claude-code-swarm 0.3.21 → 0.3.22
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-swarm",
|
|
3
3
|
"description": "Spin up Claude Code agent teams from openteams YAML topologies with optional MAP (Multi-Agent Protocol) observability and coordination. Provides hooks for session lifecycle, agent spawn/complete tracking, and a /swarm skill to launch team configurations.",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.22",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "alexngai"
|
|
7
7
|
},
|
package/package.json
CHANGED
|
@@ -5,9 +5,17 @@ import { registerOpenTasksHandler } from "../opentasks-connector.mjs";
|
|
|
5
5
|
|
|
6
6
|
const MOCK_METHODS = {
|
|
7
7
|
QUERY_REQUEST: "opentasks/query.request",
|
|
8
|
+
QUERY_RESPONSE: "opentasks/query.response",
|
|
8
9
|
LINK_REQUEST: "opentasks/link.request",
|
|
10
|
+
LINK_RESPONSE: "opentasks/link.response",
|
|
9
11
|
ANNOTATE_REQUEST: "opentasks/annotate.request",
|
|
12
|
+
ANNOTATE_RESPONSE: "opentasks/annotate.response",
|
|
10
13
|
TASK_REQUEST: "opentasks/task.request",
|
|
14
|
+
TASK_RESPONSE: "opentasks/task.response",
|
|
15
|
+
GRAPH_CREATE_REQUEST: "opentasks/graph.create.request",
|
|
16
|
+
GRAPH_CREATE_RESPONSE: "opentasks/graph.create.response",
|
|
17
|
+
GRAPH_UPDATE_REQUEST: "opentasks/graph.update.request",
|
|
18
|
+
GRAPH_UPDATE_RESPONSE: "opentasks/graph.update.response",
|
|
11
19
|
};
|
|
12
20
|
|
|
13
21
|
function createMockConnection() {
|
|
@@ -89,16 +97,53 @@ describe("registerOpenTasksHandler", () => {
|
|
|
89
97
|
expect(callArgs.agentId).toBe("swarm:test-sidecar");
|
|
90
98
|
});
|
|
91
99
|
|
|
92
|
-
it("registers onNotification for
|
|
100
|
+
it("registers onNotification for every *.request method exported by opentasks", async () => {
|
|
93
101
|
await callRegister();
|
|
94
102
|
|
|
95
|
-
|
|
103
|
+
const expectedRequestMethods = Object.values(MOCK_METHODS).filter((m) =>
|
|
104
|
+
m.endsWith(".request"),
|
|
105
|
+
);
|
|
106
|
+
expect(mockConn.onNotification).toHaveBeenCalledTimes(expectedRequestMethods.length);
|
|
96
107
|
|
|
97
108
|
const registeredMethods = mockConn.onNotification.mock.calls.map((c) => c[0]);
|
|
98
109
|
expect(registeredMethods).toContain(MOCK_METHODS.QUERY_REQUEST);
|
|
99
110
|
expect(registeredMethods).toContain(MOCK_METHODS.LINK_REQUEST);
|
|
100
111
|
expect(registeredMethods).toContain(MOCK_METHODS.ANNOTATE_REQUEST);
|
|
101
112
|
expect(registeredMethods).toContain(MOCK_METHODS.TASK_REQUEST);
|
|
113
|
+
expect(registeredMethods).toContain(MOCK_METHODS.GRAPH_CREATE_REQUEST);
|
|
114
|
+
expect(registeredMethods).toContain(MOCK_METHODS.GRAPH_UPDATE_REQUEST);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("does not register response methods (only .request is subscribed)", async () => {
|
|
118
|
+
await callRegister();
|
|
119
|
+
|
|
120
|
+
const registeredMethods = mockConn.onNotification.mock.calls.map((c) => c[0]);
|
|
121
|
+
const responseMethods = registeredMethods.filter((m) => m.endsWith(".response"));
|
|
122
|
+
expect(responseMethods).toEqual([]);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("forwards graph.create.request to the connector", async () => {
|
|
126
|
+
await callRegister();
|
|
127
|
+
|
|
128
|
+
const params = { request_id: "req-c1", create: { type: "task", title: "New" } };
|
|
129
|
+
await mockConn._fireNotification(MOCK_METHODS.GRAPH_CREATE_REQUEST, params);
|
|
130
|
+
|
|
131
|
+
expect(mockOpentasks._connector.handleNotification).toHaveBeenCalledWith(
|
|
132
|
+
MOCK_METHODS.GRAPH_CREATE_REQUEST,
|
|
133
|
+
params,
|
|
134
|
+
);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it("forwards graph.update.request to the connector", async () => {
|
|
138
|
+
await callRegister();
|
|
139
|
+
|
|
140
|
+
const params = { request_id: "req-u1", update: { id: "n-1", title: "Renamed" } };
|
|
141
|
+
await mockConn._fireNotification(MOCK_METHODS.GRAPH_UPDATE_REQUEST, params);
|
|
142
|
+
|
|
143
|
+
expect(mockOpentasks._connector.handleNotification).toHaveBeenCalledWith(
|
|
144
|
+
MOCK_METHODS.GRAPH_UPDATE_REQUEST,
|
|
145
|
+
params,
|
|
146
|
+
);
|
|
102
147
|
});
|
|
103
148
|
|
|
104
149
|
it("forwards notifications to connector.handleNotification", async () => {
|
|
@@ -63,13 +63,13 @@ export async function registerOpenTasksHandler(conn, options = {}) {
|
|
|
63
63
|
agentId: `${scope}-sidecar`,
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
// Subscribe to every `opentasks/*.request` method the opentasks package
|
|
67
|
+
// exports. Iterating MAP_CONNECTOR_METHODS (rather than hardcoding a list)
|
|
68
|
+
// means new request methods added upstream — e.g. graph.create.request,
|
|
69
|
+
// graph.update.request — are wired up automatically.
|
|
70
|
+
const requestMethods = Object.values(MAP_CONNECTOR_METHODS).filter(
|
|
71
|
+
(m) => typeof m === "string" && m.endsWith(".request"),
|
|
72
|
+
);
|
|
73
73
|
|
|
74
74
|
for (const method of requestMethods) {
|
|
75
75
|
conn.onNotification(method, async (params) => {
|