@indigoai-us/hq-cli 5.345.212 → 5.345.215-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.
- package/CHANGELOG.md +49 -0
- package/dist/bin/hq-auth-refresh.js +2 -1
- package/dist/command-catalog.generated.d.ts +442 -50
- package/dist/command-catalog.generated.js +541 -50
- package/dist/commands/agent-inbox.d.ts +11 -1
- package/dist/commands/agent-inbox.js +128 -38
- package/dist/commands/agent-kit.js +2 -2
- package/dist/commands/agents.d.ts +51 -1
- package/dist/commands/agents.js +154 -2
- package/dist/commands/bot-jobs.d.ts +2 -15
- package/dist/commands/bot-jobs.js +2 -94
- package/dist/commands/bot-runtime.d.ts +46 -5
- package/dist/commands/bot-runtime.js +228 -18
- package/dist/commands/bot.d.ts +16 -9
- package/dist/commands/bot.js +169 -51
- package/dist/commands/cloud.d.ts +66 -13
- package/dist/commands/cloud.js +120 -39
- package/dist/commands/company-restore.d.ts +23 -0
- package/dist/commands/company-restore.js +128 -0
- package/dist/commands/company.js +2 -0
- package/dist/commands/core-handoff.js +1 -0
- package/dist/commands/core-hq-session-native.js +2 -2
- package/dist/commands/core-pin-native.js +1 -1
- package/dist/commands/core-policy.js +1 -1
- package/dist/commands/core-resolve-company-native.js +1 -1
- package/dist/commands/core-sentry-report-fast.d.ts +2 -0
- package/dist/commands/core-sentry-report-fast.js +3 -1
- package/dist/commands/daemon.js +11 -1
- package/dist/commands/integrations-connect.d.ts +17 -4
- package/dist/commands/integrations-connect.js +224 -26
- package/dist/commands/lanes-link.js +10 -5
- package/dist/commands/lanes.js +26 -9
- package/dist/commands/rescue.js +13 -0
- package/dist/commands/secrets.d.ts +11 -0
- package/dist/commands/secrets.js +41 -7
- package/dist/commands/sources.js +6 -0
- package/dist/commands/storage-offload.d.ts +12 -0
- package/dist/commands/storage-offload.js +41 -3
- package/dist/commands/sync-mode.js +5 -0
- package/dist/commands/whoami.js +4 -0
- package/dist/index.js +2 -0
- package/dist/lazy-commands.js +2 -0
- package/dist/lib/agent-kit/inbox-fetch.d.ts +122 -1
- package/dist/lib/agent-kit/inbox-fetch.js +215 -3
- package/dist/lib/agent-kit/inbox-redact.js +1 -1
- package/dist/lib/agent-kit/inbox-state.d.ts +98 -1
- package/dist/lib/agent-kit/inbox-state.js +261 -4
- package/dist/lib/agent-kit/mcp/tools.d.ts +3 -3
- package/dist/lib/agent-kit/mcp/tools.js +68 -25
- package/dist/lib/agent-kit/run/inbox.js +4 -2
- package/dist/lib/agent-kit/skills.js +4 -1
- package/dist/lib/agent-kit/wake.d.ts +9 -1
- package/dist/lib/agent-kit/wake.js +10 -3
- package/dist/lib/bot/config.d.ts +1 -0
- package/dist/lib/bot/config.js +10 -0
- package/dist/lib/bot/eventbridge-cron.d.ts +22 -0
- package/dist/lib/bot/eventbridge-cron.js +104 -0
- package/dist/lib/bot/fleet-cron.js +193 -14
- package/dist/lib/bot/fleet-download.d.ts +2 -0
- package/dist/lib/bot/fleet-download.js +23 -0
- package/dist/lib/bot/fleet-local.d.ts +34 -1
- package/dist/lib/bot/fleet-local.js +254 -37
- package/dist/lib/bot/fleet-python.d.ts +3 -0
- package/dist/lib/bot/fleet-python.js +34 -4
- package/dist/lib/bot/fleet-runtime-sources.d.ts +15 -0
- package/dist/lib/bot/fleet-runtime-sources.js +30 -0
- package/dist/lib/bot/legacy-provider-login.d.ts +8 -0
- package/dist/lib/bot/legacy-provider-login.js +19 -2
- package/dist/lib/bot/prompt.js +1 -1
- package/dist/lib/bot/readiness.d.ts +8 -0
- package/dist/lib/bot/readiness.js +17 -3
- package/dist/lib/bot/runtime-auth.d.ts +30 -0
- package/dist/lib/bot/runtime-auth.js +94 -3
- package/dist/lib/bot/status.d.ts +2 -0
- package/dist/lib/capacity/collectors/grok-refresh.d.ts +80 -0
- package/dist/lib/capacity/collectors/grok-refresh.js +189 -0
- package/dist/lib/capacity/collectors/grok.d.ts +5 -0
- package/dist/lib/capacity/collectors/grok.js +56 -5
- package/dist/lib/core-utils/session-id.d.ts +1 -1
- package/dist/lib/core-utils/session-id.js +4 -0
- package/dist/lib/daemon/catalog.js +11 -1
- package/dist/lib/daemon/run.js +9 -1
- package/dist/lib/daemon/updater.d.ts +34 -2
- package/dist/lib/daemon/updater.js +51 -2
- package/dist/lib/db/sqlite-binding.d.ts +1 -0
- package/dist/lib/db/sqlite-binding.js +1 -1
- package/dist/lib/delivery/artifacts.d.ts +99 -0
- package/dist/lib/delivery/artifacts.js +548 -0
- package/dist/lib/delivery/backup.d.ts +78 -0
- package/dist/lib/delivery/backup.js +343 -0
- package/dist/lib/delivery/cache.d.ts +29 -0
- package/dist/lib/delivery/cache.js +33 -0
- package/dist/lib/delivery/contracts.d.ts +142 -0
- package/dist/lib/delivery/contracts.js +289 -0
- package/dist/lib/delivery/credentials.d.ts +54 -0
- package/dist/lib/delivery/credentials.js +119 -0
- package/dist/lib/delivery/enrollment.d.ts +142 -0
- package/dist/lib/delivery/enrollment.js +382 -0
- package/dist/lib/delivery/identity.d.ts +25 -0
- package/dist/lib/delivery/identity.js +82 -0
- package/dist/lib/delivery/inbox.d.ts +116 -0
- package/dist/lib/delivery/inbox.js +260 -0
- package/dist/lib/delivery/migrations.d.ts +139 -0
- package/dist/lib/delivery/migrations.js +623 -0
- package/dist/lib/delivery/mqtt-adapter.d.ts +50 -0
- package/dist/lib/delivery/mqtt-adapter.js +242 -0
- package/dist/lib/delivery/mqtt.d.ts +61 -0
- package/dist/lib/delivery/mqtt.js +112 -0
- package/dist/lib/delivery/outbox.d.ts +95 -0
- package/dist/lib/delivery/outbox.js +187 -0
- package/dist/lib/delivery/provenance.d.ts +129 -0
- package/dist/lib/delivery/provenance.js +93 -0
- package/dist/lib/delivery/reconciler.d.ts +151 -0
- package/dist/lib/delivery/reconciler.js +492 -0
- package/dist/lib/delivery/restore.d.ts +35 -0
- package/dist/lib/delivery/restore.js +134 -0
- package/dist/lib/delivery/store.d.ts +161 -0
- package/dist/lib/delivery/store.js +940 -0
- package/dist/lib/delivery/workers/macos-job-helper.d.ts +103 -0
- package/dist/lib/delivery/workers/macos-job-helper.js +927 -0
- package/dist/lib/delivery/workers/macos.d.ts +176 -0
- package/dist/lib/delivery/workers/macos.js +901 -0
- package/dist/lib/delivery/workers/windows-boundary.d.ts +453 -0
- package/dist/lib/delivery/workers/windows-boundary.js +693 -0
- package/dist/lib/delivery/workers/windows-job-helper.d.ts +35 -0
- package/dist/lib/delivery/workers/windows-job-helper.js +264 -0
- package/dist/lib/delivery/workers/windows.d.ts +241 -0
- package/dist/lib/delivery/workers/windows.js +608 -0
- package/dist/lib/doctor/checks/release-links.d.ts +50 -8
- package/dist/lib/doctor/checks/release-links.js +260 -24
- package/dist/lib/doctor/fix/apply.js +24 -8
- package/dist/lib/doctor/fix/remediation.js +15 -5
- package/dist/lib/install/provider-wrappers.d.ts +2 -0
- package/dist/lib/install/provider-wrappers.js +68 -3
- package/dist/lib/lanes/autopilot-registry.d.ts +14 -0
- package/dist/lib/lanes/autopilot-registry.js +59 -7
- package/dist/lib/lanes/links.d.ts +14 -0
- package/dist/lib/lanes/links.js +320 -25
- package/dist/lib/lanes/outpost-pruner-install.d.ts +10 -0
- package/dist/lib/lanes/outpost-pruner-install.js +4 -3
- package/dist/main.js +3 -1
- package/dist/sentry-init.d.ts +2 -0
- package/dist/sentry-init.js +13 -2
- package/dist/sentry.d.ts +2 -0
- package/dist/sentry.js +5 -1
- package/dist/utils/cli-network-lifecycle.d.ts +9 -0
- package/dist/utils/cli-network-lifecycle.js +52 -0
- package/dist/utils/cognito-callback-port.d.ts +14 -0
- package/dist/utils/cognito-callback-port.js +24 -0
- package/dist/utils/cognito-session.js +3 -3
- package/dist/utils/deleted-company-notice.d.ts +59 -0
- package/dist/utils/deleted-company-notice.js +156 -0
- package/dist/utils/login-browser.d.ts +1 -1
- package/dist/utils/login-browser.js +7 -5
- package/dist/utils/resident-package-preload.js +30 -15
- package/dist/utils/safe-link.d.ts +63 -0
- package/dist/utils/safe-link.js +246 -0
- package/dist/utils/sentry-keepalive-transport.d.ts +28 -0
- package/dist/utils/sentry-keepalive-transport.js +70 -0
- package/dist/utils/vault-api.js +7 -0
- package/package.json +7 -7
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
+
// Same order as hq-core core/scripts/lib/session-id.sh (hq-core-staging #1818).
|
|
4
|
+
// HQ_FLEET_SESSION_ID is the only id an HQ Fleet scheduled job has. It ranks
|
|
5
|
+
// after the harness ids, which the scope guard sees in its hook payload.
|
|
3
6
|
export const SESSION_ID_ENV_KEYS = [
|
|
4
7
|
"HQ_SESSION_ID",
|
|
5
8
|
"CLAUDE_CODE_SESSION_ID",
|
|
@@ -7,6 +10,7 @@ export const SESSION_ID_ENV_KEYS = [
|
|
|
7
10
|
"CODEX_SESSION_ID",
|
|
8
11
|
"CODEX_THREAD_ID",
|
|
9
12
|
"GROK_SESSION_ID",
|
|
13
|
+
"HQ_FLEET_SESSION_ID",
|
|
10
14
|
];
|
|
11
15
|
export function validSessionId(value) {
|
|
12
16
|
return Boolean(value) && value !== "." && value !== ".." && /^[A-Za-z0-9._-]+$/.test(value);
|
|
@@ -319,7 +319,17 @@ function planService(service, ctx) {
|
|
|
319
319
|
}
|
|
320
320
|
case "mesh": {
|
|
321
321
|
const args = ["mesh", "daemon", "run", ...(ctx.hqRoot ? ["--hq-root", ctx.hqRoot] : [])];
|
|
322
|
-
return [
|
|
322
|
+
return [
|
|
323
|
+
base(service, {
|
|
324
|
+
command: { type: "hq", args },
|
|
325
|
+
// The capacity collector inside the mesh daemon runs `hq runners ... --json` for the
|
|
326
|
+
// Claude token-refresh gate. Those commands find the HQ folder from $HQ_ROOT or the
|
|
327
|
+
// working directory, and the supervisor starts services outside HQ, so without this
|
|
328
|
+
// every gate read failed and every Claude account stayed expired.
|
|
329
|
+
env: ctx.hqRoot ? { HQ_ROOT: ctx.hqRoot } : {},
|
|
330
|
+
blocked: firstBlock([[!ctx.signedIn, NOT_SIGNED_IN]]),
|
|
331
|
+
}),
|
|
332
|
+
];
|
|
323
333
|
}
|
|
324
334
|
case "heartbeat": {
|
|
325
335
|
if (agentMachine) {
|
package/dist/lib/daemon/run.js
CHANGED
|
@@ -575,7 +575,15 @@ export function prepareUnitStart(unit, log, alive) {
|
|
|
575
575
|
* an on-failure unit down. The daemon's updater handles CLI updates.
|
|
576
576
|
*/
|
|
577
577
|
export function unitProcessEnv(base, unit) {
|
|
578
|
-
|
|
578
|
+
// HQ_DAEMON_CLI_VERSION tells the updater unit which release this daemon
|
|
579
|
+
// runs when hqd (HQ Anywhere) is off, so it can replace an older daemon.
|
|
580
|
+
const env = {
|
|
581
|
+
...base,
|
|
582
|
+
...unit.env,
|
|
583
|
+
HQ_DAEMON_UNIT: unit.id,
|
|
584
|
+
HQ_DAEMON_CLI_VERSION: CLI_VERSION,
|
|
585
|
+
HQ_NO_UPDATE_CHECK: "1",
|
|
586
|
+
};
|
|
579
587
|
for (const key of DAEMON_CHILD_ONE_SHOT_KEYS)
|
|
580
588
|
delete env[key];
|
|
581
589
|
// Scheduled hq commands stay eligible for Sentry. The resident mark goes only
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
* 3. Install or update the daemon's own hq-cloud (sync and the outpost
|
|
12
12
|
* heartbeat run from it when it is newer than the CLI's bundled copy), and
|
|
13
13
|
* restart sync and the heartbeat right after it changes.
|
|
14
|
-
* 4. After a CLI update,
|
|
15
|
-
*
|
|
14
|
+
* 4. After a CLI update, or when the running daemon reports an older version
|
|
15
|
+
* than the CLI on disk, ask the daemon to restart itself so the supervisor
|
|
16
|
+
* and every service run the new version. The remote-control hosts notice an
|
|
16
17
|
* updated Claude or Codex on disk themselves and restart once idle.
|
|
17
18
|
*/
|
|
18
19
|
import type { SelfUpdateOutcome } from "../../utils/self-update.js";
|
|
@@ -36,6 +37,15 @@ export interface UpdaterDeps {
|
|
|
36
37
|
/** The units on this machine that run hq-cloud code, restarted after it updates. */
|
|
37
38
|
hqCloudUnits: readonly string[];
|
|
38
39
|
requestDaemonRestart: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* The version of the hq CLI on disk (this process's own; the daemon starts
|
|
42
|
+
* each unit from the installed CLI) and a probe for the version the running
|
|
43
|
+
* daemon reports. When the daemon is older it is restarted even though this
|
|
44
|
+
* run updated nothing: the CLI may have been replaced by the desktop app,
|
|
45
|
+
* `hq update` or npm while a daemon from an older release kept running.
|
|
46
|
+
*/
|
|
47
|
+
installedCliVersion?: string;
|
|
48
|
+
runningDaemonVersion?: () => Promise<string | null>;
|
|
39
49
|
/** Restart one unit (a restart request to the running daemon). */
|
|
40
50
|
requestRestart: (unit: string) => void;
|
|
41
51
|
log: (line: string) => void;
|
|
@@ -45,6 +55,28 @@ export interface UpdaterResult {
|
|
|
45
55
|
/** Tools whose version changed in this run. */
|
|
46
56
|
updated: ToolName[];
|
|
47
57
|
}
|
|
58
|
+
/** Only a strictly older, parseable daemon version triggers a restart, so a dev build never loops. */
|
|
59
|
+
export declare function daemonIsOlderThanCli(running: string, installed: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* The version a daemon handed to the staged child bootstrap that started this
|
|
62
|
+
* unit: `<node> <...>/hq-child-bootstrap.mjs <prefix> <version> [args]`.
|
|
63
|
+
* Daemons have started units this way since 2026-10-05 (#1541).
|
|
64
|
+
*/
|
|
65
|
+
export declare function daemonVersionFromBootstrapCommandLine(line: string | null): string | null;
|
|
66
|
+
export interface RunningDaemonVersionDeps {
|
|
67
|
+
/** Ask hqd; it listens only while HQ Anywhere is on, so this often fails. */
|
|
68
|
+
ping: () => Promise<string>;
|
|
69
|
+
env: NodeJS.ProcessEnv;
|
|
70
|
+
/** The command line of this unit's parent process (the child bootstrap). */
|
|
71
|
+
parentCommandLine: () => string | null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The hq-cli version the running daemon was started from. hqd first; then the
|
|
75
|
+
* version a newer daemon puts in the unit's environment; then the version an
|
|
76
|
+
* older daemon passed to the child bootstrap, which covers daemons from before
|
|
77
|
+
* this release on machines with HQ Anywhere off.
|
|
78
|
+
*/
|
|
79
|
+
export declare function resolveRunningDaemonVersion(deps: RunningDaemonVersionDeps): Promise<string | null>;
|
|
48
80
|
export declare function runDaemonUpdater(deps: UpdaterDeps): Promise<UpdaterResult>;
|
|
49
81
|
/**
|
|
50
82
|
* The variables for the updater's own CLI update. Every supervised service
|
|
@@ -11,13 +11,55 @@
|
|
|
11
11
|
* 3. Install or update the daemon's own hq-cloud (sync and the outpost
|
|
12
12
|
* heartbeat run from it when it is newer than the CLI's bundled copy), and
|
|
13
13
|
* restart sync and the heartbeat right after it changes.
|
|
14
|
-
* 4. After a CLI update,
|
|
15
|
-
*
|
|
14
|
+
* 4. After a CLI update, or when the running daemon reports an older version
|
|
15
|
+
* than the CLI on disk, ask the daemon to restart itself so the supervisor
|
|
16
|
+
* and every service run the new version. The remote-control hosts notice an
|
|
16
17
|
* updated Claude or Codex on disk themselves and restart once idle.
|
|
17
18
|
*/
|
|
18
19
|
import { spawnSync } from "node:child_process";
|
|
19
20
|
import * as fs from "node:fs";
|
|
21
|
+
import semver from "semver";
|
|
20
22
|
import { locateTool, toolUpdateCommand } from "./tools.js";
|
|
23
|
+
/** Only a strictly older, parseable daemon version triggers a restart, so a dev build never loops. */
|
|
24
|
+
export function daemonIsOlderThanCli(running, installed) {
|
|
25
|
+
const r = semver.valid(running);
|
|
26
|
+
const i = semver.valid(installed);
|
|
27
|
+
return r !== null && i !== null && semver.lt(r, i);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The version a daemon handed to the staged child bootstrap that started this
|
|
31
|
+
* unit: `<node> <...>/hq-child-bootstrap.mjs <prefix> <version> [args]`.
|
|
32
|
+
* Daemons have started units this way since 2026-10-05 (#1541).
|
|
33
|
+
*/
|
|
34
|
+
export function daemonVersionFromBootstrapCommandLine(line) {
|
|
35
|
+
if (!line)
|
|
36
|
+
return null;
|
|
37
|
+
const match = /hq-child-bootstrap\.m?js\s.*?(?:^|\s)(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)(?=\s|$)/.exec(line);
|
|
38
|
+
return match?.[1] ?? null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The hq-cli version the running daemon was started from. hqd first; then the
|
|
42
|
+
* version a newer daemon puts in the unit's environment; then the version an
|
|
43
|
+
* older daemon passed to the child bootstrap, which covers daemons from before
|
|
44
|
+
* this release on machines with HQ Anywhere off.
|
|
45
|
+
*/
|
|
46
|
+
export async function resolveRunningDaemonVersion(deps) {
|
|
47
|
+
try {
|
|
48
|
+
return await deps.ping();
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// fall through to the local sources
|
|
52
|
+
}
|
|
53
|
+
const fromEnv = deps.env.HQ_DAEMON_CLI_VERSION?.trim();
|
|
54
|
+
if (fromEnv)
|
|
55
|
+
return fromEnv;
|
|
56
|
+
try {
|
|
57
|
+
return daemonVersionFromBootstrapCommandLine(deps.parentCommandLine());
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
21
63
|
export async function runDaemonUpdater(deps) {
|
|
22
64
|
let ok = true;
|
|
23
65
|
// The restart stops this process too, so it is requested only once all the
|
|
@@ -42,6 +84,13 @@ export async function runDaemonUpdater(deps) {
|
|
|
42
84
|
deps.log(`hq CLI: ${cli.action === "current" ? "up to date" : cli.action}`);
|
|
43
85
|
}
|
|
44
86
|
}
|
|
87
|
+
if (!restart && deps.installedCliVersion && deps.runningDaemonVersion) {
|
|
88
|
+
const running = await deps.runningDaemonVersion().catch(() => null);
|
|
89
|
+
if (running && daemonIsOlderThanCli(running, deps.installedCliVersion)) {
|
|
90
|
+
deps.log(`hqd still runs hq-cli ${running}, older than the installed ${deps.installedCliVersion}; the daemon restarts onto it once the tools are checked`);
|
|
91
|
+
restart = true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
45
94
|
if (deps.updateHqCloud) {
|
|
46
95
|
const cloud = await deps.updateHqCloud().catch((err) => ({
|
|
47
96
|
ok: false,
|
|
@@ -10,6 +10,7 @@ export interface LoadBetterSqlite3Options {
|
|
|
10
10
|
repair?: () => boolean;
|
|
11
11
|
}
|
|
12
12
|
export declare function resetSqliteBindingForTests(): void;
|
|
13
|
+
export declare function isNativeBindingError(error: unknown): boolean;
|
|
13
14
|
export declare function clearBetterSqlite3RequireCache(): void;
|
|
14
15
|
/**
|
|
15
16
|
* A `.js` bin runs under this Node. A `.cmd` shim goes through the escaped
|
|
@@ -29,7 +29,7 @@ export function resetSqliteBindingForTests() {
|
|
|
29
29
|
failed = undefined;
|
|
30
30
|
defaultRepairAttempted = false;
|
|
31
31
|
}
|
|
32
|
-
function isNativeBindingError(error) {
|
|
32
|
+
export function isNativeBindingError(error) {
|
|
33
33
|
const record = error;
|
|
34
34
|
const text = error instanceof Error ? `${record?.code ?? ""} ${error.message}` : String(error);
|
|
35
35
|
return /better_sqlite3\.node|could not locate the bindings file|NODE_MODULE_VERSION|was compiled against a different node|not a valid win32 application|dlopen|ERR_DLOPEN_FAILED|MODULE_NOT_FOUND/i.test(text);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { CredentialSource } from "./credentials.js";
|
|
2
|
+
import type { AdminScope, DeliveryAccess } from "./enrollment.js";
|
|
3
|
+
import { type WorkerIdentity } from "./identity.js";
|
|
4
|
+
import { type ArtifactProvenance, type BuildInputs, type TrustPartition } from "./provenance.js";
|
|
5
|
+
export type { BuildInputs, ArtifactProvenance, TrustPartition } from "./provenance.js";
|
|
6
|
+
export declare const ARTIFACTS_DIR = "artifacts";
|
|
7
|
+
/** Config path of the production provenance signing-key credential ref. */
|
|
8
|
+
export declare const PROVENANCE_SIGNING_KEY_REF_PATH = "delivery.artifacts.signingKeyRef";
|
|
9
|
+
/**
|
|
10
|
+
* The provenance signing-key credential ref from HQ config at
|
|
11
|
+
* PROVENANCE_SIGNING_KEY_REF_PATH. There is no default: an unset or blank ref
|
|
12
|
+
* refuses, so artifacts are never signed with a built-in key.
|
|
13
|
+
*/
|
|
14
|
+
export declare function signingKeyRefFromConfig(config: unknown): string;
|
|
15
|
+
/** Blob path relative to the store directory. Used by backup and restore (US-010). */
|
|
16
|
+
export declare function blobRelativePath(tenantId: string, partition: TrustPartition, digest: string): string;
|
|
17
|
+
export interface ArtifactStoreOptions {
|
|
18
|
+
access: DeliveryAccess;
|
|
19
|
+
/** The control-plane data directory (the delivery store directory). */
|
|
20
|
+
dir: string;
|
|
21
|
+
/** HMAC key for provenance. Only `ref` is stored; the value is looked up on each use. */
|
|
22
|
+
signing: {
|
|
23
|
+
ref: string;
|
|
24
|
+
source: CredentialSource;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface PutInput {
|
|
28
|
+
attemptId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
bytes: Uint8Array;
|
|
31
|
+
inputs: BuildInputs;
|
|
32
|
+
}
|
|
33
|
+
export interface ArtifactView {
|
|
34
|
+
artifactId: string;
|
|
35
|
+
tenantId: string;
|
|
36
|
+
partition: TrustPartition;
|
|
37
|
+
digest: string;
|
|
38
|
+
size: number;
|
|
39
|
+
/**
|
|
40
|
+
* Absolute blob path, for diagnostics. Not verified at use: consume
|
|
41
|
+
* artifact bytes through read(), which re-checks signature and digest.
|
|
42
|
+
*/
|
|
43
|
+
path: string;
|
|
44
|
+
cacheKey: string;
|
|
45
|
+
promoted: boolean;
|
|
46
|
+
provenance: ArtifactProvenance;
|
|
47
|
+
/** Cache keys this write invalidated. Empty except on put. */
|
|
48
|
+
invalidatedCacheKeys: string[];
|
|
49
|
+
}
|
|
50
|
+
/** Open the artifact store and remove blobs left unreferenced by a failed commit. */
|
|
51
|
+
export declare function openArtifactStore(opts: ArtifactStoreOptions): ArtifactStore;
|
|
52
|
+
export declare class ArtifactStore {
|
|
53
|
+
private readonly access;
|
|
54
|
+
private readonly dir;
|
|
55
|
+
private readonly signing;
|
|
56
|
+
constructor(opts: ArtifactStoreOptions);
|
|
57
|
+
/** Store bytes built by `identity` during an open attempt of its own company. Needs "report". */
|
|
58
|
+
put(identity: WorkerIdentity, input: PutInput): ArtifactView;
|
|
59
|
+
/** Verified bytes of an artifact of the worker's own company. Needs "read". */
|
|
60
|
+
read(identity: WorkerIdentity, artifactId: string): {
|
|
61
|
+
bytes: Buffer;
|
|
62
|
+
provenance: ArtifactProvenance;
|
|
63
|
+
};
|
|
64
|
+
/** Re-check the signature and blob of an artifact in scope. Throws ARTIFACT_TAMPERED. */
|
|
65
|
+
verify(scope: AdminScope, artifactId: string): ArtifactView;
|
|
66
|
+
/** The stored record, unverified. */
|
|
67
|
+
describe(scope: AdminScope, artifactId: string): ArtifactView;
|
|
68
|
+
/**
|
|
69
|
+
* Mark a release artifact promoted. Verifies first; refuses untrusted
|
|
70
|
+
* artifacts and artifacts whose attempt has not passed. Idempotent.
|
|
71
|
+
*/
|
|
72
|
+
promote(scope: AdminScope, artifactId: string): ArtifactView;
|
|
73
|
+
/**
|
|
74
|
+
* Cache lookup for the worker's own company and trust partition. Returns a
|
|
75
|
+
* verified artifact or null. A hit that fails verification is evicted.
|
|
76
|
+
* Needs "read".
|
|
77
|
+
*/
|
|
78
|
+
lookup(identity: WorkerIdentity, inputs: BuildInputs): ArtifactView | null;
|
|
79
|
+
/**
|
|
80
|
+
* Remove blob files no artifact record references, and leftover temp
|
|
81
|
+
* files. Only regular files under the artifacts directory are touched;
|
|
82
|
+
* symlinks and unknown entries are left alone. Returns the removed paths.
|
|
83
|
+
*/
|
|
84
|
+
gc(): {
|
|
85
|
+
removed: string[];
|
|
86
|
+
};
|
|
87
|
+
private key;
|
|
88
|
+
private worker;
|
|
89
|
+
private find;
|
|
90
|
+
private unknown;
|
|
91
|
+
private scoped;
|
|
92
|
+
private sameTenant;
|
|
93
|
+
/** Check the signature, then the blob. Returns the verified bytes. */
|
|
94
|
+
private verifyStored;
|
|
95
|
+
private blobPath;
|
|
96
|
+
private writeBlob;
|
|
97
|
+
private view;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=artifacts.d.ts.map
|