@andorra-labs/code 0.1.5 → 0.1.7
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/dist/src/account-presentation.js +3 -3
- package/dist/src/agent-execution.d.ts +2 -0
- package/dist/src/agent-execution.js +526 -41
- package/dist/src/agent-mcp-catalog.d.ts +21 -0
- package/dist/src/agent-mcp-catalog.js +40 -0
- package/dist/src/agent-mcp.d.ts +36 -3
- package/dist/src/agent-mcp.js +114 -45
- package/dist/src/app-server/protocol.d.ts +57 -5
- package/dist/src/app-server/protocol.js +18 -1
- package/dist/src/app-server/workspace.d.ts +9 -1
- package/dist/src/app-server/workspace.js +50 -3
- package/dist/src/app-server.d.ts +115 -41
- package/dist/src/app-server.js +1316 -221
- package/dist/src/auth/AuthManager.d.ts +33 -1
- package/dist/src/auth/AuthManager.js +138 -10
- package/dist/src/auth/callback-page.d.ts +4 -0
- package/dist/src/auth/callback-page.js +70 -0
- package/dist/src/auth/callback.d.ts +39 -0
- package/dist/src/auth/callback.js +146 -22
- package/dist/src/auth/index.d.ts +10 -6
- package/dist/src/auth/index.js +2 -2
- package/dist/src/auth/store.d.ts +142 -3
- package/dist/src/auth/store.js +334 -13
- package/dist/src/auth/types.d.ts +17 -1
- package/dist/src/auth-commands.d.ts +11 -2
- package/dist/src/auth-commands.js +14 -7
- package/dist/src/automation-runner.d.ts +9 -0
- package/dist/src/automation-runner.js +22 -1
- package/dist/src/automation-tool.js +18 -3
- package/dist/src/automations.d.ts +5 -0
- package/dist/src/automations.js +11 -1
- package/dist/src/browser-captcha-tool.d.ts +54 -0
- package/dist/src/browser-captcha-tool.js +374 -0
- package/dist/src/browser-panel-tool.d.ts +7 -0
- package/dist/src/browser-panel-tool.js +74 -3
- package/dist/src/browser-runner.js +19 -4
- package/dist/src/browser-server.js +21 -1
- package/dist/src/browser-session.d.ts +16 -0
- package/dist/src/browser-session.js +35 -0
- package/dist/src/browser-ui/app.js +193 -3
- package/dist/src/browser-ui/style.css +15 -1
- package/dist/src/browser-view.d.ts +72 -4
- package/dist/src/browser-view.js +229 -17
- package/dist/src/capabilities.d.ts +9 -3
- package/dist/src/capabilities.js +20 -5
- package/dist/src/capsolver.d.ts +60 -0
- package/dist/src/capsolver.js +101 -0
- package/dist/src/claude-provider.d.ts +6 -0
- package/dist/src/claude-provider.js +34 -3
- package/dist/src/cli-executable.d.ts +33 -0
- package/dist/src/cli-executable.js +64 -0
- package/dist/src/cli-process.d.ts +47 -0
- package/dist/src/cli-process.js +113 -0
- package/dist/src/cli-sign-in.d.ts +68 -0
- package/dist/src/cli-sign-in.js +224 -0
- package/dist/src/cli.js +84 -26
- package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +1 -1
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +5 -5
- package/dist/src/codex-provider.js +12 -0
- package/dist/src/coding-tools.d.ts +5 -0
- package/dist/src/coding-tools.js +98 -53
- package/dist/src/command-output-tap.d.ts +16 -0
- package/dist/src/command-output-tap.js +45 -0
- package/dist/src/command-screens.js +3 -3
- package/dist/src/commands.d.ts +15 -2
- package/dist/src/commands.js +14 -13
- package/dist/src/completion.d.ts +23 -5
- package/dist/src/completion.js +380 -17
- package/dist/src/config.d.ts +61 -0
- package/dist/src/config.js +276 -12
- package/dist/src/context-budget.d.ts +7 -0
- package/dist/src/context-budget.js +18 -1
- package/dist/src/deadline.js +6 -0
- package/dist/src/decision/FactContinuations.d.ts +41 -6
- package/dist/src/decision/FactContinuations.js +211 -64
- package/dist/src/decision/PreparedSteps.js +3 -1
- package/dist/src/decision/checks.d.ts +25 -0
- package/dist/src/decision/checks.js +77 -6
- package/dist/src/delegation-changes.d.ts +109 -0
- package/dist/src/delegation-changes.js +431 -0
- package/dist/src/extensions.d.ts +1 -0
- package/dist/src/extensions.js +16 -3
- package/dist/src/graph-provider-portability.js +2 -2
- package/dist/src/graph-quota.d.ts +1 -1
- package/dist/src/graph-quota.js +1 -1
- package/dist/src/graph-runner.js +35 -21
- package/dist/src/graph-selection.d.ts +6 -0
- package/dist/src/graph-selection.js +10 -0
- package/dist/src/graph-server.d.ts +8 -0
- package/dist/src/graph-server.js +76 -6
- package/dist/src/graph-sync.d.ts +65 -0
- package/dist/src/graph-sync.js +433 -13
- package/dist/src/graph-tool.d.ts +52 -0
- package/dist/src/graph-tool.js +136 -0
- package/dist/src/graph-ui/app.js +272 -50
- package/dist/src/graph-ui/controls.js +6 -0
- package/dist/src/graph-ui/drafts.js +39 -0
- package/dist/src/graph-ui/embed.js +1 -1
- package/dist/src/graph-ui/icons.js +1 -0
- package/dist/src/graph-ui/index.html +2 -2
- package/dist/src/graph-ui/skill-picker.js +242 -0
- package/dist/src/graph-ui/studio.css +7 -5
- package/dist/src/graph-ui/style.css +65 -12
- package/dist/src/graphs.d.ts +60 -5
- package/dist/src/graphs.js +191 -37
- package/dist/src/grok-provider.d.ts +50 -0
- package/dist/src/grok-provider.js +186 -0
- package/dist/src/handoffs.d.ts +13 -0
- package/dist/src/handoffs.js +31 -1
- package/dist/src/hardened-runtime.d.ts +4 -4
- package/dist/src/hardened-runtime.js +109 -9
- package/dist/src/managed-sign-in.d.ts +38 -0
- package/dist/src/managed-sign-in.js +169 -0
- package/dist/src/markdown.d.ts +5 -0
- package/dist/src/markdown.js +5 -2
- package/dist/src/mcp.js +11 -0
- package/dist/src/membership.d.ts +8 -1
- package/dist/src/membership.js +15 -5
- package/dist/src/model-metadata.js +14 -2
- package/dist/src/model-override.d.ts +10 -0
- package/dist/src/model-override.js +20 -0
- package/dist/src/opencode-cli-provider.d.ts +122 -0
- package/dist/src/opencode-cli-provider.js +415 -0
- package/dist/src/opencode-provider.js +23 -8
- package/dist/src/palette.d.ts +2 -0
- package/dist/src/palette.js +2 -0
- package/dist/src/permissions.d.ts +19 -1
- package/dist/src/permissions.js +30 -1
- package/dist/src/powershell-pool.d.ts +11 -2
- package/dist/src/powershell-pool.js +34 -5
- package/dist/src/provider-connection.js +36 -0
- package/dist/src/provider-engine.d.ts +2 -1
- package/dist/src/provider-engine.js +64 -13
- package/dist/src/provider-import.js +6 -1
- package/dist/src/provider-keys.d.ts +48 -0
- package/dist/src/provider-keys.js +121 -0
- package/dist/src/provider-settings.js +22 -3
- package/dist/src/providers.d.ts +12 -1
- package/dist/src/providers.js +27 -8
- package/dist/src/pull-requests.d.ts +123 -20
- package/dist/src/pull-requests.js +334 -84
- package/dist/src/qa/qa-authorize.js +9 -1
- package/dist/src/qa/runtime/ProcessManager.d.ts +6 -0
- package/dist/src/qa/runtime/ProcessManager.js +16 -0
- package/dist/src/react-runtime.js +106 -7
- package/dist/src/read-image.d.ts +30 -0
- package/dist/src/read-image.js +97 -0
- package/dist/src/remote/engine-pool.js +1 -1
- package/dist/src/run-progress.js +6 -1
- package/dist/src/run-records.d.ts +133 -27
- package/dist/src/run-records.js +320 -40
- package/dist/src/runtime.d.ts +38 -1
- package/dist/src/runtime.js +27 -4
- package/dist/src/save-lock.d.ts +11 -0
- package/dist/src/save-lock.js +29 -2
- package/dist/src/secret-redaction.d.ts +13 -0
- package/dist/src/secret-redaction.js +71 -0
- package/dist/src/session-summary.d.ts +10 -4
- package/dist/src/session-summary.js +14 -7
- package/dist/src/sessions.js +8 -2
- package/dist/src/shell.js +4 -1
- package/dist/src/side-panel.d.ts +1 -1
- package/dist/src/side-panel.js +1 -1
- package/dist/src/skill-commands.d.ts +2 -0
- package/dist/src/skill-commands.js +2 -0
- package/dist/src/skills/bundled/create-agent/SKILL.md +81 -0
- package/dist/src/skills/bundled/create-skill/SKILL.md +81 -0
- package/dist/src/skills/bundled/doctor/SKILL.md +43 -0
- package/dist/src/skills/bundled/graph-manager/SKILL.md +100 -0
- package/dist/src/skills/bundled/graph-manager/errors.md +38 -0
- package/dist/src/skills/bundled/graph-manager/patterns.md +78 -0
- package/dist/src/skills/bundled/manage-mcp/SKILL.md +75 -0
- package/dist/src/skills/bundled/manage-mcp/probe.md +165 -0
- package/dist/src/skills/bundled/manage-skills/SKILL.md +67 -0
- package/dist/src/skills/bundled/provenance.json +50 -0
- package/dist/src/skills/bundled/write-instructions/SKILL.md +42 -0
- package/dist/src/skills/invocable-skills.d.ts +41 -0
- package/dist/src/skills/invocable-skills.js +49 -0
- package/dist/src/skills/prompt-skills.d.ts +1 -0
- package/dist/src/skills/prompt-skills.js +33 -0
- package/dist/src/skills/runtime-skills.d.ts +4 -0
- package/dist/src/skills/runtime-skills.js +21 -0
- package/dist/src/structured-step.d.ts +55 -0
- package/dist/src/structured-step.js +85 -0
- package/dist/src/subagent-run.d.ts +1 -1
- package/dist/src/subagent-run.js +29 -33
- package/dist/src/telemetry/schema.d.ts +2 -2
- package/dist/src/telemetry/schema.js +3 -2
- package/dist/src/terminal-ui.d.ts +38 -0
- package/dist/src/terminal-ui.js +126 -28
- package/dist/src/timers.d.ts +21 -2
- package/dist/src/timers.js +12 -4
- package/dist/src/tool-dependencies.js +4 -0
- package/dist/src/tool-names.d.ts +18 -0
- package/dist/src/tool-names.js +26 -0
- package/dist/src/tools.d.ts +9 -0
- package/dist/src/tools.js +159 -20
- package/dist/src/trajectory.js +32 -12
- package/dist/src/transcript.js +5 -0
- package/dist/src/types.d.ts +36 -0
- package/dist/src/web-search.d.ts +59 -0
- package/dist/src/web-search.js +216 -0
- package/docs/agents/README.md +2 -2
- package/docs/agents/mcp-server.md +28 -3
- package/docs/agents/subagent-mode.md +7 -4
- package/docs/concepts/README.md +1 -1
- package/docs/concepts/security.md +4 -2
- package/docs/getting-started/accounts.md +15 -4
- package/docs/getting-started/configure-providers.md +30 -3
- package/docs/guides/README.md +1 -0
- package/docs/guides/browser.md +12 -0
- package/docs/guides/desktop-app.md +11 -4
- package/docs/guides/graph-builder.md +9 -1
- package/docs/guides/web-search.md +47 -0
- package/docs/reference/cli.md +4 -3
- package/docs/reference/config.md +4 -4
- package/docs/reference/slash-commands.md +2 -1
- package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +125 -0
- package/docs/superpowers/plans/2026-11-09-orchestrator-delegation.md +295 -0
- package/docs/superpowers/specs/2026-11-01-pr-section-design.md +7 -0
- package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +206 -0
- package/docs/superpowers/specs/2026-11-09-orchestrator-delegation-design.md +291 -0
- package/package.json +1 -1
- package/tests/permissions-test-plan.md +2 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Graph patterns
|
|
2
|
+
|
|
3
|
+
Shapes that fit common requests. Adapt the names, instructions, providers and limits; validate every result
|
|
4
|
+
with `andorra_graph_validate`. Each agent node below needs a `provider` from `andorra_providers_list`.
|
|
5
|
+
|
|
6
|
+
## Plan → build → review loop
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
plan --completed--> build --completed--> review
|
|
10
|
+
review --pass--> done
|
|
11
|
+
review --fail--> build
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- `plan`: read-only capabilities; output a `taskInstruction` and `acceptanceCriteria`.
|
|
15
|
+
- `build`: read-write files and shell; input mapped from `plan`'s output.
|
|
16
|
+
- `review`: `completion: { mode: "outcomes", outcomes: ["pass", "fail"], criteria: { pass: "...", fail: "..." } }`,
|
|
17
|
+
read-only capabilities; output `findings`.
|
|
18
|
+
- Limits: `limits.maxNodeVisits` is a ceiling on each node's own visits, not a total across the graph. For
|
|
19
|
+
at most three build/review rounds set it to 3: `build` and `review` may each run three times, and `plan`
|
|
20
|
+
and `done` are counted separately.
|
|
21
|
+
|
|
22
|
+
## Route by kind of work
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
triage --frontend--> frontend-dev --completed--> done
|
|
26
|
+
triage --backend--> backend-dev --completed--> done
|
|
27
|
+
triage --devops--> devops-dev --completed--> done
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- `triage`: `completion: { mode: "outcomes", outcomes: ["frontend", "backend", "devops"], criteria: {...} }` with
|
|
31
|
+
one written criterion per outcome; read-only.
|
|
32
|
+
- Each specialist gets an instruction for its area and only the capabilities it needs (a DevOps agent may
|
|
33
|
+
need `deployment: "allowed"`; the others do not).
|
|
34
|
+
|
|
35
|
+
## Parallel read-only reviewers
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
build --completed--> fan-out (parallel) --completed--> security-review, perf-review, style-review
|
|
39
|
+
security-review, perf-review, style-review --completed--> join (join all) --completed--> summarize --completed--> done
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- Reviewers are read-only: copies and parallel branches cannot write to the shared workspace.
|
|
43
|
+
- `join` with `{ mode: "all" }` waits for every reviewer; never join on mutually exclusive branches.
|
|
44
|
+
- `summarize` merges the findings into one report.
|
|
45
|
+
|
|
46
|
+
## QA retry loop with a cap
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
implement --completed--> qa
|
|
50
|
+
qa --pass--> done
|
|
51
|
+
qa --fail--> implement
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- Use a plain cycle with `limits.maxNodeVisits` (3 for three attempts); running out of attempts stops the run
|
|
55
|
+
rather than reporting success. `qa` declares `completion: { mode: "outcomes", outcomes: ["pass", "fail"] }`.
|
|
56
|
+
- Do not use the agent `loop` modifier here. With `modifiers.loop.until.outcome: "pass"` a node exposes only
|
|
57
|
+
`pass`, so the `fail` edge back to `implement` no longer validates, and the modifier reruns `qa` on its own
|
|
58
|
+
without returning to `implement`.
|
|
59
|
+
|
|
60
|
+
## Retry one agent until it passes
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
check (loop modifier) --pass--> done
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- `check` with `modifiers.loop: { maxIterations: 3, until: { outcome: "pass" } }` reruns itself until it reports
|
|
67
|
+
`pass` or runs out of attempts. It exposes only the `pass` port; use it when the same agent fixes and
|
|
68
|
+
rechecks its own work.
|
|
69
|
+
|
|
70
|
+
## Single agent with a human approval
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
draft --completed--> approve (approval)
|
|
74
|
+
approve --approved--> publish --completed--> done
|
|
75
|
+
approve --rejected--> draft
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
- `approval` nodes ask the person in the live run before continuing.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-mcp
|
|
3
|
+
description: "Add, change, test, turn off or remove an MCP server in Andorra Code. Use when the user wants to connect a tool server (GitHub, a database, a browser, an internal API), asks why an MCP server's tools are missing, or wants one disconnected."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Manage MCP servers
|
|
7
|
+
|
|
8
|
+
MCP servers give Andorra's agents extra tools. They are configured in the `mcpServers` object of
|
|
9
|
+
Andorra's `config.json`, and every task started after a change connects to the servers as they are then
|
|
10
|
+
configured. This skill edits that object safely and proves the result works.
|
|
11
|
+
|
|
12
|
+
## Where the configuration lives
|
|
13
|
+
|
|
14
|
+
- The Andorra home is `$ANDORRACODE_HOME` when that variable is set, otherwise `~/.andorracode`
|
|
15
|
+
(`%USERPROFILE%\.andorracode` on Windows). The file is `<home>/config.json`.
|
|
16
|
+
- It is outside the workspace, so reading and writing it goes through the normal approval prompts.
|
|
17
|
+
- People can do the same by hand: `/mcp` in the terminal, or Settings → MCP in the desktop app.
|
|
18
|
+
|
|
19
|
+
## The entry format
|
|
20
|
+
|
|
21
|
+
`mcpServers` maps an id (letters, digits, `_` and `-`) to one of two shapes:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"github": { "transport": "stdio", "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"],
|
|
27
|
+
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}" } },
|
|
28
|
+
"search": { "transport": "http", "url": "https://mcp.example.com/mcp",
|
|
29
|
+
"headers": { "Authorization": "Bearer ${SEARCH_API_KEY}" } },
|
|
30
|
+
"old-db": { "transport": "stdio", "command": "db-mcp", "enabled": false }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- `stdio`: `command` (required), `args` (strings), `env` (names matching `[A-Za-z_][A-Za-z0-9_]*`). Only the
|
|
36
|
+
variables listed in `env` reach the server, plus the SDK's minimal defaults.
|
|
37
|
+
- `http`: `url` must be `https://`, or `http://` to a private or local host; no user name or password in
|
|
38
|
+
the URL, no `#fragment`. `headers` are strings.
|
|
39
|
+
- `enabled: false` keeps the entry but does not connect it.
|
|
40
|
+
- `${NAME}` inside an `env` or `headers` value is replaced from Andorra's own environment when the server
|
|
41
|
+
connects. A missing variable fails that server with "Missing MCP environment reference".
|
|
42
|
+
|
|
43
|
+
## Rules
|
|
44
|
+
|
|
45
|
+
- **Never write a secret into `config.json`, and never print one.** Put `${NAME}` in the entry and tell the
|
|
46
|
+
user which environment variable to set, and where (shell profile, or the system environment on Windows).
|
|
47
|
+
If the user pastes a token into chat, do not repeat it back; use the reference instead.
|
|
48
|
+
- Change only the `mcpServers` entries the user asked about. Read the whole file, change that key, and
|
|
49
|
+
write the whole file back, keeping every other setting exactly as it was. If the file does not parse,
|
|
50
|
+
stop and report that instead of rewriting it.
|
|
51
|
+
- Show the user the entry you will write (with references, not values) and get their go-ahead before
|
|
52
|
+
writing. Removing an entry also needs their confirmation; offer `enabled: false` as the reversible option.
|
|
53
|
+
- Prefer the server's published install command (its README) over guessing package names.
|
|
54
|
+
|
|
55
|
+
## Steps
|
|
56
|
+
|
|
57
|
+
1. **Understand the request.** Which server, which transport, and what it needs (tokens, a URL, a database
|
|
58
|
+
path). Read the server's README when you can.
|
|
59
|
+
2. **Read `config.json`** and list the existing `mcpServers` ids, so you neither duplicate nor clobber one.
|
|
60
|
+
3. **Draft the entry**, with `${NAME}` for every secret, and show it. Wait for approval.
|
|
61
|
+
4. **Write the file** as described in the rules.
|
|
62
|
+
5. **Probe the server.** Read `probe.md` in this skill (`read_skill_resource` with path `probe.md`) and run
|
|
63
|
+
its check: it starts a stdio server, or calls an HTTP one, asks for its tools and prints their names.
|
|
64
|
+
Give it the entry's `env` (or `headers`) exactly as written, through `MCP_PROBE_ENV` (`MCP_PROBE_HEADERS`):
|
|
65
|
+
the server then sees only what a task would give it, never the rest of your environment.
|
|
66
|
+
6. **Report:** the id, the transport, the tools the probe listed (or the exact error and the fix), and that
|
|
67
|
+
the tools are available from the next task. If an environment variable must still be set, say which.
|
|
68
|
+
|
|
69
|
+
## Turning off, removing, troubleshooting
|
|
70
|
+
|
|
71
|
+
- Turn off: set `"enabled": false`. Turn on: remove that key or set it to `true`.
|
|
72
|
+
- Remove: delete the id from `mcpServers` after the user confirms.
|
|
73
|
+
- Tools missing in a task: check the entry is enabled, every `${NAME}` is set in the environment Andorra
|
|
74
|
+
starts from (a desktop app started from the Start menu does not see variables set only in a terminal),
|
|
75
|
+
the command is on `PATH`, and the probe passes. Report what you found before changing anything.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Probing an MCP server
|
|
2
|
+
|
|
3
|
+
Write this script to a temporary file (for example `mcp-probe.mjs` in the system temp folder, never inside
|
|
4
|
+
the user's repository), run it with Node, then delete it. It prints the server's tool names, or the error.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
node mcp-probe.mjs stdio <command> [args...]
|
|
10
|
+
node mcp-probe.mjs http <url>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The probe connects the way Andorra does, so a pass means the entry works in a task:
|
|
14
|
+
|
|
15
|
+
- **stdio:** the server gets only the variables the entry's `env` lists, plus the minimal defaults the MCP SDK
|
|
16
|
+
passes (`PATH`, the home and temp folders and similar). Pass the entry's `env` object exactly as written in
|
|
17
|
+
`config.json`, `${NAME}` references included, through `MCP_PROBE_ENV`; the probe expands each reference from
|
|
18
|
+
its own environment and fails on a missing one, as Andorra does. Nothing else from your environment reaches
|
|
19
|
+
the server, so a probe cannot pass on a credential that a task would not have.
|
|
20
|
+
- **http:** pass the entry's `headers` object the same way through `MCP_PROBE_HEADERS`.
|
|
21
|
+
|
|
22
|
+
Example (bash): `MCP_PROBE_ENV='{"GITHUB_PERSONAL_ACCESS_TOKEN":"${GITHUB_TOKEN}"}' node mcp-probe.mjs stdio npx -y @modelcontextprotocol/server-github`.
|
|
23
|
+
PowerShell: `$env:MCP_PROBE_ENV = '{"GITHUB_PERSONAL_ACCESS_TOKEN":"${GITHUB_TOKEN}"}'` before the `node` line.
|
|
24
|
+
The single quotes keep the shell from expanding the reference; the probe does that.
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
// mcp-probe.mjs — list an MCP server's tools over stdio or HTTP, the way Andorra connects, then exit.
|
|
28
|
+
import { spawn } from 'node:child_process';
|
|
29
|
+
|
|
30
|
+
const TIMEOUT_MS = 30_000;
|
|
31
|
+
const [mode, target, ...rest] = process.argv.slice(2);
|
|
32
|
+
const initialize = { jsonrpc: '2.0', id: 1, method: 'initialize',
|
|
33
|
+
params: { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'andorra-mcp-probe', version: '1' } } };
|
|
34
|
+
const initialized = { jsonrpc: '2.0', method: 'notifications/initialized' };
|
|
35
|
+
const MAX_PAGES = 50;
|
|
36
|
+
const listTools = (id, cursor) => ({ jsonrpc: '2.0', id, method: 'tools/list', params: cursor === undefined ? {} : { cursor } });
|
|
37
|
+
/** Values expanded from the environment; any of them may be a credential, so none is ever printed. */
|
|
38
|
+
const secrets = new Set();
|
|
39
|
+
const redact = text => {
|
|
40
|
+
let safe = String(text);
|
|
41
|
+
for (const value of [...secrets].sort((a, b) => b.length - a.length)) safe = safe.split(value).join('[redacted]');
|
|
42
|
+
return safe.replace(/[\r\n]+/g, ' ').slice(0, 300);
|
|
43
|
+
};
|
|
44
|
+
const report = tools => { console.log(`OK: ${tools.length} tools`); for (const tool of tools) console.log(`- ${redact(tool.name)}`); };
|
|
45
|
+
const fail = message => { console.error(`FAILED: ${redact(message)}`); process.exitCode = 1; };
|
|
46
|
+
|
|
47
|
+
/** `${NAME}` references expand from this process's environment; a missing one fails, as in Andorra. */
|
|
48
|
+
const expanded = name => {
|
|
49
|
+
const raw = process.env[name] ? JSON.parse(process.env[name]) : {};
|
|
50
|
+
return Object.fromEntries(Object.entries(raw).map(([key, value]) => [key, String(value).replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, variable) => {
|
|
51
|
+
if (process.env[variable] === undefined) throw new Error(`Missing MCP environment reference \${${variable}}`);
|
|
52
|
+
if (process.env[variable].length >= 4) secrets.add(process.env[variable]);
|
|
53
|
+
return process.env[variable];
|
|
54
|
+
})]));
|
|
55
|
+
};
|
|
56
|
+
/** The variables the MCP SDK passes to a stdio server by default; nothing else is inherited. */
|
|
57
|
+
const DEFAULTS = process.platform === 'win32'
|
|
58
|
+
? ['APPDATA', 'HOMEDRIVE', 'HOMEPATH', 'LOCALAPPDATA', 'PATH', 'PROCESSOR_ARCHITECTURE', 'SYSTEMDRIVE', 'SYSTEMROOT', 'TEMP', 'USERNAME', 'USERPROFILE', 'PROGRAMFILES']
|
|
59
|
+
: ['HOME', 'LOGNAME', 'PATH', 'SHELL', 'TERM', 'USER'];
|
|
60
|
+
const baseEnvironment = () => Object.fromEntries(DEFAULTS.flatMap(key => {
|
|
61
|
+
const found = Object.keys(process.env).find(name => name.toUpperCase() === key);
|
|
62
|
+
return found && !process.env[found].startsWith('()') ? [[found, process.env[found]]] : [];
|
|
63
|
+
}));
|
|
64
|
+
|
|
65
|
+
if (mode === 'stdio') {
|
|
66
|
+
let env;
|
|
67
|
+
try { env = { ...baseEnvironment(), ...expanded('MCP_PROBE_ENV') }; } catch (error) { fail(error.message); process.exit(); }
|
|
68
|
+
// Windows runs `npx` and other .cmd launchers only through the shell; give it one quoted command line.
|
|
69
|
+
const quote = part => /[\s"]/.test(part) ? `"${part.replace(/"/g, '\\"')}"` : part;
|
|
70
|
+
const child = process.platform === 'win32'
|
|
71
|
+
? spawn([target, ...rest].map(quote).join(' '), { stdio: ['pipe', 'pipe', 'pipe'], env, shell: true })
|
|
72
|
+
: spawn(target, rest, { stdio: ['pipe', 'pipe', 'pipe'], env });
|
|
73
|
+
let buffer = '', errors = '';
|
|
74
|
+
const tools = [];
|
|
75
|
+
const timer = setTimeout(() => { fail(`no answer within ${TIMEOUT_MS / 1000} seconds` + (errors ? `; stderr: ${errors.slice(-500)}` : '')); child.kill(); }, TIMEOUT_MS);
|
|
76
|
+
child.stderr.on('data', chunk => { errors += chunk; });
|
|
77
|
+
child.on('error', error => { clearTimeout(timer); fail(error.message); });
|
|
78
|
+
child.stdout.on('data', chunk => {
|
|
79
|
+
buffer += chunk;
|
|
80
|
+
for (let at; (at = buffer.indexOf('\n')) >= 0;) {
|
|
81
|
+
const line = buffer.slice(0, at).trim(); buffer = buffer.slice(at + 1);
|
|
82
|
+
if (!line) continue;
|
|
83
|
+
let message; try { message = JSON.parse(line); } catch { continue; }
|
|
84
|
+
if (message.id === 1) {
|
|
85
|
+
if (message.error) { clearTimeout(timer); fail(message.error.message); child.kill(); return; }
|
|
86
|
+
child.stdin.write(JSON.stringify(initialized) + '\n');
|
|
87
|
+
child.stdin.write(JSON.stringify(listTools(2)) + '\n');
|
|
88
|
+
}
|
|
89
|
+
if (typeof message.id === 'number' && message.id >= 2) {
|
|
90
|
+
if (message.error) { clearTimeout(timer); fail(message.error.message); child.kill(); return; }
|
|
91
|
+
tools.push(...(message.result?.tools ?? []));
|
|
92
|
+
// Andorra follows every page of tools/list; so does the probe, up to a bound.
|
|
93
|
+
const cursor = message.result?.nextCursor;
|
|
94
|
+
if (cursor !== undefined && message.id - 1 < MAX_PAGES) { child.stdin.write(JSON.stringify(listTools(message.id + 1, cursor)) + '\n'); continue; }
|
|
95
|
+
clearTimeout(timer);
|
|
96
|
+
if (cursor !== undefined) fail(`more than ${MAX_PAGES} pages of tools`); else report(tools);
|
|
97
|
+
child.kill();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
child.stdin.write(JSON.stringify(initialize) + '\n');
|
|
102
|
+
} else if (mode === 'http') {
|
|
103
|
+
let headers;
|
|
104
|
+
try { headers = { 'content-type': 'application/json', accept: 'application/json, text/event-stream', ...expanded('MCP_PROBE_HEADERS') }; }
|
|
105
|
+
catch (error) { fail(error.message); process.exit(); }
|
|
106
|
+
/**
|
|
107
|
+
* POST one message and return the JSON-RPC reply with the given id. An SSE answer is read event by event
|
|
108
|
+
* and the stream is cancelled once the reply arrives, because a server may keep it open; every request is
|
|
109
|
+
* bounded by the timeout.
|
|
110
|
+
*/
|
|
111
|
+
const post = async (body, session, id) => {
|
|
112
|
+
const response = await fetch(target, { method: 'POST', redirect: 'error', signal: AbortSignal.timeout(TIMEOUT_MS),
|
|
113
|
+
headers: { ...headers, ...(session ? { 'mcp-session-id': session } : {}) }, body: JSON.stringify(body) });
|
|
114
|
+
const next = response.headers.get('mcp-session-id') ?? session;
|
|
115
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
116
|
+
if (id === undefined) { await response.body?.cancel(); return { session: next }; }
|
|
117
|
+
if (!(response.headers.get('content-type') ?? '').includes('text/event-stream')) return { message: await response.json(), session: next };
|
|
118
|
+
const reader = response.body.getReader(), decoder = new TextDecoder();
|
|
119
|
+
let text = '';
|
|
120
|
+
try {
|
|
121
|
+
for (;;) {
|
|
122
|
+
const { value, done } = await reader.read();
|
|
123
|
+
if (done) throw new Error('the event stream ended without a reply');
|
|
124
|
+
text += decoder.decode(value, { stream: true });
|
|
125
|
+
for (let at; (at = text.search(/\r?\n\r?\n/)) >= 0;) {
|
|
126
|
+
const event = text.slice(0, at); text = text.slice(at).replace(/^\r?\n\r?\n/, '');
|
|
127
|
+
const data = event.split(/\r?\n/).filter(line => line.startsWith('data:')).map(line => line.slice(5).trimStart()).join('\n');
|
|
128
|
+
if (!data) continue;
|
|
129
|
+
const message = JSON.parse(data);
|
|
130
|
+
if (message.id === id) return { message, session: next };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} finally { await reader.cancel().catch(() => {}); }
|
|
134
|
+
};
|
|
135
|
+
try {
|
|
136
|
+
const first = await post(initialize, undefined, 1);
|
|
137
|
+
if (first.message.error) throw new Error(first.message.error.message);
|
|
138
|
+
const ready = await post(initialized, first.session);
|
|
139
|
+
const tools = [];
|
|
140
|
+
let cursor, page = 0, session = ready.session;
|
|
141
|
+
do {
|
|
142
|
+
const reply = await post(listTools(page + 2, cursor), session, page + 2);
|
|
143
|
+
if (reply.message.error) throw new Error(reply.message.error.message);
|
|
144
|
+
tools.push(...(reply.message.result?.tools ?? []));
|
|
145
|
+
cursor = reply.message.result?.nextCursor; session = reply.session;
|
|
146
|
+
} while (cursor !== undefined && ++page < MAX_PAGES);
|
|
147
|
+
if (cursor !== undefined) throw new Error(`more than ${MAX_PAGES} pages of tools`);
|
|
148
|
+
report(tools);
|
|
149
|
+
} catch (error) { fail(error instanceof Error ? error.message : String(error)); }
|
|
150
|
+
} else {
|
|
151
|
+
fail('usage: node mcp-probe.mjs stdio <command> [args...] | http <url>');
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Reading the result:
|
|
156
|
+
|
|
157
|
+
- `OK: N tools` with names: the server works with exactly what the entry gives it. Every page of the tool
|
|
158
|
+
list is followed, as Andorra does.
|
|
159
|
+
- Any value expanded from the environment is shown as `[redacted]` in output, and server messages are cut to
|
|
160
|
+
300 characters, so a server that echoes a token cannot put it in the conversation.
|
|
161
|
+
- `FAILED: Missing MCP environment reference ${NAME}`: set that variable where Andorra starts.
|
|
162
|
+
- `FAILED: spawn ... ENOENT`: the command is not on `PATH`; use a full path or install the server.
|
|
163
|
+
- `FAILED: HTTP 401` / `403`: the token reference is unset or wrong; check the environment variable.
|
|
164
|
+
- `FAILED: no answer within 30 seconds` (stdio) or a timeout error (http): the server waits for something,
|
|
165
|
+
often a missing variable; stdio failures include its stderr.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-skills
|
|
3
|
+
description: "List, install, turn on or off, and remove Andorra Code skills and plugins. Use when the user asks what skills they have, wants to add a skill from GitHub or a folder, disable one, or clean up skills they no longer use."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Manage skills and plugins
|
|
7
|
+
|
|
8
|
+
Installed skills and plugins live in the Andorra home and are shared by every project on this machine.
|
|
9
|
+
|
|
10
|
+
## Where things are
|
|
11
|
+
|
|
12
|
+
- Home: `$ANDORRACODE_HOME` when set, otherwise `~/.andorracode`.
|
|
13
|
+
- Skills: `<home>/skills/<id>/` (a `SKILL.md`, or a repository with several skills and a manifest).
|
|
14
|
+
- Plugins: `<home>/plugins/<id>/`.
|
|
15
|
+
- On/off state: `config.json` → `extensions.disabledSkills` and `extensions.disabledPlugins`, arrays of ids.
|
|
16
|
+
An id absent from the array is enabled.
|
|
17
|
+
- Project skills are separate: `<workspace>/.andorra/skills/` and `.agents/skills/`, committed with the
|
|
18
|
+
repository. Andorra's own skills (`/manage-mcp`, `/graph-manager` and others) ship with the app and cannot
|
|
19
|
+
be removed or turned off.
|
|
20
|
+
|
|
21
|
+
## Listing
|
|
22
|
+
|
|
23
|
+
List the folders under `<home>/skills` and `<home>/plugins`. A skills folder is one of two kinds:
|
|
24
|
+
|
|
25
|
+
- **A single skill:** it has a `SKILL.md`. Its id is the folder name.
|
|
26
|
+
- **A repository install:** it has `.andorra-repository.json` (`{ "name", "source", "skills": [subpaths] }`),
|
|
27
|
+
written when a GitHub repository with several skills is installed. Each entry of `skills` is one skill, at
|
|
28
|
+
`<folder>/<subpath>/SKILL.md` (`.` means the folder itself), and its id is `<folder>:<subpath>`. List every
|
|
29
|
+
one; a missing subpath was deleted and is skipped.
|
|
30
|
+
|
|
31
|
+
For each skill read the `description:` line of its `SKILL.md` frontmatter, and mark it off when its id (the
|
|
32
|
+
folder name, or `<folder>:<subpath>` for a repository skill) is in `extensions.disabledSkills`; a repository
|
|
33
|
+
skill is also off when the repository folder's own id is there. Present a short table: id, command
|
|
34
|
+
(`/<name>`), on/off, description. Mention project skills separately when the workspace has any.
|
|
35
|
+
|
|
36
|
+
## Installing
|
|
37
|
+
|
|
38
|
+
Installing from GitHub downloads, checks and unpacks the archive; it is done by Andorra itself, not by hand:
|
|
39
|
+
|
|
40
|
+
- Terminal: `/skills` → Install, then paste `https://github.com/owner/repo`, optionally
|
|
41
|
+
`https://github.com/owner/repo/tree/<ref>/<subfolder>` or `…#<ref>`.
|
|
42
|
+
- Desktop: Settings → Skills → Install, with the same address or a local folder.
|
|
43
|
+
|
|
44
|
+
Guide the user through those, and only read the source first to tell them what it contains (its `SKILL.md`
|
|
45
|
+
files, any scripts it ships). Treat a third-party skill as untrusted: point out scripts or instructions that
|
|
46
|
+
would run commands, send data elsewhere, or ask for credentials.
|
|
47
|
+
|
|
48
|
+
A single local skill folder can also be copied into `<home>/skills/<name>/` when the user asks; check it has a
|
|
49
|
+
`SKILL.md` with frontmatter first.
|
|
50
|
+
|
|
51
|
+
## Turning on and off
|
|
52
|
+
|
|
53
|
+
Edit `config.json`: add the id to `extensions.disabledSkills` (or `disabledPlugins`) to turn it off; remove it
|
|
54
|
+
to turn it on. Use the ids from the listing: `<folder>:<subpath>` turns off one skill of a repository install,
|
|
55
|
+
the folder id turns off all of them. Read the whole file, change only that array, and write it back with every other setting
|
|
56
|
+
unchanged. Show the change before writing it. It applies from the next task.
|
|
57
|
+
|
|
58
|
+
## Removing
|
|
59
|
+
|
|
60
|
+
Removing deletes the folder and cannot be undone. Show exactly which folder will go, and remove it only after
|
|
61
|
+
the user confirms in chat. Offer turning it off as the reversible alternative. Also drop its id from the
|
|
62
|
+
disabled list so the config stays tidy.
|
|
63
|
+
|
|
64
|
+
## Report
|
|
65
|
+
|
|
66
|
+
What changed (installed, enabled, disabled, removed), the command to use it, and that changes apply from the
|
|
67
|
+
next task.
|
|
@@ -675,6 +675,56 @@
|
|
|
675
675
|
"asset": "control-browser/SKILL.md",
|
|
676
676
|
"sha256": "242994e2732bce599e52398c535e0f38a32dae02cfbf7cc208d21527fd3d9385",
|
|
677
677
|
"adaptedSha256": "c54614e5bb3f21abf9558cc013b714e939d1acef16337fd62bdbb011c2c2b86d"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
"source": "src/skills/bundled/manage-mcp/SKILL.md",
|
|
681
|
+
"asset": "manage-mcp/SKILL.md",
|
|
682
|
+
"sha256": "0986f8129908cb49a526516f0767b663eea77888b833f6f232be39a2102f828d"
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
"source": "src/skills/bundled/manage-mcp/probe.md",
|
|
686
|
+
"asset": "manage-mcp/probe.md",
|
|
687
|
+
"sha256": "73df78826d3b9ed88d00d1c12cc5a49f0d6d5d8e96427b505eb577c9448e4ee8"
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
"source": "src/skills/bundled/create-skill/SKILL.md",
|
|
691
|
+
"asset": "create-skill/SKILL.md",
|
|
692
|
+
"sha256": "6aa465fafd9b99571b442ecc003d13adfc855dd684b503aebe743a43c4cf65eb"
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
"source": "src/skills/bundled/manage-skills/SKILL.md",
|
|
696
|
+
"asset": "manage-skills/SKILL.md",
|
|
697
|
+
"sha256": "7c6e3ba3fee1f0a542277d294d42afd575d6aa07440f6a5dab09e51ce0005a2e"
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
"source": "src/skills/bundled/create-agent/SKILL.md",
|
|
701
|
+
"asset": "create-agent/SKILL.md",
|
|
702
|
+
"sha256": "810b537e45db5bd28cc8905e9218bc323a5ed4bf1f2aa23b5fa8be09d49cdc21"
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
"source": "src/skills/bundled/doctor/SKILL.md",
|
|
706
|
+
"asset": "doctor/SKILL.md",
|
|
707
|
+
"sha256": "2de13de2ac541d16c30901fb92358949afb46af23e0c6cf410b8d11ee813fb90"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
"source": "src/skills/bundled/write-instructions/SKILL.md",
|
|
711
|
+
"asset": "write-instructions/SKILL.md",
|
|
712
|
+
"sha256": "4d2d0b7c2038caac366c2147ef25454f2b4f50a42c7d36da07a781facfd3bba6"
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
"source": "src/skills/bundled/graph-manager/SKILL.md",
|
|
716
|
+
"asset": "graph-manager/SKILL.md",
|
|
717
|
+
"sha256": "b40f2e1e3b075033e70f3162eb197acf64ee027ad1d1ffb0dd266d702c3630cc"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"source": "src/skills/bundled/graph-manager/errors.md",
|
|
721
|
+
"asset": "graph-manager/errors.md",
|
|
722
|
+
"sha256": "9804639538c3491ba7c94a93a931a1b4e0a9f302492d171fc108803d64b514b3"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"source": "src/skills/bundled/graph-manager/patterns.md",
|
|
726
|
+
"asset": "graph-manager/patterns.md",
|
|
727
|
+
"sha256": "c80a27c1af42d99ae48fb16b0c9727ae5f977cedfb7258966d76d5a4e2f0c9c3"
|
|
678
728
|
}
|
|
679
729
|
],
|
|
680
730
|
"additionalCopyright": [
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: write-instructions
|
|
3
|
+
description: "Create or improve a repository's agent instructions (ANDORRA.md or AGENTS.md): build and test commands, conventions, and rules agents must follow. Use when the user wants agents to work the way their team does, or asks to set up or tighten project instructions."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Write workspace instructions
|
|
7
|
+
|
|
8
|
+
Every Andorra run in a repository reads one guide from its root: `ANDORRA.md` if it exists, otherwise
|
|
9
|
+
`AGENTS.md`, otherwise `agents.md`. Only that one file is read, and only its first 16,000 characters. An
|
|
10
|
+
installation-wide override (the system prompt override in settings) replaces the guide entirely when set.
|
|
11
|
+
|
|
12
|
+
## What belongs in it
|
|
13
|
+
|
|
14
|
+
Things an agent cannot find out quickly by reading the code, and needs on most tasks:
|
|
15
|
+
|
|
16
|
+
- **Commands:** how to install, build, run, test (one file and everything), lint and typecheck, exactly as
|
|
17
|
+
typed. Note slow or flaky ones and their known failures.
|
|
18
|
+
- **Workflow:** branches, worktrees, commit and PR conventions, what must pass before a push, who reviews.
|
|
19
|
+
- **Conventions:** where code goes, naming, error handling, test style; the patterns to copy.
|
|
20
|
+
- **Rules:** what never to do (touch generated files, commit secrets, change public APIs without asking).
|
|
21
|
+
- **Pointers:** where the design docs, decision records and test plans are.
|
|
22
|
+
|
|
23
|
+
Leave out what the code already says (file listings, function descriptions) and anything that goes stale
|
|
24
|
+
weekly.
|
|
25
|
+
|
|
26
|
+
## Steps
|
|
27
|
+
|
|
28
|
+
1. Read the existing guide if there is one, and the repository's `README`, package manifest, CI workflows
|
|
29
|
+
and contributing docs.
|
|
30
|
+
2. Run the build and test commands you are about to document, so they are correct. Note what failed.
|
|
31
|
+
3. Ask the user for the house rules the files do not show: review process, branch naming, things agents got
|
|
32
|
+
wrong before.
|
|
33
|
+
4. Draft the guide, short sections with headings, commands in fenced blocks. Keep it well under 16,000
|
|
34
|
+
characters (`wc -c ANDORRA.md`; on Windows `(Get-Item ANDORRA.md).Length`), leaving room to grow.
|
|
35
|
+
5. Show the draft or the diff and apply it when the user agrees. When improving an existing guide, keep its
|
|
36
|
+
rules unless the user removes them; tighten wording, fix wrong commands, and add what is missing.
|
|
37
|
+
6. If both `ANDORRA.md` and `AGENTS.md` exist, tell the user that only `ANDORRA.md` is read.
|
|
38
|
+
|
|
39
|
+
## Report
|
|
40
|
+
|
|
41
|
+
The file written, its size, the commands you verified and any that failed, and anything left for the user to
|
|
42
|
+
decide.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Config } from '../config.js';
|
|
2
|
+
import { type BundleEntry } from '../extensions.js';
|
|
3
|
+
/** A skill a person can start by typing its command in a composer. */
|
|
4
|
+
export interface InvocableSkill {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
/** What the person types, `/name` — or `/andorra:name` when the short name is taken. */
|
|
9
|
+
command: string;
|
|
10
|
+
source: 'installed' | 'built-in';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Andorra's own skills as typeable entries. The short command (`/control-browser`) is used unless a
|
|
14
|
+
* built-in command or an installed skill already answers to that name; the full id stays typeable
|
|
15
|
+
* either way, so a clash never makes a built-in skill unreachable.
|
|
16
|
+
*/
|
|
17
|
+
export declare function builtinSkillEntries(installed?: readonly Pick<BundleEntry, 'id' | 'name' | 'path' | 'command'>[]): InvocableSkill[];
|
|
18
|
+
/** Every enabled skill a person can type: installed ones first, then Andorra's own. */
|
|
19
|
+
export declare function listInvocableSkills(config: Config, signal?: AbortSignal, directory?: string): Promise<InvocableSkill[]>;
|
|
20
|
+
/**
|
|
21
|
+
* The built-in skill a typed command names, by full id (`/andorra:name`) or by its short command.
|
|
22
|
+
* Installed skills are resolved first by the caller, so this only answers names they left free.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveBuiltinSkill(name: string, installed: readonly Pick<BundleEntry, 'id' | 'name' | 'path' | 'command'>[]): InvocableSkill | undefined;
|
|
25
|
+
/** An installed skill a prompt may name that would not load: turned off, or broken on disk. */
|
|
26
|
+
export interface InactiveSkill {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
command: string;
|
|
30
|
+
state: 'disabled' | 'unavailable';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* What the graph editor offers when `/` is typed in a prompt, and what it checks a prompt's
|
|
34
|
+
* `/name` references against: the skills a run on this machine can load, the installed ones that
|
|
35
|
+
* would not load, and the built-in command names that are never skills.
|
|
36
|
+
*/
|
|
37
|
+
export declare function editorSkillCatalog(config: Config, signal?: AbortSignal, directory?: string): Promise<{
|
|
38
|
+
skills: InvocableSkill[];
|
|
39
|
+
inactive: InactiveSkill[];
|
|
40
|
+
reserved: string[];
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { configDirectory } from '../config.js';
|
|
2
|
+
import { listBundles } from '../extensions.js';
|
|
3
|
+
import { builtinSlashCommandNames, isBuiltinSlashCommand } from '../skill-commands.js';
|
|
4
|
+
import { bundledSkillCatalog } from './runtime-skills.js';
|
|
5
|
+
const BUILTIN_PREFIX = 'andorra:';
|
|
6
|
+
/**
|
|
7
|
+
* Andorra's own skills as typeable entries. The short command (`/control-browser`) is used unless a
|
|
8
|
+
* built-in command or an installed skill already answers to that name; the full id stays typeable
|
|
9
|
+
* either way, so a clash never makes a built-in skill unreachable.
|
|
10
|
+
*/
|
|
11
|
+
export function builtinSkillEntries(installed = []) {
|
|
12
|
+
const taken = new Set(installed.flatMap(skill => [skill.id, skill.name, skill.path.split(/[\\/]/).pop() ?? '', skill.command?.slice(1) ?? '']));
|
|
13
|
+
return bundledSkillCatalog().map(skill => {
|
|
14
|
+
const name = skill.id.slice(BUILTIN_PREFIX.length);
|
|
15
|
+
const short = !isBuiltinSlashCommand('/' + name) && !taken.has(name);
|
|
16
|
+
return { id: skill.id, name, description: skill.description, command: '/' + (short ? name : skill.id), source: 'built-in' };
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/** Every enabled skill a person can type: installed ones first, then Andorra's own. */
|
|
20
|
+
export async function listInvocableSkills(config, signal, directory = configDirectory()) {
|
|
21
|
+
return (await editorSkillCatalog(config, signal, directory)).skills;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The built-in skill a typed command names, by full id (`/andorra:name`) or by its short command.
|
|
25
|
+
* Installed skills are resolved first by the caller, so this only answers names they left free.
|
|
26
|
+
*/
|
|
27
|
+
export function resolveBuiltinSkill(name, installed) {
|
|
28
|
+
return builtinSkillEntries(installed).find(skill => skill.id === name || skill.command === '/' + name);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* What the graph editor offers when `/` is typed in a prompt, and what it checks a prompt's
|
|
32
|
+
* `/name` references against: the skills a run on this machine can load, the installed ones that
|
|
33
|
+
* would not load, and the built-in command names that are never skills.
|
|
34
|
+
*/
|
|
35
|
+
export async function editorSkillCatalog(config, signal, directory = configDirectory()) {
|
|
36
|
+
const inventory = await listBundles('skills', config, { signal, directory });
|
|
37
|
+
const installed = inventory.filter(skill => skill.enabled && !skill.unavailable && skill.command);
|
|
38
|
+
return {
|
|
39
|
+
skills: [
|
|
40
|
+
...installed.map(skill => ({ id: skill.id, name: skill.name, description: skill.description, command: skill.command, source: 'installed' })),
|
|
41
|
+
// A disabled or broken installed skill still owns its name: typing it reports that skill's state,
|
|
42
|
+
// so the built-in one is offered under its full id, which does run.
|
|
43
|
+
...builtinSkillEntries(inventory),
|
|
44
|
+
],
|
|
45
|
+
inactive: inventory.filter(skill => !installed.includes(skill))
|
|
46
|
+
.map(skill => ({ id: skill.id, name: skill.name, command: skill.command ?? '/' + skill.name, state: skill.unavailable ? 'unavailable' : 'disabled' })),
|
|
47
|
+
reserved: builtinSlashCommandNames(),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function promptSkillReferences(...texts: (string | undefined)[]): string[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { isBuiltinSlashCommand } from '../skill-commands.js';
|
|
2
|
+
/**
|
|
3
|
+
* Skills written into a graph prompt by their command, anywhere in its text: `/name`, an escaped
|
|
4
|
+
* `/skill::name` (an installed skill whose name is a built-in command), or a qualified
|
|
5
|
+
* `/group:path/to/skill` and `/group:.` (a skill from an imported repository). These are the forms
|
|
6
|
+
* `listBundles` gives installed skills as their command, so whatever the picker inserts is found.
|
|
7
|
+
*
|
|
8
|
+
* A reference starts the prompt or follows whitespace or an opening bracket, and ends at whitespace,
|
|
9
|
+
* punctuation or the end of the text. Without a `group:` qualifier, a slash followed by another path
|
|
10
|
+
* segment (`/usr/bin`) or a file extension (`/notes.txt`) is a path, not a skill. Built-in commands
|
|
11
|
+
* (`/model`) are not skills.
|
|
12
|
+
*
|
|
13
|
+
* The graph editor's picker (src/graph-ui/skill-picker.js) finds references with the same pattern,
|
|
14
|
+
* so the editor warns about exactly the names the run resolves.
|
|
15
|
+
*/
|
|
16
|
+
const REFERENCE = /(^|[\s([{])\/((?:skill::)?[A-Za-z0-9][\w-]*(?::(?:\.|[\w-]+(?:\.[\w-]+)*(?:\/[\w-]+(?:\.[\w-]+)*)*))?)(?![\w:/-])(?!\.\w)/g;
|
|
17
|
+
const MAX_REFERENCES = 16;
|
|
18
|
+
export function promptSkillReferences(...texts) {
|
|
19
|
+
const names = [];
|
|
20
|
+
for (const text of texts) {
|
|
21
|
+
if (typeof text !== 'string' || !text.includes('/'))
|
|
22
|
+
continue;
|
|
23
|
+
for (const match of text.matchAll(REFERENCE)) {
|
|
24
|
+
const name = match[2];
|
|
25
|
+
if (isBuiltinSlashCommand('/' + name) || names.includes(name))
|
|
26
|
+
continue;
|
|
27
|
+
names.push(name);
|
|
28
|
+
if (names.length >= MAX_REFERENCES)
|
|
29
|
+
return names;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return names;
|
|
33
|
+
}
|
|
@@ -5,6 +5,10 @@ export interface RuntimeSkill extends ProjectSkill {
|
|
|
5
5
|
unavailable?: string;
|
|
6
6
|
requiredTools?: string[];
|
|
7
7
|
}
|
|
8
|
+
/** Andorra's own skills, as registered: what a person can type and the agent can load by id. */
|
|
9
|
+
export declare function bundledSkillCatalog(): readonly Pick<RuntimeSkill, 'id' | 'description' | 'path' | 'requiredTools'>[];
|
|
8
10
|
export declare function discoverRuntimeSkills(workspace: string, signal: AbortSignal, toolNames?: string[], includeProject?: boolean): Promise<RuntimeSkill[]>;
|
|
11
|
+
/** The catalog skill a name loads, as the Skill tool resolves it; undefined when none would load. */
|
|
12
|
+
export declare function matchRuntimeSkill(skills: RuntimeSkill[], name: string): RuntimeSkill | undefined;
|
|
9
13
|
export declare function loadRuntimeSkill(workspace: string, skill: RuntimeSkill, signal: AbortSignal, maxContentChars?: number): Promise<string>;
|
|
10
14
|
export declare function runtimeSkillTools(skills: RuntimeSkill[], existingResourceTool?: Tool, onLoaded?: (id: string) => void | Promise<void>): Tool[];
|