From a86599f4c73b1e2461f1b25ed8e697312aa3626a Mon Sep 17 00:00:00 2001 From: YiJie Date: Wed, 25 Nov 2026 04:05:03 +0800 Subject: [PATCH 1/2] Add Linux x64 gateway bridge release --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++- README.md | 12 ++++++----- README.zh-Hans.md | 12 ++++++----- cordisx-package.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- scripts/check-release-targets.mjs | 32 +++++++++++++++++++++++++++++ scripts/test-native-integration.mjs | 2 +- 8 files changed, 82 insertions(+), 16 deletions(-) create mode 100644 scripts/check-release-targets.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15ff6f4..d106b96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,14 +10,44 @@ permissions: jobs: check: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 cache: npm + - uses: actions/setup-go@v5 + with: + go-version: 1.26.5 # The formal Host Git package still pins Protocol as a nested Git dependency. # Use the Node 22 bundled npm until Host publishes a dependency-closed package. - run: npm ci - run: npm run check + - name: Prepare the pinned CLIProxyAPI plugin host + run: | + git clone --depth 1 --filter=blob:none --no-checkout https://github.com/router-for-me/CLIProxyAPI.git "$RUNNER_TEMP/cliproxy-source" + git -C "$RUNNER_TEMP/cliproxy-source" fetch --depth 1 origin 85d2faddd17e6f4f8675a84ee28b131f702e8eaa + git -C "$RUNNER_TEMP/cliproxy-source" checkout --detach FETCH_HEAD + - name: Pack and verify the Linux and macOS resources + run: | + node scripts/sync-runtime-resources.mjs + node scripts/sync-package-manifest.mjs + mkdir -p "$RUNNER_TEMP/release" "$RUNNER_TEMP/release-package" + npm pack --ignore-scripts --pack-destination "$RUNNER_TEMP/release" + archive="cordisx-plugin-cli-proxy-api-$(node -p "require('./package.json').version").tgz" + tar -xzf "$RUNNER_TEMP/release/$archive" -C "$RUNNER_TEMP/release-package" + node scripts/check-release-targets.mjs "$RUNNER_TEMP/release-package/package" + (cd "$RUNNER_TEMP/release" && sha256sum "$archive" > SHA256SUMS) + - name: Load the packaged Linux bridge through the real plugin host + env: + CLIPROXY_SOURCE: ${{ runner.temp }}/cliproxy-source + CORDISX_GATEWAY_REPO: ${{ runner.temp }}/release-package/package + run: node scripts/test-native-integration.mjs + - uses: actions/upload-artifact@v4 + with: + name: release-candidate-${{ github.sha }} + path: | + ${{ runner.temp }}/release/*.tgz + ${{ runner.temp }}/release/SHA256SUMS + if-no-files-found: error diff --git a/README.md b/README.md index 06cf65d..d84140b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ the CordisX interface. ## Install -Plugin ID: `cli-proxy-api`. Current release: `0.1.2`. +Plugin ID: `cli-proxy-api`. Current release: `0.1.3`. + +The packaged gateway bridge supports macOS arm64 and Linux x64. The CordisX Community Marketplace feed must already be configured and enabled before `--source` can select it: @@ -15,7 +17,7 @@ before `--source` can select it: ```sh FEED_URL=https://raw.githubusercontent.com/cordisx/marketplace/main/marketplace.json npx cordisx@beta source add "$FEED_URL" --yes -npx cordisx@beta plugin install cli-proxy-api --source "$FEED_URL" --version 0.1.2 +npx cordisx@beta plugin install cli-proxy-api --source "$FEED_URL" --version 0.1.3 ``` Skip `source add` when that exact feed is already enabled. For another profile, @@ -24,9 +26,9 @@ the source change only; it does not approve plugin permissions. A discovery source is not a trust root. The install command becomes available after the Marketplace v3 entry lists the -verified `0.1.2` artifact. Until then, download the archive and `SHA256SUMS` +verified `0.1.3` artifact. Until then, download the archive and `SHA256SUMS` from the -[GitHub release](https://github.com/cordisx/plugin-cli-proxy-api/releases/tag/v0.1.2). +[GitHub release](https://github.com/cordisx/plugin-cli-proxy-api/releases/tag/v0.1.3). ## Use @@ -64,7 +66,7 @@ provider or model when an exact identity is unavailable. ## Troubleshooting -- **Install cannot find version `0.1.2`:** confirm the Marketplace v3 entry +- **Install cannot find version `0.1.3`:** confirm the Marketplace v3 entry lists the verified artifact. `--source` does not add or repair a feed. - **No models or sessions appear:** confirm CLIProxyAPI is running, its accounts are enabled, and model/catalog read permissions are granted. diff --git a/README.zh-Hans.md b/README.zh-Hans.md index 3b28869..e49312e 100644 --- a/README.zh-Hans.md +++ b/README.zh-Hans.md @@ -6,23 +6,25 @@ CLIProxy Providers 将 CordisX 连接到 CLIProxyAPI runtime 提供的模型与 ## 安装 -插件 ID:`cli-proxy-api`。当前版本:`0.1.2`。 +插件 ID:`cli-proxy-api`。当前版本:`0.1.3`。 + +内置的 gateway 桥接支持 macOS arm64 和 Linux x64。 CordisX Community Marketplace feed 必须先完成配置并启用,`--source` 才能选择它: ```sh FEED_URL=https://raw.githubusercontent.com/cordisx/marketplace/main/marketplace.json npx cordisx@beta source add "$FEED_URL" --yes -npx cordisx@beta plugin install cli-proxy-api --source "$FEED_URL" --version 0.1.2 +npx cordisx@beta plugin install cli-proxy-api --source "$FEED_URL" --version 0.1.3 ``` 若该 feed 已启用,可跳过 `source add`。使用其他 profile 时,两条命令都要添加 相同的 `--profile `。`--yes` 只确认来源变更,不会批准插件权限;发现来源 也不等同于 trust root。 -Marketplace v3 条目列出已验证的 `0.1.2` artifact 后,安装命令才可用。在此之前, +Marketplace v3 条目列出已验证的 `0.1.3` artifact 后,安装命令才可用。在此之前, 可从 -[GitHub Release](https://github.com/cordisx/plugin-cli-proxy-api/releases/tag/v0.1.2) +[GitHub Release](https://github.com/cordisx/plugin-cli-proxy-api/releases/tag/v0.1.3) 下载压缩包与 `SHA256SUMS`。 ## 使用 @@ -55,7 +57,7 @@ CLIProxyAPI 账号与 endpoint 必须在外部 runtime 中配置。Host 负责 ## 排错 -- **找不到 `0.1.2`:**确认 Marketplace v3 条目已列出验证后的 artifact;`--source` +- **找不到 `0.1.3`:**确认 Marketplace v3 条目已列出验证后的 artifact;`--source` 不会添加或修复 feed。 - **没有模型或会话:**确认 CLIProxyAPI 正在运行、账号已启用,并授予模型和 catalog 读取权限。 diff --git a/cordisx-package.json b/cordisx-package.json index 725106d..72a694c 100644 --- a/cordisx-package.json +++ b/cordisx-package.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/cordisx/cordisx-protocol/main/schemas/plugin-package.v14.schema.json", "schemaVersion": 14, "id": "cli-proxy-api", - "version": "0.1.2", + "version": "0.1.3", "entry": "./dist/runtime/module.js", "readme": "./README.md", "canonicalSource": "https://github.com/cordisx/plugin-cli-proxy-api", diff --git a/package-lock.json b/package-lock.json index 080894d..7d4ae4b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@cordisx/plugin-cli-proxy-api", - "version": "0.1.2", + "version": "0.1.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@cordisx/plugin-cli-proxy-api", - "version": "0.1.2", + "version": "0.1.3", "license": "AGPL-3.0-or-later", "devDependencies": { "@cordisx/eslint-config": "github:cordisx/cordisxmono#c63c2e8c2ba7e11502934a52ad2ce3734e804cdc", diff --git a/package.json b/package.json index 6582480..9561531 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cordisx/plugin-cli-proxy-api", - "version": "0.1.2", + "version": "0.1.3", "private": true, "license": "AGPL-3.0-or-later", "description": "CLIProxyAPI provider sessions plugin for CordisX", diff --git a/scripts/check-release-targets.mjs b/scripts/check-release-targets.mjs new file mode 100644 index 0000000..588d0fb --- /dev/null +++ b/scripts/check-release-targets.mjs @@ -0,0 +1,32 @@ +import assert from 'node:assert/strict' +import { createHash } from 'node:crypto' +import { readFile } from 'node:fs/promises' +import path from 'node:path' + +const root = process.argv[2] +if (!root || !path.isAbsolute(root)) throw new Error('provide an absolute extracted package path') +const digest = bytes => 'sha256:' + createHash('sha256').update(bytes).digest('hex') +const [packageText, runtimeText] = await Promise.all([ + readFile(path.join(root, 'cordisx-package.json')), + readFile(path.join(root, 'runtime-manifest.json')), +]) +const packageManifest = JSON.parse(packageText) +const runtimeManifest = JSON.parse(runtimeText) +assert.equal(packageManifest.runtimeManifest.digest, digest(runtimeText)) +const resources = runtimeManifest.services.find(service => service.id === 'gateway-runtime')?.runtimeResources +assert.ok(Array.isArray(resources), 'gateway runtime resources are missing') +for (const [platform, architecture, extension] of [['darwin', 'arm64', 'dylib'], ['linux', 'x64', 'so']]) { + const relative = './runtime/cli-proxy-plugins/' + platform + '/' + architecture + '/cordisx-gateway-bridge.' + + extension + const resource = resources.find(item => item.path === relative) + assert.ok(resource, 'missing ' + platform + '/' + architecture + ' bridge declaration') + assert.equal(resource.mode, 'executable') + assert.deepEqual(resource.platforms, [platform]) + assert.deepEqual(resource.architectures, [architecture]) +} +for (const resource of resources) { + assert.ok(resource.path.startsWith('./') && !resource.path.split('/').includes('..')) + const bytes = await readFile(path.join(root, resource.path)) + assert.equal(resource.byteLength, bytes.byteLength, resource.path) + assert.equal(resource.digest, digest(bytes), resource.path) +} diff --git a/scripts/test-native-integration.mjs b/scripts/test-native-integration.mjs index 7f641a9..88c54b4 100644 --- a/scripts/test-native-integration.mjs +++ b/scripts/test-native-integration.mjs @@ -25,7 +25,7 @@ await execFileAsync('go', ['test', '-mod=mod', '-count=1', '-timeout', '90s', '- cwd: work, env: { ...process.env, - CORDISX_GATEWAY_REPO: root, + CORDISX_GATEWAY_REPO: process.env.CORDISX_GATEWAY_REPO ?? root, }, maxBuffer: 16 * 1024 * 1024, }) From 3f6780ed432b5722ba73c34d6709c03dd12b7e46 Mon Sep 17 00:00:00 2001 From: YiJie Date: Wed, 25 Nov 2026 04:13:56 +0800 Subject: [PATCH 2/2] Match native gateway discovery architecture names --- scripts/build-native.mjs | 4 +++- scripts/check-release-targets.mjs | 9 +++++++-- scripts/sync-runtime-resources.mjs | 5 ++++- test/package-artifact.mjs | 4 ++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/scripts/build-native.mjs b/scripts/build-native.mjs index 4ce0112..98b190b 100644 --- a/scripts/build-native.mjs +++ b/scripts/build-native.mjs @@ -8,7 +8,9 @@ const execFileAsync = promisify(execFile) const root = fileURLToPath(new URL('../', import.meta.url)) const source = path.join(root, 'native/gateway-bridge') const extension = process.platform === 'darwin' ? '.dylib' : process.platform === 'win32' ? '.dll' : '.so' -const directory = path.join(root, 'runtime/cli-proxy-plugins', process.platform, process.arch) +// CLIProxyAPI uses Go's architecture names for plugin discovery. +const nativeArchitecture = process.arch === 'x64' ? 'amd64' : process.arch +const directory = path.join(root, 'runtime/cli-proxy-plugins', process.platform, nativeArchitecture) const output = path.join(directory, `cordisx-gateway-bridge${extension}`) if (!['darwin', 'linux', 'win32'].includes(process.platform) || !['arm64', 'x64'].includes(process.arch)) { diff --git a/scripts/check-release-targets.mjs b/scripts/check-release-targets.mjs index 588d0fb..67eaf19 100644 --- a/scripts/check-release-targets.mjs +++ b/scripts/check-release-targets.mjs @@ -15,8 +15,13 @@ const runtimeManifest = JSON.parse(runtimeText) assert.equal(packageManifest.runtimeManifest.digest, digest(runtimeText)) const resources = runtimeManifest.services.find(service => service.id === 'gateway-runtime')?.runtimeResources assert.ok(Array.isArray(resources), 'gateway runtime resources are missing') -for (const [platform, architecture, extension] of [['darwin', 'arm64', 'dylib'], ['linux', 'x64', 'so']]) { - const relative = './runtime/cli-proxy-plugins/' + platform + '/' + architecture + '/cordisx-gateway-bridge.' +for ( + const [platform, nativeArchitecture, architecture, extension] of [ + ['darwin', 'arm64', 'arm64', 'dylib'], + ['linux', 'amd64', 'x64', 'so'], + ] +) { + const relative = './runtime/cli-proxy-plugins/' + platform + '/' + nativeArchitecture + '/cordisx-gateway-bridge.' + extension const resource = resources.find(item => item.path === relative) assert.ok(resource, 'missing ' + platform + '/' + architecture + ' bridge declaration') diff --git a/scripts/sync-runtime-resources.mjs b/scripts/sync-runtime-resources.mjs index c209276..bea4658 100644 --- a/scripts/sync-runtime-resources.mjs +++ b/scripts/sync-runtime-resources.mjs @@ -29,10 +29,13 @@ for (const platform of await readdir(nativeRoot).catch(() => [])) { const directory = path.join(nativeRoot, platform, architecture) for (const file of await readdir(directory)) { if (!/^cordisx-gateway-bridge(?:\.dylib|\.so|\.dll)$/.test(file)) continue + if (!['arm64', 'amd64'].includes(architecture)) { + throw new Error('unsupported native plugin discovery architecture: ' + architecture) + } resources.push({ ...await declaration(`./runtime/cli-proxy-plugins/${platform}/${architecture}/${file}`, 'executable'), platforms: [platform], - architectures: [architecture], + architectures: [architecture === 'amd64' ? 'x64' : architecture], }) } } diff --git a/test/package-artifact.mjs b/test/package-artifact.mjs index 79e842b..d45e77e 100644 --- a/test/package-artifact.mjs +++ b/test/package-artifact.mjs @@ -111,7 +111,7 @@ test('publishes schema-valid v14 package and runtime manifests with exact reques assert.deepEqual(executableResources.map(resource => resource.path).sort(), actualExecutablePaths.sort()) for (const resource of executableResources) { const match = - /^\.\/runtime\/cli-proxy-plugins\/(darwin|linux|win32)\/(arm64|x64)\/cordisx-gateway-bridge\.(dylib|so|dll)$/ + /^\.\/runtime\/cli-proxy-plugins\/(darwin|linux|win32)\/(arm64|amd64)\/cordisx-gateway-bridge\.(dylib|so|dll)$/ .exec( resource.path, ) @@ -119,7 +119,7 @@ test('publishes schema-valid v14 package and runtime manifests with exact reques const [, platform, architecture, extension] = match assert.equal(extension, nativeExtensions[platform], `native resource extension does not match ${platform}`) assert.deepEqual(resource.platforms, [platform]) - assert.deepEqual(resource.architectures, [architecture]) + assert.deepEqual(resource.architectures, [architecture === 'amd64' ? 'x64' : architecture]) } for (const resource of gateway.runtimeResources) { const bytes = await readFile(new URL(`../${resource.path.slice(2)}`, import.meta.url))