shadow-claw 1.40.0 → 1.40.1
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/.well-known/mcp/server-card.json +2 -2
- package/.well-known/mcp/servers.json +1 -1
- package/.well-known/mcp.json +2 -2
- package/dist/cli/cli.js +2 -2
- package/dist/lib/components/index.js +2 -2
- package/dist/lib/components/shadow-claw-file-viewer/shadow-claw-file-viewer.d.ts +1 -1
- package/dist/lib/components/shadow-claw-file-viewer.js +1 -1
- package/dist/lib/components/shadow-claw.js +1 -1
- package/dist/lib/core/orchestrator/orchestrator-state.d.ts +2 -1
- package/dist/lib/core/orchestrator/orchestrator.d.ts +2 -1
- package/dist/lib/core/orchestrator/utils/operations/task.d.ts +1 -0
- package/dist/lib/index.js +2 -2
- package/dist/lib/{orchestrator-Bq9ft3uG.js → orchestrator-CMN43L0F.js} +9 -13
- package/dist/lib/orchestrator-CMN43L0F.js.map +1 -0
- package/dist/lib/orchestrator-D9f5fDCb.js.map +1 -1
- package/dist/lib/{shadow-claw-MumteAJy.js → shadow-claw-4x3LqlII.js} +2 -2
- package/dist/lib/{shadow-claw-MumteAJy.js.map → shadow-claw-4x3LqlII.js.map} +1 -1
- package/dist/lib/{shadow-claw-file-viewer-CMOnFmcP.js → shadow-claw-file-viewer-CuDhkVcL.js} +21 -21
- package/dist/lib/{shadow-claw-file-viewer-CMOnFmcP.js.map → shadow-claw-file-viewer-CuDhkVcL.js.map} +1 -1
- package/dist/lib/syncWebMcpRegistration-Bbph0XZl.js.map +1 -1
- package/dist/public/.well-known/mcp/server-card.json +2 -2
- package/dist/public/.well-known/mcp/servers.json +1 -1
- package/dist/public/.well-known/mcp.json +2 -2
- package/dist/public/docs/decisions/native-web-components-and-signals.md +1 -1
- package/dist/public/docs/example/article/index.html +2 -2
- package/dist/public/docs/publishing/index.html +2 -2
- package/dist/public/docs/skill-creator/index.html +2 -2
- package/dist/public/index.html +2 -2
- package/dist/public/index.js +1 -1
- package/dist/public/main/index.html +2 -2
- package/dist/public/main/memory/index.html +2 -2
- package/dist/public/{orchestrator-BLkS_jpm.js → orchestrator-Dc_Q73La.js} +1 -1
- package/dist/public/service-worker.js +1 -1
- package/dist/public/{shadow-claw-DmrxnX3Q.js → shadow-claw-Dabb2AEp.js} +2 -2
- package/dist/public/{shadow-claw-file-viewer-a_uRA30F.js → shadow-claw-file-viewer-CDs1QGXk.js} +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
- package/src/cli/cli.ts +2 -2
- package/src/components/shadow-claw-file-viewer/shadow-claw-file-viewer.ts +31 -31
- package/src/core/effect.test.ts +19 -0
- package/src/core/orchestrator/orchestrator-state.ts +2 -1
- package/src/core/orchestrator/orchestrator.test.ts +686 -5
- package/src/core/orchestrator/orchestrator.ts +3 -10
- package/src/core/orchestrator/utils/compactContext.test.ts +423 -121
- package/src/core/orchestrator/utils/configurePeerJs.test.ts +27 -0
- package/src/core/orchestrator/utils/deliverResponse.test.ts +127 -0
- package/src/core/orchestrator/utils/dispatchSubagentInvoke.test.ts +23 -0
- package/src/core/orchestrator/utils/enqueue.test.ts +520 -86
- package/src/core/orchestrator/utils/handleWorkerMessage.test.ts +664 -144
- package/src/core/orchestrator/utils/initTasks.node.test.ts +147 -0
- package/src/core/orchestrator/utils/initTasks.test.ts +926 -191
- package/src/core/orchestrator/utils/initTasks.ts +5 -4
- package/src/core/orchestrator/utils/invokeAgent.test.ts +563 -110
- package/src/core/orchestrator/utils/invokeAgent.ts +8 -10
- package/src/core/orchestrator/utils/loadChannelConfigurations.test.ts +50 -0
- package/src/core/orchestrator/utils/operations/channel.test.ts +377 -170
- package/src/core/orchestrator/utils/operations/provider.test.ts +663 -85
- package/src/core/orchestrator/utils/operations/room.test.ts +74 -11
- package/src/core/orchestrator/utils/operations/task.test.ts +452 -56
- package/src/core/orchestrator/utils/operations/task.ts +1 -1
- package/src/core/orchestrator/utils/operations/vm.test.ts +66 -7
- package/src/core/orchestrator/utils/parseDirectToolCommand.test.ts +6 -0
- package/src/core/orchestrator/utils/settings.test.ts +248 -81
- package/src/core/orchestrator/utils/setupPushTaskListener.test.ts +58 -0
- package/src/core/orchestrator/utils/syncWebMcpRegistration.test.ts +341 -65
- package/src/core/orchestrator/utils/syncWebMcpRegistration.ts +4 -2
- package/src/server/routes/mcp.ts +2 -2
- package/src/stores/file-viewer.test.ts +11 -0
- package/src/stores/theme.test.ts +41 -2
- package/src/stores/toast.test.ts +25 -0
- package/src/worker/tools/bash/native-bash-executor.test.ts +31 -1
- package/src/worker/tools/git/utils/extractConflictPaths.test.ts +24 -0
- package/src/worker/tools/git/utils/parseConflictRegions.test.ts +46 -0
- package/src/worker/tools/git/utils/resolveCorsProxy.test.ts +26 -5
- package/src/worker/tools/git/utils/truncateSnippet.test.ts +16 -0
- package/src/worker/tools/node-transformers-executor.test.ts +105 -6
- package/src/worker/tools/remote-mcp/remote-mcp.test.ts +172 -47
- package/src/worker/tools/remote-mcp/utils/formatListToolsOutput.test.ts +19 -0
- package/src/worker/tools/remote-mcp/utils/isMcpReauthError.test.ts +45 -0
- package/src/worker/tools/remote-mcp/utils/resolveMcpReauth.test.ts +48 -0
- package/src/worker/tools/rooms/list-room-members.test.ts +24 -10
- package/src/worker/tools/tasks/list-tasks.test.ts +39 -8
- package/src/worker/tools/tasks/update-task.test.ts +78 -14
- package/src/worker/tools/ui/javascript.test.ts +70 -17
- package/src/worker/tools/ui/list-tool-profiles.test.ts +31 -9
- package/dist/lib/orchestrator-Bq9ft3uG.js.map +0 -1
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
} from "./operations/provider.js";
|
|
51
51
|
|
|
52
52
|
import type { ShadowClawDatabase } from "../../../db/db.js";
|
|
53
|
+
import type { ToolDefinition } from "../../../subsystems/tools/types.js";
|
|
53
54
|
import type { SubagentInvokeContext } from "../../../worker/tools/spawn-subagent/spawn-subagent.js";
|
|
54
55
|
import type { Orchestrator } from "../orchestrator.js";
|
|
55
56
|
|
|
@@ -197,10 +198,7 @@ export async function invokeAgent(
|
|
|
197
198
|
const contextLimit = getContextLimit(modelForTokenLimits);
|
|
198
199
|
const systemPromptTokens =
|
|
199
200
|
estimateTokens(systemPrompt) +
|
|
200
|
-
|
|
201
|
-
(acc, t) => acc + estimateTokens(JSON.stringify(t)),
|
|
202
|
-
0,
|
|
203
|
-
) ?? 0);
|
|
201
|
+
activeTools.reduce((acc, t) => acc + estimateTokens(JSON.stringify(t)), 0);
|
|
204
202
|
let allMessages = await buildConversationMessages(groupId, 200);
|
|
205
203
|
if (freshContext) {
|
|
206
204
|
if (allMessages.length > 0) {
|
|
@@ -265,12 +263,12 @@ export async function invokeAgent(
|
|
|
265
263
|
apiKey: "",
|
|
266
264
|
assistantName: o.assistantName,
|
|
267
265
|
db,
|
|
268
|
-
enabledTools: activeTools as
|
|
266
|
+
enabledTools: activeTools as unknown as ToolDefinition[],
|
|
269
267
|
invokeSubagent: async (subPayload) => {
|
|
270
268
|
await dispatchSubagentInvoke(db, subPayload, controller.signal);
|
|
271
269
|
},
|
|
272
270
|
maxTokens: effectiveMaxTokens,
|
|
273
|
-
memory
|
|
271
|
+
memory,
|
|
274
272
|
model: effectiveModel,
|
|
275
273
|
provider: effectiveProviderId,
|
|
276
274
|
providerHeaders: getProviderRuntimeHeaders(
|
|
@@ -345,12 +343,12 @@ export async function invokeAgent(
|
|
|
345
343
|
apiKey: "",
|
|
346
344
|
assistantName: o.assistantName,
|
|
347
345
|
db,
|
|
348
|
-
enabledTools: activeTools as
|
|
346
|
+
enabledTools: activeTools as unknown as ToolDefinition[],
|
|
349
347
|
invokeSubagent: async (subPayload) => {
|
|
350
348
|
await dispatchSubagentInvoke(db, subPayload, controller.signal);
|
|
351
349
|
},
|
|
352
350
|
maxTokens: effectiveMaxTokens,
|
|
353
|
-
memory
|
|
351
|
+
memory,
|
|
354
352
|
model: effectiveModel,
|
|
355
353
|
provider: effectiveProviderId,
|
|
356
354
|
providerHeaders: getProviderRuntimeHeaders(
|
|
@@ -421,12 +419,12 @@ export async function invokeAgent(
|
|
|
421
419
|
apiKey: "",
|
|
422
420
|
assistantName: o.assistantName,
|
|
423
421
|
db,
|
|
424
|
-
enabledTools: activeTools as
|
|
422
|
+
enabledTools: activeTools as unknown as ToolDefinition[],
|
|
425
423
|
invokeSubagent: async (subPayload) => {
|
|
426
424
|
await dispatchSubagentInvoke(db, subPayload, controller.signal);
|
|
427
425
|
},
|
|
428
426
|
maxTokens: effectiveMaxTokens,
|
|
429
|
-
memory
|
|
427
|
+
memory,
|
|
430
428
|
model: effectiveModel,
|
|
431
429
|
provider: effectiveProviderId,
|
|
432
430
|
providerHeaders: getProviderRuntimeHeaders(
|
|
@@ -196,4 +196,54 @@ describe("loadChannelConfigurations", () => {
|
|
|
196
196
|
|
|
197
197
|
consoleWarn.mockRestore();
|
|
198
198
|
});
|
|
199
|
+
|
|
200
|
+
it("should configure empty peerjs server config when host is empty", async () => {
|
|
201
|
+
mockGetConfig.mockImplementation(async (_db: any, key: string) => {
|
|
202
|
+
if (key === "PEERJS_SERVER_HOST") return "";
|
|
203
|
+
if (key === "PEERJS_SERVER_PORT") return "not-a-number";
|
|
204
|
+
if (key === "PEERJS_PEER_ALIASES") return null;
|
|
205
|
+
return null;
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
await loadChannelConfigurations(mockOrchestrator, mockDb);
|
|
209
|
+
|
|
210
|
+
expect(mockOrchestrator.peerjsServerPort).toBe(0);
|
|
211
|
+
expect(mockOrchestrator.peerjsPeerAliases).toEqual({});
|
|
212
|
+
expect(mockOrchestrator.peerjs.configure).toHaveBeenCalledWith(
|
|
213
|
+
"",
|
|
214
|
+
["id1", "id2"],
|
|
215
|
+
{},
|
|
216
|
+
);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it("should omit port and path when they are zero or empty and host is set", async () => {
|
|
220
|
+
mockGetConfig.mockImplementation(async (_db: any, key: string) => {
|
|
221
|
+
if (key === "PEERJS_SERVER_HOST") return "custom-host";
|
|
222
|
+
if (key === "PEERJS_SERVER_PORT") return "0";
|
|
223
|
+
if (key === "PEERJS_SERVER_PATH") return "";
|
|
224
|
+
return null;
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
await loadChannelConfigurations(mockOrchestrator, mockDb);
|
|
228
|
+
|
|
229
|
+
expect(mockOrchestrator.peerjs.configure).toHaveBeenCalledWith(
|
|
230
|
+
"",
|
|
231
|
+
["id1", "id2"],
|
|
232
|
+
{
|
|
233
|
+
host: "custom-host",
|
|
234
|
+
port: undefined,
|
|
235
|
+
path: undefined,
|
|
236
|
+
secure: true,
|
|
237
|
+
},
|
|
238
|
+
);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it("should evaluate fallback path in fileReader when path is empty string", async () => {
|
|
242
|
+
await loadChannelConfigurations(mockOrchestrator, mockDb);
|
|
243
|
+
|
|
244
|
+
const fileReader = mockOrchestrator.telegram.fileReader;
|
|
245
|
+
const blob = await fileReader("group1", "");
|
|
246
|
+
|
|
247
|
+
expect(blob).toBeInstanceOf(Blob);
|
|
248
|
+
});
|
|
199
249
|
});
|