@team-agent/installer 0.3.7 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/crates/team-agent/src/cli/adapters.rs +52 -7
  4. package/crates/team-agent/src/cli/emit.rs +132 -4
  5. package/crates/team-agent/src/cli/leader.rs +12 -8
  6. package/crates/team-agent/src/cli/mod.rs +121 -28
  7. package/crates/team-agent/src/cli/tests/base.rs +14 -0
  8. package/crates/team-agent/src/cli/tests/missing_subcommands.rs +83 -1
  9. package/crates/team-agent/src/cli/tests/mod.rs +1 -0
  10. package/crates/team-agent/src/cli/tests/run_delegation.rs +6 -2
  11. package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +86 -21
  12. package/crates/team-agent/src/cli/tests/verb_install_skill.rs +76 -0
  13. package/crates/team-agent/src/leader/owner_bind.rs +59 -20
  14. package/crates/team-agent/src/leader/start.rs +34 -23
  15. package/crates/team-agent/src/leader/tests/identity.rs +22 -0
  16. package/crates/team-agent/src/leader/tests/wake_start_owner.rs +13 -0
  17. package/crates/team-agent/src/lifecycle/launch.rs +203 -16
  18. package/crates/team-agent/src/lifecycle/restart/rebuild.rs +25 -12
  19. package/crates/team-agent/src/lifecycle/restart.rs +7 -3
  20. package/crates/team-agent/src/lifecycle/tests/core.rs +192 -0
  21. package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +112 -0
  22. package/crates/team-agent/src/lifecycle/types.rs +2 -0
  23. package/crates/team-agent/src/messaging/results.rs +27 -22
  24. package/crates/team-agent/src/messaging/tests/runtime.rs +18 -0
  25. package/crates/team-agent/src/provider/adapter.rs +177 -15
  26. package/crates/team-agent/src/state/identity.rs +29 -0
  27. package/crates/team-agent/src/tmux_backend/tests.rs +44 -0
  28. package/crates/team-agent/src/tmux_backend.rs +90 -7
  29. package/crates/team-agent/src/transport/test_support.rs +57 -4
  30. package/crates/team-agent/src/transport.rs +13 -0
  31. package/npm/install.mjs +31 -35
  32. package/package.json +4 -4
package/npm/install.mjs CHANGED
@@ -80,13 +80,13 @@ function install(argv) {
80
80
  writeExecWrapper(path.join(binDir, "team-agent"), runtimeBinary, []);
81
81
  writeExecWrapper(path.join(binDir, "team_orchestrator"), runtimeBinary, ["mcp-server"]);
82
82
  writeExecWrapper(path.join(binDir, "team-agent-coordinator"), runtimeBinary, ["coordinator"]);
83
- installSkills();
83
+ installSkills(runtimeBinary);
84
84
 
85
85
  const teamAgent = path.join(binDir, "team-agent");
86
86
  console.log(`installed: ${teamAgent}`);
87
87
  console.log(`runtime: ${dest}`);
88
88
  console.log(`binary: ${platformBinary.packageName}`);
89
- console.log("skill: installed for Codex and Claude");
89
+ console.log("skill: installed for Codex, Claude and Copilot");
90
90
  console.log(`PATH: ensure ${binDir} is on PATH`);
91
91
 
92
92
  // 0.3.6 hotfix · C-5 cr verdict — post-install binary smoke 门(走 `--help`
@@ -149,14 +149,24 @@ function runDoctor(argv) {
149
149
  function uninstall(argv) {
150
150
  const opts = parseOptions(argv);
151
151
  const prefix = path.resolve(expandHome(opts.prefix || path.join(os.homedir(), ".local")));
152
+ // 卸载 skill 走二进制单源(同一 SkillTarget 表 codex/claude/copilot),在删 wrapper 前调
153
+ // (删 wrapper 后 PATH 上的 team-agent 没了,但 runtime 二进制仍在;用 runtime 二进制直调)。
154
+ const teamAgentBin = path.join(prefix, "bin", "team-agent");
155
+ if (fs.existsSync(teamAgentBin)) {
156
+ const res = spawnSync(teamAgentBin, ["install-skill", "--target", "all", "--uninstall", "--json"], {
157
+ text: true,
158
+ encoding: "utf8",
159
+ timeout: VERSION_SMOKE_TIMEOUT_MS,
160
+ });
161
+ if (res.status !== 0) {
162
+ console.error(`WARN: skill uninstall via binary failed (status=${res.status ?? "signal"}); skill dirs may remain under ~/.codex|.claude|.copilot/skills/team-agent`);
163
+ }
164
+ }
152
165
  for (const name of ["team-agent", "team_orchestrator", "team-agent-coordinator"]) {
153
166
  fs.rmSync(path.join(prefix, "bin", name), { force: true });
154
167
  }
155
- for (const skillDir of skillDestinations()) {
156
- fs.rmSync(skillDir, { recursive: true, force: true });
157
- }
158
168
  console.log(`removed wrappers from ${path.join(prefix, "bin")}`);
159
- console.log("removed skills from ~/.codex/skills/team-agent and ~/.claude/skills/team-agent");
169
+ console.log("removed skills from ~/.codex, ~/.claude and ~/.copilot skills/team-agent");
160
170
  if (opts.purgeRuntime) {
161
171
  const runtimeRoot = path.resolve(expandHome(opts.runtimeDir || path.join(os.homedir(), ".team-agent", "runtime")));
162
172
  fs.rmSync(runtimeRoot, { recursive: true, force: true });
@@ -238,46 +248,32 @@ exec ${shellQuote(binary)} ${argPrefix}"$@"
238
248
  fs.chmodSync(file, 0o755);
239
249
  }
240
250
 
241
- function installSkills() {
251
+ // RED-1 根治(单源):skill 安装唯一实现在二进制 `install-skill`(SkillTarget 表:
252
+ // codex/claude/copilot)。install.mjs 不再有自己的 JS 拷贝逻辑/目标硬编码——改调二进制,
253
+ // 失败显式报错(非零退出),绝不静默回退 JS。
254
+ function installSkills(runtimeBinary) {
242
255
  const source = path.join(packageRoot, "skills", "team-agent");
243
256
  if (!fs.existsSync(source)) {
244
257
  throw new Error(`skill source not found: ${source}`);
245
258
  }
246
- for (const dest of skillDestinations()) {
247
- fs.rmSync(dest, { recursive: true, force: true });
248
- copyTree(source, dest);
259
+ const res = spawnSync(runtimeBinary, ["install-skill", "--target", "all", "--source", source, "--json"], {
260
+ text: true,
261
+ encoding: "utf8",
262
+ timeout: VERSION_SMOKE_TIMEOUT_MS,
263
+ });
264
+ if (res.status !== 0) {
265
+ const log = (res.stderr || res.stdout || "").trim() || "no stderr/stdout";
266
+ console.error(`ERROR: skill install failed (status=${res.status ?? "signal"})`);
267
+ console.error(`ACTION: reinstall, or run \`team-agent install-skill --target all --source ${source}\` manually`);
268
+ console.error(`LOG: ${runtimeBinary} install-skill --target all => ${log}`);
269
+ process.exit(1);
249
270
  }
250
271
  }
251
272
 
252
- function skillDestinations() {
253
- return [
254
- path.join(os.homedir(), ".codex", "skills", "team-agent"),
255
- path.join(os.homedir(), ".claude", "skills", "team-agent"),
256
- ];
257
- }
258
-
259
273
  function makeDoctorWorkspace() {
260
274
  return fs.mkdtempSync(path.join(os.tmpdir(), "team-agent-doctor-"));
261
275
  }
262
276
 
263
- function copyTree(src, dest) {
264
- const stat = fs.lstatSync(src);
265
- if (stat.isDirectory()) {
266
- fs.mkdirSync(dest, { recursive: true, mode: stat.mode });
267
- for (const entry of fs.readdirSync(src)) {
268
- if (entry === ".DS_Store") {
269
- continue;
270
- }
271
- copyTree(path.join(src, entry), path.join(dest, entry));
272
- }
273
- return;
274
- }
275
- if (stat.isFile()) {
276
- fs.copyFileSync(src, dest);
277
- fs.chmodSync(dest, stat.mode);
278
- }
279
- }
280
-
281
277
  function expandHome(value) {
282
278
  if (value === "~") {
283
279
  return os.homedir();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-agent/installer",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
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.3.7",
24
- "@team-agent/cli-darwin-x64": "0.3.7",
25
- "@team-agent/cli-linux-x64": "0.3.7"
23
+ "@team-agent/cli-darwin-arm64": "0.3.9",
24
+ "@team-agent/cli-darwin-x64": "0.3.9",
25
+ "@team-agent/cli-linux-x64": "0.3.9"
26
26
  },
27
27
  "scripts": {
28
28
  "postinstall": "node npm/bincheck.mjs",