@webskill/sdk 0.3.0 → 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/dist/browser.d.ts +2 -2
- package/dist/browser.js +2 -6
- package/dist/{catalogComponents-C_V39rbF-BOHveMWa.js → catalogComponents-KsujmL4b-Clx1kCnU.js} +278 -122
- package/dist/{dist-rorEJsNi.js → dist-C-Sh0MDU.js} +498 -282
- package/dist/{dist-ZKaM8j06.js → dist-D9Lcn5Pp.js} +527 -837
- package/dist/governance.d.ts +45 -10
- package/dist/governance.js +151 -24
- package/dist/{index-wiV5X8Rz.d.ts → index-CHXxDccV.d.ts} +62 -144
- package/dist/{index-8d-oEDww.d.ts → index-DLfR2Y6I.d.ts} +215 -23
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +1 -1
- package/dist/memoryArtifactStore-BtOeB_hm-tj3fC5ip.js +78 -0
- package/dist/node.d.ts +8 -4
- package/dist/node.js +1 -1
- package/dist/{openUiLibrary-B8-Cvou9-BbpNTXS3.js → openUiLibrary-YLS-cxyT-C96jWDQq.js} +6 -5
- package/dist/{skillVersionStore-DOEI9ptb-BxbYL70B.d.ts → skillVersionStore-uyefLPR1-DXOzbksv.d.ts} +41 -10
- package/dist/{testing-CsrG3XLz.js → testing-DDCJWvgA.js} +7 -5
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/{types-AmKCKJn_-VGabeXK4.d.ts → types-7Wcg--Vh-1YlQ4jF9.d.ts} +85 -71
- package/dist/ui-react.d.ts +329 -18
- package/dist/ui-react.js +3714 -3463
- 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-BslMcxRZ.js → webskillLitCatalog-CSTbhBe_-CYIs5BX8.js} +312 -122
- package/package.json +1 -1
- package/dist/jsonRenderRegistry-9GrWP_hE-U6Do3Kid.js +0 -2468
- package/dist/memoryArtifactStore-C9lFVqPF-yFz6yJj0.js +0 -48
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { $ as
|
|
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;
|
|
@@ -677,11 +825,11 @@ interface RunSnapshot {
|
|
|
677
825
|
/** 等待中的 surface action;其工具结果已入消息历史,无需重跑工具。 */
|
|
678
826
|
pendingSurfaceAction?: UiSurfaceActionRequest;
|
|
679
827
|
/** 未提交的 surface form values;仅在 interrupted surface action 等待期间保存。 */
|
|
680
|
-
surfaceDrafts?:
|
|
828
|
+
surfaceDrafts?: UiSpecDrafts;
|
|
681
829
|
/** $chart 等内容收集的渲染块(0.2.0 起跨 resume 保留;旧快照缺省视为空) */
|
|
682
830
|
renderBlocks?: RenderBlock[];
|
|
683
831
|
/** 已成功渲染的 surface 事件;resume 时按原序重放(旧快照缺省视为空) */
|
|
684
|
-
surfaceEvents?:
|
|
832
|
+
surfaceEvents?: UiSpecEvent[];
|
|
685
833
|
/** 交互 id 序号(resume 后续算,避免 id 冲突;旧快照缺省从 0 起) */
|
|
686
834
|
interactionSeq?: number;
|
|
687
835
|
/** Runtime 注入的 surface action nonce 序号(resume 后续算;旧快照缺省从 0 起) */
|
|
@@ -700,12 +848,30 @@ interface RunSnapshot {
|
|
|
700
848
|
};
|
|
701
849
|
snapshotAt: string;
|
|
702
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;
|
|
703
869
|
/** @experimental */
|
|
704
870
|
interface RunSnapshotStore {
|
|
705
871
|
save(snapshot: RunSnapshot): Promise<void>;
|
|
706
872
|
load(runId: string): Promise<RunSnapshot | undefined>;
|
|
707
873
|
delete(runId: string): Promise<void>;
|
|
708
|
-
list(): Promise<
|
|
874
|
+
list(): Promise<RunSnapshotListEntry[]>;
|
|
709
875
|
}
|
|
710
876
|
/**
|
|
711
877
|
* FileSystemProvider 后端的快照存储:<root>/<runId>.snapshot.json。
|
|
@@ -725,7 +891,7 @@ declare class FsRunSnapshotStore implements RunSnapshotStore {
|
|
|
725
891
|
save(snapshot: RunSnapshot): Promise<void>;
|
|
726
892
|
load(runId: string): Promise<RunSnapshot | undefined>;
|
|
727
893
|
delete(runId: string): Promise<void>;
|
|
728
|
-
list(): Promise<
|
|
894
|
+
list(): Promise<RunSnapshotListEntry[]>;
|
|
729
895
|
}
|
|
730
896
|
//#endregion
|
|
731
897
|
//#region src/engine/agentLoop.d.ts
|
|
@@ -761,6 +927,10 @@ interface AgentLoopDeps {
|
|
|
761
927
|
catalogFilter?: (entries: SkillCatalogEntry[]) => SkillCatalogEntry[] | Promise<SkillCatalogEntry[]>;
|
|
762
928
|
/** 技能状态拦截(read/activate/execute 三入口一致执行;无注入默认全放行) */
|
|
763
929
|
skillStateGuard?: SkillStateGuard;
|
|
930
|
+
/** D3 激活期完整性校验 port(治理装配;无注入即关闭) */
|
|
931
|
+
skillIntegrityGuard?: SkillIntegrityGuard;
|
|
932
|
+
/** F1 技能执行失败上报 port(治理装配;无注入即关闭) */
|
|
933
|
+
skillOutcomeReporter?: SkillOutcomeReporter;
|
|
764
934
|
/** D3:interrupt 点快照存储(无配置则行为与现状完全一致) */
|
|
765
935
|
snapshotStore?: RunSnapshotStore;
|
|
766
936
|
}
|
|
@@ -833,6 +1003,10 @@ interface WebSkillRuntimeDeps {
|
|
|
833
1003
|
snapshotStore?: RunSnapshotStore;
|
|
834
1004
|
/** 技能状态拦截 port(治理 SkillStatePolicy.toSkillStateGuard 装配;无注入默认全放行) */
|
|
835
1005
|
skillStateGuard?: SkillStateGuard;
|
|
1006
|
+
/** D3 激活期完整性校验 port(治理 SkillStatePolicy.toSkillIntegrityGuard 装配;无注入即关闭) */
|
|
1007
|
+
skillIntegrityGuard?: SkillIntegrityGuard;
|
|
1008
|
+
/** F1 技能执行失败上报 port(治理 SkillStatePolicy.toSkillOutcomeReporter 装配;无注入即关闭) */
|
|
1009
|
+
skillOutcomeReporter?: SkillOutcomeReporter;
|
|
836
1010
|
}
|
|
837
1011
|
/**
|
|
838
1012
|
* runtime 门面:组合 discovery / router / agent loop / lifecycle
|
|
@@ -866,11 +1040,11 @@ declare class WebSkillRuntime {
|
|
|
866
1040
|
sessionId?: string;
|
|
867
1041
|
history?: LlmMessage[];
|
|
868
1042
|
}): Promise<RunResult>;
|
|
869
|
-
/** D3
|
|
870
|
-
listInterruptedRuns(): Promise<
|
|
1043
|
+
/** D3:列出 interrupted run(供 UI 展示"未完成任务");版本不受支持的项带 unsupported 标记 */
|
|
1044
|
+
listInterruptedRuns(): Promise<RunSnapshotListEntry[]>;
|
|
871
1045
|
/**
|
|
872
1046
|
* D3 恢复 interrupted run:
|
|
873
|
-
* 不存在 → RUN_SNAPSHOT_NOT_FOUND;
|
|
1047
|
+
* 不存在 → RUN_SNAPSHOT_NOT_FOUND;schema 版本不受支持 → RUN_SNAPSHOT_SCHEMA_UNSUPPORTED(由 store 抛出,不删文件);
|
|
874
1048
|
* 已过期 → interaction-timeout 终态并删快照;否则重建 LoopState 重新发起交互续跑。
|
|
875
1049
|
* @experimental
|
|
876
1050
|
*/
|
|
@@ -1009,6 +1183,8 @@ declare function summarizeToolCalls(run: RuntimeRun): RunToolCall[];
|
|
|
1009
1183
|
//#endregion
|
|
1010
1184
|
//#region src/engine/session.d.ts
|
|
1011
1185
|
declare const SESSION_SCHEMA_VERSION = 1;
|
|
1186
|
+
/** `FsSessionStore` 的缺省页长。缺省值属于实现,不属于调用方——否则「下推」只推了一半 */
|
|
1187
|
+
declare const FS_SESSION_PAGE_SIZE = 50;
|
|
1012
1188
|
/** 会话列表行:不含消息正文,`list()` 的返回元素 */
|
|
1013
1189
|
interface SessionMeta {
|
|
1014
1190
|
id: string;
|
|
@@ -1033,10 +1209,21 @@ interface SessionRecord<TMessage = unknown> extends SessionMeta {
|
|
|
1033
1209
|
* runtime 不能认识它,所以泛型默认 `unknown`(只读消费方直接用默认参数即可)。
|
|
1034
1210
|
*/
|
|
1035
1211
|
interface SessionStore<TMessage = unknown> {
|
|
1212
|
+
/**
|
|
1213
|
+
* 会话列表页。翻页方向固定为**从新到旧**(聊天 UI 的「加载更多」总是向历史走),
|
|
1214
|
+
* 页内元素仍按 `createdAt` 升序,与 0.3.0 的全量 `list()` 同序。
|
|
1215
|
+
*/
|
|
1036
1216
|
list(options?: {
|
|
1037
1217
|
includeArchived?: boolean;
|
|
1038
|
-
}): Promise<SessionMeta
|
|
1218
|
+
} & PageQuery): Promise<Page<SessionMeta>>;
|
|
1039
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>>;
|
|
1040
1227
|
create(init?: {
|
|
1041
1228
|
id?: string;
|
|
1042
1229
|
title?: string;
|
|
@@ -1065,7 +1252,12 @@ declare class FsSessionStore<TMessage = unknown> implements SessionStore<TMessag
|
|
|
1065
1252
|
});
|
|
1066
1253
|
list(options?: {
|
|
1067
1254
|
includeArchived?: boolean;
|
|
1068
|
-
}): Promise<SessionMeta
|
|
1255
|
+
} & PageQuery): Promise<Page<SessionMeta>>;
|
|
1256
|
+
/**
|
|
1257
|
+
* 整文件读后切片。磁盘 I/O 复杂度没有改善(备案 D25),
|
|
1258
|
+
* 但**跨出端口的记录数**已是常量——这正是分页对上层的意义。
|
|
1259
|
+
*/
|
|
1260
|
+
listMessages(id: string, options?: PageQuery): Promise<Page<TMessage>>;
|
|
1069
1261
|
get(id: string): Promise<SessionRecord<TMessage> | undefined>;
|
|
1070
1262
|
create(init?: {
|
|
1071
1263
|
id?: string;
|
|
@@ -1080,4 +1272,4 @@ declare class FsSessionStore<TMessage = unknown> implements SessionStore<TMessag
|
|
|
1080
1272
|
delete(id: string): Promise<void>;
|
|
1081
1273
|
}
|
|
1082
1274
|
//#endregion
|
|
1083
|
-
export {
|
|
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, type CryptoKeyLike, DEFAULT_ARCHIVE_LIMITS, type DiscoveryResult, EventBus, type ExternalSkillProvider, type ExternalToolSource, type FileStat, type FileSystemProvider, type FormField, FsArtifactStore, FsMemoryStore, FsRunSnapshotStore, FsRunTraceStore, FsSessionStore, FsTrustedKeyStore, 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, MANIFEST_EXCLUDED_FILES, 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, RUN_TRACE_SCHEMA_VERSION, type RemoteUrlPolicy, type RenderBlock, type RenderResultRequest, type RouteResult, type RunResult, type RunSnapshot, 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 SkillInstallSource, type SkillIssue, type SkillLocation, type SkillManagerPort, type SkillManifest, type SkillMetadata, type SkillPackManifest, SkillReader, type SkillRouter, type SkillSignature, type SkillSource, type SkillStateGuard, type SkillsLockfile, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type TrustedKey, type TrustedKeyStore, 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
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 {
|
|
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, 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,
|
|
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";
|
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { O as messageOf, h as assertRemoteUrlAllowed, m as WebSkillError } from "./dist-8oQRa8Xz.js";
|
|
2
|
-
import {
|
|
2
|
+
import { H as normalizeToolContent, R as mergeCatalogEntries } from "./dist-C-Sh0MDU.js";
|
|
3
3
|
|
|
4
4
|
//#region ../mcp/dist/index.js
|
|
5
5
|
/**
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { m as WebSkillError } from "./dist-8oQRa8Xz.js";
|
|
2
|
+
|
|
3
|
+
//#region ../runtime/dist/memoryArtifactStore-BtOeB_hm.js
|
|
4
|
+
/** 纯文本消息内容的构造快捷方式(引擎内部绝大多数消息仍是纯文本) */
|
|
5
|
+
const textParts = (text) => [{
|
|
6
|
+
type: "text",
|
|
7
|
+
text
|
|
8
|
+
}];
|
|
9
|
+
/** 取出 parts 中的文本(非文本分片在纯文本语境下无法表达,此处按丢弃处理——调用方须先校验) */
|
|
10
|
+
const partsToText = (parts) => (parts ?? []).reduce((acc, part) => part.type === "text" ? acc + part.text : acc, "");
|
|
11
|
+
const isContentPart = (value) => {
|
|
12
|
+
if (typeof value !== "object" || value === null) return false;
|
|
13
|
+
const part = value;
|
|
14
|
+
if (part["type"] === "text") return typeof part["text"] === "string";
|
|
15
|
+
if (part["type"] === "image" || part["type"] === "file") return typeof part["mimeType"] === "string" && typeof part["data"] === "string";
|
|
16
|
+
return false;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 0.4.0 起 `content` 是 parts 数组。旧的 `string` content 一律拒绝,不做静默转换:
|
|
20
|
+
* 转换会让「模型看到的输入」与「历史记录的输入」悄悄分叉。
|
|
21
|
+
*/
|
|
22
|
+
function validateLlmMessages(messages) {
|
|
23
|
+
messages.forEach((message, index) => {
|
|
24
|
+
if (typeof message.content === "string") throw new WebSkillError("VALIDATION_FAILED", `messages[${index}].content is a string; since schema version 2 it must be an array of content parts. Legacy data is not converted automatically.`);
|
|
25
|
+
if (!Array.isArray(message.content) || !message.content.every(isContentPart)) throw new WebSkillError("VALIDATION_FAILED", `messages[${index}].content is not a valid array of content parts`);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/** provider 不支持某类分片时的统一拒绝:静默丢弃会让模型回答一个它没看见的附件 */
|
|
29
|
+
function rejectUnsupportedPart(part, provider, where) {
|
|
30
|
+
throw new WebSkillError("VALIDATION_FAILED", `${provider} does not support ${part.type} content in ${where} messages`);
|
|
31
|
+
}
|
|
32
|
+
/** 内存 ArtifactStore:测试与浏览器降级用;索引随进程生命周期存在 */
|
|
33
|
+
var MemoryArtifactStore = class {
|
|
34
|
+
#byRun = /* @__PURE__ */ new Map();
|
|
35
|
+
#seq = 0;
|
|
36
|
+
async createTextArtifact(input) {
|
|
37
|
+
return this.#record({
|
|
38
|
+
runId: input.runId,
|
|
39
|
+
path: input.path,
|
|
40
|
+
type: "text",
|
|
41
|
+
size: new TextEncoder().encode(input.content).length,
|
|
42
|
+
mimeType: input.mimeType,
|
|
43
|
+
metadata: input.metadata
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async createBinaryArtifact(input) {
|
|
47
|
+
return this.#record({
|
|
48
|
+
runId: input.runId,
|
|
49
|
+
path: input.path,
|
|
50
|
+
type: "binary",
|
|
51
|
+
size: input.content.length,
|
|
52
|
+
mimeType: input.mimeType,
|
|
53
|
+
metadata: input.metadata
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async listArtifacts(runId) {
|
|
57
|
+
return [...this.#byRun.get(runId) ?? []];
|
|
58
|
+
}
|
|
59
|
+
#record(input) {
|
|
60
|
+
const artifact = {
|
|
61
|
+
id: `art-${++this.#seq}`,
|
|
62
|
+
runId: input.runId,
|
|
63
|
+
path: input.path,
|
|
64
|
+
type: input.type,
|
|
65
|
+
mimeType: input.mimeType,
|
|
66
|
+
size: input.size,
|
|
67
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
68
|
+
metadata: input.metadata
|
|
69
|
+
};
|
|
70
|
+
const list = this.#byRun.get(input.runId) ?? [];
|
|
71
|
+
list.push(artifact);
|
|
72
|
+
this.#byRun.set(input.runId, list);
|
|
73
|
+
return artifact;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { validateLlmMessages as a, textParts as i, partsToText as n, rejectUnsupportedPart as r, MemoryArtifactStore as t };
|
package/dist/node.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as AuditLog,
|
|
1
|
+
import { D as ArchiveLimits, F as JsonSchema, H as SKILLS_LOCKFILE, J as SignatureAuditSink, M as FileStat, N as FileSystemProvider, U as SKILL_MANIFEST_FILE, et as SkillInstallSource, ft as TrustedKeyStore, gt as VerifyResult, it as SkillManifest, mt as UnsignedPolicy, o as InteractionRequest, rt as SkillManagerPort, s as InteractionResponse, ut as SkillsLockfile, v as RenderResultRequest, y as UiBridge } from "./types-7Wcg--Vh-1YlQ4jF9.js";
|
|
2
|
+
import { C as FsArtifactStore, Dt as ToolDefinition, Lt as WebSkillRuntime, Rt as WebSkillRuntimeDeps, V as NetworkPolicy, Vt as createScriptContext, d as ApprovalScope, f as BridgeCapabilities, gt as ScriptExecutor, ht as ScriptExecutionContext, kt as ToolResult, mt as SchemaInferer, w as FsMemoryStore } from "./index-DLfR2Y6I.js";
|
|
3
|
+
import { a as AuditLog, p as CandidateStore, r as ApprovalPolicy, u as CandidateSkill, v as SkillVersionStore } from "./skillVersionStore-uyefLPR1-DXOzbksv.js";
|
|
4
4
|
import { n as LlmEnvConfig, s as probeLlmCapabilities, t as LlmCapabilities } from "./env-BPUBZCwJ-4jat_SVG.js";
|
|
5
5
|
import { Readable, Writable } from "node:stream";
|
|
6
6
|
//#region ../node/dist/index.d.ts
|
|
@@ -217,7 +217,11 @@ declare class SkillManager implements SkillManagerPort {
|
|
|
217
217
|
*/
|
|
218
218
|
signature?: {
|
|
219
219
|
trustedKeys?: TrustedKeyStore;
|
|
220
|
-
/**
|
|
220
|
+
/**
|
|
221
|
+
* 未签名包的处置,默认 `warn`(0.4.0 D2 复核后维持)。
|
|
222
|
+
* 收成 `deny` 必须同时注入 `trustedKeys`:空信任库 + deny 的接受集为空,
|
|
223
|
+
* 任何包都装不上。
|
|
224
|
+
*/
|
|
221
225
|
unsigned?: UnsignedPolicy;
|
|
222
226
|
/** 验签结论落审计(governance 的 FsAuditLog 结构上兼容) */
|
|
223
227
|
audit?: SignatureAuditSink;
|
package/dist/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as parseSkillMarkdown, B as unzipWithLimits, H as verifyManifest, I as resolveArchiveLimits, L as resolveInsideRoot, M as readResponseWithLimit, N as readSkillSignature, O as messageOf, T as isValidSkillName, U as verifySkillSignature, V as validateSkills, _ as atomicWriteText, g as assertSafePathSegment, h as assertRemoteUrlAllowed, j as parseSkillPackManifest, m as WebSkillError, o as SKILLS_LOCKFILE, r as MANIFEST_EXCLUDED_FILES, s as SKILL_MANIFEST_FILE, u as SKILL_PACK_FILE, w as exportSkills, y as buildManifest } from "./dist-8oQRa8Xz.js";
|
|
2
|
-
import {
|
|
2
|
+
import { A as createScriptContext, D as WebSkillRuntime, H as normalizeToolContent, O as bridgeError, U as normalizeToolError, W as parseBridgeRequest, l as FsArtifactStore, o as CapabilityApproval, u as FsMemoryStore, z as networkPolicyLibSource } from "./dist-C-Sh0MDU.js";
|
|
3
3
|
import { i as probeLlmCapabilities } from "./env--jJB-TSX-04klhTYi.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { unzipSync, zipSync } from "fflate";
|