tryharness 0.7.25 → 0.7.26

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
@@ -195,6 +195,17 @@ const networkAddresses = () =>
195
195
  .sort()
196
196
  .join(",");
197
197
  const TASK_LOG_PAGE = 64_000;
198
+ // How a Harness window takes the tasks given to Harness, as it says when it claims one: keep equal to
199
+ // HARNESS_INBOX_VERSION in src/schemas/reasoning.ts. A window below it (one left open across a release, or Harness's
200
+ // claim_board_task inside some other turn) would answer without the task's thread (October 15). Only a window's call is
201
+ // checked, sealed from a linked browser or through Harness; this daemon's own hold for Harness's server is not one.
202
+ const HARNESS_INBOX_VERSION = 2;
203
+ const windowCannotTake = (request, agent, task) =>
204
+ agent === "harness" &&
205
+ (request.fromWindow === true || request.hostedCaller === true) &&
206
+ task?.target_agent === "harness" &&
207
+ (!task.kind || task.kind === "task") &&
208
+ !(Number(request.inbox) >= HARNESS_INBOX_VERSION);
198
209
 
199
210
  function daemonAnswers(socketPath) {
200
211
  return new Promise((resolve) => {
@@ -4888,6 +4899,15 @@ export async function startDaemon() {
4888
4899
  state.connected
4889
4900
  )
4890
4901
  return forwardToHarness(request);
4902
+ else if (
4903
+ request.command === "board.claim" &&
4904
+ windowCannotTake(request, agent, store.getTask(id))
4905
+ )
4906
+ return {
4907
+ ok: false,
4908
+ error:
4909
+ "a task given to Harness is taken by an up-to-date Harness window by itself, as its own message; leave it open",
4910
+ };
4891
4911
  else if (request.command === "board.claim") {
4892
4912
  outcome = store.claimTask(
4893
4913
  id,
package/lib/phones.mjs CHANGED
@@ -388,6 +388,8 @@ export async function createPhoneDesk({
388
388
  ...rest,
389
389
  command,
390
390
  agent: as,
391
+ // A Harness window's own call, which daemon.mjs checks before it takes a task given to Harness.
392
+ fromWindow: as === "harness",
391
393
  ...(writtenBy.length
392
394
  ? { provenance: { trust: "agent", chain: writtenBy } }
393
395
  : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tryharness",
3
- "version": "0.7.25",
3
+ "version": "0.7.26",
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"