tryharness 0.7.68 → 0.7.69

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.
@@ -83,6 +83,8 @@ export function createTaskCommands({
83
83
  yourTurns,
84
84
  authority,
85
85
  actors,
86
+ dispatches = null,
87
+ promptFlow = null,
86
88
  files: boardFiles,
87
89
  // Threads mirrored from another app (environments.mjs), when the person reads them here.
88
90
  outside = () => null,
@@ -153,6 +155,14 @@ export function createTaskCommands({
153
155
  };
154
156
  };
155
157
  return (request, { agent, id, expected, lastLooked, machine }) => {
158
+ if (request.command.startsWith("board.prompt."))
159
+ return promptFlow
160
+ ? promptFlow.command(request, { agent, id, machine })
161
+ : { ok: false, error: "prompt execution is unavailable" };
162
+ if (request.command.startsWith("board.dispatch."))
163
+ return dispatches
164
+ ? dispatches.command(request, { agent, id, machine })
165
+ : { ok: false, error: "typed dispatch is unavailable" };
156
166
  let outcome;
157
167
  // A call from one of the person's other computers, which home answers on its board (ownMachines.mjs).
158
168
  const fromElsewhere = Boolean(machine) && machine !== machines.self();
@@ -180,6 +190,70 @@ export function createTaskCommands({
180
190
  };
181
191
  }
182
192
  if (request.command === "board.post") {
193
+ if (Object.hasOwn(request, "promptDispatch")) {
194
+ if (typeof request.promptDispatch !== "boolean")
195
+ return { ok: false, error: "invalid prompt dispatch mode" };
196
+ if (request.promptDispatch) {
197
+ const promptFields = new Set([
198
+ "command",
199
+ "agent",
200
+ "id",
201
+ "callerPid",
202
+ "objective",
203
+ "brief",
204
+ "runWorkspace",
205
+ "requestRef",
206
+ "promptDispatch",
207
+ ]);
208
+ if (Object.keys(request).some((key) => !promptFields.has(key)))
209
+ return {
210
+ ok: false,
211
+ error: "unsupported prompt dispatch arguments",
212
+ };
213
+ if (
214
+ agent !== "user" ||
215
+ request[RUN_CALLER] ||
216
+ request.hostedCaller ||
217
+ request.parentId ||
218
+ request.thread ||
219
+ request.targetAgent ||
220
+ request.targetAgents ||
221
+ request.targetMachine ||
222
+ request.deferDispatch ||
223
+ request.review ||
224
+ request.inSession ||
225
+ request.model
226
+ )
227
+ return {
228
+ ok: false,
229
+ error:
230
+ "prompt dispatch requires an owner prompt and its workspace context",
231
+ };
232
+ return dispatches.command(
233
+ {
234
+ command: "board.dispatch.prompt",
235
+ agent,
236
+ prompt: [
237
+ String(request.objective || ""),
238
+ String(request.brief || ""),
239
+ ]
240
+ .filter(Boolean)
241
+ .join("\n\n"),
242
+ runWorkspace: request.runWorkspace,
243
+ requestRef: request.requestRef ?? request.id,
244
+ },
245
+ { agent, id, machine }
246
+ );
247
+ }
248
+ }
249
+ if (
250
+ (Object.hasOwn(request, "deferDispatch") &&
251
+ typeof request.deferDispatch !== "boolean") ||
252
+ (Object.hasOwn(request, "dispatchStarts") &&
253
+ (request.deferDispatch !== true ||
254
+ ![0, 1].includes(request.dispatchStarts)))
255
+ )
256
+ return { ok: false, error: "invalid typed dispatch options" };
183
257
  const objective = String(request.objective || "").trim();
184
258
  if (!objective) return { ok: false, error: "a task needs an objective" };
185
259
  // A thread with another person themselves (not one of their agents) is the person's own: no agent here claims or runs it.
@@ -270,6 +344,23 @@ export function createTaskCommands({
270
344
  viaServer: request.hostedCaller === true,
271
345
  });
272
346
  const goalParent = parentTask?.kind === "goal" ? parentTask : null;
347
+ const deferred = request.deferDispatch === true;
348
+ if (
349
+ deferred &&
350
+ (agent !== "user" ||
351
+ provenance.trust !== "user" ||
352
+ request[RUN_CALLER] ||
353
+ request.hostedCaller ||
354
+ request.thread ||
355
+ request.parentId ||
356
+ request.targetAgents ||
357
+ ![0, 1].includes(request.dispatchStarts ?? 1))
358
+ )
359
+ return {
360
+ ok: false,
361
+ error:
362
+ "only the owner can stage an exact local run with a zero-or-one start limit",
363
+ };
273
364
  if (goalParent) {
274
365
  if (!inRoom(goalParent, agent))
275
366
  return { ok: false, error: `${agent} is not on this goal's team` };
@@ -509,7 +600,7 @@ export function createTaskCommands({
509
600
  // Asking for a run in a folder is the person's Start; a scratch folder they never asked for goes by standing permission.
510
601
  runWorkspace: thread ? null : runWorkspace,
511
602
  runAuthorizedBy:
512
- !thread && runWorkspace && !scratch && agent === "user"
603
+ !deferred && !thread && runWorkspace && !scratch && agent === "user"
513
604
  ? "user"
514
605
  : null,
515
606
  targetMachine,
@@ -525,6 +616,22 @@ export function createTaskCommands({
525
616
  getProjects()?.channelOpened(task.id);
526
617
  }
527
618
  if (pick) setRunPick(store, task.id, pick, agent);
619
+ if (deferred) {
620
+ try {
621
+ if (!dispatches) throw new Error("typed dispatch is unavailable");
622
+ dispatches.stage(store.getTask(task.id), request.dispatchStarts ?? 1);
623
+ notifyBoard(store.getTask(task.id));
624
+ return { ok: true, task: store.getTask(task.id) };
625
+ } catch (error) {
626
+ store.failUnstartedDispatch(task.id, error.message);
627
+ notifyBoard(store.getTask(task.id));
628
+ return {
629
+ ok: false,
630
+ error: error.message,
631
+ task: store.getTask(task.id),
632
+ };
633
+ }
634
+ }
528
635
  // A job in a goal's room runs on the goal's authority; anywhere else, standing permission decides. The goal covers
529
636
  // jobs from the person, Harness and the coding agents on this machine, with the person's go (personsGo) unless an
530
637
  // agent's words came from above the poster; a job from a member that runs elsewhere (Grok Bot, Muse, a connected
@@ -1097,7 +1204,24 @@ export function createTaskCommands({
1097
1204
  else if (request.command === "board.machine.info") {
1098
1205
  if (!fromElsewhere)
1099
1206
  return { ok: false, error: "only another computer says what it has" };
1207
+ if (
1208
+ !Array.isArray(request.folders) ||
1209
+ request.folders.some(
1210
+ (folder) =>
1211
+ typeof folder?.path !== "string" ||
1212
+ !path.isAbsolute(folder.path) ||
1213
+ typeof folder.repository !== "string"
1214
+ )
1215
+ )
1216
+ return {
1217
+ ok: false,
1218
+ error: "worker inventory needs valid folder and repository entries",
1219
+ };
1100
1220
  machines.learn(machine, {
1221
+ request:
1222
+ typeof request.inventoryRequest === "string"
1223
+ ? request.inventoryRequest
1224
+ : null,
1101
1225
  folders: (Array.isArray(request.folders) ? request.folders : [])
1102
1226
  .filter(
1103
1227
  (folder) =>
package/lib/team.json CHANGED
@@ -1,5 +1,15 @@
1
1
  {
2
2
  "version": 2,
3
+ "fileSpecialties": [
4
+ "building-features",
5
+ "debugging",
6
+ "testing",
7
+ "code-review",
8
+ "frontend",
9
+ "infrastructure",
10
+ "data-sql",
11
+ "smart-contracts"
12
+ ],
3
13
  "rules": [
4
14
  "Whoever already holds the context does the work. Hand a piece to an agent new to the thread only when it needs little reading in and its answer can be checked.",
5
15
  "The dispatcher routes and never frames, makes or judges. The framer says what good looks like, and the frame goes with the work, so the check and the judge test against it rather than the maker's own idea of done.",
package/lib/team.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { readFileSync } from "node:fs";
2
- import { nameOf } from "./members.mjs";
2
+ import { member, nameOf } from "./members.mjs";
3
3
  import { specialtyName } from "./specialties.mjs";
4
4
  import { namedFiles } from "./worktrees.mjs";
5
5
 
@@ -56,6 +56,33 @@ const KNOWN = new Set(
56
56
  );
57
57
  const knownSpecialty = (id) => (KNOWN.has(String(id)) ? String(id) : null);
58
58
 
59
+ const reachesComputer = (agent, specialty, computer, computers) => {
60
+ if (!computer) return true;
61
+ if (member(agent)?.runs === "machine")
62
+ return (computers[agent] ?? []).includes(computer);
63
+ return !TEAM.fileSpecialties.includes(specialty);
64
+ };
65
+
66
+ const eligibleHolders = (step, computer, computers, barred = []) => {
67
+ const candidates =
68
+ stepOf(step.id).together || step.pinned
69
+ ? step.agents
70
+ : [...new Set([...step.agents, ...(step.alternatives ?? [])])];
71
+ const eligible = candidates.filter(
72
+ (agent) =>
73
+ !barred.includes(agent) &&
74
+ reachesComputer(agent, step.specialty, computer, computers) &&
75
+ !(
76
+ step.id === "judge" &&
77
+ TEAM.fileSpecialties.includes(step.specialty) &&
78
+ !member(agent)?.review
79
+ )
80
+ );
81
+ return stepOf(step.id).together
82
+ ? step.agents.filter((agent) => eligible.includes(agent))
83
+ : eligible.slice(0, 1);
84
+ };
85
+
59
86
  /**
60
87
  * A route as the round proposed it, kept only where it names known steps and agents of the swarm, with the person's
61
88
  * choices over Jev's, step by step: an agent they tagged fills a step (Make, when Jev put it on none: "@codex fix this"
@@ -66,7 +93,14 @@ const knownSpecialty = (id) => (KNOWN.has(String(id)) ? String(id) : null);
66
93
  */
67
94
  export function validPlan(
68
95
  proposed,
69
- { members, named = [], pins = {}, piece = false }
96
+ {
97
+ members,
98
+ named = [],
99
+ pins = {},
100
+ piece = false,
101
+ computers = {},
102
+ computer = null,
103
+ }
70
104
  ) {
71
105
  const allowed = new Set(members);
72
106
  const rigor = RIGOR_LEVELS.includes(proposed?.rigor)
@@ -82,6 +116,14 @@ export function validPlan(
82
116
  step.id,
83
117
  {
84
118
  specialty: knownSpecialty(step.specialty),
119
+ machines: step.machines ?? {},
120
+ alternatives: [
121
+ ...new Set(
122
+ (Array.isArray(step.alternatives) ? step.alternatives : [])
123
+ .map(String)
124
+ .filter((agent) => allowed.has(agent))
125
+ ),
126
+ ].slice(0, 16),
85
127
  agents: [
86
128
  ...new Set(
87
129
  (step.agents ?? [])
@@ -95,8 +137,23 @@ export function validPlan(
95
137
  const tagged = named.filter((agent) => allowed.has(agent));
96
138
  const placedByJev = new Set([...given.values()].flatMap((s) => s.agents));
97
139
  const unplaced = tagged.filter((agent) => !placedByJev.has(agent));
140
+ let heldComputer = computer;
141
+ const framedByNames =
142
+ tagged.some(
143
+ (agent) =>
144
+ (given.get("make")?.agents ?? []).includes(agent) ||
145
+ unplaced.includes(agent)
146
+ ) &&
147
+ !(given.get("frame")?.agents ?? []).some((agent) => tagged.includes(agent));
148
+ const executing = split
149
+ ? ["frame"]
150
+ : stepsFor(rigor, {
151
+ makers: given.get("make")?.agents.length ?? 1,
152
+ framed: piece || framedByNames,
153
+ });
98
154
  const holders = {};
99
155
  const pinned = new Set();
156
+ let invalidAssignment = false;
100
157
  // Whom a step may not go to: a check or judgment never to a maker, a judgment never to the framer.
101
158
  const barred = (id) =>
102
159
  id === "check"
@@ -123,9 +180,57 @@ export function validPlan(
123
180
  : everyone
124
181
  ? agents
125
182
  : agents.slice(0, TEAM.mostSideBySide);
183
+ if (id === "make" && TEAM.fileSpecialties.includes(step.specialty))
184
+ agents = agents.filter((agent) => {
185
+ const capable = member(agent)?.runs === "machine";
186
+ if (!capable) invalidAssignment = true;
187
+ return capable;
188
+ });
189
+ agents = agents.filter((agent) => {
190
+ const machine = step.machines?.[agent];
191
+ const permitted =
192
+ !Object.hasOwn(step.machines ?? {}, agent) ||
193
+ (typeof machine === "string" &&
194
+ (computers[agent] ?? []).includes(machine));
195
+ if (!permitted) invalidAssignment = true;
196
+ return permitted;
197
+ });
198
+ if (heldComputer && executing.includes(id)) {
199
+ const placed = eligibleHolders(
200
+ { ...step, id, agents, pinned: pinned.has(id) },
201
+ heldComputer,
202
+ computers,
203
+ barred(id)
204
+ );
205
+ if (
206
+ placed.length !== agents.length ||
207
+ (!placed.length && TEAM.fileSpecialties.includes(step.specialty))
208
+ )
209
+ invalidAssignment = true;
210
+ agents = placed;
211
+ }
212
+ const machines = Object.fromEntries(
213
+ agents.flatMap((agent) =>
214
+ heldComputer && member(agent)?.runs === "machine"
215
+ ? [[agent, heldComputer]]
216
+ : step.machines?.[agent]
217
+ ? [[agent, step.machines[agent]]]
218
+ : []
219
+ )
220
+ );
221
+ if (!heldComputer && executing.includes(id))
222
+ heldComputer = Object.values(machines)[0] ?? null;
126
223
  holders[id] = agents;
127
- return { id, specialty: step.specialty, agents };
224
+ return {
225
+ id,
226
+ specialty: step.specialty,
227
+ agents,
228
+ ...(step.alternatives?.length ? { alternatives: step.alternatives } : {}),
229
+ ...(Object.keys(machines).length ? { machines } : {}),
230
+ };
128
231
  });
232
+ // A partial route must not dispatch the rejected agents from the round's original parts without their placement.
233
+ if (invalidAssignment) return null;
129
234
  const makers = holders.make;
130
235
  // A tagged maker means the person framed the work themselves, unless they also named who frames it.
131
236
  const framedByTag =
@@ -203,11 +308,58 @@ export function createTeam({ store, log = () => {} }) {
203
308
  return null;
204
309
  }
205
310
  };
206
- const write = (goalId, plan) => store.meta(key(goalId), JSON.stringify(plan));
311
+ const write = (goalId, plan) => {
312
+ store.meta(key(goalId), JSON.stringify(plan));
313
+ retireAsks(goalId, plan);
314
+ };
207
315
  const now = () => new Date().toISOString();
208
316
  const pieceOf = (current) => current.pieces[current.piece];
209
317
  const stepsOfNow = (current) => pieceOf(current)?.steps ?? [];
210
318
 
319
+ // A routed handoff that never started need not outlive the step that asked
320
+ // for it. Other jobs are independent work: their mere presence in this room
321
+ // is not permission to cancel them.
322
+ const retireAsks = (goalId, current) => {
323
+ const steps = stepsOfNow(current);
324
+ const at = steps.findIndex((step) => step.id === current.step);
325
+ if (at < 0 && current.step !== "done") return;
326
+ const laterPieces = current.pieces.slice(current.piece + 1);
327
+ if (
328
+ current.step !== "done" &&
329
+ laterPieces.some((piece) => !piece.steps.length)
330
+ )
331
+ return;
332
+ const remaining =
333
+ current.step === "done"
334
+ ? []
335
+ : [...steps.slice(at), ...laterPieces.flatMap((piece) => piece.steps)];
336
+ const needed = new Set(remaining.flatMap((step) => step.agents));
337
+ const history = current.history ?? [];
338
+ const held = new Set(history.flatMap((entry) => entry.agents));
339
+ for (const run of store.threadRuns(goalId)) {
340
+ if (run.kind !== "task" || run.status !== "open") continue;
341
+ if (run.created_at <= current.at || run.created_at >= current.stepAt)
342
+ continue;
343
+ const from = history.findLast(
344
+ (entry) =>
345
+ entry.at <= run.created_at && entry.agents.includes(run.origin_agent)
346
+ );
347
+ if (!from || needed.has(run.origin_agent) || needed.has(run.target_agent))
348
+ continue;
349
+ // Harness facilitates handoffs even when it holds no route step. An ask
350
+ // to an outside specialist is not a redundant route handoff.
351
+ if (run.target_agent !== "harness" && !held.has(run.target_agent))
352
+ continue;
353
+ const task = store.getTask(run.id);
354
+ if (!task?.context_refs.some((ref) => ref.kind === "ask")) continue;
355
+ const reason =
356
+ current.step === "done"
357
+ ? "the route finished"
358
+ : `the route moved past ${from.step} to ${current.step}`;
359
+ store.retireRouteAsk(goalId, task.id, task.version, reason);
360
+ }
361
+ };
362
+
211
363
  // Where each step began and who held it, so a run is marked with the step it worked.
212
364
  const started = (current, step, at = now()) => {
213
365
  const entry = stepsOfNow(current).find((s) => s.id === step);
@@ -246,6 +398,71 @@ export function createTeam({ store, log = () => {} }) {
246
398
  /** The thread's plan, or null when it has none (a thread from before routes, or one not yet triaged). */
247
399
  const plan = (goalId) => read(goalId);
248
400
 
401
+ /** The routed computer of an agent on the current step, revalidated when its wake is placed. */
402
+ const machineFor = (goalId, agent) => {
403
+ const current = read(goalId);
404
+ return current
405
+ ? (stepsOfNow(current).find((step) => step.id === current.step)
406
+ ?.machines?.[agent] ?? null)
407
+ : null;
408
+ };
409
+
410
+ /** Revalidate the current step against its checkout and retain Jev's ordered alternatives when availability changes. */
411
+ const place = (
412
+ goalId,
413
+ { computer = null, computers = {}, excluded = [] } = {}
414
+ ) => {
415
+ const current = read(goalId);
416
+ if (!current) return null;
417
+ const steps = stepsOfNow(current);
418
+ const step = steps.find((entry) => entry.id === current.step);
419
+ if (!step) return null;
420
+ const target = computer ?? Object.values(step.machines ?? {})[0] ?? null;
421
+ if (!target) return { ok: true, agents: step.agents, computer: null };
422
+ const makers = steps.find((entry) => entry.id === "make")?.agents ?? [];
423
+ const framers = steps.find((entry) => entry.id === "frame")?.agents ?? [];
424
+ const barred =
425
+ step.id === "check"
426
+ ? makers
427
+ : step.id === "judge"
428
+ ? [...makers, ...framers]
429
+ : [];
430
+ const agents = eligibleHolders(step, target, computers, [
431
+ ...barred,
432
+ ...excluded,
433
+ ]);
434
+ if (
435
+ !agents.length ||
436
+ (stepOf(step.id).together && agents.length !== step.agents.length)
437
+ )
438
+ return { ok: false, step: step.id, computer: target };
439
+ const machines = Object.fromEntries(
440
+ agents
441
+ .filter((agent) => member(agent)?.runs === "machine")
442
+ .map((agent) => [agent, target])
443
+ );
444
+ if (
445
+ JSON.stringify(agents) === JSON.stringify(step.agents) &&
446
+ JSON.stringify(machines) === JSON.stringify(step.machines ?? {})
447
+ )
448
+ return { ok: true, agents, computer: target };
449
+ const updatedStep = { ...step, agents, machines };
450
+ const pieces = current.pieces.map((piece, index) =>
451
+ index === current.piece
452
+ ? {
453
+ ...piece,
454
+ steps: steps.map((entry) =>
455
+ entry.id === step.id ? updatedStep : entry
456
+ ),
457
+ }
458
+ : piece
459
+ );
460
+ const updated = { ...current, pieces };
461
+ updated.history = started(updated, step.id, current.stepAt);
462
+ write(goalId, updated);
463
+ return { ok: true, agents, computer: target };
464
+ };
465
+
249
466
  /** The roles an agent holds in the thread's piece now. */
250
467
  const rolesOf = (goalId, agent) => {
251
468
  const current = read(goalId);
@@ -280,9 +497,24 @@ export function createTeam({ store, log = () => {} }) {
280
497
  const set = (
281
498
  goalId,
282
499
  proposed,
283
- { members, named = [], pins = {}, by, post, since = null }
500
+ {
501
+ members,
502
+ named = [],
503
+ pins = {},
504
+ computers = {},
505
+ computer = null,
506
+ by,
507
+ post,
508
+ since = null,
509
+ }
284
510
  ) => {
285
- const checked = validPlan(proposed, { members, named, pins });
511
+ const checked = validPlan(proposed, {
512
+ members,
513
+ named,
514
+ pins,
515
+ computers,
516
+ computer,
517
+ });
286
518
  if (!checked) {
287
519
  log(`route for ${goalId} not kept: ${JSON.stringify(proposed)}`);
288
520
  return null;
@@ -327,12 +559,28 @@ export function createTeam({ store, log = () => {} }) {
327
559
  const routePiece = (
328
560
  goalId,
329
561
  proposed,
330
- { members, named = [], pins = {}, outcome = null, head = null, post }
562
+ {
563
+ members,
564
+ named = [],
565
+ pins = {},
566
+ computers = {},
567
+ computer = null,
568
+ outcome = null,
569
+ head = null,
570
+ post,
571
+ }
331
572
  ) => {
332
573
  const current = read(goalId);
333
574
  const index = current ? current.piece + 1 : -1;
334
575
  if (!current || !current.pieces[index]) return null;
335
- const checked = validPlan(proposed, { members, named, pins, piece: true });
576
+ const checked = validPlan(proposed, {
577
+ members,
578
+ named,
579
+ pins,
580
+ computers,
581
+ computer,
582
+ piece: true,
583
+ });
336
584
  if (!checked) {
337
585
  log(`route for piece ${index + 1} of ${goalId} not kept`);
338
586
  return null;
@@ -393,7 +641,7 @@ export function createTeam({ store, log = () => {} }) {
393
641
  run.step === "make" &&
394
642
  !run.checked &&
395
643
  (run.reported_at ?? "") > pieceAt &&
396
- FINISHED.has(run.status)
644
+ run.status === "done"
397
645
  )
398
646
  store.setRunChecked(run.id, {
399
647
  outcome,
@@ -496,7 +744,9 @@ export function createTeam({ store, log = () => {} }) {
496
744
  });
497
745
  };
498
746
 
499
- // When every holder of a step reported after `since`: the last of their reports, else null.
747
+ // The first successful completion of each holder after `since` closes this step. A later
748
+ // turn by that same agent may be the check, so using its latest report would
749
+ // move the frame past the make and make finished work look outstanding.
500
750
  const reportedAll = (holders, runs, since) => {
501
751
  const last = holders.map(
502
752
  (agent) =>
@@ -504,12 +754,12 @@ export function createTeam({ store, log = () => {} }) {
504
754
  .filter(
505
755
  (run) =>
506
756
  run.target_agent === agent &&
507
- FINISHED.has(run.status) &&
757
+ run.status === "done" &&
508
758
  (run.reported_at ?? "") > since
509
759
  )
510
760
  .map((run) => run.reported_at)
511
761
  .sort()
512
- .at(-1) ?? null
762
+ .at(0) ?? null
513
763
  );
514
764
  return last.every(Boolean) ? last.sort().at(-1) : null;
515
765
  };
@@ -594,8 +844,11 @@ export function createTeam({ store, log = () => {} }) {
594
844
  const roundView = (goalId, runs, { head = null } = {}) => {
595
845
  const kept = read(goalId);
596
846
  if (!kept) return null;
597
- markRuns(kept, runs);
598
847
  let current = catchUp(goalId, kept, runs);
848
+ retireAsks(goalId, current);
849
+ // Catch-up adds the actual step intervals before receipts are labeled. The
850
+ // framer can return as checker before the coordinator gets a quiet round.
851
+ markRuns(current, runs);
599
852
  const steps = stepsOfNow(current);
600
853
  const piece = pieceOf(current);
601
854
  const base = {
@@ -608,11 +861,12 @@ export function createTeam({ store, log = () => {} }) {
608
861
  brief: piece.brief,
609
862
  }
610
863
  : null,
611
- steps: steps.map(({ id, specialty, role, agents }) => ({
864
+ steps: steps.map(({ id, specialty, role, agents, machines }) => ({
612
865
  id,
613
866
  specialty,
614
867
  role,
615
868
  agents,
869
+ ...(machines ? { machines } : {}),
616
870
  })),
617
871
  sendsBack: current.sendsBack,
618
872
  };
@@ -824,6 +1078,8 @@ export function createTeam({ store, log = () => {} }) {
824
1078
 
825
1079
  return {
826
1080
  plan,
1081
+ machineFor,
1082
+ place,
827
1083
  sendBack,
828
1084
  set,
829
1085
  routePiece,