tryharness 0.7.77 → 0.7.81

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.
@@ -24,17 +24,19 @@ import {
24
24
  youLine,
25
25
  } from "./cards.mjs";
26
26
  import { PICKABLE, resolvePick, setRunPick } from "./models.mjs";
27
- import { onMachine, placeTask } from "./machineRoutes.mjs";
27
+ import { fromCloud, onMachine, placeTask } from "./machineRoutes.mjs";
28
28
  import { computerAddress } from "./computerAddress.mjs";
29
29
  import { within } from "./folders.mjs";
30
30
  import { recordClaims } from "./audit.mjs";
31
31
  import {
32
+ callerRun,
32
33
  HOSTED_CALLER,
33
34
  limitedCaller,
34
35
  PROPOSERS,
35
36
  RUN_CALLER,
36
37
  } from "./runAuthority.mjs";
37
38
  import { prepareScratch, threadScratch } from "./scratch.mjs";
39
+ import { restrictedRun } from "./runWorker.mjs";
38
40
 
39
41
  // An agent working in a thread may bring another agent in for part of the work there, as Harness does when it names
40
42
  // one; an agent that moves money or takes positions joins only when the person names it (members.mjs TAGGED_ONLY).
@@ -149,7 +151,6 @@ export function createTaskCommands({
149
151
  opts.agent,
150
152
  provenance,
151
153
  {
152
- hosted: Boolean(request.hostedCaller),
153
154
  into: opts.into,
154
155
  folder: opts.folder,
155
156
  machine: opts.machine,
@@ -172,10 +173,15 @@ export function createTaskCommands({
172
173
  // What a worker is told of a task home lists for it, sealed like every answer between the person's computers
173
174
  // (machineRuns.mjs): started on another agent's ask on standing permission, so it gets none of the person's secrets,
174
175
  // and, naming no folder, run in its thread's scratch folder there.
176
+ // A run handed to another computer runs held in as home would run it (runWorker.mjs startBoardRun): read-only for a
177
+ // review, restricted, or with only the person's own agent settings for work another person asked for.
175
178
  const forWorker = (task) => ({
176
179
  ...task,
177
180
  standing: Boolean(store.standingProposal(task.id)),
178
181
  scratch: !task.run_workspace && task.kind === "task" && !!task.parent_id,
182
+ readOnly: store.meta(`review:${task.id}`) === "1",
183
+ restricted: restrictedRun(store, task),
184
+ ownSettingsOnly: store.meta(`other-person-run:${task.id}`) === "1",
179
185
  });
180
186
  return (request, { agent, id, expected, machine }) => {
181
187
  if (request.command.startsWith("board.dispatch."))
@@ -185,11 +191,15 @@ export function createTaskCommands({
185
191
  let outcome;
186
192
  // A call from one of the person's other computers, which home answers on its board (ownMachines.mjs).
187
193
  const fromElsewhere = Boolean(machine) && machine !== machines.self();
188
- // An agent's words from another computer carry no go of the person's here, as a call through Harness carries none
189
- // (security audit 2026-10-25, M1): the work it writes waits for the person's Start.
190
- const noGo =
191
- Boolean(request.hostedCaller) ||
192
- (fromElsewhere && !["user", "harness"].includes(agent));
194
+ // An agent's words from another computer the person drives carry their go as from this one, its run's limits sealed
195
+ // with them (owner, November 2, in place of audit M1). From a cloud computer Harness runs for them, as through
196
+ // Harness's server, they carry none of their own: what its agent writes starts on standing permission, past the
197
+ // guard (runAuthority.mjs admitPosted).
198
+ const cloud =
199
+ fromElsewhere &&
200
+ fromCloud(store, request) &&
201
+ !["user", "harness"].includes(agent);
202
+ const noGo = Boolean(request.hostedCaller) || cloud;
193
203
  if (
194
204
  request.command === "board.post" &&
195
205
  request.thread &&
@@ -597,8 +607,9 @@ export function createTaskCommands({
597
607
  if (pick) setRunPick(store, task.id, pick, agent);
598
608
  // How many times the person's agents have handed this work on since the person last did (runAuthority.mjs
599
609
  // MAX_HANDOFFS): one more than the run that posted it, none from a session or a post of the person's own.
600
- const handoffs = request[RUN_CALLER]
601
- ? Number(store.meta(`handoffs:${request[RUN_CALLER].id}`) || 0) + 1
610
+ const caller = callerRun(request);
611
+ const handoffs = caller
612
+ ? Number(store.meta(`handoffs:${caller.id}`) || 0) + 1
602
613
  : 0;
603
614
  if (handoffs) store.meta(`handoffs:${task.id}`, String(handoffs));
604
615
  if (deferred) {
@@ -618,8 +629,8 @@ export function createTaskCommands({
618
629
  }
619
630
  }
620
631
  // A job in a goal's room runs on the goal's authority; anywhere else, standing permission decides. The goal covers
621
- // jobs from the person and from their agents whose words came from the person's side (the agents on this machine,
622
- // Harness in the person's window; threadAuthority.mjs), with the person's go (personsGo) unless an agent's words
632
+ // jobs from the person and from their agents whose words came from the person's side (the agents on this machine
633
+ // or another the person drives, Harness in the person's window; threadAuthority.mjs), with the person's go (personsGo) unless an agent's words
623
634
  // came from above the poster; a job from a member that runs elsewhere (Grok Bot, Muse, a connected app), or any job
624
635
  // that came through Harness's server whatever name it carries, waits for the person's Start. A job
625
636
  // a restricted run or a review posts carries no go: it runs restricted (a review's job as a review) or waits, as
@@ -630,8 +641,7 @@ export function createTaskCommands({
630
641
  (!noGo && request.fromWindow !== true && speaksFromPersonsSide(agent));
631
642
  const agentWritten = task.trust !== "user";
632
643
  const limited = limitedCaller(request);
633
- if (limited && request[RUN_CALLER].review)
634
- store.meta(`review:${task.id}`, "1");
644
+ if (limited && caller.review) store.meta(`review:${task.id}`, "1");
635
645
  const go =
636
646
  onGoal &&
637
647
  !limited &&
@@ -682,7 +692,6 @@ export function createTaskCommands({
682
692
  ROOM_AGENTS.includes(task.target_agent)
683
693
  )
684
694
  openTaskRoom(store.getTask(task.id), agent, provenance, {
685
- hosted: Boolean(request.hostedCaller),
686
695
  into: workingThread,
687
696
  folder: askerFolder,
688
697
  machine,
@@ -705,7 +714,7 @@ export function createTaskCommands({
705
714
  // goal's authority.
706
715
  const cameAsItSpeaks = speaksThroughHarness(agent)
707
716
  ? request[HOSTED_CALLER] === true
708
- : !noGo;
717
+ : !noGo || cloud;
709
718
  const proposed =
710
719
  cameAsItSpeaks &&
711
720
  PROPOSERS.includes(agent) &&
@@ -734,6 +743,7 @@ export function createTaskCommands({
734
743
  proposer: agent,
735
744
  hosted: request[HOSTED_CALLER] === true,
736
745
  here: !noGo,
746
+ cloud,
737
747
  guard,
738
748
  limited,
739
749
  window: request.fromWindow === true,
package/lib/taskRooms.mjs CHANGED
@@ -79,14 +79,13 @@ export function createTaskRooms({ store, worktrees, runsHere, notifyBoard }) {
79
79
  /**
80
80
  * The thread `task` is worked in, opened for it or joined. `into`: the thread the poster is working in, which the
81
81
  * task joins (taskCommands.mjs). `folder`: where a coding agent that asked works, so its turn on the answer runs
82
- * there (answers.mjs) when the task names no folder. `machine`: the computer the poster wrote from. `hosted`: posted
83
- * through Harness.
82
+ * there (answers.mjs) when the task names no folder. `machine`: the computer the poster wrote from.
84
83
  */
85
84
  const open = (
86
85
  task,
87
86
  poster,
88
87
  provenance,
89
- { hosted = false, into = null, folder = null, machine = null } = {}
88
+ { into = null, folder = null, machine = null } = {}
90
89
  ) => {
91
90
  const conversation = conversationOf(task);
92
91
  const joined = into
@@ -115,7 +114,6 @@ export function createTaskRooms({ store, worktrees, runsHere, notifyBoard }) {
115
114
  if (provenance?.trust === "user") worktrees.inPlace(room.id);
116
115
  store.meta(`task-room:${room.id}`, task.id);
117
116
  if (conversation) store.meta(`conversation-room:${conversation}`, room.id);
118
- if (hosted) store.meta(`hosted-thread:${room.id}`, "1");
119
117
  return postJob(room, task, poster, machine);
120
118
  };
121
119
 
@@ -1,6 +1,5 @@
1
1
  import { picksIn } from "./models.mjs";
2
2
  import { DISPATCHER, MEMBERS, nameOf } from "./members.mjs";
3
- import { notifyDesktop } from "./notify.mjs";
4
3
 
5
4
  // A name after @ is an id or a one-word alias ("@grok" is Grok Bot); "@claude" is Claude Code.
6
5
  const ONE_WORD_ALIASES = new Map(
@@ -62,19 +61,24 @@ export function createThreadActions({
62
61
  ownMachines,
63
62
  threadView,
64
63
  }) {
65
- /** Pauses a thread, saying why in it and on the desktop. */
64
+ /**
65
+ * Pauses a thread, saying why in it. The person hears of it once, as the thread's item that waits on them
66
+ * (personNotices.mjs), keyed to this pause's note: a notice of its own here made two of each, and keying the item to
67
+ * the thread's last change told the same pause again at every change (A1 run, November 2).
68
+ */
66
69
  const pause = (goalId, reason) => {
67
70
  const task = store.setGoalState(goalId, {
68
71
  status: "paused",
69
72
  pausedReason: reason,
70
73
  });
71
- store.roomPost({
74
+ const said = String(reason).replace(/[.!?…\s]+$/, "");
75
+ const note = store.roomPost({
72
76
  goalId,
73
77
  author: DISPATCHER,
74
78
  kind: "note",
75
- text: `Paused: ${reason}. Resume it from the thread when you want it to go on.`,
79
+ text: `Paused: ${said}. Resume it from the thread when you want it to go on.`,
76
80
  });
77
- notifyDesktop(`${threadView().row(task).title} is paused: ${reason}`);
81
+ if (note) store.meta(`paused-note:${goalId}`, String(note.seq));
78
82
  notifyBoard(task);
79
83
  return task;
80
84
  };
@@ -158,6 +162,8 @@ export function createThreadActions({
158
162
  names = post.mentions,
159
163
  {
160
164
  hosted = false,
165
+ // The words came from a cloud computer Harness runs for the person: the guard's reading decides, as for hosted.
166
+ cloud = false,
161
167
  window = false,
162
168
  why = null,
163
169
  guard,
@@ -216,6 +222,7 @@ export function createThreadActions({
216
222
  projectGo ??
217
223
  authority.personsGo(author, agent, {
218
224
  hosted,
225
+ cloud,
219
226
  guard,
220
227
  limited,
221
228
  window,
@@ -228,15 +235,23 @@ export function createThreadActions({
228
235
  held:
229
236
  guard === undefined
230
237
  ? null
231
- : authority.guardWait(author, agent, guard, { hosted }),
238
+ : authority.guardWait(author, agent, guard, { hosted, cloud }),
232
239
  orders: guard !== undefined && authority.readAsOrders(guard),
233
240
  answer: agent === answering,
234
241
  // How the ask came, for one from the person's own agents: in a thread another agent wrote, its turn may start
235
- // on the agent's standing permission (threadRuns.mjs admitProposal). `here`: from a process on this computer.
242
+ // on the agent's standing permission (threadRuns.mjs admitProposal). `here`: from a process on this computer
243
+ // or another the person drives; `cloud`: from a cloud computer Harness runs for them.
236
244
  proposal:
237
245
  guard === undefined
238
246
  ? null
239
- : { hosted: server, here: !hosted, guard, limited, window },
247
+ : {
248
+ hosted: server,
249
+ here: !hosted && !cloud,
250
+ cloud,
251
+ guard,
252
+ limited,
253
+ window,
254
+ },
240
255
  });
241
256
  const original =
242
257
  typeof assigned === "string" ? store.getTask(assigned) : null;
@@ -55,40 +55,58 @@ export function createThreadAuthority({
55
55
  const readAsOrders = (guard) => guard?.verdict === "hold";
56
56
 
57
57
  // Whose asks carry the person's go on the guard's reading: the person's agents whose words come through Harness's
58
- // server, Harness's own among them while their window is closed.
59
- const readByGuard = (asker, hosted) =>
60
- fromElsewhere(asker) || (hosted && speaksThroughHarness(asker));
58
+ // server, Harness's own among them while their window is closed, and any of their agents on a cloud computer Harness
59
+ // runs for them (`cloud`).
60
+ const readByGuard = (asker, hosted, cloud = false) =>
61
+ fromElsewhere(asker) || cloud || (hosted && speaksThroughHarness(asker));
61
62
 
62
63
  // Whose asks carry the person's go as they are: the person's own agents whose words reached this computer from the
63
64
  // person's own computers or device, not through Harness's server. Read the same for every agent (owner, November 1:
64
- // "@harness is just another agent").
65
+ // "@harness is just another agent"), and the same from every computer the person drives (owner, November 2: agents
66
+ // handing work on should be seamless wherever they run).
65
67
  const fromPersonsSide = (asker, hosted) =>
66
68
  !hosted && speaksFromPersonsSide(asker);
67
69
 
68
- /** Whether `asker`'s request for `agent` carries the person's go. `hosted`: the request came through Harness. */
70
+ /**
71
+ * Whether `asker`'s request for `agent` carries the person's go. `hosted`: the request came through Harness, or from
72
+ * a cloud computer (`cloud`), whose words the guard reads.
73
+ */
69
74
  // A coding agent here asking from a restricted run or a review carries no go: that run had none to pass on.
70
75
  // `window`: Harness's call as a linked window sealed it (phones.mjs fromWindow). The page that window runs is served
71
76
  // by Harness, so its word for Harness is never the person's go, whatever it names.
72
77
  const personsGo = (
73
78
  asker,
74
79
  agent,
75
- { hosted = false, guard = null, limited = null, window = false } = {}
80
+ {
81
+ hosted = false,
82
+ cloud = false,
83
+ guard = null,
84
+ limited = null,
85
+ window = false,
86
+ } = {}
76
87
  ) =>
77
88
  asker === "user" ||
78
89
  (!window &&
79
90
  !readAsOrders(guard) &&
80
91
  // The dispatcher hands on the person's own work; every agent is read by where its words came from.
81
92
  ((asker === DISPATCHER && !hosted && !limited) ||
82
- (!limited && fromPersonsSide(asker, hosted)) ||
83
- (readByGuard(asker, hosted) && guardPasses(guard))) &&
93
+ (!limited && fromPersonsSide(asker, hosted || cloud)) ||
94
+ (!limited &&
95
+ readByGuard(asker, hosted, cloud) &&
96
+ guardPasses(guard))) &&
84
97
  !setToWait(agent));
85
98
 
86
99
  /** What the thread says when the guard keeps an agent's request from carrying the person's go; null otherwise. */
87
- const guardWait = (asker, agent, guard, { hosted = false } = {}) => {
100
+ const guardWait = (
101
+ asker,
102
+ agent,
103
+ guard,
104
+ { hosted = false, cloud = false } = {}
105
+ ) => {
88
106
  if (asker === "user" || setToWait(agent)) return null;
89
107
  if (readAsOrders(guard))
90
108
  return `The guard read ${nameOf(asker)}'s words as orders aimed at your agents, so ${nameOf(agent)} waits for your Start. Read them before you start it.`;
91
- if (!readByGuard(asker, hosted) || guardPasses(guard)) return null;
109
+ if (!readByGuard(asker, hosted, cloud) || guardPasses(guard)) return null;
92
110
  return `The guard that reads ${nameOf(asker)}'s words for planted instructions is not running on this computer, so ${nameOf(agent)} waits for your Start.`;
93
111
  };
94
112