@agentex/agent 0.0.32 → 0.0.34

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/src/types.ts CHANGED
@@ -63,6 +63,13 @@ export interface ProviderCapabilities {
63
63
  * process — the model is not involved.
64
64
  */
65
65
  stopTask: boolean;
66
+ /**
67
+ * Provider emits first-class `background_task` StreamEvents for work that
68
+ * can outlive the root turn, such as async subagents and backgrounded
69
+ * processes. Absent/false means callers must not infer task lifecycle from
70
+ * provider-specific `unknown` events.
71
+ */
72
+ backgroundTaskEvents?: boolean;
66
73
  /**
67
74
  * Provider exposes selectable operating modes via `listModes()` — e.g. Codex
68
75
  * collaboration modes, Copilot's allow-all/agent/plan. When `false`,
@@ -985,6 +992,21 @@ export interface BaseStreamEventFields {
985
992
  raw: Record<string, unknown>;
986
993
  }
987
994
 
995
+ /** Provider-neutral category for work that may outlive its launching turn. */
996
+ export type BackgroundTaskType = "subagent" | "process" | "unknown";
997
+
998
+ /** Lifecycle edge represented by one `background_task` StreamEvent. */
999
+ export type BackgroundTaskPhase = "started" | "progress" | "completed";
1000
+
1001
+ /** Current normalized state carried by a `background_task` event. */
1002
+ export type BackgroundTaskStatus =
1003
+ | "pending"
1004
+ | "running"
1005
+ | "paused"
1006
+ | "completed"
1007
+ | "failed"
1008
+ | "stopped";
1009
+
988
1010
  /**
989
1011
  * Categorical reason for an `auth_required` event. Derived from the
990
1012
  * provider's user-facing error text. Stable across providers — new
@@ -1176,6 +1198,26 @@ export type StreamEvent =
1176
1198
  tokenBudget?: number;
1177
1199
  iterations?: number;
1178
1200
  } & BaseStreamEventFields)
1201
+ /**
1202
+ * Lifecycle for work that is independent from the root turn. In particular,
1203
+ * `phase: "completed"` settles only this task. It is never a root turn
1204
+ * result and must not be used to resolve `SendHandle.result`.
1205
+ *
1206
+ * Events are reducer-friendly snapshots. `status` is always populated,
1207
+ * while description/summary may be null when the provider did not report
1208
+ * them. `parentTaskId` identifies a nested background task when that lineage
1209
+ * is available.
1210
+ */
1211
+ | ({
1212
+ type: "background_task";
1213
+ taskId: string;
1214
+ taskType: BackgroundTaskType;
1215
+ phase: BackgroundTaskPhase;
1216
+ status: BackgroundTaskStatus;
1217
+ description: string | null;
1218
+ summary: string | null;
1219
+ parentTaskId: string | null;
1220
+ } & BaseStreamEventFields)
1179
1221
  | ({
1180
1222
  type: "result";
1181
1223
  text: string;