lody 0.91.1 → 0.92.0

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.
@@ -32600,7 +32600,47 @@ Check ${configPath} and project .codex directories, especially their config.toml
32600
32600
  return {};
32601
32601
  }
32602
32602
  return {
32603
- configOptions: this.createSessionConfigOptions(sessionState)
32603
+ configOptions: this.createSessionConfigOptions(sessionState),
32604
+ ...this.createModelCapabilitiesMeta(sessionState)
32605
+ };
32606
+ }
32607
+ /**
32608
+ * Publishes what each model can do, not just what the current one can.
32609
+ *
32610
+ * `configOptions` is rebuilt per model — `fast-mode` appears only while the
32611
+ * current model has a fast speed tier, and the effort list is that model's —
32612
+ * so a client reading it learns nothing about any other model, and there is
32613
+ * no ACP request that asks. This data is already in hand here, from the same
32614
+ * `Model` objects those options are built from; dropping it forced clients to
32615
+ * guess or to refuse selections that are perfectly valid.
32616
+ *
32617
+ * Self-declared and advisory: it describes this account's catalog at this
32618
+ * moment, and the live session state remains the authority.
32619
+ */
32620
+ createModelCapabilitiesMeta(sessionState) {
32621
+ const models = sessionState.availableModels;
32622
+ if (models.length === 0) {
32623
+ return {};
32624
+ }
32625
+ return {
32626
+ _meta: {
32627
+ lody: {
32628
+ modelCapabilities: {
32629
+ version: 1,
32630
+ models: Object.fromEntries(
32631
+ models.map((model) => [
32632
+ model.id,
32633
+ {
32634
+ effortValues: model.supportedReasoningEfforts.map(
32635
+ (effort) => effort.reasoningEffort
32636
+ ),
32637
+ fastMode: modelSupportsFast(model)
32638
+ }
32639
+ ])
32640
+ )
32641
+ }
32642
+ }
32643
+ }
32604
32644
  };
32605
32645
  }
32606
32646
  isSessionConfigEnabled() {
@@ -80,7 +80,7 @@ let __tla = Promise.all([
80
80
  }
81
81
  })()
82
82
  ]).then(async () => {
83
- const reviewViewerVersion = "0.91.1";
83
+ const reviewViewerVersion = "0.92.0";
84
84
  const reviewViewerSha256 = "dc9c7fc1dde49bb39c5fe86392d69219b469c0cab4fd492d8b562045e7f676e4";
85
85
  const reviewViewerFileName = "standalone.html";
86
86
  const DEFAULT_CDN_BASES = [
package/dist/codex-acp.js CHANGED
@@ -3,5 +3,5 @@
3
3
  console.error("CODEX_PATH is required for the bundled Codex ACP adapter.");
4
4
  process.exit(1);
5
5
  }
6
- await import("./chunks/index-BNIS69wD.js");
6
+ await import("./chunks/index-Cy4lnlSp.js");
7
7
  })();
package/dist/grok-acp.js CHANGED
@@ -251,22 +251,21 @@ function translateSessionStart(message) {
251
251
  const params = message.params ?? {};
252
252
  const permissionMode = readLodySessionConfigOption(params._meta, "permission_mode");
253
253
  const mapped = typeof permissionMode === "string" ? PERMISSION_MODES[permissionMode] : void 0;
254
- if (!mapped) return { message, permissionMode: void 0, notification: void 0 };
255
- const clientIdentifier = params._meta?.clientIdentifier;
254
+ if (!mapped) return { message, permissionMode: void 0 };
256
255
  const translated = {
257
256
  ...message,
258
257
  params: {
259
258
  ...params,
260
259
  _meta: {
261
260
  ...stripLodySessionConfig(params._meta),
262
- yoloMode: mapped.yolo_mode
261
+ yoloMode: mapped.yolo_mode,
262
+ autoMode: mapped.auto_mode
263
263
  }
264
264
  }
265
265
  };
266
266
  return {
267
267
  message: translated,
268
- permissionMode,
269
- notification: mapped.auto_mode && typeof clientIdentifier === "string" ? permissionNotification(clientIdentifier, permissionMode) : void 0
268
+ permissionMode
270
269
  };
271
270
  }
272
271
  class GrokAcpCompatibilityProxy {
@@ -281,29 +280,49 @@ class GrokAcpCompatibilityProxy {
281
280
  this.permissionModes = /* @__PURE__ */ new Map();
282
281
  this.nextInternalRequestId = Number.MAX_SAFE_INTEGER;
283
282
  }
284
- applyModelSnapshot(state, snapshot) {
283
+ applyCurrentModel(state, currentModelId, reportedReasoningEffort) {
285
284
  const previousModelId = state.currentModelId;
286
- const previousReasoningEffort = state.reasoningEffort;
287
- const currentModel = snapshot.availableModels.find(
288
- (model) => model.modelId === snapshot.currentModelId
289
- );
285
+ const currentModel = state.models.find((model) => model.modelId === currentModelId);
290
286
  const reasoningEfforts = readReasoningEfforts(currentModel);
291
287
  const metadataReasoningEffort = currentModel?._meta?.reasoningEffort ?? currentModel?._meta?.reasoning_effort;
292
- state.currentModelId = snapshot.currentModelId;
293
- state.models = snapshot.availableModels;
288
+ state.currentModelId = currentModelId;
289
+ if (reasoningEfforts.length === 0) {
290
+ if (previousModelId !== currentModelId) state.reasoningEfforts = [];
291
+ if (typeof reportedReasoningEffort === "string") {
292
+ state.reasoningEffort = reportedReasoningEffort;
293
+ }
294
+ return;
295
+ }
294
296
  state.reasoningEfforts = reasoningEfforts;
295
- state.reasoningEffort = previousModelId === snapshot.currentModelId && reasoningEfforts.includes(previousReasoningEffort) ? previousReasoningEffort : typeof metadataReasoningEffort === "string" && reasoningEfforts.includes(metadataReasoningEffort) ? metadataReasoningEffort : reasoningEfforts[0];
297
+ state.reasoningEffort = typeof reportedReasoningEffort === "string" && reasoningEfforts.includes(reportedReasoningEffort) ? reportedReasoningEffort : previousModelId === currentModelId && reasoningEfforts.includes(state.reasoningEffort) ? state.reasoningEffort : typeof metadataReasoningEffort === "string" && reasoningEfforts.includes(metadataReasoningEffort) ? metadataReasoningEffort : reasoningEfforts[0];
298
+ }
299
+ applyModelSnapshot(state, snapshot) {
300
+ state.models = snapshot.availableModels;
301
+ this.applyCurrentModel(state, snapshot.currentModelId);
296
302
  }
297
303
  sessionResponseWithState(message, state) {
298
304
  const models = typeof state.currentModelId === "string" && state.models.length > 0 ? {
299
305
  currentModelId: state.currentModelId,
300
306
  availableModels: state.models
301
307
  } : message.result?.models;
308
+ const modelReasoningEfforts = {};
309
+ for (const model of state.models) {
310
+ const efforts = readReasoningEfforts(model);
311
+ if (efforts.length) modelReasoningEfforts[model.modelId] = efforts;
312
+ }
302
313
  return {
303
314
  ...message,
304
315
  result: {
305
316
  ...message.result,
306
317
  ...models ? { models } : {},
318
+ ...Object.keys(modelReasoningEfforts).length > 0 ? {
319
+ _meta: {
320
+ ...message.result?._meta ?? {},
321
+ lody: {
322
+ modelReasoningEfforts
323
+ }
324
+ }
325
+ } : {},
307
326
  configOptions: this.configOptions(state)
308
327
  }
309
328
  };
@@ -420,7 +439,7 @@ class GrokAcpCompatibilityProxy {
420
439
  });
421
440
  }
422
441
  return {
423
- toRuntime: translated2.notification ? [translated2.notification, translated2.message] : [translated2.message],
442
+ toRuntime: [translated2.message],
424
443
  toClient: []
425
444
  };
426
445
  }
@@ -611,7 +630,7 @@ class GrokAcpCompatibilityProxy {
611
630
  }
612
631
  const state = this.sessions.get(pending.sessionId);
613
632
  if (!state) return { toRuntime: [], toClient: [message] };
614
- if (pending.configId === "model") state.currentModelId = pending.value;
633
+ if (pending.configId === "model") this.applyCurrentModel(state, pending.value);
615
634
  if (pending.configId === "reasoning_effort") state.reasoningEffort = pending.value;
616
635
  if (pending.configId === "interaction_mode") state.interactionMode = pending.value;
617
636
  return {
@@ -652,11 +671,24 @@ class GrokAcpCompatibilityProxy {
652
671
  if (logicalMethod === contract.sessionNotification && update?.sessionUpdate === "model_changed") {
653
672
  const modelId = update.model_id ?? update.modelId;
654
673
  const reasoningEffort = update.reasoning_effort ?? update.reasoningEffort;
655
- if (typeof modelId === "string") state.currentModelId = modelId;
656
- if (typeof reasoningEffort === "string") state.reasoningEffort = reasoningEffort;
674
+ if (typeof modelId === "string") {
675
+ this.applyCurrentModel(state, modelId, reasoningEffort);
676
+ }
657
677
  return {
658
678
  toRuntime: [this.internalRequest("context", sessionId)],
659
- toClient: [message]
679
+ toClient: [
680
+ {
681
+ jsonrpc: "2.0",
682
+ method: "session/update",
683
+ params: {
684
+ sessionId,
685
+ update: {
686
+ sessionUpdate: "config_option_update",
687
+ configOptions: this.configOptions(state)
688
+ }
689
+ }
690
+ }
691
+ ]
660
692
  };
661
693
  }
662
694
  return passthrough;