@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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-adapter-acp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
13
|
-
"@mininglamp-oss/octo-runtime-acp-client": "1.1.
|
|
14
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
12
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.14",
|
|
13
|
+
"@mininglamp-oss/octo-runtime-acp-client": "1.1.14",
|
|
14
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.14"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
export declare const antigravityMetadata: AdapterMetadata;
|
|
1
3
|
import { type CanonicalEvent, type CommandSpec, type AdapterInvocationContext, type InvokeRequest } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
4
|
interface NativeUsage {
|
|
3
5
|
input_tokens?: number;
|
|
@@ -43,45 +45,18 @@ export declare class AntigravityEventNormalizer {
|
|
|
43
45
|
}
|
|
44
46
|
export declare function buildAntigravityCommand(request: InvokeRequest, command?: string, commandArgsPrefix?: string[], logPath?: string): CommandSpec;
|
|
45
47
|
export declare function antigravityLogError(log: string): string | undefined;
|
|
46
|
-
export declare function createAntigravityAdapter({ command, commandArgsPrefix }
|
|
47
|
-
command
|
|
48
|
+
export declare function createAntigravityAdapter({ command, commandArgsPrefix, env }: {
|
|
49
|
+
command: string;
|
|
48
50
|
commandArgsPrefix?: string[];
|
|
51
|
+
env?: NodeJS.ProcessEnv;
|
|
49
52
|
}): Readonly<Omit<{
|
|
50
|
-
metadata:
|
|
51
|
-
type: string;
|
|
52
|
-
agentSources: "provisioned"[];
|
|
53
|
-
processModel: string;
|
|
54
|
-
transport: string;
|
|
55
|
-
};
|
|
56
|
-
probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
|
|
57
|
-
invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncGenerator<CanonicalEvent>;
|
|
58
|
-
}, "metadata"> & {
|
|
59
|
-
metadata: Omit<{
|
|
60
|
-
type: string;
|
|
61
|
-
agentSources: "provisioned"[];
|
|
62
|
-
processModel: string;
|
|
63
|
-
transport: string;
|
|
64
|
-
}, "protocolSupport"> & {
|
|
65
|
-
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
66
|
-
};
|
|
67
|
-
}>;
|
|
68
|
-
export declare const antigravityAdapter: Readonly<Omit<{
|
|
69
|
-
metadata: {
|
|
70
|
-
type: string;
|
|
71
|
-
agentSources: "provisioned"[];
|
|
72
|
-
processModel: string;
|
|
73
|
-
transport: string;
|
|
74
|
-
};
|
|
53
|
+
metadata: AdapterMetadata;
|
|
75
54
|
probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
|
|
76
55
|
invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncGenerator<CanonicalEvent>;
|
|
77
|
-
}, "metadata"> & {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
agentSources: "provisioned"[];
|
|
81
|
-
processModel: string;
|
|
82
|
-
transport: string;
|
|
83
|
-
}, "protocolSupport"> & {
|
|
56
|
+
}, "metadata" | "defaultAgentEnv"> & {
|
|
57
|
+
readonly defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").AgentEnv;
|
|
58
|
+
metadata: Omit<AdapterMetadata, "protocolSupport"> & {
|
|
84
59
|
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
85
60
|
};
|
|
86
61
|
}>;
|
|
87
|
-
export
|
|
62
|
+
export {};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
export const antigravityMetadata = {
|
|
2
|
+
type: "antigravity",
|
|
3
|
+
processModel: "subprocess-per-invocation",
|
|
4
|
+
transport: "ndjson/stdio"
|
|
5
|
+
};
|
|
6
|
+
import { invocationEffort, invocationModel, invocationApprovalMode, invocationWorkdir } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
7
|
+
import { defineAdapter, hasImageInput, invocationEnvironment, mapReasoningEffort, parseJsonLine, probeCommand, snapshotProviderLaunch, providerInputText, spawnJsonLines } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
8
|
import { isStreamCapacityReason } from "@mininglamp-oss/octo-runtime-protocol";
|
|
3
9
|
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
4
10
|
import { tmpdir } from "node:os";
|
|
@@ -275,7 +281,7 @@ const managedFlags = new Set([
|
|
|
275
281
|
"--sandbox"
|
|
276
282
|
]);
|
|
277
283
|
export function buildAntigravityCommand(request, command = "agy", commandArgsPrefix = [], logPath) {
|
|
278
|
-
if (request
|
|
284
|
+
if (invocationApprovalMode(request) !== "full_access")
|
|
279
285
|
throw new Error("APPROVAL_MODE_UNSUPPORTED: antigravity only supports full_access");
|
|
280
286
|
if (request.signal?.aborted)
|
|
281
287
|
throw new Error("ANTIGRAVITY_CANCELLED_BEFORE_START");
|
|
@@ -285,7 +291,7 @@ export function buildAntigravityCommand(request, command = "agy", commandArgsPre
|
|
|
285
291
|
if (managedFlags.has(arg.split("=")[0]) || /^-[pic].+/.test(arg))
|
|
286
292
|
throw new Error(`ANTIGRAVITY_MANAGED_ARGUMENT: ${arg.split("=")[0]}`);
|
|
287
293
|
}
|
|
288
|
-
const effort = mapReasoningEffort("antigravity", request
|
|
294
|
+
const effort = mapReasoningEffort("antigravity", invocationEffort(request));
|
|
289
295
|
const args = [
|
|
290
296
|
...commandArgsPrefix,
|
|
291
297
|
"--input-format",
|
|
@@ -302,22 +308,14 @@ export function buildAntigravityCommand(request, command = "agy", commandArgsPre
|
|
|
302
308
|
args.push("--log-file", logPath);
|
|
303
309
|
if (request.providerSession?.sessionId)
|
|
304
310
|
args.push("--conversation", request.providerSession.sessionId);
|
|
305
|
-
|
|
306
|
-
|
|
311
|
+
const model = invocationModel(request);
|
|
312
|
+
if (model)
|
|
313
|
+
args.push("--model", model);
|
|
307
314
|
if (effort)
|
|
308
315
|
args.push("--effort", effort);
|
|
309
|
-
|
|
310
|
-
const content = initialControlInstructions(request)
|
|
311
|
-
? [
|
|
312
|
-
{
|
|
313
|
-
type: "text",
|
|
314
|
-
text: `Runtime control instructions (apply throughout this session):\n${initialControlInstructions(request)}`
|
|
315
|
-
},
|
|
316
|
-
{ type: "text", text: `User input:\n${providerInputText(request)}` }
|
|
317
|
-
]
|
|
318
|
-
: providerInputText(request);
|
|
316
|
+
const content = providerInputText(request);
|
|
319
317
|
const input = `${JSON.stringify({ event: "user", message: { content } })}\n`;
|
|
320
|
-
return { command, args, input, cwd: request
|
|
318
|
+
return { command, args, input, cwd: invocationWorkdir(request) };
|
|
321
319
|
}
|
|
322
320
|
export function antigravityLogError(log) {
|
|
323
321
|
if (/timed out waiting for response/i.test(log))
|
|
@@ -327,22 +325,18 @@ export function antigravityLogError(log) {
|
|
|
327
325
|
return "ANTIGRAVITY_AUTH_REQUIRED: agy could not read the signed-in account; open agy in your terminal and check the active account";
|
|
328
326
|
return match ? `ANTIGRAVITY_PROVIDER_ERROR: ${match[1].slice(0, 1000)}` : undefined;
|
|
329
327
|
}
|
|
330
|
-
export function createAntigravityAdapter({ command
|
|
328
|
+
export function createAntigravityAdapter({ command, commandArgsPrefix = [], env = {} }) {
|
|
329
|
+
const launch = snapshotProviderLaunch({ command, args: commandArgsPrefix, env });
|
|
331
330
|
return defineAdapter({
|
|
332
|
-
metadata:
|
|
333
|
-
type: "antigravity",
|
|
334
|
-
agentSources: ["provisioned"],
|
|
335
|
-
processModel: "subprocess-per-invocation",
|
|
336
|
-
transport: "ndjson/stdio"
|
|
337
|
-
},
|
|
331
|
+
metadata: antigravityMetadata,
|
|
338
332
|
probe: async () => {
|
|
339
|
-
const result = await probeCommand(command);
|
|
333
|
+
const result = await probeCommand(launch.command, { args: launch.args, env: launch.env });
|
|
340
334
|
if (result.available && (!result.version || compareVersion(result.version, "1.3.3") < 0))
|
|
341
335
|
return { ...result, available: false, reason: "provider_version_unsupported" };
|
|
342
336
|
return result;
|
|
343
337
|
},
|
|
344
338
|
async *invoke(request, context) {
|
|
345
|
-
buildAntigravityCommand(request, command,
|
|
339
|
+
buildAntigravityCommand(request, launch.command, [...launch.args]);
|
|
346
340
|
const directory = await mkdtemp(join(tmpdir(), "octo-runtime-antigravity-"));
|
|
347
341
|
const logPath = join(directory, "cli.log");
|
|
348
342
|
const controller = new AbortController();
|
|
@@ -381,11 +375,11 @@ export function createAntigravityAdapter({ command = "agy", commandArgsPrefix =
|
|
|
381
375
|
void checkLog();
|
|
382
376
|
}, 250);
|
|
383
377
|
timer.unref();
|
|
384
|
-
const spec = buildAntigravityCommand(request, command,
|
|
378
|
+
const spec = buildAntigravityCommand(request, launch.command, [...launch.args], logPath);
|
|
385
379
|
try {
|
|
386
380
|
for await (const native of spawnJsonLines({
|
|
387
381
|
...spec,
|
|
388
|
-
env: invocationEnvironment(request, spec.env),
|
|
382
|
+
env: invocationEnvironment(request, spec.env, launch.env),
|
|
389
383
|
signal: controller.signal,
|
|
390
384
|
rawMessageMaxBytes: context?.streamLimits?.rawMessageMaxBytes,
|
|
391
385
|
parseLine: (line) => {
|
|
@@ -433,5 +427,3 @@ function compareVersion(version, minimum) {
|
|
|
433
427
|
}
|
|
434
428
|
return 0;
|
|
435
429
|
}
|
|
436
|
-
export const antigravityAdapter = createAntigravityAdapter();
|
|
437
|
-
export default antigravityAdapter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-adapter-antigravity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"README.md"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
14
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
13
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.14",
|
|
14
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.14"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { agentEnvItem } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
/** 只读本轮私有 item;省略不补模式,非法显式值在原生映射前拒绝。 */
|
|
3
|
+
export function claudePlanMode(request) {
|
|
4
|
+
const value = agentEnvItem(request.agentEnv, "adapter.claude-code", "options")?.permissionMode;
|
|
5
|
+
if (value === undefined)
|
|
6
|
+
return undefined;
|
|
7
|
+
if (value !== "plan")
|
|
8
|
+
throw new TypeError("ADAPTER_OPTION_INVALID: claude-code.permissionMode");
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
export declare const claudeCodeMetadata: AdapterMetadata;
|
|
1
3
|
/**
|
|
2
4
|
* Claude Code local CLI transport and event normalization layer.
|
|
3
5
|
*
|
|
@@ -59,19 +61,16 @@ interface ClaudeNativeEvent {
|
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
63
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* The system/control prompt is written to a private temp file passed via
|
|
65
|
-
* `--append-system-prompt-file`, while the user prompt stays on stdin, so the
|
|
66
|
-
* two never get conflated. Returns a `cleanup` that removes the temp directory.
|
|
64
|
+
* 构造本轮 Claude CLI 参数和普通输入;临时文件仅承载显式 MCP 配置,
|
|
65
|
+
* 返回的 cleanup 负责回收该配置目录。
|
|
67
66
|
*/
|
|
68
|
-
export declare function buildClaudeCommand(req: InvokeRequest, command?: string, commandArgsPrefix?: string[]): Promise<{
|
|
67
|
+
export declare function buildClaudeCommand(req: InvokeRequest, command?: string, commandArgsPrefix?: string[], inherited?: NodeJS.ProcessEnv): Promise<{
|
|
69
68
|
command: string;
|
|
70
69
|
args: string[];
|
|
71
70
|
input: string;
|
|
72
71
|
cleanup: () => Promise<void>;
|
|
73
72
|
}>;
|
|
74
|
-
export declare function claudePermissionMode(mode:
|
|
73
|
+
export declare function claudePermissionMode(mode: "ask" | "assisted" | "full_access"): string;
|
|
75
74
|
/**
|
|
76
75
|
* Translates Claude's native stream into canonical events for one invocation.
|
|
77
76
|
*
|
|
@@ -87,73 +86,20 @@ export declare class ClaudeEventNormalizer {
|
|
|
87
86
|
/** Compatibility entry for a single complete event; a partial sequence must reuse one ClaudeEventNormalizer. */
|
|
88
87
|
export declare function normalizeClaudeEvent(native: ClaudeNativeEvent): CanonicalEvent[];
|
|
89
88
|
/** Create a Claude Code adapter bound to a resolved CLI command and optional argv prefix. */
|
|
90
|
-
export declare function createClaudeCodeAdapter({ command, commandArgsPrefix }
|
|
91
|
-
command
|
|
89
|
+
export declare function createClaudeCodeAdapter({ command, commandArgsPrefix, env }: {
|
|
90
|
+
command: string;
|
|
92
91
|
commandArgsPrefix?: string[];
|
|
92
|
+
env?: NodeJS.ProcessEnv;
|
|
93
93
|
}): Readonly<Omit<{
|
|
94
|
-
metadata:
|
|
95
|
-
mcp: true;
|
|
96
|
-
protocolSupport: {
|
|
97
|
-
protocol: string;
|
|
98
|
-
modes: ["native", "canonical"];
|
|
99
|
-
nativeMethods: string[];
|
|
100
|
-
};
|
|
101
|
-
type: string;
|
|
102
|
-
agentSources: "provisioned"[];
|
|
103
|
-
processModel: string;
|
|
104
|
-
transport: string;
|
|
105
|
-
};
|
|
106
|
-
probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
|
|
107
|
-
respondNative(invocationId: string, response: NativeInteractionResponse): Promise<void>;
|
|
108
|
-
respondInteraction(invocationId: string, response: InteractionResponse): Promise<void>;
|
|
109
|
-
invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncGenerator<AdapterOutput>;
|
|
110
|
-
}, "metadata"> & {
|
|
111
|
-
metadata: Omit<{
|
|
112
|
-
mcp: true;
|
|
113
|
-
protocolSupport: {
|
|
114
|
-
protocol: string;
|
|
115
|
-
modes: ["native", "canonical"];
|
|
116
|
-
nativeMethods: string[];
|
|
117
|
-
};
|
|
118
|
-
type: string;
|
|
119
|
-
agentSources: "provisioned"[];
|
|
120
|
-
processModel: string;
|
|
121
|
-
transport: string;
|
|
122
|
-
}, "protocolSupport"> & {
|
|
123
|
-
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
124
|
-
};
|
|
125
|
-
}>;
|
|
126
|
-
export declare const claudeCodeAdapter: Readonly<Omit<{
|
|
127
|
-
metadata: {
|
|
128
|
-
mcp: true;
|
|
129
|
-
protocolSupport: {
|
|
130
|
-
protocol: string;
|
|
131
|
-
modes: ["native", "canonical"];
|
|
132
|
-
nativeMethods: string[];
|
|
133
|
-
};
|
|
134
|
-
type: string;
|
|
135
|
-
agentSources: "provisioned"[];
|
|
136
|
-
processModel: string;
|
|
137
|
-
transport: string;
|
|
138
|
-
};
|
|
94
|
+
metadata: AdapterMetadata;
|
|
139
95
|
probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
|
|
140
96
|
respondNative(invocationId: string, response: NativeInteractionResponse): Promise<void>;
|
|
141
97
|
respondInteraction(invocationId: string, response: InteractionResponse): Promise<void>;
|
|
142
98
|
invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncGenerator<AdapterOutput>;
|
|
143
|
-
}, "metadata"> & {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
protocolSupport: {
|
|
147
|
-
protocol: string;
|
|
148
|
-
modes: ["native", "canonical"];
|
|
149
|
-
nativeMethods: string[];
|
|
150
|
-
};
|
|
151
|
-
type: string;
|
|
152
|
-
agentSources: "provisioned"[];
|
|
153
|
-
processModel: string;
|
|
154
|
-
transport: string;
|
|
155
|
-
}, "protocolSupport"> & {
|
|
99
|
+
}, "metadata" | "defaultAgentEnv"> & {
|
|
100
|
+
readonly defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").AgentEnv;
|
|
101
|
+
metadata: Omit<AdapterMetadata, "protocolSupport"> & {
|
|
156
102
|
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
157
103
|
};
|
|
158
104
|
}>;
|
|
159
|
-
export
|
|
105
|
+
export {};
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { claudePlanMode } from "./agent-env.js";
|
|
2
|
+
export const claudeCodeMetadata = {
|
|
3
|
+
mcp: true,
|
|
4
|
+
protocolSupport: {
|
|
5
|
+
protocol: "claude.stream-json",
|
|
6
|
+
modes: ["native", "canonical"],
|
|
7
|
+
nativeMethods: ["managed-turn", "can_use_tool", "control_response", "cancel"]
|
|
8
|
+
},
|
|
9
|
+
type: "claude-code",
|
|
10
|
+
processModel: "subprocess-per-invocation",
|
|
11
|
+
transport: "ndjson/stdio"
|
|
12
|
+
};
|
|
13
|
+
import { invocationModel, invocationEffort, invocationApprovalMode, invocationWorkdir } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
14
|
+
import { hasImageInput, invocationEnvironment, invocationMcpServers, assertMcpOptions, mapReasoningEffort } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
15
|
+
import { canonicalTerminalStatus } from "@mininglamp-oss/octo-runtime-protocol";
|
|
3
16
|
/**
|
|
4
17
|
* Claude Code local CLI transport and event normalization layer.
|
|
5
18
|
*
|
|
@@ -10,35 +23,29 @@ import { canonicalTerminalStatus, contextActmode } from "@mininglamp-oss/octo-ru
|
|
|
10
23
|
* carries no tool_use id of its own, so every invocation must own an
|
|
11
24
|
* independent ClaudeEventNormalizer state.
|
|
12
25
|
*/
|
|
13
|
-
import { AcpApprovalBridge, NativeInteractionBridge, defineAdapter, parseJsonLine, probeCommand, providerInputText, spawnJsonLines } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
26
|
+
import { AcpApprovalBridge, NativeInteractionBridge, defineAdapter, parseJsonLine, probeCommand, snapshotProviderLaunch, providerInputText, spawnJsonLines } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
14
27
|
import { protocolError } from "@mininglamp-oss/octo-runtime-protocol";
|
|
15
28
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
16
29
|
import { tmpdir } from "node:os";
|
|
17
30
|
import { join } from "node:path";
|
|
18
31
|
const MAX_STEP_PUBLIC_TEXT_CHARS = 1_000;
|
|
19
32
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* The system/control prompt is written to a private temp file passed via
|
|
23
|
-
* `--append-system-prompt-file`, while the user prompt stays on stdin, so the
|
|
24
|
-
* two never get conflated. Returns a `cleanup` that removes the temp directory.
|
|
33
|
+
* 构造本轮 Claude CLI 参数和普通输入;临时文件仅承载显式 MCP 配置,
|
|
34
|
+
* 返回的 cleanup 负责回收该配置目录。
|
|
25
35
|
*/
|
|
26
|
-
export async function buildClaudeCommand(req, command = "claude", commandArgsPrefix = []) {
|
|
36
|
+
export async function buildClaudeCommand(req, command = "claude", commandArgsPrefix = [], inherited = {}) {
|
|
27
37
|
if (hasImageInput(req))
|
|
28
38
|
throw new Error("UNSUPPORTED_INPUT_MODALITY: claude-code does not encode image input");
|
|
29
|
-
const mode =
|
|
30
|
-
const servers = invocationMcpServers(req);
|
|
39
|
+
const mode = claudePlanMode(req) === "plan" ? "plan" : claudePermissionMode(invocationApprovalMode(req));
|
|
40
|
+
const servers = invocationMcpServers(req, invocationEnvironment(req, {}, inherited));
|
|
31
41
|
assertMcpOptions(servers, "claude-code", []);
|
|
32
42
|
// Native Claude expands placeholders again at connection time. Reject values
|
|
33
43
|
// it cannot preserve instead of silently changing a resolved literal/token.
|
|
34
44
|
if (Object.values(servers).some((server) => JSON.stringify(server).includes("${")))
|
|
35
45
|
throw new Error("MCP_LITERAL_UNSUPPORTED: claude-code cannot preserve resolved placeholder text");
|
|
36
|
-
|
|
37
|
-
const promptFile = join(directory, "system-prompt.txt");
|
|
38
|
-
// The control prompt goes through Claude's dedicated file argument while the
|
|
39
|
-
// user prompt is still fed via stdin, so the two never get conflated.
|
|
40
|
-
await writeFile(promptFile, initialControlInstructions(req), { mode: 0o600 });
|
|
46
|
+
let directory;
|
|
41
47
|
if (Object.keys(servers).length) {
|
|
48
|
+
directory = await mkdtemp(join(tmpdir(), "octo-runtime-claude-"));
|
|
42
49
|
const mcpFile = join(directory, "mcp.json");
|
|
43
50
|
const mcpServers = Object.fromEntries(Object.entries(servers).map(([name, server]) => [
|
|
44
51
|
name,
|
|
@@ -51,7 +58,24 @@ export async function buildClaudeCommand(req, command = "claude", commandArgsPre
|
|
|
51
58
|
}
|
|
52
59
|
: { type: "http", url: server.url, headers: server.headers ?? {} }
|
|
53
60
|
]));
|
|
54
|
-
|
|
61
|
+
// 临时文件只承载本轮 MCP;准备失败由本层回收,成功后归命令执行者清理。
|
|
62
|
+
try {
|
|
63
|
+
await writeFile(mcpFile, JSON.stringify({ mcpServers }), { mode: 0o600 });
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
let cleanupFailure;
|
|
67
|
+
try {
|
|
68
|
+
await rm(directory, { recursive: true, force: true });
|
|
69
|
+
}
|
|
70
|
+
catch (cleanupError) {
|
|
71
|
+
cleanupFailure = { error: cleanupError };
|
|
72
|
+
}
|
|
73
|
+
if (cleanupFailure)
|
|
74
|
+
throw new AggregateError([error, cleanupFailure.error], "Claude MCP preparation and cleanup failed", {
|
|
75
|
+
cause: error
|
|
76
|
+
});
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
55
79
|
commandArgsPrefix = [...commandArgsPrefix, "--mcp-config", mcpFile];
|
|
56
80
|
}
|
|
57
81
|
// Only --include-partial-messages produces thinking/text/input_json deltas;
|
|
@@ -65,17 +89,17 @@ export async function buildClaudeCommand(req, command = "claude", commandArgsPre
|
|
|
65
89
|
"--output-format",
|
|
66
90
|
"stream-json",
|
|
67
91
|
"--verbose",
|
|
68
|
-
"--include-partial-messages"
|
|
69
|
-
...(initialControlInstructions(req) ? ["--append-system-prompt-file", promptFile] : [])
|
|
92
|
+
"--include-partial-messages"
|
|
70
93
|
];
|
|
71
94
|
if (req.providerSession?.sessionId)
|
|
72
95
|
args.push("--resume", req.providerSession.sessionId);
|
|
73
96
|
// --name 是展示标题;不能替换原生 UUID,也不在 resume 时覆盖既有名称。
|
|
74
97
|
else if (req.sessionName)
|
|
75
98
|
args.push("--name", req.sessionName);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
99
|
+
const model = invocationModel(req);
|
|
100
|
+
if (model)
|
|
101
|
+
args.push("--model", model);
|
|
102
|
+
const effort = mapReasoningEffort("claude-code", invocationEffort(req));
|
|
79
103
|
if (effort)
|
|
80
104
|
args.push("--effort", effort);
|
|
81
105
|
args.push("--permission-mode", mode);
|
|
@@ -87,7 +111,10 @@ export async function buildClaudeCommand(req, command = "claude", commandArgsPre
|
|
|
87
111
|
command,
|
|
88
112
|
args,
|
|
89
113
|
input,
|
|
90
|
-
cleanup: () =>
|
|
114
|
+
cleanup: async () => {
|
|
115
|
+
if (directory)
|
|
116
|
+
await rm(directory, { recursive: true, force: true });
|
|
117
|
+
}
|
|
91
118
|
};
|
|
92
119
|
}
|
|
93
120
|
export function claudePermissionMode(mode) {
|
|
@@ -541,23 +568,13 @@ function claudeToolResultOutput(content) {
|
|
|
541
568
|
return text || content;
|
|
542
569
|
}
|
|
543
570
|
/** Create a Claude Code adapter bound to a resolved CLI command and optional argv prefix. */
|
|
544
|
-
export function createClaudeCodeAdapter({ command
|
|
571
|
+
export function createClaudeCodeAdapter({ command, commandArgsPrefix = [], env = {} }) {
|
|
572
|
+
const launch = snapshotProviderLaunch({ command, args: commandArgsPrefix, env });
|
|
545
573
|
const responders = new Map();
|
|
546
574
|
const nativeResponders = new Map();
|
|
547
575
|
return defineAdapter({
|
|
548
|
-
metadata:
|
|
549
|
-
|
|
550
|
-
protocolSupport: {
|
|
551
|
-
protocol: "claude.stream-json",
|
|
552
|
-
modes: ["native", "canonical"],
|
|
553
|
-
nativeMethods: ["managed-turn", "can_use_tool", "control_response", "cancel"]
|
|
554
|
-
},
|
|
555
|
-
type: "claude-code",
|
|
556
|
-
agentSources: ["provisioned"],
|
|
557
|
-
processModel: "subprocess-per-invocation",
|
|
558
|
-
transport: "ndjson/stdio"
|
|
559
|
-
},
|
|
560
|
-
probe: () => probeCommand(command),
|
|
576
|
+
metadata: claudeCodeMetadata,
|
|
577
|
+
probe: () => probeCommand(launch.command, { args: launch.args, env: launch.env }),
|
|
561
578
|
async respondNative(invocationId, response) {
|
|
562
579
|
const bridge = nativeResponders.get(invocationId);
|
|
563
580
|
if (!bridge)
|
|
@@ -606,10 +623,10 @@ export function createClaudeCodeAdapter({ command = "claude", commandArgsPrefix
|
|
|
606
623
|
}
|
|
607
624
|
});
|
|
608
625
|
async function* execute(request, permissions, context) {
|
|
609
|
-
const spec = await buildClaudeCommand(request, command,
|
|
626
|
+
const spec = await buildClaudeCommand(request, launch.command, [...launch.args], launch.env);
|
|
610
627
|
// The normalizer must not be hoisted to an adapter singleton: one adapter may run several invocations concurrently.
|
|
611
628
|
const normalizer = permissions instanceof NativeInteractionBridge ? undefined : new ClaudeEventNormalizer();
|
|
612
|
-
const requestedMode =
|
|
629
|
+
const requestedMode = claudePlanMode(request);
|
|
613
630
|
let modeReported = false;
|
|
614
631
|
try {
|
|
615
632
|
if (normalizer)
|
|
@@ -620,8 +637,8 @@ export function createClaudeCodeAdapter({ command = "claude", commandArgsPrefix
|
|
|
620
637
|
};
|
|
621
638
|
for await (const native of spawnJsonLines({
|
|
622
639
|
...spec,
|
|
623
|
-
cwd: request
|
|
624
|
-
env: invocationEnvironment(request),
|
|
640
|
+
cwd: invocationWorkdir(request),
|
|
641
|
+
env: invocationEnvironment(request, {}, launch.env),
|
|
625
642
|
signal: request.signal,
|
|
626
643
|
rawMessageMaxBytes: context?.streamLimits?.rawMessageMaxBytes,
|
|
627
644
|
onSpawn: (close) => permissions.bindTransport(close),
|
|
@@ -662,7 +679,7 @@ export function createClaudeCodeAdapter({ command = "claude", commandArgsPrefix
|
|
|
662
679
|
decision.interrupt !== false))
|
|
663
680
|
throw protocolError("NATIVE_RESPONSE_INVALID");
|
|
664
681
|
};
|
|
665
|
-
permissions.request(requestId, native, write, validate, request
|
|
682
|
+
permissions.request(requestId, native, write, validate, invocationApprovalMode(request) === "full_access"
|
|
666
683
|
? {
|
|
667
684
|
type: "control_response",
|
|
668
685
|
response: {
|
|
@@ -719,25 +736,26 @@ export function createClaudeCodeAdapter({ command = "claude", commandArgsPrefix
|
|
|
719
736
|
})) {
|
|
720
737
|
if (requestedMode !== undefined &&
|
|
721
738
|
!modeReported &&
|
|
722
|
-
native.type === "system" &&
|
|
723
|
-
native.subtype === "init") {
|
|
739
|
+
((native.type === "system" && native.subtype === "init") || native.type === "result")) {
|
|
724
740
|
modeReported = true;
|
|
725
741
|
const nativeMode = typeof native.permissionMode === "string" ? native.permissionMode : undefined;
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
:
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
742
|
+
// 原生模式是否确认由本包解释;不再发布统一 execution evidence。
|
|
743
|
+
if (nativeMode !== requestedMode && context?.protocolMode !== "native")
|
|
744
|
+
yield {
|
|
745
|
+
protocolVersion: 2,
|
|
746
|
+
type: "run.notice",
|
|
747
|
+
payload: {
|
|
748
|
+
noticeId: `${request.invocationId}:permission-mode`,
|
|
749
|
+
code: "provider_diagnostic",
|
|
750
|
+
severity: "warning",
|
|
751
|
+
params: {
|
|
752
|
+
adapter: "claude-code",
|
|
753
|
+
diagnosticId: "permission-mode-unconfirmed",
|
|
754
|
+
category: "permission_mode_unconfirmed",
|
|
755
|
+
message: "Claude did not confirm the requested plan permission mode."
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
};
|
|
741
759
|
}
|
|
742
760
|
if (native.type === "system" && native.subtype === "init")
|
|
743
761
|
context?.reportActivity?.({ kind: "turn_started", method: "turn_start" });
|
|
@@ -796,5 +814,3 @@ export function createClaudeCodeAdapter({ command = "claude", commandArgsPrefix
|
|
|
796
814
|
}
|
|
797
815
|
}
|
|
798
816
|
}
|
|
799
|
-
export const claudeCodeAdapter = createClaudeCodeAdapter();
|
|
800
|
-
export default claudeCodeAdapter;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-adapter-claude-code",
|
|
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-adapter-sdk": "1.1.
|
|
8
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.14",
|
|
9
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.14"
|
|
10
10
|
},
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"files": [
|