@indigoai-us/hq-cli 5.342.1 → 5.342.3
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/CHANGELOG.md +6 -0
- package/dist/commands/secrets-env-exit.d.ts +6 -0
- package/dist/commands/secrets-env-exit.js +28 -0
- package/dist/commands/secrets-public-types.test-d.d.ts +2 -0
- package/dist/commands/secrets-public-types.test-d.js +18 -0
- package/dist/commands/secrets.d.ts +3 -80
- package/dist/commands/secrets.js +5 -458
- package/dist/lib/flag-registry-refresh-wait.d.ts +7 -0
- package/dist/lib/flag-registry-refresh-wait.js +10 -0
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/flag-registry-worker.js +6 -1
- package/dist/lib/flag-registry.d.ts +12 -1
- package/dist/lib/flag-registry.js +125 -5
- package/dist/main.js +8 -2
- package/dist/secrets-env-action.d.ts +103 -0
- package/dist/secrets-env-action.js +459 -0
- package/dist/secrets-env-fast-path.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.342.3] — 2026-10-04
|
|
6
|
+
- `hq secrets env` now waits briefly for the company flag snapshot refresh before its synchronous exit, allowing the fast-path gate to use a persisted snapshot on later invocations.
|
|
7
|
+
|
|
8
|
+
## [5.342.2] — 2026-10-04
|
|
9
|
+
- Load the shared `secrets env` action without importing the full secrets command module on the enabled fast route.
|
|
10
|
+
|
|
5
11
|
## [5.342.1] — 2026-10-04
|
|
6
12
|
- `hq lanes` now continues envelope numbering beyond 999 and records unexpected reconcile admission failures as a distinct queued reason with error details.
|
|
7
13
|
- Reconcile skips configured Codex homes absent on the current host and reports a note; other filesystem errors remain visible as store errors. `--dry-run` no longer compresses rollouts or advances the retention schedule.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { writeSync } from "node:fs";
|
|
2
|
+
/** Write the resolved exports synchronously and exit even if the pipe is closed. */
|
|
3
|
+
export declare function emitEnvExportsAndExit(payload: string, exit?: (code: number) => never, write?: typeof writeSync): never;
|
|
4
|
+
/** Wait for a company snapshot before the synchronous env-command exit. */
|
|
5
|
+
export declare function finishEnvExportsAndExit(payload: string, waitForSnapshot?: (timeoutMs?: number, companyUid?: string) => Promise<void>, exit?: (code: number) => never, write?: typeof writeSync, shouldWaitForSnapshot?: boolean, companyUid?: string): Promise<never>;
|
|
6
|
+
//# sourceMappingURL=secrets-env-exit.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { writeSync } from "node:fs";
|
|
2
|
+
import { waitForRegisteredFlagRegistryRefresh } from "../lib/flag-registry-refresh-wait.js";
|
|
3
|
+
/** Write the resolved exports synchronously and exit even if the pipe is closed. */
|
|
4
|
+
export function emitEnvExportsAndExit(payload, exit = process.exit, write = writeSync) {
|
|
5
|
+
const buf = Buffer.from(payload, "utf8");
|
|
6
|
+
const MAX_EAGAIN_RETRIES = 10_000;
|
|
7
|
+
let offset = 0;
|
|
8
|
+
let eagainRetries = 0;
|
|
9
|
+
while (offset < buf.length) {
|
|
10
|
+
try {
|
|
11
|
+
offset += write(1, buf, offset, buf.length - offset);
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
const code = err.code;
|
|
15
|
+
if (code === "EAGAIN" && eagainRetries++ < MAX_EAGAIN_RETRIES)
|
|
16
|
+
continue;
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return exit(0);
|
|
21
|
+
}
|
|
22
|
+
/** Wait for a company snapshot before the synchronous env-command exit. */
|
|
23
|
+
export async function finishEnvExportsAndExit(payload, waitForSnapshot = waitForRegisteredFlagRegistryRefresh, exit = process.exit, write = writeSync, shouldWaitForSnapshot = true, companyUid) {
|
|
24
|
+
if (shouldWaitForSnapshot)
|
|
25
|
+
await waitForSnapshot(500, companyUid);
|
|
26
|
+
return emitEnvExportsAndExit(payload, exit, write);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=secrets-env-exit.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const scriptUsage = {
|
|
2
|
+
scriptId: "fixture-script",
|
|
3
|
+
path: "scripts/example.sh",
|
|
4
|
+
sha256: "0".repeat(64),
|
|
5
|
+
attestationLevel: "verified",
|
|
6
|
+
};
|
|
7
|
+
const metadata = {
|
|
8
|
+
tier: "standard",
|
|
9
|
+
cacheTtlMs: 1_000,
|
|
10
|
+
};
|
|
11
|
+
const loadedSecret = {
|
|
12
|
+
...metadata,
|
|
13
|
+
name: "FIXTURE_NAME",
|
|
14
|
+
value: "fixture-only",
|
|
15
|
+
};
|
|
16
|
+
void [scriptUsage, metadata, loadedSecret];
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=secrets-public-types.test-d.js.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
|
-
|
|
2
|
+
export { buildSecretUsage, emitEnvExportsAndExit, loadRevealedSecrets, parseSecretNameList, runSecretsEnvCommand, } from "../secrets-env-action.js";
|
|
3
|
+
export type { SecretLoadResponse, SecretScriptLockMode, SecretTier, SecretUsage, SecretUsageChannel } from "../secrets-env-action.js";
|
|
4
|
+
export type { SecretScriptUsage, SecretMetadata, SecretLoadSuccessRow } from "../secrets-env-action.js";
|
|
3
5
|
import { vaultApiFetch, getCompanyUid, getEntityUid } from "../utils/vault-api.js";
|
|
4
6
|
export type { VaultApiOptions } from "../utils/vault-api.js";
|
|
5
7
|
export { vaultApiFetch, getCompanyUid, getEntityUid };
|
|
@@ -10,42 +12,6 @@ export { vaultApiFetch, getCompanyUid, getEntityUid };
|
|
|
10
12
|
*/
|
|
11
13
|
export declare const HQ_PRO_RESOURCE_SURFACES: readonly ["api", "bot_invite", "bot_join_now", "calendar_auto_schedule", "calendar_preferences", "cli_secrets_set", "console_secrets_form", "deploy_precheck", "external_connection", "factory_install", "integrations_connect", "oauth_callback", "plan_limit_check", "secrets_input_link", "web"];
|
|
12
14
|
export declare const CLI_SECRETS_SET_SURFACE = "cli_secrets_set";
|
|
13
|
-
export type SecretTier = "standard" | "sensitive" | "nuclear";
|
|
14
|
-
export type SecretScriptLockMode = "off" | "enforced";
|
|
15
|
-
export type SecretUsageChannel = "run" | "exec" | "env" | "sandbox" | "reveal" | "submit-link";
|
|
16
|
-
export interface SecretScriptUsage {
|
|
17
|
-
scriptId: string;
|
|
18
|
-
path: string;
|
|
19
|
-
sha256: string;
|
|
20
|
-
attestationLevel: string;
|
|
21
|
-
}
|
|
22
|
-
export interface SecretUsage {
|
|
23
|
-
channel: SecretUsageChannel;
|
|
24
|
-
reason?: string;
|
|
25
|
-
script?: SecretScriptUsage;
|
|
26
|
-
}
|
|
27
|
-
export interface SecretMetadata {
|
|
28
|
-
tier?: SecretTier;
|
|
29
|
-
scriptLock?: {
|
|
30
|
-
mode?: SecretScriptLockMode;
|
|
31
|
-
requiredAttestation?: string;
|
|
32
|
-
};
|
|
33
|
-
cacheTtlMs?: number;
|
|
34
|
-
revokedAt?: string | null;
|
|
35
|
-
}
|
|
36
|
-
export interface SecretLoadSuccessRow extends SecretMetadata {
|
|
37
|
-
name: string;
|
|
38
|
-
value?: string;
|
|
39
|
-
version?: number;
|
|
40
|
-
}
|
|
41
|
-
export interface SecretLoadResponse {
|
|
42
|
-
secrets: SecretLoadSuccessRow[];
|
|
43
|
-
errors: Array<{
|
|
44
|
-
name: string;
|
|
45
|
-
code: string;
|
|
46
|
-
message?: string;
|
|
47
|
-
}>;
|
|
48
|
-
}
|
|
49
15
|
export interface SecretInjectionRecipe {
|
|
50
16
|
header: string;
|
|
51
17
|
scheme: "raw" | "bearer";
|
|
@@ -60,48 +26,5 @@ export declare function parseDestinationUrl(raw: string): {
|
|
|
60
26
|
};
|
|
61
27
|
export declare function collectSecretNames(value: string, previous?: string[]): string[];
|
|
62
28
|
export declare function scrubSandboxOutput(text: string, secretNames?: string[]): string;
|
|
63
|
-
export declare function loadRevealedSecrets(token: string, companyUid: string, keys: string[], usage?: SecretUsage, options?: {
|
|
64
|
-
allowOfflineFallback?: boolean;
|
|
65
|
-
}): Promise<Map<string, string>>;
|
|
66
|
-
/**
|
|
67
|
-
* Emit `hq secrets env` output and terminate deterministically.
|
|
68
|
-
*
|
|
69
|
-
* The process MUST exit even when the consuming pipe has gone away. The
|
|
70
|
-
* orphaned-process leak (personal/projects/hq-secrets-process-leak) was caused
|
|
71
|
-
* by relying on `process.stdout.write(payload, () => process.exit(0))`: when the
|
|
72
|
-
* parent shell reading `source <(hq secrets env …)` is killed on timeout, the
|
|
73
|
-
* stdout pipe loses its reader, the write callback never fires, `process.exit(0)`
|
|
74
|
-
* is never reached, and — because `env` forces no other exit — the process parks
|
|
75
|
-
* in `epoll_pwait(-1)` forever, reparented to PID 1. Hundreds accumulated this
|
|
76
|
-
* way, exhausting swap and driving load into triple digits.
|
|
77
|
-
*
|
|
78
|
-
* Writing synchronously to fd 1 and then exiting unconditionally removes every
|
|
79
|
-
* dependency on the event loop draining and on the reader still being attached:
|
|
80
|
-
* - a live reader receives the export lines (synchronous write reaches the
|
|
81
|
-
* kernel pipe buffer before we exit, so nothing is truncated);
|
|
82
|
-
* - a dead reader surfaces as EPIPE, which we swallow — the secret is already
|
|
83
|
-
* resolved and there is nothing left to deliver, so a clean exit is correct;
|
|
84
|
-
* - EAGAIN (stdout in non-blocking mode with a momentarily full buffer) is
|
|
85
|
-
* retried a bounded number of times. `env` payloads are a few short export
|
|
86
|
-
* lines, far under the 64 KiB pipe buffer, so this effectively never spins.
|
|
87
|
-
*
|
|
88
|
-
* `exit` and `write` are injectable for tests; production uses the real ones.
|
|
89
|
-
*/
|
|
90
|
-
export declare function emitEnvExportsAndExit(payload: string, exit?: (code: number) => never, write?: typeof writeSync): never;
|
|
91
|
-
/**
|
|
92
|
-
* Shared `secrets env` action for Commander and the default-off lightweight
|
|
93
|
-
* entrypoint. The fast entrypoint still runs the same credential, usage-audit,
|
|
94
|
-
* server authorization, cache-fallback, redaction, and output code.
|
|
95
|
-
*/
|
|
96
|
-
export declare function runSecretsEnvCommand(opts: {
|
|
97
|
-
only: string[];
|
|
98
|
-
script?: string;
|
|
99
|
-
scriptId?: string;
|
|
100
|
-
}, parentScope: {
|
|
101
|
-
company?: string;
|
|
102
|
-
personal?: boolean;
|
|
103
|
-
}, options?: {
|
|
104
|
-
fallbackOnAuthFailure?: boolean;
|
|
105
|
-
}): Promise<"handled" | "fallback">;
|
|
106
29
|
export declare function registerSecretsCommand(program: Command): void;
|
|
107
30
|
//# sourceMappingURL=secrets.d.ts.map
|