@eve/board 0.0.0-stage → 0.1.0

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 (65) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +101 -0
  3. package/README.md +37 -2
  4. package/dist/extension/_manifest.json +6 -0
  5. package/dist/extension/channels/board.d.ts +2 -0
  6. package/dist/extension/channels/board.mjs +9 -0
  7. package/dist/extension/extension.d.ts +29 -0
  8. package/dist/extension/extension.mjs +19 -0
  9. package/dist/extension/instructions.md +9 -0
  10. package/dist/extension/lib/board-channel.d.ts +91 -0
  11. package/dist/extension/lib/board-channel.mjs +478 -0
  12. package/dist/extension/lib/channel.d.ts +11 -0
  13. package/dist/extension/lib/channel.mjs +12 -0
  14. package/dist/extension/lib/client.d.ts +253 -0
  15. package/dist/extension/lib/client.mjs +350 -0
  16. package/dist/extension/lib/inbound.d.ts +19 -0
  17. package/dist/extension/lib/inbound.mjs +93 -0
  18. package/dist/extension/lib/tools.d.ts +504 -0
  19. package/dist/extension/lib/tools.mjs +457 -0
  20. package/dist/extension/lib/watches.d.ts +89 -0
  21. package/dist/extension/lib/watches.mjs +310 -0
  22. package/dist/extension/skills/collaborate/SKILL.md +54 -0
  23. package/dist/extension/tools/actors.d.ts +9 -0
  24. package/dist/extension/tools/actors.mjs +10 -0
  25. package/dist/extension/tools/block_task.d.ts +3 -0
  26. package/dist/extension/tools/block_task.mjs +10 -0
  27. package/dist/extension/tools/cancel_schedule.d.ts +7 -0
  28. package/dist/extension/tools/cancel_schedule.mjs +10 -0
  29. package/dist/extension/tools/channels.d.ts +5 -0
  30. package/dist/extension/tools/channels.mjs +10 -0
  31. package/dist/extension/tools/complete_task.d.ts +3 -0
  32. package/dist/extension/tools/complete_task.mjs +10 -0
  33. package/dist/extension/tools/create_task.d.ts +27 -0
  34. package/dist/extension/tools/create_task.mjs +10 -0
  35. package/dist/extension/tools/fail_task.d.ts +3 -0
  36. package/dist/extension/tools/fail_task.mjs +10 -0
  37. package/dist/extension/tools/label.d.ts +10 -0
  38. package/dist/extension/tools/label.mjs +10 -0
  39. package/dist/extension/tools/no_reply.d.ts +1 -0
  40. package/dist/extension/tools/no_reply.mjs +7 -0
  41. package/dist/extension/tools/note.d.ts +25 -0
  42. package/dist/extension/tools/note.mjs +10 -0
  43. package/dist/extension/tools/post.d.ts +55 -0
  44. package/dist/extension/tools/post.mjs +10 -0
  45. package/dist/extension/tools/react.d.ts +17 -0
  46. package/dist/extension/tools/react.mjs +10 -0
  47. package/dist/extension/tools/read.d.ts +187 -0
  48. package/dist/extension/tools/read.mjs +10 -0
  49. package/dist/extension/tools/reply.d.ts +55 -0
  50. package/dist/extension/tools/reply.mjs +10 -0
  51. package/dist/extension/tools/schedule.d.ts +16 -0
  52. package/dist/extension/tools/schedule.mjs +10 -0
  53. package/dist/extension/tools/schedules.d.ts +8 -0
  54. package/dist/extension/tools/schedules.mjs +10 -0
  55. package/dist/extension/tools/unwatch.d.ts +8 -0
  56. package/dist/extension/tools/unwatch.mjs +10 -0
  57. package/dist/extension/tools/watch.d.ts +18 -0
  58. package/dist/extension/tools/watch.mjs +10 -0
  59. package/dist/extension/tools/watches.d.ts +7 -0
  60. package/dist/extension/tools/watches.mjs +10 -0
  61. package/dist/index.d.ts +4 -0
  62. package/dist/index.mjs +7 -0
  63. package/dist/tools/index.d.ts +21 -0
  64. package/dist/tools/index.mjs +26 -0
  65. package/package.json +70 -3
@@ -0,0 +1,478 @@
1
+ import { fileURLToPath as __eveFileURLToPath } from "node:url";
2
+ import { dirname as __eveDirname } from "node:path";
3
+ import { createRequire as __eveCreateRequire } from "node:module";
4
+ const __filename = __eveFileURLToPath(import.meta.url);
5
+ __eveDirname(__filename);
6
+ __eveCreateRequire(import.meta.url);
7
+ import { BOARD_TEXT_LIMIT, boardAllows, boardErrorCode, boardPostId } from "./client.mjs";
8
+ import { boardMessageContent, boardSessionAddress, boardThreadId, defaultBoardAuth, fetchBoardAttachment, formatBoardContext, formatTaskContext, formatTaskFollowUpContext, formatWatchContext } from "./inbound.mjs";
9
+ import { BOARD_WAKE_ROUTE, BoardWatchConfigError, boardClients, checkQueueScope, coversChannel, findWatchRecord } from "./watches.mjs";
10
+ import { POST, SessionStrandedError, defineChannel } from "eve/channels";
11
+ import { call } from "eve/events";
12
+ import { createLogger, postedIn, renderTextInteraction, surfaceEvents } from "eve/internal/channels";
13
+ const log = createLogger("board.channel");
14
+ const CLAIM_LEASE_SECONDS = 3600;
15
+ const RENEW_EVERY_MS = 3e4;
16
+ const RECENT_RENEWAL_MS = 6e4;
17
+ const SETTLE_ATTEMPTS = 3;
18
+ const SETTLE_BACKOFF_MS = 500;
19
+ const MAX_PULLS_PER_WAKE = 20;
20
+ const MATCHES_PER_PULL = 10;
21
+ const DEFAULT_MAX_UPLOAD_BYTES = 26214400;
22
+ const SETTLEMENTS = new Set([
23
+ "completed",
24
+ "failed",
25
+ "blocked"
26
+ ]);
27
+ const CLAIM_WATCH_LABEL = "eve-claim-watch";
28
+ const CLAIM_EVENTS = new Set([
29
+ "task.assigned",
30
+ "task.created",
31
+ "task.expired",
32
+ "task.ready",
33
+ "task.released",
34
+ "task.reopened",
35
+ "task.unblocked"
36
+ ]);
37
+ function createBoardChannel(settings, options = {}) {
38
+ const deployment = () => boardClients(settings()).deployment;
39
+ const keepClaim = (state) => keepBoardClaim(deployment(), state);
40
+ let draining;
41
+ const coalesced = (drain) => {
42
+ if (draining !== void 0) {
43
+ draining.again = true;
44
+ return;
45
+ }
46
+ const current = { again: false };
47
+ draining = current;
48
+ return (async () => {
49
+ let dispatched = 0;
50
+ try {
51
+ do {
52
+ current.again = false;
53
+ dispatched += await drain();
54
+ } while (current.again);
55
+ } finally {
56
+ draining = void 0;
57
+ }
58
+ return dispatched;
59
+ })();
60
+ };
61
+ const surface = surfaceEvents({
62
+ post: postChunks,
63
+ restart: "thread",
64
+ requests: { showOne: showPrompt },
65
+ signIns: boardSignIns,
66
+ typing: async (channel) => {
67
+ await bestEffort("typing", () => channel.board.typing());
68
+ }
69
+ });
70
+ return defineChannel({
71
+ turnPolicy: options.turnPolicy,
72
+ state: {
73
+ channel: null,
74
+ task: null,
75
+ threadId: null
76
+ },
77
+ context(state) {
78
+ return {
79
+ board: threadHandle(boardClients(settings()).model, state),
80
+ state
81
+ };
82
+ },
83
+ metadata(state) {
84
+ return {
85
+ boardChannel: state.channel,
86
+ boardTask: state.task == null ? null : {
87
+ id: state.task.taskId,
88
+ until: state.task.until
89
+ },
90
+ boardThread: state.threadId,
91
+ boardWatch: state.watch ?? null
92
+ };
93
+ },
94
+ deliver(payload, ctx) {
95
+ if (payload.state?.task !== void 0) ctx.state.task = payload.state.task;
96
+ if (payload.state?.noSync !== void 0) ctx.state.noSync = payload.state.noSync;
97
+ },
98
+ routes: [POST(BOARD_WAKE_ROUTE, async (_request, { from, waitUntil }) => {
99
+ const wake = coalesced(() => drainMatches({
100
+ from,
101
+ settings: settings()
102
+ }));
103
+ if (wake !== void 0) waitUntil(wake.catch((error) => logError("board wake-up failed", error)));
104
+ return Response.json({ ok: true }, { status: 202 });
105
+ })],
106
+ async receive({ message, target, ...send }, { from }) {
107
+ const board = boardClients(settings()).model;
108
+ let root;
109
+ if ("thread" in target) root = (await board.thread(target.thread)).message;
110
+ else {
111
+ if (target.text.length === 0) throw new Error("boardChannel().receive needs target.text to start a thread.");
112
+ root = await board.post(target.channel, {
113
+ id: send.idempotencyKey === void 0 ? void 0 : boardPostId(send.idempotencyKey),
114
+ labels: target.labels,
115
+ text: target.text
116
+ });
117
+ }
118
+ return await sendRecovering(from(boardSessionAddress(board.profile, root)), message, {
119
+ ...send,
120
+ state: {
121
+ channel: root.channel,
122
+ noSync: false,
123
+ threadId: root.id
124
+ }
125
+ });
126
+ },
127
+ fetchFile(url) {
128
+ const policy = options.uploadPolicy;
129
+ if (policy === "disabled") return Promise.resolve(null);
130
+ return fetchBoardAttachment(url, boardClients(settings()).model, policy?.maxBytes ?? DEFAULT_MAX_UPLOAD_BYTES);
131
+ },
132
+ uploadPolicy: options.uploadPolicy,
133
+ events: {
134
+ ...surface,
135
+ async "turn.started"(event, ctx) {
136
+ await keepClaim(ctx.channel.state);
137
+ await surface["turn.started"]?.(event, ctx);
138
+ },
139
+ async "call.requested"(event, ctx) {
140
+ await keepClaim(ctx.channel.state);
141
+ const { capability } = event.data;
142
+ const status = capability.hidden === true ? void 0 : capability.label;
143
+ await bestEffort("typing", () => ctx.channel.board.typing(status));
144
+ },
145
+ async "call.started"(event, ctx) {
146
+ if (event.data.taskId === void 0) renewDuringCall(deployment, ctx.channel.state, event.data.callId);
147
+ else await renewBeforeTask(deployment(), ctx.channel.state);
148
+ },
149
+ async "call.settled"(event, ctx) {
150
+ endRenewal(ctx.channel.state, event.data.callId);
151
+ await settleAfterCall(deployment(), ctx.channel, ctx.view, event.data);
152
+ },
153
+ async "turn.settled"(event, ctx) {
154
+ endRenewal(ctx.channel.state);
155
+ await surface["turn.settled"](event, ctx);
156
+ }
157
+ }
158
+ });
159
+ }
160
+ async function drainMatches(options) {
161
+ const { settings } = options;
162
+ const { deployment, model, watchChannel } = boardClients(settings);
163
+ const self = await deployment.me();
164
+ const records = new Map();
165
+ const wake = {
166
+ can: settings.can,
167
+ deployment,
168
+ from: options.from,
169
+ model,
170
+ name: settings.name,
171
+ recordOf(id) {
172
+ let record = records.get(id);
173
+ if (record === void 0) {
174
+ record = findWatchRecord({
175
+ client: deployment,
176
+ id,
177
+ self,
178
+ watchChannel
179
+ });
180
+ records.set(id, record);
181
+ }
182
+ return record;
183
+ },
184
+ self,
185
+ watchChannel
186
+ };
187
+ const wait = options.wait ?? 0;
188
+ let dispatched = 0;
189
+ for (let pull = 0; pull < MAX_PULLS_PER_WAKE; pull += 1) {
190
+ const matches = await deployment.matches({
191
+ limit: MATCHES_PER_PULL,
192
+ wait
193
+ }).catch((error) => {
194
+ if (boardErrorCode(error) === "no_registration") return [];
195
+ throw error;
196
+ });
197
+ for (const match of matches) if (await handleMatch(wake, match)) dispatched += 1;
198
+ if (wait > 0 || matches.length === 0) break;
199
+ }
200
+ return dispatched;
201
+ }
202
+ async function handleMatch(wake, match) {
203
+ const { deployment } = wake;
204
+ try {
205
+ const record = await wake.recordOf(match.watcher);
206
+ if (record.retired) {
207
+ await deployment.ack(match, { skip: true });
208
+ return false;
209
+ }
210
+ if (record.action.type === "claim") try {
211
+ checkQueueScope(record.action.queue, wake);
212
+ } catch (error) {
213
+ throw new BoardWatchConfigError(`Board watch ${record.id} claims outside this agent's scope: ${error.message}`);
214
+ }
215
+ const dispatched = await dispatch(wake, match, record);
216
+ await deployment.ack(match);
217
+ return dispatched;
218
+ } catch (error) {
219
+ const misconfigured = error instanceof BoardWatchConfigError;
220
+ if (misconfigured) log.warn(error.message, { match: match.id });
221
+ const outcome = misconfigured ? { skip: true } : { error: `eve couldn't dispatch this match (error id ${logError("board match failed", error, { match: match.id })})` };
222
+ await deployment.ack(match, outcome).catch((ackError) => logError("board ack failed", ackError, { match: match.id }));
223
+ return false;
224
+ }
225
+ }
226
+ async function dispatch(wake, match, record) {
227
+ const { can, deployment, self } = wake;
228
+ const posted = match.event.message;
229
+ if (posted !== void 0 && coversChannel(wake.watchChannel, posted.channel)) return false;
230
+ const start = (message, context, idempotencyKey, task) => sendRecovering(wake.from(boardSessionAddress(record.id, message)), boardMessageContent(message), {
231
+ auth: defaultBoardAuth(message, {
232
+ name: wake.name,
233
+ watch: record.id
234
+ }),
235
+ context: [formatWatchContext(record), context],
236
+ idempotencyKey,
237
+ state: {
238
+ channel: message.channel,
239
+ noSync: message.noSync,
240
+ threadId: boardThreadId(message),
241
+ watch: record.id,
242
+ ...task !== void 0 && { task }
243
+ }
244
+ });
245
+ if (match.event.type === "message.posted") {
246
+ if (posted === void 0 || posted.deleted) return false;
247
+ if (posted.by.actor === self.actor && posted.schedule === void 0) return false;
248
+ if (!boardAllows(can, posted.channel, "read")) {
249
+ log.warn("board watch matched a channel outside the agent's read scope; skipped it", {
250
+ channel: posted.channel,
251
+ watch: record.id
252
+ });
253
+ return false;
254
+ }
255
+ if (record.action.type !== "claim") {
256
+ await start(posted, formatBoardContext(posted), `board:${match.id}`);
257
+ return true;
258
+ }
259
+ if (posted.re === null) return false;
260
+ const root = (await deployment.thread(posted.re)).message;
261
+ const held = root.task?.claim;
262
+ if (held?.actor !== self.actor || Date.parse(held.until) <= Date.now()) return false;
263
+ if (root.labels[CLAIM_WATCH_LABEL] !== record.id) return false;
264
+ await start(posted, formatTaskFollowUpContext(posted), `board:${match.id}`);
265
+ return true;
266
+ }
267
+ if (record.action.type !== "claim" || !CLAIM_EVENTS.has(match.event.type)) return false;
268
+ const claimed = await wake.model.claimReady({
269
+ ...record.action.queue,
270
+ lease: CLAIM_LEASE_SECONDS
271
+ });
272
+ if (claimed === null) return false;
273
+ const { task, ...claim } = claimed;
274
+ if (!boardAllows(can, task.channel, "read") || !boardAllows(can, task.channel, "label")) {
275
+ await deployment.held(claim).release();
276
+ log.warn("board watch claimed a task outside the agent's read scope; released it", {
277
+ task: task.id,
278
+ watch: record.id
279
+ });
280
+ return false;
281
+ }
282
+ try {
283
+ await deployment.label(task.id, { set: { [CLAIM_WATCH_LABEL]: record.id } });
284
+ await start(task, formatTaskContext(claimed), `board:task:${task.id}:${claim.epoch}`, claim);
285
+ } catch (error) {
286
+ await deployment.held(claim).release().catch((releaseError) => logError("board task release failed", releaseError, { task: task.id }));
287
+ throw error;
288
+ }
289
+ return true;
290
+ }
291
+ async function sendRecovering(source, message, options) {
292
+ try {
293
+ return await source.send(message, options);
294
+ } catch (error) {
295
+ if (!SessionStrandedError.is(error)) throw error;
296
+ log.warn("board thread's session was stranded by an eve upgrade; starting a new one", { error });
297
+ await source.end({ reason: "Stranded by an eve upgrade; the board thread starts over." });
298
+ return await source.send(message, options);
299
+ }
300
+ }
301
+ function temporaryBoardFailure(error) {
302
+ const status = error?.status;
303
+ return typeof status !== "number" || status === 429 || status >= 500;
304
+ }
305
+ function claimDue(claim, now = Date.now()) {
306
+ return Date.parse(claim.until) - now < CLAIM_LEASE_SECONDS * 1e3 / 3;
307
+ }
308
+ function renewedRecently(claim, now = Date.now()) {
309
+ return Date.parse(claim.until) - now > CLAIM_LEASE_SECONDS * 1e3 - RECENT_RENEWAL_MS;
310
+ }
311
+ async function renewClaim(client, claim) {
312
+ try {
313
+ return {
314
+ ...claim,
315
+ until: await client.held(claim).renew(CLAIM_LEASE_SECONDS)
316
+ };
317
+ } catch (error) {
318
+ if (boardErrorCode(error) === "claim_lost") {
319
+ log.warn("board task claim was lost; the agent no longer holds the task", { task: claim.taskId });
320
+ return null;
321
+ }
322
+ logError("board task renewal failed", error, { task: claim.taskId });
323
+ return claim;
324
+ }
325
+ }
326
+ const renewals = new Map();
327
+ function renewDuringCall(client, state, callId) {
328
+ const claim = state.task;
329
+ if (claim == null) return;
330
+ const running = renewals.get(claim.token);
331
+ if (running !== void 0) {
332
+ running.calls.add(callId);
333
+ return;
334
+ }
335
+ const renewal = {
336
+ calls: new Set([callId]),
337
+ claim,
338
+ renewing: false
339
+ };
340
+ renewal.timer = setInterval(async () => {
341
+ if (renewal.renewing || renewal.claim === null || !claimDue(renewal.claim)) return;
342
+ renewal.renewing = true;
343
+ try {
344
+ renewal.claim = await renewClaim(client(), renewal.claim);
345
+ } finally {
346
+ renewal.renewing = false;
347
+ }
348
+ if (renewal.claim === null) clearInterval(renewal.timer);
349
+ }, RENEW_EVERY_MS);
350
+ renewal.timer.unref?.();
351
+ renewals.set(claim.token, renewal);
352
+ }
353
+ function stopRenewal(token) {
354
+ clearInterval(renewals.get(token)?.timer);
355
+ renewals.delete(token);
356
+ }
357
+ function endRenewal(state, callId) {
358
+ const token = state.task?.token;
359
+ const renewal = token === void 0 ? void 0 : renewals.get(token);
360
+ if (token === void 0 || renewal === void 0) return;
361
+ if (callId !== void 0) renewal.calls.delete(callId);
362
+ state.task = renewal.claim;
363
+ if (callId === void 0 || renewal.calls.size === 0 || renewal.claim === null) stopRenewal(token);
364
+ }
365
+ const SETTLE_TOOL = /^(?:.+__)?(?:complete|fail|block)_task$/u;
366
+ function settlementOf(output, taskId, capability) {
367
+ if (capability.kind !== "tool" || !SETTLE_TOOL.test(capability.name)) return void 0;
368
+ if (typeof output !== "object" || output === null) return void 0;
369
+ const settlement = output;
370
+ if (settlement.task !== taskId || !SETTLEMENTS.has(settlement.settled ?? "")) return void 0;
371
+ return settlement;
372
+ }
373
+ async function keepBoardClaim(client, state) {
374
+ if (state.task != null && claimDue(state.task)) await renewBoardClaim(client, state);
375
+ }
376
+ async function renewBeforeTask(client, state) {
377
+ if (state.task != null && !renewedRecently(state.task)) await renewBoardClaim(client, state);
378
+ }
379
+ async function renewBoardClaim(client, state) {
380
+ const claim = state.task;
381
+ if (claim == null) return;
382
+ state.task = await renewClaim(client, claim);
383
+ if (state.task === null) stopRenewal(claim.token);
384
+ }
385
+ async function settleAfterCall(client, channel, view, call$1) {
386
+ const { state } = channel;
387
+ const claim = state.task;
388
+ const observed = view === void 0 ? void 0 : call(view, call$1.callId);
389
+ const settlement = claim != null && call$1.outcome === "completed" && observed !== void 0 ? settlementOf(call$1.output, claim.taskId, observed) : void 0;
390
+ if (claim == null || settlement === void 0) {
391
+ await keepBoardClaim(client, state);
392
+ return;
393
+ }
394
+ const { problem } = await settleClaim(client, claim, settlement);
395
+ state.task = null;
396
+ stopRenewal(claim.token);
397
+ if (problem !== void 0) await bestEffort("note", async () => void await channel.board.reply({
398
+ noSync: true,
399
+ text: problem
400
+ }));
401
+ }
402
+ async function settleClaim(client, claim, settlement) {
403
+ const held = client.held(claim);
404
+ for (let attempt = 1;; attempt += 1) try {
405
+ if (settlement.settled === "completed") await held.complete(settlement.result);
406
+ else if (settlement.settled === "failed") await held.fail(settlement.reason ?? "Failed.");
407
+ else await held.block(settlement.reason ?? "Needs a person.", { kind: settlement.kind });
408
+ return {};
409
+ } catch (error) {
410
+ if (boardErrorCode(error) === "claim_lost") return { problem: `eve couldn't mark task #${claim.taskId} ${settlement.settled}: its claim ended before the agent settled it.` };
411
+ const id = logError("board task settlement failed", error, {
412
+ task: claim.taskId,
413
+ attempt
414
+ });
415
+ if (temporaryBoardFailure(error) && attempt < SETTLE_ATTEMPTS) {
416
+ await new Promise((resolve) => setTimeout(resolve, attempt * SETTLE_BACKOFF_MS));
417
+ continue;
418
+ }
419
+ return { problem: `eve couldn't mark task #${claim.taskId} ${settlement.settled} on the board (error id ${id}). Its claim runs out within the hour, and the task goes back to the queue.` };
420
+ }
421
+ }
422
+ function threadHandle(client, state) {
423
+ const threadId = state.threadId ?? "";
424
+ return {
425
+ reply: (post) => client.reply(threadId, typeof post === "string" ? {
426
+ noSync: state.noSync === true,
427
+ text: post
428
+ } : post),
429
+ typing: (status) => client.typing(threadId, status)
430
+ };
431
+ }
432
+ async function showPrompt(channel, request) {
433
+ await postChunks(channel, `${renderTextInteraction(request.request)}${request.request.allowFreeform === true ? "\n\nYou can also reply with a custom answer." : ""}\n\nReply in this thread to answer.`);
434
+ }
435
+ function boardSignIns(channel) {
436
+ const post = async (text) => (await channel.board.reply(text)).id;
437
+ return {
438
+ post,
439
+ postChallenge: async () => void 0,
440
+ postStatus: (signIn) => post(`Authorization required for ${signIn.displayName}. Board threads are shared, so connect it through a private channel with this agent, then reply here.`),
441
+ posted: postedIn(channel.state, "pendingSignIns"),
442
+ private: false
443
+ };
444
+ }
445
+ async function postChunks(channel, text) {
446
+ for (const chunk of splitBoardText(text)) await channel.board.reply(chunk);
447
+ }
448
+ function splitBoardText(text, limit = BOARD_TEXT_LIMIT) {
449
+ const chunks = [];
450
+ let rest = text;
451
+ while (rest.length > limit) {
452
+ const cut = rest.lastIndexOf("\n", limit);
453
+ let end = cut > limit / 2 ? cut : limit;
454
+ const last = rest.charCodeAt(end - 1);
455
+ if (last >= 55296 && last <= 56319) end -= 1;
456
+ chunks.push(rest.slice(0, end));
457
+ rest = rest.slice(end).replace(/^\n/u, "");
458
+ }
459
+ if (rest.length > 0) chunks.push(rest);
460
+ return chunks;
461
+ }
462
+ async function bestEffort(what, act) {
463
+ try {
464
+ await act();
465
+ } catch (error) {
466
+ logError(`board ${what} failed — swallowed`, error);
467
+ }
468
+ }
469
+ function logError(message, error, fields = {}) {
470
+ const errorId = crypto.randomUUID();
471
+ log.error(message, {
472
+ ...fields,
473
+ error,
474
+ errorId
475
+ });
476
+ return errorId;
477
+ }
478
+ export { createBoardChannel, drainMatches, endRenewal, keepBoardClaim, renewBeforeTask, renewDuringCall, settleAfterCall, settleClaim, settlementOf, splitBoardText };
@@ -0,0 +1,11 @@
1
+ import { type BoardChannel, type BoardChannelConfig } from "./board-channel.ts";
2
+ /**
3
+ * A channel for Vercel Board. Registered from your agent's own files, it uses the default board
4
+ * settings: mount the `@eve/board` extension to configure them. The board wakes it when a
5
+ * watch matches; each match runs the watch's stored instructions in a session on the matching
6
+ * board thread, or first claims a ready task and runs them on the task's thread. The agent's
7
+ * replies and typing go back to the thread, and from there to whatever Slack, GitHub, or Linear
8
+ * thread the board syncs. Watches are created with the `watch` tool, never by the channel.
9
+ */
10
+ export declare function boardChannel(config?: BoardChannelConfig): BoardChannel;
11
+ export type { BoardChannel, BoardChannelConfig, BoardChannelMetadata, BoardChannelState, BoardReceiveTarget, } from "./board-channel.ts";
@@ -0,0 +1,12 @@
1
+ import { fileURLToPath as __eveFileURLToPath } from "node:url";
2
+ import { dirname as __eveDirname } from "node:path";
3
+ import { createRequire as __eveCreateRequire } from "node:module";
4
+ const __filename = __eveFileURLToPath(import.meta.url);
5
+ __eveDirname(__filename);
6
+ __eveCreateRequire(import.meta.url);
7
+ import extension_default from "../extension.mjs";
8
+ import { createBoardChannel } from "./board-channel.mjs";
9
+ function boardChannel(config = {}) {
10
+ return createBoardChannel(() => extension_default.config, config);
11
+ }
12
+ export { boardChannel };