@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
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
import type { LaunchOutcome } from "./windows.js";
|
|
2
|
+
export declare const PILOT: {
|
|
3
|
+
readonly service: "HQNDUS006038";
|
|
4
|
+
readonly serviceIdentity: "NT SERVICE\\HQNDUS006038";
|
|
5
|
+
readonly jobAccount: "BEAKER\\hqnd_job038";
|
|
6
|
+
readonly jobUser: "hqnd_job038";
|
|
7
|
+
readonly root: "C:\\ProgramData\\HQNativeDelivery-US006-038";
|
|
8
|
+
readonly supervisor: "bin\\hqnd-supervisor.exe";
|
|
9
|
+
readonly supervisorPath: "C:\\ProgramData\\HQNativeDelivery-US006-038\\bin\\hqnd-supervisor.exe";
|
|
10
|
+
readonly pipes: {
|
|
11
|
+
readonly bootstrap: "\\\\.\\pipe\\HQNDUS006038.bootstrap";
|
|
12
|
+
readonly submit: "\\\\.\\pipe\\HQNDUS006038.submit";
|
|
13
|
+
readonly control: "\\\\.\\pipe\\HQNDUS006038.control";
|
|
14
|
+
};
|
|
15
|
+
readonly secretName: "HQ_NATIVE_DELIVERY_BEAKER_US006_JOB038_PASSWORD";
|
|
16
|
+
readonly lsaRights: readonly ["SeAssignPrimaryTokenPrivilege", "SeIncreaseQuotaPrivilege"];
|
|
17
|
+
};
|
|
18
|
+
export declare function isSid(value: unknown): value is string;
|
|
19
|
+
/**
|
|
20
|
+
* The virtual account SID Windows derives for a service name:
|
|
21
|
+
* S-1-5-80- followed by the SHA-1 of the upper-cased UTF-16LE name, read as
|
|
22
|
+
* five little-endian 32-bit values.
|
|
23
|
+
*/
|
|
24
|
+
export declare function serviceSidFor(name: string): string;
|
|
25
|
+
/** Looks up an account SID. Root's installer implements this with LookupAccountNameW. */
|
|
26
|
+
export interface SidResolver {
|
|
27
|
+
lookup(account: string): string | null;
|
|
28
|
+
}
|
|
29
|
+
export type SidResolution = {
|
|
30
|
+
ok: true;
|
|
31
|
+
serviceSid: string;
|
|
32
|
+
jobSid: string;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
detail: "SID_UNRESOLVED" | "SID_INVALID" | "SID_MISMATCH";
|
|
36
|
+
reason: string;
|
|
37
|
+
};
|
|
38
|
+
/** The service SID is computed; a resolver answer for it must agree. The job SID comes only from the resolver. */
|
|
39
|
+
export declare function resolveSids(resolver: SidResolver): SidResolution;
|
|
40
|
+
/** Access masks used in the directory SDDL. */
|
|
41
|
+
export declare const RIGHTS: {
|
|
42
|
+
/** FILE_GENERIC_READ | FILE_GENERIC_EXECUTE. */
|
|
43
|
+
readonly RX: "0x1200a9";
|
|
44
|
+
/** Read, write, execute and delete, without WRITE_DAC or WRITE_OWNER. */
|
|
45
|
+
readonly MODIFY: "0x1301bf";
|
|
46
|
+
/** FILE_TRAVERSE | SYNCHRONIZE: no list, create, delete-child or rename. */
|
|
47
|
+
readonly TRAVERSE: "0x100020";
|
|
48
|
+
};
|
|
49
|
+
export type Access = keyof typeof RIGHTS;
|
|
50
|
+
/** The same DACL on each of the three pipes: SYSTEM, Administrators and the service SID only. */
|
|
51
|
+
export declare function pipeSddl(serviceSid: string): string;
|
|
52
|
+
export interface DirectoryRule {
|
|
53
|
+
/** Relative to the pilot root; "" is the root and {run-id} is filled per run. */
|
|
54
|
+
path: string;
|
|
55
|
+
service: Access;
|
|
56
|
+
job: Access | null;
|
|
57
|
+
/** "contents" inherits to files and subdirectories (OICI); "this_only" applies to the directory alone. */
|
|
58
|
+
jobScope: "contents" | "this_only";
|
|
59
|
+
}
|
|
60
|
+
/** The proposal 039 ACL table, one row per object. */
|
|
61
|
+
export declare const DIRECTORY_RULES: readonly DirectoryRule[];
|
|
62
|
+
/**
|
|
63
|
+
* Literal SDDL for one directory. Every directory gets an explicit protected
|
|
64
|
+
* DACL owned by Administrators, with full control for SYSTEM and
|
|
65
|
+
* Administrators, so nothing above the pilot root is inherited.
|
|
66
|
+
*/
|
|
67
|
+
export declare function directorySddl(rule: DirectoryRule, serviceSid: string, jobSid: string): string;
|
|
68
|
+
/** Checked in this order; the first that does not pass names the refusal. */
|
|
69
|
+
export declare const BOUNDARY_PREDICATES: readonly ["BOUNDARY_SERVICE_UNAVAILABLE", "BOUNDARY_SERVICE_IDENTITY", "BOUNDARY_CHANNEL_IDENTITY", "BOUNDARY_JOB_IDENTITY", "BOUNDARY_PERMISSIONS", "BOUNDARY_MANIFEST", "BOUNDARY_RUN_SETUP"];
|
|
70
|
+
export type BoundaryDetail = (typeof BOUNDARY_PREDICATES)[number];
|
|
71
|
+
export interface BoundaryRun {
|
|
72
|
+
tenantId: string;
|
|
73
|
+
runId: string;
|
|
74
|
+
jobId: string;
|
|
75
|
+
}
|
|
76
|
+
export interface BoundaryResult {
|
|
77
|
+
detail: string;
|
|
78
|
+
status: "pass" | "fail";
|
|
79
|
+
observedAt: string;
|
|
80
|
+
installationId: string;
|
|
81
|
+
configDigest: string;
|
|
82
|
+
reason?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Reports the boundary for one run. Root's service binding implements this; the return value is untrusted. */
|
|
85
|
+
export interface BoundaryProbe {
|
|
86
|
+
probe(run: BoundaryRun): unknown;
|
|
87
|
+
}
|
|
88
|
+
export interface BoundaryContext {
|
|
89
|
+
now: () => Date;
|
|
90
|
+
/** A result older than this is stale. */
|
|
91
|
+
maxAgeMs: number;
|
|
92
|
+
installationId: string;
|
|
93
|
+
configDigest: string;
|
|
94
|
+
}
|
|
95
|
+
export type BoundaryVerdict = {
|
|
96
|
+
ok: true;
|
|
97
|
+
} | {
|
|
98
|
+
ok: false;
|
|
99
|
+
detail: BoundaryDetail;
|
|
100
|
+
reason: string;
|
|
101
|
+
};
|
|
102
|
+
/** Missing, unknown, stale or failed results refuse; nothing defaults to pass. */
|
|
103
|
+
export declare function evaluateBoundary(results: unknown, ctx: BoundaryContext): BoundaryVerdict;
|
|
104
|
+
export interface Attestation {
|
|
105
|
+
connectionId: string;
|
|
106
|
+
installationId: string;
|
|
107
|
+
runId: string;
|
|
108
|
+
sourceDigest: string;
|
|
109
|
+
serviceStartId: string;
|
|
110
|
+
configDigest: string;
|
|
111
|
+
}
|
|
112
|
+
export declare const ATTESTATION_FIELDS: readonly [readonly ["connectionId", "ATTESTATION_CONNECTION"], readonly ["installationId", "ATTESTATION_INSTALLATION"], readonly ["runId", "ATTESTATION_RUN"], readonly ["sourceDigest", "ATTESTATION_SOURCE"], readonly ["serviceStartId", "ATTESTATION_RESTARTED"], readonly ["configDigest", "ATTESTATION_CONFIG_CHANGED"]];
|
|
113
|
+
export type AttestationCheck = {
|
|
114
|
+
ok: true;
|
|
115
|
+
} | {
|
|
116
|
+
ok: false;
|
|
117
|
+
detail: string;
|
|
118
|
+
};
|
|
119
|
+
/** A reply counts only when it is bound to this connection, installation, run, source, service start and config. */
|
|
120
|
+
export declare function checkAttestation(reply: unknown, expected: Attestation): AttestationCheck;
|
|
121
|
+
/** Holds one attestation; a service restart or config change drops it for good. */
|
|
122
|
+
export declare class AttestationCache {
|
|
123
|
+
private entry;
|
|
124
|
+
remember(a: Attestation): void;
|
|
125
|
+
current(observed: {
|
|
126
|
+
serviceStartId: string;
|
|
127
|
+
configDigest: string;
|
|
128
|
+
}): Attestation | null;
|
|
129
|
+
}
|
|
130
|
+
/** What the client asks Windows about the pipe server. The native binding implements this. */
|
|
131
|
+
export interface PipeServerApi {
|
|
132
|
+
/** GetNamedPipeServerProcessId, then the process token user SID. */
|
|
133
|
+
serverSid(handle: number): string | null;
|
|
134
|
+
serverProcessId(handle: number): number | null;
|
|
135
|
+
/** The SCM's process ID for the service (QueryServiceStatusEx). */
|
|
136
|
+
scmServicePid(service: string): number | null;
|
|
137
|
+
/** The SCM's ImagePath for the service. */
|
|
138
|
+
serviceImagePath(service: string): string | null;
|
|
139
|
+
processImagePath(pid: number): string | null;
|
|
140
|
+
serverSessionId(handle: number): number | null;
|
|
141
|
+
}
|
|
142
|
+
/** Checked in this order before any byte is written. */
|
|
143
|
+
export declare const PIPE_AUTH_CHECKS: readonly ["PIPE_SERVER_SID", "PIPE_SCM_PROCESS", "PIPE_IMAGE_PATH", "PIPE_SESSION"];
|
|
144
|
+
export type PipeAuthDetail = (typeof PIPE_AUTH_CHECKS)[number];
|
|
145
|
+
export interface PipeExpected {
|
|
146
|
+
serviceSid: string;
|
|
147
|
+
service: string;
|
|
148
|
+
imagePath: string;
|
|
149
|
+
/** Services run in session 0. */
|
|
150
|
+
sessionId: number;
|
|
151
|
+
}
|
|
152
|
+
export type PipeAuthResult = {
|
|
153
|
+
ok: true;
|
|
154
|
+
} | {
|
|
155
|
+
ok: false;
|
|
156
|
+
detail: string;
|
|
157
|
+
reason: string;
|
|
158
|
+
};
|
|
159
|
+
export declare function authenticatePipeServer(api: PipeServerApi, handle: number, expected: PipeExpected): PipeAuthResult;
|
|
160
|
+
export interface PipeConnection {
|
|
161
|
+
readonly handle: number;
|
|
162
|
+
write(data: Uint8Array): void;
|
|
163
|
+
close(): void;
|
|
164
|
+
}
|
|
165
|
+
export interface PipeConnector {
|
|
166
|
+
connect(pipeName: string): PipeConnection;
|
|
167
|
+
}
|
|
168
|
+
export type PipeSendResult = {
|
|
169
|
+
ok: true;
|
|
170
|
+
} | {
|
|
171
|
+
ok: false;
|
|
172
|
+
detail: string;
|
|
173
|
+
reason: string;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Sends the job credential once over an authenticated pipe. After any
|
|
177
|
+
* failure, or after one send, the client refuses further sends; there is no
|
|
178
|
+
* automatic resend.
|
|
179
|
+
*/
|
|
180
|
+
export declare class PipeClient {
|
|
181
|
+
private readonly connector;
|
|
182
|
+
private readonly api;
|
|
183
|
+
private readonly expected;
|
|
184
|
+
private readonly pipeName;
|
|
185
|
+
private latched;
|
|
186
|
+
constructor(connector: PipeConnector, api: PipeServerApi, expected: PipeExpected, pipeName: string);
|
|
187
|
+
sendCredential(payload: Uint8Array): PipeSendResult;
|
|
188
|
+
}
|
|
189
|
+
/** Keys the supervisor sets itself; a job may not declare them. Compared case-insensitively. */
|
|
190
|
+
export declare const ENV_RESERVED: readonly ["USERPROFILE", "APPDATA", "LOCALAPPDATA", "TEMP", "TMP", "SYSTEMROOT", "WINDIR", "PATH", "HOME", "CODEX_HOME"];
|
|
191
|
+
export declare const PROCESS_DACL_MASKS: {
|
|
192
|
+
readonly PROCESS_QUERY_LIMITED_INFORMATION: 4096;
|
|
193
|
+
readonly SYNCHRONIZE: 1048576;
|
|
194
|
+
readonly PROCESS_TERMINATE: 1;
|
|
195
|
+
};
|
|
196
|
+
export declare const CREATION_FLAGS: {
|
|
197
|
+
readonly CREATE_SUSPENDED: 4;
|
|
198
|
+
readonly CREATE_UNICODE_ENVIRONMENT: 1024;
|
|
199
|
+
readonly EXTENDED_STARTUPINFO_PRESENT: 524288;
|
|
200
|
+
readonly CREATE_NO_WINDOW: 134217728;
|
|
201
|
+
};
|
|
202
|
+
export interface LaunchInput {
|
|
203
|
+
runId: string;
|
|
204
|
+
/** The verified pilot root. */
|
|
205
|
+
root: string;
|
|
206
|
+
/** The verified Windows directory, never read from the environment. */
|
|
207
|
+
windowsDir: string;
|
|
208
|
+
/** The verified runtime directory under the pilot root. */
|
|
209
|
+
runtimeDir: string;
|
|
210
|
+
declaredEnv: Record<string, string>;
|
|
211
|
+
stdio: {
|
|
212
|
+
stdin: number;
|
|
213
|
+
stdout: number;
|
|
214
|
+
stderr: number;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
export interface LaunchParameters {
|
|
218
|
+
lpDesktop: "";
|
|
219
|
+
cwd: string;
|
|
220
|
+
/** Sorted case-insensitively, as a Windows environment block must be. */
|
|
221
|
+
environment: Array<[string, string]>;
|
|
222
|
+
/** The only handles the job inherits (PROC_THREAD_ATTRIBUTE_HANDLE_LIST). */
|
|
223
|
+
inheritedHandles: number[];
|
|
224
|
+
/** The token default DACL entry for the service SID on processes the job creates. */
|
|
225
|
+
defaultDacl: {
|
|
226
|
+
sid: string;
|
|
227
|
+
mask: number;
|
|
228
|
+
};
|
|
229
|
+
creationFlags: number;
|
|
230
|
+
}
|
|
231
|
+
export type LaunchBuild = {
|
|
232
|
+
ok: true;
|
|
233
|
+
params: LaunchParameters;
|
|
234
|
+
} | {
|
|
235
|
+
ok: false;
|
|
236
|
+
detail: string;
|
|
237
|
+
reason: string;
|
|
238
|
+
};
|
|
239
|
+
export declare function buildLaunchParameters(input: LaunchInput, serviceSid: string): LaunchBuild;
|
|
240
|
+
export interface JobLimits {
|
|
241
|
+
memoryBytes: number;
|
|
242
|
+
maxProcesses: number;
|
|
243
|
+
cpuTimeMs: number;
|
|
244
|
+
}
|
|
245
|
+
/** The supervisor's process and Job Object calls. */
|
|
246
|
+
export interface LaunchApi {
|
|
247
|
+
createSuspended(params: LaunchParameters): {
|
|
248
|
+
process: number;
|
|
249
|
+
thread: number;
|
|
250
|
+
};
|
|
251
|
+
createJob(limits: JobLimits & {
|
|
252
|
+
killOnJobClose: true;
|
|
253
|
+
breakawayAllowed: false;
|
|
254
|
+
}): number;
|
|
255
|
+
assign(job: number, process: number): void;
|
|
256
|
+
resume(thread: number): void;
|
|
257
|
+
terminate(process: number, exitCode: number): void;
|
|
258
|
+
}
|
|
259
|
+
export type LaunchStep = "create_suspended" | "create_job" | "assign_job" | "resume" | "terminate";
|
|
260
|
+
export type LaunchSequenceResult = {
|
|
261
|
+
ok: true;
|
|
262
|
+
process: number;
|
|
263
|
+
job: number;
|
|
264
|
+
steps: LaunchStep[];
|
|
265
|
+
} | {
|
|
266
|
+
ok: false;
|
|
267
|
+
failedStep: LaunchStep | "refused";
|
|
268
|
+
reason: string;
|
|
269
|
+
steps: LaunchStep[];
|
|
270
|
+
};
|
|
271
|
+
/** Create suspended, then the Job Object with limits, then assign, then resume. Any failure after create terminates the process. */
|
|
272
|
+
export declare function launchSequence(api: LaunchApi, params: LaunchParameters, limits: JobLimits): LaunchSequenceResult;
|
|
273
|
+
/** What the supervisor reads from its process and Job Object handles. */
|
|
274
|
+
export interface HandleObservation {
|
|
275
|
+
supervisorLost: string | null;
|
|
276
|
+
cancelled: boolean;
|
|
277
|
+
jobLimit: "memory" | "processes" | "cpu" | null;
|
|
278
|
+
exitCode: number | null;
|
|
279
|
+
}
|
|
280
|
+
/** The outcome comes from handles only. Job stdio is passed in to show it is never read. */
|
|
281
|
+
export declare function outcomeFromHandles(input: {
|
|
282
|
+
handles: HandleObservation;
|
|
283
|
+
stdio?: unknown;
|
|
284
|
+
}): LaunchOutcome;
|
|
285
|
+
export interface FileIdentity {
|
|
286
|
+
volume: string;
|
|
287
|
+
fileId: string;
|
|
288
|
+
links: number;
|
|
289
|
+
reparse: boolean;
|
|
290
|
+
directory: boolean;
|
|
291
|
+
}
|
|
292
|
+
/** Handle-based filesystem calls. Only openRoot takes a path. */
|
|
293
|
+
export interface FsApi {
|
|
294
|
+
openRoot(path: string): number;
|
|
295
|
+
identity(handle: number): FileIdentity;
|
|
296
|
+
list(dir: number): string[];
|
|
297
|
+
/** Opens a child of dir by name without following a reparse point. */
|
|
298
|
+
openChild(dir: number, name: string): number;
|
|
299
|
+
remove(dir: number, name: string): void;
|
|
300
|
+
close(handle: number): void;
|
|
301
|
+
}
|
|
302
|
+
export type QuarantineReason = "ROOT_IDENTITY" | "LINK" | "HARDLINK" | "VOLUME" | "IDENTITY_CHANGED" | "NAME" | "REMOVE_FAILED" | "OPEN_FAILED";
|
|
303
|
+
export interface CleanReport {
|
|
304
|
+
removed: string[];
|
|
305
|
+
quarantined: Array<{
|
|
306
|
+
path: string;
|
|
307
|
+
reason: QuarantineReason;
|
|
308
|
+
}>;
|
|
309
|
+
}
|
|
310
|
+
/** Remove everything under the retained root handle. Anything in doubt is left in place and reported for quarantine. */
|
|
311
|
+
export declare function safeClean(fs: FsApi, rootPath: string, expectedRoot: {
|
|
312
|
+
volume: string;
|
|
313
|
+
fileId: string;
|
|
314
|
+
}): CleanReport;
|
|
315
|
+
export declare const MANIFEST_VERSION = "hqnd.boundary-manifest.v1";
|
|
316
|
+
export interface ManifestFile {
|
|
317
|
+
/** Relative to the pilot root. */
|
|
318
|
+
path: string;
|
|
319
|
+
sha256: string;
|
|
320
|
+
}
|
|
321
|
+
export interface LsaDelta {
|
|
322
|
+
sid: string;
|
|
323
|
+
right: string;
|
|
324
|
+
/** Root records whether the SID held the right before; rollback removes only rights the installer added. */
|
|
325
|
+
action: "add_if_absent_record_prior";
|
|
326
|
+
}
|
|
327
|
+
export interface BoundaryManifest {
|
|
328
|
+
schemaVersion: typeof MANIFEST_VERSION;
|
|
329
|
+
installationId: string;
|
|
330
|
+
service: string;
|
|
331
|
+
serviceIdentity: string;
|
|
332
|
+
serviceSid: string;
|
|
333
|
+
jobAccount: string;
|
|
334
|
+
jobSid: string;
|
|
335
|
+
root: string;
|
|
336
|
+
supervisor: string;
|
|
337
|
+
pipes: Array<{
|
|
338
|
+
name: string;
|
|
339
|
+
sddl: string;
|
|
340
|
+
}>;
|
|
341
|
+
directories: Array<{
|
|
342
|
+
path: string;
|
|
343
|
+
sddl: string;
|
|
344
|
+
}>;
|
|
345
|
+
lsa: LsaDelta[];
|
|
346
|
+
files: ManifestFile[];
|
|
347
|
+
}
|
|
348
|
+
/** JSON with object keys sorted at every level. */
|
|
349
|
+
export declare function canonicalJson(value: unknown): string;
|
|
350
|
+
export declare function manifestDigest(m: BoundaryManifest): string;
|
|
351
|
+
export declare function safeRelativePath(p: unknown): boolean;
|
|
352
|
+
export type ManifestParse = {
|
|
353
|
+
ok: true;
|
|
354
|
+
manifest: BoundaryManifest;
|
|
355
|
+
} | {
|
|
356
|
+
ok: false;
|
|
357
|
+
detail: "MANIFEST_PARSE" | "MANIFEST_VERSION" | "MANIFEST_SHAPE" | "MANIFEST_PATH";
|
|
358
|
+
reason: string;
|
|
359
|
+
};
|
|
360
|
+
export declare function parseManifest(raw: string): ManifestParse;
|
|
361
|
+
export type ManifestVerify = {
|
|
362
|
+
ok: true;
|
|
363
|
+
} | {
|
|
364
|
+
ok: false;
|
|
365
|
+
detail: string;
|
|
366
|
+
reason: string;
|
|
367
|
+
};
|
|
368
|
+
/** The manifest must match the independently approved digest, and every listed file must match its hash. */
|
|
369
|
+
export declare function verifyManifest(m: BoundaryManifest, approvedDigest: string, readFile: (relPath: string) => Uint8Array | null): ManifestVerify;
|
|
370
|
+
/** What the supervisor runs at start: parse, then verify. Any failure means it does not open its pipes. */
|
|
371
|
+
export declare function supervisorLoadCheck(raw: string, approvedDigest: string, readFile: (relPath: string) => Uint8Array | null): ManifestVerify;
|
|
372
|
+
export interface RollbackStep {
|
|
373
|
+
id: string;
|
|
374
|
+
description: string;
|
|
375
|
+
/** Literal commands, or empty when the installer does the step through an API. */
|
|
376
|
+
commands: string[];
|
|
377
|
+
}
|
|
378
|
+
export declare const ROLLBACK_STEPS: readonly RollbackStep[];
|
|
379
|
+
export type RollbackOrderCheck = {
|
|
380
|
+
ok: true;
|
|
381
|
+
} | {
|
|
382
|
+
ok: false;
|
|
383
|
+
detail: string;
|
|
384
|
+
reason: string;
|
|
385
|
+
};
|
|
386
|
+
/** The NF03d-2 order: stop and disable before the zero check, and a repeated zero check before any deletion. */
|
|
387
|
+
export declare function checkRollbackOrder(steps: readonly {
|
|
388
|
+
id: string;
|
|
389
|
+
}[]): RollbackOrderCheck;
|
|
390
|
+
export declare const ACCOUNT_PHASES: readonly ["installed", "idle", "admitted_session", "after_session", "rollback"];
|
|
391
|
+
export type AccountPhase = (typeof ACCOUNT_PHASES)[number];
|
|
392
|
+
/** Disabled with no session outside an admitted session; enabled with exactly one session inside one. */
|
|
393
|
+
export declare const EXPECTED_ACCOUNT_STATE: Readonly<Record<AccountPhase, {
|
|
394
|
+
enabled: boolean;
|
|
395
|
+
sessions: number;
|
|
396
|
+
}>>;
|
|
397
|
+
export type AccountStateCheck = {
|
|
398
|
+
ok: true;
|
|
399
|
+
} | {
|
|
400
|
+
ok: false;
|
|
401
|
+
detail: string;
|
|
402
|
+
};
|
|
403
|
+
export declare function checkAccountState(phase: string, observed: {
|
|
404
|
+
enabled?: unknown;
|
|
405
|
+
sessions?: unknown;
|
|
406
|
+
}): AccountStateCheck;
|
|
407
|
+
export interface PreflightCommand {
|
|
408
|
+
id: string;
|
|
409
|
+
/** One literal command; its stdout, stderr and exit code are captured on their own. */
|
|
410
|
+
command: string;
|
|
411
|
+
purpose: string;
|
|
412
|
+
/** What stdout must contain for the check to pass. */
|
|
413
|
+
expectStdoutIncludes: string;
|
|
414
|
+
}
|
|
415
|
+
export declare const GATE1_PREFLIGHT: readonly PreflightCommand[];
|
|
416
|
+
export interface PreflightCapture {
|
|
417
|
+
stdout: string;
|
|
418
|
+
stderr: string;
|
|
419
|
+
exitCode: number | null;
|
|
420
|
+
}
|
|
421
|
+
export type PreflightCheck = {
|
|
422
|
+
ok: true;
|
|
423
|
+
} | {
|
|
424
|
+
ok: false;
|
|
425
|
+
detail: string;
|
|
426
|
+
};
|
|
427
|
+
/** Each command is judged on its own capture and exit code. */
|
|
428
|
+
export declare function evaluatePreflight(captures: Record<string, unknown>): PreflightCheck;
|
|
429
|
+
export interface DryRunInput {
|
|
430
|
+
resolver: SidResolver;
|
|
431
|
+
/** The binaries the install will place, by relative path and hash. */
|
|
432
|
+
files: ManifestFile[];
|
|
433
|
+
installationId: string;
|
|
434
|
+
}
|
|
435
|
+
export interface DryRunOutput {
|
|
436
|
+
manifest: BoundaryManifest;
|
|
437
|
+
manifestDigest: string;
|
|
438
|
+
/** One line per object: kind, name and literal SDDL. */
|
|
439
|
+
sddlText: string;
|
|
440
|
+
rollback: readonly RollbackStep[];
|
|
441
|
+
preflight: readonly PreflightCommand[];
|
|
442
|
+
accountStates: typeof EXPECTED_ACCOUNT_STATE;
|
|
443
|
+
}
|
|
444
|
+
export type DryRunResult = {
|
|
445
|
+
ok: true;
|
|
446
|
+
output: DryRunOutput;
|
|
447
|
+
} | {
|
|
448
|
+
ok: false;
|
|
449
|
+
detail: string;
|
|
450
|
+
reason: string;
|
|
451
|
+
};
|
|
452
|
+
export declare function generateDryRun(input: DryRunInput): DryRunResult;
|
|
453
|
+
//# sourceMappingURL=windows-boundary.d.ts.map
|