@webskill/sdk 0.2.8 → 0.4.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/README.md +42 -0
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +4 -9
- package/dist/{catalogComponents-C_V39rbF-BOHveMWa.js → catalogComponents-KsujmL4b-Clx1kCnU.js} +278 -122
- package/dist/client-BCM6Z3yq-qUQNkKrK.js +7787 -0
- package/dist/{dist-BQzncxXg.js → dist-8oQRa8Xz.js} +212 -13
- package/dist/{dist-B9VLwOME.js → dist-C-Sh0MDU.js} +1019 -317
- package/dist/{dist-CtBLBbEz.js → dist-D9Lcn5Pp.js} +528 -838
- package/dist/governance.d.ts +46 -11
- package/dist/governance.js +152 -25
- package/dist/{index-7DVaZJU7.d.ts → index-CHXxDccV.d.ts} +62 -144
- package/dist/{index-QrHtAudz.d.ts → index-DLfR2Y6I.d.ts} +412 -21
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -3
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +2 -2
- package/dist/memoryArtifactStore-BtOeB_hm-tj3fC5ip.js +78 -0
- package/dist/node.d.ts +297 -4
- package/dist/node.js +281 -7
- package/dist/{openUiLibrary-B8-Cvou9-D3RsU2EB.js → openUiLibrary-YLS-cxyT-C96jWDQq.js} +6 -5
- package/dist/skillVersionStore-uyefLPR1-DXOzbksv.d.ts +158 -0
- package/dist/stdio-CFMoANJJ-BxrTeXh7.js +31 -0
- package/dist/{testing-BUoXvm1u.js → testing-DDCJWvgA.js} +8 -6
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/{types-AmKCKJn_-BogJPQHU.d.ts → types-7Wcg--Vh-1YlQ4jF9.d.ts} +219 -70
- package/dist/types-WovEf4ED-CZSDiiBU.js +6215 -0
- package/dist/ui-react.d.ts +329 -18
- package/dist/ui-react.js +3715 -3464
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui-vue.js +1 -1
- package/dist/ui.d.ts +4 -3
- package/dist/ui.js +3 -3
- package/dist/{webskillLitCatalog-CNaUpasU-CfSRvqCZ.js → webskillLitCatalog-CSTbhBe_-CYIs5BX8.js} +312 -122
- package/package.json +4 -7
- package/dist/jsonRenderRegistry-9GrWP_hE-CQY8bT9w.js +0 -2468
- package/dist/memoryArtifactStore-C9lFVqPF-yFz6yJj0.js +0 -48
- package/dist/skillVersionStore-B7rGjtMi-BgnQho9v.d.ts +0 -365
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as SkillDocument, F as JsonSchema, N as FileSystemProvider, Q as SkillDiscovery, R as Page, S as UiSpecEvent, T as UiSurfaceActionRequest, X as SkillCatalog, Z as SkillCatalogEntry, _ as RenderBlock, a as InteractionPolicy, c as LlmClient, d as LlmMessage, et as SkillInstallSource, f as LlmResponse, g as MemoryStore, h as LlmToolSpec, ht as ValidationReport, i as FormField, it as SkillManifest, j as DiscoveryResult, l as LlmCompleteInput, n as ArtifactStore, o as InteractionRequest, p as LlmStreamEvent, pt as UiSpecNode, r as ChartSpec, t as Artifact, u as LlmContentPart, v as RenderResultRequest, vt as WebSkillErrorCode, x as UiSpecDrafts, y as UiBridge, z as PageQuery } from "./types-7Wcg--Vh-1YlQ4jF9.js";
|
|
2
2
|
//#region ../runtime/dist/index.d.ts
|
|
3
|
+
//#region src/llm/parts.d.ts
|
|
4
|
+
/** 纯文本消息内容的构造快捷方式(引擎内部绝大多数消息仍是纯文本) */
|
|
5
|
+
declare const textParts: (text: string) => LlmContentPart[];
|
|
6
|
+
/** 取出 parts 中的文本(非文本分片在纯文本语境下无法表达,此处按丢弃处理——调用方须先校验) */
|
|
7
|
+
declare const partsToText: (parts: readonly LlmContentPart[] | undefined) => string;
|
|
8
|
+
//#endregion
|
|
3
9
|
//#region src/llm/openAiCompatibleClient.d.ts
|
|
4
10
|
interface OpenAiCompatibleClientConfig {
|
|
5
11
|
baseUrl?: string;
|
|
@@ -231,13 +237,95 @@ declare function createScriptContext(deps: {
|
|
|
231
237
|
//#endregion
|
|
232
238
|
//#region src/lifecycle/types.d.ts
|
|
233
239
|
type RuntimePhase = 'discover' | 'route' | 'activate' | 'prepare' | 'execute' | 'observe' | 'interact' | 'complete' | 'fail';
|
|
234
|
-
|
|
235
|
-
|
|
240
|
+
/** 路由完成:策略与本次可见的技能候选 */
|
|
241
|
+
interface RouteLifecycleData {
|
|
242
|
+
strategy: string;
|
|
243
|
+
candidates: string[];
|
|
244
|
+
}
|
|
245
|
+
/** 技能激活:每激活一个技能一次事件(不是一次性的技能集合) */
|
|
246
|
+
interface ActivateLifecycleData {
|
|
247
|
+
skillName: string;
|
|
248
|
+
source: 'local' | 'external';
|
|
249
|
+
/** 级联激活时的来源技能名(顶层激活没有) */
|
|
250
|
+
via?: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* execute 相位有五种发生场合,用 `kind` 区分。
|
|
254
|
+
* 0.3.0 时它们各写各的键(`{turn}` / `{resumed}` / `{surfaceAction}` /
|
|
255
|
+
* `{type:'tool'}` / `{type:'llm.delta'}`),消费方只能靠猜哪个键存在。
|
|
256
|
+
*/
|
|
257
|
+
type ExecuteLifecycleData = {
|
|
258
|
+
kind: 'turn';
|
|
259
|
+
turn: number;
|
|
260
|
+
} | {
|
|
261
|
+
kind: 'tool';
|
|
262
|
+
status: 'started' | 'completed' | 'failed';
|
|
263
|
+
name: string;
|
|
264
|
+
callId: string;
|
|
265
|
+
args: string;
|
|
266
|
+
} | {
|
|
267
|
+
kind: 'llm-delta';
|
|
268
|
+
delta: string;
|
|
269
|
+
} | {
|
|
270
|
+
kind: 'interaction-resumed';
|
|
271
|
+
interactionId: string;
|
|
272
|
+
} | {
|
|
273
|
+
kind: 'surface-action-resumed';
|
|
274
|
+
surfaceId: string;
|
|
275
|
+
actionId: string;
|
|
276
|
+
};
|
|
277
|
+
/** interact 相位:脚本发起的交互请求,或声明式 surface 上的动作等待 */
|
|
278
|
+
type InteractLifecycleData = {
|
|
279
|
+
kind: 'interaction';
|
|
280
|
+
interactionId: string;
|
|
281
|
+
interactionType: InteractionRequest['type'];
|
|
282
|
+
} | {
|
|
283
|
+
kind: 'surface-action';
|
|
284
|
+
surfaceId: string;
|
|
285
|
+
actionId: string;
|
|
286
|
+
nonce: string;
|
|
287
|
+
resumed: boolean;
|
|
288
|
+
};
|
|
289
|
+
/** complete / fail:终态原因 */
|
|
290
|
+
interface TerminalLifecycleData {
|
|
291
|
+
reason: RunTerminationReason;
|
|
292
|
+
}
|
|
293
|
+
interface LifecycleEventBase {
|
|
236
294
|
runId: string;
|
|
237
295
|
sessionId: string;
|
|
238
296
|
ts: string;
|
|
239
|
-
data?: Record<string, unknown>;
|
|
240
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* 按 `phase` 判别的联合:每个相位的 `data` 键已穷举,没有 `[k: string]: unknown` 兜底。
|
|
300
|
+
* 留兜底则新增字段不会让 `pnpm api:check` 变红,快照护栏形同虚设。
|
|
301
|
+
*
|
|
302
|
+
* `discover` / `prepare` / `observe` 的 `data?: never` 不是「暂时没有」:
|
|
303
|
+
* 这三个相位当前没有任何发射点(`RuntimePhase` 保留它们供 `RuntimeRun.phase` 使用),
|
|
304
|
+
* 将来要带负载就是一次公开表面变更,走正常流程。
|
|
305
|
+
*/
|
|
306
|
+
type LifecycleEvent = (LifecycleEventBase & {
|
|
307
|
+
phase: 'route';
|
|
308
|
+
data: RouteLifecycleData;
|
|
309
|
+
}) | (LifecycleEventBase & {
|
|
310
|
+
phase: 'activate';
|
|
311
|
+
data: ActivateLifecycleData;
|
|
312
|
+
}) | (LifecycleEventBase & {
|
|
313
|
+
phase: 'execute';
|
|
314
|
+
data: ExecuteLifecycleData;
|
|
315
|
+
}) | (LifecycleEventBase & {
|
|
316
|
+
phase: 'interact';
|
|
317
|
+
data: InteractLifecycleData;
|
|
318
|
+
}) | (LifecycleEventBase & {
|
|
319
|
+
phase: 'complete' | 'fail';
|
|
320
|
+
data: TerminalLifecycleData;
|
|
321
|
+
}) | (LifecycleEventBase & {
|
|
322
|
+
phase: 'discover' | 'prepare' | 'observe';
|
|
323
|
+
data?: never;
|
|
324
|
+
});
|
|
325
|
+
/** 分配式 Omit:直接 `Omit` 会把联合折叠成一个交叉对象,判别性就没了 */
|
|
326
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
327
|
+
/** 发射方只提供相位与负载,`runId` / `sessionId` / `ts` 由 runtime 填 */
|
|
328
|
+
type LifecycleEventInit = DistributiveOmit<LifecycleEvent, 'runId' | 'sessionId' | 'ts'>;
|
|
241
329
|
interface LifecycleHookContext {
|
|
242
330
|
event: LifecycleEvent;
|
|
243
331
|
run: RuntimeRun;
|
|
@@ -247,7 +335,7 @@ type LifecycleHook = (ctx: LifecycleHookContext) => Promise<void | {
|
|
|
247
335
|
}>;
|
|
248
336
|
//#endregion
|
|
249
337
|
//#region src/trace/types.d.ts
|
|
250
|
-
type TraceEventType = 'skill.routed' | 'skill.activated' | 'llm.request' | 'llm.response' | 'tool.started' | 'tool.completed' | 'tool.failed' | 'artifact.created' | 'ui.requested' | 'ui.resumed' | 'ui.surface-action.requested' | 'ui.surface-action.resolved' | 'ui.rendered' | 'run.warning' | 'run.completed' | 'run.cancelled' | 'run.failed' | 'run.resumed';
|
|
338
|
+
type TraceEventType = 'skill.routed' | 'skill.activated' | 'skill.integrity-failed' | 'llm.request' | 'llm.response' | 'tool.started' | 'tool.completed' | 'tool.failed' | 'tool.denied' | 'artifact.created' | 'ui.requested' | 'ui.resumed' | 'ui.surface-action.requested' | 'ui.surface-action.resolved' | 'ui.rendered' | 'run.warning' | 'run.completed' | 'run.cancelled' | 'run.failed' | 'run.resumed';
|
|
251
339
|
interface TraceEvent {
|
|
252
340
|
id: string;
|
|
253
341
|
runId: string;
|
|
@@ -279,6 +367,52 @@ interface SkillStateGuard {
|
|
|
279
367
|
canActivate?(skillName: string): boolean | Promise<boolean>;
|
|
280
368
|
canExecute?(skillName: string): boolean | Promise<boolean>;
|
|
281
369
|
}
|
|
370
|
+
/** 激活期完整性校验结论(D3) */
|
|
371
|
+
interface IntegrityVerdict {
|
|
372
|
+
ok: boolean;
|
|
373
|
+
/** 通过时的技能内容摘要(`manifest.integrity.digest`);进 trace,便于事后对账 */
|
|
374
|
+
digest?: string;
|
|
375
|
+
/** 失败原因(英文):实现方须写清哪些文件不一致,否则宿主无法向用户解释 */
|
|
376
|
+
reason?: string;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* 激活期完整性校验 port(治理装配;**不注入即关闭**——需求 §3 验收 3 要的开关就是它)。
|
|
380
|
+
*
|
|
381
|
+
* 与 `SkillStateGuard` 分开而不是塞进去:后者三个方法返回 `boolean`,语义是
|
|
382
|
+
* 「状态是否允许」;完整性校验要带回失败原因,且失败要驱动状态变更(→ `quarantined`)。
|
|
383
|
+
*
|
|
384
|
+
* 置 `quarantined` 与写审计由**实现方**负责(`SkillStatePolicy.toSkillIntegrityGuard`):
|
|
385
|
+
* runtime 不能写治理状态,也不能 import `@webskill/node` 去调 `verifyIntegrity`。
|
|
386
|
+
*/
|
|
387
|
+
interface SkillIntegrityGuard {
|
|
388
|
+
verifyOnActivate?(skillName: string): Promise<IntegrityVerdict>;
|
|
389
|
+
}
|
|
390
|
+
/** 技能脚本执行失败的上报负载 */
|
|
391
|
+
interface SkillFailureReport {
|
|
392
|
+
skillName: string;
|
|
393
|
+
runId: string;
|
|
394
|
+
/** 结构化错误码(执行器返回 `ok:false` 时取其错误码,抛错时取 `WebSkillError.code`,否则 `TOOL_EXECUTION_FAILED`) */
|
|
395
|
+
code: string;
|
|
396
|
+
/** 英文失败说明;上报方须能据此向用户解释,不要传空串 */
|
|
397
|
+
message: string;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* 技能执行结果上报 port(治理 `SkillStatePolicy.toSkillOutcomeReporter` 装配;**不注入即关闭**)。
|
|
401
|
+
*
|
|
402
|
+
* 与 `SkillStateGuard` / `SkillIntegrityGuard` 同形而不合并:那两个是**读**侧
|
|
403
|
+
* (「状态是否允许」「内容是否可信」),这个是**写**侧——把一次真实失败喂给治理的计数器。
|
|
404
|
+
*
|
|
405
|
+
* 0.4.0 F1 之前这条链路是断的:runtime 只把失败记进 memory 的 `skill:{name}` / `stats`,
|
|
406
|
+
* 而 `SkillStatePolicy` 的失败计数存在 `states.json` 里且没有任何生产调用方,
|
|
407
|
+
* 于是「失败达阈值自动隔离」在任何真实部署里都不会触发。
|
|
408
|
+
*
|
|
409
|
+
* runtime 不能反向依赖 `@webskill/governance`,所以只留 port,装配点在宿主。
|
|
410
|
+
* 实现方抛出的错误由 runtime 吞掉并降级为 `run.warning`:上报失败不该把一次
|
|
411
|
+
* 本来只是工具出错的 run 变成崩溃。
|
|
412
|
+
*/
|
|
413
|
+
interface SkillOutcomeReporter {
|
|
414
|
+
onSkillFailed?(report: SkillFailureReport): Promise<void>;
|
|
415
|
+
}
|
|
282
416
|
interface RuntimeSession {
|
|
283
417
|
id: string;
|
|
284
418
|
createdAt: string;
|
|
@@ -323,12 +457,12 @@ declare function extractChartSpec(data: unknown): ChartSpec | undefined;
|
|
|
323
457
|
declare function buildRenderResult(run: RuntimeRun, output: string, renderBlocks?: RenderBlock[]): RenderResultRequest;
|
|
324
458
|
//#endregion
|
|
325
459
|
//#region src/interaction/surface.d.ts
|
|
326
|
-
/** Validates the allowlisted, data-only
|
|
327
|
-
declare function
|
|
460
|
+
/** Validates the allowlisted, data-only node tree accepted by a UI surface renderer. @experimental */
|
|
461
|
+
declare function validateUiSpecNode(value: unknown): UiSpecNode;
|
|
328
462
|
/** Validates an individual event in the framework-neutral surface stream. @experimental */
|
|
329
|
-
declare function
|
|
463
|
+
declare function validateUiSpecEvent(value: unknown): UiSpecEvent;
|
|
330
464
|
/** Extracts validated surface stream events from structured tool output. @experimental */
|
|
331
|
-
declare function
|
|
465
|
+
declare function extractUiSpecEvents(data: unknown): UiSpecEvent[];
|
|
332
466
|
//#endregion
|
|
333
467
|
//#region src/interaction/schemaToForm.d.ts
|
|
334
468
|
/**
|
|
@@ -409,11 +543,17 @@ interface HookRunnerOptions {
|
|
|
409
543
|
/** 受控钩子执行器:逐个执行,超时/异常默认降级为 warning,可切严格模式 */
|
|
410
544
|
declare class HookRunner {
|
|
411
545
|
#private;
|
|
412
|
-
|
|
413
|
-
|
|
546
|
+
/** 宿主可在装配后按 RuntimeConfig 调整(console Settings › Agent Runtime 即经此生效) */
|
|
547
|
+
timeoutMs: number;
|
|
548
|
+
failOnHookError: boolean;
|
|
414
549
|
onWarning?: (message: string) => void;
|
|
415
550
|
constructor(options?: HookRunnerOptions);
|
|
416
551
|
register(phase: RuntimePhase | '*', hook: LifecycleHook): this;
|
|
552
|
+
/**
|
|
553
|
+
* 已注册钩子的**计数**,按注册相位分组(`'*'` 为全相位钩子)。
|
|
554
|
+
* 刻意不返回函数引用:那会给 UI 一条调用宿主钩子的执行路径,而面板只需要「装没装上」。
|
|
555
|
+
*/
|
|
556
|
+
listRegisteredHooks(): ReadonlyMap<RuntimePhase | '*', number>;
|
|
417
557
|
run(phase: RuntimePhase, ctx: LifecycleHookContext): Promise<void>;
|
|
418
558
|
}
|
|
419
559
|
//#endregion
|
|
@@ -636,6 +776,14 @@ declare class TraceRecorder {
|
|
|
636
776
|
interface ExternalToolSource {
|
|
637
777
|
readonly kind: string;
|
|
638
778
|
listToolSpecs(): Promise<LlmToolSpec[]>;
|
|
779
|
+
/**
|
|
780
|
+
* 可选:向 run 的 system 消息追加一段说明(组件 catalog 之类的大段规格)。
|
|
781
|
+
*
|
|
782
|
+
* 为什么不塞进工具的 `description`:description 的长度上限与截断行为是
|
|
783
|
+
* **provider 相关且静默的**——被截断后模型看到的是半份规格,而请求照样成功。
|
|
784
|
+
* system 消息没有这个隐患,也不必和工具选择耦合在一起。
|
|
785
|
+
*/
|
|
786
|
+
systemPrompt?(): Promise<string | undefined>;
|
|
639
787
|
canHandle(llmToolName: string): boolean;
|
|
640
788
|
call(llmToolName: string, args: Record<string, unknown>): Promise<ToolResult>;
|
|
641
789
|
}
|
|
@@ -652,13 +800,13 @@ interface ExternalSkillProvider {
|
|
|
652
800
|
declare function mergeCatalogEntries(localEntries: SkillCatalogEntry[], providerEntries: SkillCatalogEntry[]): SkillCatalogEntry[];
|
|
653
801
|
//#endregion
|
|
654
802
|
//#region src/engine/snapshot.d.ts
|
|
655
|
-
declare const RUN_SNAPSHOT_SCHEMA_VERSION =
|
|
803
|
+
declare const RUN_SNAPSHOT_SCHEMA_VERSION = 2;
|
|
656
804
|
/**
|
|
657
805
|
* interrupted(等待用户)状态点的可恢复快照(D3 收窄版)
|
|
658
806
|
* @experimental
|
|
659
807
|
*/
|
|
660
808
|
interface RunSnapshot {
|
|
661
|
-
schemaVersion:
|
|
809
|
+
schemaVersion: 2;
|
|
662
810
|
runId: string;
|
|
663
811
|
sessionId: string;
|
|
664
812
|
userPrompt: string;
|
|
@@ -670,16 +818,18 @@ interface RunSnapshot {
|
|
|
670
818
|
activeSkillNames: string[];
|
|
671
819
|
/** 已注册脚本工具定义(恢复后免重新激活) */
|
|
672
820
|
activatedTools: ToolDefinition[];
|
|
821
|
+
/** 声明了 allowed-tools 的技能 → 其清单(D10;旧快照缺省视为无人声明) */
|
|
822
|
+
skillAllowedTools?: Record<string, string[]>;
|
|
673
823
|
/** 等待中的旧交互(恢复时重新发起,表单重新渲染) */
|
|
674
824
|
pendingInteraction?: InteractionRequest;
|
|
675
825
|
/** 等待中的 surface action;其工具结果已入消息历史,无需重跑工具。 */
|
|
676
826
|
pendingSurfaceAction?: UiSurfaceActionRequest;
|
|
677
827
|
/** 未提交的 surface form values;仅在 interrupted surface action 等待期间保存。 */
|
|
678
|
-
surfaceDrafts?:
|
|
828
|
+
surfaceDrafts?: UiSpecDrafts;
|
|
679
829
|
/** $chart 等内容收集的渲染块(0.2.0 起跨 resume 保留;旧快照缺省视为空) */
|
|
680
830
|
renderBlocks?: RenderBlock[];
|
|
681
831
|
/** 已成功渲染的 surface 事件;resume 时按原序重放(旧快照缺省视为空) */
|
|
682
|
-
surfaceEvents?:
|
|
832
|
+
surfaceEvents?: UiSpecEvent[];
|
|
683
833
|
/** 交互 id 序号(resume 后续算,避免 id 冲突;旧快照缺省从 0 起) */
|
|
684
834
|
interactionSeq?: number;
|
|
685
835
|
/** Runtime 注入的 surface action nonce 序号(resume 后续算;旧快照缺省从 0 起) */
|
|
@@ -698,12 +848,30 @@ interface RunSnapshot {
|
|
|
698
848
|
};
|
|
699
849
|
snapshotAt: string;
|
|
700
850
|
}
|
|
851
|
+
/**
|
|
852
|
+
* schema 版本不受支持的快照:文件是好的,但本版本读不了。
|
|
853
|
+
* 仅用于列表的只读展示,不可恢复。
|
|
854
|
+
* @experimental
|
|
855
|
+
*/
|
|
856
|
+
interface UnsupportedRunSnapshot {
|
|
857
|
+
unsupported: true;
|
|
858
|
+
schemaVersion: number;
|
|
859
|
+
runId: string;
|
|
860
|
+
sessionId?: string;
|
|
861
|
+
userPrompt?: string;
|
|
862
|
+
snapshotAt: string;
|
|
863
|
+
interactionExpiresAt?: string;
|
|
864
|
+
}
|
|
865
|
+
/** @experimental */
|
|
866
|
+
type RunSnapshotListEntry = RunSnapshot | UnsupportedRunSnapshot;
|
|
867
|
+
/** @experimental */
|
|
868
|
+
declare function isUnsupportedRunSnapshot(entry: RunSnapshotListEntry): entry is UnsupportedRunSnapshot;
|
|
701
869
|
/** @experimental */
|
|
702
870
|
interface RunSnapshotStore {
|
|
703
871
|
save(snapshot: RunSnapshot): Promise<void>;
|
|
704
872
|
load(runId: string): Promise<RunSnapshot | undefined>;
|
|
705
873
|
delete(runId: string): Promise<void>;
|
|
706
|
-
list(): Promise<
|
|
874
|
+
list(): Promise<RunSnapshotListEntry[]>;
|
|
707
875
|
}
|
|
708
876
|
/**
|
|
709
877
|
* FileSystemProvider 后端的快照存储:<root>/<runId>.snapshot.json。
|
|
@@ -723,7 +891,7 @@ declare class FsRunSnapshotStore implements RunSnapshotStore {
|
|
|
723
891
|
save(snapshot: RunSnapshot): Promise<void>;
|
|
724
892
|
load(runId: string): Promise<RunSnapshot | undefined>;
|
|
725
893
|
delete(runId: string): Promise<void>;
|
|
726
|
-
list(): Promise<
|
|
894
|
+
list(): Promise<RunSnapshotListEntry[]>;
|
|
727
895
|
}
|
|
728
896
|
//#endregion
|
|
729
897
|
//#region src/engine/agentLoop.d.ts
|
|
@@ -759,6 +927,10 @@ interface AgentLoopDeps {
|
|
|
759
927
|
catalogFilter?: (entries: SkillCatalogEntry[]) => SkillCatalogEntry[] | Promise<SkillCatalogEntry[]>;
|
|
760
928
|
/** 技能状态拦截(read/activate/execute 三入口一致执行;无注入默认全放行) */
|
|
761
929
|
skillStateGuard?: SkillStateGuard;
|
|
930
|
+
/** D3 激活期完整性校验 port(治理装配;无注入即关闭) */
|
|
931
|
+
skillIntegrityGuard?: SkillIntegrityGuard;
|
|
932
|
+
/** F1 技能执行失败上报 port(治理装配;无注入即关闭) */
|
|
933
|
+
skillOutcomeReporter?: SkillOutcomeReporter;
|
|
762
934
|
/** D3:interrupt 点快照存储(无配置则行为与现状完全一致) */
|
|
763
935
|
snapshotStore?: RunSnapshotStore;
|
|
764
936
|
}
|
|
@@ -831,6 +1003,10 @@ interface WebSkillRuntimeDeps {
|
|
|
831
1003
|
snapshotStore?: RunSnapshotStore;
|
|
832
1004
|
/** 技能状态拦截 port(治理 SkillStatePolicy.toSkillStateGuard 装配;无注入默认全放行) */
|
|
833
1005
|
skillStateGuard?: SkillStateGuard;
|
|
1006
|
+
/** D3 激活期完整性校验 port(治理 SkillStatePolicy.toSkillIntegrityGuard 装配;无注入即关闭) */
|
|
1007
|
+
skillIntegrityGuard?: SkillIntegrityGuard;
|
|
1008
|
+
/** F1 技能执行失败上报 port(治理 SkillStatePolicy.toSkillOutcomeReporter 装配;无注入即关闭) */
|
|
1009
|
+
skillOutcomeReporter?: SkillOutcomeReporter;
|
|
834
1010
|
}
|
|
835
1011
|
/**
|
|
836
1012
|
* runtime 门面:组合 discovery / router / agent loop / lifecycle
|
|
@@ -864,11 +1040,11 @@ declare class WebSkillRuntime {
|
|
|
864
1040
|
sessionId?: string;
|
|
865
1041
|
history?: LlmMessage[];
|
|
866
1042
|
}): Promise<RunResult>;
|
|
867
|
-
/** D3
|
|
868
|
-
listInterruptedRuns(): Promise<
|
|
1043
|
+
/** D3:列出 interrupted run(供 UI 展示"未完成任务");版本不受支持的项带 unsupported 标记 */
|
|
1044
|
+
listInterruptedRuns(): Promise<RunSnapshotListEntry[]>;
|
|
869
1045
|
/**
|
|
870
1046
|
* D3 恢复 interrupted run:
|
|
871
|
-
* 不存在 → RUN_SNAPSHOT_NOT_FOUND;
|
|
1047
|
+
* 不存在 → RUN_SNAPSHOT_NOT_FOUND;schema 版本不受支持 → RUN_SNAPSHOT_SCHEMA_UNSUPPORTED(由 store 抛出,不删文件);
|
|
872
1048
|
* 已过期 → interaction-timeout 终态并删快照;否则重建 LoopState 重新发起交互续跑。
|
|
873
1049
|
* @experimental
|
|
874
1050
|
*/
|
|
@@ -881,4 +1057,219 @@ declare class WebSkillRuntime {
|
|
|
881
1057
|
cancel(runId: string): boolean;
|
|
882
1058
|
}
|
|
883
1059
|
//#endregion
|
|
884
|
-
|
|
1060
|
+
//#region src/engine/runTrace.d.ts
|
|
1061
|
+
declare const RUN_TRACE_SCHEMA_VERSION = 1;
|
|
1062
|
+
/**
|
|
1063
|
+
* 一次运行的完整 trace 落盘格式。
|
|
1064
|
+
*
|
|
1065
|
+
* 0.0.1 时代 chatbot 与 console 各写了一份同形状的私有类型,靠注释「字段名不得
|
|
1066
|
+
* 擅自变更」维系——本类型把那条口头约定升级为受 api:check 守护的公开契约。
|
|
1067
|
+
* 刻意**不留开放扩展位**:演进手段是 `schemaVersion`,`extra?: Record<…>` 会让
|
|
1068
|
+
* 快照对字段变更完全失明。
|
|
1069
|
+
* @stable
|
|
1070
|
+
*/
|
|
1071
|
+
interface RunTraceFile {
|
|
1072
|
+
/** 缺省视为 0(0.0.1 时代文件) */
|
|
1073
|
+
schemaVersion: number;
|
|
1074
|
+
runId: string;
|
|
1075
|
+
sessionId?: string;
|
|
1076
|
+
startedAt: string;
|
|
1077
|
+
endedAt?: string;
|
|
1078
|
+
/** completed | failed | cancelled;读取侧原样透传 */
|
|
1079
|
+
status: string;
|
|
1080
|
+
activeSkills: string[];
|
|
1081
|
+
events: TraceEvent[];
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* 运行列表行。由写入侧一次算好,读取侧不再扫描事件。
|
|
1085
|
+
* @stable
|
|
1086
|
+
*/
|
|
1087
|
+
interface RunTraceSummary {
|
|
1088
|
+
runId: string;
|
|
1089
|
+
sessionId?: string;
|
|
1090
|
+
startedAt: string;
|
|
1091
|
+
endedAt?: string;
|
|
1092
|
+
status: string;
|
|
1093
|
+
activeSkills: string[];
|
|
1094
|
+
/** 终止原因,取自 run.completed/cancelled/failed 事件的 data.reason */
|
|
1095
|
+
endReason?: string;
|
|
1096
|
+
eventCount: number;
|
|
1097
|
+
/** llm.request 事件数(指标里的「轮次」) */
|
|
1098
|
+
turnCount: number;
|
|
1099
|
+
/** endedAt - startedAt,无 endedAt 或时间戳不可解析时缺省 */
|
|
1100
|
+
durationMs?: number;
|
|
1101
|
+
}
|
|
1102
|
+
/** @stable */
|
|
1103
|
+
interface RunTraceFilter {
|
|
1104
|
+
/** 状态精确匹配 */
|
|
1105
|
+
status?: string;
|
|
1106
|
+
/** 大小写不敏感子串:匹配 runId 或任一激活技能名 */
|
|
1107
|
+
search?: string;
|
|
1108
|
+
limit?: number;
|
|
1109
|
+
offset?: number;
|
|
1110
|
+
}
|
|
1111
|
+
/** @stable */
|
|
1112
|
+
interface RunTraceMetrics {
|
|
1113
|
+
totalRuns: number;
|
|
1114
|
+
succeeded: number;
|
|
1115
|
+
failed: number;
|
|
1116
|
+
/** succeeded / totalRuns(无 run 时为 0) */
|
|
1117
|
+
successRate: number;
|
|
1118
|
+
/** turnCount 均值(无可用 run 时为 0) */
|
|
1119
|
+
avgTurns: number;
|
|
1120
|
+
/** 摘要不可解析、已排除在统计外的 run 数(正常为 0) */
|
|
1121
|
+
skippedRuns: number;
|
|
1122
|
+
/** 有 durationMs 的 run 的均值 ms(无则 0) */
|
|
1123
|
+
avgDurationMs: number;
|
|
1124
|
+
/** 近期失败(status === 'failed',按 startedAt 降序,至多 5 条) */
|
|
1125
|
+
recentFailures: RunTraceSummary[];
|
|
1126
|
+
}
|
|
1127
|
+
/** @stable */
|
|
1128
|
+
interface RunTraceStore {
|
|
1129
|
+
put(run: RuntimeRun): Promise<void>;
|
|
1130
|
+
get(runId: string): Promise<RunTraceFile>;
|
|
1131
|
+
list(filter?: RunTraceFilter): Promise<RunTraceSummary[]>;
|
|
1132
|
+
metrics(filter?: RunTraceFilter): Promise<RunTraceMetrics>;
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* `FileSystemProvider` 后端:`<root>/<runId>.json` 存全量 trace,
|
|
1136
|
+
* `<root>/index.jsonl` 是 append-only 的摘要旁路索引。
|
|
1137
|
+
*
|
|
1138
|
+
* 索引存在的唯一理由是**读次数**:0.0.1 的实现为了拼一份列表要整读每个 trace
|
|
1139
|
+
* 文件,点一次指标再来一遍。有了索引,`list()` 与 `metrics()` 各只读一个文件。
|
|
1140
|
+
*
|
|
1141
|
+
* 索引与 trace 目录发散(写完 trace 崩在追加前)的检测不引入新的读放大:
|
|
1142
|
+
* 目录列举本来就要做,比较 `*.json` 个数与索引行数即可;不等则整体重建。
|
|
1143
|
+
* @stable
|
|
1144
|
+
*/
|
|
1145
|
+
declare class FsRunTraceStore implements RunTraceStore {
|
|
1146
|
+
#private;
|
|
1147
|
+
constructor(deps: {
|
|
1148
|
+
root: string;
|
|
1149
|
+
fs: FileSystemProvider;
|
|
1150
|
+
/** 落盘失败的降级处理;默认 console.warn,保持「写失败不阻断对话」的产品语义 */
|
|
1151
|
+
onError?: (error: unknown, run: RuntimeRun) => void;
|
|
1152
|
+
});
|
|
1153
|
+
put(run: RuntimeRun): Promise<void>;
|
|
1154
|
+
get(runId: string): Promise<RunTraceFile>;
|
|
1155
|
+
list(filter?: RunTraceFilter): Promise<RunTraceSummary[]>;
|
|
1156
|
+
metrics(filter?: RunTraceFilter): Promise<RunTraceMetrics>;
|
|
1157
|
+
}
|
|
1158
|
+
//#endregion
|
|
1159
|
+
//#region src/engine/toolCalls.d.ts
|
|
1160
|
+
/**
|
|
1161
|
+
* 一次工具调用的终态摘要(completed / failed)。
|
|
1162
|
+
* @stable
|
|
1163
|
+
*/
|
|
1164
|
+
interface RunToolCall {
|
|
1165
|
+
callId: string;
|
|
1166
|
+
name: string;
|
|
1167
|
+
status: 'completed' | 'failed';
|
|
1168
|
+
/** 参数摘要(JSON 截断 100 字符) */
|
|
1169
|
+
args?: string;
|
|
1170
|
+
/** 执行耗时 ms */
|
|
1171
|
+
durationMs?: number;
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* 从 run 的 trace 推导终态工具调用列表。
|
|
1175
|
+
*
|
|
1176
|
+
* 消费者过去要靠自己遍历 trace 才能拿到这份列表,而遍历 trace 的同一段代码
|
|
1177
|
+
* 又顺手承担了「补发漏掉的 live 事件」的职责——两件事绑在一起,谁也删不掉。
|
|
1178
|
+
* 幂等归 runtime(见 `AgentLoop` 的 per-run 已发集合)之后,
|
|
1179
|
+
* 推导终态列表就是纯函数,独立导出。
|
|
1180
|
+
* @stable
|
|
1181
|
+
*/
|
|
1182
|
+
declare function summarizeToolCalls(run: RuntimeRun): RunToolCall[];
|
|
1183
|
+
//#endregion
|
|
1184
|
+
//#region src/engine/session.d.ts
|
|
1185
|
+
declare const SESSION_SCHEMA_VERSION = 1;
|
|
1186
|
+
/** `FsSessionStore` 的缺省页长。缺省值属于实现,不属于调用方——否则「下推」只推了一半 */
|
|
1187
|
+
declare const FS_SESSION_PAGE_SIZE = 50;
|
|
1188
|
+
/** 会话列表行:不含消息正文,`list()` 的返回元素 */
|
|
1189
|
+
interface SessionMeta {
|
|
1190
|
+
id: string;
|
|
1191
|
+
createdAt: string;
|
|
1192
|
+
title?: string;
|
|
1193
|
+
/** 用户已手动重命名:调用方不应再用首条消息覆盖标题 */
|
|
1194
|
+
titleLocked?: boolean;
|
|
1195
|
+
/** 归档标记:默认 `list()` 不返回 */
|
|
1196
|
+
archived?: boolean;
|
|
1197
|
+
messageCount: number;
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* 会话落盘形态。`schemaVersion` 反映**磁盘上的实际值**:
|
|
1201
|
+
* 0.0.1 时代的文件没有该字段,读出来是 0(写回时一律升到当前版本,不做读时原地升级)。
|
|
1202
|
+
*/
|
|
1203
|
+
interface SessionRecord<TMessage = unknown> extends SessionMeta {
|
|
1204
|
+
schemaVersion: number;
|
|
1205
|
+
messages: TMessage[];
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* 会话持久化端口。消息载荷对 runtime 不透明——`ChatMessage` 是 chatbot 的 UI 类型,
|
|
1209
|
+
* runtime 不能认识它,所以泛型默认 `unknown`(只读消费方直接用默认参数即可)。
|
|
1210
|
+
*/
|
|
1211
|
+
interface SessionStore<TMessage = unknown> {
|
|
1212
|
+
/**
|
|
1213
|
+
* 会话列表页。翻页方向固定为**从新到旧**(聊天 UI 的「加载更多」总是向历史走),
|
|
1214
|
+
* 页内元素仍按 `createdAt` 升序,与 0.3.0 的全量 `list()` 同序。
|
|
1215
|
+
*/
|
|
1216
|
+
list(options?: {
|
|
1217
|
+
includeArchived?: boolean;
|
|
1218
|
+
} & PageQuery): Promise<Page<SessionMeta>>;
|
|
1219
|
+
get(id: string): Promise<SessionRecord<TMessage> | undefined>;
|
|
1220
|
+
/**
|
|
1221
|
+
* 消息分页读。与 `list()` 同方向:无游标时给**最后**一页(最新的 `limit` 条),
|
|
1222
|
+
* `nextCursor` 指向更早的历史。页内元素按时间升序,UI 直接前插即可。
|
|
1223
|
+
*
|
|
1224
|
+
* 存在的理由是 `get()` 拿的是全量:长会话下 UI 只需要末尾几十条。
|
|
1225
|
+
*/
|
|
1226
|
+
listMessages(id: string, options?: PageQuery): Promise<Page<TMessage>>;
|
|
1227
|
+
create(init?: {
|
|
1228
|
+
id?: string;
|
|
1229
|
+
title?: string;
|
|
1230
|
+
}): Promise<SessionMeta>;
|
|
1231
|
+
/** 追加消息;同一 id 的并发调用互相串行,不丢消息 */
|
|
1232
|
+
appendMessages(id: string, messages: readonly TMessage[]): Promise<void>;
|
|
1233
|
+
/** 整体替换消息列表(删除单条 / 编辑重发截断历史用;破坏性,不与 append 竞争) */
|
|
1234
|
+
replaceMessages(id: string, messages: readonly TMessage[]): Promise<void>;
|
|
1235
|
+
setTitle(id: string, title: string, options?: {
|
|
1236
|
+
lock?: boolean;
|
|
1237
|
+
}): Promise<void>;
|
|
1238
|
+
setArchived(id: string, archived: boolean): Promise<void>;
|
|
1239
|
+
delete(id: string): Promise<void>;
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* `FileSystemProvider` 后端的会话存储:`<root>/<id>.json`。
|
|
1243
|
+
*
|
|
1244
|
+
* 所有变更操作按 id 串到一条 promise 链上:会话文件是整读整写的,
|
|
1245
|
+
* 两个并发 `appendMessages` 若都先读后写,后写的会覆盖先写的那条消息。
|
|
1246
|
+
*/
|
|
1247
|
+
declare class FsSessionStore<TMessage = unknown> implements SessionStore<TMessage> {
|
|
1248
|
+
#private;
|
|
1249
|
+
constructor(deps: {
|
|
1250
|
+
root: string;
|
|
1251
|
+
fs: FileSystemProvider;
|
|
1252
|
+
});
|
|
1253
|
+
list(options?: {
|
|
1254
|
+
includeArchived?: boolean;
|
|
1255
|
+
} & PageQuery): Promise<Page<SessionMeta>>;
|
|
1256
|
+
/**
|
|
1257
|
+
* 整文件读后切片。磁盘 I/O 复杂度没有改善(备案 D25),
|
|
1258
|
+
* 但**跨出端口的记录数**已是常量——这正是分页对上层的意义。
|
|
1259
|
+
*/
|
|
1260
|
+
listMessages(id: string, options?: PageQuery): Promise<Page<TMessage>>;
|
|
1261
|
+
get(id: string): Promise<SessionRecord<TMessage> | undefined>;
|
|
1262
|
+
create(init?: {
|
|
1263
|
+
id?: string;
|
|
1264
|
+
title?: string;
|
|
1265
|
+
}): Promise<SessionMeta>;
|
|
1266
|
+
appendMessages(id: string, messages: readonly TMessage[]): Promise<void>;
|
|
1267
|
+
replaceMessages(id: string, messages: readonly TMessage[]): Promise<void>;
|
|
1268
|
+
setTitle(id: string, title: string, options?: {
|
|
1269
|
+
lock?: boolean;
|
|
1270
|
+
}): Promise<void>;
|
|
1271
|
+
setArchived(id: string, archived: boolean): Promise<void>;
|
|
1272
|
+
delete(id: string): Promise<void>;
|
|
1273
|
+
}
|
|
1274
|
+
//#endregion
|
|
1275
|
+
export { RunSnapshot as $, normalizeToolContent as $t, GoogleGenAiClientConfig as A, TraceClock as At, LifecycleListener as B, buildRenderResult as Bt, FsArtifactStore as C, SkillOutcomeReporter as Ct, FsSessionStore as D, ToolDefinition as Dt, FsRunTraceStore as E, TerminalLifecycleData as Et, InteractLifecycleData as F, VercelToolSpec as Ft, READ_SKILL_FILE_INPUT_SCHEMA as G, fromVercelResult as Gt, OpenAiCompatibleClient as H, createWebSkillApi as Ht, LifecycleEvent as I, WebSkillApi as It, RUN_SNAPSHOT_SCHEMA_VERSION as J, isUnsupportedRunSnapshot as Jt, READ_SKILL_FILE_TOOL as K, fromVercelStreamPart as Kt, LifecycleEventInit as L, WebSkillRuntime as Lt, HookRunnerOptions as M, TraceEventType as Mt, InstalledSkillManifest as N, TraceRecorder as Nt, FullDisclosureRouter as O, ToolResolution as Ot, IntegrityVerdict as P, UnsupportedRunSnapshot as Pt, RunResult as Q, normalizeErrorCode as Qt, LifecycleHook as R, WebSkillRuntimeDeps as Rt, FS_SESSION_PAGE_SIZE as S, SkillIntegrityGuard as St, FsRunSnapshotStore as T, SkillStateGuard as Tt, OpenAiCompatibleClientConfig as U, extractChartSpec as Ut, NetworkPolicy as V, createScriptContext as Vt, ProgressiveRouter as W, extractUiSpecEvents as Wt, RouteLifecycleData as X, networkPolicyLibSource as Xt, RUN_TRACE_SCHEMA_VERSION as Y, mergeCatalogEntries as Yt, RouteResult as Z, networkUrlHost as Zt, CapabilityMode as _, SerializingMemoryStore as _t, AgentLoop as a, summarizeToolCalls as an, RunTraceFilter as at, ExternalSkillProvider as b, SessionStore as bt, AnthropicClient as c, toVercelToolSpecs as cn, RunTraceSummary as ct, ApprovalScope as d, RuntimeSession as dt, normalizeToolError as en, RunSnapshotListEntry as et, BridgeCapabilities as f, RuntimeSessionHandle as ft, CapabilityApproval as g, ScriptExecutor as gt, BridgeResponse as h, ScriptExecutionContext as ht, ActivateLifecycleData as i, schemaToForm as in, RunTraceFile as it, HookRunner as j, TraceEvent as jt, GoogleGenAiClient as k, ToolResult as kt, AnthropicClientConfig as l, validateUiSpecEvent as ln, RuntimePhase as lt, BridgeRequest as m, SchemaInferer as mt, ASK_USER_TOOL as n, partsToText as nn, RunTerminationReason as nt, AgentLoopConfig as o, textParts as on, RunTraceMetrics as ot, BridgeCapability as p, SESSION_SCHEMA_VERSION as pt, READ_SKILL_FILE_TOOL_NAME as q, isNetworkAllowed as qt, ASK_USER_TOOL_NAME as r, resolveToolName as rn, RunToolCall as rt, AgentLoopDeps as s, toLlmToolSpec as sn, RunTraceStore as st, ASK_USER_INPUT_SCHEMA as t, parseBridgeRequest as tn, RunSnapshotStore as tt, ApprovalDecision as u, validateUiSpecNode as un, RuntimeRun as ut, EventBus as v, SessionMeta as vt, FsMemoryStore as w, SkillRouter as wt, ExternalToolSource as x, SkillFailureReport as xt, ExecuteLifecycleData as y, SessionRecord as yt, LifecycleHookContext as z, bridgeError as zt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as
|
|
3
|
-
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, AnthropicClient, type AnthropicClientConfig, type ApprovalDecision, type ApprovalScope, type ArchiveLimits, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, DEFAULT_ARCHIVE_LIMITS, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, type GoogleGenAiClientConfig, HookRunner, type HookRunnerOptions, type InstalledSkillManifest, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MemoryFS, type MemoryStore, type NetworkPolicy, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, type RemoteUrlPolicy, type RenderBlock, type RenderResultRequest, type RouteResult, type RunResult, type RunSnapshot, type RunSnapshotStore, type RunTerminationReason, type RuntimePhase, type RuntimeRun, type RuntimeSession, type RuntimeSessionHandle, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, SerializingMemoryStore, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillInstallSource, type SkillIssue, type SkillLocation, type SkillManifest, type SkillMetadata, type SkillPackManifest, SkillReader, type SkillRouter, type SkillSource, type SkillStateGuard, type SkillsLockfile, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type UiBridge, type
|
|
1
|
+
import { $ as SkillDocument, A as DEFAULT_ARCHIVE_LIMITS, At as jsonRenderer, B as RemoteUrlPolicy, Bt as resolveArchiveLimits, C as UiSpecPatch, Ct as buildManifest, D as ArchiveLimits, Dt as escapeXml, E as UiSurfaceActionResponse, Et as computeDigest, F as JsonSchema, Ft as parseSkillPackManifest, G as SKILL_NAME_PATTERN, Gt as validateSkills, H as SKILLS_LOCKFILE, Ht as signSkill, I as MANIFEST_EXCLUDED_FILES, It as readResponseWithLimit, J as SignatureAuditSink, Jt as xmlRenderer, K as SKILL_PACK_FILE, Kt as verifyManifest, L as MemoryFS, Lt as readSkillSignature, M as FileStat, Mt as messageOf, N as FileSystemProvider, Nt as normalizePath, O as CatalogRenderer, Ot as exportSkills, P as FsTrustedKeyStore, Pt as parseSkillMarkdown, Q as SkillDiscovery, R as Page, Rt as renderAvailableSkillsXml, S as UiSpecEvent, St as buildCatalog, T as UiSurfaceActionRequest, Tt as checkSkillRules, U as SKILL_MANIFEST_FILE, Ut as signaturePayloadBytes, V as SIGNATURE_SCHEMA_VERSION, Vt as resolveInsideRoot, W as SKILL_NAME_MAX_LENGTH, Wt as unzipWithLimits, X as SkillCatalog, Y as SignatureVerdict, Z as SkillCatalogEntry, _ as RenderBlock, _t as WebSkillError, a as InteractionPolicy, at as SkillMetadata, b as UiSpecActionCapability, bt as assertSafePathSegment, c as LlmClient, ct as SkillSignature, d as LlmMessage, dt as TrustedKey, et as SkillInstallSource, f as LlmResponse, ft as TrustedKeyStore, g as MemoryStore, gt as VerifyResult, h as LlmToolSpec, ht as ValidationReport, i as FormField, it as SkillManifest, j as DiscoveryResult, jt as keyIdOf, k as CryptoKeyLike, kt as isValidSkillName, l as LlmCompleteInput, lt as SkillSource, m as LlmToolCall, mt as UnsignedPolicy, n as ArtifactStore, nt as SkillLocation, o as InteractionRequest, ot as SkillPackManifest, p as LlmStreamEvent, pt as UiSpecNode, q as SKILL_SIGNATURE_FILE, qt as verifySkillSignature, r as ChartSpec, rt as SkillManagerPort, s as InteractionResponse, st as SkillReader, t as Artifact, tt as SkillIssue, u as LlmContentPart, ut as SkillsLockfile, v as RenderResultRequest, vt as WebSkillErrorCode, w as UiSpecSnapshot, wt as checkDependencyCycles, x as UiSpecDrafts, xt as atomicWriteText, y as UiBridge, yt as assertRemoteUrlAllowed, z as PageQuery, zt as renderCatalogJson } from "./types-7Wcg--Vh-1YlQ4jF9.js";
|
|
2
|
+
import { $ as RunSnapshot, $t as normalizeToolContent, A as GoogleGenAiClientConfig, At as TraceClock, B as LifecycleListener, Bt as buildRenderResult, C as FsArtifactStore, Ct as SkillOutcomeReporter, D as FsSessionStore, Dt as ToolDefinition, E as FsRunTraceStore, Et as TerminalLifecycleData, F as InteractLifecycleData, Ft as VercelToolSpec, G as READ_SKILL_FILE_INPUT_SCHEMA, Gt as fromVercelResult, H as OpenAiCompatibleClient, Ht as createWebSkillApi, I as LifecycleEvent, It as WebSkillApi, J as RUN_SNAPSHOT_SCHEMA_VERSION, Jt as isUnsupportedRunSnapshot, K as READ_SKILL_FILE_TOOL, Kt as fromVercelStreamPart, L as LifecycleEventInit, Lt as WebSkillRuntime, M as HookRunnerOptions, Mt as TraceEventType, N as InstalledSkillManifest, Nt as TraceRecorder, O as FullDisclosureRouter, Ot as ToolResolution, P as IntegrityVerdict, Pt as UnsupportedRunSnapshot, Q as RunResult, Qt as normalizeErrorCode, R as LifecycleHook, Rt as WebSkillRuntimeDeps, S as FS_SESSION_PAGE_SIZE, St as SkillIntegrityGuard, T as FsRunSnapshotStore, Tt as SkillStateGuard, U as OpenAiCompatibleClientConfig, Ut as extractChartSpec, V as NetworkPolicy, Vt as createScriptContext, W as ProgressiveRouter, Wt as extractUiSpecEvents, X as RouteLifecycleData, Xt as networkPolicyLibSource, Y as RUN_TRACE_SCHEMA_VERSION, Yt as mergeCatalogEntries, Z as RouteResult, Zt as networkUrlHost, _ as CapabilityMode, _t as SerializingMemoryStore, a as AgentLoop, an as summarizeToolCalls, at as RunTraceFilter, b as ExternalSkillProvider, bt as SessionStore, c as AnthropicClient, cn as toVercelToolSpecs, ct as RunTraceSummary, d as ApprovalScope, dt as RuntimeSession, en as normalizeToolError, et as RunSnapshotListEntry, f as BridgeCapabilities, ft as RuntimeSessionHandle, g as CapabilityApproval, gt as ScriptExecutor, h as BridgeResponse, ht as ScriptExecutionContext, i as ActivateLifecycleData, in as schemaToForm, it as RunTraceFile, j as HookRunner, jt as TraceEvent, k as GoogleGenAiClient, kt as ToolResult, l as AnthropicClientConfig, ln as validateUiSpecEvent, lt as RuntimePhase, m as BridgeRequest, mt as SchemaInferer, n as ASK_USER_TOOL, nn as partsToText, nt as RunTerminationReason, o as AgentLoopConfig, on as textParts, ot as RunTraceMetrics, p as BridgeCapability, pt as SESSION_SCHEMA_VERSION, q as READ_SKILL_FILE_TOOL_NAME, qt as isNetworkAllowed, r as ASK_USER_TOOL_NAME, rn as resolveToolName, rt as RunToolCall, s as AgentLoopDeps, sn as toLlmToolSpec, st as RunTraceStore, t as ASK_USER_INPUT_SCHEMA, tn as parseBridgeRequest, tt as RunSnapshotStore, u as ApprovalDecision, un as validateUiSpecNode, ut as RuntimeRun, v as EventBus, vt as SessionMeta, w as FsMemoryStore, wt as SkillRouter, x as ExternalToolSource, xt as SkillFailureReport, y as ExecuteLifecycleData, yt as SessionRecord, z as LifecycleHookContext, zt as bridgeError } from "./index-DLfR2Y6I.js";
|
|
3
|
+
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, type ActivateLifecycleData, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, AnthropicClient, type AnthropicClientConfig, type ApprovalDecision, type ApprovalScope, type ArchiveLimits, type Artifact, type ArtifactStore, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, type CryptoKeyLike, DEFAULT_ARCHIVE_LIMITS, type DiscoveryResult, EventBus, type ExecuteLifecycleData, type ExternalSkillProvider, type ExternalToolSource, FS_SESSION_PAGE_SIZE, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FsRunTraceStore, FsSessionStore, FsTrustedKeyStore, FullDisclosureRouter, GoogleGenAiClient, type GoogleGenAiClientConfig, HookRunner, type HookRunnerOptions, type InstalledSkillManifest, type IntegrityVerdict, type InteractLifecycleData, type InteractionPolicy, type InteractionRequest, type InteractionResponse, type JsonSchema, type LifecycleEvent, type LifecycleEventInit, type LifecycleHook, type LifecycleHookContext, type LifecycleListener, type LlmClient, type LlmCompleteInput, type LlmContentPart, type LlmMessage, type LlmResponse, type LlmStreamEvent, type LlmToolCall, type LlmToolSpec, MANIFEST_EXCLUDED_FILES, MemoryFS, type MemoryStore, type NetworkPolicy, OpenAiCompatibleClient, type OpenAiCompatibleClientConfig, type Page, type PageQuery, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, RUN_TRACE_SCHEMA_VERSION, type RemoteUrlPolicy, type RenderBlock, type RenderResultRequest, type RouteLifecycleData, type RouteResult, type RunResult, type RunSnapshot, type RunSnapshotListEntry, type RunSnapshotStore, type RunTerminationReason, type RunToolCall, type RunTraceFile, type RunTraceFilter, type RunTraceMetrics, type RunTraceStore, type RunTraceSummary, type RuntimePhase, type RuntimeRun, type RuntimeSession, type RuntimeSessionHandle, SESSION_SCHEMA_VERSION, SIGNATURE_SCHEMA_VERSION, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, SKILL_SIGNATURE_FILE, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, SerializingMemoryStore, type SessionMeta, type SessionRecord, type SessionStore, type SignatureAuditSink, type SignatureVerdict, type SkillCatalog, type SkillCatalogEntry, SkillDiscovery, type SkillDocument, type SkillFailureReport, type SkillInstallSource, type SkillIntegrityGuard, type SkillIssue, type SkillLocation, type SkillManagerPort, type SkillManifest, type SkillMetadata, type SkillOutcomeReporter, type SkillPackManifest, SkillReader, type SkillRouter, type SkillSignature, type SkillSource, type SkillStateGuard, type SkillsLockfile, type TerminalLifecycleData, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type TrustedKey, type TrustedKeyStore, type UiBridge, type UiSpecActionCapability, type UiSpecDrafts, type UiSpecEvent, type UiSpecNode, type UiSpecPatch, type UiSpecSnapshot, type UiSurfaceActionRequest, type UiSurfaceActionResponse, type UnsignedPolicy, type UnsupportedRunSnapshot, type ValidationReport, type VercelToolSpec, type VerifyResult, type WebSkillApi, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, extractUiSpecEvents, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isUnsupportedRunSnapshot, isValidSkillName, jsonRenderer, keyIdOf, mergeCatalogEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, partsToText, readResponseWithLimit, readSkillSignature, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, signSkill, signaturePayloadBytes, summarizeToolCalls, textParts, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSpecEvent, validateUiSpecNode, verifyManifest, verifySkillSignature, xmlRenderer };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import {
|
|
1
|
+
import { A as parseSkillMarkdown, B as unzipWithLimits, C as escapeXml, D as keyIdOf, E as jsonRenderer, F as renderCatalogJson, H as verifyManifest, I as resolveArchiveLimits, L as resolveInsideRoot, M as readResponseWithLimit, N as readSkillSignature, O as messageOf, P as renderAvailableSkillsXml, R as signSkill, S as computeDigest, T as isValidSkillName, U as verifySkillSignature, V as validateSkills, W as xmlRenderer, _ as atomicWriteText, a as SIGNATURE_SCHEMA_VERSION, b as checkDependencyCycles, c as SKILL_NAME_MAX_LENGTH, d as SKILL_SIGNATURE_FILE, f as SkillDiscovery, g as assertSafePathSegment, h as assertRemoteUrlAllowed, i as MemoryFS, j as parseSkillPackManifest, k as normalizePath, l as SKILL_NAME_PATTERN, m as WebSkillError, n as FsTrustedKeyStore, o as SKILLS_LOCKFILE, p as SkillReader, r as MANIFEST_EXCLUDED_FILES, s as SKILL_MANIFEST_FILE, t as DEFAULT_ARCHIVE_LIMITS, u as SKILL_PACK_FILE, v as buildCatalog, w as exportSkills, x as checkSkillRules, y as buildManifest, z as signaturePayloadBytes } from "./dist-8oQRa8Xz.js";
|
|
2
|
+
import { i as textParts, n as partsToText } from "./memoryArtifactStore-BtOeB_hm-tj3fC5ip.js";
|
|
3
|
+
import { A as createScriptContext, B as networkUrlHost, C as RUN_TRACE_SCHEMA_VERSION, D as WebSkillRuntime, E as TraceRecorder, F as fromVercelStreamPart, G as resolveToolName, H as normalizeToolContent, I as isNetworkAllowed, J as toLlmToolSpec, K as schemaToForm, L as isUnsupportedRunSnapshot, M as extractChartSpec, N as extractUiSpecEvents, O as bridgeError, P as fromVercelResult, R as mergeCatalogEntries, S as RUN_SNAPSHOT_SCHEMA_VERSION, T as SerializingMemoryStore, U as normalizeToolError, V as normalizeErrorCode, W as parseBridgeRequest, X as validateUiSpecEvent, Y as toVercelToolSpecs, Z as validateUiSpecNode, _ as OpenAiCompatibleClient, a as AnthropicClient, b as READ_SKILL_FILE_TOOL, c as FS_SESSION_PAGE_SIZE, d as FsRunSnapshotStore, f as FsRunTraceStore, g as HookRunner, h as GoogleGenAiClient, i as AgentLoop, j as createWebSkillApi, k as buildRenderResult, l as FsArtifactStore, m as FullDisclosureRouter, n as ASK_USER_TOOL, o as CapabilityApproval, p as FsSessionStore, q as summarizeToolCalls, r as ASK_USER_TOOL_NAME, s as EventBus, t as ASK_USER_INPUT_SCHEMA, u as FsMemoryStore, v as ProgressiveRouter, w as SESSION_SCHEMA_VERSION, x as READ_SKILL_FILE_TOOL_NAME, y as READ_SKILL_FILE_INPUT_SCHEMA, z as networkPolicyLibSource } from "./dist-C-Sh0MDU.js";
|
|
3
4
|
|
|
4
|
-
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, AnthropicClient, CapabilityApproval, DEFAULT_ARCHIVE_LIMITS, EventBus, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FullDisclosureRouter, GoogleGenAiClient, HookRunner, MemoryFS, OpenAiCompatibleClient, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, SerializingMemoryStore, SkillDiscovery, SkillReader, TraceRecorder, WebSkillError, WebSkillRuntime, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec,
|
|
5
|
+
export { ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, AnthropicClient, CapabilityApproval, DEFAULT_ARCHIVE_LIMITS, EventBus, FS_SESSION_PAGE_SIZE, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FsRunTraceStore, FsSessionStore, FsTrustedKeyStore, FullDisclosureRouter, GoogleGenAiClient, HookRunner, MANIFEST_EXCLUDED_FILES, MemoryFS, OpenAiCompatibleClient, ProgressiveRouter, READ_SKILL_FILE_INPUT_SCHEMA, READ_SKILL_FILE_TOOL, READ_SKILL_FILE_TOOL_NAME, RUN_SNAPSHOT_SCHEMA_VERSION, RUN_TRACE_SCHEMA_VERSION, SESSION_SCHEMA_VERSION, SIGNATURE_SCHEMA_VERSION, SKILLS_LOCKFILE, SKILL_MANIFEST_FILE, SKILL_NAME_MAX_LENGTH, SKILL_NAME_PATTERN, SKILL_PACK_FILE, SKILL_SIGNATURE_FILE, SerializingMemoryStore, SkillDiscovery, SkillReader, TraceRecorder, WebSkillError, WebSkillRuntime, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, escapeXml, exportSkills, extractChartSpec, extractUiSpecEvents, fromVercelResult, fromVercelStreamPart, isNetworkAllowed, isUnsupportedRunSnapshot, isValidSkillName, jsonRenderer, keyIdOf, mergeCatalogEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, partsToText, readResponseWithLimit, readSkillSignature, renderAvailableSkillsXml, renderCatalogJson, resolveArchiveLimits, resolveInsideRoot, resolveToolName, schemaToForm, signSkill, signaturePayloadBytes, summarizeToolCalls, textParts, toLlmToolSpec, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSpecEvent, validateUiSpecNode, verifyManifest, verifySkillSignature, xmlRenderer };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { $ as SkillDocument, F as JsonSchema, Z as SkillCatalogEntry, h as LlmToolSpec } from "./types-7Wcg--Vh-1YlQ4jF9.js";
|
|
2
|
+
import { Yt as mergeCatalogEntries, b as ExternalSkillProvider, kt as ToolResult, x as ExternalToolSource } from "./index-DLfR2Y6I.js";
|
|
3
3
|
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
4
4
|
import { JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|