@crewhaus/tool-orchestrator 0.1.1 → 0.1.3
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 +8 -13
- package/src/index.test.ts +26 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewhaus/tool-orchestrator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Partition tool_use blocks into concurrent batches and serial calls based on catalog metadata",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
"test": "bun test src"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@crewhaus/errors": "0.1.
|
|
16
|
-
"@crewhaus/tool-catalog": "0.1.
|
|
17
|
-
"@crewhaus/turn-state-machine": "0.1.
|
|
15
|
+
"@crewhaus/errors": "0.1.3",
|
|
16
|
+
"@crewhaus/tool-catalog": "0.1.3",
|
|
17
|
+
"@crewhaus/turn-state-machine": "0.1.3"
|
|
18
18
|
},
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"author": {
|
|
21
21
|
"name": "Max Meier",
|
|
22
|
-
"email": "max@
|
|
23
|
-
"url": "https://
|
|
22
|
+
"email": "max@crewhaus.ai",
|
|
23
|
+
"url": "https://crewhaus.ai"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
@@ -32,12 +32,7 @@
|
|
|
32
32
|
"url": "https://github.com/crewhaus/factory/issues"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
|
-
"access": "
|
|
35
|
+
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"files": [
|
|
38
|
-
"src",
|
|
39
|
-
"README.md",
|
|
40
|
-
"LICENSE",
|
|
41
|
-
"NOTICE"
|
|
42
|
-
]
|
|
37
|
+
"files": ["src", "README.md", "LICENSE", "NOTICE"]
|
|
43
38
|
}
|
package/src/index.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import type
|
|
2
|
+
import { type RegisteredTool, ToolCatalog } from "@crewhaus/tool-catalog";
|
|
3
3
|
import type { ToolUseBlock } from "@crewhaus/turn-state-machine";
|
|
4
4
|
import { isConcurrencySafe, partitionToolCalls } from "./index";
|
|
5
5
|
|
|
@@ -118,6 +118,31 @@ describe("partitionToolCalls — accepts ToolCatalog", () => {
|
|
|
118
118
|
expect(out.concurrent.length).toBe(1);
|
|
119
119
|
expect(out.concurrent[0]?.[0]?.id).toBe("1");
|
|
120
120
|
});
|
|
121
|
+
|
|
122
|
+
test("accepts a real ToolCatalog object (exercises the .get() lookup adapter)", () => {
|
|
123
|
+
// Passing a ToolCatalog instance (not a function) routes asLookup through
|
|
124
|
+
// the `(name) => lookup.get(name)` branch.
|
|
125
|
+
const catalog = new ToolCatalog();
|
|
126
|
+
catalog.register(READ);
|
|
127
|
+
catalog.register(BASH);
|
|
128
|
+
const calls = [call("Read", "1"), call("Bash", "2"), call("Read", "3")];
|
|
129
|
+
const out = partitionToolCalls(calls, catalog);
|
|
130
|
+
// Read is concurrency-safe (own batch), Bash is destructive (serial),
|
|
131
|
+
// trailing Read opens a fresh batch.
|
|
132
|
+
expect(out.concurrent.length).toBe(2);
|
|
133
|
+
expect(out.concurrent[0]?.map((c) => c.id)).toEqual(["1"]);
|
|
134
|
+
expect(out.concurrent[1]?.map((c) => c.id)).toEqual(["3"]);
|
|
135
|
+
expect(out.serial.map((c) => c.id)).toEqual(["2"]);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test("ToolCatalog lookup treats unregistered names as unknown → serial", () => {
|
|
139
|
+
const catalog = new ToolCatalog();
|
|
140
|
+
catalog.register(READ);
|
|
141
|
+
const calls = [call("Read", "1"), call("Ghost", "2")];
|
|
142
|
+
const out = partitionToolCalls(calls, catalog);
|
|
143
|
+
expect(out.concurrent[0]?.map((c) => c.id)).toEqual(["1"]);
|
|
144
|
+
expect(out.serial.map((c) => c.id)).toEqual(["2"]);
|
|
145
|
+
});
|
|
121
146
|
});
|
|
122
147
|
|
|
123
148
|
// T9 property test: invariant — no concurrent batch contains a call whose
|