@gobing-ai/spur 0.3.62 → 0.3.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/config/corpus-baseline.json +3428 -3796
  3. package/config/workflows/history-anatomy.yaml +40 -11
  4. package/package.json +9 -9
  5. package/plugins/sp/README.md +8 -5
  6. package/plugins/sp/agents/expert-spur.md +20 -4
  7. package/plugins/sp/commands/dev-find-issue.md +4 -4
  8. package/plugins/sp/commands/dev-gitmsg.md +12 -6
  9. package/plugins/sp/commands/dev-gtd.md +8 -19
  10. package/plugins/sp/commands/dev-idea.md +3 -3
  11. package/plugins/sp/commands/dev-plan.md +1 -1
  12. package/plugins/sp/commands/dev-run.md +2 -2
  13. package/plugins/sp/commands/dev-runall.md +2 -2
  14. package/plugins/sp/commands/dev-wrap.md +5 -6
  15. package/plugins/sp/commands/dev-wrapall.md +5 -7
  16. package/plugins/sp/plugin.json +1 -1
  17. package/plugins/sp/references/environment-lens.md +66 -0
  18. package/plugins/sp/scripts/history-anatomy-cache.mjs +165 -15
  19. package/plugins/sp/scripts/history-anatomy-cache.ts +216 -15
  20. package/plugins/sp/skills/dogfood-testing/SKILL.md +14 -1
  21. package/plugins/sp/skills/dogfood-testing/references/report-template.md +30 -0
  22. package/plugins/sp/skills/history-anatomy/SKILL.md +3 -3
  23. package/plugins/sp/skills/history-anatomy/references/operations.md +21 -8
  24. package/plugins/sp/skills/history-anatomy/references/report-contract.md +63 -5
  25. package/plugins/sp/skills/next-router/SKILL.md +4 -4
  26. package/plugins/sp/skills/pr-reviewing/SKILL.md +2 -3
  27. package/plugins/sp/skills/redesign-web-ui/SKILL.md +184 -0
  28. package/plugins/sp/skills/redesign-web-ui/references/audit-checklist.md +121 -0
  29. package/plugins/sp/skills/redesign-web-ui/references/upgrade-techniques.md +66 -0
  30. package/plugins/sp/skills/spur-cli/references/agent.md +16 -7
  31. package/plugins/sp/skills/spur-cli/references/message.md +4 -2
  32. package/plugins/sp/skills/spur-cli/references/workflows/authoring-workflows.md +5 -0
  33. package/plugins/sp/skills/spur-cli/references/workflows/operations.md +20 -5
  34. package/plugins/sp/skills/spur-cli/references/workflows/workflow-fit-and-tuning.md +230 -0
  35. package/plugins/sp/skills/spur-cli/references/workflows.md +26 -4
  36. package/plugins/sp/skills/spur-dev/references/cross-cutting.md +28 -34
  37. package/plugins/sp/skills/spur-dev/references/dev-operations.md +62 -20
  38. package/plugins/sp/skills/spur-dev/references/execution-workflow.md +1 -1
  39. package/plugins/sp/skills/spur-dev/references/flag-glossary.md +18 -8
  40. package/plugins/sp/skills/spur-dev/references/inline-pipeline-driver.md +7 -6
  41. package/spur.js +1012 -372
  42. package/web/_astro/{BoardApp.rkWGVwwK.js → BoardApp.CKolAjUz.js} +56 -56
  43. package/web/_astro/BoardApp.DXD--ybM.js +1 -0
  44. package/web/_astro/{TaskDetail.B7ODt_bA.js → TaskDetail.Bre7G4gC.js} +1 -1
  45. package/web/_astro/{arc.C5QRz6AQ.js → arc.7luwOGiC.js} +1 -1
  46. package/web/_astro/{architectureDiagram-3BPJPVTR.CHptn8gZ.js → architectureDiagram-3BPJPVTR.F6KaHXp-.js} +1 -1
  47. package/web/_astro/{blockDiagram-GPEHLZMM.b1nEDkDw.js → blockDiagram-GPEHLZMM.CCGHeRVi.js} +1 -1
  48. package/web/_astro/{c4Diagram-AAUBKEIU.BWj8S_Qq.js → c4Diagram-AAUBKEIU.CpqewGmd.js} +1 -1
  49. package/web/_astro/channel.DxfOFf1l.js +1 -0
  50. package/web/_astro/{chunk-2J33WTMH.q0BBuE1n.js → chunk-2J33WTMH.CB9vKa5F.js} +1 -1
  51. package/web/_astro/{chunk-4BX2VUAB.DP2KDkAU.js → chunk-4BX2VUAB.ifGXoUA3.js} +1 -1
  52. package/web/_astro/{chunk-55IACEB6.CkCId72p.js → chunk-55IACEB6.VIaRo7l8.js} +1 -1
  53. package/web/_astro/{chunk-727SXJPM.oHWzxMot.js → chunk-727SXJPM.DzPE41OS.js} +1 -1
  54. package/web/_astro/{chunk-AQP2D5EJ.DkkgxfMP.js → chunk-AQP2D5EJ.UF2QRXYF.js} +1 -1
  55. package/web/_astro/{chunk-FMBD7UC4.lmFJDvRK.js → chunk-FMBD7UC4.D2zXKa1R.js} +1 -1
  56. package/web/_astro/{chunk-ND2GUHAM.52jt0eHK.js → chunk-ND2GUHAM.Cb9bDyvx.js} +1 -1
  57. package/web/_astro/{chunk-QZHKN3VN.Cg8KEFoD.js → chunk-QZHKN3VN.nUKFBiLD.js} +1 -1
  58. package/web/_astro/{classDiagram-4FO5ZUOK.BuOUhxcD.js → classDiagram-4FO5ZUOK.DZg9K9mO.js} +1 -1
  59. package/web/_astro/{classDiagram-v2-Q7XG4LA2.BuOUhxcD.js → classDiagram-v2-Q7XG4LA2.DZg9K9mO.js} +1 -1
  60. package/web/_astro/{cose-bilkent-S5V4N54A.BRUU8E_0.js → cose-bilkent-S5V4N54A.D9STo90d.js} +1 -1
  61. package/web/_astro/{dagre-BM42HDAG.GDbfFYVV.js → dagre-BM42HDAG.D3IbwhHz.js} +1 -1
  62. package/web/_astro/{diagram-2AECGRRQ.CvIDBeJF.js → diagram-2AECGRRQ.BWTDxBe9.js} +1 -1
  63. package/web/_astro/{diagram-5GNKFQAL.DMgJjWOX.js → diagram-5GNKFQAL.XnXlonHG.js} +1 -1
  64. package/web/_astro/{diagram-KO2AKTUF.njjl-0AP.js → diagram-KO2AKTUF.CywOngCO.js} +1 -1
  65. package/web/_astro/{diagram-LMA3HP47.CcCqgP8M.js → diagram-LMA3HP47.DY1D21Iu.js} +1 -1
  66. package/web/_astro/{diagram-OG6HWLK6.Btqd-YVE.js → diagram-OG6HWLK6.DQxb59KA.js} +1 -1
  67. package/web/_astro/{erDiagram-TEJ5UH35.BbhML_Xo.js → erDiagram-TEJ5UH35.CF2U-pQZ.js} +1 -1
  68. package/web/_astro/{flowDiagram-I6XJVG4X.CkvsIgY8.js → flowDiagram-I6XJVG4X.BJK4M3in.js} +1 -1
  69. package/web/_astro/{ganttDiagram-6RSMTGT7.m8IWD_wW.js → ganttDiagram-6RSMTGT7.BSniMzdB.js} +1 -1
  70. package/web/_astro/{gitGraphDiagram-PVQCEYII.5z87HXO-.js → gitGraphDiagram-PVQCEYII.Dxg-yRov.js} +1 -1
  71. package/web/_astro/index.BVXdIsZV.css +1 -0
  72. package/web/_astro/{infoDiagram-5YYISTIA.Bvyvsd7Q.js → infoDiagram-5YYISTIA.BY4CgO_n.js} +1 -1
  73. package/web/_astro/{ishikawaDiagram-YF4QCWOH.DdWVYO87.js → ishikawaDiagram-YF4QCWOH.BmWDZtwF.js} +1 -1
  74. package/web/_astro/{journeyDiagram-JHISSGLW.C3kOlYH1.js → journeyDiagram-JHISSGLW.CpB1YWDP.js} +1 -1
  75. package/web/_astro/{kanban-definition-UN3LZRKU.CfKTUHVC.js → kanban-definition-UN3LZRKU.k-fukQX9.js} +1 -1
  76. package/web/_astro/{linear.CMDHnzgX.js → linear.BNNCobvI.js} +1 -1
  77. package/web/_astro/{mermaid.core.DN7-WrsP.js → mermaid.core.DnpzzuPU.js} +4 -4
  78. package/web/_astro/{mindmap-definition-RKZ34NQL.DcQxLvqG.js → mindmap-definition-RKZ34NQL.D9NnlLBu.js} +1 -1
  79. package/web/_astro/{pieDiagram-4H26LBE5.Nu-Inbw6.js → pieDiagram-4H26LBE5.CKhoMiyC.js} +1 -1
  80. package/web/_astro/{quadrantDiagram-W4KKPZXB.Dck2EChs.js → quadrantDiagram-W4KKPZXB.BkAygRlm.js} +1 -1
  81. package/web/_astro/{requirementDiagram-4Y6WPE33.C--E5XuW.js → requirementDiagram-4Y6WPE33.CX8ibmwc.js} +1 -1
  82. package/web/_astro/{sankeyDiagram-5OEKKPKP.B_0iRNna.js → sankeyDiagram-5OEKKPKP.Dvurpa0Y.js} +1 -1
  83. package/web/_astro/{sequenceDiagram-3UESZ5HK.PKuKr9mk.js → sequenceDiagram-3UESZ5HK.veO8c2tk.js} +1 -1
  84. package/web/_astro/{stateDiagram-AJRCARHV.ClhGHb-O.js → stateDiagram-AJRCARHV.DpMr4CO3.js} +1 -1
  85. package/web/_astro/{stateDiagram-v2-BHNVJYJU.Bv6BBnvg.js → stateDiagram-v2-BHNVJYJU.CKjso86_.js} +1 -1
  86. package/web/_astro/{timeline-definition-PNZ67QCA.BZm2ZvAH.js → timeline-definition-PNZ67QCA.DayoPp_2.js} +1 -1
  87. package/web/_astro/{vennDiagram-CIIHVFJN.Dt6yZXry.js → vennDiagram-CIIHVFJN.XNHf04O9.js} +1 -1
  88. package/web/_astro/{wardley-L42UT6IY.rUs-E00M.js → wardley-L42UT6IY.CpM_031g.js} +1 -1
  89. package/web/_astro/{wardleyDiagram-YWT4CUSO.BcWgv4cA.js → wardleyDiagram-YWT4CUSO.lIAjSkZJ.js} +1 -1
  90. package/web/_astro/{xychartDiagram-2RQKCTM6.DH-M-cX9.js → xychartDiagram-2RQKCTM6.D8_2K6U1.js} +1 -1
  91. package/web/index.html +2 -2
  92. package/web/_astro/BoardApp.Z9jMwI9G.js +0 -1
  93. package/web/_astro/channel.BJtn6CGV.js +0 -1
  94. package/web/_astro/index.nWve6EHS.css +0 -1
package/spur.js CHANGED
@@ -47,7 +47,7 @@ var __export = (target, all) => {
47
47
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
48
48
  var __require = import.meta.require;
49
49
 
50
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.42/node_modules/@gobing-ai/ts-utils/dist/errors.js
50
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.45/node_modules/@gobing-ai/ts-utils/dist/errors.js
51
51
  var ErrorCode;
52
52
  var init_errors = __esm(() => {
53
53
  ErrorCode = {
@@ -58,7 +58,7 @@ var init_errors = __esm(() => {
58
58
  };
59
59
  });
60
60
 
61
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.42/node_modules/@gobing-ai/ts-utils/dist/api-response.js
61
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.45/node_modules/@gobing-ai/ts-utils/dist/api-response.js
62
62
  var API_ERROR_CODES, ERROR_CODE_TO_HTTP, CLIENT_SAFE_CODES;
63
63
  var init_api_response = __esm(() => {
64
64
  init_errors();
@@ -81,13 +81,13 @@ var init_api_response = __esm(() => {
81
81
  CLIENT_SAFE_CODES = new Set([ErrorCode.NotFound, ErrorCode.Validation, ErrorCode.Conflict]);
82
82
  });
83
83
 
84
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.42/node_modules/@gobing-ai/ts-utils/dist/cursor.js
84
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.45/node_modules/@gobing-ai/ts-utils/dist/cursor.js
85
85
  var init_cursor = () => {};
86
86
 
87
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.42/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
87
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.45/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
88
88
  var init_event_severity = () => {};
89
89
 
90
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.42/node_modules/@gobing-ai/ts-utils/dist/object.js
90
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.45/node_modules/@gobing-ai/ts-utils/dist/object.js
91
91
  function isPlainObject(value) {
92
92
  return typeof value === "object" && value !== null && !Array.isArray(value);
93
93
  }
@@ -105,7 +105,7 @@ function deepMerge(target, source) {
105
105
  return result;
106
106
  }
107
107
 
108
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.42/node_modules/@gobing-ai/ts-utils/dist/output.js
108
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.45/node_modules/@gobing-ai/ts-utils/dist/output.js
109
109
  function processStream(name) {
110
110
  const proc = globalThis.process;
111
111
  const stream = proc?.[name];
@@ -126,7 +126,7 @@ function echoError(message, target = defaultStderrTarget ?? processStream("stder
126
126
  }
127
127
  var defaultStdoutTarget, defaultStderrTarget;
128
128
 
129
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.42/node_modules/@gobing-ai/ts-utils/dist/index.js
129
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.45/node_modules/@gobing-ai/ts-utils/dist/index.js
130
130
  var init_dist = __esm(() => {
131
131
  init_api_response();
132
132
  init_cursor();
@@ -21749,7 +21749,7 @@ var init_zod = __esm(() => {
21749
21749
  init_external();
21750
21750
  });
21751
21751
 
21752
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+65e77bb9e86f02cf/node_modules/@gobing-ai/ts-runtime/dist/config.js
21752
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+3976d6402491c270/node_modules/@gobing-ai/ts-runtime/dist/config.js
21753
21753
  function getProcessEnv() {
21754
21754
  return process.env;
21755
21755
  }
@@ -21827,7 +21827,7 @@ var init_config = __esm(() => {
21827
21827
  };
21828
21828
  });
21829
21829
 
21830
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+65e77bb9e86f02cf/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
21830
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+3976d6402491c270/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
21831
21831
  import { appendFileSync, cpSync, createReadStream, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
21832
21832
  import { dirname, resolve as resolvePath } from "path";
21833
21833
  function createNodeFileSystem(root, paths) {
@@ -21914,7 +21914,7 @@ function findProjectRoot(startDir) {
21914
21914
  }
21915
21915
  var init_file_system_node = () => {};
21916
21916
 
21917
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+65e77bb9e86f02cf/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
21917
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+3976d6402491c270/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
21918
21918
  var DbModuleNotInstalledError;
21919
21919
  var init_db_errors = __esm(() => {
21920
21920
  DbModuleNotInstalledError = class DbModuleNotInstalledError extends Error {
@@ -29125,7 +29125,7 @@ var init_execa = __esm(() => {
29125
29125
  } = getIpcExport());
29126
29126
  });
29127
29127
 
29128
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+65e77bb9e86f02cf/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
29128
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+3976d6402491c270/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
29129
29129
  import { isatty } from "tty";
29130
29130
  function processEventSeverity(reason, exitCode) {
29131
29131
  if (reason === "error")
@@ -29489,7 +29489,7 @@ var init_process_executor = __esm(() => {
29489
29489
  init_config();
29490
29490
  });
29491
29491
 
29492
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+65e77bb9e86f02cf/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
29492
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+3976d6402491c270/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
29493
29493
  function getNodeFileSystem() {
29494
29494
  if (!_nodeFileSystem)
29495
29495
  _nodeFileSystem = createNodeFileSystem();
@@ -29549,7 +29549,7 @@ var init_runtime_node_bun = __esm(() => {
29549
29549
  };
29550
29550
  });
29551
29551
 
29552
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+65e77bb9e86f02cf/node_modules/@gobing-ai/ts-runtime/dist/context.js
29552
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+3976d6402491c270/node_modules/@gobing-ai/ts-runtime/dist/context.js
29553
29553
  class RuntimeContext {
29554
29554
  scope;
29555
29555
  runtimeName;
@@ -29619,7 +29619,7 @@ var init_context = __esm(() => {
29619
29619
  init_runtime_node_bun();
29620
29620
  });
29621
29621
 
29622
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+65e77bb9e86f02cf/node_modules/@gobing-ai/ts-runtime/dist/path.js
29622
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+3976d6402491c270/node_modules/@gobing-ai/ts-runtime/dist/path.js
29623
29623
  function normalizeSeparators(path6) {
29624
29624
  return path6.replaceAll("\\", "/");
29625
29625
  }
@@ -29680,17 +29680,17 @@ var init_path = __esm(() => {
29680
29680
  SEP = globalThis.process?.platform === "win32" ? "\\" : "/";
29681
29681
  });
29682
29682
 
29683
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+65e77bb9e86f02cf/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
29683
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+3976d6402491c270/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
29684
29684
  var REMOTE_SCHEMA_MAX_BYTES;
29685
29685
  var init_schema_validation = __esm(() => {
29686
29686
  init_dist2();
29687
29687
  REMOTE_SCHEMA_MAX_BYTES = 5 * 1024 * 1024;
29688
29688
  });
29689
29689
 
29690
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+65e77bb9e86f02cf/node_modules/@gobing-ai/ts-runtime/dist/types.js
29690
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+3976d6402491c270/node_modules/@gobing-ai/ts-runtime/dist/types.js
29691
29691
  var init_types = () => {};
29692
29692
 
29693
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+65e77bb9e86f02cf/node_modules/@gobing-ai/ts-runtime/dist/index.js
29693
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+3976d6402491c270/node_modules/@gobing-ai/ts-runtime/dist/index.js
29694
29694
  var init_dist3 = __esm(() => {
29695
29695
  init_config();
29696
29696
  init_context();
@@ -29699,7 +29699,7 @@ var init_dist3 = __esm(() => {
29699
29699
  init_types();
29700
29700
  });
29701
29701
 
29702
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+65e77bb9e86f02cf/node_modules/@gobing-ai/ts-runtime/dist/bun-sqlite.js
29702
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+3976d6402491c270/node_modules/@gobing-ai/ts-runtime/dist/bun-sqlite.js
29703
29703
  import { Database } from "bun:sqlite";
29704
29704
  var init_bun_sqlite = () => {};
29705
29705
 
@@ -34129,7 +34129,7 @@ var init_bun_sqlite2 = __esm(() => {
34129
34129
  init_session2();
34130
34130
  });
34131
34131
 
34132
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/schema/inbox-messages.js
34132
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/schema/inbox-messages.js
34133
34133
  var inboxMessages;
34134
34134
  var init_inbox_messages = __esm(() => {
34135
34135
  init_sqlite_core();
@@ -34148,7 +34148,7 @@ var init_inbox_messages = __esm(() => {
34148
34148
  }, (table2) => [index("idx_inbox_messages_to_status").on(table2.toId, table2.status)]);
34149
34149
  });
34150
34150
 
34151
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/schema/common.js
34151
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/schema/common.js
34152
34152
  function nowTimestamp() {
34153
34153
  return Date.now();
34154
34154
  }
@@ -34177,7 +34177,7 @@ var init_common3 = __esm(() => {
34177
34177
  appendOnlyColumns = buildAppendOnlyColumns();
34178
34178
  });
34179
34179
 
34180
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/schema/queue-jobs.js
34180
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/schema/queue-jobs.js
34181
34181
  var queueJobs;
34182
34182
  var init_queue_jobs = __esm(() => {
34183
34183
  init_sqlite_core();
@@ -34197,7 +34197,7 @@ var init_queue_jobs = __esm(() => {
34197
34197
  }, (table2) => [index("queue_jobs_ready_idx").on(table2.status, table2.nextRetryAt, table2.createdAt)]);
34198
34198
  });
34199
34199
 
34200
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/schema/runtime.js
34200
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/schema/runtime.js
34201
34201
  var exports_runtime = {};
34202
34202
  __export(exports_runtime, {
34203
34203
  queueJobs: () => queueJobs,
@@ -34208,7 +34208,7 @@ var init_runtime = __esm(() => {
34208
34208
  init_queue_jobs();
34209
34209
  });
34210
34210
 
34211
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/adapters/bun-sqlite.js
34211
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/adapters/bun-sqlite.js
34212
34212
  var exports_bun_sqlite = {};
34213
34213
  __export(exports_bun_sqlite, {
34214
34214
  BunSqliteAdapter: () => BunSqliteAdapter
@@ -34519,7 +34519,7 @@ var init_d1 = __esm(() => {
34519
34519
  init_session3();
34520
34520
  });
34521
34521
 
34522
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/adapters/d1.js
34522
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/adapters/d1.js
34523
34523
  var exports_d1 = {};
34524
34524
  __export(exports_d1, {
34525
34525
  D1Adapter: () => D1Adapter
@@ -34583,7 +34583,7 @@ var init_d12 = __esm(() => {
34583
34583
  init_runtime();
34584
34584
  });
34585
34585
 
34586
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/adapter.js
34586
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/adapter.js
34587
34587
  async function createDbAdapter(config3) {
34588
34588
  switch (config3.driver) {
34589
34589
  case "bun-sqlite": {
@@ -34617,7 +34617,7 @@ var init_drizzle_orm = __esm(() => {
34617
34617
  init_view_common();
34618
34618
  });
34619
34619
 
34620
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/query-spec.js
34620
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/query-spec.js
34621
34621
  function compilePredicate(predicate) {
34622
34622
  if ("and" in predicate) {
34623
34623
  const parts = predicate.and.map(compilePredicate).filter((p) => p !== undefined);
@@ -34655,7 +34655,7 @@ var init_query_spec = __esm(() => {
34655
34655
  };
34656
34656
  });
34657
34657
 
34658
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/base-dao.js
34658
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/base-dao.js
34659
34659
  function asSelectQuery(query) {
34660
34660
  return query;
34661
34661
  }
@@ -34697,7 +34697,7 @@ var init_base_dao = __esm(() => {
34697
34697
  init_query_spec();
34698
34698
  });
34699
34699
 
34700
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/embedded-migrations.js
34700
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/embedded-migrations.js
34701
34701
  var embeddedMigrations;
34702
34702
  var init_embedded_migrations = __esm(() => {
34703
34703
  embeddedMigrations = [
@@ -34729,7 +34729,7 @@ var init_embedded_migrations = __esm(() => {
34729
34729
  ];
34730
34730
  });
34731
34731
 
34732
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/entity-dao.js
34732
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/entity-dao.js
34733
34733
  var EntityDao;
34734
34734
  var init_entity_dao = __esm(() => {
34735
34735
  init_drizzle_orm();
@@ -34891,7 +34891,7 @@ var init_entity_dao = __esm(() => {
34891
34891
  };
34892
34892
  });
34893
34893
 
34894
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/inbox-message-dao.js
34894
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/inbox-message-dao.js
34895
34895
  function isPromiseLike(value) {
34896
34896
  return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
34897
34897
  }
@@ -35069,7 +35069,7 @@ var init_migrator2 = __esm(() => {
35069
35069
  init_migrator();
35070
35070
  });
35071
35071
 
35072
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/migrate.js
35072
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/migrate.js
35073
35073
  async function ensureJournalTable(adapter, table3) {
35074
35074
  await adapter.exec(`CREATE TABLE IF NOT EXISTS "${table3}" (` + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "hash text NOT NULL, " + "created_at numeric" + ")");
35075
35075
  }
@@ -35144,7 +35144,7 @@ var init_migrate = __esm(() => {
35144
35144
  init_embedded_migrations();
35145
35145
  });
35146
35146
 
35147
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/queue-job-dao.js
35147
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/queue-job-dao.js
35148
35148
  var QueueJobDao;
35149
35149
  var init_queue_job_dao = __esm(() => {
35150
35150
  init_drizzle_orm();
@@ -35285,7 +35285,7 @@ var init_queue_job_dao = __esm(() => {
35285
35285
  };
35286
35286
  });
35287
35287
 
35288
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/index.js
35288
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/index.js
35289
35289
  var exports_dist = {};
35290
35290
  __export(exports_dist, {
35291
35291
  embeddedMigrations: () => embeddedMigrations,
@@ -37418,7 +37418,7 @@ var require_extra_typings = __commonJS((exports, module) => {
37418
37418
  exports.createArgument = (name, description) => new commander.Argument(name, description);
37419
37419
  });
37420
37420
 
37421
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/config.js
37421
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/config.js
37422
37422
  function parseYamlObject(text3) {
37423
37423
  let parsed;
37424
37424
  try {
@@ -37545,7 +37545,7 @@ var init_config2 = __esm(() => {
37545
37545
  };
37546
37546
  });
37547
37547
 
37548
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
37548
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
37549
37549
  import { appendFileSync as appendFileSync3, cpSync as cpSync2, createReadStream as createReadStream3, createWriteStream as createWriteStream3, existsSync as existsSync2, mkdirSync as mkdirSync2, readdirSync as readdirSync2, readFileSync as readFileSync4, realpathSync as realpathSync2, renameSync as renameSync2, rmSync as rmSync2, statSync as statSync3, writeFileSync as writeFileSync3 } from "fs";
37550
37550
  import { dirname as dirname2, resolve as resolvePath3 } from "path";
37551
37551
  function createNodeFileSystem3(root, paths) {
@@ -37632,7 +37632,7 @@ function findProjectRoot3(startDir) {
37632
37632
  }
37633
37633
  var init_file_system_node2 = () => {};
37634
37634
 
37635
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
37635
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
37636
37636
  var D1NotConfiguredError2, DbModuleNotInstalledError3;
37637
37637
  var init_db_errors2 = __esm(() => {
37638
37638
  D1NotConfiguredError2 = class D1NotConfiguredError2 extends Error {
@@ -37649,7 +37649,7 @@ var init_db_errors2 = __esm(() => {
37649
37649
  };
37650
37650
  });
37651
37651
 
37652
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/file-system-cf.js
37652
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/file-system-cf.js
37653
37653
  function createCfFileSystem2() {
37654
37654
  return {
37655
37655
  getProjectRoot: () => "/bundle",
@@ -37688,7 +37688,7 @@ function createCfFileSystem2() {
37688
37688
  }
37689
37689
  var UNSUPPORTED = "FileSystem is not available on Cloudflare Workers. Use D1, KV, or R2 for persistent storage.";
37690
37690
 
37691
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/runtime-cf.js
37691
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/runtime-cf.js
37692
37692
  var exports_runtime_cf = {};
37693
37693
  __export(exports_runtime_cf, {
37694
37694
  cloudflareWorkersFactory: () => cloudflareWorkersFactory2
@@ -37726,7 +37726,7 @@ var init_runtime_cf = __esm(() => {
37726
37726
  };
37727
37727
  });
37728
37728
 
37729
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
37729
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
37730
37730
  import { isatty as isatty2 } from "tty";
37731
37731
  function processEventSeverity2(reason, exitCode) {
37732
37732
  if (reason === "error")
@@ -38137,7 +38137,7 @@ var init_process_executor2 = __esm(() => {
38137
38137
  ProcessExecutor2 = NodeProcessExecutor3;
38138
38138
  });
38139
38139
 
38140
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
38140
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
38141
38141
  var exports_runtime_node_bun = {};
38142
38142
  __export(exports_runtime_node_bun, {
38143
38143
  nodeBunFactory: () => nodeBunFactory3,
@@ -38205,7 +38205,7 @@ var init_runtime_node_bun2 = __esm(() => {
38205
38205
  };
38206
38206
  });
38207
38207
 
38208
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/platform.js
38208
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/platform.js
38209
38209
  function isCloudflareWorkerRuntime2() {
38210
38210
  return globalThis.navigator?.userAgent?.startsWith("Cloudflare-Workers") ?? false;
38211
38211
  }
@@ -38235,7 +38235,7 @@ function _resetRuntimeFactory2() {
38235
38235
  }
38236
38236
  var _factory, _runtimeName;
38237
38237
 
38238
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/context.js
38238
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/context.js
38239
38239
  class RuntimeContext2 {
38240
38240
  scope;
38241
38241
  runtimeName;
@@ -38325,7 +38325,7 @@ var init_context2 = __esm(() => {
38325
38325
  init_runtime_node_bun2();
38326
38326
  });
38327
38327
 
38328
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/path.js
38328
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/path.js
38329
38329
  function normalizeSeparators2(path7) {
38330
38330
  return path7.replaceAll("\\", "/");
38331
38331
  }
@@ -38448,7 +38448,7 @@ var init_path2 = __esm(() => {
38448
38448
  SEP2 = globalThis.process?.platform === "win32" ? "\\" : "/";
38449
38449
  });
38450
38450
 
38451
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/fs.js
38451
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/fs.js
38452
38452
  async function ensureDirForFile2(path7, fs2 = createNodeFileSystem3()) {
38453
38453
  await fs2.ensureDir(dirnamePath(path7));
38454
38454
  }
@@ -38516,7 +38516,7 @@ var init_fs = __esm(() => {
38516
38516
  init_path2();
38517
38517
  });
38518
38518
 
38519
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/process-registry.js
38519
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/process-registry.js
38520
38520
  function allocateId() {
38521
38521
  nextIdSeq += 1;
38522
38522
  return `pe_${Date.now().toString(36)}_${nextIdSeq.toString(36)}`;
@@ -38640,7 +38640,7 @@ function createInMemoryProcessRegistry2(options) {
38640
38640
  }
38641
38641
  var nextIdSeq = 0;
38642
38642
 
38643
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/runtime-paths.js
38643
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/runtime-paths.js
38644
38644
  function ambientRuntimePaths2() {
38645
38645
  const cwd = getProcessCwd2();
38646
38646
  return { cwd, home: getHomeDir() ?? cwd };
@@ -38650,7 +38650,7 @@ var init_runtime_paths = __esm(() => {
38650
38650
  init_path2();
38651
38651
  });
38652
38652
 
38653
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
38653
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
38654
38654
  async function loadStructuredConfig(path7, options = {}) {
38655
38655
  const content = await (options.fileSystem ?? createNodeFileSystem3()).readFile(path7);
38656
38656
  return await parseStructuredConfig(content, path7, options);
@@ -38933,10 +38933,10 @@ var init_schema_validation2 = __esm(() => {
38933
38933
  defaultResolve = typeof Bun !== "undefined" ? (specifier, from) => Bun.resolveSync(specifier, from) : undefined;
38934
38934
  });
38935
38935
 
38936
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/types.js
38936
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/types.js
38937
38937
  var init_types2 = () => {};
38938
38938
 
38939
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/index.js
38939
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/index.js
38940
38940
  var exports_dist2 = {};
38941
38941
  __export(exports_dist2, {
38942
38942
  writeJsonFile: () => writeJsonFile2,
@@ -39036,7 +39036,7 @@ var init_finding_codes = __esm(() => {
39036
39036
  "L3.ac-requirement-coverage",
39037
39037
  "L3.solution-file-line",
39038
39038
  "L3.review-priority-table",
39039
- "L3.testing-coverage",
39039
+ "L3.status-claim-contradiction",
39040
39040
  "L3.required-section-placeholder",
39041
39041
  "L3.plan-format",
39042
39042
  "L3.unchecked-checklist",
@@ -39089,7 +39089,7 @@ var init_finding_codes = __esm(() => {
39089
39089
  L3_AC_REQUIREMENT_COVERAGE: "L3.ac-requirement-coverage",
39090
39090
  L3_SOLUTION_FILE_LINE: "L3.solution-file-line",
39091
39091
  L3_REVIEW_PRIORITY_TABLE: "L3.review-priority-table",
39092
- L3_TESTING_COVERAGE: "L3.testing-coverage",
39092
+ L3_STATUS_CLAIM_CONTRADICTION: "L3.status-claim-contradiction",
39093
39093
  L3_REQUIRED_SECTION_PLACEHOLDER: "L3.required-section-placeholder",
39094
39094
  L3_PLAN_FORMAT: "L3.plan-format",
39095
39095
  L3_UNCHECKED_CHECKLIST: "L3.unchecked-checklist",
@@ -39165,18 +39165,37 @@ function normalizeMember(member) {
39165
39165
  function memberLocalId(member, roster, index2) {
39166
39166
  if (member.id !== undefined)
39167
39167
  return member.id;
39168
- if (member.executor !== undefined)
39169
- return member.executor;
39170
- const role = member.role;
39171
- if (role === undefined)
39172
- return "";
39173
- let n2 = 0;
39168
+ const used = new Set;
39169
+ const executorSeen = new Map;
39170
+ const roleSeen = new Map;
39174
39171
  for (let i2 = 0;i2 <= index2; i2++) {
39175
- const m = roster[i2];
39176
- if (m !== undefined && m.id === undefined && m.executor === undefined && m.role === role)
39177
- n2 += 1;
39172
+ const current = i2 === index2 ? member : roster[i2];
39173
+ if (current === undefined)
39174
+ continue;
39175
+ let localId;
39176
+ if (current.id !== undefined) {
39177
+ localId = current.id;
39178
+ } else if (current.executor !== undefined) {
39179
+ const base2 = current.executor;
39180
+ let suffix = (executorSeen.get(base2) ?? 0) + 1;
39181
+ executorSeen.set(base2, suffix);
39182
+ localId = suffix === 1 ? base2 : `${base2}-${suffix}`;
39183
+ while (used.has(localId)) {
39184
+ suffix += 1;
39185
+ localId = `${base2}-${suffix}`;
39186
+ }
39187
+ } else if (current.role !== undefined) {
39188
+ const n2 = (roleSeen.get(current.role) ?? 0) + 1;
39189
+ roleSeen.set(current.role, n2);
39190
+ localId = `${current.role}-${n2}`;
39191
+ } else {
39192
+ localId = "";
39193
+ }
39194
+ if (i2 === index2)
39195
+ return localId;
39196
+ used.add(localId);
39178
39197
  }
39179
- return `${role}-${n2}`;
39198
+ return "";
39180
39199
  }
39181
39200
  function resolveExecutor(name, agentConfig, opts) {
39182
39201
  const exec = agentConfig?.executors?.find((entry) => entry.name === name);
@@ -41773,7 +41792,7 @@ var init_mod = __esm(() => {
41773
41792
  init_config3();
41774
41793
  });
41775
41794
 
41776
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/logger.js
41795
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/logger.js
41777
41796
  function toLogTapeLevel(level) {
41778
41797
  return level === "warn" ? "warning" : level;
41779
41798
  }
@@ -43326,7 +43345,7 @@ var require_src = __commonJS((exports) => {
43326
43345
  };
43327
43346
  });
43328
43347
 
43329
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/telemetry/sdk.js
43348
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/telemetry/sdk.js
43330
43349
  function getTelemetryConfig(configPartial = {}) {
43331
43350
  return {
43332
43351
  enabled: configPartial.enabled ?? CONFIG_DEFAULTS.enabled,
@@ -43362,7 +43381,7 @@ var init_sdk = __esm(() => {
43362
43381
  resolvedConfig = getTelemetryConfig();
43363
43382
  });
43364
43383
 
43365
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/telemetry/tracing.js
43384
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/telemetry/tracing.js
43366
43385
  function isSuppressed(tracer2) {
43367
43386
  return tracer2 === undefined && !getResolvedConfig().enabled;
43368
43387
  }
@@ -43402,7 +43421,7 @@ var init_tracing2 = __esm(() => {
43402
43421
  import_api2 = __toESM(require_src(), 1);
43403
43422
  });
43404
43423
 
43405
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/telemetry/metrics.js
43424
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/telemetry/metrics.js
43406
43425
  function getMeter() {
43407
43426
  return import_api3.metrics.getMeter(METER_NAME, METER_VERSION);
43408
43427
  }
@@ -43499,7 +43518,7 @@ var init_metrics = __esm(() => {
43499
43518
  instruments = {};
43500
43519
  });
43501
43520
 
43502
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/event-bus/event-bus.js
43521
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/event-bus/event-bus.js
43503
43522
  function busLogger() {
43504
43523
  if (!_busLogger)
43505
43524
  _busLogger = getLogger2("event-bus");
@@ -43752,7 +43771,7 @@ var init_event_bus = __esm(() => {
43752
43771
  init_metrics();
43753
43772
  });
43754
43773
 
43755
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/event-bus/default-observers.js
43774
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/event-bus/default-observers.js
43756
43775
  function obsLogger() {
43757
43776
  if (!_obsLogger)
43758
43777
  _obsLogger = getLogger2("event-bus.observers");
@@ -43816,7 +43835,7 @@ var init_default_observers = __esm(() => {
43816
43835
  init_event_bus();
43817
43836
  });
43818
43837
 
43819
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/event-bus/file-observer.js
43838
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/event-bus/file-observer.js
43820
43839
  function parentDir(filePath) {
43821
43840
  const idx = filePath.lastIndexOf("/");
43822
43841
  return idx <= 0 ? "." : filePath.slice(0, idx);
@@ -43914,7 +43933,7 @@ var init_file_observer = __esm(() => {
43914
43933
  init_logger3();
43915
43934
  });
43916
43935
 
43917
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/internals/drain.js
43936
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/internals/drain.js
43918
43937
  function settleWithin(promise2, deadline) {
43919
43938
  const remaining = deadline - Date.now();
43920
43939
  if (remaining <= 0)
@@ -43929,7 +43948,7 @@ function settleWithin(promise2, deadline) {
43929
43948
  return settled;
43930
43949
  }
43931
43950
 
43932
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/scheduler/node.js
43951
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/scheduler/node.js
43933
43952
  function parseInterval(cron) {
43934
43953
  const trimmed = cron.trim();
43935
43954
  const num = Number(trimmed);
@@ -44023,7 +44042,7 @@ var init_node3 = __esm(() => {
44023
44042
  init_metrics();
44024
44043
  });
44025
44044
 
44026
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/scheduler-node.js
44045
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/scheduler-node.js
44027
44046
  var exports_scheduler_node = {};
44028
44047
  __export(exports_scheduler_node, {
44029
44048
  NodeSchedulerAdapter: () => NodeSchedulerAdapter
@@ -50251,6 +50270,12 @@ var require_src8 = __commonJS((exports) => {
50251
50270
  } });
50252
50271
  });
50253
50272
 
50273
+ // ../../packages/domain/src/agent-instance.ts
50274
+ function specRole(input) {
50275
+ const role = input?.config?.role;
50276
+ return typeof role === "string" && role.length > 0 ? role : null;
50277
+ }
50278
+
50254
50279
  // ../../packages/domain/src/analytics/artifact.ts
50255
50280
  import { createHash } from "crypto";
50256
50281
  function selectorDigest(selector) {
@@ -50427,8 +50452,15 @@ class MetricRegistry {
50427
50452
  }
50428
50453
  function emptyDerived() {
50429
50454
  return {
50430
- phases: { phaseSupport: "unsupported", phases: [] },
50431
- timeDecomposition: { llmMs: 0, toolMs: 0, idleMs: 0, unattributedMs: 0, spanMs: 0, spanExcludedSessions: 0 },
50455
+ phases: { phaseSupport: "unsupported", phases: [], invalidPhaseCount: 0 },
50456
+ timeDecomposition: {
50457
+ llmMs: null,
50458
+ toolMs: null,
50459
+ idleMs: 0,
50460
+ unattributedMs: 0,
50461
+ spanMs: 0,
50462
+ spanExcludedSessions: 0
50463
+ },
50432
50464
  bottlenecks: []
50433
50465
  };
50434
50466
  }
@@ -50506,6 +50538,7 @@ function extractPhases(todoCalls) {
50506
50538
  arr.push(call);
50507
50539
  }
50508
50540
  const phases = [];
50541
+ let invalidPhaseCount = 0;
50509
50542
  for (const [, calls] of sessions) {
50510
50543
  const started = new Map;
50511
50544
  const ended = new Map;
@@ -50522,55 +50555,55 @@ function extractPhases(todoCalls) {
50522
50555
  }
50523
50556
  }
50524
50557
  }
50525
- const lastCallTs = calls[calls.length - 1]?.ts ?? "";
50526
50558
  for (const content of seen) {
50527
- phases.push({
50528
- name: content,
50529
- startedAt: started.get(content) ?? lastCallTs,
50530
- endedAt: ended.get(content) ?? lastCallTs,
50531
- source: "todo"
50532
- });
50559
+ const s = started.get(content) ?? null;
50560
+ const e = ended.get(content) ?? null;
50561
+ if (s !== null && e !== null && Date.parse(e) < Date.parse(s)) {
50562
+ invalidPhaseCount += 1;
50563
+ continue;
50564
+ }
50565
+ phases.push({ name: content, startedAt: s, endedAt: e, source: "todo" });
50533
50566
  }
50534
50567
  }
50535
- return phases;
50568
+ return { phases, invalidPhaseCount };
50536
50569
  }
50537
50570
  function phasesMetric(ctx) {
50538
50571
  if (ctx.todoCalls.length === 0) {
50539
- ctx.results.phases = { phaseSupport: "unsupported", phases: [] };
50572
+ ctx.results.phases = { phaseSupport: "unsupported", phases: [], invalidPhaseCount: 0 };
50540
50573
  return;
50541
50574
  }
50542
- ctx.results.phases = {
50543
- phaseSupport: "supported",
50544
- phases: extractPhases(ctx.todoCalls)
50545
- };
50575
+ const { phases, invalidPhaseCount } = extractPhases(ctx.todoCalls);
50576
+ ctx.results.phases = { phaseSupport: "supported", phases, invalidPhaseCount };
50546
50577
  }
50547
50578
  function decompositionMetric(ctx) {
50548
50579
  const toolMap = new Map;
50549
50580
  for (const row of ctx.sessionTools) {
50550
50581
  toolMap.set(`${row.sessionId}\x00${row.source}`, row);
50551
50582
  }
50552
- let llmMs = 0;
50553
- let toolMs = 0;
50583
+ let llmMs = null;
50584
+ let toolMs = null;
50554
50585
  let idleMs = 0;
50555
50586
  let unattributedMs = 0;
50556
50587
  let spanMs = 0;
50557
50588
  let spanExcludedSessions = 0;
50558
50589
  for (const span of ctx.sessionSpans) {
50559
50590
  const ms = new Date(span.lastTs ?? NaN).getTime() - new Date(span.firstTs ?? NaN).getTime();
50560
- const llm = span.assistantDurationMs ?? 0;
50591
+ const llm = span.assistantDurationMs;
50561
50592
  const llmUnmeasured = span.assistantDurationUnmeasured;
50562
50593
  const key = `${span.sessionId}\x00${span.source}`;
50563
50594
  const toolRow = toolMap.get(key);
50564
- const tool = toolRow?.toolDurationMs ?? 0;
50595
+ const tool = toolRow?.toolDurationMs ?? null;
50565
50596
  const toolUnmeasured = toolRow?.toolDurationUnmeasured ?? 0;
50566
- llmMs += llm;
50567
- toolMs += tool;
50597
+ if (llm !== null)
50598
+ llmMs = (llmMs ?? 0) + llm;
50599
+ if (tool !== null)
50600
+ toolMs = (toolMs ?? 0) + tool;
50568
50601
  if (!Number.isFinite(ms) || ms <= 0) {
50569
50602
  spanExcludedSessions++;
50570
50603
  continue;
50571
50604
  }
50572
50605
  spanMs += ms;
50573
- const remainder = Math.max(0, ms - llm - tool);
50606
+ const remainder = Math.max(0, ms - (llm ?? 0) - (tool ?? 0));
50574
50607
  if (llmUnmeasured > 0 || toolUnmeasured > 0) {
50575
50608
  unattributedMs += remainder;
50576
50609
  } else {
@@ -50582,8 +50615,8 @@ function decompositionMetric(ctx) {
50582
50615
  function bottlenecksMetric(ctx) {
50583
50616
  const { llmMs, toolMs, idleMs, unattributedMs, spanMs } = ctx.results.timeDecomposition;
50584
50617
  const entries = [
50585
- { label: "llm", ms: llmMs },
50586
- { label: "tool", ms: toolMs },
50618
+ ...llmMs !== null ? [{ label: "llm", ms: llmMs }] : [],
50619
+ ...toolMs !== null ? [{ label: "tool", ms: toolMs }] : [],
50587
50620
  { label: "idle", ms: idleMs },
50588
50621
  { label: "unattributed", ms: unattributedMs }
50589
50622
  ];
@@ -50604,7 +50637,7 @@ function derivedWarnings(derived) {
50604
50637
  if (derived.timeDecomposition.unattributedMs > 0) {
50605
50638
  warnings.push({
50606
50639
  code: "derived-unattributed-time",
50607
- detail: `${derived.timeDecomposition.unattributedMs}ms could not be attributed to llm/tool/idle because some durations were unmeasured.`
50640
+ detail: `${derived.timeDecomposition.unattributedMs}ms could not be attributed to llm/tool/idle because some durations were unmeasured. Check the stepSupport matrix for per-source coverage before treating this as workload.`
50608
50641
  });
50609
50642
  }
50610
50643
  return warnings;
@@ -52136,19 +52169,23 @@ async function pairingSummary(db2, spec = {}) {
52136
52169
  } else {
52137
52170
  existing.dispatches += d.dispatches;
52138
52171
  existing.successes += d.successes;
52172
+ existing.failures += d.failures;
52139
52173
  existing.durationTotal += d.durationTotal;
52140
52174
  existing.durationCount += d.durationCount;
52141
52175
  }
52142
52176
  }
52143
52177
  const byKey = new Map;
52144
52178
  for (const [key, d] of rawByKey) {
52179
+ const known = d.successes + d.failures;
52145
52180
  byKey.set(key, {
52146
52181
  executor: d.executor,
52147
52182
  role: d.role,
52148
52183
  agent: d.agent,
52149
52184
  model: d.model,
52150
52185
  dispatches: d.dispatches,
52151
- successRate: d.dispatches > 0 ? d.successes / d.dispatches : 0,
52186
+ successRate: known > 0 ? d.successes / known : 0,
52187
+ failures: d.failures,
52188
+ unknownOutcomes: d.dispatches - known,
52152
52189
  escalations: {},
52153
52190
  totalCostUsd: 0,
52154
52191
  meanDurationMs: d.durationCount > 0 ? d.durationTotal / d.durationCount : 0
@@ -52176,9 +52213,14 @@ async function loadDispatchStats(db2, spec) {
52176
52213
  const { where, params } = eventWindow(spec);
52177
52214
  return await db2.queryAll(`WITH dispatch AS (
52178
52215
  SELECT id, run_id, occurred_at,
52179
- json_extract(payload_json, '$.data.executionId') AS execution_id,
52216
+ -- 0679 R1: the writer emits the execution key at either
52217
+ -- $.data.executionId or inside its correlation object; COALESCE
52218
+ -- covers both payload shapes (reader/writer drift guard, R9).
52219
+ COALESCE(json_extract(payload_json, '$.data.executionId'),
52220
+ json_extract(payload_json, '$.data.correlation.executionId')) AS execution_id,
52180
52221
  json_extract(payload_json, '$.data.agent') AS agent,
52181
- json_extract(payload_json, '$.data.model') AS model,
52222
+ COALESCE(json_extract(payload_json, '$.data.model'),
52223
+ json_extract(payload_json, '$.data.routing.model')) AS model,
52182
52224
  json_extract(payload_json, '$.data.routing.executor') AS executor,
52183
52225
  json_extract(payload_json, '$.data.routing.role') AS role
52184
52226
  FROM system_events
@@ -52190,14 +52232,18 @@ async function loadDispatchStats(db2, spec) {
52190
52232
  ),
52191
52233
  exit_rows AS (
52192
52234
  SELECT id, occurred_at,
52193
- json_extract(payload_json, '$.data.executionId') AS execution_id,
52194
- json_extract(payload_json, '$.data.outcome') AS outcome,
52235
+ -- 0679 R1: same dual-path join key on the exit leg.
52236
+ COALESCE(json_extract(payload_json, '$.data.executionId'),
52237
+ json_extract(payload_json, '$.data.correlation.executionId')) AS execution_id,
52238
+ -- 0679 R2: the writer emits exitCode, never an outcome field.
52239
+ json_extract(payload_json, '$.data.exitCode') AS exit_code,
52195
52240
  json_extract(payload_json, '$.data.durationMs') AS duration_ms
52196
52241
  FROM system_events
52197
52242
  WHERE event_name = 'agent.invoke.exit'
52198
52243
  ${where}
52199
52244
  AND json_valid(payload_json) = 1
52200
- AND json_extract(payload_json, '$.data.executionId') IS NOT NULL
52245
+ AND COALESCE(json_extract(payload_json, '$.data.executionId'),
52246
+ json_extract(payload_json, '$.data.correlation.executionId')) IS NOT NULL
52201
52247
  ),
52202
52248
  -- One exit per executionId: the latest. An execution emits one exit,
52203
52249
  -- but picking the latest keeps the FINAL dispatch outcome honest if
@@ -52213,7 +52259,10 @@ async function loadDispatchStats(db2, spec) {
52213
52259
  )
52214
52260
  SELECT d.executor AS executor, d.role AS role, d.agent AS agent, d.model AS model,
52215
52261
  COUNT(DISTINCT d.id) AS dispatches,
52216
- COALESCE(SUM(CASE WHEN f.outcome = 'done' THEN 1 ELSE 0 END), 0) AS successes,
52262
+ -- 0679 R2/R3: success = exitCode 0; failure = a non-zero exit; a dispatch
52263
+ -- with no joined exit stays unknown (never reads as failure).
52264
+ COALESCE(SUM(CASE WHEN f.exit_code = 0 THEN 1 ELSE 0 END), 0) AS successes,
52265
+ COALESCE(SUM(CASE WHEN f.exit_code IS NOT NULL AND f.exit_code != 0 THEN 1 ELSE 0 END), 0) AS failures,
52217
52266
  COALESCE(SUM(f.duration_ms), 0) AS durationTotal,
52218
52267
  COALESCE(SUM(CASE WHEN f.duration_ms IS NOT NULL THEN 1 ELSE 0 END), 0) AS durationCount
52219
52268
  FROM dispatch d
@@ -52554,7 +52603,7 @@ function renderTimeDecomposition(derived) {
52554
52603
  }
52555
52604
  const d = derived.timeDecomposition;
52556
52605
  const pct = (ms) => d.spanMs > 0 ? `${Math.round(ms / d.spanMs * 100)}%` : "n/a";
52557
- lines.push("| Component | Time | Share of wall |", "| --- | ---: | ---: |", `| LLM latency (assistant duration) | ${fmtWall(d.llmMs)} | ${pct(d.llmMs)} |`, `| Tool execution | ${fmtWall(d.toolMs)} | ${pct(d.toolMs)} |`, `| Idle / overhead | ${fmtWall(d.idleMs)} | ${pct(d.idleMs)} |`, `| Unattributed (unmeasured durations) | ${fmtWall(d.unattributedMs)} | ${pct(d.unattributedMs)} |`, `| **Wall clock (span)** | **${fmtWall(d.spanMs)}** | 100% |`, "", d.spanExcludedSessions > 0 ? `_Span excludes ${d.spanExcludedSessions} session(s) with unusable timestamps (sentinel-only or non-ISO); their measured durations still count above._` : "", "");
52606
+ lines.push("| Component | Time | Share of wall |", "| --- | ---: | ---: |", `| LLM latency (assistant duration) | ${naOrValue(d.llmMs, fmtWall)} | ${d.llmMs === null ? "not available" : pct(d.llmMs)} |`, `| Tool execution | ${naOrValue(d.toolMs, fmtWall)} | ${d.toolMs === null ? "not available" : pct(d.toolMs)} |`, `| Idle / overhead | ${fmtWall(d.idleMs)} | ${pct(d.idleMs)} |`, `| Unattributed (unmeasured durations) | ${fmtWall(d.unattributedMs)} | ${pct(d.unattributedMs)} \u2014 check the Section Support matrix below; an instrumentation gap reads as unattributed work. |`, `| **Wall clock (span)** | **${fmtWall(d.spanMs)}** | 100% |`, "", d.spanExcludedSessions > 0 ? `_Span excludes ${d.spanExcludedSessions} session(s) with unusable timestamps (sentinel-only or non-ISO); their measured durations still count above._` : "", "");
52558
52607
  return lines;
52559
52608
  }
52560
52609
  function renderPhases(derived) {
@@ -52569,12 +52618,15 @@ function renderPhases(derived) {
52569
52618
  }
52570
52619
  lines.push("| # | Phase | Started | Wall |", "| ---: | --- | --- | ---: |");
52571
52620
  derived.phases.phases.forEach((phase, i2) => {
52572
- const wallMs = Date.parse(phase.endedAt) - Date.parse(phase.startedAt);
52573
- lines.push(`| ${i2} | ${phase.name} | ${phase.startedAt} | ${Number.isNaN(wallMs) ? "n/a" : fmtWall(wallMs)} |`);
52621
+ const wallMs = phase.startedAt !== null && phase.endedAt !== null ? Date.parse(phase.endedAt) - Date.parse(phase.startedAt) : null;
52622
+ lines.push(`| ${i2} | ${phase.name} | ${phase.startedAt ?? "not available"} | ${wallMs === null ? "not available" : fmtWall(wallMs)} |`);
52574
52623
  });
52575
52624
  if (derived.phases.phases.length === 0) {
52576
52625
  lines.push("| (todo signal present but no phases extracted) | | | |");
52577
52626
  }
52627
+ if ((derived.phases.invalidPhaseCount ?? 0) > 0) {
52628
+ lines.push("", `> ${derived.phases.invalidPhaseCount} further phase(s) were excluded: their observed boundaries are out of order and must not enter elapsed-duration analysis as positive intervals.`);
52629
+ }
52578
52630
  lines.push("");
52579
52631
  return lines;
52580
52632
  }
@@ -52751,6 +52803,9 @@ function fmtTopOf(population, appliedTop) {
52751
52803
  }
52752
52804
  return population.toLocaleString("en-US");
52753
52805
  }
52806
+ function naOrValue(v, fmt) {
52807
+ return v === null ? "not available" : fmt(v);
52808
+ }
52754
52809
  function fmtWall(ms) {
52755
52810
  if (ms < 1000)
52756
52811
  return `${Math.round(ms)}ms`;
@@ -52810,9 +52865,9 @@ function renderPairingsSection(artifact) {
52810
52865
  for (const role of [...new Set(pairings.map((p) => p.role))].sort()) {
52811
52866
  const rows = pairings.filter((p) => p.role === role).sort(comparePairings);
52812
52867
  lines.push(`### role: ${role}`, "");
52813
- lines.push("| executor | agent | model | dispatches | success | escalations | cost | mean dur |", "| --- | --- | --- | ---: | ---: | ---: | ---: | ---: |");
52868
+ lines.push("| executor | agent | model | dispatches | success | unknown | escalations | cost | mean dur |", "| --- | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: |");
52814
52869
  for (const p of rows) {
52815
- lines.push(`| ${p.executor} | ${p.agent} | ${p.model ?? "n/a"} | ${p.dispatches} | ${pct(p.successRate)} | ` + `${fmtEscalations(p)} | ${usd(p.totalCostUsd)} | ${fmtDuration(p.meanDurationMs)} |`);
52870
+ lines.push(`| ${p.executor} | ${p.agent} | ${p.model ?? "n/a"} | ${p.dispatches} | ${pct(p.successRate)} | ` + `${(p.unknownOutcomes ?? 0).toString()} | ${fmtEscalations(p)} | ${usd(p.totalCostUsd)} | ${fmtDuration(p.meanDurationMs)} |`);
52816
52871
  }
52817
52872
  lines.push("");
52818
52873
  }
@@ -54281,7 +54336,7 @@ class ActionRunDao {
54281
54336
  }
54282
54337
  }
54283
54338
 
54284
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/schema/drizzle-internals.js
54339
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/schema/drizzle-internals.js
54285
54340
  function sqlExpressionToText(value) {
54286
54341
  if (typeof value !== "object" || value === null || !("queryChunks" in value)) {
54287
54342
  return;
@@ -54304,7 +54359,7 @@ function getDrizzleTableName(table3) {
54304
54359
  return String(table3[nameSym]);
54305
54360
  }
54306
54361
 
54307
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/schema/ddl.js
54362
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/schema/ddl.js
54308
54363
  function quoteIdent(name) {
54309
54364
  return `"${name.replace(/"/g, '""')}"`;
54310
54365
  }
@@ -54676,7 +54731,7 @@ var init_drizzle_zod = __esm(() => {
54676
54731
  };
54677
54732
  });
54678
54733
 
54679
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/schema/define-table.js
54734
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/schema/define-table.js
54680
54735
  function defineTable(name, columns2) {
54681
54736
  const table3 = sqliteTable(name, columns2);
54682
54737
  let insert2;
@@ -54710,7 +54765,7 @@ var init_define_table = __esm(() => {
54710
54765
  init_ddl();
54711
54766
  });
54712
54767
 
54713
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.42+88214ba569abd6d3/node_modules/@gobing-ai/ts-db/dist/schema/index.js
54768
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.45+6d1591eb73338c5d/node_modules/@gobing-ai/ts-db/dist/schema/index.js
54714
54769
  var exports_schema = {};
54715
54770
  __export(exports_schema, {
54716
54771
  text: () => text,
@@ -55332,7 +55387,7 @@ var init_dao = __esm(() => {
55332
55387
  init_workspace_dao();
55333
55388
  });
55334
55389
 
55335
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/errors.js
55390
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/errors.js
55336
55391
  var WorkflowValidationError, FSMError, RunCollisionError, WorkflowResumeError;
55337
55392
  var init_errors5 = __esm(() => {
55338
55393
  WorkflowValidationError = class WorkflowValidationError extends Error {
@@ -55367,12 +55422,12 @@ var init_errors5 = __esm(() => {
55367
55422
  };
55368
55423
  });
55369
55424
 
55370
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/event-bus/index.js
55425
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/event-bus/index.js
55371
55426
  var init_event_bus2 = __esm(() => {
55372
55427
  init_event_bus();
55373
55428
  });
55374
55429
 
55375
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/api-client.js
55430
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/api-client.js
55376
55431
  function sanitizeUrlForObservability(url2) {
55377
55432
  try {
55378
55433
  const parsed = new URL(url2);
@@ -55603,12 +55658,12 @@ var init_api_client = __esm(() => {
55603
55658
  };
55604
55659
  });
55605
55660
 
55606
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/telemetry/index.js
55661
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/telemetry/index.js
55607
55662
  var init_telemetry = __esm(() => {
55608
55663
  init_tracing2();
55609
55664
  });
55610
55665
 
55611
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/index.js
55666
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/index.js
55612
55667
  var init_dist6 = __esm(() => {
55613
55668
  init_api_client();
55614
55669
  init_event_bus2();
@@ -55616,7 +55671,7 @@ var init_dist6 = __esm(() => {
55616
55671
  init_telemetry();
55617
55672
  });
55618
55673
 
55619
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/run-lifecycle.js
55674
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/run-lifecycle.js
55620
55675
  function runtimeBuiltins(workflowName, stateOrNodeId, runId, transitionsTaken, mode) {
55621
55676
  return {
55622
55677
  workflow: workflowName,
@@ -55900,7 +55955,7 @@ var init_run_lifecycle = __esm(() => {
55900
55955
  ];
55901
55956
  });
55902
55957
 
55903
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/extension/capability-registry.js
55958
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/extension/capability-registry.js
55904
55959
  class CapabilityRegistry {
55905
55960
  kind;
55906
55961
  capabilities = new Map;
@@ -55931,7 +55986,7 @@ class CapabilityRegistry {
55931
55986
  }
55932
55987
  }
55933
55988
 
55934
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-path.js
55989
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-path.js
55935
55990
  function assertRelativeExtensionPath(path9, options = {}) {
55936
55991
  const where = options.sourceName !== undefined ? ` declared by "${options.sourceName}"` : "";
55937
55992
  if (/^([/\\]|[A-Za-z]:[/\\])/.test(path9)) {
@@ -55942,7 +55997,7 @@ function assertRelativeExtensionPath(path9, options = {}) {
55942
55997
  }
55943
55998
  }
55944
55999
 
55945
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-loader.js
56000
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-loader.js
55946
56001
  import { isAbsolute, resolve } from "path";
55947
56002
  async function loadExtensionModules(refs, options, register) {
55948
56003
  if (refs.length === 0)
@@ -55981,17 +56036,17 @@ async function loadExtensionModules(refs, options, register) {
55981
56036
  }
55982
56037
  var init_extension_loader = () => {};
55983
56038
 
55984
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/extension/index.js
56039
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/extension/index.js
55985
56040
  var init_extension = __esm(() => {
55986
56041
  init_extension_loader();
55987
56042
  });
55988
56043
 
55989
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.42+815552c3ca302057/node_modules/@gobing-ai/ts-runtime/dist/extension.js
56044
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.45+6331fb8cbb13f69c/node_modules/@gobing-ai/ts-runtime/dist/extension.js
55990
56045
  var init_extension2 = __esm(() => {
55991
56046
  init_extension();
55992
56047
  });
55993
56048
 
55994
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema.js
56049
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema.js
55995
56050
  var RESERVED_VAR_NAMES, IDENTIFIER, VarsSchema, EnvSchema, relativeExtensionPath, WorkflowExtensionsSchema, ActionDefSchema, GuardDefSchema, StateMachineWorkflowDefSchema, TransitionFlowWorkflowDefSchema, WorkflowDefSchema;
55996
56051
  var init_schema2 = __esm(() => {
55997
56052
  init_extension2();
@@ -56093,7 +56148,7 @@ var init_schema2 = __esm(() => {
56093
56148
  WorkflowDefSchema = exports_external.union([StateMachineWorkflowDefSchema, TransitionFlowWorkflowDefSchema]);
56094
56149
  });
56095
56150
 
56096
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/config.js
56151
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/config.js
56097
56152
  async function loadWorkflowDef(path9, options = {}) {
56098
56153
  return parseWorkflowDef(await loadStructuredConfig(path9, options), path9);
56099
56154
  }
@@ -56260,7 +56315,7 @@ var init_config4 = __esm(() => {
56260
56315
  RUNTIME_TEMPLATE_NAMESPACES = new Set(RUNTIME_BUILTIN_KEYS);
56261
56316
  });
56262
56317
 
56263
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/extensions.js
56318
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/extensions.js
56264
56319
  function collectWorkflowExtensions(sourceName, sourceDir, extensions) {
56265
56320
  if (extensions === undefined)
56266
56321
  return [];
@@ -56324,7 +56379,7 @@ var init_extensions = __esm(() => {
56324
56379
  init_errors5();
56325
56380
  });
56326
56381
 
56327
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/host.js
56382
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/host.js
56328
56383
  class WorkflowEngineHost {
56329
56384
  lifecycleBus;
56330
56385
  actions = new CapabilityRegistry("workflow action");
@@ -56494,7 +56549,7 @@ var init_host = __esm(() => {
56494
56549
  init_errors5();
56495
56550
  });
56496
56551
 
56497
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema-sql.js
56552
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema-sql.js
56498
56553
  var WORKFLOW_ENGINE_SCHEMA_SQL;
56499
56554
  var init_schema_sql = __esm(() => {
56500
56555
  WORKFLOW_ENGINE_SCHEMA_SQL = `
@@ -56567,7 +56622,7 @@ CREATE TABLE IF NOT EXISTS action_runs (
56567
56622
  `.trim();
56568
56623
  });
56569
56624
 
56570
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/persistence.js
56625
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/persistence.js
56571
56626
  async function applyWorkflowEngineSchema(db2) {
56572
56627
  for (const statement of WORKFLOW_ENGINE_SCHEMA_SQL.split(";")) {
56573
56628
  const sql4 = statement.trim();
@@ -56883,7 +56938,7 @@ var init_persistence = __esm(() => {
56883
56938
  init_schema_sql();
56884
56939
  });
56885
56940
 
56886
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/variables.js
56941
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/variables.js
56887
56942
  function mergeVars(workflowVars = {}, overrideVars = {}) {
56888
56943
  return { ...workflowVars, ...overrideVars };
56889
56944
  }
@@ -56943,7 +56998,7 @@ var init_variables = __esm(() => {
56943
56998
  TEMPLATE_REF = /\$\{([^}]+)\}/g;
56944
56999
  });
56945
57000
 
56946
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/action-step.js
57001
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/action-step.js
56947
57002
  async function runActionStep(action, vars, deps) {
56948
57003
  const { host, persistence, lifecycle, stateOrNodeId, runId } = deps;
56949
57004
  const resolved = resolveTemplates(action.options ?? {}, {
@@ -57007,7 +57062,7 @@ var init_action_step = __esm(() => {
57007
57062
  init_variables();
57008
57063
  });
57009
57064
 
57010
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/state-machine.js
57065
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/state-machine.js
57011
57066
  class StateMachineDriver {
57012
57067
  options;
57013
57068
  constructor(options) {
@@ -57143,7 +57198,7 @@ var init_state_machine = __esm(() => {
57143
57198
  EMPTY_OUTCOME = { outcome: "completed", result: undefined, setVars: undefined };
57144
57199
  });
57145
57200
 
57146
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/transition-flow.js
57201
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/transition-flow.js
57147
57202
  class TransitionFlowDriver {
57148
57203
  options;
57149
57204
  constructor(options) {
@@ -57262,7 +57317,7 @@ var init_transition_flow = __esm(() => {
57262
57317
  init_variables();
57263
57318
  });
57264
57319
 
57265
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/service.js
57320
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/service.js
57266
57321
  class WorkflowService {
57267
57322
  host;
57268
57323
  persistence;
@@ -57487,7 +57542,7 @@ var init_service = __esm(() => {
57487
57542
  init_variables();
57488
57543
  });
57489
57544
 
57490
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/index.js
57545
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/index.js
57491
57546
  var init_dist7 = __esm(() => {
57492
57547
  init_config4();
57493
57548
  init_extensions();
@@ -57497,7 +57552,7 @@ var init_dist7 = __esm(() => {
57497
57552
  init_service();
57498
57553
  });
57499
57554
 
57500
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.42+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/hash.js
57555
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.45+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/hash.js
57501
57556
  import { createHash as createHash3 } from "crypto";
57502
57557
  function stableJson(value) {
57503
57558
  if (Array.isArray(value)) {
@@ -57514,7 +57569,7 @@ function sha256(value) {
57514
57569
  }
57515
57570
  var init_hash = () => {};
57516
57571
 
57517
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.42+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/errors.js
57572
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.45+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/errors.js
57518
57573
  var HistoryImportError;
57519
57574
  var init_errors6 = __esm(() => {
57520
57575
  HistoryImportError = class HistoryImportError extends Error {
@@ -57527,7 +57582,7 @@ var init_errors6 = __esm(() => {
57527
57582
  };
57528
57583
  });
57529
57584
 
57530
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.42+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/schema-sql.js
57585
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.45+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/schema-sql.js
57531
57586
  var HISTORY_IMPORT_SCHEMA_SQL;
57532
57587
  var init_schema_sql2 = __esm(() => {
57533
57588
  HISTORY_IMPORT_SCHEMA_SQL = `
@@ -57535,6 +57590,9 @@ CREATE TABLE IF NOT EXISTS history_import_checkpoint (
57535
57590
  source TEXT NOT NULL,
57536
57591
  source_file TEXT NOT NULL,
57537
57592
  last_imported_line INTEGER NOT NULL DEFAULT 0,
57593
+ -- File identity (0675 R1): nullable so pre-migration rows self-heal on first read.
57594
+ source_size INTEGER,
57595
+ source_mtime_ms REAL,
57538
57596
  updated_at TEXT NOT NULL,
57539
57597
  PRIMARY KEY (source, source_file)
57540
57598
  );
@@ -57611,7 +57669,7 @@ CREATE INDEX IF NOT EXISTS idx_history_tool_call_message_hash
57611
57669
  `.trim();
57612
57670
  });
57613
57671
 
57614
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.42+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/mappers.js
57672
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.45+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/mappers.js
57615
57673
  function identityFieldMap(keys) {
57616
57674
  const map2 = {};
57617
57675
  for (const key of keys) {
@@ -57980,10 +58038,14 @@ function claudeToolResultTiming(raw) {
57980
58038
  if (toolCallId === undefined)
57981
58039
  continue;
57982
58040
  const payload = b.content ?? raw.toolUseResult;
58041
+ const toolUseResult = o2(raw.toolUseResult);
58042
+ const rawDurationMs = typeof toolUseResult.durationMs === "number" ? toolUseResult.durationMs : typeof toolUseResult.durationSeconds === "number" ? toolUseResult.durationSeconds * 1000 : undefined;
58043
+ const durationMs = typeof rawDurationMs === "number" && Number.isFinite(rawDurationMs) ? Math.round(rawDurationMs) : undefined;
57983
58044
  const resultBytes = JSON.stringify(payload ?? null)?.length ?? 2;
57984
58045
  return {
57985
58046
  toolCallId,
57986
58047
  timestampMs: timestampToEpochMs(raw.timestamp),
58048
+ durationMs,
57987
58049
  resultBytes
57988
58050
  };
57989
58051
  }
@@ -58079,6 +58141,8 @@ function codexSplit(raw, context4) {
58079
58141
  const finalInput = usageInput !== undefined ? usageInput : turnInputTokens;
58080
58142
  const finalOutput = usageOutput !== undefined ? usageOutput : turnOutputTokens;
58081
58143
  const costUsd = computeCost(finalInput, finalOutput, model);
58144
+ const usageCarrier = finalInput !== undefined || finalOutput !== undefined ? { input: finalInput ?? null, output: finalOutput ?? null, cacheRead: cacheRead ?? null } : undefined;
58145
+ const stripUsage = role === "meta" && usageCarrier !== undefined;
58082
58146
  const messageSplitIndex = entries.length;
58083
58147
  entries.push({
58084
58148
  targetTable: "history_message",
@@ -58091,9 +58155,10 @@ function codexSplit(raw, context4) {
58091
58155
  ts,
58092
58156
  duration_ms: undefined,
58093
58157
  model: model ?? null,
58094
- input_tokens: finalInput ?? null,
58095
- output_tokens: finalOutput ?? null,
58096
- cache_read_tokens: cacheRead ?? null,
58158
+ input_tokens: stripUsage ? null : finalInput ?? null,
58159
+ output_tokens: stripUsage ? null : finalOutput ?? null,
58160
+ cache_read_tokens: stripUsage ? null : cacheRead ?? null,
58161
+ ...usageCarrier !== undefined ? { _codexUsageCarrier: usageCarrier } : {},
58097
58162
  cache_write_tokens: null,
58098
58163
  cost_usd: costUsd ?? null,
58099
58164
  content_text: contentText,
@@ -58442,7 +58507,7 @@ function grokSplit(raw) {
58442
58507
  record_type: recordType,
58443
58508
  disposition: "keep",
58444
58509
  ts,
58445
- duration_ms: n2.durationMs ?? null,
58510
+ duration_ms: n2.durationMs ?? usage?.apiDurationMs ?? null,
58446
58511
  model: model ?? null,
58447
58512
  input_tokens: inputTokens ?? null,
58448
58513
  output_tokens: outputTokens ?? null,
@@ -58773,6 +58838,7 @@ var init_mappers = __esm(() => {
58773
58838
  init_zod();
58774
58839
  init_hash();
58775
58840
  MESSAGE_MAPPER_KEYS = [
58841
+ "_codexUsageCarrier",
58776
58842
  "session_id",
58777
58843
  "seq",
58778
58844
  "turn_index",
@@ -58868,7 +58934,7 @@ var init_mappers = __esm(() => {
58868
58934
  GEMINI_SCHEMA = passthroughSchema;
58869
58935
  });
58870
58936
 
58871
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.42+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/sources.js
58937
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.45+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/sources.js
58872
58938
  function firstString(...values) {
58873
58939
  for (const value of values) {
58874
58940
  if (typeof value === "string" && value.length > 0)
@@ -59025,7 +59091,7 @@ var init_sources = __esm(() => {
59025
59091
  };
59026
59092
  });
59027
59093
 
59028
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.42+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/jsonl-importer-dao.js
59094
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.45+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/jsonl-importer-dao.js
59029
59095
  function targetTableFor(table3) {
59030
59096
  if (!VALID_TABLE_NAME.test(table3)) {
59031
59097
  throw new HistoryImportError(`Invalid history ETL target table: ${table3}`, { table: table3 });
@@ -59052,24 +59118,31 @@ async function applyHistoryImportSchema(db2) {
59052
59118
  await db2.exec(sql4);
59053
59119
  }
59054
59120
  }
59055
- for (const definition of Object.values(SOURCE_DEFINITIONS)) {
59056
- await ensureTargetTables(db2, definition);
59057
- }
59058
59121
  }
59059
- async function ensureTargetTables(db2, definition) {
59060
- const tables = new Set([targetTableFor(definition.targetTable)]);
59061
- if (definition.splitConfig.mode !== "one-to-one" && definition.splitConfig.targetTable !== undefined) {
59062
- tables.add(targetTableFor(definition.splitConfig.targetTable));
59063
- }
59064
- for (const table3 of tables) {
59065
- if (TYPED_TABLE_COLUMNS[table3] !== undefined)
59066
- continue;
59122
+ async function ensureTargetTable(db2, targetTable) {
59123
+ const table3 = targetTableFor(targetTable);
59124
+ if (TYPED_TABLE_COLUMNS[table3] === undefined)
59067
59125
  await db2.exec(ETL_TABLE_DDL(table3));
59068
- }
59069
59126
  }
59070
- async function readCheckpoint(db2, source, sourceFile) {
59071
- const row = await db2.queryFirst("SELECT last_imported_line FROM history_import_checkpoint WHERE source = ? AND source_file = ?", source, sourceFile);
59072
- return row?.last_imported_line ?? 0;
59127
+ async function loadSourceCheckpoints(db2, source) {
59128
+ let rows;
59129
+ try {
59130
+ rows = await db2.queryAll("SELECT source_file, last_imported_line, source_size, source_mtime_ms FROM history_import_checkpoint WHERE source = ?", source);
59131
+ } catch (err) {
59132
+ if (!/no such column|source_size|source_mtime_ms/i.test(err.message))
59133
+ throw err;
59134
+ rows = await db2.queryAll("SELECT source_file, last_imported_line FROM history_import_checkpoint WHERE source = ?", source);
59135
+ return new Map(rows.map((row) => [row.source_file, { line: row.last_imported_line, size: null, mtimeMs: null }]));
59136
+ }
59137
+ const map2 = new Map;
59138
+ for (const row of rows) {
59139
+ map2.set(row.source_file, {
59140
+ line: row.last_imported_line,
59141
+ size: row.source_size ?? null,
59142
+ mtimeMs: row.source_mtime_ms ?? null
59143
+ });
59144
+ }
59145
+ return map2;
59073
59146
  }
59074
59147
  async function resetCheckpoints(db2, source, files) {
59075
59148
  for (const file2 of files) {
@@ -59114,14 +59187,16 @@ function ledgerInsertOp(recordHash, source, sourceFile, sourceLine, splitIndex,
59114
59187
  params: [recordHash, source, sourceFile, sourceLine, splitIndex, targetTable, timestamp(now)]
59115
59188
  };
59116
59189
  }
59117
- function checkpointUpsertOp(source, sourceFile, line, now) {
59190
+ function checkpointUpsertOp(source, sourceFile, line, now, identity5) {
59118
59191
  return {
59119
- sql: `INSERT INTO history_import_checkpoint (source, source_file, last_imported_line, updated_at)
59120
- VALUES (?, ?, ?, ?)
59192
+ sql: `INSERT INTO history_import_checkpoint (source, source_file, last_imported_line, source_size, source_mtime_ms, updated_at)
59193
+ VALUES (?, ?, ?, ?, ?, ?)
59121
59194
  ON CONFLICT(source, source_file) DO UPDATE SET
59122
59195
  last_imported_line = excluded.last_imported_line,
59196
+ source_size = excluded.source_size,
59197
+ source_mtime_ms = excluded.source_mtime_ms,
59123
59198
  updated_at = excluded.updated_at`,
59124
- params: [source, sourceFile, line, timestamp(now)]
59199
+ params: [source, sourceFile, line, identity5?.size ?? null, identity5?.mtimeMs ?? null, timestamp(now)]
59125
59200
  };
59126
59201
  }
59127
59202
  function toolCallDurationUpdateOp(recordHash, startedAt, completedAt, durationMs) {
@@ -59140,6 +59215,14 @@ function toolCallResultBytesUpdateOp(recordHash, resultBytes) {
59140
59215
  params: [resultBytes, recordHash]
59141
59216
  };
59142
59217
  }
59218
+ function codexUsageAttributionUpdateOp(recordHash, tokens) {
59219
+ return {
59220
+ sql: `UPDATE history_message
59221
+ SET input_tokens = ?, output_tokens = ?, cache_read_tokens = ?
59222
+ WHERE record_hash = ?`,
59223
+ params: [tokens.input, tokens.output, tokens.cacheRead, recordHash]
59224
+ };
59225
+ }
59143
59226
  async function ledgerExistingHashes(db2, hashes) {
59144
59227
  const existing = new Set;
59145
59228
  for (let i2 = 0;i2 < hashes.length; i2 += 200) {
@@ -59340,7 +59423,7 @@ var init_jsonl_importer_dao = __esm(() => {
59340
59423
  TYPED_IGNORED_KEYS = new Set(["_meta", "split_index"]);
59341
59424
  });
59342
59425
 
59343
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.42+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/redaction.js
59426
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.45+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/redaction.js
59344
59427
  function redactValue(value, rules = DEFAULT_REDACTION_RULES) {
59345
59428
  if (typeof value === "string") {
59346
59429
  return rules.reduce((current, rule) => current.replace(rule.pattern, rule.replacement), value);
@@ -59392,7 +59475,7 @@ var init_redaction = __esm(() => {
59392
59475
  ];
59393
59476
  });
59394
59477
 
59395
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.42+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/importer.js
59478
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.45+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/importer.js
59396
59479
  function toolCallKey(source, sessionId, callId) {
59397
59480
  return `${source}${TOOL_CALL_KEY_SEP}${sessionId}${TOOL_CALL_KEY_SEP}${callId}`;
59398
59481
  }
@@ -59425,7 +59508,6 @@ async function runJsonlImport(source, options) {
59425
59508
  const resolvedSource = definition.source;
59426
59509
  const fileSystem = options.fileSystem ?? createNodeFileSystem3();
59427
59510
  await applyHistoryImportSchema(options.db);
59428
- await ensureTargetTables(options.db, definition);
59429
59511
  const mode = options.mode ?? "incremental";
59430
59512
  const files = await discoverFiles(definition, options.roots, options.files, fileSystem, options.paths);
59431
59513
  if (mode === "full" && !options.dryRun) {
@@ -59438,11 +59520,23 @@ async function runJsonlImport(source, options) {
59438
59520
  let skippedDuplicates = 0;
59439
59521
  let unknownRecords = 0;
59440
59522
  let skippedCorruptLines = 0;
59523
+ let skippedUnchangedFiles = 0;
59441
59524
  let checkpointUpdates = 0;
59525
+ const ensuredTargetTables = new Set;
59442
59526
  const desiredHashes = new Set;
59443
59527
  const toolCallRows = new Map;
59528
+ const codexLastAssistant = new Map;
59529
+ const checkpoints = mode === "incremental" ? await loadSourceCheckpoints(options.db, resolvedSource) : undefined;
59444
59530
  for (const file2 of files) {
59445
- const checkpoint = mode === "incremental" ? await readCheckpoint(options.db, resolvedSource, file2) : 0;
59531
+ const entry = checkpoints?.get(file2);
59532
+ const checkpoint = entry?.line ?? 0;
59533
+ if (checkpoints !== undefined && entry !== undefined && entry.size !== null && entry.mtimeMs !== null) {
59534
+ const stat = await safeStat(fileSystem, file2);
59535
+ if (stat !== null && stat.size === entry.size && stat.mtimeMs === entry.mtimeMs) {
59536
+ skippedUnchangedFiles += 1;
59537
+ continue;
59538
+ }
59539
+ }
59446
59540
  let lineNumber = 0;
59447
59541
  for await (const rawLine of readLines(fileSystem, file2)) {
59448
59542
  lineNumber += 1;
@@ -59502,34 +59596,42 @@ async function runJsonlImport(source, options) {
59502
59596
  if (definition.source === "omp" || definition.source === "claude") {
59503
59597
  const assistantTs = definition.source === "omp" ? new Map : null;
59504
59598
  if (assistantTs !== null) {
59505
- for (const entry of prepared) {
59506
- if (entry.split.targetTable === "history_message" && entry.normalized.role === "assistant" && typeof entry.normalized.session_id === "string") {
59507
- assistantTs.set(`${entry.normalized.session_id}${TOOL_CALL_KEY_SEP}${entry.normalized.seq}`, timestampToEpochMs(entry.normalized.ts));
59599
+ for (const entry2 of prepared) {
59600
+ if (entry2.split.targetTable === "history_message" && entry2.normalized.role === "assistant" && typeof entry2.normalized.session_id === "string") {
59601
+ assistantTs.set(`${entry2.normalized.session_id}${TOOL_CALL_KEY_SEP}${entry2.normalized.seq}`, timestampToEpochMs(entry2.normalized.ts));
59508
59602
  }
59509
59603
  }
59510
59604
  }
59511
- for (const entry of prepared) {
59512
- const callId = entry.normalized.call_id;
59513
- if (entry.split.targetTable === "history_tool_call" && typeof callId === "string" && callId.length > 0 && typeof entry.normalized.session_id === "string") {
59514
- toolCallRows.set(toolCallKey(resolvedSource, entry.normalized.session_id, callId), {
59515
- recordHash: entry.recordHash,
59516
- messageTsMs: assistantTs?.get(`${entry.normalized.session_id}${TOOL_CALL_KEY_SEP}${entry.normalized.seq}`)
59605
+ for (const entry2 of prepared) {
59606
+ const callId = entry2.normalized.call_id;
59607
+ if (entry2.split.targetTable === "history_tool_call" && typeof callId === "string" && callId.length > 0 && typeof entry2.normalized.session_id === "string") {
59608
+ toolCallRows.set(toolCallKey(resolvedSource, entry2.normalized.session_id, callId), {
59609
+ recordHash: entry2.recordHash,
59610
+ messageTsMs: assistantTs?.get(`${entry2.normalized.session_id}${TOOL_CALL_KEY_SEP}${entry2.normalized.seq}`)
59517
59611
  });
59518
59612
  }
59519
59613
  }
59520
59614
  }
59521
59615
  const existing = await ledgerExistingHashes(options.db, prepared.map((e) => e.recordHash));
59522
- const accepted = prepared.filter((entry) => {
59523
- if (existing.has(entry.recordHash)) {
59616
+ const accepted = prepared.filter((entry2) => {
59617
+ if (existing.has(entry2.recordHash)) {
59524
59618
  skippedDuplicates += 1;
59525
59619
  return false;
59526
59620
  }
59527
59621
  return true;
59528
59622
  });
59623
+ if (!options.dryRun) {
59624
+ for (const entry2 of accepted) {
59625
+ if (ensuredTargetTables.has(entry2.split.targetTable))
59626
+ continue;
59627
+ await ensureTargetTable(options.db, entry2.split.targetTable);
59628
+ ensuredTargetTables.add(entry2.split.targetTable);
59629
+ }
59630
+ }
59529
59631
  const recordHashBySplitIndex = new Map(prepared.map((e) => [e.splitIndex, e.recordHash]));
59530
59632
  const ops = [];
59531
- for (const entry of accepted) {
59532
- const { split, splitIndex, normalized, recordHash } = entry;
59633
+ for (const entry2 of accepted) {
59634
+ const { split, splitIndex, normalized, recordHash } = entry2;
59533
59635
  if (normalized.disposition === "unknown") {
59534
59636
  unknownRecords += 1;
59535
59637
  }
@@ -59542,8 +59644,23 @@ async function runJsonlImport(source, options) {
59542
59644
  }
59543
59645
  }
59544
59646
  if (!options.dryRun) {
59647
+ const carrier = normalized._codexUsageCarrier;
59648
+ delete normalized._codexUsageCarrier;
59649
+ if (carrier !== undefined && typeof normalized.session_id === "string" && codexLastAssistant.has(normalized.session_id)) {
59650
+ const lastHash = codexLastAssistant.get(normalized.session_id);
59651
+ if (lastHash !== undefined) {
59652
+ ops.push(codexUsageAttributionUpdateOp(lastHash, {
59653
+ input: carrier.input,
59654
+ output: carrier.output,
59655
+ cacheRead: carrier.cacheRead
59656
+ }));
59657
+ }
59658
+ }
59545
59659
  ops.push(recordInsertOp(split.targetTable, recordHash, file2, lineNumber, splitIndex, normalized, options.now));
59546
59660
  ops.push(ledgerInsertOp(recordHash, resolvedSource, file2, lineNumber, splitIndex, split.targetTable, options.now));
59661
+ if (definition.source === "codex" && split.targetTable === "history_message" && normalized.role === "assistant" && typeof normalized.session_id === "string") {
59662
+ codexLastAssistant.set(normalized.session_id, recordHash);
59663
+ }
59547
59664
  }
59548
59665
  importedRecords += 1;
59549
59666
  }
@@ -59551,7 +59668,7 @@ async function runJsonlImport(source, options) {
59551
59668
  if (definition.source === "omp") {
59552
59669
  const timing = ompToolResultTiming(raw);
59553
59670
  if (timing !== null) {
59554
- const resultEntry = prepared.find((entry) => entry.split.targetTable === "history_message" && entry.normalized.role === "toolresult");
59671
+ const resultEntry = prepared.find((entry2) => entry2.split.targetTable === "history_message" && entry2.normalized.role === "toolresult");
59555
59672
  const sessionId = resultEntry?.normalized.session_id;
59556
59673
  if (typeof sessionId === "string") {
59557
59674
  let pending = toolCallRows.get(toolCallKey(resolvedSource, sessionId, timing.toolCallId));
@@ -59570,7 +59687,7 @@ async function runJsonlImport(source, options) {
59570
59687
  if (definition.source === "claude") {
59571
59688
  const timing = claudeToolResultTiming(raw);
59572
59689
  if (timing !== null) {
59573
- const resultEntry = prepared.find((entry) => entry.split.targetTable === "history_message");
59690
+ const resultEntry = prepared.find((entry2) => entry2.split.targetTable === "history_message");
59574
59691
  const sessionId = resultEntry?.normalized.session_id;
59575
59692
  if (typeof sessionId === "string") {
59576
59693
  let pending = toolCallRows.get(toolCallKey(resolvedSource, sessionId, timing.toolCallId));
@@ -59579,6 +59696,9 @@ async function runJsonlImport(source, options) {
59579
59696
  }
59580
59697
  if (pending !== undefined) {
59581
59698
  ops.push(toolCallResultBytesUpdateOp(pending.recordHash, timing.resultBytes));
59699
+ if (timing.durationMs !== undefined) {
59700
+ ops.push(toolCallDurationUpdateOp(pending.recordHash, null, null, timing.durationMs));
59701
+ }
59582
59702
  }
59583
59703
  }
59584
59704
  }
@@ -59589,6 +59709,20 @@ async function runJsonlImport(source, options) {
59589
59709
  checkpointUpdates += 1;
59590
59710
  }
59591
59711
  }
59712
+ if (!options.dryRun && mode === "incremental") {
59713
+ const statAfter = await safeStat(fileSystem, file2);
59714
+ const identityDegraded = entry !== undefined && entry.size === null && entry.mtimeMs === null;
59715
+ const identityChanged = entry !== undefined && (entry.size !== (statAfter?.size ?? null) || entry.mtimeMs !== (statAfter?.mtimeMs ?? null));
59716
+ if (statAfter !== null && !identityDegraded && (entry === undefined || identityChanged)) {
59717
+ await options.db.batch([
59718
+ checkpointUpsertOp(resolvedSource, file2, Math.max(lineNumber, checkpoint), options.now, {
59719
+ size: statAfter.size,
59720
+ mtimeMs: statAfter.mtimeMs
59721
+ })
59722
+ ]);
59723
+ checkpointUpdates += 1;
59724
+ }
59725
+ }
59592
59726
  }
59593
59727
  }
59594
59728
  let reconciliation;
@@ -59603,6 +59737,7 @@ async function runJsonlImport(source, options) {
59603
59737
  importedRecords,
59604
59738
  skippedDuplicates,
59605
59739
  skippedCorruptLines,
59740
+ skippedUnchangedFiles,
59606
59741
  unknownRecords,
59607
59742
  parseErrors,
59608
59743
  validationErrors,
@@ -59716,6 +59851,14 @@ function matchesPattern(path9, patterns) {
59716
59851
  return path9.endsWith(pattern.replace(/^\*/, ""));
59717
59852
  });
59718
59853
  }
59854
+ async function safeStat(fileSystem, file2) {
59855
+ try {
59856
+ const stat = await fileSystem.stat(file2);
59857
+ return stat === null ? null : { size: stat.size, mtimeMs: stat.mtimeMs };
59858
+ } catch {
59859
+ return null;
59860
+ }
59861
+ }
59719
59862
  async function* readLines(fileSystem, file2) {
59720
59863
  if (fileSystem.readFileStream) {
59721
59864
  yield* fileSystem.readFileStream(file2);
@@ -59736,7 +59879,7 @@ var init_importer = __esm(() => {
59736
59879
  init_sources();
59737
59880
  });
59738
59881
 
59739
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.42+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/opencode-importer.js
59882
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.45+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/opencode-importer.js
59740
59883
  async function runOpenCodeImport(options) {
59741
59884
  const paths = options.paths ?? ambientRuntimePaths2();
59742
59885
  const sourceDatabase = options.sourceDatabase ?? joinPath2(paths.home, ".local/share/opencode/opencode.db");
@@ -59839,6 +59982,7 @@ async function runOpenCodeImport(options) {
59839
59982
  importedRecords,
59840
59983
  skippedDuplicates,
59841
59984
  skippedCorruptLines: 0,
59985
+ skippedUnchangedFiles: 0,
59842
59986
  unknownRecords: 0,
59843
59987
  parseErrors,
59844
59988
  validationErrors,
@@ -59975,6 +60119,7 @@ function emptyResult(mode) {
59975
60119
  importedRecords: 0,
59976
60120
  skippedDuplicates: 0,
59977
60121
  skippedCorruptLines: 0,
60122
+ skippedUnchangedFiles: 0,
59978
60123
  unknownRecords: 0,
59979
60124
  parseErrors: [],
59980
60125
  validationErrors: [],
@@ -59991,7 +60136,7 @@ var init_opencode_importer = __esm(() => {
59991
60136
  init_redaction();
59992
60137
  });
59993
60138
 
59994
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.42+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/index.js
60139
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.45+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/index.js
59995
60140
  var init_dist8 = __esm(() => {
59996
60141
  init_importer();
59997
60142
  init_mappers();
@@ -60000,7 +60145,7 @@ var init_dist8 = __esm(() => {
60000
60145
  init_sources();
60001
60146
  });
60002
60147
 
60003
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/extensions.js
60148
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/extensions.js
60004
60149
  function collectExtensions(sourceName, sourceDir, extensions) {
60005
60150
  if (extensions === undefined)
60006
60151
  return [];
@@ -60014,7 +60159,7 @@ function collectExtensions(sourceName, sourceDir, extensions) {
60014
60159
  }
60015
60160
  var init_extensions2 = () => {};
60016
60161
 
60017
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/types.js
60162
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/types.js
60018
60163
  function createFinding(rule, message, filePath, extras = {}) {
60019
60164
  return {
60020
60165
  ruleId: rule.id,
@@ -60085,7 +60230,7 @@ var init_types3 = __esm(() => {
60085
60230
  });
60086
60231
  });
60087
60232
 
60088
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/loader.js
60233
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/loader.js
60089
60234
  async function loadPreset(name, options) {
60090
60235
  const merged = await buildMergedRoots(options.roots.map((root) => resolvePath4(root)), options.fileSystem);
60091
60236
  const presetPath = findMergedPreset(merged, name);
@@ -60300,7 +60445,7 @@ var init_loader2 = __esm(() => {
60300
60445
  FIX_MODE_AUTHORITY = { none: 0, suggest: 1, auto: 2 };
60301
60446
  });
60302
60447
 
60303
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/test-stub-fixer.js
60448
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/test-stub-fixer.js
60304
60449
  function normalizeFindingPath(filePath) {
60305
60450
  if (!filePath || isAbsolutePath2(filePath))
60306
60451
  return null;
@@ -60365,7 +60510,7 @@ var init_test_stub_fixer = __esm(() => {
60365
60510
  realFileSystem = createNodeFileSystem3();
60366
60511
  });
60367
60512
 
60368
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/fixers.js
60513
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/fixers.js
60369
60514
  function registerBuiltinFixers(host, exec) {
60370
60515
  const regexFixer = new RegexFixerProvider;
60371
60516
  const pathFixer = new PathFixerProvider;
@@ -60568,7 +60713,7 @@ var init_fixers = __esm(() => {
60568
60713
  };
60569
60714
  });
60570
60715
 
60571
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/agents/shims.js
60716
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/agents/shims.js
60572
60717
  function getAgentSessionCapability(agent) {
60573
60718
  return AGENT_SESSION_CAPABILITY[agent];
60574
60719
  }
@@ -60718,11 +60863,13 @@ var init_shims = __esm(() => {
60718
60863
  name: "antigravity-cli",
60719
60864
  command: "agy",
60720
60865
  tier: 1,
60721
- aliases: ["antigravity"],
60866
+ aliases: ["antigravity", "agy"],
60722
60867
  getHelpCommand: () => ({ command: "agy", args: ["--help"] }),
60723
60868
  getVersionCommand: () => ({ command: "agy", args: ["--version"] }),
60724
60869
  getPromptCommand: (options) => {
60725
- const args = ["-p", options.input ?? ""];
60870
+ const args = ["-p", options.input ?? "", "--dangerously-skip-permissions"];
60871
+ if (options.workspace !== undefined)
60872
+ args.push("--add-dir", options.workspace);
60726
60873
  const hasSession = options.sessionId !== undefined || options.sessionDir !== undefined;
60727
60874
  if (hasSession) {
60728
60875
  if (options.sessionId !== undefined)
@@ -60860,7 +61007,7 @@ var init_shims = __esm(() => {
60860
61007
  ALIAS_TO_CANONICAL = Object.fromEntries(Object.values(AGENT_SHIMS).flatMap((shim) => (shim.aliases ?? []).map((alias3) => [alias3, shim.name])));
60861
61008
  });
60862
61009
 
60863
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/identity.js
61010
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/identity.js
60864
61011
  function buildIdentityPreamble(ctx) {
60865
61012
  const sections = [
60866
61013
  `You are agent \`${ctx.agentId}\` (${ctx.agentType}) in workspace \`${ctx.workspace}\`.`
@@ -60936,7 +61083,7 @@ var init_identity = __esm(() => {
60936
61083
  init_dist5();
60937
61084
  });
60938
61085
 
60939
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/slash-command.js
61086
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/slash-command.js
60940
61087
  function isClaudeStyleSlashCommand(input) {
60941
61088
  return SLASH_COMMAND_RE.test(input);
60942
61089
  }
@@ -60964,7 +61111,7 @@ var init_slash_command = __esm(() => {
60964
61111
  SLASH_COMMAND_RE = /^\/([a-zA-Z0-9._-]+):([a-zA-Z0-9._-]+)(\s.*)?$/;
60965
61112
  });
60966
61113
 
60967
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/ai-runner.js
61114
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/ai-runner.js
60968
61115
  function buildCorrelationEnv(correlation) {
60969
61116
  return {
60970
61117
  [AGENT_RUN_ID_ENV]: correlation.runId,
@@ -61075,7 +61222,10 @@ function hasIdentityOptions(options) {
61075
61222
  return options.purpose !== undefined || options.systemPrompt !== undefined || options.taskId !== undefined || options.peers !== undefined && options.peers.length > 0;
61076
61223
  }
61077
61224
  function buildAgentCommand(agent, promptOptions, context4) {
61078
- return getAgentShim(agent).getPromptCommand(applyIdentityPreamble(agent, promptOptions, context4));
61225
+ return getAgentShim(agent).getPromptCommand({
61226
+ workspace: context4.workspace,
61227
+ ...applyIdentityPreamble(agent, promptOptions, context4)
61228
+ });
61079
61229
  }
61080
61230
  function applyIdentityPreamble(agent, promptOptions, context4) {
61081
61231
  if (!hasIdentityOptions(promptOptions))
@@ -61102,7 +61252,7 @@ var init_ai_runner = __esm(() => {
61102
61252
  init_slash_command();
61103
61253
  });
61104
61254
 
61105
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/agent-detector.js
61255
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/agent-detector.js
61106
61256
  class AgentDetector {
61107
61257
  runner;
61108
61258
  timeout;
@@ -61178,7 +61328,7 @@ var init_agent_detector = __esm(() => {
61178
61328
  VERSION_PATTERN = /(?<version>\d+\.\d+(?:\.\d+)?)/;
61179
61329
  });
61180
61330
 
61181
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/agent-spec.js
61331
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/agent-spec.js
61182
61332
  function validateAgentId(id) {
61183
61333
  if (!/^[a-z][a-z0-9_-]{1,63}$/.test(id)) {
61184
61334
  throw new ValueError(`Invalid agent id "${id}": expected 2-64 chars, lowercase alphanumeric, "_" or "-"`);
@@ -61277,7 +61427,7 @@ var init_agent_spec = __esm(() => {
61277
61427
  };
61278
61428
  });
61279
61429
 
61280
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/agents/auth-shims.js
61430
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/agents/auth-shims.js
61281
61431
  function isNonEmpty(value) {
61282
61432
  return value !== undefined && value.trim().length > 0;
61283
61433
  }
@@ -61402,7 +61552,7 @@ var init_auth_shims = __esm(() => {
61402
61552
  };
61403
61553
  });
61404
61554
 
61405
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/model-health-probe.js
61555
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/model-health-probe.js
61406
61556
  class ModelHealthProbeRegistry {
61407
61557
  probes = new Map;
61408
61558
  register(providerPrefix, probe) {
@@ -61510,7 +61660,7 @@ var init_model_health_probe = __esm(() => {
61510
61660
  };
61511
61661
  });
61512
61662
 
61513
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/doctor-runner.js
61663
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/doctor-runner.js
61514
61664
  class DoctorRunner {
61515
61665
  detector;
61516
61666
  runner;
@@ -61521,6 +61671,7 @@ class DoctorRunner {
61521
61671
  executors;
61522
61672
  probeRegistry;
61523
61673
  probeTimeoutMs;
61674
+ probeAuth;
61524
61675
  constructor(options = {}) {
61525
61676
  this.runner = options.runner ?? new AiRunner;
61526
61677
  this.detector = options.agentDetector ?? new AgentDetector({ runner: this.runner });
@@ -61531,6 +61682,7 @@ class DoctorRunner {
61531
61682
  this.executors = options.executors ?? [];
61532
61683
  this.probeTimeoutMs = options.probeTimeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS;
61533
61684
  this.probeRegistry = options.probeRegistry ?? this.createDefaultRegistry();
61685
+ this.probeAuth = options.probeAuth ?? true;
61534
61686
  }
61535
61687
  createDefaultRegistry() {
61536
61688
  const registry2 = new ModelHealthProbeRegistry;
@@ -61559,7 +61711,8 @@ class DoctorRunner {
61559
61711
  const byName = new Map(detected.map((agent) => [agent.name, agent]));
61560
61712
  const results = [];
61561
61713
  for (const executor of this.executors) {
61562
- const agentDetected = byName.get(executor.agent) ?? {
61714
+ const canonical = resolveAgentName(executor.agent);
61715
+ const agentDetected = byName.get(executor.agent) ?? (canonical !== undefined ? byName.get(canonical) : undefined) ?? {
61563
61716
  name: executor.agent,
61564
61717
  installed: false,
61565
61718
  version: null,
@@ -61616,7 +61769,7 @@ class DoctorRunner {
61616
61769
  const canonical = resolveAgentName(detected.name) ?? null;
61617
61770
  const tier = canonical !== null && TIER2_AGENTS.has(canonical) ? 2 : 1;
61618
61771
  this.logger.debug("checking agent", { agent: detected.name, installed: detected.installed, tier });
61619
- const authenticated = detected.installed && canonical !== null ? await isAuthenticated(canonical, {
61772
+ const authenticated = !this.probeAuth ? "unknown" : detected.installed && canonical !== null ? await isAuthenticated(canonical, {
61620
61773
  runner: this.runner,
61621
61774
  env: this.env,
61622
61775
  fileSystem: this.fs,
@@ -61647,15 +61800,15 @@ var init_doctor_runner = __esm(() => {
61647
61800
  init_model_health_probe();
61648
61801
  });
61649
61802
 
61650
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/events.js
61803
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/events.js
61651
61804
  var init_events = () => {};
61652
61805
 
61653
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/messages.js
61806
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/messages.js
61654
61807
  function formatMessage(msg) {
61655
61808
  return `[task from=${msg.fromId ?? "operator"} id=${msg.id}] ${msg.body}`;
61656
61809
  }
61657
61810
 
61658
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/team-agent-process.js
61811
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/team-agent-process.js
61659
61812
  import { Buffer as Buffer5 } from "buffer";
61660
61813
 
61661
61814
  class TeamAgentProcess {
@@ -61789,7 +61942,7 @@ var init_team_agent_process = __esm(() => {
61789
61942
  init_dist5();
61790
61943
  });
61791
61944
 
61792
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/team-orchestrator.js
61945
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/team-orchestrator.js
61793
61946
  class TeamOrchestrator {
61794
61947
  configDir;
61795
61948
  inbox;
@@ -61930,7 +62083,7 @@ var init_team_orchestrator = __esm(() => {
61930
62083
  init_team_agent_process();
61931
62084
  });
61932
62085
 
61933
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/index.js
62086
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.45+e6176d7fb9f2801d/node_modules/@gobing-ai/ts-ai-runner/dist/index.js
61934
62087
  var exports_dist3 = {};
61935
62088
  __export(exports_dist3, {
61936
62089
  validateAgentId: () => validateAgentId,
@@ -61983,7 +62136,7 @@ var init_dist9 = __esm(() => {
61983
62136
  init_team_orchestrator();
61984
62137
  });
61985
62138
 
61986
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/config-access.js
62139
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/config-access.js
61987
62140
  function stringArray(value) {
61988
62141
  return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : undefined;
61989
62142
  }
@@ -62021,7 +62174,7 @@ function parseInlineFlags(source) {
62021
62174
  return { flags, rest: source.slice(match[0].length) };
62022
62175
  }
62023
62176
 
62024
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/glob-match.js
62177
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/glob-match.js
62025
62178
  function matchesAny(path9, patterns) {
62026
62179
  if (patterns === undefined || patterns.length === 0)
62027
62180
  return true;
@@ -62069,7 +62222,7 @@ function escapeRegExp(value) {
62069
62222
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
62070
62223
  }
62071
62224
 
62072
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-discovery.js
62225
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-discovery.js
62073
62226
  async function discoverFiles2(options) {
62074
62227
  const fs3 = options.fs ?? createNodeFileSystem3();
62075
62228
  const allFiles = await walkDir2(options.workdir, fs3, DEFAULT_EXCLUDES);
@@ -62100,12 +62253,12 @@ var init_file_discovery = __esm(() => {
62100
62253
  DEFAULT_EXCLUDES = new Set([".git", "node_modules", "dist", ".coverage", ".astro", ".wrangler"]);
62101
62254
  });
62102
62255
 
62103
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-utils.js
62256
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-utils.js
62104
62257
  var init_file_utils = __esm(() => {
62105
62258
  init_file_discovery();
62106
62259
  });
62107
62260
 
62108
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/agent-detection-evaluator.js
62261
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/agent-detection-evaluator.js
62109
62262
  class AgentDetectionEvaluator {
62110
62263
  detector;
62111
62264
  constructor(detector = new AgentDetector) {
@@ -62133,7 +62286,7 @@ var init_agent_detection_evaluator = __esm(() => {
62133
62286
  init_file_utils();
62134
62287
  });
62135
62288
 
62136
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/coverage-gate-evaluator.js
62289
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/coverage-gate-evaluator.js
62137
62290
  class CoverageGateEvaluator {
62138
62291
  constructor() {}
62139
62292
  async evaluate(rule, context4) {
@@ -62217,7 +62370,7 @@ var init_coverage_gate_evaluator = __esm(() => {
62217
62370
  init_file_utils();
62218
62371
  });
62219
62372
 
62220
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/exit-code-evaluator.js
62373
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/exit-code-evaluator.js
62221
62374
  class ExitCodeEvaluator {
62222
62375
  executor;
62223
62376
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -62253,7 +62406,7 @@ var init_exit_code_evaluator = __esm(() => {
62253
62406
  init_file_utils();
62254
62407
  });
62255
62408
 
62256
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/forbidden-import-evaluator.js
62409
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/forbidden-import-evaluator.js
62257
62410
  class ForbiddenImportEvaluator {
62258
62411
  constructor() {}
62259
62412
  async evaluate(rule, context4) {
@@ -62334,7 +62487,7 @@ var init_forbidden_import_evaluator = __esm(() => {
62334
62487
  init_file_utils();
62335
62488
  });
62336
62489
 
62337
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/import-boundary-evaluator.js
62490
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/import-boundary-evaluator.js
62338
62491
  class ImportBoundaryEvaluator {
62339
62492
  async evaluate(rule, context4) {
62340
62493
  const config4 = rule.evaluator.config ?? {};
@@ -62427,7 +62580,7 @@ var init_import_boundary_evaluator = __esm(() => {
62427
62580
  init_file_utils();
62428
62581
  });
62429
62582
 
62430
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/path-evaluator.js
62583
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/path-evaluator.js
62431
62584
  class PathEvaluator {
62432
62585
  constructor() {}
62433
62586
  async evaluate(rule, context4) {
@@ -62488,7 +62641,7 @@ var init_path_evaluator = __esm(() => {
62488
62641
  init_file_utils();
62489
62642
  });
62490
62643
 
62491
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/regex-evaluator.js
62644
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/regex-evaluator.js
62492
62645
  class RegexEvaluator {
62493
62646
  constructor() {}
62494
62647
  async evaluate(rule, context4) {
@@ -62566,7 +62719,7 @@ var init_regex_evaluator = __esm(() => {
62566
62719
  init_file_utils();
62567
62720
  });
62568
62721
 
62569
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/ripgrep-evaluator.js
62722
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/ripgrep-evaluator.js
62570
62723
  class RipgrepEvaluator {
62571
62724
  executor;
62572
62725
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -62659,7 +62812,7 @@ var init_ripgrep_evaluator = __esm(() => {
62659
62812
  init_file_utils();
62660
62813
  });
62661
62814
 
62662
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/schema-artifact-evaluator.js
62815
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/schema-artifact-evaluator.js
62663
62816
  class SchemaArtifactEvaluator {
62664
62817
  constructor() {}
62665
62818
  async evaluate(rule, context4) {
@@ -62737,7 +62890,7 @@ var init_schema_artifact_evaluator = __esm(() => {
62737
62890
  init_file_utils();
62738
62891
  });
62739
62892
 
62740
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/secrets-scanner-evaluator.js
62893
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/secrets-scanner-evaluator.js
62741
62894
  class SecretsScannerEvaluator {
62742
62895
  constructor() {}
62743
62896
  async evaluate(rule, context4) {
@@ -62805,7 +62958,7 @@ var init_secrets_scanner_evaluator = __esm(() => {
62805
62958
  ALL_CATEGORIES = Object.keys(BUILTIN_PATTERNS);
62806
62959
  });
62807
62960
 
62808
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/sg-evaluator.js
62961
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/sg-evaluator.js
62809
62962
  class SgEvaluator {
62810
62963
  executor;
62811
62964
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -62902,7 +63055,7 @@ var init_sg_evaluator = __esm(() => {
62902
63055
  init_file_utils();
62903
63056
  });
62904
63057
 
62905
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/resolvers/test-path-resolver.js
63058
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/resolvers/test-path-resolver.js
62906
63059
  class TypeScriptTestPathResolver {
62907
63060
  name = "typescript";
62908
63061
  constructor() {}
@@ -62985,7 +63138,7 @@ function testify(rel) {
62985
63138
  return `${dir}test_${base2}`;
62986
63139
  }
62987
63140
 
62988
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/test-location-evaluator.js
63141
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/test-location-evaluator.js
62989
63142
  class TestLocationEvaluator {
62990
63143
  resolvers;
62991
63144
  constructor(resolvers) {
@@ -63060,7 +63213,7 @@ var init_test_location_evaluator = __esm(() => {
63060
63213
  TYPESCRIPT_FALLBACK = new TypeScriptTestPathResolver;
63061
63214
  });
63062
63215
 
63063
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/tsdoc-export-evaluator.js
63216
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/tsdoc-export-evaluator.js
63064
63217
  class TsdocExportEvaluator {
63065
63218
  constructor() {}
63066
63219
  async evaluate(rule, context4) {
@@ -63145,7 +63298,7 @@ var init_tsdoc_export_evaluator = __esm(() => {
63145
63298
  };
63146
63299
  });
63147
63300
 
63148
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/json.js
63301
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/json.js
63149
63302
  class JsonFormatter {
63150
63303
  constructor() {}
63151
63304
  format(result) {
@@ -63153,7 +63306,7 @@ class JsonFormatter {
63153
63306
  }
63154
63307
  }
63155
63308
 
63156
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/text.js
63309
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/text.js
63157
63310
  class TextFormatter {
63158
63311
  constructor() {}
63159
63312
  format(result) {
@@ -63167,7 +63320,7 @@ class TextFormatter {
63167
63320
  }
63168
63321
  }
63169
63322
 
63170
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/builtins.js
63323
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/builtins.js
63171
63324
  function registerBuiltins(host, executor) {
63172
63325
  const path9 = new PathEvaluator;
63173
63326
  host.evaluators.register("regex", new RegexEvaluator, "builtin");
@@ -63207,7 +63360,7 @@ var init_builtins = __esm(() => {
63207
63360
  init_tsdoc_export_evaluator();
63208
63361
  });
63209
63362
 
63210
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/rule-engine-host.js
63363
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/rule-engine-host.js
63211
63364
  class RuleEngineHost {
63212
63365
  evaluators;
63213
63366
  formatters;
@@ -63224,7 +63377,7 @@ var init_rule_engine_host = __esm(() => {
63224
63377
  init_extension2();
63225
63378
  });
63226
63379
 
63227
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/engine.js
63380
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/engine.js
63228
63381
  class RuleEngine {
63229
63382
  host;
63230
63383
  events;
@@ -63410,7 +63563,7 @@ var init_engine = __esm(() => {
63410
63563
  init_types3();
63411
63564
  });
63412
63565
 
63413
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/bundled-rules.js
63566
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/bundled-rules.js
63414
63567
  async function bundledRulesRoot() {
63415
63568
  if (cachedRoot2 !== undefined)
63416
63569
  return cachedRoot2;
@@ -63461,7 +63614,7 @@ var init_bundled_rules = __esm(() => {
63461
63614
  init_dist5();
63462
63615
  });
63463
63616
 
63464
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/db-adapter.js
63617
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/db-adapter.js
63465
63618
  class DbRulePersistenceAdapter {
63466
63619
  db;
63467
63620
  constructor(db2) {
@@ -63495,7 +63648,7 @@ class DbRulePersistenceAdapter {
63495
63648
  }
63496
63649
  }
63497
63650
 
63498
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/schema.js
63651
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/schema.js
63499
63652
  var RULE_ENGINE_SCHEMA_SQL = `
63500
63653
  CREATE TABLE IF NOT EXISTS rule_runs (
63501
63654
  id TEXT PRIMARY KEY,
@@ -63541,10 +63694,10 @@ CREATE TABLE IF NOT EXISTS rule_eval_runs (
63541
63694
  CREATE INDEX IF NOT EXISTS idx_rule_eval_runs_run_id ON rule_eval_runs (run_id);
63542
63695
  `;
63543
63696
 
63544
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/index.js
63697
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/index.js
63545
63698
  var init_persistence2 = () => {};
63546
63699
 
63547
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/index.js
63700
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.45+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/index.js
63548
63701
  var init_dist10 = __esm(() => {
63549
63702
  init_extensions2();
63550
63703
  init_loader2();
@@ -63626,6 +63779,13 @@ async function applyCliMigrations(adapter, migrations = CLI_MIGRATIONS) {
63626
63779
  await adapter.exec(statement);
63627
63780
  }
63628
63781
  }
63782
+ if ((migration.id === "0024_spur_cli_history_checkpoint_identity" || migration.id === "0025_spur_cli_history_checkpoint_identity_mtime") && !await tableExists(adapter, "history_import_checkpoint")) {
63783
+ await adapter.run('INSERT INTO "__spur_cli_migrations" (id, applied_at) VALUES (?, ?)', [
63784
+ migration.id,
63785
+ Date.now()
63786
+ ]);
63787
+ continue;
63788
+ }
63629
63789
  const addColumnGuard = migration.addColumnIfMissing;
63630
63790
  const shouldApplySql = addColumnGuard === undefined || !await columnExists(adapter, addColumnGuard.table, addColumnGuard.column);
63631
63791
  const tsNullableSkip = migration.id === "0016_spur_cli_history_message_ts_nullable" && (!await tableExists(adapter, "history_message") || !await columnNotNull(adapter, "history_message", "ts"));
@@ -64033,6 +64193,27 @@ FROM history_message;
64033
64193
  DROP TABLE history_message;
64034
64194
  ALTER TABLE history_message_rebuild RENAME TO history_message;
64035
64195
  CREATE INDEX IF NOT EXISTS idx_history_message_provenance_run ON history_message (provenance, run_id);
64196
+ `, AGENT_INSTANCES_MIGRATION_ID_DRAFT = "0026_spur_cli_agent_instances", AGENT_INSTANCES_DDL_DRAFT = `
64197
+ CREATE TABLE IF NOT EXISTS agent_instances (
64198
+ spec_id TEXT PRIMARY KEY,
64199
+ team_id TEXT,
64200
+ member_key TEXT NOT NULL,
64201
+ executor TEXT,
64202
+ role TEXT,
64203
+ workspace TEXT NOT NULL,
64204
+ status TEXT NOT NULL CHECK (status IN ('stopped', 'running', 'exited', 'errored')),
64205
+ pid INTEGER,
64206
+ run_id TEXT,
64207
+ generation INTEGER,
64208
+ tags TEXT NOT NULL DEFAULT '[]',
64209
+ config TEXT NOT NULL DEFAULT '{}',
64210
+ created_at INTEGER NOT NULL,
64211
+ updated_at INTEGER NOT NULL
64212
+ );
64213
+
64214
+ CREATE INDEX IF NOT EXISTS idx_agent_instances_role ON agent_instances (role);
64215
+ CREATE INDEX IF NOT EXISTS idx_agent_instances_executor ON agent_instances (executor);
64216
+ CREATE INDEX IF NOT EXISTS idx_agent_instances_team ON agent_instances (team_id);
64036
64217
  `, CLI_MIGRATIONS, CLI_MIGRATION_FILE_MARKER = "_spur_cli_";
64037
64218
  var init_migrations = __esm(() => {
64038
64219
  init_dist7();
@@ -64124,11 +64305,21 @@ ${HISTORY_RUN_SESSION_SCHEMA_SQL}
64124
64305
  {
64125
64306
  id: "0023_spur_cli_history_message_request_id_idx",
64126
64307
  sql: HISTORY_MESSAGE_REQUEST_ID_INDEX_SCHEMA_SQL
64308
+ },
64309
+ {
64310
+ id: "0024_spur_cli_history_checkpoint_identity",
64311
+ sql: "ALTER TABLE history_import_checkpoint ADD COLUMN source_size INTEGER",
64312
+ addColumnIfMissing: { table: "history_import_checkpoint", column: "source_size" }
64313
+ },
64314
+ {
64315
+ id: "0025_spur_cli_history_checkpoint_identity_mtime",
64316
+ sql: "ALTER TABLE history_import_checkpoint ADD COLUMN source_mtime_ms REAL",
64317
+ addColumnIfMissing: { table: "history_import_checkpoint", column: "source_mtime_ms" }
64127
64318
  }
64128
64319
  ];
64129
64320
  });
64130
64321
 
64131
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/job-queue/db-job-queue.js
64322
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/job-queue/db-job-queue.js
64132
64323
  function queueLogger() {
64133
64324
  if (!_queueLogger)
64134
64325
  _queueLogger = getLogger2("job-queue");
@@ -64431,7 +64622,7 @@ var init_db_job_queue = __esm(() => {
64431
64622
  init_tracing2();
64432
64623
  });
64433
64624
 
64434
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/job-queue-db.js
64625
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/job-queue-db.js
64435
64626
  var exports_job_queue_db = {};
64436
64627
  __export(exports_job_queue_db, {
64437
64628
  DBQueueConsumer: () => DBQueueConsumer,
@@ -66682,6 +66873,7 @@ __export(exports_src, {
66682
66873
  stageContextLayerSchema: () => stageContextLayerSchema,
66683
66874
  stageArtifactSchema: () => stageArtifactSchema,
66684
66875
  stablePrefixesMatch: () => stablePrefixesMatch,
66876
+ specRole: () => specRole,
66685
66877
  sourceSummary: () => sourceSummary,
66686
66878
  sessionWatermarks: () => sessionWatermarks,
66687
66879
  sessionToolDurations: () => sessionToolDurations,
@@ -66909,7 +67101,9 @@ __export(exports_src, {
66909
67101
  ActionRunDao: () => ActionRunDao,
66910
67102
  AUTHORITY_LANES: () => AUTHORITY_LANES,
66911
67103
  ARTIFACT_DIRECTIONS: () => ARTIFACT_DIRECTIONS,
66912
- ARTIFACT_ARRAY_CLASSIFICATION: () => ARTIFACT_ARRAY_CLASSIFICATION
67104
+ ARTIFACT_ARRAY_CLASSIFICATION: () => ARTIFACT_ARRAY_CLASSIFICATION,
67105
+ AGENT_INSTANCES_MIGRATION_ID_DRAFT: () => AGENT_INSTANCES_MIGRATION_ID_DRAFT,
67106
+ AGENT_INSTANCES_DDL_DRAFT: () => AGENT_INSTANCES_DDL_DRAFT
66913
67107
  });
66914
67108
  var init_src2 = __esm(() => {
66915
67109
  init_db2();
@@ -67610,6 +67804,83 @@ var init_workflow_run_log_sink = __esm(() => {
67610
67804
  ];
67611
67805
  });
67612
67806
 
67807
+ // ../../packages/app/src/services/agent-instance-store.ts
67808
+ function teamTagOf(spec) {
67809
+ for (const tag of spec.tags ?? []) {
67810
+ if (tag.startsWith("team:"))
67811
+ return tag.slice("team:".length);
67812
+ }
67813
+ return null;
67814
+ }
67815
+ function memberKeyOf(specId, teamId) {
67816
+ const prefix = teamId === null ? null : `${teamId}-`;
67817
+ return prefix !== null && specId.startsWith(prefix) ? specId.slice(prefix.length) : specId;
67818
+ }
67819
+ function createFileAgentInstanceStore(listAgentSpecs) {
67820
+ async function all() {
67821
+ const specs = await listAgentSpecs();
67822
+ return specs.map((spec) => {
67823
+ const teamId = teamTagOf(spec);
67824
+ return {
67825
+ specId: spec.id,
67826
+ teamId,
67827
+ memberKey: memberKeyOf(spec.id, teamId),
67828
+ role: specRole(spec),
67829
+ executor: spec.executor ?? null,
67830
+ workspace: spec.workspace,
67831
+ tags: spec.tags,
67832
+ config: spec.config,
67833
+ status: "stopped",
67834
+ pid: null,
67835
+ runId: null,
67836
+ generation: null,
67837
+ createdAt: 0,
67838
+ updatedAt: 0
67839
+ };
67840
+ });
67841
+ }
67842
+ return {
67843
+ bySpecId: async (specId) => (await all()).find((i2) => i2.specId === specId) ?? null,
67844
+ byRole: async (role) => (await all()).filter((i2) => i2.role === role),
67845
+ byExecutor: async (executor) => (await all()).filter((i2) => i2.executor === executor)
67846
+ };
67847
+ }
67848
+ async function resolveAgentSelector(listAgentSpecs, agentConfig, selector) {
67849
+ const store = createFileAgentInstanceStore(listAgentSpecs);
67850
+ return resolveRoleTarget(store, selector, AGENT_ROLE_NAMES, agentConfig?.executors?.map((e) => e.name) ?? []);
67851
+ }
67852
+ async function resolveRoleTarget(store, selector, roles, executorNames) {
67853
+ const vocabulary = [...roles, ...executorNames];
67854
+ if (!vocabulary.includes(selector)) {
67855
+ return {
67856
+ ok: false,
67857
+ code: "unknown_selector",
67858
+ message: `--role "${selector}" is neither a known Layer-1 role nor an executor name (accepted: ${vocabulary.join(", ")})`
67859
+ };
67860
+ }
67861
+ const matches = roles.includes(selector) ? await store.byRole(selector) : await store.byExecutor(selector);
67862
+ const candidates = matches.map((m) => m.specId);
67863
+ if (matches.length === 0) {
67864
+ return {
67865
+ ok: false,
67866
+ code: "selector_unmatched",
67867
+ message: `"${selector}" resolves to count=0 instances (looked up as ${roles.includes(selector) ? "role" : "executor"}; candidates: none)`
67868
+ };
67869
+ }
67870
+ if (matches.length > 1) {
67871
+ return {
67872
+ ok: false,
67873
+ code: "selector_ambiguous",
67874
+ message: `"${selector}" resolves to count=${matches.length} instances (candidates: ${candidates.join(", ")}) \u2014 address one by its full spec id`
67875
+ };
67876
+ }
67877
+ return { ok: true, specId: candidates[0] ?? "", count: 1, candidates };
67878
+ }
67879
+ var init_agent_instance_store = __esm(() => {
67880
+ init_src();
67881
+ init_src2();
67882
+ });
67883
+
67613
67884
  // ../../packages/app/src/services/event-bridge.ts
67614
67885
  function bridgeEventBus(serverBus) {
67615
67886
  const bridge = {
@@ -67660,12 +67931,21 @@ function extractStatusCodes(text4) {
67660
67931
  }
67661
67932
  return codes;
67662
67933
  }
67934
+ function permissionFailureEvidence(text4) {
67935
+ if (!PERMISSION_PATTERNS.some((pattern) => pattern.test(text4)))
67936
+ return;
67937
+ const line = text4.split(`
67938
+ `).map((candidate) => candidate.trim()).find((candidate) => PERMISSION_PATTERNS.some((pattern) => pattern.test(candidate)));
67939
+ return line !== undefined && line !== "" ? line : undefined;
67940
+ }
67663
67941
  function classifyDispatch(result) {
67664
67942
  if (result.signal !== undefined)
67665
67943
  return "timeout";
67666
67944
  if (result.exitCode === 0)
67667
67945
  return;
67668
67946
  const text4 = `${result.stderr ?? ""} ${result.stdout ?? ""}`;
67947
+ if (permissionFailureEvidence(text4) !== undefined)
67948
+ return;
67669
67949
  const statusCodes = extractStatusCodes(text4);
67670
67950
  for (const rule of FAILURE_RULES) {
67671
67951
  const statusMatch = rule.statusCodes?.some((code) => statusCodes.has(code)) ?? false;
@@ -67675,7 +67955,7 @@ function classifyDispatch(result) {
67675
67955
  }
67676
67956
  return;
67677
67957
  }
67678
- var FAILURE_RULES, HTTP_STATUS_PATTERN;
67958
+ var FAILURE_RULES, PERMISSION_PATTERNS, HTTP_STATUS_PATTERN;
67679
67959
  var init_failure_classification = __esm(() => {
67680
67960
  FAILURE_RULES = [
67681
67961
  {
@@ -67719,14 +67999,23 @@ var init_failure_classification = __esm(() => {
67719
67999
  {
67720
68000
  provider: "ollama",
67721
68001
  signal: "resource-exhaustion",
67722
- patterns: [/(?:out of tokens?|token[_ -]?(?:limit|budget)|context[_ -]?(?:length|window)|maximum context)/i]
68002
+ patterns: [/(?:out of tokens?|token[_ -]?(?:limit|budget)|context[_ -](?:length|window)|maximum context)/i]
67723
68003
  },
67724
68004
  {
67725
68005
  provider: "gemini",
67726
68006
  signal: "resource-exhaustion",
67727
- patterns: [/(?:usage[_ -]?limit|quota|overloaded|resource exhausted)/i]
68007
+ patterns: [
68008
+ /(?:usage[_ -]?limit|quota (?:exceeded|exhausted|reached)|exceeded[^.\n]{0,40}quota|overloaded|resource exhausted)/i
68009
+ ]
67728
68010
  }
67729
68011
  ];
68012
+ PERMISSION_PATTERNS = [
68013
+ /\bEPERM\b/,
68014
+ /\bEACCES\b/,
68015
+ /operation not permitted/i,
68016
+ /permission denied/i,
68017
+ /FS_PERMISSION_DENIED/i
68018
+ ];
67730
68019
  HTTP_STATUS_PATTERN = /(?:\bstatus|\bhttp(?:\/\d(?:\.\d)?)?|\bapi error)\s*(?:code\s*)?[:(=-]?\s*(\d{3})\b/gi;
67731
68020
  });
67732
68021
 
@@ -67954,6 +68243,7 @@ var init_run_session_observer = __esm(() => {
67954
68243
  });
67955
68244
 
67956
68245
  // ../../packages/app/src/services/agent-service.ts
68246
+ import { createHash as createHash6 } from "crypto";
67957
68247
  import { homedir as homedir4 } from "os";
67958
68248
  import { isatty as isatty3 } from "tty";
67959
68249
 
@@ -67973,7 +68263,7 @@ class AgentService {
67973
68263
  })
67974
68264
  });
67975
68265
  const detector = deps?.detector ?? new AgentDetector({ runner });
67976
- const doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ agentDetector: detector, runner, env: this.ctx.env });
68266
+ const doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ agentDetector: detector, runner, env: this.ctx.env, probeAuth: false });
67977
68267
  return this.resolveAgent(flags, doctorRunner);
67978
68268
  }
67979
68269
  async list(opts, deps) {
@@ -67989,32 +68279,88 @@ class AgentService {
67989
68279
  }
67990
68280
  async doctor(args, deps) {
67991
68281
  const executors = this.ctx.agentConfig?.executors;
67992
- const doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ env: this.ctx.env, executors });
68282
+ const now2 = deps?.now ?? (() => Date.now());
68283
+ const fileSystem = deps?.fileSystem ?? createNodeFileSystem3(this.ctx.cwd);
67993
68284
  if (this.ctx.rolesSource === "fallback" && !args.json) {
67994
68285
  this.ctx.output.error("agent.roles: no config layer defines a table \u2014 built-in DEFAULT_AGENT_ROLES fallback in effect");
67995
68286
  }
68287
+ const runnerExecutors = args.probeHealth ? executors : executors?.map(({ name, agent }) => ({ name, agent }));
68288
+ const fingerprint2 = executorFingerprint(executors);
68289
+ let cacheInfo = { hit: false, ageMs: null, path: DOCTOR_CACHE_REL };
68290
+ const cacheOn = deps?.fileSystem !== undefined || deps?.doctorRunner === undefined;
68291
+ const serveCached = cacheOn && !args.probeHealth && !args.forceRefresh ? readFreshDoctorCache(fileSystem, fingerprint2, now2) : null;
68292
+ let doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ env: this.ctx.env, executors: runnerExecutors, probeAuth: false });
67996
68293
  if (args.agent === undefined) {
68294
+ if (serveCached !== null) {
68295
+ cacheInfo = { hit: true, ageMs: serveCached.ageMs, path: DOCTOR_CACHE_REL };
68296
+ return this.renderDoctor(serveCached.results, executors, args.json, undefined, cacheInfo);
68297
+ }
67997
68298
  const results2 = await doctorRunner.runAll();
67998
- return this.renderDoctor(results2, executors, args.json, args.agent);
68299
+ if (cacheOn && !args.probeHealth) {
68300
+ const writeErr = await writeDoctorCacheFile(fileSystem, fingerprint2, results2, now2);
68301
+ if (writeErr !== null) {
68302
+ this.ctx.output.error(`Warning: could not update ${DOCTOR_CACHE_REL}: ${writeErr}`);
68303
+ }
68304
+ }
68305
+ return this.renderDoctor(results2, executors, args.json, undefined, cacheInfo);
67999
68306
  }
68000
68307
  const roleDef = this.ctx.roles?.get(args.agent);
68001
68308
  if (roleDef !== undefined) {
68309
+ if (serveCached !== null && roleCoveredByCache(serveCached.results, executors, roleDef.tier)) {
68310
+ cacheInfo = { hit: true, ageMs: serveCached.ageMs, path: DOCTOR_CACHE_REL };
68311
+ doctorRunner = cachedDoctorRunner(serveCached.results);
68312
+ }
68002
68313
  const resolved = await this.resolveRole(args.agent, roleDef.tier, doctorRunner);
68314
+ const results2 = await doctorRunner.runAll();
68315
+ const rows = buildDoctorRows(results2, executors, this.ctx.roles);
68316
+ const rowByName = new Map(rows.map((row) => [row.executor, row]));
68317
+ const executorsConfigured = this.ctx.agentConfig?.executors ?? [];
68318
+ const ladderRows = cheapestEligibleExecutors(executorsConfigured, roleDef.tier).map((e) => rowByName.get(e.name)).filter((row) => row !== undefined);
68003
68319
  if (!resolved.ok) {
68004
68320
  if (args.json) {
68005
68321
  this.ctx.output.write(toJson({ error: { code: "agent-resolution", message: resolved.message } }));
68006
68322
  } else {
68007
- this.ctx.output.error(resolved.message);
68323
+ this.ctx.output.error(renderRoleLadder(args.agent, roleDef.tier, ladderRows, undefined));
68008
68324
  }
68009
68325
  return resolved.exitCode;
68010
68326
  }
68011
- const results2 = [await doctorRunner.runOne(resolved.executor ?? resolved.agent)];
68012
- return this.renderDoctor(results2, executors, args.json, resolved.executor ?? resolved.agent);
68327
+ const electedName = resolved.executor ?? resolved.agent;
68328
+ if (args.json) {
68329
+ const ordered = [
68330
+ ...ladderRows.filter((row) => row.executor === electedName),
68331
+ ...ladderRows.filter((row) => row.executor !== electedName)
68332
+ ];
68333
+ const entries = ordered.map((row) => {
68334
+ const result = results2.find((r) => r.agent === row.executor);
68335
+ return {
68336
+ ...withoutAuthenticated(result),
68337
+ capabilityTier: row.capabilityTier,
68338
+ model: row.model,
68339
+ roles: row.roles,
68340
+ elected: row.elected
68341
+ };
68342
+ });
68343
+ this.ctx.output.write(toJson({ agents: entries, rolesSource: this.ctx.rolesSource ?? "config", cache: cacheInfo }));
68344
+ return 0;
68345
+ }
68346
+ this.ctx.output.write(renderRoleLadder(args.agent, roleDef.tier, ladderRows, electedName));
68347
+ this.appendCacheNote(cacheInfo, args.json);
68348
+ return 0;
68349
+ }
68350
+ const cachedSelectorRow = serveCached?.results.find((r) => r.agent === args.agent);
68351
+ if (cachedSelectorRow !== undefined) {
68352
+ cacheInfo = { hit: true, ageMs: serveCached?.ageMs ?? null, path: DOCTOR_CACHE_REL };
68353
+ return this.renderDoctor([cachedSelectorRow], executors, args.json, args.agent, cacheInfo);
68013
68354
  }
68014
68355
  const results = [await doctorRunner.runOne(args.agent)];
68015
- return this.renderDoctor(results, executors, args.json, args.agent);
68356
+ return this.renderDoctor(results, executors, args.json, args.agent, cacheInfo);
68016
68357
  }
68017
- renderDoctor(results, executors, json3, agent) {
68358
+ appendCacheNote(cache2, json3) {
68359
+ if (json3 || !cache2.hit || cache2.ageMs === null)
68360
+ return;
68361
+ this.ctx.output.write(`\xB7 cached ${Math.round(cache2.ageMs / 1000)}s ago (${cache2.path}) \u2014 --force-refresh to re-detect`);
68362
+ }
68363
+ renderDoctor(results, executors, json3, agent, cache2) {
68018
68364
  const modelByExecutor = new Map((executors ?? []).filter((e) => e.model !== undefined).map((e) => [e.name, e.model]));
68019
68365
  for (const result of results) {
68020
68366
  if (result.modelStatus && (result.modelStatus.status === "quota_exhausted" || result.modelStatus.status === "unavailable")) {
@@ -68023,16 +68369,23 @@ class AgentService {
68023
68369
  }
68024
68370
  }
68025
68371
  if (json3) {
68026
- const executorByName = new Map((executors ?? []).map((e) => [e.name, e]));
68027
- const rows = results.map((result) => {
68028
- const executor = executorByName.get(result.agent) ?? { name: result.agent, agent: result.agent };
68029
- return { ...result, capabilityTier: getExecutorTier(executor) };
68372
+ const rows = buildDoctorRows(results, executors, this.ctx.roles);
68373
+ const entries = rows.map((row, i2) => {
68374
+ const result = results[i2];
68375
+ return {
68376
+ ...withoutAuthenticated(result),
68377
+ capabilityTier: row.capabilityTier,
68378
+ model: row.model,
68379
+ roles: row.roles,
68380
+ elected: row.elected
68381
+ };
68030
68382
  });
68031
- this.ctx.output.write(toJson({ agents: rows, rolesSource: this.ctx.rolesSource ?? "config" }));
68032
- } else if (agent !== undefined) {
68033
- this.ctx.output.write(renderDoctorDetail(results[0] ?? null));
68383
+ const cacheField = cache2 ?? { hit: false, ageMs: null, path: DOCTOR_CACHE_REL };
68384
+ this.ctx.output.write(toJson({ agents: entries, rolesSource: this.ctx.rolesSource ?? "config", cache: cacheField }));
68034
68385
  } else {
68035
- this.ctx.output.write(renderDoctorTable(results));
68386
+ const rows = buildDoctorRows(results, executors, this.ctx.roles);
68387
+ this.ctx.output.write(agent !== undefined ? renderDoctorDetail(rows[0] ?? null) : renderDoctorTable(rows));
68388
+ this.appendCacheNote(cache2 ?? { hit: false, ageMs: null, path: DOCTOR_CACHE_REL }, false);
68036
68389
  }
68037
68390
  return results.some((result) => !result.usable && result.tier === 1) ? 1 : 0;
68038
68391
  }
@@ -68138,7 +68491,7 @@ class AgentService {
68138
68491
  ...invokeBridge !== undefined ? { processEvents: invokeBridge } : {}
68139
68492
  });
68140
68493
  const detector = deps?.detector ?? new AgentDetector({ runner });
68141
- const doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ agentDetector: detector, runner, env: this.ctx.env });
68494
+ const doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ agentDetector: detector, runner, env: this.ctx.env, probeAuth: false });
68142
68495
  const resolved = await this.resolveAgent(flags, doctorRunner);
68143
68496
  if (!resolved.ok) {
68144
68497
  return { ok: false, exitCode: resolved.exitCode, message: resolved.message };
@@ -68437,11 +68790,16 @@ class AgentService {
68437
68790
  };
68438
68791
  }
68439
68792
  async resolveAgent(flags, doctorRunner, exclude) {
68440
- const raw = stringFlag(flags, "agent", "auto");
68793
+ const raw = stringFlag(flags, "agent", "inline");
68441
68794
  if (raw === "auto")
68442
68795
  return this.resolveAgentAuto(flags, doctorRunner, exclude);
68443
68796
  if (raw === "inline") {
68444
- return { ok: false, exitCode: 2, message: AGENT_INLINE_HEADLESS_MESSAGE };
68797
+ const res = await this.resolveAgentAuto(flags, doctorRunner, exclude);
68798
+ if (res.ok) {
68799
+ const target = res.role !== undefined ? `${res.executor ?? res.agent} via role/${res.tier ?? res.role}` : res.executor ?? res.agent;
68800
+ this.ctx.output.error(`--agent inline requested on a headless surface (no host session); resolved ${target} \u2014 substituted tier resolution`);
68801
+ }
68802
+ return res;
68445
68803
  }
68446
68804
  return this.resolvePinned(raw, flags, doctorRunner, exclude);
68447
68805
  }
@@ -68911,6 +69269,64 @@ class AgentService {
68911
69269
  function toJson(value) {
68912
69270
  return JSON.stringify(value, null, 2);
68913
69271
  }
69272
+ function executorFingerprint(executors) {
69273
+ const lines = [...executors ?? []].sort((a2, b) => a2.name.localeCompare(b.name)).map((e) => `${e.name}|${e.agent}|${e.model ?? ""}|${getExecutorTier(e)}`);
69274
+ return createHash6("sha256").update(lines.join(`
69275
+ `)).digest("hex");
69276
+ }
69277
+ function readFreshDoctorCache(fileSystem, fingerprint2, now2) {
69278
+ try {
69279
+ const path9 = fileSystem.resolve(DOCTOR_CACHE_REL);
69280
+ if (fileSystem.exists(path9) !== true)
69281
+ return null;
69282
+ const parsed = JSON.parse(fileSystem.readFile(path9));
69283
+ if (parsed === null || typeof parsed !== "object" || parsed.schemaVersion !== 1 || typeof parsed.fingerprint !== "string" || typeof parsed.capturedAt !== "string" || !Array.isArray(parsed.results)) {
69284
+ return null;
69285
+ }
69286
+ if (parsed.fingerprint !== fingerprint2)
69287
+ return null;
69288
+ const ageMs = now2() - Date.parse(parsed.capturedAt);
69289
+ if (!Number.isFinite(ageMs) || ageMs < 0 || ageMs >= DOCTOR_CACHE_TTL_MS)
69290
+ return null;
69291
+ return { results: parsed.results, ageMs };
69292
+ } catch {
69293
+ return null;
69294
+ }
69295
+ }
69296
+ async function writeDoctorCacheFile(fileSystem, fingerprint2, results, now2) {
69297
+ try {
69298
+ const path9 = fileSystem.resolve(DOCTOR_CACHE_REL);
69299
+ const tmp = `${path9}.tmp`;
69300
+ const body = {
69301
+ schemaVersion: 1,
69302
+ fingerprint: fingerprint2,
69303
+ capturedAt: new Date(now2()).toISOString(),
69304
+ results: [...results]
69305
+ };
69306
+ await fileSystem.writeFile(tmp, JSON.stringify(body));
69307
+ await fileSystem.rename(tmp, path9);
69308
+ return null;
69309
+ } catch (err) {
69310
+ return err instanceof Error ? err.message : String(err);
69311
+ }
69312
+ }
69313
+ function roleCoveredByCache(results, executors, tier) {
69314
+ const needed = cheapestEligibleExecutors(executors ?? [], tier).map((e) => e.name);
69315
+ return needed.every((name) => results.some((r) => r.agent === name));
69316
+ }
69317
+ function cachedDoctorRunner(results) {
69318
+ const runAll = () => Promise.resolve([...results]);
69319
+ const runOne = (agent) => {
69320
+ const row = results.find((r) => r.agent === agent);
69321
+ return Promise.resolve(row ?? {
69322
+ agent,
69323
+ usable: false,
69324
+ tier: 3,
69325
+ error: "not covered by cache"
69326
+ });
69327
+ };
69328
+ return { runAll, runOne };
69329
+ }
68914
69330
  function traceSafePrompt(prompt) {
68915
69331
  const trimmed = prompt.trim();
68916
69332
  if (!TRACE_SAFE_SLASH_COMMAND.test(trimmed)) {
@@ -68961,17 +69377,43 @@ function _resetAgentServiceShimsForTest() {
68961
69377
  warnedBareBinary.clear();
68962
69378
  warnedAgentDefaultExecutor.clear();
68963
69379
  }
68964
- function renderAuth(authenticated) {
68965
- if (authenticated === "authenticated")
68966
- return "yes";
68967
- if (authenticated === "unauthenticated")
68968
- return "no";
68969
- return "?";
69380
+ function buildDoctorRows(results, executors, roles) {
69381
+ const executorByName = new Map((executors ?? []).map((e) => [e.name, e]));
69382
+ const joined = results.map((result) => {
69383
+ const executor = executorByName.get(result.agent) ?? { name: result.agent, agent: result.agent };
69384
+ return { result, capabilityTier: getExecutorTier(executor), model: executor.model ?? null };
69385
+ });
69386
+ const usableByName = new Set(joined.filter((j) => j.result.usable).map((j) => j.result.agent));
69387
+ const elections = new Map;
69388
+ if (roles !== undefined && executors !== undefined && executors.length > 0) {
69389
+ for (const [roleId, roleDef] of roles) {
69390
+ const winner = cheapestEligibleExecutors(executors, roleDef.tier).find((e) => usableByName.has(e.name));
69391
+ if (winner !== undefined)
69392
+ elections.set(roleId, winner.name);
69393
+ }
69394
+ }
69395
+ return joined.map(({ result, capabilityTier, model }) => ({
69396
+ executor: result.agent,
69397
+ agentBinary: executorByName.get(result.agent)?.agent ?? result.agent,
69398
+ usable: result.usable,
69399
+ tier: result.tier,
69400
+ capabilityTier,
69401
+ model,
69402
+ roles: roles ? [...roles].filter(([, rd]) => isTierEligible(capabilityTier, rd.tier)).map(([id]) => id) : [],
69403
+ elected: [...elections].filter(([, executorName]) => executorName === result.agent).map(([id]) => id),
69404
+ version: result.version,
69405
+ error: result.error,
69406
+ modelStatus: result.modelStatus
69407
+ }));
68970
69408
  }
68971
- function renderModelStatus(status) {
68972
- if (status === null || status === undefined)
69409
+ function renderRolesCell(row) {
69410
+ if (!row.usable || row.roles.length === 0)
68973
69411
  return "\u2014";
68974
- return status.status;
69412
+ return row.roles.map((id) => row.elected.includes(id) ? `${id}*` : id).join(",");
69413
+ }
69414
+ function withoutAuthenticated(row) {
69415
+ const { authenticated: _drop, ...rest } = row;
69416
+ return rest;
68975
69417
  }
68976
69418
  function renderDoctorTable(results) {
68977
69419
  const dash = "\u2014";
@@ -68980,31 +69422,57 @@ function renderDoctorTable(results) {
68980
69422
  return {
68981
69423
  glyph: usable ? "\u2713" : "\u2717",
68982
69424
  state: usable ? "usable" : "missing",
68983
- agent: result.agent,
68984
- tier: String(result.tier),
69425
+ executor: result.executor,
69426
+ agentBinary: result.agentBinary,
69427
+ model: result.model ?? dash,
69428
+ tier: String(result.capabilityTier),
68985
69429
  version: result.version ?? dash,
68986
- model: renderModelStatus(result.modelStatus)
69430
+ roles: renderRolesCell(result)
68987
69431
  };
68988
69432
  });
68989
69433
  const header = {
68990
69434
  glyph: " ",
68991
69435
  state: "STATUS",
68992
- agent: "AGENT",
69436
+ executor: "EXECUTOR",
69437
+ agentBinary: "AGENT",
69438
+ model: "MODEL",
68993
69439
  tier: "TIER",
68994
69440
  version: "VERSION",
68995
- model: "MODEL"
69441
+ roles: "ROLES"
68996
69442
  };
68997
69443
  const all = [header, ...rows];
68998
69444
  const width = (key) => Math.max(...all.map((row) => row[key].length));
68999
69445
  const wState = width("state");
69000
- const wAgent = width("agent");
69446
+ const wExecutor = width("executor");
69447
+ const wAgent = width("agentBinary");
69448
+ const wModel = width("model");
69001
69449
  const wTier = width("tier");
69002
69450
  const wVersion = width("version");
69003
- const line = (row) => `${row.glyph} ${row.state.padEnd(wState)} ${row.agent.padEnd(wAgent)} ${row.tier.padEnd(wTier)} ${row.version.padEnd(wVersion)} ${row.model}`.trimEnd();
69451
+ const line = (row) => `${row.glyph} ${row.state.padEnd(wState)} ${row.executor.padEnd(wExecutor)} ${row.agentBinary.padEnd(wAgent)} ${row.model.padEnd(wModel)} ${row.tier.padEnd(wTier)} ${row.version.padEnd(wVersion)} ${row.roles}`.trimEnd();
69004
69452
  const usableCount = rows.filter((row) => row.state === "usable").length;
69005
- const missingTier1 = results.filter((result) => !result.usable && result.tier === 1).length;
69006
- const footer = missingTier1 > 0 ? `${usableCount} usable, ${missingTier1} missing (tier-1)` : `${usableCount} usable, ${rows.length - usableCount} missing`;
69007
- return [line(header), ...rows.map(line), "", footer].join(`
69453
+ const missing = rows.length - usableCount;
69454
+ const footerLines = [
69455
+ `${usableCount} usable, ${missing} missing`,
69456
+ ...results.some((result) => result.elected.length > 0) ? ["(* = elected executor for that role)"] : []
69457
+ ];
69458
+ return [line(header), ...rows.map(line), "", ...footerLines].join(`
69459
+ `);
69460
+ }
69461
+ function renderRoleLadder(role, roleTier, ladder, electedExecutor) {
69462
+ const lines = [`${role} (min tier ${roleTier}) \u2014 eligible ladder`, ""];
69463
+ if (ladder.length === 0) {
69464
+ lines.push("(no eligible executor)", "");
69465
+ }
69466
+ const wName = Math.max(...ladder.map((row) => row.executor.length));
69467
+ for (const row of ladder) {
69468
+ const glyph = row.usable ? "\u2713" : "\u2717";
69469
+ const status = row.usable ? "usable" : "missing";
69470
+ const note = row.executor === electedExecutor ? "ELECTED" : row.usable ? "eligible" : row.error ?? "not installed";
69471
+ lines.push(`${glyph} ${row.executor.padEnd(wName)} ${status}${note.length > 0 ? ` ${note}` : ""}`);
69472
+ }
69473
+ const usableCount = ladder.filter((row) => row.usable).length;
69474
+ lines.push("", `${ladder.length} eligible, ${usableCount} usable, elected: ${electedExecutor ?? "none"}`);
69475
+ return lines.join(`
69008
69476
  `);
69009
69477
  }
69010
69478
  function renderDoctorDetail(result) {
@@ -69012,12 +69480,13 @@ function renderDoctorDetail(result) {
69012
69480
  return "No result.";
69013
69481
  const lines = [];
69014
69482
  const glyph = result.usable ? "\u2713" : "\u2717";
69015
- lines.push(`${glyph} ${result.agent} (tier ${result.tier})`);
69483
+ lines.push(`${glyph} ${result.executor} (${result.capabilityTier})`);
69484
+ lines.push(` agent: ${result.agentBinary}`);
69016
69485
  lines.push(` status: ${result.usable ? "usable" : "missing"}`);
69017
69486
  lines.push(` version: ${result.version ?? "\u2014"}`);
69018
- lines.push(` auth: ${renderAuth(result.authenticated)}`);
69487
+ lines.push(` pinned: ${result.model ?? "\u2014"}`);
69019
69488
  if (result.modelStatus) {
69020
- lines.push(` model: ${result.modelStatus.status}`);
69489
+ lines.push(` health: ${result.modelStatus.status}`);
69021
69490
  lines.push(` checked: ${result.modelStatus.checkedAt}`);
69022
69491
  if (result.modelStatus.detail) {
69023
69492
  lines.push(` detail: ${result.modelStatus.detail}`);
@@ -69080,10 +69549,11 @@ function buildRoutingAttribution(result) {
69080
69549
  ...result.role !== undefined ? { role: result.role } : {},
69081
69550
  tier: tier ?? "unknown",
69082
69551
  executor: executor ?? result.agent,
69083
- source: result.source
69552
+ source: result.source,
69553
+ ...result.model !== undefined ? { model: result.model } : {}
69084
69554
  };
69085
69555
  }
69086
- var AGENT_INLINE_HEADLESS_MESSAGE = "--agent inline requires a host session: this surface is headless and never dispatches inline runs (no fallback to agent.default). Use 'auto', a role, or an executor name.", PidObservingProcessExecutor, RolePropagatingProcessExecutor, TRACE_SAFE_SLASH_COMMAND, TRACE_SAFE_SLASH_TOKEN, SENSITIVE_FLAG, SENSITIVE_INLINE_FLAG, warnedBareBinary, warnedAgentDefaultExecutor;
69556
+ var PidObservingProcessExecutor, RolePropagatingProcessExecutor, DOCTOR_CACHE_REL = ".spur/run/agent-doctor.json", DOCTOR_CACHE_TTL_MS = 60000, TRACE_SAFE_SLASH_COMMAND, TRACE_SAFE_SLASH_TOKEN, SENSITIVE_FLAG, SENSITIVE_INLINE_FLAG, warnedBareBinary, warnedAgentDefaultExecutor;
69087
69557
  var init_agent_service = __esm(() => {
69088
69558
  init_src2();
69089
69559
  init_dist9();
@@ -71095,13 +71565,13 @@ function classifyExternalEvidence(body) {
71095
71565
  }
71096
71566
  return out;
71097
71567
  }
71098
- function extractSubjectTokens(row, excludeCitation) {
71568
+ function extractSubjectTokens(row) {
71099
71569
  const tokens = new Set;
71100
71570
  const ROW_METADATA = new Set(["met", "partial", "unmet", "n/a", "na", "pass", "fail", "todo", "done"]);
71101
71571
  const excluded = new Set;
71102
- if (excludeCitation !== undefined && excludeCitation !== "") {
71103
- excluded.add(excludeCitation.toLowerCase());
71104
- excluded.add(excludeCitation.replace(/:(\d+)(?:-(\d+))?$/, "").toLowerCase());
71572
+ for (const anchor of extractBacktickLineAnchors(row)) {
71573
+ excluded.add(anchor.raw.toLowerCase());
71574
+ excluded.add(anchor.path.toLowerCase());
71105
71575
  }
71106
71576
  for (const m of row.matchAll(/`([^`]+)`/g)) {
71107
71577
  const t = m[1]?.trim();
@@ -71147,6 +71617,13 @@ function citedLinesNameSubject(subjectTokens, cited) {
71147
71617
  const isRowId = (t) => /^(r|ac)-?\d+$/.test(t);
71148
71618
  return subjectTokens.every(isRowId);
71149
71619
  }
71620
+ function claimsOpen(line, id) {
71621
+ return new RegExp(`\\bR${id}\\b[^.;]{0,80}?\\b(?:${OPEN_CLAIM_WORDS})\\b`, "i").test(line) || new RegExp(`\\b(?:${OPEN_CLAIM_WORDS})\\b[^.;]{0,80}?\\bR${id}\\b`, "i").test(line);
71622
+ }
71623
+ function claimsDone(line, id) {
71624
+ const word = `(?<!not |never )(?:${DONE_CLAIM_WORDS})`;
71625
+ return new RegExp(`\\bR${id}\\b[^.;]{0,80}?\\b${word}\\b`, "i").test(line) || new RegExp(`\\b${word}\\b[^.;]{0,80}?\\bR${id}\\b`, "i").test(line);
71626
+ }
71150
71627
  function extractPathSubjectTokens(path9) {
71151
71628
  const basename4 = path9.split("/").pop() ?? "";
71152
71629
  const stem = basename4.replace(/\.[^.]+$/, "");
@@ -71188,7 +71665,7 @@ function hasSolutionFileLineCitation(body) {
71188
71665
  const hasFileLine = /`[^`]+?:\d+(-\d+)?`/.test(body) || /[^\s`]\.\w+:\d+/.test(body);
71189
71666
  return hasFileLine || hasAdjacentFileLineColumns(body);
71190
71667
  }
71191
- var TESTING_VERDICT_STUB_RE, EXTERNAL_EVIDENCE_RE, TaskCheckService;
71668
+ var TESTING_VERDICT_STUB_RE, EXTERNAL_EVIDENCE_RE, ANCHOR_WINDOW_LINES = 20, OPEN_CLAIM_WORDS = "remains open|still open|pending|unfinished|unimplemented|not implemented|outstanding|todo", DONE_CLAIM_WORDS = "done|landed|implemented|completed|shipped|closed|resolved|fixed", TaskCheckService;
71192
71669
  var init_task_check = __esm(() => {
71193
71670
  init_src2();
71194
71671
  init_planning_check_base();
@@ -71397,17 +71874,50 @@ var init_task_check = __esm(() => {
71397
71874
  message: `${sectionName} is required at status '${status}' but is still placeholder-only \u2014 run \`spur task record <wbs>\` to fill it from the verdict artifact, or author it directly`
71398
71875
  });
71399
71876
  }
71400
- const testBody = doc2.getSection("Testing");
71401
- if (testBody !== null && !isPlaceholderBody(testBody)) {
71402
- const hasCoverage = /coverage|\u2265\d+%|\d+\.\d+%|N\/A/i.test(testBody);
71403
- if (!hasCoverage) {
71404
- findings.push({
71405
- layer: "L3",
71406
- code: FINDING_CODES.L3_TESTING_COVERAGE,
71407
- severity: "warning",
71408
- section: "Testing",
71409
- message: "Testing should include numeric coverage claim or N/A"
71410
- });
71877
+ const checkboxBody = doc2.getSection("Requirements");
71878
+ if (checkboxBody !== null && !isPlaceholderBody(checkboxBody)) {
71879
+ const checked = new Set;
71880
+ const unchecked = new Set;
71881
+ for (const cbLine of checkboxBody.split(`
71882
+ `)) {
71883
+ const m = /^\s*[-*]\s*\[([ xX])\]\s*[`*_]{0,2}R(\d+)\b/.exec(cbLine);
71884
+ if (m === null)
71885
+ continue;
71886
+ (m[1]?.toLowerCase() === "x" ? checked : unchecked).add(m[2] ?? "");
71887
+ }
71888
+ if (checked.size > 0 || unchecked.size > 0) {
71889
+ for (const claimSection of ["Solution", "Testing"]) {
71890
+ const claimBody = doc2.getSection(claimSection);
71891
+ if (claimBody === null || isPlaceholderBody(claimBody))
71892
+ continue;
71893
+ for (const rawClaimLine of claimBody.split(`
71894
+ `)) {
71895
+ const claimLine = rawClaimLine.replace(/`[^`]*`/g, " ");
71896
+ const excerpt = rawClaimLine.trim().slice(0, 100);
71897
+ for (const id of checked) {
71898
+ if (claimsOpen(claimLine, id)) {
71899
+ findings.push({
71900
+ layer: "L3",
71901
+ code: FINDING_CODES.L3_STATUS_CLAIM_CONTRADICTION,
71902
+ severity: "error",
71903
+ section: claimSection,
71904
+ message: `R${id} is checked in Requirements but ${claimSection} claims it is still open \u2014 reconcile: "${excerpt}"`
71905
+ });
71906
+ }
71907
+ }
71908
+ for (const id of unchecked) {
71909
+ if (claimsDone(claimLine, id)) {
71910
+ findings.push({
71911
+ layer: "L3",
71912
+ code: FINDING_CODES.L3_STATUS_CLAIM_CONTRADICTION,
71913
+ severity: "error",
71914
+ section: claimSection,
71915
+ message: `R${id} is unchecked in Requirements but ${claimSection} claims it is done \u2014 reconcile: "${excerpt}"`
71916
+ });
71917
+ }
71918
+ }
71919
+ }
71920
+ }
71411
71921
  }
71412
71922
  }
71413
71923
  const planBody = doc2.getSection("Plan");
@@ -71785,15 +72295,15 @@ var init_task_check = __esm(() => {
71785
72295
  });
71786
72296
  reported++;
71787
72297
  } else {
71788
- const rawLow = raw.toLowerCase();
71789
- const basename4 = cite.path.split("/").pop() ?? "";
71790
- const citedWindow = (raw.split(`
71791
- `).slice(cite.startLine - 1, cite.endLine ?? cite.startLine).join(`
71792
- `) || "") + (rawLow.includes(basename4.toLowerCase()) ? ` ${basename4}` : "");
72298
+ const start = Math.max(1, cite.startLine - ANCHOR_WINDOW_LINES);
72299
+ const end2 = Math.min(lineCount, (cite.endLine ?? cite.startLine) + ANCHOR_WINDOW_LINES);
72300
+ const citedWindow = raw.split(`
72301
+ `).slice(start - 1, end2).join(`
72302
+ `) || "";
71793
72303
  const citingRow = body.split(`
71794
72304
  `).find((l) => l.includes(`\`${cite.raw}\``)) ?? body.split(`
71795
72305
  `).find((l) => l.includes(cite.raw)) ?? "";
71796
- const tokens = extractSubjectTokens(citingRow, cite.raw);
72306
+ const tokens = extractSubjectTokens(citingRow);
71797
72307
  const effectiveTokens = tokens.length === 0 && section === "Solution" ? extractPathSubjectTokens(cite.path) : tokens;
71798
72308
  if (!citedLinesNameSubject(effectiveTokens, citedWindow)) {
71799
72309
  findings.push({
@@ -82969,12 +83479,6 @@ class AgentRunActionRunner {
82969
83479
  async execute(options, context4) {
82970
83480
  const input = asOptionalString(options.input);
82971
83481
  const agent = asOptionalString(options.agent);
82972
- if (agent === "inline") {
82973
- return {
82974
- ok: false,
82975
- error: `agent.run: ${AGENT_INLINE_HEADLESS_MESSAGE}`
82976
- };
82977
- }
82978
83482
  const role = asOptionalString(options.role);
82979
83483
  const dispatchAgent = agent;
82980
83484
  const model = asOptionalString(options.model);
@@ -83048,6 +83552,15 @@ class AgentRunActionRunner {
83048
83552
  const expectFile = asOptionalString(options.expectFile);
83049
83553
  const requireDiff = asOptionalBoolean(options.requireDiff);
83050
83554
  const capture = asOptionalBoolean(options.capture) || answerFile !== undefined;
83555
+ const absoluteArtifactHint = (() => {
83556
+ const rel = expectFile ?? answerFile;
83557
+ if (rel === undefined || isAbsolute5(rel))
83558
+ return;
83559
+ return `
83560
+
83561
+ Write the required artifact to this absolute path: ${join20(cwd, rel)}`;
83562
+ })();
83563
+ const dispatchInput = input === undefined || absoluteArtifactHint === undefined ? input : `${input}${absoluteArtifactHint}`;
83051
83564
  const observer = this.observabilityBus === undefined ? undefined : (event) => {
83052
83565
  this.observabilityBus?.emit("workflow.agent", event);
83053
83566
  };
@@ -83062,7 +83575,7 @@ class AgentRunActionRunner {
83062
83575
  steeringNote = undefined;
83063
83576
  let steeringSignal = this.steeringController?.begin(context4.runId, actionId, steeringPolicy);
83064
83577
  while (true) {
83065
- traced = await this.agentService.runTraced(input, flags, undefined, {
83578
+ traced = await this.agentService.runTraced(dispatchInput, flags, undefined, {
83066
83579
  correlation: {
83067
83580
  runId: context4.runId,
83068
83581
  executionId: crypto.randomUUID(),
@@ -83143,8 +83656,12 @@ class AgentRunActionRunner {
83143
83656
  if (!ok) {
83144
83657
  await writePartialWorkArtifact(context4, agentLabel, model, traced, cwd, sessionDir);
83145
83658
  }
83146
- const partialWorkHint = `partial work (if any) preserved at .spur/run/${context4.runId}-${stepLabel}-partial.md; resume from that tree per the timed-out-implement runbook (plugins/sp/skills/spur-dev/references/execution-workflow.md)`;
83147
- const error51 = ok ? undefined : traced.signal !== undefined ? timeoutMs !== undefined ? `agent.run '${stepLabel}' (${agentLabel}) terminated by signal ${traced.signal} (configured timeout: ${timeoutMs}ms; timeout or cancellation); ${partialWorkHint}` : `agent.run '${stepLabel}' (${agentLabel}) was cancelled by signal ${traced.signal}; ${partialWorkHint}` : traced.message !== undefined ? `agent.run '${stepLabel}' (${agentLabel}) dispatch failed: ${traced.message}` : `agent.run '${stepLabel}' (${agentLabel}) exited with code ${exitCode}; ${partialWorkHint}`;
83659
+ const partialWorkPath = `.spur/run/${context4.runId}-${stepLabel}-partial.md`;
83660
+ const partialWorkHint = `partial work (if any) preserved at ${partialWorkPath}; resume from that tree per the timed-out-implement runbook (plugins/sp/skills/spur-dev/references/execution-workflow.md)`;
83661
+ const exitWorkHint = `partial work (if any) preserved at ${partialWorkPath}; the executor exited on its own, so inspect that tree and the executor's stderr before retrying (plugins/sp/skills/spur-dev/references/execution-workflow.md)`;
83662
+ const permissionEvidence = permissionFailureEvidence(`${traced.stderr ?? ""}
83663
+ ${traced.stdout ?? ""}`);
83664
+ const error51 = ok ? undefined : traced.signal !== undefined ? timeoutMs !== undefined ? `agent.run '${stepLabel}' (${agentLabel}) terminated by signal ${traced.signal} (configured timeout: ${timeoutMs}ms; timeout or cancellation); ${partialWorkHint}` : `agent.run '${stepLabel}' (${agentLabel}) was cancelled by signal ${traced.signal}; ${partialWorkHint}` : traced.message !== undefined ? `agent.run '${stepLabel}' (${agentLabel}) dispatch failed: ${traced.message}` : permissionEvidence !== undefined ? `agent.run '${stepLabel}' (${agentLabel}) exited with code ${exitCode}: the executor was denied an OS permission \u2014 ${permissionEvidence}. This is an environment constraint, not a model or quota failure; grant the executor its state directory and any local socket bind it needs, then retry` : `agent.run '${stepLabel}' (${agentLabel}) exited with code ${exitCode}; ${exitWorkHint}`;
83148
83665
  const resolvedAgent = invocation?.agent ?? targetAgentDir;
83149
83666
  let resolvedSessionDir = sessionDir;
83150
83667
  if (ok && affinityOn && resolvedAgent !== targetAgentDir && !context4.vars.__agentSessionDir) {
@@ -83551,7 +84068,7 @@ var init_agent_run = __esm(() => {
83551
84068
  init_src();
83552
84069
  init_dist5();
83553
84070
  init_agent_execution();
83554
- init_agent_service();
84071
+ init_failure_classification();
83555
84072
  init_task_locator();
83556
84073
  init_steering();
83557
84074
  });
@@ -83732,23 +84249,15 @@ function stringOption2(options, key2, fallback) {
83732
84249
  return fallback;
83733
84250
  throw new Error(`Action option "${key2}" must be a string`);
83734
84251
  }
83735
- function classifyDoctorProbe(detail, agent) {
83736
- if (RELAY_FAMILY.test(agent) && ENV_MISS_PATTERN.test(detail))
83737
- return "env-miss";
83738
- if (AUTH_FAIL_PATTERN.test(detail))
83739
- return "auth-fail";
83740
- return "unknown";
83741
- }
83742
84252
  function parseDoctorJson(stdout) {
83743
84253
  try {
83744
84254
  const parsed = JSON.parse(stdout);
83745
84255
  const first = parsed.agents?.[0];
83746
- const auth = typeof first?.authenticated === "string" ? first.authenticated : "unknown";
83747
- const detail = typeof first?.modelStatus?.detail === "string" ? first.modelStatus.detail : "";
84256
+ const usable = typeof first?.usable === "boolean" ? first.usable : true;
83748
84257
  const resolvedAgent = typeof first?.agent === "string" && first.agent.length > 0 ? first.agent : "";
83749
- return { auth, detail, resolvedAgent };
84258
+ return { usable, resolvedAgent };
83750
84259
  } catch {
83751
- return { auth: "unknown", detail: "", resolvedAgent: "" };
84260
+ return { usable: true, resolvedAgent: "" };
83752
84261
  }
83753
84262
  }
83754
84263
 
@@ -83834,24 +84343,16 @@ ${res.stderr}`.trim();
83834
84343
  status = "FAIL";
83835
84344
  continue;
83836
84345
  }
83837
- const { auth, detail, resolvedAgent } = parseDoctorJson(res.stdout);
83838
- const classifyAgainst = resolvedAgent !== "" ? resolvedAgent : exe;
83839
- const probe = classifyDoctorProbe(detail, classifyAgainst);
84346
+ const { usable, resolvedAgent } = parseDoctorJson(res.stdout);
83840
84347
  const resolvedSuffix = resolvedAgent !== "" && resolvedAgent !== exe ? ` (resolved ${resolvedAgent})` : "";
83841
- const line = `precheck: ${exe}${resolvedSuffix} auth=${auth} probe=${probe} ${detail}`.replace(/\s+$/, "");
84348
+ const line = `precheck: ${exe}${resolvedSuffix} usable=${usable}`.replace(/\s+$/, "");
83842
84349
  lines.push(line);
83843
84350
  emit(line);
83844
- if (auth === "unauthenticated") {
83845
- if (RELAY_FAMILY.test(classifyAgainst) && (probe === "env-miss" || probe === "unknown")) {
83846
- const soft = `precheck: SOFT - executor ${classifyAgainst} auth probe cannot see agent-owned credentials`;
83847
- lines.push(soft);
83848
- emit(soft);
83849
- } else {
83850
- const hard = `precheck: FAIL - executor ${classifyAgainst} is unauthenticated; fix agent.default or pass --vars '{"agent":"<authenticated-executor>"}' (${spurBin} agent doctor ${classifyAgainst} --json); ${detail}`;
83851
- lines.push(hard);
83852
- emit(hard);
83853
- status = "FAIL";
83854
- }
84351
+ if (!usable) {
84352
+ const fail = `precheck: FAIL - executor ${exe} is not usable per doctor; run ${spurBin} agent doctor ${exe} --json or pass --vars '{"agent":"<usable-executor>"}'`;
84353
+ lines.push(fail);
84354
+ emit(fail);
84355
+ status = "FAIL";
83855
84356
  }
83856
84357
  }
83857
84358
  await this.fileSystem.writeFile(normalized, `${status}
@@ -83859,14 +84360,11 @@ ${res.stderr}`.trim();
83859
84360
  return { ok: true, data: { status, resultFile: normalized, output: lines } };
83860
84361
  }
83861
84362
  }
83862
- var KIND3 = "doctor.probe", RELAY_FAMILY, ENV_MISS_PATTERN, AUTH_FAIL_PATTERN;
84363
+ var KIND3 = "doctor.probe";
83863
84364
  var init_doctor_probe = __esm(() => {
83864
84365
  init_dist5();
83865
84366
  init_observability();
83866
84367
  init_split_launch_command();
83867
- RELAY_FAMILY = /^(omp|pi)(-.*)?$/;
83868
- ENV_MISS_PATTERN = /API key not found for provider|no probe registered/i;
83869
- AUTH_FAIL_PATTERN = /invalid (API )?key|unauthori[sz]ed|forbidden|authentication failed|credential(s)? rejected/i;
83870
84368
  });
83871
84369
 
83872
84370
  // ../../packages/app/src/workflow/actions/file-exists.ts
@@ -85197,6 +85695,10 @@ class WorkflowAppService {
85197
85695
  if (roleErrors.length > 0) {
85198
85696
  return { ok: false, valid: false, file: file2, errors: roleErrors };
85199
85697
  }
85698
+ const varErrors = collectUndeclaredShellVarViolations(workflow);
85699
+ if (varErrors.length > 0) {
85700
+ return { ok: false, valid: false, file: file2, errors: varErrors };
85701
+ }
85200
85702
  const composition = collectCompositionAdvisory(workflow, absolute);
85201
85703
  await this.loadWorkflowExtensions(createDefaultWorkflowEngineHost(), workflow, absolute);
85202
85704
  return { ok: true, valid: true, workflow, composition };
@@ -85692,6 +86194,78 @@ function collectAgentRunRoleViolations(def) {
85692
86194
  }
85693
86195
  return violations;
85694
86196
  }
86197
+ function collectUndeclaredShellVarViolations(def) {
86198
+ const declared = new Set(Object.keys(def.vars ?? {}));
86199
+ const violations = [];
86200
+ const visitCommand = (location, command) => {
86201
+ let masked = "";
86202
+ let open = false;
86203
+ for (const ch of command) {
86204
+ if (ch === "'")
86205
+ open = !open;
86206
+ else if (!open)
86207
+ masked += ch;
86208
+ }
86209
+ const assigned = new Set;
86210
+ for (const m of command.matchAll(/\b(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\S/g)) {
86211
+ assigned.add(m[1]);
86212
+ }
86213
+ for (const m of masked.matchAll(/(?:^|\s)(?:--arg|--argjson|--slurpfile)\s+([A-Za-z_][A-Za-z0-9_]*)\b/g)) {
86214
+ assigned.add(m[1]);
86215
+ }
86216
+ for (const m of masked.matchAll(/\bfor\s+([A-Za-z_][A-Za-z0-9_]*)\s+in\b/g)) {
86217
+ assigned.add(m[1]);
86218
+ }
86219
+ for (const m of masked.matchAll(/\bread\s+(?:-[a-zA-Z]+\s+)*([A-Za-z_][A-Za-z0-9_]*(?:\s+[A-Za-z_][A-Za-z0-9_]*)*)/g)) {
86220
+ for (const v of (m[1] ?? "").split(/\s+/))
86221
+ assigned.add(v);
86222
+ }
86223
+ for (const m of masked.matchAll(/\$(?:\{([^}]*)\}|([A-Za-z_][A-Za-z0-9_]*))/g)) {
86224
+ const raw = m[1] ?? m[2];
86225
+ if (raw.includes("."))
86226
+ continue;
86227
+ if (/^[A-Z][A-Z0-9_]*$/.test(raw))
86228
+ continue;
86229
+ if ((masked[(m.index ?? 0) - 1] ?? "") === "\\")
86230
+ continue;
86231
+ if (declared.has(raw) || assigned.has(raw))
86232
+ continue;
86233
+ violations.push(`Shell command at ${location} references $${raw}, which is not declared in the workflow's vars: block (0674 R5) \u2014 declare it or provide it locally`);
86234
+ }
86235
+ };
86236
+ if (def.kind === "transition-flow" || def.kind === undefined) {
86237
+ const flowDef = def;
86238
+ for (const node of flowDef.nodes ?? []) {
86239
+ const cmd = node.action?.kind === "shell" ? node.action.options?.command : undefined;
86240
+ if (typeof cmd === "string" && cmd.length > 0)
86241
+ visitCommand(node.id, cmd);
86242
+ }
86243
+ for (const edge of flowDef.edges ?? []) {
86244
+ const cmd = edge.condition?.kind === "shell" ? edge.condition.options?.command : undefined;
86245
+ if (typeof cmd === "string" && cmd.length > 0)
86246
+ visitCommand(`${edge.from}\u2192${edge.to}`, cmd);
86247
+ }
86248
+ } else {
86249
+ const smDef = def;
86250
+ const walkActions = (stateId, actions) => {
86251
+ for (const [i2, action] of (actions ?? []).entries()) {
86252
+ const cmd = action.kind === "shell" ? action.options?.command : undefined;
86253
+ if (typeof cmd === "string" && cmd.length > 0)
86254
+ visitCommand(`${stateId}/action[${i2}]`, cmd);
86255
+ }
86256
+ };
86257
+ for (const state of smDef.states ?? []) {
86258
+ walkActions(state.id, state.onEnter);
86259
+ walkActions(state.id, state.onExit);
86260
+ }
86261
+ for (const trans of smDef.transitions ?? []) {
86262
+ const cmd = trans.guard?.kind === "shell" ? trans.guard.options?.command : undefined;
86263
+ if (typeof cmd === "string" && cmd.length > 0)
86264
+ visitCommand(`${trans.from}\u2192${trans.to}`, cmd);
86265
+ }
86266
+ }
86267
+ return violations;
86268
+ }
85695
86269
  function collectCompositionAdvisory(def, workflowFile) {
85696
86270
  const findings = [];
85697
86271
  let suppressed = 0;
@@ -86829,6 +87403,7 @@ __export(exports_src2, {
86829
87403
  resolveWorkflowLogRetentionDays: () => resolveWorkflowLogRetentionDays,
86830
87404
  resolveWorkflowFile: () => resolveWorkflowFile,
86831
87405
  resolveSpurServeCommand: () => resolveSpurServeCommand,
87406
+ resolveRoleTarget: () => resolveRoleTarget,
86832
87407
  resolveRetentionQuotas: () => resolveRetentionQuotas,
86833
87408
  resolvePlanningFolders: () => resolvePlanningFolders,
86834
87409
  resolveOutputLogConfig: () => resolveOutputLogConfig,
@@ -86836,6 +87411,7 @@ __export(exports_src2, {
86836
87411
  resolveConfiguredTaskDirs: () => resolveConfiguredTaskDirs,
86837
87412
  resolveAutostartSet: () => resolveAutostartSet,
86838
87413
  resolveArtifactPath: () => resolveArtifactPath,
87414
+ resolveAgentSelector: () => resolveAgentSelector,
86839
87415
  renderTesting: () => renderTesting,
86840
87416
  renderStepLine: () => renderStepLine,
86841
87417
  renderSolutionFromDiff: () => renderSolutionFromDiff,
@@ -86858,6 +87434,7 @@ __export(exports_src2, {
86858
87434
  projectLifecycle: () => projectLifecycle,
86859
87435
  probePort: () => probePort,
86860
87436
  portBindingAvailable: () => portBindingAvailable,
87437
+ permissionFailureEvidence: () => permissionFailureEvidence,
86861
87438
  parseVerdict: () => parseVerdict,
86862
87439
  parseSteeringPolicy: () => parseSteeringPolicy,
86863
87440
  parsePsOutput: () => parsePsOutput,
@@ -86901,6 +87478,7 @@ __export(exports_src2, {
86901
87478
  createWorkflowEventIdentity: () => createWorkflowEventIdentity,
86902
87479
  createPsProcessInspector: () => createPsProcessInspector,
86903
87480
  createGitAlternateTree: () => createGitAlternateTree,
87481
+ createFileAgentInstanceStore: () => createFileAgentInstanceStore,
86904
87482
  configuredSecretValues: () => configuredSecretValues,
86905
87483
  computeProofInputFingerprint: () => computeProofInputFingerprint,
86906
87484
  computeExitCode: () => computeExitCode,
@@ -87007,8 +87585,7 @@ __export(exports_src2, {
87007
87585
  AgentRunActionRunner: () => AgentRunActionRunner,
87008
87586
  AgentExecutionLifecycle: () => AgentExecutionLifecycle,
87009
87587
  ALL_FINDING_CODES: () => ALL_FINDING_CODES,
87010
- AGENT_SESSION_SOURCES: () => AGENT_SESSION_SOURCES,
87011
- AGENT_INLINE_HEADLESS_MESSAGE: () => AGENT_INLINE_HEADLESS_MESSAGE
87588
+ AGENT_SESSION_SOURCES: () => AGENT_SESSION_SOURCES
87012
87589
  });
87013
87590
  var init_src3 = __esm(async () => {
87014
87591
  init_src2();
@@ -87016,6 +87593,7 @@ var init_src3 = __esm(async () => {
87016
87593
  init_errors7();
87017
87594
  init_agent_execution();
87018
87595
  init_workflow_run_log_sink();
87596
+ init_agent_instance_store();
87019
87597
  init_agent_service();
87020
87598
  init_anchor_qualifier();
87021
87599
  init_corpus_check();
@@ -87155,19 +87733,19 @@ var {
87155
87733
  // src/index.ts
87156
87734
  init_loader();
87157
87735
 
87158
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application-node.js
87736
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/application-node.js
87159
87737
  init_dist4();
87160
87738
  init_dist5();
87161
87739
  import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "fs";
87162
87740
  import { dirname as dirname5 } from "path";
87163
87741
 
87164
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application/index.js
87742
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/application/index.js
87165
87743
  init_default_observers();
87166
87744
  init_event_bus();
87167
87745
  init_file_observer();
87168
87746
  init_logger3();
87169
87747
 
87170
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/scheduler/noop.js
87748
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/scheduler/noop.js
87171
87749
  class NoopSchedulerAdapter {
87172
87750
  constructor() {}
87173
87751
  register(_cron, _action) {}
@@ -87175,7 +87753,7 @@ class NoopSchedulerAdapter {
87175
87753
  async stop() {}
87176
87754
  }
87177
87755
 
87178
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/scheduler/factory.js
87756
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/scheduler/factory.js
87179
87757
  function initScheduler(adapter, cronEntries) {
87180
87758
  const resolved = adapter ?? new NoopSchedulerAdapter;
87181
87759
  if (cronEntries) {
@@ -87186,7 +87764,7 @@ function initScheduler(adapter, cronEntries) {
87186
87764
  return resolved;
87187
87765
  }
87188
87766
 
87189
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application/plugins/builtins.js
87767
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/application/plugins/builtins.js
87190
87768
  init_logger3();
87191
87769
  init_metrics();
87192
87770
  init_sdk();
@@ -87279,7 +87857,7 @@ function dbPlugin(db2) {
87279
87857
  };
87280
87858
  }
87281
87859
 
87282
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application/plugins/host.js
87860
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/application/plugins/host.js
87283
87861
  init_logger3();
87284
87862
 
87285
87863
  class PluginHost {
@@ -87367,7 +87945,7 @@ class PluginHost {
87367
87945
  }
87368
87946
  }
87369
87947
 
87370
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application/index.js
87948
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/application/index.js
87371
87949
  async function performShutdown(state, reason) {
87372
87950
  if (state.stopped)
87373
87951
  return;
@@ -87478,10 +88056,10 @@ async function runApplication(options) {
87478
88056
  }
87479
88057
  }
87480
88058
 
87481
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application-node.js
88059
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/application-node.js
87482
88060
  init_scheduler_node();
87483
88061
 
87484
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
88062
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
87485
88063
  var import_api14 = __toESM(require_src(), 1);
87486
88064
 
87487
88065
  // ../../node_modules/.bun/@opentelemetry+exporter-metrics-otlp-http@0.218.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esm/OTLPMetricExporterBase.js
@@ -90497,7 +91075,7 @@ class OTLPTraceExporter extends import_otlp_exporter_base2.OTLPExporterBase {
90497
91075
  }), JsonTraceSerializer));
90498
91076
  }
90499
91077
  }
90500
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
91078
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
90501
91079
  var import_resources2 = __toESM(require_src4(), 1);
90502
91080
  var import_sdk_trace_node = __toESM(require_src8(), 1);
90503
91081
  var import_semantic_conventions = __toESM(require_src2(), 1);
@@ -90548,7 +91126,7 @@ async function shutdownNodeTelemetry() {
90548
91126
  await Promise.all(pending);
90549
91127
  }
90550
91128
 
90551
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application-node.js
91129
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.45+497c20e6aa4ee57e/node_modules/@gobing-ai/ts-infra/dist/application-node.js
90552
91130
  class ConfigValidationError extends Error {
90553
91131
  constructor(message) {
90554
91132
  super(message);
@@ -94494,9 +95072,14 @@ function registerAgentCommand(program2, context4) {
94494
95072
  const code = await runAgentList(svc, context4, { json: options.json, specs: options.specs });
94495
95073
  context4.setExitCode(code);
94496
95074
  });
94497
- agent.command("doctor").description("Check agent readiness.").option(...SHARED_OPTIONS.json).argument("[agent]", "Agent to check").action(async (agentName, options) => {
95075
+ agent.command("doctor").description("Check agent readiness.").option(...SHARED_OPTIONS.json).argument("[agent]", "Agent to check").option("--probe-health", "Opt into model health probing (liveness questions are never cached)").option("--force-refresh", "Bypass the detection cache, re-run, and rewrite it").action(async (agentName, options) => {
94498
95076
  const svc = context4.agentService();
94499
- const code = await svc.doctor({ json: options.json === true, agent: agentName }, undefined);
95077
+ const code = await svc.doctor({
95078
+ json: options.json === true,
95079
+ agent: agentName,
95080
+ probeHealth: options.probeHealth === true,
95081
+ forceRefresh: options.forceRefresh === true
95082
+ }, undefined);
94500
95083
  context4.setExitCode(code);
94501
95084
  });
94502
95085
  agent.command("run").description("Execute a prompt or slash command via a coding agent.").option("--agent <name>", "Role, executor, agent binary, auto, or inline (host-session-only; errors on headless surfaces)").option("--spec <id>", "Team agent spec id (occupant addressing; pairs with --drain)").option("--continue", "Resume the previous agent session").option("--model <name>", "Agent model argument").option(...SHARED_OPTIONS.modeAgent).option(...SHARED_OPTIONS.cwdAgent).option(...SHARED_OPTIONS.jsonSupported).option("--drain", "Prepend pending inbox messages for --spec <id>").argument("<prompt>", "The prompt or slash command to execute").action(async (prompt, options) => {
@@ -94518,8 +95101,30 @@ function registerAgentCommand(program2, context4) {
94518
95101
  process.off("SIGTERM", onSignal);
94519
95102
  }
94520
95103
  });
94521
- agent.command("wait").description("Wait for a pinned occupant run to reach a lifecycle state (G4 wave 2).").argument("<specId>", "Agent spec id whose occupant to wait on").option(...SHARED_OPTIONS.runAgentPin).option(...SHARED_OPTIONS.untilAgent, collectUntil, []).option(...SHARED_OPTIONS.timeout, parseTimeout).option(...SHARED_OPTIONS.json).action(async (specId, options) => {
94522
- const code = await runAgentWait(context4, specId, options);
95104
+ agent.command("wait").description("Wait for a pinned occupant run to reach a lifecycle state (G4 wave 2). Address by spec id or --role.").argument("[specId]", "Agent spec id whose occupant to wait on (mutually exclusive with --role)").option("--role <name>", "Address by Layer-1 role or executor name; must resolve to exactly one materialized instance").option(...SHARED_OPTIONS.runAgentPin).option(...SHARED_OPTIONS.untilAgent, collectUntil, []).option(...SHARED_OPTIONS.timeout, parseTimeout).option(...SHARED_OPTIONS.json).action(async (specId, options) => {
95105
+ if (options.role !== undefined && specId !== undefined) {
95106
+ context4.setExitCode(waitUsageError(context4, options, "agent wait accepts a spec id or --role, not both"));
95107
+ return;
95108
+ }
95109
+ let targetId = specId;
95110
+ if (options.role !== undefined) {
95111
+ const resolution = await resolveAgentSelector(() => new TeamService(context4).listAgentSpecs(), context4.agentConfig, options.role);
95112
+ if (!resolution.ok) {
95113
+ context4.setExitCode(resolution.code === "unknown_selector" ? 2 : 1);
95114
+ if (options.json) {
95115
+ context4.output.write(toJson2({ error: { code: resolution.code, message: resolution.message } }));
95116
+ } else {
95117
+ context4.output.error(resolution.message);
95118
+ }
95119
+ return;
95120
+ }
95121
+ targetId = resolution.specId;
95122
+ }
95123
+ if (targetId === undefined) {
95124
+ context4.setExitCode(waitUsageError(context4, options, "agent wait requires a spec id or --role <name>"));
95125
+ return;
95126
+ }
95127
+ const code = await runAgentWait(context4, targetId, options);
94523
95128
  context4.setExitCode(code);
94524
95129
  });
94525
95130
  agent.command("create").description("Write a team agent spec to .spur/agents/<id>.yaml.").option("--type <agent-type>", "Agent spec type for create").option("--tags <a,b>", "Team identity tags").option("--system-prompt <text>", "Team identity system prompt").option(...SHARED_OPTIONS.nameAgent).option("--workspace <path>", "Workspace path").option("--purpose <text>", "Team identity purpose").option("--auto-start", "Auto-start flag").option("--model <name>", "Agent model argument").option("--autonomy <level>", "Autonomy level").option("--no-identity-preamble", "Disable identity preamble").option(...SHARED_OPTIONS.json).argument("<id>", "Agent spec id").action(async (id, options) => {
@@ -94555,7 +95160,7 @@ function validateAgentSelector(flags, context4) {
94555
95160
  if (raw === undefined || raw === "auto")
94556
95161
  return null;
94557
95162
  if (raw === "inline")
94558
- return AGENT_INLINE_HEADLESS_MESSAGE;
95163
+ return null;
94559
95164
  if (context4.agentRoles.has(raw))
94560
95165
  return null;
94561
95166
  if ((context4.agentConfig?.executors ?? []).some((e) => e.name === raw))
@@ -95936,7 +96541,7 @@ import { createRequire } from "module";
95936
96541
  var CLI_CONFIG = {
95937
96542
  binaryName: "spur",
95938
96543
  binaryLabel: "spur",
95939
- binaryVersion: "0.3.62",
96544
+ binaryVersion: "0.3.64",
95940
96545
  configDir: ".spur",
95941
96546
  configFile: ".spur/config.yaml",
95942
96547
  databaseFile: ".spur/spur.db"
@@ -96551,9 +97156,36 @@ var DEFAULT_FROM = "operator";
96551
97156
  var DEFAULT_WATCH_INTERVAL_MS = 2000;
96552
97157
  function registerMessageCommand(program2, context4) {
96553
97158
  const noun = program2.command("message").summary("send and inspect durable inter-agent messages");
96554
- noun.command("send").description("Enqueue a message for an agent. Use --wait to block until the recipient reaches a state.").argument("<body>", "Message body").requiredOption("--to <id>", "Recipient agent id").option("--from <id>", "Sender id", DEFAULT_FROM).option("--wait", "Block until the recipient occupant reaches --until (default: invoke-exit)").option(...SHARED_OPTIONS.untilMessage, collectSendUntil, []).option(...SHARED_OPTIONS.timeout, parseTimeout2).option(...SHARED_OPTIONS.json).action(async (body, options) => {
97159
+ noun.command("send").description("Enqueue a message for an agent. Use --wait to block until the recipient reaches a state.").argument("<body>", "Message body").option("--to <id>", "Recipient agent id (mutually exclusive with --role)").option("--role <name>", "Address by Layer-1 role or executor name; must resolve to exactly one materialized instance").option("--from <id>", "Sender id", DEFAULT_FROM).option("--wait", "Block until the recipient occupant reaches --until (default: invoke-exit)").option(...SHARED_OPTIONS.untilMessage, collectSendUntil, []).option(...SHARED_OPTIONS.timeout, parseTimeout2).option(...SHARED_OPTIONS.json).action(async (body, options) => {
96555
97160
  const svc = new TeamService(context4);
96556
- const code = await runMessageSend(svc, context4, body, options);
97161
+ let toId = options.to;
97162
+ if (options.role !== undefined && options.to !== undefined) {
97163
+ const message = "message send accepts --to or --role, not both";
97164
+ if (options.json) {
97165
+ context4.output.write(toJson2({ error: { code: "usage", message } }));
97166
+ } else {
97167
+ context4.output.error(message);
97168
+ }
97169
+ context4.setExitCode(2);
97170
+ return;
97171
+ }
97172
+ if (options.role !== undefined) {
97173
+ const resolution = await resolveAgentSelector(() => svc.listAgentSpecs(), context4.agentConfig, options.role);
97174
+ if (!resolution.ok) {
97175
+ if (options.json) {
97176
+ context4.output.write(toJson2({ error: { code: resolution.code, message: resolution.message } }));
97177
+ } else {
97178
+ context4.output.error(resolution.message);
97179
+ }
97180
+ context4.setExitCode(resolution.code === "unknown_selector" ? 2 : 1);
97181
+ return;
97182
+ }
97183
+ toId = resolution.specId;
97184
+ }
97185
+ const code = await runMessageSend(svc, context4, body, {
97186
+ ...options,
97187
+ to: toId ?? ""
97188
+ });
96557
97189
  context4.setExitCode(code);
96558
97190
  });
96559
97191
  noun.command("inbox").description("List messages addressed to an agent.").requiredOption(...SHARED_OPTIONS.agentIdMessage).option(...SHARED_OPTIONS.json).action(async (options) => {
@@ -96600,6 +97232,14 @@ async function runMessageSend(svc, context4, body, options) {
96600
97232
  }
96601
97233
  return 2;
96602
97234
  }
97235
+ if (options.to === "") {
97236
+ if (options.json) {
97237
+ context4.output.write(toJson2({ error: { code: "usage", message: "message send requires --to <id> or --role <name>" } }));
97238
+ } else {
97239
+ context4.output.error("message send requires --to <id> or --role <name>");
97240
+ }
97241
+ return 2;
97242
+ }
96603
97243
  const from = options.from || DEFAULT_FROM;
96604
97244
  let pinnedBeforeSend = null;
96605
97245
  if (options.wait === true) {
@@ -109553,7 +110193,7 @@ import { setTimeout as sleep5 } from "timers/promises";
109553
110193
 
109554
110194
  // src/workflow/mermaid-render.ts
109555
110195
  function esc2(text4) {
109556
- return text4.replace(/"/g, "&quot;").replace(/\[/g, "&#91;").replace(/\]/g, "&#93;");
110196
+ return text4.replace(/"/g, "&quot;").replace(/\[/g, "&#91;").replace(/\]/g, "&#93;").replace(/\(/g, "&#40;").replace(/\)/g, "&#41;");
109557
110197
  }
109558
110198
  function classLine(id, cls) {
109559
110199
  return ` class ${esc2(id)} ${cls};`;
@@ -109561,7 +110201,7 @@ function classLine(id, cls) {
109561
110201
  function renderWorkflowMermaid(def) {
109562
110202
  const lines = [];
109563
110203
  lines.push("```mermaid");
109564
- lines.push("flowchart LR");
110204
+ lines.push("flowchart TD");
109565
110205
  lines.push(" classDef terminal fill:#d4edda,stroke:#1e7e34,color:#0a3d1f;");
109566
110206
  lines.push(" classDef failure fill:#f8d7da,stroke:#c62828,color:#5f1414;");
109567
110207
  lines.push(" classDef initial fill:#fff3cd,stroke:#b8860b,color:#5a4a00;");
@@ -109721,7 +110361,7 @@ function registerWorkflowCommand(program2, context4) {
109721
110361
  secretValues: configuredSecretValues(context4.env),
109722
110362
  warn: (message) => context4.output.error(`Warning: ${message}`),
109723
110363
  getDb: () => context4.getDb(),
109724
- agentService: () => context4.agentService(),
110364
+ agentService: () => bus ? context4.agentService({ events: bus }) : context4.agentService(),
109725
110365
  ruleService: () => context4.ruleService(),
109726
110366
  hitlResponder: () => context4.hitlResponder(json3),
109727
110367
  embeddedSchemas: () => EMBEDDED_SPUR_SCHEMAS,