@robota-sdk/agent-tool-defaults 3.0.0-beta.83 → 3.0.0-beta.84

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @robota-sdk/agent-tool-defaults
2
2
 
3
+ ## 3.0.0-beta.84
4
+
5
+ ### Patch Changes
6
+
7
+ - c7f213c: `createDefaultTools` returned the same `WebFetch`/`WebSearch` tool instances on every call — the
8
+ two module-level singletons `@robota-sdk/agent-tools` exports — unlike every other tool in the set,
9
+ which was already built fresh per call. Two sessions built from separate `createDefaultTools({cwd})`
10
+ calls that were open at the same time shared those two tools without meaning to, which a resource
11
+ guard keyed by object identity (as `@robota-sdk/agent-roundtable-robota`'s does) rejected as reused
12
+ even though nothing about either tool needs to be shared across sessions. `WebFetch`/`WebSearch` are
13
+ now built per call, the same way `Glob`/`Grep` already were.
14
+ - Updated dependencies [9f46375]
15
+ - Updated dependencies [9c6a8db]
16
+ - Updated dependencies [9c6a8db]
17
+ - @robota-sdk/agent-core@3.0.0-beta.84
18
+ - @robota-sdk/agent-tools@3.0.0-beta.84
19
+
3
20
  ## 3.0.0-beta.83
4
21
 
5
22
  ### Patch Changes
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@robota-sdk/agent-tools");function t(t){let n=(0,e.routesFilesThroughSandbox)(t.sandboxClient),{sandboxClient:r,...i}=t,a=n?t:i;return[(0,e.createShellTool)(t),(0,e.createBashTool)(t),(0,e.createReadTool)(a),(0,e.createWriteTool)(a),(0,e.createEditTool)(a),...n?[]:[(0,e.createGlobTool)(t),(0,e.createGrepTool)(t)],e.webFetchTool,e.webSearchTool,(0,e.createAskUserQuestionTool)(),...t.retrievalAdapter?[(0,e.createRetrievalTool)({adapter:t.retrievalAdapter})]:[],...t.computerDriver?(0,e.createComputerTool)({driver:t.computerDriver}):[]]}exports.createDefaultTools=t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@robota-sdk/agent-tools");function t(t){let n=(0,e.routesFilesThroughSandbox)(t.sandboxClient),{sandboxClient:r,...i}=t,a=n?t:i;return[(0,e.createShellTool)(t),(0,e.createBashTool)(t),(0,e.createReadTool)(a),(0,e.createWriteTool)(a),(0,e.createEditTool)(a),...n?[]:[(0,e.createGlobTool)(t),(0,e.createGrepTool)(t)],(0,e.createWebFetchTool)(),(0,e.createWebSearchTool)(),(0,e.createAskUserQuestionTool)(),...t.retrievalAdapter?[(0,e.createRetrievalTool)({adapter:t.retrievalAdapter})]:[],...t.computerDriver?(0,e.createComputerTool)({driver:t.computerDriver}):[]]}exports.createDefaultTools=t;
@@ -1,2 +1,2 @@
1
- import{createAskUserQuestionTool as e,createBashTool as t,createComputerTool as n,createEditTool as r,createGlobTool as i,createGrepTool as a,createReadTool as o,createRetrievalTool as s,createShellTool as c,createWriteTool as l,routesFilesThroughSandbox as u,webFetchTool as d,webSearchTool as f}from"@robota-sdk/agent-tools";function p(p){let m=u(p.sandboxClient),{sandboxClient:h,...g}=p,_=m?p:g;return[c(p),t(p),o(_),l(_),r(_),...m?[]:[i(p),a(p)],d,f,e(),...p.retrievalAdapter?[s({adapter:p.retrievalAdapter})]:[],...p.computerDriver?n({driver:p.computerDriver}):[]]}export{p as createDefaultTools};
1
+ import{createAskUserQuestionTool as e,createBashTool as t,createComputerTool as n,createEditTool as r,createGlobTool as i,createGrepTool as a,createReadTool as o,createRetrievalTool as s,createShellTool as c,createWebFetchTool as l,createWebSearchTool as u,createWriteTool as d,routesFilesThroughSandbox as f}from"@robota-sdk/agent-tools";function p(p){let m=f(p.sandboxClient),{sandboxClient:h,...g}=p,_=m?p:g;return[c(p),t(p),o(_),d(_),r(_),...m?[]:[i(p),a(p)],l(),u(),e(),...p.retrievalAdapter?[s({adapter:p.retrievalAdapter})]:[],...p.computerDriver?n({driver:p.computerDriver}):[]]}export{p as createDefaultTools};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/create-default-tools.ts"],"sourcesContent":["/**\n * The DEFAULT TOOL SET — a composition leaf.\n *\n * ARCH-035 moved this out of `@robota-sdk/agent-framework`. It is a defaults aggregator, and\n * `.agents/project-structure.md` classifies that family as a composition leaf \"imported only at\n * composition roots (entry-point-only)\" — not something a mid-layer assembly library owns, publishes\n * and self-consumes.\n *\n * The move is what carries the guarantee. `agent-subagent-runner` may depend on `agent-framework`\n * (it needs `createSubagentSession` and friends) but has no manifest edge to THIS package, so\n * `import { createDefaultTools } from '@robota-sdk/agent-tool-defaults'` does not resolve there at\n * all. A neutral runner composing the product's tool surface is now a compile error rather than a\n * scan finding — the same shape ARCH-021 achieved on the provider axis with\n * `@robota-sdk/agent-builtin-providers`.\n *\n * `DEFAULT_TOOL_DESCRIPTIONS` deliberately did NOT come along: its only consumer builds the system\n * prompt synchronously, and dragging it here would force either a static edge back into this leaf or\n * a second async hop through prompt building. It stays beside its consumer in `agent-framework`.\n */\nimport {\n createAskUserQuestionTool,\n createShellTool,\n createBashTool,\n createReadTool,\n createWriteTool,\n createEditTool,\n createRetrievalTool,\n createComputerTool,\n createGlobTool,\n createGrepTool,\n webFetchTool,\n webSearchTool,\n routesFilesThroughSandbox,\n} from '@robota-sdk/agent-tools';\n\nimport type { FunctionTool } from '@robota-sdk/agent-core';\nimport type { ISandboxClient, IRetrievalAdapter, IComputerDriver } from '@robota-sdk/agent-tools';\n\n/**\n * Create the default set of CLI tools.\n * Returns the standard tools.\n */\nexport interface ICreateDefaultToolsOptions {\n sandboxClient?: ISandboxClient;\n /** Host-selected executable for Shell and Bash. */\n shellExecutable?: string;\n /**\n * The execution root every file tool is contained by. REQUIRED — ARCH-010.\n *\n * It was optional, and `child-process-subagent-worker.ts` called this factory with no argument at\n * all: `cwd` was `undefined`, the path guard was fail-open, and the subagent's `Read` returned\n * `/etc/hostname`. Requiring it means a construction site that forgets does not compile, which is\n * the only way a containment root stays a contract rather than a convention.\n */\n cwd: string;\n /** SELFHOST-003: when present, adds the adapter-gated `CodebaseRetrieval` tool (absent otherwise). */\n retrievalAdapter?: IRetrievalAdapter;\n /**\n * SELFHOST-010: when present, adds the adapter-gated `ComputerView` + `Computer` tools. Unlike the\n * shell tool's host `spawn` fallback, computer-use has NO host fallback — with no driver the tools are\n * simply ABSENT (there is no safe library-side \"local\" screen to fall back to).\n */\n computerDriver?: IComputerDriver;\n}\n\n/**\n * ARCH-035: returns `FunctionTool[]`, which is what every factory below actually returns.\n *\n * An earlier revision cast each one to `IToolWithEventService` because session assembly consumes that\n * interface. The cast was lossy in the direction that mattered: `ICapabilityPack.tools` is\n * `readonly FunctionTool[]`, so a pack CONSUMING this set could not assign it without a second cast\n * back — one erasure creating the need for another. `FunctionTool` satisfies `IToolWithEventService`,\n * so session assembly is unaffected and no cast is needed at either end.\n */\nexport function createDefaultTools(options: ICreateDefaultToolsOptions): FunctionTool[] {\n // Issue #3081: the sandbox's filesystem relation decides where file tools read and write. On a\n // SEPARATE filesystem every file tool goes through the sandbox — and `Glob`/`Grep`, which have no\n // sandbox path, are withheld, so a search can never read the host while an edit writes the\n // sandbox. On a SHARED filesystem (commands confined over the host's) file tools stay on the host\n // under the path guard, and only commands run through the sandbox.\n const separate = routesFilesThroughSandbox(options.sandboxClient);\n const { sandboxClient: _commandsOnly, ...hostFileOptions } = options;\n const fileOptions = separate ? options : hostFileOptions;\n return [\n createShellTool(options),\n createBashTool(options),\n createReadTool(fileOptions),\n createWriteTool(fileOptions),\n createEditTool(fileOptions),\n // SEC-007: built per call, NOT the module-level singletons. A singleton is context-free by\n // construction, so registering one meant `Glob`/`Grep` could enumerate outside the session's\n // working directory while `Read`/`Write`/`Edit` were contained.\n ...(separate ? [] : [createGlobTool(options), createGrepTool(options)]),\n webFetchTool,\n webSearchTool,\n createAskUserQuestionTool(),\n // Retrieval is adapter-gated: absent when no adapter is supplied (there is no host fallback).\n ...(options.retrievalAdapter\n ? [createRetrievalTool({ adapter: options.retrievalAdapter })]\n : []),\n // Computer-use is adapter-gated on the driver: absent when no driver is supplied. There is NO host\n // fallback (unlike the shell tool's host spawn) — no library-side \"local\" screen exists.\n ...(options.computerDriver ? createComputerTool({ driver: options.computerDriver }) : []),\n ];\n}\n"],"mappings":"uUA0EA,SAAgB,EAAmB,EAAqD,CAMtF,IAAM,EAAW,EAA0B,EAAQ,aAAa,EAC1D,CAAE,cAAe,EAAe,GAAG,GAAoB,EACvD,EAAc,EAAW,EAAU,EACzC,MAAO,CACL,EAAgB,CAAO,EACvB,EAAe,CAAO,EACtB,EAAe,CAAW,EAC1B,EAAgB,CAAW,EAC3B,EAAe,CAAW,EAI1B,GAAI,EAAW,CAAC,EAAI,CAAC,EAAe,CAAO,EAAG,EAAe,CAAO,CAAC,EACrE,EACA,EACA,EAA0B,EAE1B,GAAI,EAAQ,iBACR,CAAC,EAAoB,CAAE,QAAS,EAAQ,gBAAiB,CAAC,CAAC,EAC3D,CAAC,EAGL,GAAI,EAAQ,eAAiB,EAAmB,CAAE,OAAQ,EAAQ,cAAe,CAAC,EAAI,CAAC,CACzF,CACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/create-default-tools.ts"],"sourcesContent":["/**\n * The DEFAULT TOOL SET — a composition leaf.\n *\n * ARCH-035 moved this out of `@robota-sdk/agent-framework`. It is a defaults aggregator, and\n * `.agents/project-structure.md` classifies that family as a composition leaf \"imported only at\n * composition roots (entry-point-only)\" — not something a mid-layer assembly library owns, publishes\n * and self-consumes.\n *\n * The move is what carries the guarantee. `agent-subagent-runner` may depend on `agent-framework`\n * (it needs `createSubagentSession` and friends) but has no manifest edge to THIS package, so\n * `import { createDefaultTools } from '@robota-sdk/agent-tool-defaults'` does not resolve there at\n * all. A neutral runner composing the product's tool surface is now a compile error rather than a\n * scan finding — the same shape ARCH-021 achieved on the provider axis with\n * `@robota-sdk/agent-builtin-providers`.\n *\n * `DEFAULT_TOOL_DESCRIPTIONS` deliberately did NOT come along: its only consumer builds the system\n * prompt synchronously, and dragging it here would force either a static edge back into this leaf or\n * a second async hop through prompt building. It stays beside its consumer in `agent-framework`.\n */\nimport {\n createAskUserQuestionTool,\n createShellTool,\n createBashTool,\n createReadTool,\n createWriteTool,\n createEditTool,\n createRetrievalTool,\n createComputerTool,\n createGlobTool,\n createGrepTool,\n createWebFetchTool,\n createWebSearchTool,\n routesFilesThroughSandbox,\n} from '@robota-sdk/agent-tools';\n\nimport type { FunctionTool } from '@robota-sdk/agent-core';\nimport type { ISandboxClient, IRetrievalAdapter, IComputerDriver } from '@robota-sdk/agent-tools';\n\n/**\n * Create the default set of CLI tools.\n * Returns the standard tools.\n */\nexport interface ICreateDefaultToolsOptions {\n sandboxClient?: ISandboxClient;\n /** Host-selected executable for Shell and Bash. */\n shellExecutable?: string;\n /**\n * The execution root every file tool is contained by. REQUIRED — ARCH-010.\n *\n * It was optional, and `child-process-subagent-worker.ts` called this factory with no argument at\n * all: `cwd` was `undefined`, the path guard was fail-open, and the subagent's `Read` returned\n * `/etc/hostname`. Requiring it means a construction site that forgets does not compile, which is\n * the only way a containment root stays a contract rather than a convention.\n */\n cwd: string;\n /** SELFHOST-003: when present, adds the adapter-gated `CodebaseRetrieval` tool (absent otherwise). */\n retrievalAdapter?: IRetrievalAdapter;\n /**\n * SELFHOST-010: when present, adds the adapter-gated `ComputerView` + `Computer` tools. Unlike the\n * shell tool's host `spawn` fallback, computer-use has NO host fallback — with no driver the tools are\n * simply ABSENT (there is no safe library-side \"local\" screen to fall back to).\n */\n computerDriver?: IComputerDriver;\n}\n\n/**\n * ARCH-035: returns `FunctionTool[]`, which is what every factory below actually returns.\n *\n * An earlier revision cast each one to `IToolWithEventService` because session assembly consumes that\n * interface. The cast was lossy in the direction that mattered: `ICapabilityPack.tools` is\n * `readonly FunctionTool[]`, so a pack CONSUMING this set could not assign it without a second cast\n * back — one erasure creating the need for another. `FunctionTool` satisfies `IToolWithEventService`,\n * so session assembly is unaffected and no cast is needed at either end.\n */\nexport function createDefaultTools(options: ICreateDefaultToolsOptions): FunctionTool[] {\n // Issue #3081: the sandbox's filesystem relation decides where file tools read and write. On a\n // SEPARATE filesystem every file tool goes through the sandbox — and `Glob`/`Grep`, which have no\n // sandbox path, are withheld, so a search can never read the host while an edit writes the\n // sandbox. On a SHARED filesystem (commands confined over the host's) file tools stay on the host\n // under the path guard, and only commands run through the sandbox.\n const separate = routesFilesThroughSandbox(options.sandboxClient);\n const { sandboxClient: _commandsOnly, ...hostFileOptions } = options;\n const fileOptions = separate ? options : hostFileOptions;\n return [\n createShellTool(options),\n createBashTool(options),\n createReadTool(fileOptions),\n createWriteTool(fileOptions),\n createEditTool(fileOptions),\n // SEC-007: built per call, NOT the module-level singletons. A singleton is context-free by\n // construction, so registering one meant `Glob`/`Grep` could enumerate outside the session's\n // working directory while `Read`/`Write`/`Edit` were contained.\n ...(separate ? [] : [createGlobTool(options), createGrepTool(options)]),\n // MUST 4: also built per call, for the same reason — `webFetchTool`/`webSearchTool` are\n // module-level singletons in `agent-tools`, so two concurrently open sessions built from this\n // set (e.g. two `sessionParticipant`s) shared them and tripped `resource-reused` even though\n // nothing about a WebFetch/WebSearch tool actually needs to be shared across sessions.\n createWebFetchTool(),\n createWebSearchTool(),\n createAskUserQuestionTool(),\n // Retrieval is adapter-gated: absent when no adapter is supplied (there is no host fallback).\n ...(options.retrievalAdapter\n ? [createRetrievalTool({ adapter: options.retrievalAdapter })]\n : []),\n // Computer-use is adapter-gated on the driver: absent when no driver is supplied. There is NO host\n // fallback (unlike the shell tool's host spawn) — no library-side \"local\" screen exists.\n ...(options.computerDriver ? createComputerTool({ driver: options.computerDriver }) : []),\n ];\n}\n"],"mappings":"mVA0EA,SAAgB,EAAmB,EAAqD,CAMtF,IAAM,EAAW,EAA0B,EAAQ,aAAa,EAC1D,CAAE,cAAe,EAAe,GAAG,GAAoB,EACvD,EAAc,EAAW,EAAU,EACzC,MAAO,CACL,EAAgB,CAAO,EACvB,EAAe,CAAO,EACtB,EAAe,CAAW,EAC1B,EAAgB,CAAW,EAC3B,EAAe,CAAW,EAI1B,GAAI,EAAW,CAAC,EAAI,CAAC,EAAe,CAAO,EAAG,EAAe,CAAO,CAAC,EAKrE,EAAmB,EACnB,EAAoB,EACpB,EAA0B,EAE1B,GAAI,EAAQ,iBACR,CAAC,EAAoB,CAAE,QAAS,EAAQ,gBAAiB,CAAC,CAAC,EAC3D,CAAC,EAGL,GAAI,EAAQ,eAAiB,EAAmB,CAAE,OAAQ,EAAQ,cAAe,CAAC,EAAI,CAAC,CACzF,CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robota-sdk/agent-tool-defaults",
3
- "version": "3.0.0-beta.83",
3
+ "version": "3.0.0-beta.84",
4
4
  "description": "The SDK's built-in default tool set (createDefaultTools) as a composition leaf over agent-tools",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -54,9 +54,10 @@
54
54
  "url": "https://github.com/woojubb/robota.git",
55
55
  "directory": "packages/agent-tool-defaults"
56
56
  },
57
+ "homepage": "https://docs.robota.io/en/packages/agent-tool-defaults/",
57
58
  "dependencies": {
58
- "@robota-sdk/agent-core": "3.0.0-beta.83",
59
- "@robota-sdk/agent-tools": "3.0.0-beta.83"
59
+ "@robota-sdk/agent-tools": "3.0.0-beta.84",
60
+ "@robota-sdk/agent-core": "3.0.0-beta.84"
60
61
  },
61
62
  "volta": {
62
63
  "extends": "../../package.json"
@@ -89,6 +89,23 @@ describe('createDefaultTools', () => {
89
89
  }
90
90
  });
91
91
 
92
+ // MUST 4: `WebFetch`/`WebSearch` used to be the module-level singletons `webFetchTool` /
93
+ // `webSearchTool` from `@robota-sdk/agent-tools` — the SAME object on every call. Two
94
+ // concurrently open sessions each built from `createDefaultTools({cwd})` then shared them and
95
+ // tripped a resource guard's `resource-reused` even though nothing about either tool needs
96
+ // sharing across sessions. A fresh instance per call is the fix, mirroring Glob/Grep (SEC-007).
97
+ it('MUST 4: WebFetch and WebSearch are fresh instances per call, not context-free singletons', () => {
98
+ const first = createDefaultTools({ cwd: ASSEMBLY_ROOT });
99
+ const second = createDefaultTools({ cwd: ASSEMBLY_ROOT });
100
+ for (const name of ['WebFetch', 'WebSearch']) {
101
+ const a = first.find((tool) => tool.getName() === name);
102
+ const b = second.find((tool) => tool.getName() === name);
103
+ expect(a, `${name} must be part of the default set`).toBeDefined();
104
+ expect(b).toBeDefined();
105
+ expect(a).not.toBe(b);
106
+ }
107
+ });
108
+
92
109
  // SELFHOST-003 TC-03: the retrieval adapter is threaded through assembly and the tool is
93
110
  // adapter-gated — absent with no adapter, present (and only then) when an adapter is supplied.
94
111
  it('TC-03: CodebaseRetrieval joins the default set only when a retrieval adapter is supplied', () => {
@@ -28,8 +28,8 @@ import {
28
28
  createComputerTool,
29
29
  createGlobTool,
30
30
  createGrepTool,
31
- webFetchTool,
32
- webSearchTool,
31
+ createWebFetchTool,
32
+ createWebSearchTool,
33
33
  routesFilesThroughSandbox,
34
34
  } from '@robota-sdk/agent-tools';
35
35
 
@@ -91,8 +91,12 @@ export function createDefaultTools(options: ICreateDefaultToolsOptions): Functio
91
91
  // construction, so registering one meant `Glob`/`Grep` could enumerate outside the session's
92
92
  // working directory while `Read`/`Write`/`Edit` were contained.
93
93
  ...(separate ? [] : [createGlobTool(options), createGrepTool(options)]),
94
- webFetchTool,
95
- webSearchTool,
94
+ // MUST 4: also built per call, for the same reason — `webFetchTool`/`webSearchTool` are
95
+ // module-level singletons in `agent-tools`, so two concurrently open sessions built from this
96
+ // set (e.g. two `sessionParticipant`s) shared them and tripped `resource-reused` even though
97
+ // nothing about a WebFetch/WebSearch tool actually needs to be shared across sessions.
98
+ createWebFetchTool(),
99
+ createWebSearchTool(),
96
100
  createAskUserQuestionTool(),
97
101
  // Retrieval is adapter-gated: absent when no adapter is supplied (there is no host fallback).
98
102
  ...(options.retrievalAdapter