@webskill/sdk 0.0.6 → 0.1.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.
@@ -1,394 +1,5 @@
1
- //#region ../core/dist/index.d.ts
2
- //#region src/errors.d.ts
3
- type WebSkillErrorCode = 'FS_NOT_FOUND' | 'FS_PATH_OUTSIDE_ROOT' | 'SKILL_NOT_FOUND' | 'SKILL_INVALID_METADATA' | 'SKILL_INVALID_NAME' | 'SKILL_DUPLICATE_NAME' | 'SKILL_UNSUPPORTED_SCRIPT' | 'VALIDATION_FAILED' | 'TOOL_NOT_FOUND' | 'TOOL_EXECUTION_FAILED' | 'NETWORK_BLOCKED' | 'TOOL_UNSUPPORTED' | 'TOOL_SCHEMA_UNAVAILABLE' | 'RUN_TIMEOUT' | 'RUN_MAX_TURNS_EXCEEDED' | 'RUN_FAILED' | 'RUN_CANCELLED' | 'RUN_INTERACTION_TIMEOUT' | 'UI_UNAVAILABLE' | 'LLM_UNAVAILABLE' | 'LLM_REQUEST_FAILED' | 'INSTALL_FAILED' | 'UNINSTALL_FAILED' | 'EXPORT_FAILED' | 'INTEGRITY_FAILED' | 'FS_PERMISSION_DENIED' | 'MCP_ENDPOINT_UNAVAILABLE' | 'MCP_TOOL_NOT_FOUND' | 'CANDIDATE_INVALID' | 'APPROVAL_REQUIRED' | 'SKILL_QUARANTINED' | 'SKILL_DISABLED' | 'GOVERNANCE_FAILED' | 'RUN_SNAPSHOT_NOT_FOUND' | 'RUN_SNAPSHOT_EXPIRED' | 'RUN_SNAPSHOT_INCOMPATIBLE';
4
- /** 所有公开 API 抛出的结构化错误,code 供上层可编程处理 */
5
- declare class WebSkillError extends Error {
6
- readonly code: WebSkillErrorCode;
7
- readonly details?: unknown;
8
- constructor(code: WebSkillErrorCode, message: string, details?: unknown);
9
- }
10
- //#endregion
11
- //#region src/contracts/jsonSchema.d.ts
12
- /**
13
- * 宽松 JSON Schema:覆盖工具 inputSchema 的常见字段,
14
- * 索引签名允许透传规范内的其他关键字。供 tools 与后续 UI 复用。
15
- */
16
- interface JsonSchema {
17
- type?: string;
18
- properties?: Record<string, JsonSchema>;
19
- required?: string[];
20
- items?: JsonSchema;
21
- enum?: unknown[];
22
- description?: string;
23
- default?: unknown;
24
- [key: string]: unknown;
25
- }
26
- //#endregion
27
- //#region src/skill/manifest.d.ts
28
- type SkillInstallSource = {
29
- type: 'local';
30
- path: string;
31
- } | {
32
- type: 'http';
33
- url: string;
34
- } | {
35
- type: 'archive';
36
- data: ArrayBuffer;
37
- } | {
38
- type: 'git';
39
- url: string;
40
- ref?: string;
41
- commit?: string;
42
- } | {
43
- type: 'npm';
44
- packageName: string;
45
- version?: string;
46
- };
47
- interface SkillManifest {
48
- schemaVersion: 1;
49
- name: string;
50
- version?: string;
51
- source: SkillInstallSource;
52
- installedAt: string;
53
- integrity: {
54
- algorithm: 'sha256';
55
- digest: string;
56
- };
57
- files: Array<{
58
- path: string;
59
- size: number;
60
- sha256: string;
61
- }>;
62
- }
63
- interface SkillsLockfile {
64
- schemaVersion: 1;
65
- skills: Record<string, {
66
- digest: string;
67
- installedAt: string;
68
- source: SkillInstallSource;
69
- }>;
70
- }
71
- interface VerifyResult {
72
- ok: boolean;
73
- mismatches: string[];
74
- }
75
- /** 技能目录内的安装清单文件名(不参与 files 列表与 digest) */
76
- declare const SKILL_MANIFEST_FILE = "webskill.skill-manifest.json";
77
- /** managed root 下的锁定文件名(不参与 files 列表与 digest) */
78
- declare const SKILLS_LOCKFILE = "skills.lock.json";
79
- type Sha256Fn = (data: Uint8Array | string) => string | Promise<string>;
80
- /** 整体 digest:逐文件 "<path>:<sha256>\n" 拼接串(文件按 path 排序)的 sha256(hash 由调用方提供,可为 WebCrypto 异步实现) */
81
- declare function computeDigest(files: Array<{
82
- path: string;
83
- sha256: string;
84
- }>, sha256: Sha256Fn): Promise<string>;
85
- /** 由逐文件清单构建 manifest(digest 由 computeDigest 计算) */
86
- declare function buildManifest(input: {
87
- name: string;
88
- version?: string;
89
- source: SkillInstallSource;
90
- installedAt: string;
91
- files: SkillManifest['files'];
92
- sha256: Sha256Fn;
93
- }): Promise<SkillManifest>;
94
- /** 按 manifest.files 比对实际 hash(调用方负责计算 actualHashes) */
95
- declare function verifyManifest(manifest: SkillManifest, actualHashes: Map<string, string>): VerifyResult;
96
- //#endregion
97
- //#region src/fs/types.d.ts
98
- interface FileStat {
99
- path: string;
100
- type: 'file' | 'directory';
101
- size?: number;
102
- mtimeMs?: number;
103
- }
104
- /**
105
- * 文件系统抽象:core 只依赖此接口,Node/浏览器各自提供实现。
106
- * 路径一律使用 `/` 分隔的 POSIX 风格。
107
- */
108
- interface FileSystemProvider {
109
- readonly kind: string;
110
- readText(path: string): Promise<string>;
111
- writeText(path: string, content: string): Promise<void>;
112
- readBinary(path: string): Promise<Uint8Array>;
113
- writeBinary(path: string, content: Uint8Array): Promise<void>;
114
- exists(path: string): Promise<boolean>;
115
- stat(path: string): Promise<FileStat>;
116
- list(path: string): Promise<FileStat[]>;
117
- mkdir(path: string): Promise<void>;
118
- remove(path: string, options?: {
119
- recursive?: boolean;
120
- }): Promise<void>;
121
- }
122
- //#endregion
123
- //#region src/fs/memoryFs.d.ts
124
- /** 内存文件系统:路径一律规范化为 `/` 分隔,写入自动创建父目录 */
125
- declare class MemoryFS implements FileSystemProvider {
126
- #private;
127
- readonly kind = "memory";
128
- constructor();
129
- readText(path: string): Promise<string>;
130
- writeText(path: string, content: string): Promise<void>;
131
- readBinary(path: string): Promise<Uint8Array>;
132
- writeBinary(path: string, content: Uint8Array): Promise<void>;
133
- exists(path: string): Promise<boolean>;
134
- stat(path: string): Promise<FileStat>;
135
- list(path: string): Promise<FileStat[]>;
136
- mkdir(path: string): Promise<void>;
137
- remove(path: string, options?: {
138
- recursive?: boolean;
139
- }): Promise<void>;
140
- }
141
- //#endregion
142
- //#region src/fs/pathSecurity.d.ts
143
- /** 统一分隔符为 `/`,去除 `.` 段与重复分隔符(不解析 `..`) */
144
- declare function normalizePath(path: string): string;
145
- /**
146
- * 将相对路径安全地解析到 root 之内。
147
- * 拒绝空路径、绝对路径(`/`、`\\`、`C:\` 形式)与任何 `..` 段。
148
- */
149
- declare function resolveInsideRoot(root: string, relativePath: string): string;
150
- //#endregion
151
- //#region src/skill/types.d.ts
152
- type SkillSource = 'local' | 'mcp' | 'generated' | 'installed';
153
- /** SKILL.md frontmatter 元数据;未知字段原样透传 */
154
- interface SkillMetadata {
155
- name: string;
156
- description: string;
157
- license?: string;
158
- version?: string;
159
- /** 声明式依赖:精确技能名列表(无版本约束);缺依赖/循环依赖 → error 级校验 */
160
- dependencies?: string[];
161
- [key: string]: unknown;
162
- }
163
- interface SkillLocation {
164
- skillRoot: string;
165
- skillMdPath: string;
166
- source: SkillSource;
167
- }
168
- interface SkillDocument {
169
- metadata: SkillMetadata;
170
- body: string;
171
- location: SkillLocation;
172
- }
173
- /** Catalog 条目:渐进披露第一层,只含元数据摘要与标记位 */
174
- interface SkillCatalogEntry {
175
- name: string;
176
- description: string;
177
- version?: string;
178
- license?: string;
179
- root: string;
180
- source: SkillSource;
181
- hasScripts: boolean;
182
- hasReferences: boolean;
183
- hasAssets: boolean;
184
- }
185
- interface SkillCatalog {
186
- skills: SkillCatalogEntry[];
187
- }
188
- //#endregion
189
- //#region src/skill/parser.d.ts
190
- declare function parseSkillMarkdown(raw: string): {
191
- metadata: SkillMetadata;
192
- body: string;
193
- };
194
- //#endregion
195
- //#region src/skill/naming.d.ts
196
- declare const SKILL_NAME_MAX_LENGTH = 64;
197
- /** Agent Skills 官方命名规范:小写字母/数字/连字符,不允许首尾或连续连字符 */
198
- declare const SKILL_NAME_PATTERN: RegExp;
199
- declare function isValidSkillName(name: string): boolean;
200
- //#endregion
201
- //#region src/skill/rules.d.ts
202
- interface SkillIssue {
203
- /** 与 WebSkillErrorCode 对齐 */
204
- code: string;
205
- severity: 'info' | 'warning' | 'error';
206
- message: string;
207
- path?: string;
208
- }
209
- /**
210
- * 技能合规规则的唯一实现。SkillDiscovery 与 validateSkills 都必须调用本函数,
211
- * 禁止各自重复实现规则(避免两套规则漂移)。
212
- */
213
- declare function checkSkillRules(input: {
214
- dirName: string;
215
- hasSkillMd: boolean;
216
- metadata?: SkillMetadata;
217
- parseError?: WebSkillError;
218
- scriptFileNames?: string[];
219
- existingNames?: Set<string>;
220
- /** 全库技能名集合(两趟扫描提供);提供时启用 dependencies 存在性校验 */
221
- knownSkillNames?: Set<string>;
222
- }): SkillIssue[];
223
- /**
224
- * 循环依赖检测(全量邻接表,discovery 两趟扫描第二趟调用)。
225
- * 每个环只报一次(error 级,阻断进 Catalog);自引用视为长度 1 的环。
226
- */
227
- declare function checkDependencyCycles(adjacency: Map<string, string[]>): {
228
- issues: SkillIssue[];
229
- /** 处于环上的技能名(调用方将其排除出 Catalog) */
230
- involved: Set<string>;
231
- };
232
- //#endregion
233
- //#region src/skill/skillPack.d.ts
234
- /**
235
- * 技能包集(skill pack)格式与打包逻辑(node/browser 共用单一来源):
236
- * webskill.skill-pack.json { schemaVersion: 1, skills: [{ name, digest }] }
237
- * <skill-a>/SKILL.md … webskill.skill-manifest.json
238
- * <skill-b>/SKILL.md …
239
- * fflate 环境无关;文件读取经 FileSystemProvider 抽象。
240
- */
241
- /** 包级清单文件名(位于 zip 根,不参与各技能 digest) */
242
- declare const SKILL_PACK_FILE = "webskill.skill-pack.json";
243
- interface SkillPackManifest {
244
- schemaVersion: 1;
245
- skills: Array<{
246
- name: string;
247
- digest: string;
248
- }>;
249
- }
250
- /**
251
- * 多技能打包为单一 zip(包级清单 + 各技能目录含自身 manifest)。
252
- * manifestBuilder 负责确保技能目录内 manifest 文件存在并返回之(digest 入包级清单)。
253
- */
254
- declare function exportSkills(fs: FileSystemProvider, input: {
255
- roots: string[];
256
- manifestBuilder: (skillRoot: string) => Promise<SkillManifest>;
257
- }): Promise<Uint8Array>;
258
- /** 包级清单解析 + 形状校验;损坏 → INSTALL_FAILED(安装侧保证零残留) */
259
- declare function parseSkillPackManifest(text: string): SkillPackManifest;
260
- //#endregion
261
- //#region src/skill/discovery.d.ts
262
- interface DiscoveryResult {
263
- entries: SkillCatalogEntry[];
264
- issues: SkillIssue[];
265
- }
266
- declare class SkillDiscovery {
267
- #private;
268
- constructor(fs: FileSystemProvider, roots: string[]);
269
- discover(): Promise<DiscoveryResult>;
270
- catalog(): Promise<{
271
- catalog: SkillCatalog;
272
- issues: SkillIssue[];
273
- }>;
274
- /** 按需加载技能完整文档;技能不存在时抛 SKILL_NOT_FOUND */
275
- loadDocument(skillName: string): Promise<SkillDocument>;
276
- }
277
- //#endregion
278
- //#region src/skill/validator.d.ts
279
- interface ValidationReport {
280
- /** 无 error 级 issue 即 true */
281
- ok: boolean;
282
- issues: SkillIssue[];
283
- }
284
- /**
285
- * 合规校验。内部直接复用 SkillDiscovery 的扫描逻辑,
286
- * 规则判定同样落在 checkSkillRules 单一来源上。
287
- */
288
- declare function validateSkills(fs: FileSystemProvider, roots: string[]): Promise<ValidationReport>;
289
- //#endregion
290
- //#region src/skill/reader.d.ts
291
- /** 按技能名读取技能根目录内的文件,全部读取强制经过路径安全检查 */
292
- declare class SkillReader {
293
- #private;
294
- constructor(fs: FileSystemProvider, index: Map<string, string>);
295
- readSkillMarkdown(skillName: string): Promise<string>;
296
- readSkillFile(skillName: string, relativePath: string): Promise<string>;
297
- readSkillBinary(skillName: string, relativePath: string): Promise<Uint8Array>;
298
- }
299
- //#endregion
300
- //#region src/skill/catalog.d.ts
301
- /** 由条目列表构建 Catalog,保证按名称排序 */
302
- declare function buildCatalog(entries: SkillCatalogEntry[]): SkillCatalog;
303
- //#endregion
304
- //#region src/render/types.d.ts
305
- /** 可插拔的 Catalog 渲染器 */
306
- interface CatalogRenderer {
307
- readonly format: string;
308
- render(catalog: SkillCatalog): string;
309
- }
310
- //#endregion
311
- //#region src/render/jsonRenderer.d.ts
312
- declare function renderCatalogJson(catalog: SkillCatalog): string;
313
- declare const jsonRenderer: CatalogRenderer;
314
- //#endregion
315
- //#region src/render/xmlRenderer.d.ts
316
- /** 转义 XML 五个特殊字符:& < > " ' */
317
- declare function escapeXml(text: string): string;
318
- declare function renderAvailableSkillsXml(catalog: SkillCatalog): string;
319
- declare const xmlRenderer: CatalogRenderer;
320
- //#endregion
1
+ import { A as SkillCatalog, C as JsonSchema, L as SkillManifest, M as SkillDiscovery, N as SkillDocument, P as SkillInstallSource, S as FileSystemProvider, U as ValidationReport, _ as RenderResultRequest, a as InteractionPolicy, b as DiscoveryResult, c as LlmClient, d as LlmResponse, f as LlmStreamEvent, g as RenderBlock, h as MemoryStore, i as FormField, j as SkillCatalogEntry, l as LlmCompleteInput, m as LlmToolSpec, n as ArtifactStore, o as InteractionRequest, r as ChartSpec, t as Artifact, u as LlmMessage, v as UiBridge } from "./types-CgNC-oQu-DCklnS0h.js";
321
2
  //#region ../runtime/dist/index.d.ts
322
- //#region src/llm/streamTypes.d.ts
323
- /** 流式 LLM 事件(OpenAI SSE / Vercel fullStream 统一映射) */
324
- type LlmStreamEvent = {
325
- type: 'text-delta';
326
- delta: string;
327
- } | {
328
- type: 'tool-calls';
329
- toolCalls: LlmToolCall[];
330
- } | {
331
- type: 'done';
332
- content?: string;
333
- };
334
- //#endregion
335
- //#region src/llm/types.d.ts
336
- interface LlmMessage {
337
- role: 'system' | 'user' | 'assistant' | 'tool';
338
- content: string;
339
- /** role=tool 时必填 */
340
- toolCallId?: string;
341
- /** role=assistant 发起工具调用时携带 */
342
- toolCalls?: LlmToolCall[];
343
- }
344
- interface LlmToolSpec {
345
- name: string;
346
- description?: string;
347
- inputSchema: JsonSchema;
348
- }
349
- interface LlmToolCall {
350
- id: string;
351
- name: string;
352
- arguments: Record<string, unknown>;
353
- }
354
- interface LlmResponse {
355
- content?: string;
356
- toolCalls?: LlmToolCall[];
357
- raw?: unknown;
358
- }
359
- interface LlmCompleteInput {
360
- model?: string;
361
- messages: LlmMessage[];
362
- tools?: LlmToolSpec[];
363
- temperature?: number;
364
- signal?: AbortSignal;
365
- }
366
- interface LlmClient {
367
- complete(input: LlmCompleteInput): Promise<LlmResponse>;
368
- /** 可选流式接口;实现后 AgentLoop 默认走流式(text-delta 增量 + 最终组装) */
369
- stream?(input: LlmCompleteInput): AsyncIterable<LlmStreamEvent>;
370
- }
371
- //#endregion
372
- //#region src/llm/mockLlmClient.d.ts
373
- type MockLlmHandler = (input: LlmCompleteInput) => LlmResponse | Promise<LlmResponse>;
374
- type MockLlmQueueItem = LlmResponse | MockLlmHandler | {
375
- stream: LlmStreamEvent[] | ((input: LlmCompleteInput) => LlmStreamEvent[]);
376
- };
377
- /**
378
- * 预设响应序列的确定性 LlmClient;handler 形式可按会话状态动态应答。
379
- * 默认不含 stream(存量行为);构造传 { streaming: true } 启用流式:
380
- * 队列项 { stream: [...] } 按预设 delta 序列产出,LlmResponse 项自动合成增量。
381
- */
382
- declare class MockLlmClient implements LlmClient {
383
- #private;
384
- readonly calls: LlmCompleteInput[];
385
- readonly stream?: (input: LlmCompleteInput) => AsyncIterable<LlmStreamEvent>;
386
- constructor(responses: MockLlmQueueItem[], options?: {
387
- streaming?: boolean;
388
- });
389
- complete(input: LlmCompleteInput): Promise<LlmResponse>;
390
- }
391
- //#endregion
392
3
  //#region src/llm/openAiCompatibleClient.d.ts
393
4
  interface OpenAiCompatibleClientConfig {
394
5
  baseUrl?: string;
@@ -452,35 +63,6 @@ declare class FullDisclosureRouter implements SkillRouter {
452
63
  route(catalog: SkillCatalog): Promise<RouteResult>;
453
64
  }
454
65
  //#endregion
455
- //#region src/artifacts/types.d.ts
456
- interface Artifact {
457
- id: string;
458
- runId: string;
459
- path: string;
460
- type: 'text' | 'binary';
461
- mimeType?: string;
462
- size: number;
463
- createdAt: string;
464
- metadata?: Record<string, unknown>;
465
- }
466
- interface ArtifactStore {
467
- createTextArtifact(input: {
468
- runId: string;
469
- path: string;
470
- content: string;
471
- mimeType?: string;
472
- metadata?: Record<string, unknown>;
473
- }): Promise<Artifact>;
474
- createBinaryArtifact(input: {
475
- runId: string;
476
- path: string;
477
- content: Uint8Array;
478
- mimeType?: string;
479
- metadata?: Record<string, unknown>;
480
- }): Promise<Artifact>;
481
- listArtifacts(runId: string): Promise<Artifact[]>;
482
- }
483
- //#endregion
484
66
  //#region src/tools/types.d.ts
485
67
  interface ToolDefinition {
486
68
  /** LLM 可见名:脚本工具为 `${skillName}__${scriptName}` */
@@ -594,116 +176,6 @@ declare function createScriptContext(deps: {
594
176
  onWarning?: (message: string) => void;
595
177
  }): ScriptExecutionContext;
596
178
  //#endregion
597
- //#region src/interaction/types.d.ts
598
- type InteractionRequest = {
599
- type: 'ask';
600
- id: string;
601
- message: string;
602
- schema?: JsonSchema;
603
- } | {
604
- type: 'confirm';
605
- id: string;
606
- message: string;
607
- defaultValue?: boolean;
608
- } | {
609
- type: 'form';
610
- id: string;
611
- title?: string;
612
- fields: FormField[];
613
- } | {
614
- type: 'select';
615
- id: string;
616
- message: string;
617
- options: Array<{
618
- label: string;
619
- value: unknown;
620
- }>;
621
- } | {
622
- /** 能力强制授权(require-approval):与脚本自发 confirm 区分,UI 渲染为授权样式 */
623
- type: 'authorize';
624
- id: string;
625
- capability: 'readReference' | 'writeArtifact' | 'confirm';
626
- message: string;
627
- details?: unknown;
628
- };
629
- interface InteractionResponse {
630
- id: string;
631
- value?: unknown;
632
- cancelled?: boolean;
633
- }
634
- /** 图表规格($chart 约定的校验后形态;渲染单一来源在 ui/chart/miniChart) */
635
- interface ChartSpec {
636
- kind: 'bar' | 'line' | 'pie';
637
- title?: string;
638
- labels: string[];
639
- series: Array<{
640
- name?: string;
641
- data: number[];
642
- }>;
643
- }
644
- type RenderBlock = {
645
- type: 'markdown';
646
- text: string;
647
- } | {
648
- type: 'json';
649
- data: unknown;
650
- } | {
651
- type: 'table';
652
- columns: string[];
653
- rows: unknown[][];
654
- } | {
655
- type: 'image';
656
- url: string;
657
- alt?: string;
658
- } | {
659
- type: 'file';
660
- path: string;
661
- mimeType?: string;
662
- size?: number;
663
- } | {
664
- type: 'chart';
665
- chart: ChartSpec;
666
- };
667
- interface RenderResultRequest {
668
- runId: string;
669
- title?: string;
670
- summary?: string;
671
- blocks: RenderBlock[];
672
- artifacts?: Artifact[];
673
- }
674
- interface UiBridge {
675
- request(input: InteractionRequest): Promise<InteractionResponse>;
676
- progress?(input: {
677
- runId: string;
678
- message: string;
679
- value?: number;
680
- }): Promise<void>;
681
- /** 定义即可,阶段 7 消费 */
682
- renderResult?(input: RenderResultRequest): Promise<void>;
683
- /** 流式文本增量(流式 LLM 路径下由 AgentLoop 转发) */
684
- onTextDelta?(runId: string, delta: string): Promise<void> | void;
685
- }
686
- interface FormField {
687
- name: string;
688
- label: string;
689
- type: 'text' | 'number' | 'boolean' | 'select' | 'textarea';
690
- required?: boolean;
691
- description?: string;
692
- defaultValue?: unknown;
693
- options?: Array<{
694
- label: string;
695
- value: unknown;
696
- }>;
697
- }
698
- interface InteractionPolicy {
699
- /** 缺必填参数策略:默认 'user'(表单问用户),'llm' 回喂自愈 */
700
- missingParams?: 'user' | 'llm';
701
- /** context.confirm 策略:默认 'required'(真实询问) */
702
- confirmations?: 'required' | 'auto-approve';
703
- /** 交互超时,默认 300_000ms */
704
- interactionTimeoutMs?: number;
705
- }
706
- //#endregion
707
179
  //#region src/lifecycle/types.d.ts
708
180
  type RuntimePhase = 'discover' | 'route' | 'activate' | 'prepare' | 'execute' | 'observe' | 'interact' | 'complete' | 'fail';
709
181
  interface LifecycleEvent {
@@ -789,23 +261,11 @@ declare function buildRenderResult(run: RuntimeRun, output: string, renderBlocks
789
261
  */
790
262
  declare function schemaToForm(schema: JsonSchema, providedArgs?: Record<string, unknown>): FormField[];
791
263
  //#endregion
792
- //#region src/interaction/mockUiBridge.d.ts
793
- type MockUiAnswer = InteractionResponse | ((request: InteractionRequest) => InteractionResponse | Promise<InteractionResponse>);
264
+ //#region src/facade/types.d.ts
794
265
  /**
795
- * 测试用 UiBridge:按请求 id 或类型预设应答(永不 resolve 的 handler 可模拟超时);
796
- * 记录全部请求供断言。
266
+ * 安装结果清单(对齐 README IDL 命名;SkillManifest 的精简投影)
267
+ * @stable
797
268
  */
798
- declare class MockUiBridge implements UiBridge {
799
- #private;
800
- readonly requests: InteractionRequest[];
801
- /** key 为请求 id 或请求类型('ask' | 'confirm' | 'form' | 'select') */
802
- respondTo(key: string, answer: MockUiAnswer): this;
803
- setFallback(answer: MockUiAnswer): this;
804
- request(input: InteractionRequest): Promise<InteractionResponse>;
805
- }
806
- //#endregion
807
- //#region src/facade/types.d.ts
808
- /** 安装结果清单(对齐 README IDL 命名;SkillManifest 的精简投影) */
809
269
  interface InstalledSkillManifest {
810
270
  name: string;
811
271
  version?: string;
@@ -829,6 +289,7 @@ interface WebSkillApi {
829
289
  /**
830
290
  * navigator.webskill 门面装配层:零新业务逻辑,全部直转
831
291
  * SkillDiscovery / validateSkills / WebSkillRuntime / SkillManager。
292
+ * @stable
832
293
  */
833
294
  declare function createWebSkillApi(deps: {
834
295
  fs: FileSystemProvider;
@@ -878,33 +339,6 @@ declare class HookRunner {
878
339
  run(phase: RuntimePhase, ctx: LifecycleHookContext): Promise<void>;
879
340
  }
880
341
  //#endregion
881
- //#region src/memory/types.d.ts
882
- /** scope/key 两级记忆存储;scope 约定:session:{id} / skill:{name} / user:{id} */
883
- interface MemoryStore {
884
- get(scope: string, key: string): Promise<unknown>;
885
- set(scope: string, key: string, value: unknown): Promise<void>;
886
- delete(scope: string, key: string): Promise<void>;
887
- list(scope: string): Promise<Array<{
888
- key: string;
889
- value: unknown;
890
- }>>;
891
- clear(scope?: string): Promise<void>;
892
- }
893
- //#endregion
894
- //#region src/memory/inMemoryStore.d.ts
895
- /** 内存 MemoryStore:测试与浏览器降级用 */
896
- declare class InMemoryStore implements MemoryStore {
897
- #private;
898
- get(scope: string, key: string): Promise<unknown>;
899
- set(scope: string, key: string, value: unknown): Promise<void>;
900
- delete(scope: string, key: string): Promise<void>;
901
- list(scope: string): Promise<Array<{
902
- key: string;
903
- value: unknown;
904
- }>>;
905
- clear(scope?: string): Promise<void>;
906
- }
907
- //#endregion
908
342
  //#region src/memory/fsMemoryStore.d.ts
909
343
  /**
910
344
  * 基于 FileSystemProvider 的 MemoryStore:
@@ -927,27 +361,6 @@ declare class FsMemoryStore implements MemoryStore {
927
361
  clear(scope?: string): Promise<void>;
928
362
  }
929
363
  //#endregion
930
- //#region src/artifacts/memoryArtifactStore.d.ts
931
- /** 内存 ArtifactStore:测试与浏览器降级用;索引随进程生命周期存在 */
932
- declare class MemoryArtifactStore implements ArtifactStore {
933
- #private;
934
- createTextArtifact(input: {
935
- runId: string;
936
- path: string;
937
- content: string;
938
- mimeType?: string;
939
- metadata?: Record<string, unknown>;
940
- }): Promise<Artifact>;
941
- createBinaryArtifact(input: {
942
- runId: string;
943
- path: string;
944
- content: Uint8Array;
945
- mimeType?: string;
946
- metadata?: Record<string, unknown>;
947
- }): Promise<Artifact>;
948
- listArtifacts(runId: string): Promise<Artifact[]>;
949
- }
950
- //#endregion
951
364
  //#region src/artifacts/fsArtifactStore.d.ts
952
365
  /**
953
366
  * 基于 FileSystemProvider 的 ArtifactStore:产物落盘 <root>/<runId>/<path>,
@@ -1039,6 +452,7 @@ type NetworkPolicy = 'deny-all' | 'allow-all' | {
1039
452
  * - 通配 '*.example.com'(含 apex 与任意深度子域)
1040
453
  * - 源 'http://localhost:3000'(协议 + host + port 全等)
1041
454
  * - URL 解析失败一律拒绝
455
+ * @stable
1042
456
  */
1043
457
  declare function isNetworkAllowed(policy: NetworkPolicy, url: string): boolean;
1044
458
  /** 阻断 trace 用的脱敏 host(解析失败返回占位,不记录完整 URL) */
@@ -1053,6 +467,7 @@ type ApprovalDecision = 'allowed' | 'denied' | 'disabled';
1053
467
  * Per-capability 强制授权判定(宿主侧,browser/node 执行器共用单一来源)。
1054
468
  * 'require-approval' 模式下经注入的 UiBridge 发 authorize 交互;
1055
469
  * once-per-run(默认)在 run 内记忆已批准能力,every-call 每次调用都问。
470
+ * @stable
1056
471
  */
1057
472
  declare class CapabilityApproval {
1058
473
  #private;
@@ -1110,7 +525,10 @@ declare function mergeCatalogEntries(localEntries: SkillCatalogEntry[], provider
1110
525
  //#endregion
1111
526
  //#region src/engine/snapshot.d.ts
1112
527
  declare const RUN_SNAPSHOT_SCHEMA_VERSION = 1;
1113
- /** interrupted(等待用户)状态点的可恢复快照(D3 收窄版) */
528
+ /**
529
+ * interrupted(等待用户)状态点的可恢复快照(D3 收窄版)
530
+ * @experimental
531
+ */
1114
532
  interface RunSnapshot {
1115
533
  schemaVersion: 1;
1116
534
  runId: string;
@@ -1136,6 +554,7 @@ interface RunSnapshot {
1136
554
  };
1137
555
  snapshotAt: string;
1138
556
  }
557
+ /** @experimental */
1139
558
  interface RunSnapshotStore {
1140
559
  save(snapshot: RunSnapshot): Promise<void>;
1141
560
  load(runId: string): Promise<RunSnapshot | undefined>;
@@ -1145,6 +564,7 @@ interface RunSnapshotStore {
1145
564
  /**
1146
565
  * FileSystemProvider 后端的快照存储:<root>/<runId>.snapshot.json。
1147
566
  * 坏 JSON → RUN_SNAPSHOT_INCOMPATIBLE 并自动清理坏文件;runId 过路径安全校验。
567
+ * @experimental
1148
568
  */
1149
569
  declare class FsRunSnapshotStore implements RunSnapshotStore {
1150
570
  #private;
@@ -1252,7 +672,10 @@ interface WebSkillRuntimeDeps {
1252
672
  /** D3:interrupt 点快照存储(配置后 interrupted run 可 resumeRun 恢复) */
1253
673
  snapshotStore?: RunSnapshotStore;
1254
674
  }
1255
- /** runtime 门面:组合 discovery / router / agent loop / lifecycle */
675
+ /**
676
+ * runtime 门面:组合 discovery / router / agent loop / lifecycle
677
+ * @stable
678
+ */
1256
679
  declare class WebSkillRuntime {
1257
680
  #private;
1258
681
  constructor(deps: WebSkillRuntimeDeps);
@@ -1267,8 +690,9 @@ declare class WebSkillRuntime {
1267
690
  * D3 恢复 interrupted run:
1268
691
  * 不存在 → RUN_SNAPSHOT_NOT_FOUND;schemaVersion 不匹配 → 删除 + RUN_SNAPSHOT_INCOMPATIBLE;
1269
692
  * 已过期 → interaction-timeout 终态并删快照;否则重建 LoopState 重新发起交互续跑。
693
+ * @experimental
1270
694
  */
1271
695
  resumeRun(runId: string): Promise<RunResult>;
1272
696
  }
1273
697
  //#endregion
1274
- export { OpenAiCompatibleClientConfig as $, SKILLS_LOCKFILE as $t, InteractionPolicy as A, normalizePath as An, WebSkillRuntimeDeps as At, LlmResponse as B, networkUrlHost as Bt, FsMemoryStore as C, checkDependencyCycles as Cn, TraceEvent as Ct, HookRunnerOptions as D, exportSkills as Dn, VercelToolSpec as Dt, HookRunner as E, escapeXml as En, UiBridge as Et, LifecycleHookContext as F, resolveInsideRoot as Fn, extractChartSpec as Ft, MemoryStore as G, toLlmToolSpec as Gt, LlmToolCall as H, parseBridgeRequest as Ht, LifecycleListener as I, validateSkills as In, fromVercelResult as It, MockLlmQueueItem as J, DiscoveryResult as Jt, MockLlmClient as K, toVercelToolSpecs as Kt, LlmClient as L, verifyManifest as Ln, fromVercelStreamPart as Lt, InteractionResponse as M, parseSkillPackManifest as Mn, buildRenderResult as Mt, LifecycleEvent as N, renderAvailableSkillsXml as Nn, createScriptContext as Nt, InMemoryStore as O, isValidSkillName as On, WebSkillApi as Ot, LifecycleHook as P, renderCatalogJson as Pn, createWebSkillApi as Pt, OpenAiCompatibleClient as Q, MemoryFS as Qt, LlmCompleteInput as R, xmlRenderer as Rn, isNetworkAllowed as Rt, FsArtifactStore as S, buildManifest as Sn, TraceClock as St, FullDisclosureRouter as T, computeDigest as Tn, TraceRecorder as Tt, LlmToolSpec as U, resolveToolName as Ut, LlmStreamEvent as V, normalizeToolContent as Vt, MemoryArtifactStore as W, schemaToForm as Wt, MockUiBridge as X, FileSystemProvider as Xt, MockUiAnswer as Y, FileStat as Yt, NetworkPolicy as Z, JsonSchema as Zt, ChartSpec as _, ValidationReport as _n, ScriptExecutor as _t, AgentLoopConfig as a, SkillCatalogEntry as an, RenderBlock as at, ExternalToolSource as b, WebSkillErrorCode as bn, ToolResolution as bt, ApprovalScope as c, SkillInstallSource as cn, RunResult as ct, BridgeCapabilities as d, SkillManifest as dn, RunTerminationReason as dt, SKILL_MANIFEST_FILE as en, ProgressiveRouter as et, BridgeCapability as f, SkillMetadata as fn, RuntimePhase as ft, CapabilityMode as g, SkillsLockfile as gn, ScriptExecutionContext as gt, CapabilityApproval as h, SkillSource as hn, SchemaInferer as ht, AgentLoop as i, SkillCatalog as in, RUN_SNAPSHOT_SCHEMA_VERSION as it, InteractionRequest as j, parseSkillMarkdown as jn, bridgeError as jt, InstalledSkillManifest as k, jsonRenderer as kn, WebSkillRuntime as kt, Artifact as l, SkillIssue as ln, RunSnapshot as lt, BridgeResponse as m, SkillReader as mn, RuntimeSession as mt, ASK_USER_TOOL as n, SKILL_NAME_PATTERN as nn, READ_SKILL_FILE_TOOL as nt, AgentLoopDeps as o, SkillDiscovery as on, RenderResultRequest as ot, BridgeRequest as p, SkillPackManifest as pn, RuntimeRun as pt, MockLlmHandler as q, CatalogRenderer as qt, ASK_USER_TOOL_NAME as r, SKILL_PACK_FILE as rn, READ_SKILL_FILE_TOOL_NAME as rt, ApprovalDecision as s, SkillDocument as sn, RouteResult as st, ASK_USER_INPUT_SCHEMA as t, SKILL_NAME_MAX_LENGTH as tn, READ_SKILL_FILE_INPUT_SCHEMA as tt, ArtifactStore as u, SkillLocation as un, RunSnapshotStore as ut, EventBus as v, VerifyResult as vn, SkillRouter as vt, FsRunSnapshotStore as w, checkSkillRules as wn, TraceEventType as wt, FormField as x, buildCatalog as xn, ToolResult as xt, ExternalSkillProvider as y, WebSkillError as yn, ToolDefinition as yt, LlmMessage as z, mergeCatalogEntries as zt };
698
+ export { TraceEvent as $, OpenAiCompatibleClient as A, RunSnapshotStore as B, HookRunnerOptions as C, LifecycleHookContext as D, LifecycleHook as E, READ_SKILL_FILE_TOOL_NAME as F, SchemaInferer as G, RuntimePhase as H, RUN_SNAPSHOT_SCHEMA_VERSION as I, SkillRouter as J, ScriptExecutionContext as K, RouteResult as L, ProgressiveRouter as M, READ_SKILL_FILE_INPUT_SCHEMA as N, LifecycleListener as O, READ_SKILL_FILE_TOOL as P, TraceClock as Q, RunResult as R, HookRunner as S, LifecycleEvent as T, RuntimeRun as U, RunTerminationReason as V, RuntimeSession as W, ToolResolution as X, ToolDefinition as Y, ToolResult as Z, ExternalToolSource as _, parseBridgeRequest as _t, AgentLoopConfig as a, WebSkillRuntimeDeps as at, FsRunSnapshotStore as b, toLlmToolSpec as bt, ApprovalScope as c, createScriptContext as ct, BridgeRequest as d, fromVercelResult as dt, TraceEventType as et, BridgeResponse as f, fromVercelStreamPart as ft, ExternalSkillProvider as g, normalizeToolContent as gt, EventBus as h, networkUrlHost as ht, AgentLoop as i, WebSkillRuntime as it, OpenAiCompatibleClientConfig as j, NetworkPolicy as k, BridgeCapabilities as l, createWebSkillApi as lt, CapabilityMode as m, mergeCatalogEntries as mt, ASK_USER_TOOL as n, VercelToolSpec as nt, AgentLoopDeps as o, bridgeError as ot, CapabilityApproval as p, isNetworkAllowed as pt, ScriptExecutor as q, ASK_USER_TOOL_NAME as r, WebSkillApi as rt, ApprovalDecision as s, buildRenderResult as st, ASK_USER_INPUT_SCHEMA as t, TraceRecorder as tt, BridgeCapability as u, extractChartSpec as ut, FsArtifactStore as v, resolveToolName as vt, InstalledSkillManifest as w, FullDisclosureRouter as x, toVercelToolSpecs as xt, FsMemoryStore as y, schemaToForm as yt, RunSnapshot as z };