@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@springbrand/agent-runtime",
3
- "version": "0.1.3-alpha.11",
3
+ "version": "0.1.3-alpha.12",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src",
@@ -194,6 +194,7 @@ export interface WorkspacePort {
194
194
  * Workspace;Tool Surface 只把这个已授权 Port 转成 `execute` Tool。
195
195
  */
196
196
  export interface RuntimeCodeExecutionPort {
197
+ readonly description: string;
197
198
  execute(input: { code: string }): Promise<unknown>;
198
199
  }
199
200
 
@@ -36,11 +36,15 @@ export function createWorkspaceCodeExecutionPort(options: {
36
36
  ),
37
37
  name: "execute",
38
38
  });
39
- const execute = tool.execute;
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: [],
@@ -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 取消。