@ycodium-ai/agent-grok 0.2.3671 → 0.2.3710
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 +52 -12
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -25381,23 +25381,31 @@ function createAcpConnection(options) {
|
|
|
25381
25381
|
function normalizeModelId(value) {
|
|
25382
25382
|
return value?.trim() || void 0;
|
|
25383
25383
|
}
|
|
25384
|
-
function adoptReportedConfigOptions(state, configOptions) {
|
|
25384
|
+
function adoptReportedConfigOptions(state, configOptions, fromAgent = true) {
|
|
25385
25385
|
const option = state.modelConfigId === void 0 ? void 0 : findConfigOptionEntry(configOptions, state.modelConfigId);
|
|
25386
25386
|
const value = option?.["currentValue"];
|
|
25387
25387
|
const reported = typeof value === "string" ? normalizeModelId(value) : void 0;
|
|
25388
25388
|
if (reported === void 0) return { ...state, configOptions };
|
|
25389
25389
|
const { modelUnconfirmed: _confirmed, ...known } = state;
|
|
25390
|
-
|
|
25390
|
+
const stillReported = fromAgent || state.currentModelReported === true && reported === state.currentModelId;
|
|
25391
|
+
const { currentModelReported: _stale, ...unreported } = known;
|
|
25392
|
+
return {
|
|
25393
|
+
...stillReported ? known : unreported,
|
|
25394
|
+
configOptions,
|
|
25395
|
+
currentModelId: reported,
|
|
25396
|
+
...stillReported ? { currentModelReported: true } : {}
|
|
25397
|
+
};
|
|
25391
25398
|
}
|
|
25392
25399
|
function forgetConfigOptionValue(state, configId) {
|
|
25393
25400
|
const forgetsModel = configId === void 0 || configId === state.modelConfigId;
|
|
25401
|
+
const { currentModelReported: _forgottenReport, ...withoutReport } = state;
|
|
25394
25402
|
const configOptions = configId !== void 0 && Array.isArray(state.configOptions) ? state.configOptions.map((option) => {
|
|
25395
25403
|
if (!isRecord2(option) || option["id"] !== configId) return option;
|
|
25396
25404
|
const { currentValue: _forgotten, ...rest } = option;
|
|
25397
25405
|
return rest;
|
|
25398
25406
|
}) : state.configOptions;
|
|
25399
25407
|
return {
|
|
25400
|
-
...state,
|
|
25408
|
+
...forgetsModel ? withoutReport : state,
|
|
25401
25409
|
configOptions,
|
|
25402
25410
|
...forgetsModel ? { currentModelId: void 0, modelUnconfirmed: true } : {}
|
|
25403
25411
|
};
|
|
@@ -25414,6 +25422,7 @@ function modelSelectionStateFromSetup(setup) {
|
|
|
25414
25422
|
sessionModelsAdvertised: sessionModels !== void 0,
|
|
25415
25423
|
modelConfigId,
|
|
25416
25424
|
currentModelId,
|
|
25425
|
+
...currentModelId === void 0 ? {} : { currentModelReported: true },
|
|
25417
25426
|
advertisedModelValues: strategy === "config-option" ? modelConfigOption === void 0 ? [] : collectSessionConfigOptionValues(modelConfigOption) : collectSessionModelIds(sessionModels),
|
|
25418
25427
|
configOptions: setup.configOptions,
|
|
25419
25428
|
catalogSetup: setup
|
|
@@ -26201,14 +26210,28 @@ function createExecutorPrompt({
|
|
|
26201
26210
|
}
|
|
26202
26211
|
};
|
|
26203
26212
|
const alignTurnOptions = async (input2, sessionId, generation, isStale, signal) => {
|
|
26213
|
+
const before = shared.modelSelectionState;
|
|
26204
26214
|
const applied = await applyRequestedModel({
|
|
26205
|
-
state:
|
|
26215
|
+
state: before,
|
|
26206
26216
|
acpSessionId: sessionId,
|
|
26207
26217
|
requestedModelId: input2.requestedModelId,
|
|
26208
26218
|
expectedGeneration: generation,
|
|
26209
26219
|
signal
|
|
26210
26220
|
});
|
|
26211
26221
|
shared.modelSelectionState = applied;
|
|
26222
|
+
if (applied.currentModelId !== void 0 && (applied.currentModelId !== before.currentModelId || applied.currentModelReported !== before.currentModelReported)) {
|
|
26223
|
+
emit({
|
|
26224
|
+
type: "thread.metadata.updated",
|
|
26225
|
+
...stamp(),
|
|
26226
|
+
provider: options.provider,
|
|
26227
|
+
threadId: options.threadId,
|
|
26228
|
+
...shared.activeTurnId === void 0 ? {} : { turnId: shared.activeTurnId },
|
|
26229
|
+
payload: {
|
|
26230
|
+
model: applied.currentModelId,
|
|
26231
|
+
modelSource: applied.currentModelReported === true ? "reported" : "echo"
|
|
26232
|
+
}
|
|
26233
|
+
});
|
|
26234
|
+
}
|
|
26212
26235
|
if (isStale()) return;
|
|
26213
26236
|
const switched = applied.configOptions;
|
|
26214
26237
|
let aligned;
|
|
@@ -26233,7 +26256,8 @@ function createExecutorPrompt({
|
|
|
26233
26256
|
if (aligned.configOptions !== switched) {
|
|
26234
26257
|
shared.modelSelectionState = adoptReportedConfigOptions(
|
|
26235
26258
|
shared.modelSelectionState,
|
|
26236
|
-
aligned.configOptions
|
|
26259
|
+
aligned.configOptions,
|
|
26260
|
+
false
|
|
26237
26261
|
);
|
|
26238
26262
|
}
|
|
26239
26263
|
if (aligned.unsupportedEffort !== void 0) {
|
|
@@ -27154,18 +27178,20 @@ function createExecutorSession({
|
|
|
27154
27178
|
const base = ours !== void 0 && ours.seq > issuedAt ? ours.configOptions : configOptions;
|
|
27155
27179
|
return { configOptions: withConfigOptionValue(base, configId, value), reported: false };
|
|
27156
27180
|
};
|
|
27157
|
-
const writeConfigOption = async (...args) => (await writeConfigOptionReported(...args)).configOptions;
|
|
27158
27181
|
const switchModel = async (input2) => {
|
|
27159
27182
|
let configOptions = input2.state.configOptions;
|
|
27183
|
+
let fromAgent = true;
|
|
27160
27184
|
const write = { option: "model", signal: input2.signal };
|
|
27161
27185
|
if (input2.state.strategy === "config-option" && input2.state.modelConfigId !== void 0) {
|
|
27162
|
-
|
|
27186
|
+
const written = await writeConfigOptionReported(
|
|
27163
27187
|
input2.sessionId,
|
|
27164
27188
|
configOptions,
|
|
27165
27189
|
input2.state.modelConfigId,
|
|
27166
27190
|
input2.value,
|
|
27167
27191
|
write
|
|
27168
27192
|
);
|
|
27193
|
+
configOptions = written.configOptions;
|
|
27194
|
+
fromAgent = written.reported;
|
|
27169
27195
|
} else {
|
|
27170
27196
|
const before = shared.configOptionUpdates.get(input2.sessionId);
|
|
27171
27197
|
const pending = connection.begin("session/set_model", {
|
|
@@ -27183,7 +27209,12 @@ function createExecutorSession({
|
|
|
27183
27209
|
throw new AcpExecutorDisposedError();
|
|
27184
27210
|
}
|
|
27185
27211
|
const { modelUnconfirmed: _confirmed, ...known } = input2.state;
|
|
27186
|
-
|
|
27212
|
+
const { currentModelReported: _echoed, ...requested } = known;
|
|
27213
|
+
return adoptReportedConfigOptions(
|
|
27214
|
+
{ ...requested, currentModelId: input2.value },
|
|
27215
|
+
configOptions,
|
|
27216
|
+
fromAgent
|
|
27217
|
+
);
|
|
27187
27218
|
};
|
|
27188
27219
|
const applyRequestedModel = async (input2) => {
|
|
27189
27220
|
const requestedModelId = normalizeModelId(input2.requestedModelId) ?? "";
|
|
@@ -27327,7 +27358,8 @@ function createExecutorSession({
|
|
|
27327
27358
|
});
|
|
27328
27359
|
nextModelSelectionState = adoptReportedConfigOptions(
|
|
27329
27360
|
nextModelSelectionState,
|
|
27330
|
-
aligned.configOptions
|
|
27361
|
+
aligned.configOptions,
|
|
27362
|
+
false
|
|
27331
27363
|
);
|
|
27332
27364
|
if (aligned.unsupportedEffort !== void 0) {
|
|
27333
27365
|
options.log?.info("requested effort is not offered by this model; using its default", {
|
|
@@ -27360,7 +27392,8 @@ function createExecutorSession({
|
|
|
27360
27392
|
initializeResult: initialized,
|
|
27361
27393
|
sessionSetupResult: setup,
|
|
27362
27394
|
modelConfigId: extractModelConfigId(setup),
|
|
27363
|
-
modelId: nextModelSelectionState.currentModelId
|
|
27395
|
+
modelId: nextModelSelectionState.currentModelId,
|
|
27396
|
+
modelReported: nextModelSelectionState.currentModelReported === true
|
|
27364
27397
|
};
|
|
27365
27398
|
shared.startResult = result;
|
|
27366
27399
|
shared.status = "ready";
|
|
@@ -28318,6 +28351,9 @@ function createAcpExecutor(options) {
|
|
|
28318
28351
|
get modelId() {
|
|
28319
28352
|
return shared.modelSelectionState.currentModelId;
|
|
28320
28353
|
},
|
|
28354
|
+
get modelReported() {
|
|
28355
|
+
return shared.modelSelectionState.currentModelReported === true;
|
|
28356
|
+
},
|
|
28321
28357
|
get status() {
|
|
28322
28358
|
return shared.status;
|
|
28323
28359
|
},
|
|
@@ -30780,7 +30816,11 @@ var createGrokInstance = (config2, host) => {
|
|
|
30780
30816
|
createdAt,
|
|
30781
30817
|
updatedAt: createdAt,
|
|
30782
30818
|
resumeCursor,
|
|
30783
|
-
...started.modelId === void 0 ? {} : {
|
|
30819
|
+
...started.modelId === void 0 ? {} : {
|
|
30820
|
+
model: started.modelId,
|
|
30821
|
+
// agent 在握手里报的才是读回的;切型号走 session/set_model 时回包不带型号,那只是请求值。
|
|
30822
|
+
modelSource: started.modelReported ? "reported" : "echo"
|
|
30823
|
+
},
|
|
30784
30824
|
...input2.bindingGeneration === void 0 ? {} : { bindingGeneration: input2.bindingGeneration }
|
|
30785
30825
|
};
|
|
30786
30826
|
registerSession(input2.threadId, {
|
|
@@ -30930,7 +30970,7 @@ var executors = [
|
|
|
30930
30970
|
];
|
|
30931
30971
|
var index_default = definePlugin({
|
|
30932
30972
|
id: "agent-grok",
|
|
30933
|
-
apiVersion:
|
|
30973
|
+
apiVersion: 53,
|
|
30934
30974
|
executors,
|
|
30935
30975
|
activate(ctx) {
|
|
30936
30976
|
ctx.log.info("grok executor ready");
|
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.3710",
|
|
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
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
25
|
-
"ycodium-executor
|
|
26
|
-
"ycodium-
|
|
24
|
+
"@ycodium-ai/plugin-api": "0.2.3710",
|
|
25
|
+
"ycodium-acp-executor": "0.2.3710",
|
|
26
|
+
"ycodium-executor-testing": "0.0.0"
|
|
27
27
|
},
|
|
28
28
|
"ycodium": {
|
|
29
29
|
"plugin": "./dist/index.js",
|