@ycodium-ai/agent-kimi 0.2.2996 → 0.2.2998
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 +140 -141
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -24273,6 +24273,9 @@ function asTrimmedString(value) {
|
|
|
24273
24273
|
const trimmed = value.trim();
|
|
24274
24274
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
24275
24275
|
}
|
|
24276
|
+
function readAcpText(source, key) {
|
|
24277
|
+
return asTrimmedString(source?.[key]);
|
|
24278
|
+
}
|
|
24276
24279
|
var selectPromptTurnId = (input2, activeTurnId, freshTurnId) => {
|
|
24277
24280
|
const target = input2.expectedActiveTurnId;
|
|
24278
24281
|
if (target === void 0) return input2.turnId ?? activeTurnId ?? freshTurnId();
|
|
@@ -24492,141 +24495,7 @@ function deriveToolActivityPresentation(input2) {
|
|
|
24492
24495
|
};
|
|
24493
24496
|
}
|
|
24494
24497
|
|
|
24495
|
-
// ../../packages/ycodium-acp-executor/src/
|
|
24496
|
-
function extractModelConfigId(sessionResponse) {
|
|
24497
|
-
const configOptions = sessionResponse.configOptions;
|
|
24498
|
-
if (!configOptions) return void 0;
|
|
24499
|
-
for (const opt of configOptions) {
|
|
24500
|
-
if (opt.category === "model" && opt.id.trim().length > 0) {
|
|
24501
|
-
return opt.id.trim();
|
|
24502
|
-
}
|
|
24503
|
-
}
|
|
24504
|
-
return configOptions.find((opt) => opt.id.trim() === "model" && opt.type === "select") ? "model" : void 0;
|
|
24505
|
-
}
|
|
24506
|
-
function findSessionConfigOption(configOptions, configId) {
|
|
24507
|
-
if (!configOptions) {
|
|
24508
|
-
return void 0;
|
|
24509
|
-
}
|
|
24510
|
-
const normalizedConfigId = configId.trim();
|
|
24511
|
-
if (!normalizedConfigId) {
|
|
24512
|
-
return void 0;
|
|
24513
|
-
}
|
|
24514
|
-
return configOptions.find((option) => option.id.trim() === normalizedConfigId);
|
|
24515
|
-
}
|
|
24516
|
-
function collectSessionConfigOptionValues(configOption) {
|
|
24517
|
-
if (configOption.type !== "select" || !configOption.options) {
|
|
24518
|
-
return [];
|
|
24519
|
-
}
|
|
24520
|
-
return configOption.options.flatMap(
|
|
24521
|
-
(entry) => "value" in entry ? [entry.value] : entry.options.map((option) => option.value)
|
|
24522
|
-
);
|
|
24523
|
-
}
|
|
24524
|
-
function collectSessionModelIds(models) {
|
|
24525
|
-
if (!isRecord3(models) || !Array.isArray(models["availableModels"])) {
|
|
24526
|
-
return [];
|
|
24527
|
-
}
|
|
24528
|
-
return models["availableModels"].flatMap(
|
|
24529
|
-
(model) => isRecord3(model) && typeof model["modelId"] === "string" ? [model["modelId"]] : []
|
|
24530
|
-
);
|
|
24531
|
-
}
|
|
24532
|
-
function catalogModelLastSegment(value) {
|
|
24533
|
-
if (value.startsWith("[")) {
|
|
24534
|
-
let parsed;
|
|
24535
|
-
try {
|
|
24536
|
-
parsed = JSON.parse(value);
|
|
24537
|
-
} catch {
|
|
24538
|
-
return void 0;
|
|
24539
|
-
}
|
|
24540
|
-
if (!Array.isArray(parsed) || parsed.length < 2) return void 0;
|
|
24541
|
-
const last = parsed[parsed.length - 1];
|
|
24542
|
-
return typeof last === "string" ? last : void 0;
|
|
24543
|
-
}
|
|
24544
|
-
const separator = value.indexOf("/");
|
|
24545
|
-
return separator > 0 && separator < value.length - 1 ? value.slice(separator + 1) : void 0;
|
|
24546
|
-
}
|
|
24547
|
-
function matchAdvertisedModelValue(requestedModelId, advertisedValues) {
|
|
24548
|
-
const wanted = requestedModelId.trim();
|
|
24549
|
-
if (!wanted) return void 0;
|
|
24550
|
-
if (advertisedValues.includes(wanted)) return wanted;
|
|
24551
|
-
const byLastSegment = advertisedValues.filter(
|
|
24552
|
-
(value) => catalogModelLastSegment(value) === wanted
|
|
24553
|
-
);
|
|
24554
|
-
return byLastSegment.length === 1 ? byLastSegment[0] : void 0;
|
|
24555
|
-
}
|
|
24556
|
-
function parseSessionModeState(sessionResponse) {
|
|
24557
|
-
const modes = sessionResponse.modes;
|
|
24558
|
-
if (!modes) return void 0;
|
|
24559
|
-
const currentModeId = modes.currentModeId.trim();
|
|
24560
|
-
if (!currentModeId) {
|
|
24561
|
-
return void 0;
|
|
24562
|
-
}
|
|
24563
|
-
const availableModes = [];
|
|
24564
|
-
for (const mode of modes.availableModes) {
|
|
24565
|
-
const id = mode.id.trim();
|
|
24566
|
-
const name = mode.name.trim();
|
|
24567
|
-
if (!id || !name) {
|
|
24568
|
-
continue;
|
|
24569
|
-
}
|
|
24570
|
-
const description = mode.description?.trim() || void 0;
|
|
24571
|
-
availableModes.push(
|
|
24572
|
-
description !== void 0 ? { id, name, description } : { id, name }
|
|
24573
|
-
);
|
|
24574
|
-
}
|
|
24575
|
-
if (availableModes.length === 0) {
|
|
24576
|
-
return void 0;
|
|
24577
|
-
}
|
|
24578
|
-
return {
|
|
24579
|
-
currentModeId,
|
|
24580
|
-
availableModes
|
|
24581
|
-
};
|
|
24582
|
-
}
|
|
24583
|
-
function acpCommandsToSlashCommands(commands) {
|
|
24584
|
-
return commands.map((command) => ({
|
|
24585
|
-
name: command.name,
|
|
24586
|
-
...command.description === void 0 ? {} : { description: command.description },
|
|
24587
|
-
...command.inputHint === void 0 ? {} : { input: { hint: command.inputHint } }
|
|
24588
|
-
}));
|
|
24589
|
-
}
|
|
24590
|
-
function parseAvailableCommandsUpdate(params) {
|
|
24591
|
-
const update = params.update;
|
|
24592
|
-
if (update["sessionUpdate"] !== "available_commands_update") {
|
|
24593
|
-
return void 0;
|
|
24594
|
-
}
|
|
24595
|
-
const availableCommands = update["availableCommands"];
|
|
24596
|
-
if (!Array.isArray(availableCommands)) {
|
|
24597
|
-
return [];
|
|
24598
|
-
}
|
|
24599
|
-
const commands = [];
|
|
24600
|
-
for (const command of availableCommands) {
|
|
24601
|
-
if (!isRecord3(command)) {
|
|
24602
|
-
continue;
|
|
24603
|
-
}
|
|
24604
|
-
const name = typeof command["name"] === "string" ? command["name"].trim() : "";
|
|
24605
|
-
if (!name) {
|
|
24606
|
-
continue;
|
|
24607
|
-
}
|
|
24608
|
-
const description = typeof command["description"] === "string" ? command["description"].trim() || void 0 : void 0;
|
|
24609
|
-
const input2 = isRecord3(command["input"]) ? command["input"] : void 0;
|
|
24610
|
-
const inputHint = typeof input2?.["hint"] === "string" ? input2["hint"].trim() || void 0 : void 0;
|
|
24611
|
-
commands.push({
|
|
24612
|
-
name,
|
|
24613
|
-
...description ? { description } : {},
|
|
24614
|
-
...inputHint ? { inputHint } : {}
|
|
24615
|
-
});
|
|
24616
|
-
}
|
|
24617
|
-
return commands;
|
|
24618
|
-
}
|
|
24619
|
-
function normalizePlanStepStatus(raw) {
|
|
24620
|
-
switch (raw) {
|
|
24621
|
-
case "completed":
|
|
24622
|
-
return "completed";
|
|
24623
|
-
case "in_progress":
|
|
24624
|
-
case "inProgress":
|
|
24625
|
-
return "inProgress";
|
|
24626
|
-
default:
|
|
24627
|
-
return "pending";
|
|
24628
|
-
}
|
|
24629
|
-
}
|
|
24498
|
+
// ../../packages/ycodium-acp-executor/src/tool-call-state.ts
|
|
24630
24499
|
function normalizeToolCallStatus(raw, fallback) {
|
|
24631
24500
|
switch (raw) {
|
|
24632
24501
|
case "pending":
|
|
@@ -24849,6 +24718,142 @@ function decideToolCallUpdateEmission(input2) {
|
|
|
24849
24718
|
}
|
|
24850
24719
|
return { emit: false, skippedSinceEmit: skippedSinceEmit + 1 };
|
|
24851
24720
|
}
|
|
24721
|
+
|
|
24722
|
+
// ../../packages/ycodium-acp-executor/src/runtime-model.ts
|
|
24723
|
+
function normalizePlanStepStatus(raw) {
|
|
24724
|
+
switch (raw) {
|
|
24725
|
+
case "completed":
|
|
24726
|
+
return "completed";
|
|
24727
|
+
case "in_progress":
|
|
24728
|
+
case "inProgress":
|
|
24729
|
+
return "inProgress";
|
|
24730
|
+
default:
|
|
24731
|
+
return "pending";
|
|
24732
|
+
}
|
|
24733
|
+
}
|
|
24734
|
+
function extractModelConfigId(sessionResponse) {
|
|
24735
|
+
const configOptions = sessionResponse.configOptions;
|
|
24736
|
+
if (!configOptions) return void 0;
|
|
24737
|
+
for (const opt of configOptions) {
|
|
24738
|
+
if (opt.category === "model" && opt.id.trim().length > 0) {
|
|
24739
|
+
return opt.id.trim();
|
|
24740
|
+
}
|
|
24741
|
+
}
|
|
24742
|
+
return configOptions.find((opt) => opt.id.trim() === "model" && opt.type === "select") ? "model" : void 0;
|
|
24743
|
+
}
|
|
24744
|
+
function findSessionConfigOption(configOptions, configId) {
|
|
24745
|
+
if (!configOptions) {
|
|
24746
|
+
return void 0;
|
|
24747
|
+
}
|
|
24748
|
+
const normalizedConfigId = configId.trim();
|
|
24749
|
+
if (!normalizedConfigId) {
|
|
24750
|
+
return void 0;
|
|
24751
|
+
}
|
|
24752
|
+
return configOptions.find((option) => option.id.trim() === normalizedConfigId);
|
|
24753
|
+
}
|
|
24754
|
+
function collectSessionConfigOptionValues(configOption) {
|
|
24755
|
+
if (configOption.type !== "select" || !configOption.options) {
|
|
24756
|
+
return [];
|
|
24757
|
+
}
|
|
24758
|
+
return configOption.options.flatMap(
|
|
24759
|
+
(entry) => "value" in entry ? [entry.value] : entry.options.map((option) => option.value)
|
|
24760
|
+
);
|
|
24761
|
+
}
|
|
24762
|
+
function collectSessionModelIds(models) {
|
|
24763
|
+
if (!isRecord3(models) || !Array.isArray(models["availableModels"])) {
|
|
24764
|
+
return [];
|
|
24765
|
+
}
|
|
24766
|
+
return models["availableModels"].flatMap(
|
|
24767
|
+
(model) => isRecord3(model) && typeof model["modelId"] === "string" ? [model["modelId"]] : []
|
|
24768
|
+
);
|
|
24769
|
+
}
|
|
24770
|
+
function catalogModelLastSegment(value) {
|
|
24771
|
+
if (value.startsWith("[")) {
|
|
24772
|
+
let parsed;
|
|
24773
|
+
try {
|
|
24774
|
+
parsed = JSON.parse(value);
|
|
24775
|
+
} catch {
|
|
24776
|
+
return void 0;
|
|
24777
|
+
}
|
|
24778
|
+
if (!Array.isArray(parsed) || parsed.length < 2) return void 0;
|
|
24779
|
+
const last = parsed[parsed.length - 1];
|
|
24780
|
+
return typeof last === "string" ? last : void 0;
|
|
24781
|
+
}
|
|
24782
|
+
const separator = value.indexOf("/");
|
|
24783
|
+
return separator > 0 && separator < value.length - 1 ? value.slice(separator + 1) : void 0;
|
|
24784
|
+
}
|
|
24785
|
+
function matchAdvertisedModelValue(requestedModelId, advertisedValues) {
|
|
24786
|
+
const wanted = requestedModelId.trim();
|
|
24787
|
+
if (!wanted) return void 0;
|
|
24788
|
+
if (advertisedValues.includes(wanted)) return wanted;
|
|
24789
|
+
const byLastSegment = advertisedValues.filter(
|
|
24790
|
+
(value) => catalogModelLastSegment(value) === wanted
|
|
24791
|
+
);
|
|
24792
|
+
return byLastSegment.length === 1 ? byLastSegment[0] : void 0;
|
|
24793
|
+
}
|
|
24794
|
+
function parseSessionModeState(sessionResponse) {
|
|
24795
|
+
const modes = sessionResponse.modes;
|
|
24796
|
+
if (!modes) return void 0;
|
|
24797
|
+
const currentModeId = modes.currentModeId.trim();
|
|
24798
|
+
if (!currentModeId) {
|
|
24799
|
+
return void 0;
|
|
24800
|
+
}
|
|
24801
|
+
const availableModes = [];
|
|
24802
|
+
for (const mode of modes.availableModes) {
|
|
24803
|
+
const id = mode.id.trim();
|
|
24804
|
+
const name = mode.name.trim();
|
|
24805
|
+
if (!id || !name) {
|
|
24806
|
+
continue;
|
|
24807
|
+
}
|
|
24808
|
+
const description = mode.description?.trim() || void 0;
|
|
24809
|
+
availableModes.push(
|
|
24810
|
+
description !== void 0 ? { id, name, description } : { id, name }
|
|
24811
|
+
);
|
|
24812
|
+
}
|
|
24813
|
+
if (availableModes.length === 0) {
|
|
24814
|
+
return void 0;
|
|
24815
|
+
}
|
|
24816
|
+
return {
|
|
24817
|
+
currentModeId,
|
|
24818
|
+
availableModes
|
|
24819
|
+
};
|
|
24820
|
+
}
|
|
24821
|
+
function acpCommandsToSlashCommands(commands) {
|
|
24822
|
+
return commands.map((command) => ({
|
|
24823
|
+
name: command.name,
|
|
24824
|
+
...command.description === void 0 ? {} : { description: command.description },
|
|
24825
|
+
...command.inputHint === void 0 ? {} : { input: { hint: command.inputHint } }
|
|
24826
|
+
}));
|
|
24827
|
+
}
|
|
24828
|
+
function parseAvailableCommandsUpdate(params) {
|
|
24829
|
+
const update = params.update;
|
|
24830
|
+
if (update["sessionUpdate"] !== "available_commands_update") {
|
|
24831
|
+
return void 0;
|
|
24832
|
+
}
|
|
24833
|
+
const availableCommands = update["availableCommands"];
|
|
24834
|
+
if (!Array.isArray(availableCommands)) {
|
|
24835
|
+
return [];
|
|
24836
|
+
}
|
|
24837
|
+
const commands = [];
|
|
24838
|
+
for (const command of availableCommands) {
|
|
24839
|
+
if (!isRecord3(command)) {
|
|
24840
|
+
continue;
|
|
24841
|
+
}
|
|
24842
|
+
const name = typeof command["name"] === "string" ? command["name"].trim() : "";
|
|
24843
|
+
if (!name) {
|
|
24844
|
+
continue;
|
|
24845
|
+
}
|
|
24846
|
+
const description = typeof command["description"] === "string" ? command["description"].trim() || void 0 : void 0;
|
|
24847
|
+
const input2 = isRecord3(command["input"]) ? command["input"] : void 0;
|
|
24848
|
+
const inputHint = typeof input2?.["hint"] === "string" ? input2["hint"].trim() || void 0 : void 0;
|
|
24849
|
+
commands.push({
|
|
24850
|
+
name,
|
|
24851
|
+
...description ? { description } : {},
|
|
24852
|
+
...inputHint ? { inputHint } : {}
|
|
24853
|
+
});
|
|
24854
|
+
}
|
|
24855
|
+
return commands;
|
|
24856
|
+
}
|
|
24852
24857
|
function parsePermissionRequest(params) {
|
|
24853
24858
|
const toolCall = makeToolCallState(
|
|
24854
24859
|
{
|
|
@@ -24888,12 +24893,6 @@ function boundToolCallRawPayload(params, update, toolCall) {
|
|
|
24888
24893
|
}
|
|
24889
24894
|
};
|
|
24890
24895
|
}
|
|
24891
|
-
function readAcpText(source, key) {
|
|
24892
|
-
const value = source?.[key];
|
|
24893
|
-
if (typeof value !== "string") return void 0;
|
|
24894
|
-
const trimmed = value.trim();
|
|
24895
|
-
return trimmed.length > 0 ? trimmed : void 0;
|
|
24896
|
-
}
|
|
24897
24896
|
function textFromContentBlocks(blocks) {
|
|
24898
24897
|
const parts = blocks.flatMap(
|
|
24899
24898
|
(block) => isRecord3(block) && block["type"] === "text" && typeof block["text"] === "string" ? [block["text"]] : []
|
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.2998",
|
|
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.2998",
|
|
25
|
+
"ycodium-executor-testing": "0.0.0",
|
|
26
|
+
"@ycodium-ai/plugin-api": "0.2.2998"
|
|
27
27
|
},
|
|
28
28
|
"ycodium": {
|
|
29
29
|
"plugin": "./dist/index.js",
|