@thinkwell/conductor 0.5.5 → 0.5.6
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/dist/conductor.js +627 -935
- package/dist/connectors/channel.js +75 -142
- package/dist/connectors/index.js +1 -5
- package/dist/connectors/stdio.js +100 -202
- package/dist/generated/features.d.ts +5 -0
- package/dist/generated/features.d.ts.map +1 -0
- package/dist/generated/features.js +4 -0
- package/dist/generated/features.js.map +1 -0
- package/dist/index.js +5 -73
- package/dist/instantiators.js +38 -171
- package/dist/logger.js +80 -148
- package/dist/mcp-bridge/http-listener.js +116 -212
- package/dist/mcp-bridge/index.js +0 -6
- package/dist/mcp-bridge/mcp-bridge.js +117 -164
- package/dist/mcp-bridge/types.js +0 -7
- package/dist/message-queue.js +49 -86
- package/dist/types.js +4 -11
- package/package.json +4 -3
package/dist/message-queue.js
CHANGED
|
@@ -1,90 +1,53 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Central message queue for the conductor
|
|
3
|
-
*
|
|
4
|
-
* All routing flows through this queue, preserving message ordering.
|
|
5
|
-
* The queue supports async iteration, allowing the conductor's main loop
|
|
6
|
-
* to consume messages as they arrive.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* A message queue with async iteration support.
|
|
10
|
-
*
|
|
11
|
-
* Messages can be pushed from multiple sources (client, proxies, agent)
|
|
12
|
-
* and are consumed in order by the conductor's event loop.
|
|
13
|
-
*/
|
|
14
1
|
export class MessageQueue {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
2
|
+
queue = [];
|
|
3
|
+
resolvers = [];
|
|
4
|
+
closed = !1;
|
|
5
|
+
/**
|
|
6
|
+
* Push a message onto the queue.
|
|
7
|
+
*
|
|
8
|
+
* If there's a waiting consumer, the message is delivered immediately.
|
|
9
|
+
* Otherwise, it's buffered until the next consumer is ready.
|
|
10
|
+
*/
|
|
11
|
+
push(message) {
|
|
12
|
+
this.closed || (this.resolvers.length > 0 ? this.resolvers.shift()(message) : this.queue.push(message));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Close the queue, causing the async iterator to complete.
|
|
16
|
+
*/
|
|
17
|
+
close() {
|
|
18
|
+
this.closed = !0;
|
|
19
|
+
for (const resolve of this.resolvers)
|
|
20
|
+
resolve({ type: "shutdown" });
|
|
21
|
+
this.resolvers = [];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check if the queue has been closed
|
|
25
|
+
*/
|
|
26
|
+
isClosed() {
|
|
27
|
+
return this.closed;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Async iterator for consuming messages.
|
|
31
|
+
*
|
|
32
|
+
* This allows the conductor to use `for await` to process messages:
|
|
33
|
+
* ```typescript
|
|
34
|
+
* for await (const msg of messageQueue) {
|
|
35
|
+
* await handleMessage(msg);
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
async *[Symbol.asyncIterator]() {
|
|
40
|
+
for (; !this.closed; ) {
|
|
41
|
+
let message;
|
|
42
|
+
if (this.queue.length > 0 ? message = this.queue.shift() : message = await new Promise((resolve) => {
|
|
43
|
+
this.resolvers.push(resolve);
|
|
44
|
+
}), message.type === "shutdown")
|
|
45
|
+
return;
|
|
46
|
+
yield message;
|
|
35
47
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
close() {
|
|
40
|
-
this.closed = true;
|
|
41
|
-
// Wake up any waiting consumers so they can exit
|
|
42
|
-
for (const resolve of this.resolvers) {
|
|
43
|
-
// Push a shutdown message to signal completion
|
|
44
|
-
resolve({ type: "shutdown" });
|
|
45
|
-
}
|
|
46
|
-
this.resolvers = [];
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Check if the queue has been closed
|
|
50
|
-
*/
|
|
51
|
-
isClosed() {
|
|
52
|
-
return this.closed;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Async iterator for consuming messages.
|
|
56
|
-
*
|
|
57
|
-
* This allows the conductor to use `for await` to process messages:
|
|
58
|
-
* ```typescript
|
|
59
|
-
* for await (const msg of messageQueue) {
|
|
60
|
-
* await handleMessage(msg);
|
|
61
|
-
* }
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
async *[Symbol.asyncIterator]() {
|
|
65
|
-
while (!this.closed) {
|
|
66
|
-
let message;
|
|
67
|
-
if (this.queue.length > 0) {
|
|
68
|
-
message = this.queue.shift();
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
message = await new Promise((resolve) => {
|
|
72
|
-
this.resolvers.push(resolve);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
// Check for shutdown message
|
|
76
|
-
if (message.type === "shutdown") {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
yield message;
|
|
80
|
-
}
|
|
81
|
-
// Drain any remaining messages in the queue
|
|
82
|
-
while (this.queue.length > 0) {
|
|
83
|
-
const message = this.queue.shift();
|
|
84
|
-
if (message.type !== "shutdown") {
|
|
85
|
-
yield message;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
48
|
+
for (; this.queue.length > 0; ) {
|
|
49
|
+
const message = this.queue.shift();
|
|
50
|
+
message.type !== "shutdown" && (yield message);
|
|
88
51
|
}
|
|
52
|
+
}
|
|
89
53
|
}
|
|
90
|
-
//# sourceMappingURL=message-queue.js.map
|
package/dist/types.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal types for the conductor
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Role relationships - encode at runtime what Rust does at compile time
|
|
6
|
-
*/
|
|
7
1
|
export const ROLE_COUNTERPART = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
client: "agent",
|
|
3
|
+
agent: "client",
|
|
4
|
+
proxy: "conductor",
|
|
5
|
+
conductor: "proxy"
|
|
12
6
|
};
|
|
13
|
-
//# sourceMappingURL=types.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thinkwell/conductor",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "TypeScript conductor for ACP proxy chains - orchestrates message routing between clients, proxies, and agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"author": "David Herman",
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@thinkwell/protocol": "0.5.
|
|
29
|
+
"@thinkwell/protocol": "0.5.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^24.10.4",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"typescript": "^5.7.2"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build": "tsc",
|
|
37
|
+
"build": "tsc && tsx ../../scripts/strip-features.ts --mode=release",
|
|
38
|
+
"build:debug": "tsc",
|
|
38
39
|
"clean": "rm -rf dist",
|
|
39
40
|
"test": "node --test --import tsx src/**/*.test.ts"
|
|
40
41
|
}
|