@orkestrel/tool 0.0.6 → 0.0.8
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 +55 -33
- package/dist/src/core/index.cjs +136 -3297
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +231 -2553
- package/dist/src/core/index.d.ts +231 -2553
- package/dist/src/core/index.js +133 -3193
- package/dist/src/core/index.js.map +1 -1
- package/package.json +12 -31
- package/dist/src/server/index.cjs +0 -267
- package/dist/src/server/index.cjs.map +0 -1
- package/dist/src/server/index.d.cts +0 -167
- package/dist/src/server/index.d.ts +0 -167
- package/dist/src/server/index.js +0 -262
- package/dist/src/server/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,29 +1,16 @@
|
|
|
1
1
|
# @orkestrel/tool
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
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,55 @@ becomes the defining home) land.
|
|
|
31
18
|
npm install @orkestrel/tool
|
|
32
19
|
```
|
|
33
20
|
|
|
34
|
-
##
|
|
21
|
+
## Example
|
|
35
22
|
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
```ts
|
|
24
|
+
import { createTool, createToolManager } from '@orkestrel/tool'
|
|
38
25
|
|
|
39
|
-
|
|
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
|
-
|
|
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
|
+
if (result.success) {
|
|
51
|
+
result.value // 5
|
|
52
|
+
} else {
|
|
53
|
+
result.error // the failure message
|
|
54
|
+
}
|
|
55
|
+
```
|
|
42
56
|
|
|
43
|
-
|
|
57
|
+
Handlers may be synchronous or asynchronous. An unknown name or a thrown handler becomes an
|
|
58
|
+
error result instead of escaping, and a batch runs concurrently, stays isolated per call, and
|
|
59
|
+
answers in input order.
|
|
60
|
+
|
|
61
|
+
Ready-made tools ship in `@orkestrel/toolbox`.
|
|
62
|
+
|
|
63
|
+
See the [tool guide](guides/src/tool.md) for the complete surface and behavior.
|
|
64
|
+
|
|
65
|
+
## Requirements
|
|
44
66
|
|
|
45
|
-
|
|
46
|
-
|
|
67
|
+
- Node.js 22.12 or newer
|
|
68
|
+
- ESM and CommonJS consumers
|
|
47
69
|
|
|
48
70
|
## License
|
|
49
71
|
|
|
50
|
-
MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](
|
|
72
|
+
MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](LICENSE).
|