examples/openclaw-plugin/docs/openviking-install-package-contract.md
This document records the install/package contract that the OpenViking OpenClaw plugin must keep stable.
It intentionally documents the current package contract instead of the unpublished TOS shell-script flow from #2613. Current main does not contain those TOS publishing scripts, so the safe contract is the npm/openclaw package shape that is actually built and installed by this repository.
The plugin package must include:
| Entry | Why it is required |
|---|---|
dist/ | Compiled runtime loaded by OpenClaw. |
dist/index.js | Main extension entry. |
dist/commands/setup.js | Setup entry used by OpenClaw. |
package.json | OpenClaw package metadata and runtime dependencies. |
openclaw.plugin.json | Plugin manifest. |
install-manifest.json | Install-time file contract. |
README.md, INSTALL.md, INSTALL-ZH.md | User-facing install and usage docs. |
skills/ | Packaged OpenViking skills. |
Helper modules added under plugin/ must be listed in the package files contract or included by a package-level directory rule.
package.json must keep these OpenClaw fields valid:
{
"openclaw": {
"extensions": ["./dist/index.js"],
"setupEntry": "./dist/commands/setup.js"
}
}
The setupEntry must point at compiled JavaScript, not source TypeScript.
Runtime dependencies must include everything the compiled plugin imports at runtime. Development-only test/build packages belong in devDependencies in the source manifest.
Published npm and ClawHub artifacts must remove the devDependencies field after npm ci and before npm pack. OpenClaw installs the extracted artifact as a project root, and npm install --omit=dev still resolves the root development dependency graph. Shipping that graph can therefore trigger npm Arborist peer-resolution failures even though none of those packages are needed at runtime.
The package currently keeps an axios override to avoid installing vulnerable or incompatible transitive versions through OpenClaw packaging.
install-manifest.json defines the source files and metadata required by the OpenClaw install flow. When a new runtime source module is imported by index.ts or setup code, add it to files.required.
Required entries should include core runtime modules such as:
index.tsconfig.tscontext-engine.tsclient.tsauto-recall.tsrecall-trace.tscommands/setup.tspackage.jsonopenclaw.plugin.jsonOptional entries are for files that improve the installed plugin but are not needed to load the runtime, such as lockfiles or extra docs.
Before publishing or merging package-contract changes, run:
npm test -- tests/ut/package-install-contract.test.ts
npm run typecheck
npm run build
git diff --check
The package contract test should verify:
openclaw.extensions and openclaw.setupEntry point to dist/*.js,files include runtime assets and docs,devDependencies before npm pack.The #2613 branch also contained draft TOS publishing/install notes. Those notes depend on release scripts and object-storage upload flow that are not present in current main. They should be added only with the corresponding scripts and CI/release process, not as standalone documentation.