@evident-ai/cli 3.4.1-dev.11f0c53 → 3.4.1-dev.1549524

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
@@ -2208,7 +2208,6 @@ async function createOpenCodeSession(port, directory) {
2208
2208
  return data.id;
2209
2209
  }
2210
2210
  async function getModelAttachmentCapability(port, model) {
2211
- const { model: baseModel } = splitModelVariant(model);
2212
2211
  try {
2213
2212
  const res = await timedFetch(`${opencodeBase(port)}/config/providers`);
2214
2213
  if (!res.ok) {
@@ -2225,9 +2224,9 @@ async function getModelAttachmentCapability(port, model) {
2225
2224
  );
2226
2225
  return null;
2227
2226
  }
2228
- const slash = baseModel ? baseModel.indexOf("/") : -1;
2229
- const providerId = slash > 0 ? baseModel.slice(0, slash) : void 0;
2230
- let modelId = slash > 0 ? baseModel.slice(slash + 1) : void 0;
2227
+ const slash = model ? model.indexOf("/") : -1;
2228
+ const providerId = slash > 0 ? model.slice(0, slash) : void 0;
2229
+ let modelId = slash > 0 ? model.slice(slash + 1) : void 0;
2231
2230
  const defaults2 = body?.default && typeof body.default === "object" ? body.default : void 0;
2232
2231
  let provider = providerId ? providers.find((p) => p?.id === providerId) : void 0;
2233
2232
  if (!provider && !providerId) {
@@ -2307,29 +2306,6 @@ async function buildFileParts(attachments, capable) {
2307
2306
  }
2308
2307
  return { parts, outcomes, capabilityUnknown };
2309
2308
  }
2310
- function splitModelVariant(raw) {
2311
- const value = raw?.trim();
2312
- if (!value) return {};
2313
- const hashIndex = value.indexOf("#");
2314
- if (hashIndex === -1) return { model: value };
2315
- const model = value.slice(0, hashIndex).trim() || void 0;
2316
- const variant = value.slice(hashIndex + 1).trim() || void 0;
2317
- return { model, variant };
2318
- }
2319
- function applyModelOptions(body, options) {
2320
- if (options?.agent) body.agent = options.agent;
2321
- const { model, variant } = splitModelVariant(options?.model);
2322
- if (model) {
2323
- const slashIndex = model.indexOf("/");
2324
- if (slashIndex !== -1) {
2325
- body.model = {
2326
- providerID: model.substring(0, slashIndex),
2327
- modelID: model.substring(slashIndex + 1)
2328
- };
2329
- }
2330
- }
2331
- if (variant) body.variant = variant;
2332
- }
2333
2309
  function messageText(m) {
2334
2310
  if (!m || !Array.isArray(m.parts)) return "";
2335
2311
  return m.parts.filter((p) => p.type === "text" && typeof p.text === "string").map((p) => p.text).join("");
@@ -2354,7 +2330,18 @@ async function sendPromptAsync(port, sessionId, content, options, attachments) {
2354
2330
  const body = {
2355
2331
  parts
2356
2332
  };
2357
- applyModelOptions(body, options);
2333
+ if (options?.agent) {
2334
+ body.agent = options.agent;
2335
+ }
2336
+ if (options?.model) {
2337
+ const slashIndex = options.model.indexOf("/");
2338
+ if (slashIndex !== -1) {
2339
+ body.model = {
2340
+ providerID: options.model.substring(0, slashIndex),
2341
+ modelID: options.model.substring(slashIndex + 1)
2342
+ };
2343
+ }
2344
+ }
2358
2345
  const res = await timedFetch(`${opencodeBase(port)}/session/${sessionId}/prompt_async`, {
2359
2346
  method: "POST",
2360
2347
  headers: { "Content-Type": "application/json" },
@@ -2362,10 +2349,7 @@ async function sendPromptAsync(port, sessionId, content, options, attachments) {
2362
2349
  });
2363
2350
  if (res.status < 200 || res.status >= 300) {
2364
2351
  const text = await res.text().catch(() => "");
2365
- const { variant } = splitModelVariant(options?.model);
2366
- throw new Error(
2367
- `OpenCode prompt_async failed: HTTP ${res.status}${text ? `: ${text}` : ""}${variant ? ` (variant: ${variant})` : ""}`
2368
- );
2352
+ throw new Error(`OpenCode prompt_async failed: HTTP ${res.status}${text ? `: ${text}` : ""}`);
2369
2353
  }
2370
2354
  const READ_BACK_ATTEMPTS = 5;
2371
2355
  const READ_BACK_DELAY_MS = 150;