@syengup/fridaynext-codex-channel 0.0.0-stage → 0.1.0-beta.1

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/README.md CHANGED
@@ -1,3 +1,40 @@
1
- # Temporary Holding Version
1
+ # FridayNext Codex插件 · Beta 1
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 发行包`@syengup/fridaynext-codex-channel@0.1.0-beta.1`内置已验收标准插件/适配器0.1.64、精确registry Kit0.2.0-beta.3及依赖闭包/许可证,无需访问私有仓库。当前验证macOS、Node.js≥22.13、Codex CLI **0.159.3**,以及兼容适配器0.1.64的Friday iOS候选;不推断其他平台或新宿主版本已认证。
4
+
5
+ ## 安装
6
+
7
+ 先在电脑端准备固定Codex CLI与原生认证。安装器不安装/降级Codex或复制认证;固定CLI不在PATH时,先设置`FN_CODEX_BINARY=/绝对路径/codex-0.159.3`。
8
+
9
+ ```sh
10
+ npx -y @syengup/fridaynext-codex-channel@0.1.0-beta.1
11
+ ```
12
+
13
+ 默认只用官方`plugin marketplace add`及`plugin add`注册/安装标准插件,市场身份沿原运行合同`fridaynext-codex@fridaynext-local`。代码根为`~/.fridaynext/codex/plugin/`,可用`FN_CODEX_INSTALL_ROOT`显式指定。已有其他目录的同名市场时拒绝混装;先按既有运维方式正常停止自己的插件服务、用官方命令移除原插件/市场,再安装本版,保留原配置与数据。安装不替用户停止常驻服务或迁移资料。
14
+
15
+ ## 连接与配对
16
+
17
+ 必须先由用户准备**已运行的**Codex app-server Unix socket;插件不启动app-server、不另建模型循环。默认stdio宿主没有共享端点时保持未就绪。使用已有默认配置时无需重新configure。首次配置必须明确指定socket、独立私有数据根和电脑实际局域网地址:
18
+
19
+ ```sh
20
+ npx -y @syengup/fridaynext-codex-channel@0.1.0-beta.1 configure --native-socket /绝对路径/已运行端点.sock --data-root /绝对路径/独立私有数据根 --lan-host 实际局域网IPv4
21
+ ```
22
+
23
+ 配置默认`~/.fridaynext/codex/integration.json`,代码与配置/数据根不能重叠。该configure会写所选配置,仅首次或明确重新配置时执行。终端原命令支持`--config`/`FN_CODEX_CONFIG`;MCP使用自定义配置时必须另在该MCP进程环境明确传入变量,不能假定宿主自动转发任意环境变量,首次使用建议默认路径。原生CODEX_HOME、账号、项目cwd及授权保持电脑端;安装不自动登记HOME或项目根。
24
+
25
+ 新建/重开原生Codex会话,让官方插件实际加载。在该会话调用`fridaynext_activate`,server为原生实际MCP服务器名;可信thread和同helper随机挑战见证齐备后才开启唯一Kit HTTPS。再用`fridaynext_pair`取得同一一次券的二维码/完整JSON,供Friday扫码或粘贴。终端也可执行:
26
+
27
+ ```sh
28
+ npx -y @syengup/fridaynext-codex-channel@0.1.0-beta.1 status
29
+ npx -y @syengup/fridaynext-codex-channel@0.1.0-beta.1 pair
30
+ ```
31
+
32
+ 终端pair告知0600的二维码PNG与完整配对文本位置。券十分钟有效,重出使旧券失效;配对信息和日志不要公开。手机仅使用Kit配对凭据,电脑认证不下发。项目根登记使用原owner入口`roots add --path /明确授权项目`,`roots list`读取;不自动扩大目录权限。
33
+
34
+ ## 重装、升级及边界
35
+
36
+ 相同固定包重复安装保留原配置、身份/TLS、配对及会话。不同发行/被改源保守拒绝覆盖;升级/回退应先确认Kit队列与原生轮空闲,按官方命令切换代码来源并重开原生会话,保留原数据,不手动抢owner。官方卸载为`codex plugin remove fridaynext-codex@fridaynext-local`及`codex plugin marketplace remove fridaynext-local`;插件停用/卸载不等于取消原生turn或删除私有数据。一个thread的owner退出后服务结束,其他helper须显式重新激活,不承诺无缝接管。
37
+
38
+ 支持已验原生会话/历史、流式正文与工具、设置/审批/提问、停止/排队、授权目录/新工作树、图片/普通文件及子任务等既有功能。媒体最多4件、单件2MiB、合计4MiB;图片需当前模型原生支持。会话迁移、工作树归档/恢复、完整目录漂移、原生配置/技能管理、语音等未纳入本版。公网需原服务显式配置、权益及production App Attest分别成立;本包不自动开通或购买。
39
+
40
+ 固定CLI的ChatGPT账号绑定沿公开experimental account/read.workspaceRouting核对,缺字段/稳定账号域时保持未就绪,不按email/套餐猜测。Beta不代表所有宿主版本、模型、操作系统或未纳入功能均可用。
package/install.mjs ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { createHash } from 'node:crypto';
7
+ import { execFileSync, spawnSync } from 'node:child_process';
8
+ const pkg = fileURLToPath(new URL('.', import.meta.url));
9
+ const root = path.resolve(process.env.FN_CODEX_INSTALL_ROOT ?? path.join(os.homedir(), '.fridaynext/codex/plugin'));
10
+ const binary = process.env.FN_CODEX_BINARY ?? 'codex', pluginId = 'fridaynext-codex@fridaynext-local';
11
+ const read = file => JSON.parse(fs.readFileSync(file));
12
+ const hash = bytes => createHash('sha256').update(bytes).digest('hex');
13
+ const fail = code => { throw Object.assign(new Error(code), { code }); };
14
+ function privateRoot() {
15
+ const st = fs.lstatSync(root); if (!st.isDirectory() || st.isSymbolicLink() || st.uid !== process.getuid() || st.mode & 0o077) fail('INSTALL_ROOT_UNSAFE');
16
+ }
17
+ function verify(release) {
18
+ privateRoot();
19
+ const plugin = path.join(root, 'plugins/fridaynext-codex'), h = createHash('sha256');
20
+ for (const file of ['plugin.json', 'mcp.json', ...fs.readdirSync(path.join(plugin, 'src')).filter(f => f.endsWith('.mjs')).map(f => 'src/' + f)].sort())
21
+ h.update(file + '\0').update(fs.readFileSync(path.join(plugin, file))).update('\0');
22
+ if (read(path.join(plugin, 'plugin.json')).version !== release.adapterVersion || h.digest('hex') !== release.sourceDigest) fail('INSTALLED_SOURCE_CHANGED');
23
+ }
24
+ function cli(args, json = true) {
25
+ try { const value = execFileSync(binary, args, { encoding: 'utf8', timeout: 120000, maxBuffer: 1048576, stdio: ['ignore', 'pipe', 'pipe'] }); return json ? JSON.parse(value) : value.trim(); }
26
+ catch { fail('CODEX_PLUGIN_COMMAND_FAILED'); }
27
+ }
28
+ function install() {
29
+ const release = read(path.join(pkg, 'release.json'));
30
+ if (cli(['--version'], false) !== 'codex-cli ' + release.host) fail('HOST_VERSION_UNSUPPORTED');
31
+ if (hash(fs.readFileSync(path.join(pkg, 'plugin.tgz'))) !== release.payloadSHA256) fail('RELEASE_PAYLOAD_CHANGED');
32
+ if (fs.lstatSync(root, { throwIfNoEntry: false })) {
33
+ privateRoot(); const old = read(path.join(root, 'release.json'));
34
+ if (old.payloadSHA256 !== release.payloadSHA256 || old.distributionVersion !== release.distributionVersion) fail('INSTALL_VERSION_CONFLICT');
35
+ } else {
36
+ fs.mkdirSync(path.dirname(root), { recursive: true, mode: 0o700 });
37
+ const stage = fs.mkdtempSync(path.join(path.dirname(root), '.codex-install-'));
38
+ try {
39
+ const names = execFileSync('tar', ['-tzf', path.join(pkg, 'plugin.tgz')], { encoding: 'utf8', maxBuffer: 8388608 }).split('\n');
40
+ if (names.some(name => path.isAbsolute(name) || name.split('/').includes('..'))) fail('RELEASE_PATH_UNSAFE');
41
+ execFileSync('tar', ['-xzf', path.join(pkg, 'plugin.tgz'), '-C', stage]);
42
+ fs.writeFileSync(path.join(stage, 'release.json'), JSON.stringify(release), { mode: 0o600 }); fs.renameSync(stage, root);
43
+ } finally { fs.rmSync(stage, { recursive: true, force: true }); }
44
+ }
45
+ verify(release);
46
+ const markets = cli(['plugin', 'marketplace', 'list', '--json']).marketplaces;
47
+ if (!Array.isArray(markets)) fail('MARKETPLACE_RESPONSE_UNKNOWN');
48
+ const market = markets.find(value => value.name === 'fridaynext-local');
49
+ if (market && fs.realpathSync(market.root) !== fs.realpathSync(root)) fail('MARKETPLACE_SOURCE_CONFLICT');
50
+ if (!market) cli(['plugin', 'marketplace', 'add', root, '--json']);
51
+ const installed = cli(['plugin', 'list', '--json']).installed;
52
+ if (!Array.isArray(installed)) fail('PLUGIN_RESPONSE_UNKNOWN');
53
+ if (installed.some(value => value.name === 'fridaynext-codex' && value.pluginId !== pluginId)) fail('PLUGIN_SOURCE_CONFLICT');
54
+ const current = installed.find(value => value.pluginId === pluginId);
55
+ if (current && (current.enabled !== true || fs.realpathSync(current.source.path) !== fs.realpathSync(path.join(root, 'plugins/fridaynext-codex')))) fail('PLUGIN_SOURCE_CONFLICT');
56
+ if (!current) cli(['plugin', 'add', pluginId, '--json']);
57
+ const receipt = { state: 'installed', distributionVersion: release.distributionVersion, adapterVersion: release.adapterVersion, pluginId, codeRoot: root, sourceDigest: release.sourceDigest, serviceStarted: false };
58
+ fs.writeFileSync(path.join(root, 'installed.json'), JSON.stringify(receipt), { mode: 0o600 }); console.log(JSON.stringify(receipt, null, 2));
59
+ }
60
+ try {
61
+ const [major, minor] = process.versions.node.split('.').map(Number); if (major < 22 || major === 22 && minor < 13) fail('NODE_VERSION_UNSUPPORTED');
62
+ const [command = 'install', ...args] = process.argv.slice(2);
63
+ if (['help', '--help'].includes(command)) console.log('用法:fridaynext-codex-channel [install|configure|status|pair|roots|permissions|sessions];默认仅安装官方插件,不启动app-server、模型或Kit。');
64
+ else if (command === 'install') install();
65
+ else if (['configure', 'status', 'pair', 'roots', 'permissions', 'sessions'].includes(command)) {
66
+ const release = read(path.join(pkg, 'release.json')); if (read(path.join(root, 'release.json')).payloadSHA256 !== release.payloadSHA256) fail('INSTALL_VERSION_CONFLICT'); verify(release);
67
+ const child = spawnSync(process.execPath, [path.join(root, 'plugins/fridaynext-codex/src/cli.mjs'), command, ...args], { stdio: 'inherit', env: process.env }); process.exitCode = child.status ?? 1;
68
+ } else fail('COMMAND_UNSUPPORTED');
69
+ } catch (error) { console.error(JSON.stringify({ code: typeof error.code === 'string' ? error.code : 'CODEX_INSTALL_FAILED' })); process.exitCode = 1; }
package/package.json CHANGED
@@ -1,6 +1,24 @@
1
1
  {
2
2
  "name": "@syengup/fridaynext-codex-channel",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-beta.1",
4
+ "type": "module",
5
+ "license": "UNLICENSED",
6
+ "description": "通过Codex官方标准插件命令安装FridayNext并连接显式授权的本机宿主",
7
+ "engines": {
8
+ "node": ">=22.13.0"
9
+ },
10
+ "bin": {
11
+ "fridaynext-codex-channel": "install.mjs"
12
+ },
13
+ "files": [
14
+ "install.mjs",
15
+ "release.json",
16
+ "plugin.tgz",
17
+ "README.md"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public",
21
+ "tag": "beta",
22
+ "registry": "https://registry.npmjs.org/"
23
+ }
24
+ }
package/plugin.tgz ADDED
Binary file
package/release.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 1,
3
+ "distributionVersion": "0.1.0-beta.1",
4
+ "adapterVersion": "0.1.64",
5
+ "host": "0.159.3",
6
+ "kit": "0.2.0-beta.3",
7
+ "sourceDigest": "884048827cd127a433a36f0c0ed2c1fdf4f3a5b1fb8c76d071f6109749bb410c",
8
+ "payloadSHA256": "1740be23f96b839c2433688a710aa37cbfe071b75b93e95eab74498af07f8b16"
9
+ }