@webless/agent 0.11.0 → 0.12.1

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/react.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react from 'react';
2
- import { e as AgentIndexVersion, l as AgentPlacementConfig, d as AgentColorScheme, c as AgentBrandingConfig, b as AgentAnalyticsConfig, Y as VisitorToolResultRegistry, i as AgentMessageFeedback, T as ToolStep, n as AgentRailState, o as AgentRailTheme, I as ConversationMessage, k as AgentPanelSubmitOptions, h as AgentInputResponse, D as AgentToolUiSurface, w as AgentToolResultJsonValue, K as FollowUpSuggestion, m as AgentRailPhase, V as VisitorBooking, R as ResolvedVisitorToolResultPresentation } from './panel-controller-rxR75tRa.cjs';
3
- export { A as AGENT_STRUCTURED_TOOL_INPUT_HEADER, a as AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION, f as AgentInputOption, g as AgentInputRequest, p as AgentSearchReferences, q as AgentSearchSource, r as AgentStructuredToolInput, v as AgentToolResult, x as AgentToolUiAction, y as AgentToolUiField, z as AgentToolUiFieldKind, B as AgentToolUiOption, C as AgentToolUiStep, E as AssistEdgeTab, F as AssistTabSide, G as AssistTabVariant, H as Citation, J as DEFAULT_AGENT_PLACEMENT, L as JourneyContext, M as ToolStepState, O as VisitorBookingResultPresentation, P as VisitorSearchResultPresentation, Q as VisitorToolInputResultPresentation, S as VisitorToolResultLink, U as VisitorToolResultPresentation, W as VisitorToolResultPresenter, X as VisitorToolResultPresenterOutput, Z as builtInVisitorToolResultRegistry, _ as defaultAgentRailTheme, $ as defaultDarkAgentRailTheme, a0 as formatAgentStructuredToolInput, a1 as normalizeAgentPlacement, a3 as presentVisitorToolResult } from './panel-controller-rxR75tRa.cjs';
2
+ import { f as AgentIndexVersion, m as AgentPlacementConfig, e as AgentColorScheme, c as AgentBrandingConfig, b as AgentAnalyticsConfig, _ as VisitorToolResultRegistry, d as AgentClient, q as AgentRuntimeHandoffEvent, j as AgentMessageFeedback, T as ToolStep, o as AgentRailState, p as AgentRailTheme, K as ConversationMessage, l as AgentPanelSubmitOptions, i as AgentInputResponse, F as AgentToolUiSurface, y as AgentToolResultJsonValue, M as FollowUpSuggestion, n as AgentRailPhase, V as VisitorBooking, R as ResolvedVisitorToolResultPresentation } from './panel-controller-DbDHLs4L.cjs';
3
+ export { A as AGENT_STRUCTURED_TOOL_INPUT_HEADER, a as AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION, g as AgentInputOption, h as AgentInputRequest, r as AgentSearchReferences, s as AgentSearchSource, t as AgentStructuredToolInput, x as AgentToolResult, z as AgentToolUiAction, B as AgentToolUiField, C as AgentToolUiFieldKind, D as AgentToolUiOption, E as AgentToolUiStep, G as AssistEdgeTab, H as AssistTabSide, I as AssistTabVariant, J as Citation, L as DEFAULT_AGENT_PLACEMENT, N as JourneyContext, P as ToolStepState, Q as VisitorBookingResultPresentation, S as VisitorSearchResultPresentation, U as VisitorToolInputResultPresentation, W as VisitorToolResultLink, X as VisitorToolResultPresentation, Y as VisitorToolResultPresenter, Z as VisitorToolResultPresenterOutput, $ as builtInVisitorToolResultRegistry, a0 as defaultAgentRailTheme, a1 as defaultDarkAgentRailTheme, a2 as formatAgentStructuredToolInput, a3 as normalizeAgentPlacement, a5 as presentVisitorToolResult } from './panel-controller-DbDHLs4L.cjs';
4
+ import 'zod';
4
5
 
5
6
  type AgentWidgetProps = {
6
7
  indexId: string;
@@ -9,6 +10,7 @@ type AgentWidgetProps = {
9
10
  previewBuildId?: string;
10
11
  version?: AgentIndexVersion;
11
12
  runtimeOrigin?: string;
13
+ handoffEnabled?: boolean;
12
14
  placement?: Partial<AgentPlacementConfig>;
13
15
  defaultCollapsed?: boolean;
14
16
  pageShift?: boolean;
@@ -18,7 +20,70 @@ type AgentWidgetProps = {
18
20
  analytics?: AgentAnalyticsConfig;
19
21
  toolResultRegistry?: VisitorToolResultRegistry;
20
22
  };
21
- declare function AgentWidget({ indexId, customerId, getUnpublishedPreviewGrant, previewBuildId, version, runtimeOrigin, placement: placementInput, defaultCollapsed, pageShift, registerPanelController, colorScheme, branding, analytics, toolResultRegistry, }: AgentWidgetProps): react.JSX.Element;
23
+ declare function AgentWidget({ indexId, customerId, getUnpublishedPreviewGrant, previewBuildId, version, runtimeOrigin, handoffEnabled, placement: placementInput, defaultCollapsed, pageShift, registerPanelController, colorScheme, branding, analytics, toolResultRegistry, }: AgentWidgetProps): react.JSX.Element;
24
+
25
+ declare function useAgentHandoff(options: {
26
+ enabled: boolean;
27
+ client: AgentClient;
28
+ sessionId: string | undefined;
29
+ onEvents: (events: AgentRuntimeHandoffEvent[]) => void;
30
+ onOwnership: () => void;
31
+ }): {
32
+ page: {
33
+ apiVersion: "webless.ai/agent-runtime-handoff/v1";
34
+ sessionId: string;
35
+ enabled: boolean;
36
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
37
+ handoffId: string | null;
38
+ epoch: number;
39
+ after: number;
40
+ cursor: number;
41
+ hasMore: boolean;
42
+ events: ({
43
+ type: "status";
44
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
45
+ actor: {
46
+ id: string;
47
+ name: string;
48
+ } | null;
49
+ id: string;
50
+ sequence: number;
51
+ handoffId: string;
52
+ epoch: number;
53
+ createdAt: string;
54
+ } | {
55
+ type: "visitor.message";
56
+ message: string;
57
+ operationId: string;
58
+ id: string;
59
+ sequence: number;
60
+ handoffId: string;
61
+ epoch: number;
62
+ createdAt: string;
63
+ } | {
64
+ type: "human.message";
65
+ message: string;
66
+ actor: {
67
+ id: string;
68
+ name: string;
69
+ };
70
+ id: string;
71
+ sequence: number;
72
+ handoffId: string;
73
+ epoch: number;
74
+ createdAt: string;
75
+ })[];
76
+ } | null;
77
+ busy: boolean;
78
+ error: string | null;
79
+ hasPending: boolean;
80
+ canReset: boolean;
81
+ blocksAI: boolean;
82
+ start: () => Promise<void>;
83
+ send: (message: string) => Promise<void>;
84
+ returnToAI: () => Promise<void>;
85
+ retry: () => Promise<void>;
86
+ };
22
87
 
23
88
  declare function MessageActions({ answeredAt, copyText, disabled, onOpenReceipt, onRegenerate, onFeedback, readAloud, receiptSteps, speechText, }: {
24
89
  answeredAt?: number;
@@ -35,6 +100,7 @@ declare function MessageActions({ answeredAt, copyText, disabled, onOpenReceipt,
35
100
 
36
101
  type AgentRailProps = {
37
102
  state: AgentRailState;
103
+ handoff?: ReturnType<typeof useAgentHandoff>;
38
104
  theme?: Partial<AgentRailTheme>;
39
105
  colorScheme?: AgentColorScheme;
40
106
  brandLabel?: string;
@@ -63,9 +129,10 @@ type AgentRailProps = {
63
129
  onInputResponse?: (response: AgentInputResponse) => void;
64
130
  onToolInput?: (surface: AgentToolUiSurface, values: Record<string, AgentToolResultJsonValue>) => void;
65
131
  };
66
- declare function AgentRail({ state, theme, colorScheme, brandLabel, brandLogoUrl, poweredByLabel, disclaimerLabel, disclaimerLink, answerReceipt, readAloud, composerPlaceholder, mobileFullscreen, expanded, onCollapse, onClose, onExpandToggle, onReset, onRetry, onRegenerate, onFeedback, onSubmit, onFollowUpSelect, onBook, onInputResponse, onToolInput, }: AgentRailProps): react.JSX.Element;
132
+ declare function AgentRail({ state, handoff, theme, colorScheme, brandLabel, brandLogoUrl, poweredByLabel, disclaimerLabel, disclaimerLink, answerReceipt, readAloud, composerPlaceholder, mobileFullscreen, expanded, onCollapse, onClose, onExpandToggle, onReset, onRetry, onRegenerate, onFeedback, onSubmit, onFollowUpSelect, onBook, onInputResponse, onToolInput, }: AgentRailProps): react.JSX.Element;
67
133
 
68
134
  type UseAgentChatOptions = {
135
+ handoffEnabled?: boolean;
69
136
  customerId?: string;
70
137
  getUnpublishedPreviewGrant?: () => Promise<string>;
71
138
  indexId: string;
@@ -82,7 +149,63 @@ type AgentChatSubmitOptions = {
82
149
  runtimeText?: string;
83
150
  declinedComposerFormId?: string;
84
151
  };
85
- declare function useAgentChat({ customerId, getUnpublishedPreviewGrant, indexId, previewBuildId, version, runtimeOrigin, visitorSessionId, storageKeyPrefix, greeting, toolResultRegistry, }: UseAgentChatOptions): {
152
+ declare function useAgentChat({ handoffEnabled, customerId, getUnpublishedPreviewGrant, indexId, previewBuildId, version, runtimeOrigin, visitorSessionId, storageKeyPrefix, greeting, toolResultRegistry, }: UseAgentChatOptions): {
153
+ handoff: {
154
+ page: {
155
+ apiVersion: "webless.ai/agent-runtime-handoff/v1";
156
+ sessionId: string;
157
+ enabled: boolean;
158
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
159
+ handoffId: string | null;
160
+ epoch: number;
161
+ after: number;
162
+ cursor: number;
163
+ hasMore: boolean;
164
+ events: ({
165
+ type: "status";
166
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
167
+ actor: {
168
+ id: string;
169
+ name: string;
170
+ } | null;
171
+ id: string;
172
+ sequence: number;
173
+ handoffId: string;
174
+ epoch: number;
175
+ createdAt: string;
176
+ } | {
177
+ type: "visitor.message";
178
+ message: string;
179
+ operationId: string;
180
+ id: string;
181
+ sequence: number;
182
+ handoffId: string;
183
+ epoch: number;
184
+ createdAt: string;
185
+ } | {
186
+ type: "human.message";
187
+ message: string;
188
+ actor: {
189
+ id: string;
190
+ name: string;
191
+ };
192
+ id: string;
193
+ sequence: number;
194
+ handoffId: string;
195
+ epoch: number;
196
+ createdAt: string;
197
+ })[];
198
+ } | null;
199
+ busy: boolean;
200
+ error: string | null;
201
+ hasPending: boolean;
202
+ canReset: boolean;
203
+ blocksAI: boolean;
204
+ start: () => Promise<void>;
205
+ send: (message: string) => Promise<void>;
206
+ returnToAI: () => Promise<void>;
207
+ retry: () => Promise<void>;
208
+ };
86
209
  state: AgentRailState;
87
210
  reset: () => void;
88
211
  retry: () => Promise<void>;
package/dist/react.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react from 'react';
2
- import { e as AgentIndexVersion, l as AgentPlacementConfig, d as AgentColorScheme, c as AgentBrandingConfig, b as AgentAnalyticsConfig, Y as VisitorToolResultRegistry, i as AgentMessageFeedback, T as ToolStep, n as AgentRailState, o as AgentRailTheme, I as ConversationMessage, k as AgentPanelSubmitOptions, h as AgentInputResponse, D as AgentToolUiSurface, w as AgentToolResultJsonValue, K as FollowUpSuggestion, m as AgentRailPhase, V as VisitorBooking, R as ResolvedVisitorToolResultPresentation } from './panel-controller-rxR75tRa.js';
3
- export { A as AGENT_STRUCTURED_TOOL_INPUT_HEADER, a as AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION, f as AgentInputOption, g as AgentInputRequest, p as AgentSearchReferences, q as AgentSearchSource, r as AgentStructuredToolInput, v as AgentToolResult, x as AgentToolUiAction, y as AgentToolUiField, z as AgentToolUiFieldKind, B as AgentToolUiOption, C as AgentToolUiStep, E as AssistEdgeTab, F as AssistTabSide, G as AssistTabVariant, H as Citation, J as DEFAULT_AGENT_PLACEMENT, L as JourneyContext, M as ToolStepState, O as VisitorBookingResultPresentation, P as VisitorSearchResultPresentation, Q as VisitorToolInputResultPresentation, S as VisitorToolResultLink, U as VisitorToolResultPresentation, W as VisitorToolResultPresenter, X as VisitorToolResultPresenterOutput, Z as builtInVisitorToolResultRegistry, _ as defaultAgentRailTheme, $ as defaultDarkAgentRailTheme, a0 as formatAgentStructuredToolInput, a1 as normalizeAgentPlacement, a3 as presentVisitorToolResult } from './panel-controller-rxR75tRa.js';
2
+ import { f as AgentIndexVersion, m as AgentPlacementConfig, e as AgentColorScheme, c as AgentBrandingConfig, b as AgentAnalyticsConfig, _ as VisitorToolResultRegistry, d as AgentClient, q as AgentRuntimeHandoffEvent, j as AgentMessageFeedback, T as ToolStep, o as AgentRailState, p as AgentRailTheme, K as ConversationMessage, l as AgentPanelSubmitOptions, i as AgentInputResponse, F as AgentToolUiSurface, y as AgentToolResultJsonValue, M as FollowUpSuggestion, n as AgentRailPhase, V as VisitorBooking, R as ResolvedVisitorToolResultPresentation } from './panel-controller-DbDHLs4L.js';
3
+ export { A as AGENT_STRUCTURED_TOOL_INPUT_HEADER, a as AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION, g as AgentInputOption, h as AgentInputRequest, r as AgentSearchReferences, s as AgentSearchSource, t as AgentStructuredToolInput, x as AgentToolResult, z as AgentToolUiAction, B as AgentToolUiField, C as AgentToolUiFieldKind, D as AgentToolUiOption, E as AgentToolUiStep, G as AssistEdgeTab, H as AssistTabSide, I as AssistTabVariant, J as Citation, L as DEFAULT_AGENT_PLACEMENT, N as JourneyContext, P as ToolStepState, Q as VisitorBookingResultPresentation, S as VisitorSearchResultPresentation, U as VisitorToolInputResultPresentation, W as VisitorToolResultLink, X as VisitorToolResultPresentation, Y as VisitorToolResultPresenter, Z as VisitorToolResultPresenterOutput, $ as builtInVisitorToolResultRegistry, a0 as defaultAgentRailTheme, a1 as defaultDarkAgentRailTheme, a2 as formatAgentStructuredToolInput, a3 as normalizeAgentPlacement, a5 as presentVisitorToolResult } from './panel-controller-DbDHLs4L.js';
4
+ import 'zod';
4
5
 
5
6
  type AgentWidgetProps = {
6
7
  indexId: string;
@@ -9,6 +10,7 @@ type AgentWidgetProps = {
9
10
  previewBuildId?: string;
10
11
  version?: AgentIndexVersion;
11
12
  runtimeOrigin?: string;
13
+ handoffEnabled?: boolean;
12
14
  placement?: Partial<AgentPlacementConfig>;
13
15
  defaultCollapsed?: boolean;
14
16
  pageShift?: boolean;
@@ -18,7 +20,70 @@ type AgentWidgetProps = {
18
20
  analytics?: AgentAnalyticsConfig;
19
21
  toolResultRegistry?: VisitorToolResultRegistry;
20
22
  };
21
- declare function AgentWidget({ indexId, customerId, getUnpublishedPreviewGrant, previewBuildId, version, runtimeOrigin, placement: placementInput, defaultCollapsed, pageShift, registerPanelController, colorScheme, branding, analytics, toolResultRegistry, }: AgentWidgetProps): react.JSX.Element;
23
+ declare function AgentWidget({ indexId, customerId, getUnpublishedPreviewGrant, previewBuildId, version, runtimeOrigin, handoffEnabled, placement: placementInput, defaultCollapsed, pageShift, registerPanelController, colorScheme, branding, analytics, toolResultRegistry, }: AgentWidgetProps): react.JSX.Element;
24
+
25
+ declare function useAgentHandoff(options: {
26
+ enabled: boolean;
27
+ client: AgentClient;
28
+ sessionId: string | undefined;
29
+ onEvents: (events: AgentRuntimeHandoffEvent[]) => void;
30
+ onOwnership: () => void;
31
+ }): {
32
+ page: {
33
+ apiVersion: "webless.ai/agent-runtime-handoff/v1";
34
+ sessionId: string;
35
+ enabled: boolean;
36
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
37
+ handoffId: string | null;
38
+ epoch: number;
39
+ after: number;
40
+ cursor: number;
41
+ hasMore: boolean;
42
+ events: ({
43
+ type: "status";
44
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
45
+ actor: {
46
+ id: string;
47
+ name: string;
48
+ } | null;
49
+ id: string;
50
+ sequence: number;
51
+ handoffId: string;
52
+ epoch: number;
53
+ createdAt: string;
54
+ } | {
55
+ type: "visitor.message";
56
+ message: string;
57
+ operationId: string;
58
+ id: string;
59
+ sequence: number;
60
+ handoffId: string;
61
+ epoch: number;
62
+ createdAt: string;
63
+ } | {
64
+ type: "human.message";
65
+ message: string;
66
+ actor: {
67
+ id: string;
68
+ name: string;
69
+ };
70
+ id: string;
71
+ sequence: number;
72
+ handoffId: string;
73
+ epoch: number;
74
+ createdAt: string;
75
+ })[];
76
+ } | null;
77
+ busy: boolean;
78
+ error: string | null;
79
+ hasPending: boolean;
80
+ canReset: boolean;
81
+ blocksAI: boolean;
82
+ start: () => Promise<void>;
83
+ send: (message: string) => Promise<void>;
84
+ returnToAI: () => Promise<void>;
85
+ retry: () => Promise<void>;
86
+ };
22
87
 
23
88
  declare function MessageActions({ answeredAt, copyText, disabled, onOpenReceipt, onRegenerate, onFeedback, readAloud, receiptSteps, speechText, }: {
24
89
  answeredAt?: number;
@@ -35,6 +100,7 @@ declare function MessageActions({ answeredAt, copyText, disabled, onOpenReceipt,
35
100
 
36
101
  type AgentRailProps = {
37
102
  state: AgentRailState;
103
+ handoff?: ReturnType<typeof useAgentHandoff>;
38
104
  theme?: Partial<AgentRailTheme>;
39
105
  colorScheme?: AgentColorScheme;
40
106
  brandLabel?: string;
@@ -63,9 +129,10 @@ type AgentRailProps = {
63
129
  onInputResponse?: (response: AgentInputResponse) => void;
64
130
  onToolInput?: (surface: AgentToolUiSurface, values: Record<string, AgentToolResultJsonValue>) => void;
65
131
  };
66
- declare function AgentRail({ state, theme, colorScheme, brandLabel, brandLogoUrl, poweredByLabel, disclaimerLabel, disclaimerLink, answerReceipt, readAloud, composerPlaceholder, mobileFullscreen, expanded, onCollapse, onClose, onExpandToggle, onReset, onRetry, onRegenerate, onFeedback, onSubmit, onFollowUpSelect, onBook, onInputResponse, onToolInput, }: AgentRailProps): react.JSX.Element;
132
+ declare function AgentRail({ state, handoff, theme, colorScheme, brandLabel, brandLogoUrl, poweredByLabel, disclaimerLabel, disclaimerLink, answerReceipt, readAloud, composerPlaceholder, mobileFullscreen, expanded, onCollapse, onClose, onExpandToggle, onReset, onRetry, onRegenerate, onFeedback, onSubmit, onFollowUpSelect, onBook, onInputResponse, onToolInput, }: AgentRailProps): react.JSX.Element;
67
133
 
68
134
  type UseAgentChatOptions = {
135
+ handoffEnabled?: boolean;
69
136
  customerId?: string;
70
137
  getUnpublishedPreviewGrant?: () => Promise<string>;
71
138
  indexId: string;
@@ -82,7 +149,63 @@ type AgentChatSubmitOptions = {
82
149
  runtimeText?: string;
83
150
  declinedComposerFormId?: string;
84
151
  };
85
- declare function useAgentChat({ customerId, getUnpublishedPreviewGrant, indexId, previewBuildId, version, runtimeOrigin, visitorSessionId, storageKeyPrefix, greeting, toolResultRegistry, }: UseAgentChatOptions): {
152
+ declare function useAgentChat({ handoffEnabled, customerId, getUnpublishedPreviewGrant, indexId, previewBuildId, version, runtimeOrigin, visitorSessionId, storageKeyPrefix, greeting, toolResultRegistry, }: UseAgentChatOptions): {
153
+ handoff: {
154
+ page: {
155
+ apiVersion: "webless.ai/agent-runtime-handoff/v1";
156
+ sessionId: string;
157
+ enabled: boolean;
158
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
159
+ handoffId: string | null;
160
+ epoch: number;
161
+ after: number;
162
+ cursor: number;
163
+ hasMore: boolean;
164
+ events: ({
165
+ type: "status";
166
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
167
+ actor: {
168
+ id: string;
169
+ name: string;
170
+ } | null;
171
+ id: string;
172
+ sequence: number;
173
+ handoffId: string;
174
+ epoch: number;
175
+ createdAt: string;
176
+ } | {
177
+ type: "visitor.message";
178
+ message: string;
179
+ operationId: string;
180
+ id: string;
181
+ sequence: number;
182
+ handoffId: string;
183
+ epoch: number;
184
+ createdAt: string;
185
+ } | {
186
+ type: "human.message";
187
+ message: string;
188
+ actor: {
189
+ id: string;
190
+ name: string;
191
+ };
192
+ id: string;
193
+ sequence: number;
194
+ handoffId: string;
195
+ epoch: number;
196
+ createdAt: string;
197
+ })[];
198
+ } | null;
199
+ busy: boolean;
200
+ error: string | null;
201
+ hasPending: boolean;
202
+ canReset: boolean;
203
+ blocksAI: boolean;
204
+ start: () => Promise<void>;
205
+ send: (message: string) => Promise<void>;
206
+ returnToAI: () => Promise<void>;
207
+ retry: () => Promise<void>;
208
+ };
86
209
  state: AgentRailState;
87
210
  reset: () => void;
88
211
  retry: () => Promise<void>;
package/dist/react.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  sendAgentAnswerFeedback,
28
28
  useAgentChat,
29
29
  useAgentColorScheme
30
- } from "./chunk-NW37MHU7.js";
30
+ } from "./chunk-HKQFEO6R.js";
31
31
 
32
32
  // src/react/components/AgentTranscript/AgentTranscript.tsx
33
33
  import { Fragment as Fragment2 } from "react";
@@ -1,3 +1,5 @@
1
+ import { z } from 'zod';
2
+
1
3
  declare const AGENT_TOOL_UI_SCHEMA_VERSION: "webless.tool-ui.v1";
2
4
  declare const AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION: "webless.structured-tool-input.v1";
3
5
  declare const AGENT_STRUCTURED_TOOL_INPUT_HEADER: "Webless-Structured-Tool-Input-JSON:";
@@ -66,6 +68,135 @@ type AgentToolResultEnvelope = {
66
68
  };
67
69
  declare function parseAgentToolResultEnvelope(value: unknown): AgentToolResultEnvelope | null;
68
70
 
71
+ declare const agentRuntimeHandoffStatusSchema: z.ZodEnum<{
72
+ ai: "ai";
73
+ requesting: "requesting";
74
+ queued: "queued";
75
+ human: "human";
76
+ resolved: "resolved";
77
+ failed: "failed";
78
+ }>;
79
+ declare const agentRuntimeHandoffEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
80
+ type: z.ZodLiteral<"status">;
81
+ status: z.ZodEnum<{
82
+ ai: "ai";
83
+ requesting: "requesting";
84
+ queued: "queued";
85
+ human: "human";
86
+ resolved: "resolved";
87
+ failed: "failed";
88
+ }>;
89
+ actor: z.ZodNullable<z.ZodObject<{
90
+ id: z.ZodString;
91
+ name: z.ZodString;
92
+ }, z.core.$strict>>;
93
+ id: z.ZodString;
94
+ sequence: z.ZodNumber;
95
+ handoffId: z.ZodString;
96
+ epoch: z.ZodNumber;
97
+ createdAt: z.ZodISODateTime;
98
+ }, z.core.$strict>, z.ZodObject<{
99
+ type: z.ZodLiteral<"visitor.message">;
100
+ message: z.ZodString;
101
+ operationId: z.ZodString;
102
+ id: z.ZodString;
103
+ sequence: z.ZodNumber;
104
+ handoffId: z.ZodString;
105
+ epoch: z.ZodNumber;
106
+ createdAt: z.ZodISODateTime;
107
+ }, z.core.$strict>, z.ZodObject<{
108
+ type: z.ZodLiteral<"human.message">;
109
+ message: z.ZodString;
110
+ actor: z.ZodObject<{
111
+ id: z.ZodString;
112
+ name: z.ZodString;
113
+ }, z.core.$strict>;
114
+ id: z.ZodString;
115
+ sequence: z.ZodNumber;
116
+ handoffId: z.ZodString;
117
+ epoch: z.ZodNumber;
118
+ createdAt: z.ZodISODateTime;
119
+ }, z.core.$strict>], "type">;
120
+ declare const agentRuntimeHandoffPageSchema: z.ZodObject<{
121
+ apiVersion: z.ZodLiteral<"webless.ai/agent-runtime-handoff/v1">;
122
+ sessionId: z.ZodString;
123
+ enabled: z.ZodBoolean;
124
+ status: z.ZodEnum<{
125
+ ai: "ai";
126
+ requesting: "requesting";
127
+ queued: "queued";
128
+ human: "human";
129
+ resolved: "resolved";
130
+ failed: "failed";
131
+ }>;
132
+ handoffId: z.ZodNullable<z.ZodString>;
133
+ epoch: z.ZodNumber;
134
+ after: z.ZodNumber;
135
+ cursor: z.ZodNumber;
136
+ hasMore: z.ZodBoolean;
137
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
138
+ type: z.ZodLiteral<"status">;
139
+ status: z.ZodEnum<{
140
+ ai: "ai";
141
+ requesting: "requesting";
142
+ queued: "queued";
143
+ human: "human";
144
+ resolved: "resolved";
145
+ failed: "failed";
146
+ }>;
147
+ actor: z.ZodNullable<z.ZodObject<{
148
+ id: z.ZodString;
149
+ name: z.ZodString;
150
+ }, z.core.$strict>>;
151
+ id: z.ZodString;
152
+ sequence: z.ZodNumber;
153
+ handoffId: z.ZodString;
154
+ epoch: z.ZodNumber;
155
+ createdAt: z.ZodISODateTime;
156
+ }, z.core.$strict>, z.ZodObject<{
157
+ type: z.ZodLiteral<"visitor.message">;
158
+ message: z.ZodString;
159
+ operationId: z.ZodString;
160
+ id: z.ZodString;
161
+ sequence: z.ZodNumber;
162
+ handoffId: z.ZodString;
163
+ epoch: z.ZodNumber;
164
+ createdAt: z.ZodISODateTime;
165
+ }, z.core.$strict>, z.ZodObject<{
166
+ type: z.ZodLiteral<"human.message">;
167
+ message: z.ZodString;
168
+ actor: z.ZodObject<{
169
+ id: z.ZodString;
170
+ name: z.ZodString;
171
+ }, z.core.$strict>;
172
+ id: z.ZodString;
173
+ sequence: z.ZodNumber;
174
+ handoffId: z.ZodString;
175
+ epoch: z.ZodNumber;
176
+ createdAt: z.ZodISODateTime;
177
+ }, z.core.$strict>], "type">>;
178
+ }, z.core.$strict>;
179
+ type AgentRuntimeHandoffStatus = z.infer<typeof agentRuntimeHandoffStatusSchema>;
180
+ type AgentRuntimeHandoffEvent = z.infer<typeof agentRuntimeHandoffEventSchema>;
181
+ type AgentRuntimeHandoffPage = z.infer<typeof agentRuntimeHandoffPageSchema>;
182
+
183
+ type AgentHandoffCommand = {
184
+ operationId: string;
185
+ handoffId: string;
186
+ epoch: number;
187
+ };
188
+ type AgentHandoffClient = {
189
+ read(options?: {
190
+ after?: number;
191
+ signal?: AbortSignal;
192
+ }): Promise<AgentRuntimeHandoffPage>;
193
+ start(operationId: string, signal?: AbortSignal): Promise<void>;
194
+ send(command: AgentHandoffCommand & {
195
+ message: string;
196
+ }, signal?: AbortSignal): Promise<void>;
197
+ returnToAI(command: AgentHandoffCommand, signal?: AbortSignal): Promise<void>;
198
+ };
199
+
69
200
  type AgentIndexVersion = "published" | "unpublished";
70
201
  type AgentRuntimeConfig = {
71
202
  origin: string;
@@ -163,6 +294,7 @@ type AgentClientOptions = {
163
294
  storageKeyPrefix?: string;
164
295
  };
165
296
  type AgentClient = {
297
+ readonly handoff: AgentHandoffClient;
166
298
  readonly indexId: string;
167
299
  readonly version: AgentIndexVersion;
168
300
  readonly runtimeOrigin: string;
@@ -180,4 +312,4 @@ type AgentHealthResult = {
180
312
  detail: string;
181
313
  };
182
314
 
183
- export { AGENT_STRUCTURED_TOOL_INPUT_HEADER as A, parseAgentToolResultEnvelope as B, parseAgentToolUiSurface as C, type PersistedAgentSession as P, AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION as a, AGENT_TOOL_UI_SCHEMA_VERSION as b, type AgentClient as c, type AgentClientOptions as d, type AgentHealthResult as e, type AgentIndexVersion as f, type AgentInputOption as g, type AgentInputRequest as h, type AgentInputResponse as i, type AgentRespondTurnOptions as j, type AgentResumeTurnOptions as k, type AgentRuntimeConfig as l, type AgentSendTurnOptions as m, type AgentStreamHandlers as n, type AgentStructuredToolInput as o, type AgentToolResult as p, type AgentToolResultEnvelope as q, type AgentToolResultJsonValue as r, type AgentToolUiAction as s, type AgentToolUiField as t, type AgentToolUiFieldKind as u, type AgentToolUiOption as v, type AgentToolUiStep as w, type AgentToolUiSurface as x, type AgentWorkItem as y, formatAgentStructuredToolInput as z };
315
+ export { AGENT_STRUCTURED_TOOL_INPUT_HEADER as A, type AgentToolUiOption as B, type AgentToolUiStep as C, type AgentToolUiSurface as D, type AgentWorkItem as E, formatAgentStructuredToolInput as F, parseAgentToolResultEnvelope as G, parseAgentToolUiSurface as H, type PersistedAgentSession as P, AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION as a, AGENT_TOOL_UI_SCHEMA_VERSION as b, type AgentClient as c, type AgentClientOptions as d, type AgentHandoffClient as e, type AgentHandoffCommand as f, type AgentHealthResult as g, type AgentIndexVersion as h, type AgentInputOption as i, type AgentInputRequest as j, type AgentInputResponse as k, type AgentRespondTurnOptions as l, type AgentResumeTurnOptions as m, type AgentRuntimeConfig as n, type AgentRuntimeHandoffEvent as o, type AgentRuntimeHandoffPage as p, type AgentRuntimeHandoffStatus as q, type AgentSendTurnOptions as r, type AgentStreamHandlers as s, type AgentStructuredToolInput as t, type AgentToolResult as u, type AgentToolResultEnvelope as v, type AgentToolResultJsonValue as w, type AgentToolUiAction as x, type AgentToolUiField as y, type AgentToolUiFieldKind as z };