@capybara-hq/plugin-sdk 0.1.0-rc.7 → 0.1.0-rc.71
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/README.md +1 -1
- package/agent-docs/agent-templates.md +14 -2
- package/agent-docs/concepts.md +14 -5
- package/agent-docs/connector-templates.md +11 -3
- package/agent-docs/extension-points/channel.md +1 -1
- package/agent-docs/extension-points/context.md +15 -0
- package/agent-docs/extension-points/device-provider.md +15 -0
- package/agent-docs/extension-points/file-preview.md +3 -1
- package/agent-docs/extension-points/model-provider.md +3 -1
- package/agent-docs/extension-points/object-store.md +2 -0
- package/agent-docs/extension-points/push-provider.md +17 -0
- package/agent-docs/extensions.md +77 -4
- package/agent-docs/plugin-format.md +51 -12
- package/agent-docs/setup.md +54 -0
- package/dist/agent-template.d.ts +15 -6
- package/dist/agent-template.js +32 -13
- package/dist/avatar-presets.d.ts +8 -0
- package/dist/avatar-presets.js +17 -0
- package/dist/bootstrap.d.ts +109 -1
- package/dist/bootstrap.js +185 -2
- package/dist/cards.d.ts +60 -13
- package/dist/cards.js +88 -18
- package/dist/channel.d.ts +128 -47
- package/dist/channel.js +10 -5
- package/dist/client-css.d.ts +36 -0
- package/dist/client-css.js +326 -0
- package/dist/client-section.d.ts +35 -0
- package/dist/client-section.js +133 -0
- package/dist/config-ui.d.ts +28 -6
- package/dist/config-ui.js +88 -25
- package/dist/config-url-fetch.d.ts +19 -0
- package/dist/config-url-fetch.js +43 -0
- package/dist/connector-auth.d.ts +13 -2
- package/dist/connector-auth.js +82 -8
- package/dist/connector.d.ts +74 -32
- package/dist/context.d.ts +40 -0
- package/dist/context.js +2 -0
- package/dist/ctx.d.ts +210 -30
- package/dist/ctx.js +9 -1
- package/dist/define-extension.d.ts +23 -13
- package/dist/define-extension.js +19 -5
- package/dist/device-denied-paths.d.ts +20 -0
- package/dist/device-denied-paths.js +118 -0
- package/dist/device-operation.d.ts +339 -0
- package/dist/device-operation.js +312 -0
- package/dist/device-protocol.d.ts +285 -50
- package/dist/device-protocol.js +755 -90
- package/dist/device-provider.d.ts +708 -0
- package/dist/device-provider.js +325 -0
- package/dist/device-service.d.ts +52 -0
- package/dist/device-service.js +105 -0
- package/dist/dial-in.d.ts +239 -0
- package/dist/dial-in.js +155 -0
- package/dist/directory.d.ts +15 -12
- package/dist/extension-point.d.ts +2 -0
- package/dist/extension-point.js +7 -3
- package/dist/field-meta.d.ts +19 -0
- package/dist/field-meta.js +54 -0
- package/dist/file-preview.d.ts +43 -10
- package/dist/git-hosts.d.ts +53 -0
- package/dist/git-hosts.js +98 -0
- package/dist/hooks.d.ts +125 -20
- package/dist/hooks.js +5 -0
- package/dist/http-access.d.ts +71 -0
- package/dist/http-access.js +12 -0
- package/dist/identity.d.ts +38 -9
- package/dist/identity.js +21 -1
- package/dist/index.d.ts +31 -4
- package/dist/index.js +31 -4
- package/dist/model-params.d.ts +41 -22
- package/dist/model-params.js +28 -15
- package/dist/model.d.ts +210 -75
- package/dist/model.js +152 -19
- package/dist/net.d.ts +52 -0
- package/dist/net.js +34 -0
- package/dist/network-classes.d.ts +98 -0
- package/dist/network-classes.js +291 -0
- package/dist/permissions.d.ts +65 -22
- package/dist/permissions.js +139 -43
- package/dist/platform-only.d.ts +27 -0
- package/dist/platform-only.js +35 -0
- package/dist/plugin-manifest.d.ts +40 -9
- package/dist/plugin-manifest.js +171 -60
- package/dist/plugin-package.d.ts +82 -39
- package/dist/plugin-package.js +68 -41
- package/dist/push.d.ts +75 -0
- package/dist/push.js +87 -0
- package/dist/sandbox-linux-runtime-source.d.ts +1 -0
- package/dist/sandbox-linux-runtime-source.js +2343 -0
- package/dist/sandbox-native-runtime-source.d.ts +10 -0
- package/dist/sandbox-native-runtime-source.js +476 -0
- package/dist/sandbox-runtime-source.d.ts +47 -0
- package/dist/sandbox-runtime-source.js +73 -0
- package/dist/sandbox-write-denies.d.ts +139 -0
- package/dist/sandbox-write-denies.js +869 -0
- package/dist/secret.d.ts +8 -2
- package/dist/secret.js +11 -4
- package/dist/setup-check.d.ts +128 -0
- package/dist/setup-check.js +142 -0
- package/dist/setup-guide-parse.d.ts +121 -0
- package/dist/setup-guide-parse.js +356 -0
- package/dist/setup-guide-render.d.ts +45 -0
- package/dist/setup-guide-render.js +351 -0
- package/dist/setup-guide.d.ts +86 -72
- package/dist/setup-guide.js +340 -108
- package/dist/shell-capabilities.d.ts +211 -0
- package/dist/shell-capabilities.js +44 -0
- package/dist/shell-environment.d.ts +57 -0
- package/dist/shell-environment.js +21 -0
- package/dist/skill.d.ts +27 -17
- package/dist/skill.js +40 -26
- package/dist/storage.d.ts +52 -25
- package/dist/svg-viewbox.d.ts +10 -0
- package/dist/svg-viewbox.js +24 -0
- package/dist/theme-assets.d.ts +55 -0
- package/dist/theme-assets.js +489 -0
- package/dist/theme-readability.d.ts +37 -0
- package/dist/theme-readability.js +145 -0
- package/dist/theme-tokens.generated.d.ts +299 -0
- package/dist/theme-tokens.generated.js +184 -0
- package/dist/theme.d.ts +190 -0
- package/dist/theme.js +471 -0
- package/dist/tool.d.ts +104 -30
- package/dist/tool.js +29 -9
- package/dist/ui-parts.d.ts +23 -0
- package/dist/ui-parts.js +385 -0
- package/dist/ui-resolve.d.ts +35 -0
- package/dist/ui-resolve.js +42 -0
- package/dist/ui-slots.d.ts +65 -0
- package/dist/ui-slots.js +261 -0
- package/dist/ui.d.ts +232 -77
- package/dist/ui.js +104 -27
- package/dist/url.d.ts +4 -1
- package/dist/url.js +4 -1
- package/dist/web.d.ts +26 -20
- package/package.json +13 -1
- package/schemas/bootstrap-extra.v1.schema.json +186 -0
- package/schemas/bootstrap.v1.schema.json +20 -0
- package/schemas/connector-template.v1.schema.json +62 -4
- package/schemas/plugin.v1.schema.json +93 -143
- package/schemas/theme.v1.schema.json +302 -0
- package/agent-docs/extension-points/sandbox.md +0 -15
- package/dist/org-access.d.ts +0 -27
- package/dist/org-access.js +0 -35
- package/dist/sandbox.d.ts +0 -254
- package/dist/sandbox.js +0 -153
package/dist/index.js
CHANGED
|
@@ -1,33 +1,60 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.1.0-rc.
|
|
1
|
+
export const SDK_VERSION = "0.1.0-rc.71";
|
|
2
2
|
export * from "./agent-template.js";
|
|
3
|
+
export * from "./avatar-presets.js";
|
|
3
4
|
export * from "./bootstrap.js";
|
|
4
5
|
export * from "./cards.js";
|
|
5
6
|
export * from "./channel.js";
|
|
7
|
+
export * from "./client-css.js";
|
|
8
|
+
export * from "./client-section.js";
|
|
6
9
|
export * from "./config-ui.js";
|
|
10
|
+
export * from "./config-url-fetch.js";
|
|
7
11
|
export * from "./connector.js";
|
|
8
12
|
export * from "./connector-auth.js";
|
|
13
|
+
export * from "./context.js";
|
|
9
14
|
export * from "./ctx.js";
|
|
10
15
|
export * from "./define-extension.js";
|
|
11
|
-
export
|
|
16
|
+
export { DEVICE_DEFAULT_STATE_PATH, DEVICE_DENIED_SECRET_PATHS } from "./device-denied-paths.js";
|
|
17
|
+
export * from "./device-operation.js";
|
|
18
|
+
export * from "./device-provider.js";
|
|
19
|
+
export * from "./device-service.js";
|
|
20
|
+
export * from "./dial-in.js";
|
|
12
21
|
export * from "./directory.js";
|
|
13
22
|
export * from "./extension-point.js";
|
|
14
23
|
export * from "./file-preview.js";
|
|
24
|
+
export * from "./git-hosts.js";
|
|
15
25
|
export * from "./hooks.js";
|
|
26
|
+
export * from "./http-access.js";
|
|
16
27
|
export * from "./identity.js";
|
|
17
28
|
export * from "./marketplace.js";
|
|
18
29
|
export * from "./model.js";
|
|
19
30
|
export * from "./model-params.js";
|
|
20
|
-
export * from "./
|
|
31
|
+
export * from "./net.js";
|
|
32
|
+
export * from "./network-classes.js";
|
|
21
33
|
export * from "./permissions.js";
|
|
34
|
+
export * from "./platform-only.js";
|
|
22
35
|
export * from "./plugin-manifest.js";
|
|
23
36
|
export * from "./plugin-package.js";
|
|
24
|
-
export * from "./
|
|
37
|
+
export * from "./push.js";
|
|
38
|
+
export { SANDBOX_RUNTIME_SOURCE, } from "./sandbox-runtime-source.js";
|
|
39
|
+
export { isSandboxHomeWriteDenied, isSandboxMoveDenied, isSandboxWriteDenied, SANDBOX_GIT_ALLOWED_DIRECTORIES, SANDBOX_GIT_ALLOWED_FILES, SANDBOX_GIT_DENIED_INTERNALS, SANDBOX_HOME_WRITE_DENIES, SANDBOX_MANDATORY_WRITE_DENIES, SANDBOX_PROTECTED_PATH_NAMES, SANDBOX_RESERVED_NAME_PREFIX, SANDBOX_RUNTIME_DIRECTORIES, SANDBOX_SYSTEM_WRITE_DENIES, sandboxRuntimeDirectoryOf, } from "./sandbox-write-denies.js";
|
|
25
40
|
export * from "./secret.js";
|
|
41
|
+
export * from "./setup-check.js";
|
|
26
42
|
export * from "./setup-guide.js";
|
|
43
|
+
export { parseSetupGuide, } from "./setup-guide-parse.js";
|
|
44
|
+
export * from "./setup-guide-render.js";
|
|
45
|
+
export * from "./shell-capabilities.js";
|
|
46
|
+
export * from "./shell-environment.js";
|
|
27
47
|
export * from "./skill.js";
|
|
28
48
|
export * from "./skill-invocation.js";
|
|
29
49
|
export * from "./storage.js";
|
|
50
|
+
export * from "./theme.js";
|
|
51
|
+
export * from "./theme-assets.js";
|
|
52
|
+
export * from "./theme-readability.js";
|
|
53
|
+
export * from "./theme-tokens.generated.js";
|
|
30
54
|
export * from "./tool.js";
|
|
31
55
|
export * from "./tool-key.js";
|
|
32
56
|
export * from "./ui.js";
|
|
57
|
+
export * from "./ui-parts.js";
|
|
58
|
+
export * from "./ui-resolve.js";
|
|
59
|
+
export * from "./ui-slots.js";
|
|
33
60
|
export * from "./web.js";
|
package/dist/model-params.d.ts
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `model-provider@2`
|
|
3
|
-
*
|
|
2
|
+
* Parameter declarations and validation for `model-provider@2` (pure functions; issues / error
|
|
3
|
+
* messages are in English, for logs and API responses).
|
|
4
|
+
* Each model declares in `ModelInfo.parameters` the parameters it supports; value constraints are a
|
|
5
|
+
* restricted JSON Schema subset.
|
|
4
6
|
*/
|
|
5
7
|
export type Effort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - `thinking
|
|
10
|
-
*
|
|
11
|
-
* - `
|
|
9
|
+
* Standard knobs: uniform platform semantics, rendered specially by the UI, with semantics that
|
|
10
|
+
* carry over when switching models or falling back; the plugin maps them to native parameters.
|
|
11
|
+
* - `effort`: thinking depth, `{ type: "string", enum }`, values a subset of
|
|
12
|
+
* `low|medium|high|xhigh|max`;
|
|
13
|
+
* - `thinking`: thinking mode, `{ type: "string", enum }`, values a subset of `off|on|summarized`;
|
|
14
|
+
* - `temperature`: `{ type: "number" }` (may carry a range);
|
|
15
|
+
* - `maxOutputTokens`: maximum output tokens, `{ type: "integer" }` (may carry a range).
|
|
12
16
|
*/
|
|
13
17
|
export type StandardKnob = "effort" | "thinking" | "temperature" | "maxOutputTokens";
|
|
14
18
|
export declare const STANDARD_KNOBS: readonly StandardKnob[];
|
|
15
|
-
/** `effort`
|
|
19
|
+
/** The full set of values the `effort` knob allows. */
|
|
16
20
|
export declare const EFFORT_VALUES: readonly Effort[];
|
|
17
|
-
/** `thinking`
|
|
21
|
+
/** The full set of values the `thinking` knob allows. */
|
|
18
22
|
export declare const THINKING_VALUES: readonly string[];
|
|
19
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Parameter value constraints: a restricted JSON Schema subset (serializable for the UI; the kernel
|
|
25
|
+
* validates it itself, without ajv).
|
|
26
|
+
*/
|
|
20
27
|
export type ParamSchema = {
|
|
21
28
|
type: "string";
|
|
22
29
|
enum: string[];
|
|
@@ -31,14 +38,20 @@ export type ParamSchema = {
|
|
|
31
38
|
maximum?: number;
|
|
32
39
|
};
|
|
33
40
|
export type ParamValue = string | number | boolean;
|
|
34
|
-
/**
|
|
41
|
+
/** One parameter a model declares. */
|
|
35
42
|
export interface ModelParameter {
|
|
36
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* A standard knob name (see {@link StandardKnob}), or a vendor-specific parameter `"<plugin
|
|
45
|
+
* name>.<name>"`.
|
|
46
|
+
*/
|
|
37
47
|
key: string;
|
|
38
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Required when key is a standard knob and must equal key; vendor-specific parameters must not
|
|
50
|
+
* set it.
|
|
51
|
+
*/
|
|
39
52
|
standard?: StandardKnob;
|
|
40
53
|
schema: ParamSchema;
|
|
41
|
-
/**
|
|
54
|
+
/** The value used when unset; must satisfy the schema. */
|
|
42
55
|
default?: ParamValue;
|
|
43
56
|
label: {
|
|
44
57
|
zh: string;
|
|
@@ -53,11 +66,13 @@ export interface ParamIssue {
|
|
|
53
66
|
key: string;
|
|
54
67
|
message: string;
|
|
55
68
|
}
|
|
56
|
-
/**
|
|
69
|
+
/** Returns an English reason when the value does not satisfy the schema, undefined when it does. */
|
|
57
70
|
export declare function checkParamValue(schema: ParamSchema, v: unknown): string | undefined;
|
|
58
71
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
72
|
+
* Strict validation (used when saving an agent): unknown keys, type mismatches, enum violations and
|
|
73
|
+
* out-of-range values are all errors, reported per key.
|
|
74
|
+
* On success `value` is the input parameters, with no defaults filled in; a key whose value is
|
|
75
|
+
* undefined counts as unset.
|
|
61
76
|
*/
|
|
62
77
|
export declare function validateParams(decl: ModelParameter[], params: Record<string, unknown>): {
|
|
63
78
|
ok: true;
|
|
@@ -67,16 +82,20 @@ export declare function validateParams(decl: ModelParameter[], params: Record<st
|
|
|
67
82
|
issues: ParamIssue[];
|
|
68
83
|
};
|
|
69
84
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
85
|
+
* The lenient variant (used at runtime): drops unknown or invalid entries (their keys go into
|
|
86
|
+
* `dropped`), then fills defaults for declared parameters that are unset.
|
|
87
|
+
* For the case where saved parameters are no longer valid after a plugin upgrade, so that the whole
|
|
88
|
+
* run does not fail.
|
|
72
89
|
*/
|
|
73
90
|
export declare function sanitizeParams(decl: ModelParameter[], params: Record<string, unknown>): {
|
|
74
91
|
value: Record<string, ParamValue>;
|
|
75
92
|
dropped: string[];
|
|
76
93
|
};
|
|
77
94
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
95
|
+
* Validates the parameters a plugin declares for a model: the key is a standard knob or
|
|
96
|
+
* `<plugin>.<name>`, `standard` agrees with the key,
|
|
97
|
+
* the schema belongs to the supported subset, standard knobs satisfy the value conventions,
|
|
98
|
+
* defaults satisfy the schema, copy is complete, keys do not repeat.
|
|
99
|
+
* Throws when there is a problem, with a message naming the plugin and each key (in English).
|
|
81
100
|
*/
|
|
82
101
|
export declare function assertValidDeclarations(plugin: string, decl: ModelParameter[]): void;
|
package/dist/model-params.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `model-provider@2`
|
|
3
|
-
*
|
|
2
|
+
* Parameter declarations and validation for `model-provider@2` (pure functions; issues / error
|
|
3
|
+
* messages are in English, for logs and API responses).
|
|
4
|
+
* Each model declares in `ModelInfo.parameters` the parameters it supports; value constraints are a
|
|
5
|
+
* restricted JSON Schema subset.
|
|
4
6
|
*/
|
|
5
7
|
export const STANDARD_KNOBS = [
|
|
6
8
|
"effort",
|
|
@@ -8,13 +10,13 @@ export const STANDARD_KNOBS = [
|
|
|
8
10
|
"temperature",
|
|
9
11
|
"maxOutputTokens",
|
|
10
12
|
];
|
|
11
|
-
/** `effort`
|
|
13
|
+
/** The full set of values the `effort` knob allows. */
|
|
12
14
|
export const EFFORT_VALUES = ["low", "medium", "high", "xhigh", "max"];
|
|
13
|
-
/** `thinking`
|
|
15
|
+
/** The full set of values the `thinking` knob allows. */
|
|
14
16
|
export const THINKING_VALUES = ["off", "on", "summarized"];
|
|
15
17
|
const isStandardKnob = (k) => STANDARD_KNOBS.includes(k);
|
|
16
18
|
const VENDOR_NAME = /^[A-Za-z][A-Za-z0-9_-]*$/;
|
|
17
|
-
/**
|
|
19
|
+
/** Returns an English reason when the value does not satisfy the schema, undefined when it does. */
|
|
18
20
|
export function checkParamValue(schema, v) {
|
|
19
21
|
switch (schema.type) {
|
|
20
22
|
case "boolean":
|
|
@@ -45,11 +47,16 @@ export function checkParamValue(schema, v) {
|
|
|
45
47
|
return `has unsupported schema type ${JSON.stringify(schema.type)}`;
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Looks up a declaration by key (uses a Map so that prototype properties such as `constructor` are
|
|
52
|
+
* not mistaken for declared keys).
|
|
53
|
+
*/
|
|
49
54
|
const declMap = (decl) => new Map(decl.map((d) => [d.key, d]));
|
|
50
55
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
56
|
+
* Strict validation (used when saving an agent): unknown keys, type mismatches, enum violations and
|
|
57
|
+
* out-of-range values are all errors, reported per key.
|
|
58
|
+
* On success `value` is the input parameters, with no defaults filled in; a key whose value is
|
|
59
|
+
* undefined counts as unset.
|
|
53
60
|
*/
|
|
54
61
|
export function validateParams(decl, params) {
|
|
55
62
|
const byKey = declMap(decl);
|
|
@@ -72,8 +79,10 @@ export function validateParams(decl, params) {
|
|
|
72
79
|
return issues.length > 0 ? { ok: false, issues } : { ok: true, value };
|
|
73
80
|
}
|
|
74
81
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
82
|
+
* The lenient variant (used at runtime): drops unknown or invalid entries (their keys go into
|
|
83
|
+
* `dropped`), then fills defaults for declared parameters that are unset.
|
|
84
|
+
* For the case where saved parameters are no longer valid after a plugin upgrade, so that the whole
|
|
85
|
+
* run does not fail.
|
|
77
86
|
*/
|
|
78
87
|
export function sanitizeParams(decl, params) {
|
|
79
88
|
const byKey = declMap(decl);
|
|
@@ -143,7 +152,9 @@ function schemaProblems(schema) {
|
|
|
143
152
|
return [`unsupported schema type ${JSON.stringify(s.type)}`];
|
|
144
153
|
}
|
|
145
154
|
}
|
|
146
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* The value conventions of standard knobs (checked only when the schema itself is already valid).
|
|
157
|
+
*/
|
|
147
158
|
function knobProblems(key, schema) {
|
|
148
159
|
const values = schema.type === "string" && "enum" in schema ? schema.enum : undefined;
|
|
149
160
|
switch (key) {
|
|
@@ -178,7 +189,7 @@ function textProblems(d) {
|
|
|
178
189
|
}
|
|
179
190
|
return out;
|
|
180
191
|
}
|
|
181
|
-
/**
|
|
192
|
+
/** All problems of one parameter declaration; an empty array when there are none. */
|
|
182
193
|
function declarationProblems(plugin, d) {
|
|
183
194
|
if (typeof d !== "object" || d === null)
|
|
184
195
|
return ["declaration must be an object"];
|
|
@@ -198,9 +209,11 @@ function declarationProblems(plugin, d) {
|
|
|
198
209
|
return out;
|
|
199
210
|
}
|
|
200
211
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
212
|
+
* Validates the parameters a plugin declares for a model: the key is a standard knob or
|
|
213
|
+
* `<plugin>.<name>`, `standard` agrees with the key,
|
|
214
|
+
* the schema belongs to the supported subset, standard knobs satisfy the value conventions,
|
|
215
|
+
* defaults satisfy the schema, copy is complete, keys do not repeat.
|
|
216
|
+
* Throws when there is a problem, with a message naming the plugin and each key (in English).
|
|
204
217
|
*/
|
|
205
218
|
export function assertValidDeclarations(plugin, decl) {
|
|
206
219
|
if (!Array.isArray(decl)) {
|