Files
next-tjwater-agent/.opencode/tools/publish_task_presentation.ts
jiang 6a49d2209e feat(agent): unify MCP tools and adopt Responses delivery
Move project and host queries into native MCP with host-owned OAuth/context,
while retaining memory, skills, actions and publication plugins. Add nearby-model
queries and explicit chat/task/learning model defaults.

Adopt Responses HTTP/SSE and native steer/queue inbox delivery, preserving scoped
session ownership, pending input edits and investigation communication.

Disable local-provider discovery: Server /health allowed native vLLM to probe
/v1/models on port 8000. A native before/after regression prevents recurrence.

Validation: 170 focused Bun tests; service/plugin typechecks; native discovery,
provider-discovery and input-inbox smoke checks; no paid model inference.
2026-10-19 18:46:58 +08:00

26 lines
1.7 KiB
TypeScript

import { tool } from "../tool.js";
import { getInternalBridgeConfig } from "../internalBridge.js";
import { taskPresentationCommandSchema } from "../../src/product/task-presentation.js";
import { taskPublicationCommandSchema } from "./task-publication-schema.js";
export default tool({
description: "Record a bounded map, chart or evidence-backed overlay presentation command for the current task execution. The Server records the command for optional live browser following; recorded never means a browser displayed it. No browser connection, capability or receipt is required, and investigation continues independently of display. Chart data must reflect the referenced persisted evidence. Overlay coordinates and values are extracted by the Server from the evidence snapshot; never supply invented geometry or arbitrary code. Use a stable UUID request_id and reuse it when retrying the same command.",
args: {
request_id: tool.schema.string().uuid().describe("Stable UUID idempotency key; reuse for retries of this command"),
command: taskPublicationCommandSchema,
},
async execute(args, context) {
const command = taskPresentationCommandSchema.parse(args.command);
const { baseUrl, internalToken } = getInternalBridgeConfig();
const response = await fetch(`${baseUrl}/internal/operational-task/presentation`, {
method: "POST",
headers: { "Content-Type": "application/json", "x-agent-internal-token": internalToken },
signal: context.signal,
body: JSON.stringify({ session_id: context.sessionID, request_id: args.request_id, command }),
});
const text = await response.text();
if (!response.ok) throw new Error(`task presentation publish failed (${response.status}): ${text}`);
return text;
},
});