peerband 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/dist/peerband.mjs +25 -1
- package/herdr-plugin.toml +1 -1
- package/package.json +1 -1
package/dist/peerband.mjs
CHANGED
|
@@ -13514,6 +13514,8 @@ function failureDetail(result) {
|
|
|
13514
13514
|
const parsed = JSON.parse(text2);
|
|
13515
13515
|
detail = parsed.error?.message || parsed.message || text2;
|
|
13516
13516
|
} catch {
|
|
13517
|
+
const errorLine = text2.split(/\r?\n/).reverse().find((line) => /^\s*error\b/i.test(line));
|
|
13518
|
+
if (errorLine) detail = errorLine.trim();
|
|
13517
13519
|
}
|
|
13518
13520
|
return detail.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g, "").replace(/[\u0000-\u001f\u007f-\u009f]+/g, " ").trim().slice(0, 400);
|
|
13519
13521
|
}
|
|
@@ -16150,6 +16152,7 @@ var HerdrCoreAdapter = class {
|
|
|
16150
16152
|
};
|
|
16151
16153
|
}));
|
|
16152
16154
|
this.settleMs = options.settleMs ?? 150;
|
|
16155
|
+
this.nudgeMs = options.nudgeMs ?? 400;
|
|
16153
16156
|
}
|
|
16154
16157
|
options;
|
|
16155
16158
|
client;
|
|
@@ -16173,6 +16176,8 @@ var HerdrCoreAdapter = class {
|
|
|
16173
16176
|
wake;
|
|
16174
16177
|
sleep;
|
|
16175
16178
|
settleMs;
|
|
16179
|
+
nudgeMs;
|
|
16180
|
+
methods = /* @__PURE__ */ new Set();
|
|
16176
16181
|
getCapabilities() {
|
|
16177
16182
|
return { readOutput: true, sendMessage: true, reason: "Messages go to the agent's terminal address, which herdr-core never reuses. PeerBand checks that the same program still runs there right before sending." };
|
|
16178
16183
|
}
|
|
@@ -16278,6 +16283,24 @@ var HerdrCoreAdapter = class {
|
|
|
16278
16283
|
}
|
|
16279
16284
|
const result = await this.call("terminal.send", { terminal: live.terminal.address, text: message }, SEND_TIMEOUT_MS);
|
|
16280
16285
|
if (!result || typeof result !== "object" || typeof result.turn !== "number") throw new ConnectError("delivery_unknown", "herdr-core answered the message with an unexpected result.", "Read the agent output before deciding whether to send it again.");
|
|
16286
|
+
await this.nudgeUnsubmitted(live, result);
|
|
16287
|
+
}
|
|
16288
|
+
/**
|
|
16289
|
+
* Codex reads a long paste followed at once by Enter as part of the paste, so the message stays in its input box
|
|
16290
|
+
* (core reports `started: false`). Every relayed message is long because of its sender line. Press Enter once more
|
|
16291
|
+
* when the agent was not busy and still has not started. An extra Enter on an empty prompt does nothing.
|
|
16292
|
+
*/
|
|
16293
|
+
async nudgeUnsubmitted(live, result) {
|
|
16294
|
+
if (result.started !== false || result.status === "working" || !this.methods.has("terminal.keys")) return;
|
|
16295
|
+
await new Promise((resolve6) => setTimeout(resolve6, this.nudgeMs));
|
|
16296
|
+
try {
|
|
16297
|
+
const now2 = await this.call("terminal.get", { terminal: live.terminal.address });
|
|
16298
|
+
if (!isTerminal(now2) || now2.state !== "live" || identityFingerprint2(this.coreId, now2) !== live.fingerprint) return;
|
|
16299
|
+
const state = now2.status?.state;
|
|
16300
|
+
if (state === "working" || state === "blocked" || state === "error") return;
|
|
16301
|
+
await this.call("terminal.keys", { terminal: live.terminal.address, keys: ["enter"] });
|
|
16302
|
+
} catch {
|
|
16303
|
+
}
|
|
16281
16304
|
}
|
|
16282
16305
|
/** The layout as the dashboard shows it. Read only: herdr-core spaces and tabs belong to the desktop app. */
|
|
16283
16306
|
async listEnvironment() {
|
|
@@ -16420,6 +16443,7 @@ var HerdrCoreAdapter = class {
|
|
|
16420
16443
|
if (!hello || hello.generation !== PROTOCOL_GENERATION) throw new ConnectError("schema_mismatch", "This herdr-core speaks a protocol generation PeerBand does not support.", "Update PeerBand (`peerband update`) and herdr-core (`hc update`).");
|
|
16421
16444
|
const methods = Array.isArray(hello.methods) ? hello.methods : [];
|
|
16422
16445
|
const missing = REQUIRED_METHODS.filter((method) => !methods.includes(method));
|
|
16446
|
+
this.methods = new Set(methods.filter((method) => typeof method === "string"));
|
|
16423
16447
|
if (missing.length) throw new ConnectError("schema_mismatch", `This herdr-core lacks ${missing.join(", ")}.`, "Update herdr-core with `hc update`.");
|
|
16424
16448
|
return typeof hello.core?.id === "string" ? hello.core.id : "core";
|
|
16425
16449
|
})();
|
|
@@ -18585,7 +18609,7 @@ function herdrGroupHelp(s) {
|
|
|
18585
18609
|
}
|
|
18586
18610
|
|
|
18587
18611
|
// src/cli/cli.ts
|
|
18588
|
-
var VERSION = true ? "0.3.
|
|
18612
|
+
var VERSION = true ? "0.3.1" : "0.0.0-dev";
|
|
18589
18613
|
function createContext(overrides = {}) {
|
|
18590
18614
|
const env = overrides.env ?? process.env;
|
|
18591
18615
|
const stdout = overrides.stdout ?? process.stdout;
|
package/herdr-plugin.toml
CHANGED
package/package.json
CHANGED