@ycodium-ai/agent-kimi 0.2.3681 → 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 +114 -47
- package/locales/en.json +9 -0
- package/locales/zh-CN.json +9 -0
- package/package.json +7 -5
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
|
}
|
|
@@ -25316,23 +25325,31 @@ function createAcpConnection(options) {
|
|
|
25316
25325
|
function normalizeModelId(value) {
|
|
25317
25326
|
return value?.trim() || void 0;
|
|
25318
25327
|
}
|
|
25319
|
-
function adoptReportedConfigOptions(state, configOptions) {
|
|
25328
|
+
function adoptReportedConfigOptions(state, configOptions, fromAgent = true) {
|
|
25320
25329
|
const option = state.modelConfigId === void 0 ? void 0 : findConfigOptionEntry(configOptions, state.modelConfigId);
|
|
25321
25330
|
const value = option?.["currentValue"];
|
|
25322
25331
|
const reported = typeof value === "string" ? normalizeModelId(value) : void 0;
|
|
25323
25332
|
if (reported === void 0) return { ...state, configOptions };
|
|
25324
25333
|
const { modelUnconfirmed: _confirmed, ...known } = state;
|
|
25325
|
-
|
|
25334
|
+
const stillReported = fromAgent || state.currentModelReported === true && reported === state.currentModelId;
|
|
25335
|
+
const { currentModelReported: _stale, ...unreported } = known;
|
|
25336
|
+
return {
|
|
25337
|
+
...stillReported ? known : unreported,
|
|
25338
|
+
configOptions,
|
|
25339
|
+
currentModelId: reported,
|
|
25340
|
+
...stillReported ? { currentModelReported: true } : {}
|
|
25341
|
+
};
|
|
25326
25342
|
}
|
|
25327
25343
|
function forgetConfigOptionValue(state, configId) {
|
|
25328
25344
|
const forgetsModel = configId === void 0 || configId === state.modelConfigId;
|
|
25345
|
+
const { currentModelReported: _forgottenReport, ...withoutReport } = state;
|
|
25329
25346
|
const configOptions = configId !== void 0 && Array.isArray(state.configOptions) ? state.configOptions.map((option) => {
|
|
25330
25347
|
if (!isRecord2(option) || option["id"] !== configId) return option;
|
|
25331
25348
|
const { currentValue: _forgotten, ...rest } = option;
|
|
25332
25349
|
return rest;
|
|
25333
25350
|
}) : state.configOptions;
|
|
25334
25351
|
return {
|
|
25335
|
-
...state,
|
|
25352
|
+
...forgetsModel ? withoutReport : state,
|
|
25336
25353
|
configOptions,
|
|
25337
25354
|
...forgetsModel ? { currentModelId: void 0, modelUnconfirmed: true } : {}
|
|
25338
25355
|
};
|
|
@@ -25349,6 +25366,7 @@ function modelSelectionStateFromSetup(setup) {
|
|
|
25349
25366
|
sessionModelsAdvertised: sessionModels !== void 0,
|
|
25350
25367
|
modelConfigId,
|
|
25351
25368
|
currentModelId,
|
|
25369
|
+
...currentModelId === void 0 ? {} : { currentModelReported: true },
|
|
25352
25370
|
advertisedModelValues: strategy === "config-option" ? modelConfigOption === void 0 ? [] : collectSessionConfigOptionValues(modelConfigOption) : collectSessionModelIds(sessionModels),
|
|
25353
25371
|
configOptions: setup.configOptions,
|
|
25354
25372
|
catalogSetup: setup
|
|
@@ -25367,8 +25385,8 @@ var Mutex = class {
|
|
|
25367
25385
|
this.locked = true;
|
|
25368
25386
|
return Promise.resolve();
|
|
25369
25387
|
}
|
|
25370
|
-
return new Promise((
|
|
25371
|
-
this.waiters.push(
|
|
25388
|
+
return new Promise((resolve4) => {
|
|
25389
|
+
this.waiters.push(resolve4);
|
|
25372
25390
|
});
|
|
25373
25391
|
}
|
|
25374
25392
|
tryAcquire() {
|
|
@@ -25568,9 +25586,9 @@ function createExecutorLifecycle({
|
|
|
25568
25586
|
let timer;
|
|
25569
25587
|
await Promise.race([
|
|
25570
25588
|
connection.closed.catch(() => void 0),
|
|
25571
|
-
new Promise((
|
|
25589
|
+
new Promise((resolve4) => {
|
|
25572
25590
|
timer = setTimeout(
|
|
25573
|
-
|
|
25591
|
+
resolve4,
|
|
25574
25592
|
options.resultDrainTimeoutMs ?? DEFAULT_RESULT_DRAIN_TIMEOUT_MS
|
|
25575
25593
|
);
|
|
25576
25594
|
})
|
|
@@ -26136,14 +26154,28 @@ function createExecutorPrompt({
|
|
|
26136
26154
|
}
|
|
26137
26155
|
};
|
|
26138
26156
|
const alignTurnOptions = async (input2, sessionId, generation, isStale, signal) => {
|
|
26157
|
+
const before = shared.modelSelectionState;
|
|
26139
26158
|
const applied = await applyRequestedModel({
|
|
26140
|
-
state:
|
|
26159
|
+
state: before,
|
|
26141
26160
|
acpSessionId: sessionId,
|
|
26142
26161
|
requestedModelId: input2.requestedModelId,
|
|
26143
26162
|
expectedGeneration: generation,
|
|
26144
26163
|
signal
|
|
26145
26164
|
});
|
|
26146
26165
|
shared.modelSelectionState = applied;
|
|
26166
|
+
if (applied.currentModelId !== void 0 && (applied.currentModelId !== before.currentModelId || applied.currentModelReported !== before.currentModelReported)) {
|
|
26167
|
+
emit({
|
|
26168
|
+
type: "thread.metadata.updated",
|
|
26169
|
+
...stamp(),
|
|
26170
|
+
provider: options.provider,
|
|
26171
|
+
threadId: options.threadId,
|
|
26172
|
+
...shared.activeTurnId === void 0 ? {} : { turnId: shared.activeTurnId },
|
|
26173
|
+
payload: {
|
|
26174
|
+
model: applied.currentModelId,
|
|
26175
|
+
modelSource: applied.currentModelReported === true ? "reported" : "echo"
|
|
26176
|
+
}
|
|
26177
|
+
});
|
|
26178
|
+
}
|
|
26147
26179
|
if (isStale()) return;
|
|
26148
26180
|
const switched = applied.configOptions;
|
|
26149
26181
|
let aligned;
|
|
@@ -26168,7 +26200,8 @@ function createExecutorPrompt({
|
|
|
26168
26200
|
if (aligned.configOptions !== switched) {
|
|
26169
26201
|
shared.modelSelectionState = adoptReportedConfigOptions(
|
|
26170
26202
|
shared.modelSelectionState,
|
|
26171
|
-
aligned.configOptions
|
|
26203
|
+
aligned.configOptions,
|
|
26204
|
+
false
|
|
26172
26205
|
);
|
|
26173
26206
|
}
|
|
26174
26207
|
if (aligned.unsupportedEffort !== void 0) {
|
|
@@ -26400,12 +26433,12 @@ function createPromptResults({
|
|
|
26400
26433
|
}) {
|
|
26401
26434
|
const prompts = /* @__PURE__ */ new Map();
|
|
26402
26435
|
const add = (identity, finish) => {
|
|
26403
|
-
const { promise: done, resolve:
|
|
26436
|
+
const { promise: done, resolve: resolve4 } = Promise.withResolvers();
|
|
26404
26437
|
const record2 = {
|
|
26405
26438
|
...identity,
|
|
26406
26439
|
finish,
|
|
26407
26440
|
done,
|
|
26408
|
-
resolve:
|
|
26441
|
+
resolve: resolve4,
|
|
26409
26442
|
rejected: false,
|
|
26410
26443
|
interrupted: false,
|
|
26411
26444
|
finished: false
|
|
@@ -26453,9 +26486,9 @@ function createPromptResults({
|
|
|
26453
26486
|
try {
|
|
26454
26487
|
const drained = await Promise.race([
|
|
26455
26488
|
Promise.all(claimed.map((record2) => record2.done)).then(() => true),
|
|
26456
|
-
new Promise((
|
|
26489
|
+
new Promise((resolve4) => {
|
|
26457
26490
|
timer = setTimeout(
|
|
26458
|
-
() =>
|
|
26491
|
+
() => resolve4(false),
|
|
26459
26492
|
options.resultDrainTimeoutMs ?? DEFAULT_RESULT_DRAIN_TIMEOUT_MS
|
|
26460
26493
|
);
|
|
26461
26494
|
})
|
|
@@ -26615,14 +26648,14 @@ function createExecutorRequests({
|
|
|
26615
26648
|
}
|
|
26616
26649
|
}
|
|
26617
26650
|
const requestId = randomId();
|
|
26618
|
-
const outcome = await new Promise((
|
|
26651
|
+
const outcome = await new Promise((resolve4) => {
|
|
26619
26652
|
const pending = {
|
|
26620
26653
|
requestId,
|
|
26621
26654
|
request: params,
|
|
26622
26655
|
permissionRequest,
|
|
26623
26656
|
turnId: shared.activeTurnId,
|
|
26624
26657
|
settled: false,
|
|
26625
|
-
resolve:
|
|
26658
|
+
resolve: resolve4
|
|
26626
26659
|
};
|
|
26627
26660
|
approvals.add(pending);
|
|
26628
26661
|
emit(
|
|
@@ -26840,14 +26873,14 @@ function createExecutorRuntime({
|
|
|
26840
26873
|
if (!promptMutex.isLocked) {
|
|
26841
26874
|
return true;
|
|
26842
26875
|
}
|
|
26843
|
-
return await new Promise((
|
|
26876
|
+
return await new Promise((resolve4) => {
|
|
26844
26877
|
const timer = setTimeout(() => {
|
|
26845
26878
|
shared.promptWaiters = shared.promptWaiters.filter((waiter) => waiter !== onSettle);
|
|
26846
|
-
|
|
26879
|
+
resolve4(false);
|
|
26847
26880
|
}, timeoutMs);
|
|
26848
26881
|
const onSettle = () => {
|
|
26849
26882
|
clearTimeout(timer);
|
|
26850
|
-
|
|
26883
|
+
resolve4(true);
|
|
26851
26884
|
};
|
|
26852
26885
|
shared.promptWaiters.push(onSettle);
|
|
26853
26886
|
});
|
|
@@ -27107,18 +27140,20 @@ function createExecutorSession({
|
|
|
27107
27140
|
const base = ours !== void 0 && ours.seq > issuedAt ? ours.configOptions : configOptions;
|
|
27108
27141
|
return { configOptions: withConfigOptionValue(base, configId, value), reported: false };
|
|
27109
27142
|
};
|
|
27110
|
-
const writeConfigOption = async (...args) => (await writeConfigOptionReported(...args)).configOptions;
|
|
27111
27143
|
const switchModel = async (input2) => {
|
|
27112
27144
|
let configOptions = input2.state.configOptions;
|
|
27145
|
+
let fromAgent = true;
|
|
27113
27146
|
const write = { option: "model", signal: input2.signal };
|
|
27114
27147
|
if (input2.state.strategy === "config-option" && input2.state.modelConfigId !== void 0) {
|
|
27115
|
-
|
|
27148
|
+
const written = await writeConfigOptionReported(
|
|
27116
27149
|
input2.sessionId,
|
|
27117
27150
|
configOptions,
|
|
27118
27151
|
input2.state.modelConfigId,
|
|
27119
27152
|
input2.value,
|
|
27120
27153
|
write
|
|
27121
27154
|
);
|
|
27155
|
+
configOptions = written.configOptions;
|
|
27156
|
+
fromAgent = written.reported;
|
|
27122
27157
|
} else {
|
|
27123
27158
|
const before = shared.configOptionUpdates.get(input2.sessionId);
|
|
27124
27159
|
const pending = connection.begin("session/set_model", {
|
|
@@ -27136,7 +27171,12 @@ function createExecutorSession({
|
|
|
27136
27171
|
throw new AcpExecutorDisposedError();
|
|
27137
27172
|
}
|
|
27138
27173
|
const { modelUnconfirmed: _confirmed, ...known } = input2.state;
|
|
27139
|
-
|
|
27174
|
+
const { currentModelReported: _echoed, ...requested } = known;
|
|
27175
|
+
return adoptReportedConfigOptions(
|
|
27176
|
+
{ ...requested, currentModelId: input2.value },
|
|
27177
|
+
configOptions,
|
|
27178
|
+
fromAgent
|
|
27179
|
+
);
|
|
27140
27180
|
};
|
|
27141
27181
|
const applyRequestedModel = async (input2) => {
|
|
27142
27182
|
const requestedModelId = normalizeModelId(input2.requestedModelId) ?? "";
|
|
@@ -27280,7 +27320,8 @@ function createExecutorSession({
|
|
|
27280
27320
|
});
|
|
27281
27321
|
nextModelSelectionState = adoptReportedConfigOptions(
|
|
27282
27322
|
nextModelSelectionState,
|
|
27283
|
-
aligned.configOptions
|
|
27323
|
+
aligned.configOptions,
|
|
27324
|
+
false
|
|
27284
27325
|
);
|
|
27285
27326
|
if (aligned.unsupportedEffort !== void 0) {
|
|
27286
27327
|
options.log?.info("requested effort is not offered by this model; using its default", {
|
|
@@ -27313,7 +27354,8 @@ function createExecutorSession({
|
|
|
27313
27354
|
initializeResult: initialized,
|
|
27314
27355
|
sessionSetupResult: setup,
|
|
27315
27356
|
modelConfigId: extractModelConfigId(setup),
|
|
27316
|
-
modelId: nextModelSelectionState.currentModelId
|
|
27357
|
+
modelId: nextModelSelectionState.currentModelId,
|
|
27358
|
+
modelReported: nextModelSelectionState.currentModelReported === true
|
|
27317
27359
|
};
|
|
27318
27360
|
shared.startResult = result;
|
|
27319
27361
|
shared.status = "ready";
|
|
@@ -28271,6 +28313,9 @@ function createAcpExecutor(options) {
|
|
|
28271
28313
|
get modelId() {
|
|
28272
28314
|
return shared.modelSelectionState.currentModelId;
|
|
28273
28315
|
},
|
|
28316
|
+
get modelReported() {
|
|
28317
|
+
return shared.modelSelectionState.currentModelReported === true;
|
|
28318
|
+
},
|
|
28274
28319
|
get status() {
|
|
28275
28320
|
return shared.status;
|
|
28276
28321
|
},
|
|
@@ -28406,13 +28451,13 @@ function acpNativeSessionProcessMatcher(program, args) {
|
|
|
28406
28451
|
|
|
28407
28452
|
// ../../packages/ycodium-acp-executor/src/prompt-dispatch.ts
|
|
28408
28453
|
var dispatchAcpPrompt = (executor, input2) => {
|
|
28409
|
-
const { promise: dispatched, resolve:
|
|
28454
|
+
const { promise: dispatched, resolve: resolve4 } = Promise.withResolvers();
|
|
28410
28455
|
let written = false;
|
|
28411
28456
|
const finished = executor.prompt({
|
|
28412
28457
|
...input2,
|
|
28413
28458
|
onDispatched: (turnId) => {
|
|
28414
28459
|
written = true;
|
|
28415
|
-
|
|
28460
|
+
resolve4(turnId);
|
|
28416
28461
|
}
|
|
28417
28462
|
});
|
|
28418
28463
|
return Promise.race([
|
|
@@ -29458,8 +29503,8 @@ var kimiToolSubagents = {
|
|
|
29458
29503
|
// src/kimiInstance.ts
|
|
29459
29504
|
var RESUME_SCHEMA_VERSION = 1;
|
|
29460
29505
|
var CLIENT_INFO = { name: "ycodium-agent-kimi", version: "0.1.0" };
|
|
29461
|
-
var yieldTick = () => new Promise((
|
|
29462
|
-
setImmediate(
|
|
29506
|
+
var yieldTick = () => new Promise((resolve4) => {
|
|
29507
|
+
setImmediate(resolve4);
|
|
29463
29508
|
});
|
|
29464
29509
|
var EventBus = class {
|
|
29465
29510
|
#queued = [];
|
|
@@ -29486,8 +29531,8 @@ var EventBus = class {
|
|
|
29486
29531
|
const queued = this.#queued.shift();
|
|
29487
29532
|
if (queued !== void 0) return Promise.resolve({ done: false, value: queued });
|
|
29488
29533
|
if (this.#closed) return Promise.resolve({ done: true, value: void 0 });
|
|
29489
|
-
return new Promise((
|
|
29490
|
-
this.#waiters.push(
|
|
29534
|
+
return new Promise((resolve4) => {
|
|
29535
|
+
this.#waiters.push(resolve4);
|
|
29491
29536
|
});
|
|
29492
29537
|
}
|
|
29493
29538
|
};
|
|
@@ -29735,7 +29780,11 @@ var createKimiInstance = (config2, host) => {
|
|
|
29735
29780
|
createdAt,
|
|
29736
29781
|
updatedAt: createdAt,
|
|
29737
29782
|
resumeCursor,
|
|
29738
|
-
...started.modelId === void 0 ? {} : {
|
|
29783
|
+
...started.modelId === void 0 ? {} : {
|
|
29784
|
+
model: started.modelId,
|
|
29785
|
+
// agent 在握手里报的才是读回的;切型号走 session/set_model 时回包不带型号,那只是请求值。
|
|
29786
|
+
modelSource: started.modelReported ? "reported" : "echo"
|
|
29787
|
+
},
|
|
29739
29788
|
...input2.bindingGeneration === void 0 ? {} : { bindingGeneration: input2.bindingGeneration }
|
|
29740
29789
|
};
|
|
29741
29790
|
registerSession(input2.threadId, {
|
|
@@ -29872,6 +29921,7 @@ var createKimiInstance = (config2, host) => {
|
|
|
29872
29921
|
var executors = [
|
|
29873
29922
|
{
|
|
29874
29923
|
card: KIMI_CARD,
|
|
29924
|
+
lifecycle: [{ kind: "detect", reversible: true }],
|
|
29875
29925
|
createInstance: async (config2, host) => {
|
|
29876
29926
|
host.log.info("createInstance");
|
|
29877
29927
|
return createKimiInstance(config2, host);
|
|
@@ -29880,9 +29930,26 @@ var executors = [
|
|
|
29880
29930
|
];
|
|
29881
29931
|
var index_default = definePlugin({
|
|
29882
29932
|
id: "agent-kimi",
|
|
29883
|
-
apiVersion:
|
|
29933
|
+
apiVersion: 56,
|
|
29884
29934
|
executors,
|
|
29885
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
|
+
});
|
|
29886
29953
|
ctx.log.info("Kimi Code executor ready");
|
|
29887
29954
|
}
|
|
29888
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
|
-
"
|
|
25
|
-
"ycodium-
|
|
26
|
-
"ycodium-
|
|
24
|
+
"ycodium-acp-executor": "0.2.3766",
|
|
25
|
+
"ycodium-executor-testing": "0.0.0",
|
|
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
|
{
|