@ycodium-ai/agent-kimi 0.2.3710 → 0.2.3766
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 +63 -36
- package/locales/en.json +9 -0
- package/locales/zh-CN.json +9 -0
- package/package.json +6 -4
package/dist/index.js
CHANGED
|
@@ -6,6 +6,13 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
9
|
+
import * as NodeOS6 from "node:os";
|
|
10
|
+
import * as NodePath8 from "node:path";
|
|
11
|
+
import {
|
|
12
|
+
EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
|
|
13
|
+
executorHomeEffectiveValue,
|
|
14
|
+
readExecutorEffectiveRequest
|
|
15
|
+
} from "@ycodium-ai/plugin-api/executor";
|
|
9
16
|
|
|
10
17
|
// src/card.ts
|
|
11
18
|
var KIMI_DRIVER_KIND = "kimiCode";
|
|
@@ -16,6 +23,8 @@ var KIMI_CARD = {
|
|
|
16
23
|
commandName: "kimi",
|
|
17
24
|
launchArgs: "acp",
|
|
18
25
|
homeEnvVar: "KIMI_CODE_HOME",
|
|
26
|
+
// 设置表单里留空的格子此刻会用什么,见 index.ts 的同名命令。
|
|
27
|
+
effectiveCommand: "effectiveConfig",
|
|
19
28
|
environment: [],
|
|
20
29
|
// 官方安装器装进 ~/.kimi-code(安装器的 KIMI_INSTALL_DIR 默认值)。
|
|
21
30
|
install: {
|
|
@@ -310,8 +319,8 @@ var UnboundedEventStream = class {
|
|
|
310
319
|
iterators.subscribers.delete(subscriber);
|
|
311
320
|
return { value: void 0, done: true };
|
|
312
321
|
}
|
|
313
|
-
await new Promise((
|
|
314
|
-
subscriber.wake =
|
|
322
|
+
await new Promise((resolve4) => {
|
|
323
|
+
subscriber.wake = resolve4;
|
|
315
324
|
});
|
|
316
325
|
}
|
|
317
326
|
},
|
|
@@ -6506,7 +6515,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
6506
6515
|
var NONE = 0;
|
|
6507
6516
|
var ASSUMED = 1;
|
|
6508
6517
|
var PROVEN = 2;
|
|
6509
|
-
function isRecursive(inst, stack,
|
|
6518
|
+
function isRecursive(inst, stack, resolve4) {
|
|
6510
6519
|
const cached2 = recursive.get(inst);
|
|
6511
6520
|
if (cached2 !== void 0)
|
|
6512
6521
|
return cached2 ? PROVEN : NONE;
|
|
@@ -6516,7 +6525,7 @@ function isRecursive(inst, stack, resolve3) {
|
|
|
6516
6525
|
let result = NONE;
|
|
6517
6526
|
const check2 = (child) => {
|
|
6518
6527
|
if (result !== PROVEN && child?._zod) {
|
|
6519
|
-
const answer = isRecursive(child, stack,
|
|
6528
|
+
const answer = isRecursive(child, stack, resolve4);
|
|
6520
6529
|
if (answer > result)
|
|
6521
6530
|
result = answer;
|
|
6522
6531
|
}
|
|
@@ -6527,7 +6536,7 @@ function isRecursive(inst, stack, resolve3) {
|
|
|
6527
6536
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
6528
6537
|
if (spread && !desc.enumerable)
|
|
6529
6538
|
continue;
|
|
6530
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
6539
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve4) : NONE;
|
|
6531
6540
|
if (child > answer)
|
|
6532
6541
|
answer = child;
|
|
6533
6542
|
}
|
|
@@ -6591,7 +6600,7 @@ function isRecursive(inst, stack, resolve3) {
|
|
|
6591
6600
|
break;
|
|
6592
6601
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
6593
6602
|
case "lazy": {
|
|
6594
|
-
const inner = def._cachedInner ?? (
|
|
6603
|
+
const inner = def._cachedInner ?? (resolve4 ? inst._zod.innerType : void 0);
|
|
6595
6604
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
6596
6605
|
break;
|
|
6597
6606
|
}
|
|
@@ -23255,11 +23264,11 @@ var Connection = class {
|
|
|
23255
23264
|
const id = this.nextRequestId++;
|
|
23256
23265
|
let cancel = () => {
|
|
23257
23266
|
};
|
|
23258
|
-
const response = new Promise((
|
|
23267
|
+
const response = new Promise((resolve4, reject) => {
|
|
23259
23268
|
const pendingResponse = {
|
|
23260
23269
|
resolve: (value) => {
|
|
23261
23270
|
try {
|
|
23262
|
-
|
|
23271
|
+
resolve4(mapResponse ? mapResponse(value) : value);
|
|
23263
23272
|
} catch (error62) {
|
|
23264
23273
|
reject(error62);
|
|
23265
23274
|
}
|
|
@@ -23316,8 +23325,8 @@ var Connection = class {
|
|
|
23316
23325
|
this.stream = stream;
|
|
23317
23326
|
this.staticHandlers = handlers;
|
|
23318
23327
|
this.allowBatches = options?.allowBatches ?? true;
|
|
23319
|
-
this.closedPromise = new Promise((
|
|
23320
|
-
this.abortController.signal.addEventListener("abort", () =>
|
|
23328
|
+
this.closedPromise = new Promise((resolve4) => {
|
|
23329
|
+
this.abortController.signal.addEventListener("abort", () => resolve4());
|
|
23321
23330
|
});
|
|
23322
23331
|
void this.receive();
|
|
23323
23332
|
}
|
|
@@ -24211,8 +24220,8 @@ var AsyncQueue = class {
|
|
|
24211
24220
|
if (this.failed) {
|
|
24212
24221
|
return Promise.reject(this.failure);
|
|
24213
24222
|
}
|
|
24214
|
-
return new Promise((
|
|
24215
|
-
this.waiters.push({ resolve:
|
|
24223
|
+
return new Promise((resolve4, reject) => {
|
|
24224
|
+
this.waiters.push({ resolve: resolve4, reject });
|
|
24216
24225
|
});
|
|
24217
24226
|
}
|
|
24218
24227
|
};
|
|
@@ -25256,12 +25265,12 @@ function createAcpConnection(options) {
|
|
|
25256
25265
|
failIfClosed();
|
|
25257
25266
|
const id = nextRequestId;
|
|
25258
25267
|
nextRequestId += 1;
|
|
25259
|
-
const { promise: promise2, resolve:
|
|
25268
|
+
const { promise: promise2, resolve: resolve4, reject } = Promise.withResolvers();
|
|
25260
25269
|
pending.set(String(id), {
|
|
25261
25270
|
method,
|
|
25262
25271
|
...promptId === void 0 ? {} : { promptId },
|
|
25263
25272
|
...onArrival === void 0 ? {} : { onArrival },
|
|
25264
|
-
resolve:
|
|
25273
|
+
resolve: resolve4,
|
|
25265
25274
|
reject
|
|
25266
25275
|
});
|
|
25267
25276
|
const message = params === void 0 ? { jsonrpc: "2.0", id, method } : { jsonrpc: "2.0", id, method, params };
|
|
@@ -25290,8 +25299,8 @@ function createAcpConnection(options) {
|
|
|
25290
25299
|
if (inboundBatches === 0) {
|
|
25291
25300
|
return;
|
|
25292
25301
|
}
|
|
25293
|
-
await new Promise((
|
|
25294
|
-
idleWaiters.push(
|
|
25302
|
+
await new Promise((resolve4) => {
|
|
25303
|
+
idleWaiters.push(resolve4);
|
|
25295
25304
|
if (inboundBatches === 0) {
|
|
25296
25305
|
releaseIdleWaiters();
|
|
25297
25306
|
}
|
|
@@ -25376,8 +25385,8 @@ var Mutex = class {
|
|
|
25376
25385
|
this.locked = true;
|
|
25377
25386
|
return Promise.resolve();
|
|
25378
25387
|
}
|
|
25379
|
-
return new Promise((
|
|
25380
|
-
this.waiters.push(
|
|
25388
|
+
return new Promise((resolve4) => {
|
|
25389
|
+
this.waiters.push(resolve4);
|
|
25381
25390
|
});
|
|
25382
25391
|
}
|
|
25383
25392
|
tryAcquire() {
|
|
@@ -25577,9 +25586,9 @@ function createExecutorLifecycle({
|
|
|
25577
25586
|
let timer;
|
|
25578
25587
|
await Promise.race([
|
|
25579
25588
|
connection.closed.catch(() => void 0),
|
|
25580
|
-
new Promise((
|
|
25589
|
+
new Promise((resolve4) => {
|
|
25581
25590
|
timer = setTimeout(
|
|
25582
|
-
|
|
25591
|
+
resolve4,
|
|
25583
25592
|
options.resultDrainTimeoutMs ?? DEFAULT_RESULT_DRAIN_TIMEOUT_MS
|
|
25584
25593
|
);
|
|
25585
25594
|
})
|
|
@@ -26424,12 +26433,12 @@ function createPromptResults({
|
|
|
26424
26433
|
}) {
|
|
26425
26434
|
const prompts = /* @__PURE__ */ new Map();
|
|
26426
26435
|
const add = (identity, finish) => {
|
|
26427
|
-
const { promise: done, resolve:
|
|
26436
|
+
const { promise: done, resolve: resolve4 } = Promise.withResolvers();
|
|
26428
26437
|
const record2 = {
|
|
26429
26438
|
...identity,
|
|
26430
26439
|
finish,
|
|
26431
26440
|
done,
|
|
26432
|
-
resolve:
|
|
26441
|
+
resolve: resolve4,
|
|
26433
26442
|
rejected: false,
|
|
26434
26443
|
interrupted: false,
|
|
26435
26444
|
finished: false
|
|
@@ -26477,9 +26486,9 @@ function createPromptResults({
|
|
|
26477
26486
|
try {
|
|
26478
26487
|
const drained = await Promise.race([
|
|
26479
26488
|
Promise.all(claimed.map((record2) => record2.done)).then(() => true),
|
|
26480
|
-
new Promise((
|
|
26489
|
+
new Promise((resolve4) => {
|
|
26481
26490
|
timer = setTimeout(
|
|
26482
|
-
() =>
|
|
26491
|
+
() => resolve4(false),
|
|
26483
26492
|
options.resultDrainTimeoutMs ?? DEFAULT_RESULT_DRAIN_TIMEOUT_MS
|
|
26484
26493
|
);
|
|
26485
26494
|
})
|
|
@@ -26639,14 +26648,14 @@ function createExecutorRequests({
|
|
|
26639
26648
|
}
|
|
26640
26649
|
}
|
|
26641
26650
|
const requestId = randomId();
|
|
26642
|
-
const outcome = await new Promise((
|
|
26651
|
+
const outcome = await new Promise((resolve4) => {
|
|
26643
26652
|
const pending = {
|
|
26644
26653
|
requestId,
|
|
26645
26654
|
request: params,
|
|
26646
26655
|
permissionRequest,
|
|
26647
26656
|
turnId: shared.activeTurnId,
|
|
26648
26657
|
settled: false,
|
|
26649
|
-
resolve:
|
|
26658
|
+
resolve: resolve4
|
|
26650
26659
|
};
|
|
26651
26660
|
approvals.add(pending);
|
|
26652
26661
|
emit(
|
|
@@ -26864,14 +26873,14 @@ function createExecutorRuntime({
|
|
|
26864
26873
|
if (!promptMutex.isLocked) {
|
|
26865
26874
|
return true;
|
|
26866
26875
|
}
|
|
26867
|
-
return await new Promise((
|
|
26876
|
+
return await new Promise((resolve4) => {
|
|
26868
26877
|
const timer = setTimeout(() => {
|
|
26869
26878
|
shared.promptWaiters = shared.promptWaiters.filter((waiter) => waiter !== onSettle);
|
|
26870
|
-
|
|
26879
|
+
resolve4(false);
|
|
26871
26880
|
}, timeoutMs);
|
|
26872
26881
|
const onSettle = () => {
|
|
26873
26882
|
clearTimeout(timer);
|
|
26874
|
-
|
|
26883
|
+
resolve4(true);
|
|
26875
26884
|
};
|
|
26876
26885
|
shared.promptWaiters.push(onSettle);
|
|
26877
26886
|
});
|
|
@@ -28442,13 +28451,13 @@ function acpNativeSessionProcessMatcher(program, args) {
|
|
|
28442
28451
|
|
|
28443
28452
|
// ../../packages/ycodium-acp-executor/src/prompt-dispatch.ts
|
|
28444
28453
|
var dispatchAcpPrompt = (executor, input2) => {
|
|
28445
|
-
const { promise: dispatched, resolve:
|
|
28454
|
+
const { promise: dispatched, resolve: resolve4 } = Promise.withResolvers();
|
|
28446
28455
|
let written = false;
|
|
28447
28456
|
const finished = executor.prompt({
|
|
28448
28457
|
...input2,
|
|
28449
28458
|
onDispatched: (turnId) => {
|
|
28450
28459
|
written = true;
|
|
28451
|
-
|
|
28460
|
+
resolve4(turnId);
|
|
28452
28461
|
}
|
|
28453
28462
|
});
|
|
28454
28463
|
return Promise.race([
|
|
@@ -29494,8 +29503,8 @@ var kimiToolSubagents = {
|
|
|
29494
29503
|
// src/kimiInstance.ts
|
|
29495
29504
|
var RESUME_SCHEMA_VERSION = 1;
|
|
29496
29505
|
var CLIENT_INFO = { name: "ycodium-agent-kimi", version: "0.1.0" };
|
|
29497
|
-
var yieldTick = () => new Promise((
|
|
29498
|
-
setImmediate(
|
|
29506
|
+
var yieldTick = () => new Promise((resolve4) => {
|
|
29507
|
+
setImmediate(resolve4);
|
|
29499
29508
|
});
|
|
29500
29509
|
var EventBus = class {
|
|
29501
29510
|
#queued = [];
|
|
@@ -29522,8 +29531,8 @@ var EventBus = class {
|
|
|
29522
29531
|
const queued = this.#queued.shift();
|
|
29523
29532
|
if (queued !== void 0) return Promise.resolve({ done: false, value: queued });
|
|
29524
29533
|
if (this.#closed) return Promise.resolve({ done: true, value: void 0 });
|
|
29525
|
-
return new Promise((
|
|
29526
|
-
this.#waiters.push(
|
|
29534
|
+
return new Promise((resolve4) => {
|
|
29535
|
+
this.#waiters.push(resolve4);
|
|
29527
29536
|
});
|
|
29528
29537
|
}
|
|
29529
29538
|
};
|
|
@@ -29912,6 +29921,7 @@ var createKimiInstance = (config2, host) => {
|
|
|
29912
29921
|
var executors = [
|
|
29913
29922
|
{
|
|
29914
29923
|
card: KIMI_CARD,
|
|
29924
|
+
lifecycle: [{ kind: "detect", reversible: true }],
|
|
29915
29925
|
createInstance: async (config2, host) => {
|
|
29916
29926
|
host.log.info("createInstance");
|
|
29917
29927
|
return createKimiInstance(config2, host);
|
|
@@ -29920,9 +29930,26 @@ var executors = [
|
|
|
29920
29930
|
];
|
|
29921
29931
|
var index_default = definePlugin({
|
|
29922
29932
|
id: "agent-kimi",
|
|
29923
|
-
apiVersion:
|
|
29933
|
+
apiVersion: 56,
|
|
29924
29934
|
executors,
|
|
29925
29935
|
activate(ctx) {
|
|
29936
|
+
ctx.command({
|
|
29937
|
+
name: "effectiveConfig",
|
|
29938
|
+
description: "Settings form: the account directory an empty path resolves to on this machine.",
|
|
29939
|
+
scope: "read",
|
|
29940
|
+
payloadSchema: EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
|
|
29941
|
+
handle: async (payload) => {
|
|
29942
|
+
const request = readExecutorEffectiveRequest(payload);
|
|
29943
|
+
return {
|
|
29944
|
+
homePath: executorHomeEffectiveValue(
|
|
29945
|
+
"KIMI_CODE_HOME",
|
|
29946
|
+
request,
|
|
29947
|
+
process.env,
|
|
29948
|
+
(value) => value === void 0 ? NodePath8.join(NodeOS6.homedir(), ".kimi-code") : NodePath8.resolve(expandHomePath(value))
|
|
29949
|
+
)
|
|
29950
|
+
};
|
|
29951
|
+
}
|
|
29952
|
+
});
|
|
29926
29953
|
ctx.log.info("Kimi Code executor ready");
|
|
29927
29954
|
}
|
|
29928
29955
|
});
|
package/locales/en.json
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"presentation": {
|
|
3
|
+
"name": "Kimi Code",
|
|
4
|
+
"description": "Use Kimi Code in Ycodium, signed in with your Kimi account."
|
|
5
|
+
},
|
|
2
6
|
"form": {
|
|
3
7
|
"binaryPath": {
|
|
4
8
|
"title": "Program path",
|
|
@@ -9,6 +13,11 @@
|
|
|
9
13
|
"title": "Account directory",
|
|
10
14
|
"description": "Sessions and the `kimi login` credentials live here, so providers sharing this directory can pick up each other's threads and providers with different directories cannot. Leave empty to use the CLI's default.",
|
|
11
15
|
"placeholder": "e.g. ~/.kimi-code-work"
|
|
16
|
+
},
|
|
17
|
+
"effective": {
|
|
18
|
+
"provider": "{{name}} in this provider",
|
|
19
|
+
"machine": "{{name}} on this machine",
|
|
20
|
+
"default": "default"
|
|
12
21
|
}
|
|
13
22
|
},
|
|
14
23
|
"usage": {
|
package/locales/zh-CN.json
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"presentation": {
|
|
3
|
+
"name": "Kimi Code",
|
|
4
|
+
"description": "在 Ycodium 里使用 Kimi Code,用你的 Kimi 账号登录。"
|
|
5
|
+
},
|
|
2
6
|
"form": {
|
|
3
7
|
"binaryPath": {
|
|
4
8
|
"title": "程序路径",
|
|
@@ -9,6 +13,11 @@
|
|
|
9
13
|
"title": "账号目录",
|
|
10
14
|
"description": "会话和 `kimi login` 的凭据都保存在这里,因此共用同一目录的 provider 可以接手彼此的会话,目录不同的则不能。留空则使用该命令行工具的默认目录。",
|
|
11
15
|
"placeholder": "例如 ~/.kimi-code-work"
|
|
16
|
+
},
|
|
17
|
+
"effective": {
|
|
18
|
+
"provider": "本 provider 的 {{name}}",
|
|
19
|
+
"machine": "本机的 {{name}}",
|
|
20
|
+
"default": "默认"
|
|
12
21
|
}
|
|
13
22
|
},
|
|
14
23
|
"usage": {
|
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.3766",
|
|
4
4
|
"description": "Kimi Code executor: runs `kimi acp` over Agent Client Protocol stdio.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -21,14 +21,16 @@
|
|
|
21
21
|
"@types/node": "24.12.4",
|
|
22
22
|
"esbuild": "0.28.1",
|
|
23
23
|
"vite-plus": "0.2.2",
|
|
24
|
-
"
|
|
24
|
+
"ycodium-acp-executor": "0.2.3766",
|
|
25
25
|
"ycodium-executor-testing": "0.0.0",
|
|
26
|
-
"ycodium-
|
|
26
|
+
"@ycodium-ai/plugin-api": "0.2.3766"
|
|
27
27
|
},
|
|
28
28
|
"ycodium": {
|
|
29
29
|
"plugin": "./dist/index.js",
|
|
30
30
|
"displayName": "Kimi Code",
|
|
31
|
-
"
|
|
31
|
+
"displayNameKey": "presentation.name",
|
|
32
|
+
"description": "Use Kimi Code in Ycodium, signed in with your Kimi account.",
|
|
33
|
+
"descriptionKey": "presentation.description",
|
|
32
34
|
"icon": "./assets/icon.svg",
|
|
33
35
|
"permissions": [
|
|
34
36
|
{
|