@gobing-ai/spur 0.3.62 → 0.3.63

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 (72) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/config/corpus-baseline.json +200 -8
  3. package/config/workflows/history-anatomy.yaml +40 -11
  4. package/package.json +9 -9
  5. package/plugins/sp/README.md +2 -2
  6. package/plugins/sp/commands/dev-find-issue.md +4 -4
  7. package/plugins/sp/commands/dev-idea.md +3 -3
  8. package/plugins/sp/plugin.json +1 -1
  9. package/plugins/sp/references/environment-lens.md +66 -0
  10. package/plugins/sp/scripts/history-anatomy-cache.mjs +162 -13
  11. package/plugins/sp/scripts/history-anatomy-cache.ts +209 -13
  12. package/plugins/sp/skills/dogfood-testing/references/report-template.md +30 -0
  13. package/plugins/sp/skills/history-anatomy/SKILL.md +3 -3
  14. package/plugins/sp/skills/history-anatomy/references/operations.md +21 -8
  15. package/plugins/sp/skills/history-anatomy/references/report-contract.md +55 -5
  16. package/plugins/sp/skills/spur-cli/references/agent.md +15 -6
  17. package/plugins/sp/skills/spur-cli/references/message.md +4 -2
  18. package/plugins/sp/skills/spur-dev/references/cross-cutting.md +6 -4
  19. package/spur.js +882 -325
  20. package/web/_astro/{BoardApp.rkWGVwwK.js → BoardApp.CKolAjUz.js} +56 -56
  21. package/web/_astro/BoardApp.DXD--ybM.js +1 -0
  22. package/web/_astro/{TaskDetail.B7ODt_bA.js → TaskDetail.Bre7G4gC.js} +1 -1
  23. package/web/_astro/{arc.C5QRz6AQ.js → arc.7luwOGiC.js} +1 -1
  24. package/web/_astro/{architectureDiagram-3BPJPVTR.CHptn8gZ.js → architectureDiagram-3BPJPVTR.F6KaHXp-.js} +1 -1
  25. package/web/_astro/{blockDiagram-GPEHLZMM.b1nEDkDw.js → blockDiagram-GPEHLZMM.CCGHeRVi.js} +1 -1
  26. package/web/_astro/{c4Diagram-AAUBKEIU.BWj8S_Qq.js → c4Diagram-AAUBKEIU.CpqewGmd.js} +1 -1
  27. package/web/_astro/channel.DxfOFf1l.js +1 -0
  28. package/web/_astro/{chunk-2J33WTMH.q0BBuE1n.js → chunk-2J33WTMH.CB9vKa5F.js} +1 -1
  29. package/web/_astro/{chunk-4BX2VUAB.DP2KDkAU.js → chunk-4BX2VUAB.ifGXoUA3.js} +1 -1
  30. package/web/_astro/{chunk-55IACEB6.CkCId72p.js → chunk-55IACEB6.VIaRo7l8.js} +1 -1
  31. package/web/_astro/{chunk-727SXJPM.oHWzxMot.js → chunk-727SXJPM.DzPE41OS.js} +1 -1
  32. package/web/_astro/{chunk-AQP2D5EJ.DkkgxfMP.js → chunk-AQP2D5EJ.UF2QRXYF.js} +1 -1
  33. package/web/_astro/{chunk-FMBD7UC4.lmFJDvRK.js → chunk-FMBD7UC4.D2zXKa1R.js} +1 -1
  34. package/web/_astro/{chunk-ND2GUHAM.52jt0eHK.js → chunk-ND2GUHAM.Cb9bDyvx.js} +1 -1
  35. package/web/_astro/{chunk-QZHKN3VN.Cg8KEFoD.js → chunk-QZHKN3VN.nUKFBiLD.js} +1 -1
  36. package/web/_astro/{classDiagram-4FO5ZUOK.BuOUhxcD.js → classDiagram-4FO5ZUOK.DZg9K9mO.js} +1 -1
  37. package/web/_astro/{classDiagram-v2-Q7XG4LA2.BuOUhxcD.js → classDiagram-v2-Q7XG4LA2.DZg9K9mO.js} +1 -1
  38. package/web/_astro/{cose-bilkent-S5V4N54A.BRUU8E_0.js → cose-bilkent-S5V4N54A.D9STo90d.js} +1 -1
  39. package/web/_astro/{dagre-BM42HDAG.GDbfFYVV.js → dagre-BM42HDAG.D3IbwhHz.js} +1 -1
  40. package/web/_astro/{diagram-2AECGRRQ.CvIDBeJF.js → diagram-2AECGRRQ.BWTDxBe9.js} +1 -1
  41. package/web/_astro/{diagram-5GNKFQAL.DMgJjWOX.js → diagram-5GNKFQAL.XnXlonHG.js} +1 -1
  42. package/web/_astro/{diagram-KO2AKTUF.njjl-0AP.js → diagram-KO2AKTUF.CywOngCO.js} +1 -1
  43. package/web/_astro/{diagram-LMA3HP47.CcCqgP8M.js → diagram-LMA3HP47.DY1D21Iu.js} +1 -1
  44. package/web/_astro/{diagram-OG6HWLK6.Btqd-YVE.js → diagram-OG6HWLK6.DQxb59KA.js} +1 -1
  45. package/web/_astro/{erDiagram-TEJ5UH35.BbhML_Xo.js → erDiagram-TEJ5UH35.CF2U-pQZ.js} +1 -1
  46. package/web/_astro/{flowDiagram-I6XJVG4X.CkvsIgY8.js → flowDiagram-I6XJVG4X.BJK4M3in.js} +1 -1
  47. package/web/_astro/{ganttDiagram-6RSMTGT7.m8IWD_wW.js → ganttDiagram-6RSMTGT7.BSniMzdB.js} +1 -1
  48. package/web/_astro/{gitGraphDiagram-PVQCEYII.5z87HXO-.js → gitGraphDiagram-PVQCEYII.Dxg-yRov.js} +1 -1
  49. package/web/_astro/index.BVXdIsZV.css +1 -0
  50. package/web/_astro/{infoDiagram-5YYISTIA.Bvyvsd7Q.js → infoDiagram-5YYISTIA.BY4CgO_n.js} +1 -1
  51. package/web/_astro/{ishikawaDiagram-YF4QCWOH.DdWVYO87.js → ishikawaDiagram-YF4QCWOH.BmWDZtwF.js} +1 -1
  52. package/web/_astro/{journeyDiagram-JHISSGLW.C3kOlYH1.js → journeyDiagram-JHISSGLW.CpB1YWDP.js} +1 -1
  53. package/web/_astro/{kanban-definition-UN3LZRKU.CfKTUHVC.js → kanban-definition-UN3LZRKU.k-fukQX9.js} +1 -1
  54. package/web/_astro/{linear.CMDHnzgX.js → linear.BNNCobvI.js} +1 -1
  55. package/web/_astro/{mermaid.core.DN7-WrsP.js → mermaid.core.DnpzzuPU.js} +4 -4
  56. package/web/_astro/{mindmap-definition-RKZ34NQL.DcQxLvqG.js → mindmap-definition-RKZ34NQL.D9NnlLBu.js} +1 -1
  57. package/web/_astro/{pieDiagram-4H26LBE5.Nu-Inbw6.js → pieDiagram-4H26LBE5.CKhoMiyC.js} +1 -1
  58. package/web/_astro/{quadrantDiagram-W4KKPZXB.Dck2EChs.js → quadrantDiagram-W4KKPZXB.BkAygRlm.js} +1 -1
  59. package/web/_astro/{requirementDiagram-4Y6WPE33.C--E5XuW.js → requirementDiagram-4Y6WPE33.CX8ibmwc.js} +1 -1
  60. package/web/_astro/{sankeyDiagram-5OEKKPKP.B_0iRNna.js → sankeyDiagram-5OEKKPKP.Dvurpa0Y.js} +1 -1
  61. package/web/_astro/{sequenceDiagram-3UESZ5HK.PKuKr9mk.js → sequenceDiagram-3UESZ5HK.veO8c2tk.js} +1 -1
  62. package/web/_astro/{stateDiagram-AJRCARHV.ClhGHb-O.js → stateDiagram-AJRCARHV.DpMr4CO3.js} +1 -1
  63. package/web/_astro/{stateDiagram-v2-BHNVJYJU.Bv6BBnvg.js → stateDiagram-v2-BHNVJYJU.CKjso86_.js} +1 -1
  64. package/web/_astro/{timeline-definition-PNZ67QCA.BZm2ZvAH.js → timeline-definition-PNZ67QCA.DayoPp_2.js} +1 -1
  65. package/web/_astro/{vennDiagram-CIIHVFJN.Dt6yZXry.js → vennDiagram-CIIHVFJN.XNHf04O9.js} +1 -1
  66. package/web/_astro/{wardley-L42UT6IY.rUs-E00M.js → wardley-L42UT6IY.CpM_031g.js} +1 -1
  67. package/web/_astro/{wardleyDiagram-YWT4CUSO.BcWgv4cA.js → wardleyDiagram-YWT4CUSO.lIAjSkZJ.js} +1 -1
  68. package/web/_astro/{xychartDiagram-2RQKCTM6.DH-M-cX9.js → xychartDiagram-2RQKCTM6.D8_2K6U1.js} +1 -1
  69. package/web/index.html +2 -2
  70. package/web/_astro/BoardApp.Z9jMwI9G.js +0 -1
  71. package/web/_astro/channel.BJtn6CGV.js +0 -1
  72. 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.43/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.43/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.43/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.43/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.43/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.43/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.43/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.43+292f49f11139e86a/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.43+292f49f11139e86a/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.43+292f49f11139e86a/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.43+292f49f11139e86a/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.43+292f49f11139e86a/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.43+292f49f11139e86a/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.43+292f49f11139e86a/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.43+292f49f11139e86a/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.43+292f49f11139e86a/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.43+292f49f11139e86a/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.43+292f49f11139e86a/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/node_modules/@gobing-ai/ts-runtime/dist/index.js
38940
38940
  var exports_dist2 = {};
38941
38941
  __export(exports_dist2, {
38942
38942
  writeJsonFile: () => writeJsonFile2,
@@ -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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+0f4912dac59dd9a6/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.43+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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+db68697b5a8b90df/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.43+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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+2903c6de41d25eca/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.43+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.43+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.43+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.43+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.43+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.43+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.43+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.43+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.43+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.43+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.43+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.43+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.43+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.43+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.43+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.43+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.43+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.43+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) {
@@ -59340,7 +59415,7 @@ var init_jsonl_importer_dao = __esm(() => {
59340
59415
  TYPED_IGNORED_KEYS = new Set(["_meta", "split_index"]);
59341
59416
  });
59342
59417
 
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
59418
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.43+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/redaction.js
59344
59419
  function redactValue(value, rules = DEFAULT_REDACTION_RULES) {
59345
59420
  if (typeof value === "string") {
59346
59421
  return rules.reduce((current, rule) => current.replace(rule.pattern, rule.replacement), value);
@@ -59392,7 +59467,7 @@ var init_redaction = __esm(() => {
59392
59467
  ];
59393
59468
  });
59394
59469
 
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
59470
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.43+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/importer.js
59396
59471
  function toolCallKey(source, sessionId, callId) {
59397
59472
  return `${source}${TOOL_CALL_KEY_SEP}${sessionId}${TOOL_CALL_KEY_SEP}${callId}`;
59398
59473
  }
@@ -59425,7 +59500,6 @@ async function runJsonlImport(source, options) {
59425
59500
  const resolvedSource = definition.source;
59426
59501
  const fileSystem = options.fileSystem ?? createNodeFileSystem3();
59427
59502
  await applyHistoryImportSchema(options.db);
59428
- await ensureTargetTables(options.db, definition);
59429
59503
  const mode = options.mode ?? "incremental";
59430
59504
  const files = await discoverFiles(definition, options.roots, options.files, fileSystem, options.paths);
59431
59505
  if (mode === "full" && !options.dryRun) {
@@ -59438,11 +59512,23 @@ async function runJsonlImport(source, options) {
59438
59512
  let skippedDuplicates = 0;
59439
59513
  let unknownRecords = 0;
59440
59514
  let skippedCorruptLines = 0;
59515
+ let skippedUnchangedFiles = 0;
59441
59516
  let checkpointUpdates = 0;
59517
+ const ensuredTargetTables = new Set;
59442
59518
  const desiredHashes = new Set;
59443
59519
  const toolCallRows = new Map;
59520
+ const codexLastAssistant = new Map;
59521
+ const checkpoints = mode === "incremental" ? await loadSourceCheckpoints(options.db, resolvedSource) : undefined;
59444
59522
  for (const file2 of files) {
59445
- const checkpoint = mode === "incremental" ? await readCheckpoint(options.db, resolvedSource, file2) : 0;
59523
+ const entry = checkpoints?.get(file2);
59524
+ const checkpoint = entry?.line ?? 0;
59525
+ if (checkpoints !== undefined && entry !== undefined && entry.size !== null && entry.mtimeMs !== null) {
59526
+ const stat = await safeStat(fileSystem, file2);
59527
+ if (stat !== null && stat.size === entry.size && stat.mtimeMs === entry.mtimeMs) {
59528
+ skippedUnchangedFiles += 1;
59529
+ continue;
59530
+ }
59531
+ }
59446
59532
  let lineNumber = 0;
59447
59533
  for await (const rawLine of readLines(fileSystem, file2)) {
59448
59534
  lineNumber += 1;
@@ -59502,34 +59588,42 @@ async function runJsonlImport(source, options) {
59502
59588
  if (definition.source === "omp" || definition.source === "claude") {
59503
59589
  const assistantTs = definition.source === "omp" ? new Map : null;
59504
59590
  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));
59591
+ for (const entry2 of prepared) {
59592
+ if (entry2.split.targetTable === "history_message" && entry2.normalized.role === "assistant" && typeof entry2.normalized.session_id === "string") {
59593
+ assistantTs.set(`${entry2.normalized.session_id}${TOOL_CALL_KEY_SEP}${entry2.normalized.seq}`, timestampToEpochMs(entry2.normalized.ts));
59508
59594
  }
59509
59595
  }
59510
59596
  }
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}`)
59597
+ for (const entry2 of prepared) {
59598
+ const callId = entry2.normalized.call_id;
59599
+ if (entry2.split.targetTable === "history_tool_call" && typeof callId === "string" && callId.length > 0 && typeof entry2.normalized.session_id === "string") {
59600
+ toolCallRows.set(toolCallKey(resolvedSource, entry2.normalized.session_id, callId), {
59601
+ recordHash: entry2.recordHash,
59602
+ messageTsMs: assistantTs?.get(`${entry2.normalized.session_id}${TOOL_CALL_KEY_SEP}${entry2.normalized.seq}`)
59517
59603
  });
59518
59604
  }
59519
59605
  }
59520
59606
  }
59521
59607
  const existing = await ledgerExistingHashes(options.db, prepared.map((e) => e.recordHash));
59522
- const accepted = prepared.filter((entry) => {
59523
- if (existing.has(entry.recordHash)) {
59608
+ const accepted = prepared.filter((entry2) => {
59609
+ if (existing.has(entry2.recordHash)) {
59524
59610
  skippedDuplicates += 1;
59525
59611
  return false;
59526
59612
  }
59527
59613
  return true;
59528
59614
  });
59615
+ if (!options.dryRun) {
59616
+ for (const entry2 of accepted) {
59617
+ if (ensuredTargetTables.has(entry2.split.targetTable))
59618
+ continue;
59619
+ await ensureTargetTable(options.db, entry2.split.targetTable);
59620
+ ensuredTargetTables.add(entry2.split.targetTable);
59621
+ }
59622
+ }
59529
59623
  const recordHashBySplitIndex = new Map(prepared.map((e) => [e.splitIndex, e.recordHash]));
59530
59624
  const ops = [];
59531
- for (const entry of accepted) {
59532
- const { split, splitIndex, normalized, recordHash } = entry;
59625
+ for (const entry2 of accepted) {
59626
+ const { split, splitIndex, normalized, recordHash } = entry2;
59533
59627
  if (normalized.disposition === "unknown") {
59534
59628
  unknownRecords += 1;
59535
59629
  }
@@ -59542,8 +59636,24 @@ async function runJsonlImport(source, options) {
59542
59636
  }
59543
59637
  }
59544
59638
  if (!options.dryRun) {
59639
+ const carrier = normalized._codexUsageCarrier;
59640
+ delete normalized._codexUsageCarrier;
59641
+ if (carrier !== undefined && typeof normalized.session_id === "string" && codexLastAssistant.has(normalized.session_id)) {
59642
+ ops.push({
59643
+ sql: "UPDATE history_message SET input_tokens = ?, output_tokens = ?, cache_read_tokens = ? WHERE record_hash = ?",
59644
+ params: [
59645
+ carrier.input,
59646
+ carrier.output,
59647
+ carrier.cacheRead,
59648
+ codexLastAssistant.get(normalized.session_id)
59649
+ ]
59650
+ });
59651
+ }
59545
59652
  ops.push(recordInsertOp(split.targetTable, recordHash, file2, lineNumber, splitIndex, normalized, options.now));
59546
59653
  ops.push(ledgerInsertOp(recordHash, resolvedSource, file2, lineNumber, splitIndex, split.targetTable, options.now));
59654
+ if (definition.source === "codex" && split.targetTable === "history_message" && normalized.role === "assistant" && typeof normalized.session_id === "string") {
59655
+ codexLastAssistant.set(normalized.session_id, recordHash);
59656
+ }
59547
59657
  }
59548
59658
  importedRecords += 1;
59549
59659
  }
@@ -59551,7 +59661,7 @@ async function runJsonlImport(source, options) {
59551
59661
  if (definition.source === "omp") {
59552
59662
  const timing = ompToolResultTiming(raw);
59553
59663
  if (timing !== null) {
59554
- const resultEntry = prepared.find((entry) => entry.split.targetTable === "history_message" && entry.normalized.role === "toolresult");
59664
+ const resultEntry = prepared.find((entry2) => entry2.split.targetTable === "history_message" && entry2.normalized.role === "toolresult");
59555
59665
  const sessionId = resultEntry?.normalized.session_id;
59556
59666
  if (typeof sessionId === "string") {
59557
59667
  let pending = toolCallRows.get(toolCallKey(resolvedSource, sessionId, timing.toolCallId));
@@ -59570,7 +59680,7 @@ async function runJsonlImport(source, options) {
59570
59680
  if (definition.source === "claude") {
59571
59681
  const timing = claudeToolResultTiming(raw);
59572
59682
  if (timing !== null) {
59573
- const resultEntry = prepared.find((entry) => entry.split.targetTable === "history_message");
59683
+ const resultEntry = prepared.find((entry2) => entry2.split.targetTable === "history_message");
59574
59684
  const sessionId = resultEntry?.normalized.session_id;
59575
59685
  if (typeof sessionId === "string") {
59576
59686
  let pending = toolCallRows.get(toolCallKey(resolvedSource, sessionId, timing.toolCallId));
@@ -59579,6 +59689,9 @@ async function runJsonlImport(source, options) {
59579
59689
  }
59580
59690
  if (pending !== undefined) {
59581
59691
  ops.push(toolCallResultBytesUpdateOp(pending.recordHash, timing.resultBytes));
59692
+ if (timing.durationMs !== undefined) {
59693
+ ops.push(toolCallDurationUpdateOp(pending.recordHash, null, null, timing.durationMs));
59694
+ }
59582
59695
  }
59583
59696
  }
59584
59697
  }
@@ -59589,6 +59702,20 @@ async function runJsonlImport(source, options) {
59589
59702
  checkpointUpdates += 1;
59590
59703
  }
59591
59704
  }
59705
+ if (!options.dryRun && mode === "incremental") {
59706
+ const statAfter = await safeStat(fileSystem, file2);
59707
+ const identityDegraded = entry !== undefined && entry.size === null && entry.mtimeMs === null;
59708
+ const identityChanged = entry !== undefined && (entry.size !== (statAfter?.size ?? null) || entry.mtimeMs !== (statAfter?.mtimeMs ?? null));
59709
+ if (statAfter !== null && !identityDegraded && (entry === undefined || identityChanged)) {
59710
+ await options.db.batch([
59711
+ checkpointUpsertOp(resolvedSource, file2, Math.max(lineNumber, checkpoint), options.now, {
59712
+ size: statAfter.size,
59713
+ mtimeMs: statAfter.mtimeMs
59714
+ })
59715
+ ]);
59716
+ checkpointUpdates += 1;
59717
+ }
59718
+ }
59592
59719
  }
59593
59720
  }
59594
59721
  let reconciliation;
@@ -59603,6 +59730,7 @@ async function runJsonlImport(source, options) {
59603
59730
  importedRecords,
59604
59731
  skippedDuplicates,
59605
59732
  skippedCorruptLines,
59733
+ skippedUnchangedFiles,
59606
59734
  unknownRecords,
59607
59735
  parseErrors,
59608
59736
  validationErrors,
@@ -59716,6 +59844,14 @@ function matchesPattern(path9, patterns) {
59716
59844
  return path9.endsWith(pattern.replace(/^\*/, ""));
59717
59845
  });
59718
59846
  }
59847
+ async function safeStat(fileSystem, file2) {
59848
+ try {
59849
+ const stat = await fileSystem.stat(file2);
59850
+ return stat === null ? null : { size: stat.size, mtimeMs: stat.mtimeMs };
59851
+ } catch {
59852
+ return null;
59853
+ }
59854
+ }
59719
59855
  async function* readLines(fileSystem, file2) {
59720
59856
  if (fileSystem.readFileStream) {
59721
59857
  yield* fileSystem.readFileStream(file2);
@@ -59736,7 +59872,7 @@ var init_importer = __esm(() => {
59736
59872
  init_sources();
59737
59873
  });
59738
59874
 
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
59875
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.43+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/opencode-importer.js
59740
59876
  async function runOpenCodeImport(options) {
59741
59877
  const paths = options.paths ?? ambientRuntimePaths2();
59742
59878
  const sourceDatabase = options.sourceDatabase ?? joinPath2(paths.home, ".local/share/opencode/opencode.db");
@@ -59839,6 +59975,7 @@ async function runOpenCodeImport(options) {
59839
59975
  importedRecords,
59840
59976
  skippedDuplicates,
59841
59977
  skippedCorruptLines: 0,
59978
+ skippedUnchangedFiles: 0,
59842
59979
  unknownRecords: 0,
59843
59980
  parseErrors,
59844
59981
  validationErrors,
@@ -59975,6 +60112,7 @@ function emptyResult(mode) {
59975
60112
  importedRecords: 0,
59976
60113
  skippedDuplicates: 0,
59977
60114
  skippedCorruptLines: 0,
60115
+ skippedUnchangedFiles: 0,
59978
60116
  unknownRecords: 0,
59979
60117
  parseErrors: [],
59980
60118
  validationErrors: [],
@@ -59991,7 +60129,7 @@ var init_opencode_importer = __esm(() => {
59991
60129
  init_redaction();
59992
60130
  });
59993
60131
 
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
60132
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.43+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/index.js
59995
60133
  var init_dist8 = __esm(() => {
59996
60134
  init_importer();
59997
60135
  init_mappers();
@@ -60000,7 +60138,7 @@ var init_dist8 = __esm(() => {
60000
60138
  init_sources();
60001
60139
  });
60002
60140
 
60003
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/extensions.js
60141
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/extensions.js
60004
60142
  function collectExtensions(sourceName, sourceDir, extensions) {
60005
60143
  if (extensions === undefined)
60006
60144
  return [];
@@ -60014,7 +60152,7 @@ function collectExtensions(sourceName, sourceDir, extensions) {
60014
60152
  }
60015
60153
  var init_extensions2 = () => {};
60016
60154
 
60017
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/types.js
60155
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/types.js
60018
60156
  function createFinding(rule, message, filePath, extras = {}) {
60019
60157
  return {
60020
60158
  ruleId: rule.id,
@@ -60085,7 +60223,7 @@ var init_types3 = __esm(() => {
60085
60223
  });
60086
60224
  });
60087
60225
 
60088
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/loader.js
60226
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/loader.js
60089
60227
  async function loadPreset(name, options) {
60090
60228
  const merged = await buildMergedRoots(options.roots.map((root) => resolvePath4(root)), options.fileSystem);
60091
60229
  const presetPath = findMergedPreset(merged, name);
@@ -60300,7 +60438,7 @@ var init_loader2 = __esm(() => {
60300
60438
  FIX_MODE_AUTHORITY = { none: 0, suggest: 1, auto: 2 };
60301
60439
  });
60302
60440
 
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
60441
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/test-stub-fixer.js
60304
60442
  function normalizeFindingPath(filePath) {
60305
60443
  if (!filePath || isAbsolutePath2(filePath))
60306
60444
  return null;
@@ -60365,7 +60503,7 @@ var init_test_stub_fixer = __esm(() => {
60365
60503
  realFileSystem = createNodeFileSystem3();
60366
60504
  });
60367
60505
 
60368
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/fixers.js
60506
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/fixers.js
60369
60507
  function registerBuiltinFixers(host, exec) {
60370
60508
  const regexFixer = new RegexFixerProvider;
60371
60509
  const pathFixer = new PathFixerProvider;
@@ -60568,7 +60706,7 @@ var init_fixers = __esm(() => {
60568
60706
  };
60569
60707
  });
60570
60708
 
60571
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/agents/shims.js
60709
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/agents/shims.js
60572
60710
  function getAgentSessionCapability(agent) {
60573
60711
  return AGENT_SESSION_CAPABILITY[agent];
60574
60712
  }
@@ -60860,7 +60998,7 @@ var init_shims = __esm(() => {
60860
60998
  ALIAS_TO_CANONICAL = Object.fromEntries(Object.values(AGENT_SHIMS).flatMap((shim) => (shim.aliases ?? []).map((alias3) => [alias3, shim.name])));
60861
60999
  });
60862
61000
 
60863
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/identity.js
61001
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/identity.js
60864
61002
  function buildIdentityPreamble(ctx) {
60865
61003
  const sections = [
60866
61004
  `You are agent \`${ctx.agentId}\` (${ctx.agentType}) in workspace \`${ctx.workspace}\`.`
@@ -60936,7 +61074,7 @@ var init_identity = __esm(() => {
60936
61074
  init_dist5();
60937
61075
  });
60938
61076
 
60939
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/slash-command.js
61077
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/slash-command.js
60940
61078
  function isClaudeStyleSlashCommand(input) {
60941
61079
  return SLASH_COMMAND_RE.test(input);
60942
61080
  }
@@ -60964,7 +61102,7 @@ var init_slash_command = __esm(() => {
60964
61102
  SLASH_COMMAND_RE = /^\/([a-zA-Z0-9._-]+):([a-zA-Z0-9._-]+)(\s.*)?$/;
60965
61103
  });
60966
61104
 
60967
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/ai-runner.js
61105
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/ai-runner.js
60968
61106
  function buildCorrelationEnv(correlation) {
60969
61107
  return {
60970
61108
  [AGENT_RUN_ID_ENV]: correlation.runId,
@@ -61102,7 +61240,7 @@ var init_ai_runner = __esm(() => {
61102
61240
  init_slash_command();
61103
61241
  });
61104
61242
 
61105
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/agent-detector.js
61243
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/agent-detector.js
61106
61244
  class AgentDetector {
61107
61245
  runner;
61108
61246
  timeout;
@@ -61178,7 +61316,7 @@ var init_agent_detector = __esm(() => {
61178
61316
  VERSION_PATTERN = /(?<version>\d+\.\d+(?:\.\d+)?)/;
61179
61317
  });
61180
61318
 
61181
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/agent-spec.js
61319
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/agent-spec.js
61182
61320
  function validateAgentId(id) {
61183
61321
  if (!/^[a-z][a-z0-9_-]{1,63}$/.test(id)) {
61184
61322
  throw new ValueError(`Invalid agent id "${id}": expected 2-64 chars, lowercase alphanumeric, "_" or "-"`);
@@ -61277,7 +61415,7 @@ var init_agent_spec = __esm(() => {
61277
61415
  };
61278
61416
  });
61279
61417
 
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
61418
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/agents/auth-shims.js
61281
61419
  function isNonEmpty(value) {
61282
61420
  return value !== undefined && value.trim().length > 0;
61283
61421
  }
@@ -61402,7 +61540,7 @@ var init_auth_shims = __esm(() => {
61402
61540
  };
61403
61541
  });
61404
61542
 
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
61543
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/model-health-probe.js
61406
61544
  class ModelHealthProbeRegistry {
61407
61545
  probes = new Map;
61408
61546
  register(providerPrefix, probe) {
@@ -61510,7 +61648,7 @@ var init_model_health_probe = __esm(() => {
61510
61648
  };
61511
61649
  });
61512
61650
 
61513
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/doctor-runner.js
61651
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/doctor-runner.js
61514
61652
  class DoctorRunner {
61515
61653
  detector;
61516
61654
  runner;
@@ -61521,6 +61659,7 @@ class DoctorRunner {
61521
61659
  executors;
61522
61660
  probeRegistry;
61523
61661
  probeTimeoutMs;
61662
+ probeAuth;
61524
61663
  constructor(options = {}) {
61525
61664
  this.runner = options.runner ?? new AiRunner;
61526
61665
  this.detector = options.agentDetector ?? new AgentDetector({ runner: this.runner });
@@ -61531,6 +61670,7 @@ class DoctorRunner {
61531
61670
  this.executors = options.executors ?? [];
61532
61671
  this.probeTimeoutMs = options.probeTimeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS;
61533
61672
  this.probeRegistry = options.probeRegistry ?? this.createDefaultRegistry();
61673
+ this.probeAuth = options.probeAuth ?? true;
61534
61674
  }
61535
61675
  createDefaultRegistry() {
61536
61676
  const registry2 = new ModelHealthProbeRegistry;
@@ -61616,7 +61756,7 @@ class DoctorRunner {
61616
61756
  const canonical = resolveAgentName(detected.name) ?? null;
61617
61757
  const tier = canonical !== null && TIER2_AGENTS.has(canonical) ? 2 : 1;
61618
61758
  this.logger.debug("checking agent", { agent: detected.name, installed: detected.installed, tier });
61619
- const authenticated = detected.installed && canonical !== null ? await isAuthenticated(canonical, {
61759
+ const authenticated = !this.probeAuth ? "unknown" : detected.installed && canonical !== null ? await isAuthenticated(canonical, {
61620
61760
  runner: this.runner,
61621
61761
  env: this.env,
61622
61762
  fileSystem: this.fs,
@@ -61647,15 +61787,15 @@ var init_doctor_runner = __esm(() => {
61647
61787
  init_model_health_probe();
61648
61788
  });
61649
61789
 
61650
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/events.js
61790
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/events.js
61651
61791
  var init_events = () => {};
61652
61792
 
61653
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/messages.js
61793
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/messages.js
61654
61794
  function formatMessage(msg) {
61655
61795
  return `[task from=${msg.fromId ?? "operator"} id=${msg.id}] ${msg.body}`;
61656
61796
  }
61657
61797
 
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
61798
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/team-agent-process.js
61659
61799
  import { Buffer as Buffer5 } from "buffer";
61660
61800
 
61661
61801
  class TeamAgentProcess {
@@ -61789,7 +61929,7 @@ var init_team_agent_process = __esm(() => {
61789
61929
  init_dist5();
61790
61930
  });
61791
61931
 
61792
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/team-orchestrator.js
61932
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/team-orchestrator.js
61793
61933
  class TeamOrchestrator {
61794
61934
  configDir;
61795
61935
  inbox;
@@ -61930,7 +62070,7 @@ var init_team_orchestrator = __esm(() => {
61930
62070
  init_team_agent_process();
61931
62071
  });
61932
62072
 
61933
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.42+2a1a28b8ddd1e341/node_modules/@gobing-ai/ts-ai-runner/dist/index.js
62073
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.43+196da29841148d73/node_modules/@gobing-ai/ts-ai-runner/dist/index.js
61934
62074
  var exports_dist3 = {};
61935
62075
  __export(exports_dist3, {
61936
62076
  validateAgentId: () => validateAgentId,
@@ -61983,7 +62123,7 @@ var init_dist9 = __esm(() => {
61983
62123
  init_team_orchestrator();
61984
62124
  });
61985
62125
 
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
62126
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/config-access.js
61987
62127
  function stringArray(value) {
61988
62128
  return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : undefined;
61989
62129
  }
@@ -62021,7 +62161,7 @@ function parseInlineFlags(source) {
62021
62161
  return { flags, rest: source.slice(match[0].length) };
62022
62162
  }
62023
62163
 
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
62164
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/glob-match.js
62025
62165
  function matchesAny(path9, patterns) {
62026
62166
  if (patterns === undefined || patterns.length === 0)
62027
62167
  return true;
@@ -62069,7 +62209,7 @@ function escapeRegExp(value) {
62069
62209
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
62070
62210
  }
62071
62211
 
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
62212
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-discovery.js
62073
62213
  async function discoverFiles2(options) {
62074
62214
  const fs3 = options.fs ?? createNodeFileSystem3();
62075
62215
  const allFiles = await walkDir2(options.workdir, fs3, DEFAULT_EXCLUDES);
@@ -62100,12 +62240,12 @@ var init_file_discovery = __esm(() => {
62100
62240
  DEFAULT_EXCLUDES = new Set([".git", "node_modules", "dist", ".coverage", ".astro", ".wrangler"]);
62101
62241
  });
62102
62242
 
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
62243
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-utils.js
62104
62244
  var init_file_utils = __esm(() => {
62105
62245
  init_file_discovery();
62106
62246
  });
62107
62247
 
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
62248
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/agent-detection-evaluator.js
62109
62249
  class AgentDetectionEvaluator {
62110
62250
  detector;
62111
62251
  constructor(detector = new AgentDetector) {
@@ -62133,7 +62273,7 @@ var init_agent_detection_evaluator = __esm(() => {
62133
62273
  init_file_utils();
62134
62274
  });
62135
62275
 
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
62276
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/coverage-gate-evaluator.js
62137
62277
  class CoverageGateEvaluator {
62138
62278
  constructor() {}
62139
62279
  async evaluate(rule, context4) {
@@ -62217,7 +62357,7 @@ var init_coverage_gate_evaluator = __esm(() => {
62217
62357
  init_file_utils();
62218
62358
  });
62219
62359
 
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
62360
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/exit-code-evaluator.js
62221
62361
  class ExitCodeEvaluator {
62222
62362
  executor;
62223
62363
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -62253,7 +62393,7 @@ var init_exit_code_evaluator = __esm(() => {
62253
62393
  init_file_utils();
62254
62394
  });
62255
62395
 
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
62396
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/forbidden-import-evaluator.js
62257
62397
  class ForbiddenImportEvaluator {
62258
62398
  constructor() {}
62259
62399
  async evaluate(rule, context4) {
@@ -62334,7 +62474,7 @@ var init_forbidden_import_evaluator = __esm(() => {
62334
62474
  init_file_utils();
62335
62475
  });
62336
62476
 
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
62477
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/import-boundary-evaluator.js
62338
62478
  class ImportBoundaryEvaluator {
62339
62479
  async evaluate(rule, context4) {
62340
62480
  const config4 = rule.evaluator.config ?? {};
@@ -62427,7 +62567,7 @@ var init_import_boundary_evaluator = __esm(() => {
62427
62567
  init_file_utils();
62428
62568
  });
62429
62569
 
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
62570
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/path-evaluator.js
62431
62571
  class PathEvaluator {
62432
62572
  constructor() {}
62433
62573
  async evaluate(rule, context4) {
@@ -62488,7 +62628,7 @@ var init_path_evaluator = __esm(() => {
62488
62628
  init_file_utils();
62489
62629
  });
62490
62630
 
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
62631
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/regex-evaluator.js
62492
62632
  class RegexEvaluator {
62493
62633
  constructor() {}
62494
62634
  async evaluate(rule, context4) {
@@ -62566,7 +62706,7 @@ var init_regex_evaluator = __esm(() => {
62566
62706
  init_file_utils();
62567
62707
  });
62568
62708
 
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
62709
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/ripgrep-evaluator.js
62570
62710
  class RipgrepEvaluator {
62571
62711
  executor;
62572
62712
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -62659,7 +62799,7 @@ var init_ripgrep_evaluator = __esm(() => {
62659
62799
  init_file_utils();
62660
62800
  });
62661
62801
 
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
62802
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/schema-artifact-evaluator.js
62663
62803
  class SchemaArtifactEvaluator {
62664
62804
  constructor() {}
62665
62805
  async evaluate(rule, context4) {
@@ -62737,7 +62877,7 @@ var init_schema_artifact_evaluator = __esm(() => {
62737
62877
  init_file_utils();
62738
62878
  });
62739
62879
 
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
62880
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/secrets-scanner-evaluator.js
62741
62881
  class SecretsScannerEvaluator {
62742
62882
  constructor() {}
62743
62883
  async evaluate(rule, context4) {
@@ -62805,7 +62945,7 @@ var init_secrets_scanner_evaluator = __esm(() => {
62805
62945
  ALL_CATEGORIES = Object.keys(BUILTIN_PATTERNS);
62806
62946
  });
62807
62947
 
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
62948
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/sg-evaluator.js
62809
62949
  class SgEvaluator {
62810
62950
  executor;
62811
62951
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -62902,7 +63042,7 @@ var init_sg_evaluator = __esm(() => {
62902
63042
  init_file_utils();
62903
63043
  });
62904
63044
 
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
63045
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/resolvers/test-path-resolver.js
62906
63046
  class TypeScriptTestPathResolver {
62907
63047
  name = "typescript";
62908
63048
  constructor() {}
@@ -62985,7 +63125,7 @@ function testify(rel) {
62985
63125
  return `${dir}test_${base2}`;
62986
63126
  }
62987
63127
 
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
63128
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/test-location-evaluator.js
62989
63129
  class TestLocationEvaluator {
62990
63130
  resolvers;
62991
63131
  constructor(resolvers) {
@@ -63060,7 +63200,7 @@ var init_test_location_evaluator = __esm(() => {
63060
63200
  TYPESCRIPT_FALLBACK = new TypeScriptTestPathResolver;
63061
63201
  });
63062
63202
 
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
63203
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/tsdoc-export-evaluator.js
63064
63204
  class TsdocExportEvaluator {
63065
63205
  constructor() {}
63066
63206
  async evaluate(rule, context4) {
@@ -63145,7 +63285,7 @@ var init_tsdoc_export_evaluator = __esm(() => {
63145
63285
  };
63146
63286
  });
63147
63287
 
63148
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/json.js
63288
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/json.js
63149
63289
  class JsonFormatter {
63150
63290
  constructor() {}
63151
63291
  format(result) {
@@ -63153,7 +63293,7 @@ class JsonFormatter {
63153
63293
  }
63154
63294
  }
63155
63295
 
63156
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/text.js
63296
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/text.js
63157
63297
  class TextFormatter {
63158
63298
  constructor() {}
63159
63299
  format(result) {
@@ -63167,7 +63307,7 @@ class TextFormatter {
63167
63307
  }
63168
63308
  }
63169
63309
 
63170
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/builtins.js
63310
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/builtins.js
63171
63311
  function registerBuiltins(host, executor) {
63172
63312
  const path9 = new PathEvaluator;
63173
63313
  host.evaluators.register("regex", new RegexEvaluator, "builtin");
@@ -63207,7 +63347,7 @@ var init_builtins = __esm(() => {
63207
63347
  init_tsdoc_export_evaluator();
63208
63348
  });
63209
63349
 
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
63350
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/rule-engine-host.js
63211
63351
  class RuleEngineHost {
63212
63352
  evaluators;
63213
63353
  formatters;
@@ -63224,7 +63364,7 @@ var init_rule_engine_host = __esm(() => {
63224
63364
  init_extension2();
63225
63365
  });
63226
63366
 
63227
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/engine.js
63367
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/engine.js
63228
63368
  class RuleEngine {
63229
63369
  host;
63230
63370
  events;
@@ -63410,7 +63550,7 @@ var init_engine = __esm(() => {
63410
63550
  init_types3();
63411
63551
  });
63412
63552
 
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
63553
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/bundled-rules.js
63414
63554
  async function bundledRulesRoot() {
63415
63555
  if (cachedRoot2 !== undefined)
63416
63556
  return cachedRoot2;
@@ -63461,7 +63601,7 @@ var init_bundled_rules = __esm(() => {
63461
63601
  init_dist5();
63462
63602
  });
63463
63603
 
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
63604
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/db-adapter.js
63465
63605
  class DbRulePersistenceAdapter {
63466
63606
  db;
63467
63607
  constructor(db2) {
@@ -63495,7 +63635,7 @@ class DbRulePersistenceAdapter {
63495
63635
  }
63496
63636
  }
63497
63637
 
63498
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/schema.js
63638
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/schema.js
63499
63639
  var RULE_ENGINE_SCHEMA_SQL = `
63500
63640
  CREATE TABLE IF NOT EXISTS rule_runs (
63501
63641
  id TEXT PRIMARY KEY,
@@ -63541,10 +63681,10 @@ CREATE TABLE IF NOT EXISTS rule_eval_runs (
63541
63681
  CREATE INDEX IF NOT EXISTS idx_rule_eval_runs_run_id ON rule_eval_runs (run_id);
63542
63682
  `;
63543
63683
 
63544
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/index.js
63684
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/index.js
63545
63685
  var init_persistence2 = () => {};
63546
63686
 
63547
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.42+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/index.js
63687
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.43+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/index.js
63548
63688
  var init_dist10 = __esm(() => {
63549
63689
  init_extensions2();
63550
63690
  init_loader2();
@@ -63626,6 +63766,13 @@ async function applyCliMigrations(adapter, migrations = CLI_MIGRATIONS) {
63626
63766
  await adapter.exec(statement);
63627
63767
  }
63628
63768
  }
63769
+ if ((migration.id === "0024_spur_cli_history_checkpoint_identity" || migration.id === "0025_spur_cli_history_checkpoint_identity_mtime") && !await tableExists(adapter, "history_import_checkpoint")) {
63770
+ await adapter.run('INSERT INTO "__spur_cli_migrations" (id, applied_at) VALUES (?, ?)', [
63771
+ migration.id,
63772
+ Date.now()
63773
+ ]);
63774
+ continue;
63775
+ }
63629
63776
  const addColumnGuard = migration.addColumnIfMissing;
63630
63777
  const shouldApplySql = addColumnGuard === undefined || !await columnExists(adapter, addColumnGuard.table, addColumnGuard.column);
63631
63778
  const tsNullableSkip = migration.id === "0016_spur_cli_history_message_ts_nullable" && (!await tableExists(adapter, "history_message") || !await columnNotNull(adapter, "history_message", "ts"));
@@ -64033,6 +64180,27 @@ FROM history_message;
64033
64180
  DROP TABLE history_message;
64034
64181
  ALTER TABLE history_message_rebuild RENAME TO history_message;
64035
64182
  CREATE INDEX IF NOT EXISTS idx_history_message_provenance_run ON history_message (provenance, run_id);
64183
+ `, AGENT_INSTANCES_MIGRATION_ID_DRAFT = "0026_spur_cli_agent_instances", AGENT_INSTANCES_DDL_DRAFT = `
64184
+ CREATE TABLE IF NOT EXISTS agent_instances (
64185
+ spec_id TEXT PRIMARY KEY,
64186
+ team_id TEXT,
64187
+ member_key TEXT NOT NULL,
64188
+ executor TEXT,
64189
+ role TEXT,
64190
+ workspace TEXT NOT NULL,
64191
+ status TEXT NOT NULL CHECK (status IN ('stopped', 'running', 'exited', 'errored')),
64192
+ pid INTEGER,
64193
+ run_id TEXT,
64194
+ generation INTEGER,
64195
+ tags TEXT NOT NULL DEFAULT '[]',
64196
+ config TEXT NOT NULL DEFAULT '{}',
64197
+ created_at INTEGER NOT NULL,
64198
+ updated_at INTEGER NOT NULL
64199
+ );
64200
+
64201
+ CREATE INDEX IF NOT EXISTS idx_agent_instances_role ON agent_instances (role);
64202
+ CREATE INDEX IF NOT EXISTS idx_agent_instances_executor ON agent_instances (executor);
64203
+ CREATE INDEX IF NOT EXISTS idx_agent_instances_team ON agent_instances (team_id);
64036
64204
  `, CLI_MIGRATIONS, CLI_MIGRATION_FILE_MARKER = "_spur_cli_";
64037
64205
  var init_migrations = __esm(() => {
64038
64206
  init_dist7();
@@ -64124,11 +64292,21 @@ ${HISTORY_RUN_SESSION_SCHEMA_SQL}
64124
64292
  {
64125
64293
  id: "0023_spur_cli_history_message_request_id_idx",
64126
64294
  sql: HISTORY_MESSAGE_REQUEST_ID_INDEX_SCHEMA_SQL
64295
+ },
64296
+ {
64297
+ id: "0024_spur_cli_history_checkpoint_identity",
64298
+ sql: "ALTER TABLE history_import_checkpoint ADD COLUMN source_size INTEGER",
64299
+ addColumnIfMissing: { table: "history_import_checkpoint", column: "source_size" }
64300
+ },
64301
+ {
64302
+ id: "0025_spur_cli_history_checkpoint_identity_mtime",
64303
+ sql: "ALTER TABLE history_import_checkpoint ADD COLUMN source_mtime_ms REAL",
64304
+ addColumnIfMissing: { table: "history_import_checkpoint", column: "source_mtime_ms" }
64127
64305
  }
64128
64306
  ];
64129
64307
  });
64130
64308
 
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
64309
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/job-queue/db-job-queue.js
64132
64310
  function queueLogger() {
64133
64311
  if (!_queueLogger)
64134
64312
  _queueLogger = getLogger2("job-queue");
@@ -64431,7 +64609,7 @@ var init_db_job_queue = __esm(() => {
64431
64609
  init_tracing2();
64432
64610
  });
64433
64611
 
64434
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/job-queue-db.js
64612
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/job-queue-db.js
64435
64613
  var exports_job_queue_db = {};
64436
64614
  __export(exports_job_queue_db, {
64437
64615
  DBQueueConsumer: () => DBQueueConsumer,
@@ -66682,6 +66860,7 @@ __export(exports_src, {
66682
66860
  stageContextLayerSchema: () => stageContextLayerSchema,
66683
66861
  stageArtifactSchema: () => stageArtifactSchema,
66684
66862
  stablePrefixesMatch: () => stablePrefixesMatch,
66863
+ specRole: () => specRole,
66685
66864
  sourceSummary: () => sourceSummary,
66686
66865
  sessionWatermarks: () => sessionWatermarks,
66687
66866
  sessionToolDurations: () => sessionToolDurations,
@@ -66909,7 +67088,9 @@ __export(exports_src, {
66909
67088
  ActionRunDao: () => ActionRunDao,
66910
67089
  AUTHORITY_LANES: () => AUTHORITY_LANES,
66911
67090
  ARTIFACT_DIRECTIONS: () => ARTIFACT_DIRECTIONS,
66912
- ARTIFACT_ARRAY_CLASSIFICATION: () => ARTIFACT_ARRAY_CLASSIFICATION
67091
+ ARTIFACT_ARRAY_CLASSIFICATION: () => ARTIFACT_ARRAY_CLASSIFICATION,
67092
+ AGENT_INSTANCES_MIGRATION_ID_DRAFT: () => AGENT_INSTANCES_MIGRATION_ID_DRAFT,
67093
+ AGENT_INSTANCES_DDL_DRAFT: () => AGENT_INSTANCES_DDL_DRAFT
66913
67094
  });
66914
67095
  var init_src2 = __esm(() => {
66915
67096
  init_db2();
@@ -67610,6 +67791,83 @@ var init_workflow_run_log_sink = __esm(() => {
67610
67791
  ];
67611
67792
  });
67612
67793
 
67794
+ // ../../packages/app/src/services/agent-instance-store.ts
67795
+ function teamTagOf(spec) {
67796
+ for (const tag of spec.tags ?? []) {
67797
+ if (tag.startsWith("team:"))
67798
+ return tag.slice("team:".length);
67799
+ }
67800
+ return null;
67801
+ }
67802
+ function memberKeyOf(specId, teamId) {
67803
+ const prefix = teamId === null ? null : `${teamId}-`;
67804
+ return prefix !== null && specId.startsWith(prefix) ? specId.slice(prefix.length) : specId;
67805
+ }
67806
+ function createFileAgentInstanceStore(listAgentSpecs) {
67807
+ async function all() {
67808
+ const specs = await listAgentSpecs();
67809
+ return specs.map((spec) => {
67810
+ const teamId = teamTagOf(spec);
67811
+ return {
67812
+ specId: spec.id,
67813
+ teamId,
67814
+ memberKey: memberKeyOf(spec.id, teamId),
67815
+ role: specRole(spec),
67816
+ executor: spec.executor ?? null,
67817
+ workspace: spec.workspace,
67818
+ tags: spec.tags,
67819
+ config: spec.config,
67820
+ status: "stopped",
67821
+ pid: null,
67822
+ runId: null,
67823
+ generation: null,
67824
+ createdAt: 0,
67825
+ updatedAt: 0
67826
+ };
67827
+ });
67828
+ }
67829
+ return {
67830
+ bySpecId: async (specId) => (await all()).find((i2) => i2.specId === specId) ?? null,
67831
+ byRole: async (role) => (await all()).filter((i2) => i2.role === role),
67832
+ byExecutor: async (executor) => (await all()).filter((i2) => i2.executor === executor)
67833
+ };
67834
+ }
67835
+ async function resolveAgentSelector(listAgentSpecs, agentConfig, selector) {
67836
+ const store = createFileAgentInstanceStore(listAgentSpecs);
67837
+ return resolveRoleTarget(store, selector, AGENT_ROLE_NAMES, agentConfig?.executors?.map((e) => e.name) ?? []);
67838
+ }
67839
+ async function resolveRoleTarget(store, selector, roles, executorNames) {
67840
+ const vocabulary = [...roles, ...executorNames];
67841
+ if (!vocabulary.includes(selector)) {
67842
+ return {
67843
+ ok: false,
67844
+ code: "unknown_selector",
67845
+ message: `--role "${selector}" is neither a known Layer-1 role nor an executor name (accepted: ${vocabulary.join(", ")})`
67846
+ };
67847
+ }
67848
+ const matches = roles.includes(selector) ? await store.byRole(selector) : await store.byExecutor(selector);
67849
+ const candidates = matches.map((m) => m.specId);
67850
+ if (matches.length === 0) {
67851
+ return {
67852
+ ok: false,
67853
+ code: "selector_unmatched",
67854
+ message: `"${selector}" resolves to count=0 instances (looked up as ${roles.includes(selector) ? "role" : "executor"}; candidates: none)`
67855
+ };
67856
+ }
67857
+ if (matches.length > 1) {
67858
+ return {
67859
+ ok: false,
67860
+ code: "selector_ambiguous",
67861
+ message: `"${selector}" resolves to count=${matches.length} instances (candidates: ${candidates.join(", ")}) \u2014 address one by its full spec id`
67862
+ };
67863
+ }
67864
+ return { ok: true, specId: candidates[0] ?? "", count: 1, candidates };
67865
+ }
67866
+ var init_agent_instance_store = __esm(() => {
67867
+ init_src();
67868
+ init_src2();
67869
+ });
67870
+
67613
67871
  // ../../packages/app/src/services/event-bridge.ts
67614
67872
  function bridgeEventBus(serverBus) {
67615
67873
  const bridge = {
@@ -67954,6 +68212,7 @@ var init_run_session_observer = __esm(() => {
67954
68212
  });
67955
68213
 
67956
68214
  // ../../packages/app/src/services/agent-service.ts
68215
+ import { createHash as createHash6 } from "crypto";
67957
68216
  import { homedir as homedir4 } from "os";
67958
68217
  import { isatty as isatty3 } from "tty";
67959
68218
 
@@ -67973,7 +68232,7 @@ class AgentService {
67973
68232
  })
67974
68233
  });
67975
68234
  const detector = deps?.detector ?? new AgentDetector({ runner });
67976
- const doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ agentDetector: detector, runner, env: this.ctx.env });
68235
+ const doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ agentDetector: detector, runner, env: this.ctx.env, probeAuth: false });
67977
68236
  return this.resolveAgent(flags, doctorRunner);
67978
68237
  }
67979
68238
  async list(opts, deps) {
@@ -67989,32 +68248,88 @@ class AgentService {
67989
68248
  }
67990
68249
  async doctor(args, deps) {
67991
68250
  const executors = this.ctx.agentConfig?.executors;
67992
- const doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ env: this.ctx.env, executors });
68251
+ const now2 = deps?.now ?? (() => Date.now());
68252
+ const fileSystem = deps?.fileSystem ?? createNodeFileSystem3(this.ctx.cwd);
67993
68253
  if (this.ctx.rolesSource === "fallback" && !args.json) {
67994
68254
  this.ctx.output.error("agent.roles: no config layer defines a table \u2014 built-in DEFAULT_AGENT_ROLES fallback in effect");
67995
68255
  }
68256
+ const runnerExecutors = args.probeHealth ? executors : executors?.map(({ name, agent }) => ({ name, agent }));
68257
+ const fingerprint2 = executorFingerprint(executors);
68258
+ let cacheInfo = { hit: false, ageMs: null, path: DOCTOR_CACHE_REL };
68259
+ const cacheOn = deps?.fileSystem !== undefined || deps?.doctorRunner === undefined;
68260
+ const serveCached = cacheOn && !args.probeHealth && !args.forceRefresh ? readFreshDoctorCache(fileSystem, fingerprint2, now2) : null;
68261
+ let doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ env: this.ctx.env, executors: runnerExecutors, probeAuth: false });
67996
68262
  if (args.agent === undefined) {
68263
+ if (serveCached !== null) {
68264
+ cacheInfo = { hit: true, ageMs: serveCached.ageMs, path: DOCTOR_CACHE_REL };
68265
+ return this.renderDoctor(serveCached.results, executors, args.json, undefined, cacheInfo);
68266
+ }
67997
68267
  const results2 = await doctorRunner.runAll();
67998
- return this.renderDoctor(results2, executors, args.json, args.agent);
68268
+ if (cacheOn && !args.probeHealth) {
68269
+ const writeErr = await writeDoctorCacheFile(fileSystem, fingerprint2, results2, now2);
68270
+ if (writeErr !== null) {
68271
+ this.ctx.output.error(`Warning: could not update ${DOCTOR_CACHE_REL}: ${writeErr}`);
68272
+ }
68273
+ }
68274
+ return this.renderDoctor(results2, executors, args.json, undefined, cacheInfo);
67999
68275
  }
68000
68276
  const roleDef = this.ctx.roles?.get(args.agent);
68001
68277
  if (roleDef !== undefined) {
68278
+ if (serveCached !== null && roleCoveredByCache(serveCached.results, executors, roleDef.tier)) {
68279
+ cacheInfo = { hit: true, ageMs: serveCached.ageMs, path: DOCTOR_CACHE_REL };
68280
+ doctorRunner = cachedDoctorRunner(serveCached.results);
68281
+ }
68002
68282
  const resolved = await this.resolveRole(args.agent, roleDef.tier, doctorRunner);
68283
+ const results2 = await doctorRunner.runAll();
68284
+ const rows = buildDoctorRows(results2, executors, this.ctx.roles);
68285
+ const rowByName = new Map(rows.map((row) => [row.executor, row]));
68286
+ const executorsConfigured = this.ctx.agentConfig?.executors ?? [];
68287
+ const ladderRows = cheapestEligibleExecutors(executorsConfigured, roleDef.tier).map((e) => rowByName.get(e.name)).filter((row) => row !== undefined);
68003
68288
  if (!resolved.ok) {
68004
68289
  if (args.json) {
68005
68290
  this.ctx.output.write(toJson({ error: { code: "agent-resolution", message: resolved.message } }));
68006
68291
  } else {
68007
- this.ctx.output.error(resolved.message);
68292
+ this.ctx.output.error(renderRoleLadder(args.agent, roleDef.tier, ladderRows, undefined));
68008
68293
  }
68009
68294
  return resolved.exitCode;
68010
68295
  }
68011
- const results2 = [await doctorRunner.runOne(resolved.executor ?? resolved.agent)];
68012
- return this.renderDoctor(results2, executors, args.json, resolved.executor ?? resolved.agent);
68296
+ const electedName = resolved.executor ?? resolved.agent;
68297
+ if (args.json) {
68298
+ const ordered = [
68299
+ ...ladderRows.filter((row) => row.executor === electedName),
68300
+ ...ladderRows.filter((row) => row.executor !== electedName)
68301
+ ];
68302
+ const entries = ordered.map((row) => {
68303
+ const result = results2.find((r) => r.agent === row.executor);
68304
+ return {
68305
+ ...withoutAuthenticated(result),
68306
+ capabilityTier: row.capabilityTier,
68307
+ model: row.model,
68308
+ roles: row.roles,
68309
+ elected: row.elected
68310
+ };
68311
+ });
68312
+ this.ctx.output.write(toJson({ agents: entries, rolesSource: this.ctx.rolesSource ?? "config", cache: cacheInfo }));
68313
+ return 0;
68314
+ }
68315
+ this.ctx.output.write(renderRoleLadder(args.agent, roleDef.tier, ladderRows, electedName));
68316
+ this.appendCacheNote(cacheInfo, args.json);
68317
+ return 0;
68318
+ }
68319
+ const cachedSelectorRow = serveCached?.results.find((r) => r.agent === args.agent);
68320
+ if (cachedSelectorRow !== undefined) {
68321
+ cacheInfo = { hit: true, ageMs: serveCached?.ageMs ?? null, path: DOCTOR_CACHE_REL };
68322
+ return this.renderDoctor([cachedSelectorRow], executors, args.json, args.agent, cacheInfo);
68013
68323
  }
68014
68324
  const results = [await doctorRunner.runOne(args.agent)];
68015
- return this.renderDoctor(results, executors, args.json, args.agent);
68325
+ return this.renderDoctor(results, executors, args.json, args.agent, cacheInfo);
68016
68326
  }
68017
- renderDoctor(results, executors, json3, agent) {
68327
+ appendCacheNote(cache2, json3) {
68328
+ if (json3 || !cache2.hit || cache2.ageMs === null)
68329
+ return;
68330
+ this.ctx.output.write(`\xB7 cached ${Math.round(cache2.ageMs / 1000)}s ago (${cache2.path}) \u2014 --force-refresh to re-detect`);
68331
+ }
68332
+ renderDoctor(results, executors, json3, agent, cache2) {
68018
68333
  const modelByExecutor = new Map((executors ?? []).filter((e) => e.model !== undefined).map((e) => [e.name, e.model]));
68019
68334
  for (const result of results) {
68020
68335
  if (result.modelStatus && (result.modelStatus.status === "quota_exhausted" || result.modelStatus.status === "unavailable")) {
@@ -68023,16 +68338,23 @@ class AgentService {
68023
68338
  }
68024
68339
  }
68025
68340
  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) };
68341
+ const rows = buildDoctorRows(results, executors, this.ctx.roles);
68342
+ const entries = rows.map((row, i2) => {
68343
+ const result = results[i2];
68344
+ return {
68345
+ ...withoutAuthenticated(result),
68346
+ capabilityTier: row.capabilityTier,
68347
+ model: row.model,
68348
+ roles: row.roles,
68349
+ elected: row.elected
68350
+ };
68030
68351
  });
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));
68352
+ const cacheField = cache2 ?? { hit: false, ageMs: null, path: DOCTOR_CACHE_REL };
68353
+ this.ctx.output.write(toJson({ agents: entries, rolesSource: this.ctx.rolesSource ?? "config", cache: cacheField }));
68034
68354
  } else {
68035
- this.ctx.output.write(renderDoctorTable(results));
68355
+ const rows = buildDoctorRows(results, executors, this.ctx.roles);
68356
+ this.ctx.output.write(agent !== undefined ? renderDoctorDetail(rows[0] ?? null) : renderDoctorTable(rows));
68357
+ this.appendCacheNote(cache2 ?? { hit: false, ageMs: null, path: DOCTOR_CACHE_REL }, false);
68036
68358
  }
68037
68359
  return results.some((result) => !result.usable && result.tier === 1) ? 1 : 0;
68038
68360
  }
@@ -68138,7 +68460,7 @@ class AgentService {
68138
68460
  ...invokeBridge !== undefined ? { processEvents: invokeBridge } : {}
68139
68461
  });
68140
68462
  const detector = deps?.detector ?? new AgentDetector({ runner });
68141
- const doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ agentDetector: detector, runner, env: this.ctx.env });
68463
+ const doctorRunner = deps?.doctorRunner ?? new DoctorRunner({ agentDetector: detector, runner, env: this.ctx.env, probeAuth: false });
68142
68464
  const resolved = await this.resolveAgent(flags, doctorRunner);
68143
68465
  if (!resolved.ok) {
68144
68466
  return { ok: false, exitCode: resolved.exitCode, message: resolved.message };
@@ -68911,6 +69233,64 @@ class AgentService {
68911
69233
  function toJson(value) {
68912
69234
  return JSON.stringify(value, null, 2);
68913
69235
  }
69236
+ function executorFingerprint(executors) {
69237
+ const lines = [...executors ?? []].sort((a2, b) => a2.name.localeCompare(b.name)).map((e) => `${e.name}|${e.agent}|${e.model ?? ""}|${getExecutorTier(e)}`);
69238
+ return createHash6("sha256").update(lines.join(`
69239
+ `)).digest("hex");
69240
+ }
69241
+ function readFreshDoctorCache(fileSystem, fingerprint2, now2) {
69242
+ try {
69243
+ const path9 = fileSystem.resolve(DOCTOR_CACHE_REL);
69244
+ if (fileSystem.exists(path9) !== true)
69245
+ return null;
69246
+ const parsed = JSON.parse(fileSystem.readFile(path9));
69247
+ if (parsed === null || typeof parsed !== "object" || parsed.schemaVersion !== 1 || typeof parsed.fingerprint !== "string" || typeof parsed.capturedAt !== "string" || !Array.isArray(parsed.results)) {
69248
+ return null;
69249
+ }
69250
+ if (parsed.fingerprint !== fingerprint2)
69251
+ return null;
69252
+ const ageMs = now2() - Date.parse(parsed.capturedAt);
69253
+ if (!Number.isFinite(ageMs) || ageMs < 0 || ageMs >= DOCTOR_CACHE_TTL_MS)
69254
+ return null;
69255
+ return { results: parsed.results, ageMs };
69256
+ } catch {
69257
+ return null;
69258
+ }
69259
+ }
69260
+ async function writeDoctorCacheFile(fileSystem, fingerprint2, results, now2) {
69261
+ try {
69262
+ const path9 = fileSystem.resolve(DOCTOR_CACHE_REL);
69263
+ const tmp = `${path9}.tmp`;
69264
+ const body = {
69265
+ schemaVersion: 1,
69266
+ fingerprint: fingerprint2,
69267
+ capturedAt: new Date(now2()).toISOString(),
69268
+ results: [...results]
69269
+ };
69270
+ await fileSystem.writeFile(tmp, JSON.stringify(body));
69271
+ await fileSystem.rename(tmp, path9);
69272
+ return null;
69273
+ } catch (err) {
69274
+ return err instanceof Error ? err.message : String(err);
69275
+ }
69276
+ }
69277
+ function roleCoveredByCache(results, executors, tier) {
69278
+ const needed = cheapestEligibleExecutors(executors ?? [], tier).map((e) => e.name);
69279
+ return needed.every((name) => results.some((r) => r.agent === name));
69280
+ }
69281
+ function cachedDoctorRunner(results) {
69282
+ const runAll = () => Promise.resolve([...results]);
69283
+ const runOne = (agent) => {
69284
+ const row = results.find((r) => r.agent === agent);
69285
+ return Promise.resolve(row ?? {
69286
+ agent,
69287
+ usable: false,
69288
+ tier: 3,
69289
+ error: "not covered by cache"
69290
+ });
69291
+ };
69292
+ return { runAll, runOne };
69293
+ }
68914
69294
  function traceSafePrompt(prompt) {
68915
69295
  const trimmed = prompt.trim();
68916
69296
  if (!TRACE_SAFE_SLASH_COMMAND.test(trimmed)) {
@@ -68961,17 +69341,43 @@ function _resetAgentServiceShimsForTest() {
68961
69341
  warnedBareBinary.clear();
68962
69342
  warnedAgentDefaultExecutor.clear();
68963
69343
  }
68964
- function renderAuth(authenticated) {
68965
- if (authenticated === "authenticated")
68966
- return "yes";
68967
- if (authenticated === "unauthenticated")
68968
- return "no";
68969
- return "?";
69344
+ function buildDoctorRows(results, executors, roles) {
69345
+ const executorByName = new Map((executors ?? []).map((e) => [e.name, e]));
69346
+ const joined = results.map((result) => {
69347
+ const executor = executorByName.get(result.agent) ?? { name: result.agent, agent: result.agent };
69348
+ return { result, capabilityTier: getExecutorTier(executor), model: executor.model ?? null };
69349
+ });
69350
+ const usableByName = new Set(joined.filter((j) => j.result.usable).map((j) => j.result.agent));
69351
+ const elections = new Map;
69352
+ if (roles !== undefined && executors !== undefined && executors.length > 0) {
69353
+ for (const [roleId, roleDef] of roles) {
69354
+ const winner = cheapestEligibleExecutors(executors, roleDef.tier).find((e) => usableByName.has(e.name));
69355
+ if (winner !== undefined)
69356
+ elections.set(roleId, winner.name);
69357
+ }
69358
+ }
69359
+ return joined.map(({ result, capabilityTier, model }) => ({
69360
+ executor: result.agent,
69361
+ agentBinary: executorByName.get(result.agent)?.agent ?? result.agent,
69362
+ usable: result.usable,
69363
+ tier: result.tier,
69364
+ capabilityTier,
69365
+ model,
69366
+ roles: roles ? [...roles].filter(([, rd]) => isTierEligible(capabilityTier, rd.tier)).map(([id]) => id) : [],
69367
+ elected: [...elections].filter(([, executorName]) => executorName === result.agent).map(([id]) => id),
69368
+ version: result.version,
69369
+ error: result.error,
69370
+ modelStatus: result.modelStatus
69371
+ }));
68970
69372
  }
68971
- function renderModelStatus(status) {
68972
- if (status === null || status === undefined)
69373
+ function renderRolesCell(row) {
69374
+ if (!row.usable || row.roles.length === 0)
68973
69375
  return "\u2014";
68974
- return status.status;
69376
+ return row.roles.map((id) => row.elected.includes(id) ? `${id}*` : id).join(",");
69377
+ }
69378
+ function withoutAuthenticated(row) {
69379
+ const { authenticated: _drop, ...rest } = row;
69380
+ return rest;
68975
69381
  }
68976
69382
  function renderDoctorTable(results) {
68977
69383
  const dash = "\u2014";
@@ -68980,31 +69386,57 @@ function renderDoctorTable(results) {
68980
69386
  return {
68981
69387
  glyph: usable ? "\u2713" : "\u2717",
68982
69388
  state: usable ? "usable" : "missing",
68983
- agent: result.agent,
68984
- tier: String(result.tier),
69389
+ executor: result.executor,
69390
+ agentBinary: result.agentBinary,
69391
+ model: result.model ?? dash,
69392
+ tier: String(result.capabilityTier),
68985
69393
  version: result.version ?? dash,
68986
- model: renderModelStatus(result.modelStatus)
69394
+ roles: renderRolesCell(result)
68987
69395
  };
68988
69396
  });
68989
69397
  const header = {
68990
69398
  glyph: " ",
68991
69399
  state: "STATUS",
68992
- agent: "AGENT",
69400
+ executor: "EXECUTOR",
69401
+ agentBinary: "AGENT",
69402
+ model: "MODEL",
68993
69403
  tier: "TIER",
68994
69404
  version: "VERSION",
68995
- model: "MODEL"
69405
+ roles: "ROLES"
68996
69406
  };
68997
69407
  const all = [header, ...rows];
68998
69408
  const width = (key) => Math.max(...all.map((row) => row[key].length));
68999
69409
  const wState = width("state");
69000
- const wAgent = width("agent");
69410
+ const wExecutor = width("executor");
69411
+ const wAgent = width("agentBinary");
69412
+ const wModel = width("model");
69001
69413
  const wTier = width("tier");
69002
69414
  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();
69415
+ 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
69416
  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(`
69417
+ const missing = rows.length - usableCount;
69418
+ const footerLines = [
69419
+ `${usableCount} usable, ${missing} missing`,
69420
+ ...results.some((result) => result.elected.length > 0) ? ["(* = elected executor for that role)"] : []
69421
+ ];
69422
+ return [line(header), ...rows.map(line), "", ...footerLines].join(`
69423
+ `);
69424
+ }
69425
+ function renderRoleLadder(role, roleTier, ladder, electedExecutor) {
69426
+ const lines = [`${role} (min tier ${roleTier}) \u2014 eligible ladder`, ""];
69427
+ if (ladder.length === 0) {
69428
+ lines.push("(no eligible executor)", "");
69429
+ }
69430
+ const wName = Math.max(...ladder.map((row) => row.executor.length));
69431
+ for (const row of ladder) {
69432
+ const glyph = row.usable ? "\u2713" : "\u2717";
69433
+ const status = row.usable ? "usable" : "missing";
69434
+ const note = row.executor === electedExecutor ? "ELECTED" : row.usable ? "eligible" : row.error ?? "not installed";
69435
+ lines.push(`${glyph} ${row.executor.padEnd(wName)} ${status}${note.length > 0 ? ` ${note}` : ""}`);
69436
+ }
69437
+ const usableCount = ladder.filter((row) => row.usable).length;
69438
+ lines.push("", `${ladder.length} eligible, ${usableCount} usable, elected: ${electedExecutor ?? "none"}`);
69439
+ return lines.join(`
69008
69440
  `);
69009
69441
  }
69010
69442
  function renderDoctorDetail(result) {
@@ -69012,12 +69444,13 @@ function renderDoctorDetail(result) {
69012
69444
  return "No result.";
69013
69445
  const lines = [];
69014
69446
  const glyph = result.usable ? "\u2713" : "\u2717";
69015
- lines.push(`${glyph} ${result.agent} (tier ${result.tier})`);
69447
+ lines.push(`${glyph} ${result.executor} (${result.capabilityTier})`);
69448
+ lines.push(` agent: ${result.agentBinary}`);
69016
69449
  lines.push(` status: ${result.usable ? "usable" : "missing"}`);
69017
69450
  lines.push(` version: ${result.version ?? "\u2014"}`);
69018
- lines.push(` auth: ${renderAuth(result.authenticated)}`);
69451
+ lines.push(` pinned: ${result.model ?? "\u2014"}`);
69019
69452
  if (result.modelStatus) {
69020
- lines.push(` model: ${result.modelStatus.status}`);
69453
+ lines.push(` health: ${result.modelStatus.status}`);
69021
69454
  lines.push(` checked: ${result.modelStatus.checkedAt}`);
69022
69455
  if (result.modelStatus.detail) {
69023
69456
  lines.push(` detail: ${result.modelStatus.detail}`);
@@ -69080,10 +69513,11 @@ function buildRoutingAttribution(result) {
69080
69513
  ...result.role !== undefined ? { role: result.role } : {},
69081
69514
  tier: tier ?? "unknown",
69082
69515
  executor: executor ?? result.agent,
69083
- source: result.source
69516
+ source: result.source,
69517
+ ...result.model !== undefined ? { model: result.model } : {}
69084
69518
  };
69085
69519
  }
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;
69520
+ 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, 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
69521
  var init_agent_service = __esm(() => {
69088
69522
  init_src2();
69089
69523
  init_dist9();
@@ -83732,23 +84166,15 @@ function stringOption2(options, key2, fallback) {
83732
84166
  return fallback;
83733
84167
  throw new Error(`Action option "${key2}" must be a string`);
83734
84168
  }
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
84169
  function parseDoctorJson(stdout) {
83743
84170
  try {
83744
84171
  const parsed = JSON.parse(stdout);
83745
84172
  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 : "";
84173
+ const usable = typeof first?.usable === "boolean" ? first.usable : true;
83748
84174
  const resolvedAgent = typeof first?.agent === "string" && first.agent.length > 0 ? first.agent : "";
83749
- return { auth, detail, resolvedAgent };
84175
+ return { usable, resolvedAgent };
83750
84176
  } catch {
83751
- return { auth: "unknown", detail: "", resolvedAgent: "" };
84177
+ return { usable: true, resolvedAgent: "" };
83752
84178
  }
83753
84179
  }
83754
84180
 
@@ -83834,24 +84260,16 @@ ${res.stderr}`.trim();
83834
84260
  status = "FAIL";
83835
84261
  continue;
83836
84262
  }
83837
- const { auth, detail, resolvedAgent } = parseDoctorJson(res.stdout);
83838
- const classifyAgainst = resolvedAgent !== "" ? resolvedAgent : exe;
83839
- const probe = classifyDoctorProbe(detail, classifyAgainst);
84263
+ const { usable, resolvedAgent } = parseDoctorJson(res.stdout);
83840
84264
  const resolvedSuffix = resolvedAgent !== "" && resolvedAgent !== exe ? ` (resolved ${resolvedAgent})` : "";
83841
- const line = `precheck: ${exe}${resolvedSuffix} auth=${auth} probe=${probe} ${detail}`.replace(/\s+$/, "");
84265
+ const line = `precheck: ${exe}${resolvedSuffix} usable=${usable}`.replace(/\s+$/, "");
83842
84266
  lines.push(line);
83843
84267
  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
- }
84268
+ if (!usable) {
84269
+ const fail = `precheck: FAIL - executor ${exe} is not usable per doctor; run ${spurBin} agent doctor ${exe} --json or pass --vars '{"agent":"<usable-executor>"}'`;
84270
+ lines.push(fail);
84271
+ emit(fail);
84272
+ status = "FAIL";
83855
84273
  }
83856
84274
  }
83857
84275
  await this.fileSystem.writeFile(normalized, `${status}
@@ -83859,14 +84277,11 @@ ${res.stderr}`.trim();
83859
84277
  return { ok: true, data: { status, resultFile: normalized, output: lines } };
83860
84278
  }
83861
84279
  }
83862
- var KIND3 = "doctor.probe", RELAY_FAMILY, ENV_MISS_PATTERN, AUTH_FAIL_PATTERN;
84280
+ var KIND3 = "doctor.probe";
83863
84281
  var init_doctor_probe = __esm(() => {
83864
84282
  init_dist5();
83865
84283
  init_observability();
83866
84284
  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
84285
  });
83871
84286
 
83872
84287
  // ../../packages/app/src/workflow/actions/file-exists.ts
@@ -85197,6 +85612,10 @@ class WorkflowAppService {
85197
85612
  if (roleErrors.length > 0) {
85198
85613
  return { ok: false, valid: false, file: file2, errors: roleErrors };
85199
85614
  }
85615
+ const varErrors = collectUndeclaredShellVarViolations(workflow);
85616
+ if (varErrors.length > 0) {
85617
+ return { ok: false, valid: false, file: file2, errors: varErrors };
85618
+ }
85200
85619
  const composition = collectCompositionAdvisory(workflow, absolute);
85201
85620
  await this.loadWorkflowExtensions(createDefaultWorkflowEngineHost(), workflow, absolute);
85202
85621
  return { ok: true, valid: true, workflow, composition };
@@ -85692,6 +86111,78 @@ function collectAgentRunRoleViolations(def) {
85692
86111
  }
85693
86112
  return violations;
85694
86113
  }
86114
+ function collectUndeclaredShellVarViolations(def) {
86115
+ const declared = new Set(Object.keys(def.vars ?? {}));
86116
+ const violations = [];
86117
+ const visitCommand = (location, command) => {
86118
+ let masked = "";
86119
+ let open = false;
86120
+ for (const ch of command) {
86121
+ if (ch === "'")
86122
+ open = !open;
86123
+ else if (!open)
86124
+ masked += ch;
86125
+ }
86126
+ const assigned = new Set;
86127
+ for (const m of command.matchAll(/\b(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\S/g)) {
86128
+ assigned.add(m[1]);
86129
+ }
86130
+ for (const m of masked.matchAll(/(?:^|\s)(?:--arg|--argjson|--slurpfile)\s+([A-Za-z_][A-Za-z0-9_]*)\b/g)) {
86131
+ assigned.add(m[1]);
86132
+ }
86133
+ for (const m of masked.matchAll(/\bfor\s+([A-Za-z_][A-Za-z0-9_]*)\s+in\b/g)) {
86134
+ assigned.add(m[1]);
86135
+ }
86136
+ 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)) {
86137
+ for (const v of (m[1] ?? "").split(/\s+/))
86138
+ assigned.add(v);
86139
+ }
86140
+ for (const m of masked.matchAll(/\$(?:\{([^}]*)\}|([A-Za-z_][A-Za-z0-9_]*))/g)) {
86141
+ const raw = m[1] ?? m[2];
86142
+ if (raw.includes("."))
86143
+ continue;
86144
+ if (/^[A-Z][A-Z0-9_]*$/.test(raw))
86145
+ continue;
86146
+ if ((masked[(m.index ?? 0) - 1] ?? "") === "\\")
86147
+ continue;
86148
+ if (declared.has(raw) || assigned.has(raw))
86149
+ continue;
86150
+ 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`);
86151
+ }
86152
+ };
86153
+ if (def.kind === "transition-flow" || def.kind === undefined) {
86154
+ const flowDef = def;
86155
+ for (const node of flowDef.nodes ?? []) {
86156
+ const cmd = node.action?.kind === "shell" ? node.action.options?.command : undefined;
86157
+ if (typeof cmd === "string" && cmd.length > 0)
86158
+ visitCommand(node.id, cmd);
86159
+ }
86160
+ for (const edge of flowDef.edges ?? []) {
86161
+ const cmd = edge.condition?.kind === "shell" ? edge.condition.options?.command : undefined;
86162
+ if (typeof cmd === "string" && cmd.length > 0)
86163
+ visitCommand(`${edge.from}\u2192${edge.to}`, cmd);
86164
+ }
86165
+ } else {
86166
+ const smDef = def;
86167
+ const walkActions = (stateId, actions) => {
86168
+ for (const [i2, action] of (actions ?? []).entries()) {
86169
+ const cmd = action.kind === "shell" ? action.options?.command : undefined;
86170
+ if (typeof cmd === "string" && cmd.length > 0)
86171
+ visitCommand(`${stateId}/action[${i2}]`, cmd);
86172
+ }
86173
+ };
86174
+ for (const state of smDef.states ?? []) {
86175
+ walkActions(state.id, state.onEnter);
86176
+ walkActions(state.id, state.onExit);
86177
+ }
86178
+ for (const trans of smDef.transitions ?? []) {
86179
+ const cmd = trans.guard?.kind === "shell" ? trans.guard.options?.command : undefined;
86180
+ if (typeof cmd === "string" && cmd.length > 0)
86181
+ visitCommand(`${trans.from}\u2192${trans.to}`, cmd);
86182
+ }
86183
+ }
86184
+ return violations;
86185
+ }
85695
86186
  function collectCompositionAdvisory(def, workflowFile) {
85696
86187
  const findings = [];
85697
86188
  let suppressed = 0;
@@ -86829,6 +87320,7 @@ __export(exports_src2, {
86829
87320
  resolveWorkflowLogRetentionDays: () => resolveWorkflowLogRetentionDays,
86830
87321
  resolveWorkflowFile: () => resolveWorkflowFile,
86831
87322
  resolveSpurServeCommand: () => resolveSpurServeCommand,
87323
+ resolveRoleTarget: () => resolveRoleTarget,
86832
87324
  resolveRetentionQuotas: () => resolveRetentionQuotas,
86833
87325
  resolvePlanningFolders: () => resolvePlanningFolders,
86834
87326
  resolveOutputLogConfig: () => resolveOutputLogConfig,
@@ -86836,6 +87328,7 @@ __export(exports_src2, {
86836
87328
  resolveConfiguredTaskDirs: () => resolveConfiguredTaskDirs,
86837
87329
  resolveAutostartSet: () => resolveAutostartSet,
86838
87330
  resolveArtifactPath: () => resolveArtifactPath,
87331
+ resolveAgentSelector: () => resolveAgentSelector,
86839
87332
  renderTesting: () => renderTesting,
86840
87333
  renderStepLine: () => renderStepLine,
86841
87334
  renderSolutionFromDiff: () => renderSolutionFromDiff,
@@ -86901,6 +87394,7 @@ __export(exports_src2, {
86901
87394
  createWorkflowEventIdentity: () => createWorkflowEventIdentity,
86902
87395
  createPsProcessInspector: () => createPsProcessInspector,
86903
87396
  createGitAlternateTree: () => createGitAlternateTree,
87397
+ createFileAgentInstanceStore: () => createFileAgentInstanceStore,
86904
87398
  configuredSecretValues: () => configuredSecretValues,
86905
87399
  computeProofInputFingerprint: () => computeProofInputFingerprint,
86906
87400
  computeExitCode: () => computeExitCode,
@@ -87016,6 +87510,7 @@ var init_src3 = __esm(async () => {
87016
87510
  init_errors7();
87017
87511
  init_agent_execution();
87018
87512
  init_workflow_run_log_sink();
87513
+ init_agent_instance_store();
87019
87514
  init_agent_service();
87020
87515
  init_anchor_qualifier();
87021
87516
  init_corpus_check();
@@ -87155,19 +87650,19 @@ var {
87155
87650
  // src/index.ts
87156
87651
  init_loader();
87157
87652
 
87158
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application-node.js
87653
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/application-node.js
87159
87654
  init_dist4();
87160
87655
  init_dist5();
87161
87656
  import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "fs";
87162
87657
  import { dirname as dirname5 } from "path";
87163
87658
 
87164
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application/index.js
87659
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/application/index.js
87165
87660
  init_default_observers();
87166
87661
  init_event_bus();
87167
87662
  init_file_observer();
87168
87663
  init_logger3();
87169
87664
 
87170
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/scheduler/noop.js
87665
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/scheduler/noop.js
87171
87666
  class NoopSchedulerAdapter {
87172
87667
  constructor() {}
87173
87668
  register(_cron, _action) {}
@@ -87175,7 +87670,7 @@ class NoopSchedulerAdapter {
87175
87670
  async stop() {}
87176
87671
  }
87177
87672
 
87178
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/scheduler/factory.js
87673
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/scheduler/factory.js
87179
87674
  function initScheduler(adapter, cronEntries) {
87180
87675
  const resolved = adapter ?? new NoopSchedulerAdapter;
87181
87676
  if (cronEntries) {
@@ -87186,7 +87681,7 @@ function initScheduler(adapter, cronEntries) {
87186
87681
  return resolved;
87187
87682
  }
87188
87683
 
87189
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application/plugins/builtins.js
87684
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/application/plugins/builtins.js
87190
87685
  init_logger3();
87191
87686
  init_metrics();
87192
87687
  init_sdk();
@@ -87279,7 +87774,7 @@ function dbPlugin(db2) {
87279
87774
  };
87280
87775
  }
87281
87776
 
87282
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application/plugins/host.js
87777
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/application/plugins/host.js
87283
87778
  init_logger3();
87284
87779
 
87285
87780
  class PluginHost {
@@ -87367,7 +87862,7 @@ class PluginHost {
87367
87862
  }
87368
87863
  }
87369
87864
 
87370
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application/index.js
87865
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/application/index.js
87371
87866
  async function performShutdown(state, reason) {
87372
87867
  if (state.stopped)
87373
87868
  return;
@@ -87478,10 +87973,10 @@ async function runApplication(options) {
87478
87973
  }
87479
87974
  }
87480
87975
 
87481
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application-node.js
87976
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/application-node.js
87482
87977
  init_scheduler_node();
87483
87978
 
87484
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
87979
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
87485
87980
  var import_api14 = __toESM(require_src(), 1);
87486
87981
 
87487
87982
  // ../../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 +90992,7 @@ class OTLPTraceExporter extends import_otlp_exporter_base2.OTLPExporterBase {
90497
90992
  }), JsonTraceSerializer));
90498
90993
  }
90499
90994
  }
90500
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
90995
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
90501
90996
  var import_resources2 = __toESM(require_src4(), 1);
90502
90997
  var import_sdk_trace_node = __toESM(require_src8(), 1);
90503
90998
  var import_semantic_conventions = __toESM(require_src2(), 1);
@@ -90548,7 +91043,7 @@ async function shutdownNodeTelemetry() {
90548
91043
  await Promise.all(pending);
90549
91044
  }
90550
91045
 
90551
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.42+4012563f10a1cd34/node_modules/@gobing-ai/ts-infra/dist/application-node.js
91046
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.43+db68697b5a8b90df/node_modules/@gobing-ai/ts-infra/dist/application-node.js
90552
91047
  class ConfigValidationError extends Error {
90553
91048
  constructor(message) {
90554
91049
  super(message);
@@ -94494,9 +94989,14 @@ function registerAgentCommand(program2, context4) {
94494
94989
  const code = await runAgentList(svc, context4, { json: options.json, specs: options.specs });
94495
94990
  context4.setExitCode(code);
94496
94991
  });
94497
- agent.command("doctor").description("Check agent readiness.").option(...SHARED_OPTIONS.json).argument("[agent]", "Agent to check").action(async (agentName, options) => {
94992
+ 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
94993
  const svc = context4.agentService();
94499
- const code = await svc.doctor({ json: options.json === true, agent: agentName }, undefined);
94994
+ const code = await svc.doctor({
94995
+ json: options.json === true,
94996
+ agent: agentName,
94997
+ probeHealth: options.probeHealth === true,
94998
+ forceRefresh: options.forceRefresh === true
94999
+ }, undefined);
94500
95000
  context4.setExitCode(code);
94501
95001
  });
94502
95002
  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 +95018,30 @@ function registerAgentCommand(program2, context4) {
94518
95018
  process.off("SIGTERM", onSignal);
94519
95019
  }
94520
95020
  });
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);
95021
+ 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) => {
95022
+ if (options.role !== undefined && specId !== undefined) {
95023
+ context4.setExitCode(waitUsageError(context4, options, "agent wait accepts a spec id or --role, not both"));
95024
+ return;
95025
+ }
95026
+ let targetId = specId;
95027
+ if (options.role !== undefined) {
95028
+ const resolution = await resolveAgentSelector(() => new TeamService(context4).listAgentSpecs(), context4.agentConfig, options.role);
95029
+ if (!resolution.ok) {
95030
+ context4.setExitCode(resolution.code === "unknown_selector" ? 2 : 1);
95031
+ if (options.json) {
95032
+ context4.output.write(toJson2({ error: { code: resolution.code, message: resolution.message } }));
95033
+ } else {
95034
+ context4.output.error(resolution.message);
95035
+ }
95036
+ return;
95037
+ }
95038
+ targetId = resolution.specId;
95039
+ }
95040
+ if (targetId === undefined) {
95041
+ context4.setExitCode(waitUsageError(context4, options, "agent wait requires a spec id or --role <name>"));
95042
+ return;
95043
+ }
95044
+ const code = await runAgentWait(context4, targetId, options);
94523
95045
  context4.setExitCode(code);
94524
95046
  });
94525
95047
  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) => {
@@ -95936,7 +96458,7 @@ import { createRequire } from "module";
95936
96458
  var CLI_CONFIG = {
95937
96459
  binaryName: "spur",
95938
96460
  binaryLabel: "spur",
95939
- binaryVersion: "0.3.62",
96461
+ binaryVersion: "0.3.63",
95940
96462
  configDir: ".spur",
95941
96463
  configFile: ".spur/config.yaml",
95942
96464
  databaseFile: ".spur/spur.db"
@@ -96551,9 +97073,36 @@ var DEFAULT_FROM = "operator";
96551
97073
  var DEFAULT_WATCH_INTERVAL_MS = 2000;
96552
97074
  function registerMessageCommand(program2, context4) {
96553
97075
  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) => {
97076
+ 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
97077
  const svc = new TeamService(context4);
96556
- const code = await runMessageSend(svc, context4, body, options);
97078
+ let toId = options.to;
97079
+ if (options.role !== undefined && options.to !== undefined) {
97080
+ const message = "message send accepts --to or --role, not both";
97081
+ if (options.json) {
97082
+ context4.output.write(toJson2({ error: { code: "usage", message } }));
97083
+ } else {
97084
+ context4.output.error(message);
97085
+ }
97086
+ context4.setExitCode(2);
97087
+ return;
97088
+ }
97089
+ if (options.role !== undefined) {
97090
+ const resolution = await resolveAgentSelector(() => svc.listAgentSpecs(), context4.agentConfig, options.role);
97091
+ if (!resolution.ok) {
97092
+ if (options.json) {
97093
+ context4.output.write(toJson2({ error: { code: resolution.code, message: resolution.message } }));
97094
+ } else {
97095
+ context4.output.error(resolution.message);
97096
+ }
97097
+ context4.setExitCode(resolution.code === "unknown_selector" ? 2 : 1);
97098
+ return;
97099
+ }
97100
+ toId = resolution.specId;
97101
+ }
97102
+ const code = await runMessageSend(svc, context4, body, {
97103
+ ...options,
97104
+ to: toId ?? ""
97105
+ });
96557
97106
  context4.setExitCode(code);
96558
97107
  });
96559
97108
  noun.command("inbox").description("List messages addressed to an agent.").requiredOption(...SHARED_OPTIONS.agentIdMessage).option(...SHARED_OPTIONS.json).action(async (options) => {
@@ -96600,6 +97149,14 @@ async function runMessageSend(svc, context4, body, options) {
96600
97149
  }
96601
97150
  return 2;
96602
97151
  }
97152
+ if (options.to === "") {
97153
+ if (options.json) {
97154
+ context4.output.write(toJson2({ error: { code: "usage", message: "message send requires --to <id> or --role <name>" } }));
97155
+ } else {
97156
+ context4.output.error("message send requires --to <id> or --role <name>");
97157
+ }
97158
+ return 2;
97159
+ }
96603
97160
  const from = options.from || DEFAULT_FROM;
96604
97161
  let pinnedBeforeSend = null;
96605
97162
  if (options.wait === true) {
@@ -109553,7 +110110,7 @@ import { setTimeout as sleep5 } from "timers/promises";
109553
110110
 
109554
110111
  // src/workflow/mermaid-render.ts
109555
110112
  function esc2(text4) {
109556
- return text4.replace(/"/g, "&quot;").replace(/\[/g, "&#91;").replace(/\]/g, "&#93;");
110113
+ return text4.replace(/"/g, "&quot;").replace(/\[/g, "&#91;").replace(/\]/g, "&#93;").replace(/\(/g, "&#40;").replace(/\)/g, "&#41;");
109557
110114
  }
109558
110115
  function classLine(id, cls) {
109559
110116
  return ` class ${esc2(id)} ${cls};`;
@@ -109561,7 +110118,7 @@ function classLine(id, cls) {
109561
110118
  function renderWorkflowMermaid(def) {
109562
110119
  const lines = [];
109563
110120
  lines.push("```mermaid");
109564
- lines.push("flowchart LR");
110121
+ lines.push("flowchart TD");
109565
110122
  lines.push(" classDef terminal fill:#d4edda,stroke:#1e7e34,color:#0a3d1f;");
109566
110123
  lines.push(" classDef failure fill:#f8d7da,stroke:#c62828,color:#5f1414;");
109567
110124
  lines.push(" classDef initial fill:#fff3cd,stroke:#b8860b,color:#5a4a00;");