@desplega.ai/agent-swarm 1.65.0 → 1.66.0

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 CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Agent Swarm API",
5
- "version": "1.65.0",
5
+ "version": "1.66.0",
6
6
  "description": "Multi-agent orchestration API for Claude Code, Codex, and Gemini CLI. Enables task distribution, agent communication, and service discovery.\n\nMCP tools are documented separately in [MCP.md](./MCP.md)."
7
7
  },
8
8
  "servers": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desplega.ai/agent-swarm",
3
- "version": "1.65.0",
3
+ "version": "1.66.0",
4
4
  "description": "Multi-agent orchestration for Claude Code, Codex, Gemini CLI, and other AI coding assistants",
5
5
  "license": "MIT",
6
6
  "author": "desplega.sh <contact@desplega.sh>",
package/src/be/db.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Database } from "bun:sqlite";
2
+ import pkg from "../../package.json";
2
3
  import { addEyesReactionOnTaskStart } from "../github/task-reactions";
3
4
  import { configureDbResolver } from "../prompts/resolver";
4
5
  import type {
@@ -764,6 +765,7 @@ type AgentTaskRow = {
764
765
  credentialKeySuffix: string | null;
765
766
  credentialKeyType: string | null;
766
767
  requestedByUserId: string | null;
768
+ swarmVersion: string | null;
767
769
  };
768
770
 
769
771
  function rowToAgentTask(row: AgentTaskRow): AgentTask {
@@ -823,6 +825,7 @@ function rowToAgentTask(row: AgentTaskRow): AgentTask {
823
825
  credentialKeySuffix: row.credentialKeySuffix ?? undefined,
824
826
  credentialKeyType: row.credentialKeyType ?? undefined,
825
827
  requestedByUserId: row.requestedByUserId ?? undefined,
828
+ swarmVersion: row.swarmVersion ?? undefined,
826
829
  };
827
830
  }
828
831
 
@@ -839,10 +842,11 @@ export const taskQueries = {
839
842
  string | null,
840
843
  string | null,
841
844
  string | null,
845
+ string,
842
846
  ]
843
847
  >(
844
- `INSERT INTO agent_tasks (id, agentId, task, status, source, slackChannelId, slackThreadTs, slackUserId, createdAt, lastUpdatedAt)
845
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'), strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) RETURNING *`,
848
+ `INSERT INTO agent_tasks (id, agentId, task, status, source, slackChannelId, slackThreadTs, slackUserId, swarmVersion, createdAt, lastUpdatedAt)
849
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'), strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) RETURNING *`,
846
850
  ),
847
851
 
848
852
  getById: () => getDb().prepare<AgentTaskRow, [string]>("SELECT * FROM agent_tasks WHERE id = ?"),
@@ -913,6 +917,7 @@ export function createTask(
913
917
  options?.slackChannelId ?? null,
914
918
  options?.slackThreadTs ?? null,
915
919
  options?.slackUserId ?? null,
920
+ pkg.version,
916
921
  );
917
922
  if (!row) throw new Error("Failed to create task");
918
923
  try {
@@ -1952,8 +1957,8 @@ export function createTaskExtended(task: string, options?: CreateTaskOptions): A
1952
1957
  vcsInstallationId, vcsNodeId,
1953
1958
  agentmailInboxId, agentmailMessageId, agentmailThreadId,
1954
1959
  mentionMessageId, mentionChannelId, dir, parentTaskId, model, scheduleId,
1955
- workflowRunId, workflowRunStepId, outputSchema, requestedByUserId, createdAt, lastUpdatedAt
1956
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`,
1960
+ workflowRunId, workflowRunStepId, outputSchema, requestedByUserId, swarmVersion, createdAt, lastUpdatedAt
1961
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`,
1957
1962
  )
1958
1963
  .get(
1959
1964
  id,
@@ -1993,6 +1998,7 @@ export function createTaskExtended(task: string, options?: CreateTaskOptions): A
1993
1998
  options?.workflowRunStepId ?? null,
1994
1999
  options?.outputSchema ? JSON.stringify(options.outputSchema) : null,
1995
2000
  options?.requestedByUserId ?? null,
2001
+ pkg.version,
1996
2002
  now,
1997
2003
  now,
1998
2004
  );
@@ -0,0 +1,7 @@
1
+ -- Stamp agent-swarm version on each task at creation time.
2
+ -- Enables benchmarking performance (cost, duration, tokens, etc.) across releases.
3
+ -- Existing rows stay NULL; benchmark queries should filter WHERE swarmVersion IS NOT NULL.
4
+ ALTER TABLE agent_tasks ADD COLUMN swarmVersion TEXT;
5
+
6
+ CREATE INDEX IF NOT EXISTS idx_agent_tasks_swarmVersion
7
+ ON agent_tasks(swarmVersion);
@@ -0,0 +1,81 @@
1
+ import { afterAll, beforeAll, describe, expect, test } from "bun:test";
2
+ import { unlink } from "node:fs/promises";
3
+ import pkg from "../../package.json";
4
+ import {
5
+ closeDb,
6
+ createAgent,
7
+ createTask,
8
+ createTaskExtended,
9
+ getDb,
10
+ getTaskById,
11
+ initDb,
12
+ } from "../be/db";
13
+
14
+ const TEST_DB_PATH = "./test-task-swarm-version.sqlite";
15
+
16
+ describe("Task swarmVersion tracking", () => {
17
+ beforeAll(async () => {
18
+ try {
19
+ await unlink(TEST_DB_PATH);
20
+ } catch {}
21
+ initDb(TEST_DB_PATH);
22
+ });
23
+
24
+ afterAll(async () => {
25
+ closeDb();
26
+ for (const suffix of ["", "-wal", "-shm"]) {
27
+ try {
28
+ await unlink(`${TEST_DB_PATH}${suffix}`);
29
+ } catch {}
30
+ }
31
+ });
32
+
33
+ test("createTaskExtended stamps pkg.version on new tasks", () => {
34
+ const agent = createAgent({
35
+ id: "swarm-version-agent-1",
36
+ name: "Swarm Version Agent",
37
+ isLead: false,
38
+ status: "idle",
39
+ });
40
+
41
+ const task = createTaskExtended("extended task", { agentId: agent.id });
42
+
43
+ expect(task.swarmVersion).toBe(pkg.version);
44
+
45
+ const reloaded = getTaskById(task.id);
46
+ expect(reloaded?.swarmVersion).toBe(pkg.version);
47
+ });
48
+
49
+ test("createTask stamps pkg.version on new tasks", () => {
50
+ const agent = createAgent({
51
+ id: "swarm-version-agent-2",
52
+ name: "Swarm Version Agent 2",
53
+ isLead: false,
54
+ status: "idle",
55
+ });
56
+
57
+ const task = createTask(agent.id, "basic task");
58
+
59
+ expect(task.swarmVersion).toBe(pkg.version);
60
+
61
+ const reloaded = getTaskById(task.id);
62
+ expect(reloaded?.swarmVersion).toBe(pkg.version);
63
+ });
64
+
65
+ test("column exists and is indexed", () => {
66
+ const db = getDb();
67
+ const columns = db
68
+ .prepare<{ name: string }, []>("PRAGMA table_info(agent_tasks)")
69
+ .all()
70
+ .map((c) => c.name);
71
+ expect(columns).toContain("swarmVersion");
72
+
73
+ const indexes = db
74
+ .prepare<{ name: string }, []>(
75
+ "SELECT name FROM sqlite_master WHERE type='index' AND tbl_name='agent_tasks'",
76
+ )
77
+ .all()
78
+ .map((i) => i.name);
79
+ expect(indexes).toContain("idx_agent_tasks_swarmVersion");
80
+ });
81
+ });
package/src/types.ts CHANGED
@@ -159,6 +159,10 @@ export const AgentTaskSchema = z.object({
159
159
 
160
160
  // User identity — canonical user who requested this task
161
161
  requestedByUserId: z.string().optional(),
162
+
163
+ // agent-swarm package version at task creation time. Enables benchmarking
164
+ // performance across releases. Nullable for rows created before tracking was added.
165
+ swarmVersion: z.string().optional(),
162
166
  });
163
167
 
164
168
  // ============================================================================