@jini-ai/chat 0.7.3-next.4 → 0.7.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.7.4
2
+
3
+ ### Changes
4
+
5
+ - Add reusable assistant sessions, durable run bindings, AG-UI resume support, and host-supplied browser ports.
6
+ - Keep the current answer controller when an older answer settles, simplify pin controls, and declare Zod as a required runtime dependency.
7
+
1
8
  ## 0.7.2
2
9
 
3
10
  ### Patch Changes
package/README.md CHANGED
@@ -315,3 +315,38 @@ relays each request through the existing `chat.send_message` capability.
315
315
  `./core/durable-runs/run-finalizer` holds a host run finalizer's pure slices (checkpoint growth and
316
316
  size rules, `reportSafely`, `releaseUnreadBody`, and the `RunTimerPort`/`RunLogPort` types). The host
317
317
  injects its timer and log through those ports and keeps the ledger, daemon client and watch state.
318
+
319
+ ### Desktop/site conversation actions (`@jini-ai/chat/react`)
320
+
321
+ `ConversationList` accepts optional `creationActions: ConversationCreationActions`:
322
+
323
+ ```ts
324
+ import type { ConversationCreationActions } from '@jini-ai/chat/react';
325
+
326
+ declare const createDesktopChat: () => Promise<void>;
327
+ declare const chooseSiteAndCreateChat: () => Promise<void>;
328
+ declare const canCreateSiteChat: boolean;
329
+
330
+ const creationActions: ConversationCreationActions = {
331
+ desktop: { onCreate: createDesktopChat },
332
+ site: { onCreate: chooseSiteAndCreateChat, disabled: !canCreateSiteChat },
333
+ };
334
+ ```
335
+
336
+ Providing both destinations replaces the legacy New button with plus/monitor and plus/globe
337
+ icon buttons, labelled and translated as "New desktop chat" and "New site chat". The existing
338
+ `createDisabled` gate disables both; a destination's `disabled` gates only that button. Omitting
339
+ `creationActions` retains the existing `onCreate` action. Failed creation reports through `report`
340
+ and never falls back to a different destination or inserts a temporary conversation row.
341
+
342
+ Hosts provide `kind: 'desktop' | 'site'` on list/search/create summaries. The list renders a
343
+ translated "Desktop chat" or "Site chat" ownership icon. Missing kind stays unclassified. Title
344
+ cleanup and sorting preserve kind; the assistant-chat hook retains it on creation and rename.
345
+ These labels describe transcript ownership, independently of available tools or the active site.
346
+ The host still owns durable storage, destination choice, row updates and selection after creation.
347
+
348
+ Admin hosts can pass the same actions in `DockHeader`'s `conversationTools.listProps.creationActions`
349
+ or bind `DockCleanupHeader`'s optional `creationActions` prop in their existing header wrapper.
350
+ The latter retains the shared cleanup controls. The admin dock's existing chat i18n adapter
351
+ translates all four labels in its 21 supported non-English locales. Button styling reuses
352
+ `jini-conv-new`; the ownership marker exposes `jini-conv-item-kind` for host styling.
@@ -0,0 +1,43 @@
1
+ import { type AGUIEvent } from '@ag-ui/core';
2
+ type Empty = Record<string, never>;
3
+ /** A delivery envelope is a request to the host's authorized page bridge, never authority itself. */
4
+ export interface AgUiBrowserInvocation {
5
+ readonly runId: string;
6
+ readonly action: {
7
+ readonly invocationId: string;
8
+ readonly capabilityId: string;
9
+ readonly input: Record<string, unknown>;
10
+ };
11
+ }
12
+ export interface AgUiBrowserDeliveryPorts {
13
+ readonly toolCallName: string;
14
+ readonly maxToolArgsChars: number;
15
+ /** Revokes live delivery for this attachment; it does not cancel the host's durable run. */
16
+ readonly signal: AbortSignal;
17
+ /** The host still performs claim/begin and page authorization before executing anything. */
18
+ readonly deliver: (required: AgUiBrowserInvocation, optional: Empty) => void;
19
+ }
20
+ export interface AgUiBrowserDeliverySegment {
21
+ /** Accept only SDK-validated live events. True consumes tool frames before transcript reduction. */
22
+ observe(required: {
23
+ event: AGUIEvent;
24
+ }, optional?: Empty): boolean;
25
+ /** Call on EOF, stream failure or disconnect to discard incomplete arguments. */
26
+ close(required: Empty, optional?: Empty): void;
27
+ }
28
+ export interface AgUiBrowserDelivery {
29
+ /** One instance per logical turn. Replacing a segment revokes the old segment immediately. */
30
+ beginSegment(required: {
31
+ threadId: string;
32
+ runId: string;
33
+ }, optional?: Empty): AgUiBrowserDeliverySegment;
34
+ /** Call on final turn settlement or document replacement; later segments stay inert. */
35
+ dispose(required: Empty, optional?: Empty): void;
36
+ }
37
+ /** Decode live browser delivery across one logical turn's start and approval-resume segments.
38
+ * Never feed saved/replayed transcripts here. Logical-run pinning and local deduplication contain
39
+ * delivery mistakes; the host's page bridge owns identity, admission and execution permissions.
40
+ */
41
+ export declare function createAgUiBrowserDelivery(ports: AgUiBrowserDeliveryPorts, _optional?: Empty): AgUiBrowserDelivery;
42
+ export {};
43
+ //# sourceMappingURL=ag-ui-browser-delivery.d.ts.map
@@ -0,0 +1,113 @@
1
+ import { EventType } from '@ag-ui/core';
2
+ import { createAgUiToAgentTranslationState, translateAgUiEventToAgentEvent } from '../ag-ui/event-reduction.js';
3
+ function toolFrame({ event }, _optional = {}) {
4
+ switch (event.type) {
5
+ case EventType.TOOL_CALL_START:
6
+ case EventType.TOOL_CALL_ARGS:
7
+ case EventType.TOOL_CALL_END:
8
+ case EventType.TOOL_CALL_RESULT: return event;
9
+ default: return undefined;
10
+ }
11
+ }
12
+ function record({ value }, _optional = {}) {
13
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
14
+ ? value : undefined;
15
+ }
16
+ function readInvocation({ toolCallId, value }, _optional = {}) {
17
+ const envelope = record({ value });
18
+ if (!envelope || !toolCallId || envelope.invocationId !== toolCallId)
19
+ return undefined;
20
+ if (typeof envelope.runId !== 'string' || !envelope.runId.trim())
21
+ return undefined;
22
+ if (typeof envelope.capabilityId !== 'string' || !envelope.capabilityId.trim())
23
+ return undefined;
24
+ const input = record({ value: envelope.input });
25
+ if (!input)
26
+ return undefined;
27
+ return { runId: envelope.runId, action: { invocationId: toolCallId, capabilityId: envelope.capabilityId, input } };
28
+ }
29
+ function closeSegment({ segment }, _optional = {}) {
30
+ segment.closed = true;
31
+ segment.reduction.toolCalls.clear();
32
+ }
33
+ function matches({ event, segment }, _optional = {}) {
34
+ return event.threadId === segment.threadId && event.runId === segment.runId;
35
+ }
36
+ function observeLifecycle({ event, segment }, _optional = {}) {
37
+ if (event.type === EventType.RUN_STARTED && matches({ event, segment }))
38
+ segment.started = true;
39
+ if (event.type === EventType.RUN_ERROR)
40
+ closeSegment({ segment });
41
+ if (event.type === EventType.RUN_FINISHED && segment.started && matches({ event, segment }))
42
+ closeSegment({ segment });
43
+ }
44
+ function deliverInvocation({ state, invocation }, _optional = {}) {
45
+ state.logicalRunId ??= invocation.runId;
46
+ if (state.logicalRunId !== invocation.runId || state.delivered.has(invocation.action.invocationId))
47
+ return;
48
+ // Record before crossing the host boundary: a throw or reentrant delivery is an uncertain effect,
49
+ // never permission to submit the same invocation again. Server claim/begin remains authoritative.
50
+ state.delivered.add(invocation.action.invocationId);
51
+ state.ports.deliver(invocation, {});
52
+ }
53
+ function observeTool({ event, segment, state }, _optional = {}) {
54
+ if (!segment.started || segment.closed || event.type === EventType.TOOL_CALL_RESULT)
55
+ return;
56
+ const [tool] = translateAgUiEventToAgentEvent({ event, state: segment.reduction });
57
+ if (tool?.kind !== 'tool_use')
58
+ return;
59
+ const invocation = readInvocation({ toolCallId: tool.id, value: tool.input });
60
+ if (invocation)
61
+ deliverInvocation({ state, invocation });
62
+ }
63
+ function beginSegment({ state, threadId, runId }, _optional = {}) {
64
+ if (state.segment)
65
+ closeSegment({ segment: state.segment });
66
+ const segment = { threadId, runId, started: false, closed: state.disposed,
67
+ reduction: createAgUiToAgentTranslationState({
68
+ // This decoder receives only tool frames; custom data never reaches its reducer.
69
+ customEventNames: { usage: '', status: '', extensionPrefix: '' },
70
+ }, { acceptToolCall: ({ toolCallName }) => toolCallName === state.ports.toolCallName,
71
+ maxToolArgsChars: state.ports.maxToolArgsChars }) };
72
+ state.segment = segment;
73
+ return {
74
+ observe({ event }, _optional = {}) {
75
+ const tool = toolFrame({ event });
76
+ if (state.disposed || segment.closed || state.segment !== segment)
77
+ return Boolean(tool);
78
+ observeLifecycle({ event, segment });
79
+ if (tool)
80
+ observeTool({ event: tool, segment, state });
81
+ return Boolean(tool);
82
+ },
83
+ close(_required, _optional = {}) { closeSegment({ segment }); },
84
+ };
85
+ }
86
+ /** Decode live browser delivery across one logical turn's start and approval-resume segments.
87
+ * Never feed saved/replayed transcripts here. Logical-run pinning and local deduplication contain
88
+ * delivery mistakes; the host's page bridge owns identity, admission and execution permissions.
89
+ */
90
+ export function createAgUiBrowserDelivery(ports, _optional = {}) {
91
+ if (!Number.isSafeInteger(ports.maxToolArgsChars) || ports.maxToolArgsChars <= 0) {
92
+ throw new RangeError('Browser tool arguments need a positive safe integer character limit');
93
+ }
94
+ const state = { ports, delivered: new Set(), disposed: false };
95
+ const dispose = () => {
96
+ state.disposed = true;
97
+ if (state.segment)
98
+ closeSegment({ segment: state.segment });
99
+ state.delivered.clear();
100
+ ports.signal.removeEventListener('abort', dispose);
101
+ };
102
+ ports.signal.addEventListener('abort', dispose, { once: true });
103
+ if (ports.signal.aborted)
104
+ dispose();
105
+ return {
106
+ beginSegment({ threadId, runId }, _optional = {}) {
107
+ // A full RunAgentInput also has state; only segment ids may cross into private delivery state.
108
+ return beginSegment({ state, threadId, runId });
109
+ },
110
+ dispose(_required, _optional = {}) { dispose(); },
111
+ };
112
+ }
113
+ //# sourceMappingURL=ag-ui-browser-delivery.js.map
@@ -0,0 +1,60 @@
1
+ import { type AGUIEvent, type RunAgentInput } from '@ag-ui/core';
2
+ import { type AgUiConfirmationInterrupt } from './ag-ui-approval-relay.js';
3
+ type Empty = Record<string, never>;
4
+ type SegmentIds = Pick<RunAgentInput, 'threadId' | 'runId'>;
5
+ export interface AgUiConfirmationSessionPorts {
6
+ readonly mintId: (required: Empty, optional: Empty) => string;
7
+ /** Start a segment on the SAME logical turn; report HTTP acceptance, not stream completion.
8
+ * The host owns refusals, public copy, identity, headers, abort and the fetch agent subscription. */
9
+ readonly resume: (required: {
10
+ input: RunAgentInput;
11
+ }, optional: Empty) => Promise<boolean>;
12
+ /** Independent best-effort delivery: must not use the stopped attachment's aborted signal.
13
+ * The host retains identity checks and expiry remains the server's fallback denial. */
14
+ readonly cancel: (required: {
15
+ input: RunAgentInput;
16
+ }, optional: Empty) => Promise<void>;
17
+ /** Keep host card field bounds, challenge format and public presentation in the host. */
18
+ readonly acceptConfirmation: (required: {
19
+ interrupt: AgUiConfirmationInterrupt;
20
+ }, optional: Empty) => boolean;
21
+ readonly onConfirmation: (required: {
22
+ interrupt: AgUiConfirmationInterrupt | null;
23
+ }, optional: Empty) => void;
24
+ /** Report/settle a thrown resume failure using host-safe copy. A false acceptance is already
25
+ * reported by the host's HTTP refusal path and does not call this hook a second time. */
26
+ readonly onResumeError: (required: {
27
+ error: unknown;
28
+ }, optional: Empty) => void;
29
+ }
30
+ export type AgUiConfirmationObservation = 'pass' | 'parked' | 'invalid' | 'closed';
31
+ export interface AgUiConfirmationSegment {
32
+ /** Live SDK-validated events only, before transcript reduction. A parked interrupt consumes its
33
+ * terminal; invalid requires host failure/settlement, and closed consumes all late events. */
34
+ observe(required: {
35
+ event: AGUIEvent;
36
+ }, optional?: Empty): AgUiConfirmationObservation;
37
+ /** EOF/disconnect revokes callbacks but preserves an already parked answer right. */
38
+ close(required: Empty, optional?: Empty): void;
39
+ }
40
+ export interface AgUiConfirmationSession {
41
+ beginSegment(required: SegmentIds, optional?: Empty): AgUiConfirmationSegment;
42
+ answer(required: {
43
+ interruptId: string;
44
+ allow: boolean;
45
+ }, optional?: Empty): Promise<boolean>;
46
+ /** Stop/unmount competes for the pending interrupt with the same first-answer latch as clicks. */
47
+ stop(required: Empty, optional?: Empty): void;
48
+ /** Final settlement revokes live rights without posting cancellation. */
49
+ dispose(required: Empty, optional?: Empty): void;
50
+ }
51
+ /** One live confirmation session per logical turn. This is the challenge-addressed composition
52
+ * for hosts without exchange metadata; durable admin exchange routing remains in the relay.
53
+ * It never reads saved transcripts, posts a new turn, authorizes tools, or retries an answer.
54
+ */
55
+ export declare function createAgUiConfirmationSession({ signal, ports }: {
56
+ signal: AbortSignal;
57
+ ports: AgUiConfirmationSessionPorts;
58
+ }, _optional?: Empty): AgUiConfirmationSession;
59
+ export {};
60
+ //# sourceMappingURL=ag-ui-confirmation-session.d.ts.map
@@ -0,0 +1,138 @@
1
+ import { EventType } from '@ag-ui/core';
2
+ import { createAgUiAnswerOnce, createAgUiResumeInput, readAgUiConfirmationInterrupt } from './ag-ui-approval-relay.js';
3
+ function clearPending({ state }, _optional = {}) {
4
+ if (!state.pending)
5
+ return;
6
+ state.pending = undefined;
7
+ state.ports.onConfirmation({ interrupt: null }, {});
8
+ }
9
+ function dispose({ state }, _optional = {}) {
10
+ if (state.disposed)
11
+ return;
12
+ state.disposed = true;
13
+ state.signal.removeEventListener('abort', state.onAbort);
14
+ if (state.segment)
15
+ state.segment.closed = true;
16
+ state.seen.clear();
17
+ clearPending({ state });
18
+ }
19
+ function stop({ state }, _optional = {}) {
20
+ const pending = state.pending;
21
+ try {
22
+ dispose({ state });
23
+ }
24
+ finally {
25
+ // Disposal must precede host I/O; the parked latch survives just long enough to select
26
+ // cancellation. An allow/deny already in flight keeps its original choice.
27
+ void pending?.answer.answer({ choice: 'cancelled' }).catch(() => { });
28
+ }
29
+ }
30
+ function resumeInput({ state, pending, decision }, _optional = {}) {
31
+ const { threadId, parentRunId, interruptId } = pending.interrupt;
32
+ return createAgUiResumeInput({ threadId, parentRunId, interruptId, decision,
33
+ runId: state.ports.mintId({}, {}) });
34
+ }
35
+ function reportFailure({ state, pending, decision, error }, _optional = {}) {
36
+ // Detached cards cannot report into a newer turn, and cancellation is best effort only.
37
+ if (decision === 'cancelled' || state.disposed || state.pending !== pending)
38
+ return;
39
+ dispose({ state });
40
+ state.ports.onResumeError({ error }, {});
41
+ }
42
+ async function submit({ state, pending, decision }, _optional = {}) {
43
+ if (decision !== 'cancelled' && (state.disposed || state.pending !== pending))
44
+ return false;
45
+ pending.claimed = true;
46
+ try {
47
+ const input = resumeInput({ state, pending, decision });
48
+ if (decision === 'cancelled') {
49
+ void state.ports.cancel({ input }, {}).catch(() => { });
50
+ return false;
51
+ }
52
+ const accepted = await state.ports.resume({ input }, {});
53
+ if (!accepted && state.pending === pending)
54
+ dispose({ state });
55
+ return accepted;
56
+ }
57
+ catch (error) {
58
+ reportFailure({ state, pending, decision, error });
59
+ return false;
60
+ }
61
+ }
62
+ function park({ state, interrupt }, _optional = {}) {
63
+ const pending = { interrupt, claimed: false,
64
+ answer: createAgUiAnswerOnce({
65
+ submit: ({ choice }) => submit({ state, pending, decision: choice }),
66
+ }) };
67
+ state.pending = pending;
68
+ state.seen.add(interrupt.interruptId);
69
+ // Install the answer right before rendering: a host can synchronously Stop from this callback.
70
+ state.ports.onConfirmation({ interrupt }, {});
71
+ }
72
+ function matches({ event, segment }, _optional = {}) {
73
+ return event.threadId === segment.threadId && event.runId === segment.runId;
74
+ }
75
+ function observe({ state, segment, event }, _optional = {}) {
76
+ if (state.disposed || state.segment !== segment || segment.closed)
77
+ return 'closed';
78
+ if (event.type === EventType.RUN_STARTED && matches({ event, segment }))
79
+ segment.started = true;
80
+ if (event.type === EventType.RUN_ERROR)
81
+ segment.closed = true;
82
+ if (event.type !== EventType.RUN_FINISHED || !segment.started || !matches({ event, segment }))
83
+ return 'pass';
84
+ return observeFinish({ state, segment, event });
85
+ }
86
+ function observeFinish({ state, segment, event }, _optional = {}) {
87
+ segment.closed = true;
88
+ if (event.outcome?.type !== 'interrupt')
89
+ return 'pass';
90
+ const interrupt = readAgUiConfirmationInterrupt({ event });
91
+ if (!interrupt || state.seen.has(interrupt.interruptId))
92
+ return 'invalid';
93
+ if (!state.ports.acceptConfirmation({ interrupt }, {}))
94
+ return 'invalid';
95
+ if (state.disposed || state.segment !== segment)
96
+ return 'closed';
97
+ park({ state, interrupt });
98
+ return 'parked';
99
+ }
100
+ function beginSegment({ state, threadId, runId }, _optional = {}) {
101
+ if (state.segment)
102
+ state.segment.closed = true;
103
+ // A replacement cannot carry an unanswered old card. Keep a claimed latch until the next
104
+ // approval so duplicate clicks still share the first promise while resume opens its segment.
105
+ if (!state.pending?.claimed)
106
+ clearPending({ state });
107
+ const segment = { threadId, runId, started: false, closed: state.disposed };
108
+ state.segment = segment;
109
+ return {
110
+ observe({ event }, _optional = {}) { return observe({ state, segment, event }); },
111
+ close(_required, _optional = {}) { segment.closed = true; },
112
+ };
113
+ }
114
+ /** One live confirmation session per logical turn. This is the challenge-addressed composition
115
+ * for hosts without exchange metadata; durable admin exchange routing remains in the relay.
116
+ * It never reads saved transcripts, posts a new turn, authorizes tools, or retries an answer.
117
+ */
118
+ export function createAgUiConfirmationSession({ signal, ports }, _optional = {}) {
119
+ const state = { signal, ports, seen: new Set(), disposed: false, onAbort: () => { } };
120
+ state.onAbort = () => stop({ state });
121
+ signal.addEventListener('abort', state.onAbort, { once: true });
122
+ if (signal.aborted)
123
+ stop({ state });
124
+ return {
125
+ beginSegment({ threadId, runId }, _optional = {}) {
126
+ // A full RunAgentInput also has state; only segment ids may cross into private session state.
127
+ return beginSegment({ state, threadId, runId });
128
+ },
129
+ answer({ interruptId, allow }, _optional = {}) {
130
+ if (state.disposed || state.pending?.interrupt.interruptId !== interruptId)
131
+ return Promise.resolve(false);
132
+ return state.pending.answer.answer({ choice: allow ? 'allow' : 'deny' });
133
+ },
134
+ stop(_required, _optional = {}) { stop({ state }); },
135
+ dispose(_required, _optional = {}) { dispose({ state }); },
136
+ };
137
+ }
138
+ //# sourceMappingURL=ag-ui-confirmation-session.js.map
@@ -0,0 +1,85 @@
1
+ import { EventType, type AGUIEvent, type RunAgentInput } from '@ag-ui/core';
2
+ import type { AgentEvent } from '@jini-ai/core/contracts/site/chat-core';
3
+ import { type AgUiBrowserDeliveryPorts } from './ag-ui-browser-delivery.js';
4
+ import { type AgUiConfirmationSessionPorts } from './ag-ui-confirmation-session.js';
5
+ type Empty = Record<string, never>;
6
+ type ConfirmationPorts = Omit<AgUiConfirmationSessionPorts, 'resume' | 'onResumeError'>;
7
+ type BrowserPorts = Omit<AgUiBrowserDeliveryPorts, 'signal'>;
8
+ /** Private diagnostic data for a host classifier, never public copy or persisted transcript. */
9
+ export type AgUiLiveTurnFailure = {
10
+ readonly kind: 'request' | 'stream' | 'refusal';
11
+ readonly error: unknown;
12
+ } | {
13
+ readonly kind: 'run';
14
+ readonly event: Extract<AGUIEvent, {
15
+ type: EventType.RUN_ERROR;
16
+ }>;
17
+ } | {
18
+ readonly kind: 'no-reply' | 'incomplete' | 'timeout' | 'invalid-interrupt';
19
+ };
20
+ export interface AgUiLiveTurnResult {
21
+ readonly outcome: 'finished' | 'failed' | 'stopped';
22
+ /** Text only; a failed partial transcript must not be saved as a successful answer. */
23
+ readonly events: readonly AgentEvent[];
24
+ /** Live-only terminal result; host policy decides whether to release deferred page work. */
25
+ readonly result?: unknown;
26
+ }
27
+ export interface AgUiLiveTurnPorts {
28
+ /** Host owns optional-page fallback, attachment identity and admission policy. */
29
+ readonly headers: (required: {
30
+ signal: AbortSignal;
31
+ }, optional: Empty) => Promise<HeadersInit>;
32
+ /** Host owns route, exact AG-UI Accept header, cookie/origin policy and credentials. */
33
+ readonly request: (required: {
34
+ input: RunAgentInput;
35
+ headers: HeadersInit;
36
+ signal: AbortSignal;
37
+ }, optional: Empty) => Promise<Response>;
38
+ /** Parse/validate refusal details in the host; even a hanging parser is interruptible. */
39
+ readonly refusal: (required: {
40
+ response: Response;
41
+ signal: AbortSignal;
42
+ }, optional: Empty) => Promise<unknown>;
43
+ readonly onEvent: (required: {
44
+ event: AgentEvent;
45
+ }, optional: Empty) => void;
46
+ /** Must classify/redact diagnostics and translate public copy before displaying it. */
47
+ readonly onFailure: (required: {
48
+ failure: AgUiLiveTurnFailure;
49
+ }, optional: Empty) => void;
50
+ readonly onDone: (required: AgUiLiveTurnResult, optional: Empty) => void;
51
+ /** Snapshot original cancellation identity and retire page work BEFORE confirmation cancellation. */
52
+ readonly onStop: (required: Empty, optional: Empty) => void;
53
+ }
54
+ export interface AgUiLiveTurnSegment {
55
+ /** First HTTP acceptance report, independent of body completion; never retries a POST. */
56
+ readonly accepted: Promise<boolean>;
57
+ /** Segment delivery ends on EOF, pause, terminal or Stop. A pause leaves the logical turn live. */
58
+ readonly completed: Promise<void>;
59
+ }
60
+ export interface AgUiLiveTurn {
61
+ /** Attachment lifetime. This runner is for live, non-durable turns; abort means Stop. */
62
+ readonly signal: AbortSignal;
63
+ startSegment(required: {
64
+ input: RunAgentInput;
65
+ }, optional?: Empty): AgUiLiveTurnSegment;
66
+ answer(required: {
67
+ interruptId: string;
68
+ allow: boolean;
69
+ }, optional?: Empty): Promise<boolean>;
70
+ stop(required: Empty, optional?: Empty): void;
71
+ }
72
+ /** One opt-in, non-durable logical turn across start and confirmation resumes. Hosts retain
73
+ * request construction, identity, admission, safe copy and authorized page execution. Never feed
74
+ * replay/history through this runner. Durable detach/recovery uses the canonical run bindings.
75
+ */
76
+ export declare function createAgUiLiveTurn({ signal, ports, idleTimeoutMs, approvalTimeoutMs, confirmation, browser }: {
77
+ signal: AbortSignal;
78
+ ports: AgUiLiveTurnPorts;
79
+ idleTimeoutMs: number;
80
+ approvalTimeoutMs: number;
81
+ confirmation?: ConfirmationPorts;
82
+ browser?: BrowserPorts;
83
+ }, _optional?: Empty): AgUiLiveTurn;
84
+ export {};
85
+ //# sourceMappingURL=ag-ui-live-turn.d.ts.map