@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.cjs
CHANGED
|
@@ -154,6 +154,7 @@ OpenCodeMcpController = _ts_decorate([
|
|
|
154
154
|
// src/mcp.ts
|
|
155
155
|
var import_node_crypto = require("crypto");
|
|
156
156
|
var import_nestjs_agent_core3 = require("@dudousxd/nestjs-agent-core");
|
|
157
|
+
var import_genui = require("@dudousxd/nestjs-agent-core/genui");
|
|
157
158
|
var import_server = require("@modelcontextprotocol/sdk/server/index.js");
|
|
158
159
|
var import_streamableHttp = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
159
160
|
var import_zod_json_schema_compat = require("@modelcontextprotocol/sdk/server/zod-json-schema-compat.js");
|
|
@@ -1474,6 +1475,8 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1474
1475
|
}
|
|
1475
1476
|
turns;
|
|
1476
1477
|
tokens;
|
|
1478
|
+
/** Genui telemetry of the UI calls OpenCode makes (its code mode calls tools here, not in the loop). */
|
|
1479
|
+
genui = new import_nestjs_agent_core3.GenuiRunRecorder();
|
|
1477
1480
|
constructor(turns, tokens) {
|
|
1478
1481
|
this.turns = turns;
|
|
1479
1482
|
this.tokens = tokens;
|
|
@@ -1605,7 +1608,7 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1605
1608
|
if (spec.kind === "action" && !await this.turns.spendApproval(turn.runId, name, turn.input)) {
|
|
1606
1609
|
throw new OpenCodeToolRefusedError(`"${name}" is an action and nobody approved this call; ask for the permission first.`);
|
|
1607
1610
|
}
|
|
1608
|
-
|
|
1611
|
+
const invoke = /* @__PURE__ */ __name(() => registry.invoke(name, args ?? {}, {
|
|
1609
1612
|
actor,
|
|
1610
1613
|
threadId: turn.ctx.threadId,
|
|
1611
1614
|
runId: turn.runId,
|
|
@@ -1622,7 +1625,24 @@ var OpenCodeMcpEndpoint2 = class {
|
|
|
1622
1625
|
} : {}
|
|
1623
1626
|
}, this.turns.rolesPolicyFor(turn.input), allowed !== void 0 ? {
|
|
1624
1627
|
allowedTools: allowed
|
|
1625
|
-
} : {});
|
|
1628
|
+
} : {}), "invoke");
|
|
1629
|
+
return this.genui.track({
|
|
1630
|
+
store: this.turns.store,
|
|
1631
|
+
marker: spec.genui,
|
|
1632
|
+
runId: turn.runId,
|
|
1633
|
+
threadId: turn.ctx.threadId,
|
|
1634
|
+
actorRef: actor.id,
|
|
1635
|
+
...turn.input.agentName !== void 0 ? {
|
|
1636
|
+
agentName: turn.input.agentName
|
|
1637
|
+
} : {},
|
|
1638
|
+
channel: (0, import_genui.turnChannel)(turn.input.pageContext),
|
|
1639
|
+
modelId: turn.input.model ?? "opencode",
|
|
1640
|
+
call: {
|
|
1641
|
+
id: `mcp:${turn.runId}:${requestId}`,
|
|
1642
|
+
name,
|
|
1643
|
+
input: args ?? {}
|
|
1644
|
+
}
|
|
1645
|
+
}, invoke);
|
|
1626
1646
|
}
|
|
1627
1647
|
/** `remember`: one fact, at the actor's own scope only — as the loop serves it. */
|
|
1628
1648
|
async remember(turn, args) {
|