@bradygaster/squad-cli 0.8.24 → 0.9.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/README.md +284 -32
- package/dist/cli/commands/aspire.d.ts.map +1 -1
- package/dist/cli/commands/aspire.js +3 -0
- package/dist/cli/commands/aspire.js.map +1 -1
- package/dist/cli/commands/build.js +3 -3
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/cast.d.ts +13 -0
- package/dist/cli/commands/cast.d.ts.map +1 -0
- package/dist/cli/commands/cast.js +77 -0
- package/dist/cli/commands/cast.js.map +1 -0
- package/dist/cli/commands/cost.d.ts +2 -0
- package/dist/cli/commands/cost.d.ts.map +1 -0
- package/dist/cli/commands/cost.js +170 -0
- package/dist/cli/commands/cost.js.map +1 -0
- package/dist/cli/commands/cross-squad.d.ts +12 -0
- package/dist/cli/commands/cross-squad.d.ts.map +1 -0
- package/dist/cli/commands/cross-squad.js +80 -0
- package/dist/cli/commands/cross-squad.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +5 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +156 -0
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/economy.d.ts +10 -0
- package/dist/cli/commands/economy.d.ts.map +1 -0
- package/dist/cli/commands/economy.js +64 -0
- package/dist/cli/commands/economy.js.map +1 -0
- package/dist/cli/commands/export.d.ts.map +1 -1
- package/dist/cli/commands/export.js +11 -4
- package/dist/cli/commands/export.js.map +1 -1
- package/dist/cli/commands/import.js +2 -2
- package/dist/cli/commands/import.js.map +1 -1
- package/dist/cli/commands/personal.d.ts +16 -0
- package/dist/cli/commands/personal.d.ts.map +1 -0
- package/dist/cli/commands/personal.js +213 -0
- package/dist/cli/commands/personal.js.map +1 -0
- package/dist/cli/commands/roles.d.ts +2 -0
- package/dist/cli/commands/roles.d.ts.map +1 -0
- package/dist/cli/commands/roles.js +54 -0
- package/dist/cli/commands/roles.js.map +1 -0
- package/dist/cli/commands/schedule.d.ts +14 -0
- package/dist/cli/commands/schedule.d.ts.map +1 -0
- package/dist/cli/commands/schedule.js +208 -0
- package/dist/cli/commands/schedule.js.map +1 -0
- package/dist/cli/commands/watch.d.ts.map +1 -1
- package/dist/cli/commands/watch.js +17 -5
- package/dist/cli/commands/watch.js.map +1 -1
- package/dist/cli/core/cast.d.ts +9 -0
- package/dist/cli/core/cast.d.ts.map +1 -1
- package/dist/cli/core/cast.js +170 -60
- package/dist/cli/core/cast.js.map +1 -1
- package/dist/cli/core/detect-squad-dir.d.ts +10 -0
- package/dist/cli/core/detect-squad-dir.d.ts.map +1 -1
- package/dist/cli/core/detect-squad-dir.js +47 -0
- package/dist/cli/core/detect-squad-dir.js.map +1 -1
- package/dist/cli/core/init.d.ts +8 -0
- package/dist/cli/core/init.d.ts.map +1 -1
- package/dist/cli/core/init.js +115 -2
- package/dist/cli/core/init.js.map +1 -1
- package/dist/cli/core/migrations.d.ts.map +1 -1
- package/dist/cli/core/migrations.js +21 -0
- package/dist/cli/core/migrations.js.map +1 -1
- package/dist/cli/core/templates.d.ts.map +1 -1
- package/dist/cli/core/templates.js +8 -1
- package/dist/cli/core/templates.js.map +1 -1
- package/dist/cli/core/upgrade.d.ts +14 -0
- package/dist/cli/core/upgrade.d.ts.map +1 -1
- package/dist/cli/core/upgrade.js +182 -48
- package/dist/cli/core/upgrade.js.map +1 -1
- package/dist/cli/core/version.js +2 -2
- package/dist/cli/core/version.js.map +1 -1
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/self-update.d.ts +21 -0
- package/dist/cli/self-update.d.ts.map +1 -0
- package/dist/cli/self-update.js +113 -0
- package/dist/cli/self-update.js.map +1 -0
- package/dist/cli/shell/autocomplete.d.ts.map +1 -1
- package/dist/cli/shell/autocomplete.js +5 -0
- package/dist/cli/shell/autocomplete.js.map +1 -1
- package/dist/cli/shell/commands.d.ts.map +1 -1
- package/dist/cli/shell/commands.js +55 -24
- package/dist/cli/shell/commands.js.map +1 -1
- package/dist/cli/shell/components/AgentPanel.d.ts.map +1 -1
- package/dist/cli/shell/components/AgentPanel.js +21 -6
- package/dist/cli/shell/components/AgentPanel.js.map +1 -1
- package/dist/cli/shell/components/App.d.ts.map +1 -1
- package/dist/cli/shell/components/App.js +33 -15
- package/dist/cli/shell/components/App.js.map +1 -1
- package/dist/cli/shell/components/InputPrompt.js +1 -1
- package/dist/cli/shell/components/InputPrompt.js.map +1 -1
- package/dist/cli/shell/components/MessageStream.d.ts +2 -0
- package/dist/cli/shell/components/MessageStream.d.ts.map +1 -1
- package/dist/cli/shell/components/MessageStream.js +20 -20
- package/dist/cli/shell/components/MessageStream.js.map +1 -1
- package/dist/cli/shell/components/ThinkingIndicator.d.ts +4 -0
- package/dist/cli/shell/components/ThinkingIndicator.d.ts.map +1 -1
- package/dist/cli/shell/components/ThinkingIndicator.js +23 -4
- package/dist/cli/shell/components/ThinkingIndicator.js.map +1 -1
- package/dist/cli/shell/coordinator.d.ts +7 -0
- package/dist/cli/shell/coordinator.d.ts.map +1 -1
- package/dist/cli/shell/coordinator.js +206 -88
- package/dist/cli/shell/coordinator.js.map +1 -1
- package/dist/cli/shell/error-messages.d.ts +14 -0
- package/dist/cli/shell/error-messages.d.ts.map +1 -1
- package/dist/cli/shell/error-messages.js +65 -1
- package/dist/cli/shell/error-messages.js.map +1 -1
- package/dist/cli/shell/index.d.ts +1 -1
- package/dist/cli/shell/index.d.ts.map +1 -1
- package/dist/cli/shell/index.js +83 -12
- package/dist/cli/shell/index.js.map +1 -1
- package/dist/cli/shell/router.d.ts.map +1 -1
- package/dist/cli/shell/router.js +21 -2
- package/dist/cli/shell/router.js.map +1 -1
- package/dist/cli/shell/stream-bridge.d.ts +2 -0
- package/dist/cli/shell/stream-bridge.d.ts.map +1 -1
- package/dist/cli/shell/stream-bridge.js +11 -2
- package/dist/cli/shell/stream-bridge.js.map +1 -1
- package/dist/cli/shell/terminal.d.ts +5 -5
- package/dist/cli/shell/terminal.d.ts.map +1 -1
- package/dist/cli/shell/terminal.js +35 -26
- package/dist/cli/shell/terminal.js.map +1 -1
- package/dist/cli-entry.js +140 -43
- package/dist/cli-entry.js.map +1 -1
- package/package.json +20 -4
- package/scripts/patch-esm-imports.mjs +84 -55
- package/scripts/patch-ink-rendering.mjs +115 -0
- package/templates/casting/Futurama.json +10 -0
- package/templates/casting-policy.json +4 -2
- package/templates/casting-reference.md +104 -0
- package/templates/cooperative-rate-limiting.md +229 -0
- package/templates/issue-lifecycle.md +412 -0
- package/templates/keda-scaler.md +164 -0
- package/templates/machine-capabilities.md +75 -0
- package/templates/orchestration-log.md +1 -1
- package/templates/ralph-circuit-breaker.md +313 -0
- package/templates/routing.md +5 -20
- package/templates/scribe-charter.md +1 -1
- package/templates/skills/agent-collaboration/SKILL.md +42 -0
- package/templates/skills/agent-conduct/SKILL.md +24 -0
- package/templates/skills/architectural-proposals/SKILL.md +151 -0
- package/templates/skills/ci-validation-gates/SKILL.md +84 -0
- package/templates/skills/cli-wiring/SKILL.md +47 -0
- package/templates/skills/client-compatibility/SKILL.md +89 -0
- package/templates/skills/cross-squad/SKILL.md +114 -0
- package/templates/skills/distributed-mesh/SKILL.md +287 -0
- package/templates/skills/distributed-mesh/mesh.json.example +30 -0
- package/templates/skills/distributed-mesh/sync-mesh.ps1 +111 -0
- package/templates/skills/distributed-mesh/sync-mesh.sh +104 -0
- package/templates/skills/docs-standards/SKILL.md +71 -0
- package/templates/skills/economy-mode/SKILL.md +114 -0
- package/templates/skills/external-comms/SKILL.md +329 -0
- package/templates/skills/gh-auth-isolation/SKILL.md +183 -0
- package/templates/skills/git-workflow/SKILL.md +204 -0
- package/templates/skills/github-multi-account/SKILL.md +95 -0
- package/templates/skills/history-hygiene/SKILL.md +36 -0
- package/templates/skills/humanizer/SKILL.md +105 -0
- package/templates/skills/init-mode/SKILL.md +102 -0
- package/templates/skills/model-selection/SKILL.md +117 -0
- package/templates/skills/nap/SKILL.md +24 -0
- package/templates/skills/personal-squad/SKILL.md +57 -0
- package/templates/skills/release-process/SKILL.md +423 -0
- package/templates/skills/reskill/SKILL.md +92 -0
- package/templates/skills/reviewer-protocol/SKILL.md +79 -0
- package/templates/skills/secret-handling/SKILL.md +200 -0
- package/templates/skills/session-recovery/SKILL.md +155 -0
- package/templates/skills/test-discipline/SKILL.md +37 -0
- package/templates/skills/windows-compatibility/SKILL.md +74 -0
- package/templates/squad.agent.md +1287 -1146
- package/templates/workflows/squad-docs.yml +8 -4
- package/templates/workflows/squad-heartbeat.yml +3 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
+
import { listRoles, searchRoles } from '@bradygaster/squad-sdk';
|
|
3
4
|
/** Debug logger — writes to stderr only when SQUAD_DEBUG=1. */
|
|
4
5
|
function debugLog(...args) {
|
|
5
6
|
if (process.env['SQUAD_DEBUG'] === '1') {
|
|
@@ -26,50 +27,167 @@ export function hasRosterEntries(teamContent) {
|
|
|
26
27
|
/**
|
|
27
28
|
* Build an Init Mode system prompt for team casting.
|
|
28
29
|
* Used when team.md exists but has no roster entries.
|
|
30
|
+
*
|
|
31
|
+
* When `config.useBaseRoles` is true (opt-in via `--roles`), the prompt
|
|
32
|
+
* includes the built-in base roles catalog so the LLM maps agents to
|
|
33
|
+
* curated role IDs. Otherwise (default), the LLM casts from a fictional
|
|
34
|
+
* universe with free-form role names — the beloved casting experience.
|
|
29
35
|
*/
|
|
30
36
|
export function buildInitModePrompt(config) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
-
|
|
37
|
+
if (config.useBaseRoles) {
|
|
38
|
+
return buildBaseRolesInitPrompt();
|
|
39
|
+
}
|
|
40
|
+
return buildUniverseCastingInitPrompt();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Default init prompt — fictional universe casting (no base roles catalog).
|
|
44
|
+
*/
|
|
45
|
+
function buildUniverseCastingInitPrompt() {
|
|
46
|
+
return `You are the Squad Coordinator in Init Mode.
|
|
47
|
+
|
|
48
|
+
This project has a Squad scaffold (.squad/ directory) but no team has been cast yet.
|
|
49
|
+
The user's message describes what they want to build or work on.
|
|
50
|
+
|
|
51
|
+
Your job: Propose a team of 4-5 AI agents based on what the user wants to do.
|
|
52
|
+
|
|
53
|
+
## Rules
|
|
54
|
+
1. Analyze the user's message to understand the project (language, stack, scope)
|
|
55
|
+
2. Pick a fictional universe for character names. **Strongly prefer:**
|
|
56
|
+
- **The Usual Suspects** (8 characters: Keyser, McManus, Fenster, Verbal, Hockney, Redfoot, Edie, Kobayashi)
|
|
57
|
+
- **Ocean's Eleven** (10 characters: Danny, Rusty, Linus, Basher, Livingston, Saul, Yen, Virgil, Turk, Reuben)
|
|
58
|
+
|
|
59
|
+
You may also choose other film universes (Alien, The Matrix, Heat, Star Wars, Blade Runner, etc.) but the two above are preferred.
|
|
60
|
+
3. Propose 4-5 agents with roles that match the project needs
|
|
61
|
+
4. Scribe and Ralph are always included automatically — do NOT include them in your proposal
|
|
62
|
+
|
|
63
|
+
## Response Format — you MUST use this EXACT format:
|
|
64
|
+
|
|
65
|
+
INIT_TEAM:
|
|
66
|
+
- {Name} | {Role} | {scope: 2-4 words describing expertise}
|
|
67
|
+
- {Name} | {Role} | {scope}
|
|
68
|
+
- {Name} | {Role} | {scope}
|
|
69
|
+
- {Name} | {Role} | {scope}
|
|
70
|
+
UNIVERSE: {universe name}
|
|
71
|
+
PROJECT: {1-sentence project description}
|
|
72
|
+
|
|
73
|
+
## Example
|
|
74
|
+
|
|
75
|
+
If user says "Build a React app with a Node backend":
|
|
76
|
+
|
|
77
|
+
INIT_TEAM:
|
|
78
|
+
- Ripley | Lead | Architecture, code review, decisions
|
|
79
|
+
- Dallas | Frontend Dev | React, components, styling
|
|
80
|
+
- Kane | Backend Dev | Node.js, APIs, database
|
|
81
|
+
- Lambert | Tester | Tests, quality, edge cases
|
|
82
|
+
UNIVERSE: Alien
|
|
83
|
+
PROJECT: A React and Node.js web application
|
|
84
|
+
|
|
85
|
+
## Important
|
|
86
|
+
- Use character names that feel natural, not forced
|
|
87
|
+
- Roles should match project needs (don't always use the same 4 roles)
|
|
88
|
+
- For CLI projects: maybe skip Frontend, add DevOps or SDK Expert
|
|
89
|
+
- For data projects: add Data Engineer, skip Frontend
|
|
90
|
+
- Keep scope descriptions short (2-4 words each)
|
|
91
|
+
- Respond ONLY with the INIT_TEAM block — no other text
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Opt-in base roles init prompt — includes the curated role catalog.
|
|
96
|
+
* Activated by `squad init --roles` or `/init --roles`.
|
|
97
|
+
*/
|
|
98
|
+
function buildBaseRolesInitPrompt() {
|
|
99
|
+
const catalog = new Map(listRoles().map((role) => [role.id, role]));
|
|
100
|
+
const resolveRole = (id) => catalog.get(id) ?? searchRoles(id)[0];
|
|
101
|
+
const formatRole = (id, label) => {
|
|
102
|
+
const role = resolveRole(id);
|
|
103
|
+
const title = role?.title ?? label;
|
|
104
|
+
return ` ${id.padEnd(22, ' ')} — ${title}`;
|
|
105
|
+
};
|
|
106
|
+
const softwareRoles = [
|
|
107
|
+
['lead', 'Lead / Architect'],
|
|
108
|
+
['frontend', 'Frontend Developer'],
|
|
109
|
+
['backend', 'Backend Developer'],
|
|
110
|
+
['fullstack', 'Full-Stack Developer'],
|
|
111
|
+
['reviewer', 'Code Reviewer'],
|
|
112
|
+
['tester', 'Test Engineer'],
|
|
113
|
+
['devops', 'DevOps Engineer'],
|
|
114
|
+
['security', 'Security Engineer'],
|
|
115
|
+
['data', 'Data Engineer'],
|
|
116
|
+
['docs', 'Technical Writer'],
|
|
117
|
+
['ai', 'AI / ML Engineer'],
|
|
118
|
+
['designer', 'UI/UX Designer'],
|
|
119
|
+
];
|
|
120
|
+
const businessRoles = [
|
|
121
|
+
['marketing-strategist', 'Marketing Strategist'],
|
|
122
|
+
['sales-strategist', 'Sales Strategist'],
|
|
123
|
+
['product-manager', 'Product Manager'],
|
|
124
|
+
['project-manager', 'Project Manager'],
|
|
125
|
+
['support-specialist', 'Support Specialist'],
|
|
126
|
+
['game-developer', 'Game Developer'],
|
|
127
|
+
['media-buyer', 'Media Buyer'],
|
|
128
|
+
['compliance-legal', 'Compliance & Legal'],
|
|
129
|
+
];
|
|
130
|
+
const softwareRoleLines = softwareRoles.map(([id, label]) => formatRole(id, label)).join('\n');
|
|
131
|
+
const businessRoleLines = businessRoles.map(([id, label]) => formatRole(id, label)).join('\n');
|
|
132
|
+
return `You are the Squad Coordinator in Init Mode.
|
|
133
|
+
|
|
134
|
+
This project has a Squad scaffold (.squad/ directory) but no team has been cast yet.
|
|
135
|
+
The user's message describes what they want to build or work on.
|
|
136
|
+
|
|
137
|
+
Your job: Propose a team of 4-5 AI agents based on what the user wants to do.
|
|
138
|
+
|
|
139
|
+
## Rules
|
|
140
|
+
1. Analyze the user's message to understand the project (language, stack, scope)
|
|
141
|
+
2. Pick a fictional universe for character names (e.g., Alien, The Usual Suspects, Blade Runner, The Matrix, Heat, Star Wars). Pick ONE universe and use it consistently.
|
|
142
|
+
3. Propose 4-5 agents with roles that match the project needs
|
|
143
|
+
4. Scribe and Ralph are always included automatically — do NOT include them in your proposal
|
|
144
|
+
|
|
145
|
+
## Built-in Base Roles (use these as starting points)
|
|
146
|
+
|
|
147
|
+
The following base roles are available. Prefer these over inventing new roles — they have deep, curated charter content.
|
|
148
|
+
When proposing a team, match the user's project needs to these roles first.
|
|
149
|
+
Only propose a custom role if none of the base roles fit.
|
|
150
|
+
|
|
151
|
+
Software Development:
|
|
152
|
+
${softwareRoleLines}
|
|
153
|
+
|
|
154
|
+
Business & Operations:
|
|
155
|
+
${businessRoleLines}
|
|
156
|
+
|
|
157
|
+
When proposing a team member, use the role ID from above in the Role field.
|
|
158
|
+
Example: "- Ripley | lead | Architecture, code review, decisions"
|
|
159
|
+
This tells the system to use the pre-built Lead/Architect charter content.
|
|
160
|
+
If you use a role not in this list, the system will generate a generic charter instead.
|
|
161
|
+
|
|
162
|
+
## Response Format — you MUST use this EXACT format:
|
|
163
|
+
|
|
164
|
+
INIT_TEAM:
|
|
165
|
+
- {Name} | {Role} | {scope: 2-4 words describing expertise}
|
|
166
|
+
- {Name} | {Role} | {scope}
|
|
167
|
+
- {Name} | {Role} | {scope}
|
|
168
|
+
- {Name} | {Role} | {scope}
|
|
169
|
+
UNIVERSE: {universe name}
|
|
170
|
+
PROJECT: {1-sentence project description}
|
|
171
|
+
|
|
172
|
+
## Example
|
|
173
|
+
|
|
174
|
+
If user says "Build a React app with a Node backend":
|
|
175
|
+
|
|
176
|
+
INIT_TEAM:
|
|
177
|
+
- Ripley | lead | Architecture, code review, decisions
|
|
178
|
+
- Dallas | frontend | React, components, styling
|
|
179
|
+
- Kane | backend | Node.js, APIs, database
|
|
180
|
+
- Lambert | tester | Tests, quality, edge cases
|
|
181
|
+
UNIVERSE: Alien
|
|
182
|
+
PROJECT: A React and Node.js web application
|
|
183
|
+
|
|
184
|
+
## Important
|
|
185
|
+
- Use character names that feel natural, not forced
|
|
186
|
+
- Roles should match project needs (don't always use the same 4 roles)
|
|
187
|
+
- For CLI projects: maybe skip Frontend, add DevOps or SDK Expert
|
|
188
|
+
- For data projects: add Data Engineer, skip Frontend
|
|
189
|
+
- Keep scope descriptions short (2-4 words each)
|
|
190
|
+
- Respond ONLY with the INIT_TEAM block — no other text
|
|
73
191
|
`;
|
|
74
192
|
}
|
|
75
193
|
/**
|
|
@@ -84,29 +202,29 @@ export function buildCoordinatorPrompt(config) {
|
|
|
84
202
|
try {
|
|
85
203
|
teamContent = readFileSync(teamPath, 'utf-8');
|
|
86
204
|
if (!hasRosterEntries(teamContent)) {
|
|
87
|
-
teamContent = `⚠️ NO TEAM CONFIGURED
|
|
88
|
-
|
|
89
|
-
This project doesn't have a Squad team yet.
|
|
90
|
-
|
|
91
|
-
**You MUST NOT do any project work.** Instead, tell the user:
|
|
92
|
-
1. "This project doesn't have a Squad team yet."
|
|
93
|
-
2. Suggest running \`squad init\` or the \`/init\` command to set one up.
|
|
94
|
-
3. Politely refuse any work requests until init is done.
|
|
95
|
-
|
|
205
|
+
teamContent = `⚠️ NO TEAM CONFIGURED
|
|
206
|
+
|
|
207
|
+
This project doesn't have a Squad team yet.
|
|
208
|
+
|
|
209
|
+
**You MUST NOT do any project work.** Instead, tell the user:
|
|
210
|
+
1. "This project doesn't have a Squad team yet."
|
|
211
|
+
2. Suggest running \`squad init\` or the \`/init\` command to set one up.
|
|
212
|
+
3. Politely refuse any work requests until init is done.
|
|
213
|
+
|
|
96
214
|
Do not answer coding questions, route to agents, or perform any project tasks.`;
|
|
97
215
|
}
|
|
98
216
|
}
|
|
99
217
|
catch (err) {
|
|
100
218
|
debugLog('buildCoordinatorPrompt: failed to read team.md at', teamPath, err);
|
|
101
|
-
teamContent = `⚠️ NO TEAM CONFIGURED
|
|
102
|
-
|
|
103
|
-
This project doesn't have a Squad team yet.
|
|
104
|
-
|
|
105
|
-
**You MUST NOT do any project work.** Instead, tell the user:
|
|
106
|
-
1. "This project doesn't have a Squad team yet."
|
|
107
|
-
2. Suggest running \`squad init\` or the \`/init\` command to set one up.
|
|
108
|
-
3. Politely refuse any work requests until init is done.
|
|
109
|
-
|
|
219
|
+
teamContent = `⚠️ NO TEAM CONFIGURED
|
|
220
|
+
|
|
221
|
+
This project doesn't have a Squad team yet.
|
|
222
|
+
|
|
223
|
+
**You MUST NOT do any project work.** Instead, tell the user:
|
|
224
|
+
1. "This project doesn't have a Squad team yet."
|
|
225
|
+
2. Suggest running \`squad init\` or the \`/init\` command to set one up.
|
|
226
|
+
3. Politely refuse any work requests until init is done.
|
|
227
|
+
|
|
110
228
|
Do not answer coding questions, route to agents, or perform any project tasks.`;
|
|
111
229
|
}
|
|
112
230
|
// Load routing.md for routing rules
|
|
@@ -119,34 +237,34 @@ Do not answer coding questions, route to agents, or perform any project tasks.`;
|
|
|
119
237
|
debugLog('buildCoordinatorPrompt: failed to read routing.md at', routingPath, err);
|
|
120
238
|
routingContent = '(No routing.md found — run `squad init` to create one)';
|
|
121
239
|
}
|
|
122
|
-
return `You are the Squad Coordinator — you route work to the right agent.
|
|
123
|
-
|
|
124
|
-
## Team Roster
|
|
125
|
-
${teamContent}
|
|
126
|
-
|
|
127
|
-
## Routing Rules
|
|
128
|
-
${routingContent}
|
|
129
|
-
|
|
130
|
-
## Your Job
|
|
131
|
-
1. Read the user's message
|
|
132
|
-
2. Decide which agent(s) should handle it based on routing rules
|
|
133
|
-
3. If naming a specific agent ("Fenster, fix the bug"), route directly
|
|
134
|
-
4. If ambiguous, pick the best match and explain your choice
|
|
135
|
-
5. For status/factual questions, answer directly without spawning
|
|
136
|
-
|
|
137
|
-
## Response Format
|
|
138
|
-
When routing to an agent, respond with:
|
|
139
|
-
ROUTE: {agent_name}
|
|
140
|
-
TASK: {what the agent should do}
|
|
141
|
-
CONTEXT: {any relevant context}
|
|
142
|
-
|
|
143
|
-
When answering directly:
|
|
144
|
-
DIRECT: {your answer}
|
|
145
|
-
|
|
146
|
-
When routing to multiple agents:
|
|
147
|
-
MULTI:
|
|
148
|
-
- {agent1}: {task1}
|
|
149
|
-
- {agent2}: {task2}
|
|
240
|
+
return `You are the Squad Coordinator — you route work to the right agent.
|
|
241
|
+
|
|
242
|
+
## Team Roster
|
|
243
|
+
${teamContent}
|
|
244
|
+
|
|
245
|
+
## Routing Rules
|
|
246
|
+
${routingContent}
|
|
247
|
+
|
|
248
|
+
## Your Job
|
|
249
|
+
1. Read the user's message
|
|
250
|
+
2. Decide which agent(s) should handle it based on routing rules
|
|
251
|
+
3. If naming a specific agent ("Fenster, fix the bug"), route directly
|
|
252
|
+
4. If ambiguous, pick the best match and explain your choice
|
|
253
|
+
5. For status/factual questions, answer directly without spawning
|
|
254
|
+
|
|
255
|
+
## Response Format
|
|
256
|
+
When routing to an agent, respond with:
|
|
257
|
+
ROUTE: {agent_name}
|
|
258
|
+
TASK: {what the agent should do}
|
|
259
|
+
CONTEXT: {any relevant context}
|
|
260
|
+
|
|
261
|
+
When answering directly:
|
|
262
|
+
DIRECT: {your answer}
|
|
263
|
+
|
|
264
|
+
When routing to multiple agents:
|
|
265
|
+
MULTI:
|
|
266
|
+
- {agent1}: {task1}
|
|
267
|
+
- {agent2}: {task2}
|
|
150
268
|
`;
|
|
151
269
|
}
|
|
152
270
|
export function parseCoordinatorResponse(response) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../../src/cli/shell/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../../src/cli/shell/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;A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AAM,MAAM,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC;QAChE,OAAO,GAAG,MAAM,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -14,8 +14,22 @@ export declare function sdkDisconnectGuidance(detail?: string): ErrorGuidance;
|
|
|
14
14
|
export declare function teamConfigGuidance(issue: string): ErrorGuidance;
|
|
15
15
|
/** Agent session failure */
|
|
16
16
|
export declare function agentSessionGuidance(agentName: string, detail?: string): ErrorGuidance;
|
|
17
|
+
/**
|
|
18
|
+
* Extract retry-after duration (in seconds) from an error message string.
|
|
19
|
+
* Handles patterns like "retry after 120 seconds", "try again in 2 hours", etc.
|
|
20
|
+
*/
|
|
21
|
+
export declare function extractRetryAfter(message: string): number | undefined;
|
|
22
|
+
/** Rate limit hit — model or endpoint temporarily throttled */
|
|
23
|
+
export declare function rateLimitGuidance(opts?: {
|
|
24
|
+
retryAfter?: number;
|
|
25
|
+
model?: string;
|
|
26
|
+
}): ErrorGuidance;
|
|
17
27
|
/** Generic error with context */
|
|
18
28
|
export declare function genericGuidance(detail: string): ErrorGuidance;
|
|
29
|
+
/** Request timeout */
|
|
30
|
+
export declare function timeoutGuidance(agentName?: string): ErrorGuidance;
|
|
31
|
+
/** Unknown slash command */
|
|
32
|
+
export declare function unknownCommandGuidance(command: string): ErrorGuidance;
|
|
19
33
|
/** Format an ErrorGuidance into a user-facing string */
|
|
20
34
|
export declare function formatGuidance(g: ErrorGuidance): string;
|
|
21
35
|
//# sourceMappingURL=error-messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-messages.d.ts","sourceRoot":"","sources":["../../../src/cli/shell/error-messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH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Aa,CAS7D;AAED,sBAAsB;AACtB,wBAAgB,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAUjE;AAED,4BAA4B;AAC5B,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAQrE;AAED,wDAAwD;AACxD,wBAAgB,cAAc,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CASvD"}
|
|
@@ -37,13 +37,77 @@ export function agentSessionGuidance(agentName, detail) {
|
|
|
37
37
|
],
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
+
/** Format seconds into a human-readable duration string */
|
|
41
|
+
function formatDuration(seconds) {
|
|
42
|
+
const hours = Math.ceil(seconds / 3600);
|
|
43
|
+
const minutes = Math.ceil(seconds / 60);
|
|
44
|
+
if (seconds >= 3600)
|
|
45
|
+
return `${hours} hour${hours === 1 ? '' : 's'}`;
|
|
46
|
+
if (seconds >= 60)
|
|
47
|
+
return `${minutes} minute${minutes === 1 ? '' : 's'}`;
|
|
48
|
+
return `${seconds} second${seconds === 1 ? '' : 's'}`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Extract retry-after duration (in seconds) from an error message string.
|
|
52
|
+
* Handles patterns like "retry after 120 seconds", "try again in 2 hours", etc.
|
|
53
|
+
*/
|
|
54
|
+
export function extractRetryAfter(message) {
|
|
55
|
+
const secMatch = message.match(/retry.{0,15}after\s+(\d+)\s*second/i);
|
|
56
|
+
if (secMatch)
|
|
57
|
+
return parseInt(secMatch[1], 10);
|
|
58
|
+
const hrMatch = message.match(/(?:try again|retry).{0,20}in\s+(\d+)\s*hour/i);
|
|
59
|
+
if (hrMatch)
|
|
60
|
+
return parseInt(hrMatch[1], 10) * 3600;
|
|
61
|
+
const minMatch = message.match(/(?:try again|retry).{0,20}in\s+(\d+)\s*minute/i);
|
|
62
|
+
if (minMatch)
|
|
63
|
+
return parseInt(minMatch[1], 10) * 60;
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
/** Rate limit hit — model or endpoint temporarily throttled */
|
|
67
|
+
export function rateLimitGuidance(opts) {
|
|
68
|
+
const modelStr = opts?.model ? ` for ${opts.model}` : '';
|
|
69
|
+
const retryStr = opts?.retryAfter
|
|
70
|
+
? `Try again in ${formatDuration(opts.retryAfter)}`
|
|
71
|
+
: 'Try again later when the limit resets';
|
|
72
|
+
return {
|
|
73
|
+
message: `Rate limit reached${modelStr}. Copilot has temporarily throttled your requests.`,
|
|
74
|
+
recovery: [
|
|
75
|
+
retryStr,
|
|
76
|
+
'Enable economy mode to switch to cheaper models: `squad economy on`',
|
|
77
|
+
'Or set a different model: add `"defaultModel": "gpt-4.1"` to .squad/config.json',
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
40
81
|
/** Generic error with context */
|
|
41
82
|
export function genericGuidance(detail) {
|
|
42
83
|
return {
|
|
43
84
|
message: detail,
|
|
44
85
|
recovery: [
|
|
45
|
-
'Try again',
|
|
86
|
+
'Try your message again',
|
|
46
87
|
"Run 'squad doctor' for diagnostics",
|
|
88
|
+
'Check your internet connection',
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** Request timeout */
|
|
93
|
+
export function timeoutGuidance(agentName) {
|
|
94
|
+
const who = agentName ? `${agentName} timed out` : 'Request timed out';
|
|
95
|
+
return {
|
|
96
|
+
message: `${who}. The model may be under load.`,
|
|
97
|
+
recovery: [
|
|
98
|
+
'Try again — the issue is often transient',
|
|
99
|
+
'Set SQUAD_REPL_TIMEOUT=120 for a longer timeout (seconds)',
|
|
100
|
+
"Run 'squad doctor' to verify connectivity",
|
|
101
|
+
],
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/** Unknown slash command */
|
|
105
|
+
export function unknownCommandGuidance(command) {
|
|
106
|
+
return {
|
|
107
|
+
message: `Unknown command: /${command}`,
|
|
108
|
+
recovery: [
|
|
109
|
+
'Type /help to see available commands',
|
|
110
|
+
'Check for typos in the command name',
|
|
47
111
|
],
|
|
48
112
|
};
|
|
49
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-messages.js","sourceRoot":"","sources":["../../../src/cli/shell/error-messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,yCAAyC;AACzC,MAAM,UAAU,qBAAqB,CAAC,MAAe;IACnD,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,qBAAqB,MAAM,EAAE,CAAC,CAAC,CAAC,mBAAmB;QACrE,QAAQ,EAAE;YACR,wCAAwC;YACxC,gCAAgC;YAChC,gCAAgC;SACjC;KACF,CAAC;AACJ,CAAC;AAED,iCAAiC;AACjC,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO;QACL,OAAO,EAAE,6BAA6B,KAAK,EAAE;QAC7C,QAAQ,EAAE;YACR,gCAAgC;YAChC,wCAAwC;YACxC,gDAAgD;SACjD;KACF,CAAC;AACJ,CAAC;AAED,4BAA4B;AAC5B,MAAM,UAAU,oBAAoB,CAAC,SAAiB,EAAE,MAAe;IACrE,OAAO;QACL,OAAO,EAAE,GAAG,SAAS,kBAAkB,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG;QACrE,QAAQ,EAAE;YACR,sDAAsD;YACtD,mCAAmC;YACnC,QAAQ,SAAS,oBAAoB;SACtC;KACF,CAAC;AACJ,CAAC;AAED,iCAAiC;AACjC,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO;QACL,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE;YACR,
|
|
1
|
+
{"version":3,"file":"error-messages.js","sourceRoot":"","sources":["../../../src/cli/shell/error-messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,yCAAyC;AACzC,MAAM,UAAU,qBAAqB,CAAC,MAAe;IACnD,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,qBAAqB,MAAM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ACtB,MAAM,UAAU,eAAe,CAAC,SAAkB;IAChD,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,YAAY,CAAC,CAAC,CAAC,mBAAmB,CAAC;IACvE,OAAO;QACL,OAAO,EAAE,GAAG,GAAG,gCAAgC;QAC/C,QAAQ,EAAE;YACR,0CAA0C;YAC1C,2DAA2D;YAC3D,2CAA2C;SAC5C;KACF,CAAC;AACJ,CAAC;AAED,4BAA4B;AAC5B,MAAM,UAAU,sBAAsB,CAAC,OAAe;IACpD,OAAO;QACL,OAAO,EAAE,qBAAqB,OAAO,EAAE;QACvC,QAAQ,EAAE;YACR,sCAAsC;YACtC,qCAAqC;SACtC;KACF,CAAC;AACJ,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,cAAc,CAAC,CAAgB;IAC7C,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtB,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -29,7 +29,7 @@ export type { SessionData, SessionSummary } from './session-store.js';
|
|
|
29
29
|
export { App } from './components/App.js';
|
|
30
30
|
export type { ShellApi, AppProps } from './components/App.js';
|
|
31
31
|
export { ErrorBoundary } from './components/ErrorBoundary.js';
|
|
32
|
-
export { sdkDisconnectGuidance, teamConfigGuidance, agentSessionGuidance, genericGuidance, formatGuidance, } from './error-messages.js';
|
|
32
|
+
export { sdkDisconnectGuidance, teamConfigGuidance, agentSessionGuidance, genericGuidance, rateLimitGuidance, extractRetryAfter, timeoutGuidance, unknownCommandGuidance, formatGuidance, } from './error-messages.js';
|
|
33
33
|
export type { ErrorGuidance } from './error-messages.js';
|
|
34
34
|
export { enableShellMetrics, recordShellSessionDuration, recordAgentResponseLatency, recordShellError, isShellTelemetryEnabled, _resetShellMetrics, } from './shell-metrics.js';
|
|
35
35
|
/** Options for ghost response retry. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/shell/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/shell/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA6BH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC5E,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtJ,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAA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