@dudousxd/nestjs-agent-opencode 0.5.0 → 1.0.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 +1 -1
- package/dist/durable/index.cjs +61 -59
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.js +2 -0
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +59 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -89,6 +89,7 @@ function keyValueOpenCodeSessionStore(kv, prefix = "aviary:opencode:session:") {
|
|
|
89
89
|
__name(keyValueOpenCodeSessionStore, "keyValueOpenCodeSessionStore");
|
|
90
90
|
|
|
91
91
|
// src/mcp.controller.ts
|
|
92
|
+
var import_nestjs_agent_core = require("@dudousxd/nestjs-agent-core");
|
|
92
93
|
var import_common = require("@nestjs/common");
|
|
93
94
|
|
|
94
95
|
// src/tokens.ts
|
|
@@ -185,6 +186,7 @@ _ts_decorate([
|
|
|
185
186
|
_ts_metadata("design:returntype", void 0)
|
|
186
187
|
], OpenCodeMcpController.prototype, "delete", null);
|
|
187
188
|
OpenCodeMcpController = _ts_decorate([
|
|
189
|
+
(0, import_nestjs_agent_core.CanAnyone)(),
|
|
188
190
|
(0, import_common.Controller)("opencode/mcp"),
|
|
189
191
|
_ts_param(0, (0, import_common.Inject)(OPENCODE_MCP_ENDPOINT)),
|
|
190
192
|
_ts_metadata("design:type", Function),
|
|
@@ -195,7 +197,7 @@ OpenCodeMcpController = _ts_decorate([
|
|
|
195
197
|
|
|
196
198
|
// src/mcp.ts
|
|
197
199
|
var import_node_crypto = require("crypto");
|
|
198
|
-
var
|
|
200
|
+
var import_nestjs_agent_core4 = require("@dudousxd/nestjs-agent-core");
|
|
199
201
|
var import_genui = require("@dudousxd/nestjs-agent-core/genui");
|
|
200
202
|
var import_server = require("@modelcontextprotocol/sdk/server/index.js");
|
|
201
203
|
var import_streamableHttp = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
@@ -203,11 +205,11 @@ var import_zod_json_schema_compat = require("@modelcontextprotocol/sdk/server/zo
|
|
|
203
205
|
var import_types = require("@modelcontextprotocol/sdk/types.js");
|
|
204
206
|
|
|
205
207
|
// src/turn.ts
|
|
206
|
-
var
|
|
208
|
+
var import_nestjs_agent_core3 = require("@dudousxd/nestjs-agent-core");
|
|
207
209
|
var import_common2 = require("@nestjs/common");
|
|
208
210
|
|
|
209
211
|
// src/forms.ts
|
|
210
|
-
var
|
|
212
|
+
var import_nestjs_agent_core2 = require("@dudousxd/nestjs-agent-core");
|
|
211
213
|
function toQuestion(field) {
|
|
212
214
|
const required = field.required === true ? {
|
|
213
215
|
required: true
|
|
@@ -277,7 +279,7 @@ function toFormAnswer(form, answers = {}) {
|
|
|
277
279
|
for (const field of formFields(form)) {
|
|
278
280
|
const question = toQuestion(field);
|
|
279
281
|
const values = answers[field.key] ?? question.defaults ?? [];
|
|
280
|
-
const problem = (0,
|
|
282
|
+
const problem = (0, import_nestjs_agent_core2.validateElicitationAnswer)(question, values);
|
|
281
283
|
if (problem) throw new FormAnswerError(`answers["${field.key}"] ${problem}`);
|
|
282
284
|
const present = values.filter((v) => v !== "");
|
|
283
285
|
const [value] = present;
|
|
@@ -589,7 +591,7 @@ var OpenCodeTurn = class {
|
|
|
589
591
|
});
|
|
590
592
|
}
|
|
591
593
|
async write(event) {
|
|
592
|
-
await this.a.writer.write((0,
|
|
594
|
+
await this.a.writer.write((0, import_nestjs_agent_core3.encodeStreamEvent)(event));
|
|
593
595
|
}
|
|
594
596
|
async step() {
|
|
595
597
|
if (this.stepOpen) return;
|
|
@@ -1123,7 +1125,7 @@ ${delta}` : delta;
|
|
|
1123
1125
|
const ttlMs = requirement.ttlMs !== void 0 && Number.isFinite(requirement.ttlMs) && requirement.ttlMs > 0 ? Math.floor(requirement.ttlMs) : void 0;
|
|
1124
1126
|
const expiresAt = ttlMs !== void 0 ? new Date(Date.now() + ttlMs).toISOString() : void 0;
|
|
1125
1127
|
const tool = this.a.approvalPresentation?.(action);
|
|
1126
|
-
const confirmation = tool !== void 0 ? (0,
|
|
1128
|
+
const confirmation = tool !== void 0 ? (0, import_nestjs_agent_core3.resolveToolConfirmation)(tool.name, args, tool.presentation) : void 0;
|
|
1127
1129
|
this.segment.calls.push({
|
|
1128
1130
|
id: req.id,
|
|
1129
1131
|
name: action,
|
|
@@ -1350,7 +1352,7 @@ ${delta}` : delta;
|
|
|
1350
1352
|
answer: toFormAnswer(form, answer.answers)
|
|
1351
1353
|
});
|
|
1352
1354
|
}
|
|
1353
|
-
const result = (0,
|
|
1355
|
+
const result = (0, import_nestjs_agent_core3.settleElicitation)(request, answer);
|
|
1354
1356
|
await this.a.store.updateToolCall({
|
|
1355
1357
|
toolCallId: form.id,
|
|
1356
1358
|
status: result.skipped ? "rejected" : "executed",
|
|
@@ -1705,7 +1707,7 @@ function isZodSchema(schema) {
|
|
|
1705
1707
|
}
|
|
1706
1708
|
__name(isZodSchema, "isZodSchema");
|
|
1707
1709
|
function toInputSchema(schema) {
|
|
1708
|
-
const extension = (0,
|
|
1710
|
+
const extension = (0, import_nestjs_agent_core4.schemaExtensionOf)(schema);
|
|
1709
1711
|
if (extension !== void 0) {
|
|
1710
1712
|
const base = toInputSchema(extension.base);
|
|
1711
1713
|
const properties = {
|
|
@@ -1749,7 +1751,7 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1749
1751
|
turns;
|
|
1750
1752
|
tokens;
|
|
1751
1753
|
/** Genui telemetry of the UI calls OpenCode makes (its code mode calls tools here, not in the loop). */
|
|
1752
|
-
genui = new
|
|
1754
|
+
genui = new import_nestjs_agent_core4.GenuiRunRecorder();
|
|
1753
1755
|
constructor(turns, tokens) {
|
|
1754
1756
|
this.turns = turns;
|
|
1755
1757
|
this.tokens = tokens;
|
|
@@ -1830,9 +1832,9 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1830
1832
|
}));
|
|
1831
1833
|
if (this.turns.memoryWritable()) {
|
|
1832
1834
|
tools.push({
|
|
1833
|
-
name:
|
|
1834
|
-
description:
|
|
1835
|
-
inputSchema: toInputSchema(
|
|
1835
|
+
name: import_nestjs_agent_core4.REMEMBER_TOOL_NAME,
|
|
1836
|
+
description: import_nestjs_agent_core4.REMEMBER_TOOL_DESCRIPTION,
|
|
1837
|
+
inputSchema: toInputSchema(import_nestjs_agent_core4.rememberInputSchema),
|
|
1836
1838
|
annotations: {
|
|
1837
1839
|
readOnlyHint: false
|
|
1838
1840
|
}
|
|
@@ -1849,7 +1851,7 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1849
1851
|
if (turn === void 0) {
|
|
1850
1852
|
throw new OpenCodeToolRefusedError("This endpoint serves OpenCode turns: no turn of yours is running on this session.");
|
|
1851
1853
|
}
|
|
1852
|
-
const output = name ===
|
|
1854
|
+
const output = name === import_nestjs_agent_core4.REMEMBER_TOOL_NAME && this.turns.memoryWritable() ? await this.remember(turn, args) : await this.invoke(turn, actor, name, args, String(extra.requestId ?? ""));
|
|
1853
1855
|
return {
|
|
1854
1856
|
content: [
|
|
1855
1857
|
{
|
|
@@ -1875,9 +1877,9 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1875
1877
|
async invoke(turn, actor, name, args, requestId) {
|
|
1876
1878
|
const { registry } = this.turns;
|
|
1877
1879
|
const spec = registry.spec(name);
|
|
1878
|
-
if (spec === void 0 || LOOP_SERVED_KINDS.has(spec.kind)) throw new
|
|
1880
|
+
if (spec === void 0 || LOOP_SERVED_KINDS.has(spec.kind)) throw new import_nestjs_agent_core4.ToolNotFoundError(name);
|
|
1879
1881
|
const allowed = this.turns.allowedTools(turn.input);
|
|
1880
|
-
if (allowed !== void 0 && !allowed.includes(name)) throw new
|
|
1882
|
+
if (allowed !== void 0 && !allowed.includes(name)) throw new import_nestjs_agent_core4.ToolNotFoundError(name);
|
|
1881
1883
|
if (spec.kind === "action" && !await this.turns.spendApproval(turn.runId, name, turn.input)) {
|
|
1882
1884
|
throw new OpenCodeToolRefusedError(`"${name}" is an action and nobody approved this call; ask for the permission first.`);
|
|
1883
1885
|
}
|
|
@@ -1919,7 +1921,7 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1919
1921
|
}
|
|
1920
1922
|
/** `remember`: one fact, at the actor's own scope only — as the loop serves it. */
|
|
1921
1923
|
async remember(turn, args) {
|
|
1922
|
-
const parsed = await
|
|
1924
|
+
const parsed = await import_nestjs_agent_core4.rememberInputSchema["~standard"].validate(args ?? {});
|
|
1923
1925
|
if (parsed.issues !== void 0) {
|
|
1924
1926
|
throw new OpenCodeToolRefusedError(`remember: ${parsed.issues.map((issue) => issue.message).join("; ")}`);
|
|
1925
1927
|
}
|
|
@@ -1928,13 +1930,13 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1928
1930
|
};
|
|
1929
1931
|
|
|
1930
1932
|
// src/runner.ts
|
|
1931
|
-
var
|
|
1933
|
+
var import_nestjs_agent_core6 = require("@dudousxd/nestjs-agent-core");
|
|
1932
1934
|
var import_common5 = require("@nestjs/common");
|
|
1933
1935
|
|
|
1934
1936
|
// src/turns.ts
|
|
1935
1937
|
var import_node_crypto2 = require("crypto");
|
|
1936
1938
|
var import_nestjs_agent = require("@dudousxd/nestjs-agent");
|
|
1937
|
-
var
|
|
1939
|
+
var import_nestjs_agent_core5 = require("@dudousxd/nestjs-agent-core");
|
|
1938
1940
|
var import_common4 = require("@nestjs/common");
|
|
1939
1941
|
|
|
1940
1942
|
// src/event-hub.ts
|
|
@@ -2113,7 +2115,7 @@ var OpenCodeTurns = class {
|
|
|
2113
2115
|
this.memory = memory;
|
|
2114
2116
|
this.queue = queue;
|
|
2115
2117
|
this.toolsTokens = toolsTokens2;
|
|
2116
|
-
this.prices = new
|
|
2118
|
+
this.prices = new import_nestjs_agent_core5.ModelPriceResolver({
|
|
2117
2119
|
pricingStore,
|
|
2118
2120
|
catalog: agentOptions?.priceCatalog,
|
|
2119
2121
|
log: {
|
|
@@ -2133,10 +2135,10 @@ var OpenCodeTurns = class {
|
|
|
2133
2135
|
const tokens = usage.inputTokens + usage.outputTokens;
|
|
2134
2136
|
const reported = reportedCostUsd !== void 0 && (reportedCostUsd > 0 || tokens === 0);
|
|
2135
2137
|
if (reported && this.settings.cost !== "estimate") {
|
|
2136
|
-
return (0,
|
|
2138
|
+
return (0, import_nestjs_agent_core5.resolveUsageCost)(usage, reportedCostUsd, void 0);
|
|
2137
2139
|
}
|
|
2138
2140
|
const price = model !== void 0 && tokens > 0 ? await this.prices.priceFor(priceRef(model)) : void 0;
|
|
2139
|
-
return (0,
|
|
2141
|
+
return (0, import_nestjs_agent_core5.resolveUsageCost)(usage, price === void 0 ? reportedCostUsd : void 0, price);
|
|
2140
2142
|
}
|
|
2141
2143
|
/** The tools server's name in OpenCode. */
|
|
2142
2144
|
get toolsServer() {
|
|
@@ -2191,7 +2193,7 @@ var OpenCodeTurns = class {
|
|
|
2191
2193
|
const memory = this.memory;
|
|
2192
2194
|
const write = memory?.provider.write?.bind(memory.provider);
|
|
2193
2195
|
if (memory === void 0 || write === void 0) return "Memory is read-only here.";
|
|
2194
|
-
const max = memory.maxFactChars ??
|
|
2196
|
+
const max = memory.maxFactChars ?? import_nestjs_agent_core5.DEFAULT_MAX_FACT_CHARS;
|
|
2195
2197
|
if (input.fact.length > max) return `Not recorded: a fact is at most ${max} characters.`;
|
|
2196
2198
|
const actor = turn.input.actor;
|
|
2197
2199
|
const scopeCtx = {
|
|
@@ -2201,9 +2203,9 @@ var OpenCodeTurns = class {
|
|
|
2201
2203
|
agentName: turn.input.agentName
|
|
2202
2204
|
} : {}
|
|
2203
2205
|
};
|
|
2204
|
-
const scopes = await (memory.scopes ??
|
|
2205
|
-
const scope = (0,
|
|
2206
|
-
const verdict = (0,
|
|
2206
|
+
const scopes = await (memory.scopes ?? import_nestjs_agent_core5.defaultScopeResolver).resolve(scopeCtx);
|
|
2207
|
+
const scope = (0, import_nestjs_agent_core5.actorScope)(actor);
|
|
2208
|
+
const verdict = (0, import_nestjs_agent_core5.memoryWriteVerdict)({
|
|
2207
2209
|
scope,
|
|
2208
2210
|
scopes,
|
|
2209
2211
|
actor,
|
|
@@ -2285,7 +2287,7 @@ var OpenCodeTurns = class {
|
|
|
2285
2287
|
runId,
|
|
2286
2288
|
emitUi: uiEmitter(scope(runId), async (component) => {
|
|
2287
2289
|
const writer = await this.sink.open(runId);
|
|
2288
|
-
await writer.write((0,
|
|
2290
|
+
await writer.write((0, import_nestjs_agent_core5.encodeStreamEvent)({
|
|
2289
2291
|
kind: "ui",
|
|
2290
2292
|
...component
|
|
2291
2293
|
}));
|
|
@@ -2613,12 +2615,12 @@ ${transcript}` : "",
|
|
|
2613
2615
|
const memory = this.memory;
|
|
2614
2616
|
if (memory === void 0) return void 0;
|
|
2615
2617
|
const ctx = this.scopeContext(input);
|
|
2616
|
-
const scopes = await (memory.scopes ??
|
|
2618
|
+
const scopes = await (memory.scopes ?? import_nestjs_agent_core5.defaultScopeResolver).resolve(ctx);
|
|
2617
2619
|
const records = await memory.provider.list({
|
|
2618
2620
|
scopes,
|
|
2619
2621
|
ctx
|
|
2620
2622
|
});
|
|
2621
|
-
const digest = (0,
|
|
2623
|
+
const digest = (0, import_nestjs_agent_core5.resolveMemoryDigest)({
|
|
2622
2624
|
records,
|
|
2623
2625
|
scopes,
|
|
2624
2626
|
...memory.maxMemories !== void 0 ? {
|
|
@@ -2626,7 +2628,7 @@ ${transcript}` : "",
|
|
|
2626
2628
|
} : {}
|
|
2627
2629
|
});
|
|
2628
2630
|
if (digest.entries.length === 0) return void 0;
|
|
2629
|
-
return (0,
|
|
2631
|
+
return (0, import_nestjs_agent_core5.buildMemoryBlock)({
|
|
2630
2632
|
entries: digest.entries,
|
|
2631
2633
|
writable: this.memoryWritable(),
|
|
2632
2634
|
partial: digest.omitted > 0
|
|
@@ -2640,12 +2642,12 @@ ${transcript}` : "",
|
|
|
2640
2642
|
const skills = this.skills;
|
|
2641
2643
|
if (skills === void 0 || client.file === void 0 || directory === void 0) return [];
|
|
2642
2644
|
const ctx = this.scopeContext(input);
|
|
2643
|
-
const scopes = await (skills.scopes ??
|
|
2645
|
+
const scopes = await (skills.scopes ?? import_nestjs_agent_core5.defaultScopeResolver).resolve(ctx);
|
|
2644
2646
|
const summaries = await skills.provider.list({
|
|
2645
2647
|
scopes,
|
|
2646
2648
|
ctx
|
|
2647
2649
|
});
|
|
2648
|
-
const { entries } = (0,
|
|
2650
|
+
const { entries } = (0, import_nestjs_agent_core5.resolveSkillCatalog)(summaries, scopes, skills.maxSkills);
|
|
2649
2651
|
const dir = this.settings.skillsDir ?? ".opencode/skills";
|
|
2650
2652
|
const written = [];
|
|
2651
2653
|
for (const entry of entries) {
|
|
@@ -2884,7 +2886,7 @@ ${body}
|
|
|
2884
2886
|
current?.stop();
|
|
2885
2887
|
const server = await this.host.server(input.actor);
|
|
2886
2888
|
const deps = this.deps.forAgent(input.agentName);
|
|
2887
|
-
const policy = deps.approvalPolicy ?? new
|
|
2889
|
+
const policy = deps.approvalPolicy ?? new import_nestjs_agent_core5.DefaultApprovalPolicy();
|
|
2888
2890
|
const writer = await this.sink.open(input.sinkRunId ?? runId);
|
|
2889
2891
|
const turn = new OpenCodeTurn({
|
|
2890
2892
|
runId,
|
|
@@ -2994,7 +2996,7 @@ ${body}
|
|
|
2994
2996
|
const ui = amendment.ui ?? [];
|
|
2995
2997
|
const last = result.messages.at(-1);
|
|
2996
2998
|
if (ui.length > 0) {
|
|
2997
|
-
for (const component of ui) await writer.write((0,
|
|
2999
|
+
for (const component of ui) await writer.write((0, import_nestjs_agent_core5.encodeStreamEvent)({
|
|
2998
3000
|
kind: "ui",
|
|
2999
3001
|
...component
|
|
3000
3002
|
}));
|
|
@@ -3041,18 +3043,18 @@ ${body}
|
|
|
3041
3043
|
await this.amend(writer, result);
|
|
3042
3044
|
if (outcome.status === "interrupted") {
|
|
3043
3045
|
this.logger.log(`agent run ${runId} cancelled`);
|
|
3044
|
-
await Promise.resolve(this.store.failUnsettledToolCalls?.(runId,
|
|
3046
|
+
await Promise.resolve(this.store.failUnsettledToolCalls?.(runId, import_nestjs_agent_core5.RUN_ENDED_BEFORE_TOOL_CALL)).catch(() => 0);
|
|
3045
3047
|
await this.handoff(writer, input, runId, "cancelled");
|
|
3046
|
-
await (0,
|
|
3047
|
-
await writer.write((0,
|
|
3048
|
+
await (0, import_nestjs_agent_core5.releaseThreadRun)(this.store, input.threadId, runId);
|
|
3049
|
+
await writer.write((0, import_nestjs_agent_core5.encodeStreamEvent)({
|
|
3048
3050
|
kind: "cancelled"
|
|
3049
3051
|
}));
|
|
3050
3052
|
await writer.end();
|
|
3051
|
-
(0,
|
|
3053
|
+
(0, import_nestjs_agent_core5.publishAgentRunCancelled)({
|
|
3052
3054
|
runId,
|
|
3053
3055
|
threadId: input.threadId,
|
|
3054
3056
|
durationMs,
|
|
3055
|
-
context: (0,
|
|
3057
|
+
context: (0, import_nestjs_agent_core5.agentRunContext)(input)
|
|
3056
3058
|
});
|
|
3057
3059
|
await this.store.recordRunEnd?.({
|
|
3058
3060
|
runId,
|
|
@@ -3061,7 +3063,7 @@ ${body}
|
|
|
3061
3063
|
});
|
|
3062
3064
|
} else {
|
|
3063
3065
|
await this.handoff(writer, input, runId, "completed");
|
|
3064
|
-
await (0,
|
|
3066
|
+
await (0, import_nestjs_agent_core5.releaseThreadRun)(this.store, input.threadId, runId);
|
|
3065
3067
|
await writer.end();
|
|
3066
3068
|
await this.store.recordRunEnd?.({
|
|
3067
3069
|
runId,
|
|
@@ -3080,15 +3082,15 @@ ${body}
|
|
|
3080
3082
|
error
|
|
3081
3083
|
}, durationMs, usage);
|
|
3082
3084
|
const worded = (await this.amend(writer, result)).error;
|
|
3083
|
-
const message = worded ?? (0,
|
|
3085
|
+
const message = worded ?? (0, import_nestjs_agent_core5.streamFailure)(new Error(error)).message;
|
|
3084
3086
|
this.logger.error(`agent run ${runId} failed: ${error}`);
|
|
3085
|
-
(0,
|
|
3087
|
+
(0, import_nestjs_agent_core5.publishAgentRunFailed)({
|
|
3086
3088
|
runId,
|
|
3087
3089
|
threadId: input.threadId,
|
|
3088
3090
|
code: "opencode_failed",
|
|
3089
3091
|
message: error,
|
|
3090
3092
|
durationMs,
|
|
3091
|
-
context: (0,
|
|
3093
|
+
context: (0, import_nestjs_agent_core5.agentRunContext)(input)
|
|
3092
3094
|
});
|
|
3093
3095
|
await this.store.recordRunEnd?.({
|
|
3094
3096
|
runId,
|
|
@@ -3097,9 +3099,9 @@ ${body}
|
|
|
3097
3099
|
errorCode: "opencode_failed",
|
|
3098
3100
|
errorMessage: error
|
|
3099
3101
|
});
|
|
3100
|
-
await Promise.resolve(this.store.failUnsettledToolCalls?.(runId,
|
|
3102
|
+
await Promise.resolve(this.store.failUnsettledToolCalls?.(runId, import_nestjs_agent_core5.RUN_ENDED_BEFORE_TOOL_CALL)).catch(() => 0);
|
|
3101
3103
|
await this.handoff(writer, input, runId, "failed", error);
|
|
3102
|
-
await (0,
|
|
3104
|
+
await (0, import_nestjs_agent_core5.releaseThreadRun)(this.store, input.threadId, runId);
|
|
3103
3105
|
await writer.fail({
|
|
3104
3106
|
code: "opencode_failed",
|
|
3105
3107
|
message
|
|
@@ -3129,7 +3131,7 @@ ${body}
|
|
|
3129
3131
|
error
|
|
3130
3132
|
} : {}
|
|
3131
3133
|
}, (next, nextRunId) => startNext(next, nextRunId));
|
|
3132
|
-
if (frame !== void 0) await writer.write((0,
|
|
3134
|
+
if (frame !== void 0) await writer.write((0, import_nestjs_agent_core5.encodeStreamEvent)(frame));
|
|
3133
3135
|
} catch (failure) {
|
|
3134
3136
|
this.logger.error(`could not advance the queue of thread ${input.threadId} after run ${runId}: ${failure instanceof Error ? failure.message : String(failure)}`);
|
|
3135
3137
|
}
|
|
@@ -3140,22 +3142,22 @@ OpenCodeTurns = _ts_decorate2([
|
|
|
3140
3142
|
_ts_param2(0, (0, import_common4.Inject)(OPENCODE_HOST)),
|
|
3141
3143
|
_ts_param2(1, (0, import_common4.Inject)(OPENCODE_SESSIONS)),
|
|
3142
3144
|
_ts_param2(2, (0, import_common4.Inject)(OPENCODE_OPTIONS)),
|
|
3143
|
-
_ts_param2(3, (0, import_common4.Inject)(
|
|
3144
|
-
_ts_param2(4, (0, import_common4.Inject)(
|
|
3145
|
-
_ts_param2(5, (0, import_common4.Inject)(
|
|
3146
|
-
_ts_param2(6, (0, import_common4.Inject)(
|
|
3145
|
+
_ts_param2(3, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_STORE)),
|
|
3146
|
+
_ts_param2(4, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_SINK)),
|
|
3147
|
+
_ts_param2(5, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_DEPS_FACTORY)),
|
|
3148
|
+
_ts_param2(6, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_TOOL_REGISTRY)),
|
|
3147
3149
|
_ts_param2(7, (0, import_common4.Optional)()),
|
|
3148
|
-
_ts_param2(7, (0, import_common4.Inject)(
|
|
3150
|
+
_ts_param2(7, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_SKILLS)),
|
|
3149
3151
|
_ts_param2(8, (0, import_common4.Optional)()),
|
|
3150
|
-
_ts_param2(8, (0, import_common4.Inject)(
|
|
3152
|
+
_ts_param2(8, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_MEMORY)),
|
|
3151
3153
|
_ts_param2(9, (0, import_common4.Optional)()),
|
|
3152
3154
|
_ts_param2(9, (0, import_common4.Inject)(import_nestjs_agent.AGENT_CHAT_QUEUE)),
|
|
3153
3155
|
_ts_param2(10, (0, import_common4.Optional)()),
|
|
3154
3156
|
_ts_param2(10, (0, import_common4.Inject)(OPENCODE_TOOLS_TOKENS)),
|
|
3155
3157
|
_ts_param2(11, (0, import_common4.Optional)()),
|
|
3156
|
-
_ts_param2(11, (0, import_common4.Inject)(
|
|
3158
|
+
_ts_param2(11, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_PRICING_STORE)),
|
|
3157
3159
|
_ts_param2(12, (0, import_common4.Optional)()),
|
|
3158
|
-
_ts_param2(12, (0, import_common4.Inject)(
|
|
3160
|
+
_ts_param2(12, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_OPTIONS)),
|
|
3159
3161
|
_ts_metadata2("design:type", Function),
|
|
3160
3162
|
_ts_metadata2("design:paramtypes", [
|
|
3161
3163
|
typeof OpenCodeHost === "undefined" ? Object : OpenCodeHost,
|
|
@@ -3217,7 +3219,7 @@ function priceRef(model) {
|
|
|
3217
3219
|
model.id
|
|
3218
3220
|
];
|
|
3219
3221
|
const tail = model.id.slice(model.id.lastIndexOf("/") + 1);
|
|
3220
|
-
if (tail !== model.id && (0,
|
|
3222
|
+
if (tail !== model.id && (0, import_nestjs_agent_core5.parseBedrockModelId)(tail) !== void 0) aliases.push(tail);
|
|
3221
3223
|
return {
|
|
3222
3224
|
modelId: `${model.providerID}/${model.id}`,
|
|
3223
3225
|
provider: model.providerID,
|
|
@@ -3317,7 +3319,7 @@ var OpenCodeAgentRunner = class {
|
|
|
3317
3319
|
]) {
|
|
3318
3320
|
if (!key.startsWith(`${runId}:`)) continue;
|
|
3319
3321
|
this.pending.delete(key);
|
|
3320
|
-
waiter.reject(new
|
|
3322
|
+
waiter.reject(new import_nestjs_agent_core6.RunCancelledError());
|
|
3321
3323
|
}
|
|
3322
3324
|
const input = this.inputs.get(runId);
|
|
3323
3325
|
if (input !== void 0) await this.turns.interrupt(input).catch(() => void 0);
|
|
@@ -3329,7 +3331,7 @@ var OpenCodeAgentRunner = class {
|
|
|
3329
3331
|
let spent = emptyUsage();
|
|
3330
3332
|
try {
|
|
3331
3333
|
let handle = await this.turns.begin(runId, input);
|
|
3332
|
-
if (this.cancelled.has(runId)) throw new
|
|
3334
|
+
if (this.cancelled.has(runId)) throw new import_nestjs_agent_core6.RunCancelledError();
|
|
3333
3335
|
await this.turns.prompt(runId, input, handle, spent);
|
|
3334
3336
|
for (; ; ) {
|
|
3335
3337
|
const milestone = await this.turns.observe(runId, input, handle, spent);
|
|
@@ -3342,7 +3344,7 @@ var OpenCodeAgentRunner = class {
|
|
|
3342
3344
|
handle = await this.turns.reply(runId, input, handle, milestone.ask, reply, spent);
|
|
3343
3345
|
}
|
|
3344
3346
|
} catch (error) {
|
|
3345
|
-
if (error instanceof
|
|
3347
|
+
if (error instanceof import_nestjs_agent_core6.RunCancelledError) {
|
|
3346
3348
|
await this.turns.interrupt(input).catch(() => void 0);
|
|
3347
3349
|
await this.turns.settle(runId, input, {
|
|
3348
3350
|
status: "interrupted"
|