@dadado/agent-kit-cli 6.11.0 → 6.13.1

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 (50) hide show
  1. package/dashboard/dashboard-data.mjs +19 -3
  2. package/dashboard/lib/live-refresh.mjs +1 -0
  3. package/dashboard/lib/workspace-docs.d.mts +49 -0
  4. package/dashboard/lib/workspace-docs.mjs +231 -0
  5. package/dist/{add-P4DIZKC2.js → add-FTPXOOZD.js} +3 -3
  6. package/dist/{chunk-SZ5REXPD.js → chunk-2KATW2O4.js} +2 -2
  7. package/dist/{chunk-BOZUBCQA.js → chunk-2TKPKRHO.js} +2 -2
  8. package/dist/{chunk-2KIOZMTV.js → chunk-4PL57BZ5.js} +4 -0
  9. package/dist/{chunk-2B3HHQ3L.js → chunk-6QBU4DQF.js} +3 -3
  10. package/dist/{chunk-47ZJ3S7M.js → chunk-A4PHFHYO.js} +5 -1
  11. package/dist/{chunk-VWDFMXFK.js → chunk-AEUE74EZ.js} +5 -5
  12. package/dist/{chunk-5D5BJZW5.js → chunk-CFJRCJWD.js} +15 -5
  13. package/dist/{chunk-AOSXKF3M.js → chunk-CRLMS2JX.js} +1 -1
  14. package/dist/{chunk-H3PQYVFT.js → chunk-DONKV6MA.js} +2 -2
  15. package/dist/{chunk-7T4MDNV3.js → chunk-DQLIEJFK.js} +1 -1
  16. package/dist/{chunk-5KDMATUR.js → chunk-EE3LTOBZ.js} +1 -1
  17. package/dist/{chunk-5TEXYAGP.js → chunk-GDKTTV2A.js} +4 -2
  18. package/dist/{chunk-UGJ3YAT2.js → chunk-GYPCR4UO.js} +11 -7
  19. package/dist/{chunk-Q4J5UXVQ.js → chunk-JGEGTOF6.js} +1 -1
  20. package/dist/{chunk-FTLMWPQY.js → chunk-JRCI2GNS.js} +1 -1
  21. package/dist/{chunk-FQNAEFTW.js → chunk-LQJNGECA.js} +2 -1
  22. package/dist/{chunk-UQSFGLY5.js → chunk-N7HMTWS5.js} +4 -4
  23. package/dist/{chunk-KHFPPQJ5.js → chunk-NDKSOPP7.js} +3 -2
  24. package/dist/{chunk-6GM5YUWR.js → chunk-OVRWRZ5S.js} +2 -2
  25. package/dist/{chunk-MAXEVJCP.js → chunk-PHH3H5EQ.js} +1 -1
  26. package/dist/{chunk-CAOQBBP5.js → chunk-PXURVVVO.js} +2 -2
  27. package/dist/{chunk-S4T6KYYA.js → chunk-SKC6QZW4.js} +46 -10
  28. package/dist/{chunk-YN5NBMQT.js → chunk-W6U3Z2RU.js} +8 -8
  29. package/dist/{chunk-JPAQOESJ.js → chunk-WRCXRV2U.js} +29 -5
  30. package/dist/{chunk-LFWPB2JR.js → chunk-ZFJIJUZ4.js} +1 -0
  31. package/dist/{commands-F437QCGQ.js → commands-MVUJZEJ6.js} +6 -6
  32. package/dist/{contribute-G5DFZCH6.js → contribute-EKTMMEYU.js} +5 -5
  33. package/dist/{countdown-6SP7IEJ3.js → countdown-TFKPAYIQ.js} +7 -7
  34. package/dist/{diff-VCVSR4OV.js → diff-RFW6K4X5.js} +6 -6
  35. package/dist/{doctor-5LPPWRPI.js → doctor-3KNZI3CK.js} +10 -10
  36. package/dist/{engine-info-LEE37RRK.js → engine-info-CYDRD7SW.js} +2 -2
  37. package/dist/{ground-control-IJ5NQVLP.js → ground-control-DB5RSYAT.js} +4 -4
  38. package/dist/{guard-X6FNFZ27.js → guard-RJZEEKSL.js} +50 -8
  39. package/dist/{hook-A22PNYY2.js → hook-VXHZ4ICK.js} +6 -6
  40. package/dist/index.js +23 -23
  41. package/dist/{init-VCOMQ32C.js → init-BDWKZGMP.js} +13 -13
  42. package/dist/{install-YXOE2U6T.js → install-NXNO4RTU.js} +13 -13
  43. package/dist/{mission-control-C2QV5D25.js → mission-control-JIF6GFSV.js} +1 -1
  44. package/dist/{queue-Q2LEPXSY.js → queue-VLIWWVKM.js} +7 -7
  45. package/dist/{run-BOWCPU56.js → run-NKCDKMTC.js} +12 -12
  46. package/dist/{run-plan-P65QMVCS.js → run-plan-3PCINKTY.js} +7 -7
  47. package/dist/{setup-global-QEEW7ASU.js → setup-global-K53H3ZEH.js} +7 -7
  48. package/dist/{status-WGO2O7TR.js → status-GFV3KCUR.js} +8 -8
  49. package/dist/{update-LV335HJU.js → update-25WSBSWM.js} +11 -11
  50. package/package.json +2 -2
@@ -8,24 +8,24 @@ import {
8
8
  createDriverEmitter,
9
9
  driverReplies,
10
10
  driverStop
11
- } from "./chunk-S4T6KYYA.js";
11
+ } from "./chunk-SKC6QZW4.js";
12
12
  import {
13
13
  detectAgentBackend
14
- } from "./chunk-5KDMATUR.js";
14
+ } from "./chunk-EE3LTOBZ.js";
15
15
  import {
16
16
  classifyGateExit,
17
17
  landGateExit
18
- } from "./chunk-BOZUBCQA.js";
18
+ } from "./chunk-2TKPKRHO.js";
19
19
  import {
20
20
  buildDispatchPrompt,
21
21
  ensureDispatchLogPath,
22
22
  readCommandFile,
23
23
  runHeadlessDispatch
24
- } from "./chunk-KHFPPQJ5.js";
24
+ } from "./chunk-NDKSOPP7.js";
25
25
  import {
26
26
  formatHitlSummary,
27
27
  hitlExitCode
28
- } from "./chunk-JPAQOESJ.js";
28
+ } from "./chunk-WRCXRV2U.js";
29
29
  import {
30
30
  HANDOFF_REL
31
31
  } from "./chunk-C4Q77GGJ.js";
@@ -138,15 +138,19 @@ async function landDispatchOutcome(opts) {
138
138
  async function runDispatchDriver(opts) {
139
139
  const root = path.resolve(opts.root);
140
140
  const emitter = createDriverEmitter(opts.events.write, opts.events.now);
141
+ const say = (message, level = "info") => emitter.emit({ type: "log", level, message });
141
142
  const reader = createDriverAnswerReader({
142
143
  input: opts.events.input,
143
144
  emitter,
144
- tick: () => DISPATCH_DRIVER_TICK
145
+ tick: () => DISPATCH_DRIVER_TICK,
146
+ onStopRequested: () => say(
147
+ `stop_after_tick received: ${opts.slash} has no tick boundary, so the session runs on until its next gate, which is not offered (the run ends there, exit 4). Send {"type":"stop"} at a gate or terminate the process to end it sooner.`,
148
+ "warn"
149
+ )
145
150
  });
146
151
  const writeErr = opts.events.writeErr ?? ((text) => {
147
152
  process.stderr.write(text);
148
153
  });
149
- const say = (message, level = "info") => emitter.emit({ type: "log", level, message });
150
154
  let ticks = 0;
151
155
  let queue = null;
152
156
  const finish = async (exitCode, reason, result) => {
@@ -7,7 +7,7 @@ import {
7
7
  assertRealParentContained,
8
8
  isRealWriteTargetContained,
9
9
  resolveContained
10
- } from "./chunk-47ZJ3S7M.js";
10
+ } from "./chunk-A4PHFHYO.js";
11
11
  import {
12
12
  ensureDir
13
13
  } from "./chunk-5B4DVO6C.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MANIFEST_RELATIVE_PATH
3
- } from "./chunk-7T4MDNV3.js";
3
+ } from "./chunk-DQLIEJFK.js";
4
4
  import {
5
5
  fileExists
6
6
  } from "./chunk-5B4DVO6C.js";
@@ -5,7 +5,7 @@ import {
5
5
  resolveContained,
6
6
  saveManagedHashLedger,
7
7
  shouldPreserveCustomizedOverlay
8
- } from "./chunk-47ZJ3S7M.js";
8
+ } from "./chunk-A4PHFHYO.js";
9
9
  import {
10
10
  ensureDir,
11
11
  fileExists
@@ -33,6 +33,7 @@ var MODEL_INVOCATION_DISABLED = /* @__PURE__ */ new Set([
33
33
  "kit-prod",
34
34
  "backlog-delete",
35
35
  "backlog-cancel",
36
+ "cancel-plan",
36
37
  "archive-plan",
37
38
  "hotfix",
38
39
  "run-plan-all"
@@ -2,10 +2,10 @@ import {
2
2
  compareSemver,
3
3
  normalizeSemver,
4
4
  readLocalKitVersion
5
- } from "./chunk-H3PQYVFT.js";
5
+ } from "./chunk-DONKV6MA.js";
6
6
  import {
7
7
  L0_ARTIFACTS
8
- } from "./chunk-2KIOZMTV.js";
8
+ } from "./chunk-4PL57BZ5.js";
9
9
  import {
10
10
  copyRegistryFile,
11
11
  emptyStats,
@@ -15,11 +15,11 @@ import {
15
15
  mergeStats,
16
16
  recordOutcome,
17
17
  resolveProtectedGlobs
18
- } from "./chunk-7T4MDNV3.js";
18
+ } from "./chunk-DQLIEJFK.js";
19
19
  import {
20
20
  loadManagedHashLedger,
21
21
  saveManagedHashLedger
22
- } from "./chunk-47ZJ3S7M.js";
22
+ } from "./chunk-A4PHFHYO.js";
23
23
  import {
24
24
  KIT_PACKAGE_SPEC,
25
25
  KIT_VERSION
@@ -13,10 +13,10 @@ import {
13
13
  redactSecrets,
14
14
  resolveHitlRunOptions,
15
15
  spawnLogged
16
- } from "./chunk-5TEXYAGP.js";
16
+ } from "./chunk-GDKTTV2A.js";
17
17
  import {
18
18
  RESERVED_GATE_IDS
19
- } from "./chunk-JPAQOESJ.js";
19
+ } from "./chunk-WRCXRV2U.js";
20
20
  import {
21
21
  ensureLoopLogsDir,
22
22
  runnerStatePaths
@@ -37,6 +37,7 @@ var RUN_CATALOG = [
37
37
  "backlog-edit",
38
38
  "backlog-delete",
39
39
  "backlog-cancel",
40
+ "cancel-plan",
40
41
  "git-staging",
41
42
  "review-pack"
42
43
  ];
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  L0_ARTIFACTS
3
- } from "./chunk-2KIOZMTV.js";
3
+ } from "./chunk-4PL57BZ5.js";
4
4
  import {
5
5
  allSkills,
6
6
  loadPackManifest,
7
7
  loadRegistry,
8
8
  packMemberFileTargets,
9
9
  skillFileTargets
10
- } from "./chunk-7T4MDNV3.js";
10
+ } from "./chunk-DQLIEJFK.js";
11
11
 
12
12
  // src/lifecycle/targets.ts
13
13
  import path from "path";
@@ -5,7 +5,7 @@ import {
5
5
  DEFAULT_REGISTRY_REF,
6
6
  DEFAULT_REGISTRY_URL,
7
7
  resolveRegistryRoot
8
- } from "./chunk-7T4MDNV3.js";
8
+ } from "./chunk-DQLIEJFK.js";
9
9
 
10
10
  // src/lifecycle/resolve-cli.ts
11
11
  async function resolveRegistryFromCli(options) {
@@ -3,11 +3,11 @@ import {
3
3
  GUARD_SHELL_HOOK_MARKER,
4
4
  RESOLVE_AGENT_KIT_REL,
5
5
  SESSION_START_HOOK_MARKER
6
- } from "./chunk-Q4J5UXVQ.js";
6
+ } from "./chunk-JGEGTOF6.js";
7
7
  import {
8
8
  CLAUDE_COMMANDS_DIR_REL,
9
9
  discoverInstalledCommands
10
- } from "./chunk-FQNAEFTW.js";
10
+ } from "./chunk-LQJNGECA.js";
11
11
  import {
12
12
  findOnPath
13
13
  } from "./chunk-WGLPZXNU.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  formatHitlGateLine
3
- } from "./chunk-JPAQOESJ.js";
3
+ } from "./chunk-WRCXRV2U.js";
4
4
 
5
5
  // src/plan-loop/driver-events.ts
6
6
  import { createInterface } from "readline";
7
7
  import { StringDecoder } from "string_decoder";
8
8
  var DRIVER_PROTOCOL_MAJOR = 1;
9
- var DRIVER_PROTOCOL_VERSION = "1.3.0";
9
+ var DRIVER_PROTOCOL_VERSION = "1.5.0";
10
10
  var DRIVER_EVENTS_FORMATS = ["ndjson"];
11
11
  var INBOUND_MAX_CHARS = 64 * 1024;
12
12
  var AGENT_PENDING_MAX_CHARS = 4 * 1024 * 1024;
@@ -38,6 +38,7 @@ function driverReplies(replies) {
38
38
  function driverStop(stop) {
39
39
  return stop ? { askId: stop.askId, cause: stop.cause, message: stop.message, exitCode: stop.exitCode } : null;
40
40
  }
41
+ var STOPPED_BY_REQUEST_REASON = "stopped by request";
41
42
  function parseDriverInbound(line) {
42
43
  const text = line.trim();
43
44
  if (text.length > INBOUND_MAX_CHARS) return { ok: false, error: "line too long" };
@@ -54,10 +55,13 @@ function parseDriverInbound(line) {
54
55
  if (msg.v !== void 0 && msg.v !== DRIVER_PROTOCOL_MAJOR) {
55
56
  return { ok: false, error: `unsupported protocol v${String(msg.v)}` };
56
57
  }
57
- if (msg.type === "stop") {
58
+ if (msg.type === "stop" || msg.type === "stop_after_tick") {
58
59
  return {
59
60
  ok: true,
60
- message: { type: "stop", ...typeof msg.reason === "string" ? { reason: msg.reason } : {} }
61
+ message: {
62
+ type: msg.type,
63
+ ...typeof msg.reason === "string" ? { reason: msg.reason } : {}
64
+ }
61
65
  };
62
66
  }
63
67
  if (msg.type !== "hitl_reply")
@@ -65,14 +69,24 @@ function parseDriverInbound(line) {
65
69
  if (typeof msg.askId !== "string" || !/^[a-z0-9-]+$/.test(msg.askId)) {
66
70
  return { ok: false, error: "hitl_reply.askId must be a kebab-case string" };
67
71
  }
72
+ if (msg.source !== void 0 && msg.source !== "operator" && msg.source !== "policy") {
73
+ return { ok: false, error: 'hitl_reply.source must be "operator" or "policy"' };
74
+ }
75
+ const source = msg.source === "policy" ? { source: "policy" } : {};
68
76
  if (typeof msg.reply === "number") {
69
77
  if (!Number.isInteger(msg.reply) || msg.reply < 1) {
70
78
  return { ok: false, error: "hitl_reply.reply number must be a positive integer" };
71
79
  }
72
- return { ok: true, message: { type: "hitl_reply", askId: msg.askId, reply: msg.reply } };
80
+ return {
81
+ ok: true,
82
+ message: { type: "hitl_reply", askId: msg.askId, reply: msg.reply, ...source }
83
+ };
73
84
  }
74
85
  if (typeof msg.reply === "string" && msg.reply.trim() && !/[\r\n]/.test(msg.reply)) {
75
- return { ok: true, message: { type: "hitl_reply", askId: msg.askId, reply: msg.reply.trim() } };
86
+ return {
87
+ ok: true,
88
+ message: { type: "hitl_reply", askId: msg.askId, reply: msg.reply.trim(), ...source }
89
+ };
76
90
  }
77
91
  return { ok: false, error: "hitl_reply.reply must be a number or a one-line non-empty string" };
78
92
  }
@@ -80,6 +94,9 @@ function inboundToRawAnswer(gate, parsed) {
80
94
  if (!parsed.ok) return { kind: "stop", cause: "protocol error", detail: parsed.error };
81
95
  const message = parsed.message;
82
96
  if (message.type === "stop") return { kind: "stop", cause: "driver stop" };
97
+ if (message.type === "stop_after_tick") {
98
+ return { kind: "stop", cause: "driver stop", detail: "stop_after_tick at an open gate" };
99
+ }
83
100
  if (message.askId !== gate.askId) {
84
101
  return {
85
102
  kind: "stop",
@@ -87,12 +104,13 @@ function inboundToRawAnswer(gate, parsed) {
87
104
  detail: `reply for ${message.askId} while gate ${gate.askId} is open`
88
105
  };
89
106
  }
90
- return { kind: "line", text: String(message.reply) };
107
+ return message.source === "policy" ? { kind: "line", text: String(message.reply), source: "policy" } : { kind: "line", text: String(message.reply) };
91
108
  }
92
109
  function createDriverAnswerReader(opts) {
93
110
  const input = opts.input ?? process.stdin;
94
111
  const queue = [];
95
112
  let ended = false;
113
+ let stopRequested = false;
96
114
  let waiter = null;
97
115
  let rl = null;
98
116
  const ensure = () => {
@@ -104,7 +122,17 @@ function createDriverAnswerReader(opts) {
104
122
  const w = waiter;
105
123
  waiter = null;
106
124
  w(line);
107
- } else queue.push(line);
125
+ return;
126
+ }
127
+ const parsed = parseDriverInbound(line);
128
+ if (parsed.ok && parsed.message.type === "stop_after_tick") {
129
+ if (!stopRequested) {
130
+ stopRequested = true;
131
+ opts.onStopRequested?.(parsed.message.reason);
132
+ }
133
+ return;
134
+ }
135
+ queue.push(line);
108
136
  });
109
137
  rl.on("close", () => {
110
138
  ended = true;
@@ -140,21 +168,28 @@ function createDriverAnswerReader(opts) {
140
168
  signal?.addEventListener("abort", onAbort, { once: true });
141
169
  waiter = settle;
142
170
  });
171
+ ensure();
143
172
  return {
144
173
  read: async (gate, readOpts) => {
145
174
  ensure();
175
+ if (stopRequested) {
176
+ return { kind: "stop", cause: "driver stop", detail: "stop_after_tick before the gate" };
177
+ }
178
+ const pending = nextLine(readOpts.signal);
146
179
  opts.emitter.emit({
147
180
  type: "hitl_gate",
148
181
  tick: opts.tick(),
149
182
  askId: gate.askId,
150
183
  labels: [...gate.labels],
151
184
  detection: gate.detection,
152
- line: formatHitlGateLine(gate)
185
+ line: formatHitlGateLine(gate),
186
+ usage: readOpts.usage ?? null
153
187
  });
154
- const line = await nextLine(readOpts.signal);
188
+ const line = await pending;
155
189
  if (line === null) return { kind: "eof" };
156
190
  return inboundToRawAnswer(gate, parseDriverInbound(line));
157
191
  },
192
+ stopRequested: () => stopRequested,
158
193
  close: () => {
159
194
  const r = rl;
160
195
  rl = null;
@@ -232,6 +267,7 @@ export {
232
267
  createDriverEmitter,
233
268
  driverReplies,
234
269
  driverStop,
270
+ STOPPED_BY_REQUEST_REASON,
235
271
  createDriverAnswerReader,
236
272
  DriverAgentSink
237
273
  };
@@ -6,7 +6,7 @@ import {
6
6
  formatStaleCliRefusal,
7
7
  installL0,
8
8
  syncFromManifest
9
- } from "./chunk-UQSFGLY5.js";
9
+ } from "./chunk-N7HMTWS5.js";
10
10
  import {
11
11
  SkippedSymlinkError,
12
12
  formatPersonalizationSkippedSymlinks,
@@ -15,21 +15,21 @@ import {
15
15
  import {
16
16
  REGISTRY_CLI_ARGS,
17
17
  resolveRegistryFromCli
18
- } from "./chunk-MAXEVJCP.js";
18
+ } from "./chunk-PHH3H5EQ.js";
19
19
  import {
20
20
  assessClaudeCommandAdapters,
21
21
  executeSafeReadinessFixes
22
- } from "./chunk-CAOQBBP5.js";
22
+ } from "./chunk-PXURVVVO.js";
23
23
  import {
24
24
  writeReadinessSnapshot
25
25
  } from "./chunk-HAFRAXGV.js";
26
26
  import {
27
27
  writeClaudeSessionStartHook
28
- } from "./chunk-Q4J5UXVQ.js";
28
+ } from "./chunk-JGEGTOF6.js";
29
29
  import {
30
30
  CLAUDE_HITL_FALLBACK,
31
31
  generateClaudeCommandAdapters
32
- } from "./chunk-FQNAEFTW.js";
32
+ } from "./chunk-LQJNGECA.js";
33
33
  import {
34
34
  shouldUseWelcomeColor,
35
35
  withCliProgress
@@ -56,13 +56,13 @@ import {
56
56
  npxPinned,
57
57
  pathCliStatus,
58
58
  syncPathCliToRuntime
59
- } from "./chunk-SZ5REXPD.js";
59
+ } from "./chunk-2KATW2O4.js";
60
60
  import {
61
61
  assessEnvironment
62
62
  } from "./chunk-B3VR5YBQ.js";
63
63
  import {
64
64
  warnIfRunningCliBehindNpm
65
- } from "./chunk-H3PQYVFT.js";
65
+ } from "./chunk-DONKV6MA.js";
66
66
  import {
67
67
  DOMAIN_PACK_IDS,
68
68
  allPacks,
@@ -79,7 +79,7 @@ import {
79
79
  resolveProtectedGlobs,
80
80
  saveManifest,
81
81
  skillTargetDir
82
- } from "./chunk-7T4MDNV3.js";
82
+ } from "./chunk-DQLIEJFK.js";
83
83
  import {
84
84
  KIT_VERSION,
85
85
  pinnedCliSpec
@@ -136,6 +136,9 @@ var UsageTally = class {
136
136
  var HITL_GATE_LINE_RE = /^HITL_GATE:\s*([a-z0-9-]+)\s*\|\s*(.+)$/;
137
137
  var HITL_REPLY_PREFIX = "HITL_REPLY:";
138
138
  var RESERVED_GATE_IDS = ["git-prod", "kit-prod"];
139
+ var PREANSWERABLE_GATES = {
140
+ "context-checkpoint": ["Continue queue"]
141
+ };
139
142
  var FALLBACK_ASK_ID = "prose-fallback";
140
143
  var HITL_UNANSWERED_EXIT_CODE = 4;
141
144
  var HITL_SIGINT_EXIT_CODE = 130;
@@ -227,10 +230,21 @@ function resolveOperatorAnswer(input, labels) {
227
230
  if (STOP_WORDS.has(lower)) return { kind: "stop", cause: lower };
228
231
  return { kind: "other", text };
229
232
  }
230
- function formatHitlReply(askId, answer) {
233
+ function isPreanswerable(askId, label) {
234
+ if (isReservedGateId(askId)) return false;
235
+ return Object.hasOwn(PREANSWERABLE_GATES, askId) && (PREANSWERABLE_GATES[askId] ?? []).includes(label);
236
+ }
237
+ function replyTag(answer, source) {
231
238
  if (answer.kind === "reply") {
232
- return `${HITL_REPLY_PREFIX} ${askId} | operator reply ${answer.n} | ${answer.label}`;
239
+ return source === "policy" ? `policy pre-answer ${answer.n}` : `operator reply ${answer.n}`;
233
240
  }
241
+ return "operator reply other";
242
+ }
243
+ function formatHitlReply(askId, answer, source = "operator") {
244
+ if (answer.kind === "reply") {
245
+ return `${HITL_REPLY_PREFIX} ${askId} | ${replyTag(answer, source)} | ${answer.label}`;
246
+ }
247
+ if (source === "policy") throw new Error("a policy pre-answer is always a listed label");
234
248
  if (answer.kind === "other") {
235
249
  return `${HITL_REPLY_PREFIX} ${askId} | operator reply other | ${answer.text}`;
236
250
  }
@@ -336,7 +350,7 @@ async function askOperator(gate, opts) {
336
350
  let raw;
337
351
  try {
338
352
  opts.write(formatGatePrompt(gate));
339
- raw = await opts.readAnswer(gate, { signal: opts.signal });
353
+ raw = await opts.readAnswer(gate, { signal: opts.signal, usage: opts.usage ?? null });
340
354
  } finally {
341
355
  opts.onPromptEnd?.();
342
356
  }
@@ -346,12 +360,22 @@ async function askOperator(gate, opts) {
346
360
  if (raw.kind === "eof") return { kind: "stop", stop: operatorStop(gate.askId, "EOF") };
347
361
  if (raw.kind === "sigint") return { kind: "stop", stop: operatorStop(gate.askId, "SIGINT") };
348
362
  if (raw.kind === "stop") return { kind: "stop", stop: driverStop(gate.askId, raw) };
363
+ const source = raw.source ?? "operator";
349
364
  const answer = resolveOperatorAnswer(raw.text, gate.labels);
365
+ if (source === "policy" && (answer.kind !== "reply" || !isPreanswerable(gate.askId, answer.label))) {
366
+ return {
367
+ kind: "stop",
368
+ stop: driverStop(gate.askId, {
369
+ cause: "protocol error",
370
+ detail: `policy pre-answer not allowed for ${gate.askId}`
371
+ })
372
+ };
373
+ }
350
374
  if (answer.kind === "stop") return { kind: "stop", stop: operatorStop(gate.askId, answer.cause) };
351
- const line = formatHitlReply(gate.askId, answer);
375
+ const line = formatHitlReply(gate.askId, answer, source);
352
376
  const stamp = {
353
377
  askId: gate.askId,
354
- reply: answer.kind === "reply" ? `operator reply ${answer.n}` : "operator reply other",
378
+ reply: replyTag(answer, source),
355
379
  label: answer.kind === "reply" ? answer.label : answer.text,
356
380
  line,
357
381
  at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -33,6 +33,7 @@ var SNAPSHOT_REPO_SOURCE_RELS = Object.freeze([
33
33
  ".cursor/HANDOFF.md",
34
34
  ".cursor/agents",
35
35
  ".cursor/commands",
36
+ ".cursor/rules",
36
37
  ".cursor/memory",
37
38
  ".cursor/context/config.json",
38
39
  ".cursor/context/current",
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  RUN_CATALOG
3
- } from "./chunk-KHFPPQJ5.js";
4
- import "./chunk-5TEXYAGP.js";
5
- import "./chunk-JPAQOESJ.js";
3
+ } from "./chunk-NDKSOPP7.js";
4
+ import "./chunk-GDKTTV2A.js";
5
+ import "./chunk-WRCXRV2U.js";
6
6
  import {
7
7
  discoverInstalledCommands
8
- } from "./chunk-FQNAEFTW.js";
8
+ } from "./chunk-LQJNGECA.js";
9
9
  import "./chunk-WGLPZXNU.js";
10
10
  import "./chunk-6RRG3WOE.js";
11
11
  import "./chunk-QTON2GQX.js";
12
12
  import {
13
13
  L0_ARTIFACTS
14
- } from "./chunk-2KIOZMTV.js";
15
- import "./chunk-47ZJ3S7M.js";
14
+ } from "./chunk-4PL57BZ5.js";
15
+ import "./chunk-A4PHFHYO.js";
16
16
  import {
17
17
  KIT_VERSION
18
18
  } from "./chunk-7HDQEK6T.js";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  REGISTRY_CLI_ARGS,
3
3
  resolveRegistryFromCli
4
- } from "./chunk-MAXEVJCP.js";
4
+ } from "./chunk-PHH3H5EQ.js";
5
5
  import {
6
6
  logger
7
7
  } from "./chunk-ZB43YMHW.js";
8
8
  import {
9
9
  managedPairs
10
- } from "./chunk-6GM5YUWR.js";
11
- import "./chunk-2KIOZMTV.js";
10
+ } from "./chunk-OVRWRZ5S.js";
11
+ import "./chunk-4PL57BZ5.js";
12
12
  import {
13
13
  loadAgentKitManifest,
14
14
  normalizeRelPath
15
- } from "./chunk-7T4MDNV3.js";
15
+ } from "./chunk-DQLIEJFK.js";
16
16
  import {
17
17
  resolveContained
18
- } from "./chunk-47ZJ3S7M.js";
18
+ } from "./chunk-A4PHFHYO.js";
19
19
  import "./chunk-C4Q77GGJ.js";
20
20
  import "./chunk-5B4DVO6C.js";
21
21
 
@@ -4,12 +4,12 @@ import {
4
4
  REVIEW_PACK_SLASH,
5
5
  parseReviewPackMaxBytes,
6
6
  reviewBackendMessage
7
- } from "./chunk-VWDFMXFK.js";
7
+ } from "./chunk-AEUE74EZ.js";
8
8
  import {
9
9
  detectAgentBackend,
10
10
  listDetectBackendIds
11
- } from "./chunk-5KDMATUR.js";
12
- import "./chunk-AOSXKF3M.js";
11
+ } from "./chunk-EE3LTOBZ.js";
12
+ import "./chunk-CRLMS2JX.js";
13
13
  import {
14
14
  GATE_EXIT_MARKER_RELPATH,
15
15
  defaultExec,
@@ -20,23 +20,23 @@ import {
20
20
  readGateExitMarker,
21
21
  resolveGateExitRefs,
22
22
  writeGateExitMarker
23
- } from "./chunk-BOZUBCQA.js";
23
+ } from "./chunk-2TKPKRHO.js";
24
24
  import "./chunk-MUTTNRX4.js";
25
25
  import {
26
26
  classifySlash,
27
27
  normalizeSlashName,
28
28
  promoteBlockedMessage,
29
29
  unknownSlashMessage
30
- } from "./chunk-KHFPPQJ5.js";
30
+ } from "./chunk-NDKSOPP7.js";
31
31
  import {
32
32
  CLAUDE_MAX_BUDGET_USD_ENV,
33
33
  CLAUDE_MAX_TURNS_ENV,
34
34
  RedactingStreamBuffer,
35
35
  redactSecrets
36
- } from "./chunk-5TEXYAGP.js";
36
+ } from "./chunk-GDKTTV2A.js";
37
37
  import {
38
38
  HITL_UNANSWERED_EXIT_CODE
39
- } from "./chunk-JPAQOESJ.js";
39
+ } from "./chunk-WRCXRV2U.js";
40
40
  import "./chunk-WGLPZXNU.js";
41
41
  import "./chunk-6RRG3WOE.js";
42
42
  import "./chunk-QTON2GQX.js";
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  REGISTRY_CLI_ARGS,
3
3
  resolveRegistryFromCli
4
- } from "./chunk-MAXEVJCP.js";
4
+ } from "./chunk-PHH3H5EQ.js";
5
5
  import {
6
6
  logger
7
7
  } from "./chunk-ZB43YMHW.js";
8
8
  import {
9
9
  diffAgainstRegistry,
10
10
  summarizeDiff
11
- } from "./chunk-2B3HHQ3L.js";
12
- import "./chunk-6GM5YUWR.js";
13
- import "./chunk-2KIOZMTV.js";
11
+ } from "./chunk-6QBU4DQF.js";
12
+ import "./chunk-OVRWRZ5S.js";
13
+ import "./chunk-4PL57BZ5.js";
14
14
  import {
15
15
  loadAgentKitManifest
16
- } from "./chunk-7T4MDNV3.js";
17
- import "./chunk-47ZJ3S7M.js";
16
+ } from "./chunk-DQLIEJFK.js";
17
+ import "./chunk-A4PHFHYO.js";
18
18
  import "./chunk-C4Q77GGJ.js";
19
19
  import "./chunk-5B4DVO6C.js";
20
20
 
@@ -2,12 +2,12 @@ import {
2
2
  assessHooksHealth,
3
3
  executeSafeReadinessFixes,
4
4
  refreshRepositoryProfile
5
- } from "./chunk-CAOQBBP5.js";
5
+ } from "./chunk-PXURVVVO.js";
6
6
  import {
7
7
  writeReadinessSnapshot
8
8
  } from "./chunk-HAFRAXGV.js";
9
- import "./chunk-Q4J5UXVQ.js";
10
- import "./chunk-FQNAEFTW.js";
9
+ import "./chunk-JGEGTOF6.js";
10
+ import "./chunk-LQJNGECA.js";
11
11
  import "./chunk-WGLPZXNU.js";
12
12
  import "./chunk-6RRG3WOE.js";
13
13
  import {
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  detectWorkspaceParent,
18
18
  workspaceParentAdvisoryLines
19
- } from "./chunk-FTLMWPQY.js";
19
+ } from "./chunk-JRCI2GNS.js";
20
20
  import {
21
21
  createReadinessReport
22
22
  } from "./chunk-PNFF6OU3.js";
@@ -33,13 +33,13 @@ import {
33
33
  } from "./chunk-B3VR5YBQ.js";
34
34
  import {
35
35
  warnIfRunningCliBehindNpm
36
- } from "./chunk-H3PQYVFT.js";
36
+ } from "./chunk-DONKV6MA.js";
37
37
  import "./chunk-PFEUZXVT.js";
38
- import "./chunk-2B3HHQ3L.js";
39
- import "./chunk-6GM5YUWR.js";
40
- import "./chunk-2KIOZMTV.js";
41
- import "./chunk-7T4MDNV3.js";
42
- import "./chunk-47ZJ3S7M.js";
38
+ import "./chunk-6QBU4DQF.js";
39
+ import "./chunk-OVRWRZ5S.js";
40
+ import "./chunk-4PL57BZ5.js";
41
+ import "./chunk-DQLIEJFK.js";
42
+ import "./chunk-A4PHFHYO.js";
43
43
  import {
44
44
  KIT_VERSION
45
45
  } from "./chunk-7HDQEK6T.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DRIVER_PROTOCOL_VERSION
3
- } from "./chunk-S4T6KYYA.js";
3
+ } from "./chunk-SKC6QZW4.js";
4
4
  import {
5
5
  bundledDashboardCandidates
6
6
  } from "./chunk-XDCCYBCJ.js";
7
- import "./chunk-JPAQOESJ.js";
7
+ import "./chunk-WRCXRV2U.js";
8
8
  import "./chunk-ZB43YMHW.js";
9
9
 
10
10
  // src/commands/engine-info.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  blobId,
3
3
  isTicketMerged
4
- } from "./chunk-AOSXKF3M.js";
4
+ } from "./chunk-CRLMS2JX.js";
5
5
  import {
6
6
  GATE_EXIT_BRANCH_PREFIX,
7
7
  GATE_EXIT_MARKER_RELPATH,
@@ -16,12 +16,12 @@ import {
16
16
  readGateExitMarker,
17
17
  resolveGateExitRefs,
18
18
  writeGateExitMarker
19
- } from "./chunk-BOZUBCQA.js";
19
+ } from "./chunk-2TKPKRHO.js";
20
20
  import "./chunk-MUTTNRX4.js";
21
21
  import {
22
22
  redactSecrets
23
- } from "./chunk-5TEXYAGP.js";
24
- import "./chunk-JPAQOESJ.js";
23
+ } from "./chunk-GDKTTV2A.js";
24
+ import "./chunk-WRCXRV2U.js";
25
25
  import {
26
26
  findOnPath
27
27
  } from "./chunk-WGLPZXNU.js";