@useorgx/wizard 0.1.66 → 0.1.67

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
@@ -32,7 +32,7 @@ The wizard modifies local tool configuration only. Depending on the command, it
32
32
  - Every profile or preview writes both the full evidence report and a compact, machine-safe `work-graph-agent-brief-*.md` with provenance, the growth edge, and a ready prompt for the smallest verifiable repair.
33
33
  - `work-graph preview --from all` shows the same profile story locally without publishing.
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
- - `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. 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.
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
38
  - `hooks doctor` shows hook wiring, automatic-delivery configuration, active and quarantined capture counts, and the legacy spool count without changing local configuration.
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]="783f771d-d176-55f3-b036-2be49833854e")}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]="20c1b754-5691-5226-9f34-921cdff2d9f8")}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";
@@ -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.66",
6357
+ release: "useorgx-wizard@0.1.67",
6358
6358
  tracesSampleRate: sampleRate(process.env.ORGX_SENTRY_TRACES_SAMPLE_RATE),
6359
6359
  enableLogs: true,
6360
6360
  sendDefaultPii: false,
@@ -15691,6 +15691,24 @@ function quarantineMalformedCapture(path, queueDir) {
15691
15691
  function isRecord4(value) {
15692
15692
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15693
15693
  }
15694
+ function expectsAutomaticReceipt(body) {
15695
+ const session = isRecord4(body.session) ? body.session : {};
15696
+ const metadata = isRecord4(session.metadata) ? session.metadata : {};
15697
+ const capture = isRecord4(metadata.capture) ? metadata.capture : {};
15698
+ const execution = isRecord4(metadata.execution) ? metadata.execution : {};
15699
+ const workContext = isRecord4(metadata.work_context) ? metadata.work_context : {};
15700
+ const actions = Array.isArray(execution.actions) ? execution.actions : [];
15701
+ const completed = execution.actions_completed_observed;
15702
+ return (capture.kind === "run_end" || capture.kind === "session_end") && execution.boundary === capture.kind && execution.terminal_observed === true && execution.action_capture_complete === true && typeof completed === "number" && completed > 0 && session.tool_calls === completed && execution.actions_omitted === 0 && execution.start_times_omitted === 0 && execution.pending_actions === 0 && actions.length === completed && actions.every((value) => {
15703
+ const action = isRecord4(value) ? value : {};
15704
+ return action.status !== "running" && typeof action.started_at === "string" && typeof action.completed_at === "string";
15705
+ }) && isRecord4(workContext.intent) && isRecord4(workContext.authority) && isRecord4(workContext.cost);
15706
+ }
15707
+ function confirmsAutomaticReceipt(response) {
15708
+ const body = isRecord4(response.body) ? response.body : {};
15709
+ const receipt = isRecord4(body.automatic_receipt) ? body.automatic_receipt : {};
15710
+ return receipt.ready === true && receipt.persisted === true && typeof receipt.receipt_id === "string" && receipt.receipt_id.length > 0;
15711
+ }
15694
15712
  function isSessionSummary(value) {
15695
15713
  if (!isRecord4(value)) return false;
15696
15714
  return typeof value.schema_version === "string" && typeof value.session_id === "string" && typeof value.source_client === "string";
@@ -15801,7 +15819,9 @@ async function flushSessionSummaryCaptures(options) {
15801
15819
  retained: 0,
15802
15820
  malformed: 0,
15803
15821
  quarantined: 0,
15804
- fallbackAcknowledged: 0
15822
+ fallbackAcknowledged: 0,
15823
+ receiptExpected: 0,
15824
+ receiptAcknowledged: 0
15805
15825
  };
15806
15826
  for (const path of selected) {
15807
15827
  const capture = readSessionSummaryCapture(path);
@@ -15820,11 +15840,21 @@ async function flushSessionSummaryCaptures(options) {
15820
15840
  let response;
15821
15841
  let usedFallback = false;
15822
15842
  try {
15823
- response = await options.send(primaryUrl, deliveryBody(capture), headers);
15843
+ const body = deliveryBody(capture);
15844
+ const receiptExpected = expectsAutomaticReceipt(body);
15845
+ if (receiptExpected) result.receiptExpected += 1;
15846
+ response = await options.send(primaryUrl, body, headers);
15824
15847
  if (!response.ok && (response.status === 404 || response.status === 405)) {
15825
15848
  response = await options.send(fallbackUrl, buildWorkGraphFallback(capture), headers);
15826
15849
  usedFallback = true;
15827
15850
  }
15851
+ if (response.ok && receiptExpected && !confirmsAutomaticReceipt(response)) {
15852
+ result.retained += 1;
15853
+ result.firstError ??= `HTTP ${response.status} did not confirm automatic receipt persistence for ${capture.capture_id}`;
15854
+ if (options.stopOnFailure) break;
15855
+ continue;
15856
+ }
15857
+ if (response.ok && receiptExpected) result.receiptAcknowledged += 1;
15828
15858
  } catch {
15829
15859
  response = { ok: false, status: 0 };
15830
15860
  }
@@ -16726,6 +16756,13 @@ function printSessionSummaryFlush(result) {
16726
16756
  if (result.fallbackAcknowledged > 0) {
16727
16757
  console.log(` ${ICON.warn} ${pc3.bold("fallback ")} ${pc3.dim(`${result.fallbackAcknowledged} capture(s) delivered through the legacy Work Graph endpoint`)}`);
16728
16758
  }
16759
+ if (result.receiptExpected > 0) {
16760
+ const receiptStatus = `${result.receiptAcknowledged}/${result.receiptExpected} persisted`;
16761
+ const receiptIcon = result.receiptAcknowledged === result.receiptExpected ? ICON.ok : ICON.warn;
16762
+ console.log(
16763
+ ` ${receiptIcon} ${pc3.bold("receipts ")} ${pc3.dim(receiptStatus)}`
16764
+ );
16765
+ }
16729
16766
  if (result.firstError) console.log(` ${ICON.warn} ${pc3.dim(result.firstError)}`);
16730
16767
  }
16731
16768
  async function runSessionSummaryFlushCommand(options) {
@@ -16741,6 +16778,8 @@ async function runSessionSummaryFlushCommand(options) {
16741
16778
  malformed: 0,
16742
16779
  quarantined: 0,
16743
16780
  fallbackAcknowledged: 0,
16781
+ receiptExpected: 0,
16782
+ receiptAcknowledged: 0,
16744
16783
  skipped: "empty_queue"
16745
16784
  };
16746
16785
  } else {
@@ -16758,6 +16797,8 @@ async function runSessionSummaryFlushCommand(options) {
16758
16797
  malformed: 0,
16759
16798
  quarantined: 0,
16760
16799
  fallbackAcknowledged: 0,
16800
+ receiptExpected: 0,
16801
+ receiptAcknowledged: 0,
16761
16802
  skipped: "already_running"
16762
16803
  };
16763
16804
  } else {
@@ -16783,7 +16824,17 @@ async function runSessionSummaryFlushCommand(options) {
16783
16824
  },
16784
16825
  options.background ? { timeoutMs: 8e3, retries: 0 } : { timeoutMs: 12e3, retries: 1 }
16785
16826
  );
16786
- return { ok: response.ok, status: response.status };
16827
+ let responseBody;
16828
+ try {
16829
+ responseBody = await response.json();
16830
+ } catch {
16831
+ responseBody = void 0;
16832
+ }
16833
+ return {
16834
+ ok: response.ok,
16835
+ status: response.status,
16836
+ body: responseBody
16837
+ };
16787
16838
  } catch {
16788
16839
  return { ok: false, status: 0 };
16789
16840
  }
@@ -18578,7 +18629,7 @@ async function main() {
18578
18629
  initializeWizardSentry();
18579
18630
  const program = new Command();
18580
18631
  program.name("orgx-wizard").description("Add OrgX MCP configs, skills/rules, and companion plugins to your local AI tools.").showHelpAfterError();
18581
- const pkgVersion = true ? "0.1.66" : void 0;
18632
+ const pkgVersion = true ? "0.1.67" : void 0;
18582
18633
  program.version(pkgVersion ?? "unknown", "-V, --version");
18583
18634
  program.hook("preAction", (_thisCommand, actionCommand) => {
18584
18635
  if (Boolean(actionCommand.optsWithGlobals().json)) return;
@@ -19622,4 +19673,4 @@ main().catch(async (error) => {
19622
19673
  process.exitCode = 1;
19623
19674
  });
19624
19675
  //# sourceMappingURL=cli.js.map
19625
- //# debugId=783f771d-d176-55f3-b036-2be49833854e
19676
+ //# debugId=20c1b754-5691-5226-9f34-921cdff2d9f8