@classic-homes/agent-contracts 0.11.0 → 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/api.d.ts +3 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +5 -0
- package/dist/api.js.map +1 -1
- package/dist/chat.d.ts +115 -0
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +10 -0
- package/dist/chat.js.map +1 -1
- package/dist/client-tools.d.ts +519 -0
- package/dist/client-tools.d.ts.map +1 -0
- package/dist/client-tools.js +57 -0
- package/dist/client-tools.js.map +1 -0
- package/dist/context.d.ts +325 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +47 -3
- package/dist/context.js.map +1 -1
- package/dist/events.d.ts +50 -6
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +27 -2
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +16 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +16 -0
- package/dist/limits.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Client tools: read-only questions the agent may put to the live Classic App page during a
|
|
4
|
+
* turn. The runtime offers them only when the request declared the `page` capability, sends a
|
|
5
|
+
* `client_call` event, and waits for `POST /api/chat/:requestId/client-result`. Allowlisted and
|
|
6
|
+
* schema-validated here; a client tool never changes the page.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CLIENT_TOOL_NAMES: readonly ["read_page", "read_selection"];
|
|
9
|
+
export declare const ClientToolName: z.ZodEnum<{
|
|
10
|
+
read_page: "read_page";
|
|
11
|
+
read_selection: "read_selection";
|
|
12
|
+
}>;
|
|
13
|
+
export type ClientToolName = z.infer<typeof ClientToolName>;
|
|
14
|
+
/** How long the runtime waits for a client result before telling the agent the page is unavailable. */
|
|
15
|
+
export declare const CLIENT_CALL_TIMEOUT_MS = 10000;
|
|
16
|
+
export declare const ReadPageInput: z.ZodObject<{
|
|
17
|
+
includeText: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type ReadPageInput = z.infer<typeof ReadPageInput>;
|
|
20
|
+
export declare const ReadSelectionInput: z.ZodObject<{}, z.core.$strip>;
|
|
21
|
+
export type ReadSelectionInput = z.infer<typeof ReadSelectionInput>;
|
|
22
|
+
/** One client tool call as it travels in a `client_call` event. */
|
|
23
|
+
export declare const ClientCall: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
24
|
+
tool: z.ZodLiteral<"read_page">;
|
|
25
|
+
input: z.ZodObject<{
|
|
26
|
+
includeText: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
29
|
+
tool: z.ZodLiteral<"read_selection">;
|
|
30
|
+
input: z.ZodObject<{}, z.core.$strip>;
|
|
31
|
+
}, z.core.$strip>], "tool">;
|
|
32
|
+
export type ClientCall = z.infer<typeof ClientCall>;
|
|
33
|
+
/** A fresh snapshot of the page, taken when the agent asked rather than when the user sent. */
|
|
34
|
+
export declare const ReadPageOutput: z.ZodObject<{
|
|
35
|
+
tool: z.ZodLiteral<"read_page">;
|
|
36
|
+
context: z.ZodObject<{
|
|
37
|
+
host: z.ZodLiteral<"app">;
|
|
38
|
+
capturedAt: z.ZodISODateTime;
|
|
39
|
+
route: z.ZodString;
|
|
40
|
+
title: z.ZodString;
|
|
41
|
+
tab: z.ZodOptional<z.ZodString>;
|
|
42
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
43
|
+
kind: z.ZodEnum<{
|
|
44
|
+
home: "home";
|
|
45
|
+
lot: "lot";
|
|
46
|
+
community: "community";
|
|
47
|
+
filing: "filing";
|
|
48
|
+
floorplan: "floorplan";
|
|
49
|
+
elevation: "elevation";
|
|
50
|
+
district: "district";
|
|
51
|
+
user: "user";
|
|
52
|
+
vendor: "vendor";
|
|
53
|
+
sign: "sign";
|
|
54
|
+
"slide-deck": "slide-deck";
|
|
55
|
+
survey: "survey";
|
|
56
|
+
workspace: "workspace";
|
|
57
|
+
walk: "walk";
|
|
58
|
+
permit: "permit";
|
|
59
|
+
incentive: "incentive";
|
|
60
|
+
}>;
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
label: z.ZodString;
|
|
63
|
+
path: z.ZodOptional<z.ZodString>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
homeRid: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
lotRid: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
elevationRid: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
floorplanRid: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
filingRid: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
communityRid: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
districtId: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
facts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
75
|
+
selection: z.ZodOptional<z.ZodString>;
|
|
76
|
+
breadcrumb: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
77
|
+
view: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
kind: z.ZodEnum<{
|
|
79
|
+
list: "list";
|
|
80
|
+
detail: "detail";
|
|
81
|
+
form: "form";
|
|
82
|
+
dashboard: "dashboard";
|
|
83
|
+
other: "other";
|
|
84
|
+
}>;
|
|
85
|
+
search: z.ZodOptional<z.ZodString>;
|
|
86
|
+
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
87
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
88
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
selected: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
90
|
+
kind: z.ZodEnum<{
|
|
91
|
+
home: "home";
|
|
92
|
+
lot: "lot";
|
|
93
|
+
community: "community";
|
|
94
|
+
filing: "filing";
|
|
95
|
+
floorplan: "floorplan";
|
|
96
|
+
elevation: "elevation";
|
|
97
|
+
district: "district";
|
|
98
|
+
user: "user";
|
|
99
|
+
vendor: "vendor";
|
|
100
|
+
sign: "sign";
|
|
101
|
+
"slide-deck": "slide-deck";
|
|
102
|
+
survey: "survey";
|
|
103
|
+
workspace: "workspace";
|
|
104
|
+
walk: "walk";
|
|
105
|
+
permit: "permit";
|
|
106
|
+
incentive: "incentive";
|
|
107
|
+
}>;
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
label: z.ZodString;
|
|
110
|
+
path: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>>>;
|
|
112
|
+
dirty: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
113
|
+
}, z.core.$strip>>;
|
|
114
|
+
overlay: z.ZodOptional<z.ZodObject<{
|
|
115
|
+
kind: z.ZodEnum<{
|
|
116
|
+
dialog: "dialog";
|
|
117
|
+
drawer: "drawer";
|
|
118
|
+
}>;
|
|
119
|
+
title: z.ZodString;
|
|
120
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
kind: z.ZodEnum<{
|
|
122
|
+
home: "home";
|
|
123
|
+
lot: "lot";
|
|
124
|
+
community: "community";
|
|
125
|
+
filing: "filing";
|
|
126
|
+
floorplan: "floorplan";
|
|
127
|
+
elevation: "elevation";
|
|
128
|
+
district: "district";
|
|
129
|
+
user: "user";
|
|
130
|
+
vendor: "vendor";
|
|
131
|
+
sign: "sign";
|
|
132
|
+
"slide-deck": "slide-deck";
|
|
133
|
+
survey: "survey";
|
|
134
|
+
workspace: "workspace";
|
|
135
|
+
walk: "walk";
|
|
136
|
+
permit: "permit";
|
|
137
|
+
incentive: "incentive";
|
|
138
|
+
}>;
|
|
139
|
+
id: z.ZodString;
|
|
140
|
+
label: z.ZodString;
|
|
141
|
+
path: z.ZodOptional<z.ZodString>;
|
|
142
|
+
}, z.core.$strip>>;
|
|
143
|
+
}, z.core.$strip>>;
|
|
144
|
+
recent: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
145
|
+
at: z.ZodISODateTime;
|
|
146
|
+
type: z.ZodEnum<{
|
|
147
|
+
filter: "filter";
|
|
148
|
+
navigate: "navigate";
|
|
149
|
+
tab: "tab";
|
|
150
|
+
select: "select";
|
|
151
|
+
save: "save";
|
|
152
|
+
open: "open";
|
|
153
|
+
close: "close";
|
|
154
|
+
}>;
|
|
155
|
+
label: z.ZodString;
|
|
156
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
157
|
+
kind: z.ZodEnum<{
|
|
158
|
+
home: "home";
|
|
159
|
+
lot: "lot";
|
|
160
|
+
community: "community";
|
|
161
|
+
filing: "filing";
|
|
162
|
+
floorplan: "floorplan";
|
|
163
|
+
elevation: "elevation";
|
|
164
|
+
district: "district";
|
|
165
|
+
user: "user";
|
|
166
|
+
vendor: "vendor";
|
|
167
|
+
sign: "sign";
|
|
168
|
+
"slide-deck": "slide-deck";
|
|
169
|
+
survey: "survey";
|
|
170
|
+
workspace: "workspace";
|
|
171
|
+
walk: "walk";
|
|
172
|
+
permit: "permit";
|
|
173
|
+
incentive: "incentive";
|
|
174
|
+
}>;
|
|
175
|
+
id: z.ZodString;
|
|
176
|
+
label: z.ZodString;
|
|
177
|
+
path: z.ZodOptional<z.ZodString>;
|
|
178
|
+
}, z.core.$strip>>;
|
|
179
|
+
}, z.core.$strip>>>;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
text: z.ZodOptional<z.ZodString>;
|
|
182
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
export declare const ReadSelectionOutput: z.ZodObject<{
|
|
185
|
+
tool: z.ZodLiteral<"read_selection">;
|
|
186
|
+
selection: z.ZodString;
|
|
187
|
+
}, z.core.$strip>;
|
|
188
|
+
export declare const ClientToolOutput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
189
|
+
tool: z.ZodLiteral<"read_page">;
|
|
190
|
+
context: z.ZodObject<{
|
|
191
|
+
host: z.ZodLiteral<"app">;
|
|
192
|
+
capturedAt: z.ZodISODateTime;
|
|
193
|
+
route: z.ZodString;
|
|
194
|
+
title: z.ZodString;
|
|
195
|
+
tab: z.ZodOptional<z.ZodString>;
|
|
196
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
197
|
+
kind: z.ZodEnum<{
|
|
198
|
+
home: "home";
|
|
199
|
+
lot: "lot";
|
|
200
|
+
community: "community";
|
|
201
|
+
filing: "filing";
|
|
202
|
+
floorplan: "floorplan";
|
|
203
|
+
elevation: "elevation";
|
|
204
|
+
district: "district";
|
|
205
|
+
user: "user";
|
|
206
|
+
vendor: "vendor";
|
|
207
|
+
sign: "sign";
|
|
208
|
+
"slide-deck": "slide-deck";
|
|
209
|
+
survey: "survey";
|
|
210
|
+
workspace: "workspace";
|
|
211
|
+
walk: "walk";
|
|
212
|
+
permit: "permit";
|
|
213
|
+
incentive: "incentive";
|
|
214
|
+
}>;
|
|
215
|
+
id: z.ZodString;
|
|
216
|
+
label: z.ZodString;
|
|
217
|
+
path: z.ZodOptional<z.ZodString>;
|
|
218
|
+
}, z.core.$strip>>;
|
|
219
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
220
|
+
homeRid: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
lotRid: z.ZodOptional<z.ZodNumber>;
|
|
222
|
+
elevationRid: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
floorplanRid: z.ZodOptional<z.ZodNumber>;
|
|
224
|
+
filingRid: z.ZodOptional<z.ZodNumber>;
|
|
225
|
+
communityRid: z.ZodOptional<z.ZodNumber>;
|
|
226
|
+
districtId: z.ZodOptional<z.ZodString>;
|
|
227
|
+
}, z.core.$strip>>;
|
|
228
|
+
facts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
229
|
+
selection: z.ZodOptional<z.ZodString>;
|
|
230
|
+
breadcrumb: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
231
|
+
view: z.ZodOptional<z.ZodObject<{
|
|
232
|
+
kind: z.ZodEnum<{
|
|
233
|
+
list: "list";
|
|
234
|
+
detail: "detail";
|
|
235
|
+
form: "form";
|
|
236
|
+
dashboard: "dashboard";
|
|
237
|
+
other: "other";
|
|
238
|
+
}>;
|
|
239
|
+
search: z.ZodOptional<z.ZodString>;
|
|
240
|
+
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
241
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
242
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
243
|
+
selected: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
244
|
+
kind: z.ZodEnum<{
|
|
245
|
+
home: "home";
|
|
246
|
+
lot: "lot";
|
|
247
|
+
community: "community";
|
|
248
|
+
filing: "filing";
|
|
249
|
+
floorplan: "floorplan";
|
|
250
|
+
elevation: "elevation";
|
|
251
|
+
district: "district";
|
|
252
|
+
user: "user";
|
|
253
|
+
vendor: "vendor";
|
|
254
|
+
sign: "sign";
|
|
255
|
+
"slide-deck": "slide-deck";
|
|
256
|
+
survey: "survey";
|
|
257
|
+
workspace: "workspace";
|
|
258
|
+
walk: "walk";
|
|
259
|
+
permit: "permit";
|
|
260
|
+
incentive: "incentive";
|
|
261
|
+
}>;
|
|
262
|
+
id: z.ZodString;
|
|
263
|
+
label: z.ZodString;
|
|
264
|
+
path: z.ZodOptional<z.ZodString>;
|
|
265
|
+
}, z.core.$strip>>>;
|
|
266
|
+
dirty: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
267
|
+
}, z.core.$strip>>;
|
|
268
|
+
overlay: z.ZodOptional<z.ZodObject<{
|
|
269
|
+
kind: z.ZodEnum<{
|
|
270
|
+
dialog: "dialog";
|
|
271
|
+
drawer: "drawer";
|
|
272
|
+
}>;
|
|
273
|
+
title: z.ZodString;
|
|
274
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
275
|
+
kind: z.ZodEnum<{
|
|
276
|
+
home: "home";
|
|
277
|
+
lot: "lot";
|
|
278
|
+
community: "community";
|
|
279
|
+
filing: "filing";
|
|
280
|
+
floorplan: "floorplan";
|
|
281
|
+
elevation: "elevation";
|
|
282
|
+
district: "district";
|
|
283
|
+
user: "user";
|
|
284
|
+
vendor: "vendor";
|
|
285
|
+
sign: "sign";
|
|
286
|
+
"slide-deck": "slide-deck";
|
|
287
|
+
survey: "survey";
|
|
288
|
+
workspace: "workspace";
|
|
289
|
+
walk: "walk";
|
|
290
|
+
permit: "permit";
|
|
291
|
+
incentive: "incentive";
|
|
292
|
+
}>;
|
|
293
|
+
id: z.ZodString;
|
|
294
|
+
label: z.ZodString;
|
|
295
|
+
path: z.ZodOptional<z.ZodString>;
|
|
296
|
+
}, z.core.$strip>>;
|
|
297
|
+
}, z.core.$strip>>;
|
|
298
|
+
recent: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
299
|
+
at: z.ZodISODateTime;
|
|
300
|
+
type: z.ZodEnum<{
|
|
301
|
+
filter: "filter";
|
|
302
|
+
navigate: "navigate";
|
|
303
|
+
tab: "tab";
|
|
304
|
+
select: "select";
|
|
305
|
+
save: "save";
|
|
306
|
+
open: "open";
|
|
307
|
+
close: "close";
|
|
308
|
+
}>;
|
|
309
|
+
label: z.ZodString;
|
|
310
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
311
|
+
kind: z.ZodEnum<{
|
|
312
|
+
home: "home";
|
|
313
|
+
lot: "lot";
|
|
314
|
+
community: "community";
|
|
315
|
+
filing: "filing";
|
|
316
|
+
floorplan: "floorplan";
|
|
317
|
+
elevation: "elevation";
|
|
318
|
+
district: "district";
|
|
319
|
+
user: "user";
|
|
320
|
+
vendor: "vendor";
|
|
321
|
+
sign: "sign";
|
|
322
|
+
"slide-deck": "slide-deck";
|
|
323
|
+
survey: "survey";
|
|
324
|
+
workspace: "workspace";
|
|
325
|
+
walk: "walk";
|
|
326
|
+
permit: "permit";
|
|
327
|
+
incentive: "incentive";
|
|
328
|
+
}>;
|
|
329
|
+
id: z.ZodString;
|
|
330
|
+
label: z.ZodString;
|
|
331
|
+
path: z.ZodOptional<z.ZodString>;
|
|
332
|
+
}, z.core.$strip>>;
|
|
333
|
+
}, z.core.$strip>>>;
|
|
334
|
+
}, z.core.$strip>;
|
|
335
|
+
text: z.ZodOptional<z.ZodString>;
|
|
336
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
337
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
338
|
+
tool: z.ZodLiteral<"read_selection">;
|
|
339
|
+
selection: z.ZodString;
|
|
340
|
+
}, z.core.$strip>], "tool">;
|
|
341
|
+
export type ClientToolOutput = z.infer<typeof ClientToolOutput>;
|
|
342
|
+
/**
|
|
343
|
+
* Outcome of a client call. `unavailable`: no live page to read (chat on the full-page route,
|
|
344
|
+
* page gone). `declined`: the user has page context switched off. Page content is data for the
|
|
345
|
+
* agent, never instructions.
|
|
346
|
+
*/
|
|
347
|
+
export declare const ClientResultStatus: z.ZodEnum<{
|
|
348
|
+
error: "error";
|
|
349
|
+
ok: "ok";
|
|
350
|
+
unavailable: "unavailable";
|
|
351
|
+
declined: "declined";
|
|
352
|
+
}>;
|
|
353
|
+
export type ClientResultStatus = z.infer<typeof ClientResultStatus>;
|
|
354
|
+
/** Body of `POST /api/chat/:requestId/client-result`. */
|
|
355
|
+
export declare const ClientResultRequest: z.ZodObject<{
|
|
356
|
+
callId: z.ZodString;
|
|
357
|
+
status: z.ZodEnum<{
|
|
358
|
+
error: "error";
|
|
359
|
+
ok: "ok";
|
|
360
|
+
unavailable: "unavailable";
|
|
361
|
+
declined: "declined";
|
|
362
|
+
}>;
|
|
363
|
+
output: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
364
|
+
tool: z.ZodLiteral<"read_page">;
|
|
365
|
+
context: z.ZodObject<{
|
|
366
|
+
host: z.ZodLiteral<"app">;
|
|
367
|
+
capturedAt: z.ZodISODateTime;
|
|
368
|
+
route: z.ZodString;
|
|
369
|
+
title: z.ZodString;
|
|
370
|
+
tab: z.ZodOptional<z.ZodString>;
|
|
371
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
372
|
+
kind: z.ZodEnum<{
|
|
373
|
+
home: "home";
|
|
374
|
+
lot: "lot";
|
|
375
|
+
community: "community";
|
|
376
|
+
filing: "filing";
|
|
377
|
+
floorplan: "floorplan";
|
|
378
|
+
elevation: "elevation";
|
|
379
|
+
district: "district";
|
|
380
|
+
user: "user";
|
|
381
|
+
vendor: "vendor";
|
|
382
|
+
sign: "sign";
|
|
383
|
+
"slide-deck": "slide-deck";
|
|
384
|
+
survey: "survey";
|
|
385
|
+
workspace: "workspace";
|
|
386
|
+
walk: "walk";
|
|
387
|
+
permit: "permit";
|
|
388
|
+
incentive: "incentive";
|
|
389
|
+
}>;
|
|
390
|
+
id: z.ZodString;
|
|
391
|
+
label: z.ZodString;
|
|
392
|
+
path: z.ZodOptional<z.ZodString>;
|
|
393
|
+
}, z.core.$strip>>;
|
|
394
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
395
|
+
homeRid: z.ZodOptional<z.ZodNumber>;
|
|
396
|
+
lotRid: z.ZodOptional<z.ZodNumber>;
|
|
397
|
+
elevationRid: z.ZodOptional<z.ZodNumber>;
|
|
398
|
+
floorplanRid: z.ZodOptional<z.ZodNumber>;
|
|
399
|
+
filingRid: z.ZodOptional<z.ZodNumber>;
|
|
400
|
+
communityRid: z.ZodOptional<z.ZodNumber>;
|
|
401
|
+
districtId: z.ZodOptional<z.ZodString>;
|
|
402
|
+
}, z.core.$strip>>;
|
|
403
|
+
facts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
|
|
404
|
+
selection: z.ZodOptional<z.ZodString>;
|
|
405
|
+
breadcrumb: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
406
|
+
view: z.ZodOptional<z.ZodObject<{
|
|
407
|
+
kind: z.ZodEnum<{
|
|
408
|
+
list: "list";
|
|
409
|
+
detail: "detail";
|
|
410
|
+
form: "form";
|
|
411
|
+
dashboard: "dashboard";
|
|
412
|
+
other: "other";
|
|
413
|
+
}>;
|
|
414
|
+
search: z.ZodOptional<z.ZodString>;
|
|
415
|
+
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
416
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
417
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
418
|
+
selected: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
419
|
+
kind: z.ZodEnum<{
|
|
420
|
+
home: "home";
|
|
421
|
+
lot: "lot";
|
|
422
|
+
community: "community";
|
|
423
|
+
filing: "filing";
|
|
424
|
+
floorplan: "floorplan";
|
|
425
|
+
elevation: "elevation";
|
|
426
|
+
district: "district";
|
|
427
|
+
user: "user";
|
|
428
|
+
vendor: "vendor";
|
|
429
|
+
sign: "sign";
|
|
430
|
+
"slide-deck": "slide-deck";
|
|
431
|
+
survey: "survey";
|
|
432
|
+
workspace: "workspace";
|
|
433
|
+
walk: "walk";
|
|
434
|
+
permit: "permit";
|
|
435
|
+
incentive: "incentive";
|
|
436
|
+
}>;
|
|
437
|
+
id: z.ZodString;
|
|
438
|
+
label: z.ZodString;
|
|
439
|
+
path: z.ZodOptional<z.ZodString>;
|
|
440
|
+
}, z.core.$strip>>>;
|
|
441
|
+
dirty: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
442
|
+
}, z.core.$strip>>;
|
|
443
|
+
overlay: z.ZodOptional<z.ZodObject<{
|
|
444
|
+
kind: z.ZodEnum<{
|
|
445
|
+
dialog: "dialog";
|
|
446
|
+
drawer: "drawer";
|
|
447
|
+
}>;
|
|
448
|
+
title: z.ZodString;
|
|
449
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
450
|
+
kind: z.ZodEnum<{
|
|
451
|
+
home: "home";
|
|
452
|
+
lot: "lot";
|
|
453
|
+
community: "community";
|
|
454
|
+
filing: "filing";
|
|
455
|
+
floorplan: "floorplan";
|
|
456
|
+
elevation: "elevation";
|
|
457
|
+
district: "district";
|
|
458
|
+
user: "user";
|
|
459
|
+
vendor: "vendor";
|
|
460
|
+
sign: "sign";
|
|
461
|
+
"slide-deck": "slide-deck";
|
|
462
|
+
survey: "survey";
|
|
463
|
+
workspace: "workspace";
|
|
464
|
+
walk: "walk";
|
|
465
|
+
permit: "permit";
|
|
466
|
+
incentive: "incentive";
|
|
467
|
+
}>;
|
|
468
|
+
id: z.ZodString;
|
|
469
|
+
label: z.ZodString;
|
|
470
|
+
path: z.ZodOptional<z.ZodString>;
|
|
471
|
+
}, z.core.$strip>>;
|
|
472
|
+
}, z.core.$strip>>;
|
|
473
|
+
recent: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
474
|
+
at: z.ZodISODateTime;
|
|
475
|
+
type: z.ZodEnum<{
|
|
476
|
+
filter: "filter";
|
|
477
|
+
navigate: "navigate";
|
|
478
|
+
tab: "tab";
|
|
479
|
+
select: "select";
|
|
480
|
+
save: "save";
|
|
481
|
+
open: "open";
|
|
482
|
+
close: "close";
|
|
483
|
+
}>;
|
|
484
|
+
label: z.ZodString;
|
|
485
|
+
record: z.ZodOptional<z.ZodObject<{
|
|
486
|
+
kind: z.ZodEnum<{
|
|
487
|
+
home: "home";
|
|
488
|
+
lot: "lot";
|
|
489
|
+
community: "community";
|
|
490
|
+
filing: "filing";
|
|
491
|
+
floorplan: "floorplan";
|
|
492
|
+
elevation: "elevation";
|
|
493
|
+
district: "district";
|
|
494
|
+
user: "user";
|
|
495
|
+
vendor: "vendor";
|
|
496
|
+
sign: "sign";
|
|
497
|
+
"slide-deck": "slide-deck";
|
|
498
|
+
survey: "survey";
|
|
499
|
+
workspace: "workspace";
|
|
500
|
+
walk: "walk";
|
|
501
|
+
permit: "permit";
|
|
502
|
+
incentive: "incentive";
|
|
503
|
+
}>;
|
|
504
|
+
id: z.ZodString;
|
|
505
|
+
label: z.ZodString;
|
|
506
|
+
path: z.ZodOptional<z.ZodString>;
|
|
507
|
+
}, z.core.$strip>>;
|
|
508
|
+
}, z.core.$strip>>>;
|
|
509
|
+
}, z.core.$strip>;
|
|
510
|
+
text: z.ZodOptional<z.ZodString>;
|
|
511
|
+
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
512
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
513
|
+
tool: z.ZodLiteral<"read_selection">;
|
|
514
|
+
selection: z.ZodString;
|
|
515
|
+
}, z.core.$strip>], "tool">>;
|
|
516
|
+
message: z.ZodOptional<z.ZodString>;
|
|
517
|
+
}, z.core.$strip>;
|
|
518
|
+
export type ClientResultRequest = z.infer<typeof ClientResultRequest>;
|
|
519
|
+
//# sourceMappingURL=client-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-tools.d.ts","sourceRoot":"","sources":["../src/client-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,0CAA2C,CAAC;AAC1E,eAAO,MAAM,cAAc;;;EAA4B,CAAC;AACxD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,uGAAuG;AACvG,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAE7C,eAAO,MAAM,aAAa;;iBAGxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,C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;;;;;;;;;;;;;;;;;iBAU5B,CAAC;AACL,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AppContext } from './context.js';
|
|
3
|
+
import { ToolCallId } from './ids.js';
|
|
4
|
+
import { LIMITS } from './limits.js';
|
|
5
|
+
/**
|
|
6
|
+
* Client tools: read-only questions the agent may put to the live Classic App page during a
|
|
7
|
+
* turn. The runtime offers them only when the request declared the `page` capability, sends a
|
|
8
|
+
* `client_call` event, and waits for `POST /api/chat/:requestId/client-result`. Allowlisted and
|
|
9
|
+
* schema-validated here; a client tool never changes the page.
|
|
10
|
+
*/
|
|
11
|
+
export const CLIENT_TOOL_NAMES = ['read_page', 'read_selection'];
|
|
12
|
+
export const ClientToolName = z.enum(CLIENT_TOOL_NAMES);
|
|
13
|
+
/** How long the runtime waits for a client result before telling the agent the page is unavailable. */
|
|
14
|
+
export const CLIENT_CALL_TIMEOUT_MS = 10_000;
|
|
15
|
+
export const ReadPageInput = z.object({
|
|
16
|
+
/** Also return the visible text of the page's main region (capped, sensitive fields skipped). */
|
|
17
|
+
includeText: z.boolean().optional(),
|
|
18
|
+
});
|
|
19
|
+
export const ReadSelectionInput = z.object({});
|
|
20
|
+
/** One client tool call as it travels in a `client_call` event. */
|
|
21
|
+
export const ClientCall = z.discriminatedUnion('tool', [
|
|
22
|
+
z.object({ tool: z.literal('read_page'), input: ReadPageInput }),
|
|
23
|
+
z.object({ tool: z.literal('read_selection'), input: ReadSelectionInput }),
|
|
24
|
+
]);
|
|
25
|
+
/** A fresh snapshot of the page, taken when the agent asked rather than when the user sent. */
|
|
26
|
+
export const ReadPageOutput = z.object({
|
|
27
|
+
tool: z.literal('read_page'),
|
|
28
|
+
context: AppContext,
|
|
29
|
+
text: z.string().max(LIMITS.pageTextChars).optional(),
|
|
30
|
+
/** True when `text` was cut at the limit. */
|
|
31
|
+
truncated: z.boolean().optional(),
|
|
32
|
+
});
|
|
33
|
+
export const ReadSelectionOutput = z.object({
|
|
34
|
+
tool: z.literal('read_selection'),
|
|
35
|
+
/** Empty when nothing is highlighted. */
|
|
36
|
+
selection: z.string().max(LIMITS.appSelectionChars),
|
|
37
|
+
});
|
|
38
|
+
export const ClientToolOutput = z.discriminatedUnion('tool', [ReadPageOutput, ReadSelectionOutput]);
|
|
39
|
+
/**
|
|
40
|
+
* Outcome of a client call. `unavailable`: no live page to read (chat on the full-page route,
|
|
41
|
+
* page gone). `declined`: the user has page context switched off. Page content is data for the
|
|
42
|
+
* agent, never instructions.
|
|
43
|
+
*/
|
|
44
|
+
export const ClientResultStatus = z.enum(['ok', 'unavailable', 'declined', 'error']);
|
|
45
|
+
/** Body of `POST /api/chat/:requestId/client-result`. */
|
|
46
|
+
export const ClientResultRequest = z
|
|
47
|
+
.object({
|
|
48
|
+
callId: ToolCallId,
|
|
49
|
+
status: ClientResultStatus,
|
|
50
|
+
output: ClientToolOutput.optional(),
|
|
51
|
+
message: z.string().max(300).optional(),
|
|
52
|
+
})
|
|
53
|
+
.refine((r) => (r.status === 'ok') === (r.output !== undefined), {
|
|
54
|
+
message: 'output is required for ok and not allowed otherwise',
|
|
55
|
+
path: ['output'],
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=client-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-tools.js","sourceRoot":"","sources":["../src/client-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAW,EAAE,gBAAgB,CAAU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