@agent-compose/sdk 0.8.5 → 0.8.7

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 (100) hide show
  1. package/README.md +213 -189
  2. package/dist/agent/agent-context.d.ts +3 -3
  3. package/dist/agent/agent-loop.d.ts +6 -5
  4. package/dist/agent/perf-sampler.d.ts +27 -2
  5. package/dist/agent/run-agent.d.ts +1 -1
  6. package/dist/client.d.ts +119 -54
  7. package/dist/directives.d.ts +3 -3
  8. package/dist/display.d.ts +7 -0
  9. package/dist/errors.d.ts +1 -1
  10. package/dist/generated/agentc-commands.d.ts +34 -0
  11. package/dist/index.d.ts +12 -12
  12. package/dist/index.js +771 -204
  13. package/dist/request-context/request-context.d.ts +1 -1
  14. package/dist/runtimes/_cli-agent.d.ts +185 -68
  15. package/dist/runtimes/_reported-model.d.ts +16 -0
  16. package/dist/runtimes/claude-code.d.ts +60 -1
  17. package/dist/runtimes/claude.d.ts +1 -1
  18. package/dist/runtimes/codex.d.ts +94 -6
  19. package/dist/runtimes/codex.mid-turn-hook.test.d.ts +10 -0
  20. package/dist/runtimes/model-report.test.d.ts +14 -0
  21. package/dist/runtimes/openai-desktop.js +741 -200
  22. package/dist/runtimes/opencode.d.ts +48 -11
  23. package/dist/runtimes/opencode.test.d.ts +14 -0
  24. package/dist/sandbox/baked-clis.d.ts +75 -0
  25. package/dist/sandbox/exec-stream.d.ts +1 -2
  26. package/dist/sandbox/network-policy.d.ts +23 -5
  27. package/dist/sandbox.d.ts +4 -2
  28. package/dist/step-invocation/protocol.d.ts +3 -4
  29. package/dist/step-invocation/server.d.ts +2 -2
  30. package/dist/step-invocation/types.d.ts +1 -1
  31. package/dist/types/api-conversations.d.ts +442 -29
  32. package/dist/types/api-factory.d.ts +99 -10
  33. package/dist/types/api-projects.d.ts +521 -0
  34. package/dist/types/api-runs.d.ts +83 -0
  35. package/dist/types/api-scopes.d.ts +32 -3
  36. package/dist/types/conversation-stream.d.ts +5 -0
  37. package/dist/types/execution-context.d.ts +1 -1
  38. package/dist/types/protocol.d.ts +86 -2
  39. package/dist/types/runtime.d.ts +9 -2
  40. package/dist/types/workflow-metadata.d.ts +2 -4
  41. package/dist/types/workflow-plan.d.ts +1 -3
  42. package/dist/utils/bundler.d.ts +23 -0
  43. package/dist/workflow-steps/observability.d.ts +2 -3
  44. package/dist/workflow-steps/runner.d.ts +5 -8
  45. package/dist/workflow-steps/types.d.ts +8 -10
  46. package/dist/workflow-steps/workflow.d.ts +2 -1
  47. package/dist/workflows/engine.d.ts +3 -5
  48. package/dist/workflows/invoke-child.d.ts +2 -2
  49. package/package.json +2 -2
  50. package/src/agent/agent-context.ts +168 -125
  51. package/src/agent/agent-loop.ts +7 -6
  52. package/src/agent/perf-sampler.ts +54 -3
  53. package/src/agent/run-agent.ts +1 -1
  54. package/src/client.ts +226 -71
  55. package/src/directives.ts +3 -3
  56. package/src/display.ts +12 -0
  57. package/src/errors.ts +1 -0
  58. package/src/generated/agentc-commands.ts +571 -0
  59. package/src/index.ts +57 -21
  60. package/src/pause/pause-core.ts +2 -1
  61. package/src/request-context/request-context.ts +1 -1
  62. package/src/runtimes/_cli-agent.ts +318 -122
  63. package/src/runtimes/_reported-model.ts +24 -0
  64. package/src/runtimes/claude-code.ts +195 -12
  65. package/src/runtimes/claude.ts +9 -2
  66. package/src/runtimes/codex.ts +188 -19
  67. package/src/runtimes/opencode.ts +195 -26
  68. package/src/sandbox/baked-clis.ts +86 -0
  69. package/src/sandbox/exec-stream.ts +1 -2
  70. package/src/sandbox/network-policy.ts +51 -7
  71. package/src/sandbox/providers/e2b.ts +3 -3
  72. package/src/sandbox/providers/vercel.ts +6 -6
  73. package/src/sandbox.ts +8 -2
  74. package/src/step-invocation/invoker.ts +2 -6
  75. package/src/step-invocation/protocol.ts +3 -4
  76. package/src/step-invocation/server.ts +2 -2
  77. package/src/types/api-conversations.ts +366 -23
  78. package/src/types/api-factory.ts +95 -10
  79. package/src/types/api-projects.ts +477 -0
  80. package/src/types/api-runs.ts +73 -0
  81. package/src/types/api-scopes.ts +32 -3
  82. package/src/types/conversation-stream.ts +5 -0
  83. package/src/types/execution-context.ts +1 -1
  84. package/src/types/protocol.ts +91 -2
  85. package/src/types/runtime.ts +8 -2
  86. package/src/types/sandbox-environment.ts +1 -2
  87. package/src/types/workflow-metadata.ts +2 -4
  88. package/src/types/workflow-plan.ts +1 -3
  89. package/src/utils/bundler.ts +88 -19
  90. package/src/workflow-steps/observability.ts +2 -3
  91. package/src/workflow-steps/runner.ts +5 -8
  92. package/src/workflow-steps/types.ts +8 -10
  93. package/src/workflow-steps/workflow.ts +2 -1
  94. package/src/workflows/engine.ts +3 -5
  95. package/src/workflows/invoke-child.ts +2 -2
  96. package/dist/generated/verb-synopsis.d.ts +0 -34
  97. package/dist/pause/__tests__/errors.test.d.ts +0 -1
  98. package/dist/pause/__tests__/wrappers.test.d.ts +0 -1
  99. package/dist/step-invocation/__tests__/protocol.test.d.ts +0 -1
  100. package/src/generated/verb-synopsis.ts +0 -544
@@ -30,6 +30,22 @@ export interface Project {
30
30
  role: ProjectRole;
31
31
  memberCount: number;
32
32
  objectCount: number;
33
+ /** The overview's words and dates (owner 2026-10-05): a short
34
+ * description, and the start and target dates as calendar days
35
+ * (`YYYY-MM-DD`); null until someone sets them. */
36
+ description: string | null;
37
+ startDate: string | null;
38
+ targetDate: string | null;
39
+ }
40
+ /** What `updateProject` may set: each field absent = untouched, null =
41
+ * cleared. `name` and the details need `write`; `visibility` needs a
42
+ * project owner or a team admin. */
43
+ export interface ProjectUpdate {
44
+ name?: string;
45
+ visibility?: "public" | "private";
46
+ description?: string | null;
47
+ startDate?: string | null;
48
+ targetDate?: string | null;
33
49
  }
34
50
  /** A page of projects, newest-activity first. Cursor-paginated: pass the
35
51
  * previous page's `next_cursor` (null when exhausted). */
@@ -84,6 +100,15 @@ export interface ProjectObjectsPage {
84
100
  objects: ProjectObject[];
85
101
  next_cursor: string | null;
86
102
  }
103
+ /** How many objects of each kind a project holds for the caller — the
104
+ * whole project's counts under the list's own visibility, never a
105
+ * page's. `GET /projects/:id/objects/counts`. */
106
+ export interface ProjectObjectCounts {
107
+ file: number;
108
+ conversation: number;
109
+ session: number;
110
+ folder: number;
111
+ }
87
112
  /** One file the caller could NOT contribute to a project when adding a
88
113
  * session — only files the caller OWNS are materialized. `path` is present
89
114
  * only when visible to the caller; paths concealed from the caller are
@@ -129,3 +154,499 @@ export interface RefreshProjectObjectResult {
129
154
  objects: ProjectObject[];
130
155
  skipped: ProjectSkippedFile[];
131
156
  }
157
+ /** A person on a project status row, identity merged server-side. `email`
158
+ * rides only while they share the workspace with the viewer: the
159
+ * dashboard's label rule (name, else email, else "Teammate") picks. */
160
+ export interface ProjectStatusPerson {
161
+ id: string;
162
+ name: string | null;
163
+ email: string | null;
164
+ image: string | null;
165
+ avatarUrl: string | null;
166
+ }
167
+ /** Whom a thread waits on (owner 2026-10-01: status "is multiplayer, could
168
+ * be needs Chris or Westan"; it names people). A plan task that waits on a
169
+ * person, as the thread agent wrote it (a teammate, or someone outside by
170
+ * name), or a worker's question owed an answer, which waits on the person
171
+ * who asked for the work (the thread's opening message), else the last
172
+ * person to speak on the thread. */
173
+ export interface ProjectStatusWaitingOn {
174
+ /** The teammate, when known. */
175
+ person: ProjectStatusPerson | null;
176
+ /** How the thread names them: the teammate's name, "Dana's IT team", or
177
+ * "an answer" when a worker's question has nobody to wait on yet. */
178
+ who: string;
179
+ /** What they will do or answer, in the people's terms. */
180
+ what: string | null;
181
+ /** `task`: a plan task waiting on a person; `question`: a worker's
182
+ * question owed an answer; `answer`: the thread's own question to a
183
+ * person (its raise declared whom it waits on), open until one of them
184
+ * answers where Ivy spoke. */
185
+ kind: "task" | "question" | "answer";
186
+ /** The chat message where the person said it, when the thread agent
187
+ * recorded one, or Ivy's message carrying the thread's question: the way
188
+ * to the ask. Null otherwise. */
189
+ messageId: string | null;
190
+ /** An answer wait's place: the chat thread Ivy spoke in (null for the
191
+ * room's top level). Absent on the other kinds. */
192
+ threadRootId?: string | null;
193
+ /** When the thread asked (ISO). Absent on the other kinds. */
194
+ at?: string | null;
195
+ }
196
+ /** Whom a TASK waits on (owner 2026-10-05: a todo may wait on more than one
197
+ * person's answer or sign-off): every teammate it names, as people, and
198
+ * the words the thread agent (or the person who set it) wrote for whoever
199
+ * they are. */
200
+ export interface ThreadStatusWaitingOn {
201
+ /** The teammates, the one whose act comes first first; empty for a wait
202
+ * on someone the workspace cannot name ("Dana's IT team"). */
203
+ people: ProjectStatusPerson[];
204
+ /** How the thread names them. */
205
+ who: string;
206
+ /** What they will do or answer, in the people's terms; null when a person
207
+ * set the wait without saying for what. */
208
+ what: string | null;
209
+ /** The chat message where the person said it, when one was recorded. */
210
+ messageId: string | null;
211
+ }
212
+ /** Who a todo is assigned to (owner 2026-10-05, like an issue's assignee):
213
+ * Ivy, or one person. Null on the todo = nobody, after a person took the
214
+ * assignee off. */
215
+ export type ThreadStatusAssignee = {
216
+ kind: "ivy";
217
+ } | ({
218
+ kind: "person";
219
+ } & ProjectStatusPerson);
220
+ /** One plan task of a thread, as the thread agent's plan view reads it. */
221
+ export interface ProjectStatusTask {
222
+ id: string;
223
+ objective: string;
224
+ status: "open" | "done";
225
+ dueAt: string | null;
226
+ overdue: boolean;
227
+ /** Open and waiting on a task that is not done. */
228
+ blocked: boolean;
229
+ criteria: {
230
+ met: number;
231
+ total: number;
232
+ };
233
+ /** Open and waiting on a person. */
234
+ waitingOn: ThreadStatusWaitingOn | null;
235
+ assignee: ThreadStatusAssignee | null;
236
+ }
237
+ /** What a thread's workers are doing, from platform rows: `waiting` a
238
+ * worker's question is owed an answer; `working` a worker has a live turn;
239
+ * `idle` workers exist and none is running; `done` the thread is closed;
240
+ * `none` no worker was started. */
241
+ export type ProjectStatusWorker = "working" | "waiting" | "idle" | "done" | "none";
242
+ /** One outcome thread born in one of the project's chats. */
243
+ export interface ProjectStatusThread {
244
+ id: string;
245
+ title: string;
246
+ state: "open" | "waiting" | "snoozed" | "closed";
247
+ note: string | null;
248
+ /** The chat the thread was born in, and whether it is public or private. */
249
+ conversation: {
250
+ id: string;
251
+ title: string | null;
252
+ access: "public" | "private";
253
+ };
254
+ /** The chat message the thread opened on, for a deep link; null if none. */
255
+ openingMessageId: string | null;
256
+ /** Who holds the next move: a person while the thread waits on people,
257
+ * else Ivy. */
258
+ owner: {
259
+ kind: "ivy";
260
+ } | ({
261
+ kind: "person";
262
+ } & ProjectStatusPerson);
263
+ /** The people who spoke on the thread, most recent first. */
264
+ people: ProjectStatusPerson[];
265
+ /** The now line: what its running worker is doing (`worker`), else the
266
+ * thread agent's note, its own reading of where things stand (`note`);
267
+ * null when there is neither. `at` is when the text was set (ISO). */
268
+ now: {
269
+ kind: "worker" | "note";
270
+ text: string;
271
+ at: string | null;
272
+ } | null;
273
+ /** `running`: how many of its workers have a live turn. `line`: while
274
+ * `status` is working, the one-line status its running worker set most
275
+ * recently ("Reading the Fly logs") and when (ISO); null otherwise. */
276
+ worker: {
277
+ status: ProjectStatusWorker;
278
+ sessions: number;
279
+ running: number;
280
+ line: {
281
+ text: string;
282
+ at: string;
283
+ } | null;
284
+ };
285
+ /** Whom the thread waits on, named; empty when it waits on nobody. */
286
+ waitingOn: ProjectStatusWaitingOn[];
287
+ /** The next open task deadline, else the thread agent's check-in. */
288
+ next: {
289
+ at: string;
290
+ what: string;
291
+ kind: "deadline" | "check_in";
292
+ } | null;
293
+ progress: {
294
+ done: number;
295
+ total: number;
296
+ };
297
+ tasks: ProjectStatusTask[];
298
+ overdue: number;
299
+ blocked: number;
300
+ unmetCriteria: number;
301
+ lastMovementAt: string;
302
+ closedAt: string | null;
303
+ }
304
+ /** What moved: a task done, a thread opened or closed, a result or decision
305
+ * the thread agent raised to the people, a worker's declared result, or a
306
+ * person's answer (`by` names them). */
307
+ export type ProjectStatusActivityKind = "task_done" | "thread_closed" | "thread_opened" | "result" | "decision" | "answer";
308
+ export interface ProjectStatusActivity {
309
+ at: string;
310
+ kind: ProjectStatusActivityKind;
311
+ threadId: string;
312
+ threadTitle: string;
313
+ text: string;
314
+ by: ProjectStatusPerson | null;
315
+ }
316
+ /** How many live threads wait on one person (or one named outsider). */
317
+ export interface ProjectStatusWaitingCount {
318
+ person: ProjectStatusPerson | null;
319
+ who: string;
320
+ threads: number;
321
+ }
322
+ /** The header's counts: "3 in progress, waiting on Chris (2) and Westan (1),
323
+ * 4 done this week". */
324
+ export interface ProjectStatusCounts {
325
+ /** Live threads (open, waiting or snoozed). */
326
+ inProgress: number;
327
+ /** Threads closed in the last seven days. */
328
+ doneThisWeek: number;
329
+ waitingOn: ProjectStatusWaitingCount[];
330
+ }
331
+ /** GET /projects/:id/status. `threads` (the live ones) is cursor-paginated
332
+ * by last movement; `recentlyClosed` rides the first page only (empty on
333
+ * later pages). The project facts (`sources`, `progress`, `dueAt`,
334
+ * `nextCheckIn`, `activity`) span every thread the viewer may read, on
335
+ * every page. */
336
+ export interface ProjectStatus {
337
+ project: {
338
+ id: string;
339
+ name: string;
340
+ visibility: "public" | "private";
341
+ role: ProjectRole;
342
+ };
343
+ /** The chats in the project, where its threads are born. */
344
+ sources: number;
345
+ progress: {
346
+ done: number;
347
+ total: number;
348
+ };
349
+ /** The latest deadline of an open task: the project's finish line. */
350
+ dueAt: string | null;
351
+ nextCheckIn: {
352
+ at: string;
353
+ threadId: string;
354
+ threadTitle: string;
355
+ conversationId: string;
356
+ with: ProjectStatusPerson | null;
357
+ } | null;
358
+ counts: ProjectStatusCounts;
359
+ threads: ProjectStatusThread[];
360
+ /** Closed in the last seven days. */
361
+ recentlyClosed: ProjectStatusThread[];
362
+ activity: ProjectStatusActivity[];
363
+ generatedAt: string;
364
+ next_cursor: string | null;
365
+ }
366
+ /** A worker's state as the chat's chips say it: working (a live turn, or
367
+ * parked on a question), starting (nothing produced yet), done, failed,
368
+ * stopped. */
369
+ export type ThreadStatusWorkerState = "starting" | "working" | "done" | "failed" | "stopped";
370
+ /** The effort a worker was started with; null = the harness's own default. */
371
+ export type ThreadStatusWorkerEffort = "low" | "medium" | "high" | "xhigh" | "max";
372
+ /** What pays for a worker's inference, as its hover card says it (owner
373
+ * 2026-10-05: a findable detail, never a mark on rows): a person's connected
374
+ * plan (the person by id and name only, when the turn named them), platform
375
+ * credits, or a connected provider key by its provider family. */
376
+ export type WorkerFunding = {
377
+ lane: "subscription";
378
+ owner: {
379
+ id: string;
380
+ name: string | null;
381
+ } | null;
382
+ } | {
383
+ lane: "platform";
384
+ } | {
385
+ lane: "byok";
386
+ provider: string;
387
+ };
388
+ export interface ThreadStatusWorker {
389
+ /** The worker's session (its page is /conversations/:id). */
390
+ conversationId: string;
391
+ title: string | null;
392
+ state: ThreadStatusWorkerState;
393
+ /** Its one-line status while working; null otherwise. */
394
+ line: {
395
+ text: string;
396
+ at: string;
397
+ } | null;
398
+ startedAt: string;
399
+ /** When a settled worker last spoke, or its session ended. */
400
+ finishedAt: string | null;
401
+ /** The result it declared, when it did. */
402
+ result: string | null;
403
+ /** The question it is parked on, while one is owed. */
404
+ asking: string | null;
405
+ /** The model stamped at birth (what it was CONFIGURED to run); null =
406
+ * the runtime's own default. */
407
+ model: string | null;
408
+ /** The models its turns ACTUALLY ran (owner 2026-10-06: "what model
409
+ * actually did the work"), each once in first-seen order — a mid-turn
410
+ * switch lists both: the harness's own report (its stream; codex's
411
+ * rollout file read at the turn's end), then the metering gateway's
412
+ * attested record of the model each platform-funded call went to. Never
413
+ * derived from `model`: empty when nothing is on record, and the
414
+ * surfaces then say the model isn't known. Absent on older servers. */
415
+ ranModels?: string[];
416
+ effort: ThreadStatusWorkerEffort | null;
417
+ /** The harness it runs ("claude-code", "codex", ...); null when unknown. */
418
+ runtime: string | null;
419
+ /** Where it runs: a cloud sandbox or the person's machine; null when
420
+ * unknown. */
421
+ executor: "local" | "cloud" | null;
422
+ /** When its running turn started (ISO); null while no turn runs. */
423
+ workingSince: string | null;
424
+ /** When its newest turn ended (ISO): the moment it stopped, while no turn
425
+ * runs. Null while a turn runs, and for a worker that has not run one. */
426
+ lastTurnEndedAt: string | null;
427
+ /** Its machine has a live desktop to show (the Desktop pill's own
428
+ * verdict, for the session's current machine): the chat draws a door to
429
+ * it on the step the worker is on. False for a local session, a machine
430
+ * with no GUI, or a session no longer on a machine. */
431
+ desktopCapable: boolean;
432
+ /** What pays for it, when the record says (see WorkerFunding); null when
433
+ * nothing is on record. Absent on older servers. */
434
+ funding?: WorkerFunding | null;
435
+ }
436
+ /** A message that directed a step: who wrote it and the opening of what
437
+ * they said, where it sits (its chat and, for a reply, the root of its
438
+ * chat thread; null for the chat's top level) and when. */
439
+ export interface ThreadStatusDirector {
440
+ messageId: string;
441
+ conversationId: string;
442
+ threadRootId: string | null;
443
+ /** The person who wrote it, as the status wire names people; null for a
444
+ * message Ivy wrote. */
445
+ author: ProjectStatusPerson | null;
446
+ /** The opening of what they said, in plain words (links read as their
447
+ * labels), capped; null when the message shows no words. */
448
+ excerpt: string | null;
449
+ /** When it was said (ISO). */
450
+ at: string;
451
+ }
452
+ /** Something a worker produced, filed under the step it was on: a desktop
453
+ * screenshot or a capture pushed with a need (`path`, a drive file), or
454
+ * its declared result (`text`, its words). */
455
+ export interface ThreadStatusOutput {
456
+ id: string;
457
+ kind: "screenshot" | "capture" | "result";
458
+ /** When it landed (ISO). */
459
+ at: string;
460
+ /** The drive path of a picture; null for words. */
461
+ path: string | null;
462
+ /** The words: a result's own, a picture's summary. */
463
+ text: string;
464
+ }
465
+ /** What a person did on a todo in the chat's todo view (owner 2026-10-05):
466
+ * a comment, or an edit of its assignee, details, status or whom it waits
467
+ * on. The todo's Activity, with the platform's own history. */
468
+ export interface ThreadStatusTodoActivity {
469
+ id: string;
470
+ /** When (ISO). */
471
+ at: string;
472
+ kind: "comment" | "assignee" | "description" | "status" | "waiting_on";
473
+ /** Who did it; null for a person the workspace cannot name. */
474
+ by: ProjectStatusPerson | null;
475
+ /** A comment's words, or the details written; null otherwise. */
476
+ text: string | null;
477
+ /** The assignee set (`kind` assignee); null for nobody. */
478
+ assignee: ThreadStatusAssignee | null;
479
+ /** The status set (`kind` status). */
480
+ status: "open" | "in_progress" | "waiting" | "done" | null;
481
+ /** The people set (`kind` waiting_on). */
482
+ waitingOn: ProjectStatusPerson[];
483
+ }
484
+ /** One step of the thread's plan. */
485
+ export interface ThreadStatusTodo {
486
+ id: string;
487
+ objective: string;
488
+ status: "open" | "done";
489
+ dueAt: string | null;
490
+ overdue: boolean;
491
+ /** Open and waiting on a step that is not done. */
492
+ blocked: boolean;
493
+ /** The steps it waits on, by their objective. */
494
+ blockedOn: string[];
495
+ /** Open and waiting on people. */
496
+ waitingOn: ThreadStatusWaitingOn | null;
497
+ /** Who it is assigned to: Ivy, one person, or nobody (owner 2026-10-05).
498
+ * Stored on the server; the plan's default is the first person it waits
499
+ * on, else Ivy, and a person's choice stands over the plan's. */
500
+ assignee: ThreadStatusAssignee | null;
501
+ /** The details a person wrote on it, plain text with line breaks; null
502
+ * when none. */
503
+ description: string | null;
504
+ /** What people did on it (edits and comments), oldest first, bounded. */
505
+ activity: ThreadStatusTodoActivity[];
506
+ /** Its done criteria, as counts. */
507
+ criteria: {
508
+ met: number;
509
+ total: number;
510
+ };
511
+ /** The thread's worker on this step (the thread agent's stamp), or null. */
512
+ workerConversationId: string | null;
513
+ /** Done, and completed with this note: what it produced, in one line. */
514
+ result: string | null;
515
+ /** When a worker was first put on the step (ISO): its own clock in the
516
+ * chat, never a worker's turn. Null until then. */
517
+ startedAt: string | null;
518
+ /** Done at this moment (ISO): when its check-off lands in the chat. Null
519
+ * while open. */
520
+ completedAt: string | null;
521
+ /** The messages that directed the step (the request or follow-up that
522
+ * added it, then every steer, from another chat thread too), oldest
523
+ * first. Empty = the job's request alone. The step's status shows in the
524
+ * chat thread of each. */
525
+ directedBy: ThreadStatusDirector[];
526
+ /** What the worker produced for the step, newest first (bounded): its
527
+ * screenshots and captures, and its declared result. */
528
+ outputs: ThreadStatusOutput[];
529
+ }
530
+ /** One of the last things that happened on the thread: a worker's stream
531
+ * event (its type), or the thread's record ("said" for a person's words,
532
+ * "raised" for what the agent put to the people, "worker_result", ...). */
533
+ export interface ThreadStatusEvent {
534
+ at: string;
535
+ kind: string;
536
+ text: string;
537
+ by: ProjectStatusPerson | null;
538
+ }
539
+ /** One thread's work, as the card under the message that started it reads
540
+ * it: the thread, the root it opened on, the note, its workers and its
541
+ * steps. */
542
+ export interface ChatWorkThread {
543
+ thread: ProjectStatusThread;
544
+ /** The message the thread opened on, in this chat: the job's request —
545
+ * who asked for it, their words, where it sits (the job's started mark
546
+ * shows there) and when. Null when the thread opened on no message here
547
+ * (the chat shows no card for it, but its workers still count in the
548
+ * chat's working status), or the viewer cannot see it. */
549
+ request: ThreadStatusDirector | null;
550
+ /** The job's latest place: the newest agent-authored message after the
551
+ * request in the request's own chat thread (the thread under a room
552
+ * request, or the reply thread the request sits in), else the room's
553
+ * newest after it for a room request answered inline. "Jump to latest"
554
+ * lands here. Null while nothing has answered; the request is then its
555
+ * place. */
556
+ latestMessageId: string | null;
557
+ /** The chat thread that latest message sits in (null for the room's top
558
+ * level); null with no latest message. */
559
+ latestThreadRootId: string | null;
560
+ /** The thread agent's rolling note: where things stand, in its words. */
561
+ summary: string | null;
562
+ /** When the thread was opened (ISO): the job's start, the beginning of
563
+ * its total time. */
564
+ openedAt: string;
565
+ /** Working first, then starting, then what settled (newest first). */
566
+ workers: ThreadStatusWorker[];
567
+ /** The plan's steps, in plan order (oldest first). */
568
+ todos: ThreadStatusTodo[];
569
+ }
570
+ export interface ThreadStatus extends ChatWorkThread {
571
+ events: ThreadStatusEvent[];
572
+ generatedAt: string;
573
+ }
574
+ /** GET /conversations/:id/work: the chat's threads, most recently moved
575
+ * first and bounded (the server's CHAT_WORK_THREADS), each with its work.
576
+ * 404 for a chat the viewer cannot read. */
577
+ export interface ChatWork {
578
+ threads: ChatWorkThread[];
579
+ /** The project the chat is filed in, as the viewer may see it; null for
580
+ * a chat in none. A todo's Properties name it. */
581
+ project: {
582
+ id: string;
583
+ name: string;
584
+ } | null;
585
+ generatedAt: string;
586
+ }
587
+ /** PATCH /conversations/:id/todos/:todoId (owner 2026-10-05: "change the
588
+ * assignee", "write details in here myself"): what a person who can read
589
+ * the chat may change on a todo. Each field is optional; one call may
590
+ * carry several. Answers the chat's whole work read (ChatWork), so the
591
+ * surfaces redraw from one truth. */
592
+ export interface ChatTodoPatch {
593
+ /** The one assignee: Ivy, a person who can read the chat, or null for
594
+ * nobody. */
595
+ assignee?: {
596
+ kind: "ivy";
597
+ } | {
598
+ kind: "person";
599
+ userId: string;
600
+ } | null;
601
+ /** The details, plain text with line breaks; null or "" clears. */
602
+ description?: string | null;
603
+ /** Where it stands, in the plan's own states: open (not started), in
604
+ * progress, waiting (on the people given, or the ones it already waits
605
+ * on), done. A done todo stays done. */
606
+ status?: "open" | "in_progress" | "waiting" | "done";
607
+ /** Whom it waits on: people who can read the chat (several allowed), and
608
+ * for what; [] or null clears the wait. */
609
+ waitingOn?: {
610
+ userIds: string[];
611
+ what?: string | null;
612
+ } | null;
613
+ }
614
+ /** POST /conversations/:id/todos/:todoId/comments: a comment on the todo,
615
+ * which lands in its Activity and reaches the thread's agent. Answers the
616
+ * chat's whole work read. */
617
+ export interface ChatTodoComment {
618
+ text: string;
619
+ }
620
+ export interface MeStatusCounts {
621
+ waitingOnYou: number;
622
+ inProgress: number;
623
+ /** The viewer's projects with a relevant live thread. */
624
+ projects: number;
625
+ doneThisWeek: number;
626
+ }
627
+ /** GET /me/status, for the current workspace: the threads relevant to the
628
+ * viewer (they posted, were mentioned, asked, have a to-do, or are in the
629
+ * chat), never the whole workspace. `threads` is cursor-paginated by last
630
+ * movement; `waitingOnYou`, `recentlyClosed` and `activity` ride the first
631
+ * page. The client groups by `chatProjects` (the viewer's project for each
632
+ * chat; a chat absent there is in none of theirs). */
633
+ export interface MeStatus {
634
+ counts: MeStatusCounts;
635
+ /** Live threads a task of which waits on the viewer, or whose worker's
636
+ * question is owed and the viewer asked for the work (else spoke last). */
637
+ waitingOnYou: ProjectStatusThread[];
638
+ threads: ProjectStatusThread[];
639
+ recentlyClosed: ProjectStatusThread[];
640
+ chatProjects: Array<{
641
+ conversationId: string;
642
+ project: {
643
+ id: string;
644
+ name: string;
645
+ };
646
+ }>;
647
+ activity: Array<ProjectStatusActivity & {
648
+ conversationId: string | null;
649
+ }>;
650
+ generatedAt: string;
651
+ next_cursor: string | null;
652
+ }
@@ -90,6 +90,14 @@ export interface InvokeInlineAndWaitOptions extends InvokeInlineOptions {
90
90
  }
91
91
  export interface InvokeResult {
92
92
  id: string;
93
+ /** The run is PARKED for its funding plan's reset: the person whose plan
94
+ * pays for it has every plan out, so nothing runs until `until`, when it
95
+ * starts by itself; `text` is the one line to pass on. Absent for a run
96
+ * that boots now. */
97
+ hold?: {
98
+ until: string;
99
+ text: string;
100
+ };
93
101
  }
94
102
  export interface StreamRunLogsOptions {
95
103
  lastEventId?: number;
@@ -311,6 +319,81 @@ export interface ListRunsOptions {
311
319
  sort?: "newest" | "oldest" | "fastest" | "slowest";
312
320
  limit?: number;
313
321
  }
322
+ /** What started a run (`GET /factories/:slug/workflow-activity*`), read off
323
+ * the dispatch stamps: a schedule's tick, a thread's scripted check, the
324
+ * chat an agent's turn dispatched it from, the person who invoked it from
325
+ * the dashboard, or the API key (the CLI, a script). */
326
+ export type RunStartedBy = {
327
+ kind: "schedule";
328
+ name: string | null;
329
+ } | {
330
+ kind: "check";
331
+ } | {
332
+ kind: "chat";
333
+ conversationId: string;
334
+ title: string | null;
335
+ } | {
336
+ kind: "person";
337
+ userId: string;
338
+ name: string;
339
+ image: string | null;
340
+ avatarUrl: string | null;
341
+ } | {
342
+ kind: "key";
343
+ name: string;
344
+ } | {
345
+ kind: "unknown";
346
+ };
347
+ /** One run in a space's workflow activity: the runs list's summary plus
348
+ * what started it. */
349
+ export interface WorkflowActivityRun extends RunListEntry {
350
+ finalSummary: string | null;
351
+ /** Structured return value from the workflow, when it completed. */
352
+ output: unknown;
353
+ startedBy: RunStartedBy;
354
+ }
355
+ /** One stack in a space's workflow activity: a workflow that has run there
356
+ * and its latest run. */
357
+ export interface WorkflowActivityHead {
358
+ workflow: string;
359
+ latestRun: WorkflowActivityRun;
360
+ }
361
+ export interface ListWorkflowActivityOptions {
362
+ /** Factory the runs live in. Defaults to "default". */
363
+ factorySlug?: string;
364
+ /** Stacks per page (1–50, server default 20). */
365
+ limit?: number;
366
+ /** The previous page's `nextCursor`. */
367
+ cursor?: string;
368
+ /** A search (at most 100 characters): every run whose workflow name,
369
+ * title, failure or summary contains it, without case — reaching past
370
+ * the last 90 days the listing shows without one. */
371
+ q?: string;
372
+ }
373
+ export interface ListWorkflowRunsOptions {
374
+ /** Factory the runs live in. Defaults to "default". */
375
+ factorySlug?: string;
376
+ /** The registered workflow name, exactly. */
377
+ workflow: string;
378
+ /** Runs per page (1–50, server default 10). */
379
+ limit?: number;
380
+ /** The previous page's `nextCursor`. */
381
+ cursor?: string;
382
+ /** A search (at most 100 characters): the workflow's runs whose title,
383
+ * failure or summary contains it, without case — reaching past the last
384
+ * 90 days the listing shows without one. */
385
+ q?: string;
386
+ }
387
+ export interface WorkflowActivityPage {
388
+ workflows: WorkflowActivityHead[];
389
+ hasMore: boolean;
390
+ nextCursor: string | null;
391
+ }
392
+ export interface WorkflowRunsPage {
393
+ runs: WorkflowActivityRun[];
394
+ hasMore: boolean;
395
+ nextCursor: string | null;
396
+ }
314
397
  export interface TimelineEvent {
315
398
  kind: string;
316
399
  at: string;
@@ -32,9 +32,10 @@ export type DocumentCapability = "read" | "write";
32
32
  * regardless of call context — read-only, never act. */
33
33
  export type TemplateCapability = "read" | "write" | "invoke" | "see_runs";
34
34
  /** One grant on an artifact scope. `team`/`user` are the editable tiers
35
- * carried on a PUT (full-replace); `session`/`project` are DERIVED,
36
- * read-only arms that appear only on READ payloads (the routes that manage
37
- * them own their mutation — a scope PUT rejects them, 400 `invalid_principal`).
35
+ * carried on a PUT (full-replace); `session`/`project`/`conversation`/
36
+ * `worker` are DERIVED, read-only arms that appear only on READ payloads
37
+ * (the routes that manage them own their mutation — a scope PUT rejects
38
+ * them, 400 `invalid_principal`).
38
39
  *
39
40
  * Session and project grants carry FIXED capabilities `['read','write']`:
40
41
  * the fs-gateway is concealment-only (no read/write dimension at the mount),
@@ -62,6 +63,30 @@ export type ScopeGrant = {
62
63
  * being a project member (share implies unshare). Null only for
63
64
  * transitional/legacy rows. */
64
65
  projectObjectId: string | null;
66
+ /** The people in the project: the row's reach. */
67
+ memberCount: number;
68
+ capabilities: string[];
69
+ }
70
+ /** A chat's grant (scope-at-birth, documents): reach derives LIVE from the
71
+ * chat's tier and member rows. `memberCount` is null for a public channel,
72
+ * whose audience is the whole team rather than its member rows. */
73
+ | {
74
+ principal: "conversation";
75
+ conversationId: string;
76
+ conversationTitle: string | null;
77
+ memberCount: number | null;
78
+ capabilities: string[];
79
+ }
80
+ /** The grant a chat's WORKER session holds on what it wrote: not a group
81
+ * of people. The readers of the chat it works for (`chatId`) reach the
82
+ * file through it while the worker's project boundary holds. `title` is
83
+ * the work's (the session's) title. */
84
+ | {
85
+ principal: "worker";
86
+ conversationId: string;
87
+ title: string | null;
88
+ chatId: string;
89
+ chatTitle: string | null;
65
90
  capabilities: string[];
66
91
  };
67
92
  /** An artifact's share scope (documents and templates — one model).
@@ -74,6 +99,10 @@ export interface ArtifactScope {
74
99
  /** Templates only — the owning conversation binding (a grant source:
75
100
  * members of that conversation reach the template via their role). */
76
101
  conversationId?: string | null;
102
+ /** Documents only — born of a shared chat's work (Ivy's publish, a
103
+ * worker's output for a chat). Such a document is shared by the people
104
+ * who can edit it, whoever its owner is; so is one with no owner. */
105
+ bornOfChatWork?: boolean;
77
106
  grants: ScopeGrant[];
78
107
  }
79
108
  /** The call context stamped on a run at dispatch (ADR-0045 §3) — the