@ycodium-ai/agent-grok 0.2.2868 → 0.2.2874
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 +64 -23
- package/locales/zh-CN.json +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -63,6 +63,8 @@ var GROK_CARD = {
|
|
|
63
63
|
capabilities: {
|
|
64
64
|
// 插件不承诺原生会话内活切型号。
|
|
65
65
|
sessionModelSwitch: "unsupported",
|
|
66
|
+
// 思考档位只在 spawn 时定(`--reasoning-effort`):中途换档,宿主带 resume cursor 重开会话。
|
|
67
|
+
sessionOptionSwitch: "unsupported",
|
|
66
68
|
// 运行模式只在 spawn 时定得了(`--permission-mode` 是启动旗标,ACP 那一侧
|
|
67
69
|
// `modes: null`,`session/set_mode` 对它无效),所以不许声称能会话中途换。
|
|
68
70
|
// 报 next-turn 之后宿主 `ProviderCommandReactor` 不再下发,而是把新档记在
|
|
@@ -25420,7 +25422,8 @@ function modelSelectionStateFromSetup(setup) {
|
|
|
25420
25422
|
sessionModelsAdvertised: sessionModels !== void 0,
|
|
25421
25423
|
modelConfigId,
|
|
25422
25424
|
currentModelId,
|
|
25423
|
-
advertisedModelValues: strategy === "config-option" ? modelConfigOption === void 0 ? [] : collectSessionConfigOptionValues(modelConfigOption) : collectSessionModelIds(sessionModels)
|
|
25425
|
+
advertisedModelValues: strategy === "config-option" ? modelConfigOption === void 0 ? [] : collectSessionConfigOptionValues(modelConfigOption) : collectSessionModelIds(sessionModels),
|
|
25426
|
+
configOptions: setup.configOptions
|
|
25424
25427
|
};
|
|
25425
25428
|
}
|
|
25426
25429
|
|
|
@@ -26045,12 +26048,13 @@ function createAcpExecutor(options) {
|
|
|
26045
26048
|
if (value === input2.state.currentModelId) {
|
|
26046
26049
|
return input2.state;
|
|
26047
26050
|
}
|
|
26051
|
+
let configOptions = input2.state.configOptions;
|
|
26048
26052
|
if (input2.state.strategy === "config-option") {
|
|
26049
|
-
await connection.request(
|
|
26050
|
-
|
|
26051
|
-
configId: input2.state.modelConfigId,
|
|
26052
|
-
|
|
26053
|
-
|
|
26053
|
+
const switched = await connection.request(
|
|
26054
|
+
"session/set_config_option",
|
|
26055
|
+
{ sessionId: input2.acpSessionId, configId: input2.state.modelConfigId, value }
|
|
26056
|
+
);
|
|
26057
|
+
configOptions = switched?.configOptions ?? configOptions;
|
|
26054
26058
|
} else {
|
|
26055
26059
|
await connection.request("session/set_model", {
|
|
26056
26060
|
sessionId: input2.acpSessionId,
|
|
@@ -26060,13 +26064,12 @@ function createAcpExecutor(options) {
|
|
|
26060
26064
|
if (!isLive(input2.expectedGeneration)) {
|
|
26061
26065
|
throw new AcpExecutorDisposedError();
|
|
26062
26066
|
}
|
|
26063
|
-
return { ...input2.state, currentModelId: value };
|
|
26067
|
+
return { ...input2.state, currentModelId: value, configOptions };
|
|
26064
26068
|
};
|
|
26065
26069
|
const applyRequestedEffort = async (input2) => {
|
|
26066
26070
|
const requested = input2.requestedEffort?.trim();
|
|
26067
26071
|
if (!requested) return;
|
|
26068
|
-
const
|
|
26069
|
-
const effort = findAcpEffortConfig(configOptions);
|
|
26072
|
+
const effort = findAcpEffortConfig(input2.configOptions);
|
|
26070
26073
|
if (effort === void 0) return;
|
|
26071
26074
|
const matched = effort.choices.find((choice) => choice.value === requested);
|
|
26072
26075
|
if (matched === void 0) {
|
|
@@ -26166,7 +26169,7 @@ function createAcpExecutor(options) {
|
|
|
26166
26169
|
expectedGeneration
|
|
26167
26170
|
});
|
|
26168
26171
|
await applyRequestedEffort({
|
|
26169
|
-
|
|
26172
|
+
configOptions: nextModelSelectionState.configOptions,
|
|
26170
26173
|
acpSessionId: nextSessionId,
|
|
26171
26174
|
requestedEffort: options.requestedEffort,
|
|
26172
26175
|
expectedGeneration
|
|
@@ -27305,6 +27308,53 @@ function makeXAiExitPlanModeResponse(params, resolution) {
|
|
|
27305
27308
|
return { outcome: "request_changes", feedback: text3 };
|
|
27306
27309
|
}
|
|
27307
27310
|
|
|
27311
|
+
// src/grokReasoningEffort.ts
|
|
27312
|
+
import { REASONING_OPTION_LABEL, reasoningEffortShortLabel } from "@ycodium-ai/plugin-api/executor";
|
|
27313
|
+
|
|
27314
|
+
// src/grokJson.ts
|
|
27315
|
+
var isRecord10 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27316
|
+
var trimmed2 = (value) => {
|
|
27317
|
+
if (typeof value !== "string") return void 0;
|
|
27318
|
+
const text3 = value.trim();
|
|
27319
|
+
return text3.length > 0 ? text3 : void 0;
|
|
27320
|
+
};
|
|
27321
|
+
|
|
27322
|
+
// src/grokReasoningEffort.ts
|
|
27323
|
+
var GROK_REASONING_OPTION_ID = "reasoningEffort";
|
|
27324
|
+
function grokReasoningEffortDescriptor(modelMeta) {
|
|
27325
|
+
if (!isRecord10(modelMeta) || modelMeta["supportsReasoningEffort"] !== true) return void 0;
|
|
27326
|
+
const table = modelMeta["reasoningEfforts"];
|
|
27327
|
+
if (!Array.isArray(table)) return void 0;
|
|
27328
|
+
const options = table.flatMap((entry) => {
|
|
27329
|
+
if (!isRecord10(entry)) return [];
|
|
27330
|
+
const value = trimmed2(entry["value"]) ?? trimmed2(entry["id"]);
|
|
27331
|
+
if (value === void 0) return [];
|
|
27332
|
+
const description = trimmed2(entry["description"]);
|
|
27333
|
+
return [
|
|
27334
|
+
{
|
|
27335
|
+
id: value,
|
|
27336
|
+
// CLI 自带的标签是「High Effort」这种,放在档位那一格里重复;认不出的档才用它。
|
|
27337
|
+
label: reasoningEffortShortLabel(value) ?? trimmed2(entry["label"]) ?? value,
|
|
27338
|
+
...description === void 0 ? {} : { description },
|
|
27339
|
+
...entry["default"] === true ? { isDefault: true } : {}
|
|
27340
|
+
}
|
|
27341
|
+
];
|
|
27342
|
+
});
|
|
27343
|
+
if (options.length === 0) return void 0;
|
|
27344
|
+
const currentValue = options.find((option) => option.isDefault === true)?.id;
|
|
27345
|
+
return {
|
|
27346
|
+
id: GROK_REASONING_OPTION_ID,
|
|
27347
|
+
label: REASONING_OPTION_LABEL,
|
|
27348
|
+
type: "select",
|
|
27349
|
+
options,
|
|
27350
|
+
...currentValue === void 0 ? {} : { currentValue }
|
|
27351
|
+
};
|
|
27352
|
+
}
|
|
27353
|
+
function grokReasoningEffortArgs(effort) {
|
|
27354
|
+
const value = effort?.trim();
|
|
27355
|
+
return value === void 0 || value.length === 0 ? [] : ["--reasoning-effort", value];
|
|
27356
|
+
}
|
|
27357
|
+
|
|
27308
27358
|
// src/grokBackgroundTasks.ts
|
|
27309
27359
|
var record2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
27310
27360
|
var text2 = (value) => typeof value === "string" ? value.trim() || void 0 : void 0;
|
|
@@ -27405,16 +27455,6 @@ function buildGrokBackgroundTaskEvents(input2) {
|
|
|
27405
27455
|
|
|
27406
27456
|
// src/grokSupport.ts
|
|
27407
27457
|
import { modelSelectionStringOption } from "@ycodium-ai/plugin-api/executor";
|
|
27408
|
-
var isRecord10 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27409
|
-
var trimmed2 = (value) => {
|
|
27410
|
-
if (typeof value !== "string") return void 0;
|
|
27411
|
-
const text3 = value.trim();
|
|
27412
|
-
return text3.length > 0 ? text3 : void 0;
|
|
27413
|
-
};
|
|
27414
|
-
function grokReasoningEffortArgs(effort) {
|
|
27415
|
-
const value = effort?.trim();
|
|
27416
|
-
return value === void 0 || value.length === 0 ? [] : ["--reasoning-effort", value];
|
|
27417
|
-
}
|
|
27418
27458
|
var GROK_NATIVE_MODE_BY_RUNTIME_MODE = {
|
|
27419
27459
|
"approval-required": "default",
|
|
27420
27460
|
"auto-accept-edits": "auto",
|
|
@@ -27518,7 +27558,6 @@ function grokRuntimeModeCaveat(nativeModeId) {
|
|
|
27518
27558
|
message
|
|
27519
27559
|
};
|
|
27520
27560
|
}
|
|
27521
|
-
var GROK_REASONING_OPTION_ID = "reasoningEffort";
|
|
27522
27561
|
function resolveGrokAuthMethodId(initializeResult) {
|
|
27523
27562
|
const authMethods = isRecord10(initializeResult) ? initializeResult["authMethods"] : void 0;
|
|
27524
27563
|
if (!Array.isArray(authMethods)) return void 0;
|
|
@@ -27560,7 +27599,8 @@ function grokAdvertisedModels(initializeResult) {
|
|
|
27560
27599
|
modelId,
|
|
27561
27600
|
name: trimmed2(entry["name"]),
|
|
27562
27601
|
isDefault: state.currentModelId !== void 0 && modelId === state.currentModelId,
|
|
27563
|
-
contextWindow
|
|
27602
|
+
contextWindow,
|
|
27603
|
+
reasoningEffort: grokReasoningEffortDescriptor(modelMeta)
|
|
27564
27604
|
});
|
|
27565
27605
|
}
|
|
27566
27606
|
return models;
|
|
@@ -27802,7 +27842,8 @@ function grokProbeModels(initializeResult) {
|
|
|
27802
27842
|
slug: model.modelId,
|
|
27803
27843
|
...model.name === void 0 ? {} : { name: model.name },
|
|
27804
27844
|
...model.isDefault ? { isDefault: true } : {},
|
|
27805
|
-
...model.contextWindow === void 0 ? {} : { contextWindow: model.contextWindow }
|
|
27845
|
+
...model.contextWindow === void 0 ? {} : { contextWindow: model.contextWindow },
|
|
27846
|
+
...model.reasoningEffort === void 0 ? {} : { capabilities: { optionDescriptors: [model.reasoningEffort] } }
|
|
27806
27847
|
}));
|
|
27807
27848
|
}
|
|
27808
27849
|
var failureDetail = (error62) => (error62 instanceof Error ? error62.message : String(error62)).trim() || void 0;
|
package/locales/zh-CN.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-grok",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2874",
|
|
4
4
|
"description": "Grok executor: grok CLI 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.2874",
|
|
25
|
+
"@ycodium-ai/plugin-api": "0.2.2874",
|
|
26
|
+
"ycodium-executor-testing": "0.0.0"
|
|
27
27
|
},
|
|
28
28
|
"ycodium": {
|
|
29
29
|
"plugin": "./dist/index.js",
|