@inixiative/foundry-core 0.5.13 → 0.5.14

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inixiative/foundry-core",
3
- "version": "0.5.13",
3
+ "version": "0.5.14",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -42,6 +42,8 @@ export type StreamEvent =
42
42
  message: string;
43
43
  severity: 'error' | 'warn';
44
44
  timestamp: number;
45
+ /** The thread the error is about, when it is one thread's (the viewer shows it on that thread). */
46
+ threadId?: string;
45
47
  }
46
48
  | ({ kind: 'activity'; timestamp: number } & SystemActivity);
47
49
 
@@ -142,9 +144,21 @@ export class EventStream {
142
144
  return events.slice(-limit);
143
145
  }
144
146
 
145
- /** Push an error event — surfaced as a toast in the viewer UI. */
146
- pushError(source: string, message: string, severity: 'error' | 'warn' = 'error'): void {
147
- this.push({ kind: 'error', source, message, severity, timestamp: Date.now() });
147
+ /** Push an error event — surfaced as a toast in the viewer UI, on its thread when it names one. */
148
+ pushError(
149
+ source: string,
150
+ message: string,
151
+ severity: 'error' | 'warn' = 'error',
152
+ threadId?: string,
153
+ ): void {
154
+ this.push({
155
+ kind: 'error',
156
+ source,
157
+ message,
158
+ severity,
159
+ timestamp: Date.now(),
160
+ ...(threadId ? { threadId } : {}),
161
+ });
148
162
  }
149
163
 
150
164
  /** Push what the system is doing (shown above the composer, never as a toast). */
package/src/index.ts CHANGED
@@ -433,6 +433,7 @@ export {
433
433
  type ThreadPlan,
434
434
  type ThreadPlanItem,
435
435
  type ThreadReference,
436
+ type ThreadScheduled,
436
437
  type ThreadSnooze,
437
438
  type ThreadSpawn,
438
439
  type ThreadStatus,
package/src/thread.ts CHANGED
@@ -214,6 +214,15 @@ export interface ThreadFork {
214
214
  readonly journalSeq: number;
215
215
  }
216
216
 
217
+ /** The schedule run a thread was started for (provenance; a run is top-level). */
218
+ export interface ThreadScheduled {
219
+ readonly scheduleId: string;
220
+ /** The run's id, `schedule:<scheduleId>:<dueAt>`: one run per due time. */
221
+ readonly runId: string;
222
+ /** When the run was due (epoch ms). */
223
+ readonly dueAt: number;
224
+ }
225
+
217
226
  /** How a subagent thread came to be: who spawned it, through what, and its native identity. */
218
227
  export interface ThreadSpawn {
219
228
  readonly via: 'foundry' | 'native-claude' | 'native-codex' | 'host-paseo' | 'host-t3';
@@ -292,6 +301,9 @@ export interface ThreadMeta {
292
301
  /** The thread and point this one was forked from (provenance; a fork is top-level). */
293
302
  forkedFrom?: ThreadFork;
294
303
 
304
+ /** The schedule run this thread was started for. */
305
+ scheduledBy?: ThreadScheduled;
306
+
295
307
  /** How this subagent thread was spawned. */
296
308
  spawn?: ThreadSpawn;
297
309
 
@@ -409,6 +421,8 @@ export interface ThreadConfig {
409
421
  parentThreadId?: string;
410
422
  /** The thread and point this one was forked from. */
411
423
  forkedFrom?: ThreadFork;
424
+ /** The schedule run this thread was started for. */
425
+ scheduledBy?: ThreadScheduled;
412
426
  /** Project that owns this thread. Scopes memory sources and tool calls. */
413
427
  projectId?: string;
414
428
  /** The harness running this thread's main session. */
@@ -466,6 +480,7 @@ export class Thread {
466
480
  branch: opts?.branch,
467
481
  parentThreadId: opts?.parentThreadId,
468
482
  ...(opts?.forkedFrom ? { forkedFrom: opts.forkedFrom } : {}),
483
+ ...(opts?.scheduledBy ? { scheduledBy: opts.scheduledBy } : {}),
469
484
  projectId: opts?.projectId,
470
485
  ...(opts?.worker ? { worker: opts.worker } : {}),
471
486
  ...(opts?.role ? { role: opts.role } : {}),