@dudousxd/nestjs-agent-opencode 0.3.0 → 0.4.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/dist/durable/index.cjs +22 -2
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +1 -1
- package/dist/durable/index.d.ts +1 -1
- package/dist/durable/index.js +23 -3
- package/dist/durable/index.js.map +1 -1
- package/dist/{engine-Cp5uysaN.d.cts → engine-BNNxQAFV.d.cts} +7 -2
- package/dist/{engine-Cp5uysaN.d.ts → engine-BNNxQAFV.d.ts} +7 -2
- package/dist/index.cjs +22 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/durable/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AgentEngine } from '@dudousxd/nestjs-agent';
|
|
2
|
-
import { O as OpenCodeTurns, a as OpenCodeEngineSettings, b as OpenCodeHost, c as OpenCodeEngineOptions } from '../engine-
|
|
2
|
+
import { O as OpenCodeTurns, a as OpenCodeEngineSettings, b as OpenCodeHost, c as OpenCodeEngineOptions } from '../engine-BNNxQAFV.cjs';
|
|
3
3
|
import { AgentRunner, AgentStore, AgentRunInput, AgentRunStartOptions, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
4
4
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
5
5
|
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
package/dist/durable/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AgentEngine } from '@dudousxd/nestjs-agent';
|
|
2
|
-
import { O as OpenCodeTurns, a as OpenCodeEngineSettings, b as OpenCodeHost, c as OpenCodeEngineOptions } from '../engine-
|
|
2
|
+
import { O as OpenCodeTurns, a as OpenCodeEngineSettings, b as OpenCodeHost, c as OpenCodeEngineOptions } from '../engine-BNNxQAFV.js';
|
|
3
3
|
import { AgentRunner, AgentStore, AgentRunInput, AgentRunStartOptions, HumanReply } from '@dudousxd/nestjs-agent-core';
|
|
4
4
|
import { WorkflowService } from '@dudousxd/nestjs-durable';
|
|
5
5
|
import { RunGateway, WorkflowCtx } from '@dudousxd/nestjs-durable-core';
|
package/dist/durable/index.js
CHANGED
|
@@ -125,7 +125,8 @@ OpenCodeMcpController = _ts_decorate([
|
|
|
125
125
|
|
|
126
126
|
// src/mcp.ts
|
|
127
127
|
import { createHash, createHmac, randomBytes, timingSafeEqual } from "crypto";
|
|
128
|
-
import { REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, ToolNotFoundError, rememberInputSchema, schemaExtensionOf } from "@dudousxd/nestjs-agent-core";
|
|
128
|
+
import { GenuiRunRecorder, REMEMBER_TOOL_DESCRIPTION, REMEMBER_TOOL_NAME, ToolNotFoundError, rememberInputSchema, schemaExtensionOf } from "@dudousxd/nestjs-agent-core";
|
|
129
|
+
import { turnChannel } from "@dudousxd/nestjs-agent-core/genui";
|
|
129
130
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
130
131
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
131
132
|
import { toJsonSchemaCompat } from "@modelcontextprotocol/sdk/server/zod-json-schema-compat.js";
|
|
@@ -1446,6 +1447,8 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1446
1447
|
}
|
|
1447
1448
|
turns;
|
|
1448
1449
|
tokens;
|
|
1450
|
+
/** Genui telemetry of the UI calls OpenCode makes (its code mode calls tools here, not in the loop). */
|
|
1451
|
+
genui = new GenuiRunRecorder();
|
|
1449
1452
|
constructor(turns, tokens) {
|
|
1450
1453
|
this.turns = turns;
|
|
1451
1454
|
this.tokens = tokens;
|
|
@@ -1577,7 +1580,7 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1577
1580
|
if (spec.kind === "action" && !await this.turns.spendApproval(turn.runId, name, turn.input)) {
|
|
1578
1581
|
throw new OpenCodeToolRefusedError(`"${name}" is an action and nobody approved this call; ask for the permission first.`);
|
|
1579
1582
|
}
|
|
1580
|
-
|
|
1583
|
+
const invoke = /* @__PURE__ */ __name(() => registry.invoke(name, args ?? {}, {
|
|
1581
1584
|
actor,
|
|
1582
1585
|
threadId: turn.ctx.threadId,
|
|
1583
1586
|
runId: turn.runId,
|
|
@@ -1594,7 +1597,24 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1594
1597
|
} : {}
|
|
1595
1598
|
}, this.turns.rolesPolicyFor(turn.input), allowed !== void 0 ? {
|
|
1596
1599
|
allowedTools: allowed
|
|
1597
|
-
} : {});
|
|
1600
|
+
} : {}), "invoke");
|
|
1601
|
+
return this.genui.track({
|
|
1602
|
+
store: this.turns.store,
|
|
1603
|
+
marker: spec.genui,
|
|
1604
|
+
runId: turn.runId,
|
|
1605
|
+
threadId: turn.ctx.threadId,
|
|
1606
|
+
actorRef: actor.id,
|
|
1607
|
+
...turn.input.agentName !== void 0 ? {
|
|
1608
|
+
agentName: turn.input.agentName
|
|
1609
|
+
} : {},
|
|
1610
|
+
channel: turnChannel(turn.input.pageContext),
|
|
1611
|
+
modelId: turn.input.model ?? "opencode",
|
|
1612
|
+
call: {
|
|
1613
|
+
id: `mcp:${turn.runId}:${requestId}`,
|
|
1614
|
+
name,
|
|
1615
|
+
input: args ?? {}
|
|
1616
|
+
}
|
|
1617
|
+
}, invoke);
|
|
1598
1618
|
}
|
|
1599
1619
|
/** `remember`: one fact, at the actor's own scope only — as the loop serves it. */
|
|
1600
1620
|
async remember(turn, args) {
|