@capybara-hq/plugin-sdk 0.1.0-rc.77 → 0.1.0-rc.78
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/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/native-failure.d.ts +13 -0
- package/dist/native-failure.js +31 -0
- package/dist/skill-invocation.d.ts +5 -0
- package/dist/skill-invocation.js +4 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.0-rc.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.0-rc.78";
|
|
2
2
|
export * from "./agent-template.js";
|
|
3
3
|
export * from "./avatar-presets.js";
|
|
4
4
|
export * from "./bootstrap.js";
|
|
@@ -28,6 +28,7 @@ export * from "./identity.js";
|
|
|
28
28
|
export * from "./marketplace.js";
|
|
29
29
|
export * from "./model.js";
|
|
30
30
|
export * from "./model-params.js";
|
|
31
|
+
export * from "./native-failure.js";
|
|
31
32
|
export * from "./net.js";
|
|
32
33
|
export * from "./network-classes.js";
|
|
33
34
|
export * from "./permissions.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.1.0-rc.
|
|
1
|
+
export const SDK_VERSION = "0.1.0-rc.78";
|
|
2
2
|
export * from "./agent-template.js";
|
|
3
3
|
export * from "./avatar-presets.js";
|
|
4
4
|
export * from "./bootstrap.js";
|
|
@@ -28,6 +28,7 @@ export * from "./identity.js";
|
|
|
28
28
|
export * from "./marketplace.js";
|
|
29
29
|
export * from "./model.js";
|
|
30
30
|
export * from "./model-params.js";
|
|
31
|
+
export * from "./native-failure.js";
|
|
31
32
|
export * from "./net.js";
|
|
32
33
|
export * from "./network-classes.js";
|
|
33
34
|
export * from "./permissions.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model-facing text of a failed native file operation (#907), one mapping for every native
|
|
3
|
+
* helper and provider (capybara-device, device-docker, device-e2b). A native helper answers
|
|
4
|
+
* `{ error: { code } }` with an errno name (`ENOENT`, …), `SCOPE_DENIED`, `NOT_REGULAR_FILE` or
|
|
5
|
+
* `INVALID_NATIVE_REQUEST`; its own exception text never reaches the model (it may carry paths or
|
|
6
|
+
* other details), only the kernel-defined text for the code.
|
|
7
|
+
*/
|
|
8
|
+
/** The code a native helper answers when a read or write names something other than a regular file. */
|
|
9
|
+
export declare const NATIVE_NOT_REGULAR_FILE = "NOT_REGULAR_FILE";
|
|
10
|
+
/** The text for a code this mapping does not know. */
|
|
11
|
+
export declare const NATIVE_FAILURE_GENERIC = "Native operation failed; check the path, scope and filesystem access";
|
|
12
|
+
/** The model-facing text for a native helper's error code. */
|
|
13
|
+
export declare function nativeFailureText(code: string | undefined): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model-facing text of a failed native file operation (#907), one mapping for every native
|
|
3
|
+
* helper and provider (capybara-device, device-docker, device-e2b). A native helper answers
|
|
4
|
+
* `{ error: { code } }` with an errno name (`ENOENT`, …), `SCOPE_DENIED`, `NOT_REGULAR_FILE` or
|
|
5
|
+
* `INVALID_NATIVE_REQUEST`; its own exception text never reaches the model (it may carry paths or
|
|
6
|
+
* other details), only the kernel-defined text for the code.
|
|
7
|
+
*/
|
|
8
|
+
/** The code a native helper answers when a read or write names something other than a regular file. */
|
|
9
|
+
export const NATIVE_NOT_REGULAR_FILE = "NOT_REGULAR_FILE";
|
|
10
|
+
/** The text for a code this mapping does not know. */
|
|
11
|
+
export const NATIVE_FAILURE_GENERIC = "Native operation failed; check the path, scope and filesystem access";
|
|
12
|
+
const TEXTS = {
|
|
13
|
+
[NATIVE_NOT_REGULAR_FILE]: "The path is not a regular file (it is a directory, a device or another special file); only regular files can be read or written",
|
|
14
|
+
ENOENT: "The path, or one of its parent directories, does not exist; check the path",
|
|
15
|
+
ENOTDIR: "A component of the path is not a directory; check the path",
|
|
16
|
+
EISDIR: "The path is a directory, not a file",
|
|
17
|
+
EEXIST: "The path already exists",
|
|
18
|
+
ENAMETOOLONG: "The path is too long",
|
|
19
|
+
ENOSPC: "The device's disk is full; free some space, then retry",
|
|
20
|
+
EDQUOT: "The device's disk quota is exhausted; free some space, then retry",
|
|
21
|
+
EROFS: "The path is on a read-only file system",
|
|
22
|
+
EFBIG: "The file is too large for the device's file system",
|
|
23
|
+
EBUSY: "The file is busy; retry the call",
|
|
24
|
+
ESTALE: "The file changed while it was being used; retry the call",
|
|
25
|
+
EIO: "The device's disk reported an input/output error",
|
|
26
|
+
};
|
|
27
|
+
/** The model-facing text for a native helper's error code. */
|
|
28
|
+
export function nativeFailureText(code) {
|
|
29
|
+
return ((code !== undefined && Object.hasOwn(TEXTS, code) ? TEXTS[code] : undefined) ??
|
|
30
|
+
NATIVE_FAILURE_GENERIC);
|
|
31
|
+
}
|
|
@@ -64,6 +64,11 @@ export interface RenderSkillInvocationInput {
|
|
|
64
64
|
};
|
|
65
65
|
/** false: leave out the lead sentence (a forked skill's task for the sub-agent). Default true. */
|
|
66
66
|
lead?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The skills root of the conversation's device (`SandboxRoots.skills`, e.g. a connected
|
|
69
|
+
* machine's real path), used for `${CLAUDE_SKILL_DIR}` and the files line. Default `/skills`.
|
|
70
|
+
*/
|
|
71
|
+
skillsRoot?: string;
|
|
67
72
|
}
|
|
68
73
|
/**
|
|
69
74
|
* Both `skill_invocation` wrapper tags made inert (`<\/skill_invocation`, `<\skill_invocation`, any
|
package/dist/skill-invocation.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* The argument rules follow Claude Code (re-checked 2026-10-27): `$ARGUMENTS` is the whole argument
|
|
7
7
|
* string, `$ARGUMENTS[N]` / `$N` are 0-based positional values (a missing one stays as written),
|
|
8
8
|
* `$name` takes its value from frontmatter `arguments` (a missing one becomes empty), `\$` is a
|
|
9
|
-
* literal `$`, `${CLAUDE_SKILL_DIR}` is
|
|
9
|
+
* literal `$`, `${CLAUDE_SKILL_DIR}` is `<skills root>/<name>@<digest>` (the device's skills root,
|
|
10
|
+
* default `/skills`) and every other `${…}` stays as written.
|
|
10
11
|
* When the body has no argument placeholder and the arguments are not empty, they are appended as
|
|
11
12
|
* `ARGUMENTS: <args>`. Substituted text is never scanned again. Nothing is executed: shell
|
|
12
13
|
* injections (`` !`cmd` ``) stay text, and the model is told how to run them.
|
|
@@ -183,14 +184,14 @@ const escapeAttr = (s) => s.replace(/&/g, "&").replace(/"/g, """).repla
|
|
|
183
184
|
*/
|
|
184
185
|
export function renderSkillInvocation(i) {
|
|
185
186
|
const args = trimmedArgs(i.args);
|
|
186
|
-
const body = renderSkillBody(i.body, i.invocation, args, i.skillName, i.digest).replace(CLOSE_TAG_RE, "<\\/$1");
|
|
187
|
+
const body = renderSkillBody(i.body, i.invocation, args, i.skillName, i.digest, i.skillsRoot).replace(CLOSE_TAG_RE, "<\\/$1");
|
|
187
188
|
const parts = [];
|
|
188
189
|
if (i.lead !== false) {
|
|
189
190
|
parts.push(escapeTags(`The user invoked the skill "${i.name}" with /${i.name}${args === "" ? "" : ` ${args}`}. Follow its instructions for this request.`));
|
|
190
191
|
}
|
|
191
192
|
parts.push(`<skill_invocation name="${escapeAttr(i.name)}" version="${i.version}">\n${body}\n</skill_invocation>`);
|
|
192
193
|
if (i.lines.files === "load") {
|
|
193
|
-
parts.push(`Its files are not in the sandbox yet: call Skill with "${i.name}" to copy them to ${skillSandboxDir(i.skillName, i.digest)}/ before running its scripts.`);
|
|
194
|
+
parts.push(`Its files are not in the sandbox yet: call Skill with "${i.name}" to copy them to ${skillSandboxDir(i.skillName, i.digest, i.skillsRoot)}/ before running its scripts.`);
|
|
194
195
|
}
|
|
195
196
|
else if (i.lines.files === "unavailable") {
|
|
196
197
|
parts.push("Its other files are not available in this conversation.");
|