dsh-codex-style-computer-use 1.3.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,23 @@ import { execFileSync } from 'node:child_process'
8
8
 
9
9
  const hash = bytes => createHash('sha256').update(bytes).digest('hex')
10
10
  const fileHash = file => hash(fs.readFileSync(file))
11
+ export const WORKER_PROTOCOL_VERSION = 2
12
+
13
+ // Identity comes from the exact executable selected for this worker. A custom
14
+ // executable without a verified manifest stays explicitly unverified.
15
+ export function nativeRuntimeIdentity (binary) {
16
+ let packageVersion = 'unknown'
17
+ try { packageVersion = JSON.parse(fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf8')).version } catch {}
18
+ const binaryHash = fileHash(binary)
19
+ let manifest
20
+ try { manifest = JSON.parse(fs.readFileSync(`${binary}.json`, 'utf8')) } catch {}
21
+ const verified = manifest?.format === 1 && manifest?.platform === 'win32' && manifest?.architecture === 'x64' &&
22
+ /^[a-f0-9]{64}$/.test(manifest?.sourceSha256 || '') && manifest?.binarySha256 === binaryHash
23
+ const sourceHash = verified ? manifest.sourceSha256 : null
24
+ return { packageVersion, protocolVersion: WORKER_PROTOCOL_VERSION, sourceHash, binaryHash,
25
+ buildId: `${packageVersion}:${sourceHash?.slice(0, 16) || 'unverified'}:${binaryHash.slice(0, 16)}`,
26
+ verified: !!verified }
27
+ }
11
28
  const framework = env => path.join(env.SystemRoot || env.windir || 'C:\\Windows', 'Microsoft.NET', 'Framework64', 'v4.0.30319')
12
29
 
13
30
  export function workerReferences (env = process.env) {