@webskill/sdk 0.8.0 → 0.9.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 +1 -1
  2. package/dist/agent.js +1 -1
  3. package/dist/browser.d.ts +3 -3
  4. package/dist/browser.js +22 -8
  5. package/dist/{catalogComponents-DfxxfUvn-D55Gbb2l.js → catalogComponents-DfxxfUvn-T7Ic8QFV.js} +593 -562
  6. package/dist/{dist-CJqQsIm9.js → dist-BQe1uglQ.js} +2 -2
  7. package/dist/{dist-59XlqDuv.js → dist-Bev6i6Ip.js} +10 -2
  8. package/dist/{dist-DmI5SBBF.js → dist-CFmkV45C.js} +44 -12
  9. package/dist/{eventTypes-g1BXL6x5-CibcOftR.js → eventTypes-DbOpAECr-BjcjZVms.js} +10 -2
  10. package/dist/governance.d.ts +11 -3
  11. package/dist/governance.js +9 -9
  12. package/dist/{index-P9J2LTfU.d.ts → index-DXNTIa-6.d.ts} +2 -2
  13. package/dist/{index-fLskQfAS.d.ts → index-lLcCpHE-.d.ts} +2 -2
  14. package/dist/{index-K-eewlGL.d.ts → index-znZjobkr.d.ts} +7 -2
  15. package/dist/index.d.ts +11 -3
  16. package/dist/index.js +13 -4
  17. package/dist/mcp.d.ts +7 -2
  18. package/dist/mcp.js +9 -5
  19. package/dist/{memoryArtifactStore-52Zn9npI-upv5OWYf.js → memoryArtifactStore-52Zn9npI-LbCQaqyx.js} +1 -1
  20. package/dist/node.d.ts +3 -3
  21. package/dist/node.js +6 -6
  22. package/dist/{openUiLibrary-DURlAxjk-CU6AzfSW.js → openUiLibrary-DURlAxjk-Do_yqg3u.js} +2 -2
  23. package/dist/{skillVersionStore-Bl-ElD45-gRfSaAby.d.ts → skillVersionStore-Bl-ElD45-dMJ8Ybhb.d.ts} +1 -1
  24. package/dist/{testing-BCUO5gZR.js → testing-Csg5ljNm.js} +2 -2
  25. package/dist/testing.d.ts +1 -1
  26. package/dist/testing.js +2 -2
  27. package/dist/{types-B3n0cMZu-BdcqQ35O.d.ts → types-B3n0cMZu-BDhheIhX.d.ts} +9 -1
  28. package/dist/ui-react.d.ts +8 -2
  29. package/dist/ui-react.js +8 -5
  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-DwTwSBFt-DiXXpNZA.js → webskillLitCatalog-DwTwSBFt-BG7kL-Es.js} +1 -1
  35. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { m as WebSkillError } from "./dist-59XlqDuv.js";
1
+ import { h as WebSkillError } from "./dist-Bev6i6Ip.js";
2
2
  import { toJSONSchema, z } from "zod";
3
3
 
4
4
  //#region ../ui/dist/webskillCatalog-CKM0bu47.js
@@ -2871,7 +2871,7 @@ function fromA2uiSpecAction(event) {
2871
2871
  */
2872
2872
  async function loadWebSkillLitCatalog() {
2873
2873
  try {
2874
- const { webskillLitCatalog } = await import("./webskillLitCatalog-DwTwSBFt-DiXXpNZA.js");
2874
+ const { webskillLitCatalog } = await import("./webskillLitCatalog-DwTwSBFt-BG7kL-Es.js");
2875
2875
  return webskillLitCatalog();
2876
2876
  } catch (cause) {
2877
2877
  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);
@@ -76,6 +76,14 @@ function verifyManifest(manifest, actualHashes, actualFiles = [...actualHashes.k
76
76
  };
77
77
  }
78
78
  /**
79
+ * 原子写的临时文件名后缀模式;列举/打包侧据此排除中断残留(0.9.0 分册 11)。
80
+ * 单一来源:不要在别处手写正则(AC-G10),复制正则必然漂移。
81
+ * @stable
82
+ */
83
+ const ATOMIC_TMP_SUFFIX_PATTERN = /\.tmp-\d+-[a-z0-9]+$/;
84
+ /** 该路径是否是 atomicWriteText 留下的临时文件 */
85
+ const isAtomicTempPath = (path) => ATOMIC_TMP_SUFFIX_PATTERN.test(path);
86
+ /**
79
87
  * 原子写文本:先写临时文件再 rename(进程崩溃不留下半写文件;lockfile 等账本场景)。
80
88
  * 原子性强弱取决于 provider 的 rename 实现:NodeFS/MemoryFS 为真 rename;
81
89
  * OPFS 无原生 move,rename 是 copy+delete(非原子,崩溃可能残留双份),
@@ -656,7 +664,7 @@ async function listFilesRecursive(fs, root, prefix = "") {
656
664
  for (const entry of await fs.list(root)) {
657
665
  const rel = prefix === "" ? baseName$1(entry.path) : `${prefix}/${baseName$1(entry.path)}`;
658
666
  if (entry.type === "directory") out.push(...await listFilesRecursive(fs, entry.path, rel));
659
- else out.push(rel);
667
+ else if (!isAtomicTempPath(baseName$1(entry.path))) out.push(rel);
660
668
  }
661
669
  return out;
662
670
  }
@@ -1122,4 +1130,4 @@ const xmlRenderer = {
1122
1130
  };
1123
1131
 
1124
1132
  //#endregion
1125
- export { messageOf as A, signSkill as B, detectSkillArchiveShape as C, isValidSkillName as D, exportSkills as E, readSkillSignature as F, verifyManifest as G, stripArchiveRoot as H, renderAvailableSkillsXml as I, verifySkillSignature as K, renderCatalogJson as L, parseSkillMarkdown as M, parseSkillPackManifest as N, jsonRenderer as O, readResponseWithLimit as P, resolveArchiveLimits as R, computeDigest as S, escapeXml as T, unzipWithLimits as U, signaturePayloadBytes as V, validateSkills as W, atomicWriteText as _, SIGNATURE_SCHEMA_VERSION as a, checkDependencyCycles as b, SKILL_NAME_MAX_LENGTH as c, SKILL_SIGNATURE_FILE as d, SkillDiscovery as f, assertSafePathSegment as g, assertRemoteUrlAllowed as h, MemoryFS as i, normalizePath as j, keyIdOf as k, SKILL_NAME_PATTERN as l, WebSkillError as m, FsTrustedKeyStore as n, SKILLS_LOCKFILE as o, SkillReader as p, xmlRenderer as q, MANIFEST_EXCLUDED_FILES as r, SKILL_MANIFEST_FILE as s, DEFAULT_ARCHIVE_LIMITS as t, SKILL_PACK_FILE as u, buildCatalog as v, detectSkillArchiveShapeFromFs as w, checkSkillRules as x, buildManifest as y, resolveInsideRoot as z };
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 };
@@ -1,5 +1,5 @@
1
- import { A as messageOf, I as renderAvailableSkillsXml, M as parseSkillMarkdown, W as validateSkills, f as SkillDiscovery, g as assertSafePathSegment, m as WebSkillError, p as SkillReader, v as buildCatalog, z as resolveInsideRoot } from "./dist-59XlqDuv.js";
2
- import { a as textParts, i as rejectUnsupportedPart, n as partsToText, o as validateLlmMessages, r as promptText, t as MemoryArtifactStore } from "./memoryArtifactStore-52Zn9npI-upv5OWYf.js";
1
+ import { K as validateSkills, M as messageOf, P as parseSkillMarkdown, R as renderAvailableSkillsXml, V as resolveInsideRoot, _ as assertSafePathSegment, h as WebSkillError, m as SkillReader, p as SkillDiscovery, v as atomicWriteText, y as buildCatalog } from "./dist-Bev6i6Ip.js";
2
+ import { a as textParts, i as rejectUnsupportedPart, n as partsToText, o as validateLlmMessages, r as promptText, t as MemoryArtifactStore } from "./memoryArtifactStore-52Zn9npI-LbCQaqyx.js";
3
3
 
4
4
  //#region ../runtime/dist/index.js
5
5
  /** 与正常工具结果同构:模型读到的是「这次调用被中断了」,而不是一个凭空消失的调用 */
@@ -897,10 +897,26 @@ var AnthropicClient = class {
897
897
  }
898
898
  return res;
899
899
  }
900
- /** 轻量探测(GET /v1/models),集成测试据此决定 skip */
900
+ /**
901
+ * 真实调用路径探测(FR-27.1):`POST /v1/messages` 最小请求(max_tokens=1),200 即可达。
902
+ * Anthropic 兼容端点(如 LM Studio 的 /anthropic 层)不实现 `GET /v1/models`,
903
+ * 用 /models 探测会把「能对话」误判为「不可达」——checkAvailability 的语义从
904
+ * 「/models 可达」改为「能完成一次真实调用」。
905
+ */
901
906
  async checkAvailability() {
902
907
  try {
903
- return (await this.#fetch(`${this.#baseUrl()}/v1/models`, { headers: this.#headers() })).ok;
908
+ return (await this.#fetch(`${this.#baseUrl()}/v1/messages`, {
909
+ method: "POST",
910
+ headers: this.#headers(),
911
+ body: JSON.stringify({
912
+ model: this.#config.model,
913
+ max_tokens: 1,
914
+ messages: [{
915
+ role: "user",
916
+ content: "ping"
917
+ }]
918
+ })
919
+ })).ok;
904
920
  } catch {
905
921
  return false;
906
922
  }
@@ -1421,6 +1437,16 @@ const ASK_USER_TOOL = {
1421
1437
  source: "builtin"
1422
1438
  };
1423
1439
  /**
1440
+ * 越权 / 绝对路径 / 父级遍历的引用读取:策略拒绝(FS_PERMISSION_DENIED,
1441
+ * 计入 POLICY_DENIAL_CODES → 不计入隔离失败计数),
1442
+ * 与「references/ 内路径确实不存在 → FS_NOT_FOUND」区分(0.9.0 分册 14,UX-04)。
1443
+ */
1444
+ function assertReferencePath(relativePath) {
1445
+ const trimmed = relativePath.trim();
1446
+ if (trimmed === "" || trimmed.startsWith("/") || trimmed.startsWith("\\") || /^[a-zA-Z]:[\\/]/.test(trimmed)) throw new WebSkillError("FS_PERMISSION_DENIED", `Reference access denied: absolute or empty path (path: ${JSON.stringify(relativePath)})`);
1447
+ if (trimmed.replace(/\\/g, "/").split("/").includes("..")) throw new WebSkillError("FS_PERMISSION_DENIED", `Reference access denied: parent traversal (path: ${JSON.stringify(relativePath)})`);
1448
+ }
1449
+ /**
1424
1450
  * 脚本执行上下文:只暴露 readReference / writeArtifact 两个显式能力,
1425
1451
  * 不暴露 fs 本体(沙箱语义,对齐 deferred-items D1)。
1426
1452
  */
@@ -1431,6 +1457,7 @@ function createScriptContext(deps) {
1431
1457
  skillName,
1432
1458
  runId,
1433
1459
  async readReference(relativePath) {
1460
+ assertReferencePath(relativePath);
1434
1461
  return readFs.readText(resolveInsideRoot(skillRoot, `references/${relativePath}`));
1435
1462
  },
1436
1463
  async writeArtifact(path, content, options) {
@@ -2055,7 +2082,7 @@ var FsRunSnapshotStore = class {
2055
2082
  return resolveInsideRoot(this.#root, `${runId}${SNAPSHOT_SUFFIX}`);
2056
2083
  }
2057
2084
  async save(snapshot) {
2058
- await this.#fs.writeText(this.#path(snapshot.runId), JSON.stringify(snapshot, null, 2));
2085
+ await atomicWriteText(this.#fs, this.#path(snapshot.runId), JSON.stringify(snapshot, null, 2));
2059
2086
  await this.#pruneExpired();
2060
2087
  }
2061
2088
  async load(runId) {
@@ -4398,7 +4425,7 @@ var FsMemoryStore = class {
4398
4425
  }
4399
4426
  }
4400
4427
  async set(scope, key, value) {
4401
- await this.#fs.writeText(this.#keyPath(scope, key), JSON.stringify(value, null, 2));
4428
+ await atomicWriteText(this.#fs, this.#keyPath(scope, key), JSON.stringify(value, null, 2));
4402
4429
  }
4403
4430
  async delete(scope, key) {
4404
4431
  const path = this.#keyPath(scope, key);
@@ -4634,7 +4661,7 @@ var FsArtifactStore = class {
4634
4661
  }
4635
4662
  async createTextArtifact(input) {
4636
4663
  const size = new TextEncoder().encode(input.content).length;
4637
- await this.#fs.writeText(this.#artifactPath(input.runId, input.path), input.content);
4664
+ await atomicWriteText(this.#fs, this.#artifactPath(input.runId, input.path), input.content);
4638
4665
  return this.#persist({
4639
4666
  ...input,
4640
4667
  type: "text",
@@ -4684,7 +4711,7 @@ var FsArtifactStore = class {
4684
4711
  metadata: input.metadata
4685
4712
  };
4686
4713
  const next = [...(await this.listArtifacts(input.runId)).filter((a) => a.id !== artifact.id), artifact];
4687
- await this.#fs.writeText(`${this.#root}/${input.runId}/${INDEX_FILE$1}`, JSON.stringify({ artifacts: next }, null, 2));
4714
+ await atomicWriteText(this.#fs, `${this.#root}/${input.runId}/${INDEX_FILE$1}`, JSON.stringify({ artifacts: next }, null, 2));
4688
4715
  return artifact;
4689
4716
  }
4690
4717
  };
@@ -4994,7 +5021,7 @@ var FsRunTraceStore = class {
4994
5021
  events: run.trace
4995
5022
  };
4996
5023
  try {
4997
- await this.#fs.writeText(this.#path(run.id), JSON.stringify(trace, null, 2));
5024
+ await atomicWriteText(this.#fs, this.#path(run.id), JSON.stringify(trace, null, 2));
4998
5025
  } catch (e) {
4999
5026
  this.#onError(e, run);
5000
5027
  return;
@@ -5213,6 +5240,8 @@ var FsSessionStore = class {
5213
5240
  #fs;
5214
5241
  /** id → 该 id 上最后一次变更的完成时点,用于串行化读改写 */
5215
5242
  #writes = /* @__PURE__ */ new Map();
5243
+ /** FR-11.4:损坏文件诊断只报一次,避免 list 轮询刷屏 */
5244
+ #warnedDataLoss = false;
5216
5245
  constructor(deps) {
5217
5246
  this.#root = deps.root.replace(/\/+$/, "");
5218
5247
  this.#fs = deps.fs;
@@ -5242,7 +5271,7 @@ var FsSessionStore = class {
5242
5271
  ...record.modelId !== void 0 ? { modelId: record.modelId } : {},
5243
5272
  messages: record.messages
5244
5273
  };
5245
- await this.#fs.writeText(this.#path(record.id), JSON.stringify(file, null, 2));
5274
+ await atomicWriteText(this.#fs, this.#path(record.id), JSON.stringify(file, null, 2));
5246
5275
  }
5247
5276
  async #require(id) {
5248
5277
  const record = await this.get(id);
@@ -5262,14 +5291,17 @@ var FsSessionStore = class {
5262
5291
  let record;
5263
5292
  try {
5264
5293
  record = parseSessionFile(await this.#fs.readText(entry.path), entry.path);
5265
- } catch (e) {
5266
- console.warn(`Skipping unreadable session file "${entry.path}": ${e instanceof Error ? e.message : String(e)}`);
5294
+ } catch {
5267
5295
  skipped.push(baseName(entry.path));
5268
5296
  continue;
5269
5297
  }
5270
5298
  if (record.archived === true && options.includeArchived !== true) continue;
5271
5299
  metas.push(toMeta(record));
5272
5300
  }
5301
+ if (skipped.length > 0 && !this.#warnedDataLoss) {
5302
+ this.#warnedDataLoss = true;
5303
+ console.warn(`[webskill] ${skipped.length} session file(s) under ${this.#root} are unreadable (possible data loss from an interrupted write): ${skipped.join(", ")}`);
5304
+ }
5273
5305
  metas.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
5274
5306
  return {
5275
5307
  ...takeTailPage(metas, options, "session"),
@@ -1,4 +1,4 @@
1
- //#region ../governance/dist/eventTypes-g1BXL6x5.js
1
+ //#region ../governance/dist/eventTypes-DbOpAECr.js
2
2
  /**
3
3
  * 审计事件类型常量(FR-13.4)。
4
4
  *
@@ -17,6 +17,9 @@ const AUDIT_EVENT_TYPES = {
17
17
  skillPolicyDenied: "skill.policy_denied",
18
18
  skillUninstalled: "skill.uninstalled",
19
19
  skillInstalled: "skill.installed",
20
+ skillExported: "skill.exported",
21
+ skillRenamed: "skill.renamed",
22
+ skillVersioned: "skill.versioned",
20
23
  trustKeyAdded: "trust.key_added",
21
24
  trustKeyRemoved: "trust.key_removed",
22
25
  policyNetworkChanged: "policy.network_changed",
@@ -27,8 +30,13 @@ const AUDIT_EVENT_TYPES = {
27
30
  profileChanged: "profile.changed",
28
31
  mcpEndpointChanged: "mcp.endpoint_changed",
29
32
  mcpPolicyRelaxed: "mcp.policy_relaxed",
33
+ webmcpEnabled: "webmcp.enabled",
30
34
  providerChanged: "provider.changed",
31
- candidateGenerated: "candidate.generated"
35
+ candidateCreated: "candidate.created",
36
+ candidateGenerated: "candidate.generated",
37
+ candidateSubmitted: "candidate.submitted",
38
+ candidateApproved: "candidate.approved",
39
+ candidateRejected: "candidate.rejected"
32
40
  };
33
41
  /** 稳定展示序:筛选下拉与文档表格都从这里取,不各自维护一份顺序 */
34
42
  const AUDIT_EVENT_TYPE_LIST = Object.values(AUDIT_EVENT_TYPES);
@@ -1,6 +1,6 @@
1
- import { H as PageQuery, I as FileSystemProvider, V as Page, ct as SkillManagerPort, f as LlmMessage, it as SkillDocument, l as LlmClient, nt as SkillCatalogEntry, x as UiBridge } from "./types-B3n0cMZu-BdcqQ35O.js";
2
- import { H as IntegrityVerdict, It as SkillIntegrityGuard, Lt as SkillOutcomeReporter, Vt as SkillStateGuard, bt as RuntimeRun, pn as WebSkillRuntime } from "./index-K-eewlGL.js";
3
- import { _ as SkillVersion, a as AuditLog, c as CandidateFile, d as CandidateSource, f as CandidateStatus, g as SkillState, h as SKILL_VERSION_PAGE_SIZE, i as AuditEvent, l as CandidateRisk, m as CompositeApprovalPolicy, n as ApprovalDecision, o as AuditQueryFilter, p as CandidateStore, r as ApprovalPolicy, s as CANDIDATE_PAGE_SIZE, t as AlwaysHumanApprovalPolicy, u as CandidateSkill, v as SkillVersionStore, y as candidateToCatalogEntry } from "./skillVersionStore-Bl-ElD45-gRfSaAby.js";
1
+ import { H as Page, L as FileSystemProvider, U as PageQuery, at as SkillDocument, f as LlmMessage, l as LlmClient, lt as SkillManagerPort, rt as SkillCatalogEntry, x as UiBridge } from "./types-B3n0cMZu-BDhheIhX.js";
2
+ import { H as IntegrityVerdict, It as SkillIntegrityGuard, Lt as SkillOutcomeReporter, Vt as SkillStateGuard, bt as RuntimeRun, pn as WebSkillRuntime } from "./index-znZjobkr.js";
3
+ import { _ as SkillVersion, a as AuditLog, c as CandidateFile, d as CandidateSource, f as CandidateStatus, g as SkillState, h as SKILL_VERSION_PAGE_SIZE, i as AuditEvent, l as CandidateRisk, m as CompositeApprovalPolicy, n as ApprovalDecision, o as AuditQueryFilter, p as CandidateStore, r as ApprovalPolicy, s as CANDIDATE_PAGE_SIZE, t as AlwaysHumanApprovalPolicy, u as CandidateSkill, v as SkillVersionStore, y as candidateToCatalogEntry } from "./skillVersionStore-Bl-ElD45-dMJ8Ybhb.js";
4
4
  //#region ../governance/dist/index.d.ts
5
5
  //#region src/candidate/candidateNormalizer.d.ts
6
6
  /** 剥 markdown fence 与 <think> 块、截取首尾 {};非对象 → CANDIDATE_INVALID */
@@ -175,6 +175,9 @@ declare const AUDIT_EVENT_TYPES: {
175
175
  readonly skillPolicyDenied: "skill.policy_denied";
176
176
  readonly skillUninstalled: "skill.uninstalled";
177
177
  readonly skillInstalled: "skill.installed";
178
+ readonly skillExported: "skill.exported";
179
+ readonly skillRenamed: "skill.renamed";
180
+ readonly skillVersioned: "skill.versioned";
178
181
  readonly trustKeyAdded: "trust.key_added";
179
182
  readonly trustKeyRemoved: "trust.key_removed";
180
183
  readonly policyNetworkChanged: "policy.network_changed";
@@ -185,8 +188,13 @@ declare const AUDIT_EVENT_TYPES: {
185
188
  readonly profileChanged: "profile.changed";
186
189
  readonly mcpEndpointChanged: "mcp.endpoint_changed";
187
190
  readonly mcpPolicyRelaxed: "mcp.policy_relaxed";
191
+ readonly webmcpEnabled: "webmcp.enabled";
188
192
  readonly providerChanged: "provider.changed";
193
+ readonly candidateCreated: "candidate.created";
189
194
  readonly candidateGenerated: "candidate.generated";
195
+ readonly candidateSubmitted: "candidate.submitted";
196
+ readonly candidateApproved: "candidate.approved";
197
+ readonly candidateRejected: "candidate.rejected";
190
198
  };
191
199
  type AuditEventType = (typeof AUDIT_EVENT_TYPES)[keyof typeof AUDIT_EVENT_TYPES];
192
200
  /** 稳定展示序:筛选下拉与文档表格都从这里取,不各自维护一份顺序 */
@@ -1,6 +1,6 @@
1
- import { A as messageOf, D as isValidSkillName, g as assertSafePathSegment, m as WebSkillError } from "./dist-59XlqDuv.js";
2
- import { a as textParts, n as partsToText } from "./memoryArtifactStore-52Zn9npI-upv5OWYf.js";
3
- import { n as AUDIT_EVENT_TYPE_LIST, t as AUDIT_EVENT_TYPES } from "./eventTypes-g1BXL6x5-CibcOftR.js";
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";
3
+ import { n as AUDIT_EVENT_TYPE_LIST, t as AUDIT_EVENT_TYPES } from "./eventTypes-DbOpAECr-BjcjZVms.js";
4
4
 
5
5
  //#region ../governance/dist/index.js
6
6
  const invalid = (message, details) => {
@@ -135,7 +135,7 @@ var CandidateStore = class {
135
135
  async save(candidate) {
136
136
  validateCandidate(candidate);
137
137
  assertSafePathSegment(candidate.id, "candidate id");
138
- await this.#fs.writeText(`${dirOf$1(this.#root)}/${candidate.id}.json`, JSON.stringify(candidate, null, 2));
138
+ await atomicWriteText(this.#fs, `${dirOf$1(this.#root)}/${candidate.id}.json`, JSON.stringify(candidate, null, 2));
139
139
  }
140
140
  async get(id) {
141
141
  assertSafePathSegment(id, "candidate id");
@@ -211,7 +211,7 @@ function createCandidateSink(options) {
211
211
  };
212
212
  await options.store.save(candidate);
213
213
  await options.audit?.append({
214
- type: "candidate.created",
214
+ type: AUDIT_EVENT_TYPES.candidateCreated,
215
215
  target: candidate.id,
216
216
  data: {
217
217
  name: candidate.name,
@@ -275,7 +275,7 @@ var LlmCandidateGenerator = class {
275
275
  ...this.#createId ? { createId: this.#createId } : {}
276
276
  });
277
277
  await this.#audit?.append({
278
- type: "candidate.created",
278
+ type: AUDIT_EVENT_TYPES.candidateCreated,
279
279
  target: candidate.id,
280
280
  data: {
281
281
  name: candidate.name,
@@ -592,7 +592,7 @@ var SkillVersionStore = class {
592
592
  await this.#fs.writeBinary(archivePath, input.archive);
593
593
  version.archivePath = archivePath;
594
594
  }
595
- await this.#fs.writeText(`${dirOf(this.#root, skillName)}/${version.versionId}.json`, JSON.stringify(version, null, 2));
595
+ await atomicWriteText(this.#fs, `${dirOf(this.#root, skillName)}/${version.versionId}.json`, JSON.stringify(version, null, 2));
596
596
  await this.#prune(skillName);
597
597
  return version;
598
598
  }
@@ -787,7 +787,7 @@ var SkillStatePolicy = class {
787
787
  async #persist() {
788
788
  const data = await this.#load();
789
789
  const path = fileOf(this.#root);
790
- await this.#fs.writeText(path, JSON.stringify(data, null, 2));
790
+ await atomicWriteText(this.#fs, path, JSON.stringify(data, null, 2));
791
791
  try {
792
792
  this.#loadedMtimeMs = (await this.#fs.stat(path)).mtimeMs;
793
793
  } catch {
@@ -1178,7 +1178,7 @@ var DocumentSkillExtractor = class {
1178
1178
  documentHash: input.document.hash
1179
1179
  };
1180
1180
  await this.#audit?.append({
1181
- type: "candidate.created",
1181
+ type: AUDIT_EVENT_TYPES.candidateCreated,
1182
1182
  target: candidate.id,
1183
1183
  data: {
1184
1184
  name: candidate.name,
@@ -1,5 +1,5 @@
1
- import { E as UiSpecSnapshot, R as JsonSchema, S as UiSpecActionCapability, c as InteractionResponse, r as ChartSpec, s as InteractionRequest, v as RenderBlock, vt as UiSpecNode, x as UiBridge, y as RenderResultRequest } from "./types-B3n0cMZu-BdcqQ35O.js";
2
- import { k as ExternalToolSource } from "./index-K-eewlGL.js";
1
+ import { E as UiSpecSnapshot, S as UiSpecActionCapability, c as InteractionResponse, r as ChartSpec, s as InteractionRequest, v as RenderBlock, x as UiBridge, y as RenderResultRequest, yt as UiSpecNode, z as JsonSchema } from "./types-B3n0cMZu-BDhheIhX.js";
2
+ import { k as ExternalToolSource } from "./index-znZjobkr.js";
3
3
  import { z } from "zod";
4
4
  import { ComponentType, ReactNode } from "react";
5
5
  //#region ../ui/dist/index.d.ts
@@ -1,5 +1,5 @@
1
- import { a as InteractionOrigin, c as InteractionResponse, s as InteractionRequest, x as UiBridge } from "./types-B3n0cMZu-BdcqQ35O.js";
2
- import { k as ExternalToolSource } from "./index-K-eewlGL.js";
1
+ import { a as InteractionOrigin, c as InteractionResponse, s as InteractionRequest, x as UiBridge } from "./types-B3n0cMZu-BDhheIhX.js";
2
+ import { k as ExternalToolSource } from "./index-znZjobkr.js";
3
3
  //#region ../agent/dist/index.d.ts
4
4
  //#region src/todo/types.d.ts
5
5
  /** 待办条目状态:未开始 / 进行中 / 已完成(FR-3.1) */
@@ -1,4 +1,4 @@
1
- import { C as UiSpecDrafts, Ct as WebSkillErrorCode, D as UiSurfaceActionRequest, H as PageQuery, I as FileSystemProvider, P as DiscoveryResult, R as JsonSchema, V as Page, _ as MemoryStore, at as SkillInstallSource, bt as ValidationReport, d as LlmContentPart, f as LlmMessage, g as LlmToolSpec, h as LlmToolCall, i as FormField, it as SkillDocument, l as LlmClient, lt as SkillManifest, m as LlmStreamEvent, n as ArtifactStore, nt as SkillCatalogEntry, o as InteractionPolicy, p as LlmResponse, r as ChartSpec, rt as SkillDiscovery, s as InteractionRequest, t as Artifact, tt as SkillCatalog, u as LlmCompleteInput, v as RenderBlock, vt as UiSpecNode, w as UiSpecEvent, x as UiBridge, y as RenderResultRequest } from "./types-B3n0cMZu-BdcqQ35O.js";
1
+ import { C as UiSpecDrafts, D as UiSurfaceActionRequest, F as DiscoveryResult, H as Page, L as FileSystemProvider, U as PageQuery, _ as MemoryStore, at as SkillDocument, d as LlmContentPart, f as LlmMessage, g as LlmToolSpec, h as LlmToolCall, i as FormField, it as SkillDiscovery, l as LlmClient, m as LlmStreamEvent, n as ArtifactStore, nt as SkillCatalog, o as InteractionPolicy, ot as SkillInstallSource, p as LlmResponse, r as ChartSpec, rt as SkillCatalogEntry, s as InteractionRequest, t as Artifact, u as LlmCompleteInput, ut as SkillManifest, v as RenderBlock, w as UiSpecEvent, wt as WebSkillErrorCode, x as UiBridge, xt as ValidationReport, y as RenderResultRequest, yt as UiSpecNode, z as JsonSchema } from "./types-B3n0cMZu-BDhheIhX.js";
2
2
  //#region ../runtime/dist/index.d.ts
3
3
  //#region src/llm/parts.d.ts
4
4
  /** 纯文本消息内容的构造快捷方式(引擎内部绝大多数消息仍是纯文本) */
@@ -161,7 +161,12 @@ declare class AnthropicClient implements LlmClient {
161
161
  complete(input: LlmCompleteInput): Promise<LlmResponse>;
162
162
  /** SSE 流式:text_delta → text-delta;input_json_delta 按 block index 聚合 → tool-calls */
163
163
  stream(input: LlmCompleteInput): AsyncIterable<LlmStreamEvent>;
164
- /** 轻量探测(GET /v1/models),集成测试据此决定 skip */
164
+ /**
165
+ * 真实调用路径探测(FR-27.1):`POST /v1/messages` 最小请求(max_tokens=1),200 即可达。
166
+ * Anthropic 兼容端点(如 LM Studio 的 /anthropic 层)不实现 `GET /v1/models`,
167
+ * 用 /models 探测会把「能对话」误判为「不可达」——checkAvailability 的语义从
168
+ * 「/models 可达」改为「能完成一次真实调用」。
169
+ */
165
170
  checkAvailability(): Promise<boolean>;
166
171
  }
167
172
  //#endregion
package/dist/index.d.ts CHANGED
@@ -1,3 +1,11 @@
1
- import { $ as SkillArchiveDetection, $t as validateSkills, A as ArchiveLimits, At as checkSkillRules, B as MemoryFS, Bt as normalizePath, C as UiSpecDrafts, Ct as WebSkillErrorCode, D as UiSurfaceActionRequest, Dt as buildCatalog, E as UiSpecSnapshot, Et as atomicWriteText, F as FileStat, Ft as exportSkills, G as SKILLS_LOCKFILE, Gt as renderAvailableSkillsXml, H as PageQuery, Ht as parseSkillPackManifest, I as FileSystemProvider, It as isValidSkillName, J as SKILL_NAME_PATTERN, Jt as resolveInsideRoot, K as SKILL_MANIFEST_FILE, Kt as renderCatalogJson, L as FsTrustedKeyStore, Lt as jsonRenderer, M as CryptoKeyLike, Mt as detectSkillArchiveShape, N as DEFAULT_ARCHIVE_LIMITS, Nt as detectSkillArchiveShapeFromFs, O as UiSurfaceActionResponse, Ot as buildManifest, P as DiscoveryResult, Pt as escapeXml, Q as SignatureVerdict, Qt as unzipWithLimits, R as JsonSchema, Rt as keyIdOf, S as UiSpecActionCapability, St as WebSkillError, T as UiSpecPatch, Tt as assertSafePathSegment, U as RemoteUrlPolicy, Ut as readResponseWithLimit, V as Page, Vt as parseSkillMarkdown, W as SIGNATURE_SCHEMA_VERSION, Wt as readSkillSignature, X as SKILL_SIGNATURE_FILE, Xt as signaturePayloadBytes, Y as SKILL_PACK_FILE, Yt as signSkill, Z as SignatureAuditSink, Zt as stripArchiveRoot, _ as MemoryStore, _t as TrustedKeyStore, a as InteractionOrigin, at as SkillInstallSource, b as SkillCandidateMarker, bt as ValidationReport, c as InteractionResponse, ct as SkillManagerPort, d as LlmContentPart, dt as SkillPackManifest, en as verifyManifest, et as SkillArchiveShape, f as LlmMessage, ft as SkillReader, g as LlmToolSpec, gt as TrustedKey, h as LlmToolCall, ht as SkillsLockfile, i as FormField, it as SkillDocument, j as CatalogRenderer, jt as computeDigest, k as extractSkillCandidate, kt as checkDependencyCycles, l as LlmClient, lt as SkillManifest, m as LlmStreamEvent, mt as SkillSource, n as ArtifactStore, nn as xmlRenderer, nt as SkillCatalogEntry, o as InteractionPolicy, ot as SkillIssue, p as LlmResponse, pt as SkillSignature, q as SKILL_NAME_MAX_LENGTH, qt as resolveArchiveLimits, r as ChartSpec, rt as SkillDiscovery, s as InteractionRequest, st as SkillLocation, t as Artifact, tn as verifySkillSignature, tt as SkillCatalog, u as LlmCompleteInput, ut as SkillMetadata, v as RenderBlock, vt as UiSpecNode, w as UiSpecEvent, wt as assertRemoteUrlAllowed, x as UiBridge, xt as VerifyResult, y as RenderResultRequest, yt as UnsignedPolicy, z as MANIFEST_EXCLUDED_FILES, zt as messageOf } from "./types-B3n0cMZu-BdcqQ35O.js";
2
- import { $ as READ_SKILL_FILE_INPUT_SCHEMA, $n as scriptToolName, $t as TraceRecorder, A as FS_SESSION_PAGE_SIZE, An as interruptedToolResult, At as SerializingMemoryStore, B as HookRunnerOptions, Bn as normalizeToolError, Bt as SkillScriptSchemaSource, C as DEFAULT_LOOP_LIMITS, Cn as extractChartSpec, Ct as SESSION_SCHEMA_VERSION, D as ExecuteLifecycleData, Dn as formatSkillScriptManifest, Dt as SealOptions, E as EventBus, En as findUnpairedToolCalls, Et as ScriptExecutor, F as FsSessionStore, Fn as mergeProfileEntries, Ft as SkillFailureReport, G as LifecycleEventInit, Gn as readProfileEntries, Gt as TodoTraceEvent, H as IntegrityVerdict, Hn as parseUserProfileExport, Ht as SkillSuccessReport, I as FullDisclosureRouter, In as networkPolicyLibSource, It as SkillIntegrityGuard, J as LifecycleListener, Jn as renderUserProfileContext, Jt as ToolResolution, K as LifecycleHook, Kn as readUserProfile, Kt as ToolContent, L as GoogleGenAiClient, Ln as networkUrlHost, Lt as SkillOutcomeReporter, M as FsMemoryStore, Mn as isUnsupportedRunSnapshot, Mt as SessionMeta, N as FsRunSnapshotStore, Nn as listSkillScripts, Nt as SessionRecord, O as ExternalSkillProvider, On as fromVercelResult, Ot as SealRecord, P as FsRunTraceStore, Pn as mergeCatalogEntries, Pt as SessionStore, Q as ProgressiveRouter, Qn as schemaToForm, Qt as TraceEventType, R as GoogleGenAiClientConfig, Rn as normalizeErrorCode, Rt as SkillRouter, S as CapabilityMode, Sn as exportUserProfile, St as RuntimeSessionHandle, T as EMPTY_USER_PROFILE, Tn as extractUiSpecEvents, Tt as ScriptExecutionContext, U as InteractLifecycleData, Un as partsToText, Ut as TerminalLifecycleData, V as InstalledSkillManifest, Vn as parseBridgeRequest, Vt as SkillStateGuard, W as LifecycleEvent, Wn as readBehaviorRecords, Wt as TextualToolContent, X as OpenAiCompatibleClient, Xn as sampleBehaviorRecords, Xt as TraceClock, Y as NetworkPolicy, Yn as resolveToolName, Yt as ToolResult, Z as OpenAiCompatibleClientConfig, Zn as schemaSourceLabel, Zt as TraceEvent, _ as BridgeCapabilities, _n as bridgeError, _t as RunTraceStore, a as ActivateLifecycleData, an as UnsupportedRunSnapshot, ar as toVercelToolSpecs, at as RouteLifecycleData, b as BridgeResponse, bn as createWebSkillApi, bt as RuntimeRun, c as AgentLoopDeps, cn as UserProfileExport, ct as RunResult, d as ApprovalDecision, dn as VercelToolSpec, dt as RunSnapshotStore, en as USER_PROFILE_EXPORT_VERSION, er as sealToolCallPairs, et as READ_SKILL_FILE_TOOL, f as ApprovalScope, fn as WebSkillApi, ft as RunTerminationReason, g as BehaviorScene, gn as applyUserProfileImport, gt as RunTraceMetrics, h as BehaviorRecordKind, hn as appendBehaviorRecords, ht as RunTraceFilter, i as ASK_USER_TOOL_NAME, in as USER_PROFILE_REFINE_PROMPT, ir as toRecordDigests, it as RefineUserProfileInput, j as FsArtifactStore, jn as isNetworkAllowed, jt as SessionListPage, k as ExternalToolSource, kn as fromVercelStreamPart, kt as SealResult, l as AnthropicClient, ln as UserProfileImportDiff, lt as RunSnapshot, m as BehaviorRecord, mn as WebSkillRuntimeDeps, mt as RunTraceFile, n as ASK_USER_INPUT_SCHEMA, nn as USER_PROFILE_NO_INVENTION_RULE, nr as textParts, nt as RUN_SNAPSHOT_SCHEMA_VERSION, o as AgentLoop, on as UserProfile, or as validateUiSpecEvent, ot as RouteResult, p as BEHAVIOR_RECORDS_KEY, pn as WebSkillRuntime, pt as RunToolCall, q as LifecycleHookContext, qn as refineUserProfile, qt as ToolDefinition, r as ASK_USER_TOOL, rn as USER_PROFILE_PROMPT_HEADER, rr as toLlmToolSpec, rt as RUN_TRACE_SCHEMA_VERSION, s as AgentLoopConfig, sn as UserProfileEntry, sr as validateUiSpecNode, st as RunLimitErrorDetails, t as ALLOWED_TOOLS_EXCLUSION_REASON, tn as USER_PROFILE_KEY, tr as summarizeToolCalls, tt as READ_SKILL_FILE_TOOL_NAME, u as AnthropicClientConfig, un as UserProfileLimits, ut as RunSnapshotListEntry, v as BridgeCapability, vn as buildRenderResult, vt as RunTraceSummary, w as DEFAULT_USER_PROFILE_LIMITS, wn as extractTodoTraceEvents, wt as SchemaInferer, x as CapabilityApproval, xn as diffUserProfile, xt as RuntimeSession, y as BridgeRequest, yn as createScriptContext, yt as RuntimePhase, z as HookRunner, zn as normalizeToolContent, zt as SkillScriptDescriptor } from "./index-K-eewlGL.js";
3
- export { ALLOWED_TOOLS_EXCLUSION_REASON, 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, BEHAVIOR_RECORDS_KEY, type BehaviorRecord, type BehaviorRecordKind, type BehaviorScene, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, type CryptoKeyLike, DEFAULT_ARCHIVE_LIMITS, DEFAULT_LOOP_LIMITS, DEFAULT_USER_PROFILE_LIMITS, type DiscoveryResult, EMPTY_USER_PROFILE, 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 InteractionOrigin, 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 RefineUserProfileInput, type RemoteUrlPolicy, type RenderBlock, type RenderResultRequest, type RouteLifecycleData, type RouteResult, type RunLimitErrorDetails, 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, type SealOptions, type SealRecord, type SealResult, SerializingMemoryStore, type SessionListPage, type SessionMeta, type SessionRecord, type SessionStore, type SignatureAuditSink, type SignatureVerdict, type SkillArchiveDetection, type SkillArchiveShape, type SkillCandidateMarker, 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 SkillScriptDescriptor, type SkillScriptSchemaSource, type SkillSignature, type SkillSource, type SkillStateGuard, type SkillSuccessReport, type SkillsLockfile, type TerminalLifecycleData, type TextualToolContent, type TodoTraceEvent, type ToolContent, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type TrustedKey, type TrustedKeyStore, USER_PROFILE_EXPORT_VERSION, USER_PROFILE_KEY, USER_PROFILE_NO_INVENTION_RULE, USER_PROFILE_PROMPT_HEADER, USER_PROFILE_REFINE_PROMPT, type UiBridge, type UiSpecActionCapability, type UiSpecDrafts, type UiSpecEvent, type UiSpecNode, type UiSpecPatch, type UiSpecSnapshot, type UiSurfaceActionRequest, type UiSurfaceActionResponse, type UnsignedPolicy, type UnsupportedRunSnapshot, type UserProfile, type UserProfileEntry, type UserProfileExport, type UserProfileImportDiff, type UserProfileLimits, type ValidationReport, type VercelToolSpec, type VerifyResult, type WebSkillApi, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, appendBehaviorRecords, applyUserProfileImport, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, detectSkillArchiveShape, detectSkillArchiveShapeFromFs, diffUserProfile, escapeXml, exportSkills, exportUserProfile, extractChartSpec, extractSkillCandidate, extractTodoTraceEvents, extractUiSpecEvents, findUnpairedToolCalls, formatSkillScriptManifest, fromVercelResult, fromVercelStreamPart, interruptedToolResult, isNetworkAllowed, isUnsupportedRunSnapshot, isValidSkillName, jsonRenderer, keyIdOf, listSkillScripts, mergeCatalogEntries, mergeProfileEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, parseUserProfileExport, partsToText, readBehaviorRecords, readProfileEntries, readResponseWithLimit, readSkillSignature, readUserProfile, refineUserProfile, renderAvailableSkillsXml, renderCatalogJson, renderUserProfileContext, resolveArchiveLimits, resolveInsideRoot, resolveToolName, sampleBehaviorRecords, schemaSourceLabel, schemaToForm, scriptToolName, sealToolCallPairs, signSkill, signaturePayloadBytes, stripArchiveRoot, summarizeToolCalls, textParts, toLlmToolSpec, toRecordDigests, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSpecEvent, validateUiSpecNode, verifyManifest, verifySkillSignature, xmlRenderer };
1
+ import { $ as SignatureVerdict, $t as stripArchiveRoot, A as ATOMIC_TMP_SUFFIX_PATTERN, At as checkDependencyCycles, B as MANIFEST_EXCLUDED_FILES, Bt as keyIdOf, C as UiSpecDrafts, Ct as WebSkillError, D as UiSurfaceActionRequest, Dt as atomicWriteText, E as UiSpecSnapshot, Et as assertSafePathSegment, F as DiscoveryResult, Ft as escapeXml, G as SIGNATURE_SCHEMA_VERSION, Gt as readResponseWithLimit, H as Page, Ht as normalizePath, I as FileStat, It as exportSkills, J as SKILL_NAME_MAX_LENGTH, Jt as renderCatalogJson, K as SKILLS_LOCKFILE, Kt as readSkillSignature, L as FileSystemProvider, Lt as isAtomicTempPath, M as CatalogRenderer, Mt as computeDigest, N as CryptoKeyLike, Nt as detectSkillArchiveShape, O as UiSurfaceActionResponse, Ot as buildCatalog, P as DEFAULT_ARCHIVE_LIMITS, Pt as detectSkillArchiveShapeFromFs, Q as SignatureAuditSink, Qt as signaturePayloadBytes, R as FsTrustedKeyStore, Rt as isValidSkillName, S as UiSpecActionCapability, St as VerifyResult, T as UiSpecPatch, Tt as assertRemoteUrlAllowed, U as PageQuery, Ut as parseSkillMarkdown, V as MemoryFS, Vt as messageOf, W as RemoteUrlPolicy, Wt as parseSkillPackManifest, X as SKILL_PACK_FILE, Xt as resolveInsideRoot, Y as SKILL_NAME_PATTERN, Yt as resolveArchiveLimits, Z as SKILL_SIGNATURE_FILE, Zt as signSkill, _ as MemoryStore, _t as TrustedKey, a as InteractionOrigin, at as SkillDocument, b as SkillCandidateMarker, bt as UnsignedPolicy, c as InteractionResponse, ct as SkillLocation, d as LlmContentPart, dt as SkillMetadata, en as unzipWithLimits, et as SkillArchiveDetection, f as LlmMessage, ft as SkillPackManifest, g as LlmToolSpec, gt as SkillsLockfile, h as LlmToolCall, ht as SkillSource, i as FormField, in as xmlRenderer, it as SkillDiscovery, j as ArchiveLimits, jt as checkSkillRules, k as extractSkillCandidate, kt as buildManifest, l as LlmClient, lt as SkillManagerPort, m as LlmStreamEvent, mt as SkillSignature, n as ArtifactStore, nn as verifyManifest, nt as SkillCatalog, o as InteractionPolicy, ot as SkillInstallSource, p as LlmResponse, pt as SkillReader, q as SKILL_MANIFEST_FILE, qt as renderAvailableSkillsXml, r as ChartSpec, rn as verifySkillSignature, rt as SkillCatalogEntry, s as InteractionRequest, st as SkillIssue, t as Artifact, tn as validateSkills, tt as SkillArchiveShape, u as LlmCompleteInput, ut as SkillManifest, v as RenderBlock, vt as TrustedKeyStore, w as UiSpecEvent, wt as WebSkillErrorCode, x as UiBridge, xt as ValidationReport, y as RenderResultRequest, yt as UiSpecNode, z as JsonSchema, zt as jsonRenderer } from "./types-B3n0cMZu-BDhheIhX.js";
2
+ import { $ as READ_SKILL_FILE_INPUT_SCHEMA, $n as scriptToolName, $t as TraceRecorder, A as FS_SESSION_PAGE_SIZE, An as interruptedToolResult, At as SerializingMemoryStore, B as HookRunnerOptions, Bn as normalizeToolError, Bt as SkillScriptSchemaSource, C as DEFAULT_LOOP_LIMITS, Cn as extractChartSpec, Ct as SESSION_SCHEMA_VERSION, D as ExecuteLifecycleData, Dn as formatSkillScriptManifest, Dt as SealOptions, E as EventBus, En as findUnpairedToolCalls, Et as ScriptExecutor, F as FsSessionStore, Fn as mergeProfileEntries, Ft as SkillFailureReport, G as LifecycleEventInit, Gn as readProfileEntries, Gt as TodoTraceEvent, H as IntegrityVerdict, Hn as parseUserProfileExport, Ht as SkillSuccessReport, I as FullDisclosureRouter, In as networkPolicyLibSource, It as SkillIntegrityGuard, J as LifecycleListener, Jn as renderUserProfileContext, Jt as ToolResolution, K as LifecycleHook, Kn as readUserProfile, Kt as ToolContent, L as GoogleGenAiClient, Ln as networkUrlHost, Lt as SkillOutcomeReporter, M as FsMemoryStore, Mn as isUnsupportedRunSnapshot, Mt as SessionMeta, N as FsRunSnapshotStore, Nn as listSkillScripts, Nt as SessionRecord, O as ExternalSkillProvider, On as fromVercelResult, Ot as SealRecord, P as FsRunTraceStore, Pn as mergeCatalogEntries, Pt as SessionStore, Q as ProgressiveRouter, Qn as schemaToForm, Qt as TraceEventType, R as GoogleGenAiClientConfig, Rn as normalizeErrorCode, Rt as SkillRouter, S as CapabilityMode, Sn as exportUserProfile, St as RuntimeSessionHandle, T as EMPTY_USER_PROFILE, Tn as extractUiSpecEvents, Tt as ScriptExecutionContext, U as InteractLifecycleData, Un as partsToText, Ut as TerminalLifecycleData, V as InstalledSkillManifest, Vn as parseBridgeRequest, Vt as SkillStateGuard, W as LifecycleEvent, Wn as readBehaviorRecords, Wt as TextualToolContent, X as OpenAiCompatibleClient, Xn as sampleBehaviorRecords, Xt as TraceClock, Y as NetworkPolicy, Yn as resolveToolName, Yt as ToolResult, Z as OpenAiCompatibleClientConfig, Zn as schemaSourceLabel, Zt as TraceEvent, _ as BridgeCapabilities, _n as bridgeError, _t as RunTraceStore, a as ActivateLifecycleData, an as UnsupportedRunSnapshot, ar as toVercelToolSpecs, at as RouteLifecycleData, b as BridgeResponse, bn as createWebSkillApi, bt as RuntimeRun, c as AgentLoopDeps, cn as UserProfileExport, ct as RunResult, d as ApprovalDecision, dn as VercelToolSpec, dt as RunSnapshotStore, en as USER_PROFILE_EXPORT_VERSION, er as sealToolCallPairs, et as READ_SKILL_FILE_TOOL, f as ApprovalScope, fn as WebSkillApi, ft as RunTerminationReason, g as BehaviorScene, gn as applyUserProfileImport, gt as RunTraceMetrics, h as BehaviorRecordKind, hn as appendBehaviorRecords, ht as RunTraceFilter, i as ASK_USER_TOOL_NAME, in as USER_PROFILE_REFINE_PROMPT, ir as toRecordDigests, it as RefineUserProfileInput, j as FsArtifactStore, jn as isNetworkAllowed, jt as SessionListPage, k as ExternalToolSource, kn as fromVercelStreamPart, kt as SealResult, l as AnthropicClient, ln as UserProfileImportDiff, lt as RunSnapshot, m as BehaviorRecord, mn as WebSkillRuntimeDeps, mt as RunTraceFile, n as ASK_USER_INPUT_SCHEMA, nn as USER_PROFILE_NO_INVENTION_RULE, nr as textParts, nt as RUN_SNAPSHOT_SCHEMA_VERSION, o as AgentLoop, on as UserProfile, or as validateUiSpecEvent, ot as RouteResult, p as BEHAVIOR_RECORDS_KEY, pn as WebSkillRuntime, pt as RunToolCall, q as LifecycleHookContext, qn as refineUserProfile, qt as ToolDefinition, r as ASK_USER_TOOL, rn as USER_PROFILE_PROMPT_HEADER, rr as toLlmToolSpec, rt as RUN_TRACE_SCHEMA_VERSION, s as AgentLoopConfig, sn as UserProfileEntry, sr as validateUiSpecNode, st as RunLimitErrorDetails, t as ALLOWED_TOOLS_EXCLUSION_REASON, tn as USER_PROFILE_KEY, tr as summarizeToolCalls, tt as READ_SKILL_FILE_TOOL_NAME, u as AnthropicClientConfig, un as UserProfileLimits, ut as RunSnapshotListEntry, v as BridgeCapability, vn as buildRenderResult, vt as RunTraceSummary, w as DEFAULT_USER_PROFILE_LIMITS, wn as extractTodoTraceEvents, wt as SchemaInferer, x as CapabilityApproval, xn as diffUserProfile, xt as RuntimeSession, y as BridgeRequest, yn as createScriptContext, yt as RuntimePhase, z as HookRunner, zn as normalizeToolContent, zt as SkillScriptDescriptor } from "./index-znZjobkr.js";
3
+ //#region src/version.d.ts
4
+ /** Generated by scripts/syncVersionConstant.mjs from packages/sdk/package.json. Do not edit by hand. */
5
+ /**
6
+ * Version of the published `@webskill/sdk` package, injected at build time.
7
+ * @stable
8
+ */
9
+ declare const SDK_VERSION = "0.9.0";
10
+ //#endregion
11
+ export { ALLOWED_TOOLS_EXCLUSION_REASON, ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, ATOMIC_TMP_SUFFIX_PATTERN, type ActivateLifecycleData, AgentLoop, type AgentLoopConfig, type AgentLoopDeps, AnthropicClient, type AnthropicClientConfig, type ApprovalDecision, type ApprovalScope, type ArchiveLimits, type Artifact, type ArtifactStore, BEHAVIOR_RECORDS_KEY, type BehaviorRecord, type BehaviorRecordKind, type BehaviorScene, type BridgeCapabilities, type BridgeCapability, type BridgeRequest, type BridgeResponse, CapabilityApproval, type CapabilityMode, type CatalogRenderer, type ChartSpec, type CryptoKeyLike, DEFAULT_ARCHIVE_LIMITS, DEFAULT_LOOP_LIMITS, DEFAULT_USER_PROFILE_LIMITS, type DiscoveryResult, EMPTY_USER_PROFILE, 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 InteractionOrigin, 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 RefineUserProfileInput, type RemoteUrlPolicy, type RenderBlock, type RenderResultRequest, type RouteLifecycleData, type RouteResult, type RunLimitErrorDetails, 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, SDK_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, type SchemaInferer, type ScriptExecutionContext, type ScriptExecutor, type SealOptions, type SealRecord, type SealResult, SerializingMemoryStore, type SessionListPage, type SessionMeta, type SessionRecord, type SessionStore, type SignatureAuditSink, type SignatureVerdict, type SkillArchiveDetection, type SkillArchiveShape, type SkillCandidateMarker, 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 SkillScriptDescriptor, type SkillScriptSchemaSource, type SkillSignature, type SkillSource, type SkillStateGuard, type SkillSuccessReport, type SkillsLockfile, type TerminalLifecycleData, type TextualToolContent, type TodoTraceEvent, type ToolContent, type ToolDefinition, type ToolResolution, type ToolResult, type TraceClock, type TraceEvent, type TraceEventType, TraceRecorder, type TrustedKey, type TrustedKeyStore, USER_PROFILE_EXPORT_VERSION, USER_PROFILE_KEY, USER_PROFILE_NO_INVENTION_RULE, USER_PROFILE_PROMPT_HEADER, USER_PROFILE_REFINE_PROMPT, type UiBridge, type UiSpecActionCapability, type UiSpecDrafts, type UiSpecEvent, type UiSpecNode, type UiSpecPatch, type UiSpecSnapshot, type UiSurfaceActionRequest, type UiSurfaceActionResponse, type UnsignedPolicy, type UnsupportedRunSnapshot, type UserProfile, type UserProfileEntry, type UserProfileExport, type UserProfileImportDiff, type UserProfileLimits, type ValidationReport, type VercelToolSpec, type VerifyResult, type WebSkillApi, WebSkillError, type WebSkillErrorCode, WebSkillRuntime, type WebSkillRuntimeDeps, appendBehaviorRecords, applyUserProfileImport, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, detectSkillArchiveShape, detectSkillArchiveShapeFromFs, diffUserProfile, escapeXml, exportSkills, exportUserProfile, extractChartSpec, extractSkillCandidate, extractTodoTraceEvents, extractUiSpecEvents, findUnpairedToolCalls, formatSkillScriptManifest, fromVercelResult, fromVercelStreamPart, interruptedToolResult, isAtomicTempPath, isNetworkAllowed, isUnsupportedRunSnapshot, isValidSkillName, jsonRenderer, keyIdOf, listSkillScripts, mergeCatalogEntries, mergeProfileEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, parseUserProfileExport, partsToText, readBehaviorRecords, readProfileEntries, readResponseWithLimit, readSkillSignature, readUserProfile, refineUserProfile, renderAvailableSkillsXml, renderCatalogJson, renderUserProfileContext, resolveArchiveLimits, resolveInsideRoot, resolveToolName, sampleBehaviorRecords, schemaSourceLabel, schemaToForm, scriptToolName, sealToolCallPairs, signSkill, signaturePayloadBytes, stripArchiveRoot, summarizeToolCalls, textParts, toLlmToolSpec, toRecordDigests, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSpecEvent, validateUiSpecNode, verifyManifest, verifySkillSignature, xmlRenderer };
package/dist/index.js CHANGED
@@ -1,5 +1,14 @@
1
- import { A as messageOf, B as signSkill, C as detectSkillArchiveShape, D as isValidSkillName, E as exportSkills, F as readSkillSignature, G as verifyManifest, H as stripArchiveRoot, I as renderAvailableSkillsXml, K as verifySkillSignature, L as renderCatalogJson, M as parseSkillMarkdown, N as parseSkillPackManifest, O as jsonRenderer, P as readResponseWithLimit, R as resolveArchiveLimits, S as computeDigest, T as escapeXml, U as unzipWithLimits, V as signaturePayloadBytes, W as validateSkills, _ 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 normalizePath, k as keyIdOf, l as SKILL_NAME_PATTERN, m as WebSkillError, n as FsTrustedKeyStore, o as SKILLS_LOCKFILE, p as SkillReader, q as xmlRenderer, 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 detectSkillArchiveShapeFromFs, x as checkSkillRules, y as buildManifest, z as resolveInsideRoot } from "./dist-59XlqDuv.js";
2
- import { a as textParts, n as partsToText } from "./memoryArtifactStore-52Zn9npI-upv5OWYf.js";
3
- import { $ as fromVercelStreamPart, A as SerializingMemoryStore, B as bridgeError, C as ProgressiveRouter, Ct as sealToolCallPairs, D as RUN_SNAPSHOT_SCHEMA_VERSION, Dt as toVercelToolSpecs, E as READ_SKILL_FILE_TOOL_NAME, Et as toRecordDigests, F as USER_PROFILE_PROMPT_HEADER, G as exportUserProfile, H as createScriptContext, I as USER_PROFILE_REFINE_PROMPT, J as extractTodoTraceEvents, K as extractChartSpec, L as WebSkillRuntime, M as USER_PROFILE_EXPORT_VERSION, N as USER_PROFILE_KEY, O as RUN_TRACE_SCHEMA_VERSION, Ot as validateUiSpecEvent, P as USER_PROFILE_NO_INVENTION_RULE, Q as fromVercelResult, R as appendBehaviorRecords, S as OpenAiCompatibleClient, St as scriptToolName, T as READ_SKILL_FILE_TOOL, Tt as toLlmToolSpec, U as createWebSkillApi, V as buildRenderResult, W as diffUserProfile, X as findUnpairedToolCalls, Y as extractUiSpecEvents, Z as formatSkillScriptManifest, _ as FsRunTraceStore, _t as renderUserProfileContext, a as AgentLoop, at as mergeProfileEntries, b as GoogleGenAiClient, bt as schemaSourceLabel, c as CapabilityApproval, ct as normalizeErrorCode, d as EMPTY_USER_PROFILE, dt as parseBridgeRequest, et as interruptedToolResult, f as EventBus, ft as parseUserProfileExport, g as FsRunSnapshotStore, gt as refineUserProfile, h as FsMemoryStore, ht as readUserProfile, i as ASK_USER_TOOL_NAME, it as mergeCatalogEntries, j as TraceRecorder, k as SESSION_SCHEMA_VERSION, kt as validateUiSpecNode, l as DEFAULT_LOOP_LIMITS, lt as normalizeToolContent, m as FsArtifactStore, mt as readProfileEntries, n as ASK_USER_INPUT_SCHEMA, nt as isUnsupportedRunSnapshot, o as AnthropicClient, ot as networkPolicyLibSource, p as FS_SESSION_PAGE_SIZE, pt as readBehaviorRecords, q as extractSkillCandidate, r as ASK_USER_TOOL, rt as listSkillScripts, s as BEHAVIOR_RECORDS_KEY, st as networkUrlHost, t as ALLOWED_TOOLS_EXCLUSION_REASON, tt as isNetworkAllowed, u as DEFAULT_USER_PROFILE_LIMITS, ut as normalizeToolError, v as FsSessionStore, vt as resolveToolName, w as READ_SKILL_FILE_INPUT_SCHEMA, wt as summarizeToolCalls, x as HookRunner, xt as schemaToForm, y as FullDisclosureRouter, yt as sampleBehaviorRecords, z as applyUserProfileImport } from "./dist-DmI5SBBF.js";
1
+ import { A as jsonRenderer, B as resolveArchiveLimits, C as computeDigest, D as exportSkills, E as escapeXml, F as parseSkillPackManifest, G as unzipWithLimits, H as signSkill, I as readResponseWithLimit, J as verifySkillSignature, K as validateSkills, L as readSkillSignature, M as messageOf, N as normalizePath, O as isAtomicTempPath, P as parseSkillMarkdown, R as renderAvailableSkillsXml, S as checkSkillRules, T as detectSkillArchiveShapeFromFs, U as signaturePayloadBytes, V as resolveInsideRoot, W as stripArchiveRoot, Y as xmlRenderer, _ as assertSafePathSegment, a as MemoryFS, b as buildManifest, c as SKILL_MANIFEST_FILE, d as SKILL_PACK_FILE, f as SKILL_SIGNATURE_FILE, g as assertRemoteUrlAllowed, h as WebSkillError, i as MANIFEST_EXCLUDED_FILES, j as keyIdOf, k as isValidSkillName, l as SKILL_NAME_MAX_LENGTH, m as SkillReader, n as DEFAULT_ARCHIVE_LIMITS, o as SIGNATURE_SCHEMA_VERSION, p as SkillDiscovery, q as verifyManifest, r as FsTrustedKeyStore, s as SKILLS_LOCKFILE, t as ATOMIC_TMP_SUFFIX_PATTERN, u as SKILL_NAME_PATTERN, v as atomicWriteText, w as detectSkillArchiveShape, x as checkDependencyCycles, y as buildCatalog, z as renderCatalogJson } from "./dist-Bev6i6Ip.js";
2
+ import { a as textParts, n as partsToText } from "./memoryArtifactStore-52Zn9npI-LbCQaqyx.js";
3
+ import { $ as fromVercelStreamPart, A as SerializingMemoryStore, B as bridgeError, C as ProgressiveRouter, Ct as sealToolCallPairs, D as RUN_SNAPSHOT_SCHEMA_VERSION, Dt as toVercelToolSpecs, E as READ_SKILL_FILE_TOOL_NAME, Et as toRecordDigests, F as USER_PROFILE_PROMPT_HEADER, G as exportUserProfile, H as createScriptContext, I as USER_PROFILE_REFINE_PROMPT, J as extractTodoTraceEvents, K as extractChartSpec, L as WebSkillRuntime, M as USER_PROFILE_EXPORT_VERSION, N as USER_PROFILE_KEY, O as RUN_TRACE_SCHEMA_VERSION, Ot as validateUiSpecEvent, P as USER_PROFILE_NO_INVENTION_RULE, Q as fromVercelResult, R as appendBehaviorRecords, S as OpenAiCompatibleClient, St as scriptToolName, T as READ_SKILL_FILE_TOOL, Tt as toLlmToolSpec, U as createWebSkillApi, V as buildRenderResult, W as diffUserProfile, X as findUnpairedToolCalls, Y as extractUiSpecEvents, Z as formatSkillScriptManifest, _ as FsRunTraceStore, _t as renderUserProfileContext, a as AgentLoop, at as mergeProfileEntries, b as GoogleGenAiClient, bt as schemaSourceLabel, c as CapabilityApproval, ct as normalizeErrorCode, d as EMPTY_USER_PROFILE, dt as parseBridgeRequest, et as interruptedToolResult, f as EventBus, ft as parseUserProfileExport, g as FsRunSnapshotStore, gt as refineUserProfile, h as FsMemoryStore, ht as readUserProfile, i as ASK_USER_TOOL_NAME, it as mergeCatalogEntries, j as TraceRecorder, k as SESSION_SCHEMA_VERSION, kt as validateUiSpecNode, l as DEFAULT_LOOP_LIMITS, lt as normalizeToolContent, m as FsArtifactStore, mt as readProfileEntries, n as ASK_USER_INPUT_SCHEMA, nt as isUnsupportedRunSnapshot, o as AnthropicClient, ot as networkPolicyLibSource, p as FS_SESSION_PAGE_SIZE, pt as readBehaviorRecords, q as extractSkillCandidate, r as ASK_USER_TOOL, rt as listSkillScripts, s as BEHAVIOR_RECORDS_KEY, st as networkUrlHost, t as ALLOWED_TOOLS_EXCLUSION_REASON, tt as isNetworkAllowed, u as DEFAULT_USER_PROFILE_LIMITS, ut as normalizeToolError, v as FsSessionStore, vt as resolveToolName, w as READ_SKILL_FILE_INPUT_SCHEMA, wt as summarizeToolCalls, x as HookRunner, xt as schemaToForm, y as FullDisclosureRouter, yt as sampleBehaviorRecords, z as applyUserProfileImport } from "./dist-CFmkV45C.js";
4
4
 
5
- export { ALLOWED_TOOLS_EXCLUSION_REASON, ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, AgentLoop, AnthropicClient, BEHAVIOR_RECORDS_KEY, CapabilityApproval, DEFAULT_ARCHIVE_LIMITS, DEFAULT_LOOP_LIMITS, DEFAULT_USER_PROFILE_LIMITS, EMPTY_USER_PROFILE, 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, USER_PROFILE_EXPORT_VERSION, USER_PROFILE_KEY, USER_PROFILE_NO_INVENTION_RULE, USER_PROFILE_PROMPT_HEADER, USER_PROFILE_REFINE_PROMPT, WebSkillError, WebSkillRuntime, appendBehaviorRecords, applyUserProfileImport, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, detectSkillArchiveShape, detectSkillArchiveShapeFromFs, diffUserProfile, escapeXml, exportSkills, exportUserProfile, extractChartSpec, extractSkillCandidate, extractTodoTraceEvents, extractUiSpecEvents, findUnpairedToolCalls, formatSkillScriptManifest, fromVercelResult, fromVercelStreamPart, interruptedToolResult, isNetworkAllowed, isUnsupportedRunSnapshot, isValidSkillName, jsonRenderer, keyIdOf, listSkillScripts, mergeCatalogEntries, mergeProfileEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, parseUserProfileExport, partsToText, readBehaviorRecords, readProfileEntries, readResponseWithLimit, readSkillSignature, readUserProfile, refineUserProfile, renderAvailableSkillsXml, renderCatalogJson, renderUserProfileContext, resolveArchiveLimits, resolveInsideRoot, resolveToolName, sampleBehaviorRecords, schemaSourceLabel, schemaToForm, scriptToolName, sealToolCallPairs, signSkill, signaturePayloadBytes, stripArchiveRoot, summarizeToolCalls, textParts, toLlmToolSpec, toRecordDigests, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSpecEvent, validateUiSpecNode, verifyManifest, verifySkillSignature, xmlRenderer };
5
+ //#region src/version.ts
6
+ /** Generated by scripts/syncVersionConstant.mjs from packages/sdk/package.json. Do not edit by hand. */
7
+ /**
8
+ * Version of the published `@webskill/sdk` package, injected at build time.
9
+ * @stable
10
+ */
11
+ const SDK_VERSION = "0.9.0";
12
+
13
+ //#endregion
14
+ export { ALLOWED_TOOLS_EXCLUSION_REASON, ASK_USER_INPUT_SCHEMA, ASK_USER_TOOL, ASK_USER_TOOL_NAME, ATOMIC_TMP_SUFFIX_PATTERN, AgentLoop, AnthropicClient, BEHAVIOR_RECORDS_KEY, CapabilityApproval, DEFAULT_ARCHIVE_LIMITS, DEFAULT_LOOP_LIMITS, DEFAULT_USER_PROFILE_LIMITS, EMPTY_USER_PROFILE, 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, SDK_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, USER_PROFILE_EXPORT_VERSION, USER_PROFILE_KEY, USER_PROFILE_NO_INVENTION_RULE, USER_PROFILE_PROMPT_HEADER, USER_PROFILE_REFINE_PROMPT, WebSkillError, WebSkillRuntime, appendBehaviorRecords, applyUserProfileImport, assertRemoteUrlAllowed, assertSafePathSegment, atomicWriteText, bridgeError, buildCatalog, buildManifest, buildRenderResult, checkDependencyCycles, checkSkillRules, computeDigest, createScriptContext, createWebSkillApi, detectSkillArchiveShape, detectSkillArchiveShapeFromFs, diffUserProfile, escapeXml, exportSkills, exportUserProfile, extractChartSpec, extractSkillCandidate, extractTodoTraceEvents, extractUiSpecEvents, findUnpairedToolCalls, formatSkillScriptManifest, fromVercelResult, fromVercelStreamPart, interruptedToolResult, isAtomicTempPath, isNetworkAllowed, isUnsupportedRunSnapshot, isValidSkillName, jsonRenderer, keyIdOf, listSkillScripts, mergeCatalogEntries, mergeProfileEntries, messageOf, networkPolicyLibSource, networkUrlHost, normalizeErrorCode, normalizePath, normalizeToolContent, normalizeToolError, parseBridgeRequest, parseSkillMarkdown, parseSkillPackManifest, parseUserProfileExport, partsToText, readBehaviorRecords, readProfileEntries, readResponseWithLimit, readSkillSignature, readUserProfile, refineUserProfile, renderAvailableSkillsXml, renderCatalogJson, renderUserProfileContext, resolveArchiveLimits, resolveInsideRoot, resolveToolName, sampleBehaviorRecords, schemaSourceLabel, schemaToForm, scriptToolName, sealToolCallPairs, signSkill, signaturePayloadBytes, stripArchiveRoot, summarizeToolCalls, textParts, toLlmToolSpec, toRecordDigests, toVercelToolSpecs, unzipWithLimits, validateSkills, validateUiSpecEvent, validateUiSpecNode, verifyManifest, verifySkillSignature, xmlRenderer };
package/dist/mcp.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as JsonSchema, g as LlmToolSpec, it as SkillDocument, nt as SkillCatalogEntry } from "./types-B3n0cMZu-BdcqQ35O.js";
2
- import { O as ExternalSkillProvider, Pn as mergeCatalogEntries, Yt as ToolResult, k as ExternalToolSource } from "./index-K-eewlGL.js";
1
+ import { at as SkillDocument, g as LlmToolSpec, rt as SkillCatalogEntry, z as JsonSchema } from "./types-B3n0cMZu-BDhheIhX.js";
2
+ import { O as ExternalSkillProvider, Pn as mergeCatalogEntries, Yt as ToolResult, k as ExternalToolSource } from "./index-znZjobkr.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";
@@ -244,6 +244,11 @@ declare class ExperimentalWebMcpAdapter {
244
244
  constructor(api?: BrowserModelContextLike | (() => BrowserModelContextLike | undefined), options?: {
245
245
  enabled?: boolean;
246
246
  });
247
+ /**
248
+ * 宿主能力检测(FR-19.2/19.4):**只**看 `document.modelContext.executeTool` 是否存在,
249
+ * 不含 `enabled` 状态——「未启用」不等于「浏览器不支持」,两者必须可区分。
250
+ * 是否对 LLM 列出工具由 `isEnabled()` 单独把关(McpRuntimePlugin 读它,见测试)。
251
+ */
247
252
  isAvailable(): boolean;
248
253
  isEnabled(): boolean;
249
254
  /**
package/dist/mcp.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A as messageOf, h as assertRemoteUrlAllowed, m as WebSkillError } from "./dist-59XlqDuv.js";
2
- import { it as mergeCatalogEntries, lt as normalizeToolContent } from "./dist-DmI5SBBF.js";
1
+ import { M as messageOf, g as assertRemoteUrlAllowed, h as WebSkillError } from "./dist-Bev6i6Ip.js";
2
+ import { it as mergeCatalogEntries, lt as normalizeToolContent } from "./dist-CFmkV45C.js";
3
3
 
4
4
  //#region ../mcp/dist/index.js
5
5
  /**
@@ -441,9 +441,13 @@ var ExperimentalWebMcpAdapter = class {
441
441
  this.#resolveApi = typeof api === "function" ? api : () => api;
442
442
  this.#enabled = options?.enabled ?? false;
443
443
  }
444
+ /**
445
+ * 宿主能力检测(FR-19.2/19.4):**只**看 `document.modelContext.executeTool` 是否存在,
446
+ * 不含 `enabled` 状态——「未启用」不等于「浏览器不支持」,两者必须可区分。
447
+ * 是否对 LLM 列出工具由 `isEnabled()` 单独把关(McpRuntimePlugin 读它,见测试)。
448
+ */
444
449
  isAvailable() {
445
- const api = this.#resolveApi();
446
- return this.#enabled && typeof api?.executeTool === "function";
450
+ return typeof this.#resolveApi()?.executeTool === "function";
447
451
  }
448
452
  isEnabled() {
449
453
  return this.#enabled;
@@ -533,7 +537,7 @@ var McpRuntimePlugin = class {
533
537
  } catch (e) {
534
538
  this.#onWarning(`[webskill] MCP endpoint "${endpoint}" is unavailable; its tools are omitted from this turn: ${e instanceof Error ? e.message : String(e)}`);
535
539
  }
536
- if (this.#webMcp?.isAvailable()) {
540
+ if (this.#webMcp?.isEnabled()) {
537
541
  const tools = await this.#webMcp.listTools();
538
542
  for (const tool of tools ?? []) specs.push({
539
543
  name: webMcpToolLlmName(tool.name),
@@ -1,4 +1,4 @@
1
- import { m as WebSkillError } from "./dist-59XlqDuv.js";
1
+ import { h as WebSkillError } from "./dist-Bev6i6Ip.js";
2
2
 
3
3
  //#region ../runtime/dist/memoryArtifactStore-52Zn9npI.js
4
4
  /** 纯文本消息内容的构造快捷方式(引擎内部绝大多数消息仍是纯文本) */
package/dist/node.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { A as ArchiveLimits, F as FileStat, G as SKILLS_LOCKFILE, I as FileSystemProvider, K as SKILL_MANIFEST_FILE, R as JsonSchema, Z as SignatureAuditSink, _t as TrustedKeyStore, at as SkillInstallSource, c as InteractionResponse, ct as SkillManagerPort, ht as SkillsLockfile, lt as SkillManifest, s as InteractionRequest, x as UiBridge, xt as VerifyResult, y as RenderResultRequest, yt as UnsignedPolicy } from "./types-B3n0cMZu-BdcqQ35O.js";
2
- import { Et as ScriptExecutor, M as FsMemoryStore, Tt as ScriptExecutionContext, Y as NetworkPolicy, Yt as ToolResult, _ as BridgeCapabilities, f as ApprovalScope, j as FsArtifactStore, mn as WebSkillRuntimeDeps, pn as WebSkillRuntime, qt as ToolDefinition, wt as SchemaInferer, yn as createScriptContext } from "./index-K-eewlGL.js";
3
- import { a as AuditLog, p as CandidateStore, r as ApprovalPolicy, u as CandidateSkill, v as SkillVersionStore } from "./skillVersionStore-Bl-ElD45-gRfSaAby.js";
1
+ import { I as FileStat, K as SKILLS_LOCKFILE, L as FileSystemProvider, Q as SignatureAuditSink, St as VerifyResult, bt as UnsignedPolicy, c as InteractionResponse, gt as SkillsLockfile, j as ArchiveLimits, lt as SkillManagerPort, ot as SkillInstallSource, q as SKILL_MANIFEST_FILE, s as InteractionRequest, ut as SkillManifest, vt as TrustedKeyStore, x as UiBridge, y as RenderResultRequest, z as JsonSchema } from "./types-B3n0cMZu-BDhheIhX.js";
2
+ import { Et as ScriptExecutor, M as FsMemoryStore, Tt as ScriptExecutionContext, Y as NetworkPolicy, Yt as ToolResult, _ as BridgeCapabilities, f as ApprovalScope, j as FsArtifactStore, mn as WebSkillRuntimeDeps, pn as WebSkillRuntime, qt as ToolDefinition, wt as SchemaInferer, yn as createScriptContext } from "./index-znZjobkr.js";
3
+ import { a as AuditLog, p as CandidateStore, r as ApprovalPolicy, u as CandidateSkill, v as SkillVersionStore } from "./skillVersionStore-Bl-ElD45-dMJ8Ybhb.js";
4
4
  import { n as LlmEnvConfig, s as probeLlmCapabilities, t as LlmCapabilities } from "./env-AK3cSMEA-Dli6QU5E.js";
5
5
  import { Readable, Writable } from "node:stream";
6
6
  //#region ../node/dist/index.d.ts
package/dist/node.js CHANGED
@@ -1,7 +1,7 @@
1
- import { A as messageOf, D as isValidSkillName, E as exportSkills, F as readSkillSignature, G as verifyManifest, K as verifySkillSignature, M as parseSkillMarkdown, N as parseSkillPackManifest, P as readResponseWithLimit, R as resolveArchiveLimits, U as unzipWithLimits, W as validateSkills, _ as atomicWriteText, g as assertSafePathSegment, h as assertRemoteUrlAllowed, m as WebSkillError, o as SKILLS_LOCKFILE, r as MANIFEST_EXCLUDED_FILES, s as SKILL_MANIFEST_FILE, u as SKILL_PACK_FILE, y as buildManifest, z as resolveInsideRoot } from "./dist-59XlqDuv.js";
2
- import { B as bridgeError, H as createScriptContext, L as WebSkillRuntime, c as CapabilityApproval, dt as parseBridgeRequest, h as FsMemoryStore, lt as normalizeToolContent, m as FsArtifactStore, ot as networkPolicyLibSource, ut as normalizeToolError } from "./dist-DmI5SBBF.js";
1
+ import { B as resolveArchiveLimits, D as exportSkills, F as parseSkillPackManifest, G as unzipWithLimits, I as readResponseWithLimit, J as verifySkillSignature, K as validateSkills, L as readSkillSignature, M as messageOf, O as isAtomicTempPath, P as parseSkillMarkdown, V as resolveInsideRoot, _ as assertSafePathSegment, b as buildManifest, c as SKILL_MANIFEST_FILE, d as SKILL_PACK_FILE, g as assertRemoteUrlAllowed, h as WebSkillError, i as MANIFEST_EXCLUDED_FILES, k as isValidSkillName, q as verifyManifest, s as SKILLS_LOCKFILE, v as atomicWriteText } from "./dist-Bev6i6Ip.js";
2
+ import { B as bridgeError, H as createScriptContext, L as WebSkillRuntime, c as CapabilityApproval, dt as parseBridgeRequest, h as FsMemoryStore, lt as normalizeToolContent, m as FsArtifactStore, ot as networkPolicyLibSource, ut as normalizeToolError } from "./dist-CFmkV45C.js";
3
3
  import { i as probeLlmCapabilities } from "./env-8cY40DXB-CGnEVZby.js";
4
- import { t as AUDIT_EVENT_TYPES } from "./eventTypes-g1BXL6x5-CibcOftR.js";
4
+ import { t as AUDIT_EVENT_TYPES } from "./eventTypes-DbOpAECr-BjcjZVms.js";
5
5
  import { createRequire } from "node:module";
6
6
  import { unzipSync, zipSync } from "fflate";
7
7
  import { existsSync, promises, realpathSync } from "node:fs";
@@ -1274,14 +1274,14 @@ async function extractTarFile(archivePath, destRoot, limits) {
1274
1274
  throw new WebSkillError("INSTALL_FAILED", `Failed to extract tar archive: ${messageOf(e)}`, e);
1275
1275
  }
1276
1276
  }
1277
- /** 递归列出目录内全部文件(相对路径,posix 分隔,不含目录条目) */
1277
+ /** 递归列出目录内全部文件(相对路径,posix 分隔,不含目录条目;原子写中断残留的 `.tmp-*` 不计入) */
1278
1278
  async function listFiles(fs, root, prefix = "") {
1279
1279
  const out = [];
1280
1280
  for (const entry of await fs.list(root)) {
1281
1281
  const name = entry.path.split("/").pop() ?? "";
1282
1282
  const rel = prefix === "" ? name : `${prefix}/${name}`;
1283
1283
  if (entry.type === "directory") out.push(...await listFiles(fs, entry.path, rel));
1284
- else out.push(rel);
1284
+ else if (!isAtomicTempPath(name)) out.push(rel);
1285
1285
  }
1286
1286
  return out;
1287
1287
  }
@@ -2238,7 +2238,7 @@ var ApprovalWorkflow = class {
2238
2238
  const stagingRoot = (await mkdtemp(path.join(tmpdir(), "webskill-candidate-"))).split(path.sep).join("/");
2239
2239
  try {
2240
2240
  const skillDir = `${stagingRoot}/${candidate.name}`;
2241
- for (const file of candidate.files) await this.#fs.writeText(resolveInsideRoot(skillDir, file.path), file.content);
2241
+ for (const file of candidate.files) await atomicWriteText(this.#fs, resolveInsideRoot(skillDir, file.path), file.content);
2242
2242
  const report = await validateSkills(this.#fs, [stagingRoot]);
2243
2243
  if (!report.ok) {
2244
2244
  const errors = report.issues.filter((i) => i.severity === "error");
@@ -1,5 +1,5 @@
1
- import { ft as uiCatalog } from "./dist-CJqQsIm9.js";
2
- import { t as CatalogNode } from "./catalogComponents-DfxxfUvn-D55Gbb2l.js";
1
+ import { ft as uiCatalog } from "./dist-BQe1uglQ.js";
2
+ import { t as CatalogNode } from "./catalogComponents-DfxxfUvn-T7Ic8QFV.js";
3
3
  import { z } from "zod";
4
4
  import { Component, Fragment, createContext, useCallback, useContext, useEffect, useInsertionEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";