@nexera-systems/protocol 0.1.3

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.
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@nexera-systems/protocol",
3
+ "version": "0.1.3",
4
+ "type": "module",
5
+ "description": "Coding agent CLI for protocol: — usage counts against your plan (free tier included)",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "protocol": "dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "npm run check && tsx build.ts",
12
+ "dev": "tsx watch src/index.ts",
13
+ "start": "node dist/index.js",
14
+ "typecheck": "tsc --noEmit",
15
+ "lint": "eslint src/",
16
+ "test": "vitest",
17
+ "test:native-pty": "PROTOCOL_REQUIRE_NATIVE_PTY=1 vitest --run src/session/session.test.ts",
18
+ "check": "node scripts/check-wiring.mjs",
19
+ "smoke": "tsx scripts/smoke.mjs",
20
+ "e2e:cowork-codex": "tsx scripts/cowork-codex-e2e.mts",
21
+ "postinstall": "node scripts/fix-pty-perms.mjs",
22
+ "prepublishOnly": "NODE_ENV=production npm run build"
23
+ },
24
+ "files": [
25
+ "dist/index.js",
26
+ "scripts/fix-pty-perms.mjs"
27
+ ],
28
+ "keywords": [
29
+ "cli",
30
+ "agent",
31
+ "llm",
32
+ "ai",
33
+ "coding-assistant"
34
+ ],
35
+ "author": "Nexera Systems",
36
+ "license": "MIT",
37
+ "dependencies": {
38
+ "@modelcontextprotocol/sdk": "^1.0.0",
39
+ "@xenova/transformers": "^2.17.0",
40
+ "chalk": "^5.3.0",
41
+ "clipboardy": "^5.3.1",
42
+ "commander": "^12.0.0",
43
+ "dotenv": "^16.6.1",
44
+ "eventemitter3": "^5.0.0",
45
+ "glob": "^10.0.0",
46
+ "gradient-string": "^3.0.0",
47
+ "ink": "^6.8.0",
48
+ "ink-text-input": "^6.0.0",
49
+ "inquirer": "^9.3.8",
50
+ "js-yaml": "^4.1.0",
51
+ "marked": "^12.0.0",
52
+ "marked-terminal": "^7.0.0",
53
+ "node-pty": "^1.1.0",
54
+ "ora": "^8.0.0",
55
+ "react": "^19.2.4",
56
+ "uuid": "^9.0.0",
57
+ "zod": "^3.22.0"
58
+ },
59
+ "devDependencies": {
60
+ "@types/inquirer": "^9.0.0",
61
+ "@types/js-yaml": "^4.0.0",
62
+ "@types/node": "^20.0.0",
63
+ "@types/react": "^19.2.14",
64
+ "@types/uuid": "^9.0.0",
65
+ "esbuild": "^0.20.0",
66
+ "tsx": "^4.7.0",
67
+ "typescript": "^5.4.0",
68
+ "vitest": "^1.0.0"
69
+ },
70
+ "engines": {
71
+ "node": ">=18.0.0"
72
+ },
73
+ "publishConfig": {
74
+ "access": "public"
75
+ },
76
+ "repository": {
77
+ "type": "git",
78
+ "url": "git+https://github.com/GALGALMawang/protocol-mvp.git",
79
+ "directory": "cli"
80
+ },
81
+ "homepage": "https://protocolai.tech",
82
+ "bugs": {
83
+ "url": "https://github.com/GALGALMawang/protocol-mvp/issues"
84
+ }
85
+ }
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * node-pty 의 prebuilt `spawn-helper` 에 실행 권한을 되돌린다.
4
+ *
5
+ * 왜 필요한가 (2026-08-17):
6
+ * npm 이 tarball 을 풀면서 이 헬퍼의 실행 비트를 떨어뜨린다(644). 그러면 pty 가
7
+ * `posix_spawnp failed` 로 죽는데, 에러 어디에도 "권한"이라는 말이 없어서
8
+ * **"Node 24 라서 node-pty 가 안 되는구나"로 오진**하기 딱 좋다. 실제로 이 저장소는
9
+ * 그 오진 상태로 임베디드 터미널을 꺼둔 채 지냈다.
10
+ *
11
+ * ⚠️ 2026-08-23: 이 스크립트가 **실제 설치에선 한 번도 동작한 적이 없었다.**
12
+ * 예전엔 `process.cwd()/node_modules/node-pty` 만 봤는데, npm 은 의존성의
13
+ * postinstall 을 **그 패키지 자기 디렉토리**를 cwd 로 실행한다. 그런데 node-pty 는
14
+ * 보통 최상위로 호이스팅되므로 그 경로엔 없다 → ENOENT 를 조용히 삼키고 끝났다.
15
+ * 즉 고치라고 만든 버그가 모든 유저에게 그대로 재현되고 있었다.
16
+ * 이제 import.meta.resolve / require.resolve 로 **실제 설치 위치**를 찾는다.
17
+ *
18
+ * 실패해도 설치를 막지는 않는다 — pty 는 있으면 좋은 기능이지 CLI 의 전제가 아니다.
19
+ */
20
+ import fs from 'fs';
21
+ import path from 'path';
22
+ import { createRequire } from 'module';
23
+ import { fileURLToPath } from 'url';
24
+
25
+ /** node-pty 가 실제로 설치된 자리를 찾는다. 호이스팅·중첩 어느 쪽이든. */
26
+ function findPrebuilds() {
27
+ const cands = [];
28
+ // ① 정석: 이 스크립트 위치 기준으로 node-pty 를 해석한다 (호이스팅돼도 찾아진다)
29
+ try {
30
+ const req = createRequire(import.meta.url);
31
+ cands.push(path.join(path.dirname(req.resolve('node-pty/package.json')), 'prebuilds'));
32
+ } catch { /* 아래 폴백 */ }
33
+ // ② 폴백: 스크립트에서 위로 올라가며 node_modules/node-pty 를 찾는다
34
+ let dir = path.dirname(fileURLToPath(import.meta.url));
35
+ for (let i = 0; i < 6; i++) {
36
+ cands.push(path.join(dir, 'node_modules', 'node-pty', 'prebuilds'));
37
+ dir = path.dirname(dir);
38
+ }
39
+ // ③ 마지막: 예전 동작(개발 저장소에서 직접 돌릴 때)
40
+ cands.push(path.join(process.cwd(), 'node_modules', 'node-pty', 'prebuilds'));
41
+ return cands.find((c) => { try { return fs.existsSync(c); } catch { return false; } }) ?? null;
42
+ }
43
+
44
+ const base = findPrebuilds();
45
+ if (!base) {
46
+ // node-pty 가 아직 안 풀렸거나 설치 안 된 경우 — 조용히 넘어간다(설치를 막지 않는다)
47
+ process.exit(0);
48
+ }
49
+
50
+ let fixed = 0;
51
+ try {
52
+ for (const dir of fs.readdirSync(base)) {
53
+ const helper = path.join(base, dir, 'spawn-helper');
54
+ if (!fs.existsSync(helper)) continue;
55
+ const mode = fs.statSync(helper).mode;
56
+ if (mode & 0o111) continue; // 이미 실행 가능
57
+ fs.chmodSync(helper, 0o755);
58
+ fixed++;
59
+ }
60
+ if (fixed > 0) console.log(`[protocol] node-pty spawn-helper 실행 권한 복구 (${fixed}개)`);
61
+ } catch (e) {
62
+ console.warn('[protocol] node-pty 권한 확인 건너뜀:', e.message);
63
+ }