@indigoai-us/hq-cli 5.312.1 → 5.312.2-beta.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +2 -5
  2. package/dist/command-catalog.generated.d.ts +0 -65
  3. package/dist/command-catalog.generated.js +0 -80
  4. package/dist/commands/cloud.js +1 -0
  5. package/dist/commands/company.js +0 -2
  6. package/dist/commands/core.js +0 -7
  7. package/dist/fast-core.js +3 -10
  8. package/dist/fast-scaffold.d.ts +0 -2
  9. package/dist/fast-scaffold.js +0 -11
  10. package/dist/lib/doctor/checks/work-context.js +1 -9
  11. package/dist/lib/mesh/client.js +5 -23
  12. package/dist/lib/mesh/live/daemon/doctor.d.ts +0 -2
  13. package/dist/lib/mesh/live/daemon/doctor.js +1 -11
  14. package/dist/lib/search-index/embed-lock.d.ts +0 -2
  15. package/dist/lib/search-index/embed-lock.js +1 -10
  16. package/dist/lib/work-context/contract.d.ts +0 -3
  17. package/dist/lib/work-context/contract.schema.json +1 -3
  18. package/dist/lib/work-context/outbox.d.ts +5 -14
  19. package/dist/lib/work-context/outbox.js +5 -48
  20. package/dist/lib/work-context/reconcile.js +5 -26
  21. package/dist/main.d.ts +0 -20
  22. package/dist/main.js +1 -8
  23. package/package.json +1 -1
  24. package/assets/scaffold/core/scripts/lib/work-mesh-live-hook.sh +0 -378
  25. package/assets/scaffold/core/scripts/lib/work-mesh-live-rebind.sh +0 -141
  26. package/assets/scaffold/core/scripts/migrate-policy-triggers.sh +0 -373
  27. package/assets/scaffold/core/scripts/register-project.sh +0 -262
  28. package/assets/scaffold/core/scripts/work-mesh-live-rebind.sh +0 -59
  29. package/dist/commands/company-rename-flag.d.ts +0 -4
  30. package/dist/commands/company-rename-flag.js +0 -7
  31. package/dist/commands/company-rename.d.ts +0 -4
  32. package/dist/commands/company-rename.js +0 -90
  33. package/dist/commands/core-eval-trigger-native.d.ts +0 -4
  34. package/dist/commands/core-eval-trigger-native.js +0 -12
  35. package/dist/commands/core-migrate-policy-triggers-native.d.ts +0 -21
  36. package/dist/commands/core-migrate-policy-triggers-native.js +0 -378
  37. package/dist/commands/core-native-hook-helper-commands.d.ts +0 -4
  38. package/dist/commands/core-native-hook-helper-commands.js +0 -56
  39. package/dist/commands/core-native-hook-helpers-flag.d.ts +0 -4
  40. package/dist/commands/core-native-hook-helpers-flag.js +0 -7
  41. package/dist/commands/core-register-project-native.d.ts +0 -30
  42. package/dist/commands/core-register-project-native.js +0 -347
  43. package/dist/commands/core-work-mesh-live-rebind-native.d.ts +0 -18
  44. package/dist/commands/core-work-mesh-live-rebind-native.js +0 -262
  45. package/dist/lib/mesh/denial-codes.d.ts +0 -5
  46. package/dist/lib/mesh/denial-codes.js +0 -14
  47. package/dist/utils/core-eval-trigger.d.ts +0 -4
  48. package/dist/utils/core-eval-trigger.js +0 -88
package/CHANGELOG.md CHANGED
@@ -2,12 +2,9 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
- ## [5.312.1] — 2026-10-02
5
+ ## [5.312.2-beta.0] — 2026-10-02
6
6
  - Fix checkpoint Stop hook-state creation and the jq-absent early exit to match the bundled shell.
7
- - Add native `hq core eval-trigger`, `migrate-policy-triggers`, `register-project`, and `work-mesh-live-rebind` on the fast route behind the default-off `core-native-hook-helpers` flag.
8
- - Prevent concurrent QMD reindex workers from replacing each other's lock owner record.
9
- - Add a default-off `hq company rename <new name>` command to update a cloud-backed company's display name.
10
- - Preserve HTTP status and safe server denial codes in work-mesh registration diagnostics.
7
+ - Let `hq sync now` skip unchanged server-owned cloud placeholders while keeping their warnings visible, so the sync can complete.
11
8
 
12
9
  ## [5.312.0] — 2026-10-02
13
10
  - The desktop app can turn event-driven daemon sync on or off with its Instant Sync setting. The daemon stores the preference and restarts when a running daemon needs to apply it.
@@ -3826,19 +3826,6 @@ export declare const COMMAND_CATALOG: readonly [{
3826
3826
  }];
3827
3827
  readonly subcommands: readonly [];
3828
3828
  }];
3829
- }, {
3830
- readonly name: "rename";
3831
- readonly description: "Rename a cloud-backed company display name";
3832
- readonly aliases: readonly [];
3833
- readonly hidden: false;
3834
- readonly usage: "[options] <new-name>";
3835
- readonly arguments: readonly [{
3836
- readonly name: "new-name";
3837
- readonly required: true;
3838
- readonly variadic: false;
3839
- }];
3840
- readonly options: readonly [];
3841
- readonly subcommands: readonly [];
3842
3829
  }, {
3843
3830
  readonly name: "settings";
3844
3831
  readonly description: "Per-company settings (owner-only)";
@@ -5880,58 +5867,6 @@ export declare const COMMAND_CATALOG: readonly [{
5880
5867
  }];
5881
5868
  readonly options: readonly [];
5882
5869
  readonly subcommands: readonly [];
5883
- }, {
5884
- readonly name: "eval-trigger";
5885
- readonly description: "Evaluate policy trigger expressions";
5886
- readonly aliases: readonly [];
5887
- readonly hidden: false;
5888
- readonly usage: "[args...]";
5889
- readonly arguments: readonly [{
5890
- readonly name: "args";
5891
- readonly required: false;
5892
- readonly variadic: true;
5893
- }];
5894
- readonly options: readonly [];
5895
- readonly subcommands: readonly [];
5896
- }, {
5897
- readonly name: "migrate-policy-triggers";
5898
- readonly description: "Backfill policy trigger frontmatter";
5899
- readonly aliases: readonly [];
5900
- readonly hidden: false;
5901
- readonly usage: "[args...]";
5902
- readonly arguments: readonly [{
5903
- readonly name: "args";
5904
- readonly required: false;
5905
- readonly variadic: true;
5906
- }];
5907
- readonly options: readonly [];
5908
- readonly subcommands: readonly [];
5909
- }, {
5910
- readonly name: "register-project";
5911
- readonly description: "Register a project with Work Mesh";
5912
- readonly aliases: readonly [];
5913
- readonly hidden: false;
5914
- readonly usage: "[args...]";
5915
- readonly arguments: readonly [{
5916
- readonly name: "args";
5917
- readonly required: false;
5918
- readonly variadic: true;
5919
- }];
5920
- readonly options: readonly [];
5921
- readonly subcommands: readonly [];
5922
- }, {
5923
- readonly name: "work-mesh-live-rebind";
5924
- readonly description: "Rebind a live Work Mesh session to its current project";
5925
- readonly aliases: readonly [];
5926
- readonly hidden: false;
5927
- readonly usage: "[args...]";
5928
- readonly arguments: readonly [{
5929
- readonly name: "args";
5930
- readonly required: false;
5931
- readonly variadic: true;
5932
- }];
5933
- readonly options: readonly [];
5934
- readonly subcommands: readonly [];
5935
5870
  }, {
5936
5871
  readonly name: "worktree-gc";
5937
5872
  readonly description: "Safely collect old, preserved HQ worktrees";
@@ -4940,22 +4940,6 @@ export const COMMAND_CATALOG = [
4940
4940
  }
4941
4941
  ]
4942
4942
  },
4943
- {
4944
- "name": "rename",
4945
- "description": "Rename a cloud-backed company display name",
4946
- "aliases": [],
4947
- "hidden": false,
4948
- "usage": "[options] <new-name>",
4949
- "arguments": [
4950
- {
4951
- "name": "new-name",
4952
- "required": true,
4953
- "variadic": false
4954
- }
4955
- ],
4956
- "options": [],
4957
- "subcommands": []
4958
- },
4959
4943
  {
4960
4944
  "name": "settings",
4961
4945
  "description": "Per-company settings (owner-only)",
@@ -7569,70 +7553,6 @@ export const COMMAND_CATALOG = [
7569
7553
  "options": [],
7570
7554
  "subcommands": []
7571
7555
  },
7572
- {
7573
- "name": "eval-trigger",
7574
- "description": "Evaluate policy trigger expressions",
7575
- "aliases": [],
7576
- "hidden": false,
7577
- "usage": "[args...]",
7578
- "arguments": [
7579
- {
7580
- "name": "args",
7581
- "required": false,
7582
- "variadic": true
7583
- }
7584
- ],
7585
- "options": [],
7586
- "subcommands": []
7587
- },
7588
- {
7589
- "name": "migrate-policy-triggers",
7590
- "description": "Backfill policy trigger frontmatter",
7591
- "aliases": [],
7592
- "hidden": false,
7593
- "usage": "[args...]",
7594
- "arguments": [
7595
- {
7596
- "name": "args",
7597
- "required": false,
7598
- "variadic": true
7599
- }
7600
- ],
7601
- "options": [],
7602
- "subcommands": []
7603
- },
7604
- {
7605
- "name": "register-project",
7606
- "description": "Register a project with Work Mesh",
7607
- "aliases": [],
7608
- "hidden": false,
7609
- "usage": "[args...]",
7610
- "arguments": [
7611
- {
7612
- "name": "args",
7613
- "required": false,
7614
- "variadic": true
7615
- }
7616
- ],
7617
- "options": [],
7618
- "subcommands": []
7619
- },
7620
- {
7621
- "name": "work-mesh-live-rebind",
7622
- "description": "Rebind a live Work Mesh session to its current project",
7623
- "aliases": [],
7624
- "hidden": false,
7625
- "usage": "[args...]",
7626
- "arguments": [
7627
- {
7628
- "name": "args",
7629
- "required": false,
7630
- "variadic": true
7631
- }
7632
- ],
7633
- "options": [],
7634
- "subcommands": []
7635
- },
7636
7556
  {
7637
7557
  "name": "worktree-gc",
7638
7558
  "description": "Safely collect old, preserved HQ worktrees",
@@ -1697,6 +1697,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
1697
1697
  hqRoot,
1698
1698
  progressRecorder: trackingProgressRecorder(planLimitTracker, pushProgressCompany),
1699
1699
  skipUnchanged: true,
1700
+ serverOwnedPathPolicy: "skip",
1700
1701
  propagateDeletes: true,
1701
1702
  propagateDeletePolicy: resolveDeletePolicy(),
1702
1703
  ...(onConflict ? { onConflict } : {}),
@@ -2,7 +2,6 @@ import chalk from "chalk";
2
2
  import { ensureCognitoToken } from "../utils/cognito-session.js";
3
3
  import { vaultApiFetch, getEntityUid } from "../utils/vault-api.js";
4
4
  import { registerCompanyTransferCommand } from "./company-transfer.js";
5
- import { registerCompanyRenameCommand } from "./company-rename.js";
6
5
  import { describeRefreshOutcome, refreshCheckpointGateSetting, } from "./core-checkpoint-gate-setting.js";
7
6
  /**
8
7
  * Parse a `--flag <true|false>` string into a boolean, or throw. Commander
@@ -24,7 +23,6 @@ export function registerCompanyCommand(program) {
24
23
  .option("--company <slug>", "Company slug (resolves to companyUid)");
25
24
  // `hq company transfer …` — ownership handover (client-service-pack US-010).
26
25
  registerCompanyTransferCommand(company);
27
- registerCompanyRenameCommand(company);
28
26
  const settings = company
29
27
  .command("settings")
30
28
  .description("Per-company settings (owner-only)");
@@ -45,7 +45,6 @@ import { registerCoreGitPackExtensionCheckNative } from "./core-git-pack-extensi
45
45
  import { registerCorePinNative } from "./core-pin-native.js";
46
46
  import { registerCoreRefreshVaultAccessNative } from "./core-refresh-vault-access-native.js";
47
47
  import { registerCoreWorkMeshBindTrustedNative } from "./core-work-mesh-bind-trusted-native.js";
48
- import { registerCoreHookHelperNativeCommands } from "./core-native-hook-helper-commands.js";
49
48
  import { resolveLiveRoot } from "../utils/hq-roots.js";
50
49
  import { interpreterFor, runBundledScript } from "../utils/run-bundled-script.js";
51
50
  import { CompanyIndexUserError, renderIndexTarget } from "../lib/index-render/index.js";
@@ -241,8 +240,6 @@ export const SCAFFOLD_ONLY_ASSETS = [
241
240
  { asset: "core/scripts/lib/session-scope-capability.sh", root: "live", summary: "Session scope-capability lib sourced by hq-session" },
242
241
  { asset: "core/scripts/lib/session-id.sh", root: "live", summary: "Session-id resolver lib sourced by hq-session" },
243
242
  { asset: "core/scripts/lib/work-mesh-enqueue.sh", root: "live", summary: "Work Mesh Live spool enqueue lib sourced by hooks" },
244
- { asset: "core/scripts/lib/work-mesh-live-hook.sh", root: "live", summary: "Work Mesh Live hook helpers sourced by rebind" },
245
- { asset: "core/scripts/lib/work-mesh-live-rebind.sh", root: "live", summary: "Work Mesh Live session rebind library sourced by hooks and the native rollback command" },
246
243
  // Wave 2 handoff/worktree commands retain their old scripts for one release,
247
244
  // behind the shared default-off rollback flag.
248
245
  { asset: WORKTREE_GC_ASSET, root: "live", summary: "Rollback companion for native worktree-gc" },
@@ -279,9 +276,6 @@ export const SCAFFOLD_ONLY_ASSETS = [
279
276
  { asset: "core/scripts/policy-retire.sh", root: "live", summary: "Rollback companion for native policy retire" },
280
277
  { asset: "core/scripts/read-policy-frontmatter.sh", root: "cwd", summary: "Rollback companion for native policy frontmatter" },
281
278
  { asset: "core/scripts/eval-trigger.sh", root: "live", summary: "Trigger grammar helper used by the policy validator companion" },
282
- { asset: "core/scripts/migrate-policy-triggers.sh", root: "live", summary: "Rollback shell for native migrate-policy-triggers" },
283
- { asset: "core/scripts/register-project.sh", root: "live", summary: "Rollback shell for native register-project" },
284
- { asset: "core/scripts/work-mesh-live-rebind.sh", root: "live", summary: "Rollback shell for native work-mesh-live-rebind" },
285
279
  { asset: ".claude/hooks/validate-policy-frontmatter.sh", root: "live", summary: "Policy validator companion used by policy-retire rollback" },
286
280
  // Wave 2a handoff shells remain bundled as the default-off rollback path.
287
281
  { asset: "core/scripts/handoff-finalize.sh", root: "live", summary: "Rollback shell for native handoff finalize" },
@@ -386,7 +380,6 @@ export function registerCoreCommands(program) {
386
380
  registerCoreRefreshVaultAccessNative(core);
387
381
  registerCoreDmBindNative(core);
388
382
  registerCoreWorkMeshBindTrustedNative(core);
389
- registerCoreHookHelperNativeCommands(core);
390
383
  // Wave 2 handoff/worktree commands retain their byte-identical shell assets
391
384
  // as a default-off rollback path for one release. Keep the gate helper small
392
385
  // so sibling Wave 2 work can reuse it without editing this command table.
package/dist/fast-core.js CHANGED
@@ -59,13 +59,12 @@ export async function runFastCore(argv) {
59
59
  if (typeof handler !== "function") {
60
60
  throw new Error(`Native fast handler ${entry.exportName} was not exported`);
61
61
  }
62
- const readsStdin = entry.readsStdinFor?.(parsed.args) ?? entry.readsStdin ?? false;
63
62
  const chunks = [];
64
- if (readsStdin) {
63
+ if (entry.readsStdin) {
65
64
  for await (const chunk of process.stdin)
66
65
  chunks.push(chunk);
67
66
  }
68
- const code = await handler(parsed.args, readsStdin ? Buffer.concat(chunks).toString("utf8") : "", process.cwd(), hqRoot, entry.name.split(" ").at(-1) ?? entry.name, parsed.hqRootArg);
67
+ const code = await handler(parsed.args, entry.readsStdin ? Buffer.concat(chunks).toString("utf8") : "", process.cwd(), hqRoot, entry.name.split(" ").at(-1) ?? entry.name, parsed.hqRootArg);
69
68
  // Let Node drain handler output before terminating. The timeout guard's
70
69
  // stderr message must survive the native route's process boundary.
71
70
  process.exitCode = code;
@@ -81,18 +80,12 @@ export async function runFastCore(argv) {
81
80
  : process.cwd();
82
81
  const injectRoot = entry.kind === "shell" || entry.kind === "native" &&
83
82
  (entry.shellHqRoot === "live" || entry.shellHqRoot === "reconcile-default" && shouldInjectRoot);
84
- const childEnv = {
85
- ...(entry.name === "hq-session" ? { HQ_HQ_SESSION_NO_CLI: "1" } : {}),
86
- ...(entry.name === "migrate-policy-triggers"
87
- ? { CLAUDE_PROJECT_DIR: process.env.CLAUDE_PROJECT_DIR || process.cwd() }
88
- : {}),
89
- };
90
83
  const { code } = runBundledScript({
91
84
  asset,
92
85
  args: parsed.args,
93
86
  cwd,
94
87
  ...(injectRoot ? { hqRoot } : {}),
95
- ...(Object.keys(childEnv).length ? { env: childEnv } : {}),
88
+ env: entry.name === "hq-session" ? { HQ_HQ_SESSION_NO_CLI: "1" } : undefined,
96
89
  });
97
90
  // Propagate verbatim: these scripts use their exit code as their interface.
98
91
  process.exit(code);
@@ -40,8 +40,6 @@ export type FastScaffoldScript = {
40
40
  shellHqRoot?: "none" | "live" | "reconcile-default";
41
41
  /** Whether this handler consumes stdin. Shell companions inherit stdin directly. */
42
42
  readsStdin?: boolean;
43
- /** Per-invocation stdin policy for handlers whose shell reads conditionally. */
44
- readsStdinFor?: (args: readonly string[]) => boolean;
45
43
  /** Whether the bundled fast-route module closure needs Node's network timeout patch. */
46
44
  requiresNodeNetworkCompatibility?: boolean;
47
45
  };
@@ -184,17 +184,6 @@ export const FAST_SCAFFOLD_SCRIPTS = [
184
184
  shellCwd: "live",
185
185
  shellHqRoot: "live",
186
186
  },
187
- ...[
188
- { name: "eval-trigger", modulePath: "./commands/core-eval-trigger-native.js", exportName: "runEvalTriggerFast", asset: "core/scripts/eval-trigger.sh", root: "cwd", shellCwd: "caller", shellHqRoot: "none", readsStdinFor: (args) => args[0] === "--check" },
189
- { name: "migrate-policy-triggers", modulePath: "./commands/core-migrate-policy-triggers-native.js", exportName: "runMigratePolicyTriggersFast", asset: "core/scripts/migrate-policy-triggers.sh", root: "live", shellCwd: "caller", shellHqRoot: "live" },
190
- { name: "register-project", modulePath: "./commands/core-register-project-native.js", exportName: "runRegisterProjectFast", asset: "core/scripts/register-project.sh", root: "live", shellCwd: "caller", shellHqRoot: "live" },
191
- { name: "work-mesh-live-rebind", modulePath: "./commands/core-work-mesh-live-rebind-native.js", exportName: "runWorkMeshLiveRebindFast", asset: "core/scripts/work-mesh-live-rebind.sh", root: "live", shellCwd: "caller", shellHqRoot: "live" },
192
- ].map((entry) => ({
193
- ...entry,
194
- kind: "native",
195
- flagKey: "hq-core-native-fast-route",
196
- familyFlagKey: "core-native-hook-helpers",
197
- })),
198
187
  ...["resolve", "pickup", "repo", "secrets", "transfer"].map((name) => ({
199
188
  name: `delegate ${name}`,
200
189
  kind: "native",
@@ -89,20 +89,12 @@ function runChecks(deps) {
89
89
  message: `Outbox queued depth=${stats.depth} (acked=${stats.acked}).`,
90
90
  });
91
91
  const showQuarantineReason = stats.quarantined > 0 && outboxQuarantineStatusEnabled();
92
- const quarantineDetails = [
93
- stats.lastQuarantineHttpStatus !== null
94
- ? `HTTP ${stats.lastQuarantineHttpStatus}`
95
- : "",
96
- stats.lastQuarantineServerCode ?? "",
97
- ]
98
- .filter(Boolean)
99
- .join(" ");
100
92
  results.push({
101
93
  status: stats.quarantined > 0 ? "WARN" : "PASS",
102
94
  checkId: "work-context.outbox-quarantined",
103
95
  target: path.join(root, "outbox"),
104
96
  message: `Outbox quarantined count=${stats.quarantined}${showQuarantineReason
105
- ? ` (last reason=${stats.lastQuarantineReason ?? "unknown"}${quarantineDetails ? `; ${quarantineDetails}` : ""})`
97
+ ? ` (last reason=${stats.lastQuarantineReason ?? "unknown"})`
106
98
  : ""}.`,
107
99
  });
108
100
  // Default-company mode + migration capability (US-017B)
@@ -4,7 +4,6 @@
4
4
  * vault HTTP + receipt-shaped responses (US-007A / US-007B).
5
5
  */
6
6
  import { listActiveMembershipCompanies, meshJson, requireToken, resolveMeshCompany, } from "./api.js";
7
- import { isWorkSessionDenialCode } from "./denial-codes.js";
8
7
  export { meshJson, requireToken, resolveMeshCompany, listActiveMembershipCompanies };
9
8
  export async function openMeshTransport(opts) {
10
9
  const token = await requireToken();
@@ -51,28 +50,11 @@ export function createWorkSessionDeliverer(opts) {
51
50
  const message = err instanceof Error ? err.message : String(err);
52
51
  // meshJson throws on !ok with error text; classify by leading status when present.
53
52
  const statusMatch = /^(\d{3})\b/.exec(message);
54
- const errorFields = err && typeof err === "object"
55
- ? err
56
- : {};
57
- const status = typeof errorFields.status === "number" &&
58
- Number.isInteger(errorFields.status)
59
- ? errorFields.status
60
- : statusMatch
61
- ? Number(statusMatch[1])
62
- : undefined;
63
- if (status === 401 || status === 403) {
64
- const serverCode = isWorkSessionDenialCode(errorFields.code)
65
- ? errorFields.code
66
- : undefined;
67
- return {
68
- ok: false,
69
- retryable: false,
70
- code: "AUTH_DENIED",
71
- httpStatus: status,
72
- ...(serverCode ? { serverCode } : {}),
73
- };
74
- }
75
- if (status !== undefined) {
53
+ if (statusMatch) {
54
+ const status = Number(statusMatch[1]);
55
+ if (status === 401 || status === 403) {
56
+ return { ok: false, retryable: false, code: "AUTH_DENIED" };
57
+ }
76
58
  if (status === 400 || status === 422) {
77
59
  return { ok: false, retryable: false, code: "VALIDATION_FAILED" };
78
60
  }
@@ -27,8 +27,6 @@ export interface DaemonDoctorReport {
27
27
  outboxDepth: number;
28
28
  outboxQuarantined?: number;
29
29
  outboxLastQuarantineReason?: string;
30
- outboxLastQuarantineHttpStatus?: number;
31
- outboxLastQuarantineServerCode?: string;
32
30
  lastFlushAt?: string;
33
31
  lastFlushResult?: DaemonStateFile["lastFlushResult"];
34
32
  unhealthy: boolean;
@@ -263,8 +263,6 @@ export function collectDaemonDoctor(deps = {}) {
263
263
  ? {
264
264
  outboxQuarantined: outbox.quarantined,
265
265
  outboxLastQuarantineReason: outbox.lastQuarantineReason ?? undefined,
266
- outboxLastQuarantineHttpStatus: outbox.lastQuarantineHttpStatus ?? undefined,
267
- outboxLastQuarantineServerCode: outbox.lastQuarantineServerCode ?? undefined,
268
266
  }
269
267
  : {}),
270
268
  lastFlushAt: state?.lastFlushAt,
@@ -312,15 +310,7 @@ export function formatDaemonDoctor(report) {
312
310
  lines.push(`spool depth: ${report.spoolDepth}`, `held: ${report.heldCount}${report.heldCount > 0 ? " (needs_company; not sent as NONE)" : ""}`, `held with no local evidence: ${report.heldWithNoLocalEvidence}`, `outbox depth: ${report.outboxDepth}`);
313
311
  }
314
312
  if (report.outboxQuarantined !== undefined) {
315
- const quarantineDetails = [
316
- report.outboxLastQuarantineHttpStatus !== undefined
317
- ? `HTTP ${report.outboxLastQuarantineHttpStatus}`
318
- : "",
319
- report.outboxLastQuarantineServerCode ?? "",
320
- ]
321
- .filter(Boolean)
322
- .join(" ");
323
- lines.push(`outbox quarantined: ${report.outboxQuarantined} (last reason=${report.outboxLastQuarantineReason ?? "unknown"}${quarantineDetails ? `; ${quarantineDetails}` : ""})`);
313
+ lines.push(`outbox quarantined: ${report.outboxQuarantined} (last reason=${report.outboxLastQuarantineReason ?? "unknown"})`);
324
314
  }
325
315
  if (report.emitMode !== "legacy" && report.heldCount > 0) {
326
316
  lines.push(`held: ${report.heldCount} (needs_company; not sent as NONE)`);
@@ -4,8 +4,6 @@ export type EmbedLockDependencies = {
4
4
  pid: number;
5
5
  random: () => string;
6
6
  isProcessAlive: (pid: number) => boolean;
7
- /** Test seam for a contender arriving after mkdir and before owner publication. */
8
- beforeOwnerPublish?: (ownerFile: string) => void;
9
7
  /** Test seam for simulating a competing owner replacing the atomic record. */
10
8
  afterOwnerPublish?: (ownerFile: string) => void;
11
9
  };
@@ -184,13 +184,8 @@ function createAndPublishLock(home, dependencies) {
184
184
  // parity: the script's write_owner_record honored the same variable.
185
185
  if (dependencies.env.QMD_FORCE_OWNER_WRITE_FAIL)
186
186
  throw new Error('forced owner write failure');
187
- dependencies.beforeOwnerPublish?.(ownerFile);
188
187
  fs.writeFileSync(temporary, `pid=${dependencies.pid}\nts=${dependencies.now()}\nnonce=${nonce}\n`);
189
- // renameSync replaces an existing owner on POSIX. A stale reclaim can
190
- // replace this ownerless directory while this publisher is paused, so
191
- // publish only if this exact generation still has no owner.
192
- fs.linkSync(temporary, ownerFile);
193
- fs.unlinkSync(temporary);
188
+ fs.renameSync(temporary, ownerFile);
194
189
  dependencies.afterOwnerPublish?.(ownerFile);
195
190
  const verified = readOwner(directory);
196
191
  if (!verified || verified.pid !== dependencies.pid || verified.nonce !== nonce)
@@ -201,10 +196,6 @@ function createAndPublishLock(home, dependencies) {
201
196
  catch {
202
197
  // The marker identifies only the directory this process created. Do not
203
198
  // recursively remove the fixed lock path after a failed publication.
204
- try {
205
- fs.unlinkSync(temporary);
206
- }
207
- catch { /* absent after link or moved with a stale generation */ }
208
199
  fs.rmSync(marker, { recursive: true, force: true });
209
200
  removeDirectoryIfEmpty(directory);
210
201
  return false;
@@ -61,9 +61,6 @@ export interface ContextResult {
61
61
  bindingEpisodeId?: string;
62
62
  clientOperationId: string;
63
63
  errorCode?: string;
64
- /** Sanitized HTTP denial details; raw response bodies are never included. */
65
- httpStatus?: number;
66
- serverCode?: string;
67
64
  /** Why a project was chosen, or why the session is asking. Local consumers only. */
68
65
  projectBindReason?: string;
69
66
  /** Ranked alternatives when classification is needs_project. */
@@ -100,9 +100,7 @@
100
100
  "taskId": { "type": "string", "maxLength": 128 },
101
101
  "bindingEpisodeId": { "type": "string", "maxLength": 128 },
102
102
  "clientOperationId": { "type": "string", "minLength": 1, "maxLength": 128 },
103
- "errorCode": { "type": "string", "maxLength": 64 },
104
- "httpStatus": { "type": "number" },
105
- "serverCode": { "type": "string", "maxLength": 64 }
103
+ "errorCode": { "type": "string", "maxLength": 64 }
106
104
  }
107
105
  }
108
106
  }
@@ -5,7 +5,7 @@
5
5
  import type { DeliveryState } from "./contract.js";
6
6
  import { WORK_CONTEXT_CONTRACT_VERSION } from "./contract.js";
7
7
  /** Fields allowed on a durable outbox operation (privacy allowlist). */
8
- export declare const OUTBOX_ALLOWLIST: readonly ["contractVersion", "operationId", "clientOperationId", "sessionId", "harness", "companyUid", "companySlug", "projectId", "taskId", "companyConfidence", "kind", "digest", "delivery", "createdAt", "updatedAt", "attemptCount", "lastErrorCode", "lastErrorHttpStatus", "lastServerErrorCode", "receiptId", "destinationCompanyUid", "destinationCompanySlug", "nextAttemptAt"];
8
+ export declare const OUTBOX_ALLOWLIST: readonly ["contractVersion", "operationId", "clientOperationId", "sessionId", "harness", "companyUid", "companySlug", "projectId", "taskId", "companyConfidence", "kind", "digest", "delivery", "createdAt", "updatedAt", "attemptCount", "lastErrorCode", "receiptId", "destinationCompanyUid", "destinationCompanySlug", "nextAttemptAt"];
9
9
  /** Base delay for outbox retry backoff (attempt 1 → 30s). */
10
10
  export declare const OUTBOX_RETRY_BASE_MS = 30000;
11
11
  /** Cap for outbox retry backoff (6 hours). */
@@ -34,8 +34,6 @@ export interface OutboxOperation {
34
34
  updatedAt: string;
35
35
  attemptCount: number;
36
36
  lastErrorCode?: string;
37
- lastErrorHttpStatus?: number;
38
- lastServerErrorCode?: string;
39
37
  receiptId?: string;
40
38
  /** Destination company for kind=migrate (source is companyUid). */
41
39
  destinationCompanyUid?: string;
@@ -90,13 +88,8 @@ export declare function markOutboxAcked(operationId: string, root: string, recei
90
88
  export declare function writeAckedRegisterState(op: OutboxOperation, root: string, receiptId: string, now?: () => Date): void;
91
89
  /** Repair older unresolved session projections from acknowledged registrations. */
92
90
  export declare function repairAckedRegisterStates(root: string, sessionIds?: ReadonlySet<string>, now?: () => Date): number;
93
- export declare function markOutboxQueued(operationId: string, root: string, errorCode: string, now?: () => Date, random?: () => number, details?: OutboxErrorDetails): OutboxOperation | null;
94
- export declare function markOutboxQuarantined(operationId: string, root: string, errorCode: string, now?: () => Date, details?: OutboxErrorDetails): OutboxOperation | null;
95
- export interface OutboxErrorDetails {
96
- httpStatus?: number;
97
- serverCode?: string;
98
- }
99
- export declare function sanitizeOutboxErrorDetails(details?: OutboxErrorDetails): OutboxErrorDetails;
91
+ export declare function markOutboxQueued(operationId: string, root: string, errorCode: string, now?: () => Date, random?: () => number): OutboxOperation | null;
92
+ export declare function markOutboxQuarantined(operationId: string, root: string, errorCode: string, now?: () => Date): OutboxOperation | null;
100
93
  /**
101
94
  * Requeue quarantined outbox operations so the daemon's replay picks them up
102
95
  * again. Quarantine is otherwise terminal: after the work-mesh-live gap 10 fix
@@ -126,18 +119,16 @@ export interface OutboxStats {
126
119
  queued: number;
127
120
  acked: number;
128
121
  lastQuarantineReason: string | null;
129
- lastQuarantineHttpStatus: number | null;
130
- lastQuarantineServerCode: string | null;
131
122
  }
132
123
  export declare function outboxStats(root: string): OutboxStats;
133
124
  export type DeliverFn = (op: OutboxOperation) => Promise<{
134
125
  ok: true;
135
126
  receiptId: string;
136
- } | ({
127
+ } | {
137
128
  ok: false;
138
129
  retryable: boolean;
139
130
  code: string;
140
- } & OutboxErrorDetails)>;
131
+ }>;
141
132
  /**
142
133
  * Replay queued (and recover lost-receipt) operations.
143
134
  * FIFO per sessionId; bounded parallelism across sessions.