@gobing-ai/spur 0.3.16 → 0.3.18

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 (57) hide show
  1. package/config/rules/typescript/no-biome-suppressions.yaml +3 -0
  2. package/config/workflows/wayfinder-resolution.yaml +22 -2
  3. package/package.json +9 -9
  4. package/spur.js +1905 -392
  5. package/web/_astro/BoardApp.Bwxdbc0J.js +1 -0
  6. package/web/_astro/{BoardApp.oOZMY52P.js → BoardApp.DfUXxULJ.js} +44 -44
  7. package/web/_astro/TaskDetail.CWHJA-V_.js +1 -0
  8. package/web/_astro/{arc.CmzWyu5T.js → arc.B64JH2Yw.js} +1 -1
  9. package/web/_astro/{architectureDiagram-3BPJPVTR.DEvXeSWP.js → architectureDiagram-3BPJPVTR.CNsf8RqK.js} +1 -1
  10. package/web/_astro/{blockDiagram-GPEHLZMM.DULgqAsN.js → blockDiagram-GPEHLZMM.B5L6Sdtp.js} +1 -1
  11. package/web/_astro/{c4Diagram-AAUBKEIU.CtwqGUxK.js → c4Diagram-AAUBKEIU.D2LUWzto.js} +1 -1
  12. package/web/_astro/channel.DTWaHQwD.js +1 -0
  13. package/web/_astro/{chunk-2J33WTMH.lyKyWJjV.js → chunk-2J33WTMH.BDCK4a2A.js} +1 -1
  14. package/web/_astro/{chunk-4BX2VUAB.COAavIDd.js → chunk-4BX2VUAB.DRG-P5ln.js} +1 -1
  15. package/web/_astro/{chunk-55IACEB6.EoRbsXM1.js → chunk-55IACEB6.BF6dAaDw.js} +1 -1
  16. package/web/_astro/{chunk-727SXJPM.DhjfPs_B.js → chunk-727SXJPM.GT8NEsK6.js} +1 -1
  17. package/web/_astro/{chunk-AQP2D5EJ.BgSRWTUm.js → chunk-AQP2D5EJ.C6g9Ixyp.js} +1 -1
  18. package/web/_astro/{chunk-FMBD7UC4.Dj0MuLrK.js → chunk-FMBD7UC4.37t3ZahP.js} +1 -1
  19. package/web/_astro/{chunk-ND2GUHAM.B2_roVTb.js → chunk-ND2GUHAM.CIMe94Tp.js} +1 -1
  20. package/web/_astro/{chunk-QZHKN3VN.Cr3PSROo.js → chunk-QZHKN3VN.BDk4vBSo.js} +1 -1
  21. package/web/_astro/{classDiagram-4FO5ZUOK.CXEuLRp6.js → classDiagram-4FO5ZUOK.BkZHAH5J.js} +1 -1
  22. package/web/_astro/{classDiagram-v2-Q7XG4LA2.CXEuLRp6.js → classDiagram-v2-Q7XG4LA2.BkZHAH5J.js} +1 -1
  23. package/web/_astro/{cose-bilkent-S5V4N54A._ulIkUyI.js → cose-bilkent-S5V4N54A.-vmutMeo.js} +1 -1
  24. package/web/_astro/{dagre-BM42HDAG.D5SRsv4S.js → dagre-BM42HDAG.YTN__ph-.js} +1 -1
  25. package/web/_astro/{diagram-2AECGRRQ.rMwI7OR9.js → diagram-2AECGRRQ.CpwYXr6h.js} +1 -1
  26. package/web/_astro/{diagram-5GNKFQAL.DWZ2ui2V.js → diagram-5GNKFQAL.BLW_nNiA.js} +1 -1
  27. package/web/_astro/{diagram-KO2AKTUF.DuqJ_D0B.js → diagram-KO2AKTUF.BTFC9CYM.js} +1 -1
  28. package/web/_astro/{diagram-LMA3HP47.BDxKBl9B.js → diagram-LMA3HP47.CWXHZTYF.js} +1 -1
  29. package/web/_astro/{diagram-OG6HWLK6.D6IMfAPf.js → diagram-OG6HWLK6.4DO1knJK.js} +1 -1
  30. package/web/_astro/{erDiagram-TEJ5UH35.DSsh9EFG.js → erDiagram-TEJ5UH35.eWFFCa1s.js} +1 -1
  31. package/web/_astro/{flowDiagram-I6XJVG4X.DwjNzc4e.js → flowDiagram-I6XJVG4X.Qnt78_UD.js} +1 -1
  32. package/web/_astro/{ganttDiagram-6RSMTGT7.DbYs_nXA.js → ganttDiagram-6RSMTGT7.CMqioE2G.js} +1 -1
  33. package/web/_astro/{gitGraphDiagram-PVQCEYII.DX5-xqVb.js → gitGraphDiagram-PVQCEYII.DIHrO_gc.js} +1 -1
  34. package/web/_astro/{index.BOgTYz24.css → index.Bg28MlvM.css} +1 -1
  35. package/web/_astro/{infoDiagram-5YYISTIA.jP6EGbwr.js → infoDiagram-5YYISTIA.DbzNXZsX.js} +1 -1
  36. package/web/_astro/{ishikawaDiagram-YF4QCWOH.Cn89YzBJ.js → ishikawaDiagram-YF4QCWOH.C34rBvEh.js} +1 -1
  37. package/web/_astro/{journeyDiagram-JHISSGLW.CNT2WvMT.js → journeyDiagram-JHISSGLW.B4Y56hm8.js} +1 -1
  38. package/web/_astro/{kanban-definition-UN3LZRKU.CLEZjEjD.js → kanban-definition-UN3LZRKU.CbkLbGD-.js} +1 -1
  39. package/web/_astro/{linear.Cn4ewR2z.js → linear.CJu-zQ8Y.js} +1 -1
  40. package/web/_astro/{mermaid.core.BEACwKCZ.js → mermaid.core.Cg8FpcnS.js} +4 -4
  41. package/web/_astro/{mindmap-definition-RKZ34NQL.BE9cnWaH.js → mindmap-definition-RKZ34NQL.CUS8uIx4.js} +1 -1
  42. package/web/_astro/{pieDiagram-4H26LBE5.CLcCK_JM.js → pieDiagram-4H26LBE5.DLoKfxBO.js} +1 -1
  43. package/web/_astro/{quadrantDiagram-W4KKPZXB.qw8LmkgG.js → quadrantDiagram-W4KKPZXB.C4gJNQom.js} +1 -1
  44. package/web/_astro/{requirementDiagram-4Y6WPE33.D02534qk.js → requirementDiagram-4Y6WPE33.BsiW5Ob5.js} +1 -1
  45. package/web/_astro/{sankeyDiagram-5OEKKPKP.I6nOztAU.js → sankeyDiagram-5OEKKPKP.k6qljwMr.js} +1 -1
  46. package/web/_astro/{sequenceDiagram-3UESZ5HK.CXTuiAV8.js → sequenceDiagram-3UESZ5HK.Bx0G-FfT.js} +1 -1
  47. package/web/_astro/{stateDiagram-AJRCARHV.BV-mNJRM.js → stateDiagram-AJRCARHV.CRbr10-B.js} +1 -1
  48. package/web/_astro/{stateDiagram-v2-BHNVJYJU.kF2_t5fy.js → stateDiagram-v2-BHNVJYJU.iDwcqAkR.js} +1 -1
  49. package/web/_astro/{timeline-definition-PNZ67QCA.BiIzvhe5.js → timeline-definition-PNZ67QCA.p4S9tDNI.js} +1 -1
  50. package/web/_astro/{vennDiagram-CIIHVFJN.9cR-p_zq.js → vennDiagram-CIIHVFJN.DgzRFt8Y.js} +1 -1
  51. package/web/_astro/{wardley-L42UT6IY.CwwpzGfz.js → wardley-L42UT6IY.DUFfR4J1.js} +1 -1
  52. package/web/_astro/{wardleyDiagram-YWT4CUSO.Q3hswh_f.js → wardleyDiagram-YWT4CUSO.BgE4haqE.js} +1 -1
  53. package/web/_astro/{xychartDiagram-2RQKCTM6.Co-1OW2E.js → xychartDiagram-2RQKCTM6.BnitKCz8.js} +1 -1
  54. package/web/index.html +2 -2
  55. package/web/_astro/BoardApp.BdyUxAQU.js +0 -1
  56. package/web/_astro/TaskDetail.DZVfe6fy.js +0 -1
  57. package/web/_astro/channel.C6f9ncOV.js +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.10/node_modules/@gobing-ai/ts-utils/dist/errors.js
50
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.11/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.10/node_modules/@gobing-ai/ts-utils/dist/api-response.js
61
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.11/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,10 +81,10 @@ 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.10/node_modules/@gobing-ai/ts-utils/dist/cursor.js
84
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.11/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.10/node_modules/@gobing-ai/ts-utils/dist/object.js
87
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.11/node_modules/@gobing-ai/ts-utils/dist/object.js
88
88
  function isPlainObject(value) {
89
89
  return typeof value === "object" && value !== null && !Array.isArray(value);
90
90
  }
@@ -100,7 +100,7 @@ function deepMerge(target, source) {
100
100
  return result;
101
101
  }
102
102
 
103
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.10/node_modules/@gobing-ai/ts-utils/dist/output.js
103
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.11/node_modules/@gobing-ai/ts-utils/dist/output.js
104
104
  function processStream(name) {
105
105
  const proc = globalThis.process;
106
106
  const stream = proc?.[name];
@@ -121,7 +121,7 @@ function echoError(message, target = defaultStderrTarget ?? processStream("stder
121
121
  }
122
122
  var defaultStdoutTarget, defaultStderrTarget;
123
123
 
124
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.10/node_modules/@gobing-ai/ts-utils/dist/index.js
124
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.11/node_modules/@gobing-ai/ts-utils/dist/index.js
125
125
  var init_dist = __esm(() => {
126
126
  init_api_response();
127
127
  init_cursor();
@@ -21743,7 +21743,7 @@ var init_zod = __esm(() => {
21743
21743
  init_external();
21744
21744
  });
21745
21745
 
21746
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+170d5985e987c687/node_modules/@gobing-ai/ts-runtime/dist/config.js
21746
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+92240aa39452d4a9/node_modules/@gobing-ai/ts-runtime/dist/config.js
21747
21747
  function getProcessEnv() {
21748
21748
  return process.env;
21749
21749
  }
@@ -21821,7 +21821,7 @@ var init_config = __esm(() => {
21821
21821
  };
21822
21822
  });
21823
21823
 
21824
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+170d5985e987c687/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
21824
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+92240aa39452d4a9/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
21825
21825
  import { appendFileSync, cpSync, createReadStream, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
21826
21826
  import { dirname, resolve as resolvePath } from "path";
21827
21827
  function createNodeFileSystem(root) {
@@ -21908,7 +21908,7 @@ function findProjectRoot(startDir) {
21908
21908
  }
21909
21909
  var init_file_system_node = () => {};
21910
21910
 
21911
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+170d5985e987c687/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
21911
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+92240aa39452d4a9/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
21912
21912
  var DbModuleNotInstalledError;
21913
21913
  var init_db_errors = __esm(() => {
21914
21914
  DbModuleNotInstalledError = class DbModuleNotInstalledError extends Error {
@@ -29099,7 +29099,7 @@ var init_execa = __esm(() => {
29099
29099
  } = getIpcExport());
29100
29100
  });
29101
29101
 
29102
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+170d5985e987c687/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
29102
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+92240aa39452d4a9/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
29103
29103
  import { isatty } from "tty";
29104
29104
 
29105
29105
  class NodeProcessExecutor {
@@ -29392,7 +29392,7 @@ var init_process_executor = __esm(() => {
29392
29392
  init_execa();
29393
29393
  });
29394
29394
 
29395
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+170d5985e987c687/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
29395
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+92240aa39452d4a9/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
29396
29396
  function getNodeFileSystem() {
29397
29397
  if (!_nodeFileSystem)
29398
29398
  _nodeFileSystem = createNodeFileSystem();
@@ -29452,7 +29452,7 @@ var init_runtime_node_bun = __esm(() => {
29452
29452
  };
29453
29453
  });
29454
29454
 
29455
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+170d5985e987c687/node_modules/@gobing-ai/ts-runtime/dist/context.js
29455
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+92240aa39452d4a9/node_modules/@gobing-ai/ts-runtime/dist/context.js
29456
29456
  class RuntimeContext {
29457
29457
  scope;
29458
29458
  runtimeName;
@@ -29522,7 +29522,7 @@ var init_context = __esm(() => {
29522
29522
  init_runtime_node_bun();
29523
29523
  });
29524
29524
 
29525
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+170d5985e987c687/node_modules/@gobing-ai/ts-runtime/dist/path.js
29525
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+92240aa39452d4a9/node_modules/@gobing-ai/ts-runtime/dist/path.js
29526
29526
  function normalizeSeparators(path6) {
29527
29527
  return path6.replaceAll("\\", "/");
29528
29528
  }
@@ -29583,17 +29583,17 @@ var init_path = __esm(() => {
29583
29583
  SEP = globalThis.process?.platform === "win32" ? "\\" : "/";
29584
29584
  });
29585
29585
 
29586
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+170d5985e987c687/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
29586
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+92240aa39452d4a9/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
29587
29587
  var REMOTE_SCHEMA_MAX_BYTES;
29588
29588
  var init_schema_validation = __esm(() => {
29589
29589
  init_dist2();
29590
29590
  REMOTE_SCHEMA_MAX_BYTES = 5 * 1024 * 1024;
29591
29591
  });
29592
29592
 
29593
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+170d5985e987c687/node_modules/@gobing-ai/ts-runtime/dist/types.js
29593
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+92240aa39452d4a9/node_modules/@gobing-ai/ts-runtime/dist/types.js
29594
29594
  var init_types = () => {};
29595
29595
 
29596
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+170d5985e987c687/node_modules/@gobing-ai/ts-runtime/dist/index.js
29596
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+92240aa39452d4a9/node_modules/@gobing-ai/ts-runtime/dist/index.js
29597
29597
  var init_dist3 = __esm(() => {
29598
29598
  init_config();
29599
29599
  init_context();
@@ -29602,7 +29602,7 @@ var init_dist3 = __esm(() => {
29602
29602
  init_types();
29603
29603
  });
29604
29604
 
29605
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+170d5985e987c687/node_modules/@gobing-ai/ts-runtime/dist/bun-sqlite.js
29605
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+92240aa39452d4a9/node_modules/@gobing-ai/ts-runtime/dist/bun-sqlite.js
29606
29606
  import { Database } from "bun:sqlite";
29607
29607
  var init_bun_sqlite = () => {};
29608
29608
 
@@ -33794,7 +33794,7 @@ var init_bun_sqlite2 = __esm(() => {
33794
33794
  init_session2();
33795
33795
  });
33796
33796
 
33797
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/schema/inbox-messages.js
33797
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/schema/inbox-messages.js
33798
33798
  var inboxMessages;
33799
33799
  var init_inbox_messages = __esm(() => {
33800
33800
  init_sqlite_core();
@@ -33813,7 +33813,7 @@ var init_inbox_messages = __esm(() => {
33813
33813
  }, (table2) => [index("idx_inbox_messages_to_status").on(table2.toId, table2.status)]);
33814
33814
  });
33815
33815
 
33816
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/schema/common.js
33816
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/schema/common.js
33817
33817
  function nowTimestamp() {
33818
33818
  return Date.now();
33819
33819
  }
@@ -33842,7 +33842,7 @@ var init_common3 = __esm(() => {
33842
33842
  appendOnlyColumns = buildAppendOnlyColumns();
33843
33843
  });
33844
33844
 
33845
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/schema/queue-jobs.js
33845
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/schema/queue-jobs.js
33846
33846
  var queueJobs;
33847
33847
  var init_queue_jobs = __esm(() => {
33848
33848
  init_sqlite_core();
@@ -33862,7 +33862,7 @@ var init_queue_jobs = __esm(() => {
33862
33862
  }, (table2) => [index("queue_jobs_ready_idx").on(table2.status, table2.nextRetryAt, table2.createdAt)]);
33863
33863
  });
33864
33864
 
33865
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/schema/runtime.js
33865
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/schema/runtime.js
33866
33866
  var exports_runtime = {};
33867
33867
  __export(exports_runtime, {
33868
33868
  queueJobs: () => queueJobs,
@@ -33873,7 +33873,7 @@ var init_runtime = __esm(() => {
33873
33873
  init_queue_jobs();
33874
33874
  });
33875
33875
 
33876
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/adapters/bun-sqlite.js
33876
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/adapters/bun-sqlite.js
33877
33877
  var exports_bun_sqlite = {};
33878
33878
  __export(exports_bun_sqlite, {
33879
33879
  BunSqliteAdapter: () => BunSqliteAdapter
@@ -34162,7 +34162,7 @@ var init_d1 = __esm(() => {
34162
34162
  init_session3();
34163
34163
  });
34164
34164
 
34165
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/adapters/d1.js
34165
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/adapters/d1.js
34166
34166
  var exports_d1 = {};
34167
34167
  __export(exports_d1, {
34168
34168
  D1Adapter: () => D1Adapter
@@ -34226,7 +34226,7 @@ var init_d12 = __esm(() => {
34226
34226
  init_runtime();
34227
34227
  });
34228
34228
 
34229
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/adapter.js
34229
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/adapter.js
34230
34230
  async function createDbAdapter(config3) {
34231
34231
  switch (config3.driver) {
34232
34232
  case "bun-sqlite": {
@@ -34266,7 +34266,7 @@ var init_drizzle_orm = __esm(() => {
34266
34266
  init_view_common();
34267
34267
  });
34268
34268
 
34269
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/query-spec.js
34269
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/query-spec.js
34270
34270
  function compilePredicate(predicate) {
34271
34271
  if ("and" in predicate) {
34272
34272
  const parts = predicate.and.map(compilePredicate).filter((p) => p !== undefined);
@@ -34304,7 +34304,7 @@ var init_query_spec = __esm(() => {
34304
34304
  };
34305
34305
  });
34306
34306
 
34307
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/base-dao.js
34307
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/base-dao.js
34308
34308
  function asSelectQuery(query) {
34309
34309
  return query;
34310
34310
  }
@@ -34346,7 +34346,7 @@ var init_base_dao = __esm(() => {
34346
34346
  init_query_spec();
34347
34347
  });
34348
34348
 
34349
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/embedded-migrations.js
34349
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/embedded-migrations.js
34350
34350
  var embeddedMigrations;
34351
34351
  var init_embedded_migrations = __esm(() => {
34352
34352
  embeddedMigrations = [
@@ -34378,7 +34378,7 @@ var init_embedded_migrations = __esm(() => {
34378
34378
  ];
34379
34379
  });
34380
34380
 
34381
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/entity-dao.js
34381
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/entity-dao.js
34382
34382
  var EntityDao;
34383
34383
  var init_entity_dao = __esm(() => {
34384
34384
  init_drizzle_orm();
@@ -34540,7 +34540,7 @@ var init_entity_dao = __esm(() => {
34540
34540
  };
34541
34541
  });
34542
34542
 
34543
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/inbox-message-dao.js
34543
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/inbox-message-dao.js
34544
34544
  function isPromiseLike(value) {
34545
34545
  return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
34546
34546
  }
@@ -34713,7 +34713,7 @@ var init_migrator2 = __esm(() => {
34713
34713
  init_migrator();
34714
34714
  });
34715
34715
 
34716
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/migrate.js
34716
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/migrate.js
34717
34717
  async function ensureJournalTable(adapter, table3) {
34718
34718
  await adapter.exec(`CREATE TABLE IF NOT EXISTS "${table3}" (` + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "hash text NOT NULL, " + "created_at numeric" + ")");
34719
34719
  }
@@ -34788,7 +34788,7 @@ var init_migrate = __esm(() => {
34788
34788
  init_embedded_migrations();
34789
34789
  });
34790
34790
 
34791
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/queue-job-dao.js
34791
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/queue-job-dao.js
34792
34792
  var QueueJobDao;
34793
34793
  var init_queue_job_dao = __esm(() => {
34794
34794
  init_drizzle_orm();
@@ -34929,7 +34929,7 @@ var init_queue_job_dao = __esm(() => {
34929
34929
  };
34930
34930
  });
34931
34931
 
34932
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/index.js
34932
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/index.js
34933
34933
  var exports_dist = {};
34934
34934
  __export(exports_dist, {
34935
34935
  embeddedMigrations: () => embeddedMigrations,
@@ -37251,7 +37251,7 @@ var init_src = __esm(() => {
37251
37251
  });
37252
37252
  });
37253
37253
 
37254
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/config.js
37254
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/config.js
37255
37255
  function parseYamlObject(text3) {
37256
37256
  let parsed;
37257
37257
  try {
@@ -37378,7 +37378,7 @@ var init_config2 = __esm(() => {
37378
37378
  };
37379
37379
  });
37380
37380
 
37381
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
37381
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
37382
37382
  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";
37383
37383
  import { dirname as dirname2, resolve as resolvePath3 } from "path";
37384
37384
  function createNodeFileSystem3(root) {
@@ -37465,7 +37465,7 @@ function findProjectRoot3(startDir) {
37465
37465
  }
37466
37466
  var init_file_system_node2 = () => {};
37467
37467
 
37468
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
37468
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
37469
37469
  var D1NotConfiguredError2, DbModuleNotInstalledError3;
37470
37470
  var init_db_errors2 = __esm(() => {
37471
37471
  D1NotConfiguredError2 = class D1NotConfiguredError2 extends Error {
@@ -37482,7 +37482,7 @@ var init_db_errors2 = __esm(() => {
37482
37482
  };
37483
37483
  });
37484
37484
 
37485
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/file-system-cf.js
37485
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/file-system-cf.js
37486
37486
  function createCfFileSystem2() {
37487
37487
  return {
37488
37488
  getProjectRoot: () => "/bundle",
@@ -37521,7 +37521,7 @@ function createCfFileSystem2() {
37521
37521
  }
37522
37522
  var UNSUPPORTED = "FileSystem is not available on Cloudflare Workers. Use D1, KV, or R2 for persistent storage.";
37523
37523
 
37524
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/runtime-cf.js
37524
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/runtime-cf.js
37525
37525
  var exports_runtime_cf = {};
37526
37526
  __export(exports_runtime_cf, {
37527
37527
  cloudflareWorkersFactory: () => cloudflareWorkersFactory2
@@ -37559,7 +37559,7 @@ var init_runtime_cf = __esm(() => {
37559
37559
  };
37560
37560
  });
37561
37561
 
37562
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
37562
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
37563
37563
  import { isatty as isatty2 } from "tty";
37564
37564
 
37565
37565
  class NodeProcessExecutor3 {
@@ -37899,7 +37899,7 @@ var init_process_executor2 = __esm(() => {
37899
37899
  ProcessExecutor2 = NodeProcessExecutor3;
37900
37900
  });
37901
37901
 
37902
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
37902
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
37903
37903
  var exports_runtime_node_bun = {};
37904
37904
  __export(exports_runtime_node_bun, {
37905
37905
  nodeBunFactory: () => nodeBunFactory3,
@@ -37967,7 +37967,7 @@ var init_runtime_node_bun2 = __esm(() => {
37967
37967
  };
37968
37968
  });
37969
37969
 
37970
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/platform.js
37970
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/platform.js
37971
37971
  function isCloudflareWorkerRuntime2() {
37972
37972
  return globalThis.navigator?.userAgent?.startsWith("Cloudflare-Workers") ?? false;
37973
37973
  }
@@ -37997,7 +37997,7 @@ function _resetRuntimeFactory2() {
37997
37997
  }
37998
37998
  var _factory, _runtimeName;
37999
37999
 
38000
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/context.js
38000
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/context.js
38001
38001
  class RuntimeContext2 {
38002
38002
  scope;
38003
38003
  runtimeName;
@@ -38087,7 +38087,7 @@ var init_context2 = __esm(() => {
38087
38087
  init_runtime_node_bun2();
38088
38088
  });
38089
38089
 
38090
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/path.js
38090
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/path.js
38091
38091
  function normalizeSeparators2(path7) {
38092
38092
  return path7.replaceAll("\\", "/");
38093
38093
  }
@@ -38210,7 +38210,7 @@ var init_path2 = __esm(() => {
38210
38210
  SEP2 = globalThis.process?.platform === "win32" ? "\\" : "/";
38211
38211
  });
38212
38212
 
38213
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/fs.js
38213
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/fs.js
38214
38214
  async function ensureDirForFile2(path7, fs2 = createNodeFileSystem3()) {
38215
38215
  await fs2.ensureDir(dirnamePath(path7));
38216
38216
  }
@@ -38261,7 +38261,7 @@ var init_fs = __esm(() => {
38261
38261
  init_path2();
38262
38262
  });
38263
38263
 
38264
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/process-registry.js
38264
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/process-registry.js
38265
38265
  function allocateId() {
38266
38266
  nextIdSeq += 1;
38267
38267
  return `pe_${Date.now().toString(36)}_${nextIdSeq.toString(36)}`;
@@ -38385,7 +38385,7 @@ function createInMemoryProcessRegistry2(options) {
38385
38385
  }
38386
38386
  var nextIdSeq = 0;
38387
38387
 
38388
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
38388
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
38389
38389
  async function loadStructuredConfig(path7, options = {}) {
38390
38390
  const content = await (options.fileSystem ?? createNodeFileSystem3()).readFile(path7);
38391
38391
  return await parseStructuredConfig(content, path7, options);
@@ -38662,10 +38662,10 @@ var init_schema_validation2 = __esm(() => {
38662
38662
  defaultResolve = typeof Bun !== "undefined" ? (specifier, from) => Bun.resolveSync(specifier, from) : undefined;
38663
38663
  });
38664
38664
 
38665
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/types.js
38665
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/types.js
38666
38666
  var init_types2 = () => {};
38667
38667
 
38668
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/index.js
38668
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/index.js
38669
38669
  var exports_dist2 = {};
38670
38670
  __export(exports_dist2, {
38671
38671
  writeJsonFile: () => writeJsonFile2,
@@ -40814,7 +40814,7 @@ var init_mod = __esm(() => {
40814
40814
  init_config3();
40815
40815
  });
40816
40816
 
40817
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/logger.js
40817
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/logger.js
40818
40818
  function toLogTapeLevel(level) {
40819
40819
  return level === "warn" ? "warning" : level;
40820
40820
  }
@@ -42367,7 +42367,7 @@ var require_src = __commonJS((exports) => {
42367
42367
  };
42368
42368
  });
42369
42369
 
42370
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/telemetry/sdk.js
42370
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/telemetry/sdk.js
42371
42371
  function getTelemetryConfig(configPartial = {}) {
42372
42372
  return {
42373
42373
  enabled: configPartial.enabled ?? CONFIG_DEFAULTS.enabled,
@@ -42403,7 +42403,7 @@ var init_sdk = __esm(() => {
42403
42403
  resolvedConfig = getTelemetryConfig();
42404
42404
  });
42405
42405
 
42406
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/telemetry/tracing.js
42406
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/telemetry/tracing.js
42407
42407
  function isSuppressed(tracer2) {
42408
42408
  return tracer2 === undefined && !getResolvedConfig().enabled;
42409
42409
  }
@@ -42443,7 +42443,7 @@ var init_tracing2 = __esm(() => {
42443
42443
  import_api2 = __toESM(require_src(), 1);
42444
42444
  });
42445
42445
 
42446
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/telemetry/metrics.js
42446
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/telemetry/metrics.js
42447
42447
  function getMeter() {
42448
42448
  return import_api3.metrics.getMeter(METER_NAME, METER_VERSION);
42449
42449
  }
@@ -42540,7 +42540,7 @@ var init_metrics = __esm(() => {
42540
42540
  instruments = {};
42541
42541
  });
42542
42542
 
42543
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/event-bus/event-bus.js
42543
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/event-bus/event-bus.js
42544
42544
  function busLogger() {
42545
42545
  if (!_busLogger)
42546
42546
  _busLogger = getLogger2("event-bus");
@@ -42785,7 +42785,7 @@ var init_event_bus = __esm(() => {
42785
42785
  init_metrics();
42786
42786
  });
42787
42787
 
42788
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/event-bus/default-observers.js
42788
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/event-bus/default-observers.js
42789
42789
  function obsLogger() {
42790
42790
  if (!_obsLogger)
42791
42791
  _obsLogger = getLogger2("event-bus.observers");
@@ -42849,7 +42849,7 @@ var init_default_observers = __esm(() => {
42849
42849
  init_event_bus();
42850
42850
  });
42851
42851
 
42852
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/event-bus/file-observer.js
42852
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/event-bus/file-observer.js
42853
42853
  function parentDir(filePath) {
42854
42854
  const idx = filePath.lastIndexOf("/");
42855
42855
  return idx <= 0 ? "." : filePath.slice(0, idx);
@@ -42947,7 +42947,7 @@ var init_file_observer = __esm(() => {
42947
42947
  init_logger3();
42948
42948
  });
42949
42949
 
42950
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/scheduler/node.js
42950
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/scheduler/node.js
42951
42951
  function parseInterval(cron) {
42952
42952
  const trimmed = cron.trim();
42953
42953
  const num = Number(trimmed);
@@ -43021,7 +43021,7 @@ var init_node3 = __esm(() => {
43021
43021
  init_metrics();
43022
43022
  });
43023
43023
 
43024
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/scheduler-node.js
43024
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/scheduler-node.js
43025
43025
  var exports_scheduler_node = {};
43026
43026
  __export(exports_scheduler_node, {
43027
43027
  NodeSchedulerAdapter: () => NodeSchedulerAdapter
@@ -49277,12 +49277,12 @@ var init_errors5 = __esm(() => {
49277
49277
  };
49278
49278
  });
49279
49279
 
49280
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/event-bus/index.js
49280
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/event-bus/index.js
49281
49281
  var init_event_bus2 = __esm(() => {
49282
49282
  init_event_bus();
49283
49283
  });
49284
49284
 
49285
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/api-client.js
49285
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/api-client.js
49286
49286
  function sanitizeUrlForObservability(url2) {
49287
49287
  try {
49288
49288
  const parsed = new URL(url2);
@@ -49512,12 +49512,12 @@ var init_api_client = __esm(() => {
49512
49512
  };
49513
49513
  });
49514
49514
 
49515
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/telemetry/index.js
49515
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/telemetry/index.js
49516
49516
  var init_telemetry = __esm(() => {
49517
49517
  init_tracing2();
49518
49518
  });
49519
49519
 
49520
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/index.js
49520
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/index.js
49521
49521
  var init_dist6 = __esm(() => {
49522
49522
  init_api_client();
49523
49523
  init_event_bus2();
@@ -49525,7 +49525,7 @@ var init_dist6 = __esm(() => {
49525
49525
  init_telemetry();
49526
49526
  });
49527
49527
 
49528
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/agents/shims.js
49528
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/agents/shims.js
49529
49529
  function resolveAgentName(input) {
49530
49530
  if (isCanonicalName(input))
49531
49531
  return input;
@@ -49776,7 +49776,7 @@ var init_shims = __esm(() => {
49776
49776
  ALIAS_TO_CANONICAL = Object.fromEntries(Object.values(AGENT_SHIMS).flatMap((shim) => (shim.aliases ?? []).map((alias3) => [alias3, shim.name])));
49777
49777
  });
49778
49778
 
49779
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/identity.js
49779
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/identity.js
49780
49780
  function buildIdentityPreamble(ctx) {
49781
49781
  const sections = [
49782
49782
  `You are agent \`${ctx.agentId}\` (${ctx.agentType}) in workspace \`${ctx.workspace}\`.`
@@ -49836,7 +49836,7 @@ var init_identity = __esm(() => {
49836
49836
  init_dist5();
49837
49837
  });
49838
49838
 
49839
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/slash-command.js
49839
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/slash-command.js
49840
49840
  function isClaudeStyleSlashCommand(input) {
49841
49841
  return SLASH_COMMAND_RE.test(input);
49842
49842
  }
@@ -49864,7 +49864,7 @@ var init_slash_command = __esm(() => {
49864
49864
  SLASH_COMMAND_RE = /^\/([a-zA-Z0-9._-]+):([a-zA-Z0-9._-]+)(\s.*)?$/;
49865
49865
  });
49866
49866
 
49867
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/ai-runner.js
49867
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/ai-runner.js
49868
49868
  class AiRunner {
49869
49869
  processExecutor;
49870
49870
  defaultCwd;
@@ -49982,7 +49982,7 @@ var init_ai_runner = __esm(() => {
49982
49982
  init_slash_command();
49983
49983
  });
49984
49984
 
49985
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/agent-detector.js
49985
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/agent-detector.js
49986
49986
  class AgentDetector {
49987
49987
  runner;
49988
49988
  timeout;
@@ -50058,7 +50058,7 @@ var init_agent_detector = __esm(() => {
50058
50058
  VERSION_PATTERN = /(?<version>\d+\.\d+(?:\.\d+)?)/;
50059
50059
  });
50060
50060
 
50061
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/agent-spec.js
50061
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/agent-spec.js
50062
50062
  function validateAgentId(id) {
50063
50063
  if (!/^[a-z][a-z0-9_-]{1,63}$/.test(id)) {
50064
50064
  throw new ValueError(`Invalid agent id "${id}": expected 2-64 chars, lowercase alphanumeric, "_" or "-"`);
@@ -50155,7 +50155,7 @@ var init_agent_spec = __esm(() => {
50155
50155
  };
50156
50156
  });
50157
50157
 
50158
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/agents/auth-shims.js
50158
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/agents/auth-shims.js
50159
50159
  function isNonEmpty(value) {
50160
50160
  return value !== undefined && value.trim().length > 0;
50161
50161
  }
@@ -50260,7 +50260,7 @@ var init_auth_shims = __esm(() => {
50260
50260
  };
50261
50261
  });
50262
50262
 
50263
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/model-health-probe.js
50263
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/model-health-probe.js
50264
50264
  class ModelHealthProbeRegistry {
50265
50265
  probes = new Map;
50266
50266
  register(providerPrefix, probe) {
@@ -50368,7 +50368,7 @@ var init_model_health_probe = __esm(() => {
50368
50368
  };
50369
50369
  });
50370
50370
 
50371
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/doctor-runner.js
50371
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/doctor-runner.js
50372
50372
  class DoctorRunner {
50373
50373
  detector;
50374
50374
  runner;
@@ -50505,15 +50505,15 @@ var init_doctor_runner = __esm(() => {
50505
50505
  init_model_health_probe();
50506
50506
  });
50507
50507
 
50508
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/events.js
50508
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/events.js
50509
50509
  var init_events = () => {};
50510
50510
 
50511
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/messages.js
50511
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/messages.js
50512
50512
  function formatMessage(msg) {
50513
50513
  return `[task from=${msg.fromId ?? "operator"} id=${msg.id}] ${msg.body}`;
50514
50514
  }
50515
50515
 
50516
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/team-agent-process.js
50516
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/team-agent-process.js
50517
50517
  import { Buffer as Buffer5 } from "buffer";
50518
50518
 
50519
50519
  class TeamAgentProcess {
@@ -50647,7 +50647,7 @@ var init_team_agent_process = __esm(() => {
50647
50647
  init_dist5();
50648
50648
  });
50649
50649
 
50650
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/team-orchestrator.js
50650
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/team-orchestrator.js
50651
50651
  class TeamOrchestrator {
50652
50652
  configDir;
50653
50653
  inbox;
@@ -50776,7 +50776,7 @@ var init_team_orchestrator = __esm(() => {
50776
50776
  init_team_agent_process();
50777
50777
  });
50778
50778
 
50779
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.10+443204d2f30aef7a/node_modules/@gobing-ai/ts-ai-runner/dist/index.js
50779
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.4.11+267785e00c831d29/node_modules/@gobing-ai/ts-ai-runner/dist/index.js
50780
50780
  var exports_dist3 = {};
50781
50781
  __export(exports_dist3, {
50782
50782
  validateAgentId: () => validateAgentId,
@@ -51349,58 +51349,65 @@ function computeRecordCost(record2) {
51349
51349
  const costUsd = record2.inputTokens / 1e6 * pricing.inputPricePer1M + record2.outputTokens / 1e6 * pricing.outputPricePer1M;
51350
51350
  return { ...record2, costUsd };
51351
51351
  }
51352
+ function emptyTotals() {
51353
+ return {
51354
+ inputTokens: 0,
51355
+ outputTokens: 0,
51356
+ cacheReadTokens: 0,
51357
+ cacheCreationTokens: 0,
51358
+ costUsd: 0,
51359
+ records: 0,
51360
+ recordsWithUsage: 0
51361
+ };
51362
+ }
51363
+ function accumulate(bucket, record2) {
51364
+ bucket.inputTokens += record2.inputTokens;
51365
+ bucket.outputTokens += record2.outputTokens;
51366
+ bucket.cacheReadTokens += record2.cacheReadTokens;
51367
+ bucket.cacheCreationTokens += record2.cacheCreationTokens;
51368
+ bucket.costUsd += record2.costUsd;
51369
+ bucket.records += 1;
51370
+ if (record2.usageReported)
51371
+ bucket.recordsWithUsage += 1;
51372
+ }
51352
51373
  function aggregateCosts(records) {
51353
51374
  const summary = {
51354
- totals: { inputTokens: 0, outputTokens: 0, costUsd: 0, records: 0 },
51375
+ totals: emptyTotals(),
51355
51376
  bySource: {},
51356
51377
  byModel: {},
51357
51378
  daily: []
51358
51379
  };
51359
51380
  const dailyMap = new Map;
51360
51381
  for (const record2 of records) {
51361
- summary.totals.inputTokens += record2.inputTokens;
51362
- summary.totals.outputTokens += record2.outputTokens;
51363
- summary.totals.costUsd += record2.costUsd;
51364
- summary.totals.records += 1;
51365
- const sourceEntry = summary.bySource[record2.source] ?? {
51366
- inputTokens: 0,
51367
- outputTokens: 0,
51368
- costUsd: 0,
51369
- records: 0
51370
- };
51371
- sourceEntry.inputTokens += record2.inputTokens;
51372
- sourceEntry.outputTokens += record2.outputTokens;
51373
- sourceEntry.costUsd += record2.costUsd;
51374
- sourceEntry.records += 1;
51375
- summary.bySource[record2.source] = sourceEntry;
51376
- const modelEntry = summary.byModel[record2.model] ?? { inputTokens: 0, outputTokens: 0, costUsd: 0, records: 0 };
51377
- modelEntry.inputTokens += record2.inputTokens;
51378
- modelEntry.outputTokens += record2.outputTokens;
51379
- modelEntry.costUsd += record2.costUsd;
51380
- modelEntry.records += 1;
51381
- summary.byModel[record2.model] = modelEntry;
51382
- const dailyEntry = dailyMap.get(record2.date) ?? {
51383
- date: record2.date,
51384
- inputTokens: 0,
51385
- outputTokens: 0,
51386
- costUsd: 0,
51387
- records: 0
51388
- };
51389
- dailyEntry.inputTokens += record2.inputTokens;
51390
- dailyEntry.outputTokens += record2.outputTokens;
51391
- dailyEntry.costUsd += record2.costUsd;
51392
- dailyEntry.records += 1;
51393
- dailyMap.set(record2.date, dailyEntry);
51382
+ accumulate(summary.totals, record2);
51383
+ summary.bySource[record2.source] ??= emptyTotals();
51384
+ accumulate(summary.bySource[record2.source], record2);
51385
+ summary.byModel[record2.model] ??= emptyTotals();
51386
+ accumulate(summary.byModel[record2.model], record2);
51387
+ let dailyEntry = dailyMap.get(record2.date);
51388
+ if (dailyEntry === undefined) {
51389
+ dailyEntry = { date: record2.date, ...emptyTotals() };
51390
+ dailyMap.set(record2.date, dailyEntry);
51391
+ }
51392
+ accumulate(dailyEntry, record2);
51394
51393
  }
51395
51394
  summary.daily = [...dailyMap.values()].sort(byDateAsc);
51396
51395
  return summary;
51397
51396
  }
51397
+ function cacheHitRatio(totals) {
51398
+ if (totals.recordsWithUsage === 0)
51399
+ return null;
51400
+ if (totals.inputTokens === 0)
51401
+ return null;
51402
+ return totals.cacheReadTokens / totals.inputTokens;
51403
+ }
51398
51404
  function formatSummary(summary) {
51399
51405
  const lines = [];
51400
51406
  const totalCost = summary.totals.costUsd.toFixed(2);
51401
51407
  const totalInput = (summary.totals.inputTokens / 1e6).toFixed(1);
51402
51408
  const totalOutput = (summary.totals.outputTokens / 1e6).toFixed(1);
51403
51409
  lines.push(`Total: ${totalInput}M input / ${totalOutput}M output tokens \xB7 $${totalCost} \xB7 ${summary.totals.records} records`);
51410
+ lines.push(`Cache hit: ${formatRatio(cacheHitRatio(summary.totals))} of input tokens served from cache`);
51404
51411
  lines.push("");
51405
51412
  lines.push("By source:");
51406
51413
  const sourceEntries = Object.entries(summary.bySource).sort(byCostDesc);
@@ -51418,6 +51425,9 @@ function formatSummary(summary) {
51418
51425
  return lines.join(`
51419
51426
  `);
51420
51427
  }
51428
+ function formatRatio(ratio) {
51429
+ return ratio === null ? "n/a" : `${(ratio * 100).toFixed(1)}%`;
51430
+ }
51421
51431
  function byDateAsc(a2, b) {
51422
51432
  return a2.date.localeCompare(b.date);
51423
51433
  }
@@ -51456,13 +51466,26 @@ async function queryAllEtlRecords(db2, since) {
51456
51466
  }
51457
51467
  function extractClaudeTokens(payload) {
51458
51468
  const usage = payload.usage;
51469
+ const absent = {
51470
+ inputTokens: 0,
51471
+ outputTokens: 0,
51472
+ cacheReadTokens: 0,
51473
+ cacheCreationTokens: 0,
51474
+ usageReported: false
51475
+ };
51459
51476
  if (usage === undefined || usage === null)
51460
- return { inputTokens: 0, outputTokens: 0 };
51477
+ return absent;
51461
51478
  const input = typeof usage.input_tokens === "number" ? usage.input_tokens : 0;
51462
51479
  const output2 = typeof usage.output_tokens === "number" ? usage.output_tokens : 0;
51463
51480
  const cacheRead = typeof usage.cache_read_input_tokens === "number" ? usage.cache_read_input_tokens : 0;
51464
51481
  const cacheCreate = typeof usage.cache_creation_input_tokens === "number" ? usage.cache_creation_input_tokens : 0;
51465
- return { inputTokens: input + cacheRead + cacheCreate, outputTokens: output2 };
51482
+ return {
51483
+ inputTokens: input + cacheRead + cacheCreate,
51484
+ outputTokens: output2,
51485
+ cacheReadTokens: cacheRead,
51486
+ cacheCreationTokens: cacheCreate,
51487
+ usageReported: true
51488
+ };
51466
51489
  }
51467
51490
  function etlToCostRecord(payload, source) {
51468
51491
  const tokens = extractClaudeTokens(payload);
@@ -51478,6 +51501,9 @@ function etlToCostRecord(payload, source) {
51478
51501
  model: payload.model ?? "unknown",
51479
51502
  inputTokens: tokens.inputTokens,
51480
51503
  outputTokens: tokens.outputTokens,
51504
+ cacheReadTokens: tokens.cacheReadTokens,
51505
+ cacheCreationTokens: tokens.cacheCreationTokens,
51506
+ usageReported: tokens.usageReported,
51481
51507
  costUsd: 0
51482
51508
  };
51483
51509
  }
@@ -51494,11 +51520,123 @@ var init_query2 = __esm(() => {
51494
51520
  ];
51495
51521
  });
51496
51522
 
51523
+ // ../../packages/domain/src/analytics/run-cost.ts
51524
+ function extractSessionId(action) {
51525
+ if (!action.result_json)
51526
+ return;
51527
+ try {
51528
+ const parsed = JSON.parse(action.result_json);
51529
+ const sid = parsed?.invocation;
51530
+ return typeof sid?.sessionId === "string" ? sid.sessionId : undefined;
51531
+ } catch {
51532
+ return;
51533
+ }
51534
+ }
51535
+ function extractAgentModel(action) {
51536
+ if (!action.result_json)
51537
+ return { agent: undefined, model: undefined };
51538
+ try {
51539
+ const parsed = JSON.parse(action.result_json);
51540
+ const inv = parsed?.invocation;
51541
+ return {
51542
+ agent: typeof inv?.agent === "string" ? inv.agent : undefined,
51543
+ model: typeof inv?.model === "string" ? inv.model : undefined
51544
+ };
51545
+ } catch {
51546
+ return { agent: undefined, model: undefined };
51547
+ }
51548
+ }
51549
+ async function loadAllEtlPayloads(db2) {
51550
+ const payloads = [];
51551
+ for (const table3 of SOURCE_TABLES) {
51552
+ let rows;
51553
+ try {
51554
+ rows = await db2.queryAll(`SELECT payload_json FROM ${table3}`);
51555
+ } catch {
51556
+ continue;
51557
+ }
51558
+ for (const row of rows) {
51559
+ try {
51560
+ payloads.push(JSON.parse(row.payload_json));
51561
+ } catch {}
51562
+ }
51563
+ }
51564
+ return payloads;
51565
+ }
51566
+ function matchEtlPayloads(payloads, action) {
51567
+ const sessionId = extractSessionId(action);
51568
+ if (sessionId) {
51569
+ const records2 = payloads.filter((p) => p.sessionId === sessionId);
51570
+ return { records: records2, estimated: false };
51571
+ }
51572
+ const { agent, model } = extractAgentModel(action);
51573
+ const startedAt = action.started_at ? new Date(action.started_at).getTime() : 0;
51574
+ const completedAt = action.completed_at ? new Date(action.completed_at).getTime() : Date.now();
51575
+ const records = payloads.filter((p) => {
51576
+ const record2 = p;
51577
+ const createdAt = new Date(String(record2.created_at ?? "")).getTime();
51578
+ if (Number.isNaN(createdAt))
51579
+ return false;
51580
+ if (createdAt < startedAt || createdAt > completedAt)
51581
+ return false;
51582
+ if (agent && record2.agent !== agent)
51583
+ return false;
51584
+ if (model && record2.model !== model)
51585
+ return false;
51586
+ return true;
51587
+ });
51588
+ return { records, estimated: true };
51589
+ }
51590
+ async function matchEtlForAction(db2, action) {
51591
+ const payloads = await loadAllEtlPayloads(db2);
51592
+ return matchEtlPayloads(payloads, action);
51593
+ }
51594
+ function actionCost(matchedRecords, source) {
51595
+ if (matchedRecords.length === 0) {
51596
+ return UNAVAILABLE;
51597
+ }
51598
+ const costRecords = [];
51599
+ for (const payload of matchedRecords) {
51600
+ const record2 = etlToCostRecord(payload, source);
51601
+ costRecords.push(computeRecordCost(record2));
51602
+ }
51603
+ const summary = aggregateCosts(costRecords);
51604
+ const cacheHit = cacheHitRatio(summary.totals);
51605
+ return {
51606
+ totals: summary.totals,
51607
+ cacheHit,
51608
+ estimated: false
51609
+ };
51610
+ }
51611
+ function actionCostEstimated(matchedRecords, source) {
51612
+ const cost = actionCost(matchedRecords, source);
51613
+ return matchedRecords.length === 0 ? cost : { ...cost, estimated: true };
51614
+ }
51615
+ var UNAVAILABLE;
51616
+ var init_run_cost = __esm(() => {
51617
+ init_costs();
51618
+ init_query2();
51619
+ UNAVAILABLE = Object.freeze({
51620
+ totals: {
51621
+ inputTokens: 0,
51622
+ outputTokens: 0,
51623
+ cacheReadTokens: 0,
51624
+ cacheCreationTokens: 0,
51625
+ costUsd: 0,
51626
+ records: 0,
51627
+ recordsWithUsage: 0
51628
+ },
51629
+ cacheHit: null,
51630
+ estimated: false
51631
+ });
51632
+ });
51633
+
51497
51634
  // ../../packages/domain/src/analytics/index.ts
51498
51635
  var init_analytics = __esm(() => {
51499
51636
  init_costs();
51500
51637
  init_models();
51501
51638
  init_query2();
51639
+ init_run_cost();
51502
51640
  });
51503
51641
 
51504
51642
  // ../../packages/domain/src/bdd/checklist.ts
@@ -52311,7 +52449,7 @@ var init_drizzle_zod = __esm(() => {
52311
52449
  };
52312
52450
  });
52313
52451
 
52314
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/schema/drizzle-internals.js
52452
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/schema/drizzle-internals.js
52315
52453
  function sqlExpressionToText(value) {
52316
52454
  if (typeof value !== "object" || value === null || !("queryChunks" in value)) {
52317
52455
  return;
@@ -52334,7 +52472,7 @@ function getDrizzleTableName(table3) {
52334
52472
  return String(table3[nameSym]);
52335
52473
  }
52336
52474
 
52337
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/schema/ddl.js
52475
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/schema/ddl.js
52338
52476
  function quoteIdent(name) {
52339
52477
  return `"${name.replace(/"/g, '""')}"`;
52340
52478
  }
@@ -52428,7 +52566,7 @@ var init_ddl = __esm(() => {
52428
52566
  init_sqlite_core();
52429
52567
  });
52430
52568
 
52431
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/schema/define-table.js
52569
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/schema/define-table.js
52432
52570
  function defineTable(name, columns2) {
52433
52571
  const table3 = sqliteTable(name, columns2);
52434
52572
  let insert2;
@@ -52462,7 +52600,7 @@ var init_define_table = __esm(() => {
52462
52600
  init_ddl();
52463
52601
  });
52464
52602
 
52465
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.10+86b80a818ad2648a/node_modules/@gobing-ai/ts-db/dist/schema/index.js
52603
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.4.11+3ced2785cbe4d5ed/node_modules/@gobing-ai/ts-db/dist/schema/index.js
52466
52604
  var init_schema = __esm(() => {
52467
52605
  init_sqlite_core();
52468
52606
  init_define_table();
@@ -53038,7 +53176,7 @@ var init_dao = __esm(() => {
53038
53176
  init_workspace_dao();
53039
53177
  });
53040
53178
 
53041
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/errors.js
53179
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/errors.js
53042
53180
  var WorkflowValidationError, FSMError, RunCollisionError, WorkflowResumeError;
53043
53181
  var init_errors6 = __esm(() => {
53044
53182
  WorkflowValidationError = class WorkflowValidationError extends Error {
@@ -53073,7 +53211,7 @@ var init_errors6 = __esm(() => {
53073
53211
  };
53074
53212
  });
53075
53213
 
53076
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/run-lifecycle.js
53214
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/run-lifecycle.js
53077
53215
  function runtimeBuiltins(workflowName, stateOrNodeId, runId, transitionsTaken, mode) {
53078
53216
  return {
53079
53217
  workflow: workflowName,
@@ -53322,7 +53460,7 @@ var init_run_lifecycle = __esm(() => {
53322
53460
  ];
53323
53461
  });
53324
53462
 
53325
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema.js
53463
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema.js
53326
53464
  var RESERVED_VAR_NAMES, IDENTIFIER, VarsSchema, EnvSchema, ActionDefSchema, GuardDefSchema, StateMachineWorkflowDefSchema, TransitionFlowWorkflowDefSchema, WorkflowDefSchema;
53327
53465
  var init_schema2 = __esm(() => {
53328
53466
  init_zod();
@@ -53406,7 +53544,7 @@ var init_schema2 = __esm(() => {
53406
53544
  WorkflowDefSchema = exports_external.union([StateMachineWorkflowDefSchema, TransitionFlowWorkflowDefSchema]);
53407
53545
  });
53408
53546
 
53409
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/config.js
53547
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/config.js
53410
53548
  async function loadWorkflowDef(path9, options = {}) {
53411
53549
  return parseWorkflowDef(await loadStructuredConfig(path9, options), path9);
53412
53550
  }
@@ -53565,7 +53703,7 @@ var init_config4 = __esm(() => {
53565
53703
  RUNTIME_TEMPLATE_NAMESPACES = new Set(RUNTIME_BUILTIN_KEYS);
53566
53704
  });
53567
53705
 
53568
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/extension/capability-registry.js
53706
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/extension/capability-registry.js
53569
53707
  class CapabilityRegistry {
53570
53708
  kind;
53571
53709
  capabilities = new Map;
@@ -53596,7 +53734,7 @@ class CapabilityRegistry {
53596
53734
  }
53597
53735
  }
53598
53736
 
53599
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-path.js
53737
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-path.js
53600
53738
  function assertRelativeExtensionPath(path9, options = {}) {
53601
53739
  const where = options.sourceName !== undefined ? ` declared by "${options.sourceName}"` : "";
53602
53740
  if (/^([/\\]|[A-Za-z]:[/\\])/.test(path9)) {
@@ -53607,20 +53745,20 @@ function assertRelativeExtensionPath(path9, options = {}) {
53607
53745
  }
53608
53746
  }
53609
53747
 
53610
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-loader.js
53748
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-loader.js
53611
53749
  var init_extension_loader = () => {};
53612
53750
 
53613
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/extension/index.js
53751
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/extension/index.js
53614
53752
  var init_extension = __esm(() => {
53615
53753
  init_extension_loader();
53616
53754
  });
53617
53755
 
53618
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.10+f5990ac4de041c52/node_modules/@gobing-ai/ts-runtime/dist/extension.js
53756
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.11+b7f415af47cc46d8/node_modules/@gobing-ai/ts-runtime/dist/extension.js
53619
53757
  var init_extension2 = __esm(() => {
53620
53758
  init_extension();
53621
53759
  });
53622
53760
 
53623
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/host.js
53761
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/host.js
53624
53762
  class WorkflowEngineHost {
53625
53763
  lifecycleBus;
53626
53764
  actions = new CapabilityRegistry("workflow action");
@@ -53789,7 +53927,7 @@ var init_host = __esm(() => {
53789
53927
  init_errors6();
53790
53928
  });
53791
53929
 
53792
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema-sql.js
53930
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema-sql.js
53793
53931
  var WORKFLOW_ENGINE_SCHEMA_SQL;
53794
53932
  var init_schema_sql = __esm(() => {
53795
53933
  WORKFLOW_ENGINE_SCHEMA_SQL = `
@@ -53862,7 +54000,7 @@ CREATE TABLE IF NOT EXISTS action_runs (
53862
54000
  `.trim();
53863
54001
  });
53864
54002
 
53865
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/persistence.js
54003
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/persistence.js
53866
54004
  async function applyWorkflowEngineSchema(db2) {
53867
54005
  for (const statement of WORKFLOW_ENGINE_SCHEMA_SQL.split(";")) {
53868
54006
  const sql4 = statement.trim();
@@ -53955,7 +54093,7 @@ class DbWorkflowPersistenceAdapter {
53955
54093
  ]
53956
54094
  };
53957
54095
  }
53958
- async saveActionStart(runId, node, kind) {
54096
+ async saveActionStart(runId, node, kind, _options) {
53959
54097
  const id = crypto.randomUUID();
53960
54098
  const now = Date.now();
53961
54099
  await this.db.run(`INSERT INTO action_runs (id, run_id, node, kind, status, started_at, created_at, updated_at)
@@ -54045,7 +54183,7 @@ class MemoryWorkflowPersistenceAdapter {
54045
54183
  this.runs.set(runId, { ...run, status, completed_at: completedAt });
54046
54184
  }
54047
54185
  actionRuns = [];
54048
- async saveActionStart(runId, node, kind) {
54186
+ async saveActionStart(runId, node, kind, _options) {
54049
54187
  const id = crypto.randomUUID();
54050
54188
  this.actionRuns.push({
54051
54189
  id,
@@ -54130,7 +54268,7 @@ var init_persistence = __esm(() => {
54130
54268
  init_schema_sql();
54131
54269
  });
54132
54270
 
54133
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/variables.js
54271
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/variables.js
54134
54272
  function mergeVars(workflowVars = {}, overrideVars = {}) {
54135
54273
  return { ...workflowVars, ...overrideVars };
54136
54274
  }
@@ -54190,7 +54328,7 @@ var init_variables = __esm(() => {
54190
54328
  TEMPLATE_REF = /\$\{([^}]+)\}/g;
54191
54329
  });
54192
54330
 
54193
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/action-step.js
54331
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/action-step.js
54194
54332
  async function runActionStep(action, vars, deps) {
54195
54333
  const { host, persistence, lifecycle, stateOrNodeId, runId } = deps;
54196
54334
  const resolved = resolveTemplates(action.options ?? {}, {
@@ -54198,7 +54336,7 @@ async function runActionStep(action, vars, deps) {
54198
54336
  env: deps.env,
54199
54337
  builtins: runtimeBuiltins(deps.workflowName, stateOrNodeId, runId, deps.transitionsTaken, deps.mode)
54200
54338
  });
54201
- const actionId = await persistence.saveActionStart(runId, stateOrNodeId, action.kind);
54339
+ const actionId = await persistence.saveActionStart(runId, stateOrNodeId, action.kind, resolved);
54202
54340
  const actionStartMs = Date.now();
54203
54341
  lifecycle.actionStart(stateOrNodeId, action.kind);
54204
54342
  let result;
@@ -54247,7 +54385,7 @@ var init_action_step = __esm(() => {
54247
54385
  init_variables();
54248
54386
  });
54249
54387
 
54250
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/state-machine.js
54388
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/state-machine.js
54251
54389
  class StateMachineDriver {
54252
54390
  options;
54253
54391
  constructor(options) {
@@ -54381,7 +54519,7 @@ var init_state_machine = __esm(() => {
54381
54519
  EMPTY_OUTCOME = { outcome: "completed", result: undefined };
54382
54520
  });
54383
54521
 
54384
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/transition-flow.js
54522
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/transition-flow.js
54385
54523
  class TransitionFlowDriver {
54386
54524
  options;
54387
54525
  constructor(options) {
@@ -54499,7 +54637,7 @@ var init_transition_flow = __esm(() => {
54499
54637
  init_variables();
54500
54638
  });
54501
54639
 
54502
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/service.js
54640
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/service.js
54503
54641
  class WorkflowService {
54504
54642
  host;
54505
54643
  persistence;
@@ -54697,7 +54835,7 @@ var init_service = __esm(() => {
54697
54835
  init_variables();
54698
54836
  });
54699
54837
 
54700
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/index.js
54838
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/index.js
54701
54839
  var init_dist8 = __esm(() => {
54702
54840
  init_config4();
54703
54841
  init_host();
@@ -54706,7 +54844,7 @@ var init_dist8 = __esm(() => {
54706
54844
  init_service();
54707
54845
  });
54708
54846
 
54709
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.10+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/errors.js
54847
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.11+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/errors.js
54710
54848
  var HistoryImportError;
54711
54849
  var init_errors7 = __esm(() => {
54712
54850
  HistoryImportError = class HistoryImportError extends Error {
@@ -54719,7 +54857,7 @@ var init_errors7 = __esm(() => {
54719
54857
  };
54720
54858
  });
54721
54859
 
54722
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.10+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/hash.js
54860
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.11+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/hash.js
54723
54861
  import { createHash } from "crypto";
54724
54862
  function stableJson(value) {
54725
54863
  if (Array.isArray(value)) {
@@ -54736,7 +54874,7 @@ function sha256(value) {
54736
54874
  }
54737
54875
  var init_hash = () => {};
54738
54876
 
54739
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.10+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/redaction.js
54877
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.11+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/redaction.js
54740
54878
  function redactValue(value, rules = DEFAULT_REDACTION_RULES) {
54741
54879
  if (typeof value === "string") {
54742
54880
  return rules.reduce((current, rule) => current.replace(rule.pattern, rule.replacement), value);
@@ -54773,7 +54911,7 @@ var init_redaction = __esm(() => {
54773
54911
  ];
54774
54912
  });
54775
54913
 
54776
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.10+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/schema-sql.js
54914
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.11+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/schema-sql.js
54777
54915
  var HISTORY_IMPORT_SCHEMA_SQL;
54778
54916
  var init_schema_sql2 = __esm(() => {
54779
54917
  HISTORY_IMPORT_SCHEMA_SQL = `
@@ -54860,7 +54998,7 @@ CREATE TABLE IF NOT EXISTS history_etl_openclaw (
54860
54998
  `.trim();
54861
54999
  });
54862
55000
 
54863
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.10+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/sources.js
55001
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.11+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/sources.js
54864
55002
  function firstString(...values) {
54865
55003
  for (const value of values) {
54866
55004
  if (typeof value === "string" && value.length > 0)
@@ -54948,7 +55086,7 @@ var init_sources = __esm(() => {
54948
55086
  };
54949
55087
  });
54950
55088
 
54951
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.10+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/importer.js
55089
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.11+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/importer.js
54952
55090
  async function applyHistoryImportSchema(db2) {
54953
55091
  for (const statement of HISTORY_IMPORT_SCHEMA_SQL.split(";")) {
54954
55092
  const sql4 = statement.trim();
@@ -55185,13 +55323,13 @@ var init_importer = __esm(() => {
55185
55323
  VALID_TABLE_NAME = /^history_etl_[a-z_]+$/;
55186
55324
  });
55187
55325
 
55188
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.10+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/index.js
55326
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.4.11+d5c29f764bf0e6e0/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/index.js
55189
55327
  var init_dist9 = __esm(() => {
55190
55328
  init_importer();
55191
55329
  init_schema_sql2();
55192
55330
  });
55193
55331
 
55194
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/config/extensions.js
55332
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/config/extensions.js
55195
55333
  function collectExtensions(sourceName, sourceDir, extensions) {
55196
55334
  if (extensions === undefined)
55197
55335
  return [];
@@ -55207,7 +55345,7 @@ var init_extensions = __esm(() => {
55207
55345
  init_dist5();
55208
55346
  });
55209
55347
 
55210
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/types.js
55348
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/types.js
55211
55349
  function createFinding(rule, message, filePath, extras = {}) {
55212
55350
  return {
55213
55351
  ruleId: rule.id,
@@ -55278,7 +55416,7 @@ var init_types3 = __esm(() => {
55278
55416
  });
55279
55417
  });
55280
55418
 
55281
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/config/loader.js
55419
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/config/loader.js
55282
55420
  async function loadPreset(name, options) {
55283
55421
  const merged = await buildMergedRoots(options.roots.map((root) => resolvePath4(root)), options.fileSystem);
55284
55422
  const presetPath = findMergedPreset(merged, name);
@@ -55493,7 +55631,7 @@ var init_loader2 = __esm(() => {
55493
55631
  FIX_MODE_AUTHORITY = { none: 0, suggest: 1, auto: 2 };
55494
55632
  });
55495
55633
 
55496
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/test-stub-fixer.js
55634
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/test-stub-fixer.js
55497
55635
  function normalizeFindingPath(filePath) {
55498
55636
  if (!filePath || isAbsolutePath2(filePath))
55499
55637
  return null;
@@ -55558,7 +55696,7 @@ var init_test_stub_fixer = __esm(() => {
55558
55696
  realFileSystem = createNodeFileSystem3();
55559
55697
  });
55560
55698
 
55561
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/fixers.js
55699
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/fixers.js
55562
55700
  function registerBuiltinFixers(host, exec) {
55563
55701
  const regexFixer = new RegexFixerProvider;
55564
55702
  const pathFixer = new PathFixerProvider;
@@ -55761,7 +55899,7 @@ var init_fixers = __esm(() => {
55761
55899
  };
55762
55900
  });
55763
55901
 
55764
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/config-access.js
55902
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/config-access.js
55765
55903
  function stringArray(value) {
55766
55904
  return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : undefined;
55767
55905
  }
@@ -55799,7 +55937,7 @@ function parseInlineFlags(source) {
55799
55937
  return { flags, rest: source.slice(match[0].length) };
55800
55938
  }
55801
55939
 
55802
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/glob-match.js
55940
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/glob-match.js
55803
55941
  function matchesAny(path9, patterns) {
55804
55942
  if (patterns === undefined || patterns.length === 0)
55805
55943
  return true;
@@ -55847,7 +55985,7 @@ function escapeRegExp(value) {
55847
55985
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
55848
55986
  }
55849
55987
 
55850
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-discovery.js
55988
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-discovery.js
55851
55989
  async function discoverFiles2(options) {
55852
55990
  const fs3 = options.fs ?? createNodeFileSystem3();
55853
55991
  const allFiles = await walkDir2(options.workdir, fs3, DEFAULT_EXCLUDES);
@@ -55875,12 +56013,12 @@ var init_file_discovery = __esm(() => {
55875
56013
  DEFAULT_EXCLUDES = new Set([".git", "node_modules", "dist", ".coverage", ".astro", ".wrangler"]);
55876
56014
  });
55877
56015
 
55878
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-utils.js
56016
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-utils.js
55879
56017
  var init_file_utils = __esm(() => {
55880
56018
  init_file_discovery();
55881
56019
  });
55882
56020
 
55883
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/agent-detection-evaluator.js
56021
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/agent-detection-evaluator.js
55884
56022
  class AgentDetectionEvaluator {
55885
56023
  detector;
55886
56024
  constructor(detector = new AgentDetector) {
@@ -55908,7 +56046,7 @@ var init_agent_detection_evaluator = __esm(() => {
55908
56046
  init_file_utils();
55909
56047
  });
55910
56048
 
55911
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/coverage-gate-evaluator.js
56049
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/coverage-gate-evaluator.js
55912
56050
  class CoverageGateEvaluator {
55913
56051
  constructor() {}
55914
56052
  async evaluate(rule, context4) {
@@ -55992,7 +56130,7 @@ var init_coverage_gate_evaluator = __esm(() => {
55992
56130
  init_file_utils();
55993
56131
  });
55994
56132
 
55995
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/exit-code-evaluator.js
56133
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/exit-code-evaluator.js
55996
56134
  class ExitCodeEvaluator {
55997
56135
  executor;
55998
56136
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -56028,7 +56166,7 @@ var init_exit_code_evaluator = __esm(() => {
56028
56166
  init_file_utils();
56029
56167
  });
56030
56168
 
56031
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/forbidden-import-evaluator.js
56169
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/forbidden-import-evaluator.js
56032
56170
  class ForbiddenImportEvaluator {
56033
56171
  constructor() {}
56034
56172
  async evaluate(rule, context4) {
@@ -56109,7 +56247,7 @@ var init_forbidden_import_evaluator = __esm(() => {
56109
56247
  init_file_utils();
56110
56248
  });
56111
56249
 
56112
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/import-boundary-evaluator.js
56250
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/import-boundary-evaluator.js
56113
56251
  class ImportBoundaryEvaluator {
56114
56252
  async evaluate(rule, context4) {
56115
56253
  const config4 = rule.evaluator.config ?? {};
@@ -56202,7 +56340,7 @@ var init_import_boundary_evaluator = __esm(() => {
56202
56340
  init_file_utils();
56203
56341
  });
56204
56342
 
56205
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/path-evaluator.js
56343
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/path-evaluator.js
56206
56344
  class PathEvaluator {
56207
56345
  constructor() {}
56208
56346
  async evaluate(rule, context4) {
@@ -56263,7 +56401,7 @@ var init_path_evaluator = __esm(() => {
56263
56401
  init_file_utils();
56264
56402
  });
56265
56403
 
56266
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/regex-evaluator.js
56404
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/regex-evaluator.js
56267
56405
  class RegexEvaluator {
56268
56406
  constructor() {}
56269
56407
  async evaluate(rule, context4) {
@@ -56341,7 +56479,7 @@ var init_regex_evaluator = __esm(() => {
56341
56479
  init_file_utils();
56342
56480
  });
56343
56481
 
56344
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/ripgrep-evaluator.js
56482
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/ripgrep-evaluator.js
56345
56483
  class RipgrepEvaluator {
56346
56484
  executor;
56347
56485
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -56434,7 +56572,7 @@ var init_ripgrep_evaluator = __esm(() => {
56434
56572
  init_file_utils();
56435
56573
  });
56436
56574
 
56437
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/schema-artifact-evaluator.js
56575
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/schema-artifact-evaluator.js
56438
56576
  class SchemaArtifactEvaluator {
56439
56577
  constructor() {}
56440
56578
  async evaluate(rule, context4) {
@@ -56512,7 +56650,7 @@ var init_schema_artifact_evaluator = __esm(() => {
56512
56650
  init_file_utils();
56513
56651
  });
56514
56652
 
56515
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/secrets-scanner-evaluator.js
56653
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/secrets-scanner-evaluator.js
56516
56654
  class SecretsScannerEvaluator {
56517
56655
  constructor() {}
56518
56656
  async evaluate(rule, context4) {
@@ -56580,7 +56718,7 @@ var init_secrets_scanner_evaluator = __esm(() => {
56580
56718
  ALL_CATEGORIES = Object.keys(BUILTIN_PATTERNS);
56581
56719
  });
56582
56720
 
56583
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/sg-evaluator.js
56721
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/sg-evaluator.js
56584
56722
  class SgEvaluator {
56585
56723
  executor;
56586
56724
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -56677,7 +56815,7 @@ var init_sg_evaluator = __esm(() => {
56677
56815
  init_file_utils();
56678
56816
  });
56679
56817
 
56680
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/resolvers/test-path-resolver.js
56818
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/resolvers/test-path-resolver.js
56681
56819
  class TypeScriptTestPathResolver {
56682
56820
  name = "typescript";
56683
56821
  constructor() {}
@@ -56760,7 +56898,7 @@ function testify(rel) {
56760
56898
  return `${dir}test_${base2}`;
56761
56899
  }
56762
56900
 
56763
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/test-location-evaluator.js
56901
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/test-location-evaluator.js
56764
56902
  class TestLocationEvaluator {
56765
56903
  resolvers;
56766
56904
  constructor(resolvers) {
@@ -56835,7 +56973,7 @@ var init_test_location_evaluator = __esm(() => {
56835
56973
  TYPESCRIPT_FALLBACK = new TypeScriptTestPathResolver;
56836
56974
  });
56837
56975
 
56838
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/tsdoc-export-evaluator.js
56976
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/tsdoc-export-evaluator.js
56839
56977
  class TsdocExportEvaluator {
56840
56978
  constructor() {}
56841
56979
  async evaluate(rule, context4) {
@@ -56920,7 +57058,7 @@ var init_tsdoc_export_evaluator = __esm(() => {
56920
57058
  };
56921
57059
  });
56922
57060
 
56923
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/json.js
57061
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/json.js
56924
57062
  class JsonFormatter {
56925
57063
  constructor() {}
56926
57064
  format(result) {
@@ -56928,7 +57066,7 @@ class JsonFormatter {
56928
57066
  }
56929
57067
  }
56930
57068
 
56931
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/text.js
57069
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/text.js
56932
57070
  class TextFormatter {
56933
57071
  constructor() {}
56934
57072
  format(result) {
@@ -56942,7 +57080,7 @@ class TextFormatter {
56942
57080
  }
56943
57081
  }
56944
57082
 
56945
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/host/builtins.js
57083
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/host/builtins.js
56946
57084
  function registerBuiltins(host, executor) {
56947
57085
  const path9 = new PathEvaluator;
56948
57086
  host.evaluators.register("regex", new RegexEvaluator, "builtin");
@@ -56982,7 +57120,7 @@ var init_builtins = __esm(() => {
56982
57120
  init_tsdoc_export_evaluator();
56983
57121
  });
56984
57122
 
56985
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/host/rule-engine-host.js
57123
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/host/rule-engine-host.js
56986
57124
  class RuleEngineHost {
56987
57125
  evaluators;
56988
57126
  formatters;
@@ -56999,7 +57137,7 @@ var init_rule_engine_host = __esm(() => {
56999
57137
  init_extension2();
57000
57138
  });
57001
57139
 
57002
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/engine.js
57140
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/engine.js
57003
57141
  class RuleEngine {
57004
57142
  host;
57005
57143
  events;
@@ -57170,7 +57308,7 @@ var init_engine = __esm(() => {
57170
57308
  init_types3();
57171
57309
  });
57172
57310
 
57173
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/host/bundled-rules.js
57311
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/host/bundled-rules.js
57174
57312
  async function bundledRulesRoot() {
57175
57313
  if (cachedRoot2 !== undefined)
57176
57314
  return cachedRoot2;
@@ -57221,7 +57359,7 @@ var init_bundled_rules = __esm(() => {
57221
57359
  init_dist5();
57222
57360
  });
57223
57361
 
57224
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/db-adapter.js
57362
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/db-adapter.js
57225
57363
  class DbRulePersistenceAdapter {
57226
57364
  db;
57227
57365
  constructor(db2) {
@@ -57255,7 +57393,7 @@ class DbRulePersistenceAdapter {
57255
57393
  }
57256
57394
  }
57257
57395
 
57258
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/schema.js
57396
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/schema.js
57259
57397
  var RULE_ENGINE_SCHEMA_SQL = `
57260
57398
  CREATE TABLE IF NOT EXISTS rule_runs (
57261
57399
  id TEXT PRIMARY KEY,
@@ -57301,10 +57439,10 @@ CREATE TABLE IF NOT EXISTS rule_eval_runs (
57301
57439
  CREATE INDEX IF NOT EXISTS idx_rule_eval_runs_run_id ON rule_eval_runs (run_id);
57302
57440
  `;
57303
57441
 
57304
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/index.js
57442
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/index.js
57305
57443
  var init_persistence2 = () => {};
57306
57444
 
57307
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.10+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/index.js
57445
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.4.11+eb8900f44f4776f9/node_modules/@gobing-ai/ts-rule-engine/dist/index.js
57308
57446
  var init_dist10 = __esm(() => {
57309
57447
  init_extensions();
57310
57448
  init_loader2();
@@ -57503,7 +57641,7 @@ ${SYSTEM_EVENTS_SCHEMA_SQL}
57503
57641
  ];
57504
57642
  });
57505
57643
 
57506
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/job-queue/db-job-queue.js
57644
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/job-queue/db-job-queue.js
57507
57645
  function queueLogger() {
57508
57646
  if (!_queueLogger)
57509
57647
  _queueLogger = getLogger2("job-queue");
@@ -57731,7 +57869,7 @@ var init_db_job_queue = __esm(() => {
57731
57869
  init_tracing2();
57732
57870
  });
57733
57871
 
57734
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/job-queue-db.js
57872
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/job-queue-db.js
57735
57873
  var exports_job_queue_db = {};
57736
57874
  __export(exports_job_queue_db, {
57737
57875
  DBQueueConsumer: () => DBQueueConsumer,
@@ -57778,6 +57916,673 @@ var init_db2 = __esm(() => {
57778
57916
  init_migrations();
57779
57917
  });
57780
57918
 
57919
+ // ../../packages/domain/src/envelope/fingerprint.ts
57920
+ import { createHash as createHash2 } from "crypto";
57921
+ function computeContentHash(content) {
57922
+ return createHash2("sha256").update(content, "utf-8").digest("hex");
57923
+ }
57924
+ var init_fingerprint = () => {};
57925
+
57926
+ // ../../packages/domain/src/stage-registry/schema.ts
57927
+ function isCompatibleStageVersion(consumer, record2) {
57928
+ return consumer.major === record2.major;
57929
+ }
57930
+ function bumpStageSchemaMajor(version3) {
57931
+ return { major: version3.major + 1, minor: 0 };
57932
+ }
57933
+ function bumpStageSchemaMinor(version3) {
57934
+ return { major: version3.major, minor: version3.minor + 1 };
57935
+ }
57936
+ function validateStageRecord(record2) {
57937
+ if (record2.execution.kind === "subprocess" && record2.execution.current_agent_allowed) {
57938
+ throw new StageRegistryError(`stage ${record2.id}: subprocess execution cannot claim current-agent execution`, "subprocess-current-agent", record2.id);
57939
+ }
57940
+ if (record2.mutation_class === "irreversible") {
57941
+ const hasIrreversibleExec = record2.execution.kind === "irreversible";
57942
+ const hasHitlGate = record2.execution.kind === "hitl" && (record2.execution.gate_timing === "pre" || record2.execution.gate_timing === "both");
57943
+ if (!hasIrreversibleExec && !hasHitlGate) {
57944
+ throw new StageRegistryError(`stage ${record2.id}: irreversible mutation_class requires irreversible execution or a pre/both hitl gate`, "incompatible-model-policy", record2.id);
57945
+ }
57946
+ }
57947
+ if (record2.execution.kind === "hitl" && record2.gates.length === 0) {
57948
+ throw new StageRegistryError(`stage ${record2.id}: hitl execution requires at least one gate`, "missing-gate", record2.id);
57949
+ }
57950
+ return record2;
57951
+ }
57952
+ function validateStageRegistry(records) {
57953
+ const seenIds = new Map;
57954
+ const seenAliases = new Map;
57955
+ for (const record2 of records) {
57956
+ validateStageRecord(record2);
57957
+ const prior = seenIds.get(record2.id);
57958
+ if (prior !== undefined) {
57959
+ throw new StageRegistryError(`duplicate stage id ${record2.id} (first at index ${prior})`, "duplicate-id", record2.id);
57960
+ }
57961
+ seenIds.set(record2.id, records.indexOf(record2));
57962
+ for (const alias3 of record2.aliases) {
57963
+ const owner = seenAliases.get(alias3);
57964
+ if (owner !== undefined && owner !== record2.id) {
57965
+ throw new StageRegistryError(`alias ${alias3} of stage ${record2.id} shadows stage ${owner}`, "duplicate-id", record2.id);
57966
+ }
57967
+ if (seenIds.has(alias3) && seenIds.get(alias3) !== records.indexOf(record2)) {
57968
+ throw new StageRegistryError(`alias ${alias3} of stage ${record2.id} shadows another stage id`, "duplicate-id", record2.id);
57969
+ }
57970
+ seenAliases.set(alias3, record2.id);
57971
+ }
57972
+ }
57973
+ return [...records];
57974
+ }
57975
+ function parseStageRecord(raw, consumerVersion = STAGE_REGISTRY_SCHEMA_VERSION) {
57976
+ const parsed = stageRecordSchema.safeParse(raw);
57977
+ if (!parsed.success) {
57978
+ throw new StageRegistryError(`stage record failed schema validation: ${parsed.error.message}`, "schema-version-mismatch");
57979
+ }
57980
+ const record2 = parsed.data;
57981
+ if (!isCompatibleStageVersion(consumerVersion, record2.schema_version)) {
57982
+ throw new StageRegistryError(`stage ${record2.id}: schema major ${record2.schema_version.major} is incompatible with consumer major ${consumerVersion.major}`, "schema-version-mismatch", record2.id);
57983
+ }
57984
+ return validateStageRecord(record2);
57985
+ }
57986
+ var STAGE_REGISTRY_SCHEMA_VERSION, stageSchemaVersionSchema, AUTHORITY_LANES, MUTATION_CLASSES, EXECUTION_KINDS, inlineExecutionSchema, subprocessExecutionSchema, deterministicExecutionSchema, hitlExecutionSchema, irreversibleExecutionSchema, executionKindSchema, ARTIFACT_DIRECTIONS, stageArtifactSchema, stageGateSchema, stageRetryPolicySchema, stageModelPolicySchema, CONTEXT_LAYER_NAMES, stageContextLayerSchema, stageEventSchema, STAGE_ID_PATTERN, stageRecordSchema, StageRegistryError;
57987
+ var init_schema4 = __esm(() => {
57988
+ init_zod();
57989
+ STAGE_REGISTRY_SCHEMA_VERSION = {
57990
+ major: 1,
57991
+ minor: 0
57992
+ };
57993
+ stageSchemaVersionSchema = exports_external.object({
57994
+ major: exports_external.number().int().nonnegative(),
57995
+ minor: exports_external.number().int().nonnegative()
57996
+ }).strict();
57997
+ AUTHORITY_LANES = ["registry", "workflow", "skill", "cli", "adapter"];
57998
+ MUTATION_CLASSES = [
57999
+ "none",
58000
+ "corpus",
58001
+ "code",
58002
+ "tests",
58003
+ "verdict",
58004
+ "learnings",
58005
+ "driver",
58006
+ "irreversible"
58007
+ ];
58008
+ EXECUTION_KINDS = ["inline", "subprocess", "deterministic", "hitl", "irreversible"];
58009
+ inlineExecutionSchema = exports_external.object({
58010
+ kind: exports_external.literal("inline"),
58011
+ current_agent_allowed: exports_external.literal(true),
58012
+ may_reuse_captured_layers: exports_external.boolean().optional()
58013
+ }).strict();
58014
+ subprocessExecutionSchema = exports_external.object({
58015
+ kind: exports_external.literal("subprocess"),
58016
+ current_agent_allowed: exports_external.literal(false),
58017
+ via: exports_external.literal("spur-agent-run")
58018
+ }).strict();
58019
+ deterministicExecutionSchema = exports_external.object({
58020
+ kind: exports_external.literal("deterministic"),
58021
+ current_agent_allowed: exports_external.literal(false),
58022
+ executor: exports_external.enum(["cli", "script"])
58023
+ }).strict();
58024
+ hitlExecutionSchema = exports_external.object({
58025
+ kind: exports_external.literal("hitl"),
58026
+ current_agent_allowed: exports_external.literal(true),
58027
+ gate_timing: exports_external.enum(["pre", "post", "both"])
58028
+ }).strict();
58029
+ irreversibleExecutionSchema = exports_external.object({
58030
+ kind: exports_external.literal("irreversible"),
58031
+ requires_operator_intent: exports_external.literal(true),
58032
+ current_agent_allowed: exports_external.boolean(),
58033
+ rollback_disclaimer: exports_external.string().min(1)
58034
+ }).strict();
58035
+ executionKindSchema = exports_external.discriminatedUnion("kind", [
58036
+ inlineExecutionSchema,
58037
+ subprocessExecutionSchema,
58038
+ deterministicExecutionSchema,
58039
+ hitlExecutionSchema,
58040
+ irreversibleExecutionSchema
58041
+ ]);
58042
+ ARTIFACT_DIRECTIONS = ["input", "output"];
58043
+ stageArtifactSchema = exports_external.object({
58044
+ kind: exports_external.string().min(1),
58045
+ direction: exports_external.enum(ARTIFACT_DIRECTIONS),
58046
+ description: exports_external.string().optional(),
58047
+ required: exports_external.boolean().optional().default(true)
58048
+ }).strict();
58049
+ stageGateSchema = exports_external.object({
58050
+ name: exports_external.string().min(1),
58051
+ timing: exports_external.enum(["pre", "post", "transition"]),
58052
+ min_verdict: exports_external.enum(["pass", "partial", "fail"]).optional(),
58053
+ description: exports_external.string().optional()
58054
+ }).strict();
58055
+ stageRetryPolicySchema = exports_external.object({
58056
+ max_attempts: exports_external.number().int().min(1),
58057
+ terminal_stop: exports_external.enum(["block", "escalate", "fail"]),
58058
+ timeout_seconds: exports_external.number().int().positive().optional()
58059
+ }).strict();
58060
+ stageModelPolicySchema = exports_external.object({
58061
+ min_tier: exports_external.enum(["cheap", "standard", "capable"]),
58062
+ fallback: exports_external.array(exports_external.object({
58063
+ tier: exports_external.enum(["cheap", "standard", "capable"]),
58064
+ trigger: exports_external.enum(["gate-fail", "timeout", "insufficient-evidence", "retry-exhausted"])
58065
+ }).strict()),
58066
+ override_key: exports_external.string().optional()
58067
+ }).strict();
58068
+ CONTEXT_LAYER_NAMES = [
58069
+ "harness-policy",
58070
+ "project-authority",
58071
+ "stage-contract",
58072
+ "task-state",
58073
+ "indexed-evidence",
58074
+ "run-state",
58075
+ "tool-observations"
58076
+ ];
58077
+ stageContextLayerSchema = exports_external.object({
58078
+ layer: exports_external.enum(CONTEXT_LAYER_NAMES),
58079
+ required: exports_external.literal(true)
58080
+ }).strict();
58081
+ stageEventSchema = exports_external.object({
58082
+ name: exports_external.string().min(1),
58083
+ description: exports_external.string().optional()
58084
+ }).strict();
58085
+ STAGE_ID_PATTERN = /^[a-z][a-z0-9-]*$/;
58086
+ stageRecordSchema = exports_external.object({
58087
+ schema_version: stageSchemaVersionSchema,
58088
+ id: exports_external.string().regex(STAGE_ID_PATTERN, {
58089
+ message: "stage id must be lowercase kebab-case"
58090
+ }),
58091
+ aliases: exports_external.array(exports_external.string().min(1)).optional().default([]),
58092
+ description: exports_external.string().min(1),
58093
+ artifacts: exports_external.array(stageArtifactSchema).min(1),
58094
+ reasoning_skill: exports_external.string().min(1),
58095
+ required_references: exports_external.array(exports_external.string().min(1)).optional().default([]),
58096
+ gates: exports_external.array(stageGateSchema).optional().default([]),
58097
+ mutation_class: exports_external.enum(MUTATION_CLASSES),
58098
+ retry: stageRetryPolicySchema,
58099
+ model_policy: stageModelPolicySchema,
58100
+ context_layers: exports_external.array(stageContextLayerSchema).optional().default([]),
58101
+ observability: exports_external.array(stageEventSchema).optional().default([]),
58102
+ execution: executionKindSchema
58103
+ }).strict();
58104
+ StageRegistryError = class StageRegistryError extends Error {
58105
+ code;
58106
+ stageId;
58107
+ constructor(message, code, stageId) {
58108
+ super(message);
58109
+ this.code = code;
58110
+ this.stageId = stageId;
58111
+ this.name = "StageRegistryError";
58112
+ }
58113
+ };
58114
+ });
58115
+
58116
+ // ../../packages/domain/src/envelope/schema.ts
58117
+ var CACHEABILITY_CLASSES, SENSITIVITY_CLASSES, envelopeProvenanceSchema, envelopeSizeBudgetSchema, envelopeLayerSchema, STABLE_LAYER_NAMES, VOLATILE_LAYER_NAMES, envelopeSchema, projectSnapshotSchema, taskSnapshotSchema, featureSnapshotSchema;
58118
+ var init_schema5 = __esm(() => {
58119
+ init_zod();
58120
+ init_schema4();
58121
+ CACHEABILITY_CLASSES = ["stable-prefix-eligible", "volatile"];
58122
+ SENSITIVITY_CLASSES = ["public", "internal", "confidential"];
58123
+ envelopeProvenanceSchema = exports_external.object({
58124
+ owner: exports_external.string().min(1),
58125
+ schema_version: exports_external.string().min(1),
58126
+ source_revision: exports_external.string().nullable().optional(),
58127
+ generated_at: exports_external.string().datetime()
58128
+ }).strict();
58129
+ envelopeSizeBudgetSchema = exports_external.object({
58130
+ max_bytes: exports_external.number().int().positive()
58131
+ }).strict();
58132
+ envelopeLayerSchema = exports_external.object({
58133
+ layer: exports_external.enum(CONTEXT_LAYER_NAMES),
58134
+ content: exports_external.string(),
58135
+ size_bytes: exports_external.number().int().nonnegative(),
58136
+ content_hash: exports_external.string().length(64),
58137
+ provenance: envelopeProvenanceSchema,
58138
+ cacheability: exports_external.enum(CACHEABILITY_CLASSES),
58139
+ sensitivity: exports_external.enum(SENSITIVITY_CLASSES).default("internal"),
58140
+ size_budget: envelopeSizeBudgetSchema.optional(),
58141
+ disclosure_handle: exports_external.string().optional()
58142
+ }).strict();
58143
+ STABLE_LAYER_NAMES = [
58144
+ "harness-policy",
58145
+ "project-authority",
58146
+ "stage-contract",
58147
+ "task-state",
58148
+ "indexed-evidence"
58149
+ ];
58150
+ VOLATILE_LAYER_NAMES = ["run-state", "tool-observations"];
58151
+ envelopeSchema = exports_external.object({
58152
+ schema_version: exports_external.string().default("1.0"),
58153
+ layers: exports_external.array(envelopeLayerSchema).min(1),
58154
+ stage_id: exports_external.string().optional(),
58155
+ run_id: exports_external.string().optional(),
58156
+ assembled_at: exports_external.string().datetime(),
58157
+ total_size_bytes: exports_external.number().int().nonnegative()
58158
+ }).strict();
58159
+ projectSnapshotSchema = exports_external.object({
58160
+ name: exports_external.string(),
58161
+ version: exports_external.string(),
58162
+ task_counts: exports_external.object({
58163
+ backlog: exports_external.number().int().nonnegative(),
58164
+ todo: exports_external.number().int().nonnegative(),
58165
+ wip: exports_external.number().int().nonnegative(),
58166
+ testing: exports_external.number().int().nonnegative(),
58167
+ done: exports_external.number().int().nonnegative(),
58168
+ blocked: exports_external.number().int().nonnegative(),
58169
+ cancelled: exports_external.number().int().nonnegative()
58170
+ }).strict(),
58171
+ feature_counts: exports_external.object({
58172
+ backlog: exports_external.number().int().nonnegative(),
58173
+ active: exports_external.number().int().nonnegative(),
58174
+ verifying: exports_external.number().int().nonnegative(),
58175
+ done: exports_external.number().int().nonnegative(),
58176
+ blocked: exports_external.number().int().nonnegative(),
58177
+ cancelled: exports_external.number().int().nonnegative()
58178
+ }).strict(),
58179
+ active_features: exports_external.array(exports_external.string()),
58180
+ content_hash: exports_external.string().length(64).optional()
58181
+ }).strict();
58182
+ taskSnapshotSchema = exports_external.object({
58183
+ wbs: exports_external.string().regex(/^\d{4}$/),
58184
+ name: exports_external.string(),
58185
+ status: exports_external.string(),
58186
+ priority: exports_external.string().optional(),
58187
+ feature_id: exports_external.string().optional(),
58188
+ acceptance_criteria: exports_external.string().optional(),
58189
+ locked_qa: exports_external.array(exports_external.string()).optional(),
58190
+ solution: exports_external.string().optional(),
58191
+ content_hash: exports_external.string().length(64).optional()
58192
+ }).strict();
58193
+ featureSnapshotSchema = exports_external.object({
58194
+ id: exports_external.string(),
58195
+ name: exports_external.string(),
58196
+ status: exports_external.string(),
58197
+ priority: exports_external.string().optional(),
58198
+ scenarios: exports_external.array(exports_external.string()).optional(),
58199
+ content_hash: exports_external.string().length(64).optional()
58200
+ }).strict();
58201
+ });
58202
+
58203
+ // ../../packages/domain/src/envelope/assemblies.ts
58204
+ function sortLayers(layers) {
58205
+ return [...layers].sort((a2, b) => (LAYER_ORDER[a2.layer] ?? 99) - (LAYER_ORDER[b.layer] ?? 99));
58206
+ }
58207
+ function isStableLayerName(name) {
58208
+ return STABLE_LAYER_NAMES.includes(name);
58209
+ }
58210
+ function cacheabilityForLayer(name) {
58211
+ return isStableLayerName(name) ? "stable-prefix-eligible" : "volatile";
58212
+ }
58213
+ function getStageLayerSelection(stageId) {
58214
+ return STAGE_LAYER_DISCLOSURE[stageId] ?? { required: ALL_LAYER_NAMES, optional: [] };
58215
+ }
58216
+ function getStageLayerNames(stageId) {
58217
+ return STAGE_LAYER_SELECTORS[stageId] ?? ALL_LAYER_NAMES;
58218
+ }
58219
+ function getStableLayerNames(stageId) {
58220
+ return getStageLayerNames(stageId).filter((n2) => isStableLayerName(n2));
58221
+ }
58222
+ function getVolatileLayerNames(stageId) {
58223
+ return getStageLayerNames(stageId).filter((n2) => !isStableLayerName(n2));
58224
+ }
58225
+ function buildStageLayers(stageId, contentMap, owner, schemaVersion, generatedAt, sourceRevision, sensitivityByLayer) {
58226
+ const layerNames = getStageLayerNames(stageId);
58227
+ const layers = [];
58228
+ for (const name of layerNames) {
58229
+ const content = contentMap[name];
58230
+ if (content === undefined || content === null)
58231
+ continue;
58232
+ const encoder = new TextEncoder;
58233
+ const sizeBytes = encoder.encode(content).length;
58234
+ const hash2 = computeContentHash(content);
58235
+ layers.push({
58236
+ layer: name,
58237
+ content,
58238
+ size_bytes: sizeBytes,
58239
+ content_hash: hash2,
58240
+ provenance: {
58241
+ owner,
58242
+ schema_version: schemaVersion,
58243
+ source_revision: sourceRevision ?? null,
58244
+ generated_at: generatedAt
58245
+ },
58246
+ cacheability: cacheabilityForLayer(name),
58247
+ sensitivity: sensitivityByLayer?.[name] ?? "internal"
58248
+ });
58249
+ }
58250
+ return sortLayers(layers);
58251
+ }
58252
+ function appendDisclosurePlaceholders(stageId, layers, provenance) {
58253
+ const present = new Set(layers.map((l) => l.layer));
58254
+ const { optional: optional2 } = getStageLayerSelection(stageId);
58255
+ const placeholders = [];
58256
+ for (const name of optional2) {
58257
+ if (present.has(name))
58258
+ continue;
58259
+ placeholders.push({
58260
+ layer: name,
58261
+ content: "",
58262
+ size_bytes: 0,
58263
+ content_hash: computeContentHash(""),
58264
+ provenance,
58265
+ cacheability: cacheabilityForLayer(name),
58266
+ sensitivity: "internal",
58267
+ size_budget: { max_bytes: DEFAULT_DISCLOSURE_BUDGET_BYTES },
58268
+ disclosure_handle: `${stageId}:${name}`
58269
+ });
58270
+ }
58271
+ return sortLayers([...layers, ...placeholders]);
58272
+ }
58273
+ function extractStablePrefix(layers) {
58274
+ return sortLayers(layers).filter((l) => l.cacheability === "stable-prefix-eligible");
58275
+ }
58276
+ function stablePrefixesMatch(a2, b) {
58277
+ const stableA = extractStablePrefix(a2);
58278
+ const stableB = extractStablePrefix(b);
58279
+ if (stableA.length !== stableB.length)
58280
+ return false;
58281
+ for (let i2 = 0;i2 < stableA.length; i2++) {
58282
+ const left = stableA[i2];
58283
+ const right = stableB[i2];
58284
+ if (!left || !right)
58285
+ return false;
58286
+ if (left.content_hash !== right.content_hash)
58287
+ return false;
58288
+ }
58289
+ return true;
58290
+ }
58291
+ var ALL_LAYER_NAMES, LAYER_ORDER, STAGE_LAYER_SELECTORS, STAGE_LAYER_DISCLOSURE, DEFAULT_DISCLOSURE_BUDGET_BYTES = 8192;
58292
+ var init_assemblies = __esm(() => {
58293
+ init_fingerprint();
58294
+ init_schema5();
58295
+ ALL_LAYER_NAMES = [...STABLE_LAYER_NAMES, ...VOLATILE_LAYER_NAMES];
58296
+ LAYER_ORDER = {};
58297
+ ALL_LAYER_NAMES.forEach((name, idx) => {
58298
+ LAYER_ORDER[name] = idx;
58299
+ });
58300
+ STAGE_LAYER_SELECTORS = {
58301
+ refine: ["harness-policy", "project-authority", "stage-contract", "task-state"],
58302
+ implement: [
58303
+ "harness-policy",
58304
+ "project-authority",
58305
+ "stage-contract",
58306
+ "task-state",
58307
+ "indexed-evidence",
58308
+ "run-state",
58309
+ "tool-observations"
58310
+ ],
58311
+ review: [
58312
+ "harness-policy",
58313
+ "project-authority",
58314
+ "stage-contract",
58315
+ "task-state",
58316
+ "indexed-evidence",
58317
+ "run-state",
58318
+ "tool-observations"
58319
+ ],
58320
+ verify: ["harness-policy", "project-authority", "stage-contract", "task-state", "run-state"],
58321
+ dogfood: [
58322
+ "harness-policy",
58323
+ "project-authority",
58324
+ "stage-contract",
58325
+ "task-state",
58326
+ "indexed-evidence",
58327
+ "run-state",
58328
+ "tool-observations"
58329
+ ]
58330
+ };
58331
+ STAGE_LAYER_DISCLOSURE = {
58332
+ refine: {
58333
+ required: ["harness-policy", "project-authority", "stage-contract", "task-state"],
58334
+ optional: []
58335
+ },
58336
+ implement: {
58337
+ required: ["harness-policy", "project-authority", "stage-contract", "task-state", "run-state"],
58338
+ optional: ["indexed-evidence", "tool-observations"]
58339
+ },
58340
+ review: {
58341
+ required: ["harness-policy", "project-authority", "stage-contract", "task-state", "run-state"],
58342
+ optional: ["indexed-evidence", "tool-observations"]
58343
+ },
58344
+ verify: {
58345
+ required: ["harness-policy", "project-authority", "stage-contract", "task-state", "run-state"],
58346
+ optional: []
58347
+ },
58348
+ dogfood: {
58349
+ required: ["harness-policy", "project-authority", "stage-contract", "task-state", "run-state"],
58350
+ optional: ["indexed-evidence", "tool-observations"]
58351
+ }
58352
+ };
58353
+ });
58354
+
58355
+ // ../../packages/domain/src/envelope/attribution.ts
58356
+ function attributeFreshVsReused(layers, capturedLayers, freshInputTokens = null, reusedInputTokens = null, providerCacheHit = "unavailable") {
58357
+ const capturedByLayer = new Map;
58358
+ for (const cl of capturedLayers) {
58359
+ capturedByLayer.set(cl.layer, cl);
58360
+ }
58361
+ const layerResults = [];
58362
+ let freshCount = 0;
58363
+ let reusedCount = 0;
58364
+ for (const layer of layers) {
58365
+ const captured = capturedByLayer.get(layer.layer);
58366
+ const capturedHash = captured?.content_hash ?? "";
58367
+ const isFresh = !captured || layer.content_hash === "" || captured.content_hash !== layer.content_hash;
58368
+ const isReused = !isFresh;
58369
+ if (isFresh)
58370
+ freshCount++;
58371
+ if (isReused)
58372
+ reusedCount++;
58373
+ const evidenceKind = isReused ? "documented" : "inferred";
58374
+ const reason = isReused ? `content hash matches captured layer (${layer.layer})` : !captured ? `no prior capture for layer ${layer.layer}` : `content hash differs: captured ${capturedHash} vs fresh ${layer.content_hash}`;
58375
+ layerResults.push({
58376
+ layer: layer.layer,
58377
+ fresh: isFresh,
58378
+ reused: isReused,
58379
+ capturedHash,
58380
+ freshHash: layer.content_hash,
58381
+ evidenceKind,
58382
+ reason
58383
+ });
58384
+ }
58385
+ let providerEvidenceKind;
58386
+ if (providerCacheHit !== "unavailable") {
58387
+ providerEvidenceKind = "documented";
58388
+ } else if (freshInputTokens !== null || reusedInputTokens !== null) {
58389
+ providerEvidenceKind = "documented";
58390
+ } else {
58391
+ providerEvidenceKind = "unavailable";
58392
+ }
58393
+ return {
58394
+ dispatchId: "",
58395
+ attributedAt: new Date().toISOString(),
58396
+ layers: layerResults,
58397
+ freshCount,
58398
+ reusedCount,
58399
+ freshInputTokens,
58400
+ reusedInputTokens,
58401
+ providerCacheHit,
58402
+ providerEvidenceKind
58403
+ };
58404
+ }
58405
+ function attributeWithoutTelemetry(layers, capturedLayers) {
58406
+ return {
58407
+ ...attributeFreshVsReused(layers, capturedLayers),
58408
+ freshInputTokens: null,
58409
+ reusedInputTokens: null,
58410
+ providerCacheHit: "unavailable",
58411
+ providerEvidenceKind: "unavailable"
58412
+ };
58413
+ }
58414
+
58415
+ // ../../packages/domain/src/envelope/invalidation.ts
58416
+ import { createHash as createHash3 } from "crypto";
58417
+ function computeInvalidationFingerprint(trigger) {
58418
+ if (trigger.kind === "tool-output")
58419
+ return null;
58420
+ let raw;
58421
+ switch (trigger.kind) {
58422
+ case "corpus-update":
58423
+ raw = `corpus:${trigger.mtime}:${trigger.hash}`;
58424
+ break;
58425
+ case "git-change":
58426
+ raw = `git:${trigger.worktreeSha}`;
58427
+ break;
58428
+ case "config-change":
58429
+ raw = `config:${trigger.configHash}:${trigger.modelId}`;
58430
+ break;
58431
+ case "version-change":
58432
+ raw = `version:${trigger.manifestVersion}:${trigger.source}`;
58433
+ break;
58434
+ case "gate-result":
58435
+ raw = `gate:${trigger.verdictHash}`;
58436
+ break;
58437
+ default:
58438
+ return null;
58439
+ }
58440
+ return createHash3("sha256").update(raw, "utf-8").digest("hex");
58441
+ }
58442
+ function checkLayerStale(layer, freshFingerprint) {
58443
+ if (freshFingerprint === null) {
58444
+ return {
58445
+ layer: layer.layer,
58446
+ stale: true,
58447
+ reason: "never-cached",
58448
+ triggerKind: "tool-output"
58449
+ };
58450
+ }
58451
+ if (layer.cacheability === "volatile") {
58452
+ return {
58453
+ layer: layer.layer,
58454
+ stale: true,
58455
+ reason: "volatile-layer"
58456
+ };
58457
+ }
58458
+ const storedHash = layer.content_hash;
58459
+ const match = storedHash === freshFingerprint;
58460
+ return {
58461
+ layer: layer.layer,
58462
+ stale: !match,
58463
+ reason: match ? undefined : "fingerprint-mismatch",
58464
+ triggerKind: match ? undefined : "fingerprint-mismatch"
58465
+ };
58466
+ }
58467
+ function identifyStaleLayers(layers, freshFingerprints) {
58468
+ const results = [];
58469
+ const seen = new Set;
58470
+ for (const layer of layers) {
58471
+ if (seen.has(layer.layer))
58472
+ continue;
58473
+ seen.add(layer.layer);
58474
+ const fingerprint = layer.layer in freshFingerprints ? freshFingerprints[layer.layer] ?? null : null;
58475
+ results.push(checkLayerStale(layer, fingerprint));
58476
+ }
58477
+ return results;
58478
+ }
58479
+ function artifactFingerprintsMatch(capturedHashes, freshFingerprints) {
58480
+ for (const [layerName, capturedHash] of Object.entries(capturedHashes)) {
58481
+ const fresh = freshFingerprints[layerName];
58482
+ if (fresh === undefined || fresh === null)
58483
+ return false;
58484
+ if (capturedHash !== fresh)
58485
+ return false;
58486
+ }
58487
+ return true;
58488
+ }
58489
+ var init_invalidation = () => {};
58490
+
58491
+ // ../../packages/domain/src/envelope/boundary.ts
58492
+ class InlineContext {
58493
+ _capturedStable = new Map;
58494
+ _dispatchId;
58495
+ constructor(dispatchId) {
58496
+ this._dispatchId = dispatchId;
58497
+ }
58498
+ get dispatchId() {
58499
+ return this._dispatchId;
58500
+ }
58501
+ captureLayer(layer) {
58502
+ if (layer.cacheability === "stable-prefix-eligible") {
58503
+ this._capturedStable.set(layer.layer, layer);
58504
+ }
58505
+ }
58506
+ getCapturedLayer(name) {
58507
+ return this._capturedStable.get(name);
58508
+ }
58509
+ isStableLayerFresh(name, freshFingerprint) {
58510
+ const captured = this._capturedStable.get(name);
58511
+ if (!captured || freshFingerprint === null)
58512
+ return false;
58513
+ return captured.content_hash === freshFingerprint;
58514
+ }
58515
+ reset() {
58516
+ this._capturedStable.clear();
58517
+ }
58518
+ get size() {
58519
+ return this._capturedStable.size;
58520
+ }
58521
+ }
58522
+ function verifySubprocessArtifact(artifact, freshFingerprints) {
58523
+ return artifactFingerprintsMatch(artifact.capturedHashes, freshFingerprints);
58524
+ }
58525
+ function createBoundaryContext(kind, dispatchId) {
58526
+ if (kind === "inline")
58527
+ return new InlineContext(dispatchId);
58528
+ return null;
58529
+ }
58530
+ var init_boundary = __esm(() => {
58531
+ init_invalidation();
58532
+ });
58533
+
58534
+ // ../../packages/domain/src/envelope/serialization.ts
58535
+ function canonicalJson(value) {
58536
+ if (value === null || typeof value !== "object")
58537
+ return JSON.stringify(value) ?? "null";
58538
+ if (Array.isArray(value))
58539
+ return `[${value.map((v) => v === undefined ? "null" : canonicalJson(v)).join(",")}]`;
58540
+ const entries = Object.entries(value).filter(([, v]) => v !== undefined).sort(([a2], [b]) => a2 < b ? -1 : a2 > b ? 1 : 0);
58541
+ return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
58542
+ }
58543
+ function serializeLayer(layer) {
58544
+ const { content, ...meta3 } = layer;
58545
+ return `${canonicalJson(meta3)}
58546
+
58547
+ ${content}`;
58548
+ }
58549
+ function serializeEnvelope(envelope) {
58550
+ const { layers, ...meta3 } = envelope;
58551
+ const head = canonicalJson(meta3);
58552
+ return [head, ...layers.map(serializeLayer)].join(`
58553
+
58554
+ ---
58555
+
58556
+ `);
58557
+ }
58558
+ function serializeStablePrefix(layers) {
58559
+ return layers.filter((l) => l.cacheability === "stable-prefix-eligible").map(serializeLayer).join(`
58560
+
58561
+ ---
58562
+
58563
+ `);
58564
+ }
58565
+ function computeSnapshotHash(snapshot) {
58566
+ const { content_hash: _ignored, ...rest } = snapshot;
58567
+ return computeContentHash(canonicalJson(rest));
58568
+ }
58569
+ function withSnapshotHash(snapshot) {
58570
+ return { ...snapshot, content_hash: computeSnapshotHash(snapshot) };
58571
+ }
58572
+ var init_serialization = __esm(() => {
58573
+ init_fingerprint();
58574
+ });
58575
+
58576
+ // ../../packages/domain/src/envelope/index.ts
58577
+ var init_envelope = __esm(() => {
58578
+ init_assemblies();
58579
+ init_boundary();
58580
+ init_fingerprint();
58581
+ init_invalidation();
58582
+ init_schema5();
58583
+ init_serialization();
58584
+ });
58585
+
57781
58586
  // ../../packages/domain/src/planning/locks.ts
57782
58587
  import { closeSync, fsyncSync, mkdirSync as mkdirSync4, openSync, readFileSync as readFileSync7, renameSync as renameSync3, unlinkSync, writeSync } from "fs";
57783
58588
  import { dirname as dirname7, join as join5 } from "path";
@@ -58071,7 +58876,9 @@ class MarkdownDocument {
58071
58876
  return this._duplicateSectionNames;
58072
58877
  }
58073
58878
  get canonicalSections() {
58074
- return this._domain === "task" ? TASK_CANONICAL_SECTIONS : FEATURE_CANONICAL_SECTIONS;
58879
+ const base2 = this._domain === "task" ? TASK_CANONICAL_SECTIONS : FEATURE_CANONICAL_SECTIONS;
58880
+ const extra = UNIVERSAL_SECTIONS.filter((s) => !base2.includes(s));
58881
+ return [...base2, ...extra];
58075
58882
  }
58076
58883
  validateSectionName(name) {
58077
58884
  if (!this.canonicalSections.includes(name)) {
@@ -58200,6 +59007,37 @@ ${raw2}
58200
59007
  this._frontmatterBlock = rawStart === -1 ? `---
58201
59008
  ${raw}
58202
59009
  ---
59010
+ ` : this._frontmatterBlock.slice(0, rawStart) + raw + this._frontmatterBlock.slice(rawStart + oldRaw.length);
59011
+ }
59012
+ setFrontmatterArray(key, values) {
59013
+ const inline = values.length === 0 ? "[]" : `[${values.map((v) => escapeYamlArrayElement(v)).join(", ")}]`;
59014
+ const fieldLine = `${key}: ${inline}`;
59015
+ if (this._frontmatter === null) {
59016
+ this._frontmatter = { raw: fieldLine, data: { [key]: values } };
59017
+ this._frontmatterBlock = `---
59018
+ ${fieldLine}
59019
+ ---
59020
+
59021
+ `;
59022
+ return;
59023
+ }
59024
+ const oldRaw = this._frontmatter.raw;
59025
+ const lines = oldRaw.split(`
59026
+ `);
59027
+ const keyPrefix = `${key}:`;
59028
+ const idx = lines.findIndex((line) => line === keyPrefix || line.startsWith(`${keyPrefix} `));
59029
+ if (idx === -1) {
59030
+ lines.push(fieldLine);
59031
+ } else {
59032
+ lines[idx] = fieldLine;
59033
+ }
59034
+ const raw = lines.join(`
59035
+ `);
59036
+ this._frontmatter = { raw, data: { ...this._frontmatter.data, [key]: values } };
59037
+ const rawStart = this._frontmatterBlock.indexOf(oldRaw);
59038
+ this._frontmatterBlock = rawStart === -1 ? `---
59039
+ ${raw}
59040
+ ---
58203
59041
  ` : this._frontmatterBlock.slice(0, rawStart) + raw + this._frontmatterBlock.slice(rawStart + oldRaw.length);
58204
59042
  }
58205
59043
  serialize() {
@@ -58211,6 +59049,10 @@ ${raw}
58211
59049
  return result;
58212
59050
  }
58213
59051
  }
59052
+ function escapeYamlArrayElement(value) {
59053
+ const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
59054
+ return `"${escaped}"`;
59055
+ }
58214
59056
  function escapeYamlValue(value) {
58215
59057
  if (value.startsWith('"') && value.endsWith('"'))
58216
59058
  return value;
@@ -58345,7 +59187,7 @@ function normalizeFeatureStatus(raw) {
58345
59187
  return resolved;
58346
59188
  }
58347
59189
  var TASK_STATUSES, FEATURE_STATUSES, TASK_STATUS_ICONS, FEATURE_STATUS_ICONS, PRIORITIES, PROFILES, TASK_TYPES, TASK_VARIANTS, DEFAULT_TASK_VARIANT = "standard", FEATURE_ID_PATTERN, TASK_STATUS_ALIASES, FEATURE_STATUS_ALIASES, isoDateString, featureId, wbsString, taskFrontmatterSchema, featureFrontmatterSchema, TASK_TEMPLATES, taskBatchItemSchema, taskBatchSchema;
58348
- var init_schema4 = __esm(() => {
59190
+ var init_schema6 = __esm(() => {
58349
59191
  init_zod();
58350
59192
  TASK_STATUSES = ["backlog", "todo", "wip", "testing", "blocked", "done", "cancelled"];
58351
59193
  FEATURE_STATUSES = ["backlog", "active", "verifying", "blocked", "done", "cancelled"];
@@ -58561,21 +59403,282 @@ var init_task_skeleton = __esm(() => {
58561
59403
  CANONICAL_INDEX = new Map(TASK_CANONICAL_SECTIONS.map((s, i2) => [s, i2]));
58562
59404
  });
58563
59405
 
59406
+ // ../../packages/domain/src/stage-registry/validator.ts
59407
+ function generateRunId() {
59408
+ const crypto3 = globalThis.crypto;
59409
+ if (crypto3 && typeof crypto3.randomUUID === "function") {
59410
+ return `stage-registry-run-${crypto3.randomUUID()}`;
59411
+ }
59412
+ return `stage-registry-run-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
59413
+ }
59414
+ function validateStageRegistryGraph(records, options) {
59415
+ const run_id = options.run_id ?? generateRunId();
59416
+ const diagnostics = [];
59417
+ const stage_ids = records.map((r) => r.id);
59418
+ const diag14 = (code, message, extra) => {
59419
+ diagnostics.push({ run_id, code, message, ...extra });
59420
+ };
59421
+ for (const record2 of records) {
59422
+ try {
59423
+ validateStageRecord(record2);
59424
+ } catch (err) {
59425
+ if (err instanceof StageRegistryError) {
59426
+ diag14(err.code, err.message, { stageId: err.stageId ?? record2.id });
59427
+ } else {
59428
+ diag14("unknown-dependency", `stage ${record2.id}: unexpected validation error: ${err.message}`, {
59429
+ stageId: record2.id
59430
+ });
59431
+ }
59432
+ }
59433
+ }
59434
+ const idIndex = new Map;
59435
+ const aliasOwner = new Map;
59436
+ for (let i2 = 0;i2 < records.length; i2 += 1) {
59437
+ const record2 = records[i2];
59438
+ if (record2 === undefined)
59439
+ continue;
59440
+ const prior = idIndex.get(record2.id);
59441
+ if (prior !== undefined) {
59442
+ diag14("duplicate-id", `duplicate stage id ${record2.id} (first at index ${prior})`, {
59443
+ stageId: record2.id
59444
+ });
59445
+ } else {
59446
+ idIndex.set(record2.id, i2);
59447
+ }
59448
+ for (const alias3 of record2.aliases) {
59449
+ const owner = aliasOwner.get(alias3);
59450
+ if (owner !== undefined && owner !== record2.id) {
59451
+ diag14("duplicate-id", `alias ${alias3} of stage ${record2.id} shadows stage ${owner}`, {
59452
+ stageId: record2.id,
59453
+ ref: alias3
59454
+ });
59455
+ } else if (idIndex.has(alias3) && idIndex.get(alias3) !== i2) {
59456
+ diag14("duplicate-id", `alias ${alias3} of stage ${record2.id} shadows stage id ${alias3}`, {
59457
+ stageId: record2.id,
59458
+ ref: alias3
59459
+ });
59460
+ } else {
59461
+ aliasOwner.set(alias3, record2.id);
59462
+ }
59463
+ }
59464
+ }
59465
+ const resolver = options.resolver;
59466
+ for (const record2 of records) {
59467
+ if (!resolver.hasSkill(record2.reasoning_skill)) {
59468
+ diag14("unknown-dependency", `stage ${record2.id}: reasoning_skill ${record2.reasoning_skill} does not resolve`, {
59469
+ stageId: record2.id,
59470
+ ref: record2.reasoning_skill,
59471
+ kind: "skill"
59472
+ });
59473
+ }
59474
+ for (const alias3 of record2.aliases) {
59475
+ if (!resolver.hasCommand(alias3)) {
59476
+ diag14("unknown-dependency", `stage ${record2.id}: alias ${alias3} does not resolve to a command`, {
59477
+ stageId: record2.id,
59478
+ ref: alias3,
59479
+ kind: "command"
59480
+ });
59481
+ }
59482
+ }
59483
+ for (const gate of record2.gates) {
59484
+ if (!resolver.hasGate(gate.name)) {
59485
+ diag14("missing-gate", `stage ${record2.id}: gate ${gate.name} does not resolve`, {
59486
+ stageId: record2.id,
59487
+ ref: gate.name,
59488
+ kind: "gate"
59489
+ });
59490
+ }
59491
+ }
59492
+ for (const ref of record2.required_references) {
59493
+ if (!resolver.hasArtifactPath(ref)) {
59494
+ diag14("unknown-dependency", `stage ${record2.id}: required_reference ${ref} does not resolve`, {
59495
+ stageId: record2.id,
59496
+ ref,
59497
+ kind: "artifact-path"
59498
+ });
59499
+ }
59500
+ }
59501
+ }
59502
+ if (options.adapter_refs) {
59503
+ for (const [stageId, adapterName] of options.adapter_refs) {
59504
+ if (!resolver.hasAdapter(adapterName)) {
59505
+ diag14("unknown-dependency", `stage ${stageId}: adapter ${adapterName} does not resolve`, {
59506
+ stageId,
59507
+ ref: adapterName,
59508
+ kind: "adapter"
59509
+ });
59510
+ }
59511
+ }
59512
+ }
59513
+ if (options.transitions && options.transitions.length > 0) {
59514
+ const transitions = options.transitions;
59515
+ for (const t of transitions) {
59516
+ if (!idIndex.has(t.from)) {
59517
+ diag14("dangling-transition", `transition from ${t.from} to ${t.to} references unknown source stage ${t.from}`, {
59518
+ stageId: t.from,
59519
+ ref: t.from,
59520
+ kind: "transition"
59521
+ });
59522
+ }
59523
+ if (!idIndex.has(t.to)) {
59524
+ diag14("dangling-transition", `transition from ${t.from} to ${t.to} references unknown target stage ${t.to}`, {
59525
+ stageId: t.to,
59526
+ ref: t.to,
59527
+ kind: "transition"
59528
+ });
59529
+ }
59530
+ if (t.gate && !resolver.hasGate(t.gate)) {
59531
+ diag14("missing-gate", `transition ${t.from} -> ${t.to}: gate ${t.gate} does not resolve`, {
59532
+ ref: t.gate,
59533
+ kind: "gate"
59534
+ });
59535
+ }
59536
+ if (t.workflow && !resolver.hasWorkflow(t.workflow)) {
59537
+ diag14("unknown-dependency", `transition ${t.from} -> ${t.to}: workflow ${t.workflow} does not resolve`, {
59538
+ ref: t.workflow,
59539
+ kind: "workflow"
59540
+ });
59541
+ }
59542
+ }
59543
+ const adj = new Map;
59544
+ for (const id of stage_ids)
59545
+ adj.set(id, []);
59546
+ for (const t of transitions) {
59547
+ if (idIndex.has(t.from) && idIndex.has(t.to)) {
59548
+ adj.get(t.from)?.push(t.to);
59549
+ }
59550
+ }
59551
+ const WHITE = 0;
59552
+ const GRAY = 1;
59553
+ const BLACK = 2;
59554
+ const color = new Map;
59555
+ for (const id of stage_ids)
59556
+ color.set(id, WHITE);
59557
+ const findCycle = () => {
59558
+ const stack = [];
59559
+ const visit2 = (node) => {
59560
+ color.set(node, GRAY);
59561
+ stack.push(node);
59562
+ for (const next of adj.get(node) ?? []) {
59563
+ const c3 = color.get(next);
59564
+ if (c3 === GRAY) {
59565
+ const idx = stack.indexOf(next);
59566
+ return stack.slice(idx).concat(next);
59567
+ }
59568
+ if (c3 === WHITE) {
59569
+ const found = visit2(next);
59570
+ if (found)
59571
+ return found;
59572
+ }
59573
+ }
59574
+ stack.pop();
59575
+ color.set(node, BLACK);
59576
+ return null;
59577
+ };
59578
+ for (const id of stage_ids) {
59579
+ if (color.get(id) === WHITE) {
59580
+ const found = visit2(id);
59581
+ if (found)
59582
+ return found;
59583
+ }
59584
+ }
59585
+ return null;
59586
+ };
59587
+ const cycle = findCycle();
59588
+ if (cycle && cycle.length > 0) {
59589
+ const path9 = cycle.join(" -> ");
59590
+ const startNode = cycle[0];
59591
+ if (cycle.length === 2 && cycle[0] === cycle[1]) {
59592
+ diag14("cyclic-transition", `stage ${startNode} has a self-transition; use the stage retry policy for retries`, {
59593
+ stageId: startNode,
59594
+ ref: startNode,
59595
+ kind: "transition"
59596
+ });
59597
+ } else {
59598
+ diag14("cyclic-transition", `transition graph has a cycle: ${path9}`, {
59599
+ stageId: startNode,
59600
+ ref: path9,
59601
+ kind: "transition"
59602
+ });
59603
+ }
59604
+ }
59605
+ const recordById = new Map;
59606
+ for (const r of records)
59607
+ recordById.set(r.id, r);
59608
+ for (const t of transitions) {
59609
+ const target = recordById.get(t.to);
59610
+ if (target && target.execution.kind === "irreversible" && !t.gate) {
59611
+ diag14("incompatible-model-policy", `transition ${t.from} -> ${t.to}: target stage ${t.to} is irreversible and requires a transition gate`, {
59612
+ stageId: t.to,
59613
+ ref: `${t.from} -> ${t.to}`,
59614
+ kind: "transition"
59615
+ });
59616
+ }
59617
+ }
59618
+ }
59619
+ return {
59620
+ ok: diagnostics.length === 0,
59621
+ diagnostics,
59622
+ run_id,
59623
+ stage_ids
59624
+ };
59625
+ }
59626
+ var passAllResolver;
59627
+ var init_validator = __esm(() => {
59628
+ init_schema4();
59629
+ passAllResolver = {
59630
+ hasSkill: () => true,
59631
+ hasCommand: () => true,
59632
+ hasGate: () => true,
59633
+ hasWorkflow: () => true,
59634
+ hasAdapter: () => true,
59635
+ hasArtifactPath: () => true
59636
+ };
59637
+ });
59638
+
59639
+ // ../../packages/domain/src/stage-registry/index.ts
59640
+ var init_stage_registry = __esm(() => {
59641
+ init_schema4();
59642
+ init_validator();
59643
+ });
59644
+
58564
59645
  // ../../packages/domain/src/index.ts
58565
59646
  var exports_src = {};
58566
59647
  __export(exports_src, {
59648
+ withSnapshotHash: () => withSnapshotHash,
59649
+ verifySubprocessArtifact: () => verifySubprocessArtifact,
59650
+ validateStageRegistryGraph: () => validateStageRegistryGraph,
59651
+ validateStageRegistry: () => validateStageRegistry,
59652
+ validateStageRecord: () => validateStageRecord,
58567
59653
  validateAcceptanceCriteria: () => validateAcceptanceCriteria,
58568
59654
  taskStatusIcon: () => taskStatusIcon,
59655
+ taskSnapshotSchema: () => taskSnapshotSchema,
58569
59656
  taskFrontmatterSchema: () => taskFrontmatterSchema,
58570
59657
  taskBatchSchema: () => taskBatchSchema,
58571
59658
  taskBatchItemSchema: () => taskBatchItemSchema,
59659
+ subprocessExecutionSchema: () => subprocessExecutionSchema,
58572
59660
  stripAcFence: () => stripAcFence,
59661
+ stageSchemaVersionSchema: () => stageSchemaVersionSchema,
59662
+ stageRetryPolicySchema: () => stageRetryPolicySchema,
59663
+ stageRecordSchema: () => stageRecordSchema,
59664
+ stageModelPolicySchema: () => stageModelPolicySchema,
59665
+ stageGateSchema: () => stageGateSchema,
59666
+ stageEventSchema: () => stageEventSchema,
59667
+ stageContextLayerSchema: () => stageContextLayerSchema,
59668
+ stageArtifactSchema: () => stageArtifactSchema,
59669
+ stablePrefixesMatch: () => stablePrefixesMatch,
59670
+ serializeStablePrefix: () => serializeStablePrefix,
59671
+ serializeLayer: () => serializeLayer,
59672
+ serializeEnvelope: () => serializeEnvelope,
58573
59673
  sectionMatrixSchema: () => sectionMatrixSchema,
58574
59674
  resolvePricing: () => resolvePricing,
58575
59675
  renderTaskTemplate: () => renderTaskTemplate,
58576
59676
  readLockMetadata: () => readLockMetadata,
58577
59677
  queryEtlRecords: () => queryEtlRecords,
58578
59678
  queryAllEtlRecords: () => queryAllEtlRecords,
59679
+ projectSnapshotSchema: () => projectSnapshotSchema,
59680
+ passAllResolver: () => passAllResolver,
59681
+ parseStageRecord: () => parseStageRecord,
58579
59682
  parseHistoryLine: () => parseHistoryLine,
58580
59683
  parseFeature: () => parseFeature,
58581
59684
  parseChecklist: () => parseChecklist,
@@ -58584,35 +59687,74 @@ __export(exports_src, {
58584
59687
  normalizeTaskStatus: () => normalizeTaskStatus,
58585
59688
  normalizeFeatureStatus: () => normalizeFeatureStatus,
58586
59689
  matrixEntrySchema: () => matrixEntrySchema,
59690
+ matchEtlPayloads: () => matchEtlPayloads,
59691
+ matchEtlForAction: () => matchEtlForAction,
58587
59692
  loadSqlMigrations: () => loadSqlMigrations,
59693
+ loadAllEtlPayloads: () => loadAllEtlPayloads,
59694
+ isCompatibleStageVersion: () => isCompatibleStageVersion,
59695
+ irreversibleExecutionSchema: () => irreversibleExecutionSchema,
58588
59696
  inspectLock: () => inspectLock,
59697
+ inlineExecutionSchema: () => inlineExecutionSchema,
59698
+ identifyStaleLayers: () => identifyStaleLayers,
59699
+ hitlExecutionSchema: () => hitlExecutionSchema,
58589
59700
  historyEntryToEvent: () => historyEntryToEvent,
59701
+ getVolatileLayerNames: () => getVolatileLayerNames,
59702
+ getStageLayerSelection: () => getStageLayerSelection,
59703
+ getStageLayerNames: () => getStageLayerNames,
59704
+ getStableLayerNames: () => getStableLayerNames,
58590
59705
  formatSummary: () => formatSummary,
58591
59706
  featureStatusIcon: () => featureStatusIcon,
59707
+ featureSnapshotSchema: () => featureSnapshotSchema,
58592
59708
  featureFrontmatterSchema: () => featureFrontmatterSchema,
58593
59709
  extractTemplateBodies: () => extractTemplateBodies,
59710
+ extractStablePrefix: () => extractStablePrefix,
59711
+ extractSessionId: () => extractSessionId,
58594
59712
  extractHistoryEvents: () => extractHistoryEvents,
58595
59713
  extractClaudeTokens: () => extractClaudeTokens,
59714
+ executionKindSchema: () => executionKindSchema,
58596
59715
  etlToCostRecord: () => etlToCostRecord,
58597
59716
  escapeYamlValue: () => escapeYamlValue,
59717
+ escapeYamlArrayElement: () => escapeYamlArrayElement,
59718
+ envelopeSizeBudgetSchema: () => envelopeSizeBudgetSchema,
59719
+ envelopeSchema: () => envelopeSchema,
59720
+ envelopeProvenanceSchema: () => envelopeProvenanceSchema,
59721
+ envelopeLayerSchema: () => envelopeLayerSchema,
59722
+ deterministicExecutionSchema: () => deterministicExecutionSchema,
58598
59723
  dbHealthCheck: () => dbHealthCheck,
58599
59724
  createQueueConsumer: () => createQueueConsumer,
58600
59725
  createMigratedDbViaRuntime: () => createMigratedDbViaRuntime,
58601
59726
  createMigratedDb: () => createMigratedDb,
58602
59727
  createJobQueue: () => createJobQueue,
58603
59728
  createId: () => createId,
59729
+ createBoundaryContext: () => createBoundaryContext,
59730
+ computeSnapshotHash: () => computeSnapshotHash,
58604
59731
  computeRecordCost: () => computeRecordCost,
59732
+ computeInvalidationFingerprint: () => computeInvalidationFingerprint,
59733
+ computeContentHash: () => computeContentHash,
58605
59734
  cleanupTempFiles: () => cleanupTempFiles,
59735
+ checkLayerStale: () => checkLayerStale,
58606
59736
  checkAcCoverage: () => checkAcCoverage,
59737
+ canonicalJson: () => canonicalJson,
59738
+ cacheHitRatio: () => cacheHitRatio,
59739
+ bumpStageSchemaMinor: () => bumpStageSchemaMinor,
59740
+ bumpStageSchemaMajor: () => bumpStageSchemaMajor,
58607
59741
  buildTaskSkeleton: () => buildTaskSkeleton,
59742
+ buildStageLayers: () => buildStageLayers,
59743
+ attributeWithoutTelemetry: () => attributeWithoutTelemetry,
59744
+ attributeFreshVsReused: () => attributeFreshVsReused,
58608
59745
  atomicWriteAsync: () => atomicWriteAsync,
58609
59746
  atomicWrite: () => atomicWrite,
59747
+ artifactFingerprintsMatch: () => artifactFingerprintsMatch,
58610
59748
  applyCliMigrations: () => applyCliMigrations,
59749
+ appendDisclosurePlaceholders: () => appendDisclosurePlaceholders,
58611
59750
  aggregateCosts: () => aggregateCosts,
59751
+ actionCostEstimated: () => actionCostEstimated,
59752
+ actionCost: () => actionCost,
58612
59753
  acquireEntityLock: () => acquireEntityLock,
58613
59754
  acquireCreateLock: () => acquireCreateLock,
58614
59755
  WorkspaceDao: () => WorkspaceDao,
58615
59756
  WorkflowStateDao: () => WorkflowStateDao,
59757
+ VOLATILE_LAYER_NAMES: () => VOLATILE_LAYER_NAMES,
58616
59758
  UNKNOWN_MODEL_PRICING: () => UNKNOWN_MODEL_PRICING,
58617
59759
  UNIVERSAL_SECTIONS: () => UNIVERSAL_SECTIONS,
58618
59760
  TransitionRunDao: () => TransitionRunDao,
@@ -58624,7 +59766,13 @@ __export(exports_src, {
58624
59766
  TASK_STATUSES: () => TASK_STATUSES,
58625
59767
  TASK_CANONICAL_SECTIONS: () => TASK_CANONICAL_SECTIONS,
58626
59768
  SystemEventDao: () => SystemEventDao,
59769
+ StageRegistryError: () => StageRegistryError,
58627
59770
  SYSTEM_EVENTS_SCHEMA_SQL: () => SYSTEM_EVENTS_SCHEMA_SQL,
59771
+ STAGE_REGISTRY_SCHEMA_VERSION: () => STAGE_REGISTRY_SCHEMA_VERSION,
59772
+ STAGE_ID_PATTERN: () => STAGE_ID_PATTERN,
59773
+ STABLE_LAYER_NAMES: () => STABLE_LAYER_NAMES,
59774
+ SOURCE_TABLES: () => SOURCE_TABLES,
59775
+ SENSITIVITY_CLASSES: () => SENSITIVITY_CLASSES,
58628
59776
  SECTION_GUIDANCE: () => SECTION_GUIDANCE,
58629
59777
  RunDao: () => RunDao,
58630
59778
  RuleRunDao: () => RuleRunDao,
@@ -58635,7 +59783,9 @@ __export(exports_src, {
58635
59783
  PROFILES: () => PROFILES,
58636
59784
  PRIORITIES: () => PRIORITIES,
58637
59785
  MarkdownDocument: () => MarkdownDocument,
59786
+ MUTATION_CLASSES: () => MUTATION_CLASSES,
58638
59787
  MODEL_PRICING: () => MODEL_PRICING,
59788
+ InlineContext: () => InlineContext,
58639
59789
  InboxRecentDao: () => InboxRecentDao,
58640
59790
  InboxMessageDao: () => InboxMessageDao,
58641
59791
  INBOX_MESSAGES_SCHEMA_SQL: () => INBOX_MESSAGES_SCHEMA_SQL,
@@ -58643,14 +59793,20 @@ __export(exports_src, {
58643
59793
  FEATURE_STATUSES: () => FEATURE_STATUSES,
58644
59794
  FEATURE_ID_PATTERN: () => FEATURE_ID_PATTERN,
58645
59795
  FEATURE_CANONICAL_SECTIONS: () => FEATURE_CANONICAL_SECTIONS,
59796
+ EXECUTION_KINDS: () => EXECUTION_KINDS,
58646
59797
  DOMAIN_SCHEMA_SQL: () => DOMAIN_SCHEMA_SQL,
58647
59798
  DEFAULT_TASK_VARIANT: () => DEFAULT_TASK_VARIANT,
58648
59799
  DEFAULT_LOCK_TTL_MS: () => DEFAULT_LOCK_TTL_MS,
59800
+ DEFAULT_DISCLOSURE_BUDGET_BYTES: () => DEFAULT_DISCLOSURE_BUDGET_BYTES,
59801
+ CONTEXT_LAYER_NAMES: () => CONTEXT_LAYER_NAMES,
58649
59802
  CLI_SCHEMA_SQL: () => CLI_SCHEMA_SQL,
58650
59803
  CLI_MIGRATION_FILE_MARKER: () => CLI_MIGRATION_FILE_MARKER,
58651
59804
  CLI_MIGRATIONS: () => CLI_MIGRATIONS,
59805
+ CACHEABILITY_CLASSES: () => CACHEABILITY_CLASSES,
58652
59806
  ArtifactDao: () => ArtifactDao,
58653
- ActionRunDao: () => ActionRunDao
59807
+ ActionRunDao: () => ActionRunDao,
59808
+ AUTHORITY_LANES: () => AUTHORITY_LANES,
59809
+ ARTIFACT_DIRECTIONS: () => ARTIFACT_DIRECTIONS
58654
59810
  });
58655
59811
  var init_src2 = __esm(() => {
58656
59812
  init_db2();
@@ -58659,11 +59815,13 @@ var init_src2 = __esm(() => {
58659
59815
  init_analytics();
58660
59816
  init_bdd();
58661
59817
  init_dao();
59818
+ init_envelope();
58662
59819
  init_locks();
58663
59820
  init_markdown_document();
58664
59821
  init_rebuild_events();
58665
- init_schema4();
59822
+ init_schema6();
58666
59823
  init_task_skeleton();
59824
+ init_stage_registry();
58667
59825
  });
58668
59826
 
58669
59827
  // ../../packages/app/src/services/corpus-migrator.ts
@@ -59547,7 +60705,7 @@ var init_feature_check = __esm(() => {
59547
60705
  }
59548
60706
  const scopeBody = doc2.getSection("Scope");
59549
60707
  if (scopeBody !== null && scopeBody.trim().length > 0) {
59550
- const hasInOut = /\b[Ii]n\s*scope\b/.test(scopeBody) || /\b[Oo]ut\s*of\s*scope\b/.test(scopeBody) || /\b[Ii]n:\b/.test(scopeBody) || /\b[Oo]ut:\b/.test(scopeBody);
60708
+ const hasInOut = /\b[Ii]n\s*scope\b/.test(scopeBody) || /\b[Oo]ut\s*of\s*scope\b/.test(scopeBody) || /^\s*(?:[-*+]\s*)?\*{0,2}[Ii]n\*{0,2}\s*:/m.test(scopeBody) || /^\s*(?:[-*+]\s*)?\*{0,2}[Oo]ut\*{0,2}\s*:/m.test(scopeBody);
59551
60709
  if (!hasInOut) {
59552
60710
  findings.push({
59553
60711
  layer: "L3",
@@ -59841,14 +60999,15 @@ class FeatureService {
59841
60999
  } catch {}
59842
61000
  return null;
59843
61001
  }
59844
- async refresh() {
61002
+ async refresh(options) {
59845
61003
  const features = await this.list();
59846
61004
  features.sort((a2, b) => a2.id.localeCompare(b.id));
59847
61005
  const index2 = renderIndex(features);
59848
61006
  await atomicWriteAsync(`${this.ctx.featuresDir}/INDEX.md`, index2, "INDEX", this.ctx.fs, this.ctx.projectName ?? "spur");
59849
61007
  const tasksByFeature = await this.collectTasksByFeature();
61008
+ const targets = options?.featureId ? features.filter((f) => f.id === options.featureId) : features;
59850
61009
  let tasksUpdated = 0;
59851
- for (const feature of features) {
61010
+ for (const feature of targets) {
59852
61011
  const rows = tasksByFeature.get(feature.id) ?? [];
59853
61012
  const table3 = renderTasksTable(rows);
59854
61013
  const raw = await this.ctx.fs.readFile(feature.filePath);
@@ -59860,7 +61019,10 @@ class FeatureService {
59860
61019
  } catch {
59861
61020
  continue;
59862
61021
  }
59863
- await atomicWriteAsync(feature.filePath, doc2.serialize(), feature.id, this.ctx.fs, this.ctx.projectName ?? "spur");
61022
+ const next = doc2.serialize();
61023
+ if (next === raw)
61024
+ continue;
61025
+ await atomicWriteAsync(feature.filePath, next, feature.id, this.ctx.fs, this.ctx.projectName ?? "spur");
59864
61026
  tasksUpdated += 1;
59865
61027
  }
59866
61028
  return { index: index2, tasksUpdated };
@@ -60363,6 +61525,9 @@ class PlanningWriteService {
60363
61525
  async updateFrontmatter(ref, key, value) {
60364
61526
  return this.executePipeline(ref, { kind: "updateFrontmatter", fmKey: key, fmValue: value });
60365
61527
  }
61528
+ async updateFrontmatterArray(ref, key, values) {
61529
+ return this.executePipeline(ref, { kind: "updateFrontmatterArray", fmKey: key, fmArrayValue: values });
61530
+ }
60366
61531
  async transition(ref, toStatus, actor = "system") {
60367
61532
  return this.executePipeline(ref, { kind: "transition", fmKey: "status", fmValue: toStatus, actor });
60368
61533
  }
@@ -60474,6 +61639,11 @@ function applyMutation(doc2, mutation) {
60474
61639
  doc2.setFrontmatterField(mutation.fmKey, mutation.fmValue);
60475
61640
  }
60476
61641
  break;
61642
+ case "updateFrontmatterArray":
61643
+ if (mutation.fmKey !== undefined && mutation.fmArrayValue !== undefined) {
61644
+ doc2.setFrontmatterArray(mutation.fmKey, mutation.fmArrayValue);
61645
+ }
61646
+ break;
60477
61647
  }
60478
61648
  }
60479
61649
  function appendHistoryLine(doc2, timestamp2, from, to, actor) {
@@ -60719,8 +61889,13 @@ function shortLabel(command, source, pid) {
60719
61889
  return leaf || `pid:${pid}`;
60720
61890
  }
60721
61891
  function startedAtFromElapsed(elapsedSeconds, capturedAtIso) {
61892
+ if (!Number.isFinite(elapsedSeconds))
61893
+ return null;
60722
61894
  const captured = new Date(capturedAtIso).getTime();
60723
- return new Date(captured - elapsedSeconds * 1000).toISOString();
61895
+ if (!Number.isFinite(captured))
61896
+ return null;
61897
+ const started = new Date(captured - elapsedSeconds * 1000);
61898
+ return Number.isNaN(started.getTime()) ? null : started.toISOString();
60724
61899
  }
60725
61900
  var DEFAULT_MAX_COMMAND = 200;
60726
61901
  var init_process_inventory_service = __esm(() => {
@@ -62440,6 +63615,14 @@ function sectionIsBare(doc2, name) {
62440
63615
  return true;
62441
63616
  return false;
62442
63617
  }
63618
+ function renderSectionGuidanceBody(name) {
63619
+ const guidance = SECTION_GUIDANCE[name];
63620
+ if (guidance === undefined)
63621
+ return "";
63622
+ if (name === "History")
63623
+ return "";
63624
+ return `<!-- ${guidance} -->`;
63625
+ }
62443
63626
 
62444
63627
  class TaskService {
62445
63628
  ctx;
@@ -62546,6 +63729,191 @@ class TaskService {
62546
63729
  const ref = { kind: "task", id: wbs, filePath, folder: this.ctx.tasksDir };
62547
63730
  return this.writeService.updateFrontmatter(ref, key, value);
62548
63731
  }
63732
+ async mutateDependencies(wbs, op, values = []) {
63733
+ if (op === "clear") {
63734
+ if (values.length > 0) {
63735
+ throw new DependencyMutationError("usage", `clear takes no values; got ${values.length}`);
63736
+ }
63737
+ } else if (values.length === 0) {
63738
+ throw new DependencyMutationError("usage", `${op} requires at least one WBS value`);
63739
+ }
63740
+ const filePath = await this.resolveTaskFile(wbs);
63741
+ const current = await this.readDependencyArray(filePath);
63742
+ let next;
63743
+ if (op === "clear") {
63744
+ next = [];
63745
+ } else if (op === "set") {
63746
+ next = [...values];
63747
+ } else if (op === "add") {
63748
+ next = [...current];
63749
+ for (const v of values) {
63750
+ if (!next.includes(v))
63751
+ next.push(v);
63752
+ }
63753
+ } else {
63754
+ next = current.filter((v) => !values.includes(v));
63755
+ }
63756
+ for (const v of next) {
63757
+ if (!/^\d{4}$/.test(v)) {
63758
+ throw new DependencyMutationError("format", `Not a 4-digit WBS: "${v}"`);
63759
+ }
63760
+ }
63761
+ for (const v of next) {
63762
+ const target = await this.findTaskFileName(v);
63763
+ if (target === null) {
63764
+ throw new DependencyMutationError("not-found", `No task file for WBS ${v}`);
63765
+ }
63766
+ }
63767
+ if (next.includes(wbs)) {
63768
+ throw new DependencyMutationError("self-edge", `Task ${wbs} cannot depend on itself`);
63769
+ }
63770
+ if (new Set(next).size !== next.length) {
63771
+ throw new DependencyMutationError("duplicate", `Duplicate WBS in dependencies: ${next.join(", ")}`);
63772
+ }
63773
+ await this.assertNoCycle(wbs, next);
63774
+ const ref = { kind: "task", id: wbs, filePath, folder: this.ctx.tasksDir };
63775
+ const result = await this.writeService.updateFrontmatterArray(ref, "dependencies", next);
63776
+ return { ...result, dependencies: next };
63777
+ }
63778
+ async mutateSections(wbs, op, sectionName) {
63779
+ if (op === "add" && sectionName === undefined) {
63780
+ throw new SectionMutationError("usage", "add requires a section name");
63781
+ }
63782
+ if (op !== "add" && sectionName !== undefined) {
63783
+ throw new SectionMutationError("usage", `${op} takes no section name; got "${sectionName}"`);
63784
+ }
63785
+ const filePath = await this.resolveTaskFile(wbs);
63786
+ const ref = { kind: "task", id: wbs, filePath, folder: this.ctx.tasksDir };
63787
+ const raw = await this.ctx.fs.readFile(filePath);
63788
+ const doc2 = MarkdownDocument.parse(raw, "task");
63789
+ const fm = doc2.frontmatterData ?? {};
63790
+ const variant = typeof fm.template === "string" ? fm.template : DEFAULT_TASK_VARIANT;
63791
+ const status = typeof fm.status === "string" ? fm.status : "backlog";
63792
+ const matrix = this.ctx.sectionMatrix;
63793
+ const entry = matrix?.variants[variant]?.[status] ?? matrix?.variants.standard?.[status];
63794
+ if (entry === undefined) {
63795
+ throw new SectionMutationError("no-matrix", `No section matrix for variant "${variant}" status "${status}"`);
63796
+ }
63797
+ const required2 = entry.required ?? [];
63798
+ const optional2 = entry.optional ?? [];
63799
+ const forbidden = entry.forbidden ?? [];
63800
+ const present = doc2.sectionNames;
63801
+ if (op === "list") {
63802
+ return {
63803
+ op: "list",
63804
+ ref,
63805
+ variant,
63806
+ status,
63807
+ added: [],
63808
+ matrix: { required: [...required2], optional: [...optional2], forbidden: [...forbidden] },
63809
+ present,
63810
+ missing: required2.filter((s) => !present.includes(s)),
63811
+ warnings: []
63812
+ };
63813
+ }
63814
+ if (op === "add") {
63815
+ const name = sectionName;
63816
+ if (!TASK_CANONICAL_SECTIONS.includes(name) && !UNIVERSAL_SECTIONS.includes(name)) {
63817
+ throw new SectionMutationError("unknown-section", `Unknown section: "${name}"`);
63818
+ }
63819
+ if (forbidden.includes(name)) {
63820
+ throw new SectionMutationError("forbidden", `Section "${name}" is forbidden for status "${status}"`);
63821
+ }
63822
+ if (present.includes(name)) {
63823
+ return {
63824
+ op: "add",
63825
+ ref,
63826
+ variant,
63827
+ status,
63828
+ added: [],
63829
+ warnings: [`Section "${name}" already present; no change`]
63830
+ };
63831
+ }
63832
+ const body = renderSectionGuidanceBody(name);
63833
+ const result = await this.writeService.updateSection(ref, name, body);
63834
+ return {
63835
+ op: "add",
63836
+ ref,
63837
+ variant,
63838
+ status,
63839
+ added: [name],
63840
+ eventName: result.eventName,
63841
+ warnings: result.warnings ?? []
63842
+ };
63843
+ }
63844
+ const missing = required2.filter((s) => !present.includes(s));
63845
+ if (missing.length === 0) {
63846
+ return {
63847
+ op: "init",
63848
+ ref,
63849
+ variant,
63850
+ status,
63851
+ added: [],
63852
+ warnings: ["All required sections already present; no change"]
63853
+ };
63854
+ }
63855
+ const written = [];
63856
+ let last;
63857
+ for (const s of missing) {
63858
+ const body = renderSectionGuidanceBody(s);
63859
+ try {
63860
+ last = await this.writeService.updateSection(ref, s, body);
63861
+ } catch (err) {
63862
+ const landed = written.length > 0 ? written.join(", ") : "(none)";
63863
+ throw new Error(`init failed while writing section "${s}"; sections already written: ${landed}. ` + `Re-run init to complete the rest (it is idempotent). Cause: ${String(err)}`);
63864
+ }
63865
+ written.push(s);
63866
+ }
63867
+ return {
63868
+ op: "init",
63869
+ ref,
63870
+ variant,
63871
+ status,
63872
+ added: written,
63873
+ eventName: last?.eventName ?? "task.updated",
63874
+ warnings: last?.warnings ?? []
63875
+ };
63876
+ }
63877
+ async readDependencyArray(filePath) {
63878
+ const raw = await this.ctx.fs.readFile(filePath);
63879
+ const fm = MarkdownDocument.parse(raw, "task").frontmatterData ?? {};
63880
+ const deps = fm.dependencies;
63881
+ if (!Array.isArray(deps))
63882
+ return [];
63883
+ const out = [];
63884
+ for (const item of deps) {
63885
+ if (typeof item === "string")
63886
+ out.push(item);
63887
+ }
63888
+ return out;
63889
+ }
63890
+ async assertNoCycle(rootWbs, nextDeps) {
63891
+ const visiting = new Set;
63892
+ const seen = new Set;
63893
+ const stack = [...nextDeps];
63894
+ while (stack.length > 0) {
63895
+ const current = stack.pop();
63896
+ if (current === undefined)
63897
+ break;
63898
+ if (current === rootWbs) {
63899
+ throw new DependencyMutationError("cycle", `Dependency cycle detected: ${rootWbs} -> ... -> ${rootWbs}`);
63900
+ }
63901
+ if (seen.has(current))
63902
+ continue;
63903
+ if (visiting.has(current))
63904
+ continue;
63905
+ visiting.add(current);
63906
+ const found = await this.findTaskFileName(current);
63907
+ if (found !== null) {
63908
+ const deps = await this.readDependencyArray(found.filePath);
63909
+ for (const d of deps) {
63910
+ if (!seen.has(d) && !visiting.has(d))
63911
+ stack.push(d);
63912
+ }
63913
+ }
63914
+ seen.add(current);
63915
+ }
63916
+ }
62549
63917
  async updateBody(wbs, body, _actor) {
62550
63918
  const filePath = await this.resolveTaskFile(wbs);
62551
63919
  const ref = { kind: "task", id: wbs, filePath, folder: this.ctx.tasksDir };
@@ -62965,10 +64333,26 @@ ${block}` : block);
62965
64333
  return title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
62966
64334
  }
62967
64335
  }
62968
- var ROSTER_START = "<!-- AUTO-GENERATED by spur task refresh-roster -->", ROSTER_END = "<!-- END AUTO-GENERATED -->", ROSTER_REGION_RE, TASK_ACTION_COMMANDS, DEFAULT_CREATION_SECTIONS;
64336
+ var DependencyMutationError, SectionMutationError, ROSTER_START = "<!-- AUTO-GENERATED by spur task refresh-roster -->", ROSTER_END = "<!-- END AUTO-GENERATED -->", ROSTER_REGION_RE, TASK_ACTION_COMMANDS, DEFAULT_CREATION_SECTIONS;
62969
64337
  var init_task_service = __esm(() => {
62970
64338
  init_src2();
62971
64339
  init_task_record();
64340
+ DependencyMutationError = class DependencyMutationError extends Error {
64341
+ code;
64342
+ constructor(code, message) {
64343
+ super(message);
64344
+ this.name = "DependencyMutationError";
64345
+ this.code = code;
64346
+ }
64347
+ };
64348
+ SectionMutationError = class SectionMutationError extends Error {
64349
+ code;
64350
+ constructor(code, message) {
64351
+ super(message);
64352
+ this.name = "SectionMutationError";
64353
+ this.code = code;
64354
+ }
64355
+ };
62972
64356
  ROSTER_REGION_RE = /<!--[ \t]*AUTO-GENERATED[^>]*-->[\s\S]*?<!--[ \t]*END[ \t]*AUTO-GENERATED[^>]*-->/g;
62973
64357
  TASK_ACTION_COMMANDS = {
62974
64358
  refine: (wbs) => `/sp:dev-refine ${wbs} --auto`,
@@ -64925,6 +66309,19 @@ class WorkflowAppService {
64925
66309
  const phaseRows = await new PhaseRunDao(db2).phaseRowsByRunId(runId);
64926
66310
  const transitionRows = await new TransitionRunDao(db2).transitionRowsByRunId(runId);
64927
66311
  const actionRows = await new ActionRunDao(db2).actionRowsByRunId(runId);
66312
+ const costByActionId = new Map;
66313
+ if (actionRows.some((a2) => a2.kind === "agent.run")) {
66314
+ const etlPayloads = await loadAllEtlPayloads(db2);
66315
+ for (const a2 of actionRows) {
66316
+ if (a2.kind !== "agent.run")
66317
+ continue;
66318
+ try {
66319
+ const { records, estimated } = matchEtlPayloads(etlPayloads, a2);
66320
+ const cost = estimated ? actionCostEstimated(records, "") : actionCost(records, "");
66321
+ costByActionId.set(a2.id, cost);
66322
+ } catch {}
66323
+ }
66324
+ }
64928
66325
  const events2 = [];
64929
66326
  let pi = 0;
64930
66327
  let ti = 0;
@@ -64957,7 +66354,8 @@ class WorkflowAppService {
64957
66354
  status: a2.status,
64958
66355
  duration: duration3,
64959
66356
  ok: a2.ok === 1,
64960
- label
66357
+ label,
66358
+ cost: costByActionId.get(a2.id)
64961
66359
  });
64962
66360
  }
64963
66361
  }
@@ -65285,6 +66683,7 @@ __export(exports_src2, {
65285
66683
  TASK_ACTION_COMMANDS: () => TASK_ACTION_COMMANDS,
65286
66684
  SystemEventEmitter: () => SystemEventEmitter,
65287
66685
  SupervisorService: () => SupervisorService,
66686
+ SectionMutationError: () => SectionMutationError,
65288
66687
  SYSTEM_EVENT_STREAMED_NAMES: () => SYSTEM_EVENT_STREAMED_NAMES,
65289
66688
  SYSTEM_EVENT_PREFIXES: () => SYSTEM_EVENT_PREFIXES,
65290
66689
  SYSTEM_EVENT_PERSISTED_NAMES: () => SYSTEM_EVENT_PERSISTED_NAMES,
@@ -65315,6 +66714,7 @@ __export(exports_src2, {
65315
66714
  FeatureService: () => FeatureService,
65316
66715
  FeatureCheckService: () => FeatureCheckService,
65317
66716
  FEATURE_LIFECYCLE_PROFILE: () => FEATURE_LIFECYCLE_PROFILE,
66717
+ DependencyMutationError: () => DependencyMutationError,
65318
66718
  DEFAULT_FEATURE_MATRIX: () => DEFAULT_FEATURE_MATRIX,
65319
66719
  CorpusMigrator: () => CorpusMigrator,
65320
66720
  BusPlanningEventEmitter: () => BusPlanningEventEmitter,
@@ -65432,19 +66832,19 @@ var {
65432
66832
  init_src();
65433
66833
  init_loader();
65434
66834
 
65435
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/application-node.js
66835
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/application-node.js
65436
66836
  init_dist4();
65437
66837
  init_dist5();
65438
66838
  import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "fs";
65439
66839
  import { dirname as dirname5 } from "path";
65440
66840
 
65441
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/application/index.js
66841
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/application/index.js
65442
66842
  init_default_observers();
65443
66843
  init_event_bus();
65444
66844
  init_file_observer();
65445
66845
  init_logger3();
65446
66846
 
65447
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/scheduler/noop.js
66847
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/scheduler/noop.js
65448
66848
  class NoopSchedulerAdapter {
65449
66849
  constructor() {}
65450
66850
  register(_cron, _action) {}
@@ -65452,7 +66852,7 @@ class NoopSchedulerAdapter {
65452
66852
  async stop() {}
65453
66853
  }
65454
66854
 
65455
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/scheduler/factory.js
66855
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/scheduler/factory.js
65456
66856
  function initScheduler(adapter, cronEntries) {
65457
66857
  const resolved = adapter ?? new NoopSchedulerAdapter;
65458
66858
  if (cronEntries) {
@@ -65463,7 +66863,7 @@ function initScheduler(adapter, cronEntries) {
65463
66863
  return resolved;
65464
66864
  }
65465
66865
 
65466
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/application/plugins/builtins.js
66866
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/application/plugins/builtins.js
65467
66867
  init_logger3();
65468
66868
  init_metrics();
65469
66869
  init_sdk();
@@ -65556,7 +66956,7 @@ function dbPlugin(db2) {
65556
66956
  };
65557
66957
  }
65558
66958
 
65559
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/application/plugins/host.js
66959
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/application/plugins/host.js
65560
66960
  init_logger3();
65561
66961
 
65562
66962
  class PluginHost {
@@ -65644,7 +67044,7 @@ class PluginHost {
65644
67044
  }
65645
67045
  }
65646
67046
 
65647
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/application/index.js
67047
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/application/index.js
65648
67048
  async function performShutdown(state, reason) {
65649
67049
  if (state.stopped)
65650
67050
  return;
@@ -65755,10 +67155,10 @@ async function runApplication(options) {
65755
67155
  }
65756
67156
  }
65757
67157
 
65758
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/application-node.js
67158
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/application-node.js
65759
67159
  init_scheduler_node();
65760
67160
 
65761
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
67161
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
65762
67162
  var import_api14 = __toESM(require_src(), 1);
65763
67163
 
65764
67164
  // ../../node_modules/.bun/@opentelemetry+exporter-metrics-otlp-http@0.218.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esm/OTLPMetricExporterBase.js
@@ -68774,7 +70174,7 @@ class OTLPTraceExporter extends import_otlp_exporter_base2.OTLPExporterBase {
68774
70174
  }), JsonTraceSerializer));
68775
70175
  }
68776
70176
  }
68777
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
70177
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
68778
70178
  var import_resources2 = __toESM(require_src4(), 1);
68779
70179
  var import_sdk_trace_node = __toESM(require_src8(), 1);
68780
70180
  var import_semantic_conventions = __toESM(require_src2(), 1);
@@ -68825,7 +70225,7 @@ async function shutdownNodeTelemetry() {
68825
70225
  await Promise.all(pending);
68826
70226
  }
68827
70227
 
68828
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.10+8e607bbe3266e5fa/node_modules/@gobing-ai/ts-infra/dist/application-node.js
70228
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.11+08507d81f591b81d/node_modules/@gobing-ai/ts-infra/dist/application-node.js
68829
70229
  class ConfigValidationError extends Error {
68830
70230
  constructor(message) {
68831
70231
  super(message);
@@ -73166,10 +74566,10 @@ function registerFeatureCommand(program2, context4) {
73166
74566
  context4.setExitCode(1);
73167
74567
  }
73168
74568
  });
73169
- feature.command("refresh").summary("Regenerate INDEX.md (ID-encoded tree) and repopulate each feature ## Tasks region.").option("--folder <path>", "Custom features folder").option("--json", "Output machine-readable JSON").action(async (options) => {
74569
+ feature.command("refresh").summary("Regenerate INDEX.md (ID-encoded tree) and repopulate each feature ## Tasks region.").option("--feature <id>", "Restrict the ## Tasks rewrite to one feature (INDEX.md still regenerated)").option("--folder <path>", "Custom features folder").option("--json", "Output machine-readable JSON").action(async (options) => {
73170
74570
  const svc = await makeService(context4, options.folder);
73171
74571
  try {
73172
- const result = await svc.refresh();
74572
+ const result = await svc.refresh({ featureId: options.feature });
73173
74573
  if (options.json) {
73174
74574
  const featuresDir = options.folder ?? (await resolvePlanningFolders(context4.fs)).featuresDir;
73175
74575
  context4.output.write(toJson2({ index_path: `${featuresDir}/INDEX.md`, tasksUpdated: result.tasksUpdated }));
@@ -73310,7 +74710,7 @@ import { join as join15, resolve as resolve5 } from "path";
73310
74710
  var CLI_CONFIG = {
73311
74711
  binaryName: "spur",
73312
74712
  binaryLabel: "spur",
73313
- binaryVersion: "0.3.16",
74713
+ binaryVersion: "0.3.18",
73314
74714
  configDir: ".spur",
73315
74715
  configFile: ".spur/config.yaml",
73316
74716
  databaseFile: ".spur/spur.db"
@@ -75332,16 +76732,16 @@ class ContractBuilder extends ContractProcedure {
75332
76732
  route: mergeRoute(this["~orpc"].route, route)
75333
76733
  });
75334
76734
  }
75335
- input(schema2) {
76735
+ input(schema4) {
75336
76736
  return new ContractBuilder({
75337
76737
  ...this["~orpc"],
75338
- inputSchema: schema2
76738
+ inputSchema: schema4
75339
76739
  });
75340
76740
  }
75341
- output(schema2) {
76741
+ output(schema4) {
75342
76742
  return new ContractBuilder({
75343
76743
  ...this["~orpc"],
75344
- outputSchema: schema2
76744
+ outputSchema: schema4
75345
76745
  });
75346
76746
  }
75347
76747
  prefix(prefix) {
@@ -75379,11 +76779,11 @@ function fallbackContractConfig(key, value2) {
75379
76779
  return value2;
75380
76780
  }
75381
76781
  var EVENT_ITERATOR_DETAILS_SYMBOL = Symbol("ORPC_EVENT_ITERATOR_DETAILS");
75382
- function getEventIteratorSchemaDetails(schema2) {
75383
- if (schema2 === undefined) {
76782
+ function getEventIteratorSchemaDetails(schema4) {
76783
+ if (schema4 === undefined) {
75384
76784
  return;
75385
76785
  }
75386
- return schema2["~standard"][EVENT_ITERATOR_DETAILS_SYMBOL];
76786
+ return schema4["~standard"][EVENT_ITERATOR_DETAILS_SYMBOL];
75387
76787
  }
75388
76788
 
75389
76789
  // ../../node_modules/.bun/@orpc+server@1.14.4+a904a9933278b24d/node_modules/@orpc/server/dist/shared/server.DEBcqOjg.mjs
@@ -75512,12 +76912,12 @@ function createProcedureClient(lazyableProcedure, ...rest) {
75512
76912
  };
75513
76913
  }
75514
76914
  async function validateInput(procedure, input) {
75515
- const schema2 = procedure["~orpc"].inputSchema;
75516
- if (!schema2) {
76915
+ const schema4 = procedure["~orpc"].inputSchema;
76916
+ if (!schema4) {
75517
76917
  return input;
75518
76918
  }
75519
76919
  return runWithSpan({ name: "validate_input" }, async () => {
75520
- const result = await schema2["~standard"].validate(input);
76920
+ const result = await schema4["~standard"].validate(input);
75521
76921
  if (result.issues) {
75522
76922
  throw new ORPCError("BAD_REQUEST", {
75523
76923
  message: "Input validation failed",
@@ -75535,12 +76935,12 @@ async function validateInput(procedure, input) {
75535
76935
  });
75536
76936
  }
75537
76937
  async function validateOutput(procedure, output2) {
75538
- const schema2 = procedure["~orpc"].outputSchema;
75539
- if (!schema2) {
76938
+ const schema4 = procedure["~orpc"].outputSchema;
76939
+ if (!schema4) {
75540
76940
  return output2;
75541
76941
  }
75542
76942
  return runWithSpan({ name: "validate_output" }, async () => {
75543
- const result = await schema2["~standard"].validate(output2);
76943
+ const result = await schema4["~standard"].validate(output2);
75544
76944
  if (result.issues) {
75545
76945
  throw new ORPCError("INTERNAL_SERVER_ERROR", {
75546
76946
  message: "Output validation failed",
@@ -76517,17 +77917,17 @@ class Builder {
76517
77917
  route: mergeRoute(this["~orpc"].route, route)
76518
77918
  });
76519
77919
  }
76520
- input(schema2) {
77920
+ input(schema4) {
76521
77921
  return new Builder({
76522
77922
  ...this["~orpc"],
76523
- inputSchema: schema2,
77923
+ inputSchema: schema4,
76524
77924
  inputValidationIndex: fallbackConfig("initialInputValidationIndex", this["~orpc"].config.initialInputValidationIndex) + this["~orpc"].middlewares.length
76525
77925
  });
76526
77926
  }
76527
- output(schema2) {
77927
+ output(schema4) {
76528
77928
  return new Builder({
76529
77929
  ...this["~orpc"],
76530
- outputSchema: schema2,
77930
+ outputSchema: schema4,
76531
77931
  outputValidationIndex: fallbackConfig("initialOutputValidationIndex", this["~orpc"].config.initialOutputValidationIndex) + this["~orpc"].middlewares.length
76532
77932
  });
76533
77933
  }
@@ -79392,7 +80792,7 @@ var eventsModule = {
79392
80792
  if (closed.current)
79393
80793
  return;
79394
80794
  const entry = systemEventCatalogEntry(name);
79395
- const envelope = {
80795
+ const envelope2 = {
79396
80796
  eventName: name,
79397
80797
  occurredAt: new Date().toISOString(),
79398
80798
  actor: extractSystemEventActor2(event2),
@@ -79401,7 +80801,7 @@ var eventsModule = {
79401
80801
  payload: entry ? normalizeSystemEventPayload(entry, event2) : null
79402
80802
  };
79403
80803
  try {
79404
- controller.enqueue(encoder.encode(`data: ${JSON.stringify(envelope)}
80804
+ controller.enqueue(encoder.encode(`data: ${JSON.stringify(envelope2)}
79405
80805
 
79406
80806
  `));
79407
80807
  } catch {}
@@ -79458,7 +80858,7 @@ var eventsModule = {
79458
80858
  init_zod();
79459
80859
 
79460
80860
  // ../../packages/contracts/src/feature.ts
79461
- init_schema4();
80861
+ init_schema6();
79462
80862
  init_zod();
79463
80863
 
79464
80864
  // ../../packages/contracts/src/shared.ts
@@ -79693,7 +81093,7 @@ var planningEventContract = {
79693
81093
  };
79694
81094
 
79695
81095
  // ../../packages/contracts/src/task.ts
79696
- init_schema4();
81096
+ init_schema6();
79697
81097
  init_zod();
79698
81098
  var taskSummarySchema = exports_external.object({
79699
81099
  wbs: exports_external.string().regex(/^\d{4}$/),
@@ -79845,7 +81245,7 @@ var contract = {
79845
81245
  };
79846
81246
 
79847
81247
  // ../server/src/modules/feature/handlers.ts
79848
- init_schema4();
81248
+ init_schema6();
79849
81249
  var os2 = implement(contract);
79850
81250
  function createResponseShape(r2) {
79851
81251
  return { id: r2.ref.id, filePath: r2.ref.filePath };
@@ -80226,7 +81626,7 @@ var observabilityModule = {
80226
81626
  };
80227
81627
 
80228
81628
  // ../server/src/modules/task/handlers.ts
80229
- init_schema4();
81629
+ init_schema6();
80230
81630
  var os3 = implement(contract);
80231
81631
  function toFilters(query) {
80232
81632
  if (!query)
@@ -80705,43 +82105,43 @@ var LOGIC_KEYWORDS = [
80705
82105
  "unevaluatedProperties",
80706
82106
  "uniqueItems"
80707
82107
  ];
80708
- function isFileSchema(schema2) {
80709
- return isObject5(schema2) && schema2.type === "string" && typeof schema2.contentMediaType === "string";
82108
+ function isFileSchema(schema4) {
82109
+ return isObject5(schema4) && schema4.type === "string" && typeof schema4.contentMediaType === "string";
80710
82110
  }
80711
- function isObjectSchema(schema2) {
80712
- return isObject5(schema2) && schema2.type === "object";
82111
+ function isObjectSchema(schema4) {
82112
+ return isObject5(schema4) && schema4.type === "object";
80713
82113
  }
80714
- function isAnySchema(schema2) {
80715
- if (schema2 === true) {
82114
+ function isAnySchema(schema4) {
82115
+ if (schema4 === true) {
80716
82116
  return true;
80717
82117
  }
80718
- if (Object.keys(schema2).filter((v) => schema2[v] !== undefined).every((k) => !LOGIC_KEYWORDS.includes(k))) {
82118
+ if (Object.keys(schema4).filter((v) => schema4[v] !== undefined).every((k) => !LOGIC_KEYWORDS.includes(k))) {
80719
82119
  return true;
80720
82120
  }
80721
82121
  return false;
80722
82122
  }
80723
- function isNeverSchema(schema2) {
80724
- if (schema2 === false) {
82123
+ function isNeverSchema(schema4) {
82124
+ if (schema4 === false) {
80725
82125
  return true;
80726
82126
  }
80727
- if (typeof schema2 === "object" && schema2.not !== undefined) {
80728
- if (schema2.not === true) {
82127
+ if (typeof schema4 === "object" && schema4.not !== undefined) {
82128
+ if (schema4.not === true) {
80729
82129
  return true;
80730
82130
  }
80731
- if (typeof schema2.not === "object" && Object.keys(schema2.not).length === 0) {
82131
+ if (typeof schema4.not === "object" && Object.keys(schema4.not).length === 0) {
80732
82132
  return true;
80733
82133
  }
80734
82134
  }
80735
82135
  return false;
80736
82136
  }
80737
- function separateObjectSchema(schema2, separatedProperties) {
80738
- if (Object.keys(schema2).some((k) => !["type", "properties", "required", "additionalProperties"].includes(k) && LOGIC_KEYWORDS.includes(k) && schema2[k] !== undefined)) {
80739
- return [{ type: "object" }, schema2];
82137
+ function separateObjectSchema(schema4, separatedProperties) {
82138
+ if (Object.keys(schema4).some((k) => !["type", "properties", "required", "additionalProperties"].includes(k) && LOGIC_KEYWORDS.includes(k) && schema4[k] !== undefined)) {
82139
+ return [{ type: "object" }, schema4];
80740
82140
  }
80741
- const matched = { ...schema2 };
80742
- const rest = { ...schema2 };
82141
+ const matched = { ...schema4 };
82142
+ const rest = { ...schema4 };
80743
82143
  matched.properties = separatedProperties.reduce((acc, key) => {
80744
- const keySchema = schema2.properties?.[key] ?? schema2.additionalProperties;
82144
+ const keySchema = schema4.properties?.[key] ?? schema4.additionalProperties;
80745
82145
  if (keySchema !== undefined) {
80746
82146
  acc[key] = keySchema;
80747
82147
  }
@@ -80750,11 +82150,11 @@ function separateObjectSchema(schema2, separatedProperties) {
80750
82150
  if (Object.keys(matched.properties).length === 0) {
80751
82151
  matched.properties = undefined;
80752
82152
  }
80753
- matched.required = schema2.required?.filter((key) => separatedProperties.includes(key));
82153
+ matched.required = schema4.required?.filter((key) => separatedProperties.includes(key));
80754
82154
  if (matched.required?.length === 0) {
80755
82155
  matched.required = undefined;
80756
82156
  }
80757
- matched.examples = schema2.examples?.map((example) => {
82157
+ matched.examples = schema4.examples?.map((example) => {
80758
82158
  if (!isObject5(example)) {
80759
82159
  return example;
80760
82160
  }
@@ -80765,15 +82165,15 @@ function separateObjectSchema(schema2, separatedProperties) {
80765
82165
  return acc;
80766
82166
  }, {});
80767
82167
  });
80768
- rest.properties = schema2.properties && Object.entries(schema2.properties).filter(([key]) => !separatedProperties.includes(key)).reduce((acc = {}, [key, value2]) => {
82168
+ rest.properties = schema4.properties && Object.entries(schema4.properties).filter(([key]) => !separatedProperties.includes(key)).reduce((acc = {}, [key, value2]) => {
80769
82169
  acc[key] = value2;
80770
82170
  return acc;
80771
82171
  }, undefined);
80772
- rest.required = schema2.required?.filter((key) => !separatedProperties.includes(key));
82172
+ rest.required = schema4.required?.filter((key) => !separatedProperties.includes(key));
80773
82173
  if (rest.required?.length === 0) {
80774
82174
  rest.required = undefined;
80775
82175
  }
80776
- rest.examples = schema2.examples?.map((example) => {
82176
+ rest.examples = schema4.examples?.map((example) => {
80777
82177
  if (!isObject5(example)) {
80778
82178
  return example;
80779
82179
  }
@@ -80786,47 +82186,47 @@ function separateObjectSchema(schema2, separatedProperties) {
80786
82186
  });
80787
82187
  return [matched, rest];
80788
82188
  }
80789
- function filterSchemaBranches(schema2, check2, matches = []) {
80790
- if (check2(schema2)) {
80791
- matches.push(schema2);
82189
+ function filterSchemaBranches(schema4, check2, matches = []) {
82190
+ if (check2(schema4)) {
82191
+ matches.push(schema4);
80792
82192
  return [matches, undefined];
80793
82193
  }
80794
- if (isObject5(schema2)) {
82194
+ if (isObject5(schema4)) {
80795
82195
  for (const keyword of ["anyOf", "oneOf"]) {
80796
- if (schema2[keyword] && Object.keys(schema2).every((k) => k === keyword || !LOGIC_KEYWORDS.includes(k))) {
80797
- const rest = schema2[keyword].map((s) => filterSchemaBranches(s, check2, matches)[1]).filter((v) => !!v);
82196
+ if (schema4[keyword] && Object.keys(schema4).every((k) => k === keyword || !LOGIC_KEYWORDS.includes(k))) {
82197
+ const rest = schema4[keyword].map((s) => filterSchemaBranches(s, check2, matches)[1]).filter((v) => !!v);
80798
82198
  if (rest.length === 1 && typeof rest[0] === "object") {
80799
- return [matches, { ...schema2, [keyword]: undefined, ...rest[0] }];
82199
+ return [matches, { ...schema4, [keyword]: undefined, ...rest[0] }];
80800
82200
  }
80801
- return [matches, { ...schema2, [keyword]: rest }];
82201
+ return [matches, { ...schema4, [keyword]: rest }];
80802
82202
  }
80803
82203
  }
80804
82204
  }
80805
- return [matches, schema2];
82205
+ return [matches, schema4];
80806
82206
  }
80807
- function applySchemaOptionality(required2, schema2) {
82207
+ function applySchemaOptionality(required2, schema4) {
80808
82208
  if (required2) {
80809
- return schema2;
82209
+ return schema4;
80810
82210
  }
80811
82211
  return {
80812
82212
  anyOf: [
80813
- schema2,
82213
+ schema4,
80814
82214
  { not: {} }
80815
82215
  ]
80816
82216
  };
80817
82217
  }
80818
- function expandUnionSchema(schema2) {
80819
- if (typeof schema2 === "object") {
82218
+ function expandUnionSchema(schema4) {
82219
+ if (typeof schema4 === "object") {
80820
82220
  for (const keyword of ["anyOf", "oneOf"]) {
80821
- if (schema2[keyword] && Object.keys(schema2).every((k) => k === keyword || !LOGIC_KEYWORDS.includes(k))) {
80822
- return schema2[keyword].flatMap((s) => expandUnionSchema(s));
82221
+ if (schema4[keyword] && Object.keys(schema4).every((k) => k === keyword || !LOGIC_KEYWORDS.includes(k))) {
82222
+ return schema4[keyword].flatMap((s) => expandUnionSchema(s));
80823
82223
  }
80824
82224
  }
80825
82225
  }
80826
- return [schema2];
82226
+ return [schema4];
80827
82227
  }
80828
- function expandArrayableSchema(schema2) {
80829
- const schemas3 = expandUnionSchema(schema2);
82228
+ function expandArrayableSchema(schema4) {
82229
+ const schemas3 = expandUnionSchema(schema4);
80830
82230
  if (schemas3.length !== 2) {
80831
82231
  return;
80832
82232
  }
@@ -80848,8 +82248,8 @@ var PRIMITIVE_SCHEMA_TYPES = /* @__PURE__ */ new Set([
80848
82248
  TypeName.Boolean,
80849
82249
  TypeName.Null
80850
82250
  ]);
80851
- function isPrimitiveSchema(schema2) {
80852
- return expandUnionSchema(schema2).every((s) => {
82251
+ function isPrimitiveSchema(schema4) {
82252
+ return expandUnionSchema(schema4).every((s) => {
80853
82253
  if (typeof s === "boolean") {
80854
82254
  return false;
80855
82255
  }
@@ -80868,9 +82268,9 @@ function toOpenAPIPath(path9) {
80868
82268
  function toOpenAPIMethod(method) {
80869
82269
  return method.toLocaleLowerCase();
80870
82270
  }
80871
- function toOpenAPIContent(schema2) {
82271
+ function toOpenAPIContent(schema4) {
80872
82272
  const content = {};
80873
- const [matches, restSchema] = filterSchemaBranches(schema2, isFileSchema);
82273
+ const [matches, restSchema] = filterSchemaBranches(schema4, isFileSchema);
80874
82274
  for (const file2 of matches) {
80875
82275
  content[file2.contentMediaType] = {
80876
82276
  schema: toOpenAPISchema(file2)
@@ -80929,10 +82329,10 @@ function toOpenAPIEventIteratorContent([yieldsRequired, yieldsSchema], [returnsR
80929
82329
  }
80930
82330
  };
80931
82331
  }
80932
- function toOpenAPIParameters(schema2, parameterIn) {
82332
+ function toOpenAPIParameters(schema4, parameterIn) {
80933
82333
  const parameters = [];
80934
- for (const key in schema2.properties) {
80935
- const keySchema = schema2.properties[key];
82334
+ for (const key in schema4.properties) {
82335
+ const keySchema = schema4.properties[key];
80936
82336
  let isDeepObjectStyle = true;
80937
82337
  if (parameterIn !== "query") {
80938
82338
  isDeepObjectStyle = false;
@@ -80947,7 +82347,7 @@ function toOpenAPIParameters(schema2, parameterIn) {
80947
82347
  parameters.push({
80948
82348
  name: key,
80949
82349
  in: parameterIn,
80950
- required: schema2.required?.includes(key),
82350
+ required: schema4.required?.includes(key),
80951
82351
  schema: toOpenAPISchema(keySchema),
80952
82352
  style: isDeepObjectStyle ? "deepObject" : undefined,
80953
82353
  explode: isDeepObjectStyle ? true : undefined,
@@ -80957,9 +82357,9 @@ function toOpenAPIParameters(schema2, parameterIn) {
80957
82357
  }
80958
82358
  return parameters;
80959
82359
  }
80960
- function checkParamsSchema(schema2, params) {
80961
- const properties = Object.keys(schema2.properties ?? {});
80962
- const required2 = schema2.required ?? [];
82360
+ function checkParamsSchema(schema4, params) {
82361
+ const properties = Object.keys(schema4.properties ?? {});
82362
+ const required2 = schema4.required ?? [];
80963
82363
  if (properties.length !== params.length || properties.some((v) => !params.includes(v))) {
80964
82364
  return false;
80965
82365
  }
@@ -80968,33 +82368,33 @@ function checkParamsSchema(schema2, params) {
80968
82368
  }
80969
82369
  return true;
80970
82370
  }
80971
- function toOpenAPISchema(schema2) {
80972
- return schema2 === true ? {} : schema2 === false ? { not: {} } : schema2;
82371
+ function toOpenAPISchema(schema4) {
82372
+ return schema4 === true ? {} : schema4 === false ? { not: {} } : schema4;
80973
82373
  }
80974
82374
  var OPENAPI_JSON_SCHEMA_REF_PREFIX = "#/components/schemas/";
80975
- function resolveOpenAPIJsonSchemaRef(doc2, schema2) {
80976
- if (typeof schema2 !== "object" || !schema2.$ref?.startsWith(OPENAPI_JSON_SCHEMA_REF_PREFIX)) {
80977
- return schema2;
82375
+ function resolveOpenAPIJsonSchemaRef(doc2, schema4) {
82376
+ if (typeof schema4 !== "object" || !schema4.$ref?.startsWith(OPENAPI_JSON_SCHEMA_REF_PREFIX)) {
82377
+ return schema4;
80978
82378
  }
80979
- const name = schema2.$ref.slice(OPENAPI_JSON_SCHEMA_REF_PREFIX.length);
82379
+ const name = schema4.$ref.slice(OPENAPI_JSON_SCHEMA_REF_PREFIX.length);
80980
82380
  const resolved = doc2.components?.schemas?.[name];
80981
- return resolved ?? schema2;
82381
+ return resolved ?? schema4;
80982
82382
  }
80983
- function simplifyComposedObjectJsonSchemasAndRefs(schema2, doc2) {
82383
+ function simplifyComposedObjectJsonSchemasAndRefs(schema4, doc2) {
80984
82384
  if (doc2) {
80985
- schema2 = resolveOpenAPIJsonSchemaRef(doc2, schema2);
82385
+ schema4 = resolveOpenAPIJsonSchemaRef(doc2, schema4);
80986
82386
  }
80987
- if (typeof schema2 !== "object" || !schema2.anyOf && !schema2.oneOf && !schema2.allOf) {
80988
- return schema2;
82387
+ if (typeof schema4 !== "object" || !schema4.anyOf && !schema4.oneOf && !schema4.allOf) {
82388
+ return schema4;
80989
82389
  }
80990
82390
  const unionSchemas = [
80991
- ...toArray(schema2.anyOf?.map((s) => simplifyComposedObjectJsonSchemasAndRefs(s, doc2))),
80992
- ...toArray(schema2.oneOf?.map((s) => simplifyComposedObjectJsonSchemasAndRefs(s, doc2)))
82391
+ ...toArray(schema4.anyOf?.map((s) => simplifyComposedObjectJsonSchemasAndRefs(s, doc2))),
82392
+ ...toArray(schema4.oneOf?.map((s) => simplifyComposedObjectJsonSchemasAndRefs(s, doc2)))
80993
82393
  ];
80994
82394
  const objectUnionSchemas = [];
80995
82395
  for (const u2 of unionSchemas) {
80996
82396
  if (!isObjectSchema(u2)) {
80997
- return schema2;
82397
+ return schema4;
80998
82398
  }
80999
82399
  objectUnionSchemas.push(u2);
81000
82400
  }
@@ -81012,16 +82412,16 @@ function simplifyComposedObjectJsonSchemasAndRefs(schema2, doc2) {
81012
82412
  }
81013
82413
  }
81014
82414
  }
81015
- const intersectionSchemas = toArray(schema2.allOf?.map((s) => simplifyComposedObjectJsonSchemasAndRefs(s, doc2)));
82415
+ const intersectionSchemas = toArray(schema4.allOf?.map((s) => simplifyComposedObjectJsonSchemasAndRefs(s, doc2)));
81016
82416
  const objectIntersectionSchemas = [];
81017
82417
  for (const u2 of intersectionSchemas) {
81018
82418
  if (!isObjectSchema(u2)) {
81019
- return schema2;
82419
+ return schema4;
81020
82420
  }
81021
82421
  objectIntersectionSchemas.push(u2);
81022
82422
  }
81023
- if (isObjectSchema(schema2)) {
81024
- objectIntersectionSchemas.push(schema2);
82423
+ if (isObjectSchema(schema4)) {
82424
+ objectIntersectionSchemas.push(schema4);
81025
82425
  }
81026
82426
  const mergedInteractionPropertyMap = /* @__PURE__ */ new Map;
81027
82427
  for (const u2 of objectIntersectionSchemas) {
@@ -81043,7 +82443,7 @@ function simplifyComposedObjectJsonSchemasAndRefs(schema2, doc2) {
81043
82443
  ...mergedInteractionPropertyMap.keys()
81044
82444
  ]);
81045
82445
  if (keys.size === 0) {
81046
- return schema2;
82446
+ return schema4;
81047
82447
  }
81048
82448
  const deduplicateSchemas = (schemas3) => {
81049
82449
  const seen = /* @__PURE__ */ new Set;
@@ -81087,10 +82487,10 @@ class CompositeSchemaConverter {
81087
82487
  constructor(converters) {
81088
82488
  this.converters = converters;
81089
82489
  }
81090
- async convert(schema2, options) {
82490
+ async convert(schema4, options) {
81091
82491
  for (const converter of this.converters) {
81092
- if (await converter.condition(schema2, options)) {
81093
- return converter.convert(schema2, options);
82492
+ if (await converter.condition(schema4, options)) {
82493
+ return converter.convert(schema4, options);
81094
82494
  }
81095
82495
  }
81096
82496
  return [false, {}];
@@ -81189,22 +82589,22 @@ ${errors6.join(`
81189
82589
  if (options.schema === undefined) {
81190
82590
  continue;
81191
82591
  }
81192
- const { schema: schema2, strategy = "input" } = options;
81193
- const [required2, json3] = await this.converter.convert(schema2, { strategy });
82592
+ const { schema: schema4, strategy = "input" } = options;
82593
+ const [required2, json3] = await this.converter.convert(schema4, { strategy });
81194
82594
  const allowedStrategies = [strategy];
81195
82595
  if (strategy === "input") {
81196
- const [outputRequired, outputJson] = await this.converter.convert(schema2, { strategy: "output" });
82596
+ const [outputRequired, outputJson] = await this.converter.convert(schema4, { strategy: "output" });
81197
82597
  if (outputRequired === required2 && stringifyJSON(outputJson) === stringifyJSON(json3)) {
81198
82598
  allowedStrategies.push("output");
81199
82599
  }
81200
82600
  } else if (strategy === "output") {
81201
- const [inputRequired, inputJson] = await this.converter.convert(schema2, { strategy: "input" });
82601
+ const [inputRequired, inputJson] = await this.converter.convert(schema4, { strategy: "input" });
81202
82602
  if (inputRequired === required2 && stringifyJSON(inputJson) === stringifyJSON(json3)) {
81203
82603
  allowedStrategies.push("input");
81204
82604
  }
81205
82605
  }
81206
82606
  baseSchemaConvertOptions.components.push({
81207
- schema: schema2,
82607
+ schema: schema4,
81208
82608
  required: required2,
81209
82609
  ref: `#/components/schemas/${key}`,
81210
82610
  allowedStrategies
@@ -81221,8 +82621,8 @@ ${errors6.join(`
81221
82621
  }
81222
82622
  continue;
81223
82623
  }
81224
- const { schema: schema2, strategy = "input" } = options;
81225
- const [, json3] = await this.converter.convert(schema2, {
82624
+ const { schema: schema4, strategy = "input" } = options;
82625
+ const [, json3] = await this.converter.convert(schema4, {
81226
82626
  ...baseSchemaConvertOptions,
81227
82627
  strategy,
81228
82628
  minStructureDepthForRef: 1
@@ -81244,25 +82644,25 @@ ${errors6.join(`
81244
82644
  }
81245
82645
  const dynamicParams = getDynamicParams(def.route.path)?.map((v) => v.name);
81246
82646
  const inputStructure = fallbackContractConfig("defaultInputStructure", def.route.inputStructure);
81247
- let [required2, schema2] = await this.converter.convert(def.inputSchema, {
82647
+ let [required2, schema4] = await this.converter.convert(def.inputSchema, {
81248
82648
  ...baseSchemaConvertOptions,
81249
82649
  strategy: "input"
81250
82650
  });
81251
82651
  let omitResponseBody = false;
81252
- if (isAnySchema(schema2) && !dynamicParams?.length) {
82652
+ if (isAnySchema(schema4) && !dynamicParams?.length) {
81253
82653
  return;
81254
82654
  }
81255
82655
  if (inputStructure === "detailed" || inputStructure === "compact" && (dynamicParams?.length || method === "GET")) {
81256
- schema2 = simplifyComposedObjectJsonSchemasAndRefs(schema2, doc2);
82656
+ schema4 = simplifyComposedObjectJsonSchemasAndRefs(schema4, doc2);
81257
82657
  }
81258
82658
  if (inputStructure === "compact") {
81259
82659
  if (dynamicParams?.length) {
81260
82660
  const error210 = new OpenAPIGeneratorError('When input structure is "compact", and path has dynamic params, input schema must be an object with all dynamic params as required.');
81261
- if (!isObjectSchema(schema2)) {
82661
+ if (!isObjectSchema(schema4)) {
81262
82662
  throw error210;
81263
82663
  }
81264
- const [paramsSchema, rest] = separateObjectSchema(schema2, dynamicParams);
81265
- schema2 = rest;
82664
+ const [paramsSchema, rest] = separateObjectSchema(schema4, dynamicParams);
82665
+ schema4 = rest;
81266
82666
  required2 = rest.required ? rest.required.length !== 0 : false;
81267
82667
  omitResponseBody = !required2 && !rest.properties;
81268
82668
  if (!checkParamsSchema(paramsSchema, dynamicParams)) {
@@ -81272,29 +82672,29 @@ ${errors6.join(`
81272
82672
  ref.parameters.push(...toOpenAPIParameters(paramsSchema, "path"));
81273
82673
  }
81274
82674
  if (method === "GET") {
81275
- if (!isObjectSchema(schema2)) {
82675
+ if (!isObjectSchema(schema4)) {
81276
82676
  throw new OpenAPIGeneratorError('When method is "GET", input schema must satisfy: object | any | unknown');
81277
82677
  }
81278
82678
  ref.parameters ??= [];
81279
- ref.parameters.push(...toOpenAPIParameters(schema2, "query"));
82679
+ ref.parameters.push(...toOpenAPIParameters(schema4, "query"));
81280
82680
  } else if (!omitResponseBody) {
81281
82681
  ref.requestBody = {
81282
82682
  required: required2,
81283
- content: toOpenAPIContent(schema2)
82683
+ content: toOpenAPIContent(schema4)
81284
82684
  };
81285
82685
  }
81286
82686
  return;
81287
82687
  }
81288
82688
  const error51 = new OpenAPIGeneratorError('When input structure is "detailed", input schema must satisfy: { params?: Record<string, unknown>, query?: Record<string, unknown>, headers?: Record<string, unknown>, body?: unknown }');
81289
- if (!isObjectSchema(schema2)) {
82689
+ if (!isObjectSchema(schema4)) {
81290
82690
  throw error51;
81291
82691
  }
81292
- const resolvedParamSchema = schema2.properties?.params !== undefined ? simplifyComposedObjectJsonSchemasAndRefs(schema2.properties.params, doc2) : undefined;
82692
+ const resolvedParamSchema = schema4.properties?.params !== undefined ? simplifyComposedObjectJsonSchemasAndRefs(schema4.properties.params, doc2) : undefined;
81293
82693
  if (dynamicParams?.length && (resolvedParamSchema === undefined || !isObjectSchema(resolvedParamSchema) || !checkParamsSchema(resolvedParamSchema, dynamicParams))) {
81294
82694
  throw new OpenAPIGeneratorError('When input structure is "detailed" and path has dynamic params, the "params" schema must be an object with all dynamic params as required.');
81295
82695
  }
81296
82696
  for (const from of ["params", "query", "headers"]) {
81297
- const fromSchema = schema2.properties?.[from];
82697
+ const fromSchema = schema4.properties?.[from];
81298
82698
  if (fromSchema !== undefined) {
81299
82699
  const resolvedSchema = simplifyComposedObjectJsonSchemasAndRefs(fromSchema, doc2);
81300
82700
  if (!isObjectSchema(resolvedSchema)) {
@@ -81305,10 +82705,10 @@ ${errors6.join(`
81305
82705
  ref.parameters.push(...toOpenAPIParameters(resolvedSchema, parameterIn));
81306
82706
  }
81307
82707
  }
81308
- if (schema2.properties?.body !== undefined) {
82708
+ if (schema4.properties?.body !== undefined) {
81309
82709
  ref.requestBody = {
81310
- required: schema2.required?.includes("body"),
81311
- content: toOpenAPIContent(schema2.properties.body)
82710
+ required: schema4.required?.includes("body"),
82711
+ content: toOpenAPIContent(schema4.properties.body)
81312
82712
  };
81313
82713
  }
81314
82714
  }
@@ -81453,30 +82853,30 @@ var JsonSchemaXNativeType = /* @__PURE__ */ ((JsonSchemaXNativeType2) => {
81453
82853
  var FLEXIBLE_DATE_FORMAT_REGEX = /^[^-]+-[^-]+-[^-]+$/;
81454
82854
 
81455
82855
  class JsonSchemaCoercer {
81456
- coerce(schema2, value2, options = {}) {
81457
- const [, coerced] = this.#coerce(schema2, value2, options);
82856
+ coerce(schema4, value2, options = {}) {
82857
+ const [, coerced] = this.#coerce(schema4, value2, options);
81458
82858
  return coerced;
81459
82859
  }
81460
- #coerce(schema2, originalValue, options) {
81461
- if (typeof schema2 === "boolean") {
81462
- return [schema2, originalValue];
82860
+ #coerce(schema4, originalValue, options) {
82861
+ if (typeof schema4 === "boolean") {
82862
+ return [schema4, originalValue];
81463
82863
  }
81464
- if (Array.isArray(schema2.type)) {
82864
+ if (Array.isArray(schema4.type)) {
81465
82865
  return this.#coerce({
81466
- anyOf: schema2.type.map((type) => ({ ...schema2, type }))
82866
+ anyOf: schema4.type.map((type) => ({ ...schema4, type }))
81467
82867
  }, originalValue, options);
81468
82868
  }
81469
82869
  let coerced = originalValue;
81470
82870
  let satisfied = true;
81471
- if (typeof schema2.$ref === "string") {
81472
- const refSchema = options?.components?.[schema2.$ref];
82871
+ if (typeof schema4.$ref === "string") {
82872
+ const refSchema = options?.components?.[schema4.$ref];
81473
82873
  if (refSchema !== undefined) {
81474
82874
  const [subSatisfied, subCoerced] = this.#coerce(refSchema, coerced, options);
81475
82875
  coerced = subCoerced;
81476
82876
  satisfied = subSatisfied;
81477
82877
  }
81478
82878
  }
81479
- const enumValues = schema2.const !== undefined ? [schema2.const] : schema2.enum;
82879
+ const enumValues = schema4.const !== undefined ? [schema4.const] : schema4.enum;
81480
82880
  if (enumValues !== undefined && !enumValues.includes(coerced)) {
81481
82881
  if (typeof coerced === "string") {
81482
82882
  const numberValue = this.#stringToNumber(coerced);
@@ -81494,8 +82894,8 @@ class JsonSchemaCoercer {
81494
82894
  satisfied = false;
81495
82895
  }
81496
82896
  }
81497
- if (typeof schema2.type === "string") {
81498
- switch (schema2.type) {
82897
+ if (typeof schema4.type === "string") {
82898
+ switch (schema4.type) {
81499
82899
  case "null": {
81500
82900
  if (coerced !== null) {
81501
82901
  satisfied = false;
@@ -81537,8 +82937,8 @@ class JsonSchemaCoercer {
81537
82937
  }
81538
82938
  case "array": {
81539
82939
  if (Array.isArray(coerced)) {
81540
- const prefixItemSchemas = "prefixItems" in schema2 ? toArray(schema2.prefixItems) : Array.isArray(schema2.items) ? schema2.items : [];
81541
- const itemSchema = Array.isArray(schema2.items) ? schema2.additionalItems : schema2.items;
82940
+ const prefixItemSchemas = "prefixItems" in schema4 ? toArray(schema4.prefixItems) : Array.isArray(schema4.items) ? schema4.items : [];
82941
+ const itemSchema = Array.isArray(schema4.items) ? schema4.additionalItems : schema4.items;
81542
82942
  let shouldUseCoercedItems = false;
81543
82943
  const coercedItems = coerced.map((item, i2) => {
81544
82944
  const subSchema = prefixItemSchemas[i2] ?? itemSchema;
@@ -81573,11 +82973,11 @@ class JsonSchemaCoercer {
81573
82973
  if (isObject5(coerced)) {
81574
82974
  let shouldUseCoercedItems = false;
81575
82975
  const coercedItems = {};
81576
- const patternProperties = Object.entries(schema2.patternProperties ?? {}).map(([key, value2]) => [new RegExp(key), value2]);
82976
+ const patternProperties = Object.entries(schema4.patternProperties ?? {}).map(([key, value2]) => [new RegExp(key), value2]);
81577
82977
  for (const key in coerced) {
81578
82978
  const value2 = coerced[key];
81579
- const subSchema = schema2.properties?.[key] ?? patternProperties.find(([pattern]) => pattern.test(key))?.[1] ?? schema2.additionalProperties;
81580
- if (value2 === undefined && !schema2.required?.includes(key)) {
82979
+ const subSchema = schema4.properties?.[key] ?? patternProperties.find(([pattern]) => pattern.test(key))?.[1] ?? schema4.additionalProperties;
82980
+ if (value2 === undefined && !schema4.required?.includes(key)) {
81581
82981
  coercedItems[key] = value2;
81582
82982
  } else if (subSchema === undefined) {
81583
82983
  coercedItems[key] = value2;
@@ -81593,7 +82993,7 @@ class JsonSchemaCoercer {
81593
82993
  }
81594
82994
  }
81595
82995
  }
81596
- if (schema2.required?.some((key) => !Object.hasOwn(coercedItems, key))) {
82996
+ if (schema4.required?.some((key) => !Object.hasOwn(coercedItems, key))) {
81597
82997
  satisfied = false;
81598
82998
  }
81599
82999
  if (shouldUseCoercedItems) {
@@ -81606,8 +83006,8 @@ class JsonSchemaCoercer {
81606
83006
  }
81607
83007
  }
81608
83008
  }
81609
- if ("x-native-type" in schema2 && typeof schema2["x-native-type"] === "string") {
81610
- switch (schema2["x-native-type"]) {
83009
+ if ("x-native-type" in schema4 && typeof schema4["x-native-type"] === "string") {
83010
+ switch (schema4["x-native-type"]) {
81611
83011
  case JsonSchemaXNativeType.Date: {
81612
83012
  if (typeof coerced === "string") {
81613
83013
  coerced = this.#stringToDate(coerced);
@@ -81669,8 +83069,8 @@ class JsonSchemaCoercer {
81669
83069
  }
81670
83070
  }
81671
83071
  }
81672
- if (schema2.allOf) {
81673
- for (const subSchema of schema2.allOf) {
83072
+ if (schema4.allOf) {
83073
+ for (const subSchema of schema4.allOf) {
81674
83074
  const [subSatisfied, subCoerced] = this.#coerce(subSchema, coerced, options);
81675
83075
  coerced = subCoerced;
81676
83076
  if (!subSatisfied) {
@@ -81679,9 +83079,9 @@ class JsonSchemaCoercer {
81679
83079
  }
81680
83080
  }
81681
83081
  for (const key of ["anyOf", "oneOf"]) {
81682
- if (schema2[key]) {
83082
+ if (schema4[key]) {
81683
83083
  let bestOptions;
81684
- for (const subSchema of schema2[key]) {
83084
+ for (const subSchema of schema4[key]) {
81685
83085
  const [subSatisfied, subCoerced] = this.#coerce(subSchema, coerced, options);
81686
83086
  if (subSatisfied) {
81687
83087
  if (!bestOptions || subCoerced === coerced) {
@@ -81696,8 +83096,8 @@ class JsonSchemaCoercer {
81696
83096
  satisfied = bestOptions ? bestOptions.satisfied : false;
81697
83097
  }
81698
83098
  }
81699
- if (typeof schema2.not !== "undefined") {
81700
- const [notSatisfied] = this.#coerce(schema2.not, coerced, options);
83099
+ if (typeof schema4.not !== "undefined") {
83100
+ const [notSatisfied] = this.#coerce(schema4.not, coerced, options);
81701
83101
  if (notSatisfied) {
81702
83102
  satisfied = false;
81703
83103
  }
@@ -81790,11 +83190,11 @@ class SmartCoercionPlugin {
81790
83190
  return options2.next({ ...options2, input: coercedInput });
81791
83191
  });
81792
83192
  }
81793
- async#coerce(schema2, value2) {
81794
- let jsonSchema2 = this.cache.get(schema2);
83193
+ async#coerce(schema4, value2) {
83194
+ let jsonSchema2 = this.cache.get(schema4);
81795
83195
  if (!jsonSchema2) {
81796
- jsonSchema2 = (await this.converter.convert(schema2, { strategy: "input" }))[1];
81797
- this.cache.set(schema2, jsonSchema2);
83196
+ jsonSchema2 = (await this.converter.convert(schema4, { strategy: "input" }))[1];
83197
+ this.cache.set(schema4, jsonSchema2);
81798
83198
  }
81799
83199
  return this.coercer.coerce(jsonSchema2, value2);
81800
83200
  }
@@ -81815,8 +83215,8 @@ class experimental_ZodSmartCoercionPlugin {
81815
83215
  return options2.next({ ...options2, input: coercedInput });
81816
83216
  });
81817
83217
  }
81818
- #coerce(schema2, value2) {
81819
- switch (schema2._zod.def.type) {
83218
+ #coerce(schema4, value2) {
83219
+ switch (schema4._zod.def.type) {
81820
83220
  case "number": {
81821
83221
  if (typeof value2 === "string") {
81822
83222
  return this.#stringToNumber(value2);
@@ -81844,7 +83244,7 @@ class experimental_ZodSmartCoercionPlugin {
81844
83244
  }
81845
83245
  case "literal":
81846
83246
  case "enum": {
81847
- const literal2 = schema2;
83247
+ const literal2 = schema4;
81848
83248
  if (!literal2._zod.values.has(value2) && typeof value2 === "string") {
81849
83249
  const num = this.#stringToNumber(value2);
81850
83250
  if (literal2._zod.values.has(num)) {
@@ -81862,7 +83262,7 @@ class experimental_ZodSmartCoercionPlugin {
81862
83262
  return value2;
81863
83263
  }
81864
83264
  case "array": {
81865
- const array2 = schema2;
83265
+ const array2 = schema4;
81866
83266
  if (value2 === undefined) {
81867
83267
  return [];
81868
83268
  }
@@ -81872,7 +83272,7 @@ class experimental_ZodSmartCoercionPlugin {
81872
83272
  return value2;
81873
83273
  }
81874
83274
  case "tuple": {
81875
- const tuple2 = schema2;
83275
+ const tuple2 = schema4;
81876
83276
  if (value2 === undefined) {
81877
83277
  return [];
81878
83278
  }
@@ -81885,7 +83285,7 @@ class experimental_ZodSmartCoercionPlugin {
81885
83285
  return value2;
81886
83286
  }
81887
83287
  case "set": {
81888
- const set2 = schema2;
83288
+ const set2 = schema4;
81889
83289
  if (value2 === undefined) {
81890
83290
  return /* @__PURE__ */ new Set;
81891
83291
  }
@@ -81898,7 +83298,7 @@ class experimental_ZodSmartCoercionPlugin {
81898
83298
  return value2;
81899
83299
  }
81900
83300
  case "object": {
81901
- const object3 = schema2;
83301
+ const object3 = schema4;
81902
83302
  if (value2 === undefined) {
81903
83303
  return {};
81904
83304
  }
@@ -81917,7 +83317,7 @@ class experimental_ZodSmartCoercionPlugin {
81917
83317
  return value2;
81918
83318
  }
81919
83319
  case "record": {
81920
- const record2 = schema2;
83320
+ const record2 = schema4;
81921
83321
  if (value2 === undefined) {
81922
83322
  return {};
81923
83323
  }
@@ -81933,7 +83333,7 @@ class experimental_ZodSmartCoercionPlugin {
81933
83333
  return value2;
81934
83334
  }
81935
83335
  case "map": {
81936
- const map3 = schema2;
83336
+ const map3 = schema4;
81937
83337
  if (value2 === undefined) {
81938
83338
  return /* @__PURE__ */ new Map;
81939
83339
  }
@@ -81952,7 +83352,7 @@ class experimental_ZodSmartCoercionPlugin {
81952
83352
  return value2;
81953
83353
  }
81954
83354
  case "union": {
81955
- const union3 = schema2;
83355
+ const union3 = schema4;
81956
83356
  if (union3._zod.def.options.length === 1) {
81957
83357
  return this.#coerce(union3._zod.def.options[0], value2);
81958
83358
  }
@@ -81978,56 +83378,56 @@ class experimental_ZodSmartCoercionPlugin {
81978
83378
  return value2;
81979
83379
  }
81980
83380
  case "intersection": {
81981
- const intersection2 = schema2;
83381
+ const intersection2 = schema4;
81982
83382
  return this.#coerce(intersection2._zod.def.right, this.#coerce(intersection2._zod.def.left, value2));
81983
83383
  }
81984
83384
  case "optional": {
81985
- const optional2 = schema2;
83385
+ const optional2 = schema4;
81986
83386
  if (value2 === undefined) {
81987
83387
  return;
81988
83388
  }
81989
83389
  return this.#coerce(optional2._zod.def.innerType, value2);
81990
83390
  }
81991
83391
  case "nonoptional": {
81992
- const nonoptional2 = schema2;
83392
+ const nonoptional2 = schema4;
81993
83393
  return this.#coerce(nonoptional2._zod.def.innerType, value2);
81994
83394
  }
81995
83395
  case "nullable": {
81996
- const nullable2 = schema2;
83396
+ const nullable2 = schema4;
81997
83397
  if (value2 === null) {
81998
83398
  return null;
81999
83399
  }
82000
83400
  return this.#coerce(nullable2._zod.def.innerType, value2);
82001
83401
  }
82002
83402
  case "readonly": {
82003
- const readonly_ = schema2;
83403
+ const readonly_ = schema4;
82004
83404
  return this.#coerce(readonly_._zod.def.innerType, value2);
82005
83405
  }
82006
83406
  case "pipe": {
82007
- const pipe2 = schema2;
83407
+ const pipe2 = schema4;
82008
83408
  return this.#coerce(pipe2._zod.def.in, value2);
82009
83409
  }
82010
83410
  case "default":
82011
83411
  case "prefault": {
82012
- const default_ = schema2;
83412
+ const default_ = schema4;
82013
83413
  if (value2 === undefined) {
82014
83414
  return value2;
82015
83415
  }
82016
83416
  return this.#coerce(default_._zod.def.innerType, value2);
82017
83417
  }
82018
83418
  case "catch": {
82019
- const catch_ = schema2;
83419
+ const catch_ = schema4;
82020
83420
  return this.#coerce(catch_._zod.def.innerType, value2);
82021
83421
  }
82022
83422
  case "lazy": {
82023
- const lazy4 = schema2;
83423
+ const lazy4 = schema4;
82024
83424
  if (value2 !== undefined) {
82025
83425
  return this.#coerce(lazy4._zod.def.getter(), value2);
82026
83426
  }
82027
83427
  return value2;
82028
83428
  }
82029
83429
  default: {
82030
- schema2._zod.def.type;
83430
+ schema4._zod.def.type;
82031
83431
  return value2;
82032
83432
  }
82033
83433
  }
@@ -82076,14 +83476,14 @@ class ZodToJsonSchemaConverter {
82076
83476
  this.undefinedJsonSchema = options.undefinedJsonSchema ?? { not: {} };
82077
83477
  this.interceptors = options.interceptors ?? [];
82078
83478
  }
82079
- condition(schema2) {
82080
- return schema2 !== undefined && schema2["~standard"].vendor === "zod" && "_zod" in schema2;
83479
+ condition(schema4) {
83480
+ return schema4 !== undefined && schema4["~standard"].vendor === "zod" && "_zod" in schema4;
82081
83481
  }
82082
- convert(schema2, options) {
82083
- return this.#convert(schema2, options, 0, 0);
83482
+ convert(schema4, options) {
83483
+ return this.#convert(schema4, options, 0, 0);
82084
83484
  }
82085
- #convert(schema2, options, lazyDepth, structureDepth, isHandledCustomJSONSchema = false) {
82086
- return intercept(this.interceptors, { schema: schema2, options, lazyDepth, isHandledCustomJSONSchema }, ({ schema: schema22, options: options2, lazyDepth: lazyDepth2, isHandledCustomJSONSchema: isHandledCustomJSONSchema2 }) => {
83485
+ #convert(schema4, options, lazyDepth, structureDepth, isHandledCustomJSONSchema = false) {
83486
+ return intercept(this.interceptors, { schema: schema4, options, lazyDepth, isHandledCustomJSONSchema }, ({ schema: schema22, options: options2, lazyDepth: lazyDepth2, isHandledCustomJSONSchema: isHandledCustomJSONSchema2 }) => {
82087
83487
  if (structureDepth > this.maxStructureDepth) {
82088
83488
  return [false, this.anyJsonSchema];
82089
83489
  }
@@ -82417,17 +83817,17 @@ class ZodToJsonSchemaConverter {
82417
83817
  }
82418
83818
  });
82419
83819
  }
82420
- #getCustomJsonSchema(schema2, options) {
82421
- if (options.strategy === "input" && JSON_SCHEMA_INPUT_REGISTRY.has(schema2)) {
82422
- return JSON_SCHEMA_INPUT_REGISTRY.get(schema2);
83820
+ #getCustomJsonSchema(schema4, options) {
83821
+ if (options.strategy === "input" && JSON_SCHEMA_INPUT_REGISTRY.has(schema4)) {
83822
+ return JSON_SCHEMA_INPUT_REGISTRY.get(schema4);
82423
83823
  }
82424
- if (options.strategy === "output" && JSON_SCHEMA_OUTPUT_REGISTRY.has(schema2)) {
82425
- return JSON_SCHEMA_OUTPUT_REGISTRY.get(schema2);
83824
+ if (options.strategy === "output" && JSON_SCHEMA_OUTPUT_REGISTRY.has(schema4)) {
83825
+ return JSON_SCHEMA_OUTPUT_REGISTRY.get(schema4);
82426
83826
  }
82427
- if (JSON_SCHEMA_REGISTRY.has(schema2)) {
82428
- return JSON_SCHEMA_REGISTRY.get(schema2);
83827
+ if (JSON_SCHEMA_REGISTRY.has(schema4)) {
83828
+ return JSON_SCHEMA_REGISTRY.get(schema4);
82429
83829
  }
82430
- const global3 = globalRegistry.get(schema2);
83830
+ const global3 = globalRegistry.get(schema4);
82431
83831
  if (global3) {
82432
83832
  return {
82433
83833
  title: global3.title,
@@ -82436,16 +83836,16 @@ class ZodToJsonSchemaConverter {
82436
83836
  };
82437
83837
  }
82438
83838
  }
82439
- #handleArrayItemJsonSchema([required2, schema2], options) {
82440
- if (required2 || options.strategy === "input" || schema2.default !== undefined) {
82441
- return schema2;
83839
+ #handleArrayItemJsonSchema([required2, schema4], options) {
83840
+ if (required2 || options.strategy === "input" || schema4.default !== undefined) {
83841
+ return schema4;
82442
83842
  }
82443
- if (schema2 === this.undefinedJsonSchema) {
83843
+ if (schema4 === this.undefinedJsonSchema) {
82444
83844
  return { type: "null" };
82445
83845
  }
82446
83846
  return {
82447
83847
  anyOf: [
82448
- schema2,
83848
+ schema4,
82449
83849
  { type: "null" }
82450
83850
  ]
82451
83851
  };
@@ -83950,6 +85350,100 @@ ${result.content}`);
83950
85350
  context4.setExitCode(1);
83951
85351
  }
83952
85352
  });
85353
+ task.command("deps").summary("Mutate the dependencies[] frontmatter array on a task.").description("Mutate the `dependencies[]` array on an existing task. Operations:\n" + ` set <wbs...> \u2014 replace the array with the given WBS values
85354
+ ` + ` add <wbs...> \u2014 append the given values (deduped)
85355
+ ` + ` remove <wbs...> \u2014 drop the given values
85356
+ ` + ` clear \u2014 empty the array
85357
+
85358
+ ` + `Validation: WBS format, existence, self-edge, duplicates, and cycle detection
85359
+ ` + `all run BEFORE any write (atomic \u2014 R2). Exit codes: 0 success, 1 generic error,
85360
+ ` + "2 usage error, 3 validation error.").argument("<wbs>", "Task WBS number to mutate").argument("<op>", "Operation: set | add | remove | clear").argument("[values...]", "WBS values (required for set/add/remove; forbidden for clear)").option("--folder <path>", "Custom tasks folder").option("--json", "Output machine-readable JSON").action(async (wbs, op, values, options) => {
85361
+ const allowedOps = ["set", "add", "remove", "clear"];
85362
+ if (!allowedOps.includes(op)) {
85363
+ context4.output.error(`Unknown op "${op}". Allowed: ${allowedOps.join(", ")}.`);
85364
+ context4.setExitCode(2);
85365
+ return;
85366
+ }
85367
+ const typedOp = op;
85368
+ const svc = await makeService2(context4, options.folder);
85369
+ try {
85370
+ const result = await svc.mutateDependencies(wbs, typedOp, values);
85371
+ if (options.json) {
85372
+ context4.output.write(toJson2(result));
85373
+ } else {
85374
+ const list = result.dependencies.length > 0 ? result.dependencies.join(", ") : "(none)";
85375
+ context4.output.write(`Set dependencies on task ${result.ref.id}: [${list}]`);
85376
+ }
85377
+ } catch (err) {
85378
+ if (err instanceof DependencyMutationError) {
85379
+ context4.output.error(`[${err.code}] ${err.message}`);
85380
+ context4.setExitCode(err.code === "usage" ? 2 : 3);
85381
+ } else {
85382
+ context4.output.error(String(err));
85383
+ context4.setExitCode(1);
85384
+ }
85385
+ }
85386
+ });
85387
+ task.command("sections").summary("Initialize, add, or list canonical task sections (matrix-enforced).").description(`CLI-safe mutation of canonical task sections. Operations:
85388
+ ` + ` init \u2014 add every required section for the task's current status
85389
+ ` + ` that is not already present (idempotent)
85390
+ ` + ` add <name> \u2014 add a single canonical section (rejects unknown/forbidden;
85391
+ ` + ` idempotent if already present)
85392
+ ` + ` list \u2014 read-only: resolve the matrix entry for variant + status
85393
+ ` + ` and return required/optional/forbidden, present, missing
85394
+
85395
+ ` + `Section names are validated against TASK_CANONICAL_SECTIONS (closed-world) and
85396
+ ` + `against the variant/status matrix entry. Universal sections
85397
+ ` + `(${UNIVERSAL_SECTIONS.join(", ")}) are always allowed. All writes go through the
85398
+ ` + `existing planning-write-service.updateSection pipeline \u2014 phantom-section guards,
85399
+ ` + `atomic writes, history, and timestamps are inherited. Exit codes: 0 success,
85400
+ ` + "1 generic error, 2 usage error, 3 validation error.").argument("<wbs>", "Task WBS number to mutate").argument("<op>", "Operation: init | add | list").argument("[name]", "Canonical section name (required for add; forbidden for init/list)").option("--folder <path>", "Custom tasks folder").option("--json", "Output machine-readable JSON").action(async (wbs, op, name, options) => {
85401
+ const allowedOps = ["init", "add", "list"];
85402
+ if (!allowedOps.includes(op)) {
85403
+ context4.output.error(`Unknown op "${op}". Allowed: ${allowedOps.join(", ")}.`);
85404
+ context4.setExitCode(2);
85405
+ return;
85406
+ }
85407
+ const typedOp = op;
85408
+ if (typedOp === "add" && typeof name !== "string") {
85409
+ context4.output.error('op "add" requires a section name argument.');
85410
+ context4.setExitCode(2);
85411
+ return;
85412
+ }
85413
+ if ((typedOp === "init" || typedOp === "list") && name !== undefined) {
85414
+ context4.output.error(`op "${typedOp}" takes no section name argument.`);
85415
+ context4.setExitCode(2);
85416
+ return;
85417
+ }
85418
+ const svc = await makeService2(context4, options.folder);
85419
+ try {
85420
+ const result = await svc.mutateSections(wbs, typedOp, name);
85421
+ if (options.json) {
85422
+ context4.output.write(toJson2(result));
85423
+ } else if (result.op === "list") {
85424
+ const m = result.matrix ?? { required: [], optional: [], forbidden: [] };
85425
+ const present = result.present ?? [];
85426
+ const missing = result.missing ?? [];
85427
+ context4.output.write(`Task ${result.ref.id} (${result.variant}/${result.status})
85428
+ ` + ` required: ${m.required.join(", ") || "(none)"}
85429
+ ` + ` optional: ${m.optional.join(", ") || "(none)"}
85430
+ ` + ` forbidden: ${m.forbidden.join(", ") || "(none)"}
85431
+ ` + ` present: ${present.join(", ") || "(none)"}
85432
+ ` + ` missing: ${missing.join(", ") || "(none)"}`);
85433
+ } else {
85434
+ const added = result.added.length > 0 ? result.added.join(", ") : "(none)";
85435
+ context4.output.write(`${result.op} on task ${result.ref.id}: added [${added}]`);
85436
+ }
85437
+ } catch (err) {
85438
+ if (err instanceof SectionMutationError) {
85439
+ context4.output.error(`[${err.code}] ${err.message}`);
85440
+ context4.setExitCode(err.code === "usage" ? 2 : 3);
85441
+ } else {
85442
+ context4.output.error(String(err));
85443
+ context4.setExitCode(1);
85444
+ }
85445
+ }
85446
+ });
83953
85447
  task.command("list").summary("List tasks with optional filtering.").option("--status <s>", "Filter by status").option("--phase <p>", "Filter by phase (legacy alias for --status)").option("--parent <wbs>", "Filter by parent WBS").option("--feature <id>", "Filter by linked feature ID (feature_id edge)").option("--folder <path>", "Custom tasks folder").option("--json", "Output machine-readable JSON").action(async (options) => {
83954
85448
  const svc = await makeService2(context4, options.folder);
83955
85449
  try {
@@ -84881,12 +86375,31 @@ function formatTraceTimeline(result) {
84881
86375
  const guard2 = event2.trigger ? ` [${event2.trigger}]` : "";
84882
86376
  lines.push(` \u2192 ${event2.to}${guard2}`);
84883
86377
  } else {
84884
- lines.push(` \u26A1 ${event2.actionKind.padEnd(15)} ${event2.duration.padEnd(6)}${event2.label}`);
86378
+ const costSuffix = formatActionCost(event2);
86379
+ lines.push(` \u26A1 ${event2.actionKind.padEnd(15)} ${event2.duration.padEnd(6)}${event2.label}${costSuffix}`);
84885
86380
  }
84886
86381
  }
86382
+ const hasUnjoinedCost = events2.some((e) => e.kind === "action" && e.cost !== undefined && e.cost.totals.records === 0);
86383
+ if (hasUnjoinedCost) {
86384
+ lines.push("", "Some agent.run steps show cost n/a \u2014 run `spur history import` to populate cost.");
86385
+ }
84887
86386
  return lines.join(`
84888
86387
  `).trimEnd();
84889
86388
  }
86389
+ function formatActionCost(event2) {
86390
+ if (event2.kind !== "action")
86391
+ return "";
86392
+ const cost = event2.cost;
86393
+ if (!cost)
86394
+ return "";
86395
+ if (cost.totals.records === 0)
86396
+ return " \xB7 cost n/a";
86397
+ const est = cost.estimated ? "~" : "";
86398
+ if (cost.cacheHit === null) {
86399
+ return cost.totals.costUsd > 0 ? ` \xB7 ${est}$${cost.totals.costUsd.toFixed(3)} \xB7 cache n/a` : " \xB7 cost n/a";
86400
+ }
86401
+ return ` \xB7 ${est}$${cost.totals.costUsd.toFixed(3)} \xB7 cache ${est}${(cost.cacheHit * 100).toFixed(0)}%`;
86402
+ }
84890
86403
 
84891
86404
  // src/context.ts
84892
86405
  init_src3();