@skrr-ai/cli 0.1.123 → 0.1.125

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 (89) hide show
  1. package/dist/commands/agents/chat.d.ts +26 -0
  2. package/dist/commands/agents/chat.js +48 -10
  3. package/dist/commands/agents/delete.d.ts +8 -0
  4. package/dist/commands/agents/delete.js +16 -0
  5. package/dist/commands/context.js +7 -0
  6. package/dist/commands/search/workspace.js +1 -1
  7. package/dist/commands/store/gallery-admissions/approve.js +1 -1
  8. package/dist/commands/store/gallery-admissions/preview.js +1 -1
  9. package/dist/commands/store/gallery-admissions/refuse.js +1 -1
  10. package/dist/commands/store/gallery-admissions/show.js +1 -1
  11. package/dist/generated/agent-guides.json +19 -19
  12. package/dist/lib/agentic-stream.js +15 -1
  13. package/dist/lib/auth-core-init.d.ts +15 -2
  14. package/dist/lib/auth-core-init.js +47 -6
  15. package/dist/lib/command-hygiene.js +30 -1
  16. package/dist/lib/daemonBrokerRefusal.js +5 -1
  17. package/dist/lib/keychain.js +41 -4
  18. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/cliHandoffWire.d.ts +5 -1
  19. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/cliHandoffWire.js +1 -1
  20. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +13 -28
  21. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.d.ts +133 -4
  22. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +387 -90
  23. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.d.ts +106 -7
  24. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.js +77 -19
  25. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKeyHandle.d.ts +33 -0
  26. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKeyHandle.js +77 -0
  27. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKeyHardware.d.ts +68 -0
  28. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKeyHardware.js +264 -0
  29. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKeyServerSupport.d.ts +31 -0
  30. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKeyServerSupport.js +90 -0
  31. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dpop.js +2 -0
  32. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +2 -0
  33. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +7 -3
  34. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +102 -0
  35. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/index.d.ts +1 -1
  36. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/index.js +6 -0
  37. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/linux.d.ts +18 -0
  38. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/linux.js +8 -0
  39. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.d.ts +22 -0
  40. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +11 -0
  41. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/masterKekService.d.ts +43 -3
  42. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/masterKekService.js +33 -3
  43. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.d.ts +154 -0
  44. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.js +281 -0
  45. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineId.js +6 -3
  46. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +8 -5
  47. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileStateDir.js +7 -27
  48. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.d.ts +1 -1
  49. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +12 -10
  50. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/stateFiles.d.ts +31 -0
  51. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/stateFiles.js +89 -0
  52. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/cliHandoffWire.d.ts +5 -1
  53. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/cliHandoffWire.js +4 -1
  54. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +15 -37
  55. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.d.ts +133 -4
  56. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +536 -101
  57. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.d.ts +106 -7
  58. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.js +131 -27
  59. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKeyHandle.d.ts +33 -0
  60. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKeyHandle.js +81 -0
  61. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKeyHardware.d.ts +68 -0
  62. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKeyHardware.js +317 -0
  63. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKeyServerSupport.d.ts +31 -0
  64. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKeyServerSupport.js +86 -0
  65. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dpop.js +4 -0
  66. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +4 -0
  67. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +7 -3
  68. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +13 -3
  69. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/index.d.ts +1 -1
  70. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/index.js +1 -1
  71. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/linux.d.ts +18 -0
  72. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/linux.js +15 -0
  73. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.d.ts +22 -0
  74. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +20 -0
  75. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/masterKekService.d.ts +43 -3
  76. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/masterKekService.js +104 -8
  77. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.d.ts +154 -0
  78. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.js +386 -0
  79. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineId.js +6 -3
  80. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +11 -5
  81. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileStateDir.js +6 -35
  82. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.d.ts +1 -1
  83. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +14 -10
  84. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/stateFiles.d.ts +31 -0
  85. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/stateFiles.js +73 -0
  86. package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
  87. package/dist/node_modules/@skrr-ai/data-provider/index.js +1094 -1067
  88. package/oclif.manifest.json +16 -3
  89. package/package.json +4 -1
@@ -19,7 +19,9 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
  var index_exports = {};
21
21
  __export(index_exports, {
22
+ ALLOW_LIVE_STATE_ENV: () => import_liveState.ALLOW_LIVE_STATE_ENV,
22
23
  ALL_DAEMON_SCOPES: () => import_daemonScopes.ALL_DAEMON_SCOPES,
24
+ AUTH_SERVER_METADATA_PATH: () => import_deviceKeyServerSupport.AUTH_SERVER_METADATA_PATH,
23
25
  AuthHelperUnavailableError: () => import_credentialResolver.AuthHelperUnavailableError,
24
26
  AuthHelperUntrustedError: () => import_credentialResolver.AuthHelperUntrustedError,
25
27
  CI_TOKEN_PREFIX: () => import_credentialResolver.CI_TOKEN_PREFIX,
@@ -28,12 +30,16 @@ __export(index_exports, {
28
30
  CRED_ENVELOPE_MAGIC: () => import_credentialEnvelope.ENVELOPE_MAGIC,
29
31
  CRED_KEY_LEN: () => import_credentialEnvelope.KEY_LEN,
30
32
  CredentialResolver: () => import_credentialResolver.CredentialResolver,
33
+ DAEMON_BYOK_KEYCHAIN_SERVICE_BASE: () => import_liveState.DAEMON_BYOK_KEYCHAIN_SERVICE_BASE,
31
34
  DAEMON_CHILD_ENV: () => import_spawnEnv.DAEMON_CHILD_ENV,
35
+ DAEMON_KEYCHAIN_SERVICE_BASE: () => import_liveState.DAEMON_KEYCHAIN_SERVICE_BASE,
32
36
  DEFAULT_BINARY_NAME: () => import_localIdentity.DEFAULT_BINARY_NAME,
33
37
  DEFAULT_DAEMON_SCOPES: () => import_daemonScopes.DEFAULT_DAEMON_SCOPES,
34
38
  DEFAULT_FIRST_PARTY_HARNESS_CHANNEL: () => import_firstPartyHarnessChannels.DEFAULT_FIRST_PARTY_HARNESS_CHANNEL,
35
39
  DEFAULT_LOGIN_TIMEOUT_MS: () => import_loginLocalhost.DEFAULT_LOGIN_TIMEOUT_MS,
36
40
  DEFAULT_UNREADABLE_CREDENTIAL_HINT: () => import_credentialEnvelopeBridge.DEFAULT_UNREADABLE_CREDENTIAL_HINT,
41
+ DEVICE_KEY_ALGS: () => import_deviceKey.DEVICE_KEY_ALGS,
42
+ DEVICE_KEY_UNREADABLE_CREDENTIAL_HINT: () => import_deviceIdentityBridge.DEVICE_KEY_UNREADABLE_CREDENTIAL_HINT,
37
43
  DPOP_HEADER: () => import_dpop.DPOP_HEADER,
38
44
  DPOP_MAX_AGE_SECONDS: () => import_dpop.DPOP_MAX_AGE_SECONDS,
39
45
  DPOP_PROOF_INVALID: () => import_dpop.DPOP_PROOF_INVALID,
@@ -44,18 +50,25 @@ __export(index_exports, {
44
50
  FIRST_PARTY_HARNESS_CHANNELS: () => import_firstPartyHarnessChannels.FIRST_PARTY_HARNESS_CHANNELS,
45
51
  FIRST_PARTY_HARNESS_PREVIOUS_SUFFIX: () => import_firstPartyHarnessHome.FIRST_PARTY_HARNESS_PREVIOUS_SUFFIX,
46
52
  FIRST_PARTY_HARNESS_PROVENANCE_SUFFIX: () => import_firstPartyHarnessHome.FIRST_PARTY_HARNESS_PROVENANCE_SUFFIX,
53
+ HARDWARE_KEY_HELPER_NAME: () => import_deviceKeyHardware.HARDWARE_KEY_HELPER_NAME,
47
54
  HARNESSES_LOADING_CLAUDE_SKILLS_LAYOUT: () => import_harnessSkillLayout.HARNESSES_LOADING_CLAUDE_SKILLS_LAYOUT,
48
55
  HARNESS_TIERS: () => import_harnessTrust.HARNESS_TIERS,
56
+ HERMETIC_HOME_ENV: () => import_liveState.HERMETIC_HOME_ENV,
49
57
  HOSTED_RUNTIME_MACHINE_SOURCES: () => import_machineUuid.HOSTED_RUNTIME_MACHINE_SOURCES,
58
+ HardwareDeviceKeyError: () => import_deviceKeyHardware.HardwareDeviceKeyError,
50
59
  INDEPENDENT_MACHINE_PROFILE_RE: () => import_independentMachineReservation.INDEPENDENT_MACHINE_PROFILE_RE,
51
60
  INDEPENDENT_MACHINE_RESERVATION_FILE: () => import_independentMachineReservation.INDEPENDENT_MACHINE_RESERVATION_FILE,
52
61
  InMemoryKek: () => import_kek.InMemoryKek,
53
62
  KekUnavailableError: () => import_kek.KekUnavailableError,
54
63
  LEGACY_CONFIG_DIR_NAMES: () => import_localIdentity.LEGACY_CONFIG_DIR_NAMES,
64
+ LEGACY_DAEMON_KEYCHAIN_SERVICE: () => import_liveState.LEGACY_DAEMON_KEYCHAIN_SERVICE,
55
65
  LEGACY_NATIVE_ID_PREFIXES: () => import_localIdentity.LEGACY_NATIVE_ID_PREFIXES,
66
+ LIVE_DEFAULT_PROFILE: () => import_liveState.LIVE_DEFAULT_PROFILE,
67
+ LIVE_STATE_REFUSED_CODE: () => import_liveState.LIVE_STATE_REFUSED_CODE,
56
68
  LOOPBACK_DEFAULT_MAX_BODY_BYTES: () => import_loopbackHttp.LOOPBACK_DEFAULT_MAX_BODY_BYTES,
57
69
  LOOPBACK_NO_PROXY_HOSTS: () => import_spawnEnv.LOOPBACK_NO_PROXY_HOSTS,
58
70
  LinuxKek: () => import_kek.LinuxKek,
71
+ LiveStateRefusedError: () => import_liveState.LiveStateRefusedError,
59
72
  LocalCallbackBindError: () => import_loginLocalhost.LocalCallbackBindError,
60
73
  LocalCallbackDeniedError: () => import_loginLocalhost.LocalCallbackDeniedError,
61
74
  LocalCallbackError: () => import_loginLocalhost.LocalCallbackError,
@@ -81,6 +94,7 @@ __export(index_exports, {
81
94
  PAIR_NONCE_LEN: () => import_daemonPair.PAIR_NONCE_LEN,
82
95
  PAIR_PUBKEY_LEN: () => import_daemonPair.PAIR_PUBKEY_LEN,
83
96
  PAIR_SECRET_LEN: () => import_daemonPair.PAIR_SECRET_LEN,
97
+ PENDING_HARDWARE_KEY_MAX_AGE_MS: () => import_deviceIdentityBridge.PENDING_HARDWARE_KEY_MAX_AGE_MS,
84
98
  PERSONAL_ACCESS_TOKEN_PREFIX: () => import_credentialResolver.PERSONAL_ACCESS_TOKEN_PREFIX,
85
99
  PROFILES_SEGMENT: () => import_profileStateDir.PROFILES_SEGMENT,
86
100
  PairBundleError: () => import_daemonPair.PairBundleError,
@@ -92,6 +106,7 @@ __export(index_exports, {
92
106
  SENSITIVE_ENV_SUFFIXES: () => import_spawnEnv.SENSITIVE_ENV_SUFFIXES,
93
107
  SENSITIVE_ENV_VARS: () => import_spawnEnv.SENSITIVE_ENV_VARS,
94
108
  SENTINEL_TRIGGERING_FAILURES: () => import_authHelper.SENTINEL_TRIGGERING_FAILURES,
109
+ SERVER_DEVICE_KEY_ALGS_FIELD: () => import_deviceKeyServerSupport.SERVER_DEVICE_KEY_ALGS_FIELD,
95
110
  SUPERSEDED_COPY_SUFFIX: () => import_profileStateDir.SUPERSEDED_COPY_SUFFIX,
96
111
  SUPERSEDED_MARKER_SUFFIX: () => import_profileStateDir.SUPERSEDED_MARKER_SUFFIX,
97
112
  TRUSTED_FEED_ORIGINS: () => import_releaseManifest.TRUSTED_FEED_ORIGINS,
@@ -113,6 +128,7 @@ __export(index_exports, {
113
128
  __resetMachineUuidCacheForTest: () => import_machineUuid.__resetMachineUuidCacheForTest,
114
129
  __resetShutdownGuardForTest: () => import_credentialEnvelopeBridge.__resetShutdownGuardForTest,
115
130
  __resetUnknown401StreaksForTest: () => import_refresh.__resetUnknown401StreaksForTest,
131
+ __setAccountHomeForTest: () => import_liveState.__setAccountHomeForTest,
116
132
  __setCredEnvelopeStateForTest: () => import_credentialEnvelopeBridge.__setStateForTest,
117
133
  __setDeviceIdentityStateForTest: () => import_deviceIdentityBridge.__setStateForTest,
118
134
  __setFdReaderForTest: () => import_fdToken.__setFdReaderForTest,
@@ -120,8 +136,12 @@ __export(index_exports, {
120
136
  __setUnreadableReloadIntervalForTest: () => import_deviceIdentityBridge.__setUnreadableReloadIntervalForTest,
121
137
  __wrappedDekFilePathForTest: () => import_credentialEnvelopeBridge.__wrappedDekFilePathForTest,
122
138
  accessTokenHash: () => import_dpop.accessTokenHash,
139
+ accountHomeDir: () => import_liveState.accountHomeDir,
140
+ algForJwk: () => import_deviceKey.algForJwk,
123
141
  assemblePairBundleBase64: () => import_daemonPair.assemblePairBundleBase64,
124
142
  assertLoopbackHttpUrl: () => import_loopbackHttp.assertLoopbackHttpUrl,
143
+ assertMayMutateLiveKeychain: () => import_liveState.assertMayMutateLiveKeychain,
144
+ assertMayMutateLiveState: () => import_liveState.assertMayMutateLiveState,
125
145
  buildArtifactMessage: () => import_releaseManifest.buildArtifactMessage,
126
146
  buildCredentialAad: () => import_credentialEnvelope.buildCredentialAad,
127
147
  buildDeviceProof: () => import_deviceKey.buildProof,
@@ -129,14 +149,18 @@ __export(index_exports, {
129
149
  buildPairAad: () => import_daemonPair.buildPairAad,
130
150
  buildPairUrl: () => import_daemonPair.buildPairUrl,
131
151
  challenge: () => import_pkce.challenge,
152
+ classifyDaemonKeychainService: () => import_kek.classifyDaemonKeychainService,
132
153
  classifyRefreshResponse: () => import_refreshClassification.classifyRefreshResponse,
133
154
  classifyTokenKind: () => import_credentialResolver.classifyTokenKind,
134
155
  claudeSkillsLayoutEvidence: () => import_harnessSkillLayout.claudeSkillsLayoutEvidence,
135
156
  clearEnrollmentMarker: () => import_deviceIdentityBridge.clearEnrollmentMarker,
136
157
  clearReauthState: () => import_refresh.clearReauthState,
158
+ commitDeviceKeyCandidate: () => import_deviceIdentityBridge.commitDeviceKeyCandidate,
159
+ commitPendingHardwareKey: () => import_deviceIdentityBridge.commitPendingHardwareKey,
137
160
  compareReleaseVersions: () => import_releaseVersions.compareReleaseVersions,
138
161
  configRootPath: () => import_configRoot.configRootPath,
139
162
  configureAuthCore: () => import_runtime.configureAuthCore,
163
+ configureHardwareDeviceKeyHelper: () => import_deviceKeyHardware.configureHardwareDeviceKeyHelper,
140
164
  consolidateProfileState: () => import_profileStateDir.consolidateProfileState,
141
165
  createDpopKey: () => import_dpop.createDpopKey,
142
166
  createRefreshScheduler: () => import_refreshScheduler.createRefreshScheduler,
@@ -156,6 +180,8 @@ __export(index_exports, {
156
180
  describeDeviceKeySplit: () => import_deviceIdentityBridge.describeDeviceKeySplit,
157
181
  describeLegacyState: () => import_legacyStatePreflight.describeLegacyState,
158
182
  describeMachineIdentity: () => import_machineUuid.describeMachineIdentity,
183
+ describeStoredDeviceKey: () => import_deviceIdentityBridge.describeStoredDeviceKey,
184
+ discardPendingHardwareKey: () => import_deviceIdentityBridge.discardPendingHardwareKey,
159
185
  emitAuthTelemetry: () => import_runtime.emitAuthTelemetry,
160
186
  enrollWithServer: () => import_deviceIdentityBridge.enrollWithServer,
161
187
  ensureMachineDaemonId: () => import_machineId.ensureMachineDaemonId,
@@ -208,18 +234,27 @@ __export(index_exports, {
208
234
  isDaemonChildEnv: () => import_spawnEnv.isDaemonChildEnv,
209
235
  isDaemonScope: () => import_daemonScopes.isDaemonScope,
210
236
  isDeviceIdentityActive: () => import_deviceIdentityBridge.isDeviceIdentityActive,
237
+ isDevicePublicJwk: () => import_deviceKey.isDevicePublicJwk,
211
238
  isFirstPartyHarnessChannel: () => import_firstPartyHarnessChannels.isFirstPartyHarnessChannel,
212
239
  isJwkThumbprint: () => import_dpop.isJwkThumbprint,
240
+ isLiveKeychainService: () => import_liveState.isLiveKeychainService,
241
+ isLiveStateRefusal: () => import_liveState.isLiveStateRefusal,
213
242
  isLoopbackAddress: () => import_loopbackHttp.isLoopbackAddress,
214
243
  isLoopbackHostname: () => import_loopbackHttp.isLoopbackHostname,
215
244
  isMasterKekKeychainService: () => import_kek.isMasterKekKeychainService,
245
+ isSessionKeychainService: () => import_kek.isSessionKeychainService,
216
246
  isStaticTokenKind: () => import_credentialResolver.isStaticTokenKind,
247
+ isTestProcess: () => import_liveState.isTestProcess,
217
248
  isTrustedArtifactOrigin: () => import_releaseManifest.isTrustedArtifactOrigin,
249
+ isUserOwnedSecretKeychainService: () => import_kek.isUserOwnedSecretKeychainService,
218
250
  isValidRecoveryCode: () => import_recoveryCode.isValidRecoveryCode,
219
251
  jwkThumbprint: () => import_deviceKey.jwkThumbprint,
252
+ keychainSuffixForDir: () => import_liveState.keychainSuffixForDir,
220
253
  legacyDaemonUuids: () => import_machineId.legacyDaemonUuids,
221
254
  legacyProfileStateDir: () => import_profileStateDir.legacyProfileStateDir,
222
255
  linkFirstPartyHarnessAliases: () => import_firstPartyHarnessHome.linkFirstPartyHarnessAliases,
256
+ liveKeychainServices: () => import_liveState.liveKeychainServices,
257
+ liveStateRoot: () => import_liveState.liveStateRoot,
223
258
  loginWithLocalhost: () => import_loginWithLocalhost.loginWithLocalhost,
224
259
  loopbackFetch: () => import_loopbackHttp.loopbackFetch,
225
260
  maybeDecryptOnRead: () => import_credentialEnvelopeBridge.maybeDecryptOnRead,
@@ -230,6 +265,7 @@ __export(index_exports, {
230
265
  normalizeHtu: () => import_deviceKey.normalizeHtu,
231
266
  normalizeRecoveryCode: () => import_recoveryCode.normalizeRecoveryCode,
232
267
  openPairBundleBase64: () => import_daemonPair.openPairBundleBase64,
268
+ p256PublicJwkFromRaw: () => import_deviceKey.p256PublicJwkFromRaw,
233
269
  pairBase64ToUint8Array: () => import_daemonPair.base64ToUint8Array,
234
270
  pairBase64UrlToUint8Array: () => import_daemonPair.base64UrlToUint8Array,
235
271
  pairUint8ArrayToBase64: () => import_daemonPair.uint8ArrayToBase64,
@@ -239,16 +275,23 @@ __export(index_exports, {
239
275
  parsePairUrl: () => import_daemonPair.parsePairUrl,
240
276
  parseRecoveryCode: () => import_recoveryCode.parseRecoveryCode,
241
277
  parseTtlDays: () => import_ttlParser.parseTtlDays,
278
+ persistPendingHardwareKey: () => import_deviceIdentityBridge.persistPendingHardwareKey,
242
279
  persistReauthState: () => import_refresh.persistReauthState,
280
+ prepareHardwareKeyCandidate: () => import_deviceIdentityBridge.prepareHardwareKeyCandidate,
281
+ probeHardwareDeviceKey: () => import_deviceKeyHardware.probeHardwareDeviceKey,
243
282
  profileStateDir: () => import_profileStateDir.profileStateDir,
244
283
  profileStateFileLocations: () => import_profileStateDir.profileStateFileLocations,
245
284
  profileStateFilePathsToClear: () => import_profileStateDir.profileStateFilePathsToClear,
285
+ proofSigningInput: () => import_deviceKey.proofSigningInput,
246
286
  publicJwkFromX: () => import_deviceKey.publicJwkFromX,
247
287
  qualifyMachineUuid: () => import_machineUuid.qualifyMachineUuid,
248
288
  readAuthFromFd: () => import_fdToken.readAuthFromFd,
249
289
  readIndependentMachineReservation: () => import_independentMachineReservation.readIndependentMachineReservation,
290
+ readServerDeviceKeyAlgs: () => import_deviceKeyServerSupport.readServerDeviceKeyAlgs,
250
291
  reauthCommand: () => import_messages.reauthCommand,
251
292
  refreshDaemonToken: () => import_refresh.refreshDaemonToken,
293
+ refusesLiveKeychainMutation: () => import_liveState.refusesLiveKeychainMutation,
294
+ refusesLiveStateInTest: () => import_liveState.refusesLiveStateInTest,
252
295
  registerZeroizeHook: () => import_kek.registerZeroizeHook,
253
296
  reserveIndependentMachineProfile: () => import_independentMachineReservation.reserveIndependentMachineProfile,
254
297
  resetCredEnvelope: () => import_credentialEnvelopeBridge.resetCredEnvelope,
@@ -256,17 +299,23 @@ __export(index_exports, {
256
299
  resolveChannelManifestUrl: () => import_firstPartyHarnessChannels.resolveChannelManifestUrl,
257
300
  resolveConfigRoot: () => import_configRoot.resolveConfigRoot,
258
301
  resolveFirstPartyHarnessChannel: () => import_firstPartyHarnessChannels.resolveFirstPartyHarnessChannel,
302
+ resolveHardwareDeviceKeyHelper: () => import_deviceKeyHardware.resolveHardwareDeviceKeyHelper,
259
303
  resolveProfileStateDir: () => import_profileStateDir.resolveProfileStateDir,
260
304
  resolveProfileStateFile: () => import_profileStateDir.resolveProfileStateFile,
305
+ rethrowIfLiveStateRefusal: () => import_liveState.rethrowIfLiveStateRefusal,
261
306
  revokeDaemonRefreshSession: () => import_refresh.revokeDaemonRefreshSession,
262
307
  runHeadersHelper: () => import_headers_helper.runHeadersHelper,
263
308
  safeEqual: () => import_pkce.safeEqual,
264
309
  sanitizeSpawnEnv: () => import_spawnEnv.sanitizeSpawnEnv,
265
310
  setMachineUuidProfile: () => import_machineUuid.setMachineUuidProfile,
266
311
  shutdownCredEnvelope: () => import_credentialEnvelopeBridge.shutdownCredEnvelope,
312
+ signProofWith: () => import_deviceKey.signProofWith,
267
313
  signServerRequest: () => import_deviceIdentityBridge.signServerRequest,
314
+ signWithCandidate: () => import_deviceIdentityBridge.signWithCandidate,
315
+ softwareEd25519Handle: () => import_deviceKeyHandle.softwareEd25519Handle,
268
316
  splitKeyConvergencePolicy: () => import_credentialEnvelopeBridge.splitKeyConvergencePolicy,
269
317
  startLocalCallback: () => import_loginLocalhost.startLocalCallback,
318
+ testProcessSignal: () => import_liveState.testProcessSignal,
270
319
  tierPermitsConfiguredAutoMode: () => import_harnessTrust.tierPermitsConfiguredAutoMode,
271
320
  tokenHash: () => import_deviceKey.tokenHash,
272
321
  verifyArtifact: () => import_releaseManifest.verifyArtifact,
@@ -300,7 +349,11 @@ var import_ttlParser = require("./ttlParser.js");
300
349
  var import_recoveryCode = require("./recoveryCode.js");
301
350
  var import_credentialEnvelope = require("./credentialEnvelope.js");
302
351
  var import_kek = require("./kek/index.js");
352
+ var import_liveState = require("./liveState.js");
303
353
  var import_deviceKey = require("./deviceKey.js");
354
+ var import_deviceKeyHandle = require("./deviceKeyHandle.js");
355
+ var import_deviceKeyServerSupport = require("./deviceKeyServerSupport.js");
356
+ var import_deviceKeyHardware = require("./deviceKeyHardware.js");
304
357
  var import_dpop = require("./dpop.js");
305
358
  var import_credentialEnvelopeBridge = require("./credentialEnvelopeBridge.js");
306
359
  var import_deviceIdentityBridge = require("./deviceIdentityBridge.js");
@@ -327,7 +380,9 @@ __reExport(index_exports, require("./desktopWire.js"), module.exports);
327
380
  var import_independentMachineReservation = require("./independentMachineReservation.js");
328
381
  // Annotate the CommonJS export names for ESM import in node:
329
382
  0 && (module.exports = {
383
+ ALLOW_LIVE_STATE_ENV,
330
384
  ALL_DAEMON_SCOPES,
385
+ AUTH_SERVER_METADATA_PATH,
331
386
  AuthHelperUnavailableError,
332
387
  AuthHelperUntrustedError,
333
388
  CI_TOKEN_PREFIX,
@@ -336,12 +391,16 @@ var import_independentMachineReservation = require("./independentMachineReservat
336
391
  CRED_ENVELOPE_MAGIC,
337
392
  CRED_KEY_LEN,
338
393
  CredentialResolver,
394
+ DAEMON_BYOK_KEYCHAIN_SERVICE_BASE,
339
395
  DAEMON_CHILD_ENV,
396
+ DAEMON_KEYCHAIN_SERVICE_BASE,
340
397
  DEFAULT_BINARY_NAME,
341
398
  DEFAULT_DAEMON_SCOPES,
342
399
  DEFAULT_FIRST_PARTY_HARNESS_CHANNEL,
343
400
  DEFAULT_LOGIN_TIMEOUT_MS,
344
401
  DEFAULT_UNREADABLE_CREDENTIAL_HINT,
402
+ DEVICE_KEY_ALGS,
403
+ DEVICE_KEY_UNREADABLE_CREDENTIAL_HINT,
345
404
  DPOP_HEADER,
346
405
  DPOP_MAX_AGE_SECONDS,
347
406
  DPOP_PROOF_INVALID,
@@ -352,18 +411,25 @@ var import_independentMachineReservation = require("./independentMachineReservat
352
411
  FIRST_PARTY_HARNESS_CHANNELS,
353
412
  FIRST_PARTY_HARNESS_PREVIOUS_SUFFIX,
354
413
  FIRST_PARTY_HARNESS_PROVENANCE_SUFFIX,
414
+ HARDWARE_KEY_HELPER_NAME,
355
415
  HARNESSES_LOADING_CLAUDE_SKILLS_LAYOUT,
356
416
  HARNESS_TIERS,
417
+ HERMETIC_HOME_ENV,
357
418
  HOSTED_RUNTIME_MACHINE_SOURCES,
419
+ HardwareDeviceKeyError,
358
420
  INDEPENDENT_MACHINE_PROFILE_RE,
359
421
  INDEPENDENT_MACHINE_RESERVATION_FILE,
360
422
  InMemoryKek,
361
423
  KekUnavailableError,
362
424
  LEGACY_CONFIG_DIR_NAMES,
425
+ LEGACY_DAEMON_KEYCHAIN_SERVICE,
363
426
  LEGACY_NATIVE_ID_PREFIXES,
427
+ LIVE_DEFAULT_PROFILE,
428
+ LIVE_STATE_REFUSED_CODE,
364
429
  LOOPBACK_DEFAULT_MAX_BODY_BYTES,
365
430
  LOOPBACK_NO_PROXY_HOSTS,
366
431
  LinuxKek,
432
+ LiveStateRefusedError,
367
433
  LocalCallbackBindError,
368
434
  LocalCallbackDeniedError,
369
435
  LocalCallbackError,
@@ -389,6 +455,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
389
455
  PAIR_NONCE_LEN,
390
456
  PAIR_PUBKEY_LEN,
391
457
  PAIR_SECRET_LEN,
458
+ PENDING_HARDWARE_KEY_MAX_AGE_MS,
392
459
  PERSONAL_ACCESS_TOKEN_PREFIX,
393
460
  PROFILES_SEGMENT,
394
461
  PairBundleError,
@@ -400,6 +467,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
400
467
  SENSITIVE_ENV_SUFFIXES,
401
468
  SENSITIVE_ENV_VARS,
402
469
  SENTINEL_TRIGGERING_FAILURES,
470
+ SERVER_DEVICE_KEY_ALGS_FIELD,
403
471
  SUPERSEDED_COPY_SUFFIX,
404
472
  SUPERSEDED_MARKER_SUFFIX,
405
473
  TRUSTED_FEED_ORIGINS,
@@ -421,6 +489,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
421
489
  __resetMachineUuidCacheForTest,
422
490
  __resetShutdownGuardForTest,
423
491
  __resetUnknown401StreaksForTest,
492
+ __setAccountHomeForTest,
424
493
  __setCredEnvelopeStateForTest,
425
494
  __setDeviceIdentityStateForTest,
426
495
  __setFdReaderForTest,
@@ -428,8 +497,12 @@ var import_independentMachineReservation = require("./independentMachineReservat
428
497
  __setUnreadableReloadIntervalForTest,
429
498
  __wrappedDekFilePathForTest,
430
499
  accessTokenHash,
500
+ accountHomeDir,
501
+ algForJwk,
431
502
  assemblePairBundleBase64,
432
503
  assertLoopbackHttpUrl,
504
+ assertMayMutateLiveKeychain,
505
+ assertMayMutateLiveState,
433
506
  buildArtifactMessage,
434
507
  buildCredentialAad,
435
508
  buildDeviceProof,
@@ -437,14 +510,18 @@ var import_independentMachineReservation = require("./independentMachineReservat
437
510
  buildPairAad,
438
511
  buildPairUrl,
439
512
  challenge,
513
+ classifyDaemonKeychainService,
440
514
  classifyRefreshResponse,
441
515
  classifyTokenKind,
442
516
  claudeSkillsLayoutEvidence,
443
517
  clearEnrollmentMarker,
444
518
  clearReauthState,
519
+ commitDeviceKeyCandidate,
520
+ commitPendingHardwareKey,
445
521
  compareReleaseVersions,
446
522
  configRootPath,
447
523
  configureAuthCore,
524
+ configureHardwareDeviceKeyHelper,
448
525
  consolidateProfileState,
449
526
  createDpopKey,
450
527
  createRefreshScheduler,
@@ -464,6 +541,8 @@ var import_independentMachineReservation = require("./independentMachineReservat
464
541
  describeDeviceKeySplit,
465
542
  describeLegacyState,
466
543
  describeMachineIdentity,
544
+ describeStoredDeviceKey,
545
+ discardPendingHardwareKey,
467
546
  emitAuthTelemetry,
468
547
  enrollWithServer,
469
548
  ensureMachineDaemonId,
@@ -516,18 +595,27 @@ var import_independentMachineReservation = require("./independentMachineReservat
516
595
  isDaemonChildEnv,
517
596
  isDaemonScope,
518
597
  isDeviceIdentityActive,
598
+ isDevicePublicJwk,
519
599
  isFirstPartyHarnessChannel,
520
600
  isJwkThumbprint,
601
+ isLiveKeychainService,
602
+ isLiveStateRefusal,
521
603
  isLoopbackAddress,
522
604
  isLoopbackHostname,
523
605
  isMasterKekKeychainService,
606
+ isSessionKeychainService,
524
607
  isStaticTokenKind,
608
+ isTestProcess,
525
609
  isTrustedArtifactOrigin,
610
+ isUserOwnedSecretKeychainService,
526
611
  isValidRecoveryCode,
527
612
  jwkThumbprint,
613
+ keychainSuffixForDir,
528
614
  legacyDaemonUuids,
529
615
  legacyProfileStateDir,
530
616
  linkFirstPartyHarnessAliases,
617
+ liveKeychainServices,
618
+ liveStateRoot,
531
619
  loginWithLocalhost,
532
620
  loopbackFetch,
533
621
  maybeDecryptOnRead,
@@ -538,6 +626,7 @@ var import_independentMachineReservation = require("./independentMachineReservat
538
626
  normalizeHtu,
539
627
  normalizeRecoveryCode,
540
628
  openPairBundleBase64,
629
+ p256PublicJwkFromRaw,
541
630
  pairBase64ToUint8Array,
542
631
  pairBase64UrlToUint8Array,
543
632
  pairUint8ArrayToBase64,
@@ -547,16 +636,23 @@ var import_independentMachineReservation = require("./independentMachineReservat
547
636
  parsePairUrl,
548
637
  parseRecoveryCode,
549
638
  parseTtlDays,
639
+ persistPendingHardwareKey,
550
640
  persistReauthState,
641
+ prepareHardwareKeyCandidate,
642
+ probeHardwareDeviceKey,
551
643
  profileStateDir,
552
644
  profileStateFileLocations,
553
645
  profileStateFilePathsToClear,
646
+ proofSigningInput,
554
647
  publicJwkFromX,
555
648
  qualifyMachineUuid,
556
649
  readAuthFromFd,
557
650
  readIndependentMachineReservation,
651
+ readServerDeviceKeyAlgs,
558
652
  reauthCommand,
559
653
  refreshDaemonToken,
654
+ refusesLiveKeychainMutation,
655
+ refusesLiveStateInTest,
560
656
  registerZeroizeHook,
561
657
  reserveIndependentMachineProfile,
562
658
  resetCredEnvelope,
@@ -564,17 +660,23 @@ var import_independentMachineReservation = require("./independentMachineReservat
564
660
  resolveChannelManifestUrl,
565
661
  resolveConfigRoot,
566
662
  resolveFirstPartyHarnessChannel,
663
+ resolveHardwareDeviceKeyHelper,
567
664
  resolveProfileStateDir,
568
665
  resolveProfileStateFile,
666
+ rethrowIfLiveStateRefusal,
569
667
  revokeDaemonRefreshSession,
570
668
  runHeadersHelper,
571
669
  safeEqual,
572
670
  sanitizeSpawnEnv,
573
671
  setMachineUuidProfile,
574
672
  shutdownCredEnvelope,
673
+ signProofWith,
575
674
  signServerRequest,
675
+ signWithCandidate,
676
+ softwareEd25519Handle,
576
677
  splitKeyConvergencePolicy,
577
678
  startLocalCallback,
679
+ testProcessSignal,
578
680
  tierPermitsConfiguredAutoMode,
579
681
  tokenHash,
580
682
  verifyArtifact,
@@ -19,7 +19,7 @@ export { MacosKek } from './macos.js';
19
19
  export { LinuxKek } from './linux.js';
20
20
  export { WindowsKek } from './windows.js';
21
21
  export { zeroizeKekCaches, registerZeroizeHook } from './zeroize-registry.js';
22
- export { isMasterKekKeychainService, MASTER_KEK_KEYCHAIN_ACCOUNT, MASTER_KEK_KEYCHAIN_SERVICE, } from './masterKekService.js';
22
+ export { classifyDaemonKeychainService, isMasterKekKeychainService, isSessionKeychainService, isUserOwnedSecretKeychainService, MASTER_KEK_KEYCHAIN_ACCOUNT, MASTER_KEK_KEYCHAIN_SERVICE, type DaemonKeychainServiceClass, } from './masterKekService.js';
23
23
  /**
24
24
  * @internal Test-only seam — inject a synthetic KEK strategy that wraps
25
25
  * with a fixed in-memory key. Resets to platform default when called
@@ -37,8 +37,11 @@ __export(index_exports, {
37
37
  UnavailableKek: () => UnavailableKek,
38
38
  WindowsKek: () => import_windows2.WindowsKek,
39
39
  __setKekStrategyForTest: () => __setKekStrategyForTest,
40
+ classifyDaemonKeychainService: () => import_masterKekService.classifyDaemonKeychainService,
40
41
  getKekStrategy: () => getKekStrategy,
41
42
  isMasterKekKeychainService: () => import_masterKekService.isMasterKekKeychainService,
43
+ isSessionKeychainService: () => import_masterKekService.isSessionKeychainService,
44
+ isUserOwnedSecretKeychainService: () => import_masterKekService.isUserOwnedSecretKeychainService,
42
45
  registerZeroizeHook: () => import_zeroize_registry.registerZeroizeHook,
43
46
  zeroizeKekCaches: () => import_zeroize_registry.zeroizeKekCaches
44
47
  });
@@ -158,8 +161,11 @@ class UnavailableKek {
158
161
  UnavailableKek,
159
162
  WindowsKek,
160
163
  __setKekStrategyForTest,
164
+ classifyDaemonKeychainService,
161
165
  getKekStrategy,
162
166
  isMasterKekKeychainService,
167
+ isSessionKeychainService,
168
+ isUserOwnedSecretKeychainService,
163
169
  registerZeroizeHook,
164
170
  zeroizeKekCaches
165
171
  });
@@ -27,6 +27,24 @@ type ReadFileSyncLike = (path: string, encoding: BufferEncoding) => string;
27
27
  * also clear the tier selection + KEK cache so the next call re-probes.
28
28
  */
29
29
  export declare function __setFsForTest(fn: ReadFileSyncLike | null): void;
30
+ /**
31
+ * Write the master KEK to the Secret Service. Uses stdin (base64-encoded)
32
+ * as required by `secret-tool store`. Idempotent — `secret-tool store`
33
+ * overwrites an existing item silently.
34
+ *
35
+ * `service` and `account` are passed in (rather than read from the
36
+ * module-level constants) so a `LinuxKek` instance constructed with an
37
+ * override stores under a unique Secret Service entry.
38
+ *
39
+ * Race note: see module-level comment above.
40
+ */
41
+ declare function writeKekToSecretService(kek: Buffer, service: string, account: string): Promise<void>;
42
+ /**
43
+ * @internal Test seam — the Secret Service write on its own, so a spec can reach the live-state
44
+ * guard without the tier probe getting in the way. A spec using it empties `PATH`, so that a
45
+ * guard which stopped firing reaches no `secret-tool` binary.
46
+ */
47
+ export declare const __writeKekToSecretServiceForTest: typeof writeKekToSecretService;
30
48
  /**
31
49
  * Zero out and drop every in-process master-KEK cache buffer (both the
32
50
  * Tier-2 by-service map and the Tier-3 single buffer).
@@ -32,6 +32,7 @@ __export(linux_exports, {
32
32
  __resetKekCacheForTest: () => __resetKekCacheForTest,
33
33
  __setExecFileForTest: () => __setExecFileForTest,
34
34
  __setFsForTest: () => __setFsForTest,
35
+ __writeKekToSecretServiceForTest: () => __writeKekToSecretServiceForTest,
35
36
  zeroizeLinuxKekCache: () => zeroizeLinuxKekCache
36
37
  });
37
38
  module.exports = __toCommonJS(linux_exports);
@@ -43,6 +44,7 @@ var import_credentialEnvelope = require("../credentialEnvelope.js");
43
44
  var import_types = require("./types.js");
44
45
  var import_zeroize_registry = require("./zeroize-registry.js");
45
46
  var import_masterKekService = require("./masterKekService.js");
47
+ var import_liveState = require("../liveState.js");
46
48
  const KIND_LIBSECRET = "linux-libsecret-shellout";
47
49
  const KIND_HKDF = "linux-machineid-hkdf";
48
50
  const SS_SERVICE = import_masterKekService.MASTER_KEK_KEYCHAIN_SERVICE;
@@ -199,6 +201,9 @@ async function writeKekToSecretService(kek, service, account) {
199
201
  if (kek.length !== import_credentialEnvelope.KEY_LEN) {
200
202
  throw new import_types.KekUnavailableError(KIND_LIBSECRET, `writeKekToSecretService: expected ${import_credentialEnvelope.KEY_LEN}-byte buffer, got ${kek.length}`);
201
203
  }
204
+ if (_execFileForTest === null) {
205
+ (0, import_liveState.assertMayMutateLiveKeychain)(service, `store the Secret Service item ${account} (a master KEK)`);
206
+ }
202
207
  const b64 = kek.toString("base64");
203
208
  try {
204
209
  await exec("secret-tool", ["store", "--label=skrr daemon master KEK", "service", service, "account", account], { input: b64 });
@@ -206,6 +211,7 @@ async function writeKekToSecretService(kek, service, account) {
206
211
  throw new import_types.KekUnavailableError(KIND_LIBSECRET, "secret-tool store failed", { cause: err });
207
212
  }
208
213
  }
214
+ const __writeKekToSecretServiceForTest = writeKekToSecretService;
209
215
  const _tier2KekCacheBySvc = /* @__PURE__ */ new Map();
210
216
  let _tier3KekCache = null;
211
217
  let _tierSelection = null;
@@ -368,6 +374,7 @@ class LinuxKek {
368
374
  } catch (err) {
369
375
  if (err instanceof import_types.KekUnavailableError)
370
376
  throw err;
377
+ (0, import_liveState.rethrowIfLiveStateRefusal)(err);
371
378
  throw new import_types.KekUnavailableError(this.id, err?.message ?? "shellout wrap failed", {
372
379
  cause: err
373
380
  });
@@ -421,5 +428,6 @@ class LinuxKek {
421
428
  __resetKekCacheForTest,
422
429
  __setExecFileForTest,
423
430
  __setFsForTest,
431
+ __writeKekToSecretServiceForTest,
424
432
  zeroizeLinuxKekCache
425
433
  });
@@ -21,6 +21,28 @@ export declare function __setExecFileForTest(fn: ExecFileLike | null): void;
21
21
  export declare function __resetSecurityProbeCacheForTest(): void;
22
22
  /** @internal Test seam — clear the resolved-keychain cache. */
23
23
  export declare function __resetResolvedKeychainCacheForTest(): void;
24
+ /**
25
+ * Create a master KEK without replacing an existing item. This key is shared
26
+ * by profiles, so even a first-use race in a different process must not
27
+ * overwrite the key protecting already wrapped credentials.
28
+ *
29
+ * The `service` / `account` parameters are threaded from the calling
30
+ * `MacosKek` instance so each instance keeps its own keychain entry.
31
+ *
32
+ * Explicit-keychain target: the resolved login-keychain path is passed
33
+ * as the trailing positional argument to `add-generic-password` so
34
+ * `security(1)` cannot fall back to a "default keychain" lookup that
35
+ * triggers a system-modal `Keychain Not Found` dialog. If no keychain
36
+ * resolves, throw `KekUnavailableError` immediately rather than
37
+ * shelling out at all.
38
+ */
39
+ declare function writeKekToKeychain(kek: Buffer, service: string, account: string): Promise<void>;
40
+ /**
41
+ * @internal Test seam — the Keychain write on its own, so a spec can reach the live-state
42
+ * guard without `wrap()`'s `security` probe getting in the way. A spec using it empties `PATH`,
43
+ * so that a guard which stopped firing reaches no `security` binary.
44
+ */
45
+ export declare const __writeKekToKeychainForTest: typeof writeKekToKeychain;
24
46
  /**
25
47
  * Zero out and drop every cached master-KEK buffer.
26
48
  *
@@ -34,6 +34,7 @@ __export(macos_exports, {
34
34
  __resetResolvedKeychainCacheForTest: () => __resetResolvedKeychainCacheForTest,
35
35
  __resetSecurityProbeCacheForTest: () => __resetSecurityProbeCacheForTest,
36
36
  __setExecFileForTest: () => __setExecFileForTest,
37
+ __writeKekToKeychainForTest: () => __writeKekToKeychainForTest,
37
38
  zeroizeMacosKekCache: () => zeroizeMacosKekCache
38
39
  });
39
40
  module.exports = __toCommonJS(macos_exports);
@@ -47,6 +48,7 @@ var import_credentialEnvelope = require("../credentialEnvelope.js");
47
48
  var import_types = require("./types.js");
48
49
  var import_zeroize_registry = require("./zeroize-registry.js");
49
50
  var import_masterKekService = require("./masterKekService.js");
51
+ var import_liveState = require("../liveState.js");
50
52
  const KIND_SHELLOUT = "macos-keychain-shellout";
51
53
  const KEYCHAIN_SERVICE = import_masterKekService.MASTER_KEK_KEYCHAIN_SERVICE;
52
54
  const KEYCHAIN_ACCOUNT = import_masterKekService.MASTER_KEK_KEYCHAIN_ACCOUNT;
@@ -169,6 +171,11 @@ async function writeKekToKeychain(kek, service, account) {
169
171
  if (keychainPath === null) {
170
172
  throw new import_types.KekUnavailableError(KIND_SHELLOUT, "no user login keychain resolvable; cannot write master KEK");
171
173
  }
174
+ if (_execFileForTest === null) {
175
+ (0, import_liveState.assertMayMutateLiveKeychain)(service, `add the Keychain item ${account} (a master KEK)`, {
176
+ keychainFile: keychainPath
177
+ });
178
+ }
172
179
  const b64 = kek.toString("base64");
173
180
  try {
174
181
  await exec("security", [
@@ -194,6 +201,7 @@ async function writeKekToKeychain(kek, service, account) {
194
201
  });
195
202
  }
196
203
  }
204
+ const __writeKekToKeychainForTest = writeKekToKeychain;
197
205
  const _kekCacheBySvc = /* @__PURE__ */ new Map();
198
206
  (0, import_zeroize_registry.registerZeroizeHook)(() => zeroizeMacosKekCache());
199
207
  function zeroizeMacosKekCache() {
@@ -223,6 +231,7 @@ async function resolveOrCreateKek(service, account) {
223
231
  try {
224
232
  await writeKekToKeychain(fresh, service, account);
225
233
  } catch (error) {
234
+ (0, import_liveState.rethrowIfLiveStateRefusal)(error);
226
235
  const winner = await readKekFromKeychain(service, account).catch(() => null);
227
236
  if (!winner)
228
237
  throw error;
@@ -342,6 +351,7 @@ class MacosKek {
342
351
  } catch (err) {
343
352
  if (err instanceof import_types.KekUnavailableError)
344
353
  throw err;
354
+ (0, import_liveState.rethrowIfLiveStateRefusal)(err);
345
355
  throw new import_types.KekUnavailableError(this.id, err?.message ?? "shellout wrap failed", {
346
356
  cause: err
347
357
  });
@@ -398,5 +408,6 @@ class MacosKek {
398
408
  __resetResolvedKeychainCacheForTest,
399
409
  __resetSecurityProbeCacheForTest,
400
410
  __setExecFileForTest,
411
+ __writeKekToKeychainForTest,
401
412
  zeroizeMacosKekCache
402
413
  });
@@ -17,9 +17,18 @@
17
17
  * and the device private key sealed under the old DEK was gone for good — which
18
18
  * the server then saw as `DEVICE_PROOF_MISSING` on every CLI hand-off.
19
19
  *
20
- * So anything that deletes keychain items by PREFIX or PATTERN asks
21
- * `isMasterKekKeychainService` first. Deleting the KEK is a decision a caller
22
- * makes by name, never a side effect of a sweep.
20
+ * The fix first written for it was a denylist on a wildcard: the sweep kept
21
+ * matching everything under `ai.(skrr|oversky).daemon*` and skipped the services
22
+ * it knew to be precious. That fails open. The default for a service added under
23
+ * that prefix tomorrow was "deleted", which is how the KEK went, and how the
24
+ * person's own BYOK keys were being swept as well.
25
+ *
26
+ * So this module names what a sweep may delete, not what it may not. Every
27
+ * service in the daemon's Keychain namespace is in exactly one class
28
+ * (`classifyDaemonKeychainService`), and a sign-out selects with
29
+ * `isSessionKeychainService`: a service nobody has classified is LEFT IN PLACE.
30
+ * Deleting the KEK is a decision a caller makes by name, never a side effect of
31
+ * a sweep.
23
32
  */
24
33
  /** Keychain `service` of the master KEK. */
25
34
  export declare const MASTER_KEK_KEYCHAIN_SERVICE = "ai.skrr.daemon.kek";
@@ -27,3 +36,34 @@ export declare const MASTER_KEK_KEYCHAIN_SERVICE = "ai.skrr.daemon.kek";
27
36
  export declare const MASTER_KEK_KEYCHAIN_ACCOUNT = "master-kek-v1";
28
37
  /** Whether a keychain service name holds master-KEK material. */
29
38
  export declare function isMasterKekKeychainService(service: string): boolean;
39
+ /** Whether a keychain service name holds a secret the person supplied, not a session. */
40
+ export declare function isUserOwnedSecretKeychainService(service: string): boolean;
41
+ /**
42
+ * Which kind of thing a service in the daemon's Keychain namespace holds. Exactly
43
+ * one, and the order of the checks in `classifyDaemonKeychainService` is what makes
44
+ * that true.
45
+ *
46
+ * `master_kek` key material every profile's envelope is sealed under. No sweep
47
+ * deletes it; a caller that must does so by name.
48
+ * `user_secret` what the person typed in (BYOK provider keys). A sign-out keeps
49
+ * it; a full uninstall removes it.
50
+ * `session` a profile's sign-in. A sign-out removes it.
51
+ * `unclassified` none of the above. Left in place, and reported, so that the next
52
+ * engineer who adds a service has to decide what it is.
53
+ */
54
+ export type DaemonKeychainServiceClass = 'master_kek' | 'user_secret' | 'session' | 'unclassified';
55
+ /**
56
+ * Classify one Keychain `service` name. The named non-members are asked FIRST: a
57
+ * profile may legally be called `byok.work` or `kek.x`, and its service then has
58
+ * the session shape AND the shape of the namespace it collides with. Reading it as
59
+ * the protected class is the safe direction (a sign-out leaves that profile's slots
60
+ * in place), so the protected classes win.
61
+ */
62
+ export declare function classifyDaemonKeychainService(service: string): DaemonKeychainServiceClass;
63
+ /**
64
+ * Whether a sign-out owns this service. This is the ONE predicate a sign-out sweep
65
+ * selects with (`services.filter(isSessionKeychainService)`): it names what is
66
+ * deleted, not what is spared. An uninstall adds `isUserOwnedSecretKeychainService`
67
+ * to it; no sweep adds the KEK.
68
+ */
69
+ export declare function isSessionKeychainService(service: string): boolean;