cursor-route 0.1.9 → 0.1.10

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/src/jobs.ts CHANGED
@@ -17,6 +17,7 @@ import {
17
17
  sessionName,
18
18
  defaultDsModelFromEnv,
19
19
  DS_MODEL_IDS,
20
+ openCodeModel,
20
21
  type Lane,
21
22
  type WorkerKind,
22
23
  type DsModelAlias,
@@ -37,8 +38,8 @@ export interface Job {
37
38
  status: JobStatus;
38
39
  worker: WorkerKind;
39
40
  lane?: Lane;
40
- /** Mid-lane DeepSeek model alias (flash|pro). Set for claude-ds and deepseek. */
41
- model?: DsModelAlias;
41
+ /** Worker model: flash|pro for claude-ds/deepseek; provider/model for opencode. */
42
+ model?: string;
42
43
  prompt: string;
43
44
  cwd: string;
44
45
  alwaysApprove: boolean;
@@ -111,7 +112,7 @@ export interface JobEvidence {
111
112
  jobId: string;
112
113
  worker: WorkerKind;
113
114
  lane: Lane | null;
114
- model: DsModelAlias | null;
115
+ model: string | null;
115
116
  startedAt: string;
116
117
  };
117
118
  execute: {
@@ -282,7 +283,7 @@ export interface StartOptions {
282
283
  lane?: Lane;
283
284
  /** Mid-lane DeepSeek: flash (default) | pro (claude-ds + deepseek). Ignored by grok/openrouter. */
284
285
  model?: DsModelAlias;
285
- /** Concrete DeepSeek id (preserves pro[1m]). Derived from --model / env when unset. */
286
+ /** Concrete DeepSeek id (preserves pro[1m]) or OpenCode provider/model. Derived from --model / env when unset. */
286
287
  modelId?: string;
287
288
  cwd?: string;
288
289
  alwaysApprove?: boolean;
@@ -331,15 +332,18 @@ export function startJob(opts: StartOptions): {
331
332
  const paths = jobPaths(id);
332
333
  writeSecure(paths.prompt, opts.prompt);
333
334
 
334
- let model: DsModelAlias | undefined;
335
+ let model: string | undefined;
335
336
  let modelId: string | undefined;
337
+ let dsAlias: DsModelAlias | undefined;
336
338
  if (worker === "claude-ds" || worker === "deepseek") {
337
339
  if (opts.model) {
340
+ dsAlias = opts.model;
338
341
  model = opts.model;
339
342
  modelId = opts.modelId ?? DS_MODEL_IDS[opts.model];
340
343
  } else {
341
344
  try {
342
345
  const choice = defaultDsModelFromEnv();
346
+ dsAlias = choice.alias;
343
347
  model = choice.alias;
344
348
  modelId = opts.modelId ?? choice.id;
345
349
  } catch (e) {
@@ -351,6 +355,19 @@ export function startJob(opts: StartOptions): {
351
355
  return { ok: false, error: (e as Error).message };
352
356
  }
353
357
  }
358
+ } else if (worker === "opencode") {
359
+ try {
360
+ const ocModel = openCodeModel(opts.modelId);
361
+ model = ocModel;
362
+ modelId = ocModel;
363
+ } catch (e) {
364
+ try {
365
+ unlinkSync(paths.prompt);
366
+ } catch {
367
+ /* ignore */
368
+ }
369
+ return { ok: false, error: (e as Error).message };
370
+ }
354
371
  }
355
372
 
356
373
  let plan;
@@ -359,7 +376,7 @@ export function startJob(opts: StartOptions): {
359
376
  promptFile: paths.prompt,
360
377
  cwd,
361
378
  alwaysApprove,
362
- model,
379
+ model: dsAlias,
363
380
  modelId,
364
381
  dryRun: Boolean(opts.dryRun),
365
382
  });