@team-agent/installer 0.5.70 → 0.5.72
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/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/crates/team-agent/src/cli/adapters.rs +107 -9
- package/crates/team-agent/src/cli/emit.rs +35 -5
- package/crates/team-agent/src/cli/mod.rs +120 -15
- package/crates/team-agent/src/cli/models.rs +443 -0
- package/crates/team-agent/src/cli/spec.rs +4 -1
- package/crates/team-agent/src/cli/types.rs +8 -0
- package/crates/team-agent/src/compiler.rs +157 -0
- package/crates/team-agent/src/leader/owner_bind.rs +21 -0
- package/crates/team-agent/src/leader/provider_attribution.rs +25 -0
- package/crates/team-agent/src/leader/registry.rs +25 -1
- package/crates/team-agent/src/leader/start.rs +33 -9
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +169 -10
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +116 -15
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +859 -12
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +23 -7
- package/crates/team-agent/src/lifecycle/restart.rs +2 -1
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +168 -0
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +209 -0
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +122 -3
- package/crates/team-agent/src/lifecycle/types.rs +8 -0
- package/npm/check-skill-links.mjs +88 -0
- package/package.json +5 -4
- package/skills/team-agent/SKILL.md +15 -49
- package/skills/team-agent/command-coverage.json +8 -1
- package/skills/team-agent/references/team-agent-operator.md +665 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/** Resolve local Markdown links and optionally validate package/installed inventories. */
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
const value = (name) => { const i = args.indexOf(name); return i < 0 ? null : args[i + 1]; };
|
|
8
|
+
const rootArg = value("--root") ?? "skills/team-agent";
|
|
9
|
+
const root = path.resolve(rootArg);
|
|
10
|
+
const installedArg = value("--installed");
|
|
11
|
+
const inventoryArg = value("--inventory");
|
|
12
|
+
const markdownLink = /!?(?:\[[^\]]*\])\(([^)]+)\)/g;
|
|
13
|
+
const files = [];
|
|
14
|
+
const fail = (message) => { throw new Error(message); };
|
|
15
|
+
const real = (file) => { try { return fs.realpathSync.native(file); } catch (error) { fail(`cannot resolve ${file}: ${error.message}`); } };
|
|
16
|
+
const rootReal = real(root);
|
|
17
|
+
const inside = (candidate, base = rootReal) => candidate === base || candidate.startsWith(`${base}${path.sep}`);
|
|
18
|
+
const lexicalInside = (candidate, base = root) => candidate === base || candidate.startsWith(`${base}${path.sep}`);
|
|
19
|
+
|
|
20
|
+
function walk(dir, boundary = rootReal) {
|
|
21
|
+
let entries;
|
|
22
|
+
try { entries = fs.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name)); }
|
|
23
|
+
catch (error) { fail(`cannot read ${dir}: ${error.message}`); }
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
const file = path.join(dir, entry.name);
|
|
26
|
+
const fileReal = real(file);
|
|
27
|
+
if (!inside(fileReal, boundary)) fail(`${file}: realpath escapes tree`);
|
|
28
|
+
if (entry.isDirectory()) walk(file, boundary);
|
|
29
|
+
else if (entry.isFile() && file.endsWith(".md")) files.push(file);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function normalizeFragment(fragment) {
|
|
33
|
+
return decodeURIComponent(fragment).toLowerCase().trim().replace(/<[^>]+>/g, "")
|
|
34
|
+
.replace(/[`*_~]/g, "").replace(/[^\p{L}\p{N} -]/gu, "").replace(/\s+/g, "-");
|
|
35
|
+
}
|
|
36
|
+
function anchors(text) {
|
|
37
|
+
const found = new Set();
|
|
38
|
+
const used = new Map();
|
|
39
|
+
const add = (value) => {
|
|
40
|
+
const base = normalizeFragment(value); if (!base) return;
|
|
41
|
+
const n = used.get(base) ?? 0; used.set(base, n + 1); found.add(n ? `${base}-${n}` : base);
|
|
42
|
+
};
|
|
43
|
+
for (const m of text.matchAll(/^(?: {0,3})#{1,6}\s+(.+?)\s*#*\s*$/gm) ) add(m[1]);
|
|
44
|
+
for (const m of text.matchAll(/^(?: {0,3})([^\n#]+)\n(?:=+|-+)\s*$/gm)) add(m[1]);
|
|
45
|
+
for (const m of text.matchAll(/<(?:a|[^>]+)\s+[^>]*(?:id|name)=["']([^"']+)["'][^>]*>/gi)) add(m[1]);
|
|
46
|
+
return found;
|
|
47
|
+
}
|
|
48
|
+
function checkTree(dir, baseRoot, baseReal) {
|
|
49
|
+
files.length = 0; walk(dir, baseReal);
|
|
50
|
+
const errors = [];
|
|
51
|
+
for (const file of [...files].sort()) {
|
|
52
|
+
const text = fs.readFileSync(file, "utf8");
|
|
53
|
+
const known = anchors(text);
|
|
54
|
+
for (const match of text.matchAll(markdownLink)) {
|
|
55
|
+
const href = match[1].trim();
|
|
56
|
+
if (!href || /^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(href)) continue;
|
|
57
|
+
const hash = href.indexOf("#");
|
|
58
|
+
const rawPath = hash < 0 ? href : href.slice(0, hash);
|
|
59
|
+
const fragment = hash < 0 ? "" : href.slice(hash + 1).split("?", 1)[0];
|
|
60
|
+
const target = rawPath ? path.resolve(path.dirname(file), rawPath) : file;
|
|
61
|
+
if (!lexicalInside(target, baseRoot)) { errors.push(`${file}: lexical target escapes tree: ${href}`); continue; }
|
|
62
|
+
const targetReal = real(target);
|
|
63
|
+
if (!inside(targetReal, baseReal)) { errors.push(`${file}: realpath target escapes tree: ${href}`); continue; }
|
|
64
|
+
if (!fs.statSync(targetReal).isFile()) { errors.push(`${file}: target is not a file: ${href}`); continue; }
|
|
65
|
+
if (fragment && targetReal.endsWith(".md")) {
|
|
66
|
+
const targetAnchors = targetReal === real(file) ? known : anchors(fs.readFileSync(targetReal, "utf8"));
|
|
67
|
+
if (!targetAnchors.has(normalizeFragment(fragment))) errors.push(`${file}: missing fragment: ${href}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (errors.length) fail(errors.sort().join("\n"));
|
|
72
|
+
return [...files].sort().length;
|
|
73
|
+
}
|
|
74
|
+
const count = checkTree(root, root, rootReal);
|
|
75
|
+
if (inventoryArg) {
|
|
76
|
+
const inventory = path.resolve(inventoryArg);
|
|
77
|
+
for (const relative of fs.readFileSync(inventory, "utf8").split(/\r?\n/).filter(Boolean).sort()) {
|
|
78
|
+
if (path.isAbsolute(relative)) fail(`inventory path must be relative: ${relative}`);
|
|
79
|
+
const candidate = path.resolve(root, relative);
|
|
80
|
+
if (!lexicalInside(candidate)) fail(`inventory path escapes tree: ${relative}`);
|
|
81
|
+
const candidateReal = real(candidate);
|
|
82
|
+
if (!inside(candidateReal)) fail(`inventory realpath escapes tree: ${relative}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (installedArg) {
|
|
86
|
+
const installed = path.resolve(installedArg); console.log(`checked ${checkTree(installed, installed, real(installed))} Markdown files in ${installed}`);
|
|
87
|
+
}
|
|
88
|
+
console.log(`checked ${count} Markdown files in ${root}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@team-agent/installer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.72",
|
|
4
4
|
"description": "npx installer for Team Agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codex",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"team-agent-installer": "npm/install.mjs"
|
|
21
21
|
},
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@team-agent/cli-darwin-arm64": "0.5.
|
|
24
|
-
"@team-agent/cli-darwin-x64": "0.5.
|
|
25
|
-
"@team-agent/cli-linux-x64": "0.5.
|
|
23
|
+
"@team-agent/cli-darwin-arm64": "0.5.72",
|
|
24
|
+
"@team-agent/cli-darwin-x64": "0.5.72",
|
|
25
|
+
"@team-agent/cli-linux-x64": "0.5.72"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"postinstall": "node npm/bincheck.mjs",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"files": [
|
|
34
34
|
"npm/bincheck.mjs",
|
|
35
35
|
"npm/install.mjs",
|
|
36
|
+
"npm/check-skill-links.mjs",
|
|
36
37
|
"skills",
|
|
37
38
|
"templates",
|
|
38
39
|
"examples",
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
name: team-agent
|
|
3
3
|
description: Use only when the user explicitly asks to start, operate, inspect, shutdown, or restart a Team Agent team. Treat the team-agent CLI as a sealed appliance.
|
|
4
4
|
requires_team_agent: ">=0.5.0"
|
|
5
|
-
last_verified_against: "0.5.
|
|
5
|
+
last_verified_against: "0.5.72"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Team Agent
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Use this skill only for Team Agent operation. The detailed operator handbook (permissions, models, routing, and recovery) is in [the operator reference](references/team-agent-operator.md). Nested teams have a separate [nested-team reference](references/team-in-team.md).
|
|
11
11
|
|
|
12
|
-
If `team-agent --version` does not match `last_verified_against`,
|
|
12
|
+
If `team-agent --version` does not match `last_verified_against`, inspect the live CLI before copying examples:
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
team-agent --version
|
|
@@ -17,55 +17,21 @@ team-agent --help
|
|
|
17
17
|
team-agent doctor --help
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
## Pi TeamMate startup
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
TO has two co-equal logical forms: an **in-team short name** (`team-agent send reviewer "..."`) and a fully qualified `<workspace>::<team>/<agent>`. Use the qualified form across workspaces.
|
|
24
|
-
- Inspect: `team-agent status` / `status --json`. `ok: true` plus `ready: false` is not a crash.
|
|
25
|
-
- Lifecycle: `restart .` resumes a stopped team; `add-agent NAME --role-file FILE` adds or `--force` recreates one worker; `shutdown --workspace .` stops. Do not shutdown the whole team to add a worker.
|
|
26
|
-
- Roles: every `agents/*.md` must declare boolean `dangerously_skip_permissions`. Never rewrite a user-supplied model id. Never read `.env` files.
|
|
22
|
+
For a Pi worker, use this existing three-step flow:
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
1. Discover exact model ids: `team-agent models --provider pi` (add `--search TEXT` when useful).
|
|
25
|
+
2. Use the existing lifecycle command that matches the actual state: `team-agent quick-start` for a new team, `team-agent add-agent NAME --role-file FILE` for a new worker, or `team-agent start-agent NAME` for a missing worker.
|
|
26
|
+
3. Send work through the canonical route: `team-agent send AGENT MESSAGE`.
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
Pi roles preserve the direct Pi login, model defaults, extensions/plugins, skills, context, trust, and tools. Team Agent adds only per-seat identity/session isolation. `model` and `effort` are optional explicit pass-throughs. Use the shared role schema, a block-style `tools` list containing `mcp_team`, and the required boolean `dangerously_skip_permissions`.
|
|
31
29
|
|
|
32
|
-
##
|
|
30
|
+
## Operate
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
- Send: `team-agent send TO MESSAGE` using an in-team short name or fully qualified `<workspace>::<team>/<agent>`; these are co-equal positional TO forms. For example, `team-agent send reviewer "..."` uses an in-team short name. Do not poll after success.
|
|
33
|
+
- Inspect: `team-agent status` or `team-agent status --json`; `ok: true` with `ready: false` is not a crash.
|
|
34
|
+
- On a structured failure with an `action`, run that action first, then stop. Never guess flags.
|
|
35
|
+
- Never rewrite a user-supplied model id or read `.env` files.
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|---|---|---|---|---|
|
|
38
|
-
| `grok` | yes (`--resume <id>`, archive-gated) | no | yes (role `model` required) | yes (`--fork-session` + new `--session-id`) |
|
|
39
|
-
| `cursor_agent` | yes (argv `--resume <chatId>`, archive-gated) | no | required on role; same-family catalog id can take effect; unknown id silent-fallback; pane chrome ≠ proven live | **no — `CapabilityUnsupported`** |
|
|
40
|
-
|
|
41
|
-
Grok / `cursor_agent` have no JSONL turn-state reader (classify → Unknown).
|
|
42
|
-
|
|
43
|
-
## Provider Prep
|
|
44
|
-
|
|
45
|
-
### Pi TeamMate roles
|
|
46
|
-
|
|
47
|
-
Use the standard role schema with `provider: pi`, a block-style `tools` list containing `mcp_team`, and the required boolean `dangerously_skip_permissions`. That role boolean is the only bypass setting; `TEAM.md` `dangerous_auto_approve` is compatibility input, not a second user-facing switch.
|
|
48
|
-
|
|
49
|
-
Pi TeamMates keep the same login, model, extensions/plugins, skills, context files, project trust, and tools as a direct `pi` run on that machine. Team Agent only appends the role contract, a per-seat Team MCP registration, and per-seat session storage; do not duplicate those direct Pi settings in the role. `model` and `effort` remain optional compatibility overrides, and explicit values are passed through.
|
|
50
|
-
|
|
51
|
-
### Cursor provider notes
|
|
52
|
-
|
|
53
|
-
Frontmatter: `provider: cursor_agent` (not `cursor`; launcher verb is `team-agent cursor`), `auth_mode: subscription`, `name:` required (omit → `missing front matter field name`). Also required: `role:`, `tools:`, `dangerously_skip_permissions:` (bool). Subscription needs no `profile`.
|
|
54
|
-
|
|
55
|
-
`model:` is required (omit compile-fails; blocks a silent builtin `sonnet-4-thinking`). The flag stays on argv. Same-family catalog ids can change pane chrome. An id not in that provider's catalog silent-falls back (landing not stable; no events/stderr/pane warning). Pick names from the catalog; after spawn, `capture-pane` once for chrome. Do not treat the role field or pane chrome as proof of the live model.
|
|
56
|
-
|
|
57
|
-
One `cursor_agent` per **provider-config overlay** under `<workspace>/.team/runtime/provider-config/<id>/cursor`. Same workspace may run multiple cursor seats; each writes `TEAM_AGENT_ID` into that project's `.cursor/mcp.json`. Spawn points `--workspace` there and `--add-dir` at the real workspace. `HOME` stays the user home. If isolation is off or cannot be materialized, adding a second seat still fail-closes:
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
error: cursor_agent seat already occupies this workspace
|
|
61
|
-
reason: <workspace>/.cursor/mcp.json is directory-scoped; a second seat overwrites TEAM_AGENT_ID (last-writer)
|
|
62
|
-
action: do not add another CursorAgent in this workspace until per-seat MCP identity is isolated
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Do not share `<workspace>/.cursor/mcp.json` for team_orchestrator identity. Same seat, fresh context → `reset-agent --discard-session`.
|
|
66
|
-
|
|
67
|
-
`clone-agent` copies the source role (provider unchanged). Runtime add: `clone-agent` → `stop-agent` → `remove-agent --confirm` (deletes `.team/dynamic-role-files/`) → write the role file → `add-agent --role-file` → dispatch.
|
|
68
|
-
|
|
69
|
-
- Restart emits `--resume <chatId>` when `store.db`/`meta.json` exist; the gate does not read chat text. Persist anything that must survive restart.
|
|
70
|
-
- Delivery sends one Enter; a second Enter interrupts the turn.
|
|
71
|
-
- After spawn, the pane footer should show `Cursor Agent v<version>`. Do not use `strings` to probe the binary.
|
|
37
|
+
Workers report completion through `mcp_team` and call `report_result` exactly once.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"authority": {
|
|
4
4
|
"kind": "normative_handbook_plus_live_help",
|
|
5
5
|
"handbook": {
|
|
6
|
-
"path": "
|
|
6
|
+
"path": "skills/team-agent/references/team-agent-operator.md",
|
|
7
7
|
"start_marker": "<!-- command-coverage:normative-start -->",
|
|
8
8
|
"end_marker": "<!-- command-coverage:normative-end -->"
|
|
9
9
|
},
|
|
@@ -336,6 +336,13 @@
|
|
|
336
336
|
"owner": "runtime-owner:messaging",
|
|
337
337
|
"plan": "Execute the compact-skill positional send smoke with representative target and message tokens, then bind delivery truth."
|
|
338
338
|
},
|
|
339
|
+
{
|
|
340
|
+
"command": "team-agent send AGENT MESSAGE",
|
|
341
|
+
"bucket": "declared_gap",
|
|
342
|
+
"covered": false,
|
|
343
|
+
"owner": "runtime-owner:messaging",
|
|
344
|
+
"plan": "Execute a representative positional send with explicit agent and message tokens, then bind recipient and delivery truth."
|
|
345
|
+
},
|
|
339
346
|
{
|
|
340
347
|
"command": "team-agent send reviewer \"...\"",
|
|
341
348
|
"bucket": "declared_gap",
|