@orkestrel/tool 0.0.5 → 0.0.7

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/README.md CHANGED
@@ -1,29 +1,16 @@
1
1
  # @orkestrel/tool
2
2
 
3
- Concrete, LLM-callable **tools** for the `@orkestrel` line — built over
4
- [`@orkestrel/agent`](https://github.com/orkestrel/agent)'s `ToolInterface` /
5
- `createTool` runtime, with pluggable stores. Part of the `@orkestrel` line.
6
-
7
- - **`createWorkflowTool`** authors and runs an
8
- [`@orkestrel/workflow`](https://github.com/orkestrel/workflow) definition in
9
- one call (flat steps / lenient draft / full definition, depth + cycle
10
- guarded), with an optional pluggable `WorkflowStoreInterface` that persists
11
- each executed run's snapshot on settle.
12
- - **`createWorkspaceTool`** a 13-operation workspace-editing tool driving
13
- `@orkestrel/agent`'s workspace runtime, either against a caller-supplied
14
- manager or a fresh one built over a pluggable `WorkspaceStoreInterface`.
15
- - **`createAgentTool`** — net-new sub-agent delegation: resolves and runs one
16
- seeded agent via an `AgentRegistryInterface`, depth + cycle guarded,
17
- deliberately storeless (persistence, if any, rides the registry's own
18
- configuration).
19
- - **Adapters** — `createToolFunction` / `createAgentFunction` compose a
20
- registered tool or a live agent into a workflow's `functions` registry, plus
21
- the authoring umbrella (`WorkflowSteps` / `WorkflowDraft`,
22
- `createWorkflowDraftContract`, `workflowToolSummary`, `MAX_WORKFLOW_DEPTH`).
23
-
24
- **Status: v0.0.1 pending publish**, once the upstream `@orkestrel/workflow` /
25
- `@orkestrel/agent` cleanups that drop their authoring surfaces (this package
26
- becomes the defining home) land.
3
+ The tool runtime for the `@orkestrel` line.
4
+
5
+ A tool is a callable function described by a JSON Schema: a name, an optional description, an
6
+ optional parameter schema, and the handler that runs it. That is the whole idea — a tool is an
7
+ API call whose shape is data, so whoever calls it can discover it, present it, and invoke it
8
+ without knowing anything about the code behind it. This package ships that shape and the
9
+ registry around it: definitions to advertise, calls to dispatch, results to correlate, and
10
+ per-call error isolation so one bad tool never takes down the run.
11
+
12
+ Nothing here is model-specific. An agent loop, an MCP bridge, and plain application code are all
13
+ just callers.
27
14
 
28
15
  ## Install
29
16
 
@@ -31,20 +18,51 @@ becomes the defining home) land.
31
18
  npm install @orkestrel/tool
32
19
  ```
33
20
 
34
- ## Requirements
21
+ ## Example
35
22
 
36
- - Node.js >= 22
37
- - Dual ESM + CommonJS builds (`import` and `require` both supported)
23
+ ```ts
24
+ import { createTool, createToolManager } from '@orkestrel/tool'
38
25
 
39
- ## Guide
26
+ const tools = createToolManager()
27
+ tools.add(
28
+ createTool({
29
+ name: 'add',
30
+ description: 'Add two numeric values and return their sum.',
31
+ parameters: {
32
+ type: 'object',
33
+ properties: {
34
+ left: { type: 'number' },
35
+ right: { type: 'number' },
36
+ },
37
+ required: ['left', 'right'],
38
+ },
39
+ execute: (args) => Number(args.left) + Number(args.right),
40
+ }),
41
+ )
40
42
 
41
- See [`guides/src/tool.md`](guides/src/tool.md).
43
+ tools.definitions() // hand these to whatever chooses the call
44
+
45
+ const result = await tools.execute({
46
+ id: 'call-1',
47
+ name: 'add',
48
+ arguments: { left: 2, right: 3 },
49
+ })
50
+ result.value // 5 — or result.error, when the call failed
51
+ ```
42
52
 
43
- ## Package
53
+ Handlers may be synchronous or asynchronous. An unknown name or a thrown handler becomes an
54
+ error result instead of escaping, and a batch runs concurrently, stays isolated per call, and
55
+ answers in input order.
56
+
57
+ Ready-made tools ship in `@orkestrel/toolbox`.
58
+
59
+ See the [tool guide](guides/src/tool.md) for the complete surface and behavior.
60
+
61
+ ## Requirements
44
62
 
45
- Published as a single typed entry point per the `exports` field in
46
- `package.json`.
63
+ - Node.js 22.12 or newer
64
+ - ESM and CommonJS consumers
47
65
 
48
66
  ## License
49
67
 
50
- MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](./LICENSE).
68
+ MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](LICENSE).