@exaudeus/workrail 3.24.4 → 3.26.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.
- package/dist/cli/commands/index.d.ts +6 -0
- package/dist/cli/commands/index.js +14 -1
- package/dist/cli/commands/version.d.ts +6 -0
- package/dist/cli/commands/version.js +14 -0
- package/dist/cli/commands/worktrain-await.d.ts +35 -0
- package/dist/cli/commands/worktrain-await.js +207 -0
- package/dist/cli/commands/worktrain-inbox.d.ts +23 -0
- package/dist/cli/commands/worktrain-inbox.js +82 -0
- package/dist/cli/commands/worktrain-init.d.ts +23 -0
- package/dist/cli/commands/worktrain-init.js +338 -0
- package/dist/cli/commands/worktrain-spawn.d.ts +28 -0
- package/dist/cli/commands/worktrain-spawn.js +106 -0
- package/dist/cli/commands/worktrain-tell.d.ts +25 -0
- package/dist/cli/commands/worktrain-tell.js +32 -0
- package/dist/cli-worktrain.d.ts +2 -0
- package/dist/cli-worktrain.js +169 -0
- package/dist/cli.js +100 -0
- package/dist/config/config-file.d.ts +2 -0
- package/dist/config/config-file.js +55 -0
- package/dist/console/assets/index-8dh0Psu-.css +1 -0
- package/dist/console/assets/{index-TMfptYpQ.js → index-HhtarvD5.js} +10 -10
- package/dist/console/index.html +2 -2
- package/dist/daemon/agent-loop.d.ts +90 -0
- package/dist/daemon/agent-loop.js +214 -0
- package/dist/daemon/pi-mono-loader.d.ts +0 -0
- package/dist/daemon/pi-mono-loader.js +1 -0
- package/dist/daemon/soul-template.d.ts +2 -0
- package/dist/daemon/soul-template.js +22 -0
- package/dist/daemon/workflow-runner.d.ts +63 -0
- package/dist/daemon/workflow-runner.js +689 -0
- package/dist/infrastructure/session/HttpServer.js +2 -2
- package/dist/manifest.json +226 -50
- package/dist/mcp/handlers/v2-execution/start.d.ts +2 -1
- package/dist/mcp/handlers/v2-execution/start.js +4 -3
- package/dist/mcp/output-schemas.d.ts +154 -154
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/transports/bridge-entry.js +20 -2
- package/dist/mcp/transports/bridge-events.d.ts +34 -0
- package/dist/mcp/transports/bridge-events.js +24 -0
- package/dist/mcp/transports/fatal-exit.d.ts +5 -0
- package/dist/mcp/transports/fatal-exit.js +82 -0
- package/dist/mcp/transports/http-entry.js +3 -0
- package/dist/mcp/transports/stdio-entry.js +3 -7
- package/dist/mcp/v2/tools.d.ts +7 -7
- package/dist/trigger/delivery-action.d.ts +37 -0
- package/dist/trigger/delivery-action.js +204 -0
- package/dist/trigger/delivery-client.d.ts +11 -0
- package/dist/trigger/delivery-client.js +27 -0
- package/dist/trigger/index.d.ts +5 -0
- package/dist/trigger/index.js +8 -0
- package/dist/trigger/trigger-listener.d.ts +32 -0
- package/dist/trigger/trigger-listener.js +176 -0
- package/dist/trigger/trigger-router.d.ts +38 -0
- package/dist/trigger/trigger-router.js +343 -0
- package/dist/trigger/trigger-store.d.ts +39 -0
- package/dist/trigger/trigger-store.js +698 -0
- package/dist/trigger/types.d.ts +70 -0
- package/dist/trigger/types.js +10 -0
- package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.d.ts +22 -22
- package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +114 -114
- package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +454 -454
- package/dist/v2/durable-core/schemas/session/blockers.d.ts +14 -14
- package/dist/v2/durable-core/schemas/session/events.d.ts +93 -93
- package/dist/v2/durable-core/schemas/session/gaps.d.ts +2 -2
- package/dist/v2/durable-core/schemas/session/validation-event.d.ts +4 -4
- package/dist/v2/infra/in-memory/daemon-registry/index.d.ts +14 -0
- package/dist/v2/infra/in-memory/daemon-registry/index.js +32 -0
- package/dist/v2/infra/in-memory/keyed-async-queue/index.d.ts +5 -0
- package/dist/v2/infra/in-memory/keyed-async-queue/index.js +32 -0
- package/dist/v2/usecases/console-routes.d.ts +3 -1
- package/dist/v2/usecases/console-routes.js +132 -1
- package/dist/v2/usecases/console-service.d.ts +2 -0
- package/dist/v2/usecases/console-service.js +18 -2
- package/dist/v2/usecases/console-types.d.ts +2 -0
- package/package.json +6 -2
- package/spec/workflow-tags.json +1 -0
- package/workflows/classify-task-workflow.json +68 -0
- package/workflows/coding-task-workflow-agentic.lean.v2.json +43 -13
- package/workflows/workflow-for-workflows.json +4 -2
- package/workflows/workflow-for-workflows.v2.json +4 -2
- package/dist/console/assets/index-BXRk3te_.css +0 -1
- package/workflows/rich-object-contribution.json +0 -258
package/dist/console/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>WorkRail Console</title>
|
|
7
|
-
<script type="module" crossorigin src="/console/assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/console/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/console/assets/index-HhtarvD5.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/console/assets/index-8dh0Psu-.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type Anthropic from '@anthropic-ai/sdk';
|
|
2
|
+
export interface AgentClientInterface {
|
|
3
|
+
messages: {
|
|
4
|
+
create(params: Anthropic.MessageCreateParamsNonStreaming, options?: {
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
}): Promise<Anthropic.Message>;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface AgentToolResult<T> {
|
|
10
|
+
readonly content: ReadonlyArray<{
|
|
11
|
+
readonly type: 'text';
|
|
12
|
+
readonly text: string;
|
|
13
|
+
}>;
|
|
14
|
+
readonly details: T;
|
|
15
|
+
}
|
|
16
|
+
export interface AgentTool {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly description: string;
|
|
19
|
+
readonly inputSchema: Record<string, unknown>;
|
|
20
|
+
readonly label: string;
|
|
21
|
+
execute(toolCallId: string, params: Record<string, unknown>): Promise<AgentToolResult<unknown>>;
|
|
22
|
+
}
|
|
23
|
+
export type AgentEvent = {
|
|
24
|
+
readonly type: 'turn_end';
|
|
25
|
+
readonly toolResults: ReadonlyArray<AgentToolCallResult>;
|
|
26
|
+
} | {
|
|
27
|
+
readonly type: 'agent_end';
|
|
28
|
+
};
|
|
29
|
+
export interface AgentToolCallResult {
|
|
30
|
+
readonly toolCallId: string;
|
|
31
|
+
readonly toolName: string;
|
|
32
|
+
readonly result: AgentToolResult<unknown> | null;
|
|
33
|
+
readonly isError: boolean;
|
|
34
|
+
}
|
|
35
|
+
export type AgentInternalMessage = AgentInternalUserMessage | AgentInternalAssistantMessage | AgentInternalToolResultMessage;
|
|
36
|
+
export interface AgentInternalUserMessage {
|
|
37
|
+
readonly role: 'user';
|
|
38
|
+
readonly content: string;
|
|
39
|
+
readonly timestamp: number;
|
|
40
|
+
}
|
|
41
|
+
export interface AgentInternalAssistantMessage {
|
|
42
|
+
readonly role: 'assistant';
|
|
43
|
+
readonly stopReason: 'tool_use' | 'end_turn' | 'error';
|
|
44
|
+
readonly errorMessage?: string;
|
|
45
|
+
readonly content: ReadonlyArray<Anthropic.ContentBlock>;
|
|
46
|
+
}
|
|
47
|
+
export interface AgentInternalToolResultMessage {
|
|
48
|
+
readonly role: 'user';
|
|
49
|
+
readonly content: ReadonlyArray<Anthropic.ToolResultBlockParam>;
|
|
50
|
+
}
|
|
51
|
+
export interface AgentLoopOptions {
|
|
52
|
+
readonly systemPrompt: string;
|
|
53
|
+
readonly tools: readonly AgentTool[];
|
|
54
|
+
readonly client: AgentClientInterface;
|
|
55
|
+
readonly modelId: string;
|
|
56
|
+
readonly maxTokens?: number;
|
|
57
|
+
readonly toolExecution?: 'sequential';
|
|
58
|
+
}
|
|
59
|
+
export declare class AgentLoop {
|
|
60
|
+
private readonly _options;
|
|
61
|
+
private readonly _listeners;
|
|
62
|
+
private readonly _steerQueue;
|
|
63
|
+
private _messages;
|
|
64
|
+
private _abortController;
|
|
65
|
+
private _isRunning;
|
|
66
|
+
private _aborted;
|
|
67
|
+
constructor(options: AgentLoopOptions);
|
|
68
|
+
subscribe(listener: (event: AgentEvent) => Promise<void> | void): () => void;
|
|
69
|
+
steer(message: {
|
|
70
|
+
role: 'user';
|
|
71
|
+
content: string;
|
|
72
|
+
timestamp: number;
|
|
73
|
+
}): void;
|
|
74
|
+
abort(): void;
|
|
75
|
+
get state(): {
|
|
76
|
+
readonly messages: ReadonlyArray<AgentInternalMessage>;
|
|
77
|
+
};
|
|
78
|
+
prompt(message: {
|
|
79
|
+
role: 'user';
|
|
80
|
+
content: string;
|
|
81
|
+
timestamp: number;
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
private _runLoop;
|
|
84
|
+
private _executeTools;
|
|
85
|
+
private _drainSteerQueue;
|
|
86
|
+
private _emitEvent;
|
|
87
|
+
private _appendErrorMessage;
|
|
88
|
+
private _buildApiMessages;
|
|
89
|
+
private _mapStopReason;
|
|
90
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentLoop = void 0;
|
|
4
|
+
class AgentLoop {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this._listeners = [];
|
|
7
|
+
this._steerQueue = [];
|
|
8
|
+
this._messages = [];
|
|
9
|
+
this._abortController = new AbortController();
|
|
10
|
+
this._isRunning = false;
|
|
11
|
+
this._aborted = false;
|
|
12
|
+
this._options = options;
|
|
13
|
+
}
|
|
14
|
+
subscribe(listener) {
|
|
15
|
+
this._listeners.push(listener);
|
|
16
|
+
return () => {
|
|
17
|
+
const idx = this._listeners.indexOf(listener);
|
|
18
|
+
if (idx !== -1)
|
|
19
|
+
this._listeners.splice(idx, 1);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
steer(message) {
|
|
23
|
+
this._steerQueue.push({ role: 'user', content: message.content, timestamp: message.timestamp });
|
|
24
|
+
}
|
|
25
|
+
abort() {
|
|
26
|
+
this._aborted = true;
|
|
27
|
+
this._abortController.abort();
|
|
28
|
+
}
|
|
29
|
+
get state() {
|
|
30
|
+
return { messages: this._messages };
|
|
31
|
+
}
|
|
32
|
+
async prompt(message) {
|
|
33
|
+
if (!this._aborted) {
|
|
34
|
+
this._abortController = new AbortController();
|
|
35
|
+
}
|
|
36
|
+
this._isRunning = true;
|
|
37
|
+
this._messages.push({ role: 'user', content: message.content, timestamp: message.timestamp });
|
|
38
|
+
try {
|
|
39
|
+
await this._runLoop();
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
this._isRunning = false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async _runLoop() {
|
|
46
|
+
const { client, modelId, systemPrompt, tools, maxTokens = 8192 } = this._options;
|
|
47
|
+
while (true) {
|
|
48
|
+
if (this._aborted || this._abortController.signal.aborted) {
|
|
49
|
+
this._appendErrorMessage('aborted');
|
|
50
|
+
await this._emitEvent({ type: 'agent_end' });
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const apiMessages = this._buildApiMessages();
|
|
54
|
+
const apiTools = tools.map((t) => ({
|
|
55
|
+
name: t.name,
|
|
56
|
+
description: t.description,
|
|
57
|
+
input_schema: t.inputSchema,
|
|
58
|
+
}));
|
|
59
|
+
let response;
|
|
60
|
+
try {
|
|
61
|
+
response = await client.messages.create({
|
|
62
|
+
model: modelId,
|
|
63
|
+
system: systemPrompt,
|
|
64
|
+
messages: apiMessages,
|
|
65
|
+
tools: apiTools,
|
|
66
|
+
max_tokens: maxTokens,
|
|
67
|
+
}, { signal: this._abortController.signal });
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
const isAbort = this._abortController.signal.aborted ||
|
|
71
|
+
(err instanceof Error && err.name === 'AbortError');
|
|
72
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
73
|
+
this._appendErrorMessage(isAbort ? 'aborted' : message);
|
|
74
|
+
await this._emitEvent({ type: 'agent_end' });
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const stopReason = this._mapStopReason(response.stop_reason);
|
|
78
|
+
const assistantMsg = {
|
|
79
|
+
role: 'assistant',
|
|
80
|
+
stopReason,
|
|
81
|
+
content: response.content,
|
|
82
|
+
};
|
|
83
|
+
this._messages.push(assistantMsg);
|
|
84
|
+
const toolUseBlocks = response.content.filter((block) => block.type === 'tool_use');
|
|
85
|
+
if (stopReason === 'tool_use' || toolUseBlocks.length > 0) {
|
|
86
|
+
const toolResults = await this._executeTools(toolUseBlocks);
|
|
87
|
+
const toolResultBlocks = toolResults.map((r) => ({
|
|
88
|
+
type: 'tool_result',
|
|
89
|
+
tool_use_id: r.toolCallId,
|
|
90
|
+
content: r.result?.content.map((c) => ({ type: 'text', text: c.text })) ?? [
|
|
91
|
+
{ type: 'text', text: r.isError ? `Tool error: ${r.toolName}` : '(no output)' },
|
|
92
|
+
],
|
|
93
|
+
is_error: r.isError,
|
|
94
|
+
}));
|
|
95
|
+
this._messages.push({ role: 'user', content: toolResultBlocks });
|
|
96
|
+
await this._emitEvent({ type: 'turn_end', toolResults });
|
|
97
|
+
const steered = this._drainSteerQueue();
|
|
98
|
+
if (steered > 0) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (stopReason === 'end_turn') {
|
|
104
|
+
await this._emitEvent({ type: 'turn_end', toolResults: [] });
|
|
105
|
+
const steered = this._drainSteerQueue();
|
|
106
|
+
if (steered > 0) {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
await this._emitEvent({ type: 'agent_end' });
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const errorMsg = assistantMsg.errorMessage ?? `Unexpected stop_reason: ${response.stop_reason ?? 'unknown'}`;
|
|
113
|
+
this._appendErrorMessage(errorMsg);
|
|
114
|
+
await this._emitEvent({ type: 'agent_end' });
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async _executeTools(toolUseBlocks) {
|
|
119
|
+
const results = [];
|
|
120
|
+
for (const block of toolUseBlocks) {
|
|
121
|
+
if (this._abortController.signal.aborted) {
|
|
122
|
+
results.push({
|
|
123
|
+
toolCallId: block.id,
|
|
124
|
+
toolName: block.name,
|
|
125
|
+
result: null,
|
|
126
|
+
isError: true,
|
|
127
|
+
});
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const tool = this._options.tools.find((t) => t.name === block.name);
|
|
131
|
+
if (!tool) {
|
|
132
|
+
results.push({
|
|
133
|
+
toolCallId: block.id,
|
|
134
|
+
toolName: block.name,
|
|
135
|
+
result: {
|
|
136
|
+
content: [{ type: 'text', text: `Unknown tool: ${block.name}` }],
|
|
137
|
+
details: null,
|
|
138
|
+
},
|
|
139
|
+
isError: true,
|
|
140
|
+
});
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const params = (block.input ?? {});
|
|
144
|
+
const result = await tool.execute(block.id, params);
|
|
145
|
+
results.push({
|
|
146
|
+
toolCallId: block.id,
|
|
147
|
+
toolName: block.name,
|
|
148
|
+
result,
|
|
149
|
+
isError: false,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return results;
|
|
153
|
+
}
|
|
154
|
+
_drainSteerQueue() {
|
|
155
|
+
let count = 0;
|
|
156
|
+
while (this._steerQueue.length > 0) {
|
|
157
|
+
const msg = this._steerQueue.shift();
|
|
158
|
+
this._messages.push(msg);
|
|
159
|
+
count++;
|
|
160
|
+
}
|
|
161
|
+
return count;
|
|
162
|
+
}
|
|
163
|
+
async _emitEvent(event) {
|
|
164
|
+
for (const listener of this._listeners) {
|
|
165
|
+
await listener(event);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
_appendErrorMessage(errorMessage) {
|
|
169
|
+
this._messages.push({
|
|
170
|
+
role: 'assistant',
|
|
171
|
+
stopReason: 'error',
|
|
172
|
+
errorMessage,
|
|
173
|
+
content: [],
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
_buildApiMessages() {
|
|
177
|
+
const result = [];
|
|
178
|
+
for (const msg of this._messages) {
|
|
179
|
+
if (msg.role === 'assistant') {
|
|
180
|
+
const assistantMsg = msg;
|
|
181
|
+
result.push({
|
|
182
|
+
role: 'assistant',
|
|
183
|
+
content: assistantMsg.content,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
else if (msg.role === 'user') {
|
|
187
|
+
const userMsg = msg;
|
|
188
|
+
if (typeof userMsg.content === 'string') {
|
|
189
|
+
result.push({ role: 'user', content: userMsg.content });
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
result.push({
|
|
193
|
+
role: 'user',
|
|
194
|
+
content: userMsg.content,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
_mapStopReason(stopReason) {
|
|
202
|
+
switch (stopReason) {
|
|
203
|
+
case 'tool_use':
|
|
204
|
+
return 'tool_use';
|
|
205
|
+
case 'end_turn':
|
|
206
|
+
return 'end_turn';
|
|
207
|
+
case 'max_tokens':
|
|
208
|
+
return 'end_turn';
|
|
209
|
+
default:
|
|
210
|
+
return 'error';
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
exports.AgentLoop = AgentLoop;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const DAEMON_SOUL_DEFAULT = "- Write code that follows the patterns already established in the codebase\n- Never skip tests. Run existing tests before and after changes\n- Prefer small, focused changes over large rewrites\n- If a step asks you to write code, write actual code -- do not write pseudocode or placeholders\n- Commit your work when you complete a logical unit";
|
|
2
|
+
export declare const DAEMON_SOUL_TEMPLATE = "# WorkRail Daemon Soul\n#\n# This file is injected into every WorkRail Auto daemon session system prompt under\n# \"## Agent Rules and Philosophy\". Edit it to customize the agent's behavior for\n# your environment: coding conventions, commit style, tool preferences, etc.\n#\n# Changes take effect on the next daemon session -- no restart required.\n#\n# The defaults below reflect general best practices. Override them freely.\n\n- Write code that follows the patterns already established in the codebase\n- Never skip tests. Run existing tests before and after changes\n- Prefer small, focused changes over large rewrites\n- If a step asks you to write code, write actual code -- do not write pseudocode or placeholders\n- Commit your work when you complete a logical unit\n";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DAEMON_SOUL_TEMPLATE = exports.DAEMON_SOUL_DEFAULT = void 0;
|
|
4
|
+
exports.DAEMON_SOUL_DEFAULT = `\
|
|
5
|
+
- Write code that follows the patterns already established in the codebase
|
|
6
|
+
- Never skip tests. Run existing tests before and after changes
|
|
7
|
+
- Prefer small, focused changes over large rewrites
|
|
8
|
+
- If a step asks you to write code, write actual code -- do not write pseudocode or placeholders
|
|
9
|
+
- Commit your work when you complete a logical unit`;
|
|
10
|
+
exports.DAEMON_SOUL_TEMPLATE = `\
|
|
11
|
+
# WorkRail Daemon Soul
|
|
12
|
+
#
|
|
13
|
+
# This file is injected into every WorkRail Auto daemon session system prompt under
|
|
14
|
+
# "## Agent Rules and Philosophy". Edit it to customize the agent's behavior for
|
|
15
|
+
# your environment: coding conventions, commit style, tool preferences, etc.
|
|
16
|
+
#
|
|
17
|
+
# Changes take effect on the next daemon session -- no restart required.
|
|
18
|
+
#
|
|
19
|
+
# The defaults below reflect general best practices. Override them freely.
|
|
20
|
+
|
|
21
|
+
${exports.DAEMON_SOUL_DEFAULT}
|
|
22
|
+
`;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import type { AgentTool } from "./agent-loop.js";
|
|
3
|
+
import type { V2ToolContext } from '../mcp/types.js';
|
|
4
|
+
import type { DaemonRegistry } from '../v2/infra/in-memory/daemon-registry/index.js';
|
|
5
|
+
import type { V2StartWorkflowOutputSchema } from '../mcp/output-schemas.js';
|
|
6
|
+
export declare const DAEMON_SESSIONS_DIR: string;
|
|
7
|
+
export { DAEMON_SOUL_DEFAULT, DAEMON_SOUL_TEMPLATE } from './soul-template.js';
|
|
8
|
+
export interface WorkflowTrigger {
|
|
9
|
+
readonly workflowId: string;
|
|
10
|
+
readonly goal: string;
|
|
11
|
+
readonly workspacePath: string;
|
|
12
|
+
readonly context?: Readonly<Record<string, unknown>>;
|
|
13
|
+
readonly referenceUrls?: readonly string[];
|
|
14
|
+
readonly agentConfig?: {
|
|
15
|
+
readonly model?: string;
|
|
16
|
+
readonly maxSessionMinutes?: number;
|
|
17
|
+
readonly maxTurns?: number;
|
|
18
|
+
};
|
|
19
|
+
readonly _preAllocatedStartResponse?: import('zod').infer<typeof V2StartWorkflowOutputSchema>;
|
|
20
|
+
readonly soulFile?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface WorkflowRunSuccess {
|
|
23
|
+
readonly _tag: 'success';
|
|
24
|
+
readonly workflowId: string;
|
|
25
|
+
readonly stopReason: string;
|
|
26
|
+
readonly lastStepNotes?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface WorkflowRunError {
|
|
29
|
+
readonly _tag: 'error';
|
|
30
|
+
readonly workflowId: string;
|
|
31
|
+
readonly message: string;
|
|
32
|
+
readonly stopReason: string;
|
|
33
|
+
}
|
|
34
|
+
export interface WorkflowRunTimeout {
|
|
35
|
+
readonly _tag: 'timeout';
|
|
36
|
+
readonly workflowId: string;
|
|
37
|
+
readonly reason: 'wall_clock' | 'max_turns';
|
|
38
|
+
readonly message: string;
|
|
39
|
+
readonly stopReason: string;
|
|
40
|
+
}
|
|
41
|
+
export interface WorkflowDeliveryFailed {
|
|
42
|
+
readonly _tag: 'delivery_failed';
|
|
43
|
+
readonly workflowId: string;
|
|
44
|
+
readonly stopReason: string;
|
|
45
|
+
readonly deliveryError: string;
|
|
46
|
+
}
|
|
47
|
+
export type WorkflowRunResult = WorkflowRunSuccess | WorkflowRunError | WorkflowRunTimeout | WorkflowDeliveryFailed;
|
|
48
|
+
export interface OrphanedSession {
|
|
49
|
+
readonly sessionId: string;
|
|
50
|
+
readonly continueToken: string;
|
|
51
|
+
readonly checkpointToken: string | null;
|
|
52
|
+
readonly ts: number;
|
|
53
|
+
}
|
|
54
|
+
export declare function readDaemonSessionState(sessionId: string): Promise<{
|
|
55
|
+
continueToken: string;
|
|
56
|
+
checkpointToken: string | null;
|
|
57
|
+
} | null>;
|
|
58
|
+
export declare function readAllDaemonSessions(sessionsDir?: string): Promise<OrphanedSession[]>;
|
|
59
|
+
export declare function runStartupRecovery(sessionsDir?: string): Promise<void>;
|
|
60
|
+
export declare function makeBashTool(workspacePath: string, schemas: Record<string, any>): AgentTool;
|
|
61
|
+
export declare function buildSessionRecap(notes: readonly string[]): string;
|
|
62
|
+
export declare function buildSystemPrompt(trigger: WorkflowTrigger, sessionState: string, soulContent: string, workspaceContext: string | null): string;
|
|
63
|
+
export declare function runWorkflow(trigger: WorkflowTrigger, ctx: V2ToolContext, apiKey: string, daemonRegistry?: DaemonRegistry): Promise<WorkflowRunResult>;
|