@dadado/agent-kit-cli 6.18.0 → 6.19.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 (62) hide show
  1. package/dashboard/dashboard-data.mjs +8 -3
  2. package/dashboard/dashboard.html +140 -0
  3. package/dashboard/lib/guards.d.mts +20 -0
  4. package/dashboard/lib/guards.mjs +307 -0
  5. package/dashboard/lib/semantic-model.mjs +228 -1
  6. package/dist/{add-JZKFUH2O.js → add-DYRNPADR.js} +3 -3
  7. package/dist/{chunk-R4VLVX7B.js → chunk-2YPIQCPL.js} +9 -9
  8. package/dist/{chunk-H5D3HF2N.js → chunk-5EBT3V7G.js} +1 -1
  9. package/dist/{chunk-42AA2VFW.js → chunk-5V4C5N2P.js} +2 -2
  10. package/dist/{chunk-SKC6QZW4.js → chunk-6WUKLS4D.js} +1 -1
  11. package/dist/{chunk-CRH2Q6KY.js → chunk-6XJZLH53.js} +149 -18
  12. package/dist/{chunk-L7BL4246.js → chunk-BGL5DRK2.js} +2 -2
  13. package/dist/{chunk-44SDKJYY.js → chunk-C4LCOOL4.js} +3 -1
  14. package/dist/chunk-DTSL2RH7.js +433 -0
  15. package/dist/{chunk-BDIWC3WB.js → chunk-DY6EWD5X.js} +2 -2
  16. package/dist/{chunk-357Y422W.js → chunk-HJWSOZXS.js} +52 -12
  17. package/dist/{chunk-2CBKKCVU.js → chunk-KF544JTV.js} +2 -1
  18. package/dist/{chunk-4KV3TXKC.js → chunk-LX5AO7KO.js} +1 -1
  19. package/dist/{chunk-ZFJIJUZ4.js → chunk-MPCNPZJZ.js} +1 -1
  20. package/dist/{chunk-VY7AFID2.js → chunk-NA2LTNJS.js} +3 -3
  21. package/dist/{chunk-YP5OCR4I.js → chunk-NAU3ROWR.js} +1 -1
  22. package/dist/{chunk-WJRNI5FJ.js → chunk-OXLLHI2W.js} +3 -3
  23. package/dist/{chunk-WRCXRV2U.js → chunk-P7732A25.js} +10 -0
  24. package/dist/chunk-QWTBYXHN.js +751 -0
  25. package/dist/{chunk-UEW42NIF.js → chunk-R3QNQWLB.js} +3 -3
  26. package/dist/{chunk-SC2DBY2R.js → chunk-R4DUO5DA.js} +1 -0
  27. package/dist/{chunk-MOJRD6HF.js → chunk-SGTTC2JP.js} +4 -3
  28. package/dist/{chunk-B4MUKUVS.js → chunk-SPXAHVK4.js} +64 -1
  29. package/dist/{chunk-CTVVGKYB.js → chunk-U23SLQGX.js} +5 -5
  30. package/dist/chunk-UATQQDVR.js +297 -0
  31. package/dist/{chunk-Y7BH6KIE.js → chunk-W3ZJVBNY.js} +6 -3
  32. package/dist/{hook-AZ5LSJBJ.js → chunk-WF3CXK4J.js} +104 -113
  33. package/dist/{chunk-VRSBZKTA.js → chunk-WKZ63IZ7.js} +1 -1
  34. package/dist/{chunk-XHANIDPK.js → chunk-WMS3SSOO.js} +1 -1
  35. package/dist/{chunk-OKIFM3IH.js → chunk-XJORZUTG.js} +1 -1
  36. package/dist/{chunk-XDCCYBCJ.js → chunk-ZMYV6PRE.js} +13 -0
  37. package/dist/{commands-5P2E5LL4.js → commands-EHKVW7JR.js} +50 -16
  38. package/dist/{conflicts-A4B422EL.js → conflicts-XMN4PBCZ.js} +7 -7
  39. package/dist/{contribute-GAHG3J4Q.js → contribute-H3SOZGQQ.js} +4 -4
  40. package/dist/{countdown-C6NY2TSG.js → countdown-7ONIVAG6.js} +39 -11
  41. package/dist/{dashboard-YNCFISNO.js → dashboard-P65XHYCU.js} +1 -1
  42. package/dist/{dashboard-broadcast-NK7PU72L.js → dashboard-broadcast-GYK34QYL.js} +1 -1
  43. package/dist/{diff-EYAGGEU4.js → diff-HLBPPBUB.js} +5 -5
  44. package/dist/{doctor-GOMPRU6F.js → doctor-NZITN3GU.js} +10 -10
  45. package/dist/{engine-info-R6GXZ2VO.js → engine-info-BBI5QO5Y.js} +3 -3
  46. package/dist/{ground-control-MJGF5QRE.js → ground-control-IDCXN5FK.js} +4 -4
  47. package/dist/hook-IEB3N5WM.js +108 -0
  48. package/dist/index.js +27 -27
  49. package/dist/{init-WW5DR3DX.js → init-KBYUX7RA.js} +13 -13
  50. package/dist/{install-RN2DRLK6.js → install-YLGAQSP2.js} +13 -13
  51. package/dist/{mission-control-JIF6GFSV.js → mission-control-QJBSZVNI.js} +2 -2
  52. package/dist/{queue-7EBQGPPW.js → queue-OJHKFKK3.js} +54 -10
  53. package/dist/{run-GOMAHNV2.js → run-PFANZJ5Y.js} +174 -26
  54. package/dist/{run-plan-EUQ5WWF6.js → run-plan-7EB4ERSQ.js} +45 -15
  55. package/dist/{scan-BWA64R7I.js → scan-K3T5RQLC.js} +1 -1
  56. package/dist/session-start-XUAPF7TR.js +74 -0
  57. package/dist/sessions-4TVVZBB7.js +102 -0
  58. package/dist/{setup-global-DJWURJS3.js → setup-global-ND75RQEV.js} +6 -6
  59. package/dist/{status-2WYPLWTN.js → status-JI6ILZO7.js} +8 -8
  60. package/dist/{update-5VFQNBY5.js → update-B2DX5IGC.js} +10 -10
  61. package/package.json +1 -1
  62. package/dist/sessions-O7MYEMCT.js +0 -343
@@ -2,8 +2,10 @@ import {
2
2
  validateHandoffText
3
3
  } from "./chunk-2YU2H7I6.js";
4
4
  import {
5
- readStdinJson
6
- } from "./chunk-DE3LQFSJ.js";
5
+ collectLiveRoster,
6
+ formatRosterLease,
7
+ formatRosterRow
8
+ } from "./chunk-QWTBYXHN.js";
7
9
  import {
8
10
  CHANGELOG_FETCH_TIMEOUT_MS,
9
11
  resolveInventoryRoot,
@@ -17,24 +19,18 @@ import {
17
19
  formatPlanIndexSection,
18
20
  writePlanIndex
19
21
  } from "./chunk-L5V3W3DY.js";
20
- import "./chunk-MUTTNRX4.js";
21
22
  import {
22
23
  READINESS_SNAPSHOT_RELATIVE_PATH
23
24
  } from "./chunk-HAFRAXGV.js";
24
25
  import {
25
26
  stampLastCheckedAt
26
- } from "./chunk-42AA2VFW.js";
27
+ } from "./chunk-5V4C5N2P.js";
27
28
  import {
28
29
  loadContextConfig
29
30
  } from "./chunk-PFEUZXVT.js";
30
- import "./chunk-VY7AFID2.js";
31
- import "./chunk-YP5OCR4I.js";
32
- import "./chunk-WS6OX2IG.js";
33
31
  import {
34
32
  MANIFEST_RELATIVE_PATH
35
- } from "./chunk-VRSBZKTA.js";
36
- import "./chunk-B4MUKUVS.js";
37
- import "./chunk-7HDQEK6T.js";
33
+ } from "./chunk-WKZ63IZ7.js";
38
34
  import {
39
35
  HANDOFF_REL
40
36
  } from "./chunk-C4Q77GGJ.js";
@@ -42,31 +38,6 @@ import {
42
38
  fileExists
43
39
  } from "./chunk-5B4DVO6C.js";
44
40
 
45
- // src/commands/hook.ts
46
- import path2 from "path";
47
- import { defineCommand } from "citty";
48
-
49
- // src/hooks/format-session-start.ts
50
- function resolveSessionStartFormat(value) {
51
- return value === "claude" ? "claude" : "cursor";
52
- }
53
- function formatSessionStartOutput(additionalContext, format) {
54
- if (format === "claude") return additionalContext;
55
- return JSON.stringify({ additional_context: additionalContext });
56
- }
57
- var SESSION_START_DEGRADED_MESSAGE = "Agent Kit session-start context is unavailable this session (internal error, fail-open mode). Nothing else is affected; retry next session.";
58
-
59
- // src/hooks/pre-compact.ts
60
- var CONTEXT_USAGE_CAP_PERCENT = 50;
61
- function buildPreCompactUserMessage(payload = {}) {
62
- const pct = payload.context_usage_percent;
63
- const trigger = payload.trigger || "auto";
64
- const pctTxt = pct !== void 0 && pct !== null ? `~${pct}%` : "high";
65
- const overCap = pct === void 0 || pct === null || pct >= CONTEXT_USAGE_CAP_PERCENT;
66
- const msg = overCap ? `Context compacting (${trigger}, usage ${pctTxt}) \u2014 over the ${CONTEXT_USAGE_CAP_PERCENT}% per-agent context-usage cap. Update \`.cursor/HANDOFF.md\` now (forced checkpoint) and open a new chat with \`/continue-plan\` so the next agent starts fresh.` : `Context compacting (${trigger}, usage ${pctTxt}). Update \`.cursor/HANDOFF.md\` and open a new chat with \`/continue-plan\` so the next agent starts fresh.`;
67
- return { user_message: msg };
68
- }
69
-
70
41
  // src/hooks/session-start.ts
71
42
  import { spawn } from "child_process";
72
43
  import { readFile, stat } from "fs/promises";
@@ -887,32 +858,32 @@ function formatSessionAge(seconds) {
887
858
  if (seconds >= 60) return `${Math.floor(seconds / 60)}m`;
888
859
  return `${seconds}s`;
889
860
  }
890
- async function detachedAuditSessionsSection(deps = {}) {
891
- try {
892
- const run = deps.runCommand ?? runAuditSessionCommand;
893
- const nowMs = (deps.now ?? Date.now)();
894
- const [tmuxOut, screenOut] = await Promise.all([
895
- run("tmux", [
896
- "list-sessions",
897
- "-F",
898
- "#{session_name} #{session_attached} #{session_created}"
899
- ]),
900
- run("screen", ["-ls"])
901
- ]);
902
- const sessions = tmuxOut ? parseTmuxDetachedAuditSessions(tmuxOut, Math.floor(nowMs / 1e3)) : [];
903
- if (screenOut) {
904
- for (const entry of parseScreenDetachedAuditSessions(screenOut)) {
905
- let ageSeconds = -1;
906
- if (entry.socketPath) {
907
- try {
908
- const { mtimeMs } = await stat(entry.socketPath);
909
- if (nowMs >= mtimeMs) ageSeconds = Math.floor((nowMs - mtimeMs) / 1e3);
910
- } catch {
911
- }
861
+ async function listDetachedAuditSessions(deps = {}) {
862
+ const run = deps.runCommand ?? runAuditSessionCommand;
863
+ const nowMs = (deps.now ?? Date.now)();
864
+ const [tmuxOut, screenOut] = await Promise.all([
865
+ run("tmux", ["list-sessions", "-F", "#{session_name} #{session_attached} #{session_created}"]),
866
+ run("screen", ["-ls"])
867
+ ]);
868
+ const sessions = tmuxOut ? parseTmuxDetachedAuditSessions(tmuxOut, Math.floor(nowMs / 1e3)) : [];
869
+ if (screenOut) {
870
+ for (const entry of parseScreenDetachedAuditSessions(screenOut)) {
871
+ let ageSeconds = -1;
872
+ if (entry.socketPath) {
873
+ try {
874
+ const { mtimeMs } = await stat(entry.socketPath);
875
+ if (nowMs >= mtimeMs) ageSeconds = Math.floor((nowMs - mtimeMs) / 1e3);
876
+ } catch {
912
877
  }
913
- sessions.push({ channel: "screen", name: entry.name, ageSeconds });
914
878
  }
879
+ sessions.push({ channel: "screen", name: entry.name, ageSeconds });
915
880
  }
881
+ }
882
+ return sessions;
883
+ }
884
+ async function detachedAuditSessionsSection(deps = {}) {
885
+ try {
886
+ const sessions = await listDetachedAuditSessions(deps);
916
887
  if (sessions.length === 0) return null;
917
888
  const knownAges = sessions.map((s) => s.ageSeconds).filter((a) => a >= 0);
918
889
  const oldest = knownAges.length ? `oldest ~${formatSessionAge(Math.max(...knownAges))}` : "oldest age unknown";
@@ -924,8 +895,55 @@ ${sessions.length} detached \`agent-kit-audit-*\` PTY ${noun} on this host (${ol
924
895
  return null;
925
896
  }
926
897
  }
898
+ var LIVE_AGENTS_SECTION_DEADLINE_MS = 3e3;
899
+ var LIVE_AGENTS_SECTION_MAX_ROWS = 5;
900
+ var LIVE_AGENTS_SECTION_MAX_WORKTREES = 3;
901
+ var LIVE_AGENTS_SECTION_MAX_CHARS = 2e3;
902
+ function formatLiveAgentsSection(roster) {
903
+ const others = roster.rows.filter((r) => !r.self && r.kind !== "audit");
904
+ const held = roster.lease.kind === "held";
905
+ if (!held && others.length === 0) return null;
906
+ const lines = ["## Other live agents in this workspace", "", formatRosterLease(roster)];
907
+ for (const row of others.slice(0, LIVE_AGENTS_SECTION_MAX_ROWS)) {
908
+ lines.push(formatRosterRow(row, roster.root));
909
+ }
910
+ if (others.length > LIVE_AGENTS_SECTION_MAX_ROWS) {
911
+ lines.push(
912
+ ` +${others.length - LIVE_AGENTS_SECTION_MAX_ROWS} more (agent-kit sessions --live)`
913
+ );
914
+ }
915
+ const busy = roster.worktrees.filter((w) => !w.self);
916
+ if (busy.length > 0) {
917
+ const shown = busy.slice(0, LIVE_AGENTS_SECTION_MAX_WORKTREES).map((w) => w.path).join(", ");
918
+ const more = busy.length > LIVE_AGENTS_SECTION_MAX_WORKTREES ? ` (+${busy.length - LIVE_AGENTS_SECTION_MAX_WORKTREES} more)` : "";
919
+ lines.push(`Worktrees in use by a live process (never reuse them): ${shown}${more}`);
920
+ }
921
+ lines.push(
922
+ "",
923
+ held ? "Another live session holds the queue lease: do not write Plan, Next to-dos, queue fields or plan to-do status, and do not dispatch; report the lease line instead. Re-check with `agent-kit queue lease`." : "Check in with `agent-kit queue lease` before each Ask and before each write to Plan, Next to-dos, queue fields or plan to-do status; held by another live session means stop and report that line."
924
+ );
925
+ let text = lines.join("\n");
926
+ if (text.length > LIVE_AGENTS_SECTION_MAX_CHARS) {
927
+ text = `${text.slice(0, LIVE_AGENTS_SECTION_MAX_CHARS - 40).trimEnd()}
928
+ \u2026 (agent-kit sessions --live)`;
929
+ }
930
+ return text;
931
+ }
932
+ async function liveAgentsSection(root, deps = {}) {
933
+ try {
934
+ const collect = deps.collect ?? ((r) => collectLiveRoster(r, { listAudit: async () => [] }));
935
+ const roster = await withDeadline(
936
+ collect(root),
937
+ deps.deadlineMs ?? LIVE_AGENTS_SECTION_DEADLINE_MS
938
+ );
939
+ return roster ? formatLiveAgentsSection(roster) : null;
940
+ } catch {
941
+ return null;
942
+ }
943
+ }
927
944
  async function buildSessionStartAdditionalContext(rootDir, _payload = {}, deps = {}) {
928
945
  const root = path.resolve(rootDir);
946
+ const liveAgentsPending = liveAgentsSection(root, { collect: deps.liveRoster });
929
947
  const handoffPath = path.join(root, HANDOFF_REL);
930
948
  const handoffFull = await readFull(handoffPath);
931
949
  const handoff = capHandoffExcerpt(handoffFull);
@@ -953,6 +971,8 @@ async function buildSessionStartAdditionalContext(rootDir, _payload = {}, deps =
953
971
  if (updateNudge) parts.push(updateNudge);
954
972
  if (cursorNudge) parts.push(cursorNudge);
955
973
  if (inboundNudge) parts.push(inboundNudge);
974
+ const liveAgents = await liveAgentsPending.catch(() => null);
975
+ if (liveAgents) parts.push(liveAgents);
956
976
  const auditSessions = await detachedAuditSessionsSection().catch(() => null);
957
977
  if (auditSessions) parts.push(auditSessions);
958
978
  const formatWarnings = validateHandoffText(handoffFull);
@@ -1024,60 +1044,31 @@ function resolveSessionRoot(payload, cwd = process.cwd()) {
1024
1044
  return cwd;
1025
1045
  }
1026
1046
 
1027
- // src/commands/hook.ts
1028
- async function runSessionStartHook(cwd, formatArg, deps = {}) {
1029
- const format = resolveSessionStartFormat(formatArg);
1030
- try {
1031
- const readStdin = deps.readStdin ?? readStdinJson;
1032
- const buildContext = deps.buildContext ?? buildSessionStartAdditionalContext;
1033
- const payload = await readStdin();
1034
- const root = resolveSessionRoot(payload, path2.resolve(cwd));
1035
- const out = await buildContext(root, payload);
1036
- return formatSessionStartOutput(out.additional_context, format);
1037
- } catch {
1038
- return formatSessionStartOutput(SESSION_START_DEGRADED_MESSAGE, format);
1039
- }
1040
- }
1041
- var hookCommand = defineCommand({
1042
- meta: {
1043
- name: "hook",
1044
- description: "Cursor + Claude Code hook adapters (session-start, pre-compact). CLI is SoT."
1045
- },
1046
- subCommands: {
1047
- "session-start": defineCommand({
1048
- meta: {
1049
- name: "session-start",
1050
- description: "Emit sessionStart context (stdin: host payload). --format cursor (default, JSON additional_context) | claude (plain stdout)"
1051
- },
1052
- args: {
1053
- cwd: {
1054
- type: "string",
1055
- default: process.cwd()
1056
- },
1057
- format: {
1058
- type: "string",
1059
- default: "cursor",
1060
- description: "cursor (default) | claude"
1061
- }
1062
- },
1063
- async run({ args }) {
1064
- const cwd = typeof args.cwd === "string" ? args.cwd : process.cwd();
1065
- console.log(await runSessionStartHook(cwd, args.format));
1066
- }
1067
- }),
1068
- "pre-compact": defineCommand({
1069
- meta: {
1070
- name: "pre-compact",
1071
- description: "Emit preCompact user_message JSON (stdin: Cursor payload)"
1072
- },
1073
- async run() {
1074
- const payload = await readStdinJson();
1075
- console.log(JSON.stringify(buildPreCompactUserMessage(payload)));
1076
- }
1077
- })
1078
- }
1079
- });
1080
1047
  export {
1081
- hookCommand,
1082
- runSessionStartHook
1048
+ CURSOR_AWARENESS_SPAWN_TIMEOUT_MS,
1049
+ parseUnprocessedDogfoodItems,
1050
+ colonyHostSection,
1051
+ SESSION_START_SECTION_DEADLINE_MS,
1052
+ withDeadline,
1053
+ runSectionWithDeadline,
1054
+ sectionAttemptNeedsStamp,
1055
+ updateCheckSection,
1056
+ shouldEmitCursorAwarenessNudge,
1057
+ cursorAwarenessSection,
1058
+ PUBLIC_INBOUND_SPAWN_TIMEOUT_MS,
1059
+ publicInboundSection,
1060
+ AUDIT_SESSION_LIST_TIMEOUT_MS,
1061
+ parseTmuxDetachedAuditSessions,
1062
+ parseScreenDetachedAuditSessions,
1063
+ formatSessionAge,
1064
+ listDetachedAuditSessions,
1065
+ detachedAuditSessionsSection,
1066
+ LIVE_AGENTS_SECTION_DEADLINE_MS,
1067
+ LIVE_AGENTS_SECTION_MAX_ROWS,
1068
+ LIVE_AGENTS_SECTION_MAX_WORKTREES,
1069
+ LIVE_AGENTS_SECTION_MAX_CHARS,
1070
+ formatLiveAgentsSection,
1071
+ liveAgentsSection,
1072
+ buildSessionStartAdditionalContext,
1073
+ resolveSessionRoot
1083
1074
  };
@@ -8,7 +8,7 @@ import {
8
8
  saveManagedHashLedger,
9
9
  shouldPreserveCustomizedOverlay,
10
10
  toPosixRel
11
- } from "./chunk-B4MUKUVS.js";
11
+ } from "./chunk-SPXAHVK4.js";
12
12
  import {
13
13
  HANDOFF_REL
14
14
  } from "./chunk-C4Q77GGJ.js";
@@ -9,7 +9,7 @@ import {
9
9
  assertRealParentContained,
10
10
  isRealWriteTargetContained,
11
11
  resolveContained
12
- } from "./chunk-B4MUKUVS.js";
12
+ } from "./chunk-SPXAHVK4.js";
13
13
  import {
14
14
  ensureDir
15
15
  } from "./chunk-5B4DVO6C.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MANIFEST_RELATIVE_PATH
3
- } from "./chunk-VRSBZKTA.js";
3
+ } from "./chunk-WKZ63IZ7.js";
4
4
  import {
5
5
  fileExists
6
6
  } from "./chunk-5B4DVO6C.js";
@@ -22,6 +22,19 @@ var CONFIG_PERSONA_MODES = Object.freeze(["continue-plan", "run-plan", "cli-run-
22
22
  var CONFIG_REVIEW_BACKENDS = Object.freeze(["auto", "claude", "cursor"]);
23
23
  var CONFIG_REVIEW_MODES = Object.freeze(["paste", "autonomous"]);
24
24
  var CONFIG_REVIEW_PREFLIGHT = Object.freeze(["off", "warn", "block"]);
25
+ var ROLE_CAPABILITIES = Object.freeze({
26
+ claude: Object.freeze({ workerModel: true, subworkerModel: true, reviewer: true }),
27
+ "cursor-agent": Object.freeze({ workerModel: true, subworkerModel: false, reviewer: true }),
28
+ codex: Object.freeze({ workerModel: true, subworkerModel: false, reviewer: false }),
29
+ openrouter: Object.freeze({ workerModel: true, subworkerModel: false, reviewer: false }),
30
+ "cursor-acp": Object.freeze({ workerModel: false, subworkerModel: false, reviewer: false })
31
+ });
32
+ var CONFIG_ROLE_WORKER_BACKENDS = Object.freeze([
33
+ "auto",
34
+ ...Object.keys(ROLE_CAPABILITIES)
35
+ ]);
36
+ var CONFIG_ROLE_REVIEWER_BACKENDS = Object.freeze(["auto", "claude", "cursor-agent"]);
37
+ var CONFIG_ROLE_REVIEWER_SCOPES = Object.freeze(["off", "tick", "plan"]);
25
38
  function resolveContextConfigPath(repoRoot, fsHooks = {}) {
26
39
  const exists = fsHooks.existsSync;
27
40
  const realpath = fsHooks.realpathSync;
@@ -1,18 +1,20 @@
1
1
  import {
2
- RUN_CATALOG
3
- } from "./chunk-MOJRD6HF.js";
4
- import "./chunk-Y7BH6KIE.js";
5
- import "./chunk-WRCXRV2U.js";
2
+ RUN_CATALOG,
3
+ RUN_PROMOTE_BLOCKED
4
+ } from "./chunk-SGTTC2JP.js";
5
+ import "./chunk-W3ZJVBNY.js";
6
+ import "./chunk-P7732A25.js";
6
7
  import {
8
+ CURSOR_COMMANDS_DIR_REL,
7
9
  discoverInstalledCommands
8
- } from "./chunk-2CBKKCVU.js";
10
+ } from "./chunk-KF544JTV.js";
9
11
  import "./chunk-WGLPZXNU.js";
10
12
  import "./chunk-Q35TWISF.js";
11
13
  import "./chunk-QTON2GQX.js";
12
14
  import {
13
15
  L0_ARTIFACTS
14
16
  } from "./chunk-WS6OX2IG.js";
15
- import "./chunk-B4MUKUVS.js";
17
+ import "./chunk-SPXAHVK4.js";
16
18
  import {
17
19
  KIT_VERSION
18
20
  } from "./chunk-7HDQEK6T.js";
@@ -20,11 +22,13 @@ import "./chunk-C4Q77GGJ.js";
20
22
  import "./chunk-5B4DVO6C.js";
21
23
 
22
24
  // src/commands/commands.ts
23
- import path from "path";
25
+ import path2 from "path";
24
26
  import { defineCommand } from "citty";
25
27
 
26
28
  // src/lifecycle/commands-catalog.ts
27
- var COMMANDS_CATALOG_VERSION = "1.0.0";
29
+ import { readFile } from "fs/promises";
30
+ import path from "path";
31
+ var COMMANDS_CATALOG_VERSION = "1.1.0";
28
32
  var COMMAND_NAME_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
29
33
  var COMMANDS_PREFIX = ".cursor/commands/";
30
34
  var NON_L0_KIT_COMMAND_IDS = /* @__PURE__ */ new Set(["context-status", "tips"]);
@@ -40,6 +44,20 @@ var FACTORY_COMMAND_IDS = /* @__PURE__ */ new Set([
40
44
  "public-inbound-radar",
41
45
  "public-issue-triage"
42
46
  ]);
47
+ var COMMAND_CONTEXTS = ["none", "goal", "plan", "branch", "pr", "sha"];
48
+ var COMMAND_AUDIENCES = ["user", "meta"];
49
+ var INTERACTIVE_ONLY_COMMAND_IDS = new Set(RUN_PROMOTE_BLOCKED);
50
+ function parseCommandRunMeta(name, raw) {
51
+ const body = /^---\r?\n([\s\S]*?)\r?\n---/.exec(raw)?.[1] ?? "";
52
+ const field = (key) => new RegExp(`^${key}:\\s*(\\S+)\\s*$`, "m").exec(body)?.[1];
53
+ const context = field("context");
54
+ const audience = field("audience");
55
+ return {
56
+ context: COMMAND_CONTEXTS.includes(context ?? "") ? context : "none",
57
+ interactiveOnly: INTERACTIVE_ONLY_COMMAND_IDS.has(name) || field("interactiveOnly") === "true",
58
+ audience: COMMAND_AUDIENCES.includes(audience ?? "") ? audience : "user"
59
+ };
60
+ }
43
61
  function commandLayer(name) {
44
62
  if (KIT_COMMAND_IDS.has(name)) return "kit";
45
63
  if (FACTORY_COMMAND_IDS.has(name)) return "factory";
@@ -47,19 +65,35 @@ function commandLayer(name) {
47
65
  }
48
66
  async function buildCommandsCatalog(rootDir) {
49
67
  const headless = new Set(RUN_CATALOG);
50
- const commands = (await discoverInstalledCommands(rootDir)).filter((c) => COMMAND_NAME_RE.test(c.name)).map((c) => ({
51
- name: c.name,
52
- description: c.description,
53
- layer: commandLayer(c.name),
54
- headless: headless.has(c.name)
55
- })).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
68
+ const dir = path.join(rootDir, CURSOR_COMMANDS_DIR_REL);
69
+ const rows = (await discoverInstalledCommands(rootDir)).filter(
70
+ (c) => COMMAND_NAME_RE.test(c.name)
71
+ );
72
+ const commands = (await Promise.all(
73
+ rows.map(async (c) => {
74
+ const raw = await readFile(path.join(dir, `${c.name}.md`), "utf8").catch(() => "");
75
+ return {
76
+ name: c.name,
77
+ description: c.description,
78
+ layer: commandLayer(c.name),
79
+ headless: headless.has(c.name),
80
+ ...parseCommandRunMeta(c.name, raw)
81
+ };
82
+ })
83
+ )).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
56
84
  return { catalogVersion: COMMANDS_CATALOG_VERSION, kitVersion: KIT_VERSION, commands };
57
85
  }
58
86
  function renderCommandsCatalog(catalog) {
59
87
  if (catalog.commands.length === 0) return "No slash commands found in .cursor/commands/.";
60
88
  const width = Math.max(...catalog.commands.map((c) => c.name.length)) + 1;
61
89
  return catalog.commands.map((c) => {
62
- const tags = [c.layer, ...c.headless ? ["headless"] : []].join(", ");
90
+ const tags = [
91
+ c.layer,
92
+ ...c.headless ? ["headless"] : [],
93
+ ...c.interactiveOnly ? ["interactive-only"] : [],
94
+ ...c.audience === "meta" ? ["meta"] : [],
95
+ ...c.context !== "none" ? [`context: ${c.context}`] : []
96
+ ].join(", ");
63
97
  return `/${c.name.padEnd(width)} [${tags}] ${c.description}`;
64
98
  }).join("\n");
65
99
  }
@@ -79,7 +113,7 @@ var commandsCommand = defineCommand({
79
113
  json: { type: "boolean", description: "Print the versioned catalog as JSON", default: false }
80
114
  },
81
115
  async run({ args }) {
82
- const catalog = await buildCommandsCatalog(path.resolve(args.cwd));
116
+ const catalog = await buildCommandsCatalog(path2.resolve(args.cwd));
83
117
  process.stdout.write(
84
118
  args.json ? `${JSON.stringify(catalog, null, 2)}
85
119
  ` : `${renderCommandsCatalog(catalog)}
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  REVIEW_PACK_DEFAULT_MAX_BYTES
3
- } from "./chunk-CTVVGKYB.js";
3
+ } from "./chunk-U23SLQGX.js";
4
4
  import {
5
5
  detectAgentBackend
6
- } from "./chunk-44SDKJYY.js";
7
- import "./chunk-H5D3HF2N.js";
6
+ } from "./chunk-C4LCOOL4.js";
7
+ import "./chunk-5EBT3V7G.js";
8
8
  import {
9
9
  defaultExec,
10
10
  gateExitRedactions,
11
11
  isOutside
12
- } from "./chunk-L7BL4246.js";
12
+ } from "./chunk-BGL5DRK2.js";
13
13
  import "./chunk-MUTTNRX4.js";
14
14
  import {
15
15
  ensureDispatchLogPath,
16
16
  readCommandFile,
17
17
  runHeadlessDispatch
18
- } from "./chunk-MOJRD6HF.js";
18
+ } from "./chunk-SGTTC2JP.js";
19
19
  import {
20
20
  createStreamRenderer,
21
21
  redactSecrets
22
- } from "./chunk-Y7BH6KIE.js";
23
- import "./chunk-WRCXRV2U.js";
22
+ } from "./chunk-W3ZJVBNY.js";
23
+ import "./chunk-P7732A25.js";
24
24
  import "./chunk-WGLPZXNU.js";
25
25
  import "./chunk-Q35TWISF.js";
26
26
  import "./chunk-QTON2GQX.js";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  REGISTRY_CLI_ARGS,
3
3
  resolveRegistryFromCli
4
- } from "./chunk-4KV3TXKC.js";
4
+ } from "./chunk-LX5AO7KO.js";
5
5
  import {
6
6
  logger
7
7
  } from "./chunk-ZB43YMHW.js";
8
8
  import {
9
9
  managedPairs
10
- } from "./chunk-YP5OCR4I.js";
10
+ } from "./chunk-NAU3ROWR.js";
11
11
  import "./chunk-WS6OX2IG.js";
12
12
  import {
13
13
  loadAgentKitManifest,
14
14
  normalizeRelPath
15
- } from "./chunk-VRSBZKTA.js";
15
+ } from "./chunk-WKZ63IZ7.js";
16
16
  import {
17
17
  resolveContained
18
- } from "./chunk-B4MUKUVS.js";
18
+ } from "./chunk-SPXAHVK4.js";
19
19
  import "./chunk-C4Q77GGJ.js";
20
20
  import "./chunk-5B4DVO6C.js";
21
21
 
@@ -4,12 +4,17 @@ import {
4
4
  REVIEW_PACK_SLASH,
5
5
  parseReviewPackMaxBytes,
6
6
  reviewBackendMessage
7
- } from "./chunk-CTVVGKYB.js";
7
+ } from "./chunk-U23SLQGX.js";
8
+ import {
9
+ loadRolesContext,
10
+ resolveWorkerRole
11
+ } from "./chunk-UATQQDVR.js";
12
+ import "./chunk-7ABY6DYH.js";
8
13
  import {
9
14
  detectAgentBackend,
10
15
  listDetectBackendIds
11
- } from "./chunk-44SDKJYY.js";
12
- import "./chunk-H5D3HF2N.js";
16
+ } from "./chunk-C4LCOOL4.js";
17
+ import "./chunk-5EBT3V7G.js";
13
18
  import {
14
19
  GATE_EXIT_MARKER_RELPATH,
15
20
  defaultExec,
@@ -20,29 +25,31 @@ import {
20
25
  readGateExitMarker,
21
26
  resolveGateExitRefs,
22
27
  writeGateExitMarker
23
- } from "./chunk-L7BL4246.js";
28
+ } from "./chunk-BGL5DRK2.js";
29
+ import "./chunk-L5V3W3DY.js";
24
30
  import "./chunk-MUTTNRX4.js";
25
31
  import {
26
32
  classifySlash,
27
33
  normalizeSlashName,
28
34
  promoteBlockedMessage,
29
35
  unknownSlashMessage
30
- } from "./chunk-MOJRD6HF.js";
36
+ } from "./chunk-SGTTC2JP.js";
31
37
  import {
32
38
  CLAUDE_MAX_BUDGET_USD_ENV,
33
39
  CLAUDE_MAX_TURNS_ENV,
34
40
  RedactingStreamBuffer,
35
41
  redactSecrets
36
- } from "./chunk-Y7BH6KIE.js";
42
+ } from "./chunk-W3ZJVBNY.js";
37
43
  import {
38
44
  HITL_UNANSWERED_EXIT_CODE
39
- } from "./chunk-WRCXRV2U.js";
45
+ } from "./chunk-P7732A25.js";
40
46
  import "./chunk-WGLPZXNU.js";
41
47
  import "./chunk-Q35TWISF.js";
42
48
  import "./chunk-QTON2GQX.js";
43
49
  import {
44
50
  logger
45
51
  } from "./chunk-ZB43YMHW.js";
52
+ import "./chunk-PFEUZXVT.js";
46
53
  import {
47
54
  ensureLoopLogsDir,
48
55
  runnerStatePaths
@@ -265,7 +272,27 @@ async function executeCountdown(input) {
265
272
  if (job !== "review" && input.includeReviewed) {
266
273
  return usage("--include-reviewed only applies to --job review");
267
274
  }
268
- const detected = await detectAgentBackend(input.backend, input.whichFn);
275
+ let backendRequest = input.backend.trim() || "auto";
276
+ let model = input.model?.trim() || void 0;
277
+ const rolesNotes = [];
278
+ if (job === "tick") {
279
+ const ctx = await loadRolesContext(root, true);
280
+ if (!ctx.ok) return usage(ctx.error);
281
+ const worker = resolveWorkerRole({
282
+ flagBackend: input.backend,
283
+ flagModel: input.model,
284
+ plan: ctx.plan,
285
+ roles: ctx.roles,
286
+ defaultBackend: "auto"
287
+ });
288
+ backendRequest = worker.backend;
289
+ model = worker.model;
290
+ rolesNotes.push(...worker.warnings.map((w) => `roles: ${w}`));
291
+ rolesNotes.push(
292
+ `roles: worker ${worker.backend} (${worker.backendSource}), model ${worker.model ? `${worker.model} (${worker.modelSource})` : "backend default"}`
293
+ );
294
+ }
295
+ const detected = await detectAgentBackend(backendRequest, input.whichFn);
269
296
  if (!detected.ok) return usage(detected.message);
270
297
  let maxPackBytes;
271
298
  if (job === "review") {
@@ -306,6 +333,7 @@ async function executeCountdown(input) {
306
333
  };
307
334
  const jobLabel = job === "tick" ? "run-plan" : job === "review" ? `run ${REVIEW_PACK_SLASH}` : `run ${slash}`;
308
335
  say(`fire ${gateExitStamp(now)}: job ${job} (${jobLabel}) on ${detected.id}`);
336
+ for (const note of rolesNotes) say(note);
309
337
  const preflight = await countdownPreflight({ root, env, exec, now, log: say });
310
338
  if (!preflight.ok) {
311
339
  say(`refused: ${preflight.reason} (exit ${preflight.exitCode})`);
@@ -323,7 +351,7 @@ async function executeCountdown(input) {
323
351
  slash,
324
352
  backend: detected.id,
325
353
  maxTicks,
326
- ...input.model ? { model: input.model } : {},
354
+ ...model ? { model } : {},
327
355
  ...maxPackBytes !== void 0 ? { maxPackBytes } : {},
328
356
  ...job === "review" && input.includeReviewed ? { includeReviewed: true } : {}
329
357
  });
@@ -412,8 +440,8 @@ var countdownCommand = defineCommand({
412
440
  },
413
441
  backend: {
414
442
  type: "string",
415
- description: `Agent backend (${listDetectBackendIds().join(" | ")}; default: auto)`,
416
- default: "auto"
443
+ description: `Agent backend (${listDetectBackendIds().join(" | ")}; default: auto; the tick job reads plan worker_backend and config roles.worker first)`,
444
+ default: ""
417
445
  },
418
446
  model: {
419
447
  type: "string",
@@ -7,7 +7,7 @@ import {
7
7
  findDashboardStart,
8
8
  readPreferredBrowserFromWorkspace,
9
9
  resolveDashboardSnapshotRoot
10
- } from "./chunk-XDCCYBCJ.js";
10
+ } from "./chunk-ZMYV6PRE.js";
11
11
  import "./chunk-ZB43YMHW.js";
12
12
  export {
13
13
  applyDashboardOpenEnv,
@@ -5,7 +5,7 @@ import {
5
5
  findDashboardStart,
6
6
  negatedFlag,
7
7
  resolveDashboardSnapshotRoot
8
- } from "./chunk-XDCCYBCJ.js";
8
+ } from "./chunk-ZMYV6PRE.js";
9
9
  import {
10
10
  logger
11
11
  } from "./chunk-ZB43YMHW.js";
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  REGISTRY_CLI_ARGS,
3
3
  resolveRegistryFromCli
4
- } from "./chunk-4KV3TXKC.js";
4
+ } from "./chunk-LX5AO7KO.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-VY7AFID2.js";
12
- import "./chunk-YP5OCR4I.js";
11
+ } from "./chunk-NA2LTNJS.js";
12
+ import "./chunk-NAU3ROWR.js";
13
13
  import "./chunk-WS6OX2IG.js";
14
14
  import {
15
15
  loadAgentKitManifest
16
- } from "./chunk-VRSBZKTA.js";
17
- import "./chunk-B4MUKUVS.js";
16
+ } from "./chunk-WKZ63IZ7.js";
17
+ import "./chunk-SPXAHVK4.js";
18
18
  import "./chunk-C4Q77GGJ.js";
19
19
  import "./chunk-5B4DVO6C.js";
20
20