skill-creator 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README-zh.md +298 -0
  3. package/README.md +108 -112
  4. package/dist/cli.js +723 -320
  5. package/dist/cli.js.map +4 -4
  6. package/dist/daemon.js +637 -147
  7. package/dist/daemon.js.map +4 -4
  8. package/dist/package.json +1 -1
  9. package/dist/webui/_app/immutable/assets/0.BfQ9GZ7H.css +2 -0
  10. package/dist/webui/_app/immutable/chunks/{B0pe_B_o.js → 9b6xLvUw.js} +1 -1
  11. package/dist/webui/_app/immutable/chunks/{FuwccWbx.js → B0yogbIO.js} +1 -1
  12. package/dist/webui/_app/immutable/chunks/BDe0K-12.js +1 -0
  13. package/dist/webui/_app/immutable/chunks/{BoMQFGOq.js → BKjuWHgW.js} +4 -4
  14. package/dist/webui/_app/immutable/chunks/{r1y9r7sj.js → Bos6D7ir.js} +1 -1
  15. package/dist/webui/_app/immutable/chunks/{D-Jy42mM.js → CY3MARMs.js} +1 -1
  16. package/dist/webui/_app/immutable/chunks/D-ihBChi.js +1 -0
  17. package/dist/webui/_app/immutable/chunks/{BQ8kO0xi.js → D7i1h2eW.js} +2 -2
  18. package/dist/webui/_app/immutable/chunks/{JcDjicYT.js → DFDHkP9N.js} +1 -1
  19. package/dist/webui/_app/immutable/chunks/{CGrKeCdk.js → DFdxGYRu.js} +1 -1
  20. package/dist/webui/_app/immutable/chunks/{DPrjly2t.js → Dbn_qXWm.js} +1 -1
  21. package/dist/webui/_app/immutable/chunks/{CsaIfA9E.js → K56ab8zF.js} +1 -1
  22. package/dist/webui/_app/immutable/chunks/{COoMyR0G.js → NO3Cfsmo.js} +1 -1
  23. package/dist/webui/_app/immutable/chunks/{gkPAnPzC.js → QU8DIUJz.js} +1 -1
  24. package/dist/webui/_app/immutable/chunks/{Bg2k7op5.js → UsOmL8ol.js} +1 -1
  25. package/dist/webui/_app/immutable/chunks/{CqzSRtkf.js → hrRIAQd7.js} +1 -1
  26. package/dist/webui/_app/immutable/entry/{app.BisiObvX.js → app.CkIQoKd-.js} +2 -2
  27. package/dist/webui/_app/immutable/entry/start.DG-jtr9O.js +1 -0
  28. package/dist/webui/_app/immutable/nodes/0.DY8kli0K.js +234 -0
  29. package/dist/webui/_app/immutable/nodes/{1.BUJKZ337.js → 1.DxOotYUD.js} +1 -1
  30. package/dist/webui/_app/immutable/nodes/{2.Db-aM2Oa.js → 2.BhwY9m4H.js} +1 -1
  31. package/dist/webui/_app/version.json +1 -1
  32. package/dist/webui/index.html +15 -15
  33. package/package.json +26 -23
  34. package/dist/webui/_app/immutable/assets/0.0XN00VKF.css +0 -2
  35. package/dist/webui/_app/immutable/chunks/BZ2Jwl6O.js +0 -1
  36. package/dist/webui/_app/immutable/chunks/O2CEZ91h.js +0 -1
  37. package/dist/webui/_app/immutable/entry/start.uEYh5tXy.js +0 -1
  38. package/dist/webui/_app/immutable/nodes/0.C8yGM2gr.js +0 -231
package/dist/cli.js CHANGED
@@ -817,6 +817,11 @@ import { readFile as readFile2, readdir, realpath, stat } from "node:fs/promises
817
817
  import { createRequire as createRequire2 } from "node:module";
818
818
  import os3 from "node:os";
819
819
  import path6 from "node:path";
820
+ function isTextualFileName(name) {
821
+ return /\.(txt|md|markdown|json|ya?ml|toml|csv|tsv|log|patch|diff|ts|tsx|js|jsx|py|rs|go|java|c|h|cpp|sh|css|html|xml|ini|env)$/i.test(
822
+ name
823
+ );
824
+ }
820
825
  function toDomainError(error, what, target) {
821
826
  const code = error?.code;
822
827
  if (code === "ENOENT" || code === "ENOTDIR") {
@@ -1084,7 +1089,29 @@ function createAgentFilesService(deps = {}) {
1084
1089
  }
1085
1090
  return { images, files };
1086
1091
  }
1087
- return { pickFiles, list: list2, preview: preview2, resolvePromptAttachments };
1092
+ async function resolvePromptReferences(input) {
1093
+ const blocks = [];
1094
+ for (const reference of input.references) {
1095
+ const { real, size } = await canonicalRegularFile(reference.path, "reference");
1096
+ if (size > PROMPT_FILE_MAX_BYTES) {
1097
+ throw new DomainError(
1098
+ "INVALID_OPERATION",
1099
+ `"${path6.basename(real)}" exceeds the 512KiB limit.`
1100
+ );
1101
+ }
1102
+ if (!isTextualFileName(path6.basename(real))) {
1103
+ throw new DomainError(
1104
+ "INVALID_OPERATION",
1105
+ `"${path6.basename(real)}" is not a textual file; attach it instead.`
1106
+ );
1107
+ }
1108
+ const text = await readFile2(real, "utf8");
1109
+ blocks.push(`[reference: ${real}]
1110
+ ${text.slice(0, 2e5)}`);
1111
+ }
1112
+ return blocks;
1113
+ }
1114
+ return { pickFiles, list: list2, preview: preview2, resolvePromptAttachments, resolvePromptReferences };
1088
1115
  }
1089
1116
  var LIST_ENTRY_LIMIT, PREVIEW_IMAGE_MAX_BYTES, PREVIEW_TEXT_MAX_BYTES, PREVIEW_TEXT_HEAD_BYTES, PROMPT_IMAGE_MAX_BYTES, PROMPT_FILE_MAX_BYTES, PICKER_CHILD_CODE, PICKER_TIMEOUT_MS, PICKER_STDOUT_LIMIT, cachedRfdEntry;
1090
1117
  var init_agent_files = __esm({
@@ -3142,28 +3169,28 @@ var init_create_prompt_CIJV_96B = __esm({
3142
3169
  b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
3143
3170
  const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
3144
3171
  const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
3145
- const z25 = r * 0.0193 + g * 0.1192 + b * 0.9505;
3172
+ const z27 = r * 0.0193 + g * 0.1192 + b * 0.9505;
3146
3173
  return [
3147
3174
  x * 100,
3148
3175
  y * 100,
3149
- z25 * 100
3176
+ z27 * 100
3150
3177
  ];
3151
3178
  };
3152
3179
  convert$1.rgb.lab = function(rgb) {
3153
3180
  const xyz = convert$1.rgb.xyz(rgb);
3154
3181
  let x = xyz[0];
3155
3182
  let y = xyz[1];
3156
- let z25 = xyz[2];
3183
+ let z27 = xyz[2];
3157
3184
  x /= 95.047;
3158
3185
  y /= 100;
3159
- z25 /= 108.883;
3186
+ z27 /= 108.883;
3160
3187
  x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
3161
3188
  y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
3162
- z25 = z25 > 8856e-6 ? z25 ** (1 / 3) : 7.787 * z25 + 16 / 116;
3189
+ z27 = z27 > 8856e-6 ? z27 ** (1 / 3) : 7.787 * z27 + 16 / 116;
3163
3190
  return [
3164
3191
  116 * y - 16,
3165
3192
  500 * (x - y),
3166
- 200 * (y - z25)
3193
+ 200 * (y - z27)
3167
3194
  ];
3168
3195
  };
3169
3196
  convert$1.hsl.rgb = function(hsl) {
@@ -3360,13 +3387,13 @@ var init_create_prompt_CIJV_96B = __esm({
3360
3387
  convert$1.xyz.rgb = function(xyz) {
3361
3388
  const x = xyz[0] / 100;
3362
3389
  const y = xyz[1] / 100;
3363
- const z25 = xyz[2] / 100;
3390
+ const z27 = xyz[2] / 100;
3364
3391
  let r;
3365
3392
  let g;
3366
3393
  let b;
3367
- r = x * 3.2406 + y * -1.5372 + z25 * -0.4986;
3368
- g = x * -0.9689 + y * 1.8758 + z25 * 0.0415;
3369
- b = x * 0.0557 + y * -0.204 + z25 * 1.057;
3394
+ r = x * 3.2406 + y * -1.5372 + z27 * -0.4986;
3395
+ g = x * -0.9689 + y * 1.8758 + z27 * 0.0415;
3396
+ b = x * 0.0557 + y * -0.204 + z27 * 1.057;
3370
3397
  r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
3371
3398
  g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
3372
3399
  b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
@@ -3382,17 +3409,17 @@ var init_create_prompt_CIJV_96B = __esm({
3382
3409
  convert$1.xyz.lab = function(xyz) {
3383
3410
  let x = xyz[0];
3384
3411
  let y = xyz[1];
3385
- let z25 = xyz[2];
3412
+ let z27 = xyz[2];
3386
3413
  x /= 95.047;
3387
3414
  y /= 100;
3388
- z25 /= 108.883;
3415
+ z27 /= 108.883;
3389
3416
  x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
3390
3417
  y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
3391
- z25 = z25 > 8856e-6 ? z25 ** (1 / 3) : 7.787 * z25 + 16 / 116;
3418
+ z27 = z27 > 8856e-6 ? z27 ** (1 / 3) : 7.787 * z27 + 16 / 116;
3392
3419
  return [
3393
3420
  116 * y - 16,
3394
3421
  500 * (x - y),
3395
- 200 * (y - z25)
3422
+ 200 * (y - z27)
3396
3423
  ];
3397
3424
  };
3398
3425
  convert$1.lab.xyz = function(lab) {
@@ -3401,23 +3428,23 @@ var init_create_prompt_CIJV_96B = __esm({
3401
3428
  const b = lab[2];
3402
3429
  let x;
3403
3430
  let y;
3404
- let z25;
3431
+ let z27;
3405
3432
  y = (l + 16) / 116;
3406
3433
  x = a / 500 + y;
3407
- z25 = y - b / 200;
3434
+ z27 = y - b / 200;
3408
3435
  const y2 = y ** 3;
3409
3436
  const x2 = x ** 3;
3410
- const z26 = z25 ** 3;
3437
+ const z28 = z27 ** 3;
3411
3438
  y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
3412
3439
  x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
3413
- z25 = z26 > 8856e-6 ? z26 : (z25 - 16 / 116) / 7.787;
3440
+ z27 = z28 > 8856e-6 ? z28 : (z27 - 16 / 116) / 7.787;
3414
3441
  x *= 95.047;
3415
3442
  y *= 100;
3416
- z25 *= 108.883;
3443
+ z27 *= 108.883;
3417
3444
  return [
3418
3445
  x,
3419
3446
  y,
3420
- z25
3447
+ z27
3421
3448
  ];
3422
3449
  };
3423
3450
  convert$1.lab.lch = function(lab) {
@@ -42289,7 +42316,7 @@ var DSH_AUDITED_COMMIT, DshCompositionRowSchema, DshCapabilityMatrixSchema, DshU
42289
42316
  var init_dsh_runtime = __esm({
42290
42317
  "src/shared/contracts/dsh-runtime.ts"() {
42291
42318
  "use strict";
42292
- DSH_AUDITED_COMMIT = "d347e703908d0406b7a7ef80e3a0e594d86b2215";
42319
+ DSH_AUDITED_COMMIT = "0a15e36e7f82b6ed45af6fa9759f29b40dcd965d";
42293
42320
  DshCompositionRowSchema = z15.object({
42294
42321
  packageName: z15.string().min(1),
42295
42322
  lockedVersion: z15.string().min(1),
@@ -42567,7 +42594,10 @@ var init_dsh_runtime = __esm({
42567
42594
  "todo-snapshot",
42568
42595
  /** 自动压缩标记(daemon 在 turn-end 后按 inputTokens + maxOutputTokens ≥
42569
42596
  * contextWindow 阈值自动执行 compact;text = 触发说明,UI 以居中注记渲染)。 */
42570
- "auto-compact"
42597
+ "auto-compact",
42598
+ /** 子代理目录(父会话 subagent/catalog 事件投影;payload = {childId, mode,
42599
+ * label}——角色 spawn 的可见性帧,settlement 经 user-text 回流)。 */
42600
+ "subagent"
42571
42601
  ]);
42572
42602
  DshSessionStreamFrameSchema = z15.object({
42573
42603
  /** 进程内单调序号(投影视角排序用,非持久协议)。 */
@@ -45703,14 +45733,16 @@ var init_dsh_route_connection = __esm({
45703
45733
  });
45704
45734
 
45705
45735
  // src/daemon/dsh-host-lifecycle.ts
45736
+ import { join as join2 } from "node:path";
45706
45737
  function resolveDefaultDshHome() {
45707
45738
  const env2 = process.env.DSH_HOME;
45708
45739
  if (env2 && env2.trim() !== "") return env2;
45709
- return `${process.env.HOME ?? ""}/.dsh`;
45740
+ return join2(homeDir(), ".skill-creator", "dsh-home");
45710
45741
  }
45711
45742
  var init_dsh_host_lifecycle = __esm({
45712
45743
  "src/daemon/dsh-host-lifecycle.ts"() {
45713
45744
  "use strict";
45745
+ init_paths();
45714
45746
  }
45715
45747
  });
45716
45748
 
@@ -46109,6 +46141,25 @@ var init_dsh_settings = __esm({
46109
46141
  }
46110
46142
  });
46111
46143
 
46144
+ // src/shared/contracts/agent-roles.ts
46145
+ function agentRoleToolName(slug) {
46146
+ return `${AGENT_ROLE_TOOL_PREFIX}${slug}`;
46147
+ }
46148
+ var AGENT_ROLE_PROMPT_VERSION, AGENT_ROLE_TOOL_PREFIX, AGENT_MODE_ROLES;
46149
+ var init_agent_roles = __esm({
46150
+ "src/shared/contracts/agent-roles.ts"() {
46151
+ "use strict";
46152
+ AGENT_ROLE_PROMPT_VERSION = "1";
46153
+ AGENT_ROLE_TOOL_PREFIX = "role_";
46154
+ AGENT_MODE_ROLES = {
46155
+ create: ["reviewer", "writer"],
46156
+ manage: ["reviewer", "writer"],
46157
+ explore: ["researcher", "reviewer"],
46158
+ free: ["reviewer", "researcher", "writer"]
46159
+ };
46160
+ }
46161
+ });
46162
+
46112
46163
  // src/daemon/dsh-profile-support.ts
46113
46164
  var init_dsh_profile_support = __esm({
46114
46165
  "src/daemon/dsh-profile-support.ts"() {
@@ -46116,6 +46167,60 @@ var init_dsh_profile_support = __esm({
46116
46167
  }
46117
46168
  });
46118
46169
 
46170
+ // src/daemon/kernel/agent-roles.ts
46171
+ var REVIEWER_PERSONA, RESEARCHER_PERSONA, WRITER_PERSONA;
46172
+ var init_agent_roles2 = __esm({
46173
+ "src/daemon/kernel/agent-roles.ts"() {
46174
+ "use strict";
46175
+ init_agent_roles();
46176
+ REVIEWER_PERSONA = `# Role: Reviewer (v${AGENT_ROLE_PROMPT_VERSION})
46177
+
46178
+ You review local skills and report concrete, actionable findings. You read through
46179
+ the skill-creator capability face (skills_list, skills_info, skills_validate,
46180
+ creator_load) and judge trigger contracts, scope discipline, and structure.
46181
+
46182
+ ## Review law
46183
+ - Findings must cite the exact skill and the exact defect: vague advice is a failure.
46184
+ - Weigh the frontmatter description as the trigger contract: does it say what the
46185
+ skill does and when to use it, in the third person, optimized for retrieval?
46186
+ - Flag progressive-disclosure violations (kitchen-sink SKILL.md), secrets, and
46187
+ machine-specific absolute paths.
46188
+ - You propose nothing and write nothing: report findings; the parent decides.
46189
+
46190
+ ## Report shape
46191
+ Return a ranked findings list (severity, skill, defect, suggested fix). If the
46192
+ library is clean, say so explicitly instead of inventing issues.`;
46193
+ RESEARCHER_PERSONA = `# Role: Researcher (v${AGENT_ROLE_PROMPT_VERSION})
46194
+
46195
+ You scan Git skill sources (repository_scan, repository_sources_list) and analyze
46196
+ whether candidate skills fit the stated requirements. You compare against what is
46197
+ already installed (skills_list, skills_info) to avoid duplicates.
46198
+
46199
+ ## Research law
46200
+ - Turn the requirement into explicit criteria before scanning; state them back
46201
+ in one line.
46202
+ - A skill that matches the letter but not the intent is a rejection; say which
46203
+ criterion failed.
46204
+ - Red flags end a candidacy: secrets, machine-specific paths, vague triggers,
46205
+ kitchen-sink scope.
46206
+ - You install nothing: shortlist with evidence and hand the decision back.`;
46207
+ WRITER_PERSONA = `# Role: Writer (v${AGENT_ROLE_PROMPT_VERSION})
46208
+
46209
+ You draft and edit SKILL.md content in imported workspaces. Reads go through
46210
+ skills_list / skills_info / creator_load; every mutation goes through the
46211
+ propose variants (creator_save / creator_remove) \u2014 a human approves each change
46212
+ in the Skill Creator UI before it touches disk.
46213
+
46214
+ ## Authoring law
46215
+ - The frontmatter description is the trigger contract: third person, what it does
46216
+ and when to use it, optimized for retrieval.
46217
+ - Progressive disclosure: lean procedural SKILL.md; reference detail goes to
46218
+ bundled files, not long prose.
46219
+ - Never claim a document is saved until its propose result says so.
46220
+ - Respect preferences the human states (language, style, structure).`;
46221
+ }
46222
+ });
46223
+
46119
46224
  // src/daemon/kernel/dsh-kernel.ts
46120
46225
  import path20 from "node:path";
46121
46226
  import { fileURLToPath as fileURLToPath2 } from "node:url";
@@ -46131,6 +46236,7 @@ var init_dsh_kernel = __esm({
46131
46236
  "src/daemon/kernel/dsh-kernel.ts"() {
46132
46237
  "use strict";
46133
46238
  init_dsh_profile_support();
46239
+ init_agent_roles2();
46134
46240
  modulePath = fileURLToPath2(import.meta.url);
46135
46241
  sourceMode = path20.basename(modulePath) === "dsh-kernel.ts";
46136
46242
  repoRoot = sourceMode ? path20.resolve(path20.dirname(modulePath), "../../..") : path20.resolve(path20.dirname(modulePath), "..");
@@ -46434,6 +46540,59 @@ var init_session_cleanup = __esm({
46434
46540
  }
46435
46541
  });
46436
46542
 
46543
+ // src/daemon/kernel/agent-queue.ts
46544
+ import { createUserMessage } from "@deepseek-ai/dsh-llm";
46545
+ import { z as z18 } from "zod";
46546
+ function parseInboxMessage(raw) {
46547
+ const checked = InboxMessageSchema.safeParse(raw);
46548
+ return checked.success ? checked.data : null;
46549
+ }
46550
+ function queueItemOf(message, target) {
46551
+ const texts = [];
46552
+ let attachments = 0;
46553
+ for (const block of message.content) {
46554
+ if (block.type === "text" && typeof block.text === "string" && block.text.length > 0) {
46555
+ texts.push(block.text);
46556
+ }
46557
+ if (block.type === "image" || block.type === "file") attachments += 1;
46558
+ }
46559
+ return { messageId: message.id, target, text: texts.join("\n"), attachments };
46560
+ }
46561
+ function projectInbox(inbox) {
46562
+ const out = [];
46563
+ for (const [target, list2] of [
46564
+ ["next-step", inbox.nextStep],
46565
+ ["next-turn", inbox.nextTurn]
46566
+ ]) {
46567
+ for (const original of list2) {
46568
+ const parsed = parseInboxMessage(original);
46569
+ if (parsed === null) continue;
46570
+ out.push({ item: queueItemOf(parsed, target), parsed, original });
46571
+ }
46572
+ }
46573
+ return out;
46574
+ }
46575
+ function rebuildEditedMessage(original, text) {
46576
+ const nonText = original.content.filter((block) => block.type !== "text");
46577
+ const maybeSource = original.source;
46578
+ const source = typeof maybeSource === "object" && maybeSource !== null && maybeSource.kind === "user" ? maybeSource : { kind: "user" };
46579
+ return createUserMessage({
46580
+ source,
46581
+ content: [{ type: "text", text }, ...nonText]
46582
+ });
46583
+ }
46584
+ var InboxMessageSchema;
46585
+ var init_agent_queue = __esm({
46586
+ "src/daemon/kernel/agent-queue.ts"() {
46587
+ "use strict";
46588
+ InboxMessageSchema = z18.object({
46589
+ id: z18.string().min(1),
46590
+ source: z18.unknown().optional(),
46591
+ content: z18.array(z18.object({ type: z18.string().min(1), text: z18.string().optional() }).passthrough()).min(1)
46592
+ }).passthrough();
46593
+ }
46594
+ });
46595
+
46437
46596
  // src/daemon/kernel/session-transcripts.ts
46438
46597
  import fs17 from "node:fs";
46439
46598
  import path21 from "node:path";
@@ -46672,8 +46831,8 @@ var init_session_transcripts = __esm({
46672
46831
 
46673
46832
  // src/daemon/kernel/agent-sessions.ts
46674
46833
  import { randomUUID as randomUUID2 } from "node:crypto";
46675
- import { createUserMessage } from "@deepseek-ai/dsh-llm";
46676
- import { z as z18 } from "zod";
46834
+ import { createUserMessage as createUserMessage2 } from "@deepseek-ai/dsh-llm";
46835
+ import { z as z19 } from "zod";
46677
46836
  function messageEnvelopeOf(raw) {
46678
46837
  if (typeof raw === "object" && raw !== null && "message" in raw) {
46679
46838
  const wrapped = raw.message;
@@ -46946,6 +47105,26 @@ function createAgentSessionsService(deps) {
46946
47105
  }
46947
47106
  ];
46948
47107
  }
47108
+ case "subagent/catalog": {
47109
+ const checked = SubagentCatalogEventSchema.safeParse(data);
47110
+ if (!checked.success) {
47111
+ logDroppedEvent(entry.agent.session.id, event.type, data);
47112
+ return [];
47113
+ }
47114
+ return [
47115
+ {
47116
+ ...base,
47117
+ seq: entry.frameSeq++,
47118
+ kind: "subagent",
47119
+ text: checked.data.label ?? checked.data.childId,
47120
+ payload: redactDshPayload({
47121
+ childId: checked.data.childId,
47122
+ mode: checked.data.mode,
47123
+ ...checked.data.label !== void 0 ? { label: checked.data.label } : {}
47124
+ })
47125
+ }
47126
+ ];
47127
+ }
46949
47128
  case "user/message": {
46950
47129
  const checked = MessageEventSchema.safeParse(data);
46951
47130
  if (!checked.success) {
@@ -47149,6 +47328,54 @@ function createAgentSessionsService(deps) {
47149
47328
  return text;
47150
47329
  }
47151
47330
  }
47331
+ const SESSION_DIGEST_MAX_FRAMES = 30;
47332
+ const SESSION_DIGEST_MAX_CHARS = 24e3;
47333
+ function sessionReferenceDigest(sessionId) {
47334
+ const meta = deps.transcripts.listAll().find((item) => item.sessionId === sessionId);
47335
+ const frames = deps.transcripts.readFrames(sessionId);
47336
+ if (meta === void 0 && frames.length === 0) {
47337
+ throw new DomainError("NOT_FOUND", `referenced session not found: ${sessionId}`);
47338
+ }
47339
+ const lines = [];
47340
+ let total = 0;
47341
+ for (let i = frames.length - 1; i >= 0 && lines.length < SESSION_DIGEST_MAX_FRAMES; i -= 1) {
47342
+ const frame = frames[i];
47343
+ const role = frame.kind === "user-text" ? "user" : frame.kind === "assistant-text" ? "assistant" : null;
47344
+ if (role === null || typeof frame.text !== "string" || frame.text.length === 0) continue;
47345
+ const line = `${role}: ${frame.text}`;
47346
+ if (total + line.length > SESSION_DIGEST_MAX_CHARS && lines.length > 0) break;
47347
+ lines.unshift(line.slice(0, SESSION_DIGEST_MAX_CHARS));
47348
+ total += line.length;
47349
+ }
47350
+ const title = meta?.title !== void 0 && meta.title.length > 0 ? ` "${meta.title}"` : "";
47351
+ return `[reference: earlier session${title} (${sessionId})]
47352
+ ${lines.join("\n")}`;
47353
+ }
47354
+ async function expandReferences(references) {
47355
+ const blocks = [];
47356
+ for (const reference of references) {
47357
+ if (reference.kind === "file") {
47358
+ if (deps.expandFileReferences === void 0) {
47359
+ throw new DomainError(
47360
+ "UNAVAILABLE",
47361
+ "file references require the agent-files service (not wired)"
47362
+ );
47363
+ }
47364
+ blocks.push(...await deps.expandFileReferences([reference]));
47365
+ } else if (reference.kind === "skill") {
47366
+ if (deps.expandSkillReferences === void 0) {
47367
+ throw new DomainError(
47368
+ "UNAVAILABLE",
47369
+ "skill references require the skills service (not wired)"
47370
+ );
47371
+ }
47372
+ blocks.push(...await deps.expandSkillReferences([reference]));
47373
+ } else {
47374
+ blocks.push(sessionReferenceDigest(reference.sessionId));
47375
+ }
47376
+ }
47377
+ return blocks;
47378
+ }
47152
47379
  function textOf(message) {
47153
47380
  const content = message?.content;
47154
47381
  if (!Array.isArray(content)) return void 0;
@@ -47180,11 +47407,7 @@ function createAgentSessionsService(deps) {
47180
47407
  }
47181
47408
  return out;
47182
47409
  }
47183
- function isTextualFile(name) {
47184
- return /\.(txt|md|markdown|json|ya?ml|toml|csv|tsv|log|patch|diff|ts|tsx|js|jsx|py|rs|go|java|c|h|cpp|sh|css|html|xml|ini|env)$/i.test(
47185
- name
47186
- );
47187
- }
47410
+ const isTextualFile = isTextualFileName;
47188
47411
  function usageSnapshotOf(data) {
47189
47412
  const checked = UsageEnvelopeSchema.safeParse(data);
47190
47413
  if (!checked.success) return void 0;
@@ -47318,6 +47541,7 @@ function createAgentSessionsService(deps) {
47318
47541
  }
47319
47542
  for (const session of sessions.list()) {
47320
47543
  if (known.has(session.id)) continue;
47544
+ if (session.header.origin === "subagent") continue;
47321
47545
  const entry = live.get(session.id);
47322
47546
  if (entry) {
47323
47547
  summaries.push(summaryOf(entry));
@@ -47386,7 +47610,7 @@ function createAgentSessionsService(deps) {
47386
47610
  });
47387
47611
  if (input.prompt) {
47388
47612
  handle.agent.followup(
47389
- createUserMessage({
47613
+ createUserMessage2({
47390
47614
  source: { kind: "user" },
47391
47615
  content: [{ type: "text", text: input.prompt }]
47392
47616
  })
@@ -47395,19 +47619,23 @@ function createAgentSessionsService(deps) {
47395
47619
  return summaryOf(entry);
47396
47620
  },
47397
47621
  /** 驱动一轮用户输入(长度硬上限与 RPC 契约一致——外部输入 runtime 收窄)。
47398
- * 非live但有转录的会话先经内核 agents.resume 复活(跨 daemon 重启续聊)。 */
47399
- async prompt(sessionId, text, images = [], files = []) {
47622
+ * 非live但有转录的会话先经内核 agents.resume 复活(跨 daemon 重启续聊)。
47623
+ * C1:references 由 daemon 展开(file 读盘 / session 转录摘要)为
47624
+ * [reference: …] 文本块,注入内核 content——与文件附件内联同构;目标缺失
47625
+ * typed NOT_FOUND 整体拒绝,不静默降级。 */
47626
+ async prompt(sessionId, text, images = [], files = [], mode = "queue", references = []) {
47400
47627
  if (text.length > PROMPT_MAX_CHARS) {
47401
47628
  throw new DomainError(
47402
47629
  "INVALID_OPERATION",
47403
47630
  `prompt too long: ${text.length} chars (max ${PROMPT_MAX_CHARS})`
47404
47631
  );
47405
47632
  }
47633
+ const referenceBlocks = references.length > 0 ? await expandReferences(references) : [];
47406
47634
  let entry = live.get(sessionId);
47407
47635
  if (!entry) {
47408
47636
  entry = await reviveSession(sessionId);
47409
47637
  }
47410
- if (text.startsWith("/") && images.length === 0 && files.length === 0) {
47638
+ if (text.startsWith("/") && images.length === 0 && files.length === 0 && references.length === 0) {
47411
47639
  const commands = requireKernel().ctx.commands;
47412
47640
  if (commands) {
47413
47641
  const executed = await commands.execute(
@@ -47430,6 +47658,9 @@ ${decoded.slice(0, 2e5)}`
47430
47658
  });
47431
47659
  return false;
47432
47660
  });
47661
+ for (const block of referenceBlocks) {
47662
+ content.push({ type: "text", text: block });
47663
+ }
47433
47664
  if (images.length > 0 || restFiles.length > 0) {
47434
47665
  const kernel = requireKernel();
47435
47666
  const attachments = kernel.ctx.attachments;
@@ -47460,18 +47691,22 @@ ${decoded.slice(0, 2e5)}`
47460
47691
  content.push({ type: "file", attachment: ref });
47461
47692
  }
47462
47693
  }
47463
- entry.agent.followup(
47464
- createUserMessage({
47465
- source: { kind: "user" },
47466
- content
47467
- })
47468
- );
47694
+ const message = createUserMessage2({
47695
+ source: { kind: "user" },
47696
+ content
47697
+ });
47698
+ if (mode === "steer" && typeof entry.agent.steer === "function") {
47699
+ entry.agent.steer(message);
47700
+ } else {
47701
+ entry.agent.followup(message);
47702
+ }
47469
47703
  },
47470
- /** 取消当前活动(幂等;无活动为 no-op)。 */
47704
+ /** 取消当前活动(幂等;无活动为 no-op)。W4:keepInbox——排队消息在停止后
47705
+ * 存活并按 FIFO 续跑(官方 Stop 语义;内核缺省会清 inbox)。 */
47471
47706
  cancel(sessionId) {
47472
47707
  const entry = live.get(sessionId);
47473
47708
  if (!entry) throw new DomainError("NOT_FOUND", `agent session not found: ${sessionId}`);
47474
- entry.agent.cancel("user");
47709
+ entry.agent.cancel("user", { keepInbox: true });
47475
47710
  },
47476
47711
  /**
47477
47712
  * 切换会话模式(add-agent-settings-modes):meta 持久化 + live 句柄有界释放 +
@@ -47521,6 +47756,70 @@ ${decoded.slice(0, 2e5)}`
47521
47756
  deps.transcripts.append(sessionId, frame);
47522
47757
  return summary;
47523
47758
  },
47759
+ /**
47760
+ * C2 queue 面薄委托(逻辑在 agent-queue):非 live 会话返回空 items——
47761
+ * 重启后未复活的挂起队列不可操作(记录边界,不伪装)。live 会话无 inbox
47762
+ * 面(内核面缺失)同样空 items。
47763
+ */
47764
+ queueList(sessionId) {
47765
+ const entry = live.get(sessionId);
47766
+ if (!entry || entry.agent.inbox === void 0) return { items: [] };
47767
+ return { items: projectInbox(entry.agent.inbox).map(({ item }) => item) };
47768
+ },
47769
+ /**
47770
+ * C2 queue 行级操作:edit=replace(新文本 + 原附件块);remove=remove;
47771
+ * steer=next-turn → next-step(仅 running)。messageId 已被消费(轮次已
47772
+ * 开始)typed NOT_FOUND——竞态可见;目标不在 next-turn 时 steer 拒绝。
47773
+ */
47774
+ queueUpdate(sessionId, input) {
47775
+ const entry = live.get(sessionId);
47776
+ if (!entry) {
47777
+ throw new DomainError("NOT_FOUND", `agent session not found: ${sessionId}`);
47778
+ }
47779
+ if (entry.agent.inbox === void 0) {
47780
+ throw new DomainError("UNAVAILABLE", "agent kernel inbox surface missing");
47781
+ }
47782
+ const inbox = entry.agent.inbox;
47783
+ if (input.action === "remove") {
47784
+ if (!inbox.remove(input.messageId)) {
47785
+ throw new DomainError(
47786
+ "NOT_FOUND",
47787
+ `queued message no longer pending: ${input.messageId}`
47788
+ );
47789
+ }
47790
+ return;
47791
+ }
47792
+ if (input.action === "edit") {
47793
+ const found = projectInbox(inbox).find(({ item }) => item.messageId === input.messageId);
47794
+ if (found === void 0) {
47795
+ throw new DomainError(
47796
+ "NOT_FOUND",
47797
+ `queued message no longer pending: ${input.messageId}`
47798
+ );
47799
+ }
47800
+ inbox.replace(input.messageId, rebuildEditedMessage(found.parsed, input.text ?? ""));
47801
+ return;
47802
+ }
47803
+ if (statusOf(entry) !== "running") {
47804
+ throw new DomainError(
47805
+ "INVALID_OPERATION",
47806
+ "steer needs a running turn; the session is idle"
47807
+ );
47808
+ }
47809
+ const queued = projectInbox(inbox).find(
47810
+ ({ item }) => item.messageId === input.messageId && item.target === "next-turn"
47811
+ );
47812
+ if (queued === void 0) {
47813
+ throw new DomainError(
47814
+ "INVALID_OPERATION",
47815
+ `message is not a queued next-turn item: ${input.messageId}`
47816
+ );
47817
+ }
47818
+ if (!inbox.remove(input.messageId)) {
47819
+ throw new DomainError("NOT_FOUND", `queued message no longer pending: ${input.messageId}`);
47820
+ }
47821
+ inbox.append("next-step", queued.original);
47822
+ },
47524
47823
  /** 增量帧读取(afterSeq 游标 + limit 窗口);非 live 会话由转录回放。 */
47525
47824
  stream(sessionId, afterSeq, limit) {
47526
47825
  const entry = live.get(sessionId);
@@ -47557,6 +47856,11 @@ ${decoded.slice(0, 2e5)}`
47557
47856
  },
47558
47857
  /** 有界销毁(daemon stop 时逐个回收 agent;待答请求以空答案释放)。 */
47559
47858
  async dispose() {
47859
+ const kernel = deps.kernel();
47860
+ const drain = kernel?.ctx?.subagents?.drainContinuableDescendants;
47861
+ if (drain && live.size > 0) {
47862
+ await Promise.resolve(drain([...live.keys()])).catch(() => void 0);
47863
+ }
47560
47864
  for (const entry of live.values()) {
47561
47865
  for (const pending of entry.pending.values()) {
47562
47866
  pending.resolve({ answers: [] });
@@ -47577,74 +47881,79 @@ function applyProductToolSurface(agentCtx, mode) {
47577
47881
  }
47578
47882
  function productToolDenyList(globalNames, mode) {
47579
47883
  const nativeAllowed = mode === "free" ? [...KERNEL_AGENT_TOOL_ALLOWLIST, "bash"] : KERNEL_AGENT_TOOL_ALLOWLIST;
47884
+ const modeRoles = AGENT_MODE_ROLES[mode];
47885
+ const roleAllowed = modeRoles.map(agentRoleToolName);
47580
47886
  return globalNames.filter(
47581
- (name) => !nativeAllowed.includes(name) && !name.startsWith("mcp__skill-creator__")
47887
+ (name) => !nativeAllowed.includes(name) && !roleAllowed.includes(name) && !name.startsWith("mcp__skill-creator__")
47582
47888
  );
47583
47889
  }
47584
- var AgentChunkEventSchema, TodoWriteEventSchema, MessageSourceSchema, MessageBlockSchema, MessageShapeSchema, MessageEventSchema, TurnEndEventSchema, SessionTitleEventSchema, ToolCallEventSchema, ToolResultEventSchema, TurnStartEventSchema, AgentStatusEventSchema, UsageEnvelopeSchema, DROPPED_EVENT_LOG_MAX, DEFAULT_RETENTION, PROMPT_MAX_CHARS, DELTA_FLUSH_MS;
47890
+ var AgentChunkEventSchema, TodoWriteEventSchema, MessageSourceSchema, MessageBlockSchema, MessageShapeSchema, MessageEventSchema, TurnEndEventSchema, SessionTitleEventSchema, ToolCallEventSchema, ToolResultEventSchema, TurnStartEventSchema, AgentStatusEventSchema, SubagentCatalogEventSchema, UsageEnvelopeSchema, DROPPED_EVENT_LOG_MAX, DEFAULT_RETENTION, PROMPT_MAX_CHARS, DELTA_FLUSH_MS;
47585
47891
  var init_agent_sessions = __esm({
47586
47892
  "src/daemon/kernel/agent-sessions.ts"() {
47587
47893
  "use strict";
47588
47894
  init_dsh_runtime();
47589
47895
  init_domain_error();
47896
+ init_agent_files();
47897
+ init_agent_roles();
47590
47898
  init_dsh_kernel();
47591
47899
  init_agent_modes();
47592
47900
  init_product_prompt();
47593
47901
  init_session_cleanup();
47902
+ init_agent_queue();
47594
47903
  init_session_transcripts();
47595
- AgentChunkEventSchema = z18.object({
47596
- chunk: z18.object({
47597
- type: z18.string().min(1),
47598
- text: z18.string().optional(),
47599
- id: z18.string().optional(),
47600
- name: z18.string().optional(),
47601
- argumentsDelta: z18.string().optional()
47904
+ AgentChunkEventSchema = z19.object({
47905
+ chunk: z19.object({
47906
+ type: z19.string().min(1),
47907
+ text: z19.string().optional(),
47908
+ id: z19.string().optional(),
47909
+ name: z19.string().optional(),
47910
+ argumentsDelta: z19.string().optional()
47602
47911
  })
47603
47912
  });
47604
- TodoWriteEventSchema = z18.object({
47605
- todos: z18.array(
47606
- z18.object({
47607
- content: z18.string(),
47608
- status: z18.string().min(1)
47913
+ TodoWriteEventSchema = z19.object({
47914
+ todos: z19.array(
47915
+ z19.object({
47916
+ content: z19.string(),
47917
+ status: z19.string().min(1)
47609
47918
  })
47610
47919
  )
47611
47920
  });
47612
- MessageSourceSchema = z18.object({
47613
- kind: z18.string().optional(),
47614
- callId: z18.string().optional()
47921
+ MessageSourceSchema = z19.object({
47922
+ kind: z19.string().optional(),
47923
+ callId: z19.string().optional()
47615
47924
  }).passthrough();
47616
- MessageBlockSchema = z18.object({
47617
- type: z18.string().min(1),
47618
- text: z18.string().optional(),
47619
- name: z18.string().optional()
47925
+ MessageBlockSchema = z19.object({
47926
+ type: z19.string().min(1),
47927
+ text: z19.string().optional(),
47928
+ name: z19.string().optional()
47620
47929
  }).passthrough();
47621
- MessageShapeSchema = z18.object({
47930
+ MessageShapeSchema = z19.object({
47622
47931
  source: MessageSourceSchema.optional(),
47623
- content: z18.array(MessageBlockSchema).min(1)
47932
+ content: z19.array(MessageBlockSchema).min(1)
47624
47933
  }).passthrough();
47625
- MessageEventSchema = z18.preprocess(messageEnvelopeOf, MessageShapeSchema);
47626
- TurnEndEventSchema = z18.object({
47627
- reason: z18.object({ kind: z18.string().optional() }).passthrough().optional()
47934
+ MessageEventSchema = z19.preprocess(messageEnvelopeOf, MessageShapeSchema);
47935
+ TurnEndEventSchema = z19.object({
47936
+ reason: z19.object({ kind: z19.string().optional() }).passthrough().optional()
47628
47937
  }).passthrough();
47629
- SessionTitleEventSchema = z18.object({
47630
- title: z18.string().optional()
47938
+ SessionTitleEventSchema = z19.object({
47939
+ title: z19.string().optional()
47631
47940
  }).passthrough();
47632
- ToolCallEventSchema = z18.object({
47633
- callId: z18.string().min(1),
47634
- name: z18.string().min(1),
47635
- arguments: z18.string()
47941
+ ToolCallEventSchema = z19.object({
47942
+ callId: z19.string().min(1),
47943
+ name: z19.string().min(1),
47944
+ arguments: z19.string()
47636
47945
  }).passthrough();
47637
- ToolResultEventSchema = z18.object({
47638
- message: z18.object({
47639
- source: z18.object({ kind: z18.literal("tool"), callId: z18.string().min(1) }).passthrough(),
47640
- content: z18.tuple([
47641
- z18.object({
47642
- type: z18.literal("tool-result"),
47643
- toolCallId: z18.string().min(1),
47644
- content: z18.array(
47645
- z18.object({
47646
- type: z18.string().min(1),
47647
- text: z18.string().optional()
47946
+ ToolResultEventSchema = z19.object({
47947
+ message: z19.object({
47948
+ source: z19.object({ kind: z19.literal("tool"), callId: z19.string().min(1) }).passthrough(),
47949
+ content: z19.tuple([
47950
+ z19.object({
47951
+ type: z19.literal("tool-result"),
47952
+ toolCallId: z19.string().min(1),
47953
+ content: z19.array(
47954
+ z19.object({
47955
+ type: z19.string().min(1),
47956
+ text: z19.string().optional()
47648
47957
  }).passthrough()
47649
47958
  ).min(1).refine(
47650
47959
  (parts) => parts.some(
@@ -47656,9 +47965,15 @@ var init_agent_sessions = __esm({
47656
47965
  ])
47657
47966
  }).passthrough()
47658
47967
  });
47659
- TurnStartEventSchema = z18.record(z18.string(), z18.unknown());
47660
- AgentStatusEventSchema = z18.record(z18.string(), z18.unknown());
47661
- UsageEnvelopeSchema = z18.object({ usage: z18.record(z18.string(), z18.unknown()).optional() }).passthrough();
47968
+ TurnStartEventSchema = z19.record(z19.string(), z19.unknown());
47969
+ AgentStatusEventSchema = z19.record(z19.string(), z19.unknown());
47970
+ SubagentCatalogEventSchema = z19.object({
47971
+ childId: z19.string().min(1),
47972
+ childCreatedAt: z19.number().optional(),
47973
+ mode: z19.enum(["one-shot", "continuable"]),
47974
+ label: z19.string().optional()
47975
+ });
47976
+ UsageEnvelopeSchema = z19.object({ usage: z19.record(z19.string(), z19.unknown()).optional() }).passthrough();
47662
47977
  DROPPED_EVENT_LOG_MAX = 200;
47663
47978
  DEFAULT_RETENTION = 200;
47664
47979
  PROMPT_MAX_CHARS = 2e4;
@@ -47856,66 +48171,95 @@ var init_model_catalog = __esm({
47856
48171
  });
47857
48172
 
47858
48173
  // src/shared/contracts/agent.ts
47859
- import { z as z19 } from "zod";
47860
- var AgentSessionStatusSchema, AgentSessionSummarySchema, AgentSessionCreateInputSchema, AgentSessionCreateResultSchema, AgentPromptImageSchema, AgentPromptFileSchema, AgentSessionPromptInputSchema, AgentSessionPromptResultSchema, AgentSessionSetModeInputSchema, AgentSessionSetModeResultSchema, AgentSessionCancelInputSchema, AgentSessionCancelResultSchema, AgentSessionStreamInputSchema, AgentSessionStreamResultSchema, AgentSessionsStreamsInputSchema, AgentSessionsCleanupInputSchema, AgentSessionsCleanupResultSchema, AgentApprovalQuestionSchema, AgentSessionAnswerInputSchema, AgentSessionAnswerResultSchema, AgentCardGetInputSchema, AgentCardGetResultSchema, AgentMcpProposalViewSchema, AgentProposalDecisionInputSchema, AgentFilesListInputSchema, AgentFilesEntrySchema, AgentFilesListResultSchema, AgentFilesPreviewInputSchema, AgentFilesPreviewResultSchema;
48174
+ import { z as z20 } from "zod";
48175
+ var AgentSessionStatusSchema, AgentSessionSummarySchema, AgentSessionCreateInputSchema, AgentSessionCreateResultSchema, AgentPromptImageSchema, AgentPromptFileSchema, AgentPromptReferenceSchema, AgentSessionPromptInputSchema, AgentSessionPromptResultSchema, AgentSessionSetModeInputSchema, AgentSessionSetModeResultSchema, AgentSessionCancelInputSchema, AgentSessionCancelResultSchema, AgentSessionStreamInputSchema, AgentSessionStreamResultSchema, AgentQueueItemSchema, AgentQueueListInputSchema, AgentQueueListResultSchema, AgentQueueUpdateInputSchema, AgentQueueUpdateResultSchema, AgentSessionsStreamsInputSchema, AgentSessionsCleanupInputSchema, AgentSessionsCleanupResultSchema, AgentApprovalQuestionSchema, AgentSessionAnswerInputSchema, AgentSessionAnswerResultSchema, AgentCardGetInputSchema, AgentCardGetResultSchema, AgentMcpProposalViewSchema, AgentProposalDecisionInputSchema, AgentFilesListInputSchema, AgentFilesEntrySchema, AgentFilesListResultSchema, AgentFilesPreviewInputSchema, AgentFilesPreviewResultSchema;
47861
48176
  var init_agent = __esm({
47862
48177
  "src/shared/contracts/agent.ts"() {
47863
48178
  "use strict";
47864
48179
  init_dsh_runtime();
47865
- AgentSessionStatusSchema = z19.enum(["idle", "running", "disposed"]);
47866
- AgentSessionSummarySchema = z19.object({
47867
- sessionId: z19.string().min(1),
48180
+ init_workspaces();
48181
+ init_skills();
48182
+ AgentSessionStatusSchema = z20.enum(["idle", "running", "disposed"]);
48183
+ AgentSessionSummarySchema = z20.object({
48184
+ sessionId: z20.string().min(1),
47868
48185
  /** 自动标题(内核 session-title;首 prompt 前为空串)。 */
47869
- title: z19.string(),
48186
+ title: z20.string(),
47870
48187
  status: AgentSessionStatusSchema,
47871
- cwd: z19.string(),
47872
- createdAt: z19.string().min(1),
48188
+ cwd: z20.string(),
48189
+ createdAt: z20.string().min(1),
47873
48190
  /** 会话模式(旧转录缺失读 free——其创建时即全工具面的事实投影)。 */
47874
48191
  mode: DshAgentModeSchema,
47875
48192
  /** 产品转录归属(R15 codex P1-3):false = kernel/steward-only 会话——清理
47876
48193
  * RPC 只管产品转录层,这类行 UI 禁删并以 kernel-only 标记呈现。 */
47877
- hasTranscript: z19.boolean().optional()
48194
+ hasTranscript: z20.boolean().optional()
47878
48195
  });
47879
- AgentSessionCreateInputSchema = z19.object({
48196
+ AgentSessionCreateInputSchema = z20.object({
47880
48197
  /** 会话工作目录(缺省 daemon cwd;产品面通常传 Workspace 目录)。 */
47881
- cwd: z19.string().min(1).optional(),
48198
+ cwd: z20.string().min(1).optional(),
47882
48199
  /** 首条消息(可选;提供则创建后立即驱动一轮)。 */
47883
- prompt: z19.string().min(1).max(2e4).optional(),
48200
+ prompt: z20.string().min(1).max(2e4).optional(),
47884
48201
  /** 会话模式(缺省取 settings.defaultMode)。 */
47885
48202
  mode: DshAgentModeSchema.optional()
47886
48203
  });
47887
- AgentSessionCreateResultSchema = z19.object({
48204
+ AgentSessionCreateResultSchema = z20.object({
47888
48205
  session: AgentSessionSummarySchema
47889
48206
  });
47890
- AgentPromptImageSchema = z19.union([
47891
- z19.strictObject({
47892
- mediaType: z19.enum(["image/png", "image/jpeg", "image/webp", "image/gif"]),
48207
+ AgentPromptImageSchema = z20.union([
48208
+ z20.strictObject({
48209
+ mediaType: z20.enum(["image/png", "image/jpeg", "image/webp", "image/gif"]),
47893
48210
  /** canonical base64(≤4MiB 解码后;超限 schema 拒绝)。 */
47894
- data: z19.string().min(1),
47895
- name: z19.string().min(1).max(120).optional()
48211
+ data: z20.string().min(1),
48212
+ name: z20.string().min(1).max(120).optional()
47896
48213
  }),
47897
- z19.strictObject({
48214
+ z20.strictObject({
47898
48215
  /** daemon 可读的绝对路径(源文件 ≤4MiB,daemon 读盘时校验)。 */
47899
- path: z19.string().min(1),
47900
- name: z19.string().min(1).max(120).optional()
48216
+ path: z20.string().min(1),
48217
+ name: z20.string().min(1).max(120).optional()
47901
48218
  })
47902
48219
  ]);
47903
- AgentPromptFileSchema = z19.union([
47904
- z19.strictObject({
47905
- name: z19.string().min(1).max(200),
48220
+ AgentPromptFileSchema = z20.union([
48221
+ z20.strictObject({
48222
+ name: z20.string().min(1).max(200),
47906
48223
  /** canonical base64(≤512KiB 解码后)。 */
47907
- data: z19.string().min(1).max(71e4)
48224
+ data: z20.string().min(1).max(71e4)
47908
48225
  }),
47909
- z19.strictObject({
48226
+ z20.strictObject({
47910
48227
  /** daemon 可读的绝对路径。 */
47911
- path: z19.string().min(1)
48228
+ path: z20.string().min(1)
48229
+ })
48230
+ ]);
48231
+ AgentPromptReferenceSchema = z20.discriminatedUnion("kind", [
48232
+ z20.strictObject({
48233
+ kind: z20.literal("file"),
48234
+ /** daemon 可读的绝对路径(realpath + regular file + ≤512KiB + 文本扩展名)。 */
48235
+ path: z20.string().min(1)
48236
+ }),
48237
+ z20.strictObject({
48238
+ kind: z20.literal("session"),
48239
+ /** 被引用的历史会话(排除语义由 UI 持有;daemon 不猜)。 */
48240
+ sessionId: z20.string().min(1)
48241
+ }),
48242
+ z20.strictObject({
48243
+ kind: z20.literal("skill"),
48244
+ /** 技能引用的 server-owned 作用域三元组(`$` 触发;registry 解析 containment)。 */
48245
+ workspaceId: WorkspaceIdSchema,
48246
+ providerId: ProviderIdSchema,
48247
+ skillId: SkillIdSchema
47912
48248
  })
47913
48249
  ]);
47914
- AgentSessionPromptInputSchema = z19.object({
47915
- sessionId: z19.string().min(1),
47916
- text: z19.string().max(2e4),
47917
- images: z19.array(AgentPromptImageSchema).max(4).default([]),
47918
- files: z19.array(AgentPromptFileSchema).max(2).default([])
48250
+ AgentSessionPromptInputSchema = z20.object({
48251
+ sessionId: z20.string().min(1),
48252
+ text: z20.string().max(2e4),
48253
+ images: z20.array(AgentPromptImageSchema).max(4).default([]),
48254
+ files: z20.array(AgentPromptFileSchema).max(2).default([]),
48255
+ /**
48256
+ * 提交模式(W4,官方 submission-policy 语义):queue = next-turn(当前轮
48257
+ * 完成后运行,内核 inbox 排队);steer = next-step(在下一步骤边界转向
48258
+ * 当前轮)。缺省 queue。
48259
+ */
48260
+ mode: z20.enum(["queue", "steer"]).default("queue"),
48261
+ /** `@` 引用(C1):daemon 展开为 [reference: …] 文本块;缺省无。 */
48262
+ references: z20.array(AgentPromptReferenceSchema).max(4).default([])
47919
48263
  }).refine(
47920
48264
  // R17 codex P1:files-only 也是合法 prompt(后端文件选择器的主路径)。
47921
48265
  (input) => input.text.trim().length > 0 || input.images.length > 0 || input.files.length > 0,
@@ -47926,134 +48270,164 @@ var init_agent = __esm({
47926
48270
  (input) => input.images.every((image) => !("data" in image) || image.data.length <= 5592406),
47927
48271
  { message: "each image must decode to \u22644MiB" }
47928
48272
  );
47929
- AgentSessionPromptResultSchema = z19.object({ accepted: z19.literal(true) });
47930
- AgentSessionSetModeInputSchema = z19.object({
47931
- sessionId: z19.string().min(1),
48273
+ AgentSessionPromptResultSchema = z20.object({ accepted: z20.literal(true) });
48274
+ AgentSessionSetModeInputSchema = z20.object({
48275
+ sessionId: z20.string().min(1),
47932
48276
  mode: DshAgentModeSchema
47933
48277
  });
47934
- AgentSessionSetModeResultSchema = z19.object({
48278
+ AgentSessionSetModeResultSchema = z20.object({
47935
48279
  session: AgentSessionSummarySchema
47936
48280
  });
47937
- AgentSessionCancelInputSchema = z19.object({ sessionId: z19.string().min(1) });
47938
- AgentSessionCancelResultSchema = z19.object({ canceled: z19.literal(true) });
47939
- AgentSessionStreamInputSchema = z19.object({
47940
- sessionId: z19.string().min(1),
47941
- afterSeq: z19.number().int().nonnegative().default(0),
47942
- limit: z19.number().int().positive().max(200).default(50)
48281
+ AgentSessionCancelInputSchema = z20.object({ sessionId: z20.string().min(1) });
48282
+ AgentSessionCancelResultSchema = z20.object({ canceled: z20.literal(true) });
48283
+ AgentSessionStreamInputSchema = z20.object({
48284
+ sessionId: z20.string().min(1),
48285
+ afterSeq: z20.number().int().nonnegative().default(0),
48286
+ limit: z20.number().int().positive().max(200).default(50)
47943
48287
  });
47944
- AgentSessionStreamResultSchema = z19.object({
47945
- frames: z19.array(DshSessionStreamFrameSchema),
48288
+ AgentSessionStreamResultSchema = z20.object({
48289
+ frames: z20.array(DshSessionStreamFrameSchema),
47946
48290
  status: AgentSessionStatusSchema
47947
48291
  });
47948
- AgentSessionsStreamsInputSchema = z19.object({
47949
- runId: z19.string().min(1).optional(),
48292
+ AgentQueueItemSchema = z20.object({
48293
+ /** 内核 UserMessage id(edit/remove/steer 的幂等寻址键)。 */
48294
+ messageId: z20.string().min(1),
48295
+ target: z20.enum(["next-turn", "next-step"]),
48296
+ /** content 文本块拼接(引用/附件块不展开——chip 已在正文 token 中)。 */
48297
+ text: z20.string(),
48298
+ /** image/file 附件块计数(行尾 chip 展示)。 */
48299
+ attachments: z20.number().int().nonnegative()
48300
+ });
48301
+ AgentQueueListInputSchema = z20.object({ sessionId: z20.string().min(1) });
48302
+ AgentQueueListResultSchema = z20.object({ items: z20.array(AgentQueueItemSchema) });
48303
+ AgentQueueUpdateInputSchema = z20.discriminatedUnion("action", [
48304
+ z20.strictObject({
48305
+ sessionId: z20.string().min(1),
48306
+ messageId: z20.string().min(1),
48307
+ action: z20.literal("edit"),
48308
+ text: z20.string().min(1).max(2e4)
48309
+ }),
48310
+ z20.strictObject({
48311
+ sessionId: z20.string().min(1),
48312
+ messageId: z20.string().min(1),
48313
+ action: z20.literal("remove")
48314
+ }),
48315
+ z20.strictObject({
48316
+ sessionId: z20.string().min(1),
48317
+ messageId: z20.string().min(1),
48318
+ action: z20.literal("steer")
48319
+ })
48320
+ ]);
48321
+ AgentQueueUpdateResultSchema = z20.object({ updated: z20.literal(true) });
48322
+ AgentSessionsStreamsInputSchema = z20.object({
48323
+ runId: z20.string().min(1).optional(),
47950
48324
  /** 返回最新 N 帧(默认 50,上限 500)。 */
47951
- limit: z19.number().int().positive().max(500).optional()
48325
+ limit: z20.number().int().positive().max(500).optional()
47952
48326
  });
47953
- AgentSessionsCleanupInputSchema = z19.union([
47954
- z19.strictObject({ beforeDays: z19.number().int().min(0).max(365) }),
47955
- z19.strictObject({ all: z19.literal(true) }),
47956
- z19.strictObject({ sessionIds: z19.array(z19.string().min(1)).min(1).max(200) })
48327
+ AgentSessionsCleanupInputSchema = z20.union([
48328
+ z20.strictObject({ beforeDays: z20.number().int().min(0).max(365) }),
48329
+ z20.strictObject({ all: z20.literal(true) }),
48330
+ z20.strictObject({ sessionIds: z20.array(z20.string().min(1)).min(1).max(200) })
47957
48331
  ]);
47958
- AgentSessionsCleanupResultSchema = z19.object({
47959
- kind: z19.literal("summary"),
47960
- deleted: z19.number().int().nonnegative(),
47961
- kept: z19.number().int().nonnegative(),
47962
- deletedIds: z19.array(z19.string().min(1)).max(1e3).optional(),
48332
+ AgentSessionsCleanupResultSchema = z20.object({
48333
+ kind: z20.literal("summary"),
48334
+ deleted: z20.number().int().nonnegative(),
48335
+ kept: z20.number().int().nonnegative(),
48336
+ deletedIds: z20.array(z20.string().min(1)).max(1e3).optional(),
47963
48337
  /** deletedIds 达到 1000 上限被截断(客户端需以列表复核失效当前会话)。 */
47964
- deletedIdsTruncated: z19.boolean().optional(),
47965
- errors: z19.array(z19.string().min(1)).optional()
47966
- });
47967
- AgentApprovalQuestionSchema = z19.object({
47968
- id: z19.string().min(1),
47969
- question: z19.string().min(1),
47970
- detail: z19.string().optional(),
47971
- header: z19.string().optional(),
47972
- multiSelect: z19.boolean().optional(),
47973
- options: z19.array(z19.object({ label: z19.string().min(1), description: z19.string().optional() })).optional()
47974
- });
47975
- AgentSessionAnswerInputSchema = z19.object({
47976
- sessionId: z19.string().min(1),
48338
+ deletedIdsTruncated: z20.boolean().optional(),
48339
+ errors: z20.array(z20.string().min(1)).optional()
48340
+ });
48341
+ AgentApprovalQuestionSchema = z20.object({
48342
+ id: z20.string().min(1),
48343
+ question: z20.string().min(1),
48344
+ detail: z20.string().optional(),
48345
+ header: z20.string().optional(),
48346
+ multiSelect: z20.boolean().optional(),
48347
+ options: z20.array(z20.object({ label: z20.string().min(1), description: z20.string().optional() })).optional()
48348
+ });
48349
+ AgentSessionAnswerInputSchema = z20.object({
48350
+ sessionId: z20.string().min(1),
47977
48351
  /** 待答请求的帧 seq(幂等键:已解决的请求返回 resolved:false)。 */
47978
- requestSeq: z19.number().int().nonnegative(),
47979
- answers: z19.array(
47980
- z19.object({
47981
- id: z19.string().min(1),
47982
- selected: z19.array(z19.string().min(1)),
47983
- custom: z19.string().optional()
48352
+ requestSeq: z20.number().int().nonnegative(),
48353
+ answers: z20.array(
48354
+ z20.object({
48355
+ id: z20.string().min(1),
48356
+ selected: z20.array(z20.string().min(1)),
48357
+ custom: z20.string().optional()
47984
48358
  })
47985
48359
  ).min(1)
47986
48360
  });
47987
- AgentSessionAnswerResultSchema = z19.object({ answered: z19.boolean() });
47988
- AgentCardGetInputSchema = z19.object({
47989
- uri: z19.string().regex(/^ui:\/\/card\/[a-z-]+\/[a-z0-9-]+$/)
48361
+ AgentSessionAnswerResultSchema = z20.object({ answered: z20.boolean() });
48362
+ AgentCardGetInputSchema = z20.object({
48363
+ uri: z20.string().regex(/^ui:\/\/card\/[a-z-]+\/[a-z0-9-]+$/)
47990
48364
  });
47991
- AgentCardGetResultSchema = z19.object({
47992
- html: z19.string().nullable()
48365
+ AgentCardGetResultSchema = z20.object({
48366
+ html: z20.string().nullable()
47993
48367
  });
47994
- AgentMcpProposalViewSchema = z19.object({
47995
- proposalId: z19.string().min(1),
47996
- capability: z19.string().min(1),
47997
- input: z19.unknown(),
47998
- status: z19.enum(["pending", "approved", "rejected", "executed", "failed"]),
47999
- createdAt: z19.string().min(1),
48000
- decidedAt: z19.string().optional()
48368
+ AgentMcpProposalViewSchema = z20.object({
48369
+ proposalId: z20.string().min(1),
48370
+ capability: z20.string().min(1),
48371
+ input: z20.unknown(),
48372
+ status: z20.enum(["pending", "approved", "rejected", "executed", "failed"]),
48373
+ createdAt: z20.string().min(1),
48374
+ decidedAt: z20.string().optional()
48001
48375
  });
48002
- AgentProposalDecisionInputSchema = z19.object({
48003
- proposalId: z19.string().min(1)
48376
+ AgentProposalDecisionInputSchema = z20.object({
48377
+ proposalId: z20.string().min(1)
48004
48378
  });
48005
- AgentFilesListInputSchema = z19.object({
48006
- dir: z19.string().min(1).optional()
48379
+ AgentFilesListInputSchema = z20.object({
48380
+ dir: z20.string().min(1).optional()
48007
48381
  });
48008
- AgentFilesEntrySchema = z19.object({
48009
- name: z19.string().min(1),
48010
- kind: z19.enum(["file", "dir"]),
48011
- size: z19.number().int().nonnegative().optional()
48382
+ AgentFilesEntrySchema = z20.object({
48383
+ name: z20.string().min(1),
48384
+ kind: z20.enum(["file", "dir"]),
48385
+ size: z20.number().int().nonnegative().optional()
48012
48386
  });
48013
- AgentFilesListResultSchema = z19.object({
48014
- dir: z19.string().min(1),
48387
+ AgentFilesListResultSchema = z20.object({
48388
+ dir: z20.string().min(1),
48015
48389
  /** 上一级目录(文件系统根为 null)。 */
48016
- parent: z19.string().min(1).nullable(),
48017
- entries: z19.array(AgentFilesEntrySchema).max(2e3),
48018
- truncated: z19.boolean().optional()
48019
- });
48020
- AgentFilesPreviewInputSchema = z19.object({
48021
- path: z19.string().min(1)
48022
- });
48023
- AgentFilesPreviewResultSchema = z19.discriminatedUnion("kind", [
48024
- z19.strictObject({
48025
- kind: z19.literal("image"),
48026
- name: z19.string().min(1),
48027
- size: z19.number().int().nonnegative(),
48028
- mediaType: z19.enum(["image/png", "image/jpeg"]),
48390
+ parent: z20.string().min(1).nullable(),
48391
+ entries: z20.array(AgentFilesEntrySchema).max(2e3),
48392
+ truncated: z20.boolean().optional()
48393
+ });
48394
+ AgentFilesPreviewInputSchema = z20.object({
48395
+ path: z20.string().min(1)
48396
+ });
48397
+ AgentFilesPreviewResultSchema = z20.discriminatedUnion("kind", [
48398
+ z20.strictObject({
48399
+ kind: z20.literal("image"),
48400
+ name: z20.string().min(1),
48401
+ size: z20.number().int().nonnegative(),
48402
+ mediaType: z20.enum(["image/png", "image/jpeg"]),
48029
48403
  /** data:image/(png|jpeg);base64,… 缩略图(≤256px 长边)。 */
48030
- dataUrl: z19.string().min(1),
48031
- width: z19.number().int().positive(),
48032
- height: z19.number().int().positive()
48404
+ dataUrl: z20.string().min(1),
48405
+ width: z20.number().int().positive(),
48406
+ height: z20.number().int().positive()
48033
48407
  }),
48034
- z19.strictObject({
48035
- kind: z19.literal("text"),
48036
- name: z19.string().min(1),
48037
- size: z19.number().int().nonnegative(),
48038
- text: z19.string(),
48039
- truncated: z19.boolean()
48408
+ z20.strictObject({
48409
+ kind: z20.literal("text"),
48410
+ name: z20.string().min(1),
48411
+ size: z20.number().int().nonnegative(),
48412
+ text: z20.string(),
48413
+ truncated: z20.boolean()
48040
48414
  }),
48041
- z19.strictObject({
48042
- kind: z19.literal("binary"),
48043
- name: z19.string().min(1),
48044
- size: z19.number().int().nonnegative()
48415
+ z20.strictObject({
48416
+ kind: z20.literal("binary"),
48417
+ name: z20.string().min(1),
48418
+ size: z20.number().int().nonnegative()
48045
48419
  })
48046
48420
  ]);
48047
48421
  }
48048
48422
  });
48049
48423
 
48050
48424
  // src/shared/contracts/errors.ts
48051
- import { z as z20 } from "zod";
48425
+ import { z as z21 } from "zod";
48052
48426
  var RpcErrorCodeSchema, RpcErrorDefinitions;
48053
48427
  var init_errors = __esm({
48054
48428
  "src/shared/contracts/errors.ts"() {
48055
48429
  "use strict";
48056
- RpcErrorCodeSchema = z20.enum([
48430
+ RpcErrorCodeSchema = z21.enum([
48057
48431
  "NOT_FOUND",
48058
48432
  "CONFLICT",
48059
48433
  "INVALID_OPERATION",
@@ -48069,19 +48443,19 @@ var init_errors = __esm({
48069
48443
  });
48070
48444
 
48071
48445
  // src/shared/contracts/skills-update.ts
48072
- import { z as z21 } from "zod";
48446
+ import { z as z22 } from "zod";
48073
48447
  var UpdateCheckInputSchema, UpdateCheckStatusSchema, UpdateCheckResultEntrySchema, UpdateCheckResultSchema, ApplyUpdateInputSchema, ApplyUpdateStatusSchema, ApplyUpdateResultEntrySchema, ApplyUpdateResultSchema;
48074
48448
  var init_skills_update = __esm({
48075
48449
  "src/shared/contracts/skills-update.ts"() {
48076
48450
  "use strict";
48077
48451
  init_skills();
48078
48452
  init_workspaces();
48079
- UpdateCheckInputSchema = z21.object({
48453
+ UpdateCheckInputSchema = z22.object({
48080
48454
  ...WorkspaceProviderTargetSchema.shape,
48081
48455
  /** 仅检查这些技能;缺省检查当前作用域下所有 skills-CLI 来源技能。 */
48082
- skillIds: z21.array(SkillIdSchema).optional()
48456
+ skillIds: z22.array(SkillIdSchema).optional()
48083
48457
  });
48084
- UpdateCheckStatusSchema = z21.enum([
48458
+ UpdateCheckStatusSchema = z22.enum([
48085
48459
  /** hash 改变,待升级。 */
48086
48460
  "updated",
48087
48461
  /** hash 相等,已是最新。 */
@@ -48091,28 +48465,28 @@ var init_skills_update = __esm({
48091
48465
  /** 上游不可达(如限流 / 无网络)。 */
48092
48466
  "unavailable"
48093
48467
  ]);
48094
- UpdateCheckResultEntrySchema = z21.object({
48468
+ UpdateCheckResultEntrySchema = z22.object({
48095
48469
  skillId: SkillIdSchema,
48096
48470
  /** 技能显示名。 */
48097
- name: z21.string(),
48471
+ name: z22.string(),
48098
48472
  /** 当前记录的 hash。 */
48099
- currentHash: z21.string(),
48473
+ currentHash: z22.string(),
48100
48474
  /** 上游算出的 hash;`unavailable` 时可为空串。 */
48101
- upstreamHash: z21.string(),
48475
+ upstreamHash: z22.string(),
48102
48476
  /** 源 URL(用于在 UI 中展示来源)。 */
48103
- source: z21.string(),
48477
+ source: z22.string(),
48104
48478
  status: UpdateCheckStatusSchema,
48105
48479
  /** 失败 / 不可达时的原因(可选)。 */
48106
- error: z21.string().optional()
48480
+ error: z22.string().optional()
48107
48481
  });
48108
- UpdateCheckResultSchema = z21.object({
48109
- results: z21.array(UpdateCheckResultEntrySchema)
48482
+ UpdateCheckResultSchema = z22.object({
48483
+ results: z22.array(UpdateCheckResultEntrySchema)
48110
48484
  });
48111
- ApplyUpdateInputSchema = z21.object({
48485
+ ApplyUpdateInputSchema = z22.object({
48112
48486
  ...WorkspaceProviderTargetSchema.shape,
48113
- skillIds: z21.array(SkillIdSchema).min(1)
48487
+ skillIds: z22.array(SkillIdSchema).min(1)
48114
48488
  });
48115
- ApplyUpdateStatusSchema = z21.enum([
48489
+ ApplyUpdateStatusSchema = z22.enum([
48116
48490
  /** 重装成功且 hash 已刷新。 */
48117
48491
  "updated",
48118
48492
  /** 执行前已与上游一致,未实际重装。 */
@@ -48120,22 +48494,22 @@ var init_skills_update = __esm({
48120
48494
  /** 重装或 hash 刷新失败。 */
48121
48495
  "failed"
48122
48496
  ]);
48123
- ApplyUpdateResultEntrySchema = z21.object({
48497
+ ApplyUpdateResultEntrySchema = z22.object({
48124
48498
  skillId: SkillIdSchema,
48125
- name: z21.string(),
48499
+ name: z22.string(),
48126
48500
  status: ApplyUpdateStatusSchema,
48127
48501
  /** 失败原因(可选)。 */
48128
- error: z21.string().optional()
48502
+ error: z22.string().optional()
48129
48503
  });
48130
- ApplyUpdateResultSchema = z21.object({
48131
- results: z21.array(ApplyUpdateResultEntrySchema)
48504
+ ApplyUpdateResultSchema = z22.object({
48505
+ results: z22.array(ApplyUpdateResultEntrySchema)
48132
48506
  });
48133
48507
  }
48134
48508
  });
48135
48509
 
48136
48510
  // src/shared/rpc-contract.ts
48137
48511
  import { oc } from "@orpc/contract";
48138
- import { z as z22 } from "zod";
48512
+ import { z as z23 } from "zod";
48139
48513
  var WorkspaceProviderReadInputSchema, SkillsListInputSchema, SkillsInfoInputSchema, SkillsToggleInputSchema, WorkspaceAddInputSchema, WorkspaceRemoveInputSchema, WorkspaceSetActiveInputSchema, CreatorRemoveInputSchema, RepositoryScanInputSchema, RepositoryPreviewInputSchema, rpcContract;
48140
48514
  var init_rpc_contract = __esm({
48141
48515
  "src/shared/rpc-contract.ts"() {
@@ -48154,42 +48528,42 @@ var init_rpc_contract = __esm({
48154
48528
  init_skill_intelligence();
48155
48529
  init_skills();
48156
48530
  init_workspaces();
48157
- WorkspaceProviderReadInputSchema = z22.object({
48531
+ WorkspaceProviderReadInputSchema = z23.object({
48158
48532
  ...WorkspaceProviderTargetSchema.shape,
48159
- includeDisabled: z22.boolean().optional()
48533
+ includeDisabled: z23.boolean().optional()
48160
48534
  });
48161
48535
  SkillsListInputSchema = WorkspaceProviderReadInputSchema;
48162
48536
  SkillsInfoInputSchema = WorkspaceProviderReadInputSchema.extend({
48163
48537
  skillId: SkillIdSchema
48164
48538
  });
48165
- SkillsToggleInputSchema = z22.object({
48539
+ SkillsToggleInputSchema = z23.object({
48166
48540
  ...WorkspaceProviderTargetSchema.shape,
48167
- skillIds: z22.array(SkillIdSchema).min(1),
48168
- mode: z22.enum(["enable", "disable"])
48541
+ skillIds: z23.array(SkillIdSchema).min(1),
48542
+ mode: z23.enum(["enable", "disable"])
48169
48543
  });
48170
- WorkspaceAddInputSchema = z22.object({
48171
- path: z22.string().trim().min(1),
48172
- label: z22.string().trim().min(1).optional()
48544
+ WorkspaceAddInputSchema = z23.object({
48545
+ path: z23.string().trim().min(1),
48546
+ label: z23.string().trim().min(1).optional()
48173
48547
  });
48174
- WorkspaceRemoveInputSchema = z22.object({ id: ImportedWorkspaceIdSchema });
48175
- WorkspaceSetActiveInputSchema = z22.object({ id: WorkspaceIdSchema });
48176
- CreatorRemoveInputSchema = z22.object({
48548
+ WorkspaceRemoveInputSchema = z23.object({ id: ImportedWorkspaceIdSchema });
48549
+ WorkspaceSetActiveInputSchema = z23.object({ id: WorkspaceIdSchema });
48550
+ CreatorRemoveInputSchema = z23.object({
48177
48551
  ...WorkspaceProviderTargetSchema.shape,
48178
48552
  skillId: SkillIdSchema,
48179
- expectedRevision: z22.string().regex(/^sha256:[a-f0-9]{64}$/)
48553
+ expectedRevision: z23.string().regex(/^sha256:[a-f0-9]{64}$/)
48180
48554
  });
48181
- RepositoryScanInputSchema = z22.object({
48182
- source: z22.string().trim().min(1),
48183
- ref: z22.string().trim().min(1).optional()
48555
+ RepositoryScanInputSchema = z23.object({
48556
+ source: z23.string().trim().min(1),
48557
+ ref: z23.string().trim().min(1).optional()
48184
48558
  });
48185
- RepositoryPreviewInputSchema = z22.object({
48559
+ RepositoryPreviewInputSchema = z23.object({
48186
48560
  sessionId: RepositorySessionIdSchema,
48187
48561
  skillId: RemoteSkillIdSchema
48188
48562
  });
48189
48563
  rpcContract = oc.errors(RpcErrorDefinitions).router({
48190
48564
  skills: {
48191
48565
  /** Discover skills within one explicit Workspace Provider. */
48192
- list: oc.input(SkillsListInputSchema).output(z22.object({ skills: z22.array(SkillMetadataSchema) })),
48566
+ list: oc.input(SkillsListInputSchema).output(z23.object({ skills: z23.array(SkillMetadataSchema) })),
48193
48567
  /** Read one Workspace Provider-scoped skill document. */
48194
48568
  info: oc.input(SkillsInfoInputSchema).output(SkillInfoSchema),
48195
48569
  /** Enable or disable selected opaque skill IDs. */
@@ -48205,13 +48579,13 @@ var init_rpc_contract = __esm({
48205
48579
  },
48206
48580
  workspace: {
48207
48581
  /** List Global and imported Workspaces with fresh Provider counts. */
48208
- list: oc.input(z22.object({})).output(z22.object({ workspaces: z22.array(WorkspaceSchema) })),
48582
+ list: oc.input(z23.object({})).output(z23.object({ workspaces: z23.array(WorkspaceSchema) })),
48209
48583
  /** Import a canonical directory workspace. */
48210
- add: oc.input(WorkspaceAddInputSchema).output(z22.object({ workspace: WorkspaceSchema })),
48584
+ add: oc.input(WorkspaceAddInputSchema).output(z23.object({ workspace: WorkspaceSchema })),
48211
48585
  /** Remove an imported workspace registration. */
48212
- remove: oc.input(WorkspaceRemoveInputSchema).output(z22.object({ activeId: WorkspaceIdSchema })),
48586
+ remove: oc.input(WorkspaceRemoveInputSchema).output(z23.object({ activeId: WorkspaceIdSchema })),
48213
48587
  /** Select the active workspace. */
48214
- setActive: oc.input(WorkspaceSetActiveInputSchema).output(z22.object({ activeId: WorkspaceIdSchema }))
48588
+ setActive: oc.input(WorkspaceSetActiveInputSchema).output(z23.object({ activeId: WorkspaceIdSchema }))
48215
48589
  },
48216
48590
  creator: {
48217
48591
  /** Create or revision-check and update a skill. */
@@ -48219,7 +48593,7 @@ var init_rpc_contract = __esm({
48219
48593
  /** Load an editable skill document. */
48220
48594
  load: oc.input(SkillsInfoInputSchema).output(SkillDocumentSchema),
48221
48595
  /** Revision-check and delete one skill. */
48222
- remove: oc.input(CreatorRemoveInputSchema).output(z22.object({ removed: z22.literal(true) })),
48596
+ remove: oc.input(CreatorRemoveInputSchema).output(z23.object({ removed: z23.literal(true) })),
48223
48597
  /** Read revision history for one skill (change 5: change log sub-view). */
48224
48598
  revisions: oc.input(CreatorRevisionsInputSchema).output(CreatorRevisionsResultSchema)
48225
48599
  },
@@ -48232,29 +48606,29 @@ var init_rpc_contract = __esm({
48232
48606
  install: oc.input(RepositoryInstallInputSchema).output(InstallResultSchema),
48233
48607
  sources: {
48234
48608
  /** List curated (built-in) and user-persisted sources for the Discover grid. */
48235
- list: oc.input(z22.object({})).output(
48236
- z22.object({
48237
- builtIn: z22.array(
48238
- z22.object({
48239
- id: z22.string(),
48240
- label: z22.string(),
48241
- gitUrl: z22.string(),
48242
- description: z22.string(),
48243
- homepage: z22.string().optional()
48609
+ list: oc.input(z23.object({})).output(
48610
+ z23.object({
48611
+ builtIn: z23.array(
48612
+ z23.object({
48613
+ id: z23.string(),
48614
+ label: z23.string(),
48615
+ gitUrl: z23.string(),
48616
+ description: z23.string(),
48617
+ homepage: z23.string().optional()
48244
48618
  })
48245
48619
  ),
48246
- user: z22.array(UserSourceSchema)
48620
+ user: z23.array(UserSourceSchema)
48247
48621
  })
48248
48622
  ),
48249
48623
  /** Persist a new user source (https git URL only). */
48250
- add: oc.input(AddUserSourceInputSchema).output(z22.object({ source: UserSourceSchema })),
48624
+ add: oc.input(AddUserSourceInputSchema).output(z23.object({ source: UserSourceSchema })),
48251
48625
  /** Remove one user-persisted source; built-in ids are rejected. */
48252
- remove: oc.input(RemoveUserSourceInputSchema).output(z22.object({ removed: z22.literal(true) }))
48626
+ remove: oc.input(RemoveUserSourceInputSchema).output(z23.object({ removed: z23.literal(true) }))
48253
48627
  }
48254
48628
  },
48255
48629
  daemon: {
48256
48630
  /** Read the live daemon and tray status. */
48257
- status: oc.input(z22.object({})).output(DaemonStatusSchema)
48631
+ status: oc.input(z23.object({})).output(DaemonStatusSchema)
48258
48632
  },
48259
48633
  skillIntelligence: {
48260
48634
  /** Read-only multi-skill analysis locked to observed revisions. */
@@ -48262,7 +48636,7 @@ var init_rpc_contract = __esm({
48262
48636
  /** Store a Manager-owned proposal draft; never mutates Providers. */
48263
48637
  propose: oc.input(ProposeInputSchema).output(ProposeResultSchema),
48264
48638
  /** List pending proposal drafts (newest first). */
48265
- list: oc.input(z22.object({})).output(ListProposalsResultSchema),
48639
+ list: oc.input(z23.object({})).output(ListProposalsResultSchema),
48266
48640
  /** Delete one proposal draft. */
48267
48641
  reject: oc.input(RejectProposalInputSchema).output(RejectProposalResultSchema),
48268
48642
  /** Apply one proposal through existing revision-safe mutations. */
@@ -48270,9 +48644,9 @@ var init_rpc_contract = __esm({
48270
48644
  },
48271
48645
  steward: {
48272
48646
  /** Probe every registered backend (typed unavailable; no auto fallback). */
48273
- backends: oc.input(z22.object({})).output(StewardBackendsResultSchema),
48647
+ backends: oc.input(z23.object({})).output(StewardBackendsResultSchema),
48274
48648
  /** List steward runs (newest first, bounded). */
48275
- list: oc.input(z22.object({})).output(StewardListResultSchema),
48649
+ list: oc.input(z23.object({})).output(StewardListResultSchema),
48276
48650
  /** Start a steward run on an explicit backend and Imported Workspace.Provider. */
48277
48651
  start: oc.input(StewardStartInputSchema).output(StewardStartResultSchema),
48278
48652
  /** Poll normalized run events after a seq cursor. */
@@ -48307,16 +48681,16 @@ var init_rpc_contract = __esm({
48307
48681
  },
48308
48682
  /** MCP mutation proposal 审批链(task 4.4;Manager authority 的决定面)。 */
48309
48683
  proposals: {
48310
- list: oc.input(z22.object({})).output(z22.object({ proposals: z22.array(AgentMcpProposalViewSchema) })),
48311
- approve: oc.input(AgentProposalDecisionInputSchema).output(z22.object({ proposal: AgentMcpProposalViewSchema })),
48312
- reject: oc.input(AgentProposalDecisionInputSchema).output(z22.object({ proposal: AgentMcpProposalViewSchema }))
48684
+ list: oc.input(z23.object({})).output(z23.object({ proposals: z23.array(AgentMcpProposalViewSchema) })),
48685
+ approve: oc.input(AgentProposalDecisionInputSchema).output(z23.object({ proposal: AgentMcpProposalViewSchema })),
48686
+ reject: oc.input(AgentProposalDecisionInputSchema).output(z23.object({ proposal: AgentMcpProposalViewSchema }))
48313
48687
  },
48314
48688
  /** 面板会话:内核 agent 会话的生命周期投影(task 2.2;旧 dsh.* 收敛并入)。 */
48315
48689
  sessions: {
48316
48690
  /** 列出内核 live 会话(含非面板会话的 disposed 投影)。 */
48317
- list: oc.input(z22.object({})).output(z22.object({ sessions: z22.array(AgentSessionSummarySchema) })),
48691
+ list: oc.input(z23.object({})).output(z23.object({ sessions: z23.array(AgentSessionSummarySchema) })),
48318
48692
  /** 脱敏 run/session 帧查询(原 dsh.sessions.streams 平移;steward 投影消费)。 */
48319
- streams: oc.input(AgentSessionsStreamsInputSchema).output(z22.object({ frames: z22.array(DshSessionStreamFrameSchema) })),
48693
+ streams: oc.input(AgentSessionsStreamsInputSchema).output(z23.object({ frames: z23.array(DshSessionStreamFrameSchema) })),
48320
48694
  /**
48321
48695
  * 清理面板会话转录(R14-C):按保留天数 / 全量 / 显式 ID 删除产品转录层
48322
48696
  * (sessions/YYYY/MM/DD),running 会话跳过;不触碰 $DSH_HOME 内核日志。
@@ -48338,6 +48712,16 @@ var init_rpc_contract = __esm({
48338
48712
  * 下一次 prompt 以新模式 setup 复活,历史由内核 session log 保留)。 */
48339
48713
  setMode: oc.input(AgentSessionSetModeInputSchema).output(AgentSessionSetModeResultSchema)
48340
48714
  },
48715
+ /**
48716
+ * 内核 inbox 队列面(C2):queue 真相在 ReactLoopInbox;list 投影待处理项,
48717
+ * update 执行行级 edit/remove/steer(官方 updateQueue 语义)。
48718
+ */
48719
+ queue: {
48720
+ /** 待处理项(非 live 会话 = 空 items;live next-step + next-turn 有序)。 */
48721
+ list: oc.input(AgentQueueListInputSchema).output(AgentQueueListResultSchema),
48722
+ /** 行级操作;messageId 已消费 = typed NOT_FOUND(竞态可见)。 */
48723
+ update: oc.input(AgentQueueUpdateInputSchema).output(AgentQueueUpdateResultSchema)
48724
+ },
48341
48725
  /**
48342
48726
  * 后端文件选择器(R17-B):真实路径浏览 + 单文件预览。用户本机自由浏览是
48343
48727
  * 功能目的(读面,无 Workspace containment);prompt 附件 path 通道在
@@ -48349,16 +48733,16 @@ var init_rpc_contract = __esm({
48349
48733
  /** 单文件预览:图片缩略(jSquash)/ 文本头 / 二进制名投影。 */
48350
48734
  preview: oc.input(AgentFilesPreviewInputSchema).output(AgentFilesPreviewResultSchema),
48351
48735
  /** 原生文件选择(R18 @xmorse/rfd):mode 预置 filter;空 = 取消。 */
48352
- pickFiles: oc.input(z22.object({ mode: z22.enum(["image", "file"]) })).output(z22.object({ paths: z22.array(z22.string().min(1)) }))
48736
+ pickFiles: oc.input(z23.object({ mode: z23.enum(["image", "file"]) })).output(z23.object({ paths: z23.array(z23.string().min(1)) }))
48353
48737
  },
48354
48738
  /** pi-ai 装配目录(models.dev 镜像)投影:全量 provider 画廊(filter 在 UI)。 */
48355
48739
  models: {
48356
- catalog: oc.input(z22.object({})).output(z22.object({ providers: z22.array(ModelProviderCatalogEntrySchema) }))
48740
+ catalog: oc.input(z23.object({})).output(z23.object({ providers: z23.array(ModelProviderCatalogEntrySchema) }))
48357
48741
  },
48358
48742
  /** model/preset/permission/approval 投影(原 dsh.settings 平移)。 */
48359
48743
  settings: {
48360
48744
  /** 当前 settings 投影 + provider 凭据(apiKey 按 R16 用户裁决回显)。 */
48361
- get: oc.input(z22.object({})).output(DshStewardSettingsViewSchema),
48745
+ get: oc.input(z23.object({})).output(DshStewardSettingsViewSchema),
48362
48746
  /** 应用补丁;revision 只在真实变更时 +1;类型化 rejected 见契约 union。 */
48363
48747
  update: oc.input(DshSettingsUpdateSchema).output(DshSettingsUpdateResultSchema),
48364
48748
  /**
@@ -48383,13 +48767,13 @@ var init_rpc_contract = __esm({
48383
48767
  /** List ACP-capable agents installed on this machine (daemon-lifetime cached). */
48384
48768
  agents: {
48385
48769
  /** Probe known PATH binaries and return their availability projection. */
48386
- list: oc.input(z22.object({})).output(z22.object({ agents: z22.array(AcpAgentInfoSchema) }))
48770
+ list: oc.input(z23.object({})).output(z23.object({ agents: z23.array(AcpAgentInfoSchema) }))
48387
48771
  },
48388
48772
  session: {
48389
48773
  /** Spawn the selected agent subprocess and register a daemon-owned session. */
48390
48774
  open: oc.input(AcpSessionOpenInputSchema).output(AcpSessionOpenResultSchema),
48391
48775
  /** Terminate the agent subprocess for one session (idempotent). */
48392
- close: oc.input(AcpSessionCloseInputSchema).output(z22.object({ closed: z22.literal(true) }))
48776
+ close: oc.input(AcpSessionCloseInputSchema).output(z23.object({ closed: z23.literal(true) }))
48393
48777
  }
48394
48778
  }
48395
48779
  });
@@ -48397,7 +48781,7 @@ var init_rpc_contract = __esm({
48397
48781
  });
48398
48782
 
48399
48783
  // src/daemon/capability/domain-capabilities.ts
48400
- import { z as z23 } from "zod";
48784
+ import { z as z24 } from "zod";
48401
48785
  function toResult(error) {
48402
48786
  if (error instanceof DomainError) {
48403
48787
  return { kind: "failed", code: error.code, message: error.message };
@@ -48612,7 +48996,7 @@ var init_domain_capabilities = __esm({
48612
48996
  init_creator();
48613
48997
  init_skills_update();
48614
48998
  init_repository();
48615
- none = z23.object({});
48999
+ none = z24.object({});
48616
49000
  }
48617
49001
  });
48618
49002
 
@@ -49784,7 +50168,7 @@ var init_provider_roots = __esm({
49784
50168
 
49785
50169
  // src/daemon/workspace-registry/state.ts
49786
50170
  import path24 from "node:path";
49787
- import { z as z24 } from "zod";
50171
+ import { z as z25 } from "zod";
49788
50172
  function emptyRegistryState() {
49789
50173
  return { schemaVersion: 2, activeId: GLOBAL_WORKSPACE_ID, workspaces: [] };
49790
50174
  }
@@ -49826,15 +50210,15 @@ var init_state = __esm({
49826
50210
  "use strict";
49827
50211
  init_workspaces();
49828
50212
  init_path_safety();
49829
- StoredWorkspaceSchema = z24.object({
50213
+ StoredWorkspaceSchema = z25.object({
49830
50214
  id: ImportedWorkspaceIdSchema,
49831
- label: z24.string().trim().min(1),
49832
- path: z24.string().min(1).refine(path24.isAbsolute, "Workspace path must be absolute.").refine((value) => path24.normalize(value) === value, "Workspace path must be normalized.")
50215
+ label: z25.string().trim().min(1),
50216
+ path: z25.string().min(1).refine(path24.isAbsolute, "Workspace path must be absolute.").refine((value) => path24.normalize(value) === value, "Workspace path must be normalized.")
49833
50217
  }).strict();
49834
- WorkspaceRegistryStateSchema = z24.object({
49835
- schemaVersion: z24.literal(2),
50218
+ WorkspaceRegistryStateSchema = z25.object({
50219
+ schemaVersion: z25.literal(2),
49836
50220
  activeId: WorkspaceIdSchema,
49837
- workspaces: z24.array(StoredWorkspaceSchema)
50221
+ workspaces: z25.array(StoredWorkspaceSchema)
49838
50222
  }).strict().superRefine((state, context) => {
49839
50223
  const ids = /* @__PURE__ */ new Set();
49840
50224
  const paths = /* @__PURE__ */ new Set();
@@ -50205,7 +50589,7 @@ var domain_exports = {};
50205
50589
  __export(domain_exports, {
50206
50590
  createDaemonDomain: () => createDaemonDomain
50207
50591
  });
50208
- import { join as join2 } from "node:path";
50592
+ import { join as join3 } from "node:path";
50209
50593
  function defaultStewardAdapters() {
50210
50594
  const adapters = [createCodexAppServerAdapter()];
50211
50595
  if (process.env.SKILL_CREATOR_STEWARD_ENABLE_FIXTURE === "1") {
@@ -50216,8 +50600,11 @@ function defaultStewardAdapters() {
50216
50600
  function createDaemonDomain(workspaces = createWorkspaceRegistry(), options2 = {}) {
50217
50601
  const kernelHostRef = { handle: null };
50218
50602
  const dshSettings = createDshSettingsService();
50219
- const agentTranscripts = createSessionTranscripts(join2(appDir(), "sessions"));
50603
+ const agentTranscripts = createSessionTranscripts(join3(appDir(), "sessions"));
50220
50604
  const modelCatalog = createModelCatalogService();
50605
+ const agentFiles = createAgentFilesService();
50606
+ const skillsCliProbe = options2.skillsCliProbe ?? createSkillsCliProbe();
50607
+ const skills = createSkillService(workspaces, { skillsCliProbe });
50221
50608
  const agentSessions = createAgentSessionsService({
50222
50609
  kernel: () => kernelHostRef.handle,
50223
50610
  modelSelection: async () => (await dshSettings.getView()).settings.model,
@@ -50230,10 +50617,25 @@ function createDaemonDomain(workspaces = createWorkspaceRegistry(), options2 = {
50230
50617
  if (entry === void 0) return null;
50231
50618
  return { contextWindow: entry.contextWindow, maxOutputTokens: entry.maxOutputTokens };
50232
50619
  },
50233
- transcripts: agentTranscripts
50620
+ transcripts: agentTranscripts,
50621
+ expandFileReferences: (references) => agentFiles.resolvePromptReferences({ references }),
50622
+ // skill-refs C1:`$` 引用展开——registry 作用域解析 + 文档读取在 skills 服务
50623
+ //(NOT_FOUND 随 resolveSkill typed 抛出);内容截断对齐 file 引用(200k chars)。
50624
+ expandSkillReferences: async (references) => {
50625
+ const blocks = [];
50626
+ for (const reference of references) {
50627
+ const info3 = await skills.info(
50628
+ { workspaceId: reference.workspaceId, providerId: reference.providerId },
50629
+ reference.skillId
50630
+ );
50631
+ blocks.push(
50632
+ `[reference: skill ${info3.name} \xB7 ${info3.provider}]
50633
+ ${info3.content.slice(0, 2e5)}`
50634
+ );
50635
+ }
50636
+ return blocks;
50637
+ }
50234
50638
  });
50235
- const skillsCliProbe = options2.skillsCliProbe ?? createSkillsCliProbe();
50236
- const skills = createSkillService(workspaces, { skillsCliProbe });
50237
50639
  const repository = createRepositoryService(workspaces, skills);
50238
50640
  const creator = createCreatorService(workspaces, skills);
50239
50641
  const skillIntelligence = createSkillIntelligenceService(skills, creator);
@@ -50253,7 +50655,7 @@ function createDaemonDomain(workspaces = createWorkspaceRegistry(), options2 = {
50253
50655
  skillSteward: createSkillStewardPipelineService({ workspaces, skills, creator }),
50254
50656
  dshSettings,
50255
50657
  agentSessions,
50256
- agentFiles: createAgentFilesService(),
50658
+ agentFiles,
50257
50659
  modelCatalog,
50258
50660
  setKernelHost: (handle) => {
50259
50661
  kernelHostRef.handle = handle;
@@ -50309,7 +50711,8 @@ __export(skill_creator_mcp_exports, {
50309
50711
  createSkillCreatorMcpServer: () => createSkillCreatorMcpServer,
50310
50712
  mcpToolName: () => mcpToolName
50311
50713
  });
50312
- import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
50714
+ import { McpServer, ResourceTemplate } from "@modelcontextprotocol/server";
50715
+ import { z as z26 } from "zod";
50313
50716
  function mcpToolName(capabilityName) {
50314
50717
  return capabilityName.replace(/\./g, "_");
50315
50718
  }
@@ -50369,16 +50772,20 @@ function createSkillCreatorMcpServer(deps) {
50369
50772
  ]
50370
50773
  });
50371
50774
  if (shape2) {
50372
- server.tool(
50775
+ server.registerTool(
50373
50776
  proposeName,
50374
- `Propose: ${descriptor.description} A human approves it in the Skill Creator UI before execution.`,
50375
- shape2,
50777
+ {
50778
+ description: `Propose: ${descriptor.description} A human approves it in the Skill Creator UI before execution.`,
50779
+ inputSchema: z26.object(shape2)
50780
+ },
50376
50781
  async (args) => proposeResult(deps.proposals.create(descriptor.name, args))
50377
50782
  );
50378
50783
  } else {
50379
- server.tool(
50784
+ server.registerTool(
50380
50785
  proposeName,
50381
- `Propose: ${descriptor.description} A human approves it in the Skill Creator UI before execution.`,
50786
+ {
50787
+ description: `Propose: ${descriptor.description} A human approves it in the Skill Creator UI before execution.`
50788
+ },
50382
50789
  async () => proposeResult(deps.proposals.create(descriptor.name, void 0))
50383
50790
  );
50384
50791
  }
@@ -50389,10 +50796,9 @@ function createSkillCreatorMcpServer(deps) {
50389
50796
  const shape = input && typeof input.shape === "object" ? input.shape : null;
50390
50797
  const toolName = mcpToolName(descriptor.name);
50391
50798
  if (shape) {
50392
- server.tool(
50799
+ server.registerTool(
50393
50800
  toolName,
50394
- descriptor.description,
50395
- shape,
50801
+ { description: descriptor.description, inputSchema: z26.object(shape) },
50396
50802
  async (args) => withCard(
50397
50803
  descriptor.name,
50398
50804
  await deps.capabilities.call(descriptor.name, args, MCP_PRINCIPAL),
@@ -50400,9 +50806,9 @@ function createSkillCreatorMcpServer(deps) {
50400
50806
  )
50401
50807
  );
50402
50808
  } else {
50403
- server.tool(
50809
+ server.registerTool(
50404
50810
  toolName,
50405
- descriptor.description,
50811
+ { description: descriptor.description },
50406
50812
  async () => withCard(
50407
50813
  descriptor.name,
50408
50814
  await deps.capabilities.call(descriptor.name, void 0, MCP_PRINCIPAL),
@@ -51126,21 +51532,18 @@ async function main() {
51126
51532
  return COMMANDS[command].run();
51127
51533
  }
51128
51534
  async function runMcpStdio() {
51129
- const { StdioServerTransport: StdioServerTransport2 } = await import("@modelcontextprotocol/sdk/server/stdio.js");
51535
+ const { serveStdio } = await import("@modelcontextprotocol/server/stdio");
51130
51536
  const { createDaemonDomain: createDaemonDomain2 } = await Promise.resolve().then(() => (init_domain(), domain_exports));
51131
51537
  const { createSkillCreatorMcpServer: createSkillCreatorMcpServer2 } = await Promise.resolve().then(() => (init_skill_creator_mcp(), skill_creator_mcp_exports));
51132
51538
  const domain = createDaemonDomain2();
51133
- const server = createSkillCreatorMcpServer2({
51134
- capabilities: domain.managerCapabilities,
51135
- cards: domain.uiCards,
51136
- face: "stdio"
51137
- });
51138
- const transport = new StdioServerTransport2();
51139
- await server.connect(transport);
51140
51539
  console.error("skill-creator mcp: stdio server ready (readonly face)");
51141
- process.on("SIGINT", () => {
51142
- void server.close().finally(() => process.exit(0));
51143
- });
51540
+ await serveStdio(
51541
+ () => createSkillCreatorMcpServer2({
51542
+ capabilities: domain.managerCapabilities,
51543
+ cards: domain.uiCards,
51544
+ face: "stdio"
51545
+ })
51546
+ );
51144
51547
  }
51145
51548
  void main().then((code) => process.exit(code)).catch((err) => {
51146
51549
  console.error(err instanceof Error ? err.message : String(err));