@ycodium-ai/agent-kimi 0.2.3024 → 0.2.3034
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 +91 -39
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -25310,6 +25310,62 @@ function findAcpEffortConfig(configOptions) {
|
|
|
25310
25310
|
};
|
|
25311
25311
|
}
|
|
25312
25312
|
|
|
25313
|
+
// ../../packages/ycodium-acp-executor/src/apply-effort.ts
|
|
25314
|
+
var applyRequestedEffort = async (input2) => {
|
|
25315
|
+
const requested = input2.requestedEffort?.trim();
|
|
25316
|
+
if (!requested) return;
|
|
25317
|
+
const effort = findAcpEffortConfig(input2.configOptions);
|
|
25318
|
+
if (effort === void 0) return;
|
|
25319
|
+
const matched = effort.choices.find((choice) => choice.value === requested);
|
|
25320
|
+
if (matched === void 0) {
|
|
25321
|
+
input2.log?.info("requested effort is not in the agent catalog; keeping its own", {
|
|
25322
|
+
requestedEffort: requested,
|
|
25323
|
+
advertised: effort.choices.map((choice) => choice.value)
|
|
25324
|
+
});
|
|
25325
|
+
return;
|
|
25326
|
+
}
|
|
25327
|
+
if (matched.isDefault === true) return;
|
|
25328
|
+
if (!input2.isLive(input2.expectedGeneration)) return;
|
|
25329
|
+
try {
|
|
25330
|
+
await input2.connection.request("session/set_config_option", {
|
|
25331
|
+
sessionId: input2.acpSessionId,
|
|
25332
|
+
configId: effort.configId,
|
|
25333
|
+
value: requested
|
|
25334
|
+
});
|
|
25335
|
+
} catch (error62) {
|
|
25336
|
+
input2.log?.info("setting the effort level failed; the session keeps its own", {
|
|
25337
|
+
requestedEffort: requested,
|
|
25338
|
+
configId: effort.configId,
|
|
25339
|
+
error: error62 instanceof Error ? error62.message : String(error62)
|
|
25340
|
+
});
|
|
25341
|
+
}
|
|
25342
|
+
};
|
|
25343
|
+
|
|
25344
|
+
// ../../packages/ycodium-acp-executor/src/failureCategory.ts
|
|
25345
|
+
var ACP_FAILURE_CATEGORIES = [
|
|
25346
|
+
"quota",
|
|
25347
|
+
"rate-limit",
|
|
25348
|
+
"context-limit",
|
|
25349
|
+
"auth",
|
|
25350
|
+
"model-unavailable",
|
|
25351
|
+
"transport",
|
|
25352
|
+
"unknown"
|
|
25353
|
+
];
|
|
25354
|
+
var isAcpFailureCategory = (value) => ACP_FAILURE_CATEGORIES.some((category) => category === value);
|
|
25355
|
+
var readAcpFailureCategory = (error62) => {
|
|
25356
|
+
if (typeof error62 !== "object" || error62 === null) return void 0;
|
|
25357
|
+
const value = error62.failureCategory;
|
|
25358
|
+
return isAcpFailureCategory(value) ? value : void 0;
|
|
25359
|
+
};
|
|
25360
|
+
var withFailureCategory = (error62, category) => category === void 0 ? error62 : Object.assign(error62, { failureCategory: category });
|
|
25361
|
+
var failureCategoryField = (category) => category === void 0 ? {} : { failureCategory: category };
|
|
25362
|
+
var acpTransportIfEstablished = (sessionEstablished, disposed) => sessionEstablished && !disposed ? "transport" : void 0;
|
|
25363
|
+
var acpPromptFailureCategory = (error62, input2) => {
|
|
25364
|
+
const signaled = readAcpFailureCategory(error62);
|
|
25365
|
+
if (signaled !== void 0) return signaled;
|
|
25366
|
+
return error62 instanceof AcpConnectionClosedError ? acpTransportIfEstablished(input2.sessionEstablished, input2.disposed) : void 0;
|
|
25367
|
+
};
|
|
25368
|
+
|
|
25313
25369
|
// ../../packages/ycodium-acp-executor/src/runtime-mode.ts
|
|
25314
25370
|
function isRecord5(value) {
|
|
25315
25371
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -25377,7 +25433,7 @@ var ACP_CONFIG_CATEGORY_HANDLING = {
|
|
|
25377
25433
|
},
|
|
25378
25434
|
thought_level: {
|
|
25379
25435
|
consumed: true,
|
|
25380
|
-
via: "config-options.ts:findAcpEffortConfig \u2192
|
|
25436
|
+
via: "config-options.ts:findAcpEffortConfig \u2192 apply-effort.ts:applyRequestedEffort"
|
|
25381
25437
|
},
|
|
25382
25438
|
model_option: {
|
|
25383
25439
|
consumed: true,
|
|
@@ -25865,11 +25921,16 @@ function createAcpExecutor(options) {
|
|
|
25865
25921
|
payload: { answers }
|
|
25866
25922
|
});
|
|
25867
25923
|
};
|
|
25868
|
-
const abortPendingSettlement = (reason) => {
|
|
25924
|
+
const abortPendingSettlement = (reason, failureCategory) => {
|
|
25869
25925
|
const waiting = pendingSettlement;
|
|
25870
25926
|
if (waiting === void 0) return;
|
|
25871
25927
|
pendingSettlement = void 0;
|
|
25872
|
-
waiting.settle({
|
|
25928
|
+
waiting.settle({
|
|
25929
|
+
error: withFailureCategory(
|
|
25930
|
+
new AcpExecutorRequestError("session/prompt", reason),
|
|
25931
|
+
failureCategory
|
|
25932
|
+
)
|
|
25933
|
+
});
|
|
25873
25934
|
};
|
|
25874
25935
|
const settleAllUserInputs = () => {
|
|
25875
25936
|
for (const pending of pendingUserInputs.values()) {
|
|
@@ -25893,9 +25954,12 @@ function createAcpExecutor(options) {
|
|
|
25893
25954
|
rememberSettledPromptKey(waiting.promptKey);
|
|
25894
25955
|
if (signal.outcome === "error") {
|
|
25895
25956
|
waiting.settle({
|
|
25896
|
-
error:
|
|
25897
|
-
|
|
25898
|
-
|
|
25957
|
+
error: withFailureCategory(
|
|
25958
|
+
new AcpExecutorRequestError(
|
|
25959
|
+
"session/prompt",
|
|
25960
|
+
signal.detail ?? "prompt failed without an error detail"
|
|
25961
|
+
),
|
|
25962
|
+
signal.failureCategory
|
|
25899
25963
|
)
|
|
25900
25964
|
});
|
|
25901
25965
|
} else {
|
|
@@ -26050,7 +26114,10 @@ function createAcpExecutor(options) {
|
|
|
26050
26114
|
}
|
|
26051
26115
|
settleAllApprovals("cancel");
|
|
26052
26116
|
settleAllUserInputs();
|
|
26053
|
-
abortPendingSettlement(
|
|
26117
|
+
abortPendingSettlement(
|
|
26118
|
+
"connection closed",
|
|
26119
|
+
acpTransportIfEstablished(startResult !== void 0, disposed)
|
|
26120
|
+
);
|
|
26054
26121
|
promptWaiters.splice(0).forEach((wake) => wake());
|
|
26055
26122
|
},
|
|
26056
26123
|
() => {
|
|
@@ -26105,35 +26172,6 @@ function createAcpExecutor(options) {
|
|
|
26105
26172
|
}
|
|
26106
26173
|
return { ...input2.state, currentModelId: value, configOptions };
|
|
26107
26174
|
};
|
|
26108
|
-
const applyRequestedEffort = async (input2) => {
|
|
26109
|
-
const requested = input2.requestedEffort?.trim();
|
|
26110
|
-
if (!requested) return;
|
|
26111
|
-
const effort = findAcpEffortConfig(input2.configOptions);
|
|
26112
|
-
if (effort === void 0) return;
|
|
26113
|
-
const matched = effort.choices.find((choice) => choice.value === requested);
|
|
26114
|
-
if (matched === void 0) {
|
|
26115
|
-
options.log?.info("requested effort is not in the agent catalog; keeping its own", {
|
|
26116
|
-
requestedEffort: requested,
|
|
26117
|
-
advertised: effort.choices.map((choice) => choice.value)
|
|
26118
|
-
});
|
|
26119
|
-
return;
|
|
26120
|
-
}
|
|
26121
|
-
if (matched.isDefault === true) return;
|
|
26122
|
-
if (!isLive(input2.expectedGeneration)) return;
|
|
26123
|
-
try {
|
|
26124
|
-
await connection.request("session/set_config_option", {
|
|
26125
|
-
sessionId: input2.acpSessionId,
|
|
26126
|
-
configId: effort.configId,
|
|
26127
|
-
value: requested
|
|
26128
|
-
});
|
|
26129
|
-
} catch (error62) {
|
|
26130
|
-
options.log?.info("setting the effort level failed; the session keeps its own", {
|
|
26131
|
-
requestedEffort: requested,
|
|
26132
|
-
configId: effort.configId,
|
|
26133
|
-
error: error62 instanceof Error ? error62.message : String(error62)
|
|
26134
|
-
});
|
|
26135
|
-
}
|
|
26136
|
-
};
|
|
26137
26175
|
const startOnce = async (expectedGeneration) => {
|
|
26138
26176
|
const initializePayload = acpInitializePayload(options.clientInfo, options.clientCapabilities);
|
|
26139
26177
|
const initialized = await connection.request(
|
|
@@ -26208,6 +26246,9 @@ function createAcpExecutor(options) {
|
|
|
26208
26246
|
expectedGeneration
|
|
26209
26247
|
});
|
|
26210
26248
|
await applyRequestedEffort({
|
|
26249
|
+
connection,
|
|
26250
|
+
log: options.log,
|
|
26251
|
+
isLive,
|
|
26211
26252
|
configOptions: nextModelSelectionState.configOptions,
|
|
26212
26253
|
acpSessionId: nextSessionId,
|
|
26213
26254
|
requestedEffort: options.requestedEffort,
|
|
@@ -26330,7 +26371,8 @@ function createAcpExecutor(options) {
|
|
|
26330
26371
|
payload: {
|
|
26331
26372
|
state: input2.state,
|
|
26332
26373
|
stopReason: input2.stopReason,
|
|
26333
|
-
...input2.errorMessage === void 0 ? {} : { errorMessage: input2.errorMessage }
|
|
26374
|
+
...input2.errorMessage === void 0 ? {} : { errorMessage: input2.errorMessage },
|
|
26375
|
+
...input2.state === "failed" ? failureCategoryField(input2.failureCategory) : {}
|
|
26334
26376
|
}
|
|
26335
26377
|
});
|
|
26336
26378
|
interruptedTurnIds.delete(input2.turnId);
|
|
@@ -26427,15 +26469,25 @@ function createAcpExecutor(options) {
|
|
|
26427
26469
|
if (disposed) {
|
|
26428
26470
|
throw new AcpExecutorDisposedError();
|
|
26429
26471
|
}
|
|
26472
|
+
const failureCategory = acpPromptFailureCategory(error62, {
|
|
26473
|
+
sessionEstablished: startResult !== void 0,
|
|
26474
|
+
disposed
|
|
26475
|
+
});
|
|
26430
26476
|
if (written && input2.onDispatched !== void 0 && !interruptedTurnIds.has(turnId)) {
|
|
26431
26477
|
const errorMessage = error62 instanceof Error && error62.message.trim() || "ACP prompt failed";
|
|
26432
|
-
if (settle2({
|
|
26478
|
+
if (settle2({
|
|
26479
|
+
turnId,
|
|
26480
|
+
stopReason: "error",
|
|
26481
|
+
state: "failed",
|
|
26482
|
+
errorMessage,
|
|
26483
|
+
...failureCategory === void 0 ? {} : { failureCategory }
|
|
26484
|
+
}))
|
|
26433
26485
|
options.log?.warn?.("turn failed after dispatch", {
|
|
26434
26486
|
threadId: options.threadId,
|
|
26435
26487
|
failure: errorMessage
|
|
26436
26488
|
});
|
|
26437
26489
|
}
|
|
26438
|
-
throw error62;
|
|
26490
|
+
throw error62 instanceof Error ? withFailureCategory(error62, failureCategory) : error62;
|
|
26439
26491
|
}
|
|
26440
26492
|
await connection.awaitInboundIdle();
|
|
26441
26493
|
if (options.beforeApplyResult) {
|
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.3034",
|
|
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
|
-
"
|
|
24
|
+
"ycodium-acp-executor": "0.2.3034",
|
|
25
25
|
"ycodium-executor-testing": "0.0.0",
|
|
26
|
-
"ycodium-
|
|
26
|
+
"@ycodium-ai/plugin-api": "0.2.3034"
|
|
27
27
|
},
|
|
28
28
|
"ycodium": {
|
|
29
29
|
"plugin": "./dist/index.js",
|