@webless/agent 0.10.4 → 0.12.0

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-CYoivbYB.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-CYoivbYB.cjs';
4
+ import 'zod';
4
5
 
5
6
  type AgentWidgetProps = {
6
7
  indexId: string;
@@ -20,6 +21,69 @@ type AgentWidgetProps = {
20
21
  };
21
22
  declare function AgentWidget({ indexId, customerId, getUnpublishedPreviewGrant, previewBuildId, version, runtimeOrigin, placement: placementInput, defaultCollapsed, pageShift, registerPanelController, colorScheme, branding, analytics, toolResultRegistry, }: AgentWidgetProps): react.JSX.Element;
22
23
 
24
+ declare function useAgentHandoff(options: {
25
+ enabled: boolean;
26
+ client: AgentClient;
27
+ sessionId: string | undefined;
28
+ onEvents: (events: AgentRuntimeHandoffEvent[]) => void;
29
+ onOwnership: () => void;
30
+ }): {
31
+ page: {
32
+ apiVersion: "webless.ai/agent-runtime-handoff/v1";
33
+ sessionId: string;
34
+ enabled: boolean;
35
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
36
+ handoffId: string | null;
37
+ epoch: number;
38
+ after: number;
39
+ cursor: number;
40
+ hasMore: boolean;
41
+ events: ({
42
+ type: "status";
43
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
44
+ actor: {
45
+ id: string;
46
+ name: string;
47
+ } | null;
48
+ id: string;
49
+ sequence: number;
50
+ handoffId: string;
51
+ epoch: number;
52
+ createdAt: string;
53
+ } | {
54
+ type: "visitor.message";
55
+ message: string;
56
+ operationId: string;
57
+ id: string;
58
+ sequence: number;
59
+ handoffId: string;
60
+ epoch: number;
61
+ createdAt: string;
62
+ } | {
63
+ type: "human.message";
64
+ message: string;
65
+ actor: {
66
+ id: string;
67
+ name: string;
68
+ };
69
+ id: string;
70
+ sequence: number;
71
+ handoffId: string;
72
+ epoch: number;
73
+ createdAt: string;
74
+ })[];
75
+ } | null;
76
+ busy: boolean;
77
+ error: string | null;
78
+ hasPending: boolean;
79
+ canReset: boolean;
80
+ blocksAI: boolean;
81
+ start: () => Promise<void>;
82
+ send: (message: string) => Promise<void>;
83
+ returnToAI: () => Promise<void>;
84
+ retry: () => Promise<void>;
85
+ };
86
+
23
87
  declare function MessageActions({ answeredAt, copyText, disabled, onOpenReceipt, onRegenerate, onFeedback, readAloud, receiptSteps, speechText, }: {
24
88
  answeredAt?: number;
25
89
  copyText: string;
@@ -35,6 +99,7 @@ declare function MessageActions({ answeredAt, copyText, disabled, onOpenReceipt,
35
99
 
36
100
  type AgentRailProps = {
37
101
  state: AgentRailState;
102
+ handoff?: ReturnType<typeof useAgentHandoff>;
38
103
  theme?: Partial<AgentRailTheme>;
39
104
  colorScheme?: AgentColorScheme;
40
105
  brandLabel?: string;
@@ -63,9 +128,10 @@ type AgentRailProps = {
63
128
  onInputResponse?: (response: AgentInputResponse) => void;
64
129
  onToolInput?: (surface: AgentToolUiSurface, values: Record<string, AgentToolResultJsonValue>) => void;
65
130
  };
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;
131
+ 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
132
 
68
133
  type UseAgentChatOptions = {
134
+ handoffEnabled?: boolean;
69
135
  customerId?: string;
70
136
  getUnpublishedPreviewGrant?: () => Promise<string>;
71
137
  indexId: string;
@@ -82,7 +148,63 @@ type AgentChatSubmitOptions = {
82
148
  runtimeText?: string;
83
149
  declinedComposerFormId?: string;
84
150
  };
85
- declare function useAgentChat({ customerId, getUnpublishedPreviewGrant, indexId, previewBuildId, version, runtimeOrigin, visitorSessionId, storageKeyPrefix, greeting, toolResultRegistry, }: UseAgentChatOptions): {
151
+ declare function useAgentChat({ handoffEnabled, customerId, getUnpublishedPreviewGrant, indexId, previewBuildId, version, runtimeOrigin, visitorSessionId, storageKeyPrefix, greeting, toolResultRegistry, }: UseAgentChatOptions): {
152
+ handoff: {
153
+ page: {
154
+ apiVersion: "webless.ai/agent-runtime-handoff/v1";
155
+ sessionId: string;
156
+ enabled: boolean;
157
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
158
+ handoffId: string | null;
159
+ epoch: number;
160
+ after: number;
161
+ cursor: number;
162
+ hasMore: boolean;
163
+ events: ({
164
+ type: "status";
165
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
166
+ actor: {
167
+ id: string;
168
+ name: string;
169
+ } | null;
170
+ id: string;
171
+ sequence: number;
172
+ handoffId: string;
173
+ epoch: number;
174
+ createdAt: string;
175
+ } | {
176
+ type: "visitor.message";
177
+ message: string;
178
+ operationId: string;
179
+ id: string;
180
+ sequence: number;
181
+ handoffId: string;
182
+ epoch: number;
183
+ createdAt: string;
184
+ } | {
185
+ type: "human.message";
186
+ message: string;
187
+ actor: {
188
+ id: string;
189
+ name: string;
190
+ };
191
+ id: string;
192
+ sequence: number;
193
+ handoffId: string;
194
+ epoch: number;
195
+ createdAt: string;
196
+ })[];
197
+ } | null;
198
+ busy: boolean;
199
+ error: string | null;
200
+ hasPending: boolean;
201
+ canReset: boolean;
202
+ blocksAI: boolean;
203
+ start: () => Promise<void>;
204
+ send: (message: string) => Promise<void>;
205
+ returnToAI: () => Promise<void>;
206
+ retry: () => Promise<void>;
207
+ };
86
208
  state: AgentRailState;
87
209
  reset: () => void;
88
210
  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-CYoivbYB.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-CYoivbYB.js';
4
+ import 'zod';
4
5
 
5
6
  type AgentWidgetProps = {
6
7
  indexId: string;
@@ -20,6 +21,69 @@ type AgentWidgetProps = {
20
21
  };
21
22
  declare function AgentWidget({ indexId, customerId, getUnpublishedPreviewGrant, previewBuildId, version, runtimeOrigin, placement: placementInput, defaultCollapsed, pageShift, registerPanelController, colorScheme, branding, analytics, toolResultRegistry, }: AgentWidgetProps): react.JSX.Element;
22
23
 
24
+ declare function useAgentHandoff(options: {
25
+ enabled: boolean;
26
+ client: AgentClient;
27
+ sessionId: string | undefined;
28
+ onEvents: (events: AgentRuntimeHandoffEvent[]) => void;
29
+ onOwnership: () => void;
30
+ }): {
31
+ page: {
32
+ apiVersion: "webless.ai/agent-runtime-handoff/v1";
33
+ sessionId: string;
34
+ enabled: boolean;
35
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
36
+ handoffId: string | null;
37
+ epoch: number;
38
+ after: number;
39
+ cursor: number;
40
+ hasMore: boolean;
41
+ events: ({
42
+ type: "status";
43
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
44
+ actor: {
45
+ id: string;
46
+ name: string;
47
+ } | null;
48
+ id: string;
49
+ sequence: number;
50
+ handoffId: string;
51
+ epoch: number;
52
+ createdAt: string;
53
+ } | {
54
+ type: "visitor.message";
55
+ message: string;
56
+ operationId: string;
57
+ id: string;
58
+ sequence: number;
59
+ handoffId: string;
60
+ epoch: number;
61
+ createdAt: string;
62
+ } | {
63
+ type: "human.message";
64
+ message: string;
65
+ actor: {
66
+ id: string;
67
+ name: string;
68
+ };
69
+ id: string;
70
+ sequence: number;
71
+ handoffId: string;
72
+ epoch: number;
73
+ createdAt: string;
74
+ })[];
75
+ } | null;
76
+ busy: boolean;
77
+ error: string | null;
78
+ hasPending: boolean;
79
+ canReset: boolean;
80
+ blocksAI: boolean;
81
+ start: () => Promise<void>;
82
+ send: (message: string) => Promise<void>;
83
+ returnToAI: () => Promise<void>;
84
+ retry: () => Promise<void>;
85
+ };
86
+
23
87
  declare function MessageActions({ answeredAt, copyText, disabled, onOpenReceipt, onRegenerate, onFeedback, readAloud, receiptSteps, speechText, }: {
24
88
  answeredAt?: number;
25
89
  copyText: string;
@@ -35,6 +99,7 @@ declare function MessageActions({ answeredAt, copyText, disabled, onOpenReceipt,
35
99
 
36
100
  type AgentRailProps = {
37
101
  state: AgentRailState;
102
+ handoff?: ReturnType<typeof useAgentHandoff>;
38
103
  theme?: Partial<AgentRailTheme>;
39
104
  colorScheme?: AgentColorScheme;
40
105
  brandLabel?: string;
@@ -63,9 +128,10 @@ type AgentRailProps = {
63
128
  onInputResponse?: (response: AgentInputResponse) => void;
64
129
  onToolInput?: (surface: AgentToolUiSurface, values: Record<string, AgentToolResultJsonValue>) => void;
65
130
  };
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;
131
+ 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
132
 
68
133
  type UseAgentChatOptions = {
134
+ handoffEnabled?: boolean;
69
135
  customerId?: string;
70
136
  getUnpublishedPreviewGrant?: () => Promise<string>;
71
137
  indexId: string;
@@ -82,7 +148,63 @@ type AgentChatSubmitOptions = {
82
148
  runtimeText?: string;
83
149
  declinedComposerFormId?: string;
84
150
  };
85
- declare function useAgentChat({ customerId, getUnpublishedPreviewGrant, indexId, previewBuildId, version, runtimeOrigin, visitorSessionId, storageKeyPrefix, greeting, toolResultRegistry, }: UseAgentChatOptions): {
151
+ declare function useAgentChat({ handoffEnabled, customerId, getUnpublishedPreviewGrant, indexId, previewBuildId, version, runtimeOrigin, visitorSessionId, storageKeyPrefix, greeting, toolResultRegistry, }: UseAgentChatOptions): {
152
+ handoff: {
153
+ page: {
154
+ apiVersion: "webless.ai/agent-runtime-handoff/v1";
155
+ sessionId: string;
156
+ enabled: boolean;
157
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
158
+ handoffId: string | null;
159
+ epoch: number;
160
+ after: number;
161
+ cursor: number;
162
+ hasMore: boolean;
163
+ events: ({
164
+ type: "status";
165
+ status: "ai" | "requesting" | "queued" | "human" | "resolved" | "failed";
166
+ actor: {
167
+ id: string;
168
+ name: string;
169
+ } | null;
170
+ id: string;
171
+ sequence: number;
172
+ handoffId: string;
173
+ epoch: number;
174
+ createdAt: string;
175
+ } | {
176
+ type: "visitor.message";
177
+ message: string;
178
+ operationId: string;
179
+ id: string;
180
+ sequence: number;
181
+ handoffId: string;
182
+ epoch: number;
183
+ createdAt: string;
184
+ } | {
185
+ type: "human.message";
186
+ message: string;
187
+ actor: {
188
+ id: string;
189
+ name: string;
190
+ };
191
+ id: string;
192
+ sequence: number;
193
+ handoffId: string;
194
+ epoch: number;
195
+ createdAt: string;
196
+ })[];
197
+ } | null;
198
+ busy: boolean;
199
+ error: string | null;
200
+ hasPending: boolean;
201
+ canReset: boolean;
202
+ blocksAI: boolean;
203
+ start: () => Promise<void>;
204
+ send: (message: string) => Promise<void>;
205
+ returnToAI: () => Promise<void>;
206
+ retry: () => Promise<void>;
207
+ };
86
208
  state: AgentRailState;
87
209
  reset: () => void;
88
210
  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-74CSWSC5.js";
30
+ } from "./chunk-EVWZF34F.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;
@@ -143,6 +274,8 @@ type PersistedAgentSession = {
143
274
  lastMessage?: string;
144
275
  };
145
276
  type AgentClientOptions = {
277
+ /** Advertise a client that renders and resolves precise-location consent. */
278
+ locationConsent?: boolean;
146
279
  /** Index id sent as `indexId` query param to the runtime. */
147
280
  indexId: string;
148
281
  /** Selects the published index by default, or its unpublished preview. */
@@ -161,6 +294,7 @@ type AgentClientOptions = {
161
294
  storageKeyPrefix?: string;
162
295
  };
163
296
  type AgentClient = {
297
+ readonly handoff: AgentHandoffClient;
164
298
  readonly indexId: string;
165
299
  readonly version: AgentIndexVersion;
166
300
  readonly runtimeOrigin: string;
@@ -178,4 +312,4 @@ type AgentHealthResult = {
178
312
  detail: string;
179
313
  };
180
314
 
181
- 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 };
@@ -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;
@@ -143,6 +274,8 @@ type PersistedAgentSession = {
143
274
  lastMessage?: string;
144
275
  };
145
276
  type AgentClientOptions = {
277
+ /** Advertise a client that renders and resolves precise-location consent. */
278
+ locationConsent?: boolean;
146
279
  /** Index id sent as `indexId` query param to the runtime. */
147
280
  indexId: string;
148
281
  /** Selects the published index by default, or its unpublished preview. */
@@ -161,6 +294,7 @@ type AgentClientOptions = {
161
294
  storageKeyPrefix?: string;
162
295
  };
163
296
  type AgentClient = {
297
+ readonly handoff: AgentHandoffClient;
164
298
  readonly indexId: string;
165
299
  readonly version: AgentIndexVersion;
166
300
  readonly runtimeOrigin: string;
@@ -178,4 +312,4 @@ type AgentHealthResult = {
178
312
  detail: string;
179
313
  };
180
314
 
181
- 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 };