@useorgx/wizard 0.1.63 → 0.1.64

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
@@ -34,8 +34,8 @@ The wizard modifies local tool configuration only. Depending on the command, it
34
34
  - `work-graph runtime-event --source codex|claude --summary "..."` lets an agent write public-safe runtime evidence that the next AQ profile can collect.
35
35
  - `hooks install [--targets codex,claude-code]` installs bounded local capture hooks. Terminal events write compact session summaries to a durable queue, then request a detached single-flight delivery worker. 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 references, and evidence references. The Wizard does not infer this context from prompts; invalid or oversized annotations are omitted, and unknown fields are removed before cloud delivery.
37
- - `hooks flush [--limit 100]` is the manual delivery and recovery path. It uses the same queue lease as automatic delivery and removes each file only after a successful server acknowledgement. Failed or malformed captures stay on disk for inspection and retry.
38
- - `hooks doctor` shows hook wiring, automatic-delivery configuration, the capture-queue count, and the legacy spool count without changing local configuration.
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.
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,7 +2,7 @@
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]="d41747ca-7c63-5e0b-83ef-90af38ff9921")}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]="cf979138-322b-5229-81f2-931f9cdf95d2")}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";
@@ -3736,8 +3736,8 @@ function encodeRepoPath2(value) {
3736
3736
  return value.split("/").filter((segment) => segment.length > 0).map((segment) => encodeURIComponent(segment)).join("/");
3737
3737
  }
3738
3738
  function isLikelyRepoFilePath(path) {
3739
- const basename6 = path.split("/").pop() ?? path;
3740
- return basename6.includes(".") && !/^\.[^./]+$/.test(basename6);
3739
+ const basename7 = path.split("/").pop() ?? path;
3740
+ return basename7.includes(".") && !/^\.[^./]+$/.test(basename7);
3741
3741
  }
3742
3742
  function buildContentsUrl2(spec, path) {
3743
3743
  const encodedPath = encodeRepoPath2(path);
@@ -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.63",
6357
+ release: "useorgx-wizard@0.1.64",
6358
6358
  tracesSampleRate: sampleRate(process.env.ORGX_SENTRY_TRACES_SAMPLE_RATE),
6359
6359
  enableLogs: true,
6360
6360
  sendDefaultPii: false,
@@ -14546,6 +14546,15 @@ function countSessionSummaryCaptures(path) {
14546
14546
  return 0;
14547
14547
  }
14548
14548
  }
14549
+ function countSessionSummaryQuarantinedCaptures(path) {
14550
+ try {
14551
+ return readdirSync6(join8(path, "quarantine")).filter(
14552
+ (name) => name.includes(".malformed")
14553
+ ).length;
14554
+ } catch {
14555
+ return 0;
14556
+ }
14557
+ }
14549
14558
  function backupPath(path, now) {
14550
14559
  const timestamp = now.toISOString().replace(/[:.]/g, "-");
14551
14560
  return `${path}.bak.${timestamp}`;
@@ -15081,7 +15090,10 @@ function inspectRuntimeHooks(options = {}) {
15081
15090
  notifyPreserved: !codexHasNotify(codexConfigRaw) || !hasOrgxHook(codexConfigRaw)
15082
15091
  },
15083
15092
  outboxEvents: countJsonlLines(paths.outboxPath),
15084
- sessionSummaryCaptures: countSessionSummaryCaptures(paths.sessionSummaryQueueDir)
15093
+ sessionSummaryCaptures: countSessionSummaryCaptures(paths.sessionSummaryQueueDir),
15094
+ sessionSummaryQuarantinedCaptures: countSessionSummaryQuarantinedCaptures(
15095
+ paths.sessionSummaryQueueDir
15096
+ )
15085
15097
  };
15086
15098
  }
15087
15099
  function installRuntimeHooks(targets, options = {}) {
@@ -15172,8 +15184,16 @@ function parseRuntimeHookTargets(value) {
15172
15184
  }
15173
15185
 
15174
15186
  // src/lib/session-summary-queue.ts
15175
- import { existsSync as existsSync10, readdirSync as readdirSync7, readFileSync as readFileSync8, unlinkSync as unlinkSync2 } from "fs";
15176
- import { join as join9 } from "path";
15187
+ import {
15188
+ chmodSync as chmodSync2,
15189
+ existsSync as existsSync10,
15190
+ mkdirSync as mkdirSync5,
15191
+ readdirSync as readdirSync7,
15192
+ readFileSync as readFileSync8,
15193
+ renameSync as renameSync3,
15194
+ unlinkSync as unlinkSync2
15195
+ } from "fs";
15196
+ import { basename as basename6, join as join9 } from "path";
15177
15197
 
15178
15198
  // src/lib/session-summary-backfill.ts
15179
15199
  import { createReadStream, renameSync as renameSync2, statSync as statSync5, writeFileSync as writeFileSync4 } from "fs";
@@ -15560,6 +15580,8 @@ function truncateSpool(spoolPath, post, options = {}) {
15560
15580
  var SESSION_SUMMARY_CAPTURE_VERSION = "orgx-session-summary-capture/v1";
15561
15581
  var SESSION_SUMMARY_CAPTURE_FILE_SUFFIX = ".capture.json";
15562
15582
  var SESSION_SUMMARY_CAPTURE_MAX_BYTES = 16 * 1024;
15583
+ var SESSION_SUMMARY_QUARANTINE_DIR_NAME = "quarantine";
15584
+ var SESSION_SUMMARY_QUARANTINE_FILE_SUFFIX = ".malformed";
15563
15585
  function sessionSummaryCaptureFiles(queueDir) {
15564
15586
  if (!existsSync10(queueDir)) return [];
15565
15587
  try {
@@ -15568,6 +15590,33 @@ function sessionSummaryCaptureFiles(queueDir) {
15568
15590
  return [];
15569
15591
  }
15570
15592
  }
15593
+ function sessionSummaryQuarantineDir(queueDir) {
15594
+ return join9(queueDir, SESSION_SUMMARY_QUARANTINE_DIR_NAME);
15595
+ }
15596
+ function quarantineMalformedCapture(path, queueDir) {
15597
+ const quarantineDir = sessionSummaryQuarantineDir(queueDir);
15598
+ try {
15599
+ mkdirSync5(quarantineDir, { recursive: true, mode: 448 });
15600
+ const baseTarget = join9(
15601
+ quarantineDir,
15602
+ `${basename6(path)}${SESSION_SUMMARY_QUARANTINE_FILE_SUFFIX}`
15603
+ );
15604
+ let target = baseTarget;
15605
+ let collision = 0;
15606
+ while (existsSync10(target)) {
15607
+ collision += 1;
15608
+ target = `${baseTarget}.${collision}`;
15609
+ }
15610
+ renameSync3(path, target);
15611
+ try {
15612
+ chmodSync2(target, 384);
15613
+ } catch {
15614
+ }
15615
+ return target;
15616
+ } catch {
15617
+ return null;
15618
+ }
15619
+ }
15571
15620
  function isRecord4(value) {
15572
15621
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15573
15622
  }
@@ -15680,14 +15729,20 @@ async function flushSessionSummaryCaptures(options) {
15680
15729
  acknowledged: 0,
15681
15730
  retained: 0,
15682
15731
  malformed: 0,
15732
+ quarantined: 0,
15683
15733
  fallbackAcknowledged: 0
15684
15734
  };
15685
15735
  for (const path of selected) {
15686
15736
  const capture = readSessionSummaryCapture(path);
15687
15737
  if (!capture) {
15688
15738
  result.malformed += 1;
15689
- result.retained += 1;
15690
- result.firstError ??= `Malformed capture retained: ${path}`;
15739
+ const quarantinedPath = quarantineMalformedCapture(path, options.queueDir);
15740
+ if (quarantinedPath) {
15741
+ result.quarantined += 1;
15742
+ } else {
15743
+ result.retained += 1;
15744
+ result.firstError ??= `Malformed capture could not be quarantined: ${path}`;
15745
+ }
15691
15746
  continue;
15692
15747
  }
15693
15748
  result.attempted += 1;
@@ -15725,10 +15780,10 @@ import { randomUUID as randomUUID3 } from "crypto";
15725
15780
  import {
15726
15781
  closeSync as closeSync2,
15727
15782
  fsyncSync,
15728
- mkdirSync as mkdirSync5,
15783
+ mkdirSync as mkdirSync6,
15729
15784
  openSync as openSync2,
15730
15785
  readFileSync as readFileSync9,
15731
- renameSync as renameSync3,
15786
+ renameSync as renameSync4,
15732
15787
  statSync as statSync6,
15733
15788
  unlinkSync as unlinkSync3,
15734
15789
  writeSync
@@ -15805,7 +15860,7 @@ function claimSessionSummaryFlushLease(queueDir, options = {}) {
15805
15860
  const path = join10(queueDir, SESSION_SUMMARY_FLUSH_LOCK_NAME);
15806
15861
  const record = { token, pid, claimed_at: now.toISOString() };
15807
15862
  try {
15808
- mkdirSync5(queueDir, { recursive: true, mode: 448 });
15863
+ mkdirSync6(queueDir, { recursive: true, mode: 448 });
15809
15864
  } catch {
15810
15865
  return { acquired: false, reason: "unavailable" };
15811
15866
  }
@@ -15825,7 +15880,7 @@ function claimSessionSummaryFlushLease(queueDir, options = {}) {
15825
15880
  }
15826
15881
  const stalePath = `${path}.stale-${token}`;
15827
15882
  try {
15828
- renameSync3(path, stalePath);
15883
+ renameSync4(path, stalePath);
15829
15884
  unlinkSync3(stalePath);
15830
15885
  } catch {
15831
15886
  return { acquired: false, reason: "busy" };
@@ -16587,6 +16642,7 @@ function printRuntimeHookInspection(report) {
16587
16642
  console.log(` ${report.installed.summaryHookScript ? ICON.ok : ICON.warn} ${pc3.bold("summary hook")} ${report.installed.summaryHookScript ? pc3.green("installed") : pc3.yellow("missing")} ${pc3.dim(report.paths.summaryHookScriptPath)}`);
16588
16643
  console.log(` ${report.installed.automaticDelivery ? ICON.ok : ICON.warn} ${pc3.bold("auto delivery")} ${report.installed.automaticDelivery ? pc3.green("configured") : pc3.yellow("not configured")} ${pc3.dim("detached, ACK-gated worker")}`);
16589
16644
  console.log(` ${ICON.skip} ${pc3.bold("capture queue")} ${pc3.dim(`${report.sessionSummaryCaptures} capture${report.sessionSummaryCaptures === 1 ? "" : "s"} at ${report.paths.sessionSummaryQueueDir}`)}`);
16645
+ 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`)}`);
16590
16646
  console.log(` ${ICON.skip} ${pc3.bold("outbox ")} ${pc3.dim(`${report.outboxEvents} event${report.outboxEvents === 1 ? "" : "s"} at ${report.paths.outboxPath}`)}`);
16591
16647
  }
16592
16648
  function printSessionSummaryFlush(result) {
@@ -16595,7 +16651,7 @@ function printSessionSummaryFlush(result) {
16595
16651
  return;
16596
16652
  }
16597
16653
  const delivered = `${result.acknowledged}/${result.attempted} acknowledged`;
16598
- console.log(` ${result.retained === 0 ? ICON.ok : ICON.warn} ${pc3.bold("captures ")} ${pc3.dim(`${delivered}, ${result.retained} retained, ${result.malformed} malformed`)}`);
16654
+ console.log(` ${result.retained === 0 && result.malformed === 0 ? ICON.ok : ICON.warn} ${pc3.bold("captures ")} ${pc3.dim(`${delivered}, ${result.retained} retained, ${result.quarantined} quarantined, ${result.malformed} malformed`)}`);
16599
16655
  if (result.fallbackAcknowledged > 0) {
16600
16656
  console.log(` ${ICON.warn} ${pc3.bold("fallback ")} ${pc3.dim(`${result.fallbackAcknowledged} capture(s) delivered through the legacy Work Graph endpoint`)}`);
16601
16657
  }
@@ -16612,6 +16668,7 @@ async function runSessionSummaryFlushCommand(options) {
16612
16668
  acknowledged: 0,
16613
16669
  retained: 0,
16614
16670
  malformed: 0,
16671
+ quarantined: 0,
16615
16672
  fallbackAcknowledged: 0,
16616
16673
  skipped: "empty_queue"
16617
16674
  };
@@ -16628,6 +16685,7 @@ async function runSessionSummaryFlushCommand(options) {
16628
16685
  acknowledged: 0,
16629
16686
  retained: 0,
16630
16687
  malformed: 0,
16688
+ quarantined: 0,
16631
16689
  fallbackAcknowledged: 0,
16632
16690
  skipped: "already_running"
16633
16691
  };
@@ -16670,11 +16728,12 @@ async function runSessionSummaryFlushCommand(options) {
16670
16728
  command: "hooks flush",
16671
16729
  attempted: String(result.attempted),
16672
16730
  acknowledged: String(result.acknowledged),
16673
- retained: String(result.retained)
16731
+ retained: String(result.retained),
16732
+ quarantined: String(result.quarantined)
16674
16733
  });
16675
- if (result.retained > 0) process.exitCode = 1;
16734
+ if (result.retained > 0 || result.malformed > 0) process.exitCode = 1;
16676
16735
  if (options.json) {
16677
- console.log(JSON.stringify({ ok: result.retained === 0, queueDir, ...result }, null, 2));
16736
+ console.log(JSON.stringify({ ok: result.retained === 0 && result.malformed === 0, queueDir, ...result }, null, 2));
16678
16737
  return;
16679
16738
  }
16680
16739
  printSessionSummaryFlush(result);
@@ -18448,7 +18507,7 @@ async function main() {
18448
18507
  initializeWizardSentry();
18449
18508
  const program = new Command();
18450
18509
  program.name("orgx-wizard").description("Add OrgX MCP configs, skills/rules, and companion plugins to your local AI tools.").showHelpAfterError();
18451
- const pkgVersion = true ? "0.1.63" : void 0;
18510
+ const pkgVersion = true ? "0.1.64" : void 0;
18452
18511
  program.version(pkgVersion ?? "unknown", "-V, --version");
18453
18512
  program.hook("preAction", (_thisCommand, actionCommand) => {
18454
18513
  if (Boolean(actionCommand.optsWithGlobals().json)) return;
@@ -19492,4 +19551,4 @@ main().catch(async (error) => {
19492
19551
  process.exitCode = 1;
19493
19552
  });
19494
19553
  //# sourceMappingURL=cli.js.map
19495
- //# debugId=d41747ca-7c63-5e0b-83ef-90af38ff9921
19554
+ //# debugId=cf979138-322b-5229-81f2-931f9cdf95d2