@ycodium-ai/agent-kimi 0.2.2882 → 0.2.2892
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/dist/index.js +80 -21
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -92,7 +92,7 @@ var KIMI_CARD = {
|
|
|
92
92
|
|
|
93
93
|
// src/kimiInstance.ts
|
|
94
94
|
import * as NodeOS4 from "node:os";
|
|
95
|
-
import * as
|
|
95
|
+
import * as NodePath6 from "node:path";
|
|
96
96
|
import { mergeLaunchEnv, modelSelectionStringOption } from "@ycodium-ai/plugin-api/executor";
|
|
97
97
|
import { nodeStreamsFromHandle } from "@ycodium-ai/plugin-api/process-stdin";
|
|
98
98
|
|
|
@@ -24126,6 +24126,60 @@ function approvalOutcomeForDecision(decision, optionId) {
|
|
|
24126
24126
|
return decision !== "cancel" && optionId !== void 0 ? { outcome: "selected", optionId } : { outcome: "cancelled" };
|
|
24127
24127
|
}
|
|
24128
24128
|
|
|
24129
|
+
// ../../packages/ycodium-acp-executor/src/artifacts.ts
|
|
24130
|
+
import * as NodePath from "node:path";
|
|
24131
|
+
import * as NodeURL from "node:url";
|
|
24132
|
+
function resourceLinkArtifacts(content) {
|
|
24133
|
+
if (content["type"] !== "resource_link" || typeof content["uri"] !== "string") return [];
|
|
24134
|
+
const uri = content["uri"].trim();
|
|
24135
|
+
let path;
|
|
24136
|
+
try {
|
|
24137
|
+
path = uri.toLowerCase().startsWith("file:") ? NodeURL.fileURLToPath(uri) : uri;
|
|
24138
|
+
} catch {
|
|
24139
|
+
return [];
|
|
24140
|
+
}
|
|
24141
|
+
if (!NodePath.isAbsolute(path)) return [];
|
|
24142
|
+
const name = typeof content["name"] === "string" ? content["name"].trim() : "";
|
|
24143
|
+
const mimeType = typeof content["mimeType"] === "string" ? content["mimeType"].trim() : "";
|
|
24144
|
+
return [
|
|
24145
|
+
{
|
|
24146
|
+
path,
|
|
24147
|
+
...name.length > 0 ? { name } : {},
|
|
24148
|
+
...mimeType.length > 0 ? { mimeType } : {}
|
|
24149
|
+
}
|
|
24150
|
+
];
|
|
24151
|
+
}
|
|
24152
|
+
function acpArtifactEvent(input2) {
|
|
24153
|
+
if (input2.artifacts.length === 0) return void 0;
|
|
24154
|
+
const { toolCallId } = input2;
|
|
24155
|
+
return {
|
|
24156
|
+
...input2.base,
|
|
24157
|
+
type: "assistant.artifact.produced",
|
|
24158
|
+
payload: {
|
|
24159
|
+
artifacts: input2.artifacts.map((artifact) => ({
|
|
24160
|
+
...artifact,
|
|
24161
|
+
...toolCallId !== void 0 ? { toolCallId } : {}
|
|
24162
|
+
}))
|
|
24163
|
+
}
|
|
24164
|
+
};
|
|
24165
|
+
}
|
|
24166
|
+
function makeArtifactEmitter(input2) {
|
|
24167
|
+
return (artifacts, toolCallId) => {
|
|
24168
|
+
const turnId = input2.turnId();
|
|
24169
|
+
const event = acpArtifactEvent({
|
|
24170
|
+
artifacts,
|
|
24171
|
+
toolCallId,
|
|
24172
|
+
base: {
|
|
24173
|
+
...input2.stamp(),
|
|
24174
|
+
provider: input2.options.provider,
|
|
24175
|
+
threadId: input2.options.threadId,
|
|
24176
|
+
...turnId === void 0 ? {} : { turnId }
|
|
24177
|
+
}
|
|
24178
|
+
});
|
|
24179
|
+
if (event !== void 0) input2.emit(event);
|
|
24180
|
+
};
|
|
24181
|
+
}
|
|
24182
|
+
|
|
24129
24183
|
// ../../packages/ycodium-acp-executor/src/event-stream.ts
|
|
24130
24184
|
var UnboundedEventStream = class {
|
|
24131
24185
|
subscribers = /* @__PURE__ */ new Set();
|
|
@@ -25549,9 +25603,8 @@ function createAcpExecutor(options) {
|
|
|
25549
25603
|
options.originBindingGeneration === void 0 ? event : { ...event, originBindingGeneration: options.originBindingGeneration }
|
|
25550
25604
|
);
|
|
25551
25605
|
};
|
|
25552
|
-
const emit =
|
|
25553
|
-
|
|
25554
|
-
};
|
|
25606
|
+
const emit = publish;
|
|
25607
|
+
const emitArtifacts = makeArtifactEmitter({ emit, stamp, options, turnId: () => activeTurnId });
|
|
25555
25608
|
const failIfDisposed = () => {
|
|
25556
25609
|
if (disposed) {
|
|
25557
25610
|
throw new AcpExecutorDisposedError();
|
|
@@ -25654,6 +25707,8 @@ function createAcpExecutor(options) {
|
|
|
25654
25707
|
payload: taskEvent.payload
|
|
25655
25708
|
});
|
|
25656
25709
|
}
|
|
25710
|
+
if (nextToolCall.status === "completed" && hookResult && "artifacts" in hookResult)
|
|
25711
|
+
emitArtifacts(hookResult.artifacts ?? [], nextToolCall.toolCallId);
|
|
25657
25712
|
if (handledByHook || !decision.emit) {
|
|
25658
25713
|
continue;
|
|
25659
25714
|
}
|
|
@@ -25673,6 +25728,10 @@ function createAcpExecutor(options) {
|
|
|
25673
25728
|
);
|
|
25674
25729
|
continue;
|
|
25675
25730
|
}
|
|
25731
|
+
if (event._tag === "AssistantContentBlock") {
|
|
25732
|
+
emitArtifacts(resourceLinkArtifacts(event.content));
|
|
25733
|
+
continue;
|
|
25734
|
+
}
|
|
25676
25735
|
if (event._tag === "CompactionUpdated") {
|
|
25677
25736
|
applyCompactionUpdate(event);
|
|
25678
25737
|
continue;
|
|
@@ -26856,7 +26915,7 @@ function tokenizeLaunchArgs(value) {
|
|
|
26856
26915
|
|
|
26857
26916
|
// src/kimi.ts
|
|
26858
26917
|
import * as NodeFS from "node:fs";
|
|
26859
|
-
import * as
|
|
26918
|
+
import * as NodePath2 from "node:path";
|
|
26860
26919
|
var KIMI_USER_INPUT_TITLES = /* @__PURE__ */ new Set(["AskUserQuestion", "ExitPlanMode"]);
|
|
26861
26920
|
var KIMI_PLAN_ACTIONS = {
|
|
26862
26921
|
plan_approve: "approve",
|
|
@@ -26957,7 +27016,7 @@ function readTail(filePath) {
|
|
|
26957
27016
|
}
|
|
26958
27017
|
}
|
|
26959
27018
|
function findKimiSessionWireLog(input2) {
|
|
26960
|
-
const sessionsRoot =
|
|
27019
|
+
const sessionsRoot = NodePath2.join(input2.homePath, SESSIONS_DIR);
|
|
26961
27020
|
let workspaces;
|
|
26962
27021
|
try {
|
|
26963
27022
|
workspaces = NodeFS.readdirSync(sessionsRoot);
|
|
@@ -26965,7 +27024,7 @@ function findKimiSessionWireLog(input2) {
|
|
|
26965
27024
|
return void 0;
|
|
26966
27025
|
}
|
|
26967
27026
|
for (const workspace of workspaces) {
|
|
26968
|
-
const candidate =
|
|
27027
|
+
const candidate = NodePath2.join(
|
|
26969
27028
|
sessionsRoot,
|
|
26970
27029
|
workspace,
|
|
26971
27030
|
input2.acpSessionId,
|
|
@@ -26986,7 +27045,7 @@ function readKimiContextWindow(input2) {
|
|
|
26986
27045
|
// src/kimiQuota.ts
|
|
26987
27046
|
import * as NodeFS3 from "node:fs";
|
|
26988
27047
|
import * as NodeOS2 from "node:os";
|
|
26989
|
-
import * as
|
|
27048
|
+
import * as NodePath4 from "node:path";
|
|
26990
27049
|
import {
|
|
26991
27050
|
parseRetryAfterMs
|
|
26992
27051
|
} from "@ycodium-ai/plugin-api/usage";
|
|
@@ -26994,10 +27053,10 @@ import {
|
|
|
26994
27053
|
// src/kimiAccount.ts
|
|
26995
27054
|
import * as NodeFS2 from "node:fs";
|
|
26996
27055
|
import * as NodeOS from "node:os";
|
|
26997
|
-
import * as
|
|
27056
|
+
import * as NodePath3 from "node:path";
|
|
26998
27057
|
function kimiCredentialsPath(resolvedHomePath) {
|
|
26999
|
-
const home = resolvedHomePath.trim().length > 0 ? resolvedHomePath :
|
|
27000
|
-
return
|
|
27058
|
+
const home = resolvedHomePath.trim().length > 0 ? resolvedHomePath : NodePath3.join(NodeOS.homedir(), ".kimi-code");
|
|
27059
|
+
return NodePath3.join(home, "credentials", "kimi-code.json");
|
|
27001
27060
|
}
|
|
27002
27061
|
var nonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
27003
27062
|
function readKimiAuthState(resolvedHomePath) {
|
|
@@ -27168,12 +27227,12 @@ var kimiEffectiveHome = (resolvedHomePath, processEnvHome) => {
|
|
|
27168
27227
|
var createKimiUsage = (input2) => {
|
|
27169
27228
|
const now = input2.now ?? Date.now;
|
|
27170
27229
|
const processEnv = input2.processEnv ?? process.env;
|
|
27171
|
-
const home = input2.homePath.trim().length > 0 ? input2.homePath :
|
|
27230
|
+
const home = input2.homePath.trim().length > 0 ? input2.homePath : NodePath4.join(NodeOS2.homedir(), ".kimi-code");
|
|
27172
27231
|
const credentialsPath = kimiCredentialsPath(input2.homePath);
|
|
27173
27232
|
const readQuota = async (request) => {
|
|
27174
27233
|
let configToml = null;
|
|
27175
27234
|
try {
|
|
27176
|
-
configToml = NodeFS3.readFileSync(
|
|
27235
|
+
configToml = NodeFS3.readFileSync(NodePath4.join(home, "config.toml"), "utf8");
|
|
27177
27236
|
} catch (error62) {
|
|
27178
27237
|
if (error62.code !== "ENOENT") {
|
|
27179
27238
|
return { status: "unavailable", reason: "unreachable" };
|
|
@@ -27237,7 +27296,7 @@ var createKimiUsage = (input2) => {
|
|
|
27237
27296
|
// src/kimiTokens.ts
|
|
27238
27297
|
import * as NodeFS4 from "node:fs";
|
|
27239
27298
|
import * as NodeOS3 from "node:os";
|
|
27240
|
-
import * as
|
|
27299
|
+
import * as NodePath5 from "node:path";
|
|
27241
27300
|
var MTIME_SLACK_MS = 36 * 60 * 60 * 1e3;
|
|
27242
27301
|
var GUARD_LENGTH = 64;
|
|
27243
27302
|
var isRecord8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -27282,10 +27341,10 @@ var readDirs = (dir) => {
|
|
|
27282
27341
|
var listWireLogs = (sessionsRoot) => {
|
|
27283
27342
|
const found = [];
|
|
27284
27343
|
for (const workspace of readDirs(sessionsRoot)) {
|
|
27285
|
-
for (const session of readDirs(
|
|
27286
|
-
const agentsDir =
|
|
27344
|
+
for (const session of readDirs(NodePath5.join(sessionsRoot, workspace))) {
|
|
27345
|
+
const agentsDir = NodePath5.join(sessionsRoot, workspace, session, "agents");
|
|
27287
27346
|
for (const agent of readDirs(agentsDir)) {
|
|
27288
|
-
found.push({ file:
|
|
27347
|
+
found.push({ file: NodePath5.join(agentsDir, agent, "wire.jsonl"), sessionId: session });
|
|
27289
27348
|
}
|
|
27290
27349
|
}
|
|
27291
27350
|
}
|
|
@@ -27309,8 +27368,8 @@ var readRange = (file2, from, to) => {
|
|
|
27309
27368
|
};
|
|
27310
27369
|
var guardOf = (file2, size) => readRange(file2, 0, Math.min(size, GUARD_LENGTH)).toString("base64");
|
|
27311
27370
|
var createKimiTokenReader = (input2) => {
|
|
27312
|
-
const home = input2.homePath.trim().length > 0 ?
|
|
27313
|
-
const sessionsRoot =
|
|
27371
|
+
const home = input2.homePath.trim().length > 0 ? NodePath5.resolve(input2.homePath) : NodePath5.join(NodeOS3.homedir(), ".kimi-code");
|
|
27372
|
+
const sessionsRoot = NodePath5.join(home, "sessions");
|
|
27314
27373
|
const memos = /* @__PURE__ */ new Map();
|
|
27315
27374
|
const refresh = (file2, size) => {
|
|
27316
27375
|
const guard = guardOf(file2, size);
|
|
@@ -27600,7 +27659,7 @@ var EventBus = class {
|
|
|
27600
27659
|
function expandHomePath(value) {
|
|
27601
27660
|
if (value === "~") return NodeOS4.homedir();
|
|
27602
27661
|
if (value.startsWith("~/") || value.startsWith("~\\")) {
|
|
27603
|
-
return
|
|
27662
|
+
return NodePath6.join(NodeOS4.homedir(), value.slice(2));
|
|
27604
27663
|
}
|
|
27605
27664
|
return value;
|
|
27606
27665
|
}
|
|
@@ -27625,7 +27684,7 @@ function nowIso() {
|
|
|
27625
27684
|
}
|
|
27626
27685
|
function kimiContinuationKey(recipe) {
|
|
27627
27686
|
const homePath = recipe.homePath.trim();
|
|
27628
|
-
const resolvedHomePath = homePath.length > 0 ?
|
|
27687
|
+
const resolvedHomePath = homePath.length > 0 ? NodePath6.resolve(expandHomePath(homePath)) : "";
|
|
27629
27688
|
return `kimiCode:home:${recipe.binaryPath.trim()}\0${resolvedHomePath}`;
|
|
27630
27689
|
}
|
|
27631
27690
|
function resolveHomePath(recipe) {
|
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.2892",
|
|
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
|
-
"ycodium-
|
|
25
|
-
"ycodium-executor
|
|
26
|
-
"
|
|
24
|
+
"@ycodium-ai/plugin-api": "0.2.2892",
|
|
25
|
+
"ycodium-acp-executor": "0.2.2892",
|
|
26
|
+
"ycodium-executor-testing": "0.0.0"
|
|
27
27
|
},
|
|
28
28
|
"ycodium": {
|
|
29
29
|
"plugin": "./dist/index.js",
|