@springbrand/agent-runtime 0.1.3-alpha.11 → 0.1.3-alpha.12
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/package.json +1 -1
- package/src/kernel/bindings.ts +1 -0
- package/src/pi/tool/core-host.ts +5 -1
- package/src/pi/tool/core.ts +1 -10
package/package.json
CHANGED
package/src/kernel/bindings.ts
CHANGED
package/src/pi/tool/core-host.ts
CHANGED
|
@@ -36,11 +36,15 @@ export function createWorkspaceCodeExecutionPort(options: {
|
|
|
36
36
|
),
|
|
37
37
|
name: "execute",
|
|
38
38
|
});
|
|
39
|
-
const execute = tool
|
|
39
|
+
const { description, execute } = tool;
|
|
40
|
+
if (typeof description !== "string" || description.length === 0) {
|
|
41
|
+
throw new Error("Think createExecuteRuntime returned a tool without a description");
|
|
42
|
+
}
|
|
40
43
|
if (typeof execute !== "function") {
|
|
41
44
|
throw new Error("Think createExecuteRuntime returned a non-executable tool");
|
|
42
45
|
}
|
|
43
46
|
return {
|
|
47
|
+
description,
|
|
44
48
|
execute: (input) => Promise.resolve(execute(input, {
|
|
45
49
|
toolCallId: "execute",
|
|
46
50
|
messages: [],
|
package/src/pi/tool/core.ts
CHANGED
|
@@ -125,16 +125,7 @@ export function codeExecutionPiToolCandidate(
|
|
|
125
125
|
const tool: AgentTool<typeof executeParameters> = {
|
|
126
126
|
name: "execute",
|
|
127
127
|
label: "Execute JavaScript",
|
|
128
|
-
description:
|
|
129
|
-
"Run JavaScript in a short-lived Code Mode Dynamic Worker and return a value. This is your " +
|
|
130
|
-
"raw-network and tool-composition instrument, not a general web-search tool. Call fetch directly " +
|
|
131
|
-
"when you need a raw response, custom headers/method/body, a structured API, or content that " +
|
|
132
|
-
"web_search could not retrieve. Check res.status; when several known endpoints are necessary, " +
|
|
133
|
-
"fetch them in one invocation. Also available: " +
|
|
134
|
-
"state.* for your workspace filesystem (readFile/writeFile/glob/searchFiles/replaceInFiles, " +
|
|
135
|
-
"each taking one object argument), and codemode.step(name, fn) to run a side-effecting block " +
|
|
136
|
-
"exactly once so it survives replay. Write plain JavaScript — TypeScript type annotations are " +
|
|
137
|
-
"a syntax error. Use return for the result and console.log for notes.",
|
|
128
|
+
description: runtime.description,
|
|
138
129
|
parameters: executeParameters,
|
|
139
130
|
// 把模型提供的 JavaScript 交给 Codemode Runtime 执行。
|
|
140
131
|
// Pi 工具循环在模型选择 `execute` 时调用,调用前允许 Turn 取消。
|