patchcord 0.5.116 → 0.5.117
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/bin/patchcord.mjs +35 -26
- package/package.json +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -89,12 +89,12 @@ THIS AGENT — identity + messaging
|
|
|
89
89
|
ACCOUNT — log in to the CLI (commands below log in on demand)
|
|
90
90
|
patchcord login Authenticate the CLI (your account)
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
patchcord
|
|
94
|
-
Provision the
|
|
92
|
+
ORCHESTRATOR — set up the orchestrator agent (the shepherd) in this folder
|
|
93
|
+
patchcord orchestrator [--namespace <ns>] [--tool <harness>]
|
|
94
|
+
Provision the orchestrator here; launch it
|
|
95
95
|
to adopt this project or build a new team
|
|
96
96
|
|
|
97
|
-
TEAM — the
|
|
97
|
+
TEAM — the orchestrator's tools (run from the project root)
|
|
98
98
|
patchcord provision <agent> --tool <X> --role <Y> --namespace <ns> [--dir <sub/>]
|
|
99
99
|
Create a worker agent (identity + config)
|
|
100
100
|
patchcord pull <agent> --tool <X> --namespace <ns> [--dir <sub/>]
|
|
@@ -827,12 +827,12 @@ if (cmd === "subscribe") {
|
|
|
827
827
|
// works the same as the space-form (--token foo). The internal flag parsing below
|
|
828
828
|
// supports both. Non-flag commands (channel, init, skill, help, plugin-path) have
|
|
829
829
|
// their own branches above and below.
|
|
830
|
-
// ── CLI account auth +
|
|
830
|
+
// ── CLI account auth + orchestrator/team/provisioning/schedule ─────────────
|
|
831
831
|
// These commands act on the user's ACCOUNT, so they require CLI login. The
|
|
832
832
|
// account token (user-level, tied to NO agent) lives at ~/.patchcord/auth.json
|
|
833
833
|
// (legacy: main.json / master.json) or $PATCHCORD_TOKEN (legacy: *_MAIN/MASTER).
|
|
834
834
|
// `patchcord login` authenticates; everything else logs in on demand.
|
|
835
|
-
if (cmd === "login" || cmd === "teamlead" || cmd === "provision" || cmd === "pull" || cmd === "team" || cmd === "schedule") {
|
|
835
|
+
if (cmd === "login" || cmd === "orchestrator" || cmd === "teamlead" || cmd === "provision" || cmd === "pull" || cmd === "team" || cmd === "schedule") {
|
|
836
836
|
const M = { cyan: "\x1b[36m", green: "\x1b[32m", dim: "\x1b[2m", rst: "\x1b[0m" };
|
|
837
837
|
const AUTH_CONFIG = join(HOME, ".patchcord", "auth.json");
|
|
838
838
|
const LEGACY_CONFIGS = [join(HOME, ".patchcord", "main.json"), join(HOME, ".patchcord", "master.json")];
|
|
@@ -1046,27 +1046,34 @@ if (cmd === "login" || cmd === "teamlead" || cmd === "provision" || cmd === "pul
|
|
|
1046
1046
|
process.exit(0);
|
|
1047
1047
|
}
|
|
1048
1048
|
|
|
1049
|
-
if (cmd === "teamlead") {
|
|
1050
|
-
// Set up the
|
|
1051
|
-
// of agent — it shepherds a team: provisions, connects, and
|
|
1052
|
-
// other agents. It is NOT a normal agent: it gets its own
|
|
1053
|
-
// onboarding instruction, and on launch either ADOPTS
|
|
1054
|
-
// or CREATES a new team by interviewing the user.
|
|
1049
|
+
if (cmd === "orchestrator" || cmd === "teamlead") {
|
|
1050
|
+
// Set up the ORCHESTRATOR agent in THIS folder. The orchestrator is a
|
|
1051
|
+
// distinct kind of agent — it shepherds a team: provisions, connects, and
|
|
1052
|
+
// manages the other agents. It is NOT a normal agent: it gets its own
|
|
1053
|
+
// identity, its own onboarding instruction, and on launch either ADOPTS
|
|
1054
|
+
// this existing project or CREATES a new team by interviewing the user.
|
|
1055
|
+
// (`teamlead` is kept as a back-compat alias for the command name.)
|
|
1055
1056
|
const root = process.cwd();
|
|
1056
1057
|
const ns = (flagVal("namespace", basename(root)) || "team").replace(/[^a-z0-9-]/gi, "-").toLowerCase();
|
|
1057
1058
|
const tool = flagVal("tool", "claude_code");
|
|
1058
1059
|
const hostname = run("hostname -s") || run("hostname") || "unknown";
|
|
1059
|
-
const { status, json, m } = await accountCall("POST", "/api/provision", { namespace_id: ns, agent_id: "
|
|
1060
|
-
if (status !== "200" || !json?.token) { console.error(`could not set up
|
|
1060
|
+
const { status, json, m } = await accountCall("POST", "/api/provision", { namespace_id: ns, agent_id: "orchestrator", tool, role: "orchestrator", label: "orchestrator:self" });
|
|
1061
|
+
if (status !== "200" || !json?.token) { console.error(`could not set up orchestrator (HTTP ${status}): ${json?.error || ""}`); process.exit(1); }
|
|
1061
1062
|
const base = String(json.url || `${m.baseUrl}/mcp`).replace(/\/mcp$/, "");
|
|
1062
1063
|
writeWorkerConfig(tool, root, base, json.token, hostname);
|
|
1063
1064
|
mkdirSync(join(root, ".patchcord"), { recursive: true });
|
|
1064
1065
|
const tj = join(root, ".patchcord", "team.json");
|
|
1065
|
-
let manifest = { project: basename(root), namespace: ns,
|
|
1066
|
-
try {
|
|
1066
|
+
let manifest = { project: basename(root), namespace: ns, orchestrator: { agent: "orchestrator", tool }, agents: [] };
|
|
1067
|
+
try {
|
|
1068
|
+
if (existsSync(tj)) {
|
|
1069
|
+
const prev = JSON.parse(readFileSync(tj, "utf-8"));
|
|
1070
|
+
delete prev.teamlead; delete prev.main; delete prev.master; // drop pre-rename keys
|
|
1071
|
+
manifest = { ...prev, namespace: ns, orchestrator: { agent: "orchestrator", tool } };
|
|
1072
|
+
}
|
|
1073
|
+
} catch {}
|
|
1067
1074
|
writeFileSync(tj, JSON.stringify(manifest, null, 2) + "\n");
|
|
1068
|
-
// The
|
|
1069
|
-
writeFileSync(join(root, "
|
|
1075
|
+
// The orchestrator's onboarding instruction (read on launch).
|
|
1076
|
+
writeFileSync(join(root, "ORCHESTRATOR.md"), `# You are the ORCHESTRATOR (${ns}:orchestrator)
|
|
1070
1077
|
|
|
1071
1078
|
You shepherd a team of patchcord agents in this folder. You are NOT a worker —
|
|
1072
1079
|
you design the team, provision its agents, launch them, and manage them.
|
|
@@ -1079,14 +1086,16 @@ you design the team, provision its agents, launch them, and manage them.
|
|
|
1079
1086
|
which roles/harnesses, how many — confirm the plan, then build it.
|
|
1080
1087
|
|
|
1081
1088
|
## Build / run
|
|
1082
|
-
- Provision each worker: \`patchcord provision <agent> --tool <claude_code|codex|opencode|kimi> --role <role> --namespace ${ns} --dir <agent>/\`
|
|
1089
|
+
- Provision each worker: \`patchcord provision <agent> --tool <claude_code|codex|opencode|kimi|agy> --role <role> --namespace ${ns} --dir <agent>/\`
|
|
1090
|
+
- Pull an existing agent into a folder: \`patchcord pull <agent> --tool <X> --namespace ${ns} --dir <agent>/\`
|
|
1083
1091
|
- Launch: \`patchcord team launch\` (mux), verify with \`patchcord team status\`.
|
|
1084
1092
|
- Coordinate over patchcord (inbox / send_message); manage at the meta level.
|
|
1085
|
-
- Your own identity here is ${ns}:
|
|
1093
|
+
- Your own identity here is ${ns}:orchestrator — \`patchcord whoami\` confirms it.
|
|
1086
1094
|
`);
|
|
1087
|
-
|
|
1095
|
+
try { if (existsSync(join(root, "TEAMLEAD.md"))) unlinkSync(join(root, "TEAMLEAD.md")); } catch {} // remove pre-rename onboarding file
|
|
1096
|
+
console.log(`\n ${M.green}✓${M.rst} Orchestrator ready: ${M.green}${ns}:orchestrator${M.rst} [${tool}] in ${root}`);
|
|
1088
1097
|
console.log(` ${M.dim}Launch it here — it adopts this project or creates a new team, asking you:${M.rst}`);
|
|
1089
|
-
console.log(` mux new ${tool === "claude_code" ? "claude" : (tool === "kimi-code" ? "kimi" : tool)} --dir .`);
|
|
1098
|
+
console.log(` mux new ${tool === "claude_code" ? "claude" : (tool === "kimi-code" ? "kimi" : (tool === "antigravity" || tool === "agy") ? "agy" : tool)} --dir .`);
|
|
1090
1099
|
process.exit(0);
|
|
1091
1100
|
}
|
|
1092
1101
|
|
|
@@ -1160,10 +1169,10 @@ you design the team, provision its agents, launch them, and manage them.
|
|
|
1160
1169
|
panes.push({ session, window, path: real(path), cmd, claimed: false });
|
|
1161
1170
|
}
|
|
1162
1171
|
|
|
1163
|
-
// Build the roster:
|
|
1172
|
+
// Build the roster: orchestrator first, then workers.
|
|
1164
1173
|
const roster = [];
|
|
1165
|
-
const leadEntry = manifest.teamlead || manifest.main || manifest.master; // pre-rename names
|
|
1166
|
-
if (leadEntry) roster.push({ ...leadEntry, role: "
|
|
1174
|
+
const leadEntry = manifest.orchestrator || manifest.teamlead || manifest.main || manifest.master; // pre-rename names
|
|
1175
|
+
if (leadEntry) roster.push({ ...leadEntry, role: "orchestrator", dir: ".", _lead: true });
|
|
1167
1176
|
for (const a of (manifest.agents || [])) roster.push(a);
|
|
1168
1177
|
|
|
1169
1178
|
const rows = [];
|
|
@@ -3013,5 +3022,5 @@ if (cmd === "skill") {
|
|
|
3013
3022
|
process.exit(0);
|
|
3014
3023
|
}
|
|
3015
3024
|
|
|
3016
|
-
console.error(`Unknown command: ${cmd}. Available: install, whoami, agents, upload, subscribe, update, login, provision, pull,
|
|
3025
|
+
console.error(`Unknown command: ${cmd}. Available: install, whoami, agents, upload, subscribe, update, login, provision, pull, orchestrator, team, schedule, --rename, --token, --agent-type, --version, --help`);
|
|
3017
3026
|
process.exit(1);
|