@webskill/sdk 0.12.0 → 0.14.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.
Files changed (35) hide show
  1. package/dist/agent.d.ts +3 -3
  2. package/dist/agent.js +3 -3
  3. package/dist/browser.d.ts +250 -9
  4. package/dist/browser.js +1257 -95
  5. package/dist/{catalogComponents-BgAJN0p8-C3K8klJd.js → catalogComponents-BgAJN0p8-Cr55ouOg.js} +348 -14
  6. package/dist/{dist-sdKFgERo.js → dist-Bfga1TmS.js} +368 -34
  7. package/dist/{dist-DU9KDAuR.js → dist-BnqAkSS6.js} +965 -49
  8. package/dist/{dist-DqcL6jKO.js → dist-CiaDIqkV.js} +2 -2
  9. package/dist/{dist-Bev6i6Ip.js → dist-D5YhlCdY.js} +59 -1
  10. package/dist/governance.d.ts +3 -3
  11. package/dist/governance.js +2 -2
  12. package/dist/{index-C9pzXLKy.d.ts → index-CWoKOFBP.d.ts} +86 -5
  13. package/dist/{index-DFhU1uks.d.ts → index-DQwGvHAI.d.ts} +447 -22
  14. package/dist/{index-3fCHc1mQ.d.ts → index-sd-gVKey.d.ts} +2 -2
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.js +5 -5
  17. package/dist/mcp.d.ts +77 -3
  18. package/dist/mcp.js +78 -4
  19. package/dist/{memoryArtifactStore-52Zn9npI-LbCQaqyx.js → memoryArtifactStore-52Zn9npI-BxtUkrgV.js} +1 -1
  20. package/dist/node.d.ts +3 -3
  21. package/dist/node.js +6 -6
  22. package/dist/{openUiLibrary-BKXW7Iwx-DaymVubt.js → openUiLibrary-BKXW7Iwx-DjvEnMlJ.js} +2 -2
  23. package/dist/{skillVersionStore-D-qHk9ZE-DheTIwAB.d.ts → skillVersionStore-D-qHk9ZE-C0OFDTQY.d.ts} +1 -1
  24. package/dist/{testing-WPTyXQYt.js → testing-Cm8MseLF.js} +2 -2
  25. package/dist/testing.d.ts +1 -1
  26. package/dist/testing.js +2 -2
  27. package/dist/{types-DLctJep_-B5G4uk2u.d.ts → types-C3V6lAeO-BgeOvc1Y.d.ts} +63 -4
  28. package/dist/ui-react.d.ts +2 -2
  29. package/dist/ui-react.js +13 -11
  30. package/dist/ui-vue.d.ts +1 -1
  31. package/dist/ui-vue.js +1 -1
  32. package/dist/ui.d.ts +3 -3
  33. package/dist/ui.js +2 -2
  34. package/dist/{webskillLitCatalog-D_zCqeQF-C9lrvvMr.js → webskillLitCatalog-D_zCqeQF-swXsWoAe.js} +1 -1
  35. package/package.json +2 -1
@@ -1,4 +1,4 @@
1
- import { h as WebSkillError } from "./dist-Bev6i6Ip.js";
1
+ import { b as WebSkillError } from "./dist-D5YhlCdY.js";
2
2
  import { toJSONSchema, z } from "zod";
3
3
 
4
4
  //#region ../ui/dist/webskillCatalog-nTgkL9Xe.js
@@ -3481,7 +3481,7 @@ function fromA2uiSpecAction(event) {
3481
3481
  */
3482
3482
  async function loadWebSkillLitCatalog() {
3483
3483
  try {
3484
- const { webskillLitCatalog } = await import("./webskillLitCatalog-D_zCqeQF-C9lrvvMr.js");
3484
+ const { webskillLitCatalog } = await import("./webskillLitCatalog-D_zCqeQF-swXsWoAe.js");
3485
3485
  return webskillLitCatalog();
3486
3486
  } catch (cause) {
3487
3487
  throw new WebSkillError("UI_UNAVAILABLE", "The WebSkill A2UI catalog is unavailable; install @a2ui/lit, @a2ui/web_core and lit to render catalog surfaces with A2UI", cause);
@@ -518,6 +518,64 @@ function assertRemoteUrlAllowed(rawUrl, policy = {}) {
518
518
  if (!policy.allowPrivateHosts && isPrivateHost(url.hostname)) throw new WebSkillError("NETWORK_BLOCKED", `Refusing to connect to a private/loopback/link-local address: ${url.hostname}`);
519
519
  return url;
520
520
  }
521
+ /** 可作为图片分片外发的 MIME 类型 @experimental */
522
+ const IMAGE_MIME_TYPES = [
523
+ "image/png",
524
+ "image/jpeg",
525
+ "image/webp",
526
+ "image/gif"
527
+ ];
528
+ /**
529
+ * 可按文本读取的扩展名。accept 白名单与判定白名单共用这一份——
530
+ * 0.5.x 两处不一致,`log`/`yaml`/`yml` 能通过判定却在文件选择器里选不到。
531
+ */
532
+ const TEXT_EXTENSIONS = [
533
+ "txt",
534
+ "md",
535
+ "csv",
536
+ "json",
537
+ "log",
538
+ "yaml",
539
+ "yml"
540
+ ];
541
+ /** 非文本非图片但仍可整体外发的类型(provider 的 file 分片) @experimental */
542
+ const FILE_MIME_TYPES = ["application/pdf"];
543
+ /**
544
+ * 需要**客户端先抽取成文本**才能外发的类型(FR-23.9 / 0.13.0 FR-12.5)。
545
+ * 不走直通的 `file`:docx / xlsx 发给 provider 会被当成二进制垃圾。
546
+ */
547
+ const DOCX_MIME = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
548
+ const XLSX_MIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
549
+ /** 文本类附件进模型上下文的字符上限(0.6.0) @experimental */
550
+ const ATTACHMENT_TEXT_LIMIT = 32 * 1024;
551
+ const TEXT_EXTENSION_SET = new Set(TEXT_EXTENSIONS);
552
+ const IMAGE_MIME_SET = new Set(IMAGE_MIME_TYPES);
553
+ const FILE_MIME_SET = new Set(FILE_MIME_TYPES);
554
+ const EXTRACTED_MIME_SET = /* @__PURE__ */ new Set([DOCX_MIME, XLSX_MIME]);
555
+ const EXTRACTED_EXTENSION_SET = /* @__PURE__ */ new Set(["docx", "xlsx"]);
556
+ function extensionOf(fileName) {
557
+ return fileName.split(".").pop()?.toLowerCase() ?? "";
558
+ }
559
+ /** 分类集中一处,不散落在各 UI 分支里 @experimental */
560
+ function classifyAttachment(contentType, fileName) {
561
+ const type = contentType.toLowerCase();
562
+ if (IMAGE_MIME_SET.has(type)) return "image";
563
+ if (EXTRACTED_MIME_SET.has(type)) return "document-text";
564
+ if (FILE_MIME_SET.has(type)) return "file";
565
+ if (type.startsWith("text/") || type === "application/json") return "text";
566
+ if (type === "" && TEXT_EXTENSION_SET.has(extensionOf(fileName))) return "text";
567
+ if (type === "" && EXTRACTED_EXTENSION_SET.has(extensionOf(fileName))) return "document-text";
568
+ }
569
+ /**
570
+ * 文本类附件进模型上下文的最终形态。两条入口共用,差别只有出处那一段(0.14.0 D-20-6)。
571
+ * @experimental
572
+ */
573
+ function formatAttachmentText(input) {
574
+ const clipped = input.body.length > 32768 ? `${input.body.slice(0, ATTACHMENT_TEXT_LIMIT)}\n[truncated]` : input.body;
575
+ const bodyOnly = input.kind === "document-text" ? ", body text only" : "";
576
+ const from = input.origin === "download" ? ", from this device's downloads" : "";
577
+ return `--- Attachment: ${input.name} (${input.contentType}${bodyOnly}${from}) ---\n${clipped}`;
578
+ }
521
579
  const FRONTMATTER_RE = /^---[^\S\r\n]*\r?\n([\s\S]*?)\r?\n---[^\S\r\n]*(?:\r?\n|$)([\s\S]*)$/;
522
580
  const invalid = (message, details) => {
523
581
  throw new WebSkillError("SKILL_INVALID_METADATA", message, details);
@@ -1130,4 +1188,4 @@ const xmlRenderer = {
1130
1188
  };
1131
1189
 
1132
1190
  //#endregion
1133
- export { jsonRenderer as A, resolveArchiveLimits as B, computeDigest as C, exportSkills as D, escapeXml as E, parseSkillPackManifest as F, unzipWithLimits as G, signSkill as H, readResponseWithLimit as I, verifySkillSignature as J, validateSkills as K, readSkillSignature as L, messageOf as M, normalizePath as N, isAtomicTempPath as O, parseSkillMarkdown as P, renderAvailableSkillsXml as R, checkSkillRules as S, detectSkillArchiveShapeFromFs as T, signaturePayloadBytes as U, resolveInsideRoot as V, stripArchiveRoot as W, xmlRenderer as Y, assertSafePathSegment as _, MemoryFS as a, buildManifest as b, SKILL_MANIFEST_FILE as c, SKILL_PACK_FILE as d, SKILL_SIGNATURE_FILE as f, assertRemoteUrlAllowed as g, WebSkillError as h, MANIFEST_EXCLUDED_FILES as i, keyIdOf as j, isValidSkillName as k, SKILL_NAME_MAX_LENGTH as l, SkillReader as m, DEFAULT_ARCHIVE_LIMITS as n, SIGNATURE_SCHEMA_VERSION as o, SkillDiscovery as p, verifyManifest as q, FsTrustedKeyStore as r, SKILLS_LOCKFILE as s, ATOMIC_TMP_SUFFIX_PATTERN as t, SKILL_NAME_PATTERN as u, atomicWriteText as v, detectSkillArchiveShape as w, checkDependencyCycles as x, buildCatalog as y, renderCatalogJson as z };
1191
+ export { unzipWithLimits as $, computeDigest as A, messageOf as B, assertSafePathSegment as C, checkDependencyCycles as D, buildManifest as E, formatAttachmentText as F, readSkillSignature as G, parseSkillMarkdown as H, isAtomicTempPath as I, resolveArchiveLimits as J, renderAvailableSkillsXml as K, isValidSkillName as L, detectSkillArchiveShapeFromFs as M, escapeXml as N, checkSkillRules as O, exportSkills as P, stripArchiveRoot as Q, jsonRenderer as R, assertRemoteUrlAllowed as S, buildCatalog as T, parseSkillPackManifest as U, normalizePath as V, readResponseWithLimit as W, signSkill as X, resolveInsideRoot as Y, signaturePayloadBytes as Z, SkillDiscovery as _, FILE_MIME_TYPES as a, WebSkillError as b, MANIFEST_EXCLUDED_FILES as c, SKILLS_LOCKFILE as d, validateSkills as et, SKILL_MANIFEST_FILE as f, SKILL_SIGNATURE_FILE as g, SKILL_PACK_FILE as h, DOCX_MIME as i, detectSkillArchiveShape as j, classifyAttachment as k, MemoryFS as l, SKILL_NAME_PATTERN as m, ATTACHMENT_TEXT_LIMIT as n, verifySkillSignature as nt, FsTrustedKeyStore as o, SKILL_NAME_MAX_LENGTH as p, renderCatalogJson as q, DEFAULT_ARCHIVE_LIMITS as r, xmlRenderer as rt, IMAGE_MIME_TYPES as s, ATOMIC_TMP_SUFFIX_PATTERN as t, verifyManifest as tt, SIGNATURE_SCHEMA_VERSION as u, SkillReader as v, atomicWriteText as w, XLSX_MIME as x, TEXT_EXTENSIONS as y, keyIdOf as z };
@@ -1,6 +1,6 @@
1
- import { R as FileSystemProvider, S as UiBridge, U as Page, W as PageQuery, f as LlmMessage, it as SkillCatalogEntry, l as LlmClient, ot as SkillDocument, ut as SkillManagerPort } from "./types-DLctJep_-B5G4uk2u.js";
2
- import { Nt as RuntimeRun, Pn as WebSkillRuntime, Qt as SkillOutcomeReporter, Y as IntegrityVerdict, Zt as SkillIntegrityGuard, nn as SkillStateGuard } from "./index-C9pzXLKy.js";
3
- import { _ as SkillState, a as AuditLog, b as SkillVersionStore, c as CandidateFile, d as CandidateSkill, f as CandidateSource, g as SKILL_VERSION_PAGE_SIZE, h as CompositeApprovalPolicy, i as AuditEvent, l as CandidatePage, m as CandidateStore, n as ApprovalDecision, o as AuditQueryFilter, p as CandidateStatus, r as ApprovalPolicy, s as CANDIDATE_PAGE_SIZE, t as AlwaysHumanApprovalPolicy, u as CandidateRisk, v as SkillVersion, x as candidateToCatalogEntry, y as SkillVersionPage } from "./skillVersionStore-D-qHk9ZE-DheTIwAB.js";
1
+ import { S as UiBridge, U as FileSystemProvider, X as PageQuery, Y as Page, f as LlmMessage, ft as SkillDocument, gt as SkillManagerPort, l as LlmClient, ut as SkillCatalogEntry } from "./types-C3V6lAeO-BgeOvc1Y.js";
2
+ import { $t as SkillIntegrityGuard, Ft as RuntimeRun, Rn as WebSkillRuntime, X as IntegrityVerdict, en as SkillOutcomeReporter, in as SkillStateGuard } from "./index-CWoKOFBP.js";
3
+ import { _ as SkillState, a as AuditLog, b as SkillVersionStore, c as CandidateFile, d as CandidateSkill, f as CandidateSource, g as SKILL_VERSION_PAGE_SIZE, h as CompositeApprovalPolicy, i as AuditEvent, l as CandidatePage, m as CandidateStore, n as ApprovalDecision, o as AuditQueryFilter, p as CandidateStatus, r as ApprovalPolicy, s as CANDIDATE_PAGE_SIZE, t as AlwaysHumanApprovalPolicy, u as CandidateRisk, v as SkillVersion, x as candidateToCatalogEntry, y as SkillVersionPage } from "./skillVersionStore-D-qHk9ZE-C0OFDTQY.js";
4
4
  //#region ../governance/dist/index.d.ts
5
5
  //#region src/candidate/candidateNormalizer.d.ts
6
6
  /** 剥 markdown fence 与 <think> 块、截取首尾 {};非对象 → CANDIDATE_INVALID */
@@ -1,5 +1,5 @@
1
- import { M as messageOf, _ as assertSafePathSegment, h as WebSkillError, k as isValidSkillName, v as atomicWriteText } from "./dist-Bev6i6Ip.js";
2
- import { a as textParts, n as partsToText } from "./memoryArtifactStore-52Zn9npI-LbCQaqyx.js";
1
+ import { B as messageOf, C as assertSafePathSegment, L as isValidSkillName, b as WebSkillError, w as atomicWriteText } from "./dist-D5YhlCdY.js";
2
+ import { a as textParts, n as partsToText } from "./memoryArtifactStore-52Zn9npI-BxtUkrgV.js";
3
3
  import { n as AUDIT_EVENT_TYPE_LIST, t as AUDIT_EVENT_TYPES } from "./eventTypes-FllCrX-Z-DNDeHWoG.js";
4
4
 
5
5
  //#region ../governance/dist/index.js
@@ -1,4 +1,4 @@
1
- import { B as JsonSchema, G as RemoteUrlPolicy, I as DiscoveryResult, O as UiSurfaceActionRequest, R as FileSystemProvider, S as UiBridge, St as ValidationReport, T as UiSpecEvent, Tt as WebSkillErrorCode, U as Page, W as PageQuery, _ as LlmToolSpec, at as SkillDiscovery, b as RenderResultRequest, bt as UiSpecNode, d as LlmContentPart, dt as SkillManifest, f as LlmMessage, g as LlmToolCall, h as LlmTokenUsage, i as FormField, it as SkillCatalogEntry, l as LlmClient, m as LlmStreamEvent, n as ArtifactStore, o as InteractionPolicy, ot as SkillDocument, p as LlmResponse, r as ChartSpec, rt as SkillCatalog, s as InteractionRequest, st as SkillInstallSource, t as Artifact, u as LlmCompleteInput, v as MemoryStore, w as UiSpecDrafts, y as RenderBlock } from "./types-DLctJep_-B5G4uk2u.js";
1
+ import { B as DiscoveryResult, Dt as UiSpecNode, K as JsonSchema, Mt as WebSkillErrorCode, O as UiSurfaceActionRequest, S as UiBridge, T as UiSpecEvent, U as FileSystemProvider, X as PageQuery, Y as Page, Z as RemoteUrlPolicy, _ as LlmToolSpec, _t as SkillManifest, b as RenderResultRequest, d as LlmContentPart, dt as SkillDiscovery, f as LlmMessage, ft as SkillDocument, g as LlmToolCall, h as LlmTokenUsage, i as FormField, kt as ValidationReport, l as LlmClient, lt as SkillCatalog, m as LlmStreamEvent, n as ArtifactStore, o as InteractionPolicy, p as LlmResponse, pt as SkillInstallSource, r as ChartSpec, s as InteractionRequest, t as Artifact, u as LlmCompleteInput, ut as SkillCatalogEntry, v as MemoryStore, w as UiSpecDrafts, y as RenderBlock } from "./types-C3V6lAeO-BgeOvc1Y.js";
2
2
  //#region ../runtime/dist/index.d.ts
3
3
  //#region src/llm/parts.d.ts
4
4
  /** 纯文本消息内容的构造快捷方式(引擎内部绝大多数消息仍是纯文本) */
@@ -61,6 +61,25 @@ declare const DEFAULT_MAX_DOCUMENT_TEXT_BYTES = 512000;
61
61
  * 结构化数据不是文档,量级差一个数量级;超出**只拒不截**——截断的 JSON 解不出来。
62
62
  */
63
63
  declare const DEFAULT_MAX_DATA_SOURCE_BYTES = 1024000;
64
+ /**
65
+ * 宿主声明的一个数据源的**可公开部分**(0.14.0 分册 19)。
66
+ *
67
+ * `target` 不在这里,且不得被加进来:这条通路的终点是模型上下文,
68
+ * 而「地址不由脚本提供」正是 0.11.0 分册 16 §2.2 授权面的全部依据。
69
+ * @experimental
70
+ */
71
+ interface DataSourceInfo {
72
+ id: string;
73
+ description: string;
74
+ /**
75
+ * 非宿主声明时的出处(0.14.0 分册 21)。缺省即宿主声明,不带标注。
76
+ *
77
+ * 有值意味着 `description` **来自页面**,模型看到的清单里必须随之出现「可能不准确」的标注,
78
+ * 否则一段由站点控制的文本会以宿主口吻进上下文。
79
+ * @experimental
80
+ */
81
+ provenance?: 'page-declared' | 'tool-projection';
82
+ }
64
83
  /**
65
84
  * 工具结果的内容分片(0.6.0 §1.1)。
66
85
  * `image` 分片不参与 `toolResultMaxBytes` 截断——那份预算是给文本的,
@@ -557,7 +576,13 @@ type TraceEventType = 'skill.routed' | 'skill.activated' | 'skill.integrity-fail
557
576
  /** 一轮模型调用产出的一段思考正文(data.text;每轮至多一条,UI-UX5 #32) */
558
577
  'llm.thinking' |
559
578
  /** 一轮模型调用的 token 用量(data.inputTokens/outputTokens;上游不回报则无此事件,UI-UX5 #47) */
560
- 'llm.usage' | 'tool.started' | 'tool.completed' | 'tool.failed' | 'tool.denied' | 'artifact.created' | 'ui.requested' | 'ui.resumed' | 'ui.surface-action.requested' | 'ui.surface-action.resolved' | 'ui.rendered' | 'ui.degraded' | 'todo.created' | 'todo.updated' | 'todo.cleared' | 'run.warning' | 'run.completed' | 'run.cancelled' | 'run.failed' | 'run.resumed';
579
+ 'llm.usage' | 'tool.started' | 'tool.completed' | 'tool.failed' | 'tool.denied' |
580
+ /**
581
+ * 按需披露的工具本轮未被任何已激活技能点名,因此没写进 tool spec(分册 19)。
582
+ * **不是拒绝**:它照样调得动。与 `tool.denied` 分开是因为排查方向相反——
583
+ * `denied` 指向「技能清单写错了」,`withheld` 指向「该激活的技能还没激活」。
584
+ */
585
+ 'tool.withheld' | 'artifact.created' | 'ui.requested' | 'ui.resumed' | 'ui.surface-action.requested' | 'ui.surface-action.resolved' | 'ui.rendered' | 'ui.degraded' | 'todo.created' | 'todo.updated' | 'todo.cleared' | 'run.warning' | 'run.completed' | 'run.cancelled' | 'run.failed' | 'run.resumed';
561
586
  interface TraceEvent {
562
587
  id: string;
563
588
  runId: string;
@@ -1313,19 +1338,30 @@ declare const READ_LINKED_DOCUMENT_TOOL_NAME = "read_linked_document";
1313
1338
  declare const SUPPORTED_DOCUMENT_MIME: {
1314
1339
  readonly pdf: "application/pdf";
1315
1340
  readonly docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
1341
+ readonly xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
1316
1342
  };
1317
1343
  /** docx 抽取实现由宿主注入(`DOMParser` 是浏览器 API,Node 没有;备案 D55) */
1318
1344
  type DocxTextExtractor = (bytes: Uint8Array) => Promise<string>;
1345
+ /** xlsx 抽取实现由宿主注入(0.13.0 FR-12.5;限制与 docx 相同) */
1346
+ type XlsxTextExtractor = (bytes: Uint8Array) => Promise<string>;
1347
+ /**
1348
+ * PDF → 文本(0.13.0 FR-22.1)。**只用于直传被端点拒后的回退**,
1349
+ * 不改变 PDF 默认直传的路径。SDK 不带实现:正确取到文本层要处理
1350
+ * xref / 对象流 / FlateDecode / ToUnicode CMap,自写即 AGENTS.md §6 禁止的手写协议解析器。
1351
+ */
1352
+ type PdfTextExtractor = (bytes: Uint8Array) => Promise<string>;
1319
1353
  /** 引擎侧固定流程(§2.3)用到的错误文案,集中一处便于判据引用 */
1320
1354
  declare const UNSUPPORTED_DOCUMENT_MESSAGE: string;
1321
1355
  /**
1322
1356
  * 内建工具:读页面链接指向的文档。
1323
1357
  *
1324
- * **始终注册**(只要宿主装配了 reader):docx 与纯文本这条路对所有模型成立。
1358
+ * **始终注册**(只要宿主装配了 reader):docx / xlsx 与纯文本这条路对所有模型成立。
1325
1359
  * PDF 目标在模型不支持文档时**取数后拒绝**,而不是入口就拦 ——
1326
1360
  * 入口拦会误伤 docx,它抽成文本后根本不需要文档能力。
1327
1361
  */
1328
1362
  declare const READ_LINKED_DOCUMENT_TOOL: ToolDefinition;
1363
+ /** 二进制转 base64;`btoa` 只吃 latin1,必须逐字节喂而不是先 decode 成字符串 */
1364
+ declare function toBase64(bytes: Uint8Array): string;
1329
1365
  //#endregion
1330
1366
  //#region src/engine/toolStep.d.ts
1331
1367
  /**
@@ -1392,6 +1428,22 @@ declare class FsToolStepStore implements ToolStepStore {
1392
1428
  }
1393
1429
  //#endregion
1394
1430
  //#region src/engine/external.d.ts
1431
+ /**
1432
+ * 工具披露层级(分册 19)。`on-demand` 只影响工具写不写进 LLM tool spec,
1433
+ * **不影响可执行性**——要限制访问的宿主应当使用禁用(各来源自己的 enabled 通道)。
1434
+ */
1435
+ type ToolDisclosure = 'always' | 'on-demand';
1436
+ /**
1437
+ * 一次工具调用的调用侧上下文(0.14.0 分册 22 FR-22.5)。
1438
+ *
1439
+ * 工具源不实现这个参数即行为不变:TypeScript 里参数更少的函数可以
1440
+ * 赋给参数更多的函数类型。它存在的唯一理由是「游标跨 run 一律失效」——
1441
+ * 宝宝在游标里编时间戳只能做到「基本失效」,做不到「一律失效」。
1442
+ * @experimental
1443
+ */
1444
+ interface ToolCallContext {
1445
+ readonly runId: string;
1446
+ }
1395
1447
  /**
1396
1448
  * 外部工具来源(runtime 扩展点,mcp 包实现并插入)。
1397
1449
  * LLM 可见名为已消毒名(如 endpoint__greet / mcp__search)。
@@ -1399,6 +1451,13 @@ declare class FsToolStepStore implements ToolStepStore {
1399
1451
  interface ExternalToolSource {
1400
1452
  readonly kind: string;
1401
1453
  listToolSpecs(): Promise<LlmToolSpec[]>;
1454
+ /**
1455
+ * 该工具的披露层级(分册 19 / FR-19.2)。**不实现 ⇒ 该源全部工具按 `always`**(存量来源行为不变)。
1456
+ *
1457
+ * 每轮实时求值,不写进 `LlmToolSpec` 字段:spec 只在 run 起点与 resume 各收集一次,
1458
+ * 凝固进 spec 会让宿主中途改配置整轮不生效。
1459
+ */
1460
+ disclosure?(llmToolName: string): ToolDisclosure;
1402
1461
  /**
1403
1462
  * 可选:向 run 的 system 消息追加一段说明(组件 catalog 之类的大段规格)。
1404
1463
  *
@@ -1408,7 +1467,7 @@ interface ExternalToolSource {
1408
1467
  */
1409
1468
  systemPrompt?(): Promise<string | undefined>;
1410
1469
  canHandle(llmToolName: string): boolean;
1411
- call(llmToolName: string, args: Record<string, unknown>): Promise<ToolResult>;
1470
+ call(llmToolName: string, args: Record<string, unknown>, context?: ToolCallContext): Promise<ToolResult>;
1412
1471
  /**
1413
1472
  * 参数留存的信任判定(分册 30 / FR-30.3)。**不实现 ⇒ 该源全部工具按 untrusted 处理**(参数全脱敏)。
1414
1473
  *
@@ -1554,6 +1613,13 @@ interface AgentLoopDeps {
1554
1613
  * 所以这里只收一个函数,不收策略对象——否则依赖方向反了。
1555
1614
  */
1556
1615
  fetchData?: (sourceId: string, params?: Record<string, unknown>) => Promise<unknown>;
1616
+ /**
1617
+ * 宿主声明的数据源清单(0.14.0 分册 19):技能声明了本宿主没有的源时,激活期据此说明缺什么。
1618
+ * 只含可公开字段——`target` 进不来,见 `DataSourceInfo`。
1619
+ *
1620
+ * 可传函数:宿主的源清单随用户配置变动时,惰性形式免去为一次配置改动重建引擎。
1621
+ */
1622
+ dataSources?: readonly DataSourceInfo[] | (() => readonly DataSourceInfo[]);
1557
1623
  /**
1558
1624
  * 页面链接文档的读取实现(分册 22)。不注入即 `read_linked_document` 不注册——
1559
1625
  * 模型连这个工具的存在都看不到,而不是看得到再被拒。
@@ -1561,6 +1627,12 @@ interface AgentLoopDeps {
1561
1627
  linkedDocuments?: LinkedDocumentReader;
1562
1628
  /** docx → 文本;`DOMParser` 是浏览器 API,因此由宿主注入(Node 侧无此能力,备案 D55) */
1563
1629
  docxExtractor?: DocxTextExtractor;
1630
+ xlsxExtractor?: XlsxTextExtractor;
1631
+ /**
1632
+ * PDF → 文本(FR-22.1)。**只在直传被端点拒后用作回退**,不改变 PDF 默认直传。
1633
+ * 不注入即没有回退能力,失败照报——与 docx / xlsx「不注入即没这个能力」同款。
1634
+ */
1635
+ pdfExtractor?: PdfTextExtractor;
1564
1636
  /** 文档读取留痕出口(FR-22.6);不注入即不留痕,装配方要自己承担这个选择 */
1565
1637
  documentAudit?: {
1566
1638
  append(event: {
@@ -1734,6 +1806,11 @@ interface WebSkillRuntimeDeps {
1734
1806
  * 通常由 `@webskill/agent` 的 `DataSourcePolicy.fetchData` 绑定过来。
1735
1807
  */
1736
1808
  fetchData?: (sourceId: string, params?: Record<string, unknown>) => Promise<unknown>;
1809
+ /**
1810
+ * 宿主声明的数据源清单(0.14.0 分册 19);用 `DataSourcePolicy.publicSources` 取,不要自己传 `sources`。
1811
+ * 不注入即「宿主没说」,引擎不会断言某个源不存在。
1812
+ */
1813
+ dataSources?: readonly DataSourceInfo[] | (() => readonly DataSourceInfo[]);
1737
1814
  /**
1738
1815
  * 读页面链接指向的文档(分册 22);不注入即 `read_linked_document` 不注册。
1739
1816
  * 实现住在 `@webskill/browser`(docx 抽取要 `DOMParser`),由宿主装配。
@@ -1741,6 +1818,10 @@ interface WebSkillRuntimeDeps {
1741
1818
  linkedDocuments?: LinkedDocumentReader;
1742
1819
  /** docx → 文本;不注入即 Word 文档明确报「本环境不支持」(FR-23.8) */
1743
1820
  docxExtractor?: DocxTextExtractor;
1821
+ /** xlsx → 文本;不注入即 Excel 工作簿明确报「本环境不支持」(FR-12.5) */
1822
+ xlsxExtractor?: XlsxTextExtractor;
1823
+ /** PDF → 文本;**只在直传被端点拒后做回退**,不注入即没有回退能力(FR-22.1) */
1824
+ pdfExtractor?: PdfTextExtractor;
1744
1825
  /** 文档读取留痕出口(FR-22.6) */
1745
1826
  documentAudit?: {
1746
1827
  append(event: {
@@ -2111,4 +2192,4 @@ interface RedactedArgs {
2111
2192
  */
2112
2193
  declare function redactToolStepArgs(args: Record<string, unknown>, schema: JsonSchema | undefined, trust: ToolStepTrust): RedactedArgs;
2113
2194
  //#endregion
2114
- export { LifecycleHook as $, isUnsupportedRunSnapshot as $n, SkillRouter as $t, DocxTextExtractor as A, UserProfileImportDiff as An, validateUiSpecNode as Ar, RunTraceSummary as At, FsRunTraceStore as B, createScriptContext as Bn, ScriptExecutionContext as Bt, CapabilityApproval as C, USER_PROFILE_NO_INVENTION_RULE as Cn, summarizeRunUsage as Cr, RunSnapshotStore as Ct, DEFAULT_MAX_DOCUMENT_BYTES as D, UserProfile as Dn, toRecordDigests as Dr, RunTraceFilter as Dt, DEFAULT_MAX_DATA_SOURCE_BYTES as E, UnsupportedRunSnapshot as En, toLlmToolSpec as Er, RunTraceFile as Et, ExternalToolSource as F, WebSkillRuntimeDeps as Fn, RuntimeSessionHandle as Ft, GoogleGenAiClientConfig as G, extractTodoTraceEvents as Gn, SerializingMemoryStore as Gt, FsToolStepStore as H, diffUserProfile as Hn, SealOptions as Ht, FS_SESSION_PAGE_SIZE as I, appendBehaviorRecords as In, SENSITIVE_ANNOTATION as It, InstalledSkillManifest as J, formatSkillScriptManifest as Jn, SessionRecord as Jt, HookRunner as K, extractUiSpecEvents as Kn, SessionListPage as Kt, FsArtifactStore as L, applyUserProfileImport as Ln, SESSION_SCHEMA_VERSION as Lt, EventBus as M, VercelToolSpec as Mn, RuntimePhase as Mt, ExecuteLifecycleData as N, WebSkillApi as Nn, RuntimeRun as Nt, DEFAULT_MAX_DOCUMENT_TEXT_BYTES as O, UserProfileEntry as On, toVercelToolSpecs as Or, RunTraceMetrics as Ot, ExternalSkillProvider as P, WebSkillRuntime as Pn, RuntimeSession as Pt, LifecycleEventInit as Q, isNetworkAllowed as Qn, SkillOutcomeReporter as Qt, FsMemoryStore as R, bridgeError as Rn, SUPPORTED_DOCUMENT_MIME as Rt, BridgeResponse as S, USER_PROFILE_KEY as Sn, sealToolCallPairs as Sr, RunSnapshotListEntry as St, DEFAULT_LOOP_LIMITS as T, USER_PROFILE_REFINE_PROMPT as Tn, textParts as Tr, RunToolCall as Tt, FullDisclosureRouter as U, exportUserProfile as Un, SealRecord as Ut, FsSessionStore as V, createWebSkillApi as Vn, ScriptExecutor as Vt, GoogleGenAiClient as W, extractChartSpec as Wn, SealResult as Wt, InteractLifecycleData as X, fromVercelStreamPart as Xn, SkillFailureReport as Xt, IntegrityVerdict as Y, fromVercelResult as Yn, SessionStore as Yt, LifecycleEvent as Z, interruptedToolResult as Zn, SkillIntegrityGuard as Zt, BehaviorRecordKind as _, TraceEvent as _n, resolveToolName as _r, RouteLifecycleData as _t, ASK_USER_TOOL as a, TerminalLifecycleData as an, normalizeErrorCode as ar, OpenAiCompatibleClient as at, BridgeCapability as b, UNSUPPORTED_DOCUMENT_MESSAGE as bn, schemaToForm as br, RunResult as bt, AgentLoop as c, ToolContent as cn, parseBridgeRequest as cr, READ_LINKED_DOCUMENT_TOOL as ct, AnthropicClient as d, ToolResult as dn, readBehaviorRecords as dr, READ_SKILL_FILE_TOOL as dt, SkillScriptDescriptor as en, listSkillScripts as er, LifecycleHookContext as et, AnthropicClientConfig as f, ToolStepReader as fn, readProfileEntries as fr, READ_SKILL_FILE_TOOL_NAME as ft, BehaviorRecord as g, TraceClock as gn, renderUserProfileContext as gr, RefineUserProfileInput as gt, BEHAVIOR_RECORDS_KEY as h, ToolStepTrust as hn, refineUserProfile as hr, RedactedArgs as ht, ASK_USER_MAX_FIELDS as i, TEXT_BUDGETED_CONTENT_TYPES as in, networkUrlHost as ir, NetworkPolicy as it, EMPTY_USER_PROFILE as j, UserProfileLimits as jn, RunUsageSummary as jt, DEFAULT_USER_PROFILE_LIMITS as k, UserProfileExport as kn, validateUiSpecEvent as kr, RunTraceStore as kt, AgentLoopConfig as l, ToolDefinition as ln, parseUserProfileExport as lr, READ_LINKED_DOCUMENT_TOOL_NAME as lt, ApprovalScope as m, ToolStepStore as mn, redactToolStepArgs as mr, RUN_TRACE_SCHEMA_VERSION as mt, ASK_USER_FIELD_TYPES as n, SkillStateGuard as nn, mergeProfileEntries as nr, LinkedDocumentReader as nt, ASK_USER_TOOL_NAME as o, TextualToolContent as on, normalizeToolContent as or, OpenAiCompatibleClientConfig as ot, ApprovalDecision as p, ToolStepRecord as pn, readUserProfile as pr, RUN_SNAPSHOT_SCHEMA_VERSION as pt, HookRunnerOptions as q, findUnpairedToolCalls as qn, SessionMeta as qt, ASK_USER_INPUT_SCHEMA as r, SkillSuccessReport as rn, networkPolicyLibSource as rr, MAX_TOOL_STEP_ARG_BYTES as rt, ActivateLifecycleData as s, TodoTraceEvent as sn, normalizeToolError as sr, ProgressiveRouter as st, ALLOWED_TOOLS_EXCLUSION_REASON as t, SkillScriptSchemaSource as tn, mergeCatalogEntries as tr, LifecycleListener as tt, AgentLoopDeps as u, ToolResolution as un, partsToText as ur, READ_SKILL_FILE_INPUT_SCHEMA as ut, BehaviorScene as v, TraceEventType as vn, sampleBehaviorRecords as vr, RouteResult as vt, CapabilityMode as w, USER_PROFILE_PROMPT_HEADER as wn, summarizeToolCalls as wr, RunTerminationReason as wt, BridgeRequest as x, USER_PROFILE_EXPORT_VERSION as xn, scriptToolName as xr, RunSnapshot as xt, BridgeCapabilities as y, TraceRecorder as yn, schemaSourceLabel as yr, RunLimitErrorDetails as yt, FsRunSnapshotStore as z, buildRenderResult as zn, SchemaInferer as zt };
2195
+ export { LifecycleEventInit as $, formatSkillScriptManifest as $n, SkillIntegrityGuard as $t, DataSourceInfo as A, UnsupportedRunSnapshot as An, textParts as Ar, RunTraceMetrics as At, FsRunSnapshotStore as B, XlsxTextExtractor as Bn, SUPPORTED_DOCUMENT_MIME as Bt, CapabilityApproval as C, TraceRecorder as Cn, sampleBehaviorRecords as Cr, RunSnapshot as Ct, DEFAULT_MAX_DOCUMENT_BYTES as D, USER_PROFILE_NO_INVENTION_RULE as Dn, sealToolCallPairs as Dr, RunToolCall as Dt, DEFAULT_MAX_DATA_SOURCE_BYTES as E, USER_PROFILE_KEY as En, scriptToolName as Er, RunTerminationReason as Et, ExternalSkillProvider as F, UserProfileLimits as Fn, validateUiSpecEvent as Fr, RuntimeRun as Ft, GoogleGenAiClient as G, createScriptContext as Gn, SealRecord as Gt, FsSessionStore as H, applyUserProfileImport as Hn, ScriptExecutionContext as Ht, ExternalToolSource as I, VercelToolSpec as In, validateUiSpecNode as Ir, RuntimeSession as It, HookRunnerOptions as J, exportUserProfile as Jn, SessionListPage as Jt, GoogleGenAiClientConfig as K, createWebSkillApi as Kn, SealResult as Kt, FS_SESSION_PAGE_SIZE as L, WebSkillApi as Ln, RuntimeSessionHandle as Lt, EMPTY_USER_PROFILE as M, UserProfileEntry as Mn, toLlmToolSpec as Mr, RunTraceSummary as Mt, EventBus as N, UserProfileExport as Nn, toRecordDigests as Nr, RunUsageSummary as Nt, DEFAULT_MAX_DOCUMENT_TEXT_BYTES as O, USER_PROFILE_PROMPT_HEADER as On, summarizeRunUsage as Or, RunTraceFile as Ot, ExecuteLifecycleData as P, UserProfileImportDiff as Pn, toVercelToolSpecs as Pr, RuntimePhase as Pt, LifecycleEvent as Q, findUnpairedToolCalls as Qn, SkillFailureReport as Qt, FsArtifactStore as R, WebSkillRuntime as Rn, SENSITIVE_ANNOTATION as Rt, BridgeResponse as S, TraceEventType as Sn, resolveToolName as Sr, RunResult as St, DEFAULT_LOOP_LIMITS as T, USER_PROFILE_EXPORT_VERSION as Tn, schemaToForm as Tr, RunSnapshotStore as Tt, FsToolStepStore as U, bridgeError as Un, ScriptExecutor as Ut, FsRunTraceStore as V, appendBehaviorRecords as Vn, SchemaInferer as Vt, FullDisclosureRouter as W, buildRenderResult as Wn, SealOptions as Wt, IntegrityVerdict as X, extractTodoTraceEvents as Xn, SessionRecord as Xt, InstalledSkillManifest as Y, extractChartSpec as Yn, SessionMeta as Yt, InteractLifecycleData as Z, extractUiSpecEvents as Zn, SessionStore as Zt, BehaviorRecordKind as _, ToolStepRecord as _n, readProfileEntries as _r, RedactedArgs as _t, ASK_USER_TOOL as a, SkillSuccessReport as an, listSkillScripts as ar, NetworkPolicy as at, BridgeCapability as b, TraceClock as bn, refineUserProfile as br, RouteResult as bt, AgentLoop as c, TextualToolContent as cn, networkPolicyLibSource as cr, PdfTextExtractor as ct, AnthropicClient as d, ToolContent as dn, normalizeToolContent as dr, READ_LINKED_DOCUMENT_TOOL_NAME as dt, SkillOutcomeReporter as en, fromVercelResult as er, LifecycleHook as et, AnthropicClientConfig as f, ToolDefinition as fn, normalizeToolError as fr, READ_SKILL_FILE_INPUT_SCHEMA as ft, BehaviorRecord as g, ToolStepReader as gn, readBehaviorRecords as gr, RUN_TRACE_SCHEMA_VERSION as gt, BEHAVIOR_RECORDS_KEY as h, ToolResult as hn, partsToText as hr, RUN_SNAPSHOT_SCHEMA_VERSION as ht, ASK_USER_MAX_FIELDS as i, SkillStateGuard as in, isUnsupportedRunSnapshot as ir, MAX_TOOL_STEP_ARG_BYTES as it, DocxTextExtractor as j, UserProfile as jn, toBase64 as jr, RunTraceStore as jt, DEFAULT_USER_PROFILE_LIMITS as k, USER_PROFILE_REFINE_PROMPT as kn, summarizeToolCalls as kr, RunTraceFilter as kt, AgentLoopConfig as l, TodoTraceEvent as ln, networkUrlHost as lr, ProgressiveRouter as lt, ApprovalScope as m, ToolResolution as mn, parseUserProfileExport as mr, READ_SKILL_FILE_TOOL_NAME as mt, ASK_USER_FIELD_TYPES as n, SkillScriptDescriptor as nn, interruptedToolResult as nr, LifecycleListener as nt, ASK_USER_TOOL_NAME as o, TEXT_BUDGETED_CONTENT_TYPES as on, mergeCatalogEntries as or, OpenAiCompatibleClient as ot, ApprovalDecision as p, ToolDisclosure as pn, parseBridgeRequest as pr, READ_SKILL_FILE_TOOL as pt, HookRunner as q, diffUserProfile as qn, SerializingMemoryStore as qt, ASK_USER_INPUT_SCHEMA as r, SkillScriptSchemaSource as rn, isNetworkAllowed as rr, LinkedDocumentReader as rt, ActivateLifecycleData as s, TerminalLifecycleData as sn, mergeProfileEntries as sr, OpenAiCompatibleClientConfig as st, ALLOWED_TOOLS_EXCLUSION_REASON as t, SkillRouter as tn, fromVercelStreamPart as tr, LifecycleHookContext as tt, AgentLoopDeps as u, ToolCallContext as un, normalizeErrorCode as ur, READ_LINKED_DOCUMENT_TOOL as ut, BehaviorScene as v, ToolStepStore as vn, readUserProfile as vr, RefineUserProfileInput as vt, CapabilityMode as w, UNSUPPORTED_DOCUMENT_MESSAGE as wn, schemaSourceLabel as wr, RunSnapshotListEntry as wt, BridgeRequest as x, TraceEvent as xn, renderUserProfileContext as xr, RunLimitErrorDetails as xt, BridgeCapabilities as y, ToolStepTrust as yn, redactToolStepArgs as yr, RouteLifecycleData as yt, FsMemoryStore as z, WebSkillRuntimeDeps as zn, SESSION_SCHEMA_VERSION as zt };