@desplega.ai/agent-swarm 1.56.4 → 1.56.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.
Files changed (38) hide show
  1. package/openapi.json +232 -1
  2. package/package.json +1 -1
  3. package/plugin/commands/close-issue.md +11 -63
  4. package/plugin/commands/create-pr.md +15 -77
  5. package/plugin/commands/implement-issue.md +26 -102
  6. package/plugin/commands/investigate-sentry-issue.md +21 -84
  7. package/plugin/commands/respond-github.md +9 -70
  8. package/plugin/commands/review-pr.md +46 -201
  9. package/plugin/commands/start-leader.md +36 -54
  10. package/plugin/commands/swarm-chat.md +18 -57
  11. package/plugin/commands/todos.md +6 -37
  12. package/plugin/commands/work-on-task.md +18 -56
  13. package/plugin/pi-skills/close-issue/SKILL.md +11 -63
  14. package/plugin/pi-skills/create-pr/SKILL.md +15 -77
  15. package/plugin/pi-skills/implement-issue/SKILL.md +26 -102
  16. package/plugin/pi-skills/investigate-sentry-issue/SKILL.md +21 -84
  17. package/plugin/pi-skills/respond-github/SKILL.md +9 -70
  18. package/plugin/pi-skills/review-pr/SKILL.md +46 -201
  19. package/plugin/pi-skills/start-leader/SKILL.md +31 -49
  20. package/plugin/pi-skills/swarm-chat/SKILL.md +18 -57
  21. package/plugin/pi-skills/todos/SKILL.md +6 -37
  22. package/plugin/pi-skills/work-on-task/SKILL.md +18 -50
  23. package/src/be/db.ts +190 -0
  24. package/src/be/migrations/028_api_key_tracking.sql +38 -0
  25. package/src/commands/runner.ts +124 -7
  26. package/src/heartbeat/heartbeat.ts +48 -3
  27. package/src/heartbeat/templates.ts +4 -2
  28. package/src/http/api-keys.ts +168 -0
  29. package/src/http/index.ts +2 -0
  30. package/src/prompts/session-templates.ts +49 -210
  31. package/src/tests/api-key-tracking.test.ts +197 -0
  32. package/src/tests/error-tracker.test.ts +59 -0
  33. package/src/tests/prompt-template-session.test.ts +11 -16
  34. package/src/tests/update-profile-auth.test.ts +3 -3
  35. package/src/tools/update-profile.ts +4 -2
  36. package/src/utils/credentials.test.ts +10 -10
  37. package/src/utils/credentials.ts +113 -14
  38. package/src/utils/error-tracker.ts +52 -0
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.56.4",
5
+ "version": "1.56.5",
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": [
@@ -1415,6 +1415,237 @@
1415
1415
  }
1416
1416
  }
1417
1417
  },
1418
+ "/api/keys/report-usage": {
1419
+ "post": {
1420
+ "summary": "Record which API key was used for a task",
1421
+ "tags": [
1422
+ "API Keys"
1423
+ ],
1424
+ "security": [
1425
+ {
1426
+ "bearerAuth": []
1427
+ }
1428
+ ],
1429
+ "requestBody": {
1430
+ "content": {
1431
+ "application/json": {
1432
+ "schema": {
1433
+ "type": "object",
1434
+ "properties": {
1435
+ "keyType": {
1436
+ "type": "string"
1437
+ },
1438
+ "keySuffix": {
1439
+ "type": "string",
1440
+ "minLength": 1,
1441
+ "maxLength": 10
1442
+ },
1443
+ "keyIndex": {
1444
+ "type": "integer",
1445
+ "minimum": 0
1446
+ },
1447
+ "taskId": {
1448
+ "type": "string",
1449
+ "format": "uuid"
1450
+ },
1451
+ "scope": {
1452
+ "type": "string"
1453
+ },
1454
+ "scopeId": {
1455
+ "type": "string"
1456
+ }
1457
+ },
1458
+ "required": [
1459
+ "keyType",
1460
+ "keySuffix",
1461
+ "keyIndex"
1462
+ ]
1463
+ }
1464
+ }
1465
+ }
1466
+ },
1467
+ "responses": {
1468
+ "200": {
1469
+ "description": "Usage recorded"
1470
+ },
1471
+ "400": {
1472
+ "description": "Validation error"
1473
+ },
1474
+ "401": {
1475
+ "description": "Unauthorized"
1476
+ }
1477
+ }
1478
+ }
1479
+ },
1480
+ "/api/keys/report-rate-limit": {
1481
+ "post": {
1482
+ "summary": "Mark an API key as rate-limited",
1483
+ "tags": [
1484
+ "API Keys"
1485
+ ],
1486
+ "security": [
1487
+ {
1488
+ "bearerAuth": []
1489
+ }
1490
+ ],
1491
+ "requestBody": {
1492
+ "content": {
1493
+ "application/json": {
1494
+ "schema": {
1495
+ "type": "object",
1496
+ "properties": {
1497
+ "keyType": {
1498
+ "type": "string"
1499
+ },
1500
+ "keySuffix": {
1501
+ "type": "string",
1502
+ "minLength": 1,
1503
+ "maxLength": 10
1504
+ },
1505
+ "keyIndex": {
1506
+ "type": "integer",
1507
+ "minimum": 0
1508
+ },
1509
+ "rateLimitedUntil": {
1510
+ "type": "string",
1511
+ "format": "date-time"
1512
+ },
1513
+ "scope": {
1514
+ "type": "string"
1515
+ },
1516
+ "scopeId": {
1517
+ "type": "string"
1518
+ }
1519
+ },
1520
+ "required": [
1521
+ "keyType",
1522
+ "keySuffix",
1523
+ "keyIndex",
1524
+ "rateLimitedUntil"
1525
+ ]
1526
+ }
1527
+ }
1528
+ }
1529
+ },
1530
+ "responses": {
1531
+ "200": {
1532
+ "description": "Key marked as rate-limited"
1533
+ },
1534
+ "400": {
1535
+ "description": "Validation error"
1536
+ },
1537
+ "401": {
1538
+ "description": "Unauthorized"
1539
+ }
1540
+ }
1541
+ }
1542
+ },
1543
+ "/api/keys/available": {
1544
+ "get": {
1545
+ "summary": "Get available (non-rate-limited) key indices for a credential type",
1546
+ "tags": [
1547
+ "API Keys"
1548
+ ],
1549
+ "security": [
1550
+ {
1551
+ "bearerAuth": []
1552
+ }
1553
+ ],
1554
+ "parameters": [
1555
+ {
1556
+ "schema": {
1557
+ "type": "string"
1558
+ },
1559
+ "required": true,
1560
+ "name": "keyType",
1561
+ "in": "query"
1562
+ },
1563
+ {
1564
+ "schema": {
1565
+ "type": "integer",
1566
+ "minimum": 1
1567
+ },
1568
+ "required": true,
1569
+ "name": "totalKeys",
1570
+ "in": "query"
1571
+ },
1572
+ {
1573
+ "schema": {
1574
+ "type": "string"
1575
+ },
1576
+ "required": false,
1577
+ "name": "scope",
1578
+ "in": "query"
1579
+ },
1580
+ {
1581
+ "schema": {
1582
+ "type": "string"
1583
+ },
1584
+ "required": false,
1585
+ "name": "scopeId",
1586
+ "in": "query"
1587
+ }
1588
+ ],
1589
+ "responses": {
1590
+ "200": {
1591
+ "description": "List of available key indices"
1592
+ },
1593
+ "400": {
1594
+ "description": "Validation error"
1595
+ },
1596
+ "401": {
1597
+ "description": "Unauthorized"
1598
+ }
1599
+ }
1600
+ }
1601
+ },
1602
+ "/api/keys/status": {
1603
+ "get": {
1604
+ "summary": "Get all API key status records",
1605
+ "tags": [
1606
+ "API Keys"
1607
+ ],
1608
+ "security": [
1609
+ {
1610
+ "bearerAuth": []
1611
+ }
1612
+ ],
1613
+ "parameters": [
1614
+ {
1615
+ "schema": {
1616
+ "type": "string"
1617
+ },
1618
+ "required": false,
1619
+ "name": "keyType",
1620
+ "in": "query"
1621
+ },
1622
+ {
1623
+ "schema": {
1624
+ "type": "string"
1625
+ },
1626
+ "required": false,
1627
+ "name": "scope",
1628
+ "in": "query"
1629
+ },
1630
+ {
1631
+ "schema": {
1632
+ "type": "string"
1633
+ },
1634
+ "required": false,
1635
+ "name": "scopeId",
1636
+ "in": "query"
1637
+ }
1638
+ ],
1639
+ "responses": {
1640
+ "200": {
1641
+ "description": "List of key status records"
1642
+ },
1643
+ "401": {
1644
+ "description": "Unauthorized"
1645
+ }
1646
+ }
1647
+ }
1648
+ },
1418
1649
  "/api/events": {
1419
1650
  "post": {
1420
1651
  "summary": "Store a single event",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desplega.ai/agent-swarm",
3
- "version": "1.56.4",
3
+ "version": "1.56.6",
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>",
@@ -13,78 +13,26 @@ Close a GitHub or GitLab issue with an appropriate closing comment summarizing t
13
13
 
14
14
  ## Arguments
15
15
 
16
- - `issue-number-or-url`: Either an issue number (e.g., `123`) or a full issue URL (e.g., `https://github.com/owner/repo/issues/123` or `https://gitlab.com/group/project/-/issues/123`)
16
+ - `issue-number-or-url`: Either an issue number (e.g., `123`) or a full issue URL
17
17
 
18
18
  ## Workflow
19
19
 
20
- ### 1. Parse the Input
21
-
22
- If given a URL, extract the owner, repo, and issue number. If given just a number, use the current repository context.
23
-
24
- ### 2. Ensure Repository is Cloned Locally
25
-
26
- Make sure the repository is available in your personal workspace:
27
-
28
- ```bash
29
- REPO_PATH=/workspace/personal/<repo-name>
30
-
31
- if [ ! -d "$REPO_PATH" ]; then
32
- gh repo clone <owner>/<repo> "$REPO_PATH"
33
- fi
34
-
35
- cd "$REPO_PATH"
36
- ```
37
-
38
- ### 3. Get Issue Details
39
-
40
- ```bash
41
- gh issue view <issue-number> --json title,body,author,labels,comments
42
- ```
43
-
44
- ### 4. Understand the Context
45
-
46
- Review:
47
- - What was the original issue about?
48
- - What work was done to resolve it?
49
- - Were there any related PRs or commits?
50
-
51
- Check for related PRs:
52
-
53
- ```bash
54
- gh pr list --search "fixes #<issue-number>" --json number,title,state
55
- ```
56
-
57
- ### 5. Generate Closing Comment
58
-
59
- Write a closing comment that includes:
60
- - Brief summary of what was done
61
- - Reference to any PRs that addressed the issue
62
- - Any follow-up items or notes
63
-
64
- ### 6. Post Comment and Close
65
-
66
- ```bash
67
- # Add the closing comment
68
- gh issue comment <issue-number> --body "Your closing comment"
69
-
70
- # Close the issue
71
- gh issue close <issue-number>
72
- ```
73
-
74
- Or combine with a reason:
75
-
76
- ```bash
77
- gh issue close <issue-number> --comment "Your closing comment" --reason completed
78
- ```
20
+ 1. **Parse the input** — if given a URL, extract owner, repo, and issue number. If just a number, use the current repo context.
21
+ 2. **Ensure repo is cloned** to `/workspace/personal/<repo-name>` (clone with `gh repo clone` if needed).
22
+ 3. **Get issue details** read the issue title, body, comments, and check for related PRs.
23
+ 4. **Generate closing comment** — summarize what was done, reference related PRs/commits, note any follow-ups.
24
+ 5. **Post comment and close:**
25
+ ```bash
26
+ gh issue close <issue-number> --comment "Your closing comment" --reason completed
27
+ ```
79
28
 
80
29
  ## Closing Reasons
81
30
 
82
- - `completed` - The issue was resolved
83
- - `not_planned` - Won't fix / out of scope / duplicate
31
+ - `completed` The issue was resolved
32
+ - `not_planned` Won't fix / out of scope / duplicate
84
33
 
85
34
  ## Tips
86
35
 
87
36
  - Always explain why the issue is being closed
88
37
  - Reference specific PRs or commits when applicable
89
38
  - If closing as "not planned", explain the reasoning
90
- - Be respectful - someone took time to report the issue
@@ -5,15 +5,15 @@ argument-hint: [base-branch]
5
5
 
6
6
  # Create Pull Request / Merge Request
7
7
 
8
- Create a pull request (GitHub) or merge request (GitLab) from the current branch with an auto-generated title and description.
8
+ Create a PR (GitHub) or MR (GitLab) from the current branch with an auto-generated title and description.
9
9
 
10
- **Provider detection:** Check the remote URL to determine the VCS provider:
11
- - If the remote contains `github.com` → use `gh` CLI
12
- - If the remote contains `gitlab.com` or `gitlab.` → use `glab` CLI
10
+ **Provider detection:** Check the remote URL:
11
+ - If `github.com` → use `gh` CLI
12
+ - If `gitlab.com` or `gitlab.` → use `glab` CLI
13
13
 
14
14
  ## Arguments
15
15
 
16
- - `base-branch` (optional): The branch to merge into (defaults to `main` or the repo's default branch)
16
+ - `base-branch` (optional): Branch to merge into (defaults to `main` or repo default)
17
17
 
18
18
  ## Prerequisites
19
19
 
@@ -21,79 +21,17 @@ You should be working in a repository cloned to `/workspace/personal/<repo-name>
21
21
 
22
22
  ## Workflow
23
23
 
24
- ### 1. Verify Working Directory
25
-
26
- Ensure you're in a git repository:
27
-
28
- ```bash
29
- git rev-parse --is-inside-work-tree
30
- ```
31
-
32
- ### 2. Check Branch Status
33
-
34
- ```bash
35
- # Get current branch
36
- git branch --show-current
37
-
38
- # Ensure we're not on main/master
39
- # Ensure there are commits to push
40
- git log origin/main..HEAD --oneline
41
- ```
42
-
43
- ### 3. Push the Branch
44
-
45
- ```bash
46
- git push -u origin HEAD
47
- ```
48
-
49
- ### 4. Gather Context for PR Description
50
-
51
- ```bash
52
- # Get commit messages since diverging from base
53
- git log origin/main..HEAD --pretty=format:"%s%n%b"
54
-
55
- # Get changed files
56
- git diff --stat origin/main..HEAD
57
- ```
58
-
59
- ### 5. Generate PR Title and Description
60
-
61
- Based on the commits and changes:
62
- - **Title**: Concise summary of the changes (use conventional commit style if the repo uses it)
63
- - **Description**:
64
- - Summary of what changed and why
65
- - List of notable changes
66
- - Any testing done
67
- - Related issues (if applicable)
68
-
69
- ### 6. Create the PR/MR
70
-
71
- **For GitHub:**
72
- ```bash
73
- gh pr create \
74
- --title "Your generated title" \
75
- --body "Your generated description" \
76
- --base main
77
- ```
78
-
79
- **For GitLab:**
80
- ```bash
81
- glab mr create \
82
- --title "Your generated title" \
83
- --description "Your generated description" \
84
- --target-branch main
85
- ```
86
-
87
- ### 7. Report the PR/MR URL
88
-
89
- After creation, provide the URL to the user:
90
-
91
- **GitHub:** `gh pr view --json url --jq '.url'`
92
- **GitLab:** `glab mr view --web`
24
+ 1. **Verify state** — confirm you're in a git repo, not on main/master, and have commits to push.
25
+ 2. **Push the branch** — `git push -u origin HEAD`
26
+ 3. **Gather context** review commit messages and changed files since diverging from base.
27
+ 4. **Generate title and description:**
28
+ - **Title**: Concise summary (conventional commit style if the repo uses it)
29
+ - **Description**: Summary of changes, notable items, testing done, related issues
30
+ 5. **Create the PR/MR** using `gh pr create` or `glab mr create`.
31
+ 6. **Report** the PR/MR URL.
93
32
 
94
33
  ## Tips
95
34
 
96
35
  - Link related issues using `Fixes #123` or `Closes #123` in the description
97
- - Include a test plan if the changes are significant
98
- - Keep PRs focused - one logical change per PR
99
- - If the branch has many commits, consider summarizing the overall change rather than listing each commit
36
+ - Keep PRs focused one logical change per PR
37
+ - If the branch has many commits, summarize the overall change rather than listing each commit
@@ -5,131 +5,55 @@ argument-hint: <issue-number-or-url>
5
5
 
6
6
  # Implement Issue
7
7
 
8
- Read a GitHub or GitLab issue, implement the requested changes, and create a pull request / merge request.
8
+ Read a GitHub or GitLab issue, implement the requested changes, and create a PR/MR.
9
9
 
10
- **Provider detection:** Check the URL or remote to determine the VCS provider:
10
+ **Provider detection:** Check the URL or remote:
11
11
  - If GitHub → use `gh issue view` / `gh pr create`
12
12
  - If GitLab → use `glab issue view` / `glab mr create`
13
13
 
14
14
  ## Arguments
15
15
 
16
- - `issue-number-or-url`: Either an issue number (e.g., `123`) or a full URL (e.g., `https://github.com/owner/repo/issues/123` or `https://gitlab.com/group/project/-/issues/123`)
16
+ - `issue-number-or-url`: Either an issue number (e.g., `123`) or a full URL
17
17
 
18
18
  ## Workflow
19
19
 
20
- ### 1. Parse the Input
20
+ ### 1. Parse and Fetch
21
21
 
22
- If given a URL, extract the owner, repo, and issue number. If given just a number, use the current repository context.
22
+ If given a URL, extract owner, repo, and issue number. Fetch issue details (title, body, labels, comments). Understand what's being requested, acceptance criteria, and any technical constraints.
23
23
 
24
- ### 2. Fetch Issue Details
24
+ ### 2. Setup
25
25
 
26
- ```bash
27
- gh issue view <issue-number> --json number,title,body,labels,comments
28
- ```
26
+ - Ensure repo is cloned to `/workspace/personal/<repo-name>` (clone with `gh repo clone` if needed)
27
+ - Fetch origin, checkout main, pull latest
28
+ - Create a feature branch: `fix/issue-<number>-<short-description>`
29
29
 
30
- Read and understand:
31
- - What is being requested?
32
- - Are there acceptance criteria?
33
- - Any technical details or constraints mentioned?
34
- - Check comments for additional context or clarifications
30
+ ### 3. Implement
35
31
 
36
- ### 3. Ensure Repository is Cloned
37
-
38
- Clone the repository to your personal workspace if not already present:
39
-
40
- ```bash
41
- REPO_PATH=/workspace/personal/<repo-name>
42
-
43
- if [ ! -d "$REPO_PATH" ]; then
44
- gh repo clone <owner>/<repo> "$REPO_PATH"
45
- fi
46
-
47
- cd "$REPO_PATH"
48
- git fetch origin
49
- git checkout main
50
- git pull origin main
51
- ```
52
-
53
- ### 4. Create a Feature Branch
54
-
55
- ```bash
56
- # Use a descriptive branch name based on the issue
57
- git checkout -b fix/issue-<number>-<short-description>
58
-
59
- # Examples:
60
- # git checkout -b fix/issue-123-add-dark-mode
61
- # git checkout -b fix/issue-456-fix-login-redirect
62
- ```
63
-
64
- ### 5. Implement the Changes
65
-
66
- This is the core work. Based on the issue:
67
-
68
- 1. **Understand the codebase** - Explore relevant files, understand existing patterns
69
- 2. **Plan your approach** - Consider using `/desplega:create-plan` for complex changes
70
- 3. **Write the code** - Implement the requested functionality
71
- 4. **Test your changes** - Run existing tests, add new tests if appropriate
72
- 5. **Verify it works** - Manual verification where possible
32
+ 1. **Understand the codebase** — explore relevant files and existing patterns
33
+ 2. **Plan your approach** — consider using `/desplega:create-plan` for complex changes
34
+ 3. **Write the code** implement the requested functionality
35
+ 4. **Test your changes** — run existing tests, add new tests if appropriate
36
+ 5. **Verify it works** — manual verification where possible
73
37
 
74
38
  Keep changes focused on what the issue requests. Avoid scope creep.
75
39
 
76
- ### 6. Commit Your Changes
77
-
78
- ```bash
79
- # Stage your changes
80
- git add -A
81
-
82
- # Commit with a message referencing the issue
83
- git commit -m "Fix #<issue-number>: <short description>
84
-
85
- <longer description if needed>"
86
- ```
87
-
88
- Use conventional commit style if the repo uses it (e.g., `feat:`, `fix:`, `docs:`).
89
-
90
- ### 7. Push the Branch
91
-
92
- ```bash
93
- git push -u origin HEAD
94
- ```
95
-
96
- ### 8. Create the Pull Request
97
-
98
- ```bash
99
- gh pr create \
100
- --title "<descriptive title>" \
101
- --body "## Summary
102
- <Brief description of what this PR does>
103
-
104
- ## Changes
105
- - <List key changes>
106
-
107
- ## Testing
108
- - <How you tested the changes>
109
-
110
- Fixes #<issue-number>"
111
- ```
40
+ ### 4. Commit and Push
112
41
 
113
- The `Fixes #<number>` syntax will auto-close the issue when the PR is merged.
42
+ Commit with a message referencing the issue (e.g., `Fix #123: <description>`). Use conventional commit style if the repo uses it. Push with `git push -u origin HEAD`.
114
43
 
115
- ### 9. Report Back
44
+ ### 5. Create the PR
116
45
 
117
- Provide the user with:
118
- - PR URL
119
- - Summary of changes made
120
- - Any notes or caveats
46
+ Create the PR with a descriptive title and body including: summary of changes, key changes list, testing done, and `Fixes #<issue-number>` to auto-close the issue on merge.
121
47
 
122
- Optionally, comment on the original issue:
48
+ ### 6. Report Back
123
49
 
124
- ```bash
125
- gh issue comment <issue-number> --body "I've created a PR to address this: <PR-URL>"
126
- ```
50
+ Provide the PR URL, summary of changes, and any caveats. Optionally comment on the original issue linking the PR.
127
51
 
128
52
  ## Tips
129
53
 
130
- - Read the issue thoroughly before starting - misunderstanding wastes time
131
- - Check if there are related issues or existing PRs
132
- - Keep PRs focused - one issue = one PR
133
- - If the issue is too large, consider breaking it into smaller PRs
134
- - If you get stuck or the issue is unclear, use `/respond-github` to ask for clarification
54
+ - Read the issue thoroughly before starting misunderstanding wastes time
55
+ - Check for related issues or existing PRs
56
+ - One issue = one PR
57
+ - If the issue is too large, break it into smaller PRs
58
+ - If unclear, use `/respond-github` to ask for clarification
135
59
  - Run linters and tests before creating the PR