@tomflow/chatloop-tunnel-darwin-arm64 0.0.19 → 0.0.23

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 (3) hide show
  1. package/README.md +9 -0
  2. package/index.mjs +42 -0
  3. package/package.json +11 -2
package/README.md CHANGED
@@ -1,3 +1,12 @@
1
1
  # @tomflow/chatloop-tunnel-darwin-arm64
2
2
 
3
3
  Private platform binary dependency of @tomflow/chatloop-tools, not a global tunnel-client installation. Official OpenAI tunnel-client v0.0.19 release assets, with SHA-256 verification, license, NOTICE, third-party attribution and SPDX in bin/. The Chat Loop CLI selects this absolute binary path and does not use Local Dev.
4
+
5
+
6
+ The only public npm import is index.mjs (getTunnelBundle()); no CLI.
7
+ The provider verifies its own bin/tunnel-client and bin/cloudflared against
8
+ its own provenance before returning their absolute paths. Tools must never
9
+ resolve this package's private package.json, bin/* or a sibling source directory.
10
+ The package patch version may differ from the upstream v0.0.19 binary version.
11
+
12
+ Current public result keys: `binary`, `cloudflared`, `release`, `platform`, `base`. No exposed checksum or alias; hashes are validated privately.
package/index.mjs ADDED
@@ -0,0 +1,42 @@
1
+ import {createApiAspect} from '@tomflow/chatloop-trace';
2
+ const apiAspect=createApiAspect('@tomflow/chatloop-tunnel-darwin-arm64');
3
+ export const subscribeTunnelApiLog=apiAspect.subscribe;
4
+ // Platform-only npm SDK: the binary carrier owns its own asset paths and hashes.
5
+ import {createHash} from 'node:crypto';
6
+ import {lstatSync,readFileSync} from 'node:fs';
7
+ import {dirname,join} from 'node:path';
8
+ import {fileURLToPath} from 'node:url';
9
+
10
+ const PLATFORM = 'darwin-arm64';
11
+ const invalid=()=>Object.assign(Error('Untrusted tunnel package'),{code:'INVALID_BUNDLE'});
12
+ const privateFile=file=>{
13
+ const stat=lstatSync(file);
14
+ if(!stat.isFile()||stat.isSymbolicLink())throw invalid();
15
+ return stat;
16
+ };
17
+ function getTunnelBundleCore(){
18
+ if(process.platform+'-'+process.arch!==PLATFORM)
19
+ throw Object.assign(Error('Unsupported tunnel platform'),{code:'UNSUPPORTED_PLATFORM'});
20
+ const base=join(dirname(fileURLToPath(import.meta.url)),'bin');
21
+ const provenance=join(base,'provenance.json');
22
+ privateFile(provenance);
23
+ let info;
24
+ try{info=JSON.parse(readFileSync(provenance,'utf8'))}catch{throw invalid()}
25
+ if(typeof info.release!=='string'||
26
+ !/^[a-f0-9]{64}$/.test(info.tunnelClientSha256||'')||
27
+ !/^[a-f0-9]{64}$/.test(info.cloudflaredSha256||''))throw invalid();
28
+ const check=(name,sha)=>{
29
+ const target=join(base,name),st=privateFile(target);
30
+ if(!(st.mode&0o111))throw invalid();
31
+ const digest=createHash('sha256').update(readFileSync(target)).digest('hex');
32
+ if(digest!==sha)throw invalid();
33
+ return target;
34
+ };
35
+ const binary=check('tunnel-client',info.tunnelClientSha256);
36
+ const cloudflared=check('cloudflared',info.cloudflaredSha256);
37
+ return Object.freeze({binary,cloudflared,release:info.release,
38
+ platform:PLATFORM,base});
39
+ }
40
+
41
+ export const getTunnelBundle=apiAspect.observe('getTunnelBundle',
42
+ getTunnelBundleCore);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/chatloop-tunnel-darwin-arm64",
3
- "version": "0.0.19",
3
+ "version": "0.0.23",
4
4
  "description": "Chat Loop private bundled OpenAI tunnel-client v0.0.19 (arm64)",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -13,7 +13,16 @@
13
13
  "arm64"
14
14
  ],
15
15
  "files": [
16
+ "index.mjs",
17
+ "lib/",
16
18
  "bin/"
17
19
  ],
18
- "license": "Apache-2.0"
20
+ "license": "Apache-2.0",
21
+ "type": "module",
22
+ "exports": {
23
+ ".": "./index.mjs"
24
+ },
25
+ "dependencies": {
26
+ "@tomflow/chatloop-trace": "0.4.3"
27
+ }
19
28
  }