@infituit/opencode-acp 2.0.0-alpha.6 → 2.0.0-alpha.7

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 CHANGED
@@ -3576,9 +3576,11 @@ function createModelLimitCatalog() {
3576
3576
  async hydrateFromClient(client) {
3577
3577
  try {
3578
3578
  const v2Client = client;
3579
- const models = await v2Client.model.list();
3579
+ const response = await v2Client.model.list();
3580
+ if (!Array.isArray(response.data)) return 0;
3580
3581
  let recorded = 0;
3581
- for (const value of models) {
3582
+ for (const value of response.data) {
3583
+ if (!value || typeof value !== "object") continue;
3582
3584
  const model = value;
3583
3585
  if (typeof model.providerID !== "string" || typeof model.id !== "string" || typeof model.limit?.context !== "number" || model.limit.context <= 0) {
3584
3586
  continue;
@@ -11413,7 +11415,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
11413
11415
  import { join as join5 } from "path";
11414
11416
  import { existsSync as existsSync5 } from "fs";
11415
11417
  import { homedir as homedir3 } from "os";
11416
- var LOG_VERSION = true ? "2.0.0-alpha.6" : "dev";
11418
+ var LOG_VERSION = true ? "2.0.0-alpha.7" : "dev";
11417
11419
  var LEVEL_RANK = {
11418
11420
  debug: 10,
11419
11421
  info: 20,
@@ -14353,13 +14355,6 @@ async function notifySession(ctx, title, message) {
14353
14355
  } catch {
14354
14356
  }
14355
14357
  }
14356
- function asV2Model(model) {
14357
- return {
14358
- id: model.id,
14359
- providerID: model.providerID,
14360
- limit: { context: 0 }
14361
- };
14362
- }
14363
14358
  async function registerTools(ctx, config, registry4, logger, prompts) {
14364
14359
  if (config.compress.permission === "deny") return;
14365
14360
  const factoryCtx = {
@@ -14495,7 +14490,15 @@ var AcpV2Plugin = Plugin.define({
14495
14490
  await transformSystem(
14496
14491
  {
14497
14492
  sessionID: event.sessionID,
14498
- model: asV2Model(event.model)
14493
+ model: {
14494
+ ...event.model,
14495
+ limit: {
14496
+ context: registry4.resolveModelLimit(
14497
+ event.model.providerID,
14498
+ event.model.id
14499
+ ) ?? 0
14500
+ }
14501
+ }
14499
14502
  },
14500
14503
  systemOutput
14501
14504
  );