@perstack/runtime 0.0.62 → 0.0.64
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 +163 -45
- package/bin/cli.ts +93 -0
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +247 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/chunk-C7AFEVYF.js +2355 -0
- package/dist/chunk-C7AFEVYF.js.map +1 -0
- package/dist/src/index.d.ts +61 -49
- package/dist/src/index.js +158 -2144
- package/dist/src/index.js.map +1 -1
- package/package.json +27 -14
- package/LICENSE +0 -202
package/dist/src/index.d.ts
CHANGED
|
@@ -1,38 +1,50 @@
|
|
|
1
1
|
import * as _perstack_core from '@perstack/core';
|
|
2
|
-
import { ProviderConfig,
|
|
2
|
+
import { ProviderConfig, BaseAdapter, RuntimeAdapter, PrerequisiteResult, Expert, RuntimeExpertConfig, AdapterRunParams, AdapterRunResult, RunSetting, Checkpoint, Step, RunEvent, Job, RuntimeEvent, RunParamsInput, ToolDefinition, SkillType, McpStdioSkill, McpSseSkill, InteractiveSkill, TextPart, ImageInlinePart, FileInlinePart } from '@perstack/core';
|
|
3
3
|
import { LanguageModel } from 'ai';
|
|
4
4
|
import * as xstate from 'xstate';
|
|
5
|
-
import {
|
|
5
|
+
import { ActorRefFrom, SnapshotFrom } from 'xstate';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
interface GetModelOptions {
|
|
8
|
+
proxyUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function getModel(modelId: string, providerConfig: ProviderConfig, options?: GetModelOptions): LanguageModel;
|
|
10
11
|
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
mkdir: (path: string, options: {
|
|
14
|
-
recursive: boolean;
|
|
15
|
-
}) => Promise<void>;
|
|
16
|
-
readFile: (path: string, encoding: BufferEncoding) => Promise<string>;
|
|
17
|
-
writeFile: (path: string, data: string, encoding: BufferEncoding) => Promise<void>;
|
|
12
|
+
type PerstackAdapterOptions = {
|
|
13
|
+
useDirectExecution?: boolean;
|
|
18
14
|
};
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
declare class PerstackAdapter extends BaseAdapter implements RuntimeAdapter {
|
|
16
|
+
readonly name = "perstack";
|
|
17
|
+
protected version: string;
|
|
18
|
+
private useDirectExecution;
|
|
19
|
+
constructor(options?: PerstackAdapterOptions);
|
|
20
|
+
checkPrerequisites(): Promise<PrerequisiteResult>;
|
|
21
|
+
convertExpert(expert: Expert): RuntimeExpertConfig;
|
|
22
|
+
run(params: AdapterRunParams): Promise<AdapterRunResult>;
|
|
23
|
+
private runDirect;
|
|
24
|
+
private runViaCli;
|
|
25
|
+
private buildCliArgs;
|
|
26
|
+
private executeRuntimeCli;
|
|
27
|
+
private executeWithStreaming;
|
|
28
|
+
}
|
|
21
29
|
|
|
22
30
|
type ResolveExpertToRunFn = (expertKey: string, experts: Record<string, Expert>, clientOptions: {
|
|
23
31
|
perstackApiBaseUrl: string;
|
|
24
32
|
perstackApiKey?: string;
|
|
25
33
|
}) => Promise<Expert>;
|
|
26
34
|
|
|
27
|
-
|
|
35
|
+
type RunOptions = {
|
|
28
36
|
shouldContinueRun?: (setting: RunSetting, checkpoint: Checkpoint, step: Step) => Promise<boolean>;
|
|
29
|
-
retrieveCheckpoint?: (
|
|
30
|
-
storeCheckpoint?: (checkpoint: Checkpoint
|
|
37
|
+
retrieveCheckpoint?: (jobId: string, checkpointId: string) => Promise<Checkpoint>;
|
|
38
|
+
storeCheckpoint?: (checkpoint: Checkpoint) => Promise<void>;
|
|
39
|
+
storeEvent?: (event: RunEvent) => Promise<void>;
|
|
40
|
+
storeJob?: (job: Job) => void;
|
|
41
|
+
retrieveJob?: (jobId: string) => Job | undefined;
|
|
42
|
+
createJob?: (jobId: string, expertKey: string, maxSteps?: number) => Job;
|
|
31
43
|
eventListener?: (event: RunEvent | RuntimeEvent) => void;
|
|
32
44
|
resolveExpertToRun?: ResolveExpertToRunFn;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
returnOnDelegationComplete?: boolean;
|
|
46
|
+
};
|
|
47
|
+
declare function run(runInput: RunParamsInput, options?: RunOptions): Promise<Checkpoint>;
|
|
36
48
|
|
|
37
49
|
declare abstract class BaseSkillManager {
|
|
38
50
|
protected _toolDefinitions: ToolDefinition[];
|
|
@@ -44,9 +56,10 @@ declare abstract class BaseSkillManager {
|
|
|
44
56
|
readonly skill?: McpStdioSkill | McpSseSkill;
|
|
45
57
|
readonly interactiveSkill?: InteractiveSkill;
|
|
46
58
|
readonly expert?: Expert;
|
|
59
|
+
protected _jobId: string;
|
|
47
60
|
protected _runId: string;
|
|
48
61
|
protected _eventListener?: (event: RunEvent | RuntimeEvent) => void;
|
|
49
|
-
constructor(runId: string, eventListener?: (event: RunEvent | RuntimeEvent) => void);
|
|
62
|
+
constructor(jobId: string, runId: string, eventListener?: (event: RunEvent | RuntimeEvent) => void);
|
|
50
63
|
init(): Promise<void>;
|
|
51
64
|
isInitialized(): boolean;
|
|
52
65
|
protected _performInit(): Promise<void>;
|
|
@@ -96,7 +109,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
96
109
|
type: "callDelegate";
|
|
97
110
|
} & {
|
|
98
111
|
newMessage: _perstack_core.ExpertMessage;
|
|
99
|
-
|
|
112
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
100
113
|
usage: _perstack_core.Usage;
|
|
101
114
|
}) | (_perstack_core.BaseEvent & {
|
|
102
115
|
type: "resolveToolResults";
|
|
@@ -215,7 +228,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
215
228
|
type: "callDelegate";
|
|
216
229
|
} & {
|
|
217
230
|
newMessage: _perstack_core.ExpertMessage;
|
|
218
|
-
|
|
231
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
219
232
|
usage: _perstack_core.Usage;
|
|
220
233
|
}) | (_perstack_core.BaseEvent & {
|
|
221
234
|
type: "resolveToolResults";
|
|
@@ -303,7 +316,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
303
316
|
type: "callDelegate";
|
|
304
317
|
} & {
|
|
305
318
|
newMessage: _perstack_core.ExpertMessage;
|
|
306
|
-
|
|
319
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
307
320
|
usage: _perstack_core.Usage;
|
|
308
321
|
}) | (_perstack_core.BaseEvent & {
|
|
309
322
|
type: "resolveToolResults";
|
|
@@ -421,7 +434,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
421
434
|
type: "callDelegate";
|
|
422
435
|
} & {
|
|
423
436
|
newMessage: _perstack_core.ExpertMessage;
|
|
424
|
-
|
|
437
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
425
438
|
usage: _perstack_core.Usage;
|
|
426
439
|
}) | (_perstack_core.BaseEvent & {
|
|
427
440
|
type: "resolveToolResults";
|
|
@@ -527,7 +540,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
527
540
|
type: "callDelegate";
|
|
528
541
|
} & {
|
|
529
542
|
newMessage: _perstack_core.ExpertMessage;
|
|
530
|
-
|
|
543
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
531
544
|
usage: _perstack_core.Usage;
|
|
532
545
|
}) | (_perstack_core.BaseEvent & {
|
|
533
546
|
type: "resolveToolResults";
|
|
@@ -630,7 +643,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
630
643
|
type: "callDelegate";
|
|
631
644
|
} & {
|
|
632
645
|
newMessage: _perstack_core.ExpertMessage;
|
|
633
|
-
|
|
646
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
634
647
|
usage: _perstack_core.Usage;
|
|
635
648
|
}) | (_perstack_core.BaseEvent & {
|
|
636
649
|
type: "resolveToolResults";
|
|
@@ -732,7 +745,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
732
745
|
type: "callDelegate";
|
|
733
746
|
} & {
|
|
734
747
|
newMessage: _perstack_core.ExpertMessage;
|
|
735
|
-
|
|
748
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
736
749
|
usage: _perstack_core.Usage;
|
|
737
750
|
}) | (_perstack_core.BaseEvent & {
|
|
738
751
|
type: "resolveToolResults";
|
|
@@ -842,7 +855,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
842
855
|
type: "callDelegate";
|
|
843
856
|
} & {
|
|
844
857
|
newMessage: _perstack_core.ExpertMessage;
|
|
845
|
-
|
|
858
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
846
859
|
usage: _perstack_core.Usage;
|
|
847
860
|
}) | (_perstack_core.BaseEvent & {
|
|
848
861
|
type: "resolveToolResults";
|
|
@@ -946,7 +959,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
946
959
|
type: "callDelegate";
|
|
947
960
|
} & {
|
|
948
961
|
newMessage: _perstack_core.ExpertMessage;
|
|
949
|
-
|
|
962
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
950
963
|
usage: _perstack_core.Usage;
|
|
951
964
|
}) | (_perstack_core.BaseEvent & {
|
|
952
965
|
type: "resolveToolResults";
|
|
@@ -1050,7 +1063,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1050
1063
|
type: "callDelegate";
|
|
1051
1064
|
} & {
|
|
1052
1065
|
newMessage: _perstack_core.ExpertMessage;
|
|
1053
|
-
|
|
1066
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1054
1067
|
usage: _perstack_core.Usage;
|
|
1055
1068
|
}) | (_perstack_core.BaseEvent & {
|
|
1056
1069
|
type: "resolveToolResults";
|
|
@@ -1119,7 +1132,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1119
1132
|
type: "callDelegate";
|
|
1120
1133
|
} & {
|
|
1121
1134
|
newMessage: _perstack_core.ExpertMessage;
|
|
1122
|
-
|
|
1135
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1123
1136
|
usage: _perstack_core.Usage;
|
|
1124
1137
|
}, (_perstack_core.BaseEvent & {
|
|
1125
1138
|
type: "startRun";
|
|
@@ -1154,7 +1167,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1154
1167
|
type: "callDelegate";
|
|
1155
1168
|
} & {
|
|
1156
1169
|
newMessage: _perstack_core.ExpertMessage;
|
|
1157
|
-
|
|
1170
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1158
1171
|
usage: _perstack_core.Usage;
|
|
1159
1172
|
}) | (_perstack_core.BaseEvent & {
|
|
1160
1173
|
type: "resolveToolResults";
|
|
@@ -1260,7 +1273,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1260
1273
|
type: "callDelegate";
|
|
1261
1274
|
} & {
|
|
1262
1275
|
newMessage: _perstack_core.ExpertMessage;
|
|
1263
|
-
|
|
1276
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1264
1277
|
usage: _perstack_core.Usage;
|
|
1265
1278
|
}) | (_perstack_core.BaseEvent & {
|
|
1266
1279
|
type: "resolveToolResults";
|
|
@@ -1362,7 +1375,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1362
1375
|
type: "callDelegate";
|
|
1363
1376
|
} & {
|
|
1364
1377
|
newMessage: _perstack_core.ExpertMessage;
|
|
1365
|
-
|
|
1378
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1366
1379
|
usage: _perstack_core.Usage;
|
|
1367
1380
|
}) | (_perstack_core.BaseEvent & {
|
|
1368
1381
|
type: "resolveToolResults";
|
|
@@ -1464,7 +1477,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1464
1477
|
type: "callDelegate";
|
|
1465
1478
|
} & {
|
|
1466
1479
|
newMessage: _perstack_core.ExpertMessage;
|
|
1467
|
-
|
|
1480
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1468
1481
|
usage: _perstack_core.Usage;
|
|
1469
1482
|
}) | (_perstack_core.BaseEvent & {
|
|
1470
1483
|
type: "resolveToolResults";
|
|
@@ -1533,7 +1546,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1533
1546
|
type: "callDelegate";
|
|
1534
1547
|
} & {
|
|
1535
1548
|
newMessage: _perstack_core.ExpertMessage;
|
|
1536
|
-
|
|
1549
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1537
1550
|
usage: _perstack_core.Usage;
|
|
1538
1551
|
}, (_perstack_core.BaseEvent & {
|
|
1539
1552
|
type: "startRun";
|
|
@@ -1568,7 +1581,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1568
1581
|
type: "callDelegate";
|
|
1569
1582
|
} & {
|
|
1570
1583
|
newMessage: _perstack_core.ExpertMessage;
|
|
1571
|
-
|
|
1584
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1572
1585
|
usage: _perstack_core.Usage;
|
|
1573
1586
|
}) | (_perstack_core.BaseEvent & {
|
|
1574
1587
|
type: "resolveToolResults";
|
|
@@ -1672,7 +1685,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1672
1685
|
type: "callDelegate";
|
|
1673
1686
|
} & {
|
|
1674
1687
|
newMessage: _perstack_core.ExpertMessage;
|
|
1675
|
-
|
|
1688
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1676
1689
|
usage: _perstack_core.Usage;
|
|
1677
1690
|
}) | (_perstack_core.BaseEvent & {
|
|
1678
1691
|
type: "resolveToolResults";
|
|
@@ -1778,7 +1791,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1778
1791
|
type: "callDelegate";
|
|
1779
1792
|
} & {
|
|
1780
1793
|
newMessage: _perstack_core.ExpertMessage;
|
|
1781
|
-
|
|
1794
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1782
1795
|
usage: _perstack_core.Usage;
|
|
1783
1796
|
}) | (_perstack_core.BaseEvent & {
|
|
1784
1797
|
type: "resolveToolResults";
|
|
@@ -1884,7 +1897,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1884
1897
|
type: "callDelegate";
|
|
1885
1898
|
} & {
|
|
1886
1899
|
newMessage: _perstack_core.ExpertMessage;
|
|
1887
|
-
|
|
1900
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1888
1901
|
usage: _perstack_core.Usage;
|
|
1889
1902
|
}) | (_perstack_core.BaseEvent & {
|
|
1890
1903
|
type: "resolveToolResults";
|
|
@@ -1994,7 +2007,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1994
2007
|
type: "callDelegate";
|
|
1995
2008
|
} & {
|
|
1996
2009
|
newMessage: _perstack_core.ExpertMessage;
|
|
1997
|
-
|
|
2010
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
1998
2011
|
usage: _perstack_core.Usage;
|
|
1999
2012
|
}) | (_perstack_core.BaseEvent & {
|
|
2000
2013
|
type: "resolveToolResults";
|
|
@@ -2099,7 +2112,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
2099
2112
|
type: "callDelegate";
|
|
2100
2113
|
} & {
|
|
2101
2114
|
newMessage: _perstack_core.ExpertMessage;
|
|
2102
|
-
|
|
2115
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
2103
2116
|
usage: _perstack_core.Usage;
|
|
2104
2117
|
}) | (_perstack_core.BaseEvent & {
|
|
2105
2118
|
type: "resolveToolResults";
|
|
@@ -2206,7 +2219,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
2206
2219
|
type: "callDelegate";
|
|
2207
2220
|
} & {
|
|
2208
2221
|
newMessage: _perstack_core.ExpertMessage;
|
|
2209
|
-
|
|
2222
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
2210
2223
|
usage: _perstack_core.Usage;
|
|
2211
2224
|
}) | (_perstack_core.BaseEvent & {
|
|
2212
2225
|
type: "resolveToolResults";
|
|
@@ -2313,7 +2326,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
2313
2326
|
type: "callDelegate";
|
|
2314
2327
|
} & {
|
|
2315
2328
|
newMessage: _perstack_core.ExpertMessage;
|
|
2316
|
-
|
|
2329
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
2317
2330
|
usage: _perstack_core.Usage;
|
|
2318
2331
|
}) | (_perstack_core.BaseEvent & {
|
|
2319
2332
|
type: "resolveToolResults";
|
|
@@ -2421,7 +2434,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
2421
2434
|
type: "callDelegate";
|
|
2422
2435
|
} & {
|
|
2423
2436
|
newMessage: _perstack_core.ExpertMessage;
|
|
2424
|
-
|
|
2437
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
2425
2438
|
usage: _perstack_core.Usage;
|
|
2426
2439
|
}) | (_perstack_core.BaseEvent & {
|
|
2427
2440
|
type: "resolveToolResults";
|
|
@@ -2525,7 +2538,7 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
2525
2538
|
type: "callDelegate";
|
|
2526
2539
|
} & {
|
|
2527
2540
|
newMessage: _perstack_core.ExpertMessage;
|
|
2528
|
-
|
|
2541
|
+
toolCalls: _perstack_core.ToolCall[];
|
|
2529
2542
|
usage: _perstack_core.Usage;
|
|
2530
2543
|
}) | (_perstack_core.BaseEvent & {
|
|
2531
2544
|
type: "resolveToolResults";
|
|
@@ -2589,10 +2602,9 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
2589
2602
|
};
|
|
2590
2603
|
};
|
|
2591
2604
|
}>;
|
|
2592
|
-
declare const StateMachineLogics: Record<Exclude<RunSnapshot["value"], "Stopped">, (context: RunSnapshot["context"]) => Promise<RunEvent>>;
|
|
2593
2605
|
type RunActor = ActorRefFrom<typeof runtimeStateMachine>;
|
|
2594
2606
|
type RunSnapshot = SnapshotFrom<typeof runtimeStateMachine>;
|
|
2595
2607
|
|
|
2596
2608
|
declare const runtimeVersion: string;
|
|
2597
2609
|
|
|
2598
|
-
export { type RunActor, type
|
|
2610
|
+
export { PerstackAdapter, type RunActor, type RunOptions, type RunSnapshot, getModel, run, runtimeStateMachine, runtimeVersion };
|