@team-agent/installer 0.5.122 → 0.5.123
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 +78 -42
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +137 -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/contract_runtime/backend.rs +490 -2
- package/crates/team-agent/src/contract_runtime/commands.rs +38 -24
- 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/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/launch_spawn.rs +7 -5
- package/crates/team-agent/src/provider/wire.rs +2 -1
- package/npm/install.mjs +17 -97
- 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,20 @@ 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("Open a new terminal, then run: team-agent --help");
|
|
172
|
+
}
|
|
241
173
|
}
|
|
242
174
|
|
|
243
175
|
function runDoctor(argv) {
|
|
@@ -389,36 +321,26 @@ export function repairPathShadowingTeamAgentCommands(options = {}) {
|
|
|
389
321
|
const repairs = [];
|
|
390
322
|
const recordedBinDirs = options.recordedBinDirs || recordedManagedBinDirs(options.manifest);
|
|
391
323
|
const candidates = pathShadowRepairCandidates(env.PATH || "", home, binDir, recordedBinDirs);
|
|
392
|
-
log?.(`path-shadow: scanning ${candidates.length} candidate bin dirs for managed wrappers`);
|
|
393
324
|
for (const candidateDir of candidates) {
|
|
394
325
|
const entry = candidateDir.dir;
|
|
395
326
|
if (isVersionManagedPath(entry)) {
|
|
396
|
-
log?.(`path-shadow: skip ${path.join(entry, "team-agent")} source=${candidateDir.source} reason=version-managed-path`);
|
|
397
327
|
continue;
|
|
398
328
|
}
|
|
399
329
|
for (const name of WRAPPER_NAMES) {
|
|
400
330
|
const candidate = path.join(entry, name);
|
|
401
331
|
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
332
|
continue;
|
|
406
333
|
}
|
|
407
|
-
log?.(`path-shadow: found ${candidate} source=${candidateDir.source}`);
|
|
408
334
|
if (!isExecutableFile(candidate)) {
|
|
409
|
-
log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=not-executable-file`);
|
|
410
335
|
continue;
|
|
411
336
|
}
|
|
412
337
|
if (sameFile(candidate, installedWrapper) && name === "team-agent") {
|
|
413
|
-
log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=installed-wrapper`);
|
|
414
338
|
continue;
|
|
415
339
|
}
|
|
416
340
|
if (sameFile(candidate, runtimeBinary)) {
|
|
417
|
-
log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=runtime-binary`);
|
|
418
341
|
continue;
|
|
419
342
|
}
|
|
420
343
|
if (!isInstallerManagedWrapper(candidate)) {
|
|
421
|
-
log?.(`path-shadow: skip ${candidate} source=${candidateDir.source} reason=not-installer-managed`);
|
|
422
344
|
continue;
|
|
423
345
|
}
|
|
424
346
|
const extraArgs = name === "team_orchestrator" ? ["mcp-server"] : name === "team-agent-coordinator" ? ["coordinator"] : [];
|
|
@@ -428,12 +350,11 @@ export function repairPathShadowingTeamAgentCommands(options = {}) {
|
|
|
428
350
|
const detail = error instanceof Error ? error.message : String(error);
|
|
429
351
|
throw new Error(`failed to update PATH-shadowing team-agent at ${candidate}: ${detail}`);
|
|
430
352
|
}
|
|
431
|
-
log?.(`path-shadow: updated ${candidate} source=${candidateDir.source} to runtime shim`);
|
|
432
353
|
repairs.push({ file: candidate, binDir: entry, source: candidateDir.source });
|
|
433
354
|
}
|
|
434
355
|
}
|
|
435
|
-
if (repairs.length
|
|
436
|
-
log?.(
|
|
356
|
+
if (repairs.length > 0) {
|
|
357
|
+
log?.(`updated ${repairs.length} older Team Agent command${repairs.length === 1 ? "" : "s"}`);
|
|
437
358
|
}
|
|
438
359
|
return repairs;
|
|
439
360
|
}
|
|
@@ -451,11 +372,10 @@ export function verifyInstalledTeamAgentOnPath(options = {}) {
|
|
|
451
372
|
timeout: VERSION_SMOKE_TIMEOUT_MS,
|
|
452
373
|
});
|
|
453
374
|
const entry = (which.stdout || "").split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
375
|
+
// A fresh ~/.local/bin install is not on the current shell PATH yet. That is
|
|
376
|
+
// guidance, not a failed install.
|
|
454
377
|
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
|
-
);
|
|
378
|
+
return { status: "not-on-current-path" };
|
|
459
379
|
}
|
|
460
380
|
const versionProbe = spawnSync(entry, ["--version"], {
|
|
461
381
|
text: true,
|
|
@@ -479,7 +399,7 @@ export function verifyInstalledTeamAgentOnPath(options = {}) {
|
|
|
479
399
|
`but installer installed ${expectedVersion}. Remove or update the earlier PATH entry that shadows Team Agent.`,
|
|
480
400
|
);
|
|
481
401
|
}
|
|
482
|
-
return { entry, version: actualVersion };
|
|
402
|
+
return { status: "ready", entry, version: actualVersion };
|
|
483
403
|
}
|
|
484
404
|
|
|
485
405
|
export function parseTeamAgentVersion(output) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@team-agent/installer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.123",
|
|
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.123",
|
|
24
|
+
"@team-agent/cli-darwin-x64": "0.5.123",
|
|
25
|
+
"@team-agent/cli-linux-x64": "0.5.123"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"postinstall": "node npm/bincheck.mjs",
|