@opengeni/react 0.23.0 → 0.25.5
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/dist/{chunk-UQS7OQDE.js → chunk-F4CFWKVI.js} +334 -64
- package/dist/chunk-F4CFWKVI.js.map +1 -0
- package/dist/chunk-GQN2QIR2.js +3767 -0
- package/dist/chunk-GQN2QIR2.js.map +1 -0
- package/dist/{chunk-I3BJZIG5.js → chunk-HIWPQYWI.js} +2 -120
- package/dist/chunk-HIWPQYWI.js.map +1 -0
- package/dist/chunk-M7X4JZOD.js +121 -0
- package/dist/chunk-M7X4JZOD.js.map +1 -0
- package/dist/{chunk-UAHPKLB6.js → chunk-MP6237JB.js} +571 -975
- package/dist/chunk-MP6237JB.js.map +1 -0
- package/dist/chunk-OZDLELJQ.js +937 -0
- package/dist/chunk-OZDLELJQ.js.map +1 -0
- package/dist/{chunk-CATATY77.js → chunk-TMH6HZWF.js} +8 -7
- package/dist/chunk-TMH6HZWF.js.map +1 -0
- package/dist/{chunk-6XUS5VFM.js → chunk-YU5PGUK7.js} +6 -4
- package/dist/{chunk-6XUS5VFM.js.map → chunk-YU5PGUK7.js.map} +1 -1
- package/dist/{composer-CVm5uoUI.d.ts → composer-DoC4veX1.d.ts} +6 -63
- package/dist/composer.d.ts +3 -2
- package/dist/composer.js +4 -3
- package/dist/fleet-decision-projection-SLNZMS42.js +241 -0
- package/dist/fleet-decision-projection-SLNZMS42.js.map +1 -0
- package/dist/fleet-decision-row-GGCAT4E4.js +351 -0
- package/dist/fleet-decision-row-GGCAT4E4.js.map +1 -0
- package/dist/index.d.ts +17 -259
- package/dist/index.js +1042 -5058
- package/dist/index.js.map +1 -1
- package/dist/machines.js +3 -2
- package/dist/session-Du_FsrZ1.d.ts +264 -0
- package/dist/session-ui-BqQDH7YV.d.ts +183 -0
- package/dist/session-ui.d.ts +7 -0
- package/dist/session-ui.js +17 -0
- package/dist/session-ui.js.map +1 -0
- package/dist/session.d.ts +4 -2
- package/dist/session.js +26 -9
- package/dist/{use-composer-By1wn3MM.d.ts → use-composer-BnEzheSk.d.ts} +8 -2
- package/dist/use-file-attachments-C0kpHrs9.d.ts +76 -0
- package/dist/use-turn-queue-3rkJwjFv.d.ts +290 -0
- package/package.json +6 -2
- package/src/components/composer.tsx +7 -6
- package/src/components/message-timeline.tsx +94 -54
- package/src/hooks/use-composer.ts +470 -73
- package/src/hooks/use-file-attachments.ts +96 -3
- package/src/hooks/use-goal.ts +23 -5
- package/src/hooks/use-session-events.ts +5 -0
- package/src/hooks/use-session-lineage.ts +1 -1
- package/src/hooks/use-session.ts +9 -6
- package/src/hooks/use-workspace-sessions.ts +30 -5
- package/src/session-ui.ts +13 -0
- package/src/session.ts +15 -0
- package/src/timeline/activity-rail.tsx +18 -2
- package/src/timeline/fleet-decision-projection.ts +366 -0
- package/src/timeline/fleet-decision-row.tsx +412 -0
- package/src/timeline/index.ts +2 -0
- package/src/timeline/projection.ts +19 -8
- package/src/timeline/tool-display-name.ts +16 -0
- package/src/timeline/tool-renderers.tsx +1 -1
- package/src/timeline/types.ts +68 -1
- package/dist/chunk-CATATY77.js.map +0 -1
- package/dist/chunk-I3BJZIG5.js.map +0 -1
- package/dist/chunk-UAHPKLB6.js.map +0 -1
- package/dist/chunk-UQS7OQDE.js.map +0 -1
- package/dist/session-Db00TRwl.d.ts +0 -446
|
@@ -1,446 +0,0 @@
|
|
|
1
|
-
import { E as EmbeddedSessionClientOverride, e as EmbeddedSessionMcpApprovalPolicyClientOverride, f as EmbeddedHumanInputClientOverride } from './session-context-rgrfElMl.js';
|
|
2
|
-
import { ToolAuthNeededPayload, ResourceRef, ToolRef, SessionStatus, SessionEvent, StreamConnectionState, SessionQueueSnapshot, SessionTurn, EffectiveSessionControl, ComposerDraft, SessionControlResponse, SessionMcpServerMetadata, SessionMcpApprovalPolicy, UpdateSessionMcpApprovalPolicyResponse, HumanInputQuestion, SessionHumanInputRequest, SubmitHumanInputResponseRequest } from '@opengeni/sdk';
|
|
3
|
-
import { S as SessionEventFeedOptions } from './use-composer-By1wn3MM.js';
|
|
4
|
-
|
|
5
|
-
type UserMessageItem = {
|
|
6
|
-
kind: "user-message";
|
|
7
|
-
id: string;
|
|
8
|
-
text: string;
|
|
9
|
-
/** Resources attached to this message (file uploads, repositories). */
|
|
10
|
-
resources: ResourceRef[];
|
|
11
|
-
/** Tools requested for the turn this message starts. */
|
|
12
|
-
tools: ToolRef[];
|
|
13
|
-
occurredAt: string;
|
|
14
|
-
};
|
|
15
|
-
type AgentMessageItem = {
|
|
16
|
-
kind: "agent-message";
|
|
17
|
-
id: string;
|
|
18
|
-
turnId: string | null;
|
|
19
|
-
text: string;
|
|
20
|
-
/** Still receiving deltas (no completed/turn-end seen yet). */
|
|
21
|
-
streaming: boolean;
|
|
22
|
-
occurredAt: string;
|
|
23
|
-
};
|
|
24
|
-
type ReasoningItem = {
|
|
25
|
-
kind: "reasoning";
|
|
26
|
-
id: string;
|
|
27
|
-
turnId: string | null;
|
|
28
|
-
text: string;
|
|
29
|
-
streaming: boolean;
|
|
30
|
-
occurredAt: string;
|
|
31
|
-
};
|
|
32
|
-
type ToolCallItem = {
|
|
33
|
-
kind: "tool-call";
|
|
34
|
-
id: string;
|
|
35
|
-
turnId: string | null;
|
|
36
|
-
callId: string | null;
|
|
37
|
-
name: string;
|
|
38
|
-
arguments: unknown;
|
|
39
|
-
output: unknown;
|
|
40
|
-
/**
|
|
41
|
-
* The provider-native tool item (`agent.toolCall.created.payload.raw`). Carries
|
|
42
|
-
* `type` (e.g. `apply_patch_call`, `computer_call`, `hosted_tool_call`) and the
|
|
43
|
-
* tool-specific fields the per-tool renderers read (`operation`, `action`,
|
|
44
|
-
* `providerData`, …). `undefined` for first-party MCP tools, which carry their
|
|
45
|
-
* payload in `arguments`/`output` instead.
|
|
46
|
-
*/
|
|
47
|
-
raw: unknown;
|
|
48
|
-
status: "running" | "complete" | "failed" | "cancelled";
|
|
49
|
-
occurredAt: string;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* An orchestration call against another session — the manager spawning or
|
|
53
|
-
* messaging a worker. Rendered as a first-class "worker" row, not a generic
|
|
54
|
-
* tool call.
|
|
55
|
-
*/
|
|
56
|
-
type WorkerItem = {
|
|
57
|
-
kind: "worker";
|
|
58
|
-
id: string;
|
|
59
|
-
turnId: string | null;
|
|
60
|
-
callId: string | null;
|
|
61
|
-
action: "spawn" | "message";
|
|
62
|
-
/** The worker's initial message / the message sent to it, when parseable. */
|
|
63
|
-
prompt: string | null;
|
|
64
|
-
/** The target/spawned worker session id, when parseable from args/output. */
|
|
65
|
-
workerSessionId: string | null;
|
|
66
|
-
status: "running" | "complete" | "failed" | "cancelled";
|
|
67
|
-
occurredAt: string;
|
|
68
|
-
};
|
|
69
|
-
type WorkerCompletionItem = {
|
|
70
|
-
kind: "worker-completion";
|
|
71
|
-
id: string;
|
|
72
|
-
turnId: string | null;
|
|
73
|
-
occurredAt: string;
|
|
74
|
-
childSessionId: string;
|
|
75
|
-
childStatus: string;
|
|
76
|
-
goalStatus: string | null;
|
|
77
|
-
goalText: string | null;
|
|
78
|
-
evidence: string | null;
|
|
79
|
-
pausedReason: string | null;
|
|
80
|
-
text: string;
|
|
81
|
-
};
|
|
82
|
-
type SandboxItem = {
|
|
83
|
-
kind: "sandbox";
|
|
84
|
-
id: string;
|
|
85
|
-
turnId: string | null;
|
|
86
|
-
name: string;
|
|
87
|
-
command: string | null;
|
|
88
|
-
output: string;
|
|
89
|
-
origin?: "created" | "restored" | "resumed" | null;
|
|
90
|
-
status: "running" | "complete" | "failed" | "cancelled";
|
|
91
|
-
occurredAt: string;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* A first-party workspace-memory write the agent made mid-turn — a `memory.saved`
|
|
95
|
-
* (it committed a new preference / fact / procedure / decision / history) or a
|
|
96
|
-
* `memory.corrected` (it updated or archived an existing one). A settled save is
|
|
97
|
-
* ordinary progress, not an exceptional state, so it renders as a calm NEUTRAL
|
|
98
|
-
* step on the rail (never accent/color). When the host app supplies an
|
|
99
|
-
* `onMemoryClick` handler the row also deep-links to the record in its memory
|
|
100
|
-
* pane; without one it is non-interactive rich content.
|
|
101
|
-
*/
|
|
102
|
-
type MemoryItem = {
|
|
103
|
-
kind: "memory";
|
|
104
|
-
id: string;
|
|
105
|
-
turnId: string | null;
|
|
106
|
-
variant: "saved" | "corrected";
|
|
107
|
-
/** The memory's kind enum (`"preference" | "semantic" | …`); mapped to a human label at render. */
|
|
108
|
-
memoryKind: string;
|
|
109
|
-
/** The memory text, ellipsized to ≤120 chars server-side. For a supersede this is the OLD text. */
|
|
110
|
-
preview: string;
|
|
111
|
-
/** The save collapsed into an existing memory (no new row was written). Saved variant only. */
|
|
112
|
-
deduped?: boolean;
|
|
113
|
-
/** The NEW text when a correction superseded the memory with a replacement; absent = updated-in-place or archived. */
|
|
114
|
-
replacementPreview?: string;
|
|
115
|
-
/**
|
|
116
|
-
* What a `memory.corrected` did: `"superseded"` (replaced by a new record, see
|
|
117
|
-
* `replacementPreview`), `"updated"` (edited in place — the record lives on), or
|
|
118
|
-
* `"archived"` (retired). Distinguishes updated-in-place from archived when there
|
|
119
|
-
* is no replacement. Corrected variant only; read defensively (may be absent).
|
|
120
|
-
*/
|
|
121
|
-
action?: string;
|
|
122
|
-
/** The saved / corrected memory's id — the deep-link target for a save. */
|
|
123
|
-
memoryId: string;
|
|
124
|
-
/** The replacement memory's id when a correction produced one — the LIVE record the deep-link targets. */
|
|
125
|
-
replacementMemoryId?: string;
|
|
126
|
-
occurredAt: string;
|
|
127
|
-
};
|
|
128
|
-
type SessionStatusItem = {
|
|
129
|
-
kind: "session-status";
|
|
130
|
-
id: string;
|
|
131
|
-
status: SessionStatus;
|
|
132
|
-
occurredAt: string;
|
|
133
|
-
};
|
|
134
|
-
type GoalItem = {
|
|
135
|
-
kind: "goal";
|
|
136
|
-
id: string;
|
|
137
|
-
action: "set" | "updated" | "completed" | "paused" | "resumed" | "cleared" | "continuation";
|
|
138
|
-
text: string | null;
|
|
139
|
-
occurredAt: string;
|
|
140
|
-
};
|
|
141
|
-
type NoticeItem = {
|
|
142
|
-
kind: "notice";
|
|
143
|
-
id: string;
|
|
144
|
-
tone: "waiting" | "cancelled" | "failed";
|
|
145
|
-
text: string;
|
|
146
|
-
/** Optional evidence kept inspectable without overwhelming the main rail. */
|
|
147
|
-
details?: {
|
|
148
|
-
label: string;
|
|
149
|
-
value: unknown;
|
|
150
|
-
};
|
|
151
|
-
action?: {
|
|
152
|
-
label: string;
|
|
153
|
-
url: string;
|
|
154
|
-
};
|
|
155
|
-
occurredAt: string;
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* A tool call hit a missing or lapsed connection. The broker reports that
|
|
159
|
-
* condition as a tool error and the turn continues; reconnecting never resumes
|
|
160
|
-
* or replays the original call. Carries the structured `tool.auth_needed`
|
|
161
|
-
* payload so the renderer can draw a clean inline recovery affordance (provider
|
|
162
|
-
* logo + one human line + a Connect/Reconnect button) and the app can start the
|
|
163
|
-
* right flow (OAuth reconnect for the surviving connection, or credential
|
|
164
|
-
* re-entry for an api-key one). The `reason` shapes the human copy but is never
|
|
165
|
-
* shown raw.
|
|
166
|
-
*/
|
|
167
|
-
type AuthNeededItem = {
|
|
168
|
-
kind: "auth-needed";
|
|
169
|
-
id: string;
|
|
170
|
-
turnId: string | null;
|
|
171
|
-
/** The connection's registrable domain, e.g. "linear.app". */
|
|
172
|
-
providerDomain: string;
|
|
173
|
-
/** The lapsed connection to reconnect, when the row survived. */
|
|
174
|
-
connectionId: string | null;
|
|
175
|
-
reason: ToolAuthNeededPayload["reason"] | null;
|
|
176
|
-
/** Scopes the provider now needs; may inform the copy, never shown as a raw label. */
|
|
177
|
-
scopes: string[];
|
|
178
|
-
/** The OAuth `resource` (RFC 8707) the reconnect should target, when supplied. */
|
|
179
|
-
resource: string | null;
|
|
180
|
-
/** The tool whose call triggered the reauth, for context. */
|
|
181
|
-
toolName: string | null;
|
|
182
|
-
/** A pre-minted authorization URL, when the broker already produced one. */
|
|
183
|
-
authorizationUrl: string | null;
|
|
184
|
-
occurredAt: string;
|
|
185
|
-
};
|
|
186
|
-
type TurnOutcome = "complete" | "failed" | "cancelled";
|
|
187
|
-
type TurnEndItem = {
|
|
188
|
-
kind: "turn-end";
|
|
189
|
-
id: string;
|
|
190
|
-
turnId: string | null;
|
|
191
|
-
outcome: TurnOutcome;
|
|
192
|
-
failureText: string | null;
|
|
193
|
-
occurredAt: string;
|
|
194
|
-
};
|
|
195
|
-
type TimelineItem = UserMessageItem | AgentMessageItem | ReasoningItem | ToolCallItem | WorkerItem | WorkerCompletionItem | SandboxItem | SessionStatusItem | GoalItem | NoticeItem | AuthNeededItem | MemoryItem | TurnEndItem;
|
|
196
|
-
/** Activity items cluster between chat messages (reasoning, tools, workers, sandbox, memory). */
|
|
197
|
-
type ActivityItem = ReasoningItem | ToolCallItem | WorkerItem | SandboxItem | MemoryItem;
|
|
198
|
-
type TimelineGroup = {
|
|
199
|
-
kind: "item";
|
|
200
|
-
item: TimelineItem;
|
|
201
|
-
} | {
|
|
202
|
-
kind: "activity";
|
|
203
|
-
id: string;
|
|
204
|
-
items: ActivityItem[];
|
|
205
|
-
outcome?: TurnOutcome;
|
|
206
|
-
failureText?: string;
|
|
207
|
-
} | {
|
|
208
|
-
kind: "turn";
|
|
209
|
-
id: string;
|
|
210
|
-
outcome: TurnOutcome;
|
|
211
|
-
failureText?: string;
|
|
212
|
-
startedAt: string;
|
|
213
|
-
endedAt: string;
|
|
214
|
-
groups: TimelineGroup[];
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
type SessionEventsConnectionState = StreamConnectionState | "idle" | "ended" | "error";
|
|
218
|
-
type UseSessionEventsOptions = EmbeddedSessionClientOverride & {
|
|
219
|
-
/** Resume after this sequence (exclusive). Nonzero keeps full replay/resume semantics. */
|
|
220
|
-
after?: number | undefined;
|
|
221
|
-
/** Load a bounded tail by default, or opt back into full replay from `after`. */
|
|
222
|
-
replay?: "windowed" | "full" | undefined;
|
|
223
|
-
/** Pause the stream without unmounting (e.g. hidden tab). Defaults to true. */
|
|
224
|
-
enabled?: boolean | undefined;
|
|
225
|
-
};
|
|
226
|
-
type UseSessionEventsResult = {
|
|
227
|
-
/** Replayed + live events, ordered by sequence, no gaps, no duplicates. */
|
|
228
|
-
events: SessionEvent[];
|
|
229
|
-
/** Projected, renderable timeline (memoized over `events`). */
|
|
230
|
-
timeline: TimelineItem[];
|
|
231
|
-
/** Latest session status observed in the event log, if any. */
|
|
232
|
-
sessionStatus: SessionStatus | null;
|
|
233
|
-
connectionState: SessionEventsConnectionState;
|
|
234
|
-
/** Highest sequence seen so far (0 before the first event). */
|
|
235
|
-
lastSequence: number;
|
|
236
|
-
/** Exact serialized bytes retained in the current browser event window. */
|
|
237
|
-
windowBytes: number;
|
|
238
|
-
/** Whether older delivered events were evicted from the browser window. */
|
|
239
|
-
windowTruncated: boolean;
|
|
240
|
-
/** True until the initial tail window has been applied (windowed mode). */
|
|
241
|
-
initialLoading: boolean;
|
|
242
|
-
/** Whether older durable events are available before the current window. */
|
|
243
|
-
hasOlder: boolean;
|
|
244
|
-
/** True while an older window is being fetched. */
|
|
245
|
-
loadingOlder: boolean;
|
|
246
|
-
/** Prepend an older density-bounded window; resolves true when more remain. */
|
|
247
|
-
loadOlder: () => Promise<boolean>;
|
|
248
|
-
error: Error | null;
|
|
249
|
-
};
|
|
250
|
-
declare const SESSION_EVENT_BROWSER_MAX_BYTES: number;
|
|
251
|
-
declare const SESSION_EVENT_BROWSER_MAX_COUNT = 10000;
|
|
252
|
-
declare const SESSION_EVENT_BROWSER_SINGLE_EVENT_MAX_BYTES: number;
|
|
253
|
-
declare const SESSION_EVENT_BROWSER_PENDING_MAX_BYTES: number;
|
|
254
|
-
declare const SESSION_EVENT_BROWSER_PENDING_MAX_COUNT = 256;
|
|
255
|
-
type BrowserSessionEventWindow = {
|
|
256
|
-
events: SessionEvent[];
|
|
257
|
-
bytes: number;
|
|
258
|
-
truncated: boolean;
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* Live-stream a session's event log with replay-by-sequence, reconnect, and
|
|
262
|
-
* batched React updates. Fresh loads default to a bounded tail window; pass
|
|
263
|
-
* `replay: "full"` or a nonzero `after` for the previous full replay path.
|
|
264
|
-
*/
|
|
265
|
-
declare function useSessionEvents(sessionId: string | null | undefined, options?: UseSessionEventsOptions): UseSessionEventsResult;
|
|
266
|
-
/**
|
|
267
|
-
* Keep one direction-aware count+byte-bounded browser window. Live/default
|
|
268
|
-
* accumulation retains the newest suffix; backward paging retains the oldest
|
|
269
|
-
* prefix so newly fetched history cannot be immediately evicted. This is
|
|
270
|
-
* deliberately separate from durable history and transport paging: when a
|
|
271
|
-
* backward page evicts the live tail, the hook reconnects from the retained
|
|
272
|
-
* high-water mark while preserving the highest-ever-observed sequence
|
|
273
|
-
* separately. The source event remains durable in PostgreSQL throughout.
|
|
274
|
-
*/
|
|
275
|
-
declare function boundBrowserSessionEventWindow(events: readonly SessionEvent[], options?: {
|
|
276
|
-
maxBytes?: number;
|
|
277
|
-
maxCount?: number;
|
|
278
|
-
direction?: "newest" | "oldest";
|
|
279
|
-
}): BrowserSessionEventWindow;
|
|
280
|
-
|
|
281
|
-
/** Events that can change the authoritative prompt queue or effective control. */
|
|
282
|
-
declare function isTurnQueueEvent(event: Pick<SessionEvent, "type">): boolean;
|
|
283
|
-
type QueueMutationKind = "move" | "edit" | "steer" | "delete";
|
|
284
|
-
type UseTurnQueueOptions = EmbeddedSessionClientOverride & SessionEventFeedOptions & {
|
|
285
|
-
pollIntervalMs?: number | undefined;
|
|
286
|
-
};
|
|
287
|
-
type UseTurnQueueResult = {
|
|
288
|
-
snapshot: SessionQueueSnapshot | null;
|
|
289
|
-
/** Human/API prompts exactly in server execution order. Never client-sorted. */
|
|
290
|
-
queue: SessionTurn[];
|
|
291
|
-
effectiveControl: EffectiveSessionControl | null;
|
|
292
|
-
/** The latest interrupted attempt has not yet durably proved physical quiescence. */
|
|
293
|
-
stoppingPreviousAttempt: boolean;
|
|
294
|
-
loading: boolean;
|
|
295
|
-
error: Error | null;
|
|
296
|
-
refresh: () => Promise<void>;
|
|
297
|
-
moveTurn: (turnId: string, beforeTurnId: string | null) => Promise<boolean>;
|
|
298
|
-
/** Atomically withdraw a waiting prompt into the private durable composer draft. */
|
|
299
|
-
editTurn: (turnId: string, options: {
|
|
300
|
-
expectedDraftRevision: number;
|
|
301
|
-
replaceDraft: boolean;
|
|
302
|
-
}) => Promise<ComposerDraft | null>;
|
|
303
|
-
/** Advance the same durable waiting prompt; no duplicate prompt is created. */
|
|
304
|
-
steerTurn: (turnId: string) => Promise<boolean>;
|
|
305
|
-
removeTurn: (turnId: string) => Promise<boolean>;
|
|
306
|
-
pendingByTurn: Readonly<Record<string, QueueMutationKind>>;
|
|
307
|
-
mutationFor: (turnId: string) => QueueMutationKind | null;
|
|
308
|
-
mutating: boolean;
|
|
309
|
-
mutationError: Error | null;
|
|
310
|
-
clearMutationError: () => void;
|
|
311
|
-
};
|
|
312
|
-
/**
|
|
313
|
-
* The one authoritative human prompt queue. Every mutation carries the exact
|
|
314
|
-
* server versions the operator saw and accepts only monotonic snapshots. A
|
|
315
|
-
* conflict immediately reloads server truth; the client never invents order.
|
|
316
|
-
*/
|
|
317
|
-
declare function useTurnQueue(sessionId: string | null | undefined, options?: UseTurnQueueOptions): UseTurnQueueResult;
|
|
318
|
-
|
|
319
|
-
type UseSessionControlOptions = EmbeddedSessionClientOverride;
|
|
320
|
-
type UseSessionControlResult = {
|
|
321
|
-
pause: (reason?: string) => Promise<SessionControlResponse | null>;
|
|
322
|
-
resume: (reason?: string) => Promise<SessionControlResponse | null>;
|
|
323
|
-
controlling: boolean;
|
|
324
|
-
/** Approve a pending `requires_action` approval. */
|
|
325
|
-
approve: (approvalId: string, message?: string) => Promise<SessionEvent | null>;
|
|
326
|
-
/** Reject a pending `requires_action` approval. */
|
|
327
|
-
reject: (approvalId: string, message?: string) => Promise<SessionEvent | null>;
|
|
328
|
-
/** True while an approval decision is in flight. */
|
|
329
|
-
responding: boolean;
|
|
330
|
-
error: Error | null;
|
|
331
|
-
clearError: () => void;
|
|
332
|
-
};
|
|
333
|
-
/**
|
|
334
|
-
* Session pause/resume and approval decisions. Pair with
|
|
335
|
-
* `useSessionEvents` (for `session.requiresAction` payloads carrying the
|
|
336
|
-
* `approvalId`) to render an approval bar.
|
|
337
|
-
*/
|
|
338
|
-
declare function useSessionControl(sessionId: string | null | undefined, options?: UseSessionControlOptions): UseSessionControlResult;
|
|
339
|
-
|
|
340
|
-
declare function isSessionMcpApprovalPolicyEvent(event: Pick<SessionEvent, "type" | "payload">, serverId?: string): boolean;
|
|
341
|
-
type UseSessionMcpApprovalPolicyOptions = EmbeddedSessionMcpApprovalPolicyClientOverride & SessionEventFeedOptions & {
|
|
342
|
-
/** Optional safety-net polling (ms). Off by default; policy events drive refreshes. */
|
|
343
|
-
pollIntervalMs?: number | undefined;
|
|
344
|
-
};
|
|
345
|
-
type UseSessionMcpApprovalPolicyResult = {
|
|
346
|
-
server: SessionMcpServerMetadata | null;
|
|
347
|
-
policy: SessionMcpApprovalPolicy | null;
|
|
348
|
-
loading: boolean;
|
|
349
|
-
error: Error | null;
|
|
350
|
-
refresh: () => Promise<void>;
|
|
351
|
-
update: (policy: SessionMcpApprovalPolicy) => Promise<UpdateSessionMcpApprovalPolicyResponse | null>;
|
|
352
|
-
updating: boolean;
|
|
353
|
-
clearError: () => void;
|
|
354
|
-
};
|
|
355
|
-
/**
|
|
356
|
-
* Read and update one existing session MCP server's approval policy. Updates
|
|
357
|
-
* become effective for the next claimed attempt; current work is unchanged.
|
|
358
|
-
*/
|
|
359
|
-
declare function useSessionMcpApprovalPolicy(sessionId: string | null | undefined, serverId: string | null | undefined, options?: UseSessionMcpApprovalPolicyOptions): UseSessionMcpApprovalPolicyResult;
|
|
360
|
-
|
|
361
|
-
type PendingApproval = {
|
|
362
|
-
/** The id to send back via `user.approvalDecision` (`approvalId`). */
|
|
363
|
-
id: string;
|
|
364
|
-
/** Tool/function name awaiting the decision. */
|
|
365
|
-
name: string;
|
|
366
|
-
arguments?: unknown;
|
|
367
|
-
/** The raw approval entry from the `session.requiresAction` payload. */
|
|
368
|
-
raw?: unknown;
|
|
369
|
-
};
|
|
370
|
-
/** The approvals carried by one `session.requiresAction` payload. */
|
|
371
|
-
declare function approvalsFromRequiresAction(payload: unknown): PendingApproval[];
|
|
372
|
-
/** The approvals still awaiting a decision after replaying `events` in order. */
|
|
373
|
-
declare function projectPendingApprovals(events: SessionEvent[]): PendingApproval[];
|
|
374
|
-
|
|
375
|
-
/** Minimal actionable request shape available from the durable event log. */
|
|
376
|
-
type PendingHumanInputRequest = {
|
|
377
|
-
id: string;
|
|
378
|
-
turnId: string | null;
|
|
379
|
-
questions: HumanInputQuestion[];
|
|
380
|
-
allowSkip: boolean;
|
|
381
|
-
expiresAt: string | null;
|
|
382
|
-
};
|
|
383
|
-
/** Parse one generic `session.humanInput.requested` event defensively. */
|
|
384
|
-
declare function humanInputRequestFromEvent(event: Pick<SessionEvent, "type" | "payload" | "turnId">): PendingHumanInputRequest | null;
|
|
385
|
-
/**
|
|
386
|
-
* Fold a durable event log into the structured requests that are actionable
|
|
387
|
-
* now. Responses remove one request; a terminal owning turn clears any
|
|
388
|
-
* unresolved requests that died with it. Replaying history cannot resurrect a
|
|
389
|
-
* previously answered card.
|
|
390
|
-
*/
|
|
391
|
-
declare function projectPendingHumanInputRequests(events: SessionEvent[]): PendingHumanInputRequest[];
|
|
392
|
-
|
|
393
|
-
/** Events that can create, settle, or invalidate an actionable request. */
|
|
394
|
-
declare function isHumanInputEvent(event: Pick<SessionEvent, "type">): boolean;
|
|
395
|
-
type UseHumanInputRequestsOptions = EmbeddedHumanInputClientOverride & SessionEventFeedOptions & {
|
|
396
|
-
/** Optional safety-net polling. Durable events drive refresh by default. */
|
|
397
|
-
pollIntervalMs?: number | undefined;
|
|
398
|
-
};
|
|
399
|
-
type UseHumanInputRequestsResult = {
|
|
400
|
-
requests: SessionHumanInputRequest[];
|
|
401
|
-
loading: boolean;
|
|
402
|
-
error: Error | null;
|
|
403
|
-
refresh: () => Promise<void>;
|
|
404
|
-
respond: (requestId: string, response: SubmitHumanInputResponseRequest) => Promise<SessionEvent | null>;
|
|
405
|
-
respondingRequestId: string | null;
|
|
406
|
-
mutationError: Error | null;
|
|
407
|
-
clearMutationError: () => void;
|
|
408
|
-
};
|
|
409
|
-
/**
|
|
410
|
-
* Authoritative structured-human-input hook. The server's pending-request
|
|
411
|
-
* table is the read model; events only trigger reconciliation. This lets an
|
|
412
|
-
* embedded host use the same primitive with a shared event feed or its own SDK
|
|
413
|
-
* proxy without rebuilding request lifecycle logic.
|
|
414
|
-
*/
|
|
415
|
-
declare function useHumanInputRequests(sessionId: string | null | undefined, options?: UseHumanInputRequestsOptions): UseHumanInputRequestsResult;
|
|
416
|
-
|
|
417
|
-
declare function buildTimeline(events: SessionEvent[]): TimelineItem[];
|
|
418
|
-
/**
|
|
419
|
-
* Whether the session's most recent turn ended in credit exhaustion — the
|
|
420
|
-
* terminal credit state apps key their "add credits" affordances on. Derived
|
|
421
|
-
* from the LAST turn-end event (completed/failed/cancelled): a later turn that
|
|
422
|
-
* settles any other way (someone topped up and kept working) clears it.
|
|
423
|
-
*/
|
|
424
|
-
declare function creditExhaustedFromEvents(events: SessionEvent[]): boolean;
|
|
425
|
-
/** The latest session status carried in the event log, if any. */
|
|
426
|
-
declare function sessionStatusFromEvents(events: SessionEvent[]): SessionStatus | null;
|
|
427
|
-
declare function groupTimeline(items: TimelineItem[]): TimelineGroup[];
|
|
428
|
-
/**
|
|
429
|
-
* Find a session id in orchestration tool arguments or output. Handles raw
|
|
430
|
-
* objects, JSON strings, and MCP tool results (`{ content: [{ type: "text",
|
|
431
|
-
* text: "{...}" }], structuredContent? }`).
|
|
432
|
-
*/
|
|
433
|
-
declare function extractSessionRef(value: unknown, depth?: number): string | null;
|
|
434
|
-
/**
|
|
435
|
-
* Readable label for a tool call ("session_create" -> "session create").
|
|
436
|
-
*
|
|
437
|
-
* MCP tools are namespaced `<serverId>__<toolName>` (see prefixedMcpToolName),
|
|
438
|
-
* and for catalog-imported servers that serverId is an opaque slug+hash
|
|
439
|
-
* ("mcp-integrations-sh-supabase-com-34ed9dcf1390-0i6tcf8"). De-slugging the
|
|
440
|
-
* whole thing leaked that id into the timeline; strip the server prefix and show
|
|
441
|
-
* just the tool ("list organizations"). Names without the `__` boundary (plain
|
|
442
|
-
* built-ins like "session_create") are unaffected.
|
|
443
|
-
*/
|
|
444
|
-
declare function toolDisplayName(name: string): string;
|
|
445
|
-
|
|
446
|
-
export { useTurnQueue as $, type ActivityItem as A, type BrowserSessionEventWindow as B, buildTimeline as C, creditExhaustedFromEvents as D, extractSessionRef as E, groupTimeline as F, type GoalItem as G, humanInputRequestFromEvent as H, isHumanInputEvent as I, isSessionMcpApprovalPolicyEvent as J, isTurnQueueEvent as K, projectPendingApprovals as L, projectPendingHumanInputRequests as M, type NoticeItem as N, sessionStatusFromEvents as O, type PendingApproval as P, type QueueMutationKind as Q, type ReasoningItem as R, SESSION_EVENT_BROWSER_MAX_BYTES as S, type ToolCallItem as T, type UseTurnQueueResult as U, toolDisplayName as V, type WorkerItem as W, useHumanInputRequests as X, useSessionControl as Y, useSessionEvents as Z, useSessionMcpApprovalPolicy as _, type TurnOutcome as a, type MemoryItem as a0, type WorkerCompletionItem as a1, type TimelineItem as b, type AgentMessageItem as c, type UserMessageItem as d, type AuthNeededItem as e, type PendingHumanInputRequest as f, SESSION_EVENT_BROWSER_MAX_COUNT as g, SESSION_EVENT_BROWSER_PENDING_MAX_BYTES as h, SESSION_EVENT_BROWSER_PENDING_MAX_COUNT as i, SESSION_EVENT_BROWSER_SINGLE_EVENT_MAX_BYTES as j, type SandboxItem as k, type SessionEventsConnectionState as l, type SessionStatusItem as m, type TimelineGroup as n, type TurnEndItem as o, type UseHumanInputRequestsOptions as p, type UseHumanInputRequestsResult as q, type UseSessionControlOptions as r, type UseSessionControlResult as s, type UseSessionEventsOptions as t, type UseSessionEventsResult as u, type UseSessionMcpApprovalPolicyOptions as v, type UseSessionMcpApprovalPolicyResult as w, type UseTurnQueueOptions as x, approvalsFromRequiresAction as y, boundBrowserSessionEventWindow as z };
|