lody 0.91.0 → 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.0";
83
+ const reviewViewerVersion = "0.92.0";
84
84
  const reviewViewerSha256 = "dc9c7fc1dde49bb39c5fe86392d69219b469c0cab4fd492d8b562045e7f676e4";
85
85
  const reviewViewerFileName = "standalone.html";
86
86
  const DEFAULT_CDN_BASES = [
@@ -41,7 +41,7 @@ import { isIPv4, isIPv6 } from "net";
41
41
  import { R as RequestError, a as CreateElicitationResponse, n as ndJsonStream, b as agent$1, m as methods } from "./chunks/acp-DBqkNziA.js";
42
42
  import { L as LODY_EXTENSION_METHODS } from "./chunks/methods-CvEDMahD.js";
43
43
  import { p as packageJson } from "./chunks/package-DlotPnLa.js";
44
- import { s as string, b as boolean, c as array } from "./chunks/schemas-Du3qLZPS.js";
44
+ import { s as string, b as boolean, c as array, o as object, n as number, l as literal } from "./chunks/schemas-Du3qLZPS.js";
45
45
  import { WritableStream, ReadableStream as ReadableStream$1 } from "node:stream/web";
46
46
  (async () => {
47
47
  var One = Object.create;
@@ -68082,6 +68082,16 @@ ${content.text}
68082
68082
  }
68083
68083
  logger.error(`Unexpected case: ${valueAsString}`);
68084
68084
  }
68085
+ const ScopedWeeklyLimitSchema = object({
68086
+ kind: literal("weekly_scoped"),
68087
+ percent: number(),
68088
+ resets_at: string().nullish(),
68089
+ scope: object({
68090
+ model: object({
68091
+ display_name: string().trim().min(1)
68092
+ })
68093
+ })
68094
+ });
68085
68095
  const KEYCHAIN_TIMEOUT_MS = 5e3;
68086
68096
  const KEYCHAIN_BACKOFF_MS = 6e4;
68087
68097
  const defaultDeps = {
@@ -68130,6 +68140,22 @@ ${content.text}
68130
68140
  resetsAtEpochSeconds: sevenDayResetAt
68131
68141
  });
68132
68142
  }
68143
+ if (Array.isArray(apiResponse.limits)) {
68144
+ for (const rawLimit of apiResponse.limits) {
68145
+ const parsed = ScopedWeeklyLimitSchema.safeParse(rawLimit);
68146
+ if (!parsed.success) continue;
68147
+ const limit = parsed.data;
68148
+ const usedPercent = parseUtilization(limit.percent);
68149
+ if (usedPercent === null) continue;
68150
+ const window2 = {
68151
+ label: limit.scope.model.display_name,
68152
+ usedPercent,
68153
+ windowDurationSeconds: 7 * 24 * 60 * 60,
68154
+ resetsAtEpochSeconds: parseDate(limit.resets_at ?? void 0)
68155
+ };
68156
+ windows.push(window2);
68157
+ }
68158
+ }
68133
68159
  const result = {
68134
68160
  rateLimits: [
68135
68161
  {
@@ -72078,7 +72104,8 @@ ${explanation}` : fallbackSummary;
72078
72104
  return {
72079
72105
  sessionId,
72080
72106
  modes,
72081
- configOptions
72107
+ configOptions,
72108
+ ...buildModelCapabilitiesMeta(modelInfos)
72082
72109
  };
72083
72110
  }
72084
72111
  async enqueueProviderUpdate(config) {
@@ -72290,6 +72317,31 @@ ${explanation}` : fallbackSummary;
72290
72317
  function clientSupportsBooleanConfigOptions(clientCapabilities) {
72291
72318
  return clientCapabilities?.session?.configOptions?.boolean != null;
72292
72319
  }
72320
+ function buildModelCapabilitiesMeta(modelInfos) {
72321
+ if (modelInfos.length === 0) {
72322
+ return {};
72323
+ }
72324
+ return {
72325
+ _meta: {
72326
+ lody: {
72327
+ modelCapabilities: {
72328
+ version: 1,
72329
+ models: Object.fromEntries(modelInfos.map((info) => [
72330
+ info.value,
72331
+ {
72332
+ ...info.supportsEffort && info.supportedEffortLevels ? {
72333
+ effortValues: [
72334
+ ...info.supportedEffortLevels
72335
+ ]
72336
+ } : {},
72337
+ fastMode: info.supportsFastMode === true
72338
+ }
72339
+ ]))
72340
+ }
72341
+ }
72342
+ }
72343
+ };
72344
+ }
72293
72345
  function createFastModeConfigOption(enabled, useBooleanOption, disabledReason) {
72294
72346
  const explanation = enabled ? void 0 : disabledReason && FAST_MODE_UNAVAILABLE_EXPLANATIONS[disabledReason];
72295
72347
  const base = {
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;