@perstack/runtime 0.0.61 → 0.0.62
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 +16 -17
- package/dist/src/index.d.ts +376 -355
- package/dist/src/index.js +379 -290
- package/dist/src/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ The `eventListener` callback receives a `RunEvent` object, which provides granul
|
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
42
|
type RunEvent = {
|
|
43
|
-
type: EventType // e.g., "startRun", "
|
|
43
|
+
type: EventType // e.g., "startRun", "callTools"
|
|
44
44
|
id: string // Unique event ID
|
|
45
45
|
timestamp: number // Unix timestamp
|
|
46
46
|
runId: string // ID of the current run
|
|
@@ -53,9 +53,9 @@ You can narrow down the event type to access specific properties:
|
|
|
53
53
|
|
|
54
54
|
```typescript
|
|
55
55
|
eventListener: (event) => {
|
|
56
|
-
if (event.type === "
|
|
57
|
-
// event is now narrowed to the
|
|
58
|
-
console.log(`Executing
|
|
56
|
+
if (event.type === "callTools") {
|
|
57
|
+
// event is now narrowed to the callTools event type
|
|
58
|
+
console.log(`Executing ${event.toolCalls.length} tools`)
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
```
|
|
@@ -185,22 +185,20 @@ stateDiagram-v2
|
|
|
185
185
|
[*] --> Init
|
|
186
186
|
Init --> PreparingForStep: startRun
|
|
187
187
|
PreparingForStep --> GeneratingToolCall: startGeneration
|
|
188
|
+
PreparingForStep --> CallingTools: resumeToolCalls
|
|
189
|
+
PreparingForStep --> FinishingStep: finishAllToolCalls
|
|
188
190
|
|
|
189
|
-
GeneratingToolCall -->
|
|
190
|
-
GeneratingToolCall --> CallingInteractiveTool: callInteractiveTool
|
|
191
|
-
GeneratingToolCall --> CallingDelegate: callDelegate
|
|
191
|
+
GeneratingToolCall --> CallingTools: callTools
|
|
192
192
|
GeneratingToolCall --> FinishingStep: retry
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
CallingTools --> ResolvingToolResults: resolveToolResults
|
|
195
|
+
CallingTools --> ResolvingThought: resolveThought
|
|
196
|
+
CallingTools --> GeneratingRunResult: attemptCompletion
|
|
197
|
+
CallingTools --> CallingDelegate: callDelegate
|
|
198
|
+
CallingTools --> CallingInteractiveTool: callInteractiveTool
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
ResolvingToolResults --> FinishingStep: finishToolCall
|
|
201
201
|
ResolvingThought --> FinishingStep: finishToolCall
|
|
202
|
-
ResolvingPdfFile --> FinishingStep: finishToolCall
|
|
203
|
-
ResolvingImageFile --> FinishingStep: finishToolCall
|
|
204
202
|
|
|
205
203
|
GeneratingRunResult --> Stopped: completeRun
|
|
206
204
|
GeneratingRunResult --> FinishingStep: retry
|
|
@@ -216,8 +214,9 @@ stateDiagram-v2
|
|
|
216
214
|
Events trigger state transitions. They are emitted by the runtime logic or external inputs.
|
|
217
215
|
|
|
218
216
|
- **Lifecycle**: `startRun`, `startGeneration`, `continueToNextStep`, `completeRun`
|
|
219
|
-
- **Tool Execution**: `
|
|
220
|
-
- **Special Types**: `resolveThought
|
|
217
|
+
- **Tool Execution**: `callTools`, `resolveToolResults`, `finishToolCall`, `resumeToolCalls`, `finishAllToolCalls`
|
|
218
|
+
- **Special Types**: `resolveThought`
|
|
219
|
+
- **Mixed Tool Calls**: `callDelegate`, `callInteractiveTool` (from CallingTools state)
|
|
221
220
|
- **Interruption**: `stopRunByInteractiveTool`, `stopRunByDelegate`, `stopRunByExceededMaxSteps`
|
|
222
221
|
- **Error Handling**: `retry`
|
|
223
222
|
|