dsh-loop-engine-allinone 0.0.0-stage → 0.4.0
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/CHANGELOG.md +100 -0
- package/CONTRIBUTING.md +78 -0
- package/LICENSE +23 -0
- package/NOTICE +45 -0
- package/README.md +221 -2
- package/README.zh.md +89 -0
- package/SECURITY.md +39 -0
- package/cordis.patch.yml +3 -0
- package/lib/client.js +2166 -0
- package/lib/index.js +11621 -0
- package/lib/invariant.js +453 -0
- package/lib/types/agent-preset-ids.d.ts +276 -0
- package/lib/types/client/LoopEngineBadge.d.ts +71 -0
- package/lib/types/client/LoopEngineComposerSelect.d.ts +126 -0
- package/lib/types/client/LoopEngineSection.d.ts +35 -0
- package/lib/types/client/engine-marks.d.ts +87 -0
- package/lib/types/client/index.d.ts +39 -0
- package/lib/types/client/locales.d.ts +182 -0
- package/lib/types/client/reload.d.ts +135 -0
- package/lib/types/client/session-engine.d.ts +508 -0
- package/lib/types/client/store.d.ts +103 -0
- package/lib/types/client/turn-status.d.ts +234 -0
- package/lib/types/client/use-session-engine.d.ts +74 -0
- package/lib/types/commands.d.ts +77 -0
- package/lib/types/compat.d.ts +25 -0
- package/lib/types/driver-acp/agent.d.ts +289 -0
- package/lib/types/driver-acp/approval.d.ts +27 -0
- package/lib/types/driver-acp/capabilities.d.ts +200 -0
- package/lib/types/driver-acp/client.d.ts +297 -0
- package/lib/types/driver-acp/executable.d.ts +53 -0
- package/lib/types/driver-acp/mapping.d.ts +76 -0
- package/lib/types/driver-acp/profile.d.ts +126 -0
- package/lib/types/driver-acp/runtime.d.ts +45 -0
- package/lib/types/driver-acp/subprocess.d.ts +19 -0
- package/lib/types/driver-acp/terminal.d.ts +98 -0
- package/lib/types/driver-acp/transport.d.ts +43 -0
- package/lib/types/driver-acp/types.d.ts +152 -0
- package/lib/types/driver-cli/capability.d.ts +42 -0
- package/lib/types/driver-cli/cli-agent.d.ts +258 -0
- package/lib/types/driver-cli/cli-loop.d.ts +46 -0
- package/lib/types/driver-cli/flatten.d.ts +35 -0
- package/lib/types/driver-cli/frames.d.ts +128 -0
- package/lib/types/driver-cli/ndjson.d.ts +106 -0
- package/lib/types/driver-cli/session-sink.d.ts +333 -0
- package/lib/types/driver-cli/stream-json.d.ts +61 -0
- package/lib/types/driver-cli/text.d.ts +66 -0
- package/lib/types/driver-cli/transport.d.ts +84 -0
- package/lib/types/driver-core/agents-md-skill-provider.d.ts +72 -0
- package/lib/types/driver-core/assistant-stream.d.ts +68 -0
- package/lib/types/driver-core/context-files.d.ts +62 -0
- package/lib/types/driver-core/host-servers.d.ts +119 -0
- package/lib/types/driver-core/hosted-engine-runtime.d.ts +190 -0
- package/lib/types/driver-core/hosted-tool-vocabulary.d.ts +78 -0
- package/lib/types/driver-core/idle-child.d.ts +57 -0
- package/lib/types/driver-core/image-access.d.ts +25 -0
- package/lib/types/driver-core/inbox.d.ts +104 -0
- package/lib/types/driver-core/model-handover.d.ts +134 -0
- package/lib/types/driver-core/ownership.d.ts +41 -0
- package/lib/types/driver-core/permission-knobs.d.ts +26 -0
- package/lib/types/driver-core/prompt.d.ts +64 -0
- package/lib/types/driver-core/session-lifetime.d.ts +62 -0
- package/lib/types/driver-core/session-model.d.ts +128 -0
- package/lib/types/driver-core/skill-inject.d.ts +59 -0
- package/lib/types/driver-core/step-close.d.ts +49 -0
- package/lib/types/driver-core/step-images.d.ts +62 -0
- package/lib/types/driver-core/step-tools.d.ts +43 -0
- package/lib/types/driver-core/system-head.d.ts +43 -0
- package/lib/types/engine-agy/agent.d.ts +67 -0
- package/lib/types/engine-agy/frames.d.ts +90 -0
- package/lib/types/engine-agy/loop.d.ts +64 -0
- package/lib/types/engine-agy/process.d.ts +173 -0
- package/lib/types/engine-claude/agent.d.ts +186 -0
- package/lib/types/engine-claude/loop.d.ts +73 -0
- package/lib/types/engine-claude/mapping.d.ts +108 -0
- package/lib/types/engine-claude/permission.d.ts +41 -0
- package/lib/types/engine-claude/process.d.ts +59 -0
- package/lib/types/engine-claude/sdk.d.ts +67 -0
- package/lib/types/engine-claude/types.d.ts +28 -0
- package/lib/types/engine-codex/agent.d.ts +216 -0
- package/lib/types/engine-codex/appserver/client.d.ts +80 -0
- package/lib/types/engine-codex/appserver/mapping.d.ts +67 -0
- package/lib/types/engine-codex/appserver/thread.d.ts +66 -0
- package/lib/types/engine-codex/appserver/types.d.ts +225 -0
- package/lib/types/engine-codex/loop.d.ts +75 -0
- package/lib/types/engine-codex/model-handover.d.ts +56 -0
- package/lib/types/engine-codex/permission.d.ts +126 -0
- package/lib/types/engine-codex/skills.d.ts +28 -0
- package/lib/types/engine-codex/types.d.ts +36 -0
- package/lib/types/engine-drivers.d.ts +132 -0
- package/lib/types/engine-grok/agent.d.ts +24 -0
- package/lib/types/engine-grok/loop.d.ts +61 -0
- package/lib/types/engine-grok/process.d.ts +46 -0
- package/lib/types/engine-grok/profile.d.ts +82 -0
- package/lib/types/engine-hermes/agent.d.ts +47 -0
- package/lib/types/engine-hermes/loop.d.ts +56 -0
- package/lib/types/engine-hermes/process.d.ts +92 -0
- package/lib/types/engine-kimi/acp/client.d.ts +123 -0
- package/lib/types/engine-kimi/acp/mapping.d.ts +73 -0
- package/lib/types/engine-kimi/acp/types.d.ts +143 -0
- package/lib/types/engine-kimi/agent.d.ts +24 -0
- package/lib/types/engine-kimi/commands.d.ts +44 -0
- package/lib/types/engine-kimi/loop.d.ts +62 -0
- package/lib/types/engine-kimi/model-handover.d.ts +32 -0
- package/lib/types/engine-kimi/permission.d.ts +28 -0
- package/lib/types/engine-kimi/process.d.ts +47 -0
- package/lib/types/engine-kimi/profile.d.ts +19 -0
- package/lib/types/engine-kimi/skills.d.ts +52 -0
- package/lib/types/engine-kimi/types.d.ts +25 -0
- package/lib/types/engine-minimaxcode/agent.d.ts +24 -0
- package/lib/types/engine-minimaxcode/loop.d.ts +83 -0
- package/lib/types/engine-minimaxcode/process.d.ts +53 -0
- package/lib/types/engine-minimaxcode/profile.d.ts +72 -0
- package/lib/types/engine-of-session.d.ts +97 -0
- package/lib/types/engine-pi/agent.d.ts +230 -0
- package/lib/types/engine-pi/loop.d.ts +72 -0
- package/lib/types/engine-pi/model-handover.d.ts +84 -0
- package/lib/types/engine-pi/permission.d.ts +47 -0
- package/lib/types/engine-pi/rpc/client.d.ts +107 -0
- package/lib/types/engine-pi/rpc/mapping.d.ts +37 -0
- package/lib/types/engine-pi/rpc/types.d.ts +249 -0
- package/lib/types/engine-pi/skills.d.ts +47 -0
- package/lib/types/engine-pi/types.d.ts +36 -0
- package/lib/types/engine-qoderclicn/agent.d.ts +59 -0
- package/lib/types/engine-qoderclicn/loop.d.ts +51 -0
- package/lib/types/engine-qoderclicn/process.d.ts +113 -0
- package/lib/types/engine-registry.d.ts +584 -0
- package/lib/types/engine-remote.d.ts +192 -0
- package/lib/types/engine-surface.d.ts +36 -0
- package/lib/types/engine-zcode/agent.d.ts +50 -0
- package/lib/types/engine-zcode/loop.d.ts +47 -0
- package/lib/types/engine-zcode/process.d.ts +111 -0
- package/lib/types/index.d.ts +205 -0
- package/lib/types/invariant.d.ts +26 -0
- package/lib/types/model-selection-reset.d.ts +271 -0
- package/lib/types/namespace.d.ts +25 -0
- package/lib/types/patch-manager.d.ts +104 -0
- package/lib/types/preset.d.ts +254 -0
- package/lib/types/provider-route.d.ts +245 -0
- package/lib/types/router-loop.d.ts +458 -0
- package/lib/types/session-engine-store.d.ts +138 -0
- package/lib/types/settings.d.ts +60 -0
- package/lib/types/skills.d.ts +85 -0
- package/package.json +150 -4
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Client Protocol (ACP) wire types for the `kimi acp` driver.
|
|
3
|
+
*
|
|
4
|
+
* Kimi exposes the ACP adapter over stdio (JSON-RPC 2.0). The driver speaks a
|
|
5
|
+
* minimal, stable subset that a normal agent flow needs: initialize, session/new,
|
|
6
|
+
* session/prompt, session/cancel, plus the `session/update` notifications carrying
|
|
7
|
+
* incremental assistant text (`agent_message_chunk`), thinking
|
|
8
|
+
* (`agent_thought_chunk`), and tool calls (`tool_call` / `tool_call_update`).
|
|
9
|
+
* Tool-approval arrives as the reverse-RPC `session/request_permission`, which the
|
|
10
|
+
* client must answer. Shapes below are the live-record deltas observed against the
|
|
11
|
+
* 0.28.1 CLI; content blocks re-use a `{ type, text }` text shape (and tolerate
|
|
12
|
+
* other block types by ignoring them). The image block is modelled for the
|
|
13
|
+
* OUTGOING side — the bytes a dsh step delivers as an ACP image block.
|
|
14
|
+
*
|
|
15
|
+
* @module dsh-loop-engine/engine-kimi/acp/types
|
|
16
|
+
*/
|
|
17
|
+
/** A text content block in an ACP update (the observed kimi shape). */
|
|
18
|
+
export interface AcpTextContent {
|
|
19
|
+
readonly type: 'text';
|
|
20
|
+
readonly text: string;
|
|
21
|
+
}
|
|
22
|
+
/** One tool-call content block: the observed kimi `{ type: 'content', content }` nesting. */
|
|
23
|
+
export interface AcpToolContentBlock {
|
|
24
|
+
readonly type: 'content';
|
|
25
|
+
readonly content: AcpTextContent;
|
|
26
|
+
}
|
|
27
|
+
/** An image content block, as ACP/MCP spells it (base64 bytes + media type). */
|
|
28
|
+
export interface AcpImageContent {
|
|
29
|
+
readonly type: 'image';
|
|
30
|
+
/** Base64-encoded image bytes. */
|
|
31
|
+
readonly data: string;
|
|
32
|
+
/** The image's own media type. */
|
|
33
|
+
readonly mimeType: string;
|
|
34
|
+
}
|
|
35
|
+
/** A content block in a chunk/thought update; text is handled, others are ignored. */
|
|
36
|
+
export type AcpContentBlock = AcpTextContent | AcpImageContent | {
|
|
37
|
+
readonly type: 'resource_link' | 'audio' | string;
|
|
38
|
+
readonly [key: string]: unknown;
|
|
39
|
+
};
|
|
40
|
+
/** One `session/update` notification (partial; the discriminator is `sessionUpdate`). */
|
|
41
|
+
export interface AcpUpdate {
|
|
42
|
+
readonly sessionUpdate: string;
|
|
43
|
+
readonly [key: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A tool-call announcement (`sessionUpdate: 'tool_call'`).
|
|
47
|
+
*
|
|
48
|
+
* Measured against kimi 0.28.x: an announcement carries the call's identity
|
|
49
|
+
* (`toolCallId`/`title`/`kind`) and an empty content card, but **never** its
|
|
50
|
+
* input — `rawInput` only ever arrives on a later `tool_call_update` (the
|
|
51
|
+
* execution-start frame).
|
|
52
|
+
*/
|
|
53
|
+
export interface AcpToolCallExt extends AcpUpdate {
|
|
54
|
+
readonly sessionUpdate: 'tool_call';
|
|
55
|
+
readonly toolCallId: string;
|
|
56
|
+
readonly title: string;
|
|
57
|
+
readonly kind: string;
|
|
58
|
+
readonly status: string;
|
|
59
|
+
readonly content?: readonly AcpToolContentBlock[];
|
|
60
|
+
/** The call's real input; absent on the announcement (see above). */
|
|
61
|
+
readonly rawInput?: unknown;
|
|
62
|
+
}
|
|
63
|
+
/** A tool-call progress/result stream (`sessionUpdate: 'tool_call_update'`). */
|
|
64
|
+
export interface AcpToolCallStreamExt extends AcpUpdate {
|
|
65
|
+
readonly sessionUpdate: 'tool_call_update';
|
|
66
|
+
readonly toolCallId: string;
|
|
67
|
+
readonly status: string;
|
|
68
|
+
readonly content?: readonly AcpToolContentBlock[];
|
|
69
|
+
/** The call's real input, first present on the execution-start frame. */
|
|
70
|
+
readonly rawInput?: unknown;
|
|
71
|
+
/** The tool's raw structured output, present once the call settles. */
|
|
72
|
+
readonly rawOutput?: unknown;
|
|
73
|
+
}
|
|
74
|
+
/** One option the agent offers for a `session/request_permission`. */
|
|
75
|
+
export interface AcpPermissionOption {
|
|
76
|
+
/** Opaque id the client sends back in `outcome.optionId` (the only field the agent reads). */
|
|
77
|
+
readonly optionId: string;
|
|
78
|
+
/** Human-readable label for the option. */
|
|
79
|
+
readonly name?: string;
|
|
80
|
+
/** Option class: `allow_once` / `allow_always` / `reject_once` / `reject_always`. */
|
|
81
|
+
readonly kind?: string;
|
|
82
|
+
}
|
|
83
|
+
/** The `session/request_permission` reverse-RPC params. */
|
|
84
|
+
export interface AcpPermissionRequest {
|
|
85
|
+
readonly sessionId?: string;
|
|
86
|
+
/** Every option the agent will accept an answer for; empty means no answerable choice. */
|
|
87
|
+
readonly options?: readonly AcpPermissionOption[];
|
|
88
|
+
/** The tool call the prompt belongs to (presentation/correlation only). */
|
|
89
|
+
readonly toolCall?: unknown;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Terminal outcome of a permission request: the option the client picked, or
|
|
93
|
+
* `cancelled` when it had no answer to give.
|
|
94
|
+
*/
|
|
95
|
+
export type AcpPermissionOutcome = {
|
|
96
|
+
readonly outcome: 'selected';
|
|
97
|
+
readonly optionId: string;
|
|
98
|
+
} | {
|
|
99
|
+
readonly outcome: 'cancelled';
|
|
100
|
+
};
|
|
101
|
+
/** The `session/request_permission` result the agent expects (ACP `RequestPermissionResponse`). */
|
|
102
|
+
export interface AcpPermissionResponse {
|
|
103
|
+
readonly outcome: AcpPermissionOutcome;
|
|
104
|
+
}
|
|
105
|
+
/** Result of a completed `session/prompt` request (opaque; the turn ended). */
|
|
106
|
+
export interface AcpPromptResult {
|
|
107
|
+
readonly [key: string]: unknown;
|
|
108
|
+
}
|
|
109
|
+
/** The id-scoped response to a request (result or error). */
|
|
110
|
+
export interface AcpResponse {
|
|
111
|
+
readonly id: number;
|
|
112
|
+
readonly result?: unknown;
|
|
113
|
+
readonly error?: {
|
|
114
|
+
readonly code: number;
|
|
115
|
+
readonly message: string;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/** A JSON-RPC request/notification frame on the wire. */
|
|
119
|
+
export interface AcpFrame {
|
|
120
|
+
readonly jsonrpc: '2.0';
|
|
121
|
+
readonly id?: number;
|
|
122
|
+
readonly method?: string;
|
|
123
|
+
readonly params?: unknown;
|
|
124
|
+
readonly result?: unknown;
|
|
125
|
+
readonly error?: {
|
|
126
|
+
readonly code: number;
|
|
127
|
+
readonly message: string;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/** Guards toolkit: is the frame a `session/update` notification carrying an update. */
|
|
131
|
+
export declare function isUpdateFrame(frame: AcpFrame): frame is AcpFrame & {
|
|
132
|
+
readonly method: 'session/update';
|
|
133
|
+
readonly params: {
|
|
134
|
+
readonly sessionId: string;
|
|
135
|
+
readonly update: AcpUpdate;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
/** Guards toolkit: is the frame a reverse-RPC request needing an approval answer. */
|
|
139
|
+
export declare function isPermissionRequestFrame(frame: AcpFrame): frame is AcpFrame & {
|
|
140
|
+
readonly id: number;
|
|
141
|
+
readonly method: 'session/request_permission';
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kimi Code's ACP dialect's loop Agent: the shared ACP body with the dialect in `./profile.ts`.
|
|
3
|
+
*
|
|
4
|
+
* The class is this engine's published driver shape (and the seam a
|
|
5
|
+
* kimi-specific behaviour would land on); the dialect itself — argv, protocol
|
|
6
|
+
* version, model selection, session handshake — lives in `./profile.ts`, which
|
|
7
|
+
* imports no host service so it can be exercised by `scripts/probe/smoke-acp.ts`
|
|
8
|
+
* against the real CLI.
|
|
9
|
+
*
|
|
10
|
+
* @module dsh-loop-engine-allinone/engine-kimi/agent
|
|
11
|
+
*/
|
|
12
|
+
import type { AgentOptions } from '@deepseek-ai/dsh-agent';
|
|
13
|
+
import type { Session, SessionId } from '@deepseek-ai/dsh-session';
|
|
14
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
15
|
+
import type { AcpResolvedConfig } from '../driver-acp/profile.ts';
|
|
16
|
+
import type { AcpSpawnCapability } from '../driver-acp/transport.ts';
|
|
17
|
+
import { AcpEngineAgent } from '../driver-acp/agent.ts';
|
|
18
|
+
import { kimiProfile } from './profile.ts';
|
|
19
|
+
export { kimiProfile };
|
|
20
|
+
/** Kimi Code's ACP dialect's loop Agent: the shared ACP body with the profile's dialect. */
|
|
21
|
+
export declare class KimiAgent extends AcpEngineAgent {
|
|
22
|
+
constructor(loopCtx: Context, id: SessionId, options: AgentOptions, session: Session, config: AcpResolvedConfig, spawn: AcpSpawnCapability, bin?: string);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kimi Code slash-command bridge.
|
|
3
|
+
*
|
|
4
|
+
* The dsh `commands` runtime executes a registered command locally — the line is
|
|
5
|
+
* consumed and never reaches the model — so a command whose real processing
|
|
6
|
+
* lives inside the Kimi engine must forward the raw line back to the agent, which
|
|
7
|
+
* Kimi then expands natively. Registering the built-ins keeps them visible in
|
|
8
|
+
* the dsh web slash menu; unregistered `/lines` pass through as user text, but
|
|
9
|
+
* the menu would hide the engine's command surface.
|
|
10
|
+
*
|
|
11
|
+
* The list below is exactly what the `kimi acp` command surface implements
|
|
12
|
+
* (verified against kimi 0.28.1, both by driving `session/prompt` directly and
|
|
13
|
+
* by reading the `available_commands_update` the child publishes): `compact`,
|
|
14
|
+
* `status`, `usage`, `mcp`, `tasks`, `help`. Everything else Kimi's TUI offers
|
|
15
|
+
* (`/login`, `/provider`, `/settings`, `/sessions`, `/clear`, `/plan`, …) is a
|
|
16
|
+
* TUI control the ACP surface does not implement — forwarding one answers
|
|
17
|
+
* `Unknown ACP command: /name.` — so none of them is registered. `skill:`
|
|
18
|
+
* commands are already carried by the dsh skill injection seam and Kimi's own
|
|
19
|
+
* shorthand, so they are not duplicated here.
|
|
20
|
+
*
|
|
21
|
+
* `model` is deliberately absent even though the CLI has it: the dsh web
|
|
22
|
+
* client owns a `/model` contribution, and a same-named host command makes
|
|
23
|
+
* `ui-commands` throw the whole command menu source away, leaving only the
|
|
24
|
+
* skill group. `/goal` is absent too: the ACP surface implements no `/goal`, so
|
|
25
|
+
* registering one would only answer with an unknown-command error. Hosted
|
|
26
|
+
* sessions have no dsh `/goal` either — the engine preset they join strips the
|
|
27
|
+
* `command-goal` row (`src/preset.ts`, `STRIPPED_ROWS`) — so the command is
|
|
28
|
+
* simply not part of their menu.
|
|
29
|
+
*
|
|
30
|
+
* @module dsh-loop-engine-allinone/engine-kimi/commands
|
|
31
|
+
*/
|
|
32
|
+
import type { CommandDefinition, CommandInvocation, CommandResult } from '../commands.ts';
|
|
33
|
+
/**
|
|
34
|
+
* Build the forwarding handler for one Kimi slash command: it re-delivers the
|
|
35
|
+
* full `/<name> [args]` line to the receiving agent as a plain user message,
|
|
36
|
+
* where the engine expands it. `rawInput` already carries the separator
|
|
37
|
+
* whitespace and any arguments.
|
|
38
|
+
* @param name - the command name without the leading slash.
|
|
39
|
+
* @returns the command handler.
|
|
40
|
+
*/
|
|
41
|
+
export declare function forwardKimiCommand(name: string): (invocation: CommandInvocation) => CommandResult;
|
|
42
|
+
/** Kimi Code's built-in slash commands that the ACP surface implements. */
|
|
43
|
+
export declare const KIMI_COMMANDS: readonly CommandDefinition[];
|
|
44
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kimi Code loop engine module: drives every session it is handed through a
|
|
3
|
+
* persistent `kimi acp` child (Agent Client Protocol over stdio), speaking one
|
|
4
|
+
* stateless `session/new` + `session/prompt` per dsh step, with the durable
|
|
5
|
+
* session log as the sole source of model context. The router routes a session
|
|
6
|
+
* here on the plugin's own engine record, else its agent preset; this module is
|
|
7
|
+
* a library, not a Cordis plugin entry. Kimi has no host approval callback, so
|
|
8
|
+
* tool approvals surfaced by ACP (`session/request_permission`) are answered from
|
|
9
|
+
* the session's dsh approval knobs (an `ask` policy degrades to denial); the whole
|
|
10
|
+
* child is spawned through the dsh subprocess seam — the only available privilege
|
|
11
|
+
* boundary — and the sandbox stance follows the session's durable permission knobs
|
|
12
|
+
* as the subprocess provider resolves them (default read-only).
|
|
13
|
+
*
|
|
14
|
+
* @module dsh-loop-engine-allinone/engine-kimi
|
|
15
|
+
*/
|
|
16
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
17
|
+
import z from '@deepseek-ai/schemastery';
|
|
18
|
+
import type { AgentOptions } from '@deepseek-ai/dsh-agent';
|
|
19
|
+
import type { Session, SessionId } from '@deepseek-ai/dsh-session';
|
|
20
|
+
import { KimiAgent } from './agent.ts';
|
|
21
|
+
import { AcpEngineRuntime } from '../driver-acp/runtime.ts';
|
|
22
|
+
/** Grace in milliseconds for Kimi process-tree termination. */
|
|
23
|
+
export declare const KIMI_DISPOSE_GRACE_MS = 3000;
|
|
24
|
+
/** Deployment-owned configuration for the Kimi loop plugin. */
|
|
25
|
+
export interface Config {
|
|
26
|
+
/** Model sent per ACP session (`session/set_model`) when the session selects none; Kimi native config owns the model when omitted. */
|
|
27
|
+
model?: string;
|
|
28
|
+
/** Explicit environment entries passed to the `kimi` child. */
|
|
29
|
+
env?: Record<string, string>;
|
|
30
|
+
/** Kimi CLI executable; `'kimi'` resolves through PATH when not pinned to an absolute path. */
|
|
31
|
+
bin?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Idle window in milliseconds before a session's `kimi acp` child is shut
|
|
34
|
+
* down, spawned again by the next step. Omitted or non-positive keeps the
|
|
35
|
+
* child for the session's whole life.
|
|
36
|
+
*/
|
|
37
|
+
childIdleMs?: number;
|
|
38
|
+
}
|
|
39
|
+
/** Schema of the Kimi loop plugin configuration. */
|
|
40
|
+
export declare const Config: z<Config>;
|
|
41
|
+
/** Host-face ctx key this engine's runtime is registered under. */
|
|
42
|
+
export declare const KIMI_ENGINE_LABEL = "agentLoopKimi";
|
|
43
|
+
declare module '@deepseek-ai/cordis' {
|
|
44
|
+
interface Context {
|
|
45
|
+
agentLoopKimi: KimiLoop;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Creation/resume machinery for the Kimi Code engine. The process-wide
|
|
50
|
+
* AgentFactory slot belongs to the router, which delegates each session to the
|
|
51
|
+
* engine its preset names; this class is that engine's driver, not a plugin.
|
|
52
|
+
*
|
|
53
|
+
* Everything below the dialect is the shared ACP runtime
|
|
54
|
+
* (`driver-acp/runtime.ts`): kimi contributes its profile, which is its argv and
|
|
55
|
+
* its `KIMI_MODEL_*` endpoint handover.
|
|
56
|
+
*/
|
|
57
|
+
export declare class KimiLoop extends AcpEngineRuntime<KimiAgent> {
|
|
58
|
+
constructor(ctx: Context, config: Config);
|
|
59
|
+
/** Construct the Kimi ACP driver for one prepared session. */
|
|
60
|
+
protected buildAgent(loopCtx: Context, id: SessionId, options: AgentOptions, session: Session): KimiAgent;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=loop.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kimi Code's dialect for a dsh endpoint: the `KIMI_MODEL_*` environment
|
|
3
|
+
* variables of Kimi's own built-in env-model path.
|
|
4
|
+
*
|
|
5
|
+
* Kimi Code (the `kimi acp` child) reads these four variables while loading its
|
|
6
|
+
* configuration (`applyEnvModelConfig`, kimi's own `config/env-model.ts`): when
|
|
7
|
+
* `KIMI_MODEL_NAME` is set it defines one provider and one model alias from the
|
|
8
|
+
* quartet and points `defaultModel` at that alias. That is what makes a dsh
|
|
9
|
+
* model the child's default WITHOUT touching `~/.kimi-code/config.toml` — the
|
|
10
|
+
* whole handover is environment.
|
|
11
|
+
*
|
|
12
|
+
* The one translation is the provider `type` Kimi understands
|
|
13
|
+
* (`kimi` | `anthropic` | `openai`) versus dsh's wire-protocol name. A dsh
|
|
14
|
+
* protocol with no equivalent in that set is NOT guessed: the variable is
|
|
15
|
+
* omitted, so Kimi falls back to its own `kimi` default against dsh's base URL
|
|
16
|
+
* and fails loud on the request if that endpoint does not speak it.
|
|
17
|
+
*
|
|
18
|
+
* @module dsh-loop-engine-allinone/engine-kimi/model-handover
|
|
19
|
+
*/
|
|
20
|
+
import type { DshModelHandover } from '../driver-core/model-handover.ts';
|
|
21
|
+
/**
|
|
22
|
+
* Translate one dsh endpoint handover into the environment entries that point
|
|
23
|
+
* the `kimi acp` child at it.
|
|
24
|
+
*
|
|
25
|
+
* The credential value is carried in the child's environment (the only place a
|
|
26
|
+
* spawner outside this process can read it) and never returned anywhere else —
|
|
27
|
+
* no caller logs this object.
|
|
28
|
+
* @param handover - the resolved dsh endpoint for the session's selection.
|
|
29
|
+
* @returns the `KIMI_MODEL_*` entries to layer over the child's environment.
|
|
30
|
+
*/
|
|
31
|
+
export declare function kimiModelEnv(handover: DshModelHandover): Record<string, string>;
|
|
32
|
+
//# sourceMappingURL=model-handover.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool-approval mapping for the `kimi acp` driver.
|
|
3
|
+
*
|
|
4
|
+
* Kimi's ACP adapter surfaces tool/permission decisions as the reverse-RPC
|
|
5
|
+
* `session/request_permission`, which the client must answer. The dsh harness
|
|
6
|
+
* has no interactive approval callback in the unattended runtime, so the fold
|
|
7
|
+
* mirrors the codex/Pi bridges: an `ask` approval policy degrades to a denial
|
|
8
|
+
* (the only safe answer when no human is present), and anything else
|
|
9
|
+
* (`never`, or knob-less) auto-approves the tool. A full-access sandbox mode
|
|
10
|
+
* also auto-approves; a `workspace-write` stance is still auto-approved here
|
|
11
|
+
* because Kimi's own permission gating (`--permission`/session policy) is what
|
|
12
|
+
* bounds the tool — the ACP approval is the host's gate, and the dsh
|
|
13
|
+
* `approval/policy` knob is its signal.
|
|
14
|
+
*
|
|
15
|
+
* @module dsh-loop-engine-allinone/engine-kimi/permission
|
|
16
|
+
*/
|
|
17
|
+
import type { PermissionEvent } from '../driver-core/permission-knobs.ts';
|
|
18
|
+
/**
|
|
19
|
+
* Whether the driver should answer `session/request_permission` with approval for
|
|
20
|
+
* one query. An `ask` policy denies (fail-closed — no human is present in the
|
|
21
|
+
* unattended runtime); anything else (`never`, or knob-less) auto-approves. The
|
|
22
|
+
* sandbox stance is not consulted: Kimi's own tool policy bounds what a tool does,
|
|
23
|
+
* and the ACP approval is the host's gate, signalled by `approval/policy`.
|
|
24
|
+
* @param events - the durable session log.
|
|
25
|
+
* @returns whether tool requests are approved.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveToolApproval(events: readonly PermissionEvent[]): boolean;
|
|
28
|
+
//# sourceMappingURL=permission.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kimi CLI process projection: where the executable is, and the argv that
|
|
3
|
+
* launches its ACP server.
|
|
4
|
+
*
|
|
5
|
+
* The transport itself is shared (`driver-acp/transport.ts`); what is kimi's own
|
|
6
|
+
* is the RESOLUTION — kimi ships as a plain executable installed under its own
|
|
7
|
+
* home (`<KIMI_CODE_HOME>/bin/kimi[.exe]`), with PATH as the fallback — and the
|
|
8
|
+
* single `acp` subcommand that starts its Agent Client Protocol server on stdio.
|
|
9
|
+
*
|
|
10
|
+
* The `Kimi*` type names are this engine's published spelling of the shared
|
|
11
|
+
* transport types, kept as aliases rather than restated: a change to the seam
|
|
12
|
+
* cannot then reach one engine and miss another.
|
|
13
|
+
*
|
|
14
|
+
* @module dsh-loop-engine-allinone/engine-kimi/process
|
|
15
|
+
*/
|
|
16
|
+
import type { SubprocessHandle, SubprocessSpawnSpec } from '@deepseek-ai/dsh-subprocess';
|
|
17
|
+
import type { AcpProcess, AcpSpawnCapability, AcpSpawnSpec } from '../driver-acp/transport.ts';
|
|
18
|
+
/** The exact argv/cwd/env the driver requests for one `kimi acp` child. */
|
|
19
|
+
export type KimiSpawnSpec = AcpSpawnSpec;
|
|
20
|
+
/** A spawned Kimi process as the agent's transport needs it. */
|
|
21
|
+
export type KimiProcess = AcpProcess;
|
|
22
|
+
/** Spawns one Kimi child over the given spec (the driver's spawn capability). */
|
|
23
|
+
export type KimiSpawnCapability = AcpSpawnCapability;
|
|
24
|
+
/** Resolve the Kimi home directory from `KIMI_CODE_HOME` or the current user's home. */
|
|
25
|
+
export declare function kimiHomeDir(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve the Kimi CLI executable. An explicit config path wins; otherwise this
|
|
28
|
+
* probes the standard `<kimi home>/bin/kimi[.exe]` location and falls back to
|
|
29
|
+
* `'kimi'` (resolved through PATH by the spawner).
|
|
30
|
+
* @param configBin - an operator-pinned absolute path (or `'kimi'`), if any.
|
|
31
|
+
* @returns the executable to spawn as `argv[0]`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function kimiBinResolver(configBin?: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Build the persistent `kimi acp` argv. The ACP child stays alive across steps
|
|
36
|
+
* and is spoken to over JSON-RPC on stdio — the prompt is a request body, not an
|
|
37
|
+
* argv positional — so there is no command-line length ceiling and no model flag:
|
|
38
|
+
* a model is selected per ACP session through `session/set_model`, not argv.
|
|
39
|
+
* @param bin - the Kimi executable.
|
|
40
|
+
* @returns the argv, `argv[0]` being the executable.
|
|
41
|
+
*/
|
|
42
|
+
export declare function kimiAcpArgv(bin: string): string[];
|
|
43
|
+
/** Project the driver's spawn request onto the dsh subprocess seam. */
|
|
44
|
+
export declare function kimiSubprocessSpec(spec: KimiSpawnSpec, graceMs: number): SubprocessSpawnSpec;
|
|
45
|
+
/** Project a dsh subprocess handle onto the Kimi process transport. */
|
|
46
|
+
export declare function fromSubprocess(handle: SubprocessHandle): KimiProcess;
|
|
47
|
+
//# sourceMappingURL=process.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kimi Code's ACP driver: the shared ACP body plus kimi's own dialect.
|
|
3
|
+
*
|
|
4
|
+
* Kimi was the engine the shared body grew out of, so its dialect is the
|
|
5
|
+
* baseline: `kimi acp`, protocol version 1, `session/set_model` for model
|
|
6
|
+
* selection, and the one thing no other engine has — a translation of a dsh
|
|
7
|
+
* endpoint handover into the `KIMI_MODEL_*` environment its own env-model path
|
|
8
|
+
* reads.
|
|
9
|
+
*
|
|
10
|
+
* The dialect lives here, apart from the driver class in `./agent.ts`, so it
|
|
11
|
+
* imports no host service: `scripts/probe/smoke-acp.ts` exercises THIS profile
|
|
12
|
+
* (argv, protocol version, model selection, handover) against the real CLI.
|
|
13
|
+
*
|
|
14
|
+
* @module dsh-loop-engine-allinone/engine-kimi/profile
|
|
15
|
+
*/
|
|
16
|
+
import type { AcpEngineProfile } from '../driver-acp/profile.ts';
|
|
17
|
+
/** Kimi Code's ACP dialect, as the shared driver reads it. */
|
|
18
|
+
export declare function kimiProfile(bin: string): AcpEngineProfile;
|
|
19
|
+
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kimi Code skill provider: exposes the Kimi CLI's instruction files and skills
|
|
3
|
+
* as DSH skills.
|
|
4
|
+
*
|
|
5
|
+
* Kimi reads per-directory `AGENTS.md` files from the session cwd up to the git
|
|
6
|
+
* root, and installs skills from `skills/` directories — the user-level
|
|
7
|
+
* `$KIMI_CODE_HOME/skills/` (default `~/.kimi-code/skills/`) and the
|
|
8
|
+
* project-level `.kimi-code/skills/` (walking up to the git root). Each
|
|
9
|
+
* context-file set is surfaced as one user-invocable `agents-md` skill whose
|
|
10
|
+
* body is the concatenated file contents; every found `SKILL.md` catalog entry
|
|
11
|
+
* is surfaced under its own name, so the dsh skill-injection seam (`/name`
|
|
12
|
+
* gestures) can carry them into the prompt.
|
|
13
|
+
*
|
|
14
|
+
* Unlike pi and Codex, Kimi has no user-level instruction file: its user
|
|
15
|
+
* install root holds only the skills catalog.
|
|
16
|
+
*
|
|
17
|
+
* The generic `~/.agents/skills/` and `.agents/skills/` roots are deliberately
|
|
18
|
+
* not scanned here: dsh's own `skill-filesystem` provider already exposes them
|
|
19
|
+
* through the same registry in the web profile. Kimi built-in Skills are
|
|
20
|
+
* shipped inside the CLI and cannot be read from a stable on-disk location, so
|
|
21
|
+
* the filesystem subset above is authoritative for the web menu. Note the
|
|
22
|
+
* shared {@link parseSkillFile} mirrors the agents-skill frontmatter
|
|
23
|
+
* (`name`/`description`/`whenToUse`/`disable-model-invocation`); Kimi's own
|
|
24
|
+
* `disableModelInvocation`/`type` fields are not translated, so a `type: flow`
|
|
25
|
+
* skill is surfaced as model-invocable.
|
|
26
|
+
*
|
|
27
|
+
* The discovery algorithm itself lives in {@link AgentsMdSkillProvider}; this
|
|
28
|
+
* module supplies only Kimi's locations and ranks.
|
|
29
|
+
*
|
|
30
|
+
* @module dsh-loop-engine-allinone/engine-kimi/skills
|
|
31
|
+
*/
|
|
32
|
+
import { AgentsMdSkillProvider } from '../driver-core/agents-md-skill-provider.ts';
|
|
33
|
+
import type { SkillProviderControl } from '../skills.ts';
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the Kimi config directory, honoring the `KIMI_CODE_HOME` environment
|
|
36
|
+
* override and falling back to `~/.kimi-code`.
|
|
37
|
+
* @returns the absolute Kimi config directory.
|
|
38
|
+
*/
|
|
39
|
+
export declare function kimiAgentDir(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Skill provider that discovers context files and skills from Kimi's standard
|
|
42
|
+
* locations:
|
|
43
|
+
* - project `AGENTS.md` files between the cwd and the git root — surfaced as
|
|
44
|
+
* one `agents-md` skill;
|
|
45
|
+
* - project `.kimi-code/skills/` and user `~/.kimi-code/skills/` — each
|
|
46
|
+
* `SKILL.md` entry surfaced under its own name.
|
|
47
|
+
*/
|
|
48
|
+
export declare class KimiSkillProvider extends AgentsMdSkillProvider {
|
|
49
|
+
constructor(control: SkillProviderControl);
|
|
50
|
+
}
|
|
51
|
+
export default KimiSkillProvider;
|
|
52
|
+
//# sourceMappingURL=skills.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types of the Kimi Code loop driver. Types only — no runtime code.
|
|
3
|
+
*
|
|
4
|
+
* Kimi Code (`kimi`) has no host approval callback ("runs with the permissions
|
|
5
|
+
* of the user"), and its ACP surface already answers tool approvals through the
|
|
6
|
+
* shared fold. It exposes no `--tools` pruning flag on this surface either, so
|
|
7
|
+
* there is no per-driver permission lever to pin: the driver spawns the whole
|
|
8
|
+
* `kimi acp` child through the dsh subprocess seam — the only available privilege
|
|
9
|
+
* boundary — and the sandbox stance follows the session's durable permission
|
|
10
|
+
* knobs as the subprocess provider resolves them (default read-only).
|
|
11
|
+
*
|
|
12
|
+
* {@link ResolvedConfig} is the shared ACP configuration under this engine's
|
|
13
|
+
* published name: kimi, grok and MiniMax Code resolve the same four facts, so the
|
|
14
|
+
* shape lives once in `driver-acp/profile.ts` instead of three times here.
|
|
15
|
+
*
|
|
16
|
+
* @module dsh-loop-engine-allinone/engine-kimi/types
|
|
17
|
+
*/
|
|
18
|
+
import type { AcpResolvedConfig } from '../driver-acp/profile.ts';
|
|
19
|
+
/**
|
|
20
|
+
* Driver configuration after defaults and load-time validation: the model the
|
|
21
|
+
* session selects when it has none, the child's environment, the executable, and
|
|
22
|
+
* the idle window after which the ACP child is released.
|
|
23
|
+
*/
|
|
24
|
+
export type ResolvedConfig = AcpResolvedConfig;
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MiniMax Code's loop Agent: the shared ACP body with the dialect in `./profile.ts`.
|
|
3
|
+
*
|
|
4
|
+
* The class is this engine's published driver shape (and the seam a
|
|
5
|
+
* minimaxcode-specific behaviour would land on); the dialect itself — argv, protocol
|
|
6
|
+
* version, model selection, session handshake — lives in `./profile.ts`, which
|
|
7
|
+
* imports no host service so it can be exercised by `scripts/probe/smoke-acp.ts`
|
|
8
|
+
* against the real CLI.
|
|
9
|
+
*
|
|
10
|
+
* @module dsh-loop-engine-allinone/engine-minimaxcode/agent
|
|
11
|
+
*/
|
|
12
|
+
import type { AgentOptions } from '@deepseek-ai/dsh-agent';
|
|
13
|
+
import type { Session, SessionId } from '@deepseek-ai/dsh-session';
|
|
14
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
15
|
+
import type { AcpResolvedConfig } from '../driver-acp/profile.ts';
|
|
16
|
+
import type { AcpSpawnCapability } from '../driver-acp/transport.ts';
|
|
17
|
+
import { AcpEngineAgent } from '../driver-acp/agent.ts';
|
|
18
|
+
import { minimaxcodeProfile } from './profile.ts';
|
|
19
|
+
export { minimaxcodeProfile };
|
|
20
|
+
/** MiniMax Code's loop Agent: the shared ACP body with the profile's dialect. */
|
|
21
|
+
export declare class MinimaxcodeAgent extends AcpEngineAgent {
|
|
22
|
+
constructor(loopCtx: Context, id: SessionId, options: AgentOptions, session: Session, config: AcpResolvedConfig, spawn: AcpSpawnCapability, bin?: string);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MiniMax Code loop engine module: drives every session it is handed through a
|
|
3
|
+
* persistent `mcode acp` child (Agent Client Protocol over stdio), speaking one
|
|
4
|
+
* stateless `session/new` + `session/prompt` per dsh step, with the durable
|
|
5
|
+
* session log as the sole source of model context. The router routes a session
|
|
6
|
+
* here on the plugin's own engine record, else its agent preset; this module is a
|
|
7
|
+
* library, not a Cordis plugin entry.
|
|
8
|
+
*
|
|
9
|
+
* The engine's SUBSCRIPTION is what this driver is for: the plugin never logs in
|
|
10
|
+
* and never touches credentials — the user runs `mcode login --region …` once and
|
|
11
|
+
* `mcode provider use token-plan` to spend the M Plan allowance, and the region
|
|
12
|
+
* reaches the child as the environment variable the CLI reads
|
|
13
|
+
* ({@link Config.region}).
|
|
14
|
+
*
|
|
15
|
+
* Everything below the dialect is the shared ACP runtime
|
|
16
|
+
* (`driver-acp/runtime.ts`).
|
|
17
|
+
*
|
|
18
|
+
* @module dsh-loop-engine-allinone/engine-minimaxcode
|
|
19
|
+
*/
|
|
20
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
21
|
+
import z from '@deepseek-ai/schemastery';
|
|
22
|
+
import type { AgentOptions } from '@deepseek-ai/dsh-agent';
|
|
23
|
+
import type { Session, SessionId } from '@deepseek-ai/dsh-session';
|
|
24
|
+
import type { AcpResolvedConfig } from '../driver-acp/profile.ts';
|
|
25
|
+
import { AcpEngineRuntime } from '../driver-acp/runtime.ts';
|
|
26
|
+
import { MinimaxcodeAgent } from './agent.ts';
|
|
27
|
+
/** Deployment-owned configuration for the MiniMax Code engine. */
|
|
28
|
+
export interface Config {
|
|
29
|
+
/** Model sent per ACP session (`session/set_config_option`) when the session selects none. */
|
|
30
|
+
model?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Explicit environment entries passed to the child.
|
|
33
|
+
*
|
|
34
|
+
* Usually empty on purpose: MiniMax Code reads its own region-scoped
|
|
35
|
+
* credentials from `~/.minimax`. Setting the region variable here is rejected
|
|
36
|
+
* when it disagrees with {@link Config.region}, so the one knob that owns the
|
|
37
|
+
* region is always unambiguous.
|
|
38
|
+
*/
|
|
39
|
+
env?: Record<string, string>;
|
|
40
|
+
/** The `mcode` entrypoint (an absolute path), resolved from the npm prefixes then PATH when not pinned. */
|
|
41
|
+
bin?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The account region the child runs under (`cn` or `global`, default `cn`).
|
|
44
|
+
*
|
|
45
|
+
* It is a real deployment fact rather than a preference: the CLI's login
|
|
46
|
+
* endpoint and its stored credentials are BOTH region-scoped, so a child told
|
|
47
|
+
* the wrong region cannot see the account the user signed in with. It travels in
|
|
48
|
+
* the environment variable the registry row names
|
|
49
|
+
* (`region.envVar`, measured as `MAVIS_REGION` — NOT `MCODE_REGION`, which is
|
|
50
|
+
* inert on this path).
|
|
51
|
+
*/
|
|
52
|
+
region?: string;
|
|
53
|
+
/** Idle window in milliseconds before a session's ACP child is shut down; zero or less keeps it. */
|
|
54
|
+
childIdleMs?: number;
|
|
55
|
+
}
|
|
56
|
+
/** Schema of the MiniMax Code engine configuration. */
|
|
57
|
+
export declare const Config: z<Config>;
|
|
58
|
+
/**
|
|
59
|
+
* Resolve the driver configuration at the plugin config boundary.
|
|
60
|
+
* @param config - the deployment's knobs.
|
|
61
|
+
* @returns the configuration the shared ACP runtime consumes.
|
|
62
|
+
* @throws when the deployment pins a region the CLI does not accept, or pins one
|
|
63
|
+
* in `env` that contradicts {@link Config.region}.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveConfig(config: Config): AcpResolvedConfig;
|
|
66
|
+
/** Host-face ctx key this engine's runtime is registered under. */
|
|
67
|
+
export declare const MINIMAXCODE_ENGINE_LABEL = "agentLoopMinimaxcode";
|
|
68
|
+
declare module '@deepseek-ai/cordis' {
|
|
69
|
+
interface Context {
|
|
70
|
+
agentLoopMinimaxcode: MinimaxcodeLoop;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Creation/resume machinery for the MiniMax Code engine. The process-wide
|
|
75
|
+
* AgentFactory slot belongs to the router, which delegates each session to the
|
|
76
|
+
* engine its preset names; this class is that engine's driver, not a plugin.
|
|
77
|
+
*/
|
|
78
|
+
export declare class MinimaxcodeLoop extends AcpEngineRuntime<MinimaxcodeAgent> {
|
|
79
|
+
constructor(ctx: Context, config: Config);
|
|
80
|
+
/** Construct the MiniMax Code ACP driver for one prepared session. */
|
|
81
|
+
protected buildAgent(loopCtx: Context, id: SessionId, options: AgentOptions, session: Session): MinimaxcodeAgent;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=loop.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MiniMax Code process projection: where the `mcode` entrypoint is, and the argv
|
|
3
|
+
* that starts its ACP server.
|
|
4
|
+
*
|
|
5
|
+
* Measured facts this file encodes (MiniMax Code 0.6.12 on this fork's reference
|
|
6
|
+
* host):
|
|
7
|
+
*
|
|
8
|
+
* - the ACP server is `mcode acp` (`--help`: "Run MiniMax Code as an Agent
|
|
9
|
+
* Client Protocol server over stdio");
|
|
10
|
+
* - the CLI is distributed as the npm package `@minimax-ai/code`, whose own
|
|
11
|
+
* entrypoint is `cli.js`. A global install leaves `mcode.cmd` / `mcode.ps1` /
|
|
12
|
+
* `mcode` shims on PATH and NO `mcode.exe`, so spawning the bare name fails
|
|
13
|
+
* with `ENOENT` under node's spawn — the measured failure this resolver exists
|
|
14
|
+
* to avoid. The package entrypoint is therefore preferred, and a `.cmd` that is
|
|
15
|
+
* all a machine has is launched through the command interpreter
|
|
16
|
+
* (`driver-acp/executable.ts`);
|
|
17
|
+
* - the account REGION is a first-class fact (`mcode login --region cn|global`,
|
|
18
|
+
* credentials under `~/.minimax/auth/prod/<region>/…`), so the region travels
|
|
19
|
+
* in the child's environment rather than as an argv flag — `mcode acp` takes
|
|
20
|
+
* none. The variable is `MAVIS_REGION`, MEASURED as the one this surface
|
|
21
|
+
* honours (`MCODE_REGION` is inert here); it is named by the registry row and
|
|
22
|
+
* resolved by `./loop.ts`, never spelled in this file.
|
|
23
|
+
*
|
|
24
|
+
* @module dsh-loop-engine-allinone/engine-minimaxcode/process
|
|
25
|
+
*/
|
|
26
|
+
/** Grace in milliseconds for MiniMax Code process-tree termination. */
|
|
27
|
+
export declare const MINIMAXCODE_DISPOSE_GRACE_MS = 3000;
|
|
28
|
+
/** The npm package that ships the CLI. */
|
|
29
|
+
export declare const MINIMAXCODE_NPM_PACKAGE = "@minimax-ai/code";
|
|
30
|
+
/** The package-relative entrypoint that starts the CLI. */
|
|
31
|
+
export declare const MINIMAXCODE_ENTRYPOINT = "cli.js";
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the MiniMax Code entrypoint.
|
|
34
|
+
*
|
|
35
|
+
* Order: an explicit config path; the package entrypoint under the npm prefixes
|
|
36
|
+
* this machine is likely to have; a PATH lookup that honours `PATHEXT`; and
|
|
37
|
+
* finally the bare name, which the spawner resolves.
|
|
38
|
+
* @param configBin - an operator-pinned path (or a bare name), if any.
|
|
39
|
+
* @param env - the environment to read the npm prefix hints from.
|
|
40
|
+
* @returns the executable (or `.js` entrypoint) to spawn.
|
|
41
|
+
*/
|
|
42
|
+
export declare function mcodeBinResolver(configBin?: string, env?: NodeJS.ProcessEnv): string;
|
|
43
|
+
/**
|
|
44
|
+
* Build the argv that starts `mcode acp`.
|
|
45
|
+
*
|
|
46
|
+
* A `.js` entrypoint runs under the current node; a `.cmd` shim goes through
|
|
47
|
+
* `cmd.exe`; a real executable is spawned as itself (see
|
|
48
|
+
* `driver-acp/executable.ts`).
|
|
49
|
+
* @param bin - the resolved entrypoint.
|
|
50
|
+
* @returns the argv, `argv[0]` being the program to launch.
|
|
51
|
+
*/
|
|
52
|
+
export declare function mcodeAcpArgv(bin: string): string[];
|
|
53
|
+
//# sourceMappingURL=process.d.ts.map
|