terse-types 0.0.22 → 0.0.24
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/README.md +17 -22
- package/dist/ApiRouteBuilder.d.ts +0 -3
- package/dist/ApiRoutes.json +0 -3
- package/dist/FrontendRoutes.json +1 -0
- package/dist/FrontendRoutesBuilder.d.ts +1 -0
- package/dist/InvalidationKeys.d.ts +0 -1
- package/dist/InvalidationKeys.js +0 -5
- package/dist/JsonSchemaUtils.d.ts +5 -0
- package/dist/JsonSchemaUtils.js +23 -0
- package/dist/ModelEvents.d.ts +87 -114
- package/dist/ModelEvents.js +29 -73
- package/dist/SocketEvents.d.ts +0 -5
- package/dist/SocketEvents.js +1 -7
- package/dist/ToolDisplayUtils.js +0 -161
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,43 +1,38 @@
|
|
|
1
1
|
# terse-types
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Internal shared types for the [Terse](https://useterse.ai) platform.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## You probably don't want to be here
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install terse-types
|
|
9
|
-
```
|
|
7
|
+
`terse-types` is a workspace package that the Terse backend, frontend, CLI, and SDK use to share TypeScript types. It is not the public API.
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
pnpm add terse-types
|
|
13
|
-
```
|
|
9
|
+
If you landed here while building a workflow, you almost certainly want one of these instead:
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
- **[`terse-cli`](https://www.npmjs.com/package/terse-cli)** to scaffold, test, and deploy workflows
|
|
12
|
+
- **[`terse-sdk`](https://www.npmjs.com/package/terse-sdk)** to write workflow code (`createJob`, `TerseAgent`, trigger types)
|
|
13
|
+
- **[docs.useterse.ai](https://docs.useterse.ai)** for guides and reference
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
If a doc, post, or LLM pointed you at `terse-types` directly, that was probably a mistake on our end. [Let us know](mailto:support@useterse.ai) so we can fix it. The types you actually need are re-exported from `terse-sdk`.
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
import { IntegrationType, type User } from "terse-types"
|
|
21
|
-
```
|
|
17
|
+
## If you really do need it
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
Anything in `terse-types` is internal and may change without notice. There is no stability guarantee, no migration guide, and no semver discipline beyond what the workspace happens to need.
|
|
24
20
|
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
import type { RunHistoryStatus } from "terse-types/RunHistoryTypes"
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add terse-types
|
|
28
23
|
```
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
```ts
|
|
26
|
+
import { IntegrationType, type User } from "terse-types"
|
|
27
|
+
```
|
|
33
28
|
|
|
34
|
-
|
|
29
|
+
## Local development
|
|
35
30
|
|
|
36
31
|
```bash
|
|
37
32
|
pnpm --filter terse-types run build
|
|
38
33
|
```
|
|
39
34
|
|
|
40
|
-
If you are working on the local CLI and SDK at the same time, relink
|
|
35
|
+
If you are working on the local CLI and SDK at the same time, relink everything from the repo root:
|
|
41
36
|
|
|
42
37
|
```bash
|
|
43
38
|
pnpm run install-global
|
|
@@ -177,8 +177,5 @@ export declare const ApiRoutes: {
|
|
|
177
177
|
CREATE: string;
|
|
178
178
|
BY_ID: string;
|
|
179
179
|
};
|
|
180
|
-
BUILDER_CHAT: {
|
|
181
|
-
HISTORY_BY_SESSION_ID: string;
|
|
182
|
-
};
|
|
183
180
|
};
|
|
184
181
|
export declare function buildRoute(pattern: string, params: Record<string, string | number>): string;
|
package/dist/ApiRoutes.json
CHANGED
package/dist/FrontendRoutes.json
CHANGED
|
@@ -43,7 +43,6 @@ export declare const agentDetailKey: (id: string | null) => readonly [string, {
|
|
|
43
43
|
export declare const agentImprovementsKey: (agentId: string | null) => readonly [string, {
|
|
44
44
|
agentId: string;
|
|
45
45
|
}] | null;
|
|
46
|
-
export declare const builderChatHistoryKey: (sessionId: string | null | undefined) => readonly [string, string] | null;
|
|
47
46
|
export declare const orgLogoKey: (organizationId: string | null | undefined) => readonly [string, string] | null;
|
|
48
47
|
export declare const userByIdKey: (userId: string | null | undefined) => readonly [string, string] | null;
|
|
49
48
|
export declare const agentFilesKey: (agentId: string) => readonly [string, string];
|
package/dist/InvalidationKeys.js
CHANGED
|
@@ -130,11 +130,6 @@ export const agentImprovementsKey = (agentId) => {
|
|
|
130
130
|
return null;
|
|
131
131
|
return ["agentImprovements", { agentId }];
|
|
132
132
|
};
|
|
133
|
-
export const builderChatHistoryKey = (sessionId) => {
|
|
134
|
-
if (!sessionId)
|
|
135
|
-
return null;
|
|
136
|
-
return ["builderChatHistory", sessionId];
|
|
137
|
-
};
|
|
138
133
|
export const orgLogoKey = (organizationId) => {
|
|
139
134
|
if (!organizationId)
|
|
140
135
|
return null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function isPlainObject(value) {
|
|
2
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Zod 4 embeds non-JSON Schema metadata under "~*" keys (for example "~standard").
|
|
6
|
+
* Strip those keys recursively before passing schemas to model providers.
|
|
7
|
+
*/
|
|
8
|
+
export function stripZodJsonSchemaMetadata(value) {
|
|
9
|
+
if (Array.isArray(value)) {
|
|
10
|
+
return value.map(item => stripZodJsonSchemaMetadata(item));
|
|
11
|
+
}
|
|
12
|
+
if (!isPlainObject(value)) {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
const cleaned = {};
|
|
16
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
17
|
+
if (key.startsWith("~")) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
cleaned[key] = stripZodJsonSchemaMetadata(nestedValue);
|
|
21
|
+
}
|
|
22
|
+
return cleaned;
|
|
23
|
+
}
|
package/dist/ModelEvents.d.ts
CHANGED
|
@@ -18,43 +18,40 @@ export declare const changedItemSchema: z.ZodObject<{
|
|
|
18
18
|
}, z.core.$strip>;
|
|
19
19
|
export type ChangedItem = z.infer<typeof changedItemSchema>;
|
|
20
20
|
export declare const runErrorSchema: z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
timestamp: z.ZodNumber;
|
|
23
|
+
response_id: z.ZodString;
|
|
21
24
|
type: z.ZodLiteral<"RunError">;
|
|
22
|
-
id: z.ZodOptional<z.ZodString>;
|
|
23
25
|
error: z.ZodString;
|
|
24
26
|
code: z.ZodOptional<z.ZodString>;
|
|
25
|
-
timestamp: z.ZodNumber;
|
|
26
27
|
}, z.core.$strip>;
|
|
27
28
|
export type RunError = z.infer<typeof runErrorSchema>;
|
|
28
29
|
export declare const processOutputSchema: z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
timestamp: z.ZodNumber;
|
|
32
|
+
response_id: z.ZodString;
|
|
29
33
|
type: z.ZodLiteral<"ProcessOutput">;
|
|
30
|
-
id: z.ZodOptional<z.ZodString>;
|
|
31
34
|
stream: z.ZodEnum<{
|
|
32
35
|
stdout: "stdout";
|
|
33
36
|
stderr: "stderr";
|
|
34
37
|
}>;
|
|
35
38
|
content: z.ZodString;
|
|
36
39
|
label: z.ZodString;
|
|
37
|
-
timestamp: z.ZodNumber;
|
|
38
40
|
}, z.core.$strip>;
|
|
39
41
|
export type ProcessOutput = z.infer<typeof processOutputSchema>;
|
|
40
42
|
export declare const cancelledSchema: z.ZodObject<{
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
timestamp: z.ZodNumber;
|
|
45
|
+
response_id: z.ZodString;
|
|
41
46
|
type: z.ZodLiteral<"Cancelled">;
|
|
42
|
-
id: z.ZodOptional<z.ZodString>;
|
|
43
47
|
reason: z.ZodOptional<z.ZodString>;
|
|
44
|
-
timestamp: z.ZodNumber;
|
|
45
48
|
}, z.core.$strip>;
|
|
46
49
|
export type Cancelled = z.infer<typeof cancelledSchema>;
|
|
47
|
-
export declare const functionCallSchema: z.ZodObject<{
|
|
48
|
-
function_name: z.ZodString;
|
|
49
|
-
result: z.ZodString;
|
|
50
|
-
step_id: z.ZodString;
|
|
51
|
-
}, z.core.$strip>;
|
|
52
|
-
export type FunctionCall = z.infer<typeof functionCallSchema>;
|
|
53
50
|
export declare const naturalStopSchema: z.ZodObject<{
|
|
54
|
-
|
|
55
|
-
type: z.ZodLiteral<"NaturalStop">;
|
|
56
|
-
id: z.ZodOptional<z.ZodString>;
|
|
51
|
+
id: z.ZodString;
|
|
57
52
|
timestamp: z.ZodNumber;
|
|
53
|
+
response_id: z.ZodString;
|
|
54
|
+
type: z.ZodLiteral<"NaturalStop">;
|
|
58
55
|
}, z.core.$strip>;
|
|
59
56
|
export type NaturalStop = z.infer<typeof naturalStopSchema>;
|
|
60
57
|
export declare const sendModelRequestSchema: z.ZodObject<{
|
|
@@ -68,54 +65,46 @@ export declare const sendModelRequestSchema: z.ZodObject<{
|
|
|
68
65
|
}, z.core.$strip>;
|
|
69
66
|
export type SendModelRequest = z.infer<typeof sendModelRequestSchema>;
|
|
70
67
|
export declare const toolApprovalResponseSchema: z.ZodObject<{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
id: z.ZodString;
|
|
69
|
+
timestamp: z.ZodNumber;
|
|
70
|
+
response_id: z.ZodString;
|
|
74
71
|
approved: z.ZodBoolean;
|
|
75
72
|
rejection_reason: z.ZodOptional<z.ZodString>;
|
|
76
|
-
|
|
73
|
+
type: z.ZodLiteral<"ToolApprovalResponse">;
|
|
77
74
|
}, z.core.$strip>;
|
|
78
75
|
export type ToolApprovalResponse = z.infer<typeof toolApprovalResponseSchema>;
|
|
79
76
|
export declare const toolApprovalRequestSchema: z.ZodObject<{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
id: z.ZodString;
|
|
78
|
+
timestamp: z.ZodNumber;
|
|
79
|
+
response_id: z.ZodString;
|
|
83
80
|
name: z.ZodString;
|
|
84
81
|
arguments: z.ZodString;
|
|
85
|
-
|
|
82
|
+
type: z.ZodLiteral<"ToolApprovalRequest">;
|
|
86
83
|
}, z.core.$strip>;
|
|
87
84
|
export type ToolApprovalRequest = z.infer<typeof toolApprovalRequestSchema>;
|
|
88
85
|
export declare const textDeltaSchema: z.ZodObject<{
|
|
86
|
+
id: z.ZodString;
|
|
87
|
+
timestamp: z.ZodNumber;
|
|
88
|
+
response_id: z.ZodString;
|
|
89
89
|
delta: z.ZodString;
|
|
90
|
-
step_id: z.ZodString;
|
|
91
90
|
type: z.ZodLiteral<"TextDelta">;
|
|
92
|
-
id: z.ZodOptional<z.ZodString>;
|
|
93
|
-
timestamp: z.ZodNumber;
|
|
94
91
|
}, z.core.$strip>;
|
|
95
92
|
export type TextDelta = z.infer<typeof textDeltaSchema>;
|
|
96
|
-
export declare const toolCallGeneratingSchema: z.ZodObject<{
|
|
97
|
-
tool_name: z.ZodString;
|
|
98
|
-
step_id: z.ZodString;
|
|
99
|
-
type: z.ZodLiteral<"ToolCallGenerating">;
|
|
100
|
-
id: z.ZodOptional<z.ZodString>;
|
|
101
|
-
timestamp: z.ZodNumber;
|
|
102
|
-
}, z.core.$strip>;
|
|
103
|
-
export type ToolCallGenerating = z.infer<typeof toolCallGeneratingSchema>;
|
|
104
93
|
export declare const toolCallSchema: z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
timestamp: z.ZodNumber;
|
|
96
|
+
response_id: z.ZodString;
|
|
105
97
|
summary: z.ZodString;
|
|
106
|
-
step_id: z.ZodString;
|
|
107
|
-
type: z.ZodLiteral<"ToolCall">;
|
|
108
|
-
id: z.ZodOptional<z.ZodString>;
|
|
109
98
|
parameters: z.ZodString;
|
|
110
99
|
integration: z.ZodString;
|
|
111
|
-
|
|
100
|
+
type: z.ZodLiteral<"ToolCall">;
|
|
112
101
|
}, z.core.$strip>;
|
|
113
102
|
export type ToolCall = z.infer<typeof toolCallSchema>;
|
|
114
103
|
export declare const thinkingSchema: z.ZodObject<{
|
|
115
|
-
|
|
116
|
-
type: z.ZodLiteral<"Thinking">;
|
|
117
|
-
id: z.ZodOptional<z.ZodString>;
|
|
104
|
+
id: z.ZodString;
|
|
118
105
|
timestamp: z.ZodNumber;
|
|
106
|
+
response_id: z.ZodString;
|
|
107
|
+
type: z.ZodLiteral<"Thinking">;
|
|
119
108
|
}, z.core.$strip>;
|
|
120
109
|
export type Thinking = z.infer<typeof thinkingSchema>;
|
|
121
110
|
export declare enum ToolCallExecutionStatus {
|
|
@@ -126,12 +115,12 @@ export declare enum ToolCallExecutionStatus {
|
|
|
126
115
|
}
|
|
127
116
|
export declare const toolCallExecutionStatusSchema: z.ZodEnum<typeof ToolCallExecutionStatus>;
|
|
128
117
|
export declare const toolCallCompleteSchema: z.ZodObject<{
|
|
129
|
-
|
|
118
|
+
id: z.ZodString;
|
|
130
119
|
timestamp: z.ZodNumber;
|
|
120
|
+
response_id: z.ZodString;
|
|
121
|
+
tool_name: z.ZodString;
|
|
131
122
|
status: z.ZodEnum<typeof ToolCallExecutionStatus>;
|
|
132
|
-
step_id: z.ZodString;
|
|
133
123
|
type: z.ZodLiteral<"ToolCallComplete">;
|
|
134
|
-
id: z.ZodOptional<z.ZodString>;
|
|
135
124
|
changed_items: z.ZodArray<z.ZodObject<{
|
|
136
125
|
type_name: z.ZodEnum<typeof EntityType>;
|
|
137
126
|
id: z.ZodString;
|
|
@@ -146,13 +135,13 @@ export declare const toolCallCompleteSchema: z.ZodObject<{
|
|
|
146
135
|
}, z.core.$strip>;
|
|
147
136
|
export type ToolCallComplete = z.infer<typeof toolCallCompleteSchema>;
|
|
148
137
|
export declare const filterResultSchema: z.ZodObject<{
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
timestamp: z.ZodNumber;
|
|
140
|
+
response_id: z.ZodString;
|
|
149
141
|
isRelevant: z.ZodBoolean;
|
|
150
142
|
reason: z.ZodString;
|
|
151
143
|
confidence: z.ZodNumber;
|
|
152
|
-
step_id: z.ZodString;
|
|
153
144
|
type: z.ZodLiteral<"FilterResult">;
|
|
154
|
-
id: z.ZodOptional<z.ZodString>;
|
|
155
|
-
timestamp: z.ZodNumber;
|
|
156
145
|
}, z.core.$strip>;
|
|
157
146
|
export type FilterResult = z.infer<typeof filterResultSchema>;
|
|
158
147
|
export declare enum SandboxStage {
|
|
@@ -165,12 +154,12 @@ export declare enum SandboxStage {
|
|
|
165
154
|
export declare const sandboxStageSchema: z.ZodEnum<typeof SandboxStage>;
|
|
166
155
|
export declare const SANDBOX_STAGE_LABELS: Record<SandboxStage, string>;
|
|
167
156
|
export declare const userMessageSchema: z.ZodObject<{
|
|
157
|
+
id: z.ZodString;
|
|
158
|
+
timestamp: z.ZodNumber;
|
|
159
|
+
response_id: z.ZodString;
|
|
168
160
|
type: z.ZodLiteral<"UserMessage">;
|
|
169
|
-
id: z.ZodOptional<z.ZodString>;
|
|
170
161
|
message: z.ZodString;
|
|
171
|
-
step_id: z.ZodString;
|
|
172
162
|
client_turn_id: z.ZodString;
|
|
173
|
-
timestamp: z.ZodNumber;
|
|
174
163
|
}, z.core.$strip>;
|
|
175
164
|
export type UserMessage = z.infer<typeof userMessageSchema>;
|
|
176
165
|
export declare const multipleChoiceOptionSchema: z.ZodObject<{
|
|
@@ -237,7 +226,6 @@ export declare const chatSnippetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
237
226
|
label: z.ZodString;
|
|
238
227
|
url: z.ZodString;
|
|
239
228
|
id: z.ZodOptional<z.ZodString>;
|
|
240
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
241
229
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
242
230
|
}, z.core.$strip>, z.ZodObject<{
|
|
243
231
|
type: z.ZodLiteral<"integration_prompt">;
|
|
@@ -245,13 +233,11 @@ export declare const chatSnippetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
245
233
|
message: z.ZodString;
|
|
246
234
|
stateToken: z.ZodOptional<z.ZodString>;
|
|
247
235
|
id: z.ZodOptional<z.ZodString>;
|
|
248
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
249
236
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
250
237
|
}, z.core.$strip>, z.ZodObject<{
|
|
251
238
|
type: z.ZodLiteral<"navigate">;
|
|
252
239
|
path: z.ZodString;
|
|
253
240
|
id: z.ZodOptional<z.ZodString>;
|
|
254
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
255
241
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
256
242
|
}, z.core.$strip>, z.ZodObject<{
|
|
257
243
|
type: z.ZodLiteral<"multiple_choice">;
|
|
@@ -263,26 +249,24 @@ export declare const chatSnippetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
263
249
|
}, z.core.$strip>>;
|
|
264
250
|
allowMultiple: z.ZodOptional<z.ZodBoolean>;
|
|
265
251
|
id: z.ZodOptional<z.ZodString>;
|
|
266
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
267
252
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
268
253
|
}, z.core.$strip>, z.ZodObject<{
|
|
269
254
|
type: z.ZodLiteral<"image">;
|
|
270
255
|
url: z.ZodString;
|
|
271
256
|
id: z.ZodOptional<z.ZodString>;
|
|
272
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
273
257
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
274
258
|
}, z.core.$strip>], "type">;
|
|
275
259
|
export type ChatSnippet = z.infer<typeof chatSnippetSchema>;
|
|
276
260
|
export declare const modelEventChatSnippetSchema: z.ZodObject<{
|
|
277
|
-
|
|
278
|
-
id: z.ZodOptional<z.ZodString>;
|
|
261
|
+
id: z.ZodString;
|
|
279
262
|
timestamp: z.ZodNumber;
|
|
263
|
+
response_id: z.ZodString;
|
|
264
|
+
type: z.ZodLiteral<"Snippet">;
|
|
280
265
|
snippet: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
281
266
|
type: z.ZodLiteral<"button">;
|
|
282
267
|
label: z.ZodString;
|
|
283
268
|
url: z.ZodString;
|
|
284
269
|
id: z.ZodOptional<z.ZodString>;
|
|
285
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
286
270
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
287
271
|
}, z.core.$strip>, z.ZodObject<{
|
|
288
272
|
type: z.ZodLiteral<"integration_prompt">;
|
|
@@ -290,13 +274,11 @@ export declare const modelEventChatSnippetSchema: z.ZodObject<{
|
|
|
290
274
|
message: z.ZodString;
|
|
291
275
|
stateToken: z.ZodOptional<z.ZodString>;
|
|
292
276
|
id: z.ZodOptional<z.ZodString>;
|
|
293
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
294
277
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
295
278
|
}, z.core.$strip>, z.ZodObject<{
|
|
296
279
|
type: z.ZodLiteral<"navigate">;
|
|
297
280
|
path: z.ZodString;
|
|
298
281
|
id: z.ZodOptional<z.ZodString>;
|
|
299
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
300
282
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
301
283
|
}, z.core.$strip>, z.ZodObject<{
|
|
302
284
|
type: z.ZodLiteral<"multiple_choice">;
|
|
@@ -308,51 +290,43 @@ export declare const modelEventChatSnippetSchema: z.ZodObject<{
|
|
|
308
290
|
}, z.core.$strip>>;
|
|
309
291
|
allowMultiple: z.ZodOptional<z.ZodBoolean>;
|
|
310
292
|
id: z.ZodOptional<z.ZodString>;
|
|
311
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
312
293
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
313
294
|
}, z.core.$strip>, z.ZodObject<{
|
|
314
295
|
type: z.ZodLiteral<"image">;
|
|
315
296
|
url: z.ZodString;
|
|
316
297
|
id: z.ZodOptional<z.ZodString>;
|
|
317
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
318
298
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
319
299
|
}, z.core.$strip>], "type">;
|
|
320
300
|
}, z.core.$strip>;
|
|
321
301
|
export declare const modelEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
302
|
+
id: z.ZodString;
|
|
303
|
+
timestamp: z.ZodNumber;
|
|
304
|
+
response_id: z.ZodString;
|
|
325
305
|
approved: z.ZodBoolean;
|
|
326
306
|
rejection_reason: z.ZodOptional<z.ZodString>;
|
|
327
|
-
|
|
307
|
+
type: z.ZodLiteral<"ToolApprovalResponse">;
|
|
328
308
|
}, z.core.$strip>, z.ZodObject<{
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
309
|
+
id: z.ZodString;
|
|
310
|
+
timestamp: z.ZodNumber;
|
|
311
|
+
response_id: z.ZodString;
|
|
332
312
|
name: z.ZodString;
|
|
333
313
|
arguments: z.ZodString;
|
|
334
|
-
|
|
314
|
+
type: z.ZodLiteral<"ToolApprovalRequest">;
|
|
335
315
|
}, z.core.$strip>, z.ZodObject<{
|
|
336
|
-
|
|
337
|
-
step_id: z.ZodString;
|
|
338
|
-
type: z.ZodLiteral<"ToolCallGenerating">;
|
|
339
|
-
id: z.ZodOptional<z.ZodString>;
|
|
316
|
+
id: z.ZodString;
|
|
340
317
|
timestamp: z.ZodNumber;
|
|
341
|
-
|
|
318
|
+
response_id: z.ZodString;
|
|
342
319
|
summary: z.ZodString;
|
|
343
|
-
step_id: z.ZodString;
|
|
344
|
-
type: z.ZodLiteral<"ToolCall">;
|
|
345
|
-
id: z.ZodOptional<z.ZodString>;
|
|
346
320
|
parameters: z.ZodString;
|
|
347
321
|
integration: z.ZodString;
|
|
348
|
-
|
|
322
|
+
type: z.ZodLiteral<"ToolCall">;
|
|
349
323
|
}, z.core.$strip>, z.ZodObject<{
|
|
350
|
-
|
|
324
|
+
id: z.ZodString;
|
|
351
325
|
timestamp: z.ZodNumber;
|
|
326
|
+
response_id: z.ZodString;
|
|
327
|
+
tool_name: z.ZodString;
|
|
352
328
|
status: z.ZodEnum<typeof ToolCallExecutionStatus>;
|
|
353
|
-
step_id: z.ZodString;
|
|
354
329
|
type: z.ZodLiteral<"ToolCallComplete">;
|
|
355
|
-
id: z.ZodOptional<z.ZodString>;
|
|
356
330
|
changed_items: z.ZodArray<z.ZodObject<{
|
|
357
331
|
type_name: z.ZodEnum<typeof EntityType>;
|
|
358
332
|
id: z.ZodString;
|
|
@@ -365,57 +339,59 @@ export declare const modelEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
365
339
|
error: z.ZodUnknown;
|
|
366
340
|
}, z.core.$strip>>;
|
|
367
341
|
}, z.core.$strip>, z.ZodObject<{
|
|
342
|
+
id: z.ZodString;
|
|
343
|
+
timestamp: z.ZodNumber;
|
|
344
|
+
response_id: z.ZodString;
|
|
368
345
|
delta: z.ZodString;
|
|
369
|
-
step_id: z.ZodString;
|
|
370
346
|
type: z.ZodLiteral<"TextDelta">;
|
|
371
|
-
id: z.ZodOptional<z.ZodString>;
|
|
372
|
-
timestamp: z.ZodNumber;
|
|
373
347
|
}, z.core.$strip>, z.ZodObject<{
|
|
348
|
+
id: z.ZodString;
|
|
349
|
+
timestamp: z.ZodNumber;
|
|
350
|
+
response_id: z.ZodString;
|
|
374
351
|
type: z.ZodLiteral<"RunError">;
|
|
375
|
-
id: z.ZodOptional<z.ZodString>;
|
|
376
352
|
error: z.ZodString;
|
|
377
353
|
code: z.ZodOptional<z.ZodString>;
|
|
378
|
-
timestamp: z.ZodNumber;
|
|
379
354
|
}, z.core.$strip>, z.ZodObject<{
|
|
355
|
+
id: z.ZodString;
|
|
356
|
+
timestamp: z.ZodNumber;
|
|
357
|
+
response_id: z.ZodString;
|
|
380
358
|
type: z.ZodLiteral<"Cancelled">;
|
|
381
|
-
id: z.ZodOptional<z.ZodString>;
|
|
382
359
|
reason: z.ZodOptional<z.ZodString>;
|
|
383
|
-
timestamp: z.ZodNumber;
|
|
384
360
|
}, z.core.$strip>, z.ZodObject<{
|
|
385
|
-
|
|
386
|
-
type: z.ZodLiteral<"NaturalStop">;
|
|
387
|
-
id: z.ZodOptional<z.ZodString>;
|
|
361
|
+
id: z.ZodString;
|
|
388
362
|
timestamp: z.ZodNumber;
|
|
363
|
+
response_id: z.ZodString;
|
|
364
|
+
type: z.ZodLiteral<"NaturalStop">;
|
|
389
365
|
}, z.core.$strip>, z.ZodObject<{
|
|
366
|
+
id: z.ZodString;
|
|
367
|
+
timestamp: z.ZodNumber;
|
|
368
|
+
response_id: z.ZodString;
|
|
390
369
|
isRelevant: z.ZodBoolean;
|
|
391
370
|
reason: z.ZodString;
|
|
392
371
|
confidence: z.ZodNumber;
|
|
393
|
-
step_id: z.ZodString;
|
|
394
372
|
type: z.ZodLiteral<"FilterResult">;
|
|
395
|
-
id: z.ZodOptional<z.ZodString>;
|
|
396
|
-
timestamp: z.ZodNumber;
|
|
397
373
|
}, z.core.$strip>, z.ZodObject<{
|
|
374
|
+
id: z.ZodString;
|
|
375
|
+
timestamp: z.ZodNumber;
|
|
376
|
+
response_id: z.ZodString;
|
|
398
377
|
type: z.ZodLiteral<"UserMessage">;
|
|
399
|
-
id: z.ZodOptional<z.ZodString>;
|
|
400
378
|
message: z.ZodString;
|
|
401
|
-
step_id: z.ZodString;
|
|
402
379
|
client_turn_id: z.ZodString;
|
|
403
|
-
timestamp: z.ZodNumber;
|
|
404
380
|
}, z.core.$strip>, z.ZodObject<{
|
|
405
|
-
|
|
406
|
-
type: z.ZodLiteral<"Thinking">;
|
|
407
|
-
id: z.ZodOptional<z.ZodString>;
|
|
381
|
+
id: z.ZodString;
|
|
408
382
|
timestamp: z.ZodNumber;
|
|
383
|
+
response_id: z.ZodString;
|
|
384
|
+
type: z.ZodLiteral<"Thinking">;
|
|
409
385
|
}, z.core.$strip>, z.ZodObject<{
|
|
410
|
-
|
|
411
|
-
id: z.ZodOptional<z.ZodString>;
|
|
386
|
+
id: z.ZodString;
|
|
412
387
|
timestamp: z.ZodNumber;
|
|
388
|
+
response_id: z.ZodString;
|
|
389
|
+
type: z.ZodLiteral<"Snippet">;
|
|
413
390
|
snippet: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
414
391
|
type: z.ZodLiteral<"button">;
|
|
415
392
|
label: z.ZodString;
|
|
416
393
|
url: z.ZodString;
|
|
417
394
|
id: z.ZodOptional<z.ZodString>;
|
|
418
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
419
395
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
420
396
|
}, z.core.$strip>, z.ZodObject<{
|
|
421
397
|
type: z.ZodLiteral<"integration_prompt">;
|
|
@@ -423,13 +399,11 @@ export declare const modelEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
423
399
|
message: z.ZodString;
|
|
424
400
|
stateToken: z.ZodOptional<z.ZodString>;
|
|
425
401
|
id: z.ZodOptional<z.ZodString>;
|
|
426
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
427
402
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
428
403
|
}, z.core.$strip>, z.ZodObject<{
|
|
429
404
|
type: z.ZodLiteral<"navigate">;
|
|
430
405
|
path: z.ZodString;
|
|
431
406
|
id: z.ZodOptional<z.ZodString>;
|
|
432
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
433
407
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
434
408
|
}, z.core.$strip>, z.ZodObject<{
|
|
435
409
|
type: z.ZodLiteral<"multiple_choice">;
|
|
@@ -441,25 +415,24 @@ export declare const modelEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
441
415
|
}, z.core.$strip>>;
|
|
442
416
|
allowMultiple: z.ZodOptional<z.ZodBoolean>;
|
|
443
417
|
id: z.ZodOptional<z.ZodString>;
|
|
444
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
445
418
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
446
419
|
}, z.core.$strip>, z.ZodObject<{
|
|
447
420
|
type: z.ZodLiteral<"image">;
|
|
448
421
|
url: z.ZodString;
|
|
449
422
|
id: z.ZodOptional<z.ZodString>;
|
|
450
|
-
step_id: z.ZodOptional<z.ZodString>;
|
|
451
423
|
selectedValue: z.ZodOptional<z.ZodString>;
|
|
452
424
|
}, z.core.$strip>], "type">;
|
|
453
425
|
}, z.core.$strip>, z.ZodObject<{
|
|
426
|
+
id: z.ZodString;
|
|
427
|
+
timestamp: z.ZodNumber;
|
|
428
|
+
response_id: z.ZodString;
|
|
454
429
|
type: z.ZodLiteral<"ProcessOutput">;
|
|
455
|
-
id: z.ZodOptional<z.ZodString>;
|
|
456
430
|
stream: z.ZodEnum<{
|
|
457
431
|
stdout: "stdout";
|
|
458
432
|
stderr: "stderr";
|
|
459
433
|
}>;
|
|
460
434
|
content: z.ZodString;
|
|
461
435
|
label: z.ZodString;
|
|
462
|
-
timestamp: z.ZodNumber;
|
|
463
436
|
}, z.core.$strip>], "type">;
|
|
464
437
|
export type ModelEvent = z.infer<typeof modelEventSchema>;
|
|
465
438
|
export declare const modelRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -471,11 +444,11 @@ export declare const modelRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
471
444
|
client_turn_id: z.ZodString;
|
|
472
445
|
template_id: z.ZodOptional<z.ZodString>;
|
|
473
446
|
}, z.core.$strip>, z.ZodObject<{
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
447
|
+
id: z.ZodString;
|
|
448
|
+
timestamp: z.ZodNumber;
|
|
449
|
+
response_id: z.ZodString;
|
|
477
450
|
approved: z.ZodBoolean;
|
|
478
451
|
rejection_reason: z.ZodOptional<z.ZodString>;
|
|
479
|
-
|
|
452
|
+
type: z.ZodLiteral<"ToolApprovalResponse">;
|
|
480
453
|
}, z.core.$strip>], "type">;
|
|
481
454
|
export type ModelRequest = z.infer<typeof modelRequestSchema>;
|
package/dist/ModelEvents.js
CHANGED
|
@@ -7,6 +7,11 @@ export var ChangeEventType;
|
|
|
7
7
|
ChangeEventType["UPDATED"] = "UPDATED";
|
|
8
8
|
ChangeEventType["ACTION_EXECUTED"] = "ACTION_EXECUTED";
|
|
9
9
|
})(ChangeEventType || (ChangeEventType = {}));
|
|
10
|
+
const modelEventBaseSchema = z.object({
|
|
11
|
+
id: z.string(),
|
|
12
|
+
timestamp: z.number(),
|
|
13
|
+
response_id: z.string()
|
|
14
|
+
});
|
|
10
15
|
export const changeEventTypeSchema = z.enum(ChangeEventType);
|
|
11
16
|
export const sharedErrorContextSchema = z.object({
|
|
12
17
|
error: z.unknown()
|
|
@@ -16,37 +21,23 @@ export const changedItemSchema = z.object({
|
|
|
16
21
|
id: z.string(),
|
|
17
22
|
change_event_type: changeEventTypeSchema
|
|
18
23
|
});
|
|
19
|
-
export const runErrorSchema =
|
|
24
|
+
export const runErrorSchema = modelEventBaseSchema.extend({
|
|
20
25
|
type: z.literal("RunError"),
|
|
21
|
-
id: z.string().optional(),
|
|
22
26
|
error: z.string(),
|
|
23
|
-
code: z.string().optional()
|
|
24
|
-
timestamp: z.number()
|
|
27
|
+
code: z.string().optional()
|
|
25
28
|
});
|
|
26
|
-
export const processOutputSchema =
|
|
29
|
+
export const processOutputSchema = modelEventBaseSchema.extend({
|
|
27
30
|
type: z.literal("ProcessOutput"),
|
|
28
|
-
id: z.string().optional(),
|
|
29
31
|
stream: z.enum(["stdout", "stderr"]),
|
|
30
32
|
content: z.string(),
|
|
31
|
-
label: z.string()
|
|
32
|
-
timestamp: z.number()
|
|
33
|
+
label: z.string()
|
|
33
34
|
});
|
|
34
|
-
export const cancelledSchema =
|
|
35
|
+
export const cancelledSchema = modelEventBaseSchema.extend({
|
|
35
36
|
type: z.literal("Cancelled"),
|
|
36
|
-
|
|
37
|
-
reason: z.string().optional(),
|
|
38
|
-
timestamp: z.number()
|
|
39
|
-
});
|
|
40
|
-
export const functionCallSchema = z.object({
|
|
41
|
-
function_name: z.string(),
|
|
42
|
-
result: z.string(),
|
|
43
|
-
step_id: z.string()
|
|
37
|
+
reason: z.string().optional()
|
|
44
38
|
});
|
|
45
|
-
export const naturalStopSchema =
|
|
46
|
-
|
|
47
|
-
type: z.literal("NaturalStop"),
|
|
48
|
-
id: z.string().optional(),
|
|
49
|
-
timestamp: z.number()
|
|
39
|
+
export const naturalStopSchema = modelEventBaseSchema.extend({
|
|
40
|
+
type: z.literal("NaturalStop")
|
|
50
41
|
});
|
|
51
42
|
export const sendModelRequestSchema = z.object({
|
|
52
43
|
type: z.literal("SendModelRequest"),
|
|
@@ -57,50 +48,28 @@ export const sendModelRequestSchema = z.object({
|
|
|
57
48
|
client_turn_id: z.string(),
|
|
58
49
|
template_id: z.string().optional()
|
|
59
50
|
});
|
|
60
|
-
export const toolApprovalResponseSchema =
|
|
61
|
-
step_id: z.string(),
|
|
62
|
-
type: z.literal("ToolApprovalResponse"),
|
|
63
|
-
id: z.string().optional(),
|
|
51
|
+
export const toolApprovalResponseSchema = modelEventBaseSchema.extend({
|
|
64
52
|
approved: z.boolean(),
|
|
65
53
|
rejection_reason: z.string().optional(),
|
|
66
|
-
|
|
54
|
+
type: z.literal("ToolApprovalResponse")
|
|
67
55
|
});
|
|
68
|
-
export const toolApprovalRequestSchema =
|
|
69
|
-
step_id: z.string(),
|
|
70
|
-
type: z.literal("ToolApprovalRequest"),
|
|
71
|
-
id: z.string().optional(),
|
|
56
|
+
export const toolApprovalRequestSchema = modelEventBaseSchema.extend({
|
|
72
57
|
name: z.string(),
|
|
73
58
|
arguments: z.string(),
|
|
74
|
-
|
|
59
|
+
type: z.literal("ToolApprovalRequest")
|
|
75
60
|
});
|
|
76
|
-
export const textDeltaSchema =
|
|
61
|
+
export const textDeltaSchema = modelEventBaseSchema.extend({
|
|
77
62
|
delta: z.string(),
|
|
78
|
-
|
|
79
|
-
type: z.literal("TextDelta"),
|
|
80
|
-
id: z.string().optional(),
|
|
81
|
-
timestamp: z.number()
|
|
63
|
+
type: z.literal("TextDelta")
|
|
82
64
|
});
|
|
83
|
-
export const
|
|
84
|
-
tool_name: z.string(),
|
|
85
|
-
step_id: z.string(),
|
|
86
|
-
type: z.literal("ToolCallGenerating"),
|
|
87
|
-
id: z.string().optional(),
|
|
88
|
-
timestamp: z.number()
|
|
89
|
-
});
|
|
90
|
-
export const toolCallSchema = z.object({
|
|
65
|
+
export const toolCallSchema = modelEventBaseSchema.extend({
|
|
91
66
|
summary: z.string(),
|
|
92
|
-
step_id: z.string(),
|
|
93
|
-
type: z.literal("ToolCall"),
|
|
94
|
-
id: z.string().optional(),
|
|
95
67
|
parameters: z.string(),
|
|
96
68
|
integration: z.string(),
|
|
97
|
-
|
|
69
|
+
type: z.literal("ToolCall")
|
|
98
70
|
});
|
|
99
|
-
export const thinkingSchema =
|
|
100
|
-
|
|
101
|
-
type: z.literal("Thinking"),
|
|
102
|
-
id: z.string().optional(),
|
|
103
|
-
timestamp: z.number()
|
|
71
|
+
export const thinkingSchema = modelEventBaseSchema.extend({
|
|
72
|
+
type: z.literal("Thinking")
|
|
104
73
|
});
|
|
105
74
|
export var ToolCallExecutionStatus;
|
|
106
75
|
(function (ToolCallExecutionStatus) {
|
|
@@ -110,27 +79,21 @@ export var ToolCallExecutionStatus;
|
|
|
110
79
|
ToolCallExecutionStatus["UNKNOWN"] = "unknown";
|
|
111
80
|
})(ToolCallExecutionStatus || (ToolCallExecutionStatus = {}));
|
|
112
81
|
export const toolCallExecutionStatusSchema = z.enum(ToolCallExecutionStatus);
|
|
113
|
-
export const toolCallCompleteSchema =
|
|
82
|
+
export const toolCallCompleteSchema = modelEventBaseSchema.extend({
|
|
114
83
|
tool_name: z.string(),
|
|
115
|
-
timestamp: z.number(),
|
|
116
84
|
status: toolCallExecutionStatusSchema,
|
|
117
|
-
step_id: z.string(),
|
|
118
85
|
type: z.literal("ToolCallComplete"),
|
|
119
|
-
id: z.string().optional(),
|
|
120
86
|
changed_items: z.array(changedItemSchema),
|
|
121
87
|
integration: z.string(),
|
|
122
88
|
url: z.string().optional(),
|
|
123
89
|
result: z.string().optional(),
|
|
124
90
|
errorContext: sharedErrorContextSchema.optional()
|
|
125
91
|
});
|
|
126
|
-
export const filterResultSchema =
|
|
92
|
+
export const filterResultSchema = modelEventBaseSchema.extend({
|
|
127
93
|
isRelevant: z.boolean(),
|
|
128
94
|
reason: z.string(),
|
|
129
95
|
confidence: z.number(),
|
|
130
|
-
|
|
131
|
-
type: z.literal("FilterResult"),
|
|
132
|
-
id: z.string().optional(),
|
|
133
|
-
timestamp: z.number()
|
|
96
|
+
type: z.literal("FilterResult")
|
|
134
97
|
});
|
|
135
98
|
export var SandboxStage;
|
|
136
99
|
(function (SandboxStage) {
|
|
@@ -148,13 +111,10 @@ export const SANDBOX_STAGE_LABELS = {
|
|
|
148
111
|
[SandboxStage.INSTALLING_CLI]: "Installing CLI",
|
|
149
112
|
[SandboxStage.RUNNING]: "Running agent"
|
|
150
113
|
};
|
|
151
|
-
export const userMessageSchema =
|
|
114
|
+
export const userMessageSchema = modelEventBaseSchema.extend({
|
|
152
115
|
type: z.literal("UserMessage"),
|
|
153
|
-
id: z.string().optional(),
|
|
154
116
|
message: z.string(),
|
|
155
|
-
|
|
156
|
-
client_turn_id: z.string(),
|
|
157
|
-
timestamp: z.number()
|
|
117
|
+
client_turn_id: z.string()
|
|
158
118
|
});
|
|
159
119
|
export const multipleChoiceOptionSchema = z.object({
|
|
160
120
|
label: z.string(),
|
|
@@ -189,7 +149,6 @@ export const imageSchema = z.object({
|
|
|
189
149
|
export const snippetVariantSchema = z.discriminatedUnion("type", [buttonSchema, integrationPromptSchema, navigateSchema, multipleChoiceSchema, imageSchema]);
|
|
190
150
|
const chatSnippetMetadataSchema = {
|
|
191
151
|
id: z.string().optional(),
|
|
192
|
-
step_id: z.string().optional(),
|
|
193
152
|
selectedValue: z.string().optional()
|
|
194
153
|
};
|
|
195
154
|
export const chatSnippetSchema = z.discriminatedUnion("type", [
|
|
@@ -199,16 +158,13 @@ export const chatSnippetSchema = z.discriminatedUnion("type", [
|
|
|
199
158
|
multipleChoiceSchema.extend(chatSnippetMetadataSchema),
|
|
200
159
|
imageSchema.extend(chatSnippetMetadataSchema)
|
|
201
160
|
]);
|
|
202
|
-
export const modelEventChatSnippetSchema =
|
|
161
|
+
export const modelEventChatSnippetSchema = modelEventBaseSchema.extend({
|
|
203
162
|
type: z.literal("Snippet"),
|
|
204
|
-
id: z.string().optional(),
|
|
205
|
-
timestamp: z.number(),
|
|
206
163
|
snippet: chatSnippetSchema
|
|
207
164
|
});
|
|
208
165
|
export const modelEventSchema = z.discriminatedUnion("type", [
|
|
209
166
|
toolApprovalResponseSchema,
|
|
210
167
|
toolApprovalRequestSchema,
|
|
211
|
-
toolCallGeneratingSchema,
|
|
212
168
|
toolCallSchema,
|
|
213
169
|
toolCallCompleteSchema,
|
|
214
170
|
textDeltaSchema,
|
package/dist/SocketEvents.d.ts
CHANGED
|
@@ -17,11 +17,6 @@ export declare const SocketEvents: {
|
|
|
17
17
|
readonly WORKOS_FORCE_LOGOUT: "workos:force:logout";
|
|
18
18
|
readonly WORKOS_SESSION_UPDATED: "workos:session:updated";
|
|
19
19
|
readonly WORKOS_ORG_UPDATED: "workos:org:updated";
|
|
20
|
-
readonly BUILDER_CHAT_EVENT: "builder:chat:event";
|
|
21
|
-
readonly BUILDER_CHAT_MESSAGE: "builder:chat:message";
|
|
22
|
-
readonly BUILDER_CHAT_CANCEL: "builder:chat:cancel";
|
|
23
|
-
readonly BUILDER_CHAT_APPROVAL: "builder:chat:approval";
|
|
24
|
-
readonly BUILDER_CHAT_MULTIPLE_CHOICE_ANSWER: "builder:chat:multiple_choice_answer";
|
|
25
20
|
};
|
|
26
21
|
/**
|
|
27
22
|
* Socket room name patterns and helpers
|
package/dist/SocketEvents.js
CHANGED
|
@@ -19,13 +19,7 @@ export const SocketEvents = {
|
|
|
19
19
|
WORKOS_USER_UPDATED: "workos:user:updated",
|
|
20
20
|
WORKOS_FORCE_LOGOUT: "workos:force:logout",
|
|
21
21
|
WORKOS_SESSION_UPDATED: "workos:session:updated",
|
|
22
|
-
WORKOS_ORG_UPDATED: "workos:org:updated"
|
|
23
|
-
// Builder chat events
|
|
24
|
-
BUILDER_CHAT_EVENT: "builder:chat:event",
|
|
25
|
-
BUILDER_CHAT_MESSAGE: "builder:chat:message",
|
|
26
|
-
BUILDER_CHAT_CANCEL: "builder:chat:cancel",
|
|
27
|
-
BUILDER_CHAT_APPROVAL: "builder:chat:approval",
|
|
28
|
-
BUILDER_CHAT_MULTIPLE_CHOICE_ANSWER: "builder:chat:multiple_choice_answer"
|
|
22
|
+
WORKOS_ORG_UPDATED: "workos:org:updated"
|
|
29
23
|
};
|
|
30
24
|
/**
|
|
31
25
|
* Socket room name patterns and helpers
|
package/dist/ToolDisplayUtils.js
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
import { INTEGRATION_METADATA } from "./Integrations.js";
|
|
2
|
-
var PolledRunStatus;
|
|
3
|
-
(function (PolledRunStatus) {
|
|
4
|
-
PolledRunStatus["SUCCESS"] = "success";
|
|
5
|
-
PolledRunStatus["FAILED"] = "failed";
|
|
6
|
-
PolledRunStatus["CANCELLED"] = "cancelled";
|
|
7
|
-
PolledRunStatus["SKIPPED"] = "skipped";
|
|
8
|
-
PolledRunStatus["AWAITING_APPROVAL"] = "awaiting_approval";
|
|
9
|
-
PolledRunStatus["IN_PROGRESS"] = "in_progress";
|
|
10
|
-
})(PolledRunStatus || (PolledRunStatus = {}));
|
|
11
|
-
/**
|
|
12
|
-
* Helper to get a friendly integration name from params
|
|
13
|
-
*/
|
|
14
|
-
function getIntegrationName(integrationType) {
|
|
15
|
-
if (!integrationType)
|
|
16
|
-
return "integration";
|
|
17
|
-
const meta = INTEGRATION_METADATA[integrationType];
|
|
18
|
-
return meta?.name || integrationType;
|
|
19
|
-
}
|
|
20
1
|
/** Truncate a string to maxLen characters with an ellipsis */
|
|
21
2
|
function truncate(text, maxLen = 35) {
|
|
22
3
|
return text.length > maxLen ? `${text.slice(0, maxLen)}…` : text;
|
|
@@ -33,24 +14,6 @@ function safeParseResult(result) {
|
|
|
33
14
|
return undefined;
|
|
34
15
|
}
|
|
35
16
|
}
|
|
36
|
-
function toPolledRunStatus(status) {
|
|
37
|
-
switch (status) {
|
|
38
|
-
case PolledRunStatus.SUCCESS:
|
|
39
|
-
return PolledRunStatus.SUCCESS;
|
|
40
|
-
case PolledRunStatus.FAILED:
|
|
41
|
-
return PolledRunStatus.FAILED;
|
|
42
|
-
case PolledRunStatus.CANCELLED:
|
|
43
|
-
return PolledRunStatus.CANCELLED;
|
|
44
|
-
case PolledRunStatus.SKIPPED:
|
|
45
|
-
return PolledRunStatus.SKIPPED;
|
|
46
|
-
case PolledRunStatus.AWAITING_APPROVAL:
|
|
47
|
-
return PolledRunStatus.AWAITING_APPROVAL;
|
|
48
|
-
case PolledRunStatus.IN_PROGRESS:
|
|
49
|
-
return PolledRunStatus.IN_PROGRESS;
|
|
50
|
-
default:
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
17
|
/**
|
|
55
18
|
* Display configurations for all tools.
|
|
56
19
|
* Each tool defines how it should be displayed in preparing, executing, and complete phases.
|
|
@@ -61,130 +24,6 @@ function toPolledRunStatus(status) {
|
|
|
61
24
|
* - complete: The tool has finished — params and result are both available
|
|
62
25
|
*/
|
|
63
26
|
const TOOL_DISPLAY_CONFIG = {
|
|
64
|
-
// ===================
|
|
65
|
-
// ChatAgent Tools
|
|
66
|
-
// ===================
|
|
67
|
-
applyAgent: {
|
|
68
|
-
preparing: "Getting your workflow ready",
|
|
69
|
-
executing: params => {
|
|
70
|
-
const agent = params?.agent;
|
|
71
|
-
const name = agent?.name;
|
|
72
|
-
return name ? `Setting up "${truncate(name)}"` : "Setting up your workflow";
|
|
73
|
-
},
|
|
74
|
-
complete: params => {
|
|
75
|
-
const agent = params?.agent;
|
|
76
|
-
const name = agent?.name;
|
|
77
|
-
return name ? `You're all set: "${truncate(name)}"` : "Your workflow is ready";
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
promptForIntegration: {
|
|
81
|
-
preparing: "Getting connection ready",
|
|
82
|
-
executing: params => {
|
|
83
|
-
const integration = getIntegrationName(params?.integration);
|
|
84
|
-
return `Connecting ${integration}`;
|
|
85
|
-
},
|
|
86
|
-
complete: params => {
|
|
87
|
-
const integration = getIntegrationName(params?.integration);
|
|
88
|
-
return `${integration} is connected`;
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
askSurveyQuestion: {
|
|
92
|
-
preparing: "Quick question",
|
|
93
|
-
executing: params => {
|
|
94
|
-
const question = params?.question || "A quick question";
|
|
95
|
-
return question.length > 40 ? `${question.slice(0, 40)}…` : question;
|
|
96
|
-
},
|
|
97
|
-
complete: (_params, result) => {
|
|
98
|
-
if (!result)
|
|
99
|
-
return "Answered";
|
|
100
|
-
// Result may be a JSON-encoded string (e.g. "\"Option A\"") or a JSON object
|
|
101
|
-
try {
|
|
102
|
-
const parsed = JSON.parse(result);
|
|
103
|
-
if (typeof parsed === "string")
|
|
104
|
-
return truncate(parsed, 50);
|
|
105
|
-
if (typeof parsed === "object" && parsed !== null) {
|
|
106
|
-
const answer = parsed.text;
|
|
107
|
-
if (typeof answer === "string")
|
|
108
|
-
return truncate(answer, 50);
|
|
109
|
-
return "Answered";
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
catch {
|
|
113
|
-
// raw string, use as-is
|
|
114
|
-
}
|
|
115
|
-
return `Answered: ${truncate(result, 50)}`;
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
fetchResourcesForIntegration: {
|
|
119
|
-
preparing: "Looking things up",
|
|
120
|
-
executing: params => {
|
|
121
|
-
const integration = getIntegrationName(params?.integrationType);
|
|
122
|
-
return `Checking what's available in ${integration}`;
|
|
123
|
-
},
|
|
124
|
-
complete: params => {
|
|
125
|
-
const integration = getIntegrationName(params?.integrationType);
|
|
126
|
-
return `Found available options in ${integration}`;
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
getSampleEvents: {
|
|
130
|
-
preparing: "Finding recent examples",
|
|
131
|
-
executing: params => {
|
|
132
|
-
const integration = getIntegrationName(params?.integrationType);
|
|
133
|
-
return `Getting recent examples from ${integration}`;
|
|
134
|
-
},
|
|
135
|
-
complete: (params, result) => {
|
|
136
|
-
const parsed = safeParseResult(result);
|
|
137
|
-
const events = parsed?.events;
|
|
138
|
-
const count = events?.length;
|
|
139
|
-
const integration = getIntegrationName(params?.integrationType);
|
|
140
|
-
if (count !== undefined && integration)
|
|
141
|
-
return `Found ${count} recent example${count !== 1 ? "s" : ""} from ${integration}`;
|
|
142
|
-
if (count !== undefined)
|
|
143
|
-
return `Found ${count} recent example${count !== 1 ? "s" : ""}`;
|
|
144
|
-
return `Found recent examples from ${integration}`;
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
triggerAgentRun: {
|
|
148
|
-
preparing: "Starting a run",
|
|
149
|
-
executing: () => "Starting a run",
|
|
150
|
-
complete: (_params, result) => {
|
|
151
|
-
const parsed = safeParseResult(result);
|
|
152
|
-
const name = parsed?.agentName;
|
|
153
|
-
if (name)
|
|
154
|
-
return `Started "${truncate(name)}"`;
|
|
155
|
-
return "Run started";
|
|
156
|
-
},
|
|
157
|
-
approval: () => "Start this run?"
|
|
158
|
-
},
|
|
159
|
-
pollTriggeredRunStatus: {
|
|
160
|
-
preparing: "Getting the latest progress",
|
|
161
|
-
executing: () => "Checking progress",
|
|
162
|
-
complete: (_params, result) => {
|
|
163
|
-
const parsed = safeParseResult(result);
|
|
164
|
-
const status = toPolledRunStatus(parsed?.status);
|
|
165
|
-
const timedOut = parsed?.timedOut;
|
|
166
|
-
const name = parsed?.agentName;
|
|
167
|
-
if (timedOut) {
|
|
168
|
-
return name ? `"${truncate(name)}" is still running` : "Still running";
|
|
169
|
-
}
|
|
170
|
-
switch (status) {
|
|
171
|
-
case PolledRunStatus.SUCCESS:
|
|
172
|
-
return name ? `"${truncate(name)}" finished` : "Finished";
|
|
173
|
-
case PolledRunStatus.FAILED:
|
|
174
|
-
return name ? `"${truncate(name)}" could not finish` : "Could not finish";
|
|
175
|
-
case PolledRunStatus.CANCELLED:
|
|
176
|
-
return name ? `"${truncate(name)}" was cancelled` : "Cancelled";
|
|
177
|
-
case PolledRunStatus.SKIPPED:
|
|
178
|
-
return name ? `"${truncate(name)}" was skipped` : "Skipped";
|
|
179
|
-
case PolledRunStatus.AWAITING_APPROVAL:
|
|
180
|
-
return name ? `"${truncate(name)}" needs approval` : "Needs approval";
|
|
181
|
-
case PolledRunStatus.IN_PROGRESS:
|
|
182
|
-
return name ? `"${truncate(name)}" is still running` : "Still running";
|
|
183
|
-
default:
|
|
184
|
-
return "Checked progress";
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
27
|
// ===================
|
|
189
28
|
// Linear Tools
|
|
190
29
|
// ===================
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./Entities.js";
|
|
|
7
7
|
export * from "./FrontendRoutesBuilder.js";
|
|
8
8
|
export * from "./Integrations.js";
|
|
9
9
|
export * from "./InvalidationKeys.js";
|
|
10
|
+
export * from "./JsonSchemaUtils.js";
|
|
10
11
|
export * from "./ModelEvents.js";
|
|
11
12
|
export * from "./Notifications.js";
|
|
12
13
|
export * from "./RunHistoryTypes.js";
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./Entities.js";
|
|
|
7
7
|
export * from "./FrontendRoutesBuilder.js";
|
|
8
8
|
export * from "./Integrations.js";
|
|
9
9
|
export * from "./InvalidationKeys.js";
|
|
10
|
+
export * from "./JsonSchemaUtils.js";
|
|
10
11
|
export * from "./ModelEvents.js";
|
|
11
12
|
export * from "./Notifications.js";
|
|
12
13
|
export * from "./RunHistoryTypes.js";
|