@desplega.ai/agent-swarm 1.83.0 → 1.83.2
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/openapi.json +177 -10
- package/package.json +6 -6
- package/src/artifact-sdk/server.ts +23 -1
- package/src/be/budget-admission.ts +28 -4
- package/src/be/budget-refusal-notify.ts +19 -3
- package/src/be/db-queries/oauth.ts +43 -0
- package/src/be/db.ts +37 -4
- package/src/be/migrations/074_user_budget_scope.sql +85 -0
- package/src/be/schedules/validate.ts +21 -0
- package/src/be/skill-sync.ts +65 -15
- package/src/commands/resume-session.ts +118 -0
- package/src/commands/runner.ts +178 -121
- package/src/http/core.ts +4 -1
- package/src/http/index.ts +16 -0
- package/src/http/integrations.ts +26 -0
- package/src/http/mcp-user.ts +111 -0
- package/src/http/poll.ts +19 -5
- package/src/http/schedules.ts +35 -10
- package/src/http/skills.ts +27 -2
- package/src/http/users.ts +107 -2
- package/src/jira/client.ts +3 -5
- package/src/jira/oauth.ts +1 -0
- package/src/jira/sync.ts +2 -2
- package/src/oauth/ensure-token.ts +1 -0
- package/src/oauth/wrapper.ts +38 -7
- package/src/providers/claude-adapter.ts +7 -2
- package/src/providers/claude-managed-adapter.ts +1 -1
- package/src/providers/codex-adapter.ts +30 -0
- package/src/providers/opencode-adapter.ts +149 -14
- package/src/providers/pi-mono-adapter.ts +41 -1
- package/src/providers/types.ts +1 -1
- package/src/server-user.ts +117 -0
- package/src/tests/artifact-sdk.test.ts +23 -19
- package/src/tests/budget-user-scope.test.ts +376 -0
- package/src/tests/claude-managed-adapter.test.ts +6 -0
- package/src/tests/codex-adapter.test.ts +192 -0
- package/src/tests/codex-rate-limit-parse.test.ts +256 -0
- package/src/tests/db-queries-oauth.test.ts +43 -0
- package/src/tests/ensure-token.test.ts +93 -0
- package/src/tests/error-tracker.test.ts +52 -0
- package/src/tests/fetch-resolved-env.test.ts +33 -20
- package/src/tests/http-api-integration.test.ts +36 -0
- package/src/tests/http-users.test.ts +29 -1
- package/src/tests/mcp-user-route.test.ts +325 -0
- package/src/tests/opencode-adapter.test.ts +75 -0
- package/src/tests/pi-mono-adapter.test.ts +21 -1
- package/src/tests/rate-limit-event.test.ts +69 -6
- package/src/tests/resume-session.test.ts +93 -0
- package/src/tests/runner-skills-refresh.test.ts +200 -0
- package/src/tests/schedule-validation-helper.test.ts +51 -0
- package/src/tests/skill-sync.test.ts +73 -9
- package/src/tests/skills-signature.test.ts +141 -0
- package/src/tests/task-tools-ctx.test.ts +100 -0
- package/src/tests/task-tools-ownership.test.ts +167 -0
- package/src/tests/update-schedule-mcp-tool.test.ts +161 -0
- package/src/tests/user-token-routes.test.ts +221 -0
- package/src/tools/cancel-task.ts +137 -83
- package/src/tools/get-task-details.ts +73 -59
- package/src/tools/get-tasks.ts +134 -126
- package/src/tools/schedules/update-schedule.ts +48 -8
- package/src/tools/send-task.ts +312 -312
- package/src/tools/slack-upload-file.ts +17 -5
- package/src/tools/task-action.ts +464 -367
- package/src/tools/task-tool-ctx.ts +43 -0
- package/src/types.ts +6 -2
- package/src/utils/error-tracker.ts +122 -9
- package/src/utils/skills-refresh.ts +123 -0
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getScheduledTaskByName,
|
|
8
8
|
updateScheduledTask,
|
|
9
9
|
} from "@/be/db";
|
|
10
|
+
import { mergeScheduleTiming, validateRecurringTiming } from "@/be/schedules/validate";
|
|
10
11
|
import { calculateNextRun } from "@/scheduler";
|
|
11
12
|
import { createToolRegistrar } from "@/tools/utils";
|
|
12
13
|
|
|
@@ -23,8 +24,18 @@ export const registerUpdateScheduleTool = (server: McpServer) => {
|
|
|
23
24
|
name: z.string().optional().describe("Schedule name to update (alternative to ID)"),
|
|
24
25
|
newName: z.string().min(1).max(100).optional().describe("New name for the schedule"),
|
|
25
26
|
taskTemplate: z.string().min(1).optional().describe("New task template"),
|
|
26
|
-
cronExpression: z
|
|
27
|
-
|
|
27
|
+
cronExpression: z
|
|
28
|
+
.string()
|
|
29
|
+
.nullable()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("New cron expression (null to clear)"),
|
|
32
|
+
intervalMs: z
|
|
33
|
+
.number()
|
|
34
|
+
.int()
|
|
35
|
+
.positive()
|
|
36
|
+
.nullable()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("New interval in milliseconds (null to clear)"),
|
|
28
39
|
description: z.string().optional().describe("New description"),
|
|
29
40
|
taskType: z.string().max(50).optional().describe("New task type"),
|
|
30
41
|
tags: z.array(z.string()).optional().describe("New tags"),
|
|
@@ -215,6 +226,32 @@ export const registerUpdateScheduleTool = (server: McpServer) => {
|
|
|
215
226
|
updateData.nextRunAt = undefined;
|
|
216
227
|
}
|
|
217
228
|
} else {
|
|
229
|
+
// Validate merged timing before recalc — runs BEFORE the enabled===false
|
|
230
|
+
// skip-recalc branch so disabling cannot bypass the invariant.
|
|
231
|
+
const timing = mergeScheduleTiming(
|
|
232
|
+
{
|
|
233
|
+
cronExpression: schedule.cronExpression ?? null,
|
|
234
|
+
intervalMs: schedule.intervalMs ?? null,
|
|
235
|
+
},
|
|
236
|
+
{ cronExpression, intervalMs },
|
|
237
|
+
);
|
|
238
|
+
const timingError = validateRecurringTiming(timing);
|
|
239
|
+
if (timingError) {
|
|
240
|
+
return {
|
|
241
|
+
content: [
|
|
242
|
+
{
|
|
243
|
+
type: "text",
|
|
244
|
+
text: "At least one of intervalMs or cronExpression must be set for recurring schedules.",
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
structuredContent: {
|
|
248
|
+
success: false,
|
|
249
|
+
message:
|
|
250
|
+
"At least one of intervalMs or cronExpression must be set for recurring schedules.",
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
218
255
|
const needsNextRunRecalc =
|
|
219
256
|
cronExpression !== undefined ||
|
|
220
257
|
intervalMs !== undefined ||
|
|
@@ -222,12 +259,15 @@ export const registerUpdateScheduleTool = (server: McpServer) => {
|
|
|
222
259
|
(enabled === true && !schedule.enabled);
|
|
223
260
|
|
|
224
261
|
if (needsNextRunRecalc && enabled !== false) {
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
262
|
+
const mergedTimezone = timezone !== undefined ? timezone : schedule.timezone;
|
|
263
|
+
updateData.nextRunAt = calculateNextRun(
|
|
264
|
+
{
|
|
265
|
+
cronExpression: timing.mergedCron,
|
|
266
|
+
intervalMs: timing.mergedInterval,
|
|
267
|
+
timezone: mergedTimezone,
|
|
268
|
+
} as Parameters<typeof calculateNextRun>[0],
|
|
269
|
+
new Date(),
|
|
270
|
+
);
|
|
231
271
|
} else if (enabled === false) {
|
|
232
272
|
updateData.nextRunAt = undefined;
|
|
233
273
|
}
|