@team-agent/installer 0.5.122 → 0.5.124
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 +8 -1
- package/Cargo.toml +1 -1
- package/crates/team-agent/src/cli/diagnose.rs +176 -10
- package/crates/team-agent/src/cli/intent/runtime.rs +103 -43
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +198 -0
- package/crates/team-agent/src/cli/intent/tests.rs +37 -0
- package/crates/team-agent/src/cli/intent.rs +22 -0
- package/crates/team-agent/src/cli/models.rs +54 -10
- package/crates/team-agent/src/contract_runtime/backend.rs +498 -2
- package/crates/team-agent/src/contract_runtime/commands.rs +38 -24
- package/crates/team-agent/src/contract_runtime/discovery.rs +46 -56
- package/crates/team-agent/src/contract_runtime/forward.rs +59 -0
- package/crates/team-agent/src/contract_runtime/framework.rs +23 -17
- package/crates/team-agent/src/contract_runtime/registry.rs +41 -3
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +19 -101
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +6 -17
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +26 -19
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +19 -2
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +95 -31
- package/crates/team-agent/src/lifecycle/restart.rs +1 -0
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +5 -6
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +7 -5
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +1 -3
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +4 -16
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +1 -3
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +84 -53
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +19 -1
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +21 -0
- package/crates/team-agent/src/messaging/delivery.rs +5 -3
- package/crates/team-agent/src/provider/adapters/pi.rs +4 -4
- package/crates/team-agent/src/provider/session_scan/pi.rs +32 -19
- package/crates/team-agent/src/provider/tests/command_helpers.rs +2 -2
- package/crates/team-agent/src/provider/wire.rs +2 -1
- package/npm/install.mjs +56 -99
- package/package.json +4 -4
package/npm/install.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* purpose: place the Team Agent runtime and login wrappers via the npx installer
|
|
4
4
|
* contract: wrappers land only in the declared bin dir (~/.local/bin or --prefix/bin); installer-managed wrappers recorded in the manifest or recognized by marker are rewritten onto this install's runtime; a non-writable declared dir fails closed with ACTION
|
|
5
|
-
* boundary: never selects a PATH entry as the install target; never creates wrappers in third-party package dirs; does not treat host login PATH order as a landing picker
|
|
5
|
+
* boundary: never selects a PATH entry as the install target; never creates wrappers in third-party package dirs; does not treat host login PATH order as a landing picker; install does not run doctor or treat a missing MCP server as a failure
|
|
6
6
|
*/
|
|
7
7
|
import { spawnSync } from "node:child_process";
|
|
8
8
|
import fs from "node:fs";
|
|
@@ -65,56 +65,6 @@ function isCliEntrypoint() {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export function doctorSelfCheckVerdict(doctorBody, spawnMeta = {}) {
|
|
69
|
-
if (spawnMeta.error || spawnMeta.signal) {
|
|
70
|
-
return { kind: "advisory", blockers: [] };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
let body;
|
|
74
|
-
try {
|
|
75
|
-
body = JSON.parse(doctorBody || "");
|
|
76
|
-
} catch {
|
|
77
|
-
return { kind: "advisory", blockers: [] };
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const blockers = [];
|
|
81
|
-
// Doctor JSON source: crates/team-agent/src/cli/mod.rs:2739-2764.
|
|
82
|
-
if (body?.tmux?.installed === false) {
|
|
83
|
-
blockers.push("tmux not installed");
|
|
84
|
-
}
|
|
85
|
-
if (!body?.mcp?.server_command) {
|
|
86
|
-
blockers.push("MCP server command missing");
|
|
87
|
-
}
|
|
88
|
-
const profileSmokeStatus = body?.profile_smoke?.status;
|
|
89
|
-
const profileSmokeNonBlocking =
|
|
90
|
-
profileSmokeStatus === "legacy_team_invalid" || profileSmokeStatus === "not_required";
|
|
91
|
-
if (
|
|
92
|
-
body?.error === "profile_smoke_failed" ||
|
|
93
|
-
(body?.profile_smoke?.ok === false && !profileSmokeNonBlocking)
|
|
94
|
-
) {
|
|
95
|
-
blockers.push("profile smoke failed");
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (blockers.length > 0) {
|
|
99
|
-
return { kind: "blockers", blockers };
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const noContext =
|
|
103
|
-
body?.ok === false && body?.error === "workspace has no Team Agent spec or runtime context";
|
|
104
|
-
if (body?.ok === true || noContext) {
|
|
105
|
-
return { kind: "ok", blockers: [] };
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return { kind: "advisory", blockers: [] };
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function doctorSelfCheckLine(verdict) {
|
|
112
|
-
if (verdict.kind === "blockers") {
|
|
113
|
-
return `doctor: found blockers (${verdict.blockers.join("; ")}); run team-agent doctor in your project for details`;
|
|
114
|
-
}
|
|
115
|
-
return "doctor: ok (run team-agent doctor inside a team workspace for a full report)";
|
|
116
|
-
}
|
|
117
|
-
|
|
118
68
|
function printHelp() {
|
|
119
69
|
console.log(`Team Agent installer
|
|
120
70
|
|
|
@@ -187,19 +137,6 @@ function install(argv) {
|
|
|
187
137
|
});
|
|
188
138
|
|
|
189
139
|
const teamAgent = path.join(binDir, "team-agent");
|
|
190
|
-
console.log(`installed: ${teamAgent}`);
|
|
191
|
-
if (installTarget.readyNow) {
|
|
192
|
-
console.log(`installed to ${binDir} (on PATH, ready now)`);
|
|
193
|
-
} else if (installTarget.rc?.files?.length > 0) {
|
|
194
|
-
console.log(`installed to ${binDir}; added ${binDir} to ${installTarget.rc.files.join(", ")}; restart terminal or open a new shell to use team-agent`);
|
|
195
|
-
} else if (installTarget.rc?.skipped?.length > 0) {
|
|
196
|
-
console.log(`installed to ${binDir}; PATH entry already present in ${installTarget.rc.skipped.join(", ")}; restart terminal or open a new shell to use team-agent`);
|
|
197
|
-
} else {
|
|
198
|
-
console.log(`installed to ${binDir}; add it to PATH to use team-agent by name`);
|
|
199
|
-
}
|
|
200
|
-
console.log(`runtime: ${dest}`);
|
|
201
|
-
console.log(`binary: ${platformBinary.packageName}`);
|
|
202
|
-
console.log("skill: installed for Codex, Claude and Copilot");
|
|
203
140
|
|
|
204
141
|
// 0.3.6 hotfix · C-5 cr verdict — post-install binary smoke 门(走 `--help`
|
|
205
142
|
// 子命令,因为 0.3.x CLI 现阶段没有 --version)。真跑一次 binary 才能抓住
|
|
@@ -219,25 +156,25 @@ function install(argv) {
|
|
|
219
156
|
console.error(`LOG: ${teamAgent} --help => ${log}`);
|
|
220
157
|
process.exit(1);
|
|
221
158
|
}
|
|
222
|
-
console.log("smoke: team-agent --help ok");
|
|
223
|
-
|
|
224
|
-
const doctorWorkspace = makeDoctorWorkspace();
|
|
225
|
-
try {
|
|
226
|
-
const doctor = spawnSync(teamAgent, ["doctor", "--json", "--workspace", doctorWorkspace], {
|
|
227
|
-
text: true,
|
|
228
|
-
encoding: "utf8",
|
|
229
|
-
timeout: DOCTOR_TIMEOUT_MS,
|
|
230
|
-
});
|
|
231
|
-
const verdict = doctorSelfCheckVerdict(doctor.stdout, doctor);
|
|
232
|
-
console.log(doctorSelfCheckLine(verdict));
|
|
233
|
-
} finally {
|
|
234
|
-
fs.rmSync(doctorWorkspace, { recursive: true, force: true });
|
|
235
|
-
}
|
|
236
159
|
const pathCheck = verifyInstalledTeamAgentOnPath({
|
|
237
160
|
env: process.env,
|
|
238
161
|
expectedVersion: version,
|
|
239
162
|
});
|
|
240
|
-
console.log(`
|
|
163
|
+
console.log(`Installed Team Agent ${version}`);
|
|
164
|
+
console.log(teamAgent);
|
|
165
|
+
if (shadowRepairs.length > 0) {
|
|
166
|
+
console.log(`Updated ${shadowRepairs.length} older Team Agent command${shadowRepairs.length === 1 ? "" : "s"}.`);
|
|
167
|
+
}
|
|
168
|
+
if (pathCheck.status === "ready") {
|
|
169
|
+
console.log("Ready in this terminal. Run: team-agent --help");
|
|
170
|
+
} else {
|
|
171
|
+
console.log(pathActivationGuidance({
|
|
172
|
+
binDir,
|
|
173
|
+
teamAgent,
|
|
174
|
+
rc: installTarget.rc,
|
|
175
|
+
shell: path.basename(process.env.SHELL || ""),
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
241
178
|
}
|
|
242
179
|
|
|
243
180
|
function runDoctor(argv) {
|
|
@@ -389,36 +326,26 @@ export function repairPathShadowingTeamAgentCommands(options = {}) {
|
|
|
389
326
|
const repairs = [];
|
|
390
327
|
const recordedBinDirs = options.recordedBinDirs || recordedManagedBinDirs(options.manifest);
|
|
391
328
|
const candidates = pathShadowRepairCandidates(env.PATH || "", home, binDir, recordedBinDirs);
|
|
392
|
-
log?.(`path-shadow: scanning ${candidates.length} candidate bin dirs for managed wrappers`);
|
|
393
329
|
for (const candidateDir of candidates) {
|
|
394
330
|
const entry = candidateDir.dir;
|
|
395
331
|
if (isVersionManagedPath(entry)) {
|
|
396
|
-
log?.(`path-shadow: skip ${path.join(entry, "team-agent")} source=${candidateDir.source} reason=version-managed-path`);
|
|
397
332
|
continue;
|
|
398
333
|
}
|
|
399
334
|
for (const name of WRAPPER_NAMES) {
|
|
400
335
|
const candidate = path.join(entry, name);
|
|
401
336
|
if (!fs.existsSync(candidate)) {
|
|
402
|
-
if (name === "team-agent" && candidateDir.source === "home-local-bin") {
|
|
403
|
-
log?.(`path-shadow: checked ${candidate} source=${candidateDir.source} reason=not-found`);
|
|
404
|
-
}
|
|
405
337
|
continue;
|
|
406
338
|
}
|
|
407
|
-
log?.(`path-shadow: found ${candidate} source=${candidateDir.source}`);
|
|
408
339
|
if (!isExecutableFile(candidate)) {
|
|
409
|
-
log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=not-executable-file`);
|
|
410
340
|
continue;
|
|
411
341
|
}
|
|
412
342
|
if (sameFile(candidate, installedWrapper) && name === "team-agent") {
|
|
413
|
-
log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=installed-wrapper`);
|
|
414
343
|
continue;
|
|
415
344
|
}
|
|
416
345
|
if (sameFile(candidate, runtimeBinary)) {
|
|
417
|
-
log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=runtime-binary`);
|
|
418
346
|
continue;
|
|
419
347
|
}
|
|
420
348
|
if (!isInstallerManagedWrapper(candidate)) {
|
|
421
|
-
log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=not-installer-managed`);
|
|
422
349
|
continue;
|
|
423
350
|
}
|
|
424
351
|
const extraArgs = name === "team_orchestrator" ? ["mcp-server"] : name === "team-agent-coordinator" ? ["coordinator"] : [];
|
|
@@ -428,12 +355,11 @@ export function repairPathShadowingTeamAgentCommands(options = {}) {
|
|
|
428
355
|
const detail = error instanceof Error ? error.message : String(error);
|
|
429
356
|
throw new Error(`failed to update PATH-shadowing team-agent at ${candidate}: ${detail}`);
|
|
430
357
|
}
|
|
431
|
-
log?.(`path-shadow: updated ${candidate} source=${candidateDir.source} to runtime shim`);
|
|
432
358
|
repairs.push({ file: candidate, binDir: entry, source: candidateDir.source });
|
|
433
359
|
}
|
|
434
360
|
}
|
|
435
|
-
if (repairs.length
|
|
436
|
-
log?.(
|
|
361
|
+
if (repairs.length > 0) {
|
|
362
|
+
log?.(`updated ${repairs.length} older Team Agent command${repairs.length === 1 ? "" : "s"}`);
|
|
437
363
|
}
|
|
438
364
|
return repairs;
|
|
439
365
|
}
|
|
@@ -451,11 +377,10 @@ export function verifyInstalledTeamAgentOnPath(options = {}) {
|
|
|
451
377
|
timeout: VERSION_SMOKE_TIMEOUT_MS,
|
|
452
378
|
});
|
|
453
379
|
const entry = (which.stdout || "").split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
380
|
+
// A fresh ~/.local/bin install is not on the current shell PATH yet. That is
|
|
381
|
+
// guidance, not a failed install.
|
|
454
382
|
if (which.status !== 0 || !entry) {
|
|
455
|
-
|
|
456
|
-
`post-install version check failed: \`which team-agent\` did not find the installed command. ` +
|
|
457
|
-
`Expected version ${expectedVersion}. Add the install bin directory to PATH or restart your shell.`,
|
|
458
|
-
);
|
|
383
|
+
return { status: "not-on-current-path" };
|
|
459
384
|
}
|
|
460
385
|
const versionProbe = spawnSync(entry, ["--version"], {
|
|
461
386
|
text: true,
|
|
@@ -479,7 +404,7 @@ export function verifyInstalledTeamAgentOnPath(options = {}) {
|
|
|
479
404
|
`but installer installed ${expectedVersion}. Remove or update the earlier PATH entry that shadows Team Agent.`,
|
|
480
405
|
);
|
|
481
406
|
}
|
|
482
|
-
return { entry, version: actualVersion };
|
|
407
|
+
return { status: "ready", entry, version: actualVersion };
|
|
483
408
|
}
|
|
484
409
|
|
|
485
410
|
export function parseTeamAgentVersion(output) {
|
|
@@ -641,7 +566,9 @@ function ensureBinDirOnShellRc(binDir, options = {}) {
|
|
|
641
566
|
|
|
642
567
|
function shellRcTargets(shell, home) {
|
|
643
568
|
if (shell === "zsh") {
|
|
644
|
-
|
|
569
|
+
// Login shells, including ssh and macOS Terminal, read .zprofile and do
|
|
570
|
+
// not read .zshrc unless they are also interactive. Write both.
|
|
571
|
+
return { files: [path.join(home, ".zprofile"), path.join(home, ".zshrc")], style: "posix" };
|
|
645
572
|
}
|
|
646
573
|
if (shell === "bash") {
|
|
647
574
|
return { files: [path.join(home, ".bashrc"), path.join(home, ".bash_profile")], style: "posix" };
|
|
@@ -651,13 +578,43 @@ function shellRcTargets(shell, home) {
|
|
|
651
578
|
}
|
|
652
579
|
if (!shell || shell === "sh") {
|
|
653
580
|
return {
|
|
654
|
-
files:
|
|
581
|
+
files: process.platform === "darwin"
|
|
582
|
+
? [path.join(home, ".zprofile"), path.join(home, ".zshrc")]
|
|
583
|
+
: [path.join(home, ".profile")],
|
|
655
584
|
style: "posix",
|
|
656
585
|
};
|
|
657
586
|
}
|
|
658
587
|
return null;
|
|
659
588
|
}
|
|
660
589
|
|
|
590
|
+
export function pathActivationGuidance(options = {}) {
|
|
591
|
+
const binDir = options.binDir;
|
|
592
|
+
const teamAgent = options.teamAgent;
|
|
593
|
+
const rc = options.rc || { files: [], skipped: [] };
|
|
594
|
+
const refresh = options.shell === "zsh" ? "rehash" : "hash -r";
|
|
595
|
+
const lines = [
|
|
596
|
+
"This shell cannot see team-agent yet. A child installer cannot change the shell that launched it.",
|
|
597
|
+
"Run this in the current shell:",
|
|
598
|
+
` export PATH="${binDir}:$PATH"`,
|
|
599
|
+
` ${refresh}`,
|
|
600
|
+
" team-agent --help",
|
|
601
|
+
"Or run the installed command directly:",
|
|
602
|
+
` ${teamAgent} --help`,
|
|
603
|
+
];
|
|
604
|
+
const written = rc.files || [];
|
|
605
|
+
const skipped = rc.skipped || [];
|
|
606
|
+
if (written.length > 0) {
|
|
607
|
+
lines.push(`New shells read: ${written.join(", ")}`);
|
|
608
|
+
} else if (skipped.length > 0) {
|
|
609
|
+
lines.push(`Shell startup already contains the PATH entry: ${skipped.join(", ")}`);
|
|
610
|
+
} else if (rc.unsupported) {
|
|
611
|
+
lines.push("This shell has no supported startup file. Keep the export above.");
|
|
612
|
+
} else {
|
|
613
|
+
lines.push("Could not update a shell startup file. Keep the export above.");
|
|
614
|
+
}
|
|
615
|
+
return lines.join("\n");
|
|
616
|
+
}
|
|
617
|
+
|
|
661
618
|
function installedBinDir(runtimeRoot, opts) {
|
|
662
619
|
const manifest = readInstallManifest(runtimeRoot);
|
|
663
620
|
if (typeof manifest?.binDir === "string" && manifest.binDir) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@team-agent/installer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.124",
|
|
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.124",
|
|
24
|
+
"@team-agent/cli-darwin-x64": "0.5.124",
|
|
25
|
+
"@team-agent/cli-linux-x64": "0.5.124"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"postinstall": "node npm/bincheck.mjs",
|