@hasna/todos 0.15.3 → 0.15.5

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.
package/dist/cli/index.js CHANGED
@@ -2123,7 +2123,7 @@ var package_default;
2123
2123
  var init_package = __esm(() => {
2124
2124
  package_default = {
2125
2125
  name: "@hasna/todos",
2126
- version: "0.15.3",
2126
+ version: "0.15.5",
2127
2127
  description: "Universal task management for AI coding agents - CLI + MCP server + interactive TUI",
2128
2128
  type: "module",
2129
2129
  main: "dist/index.js",
@@ -6646,6 +6646,7 @@ var init_stage_a = __esm(() => {
6646
6646
  "count",
6647
6647
  "dashboard",
6648
6648
  "dedupe",
6649
+ "delegate",
6649
6650
  "delete",
6650
6651
  "deps",
6651
6652
  "dispatch",
@@ -6832,6 +6833,7 @@ var init_stage_a = __esm(() => {
6832
6833
  "claim",
6833
6834
  "comment",
6834
6835
  "count",
6836
+ "delegate",
6835
6837
  "delete",
6836
6838
  "deps",
6837
6839
  "doctor",
@@ -16243,6 +16245,18 @@ function updateTask(id, input, db) {
16243
16245
  sets.push("assigned_to = ?");
16244
16246
  params.push(input.assigned_to);
16245
16247
  }
16248
+ if (input.assigned_by !== undefined) {
16249
+ sets.push("assigned_by = ?");
16250
+ params.push(input.assigned_by);
16251
+ }
16252
+ if (input.delegated_from !== undefined) {
16253
+ sets.push("delegated_from = ?");
16254
+ params.push(input.delegated_from);
16255
+ }
16256
+ if (input.delegation_depth !== undefined) {
16257
+ sets.push("delegation_depth = ?");
16258
+ params.push(input.delegation_depth);
16259
+ }
16246
16260
  if (input.working_dir !== undefined) {
16247
16261
  sets.push("working_dir = ?");
16248
16262
  params.push(input.working_dir);
@@ -26810,16 +26824,18 @@ function registerProjectCommands(program2) {
26810
26824
  content = `[progress ${pct}%] ${text}`;
26811
26825
  progressPct = pct;
26812
26826
  }
26827
+ const router = resolveWritableIdentity(globalOpts.agent);
26828
+ const agentId = globalOpts.agent || router.agent_id || undefined;
26813
26829
  try {
26814
26830
  const comment = cloud ? await cloudAddComment(cloud, resolvedId, {
26815
26831
  content,
26816
- agent_id: globalOpts.agent,
26832
+ agent_id: agentId,
26817
26833
  session_id: globalOpts.session,
26818
26834
  ...progressPct !== undefined ? { type: "progress", progress_pct: progressPct } : {}
26819
26835
  }) : addComment({
26820
26836
  task_id: resolvedId,
26821
26837
  content,
26822
- agent_id: globalOpts.agent,
26838
+ agent_id: agentId,
26823
26839
  session_id: globalOpts.session
26824
26840
  });
26825
26841
  if (globalOpts.json) {
@@ -27627,6 +27643,7 @@ var init_project_commands = __esm(() => {
27627
27643
  init_projects();
27628
27644
  init_comments();
27629
27645
  init_cloud_router();
27646
+ init_creator_identity();
27630
27647
  init_dependency_graph();
27631
27648
  init_saved_search_views();
27632
27649
  init_sync();
@@ -72726,16 +72743,425 @@ var init_dispatch3 = __esm(() => {
72726
72743
  init_helpers();
72727
72744
  });
72728
72745
 
72746
+ // src/lib/delegation-brief.ts
72747
+ import { createHash as createHash17 } from "crypto";
72748
+ function resolveDelegationBrief(input, sources) {
72749
+ const hasPath = typeof input.briefPath === "string" && input.briefPath.length > 0;
72750
+ const hasText = typeof input.briefText === "string" && input.briefText.length > 0;
72751
+ if (hasPath && hasText) {
72752
+ return {
72753
+ ok: false,
72754
+ reason: "conflict",
72755
+ message: "Pass either --brief <path> or --brief-text <text>, not both. " + "Two briefs means the worker is told two things and the [DISPATCH] record can only name one."
72756
+ };
72757
+ }
72758
+ if (!hasPath && !hasText) {
72759
+ return {
72760
+ ok: false,
72761
+ reason: "missing",
72762
+ message: "A delegation needs a brief: pass --brief <path> (or --brief - to read stdin), or --brief-text <text>. " + "A dispatched worker sees no announcement, no channel and no rule published after it starts, " + "so anything it is not told in the brief it will never learn."
72763
+ };
72764
+ }
72765
+ let text2;
72766
+ let source3;
72767
+ if (hasPath) {
72768
+ const path = input.briefPath;
72769
+ if (path === STDIN_SENTINEL) {
72770
+ try {
72771
+ text2 = sources.readStdin();
72772
+ } catch (error2) {
72773
+ return {
72774
+ ok: false,
72775
+ reason: "unreadable",
72776
+ message: `Could not read the brief from stdin: ${error2 instanceof Error ? error2.message : String(error2)}`
72777
+ };
72778
+ }
72779
+ source3 = "(stdin)";
72780
+ } else {
72781
+ try {
72782
+ text2 = sources.readFile(path);
72783
+ } catch (error2) {
72784
+ return {
72785
+ ok: false,
72786
+ reason: "unreadable",
72787
+ message: `Could not read the brief at ${path}: ${error2 instanceof Error ? error2.message : String(error2)}`
72788
+ };
72789
+ }
72790
+ source3 = path;
72791
+ }
72792
+ } else {
72793
+ text2 = input.briefText;
72794
+ source3 = "(--brief-text)";
72795
+ }
72796
+ if (text2.trim().length === 0) {
72797
+ return {
72798
+ ok: false,
72799
+ reason: "empty",
72800
+ message: `The brief at ${source3} is empty (it contains only whitespace). ` + "An empty brief is worse than no brief, because the dispatch record would claim the worker was briefed."
72801
+ };
72802
+ }
72803
+ return {
72804
+ ok: true,
72805
+ text: text2,
72806
+ source: source3,
72807
+ sha256: createHash17("sha256").update(text2, "utf8").digest("hex"),
72808
+ bytes: Buffer.byteLength(text2, "utf8")
72809
+ };
72810
+ }
72811
+ var STDIN_SENTINEL = "-";
72812
+ var init_delegation_brief = () => {};
72813
+
72814
+ // src/lib/delegation-policy.ts
72815
+ import { readFileSync as readFileSync20 } from "fs";
72816
+ import { homedir as homedir4 } from "os";
72817
+ import { join as join28 } from "path";
72818
+ function defaultDelegationEmbargoPath() {
72819
+ return process.env["TODOS_DELEGATION_EMBARGO_PATH"] || join28(homedir4(), ".hasna", "identities", "delegation-embargo.json");
72820
+ }
72821
+ function loadDelegationEmbargo(path = defaultDelegationEmbargoPath()) {
72822
+ try {
72823
+ const parsed = JSON.parse(readFileSync20(path, "utf8"));
72824
+ const entries = Array.isArray(parsed) ? parsed : Array.isArray(parsed?.embargoed) ? parsed.embargoed : [];
72825
+ const names = new Set;
72826
+ for (const entry2 of entries) {
72827
+ const raw = typeof entry2 === "string" ? entry2 : entry2?.slug;
72828
+ if (typeof raw === "string" && raw.trim())
72829
+ names.add(normalizeAgentNameInput(raw));
72830
+ }
72831
+ return names;
72832
+ } catch {
72833
+ return new Set;
72834
+ }
72835
+ }
72836
+ function resolveDelegationDepthThreshold(flagValue) {
72837
+ const fromFlag = coerceThreshold(flagValue);
72838
+ if (fromFlag !== null)
72839
+ return { value: fromFlag, source: "flag" };
72840
+ const fromEnv = coerceThreshold(process.env["TODOS_DELEGATION_DEPTH_THRESHOLD"]);
72841
+ if (fromEnv !== null)
72842
+ return { value: fromEnv, source: "env" };
72843
+ return { value: null, source: "unset" };
72844
+ }
72845
+ function coerceThreshold(value) {
72846
+ if (value === undefined || value === null || value === "")
72847
+ return null;
72848
+ const parsed = typeof value === "number" ? value : Number.parseInt(String(value).trim(), 10);
72849
+ if (!Number.isSafeInteger(parsed) || parsed < 0)
72850
+ return null;
72851
+ return parsed;
72852
+ }
72853
+ var DEFAULT_CLAIM_WINDOW_MINUTES = 30;
72854
+ var init_delegation_policy = () => {};
72855
+
72856
+ // src/lib/delegation-record.ts
72857
+ function formatDispatchComment(input) {
72858
+ const lines = [];
72859
+ lines.push(`${DISPATCH_COMMENT_MARKER} ${input.worker} <- ${input.dispatcher} @ ${input.dispatchedAt}`);
72860
+ lines.push(`runtime: ${input.runtime ?? "unspecified"}`);
72861
+ lines.push(`brief: ${input.briefSource} (${input.briefBytes} bytes, sha256 ${input.briefSha256})`);
72862
+ lines.push(`lineage: delegated_from=${input.dispatcher} delegation_depth=${input.depth} reports_to=${input.reportsTo}`);
72863
+ lines.push(`identity: ${input.identityOutcome}`);
72864
+ lines.push(`seat ${input.seatSlug}: ${input.seatOpenTasks} open, threshold ${input.depthThreshold === null ? "unset" : input.depthThreshold}${input.override ? `, OVERRIDE ${input.override}` : ""}`);
72865
+ lines.push(`claim deadline: ${input.claimDeadline}`);
72866
+ lines.push("started_at is deliberately NOT set: the worker claims with `todos start`.");
72867
+ return lines.join(`
72868
+ `);
72869
+ }
72870
+ function formatDispatchNotice(input) {
72871
+ const shortId = input.taskId.slice(0, 8);
72872
+ const override = input.override ? ` [${input.override}]` : "";
72873
+ return `${DISPATCH_COMMENT_MARKER} ${shortId} -> ${input.worker} ` + `(by ${input.dispatcher}, depth ${input.depth}, claim by ${input.claimDeadline})${override}`;
72874
+ }
72875
+ function claimDeadlineFrom(dispatchedAt, windowMinutes) {
72876
+ return new Date(dispatchedAt.getTime() + windowMinutes * 60000).toISOString();
72877
+ }
72878
+ var DISPATCH_COMMENT_MARKER = "[DISPATCH]";
72879
+
72880
+ // src/lib/delegation-verify.ts
72881
+ function missingDelegationLineage(persisted, expected) {
72882
+ const missing = [];
72883
+ if (!sameName(persisted.assigned_to, expected.assignedTo))
72884
+ missing.push("assigned_to");
72885
+ if (!sameName(persisted.assigned_by, expected.assignedBy))
72886
+ missing.push("assigned_by");
72887
+ if (!sameName(persisted.delegated_from, expected.delegatedFrom))
72888
+ missing.push("delegated_from");
72889
+ if (persisted.delegation_depth !== expected.depth)
72890
+ missing.push("delegation_depth");
72891
+ return missing;
72892
+ }
72893
+ function sameName(actual, wanted) {
72894
+ return typeof actual === "string" && actual.trim().toLowerCase() === wanted.trim().toLowerCase();
72895
+ }
72896
+ function partialDelegationMessage(missing, taskId) {
72897
+ return `The delegation was only PARTIALLY recorded on task ${taskId}: the authority accepted the update but did not ` + `persist ${missing.join(", ")}. ` + "The row may now be assigned without its handover lineage, so it is NOT safe to treat this as delegated. " + "This is an authority-version problem, not a connectivity, credential or storage-mode problem: the /v1 server " + "must be running a build that writes assigned_by, delegated_from and delegation_depth. " + "Re-run this exact command once it is, and the row will be completed in place.";
72898
+ }
72899
+
72900
+ // src/cli/commands/delegate.ts
72901
+ var exports_delegate = {};
72902
+ __export(exports_delegate, {
72903
+ registerDelegateCommands: () => registerDelegateCommands
72904
+ });
72905
+ import chalk12 from "chalk";
72906
+ import { readFileSync as readFileSync21 } from "fs";
72907
+ function registerDelegateCommands(program2) {
72908
+ program2.command("delegate <task> <worker>").description("Hand a filed task to a worker in one call: brief, depth, lineage, assignment, record and notice").option("--brief <path>", "Path to the self-sufficient brief; `-` reads stdin").option("--brief-text <text>", "Inline brief, as an alternative to --brief").option("--depth-threshold <n>", "Open-task count above which this delegation parks").option("--despite-depth", "Proceed past an armed depth threshold; recorded in the [DISPATCH] comment").option("--owner-directive", "Mark as an owner-directive dispatch: depth warns and never parks").option("--seat <slug>", "Seat whose open count is read (default: the lineage parent)").option("--runtime <name>", "Worker runtime label recorded in the comment (e.g. claude-code-subagent)").option("--reports-to <agent>", "Lineage parent for the worker identity (default: the dispatcher)").option("--reuse-identity", "Skip registration and reuse an existing worker identity").option("--depth <n>", "Explicit delegation_depth (default: the task's current depth + 1)").option("--channel <name>", "Channel for the one-line notice (default: $TODOS_DELEGATE_NOTICE_CHANNEL)").option("--no-post", "Skip the channel notice").option("--claim-window <minutes>", `Minutes before the claim deadline (default: ${DEFAULT_CLAIM_WINDOW_MINUTES})`).option("--assign-seat", "Allow <worker> to name a durable seat (a seat queue has no session watching it)").option("--dry-run", "Report all seven effects and perform none").option("-j, --json", "Output as JSON").action(async (taskRef, workerInput, opts) => {
72909
+ const globalOpts = program2.opts();
72910
+ const useJson = Boolean(opts.json || globalOpts.json);
72911
+ try {
72912
+ const brief = resolveDelegationBrief({ briefPath: opts.brief, briefText: opts.briefText }, {
72913
+ readFile: (path) => readFileSync21(path, "utf8"),
72914
+ readStdin: () => readFileSync21(0, "utf8")
72915
+ });
72916
+ if (!brief.ok)
72917
+ handleError(new Error(brief.message));
72918
+ const dispatcherIdentity = resolveWritableIdentity(globalOpts.agent);
72919
+ if (!dispatcherIdentity.agent_id) {
72920
+ handleError(new Error("Cannot delegate without a dispatcher identity: this verb records WHO handed the row over, " + "and a handover from nobody is not a handover. " + "Set TODOS_AGENT_ID=<name> for this session, or pass --agent <name>. " + "An identity persisted by `todos init` is deliberately not used \u2014 it is keyed on $HOME and names the station, not this session."));
72921
+ }
72922
+ const dispatcher = dispatcherIdentity.agent_id;
72923
+ const worker = await resolveValidatedAssignee(workerInput, Boolean(opts.assignSeat), (v) => `${taskRef} ${v} --assign-seat`);
72924
+ const embargo = loadDelegationEmbargo();
72925
+ const embargoedForm = [workerInput, worker].find((candidate) => embargo.has(normalizeAgentNameInput(candidate)));
72926
+ if (embargoedForm !== undefined) {
72927
+ handleError(new Error(`'${embargoedForm}' is under a delegation embargo and must not receive dispatched work. ` + "The embargo list is a file, not a constant \u2014 see TODOS_DELEGATION_EMBARGO_PATH."));
72928
+ }
72929
+ try {
72930
+ validateAgentName(worker);
72931
+ } catch (error2) {
72932
+ handleError(new Error(`Cannot delegate to '${worker}': ${error2 instanceof Error ? error2.message : String(error2)} ` + "Nothing was written \u2014 the task is unchanged and still unassigned."));
72933
+ }
72934
+ const reportsTo = (opts.reportsTo ?? dispatcher).trim();
72935
+ const seatSlug = (opts.seat ?? reportsTo).trim();
72936
+ const cloud = getTodosCloudClient();
72937
+ const taskId = await resolveTaskIdForCommand(taskRef, cloud);
72938
+ const db = cloud ? null : getDatabase();
72939
+ const task2 = cloud ? await cloudGetTask(cloud, taskId) : getTask(taskId, db);
72940
+ if (!task2)
72941
+ handleError(new Error(`Task not found: ${taskRef}`));
72942
+ const threshold = resolveDelegationDepthThreshold(opts.depthThreshold);
72943
+ const seatOpenTasks = cloud ? await cloudCountTasks(cloud, { assigned_to: seatSlug, status: "pending" }) : countTasks({ assigned_to: seatSlug, status: "pending" }, db);
72944
+ const override = opts.ownerDirective ? "owner-directive" : opts.despiteDepth ? "despite-depth" : null;
72945
+ const overThreshold = threshold.value !== null && seatOpenTasks > threshold.value;
72946
+ const parked = overThreshold && override === null;
72947
+ if (overThreshold && override === "owner-directive") {
72948
+ console.error(chalk12.yellow(`Warning: seat ${seatSlug} carries ${seatOpenTasks} open tasks (threshold ${threshold.value}); ` + "proceeding because this is an owner-directive dispatch."));
72949
+ }
72950
+ if (parked) {
72951
+ handleError(new Error(`Seat ${seatSlug} carries ${seatOpenTasks} open tasks, above the armed threshold of ${threshold.value} ` + `(from ${threshold.source}). Re-run with --despite-depth to proceed and have the override recorded, ` + "or --owner-directive if this row is an owner directive."));
72952
+ }
72953
+ const currentDepth = typeof task2.delegation_depth === "number" ? task2.delegation_depth : 0;
72954
+ const depth = opts.depth !== undefined ? Number.parseInt(opts.depth, 10) : currentDepth + 1;
72955
+ if (!Number.isSafeInteger(depth) || depth < 0) {
72956
+ handleError(new Error(`--depth must be a non-negative integer; got ${JSON.stringify(opts.depth)}`));
72957
+ }
72958
+ const dispatchedAtDate = new Date;
72959
+ const dispatchedAt = dispatchedAtDate.toISOString();
72960
+ const claimWindowMinutes = opts.claimWindow !== undefined ? Number.parseInt(opts.claimWindow, 10) : DEFAULT_CLAIM_WINDOW_MINUTES;
72961
+ if (!Number.isSafeInteger(claimWindowMinutes) || claimWindowMinutes <= 0) {
72962
+ handleError(new Error(`--claim-window must be a positive integer; got ${JSON.stringify(opts.claimWindow)}`));
72963
+ }
72964
+ const claimDeadline = claimDeadlineFrom(dispatchedAtDate, claimWindowMinutes);
72965
+ const record = {
72966
+ taskId: task2.id,
72967
+ worker,
72968
+ dispatcher,
72969
+ runtime: opts.runtime ?? null,
72970
+ briefSource: brief.source,
72971
+ briefSha256: brief.sha256,
72972
+ briefBytes: brief.bytes,
72973
+ depth,
72974
+ reportsTo,
72975
+ seatSlug,
72976
+ seatOpenTasks,
72977
+ depthThreshold: threshold.value,
72978
+ override,
72979
+ identityOutcome: opts.reuseIdentity ? "skipped" : "created",
72980
+ dispatchedAt,
72981
+ claimDeadline
72982
+ };
72983
+ if (opts.dryRun) {
72984
+ const previewChannel = opts.channel ?? process.env["TODOS_DELEGATE_NOTICE_CHANNEL"] ?? null;
72985
+ const preview = {
72986
+ dry_run: true,
72987
+ task: { id: task2.id, short_id: task2.short_id, title: task2.title },
72988
+ delegation: summarize4(record, {
72989
+ identityOutcome: opts.reuseIdentity ? "skipped" : "created",
72990
+ commentId: null,
72991
+ notice: { posted: false, channel: previewChannel, error: null }
72992
+ }),
72993
+ would: [
72994
+ "1. brief accepted (already validated)",
72995
+ `2. seat ${seatSlug}: ${seatOpenTasks} open, threshold ${threshold.value ?? "unset"}`,
72996
+ opts.reuseIdentity ? `3. registration SKIPPED (--reuse-identity); reusing ${worker}` : `3. register ${worker} with reports_to=${reportsTo}`,
72997
+ `4. assign to ${worker}; assigned_by=${dispatcher}, delegated_from=${dispatcher}, delegation_depth=${depth}`,
72998
+ "5. append the [DISPATCH] comment",
72999
+ opts.post === false ? "6. channel notice SKIPPED (--no-post)" : `6. post one notice to ${previewChannel ?? "(no channel resolved \u2014 set --channel or TODOS_DELEGATE_NOTICE_CHANNEL)"}`,
73000
+ `7. claim deadline ${claimDeadline}`
73001
+ ]
73002
+ };
73003
+ if (useJson) {
73004
+ output(preview, true);
73005
+ return;
73006
+ }
73007
+ console.log(chalk12.dim("[dry-run] no writes performed"));
73008
+ for (const line of preview.would)
73009
+ console.log(` ${line}`);
73010
+ return;
73011
+ }
73012
+ let identityOutcome = "skipped";
73013
+ if (!opts.reuseIdentity) {
73014
+ identityOutcome = await registerWorkerIdentity(worker, reportsTo, cloud, db);
73015
+ }
73016
+ record.identityOutcome = identityOutcome;
73017
+ const mergedMetadata = {
73018
+ ...task2.metadata && typeof task2.metadata === "object" ? task2.metadata : {},
73019
+ delegation: {
73020
+ worker,
73021
+ dispatcher,
73022
+ runtime: opts.runtime ?? null,
73023
+ brief_source: brief.source,
73024
+ brief_sha256: brief.sha256,
73025
+ dispatched_at: dispatchedAt,
73026
+ claim_deadline: claimDeadline,
73027
+ claim_window_minutes: claimWindowMinutes,
73028
+ depth,
73029
+ override
73030
+ }
73031
+ };
73032
+ const patch = {
73033
+ assigned_to: worker,
73034
+ assigned_by: dispatcher,
73035
+ delegated_from: dispatcher,
73036
+ delegation_depth: depth,
73037
+ metadata: mergedMetadata
73038
+ };
73039
+ const updated = cloud ? await cloudUpdateTask(cloud, task2.id, patch) : updateTask(task2.id, { ...patch, version: task2.version }, db);
73040
+ const missing = missingDelegationLineage(updated, {
73041
+ assignedTo: worker,
73042
+ assignedBy: dispatcher,
73043
+ delegatedFrom: dispatcher,
73044
+ depth
73045
+ });
73046
+ if (missing.length > 0) {
73047
+ handleError(new Error(partialDelegationMessage(missing, task2.id)));
73048
+ }
73049
+ const commentBody = formatDispatchComment(record);
73050
+ const comment = cloud ? await cloudAddComment(cloud, task2.id, { content: commentBody, agent_id: dispatcher }) : addComment({ task_id: task2.id, agent_id: dispatcher, content: commentBody }, db);
73051
+ const notice = opts.post === false ? { posted: false, channel: opts.channel ?? null, error: null } : postNotice(formatDispatchNotice(record), opts.channel ?? null);
73052
+ const payload = {
73053
+ task: updated,
73054
+ delegation: summarize4(record, {
73055
+ identityOutcome,
73056
+ commentId: comment.id,
73057
+ notice
73058
+ })
73059
+ };
73060
+ if (useJson) {
73061
+ output(payload, true);
73062
+ return;
73063
+ }
73064
+ console.log(chalk12.green(`Delegated ${updated.short_id ?? updated.id.slice(0, 8)} to ${worker}`));
73065
+ console.log(chalk12.dim(` by ${dispatcher}, depth ${depth}, seat ${seatSlug} has ${seatOpenTasks} open`));
73066
+ console.log(chalk12.dim(` brief ${brief.source} (sha256 ${brief.sha256.slice(0, 12)}\u2026)`));
73067
+ console.log(chalk12.dim(` claim by ${claimDeadline}; the worker claims with \`todos start\``));
73068
+ if (!notice.posted && opts.post !== false) {
73069
+ console.error(chalk12.yellow(`Warning: the channel notice was not posted: ${notice.error ?? "unknown reason"}`));
73070
+ }
73071
+ } catch (e) {
73072
+ handleError(e);
73073
+ }
73074
+ });
73075
+ }
73076
+ function summarize4(record, extra) {
73077
+ return {
73078
+ worker: record.worker,
73079
+ dispatcher: record.dispatcher,
73080
+ runtime: record.runtime,
73081
+ depth: record.depth,
73082
+ reports_to: record.reportsTo,
73083
+ brief: { source: record.briefSource, sha256: record.briefSha256, bytes: record.briefBytes },
73084
+ seat: {
73085
+ slug: record.seatSlug,
73086
+ open_tasks: record.seatOpenTasks,
73087
+ threshold: record.depthThreshold,
73088
+ parked: false,
73089
+ override: record.override
73090
+ },
73091
+ identity: { name: record.worker, reports_to: record.reportsTo, outcome: extra.identityOutcome },
73092
+ comment_id: extra.commentId,
73093
+ dispatched_at: record.dispatchedAt,
73094
+ claim_deadline: record.claimDeadline,
73095
+ notice: extra.notice,
73096
+ started_at_written: false
73097
+ };
73098
+ }
73099
+ async function registerWorkerIdentity(worker, reportsTo, cloud, db) {
73100
+ if (cloud) {
73101
+ const existing = (await cloudListAgents(cloud)).find((a) => normalizeAgentNameInput(a.name) === normalizeAgentNameInput(worker));
73102
+ if (existing)
73103
+ return "reused";
73104
+ try {
73105
+ await cloudRegisterAgent(cloud, { name: worker, reports_to: reportsTo });
73106
+ return "created";
73107
+ } catch (error2) {
73108
+ const status = error2 && typeof error2 === "object" ? error2.status : undefined;
73109
+ if (status === 409)
73110
+ return "reused";
73111
+ throw error2;
73112
+ }
73113
+ }
73114
+ if (getAgentByName(worker, db))
73115
+ return "reused";
73116
+ const result = registerAgent({ name: worker, reports_to: reportsTo }, db);
73117
+ return isAgentConflict(result) ? "reused" : "created";
73118
+ }
73119
+ function postNotice(line, channel) {
73120
+ const resolved = channel || process.env["TODOS_DELEGATE_NOTICE_CHANNEL"] || null;
73121
+ if (!resolved) {
73122
+ return {
73123
+ posted: false,
73124
+ channel: null,
73125
+ error: "no channel resolved: pass --channel <name>, set TODOS_DELEGATE_NOTICE_CHANNEL, " + "or pass --no-post to skip the notice deliberately"
73126
+ };
73127
+ }
73128
+ channel = resolved;
73129
+ const bin = process.env["TODOS_DELEGATE_NOTIFY_BIN"] || "conversations";
73130
+ try {
73131
+ const proc = Bun.spawnSync([bin, "send", "--channel", channel, line], { stdout: "pipe", stderr: "pipe" });
73132
+ if (proc.exitCode !== 0) {
73133
+ const stderr = new TextDecoder().decode(proc.stderr).trim();
73134
+ return { posted: false, channel, error: stderr || `${bin} exited ${proc.exitCode}` };
73135
+ }
73136
+ return { posted: true, channel, error: null };
73137
+ } catch (error2) {
73138
+ return { posted: false, channel, error: error2 instanceof Error ? error2.message : String(error2) };
73139
+ }
73140
+ }
73141
+ var init_delegate = __esm(() => {
73142
+ init_cloud_router();
73143
+ init_database();
73144
+ init_tasks();
73145
+ init_comments();
73146
+ init_agents();
73147
+ init_agent_names();
73148
+ init_creator_identity();
73149
+ init_delegation_brief();
73150
+ init_delegation_policy();
73151
+ init_assignee_guard();
73152
+ init_helpers();
73153
+ });
73154
+
72729
73155
  // src/cli/commands/machines.tsx
72730
73156
  var exports_machines = {};
72731
73157
  __export(exports_machines, {
72732
73158
  registerMachineCommands: () => registerMachineCommands
72733
73159
  });
72734
- import chalk12 from "chalk";
73160
+ import chalk13 from "chalk";
72735
73161
  import { execSync as execSync4 } from "child_process";
72736
- import { readFileSync as readFileSync20, unlinkSync as unlinkSync3, writeFileSync as writeFileSync14 } from "fs";
73162
+ import { readFileSync as readFileSync22, unlinkSync as unlinkSync3, writeFileSync as writeFileSync14 } from "fs";
72737
73163
  import { tmpdir as tmpdir5 } from "os";
72738
- import { join as join28 } from "path";
73164
+ import { join as join29 } from "path";
72739
73165
  function getOrCreateLocalMachineName() {
72740
73166
  return process.env["TODOS_MACHINE_NAME"] || __require("os").hostname() || "unknown";
72741
73167
  }
@@ -72773,11 +73199,11 @@ function remoteTempPath(sshAddress) {
72773
73199
  }
72774
73200
  function readRemoteBridgeBundle(sshAddress) {
72775
73201
  const remotePath = remoteTempPath(sshAddress);
72776
- const localPath = join28(tmpdir5(), `todos-bridge-pull-${uuid()}.json`);
73202
+ const localPath = join29(tmpdir5(), `todos-bridge-pull-${uuid()}.json`);
72777
73203
  try {
72778
73204
  runSsh(sshAddress, `todos export --format bridge --allow-plaintext-sensitive --output ${shellQuote(remotePath)}`, 120000);
72779
73205
  scpFromRemote(sshAddress, remotePath, localPath);
72780
- return JSON.parse(readFileSync20(localPath, "utf-8"));
73206
+ return JSON.parse(readFileSync22(localPath, "utf-8"));
72781
73207
  } finally {
72782
73208
  try {
72783
73209
  runSsh(sshAddress, `rm -f ${shellQuote(remotePath)}`, 1e4);
@@ -72788,7 +73214,7 @@ function readRemoteBridgeBundle(sshAddress) {
72788
73214
  }
72789
73215
  }
72790
73216
  function writeLocalBridgeBundle() {
72791
- const localPath = join28(tmpdir5(), `todos-bridge-push-${uuid()}.json`);
73217
+ const localPath = join29(tmpdir5(), `todos-bridge-push-${uuid()}.json`);
72792
73218
  writeFileSync14(localPath, JSON.stringify(createLocalBridgeBundle(), null, 2));
72793
73219
  return localPath;
72794
73220
  }
@@ -72825,17 +73251,17 @@ function registerMachineCommands(program2) {
72825
73251
  const db = getDatabase();
72826
73252
  const machines = listMachines(db, opts.all);
72827
73253
  if (machines.length === 0) {
72828
- console.log(chalk12.yellow("No machines registered."));
72829
- console.log(chalk12.dim("Use `todos machines register` to add one."));
73254
+ console.log(chalk13.yellow("No machines registered."));
73255
+ console.log(chalk13.dim("Use `todos machines register` to add one."));
72830
73256
  return;
72831
73257
  }
72832
73258
  for (const m of machines) {
72833
- const primaryTag = m.is_primary ? chalk12.bold(" [PRIMARY]") : "";
72834
- const archivedTag = m.archived_at ? chalk12.dim(" [ARCHIVED]") : "";
72835
- console.log(`${chalk12.cyan(m.name)} (${m.id.slice(0, 8)})${primaryTag}${archivedTag}`);
72836
- console.log(chalk12.dim(` Host: ${m.hostname ?? "unknown"} | Platform: ${m.platform ?? "unknown"}`));
72837
- console.log(chalk12.dim(` SSH: ${m.ssh_address ?? "(not set)"}`));
72838
- console.log(chalk12.dim(` Last seen: ${m.last_seen_at}`));
73259
+ const primaryTag = m.is_primary ? chalk13.bold(" [PRIMARY]") : "";
73260
+ const archivedTag = m.archived_at ? chalk13.dim(" [ARCHIVED]") : "";
73261
+ console.log(`${chalk13.cyan(m.name)} (${m.id.slice(0, 8)})${primaryTag}${archivedTag}`);
73262
+ console.log(chalk13.dim(` Host: ${m.hostname ?? "unknown"} | Platform: ${m.platform ?? "unknown"}`));
73263
+ console.log(chalk13.dim(` SSH: ${m.ssh_address ?? "(not set)"}`));
73264
+ console.log(chalk13.dim(` Last seen: ${m.last_seen_at}`));
72839
73265
  }
72840
73266
  });
72841
73267
  machinesCmd.command("register").description("Register a machine").argument("<name>", "Machine name").option("--hostname <host>", "OS hostname").option("--platform <platform>", "OS platform").option("--ssh <address>", "SSH address (e.g. user@host)").option("--arch <arch>", "Architecture (e.g. linux-arm64)").option("--tailscale-name <name>", "User-provided Tailscale/MagicDNS name").option("--tailscale-ip <ip>", "User-provided Tailscale IP").option("--lan-address <address>", "User-provided LAN address").option("--workspace <path>", "Local workspace path for this machine").option("--git-root <path>", "Local git root for this machine").option("--primary", "Set as primary machine").option("-j, --json", "Output as JSON").action((name, opts) => {
@@ -72857,17 +73283,17 @@ function registerMachineCommands(program2) {
72857
73283
  console.log(JSON.stringify(machine));
72858
73284
  return;
72859
73285
  }
72860
- console.log(chalk12.green(`Machine registered: ${machine.name} (${machine.id.slice(0, 8)})`));
72861
- console.log(chalk12.dim(` Host: ${machine.hostname} | Platform: ${machine.platform}`));
72862
- console.log(chalk12.dim(` Primary: ${machine.is_primary}`));
73286
+ console.log(chalk13.green(`Machine registered: ${machine.name} (${machine.id.slice(0, 8)})`));
73287
+ console.log(chalk13.dim(` Host: ${machine.hostname} | Platform: ${machine.platform}`));
73288
+ console.log(chalk13.dim(` Primary: ${machine.is_primary}`));
72863
73289
  if (machine.ssh_address)
72864
- console.log(chalk12.dim(` SSH: ${machine.ssh_address}`));
73290
+ console.log(chalk13.dim(` SSH: ${machine.ssh_address}`));
72865
73291
  if (machine.metadata["tailscale_name"])
72866
- console.log(chalk12.dim(` Tailscale: ${machine.metadata["tailscale_name"]}`));
73292
+ console.log(chalk13.dim(` Tailscale: ${machine.metadata["tailscale_name"]}`));
72867
73293
  if (machine.metadata["lan_address"])
72868
- console.log(chalk12.dim(` LAN: ${machine.metadata["lan_address"]}`));
73294
+ console.log(chalk13.dim(` LAN: ${machine.metadata["lan_address"]}`));
72869
73295
  } catch (err) {
72870
- console.error(chalk12.red(err instanceof Error ? err.message : String(err)));
73296
+ console.error(chalk13.red(err instanceof Error ? err.message : String(err)));
72871
73297
  process.exit(1);
72872
73298
  }
72873
73299
  });
@@ -72889,10 +73315,10 @@ function registerMachineCommands(program2) {
72889
73315
  console.log(JSON.stringify(machine));
72890
73316
  return;
72891
73317
  }
72892
- console.log(chalk12.green(`Heartbeat recorded: ${machine.name} (${machine.id.slice(0, 8)})`));
72893
- console.log(chalk12.dim(` Last seen: ${machine.last_seen_at}`));
73318
+ console.log(chalk13.green(`Heartbeat recorded: ${machine.name} (${machine.id.slice(0, 8)})`));
73319
+ console.log(chalk13.dim(` Last seen: ${machine.last_seen_at}`));
72894
73320
  } catch (err) {
72895
- console.error(chalk12.red(err instanceof Error ? err.message : String(err)));
73321
+ console.error(chalk13.red(err instanceof Error ? err.message : String(err)));
72896
73322
  process.exit(1);
72897
73323
  }
72898
73324
  });
@@ -72900,9 +73326,9 @@ function registerMachineCommands(program2) {
72900
73326
  try {
72901
73327
  const db = getDatabase();
72902
73328
  const machine = setPrimaryMachine(name, db);
72903
- console.log(chalk12.green(`Primary machine set to: ${machine.name} (${machine.id.slice(0, 8)})`));
73329
+ console.log(chalk13.green(`Primary machine set to: ${machine.name} (${machine.id.slice(0, 8)})`));
72904
73330
  } catch (err) {
72905
- console.error(chalk12.red(err instanceof Error ? err.message : String(err)));
73331
+ console.error(chalk13.red(err instanceof Error ? err.message : String(err)));
72906
73332
  process.exit(1);
72907
73333
  }
72908
73334
  });
@@ -72911,13 +73337,13 @@ function registerMachineCommands(program2) {
72911
73337
  const db = getDatabase();
72912
73338
  const machine = getMachineByName(name, db);
72913
73339
  if (!machine) {
72914
- console.error(chalk12.red(`Machine '${name}' not found`));
73340
+ console.error(chalk13.red(`Machine '${name}' not found`));
72915
73341
  process.exit(1);
72916
73342
  }
72917
73343
  archiveMachine(machine.id, db);
72918
- console.log(chalk12.green(`Machine '${name}' archived`));
73344
+ console.log(chalk13.green(`Machine '${name}' archived`));
72919
73345
  } catch (err) {
72920
- console.error(chalk12.red(err instanceof Error ? err.message : String(err)));
73346
+ console.error(chalk13.red(err instanceof Error ? err.message : String(err)));
72921
73347
  process.exit(1);
72922
73348
  }
72923
73349
  });
@@ -72926,13 +73352,13 @@ function registerMachineCommands(program2) {
72926
73352
  const db = getDatabase();
72927
73353
  const machine = getMachineByName(name, db);
72928
73354
  if (!machine) {
72929
- console.error(chalk12.red(`Machine '${name}' not found`));
73355
+ console.error(chalk13.red(`Machine '${name}' not found`));
72930
73356
  process.exit(1);
72931
73357
  }
72932
73358
  unarchiveMachine(machine.id, db);
72933
- console.log(chalk12.green(`Machine '${name}' unarchived`));
73359
+ console.log(chalk13.green(`Machine '${name}' unarchived`));
72934
73360
  } catch (err) {
72935
- console.error(chalk12.red(err instanceof Error ? err.message : String(err)));
73361
+ console.error(chalk13.red(err instanceof Error ? err.message : String(err)));
72936
73362
  process.exit(1);
72937
73363
  }
72938
73364
  });
@@ -72941,13 +73367,13 @@ function registerMachineCommands(program2) {
72941
73367
  const db = getDatabase();
72942
73368
  const machine = getMachineByName(name, db);
72943
73369
  if (!machine) {
72944
- console.error(chalk12.red(`Machine '${name}' not found`));
73370
+ console.error(chalk13.red(`Machine '${name}' not found`));
72945
73371
  process.exit(1);
72946
73372
  }
72947
73373
  deleteMachine(machine.id, db);
72948
- console.log(chalk12.green(`Machine '${name}' deleted`));
73374
+ console.log(chalk13.green(`Machine '${name}' deleted`));
72949
73375
  } catch (err) {
72950
- console.error(chalk12.red(err instanceof Error ? err.message : String(err)));
73376
+ console.error(chalk13.red(err instanceof Error ? err.message : String(err)));
72951
73377
  process.exit(1);
72952
73378
  }
72953
73379
  });
@@ -72956,39 +73382,39 @@ function registerMachineCommands(program2) {
72956
73382
  const machines = listMachines(db);
72957
73383
  const primary = getPrimaryMachine(db);
72958
73384
  if (machines.length === 0) {
72959
- console.log(chalk12.yellow("No machines registered."));
73385
+ console.log(chalk13.yellow("No machines registered."));
72960
73386
  return;
72961
73387
  }
72962
- console.log(chalk12.bold(`
73388
+ console.log(chalk13.bold(`
72963
73389
  Machine Health`));
72964
- console.log(chalk12.dim("\u2500".repeat(60)));
73390
+ console.log(chalk13.dim("\u2500".repeat(60)));
72965
73391
  for (const m of machines) {
72966
- const primaryTag = m.is_primary ? chalk12.bold(" [PRIMARY]") : "";
73392
+ const primaryTag = m.is_primary ? chalk13.bold(" [PRIMARY]") : "";
72967
73393
  const lastSeen = new Date(m.last_seen_at);
72968
73394
  const nowDate = new Date;
72969
73395
  const diffMs = nowDate.getTime() - lastSeen.getTime();
72970
73396
  const diffMin = Math.round(diffMs / 60000);
72971
73397
  let status;
72972
73398
  if (diffMin < 5) {
72973
- status = chalk12.green("online");
73399
+ status = chalk13.green("online");
72974
73400
  } else if (diffMin < 60) {
72975
- status = chalk12.yellow("stale");
73401
+ status = chalk13.yellow("stale");
72976
73402
  } else {
72977
- status = chalk12.red("offline");
73403
+ status = chalk13.red("offline");
72978
73404
  }
72979
- console.log(`${chalk12.cyan(m.name)}${primaryTag} ${status} last: ${diffMin}m ago`);
73405
+ console.log(`${chalk13.cyan(m.name)}${primaryTag} ${status} last: ${diffMin}m ago`);
72980
73406
  }
72981
73407
  if (!primary) {
72982
- console.log(chalk12.yellow(`
73408
+ console.log(chalk13.yellow(`
72983
73409
  Warning: No primary machine set.`));
72984
- console.log(chalk12.dim("Use `todos machines set-primary <name>` to set one."));
73410
+ console.log(chalk13.dim("Use `todos machines set-primary <name>` to set one."));
72985
73411
  }
72986
73412
  });
72987
73413
  machinesCmd.command("topology").description("Show local machine topology diagnostics").option("--stale-minutes <n>", "Minutes before a machine is considered stale", "30").option("--include-archived", "Include archived machines").option("-j, --json", "Output as JSON").action((opts) => {
72988
73414
  try {
72989
73415
  const staleMinutes = Number.parseInt(opts.staleMinutes, 10);
72990
73416
  if (!Number.isFinite(staleMinutes) || staleMinutes < 1) {
72991
- console.error(chalk12.red("Invalid --stale-minutes value. Must be a positive integer."));
73417
+ console.error(chalk13.red("Invalid --stale-minutes value. Must be a positive integer."));
72992
73418
  process.exit(1);
72993
73419
  }
72994
73420
  const diagnostics = getMachineTopologyDiagnostics({
@@ -72999,26 +73425,26 @@ Warning: No primary machine set.`));
72999
73425
  console.log(JSON.stringify(diagnostics));
73000
73426
  return;
73001
73427
  }
73002
- console.log(chalk12.bold(`
73428
+ console.log(chalk13.bold(`
73003
73429
  Machine Topology`));
73004
- console.log(chalk12.dim("\u2500".repeat(60)));
73430
+ console.log(chalk13.dim("\u2500".repeat(60)));
73005
73431
  for (const machine of diagnostics.machines) {
73006
- const stale = machine.stale ? chalk12.red(` stale ${machine.stale_minutes}m`) : chalk12.green(" fresh");
73432
+ const stale = machine.stale ? chalk13.red(` stale ${machine.stale_minutes}m`) : chalk13.green(" fresh");
73007
73433
  const ts = machine.topology.tailscale_ip ? ` ts:${machine.topology.tailscale_ip}` : "";
73008
73434
  const lan = machine.topology.lan_address ? ` lan:${machine.topology.lan_address}` : "";
73009
73435
  const workspace = machine.topology.workspace_path ? `
73010
73436
  workspace: ${machine.topology.workspace_path}` : "";
73011
- console.log(`${chalk12.cyan(machine.name)}${stale}${chalk12.dim(ts + lan)}${chalk12.dim(workspace)}`);
73437
+ console.log(`${chalk13.cyan(machine.name)}${stale}${chalk13.dim(ts + lan)}${chalk13.dim(workspace)}`);
73012
73438
  }
73013
73439
  if (diagnostics.path_issues.length > 0) {
73014
- console.log(chalk12.yellow(`
73440
+ console.log(chalk13.yellow(`
73015
73441
  Path diagnostics (${diagnostics.path_issues.length})`));
73016
73442
  for (const issue of diagnostics.path_issues) {
73017
- console.log(chalk12.yellow(` ${issue.type}: ${issue.message}`));
73443
+ console.log(chalk13.yellow(` ${issue.type}: ${issue.message}`));
73018
73444
  }
73019
73445
  }
73020
73446
  } catch (err) {
73021
- console.error(chalk12.red(err instanceof Error ? err.message : String(err)));
73447
+ console.error(chalk13.red(err instanceof Error ? err.message : String(err)));
73022
73448
  process.exit(1);
73023
73449
  }
73024
73450
  });
@@ -73046,7 +73472,7 @@ Path diagnostics (${diagnostics.path_issues.length})`));
73046
73472
  }, null, 2));
73047
73473
  return;
73048
73474
  }
73049
- console.log(chalk12.dim(opts.machine ? `No remote SSH target found for machine '${opts.machine}'.` : "No remote machines with SSH addresses to sync."));
73475
+ console.log(chalk13.dim(opts.machine ? `No remote SSH target found for machine '${opts.machine}'.` : "No remote machines with SSH addresses to sync."));
73050
73476
  return;
73051
73477
  }
73052
73478
  const results = [];
@@ -73061,14 +73487,14 @@ Path diagnostics (${diagnostics.path_issues.length})`));
73061
73487
  const record = { machine: target.name, pull };
73062
73488
  if (!wantsJson(program2, opts)) {
73063
73489
  const mode = opts.dryRun ? "would pull" : "pulled";
73064
- console.log(chalk12.green(` ${target.name}: ${mode} ${formatBridgeImportSummary(pull)}`));
73490
+ console.log(chalk13.green(` ${target.name}: ${mode} ${formatBridgeImportSummary(pull)}`));
73065
73491
  }
73066
73492
  if (opts.push) {
73067
73493
  const push = pushLocalBridgeBundle(ssh, Boolean(opts.dryRun));
73068
73494
  record.push = push;
73069
73495
  if (!wantsJson(program2, opts)) {
73070
73496
  const mode = opts.dryRun ? "would push" : "pushed";
73071
- console.log(chalk12.green(` ${target.name}: ${mode} ${formatBridgeImportSummary(push)}`));
73497
+ console.log(chalk13.green(` ${target.name}: ${mode} ${formatBridgeImportSummary(push)}`));
73072
73498
  }
73073
73499
  }
73074
73500
  results.push(record);
@@ -73076,7 +73502,7 @@ Path diagnostics (${diagnostics.path_issues.length})`));
73076
73502
  const message = error2 instanceof Error ? error2.message : String(error2);
73077
73503
  results.push({ machine: target.name, error: message });
73078
73504
  if (!wantsJson(program2, opts))
73079
- console.log(chalk12.yellow(` ${target.name}: sync failed: ${message}`));
73505
+ console.log(chalk13.yellow(` ${target.name}: sync failed: ${message}`));
73080
73506
  }
73081
73507
  }
73082
73508
  if (wantsJson(program2, opts)) {
@@ -73087,19 +73513,19 @@ Path diagnostics (${diagnostics.path_issues.length})`));
73087
73513
  }, null, 2));
73088
73514
  return;
73089
73515
  }
73090
- console.log(chalk12.bold(`
73516
+ console.log(chalk13.bold(`
73091
73517
  Sync ${opts.dryRun ? "dry-run" : "complete"}: ${results.length} machine(s) checked.`));
73092
73518
  });
73093
73519
  machinesCmd.command("tasks").description("List tasks from a remote machine via SSH").argument("<machine-name>", "Machine name (must have SSH address)").option("--status <status>", "Filter by status").action((machineName, opts) => {
73094
73520
  const db = getDatabase();
73095
73521
  const machine = getMachineByName(machineName, db);
73096
73522
  if (!machine) {
73097
- console.error(chalk12.red(`Machine '${machineName}' not found`));
73523
+ console.error(chalk13.red(`Machine '${machineName}' not found`));
73098
73524
  process.exit(1);
73099
73525
  }
73100
73526
  const sshAddress = resolveMachineSshAddress(machine, getOrCreateLocalMachineName());
73101
73527
  if (!sshAddress) {
73102
- console.error(chalk12.red(`Machine '${machineName}' has no SSH address`));
73528
+ console.error(chalk13.red(`Machine '${machineName}' has no SSH address`));
73103
73529
  process.exit(1);
73104
73530
  }
73105
73531
  try {
@@ -73107,19 +73533,19 @@ Sync ${opts.dryRun ? "dry-run" : "complete"}: ${results.length} machine(s) check
73107
73533
  const tasks = bundle.data.tasks;
73108
73534
  const filtered = opts.status ? tasks.filter((t) => t.status === opts.status) : tasks;
73109
73535
  if (filtered.length === 0) {
73110
- console.log(chalk12.dim(`No tasks on ${machineName}`));
73536
+ console.log(chalk13.dim(`No tasks on ${machineName}`));
73111
73537
  return;
73112
73538
  }
73113
- console.log(chalk12.bold(`${filtered.length} task(s) on ${machineName}:
73539
+ console.log(chalk13.bold(`${filtered.length} task(s) on ${machineName}:
73114
73540
  `));
73115
73541
  for (const t of filtered) {
73116
73542
  const check = t.status === "completed" ? "x" : " ";
73117
- const prio = t.priority ? chalk12.yellow(`[${t.priority}]`) : "";
73543
+ const prio = t.priority ? chalk13.yellow(`[${t.priority}]`) : "";
73118
73544
  console.log(` [${check}] ${t.short_id || t.id.slice(0, 8)} ${prio} ${t.title}`);
73119
73545
  }
73120
73546
  } catch (error2) {
73121
73547
  const message = error2 instanceof Error ? error2.message : String(error2);
73122
- console.error(chalk12.red(`Could not read tasks from ${sshAddress}: ${message}`));
73548
+ console.error(chalk13.red(`Could not read tasks from ${sshAddress}: ${message}`));
73123
73549
  process.exit(1);
73124
73550
  }
73125
73551
  });
@@ -73135,7 +73561,7 @@ var exports_api_key_commands = {};
73135
73561
  __export(exports_api_key_commands, {
73136
73562
  registerApiKeyCommands: () => registerApiKeyCommands
73137
73563
  });
73138
- import chalk13 from "chalk";
73564
+ import chalk14 from "chalk";
73139
73565
  function registerApiKeyCommands(program2) {
73140
73566
  const apiKeys = program2.command("api-keys").alias("api-key").description("Generate, list, and revoke API keys for secured app/API access");
73141
73567
  apiKeys.command("create <name>").alias("generate").description("Generate a new API key. The plaintext key is shown once.").option("--expires-at <iso>", "Optional ISO timestamp when this key expires").option("--permissions <list>", "Comma-separated permissions (default: *)").action((name, opts) => {
@@ -73147,12 +73573,12 @@ function registerApiKeyCommands(program2) {
73147
73573
  output(created, true);
73148
73574
  return;
73149
73575
  }
73150
- console.log(chalk13.green("API key generated:"));
73151
- console.log(` ${chalk13.dim("ID:")} ${created.record.id}`);
73152
- console.log(` ${chalk13.dim("Name:")} ${created.record.name}`);
73153
- console.log(` ${chalk13.dim("Prefix:")} ${created.record.prefix}`);
73576
+ console.log(chalk14.green("API key generated:"));
73577
+ console.log(` ${chalk14.dim("ID:")} ${created.record.id}`);
73578
+ console.log(` ${chalk14.dim("Name:")} ${created.record.name}`);
73579
+ console.log(` ${chalk14.dim("Prefix:")} ${created.record.prefix}`);
73154
73580
  console.log();
73155
- console.log(chalk13.yellow("Copy this key now. It will not be shown again:"));
73581
+ console.log(chalk14.yellow("Copy this key now. It will not be shown again:"));
73156
73582
  console.log(created.key);
73157
73583
  } catch (e) {
73158
73584
  handleError(e);
@@ -73167,16 +73593,16 @@ function registerApiKeyCommands(program2) {
73167
73593
  return;
73168
73594
  }
73169
73595
  if (keys.length === 0) {
73170
- console.log(chalk13.dim("No API keys found."));
73596
+ console.log(chalk14.dim("No API keys found."));
73171
73597
  return;
73172
73598
  }
73173
73599
  for (const key of keys) {
73174
- const state = key.revoked_at ? chalk13.red("revoked") : key.expires_at && key.expires_at < new Date().toISOString() ? chalk13.yellow("expired") : chalk13.green("active");
73175
- console.log(`${chalk13.cyan(key.id)} ${chalk13.bold(key.name)} ${chalk13.dim(key.prefix)} ${state}`);
73600
+ const state = key.revoked_at ? chalk14.red("revoked") : key.expires_at && key.expires_at < new Date().toISOString() ? chalk14.yellow("expired") : chalk14.green("active");
73601
+ console.log(`${chalk14.cyan(key.id)} ${chalk14.bold(key.name)} ${chalk14.dim(key.prefix)} ${state}`);
73176
73602
  if (key.last_used_at)
73177
- console.log(chalk13.dim(` last used: ${key.last_used_at}`));
73603
+ console.log(chalk14.dim(` last used: ${key.last_used_at}`));
73178
73604
  if (key.expires_at)
73179
- console.log(chalk13.dim(` expires: ${key.expires_at}`));
73605
+ console.log(chalk14.dim(` expires: ${key.expires_at}`));
73180
73606
  }
73181
73607
  } catch (e) {
73182
73608
  handleError(e);
@@ -73193,7 +73619,7 @@ function registerApiKeyCommands(program2) {
73193
73619
  output(revoked, true);
73194
73620
  return;
73195
73621
  }
73196
- console.log(chalk13.green(`Revoked API key: ${revoked.name} (${revoked.prefix})`));
73622
+ console.log(chalk14.green(`Revoked API key: ${revoked.name} (${revoked.prefix})`));
73197
73623
  } catch (e) {
73198
73624
  handleError(e);
73199
73625
  }
@@ -73209,7 +73635,7 @@ function registerApiKeyCommands(program2) {
73209
73635
  if (!record) {
73210
73636
  handleError(new Error("API key is invalid, revoked, or expired."));
73211
73637
  }
73212
- console.log(chalk13.green(`API key valid: ${record.name} (${record.prefix})`));
73638
+ console.log(chalk14.green(`API key valid: ${record.name} (${record.prefix})`));
73213
73639
  } catch (e) {
73214
73640
  handleError(e);
73215
73641
  }
@@ -73225,7 +73651,7 @@ var exports_environment_snapshots2 = {};
73225
73651
  __export(exports_environment_snapshots2, {
73226
73652
  registerEnvironmentSnapshotCommands: () => registerEnvironmentSnapshotCommands
73227
73653
  });
73228
- import chalk14 from "chalk";
73654
+ import chalk15 from "chalk";
73229
73655
  function printJson2(value) {
73230
73656
  console.log(JSON.stringify(value, null, 2));
73231
73657
  }
@@ -73247,7 +73673,7 @@ function registerEnvironmentSnapshotCommands(program2) {
73247
73673
  printJson2(result);
73248
73674
  return;
73249
73675
  }
73250
- console.log(chalk14.green("Captured") + ` ${result.snapshot.id}`);
73676
+ console.log(chalk15.green("Captured") + ` ${result.snapshot.id}`);
73251
73677
  console.log(`path: ${result.output_path}`);
73252
73678
  console.log(`root: ${result.snapshot.root}`);
73253
73679
  console.log(`git: ${result.snapshot.git.commit || "none"}${result.snapshot.git.is_dirty ? " dirty" : ""}`);
@@ -73257,13 +73683,13 @@ function registerEnvironmentSnapshotCommands(program2) {
73257
73683
  if (result.task_verification_id)
73258
73684
  console.log(`task verification: ${result.task_verification_id}`);
73259
73685
  for (const warning of result.snapshot.warnings)
73260
- console.log(chalk14.yellow(`warning: ${warning}`));
73686
+ console.log(chalk15.yellow(`warning: ${warning}`));
73261
73687
  } catch (error2) {
73262
73688
  const message = error2 instanceof Error ? error2.message : String(error2);
73263
73689
  if (globalOpts.json)
73264
73690
  printJson2({ error: message });
73265
73691
  else
73266
- console.error(chalk14.red(`Error: ${message}`));
73692
+ console.error(chalk15.red(`Error: ${message}`));
73267
73693
  process.exit(1);
73268
73694
  }
73269
73695
  });
@@ -73289,7 +73715,7 @@ function registerEnvironmentSnapshotCommands(program2) {
73289
73715
  if (globalOpts.json)
73290
73716
  printJson2({ error: message });
73291
73717
  else
73292
- console.error(chalk14.red(`Error: ${message}`));
73718
+ console.error(chalk15.red(`Error: ${message}`));
73293
73719
  process.exit(1);
73294
73720
  }
73295
73721
  });
@@ -73303,7 +73729,7 @@ var exports_knowledge_commands = {};
73303
73729
  __export(exports_knowledge_commands, {
73304
73730
  registerKnowledgeCommands: () => registerKnowledgeCommands
73305
73731
  });
73306
- import chalk15 from "chalk";
73732
+ import chalk16 from "chalk";
73307
73733
  function parseRecordType(value) {
73308
73734
  if (RECORD_TYPES.includes(value))
73309
73735
  return value;
@@ -73339,13 +73765,13 @@ function commonFilters(opts) {
73339
73765
  };
73340
73766
  }
73341
73767
  function printRecord(record) {
73342
- console.log(`${chalk15.cyan(record.id.slice(0, 8))} ${chalk15.yellow(record.record_type)} ${record.title}`);
73768
+ console.log(`${chalk16.cyan(record.id.slice(0, 8))} ${chalk16.yellow(record.record_type)} ${record.title}`);
73343
73769
  if (record.task_id)
73344
- console.log(chalk15.dim(` task: ${record.task_id}`));
73770
+ console.log(chalk16.dim(` task: ${record.task_id}`));
73345
73771
  if (record.project_id)
73346
- console.log(chalk15.dim(` project: ${record.project_id}`));
73772
+ console.log(chalk16.dim(` project: ${record.project_id}`));
73347
73773
  if (record.tags.length > 0)
73348
- console.log(chalk15.dim(` tags: ${record.tags.join(", ")}`));
73774
+ console.log(chalk16.dim(` tags: ${record.tags.join(", ")}`));
73349
73775
  if (record.decision)
73350
73776
  console.log(` decision: ${record.decision}`);
73351
73777
  else if (record.content)
@@ -73398,7 +73824,7 @@ function registerKnowledgeCommands(program2) {
73398
73824
  if (opts.json || globalOpts.json)
73399
73825
  output(result, true);
73400
73826
  else {
73401
- console.log(chalk15.green(`Snapshot ${result.snapshot_id.slice(0, 8)} saved.`));
73827
+ console.log(chalk16.green(`Snapshot ${result.snapshot_id.slice(0, 8)} saved.`));
73402
73828
  printRecord(result.record);
73403
73829
  }
73404
73830
  } catch (error2) {
@@ -73472,7 +73898,7 @@ var exports_risk_commands = {};
73472
73898
  __export(exports_risk_commands, {
73473
73899
  registerRiskCommands: () => registerRiskCommands
73474
73900
  });
73475
- import chalk16 from "chalk";
73901
+ import chalk17 from "chalk";
73476
73902
  function parseChoice(value, choices, label) {
73477
73903
  if (choices.includes(value))
73478
73904
  return value;
@@ -73511,16 +73937,16 @@ function commonFilters2(opts) {
73511
73937
  };
73512
73938
  }
73513
73939
  function printRisk(risk) {
73514
- const color = risk.severity === "critical" ? chalk16.red : risk.severity === "high" ? chalk16.yellow : chalk16.white;
73515
- console.log(`${chalk16.cyan(risk.id.slice(0, 8))} ${color(risk.severity)} ${chalk16.bold(risk.status)} ${risk.title}`);
73940
+ const color = risk.severity === "critical" ? chalk17.red : risk.severity === "high" ? chalk17.yellow : chalk17.white;
73941
+ console.log(`${chalk17.cyan(risk.id.slice(0, 8))} ${color(risk.severity)} ${chalk17.bold(risk.status)} ${risk.title}`);
73516
73942
  if (risk.owner)
73517
- console.log(chalk16.dim(` owner: ${risk.owner}`));
73943
+ console.log(chalk17.dim(` owner: ${risk.owner}`));
73518
73944
  if (risk.due_at)
73519
- console.log(chalk16.dim(` due: ${risk.due_at}`));
73945
+ console.log(chalk17.dim(` due: ${risk.due_at}`));
73520
73946
  if (risk.plan_id)
73521
- console.log(chalk16.dim(` plan: ${risk.plan_id}`));
73947
+ console.log(chalk17.dim(` plan: ${risk.plan_id}`));
73522
73948
  if (risk.project_id)
73523
- console.log(chalk16.dim(` project: ${risk.project_id}`));
73949
+ console.log(chalk17.dim(` project: ${risk.project_id}`));
73524
73950
  if (risk.mitigation)
73525
73951
  console.log(` mitigation: ${risk.mitigation}`);
73526
73952
  }
@@ -73628,8 +74054,8 @@ function registerRiskCommands(program2) {
73628
74054
  if (opts.json || globalOpts.json)
73629
74055
  output(report, true);
73630
74056
  else {
73631
- console.log(`${chalk16.bold("Health")} ${report.status} (${report.score}/100)`);
73632
- console.log(chalk16.dim(`${report.components.total_tasks} tasks \xB7 ${report.components.blocked_tasks} blocked \xB7 ${report.components.overdue_tasks} overdue \xB7 ${report.components.open_risks} open risks`));
74057
+ console.log(`${chalk17.bold("Health")} ${report.status} (${report.score}/100)`);
74058
+ console.log(chalk17.dim(`${report.components.total_tasks} tasks \xB7 ${report.components.blocked_tasks} blocked \xB7 ${report.components.overdue_tasks} overdue \xB7 ${report.components.open_risks} open risks`));
73633
74059
  for (const recommendation of report.recommendations)
73634
74060
  console.log(`- ${recommendation}`);
73635
74061
  }
@@ -73667,7 +74093,7 @@ var exports_retrospective_commands = {};
73667
74093
  __export(exports_retrospective_commands, {
73668
74094
  registerRetrospectiveCommands: () => registerRetrospectiveCommands
73669
74095
  });
73670
- import chalk17 from "chalk";
74096
+ import chalk18 from "chalk";
73671
74097
  function commonFilters3(opts) {
73672
74098
  return {
73673
74099
  project_id: opts.project,
@@ -73678,8 +74104,8 @@ function commonFilters3(opts) {
73678
74104
  }
73679
74105
  function printRetrospective(record) {
73680
74106
  const report = record.report;
73681
- console.log(`${chalk17.cyan(record.id.slice(0, 8))} ${chalk17.bold(record.title)} ${chalk17.dim(`${record.scope}:${report.scope_id.slice(0, 8)}`)}`);
73682
- console.log(chalk17.dim(` tasks: ${report.summary.completed_tasks}/${report.summary.total_tasks} completed \xB7 missed: ${report.summary.missed_estimates} \xB7 blockers: ${report.summary.recurring_blockers} \xB7 failed checks: ${report.summary.failed_verifications}`));
74107
+ console.log(`${chalk18.cyan(record.id.slice(0, 8))} ${chalk18.bold(record.title)} ${chalk18.dim(`${record.scope}:${report.scope_id.slice(0, 8)}`)}`);
74108
+ console.log(chalk18.dim(` tasks: ${report.summary.completed_tasks}/${report.summary.total_tasks} completed \xB7 missed: ${report.summary.missed_estimates} \xB7 blockers: ${report.summary.recurring_blockers} \xB7 failed checks: ${report.summary.failed_verifications}`));
73683
74109
  for (const lesson of report.lessons.slice(0, 3))
73684
74110
  console.log(` - ${lesson}`);
73685
74111
  }
@@ -73757,7 +74183,7 @@ var exports_agent_reliability_commands = {};
73757
74183
  __export(exports_agent_reliability_commands, {
73758
74184
  registerAgentReliabilityCommands: () => registerAgentReliabilityCommands
73759
74185
  });
73760
- import chalk18 from "chalk";
74186
+ import chalk19 from "chalk";
73761
74187
  function parseNumber(value, fallback) {
73762
74188
  if (!value)
73763
74189
  return fallback;
@@ -73772,9 +74198,9 @@ function commonOptions(opts) {
73772
74198
  };
73773
74199
  }
73774
74200
  function printScorecard(scorecard) {
73775
- const color = scorecard.grade === "at_risk" ? chalk18.red : scorecard.grade === "watch" ? chalk18.yellow : scorecard.grade === "excellent" ? chalk18.green : chalk18.white;
73776
- console.log(`${chalk18.cyan(scorecard.agent_id.slice(0, 8))} ${color(`${scorecard.score}/100`)} ${chalk18.bold(scorecard.agent_name)} ${chalk18.dim(scorecard.grade)}`);
73777
- console.log(chalk18.dim(` completed: ${scorecard.signals.tasks_completed} \xB7 failed: ${scorecard.signals.tasks_failed} \xB7 failed checks: ${scorecard.signals.failed_verifications} \xB7 failed runs: ${scorecard.signals.runs_failed} \xB7 stale locks: ${scorecard.signals.stale_task_locks + scorecard.signals.stale_resource_locks}`));
74201
+ const color = scorecard.grade === "at_risk" ? chalk19.red : scorecard.grade === "watch" ? chalk19.yellow : scorecard.grade === "excellent" ? chalk19.green : chalk19.white;
74202
+ console.log(`${chalk19.cyan(scorecard.agent_id.slice(0, 8))} ${color(`${scorecard.score}/100`)} ${chalk19.bold(scorecard.agent_name)} ${chalk19.dim(scorecard.grade)}`);
74203
+ console.log(chalk19.dim(` completed: ${scorecard.signals.tasks_completed} \xB7 failed: ${scorecard.signals.tasks_failed} \xB7 failed checks: ${scorecard.signals.failed_verifications} \xB7 failed runs: ${scorecard.signals.runs_failed} \xB7 stale locks: ${scorecard.signals.stale_task_locks + scorecard.signals.stale_resource_locks}`));
73778
74204
  for (const recommendation of scorecard.recommendations.slice(0, 3))
73779
74205
  console.log(` - ${recommendation}`);
73780
74206
  }
@@ -73846,7 +74272,7 @@ var exports_onboarding_commands = {};
73846
74272
  __export(exports_onboarding_commands, {
73847
74273
  registerOnboardingCommands: () => registerOnboardingCommands
73848
74274
  });
73849
- import chalk19 from "chalk";
74275
+ import chalk20 from "chalk";
73850
74276
  import { resolve as resolve23 } from "path";
73851
74277
  function registerOnboardingCommands(program2) {
73852
74278
  program2.command("onboarding").alias("demo-fixtures").description("List, show, write, or import bundled local onboarding fixtures").option("--show <name>", "Show one fixture bridge bundle as JSON").option("--write <dir>", "Write all bundled fixture bridge bundles to a directory").option("--import <name>", "Dry-run or apply an onboarding fixture import").option("--apply", "Apply an onboarding fixture import. Defaults to dry-run.").option("--resolve-conflicts", "Safely merge existing local tasks while preserving divergent fields").action(async (opts) => {
@@ -73868,9 +74294,9 @@ function registerOnboardingCommands(program2) {
73868
74294
  output(result, true);
73869
74295
  return;
73870
74296
  }
73871
- console.log(chalk19.green(`Wrote ${result.written} onboarding fixture file(s) to ${result.directory}`));
74297
+ console.log(chalk20.green(`Wrote ${result.written} onboarding fixture file(s) to ${result.directory}`));
73872
74298
  for (const file of result.files)
73873
- console.log(chalk19.dim(` ${file}`));
74299
+ console.log(chalk20.dim(` ${file}`));
73874
74300
  return;
73875
74301
  }
73876
74302
  if (opts.import) {
@@ -73884,7 +74310,7 @@ function registerOnboardingCommands(program2) {
73884
74310
  return;
73885
74311
  }
73886
74312
  const mode = result.dry_run ? "Dry-run" : "Import";
73887
- console.log(chalk19.bold(`${mode} ${result.ok ? "ready" : "has issues"}`));
74313
+ console.log(chalk20.bold(`${mode} ${result.ok ? "ready" : "has issues"}`));
73888
74314
  for (const [key, count2] of Object.entries(result.inserted)) {
73889
74315
  if (count2 > 0)
73890
74316
  console.log(` ${key}: ${count2}`);
@@ -73894,9 +74320,9 @@ function registerOnboardingCommands(program2) {
73894
74320
  console.log(` ${key} merged: ${count2}`);
73895
74321
  }
73896
74322
  if (result.conflicts.length > 0)
73897
- console.log(chalk19.yellow(` conflicts: ${result.conflicts.length}`));
74323
+ console.log(chalk20.yellow(` conflicts: ${result.conflicts.length}`));
73898
74324
  for (const issue of result.issues)
73899
- console.error(chalk19.red(` ${issue}`));
74325
+ console.error(chalk20.red(` ${issue}`));
73900
74326
  return;
73901
74327
  }
73902
74328
  const fixtures = listOnboardingFixtures2();
@@ -73904,11 +74330,11 @@ function registerOnboardingCommands(program2) {
73904
74330
  output(fixtures, true);
73905
74331
  return;
73906
74332
  }
73907
- console.log(chalk19.bold(`${fixtures.length} bundled onboarding fixture(s):
74333
+ console.log(chalk20.bold(`${fixtures.length} bundled onboarding fixture(s):
73908
74334
  `));
73909
74335
  for (const fixture of fixtures) {
73910
- console.log(` ${chalk19.bold(fixture.name)} ${chalk19.dim(`[${fixture.version}]`)} ${chalk19.yellow(`${fixture.stats.tasks} tasks`)}`);
73911
- console.log(chalk19.dim(` ${fixture.description}`));
74336
+ console.log(` ${chalk20.bold(fixture.name)} ${chalk20.dim(`[${fixture.version}]`)} ${chalk20.yellow(`${fixture.stats.tasks} tasks`)}`);
74337
+ console.log(chalk20.dim(` ${fixture.description}`));
73912
74338
  }
73913
74339
  } catch (e) {
73914
74340
  handleError(e);
@@ -73924,7 +74350,7 @@ var exports_local_snapshot_commands = {};
73924
74350
  __export(exports_local_snapshot_commands, {
73925
74351
  registerLocalSnapshotCommands: () => registerLocalSnapshotCommands
73926
74352
  });
73927
- import chalk20 from "chalk";
74353
+ import chalk21 from "chalk";
73928
74354
  function splitTypes(value) {
73929
74355
  if (!value)
73930
74356
  return;
@@ -73958,9 +74384,9 @@ function registerLocalSnapshotCommands(program2) {
73958
74384
  output(result, true);
73959
74385
  return;
73960
74386
  }
73961
- console.log(chalk20.bold(`Changed snapshots: ${result.snapshots.length}`));
74387
+ console.log(chalk21.bold(`Changed snapshots: ${result.snapshots.length}`));
73962
74388
  for (const snapshot of result.snapshots) {
73963
- console.log(` ${snapshot.type} ${chalk20.dim(snapshot.cursor)} ${snapshot.fingerprint.slice(0, 12)}`);
74389
+ console.log(` ${snapshot.type} ${chalk21.dim(snapshot.cursor)} ${snapshot.fingerprint.slice(0, 12)}`);
73964
74390
  }
73965
74391
  return;
73966
74392
  }
@@ -73979,7 +74405,7 @@ function registerLocalSnapshotCommands(program2) {
73979
74405
  output(snapshot, true);
73980
74406
  return;
73981
74407
  }
73982
- console.log(chalk20.bold(`${snapshot.type} snapshot`));
74408
+ console.log(chalk21.bold(`${snapshot.type} snapshot`));
73983
74409
  console.log(` count: ${snapshot.count}`);
73984
74410
  console.log(` cursor: ${snapshot.cursor}`);
73985
74411
  console.log(` fingerprint: ${snapshot.fingerprint}`);
@@ -73990,11 +74416,11 @@ function registerLocalSnapshotCommands(program2) {
73990
74416
  output(resources, true);
73991
74417
  return;
73992
74418
  }
73993
- console.log(chalk20.bold(`${resources.length} local snapshot resources:
74419
+ console.log(chalk21.bold(`${resources.length} local snapshot resources:
73994
74420
  `));
73995
74421
  for (const resource of resources) {
73996
- console.log(` ${chalk20.bold(resource.type)} ${chalk20.dim(resource.uri)}`);
73997
- console.log(chalk20.dim(` ${resource.description}`));
74422
+ console.log(` ${chalk21.bold(resource.type)} ${chalk21.dim(resource.uri)}`);
74423
+ console.log(chalk21.dim(` ${resource.description}`));
73998
74424
  }
73999
74425
  } catch (e) {
74000
74426
  handleError(e);
@@ -77363,7 +77789,7 @@ __export(exports_sdk_integration_fixtures, {
77363
77789
  TODOS_SDK_INTEGRATION_FIXTURE_GENERATED_AT: () => TODOS_SDK_INTEGRATION_FIXTURE_GENERATED_AT
77364
77790
  });
77365
77791
  import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync15 } from "fs";
77366
- import { join as join29 } from "path";
77792
+ import { join as join30 } from "path";
77367
77793
  function source5(version) {
77368
77794
  return {
77369
77795
  packageName: "@hasna/todos",
@@ -77470,7 +77896,7 @@ function writeSdkIntegrationFixtures(directory, options = {}) {
77470
77896
  ];
77471
77897
  const written = [];
77472
77898
  for (const [name, payload] of files) {
77473
- const file = join29(directory, name);
77899
+ const file = join30(directory, name);
77474
77900
  writeFileSync15(file, `${JSON.stringify(payload, null, 2)}
77475
77901
  `, "utf-8");
77476
77902
  written.push(file);
@@ -77493,7 +77919,7 @@ var exports_sdk_fixture_commands = {};
77493
77919
  __export(exports_sdk_fixture_commands, {
77494
77920
  registerSdkFixtureCommands: () => registerSdkFixtureCommands
77495
77921
  });
77496
- import chalk21 from "chalk";
77922
+ import chalk22 from "chalk";
77497
77923
  import { resolve as resolve24 } from "path";
77498
77924
  function registerSdkFixtureCommands(program2) {
77499
77925
  program2.command("sdk-fixtures").description("List, show, or write local SDK integration fixtures").option("--show", "Print the full fixture pack JSON").option("--write <dir>", "Write fixture pack, bridge fixture, contract snapshots, and example index to a directory").action(async (opts) => {
@@ -77510,9 +77936,9 @@ function registerSdkFixtureCommands(program2) {
77510
77936
  console.log(JSON.stringify(result));
77511
77937
  return;
77512
77938
  }
77513
- console.log(chalk21.green(`Wrote ${result.files.length} SDK integration fixture file(s) to ${result.directory}`));
77939
+ console.log(chalk22.green(`Wrote ${result.files.length} SDK integration fixture file(s) to ${result.directory}`));
77514
77940
  for (const file of result.files)
77515
- console.log(chalk21.dim(` ${file}`));
77941
+ console.log(chalk22.dim(` ${file}`));
77516
77942
  return;
77517
77943
  }
77518
77944
  if (opts.show) {
@@ -77524,11 +77950,11 @@ function registerSdkFixtureCommands(program2) {
77524
77950
  output(examples, true);
77525
77951
  return;
77526
77952
  }
77527
- console.log(chalk21.bold(`${examples.length} local SDK integration example(s):
77953
+ console.log(chalk22.bold(`${examples.length} local SDK integration example(s):
77528
77954
  `));
77529
77955
  for (const example of examples) {
77530
- console.log(` ${chalk21.bold(example.id)} ${chalk21.dim(`[${example.surface}]`)}`);
77531
- console.log(chalk21.dim(` ${example.command}`));
77956
+ console.log(` ${chalk22.bold(example.id)} ${chalk22.dim(`[${example.surface}]`)}`);
77957
+ console.log(chalk22.dim(` ${example.command}`));
77532
77958
  }
77533
77959
  } catch (e) {
77534
77960
  handleError(e);
@@ -77544,7 +77970,7 @@ var exports_review_queue_commands = {};
77544
77970
  __export(exports_review_queue_commands, {
77545
77971
  registerReviewQueueCommands: () => registerReviewQueueCommands
77546
77972
  });
77547
- import chalk22 from "chalk";
77973
+ import chalk23 from "chalk";
77548
77974
  function splitList2(value) {
77549
77975
  return value?.split(";").flatMap((part) => part.split(",")).map((item) => item.trim()).filter(Boolean);
77550
77976
  }
@@ -77575,12 +78001,12 @@ function registerReviewQueueCommands(program2) {
77575
78001
  return;
77576
78002
  }
77577
78003
  if (items.length === 0) {
77578
- console.log(chalk22.dim("Review queue is empty."));
78004
+ console.log(chalk23.dim("Review queue is empty."));
77579
78005
  return;
77580
78006
  }
77581
78007
  for (const item of items) {
77582
78008
  const assignee = item.claimed_by || item.reviewer || "(unclaimed)";
77583
- console.log(`${chalk22.dim(item.task_id.slice(0, 8))} ${item.state.padEnd(17)} ${item.queue.padEnd(12)} ${assignee.padEnd(12)} ${item.title}`);
78009
+ console.log(`${chalk23.dim(item.task_id.slice(0, 8))} ${item.state.padEnd(17)} ${item.queue.padEnd(12)} ${assignee.padEnd(12)} ${item.title}`);
77584
78010
  }
77585
78011
  } catch (e) {
77586
78012
  handleError(e);
@@ -77602,7 +78028,7 @@ function registerReviewQueueCommands(program2) {
77602
78028
  output(item, true);
77603
78029
  return;
77604
78030
  }
77605
- console.log(chalk22.green(`Review requested: ${item.task_id.slice(0, 8)} -> ${item.queue}`));
78031
+ console.log(chalk23.green(`Review requested: ${item.task_id.slice(0, 8)} -> ${item.queue}`));
77606
78032
  } catch (e) {
77607
78033
  handleError(e);
77608
78034
  }
@@ -77616,7 +78042,7 @@ function registerReviewQueueCommands(program2) {
77616
78042
  output(item, true);
77617
78043
  return;
77618
78044
  }
77619
- console.log(chalk22.green(`Review claimed: ${item.task_id.slice(0, 8)} by ${item.claimed_by}`));
78045
+ console.log(chalk23.green(`Review claimed: ${item.task_id.slice(0, 8)} by ${item.claimed_by}`));
77620
78046
  } catch (e) {
77621
78047
  handleError(e);
77622
78048
  }
@@ -77630,7 +78056,7 @@ function registerReviewQueueCommands(program2) {
77630
78056
  output(item, true);
77631
78057
  return;
77632
78058
  }
77633
- console.log(chalk22.green(`Review approved: ${item.task_id.slice(0, 8)} by ${item.reviewer}`));
78059
+ console.log(chalk23.green(`Review approved: ${item.task_id.slice(0, 8)} by ${item.reviewer}`));
77634
78060
  } catch (e) {
77635
78061
  handleError(e);
77636
78062
  }
@@ -77649,7 +78075,7 @@ function registerReviewQueueCommands(program2) {
77649
78075
  output(item, true);
77650
78076
  return;
77651
78077
  }
77652
- console.log(chalk22.yellow(`Review returned: ${item.task_id.slice(0, 8)} with ${item.changes_requested.length} requested change(s)`));
78078
+ console.log(chalk23.yellow(`Review returned: ${item.task_id.slice(0, 8)} with ${item.changes_requested.length} requested change(s)`));
77653
78079
  } catch (e) {
77654
78080
  handleError(e);
77655
78081
  }
@@ -77663,7 +78089,7 @@ function registerReviewQueueCommands(program2) {
77663
78089
  output(item, true);
77664
78090
  return;
77665
78091
  }
77666
- console.log(chalk22.yellow(`Review reopened: ${item.task_id.slice(0, 8)}`));
78092
+ console.log(chalk23.yellow(`Review reopened: ${item.task_id.slice(0, 8)}`));
77667
78093
  } catch (e) {
77668
78094
  handleError(e);
77669
78095
  }
@@ -77679,11 +78105,11 @@ function registerReviewQueueCommands(program2) {
77679
78105
  return;
77680
78106
  }
77681
78107
  if (items.length === 0) {
77682
- console.log(chalk22.dim("No review routing rules configured."));
78108
+ console.log(chalk23.dim("No review routing rules configured."));
77683
78109
  return;
77684
78110
  }
77685
78111
  for (const rule of items) {
77686
- console.log(`${rule.enabled ? chalk22.green("on ") : chalk22.gray("off")} ${rule.name.padEnd(16)} ${rule.queue.padEnd(12)} ${rule.reviewers.join(",") || "(no reviewers)"}`);
78112
+ console.log(`${rule.enabled ? chalk23.green("on ") : chalk23.gray("off")} ${rule.name.padEnd(16)} ${rule.queue.padEnd(12)} ${rule.reviewers.join(",") || "(no reviewers)"}`);
77687
78113
  }
77688
78114
  } catch (e) {
77689
78115
  handleError(e);
@@ -77706,7 +78132,7 @@ function registerReviewQueueCommands(program2) {
77706
78132
  output(rule, true);
77707
78133
  return;
77708
78134
  }
77709
- console.log(chalk22.green(`Review routing rule saved: ${rule.name}`));
78135
+ console.log(chalk23.green(`Review routing rule saved: ${rule.name}`));
77710
78136
  } catch (e) {
77711
78137
  handleError(e);
77712
78138
  }
@@ -77720,7 +78146,7 @@ function registerReviewQueueCommands(program2) {
77720
78146
  output({ removed }, true);
77721
78147
  return;
77722
78148
  }
77723
- console.log(removed ? chalk22.green("Review routing rule removed.") : chalk22.dim("No review routing rule matched."));
78149
+ console.log(removed ? chalk23.green("Review routing rule removed.") : chalk23.dim("No review routing rule matched."));
77724
78150
  } catch (e) {
77725
78151
  handleError(e);
77726
78152
  }
@@ -77735,8 +78161,8 @@ var exports_roadmap_commands = {};
77735
78161
  __export(exports_roadmap_commands, {
77736
78162
  registerRoadmapCommands: () => registerRoadmapCommands
77737
78163
  });
77738
- import { readFileSync as readFileSync21, writeFileSync as writeFileSync16 } from "fs";
77739
- import chalk23 from "chalk";
78164
+ import { readFileSync as readFileSync23, writeFileSync as writeFileSync16 } from "fs";
78165
+ import chalk24 from "chalk";
77740
78166
  function splitList3(value) {
77741
78167
  return value?.split(";").flatMap((part) => part.split(",")).map((item) => item.trim()).filter(Boolean);
77742
78168
  }
@@ -77783,7 +78209,7 @@ function registerRoadmapCommands(program2) {
77783
78209
  output(roadmap, true);
77784
78210
  return;
77785
78211
  }
77786
- console.log(chalk23.green(`Roadmap created: ${roadmap.id.slice(0, 8)} ${roadmap.name}`));
78212
+ console.log(chalk24.green(`Roadmap created: ${roadmap.id.slice(0, 8)} ${roadmap.name}`));
77787
78213
  } catch (e) {
77788
78214
  handleError(e);
77789
78215
  }
@@ -77798,11 +78224,11 @@ function registerRoadmapCommands(program2) {
77798
78224
  return;
77799
78225
  }
77800
78226
  if (items.length === 0) {
77801
- console.log(chalk23.dim("No roadmaps configured."));
78227
+ console.log(chalk24.dim("No roadmaps configured."));
77802
78228
  return;
77803
78229
  }
77804
78230
  for (const item of items)
77805
- console.log(`${chalk23.dim(item.id.slice(0, 8))} ${item.status.padEnd(9)} ${item.name}`);
78231
+ console.log(`${chalk24.dim(item.id.slice(0, 8))} ${item.status.padEnd(9)} ${item.name}`);
77806
78232
  } catch (e) {
77807
78233
  handleError(e);
77808
78234
  }
@@ -77842,7 +78268,7 @@ function registerRoadmapCommands(program2) {
77842
78268
  output(updated, true);
77843
78269
  return;
77844
78270
  }
77845
- console.log(chalk23.green(`Roadmap updated: ${updated.id.slice(0, 8)} ${updated.name}`));
78271
+ console.log(chalk24.green(`Roadmap updated: ${updated.id.slice(0, 8)} ${updated.name}`));
77846
78272
  } catch (e) {
77847
78273
  handleError(e);
77848
78274
  }
@@ -77856,7 +78282,7 @@ function registerRoadmapCommands(program2) {
77856
78282
  output({ deleted }, true);
77857
78283
  return;
77858
78284
  }
77859
- console.log(deleted ? chalk23.green("Roadmap deleted.") : chalk23.dim("No roadmap matched."));
78285
+ console.log(deleted ? chalk24.green("Roadmap deleted.") : chalk24.dim("No roadmap matched."));
77860
78286
  } catch (e) {
77861
78287
  handleError(e);
77862
78288
  }
@@ -77884,7 +78310,7 @@ function registerRoadmapCommands(program2) {
77884
78310
  output(milestone, true);
77885
78311
  return;
77886
78312
  }
77887
- console.log(chalk23.green(`Milestone added: ${milestone.id.slice(0, 8)} ${milestone.title}`));
78313
+ console.log(chalk24.green(`Milestone added: ${milestone.id.slice(0, 8)} ${milestone.title}`));
77888
78314
  } catch (e) {
77889
78315
  handleError(e);
77890
78316
  }
@@ -77910,7 +78336,7 @@ function registerRoadmapCommands(program2) {
77910
78336
  output(updated, true);
77911
78337
  return;
77912
78338
  }
77913
- console.log(chalk23.green(`Milestone updated: ${updated.id.slice(0, 8)} ${updated.title}`));
78339
+ console.log(chalk24.green(`Milestone updated: ${updated.id.slice(0, 8)} ${updated.title}`));
77914
78340
  } catch (e) {
77915
78341
  handleError(e);
77916
78342
  }
@@ -77935,7 +78361,7 @@ function registerRoadmapCommands(program2) {
77935
78361
  output(release, true);
77936
78362
  return;
77937
78363
  }
77938
- console.log(chalk23.green(`Release group saved: ${release.name}`));
78364
+ console.log(chalk24.green(`Release group saved: ${release.name}`));
77939
78365
  } catch (e) {
77940
78366
  handleError(e);
77941
78367
  }
@@ -77948,7 +78374,7 @@ function registerRoadmapCommands(program2) {
77948
78374
  if (opts.out) {
77949
78375
  writeFileSync16(opts.out, content);
77950
78376
  if (!globalOpts.json)
77951
- console.log(chalk23.green(`Wrote roadmap export to ${opts.out}`));
78377
+ console.log(chalk24.green(`Wrote roadmap export to ${opts.out}`));
77952
78378
  }
77953
78379
  if (globalOpts.json) {
77954
78380
  output(opts.format === "markdown" ? { content } : JSON.parse(content), true);
@@ -77964,13 +78390,13 @@ function registerRoadmapCommands(program2) {
77964
78390
  const globalOpts = globalOptions(program2);
77965
78391
  try {
77966
78392
  const { importRoadmapBundle: importRoadmapBundle2 } = await Promise.resolve().then(() => (init_roadmaps(), exports_roadmaps));
77967
- const bundle = JSON.parse(readFileSync21(path, "utf8"));
78393
+ const bundle = JSON.parse(readFileSync23(path, "utf8"));
77968
78394
  const result = importRoadmapBundle2(bundle, { apply: Boolean(opts.apply) });
77969
78395
  if (globalOpts.json) {
77970
78396
  output(result, true);
77971
78397
  return;
77972
78398
  }
77973
- console.log(result.applied ? chalk23.green(`Imported roadmap ${result.roadmap_id}`) : chalk23.dim(`Preview: ${result.milestones} milestones, ${result.releases} releases`));
78399
+ console.log(result.applied ? chalk24.green(`Imported roadmap ${result.roadmap_id}`) : chalk24.dim(`Preview: ${result.milestones} milestones, ${result.releases} releases`));
77974
78400
  } catch (e) {
77975
78401
  handleError(e);
77976
78402
  }
@@ -77986,7 +78412,7 @@ var exports_capacity_commands = {};
77986
78412
  __export(exports_capacity_commands, {
77987
78413
  registerCapacityCommands: () => registerCapacityCommands
77988
78414
  });
77989
- import chalk24 from "chalk";
78415
+ import chalk25 from "chalk";
77990
78416
  function splitDays(value) {
77991
78417
  return value?.split(",").map((item) => Number(item.trim())).filter((item) => Number.isFinite(item));
77992
78418
  }
@@ -78019,7 +78445,7 @@ function registerCapacityCommands(program2) {
78019
78445
  output(profile, true);
78020
78446
  return;
78021
78447
  }
78022
- console.log(chalk24.green(`Capacity saved: ${profile.agent_id} ${profile.minutes_per_day}m/day`));
78448
+ console.log(chalk25.green(`Capacity saved: ${profile.agent_id} ${profile.minutes_per_day}m/day`));
78023
78449
  } catch (e) {
78024
78450
  handleError(e);
78025
78451
  }
@@ -78037,7 +78463,7 @@ function registerCapacityCommands(program2) {
78037
78463
  return;
78038
78464
  }
78039
78465
  if (profiles.length === 0) {
78040
- console.log(chalk24.dim("No capacity profiles."));
78466
+ console.log(chalk25.dim("No capacity profiles."));
78041
78467
  return;
78042
78468
  }
78043
78469
  for (const profile of profiles) {
@@ -78056,7 +78482,7 @@ function registerCapacityCommands(program2) {
78056
78482
  output({ removed }, true);
78057
78483
  return;
78058
78484
  }
78059
- console.log(removed ? chalk24.green("Capacity profile removed.") : chalk24.dim("No capacity profile matched."));
78485
+ console.log(removed ? chalk25.green("Capacity profile removed.") : chalk25.dim("No capacity profile matched."));
78060
78486
  } catch (e) {
78061
78487
  handleError(e);
78062
78488
  }
@@ -78095,7 +78521,7 @@ var exports_audit_ledger_commands = {};
78095
78521
  __export(exports_audit_ledger_commands, {
78096
78522
  registerAuditLedgerCommands: () => registerAuditLedgerCommands
78097
78523
  });
78098
- import chalk25 from "chalk";
78524
+ import chalk26 from "chalk";
78099
78525
  function globalOptions3(program2) {
78100
78526
  const command = program2;
78101
78527
  return command.optsWithGlobals?.() ?? program2.opts();
@@ -78151,7 +78577,7 @@ function registerAuditLedgerCommands(program2) {
78151
78577
  output(checkpoint, true);
78152
78578
  return;
78153
78579
  }
78154
- console.log(chalk25.green(`Audit checkpoint sealed: ${checkpoint.name} ${checkpoint.root_hash}`));
78580
+ console.log(chalk26.green(`Audit checkpoint sealed: ${checkpoint.name} ${checkpoint.root_hash}`));
78155
78581
  } catch (e) {
78156
78582
  handleError(e);
78157
78583
  }
@@ -78166,7 +78592,7 @@ function registerAuditLedgerCommands(program2) {
78166
78592
  return;
78167
78593
  }
78168
78594
  if (checkpoints.length === 0) {
78169
- console.log(chalk25.dim("No audit ledger checkpoints."));
78595
+ console.log(chalk26.dim("No audit ledger checkpoints."));
78170
78596
  return;
78171
78597
  }
78172
78598
  for (const checkpoint of checkpoints) {
@@ -78189,7 +78615,7 @@ function registerAuditLedgerCommands(program2) {
78189
78615
  output(result, true);
78190
78616
  return;
78191
78617
  }
78192
- console.log(result.ok ? chalk25.green("Audit ledger verified.") : chalk25.red(`Audit ledger failed: ${result.issues.join("; ")}`));
78618
+ console.log(result.ok ? chalk26.green("Audit ledger verified.") : chalk26.red(`Audit ledger failed: ${result.issues.join("; ")}`));
78193
78619
  if (!result.ok)
78194
78620
  process.exitCode = 1;
78195
78621
  } catch (e) {
@@ -78208,7 +78634,7 @@ var exports_release_compatibility_commands = {};
78208
78634
  __export(exports_release_compatibility_commands, {
78209
78635
  registerReleaseCompatibilityCommands: () => registerReleaseCompatibilityCommands
78210
78636
  });
78211
- import chalk26 from "chalk";
78637
+ import chalk27 from "chalk";
78212
78638
  function globalOptions4(program2) {
78213
78639
  const command = program2;
78214
78640
  return command.optsWithGlobals?.() ?? program2.opts();
@@ -78240,7 +78666,7 @@ function registerReleaseCompatibilityCommands(program2) {
78240
78666
  process.exitCode = 1;
78241
78667
  return;
78242
78668
  }
78243
- console.log(report.ok ? chalk26.green("Release compatibility passed.") : chalk26.red("Release compatibility failed."));
78669
+ console.log(report.ok ? chalk27.green("Release compatibility passed.") : chalk27.red("Release compatibility failed."));
78244
78670
  if (!report.ok)
78245
78671
  process.exitCode = 1;
78246
78672
  } catch (error2) {
@@ -78323,14 +78749,14 @@ var exports_local_backup_commands = {};
78323
78749
  __export(exports_local_backup_commands, {
78324
78750
  registerLocalBackupCommands: () => registerLocalBackupCommands
78325
78751
  });
78326
- import chalk27 from "chalk";
78752
+ import chalk28 from "chalk";
78327
78753
  import { resolve as resolve25 } from "path";
78328
78754
  function globalOptions6(program2) {
78329
78755
  const command = program2;
78330
78756
  return command.optsWithGlobals?.() ?? program2.opts();
78331
78757
  }
78332
78758
  function printCreateSummary(result) {
78333
- console.log(chalk27.bold("todos local backup"));
78759
+ console.log(chalk28.bold("todos local backup"));
78334
78760
  if (result.output_path)
78335
78761
  console.log(`File: ${result.output_path}`);
78336
78762
  console.log(`Checksum: ${result.backup.checksum}`);
@@ -78370,13 +78796,13 @@ function registerLocalBackupCommands(program2) {
78370
78796
  output(verification, true);
78371
78797
  return;
78372
78798
  }
78373
- console.log(chalk27.bold(`Backup ${verification.ok ? "verified" : "has issues"}`));
78799
+ console.log(chalk28.bold(`Backup ${verification.ok ? "verified" : "has issues"}`));
78374
78800
  console.log(`Checksum: ${verification.checksum.ok ? "ok" : "mismatch"}`);
78375
78801
  console.log(`Bridge: ${verification.bridge_checksum.ok ? "ok" : "mismatch"}`);
78376
78802
  for (const issue of verification.issues)
78377
- console.error(chalk27.red(` ${issue}`));
78803
+ console.error(chalk28.red(` ${issue}`));
78378
78804
  for (const warning of verification.warnings)
78379
- console.error(chalk27.yellow(` ${warning}`));
78805
+ console.error(chalk28.yellow(` ${warning}`));
78380
78806
  } catch (error2) {
78381
78807
  handleError(error2);
78382
78808
  }
@@ -78393,18 +78819,18 @@ function registerLocalBackupCommands(program2) {
78393
78819
  output(result, true);
78394
78820
  return;
78395
78821
  }
78396
- console.log(chalk27.bold(`${result.dry_run ? "Restore dry-run" : "Restore"} ${result.ok ? "ready" : "has issues"}`));
78822
+ console.log(chalk28.bold(`${result.dry_run ? "Restore dry-run" : "Restore"} ${result.ok ? "ready" : "has issues"}`));
78397
78823
  if (result.import_result) {
78398
78824
  for (const [key, count2] of Object.entries(result.import_result.inserted)) {
78399
78825
  if (count2 > 0)
78400
78826
  console.log(` ${key}: ${count2}`);
78401
78827
  }
78402
78828
  if (result.import_result.conflicts.length > 0) {
78403
- console.log(chalk27.yellow(` conflicts: ${result.import_result.conflicts.length}`));
78829
+ console.log(chalk28.yellow(` conflicts: ${result.import_result.conflicts.length}`));
78404
78830
  }
78405
78831
  }
78406
78832
  for (const issue of result.issues)
78407
- console.error(chalk27.red(` ${issue}`));
78833
+ console.error(chalk28.red(` ${issue}`));
78408
78834
  } catch (error2) {
78409
78835
  handleError(error2);
78410
78836
  }
@@ -78420,14 +78846,14 @@ function registerLocalBackupCommands(program2) {
78420
78846
  output(report, true);
78421
78847
  return;
78422
78848
  }
78423
- console.log(chalk27.bold(`Local integrity ${report.ok ? "ok" : "needs attention"}`));
78849
+ console.log(chalk28.bold(`Local integrity ${report.ok ? "ok" : "needs attention"}`));
78424
78850
  console.log(`Quick check: ${report.sqlite.quick_check}`);
78425
78851
  console.log(`Foreign key violations: ${report.sqlite.foreign_key_violations}`);
78426
78852
  console.log(`Tasks: ${report.counts.tasks}`);
78427
78853
  for (const issue of report.issues)
78428
- console.error(chalk27.red(` ${issue}`));
78854
+ console.error(chalk28.red(` ${issue}`));
78429
78855
  for (const warning of report.warnings)
78430
- console.error(chalk27.yellow(` ${warning}`));
78856
+ console.error(chalk28.yellow(` ${warning}`));
78431
78857
  } catch (error2) {
78432
78858
  handleError(error2);
78433
78859
  }
@@ -78921,7 +79347,7 @@ var init_hybrid = __esm(() => {
78921
79347
  });
78922
79348
 
78923
79349
  // src/storage/s3-artifacts.ts
78924
- import { createHash as createHash17, createHmac as createHmac2 } from "crypto";
79350
+ import { createHash as createHash18, createHmac as createHmac2 } from "crypto";
78925
79351
  function createTodosS3ArtifactStore(options) {
78926
79352
  const requestFetch = options.fetch ?? fetch;
78927
79353
  const now4 = options.now ?? (() => new Date);
@@ -79093,7 +79519,7 @@ function toAmzDate(date) {
79093
79519
  return date.toISOString().replace(/[:-]|\.\d{3}/g, "");
79094
79520
  }
79095
79521
  function sha256Hex(value) {
79096
- return createHash17("sha256").update(value).digest("hex");
79522
+ return createHash18("sha256").update(value).digest("hex");
79097
79523
  }
79098
79524
  function hmac(key, value) {
79099
79525
  return createHmac2("sha256", key).update(value).digest();
@@ -79700,13 +80126,13 @@ __export(exports_storage_commands, {
79700
80126
  s3CredentialsFromEnv: () => s3CredentialsFromEnv,
79701
80127
  registerStorageCommands: () => registerStorageCommands
79702
80128
  });
79703
- import chalk28 from "chalk";
80129
+ import chalk29 from "chalk";
79704
80130
  function globalOptions7(program2) {
79705
80131
  const command = program2;
79706
80132
  return command.optsWithGlobals?.() ?? program2.opts();
79707
80133
  }
79708
80134
  function printStatus(status) {
79709
- console.log(chalk28.bold("todos storage"));
80135
+ console.log(chalk29.bold("todos storage"));
79710
80136
  console.log(`Mode: ${status.mode}`);
79711
80137
  console.log(`Remote: ${status.remote_enabled ? "enabled" : "disabled"}`);
79712
80138
  console.log(`Canonical RDS: ${status.canonical.cluster}/${status.canonical.database}`);
@@ -79717,12 +80143,12 @@ function printStatus(status) {
79717
80143
  console.log(`Sync batch: ${status.sync.batch_size}`);
79718
80144
  console.log(`Network: not used`);
79719
80145
  for (const issue of status.issues)
79720
- console.error(chalk28.red(` ${issue}`));
80146
+ console.error(chalk29.red(` ${issue}`));
79721
80147
  for (const warning of status.warnings)
79722
- console.error(chalk28.yellow(` ${warning}`));
80148
+ console.error(chalk29.yellow(` ${warning}`));
79723
80149
  }
79724
80150
  function printSyncPlan(plan) {
79725
- console.log(chalk28.bold("todos storage sync-plan"));
80151
+ console.log(chalk29.bold("todos storage sync-plan"));
79726
80152
  console.log(`Mode: ${plan.status.mode}`);
79727
80153
  console.log(`Dry run: yes`);
79728
80154
  console.log(`Database: ${plan.postgres.configured ? "configured" : "not configured"}`);
@@ -79736,17 +80162,17 @@ function printSyncPlan(plan) {
79736
80162
  console.log(statement);
79737
80163
  }
79738
80164
  for (const issue of plan.status.issues)
79739
- console.error(chalk28.red(` ${issue}`));
80165
+ console.error(chalk29.red(` ${issue}`));
79740
80166
  for (const warning of plan.status.warnings)
79741
- console.error(chalk28.yellow(` ${warning}`));
80167
+ console.error(chalk29.yellow(` ${warning}`));
79742
80168
  }
79743
80169
  function printShadowStatus(report, enabled, shadowEnv) {
79744
- console.log(chalk28.bold("todos storage shadow-status"));
80170
+ console.log(chalk29.bold("todos storage shadow-status"));
79745
80171
  console.log(`Shadow mirror: ${enabled ? "enabled" : "disabled"} (${shadowEnv})`);
79746
80172
  console.log(`Service: ${report.service}`);
79747
80173
  console.log(`Cloud reachable: ${report.cloud_reachable ? "yes" : "no"}`);
79748
80174
  if (report.error) {
79749
- console.error(chalk28.red(` ${report.error}`));
80175
+ console.error(chalk29.red(` ${report.error}`));
79750
80176
  return;
79751
80177
  }
79752
80178
  console.log(`In sync: ${report.in_sync ? "yes" : "no"}`);
@@ -79754,7 +80180,7 @@ function printShadowStatus(report, enabled, shadowEnv) {
79754
80180
  console.log(`Last mirror lag: ${report.last_mirror_lag_ms === null ? "n/a" : `${report.last_mirror_lag_ms}ms`}`);
79755
80181
  console.log("Rows (local -> cloud):");
79756
80182
  for (const entry2 of report.objects) {
79757
- const flag = entry2.diff === 0 ? "" : chalk28.yellow(` (diff ${entry2.diff > 0 ? "+" : ""}${entry2.diff})`);
80183
+ const flag = entry2.diff === 0 ? "" : chalk29.yellow(` (diff ${entry2.diff > 0 ? "+" : ""}${entry2.diff})`);
79758
80184
  console.log(` ${entry2.object_type.padEnd(14)} local=${String(entry2.local).padStart(6)} cloud=${String(entry2.cloud).padStart(6)} tombstones=${entry2.cloud_tombstones}${flag}`);
79759
80185
  }
79760
80186
  console.log(` ${"TOTAL".padEnd(14)} local=${String(report.totals.local).padStart(6)} cloud=${String(report.totals.cloud).padStart(6)} diff=${report.totals.diff}`);
@@ -79774,7 +80200,7 @@ function readOutboxDepth() {
79774
80200
  }
79775
80201
  }
79776
80202
  function printArtifactPlan(plan) {
79777
- console.log(chalk28.bold(`todos storage artifacts ${plan.direction}`));
80203
+ console.log(chalk29.bold(`todos storage artifacts ${plan.direction}`));
79778
80204
  console.log("Dry run: yes");
79779
80205
  console.log("Network: not used");
79780
80206
  console.log(`Total: ${plan.total}`);
@@ -79785,10 +80211,10 @@ function printArtifactPlan(plan) {
79785
80211
  console.log(` ${artifact.status.padEnd(18)} ${artifact.id.slice(0, 8)} ${artifact.sha256?.slice(0, 12) ?? "no-sha"}`);
79786
80212
  }
79787
80213
  for (const error2 of plan.errors)
79788
- console.error(chalk28.red(` ${error2}`));
80214
+ console.error(chalk29.red(` ${error2}`));
79789
80215
  }
79790
80216
  function printArtifactResult(direction, result) {
79791
- console.log(chalk28.bold(`todos storage artifacts ${direction}`));
80217
+ console.log(chalk29.bold(`todos storage artifacts ${direction}`));
79792
80218
  console.log(`Uploaded: ${result.uploaded}`);
79793
80219
  console.log(`Downloaded: ${result.downloaded}`);
79794
80220
  console.log(`Skipped: ${result.skipped}`);
@@ -79796,7 +80222,7 @@ function printArtifactResult(direction, result) {
79796
80222
  console.log(` ${artifact.id.slice(0, 8)} ${artifact.key}`);
79797
80223
  }
79798
80224
  for (const error2 of result.errors)
79799
- console.error(chalk28.red(` ${error2}`));
80225
+ console.error(chalk29.red(` ${error2}`));
79800
80226
  }
79801
80227
  function artifactFilter(opts) {
79802
80228
  const limit = opts.limit ? Number.parseInt(opts.limit, 10) : undefined;
@@ -79875,7 +80301,7 @@ function registerStorageCommands(program2) {
79875
80301
  return;
79876
80302
  }
79877
80303
  if (remoteAuthority.selected) {
79878
- console.log(chalk28.bold("todos storage"));
80304
+ console.log(chalk29.bold("todos storage"));
79879
80305
  console.log("Mode: http");
79880
80306
  console.log("Transport: authenticated HTTP /v1");
79881
80307
  console.log(`Authority: ${remoteAuthority.v1_base_url ?? "not configured"}`);
@@ -79883,7 +80309,7 @@ function registerStorageCommands(program2) {
79883
80309
  console.log("Local fallback: disabled");
79884
80310
  console.log("Network: not used (configuration diagnostic only)");
79885
80311
  for (const issue of remoteAuthority.issues)
79886
- console.error(chalk28.red(` ${issue}`));
80312
+ console.error(chalk29.red(` ${issue}`));
79887
80313
  if (!status.ok)
79888
80314
  process.exitCode = 1;
79889
80315
  return;
@@ -79928,7 +80354,7 @@ function registerStorageCommands(program2) {
79928
80354
  output({ configured: false, message }, true);
79929
80355
  return;
79930
80356
  }
79931
- console.log(chalk28.yellow(message));
80357
+ console.log(chalk29.yellow(message));
79932
80358
  return;
79933
80359
  }
79934
80360
  cloud = client;
@@ -79966,7 +80392,7 @@ function registerStorageCommands(program2) {
79966
80392
  output({ shadow_enabled: false, message }, true);
79967
80393
  return;
79968
80394
  }
79969
- console.log(chalk28.yellow(message));
80395
+ console.log(chalk29.yellow(message));
79970
80396
  return;
79971
80397
  }
79972
80398
  const { getDatabase: getDatabase2 } = await Promise.resolve().then(() => (init_database(), exports_database));
@@ -79978,7 +80404,7 @@ function registerStorageCommands(program2) {
79978
80404
  output({ shadow_enabled: true, ...stats2 }, true);
79979
80405
  return;
79980
80406
  }
79981
- console.log(chalk28.bold("todos storage shadow-drain"));
80407
+ console.log(chalk29.bold("todos storage shadow-drain"));
79982
80408
  console.log(`Mirrored: ${stats2.mirrored}`);
79983
80409
  console.log(`Retries: ${stats2.retries}`);
79984
80410
  console.log(`Pending: ${stats2.pending}`);
@@ -79986,7 +80412,7 @@ function registerStorageCommands(program2) {
79986
80412
  console.log(`Outbox depth: ${stats2.depth}`);
79987
80413
  console.log(`Last mirror: ${stats2.lastMirrorAt ?? "never"}`);
79988
80414
  if (stats2.lastError)
79989
- console.error(chalk28.yellow(`Last error: ${stats2.lastError}`));
80415
+ console.error(chalk29.yellow(`Last error: ${stats2.lastError}`));
79990
80416
  } catch (error2) {
79991
80417
  handleError(error2);
79992
80418
  }
@@ -80284,7 +80710,7 @@ var exports_scale_hardening_commands = {};
80284
80710
  __export(exports_scale_hardening_commands, {
80285
80711
  registerScaleHardeningCommands: () => registerScaleHardeningCommands
80286
80712
  });
80287
- import chalk29 from "chalk";
80713
+ import chalk30 from "chalk";
80288
80714
  function globalOptions8(program2) {
80289
80715
  const command = program2;
80290
80716
  return command.optsWithGlobals?.() ?? program2.opts();
@@ -80331,7 +80757,7 @@ function registerScaleHardeningCommands(program2) {
80331
80757
  }
80332
80758
  if (format !== "markdown")
80333
80759
  throw new Error("--format must be json or markdown");
80334
- console.log(chalk29.bold(`todos scale compaction
80760
+ console.log(chalk30.bold(`todos scale compaction
80335
80761
  `));
80336
80762
  console.log(`Mode: ${result.dry_run ? "dry run" : "applied"}`);
80337
80763
  console.log(`Before: ${result.before.page_count} pages, ${result.before.freelist_count} free`);
@@ -80351,7 +80777,7 @@ var exports_pr_group_commands = {};
80351
80777
  __export(exports_pr_group_commands, {
80352
80778
  registerPrGroupCommands: () => registerPrGroupCommands
80353
80779
  });
80354
- import chalk30 from "chalk";
80780
+ import chalk31 from "chalk";
80355
80781
  function globalOptions9(program2) {
80356
80782
  const command = program2;
80357
80783
  return command.optsWithGlobals?.() ?? program2.opts();
@@ -80378,7 +80804,7 @@ function registerPrGroupCommands(program2) {
80378
80804
  output(view, true);
80379
80805
  return;
80380
80806
  }
80381
- console.log(`${chalk30.bold(view.group.id)} ${view.group.state} revision=${view.group.revision}`);
80807
+ console.log(`${chalk31.bold(view.group.id)} ${view.group.state} revision=${view.group.revision}`);
80382
80808
  console.log(`authority=${view.authority} attempts=${view.attempts.length} events=${view.diagnostics.event_count}`);
80383
80809
  } catch (error2) {
80384
80810
  handleError(error2);
@@ -80396,7 +80822,7 @@ function registerPrGroupCommands(program2) {
80396
80822
  output(history, true);
80397
80823
  return;
80398
80824
  }
80399
- console.log(`${chalk30.bold(history.group_id)} events=${history.count} authority=${history.authority}`);
80825
+ console.log(`${chalk31.bold(history.group_id)} events=${history.count} authority=${history.authority}`);
80400
80826
  for (const event of history.events) {
80401
80827
  console.log(`${String(event.sequence).padStart(4)} ${event.event_type} ${event.state}`);
80402
80828
  }
@@ -80793,6 +81219,7 @@ var [
80793
81219
  { registerQueryCommands: registerQueryCommands2 },
80794
81220
  { registerMcpHooksCommands: registerMcpHooksCommands2 },
80795
81221
  { registerDispatchCommands: registerDispatchCommands2 },
81222
+ { registerDelegateCommands: registerDelegateCommands2 },
80796
81223
  { registerMachineCommands: registerMachineCommands2 },
80797
81224
  { registerApiKeyCommands: registerApiKeyCommands2 },
80798
81225
  { registerEnvironmentSnapshotCommands: registerEnvironmentSnapshotCommands2 },
@@ -80824,6 +81251,7 @@ var [
80824
81251
  Promise.resolve().then(() => (init_query_commands(), exports_query_commands)),
80825
81252
  Promise.resolve().then(() => (init_mcp_hooks_commands(), exports_mcp_hooks_commands)),
80826
81253
  Promise.resolve().then(() => (init_dispatch3(), exports_dispatch2)),
81254
+ Promise.resolve().then(() => (init_delegate(), exports_delegate)),
80827
81255
  Promise.resolve().then(() => (init_machines3(), exports_machines)),
80828
81256
  Promise.resolve().then(() => (init_api_key_commands(), exports_api_key_commands)),
80829
81257
  Promise.resolve().then(() => (init_environment_snapshots3(), exports_environment_snapshots2)),
@@ -80854,6 +81282,7 @@ registerConfigServeCommands2(program2);
80854
81282
  registerQueryCommands2(program2);
80855
81283
  registerMcpHooksCommands2(program2);
80856
81284
  registerDispatchCommands2(program2);
81285
+ registerDelegateCommands2(program2);
80857
81286
  registerMachineCommands2(program2);
80858
81287
  registerApiKeyCommands2(program2);
80859
81288
  registerEnvironmentSnapshotCommands2(program2);