@open-cr-agent/runtime-direct 0.4.0 → 0.5.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.
Files changed (2) hide show
  1. package/dist/runtime.js +5 -3
  2. package/package.json +2 -2
package/dist/runtime.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { OcraError, } from "@open-cr-agent/core";
2
- import { completeWithFailback, MAX_AGENT_STEPS, ModelHealth, parseModel, proxiedFetch, RESUME_MESSAGE, reviewTools, withFailback, } from "@open-cr-agent/core/internal";
2
+ import { callChain, completeWithFailback, MAX_AGENT_STEPS, ModelHealth, parseModel, proxiedFetch, RESUME_MESSAGE, reviewTools, withFailback, } from "@open-cr-agent/core/internal";
3
3
  import { EffortLedger } from "./effort.js";
4
4
  import { runLoop } from "./loop.js";
5
5
  // Talks to the declared OpenAI-compatible endpoints itself: no OpenCode
@@ -30,7 +30,7 @@ export class DirectRuntime {
30
30
  return this.efforts.appliedTo(agent);
31
31
  }
32
32
  async *runTask(spec, signal) {
33
- const chain = this.options.models[spec.modelTier] ?? [];
33
+ const chain = callChain(this.options.models, spec.modelTier, spec.models);
34
34
  const refused = chain.length === 0 ? noModel(spec.modelTier) : this.unreachable(chain);
35
35
  if (refused) {
36
36
  yield { type: "error", taskId: spec.taskId, error: refused.message, retryable: false };
@@ -39,6 +39,7 @@ export class DirectRuntime {
39
39
  yield* withFailback({
40
40
  taskId: spec.taskId,
41
41
  tier: spec.modelTier,
42
+ ...(spec.models?.length ? { agent: spec.reviewer } : {}),
42
43
  chain,
43
44
  health: this.health,
44
45
  signal,
@@ -58,12 +59,13 @@ export class DirectRuntime {
58
59
  });
59
60
  }
60
61
  async complete(request, signal) {
61
- const chain = this.options.models[request.tier] ?? [];
62
+ const chain = callChain(this.options.models, request.tier, request.models);
62
63
  const refused = chain.length === 0 ? noModel(request.tier) : this.unreachable(chain);
63
64
  if (refused)
64
65
  throw refused;
65
66
  return completeWithFailback({
66
67
  tier: request.tier,
68
+ ...(request.models?.length ? { agent: request.agent ?? request.tier } : {}),
67
69
  chain,
68
70
  health: this.health,
69
71
  signal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-cr-agent/runtime-direct",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Agent runtime for Open-CR-Agent that calls OpenAI-compatible endpoints directly",
5
5
  "keywords": [
6
6
  "code-review",
@@ -33,7 +33,7 @@
33
33
  "!dist/**/*.map"
34
34
  ],
35
35
  "dependencies": {
36
- "@open-cr-agent/core": "0.4.0",
36
+ "@open-cr-agent/core": "0.5.0",
37
37
  "zod": "^4.6.5"
38
38
  },
39
39
  "publishConfig": {