@indigoai-us/hq-cli 5.310.0 → 5.311.1

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 (97) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/assets/scaffold/core/scripts/jobs-validate.sh +1 -1
  3. package/dist/command-catalog.generated.d.ts +2 -2
  4. package/dist/command-catalog.generated.js +2 -2
  5. package/dist/commands/channels.d.ts +1 -9
  6. package/dist/commands/channels.js +2 -2
  7. package/dist/commands/company-transfer.d.ts +4 -28
  8. package/dist/commands/company-transfer.js +5 -49
  9. package/dist/commands/core-checkpoint-stop-gate-native.d.ts +34 -0
  10. package/dist/commands/core-checkpoint-stop-gate-native.js +713 -0
  11. package/dist/commands/core-checkpoint.d.ts +0 -24
  12. package/dist/commands/core-checkpoint.js +4 -4
  13. package/dist/commands/core-command-catalog.js +1 -1
  14. package/dist/commands/core-delegate-w1b.js +111 -14
  15. package/dist/commands/core-delegate.d.ts +9 -0
  16. package/dist/commands/core-delegate.js +44 -23
  17. package/dist/commands/core-hq-session-native.d.ts +39 -0
  18. package/dist/commands/core-hq-session-native.js +579 -0
  19. package/dist/commands/core-jobs-native.js +1 -4
  20. package/dist/commands/core-native-session-flag.d.ts +4 -0
  21. package/dist/commands/core-native-session-flag.js +7 -0
  22. package/dist/commands/core-native-worker-skills-flag.d.ts +4 -0
  23. package/dist/commands/core-native-worker-skills-flag.js +7 -0
  24. package/dist/commands/core-worker-lint-native.d.ts +4 -0
  25. package/dist/commands/core-worker-lint-native.js +160 -0
  26. package/dist/commands/core-worker-share-native.d.ts +5 -0
  27. package/dist/commands/core-worker-share-native.js +260 -0
  28. package/dist/commands/core-worker-skills-command.d.ts +8 -0
  29. package/dist/commands/core-worker-skills-command.js +33 -0
  30. package/dist/commands/core-worker-skills-runtime.d.ts +33 -0
  31. package/dist/commands/core-worker-skills-runtime.js +86 -0
  32. package/dist/commands/core.js +4 -2
  33. package/dist/commands/dm.d.ts +3 -7
  34. package/dist/commands/dm.js +3 -3
  35. package/dist/commands/integrations-core.d.ts +2 -0
  36. package/dist/commands/integrations-core.js +4 -0
  37. package/dist/commands/integrations-import.d.ts +1 -1
  38. package/dist/commands/integrations-import.js +34 -19
  39. package/dist/commands/integrations.js +2 -2
  40. package/dist/commands/lanes-accounts.js +3 -1
  41. package/dist/commands/lanes-message.js +84 -10
  42. package/dist/commands/lanes-shared.d.ts +4 -1
  43. package/dist/commands/lanes.d.ts +4 -1
  44. package/dist/commands/lanes.js +48 -7
  45. package/dist/commands/personal-connector-settings-flag.d.ts +4 -0
  46. package/dist/commands/personal-connector-settings-flag.js +7 -0
  47. package/dist/commands/report.d.ts +1 -26
  48. package/dist/commands/report.js +6 -6
  49. package/dist/fast-core.js +15 -2
  50. package/dist/fast-scaffold.js +25 -2
  51. package/dist/index.js +8 -0
  52. package/dist/lib/bot/continuity.d.ts +2 -1
  53. package/dist/lib/bot/job-completions.d.ts +0 -2
  54. package/dist/lib/bot/job-completions.js +2 -2
  55. package/dist/lib/bot/local-config.d.ts +0 -10
  56. package/dist/lib/bot/local-config.js +3 -9
  57. package/dist/lib/bot/owner-context.d.ts +2 -6
  58. package/dist/lib/bot/owner-context.js +3 -3
  59. package/dist/lib/bot/setup-explain.d.ts +0 -4
  60. package/dist/lib/bot/setup-explain.js +2 -2
  61. package/dist/lib/daemon/catalog.d.ts +3 -2
  62. package/dist/lib/daemon/hq-cloud.d.ts +2 -2
  63. package/dist/lib/daemon/hq-cloud.js +1 -1
  64. package/dist/lib/daemon/machine-type.d.ts +3 -4
  65. package/dist/lib/daemon/machine-type.js +2 -2
  66. package/dist/lib/daemon/remote-control.d.ts +0 -1
  67. package/dist/lib/daemon/remote-control.js +1 -1
  68. package/dist/lib/daemon/supervisor.d.ts +4 -9
  69. package/dist/lib/daemon/supervisor.js +5 -5
  70. package/dist/lib/lanes/admission-host.d.ts +3 -0
  71. package/dist/lib/lanes/admission-host.js +4 -0
  72. package/dist/lib/lanes/autopilot-registry.d.ts +62 -0
  73. package/dist/lib/lanes/autopilot-registry.js +192 -0
  74. package/dist/lib/lanes/autopilot.d.ts +2 -0
  75. package/dist/lib/lanes/autopilot.js +18 -5
  76. package/dist/lib/lanes/claude-balance.d.ts +6 -0
  77. package/dist/lib/lanes/claude-balance.js +17 -2
  78. package/dist/lib/lanes/keep-alive.d.ts +3 -0
  79. package/dist/lib/lanes/keep-alive.js +3 -0
  80. package/dist/lib/lanes/reconcile.js +14 -6
  81. package/dist/lib/lanes/spawn.js +2 -0
  82. package/dist/lib/mesh/live/daemon/credentials.d.ts +2 -17
  83. package/dist/lib/mesh/live/daemon/credentials.js +9 -9
  84. package/dist/lib/mesh/live/daemon/index.d.ts +5 -5
  85. package/dist/lib/mesh/live/daemon/index.js +2 -2
  86. package/dist/lib/mesh/live/daemon/state.d.ts +1 -1
  87. package/dist/lib/mesh/live/daemon/transcript-watch.d.ts +4 -11
  88. package/dist/lib/mesh/live/daemon/transcript-watch.js +5 -5
  89. package/dist/lib/work-context/company.d.ts +2 -25
  90. package/dist/lib/work-context/company.js +3 -3
  91. package/dist/lib/work-context/config.d.ts +3 -8
  92. package/dist/lib/work-context/config.js +2 -13
  93. package/dist/lib/work-context/state.d.ts +4 -13
  94. package/dist/lib/work-context/state.js +2 -30
  95. package/dist/utils/run-bundled-script.d.ts +6 -0
  96. package/dist/utils/run-bundled-script.js +14 -3
  97. package/package.json +1 -1
@@ -5,7 +5,7 @@ import * as fs from "node:fs";
5
5
  import type { MqttConnectionState } from "./presence.js";
6
6
  import type { FlushSummary } from "../flush.js";
7
7
  import type { DroppedPresenceCompany } from "./credentials.js";
8
- export interface PresenceRefusalState {
8
+ interface PresenceRefusalState {
9
9
  code: string;
10
10
  status: number;
11
11
  nextRetryAt: string;
@@ -51,8 +51,6 @@ export declare const TRANSCRIPT_WATCH_INTERVAL_MAX_MS = 120000;
51
51
  export declare const TRANSCRIPT_WATCH_BACKOFF_ENTRIES = 2000;
52
52
  /** Double the interval when a tick takes longer than this many ms. */
53
53
  export declare const TRANSCRIPT_WATCH_BACKOFF_DURATION_MS = 500;
54
- /** Hard cap on entries examined (dir stats, readdir children, file stats) per tick. */
55
- export declare const TRANSCRIPT_WATCH_ENTRY_CAP = 20000;
56
54
  /**
57
55
  * Even when a directory mtime matches the cache, force a full relist (readdir +
58
56
  * re-stat) after this many ms so content appends and coarse mtime granularity
@@ -62,11 +60,6 @@ export declare const TRANSCRIPT_WATCH_REVALIDATE_MS: number;
62
60
  export declare const TRANSCRIPT_TURN_QUIET_MS = 5000;
63
61
  export declare const TRANSCRIPT_SESSION_END_MS: number;
64
62
  export declare const TRANSCRIPT_HOOK_COVER_MS = 60000;
65
- /** Retry unavailable transcript-start reconciliation without hot-looping. */
66
- export declare const TRANSCRIPT_START_RETRY_BASE_MS = 30000;
67
- export declare const TRANSCRIPT_START_RETRY_MAX_MS = 120000;
68
- /** Ignore cold transcripts whose mtime is older than this on first sight. */
69
- export declare const TRANSCRIPT_FRESH_MS: number;
70
63
  /**
71
64
  * Hook-covered sessions skipped as "stale" on first sight never got a quiet
72
65
  * session_end (live: skippedHook=411, ended=0). Adopt them for this long after
@@ -75,7 +68,6 @@ export declare const TRANSCRIPT_FRESH_MS: number;
75
68
  */
76
69
  export declare const TRANSCRIPT_HOOK_QUIET_ADOPT_MS: number;
77
70
  export declare const TRANSCRIPT_MARKER: "from transcript";
78
- export declare const TRANSCRIPT_ADAPTER_VERSION: string;
79
71
  /** Network `source` stamped on every synthesized event (AMEND-001). */
80
72
  export declare const TRANSCRIPT_EVENT_SOURCE: "transcript";
81
73
  /** Fs surface used by the watcher — intentionally no open/readFile. */
@@ -91,7 +83,7 @@ export interface TranscriptFs {
91
83
  existsSync: (p: string) => boolean;
92
84
  }
93
85
  export declare const defaultTranscriptFs: TranscriptFs;
94
- export type TranscriptKind = "claude" | "codex";
86
+ type TranscriptKind = "claude" | "codex";
95
87
  export interface DiscoveredTranscript {
96
88
  path: string;
97
89
  sessionId: string;
@@ -166,7 +158,7 @@ export interface TranscriptWatchTickResult {
166
158
  skippedConcurrent: boolean;
167
159
  }
168
160
  /** Per-directory mtime + child cache for incremental discovery. */
169
- export interface TranscriptDirCacheEntry {
161
+ interface TranscriptDirCacheEntry {
170
162
  mtimeMs: number;
171
163
  files: DiscoveredTranscript[];
172
164
  subdirs: string[];
@@ -176,7 +168,7 @@ export interface TranscriptDirCacheEntry {
176
168
  export interface TranscriptDiscoverCache {
177
169
  dirs: Map<string, TranscriptDirCacheEntry>;
178
170
  }
179
- export interface DiscoverScanMeta {
171
+ interface DiscoverScanMeta {
180
172
  entriesExamined: number;
181
173
  dirsListed: number;
182
174
  dirsSkipped: number;
@@ -318,4 +310,5 @@ export declare function nextTranscriptWatchIntervalMs(currentMs: number, opts: {
318
310
  entriesExamined: number;
319
311
  durationMs: number;
320
312
  }): number;
313
+ export {};
321
314
  //# sourceMappingURL=transcript-watch.d.ts.map
@@ -58,7 +58,7 @@ export const TRANSCRIPT_WATCH_BACKOFF_ENTRIES = 2_000;
58
58
  /** Double the interval when a tick takes longer than this many ms. */
59
59
  export const TRANSCRIPT_WATCH_BACKOFF_DURATION_MS = 500;
60
60
  /** Hard cap on entries examined (dir stats, readdir children, file stats) per tick. */
61
- export const TRANSCRIPT_WATCH_ENTRY_CAP = 20_000;
61
+ const TRANSCRIPT_WATCH_ENTRY_CAP = 20_000;
62
62
  /**
63
63
  * Even when a directory mtime matches the cache, force a full relist (readdir +
64
64
  * re-stat) after this many ms so content appends and coarse mtime granularity
@@ -69,10 +69,10 @@ export const TRANSCRIPT_TURN_QUIET_MS = 5_000;
69
69
  export const TRANSCRIPT_SESSION_END_MS = 10 * 60_000;
70
70
  export const TRANSCRIPT_HOOK_COVER_MS = 60_000;
71
71
  /** Retry unavailable transcript-start reconciliation without hot-looping. */
72
- export const TRANSCRIPT_START_RETRY_BASE_MS = 30_000;
73
- export const TRANSCRIPT_START_RETRY_MAX_MS = 120_000;
72
+ const TRANSCRIPT_START_RETRY_BASE_MS = 30_000;
73
+ const TRANSCRIPT_START_RETRY_MAX_MS = 120_000;
74
74
  /** Ignore cold transcripts whose mtime is older than this on first sight. */
75
- export const TRANSCRIPT_FRESH_MS = TRANSCRIPT_SESSION_END_MS;
75
+ const TRANSCRIPT_FRESH_MS = TRANSCRIPT_SESSION_END_MS;
76
76
  /**
77
77
  * Hook-covered sessions skipped as "stale" on first sight never got a quiet
78
78
  * session_end (live: skippedHook=411, ended=0). Adopt them for this long after
@@ -81,7 +81,7 @@ export const TRANSCRIPT_FRESH_MS = TRANSCRIPT_SESSION_END_MS;
81
81
  */
82
82
  export const TRANSCRIPT_HOOK_QUIET_ADOPT_MS = 2 * 60 * 60 * 1000;
83
83
  export const TRANSCRIPT_MARKER = "from transcript";
84
- export const TRANSCRIPT_ADAPTER_VERSION = CLI_VERSION;
84
+ const TRANSCRIPT_ADAPTER_VERSION = CLI_VERSION;
85
85
  /** Network `source` stamped on every synthesized event (AMEND-001). */
86
86
  export const TRANSCRIPT_EVENT_SOURCE = "transcript";
87
87
  export const defaultTranscriptFs = {
@@ -20,14 +20,12 @@
20
20
  */
21
21
  import type { TrustedExplicitContext } from "./contract.js";
22
22
  import { type SessionStateFile } from "./state.js";
23
- export type CompanyResolutionSource = "trusted_explicit" | "existing_scope" | "session_meta" | "repo_map" | "device_default" | "deterministic_cwd" | "deterministic_remote";
23
+ type CompanyResolutionSource = "trusted_explicit" | "existing_scope" | "session_meta" | "repo_map" | "device_default" | "deterministic_cwd" | "deterministic_remote";
24
24
  export interface ResolvedCompany {
25
25
  slug?: string;
26
26
  uid?: string;
27
27
  source: CompanyResolutionSource;
28
28
  }
29
- /** Pointer to the US-017B correction client (never auto-switches). */
30
- export declare const COMPANY_CORRECTION_PATH_PREFIX = "hq mesh context correct --session";
31
29
  export declare function companyCorrectionPath(sessionId: string): string;
32
30
  export type CompanyResolution = {
33
31
  status: "resolved";
@@ -72,18 +70,6 @@ export interface CompanyResolveInput {
72
70
  /** Env naming the on-box identity.json (fleet agent boxes). */
73
71
  export declare const HQ_AGENT_IDENTITY_FILE_ENV = "HQ_AGENT_IDENTITY_FILE";
74
72
  export declare const DEFAULT_AGENT_IDENTITY_FILE = "/var/lib/hq-agent/identity.json";
75
- /**
76
- * Read `companyUid` from the agent identity file when
77
- * `HQ_AGENT_IDENTITY_FILE` is set, or the conventional fleet path otherwise.
78
- * Missing/unreadable/malformed → undefined
79
- * (never throws; never logs file contents).
80
- */
81
- export interface AgentIdentityCompany {
82
- uid?: string;
83
- slug?: string;
84
- }
85
- /** Company uid and slug from the fleet identity file. Missing file → undefined. */
86
- export declare function readAgentIdentityCompany(env?: NodeJS.ProcessEnv): AgentIdentityCompany | undefined;
87
73
  export declare function readAgentIdentityCompanyUid(env?: NodeJS.ProcessEnv): string | undefined;
88
74
  /**
89
75
  * Company named for a machine session.
@@ -126,15 +112,6 @@ export declare function projectIdFromCwd(cwd: string | undefined, hqRoot?: strin
126
112
  * Read company_slug from workspace/sessions/<sid>/meta.yaml (best-effort, no yaml dep).
127
113
  */
128
114
  export declare function readMetaCompanySlug(sessionId: string, hqRoot: string | undefined): string | undefined;
129
- /**
130
- * Deterministic mapping: exactly one of cwd companies/{slug} or remote owner.
131
- * Multiple distinct signals that disagree → no deterministic mapping (needs_company
132
- * unless a higher-precedence source exists). Matching signals collapse to one.
133
- */
134
- export declare function resolveDeterministicCompany(input: {
135
- cwd?: string;
136
- hqRoot?: string;
137
- remoteOwnerSlug?: string | null;
138
- }): ResolvedCompany | null;
139
115
  export declare function resolveCompany(input: CompanyResolveInput): CompanyResolution;
116
+ export {};
140
117
  //# sourceMappingURL=company.d.ts.map
@@ -23,7 +23,7 @@ import * as path from "node:path";
23
23
  import { getDefaultCompany, getRepoCompany } from "./config.js";
24
24
  import { authoritativeCompanyFromState, readSessionState, } from "./state.js";
25
25
  /** Pointer to the US-017B correction client (never auto-switches). */
26
- export const COMPANY_CORRECTION_PATH_PREFIX = "hq mesh context correct --session";
26
+ const COMPANY_CORRECTION_PATH_PREFIX = "hq mesh context correct --session";
27
27
  export function companyCorrectionPath(sessionId) {
28
28
  return `${COMPANY_CORRECTION_PATH_PREFIX} ${sessionId}`;
29
29
  }
@@ -58,7 +58,7 @@ function readAgentIdentityRecord(env) {
58
58
  }
59
59
  }
60
60
  /** Company uid and slug from the fleet identity file. Missing file → undefined. */
61
- export function readAgentIdentityCompany(env = process.env) {
61
+ function readAgentIdentityCompany(env = process.env) {
62
62
  const raw = readAgentIdentityRecord(env);
63
63
  if (!raw)
64
64
  return undefined;
@@ -209,7 +209,7 @@ export function readMetaCompanySlug(sessionId, hqRoot) {
209
209
  * Multiple distinct signals that disagree → no deterministic mapping (needs_company
210
210
  * unless a higher-precedence source exists). Matching signals collapse to one.
211
211
  */
212
- export function resolveDeterministicCompany(input) {
212
+ function resolveDeterministicCompany(input) {
213
213
  const fromCwd = companySlugFromCwd(input.cwd, input.hqRoot);
214
214
  const fromRemote = normalizeSlug(input.remoteOwnerSlug ?? undefined);
215
215
  if (fromCwd && fromRemote && fromCwd.toLowerCase() !== fromRemote.toLowerCase()) {
@@ -4,8 +4,7 @@
4
4
  */
5
5
  import * as fs from "node:fs";
6
6
  import { type WindowsAclCheckOptions } from "./windows-acl.js";
7
- import { WORK_CONTEXT_CONTRACT_VERSION } from "./contract.js";
8
- export declare const DEVICE_CONFIG_SCHEMA_VERSION: 1;
7
+ declare const DEVICE_CONFIG_SCHEMA_VERSION: 1;
9
8
  export interface DeviceDefaultCompany {
10
9
  slug: string;
11
10
  uid?: string;
@@ -44,7 +43,7 @@ export interface RepoCompanyMapping {
44
43
  uid?: string;
45
44
  updatedAt: string;
46
45
  }
47
- export type RepoCompanyMap = Record<string, RepoCompanyMapping>;
46
+ type RepoCompanyMap = Record<string, RepoCompanyMapping>;
48
47
  export interface WorkContextDeviceConfig {
49
48
  schemaVersion: typeof DEVICE_CONFIG_SCHEMA_VERSION;
50
49
  /** Explicit device default. Never copied from activeCompany. */
@@ -77,7 +76,6 @@ export interface DeviceConfigDeps {
77
76
  validateMembership?: (slug: string) => Promise<MembershipValidationResult> | MembershipValidationResult;
78
77
  now?: () => Date;
79
78
  }
80
- export declare const CONFIG_LOCK_STALE_MS = 30000;
81
79
  /** Acquire an interprocess config lock; exported for direct lock regression tests. */
82
80
  export declare function acquireDeviceConfigLock(root: string, options?: {
83
81
  timeoutMs?: number;
@@ -132,8 +130,5 @@ export declare function setAutoDefaultCompany(membership: DefaultCompanyMembersh
132
130
  afterCompareAndSwap?: () => void;
133
131
  }): WorkContextDeviceConfig;
134
132
  export declare function setRepairHeldWithDefault(enabled: boolean, deps: Pick<DeviceConfigDeps, "root" | "now">): WorkContextDeviceConfig;
135
- /** Convenience: build deps from HOME / injectable root. */
136
- export declare function deviceConfigDepsFromHome(home?: string, extras?: Partial<DeviceConfigDeps>): DeviceConfigDeps;
137
- /** Re-export for callers that stamp contractVersion on related state. */
138
- export { WORK_CONTEXT_CONTRACT_VERSION };
133
+ export {};
139
134
  //# sourceMappingURL=config.d.ts.map
@@ -6,13 +6,11 @@ import * as fs from "node:fs";
6
6
  import * as path from "node:path";
7
7
  import { atomicWriteJson, ensureOwnerDir, resolveRealTarget } from "./atomic.js";
8
8
  import { DefaultCompanyUnavailableError, UnsafeConfigPathError, WorkContextError, } from "./errors.js";
9
- import { workContextConfigPath, workContextRoot } from "./paths.js";
9
+ import { workContextConfigPath } from "./paths.js";
10
10
  import { assertWindowsOwnerOnlyAcl } from "./windows-acl.js";
11
- import { WORK_CONTEXT_CONTRACT_VERSION } from "./contract.js";
12
- export const DEVICE_CONFIG_SCHEMA_VERSION = 1;
11
+ const DEVICE_CONFIG_SCHEMA_VERSION = 1;
13
12
  const CONFIG_LOCK_TIMEOUT_MS = 5_000;
14
13
  const CONFIG_LOCK_RETRY_MS = 10;
15
- export const CONFIG_LOCK_STALE_MS = 30_000;
16
14
  function waitForConfigLock(ms) {
17
15
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
18
16
  }
@@ -497,13 +495,4 @@ export function setRepairHeldWithDefault(enabled, deps) {
497
495
  return next;
498
496
  });
499
497
  }
500
- /** Convenience: build deps from HOME / injectable root. */
501
- export function deviceConfigDepsFromHome(home, extras = {}) {
502
- return {
503
- root: extras.root ?? workContextRoot(home),
504
- ...extras,
505
- };
506
- }
507
- /** Re-export for callers that stamp contractVersion on related state. */
508
- export { WORK_CONTEXT_CONTRACT_VERSION };
509
498
  //# sourceMappingURL=config.js.map
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import type { ClassificationState } from "./contract.js";
6
6
  import { WORK_CONTEXT_CONTRACT_VERSION } from "./contract.js";
7
- export type DecisionOptionKind = "bind_existing" | "create_project" | "create_task" | "untracked" | "keep_default" | "override_evidence";
7
+ type DecisionOptionKind = "bind_existing" | "create_project" | "create_task" | "untracked" | "keep_default" | "override_evidence";
8
8
  export interface SessionDecisionOption {
9
9
  optionId: string;
10
10
  label?: string;
@@ -27,9 +27,9 @@ export interface SessionDecision {
27
27
  /** Local-only origin of the session state writer (never sent on the wire). */
28
28
  export type SessionEventSource = "hook" | "transcript";
29
29
  /** Local-only harness label when network schema cannot carry it (US-018). */
30
- export type LocalHarnessLabel = "claude-desktop" | "codex";
30
+ type LocalHarnessLabel = "claude-desktop" | "codex";
31
31
  /** Local tracking for an in-flight or completed cross-company migrate (US-017B). */
32
- export interface SessionMigrationRecord {
32
+ interface SessionMigrationRecord {
33
33
  operationId: string;
34
34
  digest: string;
35
35
  sourceCompanyUid: string;
@@ -133,14 +133,6 @@ export interface AcknowledgedRegisterBinding {
133
133
  taskId?: string;
134
134
  receiptId: string;
135
135
  }
136
- /** Allowlisted keys that may appear in the durable state projection. */
137
- export declare const SESSION_STATE_ALLOWLIST: Set<string>;
138
- /**
139
- * Serialize a session-state read/modify/write with every state writer. Atomic
140
- * rename protects readers from torn files, but only this shared lock protects
141
- * a writer that has to verify the current binding before changing it.
142
- */
143
- export declare function withSessionStateLock<T>(sessionId: string, root: string, fn: () => T): T;
144
136
  export declare function readSessionState(sessionId: string, root: string): SessionStateFile | null;
145
137
  export declare function writeSessionState(state: SessionStateFile, root: string): string;
146
138
  /**
@@ -148,8 +140,6 @@ export declare function writeSessionState(state: SessionStateFile, root: string)
148
140
  * lock used by ordinary session writers. Returning null declines the write.
149
141
  */
150
142
  export declare function updateSessionState(sessionId: string, root: string, update: (current: SessionStateFile | null) => SessionStateFile | null): SessionStateFile | null;
151
- /** Strip any non-allowlisted fields before durable write. */
152
- export declare function projectSessionState(state: SessionStateFile): SessionStateFile;
153
143
  /**
154
144
  * Merge prior local fields into a new state write so PostToolUse bumps and
155
145
  * reconcile updates do not clobber an acknowledged company binding.
@@ -201,4 +191,5 @@ export declare function authoritativeCompanyFromState(state: SessionStateFile |
201
191
  * Carrying it forward makes the server drop every later session-event batch.
202
192
  */
203
193
  export declare function applyOperatorProjectBinding(state: SessionStateFile, projectId: string, now?: () => Date): SessionStateFile;
194
+ export {};
204
195
  //# sourceMappingURL=state.d.ts.map
@@ -8,34 +8,6 @@ import { WORK_CONTEXT_CONTRACT_VERSION } from "./contract.js";
8
8
  import { atomicWriteJson, ensureOwnerDir, resolveRealTarget } from "./atomic.js";
9
9
  import { NotTrackingError, UnsafeConfigPathError } from "./errors.js";
10
10
  import { isSafeWorkContextSegment, workContextSessionPath, workContextSessionsDir, } from "./paths.js";
11
- /** Allowlisted keys that may appear in the durable state projection. */
12
- export const SESSION_STATE_ALLOWLIST = new Set([
13
- "contractVersion",
14
- "sessionId",
15
- "companyUid",
16
- "companySlug",
17
- "contextStatus",
18
- "projectId",
19
- "taskId",
20
- "bindingEpisodeId",
21
- "version",
22
- "decision",
23
- "migration",
24
- "untrackedReceipt",
25
- "toolWrites",
26
- "startedAt",
27
- "hasTurn",
28
- "source",
29
- "localHarness",
30
- "transcriptMarker",
31
- "companyConfidence",
32
- "projectBindReason",
33
- "projectCandidates",
34
- "projectGate",
35
- "projectHint",
36
- "presenceLeave",
37
- "updatedAt",
38
- ]);
39
11
  const SESSION_STATE_LOCK_TIMEOUT_MS = 5_000;
40
12
  const SESSION_STATE_LOCK_RETRY_MS = 10;
41
13
  function waitForSessionStateLock(ms) {
@@ -72,7 +44,7 @@ function reclaimStaleSessionStateLock(lockPath) {
72
44
  * rename protects readers from torn files, but only this shared lock protects
73
45
  * a writer that has to verify the current binding before changing it.
74
46
  */
75
- export function withSessionStateLock(sessionId, root, fn) {
47
+ function withSessionStateLock(sessionId, root, fn) {
76
48
  if (!isSafeWorkContextSegment(sessionId)) {
77
49
  throw new NotTrackingError(`Unsafe session id for state file: ${sessionId}`, "NOT_TRACKING");
78
50
  }
@@ -192,7 +164,7 @@ export function updateSessionState(sessionId, root, update) {
192
164
  });
193
165
  }
194
166
  /** Strip any non-allowlisted fields before durable write. */
195
- export function projectSessionState(state) {
167
+ function projectSessionState(state) {
196
168
  const out = {
197
169
  contractVersion: WORK_CONTEXT_CONTRACT_VERSION,
198
170
  sessionId: state.sessionId,
@@ -50,10 +50,16 @@ export type RunBundledScriptOptions = {
50
50
  hqRoot?: string;
51
51
  /** Extra environment for the child, applied last. */
52
52
  env?: Record<string, string | undefined>;
53
+ /** Capture stdout and stderr as bytes instead of inheriting those streams. */
54
+ captureOutput?: boolean;
53
55
  };
54
56
  export type RunBundledScriptResult = {
55
57
  /** The child's exit code, or 128+signal if it was terminated by one. */
56
58
  code: number;
59
+ /** Present when captureOutput is true. */
60
+ stdout?: Buffer;
61
+ /** Present when captureOutput is true. */
62
+ stderr?: Buffer;
57
63
  };
58
64
  /**
59
65
  * Execute a bundled scaffold script and return its exit code.
@@ -155,7 +155,8 @@ export function runBundledScript(opts) {
155
155
  const result = spawnSync(executable, [script, ...(opts.args ?? [])], {
156
156
  cwd: opts.cwd,
157
157
  env,
158
- stdio: "inherit",
158
+ stdio: opts.captureOutput ? ["inherit", "pipe", "pipe"] : "inherit",
159
+ ...(opts.captureOutput ? { maxBuffer: Number.MAX_SAFE_INTEGER } : {}),
159
160
  });
160
161
  if (result.error) {
161
162
  const spawnError = result.error;
@@ -166,6 +167,7 @@ export function runBundledScript(opts) {
166
167
  }
167
168
  throw new Error(`Failed to run bundled script ${opts.asset}: ${result.error.message}`);
168
169
  }
170
+ let code;
169
171
  if (result.signal) {
170
172
  // Conventional shell encoding, so a caller checking for termination sees it.
171
173
  const signals = {
@@ -175,8 +177,17 @@ export function runBundledScript(opts) {
175
177
  SIGKILL: 9,
176
178
  SIGTERM: 15,
177
179
  };
178
- return { code: 128 + (signals[result.signal] ?? 0) };
180
+ code = 128 + (signals[result.signal] ?? 0);
179
181
  }
180
- return { code: result.status ?? 0 };
182
+ else {
183
+ code = result.status ?? 0;
184
+ }
185
+ return {
186
+ code,
187
+ ...(opts.captureOutput ? {
188
+ stdout: result.stdout ?? Buffer.alloc(0),
189
+ stderr: result.stderr ?? Buffer.alloc(0),
190
+ } : {}),
191
+ };
181
192
  }
182
193
  //# sourceMappingURL=run-bundled-script.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.310.0",
3
+ "version": "5.311.1",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {