@useorgx/wizard 0.1.67 → 0.1.68

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/README.md CHANGED
@@ -35,7 +35,7 @@ The wizard modifies local tool configuration only. Depending on the command, it
35
35
  - `hooks install [--targets codex,claude-code]` installs bounded local capture hooks. Terminal session events and adapter-supplied `RunEnd` events write compact summaries to a durable queue, then request a detached single-flight delivery worker. `RunEnd` represents one completed agent run inside a conversation that may continue. Receipt-ready captures remain queued until the server confirms that the automatic receipt was persisted; a session-only 2xx response is not enough. The hook does not read credentials or perform network I/O. Set `ORGX_SESSION_SUMMARY_AUTO_FLUSH=off` for local-only capture and manual delivery. The legacy transcript-derived execution-graph emit remains off unless `ORGX_EMIT_EXECUTION_GRAPH=1` is set.
36
36
  - `ORGX_SESSION_WORK_CONTEXT` can carry one explicit, bounded JSON annotation for intent, authority, cost, artifact and evidence references, plus exact Context Capsule, decision, constraint, expectation, applied-learning, and prior-receipt references. Capsule delivery requires both the capsule reference and delivery timestamp. The Wizard does not infer this context from prompts; invalid or oversized annotations are omitted, and unknown fields are removed before cloud delivery.
37
37
  - `hooks flush [--limit 100]` is the manual delivery and recovery path. It uses the same queue lease as automatic delivery and removes each valid file only after a successful server acknowledgement. Failed captures stay queued for retry; malformed captures move to the owner-only `session-summary-captures/quarantine/` directory and make a manual flush fail visibly without being deleted.
38
- - `hooks doctor` shows hook wiring, automatic-delivery configuration, active and quarantined capture counts, and the legacy spool count without changing local configuration.
38
+ - `hooks doctor` shows hook wiring, automatic-delivery configuration, active and quarantined capture counts, the legacy spool count, and capture readiness for Claude Code, Codex, Cursor, and OpenCode without changing local configuration. Add `--json` for the versioned `orgx-client-continuity/v1` machine contract, per-client terminal boundary, warnings, and exact next action.
39
39
  - `hooks backfill` previews compact summaries distilled from the legacy spool. It does not upload or archive anything unless you add `--post --yes`; `--truncate` also requires both flags and archives the original spool only after every upload succeeds.
40
40
  - `map [query...] --deep-search` runs the v1 Operating Map discovery flow over connected company signals and cited deep research, prints source health and low-confidence ProcessCards, and keeps ownership/timing/"done" confirmation human-gated. Add `--candidate <id-or-number> --yes` to explicitly propose one card as an OperatingProcess; the wizard never auto-confirms or activates inferred workflow ownership.
41
41
  - `surface list` shows supported surfaces and current status.
package/dist/cli.js CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  // src/cli.ts
4
4
 
5
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="20c1b754-5691-5226-9f34-921cdff2d9f8")}catch(e){}}();
5
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4b5dd32d-184b-560a-ae80-e8a055ae1bc4")}catch(e){}}();
6
6
  import * as clack from "@clack/prompts";
7
7
  import { spawnSync as spawnSync5 } from "child_process";
8
8
  import { readFileSync as readFileSync10 } from "fs";
9
9
  import { hostname } from "os";
10
- import { resolve as resolve4 } from "path";
10
+ import { resolve as resolve5 } from "path";
11
11
  import { Command } from "commander";
12
12
  import pc3 from "picocolors";
13
13
 
@@ -837,7 +837,7 @@ function parsePairingPollResult(value) {
837
837
  };
838
838
  }
839
839
  function sleep(ms) {
840
- return new Promise((resolve5) => setTimeout(resolve5, ms));
840
+ return new Promise((resolve6) => setTimeout(resolve6, ms));
841
841
  }
842
842
  async function startBrowserPairing(options, fetchImpl) {
843
843
  const data = await fetchJson({
@@ -950,12 +950,12 @@ h1{font-size:1.5rem;color:#b91c1c}p{color:#555;margin-top:.5rem}</style>
950
950
  <p>Return to your terminal and try again.</p>
951
951
  </div></body></html>`;
952
952
  function tryListen(port, hostname2) {
953
- return new Promise((resolve5, reject) => {
953
+ return new Promise((resolve6, reject) => {
954
954
  const server = createServer();
955
955
  server.once("error", reject);
956
956
  server.listen(port, hostname2, () => {
957
957
  server.removeListener("error", reject);
958
- resolve5(server);
958
+ resolve6(server);
959
959
  });
960
960
  });
961
961
  }
@@ -984,7 +984,7 @@ async function startLocalAuthServer(options) {
984
984
  const successHtml = options.successHtml ?? DEFAULT_SUCCESS_HTML;
985
985
  const errorHtml = options.errorHtml ?? DEFAULT_ERROR_HTML;
986
986
  const { server, port } = await bindServer(options.preferredPort, hostname2);
987
- const result = new Promise((resolve5, reject) => {
987
+ const result = new Promise((resolve6, reject) => {
988
988
  const timer = setTimeout(() => {
989
989
  server.close();
990
990
  reject(new Error("Timed out waiting for browser authorization."));
@@ -1027,7 +1027,7 @@ async function startLocalAuthServer(options) {
1027
1027
  res.writeHead(200, { "Content-Type": "text/html" }).end(successHtml);
1028
1028
  clearTimeout(timer);
1029
1029
  server.close();
1030
- resolve5({ code, state });
1030
+ resolve6({ code, state });
1031
1031
  });
1032
1032
  });
1033
1033
  return { port, result };
@@ -4013,7 +4013,7 @@ function formatCommandFailure(command, args, result) {
4013
4013
  return `${command} ${args.join(" ")} failed${result.exitCode >= 0 ? ` with exit code ${result.exitCode}` : ""}${detail ? `: ${detail}` : "."}`;
4014
4014
  }
4015
4015
  async function defaultCommandRunner(command, args) {
4016
- return await new Promise((resolve5) => {
4016
+ return await new Promise((resolve6) => {
4017
4017
  const child = spawn(command, [...args], {
4018
4018
  env: process.env,
4019
4019
  stdio: ["ignore", "pipe", "pipe"]
@@ -4028,7 +4028,7 @@ async function defaultCommandRunner(command, args) {
4028
4028
  });
4029
4029
  child.on("error", (error) => {
4030
4030
  const errorCode2 = typeof error === "object" && error && "code" in error ? String(error.code) : void 0;
4031
- resolve5({
4031
+ resolve6({
4032
4032
  exitCode: -1,
4033
4033
  stdout,
4034
4034
  stderr,
@@ -4036,7 +4036,7 @@ async function defaultCommandRunner(command, args) {
4036
4036
  });
4037
4037
  });
4038
4038
  child.on("close", (code) => {
4039
- resolve5({
4039
+ resolve6({
4040
4040
  exitCode: code ?? -1,
4041
4041
  stdout,
4042
4042
  stderr
@@ -6354,7 +6354,7 @@ function initializeWizardSentry() {
6354
6354
  Sentry.init({
6355
6355
  dsn,
6356
6356
  environment: process.env.ORGX_SENTRY_ENVIRONMENT || "production",
6357
- release: "useorgx-wizard@0.1.67",
6357
+ release: "useorgx-wizard@0.1.68",
6358
6358
  tracesSampleRate: sampleRate(process.env.ORGX_SENTRY_TRACES_SAMPLE_RATE),
6359
6359
  enableLogs: true,
6360
6360
  sendDefaultPii: false,
@@ -13766,9 +13766,9 @@ function buildWorkGraphHookReplayPatch(readResult) {
13766
13766
  }
13767
13767
 
13768
13768
  // src/lib/runtime-hooks.ts
13769
- import { copyFileSync, existsSync as existsSync9, mkdirSync as mkdirSync4, readdirSync as readdirSync6 } from "fs";
13770
- import { homedir as homedir3 } from "os";
13771
- import { dirname as dirname5, join as join8, resolve as resolve2 } from "path";
13769
+ import { copyFileSync, existsSync as existsSync10, mkdirSync as mkdirSync4, readdirSync as readdirSync6 } from "fs";
13770
+ import { homedir as homedir4 } from "os";
13771
+ import { dirname as dirname6, join as join9, resolve as resolve3 } from "path";
13772
13772
 
13773
13773
  // src/lib/session-summary-hook.ts
13774
13774
  var SESSION_SUMMARY_HOOK_MARKER = "orgx-session-summary.mjs";
@@ -14535,6 +14535,141 @@ if (invokedDirectly) {
14535
14535
  `;
14536
14536
  }
14537
14537
 
14538
+ // src/lib/client-continuity.ts
14539
+ import { existsSync as existsSync9 } from "fs";
14540
+ import { homedir as homedir3 } from "os";
14541
+ import { dirname as dirname5, join as join8, resolve as resolve2 } from "path";
14542
+ var CLIENT_CONTINUITY_SCHEMA_VERSION = "orgx-client-continuity/v1";
14543
+ function readJson(path) {
14544
+ return parseJsonObject(readTextIfExists(path));
14545
+ }
14546
+ function string(value) {
14547
+ return typeof value === "string" && value.trim() ? value.trim() : null;
14548
+ }
14549
+ function sharedCaptureReady(options) {
14550
+ return options.shared.summaryHookInstalled && options.shared.automaticDelivery;
14551
+ }
14552
+ function sharedNextAction(options) {
14553
+ return sharedCaptureReady(options) ? null : "Run orgx-wizard hooks install --targets all, then re-run hooks doctor --json.";
14554
+ }
14555
+ function wizardHookStatus(client, installed, options) {
14556
+ const captureReady = installed && sharedCaptureReady(options);
14557
+ const warnings = [
14558
+ ...!installed ? [`${client} runtime hooks are not installed.`] : [],
14559
+ ...!options.shared.summaryHookInstalled ? ["The shared bounded session-summary hook is missing."] : [],
14560
+ ...!options.shared.automaticDelivery ? ["ACK-gated automatic delivery is not configured."] : []
14561
+ ];
14562
+ return {
14563
+ client,
14564
+ state: captureReady ? "ready" : installed ? "attention_required" : "not_installed",
14565
+ installed,
14566
+ adapterVersion: null,
14567
+ captureReady,
14568
+ terminalBoundary: "session_end",
14569
+ warnings,
14570
+ nextAction: captureReady ? null : installed ? sharedNextAction(options) : `Run orgx-wizard hooks install --targets ${client}, then re-run hooks doctor --json.`
14571
+ };
14572
+ }
14573
+ function cursorStatus(paths, options) {
14574
+ const manifest = readJson(paths.cursorManifestPath);
14575
+ const hooks = readJson(paths.cursorHooksPath);
14576
+ const hookMap = hooks.hooks && typeof hooks.hooks === "object" && !Array.isArray(hooks.hooks) ? hooks.hooks : {};
14577
+ const installed = existsSync9(paths.cursorManifestPath) && existsSync9(paths.cursorHooksPath);
14578
+ const hasRunBoundary = ["afterAgentResponse", "stop", "sessionEnd"].every(
14579
+ (name) => Array.isArray(hookMap[name]) && hookMap[name].length > 0
14580
+ );
14581
+ const captureReady = installed && hasRunBoundary && sharedCaptureReady(options);
14582
+ const warnings = [
14583
+ ...!installed ? ["The managed Cursor companion plugin is not installed."] : [],
14584
+ ...installed && !hasRunBoundary ? ["Cursor is missing one or more terminal receipt hooks."] : [],
14585
+ ...!options.shared.summaryHookInstalled ? ["The shared bounded session-summary hook is missing."] : [],
14586
+ ...!options.shared.automaticDelivery ? ["ACK-gated automatic delivery is not configured."] : []
14587
+ ];
14588
+ return {
14589
+ client: "cursor",
14590
+ state: captureReady ? "ready" : installed ? "attention_required" : "not_installed",
14591
+ installed,
14592
+ adapterVersion: string(manifest.version),
14593
+ captureReady,
14594
+ terminalBoundary: "stop/session_end (afterAgentResponse CLI fallback)",
14595
+ warnings,
14596
+ nextAction: captureReady ? null : !installed || !hasRunBoundary ? "Run orgx-wizard plugins add cursor, reload Cursor, then re-run hooks doctor --json." : sharedNextAction(options)
14597
+ };
14598
+ }
14599
+ function openCodeStatus(paths, options) {
14600
+ const packageJson = readJson(paths.openCodePackagePath);
14601
+ const packageName = string(packageJson.name);
14602
+ const entry = string(packageJson.main) ?? "dist/index.js";
14603
+ const entryPath = resolve2(dirname5(paths.openCodePackagePath), entry);
14604
+ const bridgePath = join8(dirname5(entryPath), "sessionSummaryBridge.js");
14605
+ const bridge = readTextIfExists(bridgePath);
14606
+ const installed = packageName === "@useorgx/orgx-opencode-plugin" && existsSync9(entryPath);
14607
+ const hasRunBoundary = Boolean(
14608
+ bridge?.includes("session.idle") && bridge.includes("RunEnd")
14609
+ );
14610
+ const captureReady = installed && hasRunBoundary && sharedCaptureReady(options);
14611
+ const warnings = [
14612
+ ...!installed ? ["The stable OrgX OpenCode plugin entry point is not installed."] : [],
14613
+ ...installed && !hasRunBoundary ? ["OpenCode is missing the session.idle to RunEnd bridge."] : [],
14614
+ ...!options.shared.summaryHookInstalled ? ["The shared bounded session-summary hook is missing."] : [],
14615
+ ...!options.shared.automaticDelivery ? ["ACK-gated automatic delivery is not configured."] : []
14616
+ ];
14617
+ return {
14618
+ client: "opencode",
14619
+ state: captureReady ? "ready" : installed ? "attention_required" : "not_installed",
14620
+ installed,
14621
+ adapterVersion: string(packageJson.version),
14622
+ captureReady,
14623
+ terminalBoundary: "session.idle -> run_end",
14624
+ warnings,
14625
+ nextAction: captureReady ? null : !installed || !hasRunBoundary ? "Install the current @useorgx/orgx-opencode-plugin alpha package, then re-run hooks doctor --json." : sharedNextAction(options)
14626
+ };
14627
+ }
14628
+ function clientContinuityPathsForHome(home = homedir3()) {
14629
+ return {
14630
+ cursorManifestPath: join8(
14631
+ home,
14632
+ ".cursor",
14633
+ "plugins",
14634
+ "local",
14635
+ "cursor-plugin",
14636
+ ".cursor-plugin",
14637
+ "plugin.json"
14638
+ ),
14639
+ cursorHooksPath: join8(
14640
+ home,
14641
+ ".cursor",
14642
+ "plugins",
14643
+ "local",
14644
+ "cursor-plugin",
14645
+ "hooks",
14646
+ "hooks.json"
14647
+ ),
14648
+ openCodePackagePath: join8(
14649
+ home,
14650
+ ".config",
14651
+ "opencode",
14652
+ "plugins",
14653
+ "orgx-opencode-plugin",
14654
+ "package.json"
14655
+ )
14656
+ };
14657
+ }
14658
+ function inspectClientContinuity(options) {
14659
+ const paths = { ...clientContinuityPathsForHome(), ...options.paths };
14660
+ const clients = [
14661
+ wizardHookStatus("claude-code", options.shared.claudeCodeInstalled, options),
14662
+ wizardHookStatus("codex", options.shared.codexInstalled, options),
14663
+ cursorStatus(paths, options),
14664
+ openCodeStatus(paths, options)
14665
+ ];
14666
+ return {
14667
+ schemaVersion: CLIENT_CONTINUITY_SCHEMA_VERSION,
14668
+ state: clients.every((client) => client.captureReady) ? "ready" : "attention_required",
14669
+ clients
14670
+ };
14671
+ }
14672
+
14538
14673
  // src/lib/runtime-hooks.ts
14539
14674
  var HOOK_MARKER = "orgx-session-hook.mjs";
14540
14675
  var EMIT_HOOK_MARKER = "orgx-emit-execution-graph.mjs";
@@ -14561,23 +14696,23 @@ var CLAUDE_HOOK_EVENTS = [
14561
14696
  ];
14562
14697
  function currentPackagedCliPath() {
14563
14698
  if (!process.argv[1]) return "";
14564
- const candidate = resolve2(process.argv[1]);
14699
+ const candidate = resolve3(process.argv[1]);
14565
14700
  return /\.(?:cts|mts|ts|tsx)$/i.test(candidate) ? "" : candidate;
14566
14701
  }
14567
14702
  function defaultPaths(options = {}) {
14568
- const hookDir = join8(ORGX_WIZARD_CONFIG_HOME, "hooks");
14703
+ const hookDir = join9(ORGX_WIZARD_CONFIG_HOME, "hooks");
14569
14704
  return {
14570
- claudeSettingsPath: options.claudeSettingsPath ?? join8(CLAUDE_DIR, "settings.json"),
14571
- codexConfigPath: options.codexConfigPath ?? CODEX_CONFIG_PATH ?? join8(CODEX_DIR, "config.toml"),
14572
- codexHooksPath: options.codexHooksPath ?? join8(CODEX_DIR, "hooks.json"),
14573
- hookScriptPath: options.hookScriptPath ?? join8(hookDir, HOOK_MARKER),
14574
- emitHookScriptPath: options.emitHookScriptPath ?? join8(hookDir, EMIT_HOOK_MARKER),
14575
- summaryHookScriptPath: options.summaryHookScriptPath ?? join8(hookDir, SUMMARY_HOOK_MARKER),
14576
- sessionStateDir: options.sessionStateDir ?? join8(ORGX_WIZARD_CONFIG_HOME, "sessions"),
14577
- sessionSummaryQueueDir: options.sessionSummaryQueueDir ?? join8(ORGX_WIZARD_CONFIG_HOME, "session-summary-captures"),
14705
+ claudeSettingsPath: options.claudeSettingsPath ?? join9(CLAUDE_DIR, "settings.json"),
14706
+ codexConfigPath: options.codexConfigPath ?? CODEX_CONFIG_PATH ?? join9(CODEX_DIR, "config.toml"),
14707
+ codexHooksPath: options.codexHooksPath ?? join9(CODEX_DIR, "hooks.json"),
14708
+ hookScriptPath: options.hookScriptPath ?? join9(hookDir, HOOK_MARKER),
14709
+ emitHookScriptPath: options.emitHookScriptPath ?? join9(hookDir, EMIT_HOOK_MARKER),
14710
+ summaryHookScriptPath: options.summaryHookScriptPath ?? join9(hookDir, SUMMARY_HOOK_MARKER),
14711
+ sessionStateDir: options.sessionStateDir ?? join9(ORGX_WIZARD_CONFIG_HOME, "sessions"),
14712
+ sessionSummaryQueueDir: options.sessionSummaryQueueDir ?? join9(ORGX_WIZARD_CONFIG_HOME, "session-summary-captures"),
14578
14713
  deliveryNodePath: options.deliveryNodePath ?? process.execPath,
14579
14714
  deliveryCliPath: options.deliveryCliPath ?? currentPackagedCliPath(),
14580
- outboxPath: options.outboxPath ?? join8(hookDir, "events.jsonl")
14715
+ outboxPath: options.outboxPath ?? join9(hookDir, "events.jsonl")
14581
14716
  };
14582
14717
  }
14583
14718
  function countJsonlLines(path) {
@@ -14594,7 +14729,7 @@ function countSessionSummaryCaptures(path) {
14594
14729
  }
14595
14730
  function countSessionSummaryQuarantinedCaptures(path) {
14596
14731
  try {
14597
- return readdirSync6(join8(path, "quarantine")).filter(
14732
+ return readdirSync6(join9(path, "quarantine")).filter(
14598
14733
  (name) => name.includes(".malformed")
14599
14734
  ).length;
14600
14735
  } catch {
@@ -14606,7 +14741,7 @@ function backupPath(path, now) {
14606
14741
  return `${path}.bak.${timestamp}`;
14607
14742
  }
14608
14743
  function backupExisting(path, now) {
14609
- if (!existsSync9(path)) return null;
14744
+ if (!existsSync10(path)) return null;
14610
14745
  const backup = backupPath(path, now);
14611
14746
  copyFileSync(path, backup);
14612
14747
  return backup;
@@ -15117,18 +15252,28 @@ function inspectRuntimeHooks(options = {}) {
15117
15252
  const codexHooksRaw = readTextIfExists(paths.codexHooksPath);
15118
15253
  const claudeSettingsRaw = readTextIfExists(paths.claudeSettingsPath);
15119
15254
  const hasAutomaticDelivery = (raw) => Boolean(
15120
- raw && raw.includes("--delivery_node=") && raw.includes("--delivery_cli=") && raw.includes(paths.deliveryNodePath) && raw.includes(paths.deliveryCliPath) && existsSync9(paths.deliveryNodePath) && existsSync9(paths.deliveryCliPath)
15255
+ raw && raw.includes("--delivery_node=") && raw.includes("--delivery_cli=") && raw.includes(paths.deliveryNodePath) && raw.includes(paths.deliveryCliPath) && existsSync10(paths.deliveryNodePath) && existsSync10(paths.deliveryCliPath)
15121
15256
  );
15257
+ const installed = {
15258
+ claudeCode: hasOrgxHook(claudeSettingsRaw),
15259
+ codex: hasOrgxHook(codexHooksRaw),
15260
+ hookScript: existsSync10(paths.hookScriptPath),
15261
+ emitHookScript: existsSync10(paths.emitHookScriptPath),
15262
+ summaryHookScript: existsSync10(paths.summaryHookScriptPath),
15263
+ automaticDelivery: hasAutomaticDelivery(codexHooksRaw) || hasAutomaticDelivery(claudeSettingsRaw)
15264
+ };
15122
15265
  return {
15123
15266
  paths,
15124
- installed: {
15125
- claudeCode: hasOrgxHook(claudeSettingsRaw),
15126
- codex: hasOrgxHook(codexHooksRaw),
15127
- hookScript: existsSync9(paths.hookScriptPath),
15128
- emitHookScript: existsSync9(paths.emitHookScriptPath),
15129
- summaryHookScript: existsSync9(paths.summaryHookScriptPath),
15130
- automaticDelivery: hasAutomaticDelivery(codexHooksRaw) || hasAutomaticDelivery(claudeSettingsRaw)
15131
- },
15267
+ continuity: inspectClientContinuity({
15268
+ ...options.clientContinuityPaths ? { paths: options.clientContinuityPaths } : {},
15269
+ shared: {
15270
+ automaticDelivery: installed.automaticDelivery,
15271
+ claudeCodeInstalled: installed.claudeCode,
15272
+ codexInstalled: installed.codex,
15273
+ summaryHookInstalled: installed.summaryHookScript
15274
+ }
15275
+ }),
15276
+ installed,
15132
15277
  codex: {
15133
15278
  configExists: Boolean(codexConfigRaw),
15134
15279
  hooksEnabled: codexHooksEnabled(codexConfigRaw),
@@ -15154,7 +15299,7 @@ function installRuntimeHooks(targets, options = {}) {
15154
15299
  emitHookScript: false,
15155
15300
  summaryHookScript: false
15156
15301
  };
15157
- mkdirSync4(dirname5(paths.hookScriptPath), { recursive: true, mode: 448 });
15302
+ mkdirSync4(dirname6(paths.hookScriptPath), { recursive: true, mode: 448 });
15158
15303
  const scriptContent = buildRuntimeHookScriptContent();
15159
15304
  if (readTextIfExists(paths.hookScriptPath) !== scriptContent) {
15160
15305
  const backup = backupExisting(paths.hookScriptPath, now);
@@ -15162,7 +15307,7 @@ function installRuntimeHooks(targets, options = {}) {
15162
15307
  writeTextFile(paths.hookScriptPath, scriptContent, { mode: 448 });
15163
15308
  changed.hookScript = true;
15164
15309
  }
15165
- mkdirSync4(dirname5(paths.emitHookScriptPath), { recursive: true, mode: 448 });
15310
+ mkdirSync4(dirname6(paths.emitHookScriptPath), { recursive: true, mode: 448 });
15166
15311
  const emitScriptContent = buildExecutionGraphEmitScriptContent();
15167
15312
  if (readTextIfExists(paths.emitHookScriptPath) !== emitScriptContent) {
15168
15313
  const backup = backupExisting(paths.emitHookScriptPath, now);
@@ -15170,7 +15315,7 @@ function installRuntimeHooks(targets, options = {}) {
15170
15315
  writeTextFile(paths.emitHookScriptPath, emitScriptContent, { mode: 448 });
15171
15316
  changed.emitHookScript = true;
15172
15317
  }
15173
- mkdirSync4(dirname5(paths.summaryHookScriptPath), { recursive: true, mode: 448 });
15318
+ mkdirSync4(dirname6(paths.summaryHookScriptPath), { recursive: true, mode: 448 });
15174
15319
  const summaryScriptContent = buildSessionSummaryHookScriptContent();
15175
15320
  if (readTextIfExists(paths.summaryHookScriptPath) !== summaryScriptContent) {
15176
15321
  const backup = backupExisting(paths.summaryHookScriptPath, now);
@@ -15232,14 +15377,14 @@ function parseRuntimeHookTargets(value) {
15232
15377
  // src/lib/session-summary-queue.ts
15233
15378
  import {
15234
15379
  chmodSync as chmodSync2,
15235
- existsSync as existsSync10,
15380
+ existsSync as existsSync11,
15236
15381
  mkdirSync as mkdirSync5,
15237
15382
  readdirSync as readdirSync7,
15238
15383
  readFileSync as readFileSync8,
15239
15384
  renameSync as renameSync3,
15240
15385
  unlinkSync as unlinkSync2
15241
15386
  } from "fs";
15242
- import { basename as basename6, join as join9 } from "path";
15387
+ import { basename as basename6, join as join10 } from "path";
15243
15388
 
15244
15389
  // src/lib/session-summary-backfill.ts
15245
15390
  import { createReadStream, renameSync as renameSync2, statSync as statSync5, writeFileSync as writeFileSync4 } from "fs";
@@ -15654,27 +15799,27 @@ var SESSION_SUMMARY_CAPTURE_MAX_BYTES = 16 * 1024;
15654
15799
  var SESSION_SUMMARY_QUARANTINE_DIR_NAME = "quarantine";
15655
15800
  var SESSION_SUMMARY_QUARANTINE_FILE_SUFFIX = ".malformed";
15656
15801
  function sessionSummaryCaptureFiles(queueDir) {
15657
- if (!existsSync10(queueDir)) return [];
15802
+ if (!existsSync11(queueDir)) return [];
15658
15803
  try {
15659
- return readdirSync7(queueDir).filter((name) => name.endsWith(SESSION_SUMMARY_CAPTURE_FILE_SUFFIX)).sort().map((name) => join9(queueDir, name));
15804
+ return readdirSync7(queueDir).filter((name) => name.endsWith(SESSION_SUMMARY_CAPTURE_FILE_SUFFIX)).sort().map((name) => join10(queueDir, name));
15660
15805
  } catch {
15661
15806
  return [];
15662
15807
  }
15663
15808
  }
15664
15809
  function sessionSummaryQuarantineDir(queueDir) {
15665
- return join9(queueDir, SESSION_SUMMARY_QUARANTINE_DIR_NAME);
15810
+ return join10(queueDir, SESSION_SUMMARY_QUARANTINE_DIR_NAME);
15666
15811
  }
15667
15812
  function quarantineMalformedCapture(path, queueDir) {
15668
15813
  const quarantineDir = sessionSummaryQuarantineDir(queueDir);
15669
15814
  try {
15670
15815
  mkdirSync5(quarantineDir, { recursive: true, mode: 448 });
15671
- const baseTarget = join9(
15816
+ const baseTarget = join10(
15672
15817
  quarantineDir,
15673
15818
  `${basename6(path)}${SESSION_SUMMARY_QUARANTINE_FILE_SUFFIX}`
15674
15819
  );
15675
15820
  let target = baseTarget;
15676
15821
  let collision = 0;
15677
- while (existsSync10(target)) {
15822
+ while (existsSync11(target)) {
15678
15823
  collision += 1;
15679
15824
  target = `${baseTarget}.${collision}`;
15680
15825
  }
@@ -15889,7 +16034,7 @@ import {
15889
16034
  unlinkSync as unlinkSync3,
15890
16035
  writeSync
15891
16036
  } from "fs";
15892
- import { join as join10 } from "path";
16037
+ import { join as join11 } from "path";
15893
16038
  var SESSION_SUMMARY_FLUSH_LOCK_NAME = ".flush.lock";
15894
16039
  var SESSION_SUMMARY_FLUSH_MAX_AGE_MS = 2 * 60 * 60 * 1e3;
15895
16040
  var MALFORMED_LOCK_GRACE_MS = 5 * 60 * 1e3;
@@ -15958,7 +16103,7 @@ function claimSessionSummaryFlushLease(queueDir, options = {}) {
15958
16103
  const pid = options.pid ?? process.pid;
15959
16104
  const token = options.token ?? randomUUID3();
15960
16105
  const isProcessAlive = options.isProcessAlive ?? processIsAlive;
15961
- const path = join10(queueDir, SESSION_SUMMARY_FLUSH_LOCK_NAME);
16106
+ const path = join11(queueDir, SESSION_SUMMARY_FLUSH_LOCK_NAME);
15962
16107
  const record = { token, pid, claimed_at: now.toISOString() };
15963
16108
  try {
15964
16109
  mkdirSync6(queueDir, { recursive: true, mode: 448 });
@@ -16016,7 +16161,7 @@ function createOrgxSpinner(text2) {
16016
16161
 
16017
16162
  // src/lib/workload-diagnosis.ts
16018
16163
  import { closeSync as closeSync3, openSync as openSync3, readSync as readSync2 } from "fs";
16019
- import { resolve as resolve3 } from "path";
16164
+ import { resolve as resolve4 } from "path";
16020
16165
 
16021
16166
  // src/lib/workload-diagnosis-schema.ts
16022
16167
  import { z as z2 } from "zod";
@@ -16369,7 +16514,7 @@ var MAX_HANDOFF_TOKEN_CHARACTERS = 7e3;
16369
16514
  var SENSITIVE_KEY2 = /(?:^|[_-])(?:authorization|cookie|credentials?|password|secrets?|session|tokens?|api[_-]?keys?|access[_-]?tokens?|refresh[_-]?tokens?|client[_-]?secrets?|private[_-]?keys?|database[_-]?(?:url|uri)|db[_-]?(?:url|uri))(?:$|[_-])/i;
16370
16515
  function readBoundedUtf8(source) {
16371
16516
  const shouldClose = source !== "-";
16372
- const fd = shouldClose ? openSync3(resolve3(source), "r") : 0;
16517
+ const fd = shouldClose ? openSync3(resolve4(source), "r") : 0;
16373
16518
  const buffer = Buffer.alloc(MAX_WORKLOAD_DIAGNOSIS_REQUEST_BYTES + 1);
16374
16519
  let offset = 0;
16375
16520
  try {
@@ -16745,6 +16890,9 @@ function printRuntimeHookInspection(report) {
16745
16890
  console.log(` ${ICON.skip} ${pc3.bold("capture queue")} ${pc3.dim(`${report.sessionSummaryCaptures} capture${report.sessionSummaryCaptures === 1 ? "" : "s"} at ${report.paths.sessionSummaryQueueDir}`)}`);
16746
16891
  console.log(` ${report.sessionSummaryQuarantinedCaptures === 0 ? ICON.skip : ICON.warn} ${pc3.bold("quarantine ")} ${pc3.dim(`${report.sessionSummaryQuarantinedCaptures} malformed capture${report.sessionSummaryQuarantinedCaptures === 1 ? "" : "s"}, recoverable on disk`)}`);
16747
16892
  console.log(` ${ICON.skip} ${pc3.bold("outbox ")} ${pc3.dim(`${report.outboxEvents} event${report.outboxEvents === 1 ? "" : "s"} at ${report.paths.outboxPath}`)}`);
16893
+ for (const client of report.continuity.clients) {
16894
+ console.log(` ${client.captureReady ? ICON.ok : ICON.warn} ${pc3.bold(client.client.padEnd(12))} ${client.captureReady ? pc3.green("capture ready") : pc3.yellow(client.state.replaceAll("_", " "))} ${pc3.dim(client.adapterVersion ?? client.terminalBoundary)}`);
16895
+ }
16748
16896
  }
16749
16897
  function printSessionSummaryFlush(result) {
16750
16898
  if (result.skipped) {
@@ -16766,7 +16914,7 @@ function printSessionSummaryFlush(result) {
16766
16914
  if (result.firstError) console.log(` ${ICON.warn} ${pc3.dim(result.firstError)}`);
16767
16915
  }
16768
16916
  async function runSessionSummaryFlushCommand(options) {
16769
- const queueDir = resolve4(options.queue?.trim() || inspectRuntimeHooks().paths.sessionSummaryQueueDir);
16917
+ const queueDir = resolve5(options.queue?.trim() || inspectRuntimeHooks().paths.sessionSummaryQueueDir);
16770
16918
  const found = sessionSummaryCaptureFiles(queueDir).length;
16771
16919
  let result;
16772
16920
  if (found === 0) {
@@ -16862,7 +17010,7 @@ async function runSessionSummaryFlushCommand(options) {
16862
17010
  }
16863
17011
  async function runHookBackfillCommand(options) {
16864
17012
  const paths = inspectRuntimeHooks().paths;
16865
- const spoolPath = resolve4(options.spool?.trim() || paths.outboxPath);
17013
+ const spoolPath = resolve5(options.spool?.trim() || paths.outboxPath);
16866
17014
  if (!fileExists(spoolPath)) {
16867
17015
  const message = `No hook spool found at ${spoolPath}`;
16868
17016
  if (options.json) {
@@ -16960,7 +17108,7 @@ async function runHookReplayCommand(options) {
16960
17108
  }
16961
17109
  const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY);
16962
17110
  const paths = inspectRuntimeHooks().paths;
16963
- const outboxPath = resolve4(options.outbox?.trim() || paths.outboxPath);
17111
+ const outboxPath = resolve5(options.outbox?.trim() || paths.outboxPath);
16964
17112
  const readResult = readRuntimeHookOutbox(outboxPath, parsePositiveInt(options.limit, 200));
16965
17113
  const replay = buildWorkGraphHookReplayPatch(readResult);
16966
17114
  if (replay.records === 0) {
@@ -16992,7 +17140,7 @@ async function runHookReplayCommand(options) {
16992
17140
  }
16993
17141
  function readAuditInput(options, interactive) {
16994
17142
  if (options.input?.trim()) {
16995
- return readFileSync10(resolve4(options.input.trim()), "utf8");
17143
+ return readFileSync10(resolve5(options.input.trim()), "utf8");
16996
17144
  }
16997
17145
  if (!process.stdin.isTTY) {
16998
17146
  return readFileSync10(0, "utf8");
@@ -17027,7 +17175,7 @@ function collectPathOption(value, previous = []) {
17027
17175
  ];
17028
17176
  }
17029
17177
  function parseClientExtractionFile(path) {
17030
- const resolvedPath = resolve4(path);
17178
+ const resolvedPath = resolve5(path);
17031
17179
  const parsed = JSON.parse(readFileSync10(resolvedPath, "utf8"));
17032
17180
  if (!isRecord(parsed)) {
17033
17181
  throw new Error(`AI-client extraction must be a JSON object: ${resolvedPath}`);
@@ -17050,8 +17198,8 @@ async function readAuditImports(options, interactive) {
17050
17198
  const missingSources = [];
17051
17199
  if (sources.length > 0) {
17052
17200
  const imported = loadAiSessionImports({
17053
- ...options.claudeProjectsDir?.trim() ? { claudeProjectsDir: resolve4(options.claudeProjectsDir.trim()) } : {},
17054
- ...options.codexSessionsDir?.trim() ? { codexSessionsDir: resolve4(options.codexSessionsDir.trim()) } : {},
17201
+ ...options.claudeProjectsDir?.trim() ? { claudeProjectsDir: resolve5(options.claudeProjectsDir.trim()) } : {},
17202
+ ...options.codexSessionsDir?.trim() ? { codexSessionsDir: resolve5(options.codexSessionsDir.trim()) } : {},
17055
17203
  limitPerSource: parsePositiveInteger(options.sessionLimit, 3, "--session-limit"),
17056
17204
  sinceDays: parsePositiveInteger(options.sessionDays, 30, "--session-days"),
17057
17205
  sources
@@ -17091,8 +17239,8 @@ async function readWorkGraphInputs(options, interactive) {
17091
17239
  const clientExtractions = readClientExtractions(options);
17092
17240
  const investigationSources = parseInvestigationSourceList(options.from);
17093
17241
  const investigationSourceData = investigationSources.length > 0 ? loadWorkGraphInvestigationSourceData({
17094
- ...options.claudeProjectsDir?.trim() ? { claudeProjectsDir: resolve4(options.claudeProjectsDir.trim()) } : {},
17095
- ...options.codexSessionsDir?.trim() ? { codexSessionsDir: resolve4(options.codexSessionsDir.trim()) } : {},
17242
+ ...options.claudeProjectsDir?.trim() ? { claudeProjectsDir: resolve5(options.claudeProjectsDir.trim()) } : {},
17243
+ ...options.codexSessionsDir?.trim() ? { codexSessionsDir: resolve5(options.codexSessionsDir.trim()) } : {},
17096
17244
  cwd: process.cwd(),
17097
17245
  limitPerSource: parsePositiveInteger(options.sessionLimit, 8, "--session-limit"),
17098
17246
  sinceDays: parsePositiveInteger(options.sessionDays, 45, "--session-days"),
@@ -17209,10 +17357,10 @@ async function runAuditCommand(options) {
17209
17357
  workspace
17210
17358
  });
17211
17359
  const markdown = renderSelfAuditMarkdown(plan);
17212
- const outputDir = resolve4(options.outputDir?.trim() || ".orgx/audits");
17360
+ const outputDir = resolve5(options.outputDir?.trim() || ".orgx/audits");
17213
17361
  const timestamp = plan.generated_at.replace(/[:.]/g, "-");
17214
- const jsonPath = resolve4(outputDir, `ai-native-self-audit-${timestamp}.json`);
17215
- const markdownPath = resolve4(outputDir, `ai-native-self-audit-${timestamp}.md`);
17362
+ const jsonPath = resolve5(outputDir, `ai-native-self-audit-${timestamp}.json`);
17363
+ const markdownPath = resolve5(outputDir, `ai-native-self-audit-${timestamp}.md`);
17216
17364
  writeJsonFile(jsonPath, plan);
17217
17365
  writeTextFile(markdownPath, markdown);
17218
17366
  if (options.json) {
@@ -17343,7 +17491,7 @@ async function runOperatingMapCommand(queryParts, options) {
17343
17491
  }
17344
17492
  function runWorkGraphExtractionSchemaCommand(options) {
17345
17493
  const protocol = buildWorkGraphExtractionProtocol();
17346
- const outputPath = options.output?.trim() ? resolve4(options.output.trim()) : "";
17494
+ const outputPath = options.output?.trim() ? resolve5(options.output.trim()) : "";
17347
17495
  if (outputPath) {
17348
17496
  if (options.json) {
17349
17497
  writeJsonFile(outputPath, protocol);
@@ -17373,8 +17521,8 @@ function normalizeRuntimePacketRole(role) {
17373
17521
  }
17374
17522
  function runWorkGraphRuntimeEventCommand(options) {
17375
17523
  const source = normalizeRuntimePacketSource(options.source);
17376
- const cwd = resolve4(options.cwd?.trim() || process.cwd());
17377
- const outputRoot = resolve4(cwd, options.outputDir?.trim() || ".orgx/work-graph/runtime-events");
17524
+ const cwd = resolve5(options.cwd?.trim() || process.cwd());
17525
+ const outputRoot = resolve5(cwd, options.outputDir?.trim() || ".orgx/work-graph/runtime-events");
17378
17526
  const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
17379
17527
  const timestamp = generatedAt.replace(/[:.]/g, "-");
17380
17528
  const summary = options.summary?.trim() || options.message?.trim();
@@ -17395,7 +17543,7 @@ function runWorkGraphRuntimeEventCommand(options) {
17395
17543
  collection_method: "runtime_packet",
17396
17544
  redaction_state: "agent_redacted"
17397
17545
  };
17398
- const path = resolve4(outputRoot, source, `${timestamp}-${process.pid}.jsonl`);
17546
+ const path = resolve5(outputRoot, source, `${timestamp}-${process.pid}.jsonl`);
17399
17547
  writeTextFile(path, `${JSON.stringify(packet)}
17400
17548
  `, { mode: 384 });
17401
17549
  if (options.json) {
@@ -17438,11 +17586,11 @@ async function runWorkGraphCommand(options, defaults = {}) {
17438
17586
  workspace
17439
17587
  });
17440
17588
  const markdown = renderWorkGraphMarkdown(report);
17441
- const outputDir = resolve4(commandOptions.outputDir?.trim() || ".orgx/work-graph");
17589
+ const outputDir = resolve5(commandOptions.outputDir?.trim() || ".orgx/work-graph");
17442
17590
  const timestamp = report.generated_at.replace(/[:.]/g, "-");
17443
- const jsonPath = resolve4(outputDir, `work-graph-report-${timestamp}.json`);
17444
- const markdownPath = resolve4(outputDir, `work-graph-report-${timestamp}.md`);
17445
- const agentBriefPath = resolve4(outputDir, `work-graph-agent-brief-${timestamp}.md`);
17591
+ const jsonPath = resolve5(outputDir, `work-graph-report-${timestamp}.json`);
17592
+ const markdownPath = resolve5(outputDir, `work-graph-report-${timestamp}.md`);
17593
+ const agentBriefPath = resolve5(outputDir, `work-graph-agent-brief-${timestamp}.md`);
17446
17594
  writeJsonFile(jsonPath, report);
17447
17595
  writeTextFile(markdownPath, markdown);
17448
17596
  let published = null;
@@ -17857,14 +18005,14 @@ async function readSingleKey() {
17857
18005
  const stdin = process.stdin;
17858
18006
  if (!stdin.isTTY) return null;
17859
18007
  const previousRawMode = stdin.isRaw === true;
17860
- return await new Promise((resolve5) => {
18008
+ return await new Promise((resolve6) => {
17861
18009
  const cleanup = (result) => {
17862
18010
  stdin.off("data", onData);
17863
18011
  if (stdin.isTTY) {
17864
18012
  stdin.setRawMode(previousRawMode);
17865
18013
  }
17866
18014
  stdin.pause();
17867
- resolve5(result);
18015
+ resolve6(result);
17868
18016
  };
17869
18017
  const onData = (chunk) => {
17870
18018
  const text2 = chunk.toString("utf8");
@@ -18629,7 +18777,7 @@ async function main() {
18629
18777
  initializeWizardSentry();
18630
18778
  const program = new Command();
18631
18779
  program.name("orgx-wizard").description("Add OrgX MCP configs, skills/rules, and companion plugins to your local AI tools.").showHelpAfterError();
18632
- const pkgVersion = true ? "0.1.67" : void 0;
18780
+ const pkgVersion = true ? "0.1.68" : void 0;
18633
18781
  program.version(pkgVersion ?? "unknown", "-V, --version");
18634
18782
  program.hook("preAction", (_thisCommand, actionCommand) => {
18635
18783
  if (Boolean(actionCommand.optsWithGlobals().json)) return;
@@ -19393,7 +19541,7 @@ async function main() {
19393
19541
  await runWorkGraphCommand(options, { from: "all" });
19394
19542
  });
19395
19543
  const hooks = program.command("hooks").description("Inspect or install passive OrgX runtime hooks for local agent clients.");
19396
- hooks.command("doctor").description("Show Codex and Claude Code runtime hook wiring status.").option("--json", "emit a JSON command summary").action(async (options) => {
19544
+ hooks.command("doctor").description("Show four-client continuity, runtime hook, queue, and delivery status.").option("--json", "emit a JSON command summary").action(async (options) => {
19397
19545
  const report = inspectRuntimeHooks();
19398
19546
  await safeTrackWizardTelemetry("hooks_doctor_ran", {
19399
19547
  command: "hooks doctor",
@@ -19673,4 +19821,4 @@ main().catch(async (error) => {
19673
19821
  process.exitCode = 1;
19674
19822
  });
19675
19823
  //# sourceMappingURL=cli.js.map
19676
- //# debugId=20c1b754-5691-5226-9f34-921cdff2d9f8
19824
+ //# debugId=4b5dd32d-184b-560a-ae80-e8a055ae1bc4