@gobing-ai/spur 0.3.92 → 0.3.93

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 (56) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/config/pipeline-budgets.json +0 -7
  3. package/config/plugin-scripts.json +10 -0
  4. package/config/templates/AGENTS.md +4 -0
  5. package/config/templates/docs/02_ROADMAP.md +2 -0
  6. package/config/templates/docs/03_ARCHITECTURE.md +3 -1
  7. package/config/templates/docs/04_DESIGN.md +2 -0
  8. package/config/templates/docs/99_PROJECT_CONSTITUTION.md +10 -2
  9. package/config/workflow-candidates.json +72 -1
  10. package/config/workflows/feature-verification.yaml +1 -0
  11. package/config/workflows/history-anatomy.yaml +2 -0
  12. package/config/workflows/idea-pipeline.yaml +67 -18
  13. package/config/workflows/pr-review.yaml +8 -0
  14. package/config/workflows/task-pipeline.yaml +180 -39
  15. package/config/workflows/wayfinder-resolution.yaml +5 -0
  16. package/config/workflows/wrapup-pipeline.yaml +55 -14
  17. package/package.json +9 -9
  18. package/plugins/sp/README.md +7 -2
  19. package/plugins/sp/commands/dev-run.md +2 -2
  20. package/plugins/sp/commands/dev-runall.md +2 -2
  21. package/plugins/sp/lib/idea-handoff.generated.mjs +8 -4
  22. package/plugins/sp/lib/inline-run.generated.d.mts +1 -0
  23. package/plugins/sp/lib/inline-run.generated.mjs +24 -16
  24. package/plugins/sp/plugin.json +1 -1
  25. package/plugins/sp/scripts/inline-pipeline-parity-check.ts +1 -1
  26. package/plugins/sp/scripts/inline-run-setup.mjs +75 -3
  27. package/plugins/sp/scripts/inline-run-setup.ts +133 -3
  28. package/plugins/sp/scripts/quality-gate.mjs +248 -6
  29. package/plugins/sp/scripts/quality-gate.ts +410 -9
  30. package/plugins/sp/scripts/residual-scan.mjs +12 -4
  31. package/plugins/sp/scripts/residual-scan.ts +32 -6
  32. package/plugins/sp/scripts/task-diffstat.mjs +156 -0
  33. package/plugins/sp/scripts/task-diffstat.ts +229 -0
  34. package/plugins/sp/scripts/wrapup-drift-probe.mjs +181 -0
  35. package/plugins/sp/scripts/wrapup-drift-probe.ts +258 -0
  36. package/plugins/sp/scripts/wrapup-steps.mjs +60 -1
  37. package/plugins/sp/scripts/wrapup-steps.ts +89 -4
  38. package/plugins/sp/skills/brainstorm/SKILL.md +2 -0
  39. package/plugins/sp/skills/brainstorm/references/workflows.md +17 -2
  40. package/plugins/sp/skills/code-verification/SKILL.md +2 -2
  41. package/plugins/sp/skills/code-verification/references/secu-review.md +3 -2
  42. package/plugins/sp/skills/spur-check/SKILL.md +112 -0
  43. package/plugins/sp/skills/spur-dev/SKILL.md +2 -1
  44. package/plugins/sp/skills/spur-dev/references/cross-cutting.md +14 -2
  45. package/plugins/sp/skills/spur-dev/references/document-authoring.md +85 -0
  46. package/plugins/sp/skills/spur-dev/references/execution-batch.md +1 -1
  47. package/plugins/sp/skills/spur-dev/references/flag-glossary.md +8 -0
  48. package/plugins/sp/skills/spur-dev/references/gate-checklists.md +3 -2
  49. package/plugins/sp/skills/spur-dev/references/inline-pipeline-driver.md +19 -1
  50. package/plugins/sp/skills/spur-dev/references/planning-workflow.md +5 -5
  51. package/plugins/sp/skills/spur-dev/templates/design.md +31 -0
  52. package/plugins/sp/skills/spur-dev/templates/plan.md +32 -0
  53. package/plugins/sp/skills/spur-doctor/SKILL.md +60 -14
  54. package/schemas/state-machine-workflow.schema.json +4 -0
  55. package/spur.js +1117 -472
  56. package/config/workflows/decision-routing-example.yaml +0 -134
package/spur.js CHANGED
@@ -48,7 +48,7 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
48
48
  var __promiseAll = (args) => Promise.all(args);
49
49
  var __require = import.meta.require;
50
50
 
51
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.5/node_modules/@gobing-ai/ts-utils/dist/errors.js
51
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.7/node_modules/@gobing-ai/ts-utils/dist/errors.js
52
52
  var ErrorCode, AppError, ValidationError;
53
53
  var init_errors = __esm(() => {
54
54
  ErrorCode = {
@@ -73,7 +73,7 @@ var init_errors = __esm(() => {
73
73
  };
74
74
  });
75
75
 
76
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.5/node_modules/@gobing-ai/ts-utils/dist/api-response.js
76
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.7/node_modules/@gobing-ai/ts-utils/dist/api-response.js
77
77
  var API_ERROR_CODES, ERROR_CODE_TO_HTTP, CLIENT_SAFE_CODES;
78
78
  var init_api_response = __esm(() => {
79
79
  init_errors();
@@ -96,10 +96,10 @@ var init_api_response = __esm(() => {
96
96
  CLIENT_SAFE_CODES = new Set([ErrorCode.NotFound, ErrorCode.Validation, ErrorCode.Conflict]);
97
97
  });
98
98
 
99
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.5/node_modules/@gobing-ai/ts-utils/dist/cursor.js
99
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.7/node_modules/@gobing-ai/ts-utils/dist/cursor.js
100
100
  var init_cursor = () => {};
101
101
 
102
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.5/node_modules/@gobing-ai/ts-utils/dist/env.js
102
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.7/node_modules/@gobing-ai/ts-utils/dist/env.js
103
103
  function getEnvVar(name, fallback) {
104
104
  const raw = process.env[name];
105
105
  return raw === undefined ? fallback : raw;
@@ -121,10 +121,10 @@ function getAppOptions(config, key, fallback) {
121
121
  return value === undefined || value === null ? fallback : value;
122
122
  }
123
123
 
124
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.5/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
124
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.7/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
125
125
  var init_event_severity = () => {};
126
126
 
127
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.5/node_modules/@gobing-ai/ts-utils/dist/object.js
127
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.7/node_modules/@gobing-ai/ts-utils/dist/object.js
128
128
  function isPlainObject(value) {
129
129
  return typeof value === "object" && value !== null && !Array.isArray(value);
130
130
  }
@@ -142,7 +142,7 @@ function deepMerge(target, source) {
142
142
  return result;
143
143
  }
144
144
 
145
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.5/node_modules/@gobing-ai/ts-utils/dist/output.js
145
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.7/node_modules/@gobing-ai/ts-utils/dist/output.js
146
146
  function processStream(name) {
147
147
  const proc = globalThis.process;
148
148
  const stream = proc?.[name];
@@ -163,7 +163,7 @@ function echoError(message, target = defaultStderrTarget ?? processStream("stder
163
163
  }
164
164
  var defaultStdoutTarget, defaultStderrTarget;
165
165
 
166
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.5/node_modules/@gobing-ai/ts-utils/dist/index.js
166
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.7/node_modules/@gobing-ai/ts-utils/dist/index.js
167
167
  var init_dist = __esm(() => {
168
168
  init_api_response();
169
169
  init_cursor();
@@ -15288,6 +15288,7 @@ var init_src = __esm(() => {
15288
15288
  });
15289
15289
  WorkflowConfigSchema = exports_external.object({
15290
15290
  hitlDecisionMaker: exports_external.boolean().optional(),
15291
+ decideDecisionMaker: exports_external.boolean().optional(),
15291
15292
  logRetentionDays: exports_external.number().int().positive().default(30)
15292
15293
  });
15293
15294
  RedactionConfigSchema = exports_external.object({
@@ -22341,7 +22342,7 @@ var init_dist2 = __esm(() => {
22341
22342
  $visitAsync = visit.visitAsync;
22342
22343
  });
22343
22344
 
22344
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/config.js
22345
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/config.js
22345
22346
  function getProcessEnv() {
22346
22347
  return getEnvVars();
22347
22348
  }
@@ -22419,7 +22420,7 @@ var init_config = __esm(() => {
22419
22420
  };
22420
22421
  });
22421
22422
 
22422
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
22423
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
22423
22424
  import { appendFileSync, cpSync, createReadStream, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
22424
22425
  import { dirname, resolve as resolvePath } from "path";
22425
22426
  function createNodeFileSystem(root, paths) {
@@ -22506,7 +22507,7 @@ function findProjectRoot(startDir) {
22506
22507
  }
22507
22508
  var init_file_system_node = () => {};
22508
22509
 
22509
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
22510
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
22510
22511
  var DbModuleNotInstalledError;
22511
22512
  var init_db_errors = __esm(() => {
22512
22513
  DbModuleNotInstalledError = class DbModuleNotInstalledError extends Error {
@@ -29718,7 +29719,7 @@ var init_execa = __esm(() => {
29718
29719
  } = getIpcExport());
29719
29720
  });
29720
29721
 
29721
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/process-group.js
29722
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/process-group.js
29722
29723
  function resolveDeadline(optionTimeout, defaultTimeout) {
29723
29724
  if (optionTimeout === null)
29724
29725
  return null;
@@ -29810,7 +29811,7 @@ function ownProcessGroupLifecycle(ownership) {
29810
29811
  }
29811
29812
  var MAX_TIMEOUT_MS = 2147483647, DEFAULT_KILL_GRACE_MS = 5000, GROUP_POLL_INTERVAL_MS = 25, GROUP_KILL_PATIENCE_MS = 2000;
29812
29813
 
29813
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
29814
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
29814
29815
  import { isatty } from "tty";
29815
29816
  function processEventSeverity(reason, exitCode) {
29816
29817
  if (reason === "error")
@@ -30182,7 +30183,7 @@ var init_process_executor = __esm(() => {
30182
30183
  init_config();
30183
30184
  });
30184
30185
 
30185
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
30186
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
30186
30187
  function getNodeFileSystem() {
30187
30188
  if (!_nodeFileSystem)
30188
30189
  _nodeFileSystem = createNodeFileSystem();
@@ -30242,7 +30243,7 @@ var init_runtime_node_bun = __esm(() => {
30242
30243
  };
30243
30244
  });
30244
30245
 
30245
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/context.js
30246
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/context.js
30246
30247
  class RuntimeContext {
30247
30248
  scope;
30248
30249
  runtimeName;
@@ -30312,7 +30313,7 @@ var init_context = __esm(() => {
30312
30313
  init_runtime_node_bun();
30313
30314
  });
30314
30315
 
30315
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/path.js
30316
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/path.js
30316
30317
  function normalizeSeparators(path6) {
30317
30318
  return path6.replaceAll("\\", "/");
30318
30319
  }
@@ -30373,17 +30374,17 @@ var init_path = __esm(() => {
30373
30374
  SEP = globalThis.process?.platform === "win32" ? "\\" : "/";
30374
30375
  });
30375
30376
 
30376
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
30377
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
30377
30378
  var REMOTE_SCHEMA_MAX_BYTES;
30378
30379
  var init_schema_validation = __esm(() => {
30379
30380
  init_dist2();
30380
30381
  REMOTE_SCHEMA_MAX_BYTES = 5 * 1024 * 1024;
30381
30382
  });
30382
30383
 
30383
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/types.js
30384
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/types.js
30384
30385
  var init_types = () => {};
30385
30386
 
30386
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/index.js
30387
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/index.js
30387
30388
  var init_dist3 = __esm(() => {
30388
30389
  init_config();
30389
30390
  init_context();
@@ -30392,7 +30393,7 @@ var init_dist3 = __esm(() => {
30392
30393
  init_types();
30393
30394
  });
30394
30395
 
30395
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+18cd595f38302799/node_modules/@gobing-ai/ts-runtime/dist/bun-sqlite.js
30396
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+3f6d6089c70bab2e/node_modules/@gobing-ai/ts-runtime/dist/bun-sqlite.js
30396
30397
  import { Database } from "bun:sqlite";
30397
30398
  var init_bun_sqlite = () => {};
30398
30399
 
@@ -34822,7 +34823,7 @@ var init_bun_sqlite2 = __esm(() => {
34822
34823
  init_session2();
34823
34824
  });
34824
34825
 
34825
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/schema/inbox-messages.js
34826
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/schema/inbox-messages.js
34826
34827
  var inboxMessages;
34827
34828
  var init_inbox_messages = __esm(() => {
34828
34829
  init_sqlite_core();
@@ -34842,7 +34843,7 @@ var init_inbox_messages = __esm(() => {
34842
34843
  }, (table2) => [index("idx_inbox_messages_to_status").on(table2.toId, table2.status)]);
34843
34844
  });
34844
34845
 
34845
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/schema/common.js
34846
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/schema/common.js
34846
34847
  function nowTimestamp() {
34847
34848
  return Date.now();
34848
34849
  }
@@ -34871,7 +34872,7 @@ var init_common3 = __esm(() => {
34871
34872
  appendOnlyColumns = buildAppendOnlyColumns();
34872
34873
  });
34873
34874
 
34874
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/schema/queue-jobs.js
34875
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/schema/queue-jobs.js
34875
34876
  var queueJobs;
34876
34877
  var init_queue_jobs = __esm(() => {
34877
34878
  init_sqlite_core();
@@ -34895,7 +34896,7 @@ var init_queue_jobs = __esm(() => {
34895
34896
  }, (table2) => [index("queue_jobs_ready_idx").on(table2.status, table2.nextRetryAt, table2.createdAt)]);
34896
34897
  });
34897
34898
 
34898
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/schema/runtime.js
34899
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/schema/runtime.js
34899
34900
  var exports_runtime = {};
34900
34901
  __export(exports_runtime, {
34901
34902
  queueJobs: () => queueJobs,
@@ -34906,7 +34907,7 @@ var init_runtime = __esm(() => {
34906
34907
  init_queue_jobs();
34907
34908
  });
34908
34909
 
34909
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/adapters/bun-sqlite.js
34910
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/adapters/bun-sqlite.js
34910
34911
  var exports_bun_sqlite = {};
34911
34912
  __export(exports_bun_sqlite, {
34912
34913
  BunSqliteAdapter: () => BunSqliteAdapter
@@ -35217,7 +35218,7 @@ var init_d1 = __esm(() => {
35217
35218
  init_session3();
35218
35219
  });
35219
35220
 
35220
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/adapters/d1.js
35221
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/adapters/d1.js
35221
35222
  var exports_d1 = {};
35222
35223
  __export(exports_d1, {
35223
35224
  D1Adapter: () => D1Adapter
@@ -35281,7 +35282,7 @@ var init_d12 = __esm(() => {
35281
35282
  init_runtime();
35282
35283
  });
35283
35284
 
35284
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/adapter.js
35285
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/adapter.js
35285
35286
  async function createDbAdapter(config3) {
35286
35287
  switch (config3.driver) {
35287
35288
  case "bun-sqlite": {
@@ -35315,7 +35316,7 @@ var init_drizzle_orm = __esm(() => {
35315
35316
  init_view_common();
35316
35317
  });
35317
35318
 
35318
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/query-spec.js
35319
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/query-spec.js
35319
35320
  function compilePredicate(predicate) {
35320
35321
  if ("and" in predicate) {
35321
35322
  const parts = predicate.and.map(compilePredicate).filter((p) => p !== undefined);
@@ -35353,7 +35354,7 @@ var init_query_spec = __esm(() => {
35353
35354
  };
35354
35355
  });
35355
35356
 
35356
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/base-dao.js
35357
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/base-dao.js
35357
35358
  function asSelectQuery(query) {
35358
35359
  return query;
35359
35360
  }
@@ -35395,7 +35396,7 @@ var init_base_dao = __esm(() => {
35395
35396
  init_query_spec();
35396
35397
  });
35397
35398
 
35398
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/embedded-migrations.js
35399
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/embedded-migrations.js
35399
35400
  var embeddedMigrations;
35400
35401
  var init_embedded_migrations = __esm(() => {
35401
35402
  embeddedMigrations = [
@@ -35437,7 +35438,7 @@ var init_embedded_migrations = __esm(() => {
35437
35438
  ];
35438
35439
  });
35439
35440
 
35440
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/entity-dao.js
35441
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/entity-dao.js
35441
35442
  var EntityDao;
35442
35443
  var init_entity_dao = __esm(() => {
35443
35444
  init_drizzle_orm();
@@ -35599,7 +35600,7 @@ var init_entity_dao = __esm(() => {
35599
35600
  };
35600
35601
  });
35601
35602
 
35602
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/inbox-message-dao.js
35603
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/inbox-message-dao.js
35603
35604
  function isPromiseLike(value) {
35604
35605
  return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
35605
35606
  }
@@ -35841,7 +35842,7 @@ var init_migrator2 = __esm(() => {
35841
35842
  init_migrator();
35842
35843
  });
35843
35844
 
35844
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/migrate.js
35845
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/migrate.js
35845
35846
  async function ensureJournalTable(adapter, table3) {
35846
35847
  await adapter.exec(`CREATE TABLE IF NOT EXISTS "${table3}" (` + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "hash text NOT NULL, " + "created_at numeric" + ")");
35847
35848
  }
@@ -35916,7 +35917,7 @@ var init_migrate = __esm(() => {
35916
35917
  init_embedded_migrations();
35917
35918
  });
35918
35919
 
35919
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/queue-job-dao.js
35920
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/queue-job-dao.js
35920
35921
  function assertValidTimeoutMs(value) {
35921
35922
  if (value === undefined || value === null)
35922
35923
  return;
@@ -36139,7 +36140,7 @@ var init_queue_job_dao = __esm(() => {
36139
36140
  };
36140
36141
  });
36141
36142
 
36142
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/index.js
36143
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/index.js
36143
36144
  var exports_dist = {};
36144
36145
  __export(exports_dist, {
36145
36146
  embeddedMigrations: () => embeddedMigrations,
@@ -38273,7 +38274,7 @@ var require_extra_typings = __commonJS((exports, module) => {
38273
38274
  exports.createArgument = (name, description) => new commander.Argument(name, description);
38274
38275
  });
38275
38276
 
38276
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/config.js
38277
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/config.js
38277
38278
  function parseYamlObject(text3) {
38278
38279
  let parsed;
38279
38280
  try {
@@ -38400,7 +38401,7 @@ var init_config2 = __esm(() => {
38400
38401
  };
38401
38402
  });
38402
38403
 
38403
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
38404
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
38404
38405
  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";
38405
38406
  import { dirname as dirname2, resolve as resolvePath3 } from "path";
38406
38407
  function createNodeFileSystem3(root, paths) {
@@ -38487,7 +38488,7 @@ function findProjectRoot3(startDir) {
38487
38488
  }
38488
38489
  var init_file_system_node2 = () => {};
38489
38490
 
38490
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
38491
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/db-errors.js
38491
38492
  var D1NotConfiguredError2, DbModuleNotInstalledError3;
38492
38493
  var init_db_errors2 = __esm(() => {
38493
38494
  D1NotConfiguredError2 = class D1NotConfiguredError2 extends Error {
@@ -38504,7 +38505,7 @@ var init_db_errors2 = __esm(() => {
38504
38505
  };
38505
38506
  });
38506
38507
 
38507
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/file-system-cf.js
38508
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/file-system-cf.js
38508
38509
  function createCfFileSystem2() {
38509
38510
  return {
38510
38511
  getProjectRoot: () => "/bundle",
@@ -38543,7 +38544,7 @@ function createCfFileSystem2() {
38543
38544
  }
38544
38545
  var UNSUPPORTED = "FileSystem is not available on Cloudflare Workers. Use D1, KV, or R2 for persistent storage.";
38545
38546
 
38546
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/runtime-cf.js
38547
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/runtime-cf.js
38547
38548
  var exports_runtime_cf = {};
38548
38549
  __export(exports_runtime_cf, {
38549
38550
  cloudflareWorkersFactory: () => cloudflareWorkersFactory2
@@ -38581,7 +38582,7 @@ var init_runtime_cf = __esm(() => {
38581
38582
  };
38582
38583
  });
38583
38584
 
38584
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/process-group.js
38585
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/process-group.js
38585
38586
  function resolveDeadline2(optionTimeout, defaultTimeout) {
38586
38587
  if (optionTimeout === null)
38587
38588
  return null;
@@ -38673,7 +38674,7 @@ function ownProcessGroupLifecycle2(ownership) {
38673
38674
  }
38674
38675
  var MAX_TIMEOUT_MS2 = 2147483647, DEFAULT_KILL_GRACE_MS2 = 5000, GROUP_POLL_INTERVAL_MS2 = 25, GROUP_KILL_PATIENCE_MS2 = 2000;
38675
38676
 
38676
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
38677
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/process-executor.js
38677
38678
  import { spawnSync as spawnSync2 } from "child_process";
38678
38679
  import { isatty as isatty2 } from "tty";
38679
38680
  function processEventSeverity2(reason, exitCode) {
@@ -39117,7 +39118,7 @@ var init_process_executor2 = __esm(() => {
39117
39118
  ProcessExecutor2 = NodeProcessExecutor3;
39118
39119
  });
39119
39120
 
39120
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
39121
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/runtime-node-bun.js
39121
39122
  var exports_runtime_node_bun = {};
39122
39123
  __export(exports_runtime_node_bun, {
39123
39124
  nodeBunFactory: () => nodeBunFactory3,
@@ -39185,7 +39186,7 @@ var init_runtime_node_bun2 = __esm(() => {
39185
39186
  };
39186
39187
  });
39187
39188
 
39188
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/platform.js
39189
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/platform.js
39189
39190
  function isCloudflareWorkerRuntime2() {
39190
39191
  return globalThis.navigator?.userAgent?.startsWith("Cloudflare-Workers") ?? false;
39191
39192
  }
@@ -39215,7 +39216,7 @@ function _resetRuntimeFactory2() {
39215
39216
  }
39216
39217
  var _factory, _runtimeName;
39217
39218
 
39218
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/context.js
39219
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/context.js
39219
39220
  class RuntimeContext2 {
39220
39221
  scope;
39221
39222
  runtimeName;
@@ -39305,7 +39306,7 @@ var init_context2 = __esm(() => {
39305
39306
  init_runtime_node_bun2();
39306
39307
  });
39307
39308
 
39308
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/path.js
39309
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/path.js
39309
39310
  function normalizeSeparators2(path7) {
39310
39311
  return path7.replaceAll("\\", "/");
39311
39312
  }
@@ -39428,7 +39429,7 @@ var init_path2 = __esm(() => {
39428
39429
  SEP2 = globalThis.process?.platform === "win32" ? "\\" : "/";
39429
39430
  });
39430
39431
 
39431
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/fs.js
39432
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/fs.js
39432
39433
  async function ensureDirForFile2(path7, fs2 = createNodeFileSystem3()) {
39433
39434
  await fs2.ensureDir(dirnamePath(path7));
39434
39435
  }
@@ -39496,7 +39497,7 @@ var init_fs = __esm(() => {
39496
39497
  init_path2();
39497
39498
  });
39498
39499
 
39499
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/process-registry.js
39500
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/process-registry.js
39500
39501
  function allocateId() {
39501
39502
  nextIdSeq += 1;
39502
39503
  return `pe_${Date.now().toString(36)}_${nextIdSeq.toString(36)}`;
@@ -39620,7 +39621,7 @@ function createInMemoryProcessRegistry2(options) {
39620
39621
  }
39621
39622
  var nextIdSeq = 0;
39622
39623
 
39623
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/runtime-paths.js
39624
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/runtime-paths.js
39624
39625
  function ambientRuntimePaths2() {
39625
39626
  const cwd = getProcessCwd2();
39626
39627
  return { cwd, home: getHomeDir() ?? cwd };
@@ -39630,7 +39631,7 @@ var init_runtime_paths = __esm(() => {
39630
39631
  init_path2();
39631
39632
  });
39632
39633
 
39633
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
39634
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/schema-validation.js
39634
39635
  async function loadStructuredConfig(path7, options = {}) {
39635
39636
  const content = await (options.fileSystem ?? createNodeFileSystem3()).readFile(path7);
39636
39637
  return await parseStructuredConfig(content, path7, options);
@@ -39913,10 +39914,10 @@ var init_schema_validation2 = __esm(() => {
39913
39914
  defaultResolve = typeof Bun !== "undefined" ? (specifier, from) => Bun.resolveSync(specifier, from) : undefined;
39914
39915
  });
39915
39916
 
39916
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/types.js
39917
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/types.js
39917
39918
  var init_types2 = () => {};
39918
39919
 
39919
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/index.js
39920
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/index.js
39920
39921
  var exports_dist2 = {};
39921
39922
  __export(exports_dist2, {
39922
39923
  writeJsonFile: () => writeJsonFile2,
@@ -42514,7 +42515,7 @@ var init_mod = __esm(() => {
42514
42515
  init_config3();
42515
42516
  });
42516
42517
 
42517
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/logger.js
42518
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/logger.js
42518
42519
  function toLogTapeLevel(level) {
42519
42520
  return level === "warn" ? "warning" : level;
42520
42521
  }
@@ -44067,7 +44068,7 @@ var require_src = __commonJS((exports) => {
44067
44068
  };
44068
44069
  });
44069
44070
 
44070
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/telemetry/sdk.js
44071
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/telemetry/sdk.js
44071
44072
  function getTelemetryConfig(configPartial = {}) {
44072
44073
  return {
44073
44074
  enabled: configPartial.enabled ?? CONFIG_DEFAULTS.enabled,
@@ -44103,7 +44104,7 @@ var init_sdk = __esm(() => {
44103
44104
  resolvedConfig = getTelemetryConfig();
44104
44105
  });
44105
44106
 
44106
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/telemetry/tracing.js
44107
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/telemetry/tracing.js
44107
44108
  function isSuppressed(tracer2) {
44108
44109
  return tracer2 === undefined && !getResolvedConfig().enabled;
44109
44110
  }
@@ -44143,7 +44144,7 @@ var init_tracing2 = __esm(() => {
44143
44144
  import_api2 = __toESM(require_src(), 1);
44144
44145
  });
44145
44146
 
44146
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/telemetry/metrics.js
44147
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/telemetry/metrics.js
44147
44148
  function getMeter() {
44148
44149
  return import_api3.metrics.getMeter(METER_NAME, METER_VERSION);
44149
44150
  }
@@ -44240,7 +44241,7 @@ var init_metrics = __esm(() => {
44240
44241
  instruments = {};
44241
44242
  });
44242
44243
 
44243
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/event-bus/event-bus.js
44244
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/event-bus/event-bus.js
44244
44245
  function busLogger() {
44245
44246
  if (!_busLogger)
44246
44247
  _busLogger = getLogger2("event-bus");
@@ -44493,7 +44494,7 @@ var init_event_bus = __esm(() => {
44493
44494
  init_metrics();
44494
44495
  });
44495
44496
 
44496
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/event-bus/default-observers.js
44497
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/event-bus/default-observers.js
44497
44498
  function obsLogger() {
44498
44499
  if (!_obsLogger)
44499
44500
  _obsLogger = getLogger2("event-bus.observers");
@@ -44557,7 +44558,7 @@ var init_default_observers = __esm(() => {
44557
44558
  init_event_bus();
44558
44559
  });
44559
44560
 
44560
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/event-bus/file-observer.js
44561
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/event-bus/file-observer.js
44561
44562
  function parentDir(filePath) {
44562
44563
  const idx = filePath.lastIndexOf("/");
44563
44564
  return idx <= 0 ? "." : filePath.slice(0, idx);
@@ -44655,7 +44656,7 @@ var init_file_observer = __esm(() => {
44655
44656
  init_logger3();
44656
44657
  });
44657
44658
 
44658
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/execution-policy.js
44659
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/execution-policy.js
44659
44660
  function resolveExecutionTimeoutMs(scope, value, inherited) {
44660
44661
  if (value === undefined) {
44661
44662
  return inherited ?? null;
@@ -44732,7 +44733,7 @@ async function runWithExecutionDeadline(action, options) {
44732
44733
  return { outcome: "completed", result, elapsedMs, timedOut };
44733
44734
  }
44734
44735
 
44735
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/internals/drain.js
44736
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/internals/drain.js
44736
44737
  function settleWithin(promise2, deadline) {
44737
44738
  const remaining = deadline - Date.now();
44738
44739
  if (remaining <= 0)
@@ -54893,7 +54894,7 @@ END`;
54893
54894
  ];
54894
54895
  });
54895
54896
 
54896
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/errors.js
54897
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/errors.js
54897
54898
  var HistoryImportError, ImportCancelledError;
54898
54899
  var init_errors5 = __esm(() => {
54899
54900
  HistoryImportError = class HistoryImportError extends Error {
@@ -54914,7 +54915,7 @@ var init_errors5 = __esm(() => {
54914
54915
  };
54915
54916
  });
54916
54917
 
54917
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/cancellation.js
54918
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/cancellation.js
54918
54919
  function throwIfImportAborted(signal) {
54919
54920
  if (signal?.aborted) {
54920
54921
  throw new ImportCancelledError("Import cancelled by abort signal", signal.reason);
@@ -54924,7 +54925,7 @@ var init_cancellation = __esm(() => {
54924
54925
  init_errors5();
54925
54926
  });
54926
54927
 
54927
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/hash.js
54928
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/hash.js
54928
54929
  import { createHash as createHash3 } from "crypto";
54929
54930
  function stableJson(value) {
54930
54931
  if (Array.isArray(value)) {
@@ -54941,8 +54942,8 @@ function sha256(value) {
54941
54942
  }
54942
54943
  var init_hash = () => {};
54943
54944
 
54944
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/schema-sql.js
54945
- var HISTORY_IMPORT_SCHEMA_VERSION = "0.5.5", HISTORY_IMPORT_SCHEMA_SQL;
54945
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/schema-sql.js
54946
+ var HISTORY_IMPORT_SCHEMA_VERSION = "0.5.7", HISTORY_IMPORT_SCHEMA_SQL;
54946
54947
  var init_schema_sql = __esm(() => {
54947
54948
  HISTORY_IMPORT_SCHEMA_SQL = `
54948
54949
  CREATE TABLE IF NOT EXISTS history_import_checkpoint (
@@ -55064,7 +55065,7 @@ CREATE INDEX IF NOT EXISTS idx_history_skill_call_invocation_kind
55064
55065
  `.trim();
55065
55066
  });
55066
55067
 
55067
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/mappers.js
55068
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/mappers.js
55068
55069
  function identityFieldMap(keys) {
55069
55070
  const map2 = {};
55070
55071
  for (const key of keys) {
@@ -56702,7 +56703,7 @@ var init_mappers = __esm(() => {
56702
56703
  DSH_SCHEMA = passthroughSchema;
56703
56704
  });
56704
56705
 
56705
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/sources.js
56706
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/sources.js
56706
56707
  function firstString(...values) {
56707
56708
  for (const value of values) {
56708
56709
  if (typeof value === "string" && value.length > 0)
@@ -56863,7 +56864,7 @@ var init_sources = __esm(() => {
56863
56864
  };
56864
56865
  });
56865
56866
 
56866
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/jsonl-importer-dao.js
56867
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/jsonl-importer-dao.js
56867
56868
  function targetTableFor(table3) {
56868
56869
  if (!VALID_TABLE_NAME.test(table3)) {
56869
56870
  throw new HistoryImportError(`Invalid history ETL target table: ${table3}`, { table: table3 });
@@ -57286,7 +57287,7 @@ var init_jsonl_importer_dao = __esm(() => {
57286
57287
  ARGS_TOOL_NAME_KEYS = ["tool", "tool_name", "toolName", "name", "command"];
57287
57288
  });
57288
57289
 
57289
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/redaction.js
57290
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/redaction.js
57290
57291
  function redactValue(value, rules = DEFAULT_REDACTION_RULES) {
57291
57292
  if (typeof value === "string") {
57292
57293
  return rules.reduce((current, rule) => current.replace(rule.pattern, rule.replacement), value);
@@ -57347,7 +57348,7 @@ var init_redaction = __esm(() => {
57347
57348
  SECRET_KEY = /^(?:api[_-]?key|apikey|api[_-]?secret|token|access[_-]?token|refresh[_-]?token|auth[_-]?token|secret|secret[_-]?key|client[_-]?secret|private[_-]?key|session[_-]?token|password|passwd|authorization)$/i;
57348
57349
  });
57349
57350
 
57350
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/zstd.js
57351
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/zstd.js
57351
57352
  async function zstdDecompress(file2, env2) {
57352
57353
  const result = await new NodeProcessExecutor3().run({
57353
57354
  command: "zstd",
@@ -57367,7 +57368,7 @@ var init_zstd = __esm(() => {
57367
57368
  init_errors5();
57368
57369
  });
57369
57370
 
57370
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/importer.js
57371
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/importer.js
57371
57372
  function toolCallKey(source, sessionId, callId) {
57372
57373
  return `${source}${TOOL_CALL_KEY_SEP}${sessionId}${TOOL_CALL_KEY_SEP}${callId}`;
57373
57374
  }
@@ -57794,7 +57795,7 @@ var init_importer = __esm(() => {
57794
57795
  init_zstd();
57795
57796
  });
57796
57797
 
57797
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/opencode-importer.js
57798
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/opencode-importer.js
57798
57799
  async function runOpenCodeImport(options) {
57799
57800
  throwIfImportAborted(options.signal);
57800
57801
  const paths = options.paths ?? ambientRuntimePaths2();
@@ -58086,7 +58087,7 @@ var init_opencode_importer = __esm(() => {
58086
58087
  init_redaction();
58087
58088
  });
58088
58089
 
58089
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/tables.js
58090
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/tables.js
58090
58091
  var BOOKKEEPING_HISTORY_TABLES, IMPORTER_OWNED_TABLES;
58091
58092
  var init_tables = __esm(() => {
58092
58093
  init_jsonl_importer_dao();
@@ -58099,7 +58100,7 @@ var init_tables = __esm(() => {
58099
58100
  ];
58100
58101
  });
58101
58102
 
58102
- // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.5+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/index.js
58103
+ // ../../node_modules/.bun/@gobing-ai+ts-llm-jsonl-importer@0.5.7+f66f1d7f0d37c145/node_modules/@gobing-ai/ts-llm-jsonl-importer/dist/index.js
58103
58104
  var init_dist6 = __esm(() => {
58104
58105
  init_importer();
58105
58106
  init_mappers();
@@ -61010,7 +61011,7 @@ function observationIsNewer(leftAt, leftId, rightAt, rightId) {
61010
61011
  }
61011
61012
  var AGENT_EXECUTOR_UPDATE_COLUMNS = "project_id, executor_name, observation_id, observed_at, agent, model, disabled, owner, layer, skipped_reason, applied_observation_id, applied_at, attempts, retry_after, last_error";
61012
61013
 
61013
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/schema/drizzle-internals.js
61014
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/schema/drizzle-internals.js
61014
61015
  function sqlExpressionToText(value) {
61015
61016
  if (typeof value !== "object" || value === null || !("queryChunks" in value)) {
61016
61017
  return;
@@ -61033,7 +61034,7 @@ function getDrizzleTableName(table3) {
61033
61034
  return String(table3[nameSym]);
61034
61035
  }
61035
61036
 
61036
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/schema/ddl.js
61037
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/schema/ddl.js
61037
61038
  function quoteIdent(name) {
61038
61039
  return `"${name.replace(/"/g, '""')}"`;
61039
61040
  }
@@ -61405,7 +61406,7 @@ var init_drizzle_zod = __esm(() => {
61405
61406
  };
61406
61407
  });
61407
61408
 
61408
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/schema/define-table.js
61409
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/schema/define-table.js
61409
61410
  function defineTable(name, columns2) {
61410
61411
  const table3 = sqliteTable(name, columns2);
61411
61412
  let insert2;
@@ -61439,7 +61440,7 @@ var init_define_table = __esm(() => {
61439
61440
  init_ddl();
61440
61441
  });
61441
61442
 
61442
- // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.5+39bc1e2ee397acda/node_modules/@gobing-ai/ts-db/dist/schema/index.js
61443
+ // ../../node_modules/.bun/@gobing-ai+ts-db@0.5.7+bb38ae7d6d967e08/node_modules/@gobing-ai/ts-db/dist/schema/index.js
61443
61444
  var exports_schema = {};
61444
61445
  __export(exports_schema, {
61445
61446
  text: () => text,
@@ -62073,7 +62074,7 @@ var init_run_dao = __esm(() => {
62073
62074
  LIMIT ?6`, filter.workflow ?? null, filter.status ?? null, filter.since ?? null, filter.before?.started_at ?? null, filter.before?.id ?? null, filter.limit);
62074
62075
  }
62075
62076
  traceRowById(runId) {
62076
- return this.adapter.queryFirst("SELECT id, workflow_name, mode, status, agent, started_at, completed_at, metadata_json FROM runs WHERE id = ?", runId);
62077
+ return this.adapter.queryFirst("SELECT id, workflow_name, mode, status, agent, started_at, completed_at, terminal_reason, metadata_json FROM runs WHERE id = ?", runId);
62077
62078
  }
62078
62079
  mergeMetadata(runId, patch) {
62079
62080
  return this.adapter.run(`UPDATE runs
@@ -62359,7 +62360,7 @@ var init_dao = __esm(() => {
62359
62360
  init_workspace_dao();
62360
62361
  });
62361
62362
 
62362
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/errors.js
62363
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/errors.js
62363
62364
  var WorkflowValidationError, FSMError, RunCollisionError, WorkflowResumeError;
62364
62365
  var init_errors6 = __esm(() => {
62365
62366
  WorkflowValidationError = class WorkflowValidationError extends Error {
@@ -62394,12 +62395,12 @@ var init_errors6 = __esm(() => {
62394
62395
  };
62395
62396
  });
62396
62397
 
62397
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/event-bus/index.js
62398
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/event-bus/index.js
62398
62399
  var init_event_bus2 = __esm(() => {
62399
62400
  init_event_bus();
62400
62401
  });
62401
62402
 
62402
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/api-client.js
62403
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/api-client.js
62403
62404
  function truncateBody(text3) {
62404
62405
  return text3.length <= MAX_ERROR_BODY ? text3 : `${text3.slice(0, MAX_ERROR_BODY)}\u2026[truncated ${text3.length - MAX_ERROR_BODY} chars]`;
62405
62406
  }
@@ -62633,12 +62634,12 @@ var init_api_client = __esm(() => {
62633
62634
  };
62634
62635
  });
62635
62636
 
62636
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/telemetry/index.js
62637
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/telemetry/index.js
62637
62638
  var init_telemetry = __esm(() => {
62638
62639
  init_tracing2();
62639
62640
  });
62640
62641
 
62641
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/index.js
62642
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/index.js
62642
62643
  var init_dist7 = __esm(() => {
62643
62644
  init_api_client();
62644
62645
  init_event_bus2();
@@ -62646,7 +62647,7 @@ var init_dist7 = __esm(() => {
62646
62647
  init_telemetry();
62647
62648
  });
62648
62649
 
62649
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/run-lifecycle.js
62650
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/run-lifecycle.js
62650
62651
  function runtimeBuiltins(workflowName, stateOrNodeId, runId, transitionsTaken, mode) {
62651
62652
  return {
62652
62653
  workflow: workflowName,
@@ -62737,14 +62738,14 @@ class RunLifecycle {
62737
62738
  return await lifecycle.execute(loop);
62738
62739
  }, { attributes: { "workflow.name": workflowName, "workflow.mode": mode } });
62739
62740
  }
62740
- async finalizeAsOwner(status, completedAt) {
62741
+ async finalizeAsOwner(status, completedAt, reason) {
62741
62742
  if (this.ownerAttempt === undefined) {
62742
- await this.persistence.finalizeRun(this.runId, status, completedAt);
62743
+ await this.persistence.finalizeRun(this.runId, status, completedAt, undefined, reason);
62743
62744
  return;
62744
62745
  }
62745
62746
  const applied = await this.persistence.finalizeRun(this.runId, status, completedAt, {
62746
62747
  ownerAttempt: this.ownerAttempt
62747
- });
62748
+ }, reason);
62748
62749
  if (applied === false) {
62749
62750
  this.events?.emit("workflow.run.stale_owner", {
62750
62751
  runId: this.runId,
@@ -62760,7 +62761,7 @@ class RunLifecycle {
62760
62761
  return await loop(this);
62761
62762
  } catch (error51) {
62762
62763
  try {
62763
- await this.finalizeAsOwner("failed", new Date().toISOString());
62764
+ await this.finalizeAsOwner("failed", new Date().toISOString(), "failed");
62764
62765
  } catch (finalizeError) {
62765
62766
  throw new AggregateError([error51, finalizeError], "Workflow execution and failure persistence failed");
62766
62767
  }
@@ -62824,9 +62825,9 @@ class RunLifecycle {
62824
62825
  severity: "info"
62825
62826
  });
62826
62827
  }
62827
- async done(finalState, transitionsTaken) {
62828
+ async done(finalState, transitionsTaken, reason) {
62828
62829
  await this.persistence.savePhase(this.runId, finalState, "done");
62829
- await this.finalizeAsOwner("done", new Date().toISOString());
62830
+ await this.finalizeAsOwner("done", new Date().toISOString(), reason);
62830
62831
  this.logger.info("workflow run done", { finalState, transitionsTaken });
62831
62832
  addSpanEvent("workflow.run.done", { runId: this.runId, finalState, transitionsTaken });
62832
62833
  this.events?.emit("workflow.run.done", {
@@ -62836,11 +62837,11 @@ class RunLifecycle {
62836
62837
  externalKey: this.externalKey,
62837
62838
  severity: "info"
62838
62839
  });
62839
- return this.result("done", finalState, transitionsTaken);
62840
+ return this.result("done", finalState, transitionsTaken, reason);
62840
62841
  }
62841
62842
  async fail(finalState, transitionsTaken, reason = "failed") {
62842
62843
  await this.persistence.savePhase(this.runId, finalState, "failed");
62843
- await this.finalizeAsOwner("failed", new Date().toISOString());
62844
+ await this.finalizeAsOwner("failed", new Date().toISOString(), reason);
62844
62845
  addSpanEvent("workflow.run.failed", { runId: this.runId, finalState, reason });
62845
62846
  this.events?.emit("workflow.run.failed", {
62846
62847
  runId: this.runId,
@@ -62852,7 +62853,7 @@ class RunLifecycle {
62852
62853
  this.logger.warn("workflow run failed", { finalState, transitionsTaken, reason });
62853
62854
  return this.result("failed", finalState, transitionsTaken, reason);
62854
62855
  }
62855
- async pause(stateOrNodeId, transitionsTaken, vars, lastActionResult) {
62856
+ async pause(stateOrNodeId, transitionsTaken, vars, lastActionResult, reason) {
62856
62857
  const data = { transitionsTaken };
62857
62858
  if (vars !== undefined)
62858
62859
  data.effectiveVars = vars;
@@ -62860,7 +62861,7 @@ class RunLifecycle {
62860
62861
  data.lastActionResult = { ok: lastActionResult.ok };
62861
62862
  await this.persistence.saveWorkflowState(this.runId, stateOrNodeId, data);
62862
62863
  await this.persistence.savePhase(this.runId, stateOrNodeId, "paused");
62863
- await this.finalizeAsOwner("paused", new Date().toISOString());
62864
+ await this.finalizeAsOwner("paused", new Date().toISOString(), reason);
62864
62865
  this.logger.info("workflow run paused", { stateOrNodeId, transitionsTaken });
62865
62866
  addSpanEvent("workflow.run.paused", { runId: this.runId, node: stateOrNodeId, transitionsTaken });
62866
62867
  this.events?.emit("workflow.run.paused", {
@@ -62979,7 +62980,7 @@ var init_run_lifecycle = __esm(() => {
62979
62980
  ];
62980
62981
  });
62981
62982
 
62982
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/extension/capability-registry.js
62983
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/extension/capability-registry.js
62983
62984
  class CapabilityRegistry {
62984
62985
  kind;
62985
62986
  capabilities = new Map;
@@ -63010,7 +63011,7 @@ class CapabilityRegistry {
63010
63011
  }
63011
63012
  }
63012
63013
 
63013
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-path.js
63014
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-path.js
63014
63015
  function assertRelativeExtensionPath(path9, options = {}) {
63015
63016
  const where = options.sourceName !== undefined ? ` declared by "${options.sourceName}"` : "";
63016
63017
  if (/^([/\\]|[A-Za-z]:[/\\])/.test(path9)) {
@@ -63021,7 +63022,7 @@ function assertRelativeExtensionPath(path9, options = {}) {
63021
63022
  }
63022
63023
  }
63023
63024
 
63024
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-loader.js
63025
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/extension/extension-loader.js
63025
63026
  import { isAbsolute, resolve as resolve2 } from "path";
63026
63027
  async function loadExtensionModules(refs, options, register) {
63027
63028
  if (refs.length === 0)
@@ -63060,17 +63061,17 @@ async function loadExtensionModules(refs, options, register) {
63060
63061
  }
63061
63062
  var init_extension_loader = () => {};
63062
63063
 
63063
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/extension/index.js
63064
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/extension/index.js
63064
63065
  var init_extension = __esm(() => {
63065
63066
  init_extension_loader();
63066
63067
  });
63067
63068
 
63068
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.5+f7d40ff0330fe483/node_modules/@gobing-ai/ts-runtime/dist/extension.js
63069
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.7+1559f1781554b121/node_modules/@gobing-ai/ts-runtime/dist/extension.js
63069
63070
  var init_extension2 = __esm(() => {
63070
63071
  init_extension();
63071
63072
  });
63072
63073
 
63073
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema.js
63074
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema.js
63074
63075
  var RESERVED_VAR_NAMES, IDENTIFIER, VarsSchema, EnvSchema, relativeExtensionPath, WorkflowExtensionsSchema, ActionDefSchema, GuardDefSchema, StateMachineWorkflowDefSchema, TransitionFlowWorkflowDefSchema, WorkflowDefSchema;
63075
63076
  var init_schema2 = __esm(() => {
63076
63077
  init_extension2();
@@ -63139,7 +63140,8 @@ var init_schema2 = __esm(() => {
63139
63140
  to: exports_external.string().min(1),
63140
63141
  description: exports_external.string().optional(),
63141
63142
  trigger: exports_external.string().optional(),
63142
- guard: GuardDefSchema.optional()
63143
+ guard: GuardDefSchema.optional(),
63144
+ terminalReason: exports_external.string().optional()
63143
63145
  }).strict()),
63144
63146
  extensions: WorkflowExtensionsSchema.optional()
63145
63147
  }).strict();
@@ -63174,7 +63176,7 @@ var init_schema2 = __esm(() => {
63174
63176
  WorkflowDefSchema = exports_external.union([StateMachineWorkflowDefSchema, TransitionFlowWorkflowDefSchema]);
63175
63177
  });
63176
63178
 
63177
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/config.js
63179
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/config.js
63178
63180
  async function loadWorkflowDef(path9, options = {}) {
63179
63181
  return parseWorkflowDef(await loadStructuredConfig(path9, options), path9);
63180
63182
  }
@@ -63355,7 +63357,7 @@ var init_config4 = __esm(() => {
63355
63357
  RUNTIME_TEMPLATE_NAMESPACES = new Set(RUNTIME_BUILTIN_KEYS);
63356
63358
  });
63357
63359
 
63358
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/extensions.js
63360
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/extensions.js
63359
63361
  function collectWorkflowExtensions(sourceName, sourceDir, extensions) {
63360
63362
  if (extensions === undefined)
63361
63363
  return [];
@@ -63419,7 +63421,7 @@ var init_extensions = __esm(() => {
63419
63421
  init_errors6();
63420
63422
  });
63421
63423
 
63422
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/variables.js
63424
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/variables.js
63423
63425
  function mergeVars(workflowVars = {}, overrideVars = {}) {
63424
63426
  return { ...workflowVars, ...overrideVars };
63425
63427
  }
@@ -63518,7 +63520,7 @@ var init_variables = __esm(() => {
63518
63520
  SHELL_BINDING_ANY = /\$\{__WF_\d+\}|\$__WF_\d+\b/;
63519
63521
  });
63520
63522
 
63521
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/host.js
63523
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/host.js
63522
63524
  class WorkflowEngineHost {
63523
63525
  lifecycleBus;
63524
63526
  actions = new CapabilityRegistry("workflow action");
@@ -63715,7 +63717,7 @@ var init_host = __esm(() => {
63715
63717
  init_variables();
63716
63718
  });
63717
63719
 
63718
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema-sql.js
63720
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/schema-sql.js
63719
63721
  var WORKFLOW_ENGINE_SCHEMA_SQL, WORKFLOW_ENGINE_MIGRATIONS_SQL;
63720
63722
  var init_schema_sql2 = __esm(() => {
63721
63723
  WORKFLOW_ENGINE_SCHEMA_SQL = `
@@ -63733,7 +63735,8 @@ CREATE TABLE IF NOT EXISTS runs (
63733
63735
  updated_at INTEGER NOT NULL DEFAULT 0,
63734
63736
  owner_attempt TEXT,
63735
63737
  owner_pid INTEGER,
63736
- interrupt_reason TEXT
63738
+ interrupt_reason TEXT,
63739
+ terminal_reason TEXT
63737
63740
  );
63738
63741
 
63739
63742
  CREATE UNIQUE INDEX IF NOT EXISTS idx_runs_external_key
@@ -63793,10 +63796,11 @@ CREATE TABLE IF NOT EXISTS action_runs (
63793
63796
  ALTER TABLE runs ADD COLUMN owner_attempt TEXT;
63794
63797
  ALTER TABLE runs ADD COLUMN owner_pid INTEGER;
63795
63798
  ALTER TABLE runs ADD COLUMN interrupt_reason TEXT;
63799
+ ALTER TABLE runs ADD COLUMN terminal_reason TEXT;
63796
63800
  `.trim();
63797
63801
  });
63798
63802
 
63799
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/persistence.js
63803
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/persistence.js
63800
63804
  async function applyWorkflowEngineSchema(db2) {
63801
63805
  for (const statement of WORKFLOW_ENGINE_SCHEMA_SQL.split(";")) {
63802
63806
  const sql4 = statement.trim();
@@ -63853,26 +63857,26 @@ class DbWorkflowPersistenceAdapter {
63853
63857
  await this.db.run(`INSERT INTO runs (id, workflow_name, mode, status, external_key, started_at, completed_at, metadata_json, owner_attempt, owner_pid, created_at, updated_at)
63854
63858
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, record2.id, record2.workflow_name, record2.mode, record2.status, record2.external_key ?? null, record2.started_at, record2.completed_at, record2.metadata_json, record2.owner_attempt ?? null, record2.owner_pid ?? null, Date.now(), Date.now());
63855
63859
  }
63856
- async finalizeRun(runId, status, completedAt, fence) {
63860
+ async finalizeRun(runId, status, completedAt, fence, reason) {
63857
63861
  if (fence === undefined) {
63858
- await this.db.run("UPDATE runs SET status = ?, completed_at = ?, updated_at = ? WHERE id = ?", status, completedAt, Date.now(), runId);
63862
+ await this.db.run("UPDATE runs SET status = ?, completed_at = ?, terminal_reason = ?, updated_at = ? WHERE id = ?", status, completedAt, reason ?? null, Date.now(), runId);
63859
63863
  return true;
63860
63864
  }
63861
- await this.db.run("UPDATE runs SET status = ?, completed_at = ?, updated_at = ? WHERE id = ? AND owner_attempt = ? AND status = 'running'", status, completedAt, Date.now(), runId, fence.ownerAttempt);
63865
+ await this.db.run("UPDATE runs SET status = ?, completed_at = ?, terminal_reason = ?, updated_at = ? WHERE id = ? AND owner_attempt = ? AND status = 'running'", status, completedAt, reason ?? null, Date.now(), runId, fence.ownerAttempt);
63862
63866
  const run = await this.loadRun(runId);
63863
63867
  return run !== undefined && run.status === status && run.owner_attempt === fence.ownerAttempt;
63864
63868
  }
63865
63869
  async claimRunOwnership(runId, owner, expectedStatuses) {
63866
63870
  await this.ensureSchema();
63867
63871
  const placeholders = expectedStatuses.map(() => "?").join(", ");
63868
- await this.db.run(`UPDATE runs SET status = 'running', completed_at = NULL, owner_attempt = ?, owner_pid = ?, updated_at = ?
63872
+ await this.db.run(`UPDATE runs SET status = 'running', completed_at = NULL, terminal_reason = NULL, owner_attempt = ?, owner_pid = ?, updated_at = ?
63869
63873
  WHERE id = ? AND status IN (${placeholders})`, owner.attemptId, owner.pid ?? null, Date.now(), runId, ...expectedStatuses);
63870
63874
  const run = await this.loadRun(runId);
63871
63875
  return run !== undefined && run.status === "running" && run.owner_attempt === owner.attemptId ? run : undefined;
63872
63876
  }
63873
63877
  async interruptRun(runId, reason) {
63874
63878
  await this.ensureSchema();
63875
- await this.db.run("UPDATE runs SET status = 'interrupted', interrupt_reason = ?, completed_at = NULL, updated_at = ? WHERE id = ? AND status = 'running'", reason, Date.now(), runId);
63879
+ await this.db.run("UPDATE runs SET status = 'interrupted', interrupt_reason = ?, terminal_reason = ?, completed_at = NULL, updated_at = ? WHERE id = ? AND status = 'running'", reason, reason, Date.now(), runId);
63876
63880
  const run = await this.loadRun(runId);
63877
63881
  return run !== undefined && run.status === "interrupted" ? run : undefined;
63878
63882
  }
@@ -64042,17 +64046,17 @@ class MemoryWorkflowPersistenceAdapter {
64042
64046
  throw new RunCollisionError(record2.id);
64043
64047
  this.runs.set(record2.id, record2);
64044
64048
  }
64045
- async finalizeRun(runId, status, completedAt, fence) {
64049
+ async finalizeRun(runId, status, completedAt, fence, reason) {
64046
64050
  const run = this.runs.get(runId);
64047
64051
  if (fence === undefined) {
64048
64052
  if (run !== undefined)
64049
- this.runs.set(runId, { ...run, status, completed_at: completedAt });
64053
+ this.runs.set(runId, { ...run, status, completed_at: completedAt, terminal_reason: reason ?? null });
64050
64054
  return true;
64051
64055
  }
64052
64056
  if (run === undefined || run.owner_attempt !== fence.ownerAttempt || run.status !== "running") {
64053
64057
  return false;
64054
64058
  }
64055
- this.runs.set(runId, { ...run, status, completed_at: completedAt });
64059
+ this.runs.set(runId, { ...run, status, completed_at: completedAt, terminal_reason: reason ?? null });
64056
64060
  return true;
64057
64061
  }
64058
64062
  async claimRunOwnership(runId, owner, expectedStatuses) {
@@ -64064,6 +64068,7 @@ class MemoryWorkflowPersistenceAdapter {
64064
64068
  ...run,
64065
64069
  status: "running",
64066
64070
  completed_at: null,
64071
+ terminal_reason: null,
64067
64072
  owner_attempt: owner.attemptId,
64068
64073
  owner_pid: owner.pid ?? null
64069
64074
  };
@@ -64077,7 +64082,8 @@ class MemoryWorkflowPersistenceAdapter {
64077
64082
  const interrupted = {
64078
64083
  ...run,
64079
64084
  status: "interrupted",
64080
- interrupt_reason: reason
64085
+ interrupt_reason: reason,
64086
+ terminal_reason: reason
64081
64087
  };
64082
64088
  this.runs.set(runId, interrupted);
64083
64089
  return interrupted;
@@ -64182,7 +64188,7 @@ var init_persistence = __esm(() => {
64182
64188
  init_schema_sql2();
64183
64189
  });
64184
64190
 
64185
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/action-step.js
64191
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/action-step.js
64186
64192
  async function runActionStep(action, vars, deps) {
64187
64193
  const { host, persistence, lifecycle, stateOrNodeId, runId } = deps;
64188
64194
  const templateContext = {
@@ -64248,7 +64254,7 @@ var init_action_step = __esm(() => {
64248
64254
  init_variables();
64249
64255
  });
64250
64256
 
64251
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/state-machine.js
64257
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/state-machine.js
64252
64258
  class StateMachineDriver {
64253
64259
  options;
64254
64260
  constructor(options) {
@@ -64275,6 +64281,7 @@ class StateMachineDriver {
64275
64281
  const defaultOnError = workflow.defaultOnError;
64276
64282
  let resumeMode = resumeFromState !== undefined ? options.resumeMode ?? "skip-enter" : undefined;
64277
64283
  let persistedViaHop = false;
64284
+ let declaredTerminalReason;
64278
64285
  if (current === undefined) {
64279
64286
  const label = resumeFromState ?? workflow.initialState;
64280
64287
  throw new FSMError(`State "${label}" is not declared`);
@@ -64321,7 +64328,9 @@ class StateMachineDriver {
64321
64328
  }
64322
64329
  const outbound = workflow.transitions.filter((transition) => transition.from === current?.id);
64323
64330
  if (terminal.has(current.id) || outbound.length === 0) {
64324
- return failure.has(current.id) ? await lifecycle.fail(current.id, transitionsTaken, `terminal:${current.id}`) : await lifecycle.done(current.id, transitionsTaken);
64331
+ const declared = declaredTerminalReason;
64332
+ declaredTerminalReason = undefined;
64333
+ return failure.has(current.id) ? await lifecycle.fail(current.id, transitionsTaken, declared ?? `terminal:${current.id}`) : await lifecycle.done(current.id, transitionsTaken, declared);
64325
64334
  }
64326
64335
  const nextTransition = await firstPassingTransition(outbound, this.options.host, {
64327
64336
  runId,
@@ -64368,6 +64377,7 @@ class StateMachineDriver {
64368
64377
  if (nextState === undefined)
64369
64378
  throw new FSMError(`Transition target "${nextTransition.to}" is not declared`);
64370
64379
  current = nextState;
64380
+ declaredTerminalReason = nextTransition.terminalReason;
64371
64381
  persistedViaHop = true;
64372
64382
  }
64373
64383
  }
@@ -64396,7 +64406,7 @@ var init_state_machine = __esm(() => {
64396
64406
  EMPTY_OUTCOME = { outcome: "completed", result: undefined, setVars: undefined };
64397
64407
  });
64398
64408
 
64399
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/transition-flow.js
64409
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/transition-flow.js
64400
64410
  class TransitionFlowDriver {
64401
64411
  options;
64402
64412
  constructor(options) {
@@ -64524,7 +64534,7 @@ var init_transition_flow = __esm(() => {
64524
64534
  init_variables();
64525
64535
  });
64526
64536
 
64527
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/service.js
64537
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/service.js
64528
64538
  class WorkflowService {
64529
64539
  host;
64530
64540
  persistence;
@@ -64781,7 +64791,7 @@ var init_service = __esm(() => {
64781
64791
  init_variables();
64782
64792
  });
64783
64793
 
64784
- // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/index.js
64794
+ // ../../node_modules/.bun/@gobing-ai+ts-dual-workflow-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-dual-workflow-engine/dist/index.js
64785
64795
  var init_dist8 = __esm(() => {
64786
64796
  init_config4();
64787
64797
  init_extensions();
@@ -64791,7 +64801,7 @@ var init_dist8 = __esm(() => {
64791
64801
  init_service();
64792
64802
  });
64793
64803
 
64794
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/extensions.js
64804
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/extensions.js
64795
64805
  function collectExtensions(sourceName, sourceDir, extensions) {
64796
64806
  if (extensions === undefined)
64797
64807
  return [];
@@ -64805,7 +64815,7 @@ function collectExtensions(sourceName, sourceDir, extensions) {
64805
64815
  }
64806
64816
  var init_extensions2 = () => {};
64807
64817
 
64808
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/types.js
64818
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/types.js
64809
64819
  function createFinding(rule, message, filePath, extras = {}) {
64810
64820
  return {
64811
64821
  ruleId: rule.id,
@@ -64876,7 +64886,7 @@ var init_types3 = __esm(() => {
64876
64886
  });
64877
64887
  });
64878
64888
 
64879
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/loader.js
64889
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/config/loader.js
64880
64890
  async function loadPreset(name, options) {
64881
64891
  const merged = await buildMergedRoots(options.roots.map((root) => resolvePath4(root)), options.fileSystem);
64882
64892
  const presetPath = findMergedPreset(merged, name);
@@ -65091,7 +65101,7 @@ var init_loader2 = __esm(() => {
65091
65101
  FIX_MODE_AUTHORITY = { none: 0, suggest: 1, auto: 2 };
65092
65102
  });
65093
65103
 
65094
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/test-stub-fixer.js
65104
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/test-stub-fixer.js
65095
65105
  function normalizeFindingPath(filePath) {
65096
65106
  if (!filePath || isAbsolutePath2(filePath))
65097
65107
  return null;
@@ -65156,7 +65166,7 @@ var init_test_stub_fixer = __esm(() => {
65156
65166
  realFileSystem = createNodeFileSystem3();
65157
65167
  });
65158
65168
 
65159
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/fixers.js
65169
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/fixers/fixers.js
65160
65170
  function registerBuiltinFixers(host, exec) {
65161
65171
  const regexFixer = new RegexFixerProvider;
65162
65172
  const pathFixer = new PathFixerProvider;
@@ -65375,7 +65385,7 @@ var init_fixers = __esm(() => {
65375
65385
  };
65376
65386
  });
65377
65387
 
65378
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/agent-spec.js
65388
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/agent-spec.js
65379
65389
  function validateAgentId(id) {
65380
65390
  if (!/^[a-z][a-z0-9_-]{1,63}$/.test(id)) {
65381
65391
  throw new ValueError(`Invalid agent id "${id}": expected 2-64 chars, lowercase alphanumeric, "_" or "-"`);
@@ -65480,7 +65490,7 @@ var init_agent_spec = __esm(() => {
65480
65490
  };
65481
65491
  });
65482
65492
 
65483
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/agents/shims.js
65493
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/agents/shims.js
65484
65494
  function getAgentSessionCapability(agent) {
65485
65495
  return AGENT_SESSION_CAPABILITY[agent];
65486
65496
  }
@@ -65920,7 +65930,7 @@ var init_shims = __esm(() => {
65920
65930
  ALIAS_TO_CANONICAL = Object.fromEntries(Object.values(AGENT_SHIMS).flatMap((shim) => (shim.aliases ?? []).map((alias3) => [alias3, shim.name])));
65921
65931
  });
65922
65932
 
65923
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/identity.js
65933
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/identity.js
65924
65934
  function buildIdentityPreamble(ctx) {
65925
65935
  const sections = [
65926
65936
  `You are agent \`${ctx.agentId}\` (${ctx.agentType}) in workspace \`${ctx.workspace}\`.`
@@ -65996,7 +66006,7 @@ var init_identity = __esm(() => {
65996
66006
  init_dist5();
65997
66007
  });
65998
66008
 
65999
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/quota.js
66009
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/quota.js
66000
66010
  import { createHash as createHash4 } from "crypto";
66001
66011
  function classifyQuotaErrorRecord(record2) {
66002
66012
  const bounded = record2.length > MAX_QUOTA_EVIDENCE_BYTES ? record2.slice(-MAX_QUOTA_EVIDENCE_BYTES) : record2;
@@ -66097,7 +66107,7 @@ var init_quota = __esm(() => {
66097
66107
  ]);
66098
66108
  });
66099
66109
 
66100
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/slash-command.js
66110
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/slash-command.js
66101
66111
  function isClaudeStyleSlashCommand(input) {
66102
66112
  return SLASH_COMMAND_RE2.test(input);
66103
66113
  }
@@ -66125,7 +66135,7 @@ var init_slash_command = __esm(() => {
66125
66135
  SLASH_COMMAND_RE2 = /^\/([a-zA-Z0-9._-]+):([a-zA-Z0-9._-]+)(\s.*)?$/;
66126
66136
  });
66127
66137
 
66128
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/ai-runner.js
66138
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/ai-runner.js
66129
66139
  function buildCorrelationEnv(correlation) {
66130
66140
  return {
66131
66141
  [AGENT_RUN_ID_ENV]: correlation.runId,
@@ -66285,7 +66295,7 @@ var init_ai_runner = __esm(() => {
66285
66295
  init_slash_command();
66286
66296
  });
66287
66297
 
66288
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/agent-detector.js
66298
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/agent-detector.js
66289
66299
  class AgentDetector {
66290
66300
  runner;
66291
66301
  timeout;
@@ -66361,7 +66371,7 @@ var init_agent_detector = __esm(() => {
66361
66371
  VERSION_PATTERN = /(?<version>\d+\.\d+(?:\.\d+)?)/;
66362
66372
  });
66363
66373
 
66364
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/agents/auth-shims.js
66374
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/agents/auth-shims.js
66365
66375
  function isNonEmpty(value) {
66366
66376
  return value !== undefined && value.trim().length > 0;
66367
66377
  }
@@ -66490,7 +66500,7 @@ var init_auth_shims = __esm(() => {
66490
66500
  };
66491
66501
  });
66492
66502
 
66493
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/decision/errors.js
66503
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/decision/errors.js
66494
66504
  var DecisionError, DecisionConfigError, DecisionAuthError, DecisionRateLimitError, DecisionTimeoutError, DecisionConnectionError, DecisionRequestError, DecisionBackendError;
66495
66505
  var init_errors7 = __esm(() => {
66496
66506
  DecisionError = class DecisionError extends Error {
@@ -66552,7 +66562,7 @@ var init_errors7 = __esm(() => {
66552
66562
  };
66553
66563
  });
66554
66564
 
66555
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/decision/types.js
66565
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/decision/types.js
66556
66566
  var q;
66557
66567
  var init_types4 = __esm(() => {
66558
66568
  q = {
@@ -67142,7 +67152,7 @@ var init_dist9 = __esm(() => {
67142
67152
  RUNTIME = describeRuntime();
67143
67153
  });
67144
67154
 
67145
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/decision/validation.js
67155
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/decision/validation.js
67146
67156
  function record2(value) {
67147
67157
  return value !== null && typeof value === "object" && !Array.isArray(value);
67148
67158
  }
@@ -67226,7 +67236,7 @@ var init_validation2 = __esm(() => {
67226
67236
  init_errors7();
67227
67237
  });
67228
67238
 
67229
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/decision/typesafe-driver.js
67239
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/decision/typesafe-driver.js
67230
67240
  function createTypesafeDriver(config4) {
67231
67241
  let client;
67232
67242
  try {
@@ -67330,7 +67340,7 @@ var init_typesafe_driver = __esm(() => {
67330
67340
  init_validation2();
67331
67341
  });
67332
67342
 
67333
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/decision/decision-maker.js
67343
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/decision/decision-maker.js
67334
67344
  function resolveApiKey(options) {
67335
67345
  const env2 = options.env ?? getProcessEnv2();
67336
67346
  const apiKey = options.apiKey ?? env2.TYPESAFE_API_KEY;
@@ -67416,7 +67426,7 @@ var init_decision_maker = __esm(() => {
67416
67426
  init_validation2();
67417
67427
  });
67418
67428
 
67419
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/model-health-probe.js
67429
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/model-health-probe.js
67420
67430
  class ModelHealthProbeRegistry {
67421
67431
  probes = new Map;
67422
67432
  register(providerPrefix, probe) {
@@ -67540,7 +67550,7 @@ var init_model_health_probe = __esm(() => {
67540
67550
  };
67541
67551
  });
67542
67552
 
67543
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/doctor-runner.js
67553
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/doctor-runner.js
67544
67554
  class DoctorRunner {
67545
67555
  detector;
67546
67556
  runner;
@@ -67680,15 +67690,15 @@ var init_doctor_runner = __esm(() => {
67680
67690
  init_model_health_probe();
67681
67691
  });
67682
67692
 
67683
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/events.js
67693
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/events.js
67684
67694
  var init_events = () => {};
67685
67695
 
67686
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/messages.js
67696
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/messages.js
67687
67697
  function formatMessage(msg) {
67688
67698
  return `[task from=${msg.fromId ?? "operator"} id=${msg.id}] ${msg.body}`;
67689
67699
  }
67690
67700
 
67691
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/team-agent-process.js
67701
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/team-agent-process.js
67692
67702
  import { Buffer as Buffer5 } from "buffer";
67693
67703
 
67694
67704
  class TeamAgentProcess {
@@ -67855,7 +67865,7 @@ var init_team_agent_process = __esm(() => {
67855
67865
  init_quota();
67856
67866
  });
67857
67867
 
67858
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/team-orchestrator.js
67868
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/team-orchestrator.js
67859
67869
  class TeamOrchestrator {
67860
67870
  configDir;
67861
67871
  inbox;
@@ -67996,7 +68006,7 @@ var init_team_orchestrator = __esm(() => {
67996
68006
  init_team_agent_process();
67997
68007
  });
67998
68008
 
67999
- // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.5+6e2dc9a325eb9f41/node_modules/@gobing-ai/ts-ai-runner/dist/index.js
68009
+ // ../../node_modules/.bun/@gobing-ai+ts-ai-runner@0.5.7+1bb13f3c65547ce1/node_modules/@gobing-ai/ts-ai-runner/dist/index.js
68000
68010
  var exports_dist3 = {};
68001
68011
  __export(exports_dist3, {
68002
68012
  validateAgentId: () => validateAgentId,
@@ -68072,7 +68082,7 @@ var init_dist10 = __esm(() => {
68072
68082
  init_team_orchestrator();
68073
68083
  });
68074
68084
 
68075
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/config-access.js
68085
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/config-access.js
68076
68086
  function stringArray(value) {
68077
68087
  return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : undefined;
68078
68088
  }
@@ -68110,7 +68120,7 @@ function parseInlineFlags(source) {
68110
68120
  return { flags, rest: source.slice(match[0].length) };
68111
68121
  }
68112
68122
 
68113
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/glob-match.js
68123
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/glob-match.js
68114
68124
  function matchesAny(path9, patterns) {
68115
68125
  if (patterns === undefined || patterns.length === 0)
68116
68126
  return true;
@@ -68158,7 +68168,7 @@ function escapeRegExp(value) {
68158
68168
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
68159
68169
  }
68160
68170
 
68161
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-discovery.js
68171
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-discovery.js
68162
68172
  async function discoverFiles2(options) {
68163
68173
  const fs3 = options.fs ?? createNodeFileSystem3();
68164
68174
  const allFiles = await walkDir2(options.workdir, fs3, DEFAULT_EXCLUDES);
@@ -68189,12 +68199,12 @@ var init_file_discovery = __esm(() => {
68189
68199
  DEFAULT_EXCLUDES = new Set([".git", "node_modules", "dist", ".coverage", ".astro", ".wrangler"]);
68190
68200
  });
68191
68201
 
68192
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-utils.js
68202
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/file-utils.js
68193
68203
  var init_file_utils = __esm(() => {
68194
68204
  init_file_discovery();
68195
68205
  });
68196
68206
 
68197
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/agent-detection-evaluator.js
68207
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/agent-detection-evaluator.js
68198
68208
  class AgentDetectionEvaluator {
68199
68209
  detector;
68200
68210
  constructor(detector = new AgentDetector) {
@@ -68222,7 +68232,7 @@ var init_agent_detection_evaluator = __esm(() => {
68222
68232
  init_file_utils();
68223
68233
  });
68224
68234
 
68225
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/coverage-gate-evaluator.js
68235
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/coverage-gate-evaluator.js
68226
68236
  class CoverageGateEvaluator {
68227
68237
  constructor() {}
68228
68238
  async evaluate(rule, context4) {
@@ -68306,7 +68316,7 @@ var init_coverage_gate_evaluator = __esm(() => {
68306
68316
  init_file_utils();
68307
68317
  });
68308
68318
 
68309
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/exit-code-evaluator.js
68319
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/exit-code-evaluator.js
68310
68320
  class ExitCodeEvaluator {
68311
68321
  executor;
68312
68322
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -68342,7 +68352,7 @@ var init_exit_code_evaluator = __esm(() => {
68342
68352
  init_file_utils();
68343
68353
  });
68344
68354
 
68345
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/forbidden-import-evaluator.js
68355
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/forbidden-import-evaluator.js
68346
68356
  class ForbiddenImportEvaluator {
68347
68357
  constructor() {}
68348
68358
  async evaluate(rule, context4) {
@@ -68423,7 +68433,7 @@ var init_forbidden_import_evaluator = __esm(() => {
68423
68433
  init_file_utils();
68424
68434
  });
68425
68435
 
68426
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/import-boundary-evaluator.js
68436
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/import-boundary-evaluator.js
68427
68437
  class ImportBoundaryEvaluator {
68428
68438
  async evaluate(rule, context4) {
68429
68439
  const config4 = rule.evaluator.config ?? {};
@@ -68516,7 +68526,7 @@ var init_import_boundary_evaluator = __esm(() => {
68516
68526
  init_file_utils();
68517
68527
  });
68518
68528
 
68519
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/path-evaluator.js
68529
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/path-evaluator.js
68520
68530
  class PathEvaluator {
68521
68531
  constructor() {}
68522
68532
  async evaluate(rule, context4) {
@@ -68577,7 +68587,7 @@ var init_path_evaluator = __esm(() => {
68577
68587
  init_file_utils();
68578
68588
  });
68579
68589
 
68580
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/regex-evaluator.js
68590
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/regex-evaluator.js
68581
68591
  class RegexEvaluator {
68582
68592
  constructor() {}
68583
68593
  async evaluate(rule, context4) {
@@ -68655,7 +68665,7 @@ var init_regex_evaluator = __esm(() => {
68655
68665
  init_file_utils();
68656
68666
  });
68657
68667
 
68658
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/ripgrep-evaluator.js
68668
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/ripgrep-evaluator.js
68659
68669
  class RipgrepEvaluator {
68660
68670
  executor;
68661
68671
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -68748,7 +68758,7 @@ var init_ripgrep_evaluator = __esm(() => {
68748
68758
  init_file_utils();
68749
68759
  });
68750
68760
 
68751
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/schema-artifact-evaluator.js
68761
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/schema-artifact-evaluator.js
68752
68762
  class SchemaArtifactEvaluator {
68753
68763
  constructor() {}
68754
68764
  async evaluate(rule, context4) {
@@ -68826,7 +68836,7 @@ var init_schema_artifact_evaluator = __esm(() => {
68826
68836
  init_file_utils();
68827
68837
  });
68828
68838
 
68829
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/secrets-scanner-evaluator.js
68839
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/secrets-scanner-evaluator.js
68830
68840
  class SecretsScannerEvaluator {
68831
68841
  constructor() {}
68832
68842
  async evaluate(rule, context4) {
@@ -68894,7 +68904,7 @@ var init_secrets_scanner_evaluator = __esm(() => {
68894
68904
  ALL_CATEGORIES = Object.keys(BUILTIN_PATTERNS);
68895
68905
  });
68896
68906
 
68897
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/sg-evaluator.js
68907
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/sg-evaluator.js
68898
68908
  class SgEvaluator {
68899
68909
  executor;
68900
68910
  constructor(executor = nodeBunFactory3.createProcessExecutor()) {
@@ -68991,7 +69001,7 @@ var init_sg_evaluator = __esm(() => {
68991
69001
  init_file_utils();
68992
69002
  });
68993
69003
 
68994
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/resolvers/test-path-resolver.js
69004
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/resolvers/test-path-resolver.js
68995
69005
  class TypeScriptTestPathResolver {
68996
69006
  name = "typescript";
68997
69007
  constructor() {}
@@ -69074,7 +69084,7 @@ function testify(rel) {
69074
69084
  return `${dir}test_${base2}`;
69075
69085
  }
69076
69086
 
69077
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/test-location-evaluator.js
69087
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/test-location-evaluator.js
69078
69088
  class TestLocationEvaluator {
69079
69089
  resolvers;
69080
69090
  constructor(resolvers) {
@@ -69149,7 +69159,7 @@ var init_test_location_evaluator = __esm(() => {
69149
69159
  TYPESCRIPT_FALLBACK = new TypeScriptTestPathResolver;
69150
69160
  });
69151
69161
 
69152
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/tsdoc-export-evaluator.js
69162
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/evaluators/tsdoc-export-evaluator.js
69153
69163
  class TsdocExportEvaluator {
69154
69164
  constructor() {}
69155
69165
  async evaluate(rule, context4) {
@@ -69234,7 +69244,7 @@ var init_tsdoc_export_evaluator = __esm(() => {
69234
69244
  };
69235
69245
  });
69236
69246
 
69237
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/json.js
69247
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/json.js
69238
69248
  class JsonFormatter {
69239
69249
  constructor() {}
69240
69250
  format(result) {
@@ -69242,7 +69252,7 @@ class JsonFormatter {
69242
69252
  }
69243
69253
  }
69244
69254
 
69245
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/text.js
69255
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/formatters/text.js
69246
69256
  class TextFormatter {
69247
69257
  constructor() {}
69248
69258
  format(result) {
@@ -69256,7 +69266,7 @@ class TextFormatter {
69256
69266
  }
69257
69267
  }
69258
69268
 
69259
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/builtins.js
69269
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/builtins.js
69260
69270
  function registerBuiltins(host, executor) {
69261
69271
  const path9 = new PathEvaluator;
69262
69272
  host.evaluators.register("regex", new RegexEvaluator, "builtin");
@@ -69296,7 +69306,7 @@ var init_builtins = __esm(() => {
69296
69306
  init_tsdoc_export_evaluator();
69297
69307
  });
69298
69308
 
69299
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/rule-engine-host.js
69309
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/rule-engine-host.js
69300
69310
  class RuleEngineHost {
69301
69311
  evaluators;
69302
69312
  formatters;
@@ -69313,7 +69323,7 @@ var init_rule_engine_host = __esm(() => {
69313
69323
  init_extension2();
69314
69324
  });
69315
69325
 
69316
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/engine.js
69326
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/engine.js
69317
69327
  class RuleEngine {
69318
69328
  host;
69319
69329
  events;
@@ -69499,7 +69509,7 @@ var init_engine = __esm(() => {
69499
69509
  init_types3();
69500
69510
  });
69501
69511
 
69502
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/bundled-rules.js
69512
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/host/bundled-rules.js
69503
69513
  async function bundledRulesRoot() {
69504
69514
  if (cachedRoot2 !== undefined)
69505
69515
  return cachedRoot2;
@@ -69550,7 +69560,7 @@ var init_bundled_rules = __esm(() => {
69550
69560
  init_dist5();
69551
69561
  });
69552
69562
 
69553
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/db-adapter.js
69563
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/db-adapter.js
69554
69564
  class DbRulePersistenceAdapter {
69555
69565
  db;
69556
69566
  constructor(db2) {
@@ -69584,7 +69594,7 @@ class DbRulePersistenceAdapter {
69584
69594
  }
69585
69595
  }
69586
69596
 
69587
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/schema.js
69597
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/schema.js
69588
69598
  var RULE_ENGINE_SCHEMA_SQL = `
69589
69599
  CREATE TABLE IF NOT EXISTS rule_runs (
69590
69600
  id TEXT PRIMARY KEY,
@@ -69630,10 +69640,10 @@ CREATE TABLE IF NOT EXISTS rule_eval_runs (
69630
69640
  CREATE INDEX IF NOT EXISTS idx_rule_eval_runs_run_id ON rule_eval_runs (run_id);
69631
69641
  `;
69632
69642
 
69633
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/index.js
69643
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/persistence/index.js
69634
69644
  var init_persistence2 = () => {};
69635
69645
 
69636
- // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.5+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/index.js
69646
+ // ../../node_modules/.bun/@gobing-ai+ts-rule-engine@0.5.7+df32fe902834add3/node_modules/@gobing-ai/ts-rule-engine/dist/index.js
69637
69647
  var init_dist11 = __esm(() => {
69638
69648
  init_extensions2();
69639
69649
  init_loader2();
@@ -69770,6 +69780,7 @@ async function applyCliMigrations(adapter, migrations = CLI_MIGRATIONS) {
69770
69780
  const queueJobsActiveIndexSkip = migration.id === "0027_spur_cli_history_refresh_active_unique" && !await tableExists(adapter, "queue_jobs");
69771
69781
  const schedulerCustomActiveIndexSkip = migration.id === "0047_spur_cli_scheduler_custom_active_unique" && !await tableExists(adapter, "queue_jobs");
69772
69782
  const queueJobsDeadlineLeaseSkip = migration.id === "0041_spur_cli_queue_jobs_deadline_lease_columns" && !await tableExists(adapter, "queue_jobs");
69783
+ const runsTerminalReasonSkip = migration.id === "0049_spur_cli_runs_terminal_reason" && !await tableExists(adapter, "runs");
69773
69784
  const inboxRequestKeySkip = migration.id === "0043_spur_cli_inbox_messages_request_key" && !await tableExists(adapter, "inbox_messages");
69774
69785
  const coordinationReceiptColumnsSkip = migration.id === "0044_spur_cli_coordination_runs_receipt_columns" && !await tableExists(adapter, "coordination_runs");
69775
69786
  const historyToolIdentitySkip = migration.id === "0034_spur_cli_history_tool_identity" && !await tableExists(adapter, "history_tool_call");
@@ -69777,7 +69788,7 @@ async function applyCliMigrations(adapter, migrations = CLI_MIGRATIONS) {
69777
69788
  const historyRollupWatermarkSkip = migration.id === "0036_spur_cli_history_rollup_watermark" && (await tableExists(adapter, "history_board_rollup_watermark") || !await tableExists(adapter, "history_message") || !await columnExists(adapter, "history_message", "imported_at"));
69778
69789
  const boundedRollupDerivationsSkip = migration.id === "0039_spur_cli_bounded_rollup_derivations" && (!await tableExists(adapter, "history_message") || !await columnExists(adapter, "history_message", "source_file") || !await tableExists(adapter, "history_board_source_daily"));
69779
69790
  const historyModelFallbackIndexSkip = migration.id === "0042_spur_cli_history_model_fallback_index" && (!await tableExists(adapter, "history_message") || !await columnExists(adapter, "history_message", "model"));
69780
- if (shouldApplySql && !sequenceIndexSkip && !argsRawSkip && !runsStatusDoneSkip && !nameOccurredIndexSkip && !historyBoardQueryIndexesSkip && !historyPerformanceIndexesSkip && !historyToolCallIndexesSkip && !historyBoardCoveringIndexesSkip && !historyBoardToolStatsColumnsSkip && !callIdSkip && !tsNullableSkip && !queueJobsActiveIndexSkip && !schedulerCustomActiveIndexSkip && !queueJobsDeadlineLeaseSkip && !inboxRequestKeySkip && !coordinationReceiptColumnsSkip && !historyToolIdentitySkip && !historyMeasureVectorSkip && !historyRollupWatermarkSkip && !boundedRollupDerivationsSkip && !historyModelFallbackIndexSkip) {
69791
+ if (shouldApplySql && !sequenceIndexSkip && !argsRawSkip && !runsStatusDoneSkip && !nameOccurredIndexSkip && !historyBoardQueryIndexesSkip && !historyPerformanceIndexesSkip && !historyToolCallIndexesSkip && !historyBoardCoveringIndexesSkip && !historyBoardToolStatsColumnsSkip && !callIdSkip && !tsNullableSkip && !queueJobsActiveIndexSkip && !schedulerCustomActiveIndexSkip && !queueJobsDeadlineLeaseSkip && !runsTerminalReasonSkip && !inboxRequestKeySkip && !coordinationReceiptColumnsSkip && !historyToolIdentitySkip && !historyMeasureVectorSkip && !historyRollupWatermarkSkip && !boundedRollupDerivationsSkip && !historyModelFallbackIndexSkip) {
69781
69792
  for (const statement of splitSqlStatements(migration.sql)) {
69782
69793
  await adapter.exec(statement);
69783
69794
  }
@@ -69992,6 +70003,8 @@ ALTER TABLE agent_executor_updates ADD COLUMN owner TEXT;
69992
70003
  ALTER TABLE agent_executor_updates ADD COLUMN layer TEXT;
69993
70004
  ALTER TABLE agent_executor_updates ADD COLUMN skipped_reason TEXT;
69994
70005
  UPDATE agent_executor_updates SET owner = 'quota', layer = 'project' WHERE owner IS NULL;
70006
+ `, CLI_RUNS_TERMINAL_REASON_SCHEMA_SQL = `
70007
+ ALTER TABLE runs ADD COLUMN terminal_reason TEXT;
69995
70008
  `, PROJECT_CLAIMS_SCHEMA_SQL = `
69996
70009
  CREATE TABLE IF NOT EXISTS project_claims (
69997
70010
  project_path TEXT NOT NULL,
@@ -70777,11 +70790,16 @@ ${HISTORY_TASK_SESSION_SCHEMA_SQL}
70777
70790
  id: "0048_spur_cli_agent_executor_updates_owner_columns",
70778
70791
  sql: AGENT_EXECUTOR_UPDATES_OWNER_COLUMNS_SCHEMA_SQL,
70779
70792
  addColumnIfMissing: { table: "agent_executor_updates", column: "owner" }
70793
+ },
70794
+ {
70795
+ id: "0049_spur_cli_runs_terminal_reason",
70796
+ sql: CLI_RUNS_TERMINAL_REASON_SCHEMA_SQL,
70797
+ addColumnIfMissing: { table: "runs", column: "terminal_reason" }
70780
70798
  }
70781
70799
  ];
70782
70800
  });
70783
70801
 
70784
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/job-queue/db-job-queue.js
70802
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/job-queue/db-job-queue.js
70785
70803
  function queueLogger() {
70786
70804
  if (!_queueLogger)
70787
70805
  _queueLogger = getLogger2("job-queue");
@@ -71203,7 +71221,7 @@ var init_db_job_queue = __esm(() => {
71203
71221
  init_tracing2();
71204
71222
  });
71205
71223
 
71206
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/job-queue-db.js
71224
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/job-queue-db.js
71207
71225
  var exports_job_queue_db = {};
71208
71226
  __export(exports_job_queue_db, {
71209
71227
  DBQueueConsumer: () => DBQueueConsumer,
@@ -74458,6 +74476,53 @@ var init_agent_execution = __esm(() => {
74458
74476
  SECRET_PATTERN = /(?:sk-[a-z0-9_-]{8,}|(?:api[_-]?key|token|secret|password)\s*[:=]\s*\S+|bearer\s+\S+)/gi;
74459
74477
  });
74460
74478
 
74479
+ // ../../packages/app/src/workflow/terminal-reason.ts
74480
+ function isTerminalReason(value) {
74481
+ return TERMINAL_REASONS.includes(value);
74482
+ }
74483
+ function isBookkeepingWorkflow(workflowName) {
74484
+ return BOOKKEEPING_WORKFLOWS.includes(workflowName);
74485
+ }
74486
+ function classifyTerminalReason({
74487
+ status,
74488
+ engineReason,
74489
+ actionKind,
74490
+ errorText
74491
+ }) {
74492
+ if (engineReason !== undefined && engineReason !== null && isTerminalReason(engineReason))
74493
+ return engineReason;
74494
+ if (status === "interrupted")
74495
+ return "interrupted";
74496
+ if (status === "paused")
74497
+ return "paused-operator";
74498
+ if (status === "done")
74499
+ return "done";
74500
+ if (engineReason === "no-passing-transition" || engineReason === "no-passing-edge")
74501
+ return "failed-guard";
74502
+ if (engineReason === "iteration-bound-exceeded")
74503
+ return "retry-exhausted";
74504
+ if (errorText !== undefined && errorText !== null && /timeout/i.test(errorText))
74505
+ return "failed-timeout";
74506
+ if (actionKind === "agent.run")
74507
+ return "failed-agent";
74508
+ return "failed-check";
74509
+ }
74510
+ var TERMINAL_REASONS, BOOKKEEPING_WORKFLOWS;
74511
+ var init_terminal_reason = __esm(() => {
74512
+ TERMINAL_REASONS = [
74513
+ "done",
74514
+ "paused-operator",
74515
+ "failed-check",
74516
+ "failed-agent",
74517
+ "failed-timeout",
74518
+ "failed-guard",
74519
+ "cancelled",
74520
+ "interrupted",
74521
+ "retry-exhausted"
74522
+ ];
74523
+ BOOKKEEPING_WORKFLOWS = ["task-lifecycle", "feature-lifecycle"];
74524
+ });
74525
+
74461
74526
  // ../../packages/app/src/workflow/observability.ts
74462
74527
  function createWorkflowEventIdentity(def) {
74463
74528
  const nodeLabels = new Map;
@@ -74577,8 +74642,8 @@ class ObservableWorkflowAdapter {
74577
74642
  workflowName: record3.workflow_name
74578
74643
  });
74579
74644
  }
74580
- async finalizeRun(runId, status, completedAt) {
74581
- await this.inner.finalizeRun(runId, status, completedAt);
74645
+ async finalizeRun(runId, status, completedAt, fence, reason) {
74646
+ await this.inner.finalizeRun(runId, status, completedAt, fence, reason === undefined ? undefined : classifyTerminalReason({ status, engineReason: reason, errorText: reason }));
74582
74647
  await this.bus.emit("workflow.run.finalized", {
74583
74648
  ...this.envelope(runId, completedAt),
74584
74649
  status,
@@ -74687,6 +74752,7 @@ class ObservableWorkflowAdapter {
74687
74752
  }
74688
74753
  var now = () => new Date().toISOString(), MAX_FIELD_LENGTH = 256, SECRET_PATTERN2;
74689
74754
  var init_observability = __esm(() => {
74755
+ init_terminal_reason();
74690
74756
  SECRET_PATTERN2 = /(?:sk-[a-z0-9_-]{8,}|(?:api[_-]?key|token|secret|password)\s*[:=]\s*\S+|bearer\s+\S+)/gi;
74691
74757
  });
74692
74758
 
@@ -76028,8 +76094,8 @@ class WorkflowActionTraceWriter {
76028
76094
  await this.guard("action.finish", { runId: origin2?.runId ?? "", node: origin2?.node, kind }, () => this.inner.saveActionFinalize(actionId, status, durationMs, ok, kind, result, redactor));
76029
76095
  this.boundaries.delete(actionId);
76030
76096
  }
76031
- async finalizeRun(runId, status, completedAt) {
76032
- await this.inner.finalizeRun(runId, status, completedAt);
76097
+ async finalizeRun(runId, status, completedAt, fence, reason) {
76098
+ await this.inner.finalizeRun(runId, status, completedAt, fence, reason === undefined ? undefined : classifyTerminalReason({ status, engineReason: reason, errorText: reason }));
76033
76099
  }
76034
76100
  async claimRunOwnership(runId, owner, expectedStatuses) {
76035
76101
  return this.inner.claimRunOwnership(runId, owner, expectedStatuses);
@@ -76060,12 +76126,12 @@ class WorkflowActionTraceWriter {
76060
76126
  await dao2.setStartedAt(actionId, startedAt);
76061
76127
  });
76062
76128
  }
76063
- async closeRun(runId, status, completedAt) {
76129
+ async closeRun(runId, status, completedAt, reason) {
76064
76130
  const existing = await this.inner.loadRun(runId);
76065
76131
  if (existing === undefined) {
76066
76132
  throw new RunRowNotFoundError(runId);
76067
76133
  }
76068
- await this.inner.finalizeRun(runId, status, completedAt ?? new Date().toISOString());
76134
+ await this.inner.finalizeRun(runId, status, completedAt ?? new Date().toISOString(), undefined, reason === undefined ? undefined : classifyTerminalReason({ status, engineReason: reason, errorText: reason }));
76069
76135
  return { ok: true };
76070
76136
  }
76071
76137
  async guard(operation, context4, emit) {
@@ -76156,6 +76222,7 @@ var init_action_trace = __esm(() => {
76156
76222
  init_src2();
76157
76223
  init_dist8();
76158
76224
  init_dist5();
76225
+ init_terminal_reason();
76159
76226
  RunRowNotFoundError = class RunRowNotFoundError extends Error {
76160
76227
  runId;
76161
76228
  constructor(runId) {
@@ -76669,6 +76736,161 @@ var init_decision_hitl_responder = __esm(() => {
76669
76736
  DECISION_KEYS = ["mode", "statusVar", "evidenceNodes", "summaryArtifact"];
76670
76737
  });
76671
76738
 
76739
+ // ../../packages/app/src/workflow/decide.ts
76740
+ async function runDecide(options, deps) {
76741
+ const started = deps.now();
76742
+ const base2 = { schemaVersion: 1, id: options.id, method: options.method };
76743
+ const degraded = (reason, backend = null, confidence = null, evidenceDigest2 = null) => ({
76744
+ ...base2,
76745
+ value: options.default,
76746
+ backend,
76747
+ confidence,
76748
+ degraded: true,
76749
+ reason,
76750
+ evidenceDigest: evidenceDigest2,
76751
+ durationMs: deps.now() - started
76752
+ });
76753
+ if (!deps.enabled)
76754
+ return degraded("disabled");
76755
+ let maker;
76756
+ try {
76757
+ maker = deps.decisionMaker ? await deps.decisionMaker() : await defaultDecisionMaker();
76758
+ } catch {
76759
+ return degraded("no-backend");
76760
+ }
76761
+ let evidence = [];
76762
+ let evidenceDigest = null;
76763
+ if (options.evidence !== undefined && options.evidence.length > 0) {
76764
+ try {
76765
+ evidence = await Promise.all(options.evidence.map(async (path9) => redactAndBound(await deps.readFile(path9), [], DECIDE_EVIDENCE_MAX_CHARS)));
76766
+ evidenceDigest = evidencePayloadDigest(evidence);
76767
+ } catch {
76768
+ return degraded("error");
76769
+ }
76770
+ }
76771
+ const state = { id: options.id, evidence };
76772
+ const minConfidence = options.minConfidence ?? DEFAULT_MIN_CONFIDENCE;
76773
+ try {
76774
+ if (options.method === "choice") {
76775
+ const labels = Object.fromEntries((options.choices ?? []).map((c3) => [c3, c3]));
76776
+ const answer2 = await maker.choice(state, options.question, labels);
76777
+ if (!(answer2.label in labels)) {
76778
+ return degraded("error", maker.driver, answer2.confidence, evidenceDigest);
76779
+ }
76780
+ if (answer2.confidence < minConfidence) {
76781
+ return degraded("low-confidence", maker.driver, answer2.confidence, evidenceDigest);
76782
+ }
76783
+ return {
76784
+ ...base2,
76785
+ value: answer2.label,
76786
+ backend: maker.driver,
76787
+ confidence: answer2.confidence,
76788
+ degraded: false,
76789
+ reason: "accepted",
76790
+ evidenceDigest,
76791
+ durationMs: deps.now() - started
76792
+ };
76793
+ }
76794
+ const answer = await maker.noul(state, options.question);
76795
+ const confidence = answer.probability;
76796
+ if (confidence < minConfidence) {
76797
+ return degraded("low-confidence", maker.driver, confidence, evidenceDigest);
76798
+ }
76799
+ return {
76800
+ ...base2,
76801
+ value: confidence >= NOUL_YES_THRESHOLD ? "yes" : "no",
76802
+ backend: maker.driver,
76803
+ confidence,
76804
+ degraded: false,
76805
+ reason: "accepted",
76806
+ evidenceDigest,
76807
+ durationMs: deps.now() - started
76808
+ };
76809
+ } catch (error51) {
76810
+ return degraded(error51 instanceof DecisionTimeoutError ? "timeout" : "error", maker.driver, null, evidenceDigest);
76811
+ }
76812
+ }
76813
+ var DEFAULT_MIN_CONFIDENCE = 0.8, NOUL_YES_THRESHOLD = 0.5, DECIDE_EVIDENCE_MAX_CHARS = 2000;
76814
+ var init_decide = __esm(() => {
76815
+ init_dist10();
76816
+ init_agent_execution();
76817
+ init_decision_evidence();
76818
+ init_decision_hitl_responder();
76819
+ });
76820
+
76821
+ // ../../packages/app/src/workflow/actions/decide.ts
76822
+ import { join as join13 } from "path";
76823
+
76824
+ class DecideActionRunner {
76825
+ fileSystem;
76826
+ deps;
76827
+ kind = DECIDE_KIND;
76828
+ constructor(fileSystem, deps) {
76829
+ this.fileSystem = fileSystem;
76830
+ this.deps = deps;
76831
+ }
76832
+ async execute(rawOptions, context4) {
76833
+ const parsed = DecideOptionsSchema.safeParse(rawOptions);
76834
+ if (!parsed.success) {
76835
+ return {
76836
+ ok: false,
76837
+ error: `${DECIDE_KIND}: invalid options \u2014 ${parsed.error.issues.map((i2) => i2.message).join("; ")}`
76838
+ };
76839
+ }
76840
+ const options = parsed.data;
76841
+ const workdir = context4.workdir ?? ".";
76842
+ const result = await runDecide({
76843
+ ...options,
76844
+ ...options.evidence !== undefined ? { evidence: options.evidence.map((path9) => join13(workdir, path9)) } : {},
76845
+ resultFile: join13(workdir, options.resultFile)
76846
+ }, {
76847
+ enabled: this.deps.enabled,
76848
+ ...this.deps.decisionMaker !== undefined ? { decisionMaker: this.deps.decisionMaker } : {},
76849
+ readFile: async (path9) => await this.fileSystem.readFile(path9),
76850
+ now: Date.now.bind(Date)
76851
+ });
76852
+ await this.fileSystem.writeFile(join13(workdir, options.resultFile), `${JSON.stringify(result, null, 2)}
76853
+ `);
76854
+ return { ok: true, data: { value: result.value, decision: result } };
76855
+ }
76856
+ }
76857
+ var DECIDE_KIND = "decide", DecideOptionsSchema;
76858
+ var init_decide2 = __esm(() => {
76859
+ init_zod();
76860
+ init_decide();
76861
+ DecideOptionsSchema = exports_external.object({
76862
+ id: exports_external.string().min(1),
76863
+ method: exports_external.enum(["choice", "noul"]),
76864
+ question: exports_external.string().min(1),
76865
+ choices: exports_external.array(exports_external.string().min(1)).min(2).optional(),
76866
+ evidence: exports_external.array(exports_external.string().min(1)).optional(),
76867
+ default: exports_external.string().min(1),
76868
+ minConfidence: exports_external.number().min(0).max(1).optional(),
76869
+ resultFile: exports_external.string().min(1)
76870
+ }).strict().superRefine((options, ctx) => {
76871
+ if (options.method === "choice") {
76872
+ if (options.choices === undefined) {
76873
+ ctx.addIssue({ code: "custom", message: "choices is required for method choice (at least 2 labels)" });
76874
+ } else if (!options.choices.includes(options.default)) {
76875
+ ctx.addIssue({
76876
+ code: "custom",
76877
+ message: `default "${options.default}" is not one of choices [${options.choices.join(", ")}]`
76878
+ });
76879
+ }
76880
+ return;
76881
+ }
76882
+ if (options.choices !== undefined) {
76883
+ ctx.addIssue({
76884
+ code: "custom",
76885
+ message: "choices is only valid for method choice; noul uses the engine yes/no outcomes"
76886
+ });
76887
+ }
76888
+ if (options.default !== "yes" && options.default !== "no") {
76889
+ ctx.addIssue({ code: "custom", message: 'default must be "yes" or "no" for method noul' });
76890
+ }
76891
+ });
76892
+ });
76893
+
76672
76894
  // ../../packages/app/src/workflow/actions/hitl-select.ts
76673
76895
  class HitlSelectActionRunner {
76674
76896
  responder;
@@ -76757,7 +76979,7 @@ var init_hitl_select = __esm(() => {
76757
76979
  });
76758
76980
 
76759
76981
  // ../../packages/app/src/workflow/actions/run-path.ts
76760
- import { dirname as dirname9, join as join13, normalize, relative, resolve as resolve4, sep } from "path";
76982
+ import { dirname as dirname9, join as join14, normalize, relative, resolve as resolve4, sep } from "path";
76761
76983
  function within(child, ancestor) {
76762
76984
  return child === ancestor || child.startsWith(`${ancestor}${sep}`);
76763
76985
  }
@@ -76766,7 +76988,7 @@ async function resolveRunArtifactPath(fileSystem, workdir, pathRaw) {
76766
76988
  throw new RunArtifactPathError("physical path confinement requires a FileSystem with realPath support \u2014 refusing to skip confinement (0785 R2)");
76767
76989
  }
76768
76990
  const lexicalTarget = normalize(resolve4(workdir, pathRaw));
76769
- const lexicalRunRoot = normalize(join13(resolve4(workdir), ".spur", "run"));
76991
+ const lexicalRunRoot = normalize(join14(resolve4(workdir), ".spur", "run"));
76770
76992
  if (!lexicalTarget.startsWith(`${lexicalRunRoot}${sep}`)) {
76771
76993
  throw new RunArtifactPathError(`must resolve beneath .spur/run/ (got ${pathRaw})`);
76772
76994
  }
@@ -76777,7 +76999,7 @@ async function resolveRunArtifactPath(fileSystem, workdir, pathRaw) {
76777
76999
  } catch (error51) {
76778
77000
  throw new RunArtifactPathError(`project workdir could not be canonicalized: ${error51.message}`);
76779
77001
  }
76780
- const canonicalRunRootCandidate = join13(canonicalWorkdir, ".spur", "run");
77002
+ const canonicalRunRootCandidate = join14(canonicalWorkdir, ".spur", "run");
76781
77003
  let canonicalRunRoot = canonicalRunRootCandidate;
76782
77004
  const rootStat = await fileSystem.stat(canonicalRunRootCandidate);
76783
77005
  if (rootStat !== null) {
@@ -76825,7 +77047,7 @@ async function resolveRunArtifactPath(fileSystem, workdir, pathRaw) {
76825
77047
  if (!within(anchor, canonicalWorkdir)) {
76826
77048
  throw new RunArtifactPathError(`ancestor ${probe} escapes the project workdir through a symlink`);
76827
77049
  }
76828
- const reconstructed = normalize(join13(anchor, relative(probe, lexicalTarget)));
77050
+ const reconstructed = normalize(join14(anchor, relative(probe, lexicalTarget)));
76829
77051
  if (!reconstructed.startsWith(`${canonicalRunRoot}${sep}`)) {
76830
77052
  throw new RunArtifactPathError(`path escapes .spur/run/ through a symlink (got ${pathRaw})`);
76831
77053
  }
@@ -76980,6 +77202,133 @@ var init_task_locator = __esm(() => {
76980
77202
  TASK_FILENAME_RE = /^(\d{4})_(.+)\.md$/;
76981
77203
  });
76982
77204
 
77205
+ // ../../packages/app/src/workflow/fleet-dispatch.ts
77206
+ function hasReusableSession(member) {
77207
+ return member.session !== undefined && member.session.mode !== "one-shot";
77208
+ }
77209
+ async function waitForFileExists(path9, timeoutMs) {
77210
+ const fs3 = createNodeFileSystem3();
77211
+ const deadline = Date.now() + timeoutMs;
77212
+ for (;; ) {
77213
+ if (await fs3.exists(path9))
77214
+ return true;
77215
+ if (Date.now() >= deadline)
77216
+ return false;
77217
+ await new Promise((resolve5) => setTimeout(resolve5, POLL_INTERVAL_MS));
77218
+ }
77219
+ }
77220
+ function fleetUnavailableOutcome(reason, executorFallback) {
77221
+ if (executorFallback === "traditional")
77222
+ return { mode: "fallback", fallbackReason: reason };
77223
+ return { mode: "fail", error: `agent.run: fleet executor unavailable \u2014 ${reason} (terminal reason: failed-agent)` };
77224
+ }
77225
+ async function dispatchToFleet(input, deps) {
77226
+ let declaration;
77227
+ let resolved;
77228
+ try {
77229
+ declaration = await deps.fleet.load(input.projectPath);
77230
+ resolved = await deps.fleet.resolve(input.projectPath);
77231
+ } catch (error51) {
77232
+ return { status: "unavailable", reason: `fleet resolution failed: ${error51.message}` };
77233
+ }
77234
+ if (declaration === null) {
77235
+ return {
77236
+ status: "unavailable",
77237
+ reason: `no agent.fleet declaration at ${input.projectPath} (agent.fleet.enabled is false by default)`
77238
+ };
77239
+ }
77240
+ if (!declaration.enabled) {
77241
+ return { status: "unavailable", reason: "fleet is disabled (agent.fleet.enabled: false)" };
77242
+ }
77243
+ const candidates = resolved.members.filter((member2) => member2.enabled && member2.role === input.role);
77244
+ if (candidates.length === 0) {
77245
+ const memberIds = resolved.members.map((m) => m.instanceId).join(", ") || "none";
77246
+ const missing = resolved.missing.join(", ") || "none";
77247
+ return {
77248
+ status: "unavailable",
77249
+ reason: `no enabled fleet member for role '${input.role}' (members: ${memberIds}; missing: ${missing})`
77250
+ };
77251
+ }
77252
+ let pool = candidates;
77253
+ if (FRESH_SESSION_ROLES.includes(input.role)) {
77254
+ const fresh = candidates.filter((member2) => !hasReusableSession(member2));
77255
+ if (fresh.length === 0) {
77256
+ const carrying = candidates.map((m) => `${m.instanceId}:${m.session?.mode ?? "unknown"}`).join(", ");
77257
+ return {
77258
+ status: "unavailable",
77259
+ reason: `ADR-121: role '${input.role}' requires a fresh member session per dispatch and every candidate carries a reused session (${carrying}) \u2014 reset the member session or declare an idle member`
77260
+ };
77261
+ }
77262
+ pool = fresh;
77263
+ }
77264
+ const member = declaration.strategy === "gtd" ? [...pool].sort((a2, b) => Number(hasReusableSession(a2)) - Number(hasReusableSession(b)))[0] : pool[0];
77265
+ if (member === undefined) {
77266
+ return { status: "unavailable", reason: `no enabled fleet member for role '${input.role}'` };
77267
+ }
77268
+ const fs3 = createNodeFileSystem3(input.projectPath);
77269
+ const promptPath = fs3.resolve(".spur", "run", input.runId, "prompts", `${input.state}.md`);
77270
+ const expectFileAbs = input.expectFile !== undefined ? fs3.resolve(input.expectFile) : undefined;
77271
+ const startedAt = deps.now();
77272
+ try {
77273
+ await fs3.writeFile(promptPath, input.prompt);
77274
+ } catch (error51) {
77275
+ return {
77276
+ status: "unavailable",
77277
+ reason: `prompt artifact write failed at ${promptPath}: ${error51.message}`
77278
+ };
77279
+ }
77280
+ const body = [
77281
+ "[spur fleet dispatch \u2014 agent.run]",
77282
+ `run: ${input.runId}`,
77283
+ `state: ${input.state}`,
77284
+ `role: ${input.role}`,
77285
+ `prompt artifact: ${promptPath}`,
77286
+ `expectFile: ${expectFileAbs ?? "(none declared)"}`,
77287
+ "",
77288
+ "Read your task prompt from the prompt artifact above.",
77289
+ ...expectFileAbs !== undefined ? [
77290
+ `On completion, write your result artifact to the expectFile path above; the dispatch wait ends when it exists.`
77291
+ ] : [],
77292
+ ""
77293
+ ].join(`
77294
+ `);
77295
+ let send;
77296
+ try {
77297
+ send = await deps.coordination.sendMessage(null, member.instanceId, body, undefined, `${input.runId}/${input.state}`);
77298
+ } catch (error51) {
77299
+ return {
77300
+ status: "unavailable",
77301
+ reason: `message send to member '${member.instanceId}' failed: ${error51.message}`
77302
+ };
77303
+ }
77304
+ const durationMs = deps.now() - startedAt;
77305
+ if (expectFileAbs === undefined) {
77306
+ return { status: "dispatched", memberId: member.instanceId, messageId: send.msgId, durationMs, promptPath };
77307
+ }
77308
+ const appeared = await deps.waitForFile(expectFileAbs, input.timeoutMs ?? Number.POSITIVE_INFINITY);
77309
+ if (!appeared) {
77310
+ return {
77311
+ status: "timeout",
77312
+ memberId: member.instanceId,
77313
+ messageId: send.msgId,
77314
+ durationMs: deps.now() - startedAt,
77315
+ expectFile: expectFileAbs
77316
+ };
77317
+ }
77318
+ return {
77319
+ status: "dispatched",
77320
+ memberId: member.instanceId,
77321
+ messageId: send.msgId,
77322
+ durationMs: deps.now() - startedAt,
77323
+ promptPath
77324
+ };
77325
+ }
77326
+ var FRESH_SESSION_ROLES, POLL_INTERVAL_MS = 100;
77327
+ var init_fleet_dispatch = __esm(() => {
77328
+ init_dist5();
77329
+ FRESH_SESSION_ROLES = ["reviewer"];
77330
+ });
77331
+
76983
77332
  // ../../packages/app/src/workflow/steering.ts
76984
77333
  class WorkflowSteeringController {
76985
77334
  onAck;
@@ -77285,7 +77634,7 @@ var init_tripwire = __esm(() => {
77285
77634
 
77286
77635
  // ../../packages/app/src/workflow/actions/agent-run.ts
77287
77636
  import { tmpdir } from "os";
77288
- import { dirname as dirname10, isAbsolute as isAbsolute3, join as join14 } from "path";
77637
+ import { dirname as dirname10, isAbsolute as isAbsolute3, join as join15 } from "path";
77289
77638
  function parseExecutorPin(raw) {
77290
77639
  if (typeof raw !== "string" || raw.trim() === "")
77291
77640
  return;
@@ -77301,12 +77650,15 @@ class AgentRunActionRunner {
77301
77650
  observabilityBus;
77302
77651
  steeringController;
77303
77652
  agentConfig;
77653
+ fleetDeps;
77304
77654
  kind = KIND2;
77305
77655
  agentService;
77306
- constructor(agentService, observabilityBus, steeringController, agentConfig = {}) {
77656
+ fleetFallbackReason;
77657
+ constructor(agentService, observabilityBus, steeringController, agentConfig = {}, fleetDeps) {
77307
77658
  this.observabilityBus = observabilityBus;
77308
77659
  this.steeringController = steeringController;
77309
77660
  this.agentConfig = agentConfig;
77661
+ this.fleetDeps = fleetDeps;
77310
77662
  this.agentService = agentService;
77311
77663
  }
77312
77664
  contractViolation(context4, agentLabel, contract, observed, error51, data) {
@@ -77325,11 +77677,140 @@ class AgentRunActionRunner {
77325
77677
  });
77326
77678
  return {
77327
77679
  ok: false,
77328
- data: { ...data, outcome: "contract-violation", contract, observed },
77680
+ data: {
77681
+ ...data,
77682
+ outcome: "contract-violation",
77683
+ contract,
77684
+ observed,
77685
+ ...this.fleetFallbackReason !== undefined ? { fallbackReason: this.fleetFallbackReason } : {}
77686
+ },
77329
77687
  error: error51
77330
77688
  };
77331
77689
  }
77690
+ async executeFleetSurface(options, context4, input, role, cwd) {
77691
+ if (this.fleetDeps === undefined) {
77692
+ return {
77693
+ result: {
77694
+ ok: false,
77695
+ error: `agent.run: executor 'fleet' is selected but this host wired no fleet dispatch (ADR-126) \u2014 run where the fleet surface is composed`
77696
+ }
77697
+ };
77698
+ }
77699
+ const unsupported = [
77700
+ "agent",
77701
+ "model",
77702
+ "session",
77703
+ "continue",
77704
+ "answerFile",
77705
+ "escalationFile",
77706
+ "requireDiff",
77707
+ "maxTokens",
77708
+ "maxCostUsd",
77709
+ "requiresCapabilities"
77710
+ ].filter((key) => {
77711
+ const value = options[key];
77712
+ return !(value === undefined || value === null || value === false || value === "");
77713
+ });
77714
+ if (unsupported.length > 0) {
77715
+ return {
77716
+ result: {
77717
+ ok: false,
77718
+ error: `agent.run: option(s) ${unsupported.map((key) => `'${key}'`).join(", ")} are subprocess-surface only and unsupported on the fleet executor (0942)`
77719
+ }
77720
+ };
77721
+ }
77722
+ if (input === undefined || input.trim() === "") {
77723
+ return {
77724
+ result: {
77725
+ ok: false,
77726
+ error: "agent.run: fleet dispatch requires an input prompt (continue/resume is not a fleet surface)"
77727
+ }
77728
+ };
77729
+ }
77730
+ const expectFile = asOptionalString(options.expectFile);
77731
+ const timeoutMs = asOptionalNumber(options.timeoutMs);
77732
+ if (timeoutMs !== undefined && timeoutMs <= 0) {
77733
+ return { result: { ok: false, error: "agent.run: timeoutMs must be > 0" } };
77734
+ }
77735
+ if (expectFile !== undefined) {
77736
+ const target = isAbsolute3(expectFile) ? expectFile : join15(cwd, expectFile);
77737
+ const fs3 = createNodeFileSystem3(cwd);
77738
+ if (await fs3.exists(target)) {
77739
+ try {
77740
+ await fs3.deleteFile(target);
77741
+ } catch (error51) {
77742
+ return {
77743
+ result: {
77744
+ ok: false,
77745
+ error: `agent.run: expectFile ${expectFile} exists from a previous run and could not be removed before dispatch: ${error51.message}`
77746
+ }
77747
+ };
77748
+ }
77749
+ }
77750
+ }
77751
+ const dispatch = await dispatchToFleet({
77752
+ role,
77753
+ prompt: input,
77754
+ projectPath: cwd,
77755
+ ...expectFile !== undefined ? { expectFile } : {},
77756
+ ...timeoutMs !== undefined ? { timeoutMs } : {},
77757
+ runId: context4.runId,
77758
+ state: context4.stateOrNodeId
77759
+ }, this.fleetDeps);
77760
+ if (dispatch.status === "dispatched") {
77761
+ return {
77762
+ result: {
77763
+ ok: true,
77764
+ data: {
77765
+ agent: dispatch.memberId,
77766
+ usage: unavailableAgentUsage("fleet members report no token usage"),
77767
+ ...expectFile !== undefined ? { expectFile } : {},
77768
+ durationMs: dispatch.durationMs,
77769
+ reason: "done",
77770
+ surface: "fleet",
77771
+ memberId: dispatch.memberId,
77772
+ messageId: dispatch.messageId,
77773
+ promptPath: dispatch.promptPath
77774
+ }
77775
+ }
77776
+ };
77777
+ }
77778
+ if (dispatch.status === "timeout") {
77779
+ return {
77780
+ result: {
77781
+ ok: false,
77782
+ data: {
77783
+ agent: dispatch.memberId,
77784
+ usage: unavailableAgentUsage("fleet members report no token usage"),
77785
+ expectFile: dispatch.expectFile,
77786
+ durationMs: dispatch.durationMs,
77787
+ reason: "failed-timeout",
77788
+ surface: "fleet",
77789
+ memberId: dispatch.memberId,
77790
+ messageId: dispatch.messageId
77791
+ },
77792
+ error: `agent.run (${dispatch.memberId}) accepted the fleet dispatch but expectFile never appeared within the declared timeout: ${dispatch.expectFile}`
77793
+ }
77794
+ };
77795
+ }
77796
+ const outcome = fleetUnavailableOutcome(dispatch.reason, context4.vars.executorFallback);
77797
+ if (outcome.mode === "fallback")
77798
+ return { fallbackReason: outcome.fallbackReason };
77799
+ return {
77800
+ result: {
77801
+ ok: false,
77802
+ data: {
77803
+ agent: role,
77804
+ usage: unavailableAgentUsage("fleet unavailable before dispatch"),
77805
+ reason: "failed-agent",
77806
+ surface: "fleet"
77807
+ },
77808
+ error: outcome.error
77809
+ }
77810
+ };
77811
+ }
77332
77812
  async execute(options, context4) {
77813
+ this.fleetFallbackReason = undefined;
77333
77814
  const input = asOptionalString(options.input);
77334
77815
  const agent = asOptionalString(options.agent);
77335
77816
  const role = asOptionalString(options.role);
@@ -77410,15 +77891,15 @@ class AgentRunActionRunner {
77410
77891
  let sessionDir = freshSession ? undefined : asOptionalString(context4.vars[sessionDirVar]) || undefined;
77411
77892
  if (affinityOn) {
77412
77893
  if (!sessionDir || prevAgent && prevAgent !== targetAgentDir) {
77413
- sessionDir = join14(cwd, ".spur", "run", context4.runId, "agent-sessions", targetAgentDir);
77894
+ sessionDir = join15(cwd, ".spur", "run", context4.runId, "agent-sessions", targetAgentDir);
77414
77895
  }
77415
77896
  } else {
77416
77897
  if (!sessionDir) {
77417
- sessionDir = join14(cwd, ".spur", "run", context4.runId, "agent-sessions", targetAgentDir);
77898
+ sessionDir = join15(cwd, ".spur", "run", context4.runId, "agent-sessions", targetAgentDir);
77418
77899
  }
77419
77900
  }
77420
77901
  if (freshSession) {
77421
- sessionDir = join14(cwd, ".spur", "run", context4.runId, "agent-sessions", targetAgentDir, `fresh-${context4.stateOrNodeId}`);
77902
+ sessionDir = join15(cwd, ".spur", "run", context4.runId, "agent-sessions", targetAgentDir, `fresh-${context4.stateOrNodeId}`);
77422
77903
  }
77423
77904
  const storedSessionId = freshSession ? undefined : asOptionalString(context4.vars[sessionIdVar]) || undefined;
77424
77905
  let continueFlag = asOptionalBoolean(options.continue);
@@ -77445,6 +77926,12 @@ class AgentRunActionRunner {
77445
77926
  error: `agent.run: step must declare a Layer-1 role: (scribe | coder | reviewer | planner) beside agent: (0538 R2)${role === undefined ? "" : ` \u2014 unknown role '${role}'`}`
77446
77927
  };
77447
77928
  }
77929
+ if (context4.vars.executor === "fleet") {
77930
+ const fleet = await this.executeFleetSurface(options, context4, input, role, cwd);
77931
+ if (fleet.result !== undefined)
77932
+ return fleet.result;
77933
+ this.fleetFallbackReason = fleet.fallbackReason;
77934
+ }
77448
77935
  const flags = {};
77449
77936
  if (dispatchAgent !== undefined)
77450
77937
  flags.agent = dispatchAgent;
@@ -77547,7 +78034,7 @@ class AgentRunActionRunner {
77547
78034
  flags.requiresCapabilities = JSON.stringify(requiresCapabilities.requires);
77548
78035
  }
77549
78036
  if (escalationFile !== undefined) {
77550
- const target = isAbsolute3(escalationFile) ? escalationFile : join14(cwd, escalationFile);
78037
+ const target = isAbsolute3(escalationFile) ? escalationFile : join15(cwd, escalationFile);
77551
78038
  const fs3 = createNodeFileSystem3(cwd);
77552
78039
  if (await fs3.exists(target)) {
77553
78040
  try {
@@ -77561,7 +78048,7 @@ class AgentRunActionRunner {
77561
78048
  }
77562
78049
  }
77563
78050
  if (expectFile !== undefined) {
77564
- const target = isAbsolute3(expectFile) ? expectFile : join14(cwd, expectFile);
78051
+ const target = isAbsolute3(expectFile) ? expectFile : join15(cwd, expectFile);
77565
78052
  const fs3 = createNodeFileSystem3(cwd);
77566
78053
  if (await fs3.exists(target)) {
77567
78054
  try {
@@ -77580,7 +78067,7 @@ class AgentRunActionRunner {
77580
78067
  return;
77581
78068
  return `
77582
78069
 
77583
- Write the required artifact to this absolute path: ${join14(cwd, rel)}`;
78070
+ Write the required artifact to this absolute path: ${join15(cwd, rel)}`;
77584
78071
  })();
77585
78072
  const dispatchInput = input === undefined || absoluteArtifactHint === undefined ? input : `${input}${absoluteArtifactHint}`;
77586
78073
  const observer = this.observabilityBus === undefined ? undefined : (event) => {
@@ -77734,7 +78221,7 @@ Write the required artifact to this absolute path: ${join14(cwd, rel)}`;
77734
78221
  }
77735
78222
  }
77736
78223
  if (capture && answerFile !== undefined) {
77737
- const target = isAbsolute3(answerFile) ? answerFile : join14(cwd, answerFile);
78224
+ const target = isAbsolute3(answerFile) ? answerFile : join15(cwd, answerFile);
77738
78225
  const fs3 = createNodeFileSystem3(cwd);
77739
78226
  await fs3.ensureDir(dirname10(target));
77740
78227
  await fs3.writeFile(target, answer);
@@ -77744,13 +78231,13 @@ Write the required artifact to this absolute path: ${join14(cwd, rel)}`;
77744
78231
  }
77745
78232
  let escalated = false;
77746
78233
  if (ok && escalationFile !== undefined) {
77747
- const target = isAbsolute3(escalationFile) ? escalationFile : join14(cwd, escalationFile);
78234
+ const target = isAbsolute3(escalationFile) ? escalationFile : join15(cwd, escalationFile);
77748
78235
  const fs3 = createNodeFileSystem3(cwd);
77749
78236
  const stat2 = await fs3.stat(target);
77750
78237
  escalated = stat2 !== null && stat2.size > 0;
77751
78238
  }
77752
78239
  if (ok && !escalated && expectFile !== undefined) {
77753
- const target = isAbsolute3(expectFile) ? expectFile : join14(cwd, expectFile);
78240
+ const target = isAbsolute3(expectFile) ? expectFile : join15(cwd, expectFile);
77754
78241
  const fs3 = createNodeFileSystem3(cwd);
77755
78242
  if (!await fs3.exists(target)) {
77756
78243
  await writePartialWorkArtifact(context4, agentLabel, model, traced, cwd, sessionDir, this.agentConfig.secretValues);
@@ -77787,7 +78274,7 @@ ${traced.stdout ?? ""}`);
77787
78274
  const resolvedAgent = invocation?.agent ?? targetAgentDir;
77788
78275
  let resolvedSessionDir = sessionDir;
77789
78276
  if (ok && affinityOn && resolvedAgent !== targetAgentDir && !context4.vars[sessionDirVar]) {
77790
- resolvedSessionDir = join14(cwd, ".spur", "run", context4.runId, "agent-sessions", resolvedAgent);
78277
+ resolvedSessionDir = join15(cwd, ".spur", "run", context4.runId, "agent-sessions", resolvedAgent);
77791
78278
  }
77792
78279
  let discoveredSessionId = storedSessionId;
77793
78280
  if (ok && affinityOn && resolvedSessionDir && !discoveredSessionId && resumeSupported) {
@@ -77795,7 +78282,7 @@ ${traced.stdout ?? ""}`);
77795
78282
  }
77796
78283
  if (ok && affinityOn && resolvedSessionDir) {
77797
78284
  try {
77798
- const sidecarPath = join14(cwd, ".spur", "run", `${context4.runId}-agent-session.json`);
78285
+ const sidecarPath = join15(cwd, ".spur", "run", `${context4.runId}-agent-session.json`);
77799
78286
  const fs3 = createNodeFileSystem3(cwd);
77800
78287
  await fs3.ensureDir(dirname10(sidecarPath));
77801
78288
  await fs3.writeFile(sidecarPath, JSON.stringify({
@@ -77816,6 +78303,8 @@ ${traced.stdout ?? ""}`);
77816
78303
  }
77817
78304
  if (model !== undefined)
77818
78305
  resultData.model = model;
78306
+ if (this.fleetFallbackReason !== undefined)
78307
+ resultData.fallbackReason = this.fleetFallbackReason;
77819
78308
  resultData.executor = dispatchAgent;
77820
78309
  const tracedSessionId = resumedDispatch ? storedSessionId : discoveredSessionId;
77821
78310
  if (tracedSessionId !== undefined)
@@ -77875,7 +78364,7 @@ async function discoverSessionId(sessionDir) {
77875
78364
  let newestFile;
77876
78365
  let newestMtime = 0;
77877
78366
  for (const entry of jsonEntries) {
77878
- const fullPath = join14(sessionDir, entry);
78367
+ const fullPath = join15(sessionDir, entry);
77879
78368
  const st = await fs3.stat(fullPath);
77880
78369
  if (st?.isFile() && st.mtimeMs > newestMtime) {
77881
78370
  newestMtime = st.mtimeMs;
@@ -77971,7 +78460,7 @@ async function writePartialWorkArtifact(context4, agentLabel, model, traced, cwd
77971
78460
  const headerLine = model !== undefined ? `${agentLabel} (model: ${model})` : agentLabel;
77972
78461
  const inv = traced.invocation;
77973
78462
  const argvLine = redactAndBound(inv ? `${inv.command} ${inv.argv.join(" ")}` : "(invocation not captured)", secretValues, PARTIAL_ARTIFACT_TAIL_CHARS);
77974
- const latchedSessionPath = join14(cwd, ".spur", "run", `${context4.runId}-agent-session.json`);
78463
+ const latchedSessionPath = join15(cwd, ".spur", "run", `${context4.runId}-agent-session.json`);
77975
78464
  const resumeContext = [
77976
78465
  "",
77977
78466
  "## resume context",
@@ -77987,9 +78476,9 @@ async function writePartialWorkArtifact(context4, agentLabel, model, traced, cwd
77987
78476
  try {
77988
78477
  const fs4 = createNodeFileSystem3(cwd);
77989
78478
  const locator = TaskLocator.forDirs(fs4, [
77990
- join14(cwd, "docs", "tasks3"),
77991
- join14(cwd, "docs", "tasks2"),
77992
- join14(cwd, "docs", "tasks")
78479
+ join15(cwd, "docs", "tasks3"),
78480
+ join15(cwd, "docs", "tasks2"),
78481
+ join15(cwd, "docs", "tasks")
77993
78482
  ]);
77994
78483
  const hit = await locator.findByWbs(wbs);
77995
78484
  if (hit) {
@@ -78045,7 +78534,7 @@ async function writePartialWorkArtifact(context4, agentLabel, model, traced, cwd
78045
78534
  completedSection
78046
78535
  ].join(`
78047
78536
  `);
78048
- const target = join14(cwd, ".spur", "run", `${context4.runId}-${context4.stateOrNodeId}-partial.md`);
78537
+ const target = join15(cwd, ".spur", "run", `${context4.runId}-${context4.stateOrNodeId}-partial.md`);
78049
78538
  const fs3 = createNodeFileSystem3(cwd);
78050
78539
  await fs3.ensureDir(dirname10(target));
78051
78540
  await fs3.writeFile(target, body);
@@ -78067,7 +78556,7 @@ async function gitDiffStat(cwd) {
78067
78556
  }
78068
78557
  }
78069
78558
  async function createGitWorkingTreeSnapshot(cwd, excludeGlobs = ["docs/tasks3/*", "docs/features/*"]) {
78070
- const indexFile = join14(tmpdir(), `spur-implement-scope-${crypto.randomUUID()}.index`);
78559
+ const indexFile = join15(tmpdir(), `spur-implement-scope-${crypto.randomUUID()}.index`);
78071
78560
  const fs3 = createNodeFileSystem3(cwd);
78072
78561
  let keepIndex = false;
78073
78562
  try {
@@ -78198,9 +78687,9 @@ async function findOutOfScopeChanges(cwd, wbs, changed) {
78198
78687
  try {
78199
78688
  const fs3 = createNodeFileSystem3(cwd);
78200
78689
  const locator = TaskLocator.forDirs(fs3, [
78201
- join14(cwd, "docs", "tasks3"),
78202
- join14(cwd, "docs", "tasks2"),
78203
- join14(cwd, "docs", "tasks")
78690
+ join15(cwd, "docs", "tasks3"),
78691
+ join15(cwd, "docs", "tasks2"),
78692
+ join15(cwd, "docs", "tasks")
78204
78693
  ]);
78205
78694
  const hit = await locator.findByWbs(wbs);
78206
78695
  if (!hit)
@@ -78232,6 +78721,7 @@ var init_agent_run = __esm(() => {
78232
78721
  init_failure_classification();
78233
78722
  init_review_independence();
78234
78723
  init_task_locator();
78724
+ init_fleet_dispatch();
78235
78725
  init_steering();
78236
78726
  init_tripwire();
78237
78727
  });
@@ -78270,7 +78760,7 @@ var init_child_env = __esm(() => {
78270
78760
  });
78271
78761
 
78272
78762
  // ../../packages/app/src/workflow/actions/command-gate.ts
78273
- import { join as join15, normalize as normalize2 } from "path";
78763
+ import { join as join16, normalize as normalize2 } from "path";
78274
78764
  function sleep3(ms) {
78275
78765
  return new Promise((resolve5) => setTimeout(resolve5, ms));
78276
78766
  }
@@ -78342,7 +78832,7 @@ class CommandGateActionRunner {
78342
78832
  const retryOn = Array.isArray(retry.on) ? retry.on : [];
78343
78833
  const timeoutMs = typeof options.timeoutMs === "number" ? options.timeoutMs : undefined;
78344
78834
  const env2 = childProcessEnv(context4.vars);
78345
- await this.fileSystem.ensureDir(normalize2(join15(normalized, "..")));
78835
+ await this.fileSystem.ensureDir(normalize2(join16(normalized, "..")));
78346
78836
  let lastStdout = "";
78347
78837
  let lastStderr = "";
78348
78838
  let lastExitCode = -1;
@@ -79019,7 +79509,7 @@ var init_http_request = __esm(() => {
79019
79509
  // ../../packages/app/src/workflow/proof-input-fingerprint.ts
79020
79510
  import crypto4 from "crypto";
79021
79511
  import { tmpdir as tmpdir2 } from "os";
79022
- import { dirname as dirname11, join as join16, resolve as resolve6, sep as sep3 } from "path";
79512
+ import { dirname as dirname11, join as join17, resolve as resolve6, sep as sep3 } from "path";
79023
79513
  function taskDocumentShapeError(content) {
79024
79514
  const doc2 = MarkdownDocument.parse(content, "task");
79025
79515
  const heading = CANONICAL_TASK_HEADING_RE.exec(doc2.bodyWithoutFrontmatter);
@@ -79094,7 +79584,7 @@ async function readProofInputContents(fileSystem = createNodeFileSystem3(), work
79094
79584
  };
79095
79585
  }
79096
79586
  async function createGitAlternateTree(cwd, excludeGlobs = DEFAULT_EXCLUDE_GLOBS, executor = new NodeProcessExecutor3, fs3 = createNodeFileSystem3()) {
79097
- const indexFile = join16(tmpdir2(), `spur-proof-fingerprint-${crypto4.randomUUID()}.index`);
79587
+ const indexFile = join17(tmpdir2(), `spur-proof-fingerprint-${crypto4.randomUUID()}.index`);
79098
79588
  try {
79099
79589
  await fs3.ensureDir(dirname11(indexFile));
79100
79590
  const env2 = Object.fromEntries(Object.entries(getEnvVars()).filter((entry) => entry[1] !== undefined));
@@ -79530,7 +80020,7 @@ var init_verify_verdict = __esm(() => {
79530
80020
  });
79531
80021
 
79532
80022
  // ../../packages/app/src/workflow/actions/run-artifact.ts
79533
- import { join as join17, resolve as resolve7 } from "path";
80023
+ import { join as join18, resolve as resolve7 } from "path";
79534
80024
 
79535
80025
  class RunArtifactActionRunner {
79536
80026
  getDb;
@@ -79808,7 +80298,7 @@ class RunArtifactActionRunner {
79808
80298
  error: `${KIND14}: proof.stages.review.status is "${String(review.status)}" \u2014 a skipped or stale review is not completed evidence (0785 R4)`
79809
80299
  };
79810
80300
  }
79811
- const markerPath = join17(resolve7(workdir), ".spur", "run", `${context4.runId}-review-proof.digest`);
80301
+ const markerPath = join18(resolve7(workdir), ".spur", "run", `${context4.runId}-review-proof.digest`);
79812
80302
  let marker = null;
79813
80303
  try {
79814
80304
  marker = await this.fileSystem.readFile(markerPath);
@@ -80091,7 +80581,7 @@ var init_shell2 = __esm(() => {
80091
80581
  // ../../packages/app/src/workflow/builtins.ts
80092
80582
  function registerSpurBuiltins(host, options) {
80093
80583
  const fileSystem = options.fileSystem ?? createNodeFileSystem3();
80094
- host.registerAction(new AgentRunActionRunner(options.agentService, options.observabilityBus, options.steeringController, options.agentConfig), "builtin");
80584
+ host.registerAction(new AgentRunActionRunner(options.agentService, options.observabilityBus, options.steeringController, options.agentConfig, options.fleetDispatchDeps), "builtin");
80095
80585
  host.registerAction(new StreamingShellActionRunner(options.processExecutor ?? new NodeProcessExecutor3, options.observabilityBus, options.secretValues ?? []), "builtin");
80096
80586
  host.registerGuard(new EnvShellGuardRunner(options.processExecutor ?? new NodeProcessExecutor3), "builtin");
80097
80587
  host.registerGuard(new ContractViolationGuardRunner, "builtin");
@@ -80102,6 +80592,10 @@ function registerSpurBuiltins(host, options) {
80102
80592
  host.registerAction(new HitlConfirmActionRunner(options.hitlResponder, options.decisionEvaluator), "builtin");
80103
80593
  host.registerAction(new HitlSelectActionRunner(options.hitlResponder, options.decisionEvaluator), "builtin");
80104
80594
  host.registerAction(new HitlInputActionRunner(options.hitlResponder), "builtin");
80595
+ host.registerAction(new DecideActionRunner(fileSystem, {
80596
+ enabled: options.decideDecisionMaker === true,
80597
+ ...options.decideMaker !== undefined ? { decisionMaker: options.decideMaker } : {}
80598
+ }), "builtin");
80105
80599
  host.registerAction(new CommandGateActionRunner(options.processExecutor ?? new NodeProcessExecutor3, fileSystem), "builtin");
80106
80600
  host.registerAction(new DoctorProbeActionRunner(options.processExecutor ?? new NodeProcessExecutor3, fileSystem, options.observabilityBus, options.agentService), "builtin");
80107
80601
  host.registerAction(new RunArtifactActionRunner(options.getDb, fileSystem, options.artifactDao, options.processExecutor), "builtin");
@@ -80117,6 +80611,7 @@ var init_builtins2 = __esm(() => {
80117
80611
  init_dist5();
80118
80612
  init_agent_run();
80119
80613
  init_command_gate();
80614
+ init_decide2();
80120
80615
  init_doctor_probe();
80121
80616
  init_file_exists();
80122
80617
  init_file_read();
@@ -80227,7 +80722,7 @@ var init_checkpoint_contract = __esm(() => {
80227
80722
  });
80228
80723
 
80229
80724
  // ../../packages/app/src/workflow/workflow-resolver.ts
80230
- import { basename as basename3, isAbsolute as isAbsolute4, join as join18, resolve as resolve8 } from "path";
80725
+ import { basename as basename3, isAbsolute as isAbsolute4, join as join19, resolve as resolve8 } from "path";
80231
80726
  function registeredWorkflowPaths(config4) {
80232
80727
  const paths = config4?.workflows?.paths ?? [".spur/workflows/"];
80233
80728
  const bundledRoot = bundledConfigRoot();
@@ -80235,7 +80730,7 @@ function registeredWorkflowPaths(config4) {
80235
80730
  for (const path9 of paths) {
80236
80731
  if (path9.startsWith(BUNDLED_PATH_PREFIX)) {
80237
80732
  if (bundledRoot !== null)
80238
- expanded.push(join18(bundledRoot, path9.slice(BUNDLED_PATH_PREFIX.length)));
80733
+ expanded.push(join19(bundledRoot, path9.slice(BUNDLED_PATH_PREFIX.length)));
80239
80734
  } else {
80240
80735
  expanded.push(path9);
80241
80736
  }
@@ -80247,7 +80742,7 @@ function normalizeLayerPath(cwd, path9) {
80247
80742
  }
80248
80743
  function workflowLayers(opts) {
80249
80744
  const sharedRoot = opts.sharedRoot !== undefined ? opts.sharedRoot : bundledConfigRoot();
80250
- const sharedPath = sharedRoot !== null ? normalizeLayerPath(opts.cwd, join18(sharedRoot, "workflows")) : null;
80745
+ const sharedPath = sharedRoot !== null ? normalizeLayerPath(opts.cwd, join19(sharedRoot, "workflows")) : null;
80251
80746
  const layers = [];
80252
80747
  const seen = new Set;
80253
80748
  const add = (id, path9) => {
@@ -80256,7 +80751,7 @@ function workflowLayers(opts) {
80256
80751
  seen.add(path9);
80257
80752
  layers.push({ id, path: path9 });
80258
80753
  };
80259
- add("project", normalizeLayerPath(opts.cwd, join18(opts.cwd, ".spur", "workflows")));
80754
+ add("project", normalizeLayerPath(opts.cwd, join19(opts.cwd, ".spur", "workflows")));
80260
80755
  for (const entry of opts.registered) {
80261
80756
  if (sharedPath !== null && normalizeLayerPath(opts.cwd, entry) === sharedPath)
80262
80757
  continue;
@@ -80300,7 +80795,7 @@ async function scanWorkflowByName(cwd, name, registered) {
80300
80795
  try {
80301
80796
  const files = (await fs3.readDir(layer.path)).filter((f) => f.endsWith(".yaml") || f.endsWith(".yml"));
80302
80797
  for (const f of files) {
80303
- const abs = join18(layer.path, f);
80798
+ const abs = join19(layer.path, f);
80304
80799
  const wfName = await readWorkflowNameFast(fs3, abs);
80305
80800
  if (wfName === name) {
80306
80801
  return { path: abs, source: layer.id };
@@ -80342,16 +80837,16 @@ function resolveWorkflowFile(cwd, file2) {
80342
80837
  const bundledRoot = bundledConfigRoot();
80343
80838
  if (bundledRoot !== null) {
80344
80839
  const sharedName = isYaml ? base2 : `${base2}.yaml`;
80345
- const sharedPath = join18(bundledRoot, "workflows", sharedName);
80840
+ const sharedPath = join19(bundledRoot, "workflows", sharedName);
80346
80841
  if (fs3.exists(sharedPath)) {
80347
80842
  return { path: sharedPath, source: "shared" };
80348
80843
  }
80349
80844
  if (!isYaml) {
80350
- const sharedPipeline = join18(bundledRoot, "workflows", `${base2}-pipeline.yaml`);
80845
+ const sharedPipeline = join19(bundledRoot, "workflows", `${base2}-pipeline.yaml`);
80351
80846
  if (fs3.exists(sharedPipeline)) {
80352
80847
  return { path: sharedPipeline, source: "shared" };
80353
80848
  }
80354
- const sharedLiteral = join18(bundledRoot, "workflows", base2);
80849
+ const sharedLiteral = join19(bundledRoot, "workflows", base2);
80355
80850
  if (fs3.exists(sharedLiteral)) {
80356
80851
  return { path: sharedLiteral, source: "shared" };
80357
80852
  }
@@ -82669,7 +83164,7 @@ var init_system_event_envelope = __esm(() => {
82669
83164
 
82670
83165
  // ../../packages/app/src/services/workflow-service.ts
82671
83166
  import { closeSync as closeSync3, constants as constants4, existsSync as existsSync5, fstatSync, openSync as openSync3, readFileSync as readFileSync9, realpathSync as realpathSync3, statSync as statSync7 } from "fs";
82672
- import { basename as basename4, dirname as dirname12, isAbsolute as isAbsolute5, join as join19, resolve as resolve9, sep as sep4 } from "path";
83167
+ import { basename as basename4, dirname as dirname12, isAbsolute as isAbsolute5, join as join20, resolve as resolve9, sep as sep4 } from "path";
82673
83168
  function signalSubprocess(pid) {
82674
83169
  if (!Number.isInteger(pid) || pid <= 1)
82675
83170
  return false;
@@ -82819,6 +83314,14 @@ class WorkflowAppService {
82819
83314
  if (decisionErrors.length > 0) {
82820
83315
  return { ok: false, valid: false, file: file2, errors: decisionErrors };
82821
83316
  }
83317
+ const decideErrors = collectDecideViolations(workflow);
83318
+ if (decideErrors.length > 0) {
83319
+ return { ok: false, valid: false, file: file2, errors: decideErrors };
83320
+ }
83321
+ const terminalReasonErrors = collectTerminalReasonViolations(workflow);
83322
+ if (terminalReasonErrors.length > 0) {
83323
+ return { ok: false, valid: false, file: file2, errors: terminalReasonErrors };
83324
+ }
82822
83325
  const composition = collectCompositionAdvisory(workflow, absolute);
82823
83326
  await this.loadWorkflowExtensions(createDefaultWorkflowEngineHost(), workflow, absolute);
82824
83327
  return { ok: true, valid: true, workflow, digest: resolved.digest, composition };
@@ -82852,8 +83355,8 @@ class WorkflowAppService {
82852
83355
  const warnings = [];
82853
83356
  const runVars = {
82854
83357
  ...mergeWorkflowRunVars(workflow.vars, {
82855
- ...resolveDefaultAgentVar(this.ctx.spurConfig ?? null, opts.vars, (m) => warnings.push(m)),
82856
- ...opts.vars ?? {}
83358
+ ...resolveDefaultAgentVar(this.ctx.spurConfig ?? null, mapFleetExecutorVar(opts.vars), (m) => warnings.push(m)),
83359
+ ...mapFleetExecutorVar(opts.vars)
82857
83360
  }),
82858
83361
  __runId: runId,
82859
83362
  __definitionDigest: computeDefinitionDigest(workflow)
@@ -82940,9 +83443,13 @@ class WorkflowAppService {
82940
83443
  if (!dryRun) {
82941
83444
  const engine2 = new WorkflowService(createDefaultWorkflowEngineHost({}), new DbWorkflowPersistenceAdapter(db2));
82942
83445
  for (const run of stale) {
82943
- const interrupted = run.status === "running" ? await engine2.interruptRun(run.id, `stale: owner lost > ${olderThanMinutes}m (spur workflow clean)`) : undefined;
83446
+ const interrupted = run.status === "running" ? await engine2.interruptRun(run.id, "interrupted") : undefined;
82944
83447
  if (interrupted === undefined) {
82945
83448
  await dao2.finalizeStale(run.id, `stale: non-terminal > ${olderThanMinutes}m (spur workflow clean)`);
83449
+ } else {
83450
+ await dao2.mergeMetadata(run.id, {
83451
+ staleReason: `stale: owner lost > ${olderThanMinutes}m (spur workflow clean)`
83452
+ });
82946
83453
  }
82947
83454
  }
82948
83455
  }
@@ -82953,7 +83460,7 @@ class WorkflowAppService {
82953
83460
  };
82954
83461
  }
82955
83462
  async cleanRunLogs(retentionDays = 30, dryRun = false) {
82956
- const runDir = join19(this.ctx.cwd, ".spur", "run");
83463
+ const runDir = join20(this.ctx.cwd, ".spur", "run");
82957
83464
  const fs3 = createNodeFileSystem3();
82958
83465
  const cutoffMs = Date.now() - retentionDays * 24 * 60 * 60 * 1000;
82959
83466
  const reclaimed = [];
@@ -82965,7 +83472,7 @@ class WorkflowAppService {
82965
83472
  return { retentionDays, dryRun, reclaimed, failures };
82966
83473
  }
82967
83474
  for (const name of entries) {
82968
- const path9 = join19(runDir, name);
83475
+ const path9 = join20(runDir, name);
82969
83476
  const stat2 = await fs3.stat(path9);
82970
83477
  if (stat2 === null || !stat2.isFile() || stat2.mtimeMs >= cutoffMs)
82971
83478
  continue;
@@ -82984,7 +83491,7 @@ class WorkflowAppService {
82984
83491
  return { retentionDays, dryRun, reclaimed, failures };
82985
83492
  }
82986
83493
  async cleanCheckpoints(retentionDays = 30, dryRun = false) {
82987
- const sessionsDir = join19(this.ctx.cwd, ".spur", "memory", "sessions");
83494
+ const sessionsDir = join20(this.ctx.cwd, ".spur", "memory", "sessions");
82988
83495
  const fs3 = createNodeFileSystem3();
82989
83496
  let sessionsReal;
82990
83497
  try {
@@ -83004,7 +83511,7 @@ class WorkflowAppService {
83004
83511
  }
83005
83512
  const activeRunIds = new Set((await new RunDao(await this.ctx.getDb()).listActiveRuns()).map((r) => r.id));
83006
83513
  for (const name of entries) {
83007
- const path9 = join19(sessionsDir, name);
83514
+ const path9 = join20(sessionsDir, name);
83008
83515
  let resolved;
83009
83516
  try {
83010
83517
  resolved = realpathSync3(path9);
@@ -83267,7 +83774,7 @@ class WorkflowAppService {
83267
83774
  await new RunDao(db2).stampFailureReason(runId, result.reason);
83268
83775
  }
83269
83776
  async validateResumeCheckpointFreshness(runId, row, workdir) {
83270
- const sessionsDir = join19(workdir, ".spur", "memory", "sessions");
83777
+ const sessionsDir = join20(workdir, ".spur", "memory", "sessions");
83271
83778
  const fs3 = createNodeFileSystem3();
83272
83779
  let entries;
83273
83780
  try {
@@ -83301,7 +83808,7 @@ class WorkflowAppService {
83301
83808
  return head;
83302
83809
  };
83303
83810
  for (const name of entries) {
83304
- const filePath = join19(sessionsDir, name);
83811
+ const filePath = join20(sessionsDir, name);
83305
83812
  let raw;
83306
83813
  try {
83307
83814
  raw = await fs3.readFile(filePath);
@@ -83332,7 +83839,7 @@ class WorkflowAppService {
83332
83839
  const staleness = checkpointStaleness(meta3, {
83333
83840
  ...wbs !== undefined ? { taskWbs: wbs } : {},
83334
83841
  ...meta3.sourceCommit === "" ? {} : { sourceCommit: await resolveHead() },
83335
- artifactExists: (p) => fs3.exists(isAbsolute5(p) ? p : join19(workdir, p))
83842
+ artifactExists: (p) => fs3.exists(isAbsolute5(p) ? p : join20(workdir, p))
83336
83843
  });
83337
83844
  if (staleness.stale) {
83338
83845
  throw new Error(`Cannot resume run "${runId}": checkpoint is stale (${staleness.reason}).`);
@@ -83359,7 +83866,7 @@ class WorkflowAppService {
83359
83866
  return this.traceList(db2, runIdOrFilter ?? {});
83360
83867
  }
83361
83868
  inspectRunRecord(runId) {
83362
- return inspectWorkflowRunRecord(join19(this.ctx.cwd, ".spur", "run"), runId, {
83869
+ return inspectWorkflowRunRecord(join20(this.ctx.cwd, ".spur", "run"), runId, {
83363
83870
  secretValues: this.ctx.secretValues
83364
83871
  });
83365
83872
  }
@@ -83511,6 +84018,26 @@ class WorkflowAppService {
83511
84018
  excludeGlobs: [...folderGlobs, `${featuresDir}/*`]
83512
84019
  };
83513
84020
  } catch {}
84021
+ const fleetFs = createNodeFileSystem3(this.ctx.cwd);
84022
+ const fleetDispatchDeps = {
84023
+ coordination: new AgentCoordinationService({
84024
+ cwd: this.ctx.cwd,
84025
+ env: getEnvVars(),
84026
+ ...this.ctx.spurConfig !== undefined ? { spurConfig: this.ctx.spurConfig } : {},
84027
+ ...this.ctx.reloadAgentConfig !== undefined ? { reloadAgentConfig: this.ctx.reloadAgentConfig } : {},
84028
+ getDb: () => this.ctx.getDb(),
84029
+ fs: fleetFs,
84030
+ ...bus !== undefined ? { eventBus: bus } : {}
84031
+ }),
84032
+ fleet: new FleetService({
84033
+ fs: fleetFs,
84034
+ ...this.ctx.spurConfig !== undefined ? { spurConfig: this.ctx.spurConfig } : {},
84035
+ ...this.ctx.reloadAgentConfig !== undefined ? { reloadAgentConfig: this.ctx.reloadAgentConfig } : {},
84036
+ openDb: () => this.ctx.getDb()
84037
+ }),
84038
+ waitForFile: waitForFileExists,
84039
+ now: () => Date.now()
84040
+ };
83514
84041
  registerSpurBuiltins(host, {
83515
84042
  agentService: this.ctx.agentService(),
83516
84043
  ruleService: this.ctx.ruleService(),
@@ -83523,6 +84050,9 @@ class WorkflowAppService {
83523
84050
  ...opts.steeringController !== undefined ? { steeringController: opts.steeringController } : {},
83524
84051
  agentConfig: agentSlice,
83525
84052
  getDb: () => this.ctx.getDb(),
84053
+ decideDecisionMaker: this.ctx.spurConfig?.workflow?.decideDecisionMaker === true,
84054
+ ...this.ctx.decisionMaker !== undefined ? { decideMaker: this.ctx.decisionMaker } : {},
84055
+ fleetDispatchDeps,
83526
84056
  ...this.ctx.secretValues !== undefined ? { secretValues: this.ctx.secretValues } : {}
83527
84057
  });
83528
84058
  if (opts.extensions !== undefined) {
@@ -83680,6 +84210,47 @@ function collectAgentRunRoleViolations(def) {
83680
84210
  }
83681
84211
  return violations;
83682
84212
  }
84213
+ function collectTerminalReasonViolations(def) {
84214
+ if (def.kind === "transition-flow" || def.kind === undefined)
84215
+ return [];
84216
+ const smDef = def;
84217
+ const failureStates = new Set(smDef.failureStates ?? []);
84218
+ const violations = [];
84219
+ for (const transition of smDef.transitions ?? []) {
84220
+ if (!failureStates.has(transition.to))
84221
+ continue;
84222
+ if (transition.terminalReason === undefined || !isTerminalReason(transition.terminalReason)) {
84223
+ violations.push(`transition ${transition.from} -> ${transition.to} enters a failureState without a declared terminalReason` + ` \u2014 add \`terminalReason: <enum>\` (accepted: ${TERMINAL_REASONS.join(", ")}; 0937 R3)`);
84224
+ }
84225
+ }
84226
+ return violations;
84227
+ }
84228
+ function collectDecideViolations(def) {
84229
+ const violations = [];
84230
+ const visitAction = (stateId, action, idx) => {
84231
+ if (action.kind !== DECIDE_KIND)
84232
+ return;
84233
+ const parsed = DecideOptionsSchema.safeParse(action.options ?? {});
84234
+ if (!parsed.success) {
84235
+ const location = `${stateId}/${DECIDE_KIND}[${idx}]`;
84236
+ violations.push(`Invalid decide action at ${location}: ${parsed.error.issues.map((i2) => i2.message).join("; ")}`);
84237
+ }
84238
+ };
84239
+ if (def.kind === "transition-flow" || def.kind === undefined) {
84240
+ const flowDef = def;
84241
+ for (const node of flowDef.nodes ?? []) {
84242
+ if (node.action)
84243
+ visitAction(node.id, node.action, 0);
84244
+ }
84245
+ } else {
84246
+ const smDef = def;
84247
+ for (const state of smDef.states ?? []) {
84248
+ for (const [i2, action] of (state.onEnter ?? []).entries())
84249
+ visitAction(state.id, action, i2);
84250
+ }
84251
+ }
84252
+ return violations;
84253
+ }
83683
84254
  function hitlAnswerVar(kind, options) {
83684
84255
  return typeof options?.var === "string" && options.var.trim() !== "" ? options.var : HITL_ANSWER_VAR_DEFAULTS[kind] ?? "__hitlAnswer";
83685
84256
  }
@@ -83989,6 +84560,12 @@ function mergeWorkflowRunVars(declared, overrides) {
83989
84560
  }
83990
84561
  return { ...base2, ...user };
83991
84562
  }
84563
+ function mapFleetExecutorVar(callerVars) {
84564
+ if (callerVars?.agent !== "fleet")
84565
+ return callerVars ?? {};
84566
+ const { agent: _agent, ...rest } = callerVars;
84567
+ return { ...rest, executor: "fleet" };
84568
+ }
83992
84569
  function resolveDefaultAgentVar(config4, callerVars, warn) {
83993
84570
  const result = {};
83994
84571
  if (callerVars?.implementAgent === undefined && callerVars?.agent !== undefined) {
@@ -84024,8 +84601,8 @@ function resolveOutputLogConfig(config4) {
84024
84601
  }
84025
84602
  async function outputArtifactForRun(cwd, runId) {
84026
84603
  for (const name of [`${runId}.md`, `${runId}.log`]) {
84027
- const relative2 = join19(".spur", "run", name);
84028
- if (await fileExists(join19(cwd, relative2)))
84604
+ const relative2 = join20(".spur", "run", name);
84605
+ if (await fileExists(join20(cwd, relative2)))
84029
84606
  return relative2;
84030
84607
  }
84031
84608
  return;
@@ -84034,8 +84611,8 @@ function readWorkflowRunRecord(runDir, runId) {
84034
84611
  if (runId.includes("/") || runId.includes("\\") || runId.includes("..")) {
84035
84612
  throw new InvalidWorkflowRunIdError(runId);
84036
84613
  }
84037
- const markdownPath = join19(runDir, `${runId}.md`);
84038
- const statePath = join19(runDir, `${runId}.state.json`);
84614
+ const markdownPath = join20(runDir, `${runId}.md`);
84615
+ const statePath = join20(runDir, `${runId}.state.json`);
84039
84616
  if (existsSync5(markdownPath)) {
84040
84617
  let raw;
84041
84618
  try {
@@ -84052,7 +84629,7 @@ function readWorkflowRunRecord(runDir, runId) {
84052
84629
  } catch {}
84053
84630
  return { kind: "incomplete", markdownPath, statePath, reason: "state-invalid" };
84054
84631
  }
84055
- const legacyLogPath = join19(runDir, `${runId}.log`);
84632
+ const legacyLogPath = join20(runDir, `${runId}.log`);
84056
84633
  if (existsSync5(legacyLogPath))
84057
84634
  return { kind: "legacy-log", logPath: legacyLogPath };
84058
84635
  return { kind: "missing" };
@@ -84389,7 +84966,7 @@ function projectDecisionProvenance(value, secretValues) {
84389
84966
  async function partialArtifactForAction(cwd, runId, node, ok) {
84390
84967
  if (ok !== false || !TRACE_IDENTIFIER.test(runId) || !TRACE_IDENTIFIER.test(node))
84391
84968
  return;
84392
- const relativePath2 = join19(".spur", "run", `${runId}-${node}-partial.md`);
84969
+ const relativePath2 = join20(".spur", "run", `${runId}-${node}-partial.md`);
84393
84970
  return await fileExists(resolve9(cwd, relativePath2)) ? relativePath2 : undefined;
84394
84971
  }
84395
84972
  var TASK_PIPELINE_WORKFLOW = "task-pipeline", PIPELINE_LINK_KIND = "pipeline", COMPOSITION_CAPS, HITL_DECISION_KINDS, HITL_ANSWER_VAR_DEFAULTS, STRUCTURE_TOKENS, InvalidWorkflowRunIdError, RUN_RECORD_INSPECT_MAX_BYTES, RUN_RECORD_INSPECT_MAX_CHARS, TRACE_IDENTIFIER, TRACE_RESULT_FIELDS, TRACE_INVOCATION_FIELDS;
@@ -84403,16 +84980,21 @@ var init_workflow_service = __esm(() => {
84403
84980
  init_dist();
84404
84981
  init_agent_execution();
84405
84982
  init_action_trace();
84983
+ init_decide2();
84406
84984
  init_hitl_select();
84407
84985
  init_run_path();
84408
84986
  init_builtins2();
84409
84987
  init_checkpoint_contract();
84410
84988
  init_composition_baseline();
84411
84989
  init_decision_hitl_responder();
84990
+ init_fleet_dispatch();
84412
84991
  init_observability();
84413
84992
  init_progress_projection();
84993
+ init_terminal_reason();
84414
84994
  init_workflow_resolver();
84995
+ init_agent_coordination_service();
84415
84996
  init_event_bridge();
84997
+ init_fleet_service();
84416
84998
  init_system_event_envelope();
84417
84999
  init_workflow_resolver();
84418
85000
  COMPOSITION_CAPS = {
@@ -84467,7 +85049,7 @@ var init_workflow_service = __esm(() => {
84467
85049
  // ../../packages/app/src/services/agent-service.ts
84468
85050
  import { createHash as createHash9 } from "crypto";
84469
85051
  import { homedir as homedir5 } from "os";
84470
- import { basename as basename5, join as join20 } from "path";
85052
+ import { basename as basename5, join as join21 } from "path";
84471
85053
  import { isatty as isatty3 } from "tty";
84472
85054
 
84473
85055
  class AgentService {
@@ -85666,12 +86248,12 @@ class AgentService {
85666
86248
  }
85667
86249
  async resolveArtifactRefs(runId) {
85668
86250
  const refs = [];
85669
- const runDir = join20(this.ctx.cwd, ".spur", "run");
86251
+ const runDir = join21(this.ctx.cwd, ".spur", "run");
85670
86252
  const record3 = readWorkflowRunRecord(runDir, runId);
85671
86253
  if (record3.kind === "pair" || record3.kind === "incomplete") {
85672
- refs.push({ kind: "log", path: join20(".spur", "run", basename5(record3.markdownPath)) });
86254
+ refs.push({ kind: "log", path: join21(".spur", "run", basename5(record3.markdownPath)) });
85673
86255
  } else if (record3.kind === "legacy-log") {
85674
- refs.push({ kind: "log", path: join20(".spur", "run", basename5(record3.logPath)) });
86256
+ refs.push({ kind: "log", path: join21(".spur", "run", basename5(record3.logPath)) });
85675
86257
  }
85676
86258
  return refs;
85677
86259
  }
@@ -86160,7 +86742,7 @@ var init_agent_service = __esm(() => {
86160
86742
  import { existsSync as existsSync6, mkdirSync as mkdirSync6, readFileSync as readFileSync10, realpathSync as realpathSync4, renameSync as renameSync5, rmSync as rmSync4, writeFileSync as writeFileSync5 } from "fs";
86161
86743
  import { connect, createServer } from "net";
86162
86744
  import { homedir as homedir6 } from "os";
86163
- import { dirname as dirname13, join as join21, resolve as resolve10 } from "path";
86745
+ import { dirname as dirname13, join as join22, resolve as resolve10 } from "path";
86164
86746
  function setProcessHelpersForTests(helpers) {
86165
86747
  testPidFinder = helpers?.pidFinder;
86166
86748
  testProcessKiller = helpers?.processKiller;
@@ -86225,7 +86807,7 @@ function normalizeProjectPath(pathInput) {
86225
86807
  if (trimmed === "~") {
86226
86808
  expanded = homedir6();
86227
86809
  } else if (trimmed.startsWith("~/")) {
86228
- expanded = join21(homedir6(), trimmed.slice(2));
86810
+ expanded = join22(homedir6(), trimmed.slice(2));
86229
86811
  } else {
86230
86812
  expanded = resolve10(trimmed);
86231
86813
  }
@@ -86582,7 +87164,7 @@ var init_project_registry = __esm(() => {
86582
87164
  });
86583
87165
 
86584
87166
  // ../../packages/app/src/services/fleet-service.ts
86585
- import { basename as basename6, dirname as dirname14, join as join22 } from "path";
87167
+ import { basename as basename6, dirname as dirname14, join as join23 } from "path";
86586
87168
  function resolveMemberExecutor(params) {
86587
87169
  const { member, index: index2, label, agentConfig, roles, roster } = params;
86588
87170
  if (member.executor !== undefined) {
@@ -86802,7 +87384,7 @@ class FleetService {
86802
87384
  }
86803
87385
  const slug = await this.projectSlug(normalized);
86804
87386
  const config4 = await this.effectiveConfig();
86805
- const configDir = join22(normalized, ".spur", "agents");
87387
+ const configDir = join23(normalized, ".spur", "agents");
86806
87388
  const specs = await loadAgentSpecs(configDir);
86807
87389
  const projection = materializeRoster({
86808
87390
  slug,
@@ -86856,7 +87438,7 @@ class FleetService {
86856
87438
  }
86857
87439
  async assertLaunchGroundTruth(projectPath) {
86858
87440
  const expected = normalizeProjectPath(projectPath);
86859
- const expectedStorageRoot = join22(expected, ".spur");
87441
+ const expectedStorageRoot = join23(expected, ".spur");
86860
87442
  const cwd = normalizeProjectPath(process.cwd());
86861
87443
  const storageRoot = normalizeProjectPath(this.fs.resolve(".spur"));
86862
87444
  const databasePath = this.ctx.openDb ? await new ProjectClaimDao(await this.ctx.openDb(expected)).databasePath() : "";
@@ -86876,7 +87458,7 @@ var init_fleet_service = __esm(() => {
86876
87458
  });
86877
87459
 
86878
87460
  // ../../packages/app/src/services/agent-coordination-service.ts
86879
- import { join as join23 } from "path";
87461
+ import { join as join24 } from "path";
86880
87462
 
86881
87463
  class AgentCoordinationService {
86882
87464
  ctx;
@@ -86884,7 +87466,7 @@ class AgentCoordinationService {
86884
87466
  orchestratorPromise;
86885
87467
  constructor(ctx) {
86886
87468
  this.ctx = ctx;
86887
- this.configDir = join23(ctx.cwd, ".spur", "agents");
87469
+ this.configDir = join24(ctx.cwd, ".spur", "agents");
86888
87470
  }
86889
87471
  async sendMessage(fromId, toId, body, replyTo, requestKey) {
86890
87472
  validateAgentId(toId);
@@ -87150,7 +87732,7 @@ class AgentCoordinationService {
87150
87732
  async resolveTaskFile(taskId) {
87151
87733
  const fs3 = this.ctx.fs;
87152
87734
  const { foldersConfig } = await resolvePlanningFolders(fs3);
87153
- const dirs = [...new Set([foldersConfig.active_folder, ...Object.keys(foldersConfig.folders)])].map((dir) => join23(this.ctx.cwd, dir));
87735
+ const dirs = [...new Set([foldersConfig.active_folder, ...Object.keys(foldersConfig.folders)])].map((dir) => join24(this.ctx.cwd, dir));
87154
87736
  return await TaskLocator.forDirs(fs3, dirs).findPathByWbs(taskId);
87155
87737
  }
87156
87738
  }
@@ -87845,7 +88427,7 @@ var init_agent_usage_source = __esm(() => {
87845
88427
  });
87846
88428
 
87847
88429
  // ../../packages/app/src/services/anchor-qualifier.ts
87848
- import { basename as basename7, join as join24 } from "path";
88430
+ import { basename as basename7, join as join25 } from "path";
87849
88431
  async function resolveRepoRoot(projectRoot, hintDir) {
87850
88432
  if (projectRoot)
87851
88433
  return projectRoot;
@@ -87974,7 +88556,7 @@ async function qualifyAnchors(fs3, opts) {
87974
88556
  } catch {
87975
88557
  continue;
87976
88558
  }
87977
- const mdFiles = entries.filter((name) => name.endsWith(".md") && name !== "kanban.md").map((name) => join24(dir, name)).sort();
88559
+ const mdFiles = entries.filter((name) => name.endsWith(".md") && name !== "kanban.md").map((name) => join25(dir, name)).sort();
87978
88560
  for (const filePath of mdFiles) {
87979
88561
  let raw;
87980
88562
  try {
@@ -88103,7 +88685,7 @@ var init_bounded_child_run = __esm(() => {
88103
88685
  });
88104
88686
 
88105
88687
  // ../../packages/app/src/workflow/feature-verification-receipt.ts
88106
- import { basename as basename8, join as join25 } from "path";
88688
+ import { basename as basename8, join as join26 } from "path";
88107
88689
  function assertReceiptId(kind, id) {
88108
88690
  if (!RECEIPT_ID_PATTERN.test(id) || id.includes("..")) {
88109
88691
  throw new Error(`invalid ${kind} for receipt path: ${JSON.stringify(id)}`);
@@ -88113,10 +88695,10 @@ function featureReceiptPaths(runDir, featureId2, runId) {
88113
88695
  assertReceiptId("featureId", featureId2);
88114
88696
  assertReceiptId("runId", runId);
88115
88697
  return {
88116
- runScoped: join25(runDir, `${runId}-feature-verification.json`),
88117
- featureScoped: join25(runDir, `${featureId2}-feature-verification.json`),
88118
- log: join25(runDir, `${runId}-feature-verification.log`),
88119
- status: join25(runDir, `${runId}-feature-verification.status`)
88698
+ runScoped: join26(runDir, `${runId}-feature-verification.json`),
88699
+ featureScoped: join26(runDir, `${featureId2}-feature-verification.json`),
88700
+ log: join26(runDir, `${runId}-feature-verification.log`),
88701
+ status: join26(runDir, `${runId}-feature-verification.status`)
88120
88702
  };
88121
88703
  }
88122
88704
  async function atomicWriteReceipt(fs3, path9, receipt) {
@@ -88199,7 +88781,7 @@ async function readReceiptCopy(fs3, path9, label) {
88199
88781
  async function validateFeatureVerificationReceipt(fs3, options) {
88200
88782
  let latest;
88201
88783
  try {
88202
- latest = await readReceiptCopy(fs3, join25(options.runDir, `${options.featureId}-feature-verification.json`), "feature-latest");
88784
+ latest = await readReceiptCopy(fs3, join26(options.runDir, `${options.featureId}-feature-verification.json`), "feature-latest");
88203
88785
  } catch (err) {
88204
88786
  const message = String(err);
88205
88787
  return {
@@ -88295,11 +88877,13 @@ async function validateFeatureVerificationReceipt(fs3, options) {
88295
88877
  }
88296
88878
  }
88297
88879
  const verifier = latest.verifier;
88298
- if (verifier.name !== options.currentVerifier.name || verifier.sourcePath !== options.currentVerifier.sourcePath || verifier.layer !== options.currentVerifier.layer || verifier.definitionDigest !== options.currentVerifier.definitionDigest) {
88880
+ const current = options.currentVerifier;
88881
+ const drifted = ["name", "layer", "definitionDigest"].filter((k) => verifier[k] !== current[k]);
88882
+ if (drifted.length > 0) {
88299
88883
  return {
88300
88884
  ok: false,
88301
88885
  reason: "contract-mismatch",
88302
- detail: `receipt recorded verifier ${verifier.name}@${verifier.layer} (${verifier.definitionDigest}), completion evaluates ${options.currentVerifier.name}@${options.currentVerifier.layer} (${options.currentVerifier.definitionDigest}) \u2014 the selected definition changed after the pass`
88886
+ detail: `receipt recorded verifier ${verifier.name}@${verifier.layer} (${verifier.definitionDigest}), completion evaluates ${current.name}@${current.layer} (${current.definitionDigest}) \u2014 the selected definition changed after the pass (${drifted.join(", ")})`
88303
88887
  };
88304
88888
  }
88305
88889
  if (latest.verificationCmd !== options.currentVerificationCmd) {
@@ -89298,7 +89882,7 @@ __export(exports_feature_check, {
89298
89882
  FeatureCheckService: () => FeatureCheckService,
89299
89883
  DEFAULT_FEATURE_MATRIX: () => DEFAULT_FEATURE_MATRIX
89300
89884
  });
89301
- import { dirname as dirname16, join as join26 } from "path";
89885
+ import { dirname as dirname16, join as join27 } from "path";
89302
89886
  function isGroupFeature(fm) {
89303
89887
  const tags = fm.tags;
89304
89888
  return Array.isArray(tags) && tags.includes("group") ? "group" : "standard";
@@ -89396,9 +89980,9 @@ function decodeVerdictRows(source, sectionName, required2) {
89396
89980
  function defaultVerdictRunDir(tasksDir) {
89397
89981
  const norm = tasksDir.replace(/\\/g, "/");
89398
89982
  if (/\/docs\/tasks\d*$/.test(norm) || /\/docs\/tasks$/.test(norm)) {
89399
- return join26(dirname16(dirname16(tasksDir)), ".spur", "run");
89983
+ return join27(dirname16(dirname16(tasksDir)), ".spur", "run");
89400
89984
  }
89401
- return join26(dirname16(tasksDir), ".spur", "run");
89985
+ return join27(dirname16(tasksDir), ".spur", "run");
89402
89986
  }
89403
89987
  function rowMatchesScenario(id, sc) {
89404
89988
  const stripped = id.replace(/^\[[^\]]*\]\s*/, "").replace(/^Scenario:\s*/i, "").replace(/^\[[^\]]*\]\s*/, "").trim();
@@ -89543,7 +90127,7 @@ var init_feature_check = __esm(() => {
89543
90127
  if (options?.asStatus === "done" && options?.runDir) {
89544
90128
  await this.checkFeatureVerificationReceipt(featureId2, raw, options.runDir, findings, options.receiptRunPort);
89545
90129
  }
89546
- const dogfoodDir = options?.dogfoodDir ?? (options?.featuresDir ? join26(dirname16(options.featuresDir), "dogfood") : undefined);
90130
+ const dogfoodDir = options?.dogfoodDir ?? (options?.featuresDir ? join27(dirname16(options.featuresDir), "dogfood") : undefined);
89547
90131
  const primaryTasksDir = options?.tasksDir ?? options?.tasksDirs?.[0];
89548
90132
  const runDir = options?.runDir ?? (primaryTasksDir ? defaultVerdictRunDir(primaryTasksDir) : undefined);
89549
90133
  const taskScanDirs = options?.tasksDirs && options.tasksDirs.length > 0 ? options.tasksDirs : options?.tasksDir ? [options.tasksDir] : [];
@@ -89667,7 +90251,7 @@ var init_feature_check = __esm(() => {
89667
90251
  }
89668
90252
  let learningsContent;
89669
90253
  try {
89670
- learningsContent = await this.fs.readFile(join26(process.cwd(), ".spur", "context", "learnings.md"));
90254
+ learningsContent = await this.fs.readFile(join27(process.cwd(), ".spur", "context", "learnings.md"));
89671
90255
  } catch {
89672
90256
  learningsContent = undefined;
89673
90257
  }
@@ -90044,7 +90628,7 @@ var init_feature_check = __esm(() => {
90044
90628
  });
90045
90629
 
90046
90630
  // ../../packages/app/src/services/task-check.ts
90047
- import { basename as basename9, dirname as dirname17, join as join27 } from "path";
90631
+ import { basename as basename9, dirname as dirname17, join as join28 } from "path";
90048
90632
  function isPlaceholderBody(body) {
90049
90633
  const stripped = body.replace(/<!--[\s\S]*?-->/g, "").replace(/^\s*>\s*TBD\s*$/gim, "").trim();
90050
90634
  return stripped.length === 0;
@@ -90308,7 +90892,7 @@ var init_task_check = __esm(() => {
90308
90892
  this.runL2(doc2, entry, findings, raw);
90309
90893
  this.runL3(doc2, entry, effectiveStatus, findings, isTransitionTarget);
90310
90894
  const tasksDir = dirname17(filePath);
90311
- const featuresDir = join27(dirname17(tasksDir), "features");
90895
+ const featuresDir = join28(dirname17(tasksDir), "features");
90312
90896
  await this.runL4(doc2, fm, effectiveStatus, findings, featuresDir, tasksDir, wbs);
90313
90897
  await this.runL4Rollup(doc2, wbs, effectiveStatus, findings, tasksDir);
90314
90898
  if (effectiveStatus !== "done" && effectiveStatus !== "cancelled") {
@@ -90883,7 +91467,7 @@ var init_task_check = __esm(() => {
90883
91467
  for (const cite of citations) {
90884
91468
  if (reported >= 5)
90885
91469
  break;
90886
- const abs = join27(projectRoot, cite.path);
91470
+ const abs = join28(projectRoot, cite.path);
90887
91471
  let exists2 = false;
90888
91472
  try {
90889
91473
  exists2 = await this.fs.exists(abs);
@@ -90967,7 +91551,7 @@ var init_task_check = __esm(() => {
90967
91551
  continue;
90968
91552
  }
90969
91553
  try {
90970
- const abs = join27(dir, name);
91554
+ const abs = join28(dir, name);
90971
91555
  const stat2 = await this.fs.stat(abs);
90972
91556
  if (stat2 !== null && stat2 !== undefined && stat2.isDirectory?.())
90973
91557
  stack.push(abs);
@@ -91062,7 +91646,7 @@ var init_task_check = __esm(() => {
91062
91646
  }
91063
91647
  async checkVerdictArtifact(wbs, tasksDir, findings) {
91064
91648
  const projectRoot = resolveProjectRootFromTasksDir(tasksDir);
91065
- const runDir = join27(projectRoot, ".spur", "run");
91649
+ const runDir = join28(projectRoot, ".spur", "run");
91066
91650
  const verdictPath = `${runDir}/${wbs}-verdict.json`;
91067
91651
  const outcome = await readVerifyVerdict(this.fs, verdictPath, wbs);
91068
91652
  if (outcome.kind === "missing")
@@ -91107,13 +91691,13 @@ var init_task_check = __esm(() => {
91107
91691
  });
91108
91692
 
91109
91693
  // ../../packages/app/src/services/corpus-check.ts
91110
- import { basename as basename10, dirname as dirname18, join as join28, relative as relative2, resolve as resolve11 } from "path";
91694
+ import { basename as basename10, dirname as dirname18, join as join29, relative as relative2, resolve as resolve11 } from "path";
91111
91695
  async function loadTaskMatrix(projectRoot) {
91112
91696
  const fs3 = createNodeFileSystem3(projectRoot);
91113
- const candidates = [join28(projectRoot, ".spur", "tasks", "section-matrix.yaml")];
91697
+ const candidates = [join29(projectRoot, ".spur", "tasks", "section-matrix.yaml")];
91114
91698
  const bundledRoot = bundledConfigRoot();
91115
91699
  if (bundledRoot !== null)
91116
- candidates.push(join28(bundledRoot, "tasks", "section-matrix.yaml"));
91700
+ candidates.push(join29(bundledRoot, "tasks", "section-matrix.yaml"));
91117
91701
  let matrixPath;
91118
91702
  for (const candidate of candidates) {
91119
91703
  if (await fs3.exists(candidate)) {
@@ -91156,7 +91740,7 @@ async function structuralSweep(projectRoot) {
91156
91740
  const wbs = fileName.match(/^(\d{4})_.+\.md$/)?.[1];
91157
91741
  if (wbs === undefined)
91158
91742
  continue;
91159
- const result = await taskService.check(join28(tasksDir, fileName), wbs);
91743
+ const result = await taskService.check(join29(tasksDir, fileName), wbs);
91160
91744
  for (const finding of result.findings) {
91161
91745
  findings.push({
91162
91746
  kind: "task",
@@ -91174,7 +91758,7 @@ async function structuralSweep(projectRoot) {
91174
91758
  const id = fileName.match(/^([A-Z][0-9]*)_.+\.md$/)?.[1];
91175
91759
  if (id === undefined)
91176
91760
  continue;
91177
- const result = await featureService.check(join28(featuresDir, fileName), id, {
91761
+ const result = await featureService.check(join29(featuresDir, fileName), id, {
91178
91762
  featuresDir,
91179
91763
  tasksDir: activeTasksDir,
91180
91764
  tasksDirs: taskDirs,
@@ -91203,7 +91787,7 @@ async function duplicateIds(cwd, taskDirs, featuresDir) {
91203
91787
  return [];
91204
91788
  }
91205
91789
  const pattern = kind === "task" ? /^(\d{4})_/ : /^([A-Z][0-9]*)_/;
91206
- return names.map((n3) => ({ m: n3.match(pattern), n: n3 })).filter((x) => x.m !== null).map((x) => ({ id: x.m[1], file: relative2(cwd, join28(dir, x.n)), kind }));
91790
+ return names.map((n3) => ({ m: n3.match(pattern), n: n3 })).filter((x) => x.m !== null).map((x) => ({ id: x.m[1], file: relative2(cwd, join29(dir, x.n)), kind }));
91207
91791
  };
91208
91792
  const all = [
91209
91793
  ...(await Promise.all(taskDirs.map((dir) => scan(dir, "task")))).flat(),
@@ -91257,7 +91841,7 @@ function resolveProjectRoot(cwd) {
91257
91841
  const fs3 = createNodeFileSystem3(cwd);
91258
91842
  let current = resolve11(cwd);
91259
91843
  while (true) {
91260
- if (fs3.exists(join28(current, ".spur", "config.yaml"))) {
91844
+ if (fs3.exists(join29(current, ".spur", "config.yaml"))) {
91261
91845
  return current;
91262
91846
  }
91263
91847
  const parent = dirname18(current);
@@ -91279,14 +91863,14 @@ function diskReader(cwd) {
91279
91863
  return {
91280
91864
  list: async (dir) => {
91281
91865
  try {
91282
- return (await fs3.readDir(join28(cwd, dir))).map((n3) => `${dir}/${n3}`);
91866
+ return (await fs3.readDir(join29(cwd, dir))).map((n3) => `${dir}/${n3}`);
91283
91867
  } catch {
91284
91868
  return [];
91285
91869
  }
91286
91870
  },
91287
91871
  read: async (path9) => {
91288
91872
  try {
91289
- return await fs3.readFile(join28(cwd, path9));
91873
+ return await fs3.readFile(join29(cwd, path9));
91290
91874
  } catch {
91291
91875
  return null;
91292
91876
  }
@@ -91446,7 +92030,7 @@ var init_corpus_check = __esm(() => {
91446
92030
  });
91447
92031
 
91448
92032
  // ../../packages/app/src/services/corpus-migrator.ts
91449
- import { join as join29, relative as relative3 } from "path";
92033
+ import { join as join30, relative as relative3 } from "path";
91450
92034
  function applyM1(data, flags) {
91451
92035
  const raw = data.status;
91452
92036
  if (typeof raw !== "string")
@@ -91746,7 +92330,7 @@ class CorpusMigrator {
91746
92330
  }
91747
92331
  async discoverFiles() {
91748
92332
  const entries = await this.fs.readDir(this.corpusDir);
91749
- return entries.filter((name) => name.endsWith(".md")).filter((name) => name !== "kanban.md").map((name) => join29(this.corpusDir, name)).sort();
92333
+ return entries.filter((name) => name.endsWith(".md")).filter((name) => name !== "kanban.md").map((name) => join30(this.corpusDir, name)).sort();
91750
92334
  }
91751
92335
  async migrateFile(filePath, dryRun, gitDates = new Map) {
91752
92336
  const flags = [];
@@ -95968,7 +96552,7 @@ import {
95968
96552
  writeFileSync as writeFileSync6
95969
96553
  } from "fs";
95970
96554
  import { homedir as homedir7 } from "os";
95971
- import { dirname as dirname19, isAbsolute as isAbsolute6, join as join30, resolve as resolve12, sep as sep5 } from "path";
96555
+ import { dirname as dirname19, isAbsolute as isAbsolute6, join as join31, resolve as resolve12, sep as sep5 } from "path";
95972
96556
  function parseImporterVersion(version3) {
95973
96557
  if (version3 === undefined) {
95974
96558
  return null;
@@ -96023,7 +96607,7 @@ async function buildRefreshCoverage(db2, selector, fanOut) {
96023
96607
  async function runSessionAugmentedRoots(source, home, cwd, dao2) {
96024
96608
  const roots = getSourceDefinition(source).defaultRoots.map((root) => resolve12(home, root));
96025
96609
  const runRoots = [];
96026
- const runRoot = join30(cwd, ".spur", "run");
96610
+ const runRoot = join31(cwd, ".spur", "run");
96027
96611
  if (!existsSync7(runRoot))
96028
96612
  return { roots, runRoots };
96029
96613
  const sourcesByRun = new Map;
@@ -96033,7 +96617,7 @@ async function runSessionAugmentedRoots(source, home, cwd, dao2) {
96033
96617
  sourcesByRun.set(row.run_id, sources);
96034
96618
  }
96035
96619
  for (const runId of readdirSync6(runRoot)) {
96036
- const sessionsRoot = join30(runRoot, runId, "agent-sessions");
96620
+ const sessionsRoot = join31(runRoot, runId, "agent-sessions");
96037
96621
  if (!existsSync7(sessionsRoot))
96038
96622
  continue;
96039
96623
  const mappedSources = sourcesByRun.get(runId);
@@ -96042,7 +96626,7 @@ async function runSessionAugmentedRoots(source, home, cwd, dao2) {
96042
96626
  const soleMappedSource = mappedSources?.size === 1 && mappedSources.has(source);
96043
96627
  if (!directMatch && !soleMappedSource)
96044
96628
  continue;
96045
- const root = realpathSync5(join30(sessionsRoot, agent));
96629
+ const root = realpathSync5(join31(sessionsRoot, agent));
96046
96630
  roots.push(root);
96047
96631
  runRoots.push({ runId, root });
96048
96632
  }
@@ -96130,7 +96714,7 @@ class HistoryService {
96130
96714
  }
96131
96715
  async maintain(opts = {}) {
96132
96716
  const db2 = await this.ctx.getDb();
96133
- const dbPath = this.ctx.cwd ? join30(this.ctx.cwd, ".spur", "spur.db") : undefined;
96717
+ const dbPath = this.ctx.cwd ? join31(this.ctx.cwd, ".spur", "spur.db") : undefined;
96134
96718
  return maintainDatabase(db2, {
96135
96719
  ...opts,
96136
96720
  ...dbPath && opts.dbPath === undefined ? { dbPath } : {}
@@ -96638,9 +97222,9 @@ function resolveArtifactPaths(artifact, opts) {
96638
97222
  return { artifactPath: out, sidecarPath: `${out.replace(/\.json$/, "")}.errors.jsonl` };
96639
97223
  }
96640
97224
  const base2 = resolve12(opts.cwd, ".spur", "reports", "history");
96641
- const dateDir = join30(base2, artifact.generatedAt.slice(0, 10));
97225
+ const dateDir = join31(base2, artifact.generatedAt.slice(0, 10));
96642
97226
  const name = `analyze-${selectorDigest(artifact.selector)}`;
96643
- return { artifactPath: join30(dateDir, `${name}.json`), sidecarPath: join30(dateDir, `${name}.errors.jsonl`) };
97227
+ return { artifactPath: join31(dateDir, `${name}.json`), sidecarPath: join31(dateDir, `${name}.errors.jsonl`) };
96644
97228
  }
96645
97229
  function boundCoverage(coverage) {
96646
97230
  const overflow = [];
@@ -96663,7 +97247,7 @@ function boundCoverage(coverage) {
96663
97247
  }
96664
97248
  function updateLatestPointer(opts, artifactPath) {
96665
97249
  const base2 = resolve12(opts.cwd, ".spur", "reports", "history");
96666
- const latest = join30(base2, "latest.json");
97250
+ const latest = join31(base2, "latest.json");
96667
97251
  mkdirSync7(base2, { recursive: true });
96668
97252
  if (existsSync7(latest))
96669
97253
  unlinkSync3(latest);
@@ -96729,7 +97313,7 @@ function formatIssue(issue2) {
96729
97313
  return `${issue2.sourceFile}:${issue2.sourceLine}: ${issue2.reason}`;
96730
97314
  }
96731
97315
  function pruneReports(cwd, retentionDays = REPORT_RETENTION_DAYS, now2 = new Date) {
96732
- const dir = join30(cwd, ".spur", "reports", "history");
97316
+ const dir = join31(cwd, ".spur", "reports", "history");
96733
97317
  let entries;
96734
97318
  try {
96735
97319
  entries = readdirSync6(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
@@ -96747,7 +97331,7 @@ function pruneReports(cwd, retentionDays = REPORT_RETENTION_DAYS, now2 = new Dat
96747
97331
  if (entryDate >= cutoff)
96748
97332
  continue;
96749
97333
  try {
96750
- rmSync5(join30(dir, name), { recursive: true, force: true });
97334
+ rmSync5(join31(dir, name), { recursive: true, force: true });
96751
97335
  pruned.push(name);
96752
97336
  } catch {}
96753
97337
  }
@@ -96866,7 +97450,7 @@ function renderEventTrace(events2) {
96866
97450
  }
96867
97451
 
96868
97452
  // ../../packages/app/src/services/inline-run-setup.ts
96869
- import { join as join31, resolve as resolve13 } from "path";
97453
+ import { join as join32, resolve as resolve13 } from "path";
96870
97454
  function parseIdentityMetadata(raw) {
96871
97455
  if (raw.trim() === "")
96872
97456
  return {};
@@ -96880,8 +97464,8 @@ function parseIdentityMetadata(raw) {
96880
97464
  }
96881
97465
  }
96882
97466
  async function openInlineRunProjectDb(workdir) {
96883
- const url2 = join31(resolve13(workdir), ".spur", "spur.db");
96884
- mkdirSync8(join31(url2, ".."), { recursive: true });
97467
+ const url2 = join32(resolve13(workdir), ".spur", "spur.db");
97468
+ mkdirSync8(join32(url2, ".."), { recursive: true });
96885
97469
  const adapter = await createMigratedDb({ url: url2 });
96886
97470
  return { adapter, close: () => adapter.close() };
96887
97471
  }
@@ -97012,13 +97596,54 @@ async function createOrAttachInlineRun(input) {
97012
97596
  status: "running"
97013
97597
  };
97014
97598
  }
97015
- var mkdirSync8;
97599
+ async function runDecideForInlineRun(input) {
97600
+ const optionsFile = join32(resolve13(input.workdir), input.optionsFile);
97601
+ let raw;
97602
+ try {
97603
+ raw = JSON.parse(await readFile3(optionsFile, "utf8"));
97604
+ } catch (error51) {
97605
+ return { ok: false, error: `decide: unreadable options file ${input.optionsFile}: ${String(error51)}` };
97606
+ }
97607
+ const parsed = DecideOptionsSchema.safeParse(raw);
97608
+ if (!parsed.success) {
97609
+ return {
97610
+ ok: false,
97611
+ error: `decide: invalid options \u2014 ${parsed.error.issues.map((i2) => i2.message).join("; ")}`
97612
+ };
97613
+ }
97614
+ const runner = new DecideActionRunner(createNodeFileSystem3(), { enabled: input.enabled });
97615
+ const result = await runner.execute(raw, {
97616
+ runId: "inline-decide",
97617
+ stateOrNodeId: "decide",
97618
+ workdir: resolve13(input.workdir),
97619
+ vars: {},
97620
+ env: {}
97621
+ });
97622
+ if (!result.ok || result.data === undefined) {
97623
+ return { ok: false, error: result.error ?? "decide: action failed without an error message" };
97624
+ }
97625
+ const decision = result.data.decision;
97626
+ return {
97627
+ ok: true,
97628
+ value: decision.value,
97629
+ degraded: decision.degraded,
97630
+ reason: decision.reason,
97631
+ backend: decision.backend,
97632
+ confidence: decision.confidence,
97633
+ resultFile: join32(resolve13(input.workdir), parsed.data.resultFile),
97634
+ durationMs: decision.durationMs
97635
+ };
97636
+ }
97637
+ var mkdirSync8, readFile3;
97016
97638
  var init_inline_run_setup = __esm(async () => {
97017
97639
  init_src2();
97018
97640
  init_dist8();
97641
+ init_dist5();
97642
+ init_decide2();
97019
97643
  init_workflow_resolver();
97020
97644
  init_workflow_service();
97021
97645
  ({ mkdirSync: mkdirSync8 } = await import("fs"));
97646
+ ({ readFile: readFile3 } = await import("fs/promises"));
97022
97647
  });
97023
97648
 
97024
97649
  // ../../packages/app/src/services/job-worker-service.ts
@@ -97133,7 +97758,7 @@ async function waitForOccupant(deps, opts) {
97133
97758
  }
97134
97759
  const next = await Promise.race([
97135
97760
  pending,
97136
- deps.sleep(Math.min(POLL_INTERVAL_MS, Math.max(0, deadline - clock))).then(() => HEARTBEAT)
97761
+ deps.sleep(Math.min(POLL_INTERVAL_MS2, Math.max(0, deadline - clock))).then(() => HEARTBEAT)
97137
97762
  ]);
97138
97763
  if (next === HEARTBEAT) {} else {
97139
97764
  if (next.done === true) {
@@ -97171,7 +97796,7 @@ async function waitForOccupant(deps, opts) {
97171
97796
  }
97172
97797
  }
97173
97798
  }
97174
- var WaitError, POLL_INTERVAL_MS = 100, HEARTBEAT = "heartbeat", DEFAULT_STALL_MS = 5000;
97799
+ var WaitError, POLL_INTERVAL_MS2 = 100, HEARTBEAT = "heartbeat", DEFAULT_STALL_MS = 5000;
97175
97800
  var init_occupant_wait = __esm(() => {
97176
97801
  WaitError = class WaitError extends Error {
97177
97802
  code;
@@ -97856,7 +98481,7 @@ var init_project_start = __esm(() => {
97856
98481
 
97857
98482
  // ../../packages/app/src/services/rule-service.ts
97858
98483
  import { homedir as homedir8 } from "os";
97859
- import { delimiter, join as join32, relative as relative4, resolve as resolve15 } from "path";
98484
+ import { delimiter, join as join33, relative as relative4, resolve as resolve15 } from "path";
97860
98485
 
97861
98486
  class RuleService {
97862
98487
  context;
@@ -98051,13 +98676,13 @@ ${ruleIds.join(`
98051
98676
  const hasGlobalOverride = globalOverride !== undefined && globalOverride.length > 0;
98052
98677
  layers.push({
98053
98678
  id: "global",
98054
- path: hasGlobalOverride ? resolve15(cwd, globalOverride) : join32(homedir8(), GLOBAL_RULES_DIR),
98679
+ path: hasGlobalOverride ? resolve15(cwd, globalOverride) : join33(homedir8(), GLOBAL_RULES_DIR),
98055
98680
  priority: 10
98056
98681
  });
98057
98682
  if (opts.includeBundled && !hasGlobalOverride) {
98058
98683
  const bundledConfig = bundledConfigRoot();
98059
98684
  if (bundledConfig !== null) {
98060
- layers.push({ id: "bundled-config", path: join32(bundledConfig, "rules"), priority: 15 });
98685
+ layers.push({ id: "bundled-config", path: join33(bundledConfig, "rules"), priority: 15 });
98061
98686
  }
98062
98687
  const bundled = await bundledRulesRoot();
98063
98688
  if (bundled !== null)
@@ -98270,7 +98895,7 @@ ${ruleIds.join(`
98270
98895
  const { fs: fs3 } = this.context;
98271
98896
  for (const root of await this.ruleRoots()) {
98272
98897
  for (const ext of ["yaml", "yml", "json"]) {
98273
- if (await fs3.exists(join32(root, `${name}.${ext}`)))
98898
+ if (await fs3.exists(join33(root, `${name}.${ext}`)))
98274
98899
  return true;
98275
98900
  }
98276
98901
  }
@@ -98306,7 +98931,7 @@ ${ruleIds.join(`
98306
98931
  for (const layer of await this.existingRuleSourceLayers()) {
98307
98932
  const entries = await this.context.fs.readDir(layer.path);
98308
98933
  const named = entries.map((entry) => ({ entry, name: entry.match(/^([\w-]+)\.(?:ya?ml|json)$/i)?.[1] ?? "" })).filter(({ name }) => name.length > 0);
98309
- const stats = await Promise.all(named.map(({ entry }) => this.context.fs.stat(join32(layer.path, entry))));
98934
+ const stats = await Promise.all(named.map(({ entry }) => this.context.fs.stat(join33(layer.path, entry))));
98310
98935
  named.forEach(({ name }, i2) => {
98311
98936
  if (stats[i2]?.isFile())
98312
98937
  candidates.add(name);
@@ -98328,7 +98953,7 @@ ${ruleIds.join(`
98328
98953
  for (const layer of layers) {
98329
98954
  for (const file2 of await this.listRuleFilesInLayer(layer.path)) {
98330
98955
  if (!merged.has(file2))
98331
- merged.set(file2, { absolutePath: join32(layer.path, file2), source: layer.id });
98956
+ merged.set(file2, { absolutePath: join33(layer.path, file2), source: layer.id });
98332
98957
  }
98333
98958
  }
98334
98959
  const files = [];
@@ -98396,7 +99021,7 @@ ${ruleIds.join(`
98396
99021
  for (const entry of entries.sort()) {
98397
99022
  if (entry === "presets")
98398
99023
  continue;
98399
- const stat2 = await this.context.fs.stat(join32(root, entry));
99024
+ const stat2 = await this.context.fs.stat(join33(root, entry));
98400
99025
  if (stat2?.isDirectory())
98401
99026
  dirs.push(entry);
98402
99027
  }
@@ -98404,12 +99029,12 @@ ${ruleIds.join(`
98404
99029
  }
98405
99030
  async listRuleFiles(root, relativeDir) {
98406
99031
  const { fs: fs3 } = this.context;
98407
- const dir = join32(root, relativeDir);
99032
+ const dir = join33(root, relativeDir);
98408
99033
  const entries = await fs3.readDir(dir);
98409
99034
  const files = [];
98410
99035
  for (const entry of entries.sort()) {
98411
- const relativePath2 = relativeDir.length === 0 ? entry : join32(relativeDir, entry);
98412
- const absolutePath = join32(root, relativePath2);
99036
+ const relativePath2 = relativeDir.length === 0 ? entry : join33(relativeDir, entry);
99037
+ const absolutePath = join33(root, relativePath2);
98413
99038
  const stat2 = await fs3.stat(absolutePath);
98414
99039
  if (stat2?.isDirectory()) {
98415
99040
  files.push(...await this.listRuleFiles(root, relativePath2));
@@ -98544,8 +99169,8 @@ var init_rule_service = __esm(() => {
98544
99169
  init_agent_execution();
98545
99170
  init_envelope2();
98546
99171
  init_system_event_envelope();
98547
- LOCAL_RULES_DIR = join32(".spur", "rules");
98548
- GLOBAL_RULES_DIR = join32(".config", "spur", "rules");
99172
+ LOCAL_RULES_DIR = join33(".spur", "rules");
99173
+ GLOBAL_RULES_DIR = join33(".config", "spur", "rules");
98549
99174
  SEVERITY_RANK2 = {
98550
99175
  info: 0,
98551
99176
  warning: 1,
@@ -98763,7 +99388,7 @@ var init_run_store_service = __esm(() => {
98763
99388
  // ../../packages/app/src/services/slash-commands-service.ts
98764
99389
  import { existsSync as existsSync9, mkdirSync as mkdirSync9, readdirSync as readdirSync7, readFileSync as readFileSync12, writeFileSync as writeFileSync7 } from "fs";
98765
99390
  import { homedir as homedir9 } from "os";
98766
- import { basename as basename13, dirname as dirname20, join as join33, resolve as resolve16 } from "path";
99391
+ import { basename as basename13, dirname as dirname20, join as join34, resolve as resolve16 } from "path";
98767
99392
  function getBuiltinClaudeCommands() {
98768
99393
  return BUILTIN_CLAUDE_COMMANDS.map((cmd) => ({ ...cmd }));
98769
99394
  }
@@ -98784,7 +99409,7 @@ function findPluginsSpCommandsDir(startDir = process.cwd()) {
98784
99409
  let current = resolve16(startDir);
98785
99410
  while (true) {
98786
99411
  try {
98787
- const candidate = join33(current, "plugins", "sp", "commands");
99412
+ const candidate = join34(current, "plugins", "sp", "commands");
98788
99413
  if (existsSync9(candidate)) {
98789
99414
  return candidate;
98790
99415
  }
@@ -98803,7 +99428,7 @@ function findProjectClaudeCommandsDir(startDir = process.cwd()) {
98803
99428
  let current = resolve16(startDir);
98804
99429
  while (true) {
98805
99430
  try {
98806
- const candidate = join33(current, ".claude", "commands");
99431
+ const candidate = join34(current, ".claude", "commands");
98807
99432
  if (existsSync9(candidate)) {
98808
99433
  return candidate;
98809
99434
  }
@@ -98849,7 +99474,7 @@ function scanMarkdownCommands(dirPath, options = {}) {
98849
99474
  if (!entry.isFile() || !entry.name.endsWith(".md")) {
98850
99475
  continue;
98851
99476
  }
98852
- const fullPath = join33(dirPath, entry.name);
99477
+ const fullPath = join34(dirPath, entry.name);
98853
99478
  const stem = basename13(entry.name, ".md");
98854
99479
  const fileContent = readFileSync12(fullPath, "utf-8");
98855
99480
  const { frontmatter, body } = parseMarkdownFrontmatter(fileContent);
@@ -98936,10 +99561,10 @@ function scanMarkdownCommands(dirPath, options = {}) {
98936
99561
  return items;
98937
99562
  }
98938
99563
  function discoverEnabledClaudePlugins(options = {}) {
98939
- const { projectRoot = process.cwd(), claudeDir = join33(homedir9(), ".claude") } = options;
98940
- const userSettingsPath = join33(claudeDir, "settings.json");
98941
- const projectSettingsPath = join33(projectRoot, ".claude", "settings.json");
98942
- const installedPath = join33(claudeDir, "plugins", "installed_plugins.json");
99564
+ const { projectRoot = process.cwd(), claudeDir = join34(homedir9(), ".claude") } = options;
99565
+ const userSettingsPath = join34(claudeDir, "settings.json");
99566
+ const projectSettingsPath = join34(projectRoot, ".claude", "settings.json");
99567
+ const installedPath = join34(claudeDir, "plugins", "installed_plugins.json");
98943
99568
  let userSettings = {};
98944
99569
  if (existsSync9(userSettingsPath)) {
98945
99570
  try {
@@ -99001,8 +99626,8 @@ function discoverEnabledClaudePlugins(options = {}) {
99001
99626
  if (!resolvedDir && marketplaceName && extraKnownMarketplaces[marketplaceName]) {
99002
99627
  const mSrc = extraKnownMarketplaces[marketplaceName]?.source;
99003
99628
  if (mSrc?.source === "directory" && typeof mSrc.path === "string") {
99004
- const cand1 = join33(mSrc.path, "plugins", pluginName);
99005
- const cand2 = join33(mSrc.path, pluginName);
99629
+ const cand1 = join34(mSrc.path, "plugins", pluginName);
99630
+ const cand2 = join34(mSrc.path, pluginName);
99006
99631
  if (existsSync9(cand1)) {
99007
99632
  resolvedDir = cand1;
99008
99633
  } else if (existsSync9(cand2)) {
@@ -99011,20 +99636,20 @@ function discoverEnabledClaudePlugins(options = {}) {
99011
99636
  }
99012
99637
  }
99013
99638
  if (!resolvedDir && marketplaceName) {
99014
- const cacheDir = join33(claudeDir, "plugins", "cache", marketplaceName, pluginName);
99639
+ const cacheDir = join34(claudeDir, "plugins", "cache", marketplaceName, pluginName);
99015
99640
  if (existsSync9(cacheDir)) {
99016
99641
  try {
99017
99642
  const entries = readdirSync7(cacheDir, { withFileTypes: true });
99018
99643
  const dirs = entries.filter((e) => e.isDirectory()).map((e) => e.name);
99019
99644
  const lastDir = dirs[dirs.length - 1];
99020
99645
  if (lastDir) {
99021
- resolvedDir = join33(cacheDir, lastDir);
99646
+ resolvedDir = join34(cacheDir, lastDir);
99022
99647
  }
99023
99648
  } catch {}
99024
99649
  }
99025
99650
  }
99026
99651
  if (!resolvedDir && marketplaceName) {
99027
- const mpDir = join33(claudeDir, "plugins", "marketplaces", marketplaceName, "plugins", pluginName);
99652
+ const mpDir = join34(claudeDir, "plugins", "marketplaces", marketplaceName, "plugins", pluginName);
99028
99653
  if (existsSync9(mpDir)) {
99029
99654
  resolvedDir = mpDir;
99030
99655
  }
@@ -99037,7 +99662,7 @@ function discoverEnabledClaudePlugins(options = {}) {
99037
99662
  }
99038
99663
  let commandsDir;
99039
99664
  if (resolvedDir) {
99040
- const candidateCommands = join33(resolvedDir, "commands");
99665
+ const candidateCommands = join34(resolvedDir, "commands");
99041
99666
  if (existsSync9(candidateCommands)) {
99042
99667
  commandsDir = candidateCommands;
99043
99668
  }
@@ -99110,7 +99735,7 @@ function generateSlashCommands(options = {}) {
99110
99735
  }
99111
99736
  }
99112
99737
  if (includeUserClaude) {
99113
- const userClaudeDir = join33(homedir9(), ".claude", "commands");
99738
+ const userClaudeDir = join34(homedir9(), ".claude", "commands");
99114
99739
  const userClaudeCommands = scanMarkdownCommands(userClaudeDir, {
99115
99740
  prefix: "/",
99116
99741
  source: "claude:user"
@@ -99120,7 +99745,7 @@ function generateSlashCommands(options = {}) {
99120
99745
  }
99121
99746
  }
99122
99747
  if (includeUserSpur) {
99123
- const userSpurDir = join33(homedir9(), ".config", "spur", "commands");
99748
+ const userSpurDir = join34(homedir9(), ".config", "spur", "commands");
99124
99749
  const userSpurCommands = scanMarkdownCommands(userSpurDir, {
99125
99750
  prefix: "/sp:",
99126
99751
  source: "spur:user",
@@ -100623,7 +101248,7 @@ var init_task_size_precheck = __esm(() => {
100623
101248
  });
100624
101249
 
100625
101250
  // ../../packages/app/src/services/task-service.ts
100626
- import { dirname as dirname23, isAbsolute as isAbsolute7, join as join34, relative as relative5 } from "path";
101251
+ import { dirname as dirname23, isAbsolute as isAbsolute7, join as join35, relative as relative5 } from "path";
100627
101252
  function renderRosterTable(rows) {
100628
101253
  const header = `| WBS | Sub-task | Status |
100629
101254
  | --- | -------- | ------ |`;
@@ -101170,7 +101795,7 @@ ${templateBackground}`;
101170
101795
  if (!featureId2 || featureId2.length === 0)
101171
101796
  return null;
101172
101797
  const tasksDir = dirname23(taskFilePath);
101173
- const featuresDir = join34(tasksDir, "..", "features");
101798
+ const featuresDir = join35(tasksDir, "..", "features");
101174
101799
  const featurePath = await (async () => {
101175
101800
  try {
101176
101801
  for (const name of await this.ctx.fs.readDir(featuresDir)) {
@@ -101973,7 +102598,7 @@ var init_task_verdict = __esm(() => {
101973
102598
 
101974
102599
  // ../../packages/app/src/services/token-ledger-service.ts
101975
102600
  import { closeSync as closeSync4, existsSync as existsSync10, fstatSync as fstatSync2, openSync as openSync4, readSync } from "fs";
101976
- import { join as join35 } from "path";
102601
+ import { join as join36 } from "path";
101977
102602
  function isSparseToolActivity(events2) {
101978
102603
  return events2.length === 0 || !events2.some((e) => TOOL_ACTIVITY_TYPES.has(e.type));
101979
102604
  }
@@ -102074,7 +102699,7 @@ class TokenLedgerService {
102074
102699
  ledgerPath;
102075
102700
  chunkSize;
102076
102701
  constructor(options) {
102077
- this.ledgerPath = options.ledgerPath ?? join35(options.cwd, TOKEN_LEDGER_RELATIVE_PATH);
102702
+ this.ledgerPath = options.ledgerPath ?? join36(options.cwd, TOKEN_LEDGER_RELATIVE_PATH);
102078
102703
  this.chunkSize = options.chunkSize ?? DEFAULT_CHUNK;
102079
102704
  }
102080
102705
  get path() {
@@ -102115,7 +102740,7 @@ class TokenLedgerService {
102115
102740
  var TOOL_ACTIVITY_TYPES, TOKEN_LEDGER_DEFAULT_LIMIT = 200, TOKEN_LEDGER_MAX_LIMIT = 1000, TOKEN_LEDGER_RELATIVE_PATH, DEFAULT_CHUNK;
102116
102741
  var init_token_ledger_service = __esm(() => {
102117
102742
  TOOL_ACTIVITY_TYPES = new Set(["read", "write", "bash", "grep", "glob"]);
102118
- TOKEN_LEDGER_RELATIVE_PATH = join35(".spur", "context", "token-ledger.jsonl");
102743
+ TOKEN_LEDGER_RELATIVE_PATH = join36(".spur", "context", "token-ledger.jsonl");
102119
102744
  DEFAULT_CHUNK = 64 * 1024;
102120
102745
  });
102121
102746
 
@@ -102692,7 +103317,7 @@ class LifecycleAdapter {
102692
103317
  return { allowed: false, from: currentStatus, to, report: enterFailure };
102693
103318
  }
102694
103319
  const terminalStatus = to === "cancelled" ? "failed" : to === "done" ? "done" : null;
102695
- await persistence2.finalizeRun(runId, terminalStatus ?? "running", new Date().toISOString());
103320
+ await persistence2.finalizeRun(runId, terminalStatus ?? "running", new Date().toISOString(), undefined, to === "cancelled" ? "cancelled" : to === "done" ? "done" : undefined);
102696
103321
  return { allowed: true, from: result.fromState, to: result.toState };
102697
103322
  }
102698
103323
  return {
@@ -103129,7 +103754,7 @@ var init_progress_follow = __esm(() => {
103129
103754
  });
103130
103755
 
103131
103756
  // ../../packages/app/src/workflow/trace-writer.ts
103132
- import { dirname as dirname24, join as join36 } from "path";
103757
+ import { dirname as dirname24, join as join37 } from "path";
103133
103758
 
103134
103759
  class WorkflowTraceWriter {
103135
103760
  path;
@@ -103137,7 +103762,7 @@ class WorkflowTraceWriter {
103137
103762
  pending = Promise.resolve();
103138
103763
  constructor(cwd, runId) {
103139
103764
  const safeRunId = runId.replace(/[^A-Za-z0-9._-]/g, "_");
103140
- this.path = join36(cwd, ".spur", "workflow", `${safeRunId}.jsonl`);
103765
+ this.path = join37(cwd, ".spur", "workflow", `${safeRunId}.jsonl`);
103141
103766
  }
103142
103767
  attach(bus) {
103143
103768
  bus.on("workflow.run.started", (event) => this.enqueue("workflow.run.started", event));
@@ -103205,6 +103830,8 @@ __export(exports_src2, {
103205
103830
  satisfies: () => satisfies,
103206
103831
  runIdeaHandoffCli: () => runIdeaHandoffCli,
103207
103832
  runHistoryReport: () => runHistoryReport,
103833
+ runDecideForInlineRun: () => runDecideForInlineRun,
103834
+ runDecide: () => runDecide,
103208
103835
  runCorpusCheck: () => runCorpusCheck,
103209
103836
  runBoundedChild: () => runBoundedChild,
103210
103837
  runAgentUsageProducer: () => runAgentUsageProducer,
@@ -103281,6 +103908,7 @@ __export(exports_src2, {
103281
103908
  mapProvidersToExecutors: () => mapProvidersToExecutors,
103282
103909
  looksLikeOpaqueId: () => looksLikeOpaqueId,
103283
103910
  loadSlashCommands: () => loadSlashCommands,
103911
+ isTerminalReason: () => isTerminalReason,
103284
103912
  isSystemEventEnvelopeV2: () => isSystemEventEnvelopeV2,
103285
103913
  isSchedulerCustomActiveConflict: () => isSchedulerCustomActiveConflict,
103286
103914
  isRecordAuthoredReview: () => isRecordAuthoredReview,
@@ -103290,6 +103918,7 @@ __export(exports_src2, {
103290
103918
  isFindingCode: () => isFindingCode,
103291
103919
  isFeatureActionName: () => isFeatureActionName,
103292
103920
  isExclusiveJobActive: () => isExclusiveJobActive,
103921
+ isBookkeepingWorkflow: () => isBookkeepingWorkflow,
103293
103922
  installSystemEventCatchAll: () => installSystemEventCatchAll,
103294
103923
  humanWorkflowTitle: () => humanWorkflowTitle,
103295
103924
  humanStepLabel: () => humanStepLabel,
@@ -103354,6 +103983,7 @@ __export(exports_src2, {
103354
103983
  computeDecisionReadiness: () => computeDecisionReadiness,
103355
103984
  computeAggregate: () => computeAggregate,
103356
103985
  completeFeatureVerificationReceipt: () => completeFeatureVerificationReceipt,
103986
+ classifyTerminalReason: () => classifyTerminalReason,
103357
103987
  classifyTaskOutcome: () => classifyTaskOutcome,
103358
103988
  classifyProviderUsage: () => classifyProviderUsage,
103359
103989
  classifyPortBindError: () => classifyPortBindError,
@@ -103400,6 +104030,7 @@ __export(exports_src2, {
103400
104030
  TOKEN_LEDGER_RELATIVE_PATH: () => TOKEN_LEDGER_RELATIVE_PATH,
103401
104031
  TOKEN_LEDGER_MAX_LIMIT: () => TOKEN_LEDGER_MAX_LIMIT,
103402
104032
  TOKEN_LEDGER_DEFAULT_LIMIT: () => TOKEN_LEDGER_DEFAULT_LIMIT,
104033
+ TERMINAL_REASONS: () => TERMINAL_REASONS,
103403
104034
  TASK_LIFECYCLE_PROFILE: () => TASK_LIFECYCLE_PROFILE,
103404
104035
  TASK_FORWARD_CHAIN: () => TASK_FORWARD_CHAIN,
103405
104036
  TASK_ACTION_COMMANDS: () => TASK_ACTION_COMMANDS,
@@ -103445,10 +104076,11 @@ __export(exports_src2, {
103445
104076
  PluginService: () => PluginService,
103446
104077
  PlanningWriteService: () => PlanningWriteService,
103447
104078
  PS_LIST_ARGV: () => PS_LIST_ARGV,
103448
- POLL_INTERVAL_MS: () => POLL_INTERVAL_MS,
104079
+ POLL_INTERVAL_MS: () => POLL_INTERVAL_MS2,
103449
104080
  PLANNING_EVENT_NAMES: () => PLANNING_EVENT_NAMES,
103450
104081
  PLANNING_DIGEST_SECTIONS: () => PLANNING_DIGEST_SECTIONS,
103451
104082
  ObservableWorkflowAdapter: () => ObservableWorkflowAdapter,
104083
+ NOUL_YES_THRESHOLD: () => NOUL_YES_THRESHOLD,
103452
104084
  MockHistoryBoardService: () => MockHistoryBoardService,
103453
104085
  MIN_SAFE_PI_BASH_IMPORTER_VERSION: () => MIN_SAFE_PI_BASH_IMPORTER_VERSION,
103454
104086
  MAX_TIMEOUT_INPUT_MS: () => MAX_TIMEOUT_INPUT_MS,
@@ -103488,19 +104120,25 @@ __export(exports_src2, {
103488
104120
  DuplicateFollowUpError: () => DuplicateFollowUpError,
103489
104121
  DependencyMutationError: () => DependencyMutationError,
103490
104122
  DeliveryReconciler: () => DeliveryReconciler,
104123
+ DecideOptionsSchema: () => DecideOptionsSchema,
104124
+ DecideActionRunner: () => DecideActionRunner,
103491
104125
  DEFAULT_SYSTEM_EVENT_RETENTION_QUOTA: () => DEFAULT_SYSTEM_EVENT_RETENTION_QUOTA,
103492
104126
  DEFAULT_STRATEGY: () => DEFAULT_STRATEGY,
103493
104127
  DEFAULT_STALL_MS: () => DEFAULT_STALL_MS,
103494
104128
  DEFAULT_SOURCE_TIMEOUT_MS: () => DEFAULT_SOURCE_TIMEOUT_MS,
103495
104129
  DEFAULT_RUN_LOG_MAX_BYTES: () => DEFAULT_RUN_LOG_MAX_BYTES,
103496
104130
  DEFAULT_READY_PREPARE_TIMEOUT_MS: () => DEFAULT_READY_PREPARE_TIMEOUT_MS,
104131
+ DEFAULT_MIN_CONFIDENCE: () => DEFAULT_MIN_CONFIDENCE,
103497
104132
  DEFAULT_FEATURE_VERIFICATION_CMD: () => DEFAULT_FEATURE_VERIFICATION_CMD,
103498
104133
  DEFAULT_FEATURE_MATRIX: () => DEFAULT_FEATURE_MATRIX,
104134
+ DECIDE_KIND: () => DECIDE_KIND,
104135
+ DECIDE_EVIDENCE_MAX_CHARS: () => DECIDE_EVIDENCE_MAX_CHARS,
103499
104136
  CorpusMigrator: () => CorpusMigrator,
103500
104137
  CommandGateActionRunner: () => CommandGateActionRunner,
103501
104138
  CHILD_KILL_GRACE_MS: () => CHILD_KILL_GRACE_MS,
103502
104139
  BusPlanningEventEmitter: () => BusPlanningEventEmitter,
103503
104140
  BUILTIN_CLAUDE_COMMANDS: () => BUILTIN_CLAUDE_COMMANDS,
104141
+ BOOKKEEPING_WORKFLOWS: () => BOOKKEEPING_WORKFLOWS,
103504
104142
  AgentUsageProducerError: () => AgentUsageProducerError,
103505
104143
  AgentService: () => AgentService,
103506
104144
  AgentRunActionRunner: () => AgentRunActionRunner,
@@ -103579,6 +104217,7 @@ var init_src3 = __esm(async () => {
103579
104217
  init_action_trace();
103580
104218
  init_agent_run();
103581
104219
  init_command_gate();
104220
+ init_decide2();
103582
104221
  init_file_exists();
103583
104222
  init_file_read();
103584
104223
  init_file_read_into_var();
@@ -103589,6 +104228,7 @@ var init_src3 = __esm(async () => {
103589
104228
  init_shell();
103590
104229
  init_builtins2();
103591
104230
  init_composition_baseline();
104231
+ init_decide();
103592
104232
  init_decision_hitl_responder();
103593
104233
  init_escalation_packet();
103594
104234
  init_feature_verification_receipt();
@@ -103601,6 +104241,7 @@ var init_src3 = __esm(async () => {
103601
104241
  init_proof_input_fingerprint();
103602
104242
  init_steering();
103603
104243
  init_step_reporter();
104244
+ init_terminal_reason();
103604
104245
  init_trace_writer();
103605
104246
  await __promiseAll([
103606
104247
  init_inline_run_setup(),
@@ -103696,19 +104337,19 @@ var {
103696
104337
  init_src();
103697
104338
  init_loader();
103698
104339
 
103699
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/application-node.js
104340
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/application-node.js
103700
104341
  init_dist4();
103701
104342
  init_dist5();
103702
104343
  import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "fs";
103703
104344
  import { dirname as dirname6 } from "path";
103704
104345
 
103705
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/application/index.js
104346
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/application/index.js
103706
104347
  init_default_observers();
103707
104348
  init_event_bus();
103708
104349
  init_file_observer();
103709
104350
  init_logger3();
103710
104351
 
103711
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/scheduler/noop.js
104352
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/scheduler/noop.js
103712
104353
  class NoopSchedulerAdapter {
103713
104354
  constructor() {}
103714
104355
  register(_cron, _action) {}
@@ -103716,7 +104357,7 @@ class NoopSchedulerAdapter {
103716
104357
  async stop() {}
103717
104358
  }
103718
104359
 
103719
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/scheduler/factory.js
104360
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/scheduler/factory.js
103720
104361
  function initScheduler(adapter, cronEntries) {
103721
104362
  const resolved = adapter ?? new NoopSchedulerAdapter;
103722
104363
  if (cronEntries) {
@@ -103727,7 +104368,7 @@ function initScheduler(adapter, cronEntries) {
103727
104368
  return resolved;
103728
104369
  }
103729
104370
 
103730
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/application/plugins/builtins.js
104371
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/application/plugins/builtins.js
103731
104372
  init_logger3();
103732
104373
  init_metrics();
103733
104374
  init_sdk();
@@ -103820,7 +104461,7 @@ function dbPlugin(db2) {
103820
104461
  };
103821
104462
  }
103822
104463
 
103823
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/application/plugins/host.js
104464
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/application/plugins/host.js
103824
104465
  init_logger3();
103825
104466
 
103826
104467
  class PluginHost {
@@ -103908,7 +104549,7 @@ class PluginHost {
103908
104549
  }
103909
104550
  }
103910
104551
 
103911
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/application/index.js
104552
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/application/index.js
103912
104553
  async function performShutdown(state, reason) {
103913
104554
  if (state.stopped)
103914
104555
  return;
@@ -104020,7 +104661,7 @@ async function runApplication(options) {
104020
104661
  throw error51;
104021
104662
  }
104022
104663
  }
104023
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/scheduler/cron.js
104664
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/scheduler/cron.js
104024
104665
  var MAX_SCAN_MINUTES = 8 * 366 * 24 * 60;
104025
104666
  var DAYS_OF_WEEK = 7;
104026
104667
  function parseField(raw, min, max) {
@@ -104134,7 +104775,7 @@ function nextCronTime(expr, nowMs) {
104134
104775
  throw new RangeError(`unsupported cron expression "${expr.source}": no matching time within 8 years`);
104135
104776
  }
104136
104777
 
104137
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/scheduler/node.js
104778
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/scheduler/node.js
104138
104779
  init_logger3();
104139
104780
  init_metrics();
104140
104781
  var MAX_TIMEOUT = 2147483647;
@@ -104288,7 +104929,7 @@ class NodeSchedulerAdapter {
104288
104929
  }
104289
104930
  }
104290
104931
  }
104291
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
104932
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
104292
104933
  var import_api14 = __toESM(require_src(), 1);
104293
104934
 
104294
104935
  // ../../node_modules/.bun/@opentelemetry+exporter-metrics-otlp-http@0.218.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/esm/OTLPMetricExporterBase.js
@@ -107304,7 +107945,7 @@ class OTLPTraceExporter extends import_otlp_exporter_base2.OTLPExporterBase {
107304
107945
  }), JsonTraceSerializer));
107305
107946
  }
107306
107947
  }
107307
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
107948
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/telemetry/otel-node.js
107308
107949
  var import_resources2 = __toESM(require_src4(), 1);
107309
107950
  var import_sdk_trace_node = __toESM(require_src8(), 1);
107310
107951
  var import_semantic_conventions = __toESM(require_src2(), 1);
@@ -107355,7 +107996,7 @@ async function shutdownNodeTelemetry() {
107355
107996
  await Promise.all(pending);
107356
107997
  }
107357
107998
 
107358
- // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.5+d0fc91bd04d46158/node_modules/@gobing-ai/ts-infra/dist/application-node.js
107999
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.7+099f6a6591bce231/node_modules/@gobing-ai/ts-infra/dist/application-node.js
107359
108000
  class ConfigValidationError extends Error {
107360
108001
  constructor(message) {
107361
108002
  super(message);
@@ -111232,7 +111873,7 @@ init_src();
111232
111873
  init_dist5();
111233
111874
  await init_src3();
111234
111875
  import { homedir as homedir10 } from "os";
111235
- import { join as join37 } from "path";
111876
+ import { join as join38 } from "path";
111236
111877
  var CODEXBAR_ARGV = ["codexbar", "usage", "--format", "json", "--provider", "all"];
111237
111878
  var DEFAULT_CAPTURE_TIMEOUT_MS = 180000;
111238
111879
 
@@ -111278,7 +111919,7 @@ function defaultAgentUsageSnapshotPath(env2 = getEnvVars()) {
111278
111919
  const override = env2.SPUR_AGENT_USAGE_SNAPSHOT;
111279
111920
  if (override !== undefined && override.length > 0)
111280
111921
  return override;
111281
- return join37(homedir10(), ".config", "spur", "agent-usage.json");
111922
+ return join38(homedir10(), ".config", "spur", "agent-usage.json");
111282
111923
  }
111283
111924
 
111284
111925
  // src/system-event-ledger.ts
@@ -111428,7 +112069,7 @@ await init_src3();
111428
112069
  import { existsSync as existsSync12, readFileSync as readFileSync13 } from "fs";
111429
112070
  import { rm, writeFile as writeFile2 } from "fs/promises";
111430
112071
  import { tmpdir as tmpdir3 } from "os";
111431
- import { dirname as dirname25, join as join38 } from "path";
112072
+ import { dirname as dirname25, join as join39 } from "path";
111432
112073
 
111433
112074
  // src/colors.ts
111434
112075
  var CODES = {
@@ -112087,6 +112728,10 @@ var state_machine_workflow_schema_default = {
112087
112728
  type: "string",
112088
112729
  minLength: 1
112089
112730
  },
112731
+ terminalReason: {
112732
+ type: "string",
112733
+ description: "Closed terminal-reason enum declared when this edge finalizes the run (0937 R3; required for edges into failureStates)."
112734
+ },
112090
112735
  description: {
112091
112736
  type: "string"
112092
112737
  },
@@ -112768,7 +113413,7 @@ ${result.content}`);
112768
113413
  let forcedDoneVerdict;
112769
113414
  if (status === "done") {
112770
113415
  const current = await svc.show(wbs);
112771
- const verdictDir = options.verdictDir ?? join38(context4.cwd, ".spur", "run");
113416
+ const verdictDir = options.verdictDir ?? join39(context4.cwd, ".spur", "run");
112772
113417
  const loaded = await readVerdictArtifact(context4.fs, verdictDir, wbs);
112773
113418
  const guardOutcome = evaluateDoneTransition({
112774
113419
  wbs,
@@ -113078,7 +113723,7 @@ ${result.content}`);
113078
113723
  agentSelector: options.agent,
113079
113724
  cwd: context4.cwd
113080
113725
  });
113081
- tmpPath = join38(tmpdir3(), `spur-ready-batch-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.json`);
113726
+ tmpPath = join39(tmpdir3(), `spur-ready-batch-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.json`);
113082
113727
  await writeFile2(tmpPath, `${JSON.stringify(prepared.items, null, 2)}
113083
113728
  `);
113084
113729
  batchFile = tmpPath;
@@ -113514,13 +114159,13 @@ function loadTemplateBodies(projectRoot, variant) {
113514
114159
  if (cached2 !== undefined)
113515
114160
  return cached2;
113516
114161
  let bodies = {};
113517
- const localPath = join38(projectRoot, ".spur", "tasks", "templates", `${variant}.md`);
114162
+ const localPath = join39(projectRoot, ".spur", "tasks", "templates", `${variant}.md`);
113518
114163
  if (existsSync12(localPath)) {
113519
114164
  bodies = extractTemplateBodies(readFileSync13(localPath, "utf8"));
113520
114165
  } else {
113521
114166
  const root = bundledConfigRoot();
113522
114167
  if (root !== null) {
113523
- const templatePath = join38(root, "templates", "task", `${variant}.md`);
114168
+ const templatePath = join39(root, "templates", "task", `${variant}.md`);
113524
114169
  if (existsSync12(templatePath)) {
113525
114170
  bodies = extractTemplateBodies(readFileSync13(templatePath, "utf8"));
113526
114171
  }
@@ -113578,7 +114223,7 @@ async function loadSectionMatrixUncached(projectRoot) {
113578
114223
  }
113579
114224
  const root = bundledConfigRoot();
113580
114225
  if (root !== null) {
113581
- const matrixPath = join38(root, "tasks", "section-matrix.yaml");
114226
+ const matrixPath = join39(root, "tasks", "section-matrix.yaml");
113582
114227
  if (await fs3.exists(matrixPath)) {
113583
114228
  const data = await loadStructuredSpurConfig(matrixPath, {
113584
114229
  validateJsonSchema: true,
@@ -113589,7 +114234,7 @@ async function loadSectionMatrixUncached(projectRoot) {
113589
114234
  }
113590
114235
  throw new Error(`no canonical section-matrix found for task section authority (F92 R1); tried:
113591
114236
  ` + ` - ${localPath}
113592
- ` + (root !== null ? ` - ${join38(root, "tasks", "section-matrix.yaml")}
114237
+ ` + (root !== null ? ` - ${join39(root, "tasks", "section-matrix.yaml")}
113593
114238
  ` : "") + "copy/generate section-matrix.yaml from the canonical build-time matrix asset (repo `config` `tasks` tree) into one of those paths");
113594
114239
  }
113595
114240
 
@@ -114605,12 +115250,12 @@ function waitFail(context4, options, code, message) {
114605
115250
  init_src();
114606
115251
  init_dist5();
114607
115252
  import { existsSync as existsSync14, readdirSync as readdirSync8, readFileSync as readFileSync14 } from "fs";
114608
- import { join as join40 } from "path";
115253
+ import { join as join41 } from "path";
114609
115254
 
114610
115255
  // src/version-carriers.ts
114611
115256
  init_zod();
114612
115257
  import { existsSync as existsSync13 } from "fs";
114613
- import { join as join39 } from "path";
115258
+ import { join as join40 } from "path";
114614
115259
  var defaultLiteralProbe = { file: "src/config.ts", identifier: "binaryVersion" };
114615
115260
  var registry2 = new Map;
114616
115261
  function registerCarrierType(type, def) {
@@ -114662,7 +115307,7 @@ registerCarrierType("plugin-manifest", {
114662
115307
  schema: PluginManifestCarrierSchema,
114663
115308
  async syncRepoWide(carrier, { repoRoot }, version3, staged, output2) {
114664
115309
  for (const rel of carrier.paths) {
114665
- const absPath = join39(repoRoot, rel);
115310
+ const absPath = join40(repoRoot, rel);
114666
115311
  const manifest = await readJson(absPath);
114667
115312
  if (manifest === null) {
114668
115313
  output2.write(` \u26A0 ${rel}: not found or malformed \u2014 skipping`);
@@ -114720,7 +115365,7 @@ async function run(repoRoot, cmd) {
114720
115365
  };
114721
115366
  }
114722
115367
  async function verifyLockfile(ctx, output2) {
114723
- const lockPath = join40(ctx.repoRoot, "bun.lock");
115368
+ const lockPath = join41(ctx.repoRoot, "bun.lock");
114724
115369
  if (!existsSync14(lockPath) || Bun.file(lockPath).size === 0)
114725
115370
  return;
114726
115371
  const result = await run(ctx.repoRoot, ["bun", "install", "--frozen-lockfile"]);
@@ -114730,7 +115375,7 @@ async function verifyLockfile(ctx, output2) {
114730
115375
  output2.write(" \u21B3 bun.lock: verified (bun install --frozen-lockfile)");
114731
115376
  }
114732
115377
  async function assertPluginInstallable(ctx, output2) {
114733
- const smokePath = join40(ctx.repoRoot, "scripts", "commands", "plugin-install-smoke.ts");
115378
+ const smokePath = join41(ctx.repoRoot, "scripts", "commands", "plugin-install-smoke.ts");
114734
115379
  if (!existsSync14(smokePath)) {
114735
115380
  output2.write(" \u21B3 plugin-install-smoke: gate script not present in this repo \u2014 skipped");
114736
115381
  return;
@@ -114772,7 +115417,7 @@ async function readJson2(path9) {
114772
115417
  function rootWorkspaceGlobs(repoRoot) {
114773
115418
  let root;
114774
115419
  try {
114775
- root = JSON.parse(readFileSync14(join40(repoRoot, "package.json"), "utf8"));
115420
+ root = JSON.parse(readFileSync14(join41(repoRoot, "package.json"), "utf8"));
114776
115421
  } catch {
114777
115422
  return [];
114778
115423
  }
@@ -114789,11 +115434,11 @@ function workspaceDirs(repoRoot) {
114789
115434
  if (!glob.endsWith("/*"))
114790
115435
  continue;
114791
115436
  const parent = glob.slice(0, -2);
114792
- const parentAbs = join40(repoRoot, parent);
115437
+ const parentAbs = join41(repoRoot, parent);
114793
115438
  if (!existsSync14(parentAbs))
114794
115439
  continue;
114795
115440
  for (const entry of readdirSync8(parentAbs, { withFileTypes: true })) {
114796
- if (entry.isDirectory() && existsSync14(join40(parentAbs, entry.name, "package.json"))) {
115441
+ if (entry.isDirectory() && existsSync14(join41(parentAbs, entry.name, "package.json"))) {
114797
115442
  dirs.push(`${parent}/${entry.name}`);
114798
115443
  }
114799
115444
  }
@@ -114801,14 +115446,14 @@ function workspaceDirs(repoRoot) {
114801
115446
  return dirs;
114802
115447
  }
114803
115448
  async function releaseContext(repoRoot, bumpVerConfig = resolveBuilderBumpVerConfig(null)) {
114804
- const rootManifest = await readJson2(join40(repoRoot, "package.json"));
115449
+ const rootManifest = await readJson2(join41(repoRoot, "package.json"));
114805
115450
  if (rootManifest === null) {
114806
115451
  throw new Error(`no package.json found at ${repoRoot} \u2014 builder operates on a package workspace root.`);
114807
115452
  }
114808
115453
  const rootName = typeof rootManifest.name === "string" ? rootManifest.name : "root";
114809
115454
  const workspaces2 = [];
114810
115455
  for (const dir of workspaceDirs(repoRoot)) {
114811
- const manifest = await readJson2(join40(repoRoot, dir, "package.json"));
115456
+ const manifest = await readJson2(join41(repoRoot, dir, "package.json"));
114812
115457
  if (manifest === null)
114813
115458
  continue;
114814
115459
  workspaces2.push({
@@ -114823,8 +115468,8 @@ async function releaseContext(repoRoot, bumpVerConfig = resolveBuilderBumpVerCon
114823
115468
  const packages = new Map;
114824
115469
  for (const ws of workspaces2) {
114825
115470
  const probe = findLiteralProbe(versionCarriers, ws.dir) ?? defaultLiteralProbe;
114826
- const literalProbe = join40(ws.dir, probe.file);
114827
- const versionSourceFile = existsSync14(join40(repoRoot, literalProbe)) ? literalProbe : undefined;
115471
+ const literalProbe = join41(ws.dir, probe.file);
115472
+ const versionSourceFile = existsSync14(join41(repoRoot, literalProbe)) ? literalProbe : undefined;
114828
115473
  packages.set(shortName(ws.name), {
114829
115474
  packageDir: ws.dir,
114830
115475
  packageName: ws.name,
@@ -114862,7 +115507,7 @@ async function updateWorkspacePins(ctx, pkgName, oldVersion, newVersion, output2
114862
115507
  const changed = [];
114863
115508
  for (const dir of [".", ...workspaceDirs(ctx.repoRoot)]) {
114864
115509
  const relPath = dir === "." ? "package.json" : `${dir}/package.json`;
114865
- const manifest = await readJson2(join40(ctx.repoRoot, relPath));
115510
+ const manifest = await readJson2(join41(ctx.repoRoot, relPath));
114866
115511
  if (manifest === null)
114867
115512
  continue;
114868
115513
  let dirty = false;
@@ -114879,7 +115524,7 @@ async function updateWorkspacePins(ctx, pkgName, oldVersion, newVersion, output2
114879
115524
  }
114880
115525
  }
114881
115526
  if (dirty) {
114882
- await Bun.write(join40(ctx.repoRoot, relPath), `${JSON.stringify(manifest, null, 4)}
115527
+ await Bun.write(join41(ctx.repoRoot, relPath), `${JSON.stringify(manifest, null, 4)}
114883
115528
  `);
114884
115529
  output2.write(` \u21B3 ${relPath}: ${pkgName} workspace pin ${oldVersion} \u2192 ${newVersion}`);
114885
115530
  changed.push(relPath);
@@ -114887,7 +115532,7 @@ async function updateWorkspacePins(ctx, pkgName, oldVersion, newVersion, output2
114887
115532
  }
114888
115533
  if (changed.length === 0)
114889
115534
  return changed;
114890
- const lockPath = join40(ctx.repoRoot, "bun.lock");
115535
+ const lockPath = join41(ctx.repoRoot, "bun.lock");
114891
115536
  if (existsSync14(lockPath)) {
114892
115537
  const lock = await Bun.file(lockPath).text();
114893
115538
  const staleSpec = `"${pkgName}": "workspace:${oldVersion}"`;
@@ -114899,7 +115544,7 @@ async function updateWorkspacePins(ctx, pkgName, oldVersion, newVersion, output2
114899
115544
  return changed;
114900
115545
  }
114901
115546
  async function updateVersionSourceFile(ctx, filePath, previous, next, output2, identifier = "binaryVersion") {
114902
- const absPath = join40(ctx.repoRoot, filePath);
115547
+ const absPath = join41(ctx.repoRoot, filePath);
114903
115548
  const content = await Bun.file(absPath).text();
114904
115549
  const pattern = new RegExp(`(${identifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}:\\s*['"])\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z-.]+)?(?:\\+[0-9A-Za-z-.]+)?(['"])`);
114905
115550
  const updated = content.replace(pattern, `$1${next}$2`);
@@ -114917,7 +115562,7 @@ async function syncExtraCarriers(ctx, version3, staged, output2) {
114917
115562
  }
114918
115563
  }
114919
115564
  async function syncMarketplaceAndPlugins(ctx, version3, staged, output2) {
114920
- const marketplacePath = join40(ctx.repoRoot, ".claude-plugin", "marketplace.json");
115565
+ const marketplacePath = join41(ctx.repoRoot, ".claude-plugin", "marketplace.json");
114921
115566
  const marketplaceFile = Bun.file(marketplacePath);
114922
115567
  if (!await marketplaceFile.exists())
114923
115568
  return;
@@ -114942,7 +115587,7 @@ async function syncMarketplaceAndPlugins(ctx, version3, staged, output2) {
114942
115587
  output2.write(`Bumped marketplace plugins to ${version3}`);
114943
115588
  }
114944
115589
  for (const entry of plugins) {
114945
- const pluginJsonPath = join40(ctx.repoRoot, entry.source, "plugin.json");
115590
+ const pluginJsonPath = join41(ctx.repoRoot, entry.source, "plugin.json");
114946
115591
  const pluginJson = await readJson2(pluginJsonPath);
114947
115592
  if (pluginJson === null) {
114948
115593
  output2.write(` \u26A0 plugin.json not found at ${entry.source}/plugin.json \u2014 skipping`);
@@ -114996,7 +115641,7 @@ async function bumpVersion(ctx, config4, version3, options, output2) {
114996
115641
  throw new Error(`${config4.packageName}@${version3} is already published on npm. Use a new version.`);
114997
115642
  }
114998
115643
  await assertPluginInstallable(ctx, output2);
114999
- const manifestPath = join40(ctx.repoRoot, config4.packageDir, "package.json");
115644
+ const manifestPath = join41(ctx.repoRoot, config4.packageDir, "package.json");
115000
115645
  const manifest = await readJson2(manifestPath);
115001
115646
  if (manifest === null)
115002
115647
  throw new Error(`missing or malformed manifest at ${config4.packageDir}/package.json`);
@@ -115015,7 +115660,7 @@ async function bumpVersion(ctx, config4, version3, options, output2) {
115015
115660
  await syncMarketplaceAndPlugins(ctx, version3, staged, output2);
115016
115661
  await syncExtraCarriers(ctx, version3, staged, output2);
115017
115662
  await verifyLockfile(ctx, output2);
115018
- const lockPath = join40(ctx.repoRoot, "bun.lock");
115663
+ const lockPath = join41(ctx.repoRoot, "bun.lock");
115019
115664
  if (existsSync14(lockPath) && Bun.file(lockPath).size > 0)
115020
115665
  staged.push("bun.lock");
115021
115666
  await git2(ctx.repoRoot, ["add", ...staged]);
@@ -115072,7 +115717,7 @@ async function bumpAll(ctx, version3, options, output2) {
115072
115717
  }
115073
115718
  const staged = [];
115074
115719
  for (const config4 of configs) {
115075
- const manifestPath = join40(ctx.repoRoot, config4.packageDir, "package.json");
115720
+ const manifestPath = join41(ctx.repoRoot, config4.packageDir, "package.json");
115076
115721
  const manifest = await readJson2(manifestPath);
115077
115722
  if (manifest === null) {
115078
115723
  throw new Error(`missing or malformed manifest at ${config4.packageDir}/package.json`);
@@ -115093,7 +115738,7 @@ async function bumpAll(ctx, version3, options, output2) {
115093
115738
  await syncMarketplaceAndPlugins(ctx, version3, staged, output2);
115094
115739
  await syncExtraCarriers(ctx, version3, staged, output2);
115095
115740
  await verifyLockfile(ctx, output2);
115096
- const lockPath = join40(ctx.repoRoot, "bun.lock");
115741
+ const lockPath = join41(ctx.repoRoot, "bun.lock");
115097
115742
  if (existsSync14(lockPath) && Bun.file(lockPath).size > 0)
115098
115743
  staged.push("bun.lock");
115099
115744
  await git2(ctx.repoRoot, ["add", ...staged]);
@@ -115734,7 +116379,7 @@ import { createRequire } from "module";
115734
116379
  var CLI_CONFIG = {
115735
116380
  binaryName: "spur",
115736
116381
  binaryLabel: "spur",
115737
- binaryVersion: "0.3.92",
116382
+ binaryVersion: "0.3.93",
115738
116383
  configDir: ".spur",
115739
116384
  configFile: ".spur/config.yaml",
115740
116385
  databaseFile: ".spur/spur.db"
@@ -116146,7 +116791,7 @@ init_loader();
116146
116791
  init_src2();
116147
116792
  init_dist11();
116148
116793
  import { homedir as homedir11 } from "os";
116149
- import { join as join41, resolve as resolve18 } from "path";
116794
+ import { join as join42, resolve as resolve18 } from "path";
116150
116795
 
116151
116796
  // src/config/scaffold-manifest.ts
116152
116797
  var SCAFFOLD_MANIFEST = [
@@ -116175,8 +116820,8 @@ var SCAFFOLD_MANIFEST = [
116175
116820
  ];
116176
116821
 
116177
116822
  // src/commands/init.ts
116178
- var GLOBAL_CONFIG_DIR = join41(".config", "spur");
116179
- var GLOBAL_RULES_DIR2 = join41(GLOBAL_CONFIG_DIR, "rules");
116823
+ var GLOBAL_CONFIG_DIR = join42(".config", "spur");
116824
+ var GLOBAL_RULES_DIR2 = join42(GLOBAL_CONFIG_DIR, "rules");
116180
116825
  var GLOBAL_CONFIG_EXAMPLE = BUNDLED_GLOBAL_CONFIG;
116181
116826
  var GLOBAL_CONFIG_FILE2 = "config.yaml";
116182
116827
  var INDEXED_CONTEXT_MARKER = "## Indexed context";
@@ -116207,7 +116852,7 @@ If \`.spur/context/\` is absent, proceed normally. Never block work on its absen
116207
116852
  `;
116208
116853
  function globalRulesRoot(context4) {
116209
116854
  const override = context4.env.SPUR_GLOBAL_RULES_DIR;
116210
- return override !== undefined && override.length > 0 ? resolve18(context4.cwd, override) : join41(homedir11(), GLOBAL_RULES_DIR2);
116855
+ return override !== undefined && override.length > 0 ? resolve18(context4.cwd, override) : join42(homedir11(), GLOBAL_RULES_DIR2);
116211
116856
  }
116212
116857
  async function writeIfNew(context4, path9, content, force, result) {
116213
116858
  if (!force && await context4.fs.exists(path9)) {
@@ -116224,18 +116869,18 @@ async function seedGlobalRules(context4) {
116224
116869
  const target = globalRulesRoot(context4);
116225
116870
  let written = 0;
116226
116871
  for (const relPath of await listBundledRuleFiles()) {
116227
- const destination = join41(target, relPath);
116872
+ const destination = join42(target, relPath);
116228
116873
  if (await context4.fs.exists(destination))
116229
116874
  continue;
116230
- await context4.fs.ensureDir(join41(target, ...relPath.split("/").slice(0, -1)));
116231
- await context4.fs.writeFile(destination, await context4.fs.readFile(join41(source, relPath)));
116875
+ await context4.fs.ensureDir(join42(target, ...relPath.split("/").slice(0, -1)));
116876
+ await context4.fs.writeFile(destination, await context4.fs.readFile(join42(source, relPath)));
116232
116877
  written += 1;
116233
116878
  }
116234
116879
  return written;
116235
116880
  }
116236
116881
  function resolveGlobalConfigDir(context4) {
116237
116882
  const globalOverride = context4.env.SPUR_GLOBAL_RULES_DIR;
116238
- return globalOverride !== undefined && globalOverride.length > 0 ? resolve18(context4.cwd, globalOverride) : join41(homedir11(), GLOBAL_CONFIG_DIR);
116883
+ return globalOverride !== undefined && globalOverride.length > 0 ? resolve18(context4.cwd, globalOverride) : join42(homedir11(), GLOBAL_CONFIG_DIR);
116239
116884
  }
116240
116885
  async function seedGlobalConfig(context4) {
116241
116886
  const source = bundledConfigRoot();
@@ -116246,15 +116891,15 @@ async function seedGlobalConfig(context4) {
116246
116891
  for (const relPath of listBundledConfigFiles()) {
116247
116892
  if (relPath === GLOBAL_CONFIG_EXAMPLE)
116248
116893
  continue;
116249
- const destination = join41(target, relPath);
116894
+ const destination = join42(target, relPath);
116250
116895
  if (await context4.fs.exists(destination))
116251
116896
  continue;
116252
- await context4.fs.ensureDir(join41(target, ...relPath.split("/").slice(0, -1)));
116253
- await context4.fs.writeFile(destination, await context4.fs.readFile(join41(source, relPath)));
116897
+ await context4.fs.ensureDir(join42(target, ...relPath.split("/").slice(0, -1)));
116898
+ await context4.fs.writeFile(destination, await context4.fs.readFile(join42(source, relPath)));
116254
116899
  written += 1;
116255
116900
  }
116256
- const examplePath = join41(source, GLOBAL_CONFIG_EXAMPLE);
116257
- const globalConfigPath = join41(target, GLOBAL_CONFIG_FILE2);
116901
+ const examplePath = join42(source, GLOBAL_CONFIG_EXAMPLE);
116902
+ const globalConfigPath = join42(target, GLOBAL_CONFIG_FILE2);
116258
116903
  if (await context4.fs.exists(examplePath) && !await context4.fs.exists(globalConfigPath)) {
116259
116904
  await context4.fs.ensureDir(target);
116260
116905
  await context4.fs.writeFile(globalConfigPath, await context4.fs.readFile(examplePath));
@@ -116269,10 +116914,10 @@ function registerInitCommand(program2, context4, options = {}) {
116269
116914
  const minimal = options2.minimal === true;
116270
116915
  const adoptGlobal = options2.adoptGlobalConfig === true;
116271
116916
  const projectName = options2.name ?? "default";
116272
- const configPath = join41(context4.cwd, CLI_CONFIG.configFile);
116917
+ const configPath = join42(context4.cwd, CLI_CONFIG.configFile);
116273
116918
  const result = { created: [], skipped: [] };
116274
116919
  const globalConfigDir = resolveGlobalConfigDir(context4);
116275
- const globalConfigPath = join41(globalConfigDir, GLOBAL_CONFIG_FILE2);
116920
+ const globalConfigPath = join42(globalConfigDir, GLOBAL_CONFIG_FILE2);
116276
116921
  const globalConfigExists = await context4.fs.exists(globalConfigPath);
116277
116922
  let misplacedKeys = [];
116278
116923
  if (globalConfigExists) {
@@ -116285,20 +116930,20 @@ function registerInitCommand(program2, context4, options = {}) {
116285
116930
  const configRoot = bundledConfigRoot();
116286
116931
  if (configRoot !== null && !minimal) {
116287
116932
  for (const relPath of listBundledProjectSeedFiles()) {
116288
- const sourcePath = join41(configRoot, relPath);
116933
+ const sourcePath = join42(configRoot, relPath);
116289
116934
  if (!await context4.fs.exists(sourcePath))
116290
116935
  continue;
116291
- const targetPath = join41(context4.cwd, CLI_CONFIG.configDir, relPath);
116292
- await context4.fs.ensureDir(join41(targetPath, ".."));
116936
+ const targetPath = join42(context4.cwd, CLI_CONFIG.configDir, relPath);
116937
+ await context4.fs.ensureDir(join42(targetPath, ".."));
116293
116938
  await writeIfNew(context4, targetPath, await context4.fs.readFile(sourcePath), false, result);
116294
116939
  }
116295
116940
  for (const entry of SCAFFOLD_MANIFEST) {
116296
- const sourcePath = join41(configRoot, entry.source);
116941
+ const sourcePath = join42(configRoot, entry.source);
116297
116942
  if (!await context4.fs.exists(sourcePath))
116298
116943
  continue;
116299
- const baseDir = entry.root === true ? context4.cwd : join41(context4.cwd, CLI_CONFIG.configDir);
116300
- const targetPath = join41(baseDir, entry.target);
116301
- await context4.fs.ensureDir(join41(targetPath, ".."));
116944
+ const baseDir = entry.root === true ? context4.cwd : join42(context4.cwd, CLI_CONFIG.configDir);
116945
+ const targetPath = join42(baseDir, entry.target);
116946
+ await context4.fs.ensureDir(join42(targetPath, ".."));
116302
116947
  const entryForce = false;
116303
116948
  let body = await context4.fs.readFile(sourcePath);
116304
116949
  if (entry.target === "AGENTS.md") {
@@ -116315,7 +116960,7 @@ function registerInitCommand(program2, context4, options = {}) {
116315
116960
  const backupPath = `${globalConfigPath}.bak-${new Date().toISOString().replace(/[:.]/g, "-")}`;
116316
116961
  await context4.fs.writeFile(backupPath, await context4.fs.readFile(globalConfigPath));
116317
116962
  const bundledRoot = bundledConfigRoot();
116318
- const examplePath = bundledRoot !== null ? join41(bundledRoot, GLOBAL_CONFIG_EXAMPLE) : null;
116963
+ const examplePath = bundledRoot !== null ? join42(bundledRoot, GLOBAL_CONFIG_EXAMPLE) : null;
116319
116964
  if (examplePath !== null && await context4.fs.exists(examplePath)) {
116320
116965
  await context4.fs.writeFile(globalConfigPath, await context4.fs.readFile(examplePath));
116321
116966
  adoptedGlobal = true;
@@ -116385,13 +117030,13 @@ function registerInitCommand(program2, context4, options = {}) {
116385
117030
  ].join(`
116386
117031
  `)}
116387
117032
  `;
116388
- await context4.fs.ensureDir(join41(context4.cwd, CLI_CONFIG.configDir));
117033
+ await context4.fs.ensureDir(join42(context4.cwd, CLI_CONFIG.configDir));
116389
117034
  await context4.fs.writeFile(configPath, configYaml);
116390
117035
  result.created.push(configPath);
116391
- const agentsDir = join41(context4.cwd, CLI_CONFIG.configDir, "agents");
117036
+ const agentsDir = join42(context4.cwd, CLI_CONFIG.configDir, "agents");
116392
117037
  await context4.fs.ensureDir(agentsDir);
116393
- await writeIfNew(context4, join41(agentsDir, ".gitkeep"), "", force, result);
116394
- const gitignorePath = join41(context4.cwd, ".gitignore");
117038
+ await writeIfNew(context4, join42(agentsDir, ".gitkeep"), "", force, result);
117039
+ const gitignorePath = join42(context4.cwd, ".gitignore");
116395
117040
  const contextEntry = ".spur/context/";
116396
117041
  if (await context4.fs.exists(gitignorePath)) {
116397
117042
  const existing = await context4.fs.readFile(gitignorePath);
@@ -116411,20 +117056,20 @@ ${contextEntry}
116411
117056
  const configRoot = bundledConfigRoot();
116412
117057
  if (configRoot !== null) {
116413
117058
  for (const relPath of listBundledProjectSeedFiles()) {
116414
- const sourcePath = join41(configRoot, relPath);
117059
+ const sourcePath = join42(configRoot, relPath);
116415
117060
  if (!await context4.fs.exists(sourcePath))
116416
117061
  continue;
116417
- const targetPath = join41(context4.cwd, CLI_CONFIG.configDir, relPath);
116418
- await context4.fs.ensureDir(join41(targetPath, ".."));
117062
+ const targetPath = join42(context4.cwd, CLI_CONFIG.configDir, relPath);
117063
+ await context4.fs.ensureDir(join42(targetPath, ".."));
116419
117064
  await writeIfNew(context4, targetPath, await context4.fs.readFile(sourcePath), force, result);
116420
117065
  }
116421
117066
  for (const entry of SCAFFOLD_MANIFEST) {
116422
- const sourcePath = join41(configRoot, entry.source);
117067
+ const sourcePath = join42(configRoot, entry.source);
116423
117068
  if (!await context4.fs.exists(sourcePath))
116424
117069
  continue;
116425
- const baseDir = entry.root === true ? context4.cwd : join41(context4.cwd, CLI_CONFIG.configDir);
116426
- const targetPath = join41(baseDir, entry.target);
116427
- await context4.fs.ensureDir(join41(targetPath, ".."));
117070
+ const baseDir = entry.root === true ? context4.cwd : join42(context4.cwd, CLI_CONFIG.configDir);
117071
+ const targetPath = join42(baseDir, entry.target);
117072
+ await context4.fs.ensureDir(join42(targetPath, ".."));
116428
117073
  const entryForce = entry.preserve === true ? false : force;
116429
117074
  let body = await context4.fs.readFile(sourcePath);
116430
117075
  if (entry.target === "AGENTS.md") {
@@ -116437,7 +117082,7 @@ ${contextEntry}
116437
117082
  }
116438
117083
  }
116439
117084
  }
116440
- const agentsMdPath = join41(context4.cwd, "AGENTS.md");
117085
+ const agentsMdPath = join42(context4.cwd, "AGENTS.md");
116441
117086
  if (await context4.fs.exists(agentsMdPath)) {
116442
117087
  const existing = await context4.fs.readFile(agentsMdPath);
116443
117088
  if (!existing.includes(INDEXED_CONTEXT_MARKER)) {
@@ -116478,11 +117123,11 @@ ${contextEntry}
116478
117123
  // src/commands/maintain.ts
116479
117124
  init_src();
116480
117125
  init_src2();
116481
- import { join as join42 } from "path";
117126
+ import { join as join43 } from "path";
116482
117127
  function registerMaintainCommand(program2, context4, options = {}) {
116483
117128
  program2.command("maintain", { hidden: options.hidden === true }).summary("run database maintenance (optimize, WAL checkpoint truncation, optional VACUUM)").description("Run database maintenance: PRAGMA optimize, WAL checkpoint truncation; optionally VACUUM compaction.").option("--vacuum", "Run VACUUM defragmentation and page compaction", false).option(...SHARED_OPTIONS.jsonSupported).option(...SHARED_OPTIONS.jsonEnvelope).action(async (options2) => {
116484
117129
  const db2 = await context4.getDb();
116485
- const dbPath = context4.env.DATABASE_URL ?? join42(context4.cwd, DEFAULT_DATABASE_URL);
117130
+ const dbPath = context4.env.DATABASE_URL ?? join43(context4.cwd, DEFAULT_DATABASE_URL);
116486
117131
  const result = await maintainDatabase(db2, {
116487
117132
  vacuum: options2.vacuum === true,
116488
117133
  dbPath: dbPath.startsWith(":memory:") ? undefined : dbPath
@@ -116906,10 +117551,10 @@ async function waitForPendingDrain(agentService, teamService, pin, timeoutMs, si
116906
117551
 
116907
117552
  // src/commands/migrate.ts
116908
117553
  init_src2();
116909
- import { join as join43 } from "path";
117554
+ import { join as join44 } from "path";
116910
117555
  function registerMigrateCommand(program2, context4, options = {}) {
116911
117556
  program2.command("migrate", { hidden: options.hidden === true }).summary("apply CLI-owned schema migrations").option(...SHARED_OPTIONS.json).option(...SHARED_OPTIONS.jsonEnvelope).action(async (options2) => {
116912
- const migrations = await loadSqlMigrations(join43(context4.cwd, "drizzle")).catch(() => {
117557
+ const migrations = await loadSqlMigrations(join44(context4.cwd, "drizzle")).catch(() => {
116913
117558
  return;
116914
117559
  });
116915
117560
  const applied = await applyCliMigrations(await context4.getDb(), migrations);
@@ -116922,7 +117567,7 @@ function registerMigrateCommand(program2, context4, options = {}) {
116922
117567
  init_src2();
116923
117568
  init_dist5();
116924
117569
  await init_src3();
116925
- import { basename as basename15, dirname as dirname26, join as join44, resolve as resolve19 } from "path";
117570
+ import { basename as basename15, dirname as dirname26, join as join45, resolve as resolve19 } from "path";
116926
117571
  function registerProjectsCommand(program2, context4) {
116927
117572
  const projectsCmd = program2.command("projects").summary("manage the Spur multi-project registry");
116928
117573
  projectsCmd.command("add").argument("<path>", "Project root directory path").option(...SHARED_OPTIONS.nameProjectDisplay).option(...SHARED_OPTIONS.jsonProjectsResponse).option(...SHARED_OPTIONS.jsonEnvelope).action(async (pathArg, options) => {
@@ -117017,7 +117662,7 @@ function registerProjectsCommand(program2, context4) {
117017
117662
  running: p.port > 0 ? await isPortLive(p.port) : false
117018
117663
  })));
117019
117664
  const openProjectDb = async (projectPath) => {
117020
- const url2 = join44(projectPath, ".spur", "spur.db");
117665
+ const url2 = join45(projectPath, ".spur", "spur.db");
117021
117666
  await context4.fs.ensureDir(dirname26(url2));
117022
117667
  return createMigratedDb({ url: url2 });
117023
117668
  };
@@ -117460,7 +118105,7 @@ function formatTraceDetail(detail) {
117460
118105
  // src/commands/serve.ts
117461
118106
  init_src();
117462
118107
  import { statSync as statSync8 } from "fs";
117463
- import { join as join49, resolve as resolve21 } from "path";
118108
+ import { join as join50, resolve as resolve21 } from "path";
117464
118109
 
117465
118110
  // ../server/src/index.ts
117466
118111
  init_src();
@@ -117470,11 +118115,11 @@ init_src();
117470
118115
  init_loader();
117471
118116
  init_src2();
117472
118117
  await init_src3();
117473
- import { basename as basename17, dirname as dirname28, isAbsolute as isAbsolute8, join as join48 } from "path";
118118
+ import { basename as basename17, dirname as dirname28, isAbsolute as isAbsolute8, join as join49 } from "path";
117474
118119
  init_dist5();
117475
118120
 
117476
118121
  // ../server/src/bootstrap.ts
117477
- import { join as join46 } from "path";
118122
+ import { join as join47 } from "path";
117478
118123
 
117479
118124
  // ../../node_modules/.bun/radash@12.1.1/node_modules/radash/dist/esm/async.mjs
117480
118125
  var guard = (func, shouldGuard) => {
@@ -124409,7 +125054,7 @@ init_src2();
124409
125054
  init_dist5();
124410
125055
  await init_src3();
124411
125056
  import { homedir as homedir12 } from "os";
124412
- import { basename as basename16, join as join45, relative as relative6, resolve as resolve20 } from "path";
125057
+ import { basename as basename16, join as join46, relative as relative6, resolve as resolve20 } from "path";
124413
125058
  var startedAt = Date.now();
124414
125059
  var OPERATOR_AGENT_ID = "board-operator";
124415
125060
  var healthModule = {
@@ -124864,8 +125509,8 @@ var healthModule = {
124864
125509
  }
124865
125510
  });
124866
125511
  }
124867
- const projectPath = join45(ctx.cwd, ".spur", "config.yaml");
124868
- const globalPath = join45(homedir12(), ".config", "spur", "config.yaml");
125512
+ const projectPath = join46(ctx.cwd, ".spur", "config.yaml");
125513
+ const globalPath = join46(homedir12(), ".config", "spur", "config.yaml");
124869
125514
  let projectExists = false;
124870
125515
  let projectContent = "";
124871
125516
  let projectSizeBytes = 0;
@@ -124982,7 +125627,7 @@ var healthModule = {
124982
125627
  const projectRoot = ctx.cwd ?? process.cwd();
124983
125628
  const fs3 = ctx.fs ?? createNodeFileSystem3(projectRoot);
124984
125629
  const files = [];
124985
- const rootDesignPath = join45(projectRoot, "DESIGN.md");
125630
+ const rootDesignPath = join46(projectRoot, "DESIGN.md");
124986
125631
  if (await fs3.exists(rootDesignPath)) {
124987
125632
  let title2 = "UI/UX Design System";
124988
125633
  try {
@@ -124999,7 +125644,7 @@ var healthModule = {
124999
125644
  category: "root"
125000
125645
  });
125001
125646
  }
125002
- const doc04Path = join45(projectRoot, "docs", "04_DESIGN.md");
125647
+ const doc04Path = join46(projectRoot, "docs", "04_DESIGN.md");
125003
125648
  if (await fs3.exists(doc04Path)) {
125004
125649
  let title2 = "Concrete Surfaces & Contracts";
125005
125650
  try {
@@ -125016,7 +125661,7 @@ var healthModule = {
125016
125661
  category: "architecture"
125017
125662
  });
125018
125663
  }
125019
- const designDir = join45(projectRoot, "docs", "design");
125664
+ const designDir = join46(projectRoot, "docs", "design");
125020
125665
  if (await fs3.exists(designDir)) {
125021
125666
  let mdFiles = [];
125022
125667
  try {
@@ -125025,7 +125670,7 @@ var healthModule = {
125025
125670
  } catch {}
125026
125671
  mdFiles.sort((a2, b) => a2.localeCompare(b));
125027
125672
  for (const filename of mdFiles) {
125028
- const fullPath = join45(designDir, filename);
125673
+ const fullPath = join46(designDir, filename);
125029
125674
  const relPath = `docs/design/${filename}`;
125030
125675
  let title2 = filename.replace(/\.md$/, "").replace(/-/g, " ");
125031
125676
  try {
@@ -125063,7 +125708,7 @@ var healthModule = {
125063
125708
  try {
125064
125709
  const projectRoot = ctx.cwd ?? process.cwd();
125065
125710
  const fs3 = ctx.fs ?? createNodeFileSystem3(projectRoot);
125066
- const fullPath = join45(projectRoot, reqPath);
125711
+ const fullPath = join46(projectRoot, reqPath);
125067
125712
  if (!await fs3.exists(fullPath)) {
125068
125713
  return c3.json({ ok: false, error: "File not found" }, 404);
125069
125714
  }
@@ -125089,7 +125734,7 @@ var healthModule = {
125089
125734
  const projectRoot = ctx.cwd ?? process.cwd();
125090
125735
  const fs3 = ctx.fs ?? createNodeFileSystem3(projectRoot);
125091
125736
  const files = [];
125092
- const roadmapPath = join45(projectRoot, "docs", "02_ROADMAP.md");
125737
+ const roadmapPath = join46(projectRoot, "docs", "02_ROADMAP.md");
125093
125738
  if (await fs3.exists(roadmapPath)) {
125094
125739
  let title2 = "02 Roadmap \u2014 Spur";
125095
125740
  try {
@@ -125106,7 +125751,7 @@ var healthModule = {
125106
125751
  category: "roadmap"
125107
125752
  });
125108
125753
  }
125109
- const plansDir = join45(projectRoot, "docs", "plans");
125754
+ const plansDir = join46(projectRoot, "docs", "plans");
125110
125755
  if (await fs3.exists(plansDir)) {
125111
125756
  let mdFiles = [];
125112
125757
  try {
@@ -125115,7 +125760,7 @@ var healthModule = {
125115
125760
  } catch {}
125116
125761
  mdFiles.sort((a2, b) => b.localeCompare(a2));
125117
125762
  for (const filename of mdFiles) {
125118
- const fullPath = join45(plansDir, filename);
125763
+ const fullPath = join46(plansDir, filename);
125119
125764
  const relPath = `docs/plans/${filename}`;
125120
125765
  let title2 = filename.replace(/\.md$/, "").replace(/-/g, " ");
125121
125766
  try {
@@ -125153,7 +125798,7 @@ var healthModule = {
125153
125798
  try {
125154
125799
  const projectRoot = ctx.cwd ?? process.cwd();
125155
125800
  const fs3 = ctx.fs ?? createNodeFileSystem3(projectRoot);
125156
- const fullPath = join45(projectRoot, reqPath);
125801
+ const fullPath = join46(projectRoot, reqPath);
125157
125802
  if (!await fs3.exists(fullPath)) {
125158
125803
  return c3.json({ ok: false, error: "File not found" }, 404);
125159
125804
  }
@@ -128125,7 +128770,7 @@ function createApp(appRt, opts) {
128125
128770
  app.use("*", async (c3, next) => {
128126
128771
  const pathname = c3.req.path === "/" ? "/index.html" : c3.req.path;
128127
128772
  try {
128128
- const file2 = Bun.file(join46(webDistPath, pathname));
128773
+ const file2 = Bun.file(join47(webDistPath, pathname));
128129
128774
  if (await file2.exists()) {
128130
128775
  const headers = new Headers({ "content-type": file2.type });
128131
128776
  return new Response(file2.stream(), { headers });
@@ -128138,7 +128783,7 @@ function createApp(appRt, opts) {
128138
128783
  return c3.json({ error: "Not Found" }, 404);
128139
128784
  }
128140
128785
  try {
128141
- const indexFile = Bun.file(join46(webDistPath, "index.html"));
128786
+ const indexFile = Bun.file(join47(webDistPath, "index.html"));
128142
128787
  if (await indexFile.exists()) {
128143
128788
  return new Response(indexFile.stream(), {
128144
128789
  headers: { "content-type": "text/html; charset=utf-8" }
@@ -128160,7 +128805,7 @@ init_loader();
128160
128805
  init_src2();
128161
128806
  init_dist5();
128162
128807
  await init_src3();
128163
- import { dirname as dirname27, join as join47 } from "path";
128808
+ import { dirname as dirname27, join as join48 } from "path";
128164
128809
  var NOOP_OUTPUT = { write: (_s) => {}, error: (_s) => {} };
128165
128810
 
128166
128811
  class LazyPlanningEventEmitter {
@@ -128196,7 +128841,7 @@ class NotConfiguredError extends Error {
128196
128841
  function createServerContext(appRt, options) {
128197
128842
  const cwd = options.cwd;
128198
128843
  const fs3 = options.fs;
128199
- const dbUrl = options.dbUrl ?? join47(cwd, DEFAULT_DATABASE_URL);
128844
+ const dbUrl = options.dbUrl ?? join48(cwd, DEFAULT_DATABASE_URL);
128200
128845
  const eventsBus = options.eventsBus ?? appRt.events;
128201
128846
  const jobQueueEnabled = options.jobQueueEnabled ?? false;
128202
128847
  const eventProjectContext = systemEventProjectContext(cwd);
@@ -128501,7 +129146,7 @@ async function loadServerSectionMatrix(projectRoot) {
128501
129146
  }
128502
129147
  const root = bundledConfigRoot();
128503
129148
  if (root !== null) {
128504
- const matrixPath = join48(root, "tasks", "section-matrix.yaml");
129149
+ const matrixPath = join49(root, "tasks", "section-matrix.yaml");
128505
129150
  if (await nodeFs.exists(matrixPath)) {
128506
129151
  return await loadStructuredSpurConfig(matrixPath, {
128507
129152
  validateJsonSchema: false
@@ -128510,7 +129155,7 @@ async function loadServerSectionMatrix(projectRoot) {
128510
129155
  }
128511
129156
  throw new Error(`no canonical section-matrix found for task creation (F92 R1); tried:
128512
129157
  ` + ` - ${localPath}
128513
- ` + (root !== null ? ` - ${join48(root, "tasks", "section-matrix.yaml")}
129158
+ ` + (root !== null ? ` - ${join49(root, "tasks", "section-matrix.yaml")}
128514
129159
  ` : "") + "copy/generate section-matrix.yaml from the canonical build-time matrix asset (repo `config` `tasks` tree) into one of those paths");
128515
129160
  }
128516
129161
  var SYSTEM_EVENTS_PRUNE_JOB = "system-events-prune";
@@ -128746,15 +129391,15 @@ async function handleFeatureActionJob(ctx, env2, payload) {
128746
129391
  await runFeatureActionJob(ctx, env2, payload);
128747
129392
  }
128748
129393
  async function resolveWebDistPath(configuredPath, projectRoot = process.cwd()) {
128749
- const candidates = configuredPath && configuredPath.trim() !== "" ? [isAbsolute8(configuredPath) ? configuredPath : join48(projectRoot, configuredPath)] : [
128750
- join48(projectRoot, "dist/web"),
128751
- join48(import.meta.dir, "web"),
128752
- join48(dirname28(process.execPath), "web"),
128753
- join48(dirname28(process.execPath), "../web"),
128754
- join48(import.meta.dir, "../../../dist/web")
129394
+ const candidates = configuredPath && configuredPath.trim() !== "" ? [isAbsolute8(configuredPath) ? configuredPath : join49(projectRoot, configuredPath)] : [
129395
+ join49(projectRoot, "dist/web"),
129396
+ join49(import.meta.dir, "web"),
129397
+ join49(dirname28(process.execPath), "web"),
129398
+ join49(dirname28(process.execPath), "../web"),
129399
+ join49(import.meta.dir, "../../../dist/web")
128755
129400
  ];
128756
129401
  for (const candidate of candidates) {
128757
- if (await Bun.file(join48(candidate, "index.html")).exists()) {
129402
+ if (await Bun.file(join49(candidate, "index.html")).exists()) {
128758
129403
  return candidate;
128759
129404
  }
128760
129405
  }
@@ -129081,7 +129726,7 @@ var SQLITE_BUSY_MESSAGE_CONSTANTS = Object.freeze({
129081
129726
 
129082
129727
  // src/commands/serve.ts
129083
129728
  function resolveServeDbUrl(cwd, env2, configuredUrl) {
129084
- return env2.DATABASE_URL === undefined ? join49(cwd, DEFAULT_DATABASE_URL) : configuredUrl;
129729
+ return env2.DATABASE_URL === undefined ? join50(cwd, DEFAULT_DATABASE_URL) : configuredUrl;
129085
129730
  }
129086
129731
  function resolveServeCwd(cwd) {
129087
129732
  const resolved = resolve21(cwd);
@@ -129137,7 +129782,7 @@ function registerServeCommand(program2, context4, options = {}) {
129137
129782
  }
129138
129783
 
129139
129784
  // src/commands/status.ts
129140
- import { join as join50 } from "path";
129785
+ import { join as join51 } from "path";
129141
129786
 
129142
129787
  // src/git-context.ts
129143
129788
  init_dist5();
@@ -129185,8 +129830,8 @@ function registerStatusCommand(program2, context4, options = {}) {
129185
129830
  }
129186
129831
  async function runStatusCore(path9, options, context4) {
129187
129832
  const [packageJsonExists, spurConfigExists, git3, agentSpecs] = await Promise.all([
129188
- context4.fs.exists(join50(context4.cwd, "package.json")),
129189
- context4.fs.exists(join50(context4.cwd, ".spur", "config.yaml")),
129833
+ context4.fs.exists(join51(context4.cwd, "package.json")),
129834
+ context4.fs.exists(join51(context4.cwd, ".spur", "config.yaml")),
129190
129835
  gitContext(context4.cwd),
129191
129836
  listAgentSpecIds(context4)
129192
129837
  ]);
@@ -129217,14 +129862,14 @@ async function runStatusCore(path9, options, context4) {
129217
129862
  return status.ok ? 0 : 1;
129218
129863
  }
129219
129864
  async function listAgentSpecIds(context4) {
129220
- const dir = join50(context4.cwd, ".spur", "agents");
129865
+ const dir = join51(context4.cwd, ".spur", "agents");
129221
129866
  if (!await context4.fs.exists(dir))
129222
129867
  return [];
129223
129868
  const entries = await context4.fs.readDir(dir);
129224
129869
  return entries.filter((entry) => entry.endsWith(".yaml") || entry.endsWith(".yml")).map((entry) => entry.replace(/\.ya?ml$/, "")).sort();
129225
129870
  }
129226
129871
  async function readTargetStatus(context4, targetPath) {
129227
- const resolved = join50(context4.cwd, targetPath);
129872
+ const resolved = join51(context4.cwd, targetPath);
129228
129873
  const stat2 = await context4.fs.stat(resolved);
129229
129874
  if (stat2 === null)
129230
129875
  throw new CommandError(`status failed: path does not exist at ${resolved}`);
@@ -129241,7 +129886,7 @@ init_dist7();
129241
129886
  init_dist5();
129242
129887
  await init_src3();
129243
129888
  import { closeSync as closeSync6, fstatSync as fstatSync4, openSync as openSync6, readFileSync as readFileSync15, readSync as readSync3 } from "fs";
129244
- import { join as join51 } from "path";
129889
+ import { join as join52 } from "path";
129245
129890
  import { createInterface } from "readline";
129246
129891
  import { setTimeout as sleep6 } from "timers/promises";
129247
129892
 
@@ -129378,9 +130023,9 @@ async function writeWorkflowPlanArtifact(cwd, runId, resolved, secretValues) {
129378
130023
  }))
129379
130024
  });
129380
130025
  const { mkdir: mkdir2, writeFile: writeFile3 } = await import("fs/promises");
129381
- const artifactsDir = join51(cwd, ".spur", "run");
130026
+ const artifactsDir = join52(cwd, ".spur", "run");
129382
130027
  await mkdir2(artifactsDir, { recursive: true });
129383
- const artifactPath = join51(artifactsDir, `${runId}-workflow-plan.json`);
130028
+ const artifactPath = join52(artifactsDir, `${runId}-workflow-plan.json`);
129384
130029
  await writeFile3(artifactPath, payload);
129385
130030
  return artifactPath;
129386
130031
  }
@@ -129676,7 +130321,7 @@ Monitor with: spur workflow trace ${runId2} --follow`);
129676
130321
  }
129677
130322
  const runLog = options.log === false ? undefined : new WorkflowRunLogSink({
129678
130323
  bus,
129679
- dir: join51(context4.cwd, ".spur", "run"),
130324
+ dir: join52(context4.cwd, ".spur", "run"),
129680
130325
  runId,
129681
130326
  ...planPreview !== undefined ? { planPreview } : {},
129682
130327
  secrets: configuredSecretValues(context4.env),
@@ -129887,7 +130532,7 @@ Monitor with: spur workflow trace ${runId2} --follow`);
129887
130532
  }
129888
130533
  const runLog = options.log === false ? undefined : new WorkflowRunLogSink({
129889
130534
  bus,
129890
- dir: join51(context4.cwd, ".spur", "run"),
130535
+ dir: join52(context4.cwd, ".spur", "run"),
129891
130536
  runId: targetId,
129892
130537
  secrets: configuredSecretValues(context4.env),
129893
130538
  ...resolveOutputLogConfig(context4.spurConfig ?? null)
@@ -130393,8 +131038,8 @@ function readRunLogChunk(logPath, offset) {
130393
131038
  async function followRunLog(service, runId, dir, pollMs, write, wait = (ms) => sleep6(ms), now2 = Date.now, deadlineMs) {
130394
131039
  const start = now2();
130395
131040
  const deadline = deadlineMs === undefined ? Number.POSITIVE_INFINITY : start + deadlineMs;
130396
- const runDir = join51(dir, ".spur", "run");
130397
- const pendingMdPath = join51(runDir, `${runId}.md`);
131041
+ const runDir = join52(dir, ".spur", "run");
131042
+ const pendingMdPath = join52(runDir, `${runId}.md`);
130398
131043
  let logPath;
130399
131044
  let record3 = { kind: "missing" };
130400
131045
  let offset = 0;
@@ -130489,7 +131134,7 @@ init_src();
130489
131134
  init_src2();
130490
131135
  init_dist5();
130491
131136
  await init_src3();
130492
- import { dirname as dirname29, join as join52, resolve as resolve22 } from "path";
131137
+ import { dirname as dirname29, join as join53, resolve as resolve22 } from "path";
130493
131138
  import { isatty as isatty4 } from "tty";
130494
131139
 
130495
131140
  // ../../node_modules/.bun/@clack+core@1.4.1/node_modules/@clack/core/dist/index.mjs
@@ -131926,7 +132571,7 @@ function createCliContext(options) {
131926
132571
  function noopSetExitCode(_code) {}
131927
132572
  async function createMigratedDbAdapter(cwd = process.cwd(), env2 = getEnvVars(), dbUrl) {
131928
132573
  const config4 = buildConfigFromEnv(env2);
131929
- const configuredUrl = env2.DATABASE_URL === undefined ? join52(cwd, DEFAULT_DATABASE_URL) : config4.database.url;
132574
+ const configuredUrl = env2.DATABASE_URL === undefined ? join53(cwd, DEFAULT_DATABASE_URL) : config4.database.url;
131930
132575
  const url2 = dbUrl ?? configuredUrl;
131931
132576
  if (url2 !== IN_MEMORY_DATABASE_URL) {
131932
132577
  await createNodeFileSystem3().ensureDir(dirname29(url2));