@titan-design/active-work 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -76,7 +76,7 @@ import {
76
76
  writeFrontmatter,
77
77
  writeNoteFile,
78
78
  writeYaml
79
- } from "./chunk-BK25ASXA.js";
79
+ } from "./chunk-RLSQSE7I.js";
80
80
 
81
81
  // src/cli.ts
82
82
  import { Command, CommanderError } from "commander";
@@ -5039,7 +5039,7 @@ var edit_default = edit;
5039
5039
 
5040
5040
  // src/commands/mcp-serve.ts
5041
5041
  import { spawn as spawn3 } from "child_process";
5042
- import { z as z42 } from "zod";
5042
+ import { z as z43 } from "zod";
5043
5043
 
5044
5044
  // src/server/mcp.ts
5045
5045
  import {
@@ -5055,9 +5055,8 @@ import {
5055
5055
  toolNameToCommandName as pkgToolNameToCommandName
5056
5056
  } from "@titan-design/registry";
5057
5057
 
5058
- // src/server/health.ts
5059
- var DAEMON_VERSION = "0.1.0";
5060
- var startedAt = Date.now();
5058
+ // src/version.ts
5059
+ var BUILD_VERSION = "0.5.0";
5061
5060
 
5062
5061
  // src/server/mcp.ts
5063
5062
  var TOOL_NAME_PREFIX = "active__";
@@ -5068,7 +5067,7 @@ function mcpOptions() {
5068
5067
  formatError,
5069
5068
  toolPrefix: TOOL_NAME_PREFIX,
5070
5069
  name: "@hjewkes/active-work",
5071
- version: DAEMON_VERSION
5070
+ version: BUILD_VERSION
5072
5071
  };
5073
5072
  }
5074
5073
  async function runMcpStdio() {
@@ -5402,6 +5401,7 @@ function taskResolver(root) {
5402
5401
  // src/workspace-index/refresh.ts
5403
5402
  import { promises as fs43 } from "fs";
5404
5403
  import matter4 from "gray-matter";
5404
+ import { z as z42 } from "zod";
5405
5405
 
5406
5406
  // src/workspace-index/refs.ts
5407
5407
  import path48 from "path";
@@ -6031,16 +6031,17 @@ function isUnchanged(row, file) {
6031
6031
  return row.lastOffset > 0 && row.fileSize === file.size && row.fileMtime === file.mtime;
6032
6032
  }
6033
6033
  var BATCH = 200;
6034
+ function describeFailure(err) {
6035
+ if (err instanceof z42.ZodError) {
6036
+ return err.issues.map((issue) => `${issue.path.join(".") || "(root)"}: ${issue.message}`).join("; ");
6037
+ }
6038
+ return err instanceof Error ? err.message : String(err);
6039
+ }
6034
6040
  async function readAttempt(file, watermarkId) {
6035
6041
  try {
6036
6042
  return { file, watermarkId, record: await readRecord(file), reason: null };
6037
6043
  } catch (err) {
6038
- return {
6039
- file,
6040
- watermarkId,
6041
- record: null,
6042
- reason: err instanceof Error ? err.message : String(err)
6043
- };
6044
+ return { file, watermarkId, record: null, reason: describeFailure(err) };
6044
6045
  }
6045
6046
  }
6046
6047
  function applyBatch(graph, writer, batch) {
@@ -6287,7 +6288,7 @@ async function withRefreshLock(fn) {
6287
6288
  }
6288
6289
  }
6289
6290
  async function runRefresh(options = {}) {
6290
- const startedAt2 = (/* @__PURE__ */ new Date()).toISOString();
6291
+ const startedAt = (/* @__PURE__ */ new Date()).toISOString();
6291
6292
  const started = Date.now();
6292
6293
  const graph = options.graph ?? openGraph(options.dbPath ?? defaultGraphPath());
6293
6294
  const owned = options.graph === void 0;
@@ -6312,7 +6313,7 @@ async function runRefresh(options = {}) {
6312
6313
  });
6313
6314
  const preserved = replayPreserved(graph);
6314
6315
  return {
6315
- startedAt: startedAt2,
6316
+ startedAt,
6316
6317
  durationMs: Date.now() - started,
6317
6318
  transcripts: discovered.length,
6318
6319
  scanned: visiting.length,
@@ -6498,7 +6499,7 @@ async function runDaemon(options = {}) {
6498
6499
  stateDir: getStateRoot(),
6499
6500
  port: resolvePort(options),
6500
6501
  watchRoot: getActiveRoot(),
6501
- version: DAEMON_VERSION,
6502
+ version: BUILD_VERSION,
6502
6503
  logger: log,
6503
6504
  health: () => ({ index: toHealthIndexState(indexWatch?.status()) }),
6504
6505
  mountRoutes: (app) => {
@@ -6537,15 +6538,15 @@ async function runDaemon(options = {}) {
6537
6538
  }
6538
6539
 
6539
6540
  // src/commands/mcp-serve.ts
6540
- var ArgsSchema38 = z42.object({
6541
- stdio: z42.boolean().optional(),
6542
- detach: z42.boolean().optional(),
6543
- port: z42.number().int().positive().optional()
6541
+ var ArgsSchema38 = z43.object({
6542
+ stdio: z43.boolean().optional(),
6543
+ detach: z43.boolean().optional(),
6544
+ port: z43.number().int().positive().optional()
6544
6545
  });
6545
- var ResultSchema34 = z42.object({
6546
- mode: z42.enum(["stdio", "http", "detached"]),
6547
- pid: z42.number().optional(),
6548
- port: z42.number().optional()
6546
+ var ResultSchema34 = z43.object({
6547
+ mode: z43.enum(["stdio", "http", "detached"]),
6548
+ pid: z43.number().optional(),
6549
+ port: z43.number().optional()
6549
6550
  });
6550
6551
  function detachedSpawn(port) {
6551
6552
  const entry = process.argv[1];
@@ -6600,11 +6601,11 @@ var mcp_serve_default = defineCommand({
6600
6601
  });
6601
6602
 
6602
6603
  // src/commands/mcp-stop.ts
6603
- import { z as z43 } from "zod";
6604
- var ArgsSchema39 = z43.object({});
6605
- var ResultSchema35 = z43.union([
6606
- z43.object({ stopped: z43.literal(true), pid: z43.number() }),
6607
- z43.object({ stopped: z43.literal(false), reason: z43.string() })
6604
+ import { z as z44 } from "zod";
6605
+ var ArgsSchema39 = z44.object({});
6606
+ var ResultSchema35 = z44.union([
6607
+ z44.object({ stopped: z44.literal(true), pid: z44.number() }),
6608
+ z44.object({ stopped: z44.literal(false), reason: z44.string() })
6608
6609
  ]);
6609
6610
  var SHUTDOWN_TIMEOUT_MS = 3e3;
6610
6611
  var POLL_INTERVAL_MS = 100;
@@ -6649,13 +6650,13 @@ var mcp_stop_default = defineCommand({
6649
6650
 
6650
6651
  // src/commands/mcp-restart.ts
6651
6652
  import { spawn as spawn4 } from "child_process";
6652
- import { z as z44 } from "zod";
6653
- var ArgsSchema40 = z44.object({
6654
- port: z44.number().int().positive().optional()
6653
+ import { z as z45 } from "zod";
6654
+ var ArgsSchema40 = z45.object({
6655
+ port: z45.number().int().positive().optional()
6655
6656
  });
6656
- var ResultSchema36 = z44.object({
6657
- pid: z44.number(),
6658
- port: z44.number()
6657
+ var ResultSchema36 = z45.object({
6658
+ pid: z45.number(),
6659
+ port: z45.number()
6659
6660
  });
6660
6661
  var SHUTDOWN_TIMEOUT_MS2 = 15e3;
6661
6662
  var KILL_TIMEOUT_MS = 3e3;
@@ -6743,17 +6744,17 @@ var mcp_restart_default = defineCommand({
6743
6744
  });
6744
6745
 
6745
6746
  // src/commands/mcp-status.ts
6746
- import { z as z45 } from "zod";
6747
- var ArgsSchema41 = z45.object({});
6748
- var ResultSchema37 = z45.object({
6749
- running: z45.boolean(),
6750
- pid: z45.number().optional(),
6751
- port: z45.number().optional(),
6752
- version: z45.string().optional(),
6753
- uptime_ms: z45.number().optional(),
6754
- healthy: z45.boolean().optional(),
6747
+ import { z as z46 } from "zod";
6748
+ var ArgsSchema41 = z46.object({});
6749
+ var ResultSchema37 = z46.object({
6750
+ running: z46.boolean(),
6751
+ pid: z46.number().optional(),
6752
+ port: z46.number().optional(),
6753
+ version: z46.string().optional(),
6754
+ uptime_ms: z46.number().optional(),
6755
+ healthy: z46.boolean().optional(),
6755
6756
  /** Answering `/health` with no PID file naming it — see `removePidFile`. */
6756
- orphaned: z45.boolean().optional()
6757
+ orphaned: z46.boolean().optional()
6757
6758
  });
6758
6759
  async function statusByPort(port) {
6759
6760
  const health = await probeHealth(port);
@@ -6806,12 +6807,12 @@ var mcp_status_default = defineCommand({
6806
6807
  // src/commands/mcp-logs.ts
6807
6808
  import { promises as fs45 } from "fs";
6808
6809
  import path57 from "path";
6809
- import { z as z46 } from "zod";
6810
- var ArgsSchema42 = z46.object({
6811
- lines: z46.number().int().positive().optional()
6810
+ import { z as z47 } from "zod";
6811
+ var ArgsSchema42 = z47.object({
6812
+ lines: z47.number().int().positive().optional()
6812
6813
  });
6813
- var ResultSchema38 = z46.object({
6814
- lines: z46.array(z46.string())
6814
+ var ResultSchema38 = z47.object({
6815
+ lines: z47.array(z47.string())
6815
6816
  });
6816
6817
  var DEFAULT_LINES = 50;
6817
6818
  var mcp_logs_default = defineCommand({
@@ -6848,7 +6849,7 @@ var mcp_logs_default = defineCommand({
6848
6849
  });
6849
6850
 
6850
6851
  // src/commands/miner-drain-ingest.ts
6851
- import { z as z50 } from "zod";
6852
+ import { z as z51 } from "zod";
6852
6853
 
6853
6854
  // src/drain/transcript-reader.ts
6854
6855
  import { nextOffset, prefixHash, readJsonLines, resumePoint } from "@titan-design/locator";
@@ -6862,29 +6863,29 @@ import { promises as fs46 } from "fs";
6862
6863
  import path58 from "path";
6863
6864
 
6864
6865
  // src/schemas/template.ts
6865
- import { z as z47 } from "zod";
6866
- var LocatorSchema = z47.tuple([
6867
- z47.number().int().nonnegative(),
6868
- z47.number().int().nonnegative(),
6869
- z47.number().int().positive()
6866
+ import { z as z48 } from "zod";
6867
+ var LocatorSchema = z48.tuple([
6868
+ z48.number().int().nonnegative(),
6869
+ z48.number().int().nonnegative(),
6870
+ z48.number().int().positive()
6870
6871
  ]);
6871
- var TemplateSchema = z47.object({
6872
- templateId: z47.string().min(1),
6873
- toolType: z47.string().min(1),
6874
- maskedSignature: z47.string().min(1),
6875
- createdAt: z47.string().min(1),
6876
- occurrenceCount: z47.number().int().nonnegative(),
6872
+ var TemplateSchema = z48.object({
6873
+ templateId: z48.string().min(1),
6874
+ toolType: z48.string().min(1),
6875
+ maskedSignature: z48.string().min(1),
6876
+ createdAt: z48.string().min(1),
6877
+ occurrenceCount: z48.number().int().nonnegative(),
6877
6878
  exemplarLocator: LocatorSchema
6878
6879
  });
6879
- var OccurrenceSchema = z47.object({
6880
- templateId: z47.string().min(1),
6880
+ var OccurrenceSchema = z48.object({
6881
+ templateId: z48.string().min(1),
6881
6882
  locator: LocatorSchema,
6882
- sessionId: z47.string().min(1),
6883
- timestamp: z47.string().min(1),
6884
- extractedParams: z47.record(z47.string(), z47.string()).optional()
6883
+ sessionId: z48.string().min(1),
6884
+ timestamp: z48.string().min(1),
6885
+ extractedParams: z48.record(z48.string(), z48.string()).optional()
6885
6886
  });
6886
- var TemplatesFileSchema = z47.object({
6887
- templates: z47.array(TemplateSchema).default([])
6887
+ var TemplatesFileSchema = z48.object({
6888
+ templates: z48.array(TemplateSchema).default([])
6888
6889
  });
6889
6890
 
6890
6891
  // src/drain/store.ts
@@ -6931,27 +6932,27 @@ async function appendOccurrences(occurrences, root = getMinerRoot()) {
6931
6932
  // src/drain/tree-store.ts
6932
6933
  import { promises as fs47 } from "fs";
6933
6934
  import path59 from "path";
6934
- import { z as z48 } from "zod";
6935
- var PartitionSchema = z48.object({
6936
- partition: z48.string().min(1),
6937
- nextClusterId: z48.number().int().positive(),
6938
- clusters: z48.array(
6939
- z48.object({
6940
- clusterId: z48.number().int().positive(),
6941
- tokens: z48.array(z48.string()),
6942
- size: z48.number().int().nonnegative()
6935
+ import { z as z49 } from "zod";
6936
+ var PartitionSchema = z49.object({
6937
+ partition: z49.string().min(1),
6938
+ nextClusterId: z49.number().int().positive(),
6939
+ clusters: z49.array(
6940
+ z49.object({
6941
+ clusterId: z49.number().int().positive(),
6942
+ tokens: z49.array(z49.string()),
6943
+ size: z49.number().int().nonnegative()
6943
6944
  })
6944
6945
  ),
6945
6946
  /** `clusterId -> templateId`, as pairs so the file has a stable order. */
6946
- templateIds: z48.array(z48.tuple([z48.number().int().positive(), z48.string().min(1)]))
6947
+ templateIds: z49.array(z49.tuple([z49.number().int().positive(), z49.string().min(1)]))
6947
6948
  });
6948
- var TreeSnapshotFileSchema = z48.object({
6949
- version: z48.literal(1).default(1),
6950
- partitions: z48.array(PartitionSchema).default([])
6949
+ var TreeSnapshotFileSchema = z49.object({
6950
+ version: z49.literal(1).default(1),
6951
+ partitions: z49.array(PartitionSchema).default([])
6951
6952
  });
6952
- var LegacySnapshotFileSchema = z48.object({
6953
- version: z48.literal(1),
6954
- trees: z48.array(PartitionSchema.omit({ partition: true }).extend({ toolType: z48.string().min(1) }))
6953
+ var LegacySnapshotFileSchema = z49.object({
6954
+ version: z49.literal(1),
6955
+ trees: z49.array(PartitionSchema.omit({ partition: true }).extend({ toolType: z49.string().min(1) }))
6955
6956
  });
6956
6957
  function snapshotPath(root) {
6957
6958
  return path59.join(root, "drain-trees.json");
@@ -7134,23 +7135,23 @@ function extractBlobs(line, toolNames) {
7134
7135
  // src/drain/reader-state.ts
7135
7136
  import { promises as fs48 } from "fs";
7136
7137
  import path60 from "path";
7137
- import { z as z49 } from "zod";
7138
- var TranscriptStateSchema = z49.object({
7138
+ import { z as z50 } from "zod";
7139
+ var TranscriptStateSchema = z50.object({
7139
7140
  /** `~`-relative path, matching `session-index/discover.ts`'s display form. */
7140
- path: z49.string().min(1),
7141
- lastByteOffset: z49.number().int().nonnegative().default(0),
7141
+ path: z50.string().min(1),
7142
+ lastByteOffset: z50.number().int().nonnegative().default(0),
7142
7143
  /** sha256 of bytes `[0, lastByteOffset)`; detects rewrite vs. append. */
7143
- prefixHash: z49.string().nullable().default(null),
7144
+ prefixHash: z50.string().nullable().default(null),
7144
7145
  /**
7145
7146
  * `tool_use_id -> tool name` pairs seen but not yet consumed by a result.
7146
7147
  * Persisted because a chunk boundary routinely falls between an assistant's
7147
7148
  * `tool_use` and the user line carrying its result.
7148
7149
  */
7149
- pendingToolNames: z49.record(z49.string(), z49.string()).default({})
7150
+ pendingToolNames: z50.record(z50.string(), z50.string()).default({})
7150
7151
  });
7151
- var ReaderStateSchema = z49.object({
7152
- version: z49.literal(1).default(1),
7153
- transcripts: z49.array(TranscriptStateSchema).default([])
7152
+ var ReaderStateSchema = z50.object({
7153
+ version: z50.literal(1).default(1),
7154
+ transcripts: z50.array(TranscriptStateSchema).default([])
7154
7155
  });
7155
7156
  var MAX_PENDING_TOOL_NAMES = 256;
7156
7157
  function readerStatePath(root = getMinerRoot()) {
@@ -7261,7 +7262,7 @@ async function ingestLine(parsed, locator, toolNames, ingestor, counters, sample
7261
7262
  }
7262
7263
  }
7263
7264
  async function runDrainIngest(options = {}) {
7264
- const startedAt2 = (/* @__PURE__ */ new Date()).toISOString();
7265
+ const startedAt = (/* @__PURE__ */ new Date()).toISOString();
7265
7266
  const started = process.hrtime.bigint();
7266
7267
  const root = options.root ?? getMinerRoot();
7267
7268
  const corpusRoot = options.corpusRoot ?? transcriptsRoot3();
@@ -7308,7 +7309,7 @@ async function runDrainIngest(options = {}) {
7308
7309
  await ingestor.flush();
7309
7310
  await saveReaderState(state, root);
7310
7311
  return {
7311
- startedAt: startedAt2,
7312
+ startedAt,
7312
7313
  durationMs: Number(process.hrtime.bigint() - started) / 1e6,
7313
7314
  transcripts: discovered.length,
7314
7315
  scanned,
@@ -7321,27 +7322,27 @@ async function runDrainIngest(options = {}) {
7321
7322
  }
7322
7323
 
7323
7324
  // src/commands/miner-drain-ingest.ts
7324
- var ArgsSchema43 = z50.object({
7325
- full: z50.boolean().optional(),
7326
- limit: z50.coerce.number().int().positive().optional(),
7327
- verify_hashes: z50.boolean().optional()
7328
- });
7329
- var ResultSchema39 = z50.object({
7330
- startedAt: z50.string(),
7331
- durationMs: z50.number(),
7332
- transcripts: z50.number(),
7333
- scanned: z50.number(),
7334
- unchanged: z50.number(),
7335
- rewound: z50.number(),
7336
- linesRead: z50.number(),
7337
- malformedLines: z50.number(),
7338
- blobs: z50.number(),
7339
- ingested: z50.number(),
7340
- newTemplates: z50.number(),
7341
- templates: z50.number(),
7342
- evicting: z50.boolean(),
7343
- curve: z50.array(z50.object({ blobs: z50.number(), templates: z50.number(), evicting: z50.boolean() })),
7344
- errors: z50.array(z50.string())
7325
+ var ArgsSchema43 = z51.object({
7326
+ full: z51.boolean().optional(),
7327
+ limit: z51.coerce.number().int().positive().optional(),
7328
+ verify_hashes: z51.boolean().optional()
7329
+ });
7330
+ var ResultSchema39 = z51.object({
7331
+ startedAt: z51.string(),
7332
+ durationMs: z51.number(),
7333
+ transcripts: z51.number(),
7334
+ scanned: z51.number(),
7335
+ unchanged: z51.number(),
7336
+ rewound: z51.number(),
7337
+ linesRead: z51.number(),
7338
+ malformedLines: z51.number(),
7339
+ blobs: z51.number(),
7340
+ ingested: z51.number(),
7341
+ newTemplates: z51.number(),
7342
+ templates: z51.number(),
7343
+ evicting: z51.boolean(),
7344
+ curve: z51.array(z51.object({ blobs: z51.number(), templates: z51.number(), evicting: z51.boolean() })),
7345
+ errors: z51.array(z51.string())
7345
7346
  });
7346
7347
  var miner_drain_ingest_default = defineCommand({
7347
7348
  name: "miner.drain-ingest",
@@ -7374,46 +7375,46 @@ var miner_drain_ingest_default = defineCommand({
7374
7375
  });
7375
7376
 
7376
7377
  // src/commands/miner-refresh.ts
7377
- import { z as z51 } from "zod";
7378
- var ArgsSchema44 = z51.object({
7379
- full: z51.boolean().optional(),
7380
- limit: z51.coerce.number().int().positive().optional(),
7381
- verify_hashes: z51.boolean().optional()
7382
- });
7383
- var WorkspaceSchema = z51.object({
7384
- files: z51.number(),
7385
- indexed: z51.number(),
7386
- unchanged: z51.number(),
7387
- removed: z51.number(),
7388
- malformed: z51.array(z51.object({ path: z51.string(), reason: z51.string() })),
7389
- rows: z51.object({
7390
- initiative: z51.number(),
7391
- note: z51.number(),
7392
- task: z51.number(),
7393
- session: z51.number(),
7394
- source: z51.number()
7378
+ import { z as z52 } from "zod";
7379
+ var ArgsSchema44 = z52.object({
7380
+ full: z52.boolean().optional(),
7381
+ limit: z52.coerce.number().int().positive().optional(),
7382
+ verify_hashes: z52.boolean().optional()
7383
+ });
7384
+ var WorkspaceSchema = z52.object({
7385
+ files: z52.number(),
7386
+ indexed: z52.number(),
7387
+ unchanged: z52.number(),
7388
+ removed: z52.number(),
7389
+ malformed: z52.array(z52.object({ path: z52.string(), reason: z52.string() })),
7390
+ rows: z52.object({
7391
+ initiative: z52.number(),
7392
+ note: z52.number(),
7393
+ task: z52.number(),
7394
+ session: z52.number(),
7395
+ source: z52.number()
7395
7396
  }),
7396
- edges: z51.object({ holds: z51.number(), mentions: z51.number(), sharesTag: z51.number() }),
7397
- orphanRatio: z51.number()
7398
- });
7399
- var ResultSchema40 = z51.object({
7400
- startedAt: z51.string(),
7401
- durationMs: z51.number(),
7402
- transcripts: z51.number(),
7403
- scanned: z51.number(),
7404
- indexed: z51.number(),
7405
- rewound: z51.number(),
7406
- unchanged: z51.number(),
7407
- quarantined: z51.number(),
7408
- missing: z51.number(),
7409
- reconciledMissing: z51.number(),
7410
- factsAdded: z51.number(),
7411
- turnsRolledUp: z51.number(),
7412
- tasksRequested: z51.number(),
7413
- tasksApplied: z51.number(),
7397
+ edges: z52.object({ holds: z52.number(), mentions: z52.number(), sharesTag: z52.number() }),
7398
+ orphanRatio: z52.number()
7399
+ });
7400
+ var ResultSchema40 = z52.object({
7401
+ startedAt: z52.string(),
7402
+ durationMs: z52.number(),
7403
+ transcripts: z52.number(),
7404
+ scanned: z52.number(),
7405
+ indexed: z52.number(),
7406
+ rewound: z52.number(),
7407
+ unchanged: z52.number(),
7408
+ quarantined: z52.number(),
7409
+ missing: z52.number(),
7410
+ reconciledMissing: z52.number(),
7411
+ factsAdded: z52.number(),
7412
+ turnsRolledUp: z52.number(),
7413
+ tasksRequested: z52.number(),
7414
+ tasksApplied: z52.number(),
7414
7415
  workspace: WorkspaceSchema.nullable(),
7415
- preserved: z51.object({ restored: z51.number(), merged: z51.number(), skipped: z51.number() }),
7416
- errors: z51.array(z51.string())
7416
+ preserved: z52.object({ restored: z52.number(), merged: z52.number(), skipped: z52.number() }),
7417
+ errors: z52.array(z52.string())
7417
7418
  });
7418
7419
  var miner_refresh_default = defineCommand({
7419
7420
  name: "miner.refresh",
@@ -7445,7 +7446,7 @@ var miner_refresh_default = defineCommand({
7445
7446
 
7446
7447
  // src/commands/miner-liveness.ts
7447
7448
  import { existsSync as existsSync3 } from "fs";
7448
- import { z as z52 } from "zod";
7449
+ import { z as z53 } from "zod";
7449
7450
 
7450
7451
  // src/session-index/liveness.ts
7451
7452
  import { existsSync as existsSync2 } from "fs";
@@ -7562,22 +7563,22 @@ function runLiveness(db) {
7562
7563
  }
7563
7564
 
7564
7565
  // src/commands/miner-liveness.ts
7565
- var ArgsSchema45 = z52.object({});
7566
- var ResultSchema41 = z52.object({
7567
- emptyColumns: z52.array(
7568
- z52.object({ table: z52.string(), column: z52.string(), rows: z52.number(), nonNull: z52.number() })
7566
+ var ArgsSchema45 = z53.object({});
7567
+ var ResultSchema41 = z53.object({
7568
+ emptyColumns: z53.array(
7569
+ z53.object({ table: z53.string(), column: z53.string(), rows: z53.number(), nonNull: z53.number() })
7569
7570
  ),
7570
- unusedRelations: z52.array(z52.string()),
7571
- undeclaredRelations: z52.array(z52.string()),
7572
- danglingNamespaces: z52.array(
7573
- z52.object({ namespace: z52.string(), edges: z52.number(), dangling: z52.number() })
7571
+ unusedRelations: z53.array(z53.string()),
7572
+ undeclaredRelations: z53.array(z53.string()),
7573
+ danglingNamespaces: z53.array(
7574
+ z53.object({ namespace: z53.string(), edges: z53.number(), dangling: z53.number() })
7574
7575
  ),
7575
- unmappedNamespaces: z52.array(z52.string()),
7576
- expectedEmptyColumns: z52.array(
7577
- z52.object({ table: z52.string(), column: z52.string(), reason: z52.string() })
7576
+ unmappedNamespaces: z53.array(z53.string()),
7577
+ expectedEmptyColumns: z53.array(
7578
+ z53.object({ table: z53.string(), column: z53.string(), reason: z53.string() })
7578
7579
  ),
7579
- staleTranscripts: z52.number(),
7580
- transcripts: z52.number()
7580
+ staleTranscripts: z53.number(),
7581
+ transcripts: z53.number()
7581
7582
  });
7582
7583
  function report(result) {
7583
7584
  const lines = [color.bold("active-work miner liveness")];
@@ -7668,40 +7669,40 @@ var miner_liveness_default = defineCommand({
7668
7669
 
7669
7670
  // src/commands/miner-status.ts
7670
7671
  import { existsSync as existsSync4, statSync } from "fs";
7671
- import { z as z53 } from "zod";
7672
- var ArgsSchema46 = z53.object({});
7673
- var ResultSchema42 = z53.object({
7674
- dbPath: z53.string(),
7675
- schemaVersion: z53.number(),
7676
- sizeBytes: z53.number(),
7677
- counts: z53.object({
7678
- transcripts: z53.number(),
7679
- sessions: z53.number(),
7680
- facts: z53.number(),
7681
- turns: z53.number(),
7682
- edges: z53.number(),
7683
- spans: z53.number()
7672
+ import { z as z54 } from "zod";
7673
+ var ArgsSchema46 = z54.object({});
7674
+ var ResultSchema42 = z54.object({
7675
+ dbPath: z54.string(),
7676
+ schemaVersion: z54.number(),
7677
+ sizeBytes: z54.number(),
7678
+ counts: z54.object({
7679
+ transcripts: z54.number(),
7680
+ sessions: z54.number(),
7681
+ facts: z54.number(),
7682
+ turns: z54.number(),
7683
+ edges: z54.number(),
7684
+ spans: z54.number()
7684
7685
  }),
7685
- transcripts: z53.object({
7686
- ok: z53.number(),
7687
- quarantined: z53.number(),
7688
- missing: z53.number()
7686
+ transcripts: z54.object({
7687
+ ok: z54.number(),
7688
+ quarantined: z54.number(),
7689
+ missing: z54.number()
7689
7690
  }),
7690
- watermark: z53.object({
7691
- lastIndexedAt: z53.string().nullable(),
7692
- behindBytes: z53.number()
7691
+ watermark: z54.object({
7692
+ lastIndexedAt: z54.string().nullable(),
7693
+ behindBytes: z54.number()
7693
7694
  }),
7694
- fts: z53.object({
7695
- rows: z53.number(),
7696
- orphanRows: z53.number(),
7697
- needsFullRebuild: z53.boolean()
7695
+ fts: z54.object({
7696
+ rows: z54.number(),
7697
+ orphanRows: z54.number(),
7698
+ needsFullRebuild: z54.boolean()
7698
7699
  }),
7699
- daemon: z53.object({
7700
- indexing: z53.boolean(),
7701
- pending: z53.boolean(),
7702
- lastRunAt: z53.string().nullable(),
7703
- lastDurationMs: z53.number().nullable(),
7704
- consecutiveErrors: z53.number()
7700
+ daemon: z54.object({
7701
+ indexing: z54.boolean(),
7702
+ pending: z54.boolean(),
7703
+ lastRunAt: z54.string().nullable(),
7704
+ lastDurationMs: z54.number().nullable(),
7705
+ consecutiveErrors: z54.number()
7705
7706
  }).nullable()
7706
7707
  });
7707
7708
  var ORPHAN_WARN_RATIO = 0.2;
@@ -7785,7 +7786,7 @@ var miner_status_default = defineCommand({
7785
7786
  });
7786
7787
 
7787
7788
  // src/commands/hooks-agent-chat-spawn.ts
7788
- import { z as z55 } from "zod";
7789
+ import { z as z56 } from "zod";
7789
7790
 
7790
7791
  // src/utils/read-stdin-json.ts
7791
7792
  async function readStdinJson(stream = process.stdin) {
@@ -7806,12 +7807,12 @@ async function readStdinJson(stream = process.stdin) {
7806
7807
  // src/utils/agent-chat-hook-state.ts
7807
7808
  import { promises as fs49 } from "fs";
7808
7809
  import path61 from "path";
7809
- import { z as z54 } from "zod";
7810
- var SpawnContextSchema = z54.object({
7811
- slug: z54.string().min(1),
7812
- sessionId: z54.string().min(1),
7813
- name: z54.string(),
7814
- started: z54.string(),
7810
+ import { z as z55 } from "zod";
7811
+ var SpawnContextSchema = z55.object({
7812
+ slug: z55.string().min(1),
7813
+ sessionId: z55.string().min(1),
7814
+ name: z55.string(),
7815
+ started: z55.string(),
7815
7816
  /**
7816
7817
  * The spawning session, already resolved from the payload's `parent`
7817
7818
  * agentId to a session id. Resolved at spawn time on purpose: `parent` names
@@ -7819,10 +7820,10 @@ var SpawnContextSchema = z54.object({
7819
7820
  * another live entry in this same directory — which is gone by the time
7820
7821
  * on_complete runs, because reading one deletes it.
7821
7822
  */
7822
- parentSessionId: z54.string().min(1).nullable().default(null),
7823
+ parentSessionId: z55.string().min(1).nullable().default(null),
7823
7824
  /** agent-chat profile and briefing slug, for the recorded session's prose. */
7824
- profile: z54.string().nullable().default(null),
7825
- briefing: z54.string().nullable().default(null)
7825
+ profile: z55.string().nullable().default(null),
7826
+ briefing: z55.string().nullable().default(null)
7826
7827
  });
7827
7828
  function stateDir() {
7828
7829
  return path61.join(getStateRoot(), "agent-chat-hooks");
@@ -7854,10 +7855,10 @@ async function peekSpawnContext(agentId) {
7854
7855
  }
7855
7856
 
7856
7857
  // src/commands/hooks-agent-chat-spawn.ts
7857
- var ArgsSchema47 = z55.object({});
7858
- var ResultSchema43 = z55.object({
7859
- matched: z55.boolean(),
7860
- slug: z55.string().nullable()
7858
+ var ArgsSchema47 = z56.object({});
7859
+ var ResultSchema43 = z56.object({
7860
+ matched: z56.boolean(),
7861
+ slug: z56.string().nullable()
7861
7862
  });
7862
7863
  function str2(source, key) {
7863
7864
  const value = source?.[key];
@@ -7899,11 +7900,11 @@ var hooks_agent_chat_spawn_default = defineCommand({
7899
7900
 
7900
7901
  // src/commands/hooks-agent-chat-complete.ts
7901
7902
  import { spawn as spawn5 } from "child_process";
7902
- import { z as z56 } from "zod";
7903
- var ArgsSchema48 = z56.object({});
7904
- var ResultSchema44 = z56.object({
7905
- recorded: z56.boolean(),
7906
- slug: z56.string().nullable()
7903
+ import { z as z57 } from "zod";
7904
+ var ArgsSchema48 = z57.object({});
7905
+ var ResultSchema44 = z57.object({
7906
+ recorded: z57.boolean(),
7907
+ slug: z57.string().nullable()
7907
7908
  });
7908
7909
  function str3(source, key) {
7909
7910
  const value = source?.[key];
@@ -7982,7 +7983,7 @@ var hooks_agent_chat_complete_default = defineCommand({
7982
7983
  });
7983
7984
 
7984
7985
  // src/commands/setup.ts
7985
- import { z as z58 } from "zod";
7986
+ import { z as z59 } from "zod";
7986
7987
 
7987
7988
  // src/setup/steps.ts
7988
7989
  import { promises as fsp3, existsSync as existsSync5 } from "fs";
@@ -8133,7 +8134,7 @@ import path64 from "path";
8133
8134
 
8134
8135
  // src/migrations/v3-proposal.ts
8135
8136
  import { promises as fs51 } from "fs";
8136
- import { z as z57 } from "zod";
8137
+ import { z as z58 } from "zod";
8137
8138
 
8138
8139
  // src/migrations/data/v3-open-loops-proposal.ts
8139
8140
  var V3_OPEN_LOOPS_PROPOSAL = {
@@ -8929,36 +8930,36 @@ var KEBAB_SESSION_ID = SessionIdSchema.regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, {
8929
8930
  message: "session_id must be kebab-case ([a-z0-9-], no leading/trailing dash)"
8930
8931
  });
8931
8932
  var ISO_INSTANT = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
8932
- var AbandonedSchema = z57.object({ note: z57.string().min(1) });
8933
+ var AbandonedSchema = z58.object({ note: z58.string().min(1) });
8933
8934
  var ProposalNextStepSchema = NextStepSchema.extend({
8934
8935
  abandoned: AbandonedSchema.optional()
8935
8936
  });
8936
- var ProposalInitiativeSchema = z57.object({
8937
- slug: z57.string().min(1),
8937
+ var ProposalInitiativeSchema = z58.object({
8938
+ slug: z58.string().min(1),
8938
8939
  /**
8939
8940
  * Real last-touch of the initiative, hand-supplied. Never `Date.now()` and
8940
8941
  * never file mtime — several initiatives have mtimes months adrift from
8941
8942
  * their true last-touch, and the whole point of back-dating is to preserve
8942
8943
  * the staleness signal.
8943
8944
  */
8944
- ended: z57.string().regex(ISO_INSTANT, {
8945
+ ended: z58.string().regex(ISO_INSTANT, {
8945
8946
  message: "ended must be an ISO 8601 instant with timezone"
8946
8947
  }),
8947
8948
  session_id: KEBAB_SESSION_ID,
8948
- body: z57.string().min(1),
8949
- next_steps: z57.array(ProposalNextStepSchema).default([])
8949
+ body: z58.string().min(1),
8950
+ next_steps: z58.array(ProposalNextStepSchema).default([])
8950
8951
  });
8951
- var ProposalSchema = z57.object({
8952
+ var ProposalSchema = z58.object({
8952
8953
  /**
8953
8954
  * When the abandonment decision was made. Hand-supplied rather than read
8954
8955
  * from the clock: the second session's filename derives from it, and the
8955
8956
  * migration keys idempotence on exact paths, so `Date.now()` would mint a
8956
8957
  * fresh path — and a duplicate abandonment session — on every re-run.
8957
8958
  */
8958
- abandoned_at: z57.string().regex(ISO_INSTANT, {
8959
+ abandoned_at: z58.string().regex(ISO_INSTANT, {
8959
8960
  message: "abandoned_at must be an ISO 8601 instant with timezone"
8960
8961
  }).optional(),
8961
- initiatives: z57.array(ProposalInitiativeSchema)
8962
+ initiatives: z58.array(ProposalInitiativeSchema)
8962
8963
  }).superRefine((value, ctx) => {
8963
8964
  const withAbandoned = value.initiatives.filter(
8964
8965
  (i) => i.next_steps.some((n) => n.abandoned !== void 0)
@@ -10888,20 +10889,20 @@ async function runUninstall(deps = {}) {
10888
10889
  }
10889
10890
 
10890
10891
  // src/commands/setup.ts
10891
- var ArgsSchema49 = z58.object({
10892
- update: z58.boolean().optional(),
10893
- yes: z58.boolean().optional()
10892
+ var ArgsSchema49 = z59.object({
10893
+ update: z59.boolean().optional(),
10894
+ yes: z59.boolean().optional()
10894
10895
  });
10895
- var StepSchema = z58.object({
10896
- name: z58.string(),
10897
- ok: z58.boolean(),
10898
- done: z58.boolean().optional(),
10899
- message: z58.string().optional(),
10900
- error: z58.string().optional()
10896
+ var StepSchema = z59.object({
10897
+ name: z59.string(),
10898
+ ok: z59.boolean(),
10899
+ done: z59.boolean().optional(),
10900
+ message: z59.string().optional(),
10901
+ error: z59.string().optional()
10901
10902
  });
10902
- var ResultSchema45 = z58.object({
10903
- banner: z58.string(),
10904
- steps: z58.array(StepSchema)
10903
+ var ResultSchema45 = z59.object({
10904
+ banner: z59.string(),
10905
+ steps: z59.array(StepSchema)
10905
10906
  });
10906
10907
  function printStep(step) {
10907
10908
  if (step.ok) {
@@ -10954,19 +10955,19 @@ var setup_default = defineCommand({
10954
10955
  });
10955
10956
 
10956
10957
  // src/commands/uninstall.ts
10957
- import { z as z59 } from "zod";
10958
- var ArgsSchema50 = z59.object({
10959
- yes: z59.boolean().optional()
10958
+ import { z as z60 } from "zod";
10959
+ var ArgsSchema50 = z60.object({
10960
+ yes: z60.boolean().optional()
10960
10961
  });
10961
- var StepSchema2 = z59.object({
10962
- name: z59.string(),
10963
- done: z59.boolean(),
10964
- message: z59.string().optional(),
10965
- error: z59.string().optional()
10962
+ var StepSchema2 = z60.object({
10963
+ name: z60.string(),
10964
+ done: z60.boolean(),
10965
+ message: z60.string().optional(),
10966
+ error: z60.string().optional()
10966
10967
  });
10967
- var ResultSchema46 = z59.object({
10968
- steps: z59.array(StepSchema2),
10969
- activeRootPreservedAt: z59.string()
10968
+ var ResultSchema46 = z60.object({
10969
+ steps: z60.array(StepSchema2),
10970
+ activeRootPreservedAt: z60.string()
10970
10971
  });
10971
10972
  var uninstall_default = defineCommand({
10972
10973
  name: "uninstall",
@@ -11002,7 +11003,7 @@ var uninstall_default = defineCommand({
11002
11003
  });
11003
11004
 
11004
11005
  // src/commands/doctor.ts
11005
- import { z as z60 } from "zod";
11006
+ import { z as z61 } from "zod";
11006
11007
 
11007
11008
  // src/doctor.ts
11008
11009
  import { promises as fsp4 } from "fs";
@@ -11410,15 +11411,15 @@ async function runDoctor(deps = {}) {
11410
11411
  }
11411
11412
 
11412
11413
  // src/commands/doctor.ts
11413
- var ArgsSchema51 = z60.object({});
11414
- var CheckSchema = z60.object({
11415
- name: z60.string(),
11416
- status: z60.enum(["ok", "warn", "fail"]),
11417
- detail: z60.string()
11414
+ var ArgsSchema51 = z61.object({});
11415
+ var CheckSchema = z61.object({
11416
+ name: z61.string(),
11417
+ status: z61.enum(["ok", "warn", "fail"]),
11418
+ detail: z61.string()
11418
11419
  });
11419
- var ResultSchema47 = z60.object({
11420
- ok: z60.boolean(),
11421
- checks: z60.array(CheckSchema)
11420
+ var ResultSchema47 = z61.object({
11421
+ ok: z61.boolean(),
11422
+ checks: z61.array(CheckSchema)
11422
11423
  });
11423
11424
  function badge(status) {
11424
11425
  if (status === "ok") return color.green("OK ");
@@ -11446,34 +11447,34 @@ var doctor_default = defineCommand({
11446
11447
  });
11447
11448
 
11448
11449
  // src/commands/migrate.ts
11449
- import { z as z61 } from "zod";
11450
- var ArgsSchema52 = z61.object({
11451
- dry_run: z61.boolean().optional(),
11452
- apply: z61.boolean().optional()
11453
- });
11454
- var SessionSchema = z61.object({
11455
- kind: z61.enum(["open", "abandon"]),
11456
- action: z61.enum(["write", "exists"]),
11457
- file: z61.string(),
11458
- ended: z61.string(),
11459
- loops: z61.number().int().nonnegative(),
11460
- resolves: z61.number().int().nonnegative()
11461
- });
11462
- var InitiativeSchema = z61.object({
11463
- slug: z61.string(),
11464
- sessions: z61.array(SessionSchema),
11465
- task_seq_backfill: z61.number().int().positive().nullable(),
11466
- brief_repairs: z61.array(z61.string()),
11467
- brief_blocked: z61.string().optional(),
11468
- handoff: z61.enum(["archive-and-remove", "archive-exists", "absent"]),
11469
- note: z61.string().optional()
11470
- });
11471
- var ResultSchema48 = z61.object({
11472
- applied: z61.boolean(),
11473
- proposal: z61.string(),
11474
- initiatives: z61.array(InitiativeSchema),
11475
- repairs: z61.array(z61.object({ action: z61.string(), file: z61.string(), detail: z61.string() })),
11476
- uncovered: z61.array(z61.string())
11450
+ import { z as z62 } from "zod";
11451
+ var ArgsSchema52 = z62.object({
11452
+ dry_run: z62.boolean().optional(),
11453
+ apply: z62.boolean().optional()
11454
+ });
11455
+ var SessionSchema = z62.object({
11456
+ kind: z62.enum(["open", "abandon"]),
11457
+ action: z62.enum(["write", "exists"]),
11458
+ file: z62.string(),
11459
+ ended: z62.string(),
11460
+ loops: z62.number().int().nonnegative(),
11461
+ resolves: z62.number().int().nonnegative()
11462
+ });
11463
+ var InitiativeSchema = z62.object({
11464
+ slug: z62.string(),
11465
+ sessions: z62.array(SessionSchema),
11466
+ task_seq_backfill: z62.number().int().positive().nullable(),
11467
+ brief_repairs: z62.array(z62.string()),
11468
+ brief_blocked: z62.string().optional(),
11469
+ handoff: z62.enum(["archive-and-remove", "archive-exists", "absent"]),
11470
+ note: z62.string().optional()
11471
+ });
11472
+ var ResultSchema48 = z62.object({
11473
+ applied: z62.boolean(),
11474
+ proposal: z62.string(),
11475
+ initiatives: z62.array(InitiativeSchema),
11476
+ repairs: z62.array(z62.object({ action: z62.string(), file: z62.string(), detail: z62.string() })),
11477
+ uncovered: z62.array(z62.string())
11477
11478
  });
11478
11479
  function describe2(plan, applied) {
11479
11480
  const initiatives = plan.initiatives.map((i) => ({
@@ -11585,18 +11586,18 @@ var migrate_default = defineCommand({
11585
11586
 
11586
11587
  // src/commands/sync.ts
11587
11588
  import os7 from "os";
11588
- import { z as z62 } from "zod";
11589
- var ArgsSchema53 = z62.object({
11590
- message: z62.string().min(1).optional(),
11591
- require_clean: z62.boolean().optional()
11592
- });
11593
- var ResultSchema49 = z62.object({
11594
- branch: z62.string(),
11595
- committed: z62.boolean(),
11596
- committed_files: z62.number().int(),
11597
- rebased: z62.boolean(),
11598
- pushed: z62.boolean(),
11599
- summary: z62.string()
11589
+ import { z as z63 } from "zod";
11590
+ var ArgsSchema53 = z63.object({
11591
+ message: z63.string().min(1).optional(),
11592
+ require_clean: z63.boolean().optional()
11593
+ });
11594
+ var ResultSchema49 = z63.object({
11595
+ branch: z63.string(),
11596
+ committed: z63.boolean(),
11597
+ committed_files: z63.number().int(),
11598
+ rebased: z63.boolean(),
11599
+ pushed: z63.boolean(),
11600
+ summary: z63.string()
11600
11601
  });
11601
11602
  async function git(root, args) {
11602
11603
  return getGitRunner()("git", ["-C", root, ...args]);
@@ -12012,7 +12013,7 @@ function attachCommand(root, cmd) {
12012
12013
  function buildProgram() {
12013
12014
  const program = new Command();
12014
12015
  program.exitOverride();
12015
- program.name("active-work").description("active-work CLI \u2014 durable workspace state for engineering work").version("0.1.0").option("--json", "emit machine-readable JSON envelope on stdout").addHelpText(
12016
+ program.name("active-work").description("active-work CLI \u2014 durable workspace state for engineering work").version(BUILD_VERSION).option("--json", "emit machine-readable JSON envelope on stdout").addHelpText(
12016
12017
  "after",
12017
12018
  "\nRun `active-work <command> --help` for command-specific options.\nTip: `aw [slug]` launches Claude with the bootstrap prompt.\n"
12018
12019
  );