@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,8 +1,9 @@
|
|
|
1
|
+
import { invocationModel, invocationApprovalMode, invocationWorkdir } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
1
2
|
import { spawnGrokBuildAcpClient as spawnAcpClient } from "./client.js";
|
|
2
3
|
import { GrokBuildInteractionBridge as AcpApprovalBridge } from "./interactions.js";
|
|
3
4
|
import { acpModelSelectionRequest, acpActmodeSelectionRequest, normalizeAcpUpdate } from "@mininglamp-oss/octo-runtime-adapter-acp";
|
|
4
5
|
import { acpLoadSessionParams, acpNewSessionParams, acpPromptParams } from "@mininglamp-oss/octo-runtime-acp-client";
|
|
5
|
-
import {
|
|
6
|
+
import { actmodeEvidence, AcpTurnNormalizer, defineAdapter, invocationEnvironment, invocationMcpServers, assertMcpOptions, probeCommand, snapshotProviderLaunch } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
6
7
|
import { canonicalTerminalStatus, contextActmode, providerInputParts } from "@mininglamp-oss/octo-runtime-protocol";
|
|
7
8
|
function sessionModel(session) {
|
|
8
9
|
const modelOption = arrayField(session, "configOptions")
|
|
@@ -12,15 +13,21 @@ function sessionModel(session) {
|
|
|
12
13
|
stringField(recordValue(session.models), "currentModelId") ??
|
|
13
14
|
stringField(session, "model"));
|
|
14
15
|
}
|
|
15
|
-
export function createGrokBuildAcpAdapter(definition, { acpClientFactory = spawnAcpClient, command = definition.command } = {}) {
|
|
16
|
+
export function createGrokBuildAcpAdapter(definition, { acpClientFactory = spawnAcpClient, command = definition.command, commandArgsPrefix = [], env = {} } = {}) {
|
|
17
|
+
const launch = acpClientFactory === spawnAcpClient
|
|
18
|
+
? snapshotProviderLaunch({ command, args: commandArgsPrefix, env })
|
|
19
|
+
: { command, args: [...commandArgsPrefix], env: { ...env } };
|
|
16
20
|
const responders = new Map();
|
|
17
21
|
return defineAdapter({
|
|
18
|
-
metadata: {
|
|
22
|
+
metadata: definition.metadata ?? {
|
|
19
23
|
mcp: true,
|
|
20
24
|
type: definition.type,
|
|
21
25
|
agentSources: ["provisioned"]
|
|
22
26
|
},
|
|
23
|
-
probe: definition.probe ??
|
|
27
|
+
probe: definition.probe ??
|
|
28
|
+
(acpClientFactory === spawnAcpClient
|
|
29
|
+
? () => probeCommand(launch.command, { args: launch.args, env: launch.env })
|
|
30
|
+
: () => Promise.resolve({ available: false, command, reason: "probe_missing" })),
|
|
24
31
|
async respondInteraction(invocationId, response) {
|
|
25
32
|
const bridge = responders.get(invocationId);
|
|
26
33
|
if (!bridge)
|
|
@@ -28,7 +35,8 @@ export function createGrokBuildAcpAdapter(definition, { acpClientFactory = spawn
|
|
|
28
35
|
await bridge.respond(response);
|
|
29
36
|
},
|
|
30
37
|
async *invoke(request, context) {
|
|
31
|
-
if (request
|
|
38
|
+
if (invocationApprovalMode(request) !== "ask" &&
|
|
39
|
+
invocationApprovalMode(request) !== "full_access")
|
|
32
40
|
throw new Error("APPROVAL_MODE_UNSUPPORTED: this ACP adapter has no assisted policy");
|
|
33
41
|
if (responders.has(request.invocationId))
|
|
34
42
|
throw new Error("INVOCATION_ALREADY_ACTIVE");
|
|
@@ -47,7 +55,7 @@ export function createGrokBuildAcpAdapter(definition, { acpClientFactory = spawn
|
|
|
47
55
|
const args = typeof definition.args === "function"
|
|
48
56
|
? definition.args(request)
|
|
49
57
|
: (definition.args ?? ["acp"]);
|
|
50
|
-
const runEnv = invocationEnvironment(request, definition.env?.(request));
|
|
58
|
+
const runEnv = invocationEnvironment(request, definition.env?.(request), launch.env);
|
|
51
59
|
const mcp = invocationMcpServers(request, runEnv);
|
|
52
60
|
assertMcpOptions(mcp, definition.type, []);
|
|
53
61
|
const servers = Object.entries(mcp).map(([name, server]) => server.type === "stdio"
|
|
@@ -64,10 +72,10 @@ export function createGrokBuildAcpAdapter(definition, { acpClientFactory = spawn
|
|
|
64
72
|
headers: Object.entries(server.headers ?? {}).map(([name, value]) => ({ name, value }))
|
|
65
73
|
});
|
|
66
74
|
const client = acpClientFactory({
|
|
67
|
-
command,
|
|
68
|
-
args: [...args],
|
|
75
|
+
command: launch.command,
|
|
76
|
+
args: [...launch.args, ...args],
|
|
69
77
|
env: runEnv,
|
|
70
|
-
cwd: request
|
|
78
|
+
cwd: invocationWorkdir(request),
|
|
71
79
|
...definition.clientOptions?.(request, bridge),
|
|
72
80
|
permissionHandler: (params) => bridge.requestPermission(params),
|
|
73
81
|
onPermissionResponseWritten: (params) => bridge.responseWritten(params),
|
|
@@ -115,8 +123,8 @@ export function createGrokBuildAcpAdapter(definition, { acpClientFactory = spawn
|
|
|
115
123
|
let resumeFallback;
|
|
116
124
|
let sessionMethod = requestedSessionId ? "session/load" : "session/new";
|
|
117
125
|
let sessionParams = requestedSessionId
|
|
118
|
-
? acpLoadSessionParams(requestedSessionId, { cwd: request
|
|
119
|
-
: acpNewSessionParams({ cwd: request
|
|
126
|
+
? acpLoadSessionParams(requestedSessionId, { cwd: invocationWorkdir(request) })
|
|
127
|
+
: acpNewSessionParams({ cwd: invocationWorkdir(request) });
|
|
120
128
|
sessionParams.mcpServers = servers;
|
|
121
129
|
sessionParams =
|
|
122
130
|
definition.sessionParams?.(sessionParams, request, !requestedSessionId) ?? sessionParams;
|
|
@@ -143,7 +151,7 @@ export function createGrokBuildAcpAdapter(definition, { acpClientFactory = spawn
|
|
|
143
151
|
if (missingLoadedSession) {
|
|
144
152
|
resumeFallback = "session_load_not_found";
|
|
145
153
|
sessionMethod = "session/new";
|
|
146
|
-
sessionParams = acpNewSessionParams({ cwd: request
|
|
154
|
+
sessionParams = acpNewSessionParams({ cwd: invocationWorkdir(request) });
|
|
147
155
|
sessionParams.mcpServers = servers;
|
|
148
156
|
sessionParams = definition.sessionParams?.(sessionParams, request, true) ?? sessionParams;
|
|
149
157
|
sessionRequestId = client.reserveRequestId();
|
|
@@ -160,7 +168,7 @@ export function createGrokBuildAcpAdapter(definition, { acpClientFactory = spawn
|
|
|
160
168
|
: (requestedSessionId ?? stringField(sessionResult, "sessionId"));
|
|
161
169
|
if (!sessionId)
|
|
162
170
|
throw new Error("ACP session/new returned no sessionId");
|
|
163
|
-
const requestedMode = contextActmode(request.
|
|
171
|
+
const requestedMode = contextActmode(request.agentEnv);
|
|
164
172
|
if (requestedMode !== undefined) {
|
|
165
173
|
const selection = (definition.selectActmode ?? acpActmodeSelectionRequest)(sessionResult, sessionId, requestedMode);
|
|
166
174
|
if (!selection.unchanged)
|
|
@@ -175,7 +183,7 @@ export function createGrokBuildAcpAdapter(definition, { acpClientFactory = spawn
|
|
|
175
183
|
: {})
|
|
176
184
|
});
|
|
177
185
|
}
|
|
178
|
-
const requestedModel = nonEmptyString(request
|
|
186
|
+
const requestedModel = nonEmptyString(invocationModel(request));
|
|
179
187
|
if (requestedModel) {
|
|
180
188
|
const selection = acpModelSelectionRequest(sessionResult, sessionId, requestedModel);
|
|
181
189
|
if (selection) {
|
|
@@ -214,23 +222,8 @@ export function createGrokBuildAcpAdapter(definition, { acpClientFactory = spawn
|
|
|
214
222
|
}
|
|
215
223
|
};
|
|
216
224
|
const input = providerInputParts(request, resumeFallback !== undefined);
|
|
217
|
-
const instructions = definition.controlInstructions === "session"
|
|
218
|
-
? ""
|
|
219
|
-
: initialControlInstructions(request, !requestedSessionId || resumeFallback !== undefined);
|
|
220
225
|
// Preserve the legacy text call while mixed prompts retain every block's position.
|
|
221
|
-
const prompt = input.length === 1 && input[0]?.type === "text"
|
|
222
|
-
? `${input[0].text}${instructions ? `\n\n${instructions}` : ""}`
|
|
223
|
-
: [
|
|
224
|
-
...input,
|
|
225
|
-
...(instructions
|
|
226
|
-
? [
|
|
227
|
-
{
|
|
228
|
-
type: "text",
|
|
229
|
-
text: instructions
|
|
230
|
-
}
|
|
231
|
-
]
|
|
232
|
-
: [])
|
|
233
|
-
];
|
|
226
|
+
const prompt = input.length === 1 && input[0]?.type === "text" ? input[0].text : input;
|
|
234
227
|
const promptParams = acpPromptParams(sessionId, prompt);
|
|
235
228
|
const promptRequestId = client.reserveRequestId();
|
|
236
229
|
let stopReason;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AcpClient } from "@mininglamp-oss/octo-runtime-acp-client";
|
|
2
2
|
import { INVOKE_REQUEST_MAX_BYTES } from "@mininglamp-oss/octo-runtime-protocol";
|
|
3
3
|
import { mergeProcessEnvironment } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
4
|
-
import {
|
|
4
|
+
import { assertProviderCommand } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
6
|
import { createInterface } from "node:readline";
|
|
7
7
|
export class GrokBuildRpcError extends Error {
|
|
@@ -135,12 +135,9 @@ class GrokBuildAcpClient extends AcpClient {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
export function spawnGrokBuildAcpClient(options) {
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
env
|
|
142
|
-
});
|
|
143
|
-
const child = spawn(launch.command, launch.args, {
|
|
138
|
+
assertProviderCommand(options.command);
|
|
139
|
+
const env = mergeProcessEnvironment(options.env ?? {});
|
|
140
|
+
const child = spawn(options.command, options.args ?? [], {
|
|
144
141
|
cwd: options.cwd,
|
|
145
142
|
env,
|
|
146
143
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -1,33 +1,25 @@
|
|
|
1
|
+
import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
1
2
|
import { spawnGrokBuildAcpClient } from "./client.js";
|
|
2
3
|
import { type CanonicalEvent, type InvokeRequest } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
3
4
|
import type { InteractionResponse } from "@mininglamp-oss/octo-runtime-protocol";
|
|
4
5
|
export declare const GROK_BUILD_TESTED_VERSION = "1.0.67";
|
|
6
|
+
export declare const grokBuildMetadata: AdapterMetadata;
|
|
5
7
|
/** 宿主可指定已安装命令;每次调用拥有独立 ACP 子进程,不连接用户常驻 leader。 */
|
|
6
|
-
export declare function createGrokBuildAdapter({ command, acpClientFactory }
|
|
7
|
-
command
|
|
8
|
+
export declare function createGrokBuildAdapter({ command, acpClientFactory, commandArgsPrefix, env }: {
|
|
9
|
+
command: string;
|
|
8
10
|
acpClientFactory?: typeof spawnGrokBuildAcpClient;
|
|
11
|
+
commandArgsPrefix?: readonly string[];
|
|
12
|
+
env?: NodeJS.ProcessEnv;
|
|
9
13
|
}): Readonly<{
|
|
14
|
+
defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").ContextEnvelope;
|
|
10
15
|
invoke(request: InvokeRequest, context?: Parameters<(request: InvokeRequest, context?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterInvocationContext) => AsyncGenerator<CanonicalEvent>>[1]): AsyncGenerator<CanonicalEvent, void, any>;
|
|
11
16
|
respondInteraction: (invocationId: string, response: InteractionResponse) => Promise<void>;
|
|
12
|
-
probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
probe: (() => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>) | (() => Promise<{
|
|
18
|
+
available: false;
|
|
19
|
+
command: string;
|
|
20
|
+
reason: string;
|
|
21
|
+
}>);
|
|
22
|
+
metadata: Omit<AdapterMetadata, "protocolSupport"> & {
|
|
18
23
|
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
19
24
|
};
|
|
20
25
|
}>;
|
|
21
|
-
export declare const grokBuildAdapter: Readonly<{
|
|
22
|
-
invoke(request: InvokeRequest, context?: Parameters<(request: InvokeRequest, context?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterInvocationContext) => AsyncGenerator<CanonicalEvent>>[1]): AsyncGenerator<CanonicalEvent, void, any>;
|
|
23
|
-
respondInteraction: (invocationId: string, response: InteractionResponse) => Promise<void>;
|
|
24
|
-
probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
|
|
25
|
-
metadata: Omit<{
|
|
26
|
-
mcp: true;
|
|
27
|
-
type: string;
|
|
28
|
-
agentSources: "provisioned"[];
|
|
29
|
-
}, "protocolSupport"> & {
|
|
30
|
-
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
31
|
-
};
|
|
32
|
-
}>;
|
|
33
|
-
export default grokBuildAdapter;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { assertAdapterAgentEnv, assertAdapterWorkdir, runAdapterPreparation, isAdapterPreparationFailure, invocationEffort, invocationOption, invocationApprovalMode } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
1
2
|
import { GrokBuildRpcError, spawnGrokBuildAcpClient } from "./client.js";
|
|
2
3
|
import { createGrokBuildAcpAdapter } from "./adapter.js";
|
|
3
|
-
import {
|
|
4
|
+
import { invocationEnvironment, invocationMcpServers, probeCommand, snapshotProviderLaunch } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
4
5
|
export const GROK_BUILD_TESTED_VERSION = "1.0.67";
|
|
6
|
+
export const grokBuildMetadata = {
|
|
7
|
+
type: "grok-build",
|
|
8
|
+
mcp: true,
|
|
9
|
+
agentSources: ["provisioned"]
|
|
10
|
+
};
|
|
5
11
|
const levels = { low: "low", medium: "medium", high: "high", xhigh: "xhigh" };
|
|
6
12
|
function supportedVersion(version) {
|
|
7
13
|
if (typeof version !== "string")
|
|
@@ -10,21 +16,23 @@ function supportedVersion(version) {
|
|
|
10
16
|
return !!match && Number(match[1]) === 1 && (Number(match[2]) > 0 || Number(match[3]) >= 67);
|
|
11
17
|
}
|
|
12
18
|
/** 宿主可指定已安装命令;每次调用拥有独立 ACP 子进程,不连接用户常驻 leader。 */
|
|
13
|
-
export function createGrokBuildAdapter({ command =
|
|
19
|
+
export function createGrokBuildAdapter({ command, acpClientFactory = spawnGrokBuildAcpClient, commandArgsPrefix = [], env = {} }) {
|
|
20
|
+
const launch = acpClientFactory === spawnGrokBuildAcpClient
|
|
21
|
+
? snapshotProviderLaunch({ command, args: commandArgsPrefix, env })
|
|
22
|
+
: { command, args: [...commandArgsPrefix], env: { ...env } };
|
|
14
23
|
const adapter = createGrokBuildAcpAdapter({
|
|
15
24
|
type: "grok-build",
|
|
25
|
+
metadata: grokBuildMetadata,
|
|
16
26
|
provider: "grok-build",
|
|
17
27
|
command,
|
|
18
28
|
args: ["--no-auto-update", "agent", "--no-leader", "stdio"],
|
|
19
|
-
controlInstructions: "session",
|
|
20
29
|
reasoningLevels: levels,
|
|
21
30
|
async probe() {
|
|
22
|
-
|
|
31
|
+
if (acpClientFactory !== spawnGrokBuildAcpClient)
|
|
32
|
+
return { available: false, command, reason: "probe_missing" };
|
|
33
|
+
const result = await probeCommand(launch.command, { args: launch.args, env: launch.env });
|
|
23
34
|
if (!result.available)
|
|
24
|
-
return
|
|
25
|
-
...result,
|
|
26
|
-
reason: "command_not_found: install Grok Build and put grok on PATH"
|
|
27
|
-
};
|
|
35
|
+
return result;
|
|
28
36
|
return supportedVersion(result.version)
|
|
29
37
|
? result
|
|
30
38
|
: {
|
|
@@ -33,8 +41,11 @@ export function createGrokBuildAdapter({ command = "grok", acpClientFactory = sp
|
|
|
33
41
|
reason: `grok_version_unsupported: install Grok Build ${GROK_BUILD_TESTED_VERSION} or a compatible 1.x release`
|
|
34
42
|
};
|
|
35
43
|
},
|
|
36
|
-
async initialize(client, init
|
|
37
|
-
const version = record(init._meta).agentVersion ??
|
|
44
|
+
async initialize(client, init) {
|
|
45
|
+
const version = record(init._meta).agentVersion ??
|
|
46
|
+
(acpClientFactory === spawnGrokBuildAcpClient
|
|
47
|
+
? (await probeCommand(launch.command, { args: launch.args, env: launch.env })).version
|
|
48
|
+
: undefined);
|
|
38
49
|
if (init.protocolVersion !== 1 || !supportedVersion(version))
|
|
39
50
|
throw new Error(`GROK_VERSION_UNSUPPORTED: expected ACP v1 and Grok Build >= ${GROK_BUILD_TESTED_VERSION}, < 2.0.0`);
|
|
40
51
|
const methods = Array.isArray(init.authMethods)
|
|
@@ -52,14 +63,13 @@ export function createGrokBuildAdapter({ command = "grok", acpClientFactory = sp
|
|
|
52
63
|
}
|
|
53
64
|
},
|
|
54
65
|
sessionParams(params, request, fresh) {
|
|
55
|
-
//
|
|
56
|
-
const rules = initialControlInstructions(request, fresh);
|
|
66
|
+
// 应用提示词只来自普通输入;会话元数据仅保留执行策略和恢复行为。
|
|
57
67
|
return {
|
|
58
68
|
...params,
|
|
59
69
|
_meta: {
|
|
60
|
-
yoloMode: request
|
|
70
|
+
yoloMode: invocationApprovalMode(request) === "full_access",
|
|
61
71
|
autoMode: false,
|
|
62
|
-
...(fresh ?
|
|
72
|
+
...(!fresh ? { "x.ai/restore_code": false } : {})
|
|
63
73
|
}
|
|
64
74
|
};
|
|
65
75
|
},
|
|
@@ -77,7 +87,7 @@ export function createGrokBuildAdapter({ command = "grok", acpClientFactory = sp
|
|
|
77
87
|
};
|
|
78
88
|
},
|
|
79
89
|
async *configureSession(client, session, sessionId, request) {
|
|
80
|
-
const requested = request
|
|
90
|
+
const requested = invocationEffort(request);
|
|
81
91
|
if (requested === undefined)
|
|
82
92
|
return;
|
|
83
93
|
const option = (Array.isArray(session.configOptions) ? session.configOptions : [])
|
|
@@ -165,22 +175,36 @@ export function createGrokBuildAdapter({ command = "grok", acpClientFactory = sp
|
|
|
165
175
|
? [{ protocolVersion: 2, type: "usage.update", payload }]
|
|
166
176
|
: [];
|
|
167
177
|
}
|
|
168
|
-
}, { command, acpClientFactory });
|
|
178
|
+
}, { command: launch.command, acpClientFactory, commandArgsPrefix: launch.args, env: launch.env });
|
|
169
179
|
return Object.freeze({
|
|
170
180
|
...adapter,
|
|
181
|
+
get defaultAgentEnv() {
|
|
182
|
+
return adapter.defaultAgentEnv;
|
|
183
|
+
},
|
|
171
184
|
async *invoke(request, context) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
185
|
+
let env = {};
|
|
186
|
+
await runAdapterPreparation(context, async () => {
|
|
187
|
+
assertAdapterAgentEnv(request);
|
|
188
|
+
await assertAdapterWorkdir(request);
|
|
189
|
+
if (invocationOption(request, "sandbox", "grok-build") !== undefined)
|
|
190
|
+
throw new Error("SANDBOX_UNSUPPORTED: grok-build ACP has no per-session sandbox override");
|
|
191
|
+
// 纯模板校验在 Provider 操作前完成;预算和 notice 仍只由内层 SDK 应用一次。
|
|
192
|
+
env = invocationEnvironment(request, {}, launch.env);
|
|
193
|
+
const mcp = invocationMcpServers(request, env);
|
|
194
|
+
if (JSON.stringify(mcp).includes("${"))
|
|
195
|
+
throw new Error("MCP_LITERAL_UNSUPPORTED: grok-build");
|
|
196
|
+
});
|
|
179
197
|
try {
|
|
180
198
|
yield* adapter.invoke(request, context);
|
|
181
199
|
}
|
|
182
200
|
catch (error) {
|
|
183
|
-
|
|
201
|
+
const failure = publicFailure(error, env);
|
|
202
|
+
// 脱敏会创建新 Error;仅转移原错误已经确认的本轮准备证据。
|
|
203
|
+
if (context && isAdapterPreparationFailure(error, context))
|
|
204
|
+
await runAdapterPreparation(context, () => {
|
|
205
|
+
throw failure;
|
|
206
|
+
});
|
|
207
|
+
throw failure;
|
|
184
208
|
}
|
|
185
209
|
}
|
|
186
210
|
});
|
|
@@ -269,5 +293,3 @@ function record(value) {
|
|
|
269
293
|
? value
|
|
270
294
|
: {};
|
|
271
295
|
}
|
|
272
|
-
export const grokBuildAdapter = createGrokBuildAdapter();
|
|
273
|
-
export default grokBuildAdapter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-adapter-grok-build",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@mininglamp-oss/octo-runtime-acp-client": "1.1.
|
|
13
|
-
"@mininglamp-oss/octo-runtime-adapter-acp": "1.1.
|
|
14
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
15
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
12
|
+
"@mininglamp-oss/octo-runtime-acp-client": "1.1.13",
|
|
13
|
+
"@mininglamp-oss/octo-runtime-adapter-acp": "1.1.13",
|
|
14
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.13",
|
|
15
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.13"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
|
|
3
|
+
export declare const hermesMetadata: AdapterMetadata;
|
|
4
|
+
/** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
|
|
5
|
+
export declare function createHermesAdapter(options: NonNullable<Parameters<typeof createAcpAdapter>[1]> & {
|
|
6
|
+
command: string;
|
|
7
|
+
}): Readonly<Omit<{
|
|
8
|
+
metadata: AdapterMetadata;
|
|
9
|
+
probe: (() => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>) | (() => Promise<{
|
|
10
|
+
available: false;
|
|
11
|
+
command: string;
|
|
12
|
+
reason: string;
|
|
13
|
+
}>);
|
|
8
14
|
respondInteraction(invocationId: string, response: import("@mininglamp-oss/octo-runtime-protocol").InteractionResponse): Promise<void>;
|
|
9
15
|
invoke(request: import("@mininglamp-oss/octo-runtime-protocol").InvokeRequest, context?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterInvocationContext): AsyncGenerator<import("@mininglamp-oss/octo-runtime-protocol").CanonicalEvent>;
|
|
10
|
-
}, "metadata"> & {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type: string;
|
|
14
|
-
agentSources: "provisioned"[];
|
|
15
|
-
}, "protocolSupport"> & {
|
|
16
|
+
}, "metadata" | "defaultAgentEnv"> & {
|
|
17
|
+
readonly defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").AgentEnv;
|
|
18
|
+
metadata: Omit<AdapterMetadata, "protocolSupport"> & {
|
|
16
19
|
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
17
20
|
};
|
|
18
21
|
}>;
|
|
19
|
-
export default hermesAdapter;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
|
|
2
|
-
export const
|
|
2
|
+
export const hermesMetadata = {
|
|
3
3
|
type: "hermes",
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
mcp: true,
|
|
5
|
+
agentSources: ["provisioned"]
|
|
6
|
+
};
|
|
7
|
+
/** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
|
|
8
|
+
export function createHermesAdapter(options) {
|
|
9
|
+
return createAcpAdapter({
|
|
10
|
+
metadata: hermesMetadata,
|
|
11
|
+
type: "hermes",
|
|
12
|
+
provider: "hermes",
|
|
13
|
+
command: options.command,
|
|
14
|
+
args: ["acp"],
|
|
15
|
+
emptyLoadResultMeansMissing: true
|
|
16
|
+
}, options);
|
|
17
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-adapter-hermes",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@mininglamp-oss/octo-runtime-adapter-acp": "1.1.
|
|
12
|
+
"@mininglamp-oss/octo-runtime-adapter-acp": "1.1.13"
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
|
|
3
|
+
export declare const kimiCodeMetadata: AdapterMetadata;
|
|
4
|
+
/** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
|
|
5
|
+
export declare function createKimiCodeAdapter(options: NonNullable<Parameters<typeof createAcpAdapter>[1]> & {
|
|
6
|
+
command: string;
|
|
7
|
+
}): Readonly<Omit<{
|
|
8
|
+
metadata: AdapterMetadata;
|
|
9
|
+
probe: (() => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>) | (() => Promise<{
|
|
10
|
+
available: false;
|
|
11
|
+
command: string;
|
|
12
|
+
reason: string;
|
|
13
|
+
}>);
|
|
8
14
|
respondInteraction(invocationId: string, response: import("@mininglamp-oss/octo-runtime-protocol").InteractionResponse): Promise<void>;
|
|
9
15
|
invoke(request: import("@mininglamp-oss/octo-runtime-protocol").InvokeRequest, context?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterInvocationContext): AsyncGenerator<import("@mininglamp-oss/octo-runtime-protocol").CanonicalEvent>;
|
|
10
|
-
}, "metadata"> & {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type: string;
|
|
14
|
-
agentSources: "provisioned"[];
|
|
15
|
-
}, "protocolSupport"> & {
|
|
16
|
+
}, "metadata" | "defaultAgentEnv"> & {
|
|
17
|
+
readonly defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").AgentEnv;
|
|
18
|
+
metadata: Omit<AdapterMetadata, "protocolSupport"> & {
|
|
16
19
|
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
17
20
|
};
|
|
18
21
|
}>;
|
|
19
|
-
export default kimiCodeAdapter;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
|
|
2
|
-
export const
|
|
2
|
+
export const kimiCodeMetadata = {
|
|
3
3
|
type: "kimi-code",
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
4
|
+
mcp: true,
|
|
5
|
+
agentSources: ["provisioned"]
|
|
6
|
+
};
|
|
7
|
+
/** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
|
|
8
|
+
export function createKimiCodeAdapter(options) {
|
|
9
|
+
return createAcpAdapter({
|
|
10
|
+
metadata: kimiCodeMetadata,
|
|
11
|
+
type: "kimi-code",
|
|
12
|
+
provider: "kimi-code",
|
|
13
|
+
command: options.command,
|
|
14
|
+
args: ["acp"]
|
|
15
|
+
}, options);
|
|
16
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-adapter-kimi-code",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@mininglamp-oss/octo-runtime-adapter-acp": "1.1.
|
|
12
|
+
"@mininglamp-oss/octo-runtime-adapter-acp": "1.1.13"
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
|
|
1
3
|
/**
|
|
2
4
|
* MiniMax Code ACP adapter. Launches `mcode acp` and speaks the Agent Client
|
|
3
5
|
* Protocol through the shared ACP adapter, which reconstructs model steps,
|
|
@@ -10,22 +12,22 @@
|
|
|
10
12
|
* `session/load` returns an empty result is treated as a missing session and
|
|
11
13
|
* falls back to a fresh session (`emptyLoadResultMeansMissing`).
|
|
12
14
|
*/
|
|
13
|
-
export declare const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult
|
|
15
|
+
export declare const mcodeMetadata: AdapterMetadata;
|
|
16
|
+
/** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
|
|
17
|
+
export declare function createMcodeAdapter(options: NonNullable<Parameters<typeof createAcpAdapter>[1]> & {
|
|
18
|
+
command: string;
|
|
19
|
+
}): Readonly<Omit<{
|
|
20
|
+
metadata: AdapterMetadata;
|
|
21
|
+
probe: (() => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>) | (() => Promise<{
|
|
22
|
+
available: false;
|
|
23
|
+
command: string;
|
|
24
|
+
reason: string;
|
|
25
|
+
}>);
|
|
20
26
|
respondInteraction(invocationId: string, response: import("@mininglamp-oss/octo-runtime-protocol").InteractionResponse): Promise<void>;
|
|
21
27
|
invoke(request: import("@mininglamp-oss/octo-runtime-protocol").InvokeRequest, context?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterInvocationContext): AsyncGenerator<import("@mininglamp-oss/octo-runtime-protocol").CanonicalEvent>;
|
|
22
|
-
}, "metadata"> & {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type: string;
|
|
26
|
-
agentSources: "provisioned"[];
|
|
27
|
-
}, "protocolSupport"> & {
|
|
28
|
+
}, "metadata" | "defaultAgentEnv"> & {
|
|
29
|
+
readonly defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").AgentEnv;
|
|
30
|
+
metadata: Omit<AdapterMetadata, "protocolSupport"> & {
|
|
28
31
|
protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
|
|
29
32
|
};
|
|
30
33
|
}>;
|
|
31
|
-
export default mcodeAdapter;
|
|
@@ -11,11 +11,19 @@ import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
|
|
|
11
11
|
* `session/load` returns an empty result is treated as a missing session and
|
|
12
12
|
* falls back to a fresh session (`emptyLoadResultMeansMissing`).
|
|
13
13
|
*/
|
|
14
|
-
export const
|
|
14
|
+
export const mcodeMetadata = {
|
|
15
15
|
type: "mcode",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
mcp: true,
|
|
17
|
+
agentSources: ["provisioned"]
|
|
18
|
+
};
|
|
19
|
+
/** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
|
|
20
|
+
export function createMcodeAdapter(options) {
|
|
21
|
+
return createAcpAdapter({
|
|
22
|
+
metadata: mcodeMetadata,
|
|
23
|
+
type: "mcode",
|
|
24
|
+
provider: "mcode",
|
|
25
|
+
command: options.command,
|
|
26
|
+
args: ["acp"],
|
|
27
|
+
emptyLoadResultMeansMissing: true
|
|
28
|
+
}, options);
|
|
29
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-adapter-mcode",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@mininglamp-oss/octo-runtime-adapter-acp": "1.1.
|
|
12
|
+
"@mininglamp-oss/octo-runtime-adapter-acp": "1.1.13"
|
|
13
13
|
}
|
|
14
14
|
}
|