@skrr-ai/cli 0.1.142 → 0.1.143

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 (83) hide show
  1. package/dist/base-command.d.ts +4 -2
  2. package/dist/base-command.js +46 -13
  3. package/dist/commands/agents/always-on/disable.js +9 -1
  4. package/dist/commands/agents/always-on/enable.js +9 -1
  5. package/dist/commands/agents/always-on/status.js +14 -1
  6. package/dist/commands/agents/create.js +10 -1
  7. package/dist/commands/agents/delete.d.ts +6 -0
  8. package/dist/commands/agents/delete.js +24 -0
  9. package/dist/commands/agents/intuitions/list.js +1 -1
  10. package/dist/commands/agents/spawn.d.ts +9 -0
  11. package/dist/commands/agents/spawn.js +121 -5
  12. package/dist/commands/agents/todos/cancel.js +3 -0
  13. package/dist/commands/agents/todos/edit.js +1 -1
  14. package/dist/commands/agents/triggers/policy.js +7 -0
  15. package/dist/commands/commitments/preflight.js +17 -2
  16. package/dist/commands/daemon/index.js +1 -0
  17. package/dist/commands/daemon/logs.d.ts +8 -1
  18. package/dist/commands/daemon/logs.js +32 -22
  19. package/dist/commands/daemon/profile.d.ts +15 -0
  20. package/dist/commands/daemon/profile.js +51 -0
  21. package/dist/commands/goals/briefing/status.js +1 -1
  22. package/dist/commands/machines/profiles/disconnect.d.ts +23 -0
  23. package/dist/commands/machines/profiles/disconnect.js +102 -0
  24. package/dist/commands/machines/profiles/index.d.ts +15 -0
  25. package/dist/commands/machines/profiles/index.js +33 -0
  26. package/dist/commands/machines/profiles/label.d.ts +24 -0
  27. package/dist/commands/machines/profiles/label.js +85 -0
  28. package/dist/commands/machines/profiles/list.d.ts +16 -0
  29. package/dist/commands/machines/profiles/list.js +87 -0
  30. package/dist/commands/profiles/list.js +17 -2
  31. package/dist/commands/triggers/authorization.js +1 -1
  32. package/dist/lib/agent-guides.js +1 -1
  33. package/dist/lib/agent-proactive-baseline.d.ts +6 -0
  34. package/dist/lib/agent-proactive-baseline.js +25 -2
  35. package/dist/lib/always-on-command-result.d.ts +18 -0
  36. package/dist/lib/always-on-command-result.js +52 -0
  37. package/dist/lib/always-on-runtime.d.ts +31 -0
  38. package/dist/lib/always-on-runtime.js +39 -0
  39. package/dist/lib/auth-diagnostics.d.ts +10 -1
  40. package/dist/lib/auth-diagnostics.js +16 -8
  41. package/dist/lib/compasses.js +5 -0
  42. package/dist/lib/daemon-binding.js +6 -3
  43. package/dist/lib/daemon-command-hint.d.ts +10 -5
  44. package/dist/lib/daemon-command-hint.js +11 -6
  45. package/dist/lib/daemonHandoff.js +6 -2
  46. package/dist/lib/drain-stdio.d.ts +22 -0
  47. package/dist/lib/drain-stdio.js +46 -0
  48. package/dist/lib/keychain.d.ts +22 -1
  49. package/dist/lib/keychain.js +40 -1
  50. package/dist/lib/local-daemon-readiness.js +4 -6
  51. package/dist/lib/local-skills.js +4 -1
  52. package/dist/lib/machines.d.ts +68 -0
  53. package/dist/lib/machines.js +67 -0
  54. package/dist/lib/proactiveApi.d.ts +14 -0
  55. package/dist/lib/runtime-start-verification.js +3 -6
  56. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.d.ts +12 -0
  57. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.js +10 -2
  58. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.d.ts +8 -0
  59. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +22 -0
  60. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.d.ts +133 -0
  61. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/executorStopReceiptV2.js +180 -0
  62. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +4 -2
  63. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +48 -0
  64. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.d.ts +137 -0
  65. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profilePorts.js +328 -0
  66. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.d.ts +63 -0
  67. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileSelection.js +174 -0
  68. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.d.ts +12 -0
  69. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.js +14 -0
  70. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.d.ts +8 -0
  71. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +27 -0
  72. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.d.ts +133 -0
  73. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/executorStopReceiptV2.js +183 -0
  74. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +4 -2
  75. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +10 -2
  76. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.d.ts +137 -0
  77. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profilePorts.js +333 -0
  78. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.d.ts +63 -0
  79. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileSelection.js +212 -0
  80. package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
  81. package/dist/node_modules/@skrr-ai/data-provider/index.js +7295 -7265
  82. package/oclif.manifest.json +330 -1
  83. package/package.json +1 -1
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var executorStopReceiptV2_exports = {};
20
+ __export(executorStopReceiptV2_exports, {
21
+ EXECUTOR_STOP_RECEIPT_REAP_SUPPORT: () => EXECUTOR_STOP_RECEIPT_REAP_SUPPORT,
22
+ EXECUTOR_STOP_RECEIPT_V2_DEFAULT_MAX_AGE_SECONDS: () => EXECUTOR_STOP_RECEIPT_V2_DEFAULT_MAX_AGE_SECONDS,
23
+ EXECUTOR_STOP_RECEIPT_V2_ERASURE_SCOPE: () => EXECUTOR_STOP_RECEIPT_V2_ERASURE_SCOPE,
24
+ EXECUTOR_STOP_RECEIPT_V2_TYP: () => EXECUTOR_STOP_RECEIPT_V2_TYP,
25
+ EXECUTOR_STOP_RECEIPT_WITNESS_PLATFORMS: () => EXECUTOR_STOP_RECEIPT_WITNESS_PLATFORMS,
26
+ executorStopReceiptV2Htu: () => executorStopReceiptV2Htu,
27
+ parseExecutorStopReceiptBodyV2: () => parseExecutorStopReceiptBodyV2,
28
+ signExecutorStopReceiptV2: () => signExecutorStopReceiptV2,
29
+ verifyExecutorStopReceiptV2: () => verifyExecutorStopReceiptV2
30
+ });
31
+ module.exports = __toCommonJS(executorStopReceiptV2_exports);
32
+ var import_deviceKey = require("./deviceKey.js");
33
+ var import_executorStopReceipt = require("./executorStopReceipt.js");
34
+ const EXECUTOR_STOP_RECEIPT_V2_TYP = "skrr-executor-stop-receipt-v2+jwt";
35
+ const EXECUTOR_STOP_RECEIPT_REAP_SUPPORT = ["subreaper", "kqueue", "sampling_only"];
36
+ const EXECUTOR_STOP_RECEIPT_WITNESS_PLATFORMS = ["darwin", "linux"];
37
+ const EXECUTOR_STOP_RECEIPT_V2_ERASURE_SCOPE = "session_temp";
38
+ const EXECUTOR_STOP_RECEIPT_V2_DEFAULT_MAX_AGE_SECONDS = 24 * 60 * 60;
39
+ const MAX_ID_LENGTH = 160;
40
+ const MAX_INTERVAL_MS = 6e4;
41
+ const BODY_KEYS = [
42
+ "version",
43
+ "daemonId",
44
+ "sourceId",
45
+ "sessionId",
46
+ "requestId",
47
+ "dispatchId",
48
+ "status",
49
+ "stoppedAt",
50
+ "witness",
51
+ "descendants",
52
+ "erasure"
53
+ ];
54
+ const BINDING_KEYS = ["daemonId", "sourceId", "sessionId", "requestId", "dispatchId"];
55
+ const WITNESS_KEYS = [
56
+ "kind",
57
+ "platform",
58
+ "startedBeforeSpawn",
59
+ "startedAt",
60
+ "spawnedAt",
61
+ "endedAt",
62
+ "intervalMs",
63
+ "samples",
64
+ "maxGapMs",
65
+ "reapSupport"
66
+ ];
67
+ const isPlainObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
68
+ const hasExactKeys = (value, keys) => Object.keys(value).length === keys.length && keys.every((key) => Object.hasOwn(value, key));
69
+ const isId = (value) => typeof value === "string" && value.length > 0 && value.length <= MAX_ID_LENGTH;
70
+ const isCount = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
71
+ const isInstant = (value) => typeof value === "string" && !Number.isNaN(Date.parse(value));
72
+ function executorStopReceiptV2Htu(dispatchId) {
73
+ return `https://executor-stop-receipt.skrr.invalid/v2/${encodeURIComponent(dispatchId)}`;
74
+ }
75
+ function parseWitness(value) {
76
+ if (!isPlainObject(value) || !hasExactKeys(value, WITNESS_KEYS) || value.kind !== "parent_census")
77
+ return null;
78
+ if (!EXECUTOR_STOP_RECEIPT_WITNESS_PLATFORMS.includes(value.platform))
79
+ return null;
80
+ if (typeof value.startedBeforeSpawn !== "boolean")
81
+ return null;
82
+ if (!isInstant(value.startedAt) || !isInstant(value.spawnedAt) || !isInstant(value.endedAt))
83
+ return null;
84
+ if (!isCount(value.intervalMs) || value.intervalMs < 1 || value.intervalMs > MAX_INTERVAL_MS || !isCount(value.samples) || !isCount(value.maxGapMs))
85
+ return null;
86
+ if (!EXECUTOR_STOP_RECEIPT_REAP_SUPPORT.includes(value.reapSupport))
87
+ return null;
88
+ return value;
89
+ }
90
+ function parseExecutorStopReceiptBodyV2(value) {
91
+ if (!isPlainObject(value) || !hasExactKeys(value, BODY_KEYS) || value.version !== 2)
92
+ return null;
93
+ if (!BINDING_KEYS.every((key) => isId(value[key])))
94
+ return null;
95
+ if (value.status !== "completed" && value.status !== "failed" && value.status !== "cancelled")
96
+ return null;
97
+ if (!isInstant(value.stoppedAt))
98
+ return null;
99
+ if (!parseWitness(value.witness))
100
+ return null;
101
+ const d = value.descendants;
102
+ if (!isPlainObject(d) || !hasExactKeys(d, ["observed", "stopped", "survivors", "reparented"]))
103
+ return null;
104
+ if (!isCount(d.observed) || !isCount(d.stopped) || !isCount(d.survivors) || !isCount(d.reparented))
105
+ return null;
106
+ if (d.observed !== d.stopped + d.survivors || d.reparented > d.observed)
107
+ return null;
108
+ const e = value.erasure;
109
+ if (!isPlainObject(e) || !hasExactKeys(e, ["scope", "inventory", "removed", "stillPresent", "bytes"]) || e.scope !== EXECUTOR_STOP_RECEIPT_V2_ERASURE_SCOPE)
110
+ return null;
111
+ if (!isCount(e.inventory) || !isCount(e.removed) || !isCount(e.stillPresent) || !isCount(e.bytes))
112
+ return null;
113
+ if (e.inventory !== e.removed + e.stillPresent)
114
+ return null;
115
+ return value;
116
+ }
117
+ async function signExecutorStopReceiptV2(signer, body, options = {}) {
118
+ const parsed = parseExecutorStopReceiptBodyV2(body);
119
+ if (!parsed)
120
+ throw new Error("signExecutorStopReceiptV2: body is not a v2 executor stop receipt body");
121
+ const proof = await (0, import_deviceKey.signProofWith)(signer, {
122
+ method: "POST",
123
+ url: executorStopReceiptV2Htu(parsed.dispatchId),
124
+ // `accessToken` is hashed inline into the `ath` claim: the commitment to the body.
125
+ accessToken: (0, import_executorStopReceipt.canonicalReceiptJson)(parsed),
126
+ ...options.iat !== void 0 ? { iat: options.iat } : {},
127
+ ...options.jti !== void 0 ? { jti: options.jti } : {}
128
+ }, EXECUTOR_STOP_RECEIPT_V2_TYP);
129
+ return { body: parsed, proof };
130
+ }
131
+ function verifyExecutorStopReceiptV2(receipt, options) {
132
+ if (!isPlainObject(receipt) || !hasExactKeys(receipt, ["body", "proof"])) {
133
+ return { valid: false, reason: "bad_receipt" };
134
+ }
135
+ const body = parseExecutorStopReceiptBodyV2(receipt.body);
136
+ if (!body || typeof receipt.proof !== "string")
137
+ return { valid: false, reason: "bad_receipt" };
138
+ const pin = options.pinnedPublicJwk;
139
+ if (!pin || !(0, import_deviceKey.isDevicePublicJwk)(pin))
140
+ return { valid: false, reason: "no_pin" };
141
+ const result = (0, import_deviceKey.verifyDevicePublicKeyProof)(receipt.proof, {
142
+ expectedHtm: "POST",
143
+ expectedHtu: executorStopReceiptV2Htu(body.dispatchId),
144
+ expectedAth: (0, import_deviceKey.tokenHash)((0, import_executorStopReceipt.canonicalReceiptJson)(body)),
145
+ pinnedPublicJwk: pin,
146
+ // The algorithm of the PIN, never a list: a receipt cannot pick a weaker one.
147
+ allowedAlgs: [(0, import_deviceKey.algForJwk)(pin)],
148
+ maxAgeSeconds: options.maxAgeSeconds ?? EXECUTOR_STOP_RECEIPT_V2_DEFAULT_MAX_AGE_SECONDS,
149
+ ...options.clockSkewSeconds !== void 0 ? { clockSkewSeconds: options.clockSkewSeconds } : {},
150
+ ...options.now !== void 0 ? { now: options.now } : {}
151
+ }, EXECUTOR_STOP_RECEIPT_V2_TYP);
152
+ if (!result.valid)
153
+ return { valid: false, reason: result.reason };
154
+ for (const key of BINDING_KEYS) {
155
+ const want = options.expected?.[key];
156
+ if (want !== void 0 && body[key] !== want)
157
+ return { valid: false, reason: "binding_mismatch" };
158
+ }
159
+ if (body.descendants.survivors > 0 || body.erasure.stillPresent > 0)
160
+ return { valid: false, reason: "not_quiescent" };
161
+ return {
162
+ valid: true,
163
+ body,
164
+ alg: result.alg,
165
+ thumbprint: (0, import_deviceKey.jwkThumbprint)(result.publicJwk),
166
+ signedAtSeconds: result.claims.iat
167
+ };
168
+ }
169
+ // Annotate the CommonJS export names for ESM import in node:
170
+ 0 && (module.exports = {
171
+ EXECUTOR_STOP_RECEIPT_REAP_SUPPORT,
172
+ EXECUTOR_STOP_RECEIPT_V2_DEFAULT_MAX_AGE_SECONDS,
173
+ EXECUTOR_STOP_RECEIPT_V2_ERASURE_SCOPE,
174
+ EXECUTOR_STOP_RECEIPT_V2_TYP,
175
+ EXECUTOR_STOP_RECEIPT_WITNESS_PLATFORMS,
176
+ executorStopReceiptV2Htu,
177
+ parseExecutorStopReceiptBodyV2,
178
+ signExecutorStopReceiptV2,
179
+ verifyExecutorStopReceiptV2
180
+ });
@@ -29,12 +29,13 @@ export { __setKekStrategyForTest, getKekStrategy, InMemoryKek, UnavailableKek, K
29
29
  export { ALLOW_LIVE_STATE_ENV, __setAccountHomeForTest, DAEMON_BYOK_KEYCHAIN_SERVICE_BASE, DAEMON_KEYCHAIN_SERVICE_BASE, HERMETIC_HOME_ENV, LEGACY_DAEMON_KEYCHAIN_SERVICE, LIVE_DEFAULT_PROFILE, LIVE_STATE_REFUSED_CODE, LiveStateRefusedError, accountHomeDir, assertMayMutateLiveKeychain, assertMayMutateLiveState, isLiveKeychainService, isLiveStateRefusal, isTestProcess, keychainSuffixForDir, liveKeychainServices, liveStateRoot, refusesLiveKeychainMutation, refusesLiveStateInTest, rethrowIfLiveStateRefusal, testProcessSignal, type LiveKeychainProbe, type LiveStateProbe, } from './liveState.js';
30
30
  export { algForJwk, buildProof as buildDeviceProof, DEVICE_KEY_ALGS, generateDeviceKeyPair, isDevicePublicJwk, jwkThumbprint, normalizeHtu, p256PublicJwkFromRaw, proofSigningInput, publicJwkFromX, signProofWith, tokenHash, verifyProof as verifyDeviceProof, type DeviceKeyAlg, type DeviceKeyPair, type DeviceKeySigner, type DevicePublicJwk, type DeviceProofClaims, type DeviceProofHeader, type Ed25519PrivateJwk, type Ed25519PublicJwk, type P256PublicJwk, type VerifyFailureReason as DeviceProofVerifyFailureReason, type VerifyFailure as DeviceProofVerifyFailure, type VerifyOptions as DeviceProofVerifyOptions, type VerifySuccess as DeviceProofVerifySuccess, } from './deviceKey.js';
31
31
  export { canonicalReceiptJson, EXECUTOR_STOP_RECEIPT_DEFAULT_MAX_AGE_SECONDS, EXECUTOR_STOP_RECEIPT_ERASURE_SCOPES, EXECUTOR_STOP_RECEIPT_TYP, executorStopReceiptHtu, parseExecutorStopReceiptBody, signExecutorStopReceipt, verifyExecutorStopReceipt, type ExecutorStopReceipt, type ExecutorStopReceiptBody, type ExecutorStopReceiptErasureScope, type ExecutorStopReceiptFailureReason, type ExecutorStopReceiptStatus, type SignExecutorStopReceiptOptions, type VerifyExecutorStopReceiptOptions, type VerifyExecutorStopReceiptResult, } from './executorStopReceipt.js';
32
+ export { EXECUTOR_STOP_RECEIPT_REAP_SUPPORT, EXECUTOR_STOP_RECEIPT_V2_DEFAULT_MAX_AGE_SECONDS, EXECUTOR_STOP_RECEIPT_V2_ERASURE_SCOPE, EXECUTOR_STOP_RECEIPT_V2_TYP, EXECUTOR_STOP_RECEIPT_WITNESS_PLATFORMS, executorStopReceiptV2Htu, parseExecutorStopReceiptBodyV2, signExecutorStopReceiptV2, verifyExecutorStopReceiptV2, type ExecutorStopReceiptBodyV2, type ExecutorStopReceiptReapSupport, type ExecutorStopReceiptV2, type ExecutorStopReceiptV2FailureReason, type ExecutorStopReceiptWitness, type ExecutorStopReceiptWitnessPlatform, type SignExecutorStopReceiptV2Options, type VerifyExecutorStopReceiptV2Options, type VerifyExecutorStopReceiptV2Result, } from './executorStopReceiptV2.js';
32
33
  export { softwareEd25519Handle, type DeviceKeyCustody, type DeviceKeyHandle } from './deviceKeyHandle.js';
33
34
  export { AUTH_SERVER_METADATA_PATH, readServerDeviceKeyAlgs, SERVER_DEVICE_KEY_ALGS_FIELD, } from './deviceKeyServerSupport.js';
34
35
  export { configureHardwareDeviceKeyHelper, HARDWARE_KEY_HELPER_NAME, HardwareDeviceKeyError, probeHardwareDeviceKey, resolveHardwareDeviceKeyHelper, type HardwareDeviceKeyErrorCode, type HardwareKeyCapability, } from './deviceKeyHardware.js';
35
36
  export { DPOP_HEADER, DPOP_MAX_AGE_SECONDS, DPOP_PROOF_INVALID, DPOP_PROOF_REQUIRED, DPOP_PROOF_TYP, DPOP_PROOF_VERIFY_UNAVAILABLE, accessTokenHash, createDpopKey, isAth, isJwkThumbprint, normalizeDpopHtu, verifyDpopProof, type DpopKey, type DpopProofClaims, type DpopProofRequest, type DpopVerifyFailureReason, type DpopVerifyOptions, type DpopVerifyResult, } from './dpop.js';
36
37
  export { initCredEnvelope, initExistingCredEnvelope, initNewIndependentCredEnvelope, resetCredEnvelope, shutdownCredEnvelope, isCredEnvelopeActive, hasCredEnvelopePathConflict, describeCredEnvelopeState, splitKeyConvergencePolicy, maybeEncryptForWrite, maybeDecryptOnRead, DEFAULT_UNREADABLE_CREDENTIAL_HINT, type DecryptOnReadOptions, __wrappedDekFilePathForTest, __setStateForTest as __setCredEnvelopeStateForTest, __getStateForTest as __getCredEnvelopeStateForTest, __resetShutdownGuardForTest, type ReadTransformResult, } from './credentialEnvelopeBridge.js';
37
- export { initDeviceIdentity, resetDeviceIdentity, signServerRequest, signExecutorStopReceiptWithDeviceKey, prepareHardwareKeyCandidate, commitDeviceKeyCandidate, signWithCandidate, persistPendingHardwareKey, commitPendingHardwareKey, discardPendingHardwareKey, PENDING_HARDWARE_KEY_MAX_AGE_MS, type DeviceKeyCandidate, type DeviceKeyCandidateResult, type PendingHardwareKeyOutcome, enrollWithServer, clearEnrollmentMarker, isDeviceIdentityActive, getDevicePublicKey, describeDeviceIdentityState, describeDeviceKeySplit, describeStoredDeviceKey, DEVICE_KEY_UNREADABLE_CREDENTIAL_HINT, type StoredDeviceKeyDescription, __publicKeyPathForTest, __privateKeyPathForTest, __enrollmentMarkerPathForTest, __enrollmentBackoffPathForTest, __setUnreadableReloadIntervalForTest, __setStateForTest as __setDeviceIdentityStateForTest, __getStateForTest as __getDeviceIdentityStateForTest, type EnrollmentResult, } from './deviceIdentityBridge.js';
38
+ export { initDeviceIdentity, resetDeviceIdentity, signServerRequest, signExecutorStopReceiptWithDeviceKey, signExecutorStopReceiptV2WithDeviceKey, prepareHardwareKeyCandidate, commitDeviceKeyCandidate, signWithCandidate, persistPendingHardwareKey, commitPendingHardwareKey, discardPendingHardwareKey, PENDING_HARDWARE_KEY_MAX_AGE_MS, type DeviceKeyCandidate, type DeviceKeyCandidateResult, type PendingHardwareKeyOutcome, enrollWithServer, clearEnrollmentMarker, isDeviceIdentityActive, getDevicePublicKey, describeDeviceIdentityState, describeDeviceKeySplit, describeStoredDeviceKey, DEVICE_KEY_UNREADABLE_CREDENTIAL_HINT, type StoredDeviceKeyDescription, __publicKeyPathForTest, __privateKeyPathForTest, __enrollmentMarkerPathForTest, __enrollmentBackoffPathForTest, __setUnreadableReloadIntervalForTest, __setStateForTest as __setDeviceIdentityStateForTest, __getStateForTest as __getDeviceIdentityStateForTest, type EnrollmentResult, } from './deviceIdentityBridge.js';
38
39
  export { getMachineUuid, getMachineUuidForProfile, describeMachineIdentity, type MachineIdentityDescription, type MachineIdentityReason, getHardwareMachineUuid, setMachineUuidProfile, getMachineUuidProfile, qualifyMachineUuid, MACHINE_IDENTITY_FILENAME, hostedRuntimeIdOverride, HOSTED_RUNTIME_MACHINE_SOURCES, __resetMachineUuidCacheForTest, } from './machineUuid.js';
39
40
  export { ensureMachineDaemonId, legacyDaemonUuids, __resetCachedDaemonIdForTest, } from './machineId.js';
40
41
  export { PAIR_AAD_PREFIX, PAIR_AAD_MAX_LEN, PAIR_BUNDLE_MAX_BASE64_LEN, PAIR_NONCE_LEN, PAIR_PUBKEY_LEN, PAIR_SECRET_LEN, PairBundleError, assemblePairBundleBase64, base64ToUint8Array as pairBase64ToUint8Array, base64UrlToUint8Array as pairBase64UrlToUint8Array, buildPairAad, buildPairUrl, generatePairKeyPair, openPairBundleBase64, parsePairBundle, parsePairPlaintext, parsePairUrl, uint8ArrayToBase64 as pairUint8ArrayToBase64, uint8ArrayToBase64Url as pairUint8ArrayToBase64Url, type AssembleBundleOptions as PairAssembleBundleOptions, type OpenBundleOptions as PairOpenBundleOptions, type PairBundle, type PairBundleErrorCode, type PairKeyPair, type PairPlaintextV1, type PairUrlFields, } from './daemonPair.js';
@@ -49,7 +50,8 @@ export { FIRST_PARTY_HARNESS_PREVIOUS_SUFFIX, FIRST_PARTY_HARNESS_PROVENANCE_SUF
49
50
  export { DEFAULT_FIRST_PARTY_HARNESS_CHANNEL, FIRST_PARTY_HARNESS_CHANNELS, firstPartyHarnessChannelPrefix, firstPartyHarnessFeedBase, firstPartyHarnessFeedCandidates, isFirstPartyHarnessChannel, resolveChannelManifestUrl, resolveFirstPartyHarnessChannel, type FirstPartyHarnessChannel, type FirstPartyHarnessFeedCandidate, } from './firstPartyHarnessChannels.js';
50
51
  export { OVERSKY_RELEASE_PUBLIC_KEYS, type ReleaseKey } from './releaseKeys.js';
51
52
  export { MAX_SIGS, TRUSTED_FEED_ORIGINS, buildArtifactMessage, buildManifestMessage, getDeltaFor, isTrustedArtifactOrigin, verifyArtifact, verifyManifest, type DaemonVersionManifest, type DeltaDescriptor, type ManifestSignature, type PlatformArtifact, type VerifyResult, } from './releaseManifest.js';
52
- export { resolveConfigRoot, configRootPath, isConfigRootOverridden } from './configRoot.js';
53
+ export { resolveConfigRoot, configRootPath, isConfigRootOverridden, CONFIG_ROOT_ENV_VARS, withConfigRoot, } from './configRoot.js';
54
+ export { DEFAULT_PROFILE, PROFILE_LOCK_FILENAME, PROFILE_ENV_VAR, assertValidProfileName, isValidProfileName, profileLockPath, readProfileLock, resolveProfileSelection, explicitProfileArgs, profileIsImplicit, describeProfileSelection, type ProfileSelection, type ProfileSelectionSource, type ResolveProfileSelectionInput, } from './profileSelection.js';
53
55
  export { PROFILES_SEGMENT, SUPERSEDED_MARKER_SUFFIX, SUPERSEDED_COPY_SUFFIX, profileStateDir, legacyProfileStateDir, resolveProfileStateDir, resolveProfileStateFile, profileStateFileLocations, profileStateFilePathsToClear, consolidateProfileState, type ResolvedProfileStateDir, type ConsolidationSpec, type ConsolidationStatus, type ConsolidationOutcome, } from './profileStateDir.js';
54
56
  export * from './harnessPermissionControls.js';
55
57
  export { compareReleaseVersions } from './releaseVersions.js';
@@ -26,6 +26,7 @@ __export(index_exports, {
26
26
  AuthHelperUntrustedError: () => import_credentialResolver.AuthHelperUntrustedError,
27
27
  CI_TOKEN_PREFIX: () => import_credentialResolver.CI_TOKEN_PREFIX,
28
28
  CONFIG_DIR_NAME: () => import_localIdentity.CONFIG_DIR_NAME,
29
+ CONFIG_ROOT_ENV_VARS: () => import_configRoot.CONFIG_ROOT_ENV_VARS,
29
30
  CREDENTIAL_PRECEDENCE: () => import_credentialResolver.CREDENTIAL_PRECEDENCE,
30
31
  CRED_ENVELOPE_MAGIC: () => import_credentialEnvelope.ENVELOPE_MAGIC,
31
32
  CRED_KEY_LEN: () => import_credentialEnvelope.KEY_LEN,
@@ -37,6 +38,7 @@ __export(index_exports, {
37
38
  DEFAULT_DAEMON_SCOPES: () => import_daemonScopes.DEFAULT_DAEMON_SCOPES,
38
39
  DEFAULT_FIRST_PARTY_HARNESS_CHANNEL: () => import_firstPartyHarnessChannels.DEFAULT_FIRST_PARTY_HARNESS_CHANNEL,
39
40
  DEFAULT_LOGIN_TIMEOUT_MS: () => import_loginLocalhost.DEFAULT_LOGIN_TIMEOUT_MS,
41
+ DEFAULT_PROFILE: () => import_profileSelection.DEFAULT_PROFILE,
40
42
  DEFAULT_UNREADABLE_CREDENTIAL_HINT: () => import_credentialEnvelopeBridge.DEFAULT_UNREADABLE_CREDENTIAL_HINT,
41
43
  DEVICE_KEY_ALGS: () => import_deviceKey.DEVICE_KEY_ALGS,
42
44
  DEVICE_KEY_UNREADABLE_CREDENTIAL_HINT: () => import_deviceIdentityBridge.DEVICE_KEY_UNREADABLE_CREDENTIAL_HINT,
@@ -48,7 +50,12 @@ __export(index_exports, {
48
50
  DPOP_PROOF_VERIFY_UNAVAILABLE: () => import_dpop.DPOP_PROOF_VERIFY_UNAVAILABLE,
49
51
  EXECUTOR_STOP_RECEIPT_DEFAULT_MAX_AGE_SECONDS: () => import_executorStopReceipt.EXECUTOR_STOP_RECEIPT_DEFAULT_MAX_AGE_SECONDS,
50
52
  EXECUTOR_STOP_RECEIPT_ERASURE_SCOPES: () => import_executorStopReceipt.EXECUTOR_STOP_RECEIPT_ERASURE_SCOPES,
53
+ EXECUTOR_STOP_RECEIPT_REAP_SUPPORT: () => import_executorStopReceiptV2.EXECUTOR_STOP_RECEIPT_REAP_SUPPORT,
51
54
  EXECUTOR_STOP_RECEIPT_TYP: () => import_executorStopReceipt.EXECUTOR_STOP_RECEIPT_TYP,
55
+ EXECUTOR_STOP_RECEIPT_V2_DEFAULT_MAX_AGE_SECONDS: () => import_executorStopReceiptV2.EXECUTOR_STOP_RECEIPT_V2_DEFAULT_MAX_AGE_SECONDS,
56
+ EXECUTOR_STOP_RECEIPT_V2_ERASURE_SCOPE: () => import_executorStopReceiptV2.EXECUTOR_STOP_RECEIPT_V2_ERASURE_SCOPE,
57
+ EXECUTOR_STOP_RECEIPT_V2_TYP: () => import_executorStopReceiptV2.EXECUTOR_STOP_RECEIPT_V2_TYP,
58
+ EXECUTOR_STOP_RECEIPT_WITNESS_PLATFORMS: () => import_executorStopReceiptV2.EXECUTOR_STOP_RECEIPT_WITNESS_PLATFORMS,
52
59
  EXIT_NEEDS_REAUTH: () => import_messages.EXIT_NEEDS_REAUTH,
53
60
  FIRST_PARTY_HARNESS_CHANNELS: () => import_firstPartyHarnessChannels.FIRST_PARTY_HARNESS_CHANNELS,
54
61
  FIRST_PARTY_HARNESS_PREVIOUS_SUFFIX: () => import_firstPartyHarnessHome.FIRST_PARTY_HARNESS_PREVIOUS_SUFFIX,
@@ -100,6 +107,8 @@ __export(index_exports, {
100
107
  PENDING_HARDWARE_KEY_MAX_AGE_MS: () => import_deviceIdentityBridge.PENDING_HARDWARE_KEY_MAX_AGE_MS,
101
108
  PERSONAL_ACCESS_TOKEN_PREFIX: () => import_credentialResolver.PERSONAL_ACCESS_TOKEN_PREFIX,
102
109
  PROFILES_SEGMENT: () => import_profileStateDir.PROFILES_SEGMENT,
110
+ PROFILE_ENV_VAR: () => import_profileSelection.PROFILE_ENV_VAR,
111
+ PROFILE_LOCK_FILENAME: () => import_profileSelection.PROFILE_LOCK_FILENAME,
103
112
  PairBundleError: () => import_daemonPair.PairBundleError,
104
113
  PermanentAuthFailure: () => import_types.PermanentAuthFailure,
105
114
  SCOPES: () => import_daemonScopes.SCOPES,
@@ -145,6 +154,7 @@ __export(index_exports, {
145
154
  assertLoopbackHttpUrl: () => import_loopbackHttp.assertLoopbackHttpUrl,
146
155
  assertMayMutateLiveKeychain: () => import_liveState.assertMayMutateLiveKeychain,
147
156
  assertMayMutateLiveState: () => import_liveState.assertMayMutateLiveState,
157
+ assertValidProfileName: () => import_profileSelection.assertValidProfileName,
148
158
  buildArtifactMessage: () => import_releaseManifest.buildArtifactMessage,
149
159
  buildCredentialAad: () => import_credentialEnvelope.buildCredentialAad,
150
160
  buildDeviceProof: () => import_deviceKey.buildProof,
@@ -184,6 +194,7 @@ __export(index_exports, {
184
194
  describeDeviceKeySplit: () => import_deviceIdentityBridge.describeDeviceKeySplit,
185
195
  describeLegacyState: () => import_legacyStatePreflight.describeLegacyState,
186
196
  describeMachineIdentity: () => import_machineUuid.describeMachineIdentity,
197
+ describeProfileSelection: () => import_profileSelection.describeProfileSelection,
187
198
  describeStoredDeviceKey: () => import_deviceIdentityBridge.describeStoredDeviceKey,
188
199
  discardPendingHardwareKey: () => import_deviceIdentityBridge.discardPendingHardwareKey,
189
200
  emitAuthTelemetry: () => import_runtime.emitAuthTelemetry,
@@ -191,6 +202,8 @@ __export(index_exports, {
191
202
  ensureMachineDaemonId: () => import_machineId.ensureMachineDaemonId,
192
203
  envHasProxy: () => import_spawnEnv.envHasProxy,
193
204
  executorStopReceiptHtu: () => import_executorStopReceipt.executorStopReceiptHtu,
205
+ executorStopReceiptV2Htu: () => import_executorStopReceiptV2.executorStopReceiptV2Htu,
206
+ explicitProfileArgs: () => import_profileSelection.explicitProfileArgs,
194
207
  findLegacyLocalState: () => import_legacyStatePreflight.findLegacyLocalState,
195
208
  firstPartyHarnessBinDir: () => import_firstPartyHarnessHome.firstPartyHarnessBinDir,
196
209
  firstPartyHarnessChannelPrefix: () => import_firstPartyHarnessChannels.firstPartyHarnessChannelPrefix,
@@ -252,6 +265,7 @@ __export(index_exports, {
252
265
  isTestProcess: () => import_liveState.isTestProcess,
253
266
  isTrustedArtifactOrigin: () => import_releaseManifest.isTrustedArtifactOrigin,
254
267
  isUserOwnedSecretKeychainService: () => import_kek.isUserOwnedSecretKeychainService,
268
+ isValidProfileName: () => import_profileSelection.isValidProfileName,
255
269
  isValidRecoveryCode: () => import_recoveryCode.isValidRecoveryCode,
256
270
  jwkThumbprint: () => import_deviceKey.jwkThumbprint,
257
271
  keychainSuffixForDir: () => import_liveState.keychainSuffixForDir,
@@ -276,6 +290,7 @@ __export(index_exports, {
276
290
  pairUint8ArrayToBase64: () => import_daemonPair.uint8ArrayToBase64,
277
291
  pairUint8ArrayToBase64Url: () => import_daemonPair.uint8ArrayToBase64Url,
278
292
  parseExecutorStopReceiptBody: () => import_executorStopReceipt.parseExecutorStopReceiptBody,
293
+ parseExecutorStopReceiptBodyV2: () => import_executorStopReceiptV2.parseExecutorStopReceiptBodyV2,
279
294
  parsePairBundle: () => import_daemonPair.parsePairBundle,
280
295
  parsePairPlaintext: () => import_daemonPair.parsePairPlaintext,
281
296
  parsePairUrl: () => import_daemonPair.parsePairUrl,
@@ -285,6 +300,8 @@ __export(index_exports, {
285
300
  persistReauthState: () => import_refresh.persistReauthState,
286
301
  prepareHardwareKeyCandidate: () => import_deviceIdentityBridge.prepareHardwareKeyCandidate,
287
302
  probeHardwareDeviceKey: () => import_deviceKeyHardware.probeHardwareDeviceKey,
303
+ profileIsImplicit: () => import_profileSelection.profileIsImplicit,
304
+ profileLockPath: () => import_profileSelection.profileLockPath,
288
305
  profileStateDir: () => import_profileStateDir.profileStateDir,
289
306
  profileStateFileLocations: () => import_profileStateDir.profileStateFileLocations,
290
307
  profileStateFilePathsToClear: () => import_profileStateDir.profileStateFilePathsToClear,
@@ -293,6 +310,7 @@ __export(index_exports, {
293
310
  qualifyMachineUuid: () => import_machineUuid.qualifyMachineUuid,
294
311
  readAuthFromFd: () => import_fdToken.readAuthFromFd,
295
312
  readIndependentMachineReservation: () => import_independentMachineReservation.readIndependentMachineReservation,
313
+ readProfileLock: () => import_profileSelection.readProfileLock,
296
314
  readServerDeviceKeyAlgs: () => import_deviceKeyServerSupport.readServerDeviceKeyAlgs,
297
315
  reauthCommand: () => import_messages.reauthCommand,
298
316
  refreshDaemonToken: () => import_refresh.refreshDaemonToken,
@@ -306,6 +324,7 @@ __export(index_exports, {
306
324
  resolveConfigRoot: () => import_configRoot.resolveConfigRoot,
307
325
  resolveFirstPartyHarnessChannel: () => import_firstPartyHarnessChannels.resolveFirstPartyHarnessChannel,
308
326
  resolveHardwareDeviceKeyHelper: () => import_deviceKeyHardware.resolveHardwareDeviceKeyHelper,
327
+ resolveProfileSelection: () => import_profileSelection.resolveProfileSelection,
309
328
  resolveProfileStateDir: () => import_profileStateDir.resolveProfileStateDir,
310
329
  resolveProfileStateFile: () => import_profileStateDir.resolveProfileStateFile,
311
330
  rethrowIfLiveStateRefusal: () => import_liveState.rethrowIfLiveStateRefusal,
@@ -316,6 +335,8 @@ __export(index_exports, {
316
335
  setMachineUuidProfile: () => import_machineUuid.setMachineUuidProfile,
317
336
  shutdownCredEnvelope: () => import_credentialEnvelopeBridge.shutdownCredEnvelope,
318
337
  signExecutorStopReceipt: () => import_executorStopReceipt.signExecutorStopReceipt,
338
+ signExecutorStopReceiptV2: () => import_executorStopReceiptV2.signExecutorStopReceiptV2,
339
+ signExecutorStopReceiptV2WithDeviceKey: () => import_deviceIdentityBridge.signExecutorStopReceiptV2WithDeviceKey,
319
340
  signExecutorStopReceiptWithDeviceKey: () => import_deviceIdentityBridge.signExecutorStopReceiptWithDeviceKey,
320
341
  signProofWith: () => import_deviceKey.signProofWith,
321
342
  signServerRequest: () => import_deviceIdentityBridge.signServerRequest,
@@ -331,9 +352,11 @@ __export(index_exports, {
331
352
  verifyDeviceProof: () => import_deviceKey.verifyProof,
332
353
  verifyDpopProof: () => import_dpop.verifyDpopProof,
333
354
  verifyExecutorStopReceipt: () => import_executorStopReceipt.verifyExecutorStopReceipt,
355
+ verifyExecutorStopReceiptV2: () => import_executorStopReceiptV2.verifyExecutorStopReceiptV2,
334
356
  verifyIndependentMachineReservation: () => import_independentMachineReservation.verifyIndependentMachineReservation,
335
357
  verifyManifest: () => import_releaseManifest.verifyManifest,
336
358
  withAuthLock: () => import_refresh.withAuthLock,
359
+ withConfigRoot: () => import_configRoot.withConfigRoot,
337
360
  withLoopbackNoProxy: () => import_spawnEnv.withLoopbackNoProxy,
338
361
  zeroizeKekCaches: () => import_kek.zeroizeKekCaches
339
362
  });
@@ -361,6 +384,7 @@ var import_kek = require("./kek/index.js");
361
384
  var import_liveState = require("./liveState.js");
362
385
  var import_deviceKey = require("./deviceKey.js");
363
386
  var import_executorStopReceipt = require("./executorStopReceipt.js");
387
+ var import_executorStopReceiptV2 = require("./executorStopReceiptV2.js");
364
388
  var import_deviceKeyHandle = require("./deviceKeyHandle.js");
365
389
  var import_deviceKeyServerSupport = require("./deviceKeyServerSupport.js");
366
390
  var import_deviceKeyHardware = require("./deviceKeyHardware.js");
@@ -382,6 +406,7 @@ var import_firstPartyHarnessChannels = require("./firstPartyHarnessChannels.js")
382
406
  var import_releaseKeys = require("./releaseKeys.js");
383
407
  var import_releaseManifest = require("./releaseManifest.js");
384
408
  var import_configRoot = require("./configRoot.js");
409
+ var import_profileSelection = require("./profileSelection.js");
385
410
  var import_profileStateDir = require("./profileStateDir.js");
386
411
  __reExport(index_exports, require("./harnessPermissionControls.js"), module.exports);
387
412
  var import_releaseVersions = require("./releaseVersions.js");
@@ -397,6 +422,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
397
422
  AuthHelperUntrustedError,
398
423
  CI_TOKEN_PREFIX,
399
424
  CONFIG_DIR_NAME,
425
+ CONFIG_ROOT_ENV_VARS,
400
426
  CREDENTIAL_PRECEDENCE,
401
427
  CRED_ENVELOPE_MAGIC,
402
428
  CRED_KEY_LEN,
@@ -408,6 +434,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
408
434
  DEFAULT_DAEMON_SCOPES,
409
435
  DEFAULT_FIRST_PARTY_HARNESS_CHANNEL,
410
436
  DEFAULT_LOGIN_TIMEOUT_MS,
437
+ DEFAULT_PROFILE,
411
438
  DEFAULT_UNREADABLE_CREDENTIAL_HINT,
412
439
  DEVICE_KEY_ALGS,
413
440
  DEVICE_KEY_UNREADABLE_CREDENTIAL_HINT,
@@ -419,7 +446,12 @@ var import_independentMachineReservation = require("./independentMachineReservat
419
446
  DPOP_PROOF_VERIFY_UNAVAILABLE,
420
447
  EXECUTOR_STOP_RECEIPT_DEFAULT_MAX_AGE_SECONDS,
421
448
  EXECUTOR_STOP_RECEIPT_ERASURE_SCOPES,
449
+ EXECUTOR_STOP_RECEIPT_REAP_SUPPORT,
422
450
  EXECUTOR_STOP_RECEIPT_TYP,
451
+ EXECUTOR_STOP_RECEIPT_V2_DEFAULT_MAX_AGE_SECONDS,
452
+ EXECUTOR_STOP_RECEIPT_V2_ERASURE_SCOPE,
453
+ EXECUTOR_STOP_RECEIPT_V2_TYP,
454
+ EXECUTOR_STOP_RECEIPT_WITNESS_PLATFORMS,
423
455
  EXIT_NEEDS_REAUTH,
424
456
  FIRST_PARTY_HARNESS_CHANNELS,
425
457
  FIRST_PARTY_HARNESS_PREVIOUS_SUFFIX,
@@ -471,6 +503,8 @@ var import_independentMachineReservation = require("./independentMachineReservat
471
503
  PENDING_HARDWARE_KEY_MAX_AGE_MS,
472
504
  PERSONAL_ACCESS_TOKEN_PREFIX,
473
505
  PROFILES_SEGMENT,
506
+ PROFILE_ENV_VAR,
507
+ PROFILE_LOCK_FILENAME,
474
508
  PairBundleError,
475
509
  PermanentAuthFailure,
476
510
  SCOPES,
@@ -516,6 +550,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
516
550
  assertLoopbackHttpUrl,
517
551
  assertMayMutateLiveKeychain,
518
552
  assertMayMutateLiveState,
553
+ assertValidProfileName,
519
554
  buildArtifactMessage,
520
555
  buildCredentialAad,
521
556
  buildDeviceProof,
@@ -555,6 +590,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
555
590
  describeDeviceKeySplit,
556
591
  describeLegacyState,
557
592
  describeMachineIdentity,
593
+ describeProfileSelection,
558
594
  describeStoredDeviceKey,
559
595
  discardPendingHardwareKey,
560
596
  emitAuthTelemetry,
@@ -562,6 +598,8 @@ var import_independentMachineReservation = require("./independentMachineReservat
562
598
  ensureMachineDaemonId,
563
599
  envHasProxy,
564
600
  executorStopReceiptHtu,
601
+ executorStopReceiptV2Htu,
602
+ explicitProfileArgs,
565
603
  findLegacyLocalState,
566
604
  firstPartyHarnessBinDir,
567
605
  firstPartyHarnessChannelPrefix,
@@ -623,6 +661,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
623
661
  isTestProcess,
624
662
  isTrustedArtifactOrigin,
625
663
  isUserOwnedSecretKeychainService,
664
+ isValidProfileName,
626
665
  isValidRecoveryCode,
627
666
  jwkThumbprint,
628
667
  keychainSuffixForDir,
@@ -647,6 +686,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
647
686
  pairUint8ArrayToBase64,
648
687
  pairUint8ArrayToBase64Url,
649
688
  parseExecutorStopReceiptBody,
689
+ parseExecutorStopReceiptBodyV2,
650
690
  parsePairBundle,
651
691
  parsePairPlaintext,
652
692
  parsePairUrl,
@@ -656,6 +696,8 @@ var import_independentMachineReservation = require("./independentMachineReservat
656
696
  persistReauthState,
657
697
  prepareHardwareKeyCandidate,
658
698
  probeHardwareDeviceKey,
699
+ profileIsImplicit,
700
+ profileLockPath,
659
701
  profileStateDir,
660
702
  profileStateFileLocations,
661
703
  profileStateFilePathsToClear,
@@ -664,6 +706,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
664
706
  qualifyMachineUuid,
665
707
  readAuthFromFd,
666
708
  readIndependentMachineReservation,
709
+ readProfileLock,
667
710
  readServerDeviceKeyAlgs,
668
711
  reauthCommand,
669
712
  refreshDaemonToken,
@@ -677,6 +720,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
677
720
  resolveConfigRoot,
678
721
  resolveFirstPartyHarnessChannel,
679
722
  resolveHardwareDeviceKeyHelper,
723
+ resolveProfileSelection,
680
724
  resolveProfileStateDir,
681
725
  resolveProfileStateFile,
682
726
  rethrowIfLiveStateRefusal,
@@ -687,6 +731,8 @@ var import_independentMachineReservation = require("./independentMachineReservat
687
731
  setMachineUuidProfile,
688
732
  shutdownCredEnvelope,
689
733
  signExecutorStopReceipt,
734
+ signExecutorStopReceiptV2,
735
+ signExecutorStopReceiptV2WithDeviceKey,
690
736
  signExecutorStopReceiptWithDeviceKey,
691
737
  signProofWith,
692
738
  signServerRequest,
@@ -702,9 +748,11 @@ var import_independentMachineReservation = require("./independentMachineReservat
702
748
  verifyDeviceProof,
703
749
  verifyDpopProof,
704
750
  verifyExecutorStopReceipt,
751
+ verifyExecutorStopReceiptV2,
705
752
  verifyIndependentMachineReservation,
706
753
  verifyManifest,
707
754
  withAuthLock,
755
+ withConfigRoot,
708
756
  withLoopbackNoProxy,
709
757
  zeroizeKekCaches,
710
758
  ...require("./firstPartyHarness.js"),
@@ -0,0 +1,137 @@
1
+ export declare const HEALTH_BASE_PORT = 19580;
2
+ export declare const BROWSER_RELAY_BASE_PORT = 18792;
3
+ /** Each kind owns `[base, base + PROFILE_PORT_RANGE)`. */
4
+ export declare const PROFILE_PORT_RANGE = 100;
5
+ export declare const PORT_ALLOCATIONS_FILENAME = "port-allocations.json";
6
+ export declare const PORT_ALLOCATIONS_VERSION = 1;
7
+ /** The kill switch: legacy fixed defaults, no allocation. */
8
+ export declare const STATIC_DEFAULT_PORTS_ENV = "OVERSKY_STATIC_DEFAULT_PORTS";
9
+ export declare const DEFAULT_PORT_PROFILE = "default";
10
+ export declare const PROFILE_PORT_KINDS: readonly ["health", "relay"];
11
+ export type ProfilePortKind = (typeof PROFILE_PORT_KINDS)[number];
12
+ /** Where a profile's port came from. */
13
+ export type ProfilePortSource = 'explicit' | 'allocated' | 'derived' | 'static';
14
+ /**
15
+ * Why an allocation is not the profile's derived port. Recorded when the
16
+ * allocation is made, because the condition (another process holding a port)
17
+ * may be gone by the time anyone reads it.
18
+ */
19
+ export type ProfilePortMoveReason =
20
+ /** The derived port is the `default` profile's, which has priority on it. */
21
+ 'default_priority'
22
+ /** Another profile's record or explicit port holds it. */
23
+ | 'held_by_profile'
24
+ /** A bind probe found something listening there. */
25
+ | 'in_use'
26
+ /** Every slot in the range was taken; the derived port was kept anyway. */
27
+ | 'range_exhausted';
28
+ export interface ProfilePortMove {
29
+ /** The derived port the allocation moved away from. */
30
+ from: number;
31
+ reason: ProfilePortMoveReason;
32
+ /** The profile holding `from`, when `reason` names one. */
33
+ profile?: string;
34
+ at?: string;
35
+ }
36
+ export interface ProfilePortAllocation {
37
+ health?: number;
38
+ relay?: number;
39
+ /** Present only for a kind whose port is not the derived one. */
40
+ moves?: Partial<Record<ProfilePortKind, ProfilePortMove>>;
41
+ updatedAt?: string;
42
+ }
43
+ export interface PortAllocationRecord {
44
+ version: typeof PORT_ALLOCATIONS_VERSION;
45
+ profiles: Record<string, ProfilePortAllocation>;
46
+ }
47
+ export interface ResolvedProfilePort {
48
+ kind: ProfilePortKind;
49
+ port: number;
50
+ source: ProfilePortSource;
51
+ /** What the hash alone would give; shown so a reader can see a move. */
52
+ derived: number;
53
+ /** Set when an allocation moved off `derived`. */
54
+ move?: ProfilePortMove;
55
+ }
56
+ export interface ResolvedProfilePorts {
57
+ profile: string;
58
+ health: ResolvedProfilePort;
59
+ relay: ResolvedProfilePort;
60
+ }
61
+ export declare function profilePortBase(kind: ProfilePortKind): number;
62
+ /** FNV-1a 32-bit over a string's UTF-16 code units. Pure. */
63
+ export declare function fnv1a32(str: string): number;
64
+ export declare function staticDefaultPortsEnabled(env?: NodeJS.ProcessEnv): boolean;
65
+ /**
66
+ * `base + fnv1a32(profile) % 100`, or `base` under the kill switch. The legacy
67
+ * default and the starting point of every allocation; never, on its own, an
68
+ * answer to "which port does this profile listen on".
69
+ */
70
+ export declare function profileDerivedPort(basePort: number, profile: string, env?: NodeJS.ProcessEnv): number;
71
+ export declare function derivedProfilePort(kind: ProfilePortKind, profile: string, env?: NodeJS.ProcessEnv): number;
72
+ export declare function isInProfilePortRange(kind: ProfilePortKind, port: unknown): port is number;
73
+ export declare function portAllocationsPath(root: string): string;
74
+ export declare function emptyPortAllocations(): PortAllocationRecord;
75
+ /**
76
+ * Tolerant parse: an entry that is not a port in its kind's range is dropped,
77
+ * so a hand-edited or truncated record degrades to "derived" for that profile
78
+ * rather than handing a reader a port the allocator would never have chosen.
79
+ */
80
+ export declare function parsePortAllocations(raw: unknown): PortAllocationRecord;
81
+ /** The record under `root`, or an empty one when it is absent or unreadable. */
82
+ export declare function readPortAllocations(root: string): PortAllocationRecord;
83
+ /**
84
+ * A `daemon.json` port that is a real choice, or null. Absent, unparsable and
85
+ * equal-to-derived all read as "no choice" (see the header for why the last).
86
+ * `0` is a choice (an ephemeral bind) and is returned as 0.
87
+ */
88
+ export declare function explicitProfilePort(kind: ProfilePortKind, configured: unknown, profile: string, env?: NodeJS.ProcessEnv): number | null;
89
+ export interface DaemonJsonPortValues {
90
+ health: unknown;
91
+ relay: unknown;
92
+ }
93
+ export declare function profileDaemonJsonPath(root: string, profile: string): string;
94
+ /** The raw port values in a profile's `daemon.json`; both undefined when unreadable. */
95
+ export declare function readDaemonJsonPortValues(root: string, profile: string): DaemonJsonPortValues;
96
+ /** One port, from inputs the caller already holds. */
97
+ export declare function resolveProfilePort(input: {
98
+ kind: ProfilePortKind;
99
+ profile: string;
100
+ configured: unknown;
101
+ allocations: PortAllocationRecord;
102
+ env?: NodeJS.ProcessEnv;
103
+ }): ResolvedProfilePort;
104
+ /**
105
+ * Both ports of `profile` under `root`. Pass `configured` when the caller has
106
+ * already parsed the profile's `daemon.json` (the daemon's `loadConfig` does),
107
+ * so the file is not read twice and the two cannot disagree.
108
+ */
109
+ export declare function resolveProfilePorts(root: string, profile: string, options?: {
110
+ env?: NodeJS.ProcessEnv;
111
+ configured?: DaemonJsonPortValues;
112
+ allocations?: PortAllocationRecord;
113
+ }): ResolvedProfilePorts;
114
+ /** The profile directories under `root/profiles`. */
115
+ export declare function listProfileNames(root: string): string[];
116
+ /** Who else claims a port, and how. */
117
+ export interface ProfilePortClaim {
118
+ profile: string;
119
+ how: 'explicit' | 'allocated' | 'default_priority';
120
+ }
121
+ /**
122
+ * Every OTHER profile's claim on each port of `kind`: its explicit port, else
123
+ * its recorded allocation, plus the `default` profile's derived port, which is
124
+ * reserved for it even before it has a record. This is the set an allocation
125
+ * must avoid, and what a reader shows when a derived port is shared.
126
+ */
127
+ export declare function otherProfilePortClaims(root: string, kind: ProfilePortKind, profile: string, options?: {
128
+ env?: NodeJS.ProcessEnv;
129
+ allocations?: PortAllocationRecord;
130
+ }): Map<number, ProfilePortClaim>;
131
+ /**
132
+ * One sentence: which port, from where, and — when it is not the derived one or
133
+ * might be shared — why. `sharedWith` is a claim another profile holds on this
134
+ * port (from `otherProfilePortClaims`); pass it for a `derived` port, which is
135
+ * the one case where a reader can see a collision the daemon has not resolved.
136
+ */
137
+ export declare function describeProfilePort(resolved: ResolvedProfilePort, sharedWith?: ProfilePortClaim | null): string;