@exaudeus/workrail 3.76.0 → 3.77.1
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/console-ui/assets/{index-DFZjlsUM.js → index-BooFww1c.js} +1 -1
- package/dist/console-ui/index.html +1 -1
- package/dist/daemon/context-loader.d.ts +1 -1
- package/dist/daemon/core/agent-client.d.ts +7 -0
- package/dist/daemon/core/agent-client.js +31 -0
- package/dist/daemon/core/index.d.ts +6 -0
- package/dist/daemon/core/index.js +19 -0
- package/dist/daemon/core/session-context.d.ts +14 -0
- package/dist/daemon/core/session-context.js +21 -0
- package/dist/daemon/core/session-result.d.ts +10 -0
- package/dist/daemon/core/session-result.js +92 -0
- package/dist/daemon/core/system-prompt.d.ts +6 -0
- package/dist/daemon/core/system-prompt.js +151 -0
- package/dist/daemon/io/conversation-log.d.ts +2 -0
- package/dist/daemon/io/conversation-log.js +45 -0
- package/dist/daemon/io/execution-stats.d.ts +7 -0
- package/dist/daemon/io/execution-stats.js +86 -0
- package/dist/daemon/io/index.d.ts +5 -0
- package/dist/daemon/io/index.js +24 -0
- package/dist/daemon/io/session-notes-loader.d.ts +4 -0
- package/dist/daemon/io/session-notes-loader.js +45 -0
- package/dist/daemon/io/soul-loader.d.ts +3 -0
- package/dist/daemon/io/soul-loader.js +68 -0
- package/dist/daemon/io/workspace-context-loader.d.ts +17 -0
- package/dist/daemon/io/workspace-context-loader.js +137 -0
- package/dist/daemon/runner/agent-loop-runner.d.ts +28 -0
- package/dist/daemon/runner/agent-loop-runner.js +250 -0
- package/dist/daemon/runner/construct-tools.d.ts +5 -0
- package/dist/daemon/runner/construct-tools.js +30 -0
- package/dist/daemon/runner/finalize-session.d.ts +3 -0
- package/dist/daemon/runner/finalize-session.js +75 -0
- package/dist/daemon/runner/index.d.ts +8 -0
- package/dist/daemon/runner/index.js +18 -0
- package/dist/daemon/runner/pre-agent-session.d.ts +7 -0
- package/dist/daemon/runner/pre-agent-session.js +227 -0
- package/dist/daemon/runner/runner-types.d.ts +73 -0
- package/dist/daemon/runner/runner-types.js +39 -0
- package/dist/daemon/runner/tool-schemas.d.ts +1 -0
- package/dist/daemon/runner/tool-schemas.js +151 -0
- package/dist/daemon/session-scope.d.ts +1 -1
- package/dist/daemon/startup-recovery.d.ts +20 -0
- package/dist/daemon/startup-recovery.js +323 -0
- package/dist/daemon/state/index.d.ts +6 -0
- package/dist/daemon/state/index.js +14 -0
- package/dist/daemon/state/session-state.d.ts +23 -0
- package/dist/daemon/state/session-state.js +44 -0
- package/dist/daemon/state/stuck-detection.d.ts +22 -0
- package/dist/daemon/state/stuck-detection.js +25 -0
- package/dist/daemon/state/terminal-signal.d.ts +9 -0
- package/dist/daemon/state/terminal-signal.js +10 -0
- package/dist/daemon/tools/file-tools.d.ts +1 -1
- package/dist/daemon/turn-end/detect-stuck.d.ts +2 -2
- package/dist/daemon/turn-end/detect-stuck.js +2 -2
- package/dist/daemon/turn-end/step-injector.d.ts +1 -1
- package/dist/daemon/types.d.ts +105 -0
- package/dist/daemon/types.js +11 -0
- package/dist/daemon/workflow-enricher.d.ts +16 -0
- package/dist/daemon/workflow-enricher.js +58 -0
- package/dist/daemon/workflow-runner.d.ts +13 -277
- package/dist/daemon/workflow-runner.js +63 -1421
- package/dist/manifest.json +231 -31
- package/dist/trigger/coordinator-deps.d.ts +1 -1
- package/dist/trigger/delivery-client.d.ts +1 -1
- package/dist/trigger/delivery-pipeline.d.ts +1 -1
- package/dist/trigger/notification-service.d.ts +1 -1
- package/dist/trigger/trigger-listener.js +6 -2
- package/dist/trigger/trigger-router.d.ts +2 -2
- package/docs/ideas/backlog.md +249 -25
- package/docs/reference/worktrain-daemon-invariants.md +33 -49
- package/docs/vision.md +5 -15
- package/package.json +2 -2
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EMPTY_RESULT = void 0;
|
|
4
|
+
exports.createWorkflowEnricherDeps = createWorkflowEnricherDeps;
|
|
5
|
+
exports.enrichTriggerContext = enrichTriggerContext;
|
|
6
|
+
exports.shouldEnrich = shouldEnrich;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const node_util_1 = require("node:util");
|
|
9
|
+
const infra_js_1 = require("../context-assembly/infra.js");
|
|
10
|
+
const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
11
|
+
exports.EMPTY_RESULT = {
|
|
12
|
+
priorSessionNotes: [],
|
|
13
|
+
gitDiffStat: null,
|
|
14
|
+
};
|
|
15
|
+
function createWorkflowEnricherDeps() {
|
|
16
|
+
return {
|
|
17
|
+
execGit: async (args, cwd) => {
|
|
18
|
+
try {
|
|
19
|
+
const { stdout } = await execFileAsync('git', [...args], { cwd });
|
|
20
|
+
return { kind: 'ok', value: stdout };
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
return { kind: 'err', error: e instanceof Error ? e.message : String(e) };
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
listRecentSessions: (0, infra_js_1.createListRecentSessions)(),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const LIST_SESSIONS_TIMEOUT_MS = 1000;
|
|
30
|
+
function raceWithTimeout(promise, timeoutMs, timeoutMessage) {
|
|
31
|
+
let handle;
|
|
32
|
+
const timeout = new Promise((resolve) => {
|
|
33
|
+
handle = setTimeout(() => resolve({ kind: 'err', error: timeoutMessage }), timeoutMs);
|
|
34
|
+
});
|
|
35
|
+
return Promise.race([
|
|
36
|
+
promise.then((r) => { clearTimeout(handle); return r; }),
|
|
37
|
+
timeout,
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
const MAX_PRIOR_NOTES = 3;
|
|
41
|
+
async function enrichTriggerContext(trigger, deps, policy) {
|
|
42
|
+
const notesPromise = policy === 'skip_coordinator_provided'
|
|
43
|
+
? Promise.resolve({ kind: 'ok', value: [] })
|
|
44
|
+
: raceWithTimeout(deps.listRecentSessions(trigger.workspacePath, MAX_PRIOR_NOTES), LIST_SESSIONS_TIMEOUT_MS, 'listRecentSessions timeout (1s)');
|
|
45
|
+
const [notesResult, gitResult] = await Promise.all([
|
|
46
|
+
notesPromise,
|
|
47
|
+
deps.execGit(['diff', 'HEAD~1', '--stat'], trigger.workspacePath),
|
|
48
|
+
]);
|
|
49
|
+
return {
|
|
50
|
+
priorSessionNotes: notesResult.kind === 'ok' ? notesResult.value : [],
|
|
51
|
+
gitDiffStat: gitResult.kind === 'ok' && gitResult.value.trim().length > 0
|
|
52
|
+
? gitResult.value.trim()
|
|
53
|
+
: null,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function shouldEnrich(trigger) {
|
|
57
|
+
return (trigger.spawnDepth ?? 0) === 0;
|
|
58
|
+
}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import Anthropic from '@anthropic-ai/sdk';
|
|
3
|
-
import { AnthropicBedrock } from '@anthropic-ai/bedrock-sdk';
|
|
4
|
-
import { AgentLoop } from "./agent-loop.js";
|
|
5
|
-
import type { AgentTool, AgentEvent, AgentLoopCallbacks } from "./agent-loop.js";
|
|
6
2
|
import type { V2ToolContext } from '../mcp/types.js';
|
|
7
|
-
import { executeContinueWorkflow } from '../mcp/handlers/v2-execution/index.js';
|
|
8
3
|
import type { DaemonRegistry } from '../v2/infra/in-memory/daemon-registry/index.js';
|
|
9
|
-
import type { ContinueTokenResolved } from '../mcp/handlers/v2-token-ops.js';
|
|
10
|
-
import type { SessionEventLogReadonlyStorePortV2 } from '../v2/ports/session-event-log-store.port.js';
|
|
11
|
-
import type { ToolFailure } from '../mcp/handlers/v2-execution-helpers.js';
|
|
12
|
-
import type { ResultAsync } from 'neverthrow';
|
|
13
4
|
import type { DaemonEventEmitter } from './daemon-events.js';
|
|
14
|
-
import { type SessionScope } from './session-scope.js';
|
|
15
5
|
import { ActiveSessionSet } from './active-sessions.js';
|
|
16
|
-
import type {
|
|
6
|
+
import type { WorkflowTrigger, SessionSource, WorkflowRunResult } from './types.js';
|
|
7
|
+
import { type WorkflowEnricherDeps } from './workflow-enricher.js';
|
|
8
|
+
export { loadDaemonSoul, loadWorkspaceContext, loadSessionNotes, stripFrontmatter, MAX_SESSION_RECAP_NOTES, MAX_SESSION_NOTE_CHARS, } from './io/index.js';
|
|
9
|
+
export type { PreAgentSession, PreAgentSessionResult, AgentReadySession, SessionOutcome, FinalizationContext, TurnEndSubscriberContext, } from './runner/index.js';
|
|
10
|
+
export { WORKTREES_DIR } from './runner/runner-types.js';
|
|
11
|
+
export { buildPreAgentSession, buildTurnEndSubscriber, buildAgentCallbacks, finalizeSession, } from './runner/index.js';
|
|
12
|
+
export { runStartupRecovery, readDaemonSessionState, readAllDaemonSessions, countOrphanStepAdvances, clearQueueIssueSidecars, } from './startup-recovery.js';
|
|
17
13
|
import { makeContinueWorkflowTool, makeCompleteStepTool } from './tools/continue-workflow.js';
|
|
18
14
|
import { makeBashTool } from './tools/bash.js';
|
|
19
15
|
import { makeReadTool, makeWriteTool, makeEditTool } from './tools/file-tools.js';
|
|
@@ -24,269 +20,9 @@ import { makeSignalCoordinatorTool } from './tools/signal-coordinator.js';
|
|
|
24
20
|
export { DAEMON_SESSIONS_DIR, type PersistTokensError } from './tools/_shared.js';
|
|
25
21
|
export { DAEMON_SIGNALS_DIR } from './tools/signal-coordinator.js';
|
|
26
22
|
export { makeContinueWorkflowTool, makeCompleteStepTool, makeBashTool, makeReadTool, makeWriteTool, makeEditTool, makeGlobTool, makeGrepTool, makeSpawnAgentTool, makeReportIssueTool, makeSignalCoordinatorTool, };
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
export {
|
|
32
|
-
export
|
|
33
|
-
content: string;
|
|
34
|
-
timestamp: number;
|
|
35
|
-
isPartialView: boolean;
|
|
36
|
-
};
|
|
37
|
-
export interface WorkflowTrigger {
|
|
38
|
-
readonly workflowId: string;
|
|
39
|
-
readonly goal: string;
|
|
40
|
-
readonly workspacePath: string;
|
|
41
|
-
readonly context?: Readonly<Record<string, unknown>>;
|
|
42
|
-
readonly referenceUrls?: readonly string[];
|
|
43
|
-
readonly agentConfig?: {
|
|
44
|
-
readonly model?: string;
|
|
45
|
-
readonly maxSessionMinutes?: number;
|
|
46
|
-
readonly maxTurns?: number;
|
|
47
|
-
readonly maxOutputTokens?: number;
|
|
48
|
-
readonly maxSubagentDepth?: number;
|
|
49
|
-
readonly stuckAbortPolicy?: 'abort' | 'notify_only';
|
|
50
|
-
readonly noProgressAbortEnabled?: boolean;
|
|
51
|
-
readonly stallTimeoutSeconds?: number;
|
|
52
|
-
};
|
|
53
|
-
readonly parentSessionId?: string;
|
|
54
|
-
readonly spawnDepth?: number;
|
|
55
|
-
readonly soulFile?: string;
|
|
56
|
-
readonly botIdentity?: {
|
|
57
|
-
readonly name: string;
|
|
58
|
-
readonly email: string;
|
|
59
|
-
};
|
|
60
|
-
readonly branchStrategy?: 'worktree' | 'none';
|
|
61
|
-
readonly baseBranch?: string;
|
|
62
|
-
readonly branchPrefix?: string;
|
|
63
|
-
}
|
|
64
|
-
export interface AllocatedSession {
|
|
65
|
-
readonly continueToken: string;
|
|
66
|
-
readonly checkpointToken?: string | null;
|
|
67
|
-
readonly firstStepPrompt: string;
|
|
68
|
-
readonly isComplete: boolean;
|
|
69
|
-
readonly triggerSource: 'daemon' | 'mcp';
|
|
70
|
-
readonly sessionWorkspacePath?: string;
|
|
71
|
-
}
|
|
72
|
-
export type SessionSource = {
|
|
73
|
-
readonly kind: 'allocate';
|
|
74
|
-
readonly trigger: WorkflowTrigger;
|
|
75
|
-
} | {
|
|
76
|
-
readonly kind: 'pre_allocated';
|
|
77
|
-
readonly trigger: WorkflowTrigger;
|
|
78
|
-
readonly session: AllocatedSession;
|
|
79
|
-
};
|
|
80
|
-
export interface WorkflowRunSuccess {
|
|
81
|
-
readonly _tag: 'success';
|
|
82
|
-
readonly workflowId: string;
|
|
83
|
-
readonly stopReason: string;
|
|
84
|
-
readonly lastStepNotes?: string;
|
|
85
|
-
readonly lastStepArtifacts?: readonly unknown[];
|
|
86
|
-
readonly sessionWorkspacePath?: string;
|
|
87
|
-
readonly sessionId?: string;
|
|
88
|
-
readonly botIdentity?: {
|
|
89
|
-
readonly name: string;
|
|
90
|
-
readonly email: string;
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
export interface WorkflowRunError {
|
|
94
|
-
readonly _tag: 'error';
|
|
95
|
-
readonly workflowId: string;
|
|
96
|
-
readonly message: string;
|
|
97
|
-
readonly stopReason: string;
|
|
98
|
-
readonly lastStepNotes?: string;
|
|
99
|
-
}
|
|
100
|
-
export interface WorkflowRunTimeout {
|
|
101
|
-
readonly _tag: 'timeout';
|
|
102
|
-
readonly workflowId: string;
|
|
103
|
-
readonly reason: 'wall_clock' | 'max_turns';
|
|
104
|
-
readonly message: string;
|
|
105
|
-
readonly stopReason: string;
|
|
106
|
-
}
|
|
107
|
-
export interface WorkflowRunStuck {
|
|
108
|
-
readonly _tag: 'stuck';
|
|
109
|
-
readonly workflowId: string;
|
|
110
|
-
readonly reason: 'repeated_tool_call' | 'no_progress' | 'stall';
|
|
111
|
-
readonly message: string;
|
|
112
|
-
readonly stopReason: string;
|
|
113
|
-
readonly issueSummaries?: readonly string[];
|
|
114
|
-
}
|
|
115
|
-
export interface WorkflowDeliveryFailed {
|
|
116
|
-
readonly _tag: 'delivery_failed';
|
|
117
|
-
readonly workflowId: string;
|
|
118
|
-
readonly stopReason: string;
|
|
119
|
-
readonly deliveryError: string;
|
|
120
|
-
}
|
|
121
|
-
export type WorkflowRunResult = WorkflowRunSuccess | WorkflowRunError | WorkflowRunTimeout | WorkflowRunStuck | WorkflowDeliveryFailed;
|
|
122
|
-
export type ChildWorkflowRunResult = WorkflowRunSuccess | WorkflowRunError | WorkflowRunTimeout | WorkflowRunStuck;
|
|
123
|
-
export interface OrphanedSession {
|
|
124
|
-
readonly sessionId: string;
|
|
125
|
-
readonly continueToken: string;
|
|
126
|
-
readonly checkpointToken: string | null;
|
|
127
|
-
readonly ts: number;
|
|
128
|
-
readonly worktreePath?: string;
|
|
129
|
-
readonly workflowId?: string;
|
|
130
|
-
readonly goal?: string;
|
|
131
|
-
readonly workspacePath?: string;
|
|
132
|
-
}
|
|
133
|
-
export declare function readDaemonSessionState(sessionId: string): Promise<{
|
|
134
|
-
continueToken: string;
|
|
135
|
-
checkpointToken: string | null;
|
|
136
|
-
} | null>;
|
|
137
|
-
export declare function readAllDaemonSessions(sessionsDir?: string): Promise<OrphanedSession[]>;
|
|
138
|
-
export declare function runStartupRecovery(sessionsDir?: string, execFn?: (file: string, args: string[]) => Promise<{
|
|
139
|
-
stdout: string;
|
|
140
|
-
stderr: string;
|
|
141
|
-
}>, ctx?: V2ToolContext, _countStepAdvancesFn?: typeof countOrphanStepAdvances, _executeContinueWorkflowFn?: typeof executeContinueWorkflow, _runWorkflowFn?: typeof runWorkflow, apiKey?: string): Promise<void>;
|
|
142
|
-
export declare function countOrphanStepAdvances(continueToken: string, ctx: V2ToolContext, _parseFn?: ((raw: string) => ResultAsync<ContinueTokenResolved, ToolFailure>) | undefined, _loadFn?: SessionEventLogReadonlyStorePortV2['loadValidatedPrefix'] | undefined): Promise<number>;
|
|
143
|
-
export declare function clearQueueIssueSidecars(sessionsDir: string): Promise<void>;
|
|
144
|
-
export declare function stripFrontmatter(content: string): string;
|
|
145
|
-
export declare function loadWorkspaceContext(workspacePath: string): Promise<string | null>;
|
|
146
|
-
export declare function loadSessionNotes(continueToken: string, ctx: V2ToolContext): Promise<readonly string[]>;
|
|
147
|
-
export declare function buildSessionRecap(notes: readonly string[]): string;
|
|
148
|
-
export declare function buildSystemPrompt(trigger: WorkflowTrigger, sessionState: string, soulContent: string, workspaceContext: string | null, effectiveWorkspacePath: string): string;
|
|
149
|
-
export declare function tagToStatsOutcome(tag: WorkflowRunResult['_tag']): 'success' | 'error' | 'timeout' | 'stuck';
|
|
150
|
-
export type SidecarLifecycle = {
|
|
151
|
-
readonly kind: 'delete_now';
|
|
152
|
-
} | {
|
|
153
|
-
readonly kind: 'retain_for_delivery';
|
|
154
|
-
};
|
|
155
|
-
export declare function sidecardLifecycleFor(tag: WorkflowRunResult['_tag'], branchStrategy: WorkflowTrigger['branchStrategy']): SidecarLifecycle;
|
|
156
|
-
export declare function buildAgentClient(trigger: WorkflowTrigger, apiKey: string, env: NodeJS.ProcessEnv): {
|
|
157
|
-
agentClient: Anthropic | AnthropicBedrock;
|
|
158
|
-
modelId: string;
|
|
159
|
-
};
|
|
160
|
-
export type TerminalSignal = {
|
|
161
|
-
readonly kind: 'stuck';
|
|
162
|
-
readonly reason: 'repeated_tool_call' | 'no_progress' | 'stall';
|
|
163
|
-
} | {
|
|
164
|
-
readonly kind: 'timeout';
|
|
165
|
-
readonly reason: 'wall_clock' | 'max_turns';
|
|
166
|
-
};
|
|
167
|
-
export declare function setTerminalSignal(state: SessionState, signal: TerminalSignal): boolean;
|
|
168
|
-
export interface SessionState {
|
|
169
|
-
isComplete: boolean;
|
|
170
|
-
lastStepNotes: string | undefined;
|
|
171
|
-
lastStepArtifacts: readonly unknown[] | undefined;
|
|
172
|
-
currentContinueToken: string;
|
|
173
|
-
workrailSessionId: string | null;
|
|
174
|
-
stepAdvanceCount: number;
|
|
175
|
-
lastNToolCalls: Array<{
|
|
176
|
-
toolName: string;
|
|
177
|
-
argsSummary: string;
|
|
178
|
-
}>;
|
|
179
|
-
issueSummaries: string[];
|
|
180
|
-
pendingSteerParts: string[];
|
|
181
|
-
terminalSignal: TerminalSignal | null;
|
|
182
|
-
turnCount: number;
|
|
183
|
-
}
|
|
184
|
-
export declare function createSessionState(initialToken: string): SessionState;
|
|
185
|
-
export interface StuckConfig {
|
|
186
|
-
maxTurns: number;
|
|
187
|
-
stuckAbortPolicy: 'abort' | 'notify_only';
|
|
188
|
-
noProgressAbortEnabled: boolean;
|
|
189
|
-
stuckRepeatThreshold: number;
|
|
190
|
-
}
|
|
191
|
-
export type StuckSignal = {
|
|
192
|
-
kind: 'repeated_tool_call';
|
|
193
|
-
toolName: string;
|
|
194
|
-
argsSummary: string;
|
|
195
|
-
} | {
|
|
196
|
-
kind: 'no_progress';
|
|
197
|
-
turnCount: number;
|
|
198
|
-
maxTurns: number;
|
|
199
|
-
} | {
|
|
200
|
-
kind: 'max_turns_exceeded';
|
|
201
|
-
} | {
|
|
202
|
-
kind: 'timeout_imminent';
|
|
203
|
-
timeoutReason: 'wall_clock' | 'max_turns';
|
|
204
|
-
};
|
|
205
|
-
export declare function evaluateStuckSignals(state: Readonly<SessionState>, config: StuckConfig): StuckSignal | null;
|
|
206
|
-
export interface PreAgentSession {
|
|
207
|
-
readonly sessionId: string;
|
|
208
|
-
readonly workrailSessionId: string | null;
|
|
209
|
-
readonly continueToken: string;
|
|
210
|
-
readonly checkpointToken: string | null;
|
|
211
|
-
readonly sessionWorkspacePath: string;
|
|
212
|
-
readonly sessionWorktreePath: string | undefined;
|
|
213
|
-
readonly firstStepPrompt: string;
|
|
214
|
-
readonly state: SessionState;
|
|
215
|
-
readonly spawnCurrentDepth: number;
|
|
216
|
-
readonly spawnMaxDepth: number;
|
|
217
|
-
readonly readFileState: Map<string, ReadFileState>;
|
|
218
|
-
readonly agentClient: Anthropic | AnthropicBedrock;
|
|
219
|
-
readonly modelId: string;
|
|
220
|
-
readonly startMs: number;
|
|
221
|
-
readonly handle?: SessionHandle;
|
|
222
|
-
}
|
|
223
|
-
export type PreAgentSessionResult = {
|
|
224
|
-
readonly kind: 'ready';
|
|
225
|
-
readonly session: PreAgentSession;
|
|
226
|
-
} | {
|
|
227
|
-
readonly kind: 'complete';
|
|
228
|
-
readonly result: WorkflowRunResult;
|
|
229
|
-
readonly workrailSessionId: string | null;
|
|
230
|
-
readonly handle: SessionHandle | undefined;
|
|
231
|
-
};
|
|
232
|
-
export interface AgentReadySession {
|
|
233
|
-
readonly preAgentSession: PreAgentSession;
|
|
234
|
-
readonly contextBundle: import('./context-loader.js').ContextBundle;
|
|
235
|
-
readonly scope: SessionScope;
|
|
236
|
-
readonly tools: readonly AgentTool[];
|
|
237
|
-
readonly sessionCtx: SessionContext;
|
|
238
|
-
readonly handle: import('./active-sessions.js').SessionHandle | undefined;
|
|
239
|
-
readonly sessionId: string;
|
|
240
|
-
readonly workflowId: string;
|
|
241
|
-
readonly worktreePath: string | undefined;
|
|
242
|
-
readonly agent: AgentLoop;
|
|
243
|
-
readonly stuckRepeatThreshold: number;
|
|
244
|
-
}
|
|
245
|
-
export type SessionOutcome = {
|
|
246
|
-
readonly kind: 'completed';
|
|
247
|
-
readonly stopReason: string;
|
|
248
|
-
readonly errorMessage?: string;
|
|
249
|
-
} | {
|
|
250
|
-
readonly kind: 'aborted';
|
|
251
|
-
readonly errorMessage?: string;
|
|
252
|
-
};
|
|
253
|
-
export interface FinalizationContext {
|
|
254
|
-
readonly sessionId: string;
|
|
255
|
-
readonly workrailSessionId: string | null;
|
|
256
|
-
readonly startMs: number;
|
|
257
|
-
readonly stepAdvanceCount: number;
|
|
258
|
-
readonly branchStrategy: 'worktree' | 'none' | undefined;
|
|
259
|
-
readonly statsDir: string;
|
|
260
|
-
readonly sessionsDir: string;
|
|
261
|
-
readonly conversationPath: string;
|
|
262
|
-
readonly emitter: DaemonEventEmitter | undefined;
|
|
263
|
-
readonly daemonRegistry: DaemonRegistry | undefined;
|
|
264
|
-
readonly workflowId: string;
|
|
265
|
-
}
|
|
266
|
-
export declare function finalizeSession(result: WorkflowRunResult, ctx: FinalizationContext): Promise<void>;
|
|
267
|
-
export interface SessionContext {
|
|
268
|
-
readonly systemPrompt: string;
|
|
269
|
-
readonly initialPrompt: string;
|
|
270
|
-
readonly sessionTimeoutMs: number;
|
|
271
|
-
readonly maxTurns: number;
|
|
272
|
-
readonly stallTimeoutMs: number;
|
|
273
|
-
}
|
|
274
|
-
export declare function buildSessionContext(trigger: WorkflowTrigger, context: import('./context-loader.js').ContextBundle, firstStepPrompt: string, effectiveWorkspacePath: string): SessionContext;
|
|
275
|
-
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>;
|
|
276
|
-
export interface TurnEndSubscriberContext {
|
|
277
|
-
readonly agent: AgentLoop;
|
|
278
|
-
readonly state: SessionState;
|
|
279
|
-
readonly stuckConfig: StuckConfig;
|
|
280
|
-
readonly sessionId: string;
|
|
281
|
-
readonly workflowId: string;
|
|
282
|
-
readonly emitter: DaemonEventEmitter | undefined;
|
|
283
|
-
readonly conversationPath: string;
|
|
284
|
-
readonly lastFlushedRef: {
|
|
285
|
-
count: number;
|
|
286
|
-
};
|
|
287
|
-
readonly stuckRepeatThreshold: number;
|
|
288
|
-
}
|
|
289
|
-
export declare function buildTurnEndSubscriber(ctx: TurnEndSubscriberContext): (event: AgentEvent) => Promise<void>;
|
|
290
|
-
export declare function buildAgentCallbacks(sessionId: string, state: SessionState, modelId: string, emitter: DaemonEventEmitter | undefined, stuckRepeatThreshold: number, workflowId?: string): AgentLoopCallbacks;
|
|
291
|
-
export declare function buildSessionResult(state: Readonly<SessionState>, stopReason: string, errorMessage: string | undefined, trigger: WorkflowTrigger, sessionId: string, sessionWorktreePath: string | undefined): WorkflowRunResult;
|
|
292
|
-
export declare function runWorkflow(trigger: WorkflowTrigger, ctx: V2ToolContext, apiKey: string, daemonRegistry?: DaemonRegistry, emitter?: DaemonEventEmitter, activeSessionSet?: ActiveSessionSet, _statsDir?: string, _sessionsDir?: string, source?: SessionSource): Promise<WorkflowRunResult>;
|
|
23
|
+
export type { ReadFileState, WorkflowTrigger, AllocatedSession, SessionSource, WorkflowRunSuccess, WorkflowRunError, WorkflowRunTimeout, WorkflowRunStuck, WorkflowDeliveryFailed, WorkflowRunResult, ChildWorkflowRunResult, OrphanedSession, } from './types.js';
|
|
24
|
+
export type { SessionState, TerminalSignal, StuckConfig, StuckSignal } from './state/index.js';
|
|
25
|
+
export { createSessionState, setTerminalSignal, evaluateStuckSignals, advanceStep, recordCompletion, updateToken, setSessionId, recordToolCall, } from './state/index.js';
|
|
26
|
+
export type { SessionContext, SidecarLifecycle } from './core/index.js';
|
|
27
|
+
export { BASE_SYSTEM_PROMPT, buildSessionRecap, buildSystemPrompt, DEFAULT_SESSION_TIMEOUT_MINUTES, DEFAULT_MAX_TURNS, DEFAULT_STALL_TIMEOUT_SECONDS, buildSessionContext, tagToStatsOutcome, sidecardLifecycleFor, buildSessionResult, buildAgentClient, } from './core/index.js';
|
|
28
|
+
export declare function runWorkflow(trigger: WorkflowTrigger, ctx: V2ToolContext, apiKey: string, daemonRegistry?: DaemonRegistry, emitter?: DaemonEventEmitter, activeSessionSet?: ActiveSessionSet, _statsDir?: string, _sessionsDir?: string, source?: SessionSource, enricherDeps?: WorkflowEnricherDeps): Promise<WorkflowRunResult>;
|