@mininglamp-oss/octo-runtime 1.1.12 → 1.1.13
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 +153 -23
- 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 +1 -1
- 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 +15 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +24 -28
- 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 +22 -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/index.d.ts +14 -68
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +60 -43
- 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 +29 -18
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
- 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 +32 -26
- 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 +104 -216
- 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/index.d.ts +4 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +12 -14
- 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 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.js +23 -30
- 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 +48 -26
- 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 +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.js +15 -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 +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.js +14 -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 +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.js +15 -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 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +27 -29
- 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 +109 -178
- 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 +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.js +15 -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 +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.js +15 -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 +49 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.js +256 -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 -12
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +116 -58
- 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 +153 -23
- 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 +173 -1295
- 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 +26 -54
- 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/watchdog.d.ts +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +5 -0
- 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/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 -5
- 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 -2
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +3 -267
- 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 +17 -3
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +102 -396
- 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 +6 -15
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +33 -178
- 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 -28
- 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 +173 -1295
- 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-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/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-client/{schema → fixtures}/kernel-ipc-fixtures.json +0 -0
- /package/packages/octo-runtime-protocol/{schema → test/fixtures}/kernel-ipc-fixtures.json +0 -0
|
@@ -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,3 +1,4 @@
|
|
|
1
|
+
import { invocationModel, invocationEffort, invocationProviderOptions, invocationOption, invocationApprovalMode, invocationWorkdir } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
1
2
|
import { actmodeEvidence, invocationEnvs, mapReasoningEffort } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
3
|
import { canonicalTerminalStatus, classifyFailure, isCodexLocalFailureReason, isStreamCapacityReason, contextHash, contextActmode, assertJsonByteLimit, providerInputParts, PROVIDER_DIAGNOSTIC_MAX_BYTES, resolveStreamLimitPolicy, streamCapacityError } from "@mininglamp-oss/octo-runtime-protocol";
|
|
3
4
|
import { codexTransportError } from "./stdin-writer.js";
|
|
@@ -64,7 +65,7 @@ export function buildCodexAppServerArgs() {
|
|
|
64
65
|
*/
|
|
65
66
|
export async function* runCodexAppServerTurn({ request, spec, channel, context, onInteractionResponder, onNativeResponder }) {
|
|
66
67
|
const requestTimeoutMs = appServerRequestTimeout(request);
|
|
67
|
-
const interactive = request
|
|
68
|
+
const interactive = invocationApprovalMode(request) !== "full_access";
|
|
68
69
|
if (!channel)
|
|
69
70
|
throw codexTransportError("CODEX_SERVICE_SCOPE_REQUIRED");
|
|
70
71
|
const client = new CodexAppServerClient(channel, requestTimeoutMs, interactive, request, context);
|
|
@@ -75,9 +76,12 @@ export async function* runCodexAppServerTurn({ request, spec, channel, context,
|
|
|
75
76
|
try {
|
|
76
77
|
throwIfAborted(request.signal);
|
|
77
78
|
// 作用域已完成服务初始化;这里仅装配本轮 thread/turn,不重复握手。
|
|
78
|
-
let environmentConfig;
|
|
79
|
+
let environmentConfig = spec.config;
|
|
79
80
|
if (Object.keys(invocationEnvs(request)).length || spec.mcpServers) {
|
|
80
|
-
const result = recordValue(await client.request("config/read", {
|
|
81
|
+
const result = recordValue(await client.request("config/read", {
|
|
82
|
+
includeLayers: false,
|
|
83
|
+
cwd: invocationWorkdir(request)
|
|
84
|
+
}));
|
|
81
85
|
const config = recordValue(result?.config);
|
|
82
86
|
if (!config)
|
|
83
87
|
throw new Error("CONTEXT_ENVS_UNAVAILABLE: provider effective configuration is missing");
|
|
@@ -88,10 +92,13 @@ export async function* runCodexAppServerTurn({ request, spec, channel, context,
|
|
|
88
92
|
code: "MCP_SERVER_NAME_CONFLICT"
|
|
89
93
|
});
|
|
90
94
|
}
|
|
91
|
-
environmentConfig =
|
|
92
|
-
...config,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
environmentConfig = {
|
|
96
|
+
...spec.config,
|
|
97
|
+
...codexEnvironmentConfig(request, {
|
|
98
|
+
...config,
|
|
99
|
+
mcp_servers: { ...nativeServers, ...spec.mcpServers }
|
|
100
|
+
})
|
|
101
|
+
};
|
|
95
102
|
if (spec.mcpServers) {
|
|
96
103
|
const forwarding = recordValue(environmentConfig.mcp_servers) ?? {};
|
|
97
104
|
// config/read is a read model: optional nulls cannot be round-tripped as overrides.
|
|
@@ -138,7 +145,7 @@ export async function* runCodexAppServerTurn({ request, spec, channel, context,
|
|
|
138
145
|
// 名称属于调用方;只命名本轮新建 thread,恢复时保留原生标题与句柄。
|
|
139
146
|
if (!resumed && request.sessionName)
|
|
140
147
|
await client.request("thread/name/set", { threadId, name: request.sessionName });
|
|
141
|
-
const requestedMode = contextActmode(request.
|
|
148
|
+
const requestedMode = contextActmode(request.agentEnv);
|
|
142
149
|
let collaborationMode;
|
|
143
150
|
let effectiveMode;
|
|
144
151
|
if (requestedMode !== undefined) {
|
|
@@ -150,14 +157,14 @@ export async function* runCodexAppServerTurn({ request, spec, channel, context,
|
|
|
150
157
|
if (!available.some((mode) => mode?.mode === effectiveMode))
|
|
151
158
|
throw new Error("ACTMODE_UNSUPPORTED: Codex did not advertise a default collaboration mode");
|
|
152
159
|
const thread = recordValue(threadResult);
|
|
153
|
-
const model = request
|
|
160
|
+
const model = invocationModel(request) ?? stringValue(thread?.model);
|
|
154
161
|
if (!model)
|
|
155
162
|
throw new Error("ACTMODE_UNCONFIRMED: Codex omitted its effective model");
|
|
156
163
|
collaborationMode = {
|
|
157
164
|
mode: effectiveMode,
|
|
158
165
|
settings: {
|
|
159
166
|
model,
|
|
160
|
-
reasoning_effort: mapReasoningEffort("codex", request
|
|
167
|
+
reasoning_effort: mapReasoningEffort("codex", invocationEffort(request)) ??
|
|
161
168
|
thread?.reasoningEffort ??
|
|
162
169
|
null,
|
|
163
170
|
developer_instructions: null
|
|
@@ -1051,7 +1058,7 @@ class CodexAppServerClient {
|
|
|
1051
1058
|
!this.#activeTurnId)
|
|
1052
1059
|
return;
|
|
1053
1060
|
this.#clearFinalizationTimer();
|
|
1054
|
-
const configured = recordValue(this.invocation
|
|
1061
|
+
const configured = recordValue(invocationProviderOptions(this.invocation, "codex"))?.finalizationTimeoutMs;
|
|
1055
1062
|
const timeoutMs = typeof configured === "number" && Number.isFinite(configured) && configured > 0
|
|
1056
1063
|
? configured
|
|
1057
1064
|
: FINALIZATION_TIMEOUT_MS;
|
|
@@ -1621,8 +1628,8 @@ class CodexAppServerClient {
|
|
|
1621
1628
|
? {
|
|
1622
1629
|
schema: "octo.approval-request/v1",
|
|
1623
1630
|
policy: {
|
|
1624
|
-
mode: this.invocation
|
|
1625
|
-
hash: contextHash(this.invocation.
|
|
1631
|
+
mode: invocationApprovalMode(this.invocation),
|
|
1632
|
+
hash: contextHash(this.invocation.agentEnv)
|
|
1626
1633
|
},
|
|
1627
1634
|
operation: {
|
|
1628
1635
|
kind: method.includes("fileChange") || method === "applyPatchApproval"
|
|
@@ -1799,14 +1806,13 @@ class CodexAppServerClient {
|
|
|
1799
1806
|
function threadParams(request, extra, environmentConfig) {
|
|
1800
1807
|
return {
|
|
1801
1808
|
...extra,
|
|
1802
|
-
cwd: request
|
|
1803
|
-
...(request
|
|
1809
|
+
cwd: invocationWorkdir(request),
|
|
1810
|
+
...(invocationModel(request) ? { model: invocationModel(request) } : {}),
|
|
1804
1811
|
sandbox: codexSandbox(request),
|
|
1805
1812
|
// Dynamic MCP tools are untrusted until Codex asks the client to approve them. `never`
|
|
1806
1813
|
// 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 })
|
|
1814
|
+
approvalPolicy: invocationApprovalMode(request) === "assisted" ? "on-request" : "untrusted",
|
|
1815
|
+
...(environmentConfig ? { config: environmentConfig } : {})
|
|
1810
1816
|
};
|
|
1811
1817
|
}
|
|
1812
1818
|
/**
|
|
@@ -1816,7 +1822,7 @@ function threadParams(request, extra, environmentConfig) {
|
|
|
1816
1822
|
* publishing summaryTextDelta, so a UI might see only an empty analysis lifecycle.
|
|
1817
1823
|
*/
|
|
1818
1824
|
function turnParams(request, threadId, freshFallback = false) {
|
|
1819
|
-
const effort = mapReasoningEffort("codex", request
|
|
1825
|
+
const effort = mapReasoningEffort("codex", invocationEffort(request));
|
|
1820
1826
|
return {
|
|
1821
1827
|
threadId,
|
|
1822
1828
|
input: [
|
|
@@ -1824,8 +1830,8 @@ function turnParams(request, threadId, freshFallback = false) {
|
|
|
1824
1830
|
? { type: "image", url: `data:${part.mimeType};base64,${part.data}` }
|
|
1825
1831
|
: { type: "text", text: part.text, text_elements: [] })
|
|
1826
1832
|
],
|
|
1827
|
-
cwd: request
|
|
1828
|
-
...(request
|
|
1833
|
+
cwd: invocationWorkdir(request),
|
|
1834
|
+
...(invocationModel(request) ? { model: invocationModel(request) } : {}),
|
|
1829
1835
|
...(effort ? { effort } : {}),
|
|
1830
1836
|
summary: codexReasoningSummary(request)
|
|
1831
1837
|
};
|
|
@@ -1836,7 +1842,7 @@ function turnParams(request, threadId, freshFallback = false) {
|
|
|
1836
1842
|
* disable it via providerOptions.reasoningSummary.
|
|
1837
1843
|
*/
|
|
1838
1844
|
function codexReasoningSummary(request) {
|
|
1839
|
-
const configured = recordValue(request
|
|
1845
|
+
const configured = recordValue(invocationProviderOptions(request, "codex"))?.reasoningSummary;
|
|
1840
1846
|
const value = typeof configured === "string" ? configured : "auto";
|
|
1841
1847
|
if (!["auto", "concise", "detailed", "none"].includes(value)) {
|
|
1842
1848
|
throw new Error(`unsupported Codex reasoning summary: ${value}`);
|
|
@@ -1844,18 +1850,18 @@ function codexReasoningSummary(request) {
|
|
|
1844
1850
|
return value;
|
|
1845
1851
|
}
|
|
1846
1852
|
function codexSandbox(request) {
|
|
1847
|
-
const value = request
|
|
1853
|
+
const value = invocationApprovalMode(request) === "full_access"
|
|
1848
1854
|
? "danger-full-access"
|
|
1849
|
-
: (request
|
|
1855
|
+
: (invocationOption(request, "sandbox", "codex") ?? "workspace-write");
|
|
1850
1856
|
if (!["read-only", "workspace-write", "danger-full-access"].includes(value)) {
|
|
1851
1857
|
throw new Error(`unsupported Codex sandbox mode: ${value}`);
|
|
1852
1858
|
}
|
|
1853
|
-
if (request
|
|
1859
|
+
if (invocationApprovalMode(request) !== "full_access" && value === "danger-full-access")
|
|
1854
1860
|
throw new Error("APPROVAL_SANDBOX_CONFLICT");
|
|
1855
1861
|
return value;
|
|
1856
1862
|
}
|
|
1857
1863
|
function appServerRequestTimeout(request) {
|
|
1858
|
-
const configured = recordValue(request
|
|
1864
|
+
const configured = recordValue(invocationProviderOptions(request, "codex"))?.appServerRequestTimeoutMs;
|
|
1859
1865
|
return typeof configured === "number" && Number.isFinite(configured) && configured > 0
|
|
1860
1866
|
? configured
|
|
1861
1867
|
: 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;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { isAbsolute } from "node:path";
|
|
3
|
+
import { invocationEnvironment, invocationEnvs, invocationProviderOptions, invocationWorkdir, mergeProcessEnvironment, processEnvironmentValue, probeCommand, snapshotProviderLaunch } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
4
|
+
import { hasImageInput, resolveStreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
|
|
5
|
+
import { buildCodexAppServerArgs } from "./app-server.js";
|
|
6
|
+
import { codexMcpConfig } from "./mcp.js";
|
|
7
|
+
import { CodexService } from "./service.js";
|
|
8
|
+
/** Home 由宿主提供和准备;库不选择、创建或修改持久目录。 */
|
|
9
|
+
export function assertCodexHome(home) {
|
|
10
|
+
if (typeof home !== "string" || !isAbsolute(home) || home.includes("\0"))
|
|
11
|
+
throw new TypeError("CODEX_HOME_REQUIRED");
|
|
12
|
+
}
|
|
13
|
+
/** 本轮不能通过环境覆盖宿主已绑定的 Home。 */
|
|
14
|
+
export function assertCodexInvocationHome(request, home) {
|
|
15
|
+
const override = processEnvironmentValue(invocationEnvs(request), "CODEX_HOME");
|
|
16
|
+
if (override !== undefined && override !== home)
|
|
17
|
+
throw new Error("CODEX_HOME_CONFLICT");
|
|
18
|
+
}
|
|
19
|
+
/** 构造命令不启动进程;显式环境必须含 Home,不回退 ~/.codex。 */
|
|
20
|
+
export function buildCodexCommand(req, command, appServerArgs = buildCodexAppServerArgs(), env = {}) {
|
|
21
|
+
const home = processEnvironmentValue(env, "CODEX_HOME");
|
|
22
|
+
assertCodexHome(home);
|
|
23
|
+
assertCodexInvocationHome(req, home);
|
|
24
|
+
const runEnv = invocationEnvironment(req, { CODEX_HOME: home }, env);
|
|
25
|
+
const mcp = codexMcpConfig(req, runEnv);
|
|
26
|
+
return {
|
|
27
|
+
command,
|
|
28
|
+
args: [...appServerArgs, ...nativeCapacityOverrides(req)],
|
|
29
|
+
cwd: invocationWorkdir(req),
|
|
30
|
+
env: mergeProcessEnvironment(runEnv, mcp.env),
|
|
31
|
+
...(Object.keys(mcp.servers).length ? { mcpServers: mcp.servers } : {}),
|
|
32
|
+
cleanup: () => undefined
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** 宿主显式拥有唯一 app-server;本轮配置只进入 thread,不参与进程选择。 */
|
|
36
|
+
export function createManagedCodexEngine({ codexHome, command, commandArgsPrefix = [], appServerArgs = buildCodexAppServerArgs(), spawnFn, env = {} }) {
|
|
37
|
+
assertCodexHome(codexHome);
|
|
38
|
+
const launch = snapshotProviderLaunch({ command, args: commandArgsPrefix, env });
|
|
39
|
+
const inherited = mergeProcessEnvironment(launch.env, { CODEX_HOME: codexHome });
|
|
40
|
+
const scopeId = randomUUID();
|
|
41
|
+
// server 启动继承宿主目录;CODEX_HOME 仅是数据目录,本轮 cwd 只经 thread/turn RPC 传入。
|
|
42
|
+
const spec = {
|
|
43
|
+
command: launch.command,
|
|
44
|
+
args: [...launch.args, ...appServerArgs],
|
|
45
|
+
env: inherited,
|
|
46
|
+
cleanup: () => undefined
|
|
47
|
+
};
|
|
48
|
+
let service;
|
|
49
|
+
let closing = false;
|
|
50
|
+
let close;
|
|
51
|
+
const unresolved = new Set();
|
|
52
|
+
const failed = new Set();
|
|
53
|
+
return {
|
|
54
|
+
provider: {
|
|
55
|
+
codexHome,
|
|
56
|
+
probe: () => probeCommand(launch.command, { args: launch.args, env: inherited }),
|
|
57
|
+
async acquire(request, context) {
|
|
58
|
+
if (closing)
|
|
59
|
+
throw new Error("CODEX_SERVICE_CLOSED");
|
|
60
|
+
assertCodexInvocationHome(request, codexHome);
|
|
61
|
+
if (invocationProviderOptions(request, "codex").codexServiceRevision !== undefined)
|
|
62
|
+
throw new Error("CODEX_SERVICE_REVISION_UNSUPPORTED");
|
|
63
|
+
const runEnv = invocationEnvironment(request, {}, inherited);
|
|
64
|
+
const rawMessageMaxBytes = resolveStreamLimitPolicy(context?.streamLimits).rawMessageMaxBytes;
|
|
65
|
+
const mcp = codexMcpConfig(request, runEnv);
|
|
66
|
+
const config = codexCapacityConfig(request);
|
|
67
|
+
service ??= new CodexService(scopeId, spec, spawnFn);
|
|
68
|
+
const channel = await service.acquire(request.signal, context?.protocolMode !== "native" && hasImageInput(request), rawMessageMaxBytes);
|
|
69
|
+
return {
|
|
70
|
+
channel,
|
|
71
|
+
configuration: {
|
|
72
|
+
...(Object.keys(mcp.servers).length ? { mcpServers: mcp.servers } : {}),
|
|
73
|
+
...(Object.keys(config).length ? { config } : {})
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
processes: () => (service ? [service.snapshot()] : []),
|
|
79
|
+
beginShutdown() {
|
|
80
|
+
closing = true;
|
|
81
|
+
service?.stopRecovery();
|
|
82
|
+
},
|
|
83
|
+
async close({ deadline }) {
|
|
84
|
+
if (!Number.isFinite(deadline))
|
|
85
|
+
throw new TypeError("CLEANUP_DEADLINE_INVALID");
|
|
86
|
+
closing = true;
|
|
87
|
+
if (!close) {
|
|
88
|
+
if (service)
|
|
89
|
+
unresolved.add(service.id);
|
|
90
|
+
close = Promise.all((service ? [service] : []).map(async (service) => {
|
|
91
|
+
try {
|
|
92
|
+
await service.close();
|
|
93
|
+
unresolved.delete(service.id);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
failed.add(service.id);
|
|
97
|
+
}
|
|
98
|
+
})).then(() => { });
|
|
99
|
+
}
|
|
100
|
+
let timer;
|
|
101
|
+
try {
|
|
102
|
+
await Promise.race([
|
|
103
|
+
close,
|
|
104
|
+
new Promise((done) => {
|
|
105
|
+
timer = setTimeout(done, Math.max(0, deadline - performance.now()));
|
|
106
|
+
})
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
clearTimeout(timer);
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
complete: unresolved.size === 0,
|
|
114
|
+
unresolvedServiceIds: [...unresolved],
|
|
115
|
+
failedCleanupServiceIds: [...failed]
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** 宿主已确认的容量映射为原生参数,不重发已接受的 turn。 */
|
|
121
|
+
function nativeCapacityOverrides(request) {
|
|
122
|
+
return Object.entries(codexCapacityConfig(request)).flatMap(([key, value]) => [
|
|
123
|
+
"-c",
|
|
124
|
+
`${key}=${value}`
|
|
125
|
+
]);
|
|
126
|
+
}
|
|
127
|
+
/** 容量属于本轮 thread 配置,不改变共享服务的 argv。 */
|
|
128
|
+
function codexCapacityConfig(request) {
|
|
129
|
+
const value = request.runMetadata?.contextCapacity;
|
|
130
|
+
if (!value)
|
|
131
|
+
return {};
|
|
132
|
+
const window = value.contextWindow;
|
|
133
|
+
const reserve = value.outputReserveTokens;
|
|
134
|
+
if (value.management !== "provider_native" ||
|
|
135
|
+
typeof window !== "number" ||
|
|
136
|
+
!Number.isSafeInteger(window) ||
|
|
137
|
+
window < 1024 ||
|
|
138
|
+
typeof reserve !== "number" ||
|
|
139
|
+
!Number.isSafeInteger(reserve) ||
|
|
140
|
+
reserve < 0 ||
|
|
141
|
+
reserve >= window)
|
|
142
|
+
throw new TypeError("CONTEXT_CAPACITY_UNAVAILABLE");
|
|
143
|
+
return {
|
|
144
|
+
model_context_window: window,
|
|
145
|
+
model_auto_compact_token_limit: window - reserve
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { invocationEnvs } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
1
|
+
import { invocationEnvs, mergeProcessEnvironment } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
2
|
/** Per-thread overrides; the provider's effective configuration stays on disk unchanged. */
|
|
3
3
|
export function codexEnvironmentConfig(request, config) {
|
|
4
4
|
const envs = invocationEnvs(request);
|
|
@@ -7,7 +7,7 @@ export function codexEnvironmentConfig(request, config) {
|
|
|
7
7
|
return {};
|
|
8
8
|
const shell = record(config.shell_environment_policy);
|
|
9
9
|
const overrides = {
|
|
10
|
-
"shell_environment_policy.set":
|
|
10
|
+
"shell_environment_policy.set": mergeProcessEnvironment(record(shell.set), envs)
|
|
11
11
|
};
|
|
12
12
|
if (Array.isArray(shell.include_only) && shell.include_only.length) {
|
|
13
13
|
overrides["shell_environment_policy.include_only"] = [
|
|
@@ -21,15 +21,11 @@ export function codexEnvironmentConfig(request, config) {
|
|
|
21
21
|
server.enabled === false ||
|
|
22
22
|
server.experimental_environment === "remote")
|
|
23
23
|
continue;
|
|
24
|
-
//
|
|
25
|
-
// Existing per-server env overrides retain their provider-native precedence.
|
|
24
|
+
// 共享 app-server 环境固定;逐线程传实际值,MCP 自有 env 继续具有原生优先级。
|
|
26
25
|
Object.defineProperty(servers, name, {
|
|
27
26
|
enumerable: true,
|
|
28
27
|
value: {
|
|
29
|
-
|
|
30
|
-
...(Array.isArray(server.env_vars) ? server.env_vars : []),
|
|
31
|
-
...keys
|
|
32
|
-
]
|
|
28
|
+
env: mergeProcessEnvironment(envs, record(server.env))
|
|
33
29
|
}
|
|
34
30
|
});
|
|
35
31
|
}
|
|
@@ -1,99 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { type AdapterInvocationContext, type InvokeRequest } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
8
|
-
import { type InteractionResponse, type NativeInteractionResponse } from "@mininglamp-oss/octo-runtime-protocol";
|
|
9
|
-
import { type CodexAppServerCommand, type CodexAppServerSpawn } from "./app-server.js";
|
|
10
|
-
import type { AdapterExecutionScope, AdapterOutput, RuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
1
|
+
import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
export declare const codexMetadata: AdapterMetadata;
|
|
3
|
+
import { type AdapterExecutionScope, type AdapterInvocationContext, type AdapterOutput, type InvokeRequest } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
4
|
+
import type { InteractionResponse, NativeInteractionResponse } from "@mininglamp-oss/octo-runtime-protocol";
|
|
5
|
+
import { type CodexEngineProvider } from "./engine.js";
|
|
6
|
+
export * from "./engine.js";
|
|
11
7
|
export { buildCodexAppServerArgs, CodexEventNormalizer, CodexAppServerProcessError, CodexAppServerRpcError, normalizeCodexEvent, runCodexAppServerTurn, type CodexAppServerCommand, type CodexAppServerNotification, type CodexAppServerSpawn, type CodexInteractionResponder } from "./app-server.js";
|
|
12
8
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* turn/start. The parent process environment is inherited whole and only
|
|
17
|
-
* The complete real CODEX_HOME is reused. Per-run instructions are sent through
|
|
18
|
-
* thread/start or thread/resume `developerInstructions`, never written to the
|
|
19
|
-
* user's config.toml.
|
|
9
|
+
* 宿主先构造 Codex 访问依赖,再注册 Adapter;注册只创建本地调用 scope。
|
|
10
|
+
* scope 释放自身 lease 和路由,永不关闭 Engine;宿主最终关闭其 owner。
|
|
11
|
+
* 这是 Codex 专用签名,不限制其他 Adapter 的类、工厂、闭包及任意依赖参数。
|
|
20
12
|
*/
|
|
21
|
-
export declare function
|
|
22
|
-
|
|
23
|
-
command?: string;
|
|
24
|
-
appServerArgs?: string[];
|
|
25
|
-
spawnFn?: CodexAppServerSpawn;
|
|
26
|
-
env?: NodeJS.ProcessEnv;
|
|
13
|
+
export declare function createCodexAdapter({ engine }: {
|
|
14
|
+
engine: CodexEngineProvider;
|
|
27
15
|
}): Readonly<Omit<{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
processModel: string;
|
|
38
|
-
transport: string;
|
|
39
|
-
};
|
|
40
|
-
probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
|
|
41
|
-
createExecutionScope: ({ log }: {
|
|
42
|
-
log: RuntimeLog;
|
|
43
|
-
}) => AdapterExecutionScope;
|
|
44
|
-
respondNative(invocationId: string, response: NativeInteractionResponse): Promise<void>;
|
|
45
|
-
respondInteraction(invocationId: string, response: InteractionResponse): Promise<void>;
|
|
46
|
-
invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncIterable<AdapterOutput>;
|
|
47
|
-
}, "metadata"> & {
|
|
48
|
-
metadata: Omit<{
|
|
49
|
-
mcp: true;
|
|
50
|
-
protocolSupport: {
|
|
51
|
-
protocol: string;
|
|
52
|
-
modes: ["native", "canonical"];
|
|
53
|
-
nativeMethods: string[];
|
|
54
|
-
};
|
|
55
|
-
type: string;
|
|
56
|
-
agentSources: "provisioned"[];
|
|
57
|
-
processModel: string;
|
|
58
|
-
transport: string;
|
|
59
|
-
}, "protocolSupport"> & {
|
|
60
|
-
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
61
|
-
};
|
|
62
|
-
}>;
|
|
63
|
-
export declare const codexAdapter: Readonly<Omit<{
|
|
64
|
-
metadata: {
|
|
65
|
-
mcp: true;
|
|
66
|
-
protocolSupport: {
|
|
67
|
-
protocol: string;
|
|
68
|
-
modes: ["native", "canonical"];
|
|
69
|
-
nativeMethods: string[];
|
|
70
|
-
};
|
|
71
|
-
type: string;
|
|
72
|
-
agentSources: "provisioned"[];
|
|
73
|
-
processModel: string;
|
|
74
|
-
transport: string;
|
|
75
|
-
};
|
|
76
|
-
probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
|
|
77
|
-
createExecutionScope: ({ log }: {
|
|
78
|
-
log: RuntimeLog;
|
|
79
|
-
}) => AdapterExecutionScope;
|
|
80
|
-
respondNative(invocationId: string, response: NativeInteractionResponse): Promise<void>;
|
|
81
|
-
respondInteraction(invocationId: string, response: InteractionResponse): Promise<void>;
|
|
82
|
-
invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncIterable<AdapterOutput>;
|
|
83
|
-
}, "metadata"> & {
|
|
84
|
-
metadata: Omit<{
|
|
85
|
-
mcp: true;
|
|
86
|
-
protocolSupport: {
|
|
87
|
-
protocol: string;
|
|
88
|
-
modes: ["native", "canonical"];
|
|
89
|
-
nativeMethods: string[];
|
|
90
|
-
};
|
|
91
|
-
type: string;
|
|
92
|
-
agentSources: "provisioned"[];
|
|
93
|
-
processModel: string;
|
|
94
|
-
transport: string;
|
|
95
|
-
}, "protocolSupport"> & {
|
|
16
|
+
createExecutionScope: () => AdapterExecutionScope;
|
|
17
|
+
respondNative(_id: string, _response: NativeInteractionResponse): Promise<void>;
|
|
18
|
+
respondInteraction(_id: string, _response: InteractionResponse): Promise<void>;
|
|
19
|
+
invoke(_request: InvokeRequest, _context?: AdapterInvocationContext): AsyncIterable<AdapterOutput>;
|
|
20
|
+
probe?: (() => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>) | undefined;
|
|
21
|
+
metadata: AdapterMetadata;
|
|
22
|
+
}, "metadata" | "defaultAgentEnv"> & {
|
|
23
|
+
readonly defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").AgentEnv;
|
|
24
|
+
metadata: Omit<AdapterMetadata, "protocolSupport"> & {
|
|
96
25
|
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
97
26
|
};
|
|
98
27
|
}>;
|
|
99
|
-
export default codexAdapter;
|