@perstack/react 0.0.58 → 0.0.60

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 (45) hide show
  1. package/dist/src/index.d.ts +156 -3
  2. package/dist/src/index.js +660 -4
  3. package/dist/src/index.js.map +1 -1
  4. package/package.json +14 -17
  5. package/dist/src/hooks/index.d.ts +0 -4
  6. package/dist/src/hooks/index.d.ts.map +0 -1
  7. package/dist/src/hooks/index.js +0 -4
  8. package/dist/src/hooks/index.js.map +0 -1
  9. package/dist/src/hooks/use-job-stream.d.ts +0 -17
  10. package/dist/src/hooks/use-job-stream.d.ts.map +0 -1
  11. package/dist/src/hooks/use-job-stream.js +0 -45
  12. package/dist/src/hooks/use-job-stream.js.map +0 -1
  13. package/dist/src/hooks/use-job-streams.d.ts +0 -14
  14. package/dist/src/hooks/use-job-streams.d.ts.map +0 -1
  15. package/dist/src/hooks/use-job-streams.js +0 -89
  16. package/dist/src/hooks/use-job-streams.js.map +0 -1
  17. package/dist/src/hooks/use-run.d.ts +0 -38
  18. package/dist/src/hooks/use-run.d.ts.map +0 -1
  19. package/dist/src/hooks/use-run.js +0 -200
  20. package/dist/src/hooks/use-run.js.map +0 -1
  21. package/dist/src/index.d.ts.map +0 -1
  22. package/dist/src/types/index.d.ts +0 -2
  23. package/dist/src/types/index.d.ts.map +0 -1
  24. package/dist/src/types/index.js +0 -2
  25. package/dist/src/types/index.js.map +0 -1
  26. package/dist/src/types/runtime-state.d.ts +0 -19
  27. package/dist/src/types/runtime-state.d.ts.map +0 -1
  28. package/dist/src/types/runtime-state.js +0 -2
  29. package/dist/src/types/runtime-state.js.map +0 -1
  30. package/dist/src/utils/event-to-activity.d.ts +0 -67
  31. package/dist/src/utils/event-to-activity.d.ts.map +0 -1
  32. package/dist/src/utils/event-to-activity.js +0 -337
  33. package/dist/src/utils/event-to-activity.js.map +0 -1
  34. package/dist/src/utils/group-by-run.d.ts +0 -24
  35. package/dist/src/utils/group-by-run.d.ts.map +0 -1
  36. package/dist/src/utils/group-by-run.js +0 -43
  37. package/dist/src/utils/group-by-run.js.map +0 -1
  38. package/dist/src/utils/index.d.ts +0 -4
  39. package/dist/src/utils/index.d.ts.map +0 -1
  40. package/dist/src/utils/index.js +0 -4
  41. package/dist/src/utils/index.js.map +0 -1
  42. package/dist/src/utils/stream.d.ts +0 -13
  43. package/dist/src/utils/stream.d.ts.map +0 -1
  44. package/dist/src/utils/stream.js +0 -18
  45. package/dist/src/utils/stream.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
@@ -1,19 +0,0 @@
1
- /** Per-run streaming state for real-time display */
2
- export type PerRunStreamingState = {
3
- /** Expert key for this run */
4
- expertKey: string;
5
- /** Accumulated reasoning text during extended thinking */
6
- reasoning?: string;
7
- /** Accumulated run result text during generation */
8
- runResult?: string;
9
- /** Whether reasoning is currently streaming */
10
- isReasoningActive?: boolean;
11
- /** Whether run result is currently streaming */
12
- isRunResultActive?: boolean;
13
- };
14
- /** Streaming state organized by run ID to support parallel execution */
15
- export type StreamingState = {
16
- /** Per-run streaming state, keyed by runId */
17
- runs: Record<string, PerRunStreamingState>;
18
- };
19
- //# sourceMappingURL=runtime-state.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-state.d.ts","sourceRoot":"","sources":["../../../src/types/runtime-state.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,MAAM,oBAAoB,GAAG;IACjC,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG;IAC3B,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;CAC3C,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=runtime-state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-state.js","sourceRoot":"","sources":["../../../src/types/runtime-state.ts"],"names":[],"mappings":""}
@@ -1,67 +0,0 @@
1
- import type { Activity, ActivityOrGroup, PerstackEvent, ToolCall, ToolResult } from "@perstack/core";
2
- /**
3
- * Converts a tool call and result to an Activity.
4
- * Delegates to core's createBaseToolActivity/createGeneralToolActivity to avoid duplication.
5
- */
6
- export declare function toolToActivity(toolCall: ToolCall, toolResult: ToolResult, reasoning: string | undefined, meta: {
7
- id: string;
8
- expertKey: string;
9
- runId: string;
10
- previousActivityId?: string;
11
- delegatedBy?: {
12
- expertKey: string;
13
- runId: string;
14
- };
15
- }): Activity;
16
- type ToolState = {
17
- id: string;
18
- toolCall: ToolCall;
19
- logged: boolean;
20
- };
21
- /**
22
- * Per-run state to support parallel execution.
23
- * Each run maintains its own independent state.
24
- */
25
- type RunState = {
26
- expertKey: string;
27
- queryLogged: boolean;
28
- completionLogged: boolean;
29
- isComplete: boolean;
30
- completedReasoning?: string;
31
- lastActivityId?: string;
32
- delegatedBy?: {
33
- expertKey: string;
34
- runId: string;
35
- };
36
- /** Track if this run has pending delegate tool calls (for delegation complete detection) */
37
- pendingDelegateCount: number;
38
- };
39
- /**
40
- * State for processing RunEvent stream into Activity[].
41
- * This state tracks tool calls and their results to create complete Activity items.
42
- *
43
- * Supports the daisy chain architecture:
44
- * - Within-Run ordering via lastActivityId (per-run state)
45
- * - Cross-Run ordering via delegatedBy (per-run state)
46
- *
47
- * Note: `tools` is NOT cleared on new run to support delegation results
48
- * that arrive after parent expert resumes with a new runId.
49
- */
50
- export type ActivityProcessState = {
51
- /** Tool calls indexed by toolCallId - persisted across runs for delegation handling */
52
- tools: Map<string, ToolState>;
53
- /** Per-run state to support parallel execution */
54
- runStates: Map<string, RunState>;
55
- };
56
- export declare function createInitialActivityProcessState(): ActivityProcessState;
57
- /**
58
- * Processes a RunEvent and produces Activity or ParallelActivitiesGroup items.
59
- * Only processes RunEvent (state machine transitions), not RuntimeEvent.
60
- *
61
- * @param state - Mutable processing state
62
- * @param event - The event to process
63
- * @param addActivity - Callback to add a new Activity or ParallelActivitiesGroup
64
- */
65
- export declare function processRunEventToActivity(state: ActivityProcessState, event: PerstackEvent, addActivity: (activity: ActivityOrGroup) => void): void;
66
- export {};
67
- //# sourceMappingURL=event-to-activity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-to-activity.d.ts","sourceRoot":"","sources":["../../../src/utils/event-to-activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EAEf,aAAa,EAEb,QAAQ,EACR,UAAU,EACX,MAAM,gBAAgB,CAAA;AAOvB;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,IAAI,EAAE;IACJ,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CACnD,GACA,QAAQ,CAgBV;AAED,KAAK,SAAS,GAAG;IACf,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;CAChB,CAAA;AAED;;;GAGG;AACH,KAAK,QAAQ,GAAG;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,OAAO,CAAA;IACpB,gBAAgB,EAAE,OAAO,CAAA;IACzB,UAAU,EAAE,OAAO,CAAA;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE;QACZ,SAAS,EAAE,MAAM,CAAA;QACjB,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD,4FAA4F;IAC5F,oBAAoB,EAAE,MAAM,CAAA;CAC7B,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,uFAAuF;IACvF,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC7B,kDAAkD;IAClD,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;CACjC,CAAA;AAED,wBAAgB,iCAAiC,IAAI,oBAAoB,CAKxE;AA2FD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,oBAAoB,EAC3B,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,GAC/C,IAAI,CAsSN"}
@@ -1,337 +0,0 @@
1
- import { BASE_SKILL_PREFIX, createBaseToolActivity, createGeneralToolActivity, } from "@perstack/core";
2
- /**
3
- * Converts a tool call and result to an Activity.
4
- * Delegates to core's createBaseToolActivity/createGeneralToolActivity to avoid duplication.
5
- */
6
- export function toolToActivity(toolCall, toolResult, reasoning, meta) {
7
- const { skillName, toolName } = toolCall;
8
- const baseActivity = skillName.startsWith(BASE_SKILL_PREFIX)
9
- ? createBaseToolActivity(toolName, toolCall, toolResult, reasoning)
10
- : createGeneralToolActivity(skillName, toolName, toolCall, toolResult, reasoning);
11
- // Override the base fields with the correct metadata
12
- return {
13
- ...baseActivity,
14
- id: meta.id,
15
- expertKey: meta.expertKey,
16
- runId: meta.runId,
17
- previousActivityId: meta.previousActivityId,
18
- delegatedBy: meta.delegatedBy,
19
- };
20
- }
21
- export function createInitialActivityProcessState() {
22
- return {
23
- tools: new Map(),
24
- runStates: new Map(),
25
- };
26
- }
27
- function getOrCreateRunState(state, runId, expertKey) {
28
- let runState = state.runStates.get(runId);
29
- if (!runState) {
30
- runState = {
31
- expertKey,
32
- queryLogged: false,
33
- completionLogged: false,
34
- isComplete: false,
35
- pendingDelegateCount: 0,
36
- };
37
- state.runStates.set(runId, runState);
38
- }
39
- return runState;
40
- }
41
- const isRunEvent = (event) => "type" in event && "expertKey" in event;
42
- const isCompleteStreamingReasoningEvent = (event) => "type" in event && event.type === "completeStreamingReasoning";
43
- const isToolCallsEvent = (event) => event.type === "callTools" && "toolCalls" in event;
44
- const isStopRunByDelegateEvent = (event) => event.type === "stopRunByDelegate" && "checkpoint" in event;
45
- const isStopRunByInteractiveToolEvent = (event) => event.type === "stopRunByInteractiveTool" && "checkpoint" in event;
46
- const isToolResultsEvent = (event) => event.type === "resolveToolResults" && "toolResults" in event;
47
- /**
48
- * Wraps multiple activities in a ParallelActivitiesGroup with shared reasoning.
49
- * If only one activity, returns it directly.
50
- */
51
- function wrapInGroupIfParallel(activities, reasoning, meta) {
52
- if (activities.length <= 1) {
53
- return activities;
54
- }
55
- // Remove reasoning from individual activities since it's on the group
56
- const activitiesWithoutReasoning = activities.map((a) => {
57
- const { reasoning: _, ...rest } = a;
58
- return rest;
59
- });
60
- const group = {
61
- type: "parallelGroup",
62
- id: `parallel-${activities[0].id}`,
63
- expertKey: meta.expertKey,
64
- runId: meta.runId,
65
- reasoning,
66
- activities: activitiesWithoutReasoning,
67
- };
68
- return [group];
69
- }
70
- /**
71
- * Processes a RunEvent and produces Activity or ParallelActivitiesGroup items.
72
- * Only processes RunEvent (state machine transitions), not RuntimeEvent.
73
- *
74
- * @param state - Mutable processing state
75
- * @param event - The event to process
76
- * @param addActivity - Callback to add a new Activity or ParallelActivitiesGroup
77
- */
78
- export function processRunEventToActivity(state, event, addActivity) {
79
- if (isCompleteStreamingReasoningEvent(event)) {
80
- const reasoningEvent = event;
81
- const { runId, text, expertKey } = reasoningEvent;
82
- const runState = state.runStates.get(runId);
83
- if (runState) {
84
- runState.completedReasoning = text;
85
- }
86
- else {
87
- state.runStates.set(runId, {
88
- expertKey,
89
- queryLogged: false,
90
- completionLogged: false,
91
- isComplete: false,
92
- pendingDelegateCount: 0,
93
- completedReasoning: text,
94
- });
95
- }
96
- return;
97
- }
98
- if (!isRunEvent(event)) {
99
- return;
100
- }
101
- const runState = getOrCreateRunState(state, event.runId, event.expertKey);
102
- // Handle startRun - extract query from inputMessages and delegatedBy
103
- if (event.type === "startRun") {
104
- const startRunEvent = event;
105
- const userMessage = startRunEvent.inputMessages.find((m) => m.type === "userMessage");
106
- const queryText = userMessage?.contents?.find((c) => c.type === "textPart")?.text;
107
- // Extract delegatedBy from initialCheckpoint (only on first startRun for this runId)
108
- if (!runState.delegatedBy) {
109
- const delegatedByInfo = startRunEvent.initialCheckpoint?.delegatedBy;
110
- if (delegatedByInfo) {
111
- runState.delegatedBy = {
112
- expertKey: delegatedByInfo.expert.key,
113
- runId: delegatedByInfo.runId,
114
- };
115
- }
116
- }
117
- // Check if this is a delegation return (parent expert resuming after delegation)
118
- // In this case, don't log the query again as it was already logged in the original run
119
- const isDelegationReturn = startRunEvent.initialCheckpoint?.status === "stoppedByDelegate" ||
120
- startRunEvent.initialCheckpoint?.status === "stoppedByInteractiveTool";
121
- if (queryText && !runState.queryLogged && !isDelegationReturn) {
122
- const activityId = `query-${event.runId}`;
123
- addActivity({
124
- type: "query",
125
- id: activityId,
126
- expertKey: event.expertKey,
127
- runId: event.runId,
128
- previousActivityId: runState.lastActivityId,
129
- delegatedBy: runState.delegatedBy,
130
- text: queryText,
131
- });
132
- runState.lastActivityId = activityId;
133
- runState.queryLogged = true;
134
- }
135
- return;
136
- }
137
- // Handle resumeFromStop - extract delegatedBy from checkpoint for delegation return
138
- if (event.type === "resumeFromStop") {
139
- // Extract delegatedBy from checkpoint (only on first resumeFromStop for this runId)
140
- if (!runState.delegatedBy) {
141
- const resumeEvent = event;
142
- const delegatedByInfo = resumeEvent.checkpoint?.delegatedBy;
143
- if (delegatedByInfo) {
144
- runState.delegatedBy = {
145
- expertKey: delegatedByInfo.expert.key,
146
- runId: delegatedByInfo.runId,
147
- };
148
- }
149
- }
150
- return;
151
- }
152
- // Handle retry
153
- if (event.type === "retry") {
154
- const retryEvent = event;
155
- const activityId = `retry-${event.id}`;
156
- addActivity({
157
- type: "retry",
158
- id: activityId,
159
- expertKey: event.expertKey,
160
- runId: event.runId,
161
- previousActivityId: runState.lastActivityId,
162
- delegatedBy: runState.delegatedBy,
163
- reasoning: runState.completedReasoning,
164
- error: retryEvent.reason,
165
- message: "",
166
- });
167
- runState.lastActivityId = activityId;
168
- runState.completedReasoning = undefined;
169
- return;
170
- }
171
- // Handle completion
172
- if (event.type === "completeRun") {
173
- if (!runState.completionLogged) {
174
- const text = event.text ?? "";
175
- const activityId = `completion-${event.runId}`;
176
- addActivity({
177
- type: "complete",
178
- id: activityId,
179
- expertKey: event.expertKey,
180
- runId: event.runId,
181
- previousActivityId: runState.lastActivityId,
182
- delegatedBy: runState.delegatedBy,
183
- reasoning: runState.completedReasoning,
184
- text,
185
- });
186
- runState.lastActivityId = activityId;
187
- runState.completionLogged = true;
188
- runState.isComplete = true;
189
- runState.completedReasoning = undefined;
190
- }
191
- return;
192
- }
193
- // Handle error
194
- if (event.type === "stopRunByError") {
195
- const errorEvent = event;
196
- const activityId = `error-${event.id}`;
197
- addActivity({
198
- type: "error",
199
- id: activityId,
200
- expertKey: event.expertKey,
201
- runId: event.runId,
202
- previousActivityId: runState.lastActivityId,
203
- delegatedBy: runState.delegatedBy,
204
- errorName: errorEvent.error.name,
205
- error: errorEvent.error.message,
206
- isRetryable: errorEvent.error.isRetryable,
207
- });
208
- runState.lastActivityId = activityId;
209
- runState.isComplete = true;
210
- runState.completedReasoning = undefined;
211
- return;
212
- }
213
- // Track tool calls from callTools event
214
- if (isToolCallsEvent(event)) {
215
- for (const toolCall of event.toolCalls) {
216
- if (!state.tools.has(toolCall.id)) {
217
- state.tools.set(toolCall.id, { id: toolCall.id, toolCall, logged: false });
218
- }
219
- }
220
- }
221
- // Handle stopRunByDelegate - log delegation activities
222
- if (isStopRunByDelegateEvent(event)) {
223
- const reasoning = runState.completedReasoning;
224
- const delegations = event.checkpoint.delegateTo ?? [];
225
- runState.pendingDelegateCount += delegations.length;
226
- const delegateActivities = [];
227
- for (const delegation of delegations) {
228
- const existingTool = state.tools.get(delegation.toolCallId);
229
- if (!existingTool || !existingTool.logged) {
230
- // Mark as logged if exists
231
- if (existingTool) {
232
- existingTool.logged = true;
233
- }
234
- const activityId = `delegate-${delegation.toolCallId}`;
235
- delegateActivities.push({
236
- type: "delegate",
237
- id: activityId,
238
- expertKey: event.expertKey,
239
- runId: event.runId,
240
- previousActivityId: runState.lastActivityId,
241
- delegatedBy: runState.delegatedBy,
242
- delegateExpertKey: delegation.expert.key,
243
- query: delegation.query,
244
- reasoning,
245
- });
246
- runState.lastActivityId = activityId;
247
- }
248
- }
249
- // Wrap in group if multiple delegations
250
- const wrapped = wrapInGroupIfParallel(delegateActivities, reasoning, {
251
- expertKey: event.expertKey,
252
- runId: event.runId,
253
- delegatedBy: runState.delegatedBy,
254
- });
255
- for (const item of wrapped) {
256
- addActivity(item);
257
- }
258
- // Clear reasoning after delegation activities are logged
259
- runState.completedReasoning = undefined;
260
- return;
261
- }
262
- // Handle stopRunByInteractiveTool - log interactive tool activities
263
- if (isStopRunByInteractiveToolEvent(event)) {
264
- const reasoning = runState.completedReasoning;
265
- const pendingToolCalls = event.checkpoint.pendingToolCalls ?? [];
266
- const interactiveActivities = [];
267
- for (const toolCall of pendingToolCalls) {
268
- const existingTool = state.tools.get(toolCall.id);
269
- if (!existingTool || !existingTool.logged) {
270
- // Mark as logged if exists
271
- if (existingTool) {
272
- existingTool.logged = true;
273
- }
274
- const activityId = `interactive-${toolCall.id}`;
275
- interactiveActivities.push({
276
- type: "interactiveTool",
277
- id: activityId,
278
- expertKey: event.expertKey,
279
- runId: event.runId,
280
- previousActivityId: runState.lastActivityId,
281
- delegatedBy: runState.delegatedBy,
282
- skillName: toolCall.skillName,
283
- toolName: toolCall.toolName,
284
- args: toolCall.args,
285
- reasoning,
286
- });
287
- runState.lastActivityId = activityId;
288
- }
289
- }
290
- // Wrap in group if multiple interactive tools
291
- const wrapped = wrapInGroupIfParallel(interactiveActivities, reasoning, {
292
- expertKey: event.expertKey,
293
- runId: event.runId,
294
- delegatedBy: runState.delegatedBy,
295
- });
296
- for (const item of wrapped) {
297
- addActivity(item);
298
- }
299
- // Clear reasoning after interactive tool activities are logged
300
- runState.completedReasoning = undefined;
301
- return;
302
- }
303
- // Process tool results
304
- if (isToolResultsEvent(event)) {
305
- const reasoning = runState.completedReasoning;
306
- const toolActivities = [];
307
- for (const toolResult of event.toolResults) {
308
- const tool = state.tools.get(toolResult.id);
309
- if (tool && !tool.logged) {
310
- const activityId = `action-${tool.id}`;
311
- const activity = toolToActivity(tool.toolCall, toolResult, reasoning, {
312
- id: activityId,
313
- expertKey: event.expertKey,
314
- runId: event.runId,
315
- previousActivityId: runState.lastActivityId,
316
- delegatedBy: runState.delegatedBy,
317
- });
318
- toolActivities.push(activity);
319
- runState.lastActivityId = activityId;
320
- tool.logged = true;
321
- }
322
- }
323
- if (toolActivities.length > 0) {
324
- // Wrap in group if multiple tool results
325
- const wrapped = wrapInGroupIfParallel(toolActivities, reasoning, {
326
- expertKey: event.expertKey,
327
- runId: event.runId,
328
- delegatedBy: runState.delegatedBy,
329
- });
330
- for (const item of wrapped) {
331
- addActivity(item);
332
- }
333
- runState.completedReasoning = undefined;
334
- }
335
- }
336
- }
337
- //# sourceMappingURL=event-to-activity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-to-activity.js","sourceRoot":"","sources":["../../../src/utils/event-to-activity.ts"],"names":[],"mappings":"AASA,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,gBAA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AAG,UAAU,IAAI,CAAC,EAAE,EAAE,CAAA;gBACtC,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE;oBACpE,EAAE,EAAE,UAAU;oBACd,SAAS,EAAE,KAAK,CAAC,SAAS;oBAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,kBAAkB,EAAE,QAAQ,CAAC,cAAc;oBAC3C,WAAW,EAAE,QAAQ,CAAC,WAAW;iBAClC,CAAC,CAAA;gBACF,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;gBAC7B,QAAQ,CAAC,cAAc,GAAG,UAAU,CAAA;gBACpC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;YACpB,CAAC;QACH,CAAC;QAED,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,yCAAyC;YACzC,MAAM,OAAO,GAAG,qBAAqB,CAAC,cAAc,EAAE,SAAS,EAAE;gBAC/D,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,WAAW,EAAE,QAAQ,CAAC,WAAW;aAClC,CAAC,CAAA;YACF,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;gBAC3B,WAAW,CAAC,IAAI,CAAC,CAAA;YACnB,CAAC;YACD,QAAQ,CAAC,kBAAkB,GAAG,SAAS,CAAA;QACzC,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,24 +0,0 @@
1
- import type { ActivityOrGroup } from "@perstack/core";
2
- /**
3
- * Represents a group of activities belonging to the same run
4
- */
5
- export type RunGroup = {
6
- runId: string;
7
- expertKey: string;
8
- activities: ActivityOrGroup[];
9
- delegatedBy?: {
10
- expertKey: string;
11
- runId: string;
12
- };
13
- };
14
- /**
15
- * Groups activities by their runId while preserving order.
16
- *
17
- * This function groups activities so that each run can be displayed in its own
18
- * visual section (e.g., separate <Static> components in Ink).
19
- *
20
- * @param activities - Array of activities or groups to group
21
- * @returns Array of RunGroup objects, ordered by first appearance
22
- */
23
- export declare function groupActivitiesByRun(activities: ActivityOrGroup[]): RunGroup[];
24
- //# sourceMappingURL=group-by-run.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"group-by-run.d.ts","sourceRoot":"","sources":["../../../src/utils/group-by-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,eAAe,EAAE,CAAA;IAC7B,WAAW,CAAC,EAAE;QACZ,SAAS,EAAE,MAAM,CAAA;QACjB,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF,CAAA;AAqBD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,QAAQ,EAAE,CAsB9E"}
@@ -1,43 +0,0 @@
1
- /**
2
- * Extract base properties from ActivityOrGroup for grouping.
3
- */
4
- function getActivityProps(activityOrGroup) {
5
- if (activityOrGroup.type === "parallelGroup") {
6
- const firstActivity = activityOrGroup.activities[0];
7
- return {
8
- runId: activityOrGroup.runId,
9
- expertKey: activityOrGroup.expertKey,
10
- delegatedBy: firstActivity?.delegatedBy,
11
- };
12
- }
13
- return activityOrGroup;
14
- }
15
- /**
16
- * Groups activities by their runId while preserving order.
17
- *
18
- * This function groups activities so that each run can be displayed in its own
19
- * visual section (e.g., separate <Static> components in Ink).
20
- *
21
- * @param activities - Array of activities or groups to group
22
- * @returns Array of RunGroup objects, ordered by first appearance
23
- */
24
- export function groupActivitiesByRun(activities) {
25
- const groupMap = new Map();
26
- const order = [];
27
- for (const activityOrGroup of activities) {
28
- const { runId, expertKey, delegatedBy } = getActivityProps(activityOrGroup);
29
- if (!groupMap.has(runId)) {
30
- groupMap.set(runId, {
31
- runId,
32
- expertKey,
33
- activities: [],
34
- delegatedBy,
35
- });
36
- order.push(runId);
37
- }
38
- const group = groupMap.get(runId);
39
- group.activities.push(activityOrGroup);
40
- }
41
- return order.map((runId) => groupMap.get(runId));
42
- }
43
- //# sourceMappingURL=group-by-run.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"group-by-run.js","sourceRoot":"","sources":["../../../src/utils/group-by-run.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,SAAS,gBAAgB,CAAC,eAAgC;IAKxD,IAAI,eAAe,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QAC7C,MAAM,aAAa,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QACnD,OAAO;YACL,KAAK,EAAE,eAAe,CAAC,KAAK;YAC5B,SAAS,EAAE,eAAe,CAAC,SAAS;YACpC,WAAW,EAAE,aAAa,EAAE,WAAW;SACxC,CAAA;IACH,CAAC;IACD,OAAO,eAAe,CAAA;AACxB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAA6B;IAChE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAA;IAC5C,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,KAAK,MAAM,eAAe,IAAI,UAAU,EAAE,CAAC;QACzC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAA;QAE3E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE;gBAClB,KAAK;gBACL,SAAS;gBACT,UAAU,EAAE,EAAE;gBACd,WAAW;aACZ,CAAC,CAAA;YACF,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnB,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAE,CAAA;QAClC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;IACxC,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC,CAAA;AACnD,CAAC"}
@@ -1,4 +0,0 @@
1
- export { type ActivityProcessState, createInitialActivityProcessState, processRunEventToActivity, toolToActivity, } from "./event-to-activity.js";
2
- export { groupActivitiesByRun, type RunGroup } from "./group-by-run.js";
3
- export { consumeStream, isAbortError, type StreamConnector } from "./stream.js";
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,iCAAiC,EACjC,yBAAyB,EACzB,cAAc,GACf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,oBAAoB,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA"}
@@ -1,4 +0,0 @@
1
- export { createInitialActivityProcessState, processRunEventToActivity, toolToActivity, } from "./event-to-activity.js";
2
- export { groupActivitiesByRun } from "./group-by-run.js";
3
- export { consumeStream, isAbortError } from "./stream.js";
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iCAAiC,EACjC,yBAAyB,EACzB,cAAc,GACf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,oBAAoB,EAAiB,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAwB,MAAM,aAAa,CAAA"}
@@ -1,13 +0,0 @@
1
- import type { PerstackEvent } from "@perstack/core";
2
- export type StreamConnector = (jobId: string, signal: AbortSignal) => Promise<AsyncIterable<PerstackEvent>>;
3
- export declare const isAbortError: (err: unknown) => boolean;
4
- /**
5
- * Consumes an SSE stream with abort-safe iteration and error normalization.
6
- *
7
- * Handles the connection lifecycle shared by all streaming hooks:
8
- * 1. Calls `connect` to obtain an async iterable
9
- * 2. Iterates events, stopping on signal abort
10
- * 3. Filters out AbortError (normal cleanup), surfaces all others
11
- */
12
- export declare function consumeStream(connect: StreamConnector, jobId: string, signal: AbortSignal, onEvent: (event: PerstackEvent) => void): Promise<void>;
13
- //# sourceMappingURL=stream.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/utils/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,MAAM,MAAM,eAAe,GAAG,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,WAAW,KAChB,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAA;AAE1C,eAAO,MAAM,YAAY,GAAI,KAAK,OAAO,KAAG,OACc,CAAA;AAE1D;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,GACtC,OAAO,CAAC,IAAI,CAAC,CAMf"}
@@ -1,18 +0,0 @@
1
- export const isAbortError = (err) => err instanceof DOMException && err.name === "AbortError";
2
- /**
3
- * Consumes an SSE stream with abort-safe iteration and error normalization.
4
- *
5
- * Handles the connection lifecycle shared by all streaming hooks:
6
- * 1. Calls `connect` to obtain an async iterable
7
- * 2. Iterates events, stopping on signal abort
8
- * 3. Filters out AbortError (normal cleanup), surfaces all others
9
- */
10
- export async function consumeStream(connect, jobId, signal, onEvent) {
11
- const events = await connect(jobId, signal);
12
- for await (const event of events) {
13
- if (signal.aborted)
14
- break;
15
- onEvent(event);
16
- }
17
- }
18
- //# sourceMappingURL=stream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../src/utils/stream.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAY,EAAW,EAAE,CACpD,GAAG,YAAY,YAAY,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,CAAA;AAE1D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAwB,EACxB,KAAa,EACb,MAAmB,EACnB,OAAuC;IAEvC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAC3C,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACjC,IAAI,MAAM,CAAC,OAAO;YAAE,MAAK;QACzB,OAAO,CAAC,KAAK,CAAC,CAAA;IAChB,CAAC;AACH,CAAC"}