teamshare-bridge 0.30.1 → 0.30.3

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.
Files changed (87) hide show
  1. package/README.md +10 -6
  2. package/dist/bridge/daemon-inbox.js +27 -0
  3. package/dist/bridge/daemon-inbox.js.map +1 -1
  4. package/dist/bridge/daemon.js +16 -0
  5. package/dist/bridge/daemon.js.map +1 -1
  6. package/dist/bridge/doctor.js +3 -2
  7. package/dist/bridge/doctor.js.map +1 -1
  8. package/dist/cli/commands/blog.js +6 -1
  9. package/dist/cli/commands/blog.js.map +1 -1
  10. package/dist/cli/commands/board.js +5 -1
  11. package/dist/cli/commands/board.js.map +1 -1
  12. package/dist/cli/commands/build.js +10 -2
  13. package/dist/cli/commands/build.js.map +1 -1
  14. package/dist/cli/commands/chat.js +1 -1
  15. package/dist/cli/commands/chat.js.map +1 -1
  16. package/dist/cli/commands/doc.js +5 -1
  17. package/dist/cli/commands/doc.js.map +1 -1
  18. package/dist/cli/commands/git.d.ts +1 -0
  19. package/dist/cli/commands/git.js +68 -0
  20. package/dist/cli/commands/git.js.map +1 -0
  21. package/dist/cli/commands/insight.js +6 -1
  22. package/dist/cli/commands/insight.js.map +1 -1
  23. package/dist/cli/commands/planner.js +1 -0
  24. package/dist/cli/commands/planner.js.map +1 -1
  25. package/dist/cli/commands/research.d.ts +8 -0
  26. package/dist/cli/commands/research.js +30 -3
  27. package/dist/cli/commands/research.js.map +1 -1
  28. package/dist/cli/commands/run.js +1 -0
  29. package/dist/cli/commands/run.js.map +1 -1
  30. package/dist/cli/commands/worker.js +9 -1
  31. package/dist/cli/commands/worker.js.map +1 -1
  32. package/dist/cli/commands/workflow-author.js +1 -1
  33. package/dist/cli/commands/workflow-author.js.map +1 -1
  34. package/dist/cli/commands/workflow.js +4 -0
  35. package/dist/cli/commands/workflow.js.map +1 -1
  36. package/dist/cli/index.js +7 -0
  37. package/dist/cli/index.js.map +1 -1
  38. package/dist/lib/api-agents.d.ts +84 -0
  39. package/dist/lib/api-agents.js +22 -0
  40. package/dist/lib/api-agents.js.map +1 -1
  41. package/dist/lib/api-types.d.ts +10 -0
  42. package/dist/lib/api.d.ts +14 -11
  43. package/dist/lib/api.js +12 -5
  44. package/dist/lib/api.js.map +1 -1
  45. package/dist/lib/brief.d.ts +6 -0
  46. package/dist/lib/brief.js +14 -0
  47. package/dist/lib/brief.js.map +1 -1
  48. package/dist/lib/chat/board-reply.js +15 -2
  49. package/dist/lib/chat/board-reply.js.map +1 -1
  50. package/dist/lib/chat/chat-reply.d.ts +7 -1
  51. package/dist/lib/chat/chat-reply.js +21 -2
  52. package/dist/lib/chat/chat-reply.js.map +1 -1
  53. package/dist/lib/chat/doc-reply.js +16 -2
  54. package/dist/lib/chat/doc-reply.js.map +1 -1
  55. package/dist/lib/coord/format.d.ts +143 -0
  56. package/dist/lib/coord/format.js +398 -0
  57. package/dist/lib/coord/format.js.map +1 -0
  58. package/dist/lib/coord/guidance.d.ts +21 -0
  59. package/dist/lib/coord/guidance.js +110 -0
  60. package/dist/lib/coord/guidance.js.map +1 -0
  61. package/dist/lib/coord/index.d.ts +12 -0
  62. package/dist/lib/coord/index.js +38 -0
  63. package/dist/lib/coord/index.js.map +1 -0
  64. package/dist/lib/coord/monitor.d.ts +180 -0
  65. package/dist/lib/coord/monitor.js +746 -0
  66. package/dist/lib/coord/monitor.js.map +1 -0
  67. package/dist/lib/coord/paths.d.ts +20 -0
  68. package/dist/lib/coord/paths.js +76 -0
  69. package/dist/lib/coord/paths.js.map +1 -0
  70. package/dist/lib/coord/store.d.ts +13 -0
  71. package/dist/lib/coord/store.js +104 -0
  72. package/dist/lib/coord/store.js.map +1 -0
  73. package/dist/lib/git/git-naming.js +4 -0
  74. package/dist/lib/git/git-naming.js.map +1 -1
  75. package/dist/lib/git/git-pull.d.ts +35 -0
  76. package/dist/lib/git/git-pull.js +233 -0
  77. package/dist/lib/git/git-pull.js.map +1 -0
  78. package/dist/lib/harness/harness-adapter.js +7 -0
  79. package/dist/lib/harness/harness-adapter.js.map +1 -1
  80. package/dist/lib/lock.d.ts +8 -0
  81. package/dist/lib/lock.js.map +1 -1
  82. package/dist/lib/scope-guard.js +9 -1
  83. package/dist/lib/scope-guard.js.map +1 -1
  84. package/dist/lib/workspace/stop-marker.d.ts +52 -0
  85. package/dist/lib/workspace/stop-marker.js +92 -0
  86. package/dist/lib/workspace/stop-marker.js.map +1 -0
  87. package/package.json +1 -1
@@ -0,0 +1,398 @@
1
+ "use strict";
2
+ /**
3
+ * The shared working format (2026-11-21).
4
+ *
5
+ * ONE small text file per agent per project, written by the agent at
6
+ * checkpoints. Deliberately NOT JSON: a model hand-writing JSON gets it wrong
7
+ * often enough to lose a status, and a tolerant `key: value` parse can never
8
+ * throw away a note it did not understand.
9
+ *
10
+ * status: working # starting | working | blocked | waiting | done
11
+ * summary: Wiring the webhook retry path
12
+ * areas: src/common/mail, src/modules/billing
13
+ * to: 8f3c1d2e # optional - a colleague who must read the note
14
+ * ---
15
+ * ## Notes
16
+ * Free text. `to:` turns this into a peer note delivered to that agent's inbox.
17
+ *
18
+ * Everything here is PURE so the parser, the renderer and the overlap check can
19
+ * be unit-tested without a filesystem.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.STATUS_ALIASES = exports.MEMBER_STATUSES = void 0;
23
+ exports.parseStatusFile = parseStatusFile;
24
+ exports.renderStatusTemplate = renderStatusTemplate;
25
+ exports.areasOverlap = areasOverlap;
26
+ exports.findOverlaps = findOverlaps;
27
+ exports.renderWorkboard = renderWorkboard;
28
+ exports.MEMBER_STATUSES = [
29
+ 'starting',
30
+ 'working',
31
+ 'blocked',
32
+ 'waiting',
33
+ 'done',
34
+ 'lost',
35
+ ];
36
+ exports.STATUS_ALIASES = {
37
+ start: 'starting',
38
+ started: 'starting',
39
+ starting: 'starting',
40
+ work: 'working',
41
+ working: 'working',
42
+ busy: 'working',
43
+ 'in progress': 'working',
44
+ inprogress: 'working',
45
+ progress: 'working',
46
+ blocked: 'blocked',
47
+ stuck: 'blocked',
48
+ error: 'blocked',
49
+ failed: 'blocked',
50
+ waiting: 'waiting',
51
+ idle: 'waiting',
52
+ paused: 'waiting',
53
+ done: 'done',
54
+ complete: 'done',
55
+ completed: 'done',
56
+ finished: 'done',
57
+ resolved: 'done',
58
+ };
59
+ const HEADER_KEYS = new Set([
60
+ 'status',
61
+ 'summary',
62
+ 'areas',
63
+ 'area',
64
+ 'files',
65
+ 'to',
66
+ 'notify',
67
+ 'agent',
68
+ 'agents',
69
+ ]);
70
+ const clamp = (value, max) => value.length > max ? `${value.slice(0, max - 1)}…` : value;
71
+ /** Strips markdown noise a model adds around a value. */
72
+ function cleanValue(value) {
73
+ return value
74
+ .replace(/\*\*/g, '')
75
+ .replace(/`/g, '')
76
+ .replace(/^["'*_\s]+/, '')
77
+ .replace(/["'*_\s]+$/, '')
78
+ .replace(/^[-*+]\s+/, '')
79
+ .trim();
80
+ }
81
+ function splitList(value, max) {
82
+ const out = [];
83
+ for (const part of value.split(/[,;\n]/)) {
84
+ const item = cleanValue(part);
85
+ if (!item)
86
+ continue;
87
+ if (out.includes(item))
88
+ continue;
89
+ out.push(clamp(item, 300));
90
+ if (out.length >= max)
91
+ break;
92
+ }
93
+ return out;
94
+ }
95
+ /**
96
+ * A `status:` value may carry a trailing example comment
97
+ * (`working # starting | working | blocked`). Only the status field is
98
+ * cleaned this way - a summary may legitimately contain `#`.
99
+ */
100
+ function statusToken(value) {
101
+ return cleanValue(value)
102
+ .replace(/\s*#.*$/, '')
103
+ .trim();
104
+ }
105
+ /** True when the whole value is still the template's `<...>` placeholder. */
106
+ function isPlaceholder(value) {
107
+ return /^<[^>]*>$/.test(value.trim());
108
+ }
109
+ /** Parses the lines before a divider into fields, keeping junk as notes. */
110
+ function parseHeader(headerLines) {
111
+ let status = 'working';
112
+ let statusReported = false;
113
+ let summary = '';
114
+ let areas = [];
115
+ let to = [];
116
+ const loose = [];
117
+ for (const line of headerLines) {
118
+ const trimmed = line.trim();
119
+ if (!trimmed)
120
+ continue;
121
+ // A title or any markdown heading is decoration, never a field.
122
+ if (/^#{1,6}\s/.test(trimmed))
123
+ continue;
124
+ const match = /^[-*+\s]*([A-Za-z][A-Za-z _-]{0,20}):\s*(.*)$/.exec(trimmed);
125
+ if (!match) {
126
+ loose.push(trimmed);
127
+ continue;
128
+ }
129
+ const key = match[1]
130
+ .trim()
131
+ .toLowerCase()
132
+ .replace(/[ _-]+/g, ' ');
133
+ const value = match[2] ?? '';
134
+ if (!HEADER_KEYS.has(key)) {
135
+ loose.push(trimmed);
136
+ continue;
137
+ }
138
+ const clean = cleanValue(value);
139
+ const placeholder = isPlaceholder(clean);
140
+ if (key === 'status') {
141
+ const token = statusToken(value);
142
+ if (token) {
143
+ const mapped = exports.STATUS_ALIASES[token.toLowerCase()];
144
+ if (mapped) {
145
+ status = mapped;
146
+ statusReported = true;
147
+ }
148
+ else {
149
+ loose.push(`status: ${token}`);
150
+ }
151
+ }
152
+ }
153
+ else if (key === 'summary') {
154
+ if (!placeholder)
155
+ summary = clean;
156
+ }
157
+ else if (key === 'areas' || key === 'area' || key === 'files') {
158
+ if (!placeholder)
159
+ areas = splitList(value, 25);
160
+ }
161
+ else if (!placeholder) {
162
+ // `to` / `notify` / `agent` / `agents`
163
+ to = splitList(value.replace(/\s+/g, ','), 5);
164
+ }
165
+ }
166
+ return { status, statusReported, summary, areas, to, loose };
167
+ }
168
+ /**
169
+ * Parses a status file. NEVER throws: an unparseable line becomes part of the
170
+ * notes, because losing an agent's message is worse than losing its shape.
171
+ *
172
+ * TOLERANT OF YAML FRONT MATTER ON PURPOSE. Models habitually write
173
+ *
174
+ * ---
175
+ * status: done
176
+ * summary: ...
177
+ * ---
178
+ * notes
179
+ *
180
+ * and the old split-at-the-first-`---` rule made that header EMPTY: the status
181
+ * fell back to `working`, the summary disappeared ("no status written yet") and
182
+ * the whole block was posted to the shared log as a note. A leading fence is
183
+ * therefore an opener, and the divider is the first one that actually yields a
184
+ * header with at least one recognised field.
185
+ */
186
+ function parseStatusFile(raw, opts = {}) {
187
+ const maxSummary = opts.maxSummary ?? 400;
188
+ const maxNotes = opts.maxNotes ?? 2000;
189
+ const text = raw
190
+ .replace(/\r\n/g, '\n')
191
+ .replace(/^\uFEFF/, '')
192
+ // The starter template is mostly an HTML comment explaining the format.
193
+ // It is INSTRUCTION, not a note: rendering it as one made every freshly
194
+ // registered agent post the template to the shared log.
195
+ .replace(/<!--[\s\S]*?-->/g, '');
196
+ const lines = text.split('\n');
197
+ // Skip leading blank lines, then a single opening `---` (front matter).
198
+ let start = 0;
199
+ while (start < lines.length && !lines[start].trim())
200
+ start += 1;
201
+ if (lines[start]?.trim() === '---')
202
+ start += 1;
203
+ const candidates = [];
204
+ for (let i = start; i < lines.length; i += 1) {
205
+ const trimmed = lines[i].trim();
206
+ if (trimmed === '---' || /^#{1,6}\s/.test(trimmed))
207
+ candidates.push(i);
208
+ }
209
+ let splitAt = lines.length;
210
+ let parsed = null;
211
+ for (const index of candidates) {
212
+ const attempt = parseHeader(lines.slice(start, index));
213
+ if (attempt.statusReported ||
214
+ attempt.summary ||
215
+ attempt.areas.length > 0 ||
216
+ attempt.to.length > 0) {
217
+ splitAt = index;
218
+ parsed = attempt;
219
+ break;
220
+ }
221
+ }
222
+ // No usable divider: everything after the opener is a header candidate and
223
+ // anything unrecognised falls through to the notes (the original fallback).
224
+ if (!parsed)
225
+ parsed = parseHeader(lines.slice(start));
226
+ const bodyLines = splitAt < lines.length ? lines.slice(splitAt + 1) : [];
227
+ const noteText = [...parsed.loose, ...bodyLines].join('\n').trim();
228
+ return {
229
+ status: parsed.status,
230
+ statusReported: parsed.statusReported,
231
+ summary: clamp(parsed.summary, maxSummary),
232
+ areas: parsed.areas,
233
+ to: parsed.to,
234
+ notes: clamp(noteText, maxNotes),
235
+ blank: !parsed.summary &&
236
+ !noteText &&
237
+ parsed.areas.length === 0 &&
238
+ parsed.to.length === 0,
239
+ };
240
+ }
241
+ /**
242
+ * The status file the bridge SEEDS at the start of a run.
243
+ *
244
+ * It starts as `working` on purpose: a live session lock already proves the
245
+ * agent is running, and the old `starting` value sat on the board for the whole
246
+ * run whenever the agent forgot to write. The summary carries the run's subject
247
+ * so the human sees WHAT is running even before the first checkpoint.
248
+ */
249
+ function renderStatusTemplate(input) {
250
+ const summary = (input.label || input.taskTitle || '')
251
+ .replace(/\s+/g, ' ')
252
+ .trim();
253
+ return [
254
+ 'status: working',
255
+ `summary: ${clamp(summary, 400)}`,
256
+ 'areas:',
257
+ 'to:',
258
+ '---',
259
+ '<!-- TeamShare workboard. The bridge seeded this file for the current run.',
260
+ ' Overwrite the lines above at every checkpoint:',
261
+ ' status: starting | working | blocked | waiting | done',
262
+ ' summary: one line, what you are doing RIGHT NOW',
263
+ ' areas: repo-relative paths you are touching, comma separated',
264
+ ' to: <agentId> only when a specific colleague must read the note below',
265
+ ' Keep the first line a `status:` line - do not start this file with `---`.',
266
+ ' This file is machine-local and never leaves this PC.',
267
+ ' Peer notes addressed to you: ' + input.inboxFile,
268
+ ' The merged board: ' + input.workboardFile,
269
+ '-->',
270
+ '',
271
+ ].join('\n');
272
+ }
273
+ /**
274
+ * Path-aware overlap check: `src/modules/billing` and
275
+ * `src/modules/billing/invoices.ts` overlap, `src/modules/bill` and
276
+ * `src/modules/billing` do not.
277
+ */
278
+ function areasOverlap(a, b) {
279
+ const norm = (value) => value
280
+ .replace(/\\/g, '/')
281
+ .replace(/^\.\//, '')
282
+ .replace(/\/+$/, '')
283
+ .toLowerCase();
284
+ const left = norm(a);
285
+ const right = norm(b);
286
+ if (!left || !right)
287
+ return false;
288
+ return (left === right ||
289
+ left.startsWith(`${right}/`) ||
290
+ right.startsWith(`${left}/`));
291
+ }
292
+ /** Every pair of members whose declared areas overlap. */
293
+ function findOverlaps(members) {
294
+ const pairs = [];
295
+ for (let i = 0; i < members.length; i += 1) {
296
+ for (let j = i + 1; j < members.length; j += 1) {
297
+ const left = members[i];
298
+ const right = members[j];
299
+ for (const a of left.areas) {
300
+ for (const b of right.areas) {
301
+ if (!areasOverlap(a, b))
302
+ continue;
303
+ pairs.push({
304
+ area: a,
305
+ otherArea: b,
306
+ a: left.agentName,
307
+ b: right.agentName,
308
+ });
309
+ }
310
+ }
311
+ }
312
+ }
313
+ return pairs;
314
+ }
315
+ function elapsed(startedAt, now) {
316
+ const start = Date.parse(startedAt);
317
+ if (!Number.isFinite(start))
318
+ return '';
319
+ const mins = Math.max(0, Math.round((now - start) / 60_000));
320
+ if (mins < 1)
321
+ return 'just now';
322
+ if (mins < 60)
323
+ return `${mins}m`;
324
+ const hours = Math.floor(mins / 60);
325
+ return `${hours}h${String(mins % 60).padStart(2, '0')}m`;
326
+ }
327
+ /**
328
+ * The merged human/agent-readable board. Kept small on purpose: this is what an
329
+ * agent reads instead of calling the cloud, so the whole file must be cheap to
330
+ * put in a prompt tail.
331
+ */
332
+ function renderWorkboard(input) {
333
+ const now = input.now ?? Date.now();
334
+ const live = input.members.filter((m) => !m.endedAt);
335
+ const lines = [];
336
+ lines.push(`# Workboard — ${input.projectName || input.projectId}`);
337
+ lines.push('');
338
+ lines.push(`_${live.length} agent${live.length === 1 ? '' : 's'} working · updated ${new Date(now)
339
+ .toISOString()
340
+ .slice(11, 19)}Z · machine-local_`);
341
+ lines.push('');
342
+ if (live.length === 0) {
343
+ lines.push('No agent is working in this project right now.');
344
+ lines.push('');
345
+ }
346
+ else {
347
+ lines.push('## Working now');
348
+ lines.push('');
349
+ for (const member of live) {
350
+ const bits = [
351
+ `**${member.agentName}** (\`${member.agentId.slice(0, 8)}\`)`,
352
+ member.status === 'working' ? '' : `(${member.status})`,
353
+ member.derived?.taskTitle ? `— ${member.derived.taskTitle}` : '',
354
+ member.mode && member.mode !== 'task' ? `[\`${member.mode}\`]` : '',
355
+ ].filter(Boolean);
356
+ lines.push(`- ${bits.join(' ')} · ${elapsed(member.startedAt, now)}`);
357
+ if (member.summary)
358
+ lines.push(` - ${member.summary}`);
359
+ if (member.areas.length > 0) {
360
+ lines.push(` - areas: ${member.areas.join(', ')}`);
361
+ }
362
+ if (member.derived?.branch) {
363
+ lines.push(` - branch: \`${member.derived.branch}\``);
364
+ }
365
+ if (member.remote)
366
+ lines.push(' - (another machine)');
367
+ }
368
+ lines.push('');
369
+ }
370
+ const overlaps = findOverlaps(live);
371
+ if (overlaps.length > 0) {
372
+ lines.push('## Coordination warnings');
373
+ lines.push('');
374
+ const seen = new Set();
375
+ for (const pair of overlaps) {
376
+ const key = [pair.a, pair.b].sort().join('|');
377
+ if (seen.has(key))
378
+ continue;
379
+ seen.add(key);
380
+ lines.push(`- **${pair.a}** and **${pair.b}** are both touching \`${pair.area}\` — agree who owns it before you both write.`);
381
+ }
382
+ lines.push('');
383
+ }
384
+ if (input.notes.length > 0) {
385
+ lines.push('## Log');
386
+ lines.push('');
387
+ for (const note of input.notes.slice(-25)) {
388
+ const to = note.to ? ` → **${note.to}**` : '';
389
+ const urgent = note.urgent ? ' **(urgent)**' : '';
390
+ lines.push(`- ${note.at.slice(11, 16)}Z **${note.author}**${to}${urgent} [${note.kind}]: ${note.body
391
+ .replace(/\s+/g, ' ')
392
+ .trim()}`);
393
+ }
394
+ lines.push('');
395
+ }
396
+ return `${lines.join('\n').trim()}\n`;
397
+ }
398
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/lib/coord/format.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AA4LH,0CA4DC;AAuBD,oDAuBC;AAOD,oCAeC;AAUD,oCAsBC;AAmDD,0CA8EC;AA3dY,QAAA,eAAe,GAAG;IAC7B,UAAU;IACV,SAAS;IACT,SAAS;IACT,SAAS;IACT,MAAM;IACN,MAAM;CACE,CAAC;AAGE,QAAA,cAAc,GAAiC;IAC1D,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,S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AAC,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;YAC1C,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;YAClD,KAAK,CAAC,IAAI,CACR,KAAK,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,IAAI,CAAC,MAAM,KAAK,EAAE,GAAG,MAAM,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI;iBACtF,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;iBACpB,IAAI,EAAE,EAAE,CACZ,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC;AACxC,CAAC"}
@@ -0,0 +1,21 @@
1
+ export interface CoordinationPromptInput {
2
+ agentId: string;
3
+ projectId: string;
4
+ agentName?: string | null;
5
+ taskTitle?: string | null;
6
+ /** True when an URGENT note is already waiting in the inbox. */
7
+ urgentPending?: boolean;
8
+ /** Short form for chatter lanes (chat / doc / board replies). */
9
+ light?: boolean;
10
+ }
11
+ /**
12
+ * Is there an URGENT note waiting for this agent? Read straight from the local
13
+ * inbox: no cursor is kept, so "pending" means "urgent and recent" - enough for
14
+ * a prompt hint, and it can never fail a run.
15
+ */
16
+ export declare function pendingCoordinationNotes(projectId: string, agentId: string): boolean;
17
+ /**
18
+ * The workboard section for a run prompt. Returns '' when there is no agent id
19
+ * or project id - a made-up path is worse than no section at all.
20
+ */
21
+ export declare function coordinationBlock(input: CoordinationPromptInput): string;
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pendingCoordinationNotes = pendingCoordinationNotes;
4
+ exports.coordinationBlock = coordinationBlock;
5
+ /**
6
+ * The prompt side of the shared workboard (2026-11-21).
7
+ *
8
+ * A mechanism nobody is told about is a mechanism nobody uses, and this one has
9
+ * a reliability problem the design has to answer honestly: the bridge cannot
10
+ * interrupt a harness mid-turn to say "a colleague left you a note". So the
11
+ * CHECKPOINT DISCIPLINE has to reach every harness through the only channel
12
+ * that always works - the prompt - and the bridge nudges a live agent only for
13
+ * an URGENT note.
14
+ *
15
+ * This block is injected into the task brief and into every conversational lane
16
+ * (chat / document / board / tool), and it names the exact absolute paths, so
17
+ * no agent has to infer anything.
18
+ */
19
+ const paths_1 = require("./paths");
20
+ const store_1 = require("./store");
21
+ /**
22
+ * Is there an URGENT note waiting for this agent? Read straight from the local
23
+ * inbox: no cursor is kept, so "pending" means "urgent and recent" - enough for
24
+ * a prompt hint, and it can never fail a run.
25
+ */
26
+ function pendingCoordinationNotes(projectId, agentId) {
27
+ if (!projectId || !agentId)
28
+ return false;
29
+ try {
30
+ const entries = (0, store_1.readNdjson)((0, paths_1.coordPaths)(projectId, agentId).inboxFile);
31
+ const cutoff = Date.now() - 30 * 60_000;
32
+ return entries
33
+ .slice(-20)
34
+ .some((entry) => entry.urgent === true &&
35
+ Number.isFinite(Date.parse(entry.at ?? '')) &&
36
+ Date.parse(entry.at ?? '') > cutoff);
37
+ }
38
+ catch {
39
+ return false;
40
+ }
41
+ }
42
+ /**
43
+ * The workboard section for a run prompt. Returns '' when there is no agent id
44
+ * or project id - a made-up path is worse than no section at all.
45
+ */
46
+ function coordinationBlock(input) {
47
+ if (!input.agentId || !input.projectId)
48
+ return '';
49
+ const paths = (0, paths_1.coordPaths)(input.projectId, input.agentId);
50
+ const title = input.taskTitle?.replace(/\s+/g, ' ').trim();
51
+ const lines = [];
52
+ lines.push('## Project workboard (other agents are in this project)');
53
+ lines.push('');
54
+ lines.push('You are not alone in this project. Other agents may be working on other ' +
55
+ 'tasks at the same time, on this PC and on others. They coordinate through ' +
56
+ 'a machine-local folder - it is not a chat, and it is not a way to hand ' +
57
+ 'work over.');
58
+ lines.push('');
59
+ lines.push(`- **Your status file:** \`${paths.statusFile}\` (you own it - overwrite it)`);
60
+ lines.push(`- **Your inbox:** \`${paths.inboxFile}\` (notes a colleague addressed to you)`);
61
+ lines.push(`- **Merged board:** \`${paths.workboardFile}\` (everyone working here)`);
62
+ lines.push('');
63
+ if (input.urgentPending) {
64
+ lines.push('**There is an URGENT note in your inbox right now - read it before your next action.**');
65
+ lines.push('');
66
+ }
67
+ lines.push('**At every checkpoint** - when you start, after each completed step, and ' +
68
+ 'before you write your summary:');
69
+ lines.push('');
70
+ lines.push('1. Read your inbox (if the file exists) and the merged board. A note marked ' +
71
+ '**(urgent)**, or one addressed to you, is handled BEFORE your next action: ' +
72
+ 'change your plan, answer it in your notes, or say plainly that it is not yours.');
73
+ lines.push('2. Overwrite your status file with this shape. The bridge has already ' +
74
+ "seeded it with this run's subject, so you are updating, never starting " +
75
+ 'from nothing; if the file is missing, create it. Keep the `---` between ' +
76
+ 'the header and your note, and keep `status:` as the FIRST line (do not ' +
77
+ 'open the file with `---`).');
78
+ lines.push('');
79
+ lines.push('```');
80
+ lines.push('status: working');
81
+ lines.push(`summary: ${title ? title : '<one line: what you are doing right now>'}`);
82
+ lines.push('areas: <repo-relative paths you are touching, comma separated>');
83
+ lines.push('to: <agent id - ONLY when a specific colleague must read your note>');
84
+ lines.push('---');
85
+ lines.push('<free text: what you found, what you need, what you changed>');
86
+ lines.push('```');
87
+ lines.push('');
88
+ lines.push('Status values are `starting`, `working`, `blocked`, `waiting` and `done`. ' +
89
+ 'Write a real `summary` - it is the one line the human sees on the ' +
90
+ 'workboard while you work.');
91
+ lines.push('');
92
+ lines.push('Rules:');
93
+ lines.push('');
94
+ lines.push('- **Coordination is not delegation.** You cannot assign work to another ' +
95
+ 'agent, and a note never starts a run. If a request is not yours, write ' +
96
+ 'that in your notes.');
97
+ lines.push('- Write your **areas** honestly. Two agents touching the same paths are ' +
98
+ 'warned on the board, and that warning is the point.');
99
+ lines.push('- Keep `summary` to one line. Every agent reads this board at every checkpoint.');
100
+ lines.push('- The file is machine-local and never uploaded. Never put a secret, key or ' +
101
+ 'credential in it.');
102
+ lines.push('');
103
+ if (input.light) {
104
+ // Chatter lanes have no task to report; the file is still expected.
105
+ lines.push('A chat/document/board reply has no task: use `status: working` and a one-line `summary`.');
106
+ lines.push('');
107
+ }
108
+ return lines.join('\n');
109
+ }
110
+ //# sourceMappingURL=guidance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guidance.js","sourceRoot":"","sources":["../../../src/lib/coord/guidance.ts"],"names":[],"mappings":";;AAiCA,4DAqBC;AAMD,8CA+FC;AA3JD;;;;;;;;;;;;;GAaG;AACH,mCAAqC;AACrC,mCAAqC;AAarC;;;;GAIG;AACH,SAAgB,wBAAwB,CACtC,SAAiB,EACjB,OAAe;IAEf,IAAI,CAAC,SAAS,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IACzC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAA,kBAAU,EACxB,IAAA,kBAAU,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CACzC,CAAC;QACF,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;QACxC,OAAO,OAAO;aACX,KAAK,CAAC,CAAC,EAAE,CAAC;aACV,IAAI,CACH,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,MAAM,KAAK,IAAI;YACrB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK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F,KAAK,CAAC,IAAI,CACR,iFAAiF,CAClF,CAAC;IACF,KAAK,CAAC,IAAI,CACR,6EAA6E;QAC3E,mBAAmB,CACtB,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,oEAAoE;QACpE,KAAK,CAAC,IAAI,CACR,0FAA0F,CAC3F,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Machine-local agent coordination (2026-11-21).
3
+ *
4
+ * The board is LOCAL and LIVE; the hub is a throttled projection. Agents read
5
+ * and write files next to the daemon, so coordination costs no cloud traffic
6
+ * and works while offline. `workboard.md` is the merged view.
7
+ */
8
+ export * from './paths';
9
+ export * from './format';
10
+ export * from './guidance';
11
+ export * from './monitor';
12
+ export { appendNdjson, readJson, readNdjson, readText, writeJsonAtomic, writeNdjson, writeTextAtomic, writeTextIfChanged, } from './store';
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.writeTextIfChanged = exports.writeTextAtomic = exports.writeNdjson = exports.writeJsonAtomic = exports.readText = exports.readNdjson = exports.readJson = exports.appendNdjson = void 0;
18
+ /**
19
+ * Machine-local agent coordination (2026-11-21).
20
+ *
21
+ * The board is LOCAL and LIVE; the hub is a throttled projection. Agents read
22
+ * and write files next to the daemon, so coordination costs no cloud traffic
23
+ * and works while offline. `workboard.md` is the merged view.
24
+ */
25
+ __exportStar(require("./paths"), exports);
26
+ __exportStar(require("./format"), exports);
27
+ __exportStar(require("./guidance"), exports);
28
+ __exportStar(require("./monitor"), exports);
29
+ var store_1 = require("./store");
30
+ Object.defineProperty(exports, "appendNdjson", { enumerable: true, get: function () { return store_1.appendNdjson; } });
31
+ Object.defineProperty(exports, "readJson", { enumerable: true, get: function () { return store_1.readJson; } });
32
+ Object.defineProperty(exports, "readNdjson", { enumerable: true, get: function () { return store_1.readNdjson; } });
33
+ Object.defineProperty(exports, "readText", { enumerable: true, get: function () { return store_1.readText; } });
34
+ Object.defineProperty(exports, "writeJsonAtomic", { enumerable: true, get: function () { return store_1.writeJsonAtomic; } });
35
+ Object.defineProperty(exports, "writeNdjson", { enumerable: true, get: function () { return store_1.writeNdjson; } });
36
+ Object.defineProperty(exports, "writeTextAtomic", { enumerable: true, get: function () { return store_1.writeTextAtomic; } });
37
+ Object.defineProperty(exports, "writeTextIfChanged", { enumerable: true, get: function () { return store_1.writeTextIfChanged; } });
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/coord/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,0CAAwB;AACxB,2CAAyB;AACzB,6CAA2B;AAC3B,4CAA0B;AAC1B,iCASiB;AARf,qGAAA,YAAY,OAAA;AACZ,iGAAA,QAAQ,OAAA;AACR,mGAAA,UAAU,OAAA;AACV,iGAAA,QAAQ,OAAA;AACR,wGAAA,eAAe,OAAA;AACf,oGAAA,WAAW,OAAA;AACX,wGAAA,eAAe,OAAA;AACf,2GAAA,kBAAkB,OAAA"}