@exaudeus/workrail 3.32.0 → 3.34.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 +1 -0
- package/dist/cli/commands/index.js +3 -1
- package/dist/cli/commands/worktrain-await.js +11 -9
- package/dist/cli/commands/worktrain-daemon-install.d.ts +35 -0
- package/dist/cli/commands/worktrain-daemon-install.js +291 -0
- package/dist/cli/commands/worktrain-daemon.d.ts +31 -0
- package/dist/cli/commands/worktrain-daemon.js +272 -0
- package/dist/cli/commands/worktrain-spawn.js +11 -9
- package/dist/cli-worktrain.js +488 -0
- package/dist/cli.js +1 -22
- package/dist/console/standalone-console.d.ts +28 -0
- package/dist/console/standalone-console.js +142 -0
- package/dist/{console/assets/index-Cb_LO718.js → console-ui/assets/index-C1JXnwZS.js} +1 -1
- package/dist/{console → console-ui}/index.html +1 -1
- package/dist/daemon/agent-loop.d.ts +27 -0
- package/dist/daemon/agent-loop.js +39 -1
- package/dist/daemon/daemon-events.d.ts +63 -1
- package/dist/daemon/workflow-runner.d.ts +3 -2
- package/dist/daemon/workflow-runner.js +285 -46
- package/dist/infrastructure/session/HttpServer.js +133 -34
- package/dist/manifest.json +136 -104
- package/dist/mcp/handlers/v2-error-mapping.d.ts +3 -0
- package/dist/mcp/handlers/v2-error-mapping.js +2 -0
- package/dist/mcp/handlers/v2-execution/advance.js +25 -0
- package/dist/mcp/handlers/v2-execution/continue-advance.js +7 -0
- package/dist/mcp/output-schemas.d.ts +30 -30
- package/dist/mcp/transports/fatal-exit.js +4 -0
- package/dist/mcp/transports/http-entry.js +0 -5
- package/dist/mcp/transports/stdio-entry.js +24 -12
- package/dist/mcp/v2/tools.d.ts +4 -4
- package/dist/mcp-server.d.ts +0 -2
- package/dist/mcp-server.js +1 -42
- package/dist/trigger/adapters/github-poller.d.ts +44 -0
- package/dist/trigger/adapters/github-poller.js +190 -0
- package/dist/trigger/adapters/gitlab-poller.d.ts +27 -0
- package/dist/trigger/adapters/gitlab-poller.js +81 -0
- package/dist/trigger/index.d.ts +4 -1
- package/dist/trigger/index.js +5 -1
- package/dist/trigger/polled-event-store.d.ts +22 -0
- package/dist/trigger/polled-event-store.js +173 -0
- package/dist/trigger/polling-scheduler.d.ts +20 -0
- package/dist/trigger/polling-scheduler.js +249 -0
- package/dist/trigger/trigger-listener.d.ts +3 -0
- package/dist/trigger/trigger-listener.js +47 -3
- package/dist/trigger/trigger-store.js +114 -33
- package/dist/trigger/types.d.ts +17 -1
- package/dist/v2/durable-core/domain/observation-builder.d.ts +3 -0
- package/dist/v2/durable-core/domain/observation-builder.js +2 -2
- package/dist/v2/durable-core/domain/prompt-renderer.d.ts +2 -1
- package/dist/v2/durable-core/domain/prompt-renderer.js +10 -0
- package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +224 -224
- package/dist/v2/durable-core/schemas/session/events.d.ts +42 -42
- package/dist/v2/durable-core/schemas/session/manifest.d.ts +6 -6
- package/dist/v2/durable-core/schemas/session/validation-event.d.ts +2 -2
- package/dist/v2/durable-core/tokens/payloads.d.ts +52 -52
- package/dist/v2/usecases/console-routes.js +3 -3
- package/dist/v2/usecases/console-service.js +185 -10
- package/dist/v2/usecases/console-types.d.ts +8 -0
- package/docs/design/bridge-removal-pr-a-candidates.md +115 -0
- package/docs/design/bridge-removal-pr-a-design-review.md +79 -0
- package/docs/design/bridge-removal-pr-a-implementation-plan.md +203 -0
- package/docs/design/daemon-conversation-logging-plan.md +98 -0
- package/docs/design/daemon-conversation-logging-review.md +55 -0
- package/docs/design/daemon-conversation-logging.md +129 -0
- package/docs/design/github-polling-adapter-design-candidates.md +226 -0
- package/docs/design/github-polling-adapter-design-review-findings.md +131 -0
- package/docs/design/github-polling-adapter-implementation-plan.md +284 -0
- package/docs/design/implementation_plan.md +192 -0
- package/docs/design/workflow-id-validation-at-startup.md +146 -0
- package/docs/design/workflow-id-validation-design-review.md +87 -0
- package/docs/design/workflow-id-validation-implementation-plan.md +185 -0
- package/docs/design/worktrain-system-prompt-report-issue-candidates.md +135 -0
- package/docs/design/worktrain-system-prompt-report-issue-design-review.md +73 -0
- package/docs/discovery/design-candidates.md +180 -0
- package/docs/discovery/design-review-findings.md +110 -0
- package/docs/discovery/wr-discovery-goal-reframing.md +303 -0
- package/docs/ideas/backlog.md +627 -0
- package/package.json +1 -1
- package/workflows/architecture-scalability-audit.json +1 -1
- package/workflows/bug-investigation.agentic.v2.json +3 -3
- package/workflows/coding-task-workflow-agentic.json +32 -32
- package/workflows/coding-task-workflow-agentic.lean.v2.json +1 -1
- package/workflows/coding-task-workflow-agentic.v2.json +7 -7
- package/workflows/mr-review-workflow.agentic.v2.json +21 -12
- package/workflows/personal-learning-materials-creation-branched.json +2 -2
- package/workflows/production-readiness-audit.json +1 -1
- package/workflows/relocation-workflow-us.json +2 -2
- package/workflows/ui-ux-design-workflow.json +14 -14
- package/workflows/workflow-for-workflows.json +3 -3
- package/workflows/workflow-for-workflows.v2.json +2 -2
- package/workflows/wr.discovery.json +59 -8
- package/dist/mcp/transports/bridge-entry.d.ts +0 -102
- package/dist/mcp/transports/bridge-entry.js +0 -454
- package/dist/mcp/transports/bridge-events.d.ts +0 -51
- package/dist/mcp/transports/bridge-events.js +0 -24
- package/dist/mcp/transports/primary-tombstone.d.ts +0 -21
- package/dist/mcp/transports/primary-tombstone.js +0 -51
- /package/dist/{console → console-ui}/assets/index-8dh0Psu-.css +0 -0
|
@@ -43,7 +43,7 @@ class AgentLoop {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
async _runLoop() {
|
|
46
|
-
const { client, modelId, systemPrompt, tools, maxTokens = 8192 } = this._options;
|
|
46
|
+
const { client, modelId, systemPrompt, tools, maxTokens = 8192, callbacks } = this._options;
|
|
47
47
|
while (true) {
|
|
48
48
|
if (this._aborted || this._abortController.signal.aborted) {
|
|
49
49
|
this._appendErrorMessage('aborted');
|
|
@@ -56,6 +56,10 @@ class AgentLoop {
|
|
|
56
56
|
description: t.description,
|
|
57
57
|
input_schema: t.inputSchema,
|
|
58
58
|
}));
|
|
59
|
+
try {
|
|
60
|
+
callbacks?.onLlmTurnStarted?.({ messageCount: apiMessages.length, modelId });
|
|
61
|
+
}
|
|
62
|
+
catch { }
|
|
59
63
|
let response;
|
|
60
64
|
try {
|
|
61
65
|
response = await client.messages.create({
|
|
@@ -74,6 +78,20 @@ class AgentLoop {
|
|
|
74
78
|
await this._emitEvent({ type: 'agent_end' });
|
|
75
79
|
return;
|
|
76
80
|
}
|
|
81
|
+
{
|
|
82
|
+
const toolNamesRequested = response.content
|
|
83
|
+
.filter((block) => block.type === 'tool_use')
|
|
84
|
+
.map((block) => block.name);
|
|
85
|
+
try {
|
|
86
|
+
callbacks?.onLlmTurnCompleted?.({
|
|
87
|
+
stopReason: response.stop_reason ?? 'unknown',
|
|
88
|
+
outputTokens: response.usage.output_tokens,
|
|
89
|
+
inputTokens: response.usage.input_tokens,
|
|
90
|
+
toolNamesRequested,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
catch { }
|
|
94
|
+
}
|
|
77
95
|
const stopReason = this._mapStopReason(response.stop_reason);
|
|
78
96
|
const assistantMsg = {
|
|
79
97
|
role: 'assistant',
|
|
@@ -116,6 +134,7 @@ class AgentLoop {
|
|
|
116
134
|
}
|
|
117
135
|
}
|
|
118
136
|
async _executeTools(toolUseBlocks) {
|
|
137
|
+
const { callbacks } = this._options;
|
|
119
138
|
const results = [];
|
|
120
139
|
for (const block of toolUseBlocks) {
|
|
121
140
|
if (this._abortController.signal.aborted) {
|
|
@@ -141,12 +160,23 @@ class AgentLoop {
|
|
|
141
160
|
continue;
|
|
142
161
|
}
|
|
143
162
|
const params = (block.input ?? {});
|
|
163
|
+
const argsSummary = JSON.stringify(params).slice(0, 200);
|
|
164
|
+
try {
|
|
165
|
+
callbacks?.onToolCallStarted?.({ toolName: block.name, argsSummary });
|
|
166
|
+
}
|
|
167
|
+
catch { }
|
|
168
|
+
const toolStartMs = Date.now();
|
|
144
169
|
let result;
|
|
145
170
|
try {
|
|
146
171
|
result = await tool.execute(block.id, params);
|
|
147
172
|
}
|
|
148
173
|
catch (err) {
|
|
174
|
+
const durationMs = Date.now() - toolStartMs;
|
|
149
175
|
const message = err instanceof Error ? err.message : String(err);
|
|
176
|
+
try {
|
|
177
|
+
callbacks?.onToolCallFailed?.({ toolName: block.name, durationMs, errorMessage: message.slice(0, 200) });
|
|
178
|
+
}
|
|
179
|
+
catch { }
|
|
150
180
|
results.push({
|
|
151
181
|
toolCallId: block.id,
|
|
152
182
|
toolName: block.name,
|
|
@@ -155,6 +185,14 @@ class AgentLoop {
|
|
|
155
185
|
});
|
|
156
186
|
continue;
|
|
157
187
|
}
|
|
188
|
+
{
|
|
189
|
+
const durationMs = Date.now() - toolStartMs;
|
|
190
|
+
const resultSummary = (result.content[0]?.text ?? '(no output)').slice(0, 200);
|
|
191
|
+
try {
|
|
192
|
+
callbacks?.onToolCallCompleted?.({ toolName: block.name, durationMs, resultSummary });
|
|
193
|
+
}
|
|
194
|
+
catch { }
|
|
195
|
+
}
|
|
158
196
|
results.push({
|
|
159
197
|
toolCallId: block.id,
|
|
160
198
|
toolName: block.name,
|
|
@@ -18,22 +18,26 @@ export interface SessionStartedEvent {
|
|
|
18
18
|
readonly sessionId: string;
|
|
19
19
|
readonly workflowId: string;
|
|
20
20
|
readonly workspacePath: string;
|
|
21
|
+
readonly workrailSessionId?: string;
|
|
21
22
|
}
|
|
22
23
|
export interface ToolCalledEvent {
|
|
23
24
|
readonly kind: 'tool_called';
|
|
24
25
|
readonly sessionId: string;
|
|
25
26
|
readonly toolName: string;
|
|
26
27
|
readonly summary?: string;
|
|
28
|
+
readonly workrailSessionId?: string;
|
|
27
29
|
}
|
|
28
30
|
export interface ToolErrorEvent {
|
|
29
31
|
readonly kind: 'tool_error';
|
|
30
32
|
readonly sessionId: string;
|
|
31
33
|
readonly toolName: string;
|
|
32
34
|
readonly error: string;
|
|
35
|
+
readonly workrailSessionId?: string;
|
|
33
36
|
}
|
|
34
37
|
export interface StepAdvancedEvent {
|
|
35
38
|
readonly kind: 'step_advanced';
|
|
36
39
|
readonly sessionId: string;
|
|
40
|
+
readonly workrailSessionId?: string;
|
|
37
41
|
}
|
|
38
42
|
export interface SessionCompletedEvent {
|
|
39
43
|
readonly kind: 'session_completed';
|
|
@@ -41,6 +45,7 @@ export interface SessionCompletedEvent {
|
|
|
41
45
|
readonly workflowId: string;
|
|
42
46
|
readonly outcome: 'success' | 'error' | 'timeout';
|
|
43
47
|
readonly detail?: string;
|
|
48
|
+
readonly workrailSessionId?: string;
|
|
44
49
|
}
|
|
45
50
|
export interface DeliveryAttemptedEvent {
|
|
46
51
|
readonly kind: 'delivery_attempted';
|
|
@@ -48,7 +53,64 @@ export interface DeliveryAttemptedEvent {
|
|
|
48
53
|
readonly outcome: 'success' | 'http_error' | 'network_error';
|
|
49
54
|
readonly statusCode?: number;
|
|
50
55
|
}
|
|
51
|
-
export
|
|
56
|
+
export interface IssueReportedEvent {
|
|
57
|
+
readonly kind: 'issue_reported';
|
|
58
|
+
readonly sessionId: string;
|
|
59
|
+
readonly issueKind: 'tool_failure' | 'blocked' | 'unexpected_behavior' | 'needs_human' | 'self_correction';
|
|
60
|
+
readonly severity: 'info' | 'warn' | 'error' | 'fatal';
|
|
61
|
+
readonly summary: string;
|
|
62
|
+
readonly continueToken?: string;
|
|
63
|
+
readonly workrailSessionId?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface LlmTurnStartedEvent {
|
|
66
|
+
readonly kind: 'llm_turn_started';
|
|
67
|
+
readonly sessionId: string;
|
|
68
|
+
readonly messageCount: number;
|
|
69
|
+
readonly modelId?: string;
|
|
70
|
+
readonly workrailSessionId?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface LlmTurnCompletedEvent {
|
|
73
|
+
readonly kind: 'llm_turn_completed';
|
|
74
|
+
readonly sessionId: string;
|
|
75
|
+
readonly stopReason: string;
|
|
76
|
+
readonly outputTokens: number;
|
|
77
|
+
readonly inputTokens: number;
|
|
78
|
+
readonly toolNamesRequested: readonly string[];
|
|
79
|
+
readonly workrailSessionId?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ToolCallStartedEvent {
|
|
82
|
+
readonly kind: 'tool_call_started';
|
|
83
|
+
readonly sessionId: string;
|
|
84
|
+
readonly toolName: string;
|
|
85
|
+
readonly argsSummary: string;
|
|
86
|
+
readonly workrailSessionId?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface ToolCallCompletedEvent {
|
|
89
|
+
readonly kind: 'tool_call_completed';
|
|
90
|
+
readonly sessionId: string;
|
|
91
|
+
readonly toolName: string;
|
|
92
|
+
readonly durationMs: number;
|
|
93
|
+
readonly resultSummary: string;
|
|
94
|
+
readonly workrailSessionId?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface ToolCallFailedEvent {
|
|
97
|
+
readonly kind: 'tool_call_failed';
|
|
98
|
+
readonly sessionId: string;
|
|
99
|
+
readonly toolName: string;
|
|
100
|
+
readonly durationMs: number;
|
|
101
|
+
readonly errorMessage: string;
|
|
102
|
+
readonly workrailSessionId?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface AgentStuckEvent {
|
|
105
|
+
readonly kind: 'agent_stuck';
|
|
106
|
+
readonly sessionId: string;
|
|
107
|
+
readonly reason: 'repeated_tool_call' | 'no_progress' | 'timeout_imminent';
|
|
108
|
+
readonly detail: string;
|
|
109
|
+
readonly toolName?: string;
|
|
110
|
+
readonly argsSummary?: string;
|
|
111
|
+
readonly workrailSessionId?: string;
|
|
112
|
+
}
|
|
113
|
+
export type DaemonEvent = DaemonStartedEvent | TriggerFiredEvent | SessionQueuedEvent | SessionStartedEvent | ToolCalledEvent | ToolErrorEvent | StepAdvancedEvent | SessionCompletedEvent | DeliveryAttemptedEvent | IssueReportedEvent | LlmTurnStartedEvent | LlmTurnCompletedEvent | ToolCallStartedEvent | ToolCallCompletedEvent | ToolCallFailedEvent | AgentStuckEvent;
|
|
52
114
|
export declare class DaemonEventEmitter {
|
|
53
115
|
private readonly _dir;
|
|
54
116
|
constructor(dirOverride?: string);
|
|
@@ -60,8 +60,9 @@ export declare function readDaemonSessionState(sessionId: string): Promise<{
|
|
|
60
60
|
} | null>;
|
|
61
61
|
export declare function readAllDaemonSessions(sessionsDir?: string): Promise<OrphanedSession[]>;
|
|
62
62
|
export declare function runStartupRecovery(sessionsDir?: string): Promise<void>;
|
|
63
|
-
export declare function makeContinueWorkflowTool(sessionId: string, ctx: V2ToolContext, onAdvance: (nextStepText: string, continueToken: string) => void, onComplete: (notes: string | undefined) => void, schemas: Record<string, any>, _executeContinueWorkflowFn?: typeof executeContinueWorkflow, emitter?: DaemonEventEmitter): AgentTool;
|
|
64
|
-
export declare function makeBashTool(workspacePath: string, schemas: Record<string, any>, sessionId?: string, emitter?: DaemonEventEmitter): AgentTool;
|
|
63
|
+
export declare function makeContinueWorkflowTool(sessionId: string, ctx: V2ToolContext, onAdvance: (nextStepText: string, continueToken: string) => void, onComplete: (notes: string | undefined) => void, schemas: Record<string, any>, _executeContinueWorkflowFn?: typeof executeContinueWorkflow, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
|
|
64
|
+
export declare function makeBashTool(workspacePath: string, schemas: Record<string, any>, sessionId?: string, emitter?: DaemonEventEmitter, workrailSessionId?: string | null): AgentTool;
|
|
65
|
+
export declare function makeReportIssueTool(sessionId: string, emitter?: DaemonEventEmitter, workrailSessionId?: string | null, issuesDirOverride?: string, onIssueSummary?: (summary: string) => void): AgentTool;
|
|
65
66
|
export declare function buildSessionRecap(notes: readonly string[]): string;
|
|
66
67
|
export declare function buildSystemPrompt(trigger: WorkflowTrigger, sessionState: string, soulContent: string, workspaceContext: string | null): string;
|
|
67
68
|
export declare function runWorkflow(trigger: WorkflowTrigger, ctx: V2ToolContext, apiKey: string, daemonRegistry?: DaemonRegistry, emitter?: DaemonEventEmitter): Promise<WorkflowRunResult>;
|