@minniexcode/codex-switch 0.1.2 → 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/README.md +4 -2
- package/dist/runtime/copilot-adapter.js +27 -7
- package/dist/runtime/copilot-cli.js +15 -0
- package/docs/Design/codex-switch-v0.1.3-design.md +10 -0
- package/docs/PRD/codex-switch-prd-v0.1.3.md +22 -0
- package/docs/cli-usage.md +4 -2
- package/docs/codex-switch-product-overview.md +1 -1
- package/docs/codex-switch-technical-architecture.md +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@ Chinese version: [README.CN.md](./README.CN.md)
|
|
|
8
8
|
|
|
9
9
|
## Version
|
|
10
10
|
|
|
11
|
-
Current package version: `0.1.
|
|
11
|
+
Current package version: `0.1.3`
|
|
12
12
|
|
|
13
|
-
This is the current stable documentation line. `0.1.
|
|
13
|
+
This is the current stable documentation line. `0.1.3` is the Copilot login hotfix release, repairing the managed SDK client construction against the current official Copilot SDK runtime while keeping the `stream_idle_timeout_ms = 300000` Copilot projection unchanged.
|
|
14
14
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
@@ -217,7 +217,9 @@ npm pack --dry-run
|
|
|
217
217
|
- [PRD 0.1.0](./docs/PRD/codex-switch-prd-v0.1.0.md)
|
|
218
218
|
- [PRD 0.1.1](./docs/PRD/codex-switch-prd-v0.1.1.md)
|
|
219
219
|
- [PRD 0.1.2](./docs/PRD/codex-switch-prd-v0.1.2.md)
|
|
220
|
+
- [PRD 0.1.3](./docs/PRD/codex-switch-prd-v0.1.3.md)
|
|
220
221
|
- [Design 0.1.2](./docs/Design/codex-switch-v0.1.2-design.md)
|
|
222
|
+
- [Design 0.1.3](./docs/Design/codex-switch-v0.1.3-design.md)
|
|
221
223
|
|
|
222
224
|
## License
|
|
223
225
|
|
|
@@ -265,14 +265,23 @@ function createCopilotClient(sdk, runtimesDir) {
|
|
|
265
265
|
if (!ClientCtor) {
|
|
266
266
|
throw (0, errors_1.cliError)("COPILOT_SDK_API_UNSUPPORTED", "The installed Copilot SDK does not expose CopilotClient.", {});
|
|
267
267
|
}
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
268
|
+
const runtimeConnection = resolveRuntimeConnectionFactory(sdk);
|
|
269
|
+
if (!runtimeConnection?.forStdio) {
|
|
270
|
+
throw (0, errors_1.cliError)("COPILOT_SDK_API_UNSUPPORTED", "The installed Copilot SDK does not expose RuntimeConnection.forStdio().", {});
|
|
271
|
+
}
|
|
272
|
+
const runtimeInvocation = (0, copilot_cli_1.resolveCopilotSdkRuntimeInvocation)(runtimesDir);
|
|
273
|
+
if (!runtimeInvocation) {
|
|
274
|
+
throw (0, errors_1.cliError)("COPILOT_SDK_API_UNSUPPORTED", "The installed Copilot runtime is missing the @github/copilot npm loader required by the SDK.", {
|
|
275
|
+
expectedRuntimeFile: "node_modules/@github/copilot/npm-loader.js",
|
|
276
|
+
});
|
|
277
|
+
}
|
|
274
278
|
try {
|
|
275
|
-
return new ClientCtor(
|
|
279
|
+
return new ClientCtor({
|
|
280
|
+
connection: runtimeConnection.forStdio({
|
|
281
|
+
path: runtimeInvocation.path,
|
|
282
|
+
args: runtimeInvocation.args,
|
|
283
|
+
}),
|
|
284
|
+
});
|
|
276
285
|
}
|
|
277
286
|
catch (error) {
|
|
278
287
|
throw (0, errors_1.cliError)("COPILOT_SDK_API_UNSUPPORTED", "The installed Copilot SDK CopilotClient could not be constructed.", {
|
|
@@ -434,6 +443,17 @@ function resolveConstructor(target, name) {
|
|
|
434
443
|
}
|
|
435
444
|
return null;
|
|
436
445
|
}
|
|
446
|
+
function resolveRuntimeConnectionFactory(target) {
|
|
447
|
+
const direct = target.RuntimeConnection;
|
|
448
|
+
if (direct && typeof direct === "object") {
|
|
449
|
+
return direct;
|
|
450
|
+
}
|
|
451
|
+
const nestedDefault = target.default;
|
|
452
|
+
if (nestedDefault) {
|
|
453
|
+
return resolveRuntimeConnectionFactory(nestedDefault);
|
|
454
|
+
}
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
437
457
|
function resolveApproveAll(target) {
|
|
438
458
|
const direct = target.approveAll;
|
|
439
459
|
if (typeof direct === "function") {
|
|
@@ -37,6 +37,7 @@ exports.setCopilotCliSpawnImplementation = setCopilotCliSpawnImplementation;
|
|
|
37
37
|
exports.resetCopilotCliSpawnImplementation = resetCopilotCliSpawnImplementation;
|
|
38
38
|
exports.checkCopilotCliAvailable = checkCopilotCliAvailable;
|
|
39
39
|
exports.resolveCopilotCliInvocation = resolveCopilotCliInvocation;
|
|
40
|
+
exports.resolveCopilotSdkRuntimeInvocation = resolveCopilotSdkRuntimeInvocation;
|
|
40
41
|
exports.runCopilotLogin = runCopilotLogin;
|
|
41
42
|
const fs = __importStar(require("node:fs"));
|
|
42
43
|
const path = __importStar(require("node:path"));
|
|
@@ -85,6 +86,20 @@ function checkCopilotCliAvailable(runtimesDir) {
|
|
|
85
86
|
function resolveCopilotCliInvocation(args = [], runtimesDir) {
|
|
86
87
|
return getCopilotInvocation(args, runtimesDir);
|
|
87
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Resolves the explicit runtime entrypoint required by the Copilot SDK.
|
|
91
|
+
*/
|
|
92
|
+
function resolveCopilotSdkRuntimeInvocation(runtimesDir) {
|
|
93
|
+
const installDir = (0, copilot_installer_1.getCopilotRuntimeInstallDir)(runtimesDir);
|
|
94
|
+
const loaderPath = path.join(installDir, "node_modules", "@github", "copilot", "npm-loader.js");
|
|
95
|
+
if (!fs.existsSync(loaderPath)) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
path: loaderPath,
|
|
100
|
+
args: [],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
88
103
|
/**
|
|
89
104
|
* Launches the official `copilot login` flow in the current terminal.
|
|
90
105
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# codex-switch v0.1.3 Design
|
|
2
|
+
|
|
3
|
+
`0.1.3` is a targeted Copilot login compatibility repair release.
|
|
4
|
+
|
|
5
|
+
## Design Notes
|
|
6
|
+
|
|
7
|
+
- The SDK adapter constructs `CopilotClient` through `RuntimeConnection.forStdio({ path })`.
|
|
8
|
+
- The runtime path passed to the SDK resolves to the managed `@github/copilot/npm-loader.js` entrypoint.
|
|
9
|
+
- Human terminal commands such as `copilot --help` and `copilot login` continue to use the bundled `.bin` shim so interactive onboarding behavior remains unchanged.
|
|
10
|
+
- The release adds regression coverage for the constructor compatibility path and runtime loader resolution.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# codex-switch v0.1.3 PRD
|
|
2
|
+
|
|
3
|
+
## Version
|
|
4
|
+
|
|
5
|
+
- Version line: `0.1.3`
|
|
6
|
+
- Current repository package version: `0.1.3`
|
|
7
|
+
|
|
8
|
+
## Summary
|
|
9
|
+
|
|
10
|
+
`0.1.3` is a narrow hotfix release for the broken `login copilot` path. The goal is to restore compatibility with the currently supported official Copilot SDK/runtime pairing without expanding the command surface or the experimental Copilot bridge scope.
|
|
11
|
+
|
|
12
|
+
## Required Outcome
|
|
13
|
+
|
|
14
|
+
- `codexs login copilot` must no longer fail during `CopilotClient` construction when the managed SDK/runtime is installed.
|
|
15
|
+
- The SDK integration must explicitly point at the managed Copilot runtime loader instead of relying on implicit package discovery.
|
|
16
|
+
- Existing direct-provider behavior and Copilot bridge behavior remain unchanged outside the constructor compatibility fix.
|
|
17
|
+
|
|
18
|
+
## Non-Goals
|
|
19
|
+
|
|
20
|
+
- No new Copilot features or new upstream families.
|
|
21
|
+
- No migration shims or backward-compatibility preservation for older local experimental runtime state.
|
|
22
|
+
- No changes to the managed SDK pin or Node version requirements.
|
package/docs/cli-usage.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# codex-switch CLI Usage
|
|
2
2
|
|
|
3
|
-
This document describes the current `0.1.
|
|
3
|
+
This document describes the current `0.1.3` CLI contract for `@minniexcode/codex-switch`, including the Copilot login hotfix boundary.
|
|
4
4
|
|
|
5
5
|
Executable command name:
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ codexs
|
|
|
10
10
|
|
|
11
11
|
## 1. Version Context
|
|
12
12
|
|
|
13
|
-
The current package version in this repository is `0.1.
|
|
13
|
+
The current package version in this repository is `0.1.3`.
|
|
14
14
|
|
|
15
15
|
This release line targets Codex `0.134.0+`. The public contract assumes runtime routing is selected by top-level `model` plus `model_provider`, while legacy `profile` and `[profiles.*]` remain inspect-and-adopt inputs instead of the recommended runtime path.
|
|
16
16
|
|
|
@@ -287,4 +287,6 @@ codexs rollback [backup-id]
|
|
|
287
287
|
- [PRD 0.1.0](./PRD/codex-switch-prd-v0.1.0.md)
|
|
288
288
|
- [PRD 0.1.1](./PRD/codex-switch-prd-v0.1.1.md)
|
|
289
289
|
- [PRD 0.1.2](./PRD/codex-switch-prd-v0.1.2.md)
|
|
290
|
+
- [PRD 0.1.3](./PRD/codex-switch-prd-v0.1.3.md)
|
|
290
291
|
- [Design 0.1.2](./Design/codex-switch-v0.1.2-design.md)
|
|
292
|
+
- [Design 0.1.3](./Design/codex-switch-v0.1.3-design.md)
|
|
@@ -88,4 +88,4 @@ codexs migrate
|
|
|
88
88
|
- `status` / `doctor` 如何帮助定位下一步
|
|
89
89
|
- 当前运行态是用顶层 `model` 与 `model_provider` 选择活动路由
|
|
90
90
|
|
|
91
|
-
`0.1.
|
|
91
|
+
`0.1.3` 是当前已发布的 Copilot login hotfix 线。当前实现边界是:Copilot 路径要求 Node.js `>=20`,受管安装默认固定到 `@github/copilot-sdk@1.0.2`,运行时会额外拒绝过旧版本和 prerelease 版本,并通过显式 `RuntimeConnection.forStdio({ path })` 把官方 SDK 连接到受管安装中的 Copilot runtime loader;本地 bridge 仍然只是面向 simple text-oriented turns 的 experimental bridge。Direct provider 路径继续支持 Node.js `>=18`。
|
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
- [`cli-usage.md`](./cli-usage.md)
|
|
6
6
|
- [`PRD/codex-switch-prd-v0.1.0.md`](./PRD/codex-switch-prd-v0.1.0.md)
|
|
7
7
|
- [`PRD/codex-switch-prd-v0.1.1.md`](./PRD/codex-switch-prd-v0.1.1.md)
|
|
8
|
-
- [`PRD/codex-switch-prd-v0.1.2.md`](./PRD/codex-switch-prd-v0.1.2.md)
|
|
8
|
+
- [`PRD/codex-switch-prd-v0.1.2.md`](./PRD/codex-switch-prd-v0.1.2.md)
|
|
9
|
+
- [`PRD/codex-switch-prd-v0.1.3.md`](./PRD/codex-switch-prd-v0.1.3.md)
|
|
9
10
|
- [`Design/codex-switch-v0.1.0-design.md`](./Design/codex-switch-v0.1.0-design.md)
|
|
10
11
|
- [`Design/codex-switch-v0.1.1-design.md`](./Design/codex-switch-v0.1.1-design.md)
|
|
11
|
-
- [`Design/codex-switch-v0.1.2-design.md`](./Design/codex-switch-v0.1.2-design.md)
|
|
12
|
+
- [`Design/codex-switch-v0.1.2-design.md`](./Design/codex-switch-v0.1.2-design.md)
|
|
13
|
+
- [`Design/codex-switch-v0.1.3-design.md`](./Design/codex-switch-v0.1.3-design.md)
|
|
12
14
|
|
|
13
15
|
## Layers
|
|
14
16
|
|