@exaudeus/workrail 3.79.3 → 3.80.0

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.
@@ -3,14 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActiveSessionSet = void 0;
4
4
  class SessionHandleImpl {
5
5
  constructor(sessionId, onSteer, set) {
6
+ this._workrailSessionId = null;
6
7
  this._agent = null;
7
8
  this.sessionId = sessionId;
8
9
  this._onSteer = onSteer;
9
10
  this._set = set;
10
11
  }
12
+ get workrailSessionId() {
13
+ return this._workrailSessionId;
14
+ }
11
15
  steer(text) {
12
16
  this._onSteer(text);
13
17
  }
18
+ setWorkrailSessionId(workrailSessionId) {
19
+ if (this._workrailSessionId === null) {
20
+ this._workrailSessionId = workrailSessionId;
21
+ }
22
+ }
14
23
  setAgent(agent) {
15
24
  if (this._agent === null) {
16
25
  this._agent = agent;
@@ -37,8 +46,8 @@ class ActiveSessionSet {
37
46
  get(sessionId) {
38
47
  return this._handles.get(sessionId);
39
48
  }
40
- sessionIds() {
41
- return this._handles.keys();
49
+ handles() {
50
+ return this._handles.values();
42
51
  }
43
52
  abortAll() {
44
53
  for (const handle of this._handles.values()) {
@@ -1,4 +1,4 @@
1
- import type { WorkflowTrigger, WorkflowRunResult } from '../types.js';
1
+ import type { WorkflowTrigger, WorkflowRunResult, RunId } from '../types.js';
2
2
  import type { SessionState } from '../state/session-state.js';
3
3
  export declare function tagToStatsOutcome(tag: WorkflowRunResult['_tag']): 'success' | 'error' | 'timeout' | 'stuck';
4
4
  export type SidecarLifecycle = {
@@ -7,4 +7,4 @@ export type SidecarLifecycle = {
7
7
  readonly kind: 'retain_for_delivery';
8
8
  };
9
9
  export declare function sidecardLifecycleFor(tag: WorkflowRunResult['_tag'], branchStrategy: WorkflowTrigger['branchStrategy']): SidecarLifecycle;
10
- export declare function buildSessionResult(state: Readonly<SessionState>, stopReason: string, errorMessage: string | undefined, trigger: WorkflowTrigger, sessionId: string, sessionWorktreePath: string | undefined): WorkflowRunResult;
10
+ export declare function buildSessionResult(state: Readonly<SessionState>, stopReason: string, errorMessage: string | undefined, trigger: WorkflowTrigger, sessionId: RunId, sessionWorktreePath: string | undefined): WorkflowRunResult;
@@ -1,3 +1,7 @@
1
+ export type RunId = string & {
2
+ readonly _brand: 'RunId';
3
+ };
4
+ export declare function asRunId(value: string): RunId;
1
5
  export interface DaemonStartedEvent {
2
6
  readonly kind: 'daemon_started';
3
7
  readonly port: number;
@@ -15,33 +19,33 @@ export interface SessionQueuedEvent {
15
19
  }
16
20
  export interface SessionStartedEvent {
17
21
  readonly kind: 'session_started';
18
- readonly sessionId: string;
22
+ readonly sessionId: RunId;
19
23
  readonly workflowId: string;
20
24
  readonly workspacePath: string;
21
25
  readonly workrailSessionId?: string;
22
26
  }
23
27
  export interface ToolCalledEvent {
24
28
  readonly kind: 'tool_called';
25
- readonly sessionId: string;
29
+ readonly sessionId: RunId;
26
30
  readonly toolName: string;
27
31
  readonly summary?: string;
28
32
  readonly workrailSessionId?: string;
29
33
  }
30
34
  export interface ToolErrorEvent {
31
35
  readonly kind: 'tool_error';
32
- readonly sessionId: string;
36
+ readonly sessionId: RunId;
33
37
  readonly toolName: string;
34
38
  readonly error: string;
35
39
  readonly workrailSessionId?: string;
36
40
  }
37
41
  export interface StepAdvancedEvent {
38
42
  readonly kind: 'step_advanced';
39
- readonly sessionId: string;
43
+ readonly sessionId: RunId;
40
44
  readonly workrailSessionId?: string;
41
45
  }
42
46
  export interface SessionCompletedEvent {
43
47
  readonly kind: 'session_completed';
44
- readonly sessionId: string;
48
+ readonly sessionId: RunId;
45
49
  readonly workflowId: string;
46
50
  readonly outcome: 'success' | 'error' | 'timeout' | 'stuck';
47
51
  readonly detail?: string;
@@ -55,7 +59,7 @@ export interface DeliveryAttemptedEvent {
55
59
  }
56
60
  export interface IssueReportedEvent {
57
61
  readonly kind: 'issue_reported';
58
- readonly sessionId: string;
62
+ readonly sessionId: RunId;
59
63
  readonly issueKind: 'tool_failure' | 'blocked' | 'unexpected_behavior' | 'needs_human' | 'self_correction';
60
64
  readonly severity: 'info' | 'warn' | 'error' | 'fatal';
61
65
  readonly summary: string;
@@ -64,14 +68,14 @@ export interface IssueReportedEvent {
64
68
  }
65
69
  export interface LlmTurnStartedEvent {
66
70
  readonly kind: 'llm_turn_started';
67
- readonly sessionId: string;
71
+ readonly sessionId: RunId;
68
72
  readonly messageCount: number;
69
73
  readonly modelId?: string;
70
74
  readonly workrailSessionId?: string;
71
75
  }
72
76
  export interface LlmTurnCompletedEvent {
73
77
  readonly kind: 'llm_turn_completed';
74
- readonly sessionId: string;
78
+ readonly sessionId: RunId;
75
79
  readonly stopReason: string;
76
80
  readonly outputTokens: number;
77
81
  readonly inputTokens: number;
@@ -80,14 +84,14 @@ export interface LlmTurnCompletedEvent {
80
84
  }
81
85
  export interface ToolCallStartedEvent {
82
86
  readonly kind: 'tool_call_started';
83
- readonly sessionId: string;
87
+ readonly sessionId: RunId;
84
88
  readonly toolName: string;
85
89
  readonly argsSummary: string;
86
90
  readonly workrailSessionId?: string;
87
91
  }
88
92
  export interface ToolCallCompletedEvent {
89
93
  readonly kind: 'tool_call_completed';
90
- readonly sessionId: string;
94
+ readonly sessionId: RunId;
91
95
  readonly toolName: string;
92
96
  readonly durationMs: number;
93
97
  readonly resultSummary: string;
@@ -95,7 +99,7 @@ export interface ToolCallCompletedEvent {
95
99
  }
96
100
  export interface ToolCallFailedEvent {
97
101
  readonly kind: 'tool_call_failed';
98
- readonly sessionId: string;
102
+ readonly sessionId: RunId;
99
103
  readonly toolName: string;
100
104
  readonly durationMs: number;
101
105
  readonly errorMessage: string;
@@ -128,7 +132,7 @@ export interface SessionDroppedEvent {
128
132
  }
129
133
  export interface SignalEmittedEvent {
130
134
  readonly kind: 'signal_emitted';
131
- readonly sessionId: string;
135
+ readonly sessionId: RunId;
132
136
  readonly signalKind: string;
133
137
  readonly signalId: string;
134
138
  readonly payload: Readonly<Record<string, unknown>>;
@@ -136,7 +140,7 @@ export interface SignalEmittedEvent {
136
140
  }
137
141
  export interface AgentStuckEvent {
138
142
  readonly kind: 'agent_stuck';
139
- readonly sessionId: string;
143
+ readonly sessionId: RunId;
140
144
  readonly reason: 'repeated_tool_call' | 'no_progress' | 'timeout_imminent' | 'stall';
141
145
  readonly detail: string;
142
146
  readonly toolName?: string;
@@ -34,9 +34,13 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.DaemonEventEmitter = void 0;
37
+ exports.asRunId = asRunId;
37
38
  const fs = __importStar(require("node:fs/promises"));
38
39
  const path = __importStar(require("node:path"));
39
40
  const os = __importStar(require("node:os"));
41
+ function asRunId(value) {
42
+ return value;
43
+ }
40
44
  class DaemonEventEmitter {
41
45
  constructor(dirOverride) {
42
46
  this._tail = Promise.resolve();
@@ -1,7 +1,7 @@
1
1
  import type { AgentLoop, AgentEvent, AgentLoopCallbacks } from '../agent-loop.js';
2
2
  import type { V2ToolContext } from '../../mcp/types.js';
3
3
  import type { DaemonRegistry } from '../../v2/infra/in-memory/daemon-registry/index.js';
4
- import type { DaemonEventEmitter } from '../daemon-events.js';
4
+ import type { DaemonEventEmitter, RunId } from '../daemon-events.js';
5
5
  import type { SessionState } from '../state/session-state.js';
6
6
  import type { StuckConfig } from '../state/stuck-detection.js';
7
7
  import { ActiveSessionSet } from '../active-sessions.js';
@@ -13,7 +13,7 @@ export interface TurnEndSubscriberContext {
13
13
  readonly agent: AgentLoop;
14
14
  readonly state: SessionState;
15
15
  readonly stuckConfig: StuckConfig;
16
- readonly sessionId: string;
16
+ readonly sessionId: RunId;
17
17
  readonly workflowId: string;
18
18
  readonly emitter: DaemonEventEmitter | undefined;
19
19
  readonly conversationPath: string;
@@ -23,6 +23,6 @@ export interface TurnEndSubscriberContext {
23
23
  readonly stuckRepeatThreshold: number;
24
24
  }
25
25
  export declare function buildTurnEndSubscriber(ctx: TurnEndSubscriberContext): (event: AgentEvent) => Promise<void>;
26
- export declare function buildAgentCallbacks(sessionId: string, state: SessionState, modelId: string, emitter: DaemonEventEmitter | undefined, stuckRepeatThreshold: number, workflowId?: string): AgentLoopCallbacks;
27
- export declare function buildAgentReadySession(preAgentSession: PreAgentSession, trigger: WorkflowTrigger, ctx: V2ToolContext, apiKey: string, sessionId: string, emitter: DaemonEventEmitter | undefined, daemonRegistry: DaemonRegistry | undefined, activeSessionSet: ActiveSessionSet | undefined, runWorkflowFn: typeof runWorkflow, enricherResult?: EnricherResult): Promise<AgentReadySession>;
26
+ export declare function buildAgentCallbacks(sessionId: RunId, state: SessionState, modelId: string, emitter: DaemonEventEmitter | undefined, stuckRepeatThreshold: number, workflowId?: string): AgentLoopCallbacks;
27
+ export declare function buildAgentReadySession(preAgentSession: PreAgentSession, trigger: WorkflowTrigger, ctx: V2ToolContext, apiKey: string, sessionId: RunId, emitter: DaemonEventEmitter | undefined, daemonRegistry: DaemonRegistry | undefined, activeSessionSet: ActiveSessionSet | undefined, runWorkflowFn: typeof runWorkflow, enricherResult?: EnricherResult): Promise<AgentReadySession>;
28
28
  export declare function runAgentLoop(session: AgentReadySession, trigger: WorkflowTrigger, conversationPath: string): Promise<SessionOutcome>;
@@ -1,7 +1,7 @@
1
1
  import type { V2ToolContext } from '../../mcp/types.js';
2
2
  import type { DaemonRegistry } from '../../v2/infra/in-memory/daemon-registry/index.js';
3
- import type { DaemonEventEmitter } from '../daemon-events.js';
3
+ import type { DaemonEventEmitter, RunId } from '../daemon-events.js';
4
4
  import { ActiveSessionSet } from '../active-sessions.js';
5
5
  import type { WorkflowTrigger, SessionSource } from '../types.js';
6
6
  import type { PreAgentSessionResult } from './runner-types.js';
7
- export declare function buildPreAgentSession(trigger: WorkflowTrigger, ctx: V2ToolContext, apiKey: string, sessionId: string, startMs: number, statsDir: string, sessionsDir: string, emitter: DaemonEventEmitter | undefined, daemonRegistry: DaemonRegistry | undefined, activeSessionSet: ActiveSessionSet | undefined, source?: SessionSource): Promise<PreAgentSessionResult>;
7
+ export declare function buildPreAgentSession(trigger: WorkflowTrigger, ctx: V2ToolContext, apiKey: string, sessionId: RunId, startMs: number, statsDir: string, sessionsDir: string, emitter: DaemonEventEmitter | undefined, daemonRegistry: DaemonRegistry | undefined, activeSessionSet: ActiveSessionSet | undefined, source?: SessionSource): Promise<PreAgentSessionResult>;
@@ -185,9 +185,10 @@ async function buildPreAgentSession(trigger, ctx, apiKey, sessionId, startMs, st
185
185
  }
186
186
  }
187
187
  let handle;
188
+ handle = activeSessionSet?.register(sessionId, (text) => { state.pendingSteerParts.push(text); });
188
189
  if (state.workrailSessionId !== null) {
189
190
  daemonRegistry?.register(state.workrailSessionId, trigger.workflowId);
190
- handle = activeSessionSet?.register(state.workrailSessionId, (text) => { state.pendingSteerParts.push(text); });
191
+ handle?.setWorkrailSessionId(state.workrailSessionId);
191
192
  }
192
193
  if (isComplete) {
193
194
  return {
@@ -4,7 +4,7 @@ import type { SessionContext } from '../core/session-context.js';
4
4
  import type { ContextBundle } from '../context-loader.js';
5
5
  import type { SessionScope } from '../session-scope.js';
6
6
  import type { SessionHandle } from '../active-sessions.js';
7
- import type { DaemonEventEmitter } from '../daemon-events.js';
7
+ import type { DaemonEventEmitter, RunId } from '../daemon-events.js';
8
8
  import type { DaemonRegistry } from '../../v2/infra/in-memory/daemon-registry/index.js';
9
9
  import type { WorkflowRunResult } from '../types.js';
10
10
  import type { ReadFileState } from '../types.js';
@@ -12,7 +12,7 @@ import Anthropic from '@anthropic-ai/sdk';
12
12
  import { AnthropicBedrock } from '@anthropic-ai/bedrock-sdk';
13
13
  export declare const WORKTREES_DIR: string;
14
14
  export interface PreAgentSession {
15
- readonly sessionId: string;
15
+ readonly sessionId: RunId;
16
16
  readonly workrailSessionId: string | null;
17
17
  readonly continueToken: string;
18
18
  readonly checkpointToken: string | null;
@@ -44,7 +44,7 @@ export interface AgentReadySession {
44
44
  readonly tools: readonly AgentTool[];
45
45
  readonly sessionCtx: SessionContext;
46
46
  readonly handle: SessionHandle | undefined;
47
- readonly sessionId: string;
47
+ readonly sessionId: RunId;
48
48
  readonly workflowId: string;
49
49
  readonly worktreePath: string | undefined;
50
50
  readonly agent: AgentLoop;
@@ -59,7 +59,7 @@ export type SessionOutcome = {
59
59
  readonly errorMessage?: string;
60
60
  };
61
61
  export interface FinalizationContext {
62
- readonly sessionId: string;
62
+ readonly sessionId: RunId;
63
63
  readonly workrailSessionId: string | null;
64
64
  readonly startMs: number;
65
65
  readonly stepAdvanceCount: number;
@@ -1,6 +1,6 @@
1
1
  import type { ReadFileState } from './types.js';
2
2
  import type { ActiveSessionSet } from './active-sessions.js';
3
- import type { DaemonEventEmitter } from './daemon-events.js';
3
+ import type { DaemonEventEmitter, RunId } from './daemon-events.js';
4
4
  export interface FileStateTracker {
5
5
  recordRead(filePath: string, content: string, timestamp: number, isPartialView: boolean): void;
6
6
  getReadState(filePath: string): ReadFileState | undefined;
@@ -28,7 +28,7 @@ export interface SessionScope {
28
28
  readonly spawnMaxDepth: number;
29
29
  readonly workrailSessionId: string | null;
30
30
  readonly emitter: DaemonEventEmitter | undefined;
31
- readonly sessionId: string;
31
+ readonly sessionId: RunId;
32
32
  readonly workflowId: string;
33
33
  readonly activeSessionSet: ActiveSessionSet | undefined;
34
34
  }
@@ -50,6 +50,7 @@ const assert_never_js_1 = require("../runtime/assert-never.js");
50
50
  const session_recovery_policy_js_1 = require("./session-recovery-policy.js");
51
51
  const _shared_js_1 = require("./tools/_shared.js");
52
52
  const workflow_runner_js_1 = require("./workflow-runner.js");
53
+ const daemon_events_js_1 = require("./daemon-events.js");
53
54
  const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
54
55
  const MAX_ORPHAN_AGE_MS = 2 * 60 * 60 * 1000;
55
56
  const MAX_WORKTREE_ORPHAN_AGE_MS = 24 * 60 * 60 * 1000;
@@ -80,7 +81,7 @@ async function readAllDaemonSessions(sessionsDir = _shared_js_1.DAEMON_SESSIONS_
80
81
  for (const entry of entries) {
81
82
  if (!entry.endsWith('.json') || entry.startsWith('queue-issue-'))
82
83
  continue;
83
- const sessionId = entry.slice(0, -5);
84
+ const sessionId = (0, daemon_events_js_1.asRunId)(entry.slice(0, -5));
84
85
  const filePath = path.join(sessionsDir, entry);
85
86
  try {
86
87
  const raw = await fs.readFile(filePath, 'utf8');
@@ -1,3 +1,3 @@
1
1
  import type { AgentTool } from '../agent-loop.js';
2
- import type { DaemonEventEmitter } from '../daemon-events.js';
3
- export declare function makeBashTool(workspacePath: string, schemas: Record<string, any>, sessionId?: string, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
2
+ import type { DaemonEventEmitter, RunId } from '../daemon-events.js';
3
+ export declare function makeBashTool(workspacePath: string, schemas: Record<string, any>, sessionId?: RunId, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
@@ -1,6 +1,6 @@
1
1
  import type { AgentTool } from '../agent-loop.js';
2
2
  import type { V2ToolContext } from '../../mcp/types.js';
3
- import type { DaemonEventEmitter } from '../daemon-events.js';
3
+ import type { DaemonEventEmitter, RunId } from '../daemon-events.js';
4
4
  import { executeContinueWorkflow } from '../../mcp/handlers/v2-execution/index.js';
5
- export declare function makeContinueWorkflowTool(sessionId: string, ctx: V2ToolContext, onAdvance: (nextStepText: string, continueToken: string) => void, onComplete: (notes: string | undefined, artifacts?: readonly unknown[]) => void, schemas: Record<string, any>, _executeContinueWorkflowFn?: typeof executeContinueWorkflow, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
6
- export declare function makeCompleteStepTool(sessionId: string, ctx: V2ToolContext, getCurrentToken: () => string, onAdvance: (nextStepText: string, continueToken: string) => void, onComplete: (notes: string | undefined, artifacts?: readonly unknown[]) => void, onTokenUpdate: (t: string) => void, schemas: Record<string, any>, _executeContinueWorkflowFn?: typeof executeContinueWorkflow, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
5
+ export declare function makeContinueWorkflowTool(sessionId: RunId, ctx: V2ToolContext, onAdvance: (nextStepText: string, continueToken: string) => void, onComplete: (notes: string | undefined, artifacts?: readonly unknown[]) => void, schemas: Record<string, any>, _executeContinueWorkflowFn?: typeof executeContinueWorkflow, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
6
+ export declare function makeCompleteStepTool(sessionId: RunId, ctx: V2ToolContext, getCurrentToken: () => string, onAdvance: (nextStepText: string, continueToken: string) => void, onComplete: (notes: string | undefined, artifacts?: readonly unknown[]) => void, onTokenUpdate: (t: string) => void, schemas: Record<string, any>, _executeContinueWorkflowFn?: typeof executeContinueWorkflow, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
@@ -1,6 +1,6 @@
1
1
  import type { AgentTool } from '../agent-loop.js';
2
- import type { DaemonEventEmitter } from '../daemon-events.js';
2
+ import type { DaemonEventEmitter, RunId } from '../daemon-events.js';
3
3
  import type { ReadFileState } from '../types.js';
4
- export declare function makeReadTool(workspacePath: string, readFileState: Map<string, ReadFileState>, schemas: Record<string, any>, sessionId?: string, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
5
- export declare function makeWriteTool(workspacePath: string, readFileState: Map<string, ReadFileState>, schemas: Record<string, any>, sessionId?: string, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
6
- export declare function makeEditTool(workspacePath: string, readFileState: Map<string, ReadFileState>, schemas: Record<string, any>, sessionId?: string, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
4
+ export declare function makeReadTool(workspacePath: string, readFileState: Map<string, ReadFileState>, schemas: Record<string, any>, sessionId?: RunId, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
5
+ export declare function makeWriteTool(workspacePath: string, readFileState: Map<string, ReadFileState>, schemas: Record<string, any>, sessionId?: RunId, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
6
+ export declare function makeEditTool(workspacePath: string, readFileState: Map<string, ReadFileState>, schemas: Record<string, any>, sessionId?: RunId, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
@@ -1,4 +1,4 @@
1
1
  import type { AgentTool } from '../agent-loop.js';
2
- import type { DaemonEventEmitter } from '../daemon-events.js';
3
- export declare function makeGlobTool(workspacePath: string, schemas: Record<string, any>, sessionId?: string, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
4
- export declare function makeGrepTool(workspacePath: string, schemas: Record<string, any>, sessionId?: string, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
2
+ import type { DaemonEventEmitter, RunId } from '../daemon-events.js';
3
+ export declare function makeGlobTool(workspacePath: string, schemas: Record<string, any>, sessionId?: RunId, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
4
+ export declare function makeGrepTool(workspacePath: string, schemas: Record<string, any>, sessionId?: RunId, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
@@ -1,3 +1,3 @@
1
1
  import type { AgentTool } from '../agent-loop.js';
2
- import type { DaemonEventEmitter } from '../daemon-events.js';
3
- export declare function makeReportIssueTool(sessionId: string, emitter?: DaemonEventEmitter, workrailSessionId?: string | null, issuesDirOverride?: string, onIssueSummary?: (summary: string) => void): AgentTool;
2
+ import type { DaemonEventEmitter, RunId } from '../daemon-events.js';
3
+ export declare function makeReportIssueTool(sessionId: RunId, emitter?: DaemonEventEmitter, workrailSessionId?: string | null, issuesDirOverride?: string, onIssueSummary?: (summary: string) => void): AgentTool;
@@ -1,4 +1,4 @@
1
1
  import type { AgentTool } from '../agent-loop.js';
2
- import type { DaemonEventEmitter } from '../daemon-events.js';
2
+ import type { DaemonEventEmitter, RunId } from '../daemon-events.js';
3
3
  export declare const DAEMON_SIGNALS_DIR: string;
4
- export declare function makeSignalCoordinatorTool(sessionId: string, emitter?: DaemonEventEmitter, workrailSessionId?: string | null, signalsDirOverride?: string): AgentTool;
4
+ export declare function makeSignalCoordinatorTool(sessionId: RunId, emitter?: DaemonEventEmitter, workrailSessionId?: string | null, signalsDirOverride?: string): AgentTool;
@@ -1,6 +1,6 @@
1
1
  import type { AgentTool } from '../agent-loop.js';
2
2
  import type { V2ToolContext } from '../../mcp/types.js';
3
- import type { DaemonEventEmitter } from '../daemon-events.js';
3
+ import type { DaemonEventEmitter, RunId } from '../daemon-events.js';
4
4
  import type { runWorkflow } from '../workflow-runner.js';
5
5
  import type { ActiveSessionSet } from '../active-sessions.js';
6
- export declare function makeSpawnAgentTool(sessionId: string, ctx: V2ToolContext, apiKey: string, thisWorkrailSessionId: string, currentDepth: number, maxDepth: number, runWorkflowFn: typeof runWorkflow, schemas: Record<string, any>, emitter?: DaemonEventEmitter, activeSessionSet?: ActiveSessionSet): AgentTool;
6
+ export declare function makeSpawnAgentTool(sessionId: RunId, ctx: V2ToolContext, apiKey: string, thisWorkrailSessionId: string, currentDepth: number, maxDepth: number, runWorkflowFn: typeof runWorkflow, schemas: Record<string, any>, emitter?: DaemonEventEmitter, activeSessionSet?: ActiveSessionSet): AgentTool;
@@ -1,3 +1,5 @@
1
+ import type { RunId } from './daemon-events.js';
2
+ export type { RunId } from './daemon-events.js';
1
3
  export type ReadFileState = {
2
4
  content: string;
3
5
  timestamp: number;
@@ -53,7 +55,7 @@ export interface WorkflowRunSuccess {
53
55
  readonly lastStepNotes?: string;
54
56
  readonly lastStepArtifacts?: readonly unknown[];
55
57
  readonly sessionWorkspacePath?: string;
56
- readonly sessionId?: string;
58
+ readonly sessionId?: RunId;
57
59
  readonly botIdentity?: {
58
60
  readonly name: string;
59
61
  readonly email: string;
@@ -94,7 +96,7 @@ export interface WorkflowContextSlots {
94
96
  export declare function extractContextSlots(context: Readonly<Record<string, unknown>> | undefined): WorkflowContextSlots;
95
97
  export type ChildWorkflowRunResult = WorkflowRunSuccess | WorkflowRunError | WorkflowRunTimeout | WorkflowRunStuck;
96
98
  export interface OrphanedSession {
97
- readonly sessionId: string;
99
+ readonly sessionId: RunId;
98
100
  readonly continueToken: string;
99
101
  readonly checkpointToken: string | null;
100
102
  readonly ts: number;
@@ -40,6 +40,7 @@ const path = __importStar(require("node:path"));
40
40
  const node_child_process_1 = require("node:child_process");
41
41
  const node_util_1 = require("node:util");
42
42
  const node_crypto_1 = require("node:crypto");
43
+ const daemon_events_js_1 = require("./daemon-events.js");
43
44
  const types_js_1 = require("./types.js");
44
45
  const workflow_enricher_js_1 = require("./workflow-enricher.js");
45
46
  const index_js_1 = require("./core/index.js");
@@ -121,7 +122,7 @@ async function runWorkflow(trigger, ctx, apiKey, daemonRegistry, emitter, active
121
122
  const statsDir = _statsDir ?? index_js_2.DAEMON_STATS_DIR;
122
123
  const sessionsDir = _sessionsDir ?? _shared_js_1.DAEMON_SESSIONS_DIR;
123
124
  const startMs = Date.now();
124
- const sessionId = (0, node_crypto_1.randomUUID)();
125
+ const sessionId = (0, daemon_events_js_1.asRunId)((0, node_crypto_1.randomUUID)());
125
126
  console.log(`[WorkflowRunner] Session started: sessionId=${sessionId} workflowId=${trigger.workflowId}`);
126
127
  emitter?.emit({
127
128
  kind: 'session_started',
@@ -238,8 +238,8 @@
238
238
  "bytes": 31
239
239
  },
240
240
  "cli-worktrain.js": {
241
- "sha256": "fe38aca6a553491f3c9e0bd916cedbcd6a58d5cce230b1f47a52066f0b622851",
242
- "bytes": 67617
241
+ "sha256": "59cfae145a92e0a193bde66f99534ab2497c86b356a8763e1fac880cc50ea3c7",
242
+ "bytes": 67662
243
243
  },
244
244
  "cli.d.ts": {
245
245
  "sha256": "43e818adf60173644896298637f47b01d5819b17eda46eaa32d0c7d64724d012",
@@ -473,16 +473,16 @@
473
473
  "sha256": "5fe866e54f796975dec5d8ba9983aefd86074db212d3fccd64eed04bc9f0b3da",
474
474
  "bytes": 8011
475
475
  },
476
+ "console-ui/assets/index-2NrQPYdF.js": {
477
+ "sha256": "5b3d78a41cc1bcb9b1038f3e907cc34d100866b1dd014f722e5e3252969321f8",
478
+ "bytes": 768377
479
+ },
476
480
  "console-ui/assets/index-DHrKiMCf.css": {
477
481
  "sha256": "40290b50e21ee7e82433efe13b1aa31c1ea608bd057a5c4e324982f284bc928b",
478
482
  "bytes": 60673
479
483
  },
480
- "console-ui/assets/index-pA7_pNwu.js": {
481
- "sha256": "66a71ccc693b0ec393215640dd2a1a94b5716821270fae2efc09d34877bf8467",
482
- "bytes": 768377
483
- },
484
484
  "console-ui/index.html": {
485
- "sha256": "07e9a2b03cdf07f75dc3f16361f6be90423d55a7757d7a530ad660303a332c7d",
485
+ "sha256": "6088238179c08b3e42c1bd91ee266a091aa41f6d6b3279d04fc8b8836680b89d",
486
486
  "bytes": 417
487
487
  },
488
488
  "console/standalone-console.d.ts": {
@@ -622,12 +622,12 @@
622
622
  "bytes": 3493
623
623
  },
624
624
  "daemon/active-sessions.d.ts": {
625
- "sha256": "26e768eafba633eb1585ec55759b14a1daffe7b13668116b7bc4cd54c3e559e9",
626
- "bytes": 563
625
+ "sha256": "061ac8eb333bd24672f0a46a33936f08522aaf06dda1ea5480f29d5eed7275a0",
626
+ "bytes": 718
627
627
  },
628
628
  "daemon/active-sessions.js": {
629
- "sha256": "12a7346bd7a7710939c44437f22b1532c5b540bca4effece866c878c723aab80",
630
- "bytes": 1330
629
+ "sha256": "bad9cd677d28720bd4bb336416acd9f0df21af9279298d3898996ab6f4f56d4b",
630
+ "bytes": 1612
631
631
  },
632
632
  "daemon/agent-loop.d.ts": {
633
633
  "sha256": "b24e3a615f0058165cd06251835baec3b810da2b92c061aea278fbc72deae5a0",
@@ -670,8 +670,8 @@
670
670
  "bytes": 1545
671
671
  },
672
672
  "daemon/core/session-result.d.ts": {
673
- "sha256": "9f71824862fd5d258b3cd5cb4b3a830e0ac04afefb6515e91fbb9449c8922ca8",
674
- "bytes": 750
673
+ "sha256": "3a9f59a1b7dc290da45ee70947f41c4158900ec9a143ce16bccd27b80030ab78",
674
+ "bytes": 756
675
675
  },
676
676
  "daemon/core/session-result.js": {
677
677
  "sha256": "d29501089caeba4fa21ccd4be31d585894f66879543b90bbc17fc0e7dfd1d584",
@@ -694,12 +694,12 @@
694
694
  "bytes": 1216
695
695
  },
696
696
  "daemon/daemon-events.d.ts": {
697
- "sha256": "264cf0ec4ed8af828ce735b34e3310e662cf6d5502200d4be5b5c4491de0bcdc",
698
- "bytes": 5398
697
+ "sha256": "b2a44640954cb8bffecd2cbb7fd38f8369ac7aa397cc8cd31d746a50ea1a1388",
698
+ "bytes": 5504
699
699
  },
700
700
  "daemon/daemon-events.js": {
701
- "sha256": "ac8e2f94608c11ac758e38959339b0056eb18fa91912ae8a5f89609a8799a123",
702
- "bytes": 2315
701
+ "sha256": "035c81d2cb3801ebd06d2672c854fbfbe4857121d0624da387c3858efad2d64e",
702
+ "bytes": 2388
703
703
  },
704
704
  "daemon/io/conversation-log.d.ts": {
705
705
  "sha256": "eff40d1f2f707469b94665741de33ca3a505863d5b97aa8a73f070458e3cf5b5",
@@ -758,8 +758,8 @@
758
758
  "bytes": 14
759
759
  },
760
760
  "daemon/runner/agent-loop-runner.d.ts": {
761
- "sha256": "605a8bde5f1a2be3d082d52e50b67d1d2e6323faae8dfed95c80db2760a33ce3",
762
- "bytes": 2021
761
+ "sha256": "db9ce88861d5725d5946d07913c86b5dbdc6a7687a1b1f7f38ea6a934add4873",
762
+ "bytes": 2025
763
763
  },
764
764
  "daemon/runner/agent-loop-runner.js": {
765
765
  "sha256": "95ba3bad184189519c228b50b6c6dbd03c8daf2d6d43c2cf4ee8205bda3ff67b",
@@ -790,16 +790,16 @@
790
790
  "bytes": 1978
791
791
  },
792
792
  "daemon/runner/pre-agent-session.d.ts": {
793
- "sha256": "a500ff9d433245f37c3bf14d1c03ca5b291873e2d9da019d66760dba81df3bb9",
794
- "bytes": 770
793
+ "sha256": "06d1224b7a2b04e2885f5343ae7f19ad014fd096dc42fc478957f5f0fcf6e4a8",
794
+ "bytes": 776
795
795
  },
796
796
  "daemon/runner/pre-agent-session.js": {
797
- "sha256": "56c8bce2a4be1409973cfc2b6bcbdade90d6d404559256aaa74e5d10fb674c09",
798
- "bytes": 10675
797
+ "sha256": "ac80f19304ddb3909eaaa7e949b7f4d668a22d9d5f5369cdc646fc614052ec27",
798
+ "bytes": 10720
799
799
  },
800
800
  "daemon/runner/runner-types.d.ts": {
801
- "sha256": "e8760c0c0dd21fdf31807894c6bc2e237b5f8bd21db58a29abd6641c51a91897",
802
- "bytes": 2889
801
+ "sha256": "db1ce9fb557bc6af9dcd7972a3c8b08902658e2baf67c0d3bd7032b44f6b5acb",
802
+ "bytes": 2893
803
803
  },
804
804
  "daemon/runner/runner-types.js": {
805
805
  "sha256": "7a81aac9aeafd9fd7b8037dae4b8e4a5e35c6b363ab946d6431de081d873ef5d",
@@ -822,8 +822,8 @@
822
822
  "bytes": 247
823
823
  },
824
824
  "daemon/session-scope.d.ts": {
825
- "sha256": "278afe2add5fa0d56eb3736d21d027bee91d1f8a9d50594c741205e807d529f4",
826
- "bytes": 1671
825
+ "sha256": "28cd109c919d139937e43705e8b64a5beb26cd0e0e2471009ff238a3a8495cb8",
826
+ "bytes": 1677
827
827
  },
828
828
  "daemon/session-scope.js": {
829
829
  "sha256": "2f5295aa36b8d46b162a2b1f4d6f13af00517796aa468956563a8de46e2ecd56",
@@ -842,8 +842,8 @@
842
842
  "bytes": 1552
843
843
  },
844
844
  "daemon/startup-recovery.js": {
845
- "sha256": "a40f8974640340e6f83db38ac849de2b978bff30b8e05ee070d440de6b180881",
846
- "bytes": 16073
845
+ "sha256": "38b5bd7ee0fa3010e55ec5f53b477bf7695a23d6dcf938e67b62fefbd89de70e",
846
+ "bytes": 16164
847
847
  },
848
848
  "daemon/state/index.d.ts": {
849
849
  "sha256": "73a88f07267b952425222bfea4ef747f4881daf28f325da5d126194393699faf",
@@ -894,56 +894,56 @@
894
894
  "bytes": 4410
895
895
  },
896
896
  "daemon/tools/bash.d.ts": {
897
- "sha256": "7da73a970983f275477e513d348f6b9cf110edf1c7b72f83d4f2db7e1118a627",
898
- "bytes": 301
897
+ "sha256": "cc1f1afc8ee54e91cecc3471e0d4d98ef5c067815067d2abbf644cc79c4c48e5",
898
+ "bytes": 307
899
899
  },
900
900
  "daemon/tools/bash.js": {
901
901
  "sha256": "550af5e541db9bb3504d42d6246f944c8e1d54208c411bc060e142758f8f8f3b",
902
902
  "bytes": 2991
903
903
  },
904
904
  "daemon/tools/continue-workflow.d.ts": {
905
- "sha256": "592de45416a858a30069b4d55ef69f456c0da476122735918783f76838b49c75",
906
- "bytes": 1124
905
+ "sha256": "a51338292c48d060be44ca40c71ea3f9200b24ba3193c2a2e160aaad8b8bd9a3",
906
+ "bytes": 1129
907
907
  },
908
908
  "daemon/tools/continue-workflow.js": {
909
909
  "sha256": "17389b3356a17d8e82acb6a86260cc82586ff9cdcbb52b93248b42f83ccdc3bd",
910
910
  "bytes": 11395
911
911
  },
912
912
  "daemon/tools/file-tools.d.ts": {
913
- "sha256": "5ae91a3fab8cd1e42817af93532e135d7a0bfd1efe7ac7d31337376a739c9646",
914
- "bytes": 855
913
+ "sha256": "f8ddbd23bfe87eac2d2b48c91d1c494d418b2ee18be04d8118f7ce5c6cff2b38",
914
+ "bytes": 859
915
915
  },
916
916
  "daemon/tools/file-tools.js": {
917
917
  "sha256": "b90b2976e07b06427c6886e48a5bb4e267dd0834c6bf00d3c20ba0a640beb2d0",
918
918
  "bytes": 11075
919
919
  },
920
920
  "daemon/tools/glob-grep.d.ts": {
921
- "sha256": "13b79eae6df2fa4b736543b821d868399a1659f3b05c60e5efac63fc5ea41b46",
922
- "bytes": 488
921
+ "sha256": "ddffdac4855d5f45091821905347c9c945fee9399c63cb367002ada3bd501b84",
922
+ "bytes": 493
923
923
  },
924
924
  "daemon/tools/glob-grep.js": {
925
925
  "sha256": "a124b6ab639e774e152e521931a93291513ad824968cdd871190d9d630719c26",
926
926
  "bytes": 7881
927
927
  },
928
928
  "daemon/tools/report-issue.d.ts": {
929
- "sha256": "5f405011b3db32c72c6459912d698b2dcca50c81d224e18c8abd7db0fa876de0",
930
- "bytes": 326
929
+ "sha256": "3f9da8f7c3a098736436e0e64517ac5869a9421ab9f7342f3c2b15ecd180aad4",
930
+ "bytes": 332
931
931
  },
932
932
  "daemon/tools/report-issue.js": {
933
933
  "sha256": "cd59afdc1224590a116faff6454fec36f2ab20a42fc8a318155836243f3a3b2d",
934
934
  "bytes": 6294
935
935
  },
936
936
  "daemon/tools/signal-coordinator.d.ts": {
937
- "sha256": "63e5a2bdfd6260a57365ae74aeb9d566c3233e52da36e246212b5ac9ab9ffbb8",
938
- "bytes": 338
937
+ "sha256": "0c8d08355812719160a4feb0e89773814d9f858dfb223a60923bb483da7f5d54",
938
+ "bytes": 344
939
939
  },
940
940
  "daemon/tools/signal-coordinator.js": {
941
941
  "sha256": "e17b38f0109d505f1d27418d777bf73797036efa5354b2e867df2c9fd910d58f",
942
942
  "bytes": 4952
943
943
  },
944
944
  "daemon/tools/spawn-agent.d.ts": {
945
- "sha256": "fc6f2f4403c96597041f81abb656fb3499a5d0e9a6f0800f273e444b60912d71",
946
- "bytes": 605
945
+ "sha256": "83826dad317eb2b943590be3854e7a9da5dee8d9d54e0e3ff1216c2f361d6b34",
946
+ "bytes": 611
947
947
  },
948
948
  "daemon/tools/spawn-agent.js": {
949
949
  "sha256": "ff46faa59257609b391a181706afd5e162b5413645938a0e77a486f3e57725b8",
@@ -974,8 +974,8 @@
974
974
  "bytes": 429
975
975
  },
976
976
  "daemon/types.d.ts": {
977
- "sha256": "e2df5c78598f38ee2b033f48b49c1acee0e8308186b535e62262c0b9cf1b361d",
978
- "bytes": 3625
977
+ "sha256": "e827f207ee0fb5d8a68ea297a427f9603763989a9e6d8be049bcb106efd87f58",
978
+ "bytes": 3721
979
979
  },
980
980
  "daemon/types.js": {
981
981
  "sha256": "fdfd53db3769331d50bd9265b6c5050fd9a7d0ccf55a950519b385cc849c92b8",
@@ -994,8 +994,8 @@
994
994
  "bytes": 3159
995
995
  },
996
996
  "daemon/workflow-runner.js": {
997
- "sha256": "ef4fcb5e9c83e081ab4c652babea8260320e744fbb5491fc344fc7c565520c08",
998
- "bytes": 14314
997
+ "sha256": "4d3bb4d2536f7027e00f21d45c09b42c699bf1a660301fd0ac090751062a3e75",
998
+ "bytes": 14405
999
999
  },
1000
1000
  "di/container.d.ts": {
1001
1001
  "sha256": "003bb7fb7478d627524b9b1e76bd0a963a243794a687ff233b96dc0e33a06d9f",