agents 0.31.0 → 0.32.0
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/{agent-routing-wS1TimZ_.d.ts → agent-routing-vVMA7m8Y.d.ts} +6 -6
- package/dist/agent-routing.d.ts +1 -1
- package/dist/agent-tool-types.d.ts +1 -1
- package/dist/{agent-tools-Bamxxb6Y.d.ts → agent-tools-gGXXkf1z.d.ts} +2 -2
- package/dist/agent-tools.d.ts +1 -1
- package/dist/agent-tools.js +0 -1
- package/dist/agent-tools.js.map +1 -1
- package/dist/browser/ai.js +1 -1
- package/dist/browser/tools/ai-sdk.d.ts +66 -1
- package/dist/browser/tools/ai-sdk.js +2 -2
- package/dist/browser/tools/pi.js +2 -2
- package/dist/browser/tools/tanstack-ai.d.ts +2 -2
- package/dist/browser/tools/tanstack-ai.js +2 -2
- package/dist/browser/tools/tanstack-ai.js.map +1 -1
- package/dist/{browser-tool-lGnvEBLJ.js → browser-tool-DRan7Lk6.js} +2 -2
- package/dist/{browser-tool-lGnvEBLJ.js.map → browser-tool-DRan7Lk6.js.map} +1 -1
- package/dist/catalog-BpOejOsE.js +239 -0
- package/dist/catalog-BpOejOsE.js.map +1 -0
- package/dist/catalog-BpiVV1OF.d.ts +173 -0
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat-sdk/index.d.ts +1 -1
- package/dist/chat-sdk/index.js +1 -1
- package/dist/{client-wn4-yqGz.d.ts → client-eSfgYvd3.d.ts} +2 -2
- package/dist/client.d.ts +1 -1
- package/dist/{cloudflare-Dzvc7V2N.js → cloudflare-CUUm_9q9.js} +26 -4
- package/dist/cloudflare-CUUm_9q9.js.map +1 -0
- package/dist/{do-oauth-client-provider-DfsUcpc3.d.ts → do-oauth-client-provider-DtNqv7oj.d.ts} +26 -2
- package/dist/{index-YSKgfgg9.d.ts → emitter-BJZtCVjQ.d.ts} +6 -140
- package/dist/emitter-DPOVcCln.js +15 -0
- package/dist/emitter-DPOVcCln.js.map +1 -0
- package/dist/experimental/channels/web/index.js +1 -1
- package/dist/harness/container/index.js +0 -1
- package/dist/harness/container/index.js.map +1 -1
- package/dist/harness/container/runtime/index.js +2 -2
- package/dist/harness/opencode/index.js +0 -1
- package/dist/harness/opencode/index.js.map +1 -1
- package/dist/harness/pi/index.d.ts +11 -4
- package/dist/harness/pi/index.js +43 -141
- package/dist/harness/pi/index.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -2
- package/dist/markdown-BZ-VLtA1.js +86 -0
- package/dist/markdown-BZ-VLtA1.js.map +1 -0
- package/dist/mcp/client/do-oauth-client-provider.d.ts +4 -2
- package/dist/mcp/client/do-oauth-client-provider.js +15 -1
- package/dist/mcp/client/do-oauth-client-provider.js.map +1 -1
- package/dist/mcp/client/index.d.ts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/models/pi-ai/index.js +129 -2
- package/dist/models/pi-ai/index.js.map +1 -1
- package/dist/observability/ai/index.js +1 -2
- package/dist/observability/ai/index.js.map +1 -1
- package/dist/observability/index.d.ts +170 -9
- package/dist/observability/index.js +386 -11
- package/dist/observability/index.js.map +1 -1
- package/dist/react.d.ts +2 -2
- package/dist/resource-B59OV2a2.js +325 -0
- package/dist/resource-B59OV2a2.js.map +1 -0
- package/dist/routing/index.d.ts +1 -1
- package/dist/script-CFDLTk5b.d.ts +91 -0
- package/dist/script-workspace-BpdAYq1R.d.ts +41 -0
- package/dist/serializable.d.ts +1 -1
- package/dist/skill-DRBcIBjC.d.ts +221 -0
- package/dist/skills/index.d.ts +275 -36
- package/dist/skills/index.js +265 -1534
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/runner.d.ts +37 -0
- package/dist/skills/runner.js +912 -0
- package/dist/skills/runner.js.map +1 -0
- package/dist/skills/tools/ai-sdk.d.ts +36 -0
- package/dist/skills/tools/ai-sdk.js +94 -0
- package/dist/skills/tools/ai-sdk.js.map +1 -0
- package/dist/source-9RQzlEhM.d.ts +112 -0
- package/dist/{src-BGolXG_H.js → src-DoGNJ4Ud.js} +4 -5
- package/dist/src-DoGNJ4Ud.js.map +1 -0
- package/dist/sub-routing.d.ts +1 -1
- package/dist/tool-CxKsvxjm.js.map +1 -1
- package/dist/tool-DkT_DJBm.js.map +1 -1
- package/dist/{tool-helpers-BodWi4gd.js → tool-helpers-BI7ifO2S.js} +1 -2
- package/dist/{tool-helpers-BodWi4gd.js.map → tool-helpers-BI7ifO2S.js.map} +1 -1
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +10 -258
- package/dist/vite.js.map +1 -1
- package/dist/voice/index.d.ts +1 -1
- package/dist/websockets/index.js +1 -1
- package/dist/{websockets-CyoeosdO.js → websockets-C6SJtWCJ.js} +1 -2
- package/dist/{websockets-CyoeosdO.js.map → websockets-C6SJtWCJ.js.map} +1 -1
- package/dist/workflow-types.d.ts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.js +0 -1
- package/dist/workflows.js.map +1 -1
- package/docs/harnesses/pi.md +9 -3
- package/docs/mcp-client.md +23 -1
- package/docs/mcp-servers.md +2 -2
- package/docs/observability.md +5 -3
- package/package.json +24 -15
- package/dist/ai-sdk-hW3vntnk.d.ts +0 -72
- package/dist/cloudflare-Dzvc7V2N.js.map +0 -1
- package/dist/index-iv9FTXX9.d.ts +0 -311
- package/dist/skills/compile.d.ts +0 -40
- package/dist/skills/compile.js +0 -65
- package/dist/skills/compile.js.map +0 -1
- package/dist/src-BGolXG_H.js.map +0 -1
- package/skills-module.d.ts +0 -22
package/dist/serializable.d.ts
CHANGED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
//#region src/skills/result.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The outcome of a skills operation that can fail in an expected way.
|
|
4
|
+
*
|
|
5
|
+
* Skill parsing and source I/O return failures as values instead of throwing,
|
|
6
|
+
* so a broken `SKILL.md` or an unreachable bucket never takes down the agent.
|
|
7
|
+
*
|
|
8
|
+
* @template T - The success value.
|
|
9
|
+
* @template E - The expected error.
|
|
10
|
+
*/
|
|
11
|
+
type SkillResult<T, E extends Error> =
|
|
12
|
+
| {
|
|
13
|
+
readonly ok: true;
|
|
14
|
+
readonly value: T;
|
|
15
|
+
}
|
|
16
|
+
| {
|
|
17
|
+
readonly ok: false;
|
|
18
|
+
readonly error: E;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/skills/resource.d.ts
|
|
22
|
+
declare const skillResourcePathBrand: unique symbol;
|
|
23
|
+
/**
|
|
24
|
+
* A normalized path to a file inside a skill directory, relative to the
|
|
25
|
+
* skill root (for example `references/style-guide.md`). Construct one with
|
|
26
|
+
* {@link parseSkillResourcePath}.
|
|
27
|
+
*/
|
|
28
|
+
type SkillResourcePath = string & {
|
|
29
|
+
readonly [skillResourcePathBrand]: true;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* What a skill file is for, from the spec's directory conventions:
|
|
33
|
+
* `scripts/`, `references/`, and `assets/`. Anything else is a `file`.
|
|
34
|
+
*/
|
|
35
|
+
type SkillResourceKind = "script" | "reference" | "asset" | "file";
|
|
36
|
+
/** A file bundled with a skill, without its content. */
|
|
37
|
+
interface SkillResourceInfo {
|
|
38
|
+
/** Path relative to the skill directory. */
|
|
39
|
+
readonly path: SkillResourcePath;
|
|
40
|
+
/** Role inferred from the top-level directory. */
|
|
41
|
+
readonly kind: SkillResourceKind;
|
|
42
|
+
/** How {@link SkillResource.content} is encoded. */
|
|
43
|
+
readonly encoding: "text" | "base64";
|
|
44
|
+
/** MIME type, when the extension maps to a known one. */
|
|
45
|
+
readonly mimeType?: string;
|
|
46
|
+
/** Size in bytes, when the source knows it without reading the file. */
|
|
47
|
+
readonly size?: number;
|
|
48
|
+
}
|
|
49
|
+
/** A file bundled with a skill, with its content. */
|
|
50
|
+
interface SkillResource extends SkillResourceInfo {
|
|
51
|
+
/** UTF-8 text, or base64 for binary files. */
|
|
52
|
+
readonly content: string;
|
|
53
|
+
}
|
|
54
|
+
/** A resource path that is absolute, escapes the skill, or is malformed. */
|
|
55
|
+
declare class InvalidSkillResourcePathError extends Error {
|
|
56
|
+
readonly path: string;
|
|
57
|
+
/** Stable tag for narrowing. */
|
|
58
|
+
readonly _tag: "InvalidSkillResourcePathError";
|
|
59
|
+
/** @param path - The rejected path. */
|
|
60
|
+
constructor(path: string);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Parse a path to a file inside a skill directory.
|
|
64
|
+
*
|
|
65
|
+
* @param path - Candidate path relative to the skill root.
|
|
66
|
+
* @returns The branded path, or `InvalidSkillResourcePathError` when it is
|
|
67
|
+
* empty, absolute, contains `.`/`..`/empty segments or NUL, or names
|
|
68
|
+
* `SKILL.md` itself.
|
|
69
|
+
*/
|
|
70
|
+
declare function parseSkillResourcePath(
|
|
71
|
+
path: string
|
|
72
|
+
): SkillResult<SkillResourcePath, InvalidSkillResourcePathError>;
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/skills/skill.d.ts
|
|
75
|
+
/**
|
|
76
|
+
* The Agent Skills `Skill` type and its frontmatter rules. `SKILL.md`
|
|
77
|
+
* text parsing lives in `./markdown` so code that only handles parsed
|
|
78
|
+
* skills does not load the YAML parser.
|
|
79
|
+
*
|
|
80
|
+
* The rules come from https://agentskills.io/specification, applied the way
|
|
81
|
+
* the spec's guide for agents recommends
|
|
82
|
+
* (https://agentskills.io/client-implementation/adding-skills-support):
|
|
83
|
+
* a skill that breaks a rule still loads, and each broken rule is returned
|
|
84
|
+
* as a warning. Only a skill that cannot be used is rejected: no
|
|
85
|
+
* description, no usable name, or frontmatter that is not YAML.
|
|
86
|
+
*
|
|
87
|
+
* A skill that follows the spec parses with no warnings, so authoring tools
|
|
88
|
+
* check `warnings.length === 0` before storing a skill.
|
|
89
|
+
*
|
|
90
|
+
* Frontmatter keys the spec does not define are kept in
|
|
91
|
+
* {@link Skill.extraFields}.
|
|
92
|
+
*
|
|
93
|
+
* @module
|
|
94
|
+
*/
|
|
95
|
+
declare const skillNameBrand: unique symbol;
|
|
96
|
+
/**
|
|
97
|
+
* A skill name the parser accepted. It is always a single safe path segment
|
|
98
|
+
* (no `/`, `\`, NUL, or control characters, and not `.` or `..`), so it can
|
|
99
|
+
* name a directory, a tool enum value, and a qualified resource path. A name
|
|
100
|
+
* from {@link parseSkillName}, or from a parse with no warnings, also follows
|
|
101
|
+
* the spec format.
|
|
102
|
+
*/
|
|
103
|
+
type SkillName = string & {
|
|
104
|
+
readonly [skillNameBrand]: true;
|
|
105
|
+
};
|
|
106
|
+
/** Why a `SKILL.md` or skill field broke a rule. */
|
|
107
|
+
type SkillParseErrorCode =
|
|
108
|
+
| "missing-frontmatter"
|
|
109
|
+
| "invalid-yaml"
|
|
110
|
+
| "invalid-frontmatter"
|
|
111
|
+
| "invalid-name"
|
|
112
|
+
| "name-mismatch"
|
|
113
|
+
| "invalid-description"
|
|
114
|
+
| "invalid-license"
|
|
115
|
+
| "invalid-compatibility"
|
|
116
|
+
| "invalid-metadata"
|
|
117
|
+
| "invalid-allowed-tools";
|
|
118
|
+
/**
|
|
119
|
+
* A `SKILL.md` that breaks an Agent Skills rule. Returned as the error of a
|
|
120
|
+
* failed parse, or as a warning when the skill loads anyway.
|
|
121
|
+
*/
|
|
122
|
+
declare class SkillParseError extends Error {
|
|
123
|
+
readonly code: SkillParseErrorCode;
|
|
124
|
+
/** Stable tag for narrowing. */
|
|
125
|
+
readonly _tag: "SkillParseError";
|
|
126
|
+
/**
|
|
127
|
+
* @param code - Which rule the skill broke.
|
|
128
|
+
* @param message - Human-readable explanation, safe to show to a model.
|
|
129
|
+
* @param options - The underlying cause, such as a YAML syntax error.
|
|
130
|
+
*/
|
|
131
|
+
constructor(
|
|
132
|
+
code: SkillParseErrorCode,
|
|
133
|
+
message: string,
|
|
134
|
+
options?: {
|
|
135
|
+
cause?: unknown;
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
/** A parsed Agent Skill: its frontmatter and Markdown instructions. */
|
|
140
|
+
interface Skill {
|
|
141
|
+
/** The skill's name. */
|
|
142
|
+
readonly name: SkillName;
|
|
143
|
+
/** What the skill does and when to use it. */
|
|
144
|
+
readonly description: string;
|
|
145
|
+
/** License name or a reference to a bundled license file. */
|
|
146
|
+
readonly license?: string;
|
|
147
|
+
/** Environment requirements. */
|
|
148
|
+
readonly compatibility?: string;
|
|
149
|
+
/** String key-value metadata. Empty when the skill declares none. */
|
|
150
|
+
readonly metadata: Readonly<Record<string, string>>;
|
|
151
|
+
/** Pre-approved tools from `allowed-tools`. Experimental in the spec. */
|
|
152
|
+
readonly allowedTools: readonly string[];
|
|
153
|
+
/** Frontmatter keys the spec does not define, kept verbatim. */
|
|
154
|
+
readonly extraFields: Readonly<Record<string, unknown>>;
|
|
155
|
+
/** Markdown instructions after the frontmatter. */
|
|
156
|
+
readonly body: string;
|
|
157
|
+
}
|
|
158
|
+
/** Options for {@link parseSkill}. */
|
|
159
|
+
interface ParseSkillOptions {
|
|
160
|
+
/**
|
|
161
|
+
* Name of the directory that holds this `SKILL.md`. The spec requires the
|
|
162
|
+
* skill's `name` to match it; a mismatch is a warning. A missing `name`
|
|
163
|
+
* falls back to the directory, with a warning.
|
|
164
|
+
*/
|
|
165
|
+
readonly directory?: string;
|
|
166
|
+
}
|
|
167
|
+
/** The outcome of parsing a skill. */
|
|
168
|
+
type SkillParseResult =
|
|
169
|
+
| {
|
|
170
|
+
readonly ok: true /** The parsed skill. */;
|
|
171
|
+
readonly value: Skill;
|
|
172
|
+
/**
|
|
173
|
+
* Spec rules the skill breaks but was loaded anyway. Empty for a
|
|
174
|
+
* skill that follows the spec.
|
|
175
|
+
*/
|
|
176
|
+
readonly warnings: readonly SkillParseError[];
|
|
177
|
+
}
|
|
178
|
+
| {
|
|
179
|
+
readonly ok: false;
|
|
180
|
+
readonly error: SkillParseError;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Parse a skill name against the Agent Skills spec.
|
|
184
|
+
*
|
|
185
|
+
* The name is NFKC-normalized first. It must be 1-64 characters of
|
|
186
|
+
* lowercase letters, digits, and hyphens, must not start or end with a
|
|
187
|
+
* hyphen, and must not contain `--`.
|
|
188
|
+
*
|
|
189
|
+
* @param input - The candidate name.
|
|
190
|
+
* @returns The branded name, or `SkillParseError` with code `invalid-name`.
|
|
191
|
+
*/
|
|
192
|
+
declare function parseSkillName(
|
|
193
|
+
input: string
|
|
194
|
+
): SkillResult<SkillName, SkillParseError>;
|
|
195
|
+
/**
|
|
196
|
+
* Whether a model may activate this skill on its own. Skills opt out with
|
|
197
|
+
* `disable-model-invocation: true`, as a top-level field or in `metadata`.
|
|
198
|
+
*
|
|
199
|
+
* @param skill - The parsed skill.
|
|
200
|
+
* @returns `false` when the skill disables model invocation.
|
|
201
|
+
*/
|
|
202
|
+
declare function isModelInvocable(skill: Skill): boolean;
|
|
203
|
+
//#endregion
|
|
204
|
+
export {
|
|
205
|
+
SkillParseErrorCode as a,
|
|
206
|
+
parseSkillName as c,
|
|
207
|
+
SkillResourceInfo as d,
|
|
208
|
+
SkillResourceKind as f,
|
|
209
|
+
SkillResult as h,
|
|
210
|
+
SkillParseError as i,
|
|
211
|
+
InvalidSkillResourcePathError as l,
|
|
212
|
+
parseSkillResourcePath as m,
|
|
213
|
+
Skill as n,
|
|
214
|
+
SkillParseResult as o,
|
|
215
|
+
SkillResourcePath as p,
|
|
216
|
+
SkillName as r,
|
|
217
|
+
isModelInvocable as s,
|
|
218
|
+
ParseSkillOptions as t,
|
|
219
|
+
SkillResource as u
|
|
220
|
+
};
|
|
221
|
+
//# sourceMappingURL=skill-DRBcIBjC.d.ts.map
|
package/dist/skills/index.d.ts
CHANGED
|
@@ -1,52 +1,291 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
2
|
+
a as SkillParseErrorCode,
|
|
3
|
+
c as parseSkillName,
|
|
4
|
+
d as SkillResourceInfo,
|
|
5
|
+
f as SkillResourceKind,
|
|
6
|
+
h as SkillResult,
|
|
7
|
+
i as SkillParseError,
|
|
8
|
+
l as InvalidSkillResourcePathError,
|
|
9
|
+
m as parseSkillResourcePath,
|
|
10
|
+
n as Skill,
|
|
11
|
+
o as SkillParseResult,
|
|
12
|
+
p as SkillResourcePath,
|
|
13
|
+
r as SkillName,
|
|
14
|
+
s as isModelInvocable,
|
|
15
|
+
t as ParseSkillOptions,
|
|
16
|
+
u as SkillResource
|
|
17
|
+
} from "../skill-DRBcIBjC.js";
|
|
18
|
+
import {
|
|
19
|
+
a as SkillSource,
|
|
20
|
+
i as SkillResourceNotFoundError,
|
|
21
|
+
n as ListedSkill,
|
|
22
|
+
o as SkillSourceError,
|
|
23
|
+
r as SkillListing,
|
|
24
|
+
t as InvalidSkill
|
|
25
|
+
} from "../source-9RQzlEhM.js";
|
|
26
|
+
import {
|
|
27
|
+
a as SkillDiagnostic,
|
|
28
|
+
c as formatSkillDiagnostic,
|
|
29
|
+
i as SkillCatalogResource,
|
|
30
|
+
l as loadSkillCatalog,
|
|
31
|
+
n as SkillCatalog,
|
|
32
|
+
o as SkillResourceError,
|
|
33
|
+
r as SkillCatalogEntry,
|
|
34
|
+
s as UnknownSkillError,
|
|
35
|
+
t as LoadSkillCatalogOptions,
|
|
36
|
+
u as renderSkillResource
|
|
37
|
+
} from "../catalog-BpiVV1OF.js";
|
|
38
|
+
import {
|
|
39
|
+
a as SkillScriptRunner,
|
|
40
|
+
i as SkillScriptRequest,
|
|
41
|
+
n as SkillScriptContext,
|
|
42
|
+
r as SkillScriptFile,
|
|
43
|
+
t as SkillRunContext
|
|
44
|
+
} from "../script-CFDLTk5b.js";
|
|
45
|
+
import { t as SkillScriptWorkspace } from "../script-workspace-BpdAYq1R.js";
|
|
46
|
+
|
|
47
|
+
//#region src/skills/markdown.d.ts
|
|
48
|
+
/**
|
|
49
|
+
* Parse a `SKILL.md` file.
|
|
50
|
+
*
|
|
51
|
+
* Follows the spec's guide for agents: a skill that breaks a rule still
|
|
52
|
+
* parses, with each broken rule in `warnings`. Frontmatter that only fails
|
|
53
|
+
* because of unquoted values containing `: ` (for example
|
|
54
|
+
* `description: Use when: the user asks`), which many clients accept, is
|
|
55
|
+
* read again with those values quoted. The parse fails only when the skill
|
|
56
|
+
* cannot be used: no frontmatter, YAML that still does not parse, no
|
|
57
|
+
* description, or an unsafe name.
|
|
58
|
+
*
|
|
59
|
+
* To check a skill before storing it, require `warnings` to be empty.
|
|
60
|
+
*
|
|
61
|
+
* @param markdown - The full file: YAML frontmatter, then Markdown.
|
|
62
|
+
* @param options - `directory` to check the name against.
|
|
63
|
+
* @returns The parsed skill and warnings, or a `SkillParseError`.
|
|
64
|
+
*/
|
|
65
|
+
declare function parseSkill(
|
|
66
|
+
markdown: string,
|
|
67
|
+
options?: ParseSkillOptions
|
|
68
|
+
): SkillParseResult;
|
|
69
|
+
/**
|
|
70
|
+
* Render a skill back to `SKILL.md` text.
|
|
71
|
+
*
|
|
72
|
+
* @param skill - The parsed skill.
|
|
73
|
+
* @returns Frontmatter and body that {@link parseSkill} reads back to an
|
|
74
|
+
* equal skill.
|
|
75
|
+
*/
|
|
76
|
+
declare function formatSkill(skill: Skill): string;
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/skills/workspace.d.ts
|
|
79
|
+
/**
|
|
80
|
+
* The parts of a `@cloudflare/computer` Workspace a skill source reads. A
|
|
81
|
+
* local `Workspace`, a client from `getWorkspace()`, and Think's
|
|
82
|
+
* `this.workspace` all fit.
|
|
83
|
+
*/
|
|
84
|
+
interface SkillWorkspace {
|
|
85
|
+
/** The Workspace filesystem. */
|
|
86
|
+
readonly fs: {
|
|
87
|
+
/** Walk a directory tree. */ find(
|
|
88
|
+
directory: string,
|
|
89
|
+
pattern?: string,
|
|
90
|
+
options?: {
|
|
91
|
+
exclude?: string[];
|
|
92
|
+
}
|
|
93
|
+
): Promise<
|
|
94
|
+
ReadonlyArray<{
|
|
95
|
+
path: string;
|
|
96
|
+
type: string;
|
|
97
|
+
}>
|
|
98
|
+
> /** Read a file's bytes. */;
|
|
99
|
+
readFile(path: string): Promise<ReadableStream<Uint8Array>>;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** Options for {@link workspace}. */
|
|
103
|
+
interface WorkspaceSkillSourceOptions {
|
|
104
|
+
/**
|
|
105
|
+
* Absolute directory that holds the skill directories. Defaults to
|
|
106
|
+
* `/workspace/.agents/skills`, the cross-client Agent Skills location.
|
|
107
|
+
*/
|
|
108
|
+
readonly root?: string;
|
|
109
|
+
/** Source id for diagnostics. Defaults to `workspace:<root>`. */
|
|
110
|
+
readonly id?: string;
|
|
111
|
+
}
|
|
112
|
+
/** Default skills directory inside a Workspace. */
|
|
113
|
+
declare const DEFAULT_WORKSPACE_SKILLS_ROOT = "/workspace/.agents/skills";
|
|
114
|
+
/**
|
|
115
|
+
* Create a source that reads skills from a Computer Workspace.
|
|
116
|
+
*
|
|
117
|
+
* Skills are plain files: every `<root>/<skill-name>/SKILL.md` is a skill,
|
|
118
|
+
* and the files beside it are its resources. The Workspace is read on every
|
|
119
|
+
* listing, so skills the agent or a user adds, edits, or deletes take effect
|
|
120
|
+
* the next time the catalog loads. A missing root lists no skills.
|
|
121
|
+
*
|
|
122
|
+
* @param target - The Workspace to read.
|
|
123
|
+
* @param options - Skills root and source id.
|
|
124
|
+
* @returns A source backed by the Workspace.
|
|
125
|
+
* @throws TypeError when `root` is not a normalized absolute path.
|
|
126
|
+
*/
|
|
127
|
+
declare function workspace(
|
|
128
|
+
target: SkillWorkspace,
|
|
129
|
+
options?: WorkspaceSkillSourceOptions
|
|
130
|
+
): SkillSource;
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/skills/r2.d.ts
|
|
133
|
+
/** Options for {@link r2}. */
|
|
134
|
+
interface R2SkillSourceOptions {
|
|
135
|
+
/** Key prefix that holds the skill directories, such as `skills/`. */
|
|
136
|
+
readonly prefix?: string;
|
|
137
|
+
/** Source id for diagnostics. Defaults to `r2:<prefix>`. */
|
|
138
|
+
readonly id?: string;
|
|
139
|
+
/** Only serve these skill names. Serves every skill when omitted. */
|
|
140
|
+
readonly skills?: readonly string[];
|
|
141
|
+
/**
|
|
142
|
+
* How long a bucket listing is reused before the bucket is listed again.
|
|
143
|
+
* Defaults to 60 seconds; `0` lists on every call.
|
|
144
|
+
*/
|
|
145
|
+
readonly refreshIntervalMs?: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Create a read-only source backed by an R2 bucket.
|
|
149
|
+
*
|
|
150
|
+
* The bucket holds the Agent Skills layout under `prefix`:
|
|
151
|
+
* `<prefix><skill-name>/SKILL.md`, plus any bundled files beside it.
|
|
152
|
+
*
|
|
153
|
+
* @param bucket - The R2 binding.
|
|
154
|
+
* @param options - Prefix, id, name allowlist, and listing cache interval.
|
|
155
|
+
* @returns A source that reads skills from the bucket.
|
|
156
|
+
*/
|
|
157
|
+
declare function r2(
|
|
158
|
+
bucket: R2Bucket,
|
|
159
|
+
options?: R2SkillSourceOptions
|
|
160
|
+
): SkillSource;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/skills/manifest.d.ts
|
|
163
|
+
/** Skills defined in code, for tests and small fixed sets. */
|
|
164
|
+
interface SkillManifest {
|
|
165
|
+
/** Source id used in diagnostics. */
|
|
166
|
+
readonly id: string;
|
|
167
|
+
/** The skills, in priority order. */
|
|
168
|
+
readonly skills: readonly SkillManifestEntry[];
|
|
169
|
+
/**
|
|
170
|
+
* @deprecated Ignored. Catalogs fingerprint the prompt they render, so
|
|
171
|
+
* sources no longer carry a fingerprint.
|
|
172
|
+
*/
|
|
173
|
+
readonly fingerprint?: string;
|
|
174
|
+
}
|
|
175
|
+
/** One skill in a {@link SkillManifest}, written as `SKILL.md` fields. */
|
|
176
|
+
interface SkillManifestEntry {
|
|
177
|
+
/** Spec-valid skill name. */
|
|
178
|
+
readonly name: string;
|
|
179
|
+
/** What the skill does and when to use it. */
|
|
180
|
+
readonly description: string;
|
|
181
|
+
/** Markdown instructions. */
|
|
182
|
+
readonly body: string;
|
|
183
|
+
/** License name or bundled license file. */
|
|
184
|
+
readonly license?: string;
|
|
185
|
+
/** Environment requirements. */
|
|
186
|
+
readonly compatibility?: string;
|
|
187
|
+
/**
|
|
188
|
+
* String key-value metadata. Scalar values are converted to strings, as
|
|
189
|
+
* in `SKILL.md`; nested values make the entry invalid.
|
|
190
|
+
*/
|
|
191
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
192
|
+
/** Space-separated pre-approved tools. */
|
|
193
|
+
readonly allowedTools?: string;
|
|
194
|
+
/** Files bundled with the skill. */
|
|
195
|
+
readonly resources?: readonly SkillManifestResource[];
|
|
196
|
+
/** @deprecated Ignored. */
|
|
197
|
+
readonly version?: string;
|
|
198
|
+
/** @deprecated Ignored; the entry fields define the skill. */
|
|
199
|
+
readonly rawContent?: string;
|
|
200
|
+
}
|
|
201
|
+
/** A file in a {@link SkillManifestEntry}. */
|
|
202
|
+
interface SkillManifestResource {
|
|
203
|
+
/** Path relative to the skill directory. */
|
|
204
|
+
readonly path: string;
|
|
205
|
+
/** UTF-8 text, or base64 when `encoding` is `"base64"`. */
|
|
206
|
+
readonly content: string;
|
|
207
|
+
/** Overrides the encoding inferred from the file extension. */
|
|
208
|
+
readonly encoding?: "text" | "base64";
|
|
209
|
+
/** Overrides the MIME type inferred from the file extension. */
|
|
210
|
+
readonly mimeType?: string;
|
|
211
|
+
/** Overrides the kind inferred from the top-level directory. */
|
|
212
|
+
readonly kind?: SkillResourceKind;
|
|
213
|
+
/** @deprecated Ignored; the size is the content's length. */
|
|
214
|
+
readonly size?: number;
|
|
215
|
+
/** @deprecated Ignored; scripts are always run as stored. */
|
|
216
|
+
readonly precompiled?: boolean;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Create a source from skills defined in code.
|
|
220
|
+
*
|
|
221
|
+
* Entries pass the same checks as `SKILL.md` files from other sources:
|
|
222
|
+
* broken spec rules become warnings, and entries without a usable
|
|
223
|
+
* name or description are reported as invalid. Useful for tests and for small fixed skill sets
|
|
224
|
+
* that do not need a Workspace or bucket.
|
|
225
|
+
*
|
|
226
|
+
* @param definition - The skills to serve.
|
|
227
|
+
* @returns A source that always lists the same skills.
|
|
228
|
+
*/
|
|
229
|
+
declare function manifest(definition: SkillManifest): SkillSource;
|
|
230
|
+
/**
|
|
231
|
+
* Create a source from skills defined in code.
|
|
232
|
+
*
|
|
233
|
+
* @deprecated Use {@link manifest}.
|
|
234
|
+
* @param definition - The skills to serve.
|
|
235
|
+
* @returns A source that always lists the same skills.
|
|
236
|
+
*/
|
|
237
|
+
declare const fromManifest: typeof manifest;
|
|
238
|
+
//#endregion
|
|
27
239
|
export {
|
|
240
|
+
DEFAULT_WORKSPACE_SKILLS_ROOT,
|
|
241
|
+
type InvalidSkill,
|
|
242
|
+
InvalidSkillResourcePathError,
|
|
243
|
+
type ListedSkill,
|
|
244
|
+
type LoadSkillCatalogOptions,
|
|
245
|
+
type ParseSkillOptions,
|
|
28
246
|
type R2SkillSourceOptions,
|
|
29
|
-
type
|
|
30
|
-
type
|
|
247
|
+
type Skill,
|
|
248
|
+
type SkillCatalog,
|
|
249
|
+
type SkillCatalogEntry,
|
|
250
|
+
type SkillCatalogResource,
|
|
251
|
+
type SkillDiagnostic,
|
|
252
|
+
type SkillListing,
|
|
31
253
|
type SkillManifest,
|
|
32
254
|
type SkillManifestEntry,
|
|
33
255
|
type SkillManifestResource,
|
|
34
|
-
|
|
35
|
-
|
|
256
|
+
type SkillName,
|
|
257
|
+
SkillParseError,
|
|
258
|
+
type SkillParseErrorCode,
|
|
259
|
+
type SkillParseResult,
|
|
36
260
|
type SkillResource,
|
|
37
|
-
type
|
|
261
|
+
type SkillResourceError,
|
|
262
|
+
type SkillResourceInfo,
|
|
263
|
+
type SkillResourceKind,
|
|
264
|
+
SkillResourceNotFoundError,
|
|
265
|
+
type SkillResourcePath,
|
|
266
|
+
type SkillResult,
|
|
38
267
|
type SkillRunContext,
|
|
39
268
|
type SkillScriptContext,
|
|
269
|
+
type SkillScriptFile,
|
|
40
270
|
type SkillScriptRequest,
|
|
41
271
|
type SkillScriptRunner,
|
|
272
|
+
type SkillScriptWorkspace,
|
|
42
273
|
type SkillSource,
|
|
274
|
+
SkillSourceError,
|
|
43
275
|
type SkillWorkspace,
|
|
44
|
-
|
|
45
|
-
type
|
|
46
|
-
|
|
276
|
+
UnknownSkillError,
|
|
277
|
+
type WorkspaceSkillSourceOptions,
|
|
278
|
+
formatSkill,
|
|
279
|
+
formatSkillDiagnostic,
|
|
47
280
|
fromManifest,
|
|
48
|
-
|
|
49
|
-
|
|
281
|
+
isModelInvocable,
|
|
282
|
+
loadSkillCatalog,
|
|
283
|
+
manifest,
|
|
284
|
+
parseSkill,
|
|
285
|
+
parseSkillName,
|
|
286
|
+
parseSkillResourcePath,
|
|
50
287
|
r2,
|
|
51
|
-
|
|
288
|
+
renderSkillResource,
|
|
289
|
+
workspace
|
|
52
290
|
};
|
|
291
|
+
//# sourceMappingURL=index.d.ts.map
|