@nocobase/app-plugin-agents 0.1.0-beta.3 → 0.1.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +91 -0
- package/README.md +5 -3
- package/dist/client/lib/install.js +1 -1
- package/dist/client/lib/tool-policy.d.ts +0 -2
- package/dist/client/lib/tool-policy.d.ts.map +1 -1
- package/dist/client/lib/tool-policy.js +1 -6
- package/dist/client/lib/tool-policy.js.map +1 -1
- package/dist/client/locales/en-US.d.ts +0 -9
- package/dist/client/locales/en-US.d.ts.map +1 -1
- package/dist/client/locales/en-US.js +0 -9
- package/dist/client/locales/en-US.js.map +1 -1
- package/dist/client/locales/runtimes.en-US.d.ts +1 -0
- package/dist/client/locales/runtimes.en-US.d.ts.map +1 -1
- package/dist/client/locales/runtimes.en-US.js +3 -2
- package/dist/client/locales/runtimes.en-US.js.map +1 -1
- package/dist/client/locales/runtimes.zh-CN.d.ts.map +1 -1
- package/dist/client/locales/runtimes.zh-CN.js +3 -2
- package/dist/client/locales/runtimes.zh-CN.js.map +1 -1
- package/dist/client/locales/zh-CN.d.ts.map +1 -1
- package/dist/client/locales/zh-CN.js +0 -9
- package/dist/client/locales/zh-CN.js.map +1 -1
- package/dist/client/pages/agents/agent-model.d.ts +0 -4
- package/dist/client/pages/agents/agent-model.d.ts.map +1 -1
- package/dist/client/pages/agents/agent-model.js +0 -19
- package/dist/client/pages/agents/agent-model.js.map +1 -1
- package/dist/client/pages/agents/detail/index.d.ts.map +1 -1
- package/dist/client/pages/agents/detail/index.js +2 -2
- package/dist/client/pages/agents/detail/index.js.map +1 -1
- package/dist/client/pages/agents/detail/sections.d.ts +0 -1
- package/dist/client/pages/agents/detail/sections.d.ts.map +1 -1
- package/dist/client/pages/agents/detail/sections.js +2 -33
- package/dist/client/pages/agents/detail/sections.js.map +1 -1
- package/dist/client/pages/runtimes/connect.js +1 -1
- package/dist/client/pages/runtimes/connect.js.map +1 -1
- package/dist/database/migrations/.manifest.json +4 -0
- package/dist/database/migrations/202610100001_ag_index_run_event_types.d.ts +4 -0
- package/dist/database/migrations/202610100001_ag_index_run_event_types.d.ts.map +1 -0
- package/dist/database/migrations/202610100001_ag_index_run_event_types.js +17 -0
- package/dist/database/migrations/202610100001_ag_index_run_event_types.js.map +1 -0
- package/dist/package.json +1 -1
- package/dist/server/core/runs/run.service.d.ts +2 -2
- package/dist/server/core/runs/run.service.d.ts.map +1 -1
- package/dist/server/core/runs/run.service.js +8 -2
- package/dist/server/core/runs/run.service.js.map +1 -1
- package/dist/server/distribution/dist.service.d.ts +27 -5
- package/dist/server/distribution/dist.service.d.ts.map +1 -1
- package/dist/server/distribution/dist.service.js +41 -5
- package/dist/server/distribution/dist.service.js.map +1 -1
- package/dist/server/distribution/download-tokens.d.ts +1 -1
- package/dist/server/distribution/download-tokens.d.ts.map +1 -1
- package/dist/server/distribution/download-tokens.js +7 -4
- package/dist/server/distribution/download-tokens.js.map +1 -1
- package/dist/server/distribution/index.d.ts +11 -3
- package/dist/server/distribution/index.d.ts.map +1 -1
- package/dist/server/distribution/index.js +31 -8
- package/dist/server/distribution/index.js.map +1 -1
- package/dist/server/routes/admin.d.ts.map +1 -1
- package/dist/server/routes/admin.js +3 -3
- package/dist/server/routes/admin.js.map +1 -1
- package/dist/server/routes/runners/dist.d.ts +5 -1
- package/dist/server/routes/runners/dist.d.ts.map +1 -1
- package/dist/server/routes/runners/dist.js +36 -9
- package/dist/server/routes/runners/dist.js.map +1 -1
- package/dist/server/routes/runners/install.d.ts.map +1 -1
- package/dist/server/routes/runners/install.js +98 -15
- package/dist/server/routes/runners/install.js.map +1 -1
- package/dist/server/routes/runners/runner.js +4 -4
- package/dist/server/routes/runners/runner.js.map +1 -1
- package/dist/server/routes/schemas.d.ts +3 -1
- package/dist/server/routes/schemas.d.ts.map +1 -1
- package/dist/server/routes/schemas.js +16 -2
- package/dist/server/routes/schemas.js.map +1 -1
- package/dist/server/tokens.d.ts +1 -1
- package/dist/server/tokens.d.ts.map +1 -1
- package/dist/server/tokens.js.map +1 -1
- package/dist/server/vendor/just-bash.js +117 -117
- package/package.json +12 -12
- package/skills/nocobase-app-plugin-agents/SKILL.md +1 -1
- package/skills/nocobase-app-plugin-agents/references/distribution.md +21 -4
- package/skills/nocobase-app-plugin-agents/references/setup-and-config.md +2 -0
- package/skills/nocobase-app-plugin-agents/references/verification-and-troubleshooting.md +4 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@nocobase/app-plugin-agents",
|
|
3
3
|
"displayName": "Agents",
|
|
4
4
|
"description": "Agents for NocoBase applications: agents, the model services online agents call, their runs and conversations, and the runners people connect to run them (registration, the long-poll claim, slots, the sweeper, build jobs, and the runner and CLI tarballs the application serves).",
|
|
5
|
-
"version": "0.1.0-beta.
|
|
5
|
+
"version": "0.1.0-beta.5",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"prettier": "@nocobase/dev-config/prettier",
|
|
8
8
|
"engines": {
|
|
@@ -143,8 +143,8 @@
|
|
|
143
143
|
"sqlite-vec": "^0.1.9",
|
|
144
144
|
"yaml": "^2.9.0",
|
|
145
145
|
"zod": "^4.6.5",
|
|
146
|
-
"@nocobase/agent-protocol": "^0.1.0-beta.
|
|
147
|
-
"@nocobase/app-cli-client": "^0.1.0-beta.
|
|
146
|
+
"@nocobase/agent-protocol": "^0.1.0-beta.3",
|
|
147
|
+
"@nocobase/app-cli-client": "^0.1.0-beta.2",
|
|
148
148
|
"@nocobase/cli-envelope": "^0.1.0-beta.0"
|
|
149
149
|
},
|
|
150
150
|
"peerDependencies": {
|
|
@@ -160,15 +160,15 @@
|
|
|
160
160
|
"react-router": "^7.0.2",
|
|
161
161
|
"recharts": "^3.8.0",
|
|
162
162
|
"remark-gfm": "^4.0.1",
|
|
163
|
-
"@nocobase/app-cli": "^1.0.0-beta.
|
|
164
|
-
"@nocobase/app-client": "^
|
|
165
|
-
"@nocobase/app-plugin-authentication": "^2.0.0-beta.
|
|
166
|
-
"@nocobase/app-plugin-authorization": "^1.0.0-beta.
|
|
167
|
-
"@nocobase/app-plugin-file": "^1.0.0-beta.
|
|
168
|
-
"@nocobase/app-server": "^2.0.0-beta.
|
|
163
|
+
"@nocobase/app-cli": "^1.0.0-beta.18",
|
|
164
|
+
"@nocobase/app-client": "^3.0.0-beta.0",
|
|
165
|
+
"@nocobase/app-plugin-authentication": "^2.0.0-beta.4",
|
|
166
|
+
"@nocobase/app-plugin-authorization": "^1.0.0-beta.26",
|
|
167
|
+
"@nocobase/app-plugin-file": "^1.0.0-beta.22",
|
|
168
|
+
"@nocobase/app-server": "^2.0.0-beta.3",
|
|
169
169
|
"@nocobase/authorization": "^1.0.0-beta.12",
|
|
170
170
|
"@nocobase/db": "^1.0.0-beta.18",
|
|
171
|
-
"@nocobase/i18n": "^1.0.0-beta.
|
|
171
|
+
"@nocobase/i18n": "^1.0.0-beta.6",
|
|
172
172
|
"@nocobase/markdown-mermaid": "^0.1.0-beta.1",
|
|
173
173
|
"@nocobase/service-provider": "^0.0.2-beta.1"
|
|
174
174
|
},
|
|
@@ -185,10 +185,10 @@
|
|
|
185
185
|
"react-dom": "^19.2.8",
|
|
186
186
|
"typescript": "^6.0.3",
|
|
187
187
|
"vitest": "^4.1.10",
|
|
188
|
-
"@nocobase/app-testing": "0.1.0-beta.
|
|
188
|
+
"@nocobase/app-testing": "0.1.0-beta.2",
|
|
189
189
|
"@nocobase/db-postgres": "0.1.0-beta.3",
|
|
190
190
|
"@nocobase/db-sqlite": "0.1.0-beta.4",
|
|
191
|
-
"@nocobase/dev-config": "0.1.0-beta.
|
|
191
|
+
"@nocobase/dev-config": "0.1.0-beta.21",
|
|
192
192
|
"@nocobase/jobs": "0.1.0-beta.2"
|
|
193
193
|
},
|
|
194
194
|
"scripts": {
|
|
@@ -18,7 +18,7 @@ The package README is the full reference: read it at `node_modules/@nocobase/app
|
|
|
18
18
|
- Variables and model service keys are sealed with the App's secrets service: configure `secrets.keys` before storing any, or the API answers `SECRETS_KEY_MISSING` (503).
|
|
19
19
|
- The plugin registers no pages. The App routes the exported pages and mounts the chat; the App also binds `agentsAccessToken`, or every business action level is `none`.
|
|
20
20
|
- `subjects.register`'s `context.assemble`, brief sections and mounts run inside the claim's transaction: database reads only, never a network or a model call. Read anything else in the optional `prepare(run)`.
|
|
21
|
-
- Tarballs are built by `pnpm nocobase cli build` (the App's CLI) and `cli build --runner` (`nocobase-runner`) as separate CI artifacts
|
|
21
|
+
- Tarballs are built by `pnpm nocobase cli build` (the App's CLI) and `cli build --runner` (`nocobase-runner`), either as separate CI artifacts mounted into `storage/runners/dist` (or `agents.dist.dir`), or by the App's own `pnpm build` into its build output (universal packages, at the versions it was built with) and served from there. Never commit them.
|
|
22
22
|
- In examples, name the App's CLI after the App (`acme`), never `nocobase` or `nocobase-runner`.
|
|
23
23
|
|
|
24
24
|
## References
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Distribution: the CLI and runner tarballs
|
|
2
2
|
|
|
3
|
-
The App serves two products itself
|
|
3
|
+
The App serves two products itself: its own CLI (the `nocobase.cli.bin` of its `package.json`, such as `acme`) and the runner, `nocobase-runner`, each as standalone tarballs that bundle Node.js, one per platform, or as one universal tarball without Node that runs on the machine's own Node.js 24 or newer on every platform. An App that serves no tarball of a product may instead name the exact npm version to install it from ("Naming a product on npm instead" below), as NocoBase Studio does. The README's "What it does" (Distribution) and "The CLI runs get" sections, and `@nocobase/app-cli`'s README section "The application's own CLI: `cli build` and `cli link`", are the reference.
|
|
4
4
|
|
|
5
5
|
## Building
|
|
6
6
|
|
|
@@ -10,6 +10,7 @@ pnpm nocobase cli build --runner # nocobase-runner, from @nocobase/agent-run
|
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
- `--targets` takes a comma-separated list; the default is `darwin-arm64,darwin-x64,linux-x64,linux-arm64`. Windows is not supported.
|
|
13
|
+
- `--universal` also packs `<product>-v<version>-universal.tar.gz`, which carries no Node.js and runs on the machine's Node.js 24 or newer; without `--targets` it packs only that one (no Node download). The App serves it to every platform without a tarball of its own; one built for the platform wins.
|
|
13
14
|
- Node.js for each target is downloaded from nodejs.org and checked against `SHASUMS256.txt` (cached in `node_modules/.cache/nocobase-cli/node`). `--node-version` picks the version (default: the one running the command). `--host-node` uses this machine's Node.js for its own platform instead of downloading, for a quick local build: `pnpm nocobase cli build --targets darwin-arm64 --host-node`.
|
|
14
15
|
- `--out` (default `storage/runners/dist`), `--channel` (default `stable`), `--version` (default `nocobase.cli.version`, else the App's version; with `--runner`, the runner's), `--skip-build`, `--keep-staging`.
|
|
15
16
|
- The App needs `@nocobase/app-cli-client` in its `devDependencies` for the CLI and `@nocobase/agent-runner` for the runner; `npm`, `pnpm` and `tar` come from the environment.
|
|
@@ -23,11 +24,22 @@ Each product lands in a directory of its own, with a manifest of every file's SH
|
|
|
23
24
|
|
|
24
25
|
## Serving
|
|
25
26
|
|
|
26
|
-
The plugin serves `agents.dist.dir` (default `storage/runners/dist`, relative to the App root), channel `agents.dist.channel` (default `stable`). A product's current version is the highest in the channel, unless `agents.dist.versions` pins one. Only files a manifest lists are served. Routes (`DIST_ROUTES` of `@nocobase/agent-protocol`): `GET /api/agents/dist/manifest`, `GET /api/agents/dist/products/<product>/targets/<target>` (`?format=env` for a shell; 404 `PLATFORM_UNSUPPORTED` with the targets there are), the tarball itself, and `POST /api/agents/dist/downloadTokens`.
|
|
27
|
+
The plugin serves `agents.dist.dir` (default `storage/runners/dist`, relative to the App root), channel `agents.dist.channel` (default `stable`). A product's current version is the highest in the channel, unless `agents.dist.versions` pins one. Only files a manifest lists are served. Routes (`DIST_ROUTES` of `@nocobase/agent-protocol`): `GET /api/agents/dist/manifest`, `GET /api/agents/dist/products/<product>/targets/<target>` (`?format=env` for a shell; 404 `PLATFORM_UNSUPPORTED` with the targets there are; the universal tarball answers with the asked target and `universal: true`, `universal=true` in env form), the tarball itself, and `POST /api/agents/dist/downloadTokens`.
|
|
28
|
+
|
|
29
|
+
### Naming a product on npm instead
|
|
30
|
+
|
|
31
|
+
`agents.dist.npm` names the npm package and exact version (never a range) of a product, such as `{ nocobase-runner: { package: '@nocobase/agent-runner', version: 1.0.0 } }`. It is used only when `agents.dist.dir` has no current version of that product; a product the directory has is served from it exactly as without the setting. The machine needs Node.js 24 or later already; nothing bundles it on this path.
|
|
32
|
+
|
|
33
|
+
Only callers that say they understand the answer get it, so an older runner, install script or CLI never sees one:
|
|
34
|
+
|
|
35
|
+
- The resolve route with `accept=npm` (a comma-separated list) answers `{ kind: 'npm', product, version, package, channel }`, or with `format=env` the lines `kind=npm`, `product=`, `version=`, `package=` and `channel=`. Without it, such a product is 404 as before.
|
|
36
|
+
- A heartbeat answer carries `npmUpgrade` (`latestVersion`, `package`, `channel`, `reason`) instead of `upgrade` only to a runner that declares the `npm` feature (protocol 8) and runs an older version; any other runner is offered no update for that product. The Runtimes page marks only those runners "Upgradable".
|
|
37
|
+
|
|
38
|
+
An App that builds its runner and CLI into its deployment pins them to the versions it was built with this way, so redeploying it moves every runner to that version.
|
|
27
39
|
|
|
28
40
|
## CI and deployment
|
|
29
41
|
|
|
30
|
-
|
|
42
|
+
There are two ways to deliver the packages. When the runner and CLI follow the App's own releases, build them with the App: an `afterServerBuild` build hook in `cli/plugins.ts` runs `pnpm nocobase cli build --universal --skip-build --out dist/runners` (and the same with `--runner`), and `agents.dist.dir` in the App's configuration points at that directory, so every build, archive and image serves the runner and CLI it was built with; universal packages keep the build small, and `cli build` needs the npm registry for their dependencies. NocoBase Studio does this. Otherwise build the two products as separate artifacts in CI, one job each (`pnpm nocobase cli build --out output/dist` and `pnpm nocobase cli build --runner --out output/dist`, uploading `output/dist`), and mount or copy each into the deployment's `storage/runners/dist` (or the directory `agents.dist.dir` names), keeping the `<channel>/<product>/` layout. Rebuild the runner whenever `@nocobase/agent-runner` or the agents plugin is upgraded, so runners can update to a version that speaks the App's protocol, and rebuild the CLI whenever the App's `nocobase.cli` or its CLI skills change.
|
|
31
43
|
|
|
32
44
|
## Installing on a machine
|
|
33
45
|
|
|
@@ -43,10 +55,15 @@ curl -fsSL https://app.example.com/api/agents/dist/installScript | sh -s -- --ru
|
|
|
43
55
|
|
|
44
56
|
Options: `--prefix`, `--bin-dir`, `--dry-run`; with `--runner`, `--runner-prefix`, `--name`, `--label` and `--no-service` (register only). A token of the other kind fails before anything is installed. An App that serves no CLI still installs the runtime.
|
|
45
57
|
|
|
58
|
+
For a universal tarball the script checks, before downloading, that `node` on PATH is Node.js 24 or newer and stops with how to install it otherwise; it then links `<prefix>/node` to that `node`. The package's launcher tries `NOCOBASE_NODE`, `<prefix>/node`, `node` on PATH, and a Node an older standalone version in `<prefix>/versions/` still carries, so a runner's user service (launchd, systemd), whose PATH usually has no `node`, starts it. An update to a universal version leaves the Node it ran on in `<prefix>/node` before removing old versions. With `--runner`, a missing `pnpm` only prints a hint to run `corepack enable`.
|
|
59
|
+
|
|
60
|
+
The script resolves with `accept=npm`. For an npm answer it checks Node.js 24 the same way and that `npm` is on PATH (or `NOCOBASE_NPM` names one), stopping with how to get it otherwise, then runs `npm install --prefix <prefix>/versions/<version>.partial --no-save --no-audit --no-fund --omit=optional <package>@<version>` with the npm configuration (registry, proxy) of the person running it, writes a launcher at `bin/<command>` beside `node_modules`, renames the directory to `<prefix>/versions/<version>` and links `<prefix>/node`. `current`, the command link and the runner's service are then exactly as for a tarball. `--omit=optional` keeps the coding tools' per-platform SDK packages, each carrying a binary the runner never starts, off the machine.
|
|
61
|
+
|
|
46
62
|
## Updates
|
|
47
63
|
|
|
48
|
-
- The runner reports its product and version on every heartbeat; the answer names a newer `nocobase-runner` when the channel serves one for its platform. An installed runner started by its service updates itself between runs; `nocobase-runner update` does it now (`--check` only checks, `--auto on|off` switches automatic updates). The Runtimes page marks such a runner "Upgradable".
|
|
64
|
+
- The runner reports its product and version on every heartbeat; the answer names a newer `nocobase-runner` when the channel serves one for its platform (`upgrade`), or the npm version `agents.dist.npm` pins (`npmUpgrade`, to runners with the `npm` feature). An installed runner started by its service updates itself between runs; `nocobase-runner update` does it now (`--check` only checks, `--auto on|off` switches automatic updates). The Runtimes page marks such a runner "Upgradable".
|
|
49
65
|
- The App's CLI, installed by the script, has `<cli> update`, and says on stderr when a newer version is served.
|
|
66
|
+
- Both ask with `accept=npm` and install an npm answer into `<prefix>/versions/<version>` the way the install script does, with the machine's npm; an installation moves between tarball and npm versions in either direction. The runner and `@nocobase/app-cli-client` depend on exactly the `@nocobase/agent-protocol` they were built with, so an exact npm version speaks one known protocol.
|
|
50
67
|
- A run gets the App's CLI as `agents.cli.package` says: by default the tarball the App serves for the runner's platform (`{ kind: served }`), downloaded once per version. A runner without the `archives` feature, or a platform with no build, falls back to the CLI installed beside it (`preinstalled`). `{ kind: npm, package, version }` names an npm package instead.
|
|
51
68
|
|
|
52
69
|
## The npm package as an alternative
|
|
@@ -35,6 +35,8 @@ agents:
|
|
|
35
35
|
dir: storage/runners/dist # the default; relative to the App root
|
|
36
36
|
channel: stable
|
|
37
37
|
versions: { acme: 0.1.0 } # pin a product instead of the channel's highest
|
|
38
|
+
npm: # a product with no tarball in dir, named on npm instead (exact versions)
|
|
39
|
+
nocobase-runner: { package: '@nocobase/agent-runner', version: 1.0.0 }
|
|
38
40
|
server: # online agents, run by every instance
|
|
39
41
|
enabled: true
|
|
40
42
|
maxSteps: 16
|
|
@@ -22,6 +22,10 @@ Test what the App builds on the plugin, not the plugin itself. `@nocobase/app-pl
|
|
|
22
22
|
| Vectors | `vectors.status()` on `agentsToken`: availability, store and the `VectorUnavailableCode` |
|
|
23
23
|
| The runner itself | `nocobase-runner status`, `nocobase-runner logs -f [--run <id>]`, `~/.nocobase-runner/policy.json` |
|
|
24
24
|
|
|
25
|
+
## Filtering a run transcript
|
|
26
|
+
|
|
27
|
+
`GET /api/agents/runs/:runId/events` accepts repeated `type` query parameters (for example, `?type=text&type=input`). The generated `run events` command exposes repeatable `--type` flags. Values are raw protocol event types, not UI groups: `text`, `thinking`, `toolUse`, `toolResult`, `permission`, `input`, `checkout`, `status`, `error`, `usage`. Omitting the filter returns every type. The service equivalent is `agents.runs.events(runId, afterSeq, limit, types?)`. Filtering happens before pagination; retain the same types with `pageToken` or the returned `lastSeq`. These API/CLI filters are exact and do not automatically include errors. A UI that summarizes hidden events must load the complete history and filter locally.
|
|
28
|
+
|
|
25
29
|
## Troubleshooting
|
|
26
30
|
|
|
27
31
|
| Symptom | Cause and fix |
|