@exaudeus/workrail 3.40.0 → 3.42.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/init.js +0 -3
- package/dist/cli-worktrain.js +48 -11
- package/dist/cli.js +0 -18
- package/dist/config/app-config.d.ts +0 -16
- package/dist/config/app-config.js +0 -14
- package/dist/config/config-file.js +0 -3
- package/dist/console-ui/assets/index-DGj8EsFR.css +1 -0
- package/dist/console-ui/assets/index-DwfWMKvv.js +28 -0
- package/dist/console-ui/index.html +2 -2
- package/dist/context-assembly/deps.d.ts +8 -0
- package/dist/context-assembly/deps.js +2 -0
- package/dist/context-assembly/index.d.ts +6 -0
- package/dist/context-assembly/index.js +50 -0
- package/dist/context-assembly/infra.d.ts +3 -0
- package/dist/context-assembly/infra.js +154 -0
- package/dist/context-assembly/types.d.ts +30 -0
- package/dist/context-assembly/types.js +2 -0
- package/dist/coordinators/pr-review.d.ts +20 -1
- package/dist/coordinators/pr-review.js +189 -4
- package/dist/daemon/daemon-events.d.ts +9 -1
- package/dist/daemon/soul-template.d.ts +2 -2
- package/dist/daemon/soul-template.js +11 -1
- package/dist/daemon/workflow-runner.d.ts +14 -1
- package/dist/daemon/workflow-runner.js +406 -25
- package/dist/di/container.js +1 -25
- package/dist/di/tokens.d.ts +0 -3
- package/dist/di/tokens.js +0 -3
- package/dist/domain/execution/state.d.ts +6 -6
- package/dist/engine/engine-factory.js +0 -1
- package/dist/infrastructure/console-defaults.d.ts +1 -0
- package/dist/infrastructure/console-defaults.js +4 -0
- package/dist/infrastructure/session/index.d.ts +0 -1
- package/dist/infrastructure/session/index.js +1 -3
- package/dist/manifest.json +138 -122
- package/dist/mcp/handlers/session.d.ts +1 -0
- package/dist/mcp/handlers/session.js +61 -13
- package/dist/mcp/handlers/v2-workflow.d.ts +2 -2
- package/dist/mcp/output-schemas.d.ts +234 -234
- package/dist/mcp/server.js +1 -18
- package/dist/mcp/tools.d.ts +2 -2
- package/dist/mcp/transports/http-entry.js +0 -2
- package/dist/mcp/transports/stdio-entry.js +1 -2
- package/dist/mcp/types.d.ts +0 -2
- package/dist/mcp/v2/tools.d.ts +24 -24
- package/dist/trigger/daemon-console.d.ts +2 -0
- package/dist/trigger/daemon-console.js +1 -1
- package/dist/trigger/trigger-listener.d.ts +2 -0
- package/dist/trigger/trigger-listener.js +3 -1
- package/dist/trigger/trigger-router.d.ts +4 -3
- package/dist/trigger/trigger-router.js +4 -3
- package/dist/trigger/trigger-store.js +17 -4
- package/dist/v2/durable-core/schemas/artifacts/assessment.d.ts +2 -2
- package/dist/v2/durable-core/schemas/artifacts/coordinator-signal.d.ts +2 -2
- package/dist/v2/durable-core/schemas/artifacts/loop-control.d.ts +6 -6
- package/dist/v2/durable-core/schemas/artifacts/review-verdict.d.ts +6 -6
- package/dist/v2/durable-core/schemas/compiled-workflow/index.d.ts +56 -56
- package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.d.ts +83 -83
- package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +1024 -1024
- package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +2336 -2336
- package/dist/v2/durable-core/schemas/session/dag-topology.d.ts +6 -6
- package/dist/v2/durable-core/schemas/session/events.d.ts +339 -339
- package/dist/v2/durable-core/schemas/session/gaps.d.ts +30 -30
- package/dist/v2/durable-core/schemas/session/manifest.d.ts +6 -6
- package/dist/v2/durable-core/schemas/session/outputs.d.ts +8 -8
- package/dist/v2/durable-core/schemas/session/validation-event.d.ts +3 -3
- package/dist/v2/usecases/console-routes.d.ts +2 -1
- package/dist/v2/usecases/console-routes.js +29 -5
- package/dist/v2/usecases/console-service.js +14 -0
- package/dist/v2/usecases/console-types.d.ts +1 -0
- package/docs/authoring.md +16 -16
- package/docs/design/context-assembly-design-candidates.md +199 -0
- package/docs/design/context-assembly-implementation-plan.md +211 -0
- package/docs/design/context-assembly-review-findings.md +112 -0
- package/docs/design/coordinator-message-queue-drain-plan.md +241 -0
- package/docs/design/coordinator-message-queue-drain-review.md +120 -0
- package/docs/design/coordinator-message-queue-drain.md +289 -0
- package/docs/design/shaping-workflow-external-research.md +119 -0
- package/docs/discovery/late-bound-goals-impl-plan.md +147 -0
- package/docs/discovery/late-bound-goals-review.md +82 -0
- package/docs/discovery/late-bound-goals.md +118 -0
- package/docs/discovery/steer-endpoint-design-candidates.md +288 -0
- package/docs/discovery/steer-endpoint-design-review-findings.md +104 -0
- package/docs/discovery/steer-endpoint-implementation-plan.md +284 -0
- package/docs/ideas/backlog.md +356 -0
- package/docs/ideas/design-candidates-console-session-tree-impl.md +64 -0
- package/docs/ideas/design-candidates-session-tree-view.md +196 -0
- package/docs/ideas/design-review-findings-console-session-tree-impl.md +75 -0
- package/docs/ideas/design-review-findings-session-tree-view.md +88 -0
- package/docs/ideas/implementation_plan_session_tree_view.md +238 -0
- package/package.json +2 -1
- package/spec/authoring-spec.json +16 -16
- package/spec/shape.schema.json +178 -0
- package/spec/workflow-tags.json +232 -47
- package/workflows/coding-task-workflow-agentic.json +491 -480
- package/workflows/wr.shaping.json +182 -0
- package/dist/console-ui/assets/index-8dh0Psu-.css +0 -1
- package/dist/console-ui/assets/index-CXWCAonr.js +0 -28
- package/dist/infrastructure/session/DashboardHeartbeat.d.ts +0 -8
- package/dist/infrastructure/session/DashboardHeartbeat.js +0 -39
- package/dist/infrastructure/session/DashboardLockRelease.d.ts +0 -2
- package/dist/infrastructure/session/DashboardLockRelease.js +0 -29
- package/dist/infrastructure/session/HttpServer.d.ts +0 -60
- package/dist/infrastructure/session/HttpServer.js +0 -912
- package/workflows/coding-task-workflow-agentic.lean.v2.json +0 -648
- package/workflows/coding-task-workflow-agentic.v2.json +0 -324
package/dist/mcp/server.js
CHANGED
|
@@ -59,11 +59,9 @@ async function createToolContext() {
|
|
|
59
59
|
const workflowService = container_js_1.container.resolve(tokens_js_1.DI.Services.Workflow);
|
|
60
60
|
const featureFlags = container_js_1.container.resolve(tokens_js_1.DI.Infra.FeatureFlags);
|
|
61
61
|
let sessionManager = null;
|
|
62
|
-
let httpServer = null;
|
|
63
62
|
if (featureFlags.isEnabled('sessionTools')) {
|
|
64
63
|
sessionManager = container_js_1.container.resolve(tokens_js_1.DI.Infra.SessionManager);
|
|
65
|
-
|
|
66
|
-
console.error('[FeatureFlags] Session tools enabled');
|
|
64
|
+
console.error('[FeatureFlags] Session tools enabled (use \'worktrain console\' for the dashboard UI)');
|
|
67
65
|
}
|
|
68
66
|
else {
|
|
69
67
|
console.error('[FeatureFlags] Session tools disabled (enable with WORKRAIL_ENABLE_SESSION_TOOLS=true)');
|
|
@@ -150,7 +148,6 @@ async function createToolContext() {
|
|
|
150
148
|
workflowService,
|
|
151
149
|
featureFlags,
|
|
152
150
|
sessionManager,
|
|
153
|
-
httpServer,
|
|
154
151
|
v2,
|
|
155
152
|
};
|
|
156
153
|
}
|
|
@@ -178,20 +175,6 @@ async function composeServer() {
|
|
|
178
175
|
const toolCallsPerfFile = ctx.v2?.dataDir
|
|
179
176
|
? path.join(ctx.v2.dataDir.perfDir(), 'tool-calls.jsonl')
|
|
180
177
|
: null;
|
|
181
|
-
if (ctx.v2 && ctx.httpServer && ctx.v2.dataDir && ctx.v2.directoryListing) {
|
|
182
|
-
const { ConsoleService } = await Promise.resolve().then(() => __importStar(require('../v2/usecases/console-service.js')));
|
|
183
|
-
const { mountConsoleRoutes } = await Promise.resolve().then(() => __importStar(require('../v2/usecases/console-routes.js')));
|
|
184
|
-
const consoleService = new ConsoleService({
|
|
185
|
-
directoryListing: ctx.v2.directoryListing,
|
|
186
|
-
dataDir: ctx.v2.dataDir,
|
|
187
|
-
sessionStore: ctx.v2.sessionStore,
|
|
188
|
-
snapshotStore: ctx.v2.snapshotStore,
|
|
189
|
-
pinnedWorkflowStore: ctx.v2.pinnedStore,
|
|
190
|
-
});
|
|
191
|
-
ctx.httpServer.mountRoutes((app) => mountConsoleRoutes(app, consoleService, ctx.workflowService, timingRingBuffer, toolCallsPerfFile ?? undefined, serverVersion, ctx.v2 ? ctx : undefined));
|
|
192
|
-
console.error('[Console] v2 Console API routes mounted at /api/v2/');
|
|
193
|
-
}
|
|
194
|
-
ctx.httpServer?.finalize();
|
|
195
178
|
const descriptionProvider = container_js_1.container.resolve(tokens_js_1.DI.Mcp.DescriptionProvider);
|
|
196
179
|
const buildTool = (0, tool_factory_js_1.createToolFactory)(descriptionProvider);
|
|
197
180
|
const workflowEdition = (0, workflow_tool_edition_selector_js_1.selectWorkflowToolEdition)(ctx.featureFlags, buildTool);
|
package/dist/mcp/tools.d.ts
CHANGED
|
@@ -27,19 +27,19 @@ export declare const WorkflowNextInput: z.ZodObject<{
|
|
|
27
27
|
}, "strip", z.ZodTypeAny, {
|
|
28
28
|
workflowId: string;
|
|
29
29
|
state: import("../domain/execution/state.js").ExecutionState;
|
|
30
|
-
context?: Record<string, unknown> | undefined;
|
|
31
30
|
event?: {
|
|
32
31
|
readonly kind: "step_completed";
|
|
33
32
|
readonly stepInstanceId: import("../domain/execution/ids.js").StepInstanceId;
|
|
34
33
|
} | undefined;
|
|
34
|
+
context?: Record<string, unknown> | undefined;
|
|
35
35
|
}, {
|
|
36
36
|
workflowId: string;
|
|
37
37
|
state: import("../domain/execution/state.js").ExecutionState;
|
|
38
|
-
context?: Record<string, unknown> | undefined;
|
|
39
38
|
event?: {
|
|
40
39
|
readonly kind: "step_completed";
|
|
41
40
|
readonly stepInstanceId: import("../domain/execution/ids.js").StepInstanceId;
|
|
42
41
|
} | undefined;
|
|
42
|
+
context?: Record<string, unknown> | undefined;
|
|
43
43
|
}>;
|
|
44
44
|
export type WorkflowNextInput = z.infer<typeof WorkflowNextInput>;
|
|
45
45
|
export declare const WorkflowValidateJsonInput: z.ZodObject<{
|
|
@@ -52,7 +52,6 @@ async function startHttpServer(port) {
|
|
|
52
52
|
const listener = await (0, http_listener_js_1.bindWithPortFallback)(port, scanEnd);
|
|
53
53
|
(0, fatal_exit_js_1.registerGracefulShutdown)(async () => {
|
|
54
54
|
await listener.stop();
|
|
55
|
-
await ctx.httpServer?.stop();
|
|
56
55
|
});
|
|
57
56
|
const { StreamableHTTPServerTransport } = await Promise.resolve().then(() => __importStar(require('@modelcontextprotocol/sdk/server/streamableHttp.js')));
|
|
58
57
|
const transport = new StreamableHTTPServerTransport({
|
|
@@ -73,7 +72,6 @@ async function startHttpServer(port) {
|
|
|
73
72
|
(0, shutdown_hooks_js_1.wireShutdownHooks)({
|
|
74
73
|
onBeforeTerminate: async () => {
|
|
75
74
|
await listener.stop();
|
|
76
|
-
await ctx.httpServer?.stop();
|
|
77
75
|
},
|
|
78
76
|
});
|
|
79
77
|
}
|
|
@@ -50,7 +50,7 @@ async function startStdioServer() {
|
|
|
50
50
|
(0, fatal_exit_js_1.registerFatalHandlers)('stdio');
|
|
51
51
|
(0, fatal_exit_js_1.logStartup)('stdio');
|
|
52
52
|
const { server, ctx, rootsManager } = await (0, server_js_1.composeServer)();
|
|
53
|
-
(0, fatal_exit_js_1.registerGracefulShutdown)(async () => {
|
|
53
|
+
(0, fatal_exit_js_1.registerGracefulShutdown)(async () => { });
|
|
54
54
|
const { StdioServerTransport } = await Promise.resolve().then(() => __importStar(require('@modelcontextprotocol/sdk/server/stdio.js')));
|
|
55
55
|
const { RootsListChangedNotificationSchema, } = await Promise.resolve().then(() => __importStar(require('@modelcontextprotocol/sdk/types.js')));
|
|
56
56
|
server.setNotificationHandler(RootsListChangedNotificationSchema, async () => {
|
|
@@ -100,7 +100,6 @@ async function startStdioServer() {
|
|
|
100
100
|
(0, shutdown_hooks_js_1.wireStdinShutdown)();
|
|
101
101
|
(0, shutdown_hooks_js_1.wireShutdownHooks)({
|
|
102
102
|
onBeforeTerminate: async () => {
|
|
103
|
-
await ctx.httpServer?.stop();
|
|
104
103
|
},
|
|
105
104
|
});
|
|
106
105
|
}
|
package/dist/mcp/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { WorkflowService } from '../application/services/workflow-service.js';
|
|
2
2
|
import type { IFeatureFlagProvider } from '../config/feature-flags.js';
|
|
3
3
|
import type { SessionManager } from '../infrastructure/session/SessionManager.js';
|
|
4
|
-
import type { HttpServer } from '../infrastructure/session/HttpServer.js';
|
|
5
4
|
import type { SessionHealthV2 } from '../v2/durable-core/schemas/session/session-health.js';
|
|
6
5
|
import type { ExecutionSessionGateV2 } from '../v2/usecases/execution-session-gate.js';
|
|
7
6
|
import type { SessionEventLogAppendStorePortV2, SessionEventLogReadonlyStorePortV2 } from '../v2/ports/session-event-log-store.port.js';
|
|
@@ -75,7 +74,6 @@ export interface ToolContext {
|
|
|
75
74
|
readonly workflowService: WorkflowService;
|
|
76
75
|
readonly featureFlags: IFeatureFlagProvider;
|
|
77
76
|
readonly sessionManager: SessionManager | null;
|
|
78
|
-
readonly httpServer: HttpServer | null;
|
|
79
77
|
readonly v2: V2Dependencies | null;
|
|
80
78
|
}
|
|
81
79
|
export interface V2ToolContext extends ToolContext {
|
package/dist/mcp/v2/tools.d.ts
CHANGED
|
@@ -34,12 +34,12 @@ export declare const V2StartWorkflowInput: z.ZodObject<{
|
|
|
34
34
|
goal: z.ZodString;
|
|
35
35
|
}, "strip", z.ZodTypeAny, {
|
|
36
36
|
workflowId: string;
|
|
37
|
-
workspacePath: string;
|
|
38
37
|
goal: string;
|
|
38
|
+
workspacePath: string;
|
|
39
39
|
}, {
|
|
40
40
|
workflowId: string;
|
|
41
|
-
workspacePath: string;
|
|
42
41
|
goal: string;
|
|
42
|
+
workspacePath: string;
|
|
43
43
|
}>;
|
|
44
44
|
export type V2StartWorkflowInput = z.infer<typeof V2StartWorkflowInput>;
|
|
45
45
|
export declare const V2ContinueWorkflowInputShape: z.ZodObject<{
|
|
@@ -59,22 +59,22 @@ export declare const V2ContinueWorkflowInputShape: z.ZodObject<{
|
|
|
59
59
|
}>>;
|
|
60
60
|
}, "strict", z.ZodTypeAny, {
|
|
61
61
|
continueToken: string;
|
|
62
|
-
context?: Record<string, unknown> | undefined;
|
|
63
|
-
workspacePath?: string | undefined;
|
|
64
62
|
output?: {
|
|
65
63
|
notesMarkdown?: string | undefined;
|
|
66
64
|
artifacts?: unknown[] | undefined;
|
|
67
65
|
} | undefined;
|
|
68
|
-
intent?: "
|
|
69
|
-
}, {
|
|
70
|
-
continueToken: string;
|
|
66
|
+
intent?: "rehydrate" | "advance" | undefined;
|
|
71
67
|
context?: Record<string, unknown> | undefined;
|
|
72
68
|
workspacePath?: string | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
continueToken: string;
|
|
73
71
|
output?: {
|
|
74
72
|
notesMarkdown?: string | undefined;
|
|
75
73
|
artifacts?: unknown[] | undefined;
|
|
76
74
|
} | undefined;
|
|
77
|
-
intent?: "
|
|
75
|
+
intent?: "rehydrate" | "advance" | undefined;
|
|
76
|
+
context?: Record<string, unknown> | undefined;
|
|
77
|
+
workspacePath?: string | undefined;
|
|
78
78
|
}>;
|
|
79
79
|
export declare const V2ContinueWorkflowInput: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
80
80
|
workspacePath: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
@@ -95,43 +95,43 @@ export declare const V2ContinueWorkflowInput: z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
95
95
|
contextVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
96
96
|
}, "strict", z.ZodTypeAny, {
|
|
97
97
|
continueToken: string;
|
|
98
|
-
context?: Record<string, unknown> | undefined;
|
|
99
|
-
workspacePath?: string | undefined;
|
|
100
98
|
output?: {
|
|
101
99
|
notesMarkdown?: string | undefined;
|
|
102
100
|
artifacts?: unknown[] | undefined;
|
|
103
101
|
} | undefined;
|
|
104
|
-
intent?: "
|
|
102
|
+
intent?: "rehydrate" | "advance" | undefined;
|
|
103
|
+
context?: Record<string, unknown> | undefined;
|
|
104
|
+
workspacePath?: string | undefined;
|
|
105
105
|
contextVariables?: Record<string, unknown> | undefined;
|
|
106
106
|
}, {
|
|
107
107
|
continueToken: string;
|
|
108
|
-
context?: Record<string, unknown> | undefined;
|
|
109
|
-
workspacePath?: string | undefined;
|
|
110
108
|
output?: {
|
|
111
109
|
notesMarkdown?: string | undefined;
|
|
112
110
|
artifacts?: unknown[] | undefined;
|
|
113
111
|
} | undefined;
|
|
114
|
-
intent?: "
|
|
112
|
+
intent?: "rehydrate" | "advance" | undefined;
|
|
113
|
+
context?: Record<string, unknown> | undefined;
|
|
114
|
+
workspacePath?: string | undefined;
|
|
115
115
|
contextVariables?: Record<string, unknown> | undefined;
|
|
116
116
|
}>, {
|
|
117
117
|
continueToken: string;
|
|
118
|
-
context?: Record<string, unknown> | undefined;
|
|
119
|
-
workspacePath?: string | undefined;
|
|
120
118
|
output?: {
|
|
121
119
|
notesMarkdown?: string | undefined;
|
|
122
120
|
artifacts?: unknown[] | undefined;
|
|
123
121
|
} | undefined;
|
|
124
|
-
intent?: "
|
|
122
|
+
intent?: "rehydrate" | "advance" | undefined;
|
|
123
|
+
context?: Record<string, unknown> | undefined;
|
|
124
|
+
workspacePath?: string | undefined;
|
|
125
125
|
contextVariables?: Record<string, unknown> | undefined;
|
|
126
126
|
}, {
|
|
127
127
|
continueToken: string;
|
|
128
|
-
context?: Record<string, unknown> | undefined;
|
|
129
|
-
workspacePath?: string | undefined;
|
|
130
128
|
output?: {
|
|
131
129
|
notesMarkdown?: string | undefined;
|
|
132
130
|
artifacts?: unknown[] | undefined;
|
|
133
131
|
} | undefined;
|
|
134
|
-
intent?: "
|
|
132
|
+
intent?: "rehydrate" | "advance" | undefined;
|
|
133
|
+
context?: Record<string, unknown> | undefined;
|
|
134
|
+
workspacePath?: string | undefined;
|
|
135
135
|
contextVariables?: Record<string, unknown> | undefined;
|
|
136
136
|
}>, {
|
|
137
137
|
workspacePath?: string | undefined;
|
|
@@ -140,17 +140,17 @@ export declare const V2ContinueWorkflowInput: z.ZodEffects<z.ZodEffects<z.ZodObj
|
|
|
140
140
|
artifacts?: unknown[] | undefined;
|
|
141
141
|
} | undefined;
|
|
142
142
|
context?: {} | undefined;
|
|
143
|
-
intent: "
|
|
143
|
+
intent: "rehydrate" | "advance";
|
|
144
144
|
continueToken: string;
|
|
145
145
|
}, {
|
|
146
146
|
continueToken: string;
|
|
147
|
-
context?: Record<string, unknown> | undefined;
|
|
148
|
-
workspacePath?: string | undefined;
|
|
149
147
|
output?: {
|
|
150
148
|
notesMarkdown?: string | undefined;
|
|
151
149
|
artifacts?: unknown[] | undefined;
|
|
152
150
|
} | undefined;
|
|
153
|
-
intent?: "
|
|
151
|
+
intent?: "rehydrate" | "advance" | undefined;
|
|
152
|
+
context?: Record<string, unknown> | undefined;
|
|
153
|
+
workspacePath?: string | undefined;
|
|
154
154
|
contextVariables?: Record<string, unknown> | undefined;
|
|
155
155
|
}>;
|
|
156
156
|
export type V2ContinueWorkflowInput = z.infer<typeof V2ContinueWorkflowInput>;
|
|
@@ -2,6 +2,7 @@ import 'reflect-metadata';
|
|
|
2
2
|
import type { V2ToolContext } from '../mcp/types.js';
|
|
3
3
|
import type { TriggerRouter } from './trigger-router.js';
|
|
4
4
|
import type { WorkflowService } from '../application/services/workflow-service.js';
|
|
5
|
+
import type { SteerRegistry } from '../daemon/workflow-runner.js';
|
|
5
6
|
import type { Result } from '../runtime/result.js';
|
|
6
7
|
export interface DaemonConsoleHandle {
|
|
7
8
|
readonly port: number;
|
|
@@ -20,5 +21,6 @@ export interface StartDaemonConsoleOptions {
|
|
|
20
21
|
readonly serverVersion?: string;
|
|
21
22
|
readonly workflowService?: WorkflowService;
|
|
22
23
|
readonly lockFilePath?: string;
|
|
24
|
+
readonly steerRegistry?: SteerRegistry;
|
|
23
25
|
}
|
|
24
26
|
export declare function startDaemonConsole(ctx: V2ToolContext, options?: StartDaemonConsoleOptions): Promise<Result<DaemonConsoleHandle, DaemonConsoleError>>;
|
|
@@ -68,7 +68,7 @@ async function startDaemonConsole(ctx, options = {}) {
|
|
|
68
68
|
snapshotStore: ctx.v2.snapshotStore,
|
|
69
69
|
pinnedWorkflowStore: ctx.v2.pinnedStore,
|
|
70
70
|
});
|
|
71
|
-
const stopWatcher = mountConsoleRoutes(app, consoleService, options.workflowService, undefined, undefined, options.serverVersion, ctx, options.triggerRouter);
|
|
71
|
+
const stopWatcher = mountConsoleRoutes(app, consoleService, options.workflowService, undefined, undefined, options.serverVersion, ctx, options.triggerRouter, options.steerRegistry);
|
|
72
72
|
app.use((req, res) => {
|
|
73
73
|
res.status(404).json({ success: false, error: 'Not found', path: req.path });
|
|
74
74
|
});
|
|
@@ -3,6 +3,7 @@ import express from 'express';
|
|
|
3
3
|
import type { V2ToolContext } from '../mcp/types.js';
|
|
4
4
|
import type { TriggerStoreError } from './trigger-store.js';
|
|
5
5
|
import { TriggerRouter, type RunWorkflowFn } from './trigger-router.js';
|
|
6
|
+
import type { SteerRegistry } from '../daemon/workflow-runner.js';
|
|
6
7
|
import type { WorkspaceConfig } from './types.js';
|
|
7
8
|
import type { DaemonEventEmitter } from '../daemon/daemon-events.js';
|
|
8
9
|
import type { FetchFn } from './adapters/gitlab-poller.js';
|
|
@@ -17,6 +18,7 @@ export type TriggerListenerError = TriggerStoreError | {
|
|
|
17
18
|
export interface TriggerListenerHandle {
|
|
18
19
|
readonly port: number;
|
|
19
20
|
readonly router: TriggerRouter;
|
|
21
|
+
readonly steerRegistry: SteerRegistry;
|
|
20
22
|
stop(): Promise<void>;
|
|
21
23
|
}
|
|
22
24
|
export interface StartTriggerListenerOptions {
|
|
@@ -183,8 +183,9 @@ async function startTriggerListener(ctx, options) {
|
|
|
183
183
|
const notificationService = (notifyMacOs || (notifyWebhook !== undefined && notifyWebhook !== ''))
|
|
184
184
|
? new notification_service_js_1.NotificationService({ macOs: notifyMacOs, webhookUrl: notifyWebhook })
|
|
185
185
|
: undefined;
|
|
186
|
+
const steerRegistry = new Map();
|
|
186
187
|
const runWorkflowFn = options.runWorkflowFn ?? workflow_runner_js_1.runWorkflow;
|
|
187
|
-
const router = new trigger_router_js_1.TriggerRouter(triggerIndex, ctx, apiKey, runWorkflowFn, undefined, maxConcurrentSessions, options.emitter, notificationService);
|
|
188
|
+
const router = new trigger_router_js_1.TriggerRouter(triggerIndex, ctx, apiKey, runWorkflowFn, undefined, maxConcurrentSessions, options.emitter, notificationService, steerRegistry);
|
|
188
189
|
const app = createTriggerApp(router);
|
|
189
190
|
const allTriggers = [...triggerIndex.values()];
|
|
190
191
|
const polledEventStore = new polled_event_store_js_1.PolledEventStore(env);
|
|
@@ -219,6 +220,7 @@ async function startTriggerListener(ctx, options) {
|
|
|
219
220
|
resolve({
|
|
220
221
|
port: actualPort,
|
|
221
222
|
router,
|
|
223
|
+
steerRegistry,
|
|
222
224
|
stop: async () => {
|
|
223
225
|
pollingScheduler.stop();
|
|
224
226
|
return new Promise((res, rej) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WorkflowTrigger, WorkflowRunResult } from '../daemon/workflow-runner.js';
|
|
1
|
+
import type { WorkflowTrigger, WorkflowRunResult, SteerRegistry } from '../daemon/workflow-runner.js';
|
|
2
2
|
import type { V2ToolContext } from '../mcp/types.js';
|
|
3
3
|
import type { TriggerDefinition, WebhookEvent } from './types.js';
|
|
4
4
|
import type { ExecFn } from './delivery-action.js';
|
|
@@ -20,7 +20,7 @@ export type RouteResult = {
|
|
|
20
20
|
readonly _tag: 'error';
|
|
21
21
|
readonly error: RouteError;
|
|
22
22
|
};
|
|
23
|
-
export type RunWorkflowFn = (trigger: WorkflowTrigger, ctx: V2ToolContext, apiKey: string, daemonRegistry?: import('../v2/infra/in-memory/daemon-registry/index.js').DaemonRegistry, emitter?: DaemonEventEmitter) => Promise<WorkflowRunResult>;
|
|
23
|
+
export type RunWorkflowFn = (trigger: WorkflowTrigger, ctx: V2ToolContext, apiKey: string, daemonRegistry?: import('../v2/infra/in-memory/daemon-registry/index.js').DaemonRegistry, emitter?: DaemonEventEmitter, steerRegistry?: SteerRegistry) => Promise<WorkflowRunResult>;
|
|
24
24
|
export declare function interpolateGoalTemplate(template: string, staticGoal: string, payload: Readonly<Record<string, unknown>>, triggerId: string): string;
|
|
25
25
|
export declare class TriggerRouter {
|
|
26
26
|
private readonly index;
|
|
@@ -33,7 +33,8 @@ export declare class TriggerRouter {
|
|
|
33
33
|
private readonly _maxConcurrentSessions;
|
|
34
34
|
private readonly emitter;
|
|
35
35
|
private readonly notificationService;
|
|
36
|
-
|
|
36
|
+
private readonly steerRegistry;
|
|
37
|
+
constructor(index: ReadonlyMap<string, TriggerDefinition>, ctx: V2ToolContext, apiKey: string, runWorkflowFn: RunWorkflowFn, execFn?: ExecFn, maxConcurrentSessions?: number, emitter?: DaemonEventEmitter, notificationService?: NotificationService, steerRegistry?: SteerRegistry);
|
|
37
38
|
get activeSessions(): number;
|
|
38
39
|
get maxConcurrentSessions(): number;
|
|
39
40
|
route(event: WebhookEvent): RouteResult;
|
|
@@ -183,7 +183,7 @@ class Semaphore {
|
|
|
183
183
|
}
|
|
184
184
|
const DEFAULT_MAX_CONCURRENT_SESSIONS = 3;
|
|
185
185
|
class TriggerRouter {
|
|
186
|
-
constructor(index, ctx, apiKey, runWorkflowFn, execFn, maxConcurrentSessions, emitter, notificationService) {
|
|
186
|
+
constructor(index, ctx, apiKey, runWorkflowFn, execFn, maxConcurrentSessions, emitter, notificationService, steerRegistry) {
|
|
187
187
|
this.index = index;
|
|
188
188
|
this.ctx = ctx;
|
|
189
189
|
this.apiKey = apiKey;
|
|
@@ -192,6 +192,7 @@ class TriggerRouter {
|
|
|
192
192
|
this.execFn = execFn ?? execFileAsync;
|
|
193
193
|
this.emitter = emitter;
|
|
194
194
|
this.notificationService = notificationService;
|
|
195
|
+
this.steerRegistry = steerRegistry;
|
|
195
196
|
const requested = maxConcurrentSessions ?? DEFAULT_MAX_CONCURRENT_SESSIONS;
|
|
196
197
|
const cap = Number.isNaN(requested) ? DEFAULT_MAX_CONCURRENT_SESSIONS : requested;
|
|
197
198
|
if (cap < 1) {
|
|
@@ -260,7 +261,7 @@ class TriggerRouter {
|
|
|
260
261
|
await this.semaphore.acquire();
|
|
261
262
|
let result;
|
|
262
263
|
try {
|
|
263
|
-
result = await this.runWorkflowFn(workflowTrigger, this.ctx, this.apiKey, undefined, this.emitter);
|
|
264
|
+
result = await this.runWorkflowFn(workflowTrigger, this.ctx, this.apiKey, undefined, this.emitter, this.steerRegistry);
|
|
264
265
|
}
|
|
265
266
|
finally {
|
|
266
267
|
this.semaphore.release();
|
|
@@ -321,7 +322,7 @@ class TriggerRouter {
|
|
|
321
322
|
await this.semaphore.acquire();
|
|
322
323
|
let result;
|
|
323
324
|
try {
|
|
324
|
-
result = await this.runWorkflowFn(workflowTrigger, this.ctx, this.apiKey, undefined, this.emitter);
|
|
325
|
+
result = await this.runWorkflowFn(workflowTrigger, this.ctx, this.apiKey, undefined, this.emitter, this.steerRegistry);
|
|
325
326
|
}
|
|
326
327
|
finally {
|
|
327
328
|
this.semaphore.release();
|
|
@@ -426,7 +426,6 @@ function validateAndResolveTrigger(raw, env, workspaces = {}) {
|
|
|
426
426
|
const requiredStringFields = [
|
|
427
427
|
'provider',
|
|
428
428
|
'workflowId',
|
|
429
|
-
'goal',
|
|
430
429
|
];
|
|
431
430
|
for (const field of requiredStringFields) {
|
|
432
431
|
const v = raw[field];
|
|
@@ -491,7 +490,21 @@ function validateAndResolveTrigger(raw, env, workspaces = {}) {
|
|
|
491
490
|
return secretResult;
|
|
492
491
|
hmacSecret = secretResult.value;
|
|
493
492
|
}
|
|
494
|
-
const
|
|
493
|
+
const LATE_BOUND_GOAL_SENTINEL = 'Autonomous task';
|
|
494
|
+
let resolvedGoal;
|
|
495
|
+
let resolvedGoalTemplate = raw.goalTemplate?.trim();
|
|
496
|
+
if (!raw.goal?.trim()) {
|
|
497
|
+
resolvedGoal = LATE_BOUND_GOAL_SENTINEL;
|
|
498
|
+
if (!resolvedGoalTemplate) {
|
|
499
|
+
resolvedGoalTemplate = '{{$.goal}}';
|
|
500
|
+
console.log(`[TriggerStore] Trigger "${rawId}" has no static goal or goalTemplate -- ` +
|
|
501
|
+
`defaulting to goalTemplate: "{{$.goal}}" (goal taken from webhook payload). ` +
|
|
502
|
+
`Fallback goal if payload has no goal field: "${LATE_BOUND_GOAL_SENTINEL}".`);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
resolvedGoal = raw.goal.trim();
|
|
507
|
+
}
|
|
495
508
|
const referenceUrlsRaw = raw.referenceUrls?.trim();
|
|
496
509
|
const referenceUrls = referenceUrlsRaw
|
|
497
510
|
? referenceUrlsRaw.split(/\s+/).filter(Boolean)
|
|
@@ -712,13 +725,13 @@ function validateAndResolveTrigger(raw, env, workspaces = {}) {
|
|
|
712
725
|
provider,
|
|
713
726
|
workflowId: raw.workflowId.trim(),
|
|
714
727
|
workspacePath: resolvedWorkspacePath,
|
|
715
|
-
goal:
|
|
728
|
+
goal: resolvedGoal,
|
|
716
729
|
concurrencyMode,
|
|
717
730
|
...(hmacSecret !== undefined ? { hmacSecret } : {}),
|
|
718
731
|
...(raw.contextMapping !== undefined
|
|
719
732
|
? { contextMapping: assembleContextMapping(raw.contextMapping) }
|
|
720
733
|
: {}),
|
|
721
|
-
...(
|
|
734
|
+
...(resolvedGoalTemplate ? { goalTemplate: resolvedGoalTemplate } : {}),
|
|
722
735
|
...(referenceUrls !== undefined && referenceUrls.length > 0 ? { referenceUrls } : {}),
|
|
723
736
|
...(agentConfig !== undefined ? { agentConfig } : {}),
|
|
724
737
|
...(callbackUrl !== undefined ? { callbackUrl } : {}),
|
|
@@ -37,16 +37,16 @@ export declare const AssessmentArtifactV1Schema: z.ZodObject<{
|
|
|
37
37
|
level: string;
|
|
38
38
|
rationale?: string | undefined;
|
|
39
39
|
}>;
|
|
40
|
-
assessmentId?: string | undefined;
|
|
41
40
|
summary?: string | undefined;
|
|
41
|
+
assessmentId?: string | undefined;
|
|
42
42
|
}, {
|
|
43
43
|
kind: "wr.assessment";
|
|
44
44
|
dimensions: Record<string, string | {
|
|
45
45
|
level: string;
|
|
46
46
|
rationale?: string | undefined;
|
|
47
47
|
}>;
|
|
48
|
-
assessmentId?: string | undefined;
|
|
49
48
|
summary?: string | undefined;
|
|
49
|
+
assessmentId?: string | undefined;
|
|
50
50
|
}>;
|
|
51
51
|
export type AssessmentArtifactV1 = z.infer<typeof AssessmentArtifactV1Schema>;
|
|
52
52
|
export declare function isAssessmentArtifact(artifact: unknown): artifact is {
|
|
@@ -9,13 +9,13 @@ export declare const CoordinatorSignalArtifactV1Schema: z.ZodObject<{
|
|
|
9
9
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
10
10
|
}, "strict", z.ZodTypeAny, {
|
|
11
11
|
kind: "wr.coordinator_signal";
|
|
12
|
-
signalKind: "blocked" | "progress" | "finding" | "data_needed" | "approval_needed";
|
|
13
12
|
payload: Record<string, unknown>;
|
|
13
|
+
signalKind: "blocked" | "progress" | "finding" | "data_needed" | "approval_needed";
|
|
14
14
|
sessionId?: string | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
kind: "wr.coordinator_signal";
|
|
17
|
-
signalKind: "blocked" | "progress" | "finding" | "data_needed" | "approval_needed";
|
|
18
17
|
payload: Record<string, unknown>;
|
|
18
|
+
signalKind: "blocked" | "progress" | "finding" | "data_needed" | "approval_needed";
|
|
19
19
|
sessionId?: string | undefined;
|
|
20
20
|
}>;
|
|
21
21
|
export type CoordinatorSignalArtifactV1 = z.infer<typeof CoordinatorSignalArtifactV1Schema>;
|
|
@@ -9,14 +9,14 @@ export declare const LoopControlMetadataV1Schema: z.ZodOptional<z.ZodObject<{
|
|
|
9
9
|
confidence: z.ZodOptional<z.ZodNumber>;
|
|
10
10
|
}, "strict", z.ZodTypeAny, {
|
|
11
11
|
reason?: string | undefined;
|
|
12
|
+
confidence?: number | undefined;
|
|
12
13
|
issuesFound?: number | undefined;
|
|
13
14
|
iterationIndex?: number | undefined;
|
|
14
|
-
confidence?: number | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
reason?: string | undefined;
|
|
17
|
+
confidence?: number | undefined;
|
|
17
18
|
issuesFound?: number | undefined;
|
|
18
19
|
iterationIndex?: number | undefined;
|
|
19
|
-
confidence?: number | undefined;
|
|
20
20
|
}>>;
|
|
21
21
|
export type LoopControlMetadataV1 = z.infer<typeof LoopControlMetadataV1Schema>;
|
|
22
22
|
export declare const LoopControlArtifactV1Schema: z.ZodObject<{
|
|
@@ -30,14 +30,14 @@ export declare const LoopControlArtifactV1Schema: z.ZodObject<{
|
|
|
30
30
|
confidence: z.ZodOptional<z.ZodNumber>;
|
|
31
31
|
}, "strict", z.ZodTypeAny, {
|
|
32
32
|
reason?: string | undefined;
|
|
33
|
+
confidence?: number | undefined;
|
|
33
34
|
issuesFound?: number | undefined;
|
|
34
35
|
iterationIndex?: number | undefined;
|
|
35
|
-
confidence?: number | undefined;
|
|
36
36
|
}, {
|
|
37
37
|
reason?: string | undefined;
|
|
38
|
+
confidence?: number | undefined;
|
|
38
39
|
issuesFound?: number | undefined;
|
|
39
40
|
iterationIndex?: number | undefined;
|
|
40
|
-
confidence?: number | undefined;
|
|
41
41
|
}>>;
|
|
42
42
|
}, "strict", z.ZodTypeAny, {
|
|
43
43
|
kind: "wr.loop_control";
|
|
@@ -45,9 +45,9 @@ export declare const LoopControlArtifactV1Schema: z.ZodObject<{
|
|
|
45
45
|
loopId?: string | undefined;
|
|
46
46
|
metadata?: {
|
|
47
47
|
reason?: string | undefined;
|
|
48
|
+
confidence?: number | undefined;
|
|
48
49
|
issuesFound?: number | undefined;
|
|
49
50
|
iterationIndex?: number | undefined;
|
|
50
|
-
confidence?: number | undefined;
|
|
51
51
|
} | undefined;
|
|
52
52
|
}, {
|
|
53
53
|
kind: "wr.loop_control";
|
|
@@ -55,9 +55,9 @@ export declare const LoopControlArtifactV1Schema: z.ZodObject<{
|
|
|
55
55
|
loopId?: string | undefined;
|
|
56
56
|
metadata?: {
|
|
57
57
|
reason?: string | undefined;
|
|
58
|
+
confidence?: number | undefined;
|
|
58
59
|
issuesFound?: number | undefined;
|
|
59
60
|
iterationIndex?: number | undefined;
|
|
60
|
-
confidence?: number | undefined;
|
|
61
61
|
} | undefined;
|
|
62
62
|
}>;
|
|
63
63
|
export type LoopControlArtifactV1 = z.infer<typeof LoopControlArtifactV1Schema>;
|
|
@@ -8,30 +8,30 @@ export declare const ReviewVerdictArtifactV1Schema: z.ZodObject<{
|
|
|
8
8
|
severity: z.ZodEnum<["critical", "major", "minor", "nit"]>;
|
|
9
9
|
summary: z.ZodString;
|
|
10
10
|
}, "strict", z.ZodTypeAny, {
|
|
11
|
+
severity: "critical" | "minor" | "major" | "nit";
|
|
11
12
|
summary: string;
|
|
12
|
-
severity: "minor" | "critical" | "major" | "nit";
|
|
13
13
|
}, {
|
|
14
|
+
severity: "critical" | "minor" | "major" | "nit";
|
|
14
15
|
summary: string;
|
|
15
|
-
severity: "minor" | "critical" | "major" | "nit";
|
|
16
16
|
}>, "many">;
|
|
17
17
|
summary: z.ZodString;
|
|
18
18
|
}, "strict", z.ZodTypeAny, {
|
|
19
19
|
kind: "wr.review_verdict";
|
|
20
20
|
summary: string;
|
|
21
|
-
confidence: "
|
|
21
|
+
confidence: "low" | "high" | "medium";
|
|
22
22
|
verdict: "clean" | "minor" | "blocking";
|
|
23
23
|
findings: {
|
|
24
|
+
severity: "critical" | "minor" | "major" | "nit";
|
|
24
25
|
summary: string;
|
|
25
|
-
severity: "minor" | "critical" | "major" | "nit";
|
|
26
26
|
}[];
|
|
27
27
|
}, {
|
|
28
28
|
kind: "wr.review_verdict";
|
|
29
29
|
summary: string;
|
|
30
|
-
confidence: "
|
|
30
|
+
confidence: "low" | "high" | "medium";
|
|
31
31
|
verdict: "clean" | "minor" | "blocking";
|
|
32
32
|
findings: {
|
|
33
|
+
severity: "critical" | "minor" | "major" | "nit";
|
|
33
34
|
summary: string;
|
|
34
|
-
severity: "minor" | "critical" | "major" | "nit";
|
|
35
35
|
}[];
|
|
36
36
|
}>;
|
|
37
37
|
export type ReviewVerdictArtifactV1 = z.infer<typeof ReviewVerdictArtifactV1Schema>;
|