fix(opencode): restore stable v1 runtime
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
export default tool({
|
||||
description:
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
type ToolContext = {
|
||||
sessionID: string;
|
||||
};
|
||||
|
||||
type ToolDefinition<Shape extends z.ZodRawShape> = {
|
||||
description: string;
|
||||
args: Shape;
|
||||
execute: (
|
||||
args: z.infer<z.ZodObject<Shape>>,
|
||||
context: ToolContext,
|
||||
) => Promise<string> | string;
|
||||
};
|
||||
|
||||
const defineTool = <Shape extends z.ZodRawShape>(
|
||||
definition: ToolDefinition<Shape>,
|
||||
) => {
|
||||
const inputSchema = z.object(definition.args);
|
||||
return {
|
||||
description: definition.description,
|
||||
input: z.toJSONSchema(inputSchema),
|
||||
async execute(input: unknown, context: ToolContext) {
|
||||
return {
|
||||
content: await definition.execute(inputSchema.parse(input), context),
|
||||
};
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const tool = Object.assign(defineTool, { schema: z });
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
const internalBaseUrl =
|
||||
process.env.TJWATER_AGENT_INTERNAL_BASE_URL ?? "http://127.0.0.1:8787";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
export default tool({
|
||||
description: "在前端地图上定位并高亮指定的管网要素。",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
import { MemoryStore } from "../../src/memory/store.js";
|
||||
import {
|
||||
getRuntimeSessionContext,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
export default tool({
|
||||
description:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
const internalBaseUrl =
|
||||
process.env.TJWATER_AGENT_INTERNAL_BASE_URL ?? "http://127.0.0.1:8787";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
export default tool({
|
||||
description:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
import { SkillStore } from "../../src/skills/store.js";
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
const internalBaseUrl =
|
||||
process.env.TJWATER_AGENT_INTERNAL_BASE_URL ?? "http://127.0.0.1:8787";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
const internalBaseUrl =
|
||||
process.env.TJWATER_AGENT_INTERNAL_BASE_URL ?? "http://127.0.0.1:8787";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
export default tool({
|
||||
description: "为选定的管网要素打开前端的历史记录或计算结果面板。",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
export default tool({
|
||||
description: "打开前端的 SCADA 监测数据历史面板。",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
const internalBaseUrl =
|
||||
process.env.TJWATER_AGENT_INTERNAL_BASE_URL ?? "http://127.0.0.1:8787";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tool } from "./defineTool.js";
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
export default tool({
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user