tryharness 0.7.33 → 0.7.35
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/cli.mjs +24 -2
- package/lib/threadRuns.mjs +17 -1
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -1786,6 +1786,24 @@ async function agents() {
|
|
|
1786
1786
|
ui.outro("Done.");
|
|
1787
1787
|
}
|
|
1788
1788
|
|
|
1789
|
+
// The pairing link carries a public key, so its code is large: drawn two characters per module it
|
|
1790
|
+
// was 130 columns and wrapped into noise. Half blocks put two rows in one line at one column per
|
|
1791
|
+
// module (61 columns), and fixed black and white keep it scannable on light and dark themes.
|
|
1792
|
+
async function terminalQr(text) {
|
|
1793
|
+
const { default: encodeQR } = await import("qr");
|
|
1794
|
+
const rows = encodeQR(text, "raw", { ecc: "low", border: 4 });
|
|
1795
|
+
const lines = [];
|
|
1796
|
+
for (let y = 0; y < rows.length; y += 2) {
|
|
1797
|
+
const cells = rows[y].map((top, x) => {
|
|
1798
|
+
const foreground = top ? 30 : 97;
|
|
1799
|
+
const background = rows[y + 1]?.[x] ? 40 : 107;
|
|
1800
|
+
return `\x1b[${foreground};${background}m▀`;
|
|
1801
|
+
});
|
|
1802
|
+
lines.push(`${cells.join("")}\x1b[0m`);
|
|
1803
|
+
}
|
|
1804
|
+
return { lines, width: rows[0].length };
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1789
1807
|
async function phone() {
|
|
1790
1808
|
const sub = argv[0] || "pair";
|
|
1791
1809
|
if (sub === "pair") {
|
|
@@ -1794,11 +1812,15 @@ async function phone() {
|
|
|
1794
1812
|
throw new Error(
|
|
1795
1813
|
response.error || "the daemon could not make a pairing code"
|
|
1796
1814
|
);
|
|
1797
|
-
const
|
|
1815
|
+
const qr = await terminalQr(response.url);
|
|
1798
1816
|
console.log(
|
|
1799
1817
|
"Scan this with your phone's camera. The code works once, for 10 minutes.\n"
|
|
1800
1818
|
);
|
|
1801
|
-
console.log(
|
|
1819
|
+
console.log(qr.lines.join("\n"));
|
|
1820
|
+
if (process.stdout.columns && process.stdout.columns < qr.width)
|
|
1821
|
+
console.log(
|
|
1822
|
+
`\nThis window is narrower than the code (${qr.width} columns), so it may not scan. Widen it and run this again, or add --link to print the link.`
|
|
1823
|
+
);
|
|
1802
1824
|
if (has("--link"))
|
|
1803
1825
|
console.log(
|
|
1804
1826
|
`\n${response.url}\n\nThis link is the pairing secret: open it only on your own phone.`
|
package/lib/threadRuns.mjs
CHANGED
|
@@ -203,6 +203,16 @@ export function createThreadRuns({
|
|
|
203
203
|
);
|
|
204
204
|
});
|
|
205
205
|
};
|
|
206
|
+
// The person's go reaches a turn another agent's ask left waiting for their Start, so it starts now rather than
|
|
207
|
+
// after a turn that would never come (October 17: Grok Bot's mention held Claude Code in the person's own folder, and
|
|
208
|
+
// their @claude-code queued behind it). The pending call stays, so the turn's brief carries the person's words.
|
|
209
|
+
const startHeldWake = (goalId, agent) => {
|
|
210
|
+
const wake = store.getTask(store.openWake(goalId, agent));
|
|
211
|
+
if (wake?.status !== "open" || wake.run_authorized_at) return;
|
|
212
|
+
if (!threadMayRun(store.getTask(goalId))) return;
|
|
213
|
+
store.meta(`person-wake:${wake.id}`, "1");
|
|
214
|
+
if (store.authorizeGoalRun(wake.id)) notifyBoard(store.getTask(wake.id));
|
|
215
|
+
};
|
|
206
216
|
const wakeAgent = (
|
|
207
217
|
goalId,
|
|
208
218
|
agent,
|
|
@@ -247,6 +257,7 @@ export function createThreadRuns({
|
|
|
247
257
|
at: new Date().toISOString(),
|
|
248
258
|
};
|
|
249
259
|
pendingWakes.set(`${goalId}:${agent}`, pending);
|
|
260
|
+
if (pending.go) startHeldWake(goalId, agent);
|
|
250
261
|
if (asker === "user" && words)
|
|
251
262
|
steerRunning(goalId, agent, words, pending);
|
|
252
263
|
return;
|
|
@@ -431,7 +442,12 @@ export function createThreadRuns({
|
|
|
431
442
|
for (const agent of RUNNERS) {
|
|
432
443
|
const key = goal.id + ":" + agent;
|
|
433
444
|
const pending = pendingWakes.get(key);
|
|
434
|
-
if (!pending
|
|
445
|
+
if (!pending) continue;
|
|
446
|
+
// A waiting turn never started, so nothing of it is unknown: the person's go still starts it.
|
|
447
|
+
if (store.openWake(goal.id, agent)) {
|
|
448
|
+
if (pending.go) startHeldWake(goal.id, agent);
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
435
451
|
// The previous turn's effects are unknown. Preserve the new call, but let the person inspect before starting it.
|
|
436
452
|
const wakeId = wakeAgent(goal.id, agent, pending.reason, {
|
|
437
453
|
asker: pending.asker,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tryharness",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.35",
|
|
4
4
|
"description": "Harness Relay: the daemon that turns the agents on this machine into your personal swarm. Memory, history, and work handed between any of them.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tryharness": "cli.mjs"
|