tryharness 0.7.43 → 0.7.44

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/lib/daemon.mjs CHANGED
@@ -1042,10 +1042,12 @@ export async function startDaemon() {
1042
1042
  : agent === "claude-code"
1043
1043
  ? `${nameOf(agent)} would work in your own folder here, not a copy, so work another agent asked for waits for your Start.`
1044
1044
  : `${nameOf(agent)} has no restricted mode, so work another agent asked of it waits for your Start.`;
1045
- const threadMayRun = (goal) => {
1045
+ // In a task's own thread the person's go is their go on the task: a run they authorized, and, for its asker's turn on
1046
+ // the task's answer (`answer`), the task itself when they posted it or their own agent session did (owner, October 20).
1047
+ const threadMayRun = (goal, { answer = false } = {}) => {
1046
1048
  if (goal.trust !== "user") return false;
1047
1049
  const root = store.meta(`task-room:${goal.id}`);
1048
- return !root || Boolean(store.getTask(root)?.run_authorized_at);
1050
+ return !root || answer || Boolean(store.getTask(root)?.run_authorized_at);
1049
1051
  };
1050
1052
  const flagNote = (post) =>
1051
1053
  store.meta(`flagged:${post.id}`)
@@ -1536,7 +1538,7 @@ export async function startDaemon() {
1536
1538
  post,
1537
1539
  author,
1538
1540
  names = post.mentions,
1539
- { hosted = false, why = null, guard } = {}
1541
+ { hosted = false, why = null, guard, answering = null } = {}
1540
1542
  ) => {
1541
1543
  const goal = store.goal(goalId);
1542
1544
  const { picks } = picksIn(store, post.text, names);
@@ -1570,6 +1572,7 @@ export async function startDaemon() {
1570
1572
  pick: picks.get(agent),
1571
1573
  words: post.text,
1572
1574
  held: guard === undefined ? null : guardWait(author, agent, guard),
1575
+ answer: agent === answering,
1573
1576
  });
1574
1577
  else if (ASKABLE.has(agent))
1575
1578
  told.push(askAgent(goalId, agent, reason, author, post.text));
@@ -1665,6 +1668,8 @@ export async function startDaemon() {
1665
1668
  ...(root ? [] : [...alsoAsked, ...named]),
1666
1669
  ]),
1667
1670
  ].filter((agent) => agent && agent !== who && team.includes(agent));
1671
+ // The asker's turn on its own task's answer, in the thread the task opened (threadMayRun).
1672
+ const answering = root && mentions.includes(asker) ? asker : null;
1668
1673
  // An answer that carries something like a key is held for the person, as any post is, and the room hears that it was.
1669
1674
  const flag = secretReason(text);
1670
1675
  if (flag) {
@@ -1710,10 +1715,11 @@ export async function startDaemon() {
1710
1715
  void readByGuard(text).then((guard) => {
1711
1716
  if (guard?.verdict === "flag" || guard?.verdict === "hold")
1712
1717
  store.meta(`flagged:${post.id}`, String(guard.score));
1713
- wakeFor(goal.id, post, who, undefined, { guard });
1718
+ wakeFor(goal.id, post, who, undefined, { guard, answering });
1714
1719
  notifyBoard(store.getTask(goal.id));
1715
1720
  });
1716
- else if (goal.status === "open") wakeFor(goal.id, post, who);
1721
+ else if (goal.status === "open")
1722
+ wakeFor(goal.id, post, who, undefined, { answering });
1717
1723
  // Harness is asked by name only in a post (wakeFor); in a task's own thread no round follows the answer, so its
1718
1724
  // answer to work Harness posted is asked of Harness as one.
1719
1725
  if (root && mentions.includes("harness") && goal.status === "open")
@@ -213,7 +213,8 @@ export function createThreadRuns({
213
213
  const startHeldWake = (goalId, agent) => {
214
214
  const wake = store.getTask(store.openWake(goalId, agent));
215
215
  if (wake?.status !== "open" || wake.run_authorized_at) return;
216
- if (!threadMayRun(store.getTask(goalId))) return;
216
+ const answer = Boolean(pendingWakes.get(`${goalId}:${agent}`)?.answer);
217
+ if (!threadMayRun(store.getTask(goalId), { answer })) return;
217
218
  store.meta(`person-wake:${wake.id}`, "1");
218
219
  if (store.authorizeGoalRun(wake.id)) notifyBoard(store.getTask(wake.id));
219
220
  };
@@ -229,6 +230,8 @@ export function createThreadRuns({
229
230
  words = null,
230
231
  recovering = false,
231
232
  held = null,
233
+ // The asker's turn on its own task's answer (daemon.mjs threadMayRun).
234
+ answer = false,
232
235
  } = {}
233
236
  ) => {
234
237
  const task = store.getTask(goalId);
@@ -270,6 +273,7 @@ export function createThreadRuns({
270
273
  go: asker === "user" ? go : !flagged && (go || Boolean(prior?.go)),
271
274
  held: flagged,
272
275
  pick: pick ?? prior?.pick ?? null,
276
+ answer: answer || Boolean(prior?.answer),
273
277
  at: new Date().toISOString(),
274
278
  };
275
279
  pendingWakes.set(`${goalId}:${agent}`, pending);
@@ -340,7 +344,7 @@ export function createThreadRuns({
340
344
  if (pick) setRunPick(store, wake.id, pick, asker);
341
345
  // A review runs with the agent's own read-only switch (runner.mjs); only Claude Code and Codex have one.
342
346
  if (review) store.meta(`review:${wake.id}`, "1");
343
- if (!recovering && threadMayRun(task)) {
347
+ if (!recovering && threadMayRun(task, { answer })) {
344
348
  if (go) {
345
349
  store.meta(`person-wake:${wake.id}`, "1");
346
350
  store.authorizeGoalRun(wake.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tryharness",
3
- "version": "0.7.43",
3
+ "version": "0.7.44",
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"