@perstack/core 0.0.21 → 0.0.23
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 +20 -1
- package/dist/src/index.d.ts +898 -682
- package/dist/src/index.js +265 -24
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -1,12 +1,213 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
2
|
import { createId } from '@paralleldrive/cuid2';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
// src/adapters/base-adapter.ts
|
|
6
|
+
var BaseAdapter = class {
|
|
7
|
+
convertExpert(expert) {
|
|
8
|
+
return { instruction: expert.instruction };
|
|
9
|
+
}
|
|
10
|
+
execCommand(args) {
|
|
11
|
+
return new Promise((resolve) => {
|
|
12
|
+
const [cmd, ...cmdArgs] = args;
|
|
13
|
+
if (!cmd) {
|
|
14
|
+
resolve({ stdout: "", stderr: "", exitCode: 127 });
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const proc = spawn(cmd, cmdArgs, { cwd: process.cwd(), stdio: ["pipe", "pipe", "pipe"] });
|
|
18
|
+
let stdout = "";
|
|
19
|
+
let stderr = "";
|
|
20
|
+
proc.stdout.on("data", (data) => {
|
|
21
|
+
stdout += data.toString();
|
|
22
|
+
});
|
|
23
|
+
proc.stderr.on("data", (data) => {
|
|
24
|
+
stderr += data.toString();
|
|
25
|
+
});
|
|
26
|
+
proc.on("close", (code) => {
|
|
27
|
+
resolve({ stdout, stderr, exitCode: code ?? 127 });
|
|
28
|
+
});
|
|
29
|
+
proc.on("error", () => {
|
|
30
|
+
resolve({ stdout: "", stderr: "", exitCode: 127 });
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
executeWithTimeout(proc, timeout) {
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
let stdout = "";
|
|
37
|
+
let stderr = "";
|
|
38
|
+
const timer = setTimeout(() => {
|
|
39
|
+
proc.kill("SIGTERM");
|
|
40
|
+
reject(new Error(`${this.name} timed out after ${timeout}ms`));
|
|
41
|
+
}, timeout);
|
|
42
|
+
proc.stdout?.on("data", (data) => {
|
|
43
|
+
stdout += data.toString();
|
|
44
|
+
});
|
|
45
|
+
proc.stderr?.on("data", (data) => {
|
|
46
|
+
stderr += data.toString();
|
|
47
|
+
});
|
|
48
|
+
proc.on("close", (code) => {
|
|
49
|
+
clearTimeout(timer);
|
|
50
|
+
resolve({ stdout, stderr, exitCode: code ?? 127 });
|
|
51
|
+
});
|
|
52
|
+
proc.on("error", (err) => {
|
|
53
|
+
clearTimeout(timer);
|
|
54
|
+
reject(err);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
function createEmptyUsage() {
|
|
60
|
+
return {
|
|
61
|
+
inputTokens: 0,
|
|
62
|
+
outputTokens: 0,
|
|
63
|
+
reasoningTokens: 0,
|
|
64
|
+
totalTokens: 0,
|
|
65
|
+
cachedInputTokens: 0
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function createNormalizedCheckpoint(params) {
|
|
69
|
+
const { jobId, runId, expert, output, runtime } = params;
|
|
70
|
+
const checkpointId = createId();
|
|
71
|
+
const expertMessage = {
|
|
72
|
+
id: createId(),
|
|
73
|
+
type: "expertMessage",
|
|
74
|
+
contents: [{ type: "textPart", id: createId(), text: output }]
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
id: checkpointId,
|
|
78
|
+
jobId,
|
|
79
|
+
runId,
|
|
80
|
+
status: "completed",
|
|
81
|
+
stepNumber: 1,
|
|
82
|
+
messages: [expertMessage],
|
|
83
|
+
expert: { key: expert.key, name: expert.name, version: expert.version },
|
|
84
|
+
usage: createEmptyUsage(),
|
|
85
|
+
metadata: { runtime }
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function createRuntimeInitEvent(jobId, runId, expertName, runtime, version, query) {
|
|
89
|
+
return {
|
|
90
|
+
type: "initializeRuntime",
|
|
91
|
+
id: createId(),
|
|
92
|
+
timestamp: Date.now(),
|
|
93
|
+
jobId,
|
|
94
|
+
runId,
|
|
95
|
+
runtimeVersion: version,
|
|
96
|
+
runtime,
|
|
97
|
+
expertName,
|
|
98
|
+
experts: [],
|
|
99
|
+
model: `${runtime}:default`,
|
|
100
|
+
temperature: 0,
|
|
101
|
+
maxRetries: 0,
|
|
102
|
+
timeout: 0,
|
|
103
|
+
query
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function createCompleteRunEvent(jobId, runId, expertKey, checkpoint, output, startedAt) {
|
|
107
|
+
const lastMessage = checkpoint.messages[checkpoint.messages.length - 1];
|
|
108
|
+
return {
|
|
109
|
+
type: "completeRun",
|
|
110
|
+
id: createId(),
|
|
111
|
+
expertKey,
|
|
112
|
+
timestamp: Date.now(),
|
|
113
|
+
jobId,
|
|
114
|
+
runId,
|
|
115
|
+
stepNumber: checkpoint.stepNumber,
|
|
116
|
+
checkpoint,
|
|
117
|
+
step: {
|
|
118
|
+
stepNumber: checkpoint.stepNumber,
|
|
119
|
+
newMessages: lastMessage ? [lastMessage] : [],
|
|
120
|
+
usage: createEmptyUsage(),
|
|
121
|
+
startedAt: startedAt ?? Date.now()
|
|
122
|
+
},
|
|
123
|
+
text: output,
|
|
124
|
+
usage: createEmptyUsage()
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function createStreamingTextEvent(jobId, runId, text) {
|
|
128
|
+
return {
|
|
129
|
+
type: "streamingText",
|
|
130
|
+
id: createId(),
|
|
131
|
+
timestamp: Date.now(),
|
|
132
|
+
jobId,
|
|
133
|
+
runId,
|
|
134
|
+
text
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function createCallToolsEvent(jobId, runId, expertKey, stepNumber, toolCalls, _checkpoint) {
|
|
138
|
+
const expertMessage = {
|
|
139
|
+
id: createId(),
|
|
140
|
+
type: "expertMessage",
|
|
141
|
+
contents: []
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
type: "callTools",
|
|
145
|
+
id: createId(),
|
|
146
|
+
expertKey,
|
|
147
|
+
timestamp: Date.now(),
|
|
148
|
+
jobId,
|
|
149
|
+
runId,
|
|
150
|
+
stepNumber,
|
|
151
|
+
newMessage: expertMessage,
|
|
152
|
+
toolCalls,
|
|
153
|
+
usage: createEmptyUsage()
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function createResolveToolResultsEvent(jobId, runId, expertKey, stepNumber, toolResults) {
|
|
157
|
+
return {
|
|
158
|
+
type: "resolveToolResults",
|
|
159
|
+
id: createId(),
|
|
160
|
+
expertKey,
|
|
161
|
+
timestamp: Date.now(),
|
|
162
|
+
jobId,
|
|
163
|
+
runId,
|
|
164
|
+
stepNumber,
|
|
165
|
+
toolResults
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function createToolMessage(toolCallId, toolName, resultText) {
|
|
169
|
+
return {
|
|
170
|
+
id: createId(),
|
|
171
|
+
type: "toolMessage",
|
|
172
|
+
contents: [
|
|
173
|
+
{
|
|
174
|
+
type: "toolResultPart",
|
|
175
|
+
id: createId(),
|
|
176
|
+
toolCallId,
|
|
177
|
+
toolName,
|
|
178
|
+
contents: [{ type: "textPart", id: createId(), text: resultText }]
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// src/adapters/registry.ts
|
|
185
|
+
var adapters = /* @__PURE__ */ new Map();
|
|
186
|
+
function registerAdapter(runtime, factory) {
|
|
187
|
+
adapters.set(runtime, factory);
|
|
188
|
+
}
|
|
189
|
+
function getAdapter(runtime) {
|
|
190
|
+
const factory = adapters.get(runtime);
|
|
191
|
+
if (!factory) {
|
|
192
|
+
throw new Error(
|
|
193
|
+
`Runtime "${runtime}" is not registered. Available runtimes: ${Array.from(adapters.keys()).join(", ")}`
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
return factory();
|
|
197
|
+
}
|
|
198
|
+
function isAdapterAvailable(runtime) {
|
|
199
|
+
return adapters.has(runtime);
|
|
200
|
+
}
|
|
201
|
+
function getRegisteredRuntimes() {
|
|
202
|
+
return Array.from(adapters.keys());
|
|
203
|
+
}
|
|
3
204
|
|
|
4
205
|
// src/constants/constants.ts
|
|
5
206
|
var defaultPerstackApiBaseUrl = "https://api.perstack.ai";
|
|
6
|
-
var organizationNameRegex = /^[a-z0-9][a-z0-9_
|
|
207
|
+
var organizationNameRegex = /^[a-z0-9][a-z0-9_.-]*$/;
|
|
7
208
|
var maxOrganizationNameLength = 128;
|
|
8
209
|
var maxApplicationNameLength = 255;
|
|
9
|
-
var expertKeyRegex = /^((?:@[a-z0-9][a-z0-9_
|
|
210
|
+
var expertKeyRegex = /^((?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*)(?:@((?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?)|@([a-z0-9][a-z0-9_.-]*))?$/;
|
|
10
211
|
var expertNameRegex = /^(@[a-z0-9][a-z0-9_-]*\/)?[a-z0-9][a-z0-9_-]*$/;
|
|
11
212
|
var expertVersionRegex = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?$/;
|
|
12
213
|
var tagNameRegex = /^[a-z0-9][a-z0-9_-]*$/;
|
|
@@ -24,7 +225,7 @@ var defaultMaxRetries = 5;
|
|
|
24
225
|
var defaultTimeout = 5 * 1e3 * 60;
|
|
25
226
|
var maxExpertJobQueryLength = 1024 * 20;
|
|
26
227
|
var maxExpertJobFileNameLength = 1024 * 10;
|
|
27
|
-
var packageWithVersionRegex = /^(?:@[a-z0-9][a-z0-9_
|
|
228
|
+
var packageWithVersionRegex = /^(?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*(?:@(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?|@[a-z0-9][a-z0-9_.-]*)?$/;
|
|
28
229
|
var urlSafeRegex = /^[a-z0-9][a-z0-9_-]*$/;
|
|
29
230
|
var maxSkillNameLength = 255;
|
|
30
231
|
var maxSkillDescriptionLength = 1024 * 2;
|
|
@@ -328,6 +529,7 @@ var messageSchema = z.union([
|
|
|
328
529
|
expertMessageSchema,
|
|
329
530
|
toolMessageSchema
|
|
330
531
|
]);
|
|
532
|
+
var runtimeNameSchema = z.enum(["perstack", "cursor", "claude-code", "gemini", "docker"]);
|
|
331
533
|
var toolCallSchema = z.object({
|
|
332
534
|
id: z.string().min(1).max(255),
|
|
333
535
|
skillName: z.string().min(1).max(maxSkillNameLength),
|
|
@@ -358,8 +560,19 @@ var checkpointStatusSchema = z.enum([
|
|
|
358
560
|
"stoppedByExceededMaxSteps",
|
|
359
561
|
"stoppedByError"
|
|
360
562
|
]);
|
|
563
|
+
var delegationTargetSchema = z.object({
|
|
564
|
+
expert: z.object({
|
|
565
|
+
key: z.string(),
|
|
566
|
+
name: z.string(),
|
|
567
|
+
version: z.string()
|
|
568
|
+
}),
|
|
569
|
+
toolCallId: z.string(),
|
|
570
|
+
toolName: z.string(),
|
|
571
|
+
query: z.string()
|
|
572
|
+
});
|
|
361
573
|
var checkpointSchema = z.object({
|
|
362
574
|
id: z.string(),
|
|
575
|
+
jobId: z.string(),
|
|
363
576
|
runId: z.string(),
|
|
364
577
|
status: checkpointStatusSchema,
|
|
365
578
|
stepNumber: z.number(),
|
|
@@ -369,16 +582,7 @@ var checkpointSchema = z.object({
|
|
|
369
582
|
name: z.string(),
|
|
370
583
|
version: z.string()
|
|
371
584
|
}),
|
|
372
|
-
delegateTo: z.
|
|
373
|
-
expert: z.object({
|
|
374
|
-
key: z.string(),
|
|
375
|
-
name: z.string(),
|
|
376
|
-
version: z.string()
|
|
377
|
-
}),
|
|
378
|
-
toolCallId: z.string(),
|
|
379
|
-
toolName: z.string(),
|
|
380
|
-
query: z.string()
|
|
381
|
-
}).optional(),
|
|
585
|
+
delegateTo: z.array(delegationTargetSchema).optional(),
|
|
382
586
|
delegatedBy: z.object({
|
|
383
587
|
expert: z.object({
|
|
384
588
|
key: z.string(),
|
|
@@ -393,7 +597,10 @@ var checkpointSchema = z.object({
|
|
|
393
597
|
contextWindow: z.number().optional(),
|
|
394
598
|
contextWindowUsage: z.number().optional(),
|
|
395
599
|
pendingToolCalls: z.array(toolCallSchema).optional(),
|
|
396
|
-
partialToolResults: z.array(toolResultSchema).optional()
|
|
600
|
+
partialToolResults: z.array(toolResultSchema).optional(),
|
|
601
|
+
metadata: z.object({
|
|
602
|
+
runtime: runtimeNameSchema.optional()
|
|
603
|
+
}).passthrough().optional()
|
|
397
604
|
});
|
|
398
605
|
var mcpStdioSkillSchema = z.object({
|
|
399
606
|
type: z.literal("mcpStdioSkill"),
|
|
@@ -482,6 +689,23 @@ var expertSchema = z.object({
|
|
|
482
689
|
delegates: z.array(z.string().regex(expertKeyRegex).min(1)).optional().default([]),
|
|
483
690
|
tags: z.array(z.string().regex(tagNameRegex).min(1)).optional().default([])
|
|
484
691
|
});
|
|
692
|
+
var jobStatusSchema = z.enum([
|
|
693
|
+
"running",
|
|
694
|
+
"completed",
|
|
695
|
+
"stoppedByMaxSteps",
|
|
696
|
+
"stoppedByInteractiveTool",
|
|
697
|
+
"stoppedByError"
|
|
698
|
+
]);
|
|
699
|
+
var jobSchema = z.object({
|
|
700
|
+
id: z.string(),
|
|
701
|
+
status: jobStatusSchema,
|
|
702
|
+
coordinatorExpertKey: z.string(),
|
|
703
|
+
totalSteps: z.number(),
|
|
704
|
+
maxSteps: z.number().optional(),
|
|
705
|
+
usage: usageSchema,
|
|
706
|
+
startedAt: z.number(),
|
|
707
|
+
finishedAt: z.number().optional()
|
|
708
|
+
});
|
|
485
709
|
var headersSchema = z.record(z.string(), z.string()).optional();
|
|
486
710
|
var providerNameSchema = z.enum([
|
|
487
711
|
"anthropic",
|
|
@@ -560,6 +784,10 @@ var providerConfigSchema = z.discriminatedUnion("providerName", [
|
|
|
560
784
|
]);
|
|
561
785
|
|
|
562
786
|
// src/schemas/perstack-toml.ts
|
|
787
|
+
var domainPatternRegex = /^(\*\.)?[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/;
|
|
788
|
+
var domainPatternSchema = z.string().regex(domainPatternRegex, {
|
|
789
|
+
message: "Invalid domain pattern. Use exact domain (example.com) or wildcard prefix (*.example.com)"
|
|
790
|
+
});
|
|
563
791
|
var anthropicSettingSchema = z.object({
|
|
564
792
|
baseUrl: z.string().optional(),
|
|
565
793
|
headers: headersSchema
|
|
@@ -637,6 +865,7 @@ var perstackConfigSchema = z.object({
|
|
|
637
865
|
provider: providerTableSchema.optional(),
|
|
638
866
|
model: z.string().optional(),
|
|
639
867
|
temperature: z.number().optional(),
|
|
868
|
+
runtime: runtimeNameSchema.optional(),
|
|
640
869
|
maxSteps: z.number().optional(),
|
|
641
870
|
maxRetries: z.number().optional(),
|
|
642
871
|
timeout: z.number().optional(),
|
|
@@ -659,7 +888,8 @@ var perstackConfigSchema = z.object({
|
|
|
659
888
|
command: z.string(),
|
|
660
889
|
packageName: z.string().optional(),
|
|
661
890
|
args: z.array(z.string()).optional(),
|
|
662
|
-
requiredEnv: z.array(z.string()).optional()
|
|
891
|
+
requiredEnv: z.array(z.string()).optional(),
|
|
892
|
+
allowedDomains: z.array(domainPatternSchema).optional()
|
|
663
893
|
}),
|
|
664
894
|
z.object({
|
|
665
895
|
type: z.literal("mcpSseSkill"),
|
|
@@ -667,7 +897,8 @@ var perstackConfigSchema = z.object({
|
|
|
667
897
|
rule: z.string().optional(),
|
|
668
898
|
pick: z.array(z.string()).optional(),
|
|
669
899
|
omit: z.array(z.string()).optional(),
|
|
670
|
-
endpoint: z.string()
|
|
900
|
+
endpoint: z.string(),
|
|
901
|
+
allowedDomains: z.array(domainPatternSchema).optional()
|
|
671
902
|
}),
|
|
672
903
|
z.object({
|
|
673
904
|
type: z.literal("interactiveSkill"),
|
|
@@ -719,13 +950,15 @@ var commandOptionsSchema = z.object({
|
|
|
719
950
|
if (Number.isNaN(parsedValue)) return void 0;
|
|
720
951
|
return parsedValue;
|
|
721
952
|
}),
|
|
953
|
+
jobId: z.string().optional(),
|
|
722
954
|
runId: z.string().optional(),
|
|
723
955
|
envPath: z.array(z.string()).optional(),
|
|
724
956
|
verbose: z.boolean().optional(),
|
|
725
957
|
continue: z.boolean().optional(),
|
|
726
|
-
|
|
958
|
+
continueJob: z.string().optional(),
|
|
727
959
|
resumeFrom: z.string().optional(),
|
|
728
|
-
interactiveToolCallResult: z.boolean().optional()
|
|
960
|
+
interactiveToolCallResult: z.boolean().optional(),
|
|
961
|
+
runtime: runtimeNameSchema.optional()
|
|
729
962
|
});
|
|
730
963
|
var runCommandInputSchema = z.object({
|
|
731
964
|
expertKey: z.string(),
|
|
@@ -751,6 +984,7 @@ function parseExpertKey(expertKey) {
|
|
|
751
984
|
var runSettingSchema = z.object({
|
|
752
985
|
model: z.string(),
|
|
753
986
|
providerConfig: providerConfigSchema,
|
|
987
|
+
jobId: z.string(),
|
|
754
988
|
runId: z.string(),
|
|
755
989
|
expertKey: z.string().min(1).regex(expertKeyRegex),
|
|
756
990
|
input: z.object({
|
|
@@ -758,6 +992,7 @@ var runSettingSchema = z.object({
|
|
|
758
992
|
interactiveToolCallResult: z.object({
|
|
759
993
|
toolCallId: z.string(),
|
|
760
994
|
toolName: z.string(),
|
|
995
|
+
skillName: z.string(),
|
|
761
996
|
text: z.string()
|
|
762
997
|
}).optional()
|
|
763
998
|
}),
|
|
@@ -771,19 +1006,22 @@ var runSettingSchema = z.object({
|
|
|
771
1006
|
perstackApiBaseUrl: z.string().url(),
|
|
772
1007
|
perstackApiKey: z.string().optional(),
|
|
773
1008
|
perstackBaseSkillCommand: z.array(z.string()).optional(),
|
|
774
|
-
env: z.record(z.string(), z.string())
|
|
1009
|
+
env: z.record(z.string(), z.string()),
|
|
1010
|
+
proxyUrl: z.string().optional()
|
|
775
1011
|
});
|
|
776
1012
|
var runParamsSchema = z.object({
|
|
777
1013
|
setting: z.object({
|
|
778
1014
|
model: z.string(),
|
|
779
1015
|
providerConfig: providerConfigSchema,
|
|
780
|
-
|
|
1016
|
+
jobId: z.string().optional().default(() => createId()),
|
|
1017
|
+
runId: z.string().optional().default(() => createId()),
|
|
781
1018
|
expertKey: z.string().min(1).regex(expertKeyRegex),
|
|
782
1019
|
input: z.object({
|
|
783
1020
|
text: z.string().optional(),
|
|
784
1021
|
interactiveToolCallResult: z.object({
|
|
785
1022
|
toolCallId: z.string(),
|
|
786
1023
|
toolName: z.string(),
|
|
1024
|
+
skillName: z.string(),
|
|
787
1025
|
text: z.string()
|
|
788
1026
|
}).optional()
|
|
789
1027
|
}),
|
|
@@ -807,7 +1045,8 @@ var runParamsSchema = z.object({
|
|
|
807
1045
|
perstackApiBaseUrl: z.url().optional().default(defaultPerstackApiBaseUrl),
|
|
808
1046
|
perstackApiKey: z.string().optional(),
|
|
809
1047
|
perstackBaseSkillCommand: z.array(z.string()).optional(),
|
|
810
|
-
env: z.record(z.string(), z.string()).optional().default({})
|
|
1048
|
+
env: z.record(z.string(), z.string()).optional().default({}),
|
|
1049
|
+
proxyUrl: z.string().optional()
|
|
811
1050
|
}),
|
|
812
1051
|
checkpoint: checkpointSchema.optional()
|
|
813
1052
|
});
|
|
@@ -818,6 +1057,7 @@ function createEvent(type) {
|
|
|
818
1057
|
id: createId(),
|
|
819
1058
|
expertKey: checkpoint.expert.key,
|
|
820
1059
|
timestamp: Date.now(),
|
|
1060
|
+
jobId: setting.jobId,
|
|
821
1061
|
runId: setting.runId,
|
|
822
1062
|
stepNumber: checkpoint.stepNumber,
|
|
823
1063
|
...data
|
|
@@ -841,11 +1081,12 @@ var stopRunByInteractiveTool = createEvent("stopRunByInteractiveTool");
|
|
|
841
1081
|
var stopRunByDelegate = createEvent("stopRunByDelegate");
|
|
842
1082
|
var stopRunByExceededMaxSteps = createEvent("stopRunByExceededMaxSteps");
|
|
843
1083
|
var continueToNextStep = createEvent("continueToNextStep");
|
|
844
|
-
function createRuntimeEvent(type, runId, data) {
|
|
1084
|
+
function createRuntimeEvent(type, jobId, runId, data) {
|
|
845
1085
|
return {
|
|
846
1086
|
type,
|
|
847
1087
|
id: createId(),
|
|
848
1088
|
timestamp: Date.now(),
|
|
1089
|
+
jobId,
|
|
849
1090
|
runId,
|
|
850
1091
|
...data
|
|
851
1092
|
};
|
|
@@ -881,6 +1122,6 @@ function parseWithFriendlyError(schema, data, context) {
|
|
|
881
1122
|
throw new Error(`${prefix}${formatZodError(result.error)}`);
|
|
882
1123
|
}
|
|
883
1124
|
|
|
884
|
-
export { amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, attemptCompletion, azureOpenAiProviderConfigSchema, basePartSchema, callDelegate, callInteractiveTool, callTools, checkpointSchema, checkpointStatusSchema, completeRun, continueToNextStep, createEvent, createRuntimeEvent, deepseekProviderConfigSchema, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultTemperature, defaultTimeout, envNameRegex, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileUrlPartSchema, finishAllToolCalls, finishToolCall, formatZodError, googleGenerativeAiProviderConfigSchema, googleVertexProviderConfigSchema, headersSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolSchema, knownModels, maxApplicationNameLength, maxCheckpointToolCallIdLength, maxEnvNameLength, maxExpertDelegateItems, maxExpertDescriptionLength, maxExpertInstructionLength, maxExpertJobFileNameLength, maxExpertJobQueryLength, maxExpertKeyLength, maxExpertNameLength, maxExpertSkillItems, maxExpertTagItems, maxExpertVersionTagLength, maxOrganizationNameLength, maxSkillDescriptionLength, maxSkillEndpointLength, maxSkillInputJsonSchemaLength, maxSkillNameLength, maxSkillPickOmitItems, maxSkillRequiredEnvItems, maxSkillRuleLength, maxSkillToolItems, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, organizationNameRegex, packageWithVersionRegex, parseExpertKey, parseWithFriendlyError, perstackConfigSchema, providerConfigSchema, providerNameSchema, providerTableSchema, resolveThought, resolveToolResults, resumeToolCalls, retry, runCommandInputSchema, runParamsSchema, runSettingSchema, skillSchema, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, urlSafeRegex, usageSchema, userMessageSchema };
|
|
1125
|
+
export { BaseAdapter, amazonBedrockProviderConfigSchema, anthropicProviderConfigSchema, attemptCompletion, azureOpenAiProviderConfigSchema, basePartSchema, callDelegate, callInteractiveTool, callTools, checkpointSchema, checkpointStatusSchema, completeRun, continueToNextStep, createCallToolsEvent, createCompleteRunEvent, createEmptyUsage, createEvent, createNormalizedCheckpoint, createResolveToolResultsEvent, createRuntimeEvent, createRuntimeInitEvent, createStreamingTextEvent, createToolMessage, deepseekProviderConfigSchema, defaultMaxRetries, defaultMaxSteps, defaultPerstackApiBaseUrl, defaultTemperature, defaultTimeout, delegationTargetSchema, domainPatternSchema, envNameRegex, expertKeyRegex, expertMessageSchema, expertNameRegex, expertSchema, expertVersionRegex, fileBinaryPartSchema, fileInlinePartSchema, fileUrlPartSchema, finishAllToolCalls, finishToolCall, formatZodError, getAdapter, getRegisteredRuntimes, googleGenerativeAiProviderConfigSchema, googleVertexProviderConfigSchema, headersSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, instructionMessageSchema, interactiveSkillSchema, interactiveToolSchema, isAdapterAvailable, jobSchema, jobStatusSchema, knownModels, maxApplicationNameLength, maxCheckpointToolCallIdLength, maxEnvNameLength, maxExpertDelegateItems, maxExpertDescriptionLength, maxExpertInstructionLength, maxExpertJobFileNameLength, maxExpertJobQueryLength, maxExpertKeyLength, maxExpertNameLength, maxExpertSkillItems, maxExpertTagItems, maxExpertVersionTagLength, maxOrganizationNameLength, maxSkillDescriptionLength, maxSkillEndpointLength, maxSkillInputJsonSchemaLength, maxSkillNameLength, maxSkillPickOmitItems, maxSkillRequiredEnvItems, maxSkillRuleLength, maxSkillToolItems, maxSkillToolNameLength, mcpSseSkillSchema, mcpStdioSkillSchema, messagePartSchema, messageSchema, ollamaProviderConfigSchema, openAiProviderConfigSchema, organizationNameRegex, packageWithVersionRegex, parseExpertKey, parseWithFriendlyError, perstackConfigSchema, providerConfigSchema, providerNameSchema, providerTableSchema, registerAdapter, resolveThought, resolveToolResults, resumeToolCalls, retry, runCommandInputSchema, runParamsSchema, runSettingSchema, runtimeNameSchema, skillSchema, startCommandInputSchema, startGeneration, startRun, stepSchema, stopRunByDelegate, stopRunByExceededMaxSteps, stopRunByInteractiveTool, tagNameRegex, textPartSchema, toolCallPartSchema, toolCallSchema, toolMessageSchema, toolResultPartSchema, toolResultSchema, urlSafeRegex, usageSchema, userMessageSchema };
|
|
885
1126
|
//# sourceMappingURL=index.js.map
|
|
886
1127
|
//# sourceMappingURL=index.js.map
|