@open-cr-agent/runtime-opencode 0.5.0 → 0.7.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.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # @open-cr-agent/runtime-opencode
2
2
 
3
- The agent runtime backed by [OpenCode](https://opencode.ai) of [Open-CR-Agent](https://github.com/jma49/Open-CR-Agent), the multi-agent code reviewer. Most users want [`@open-cr-agent/cli`](https://www.npmjs.com/package/@open-cr-agent/cli), which provides the `ocra` command and installs this package; see the [manual](https://ocracloud.com). All `@open-cr-agent` packages are released together at one version. Apache-2.0.
3
+ The [OpenCode](https://opencode.ai) agent runtime of [Open-CR-Agent](https://github.com/jma49/Open-CR-Agent), the multi-agent code reviewer. Most users want [`@open-cr-agent/cli`](https://www.npmjs.com/package/@open-cr-agent/cli) (the `ocra` command) and the [manual](https://ocracloud.com). All packages share one version. Apache-2.0.
package/dist/binary.d.ts CHANGED
@@ -8,4 +8,3 @@ export interface Host {
8
8
  export declare function resolveOpencodeBinary(env: Env, opencodePackage?: string): string;
9
9
  export declare function isNativeExecutable(path: string): boolean;
10
10
  export declare function binaryVariants(host: Host): string[];
11
- //# sourceMappingURL=binary.d.ts.map
package/dist/binary.js CHANGED
@@ -100,4 +100,3 @@ function lacksAvx2(platform) {
100
100
  catch { }
101
101
  return false;
102
102
  }
103
- //# sourceMappingURL=binary.js.map
@@ -0,0 +1,13 @@
1
+ import type { CustomProvider } from "@open-cr-agent/core";
2
+ import type { OpencodeClient } from "@opencode-ai/sdk/v2";
3
+ import { EffortRoutes } from "./effort.js";
4
+ type ConfigApi = Pick<OpencodeClient["config"], "providers">;
5
+ export interface EffortSetup {
6
+ models: readonly string[];
7
+ custom?: Readonly<Record<string, CustomProvider>>;
8
+ probe: ConfigApi;
9
+ workspace: ConfigApi;
10
+ file: string;
11
+ }
12
+ export declare function setUpEfforts(setup: EffortSetup): Promise<EffortRoutes>;
13
+ export {};
@@ -0,0 +1,42 @@
1
+ import { writeFile } from "node:fs/promises";
2
+ import { EffortRoutes } from "./effort.js";
3
+ const CATALOG_TIMEOUT_MS = 30_000;
4
+ // The variants derive thinking budgets from the models' output limits,
5
+ // which only OpenCode's catalog knows, and the catalog is loaded only once
6
+ // OpenCode runs: the variants are written after it started and before the
7
+ // workspace is first used. Any failure leaves effort unsent, with a warning
8
+ // per agent, and never fails the review.
9
+ export async function setUpEfforts(setup) {
10
+ const { models, custom = {} } = setup;
11
+ const everyModel = new Map(models.map((m) => [m, 0]));
12
+ if (new EffortRoutes(models, custom, everyModel).empty)
13
+ return new EffortRoutes([]);
14
+ try {
15
+ const catalog = await catalogModels(setup.probe);
16
+ const routes = new EffortRoutes(models, custom, new Map([...catalog].map(([model, entry]) => [model, entry.outputLimit])));
17
+ if (routes.empty)
18
+ return routes;
19
+ await writeFile(setup.file, JSON.stringify({ provider: routes.providerConfig() }), {
20
+ mode: 0o600,
21
+ });
22
+ const loaded = await catalogModels(setup.workspace);
23
+ routes.keepLoaded(new Map([...loaded].map(([model, entry]) => [model, entry.variants])));
24
+ return routes;
25
+ }
26
+ catch {
27
+ return new EffortRoutes([]);
28
+ }
29
+ }
30
+ async function catalogModels(config) {
31
+ const answer = await config.providers({}, { signal: AbortSignal.timeout(CATALOG_TIMEOUT_MS) });
32
+ const models = new Map();
33
+ for (const provider of answer.data?.providers ?? []) {
34
+ for (const [id, model] of Object.entries(provider.models)) {
35
+ models.set(`${provider.id}/${id}`, {
36
+ outputLimit: model.limit?.output ?? 0,
37
+ variants: new Set(Object.keys(model.variants ?? {})),
38
+ });
39
+ }
40
+ }
41
+ return models;
42
+ }
@@ -0,0 +1,26 @@
1
+ import { type AppliedSettings, type CustomProvider, type Effort, type Sampling } from "@open-cr-agent/core";
2
+ type Options = Record<string, unknown>;
3
+ export declare function effortOptions(model: string, level: Effort, custom?: Readonly<Record<string, CustomProvider>>, outputLimit?: number): Options | undefined;
4
+ export declare class EffortRoutes {
5
+ private readonly routes;
6
+ constructor(models: readonly string[], custom?: Readonly<Record<string, CustomProvider>>, known?: ReadonlyMap<string, number>);
7
+ get empty(): boolean;
8
+ providerConfig(): Record<string, {
9
+ models: Record<string, {
10
+ variants: Options;
11
+ }>;
12
+ }>;
13
+ keepLoaded(loaded: ReadonlyMap<string, ReadonlySet<string>>): void;
14
+ route(model: string, level: Effort): {
15
+ variant?: string;
16
+ } | undefined;
17
+ }
18
+ export declare class AppliedEfforts {
19
+ private readonly applied;
20
+ private readonly sampling;
21
+ constructor(sampling?: Sampling);
22
+ record(agent: string, effort: Effort, model: string, sent: boolean): boolean;
23
+ appliedTo(agent: string): AppliedSettings | undefined;
24
+ private requested;
25
+ }
26
+ export {};
package/dist/effort.js ADDED
@@ -0,0 +1,148 @@
1
+ import { EFFORT_LEVELS, effortCapability, parseModel, thinkingBudget, } from "@open-cr-agent/core";
2
+ const GOOGLE_PROVIDERS = new Set(["google", "google-vertex"]);
3
+ // OpenCode merges a configured variant over a built-in one of the same name
4
+ // (1.18.32 has "high" and "max" for most models), so ocra's carry a prefix.
5
+ function effortVariant(level) {
6
+ return `ocra-${level}`;
7
+ }
8
+ // The provider options that carry a level to one model through OpenCode, in
9
+ // the option names of the provider's AI SDK package; {} when the level means
10
+ // sending nothing (no thinking for Anthropic), undefined when ocra knows no
11
+ // way to send it. A provider declared in configuration takes a level the
12
+ // way it says (`effort`), for any model the table does not rule out, as on
13
+ // the direct runtime.
14
+ export function effortOptions(model, level, custom = {}, outputLimit) {
15
+ const { providerID } = parseModel(model);
16
+ const capability = effortCapability(model);
17
+ if (capability && !capability.levels.includes(level))
18
+ return undefined;
19
+ const declared = custom[providerID];
20
+ if (declared) {
21
+ return declared.effort === "openrouter"
22
+ ? { reasoning: { effort: level } }
23
+ : { reasoningEffort: level };
24
+ }
25
+ if (!capability)
26
+ return undefined;
27
+ if (providerID === "openrouter")
28
+ return { reasoning: { effort: level } };
29
+ const google = GOOGLE_PROVIDERS.has(providerID);
30
+ switch (capability.parameter) {
31
+ case "reasoningEffort":
32
+ return providerID === "openai" ? { reasoningEffort: level } : undefined;
33
+ case "thinkingLevel":
34
+ return google ? { thinkingConfig: { thinkingLevel: level } } : undefined;
35
+ case "thinkingBudget": {
36
+ const budget = thinkingBudget(capability, level, outputLimit);
37
+ if (budget === undefined)
38
+ return undefined;
39
+ if (providerID === "anthropic") {
40
+ return budget === 0 ? {} : { thinking: { type: "enabled", budgetTokens: budget } };
41
+ }
42
+ // OpenCode asks Gemini for thoughts, which Gemini refuses with
43
+ // thinking off.
44
+ if (google) {
45
+ return {
46
+ thinkingConfig: budget === 0
47
+ ? { thinkingBudget: 0, includeThoughts: false }
48
+ : { thinkingBudget: budget },
49
+ };
50
+ }
51
+ return undefined;
52
+ }
53
+ }
54
+ }
55
+ // What each model can take, as OpenCode variants: one per (model, level)
56
+ // that sends something, so two agents on one model at different levels get
57
+ // different options. Only models OpenCode's catalog (or the configuration)
58
+ // knows get any, since declaring an unknown model would make OpenCode
59
+ // accept it at a price of 0.
60
+ export class EffortRoutes {
61
+ routes = new Map();
62
+ constructor(models, custom = {},
63
+ // Output limits by model, from OpenCode's catalog; 0 when it has none.
64
+ known = new Map()) {
65
+ for (const model of new Set(models)) {
66
+ if (!known.has(model))
67
+ continue;
68
+ const levels = new Map();
69
+ for (const level of EFFORT_LEVELS) {
70
+ const options = effortOptions(model, level, custom, known.get(model));
71
+ if (options)
72
+ levels.set(level, options);
73
+ }
74
+ if (levels.size > 0)
75
+ this.routes.set(model, levels);
76
+ }
77
+ }
78
+ get empty() {
79
+ return this.routes.size === 0;
80
+ }
81
+ // The `provider` section that declares the variants.
82
+ providerConfig() {
83
+ const config = {};
84
+ for (const [model, levels] of this.routes) {
85
+ const { providerID, modelID } = parseModel(model);
86
+ const variants = Object.fromEntries([...levels]
87
+ .filter(([, options]) => Object.keys(options).length > 0)
88
+ .map(([level, options]) => [effortVariant(level), options]));
89
+ if (Object.keys(variants).length === 0)
90
+ continue;
91
+ config[providerID] ??= { models: {} };
92
+ config[providerID].models[modelID] = { variants };
93
+ }
94
+ return config;
95
+ }
96
+ // Keeps the levels whose variant OpenCode loaded, so a level is never
97
+ // recorded as sent when OpenCode would have ignored its variant.
98
+ keepLoaded(loaded) {
99
+ for (const [model, levels] of this.routes) {
100
+ for (const [level, options] of levels) {
101
+ const needsVariant = Object.keys(options).length > 0;
102
+ if (needsVariant && !loaded.get(model)?.has(effortVariant(level)))
103
+ levels.delete(level);
104
+ }
105
+ }
106
+ }
107
+ // Undefined: the level cannot be sent to the model. No variant: the level
108
+ // is sent by sending nothing.
109
+ route(model, level) {
110
+ const options = this.routes.get(model)?.get(level);
111
+ if (!options)
112
+ return undefined;
113
+ return Object.keys(options).length > 0 ? { variant: effortVariant(level) } : {};
114
+ }
115
+ }
116
+ // What the run applied per agent (ADR-0025), as the direct runtime records
117
+ // it: a call that asks for an effort other than "none" goes without the
118
+ // configured sampling, even when its level could not be sent, so an
119
+ // agent's calls stay alike within a run.
120
+ export class AppliedEfforts {
121
+ applied = new Map();
122
+ sampling;
123
+ constructor(sampling = {}) {
124
+ this.sampling = sampling;
125
+ }
126
+ // Whether the call keeps the configured sampling.
127
+ record(agent, effort, model, sent) {
128
+ const keepsSampling = effort === "none";
129
+ const before = this.applied.get(agent);
130
+ const notApplied = [
131
+ ...new Set([...(before?.notApplied ?? []), ...(keepsSampling ? [] : this.requested())]),
132
+ ];
133
+ const unsupported = [...new Set([...(before?.unsupported ?? []), ...(sent ? [] : [model])])];
134
+ this.applied.set(agent, {
135
+ effort: (before?.effort ?? true) && sent,
136
+ ...(unsupported.length > 0 ? { unsupported } : {}),
137
+ ...(notApplied.length > 0 ? { notApplied } : {}),
138
+ });
139
+ return keepsSampling;
140
+ }
141
+ appliedTo(agent) {
142
+ const applied = this.applied.get(agent);
143
+ return applied && structuredClone(applied);
144
+ }
145
+ requested() {
146
+ return ["temperature", "seed"].filter((key) => this.sampling[key] !== undefined);
147
+ }
148
+ }
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export { opencodeRuntimePlugin } from "./plugin.js";
2
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
1
  export { opencodeRuntimePlugin } from "./plugin.js";
2
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,100 @@
1
+ import { type AppliedSampling, type CustomProvider, type Sampling } from "@open-cr-agent/core";
2
+ import type { ToolServer } from "./tool-server.js";
3
+ export declare const MCP_SERVER = "ocra";
4
+ export declare const REVIEW_AGENT = "ocra-reviewer";
5
+ export declare const HELPER_AGENT = "ocra-helper";
6
+ export declare const WITHOUT_SAMPLING = "-effort";
7
+ export declare const HELPER_AGENT_STEPS = 2;
8
+ export declare const OPENCODE_BUILTIN_TOOLS: readonly ["invalid", "question", "bash", "read", "glob", "grep", "edit", "write", "task", "webfetch", "todowrite", "websearch", "skill", "apply_patch"];
9
+ export declare const DISABLED_BUILTINS: {
10
+ [k: string]: boolean;
11
+ };
12
+ export declare function openCodeSampling(sampling?: Sampling): AppliedSampling;
13
+ export declare function openCodeConfig(tools: Pick<ToolServer, "url" | "headers">, helperTools: Record<string, boolean>, custom?: Readonly<Record<string, CustomProvider>>, sampling?: Sampling): {
14
+ share: string;
15
+ autoupdate: boolean;
16
+ provider?: {
17
+ [k: string]: {
18
+ npm: string;
19
+ name: string;
20
+ options: {
21
+ baseURL: string;
22
+ apiKey?: string;
23
+ };
24
+ models: {
25
+ [k: string]: {
26
+ name: string;
27
+ temperature?: boolean;
28
+ cost: {
29
+ input: number;
30
+ output: number;
31
+ cache_read?: number;
32
+ };
33
+ };
34
+ };
35
+ };
36
+ };
37
+ mcp: {
38
+ ocra: {
39
+ type: string;
40
+ url: string;
41
+ headers: Record<string, string>;
42
+ oauth: boolean;
43
+ enabled: boolean;
44
+ };
45
+ };
46
+ agent: {
47
+ [k: string]: {
48
+ mode: string;
49
+ prompt: string;
50
+ steps: number;
51
+ tools: {
52
+ [k: string]: boolean;
53
+ };
54
+ permission: {
55
+ edit: string;
56
+ bash: string;
57
+ webfetch: string;
58
+ skill: string;
59
+ };
60
+ } | {
61
+ mode: string;
62
+ prompt: string;
63
+ steps: number;
64
+ tools: Record<string, boolean>;
65
+ permission: {
66
+ edit: string;
67
+ bash: string;
68
+ webfetch: string;
69
+ skill: string;
70
+ };
71
+ };
72
+ } | {
73
+ "ocra-reviewer": {
74
+ mode: string;
75
+ prompt: string;
76
+ steps: number;
77
+ tools: {
78
+ [k: string]: boolean;
79
+ };
80
+ permission: {
81
+ edit: string;
82
+ bash: string;
83
+ webfetch: string;
84
+ skill: string;
85
+ };
86
+ };
87
+ "ocra-helper": {
88
+ mode: string;
89
+ prompt: string;
90
+ steps: number;
91
+ tools: Record<string, boolean>;
92
+ permission: {
93
+ edit: string;
94
+ bash: string;
95
+ webfetch: string;
96
+ skill: string;
97
+ };
98
+ };
99
+ };
100
+ };
@@ -0,0 +1,136 @@
1
+ import { MAX_AGENT_STEPS, OcraError, } from "@open-cr-agent/core";
2
+ export const MCP_SERVER = "ocra";
3
+ export const REVIEW_AGENT = "ocra-reviewer";
4
+ export const HELPER_AGENT = "ocra-helper";
5
+ // The same agents without the configured temperature, for calls that send
6
+ // an effort (ADR-0025): OpenCode sets sampling per agent.
7
+ export const WITHOUT_SAMPLING = "-effort";
8
+ // Must not be empty: OpenCode falls back to its full coding prompt otherwise.
9
+ const REVIEW_AGENT_PROMPT = "You are a code review agent run by ocra. Follow the review instructions below.";
10
+ const HELPER_AGENT_PROMPT = "You answer exactly as the instructions below ask, with no tools.";
11
+ // The helper answers in one step and has no tools. It still needs two:
12
+ // OpenCode appends an assistant message on an agent's last allowed step, and
13
+ // Gemini rejects a request that ends with a model turn (#66).
14
+ export const HELPER_AGENT_STEPS = 2;
15
+ // Every OpenCode built-in tool of the pinned version; a test fails when an
16
+ // upgrade adds one, so a new write-capable tool can never be enabled silently.
17
+ export const OPENCODE_BUILTIN_TOOLS = [
18
+ "invalid",
19
+ "question",
20
+ "bash",
21
+ "read",
22
+ "glob",
23
+ "grep",
24
+ "edit",
25
+ "write",
26
+ "task",
27
+ "webfetch",
28
+ "todowrite",
29
+ "websearch",
30
+ "skill",
31
+ "apply_patch",
32
+ ];
33
+ export const DISABLED_BUILTINS = Object.fromEntries(OPENCODE_BUILTIN_TOOLS.map((t) => [t, false]));
34
+ // OpenCode 1.18.32 takes a temperature per agent and sends it when the
35
+ // model's catalog entry says the model accepts one; a model declared in
36
+ // configuration is marked so (providerConfig). It has no seed setting: the
37
+ // request it builds carries temperature, topP, topK and the output limit only.
38
+ export function openCodeSampling(sampling = {}) {
39
+ return {
40
+ ...(sampling.temperature === undefined ? {} : { temperature: sampling.temperature }),
41
+ ...(sampling.seed === undefined ? {} : { notApplied: ["seed"] }),
42
+ };
43
+ }
44
+ export function openCodeConfig(tools, helperTools, custom = {}, sampling = {}) {
45
+ const permission = { edit: "deny", bash: "deny", webfetch: "deny", skill: "deny" };
46
+ const { temperature } = sampling;
47
+ const agents = {
48
+ [REVIEW_AGENT]: {
49
+ mode: "primary",
50
+ prompt: REVIEW_AGENT_PROMPT,
51
+ steps: MAX_AGENT_STEPS,
52
+ tools: DISABLED_BUILTINS,
53
+ permission,
54
+ },
55
+ [HELPER_AGENT]: {
56
+ mode: "primary",
57
+ prompt: HELPER_AGENT_PROMPT,
58
+ steps: HELPER_AGENT_STEPS,
59
+ tools: helperTools,
60
+ permission,
61
+ },
62
+ };
63
+ return {
64
+ share: "disabled",
65
+ autoupdate: false,
66
+ ...(Object.keys(custom).length > 0
67
+ ? { provider: providerConfig(custom, temperature !== undefined) }
68
+ : {}),
69
+ mcp: {
70
+ [MCP_SERVER]: {
71
+ type: "remote",
72
+ url: tools.url,
73
+ headers: tools.headers,
74
+ oauth: false,
75
+ enabled: true,
76
+ },
77
+ },
78
+ agent: temperature === undefined
79
+ ? agents
80
+ : Object.fromEntries(Object.entries(agents).flatMap(([name, agent]) => [
81
+ [name, { ...agent, temperature }],
82
+ [`${name}${WITHOUT_SAMPLING}`, agent],
83
+ ])),
84
+ };
85
+ }
86
+ // OpenCode's form of a provider declared in configuration. OpenCode bundles
87
+ // the OpenAI-compatible client, so nothing is installed to reach it
88
+ // (docs/spikes/0002). The key stays in the environment: OpenCode reads
89
+ // {env:NAME} itself, and the configuration, which OpenCode may log, never
90
+ // holds it. Prices are per million tokens, as OpenCode's catalog has them.
91
+ // OpenCode assumes a declared model takes no temperature and drops one;
92
+ // with a temperature configured, the models are marked as taking it.
93
+ function providerConfig(custom, temperature) {
94
+ for (const [id, provider] of Object.entries(custom))
95
+ checkProvider(id, provider);
96
+ return Object.fromEntries(Object.entries(custom).map(([id, provider]) => [
97
+ id,
98
+ {
99
+ npm: "@ai-sdk/openai-compatible",
100
+ name: id,
101
+ options: {
102
+ baseURL: provider.baseUrl,
103
+ ...(provider.apiKeyEnv ? { apiKey: `{env:${provider.apiKeyEnv}}` } : {}),
104
+ },
105
+ models: Object.fromEntries(Object.entries(provider.models).map(([model, price]) => [
106
+ model,
107
+ {
108
+ name: model,
109
+ ...(temperature ? { temperature: true } : {}),
110
+ cost: {
111
+ input: price.input,
112
+ output: price.output,
113
+ ...(price.cachedInput === undefined ? {} : { cache_read: price.cachedInput }),
114
+ },
115
+ },
116
+ ])),
117
+ },
118
+ ]));
119
+ }
120
+ // Checked here once, whatever declared the provider: a configuration file,
121
+ // ocra Cloud or another caller of this package.
122
+ function checkProvider(id, provider) {
123
+ const fields = [
124
+ ["id", id],
125
+ ["baseUrl", provider.baseUrl],
126
+ ...Object.keys(provider.models).map((model) => ["model", model]),
127
+ ];
128
+ for (const [field, value] of fields) {
129
+ if (/[{}]/.test(value)) {
130
+ throw new OcraError("CONFIG_INVALID", `Provider "${id}": ${field} must not contain { or }`);
131
+ }
132
+ }
133
+ if (provider.apiKeyEnv !== undefined && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(provider.apiKeyEnv)) {
134
+ throw new OcraError("CONFIG_INVALID", `Provider "${id}": apiKeyEnv must be an environment variable name`);
135
+ }
136
+ }
@@ -12,4 +12,3 @@ export interface StartOptions {
12
12
  startupTimeoutMs?: number;
13
13
  }
14
14
  export declare function startOpencodeServer(options: StartOptions): Promise<OpencodeServer>;
15
- //# sourceMappingURL=opencode-server.d.ts.map
@@ -83,4 +83,3 @@ function freePort() {
83
83
  });
84
84
  });
85
85
  }
86
- //# sourceMappingURL=opencode-server.js.map
package/dist/plugin.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  import type { OcraPlugin } from "@open-cr-agent/core";
2
2
  export declare const opencodeRuntimePlugin: OcraPlugin;
3
- //# sourceMappingURL=plugin.d.ts.map
package/dist/plugin.js CHANGED
@@ -5,4 +5,3 @@ export const opencodeRuntimePlugin = {
5
5
  ctx.registerRuntime("opencode", (options) => new OpenCodeRuntime(options));
6
6
  },
7
7
  };
8
- //# sourceMappingURL=plugin.js.map
package/dist/runtime.d.ts CHANGED
@@ -1,122 +1,27 @@
1
- import { type AgentEvent, type AgentRuntime, type AgentTaskSpec, type AppliedSampling, type CompletionRequest, type CompletionResult, type CustomProvider, type RuntimeOptions, type Sampling } from "@open-cr-agent/core";
2
- import { type ToolServer } from "./tool-server.js";
3
- export declare const MCP_SERVER = "ocra";
4
- export declare const HELPER_AGENT_STEPS = 2;
5
- export declare const REVIEW_RESUME: {
6
- doneTool: "task_done";
7
- maxSteps: number;
8
- message: string;
9
- };
10
- export declare const OPENCODE_BUILTIN_TOOLS: readonly ["invalid", "question", "bash", "read", "glob", "grep", "edit", "write", "task", "webfetch", "todowrite", "websearch", "skill", "apply_patch"];
1
+ import { type AgentEvent, type AgentRuntime, type AgentTaskSpec, type AppliedSampling, type AppliedSettings, type CompletionRequest, type CompletionResult, type RuntimeOptions } from "@open-cr-agent/core";
11
2
  export interface OpenCodeRuntimeOptions extends RuntimeOptions {
12
3
  binary?: string;
13
4
  }
14
5
  export declare class OpenCodeRuntime implements AgentRuntime {
15
- private readonly options;
16
6
  readonly name = "opencode";
17
7
  readonly sampling: AppliedSampling;
18
8
  private infra;
19
9
  private context;
20
- private readonly health;
10
+ private readonly chains;
21
11
  private readonly helperTools;
12
+ private readonly applied;
13
+ private readonly options;
22
14
  constructor(options: OpenCodeRuntimeOptions);
15
+ appliedTo(agent: string): AppliedSettings | undefined;
23
16
  runTask(spec: AgentTaskSpec, signal: AbortSignal): AsyncIterable<AgentEvent>;
24
17
  complete(request: CompletionRequest, signal: AbortSignal): Promise<CompletionResult>;
25
18
  dispose(): Promise<void>;
19
+ private attemptTask;
20
+ private attemptCompletion;
21
+ private effortCall;
26
22
  private prompt;
27
23
  private unprepared;
28
24
  private start;
29
25
  private launch;
30
26
  }
31
- export declare function openCodeConfig(tools: Pick<ToolServer, "url" | "headers">, helperTools: Record<string, boolean>, custom?: Readonly<Record<string, CustomProvider>>, sampling?: Sampling): {
32
- share: string;
33
- autoupdate: boolean;
34
- provider?: {
35
- [k: string]: {
36
- npm: string;
37
- name: string;
38
- options: {
39
- baseURL: string;
40
- apiKey?: string;
41
- };
42
- models: {
43
- [k: string]: {
44
- name: string;
45
- temperature?: boolean;
46
- cost: {
47
- input: number;
48
- output: number;
49
- cache_read?: number;
50
- };
51
- };
52
- };
53
- };
54
- };
55
- mcp: {
56
- ocra: {
57
- type: string;
58
- url: string;
59
- headers: Record<string, string>;
60
- oauth: boolean;
61
- enabled: boolean;
62
- };
63
- };
64
- agent: {
65
- "ocra-reviewer": {
66
- temperature?: never;
67
- mode: string;
68
- prompt: string;
69
- steps: number;
70
- tools: {
71
- [k: string]: boolean;
72
- };
73
- permission: {
74
- edit: string;
75
- bash: string;
76
- webfetch: string;
77
- skill: string;
78
- };
79
- } | {
80
- temperature: number;
81
- mode: string;
82
- prompt: string;
83
- steps: number;
84
- tools: {
85
- [k: string]: boolean;
86
- };
87
- permission: {
88
- edit: string;
89
- bash: string;
90
- webfetch: string;
91
- skill: string;
92
- };
93
- };
94
- "ocra-helper": {
95
- temperature?: never;
96
- mode: string;
97
- prompt: string;
98
- steps: number;
99
- tools: Record<string, boolean>;
100
- permission: {
101
- edit: string;
102
- bash: string;
103
- webfetch: string;
104
- skill: string;
105
- };
106
- } | {
107
- temperature: number;
108
- mode: string;
109
- prompt: string;
110
- steps: number;
111
- tools: Record<string, boolean>;
112
- permission: {
113
- edit: string;
114
- bash: string;
115
- webfetch: string;
116
- skill: string;
117
- };
118
- };
119
- };
120
- };
121
27
  export declare function providersOf(options: Pick<RuntimeOptions, "models" | "agentModels">): string[];
122
- //# sourceMappingURL=runtime.d.ts.map