-
Notifications
You must be signed in to change notification settings - Fork 52
feat(skill): spawn-cloud-swarm skill + connect-claude installer (PR 7b relay-side) #866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kjgbot
wants to merge
1
commit into
main
Choose a base branch
from
feat/spawn-cloud-swarm-skill
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
|
|
||
| import { | ||
| MCP_PREFLIGHT_REMEDIATION, | ||
| REQUIRED_CLOUD_LOCAL_MOUNT_TOOLS, | ||
| runMcpPreflight, | ||
| } from './mcp-preflight.js'; | ||
|
|
||
| const FULL_TOOLS = [ | ||
| { name: 'cloud.agent.spawn' }, | ||
| { name: 'cloud.agent.list' }, | ||
| { name: 'cloud.local-mount.ensure' }, | ||
| { name: 'cloud.local-mount.status' }, | ||
| { name: 'cloud.local-mount.stop' }, | ||
| ]; | ||
|
|
||
| describe('runMcpPreflight', () => { | ||
| it('returns ok when all required cloud.local-mount.* tools are present', async () => { | ||
| const result = await runMcpPreflight({ | ||
| listTools: () => FULL_TOOLS, | ||
| }); | ||
|
|
||
| expect(result.ok).toBe(true); | ||
| expect(result.missing).toEqual([]); | ||
| expect(result.remediation).toBeUndefined(); | ||
| }); | ||
|
|
||
| it('returns missing list and verbatim remediation when cloud.local-mount.ensure is absent', async () => { | ||
| const partial = FULL_TOOLS.filter((t) => t.name !== 'cloud.local-mount.ensure'); | ||
|
|
||
| const result = await runMcpPreflight({ | ||
| listTools: () => partial, | ||
| }); | ||
|
|
||
| expect(result.ok).toBe(false); | ||
| expect(result.missing).toEqual(['cloud.local-mount.ensure']); | ||
| expect(result.remediation).toBe(MCP_PREFLIGHT_REMEDIATION); | ||
| expect(MCP_PREFLIGHT_REMEDIATION).toBe( | ||
| 'Upgrade `@relaycast/mcp` to a build that includes `cloud.local-mount.*` (see relaycast PR `feat/cloud-local-mount-tools`).' | ||
| ); | ||
| }); | ||
|
|
||
| it('reports every missing tool when the MCP omits the whole local-mount surface', async () => { | ||
| const result = await runMcpPreflight({ | ||
| listTools: () => [{ name: 'cloud.agent.spawn' }, { name: 'cloud.agent.list' }], | ||
| }); | ||
|
|
||
| expect(result.ok).toBe(false); | ||
| expect(result.missing).toEqual([ | ||
| 'cloud.local-mount.ensure', | ||
| 'cloud.local-mount.status', | ||
| 'cloud.local-mount.stop', | ||
| ]); | ||
| expect(result.remediation).toBe(MCP_PREFLIGHT_REMEDIATION); | ||
| }); | ||
|
|
||
| it('exports the canonical required-tools tuple', () => { | ||
| expect(REQUIRED_CLOUD_LOCAL_MOUNT_TOOLS).toEqual([ | ||
| 'cloud.local-mount.ensure', | ||
| 'cloud.local-mount.status', | ||
| 'cloud.local-mount.stop', | ||
| ]); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| export const REQUIRED_CLOUD_LOCAL_MOUNT_TOOLS = [ | ||
| 'cloud.local-mount.ensure', | ||
| 'cloud.local-mount.status', | ||
| 'cloud.local-mount.stop', | ||
| ] as const; | ||
|
|
||
| export const MCP_PREFLIGHT_REMEDIATION = | ||
| 'Upgrade `@relaycast/mcp` to a build that includes `cloud.local-mount.*` (see relaycast PR `feat/cloud-local-mount-tools`).'; | ||
|
|
||
| export interface McpToolDescriptor { | ||
| name: string; | ||
| } | ||
|
|
||
| export interface McpPreflightResult { | ||
| ok: boolean; | ||
| missing: string[]; | ||
| remediation?: string; | ||
| } | ||
|
|
||
| export interface McpPreflightArgs { | ||
| listTools: () => Promise<readonly McpToolDescriptor[]> | readonly McpToolDescriptor[]; | ||
| required?: readonly string[]; | ||
| } | ||
|
|
||
| export async function runMcpPreflight(args: McpPreflightArgs): Promise<McpPreflightResult> { | ||
| const required = args.required ?? REQUIRED_CLOUD_LOCAL_MOUNT_TOOLS; | ||
| const tools = await args.listTools(); | ||
| const present = new Set(tools.map((t) => t.name)); | ||
| const missing = required.filter((name) => !present.has(name)); | ||
|
|
||
| if (missing.length === 0) { | ||
| return { ok: true, missing: [] }; | ||
| } | ||
|
|
||
| return { | ||
| ok: false, | ||
| missing, | ||
| remediation: MCP_PREFLIGHT_REMEDIATION, | ||
| }; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the Claude skill probe fail-open so connect success is not downgraded to failure.
If
skillInstalled(...)throws (override bug, filesystem edge case), the exception bubbles to the outercatchand turns a successful connect into a failed command.Suggested fix
success = result.success; if (success && trackedProvider === 'anthropic') { - const skillInstalled = deps.skillInstalled ?? hasClaudeSkillInstalled; - if (!skillInstalled(SPAWN_CLOUD_SWARM_SKILL_NAME)) { - deps.log( - `Install ${SPAWN_CLOUD_SWARM_SKILL_NAME} before spawning cloud swarms: ${SPAWN_CLOUD_SWARM_SKILL_INSTALL_COMMAND}` - ); - } + try { + const skillInstalled = deps.skillInstalled ?? hasClaudeSkillInstalled; + if (!skillInstalled(SPAWN_CLOUD_SWARM_SKILL_NAME)) { + deps.log( + `Install ${SPAWN_CLOUD_SWARM_SKILL_NAME} before spawning cloud swarms: ${SPAWN_CLOUD_SWARM_SKILL_INSTALL_COMMAND}` + ); + } + } catch (skillErr) { + const message = skillErr instanceof Error ? skillErr.message : String(skillErr ?? 'unknown error'); + deps.log(`warning: unable to verify Claude skill installation (${message})`); + } }📝 Committable suggestion
🤖 Prompt for AI Agents