@webless/agent 0.8.0 → 0.9.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/index.d.cts CHANGED
@@ -1,182 +1,5 @@
1
- declare const AGENT_TOOL_UI_SCHEMA_VERSION: "webless.tool-ui.v1";
2
- declare const AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION: "webless.structured-tool-input.v1";
3
- declare const AGENT_STRUCTURED_TOOL_INPUT_HEADER: "Webless-Structured-Tool-Input-JSON:";
4
- type AgentToolUiFieldKind = "text" | "textarea" | "email" | "number" | "select" | "multi-select" | "checkbox" | "confirmation" | "radio" | "date" | "time" | "date-time" | "calendar" | "range" | "json";
5
- type AgentToolUiOption = {
6
- label: string;
7
- value: AgentToolResultJsonValue;
8
- };
9
- type AgentToolUiField = {
10
- description?: string;
11
- kind: AgentToolUiFieldKind;
12
- label: string;
13
- max?: number;
14
- maxItems?: number;
15
- maxLength?: number;
16
- min?: number;
17
- minLength?: number;
18
- options?: readonly AgentToolUiOption[];
19
- path: string;
20
- placeholder?: string;
21
- required?: boolean;
22
- step?: number;
23
- defaultValue?: AgentToolResultJsonValue;
24
- };
25
- type AgentToolUiStep = {
26
- description?: string;
27
- fieldPaths: readonly string[];
28
- id: string;
29
- label: string;
30
- };
31
- type AgentToolUiAction = {
32
- id: "submit" | "back" | "next" | "reset";
33
- label: string;
34
- };
35
- type AgentToolUiSurface = {
36
- actions?: readonly AgentToolUiAction[];
37
- description?: string;
38
- fields: readonly AgentToolUiField[];
39
- id: string;
40
- operationId?: string;
41
- requestId?: string;
42
- schemaVersion: typeof AGENT_TOOL_UI_SCHEMA_VERSION;
43
- steps?: readonly AgentToolUiStep[];
44
- submitLabel?: string;
45
- title: string;
46
- toolSlug: string;
47
- values?: Readonly<Record<string, AgentToolResultJsonValue>>;
48
- };
49
- type AgentStructuredToolInput = {
50
- schemaVersion: typeof AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION;
51
- operationId?: string;
52
- toolSlug: string;
53
- values: Readonly<Record<string, AgentToolResultJsonValue>>;
54
- };
55
- declare function formatAgentStructuredToolInput(surface: AgentToolUiSurface, values: Readonly<Record<string, AgentToolResultJsonValue>>): string;
56
- declare function parseAgentToolUiSurface(value: unknown): AgentToolUiSurface | null;
57
-
58
- type AgentToolResultJsonValue = null | boolean | number | string | AgentToolResultJsonValue[] | {
59
- [key: string]: AgentToolResultJsonValue;
60
- };
61
- type AgentToolResultEnvelope = {
62
- schemaVersion: "webless.tool-result.v1";
63
- output: AgentToolResultJsonValue;
64
- presentationKinds: string[];
65
- ui?: AgentToolUiSurface;
66
- };
67
- declare function parseAgentToolResultEnvelope(value: unknown): AgentToolResultEnvelope | null;
68
-
69
- type AgentIndexVersion = "published" | "unpublished";
70
- type AgentRuntimeConfig = {
71
- origin: string;
72
- indexId: string;
73
- version: AgentIndexVersion;
74
- host: string;
75
- };
76
- type AgentWorkItem = {
77
- id: string;
78
- kind: "planning" | "search" | "specialist";
79
- label: string;
80
- state: "completed" | "active" | "pending" | "error";
81
- detail?: string;
82
- };
83
- type AgentInputOption = {
84
- id: string;
85
- label: string;
86
- description?: string;
87
- style?: "default" | "primary" | "danger";
88
- };
89
- type AgentInputRequest = {
90
- requestId: string;
91
- kind: "question" | "session-limit" | "tool-approval";
92
- prompt: string;
93
- display?: "confirmation" | "select" | "text";
94
- allowFreeform?: boolean;
95
- options?: readonly AgentInputOption[];
96
- ui?: AgentToolUiSurface;
97
- action: {
98
- callId: string;
99
- kind: "tool-call";
100
- toolName: string;
101
- };
102
- };
103
- type AgentInputResponse = {
104
- requestId: string;
105
- optionId?: string;
106
- text?: string;
107
- value?: AgentToolResultJsonValue;
108
- };
109
- type AgentToolResult = {
110
- callId: string;
111
- toolName: string;
112
- status: "completed" | "failed" | "rejected";
113
- output?: unknown;
114
- error?: {
115
- code: string;
116
- message: string;
117
- };
118
- };
119
- type AgentStreamHandlers = {
120
- onWork?: (item: AgentWorkItem) => void;
121
- /** @deprecated Use onWork for semantic progress events. */
122
- onStep?: (label: string, detail?: string) => void;
123
- onDelta: (delta: string) => void;
124
- onComplete?: () => void;
125
- onActionResult?: (output: unknown) => void;
126
- onToolResult?: (result: AgentToolResult) => void;
127
- onInputRequest?: (requests: readonly AgentInputRequest[]) => void;
128
- };
129
- type AgentSendTurnOptions = {
130
- signal?: AbortSignal;
131
- handlers: AgentStreamHandlers;
132
- };
133
- type AgentResumeTurnOptions = AgentSendTurnOptions & {
134
- initialText?: string;
135
- message: string;
136
- };
137
- type AgentRespondTurnOptions = AgentSendTurnOptions & {
138
- responses: readonly AgentInputResponse[];
139
- };
140
- type PersistedAgentSession = {
141
- sessionId: string;
142
- streamIndex: number;
143
- lastMessage?: string;
144
- };
145
- type AgentClientOptions = {
146
- /** Index id sent as `indexId` query param to the runtime. */
147
- indexId: string;
148
- /** Selects the published index by default, or its unpublished preview. */
149
- version?: AgentIndexVersion;
150
- /** Supplies a fresh Console authorization grant for unpublished previews. */
151
- getUnpublishedPreviewGrant?: () => Promise<string>;
152
- /** Ready unpublished build id carried by a generated preview URL. */
153
- previewBuildId?: string;
154
- /** Customer id used to isolate browser session storage when omitted from storageKeyPrefix. */
155
- customerId?: string;
156
- /** Agent runtime origin, e.g. `https://runtime.staging.webless.ai`. */
157
- runtimeOrigin?: string;
158
- /** Stable browser conversation id; generated and stored when omitted. */
159
- visitorSessionId?: string;
160
- /** Override sessionStorage key prefix (derived from agent identity when omitted). */
161
- storageKeyPrefix?: string;
162
- };
163
- type AgentClient = {
164
- readonly indexId: string;
165
- readonly version: AgentIndexVersion;
166
- readonly runtimeOrigin: string;
167
- readonly visitorSessionId: string;
168
- sendTurn: (message: string, options: AgentSendTurnOptions) => Promise<string>;
169
- regenerateTurn: (message: string, options: AgentSendTurnOptions) => Promise<string>;
170
- resumeTurn: (options: AgentResumeTurnOptions) => Promise<string | null>;
171
- respondTurn: (options: AgentRespondTurnOptions) => Promise<string>;
172
- reset: () => void;
173
- cancelActive: () => void;
174
- getActiveSessionId: () => string | undefined;
175
- };
176
- type AgentHealthResult = {
177
- ok: boolean;
178
- detail: string;
179
- };
1
+ import { d as AgentClientOptions, c as AgentClient, f as AgentIndexVersion, l as AgentRuntimeConfig, e as AgentHealthResult, P as PersistedAgentSession } from './types-ohWeTG9i.cjs';
2
+ export { A as AGENT_STRUCTURED_TOOL_INPUT_HEADER, a as AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION, b as AGENT_TOOL_UI_SCHEMA_VERSION, g as AgentInputOption, h as AgentInputRequest, i as AgentInputResponse, j as AgentRespondTurnOptions, k as AgentResumeTurnOptions, m as AgentSendTurnOptions, n as AgentStreamHandlers, o as AgentStructuredToolInput, p as AgentToolResult, q as AgentToolResultEnvelope, r as AgentToolResultJsonValue, s as AgentToolUiAction, t as AgentToolUiField, u as AgentToolUiFieldKind, v as AgentToolUiOption, w as AgentToolUiStep, x as AgentToolUiSurface, y as AgentWorkItem, z as formatAgentStructuredToolInput, B as parseAgentToolResultEnvelope, C as parseAgentToolUiSurface } from './types-ohWeTG9i.cjs';
180
3
 
181
4
  declare function createAgentClient(options: AgentClientOptions): AgentClient;
182
5
 
@@ -208,4 +31,4 @@ declare function loadPersistedAgentSession(visitorSessionId: string, options?: S
208
31
  declare function savePersistedAgentSession(visitorSessionId: string, sessionId: string, streamIndex: number, options?: SessionStoreOptions): void;
209
32
  declare function clearPersistedAgentSession(visitorSessionId: string, options?: SessionStoreOptions): void;
210
33
 
211
- export { AGENT_STRUCTURED_TOOL_INPUT_HEADER, AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION, AGENT_TOOL_UI_SCHEMA_VERSION, type AgentClient, type AgentClientOptions, type AgentHealthResult, type AgentIndexVersion, type AgentInputOption, type AgentInputRequest, type AgentInputResponse, type AgentRespondTurnOptions, type AgentResumeTurnOptions, type AgentRuntimeConfig, type AgentSendTurnOptions, type AgentStreamHandlers, type AgentStructuredToolInput, type AgentToolResult, type AgentToolResultEnvelope, type AgentToolResultJsonValue, type AgentToolUiAction, type AgentToolUiField, type AgentToolUiFieldKind, type AgentToolUiOption, type AgentToolUiStep, type AgentToolUiSurface, type AgentWorkItem, DEFAULT_RUNTIME_ORIGIN, type PersistedAgentSession, type SessionStoreOptions, agentHealthUrl, buildAgentStorageKeyPrefix, buildEveHost, clearPersistedAgentSession, clearVisitorSessionId, createAgentClient, formatAgentError, formatAgentStructuredToolInput, getOrCreateVisitorSessionId, loadPersistedAgentSession, parseAgentToolResultEnvelope, parseAgentToolUiSurface, pingAgentHealth, resolveAgentRuntimeConfig, savePersistedAgentSession };
34
+ export { AgentClient, AgentClientOptions, AgentHealthResult, AgentIndexVersion, AgentRuntimeConfig, DEFAULT_RUNTIME_ORIGIN, PersistedAgentSession, type SessionStoreOptions, agentHealthUrl, buildAgentStorageKeyPrefix, buildEveHost, clearPersistedAgentSession, clearVisitorSessionId, createAgentClient, formatAgentError, getOrCreateVisitorSessionId, loadPersistedAgentSession, pingAgentHealth, resolveAgentRuntimeConfig, savePersistedAgentSession };
package/dist/index.d.ts CHANGED
@@ -1,182 +1,5 @@
1
- declare const AGENT_TOOL_UI_SCHEMA_VERSION: "webless.tool-ui.v1";
2
- declare const AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION: "webless.structured-tool-input.v1";
3
- declare const AGENT_STRUCTURED_TOOL_INPUT_HEADER: "Webless-Structured-Tool-Input-JSON:";
4
- type AgentToolUiFieldKind = "text" | "textarea" | "email" | "number" | "select" | "multi-select" | "checkbox" | "confirmation" | "radio" | "date" | "time" | "date-time" | "calendar" | "range" | "json";
5
- type AgentToolUiOption = {
6
- label: string;
7
- value: AgentToolResultJsonValue;
8
- };
9
- type AgentToolUiField = {
10
- description?: string;
11
- kind: AgentToolUiFieldKind;
12
- label: string;
13
- max?: number;
14
- maxItems?: number;
15
- maxLength?: number;
16
- min?: number;
17
- minLength?: number;
18
- options?: readonly AgentToolUiOption[];
19
- path: string;
20
- placeholder?: string;
21
- required?: boolean;
22
- step?: number;
23
- defaultValue?: AgentToolResultJsonValue;
24
- };
25
- type AgentToolUiStep = {
26
- description?: string;
27
- fieldPaths: readonly string[];
28
- id: string;
29
- label: string;
30
- };
31
- type AgentToolUiAction = {
32
- id: "submit" | "back" | "next" | "reset";
33
- label: string;
34
- };
35
- type AgentToolUiSurface = {
36
- actions?: readonly AgentToolUiAction[];
37
- description?: string;
38
- fields: readonly AgentToolUiField[];
39
- id: string;
40
- operationId?: string;
41
- requestId?: string;
42
- schemaVersion: typeof AGENT_TOOL_UI_SCHEMA_VERSION;
43
- steps?: readonly AgentToolUiStep[];
44
- submitLabel?: string;
45
- title: string;
46
- toolSlug: string;
47
- values?: Readonly<Record<string, AgentToolResultJsonValue>>;
48
- };
49
- type AgentStructuredToolInput = {
50
- schemaVersion: typeof AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION;
51
- operationId?: string;
52
- toolSlug: string;
53
- values: Readonly<Record<string, AgentToolResultJsonValue>>;
54
- };
55
- declare function formatAgentStructuredToolInput(surface: AgentToolUiSurface, values: Readonly<Record<string, AgentToolResultJsonValue>>): string;
56
- declare function parseAgentToolUiSurface(value: unknown): AgentToolUiSurface | null;
57
-
58
- type AgentToolResultJsonValue = null | boolean | number | string | AgentToolResultJsonValue[] | {
59
- [key: string]: AgentToolResultJsonValue;
60
- };
61
- type AgentToolResultEnvelope = {
62
- schemaVersion: "webless.tool-result.v1";
63
- output: AgentToolResultJsonValue;
64
- presentationKinds: string[];
65
- ui?: AgentToolUiSurface;
66
- };
67
- declare function parseAgentToolResultEnvelope(value: unknown): AgentToolResultEnvelope | null;
68
-
69
- type AgentIndexVersion = "published" | "unpublished";
70
- type AgentRuntimeConfig = {
71
- origin: string;
72
- indexId: string;
73
- version: AgentIndexVersion;
74
- host: string;
75
- };
76
- type AgentWorkItem = {
77
- id: string;
78
- kind: "planning" | "search" | "specialist";
79
- label: string;
80
- state: "completed" | "active" | "pending" | "error";
81
- detail?: string;
82
- };
83
- type AgentInputOption = {
84
- id: string;
85
- label: string;
86
- description?: string;
87
- style?: "default" | "primary" | "danger";
88
- };
89
- type AgentInputRequest = {
90
- requestId: string;
91
- kind: "question" | "session-limit" | "tool-approval";
92
- prompt: string;
93
- display?: "confirmation" | "select" | "text";
94
- allowFreeform?: boolean;
95
- options?: readonly AgentInputOption[];
96
- ui?: AgentToolUiSurface;
97
- action: {
98
- callId: string;
99
- kind: "tool-call";
100
- toolName: string;
101
- };
102
- };
103
- type AgentInputResponse = {
104
- requestId: string;
105
- optionId?: string;
106
- text?: string;
107
- value?: AgentToolResultJsonValue;
108
- };
109
- type AgentToolResult = {
110
- callId: string;
111
- toolName: string;
112
- status: "completed" | "failed" | "rejected";
113
- output?: unknown;
114
- error?: {
115
- code: string;
116
- message: string;
117
- };
118
- };
119
- type AgentStreamHandlers = {
120
- onWork?: (item: AgentWorkItem) => void;
121
- /** @deprecated Use onWork for semantic progress events. */
122
- onStep?: (label: string, detail?: string) => void;
123
- onDelta: (delta: string) => void;
124
- onComplete?: () => void;
125
- onActionResult?: (output: unknown) => void;
126
- onToolResult?: (result: AgentToolResult) => void;
127
- onInputRequest?: (requests: readonly AgentInputRequest[]) => void;
128
- };
129
- type AgentSendTurnOptions = {
130
- signal?: AbortSignal;
131
- handlers: AgentStreamHandlers;
132
- };
133
- type AgentResumeTurnOptions = AgentSendTurnOptions & {
134
- initialText?: string;
135
- message: string;
136
- };
137
- type AgentRespondTurnOptions = AgentSendTurnOptions & {
138
- responses: readonly AgentInputResponse[];
139
- };
140
- type PersistedAgentSession = {
141
- sessionId: string;
142
- streamIndex: number;
143
- lastMessage?: string;
144
- };
145
- type AgentClientOptions = {
146
- /** Index id sent as `indexId` query param to the runtime. */
147
- indexId: string;
148
- /** Selects the published index by default, or its unpublished preview. */
149
- version?: AgentIndexVersion;
150
- /** Supplies a fresh Console authorization grant for unpublished previews. */
151
- getUnpublishedPreviewGrant?: () => Promise<string>;
152
- /** Ready unpublished build id carried by a generated preview URL. */
153
- previewBuildId?: string;
154
- /** Customer id used to isolate browser session storage when omitted from storageKeyPrefix. */
155
- customerId?: string;
156
- /** Agent runtime origin, e.g. `https://runtime.staging.webless.ai`. */
157
- runtimeOrigin?: string;
158
- /** Stable browser conversation id; generated and stored when omitted. */
159
- visitorSessionId?: string;
160
- /** Override sessionStorage key prefix (derived from agent identity when omitted). */
161
- storageKeyPrefix?: string;
162
- };
163
- type AgentClient = {
164
- readonly indexId: string;
165
- readonly version: AgentIndexVersion;
166
- readonly runtimeOrigin: string;
167
- readonly visitorSessionId: string;
168
- sendTurn: (message: string, options: AgentSendTurnOptions) => Promise<string>;
169
- regenerateTurn: (message: string, options: AgentSendTurnOptions) => Promise<string>;
170
- resumeTurn: (options: AgentResumeTurnOptions) => Promise<string | null>;
171
- respondTurn: (options: AgentRespondTurnOptions) => Promise<string>;
172
- reset: () => void;
173
- cancelActive: () => void;
174
- getActiveSessionId: () => string | undefined;
175
- };
176
- type AgentHealthResult = {
177
- ok: boolean;
178
- detail: string;
179
- };
1
+ import { d as AgentClientOptions, c as AgentClient, f as AgentIndexVersion, l as AgentRuntimeConfig, e as AgentHealthResult, P as PersistedAgentSession } from './types-ohWeTG9i.js';
2
+ export { A as AGENT_STRUCTURED_TOOL_INPUT_HEADER, a as AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION, b as AGENT_TOOL_UI_SCHEMA_VERSION, g as AgentInputOption, h as AgentInputRequest, i as AgentInputResponse, j as AgentRespondTurnOptions, k as AgentResumeTurnOptions, m as AgentSendTurnOptions, n as AgentStreamHandlers, o as AgentStructuredToolInput, p as AgentToolResult, q as AgentToolResultEnvelope, r as AgentToolResultJsonValue, s as AgentToolUiAction, t as AgentToolUiField, u as AgentToolUiFieldKind, v as AgentToolUiOption, w as AgentToolUiStep, x as AgentToolUiSurface, y as AgentWorkItem, z as formatAgentStructuredToolInput, B as parseAgentToolResultEnvelope, C as parseAgentToolUiSurface } from './types-ohWeTG9i.js';
180
3
 
181
4
  declare function createAgentClient(options: AgentClientOptions): AgentClient;
182
5
 
@@ -208,4 +31,4 @@ declare function loadPersistedAgentSession(visitorSessionId: string, options?: S
208
31
  declare function savePersistedAgentSession(visitorSessionId: string, sessionId: string, streamIndex: number, options?: SessionStoreOptions): void;
209
32
  declare function clearPersistedAgentSession(visitorSessionId: string, options?: SessionStoreOptions): void;
210
33
 
211
- export { AGENT_STRUCTURED_TOOL_INPUT_HEADER, AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION, AGENT_TOOL_UI_SCHEMA_VERSION, type AgentClient, type AgentClientOptions, type AgentHealthResult, type AgentIndexVersion, type AgentInputOption, type AgentInputRequest, type AgentInputResponse, type AgentRespondTurnOptions, type AgentResumeTurnOptions, type AgentRuntimeConfig, type AgentSendTurnOptions, type AgentStreamHandlers, type AgentStructuredToolInput, type AgentToolResult, type AgentToolResultEnvelope, type AgentToolResultJsonValue, type AgentToolUiAction, type AgentToolUiField, type AgentToolUiFieldKind, type AgentToolUiOption, type AgentToolUiStep, type AgentToolUiSurface, type AgentWorkItem, DEFAULT_RUNTIME_ORIGIN, type PersistedAgentSession, type SessionStoreOptions, agentHealthUrl, buildAgentStorageKeyPrefix, buildEveHost, clearPersistedAgentSession, clearVisitorSessionId, createAgentClient, formatAgentError, formatAgentStructuredToolInput, getOrCreateVisitorSessionId, loadPersistedAgentSession, parseAgentToolResultEnvelope, parseAgentToolUiSurface, pingAgentHealth, resolveAgentRuntimeConfig, savePersistedAgentSession };
34
+ export { AgentClient, AgentClientOptions, AgentHealthResult, AgentIndexVersion, AgentRuntimeConfig, DEFAULT_RUNTIME_ORIGIN, PersistedAgentSession, type SessionStoreOptions, agentHealthUrl, buildAgentStorageKeyPrefix, buildEveHost, clearPersistedAgentSession, clearVisitorSessionId, createAgentClient, formatAgentError, getOrCreateVisitorSessionId, loadPersistedAgentSession, pingAgentHealth, resolveAgentRuntimeConfig, savePersistedAgentSession };