@capybara-hq/plugin-sdk 0.1.0-rc.34 → 0.1.0-rc.35
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/agent-docs/concepts.md +9 -4
- package/agent-docs/extension-points/sandbox.md +1 -1
- package/agent-docs/plugin-format.md +1 -1
- package/dist/hooks.d.ts +13 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/model.d.ts +4 -3
- package/package.json +1 -1
package/agent-docs/concepts.md
CHANGED
|
@@ -52,10 +52,15 @@ When a person cannot do something themselves (install a plugin that is not on in
|
|
|
52
52
|
approve extension permissions), they file a **request**. Org admins or the super admin decide it
|
|
53
53
|
on the web. Agents can file requests but never decide them.
|
|
54
54
|
|
|
55
|
-
##
|
|
56
|
-
|
|
57
|
-
Agents run commands and keep files
|
|
58
|
-
|
|
55
|
+
## Devices
|
|
56
|
+
|
|
57
|
+
Agents run commands and keep files on a **device**: one instance plus a file system that is kept
|
|
58
|
+
until the device is deleted. A device is a cloud sandbox (from the deployment's sandbox provider)
|
|
59
|
+
or a machine connected with `capybara-device`, and the conversations that use it share its files.
|
|
60
|
+
A device runs in one of two modes: auto (the environment's own capability) or sandbox (an OS
|
|
61
|
+
sandbox with an allowlist network). Skill files are read-only in the device's skills directory;
|
|
62
|
+
each conversation is told the device's directories, mode and network. Sandbox limits and the
|
|
63
|
+
cloud network are set per org by admins.
|
|
59
64
|
|
|
60
65
|
## What agents may not do
|
|
61
66
|
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
Contract: SandboxProvider (`sandbox.ts`)
|
|
12
12
|
|
|
13
|
-
The kernel accepts only `sandbox@2`. A device is one instance plus a file system that outlives it. Implement the file system (`createFileSystem`, `destroyFileSystem`, `destroyFileSystemByName`), the instance on it (`create`, which throws `FileSystemGoneError` when the file system is gone instead of making an empty one; `resume`, `suspend`; `destroy` and `destroyByName`, which drop the instance and keep the files), and the instance's `exec`, `readFile`, `writeFile`, `stat`, `killAll` and `killTagged` (`concurrentExec` is required: several conversations share one instance). Aborting a command must kill it. Locking, suspension timing and destruction are the kernel's job, not yours.
|
|
13
|
+
The kernel accepts only `sandbox@2`. A device is one instance plus a file system that outlives it. Implement the file system (`createFileSystem`, `destroyFileSystem`, `destroyFileSystemByName`), the instance on it (`create`, which throws `FileSystemGoneError` when the file system is gone instead of making an empty one; `resume`, `suspend`; `destroy` and `destroyByName`, which drop the instance and keep the files), and the instance's `exec`, `readFile`, `writeFile`, `stat`, `killAll` and `killTagged` (`concurrentExec` is required: several conversations share one instance). Aborting a command must kill it. Locking, suspension timing and destruction are the kernel's job, not yours.
|
|
14
14
|
|
|
15
15
|
See `extensions` for the rules every extension follows.
|
|
@@ -59,7 +59,7 @@ Rules that the schema cannot show:
|
|
|
59
59
|
by `parseThemeFile` (schema `https://capybarahq.com/schemas/theme.v1.schema.json`).
|
|
60
60
|
- `setupGuides` (at most 8): `{ id, place, template? }`. Each guide is a Markdown document at
|
|
61
61
|
`guides/<id>.md` (English, required) and `guides/<id>.zh.md` (Chinese, optional), shown where a
|
|
62
|
-
person sets up what the plugin brings. `place` is `channel-connection` (
|
|
62
|
+
person sets up what the plugin brings. `place` is `channel-connection` (New channel and the channel
|
|
63
63
|
detail; the extension must provide `channel@1`; one per plugin) or `connector-template`
|
|
64
64
|
(`template` names one of the plugin's `connectors/<id>.json`; one per template). See "Setup
|
|
65
65
|
guides" below.
|
package/dist/hooks.d.ts
CHANGED
|
@@ -39,9 +39,11 @@ export interface HookScope {
|
|
|
39
39
|
* that writes a conversation's title after its first completed run (no run: `runId` is "", `step` 0,
|
|
40
40
|
* `attempt` 1), `web_fetch` is the call that extracts an answer from a fetched web page for the
|
|
41
41
|
* `WebFetch` tool, `review` is the command-review classifier's call (`review` purpose, no run
|
|
42
|
-
* step; absent = no classifier)
|
|
42
|
+
* step; absent = no classifier), `suggestion` is the prompt suggestion side request after a
|
|
43
|
+
* completed web run (`runId` the run, `step` 0, `attempt` 1; a denial skips it and is recorded only
|
|
44
|
+
* in the audit log).
|
|
43
45
|
*/
|
|
44
|
-
export type ModelCallPurpose = "step" | "compaction" | "title" | "web_fetch" | "review" | "image";
|
|
46
|
+
export type ModelCallPurpose = "step" | "compaction" | "title" | "web_fetch" | "review" | "image" | "suggestion";
|
|
45
47
|
/**
|
|
46
48
|
* What a reported or requested model call was for: the {@link ModelCallPurpose} values, or
|
|
47
49
|
* `embedding` for an embedding call an extension made through `ctx.models` (`usage.report`, and
|
|
@@ -86,8 +88,10 @@ export type HookModelRequest = Omit<ModelRequest, "messages"> & {
|
|
|
86
88
|
* `model.request` of a chat model call (see {@link ModelRequestHookPayload}): once per attempt of a
|
|
87
89
|
* step (`purpose: "step"`), once for each compaction call (`purpose: "compaction"`, `attempt` 1),
|
|
88
90
|
* once for each conversation title call (`purpose: "title"`, `runId` "", `step` 0, `attempt` 1; a
|
|
89
|
-
* denial skips the title and is recorded only in the audit log)
|
|
90
|
-
* extraction call (`purpose: "web_fetch"`)
|
|
91
|
+
* denial skips the title and is recorded only in the audit log), once for each `WebFetch`
|
|
92
|
+
* extraction call (`purpose: "web_fetch"`) and once for each prompt suggestion call
|
|
93
|
+
* (`purpose: "suggestion"`, `step` 0, `attempt` 1; a denial skips the suggestion and is recorded
|
|
94
|
+
* only in the audit log).
|
|
91
95
|
* `request` is the request as sent, except that images and documents are placeholders
|
|
92
96
|
* ({@link HookMediaPlaceholder}): no media bytes, no attachment ids.
|
|
93
97
|
*/
|
|
@@ -198,10 +202,11 @@ export interface ImageResponseHookPayload {
|
|
|
198
202
|
export type ModelRequestHookPayload = ModelCallRequestHookPayload | EmbeddingRequestHookPayload | ImageRequestHookPayload;
|
|
199
203
|
/**
|
|
200
204
|
* `model.response`: after a sent model call finished or failed, with its usage when known (step
|
|
201
|
-
* attempts, compaction and
|
|
202
|
-
* stopped while the call was in flight), nor for a call that was never sent
|
|
203
|
-
* before sending), so a `model.request` can have no matching `model.response`.
|
|
204
|
-
* is this or, for an image generation call, an
|
|
205
|
+
* attempts, compaction, title and suggestion calls, see `purpose`). Not fired for a call the user
|
|
206
|
+
* aborted (the run was stopped while the call was in flight), nor for a call that was never sent
|
|
207
|
+
* (denied, or failed before sending), so a `model.request` can have no matching `model.response`.
|
|
208
|
+
* The mount's payload is this or, for an image generation call, an
|
|
209
|
+
* {@link ImageResponseHookPayload}.
|
|
205
210
|
*/
|
|
206
211
|
export interface ModelResponseHookPayload extends HookScope {
|
|
207
212
|
purpose: Exclude<ModelCallPurpose, "image">;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/model.d.ts
CHANGED
|
@@ -255,9 +255,10 @@ export interface ModelRequest {
|
|
|
255
255
|
*/
|
|
256
256
|
params: Record<string, ParamValue>;
|
|
257
257
|
/**
|
|
258
|
-
* What this call is for, when the kernel says so: `"compaction"` for a conversation summary call
|
|
259
|
-
* Absent on ordinary step calls. Informational (a
|
|
260
|
-
* ignore it and must not forward it to a vendor
|
|
258
|
+
* What this call is for, when the kernel says so: `"compaction"` for a conversation summary call,
|
|
259
|
+
* `"suggestion"` for a prompt suggestion call. Absent on ordinary step calls. Informational (a
|
|
260
|
+
* scripted test model keys on it); real providers ignore it and must not forward it to a vendor
|
|
261
|
+
* API.
|
|
261
262
|
*/
|
|
262
263
|
purpose?: ModelCallPurpose;
|
|
263
264
|
}
|