@perstack/runtime 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +58 -0
- package/dist/index.js +58 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -999,6 +999,8 @@ type ExpertEventPayloads = {
|
|
|
999
999
|
};
|
|
1000
1000
|
retry: {
|
|
1001
1001
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
1002
|
+
toolCall?: ToolCall;
|
|
1003
|
+
toolResult?: ToolResult;
|
|
1002
1004
|
usage: Usage;
|
|
1003
1005
|
};
|
|
1004
1006
|
callTool: {
|
|
@@ -1099,11 +1101,15 @@ declare const retry: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<Ba
|
|
|
1099
1101
|
type: "retry";
|
|
1100
1102
|
} & {
|
|
1101
1103
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
1104
|
+
toolCall?: ToolCall;
|
|
1105
|
+
toolResult?: ToolResult;
|
|
1102
1106
|
usage: Usage;
|
|
1103
1107
|
}, "id" | "type" | "runId" | "stepNumber" | "expertKey" | "timestamp">) => BaseEvent & {
|
|
1104
1108
|
type: "retry";
|
|
1105
1109
|
} & {
|
|
1106
1110
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
1111
|
+
toolCall?: ToolCall;
|
|
1112
|
+
toolResult?: ToolResult;
|
|
1107
1113
|
usage: Usage;
|
|
1108
1114
|
};
|
|
1109
1115
|
declare const callTool: (setting: RunSetting, checkpoint: Checkpoint, data: Omit<BaseEvent & {
|
|
@@ -1356,6 +1362,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1356
1362
|
type: "retry";
|
|
1357
1363
|
} & {
|
|
1358
1364
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
1365
|
+
toolCall?: ToolCall;
|
|
1366
|
+
toolResult?: ToolResult;
|
|
1359
1367
|
usage: Usage;
|
|
1360
1368
|
}) | ({
|
|
1361
1369
|
id: string;
|
|
@@ -1573,6 +1581,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1573
1581
|
type: "retry";
|
|
1574
1582
|
} & {
|
|
1575
1583
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
1584
|
+
toolCall?: ToolCall;
|
|
1585
|
+
toolResult?: ToolResult;
|
|
1576
1586
|
usage: Usage;
|
|
1577
1587
|
}) | ({
|
|
1578
1588
|
id: string;
|
|
@@ -1759,6 +1769,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
1759
1769
|
type: "retry";
|
|
1760
1770
|
} & {
|
|
1761
1771
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
1772
|
+
toolCall?: ToolCall;
|
|
1773
|
+
toolResult?: ToolResult;
|
|
1762
1774
|
usage: Usage;
|
|
1763
1775
|
}) | ({
|
|
1764
1776
|
id: string;
|
|
@@ -2173,6 +2185,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
2173
2185
|
type: "retry";
|
|
2174
2186
|
} & {
|
|
2175
2187
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
2188
|
+
toolCall?: ToolCall;
|
|
2189
|
+
toolResult?: ToolResult;
|
|
2176
2190
|
usage: Usage;
|
|
2177
2191
|
}) | ({
|
|
2178
2192
|
id: string;
|
|
@@ -2383,6 +2397,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
2383
2397
|
type: "retry";
|
|
2384
2398
|
} & {
|
|
2385
2399
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
2400
|
+
toolCall?: ToolCall;
|
|
2401
|
+
toolResult?: ToolResult;
|
|
2386
2402
|
usage: Usage;
|
|
2387
2403
|
}) | ({
|
|
2388
2404
|
id: string;
|
|
@@ -2562,6 +2578,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
2562
2578
|
type: "retry";
|
|
2563
2579
|
} & {
|
|
2564
2580
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
2581
|
+
toolCall?: ToolCall;
|
|
2582
|
+
toolResult?: ToolResult;
|
|
2565
2583
|
usage: Usage;
|
|
2566
2584
|
}, ({
|
|
2567
2585
|
id: string;
|
|
@@ -2594,6 +2612,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
2594
2612
|
type: "retry";
|
|
2595
2613
|
} & {
|
|
2596
2614
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
2615
|
+
toolCall?: ToolCall;
|
|
2616
|
+
toolResult?: ToolResult;
|
|
2597
2617
|
usage: Usage;
|
|
2598
2618
|
}) | ({
|
|
2599
2619
|
id: string;
|
|
@@ -2802,6 +2822,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
2802
2822
|
type: "retry";
|
|
2803
2823
|
} & {
|
|
2804
2824
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
2825
|
+
toolCall?: ToolCall;
|
|
2826
|
+
toolResult?: ToolResult;
|
|
2805
2827
|
usage: Usage;
|
|
2806
2828
|
}) | ({
|
|
2807
2829
|
id: string;
|
|
@@ -3010,6 +3032,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
3010
3032
|
type: "retry";
|
|
3011
3033
|
} & {
|
|
3012
3034
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
3035
|
+
toolCall?: ToolCall;
|
|
3036
|
+
toolResult?: ToolResult;
|
|
3013
3037
|
usage: Usage;
|
|
3014
3038
|
}) | ({
|
|
3015
3039
|
id: string;
|
|
@@ -3218,6 +3242,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
3218
3242
|
type: "retry";
|
|
3219
3243
|
} & {
|
|
3220
3244
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
3245
|
+
toolCall?: ToolCall;
|
|
3246
|
+
toolResult?: ToolResult;
|
|
3221
3247
|
usage: Usage;
|
|
3222
3248
|
}) | ({
|
|
3223
3249
|
id: string;
|
|
@@ -3428,6 +3454,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
3428
3454
|
type: "retry";
|
|
3429
3455
|
} & {
|
|
3430
3456
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
3457
|
+
toolCall?: ToolCall;
|
|
3458
|
+
toolResult?: ToolResult;
|
|
3431
3459
|
usage: Usage;
|
|
3432
3460
|
}) | ({
|
|
3433
3461
|
id: string;
|
|
@@ -3634,6 +3662,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
3634
3662
|
type: "retry";
|
|
3635
3663
|
} & {
|
|
3636
3664
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
3665
|
+
toolCall?: ToolCall;
|
|
3666
|
+
toolResult?: ToolResult;
|
|
3637
3667
|
usage: Usage;
|
|
3638
3668
|
}) | ({
|
|
3639
3669
|
id: string;
|
|
@@ -3840,6 +3870,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
3840
3870
|
type: "retry";
|
|
3841
3871
|
} & {
|
|
3842
3872
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
3873
|
+
toolCall?: ToolCall;
|
|
3874
|
+
toolResult?: ToolResult;
|
|
3843
3875
|
usage: Usage;
|
|
3844
3876
|
}) | ({
|
|
3845
3877
|
id: string;
|
|
@@ -4046,6 +4078,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
4046
4078
|
type: "retry";
|
|
4047
4079
|
} & {
|
|
4048
4080
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
4081
|
+
toolCall?: ToolCall;
|
|
4082
|
+
toolResult?: ToolResult;
|
|
4049
4083
|
usage: Usage;
|
|
4050
4084
|
}) | ({
|
|
4051
4085
|
id: string;
|
|
@@ -4252,6 +4286,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
4252
4286
|
type: "retry";
|
|
4253
4287
|
} & {
|
|
4254
4288
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
4289
|
+
toolCall?: ToolCall;
|
|
4290
|
+
toolResult?: ToolResult;
|
|
4255
4291
|
usage: Usage;
|
|
4256
4292
|
}) | ({
|
|
4257
4293
|
id: string;
|
|
@@ -4462,6 +4498,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
4462
4498
|
type: "retry";
|
|
4463
4499
|
} & {
|
|
4464
4500
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
4501
|
+
toolCall?: ToolCall;
|
|
4502
|
+
toolResult?: ToolResult;
|
|
4465
4503
|
usage: Usage;
|
|
4466
4504
|
}) | ({
|
|
4467
4505
|
id: string;
|
|
@@ -4672,6 +4710,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
4672
4710
|
type: "retry";
|
|
4673
4711
|
} & {
|
|
4674
4712
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
4713
|
+
toolCall?: ToolCall;
|
|
4714
|
+
toolResult?: ToolResult;
|
|
4675
4715
|
usage: Usage;
|
|
4676
4716
|
}) | ({
|
|
4677
4717
|
id: string;
|
|
@@ -4882,6 +4922,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
4882
4922
|
type: "retry";
|
|
4883
4923
|
} & {
|
|
4884
4924
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
4925
|
+
toolCall?: ToolCall;
|
|
4926
|
+
toolResult?: ToolResult;
|
|
4885
4927
|
usage: Usage;
|
|
4886
4928
|
}) | ({
|
|
4887
4929
|
id: string;
|
|
@@ -5092,6 +5134,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
5092
5134
|
type: "retry";
|
|
5093
5135
|
} & {
|
|
5094
5136
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
5137
|
+
toolCall?: ToolCall;
|
|
5138
|
+
toolResult?: ToolResult;
|
|
5095
5139
|
usage: Usage;
|
|
5096
5140
|
}) | ({
|
|
5097
5141
|
id: string;
|
|
@@ -5271,6 +5315,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
5271
5315
|
type: "retry";
|
|
5272
5316
|
} & {
|
|
5273
5317
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
5318
|
+
toolCall?: ToolCall;
|
|
5319
|
+
toolResult?: ToolResult;
|
|
5274
5320
|
usage: Usage;
|
|
5275
5321
|
}, ({
|
|
5276
5322
|
id: string;
|
|
@@ -5303,6 +5349,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
5303
5349
|
type: "retry";
|
|
5304
5350
|
} & {
|
|
5305
5351
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
5352
|
+
toolCall?: ToolCall;
|
|
5353
|
+
toolResult?: ToolResult;
|
|
5306
5354
|
usage: Usage;
|
|
5307
5355
|
}) | ({
|
|
5308
5356
|
id: string;
|
|
@@ -5512,6 +5560,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
5512
5560
|
type: "retry";
|
|
5513
5561
|
} & {
|
|
5514
5562
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
5563
|
+
toolCall?: ToolCall;
|
|
5564
|
+
toolResult?: ToolResult;
|
|
5515
5565
|
usage: Usage;
|
|
5516
5566
|
}) | ({
|
|
5517
5567
|
id: string;
|
|
@@ -5723,6 +5773,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
5723
5773
|
type: "retry";
|
|
5724
5774
|
} & {
|
|
5725
5775
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
5776
|
+
toolCall?: ToolCall;
|
|
5777
|
+
toolResult?: ToolResult;
|
|
5726
5778
|
usage: Usage;
|
|
5727
5779
|
}) | ({
|
|
5728
5780
|
id: string;
|
|
@@ -5934,6 +5986,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
5934
5986
|
type: "retry";
|
|
5935
5987
|
} & {
|
|
5936
5988
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
5989
|
+
toolCall?: ToolCall;
|
|
5990
|
+
toolResult?: ToolResult;
|
|
5937
5991
|
usage: Usage;
|
|
5938
5992
|
}) | ({
|
|
5939
5993
|
id: string;
|
|
@@ -6146,6 +6200,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
6146
6200
|
type: "retry";
|
|
6147
6201
|
} & {
|
|
6148
6202
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
6203
|
+
toolCall?: ToolCall;
|
|
6204
|
+
toolResult?: ToolResult;
|
|
6149
6205
|
usage: Usage;
|
|
6150
6206
|
}) | ({
|
|
6151
6207
|
id: string;
|
|
@@ -6354,6 +6410,8 @@ declare const runtimeStateMachine: xstate.StateMachine<{
|
|
|
6354
6410
|
type: "retry";
|
|
6355
6411
|
} & {
|
|
6356
6412
|
newMessages: (UserMessage | ExpertMessage | ToolMessage)[];
|
|
6413
|
+
toolCall?: ToolCall;
|
|
6414
|
+
toolResult?: ToolResult;
|
|
6357
6415
|
usage: Usage;
|
|
6358
6416
|
}) | ({
|
|
6359
6417
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { existsSync } from "fs";
|
|
3
3
|
import { mkdir as mkdir2, readFile as readFile4, writeFile as writeFile2 } from "fs/promises";
|
|
4
4
|
import path from "path";
|
|
5
|
-
import { createId as
|
|
5
|
+
import { createId as createId8 } from "@paralleldrive/cuid2";
|
|
6
6
|
import TOML from "smol-toml";
|
|
7
7
|
import { createActor } from "xstate";
|
|
8
8
|
|
|
@@ -466,7 +466,7 @@ async function defaultStoreEvent(event) {
|
|
|
466
466
|
// package.json
|
|
467
467
|
var package_default = {
|
|
468
468
|
name: "@perstack/runtime",
|
|
469
|
-
version: "0.0.
|
|
469
|
+
version: "0.0.22",
|
|
470
470
|
description: "PerStack Runtime",
|
|
471
471
|
author: "Wintermute Technologies, Inc.",
|
|
472
472
|
license: "Apache-2.0",
|
|
@@ -1549,7 +1549,7 @@ async function generatingRunResultLogic({
|
|
|
1549
1549
|
createUserMessage([
|
|
1550
1550
|
{
|
|
1551
1551
|
type: "textPart",
|
|
1552
|
-
text: JSON.stringify({ error: error.name,
|
|
1552
|
+
text: JSON.stringify({ error: error.name, message: error.message })
|
|
1553
1553
|
}
|
|
1554
1554
|
])
|
|
1555
1555
|
],
|
|
@@ -1580,6 +1580,7 @@ async function generatingRunResultLogic({
|
|
|
1580
1580
|
}
|
|
1581
1581
|
|
|
1582
1582
|
// src/states/generating-tool-call.ts
|
|
1583
|
+
import { createId as createId6 } from "@paralleldrive/cuid2";
|
|
1583
1584
|
import { generateText as generateText2 } from "ai";
|
|
1584
1585
|
async function generatingToolCallLogic({
|
|
1585
1586
|
setting,
|
|
@@ -1606,7 +1607,7 @@ async function generatingToolCallLogic({
|
|
|
1606
1607
|
createUserMessage([
|
|
1607
1608
|
{
|
|
1608
1609
|
type: "textPart",
|
|
1609
|
-
text: JSON.stringify({ error: error.name,
|
|
1610
|
+
text: JSON.stringify({ error: error.name, message: error.message })
|
|
1610
1611
|
}
|
|
1611
1612
|
])
|
|
1612
1613
|
],
|
|
@@ -1621,46 +1622,19 @@ async function generatingToolCallLogic({
|
|
|
1621
1622
|
if (!toolCall) {
|
|
1622
1623
|
return retry(setting, checkpoint, {
|
|
1623
1624
|
newMessages: [
|
|
1624
|
-
createExpertMessage(text ? [{ type: "textPart", text }] : []),
|
|
1625
1625
|
createUserMessage([
|
|
1626
1626
|
{
|
|
1627
1627
|
type: "textPart",
|
|
1628
|
-
text:
|
|
1628
|
+
text: JSON.stringify({
|
|
1629
|
+
error: "No tool call generated",
|
|
1630
|
+
message: "You must generate a tool call. Try again."
|
|
1631
|
+
})
|
|
1629
1632
|
}
|
|
1630
1633
|
])
|
|
1631
1634
|
],
|
|
1632
1635
|
usage
|
|
1633
1636
|
});
|
|
1634
1637
|
}
|
|
1635
|
-
if (finishReason !== "tool-calls") {
|
|
1636
|
-
switch (finishReason) {
|
|
1637
|
-
case "length": {
|
|
1638
|
-
return retry(setting, checkpoint, {
|
|
1639
|
-
newMessages: [
|
|
1640
|
-
createExpertMessage([
|
|
1641
|
-
{
|
|
1642
|
-
type: "toolCallPart",
|
|
1643
|
-
toolCallId: toolCall.toolCallId,
|
|
1644
|
-
toolName: toolCall.toolName,
|
|
1645
|
-
args: toolCall.input
|
|
1646
|
-
}
|
|
1647
|
-
]),
|
|
1648
|
-
createToolMessage([
|
|
1649
|
-
{
|
|
1650
|
-
type: "toolResultPart",
|
|
1651
|
-
toolCallId: toolCall.toolCallId,
|
|
1652
|
-
toolName: toolCall.toolName,
|
|
1653
|
-
contents: [{ type: "textPart", text: "Error: Generation length exceeded" }]
|
|
1654
|
-
}
|
|
1655
|
-
])
|
|
1656
|
-
],
|
|
1657
|
-
usage
|
|
1658
|
-
});
|
|
1659
|
-
}
|
|
1660
|
-
default:
|
|
1661
|
-
throw new Error(`Unexpected finish reason: ${finishReason}`);
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
1638
|
const contents = [
|
|
1665
1639
|
{
|
|
1666
1640
|
type: "toolCallPart",
|
|
@@ -1686,18 +1660,51 @@ async function generatingToolCallLogic({
|
|
|
1686
1660
|
},
|
|
1687
1661
|
usage
|
|
1688
1662
|
};
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1663
|
+
if (finishReason === "tool-calls") {
|
|
1664
|
+
switch (skillManager.type) {
|
|
1665
|
+
case "mcp":
|
|
1666
|
+
return callTool(setting, checkpoint, eventPayload);
|
|
1667
|
+
case "interactive":
|
|
1668
|
+
return callInteractiveTool(setting, checkpoint, eventPayload);
|
|
1669
|
+
case "delegate":
|
|
1670
|
+
return callDelegate(setting, checkpoint, eventPayload);
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
if (finishReason === "length") {
|
|
1674
|
+
return retry(setting, checkpoint, {
|
|
1675
|
+
newMessages: [
|
|
1676
|
+
createExpertMessage([
|
|
1677
|
+
{
|
|
1678
|
+
type: "toolCallPart",
|
|
1679
|
+
toolCallId: toolCall.toolCallId,
|
|
1680
|
+
toolName: toolCall.toolName,
|
|
1681
|
+
args: toolCall.input
|
|
1682
|
+
}
|
|
1683
|
+
]),
|
|
1684
|
+
createToolMessage([
|
|
1685
|
+
{
|
|
1686
|
+
type: "toolResultPart",
|
|
1687
|
+
toolCallId: toolCall.toolCallId,
|
|
1688
|
+
toolName: toolCall.toolName,
|
|
1689
|
+
contents: [{ type: "textPart", text: "Error: Generation length exceeded" }]
|
|
1690
|
+
}
|
|
1691
|
+
])
|
|
1692
|
+
],
|
|
1693
|
+
toolCall: eventPayload.toolCall,
|
|
1694
|
+
toolResult: {
|
|
1695
|
+
id: toolCall.toolCallId,
|
|
1696
|
+
skillName: skillManager.name,
|
|
1697
|
+
toolName: toolCall.toolName,
|
|
1698
|
+
result: [{ type: "textPart", id: createId6(), text: "Error: Generation length exceeded" }]
|
|
1699
|
+
},
|
|
1700
|
+
usage
|
|
1701
|
+
});
|
|
1696
1702
|
}
|
|
1703
|
+
throw new Error(`Unexpected finish reason: ${finishReason}`);
|
|
1697
1704
|
}
|
|
1698
1705
|
|
|
1699
1706
|
// src/messages/instruction-message.ts
|
|
1700
|
-
import { createId as
|
|
1707
|
+
import { createId as createId7 } from "@paralleldrive/cuid2";
|
|
1701
1708
|
import { dedent as dedent2 } from "ts-dedent";
|
|
1702
1709
|
var metaInstruction = dedent2`
|
|
1703
1710
|
IMPORTANT:
|
|
@@ -1771,12 +1778,12 @@ function createInstructionMessage(expert, experts) {
|
|
|
1771
1778
|
type: "instructionMessage",
|
|
1772
1779
|
contents: [
|
|
1773
1780
|
{
|
|
1774
|
-
id:
|
|
1781
|
+
id: createId7(),
|
|
1775
1782
|
type: "textPart",
|
|
1776
1783
|
text: instruction
|
|
1777
1784
|
}
|
|
1778
1785
|
],
|
|
1779
|
-
id:
|
|
1786
|
+
id: createId7(),
|
|
1780
1787
|
cache: true
|
|
1781
1788
|
};
|
|
1782
1789
|
}
|
|
@@ -2098,6 +2105,8 @@ var runtimeStateMachine = setup({
|
|
|
2098
2105
|
step: ({ context, event }) => ({
|
|
2099
2106
|
...context.step,
|
|
2100
2107
|
newMessages: event.newMessages,
|
|
2108
|
+
toolCall: event.toolCall,
|
|
2109
|
+
toolResult: event.toolResult,
|
|
2101
2110
|
usage: sumUsage(context.step.usage, event.usage)
|
|
2102
2111
|
})
|
|
2103
2112
|
})
|
|
@@ -2282,6 +2291,8 @@ var runtimeStateMachine = setup({
|
|
|
2282
2291
|
step: ({ context, event }) => ({
|
|
2283
2292
|
...context.step,
|
|
2284
2293
|
newMessages: event.newMessages,
|
|
2294
|
+
toolCall: event.toolCall,
|
|
2295
|
+
toolResult: event.toolResult,
|
|
2285
2296
|
usage: sumUsage(context.step.usage, event.usage)
|
|
2286
2297
|
})
|
|
2287
2298
|
})
|
|
@@ -2449,10 +2460,10 @@ async function run(runInput, options) {
|
|
|
2449
2460
|
},
|
|
2450
2461
|
initialCheckpoint: checkpoint ? {
|
|
2451
2462
|
...checkpoint,
|
|
2452
|
-
id:
|
|
2463
|
+
id: createId8(),
|
|
2453
2464
|
stepNumber: checkpoint.stepNumber + 1
|
|
2454
2465
|
} : {
|
|
2455
|
-
id:
|
|
2466
|
+
id: createId8(),
|
|
2456
2467
|
runId: setting.runId,
|
|
2457
2468
|
expert: {
|
|
2458
2469
|
key: setting.expertKey,
|