@ycodium-ai/agent-kimi 0.2.4351 → 0.2.4368
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 +5 -0
- package/dist/index.js +61 -27
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -12,6 +12,11 @@ customModels } }`; launch arguments (`acp`) and the account-directory variable (
|
|
|
12
12
|
- Models come from the read-only `kimi provider list --json` (`src/kimiModels.ts`); the version
|
|
13
13
|
from `kimi --version`. No probe session is created.
|
|
14
14
|
- Sign-in is `kimi login` (device-code flow), upgrade is `kimi upgrade`.
|
|
15
|
+
- Runtime modes map to native permissions: auto and auto-accept-edits → auto, full-access → yolo, approval-required → default.
|
|
16
|
+
The auto-accept-edits mapping is an approximation and may allow more than edits. Kimi has no
|
|
17
|
+
edits-only automatic native mode: default asks for approvals and plan does not execute tools.
|
|
18
|
+
A selected native mode governs approvals. Without native modes, auto permits MCP dynamic tools
|
|
19
|
+
(ACP kind `other` with an MCP name); questions and plan confirmations remain user input.
|
|
15
20
|
- Usage (ADR-0034), per instance, read only when the user asks. The account directory is the
|
|
16
21
|
`homePath` setting, an explicit `KIMI_CODE_HOME` in the instance environment, then the process
|
|
17
22
|
environment, then `~/.kimi-code`:
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var __export = (target, all) => {
|
|
|
8
8
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
9
9
|
|
|
10
10
|
// ../../packages/plugin-api/src/version.ts
|
|
11
|
-
var PLUGIN_API_VERSION =
|
|
11
|
+
var PLUGIN_API_VERSION = 112;
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
import * as NodeOS6 from "node:os";
|
|
@@ -27809,24 +27809,40 @@ function createExecutorUpdates({
|
|
|
27809
27809
|
return;
|
|
27810
27810
|
}
|
|
27811
27811
|
};
|
|
27812
|
-
const
|
|
27813
|
-
for (const
|
|
27812
|
+
const emitHookEvents = (hookEvents) => {
|
|
27813
|
+
for (const hookEvent of hookEvents ?? []) {
|
|
27814
|
+
if (hookEvent.type === "runtime.warning") {
|
|
27815
|
+
const message = hookEvent.payload.message.trim();
|
|
27816
|
+
if (message.length === 0) continue;
|
|
27817
|
+
emit({
|
|
27818
|
+
type: "runtime.warning",
|
|
27819
|
+
...stamp(),
|
|
27820
|
+
provider: options.provider,
|
|
27821
|
+
threadId: options.threadId,
|
|
27822
|
+
...hookEvent.turnId !== void 0 ? { turnId: hookEvent.turnId } : {},
|
|
27823
|
+
payload: {
|
|
27824
|
+
message,
|
|
27825
|
+
...hookEvent.payload.detail !== void 0 ? { detail: hookEvent.payload.detail } : {}
|
|
27826
|
+
}
|
|
27827
|
+
});
|
|
27828
|
+
continue;
|
|
27829
|
+
}
|
|
27814
27830
|
emit({
|
|
27815
|
-
type:
|
|
27831
|
+
type: hookEvent.type,
|
|
27816
27832
|
...stamp(),
|
|
27817
27833
|
provider: options.provider,
|
|
27818
27834
|
threadId: options.threadId,
|
|
27819
|
-
...
|
|
27820
|
-
payload:
|
|
27835
|
+
...hookEvent.turnId !== void 0 ? { turnId: hookEvent.turnId } : {},
|
|
27836
|
+
payload: hookEvent.payload
|
|
27821
27837
|
});
|
|
27822
27838
|
}
|
|
27823
27839
|
};
|
|
27824
27840
|
const toolSubagents = hooks.toolSubagents === void 0 ? void 0 : createToolSubagentTracker(hooks.toolSubagents);
|
|
27825
|
-
const settleToolSubagents = (settlement, turnId) =>
|
|
27841
|
+
const settleToolSubagents = (settlement, turnId) => emitHookEvents(toolSubagents?.settle(settlement, turnId));
|
|
27826
27842
|
const settleSessionEnded = () => {
|
|
27827
27843
|
settleToolSubagents("session-ended");
|
|
27828
|
-
|
|
27829
|
-
|
|
27844
|
+
emitHookEvents(subagentSessions?.settleSessionEnded());
|
|
27845
|
+
emitHookEvents(hooks.onSessionEnded?.());
|
|
27830
27846
|
};
|
|
27831
27847
|
const observeContext = () => ({
|
|
27832
27848
|
turnId: shared.activeTurnId,
|
|
@@ -27888,7 +27904,7 @@ function createExecutorUpdates({
|
|
|
27888
27904
|
};
|
|
27889
27905
|
const hookResult = call === void 0 ? void 0 : toolSubagents?.onToolCallUpdated(call) ?? hooks.onToolCallUpdated?.(call);
|
|
27890
27906
|
const handledByHook = hookResult !== void 0 && "events" in hookResult && hookResult.handled === true;
|
|
27891
|
-
|
|
27907
|
+
emitHookEvents(
|
|
27892
27908
|
hookResult === void 0 ? [] : "events" in hookResult ? hookResult.events : hookResult
|
|
27893
27909
|
);
|
|
27894
27910
|
if (nextToolCall.status === "completed" && hookResult && "artifacts" in hookResult)
|
|
@@ -27985,7 +28001,7 @@ function createExecutorUpdates({
|
|
|
27985
28001
|
};
|
|
27986
28002
|
const receiveSessionUpdate = (params) => {
|
|
27987
28003
|
const foreign = !shared.ownSessionIds.has(params.sessionId) && (shared.childSessions.has(params.sessionId) || shared.sessionOpensInFlight === 0 && shared.ownSessionIds.size > 0);
|
|
27988
|
-
|
|
28004
|
+
emitHookEvents(
|
|
27989
28005
|
subagentSessions?.observe(params, {
|
|
27990
28006
|
turnId: shared.activeTurnId,
|
|
27991
28007
|
foreign,
|
|
@@ -27995,7 +28011,7 @@ function createExecutorUpdates({
|
|
|
27995
28011
|
);
|
|
27996
28012
|
if (!shared.sessionLoadInFlight) {
|
|
27997
28013
|
if (hooks.onSessionUpdate) {
|
|
27998
|
-
|
|
28014
|
+
emitHookEvents(hooks.onSessionUpdate(params, { ...observeContext(), foreign }));
|
|
27999
28015
|
}
|
|
28000
28016
|
}
|
|
28001
28017
|
if (!foreign) handleSessionUpdate(params);
|
|
@@ -28003,7 +28019,7 @@ function createExecutorUpdates({
|
|
|
28003
28019
|
const receiveExtensionNotification = (method, params) => {
|
|
28004
28020
|
if (shared.sessionLoadInFlight || !hooks.onExtensionNotification) return;
|
|
28005
28021
|
const result = hooks.onExtensionNotification(method, params, observeContext());
|
|
28006
|
-
if (Array.isArray(result))
|
|
28022
|
+
if (Array.isArray(result)) emitHookEvents(result);
|
|
28007
28023
|
};
|
|
28008
28024
|
return {
|
|
28009
28025
|
emitCompactionState,
|
|
@@ -29402,9 +29418,7 @@ async function probeKimi(input2) {
|
|
|
29402
29418
|
return {
|
|
29403
29419
|
kind: "answered",
|
|
29404
29420
|
version: version2,
|
|
29405
|
-
models: listed.models
|
|
29406
|
-
nativeModes: [],
|
|
29407
|
-
currentNativeModeId: void 0
|
|
29421
|
+
models: listed.models
|
|
29408
29422
|
};
|
|
29409
29423
|
}
|
|
29410
29424
|
}
|
|
@@ -29447,8 +29461,27 @@ function kimiOpenCommands(session) {
|
|
|
29447
29461
|
};
|
|
29448
29462
|
}
|
|
29449
29463
|
|
|
29464
|
+
// src/nativeModes.ts
|
|
29465
|
+
var KIMI_NATIVE_MODE_REPORT = {
|
|
29466
|
+
nativeModes: [
|
|
29467
|
+
{ id: "default", name: "Default", description: "Manual approvals; tools execute normally." },
|
|
29468
|
+
{ id: "plan", name: "Plan", description: "Read-only planning; no tool execution." },
|
|
29469
|
+
{ id: "auto", name: "Auto", description: "Auto-approve safe operations." },
|
|
29470
|
+
{ id: "yolo", name: "YOLO", description: "Auto-approve everything." }
|
|
29471
|
+
],
|
|
29472
|
+
currentNativeModeId: "default",
|
|
29473
|
+
nativeModeByRuntimeMode: {
|
|
29474
|
+
auto: "auto",
|
|
29475
|
+
"auto-accept-edits": "auto",
|
|
29476
|
+
"full-access": "yolo",
|
|
29477
|
+
"approval-required": "default"
|
|
29478
|
+
}
|
|
29479
|
+
};
|
|
29480
|
+
|
|
29450
29481
|
// src/runtimeModeApproval.ts
|
|
29451
|
-
function acpRuntimeModeAutoApproves(runtimeMode, toolKind) {
|
|
29482
|
+
function acpRuntimeModeAutoApproves(runtimeMode, toolKind, toolName, nativeMode = false) {
|
|
29483
|
+
if (nativeMode) return false;
|
|
29484
|
+
if (runtimeMode === "auto" && toolKind === "other" && toolName?.startsWith("mcp__")) return true;
|
|
29452
29485
|
switch (runtimeMode) {
|
|
29453
29486
|
case "full-access":
|
|
29454
29487
|
return true;
|
|
@@ -29724,11 +29757,7 @@ var createKimiInstance = (config2, host) => {
|
|
|
29724
29757
|
readiness: "ready",
|
|
29725
29758
|
auth: auth(),
|
|
29726
29759
|
...outcome.models === void 0 ? {} : { models: outcome.models },
|
|
29727
|
-
|
|
29728
|
-
...outcome.nativeModes.length === 0 ? {} : {
|
|
29729
|
-
nativeModes: outcome.nativeModes,
|
|
29730
|
-
...outcome.currentNativeModeId === void 0 ? {} : { currentNativeModeId: outcome.currentNativeModeId }
|
|
29731
|
-
}
|
|
29760
|
+
...KIMI_NATIVE_MODE_REPORT
|
|
29732
29761
|
};
|
|
29733
29762
|
}
|
|
29734
29763
|
},
|
|
@@ -29773,10 +29802,15 @@ var createKimiInstance = (config2, host) => {
|
|
|
29773
29802
|
ACP_EFFORT_OPTION_ID
|
|
29774
29803
|
);
|
|
29775
29804
|
const hooks = kimiHooks(recipe);
|
|
29776
|
-
const autoApprove =
|
|
29777
|
-
threads.get(input2.threadId)?.session
|
|
29778
|
-
|
|
29779
|
-
|
|
29805
|
+
const autoApprove = (request) => {
|
|
29806
|
+
const session = threads.get(input2.threadId)?.session ?? input2;
|
|
29807
|
+
return acpRuntimeModeAutoApproves(
|
|
29808
|
+
session.runtimeMode,
|
|
29809
|
+
request.kind,
|
|
29810
|
+
request.toolCall?.title,
|
|
29811
|
+
session.nativeModeId !== void 0
|
|
29812
|
+
);
|
|
29813
|
+
};
|
|
29780
29814
|
const executor = createAcpExecutor({
|
|
29781
29815
|
readable,
|
|
29782
29816
|
writable,
|
|
@@ -29799,7 +29833,7 @@ var createKimiInstance = (config2, host) => {
|
|
|
29799
29833
|
// 握手声明了 `sessionCapabilities.resume`:续接走 session/resume,重新激活持久会话、
|
|
29800
29834
|
// 不重放历史(0.31.1 真机实测上下文还在);session/load 要把整段历史重放一遍,会话越长越慢。
|
|
29801
29835
|
resumeMethod: "session/resume",
|
|
29802
|
-
|
|
29836
|
+
autoApprove,
|
|
29803
29837
|
// 内置编排那一条排第一,后面跟用户在插件中心配的;缺了这一栏,
|
|
29804
29838
|
// `mcp__ycodium__*` 整套工具(浏览器等)在这只手的会话里都不存在。
|
|
29805
29839
|
// http / sse 由执行器按握手里的 `mcpCapabilities` 再筛。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-kimi",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4368",
|
|
4
4
|
"description": "Kimi Code executor: runs `kimi acp` over Agent Client Protocol stdio.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"@types/node": "24.12.4",
|
|
22
22
|
"esbuild": "0.28.1",
|
|
23
23
|
"vite-plus": "0.2.2",
|
|
24
|
-
"
|
|
25
|
-
"ycodium-
|
|
26
|
-
"ycodium-
|
|
24
|
+
"ycodium-acp-executor": "0.2.4368",
|
|
25
|
+
"ycodium-executor-testing": "0.0.0",
|
|
26
|
+
"@ycodium-ai/plugin-api": "0.2.4368"
|
|
27
27
|
},
|
|
28
28
|
"ycodium": {
|
|
29
29
|
"plugin": "./dist/index.js",
|