@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.
Files changed (105) hide show
  1. package/dist/cli/commands/init.js +0 -3
  2. package/dist/cli-worktrain.js +48 -11
  3. package/dist/cli.js +0 -18
  4. package/dist/config/app-config.d.ts +0 -16
  5. package/dist/config/app-config.js +0 -14
  6. package/dist/config/config-file.js +0 -3
  7. package/dist/console-ui/assets/index-DGj8EsFR.css +1 -0
  8. package/dist/console-ui/assets/index-DwfWMKvv.js +28 -0
  9. package/dist/console-ui/index.html +2 -2
  10. package/dist/context-assembly/deps.d.ts +8 -0
  11. package/dist/context-assembly/deps.js +2 -0
  12. package/dist/context-assembly/index.d.ts +6 -0
  13. package/dist/context-assembly/index.js +50 -0
  14. package/dist/context-assembly/infra.d.ts +3 -0
  15. package/dist/context-assembly/infra.js +154 -0
  16. package/dist/context-assembly/types.d.ts +30 -0
  17. package/dist/context-assembly/types.js +2 -0
  18. package/dist/coordinators/pr-review.d.ts +20 -1
  19. package/dist/coordinators/pr-review.js +189 -4
  20. package/dist/daemon/daemon-events.d.ts +9 -1
  21. package/dist/daemon/soul-template.d.ts +2 -2
  22. package/dist/daemon/soul-template.js +11 -1
  23. package/dist/daemon/workflow-runner.d.ts +14 -1
  24. package/dist/daemon/workflow-runner.js +406 -25
  25. package/dist/di/container.js +1 -25
  26. package/dist/di/tokens.d.ts +0 -3
  27. package/dist/di/tokens.js +0 -3
  28. package/dist/domain/execution/state.d.ts +6 -6
  29. package/dist/engine/engine-factory.js +0 -1
  30. package/dist/infrastructure/console-defaults.d.ts +1 -0
  31. package/dist/infrastructure/console-defaults.js +4 -0
  32. package/dist/infrastructure/session/index.d.ts +0 -1
  33. package/dist/infrastructure/session/index.js +1 -3
  34. package/dist/manifest.json +138 -122
  35. package/dist/mcp/handlers/session.d.ts +1 -0
  36. package/dist/mcp/handlers/session.js +61 -13
  37. package/dist/mcp/handlers/v2-workflow.d.ts +2 -2
  38. package/dist/mcp/output-schemas.d.ts +234 -234
  39. package/dist/mcp/server.js +1 -18
  40. package/dist/mcp/tools.d.ts +2 -2
  41. package/dist/mcp/transports/http-entry.js +0 -2
  42. package/dist/mcp/transports/stdio-entry.js +1 -2
  43. package/dist/mcp/types.d.ts +0 -2
  44. package/dist/mcp/v2/tools.d.ts +24 -24
  45. package/dist/trigger/daemon-console.d.ts +2 -0
  46. package/dist/trigger/daemon-console.js +1 -1
  47. package/dist/trigger/trigger-listener.d.ts +2 -0
  48. package/dist/trigger/trigger-listener.js +3 -1
  49. package/dist/trigger/trigger-router.d.ts +4 -3
  50. package/dist/trigger/trigger-router.js +4 -3
  51. package/dist/trigger/trigger-store.js +17 -4
  52. package/dist/v2/durable-core/schemas/artifacts/assessment.d.ts +2 -2
  53. package/dist/v2/durable-core/schemas/artifacts/coordinator-signal.d.ts +2 -2
  54. package/dist/v2/durable-core/schemas/artifacts/loop-control.d.ts +6 -6
  55. package/dist/v2/durable-core/schemas/artifacts/review-verdict.d.ts +6 -6
  56. package/dist/v2/durable-core/schemas/compiled-workflow/index.d.ts +56 -56
  57. package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.d.ts +83 -83
  58. package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +1024 -1024
  59. package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +2336 -2336
  60. package/dist/v2/durable-core/schemas/session/dag-topology.d.ts +6 -6
  61. package/dist/v2/durable-core/schemas/session/events.d.ts +339 -339
  62. package/dist/v2/durable-core/schemas/session/gaps.d.ts +30 -30
  63. package/dist/v2/durable-core/schemas/session/manifest.d.ts +6 -6
  64. package/dist/v2/durable-core/schemas/session/outputs.d.ts +8 -8
  65. package/dist/v2/durable-core/schemas/session/validation-event.d.ts +3 -3
  66. package/dist/v2/usecases/console-routes.d.ts +2 -1
  67. package/dist/v2/usecases/console-routes.js +29 -5
  68. package/dist/v2/usecases/console-service.js +14 -0
  69. package/dist/v2/usecases/console-types.d.ts +1 -0
  70. package/docs/authoring.md +16 -16
  71. package/docs/design/context-assembly-design-candidates.md +199 -0
  72. package/docs/design/context-assembly-implementation-plan.md +211 -0
  73. package/docs/design/context-assembly-review-findings.md +112 -0
  74. package/docs/design/coordinator-message-queue-drain-plan.md +241 -0
  75. package/docs/design/coordinator-message-queue-drain-review.md +120 -0
  76. package/docs/design/coordinator-message-queue-drain.md +289 -0
  77. package/docs/design/shaping-workflow-external-research.md +119 -0
  78. package/docs/discovery/late-bound-goals-impl-plan.md +147 -0
  79. package/docs/discovery/late-bound-goals-review.md +82 -0
  80. package/docs/discovery/late-bound-goals.md +118 -0
  81. package/docs/discovery/steer-endpoint-design-candidates.md +288 -0
  82. package/docs/discovery/steer-endpoint-design-review-findings.md +104 -0
  83. package/docs/discovery/steer-endpoint-implementation-plan.md +284 -0
  84. package/docs/ideas/backlog.md +356 -0
  85. package/docs/ideas/design-candidates-console-session-tree-impl.md +64 -0
  86. package/docs/ideas/design-candidates-session-tree-view.md +196 -0
  87. package/docs/ideas/design-review-findings-console-session-tree-impl.md +75 -0
  88. package/docs/ideas/design-review-findings-session-tree-view.md +88 -0
  89. package/docs/ideas/implementation_plan_session_tree_view.md +238 -0
  90. package/package.json +2 -1
  91. package/spec/authoring-spec.json +16 -16
  92. package/spec/shape.schema.json +178 -0
  93. package/spec/workflow-tags.json +232 -47
  94. package/workflows/coding-task-workflow-agentic.json +491 -480
  95. package/workflows/wr.shaping.json +182 -0
  96. package/dist/console-ui/assets/index-8dh0Psu-.css +0 -1
  97. package/dist/console-ui/assets/index-CXWCAonr.js +0 -28
  98. package/dist/infrastructure/session/DashboardHeartbeat.d.ts +0 -8
  99. package/dist/infrastructure/session/DashboardHeartbeat.js +0 -39
  100. package/dist/infrastructure/session/DashboardLockRelease.d.ts +0 -2
  101. package/dist/infrastructure/session/DashboardLockRelease.js +0 -29
  102. package/dist/infrastructure/session/HttpServer.d.ts +0 -60
  103. package/dist/infrastructure/session/HttpServer.js +0 -912
  104. package/workflows/coding-task-workflow-agentic.lean.v2.json +0 -648
  105. package/workflows/coding-task-workflow-agentic.v2.json +0 -324
@@ -4,38 +4,38 @@ export declare const GapReasonSchema: z.ZodDiscriminatedUnion<"category", [z.Zod
4
4
  category: z.ZodLiteral<"user_only_dependency">;
5
5
  detail: z.ZodEnum<["needs_user_secret_or_token", "needs_user_account_access", "needs_user_artifact", "needs_user_choice", "needs_user_approval", "needs_user_environment_action"]>;
6
6
  }, "strip", z.ZodTypeAny, {
7
- detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
8
7
  category: "user_only_dependency";
9
- }, {
10
8
  detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
9
+ }, {
11
10
  category: "user_only_dependency";
11
+ detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
12
12
  }>, z.ZodObject<{
13
13
  category: z.ZodLiteral<"contract_violation">;
14
14
  detail: z.ZodEnum<["missing_required_output", "invalid_required_output", "missing_required_notes", "assessment_followup_required"]>;
15
15
  }, "strip", z.ZodTypeAny, {
16
- detail: "invalid_required_output" | "missing_required_output" | "assessment_followup_required" | "missing_required_notes";
17
16
  category: "contract_violation";
17
+ detail: "missing_required_output" | "invalid_required_output" | "missing_required_notes" | "assessment_followup_required";
18
18
  }, {
19
- detail: "invalid_required_output" | "missing_required_output" | "assessment_followup_required" | "missing_required_notes";
20
19
  category: "contract_violation";
20
+ detail: "missing_required_output" | "invalid_required_output" | "missing_required_notes" | "assessment_followup_required";
21
21
  }>, z.ZodObject<{
22
22
  category: z.ZodLiteral<"capability_missing">;
23
23
  detail: z.ZodEnum<["required_capability_unavailable", "required_capability_unknown"]>;
24
24
  }, "strip", z.ZodTypeAny, {
25
- detail: "required_capability_unknown" | "required_capability_unavailable";
26
25
  category: "capability_missing";
26
+ detail: "required_capability_unavailable" | "required_capability_unknown";
27
27
  }, {
28
- detail: "required_capability_unknown" | "required_capability_unavailable";
29
28
  category: "capability_missing";
29
+ detail: "required_capability_unavailable" | "required_capability_unknown";
30
30
  }>, z.ZodObject<{
31
31
  category: z.ZodLiteral<"unexpected">;
32
32
  detail: z.ZodEnum<["invariant_violation", "storage_corruption_detected", "evaluation_error"]>;
33
33
  }, "strip", z.ZodTypeAny, {
34
- detail: "invariant_violation" | "storage_corruption_detected" | "evaluation_error";
35
34
  category: "unexpected";
36
- }, {
37
35
  detail: "invariant_violation" | "storage_corruption_detected" | "evaluation_error";
36
+ }, {
38
37
  category: "unexpected";
38
+ detail: "invariant_violation" | "storage_corruption_detected" | "evaluation_error";
39
39
  }>]>;
40
40
  export declare const GapResolutionSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
41
41
  kind: z.ZodLiteral<"unresolved">;
@@ -79,38 +79,38 @@ export declare const GapRecordedDataV1Schema: z.ZodObject<{
79
79
  category: z.ZodLiteral<"user_only_dependency">;
80
80
  detail: z.ZodEnum<["needs_user_secret_or_token", "needs_user_account_access", "needs_user_artifact", "needs_user_choice", "needs_user_approval", "needs_user_environment_action"]>;
81
81
  }, "strip", z.ZodTypeAny, {
82
- detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
83
82
  category: "user_only_dependency";
84
- }, {
85
83
  detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
84
+ }, {
86
85
  category: "user_only_dependency";
86
+ detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
87
87
  }>, z.ZodObject<{
88
88
  category: z.ZodLiteral<"contract_violation">;
89
89
  detail: z.ZodEnum<["missing_required_output", "invalid_required_output", "missing_required_notes", "assessment_followup_required"]>;
90
90
  }, "strip", z.ZodTypeAny, {
91
- detail: "invalid_required_output" | "missing_required_output" | "assessment_followup_required" | "missing_required_notes";
92
91
  category: "contract_violation";
92
+ detail: "missing_required_output" | "invalid_required_output" | "missing_required_notes" | "assessment_followup_required";
93
93
  }, {
94
- detail: "invalid_required_output" | "missing_required_output" | "assessment_followup_required" | "missing_required_notes";
95
94
  category: "contract_violation";
95
+ detail: "missing_required_output" | "invalid_required_output" | "missing_required_notes" | "assessment_followup_required";
96
96
  }>, z.ZodObject<{
97
97
  category: z.ZodLiteral<"capability_missing">;
98
98
  detail: z.ZodEnum<["required_capability_unavailable", "required_capability_unknown"]>;
99
99
  }, "strip", z.ZodTypeAny, {
100
- detail: "required_capability_unknown" | "required_capability_unavailable";
101
100
  category: "capability_missing";
101
+ detail: "required_capability_unavailable" | "required_capability_unknown";
102
102
  }, {
103
- detail: "required_capability_unknown" | "required_capability_unavailable";
104
103
  category: "capability_missing";
104
+ detail: "required_capability_unavailable" | "required_capability_unknown";
105
105
  }>, z.ZodObject<{
106
106
  category: z.ZodLiteral<"unexpected">;
107
107
  detail: z.ZodEnum<["invariant_violation", "storage_corruption_detected", "evaluation_error"]>;
108
108
  }, "strip", z.ZodTypeAny, {
109
- detail: "invariant_violation" | "storage_corruption_detected" | "evaluation_error";
110
109
  category: "unexpected";
111
- }, {
112
110
  detail: "invariant_violation" | "storage_corruption_detected" | "evaluation_error";
111
+ }, {
113
112
  category: "unexpected";
113
+ detail: "invariant_violation" | "storage_corruption_detected" | "evaluation_error";
114
114
  }>]>;
115
115
  summary: z.ZodString;
116
116
  resolution: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
@@ -149,28 +149,28 @@ export declare const GapRecordedDataV1Schema: z.ZodObject<{
149
149
  outputId: string;
150
150
  }>]>, "many">>;
151
151
  }, "strip", z.ZodTypeAny, {
152
- summary: string;
152
+ gapId: string;
153
+ severity: "info" | "warning" | "critical";
153
154
  reason: {
154
- detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
155
155
  category: "user_only_dependency";
156
+ detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
156
157
  } | {
157
- detail: "invalid_required_output" | "missing_required_output" | "assessment_followup_required" | "missing_required_notes";
158
158
  category: "contract_violation";
159
+ detail: "missing_required_output" | "invalid_required_output" | "missing_required_notes" | "assessment_followup_required";
159
160
  } | {
160
- detail: "required_capability_unknown" | "required_capability_unavailable";
161
161
  category: "capability_missing";
162
+ detail: "required_capability_unavailable" | "required_capability_unknown";
162
163
  } | {
163
- detail: "invariant_violation" | "storage_corruption_detected" | "evaluation_error";
164
164
  category: "unexpected";
165
+ detail: "invariant_violation" | "storage_corruption_detected" | "evaluation_error";
165
166
  };
166
- severity: "critical" | "info" | "warning";
167
+ summary: string;
167
168
  resolution: {
168
169
  kind: "unresolved";
169
170
  } | {
170
171
  kind: "resolves";
171
172
  resolvesGapId: string;
172
173
  };
173
- gapId: string;
174
174
  evidenceRefs?: ({
175
175
  kind: "event";
176
176
  eventId: string;
@@ -179,28 +179,28 @@ export declare const GapRecordedDataV1Schema: z.ZodObject<{
179
179
  outputId: string;
180
180
  })[] | undefined;
181
181
  }, {
182
- summary: string;
182
+ gapId: string;
183
+ severity: "info" | "warning" | "critical";
183
184
  reason: {
184
- detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
185
185
  category: "user_only_dependency";
186
+ detail: "needs_user_secret_or_token" | "needs_user_account_access" | "needs_user_artifact" | "needs_user_choice" | "needs_user_approval" | "needs_user_environment_action";
186
187
  } | {
187
- detail: "invalid_required_output" | "missing_required_output" | "assessment_followup_required" | "missing_required_notes";
188
188
  category: "contract_violation";
189
+ detail: "missing_required_output" | "invalid_required_output" | "missing_required_notes" | "assessment_followup_required";
189
190
  } | {
190
- detail: "required_capability_unknown" | "required_capability_unavailable";
191
191
  category: "capability_missing";
192
+ detail: "required_capability_unavailable" | "required_capability_unknown";
192
193
  } | {
193
- detail: "invariant_violation" | "storage_corruption_detected" | "evaluation_error";
194
194
  category: "unexpected";
195
+ detail: "invariant_violation" | "storage_corruption_detected" | "evaluation_error";
195
196
  };
196
- severity: "critical" | "info" | "warning";
197
+ summary: string;
197
198
  resolution: {
198
199
  kind: "unresolved";
199
200
  } | {
200
201
  kind: "resolves";
201
202
  resolvesGapId: string;
202
203
  };
203
- gapId: string;
204
204
  evidenceRefs?: ({
205
205
  kind: "event";
206
206
  eventId: string;
@@ -11,23 +11,23 @@ export declare const ManifestRecordV1Schema: z.ZodDiscriminatedUnion<"kind", [z.
11
11
  bytes: z.ZodNumber;
12
12
  }, "strip", z.ZodTypeAny, {
13
13
  kind: "segment_closed";
14
- sessionId: string;
15
14
  v: 1;
16
- sha256: string;
17
15
  manifestIndex: number;
16
+ sessionId: string;
18
17
  firstEventIndex: number;
19
18
  lastEventIndex: number;
20
19
  segmentRelPath: string;
20
+ sha256: string;
21
21
  bytes: number;
22
22
  }, {
23
23
  kind: "segment_closed";
24
- sessionId: string;
25
24
  v: 1;
26
- sha256: string;
27
25
  manifestIndex: number;
26
+ sessionId: string;
28
27
  firstEventIndex: number;
29
28
  lastEventIndex: number;
30
29
  segmentRelPath: string;
30
+ sha256: string;
31
31
  bytes: number;
32
32
  }>, z.ZodObject<{
33
33
  v: z.ZodLiteral<1>;
@@ -39,17 +39,17 @@ export declare const ManifestRecordV1Schema: z.ZodDiscriminatedUnion<"kind", [z.
39
39
  createdByEventId: z.ZodString;
40
40
  }, "strip", z.ZodTypeAny, {
41
41
  kind: "snapshot_pinned";
42
- sessionId: string;
43
42
  v: 1;
44
43
  manifestIndex: number;
44
+ sessionId: string;
45
45
  eventIndex: number;
46
46
  snapshotRef: string;
47
47
  createdByEventId: string;
48
48
  }, {
49
49
  kind: "snapshot_pinned";
50
- sessionId: string;
51
50
  v: 1;
52
51
  manifestIndex: number;
52
+ sessionId: string;
53
53
  eventIndex: number;
54
54
  snapshotRef: string;
55
55
  createdByEventId: string;
@@ -90,6 +90,8 @@ export declare const NodeOutputAppendedDataV1Schema: z.ZodEffects<z.ZodObject<{
90
90
  content?: unknown;
91
91
  }>]>;
92
92
  }, "strip", z.ZodTypeAny, {
93
+ outputId: string;
94
+ outputChannel: "recap" | "artifact";
93
95
  payload: {
94
96
  payloadKind: "notes";
95
97
  notesMarkdown: string;
@@ -100,10 +102,10 @@ export declare const NodeOutputAppendedDataV1Schema: z.ZodEffects<z.ZodObject<{
100
102
  byteLength: number;
101
103
  content?: unknown;
102
104
  };
103
- outputId: string;
104
- outputChannel: "recap" | "artifact";
105
105
  supersedesOutputId?: string | undefined;
106
106
  }, {
107
+ outputId: string;
108
+ outputChannel: "recap" | "artifact";
107
109
  payload: {
108
110
  payloadKind: "notes";
109
111
  notesMarkdown: string;
@@ -114,10 +116,10 @@ export declare const NodeOutputAppendedDataV1Schema: z.ZodEffects<z.ZodObject<{
114
116
  byteLength: number;
115
117
  content?: unknown;
116
118
  };
117
- outputId: string;
118
- outputChannel: "recap" | "artifact";
119
119
  supersedesOutputId?: string | undefined;
120
120
  }>, {
121
+ outputId: string;
122
+ outputChannel: "recap" | "artifact";
121
123
  payload: {
122
124
  payloadKind: "notes";
123
125
  notesMarkdown: string;
@@ -128,10 +130,10 @@ export declare const NodeOutputAppendedDataV1Schema: z.ZodEffects<z.ZodObject<{
128
130
  byteLength: number;
129
131
  content?: unknown;
130
132
  };
131
- outputId: string;
132
- outputChannel: "recap" | "artifact";
133
133
  supersedesOutputId?: string | undefined;
134
134
  }, {
135
+ outputId: string;
136
+ outputChannel: "recap" | "artifact";
135
137
  payload: {
136
138
  payloadKind: "notes";
137
139
  notesMarkdown: string;
@@ -142,7 +144,5 @@ export declare const NodeOutputAppendedDataV1Schema: z.ZodEffects<z.ZodObject<{
142
144
  byteLength: number;
143
145
  content?: unknown;
144
146
  };
145
- outputId: string;
146
- outputChannel: "recap" | "artifact";
147
147
  supersedesOutputId?: string | undefined;
148
148
  }>;
@@ -46,23 +46,23 @@ export declare const ValidationPerformedDataV1Schema: z.ZodObject<{
46
46
  suggestions: readonly string[];
47
47
  }>;
48
48
  }, "strict", z.ZodTypeAny, {
49
+ validationId: string;
50
+ attemptId: string;
49
51
  contractRef: string;
50
52
  result: {
51
53
  issues: readonly string[];
52
54
  valid: boolean;
53
55
  suggestions: readonly string[];
54
56
  };
57
+ }, {
55
58
  validationId: string;
56
59
  attemptId: string;
57
- }, {
58
60
  contractRef: string;
59
61
  result: {
60
62
  issues: readonly string[];
61
63
  valid: boolean;
62
64
  suggestions: readonly string[];
63
65
  };
64
- validationId: string;
65
- attemptId: string;
66
66
  }>;
67
67
  export type ValidationPerformedDataV1 = z.infer<typeof ValidationPerformedDataV1Schema>;
68
68
  export type ValidationPerformedResultV1 = z.infer<typeof ValidationPerformedResultV1Schema>;
@@ -4,4 +4,5 @@ import type { WorkflowService } from '../../application/services/workflow-servic
4
4
  import type { ToolCallTimingRingBuffer } from '../../mcp/tool-call-timing.js';
5
5
  import type { TriggerRouter } from '../../trigger/trigger-router.js';
6
6
  import type { V2ToolContext } from '../../mcp/types.js';
7
- export declare function mountConsoleRoutes(app: Application, consoleService: ConsoleService, workflowService?: WorkflowService, timingRingBuffer?: ToolCallTimingRingBuffer, toolCallsPerfFile?: string, serverVersion?: string, v2ToolContext?: V2ToolContext, triggerRouter?: TriggerRouter): () => void;
7
+ import type { SteerRegistry } from '../../daemon/workflow-runner.js';
8
+ export declare function mountConsoleRoutes(app: Application, consoleService: ConsoleService, workflowService?: WorkflowService, timingRingBuffer?: ToolCallTimingRingBuffer, toolCallsPerfFile?: string, serverVersion?: string, v2ToolContext?: V2ToolContext, triggerRouter?: TriggerRouter, steerRegistry?: SteerRegistry): () => void;
@@ -45,6 +45,7 @@ const worktree_service_js_1 = require("./worktree-service.js");
45
45
  const workflow_js_1 = require("../../types/workflow.js");
46
46
  const dev_mode_js_1 = require("../../mcp/dev-mode.js");
47
47
  const workflow_runner_js_1 = require("../../daemon/workflow-runner.js");
48
+ const assert_never_js_1 = require("../../runtime/assert-never.js");
48
49
  const start_js_1 = require("../../mcp/handlers/v2-execution/start.js");
49
50
  const v2_token_ops_js_1 = require("../../mcp/handlers/v2-token-ops.js");
50
51
  function watchSessionsDir(sessionsDir, onChanged) {
@@ -90,7 +91,7 @@ function loadWorkflowTags() {
90
91
  return { version: 0, tags: [], workflows: {} };
91
92
  }
92
93
  }
93
- function mountConsoleRoutes(app, consoleService, workflowService, timingRingBuffer, toolCallsPerfFile, serverVersion, v2ToolContext, triggerRouter) {
94
+ function mountConsoleRoutes(app, consoleService, workflowService, timingRingBuffer, toolCallsPerfFile, serverVersion, v2ToolContext, triggerRouter, steerRegistry) {
94
95
  const sseClients = new Set();
95
96
  let sseDebounceTimer = null;
96
97
  function broadcastChange() {
@@ -590,18 +591,21 @@ function mountConsoleRoutes(app, consoleService, workflowService, timingRingBuff
590
591
  triggerRouter.dispatch(trigger);
591
592
  }
592
593
  else {
593
- void (0, workflow_runner_js_1.runWorkflow)(trigger, v2ToolContext, apiKey ?? '').then((result) => {
594
+ void (0, workflow_runner_js_1.runWorkflow)(trigger, v2ToolContext, apiKey ?? '', undefined, undefined, steerRegistry).then((result) => {
594
595
  if (result._tag === 'success') {
595
596
  console.log(`[ConsoleRoutes] Auto dispatch completed: workflowId=${workflowId} stopReason=${result.stopReason}`);
596
597
  }
598
+ else if (result._tag === 'delivery_failed') {
599
+ console.log(`[ConsoleRoutes] Auto dispatch delivery failed: workflowId=${workflowId}`);
600
+ }
597
601
  else if (result._tag === 'timeout') {
598
602
  console.log(`[ConsoleRoutes] Auto dispatch timed out: workflowId=${workflowId}`);
599
603
  }
600
- else if (result._tag === 'delivery_failed') {
601
- console.log(`[ConsoleRoutes] Auto dispatch delivery failed: workflowId=${workflowId}`);
604
+ else if (result._tag === 'error') {
605
+ console.log(`[ConsoleRoutes] Auto dispatch failed: workflowId=${workflowId} error=${result.message}`);
602
606
  }
603
607
  else {
604
- console.log(`[ConsoleRoutes] Auto dispatch failed: workflowId=${workflowId} error=${result.message}`);
608
+ (0, assert_never_js_1.assertNever)(result);
605
609
  }
606
610
  });
607
611
  }
@@ -621,6 +625,26 @@ function mountConsoleRoutes(app, consoleService, workflowService, timingRingBuff
621
625
  }));
622
626
  res.json({ success: true, data: { triggers } });
623
627
  });
628
+ app.post('/api/v2/sessions/:sessionId/steer', express_1.default.json(), (req, res) => {
629
+ if (!steerRegistry) {
630
+ res.status(503).json({ success: false, error: 'Steer not available (not a daemon context).' });
631
+ return;
632
+ }
633
+ const { sessionId } = req.params;
634
+ const body = req.body;
635
+ const text = typeof body.text === 'string' ? body.text.trim() : '';
636
+ if (!text) {
637
+ res.status(400).json({ success: false, error: 'text is required and must be a non-empty string.' });
638
+ return;
639
+ }
640
+ const callback = steerRegistry.get(sessionId);
641
+ if (!callback) {
642
+ res.status(404).json({ success: false, error: 'Session not found or not a daemon session.' });
643
+ return;
644
+ }
645
+ callback(text);
646
+ res.json({ success: true });
647
+ });
624
648
  const consoleDist = resolveConsoleDist();
625
649
  if (consoleDist) {
626
650
  app.use('/console', express_1.default.static(consoleDist, {
@@ -585,6 +585,17 @@ function extractRepoRoot(events) {
585
585
  }
586
586
  return workspacePathFallback;
587
587
  }
588
+ function extractParentSessionId(events) {
589
+ for (const e of events) {
590
+ if (e.kind === constants_js_1.EVENT_KIND.SESSION_CREATED) {
591
+ const parentId = e.data.parentSessionId;
592
+ if (typeof parentId === 'string' && parentId.length > 0)
593
+ return parentId;
594
+ return null;
595
+ }
596
+ }
597
+ return null;
598
+ }
588
599
  function truncateTitle(text, maxLen = 120) {
589
600
  if (text.length <= maxLen)
590
601
  return text;
@@ -612,6 +623,7 @@ function projectSessionSummary(sessionId, truth, completionByRunId, workflowName
612
623
  const sessionTitle = sortedEventsRes.isOk() ? deriveSessionTitle(sortedEventsRes.value) : null;
613
624
  const gitBranch = extractGitBranch(events);
614
625
  const repoRoot = extractRepoRoot(events);
626
+ const parentSessionId = extractParentSessionId(events);
615
627
  const isAutonomous = (() => {
616
628
  if (!sortedEventsRes.isOk())
617
629
  return false;
@@ -643,6 +655,7 @@ function projectSessionSummary(sessionId, truth, completionByRunId, workflowName
643
655
  lastModifiedMs,
644
656
  isAutonomous,
645
657
  isLive,
658
+ parentSessionId,
646
659
  };
647
660
  }
648
661
  const workflow = run.workflow;
@@ -688,6 +701,7 @@ function projectSessionSummary(sessionId, truth, completionByRunId, workflowName
688
701
  lastModifiedMs,
689
702
  isAutonomous,
690
703
  isLive,
704
+ parentSessionId,
691
705
  };
692
706
  }
693
707
  function projectSessionDetail(sessionId, truth, completionByRunId, stepLabels, workflowNames, skippedStepsMap = {}) {
@@ -20,6 +20,7 @@ export interface ConsoleSessionSummary {
20
20
  readonly lastModifiedMs: number;
21
21
  readonly isAutonomous: boolean;
22
22
  readonly isLive: boolean;
23
+ readonly parentSessionId: string | null;
23
24
  }
24
25
  export interface ConsoleSessionListResponse {
25
26
  readonly sessions: readonly ConsoleSessionSummary[];
package/docs/authoring.md CHANGED
@@ -42,7 +42,7 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
42
42
  **Source refs**
43
43
  - `spec/workflow.schema.json` (schema) — Legal structure and supported fields.
44
44
  - `src/application/services/validation-engine.ts` (runtime) — Validator-enforced authoring rules.
45
- - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Current modern example.
45
+ - `workflows/coding-task-workflow-agentic.json` (example) — Current modern example.
46
46
 
47
47
  ### validate-early-and-often
48
48
  - **Level**: required
@@ -141,7 +141,7 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
141
141
  - Part A / Part B / Rules: ... when the structure adds ceremony rather than clarity
142
142
 
143
143
  **Example refs**
144
- - `workflows/coding-task-workflow-agentic.lean.v2.json` — See the sharpened user-voiced prompts in the current lean coding workflow.
144
+ - `workflows/coding-task-workflow-agentic.json` — See the sharpened user-voiced prompts in the current lean coding workflow.
145
145
 
146
146
  ### protocol-footers-stay-explicit
147
147
  - **Level**: required
@@ -160,10 +160,10 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
160
160
  - Replacing exact capture requirements with vague summary prose
161
161
 
162
162
  **Example refs**
163
- - `workflows/coding-task-workflow-agentic.lean.v2.json` — Uses compact Capture footers and explicit loop-control wording.
163
+ - `workflows/coding-task-workflow-agentic.json` — Uses compact Capture footers and explicit loop-control wording.
164
164
 
165
165
  **Source refs**
166
- - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Uses explicit capture footers and shape-preserving loop outputs.
166
+ - `workflows/coding-task-workflow-agentic.json` (example) — Uses explicit capture footers and shape-preserving loop outputs.
167
167
 
168
168
 
169
169
  ## Prompt composition
@@ -185,11 +185,11 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
185
185
  - Encoding runtime logic in prose when promptFragments or templates are the right mechanism
186
186
 
187
187
  **Example refs**
188
- - `workflows/coding-task-workflow-agentic.lean.v2.json` — Uses prompt fragments and context templates to keep prompts slimmer at render time.
188
+ - `workflows/coding-task-workflow-agentic.json` — Uses prompt fragments and context templates to keep prompts slimmer at render time.
189
189
 
190
190
  **Source refs**
191
191
  - `docs/authoring.md` (documentation) — Documents context templates and prompt fragments.
192
- - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Uses prompt fragments to slim mode-specific prompt branches.
192
+ - `workflows/coding-task-workflow-agentic.json` (example) — Uses prompt fragments to slim mode-specific prompt branches.
193
193
 
194
194
  ### templates-are-for-simple-substitution
195
195
  - **Level**: recommended
@@ -405,11 +405,11 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
405
405
  - Prompt text says to stop, but the example output only permits continue
406
406
 
407
407
  **Example refs**
408
- - `workflows/coding-task-workflow-agentic.lean.v2.json` — Current loop decision steps show shape-only output examples.
408
+ - `workflows/coding-task-workflow-agentic.json` — Current loop decision steps show shape-only output examples.
409
409
 
410
410
  **Source refs**
411
411
  - `scripts/validate-workflows-registry.ts` (validator) — Registry validation should preserve semantically correct discoverable workflows.
412
- - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Current loop decision prompts show shape-only output examples.
412
+ - `workflows/coding-task-workflow-agentic.json` (example) — Current loop decision prompts show shape-only output examples.
413
413
 
414
414
  ### loops-need-real-exit-rules
415
415
  - **Level**: required
@@ -445,7 +445,7 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
445
445
  - `contextAuditNeeded = true|false` without an explicit rubric
446
446
 
447
447
  **Example refs**
448
- - `workflows/coding-task-workflow-agentic.lean.v2.json` — Phase 0 uses a context-clarity rubric instead of a vibes-only confidence flag.
448
+ - `workflows/coding-task-workflow-agentic.json` — Phase 0 uses a context-clarity rubric instead of a vibes-only confidence flag.
449
449
 
450
450
 
451
451
  ## Confirmation discipline
@@ -466,7 +466,7 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
466
466
  - Using requireConfirmation as a substitute for clear loop or rigor policy
467
467
 
468
468
  **Source refs**
469
- - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Uses confirmation for real review barriers like MultiPR checkpoints.
469
+ - `workflows/coding-task-workflow-agentic.json` (example) — Uses confirmation for real review barriers like MultiPR checkpoints.
470
470
 
471
471
 
472
472
  ## Assessment gates
@@ -544,7 +544,7 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
544
544
  - Treating named builder or researcher roles as alternate owners
545
545
 
546
546
  **Source refs**
547
- - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Delegation checkpoints keep the main agent as the synthesizer and decision-maker.
547
+ - `workflows/coding-task-workflow-agentic.json` (example) — Delegation checkpoints keep the main agent as the synthesizer and decision-maker.
548
548
 
549
549
  ### batched-checkpoints-over-ad-hoc-optionality
550
550
  - **Level**: recommended
@@ -563,7 +563,7 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
563
563
  - Optional challenge wording at high-value decision points
564
564
 
565
565
  **Example refs**
566
- - `workflows/coding-task-workflow-agentic.lean.v2.json` — Uses explicit challenge, audit, and verification barriers.
566
+ - `workflows/coding-task-workflow-agentic.json` — Uses explicit challenge, audit, and verification barriers.
567
567
 
568
568
 
569
569
  ## Subagent synthesis and claim adoption
@@ -601,10 +601,10 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
601
601
  - Using delegated findings as blockers or green lights without verification
602
602
 
603
603
  **Example refs**
604
- - `workflows/coding-task-workflow-agentic.lean.v2.json` — Major synthesis checkpoints use Confirmed / Plausible / Rejected for decision-driving findings.
604
+ - `workflows/coding-task-workflow-agentic.json` — Major synthesis checkpoints use Confirmed / Plausible / Rejected for decision-driving findings.
605
605
 
606
606
  **Source refs**
607
- - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Major synthesis checkpoints use Confirmed / Plausible / Rejected for adopted claims.
607
+ - `workflows/coding-task-workflow-agentic.json` (example) — Major synthesis checkpoints use Confirmed / Plausible / Rejected for adopted claims.
608
608
 
609
609
 
610
610
  ## Discouraged legacy patterns
@@ -670,7 +670,7 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
670
670
  - Keeping a canonical example ref after the workflow has drifted into a legacy style
671
671
 
672
672
  **Example refs**
673
- - `workflows/coding-task-workflow-agentic.lean.v2.json` — Current example of modern prompt composition, delegation barriers, and loop semantics.
673
+ - `workflows/coding-task-workflow-agentic.json` — Current example of modern prompt composition, delegation barriers, and loop semantics.
674
674
 
675
675
 
676
676
  ## Validation
@@ -728,7 +728,7 @@ Canonical current rules for authoring good WorkRail workflows. workflow.schema.j
728
728
  - Verification steps check one artifact while planning updates a different one
729
729
 
730
730
  **Example refs**
731
- - `workflows/coding-task-workflow-agentic.lean.v2.json` — Uses explicit spec vs implementation-plan ownership.
731
+ - `workflows/coding-task-workflow-agentic.json` — Uses explicit spec vs implementation-plan ownership.
732
732
 
733
733
 
734
734
  ## Planned guidance