@pitboss/cli 0.3.0 → 0.3.1
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/README.md +1 -1
- package/dist/cli.js +23 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ Each `join` connects one agent. To add another, run `join` again from that agent
|
|
|
32
32
|
Pitboss does not push into a running agent. Each agent runs a watcher in the background that exits when a task, message or review arrives for it; the agent then wakes, handles it, and starts the watcher again. The hooks `join` installs do this for you. Without them an agent only notices new work when you next prompt it.
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
pitboss watch --once # block until the next event for this folder's agent, print it as JSON, exit 0
|
|
35
|
+
pitboss watch --once # block until the next event for this folder's agent, print it as one JSON line with a summary, exit 0
|
|
36
36
|
pitboss watch # stream events until Ctrl-C (for a human watching a terminal)
|
|
37
37
|
```
|
|
38
38
|
|
package/dist/cli.js
CHANGED
|
@@ -19116,10 +19116,13 @@ function mergeMcpServer(existing, name, entry) {
|
|
|
19116
19116
|
mcpServers: { ...servers, [name]: entry }
|
|
19117
19117
|
};
|
|
19118
19118
|
}
|
|
19119
|
-
function
|
|
19119
|
+
function legacyPitbossEntry(config) {
|
|
19120
19120
|
const legacy = config.mcpServers.relai;
|
|
19121
19121
|
const ours = Array.isArray(legacy?.args) && legacy.args.some((a) => typeof a === "string" && /^(@pitboss\/cli|@getrelai\/mcp-server)(@|$)/.test(a));
|
|
19122
|
-
|
|
19122
|
+
return ours ? legacy : void 0;
|
|
19123
|
+
}
|
|
19124
|
+
function dropLegacyPitbossEntry(config) {
|
|
19125
|
+
if (!legacyPitbossEntry(config)) return config;
|
|
19123
19126
|
const { relai: _dropped, ...rest } = config.mcpServers;
|
|
19124
19127
|
return { ...config, mcpServers: rest };
|
|
19125
19128
|
}
|
|
@@ -19914,6 +19917,7 @@ async function run(opts) {
|
|
|
19914
19917
|
const failed = [];
|
|
19915
19918
|
let wroteCliConfig = "";
|
|
19916
19919
|
const wakeWarnings = [];
|
|
19920
|
+
const dropped = [];
|
|
19917
19921
|
for (const invite of invites) {
|
|
19918
19922
|
const accepted = await postJson(`${api}/auth/accept-invite`, {
|
|
19919
19923
|
code: invite.code,
|
|
@@ -19948,7 +19952,13 @@ async function run(opts) {
|
|
|
19948
19952
|
writeConfig({ apiUrl: api, apiToken: agent.token, agentId: agent.data.id, agentName: invite.name, repoId, specialization: invite.specialization ?? void 0 });
|
|
19949
19953
|
wroteCliConfig = invite.name;
|
|
19950
19954
|
} else {
|
|
19951
|
-
|
|
19955
|
+
let legacy;
|
|
19956
|
+
writeMergedJson(dest, (e) => {
|
|
19957
|
+
const merged = mergeMcpServer(e, "pitboss", { ...MCP_SERVER_ENTRY, env: env2 });
|
|
19958
|
+
legacy = legacyPitbossEntry(merged);
|
|
19959
|
+
return dropLegacyPitbossEntry(merged);
|
|
19960
|
+
}, root);
|
|
19961
|
+
if (legacy) dropped.push(`${dest} (agent ${typeof legacy.env?.AGENT_ID === "string" ? legacy.env.AGENT_ID : "unknown"})`);
|
|
19952
19962
|
}
|
|
19953
19963
|
written.push(dest);
|
|
19954
19964
|
excludeIfUntracked(root, dest);
|
|
@@ -19990,6 +20000,10 @@ async function run(opts) {
|
|
|
19990
20000
|
for (const s of skipped) console.log(source_default.red(` ${s.name} -> ${s.target.replace(home, "~")}`));
|
|
19991
20001
|
console.log(source_default.dim(" Untrack it (git rm --cached <file>) and run join again, or configure that agent by hand."));
|
|
19992
20002
|
}
|
|
20003
|
+
if (dropped.length) {
|
|
20004
|
+
console.log(source_default.yellow('\n Replaced an old "relai" server entry with "pitboss"; removed:'));
|
|
20005
|
+
for (const d of dropped) console.log(source_default.yellow(` ${d.replace(home, "~")}`));
|
|
20006
|
+
}
|
|
19993
20007
|
if (wakeWarnings.length) {
|
|
19994
20008
|
console.log(source_default.yellow("\n Wake-up hooks not installed, so these agents only see new work when prompted:"));
|
|
19995
20009
|
for (const w of wakeWarnings) console.log(source_default.yellow(` ${w}`));
|
|
@@ -20105,13 +20119,13 @@ function parseSseFrame(frame) {
|
|
|
20105
20119
|
return null;
|
|
20106
20120
|
}
|
|
20107
20121
|
}
|
|
20108
|
-
function summarize(e) {
|
|
20122
|
+
function summarize(e, bodyChars = 80) {
|
|
20109
20123
|
const p = e.payload ?? {};
|
|
20110
20124
|
const taskTitle = p.task?.title ?? e.targetId;
|
|
20111
20125
|
const threadTitle = p.thread?.title ?? e.targetId;
|
|
20112
20126
|
switch (e.kind) {
|
|
20113
20127
|
case "message.posted":
|
|
20114
|
-
return `${p.message?.type ?? "message"} from ${p.message?.fromAgent ?? "?"}: ${truncate(p.message?.body ?? "",
|
|
20128
|
+
return `${p.message?.type ?? "message"} from ${p.message?.fromAgent ?? "?"}: ${truncate(p.message?.body ?? "", bodyChars)}`;
|
|
20115
20129
|
case "task.created":
|
|
20116
20130
|
return `new task assigned to you: "${taskTitle}"`;
|
|
20117
20131
|
case "task.updated":
|
|
@@ -20136,6 +20150,9 @@ function summarize(e) {
|
|
|
20136
20150
|
return `${e.targetType} ${e.targetId}`;
|
|
20137
20151
|
}
|
|
20138
20152
|
}
|
|
20153
|
+
function wakeLine(first, count) {
|
|
20154
|
+
return JSON.stringify({ ...first, summary: summarize(first, 200), ...count > 1 ? { more: count - 1 } : {} });
|
|
20155
|
+
}
|
|
20139
20156
|
var KIND_STYLE = {
|
|
20140
20157
|
"message.posted": source_default.cyan,
|
|
20141
20158
|
"task.created": source_default.green,
|
|
@@ -20224,7 +20241,7 @@ async function watchOnce(dir) {
|
|
|
20224
20241
|
continue;
|
|
20225
20242
|
}
|
|
20226
20243
|
if (!wake.first) throw new Error("event stream closed");
|
|
20227
|
-
return printAndExit(
|
|
20244
|
+
return printAndExit(wakeLine(wake.first, wake.count), 0);
|
|
20228
20245
|
} catch (err) {
|
|
20229
20246
|
console.error(`pitboss watch: ${err.message}; reconnecting in ${Math.round(backoffMs / 1e3)}s`);
|
|
20230
20247
|
await sleep2(backoffMs);
|