@perstack/core 0.0.54 → 0.0.55

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.
Files changed (121) hide show
  1. package/dist/src/index.d.ts +6363 -28
  2. package/dist/src/index.js +1982 -28
  3. package/dist/src/index.js.map +1 -1
  4. package/package.json +2 -2
  5. package/dist/src/adapters/event-creators.d.ts +0 -26
  6. package/dist/src/adapters/event-creators.d.ts.map +0 -1
  7. package/dist/src/adapters/event-creators.js +0 -126
  8. package/dist/src/adapters/event-creators.js.map +0 -1
  9. package/dist/src/adapters/index.d.ts +0 -2
  10. package/dist/src/adapters/index.d.ts.map +0 -1
  11. package/dist/src/adapters/index.js +0 -2
  12. package/dist/src/adapters/index.js.map +0 -1
  13. package/dist/src/constants/constants.d.ts +0 -11
  14. package/dist/src/constants/constants.d.ts.map +0 -1
  15. package/dist/src/constants/constants.js +0 -13
  16. package/dist/src/constants/constants.js.map +0 -1
  17. package/dist/src/errors.d.ts +0 -4
  18. package/dist/src/errors.d.ts.map +0 -1
  19. package/dist/src/errors.js +0 -7
  20. package/dist/src/errors.js.map +0 -1
  21. package/dist/src/index.d.ts.map +0 -1
  22. package/dist/src/known-models/index.d.ts +0 -9
  23. package/dist/src/known-models/index.d.ts.map +0 -1
  24. package/dist/src/known-models/index.js +0 -216
  25. package/dist/src/known-models/index.js.map +0 -1
  26. package/dist/src/schemas/activity.d.ts +0 -2159
  27. package/dist/src/schemas/activity.d.ts.map +0 -1
  28. package/dist/src/schemas/activity.js +0 -209
  29. package/dist/src/schemas/activity.js.map +0 -1
  30. package/dist/src/schemas/checkpoint.d.ts +0 -338
  31. package/dist/src/schemas/checkpoint.d.ts.map +0 -1
  32. package/dist/src/schemas/checkpoint.js +0 -69
  33. package/dist/src/schemas/checkpoint.js.map +0 -1
  34. package/dist/src/schemas/expert.d.ts +0 -309
  35. package/dist/src/schemas/expert.d.ts.map +0 -1
  36. package/dist/src/schemas/expert.js +0 -70
  37. package/dist/src/schemas/expert.js.map +0 -1
  38. package/dist/src/schemas/job.d.ts +0 -44
  39. package/dist/src/schemas/job.d.ts.map +0 -1
  40. package/dist/src/schemas/job.js +0 -22
  41. package/dist/src/schemas/job.js.map +0 -1
  42. package/dist/src/schemas/lockfile.d.ts +0 -143
  43. package/dist/src/schemas/lockfile.d.ts.map +0 -1
  44. package/dist/src/schemas/lockfile.js +0 -26
  45. package/dist/src/schemas/lockfile.js.map +0 -1
  46. package/dist/src/schemas/message-part.d.ts +0 -239
  47. package/dist/src/schemas/message-part.d.ts.map +0 -1
  48. package/dist/src/schemas/message-part.js +0 -80
  49. package/dist/src/schemas/message-part.js.map +0 -1
  50. package/dist/src/schemas/message.d.ts +0 -236
  51. package/dist/src/schemas/message.d.ts.map +0 -1
  52. package/dist/src/schemas/message.js +0 -44
  53. package/dist/src/schemas/message.js.map +0 -1
  54. package/dist/src/schemas/perstack-toml.d.ts +0 -366
  55. package/dist/src/schemas/perstack-toml.d.ts.map +0 -1
  56. package/dist/src/schemas/perstack-toml.js +0 -175
  57. package/dist/src/schemas/perstack-toml.js.map +0 -1
  58. package/dist/src/schemas/provider-config.d.ts +0 -216
  59. package/dist/src/schemas/provider-config.d.ts.map +0 -1
  60. package/dist/src/schemas/provider-config.js +0 -86
  61. package/dist/src/schemas/provider-config.js.map +0 -1
  62. package/dist/src/schemas/provider-tools.d.ts +0 -93
  63. package/dist/src/schemas/provider-tools.d.ts.map +0 -1
  64. package/dist/src/schemas/provider-tools.js +0 -60
  65. package/dist/src/schemas/provider-tools.js.map +0 -1
  66. package/dist/src/schemas/run-command.d.ts +0 -127
  67. package/dist/src/schemas/run-command.d.ts.map +0 -1
  68. package/dist/src/schemas/run-command.js +0 -82
  69. package/dist/src/schemas/run-command.js.map +0 -1
  70. package/dist/src/schemas/runtime-version.d.ts +0 -4
  71. package/dist/src/schemas/runtime-version.d.ts.map +0 -1
  72. package/dist/src/schemas/runtime-version.js +0 -6
  73. package/dist/src/schemas/runtime-version.js.map +0 -1
  74. package/dist/src/schemas/runtime.d.ts +0 -1317
  75. package/dist/src/schemas/runtime.d.ts.map +0 -1
  76. package/dist/src/schemas/runtime.js +0 -205
  77. package/dist/src/schemas/runtime.js.map +0 -1
  78. package/dist/src/schemas/skill-manager.d.ts +0 -64
  79. package/dist/src/schemas/skill-manager.d.ts.map +0 -1
  80. package/dist/src/schemas/skill-manager.js +0 -2
  81. package/dist/src/schemas/skill-manager.js.map +0 -1
  82. package/dist/src/schemas/skill.d.ts +0 -147
  83. package/dist/src/schemas/skill.d.ts.map +0 -1
  84. package/dist/src/schemas/skill.js +0 -99
  85. package/dist/src/schemas/skill.js.map +0 -1
  86. package/dist/src/schemas/step.d.ts +0 -370
  87. package/dist/src/schemas/step.d.ts.map +0 -1
  88. package/dist/src/schemas/step.js +0 -21
  89. package/dist/src/schemas/step.js.map +0 -1
  90. package/dist/src/schemas/tool-call.d.ts +0 -19
  91. package/dist/src/schemas/tool-call.d.ts.map +0 -1
  92. package/dist/src/schemas/tool-call.js +0 -10
  93. package/dist/src/schemas/tool-call.js.map +0 -1
  94. package/dist/src/schemas/tool-result.d.ts +0 -86
  95. package/dist/src/schemas/tool-result.d.ts.map +0 -1
  96. package/dist/src/schemas/tool-result.js +0 -11
  97. package/dist/src/schemas/tool-result.js.map +0 -1
  98. package/dist/src/schemas/usage.d.ts +0 -22
  99. package/dist/src/schemas/usage.d.ts.map +0 -1
  100. package/dist/src/schemas/usage.js +0 -10
  101. package/dist/src/schemas/usage.js.map +0 -1
  102. package/dist/src/utils/activity.d.ts +0 -20
  103. package/dist/src/utils/activity.d.ts.map +0 -1
  104. package/dist/src/utils/activity.js +0 -449
  105. package/dist/src/utils/activity.js.map +0 -1
  106. package/dist/src/utils/env-filter.d.ts +0 -4
  107. package/dist/src/utils/env-filter.d.ts.map +0 -1
  108. package/dist/src/utils/env-filter.js +0 -50
  109. package/dist/src/utils/env-filter.js.map +0 -1
  110. package/dist/src/utils/event-filter.d.ts +0 -16
  111. package/dist/src/utils/event-filter.d.ts.map +0 -1
  112. package/dist/src/utils/event-filter.js +0 -31
  113. package/dist/src/utils/event-filter.js.map +0 -1
  114. package/dist/src/utils/expert-type.d.ts +0 -38
  115. package/dist/src/utils/expert-type.d.ts.map +0 -1
  116. package/dist/src/utils/expert-type.js +0 -88
  117. package/dist/src/utils/expert-type.js.map +0 -1
  118. package/dist/src/utils/zod-error.d.ts +0 -4
  119. package/dist/src/utils/zod-error.d.ts.map +0 -1
  120. package/dist/src/utils/zod-error.js +0 -17
  121. package/dist/src/utils/zod-error.js.map +0 -1
@@ -1,1317 +0,0 @@
1
- import { z } from "zod";
2
- import type { Checkpoint } from "./checkpoint.js";
3
- import type { Expert } from "./expert.js";
4
- import type { ExpertMessage, InstructionMessage, Message, ToolMessage, UserMessage } from "./message.js";
5
- import type { PerstackConfigSkill, ReasoningBudget } from "./perstack-toml.js";
6
- import type { ProviderConfig } from "./provider-config.js";
7
- import type { Step } from "./step.js";
8
- import type { ToolCall } from "./tool-call.js";
9
- import type { ToolResult } from "./tool-result.js";
10
- import type { Usage } from "./usage.js";
11
- /** Parse an expert key into its components */
12
- export declare function parseExpertKey(expertKey: string): {
13
- key: string;
14
- name: string;
15
- version?: string;
16
- tag?: string;
17
- };
18
- /** Input for a run (text or interactive tool call result) */
19
- export interface RunInput {
20
- /** Text query */
21
- text?: string;
22
- /** Interactive tool call result (when continuing from interactive tool) */
23
- interactiveToolCallResult?: {
24
- toolCallId: string;
25
- toolName: string;
26
- skillName: string;
27
- text: string;
28
- };
29
- }
30
- /** Runtime settings for an Expert run */
31
- export interface RunSetting {
32
- /** Model name to use */
33
- model: string;
34
- /** Provider configuration */
35
- providerConfig: ProviderConfig;
36
- /** Job ID this run belongs to */
37
- jobId: string;
38
- /** Unique run identifier */
39
- runId: string;
40
- /** Expert key to run */
41
- expertKey: string;
42
- /** Input for the run */
43
- input: RunInput;
44
- /** Map of expert keys to Expert definitions */
45
- experts: Record<string, Expert>;
46
- /** Reasoning budget for native LLM reasoning (extended thinking). Defaults to "low". Use "none" or 0 to disable. */
47
- reasoningBudget: ReasoningBudget;
48
- /** Maximum retries on generation failure */
49
- maxRetries: number;
50
- /** Timeout per generation in milliseconds */
51
- timeout: number;
52
- /** Unix timestamp when run started */
53
- startedAt: number;
54
- /** Unix timestamp of last update */
55
- updatedAt: number;
56
- /** Perstack API base URL */
57
- perstackApiBaseUrl: string;
58
- /** Perstack API key */
59
- perstackApiKey?: string;
60
- /** Custom command for @perstack/base */
61
- perstackBaseSkillCommand?: string[];
62
- /** Environment variables to pass to skills */
63
- env: Record<string, string>;
64
- /** HTTP proxy URL for API requests */
65
- proxyUrl?: string;
66
- /** Enable verbose output for build processes */
67
- verbose?: boolean;
68
- }
69
- /** Parameters for starting a run */
70
- export interface RunParams {
71
- /** Run settings */
72
- setting: RunSetting;
73
- /** Optional checkpoint to resume from */
74
- checkpoint?: Checkpoint;
75
- }
76
- /** Expert input type before schema transformation (skills without name, optional fields) */
77
- type ExpertInput = {
78
- name: string;
79
- version: string;
80
- description?: string;
81
- instruction: string;
82
- skills?: Record<string, PerstackConfigSkill>;
83
- delegates?: string[];
84
- tags?: string[];
85
- };
86
- /** Input type for runParamsSchema (before defaults/transforms) */
87
- export type RunParamsInput = {
88
- setting: {
89
- model: string;
90
- providerConfig: ProviderConfig;
91
- jobId?: string;
92
- runId?: string;
93
- expertKey: string;
94
- input: RunInput;
95
- experts?: Record<string, ExpertInput>;
96
- reasoningBudget?: ReasoningBudget;
97
- maxRetries?: number;
98
- timeout?: number;
99
- startedAt?: number;
100
- updatedAt?: number;
101
- perstackApiBaseUrl?: string;
102
- perstackApiKey?: string;
103
- perstackBaseSkillCommand?: string[];
104
- env?: Record<string, string>;
105
- proxyUrl?: string;
106
- verbose?: boolean;
107
- };
108
- checkpoint?: Checkpoint;
109
- };
110
- export declare const runSettingSchema: z.ZodObject<{
111
- model: z.ZodString;
112
- providerConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
113
- providerName: z.ZodLiteral<"anthropic">;
114
- apiKey: z.ZodString;
115
- baseUrl: z.ZodOptional<z.ZodString>;
116
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
117
- }, z.core.$strip>, z.ZodObject<{
118
- providerName: z.ZodLiteral<"google">;
119
- apiKey: z.ZodString;
120
- baseUrl: z.ZodOptional<z.ZodString>;
121
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
122
- }, z.core.$strip>, z.ZodObject<{
123
- providerName: z.ZodLiteral<"openai">;
124
- apiKey: z.ZodString;
125
- baseUrl: z.ZodOptional<z.ZodString>;
126
- organization: z.ZodOptional<z.ZodString>;
127
- project: z.ZodOptional<z.ZodString>;
128
- name: z.ZodOptional<z.ZodString>;
129
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
130
- }, z.core.$strip>, z.ZodObject<{
131
- providerName: z.ZodLiteral<"ollama">;
132
- baseUrl: z.ZodOptional<z.ZodString>;
133
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
134
- }, z.core.$strip>, z.ZodObject<{
135
- providerName: z.ZodLiteral<"azure-openai">;
136
- apiKey: z.ZodString;
137
- resourceName: z.ZodOptional<z.ZodString>;
138
- apiVersion: z.ZodOptional<z.ZodString>;
139
- baseUrl: z.ZodOptional<z.ZodString>;
140
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
141
- useDeploymentBasedUrls: z.ZodOptional<z.ZodBoolean>;
142
- }, z.core.$strip>, z.ZodObject<{
143
- providerName: z.ZodLiteral<"amazon-bedrock">;
144
- accessKeyId: z.ZodString;
145
- secretAccessKey: z.ZodString;
146
- region: z.ZodString;
147
- sessionToken: z.ZodOptional<z.ZodString>;
148
- }, z.core.$strip>, z.ZodObject<{
149
- providerName: z.ZodLiteral<"google-vertex">;
150
- project: z.ZodOptional<z.ZodString>;
151
- location: z.ZodOptional<z.ZodString>;
152
- baseUrl: z.ZodOptional<z.ZodString>;
153
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
154
- }, z.core.$strip>, z.ZodObject<{
155
- providerName: z.ZodLiteral<"deepseek">;
156
- apiKey: z.ZodString;
157
- baseUrl: z.ZodOptional<z.ZodString>;
158
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
159
- }, z.core.$strip>], "providerName">;
160
- jobId: z.ZodString;
161
- runId: z.ZodString;
162
- expertKey: z.ZodString;
163
- input: z.ZodObject<{
164
- text: z.ZodOptional<z.ZodString>;
165
- interactiveToolCallResult: z.ZodOptional<z.ZodObject<{
166
- toolCallId: z.ZodString;
167
- toolName: z.ZodString;
168
- skillName: z.ZodString;
169
- text: z.ZodString;
170
- }, z.core.$strip>>;
171
- }, z.core.$strip>;
172
- experts: z.ZodRecord<z.ZodString, z.ZodObject<{
173
- key: z.ZodString;
174
- name: z.ZodString;
175
- version: z.ZodString;
176
- description: z.ZodOptional<z.ZodString>;
177
- instruction: z.ZodString;
178
- skills: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
179
- type: z.ZodLiteral<"mcpStdioSkill">;
180
- description: z.ZodOptional<z.ZodString>;
181
- args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
182
- rule: z.ZodOptional<z.ZodString>;
183
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
184
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
185
- command: z.ZodString;
186
- packageName: z.ZodOptional<z.ZodString>;
187
- requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
188
- }, z.core.$strip>, z.ZodObject<{
189
- type: z.ZodLiteral<"mcpSseSkill">;
190
- description: z.ZodOptional<z.ZodString>;
191
- rule: z.ZodOptional<z.ZodString>;
192
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
193
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
194
- endpoint: z.ZodString;
195
- }, z.core.$strip>, z.ZodObject<{
196
- type: z.ZodLiteral<"interactiveSkill">;
197
- description: z.ZodOptional<z.ZodString>;
198
- rule: z.ZodOptional<z.ZodString>;
199
- tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
200
- description: z.ZodOptional<z.ZodString>;
201
- inputJsonSchema: z.ZodString;
202
- }, z.core.$strip>>, z.ZodTransform<{
203
- [k: string]: {
204
- name: string;
205
- inputJsonSchema: string;
206
- description?: string | undefined;
207
- };
208
- }, Record<string, {
209
- inputJsonSchema: string;
210
- description?: string | undefined;
211
- }>>>;
212
- }, z.core.$strip>], "type">>>>, z.ZodTransform<{
213
- [k: string]: {
214
- type: "mcpStdioSkill";
215
- name: string;
216
- pick: string[];
217
- omit: string[];
218
- command: string;
219
- args: string[];
220
- requiredEnv: string[];
221
- description?: string | undefined;
222
- rule?: string | undefined;
223
- packageName?: string | undefined;
224
- } | {
225
- type: "mcpSseSkill";
226
- name: string;
227
- pick: string[];
228
- omit: string[];
229
- endpoint: string;
230
- description?: string | undefined;
231
- rule?: string | undefined;
232
- } | {
233
- type: "interactiveSkill";
234
- name: string;
235
- tools: {
236
- [k: string]: {
237
- name: string;
238
- inputJsonSchema: string;
239
- description?: string | undefined;
240
- };
241
- };
242
- description?: string | undefined;
243
- rule?: string | undefined;
244
- };
245
- }, Record<string, {
246
- type: "mcpStdioSkill";
247
- args: string[];
248
- pick: string[];
249
- omit: string[];
250
- command: string;
251
- requiredEnv: string[];
252
- description?: string | undefined;
253
- rule?: string | undefined;
254
- packageName?: string | undefined;
255
- } | {
256
- type: "mcpSseSkill";
257
- pick: string[];
258
- omit: string[];
259
- endpoint: string;
260
- description?: string | undefined;
261
- rule?: string | undefined;
262
- } | {
263
- type: "interactiveSkill";
264
- tools: {
265
- [k: string]: {
266
- name: string;
267
- inputJsonSchema: string;
268
- description?: string | undefined;
269
- };
270
- };
271
- description?: string | undefined;
272
- rule?: string | undefined;
273
- }>>>;
274
- delegates: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
275
- tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
276
- minRuntimeVersion: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<`v${number}.${number}`, string>>>;
277
- providerTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
278
- providerSkills: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
279
- type: z.ZodLiteral<"builtin">;
280
- skillId: z.ZodEnum<{
281
- pdf: "pdf";
282
- docx: "docx";
283
- pptx: "pptx";
284
- xlsx: "xlsx";
285
- }>;
286
- }, z.core.$strip>, z.ZodObject<{
287
- type: z.ZodLiteral<"custom">;
288
- name: z.ZodString;
289
- definition: z.ZodString;
290
- }, z.core.$strip>], "type">>>;
291
- providerToolOptions: z.ZodOptional<z.ZodObject<{
292
- webSearch: z.ZodOptional<z.ZodObject<{
293
- maxUses: z.ZodOptional<z.ZodNumber>;
294
- allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString>>;
295
- }, z.core.$strip>>;
296
- webFetch: z.ZodOptional<z.ZodObject<{
297
- maxUses: z.ZodOptional<z.ZodNumber>;
298
- }, z.core.$strip>>;
299
- fileSearch: z.ZodOptional<z.ZodObject<{
300
- vectorStoreIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
301
- maxNumResults: z.ZodOptional<z.ZodNumber>;
302
- }, z.core.$strip>>;
303
- }, z.core.$strip>>;
304
- }, z.core.$strip>>;
305
- reasoningBudget: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
306
- none: "none";
307
- minimal: "minimal";
308
- low: "low";
309
- medium: "medium";
310
- high: "high";
311
- }>, z.ZodNumber]>>;
312
- maxRetries: z.ZodNumber;
313
- timeout: z.ZodNumber;
314
- startedAt: z.ZodNumber;
315
- updatedAt: z.ZodNumber;
316
- perstackApiBaseUrl: z.ZodString;
317
- perstackApiKey: z.ZodOptional<z.ZodString>;
318
- perstackBaseSkillCommand: z.ZodOptional<z.ZodArray<z.ZodString>>;
319
- env: z.ZodRecord<z.ZodString, z.ZodString>;
320
- proxyUrl: z.ZodOptional<z.ZodString>;
321
- verbose: z.ZodOptional<z.ZodBoolean>;
322
- }, z.core.$strip>;
323
- export declare const runParamsSchema: z.ZodObject<{
324
- setting: z.ZodObject<{
325
- model: z.ZodString;
326
- providerConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
327
- providerName: z.ZodLiteral<"anthropic">;
328
- apiKey: z.ZodString;
329
- baseUrl: z.ZodOptional<z.ZodString>;
330
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
331
- }, z.core.$strip>, z.ZodObject<{
332
- providerName: z.ZodLiteral<"google">;
333
- apiKey: z.ZodString;
334
- baseUrl: z.ZodOptional<z.ZodString>;
335
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
336
- }, z.core.$strip>, z.ZodObject<{
337
- providerName: z.ZodLiteral<"openai">;
338
- apiKey: z.ZodString;
339
- baseUrl: z.ZodOptional<z.ZodString>;
340
- organization: z.ZodOptional<z.ZodString>;
341
- project: z.ZodOptional<z.ZodString>;
342
- name: z.ZodOptional<z.ZodString>;
343
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
344
- }, z.core.$strip>, z.ZodObject<{
345
- providerName: z.ZodLiteral<"ollama">;
346
- baseUrl: z.ZodOptional<z.ZodString>;
347
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
348
- }, z.core.$strip>, z.ZodObject<{
349
- providerName: z.ZodLiteral<"azure-openai">;
350
- apiKey: z.ZodString;
351
- resourceName: z.ZodOptional<z.ZodString>;
352
- apiVersion: z.ZodOptional<z.ZodString>;
353
- baseUrl: z.ZodOptional<z.ZodString>;
354
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
355
- useDeploymentBasedUrls: z.ZodOptional<z.ZodBoolean>;
356
- }, z.core.$strip>, z.ZodObject<{
357
- providerName: z.ZodLiteral<"amazon-bedrock">;
358
- accessKeyId: z.ZodString;
359
- secretAccessKey: z.ZodString;
360
- region: z.ZodString;
361
- sessionToken: z.ZodOptional<z.ZodString>;
362
- }, z.core.$strip>, z.ZodObject<{
363
- providerName: z.ZodLiteral<"google-vertex">;
364
- project: z.ZodOptional<z.ZodString>;
365
- location: z.ZodOptional<z.ZodString>;
366
- baseUrl: z.ZodOptional<z.ZodString>;
367
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
368
- }, z.core.$strip>, z.ZodObject<{
369
- providerName: z.ZodLiteral<"deepseek">;
370
- apiKey: z.ZodString;
371
- baseUrl: z.ZodOptional<z.ZodString>;
372
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
373
- }, z.core.$strip>], "providerName">;
374
- jobId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
375
- runId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
376
- expertKey: z.ZodString;
377
- input: z.ZodObject<{
378
- text: z.ZodOptional<z.ZodString>;
379
- interactiveToolCallResult: z.ZodOptional<z.ZodObject<{
380
- toolCallId: z.ZodString;
381
- toolName: z.ZodString;
382
- skillName: z.ZodString;
383
- text: z.ZodString;
384
- }, z.core.$strip>>;
385
- }, z.core.$strip>;
386
- experts: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
387
- description: z.ZodOptional<z.ZodString>;
388
- name: z.ZodString;
389
- version: z.ZodString;
390
- providerToolOptions: z.ZodOptional<z.ZodObject<{
391
- webSearch: z.ZodOptional<z.ZodObject<{
392
- maxUses: z.ZodOptional<z.ZodNumber>;
393
- allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString>>;
394
- }, z.core.$strip>>;
395
- webFetch: z.ZodOptional<z.ZodObject<{
396
- maxUses: z.ZodOptional<z.ZodNumber>;
397
- }, z.core.$strip>>;
398
- fileSearch: z.ZodOptional<z.ZodObject<{
399
- vectorStoreIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
400
- maxNumResults: z.ZodOptional<z.ZodNumber>;
401
- }, z.core.$strip>>;
402
- }, z.core.$strip>>;
403
- instruction: z.ZodString;
404
- skills: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
405
- type: z.ZodLiteral<"mcpStdioSkill">;
406
- description: z.ZodOptional<z.ZodString>;
407
- args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
408
- rule: z.ZodOptional<z.ZodString>;
409
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
410
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
411
- command: z.ZodString;
412
- packageName: z.ZodOptional<z.ZodString>;
413
- requiredEnv: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
414
- }, z.core.$strip>, z.ZodObject<{
415
- type: z.ZodLiteral<"mcpSseSkill">;
416
- description: z.ZodOptional<z.ZodString>;
417
- rule: z.ZodOptional<z.ZodString>;
418
- pick: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
419
- omit: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
420
- endpoint: z.ZodString;
421
- }, z.core.$strip>, z.ZodObject<{
422
- type: z.ZodLiteral<"interactiveSkill">;
423
- description: z.ZodOptional<z.ZodString>;
424
- rule: z.ZodOptional<z.ZodString>;
425
- tools: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodObject<{
426
- description: z.ZodOptional<z.ZodString>;
427
- inputJsonSchema: z.ZodString;
428
- }, z.core.$strip>>, z.ZodTransform<{
429
- [k: string]: {
430
- name: string;
431
- inputJsonSchema: string;
432
- description?: string | undefined;
433
- };
434
- }, Record<string, {
435
- inputJsonSchema: string;
436
- description?: string | undefined;
437
- }>>>;
438
- }, z.core.$strip>], "type">>>>, z.ZodTransform<{
439
- [k: string]: {
440
- type: "mcpStdioSkill";
441
- name: string;
442
- pick: string[];
443
- omit: string[];
444
- command: string;
445
- args: string[];
446
- requiredEnv: string[];
447
- description?: string | undefined;
448
- rule?: string | undefined;
449
- packageName?: string | undefined;
450
- } | {
451
- type: "mcpSseSkill";
452
- name: string;
453
- pick: string[];
454
- omit: string[];
455
- endpoint: string;
456
- description?: string | undefined;
457
- rule?: string | undefined;
458
- } | {
459
- type: "interactiveSkill";
460
- name: string;
461
- tools: {
462
- [k: string]: {
463
- name: string;
464
- inputJsonSchema: string;
465
- description?: string | undefined;
466
- };
467
- };
468
- description?: string | undefined;
469
- rule?: string | undefined;
470
- };
471
- }, Record<string, {
472
- type: "mcpStdioSkill";
473
- args: string[];
474
- pick: string[];
475
- omit: string[];
476
- command: string;
477
- requiredEnv: string[];
478
- description?: string | undefined;
479
- rule?: string | undefined;
480
- packageName?: string | undefined;
481
- } | {
482
- type: "mcpSseSkill";
483
- pick: string[];
484
- omit: string[];
485
- endpoint: string;
486
- description?: string | undefined;
487
- rule?: string | undefined;
488
- } | {
489
- type: "interactiveSkill";
490
- tools: {
491
- [k: string]: {
492
- name: string;
493
- inputJsonSchema: string;
494
- description?: string | undefined;
495
- };
496
- };
497
- description?: string | undefined;
498
- rule?: string | undefined;
499
- }>>>;
500
- delegates: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
501
- tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
502
- minRuntimeVersion: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodTransform<`v${number}.${number}`, string>>>;
503
- providerTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
504
- providerSkills: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
505
- type: z.ZodLiteral<"builtin">;
506
- skillId: z.ZodEnum<{
507
- pdf: "pdf";
508
- docx: "docx";
509
- pptx: "pptx";
510
- xlsx: "xlsx";
511
- }>;
512
- }, z.core.$strip>, z.ZodObject<{
513
- type: z.ZodLiteral<"custom">;
514
- name: z.ZodString;
515
- definition: z.ZodString;
516
- }, z.core.$strip>], "type">>>;
517
- }, z.core.$strip>>>>, z.ZodTransform<{
518
- [k: string]: {
519
- key: string;
520
- name: string;
521
- version: string;
522
- instruction: string;
523
- skills: {
524
- [k: string]: {
525
- type: "mcpStdioSkill";
526
- name: string;
527
- pick: string[];
528
- omit: string[];
529
- command: string;
530
- args: string[];
531
- requiredEnv: string[];
532
- description?: string | undefined;
533
- rule?: string | undefined;
534
- packageName?: string | undefined;
535
- } | {
536
- type: "mcpSseSkill";
537
- name: string;
538
- pick: string[];
539
- omit: string[];
540
- endpoint: string;
541
- description?: string | undefined;
542
- rule?: string | undefined;
543
- } | {
544
- type: "interactiveSkill";
545
- name: string;
546
- tools: {
547
- [k: string]: {
548
- name: string;
549
- inputJsonSchema: string;
550
- description?: string | undefined;
551
- };
552
- };
553
- description?: string | undefined;
554
- rule?: string | undefined;
555
- };
556
- };
557
- delegates: string[];
558
- tags: string[];
559
- minRuntimeVersion: `v${number}.${number}`;
560
- description?: string | undefined;
561
- providerTools?: string[] | undefined;
562
- providerSkills?: ({
563
- type: "builtin";
564
- skillId: "pdf" | "docx" | "pptx" | "xlsx";
565
- } | {
566
- type: "custom";
567
- name: string;
568
- definition: string;
569
- })[] | undefined;
570
- providerToolOptions?: {
571
- webSearch?: {
572
- maxUses?: number | undefined;
573
- allowedDomains?: string[] | undefined;
574
- } | undefined;
575
- webFetch?: {
576
- maxUses?: number | undefined;
577
- } | undefined;
578
- fileSearch?: {
579
- vectorStoreIds?: string[] | undefined;
580
- maxNumResults?: number | undefined;
581
- } | undefined;
582
- } | undefined;
583
- };
584
- }, Record<string, {
585
- name: string;
586
- version: string;
587
- instruction: string;
588
- skills: {
589
- [k: string]: {
590
- type: "mcpStdioSkill";
591
- name: string;
592
- pick: string[];
593
- omit: string[];
594
- command: string;
595
- args: string[];
596
- requiredEnv: string[];
597
- description?: string | undefined;
598
- rule?: string | undefined;
599
- packageName?: string | undefined;
600
- } | {
601
- type: "mcpSseSkill";
602
- name: string;
603
- pick: string[];
604
- omit: string[];
605
- endpoint: string;
606
- description?: string | undefined;
607
- rule?: string | undefined;
608
- } | {
609
- type: "interactiveSkill";
610
- name: string;
611
- tools: {
612
- [k: string]: {
613
- name: string;
614
- inputJsonSchema: string;
615
- description?: string | undefined;
616
- };
617
- };
618
- description?: string | undefined;
619
- rule?: string | undefined;
620
- };
621
- };
622
- delegates: string[];
623
- tags: string[];
624
- minRuntimeVersion: `v${number}.${number}`;
625
- description?: string | undefined;
626
- providerToolOptions?: {
627
- webSearch?: {
628
- maxUses?: number | undefined;
629
- allowedDomains?: string[] | undefined;
630
- } | undefined;
631
- webFetch?: {
632
- maxUses?: number | undefined;
633
- } | undefined;
634
- fileSearch?: {
635
- vectorStoreIds?: string[] | undefined;
636
- maxNumResults?: number | undefined;
637
- } | undefined;
638
- } | undefined;
639
- providerTools?: string[] | undefined;
640
- providerSkills?: ({
641
- type: "builtin";
642
- skillId: "pdf" | "docx" | "pptx" | "xlsx";
643
- } | {
644
- type: "custom";
645
- name: string;
646
- definition: string;
647
- })[] | undefined;
648
- }>>>;
649
- reasoningBudget: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
650
- none: "none";
651
- minimal: "minimal";
652
- low: "low";
653
- medium: "medium";
654
- high: "high";
655
- }>, z.ZodNumber]>>>;
656
- maxRetries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
657
- timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
658
- startedAt: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
659
- updatedAt: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
660
- perstackApiBaseUrl: z.ZodDefault<z.ZodOptional<z.ZodURL>>;
661
- perstackApiKey: z.ZodOptional<z.ZodString>;
662
- perstackBaseSkillCommand: z.ZodOptional<z.ZodArray<z.ZodString>>;
663
- env: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
664
- proxyUrl: z.ZodOptional<z.ZodString>;
665
- verbose: z.ZodOptional<z.ZodBoolean>;
666
- }, z.core.$strip>;
667
- checkpoint: z.ZodOptional<z.ZodObject<{
668
- id: z.ZodString;
669
- jobId: z.ZodString;
670
- runId: z.ZodString;
671
- status: z.ZodEnum<{
672
- init: "init";
673
- proceeding: "proceeding";
674
- completed: "completed";
675
- stoppedByInteractiveTool: "stoppedByInteractiveTool";
676
- stoppedByDelegate: "stoppedByDelegate";
677
- stoppedByError: "stoppedByError";
678
- stoppedByCancellation: "stoppedByCancellation";
679
- }>;
680
- stepNumber: z.ZodNumber;
681
- messages: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
682
- id: z.ZodString;
683
- type: z.ZodLiteral<"instructionMessage">;
684
- contents: z.ZodArray<z.ZodObject<{
685
- id: z.ZodString;
686
- type: z.ZodLiteral<"textPart">;
687
- text: z.ZodString;
688
- }, z.core.$strip>>;
689
- cache: z.ZodOptional<z.ZodBoolean>;
690
- }, z.core.$strip>, z.ZodObject<{
691
- id: z.ZodString;
692
- type: z.ZodLiteral<"userMessage">;
693
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
694
- id: z.ZodString;
695
- type: z.ZodLiteral<"textPart">;
696
- text: z.ZodString;
697
- }, z.core.$strip>, z.ZodObject<{
698
- id: z.ZodString;
699
- type: z.ZodLiteral<"imageUrlPart">;
700
- url: z.ZodURL;
701
- mimeType: z.ZodString;
702
- }, z.core.$strip>, z.ZodObject<{
703
- id: z.ZodString;
704
- type: z.ZodLiteral<"imageInlinePart">;
705
- encodedData: z.ZodString;
706
- mimeType: z.ZodString;
707
- }, z.core.$strip>, z.ZodObject<{
708
- id: z.ZodString;
709
- type: z.ZodLiteral<"imageBinaryPart">;
710
- data: z.ZodString;
711
- mimeType: z.ZodString;
712
- }, z.core.$strip>, z.ZodObject<{
713
- id: z.ZodString;
714
- type: z.ZodLiteral<"fileUrlPart">;
715
- url: z.ZodString;
716
- mimeType: z.ZodString;
717
- }, z.core.$strip>, z.ZodObject<{
718
- id: z.ZodString;
719
- type: z.ZodLiteral<"fileInlinePart">;
720
- encodedData: z.ZodString;
721
- mimeType: z.ZodString;
722
- }, z.core.$strip>, z.ZodObject<{
723
- id: z.ZodString;
724
- type: z.ZodLiteral<"fileBinaryPart">;
725
- data: z.ZodString;
726
- mimeType: z.ZodString;
727
- }, z.core.$strip>]>>;
728
- cache: z.ZodOptional<z.ZodBoolean>;
729
- }, z.core.$strip>, z.ZodObject<{
730
- id: z.ZodString;
731
- type: z.ZodLiteral<"expertMessage">;
732
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
733
- id: z.ZodString;
734
- type: z.ZodLiteral<"textPart">;
735
- text: z.ZodString;
736
- }, z.core.$strip>, z.ZodObject<{
737
- id: z.ZodString;
738
- type: z.ZodLiteral<"toolCallPart">;
739
- toolCallId: z.ZodString;
740
- toolName: z.ZodString;
741
- args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
742
- }, z.core.$strip>, z.ZodObject<{
743
- id: z.ZodString;
744
- type: z.ZodLiteral<"thinkingPart">;
745
- thinking: z.ZodString;
746
- signature: z.ZodOptional<z.ZodString>;
747
- }, z.core.$strip>]>>;
748
- cache: z.ZodOptional<z.ZodBoolean>;
749
- }, z.core.$strip>, z.ZodObject<{
750
- id: z.ZodString;
751
- type: z.ZodLiteral<"toolMessage">;
752
- contents: z.ZodArray<z.ZodObject<{
753
- id: z.ZodString;
754
- type: z.ZodLiteral<"toolResultPart">;
755
- toolCallId: z.ZodString;
756
- toolName: z.ZodString;
757
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
758
- id: z.ZodString;
759
- type: z.ZodLiteral<"textPart">;
760
- text: z.ZodString;
761
- }, z.core.$strip>, z.ZodObject<{
762
- id: z.ZodString;
763
- type: z.ZodLiteral<"imageInlinePart">;
764
- encodedData: z.ZodString;
765
- mimeType: z.ZodString;
766
- }, z.core.$strip>, z.ZodObject<{
767
- id: z.ZodString;
768
- type: z.ZodLiteral<"fileInlinePart">;
769
- encodedData: z.ZodString;
770
- mimeType: z.ZodString;
771
- }, z.core.$strip>]>>;
772
- isError: z.ZodOptional<z.ZodBoolean>;
773
- }, z.core.$strip>>;
774
- cache: z.ZodOptional<z.ZodBoolean>;
775
- }, z.core.$strip>]>>;
776
- expert: z.ZodObject<{
777
- key: z.ZodString;
778
- name: z.ZodString;
779
- version: z.ZodString;
780
- }, z.core.$strip>;
781
- delegateTo: z.ZodOptional<z.ZodArray<z.ZodObject<{
782
- expert: z.ZodObject<{
783
- key: z.ZodString;
784
- name: z.ZodString;
785
- version: z.ZodString;
786
- }, z.core.$strip>;
787
- toolCallId: z.ZodString;
788
- toolName: z.ZodString;
789
- query: z.ZodString;
790
- }, z.core.$strip>>>;
791
- delegatedBy: z.ZodOptional<z.ZodObject<{
792
- expert: z.ZodObject<{
793
- key: z.ZodString;
794
- name: z.ZodString;
795
- version: z.ZodString;
796
- }, z.core.$strip>;
797
- toolCallId: z.ZodString;
798
- toolName: z.ZodString;
799
- checkpointId: z.ZodString;
800
- runId: z.ZodString;
801
- }, z.core.$strip>>;
802
- usage: z.ZodObject<{
803
- inputTokens: z.ZodNumber;
804
- outputTokens: z.ZodNumber;
805
- reasoningTokens: z.ZodNumber;
806
- totalTokens: z.ZodNumber;
807
- cachedInputTokens: z.ZodNumber;
808
- }, z.core.$strip>;
809
- contextWindow: z.ZodOptional<z.ZodNumber>;
810
- contextWindowUsage: z.ZodOptional<z.ZodNumber>;
811
- pendingToolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
812
- id: z.ZodString;
813
- skillName: z.ZodString;
814
- toolName: z.ZodString;
815
- args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
816
- }, z.core.$strip>>>;
817
- partialToolResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
818
- id: z.ZodString;
819
- skillName: z.ZodString;
820
- toolName: z.ZodString;
821
- result: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
822
- id: z.ZodString;
823
- type: z.ZodLiteral<"textPart">;
824
- text: z.ZodString;
825
- }, z.core.$strip>, z.ZodObject<{
826
- id: z.ZodString;
827
- type: z.ZodLiteral<"imageUrlPart">;
828
- url: z.ZodURL;
829
- mimeType: z.ZodString;
830
- }, z.core.$strip>, z.ZodObject<{
831
- id: z.ZodString;
832
- type: z.ZodLiteral<"imageInlinePart">;
833
- encodedData: z.ZodString;
834
- mimeType: z.ZodString;
835
- }, z.core.$strip>, z.ZodObject<{
836
- id: z.ZodString;
837
- type: z.ZodLiteral<"imageBinaryPart">;
838
- data: z.ZodString;
839
- mimeType: z.ZodString;
840
- }, z.core.$strip>, z.ZodObject<{
841
- id: z.ZodString;
842
- type: z.ZodLiteral<"fileUrlPart">;
843
- url: z.ZodString;
844
- mimeType: z.ZodString;
845
- }, z.core.$strip>, z.ZodObject<{
846
- id: z.ZodString;
847
- type: z.ZodLiteral<"fileInlinePart">;
848
- encodedData: z.ZodString;
849
- mimeType: z.ZodString;
850
- }, z.core.$strip>, z.ZodObject<{
851
- id: z.ZodString;
852
- type: z.ZodLiteral<"fileBinaryPart">;
853
- data: z.ZodString;
854
- mimeType: z.ZodString;
855
- }, z.core.$strip>, z.ZodObject<{
856
- id: z.ZodString;
857
- type: z.ZodLiteral<"toolCallPart">;
858
- toolCallId: z.ZodString;
859
- toolName: z.ZodString;
860
- args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
861
- }, z.core.$strip>, z.ZodObject<{
862
- id: z.ZodString;
863
- type: z.ZodLiteral<"toolResultPart">;
864
- toolCallId: z.ZodString;
865
- toolName: z.ZodString;
866
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
867
- id: z.ZodString;
868
- type: z.ZodLiteral<"textPart">;
869
- text: z.ZodString;
870
- }, z.core.$strip>, z.ZodObject<{
871
- id: z.ZodString;
872
- type: z.ZodLiteral<"imageInlinePart">;
873
- encodedData: z.ZodString;
874
- mimeType: z.ZodString;
875
- }, z.core.$strip>, z.ZodObject<{
876
- id: z.ZodString;
877
- type: z.ZodLiteral<"fileInlinePart">;
878
- encodedData: z.ZodString;
879
- mimeType: z.ZodString;
880
- }, z.core.$strip>]>>;
881
- isError: z.ZodOptional<z.ZodBoolean>;
882
- }, z.core.$strip>, z.ZodObject<{
883
- id: z.ZodString;
884
- type: z.ZodLiteral<"thinkingPart">;
885
- thinking: z.ZodString;
886
- signature: z.ZodOptional<z.ZodString>;
887
- }, z.core.$strip>], "type">>;
888
- }, z.core.$strip>>>;
889
- metadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
890
- error: z.ZodOptional<z.ZodObject<{
891
- name: z.ZodString;
892
- message: z.ZodString;
893
- statusCode: z.ZodOptional<z.ZodNumber>;
894
- isRetryable: z.ZodBoolean;
895
- }, z.core.$strip>>;
896
- retryCount: z.ZodOptional<z.ZodNumber>;
897
- }, z.core.$strip>>;
898
- }, z.core.$strip>;
899
- /**
900
- * Expert state events - state machine transitions during execution.
901
- * All events contain deeply serializable properties for checkpoint persistence.
902
- */
903
- type ExpertStatePayloads = {
904
- startRun: {
905
- initialCheckpoint: Checkpoint;
906
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
907
- };
908
- /** Resume from stoppedByDelegate or stoppedByInteractiveTool */
909
- resumeFromStop: {
910
- checkpoint: Checkpoint;
911
- };
912
- /** Proceed to CallingInteractiveTools from ResumingFromStop */
913
- proceedToInteractiveTools: {
914
- pendingToolCalls: ToolCall[];
915
- partialToolResults: ToolResult[];
916
- };
917
- startGeneration: {
918
- messages: Message[];
919
- };
920
- retry: {
921
- reason: string;
922
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
923
- toolCalls?: ToolCall[];
924
- toolResults?: ToolResult[];
925
- usage: Usage;
926
- };
927
- callTools: {
928
- newMessage: ExpertMessage;
929
- toolCalls: ToolCall[];
930
- usage: Usage;
931
- };
932
- /** Internal: MCP tools finished, proceed to delegates */
933
- finishMcpTools: {
934
- partialToolResults: ToolResult[];
935
- pendingToolCalls: ToolCall[];
936
- };
937
- /** Internal: No delegates, proceed to interactive tools */
938
- skipDelegates: object;
939
- resolveToolResults: {
940
- toolResults: ToolResult[];
941
- };
942
- finishToolCall: {
943
- newMessages: (UserMessage | ToolMessage)[];
944
- };
945
- resumeToolCalls: {
946
- pendingToolCalls: ToolCall[];
947
- partialToolResults: ToolResult[];
948
- };
949
- continueToNextStep: {
950
- checkpoint: Checkpoint;
951
- step: Step;
952
- nextCheckpoint: Checkpoint;
953
- };
954
- stopRunByInteractiveTool: {
955
- checkpoint: Checkpoint;
956
- step: Step;
957
- };
958
- stopRunByDelegate: {
959
- checkpoint: Checkpoint;
960
- step: Step;
961
- };
962
- stopRunByError: {
963
- checkpoint: Checkpoint;
964
- step: Step;
965
- error: {
966
- name: string;
967
- message: string;
968
- statusCode?: number;
969
- isRetryable: boolean;
970
- };
971
- };
972
- completeRun: {
973
- checkpoint: Checkpoint;
974
- step: Step;
975
- text: string;
976
- usage: Usage;
977
- };
978
- };
979
- /**
980
- * Streaming events - reasoning/result streaming during LLM generation.
981
- * Moved from RuntimeEvent to RunEvent to support proper attribution in parallel runs.
982
- */
983
- type StreamingPayloads = {
984
- /** Start of reasoning stream (display hint) */
985
- startStreamingReasoning: object;
986
- /** Streaming reasoning delta */
987
- streamReasoning: {
988
- delta: string;
989
- };
990
- /** Reasoning stream completion (extended thinking / test-time scaling) */
991
- completeStreamingReasoning: {
992
- text: string;
993
- };
994
- /** Start of run result stream (display hint) */
995
- startStreamingRunResult: object;
996
- /** Streaming run result delta */
997
- streamRunResult: {
998
- delta: string;
999
- };
1000
- /** Run result stream completion */
1001
- completeStreamingRunResult: {
1002
- text: string;
1003
- };
1004
- };
1005
- /** Base properties for all run events (both state and streaming) */
1006
- export interface BaseEvent {
1007
- /** Unique event ID */
1008
- id: string;
1009
- /** Expert key that emitted this event */
1010
- expertKey: string;
1011
- /** Unix timestamp when event was emitted */
1012
- timestamp: number;
1013
- /** Job ID this event belongs to */
1014
- jobId: string;
1015
- /** Run ID this event belongs to */
1016
- runId: string;
1017
- /** Step number when event was emitted */
1018
- stepNumber: number;
1019
- }
1020
- /** Expert state event types (state machine transitions) */
1021
- export type ExpertStateEventType = keyof ExpertStatePayloads;
1022
- /** Streaming event types */
1023
- export type StreamingEventType = keyof StreamingPayloads;
1024
- /** All run event types (state + streaming) */
1025
- export type EventType = ExpertStateEventType | StreamingEventType;
1026
- /** Union type of expert state events */
1027
- export type ExpertStateEvent = {
1028
- [K in ExpertStateEventType]: BaseEvent & {
1029
- type: K;
1030
- } & ExpertStatePayloads[K];
1031
- }[ExpertStateEventType];
1032
- /** Union type of streaming events */
1033
- export type StreamingEvent = {
1034
- [K in StreamingEventType]: BaseEvent & {
1035
- type: K;
1036
- } & StreamingPayloads[K];
1037
- }[StreamingEventType];
1038
- /** Union type of all run events (state machine + streaming) */
1039
- export type RunEvent = ExpertStateEvent | StreamingEvent;
1040
- /** Extract a specific event type */
1041
- export type EventForType<T extends EventType> = Extract<RunEvent, {
1042
- type: T;
1043
- }>;
1044
- /** Factory function to create expert state events */
1045
- export declare function createEvent<T extends ExpertStateEventType>(type: T): (setting: RunSetting, checkpoint: Checkpoint, data: Omit<Extract<ExpertStateEvent, {
1046
- type: T;
1047
- }>, "type" | "id" | "expertKey" | "timestamp" | "jobId" | "runId" | "stepNumber">) => Extract<ExpertStateEvent, {
1048
- type: T;
1049
- }>;
1050
- /** Factory function to create streaming events */
1051
- export declare function createStreamingEvent<T extends StreamingEventType>(type: T, setting: RunSetting, checkpoint: Checkpoint, data: Omit<Extract<StreamingEvent, {
1052
- type: T;
1053
- }>, "type" | "id" | "expertKey" | "timestamp" | "jobId" | "runId" | "stepNumber">): Extract<StreamingEvent, {
1054
- type: T;
1055
- }>;
1056
- export declare const startRun: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1057
- type: "startRun";
1058
- } & {
1059
- initialCheckpoint: Checkpoint;
1060
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1061
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1062
- type: "startRun";
1063
- } & {
1064
- initialCheckpoint: Checkpoint;
1065
- inputMessages: (InstructionMessage | UserMessage | ToolMessage)[];
1066
- };
1067
- export declare const resumeFromStop: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1068
- type: "resumeFromStop";
1069
- } & {
1070
- checkpoint: Checkpoint;
1071
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1072
- type: "resumeFromStop";
1073
- } & {
1074
- checkpoint: Checkpoint;
1075
- };
1076
- export declare const proceedToInteractiveTools: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1077
- type: "proceedToInteractiveTools";
1078
- } & {
1079
- pendingToolCalls: ToolCall[];
1080
- partialToolResults: ToolResult[];
1081
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1082
- type: "proceedToInteractiveTools";
1083
- } & {
1084
- pendingToolCalls: ToolCall[];
1085
- partialToolResults: ToolResult[];
1086
- };
1087
- export declare const startGeneration: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1088
- type: "startGeneration";
1089
- } & {
1090
- messages: Message[];
1091
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1092
- type: "startGeneration";
1093
- } & {
1094
- messages: Message[];
1095
- };
1096
- export declare const retry: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1097
- type: "retry";
1098
- } & {
1099
- reason: string;
1100
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
1101
- toolCalls?: ToolCall[];
1102
- toolResults?: ToolResult[];
1103
- usage: Usage;
1104
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1105
- type: "retry";
1106
- } & {
1107
- reason: string;
1108
- newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
1109
- toolCalls?: ToolCall[];
1110
- toolResults?: ToolResult[];
1111
- usage: Usage;
1112
- };
1113
- export declare const callTools: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1114
- type: "callTools";
1115
- } & {
1116
- newMessage: ExpertMessage;
1117
- toolCalls: ToolCall[];
1118
- usage: Usage;
1119
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1120
- type: "callTools";
1121
- } & {
1122
- newMessage: ExpertMessage;
1123
- toolCalls: ToolCall[];
1124
- usage: Usage;
1125
- };
1126
- export declare const finishMcpTools: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1127
- type: "finishMcpTools";
1128
- } & {
1129
- partialToolResults: ToolResult[];
1130
- pendingToolCalls: ToolCall[];
1131
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1132
- type: "finishMcpTools";
1133
- } & {
1134
- partialToolResults: ToolResult[];
1135
- pendingToolCalls: ToolCall[];
1136
- };
1137
- export declare const skipDelegates: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1138
- type: "skipDelegates";
1139
- } & object, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1140
- type: "skipDelegates";
1141
- } & object;
1142
- export declare const resolveToolResults: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1143
- type: "resolveToolResults";
1144
- } & {
1145
- toolResults: ToolResult[];
1146
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1147
- type: "resolveToolResults";
1148
- } & {
1149
- toolResults: ToolResult[];
1150
- };
1151
- export declare const finishToolCall: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1152
- type: "finishToolCall";
1153
- } & {
1154
- newMessages: (UserMessage | ToolMessage)[];
1155
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1156
- type: "finishToolCall";
1157
- } & {
1158
- newMessages: (UserMessage | ToolMessage)[];
1159
- };
1160
- export declare const resumeToolCalls: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1161
- type: "resumeToolCalls";
1162
- } & {
1163
- pendingToolCalls: ToolCall[];
1164
- partialToolResults: ToolResult[];
1165
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1166
- type: "resumeToolCalls";
1167
- } & {
1168
- pendingToolCalls: ToolCall[];
1169
- partialToolResults: ToolResult[];
1170
- };
1171
- export declare const completeRun: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1172
- type: "completeRun";
1173
- } & {
1174
- checkpoint: Checkpoint;
1175
- step: Step;
1176
- text: string;
1177
- usage: Usage;
1178
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1179
- type: "completeRun";
1180
- } & {
1181
- checkpoint: Checkpoint;
1182
- step: Step;
1183
- text: string;
1184
- usage: Usage;
1185
- };
1186
- export declare const stopRunByInteractiveTool: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1187
- type: "stopRunByInteractiveTool";
1188
- } & {
1189
- checkpoint: Checkpoint;
1190
- step: Step;
1191
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1192
- type: "stopRunByInteractiveTool";
1193
- } & {
1194
- checkpoint: Checkpoint;
1195
- step: Step;
1196
- };
1197
- export declare const stopRunByDelegate: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1198
- type: "stopRunByDelegate";
1199
- } & {
1200
- checkpoint: Checkpoint;
1201
- step: Step;
1202
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1203
- type: "stopRunByDelegate";
1204
- } & {
1205
- checkpoint: Checkpoint;
1206
- step: Step;
1207
- };
1208
- export declare const stopRunByError: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1209
- type: "stopRunByError";
1210
- } & {
1211
- checkpoint: Checkpoint;
1212
- step: Step;
1213
- error: {
1214
- name: string;
1215
- message: string;
1216
- statusCode?: number;
1217
- isRetryable: boolean;
1218
- };
1219
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1220
- type: "stopRunByError";
1221
- } & {
1222
- checkpoint: Checkpoint;
1223
- step: Step;
1224
- error: {
1225
- name: string;
1226
- message: string;
1227
- statusCode?: number;
1228
- isRetryable: boolean;
1229
- };
1230
- };
1231
- export declare const continueToNextStep: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
1232
- type: "continueToNextStep";
1233
- } & {
1234
- checkpoint: Checkpoint;
1235
- step: Step;
1236
- nextCheckpoint: Checkpoint;
1237
- }, "id" | "type" | "jobId" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
1238
- type: "continueToNextStep";
1239
- } & {
1240
- checkpoint: Checkpoint;
1241
- step: Step;
1242
- nextCheckpoint: Checkpoint;
1243
- };
1244
- /** Base properties for runtime events (infrastructure-level, no expertKey) */
1245
- interface BaseRuntimeEvent {
1246
- /** Unique event ID */
1247
- id: string;
1248
- /** Unix timestamp */
1249
- timestamp: number;
1250
- /** Job ID */
1251
- jobId: string;
1252
- /** Run ID */
1253
- runId: string;
1254
- }
1255
- /** Runtime event payloads (infrastructure-level events only) */
1256
- type RuntimeEventPayloads = {
1257
- initializeRuntime: {
1258
- runtimeVersion: string;
1259
- expertName: string;
1260
- experts: string[];
1261
- model: string;
1262
- maxRetries: number;
1263
- timeout: number;
1264
- query?: string;
1265
- interactiveToolCall?: {
1266
- toolName: string;
1267
- toolCallId: string;
1268
- text: string;
1269
- };
1270
- };
1271
- skillStarting: {
1272
- skillName: string;
1273
- command: string;
1274
- args: string[];
1275
- };
1276
- skillConnected: {
1277
- skillName: string;
1278
- serverInfo?: {
1279
- name: string;
1280
- version: string;
1281
- };
1282
- connectDurationMs?: number;
1283
- totalDurationMs?: number;
1284
- spawnDurationMs?: number;
1285
- handshakeDurationMs?: number;
1286
- toolDiscoveryDurationMs?: number;
1287
- };
1288
- skillStderr: {
1289
- skillName: string;
1290
- message: string;
1291
- };
1292
- skillDisconnected: {
1293
- skillName: string;
1294
- };
1295
- };
1296
- /** All runtime event types */
1297
- export type RuntimeEventType = keyof RuntimeEventPayloads;
1298
- /** Union type of all runtime events */
1299
- export type RuntimeEvent = {
1300
- [K in RuntimeEventType]: BaseRuntimeEvent & {
1301
- type: K;
1302
- } & RuntimeEventPayloads[K];
1303
- }[RuntimeEventType];
1304
- /** Extract a specific runtime event type */
1305
- export type RuntimeEventForType<T extends RuntimeEventType> = Extract<RuntimeEvent, {
1306
- type: T;
1307
- }>;
1308
- /** Factory function to create runtime events */
1309
- export declare function createRuntimeEvent<T extends RuntimeEventType>(type: T, jobId: string, runId: string, data: Omit<RuntimeEventForType<T>, "type" | "id" | "timestamp" | "jobId" | "runId">): RuntimeEventForType<T>;
1310
- /** Union of all Perstack events (RunEvent for state machine, RuntimeEvent for environment) */
1311
- export type PerstackEvent = RunEvent | RuntimeEvent;
1312
- /** Validate if a string is a valid RunEvent type (ExpertStateEvent or StreamingEvent) */
1313
- export declare function isValidEventType(type: string): type is EventType;
1314
- /** Validate if a string is a valid RuntimeEvent type */
1315
- export declare function isValidRuntimeEventType(type: string): type is RuntimeEventType;
1316
- export {};
1317
- //# sourceMappingURL=runtime.d.ts.map