@causyne/agent 1.20.118 → 1.20.121

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 (101) hide show
  1. package/package.json +1 -1
  2. package/src/agent/errorClassifier.js +113 -0
  3. package/src/agent/errorClassifier.ts +161 -0
  4. package/src/agent/promptIntent.js +200 -0
  5. package/src/agent/promptIntent.ts +203 -0
  6. package/src/agent/toolArgValidator.js +97 -0
  7. package/src/agent/toolArgValidator.ts +112 -0
  8. package/src/agentLoop.js +51 -351
  9. package/src/agentLoop.ts +69 -363
  10. package/src/autoUpdate.js +111 -8
  11. package/src/autoUpdate.ts +144 -8
  12. package/src/browser/causyneBrowser.js +231 -136
  13. package/src/browser/causyneBrowser.ts +229 -140
  14. package/src/browser/searchProviders.js +41 -30
  15. package/src/browser/searchProviders.ts +24 -14
  16. package/src/browser/workspacePathSafety.js +50 -0
  17. package/src/browser/workspacePathSafety.ts +50 -0
  18. package/src/browser/workspacePreview.js +27 -4
  19. package/src/browser/workspacePreview.ts +28 -4
  20. package/src/cliMode.js +17 -3
  21. package/src/commands.js +15 -22
  22. package/src/config.js +42 -63
  23. package/src/configVault.js +204 -0
  24. package/src/configVault.ts +213 -0
  25. package/src/core/contextCompactor.js +70 -11
  26. package/src/core/contextCompactor.ts +83 -11
  27. package/src/creative/liveBridge.js +34 -1
  28. package/src/creative/liveBridge.ts +28 -1
  29. package/src/dynamicCatalogue.js +42 -73
  30. package/src/dynamicCatalogue.ts +74 -60
  31. package/src/entrypoint.js +77 -4
  32. package/src/headlessCli.js +304 -0
  33. package/src/headlessCli.ts +380 -0
  34. package/src/mcp/mcpClient.js +38 -11
  35. package/src/mcp/mcpClient.ts +44 -11
  36. package/src/mcp/mcpRegistry.js +2 -5
  37. package/src/mcp/mcpRegistry.ts +2 -5
  38. package/src/mcp/mcpSecurity.js +189 -0
  39. package/src/mcp/mcpSecurity.ts +190 -0
  40. package/src/observer/evidence.js +23 -0
  41. package/src/observer/evidence.ts +21 -0
  42. package/src/osKeychain.js +209 -0
  43. package/src/osKeychain.ts +245 -0
  44. package/src/providers/anthropic.js +61 -28
  45. package/src/providers/base.js +14 -0
  46. package/src/providers/byokHttp.js +354 -0
  47. package/src/providers/byokHttp.ts +454 -0
  48. package/src/providers/byokStream.js +657 -0
  49. package/src/providers/byokStream.ts +759 -0
  50. package/src/providers/dashscope-byok.js +47 -32
  51. package/src/providers/deepseek.js +43 -39
  52. package/src/providers/gemini.js +73 -38
  53. package/src/providers/moonshot.js +43 -33
  54. package/src/providers/muse.js +10 -10
  55. package/src/providers/ollama.js +46 -31
  56. package/src/providers/openai-compatible.js +57 -32
  57. package/src/providers/openrouter.js +77 -113
  58. package/src/providers/openrouter.ts +99 -118
  59. package/src/providers/qwen-byok.js +46 -23
  60. package/src/providers/toolContracts.js +9 -3
  61. package/src/providers/toolContracts.ts +9 -3
  62. package/src/providers/wireNormalizer.js +238 -0
  63. package/src/providers/wireNormalizer.ts +279 -0
  64. package/src/providers/xai.js +43 -33
  65. package/src/sandbox.js +77 -56
  66. package/src/sandboxPolicy.js +1208 -0
  67. package/src/sandboxPolicy.ts +1300 -0
  68. package/src/sessionJournal.js +47 -0
  69. package/src/sessionJournal.ts +49 -0
  70. package/src/tools/browserAutomator.js +13 -1
  71. package/src/tools/browserAutomator.ts +13 -0
  72. package/src/tools/creativeApps.js +2 -1
  73. package/src/tools/creativeApps.ts +2 -1
  74. package/src/tools/gameAssetFetcher.js +130 -26
  75. package/src/tools/gameAssetHarvester.js +80 -58
  76. package/src/tools/nativeEngine.js +1 -1
  77. package/src/tools/nativeEngine.ts +1 -1
  78. package/src/tools/osSandbox.js +473 -0
  79. package/src/tools/osSandbox.ts +554 -0
  80. package/src/tools/persistentShell.js +8 -3
  81. package/src/tools/registry.js +13 -0
  82. package/src/tools/subprocessEnv.js +197 -0
  83. package/src/tools/subprocessEnv.ts +212 -0
  84. package/src/tools/sysRun.js +39 -6
  85. package/src/tools/sysRun.ts +53 -7
  86. package/src/tools/toolScanner.js +596 -140
  87. package/src/tools/toolScanner.ts +665 -147
  88. package/src/tools/toolSelfRepair.js +243 -114
  89. package/src/tools/toolSelfRepair.ts +262 -111
  90. package/src/tools/webFetch.js +161 -24
  91. package/src/tools/webFetch.ts +157 -22
  92. package/src/tools/webSearch.js +33 -4
  93. package/src/tools/webSearch.ts +27 -4
  94. package/src/tui/sessionPicker.js +132 -35
  95. package/src/tui/sessionPicker.ts +153 -32
  96. package/src/tui/sessionPickerView.js +277 -34
  97. package/src/tui/sessionPickerView.ts +328 -34
  98. package/src/tui/statusLine.js +3 -0
  99. package/src/tui/statusLine.ts +5 -0
  100. package/src/tui/workspaceIdentity.js +133 -0
  101. package/src/tui/workspaceIdentity.ts +146 -0
package/src/autoUpdate.js CHANGED
@@ -4,6 +4,7 @@
4
4
  // causyne.com installer. A source checkout is never rewritten. Commands are
5
5
  // passed as argv arrays with shell disabled, and the only accepted package is
6
6
  // the public @causyne/agent package from the npm registry.
7
+ import crypto from 'node:crypto';
7
8
  import fs from 'node:fs';
8
9
  import path from 'node:path';
9
10
  import { fileURLToPath } from 'node:url';
@@ -11,6 +12,8 @@ import { spawnSync } from 'node:child_process';
11
12
  import { UI } from './utils/cli_ui.js';
12
13
  import { causyneHome } from './utils/paths.js';
13
14
  import { getPackageVersion } from './version.js';
15
+ import { probeOsSandbox, resolveOsSandboxMode } from './tools/osSandbox.js';
16
+ import { probeOsKeychain, resolveKeychainMode } from './osKeychain.js';
14
17
  const PACKAGE_NAME = '@causyne/agent';
15
18
  const REGISTRY_LATEST = 'https://registry.npmjs.org/@causyne%2fagent/latest';
16
19
  const DEFAULT_CHECK_INTERVAL_MS = 0; // A bare 'causyne' checks the published version on every launch
@@ -140,23 +143,110 @@ function writeState(state, options = {}) {
140
143
  // Update state is an optimisation. Failure must never stop the CLI.
141
144
  }
142
145
  }
143
- export async function latestPackageVersion(options = {}) {
146
+ const SRI_PATTERN = /^(sha512|sha384|sha256)-([A-Za-z0-9+/]+={0,2})$/;
147
+ function isOfficialRegistryHttpsUrl(rawUrl) {
148
+ if (typeof rawUrl !== 'string' || !rawUrl.trim())
149
+ return false;
150
+ try {
151
+ const parsed = new URL(rawUrl.trim());
152
+ return parsed.protocol === 'https:' && parsed.hostname === 'registry.npmjs.org';
153
+ }
154
+ catch {
155
+ return false;
156
+ }
157
+ }
158
+ /**
159
+ * Verifies constant-time SRI integrity (`sha512-...`, `sha384-...`, or `sha256-...`)
160
+ * of a downloaded tarball buffer against the registry-declared integrity string.
161
+ */
162
+ export function verifyTarballIntegrity(data, expectedIntegrity) {
163
+ if (!Buffer.isBuffer(data) || typeof expectedIntegrity !== 'string')
164
+ return false;
165
+ const match = expectedIntegrity.trim().match(SRI_PATTERN);
166
+ if (!match)
167
+ return false;
168
+ const algorithm = match[1];
169
+ const expectedDigest = Buffer.from(match[2], 'base64');
170
+ const actualDigest = crypto.createHash(algorithm).update(data).digest();
171
+ if (expectedDigest.length !== actualDigest.length)
172
+ return false;
173
+ return crypto.timingSafeEqual(expectedDigest, actualDigest);
174
+ }
175
+ /**
176
+ * Validates npm registry metadata for `@causyne/agent`, enforcing official HTTPS
177
+ * tarball origin, valid SRI integrity format, and optional Sigstore provenance
178
+ * attestation checks (`requireProvenance` or `CAUSYNE_REQUIRE_PROVENANCE=1`).
179
+ */
180
+ export function verifyRegistryMetadataIntegrity(metadata, options = {}) {
181
+ if (!metadata || typeof metadata !== 'object' || Array.isArray(metadata)) {
182
+ throw new Error('npm registry returned invalid package metadata');
183
+ }
184
+ const record = metadata;
185
+ if (record.name !== PACKAGE_NAME || typeof record.version !== 'string' || !versionParts(record.version)) {
186
+ throw new Error('npm registry returned invalid package metadata');
187
+ }
188
+ let tarballUrl;
189
+ let integrity;
190
+ let attestationUrl;
191
+ let provenanceVerified = false;
192
+ if (record.dist !== undefined) {
193
+ if (!record.dist || typeof record.dist !== 'object' || Array.isArray(record.dist)) {
194
+ throw new Error('npm registry returned malformed dist metadata');
195
+ }
196
+ if (record.dist.tarball !== undefined) {
197
+ if (!isOfficialRegistryHttpsUrl(record.dist.tarball)) {
198
+ throw new Error('npm registry tarball URL must use HTTPS on registry.npmjs.org');
199
+ }
200
+ tarballUrl = record.dist.tarball;
201
+ }
202
+ if (record.dist.integrity !== undefined) {
203
+ if (typeof record.dist.integrity !== 'string' || !SRI_PATTERN.test(record.dist.integrity.trim())) {
204
+ throw new Error('npm registry returned malformed SRI integrity digest');
205
+ }
206
+ integrity = record.dist.integrity.trim();
207
+ }
208
+ if (record.dist.attestations && typeof record.dist.attestations === 'object') {
209
+ const attUrl = record.dist.attestations.url;
210
+ const predicateType = record.dist.attestations.provenance?.predicateType;
211
+ if (isOfficialRegistryHttpsUrl(attUrl) && typeof predicateType === 'string' && predicateType.length > 0) {
212
+ attestationUrl = attUrl;
213
+ provenanceVerified = true;
214
+ }
215
+ }
216
+ }
217
+ if (options.requireProvenance && !provenanceVerified) {
218
+ throw new Error(`Release ${PACKAGE_NAME}@${record.version} lacks verified npm provenance attestations.`);
219
+ }
220
+ return {
221
+ version: record.version,
222
+ ...(tarballUrl ? { tarballUrl } : {}),
223
+ ...(integrity ? { integrity } : {}),
224
+ provenanceVerified,
225
+ ...(attestationUrl ? { attestationUrl } : {})
226
+ };
227
+ }
228
+ export async function latestPackageRelease(options = {}) {
144
229
  const fetchImpl = options.fetchImpl || globalThis.fetch;
145
230
  if (typeof fetchImpl !== 'function')
146
231
  throw new Error('This Node.js runtime has no fetch implementation.');
147
232
  const timeoutMs = options.timeoutMs || 3500;
148
233
  const signal = options.signal || AbortSignal.timeout(timeoutMs);
234
+ const env = options.env || process.env;
235
+ const requireProvenance = options.requireProvenance
236
+ ?? (env.CAUSYNE_REQUIRE_PROVENANCE === '1' || env.CAUSYNE_REQUIRE_PROVENANCE === 'true');
149
237
  const response = await fetchImpl(REGISTRY_LATEST, {
150
238
  headers: { accept: 'application/json', 'user-agent': `causyne/${getPackageVersion()}` },
239
+ redirect: 'error',
151
240
  signal
152
241
  });
153
242
  if (!response.ok)
154
243
  throw new Error(`npm registry returned HTTP ${response.status}`);
155
- const metadata = (await response.json());
156
- if (metadata.name !== PACKAGE_NAME || !versionParts(metadata.version)) {
157
- throw new Error('npm registry returned invalid package metadata');
158
- }
159
- return metadata.version;
244
+ const metadata = await response.json();
245
+ return verifyRegistryMetadataIntegrity(metadata, { requireProvenance });
246
+ }
247
+ export async function latestPackageVersion(options = {}) {
248
+ const release = await latestPackageRelease(options);
249
+ return release.version;
160
250
  }
161
251
  function installLatest(info, options = {}) {
162
252
  if (!info.prefix) {
@@ -195,8 +285,14 @@ function installLatest(info, options = {}) {
195
285
  }
196
286
  export async function checkForUpdate(options = {}) {
197
287
  const current = options.currentVersion || getPackageVersion();
198
- const latest = await latestPackageVersion(options);
199
- return { current, latest, available: compareVersions(latest, current) > 0 };
288
+ const release = await latestPackageRelease(options);
289
+ return {
290
+ current,
291
+ latest: release.version,
292
+ available: compareVersions(release.version, current) > 0,
293
+ provenanceVerified: release.provenanceVerified,
294
+ ...(release.integrity ? { integrity: release.integrity } : {})
295
+ };
200
296
  }
201
297
  export async function runSelfUpdate(verbose = false, options = {}) {
202
298
  const info = installationInfo(options);
@@ -277,14 +373,21 @@ export async function diagnoseInstallation(options = {}) {
277
373
  };
278
374
  }
279
375
  export function formatDoctorReport(status, runtime = process) {
376
+ const sandboxCap = probeOsSandbox();
377
+ const sandboxMode = resolveOsSandboxMode(runtime.env);
378
+ const keychainCap = probeOsKeychain({ env: runtime.env });
379
+ const keychainMode = resolveKeychainMode(runtime.env);
280
380
  const rows = [
281
381
  `Version : ${status.current || 'unknown'}`,
282
382
  `Latest : ${status.latest || `unavailable (${status.error || 'unknown error'})`}`,
383
+ `Provenance : ${status.provenanceVerified ? 'verified (npm Sigstore attestation)' : 'unverified / not reported'}`,
283
384
  `Installation : ${status.type}`,
284
385
  `Package root : ${status.packageRoot}`,
285
386
  `NPM command : ${status.npmCommand}`,
286
387
  `Node.js : ${runtime.version}`,
287
388
  `Platform : ${runtime.platform} ${runtime.arch}`,
389
+ `OS Sandbox : ${sandboxMode.mode} (backend: ${sandboxCap.backend}${sandboxCap.available ? ', available' : ', unavailable'})`,
390
+ `OS Keychain : ${keychainMode} (backend: ${keychainCap.backend}${keychainCap.available ? ', available' : ', unavailable'})`,
288
391
  `Auto updates : ${status.autoUpdates ? 'enabled' : 'disabled'}`,
289
392
  `Workspace : ${runtime.cwd()}`
290
393
  ];
package/src/autoUpdate.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  // passed as argv arrays with shell disabled, and the only accepted package is
6
6
  // the public @causyne/agent package from the npm registry.
7
7
 
8
+ import crypto from 'node:crypto';
8
9
  import fs from 'node:fs';
9
10
  import path from 'node:path';
10
11
  import { fileURLToPath } from 'node:url';
@@ -13,6 +14,8 @@ import { spawnSync, type SpawnSyncReturns } from 'node:child_process';
13
14
  import { UI } from './utils/cli_ui.js';
14
15
  import { causyneHome } from './utils/paths.js';
15
16
  import { getPackageVersion } from './version.js';
17
+ import { probeOsSandbox, resolveOsSandboxMode } from './tools/osSandbox.js';
18
+ import { probeOsKeychain, resolveKeychainMode } from './osKeychain.js';
16
19
 
17
20
  const PACKAGE_NAME = '@causyne/agent';
18
21
  const REGISTRY_LATEST = 'https://registry.npmjs.org/@causyne%2fagent/latest';
@@ -46,6 +49,15 @@ export interface CheckUpdateOptions {
46
49
  timeoutMs?: number;
47
50
  signal?: AbortSignal;
48
51
  env?: NodeJS.ProcessEnv;
52
+ requireProvenance?: boolean;
53
+ }
54
+
55
+ export interface VerifiedReleaseMetadata {
56
+ version: string;
57
+ tarballUrl?: string | undefined;
58
+ integrity?: string | undefined;
59
+ provenanceVerified: boolean;
60
+ attestationUrl?: string | undefined;
49
61
  }
50
62
 
51
63
  export interface SelfUpdateOptions extends CheckUpdateOptions {
@@ -61,6 +73,8 @@ export interface CheckResult {
61
73
  current: string;
62
74
  latest: string;
63
75
  available: boolean;
76
+ provenanceVerified?: boolean | undefined;
77
+ integrity?: string | undefined;
64
78
  }
65
79
 
66
80
  export interface UpdateResult extends InstallationInfo {
@@ -76,6 +90,8 @@ export interface DiagnosisResult extends InstallationInfo {
76
90
  current?: string | undefined;
77
91
  latest?: string | null | undefined;
78
92
  available?: boolean | undefined;
93
+ provenanceVerified?: boolean | undefined;
94
+ integrity?: string | undefined;
79
95
  autoUpdates: boolean;
80
96
  error?: string | undefined;
81
97
  }
@@ -202,21 +218,128 @@ function writeState(state: UpdateState, options: { stateFile?: string; env?: Nod
202
218
  }
203
219
  }
204
220
 
205
- export async function latestPackageVersion(options: CheckUpdateOptions = {}): Promise<string> {
221
+ const SRI_PATTERN = /^(sha512|sha384|sha256)-([A-Za-z0-9+/]+={0,2})$/;
222
+
223
+ function isOfficialRegistryHttpsUrl(rawUrl: unknown): rawUrl is string {
224
+ if (typeof rawUrl !== 'string' || !rawUrl.trim()) return false;
225
+ try {
226
+ const parsed = new URL(rawUrl.trim());
227
+ return parsed.protocol === 'https:' && parsed.hostname === 'registry.npmjs.org';
228
+ } catch {
229
+ return false;
230
+ }
231
+ }
232
+
233
+ /**
234
+ * Verifies constant-time SRI integrity (`sha512-...`, `sha384-...`, or `sha256-...`)
235
+ * of a downloaded tarball buffer against the registry-declared integrity string.
236
+ */
237
+ export function verifyTarballIntegrity(data: Buffer, expectedIntegrity: string): boolean {
238
+ if (!Buffer.isBuffer(data) || typeof expectedIntegrity !== 'string') return false;
239
+ const match = expectedIntegrity.trim().match(SRI_PATTERN);
240
+ if (!match) return false;
241
+ const algorithm = match[1]!;
242
+ const expectedDigest = Buffer.from(match[2]!, 'base64');
243
+ const actualDigest = crypto.createHash(algorithm).update(data).digest();
244
+ if (expectedDigest.length !== actualDigest.length) return false;
245
+ return crypto.timingSafeEqual(expectedDigest, actualDigest);
246
+ }
247
+
248
+ /**
249
+ * Validates npm registry metadata for `@causyne/agent`, enforcing official HTTPS
250
+ * tarball origin, valid SRI integrity format, and optional Sigstore provenance
251
+ * attestation checks (`requireProvenance` or `CAUSYNE_REQUIRE_PROVENANCE=1`).
252
+ */
253
+ export function verifyRegistryMetadataIntegrity(
254
+ metadata: unknown,
255
+ options: { requireProvenance?: boolean | undefined } = {}
256
+ ): VerifiedReleaseMetadata {
257
+ if (!metadata || typeof metadata !== 'object' || Array.isArray(metadata)) {
258
+ throw new Error('npm registry returned invalid package metadata');
259
+ }
260
+ const record = metadata as {
261
+ name?: unknown;
262
+ version?: unknown;
263
+ dist?: {
264
+ tarball?: unknown;
265
+ integrity?: unknown;
266
+ attestations?: {
267
+ url?: unknown;
268
+ provenance?: { predicateType?: unknown };
269
+ };
270
+ };
271
+ };
272
+
273
+ if (record.name !== PACKAGE_NAME || typeof record.version !== 'string' || !versionParts(record.version)) {
274
+ throw new Error('npm registry returned invalid package metadata');
275
+ }
276
+
277
+ let tarballUrl: string | undefined;
278
+ let integrity: string | undefined;
279
+ let attestationUrl: string | undefined;
280
+ let provenanceVerified = false;
281
+
282
+ if (record.dist !== undefined) {
283
+ if (!record.dist || typeof record.dist !== 'object' || Array.isArray(record.dist)) {
284
+ throw new Error('npm registry returned malformed dist metadata');
285
+ }
286
+ if (record.dist.tarball !== undefined) {
287
+ if (!isOfficialRegistryHttpsUrl(record.dist.tarball)) {
288
+ throw new Error('npm registry tarball URL must use HTTPS on registry.npmjs.org');
289
+ }
290
+ tarballUrl = record.dist.tarball;
291
+ }
292
+ if (record.dist.integrity !== undefined) {
293
+ if (typeof record.dist.integrity !== 'string' || !SRI_PATTERN.test(record.dist.integrity.trim())) {
294
+ throw new Error('npm registry returned malformed SRI integrity digest');
295
+ }
296
+ integrity = record.dist.integrity.trim();
297
+ }
298
+ if (record.dist.attestations && typeof record.dist.attestations === 'object') {
299
+ const attUrl = record.dist.attestations.url;
300
+ const predicateType = record.dist.attestations.provenance?.predicateType;
301
+ if (isOfficialRegistryHttpsUrl(attUrl) && typeof predicateType === 'string' && predicateType.length > 0) {
302
+ attestationUrl = attUrl;
303
+ provenanceVerified = true;
304
+ }
305
+ }
306
+ }
307
+
308
+ if (options.requireProvenance && !provenanceVerified) {
309
+ throw new Error(`Release ${PACKAGE_NAME}@${record.version} lacks verified npm provenance attestations.`);
310
+ }
311
+
312
+ return {
313
+ version: record.version,
314
+ ...(tarballUrl ? { tarballUrl } : {}),
315
+ ...(integrity ? { integrity } : {}),
316
+ provenanceVerified,
317
+ ...(attestationUrl ? { attestationUrl } : {})
318
+ };
319
+ }
320
+
321
+ export async function latestPackageRelease(options: CheckUpdateOptions = {}): Promise<VerifiedReleaseMetadata> {
206
322
  const fetchImpl = options.fetchImpl || globalThis.fetch;
207
323
  if (typeof fetchImpl !== 'function') throw new Error('This Node.js runtime has no fetch implementation.');
208
324
  const timeoutMs = options.timeoutMs || 3500;
209
325
  const signal = options.signal || AbortSignal.timeout(timeoutMs);
326
+ const env = options.env || process.env;
327
+ const requireProvenance = options.requireProvenance
328
+ ?? (env.CAUSYNE_REQUIRE_PROVENANCE === '1' || env.CAUSYNE_REQUIRE_PROVENANCE === 'true');
329
+
210
330
  const response = await fetchImpl(REGISTRY_LATEST, {
211
331
  headers: { accept: 'application/json', 'user-agent': `causyne/${getPackageVersion()}` },
332
+ redirect: 'error',
212
333
  signal
213
334
  });
214
335
  if (!response.ok) throw new Error(`npm registry returned HTTP ${response.status}`);
215
- const metadata = (await response.json()) as { name?: string; version?: string };
216
- if (metadata.name !== PACKAGE_NAME || !versionParts(metadata.version)) {
217
- throw new Error('npm registry returned invalid package metadata');
218
- }
219
- return metadata.version as string;
336
+ const metadata: unknown = await response.json();
337
+ return verifyRegistryMetadataIntegrity(metadata, { requireProvenance });
338
+ }
339
+
340
+ export async function latestPackageVersion(options: CheckUpdateOptions = {}): Promise<string> {
341
+ const release = await latestPackageRelease(options);
342
+ return release.version;
220
343
  }
221
344
 
222
345
  function installLatest(info: InstallationInfo, options: SelfUpdateOptions = {}): void {
@@ -260,8 +383,14 @@ function installLatest(info: InstallationInfo, options: SelfUpdateOptions = {}):
260
383
 
261
384
  export async function checkForUpdate(options: CheckUpdateOptions = {}): Promise<CheckResult> {
262
385
  const current = options.currentVersion || getPackageVersion();
263
- const latest = await latestPackageVersion(options);
264
- return { current, latest, available: compareVersions(latest, current) > 0 };
386
+ const release = await latestPackageRelease(options);
387
+ return {
388
+ current,
389
+ latest: release.version,
390
+ available: compareVersions(release.version, current) > 0,
391
+ provenanceVerified: release.provenanceVerified,
392
+ ...(release.integrity ? { integrity: release.integrity } : {})
393
+ };
265
394
  }
266
395
 
267
396
  export async function runSelfUpdate(verbose: boolean = false, options: SelfUpdateOptions = {}): Promise<UpdateResult> {
@@ -344,14 +473,21 @@ export async function diagnoseInstallation(options: CheckUpdateOptions = {}): Pr
344
473
  }
345
474
 
346
475
  export function formatDoctorReport(status: DiagnosisResult, runtime: typeof process = process): string {
476
+ const sandboxCap = probeOsSandbox();
477
+ const sandboxMode = resolveOsSandboxMode(runtime.env);
478
+ const keychainCap = probeOsKeychain({ env: runtime.env });
479
+ const keychainMode = resolveKeychainMode(runtime.env);
347
480
  const rows = [
348
481
  `Version : ${status.current || 'unknown'}`,
349
482
  `Latest : ${status.latest || `unavailable (${status.error || 'unknown error'})`}`,
483
+ `Provenance : ${status.provenanceVerified ? 'verified (npm Sigstore attestation)' : 'unverified / not reported'}`,
350
484
  `Installation : ${status.type}`,
351
485
  `Package root : ${status.packageRoot}`,
352
486
  `NPM command : ${status.npmCommand}`,
353
487
  `Node.js : ${runtime.version}`,
354
488
  `Platform : ${runtime.platform} ${runtime.arch}`,
489
+ `OS Sandbox : ${sandboxMode.mode} (backend: ${sandboxCap.backend}${sandboxCap.available ? ', available' : ', unavailable'})`,
490
+ `OS Keychain : ${keychainMode} (backend: ${keychainCap.backend}${keychainCap.available ? ', available' : ', unavailable'})`,
355
491
  `Auto updates : ${status.autoUpdates ? 'enabled' : 'disabled'}`,
356
492
  `Workspace : ${runtime.cwd()}`
357
493
  ];