@mininglamp-oss/octo-runtime 1.1.12 → 1.1.14
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 +1 -1
- package/apps/cli/dist/adapters.d.ts +19 -1
- package/apps/cli/dist/adapters.js +154 -28
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/codex.d.ts +5 -0
- package/apps/cli/dist/codex.js +36 -0
- package/apps/cli/dist/kernel.d.ts +4 -0
- package/apps/cli/dist/kernel.js +84 -0
- package/apps/cli/dist/main.js +8 -7
- package/apps/cli/dist/manifest.json +33 -22
- package/apps/cli/dist/output.d.ts +1 -0
- package/apps/cli/dist/output.js +8 -4
- package/apps/cli/dist/playboard.js +21 -12
- package/apps/cli/dist/provider-launch.d.ts +28 -0
- package/apps/cli/dist/provider-launch.js +52 -0
- package/apps/cli/dist/providers.d.ts +182 -0
- package/apps/cli/dist/providers.js +34 -0
- package/dist/public/adapter-sdk.d.ts +2 -0
- package/dist/public/adapter-sdk.js +2 -0
- package/dist/public/protocol.d.ts +2 -2
- package/dist/public/protocol.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +26 -10
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +44 -53
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.d.ts +10 -35
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.js +21 -29
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/agent-env.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/agent-env.js +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.d.ts +14 -68
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +77 -61
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +19 -31
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.js +28 -18
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/agent-env.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/agent-env.js +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +6 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +55 -54
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.d.ts +54 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.js +147 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/environment.js +4 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +20 -92
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +103 -217
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.js +4 -11
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.d.ts +9 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.js +77 -81
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-SMTJTIN7.js → chunk-AE3OJBDS.js} +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-H3S6WM37.js → chunk-NGR74QLF.js} +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-RISQ6NGV.js → chunk-XIUZ6GXG.js} +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +6 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +16 -21
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +14 -16
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.js +29 -46
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/agent-env.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/agent-env.js +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +4 -7
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +13 -21
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.js +47 -36
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +24 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.js +14 -7
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +24 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.js +13 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +24 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.js +14 -7
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +7 -7
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +28 -31
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +16 -25
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +113 -179
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +24 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.js +14 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +24 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.js +14 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.d.ts +48 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.js +234 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +7 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +25 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +112 -59
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/mcp.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.d.ts +11 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.js +89 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.d.ts +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.js +25 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +10 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.d.ts +19 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +154 -28
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.js +36 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.js +84 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +8 -7
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +33 -22
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +8 -4
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +21 -12
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.d.ts +28 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.js +52 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.d.ts +182 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.js +34 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +20 -20
- package/node_modules/@mininglamp-oss/octo-runtime-client/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-client/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc.schema.json +3 -104
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/protocol.schema.json +166 -1870
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +122 -65
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +13 -85
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-output-silence.d.ts +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-output-silence.js +176 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.d.ts +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +8 -4
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +17 -20
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/adapter-metadata.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.d.ts +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.js +3 -9
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-configuration.js +1 -8
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.d.ts +1 -5
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +3 -292
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/experience.js +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +18 -13
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +90 -608
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.js +32 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +7 -18
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +34 -189
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +11 -22
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +38 -78
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/multimodal.js +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +5 -40
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/package.json +34 -37
- package/packages/octo-runtime-protocol/schema/kernel-ipc.schema.json +3 -104
- package/packages/octo-runtime-protocol/schema/protocol.schema.json +166 -1870
- package/dist/public/codex.d.ts +0 -1
- package/dist/public/codex.js +0 -1
- package/dist/public/dsh.d.ts +0 -2
- package/dist/public/dsh.js +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/actmode.d.ts +0 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/actmode.js +0 -8
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-configuration-fixtures.json +0 -1219
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-fixtures.json +0 -5988
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-client.behavior.json +0 -56
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/native-invoke-fixtures.json +0 -116
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/run-protocol-fixtures.json +0 -761
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/runtime-selection-fixtures.json +0 -663
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/session-name-fixtures.json +0 -191
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.d.ts +0 -12
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.js +0 -89
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.d.ts +0 -33
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.js +0 -93
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/actmode.d.ts +0 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/actmode.js +0 -36
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.d.ts +0 -3
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.js +0 -80
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.d.ts +0 -3
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.js +0 -9
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/runtime-selection.d.ts +0 -3
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/runtime-selection.js +0 -68
- /package/node_modules/@mininglamp-oss/octo-runtime-client/{schema → fixtures}/kernel-ipc-fixtures.json +0 -0
- /package/packages/octo-runtime-protocol/{schema → test/fixtures}/kernel-ipc-fixtures.json +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
export declare const codeBuddyMetadata: AdapterMetadata;
|
|
1
3
|
import { type InteractionResponse } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
4
|
/**
|
|
3
5
|
* CodeBuddy adapter: wraps the CodeBuddy CLI spoken over ACP (Agent Client
|
|
@@ -6,7 +8,7 @@ import { type InteractionResponse } from "@mininglamp-oss/octo-runtime-protocol"
|
|
|
6
8
|
*/
|
|
7
9
|
import type { AcpUpdate } from "@mininglamp-oss/octo-runtime-acp-client";
|
|
8
10
|
import { spawnAcpClient } from "@mininglamp-oss/octo-runtime-acp-client";
|
|
9
|
-
import { type AdapterInvocationContext, type CanonicalEvent, type InvokeRequest } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
11
|
+
import { type ProbeResult, type AdapterInvocationContext, type CanonicalEvent, type InvokeRequest } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
10
12
|
/** One ACP `session/update` notification; fields are optional because their presence depends on `sessionUpdate`. */
|
|
11
13
|
interface CodeBuddyUpdate extends AcpUpdate {
|
|
12
14
|
sessionUpdate?: string;
|
|
@@ -27,40 +29,26 @@ export declare function normalizeCodeBuddyUpdate(update: CodeBuddyUpdate): Canon
|
|
|
27
29
|
* adapter 将 Provider 结果映射为唯一终态并负责关闭 client;Core 独立确认清理完成。
|
|
28
30
|
* 显式模型在 prompt 前按本次原生目录设置并确认;回执只取确认值,Provider 失败优先于部分输出及空输出检查。
|
|
29
31
|
*/
|
|
30
|
-
export declare function createCodeBuddyAdapter({ acpClientFactory, command }
|
|
32
|
+
export declare function createCodeBuddyAdapter({ acpClientFactory, command, commandArgsPrefix, env, probe }: {
|
|
31
33
|
acpClientFactory?: typeof spawnAcpClient;
|
|
32
|
-
command
|
|
34
|
+
command: string;
|
|
35
|
+
commandArgsPrefix?: readonly string[];
|
|
36
|
+
env?: NodeJS.ProcessEnv;
|
|
37
|
+
probe?: () => Promise<ProbeResult>;
|
|
33
38
|
}): Readonly<Omit<{
|
|
34
|
-
metadata:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
invoke(req: InvokeRequest, context?: AdapterInvocationContext): AsyncGenerator<CanonicalEvent>;
|
|
41
|
-
}, "metadata"> & {
|
|
42
|
-
metadata: Omit<{
|
|
43
|
-
type: string;
|
|
44
|
-
agentSources: "provisioned"[];
|
|
45
|
-
}, "protocolSupport"> & {
|
|
46
|
-
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
47
|
-
};
|
|
48
|
-
}>;
|
|
49
|
-
export declare function codeBuddyPermissionMode(mode: InvokeRequest["approvalMode"]): string;
|
|
50
|
-
export declare const codebuddyAdapter: Readonly<Omit<{
|
|
51
|
-
metadata: {
|
|
52
|
-
type: string;
|
|
53
|
-
agentSources: "provisioned"[];
|
|
54
|
-
};
|
|
55
|
-
probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
|
|
39
|
+
metadata: AdapterMetadata;
|
|
40
|
+
probe: (() => Promise<ProbeResult>) | (() => Promise<{
|
|
41
|
+
available: false;
|
|
42
|
+
command: string;
|
|
43
|
+
reason: string;
|
|
44
|
+
}>);
|
|
56
45
|
respondInteraction(invocationId: string, response: InteractionResponse): Promise<void>;
|
|
57
46
|
invoke(req: InvokeRequest, context?: AdapterInvocationContext): AsyncGenerator<CanonicalEvent>;
|
|
58
|
-
}, "metadata"> & {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
agentSources: "provisioned"[];
|
|
62
|
-
}, "protocolSupport"> & {
|
|
47
|
+
}, "metadata" | "defaultAgentEnv"> & {
|
|
48
|
+
readonly defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").AgentEnv;
|
|
49
|
+
metadata: Omit<AdapterMetadata, "protocolSupport"> & {
|
|
63
50
|
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
64
51
|
};
|
|
65
52
|
}>;
|
|
66
|
-
export
|
|
53
|
+
export declare function codeBuddyPermissionMode(mode: "ask" | "assisted" | "full_access"): string;
|
|
54
|
+
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
export const codeBuddyMetadata = {
|
|
2
|
+
type: "codebuddy"
|
|
3
|
+
};
|
|
4
|
+
import { invocationModel, invocationApprovalMode, invocationWorkdir } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
5
|
+
import { invocationEnvironment } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
6
|
import { canonicalTerminalStatus, failureMessage, hasImageInput } from "@mininglamp-oss/octo-runtime-protocol";
|
|
3
7
|
import { acpLoadSessionParams, acpNewSessionParams, acpPromptParams, spawnAcpClient } from "@mininglamp-oss/octo-runtime-acp-client";
|
|
4
|
-
import { AcpApprovalBridge, AcpTurnNormalizer, acpToolTerminalStatus, defineAdapter, normalizeAcpToolUpdate, probeCommand, providerInputText } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
8
|
+
import { AcpApprovalBridge, AcpTurnNormalizer, acpToolTerminalStatus, defineAdapter, normalizeAcpToolUpdate, probeCommand, snapshotProviderLaunch, providerInputText } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
5
9
|
/** Translate one ACP update into canonical events; unrecognized update kinds yield nothing. */
|
|
6
10
|
export function normalizeCodeBuddyUpdate(update) {
|
|
7
11
|
const type = update.sessionUpdate ?? update.type;
|
|
@@ -164,14 +168,17 @@ function promptResultText(update) {
|
|
|
164
168
|
* adapter 将 Provider 结果映射为唯一终态并负责关闭 client;Core 独立确认清理完成。
|
|
165
169
|
* 显式模型在 prompt 前按本次原生目录设置并确认;回执只取确认值,Provider 失败优先于部分输出及空输出检查。
|
|
166
170
|
*/
|
|
167
|
-
export function createCodeBuddyAdapter({ acpClientFactory = spawnAcpClient, command =
|
|
171
|
+
export function createCodeBuddyAdapter({ acpClientFactory = spawnAcpClient, command, commandArgsPrefix = [], env = {}, probe }) {
|
|
172
|
+
const launch = acpClientFactory === spawnAcpClient
|
|
173
|
+
? snapshotProviderLaunch({ command, args: commandArgsPrefix, env })
|
|
174
|
+
: { command, args: [...commandArgsPrefix], env: { ...env } };
|
|
168
175
|
const responders = new Map();
|
|
169
176
|
return defineAdapter({
|
|
170
|
-
metadata:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
177
|
+
metadata: codeBuddyMetadata,
|
|
178
|
+
probe: probe ??
|
|
179
|
+
(acpClientFactory === spawnAcpClient
|
|
180
|
+
? () => probeCommand(launch.command, { args: launch.args, env: launch.env })
|
|
181
|
+
: () => Promise.resolve({ available: false, command, reason: "probe_missing" })),
|
|
175
182
|
async respondInteraction(invocationId, response) {
|
|
176
183
|
const bridge = responders.get(invocationId);
|
|
177
184
|
if (!bridge)
|
|
@@ -187,10 +194,15 @@ export function createCodeBuddyAdapter({ acpClientFactory = spawnAcpClient, comm
|
|
|
187
194
|
responders.set(req.invocationId, permissions);
|
|
188
195
|
async function* execute() {
|
|
189
196
|
const client = await Promise.resolve(acpClientFactory({
|
|
190
|
-
command,
|
|
191
|
-
args: [
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
command: launch.command,
|
|
198
|
+
args: [
|
|
199
|
+
...launch.args,
|
|
200
|
+
"--acp",
|
|
201
|
+
"--permission-mode",
|
|
202
|
+
codeBuddyPermissionMode(invocationApprovalMode(req))
|
|
203
|
+
],
|
|
204
|
+
env: invocationEnvironment(req, {}, launch.env),
|
|
205
|
+
cwd: invocationWorkdir(req),
|
|
194
206
|
signal: req.signal,
|
|
195
207
|
permissionHandler: (params) => permissions.requestPermission(params),
|
|
196
208
|
onPermissionResponseWritten: (params) => permissions.responseWritten(params),
|
|
@@ -203,8 +215,8 @@ export function createCodeBuddyAdapter({ acpClientFactory = spawnAcpClient, comm
|
|
|
203
215
|
const requestedSessionId = req.providerSession?.sessionId;
|
|
204
216
|
const sessionMethod = requestedSessionId ? "session/load" : "session/new";
|
|
205
217
|
const sessionParams = requestedSessionId
|
|
206
|
-
? acpLoadSessionParams(requestedSessionId, { cwd: req
|
|
207
|
-
: acpNewSessionParams({ cwd: req
|
|
218
|
+
? acpLoadSessionParams(requestedSessionId, { cwd: invocationWorkdir(req) })
|
|
219
|
+
: acpNewSessionParams({ cwd: invocationWorkdir(req) });
|
|
208
220
|
const sessionRequestId = client.reserveRequestId();
|
|
209
221
|
let session;
|
|
210
222
|
const requestOptions = {
|
|
@@ -224,7 +236,7 @@ export function createCodeBuddyAdapter({ acpClientFactory = spawnAcpClient, comm
|
|
|
224
236
|
session = { id: sessionId };
|
|
225
237
|
}
|
|
226
238
|
let model = confirmedSessionModel(sessionResult);
|
|
227
|
-
const requestedModel = req
|
|
239
|
+
const requestedModel = invocationModel(req);
|
|
228
240
|
if (requestedModel) {
|
|
229
241
|
const selection = modelSelection(sessionResult, session.id, requestedModel);
|
|
230
242
|
if (selection) {
|
|
@@ -249,7 +261,7 @@ export function createCodeBuddyAdapter({ acpClientFactory = spawnAcpClient, comm
|
|
|
249
261
|
}
|
|
250
262
|
}
|
|
251
263
|
};
|
|
252
|
-
const prompt =
|
|
264
|
+
const prompt = providerInputText(req);
|
|
253
265
|
const promptParams = acpPromptParams(session.id, prompt);
|
|
254
266
|
const promptRequestId = client.reserveRequestId();
|
|
255
267
|
let promptStopReason;
|
|
@@ -368,5 +380,3 @@ export function codeBuddyPermissionMode(mode) {
|
|
|
368
380
|
function isRecord(value) {
|
|
369
381
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
370
382
|
}
|
|
371
|
-
export const codebuddyAdapter = createCodeBuddyAdapter();
|
|
372
|
-
export default codebuddyAdapter;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-adapter-codebuddy",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
9
|
-
"@mininglamp-oss/octo-runtime-acp-client": "1.1.
|
|
10
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
8
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.14",
|
|
9
|
+
"@mininglamp-oss/octo-runtime-acp-client": "1.1.14",
|
|
10
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.14"
|
|
11
11
|
},
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"files": [
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { agentEnvItem } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
/** 只读本轮私有 item;省略不补模式,非法显式值在原生映射前拒绝。 */
|
|
3
|
+
export function codexCollaborationMode(request) {
|
|
4
|
+
const value = agentEnvItem(request.agentEnv, "adapter.codex", "options")?.collaborationMode;
|
|
5
|
+
if (value === undefined)
|
|
6
|
+
return undefined;
|
|
7
|
+
if (value !== "default" && value !== "plan")
|
|
8
|
+
throw new TypeError("ADAPTER_OPTION_INVALID: codex.collaborationMode");
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CodexChannel, CodexTurnConfiguration } from "./engine.js";
|
|
2
2
|
/**
|
|
3
3
|
* Codex app-server transport and event adaptation layer.
|
|
4
4
|
*
|
|
@@ -34,13 +34,14 @@ export interface CodexAppServerCommand {
|
|
|
34
34
|
/** Executable and app-server args; tests can substitute a fake server. */
|
|
35
35
|
command: string;
|
|
36
36
|
args: string[];
|
|
37
|
-
|
|
37
|
+
/** 独占命令可显式指定;managed server 省略,业务目录由 thread/turn RPC 提供。 */
|
|
38
|
+
cwd?: string;
|
|
38
39
|
env: NodeJS.ProcessEnv;
|
|
39
40
|
mcpServers?: Record<string, Record<string, unknown>>;
|
|
40
41
|
cleanup?: () => void | Promise<void>;
|
|
41
42
|
}
|
|
42
43
|
export type CodexAppServerSpawn = (command: string, args: readonly string[], options: {
|
|
43
|
-
cwd
|
|
44
|
+
cwd?: string;
|
|
44
45
|
env: NodeJS.ProcessEnv;
|
|
45
46
|
}) => ChildProcessWithoutNullStreams;
|
|
46
47
|
/** A JSON-RPC error the app-server explicitly returned, preserving method, code and raw data. */
|
|
@@ -69,8 +70,8 @@ export declare function buildCodexAppServerArgs(): string[];
|
|
|
69
70
|
*/
|
|
70
71
|
export declare function runCodexAppServerTurn({ request, spec, channel, context, onInteractionResponder, onNativeResponder }: {
|
|
71
72
|
request: InvokeRequest;
|
|
72
|
-
spec:
|
|
73
|
-
channel?:
|
|
73
|
+
spec: CodexTurnConfiguration;
|
|
74
|
+
channel?: CodexChannel;
|
|
74
75
|
context?: AdapterInvocationContext;
|
|
75
76
|
onInteractionResponder?: (responder: CodexInteractionResponder | undefined) => void;
|
|
76
77
|
onNativeResponder?: (responder: ((response: NativeInteractionResponse) => Promise<void>) | undefined) => void;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { codexCollaborationMode } from "./agent-env.js";
|
|
2
|
+
import { invocationModel, invocationEffort, invocationProviderOptions, invocationOption, invocationApprovalMode, invocationWorkdir } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
3
|
+
import { invocationEnvs, mapReasoningEffort } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
4
|
+
import { canonicalTerminalStatus, classifyFailure, isCodexLocalFailureReason, isStreamCapacityReason, contextHash, assertJsonByteLimit, providerInputParts, PROVIDER_DIAGNOSTIC_MAX_BYTES, resolveStreamLimitPolicy, streamCapacityError } from "@mininglamp-oss/octo-runtime-protocol";
|
|
3
5
|
import { codexTransportError } from "./stdin-writer.js";
|
|
4
6
|
import { codexEnvironmentConfig } from "./environment.js";
|
|
5
7
|
import { CodexAsyncQuestions, asyncQuestionMetadata } from "./async-questions.js";
|
|
@@ -64,7 +66,7 @@ export function buildCodexAppServerArgs() {
|
|
|
64
66
|
*/
|
|
65
67
|
export async function* runCodexAppServerTurn({ request, spec, channel, context, onInteractionResponder, onNativeResponder }) {
|
|
66
68
|
const requestTimeoutMs = appServerRequestTimeout(request);
|
|
67
|
-
const interactive = request
|
|
69
|
+
const interactive = invocationApprovalMode(request) !== "full_access";
|
|
68
70
|
if (!channel)
|
|
69
71
|
throw codexTransportError("CODEX_SERVICE_SCOPE_REQUIRED");
|
|
70
72
|
const client = new CodexAppServerClient(channel, requestTimeoutMs, interactive, request, context);
|
|
@@ -75,9 +77,12 @@ export async function* runCodexAppServerTurn({ request, spec, channel, context,
|
|
|
75
77
|
try {
|
|
76
78
|
throwIfAborted(request.signal);
|
|
77
79
|
// 作用域已完成服务初始化;这里仅装配本轮 thread/turn,不重复握手。
|
|
78
|
-
let environmentConfig;
|
|
80
|
+
let environmentConfig = spec.config;
|
|
79
81
|
if (Object.keys(invocationEnvs(request)).length || spec.mcpServers) {
|
|
80
|
-
const result = recordValue(await client.request("config/read", {
|
|
82
|
+
const result = recordValue(await client.request("config/read", {
|
|
83
|
+
includeLayers: false,
|
|
84
|
+
cwd: invocationWorkdir(request)
|
|
85
|
+
}));
|
|
81
86
|
const config = recordValue(result?.config);
|
|
82
87
|
if (!config)
|
|
83
88
|
throw new Error("CONTEXT_ENVS_UNAVAILABLE: provider effective configuration is missing");
|
|
@@ -88,10 +93,13 @@ export async function* runCodexAppServerTurn({ request, spec, channel, context,
|
|
|
88
93
|
code: "MCP_SERVER_NAME_CONFLICT"
|
|
89
94
|
});
|
|
90
95
|
}
|
|
91
|
-
environmentConfig =
|
|
92
|
-
...config,
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
environmentConfig = {
|
|
97
|
+
...spec.config,
|
|
98
|
+
...codexEnvironmentConfig(request, {
|
|
99
|
+
...config,
|
|
100
|
+
mcp_servers: { ...nativeServers, ...spec.mcpServers }
|
|
101
|
+
})
|
|
102
|
+
};
|
|
95
103
|
if (spec.mcpServers) {
|
|
96
104
|
const forwarding = recordValue(environmentConfig.mcp_servers) ?? {};
|
|
97
105
|
// config/read is a read model: optional nulls cannot be round-tripped as overrides.
|
|
@@ -138,37 +146,39 @@ export async function* runCodexAppServerTurn({ request, spec, channel, context,
|
|
|
138
146
|
// 名称属于调用方;只命名本轮新建 thread,恢复时保留原生标题与句柄。
|
|
139
147
|
if (!resumed && request.sessionName)
|
|
140
148
|
await client.request("thread/name/set", { threadId, name: request.sessionName });
|
|
141
|
-
const requestedMode =
|
|
142
|
-
let collaborationMode;
|
|
143
|
-
let effectiveMode;
|
|
149
|
+
const requestedMode = codexCollaborationMode(request);
|
|
144
150
|
if (requestedMode !== undefined) {
|
|
145
151
|
const modes = recordValue(await client.request("collaborationMode/list", {}));
|
|
146
152
|
const available = Array.isArray(modes?.data) ? modes.data.map(recordValue) : [];
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
if (!available.some((mode) => mode?.mode === requestedMode))
|
|
154
|
+
throw new Error("CODEX_COLLABORATION_MODE_UNSUPPORTED");
|
|
155
|
+
}
|
|
156
|
+
// 恢复线程转为 fresh fallback 时必须重新读取新线程的模型,不能沿用旧线程默认值。
|
|
157
|
+
const collaborationSettings = () => {
|
|
158
|
+
if (requestedMode === undefined)
|
|
159
|
+
return undefined;
|
|
152
160
|
const thread = recordValue(threadResult);
|
|
153
|
-
const model = request
|
|
161
|
+
const model = invocationModel(request) ?? stringValue(thread?.model);
|
|
154
162
|
if (!model)
|
|
155
|
-
throw new Error("
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
throw new Error("CODEX_COLLABORATION_MODE_UNCONFIRMED: Codex omitted its effective model");
|
|
164
|
+
return {
|
|
165
|
+
collaborationMode: {
|
|
166
|
+
mode: requestedMode,
|
|
167
|
+
settings: {
|
|
168
|
+
model,
|
|
169
|
+
reasoning_effort: mapReasoningEffort("codex", invocationEffort(request)) ??
|
|
170
|
+
thread?.reasoningEffort ??
|
|
171
|
+
null,
|
|
172
|
+
developer_instructions: null
|
|
173
|
+
}
|
|
164
174
|
}
|
|
165
175
|
};
|
|
166
|
-
}
|
|
176
|
+
};
|
|
167
177
|
let turnResult;
|
|
168
178
|
try {
|
|
169
179
|
turnResult = await client.request("turn/start", {
|
|
170
180
|
...turnParams(request, threadId, resumeFallback !== undefined),
|
|
171
|
-
...(
|
|
181
|
+
...collaborationSettings()
|
|
172
182
|
});
|
|
173
183
|
}
|
|
174
184
|
catch (error) {
|
|
@@ -187,21 +197,13 @@ export async function* runCodexAppServerTurn({ request, spec, channel, context,
|
|
|
187
197
|
await client.request("thread/name/set", { threadId, name: request.sessionName });
|
|
188
198
|
turnResult = await client.request("turn/start", {
|
|
189
199
|
...turnParams(request, threadId, true),
|
|
190
|
-
...(
|
|
200
|
+
...collaborationSettings()
|
|
191
201
|
});
|
|
192
202
|
}
|
|
193
203
|
const turnId = extractTurnId(turnResult);
|
|
194
204
|
if (turnId)
|
|
195
205
|
client.setActiveTurn(turnId);
|
|
196
206
|
context?.reportActivity?.({ kind: "turn_started", method: "turn_start" });
|
|
197
|
-
if (requestedMode !== undefined && effectiveMode !== undefined)
|
|
198
|
-
yield actmodeEvidence({
|
|
199
|
-
requested: requestedMode,
|
|
200
|
-
effective: effectiveMode,
|
|
201
|
-
status: effectiveMode === requestedMode ? "applied" : "fallback",
|
|
202
|
-
nativeMode: effectiveMode,
|
|
203
|
-
...(effectiveMode !== requestedMode ? { reason: "provider_unsupported" } : {})
|
|
204
|
-
}, context?.protocolMode);
|
|
205
207
|
// turn/start 成功后才发布权威会话更新,供调用方保存完整 binding;Core 不持久化业务会话绑定。
|
|
206
208
|
const session = {
|
|
207
209
|
protocolVersion: 2,
|
|
@@ -1051,7 +1053,7 @@ class CodexAppServerClient {
|
|
|
1051
1053
|
!this.#activeTurnId)
|
|
1052
1054
|
return;
|
|
1053
1055
|
this.#clearFinalizationTimer();
|
|
1054
|
-
const configured = recordValue(this.invocation
|
|
1056
|
+
const configured = recordValue(invocationProviderOptions(this.invocation, "codex"))?.finalizationTimeoutMs;
|
|
1055
1057
|
const timeoutMs = typeof configured === "number" && Number.isFinite(configured) && configured > 0
|
|
1056
1058
|
? configured
|
|
1057
1059
|
: FINALIZATION_TIMEOUT_MS;
|
|
@@ -1621,8 +1623,8 @@ class CodexAppServerClient {
|
|
|
1621
1623
|
? {
|
|
1622
1624
|
schema: "octo.approval-request/v1",
|
|
1623
1625
|
policy: {
|
|
1624
|
-
mode: this.invocation
|
|
1625
|
-
hash: contextHash(this.invocation.
|
|
1626
|
+
mode: invocationApprovalMode(this.invocation),
|
|
1627
|
+
hash: contextHash(this.invocation.agentEnv)
|
|
1626
1628
|
},
|
|
1627
1629
|
operation: {
|
|
1628
1630
|
kind: method.includes("fileChange") || method === "applyPatchApproval"
|
|
@@ -1799,14 +1801,13 @@ class CodexAppServerClient {
|
|
|
1799
1801
|
function threadParams(request, extra, environmentConfig) {
|
|
1800
1802
|
return {
|
|
1801
1803
|
...extra,
|
|
1802
|
-
cwd: request
|
|
1803
|
-
...(request
|
|
1804
|
+
cwd: invocationWorkdir(request),
|
|
1805
|
+
...(invocationModel(request) ? { model: invocationModel(request) } : {}),
|
|
1804
1806
|
sandbox: codexSandbox(request),
|
|
1805
1807
|
// Dynamic MCP tools are untrusted until Codex asks the client to approve them. `never`
|
|
1806
1808
|
// rejects those calls before the existing reverse-request handler can answer them.
|
|
1807
|
-
approvalPolicy: request
|
|
1808
|
-
...(environmentConfig ? { config: environmentConfig } : {})
|
|
1809
|
-
...(extra.threadId ? {} : { developerInstructions: request.controlInstructions })
|
|
1809
|
+
approvalPolicy: invocationApprovalMode(request) === "assisted" ? "on-request" : "untrusted",
|
|
1810
|
+
...(environmentConfig ? { config: environmentConfig } : {})
|
|
1810
1811
|
};
|
|
1811
1812
|
}
|
|
1812
1813
|
/**
|
|
@@ -1816,7 +1817,7 @@ function threadParams(request, extra, environmentConfig) {
|
|
|
1816
1817
|
* publishing summaryTextDelta, so a UI might see only an empty analysis lifecycle.
|
|
1817
1818
|
*/
|
|
1818
1819
|
function turnParams(request, threadId, freshFallback = false) {
|
|
1819
|
-
const effort = mapReasoningEffort("codex", request
|
|
1820
|
+
const effort = mapReasoningEffort("codex", invocationEffort(request));
|
|
1820
1821
|
return {
|
|
1821
1822
|
threadId,
|
|
1822
1823
|
input: [
|
|
@@ -1824,8 +1825,8 @@ function turnParams(request, threadId, freshFallback = false) {
|
|
|
1824
1825
|
? { type: "image", url: `data:${part.mimeType};base64,${part.data}` }
|
|
1825
1826
|
: { type: "text", text: part.text, text_elements: [] })
|
|
1826
1827
|
],
|
|
1827
|
-
cwd: request
|
|
1828
|
-
...(request
|
|
1828
|
+
cwd: invocationWorkdir(request),
|
|
1829
|
+
...(invocationModel(request) ? { model: invocationModel(request) } : {}),
|
|
1829
1830
|
...(effort ? { effort } : {}),
|
|
1830
1831
|
summary: codexReasoningSummary(request)
|
|
1831
1832
|
};
|
|
@@ -1836,7 +1837,7 @@ function turnParams(request, threadId, freshFallback = false) {
|
|
|
1836
1837
|
* disable it via providerOptions.reasoningSummary.
|
|
1837
1838
|
*/
|
|
1838
1839
|
function codexReasoningSummary(request) {
|
|
1839
|
-
const configured = recordValue(request
|
|
1840
|
+
const configured = recordValue(invocationProviderOptions(request, "codex"))?.reasoningSummary;
|
|
1840
1841
|
const value = typeof configured === "string" ? configured : "auto";
|
|
1841
1842
|
if (!["auto", "concise", "detailed", "none"].includes(value)) {
|
|
1842
1843
|
throw new Error(`unsupported Codex reasoning summary: ${value}`);
|
|
@@ -1844,18 +1845,18 @@ function codexReasoningSummary(request) {
|
|
|
1844
1845
|
return value;
|
|
1845
1846
|
}
|
|
1846
1847
|
function codexSandbox(request) {
|
|
1847
|
-
const value = request
|
|
1848
|
+
const value = invocationApprovalMode(request) === "full_access"
|
|
1848
1849
|
? "danger-full-access"
|
|
1849
|
-
: (request
|
|
1850
|
+
: (invocationOption(request, "sandbox", "codex") ?? "workspace-write");
|
|
1850
1851
|
if (!["read-only", "workspace-write", "danger-full-access"].includes(value)) {
|
|
1851
1852
|
throw new Error(`unsupported Codex sandbox mode: ${value}`);
|
|
1852
1853
|
}
|
|
1853
|
-
if (request
|
|
1854
|
+
if (invocationApprovalMode(request) !== "full_access" && value === "danger-full-access")
|
|
1854
1855
|
throw new Error("APPROVAL_SANDBOX_CONFLICT");
|
|
1855
1856
|
return value;
|
|
1856
1857
|
}
|
|
1857
1858
|
function appServerRequestTimeout(request) {
|
|
1858
|
-
const configured = recordValue(request
|
|
1859
|
+
const configured = recordValue(invocationProviderOptions(request, "codex"))?.appServerRequestTimeoutMs;
|
|
1859
1860
|
return typeof configured === "number" && Number.isFinite(configured) && configured > 0
|
|
1860
1861
|
? configured
|
|
1861
1862
|
: APP_SERVER_REQUEST_TIMEOUT_MS;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type AdapterInvocationContext, type AdapterScopeCleanup, type InvokeRequest, type ProbeResult, type ServiceProcessSnapshot } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
import { type CodexAppServerCommand, type CodexAppServerSpawn } from "./app-server.js";
|
|
3
|
+
/** Codex 专用单调用通道;close 只释放本调用,不能关闭共享 Engine。 */
|
|
4
|
+
export interface CodexChannel {
|
|
5
|
+
onMessage: (message: Record<string, unknown>) => void;
|
|
6
|
+
onFailure: (error: Error) => void;
|
|
7
|
+
reserveRequestId(): string | number;
|
|
8
|
+
write(message: Record<string, unknown>, onError: (error: Error) => void, onWritten?: () => void, options?: {
|
|
9
|
+
control?: boolean;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
}): () => void;
|
|
12
|
+
cancelPending(error: Error): void;
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
errorMessage(error: unknown): string;
|
|
15
|
+
}
|
|
16
|
+
/** 本轮协议配置,不向借用者暴露 spawn 或进程 cleanup。 */
|
|
17
|
+
export type CodexTurnConfiguration = Pick<CodexAppServerCommand, "mcpServers"> & {
|
|
18
|
+
config?: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
export interface CodexEngineLease {
|
|
21
|
+
channel: CodexChannel;
|
|
22
|
+
configuration: CodexTurnConfiguration;
|
|
23
|
+
}
|
|
24
|
+
/** 这是 Codex 专用访问依赖;不限制其他 Adapter 的构造参数。 */
|
|
25
|
+
export interface CodexEngineProvider {
|
|
26
|
+
readonly codexHome: string;
|
|
27
|
+
acquire(request: InvokeRequest, context?: AdapterInvocationContext): Promise<CodexEngineLease>;
|
|
28
|
+
probe?(): Promise<ProbeResult>;
|
|
29
|
+
}
|
|
30
|
+
/** 宿主持有 owner 并最终关闭;Adapter 仅接收不含 close 的 provider。 */
|
|
31
|
+
export interface ManagedCodexEngine {
|
|
32
|
+
readonly provider: CodexEngineProvider;
|
|
33
|
+
processes(): readonly ServiceProcessSnapshot[];
|
|
34
|
+
beginShutdown(): void;
|
|
35
|
+
close(options: {
|
|
36
|
+
deadline: number;
|
|
37
|
+
}): Promise<AdapterScopeCleanup>;
|
|
38
|
+
}
|
|
39
|
+
export interface ManagedCodexEngineOptions {
|
|
40
|
+
codexHome: string;
|
|
41
|
+
command: string;
|
|
42
|
+
commandArgsPrefix?: readonly string[];
|
|
43
|
+
appServerArgs?: string[];
|
|
44
|
+
spawnFn?: CodexAppServerSpawn;
|
|
45
|
+
env?: NodeJS.ProcessEnv;
|
|
46
|
+
}
|
|
47
|
+
/** Home 由宿主提供和准备;库不选择、创建或修改持久目录。 */
|
|
48
|
+
export declare function assertCodexHome(home: unknown): asserts home is string;
|
|
49
|
+
/** 本轮不能通过环境覆盖宿主已绑定的 Home。 */
|
|
50
|
+
export declare function assertCodexInvocationHome(request: InvokeRequest, home: string): void;
|
|
51
|
+
/** 构造命令不启动进程;显式环境必须含 Home,不回退 ~/.codex。 */
|
|
52
|
+
export declare function buildCodexCommand(req: InvokeRequest, command: string, appServerArgs?: string[], env?: NodeJS.ProcessEnv): CodexAppServerCommand;
|
|
53
|
+
/** 宿主显式拥有唯一 app-server;本轮配置只进入 thread,不参与进程选择。 */
|
|
54
|
+
export declare function createManagedCodexEngine({ codexHome, command, commandArgsPrefix, appServerArgs, spawnFn, env }: ManagedCodexEngineOptions): ManagedCodexEngine;
|