@exaudeus/workrail 3.11.1 → 3.12.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 (37) hide show
  1. package/dist/console/assets/index-CRgjJiMS.js +28 -0
  2. package/dist/console/assets/index-DW78t31j.css +1 -0
  3. package/dist/console/index.html +2 -2
  4. package/dist/manifest.json +67 -59
  5. package/dist/mcp/handlers/shared/request-workflow-reader.d.ts +10 -2
  6. package/dist/mcp/handlers/shared/request-workflow-reader.js +27 -10
  7. package/dist/mcp/handlers/shared/workflow-source-visibility.d.ts +3 -1
  8. package/dist/mcp/handlers/shared/workflow-source-visibility.js +7 -3
  9. package/dist/mcp/handlers/v2-execution/replay.js +25 -1
  10. package/dist/mcp/handlers/v2-execution/start.js +23 -17
  11. package/dist/mcp/handlers/v2-workflow.js +123 -8
  12. package/dist/mcp/output-schemas.d.ts +393 -0
  13. package/dist/mcp/output-schemas.js +49 -1
  14. package/dist/mcp/tools.js +5 -5
  15. package/dist/mcp/v2/tools.d.ts +3 -0
  16. package/dist/mcp/v2/tools.js +3 -2
  17. package/dist/v2/durable-core/constants.d.ts +1 -0
  18. package/dist/v2/durable-core/constants.js +2 -1
  19. package/dist/v2/durable-core/domain/observation-builder.d.ts +4 -1
  20. package/dist/v2/durable-core/domain/observation-builder.js +9 -0
  21. package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +76 -16
  22. package/dist/v2/durable-core/schemas/session/events.d.ts +26 -5
  23. package/dist/v2/durable-core/schemas/session/events.js +2 -1
  24. package/dist/v2/infra/local/session-summary-provider/index.js +2 -0
  25. package/dist/v2/infra/local/workspace-anchor/index.js +1 -0
  26. package/dist/v2/ports/workspace-anchor.port.d.ts +3 -0
  27. package/dist/v2/projections/resume-ranking.d.ts +1 -0
  28. package/dist/v2/usecases/console-routes.js +26 -0
  29. package/dist/v2/usecases/console-service.js +25 -6
  30. package/dist/v2/usecases/console-types.d.ts +22 -1
  31. package/dist/v2/usecases/worktree-service.d.ts +10 -0
  32. package/dist/v2/usecases/worktree-service.js +136 -0
  33. package/package.json +1 -1
  34. package/workflows/architecture-scalability-audit.json +317 -0
  35. package/workflows/routines/tension-driven-design.json +5 -5
  36. package/dist/console/assets/index-C5C4nDs4.css +0 -1
  37. package/dist/console/assets/index-CSUqsoQl.js +0 -28
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.handleV2ListWorkflows = handleV2ListWorkflows;
4
7
  exports.handleV2InspectWorkflow = handleV2InspectWorkflow;
8
+ const path_1 = __importDefault(require("path"));
5
9
  const neverthrow_1 = require("neverthrow");
6
10
  const types_js_1 = require("../types.js");
7
11
  const error_mapper_js_1 = require("../error-mapper.js");
@@ -29,7 +33,7 @@ async function handleV2ListWorkflows(input, ctx) {
29
33
  return rememberedRootRecordsResult;
30
34
  const rememberedRootRecords = rememberedRootRecordsResult;
31
35
  const { crypto, pinnedStore } = guard.ctx.v2;
32
- const workflowReader = (0, request_workflow_reader_js_1.hasRequestWorkspaceSignal)({
36
+ const readerResult = (0, request_workflow_reader_js_1.hasRequestWorkspaceSignal)({
33
37
  workspacePath: input.workspacePath,
34
38
  resolvedRootUris: guard.ctx.v2.resolvedRootUris,
35
39
  })
@@ -39,7 +43,9 @@ async function handleV2ListWorkflows(input, ctx) {
39
43
  resolvedRootUris: guard.ctx.v2.resolvedRootUris,
40
44
  rememberedRootsStore: guard.ctx.v2.rememberedRootsStore,
41
45
  })
42
- : ctx.workflowService;
46
+ : { reader: ctx.workflowService, stalePaths: [] };
47
+ const workflowReader = readerResult.reader;
48
+ const stalePaths = readerResult.stalePaths;
43
49
  return neverthrow_1.ResultAsync.fromPromise((0, with_timeout_js_1.withTimeout)(workflowReader.listWorkflowSummaries(), TIMEOUT_MS, 'list_workflows'), (err) => (0, error_mapper_js_1.mapUnknownErrorToToolError)(err))
44
50
  .andThen((summaries) => neverthrow_1.ResultAsync.combine(summaries.map((s) => neverthrow_1.ResultAsync.fromPromise(buildV2WorkflowListItem({
45
51
  summary: s,
@@ -48,11 +54,30 @@ async function handleV2ListWorkflows(input, ctx) {
48
54
  crypto,
49
55
  pinnedStore,
50
56
  }), (err) => (0, error_mapper_js_1.mapUnknownErrorToToolError)(err)))))
51
- .map((compiled) => {
52
- const payload = output_schemas_js_1.V2WorkflowListOutputSchema.parse({
53
- workflows: compiled.sort((a, b) => a.workflowId.localeCompare(b.workflowId)),
57
+ .andThen((compiled) => {
58
+ if (!input.includeSources) {
59
+ const payload = output_schemas_js_1.V2WorkflowListOutputSchema.parse({
60
+ workflows: compiled.sort((a, b) => a.workflowId.localeCompare(b.workflowId)),
61
+ ...(stalePaths.length > 0 ? { staleRoots: [...stalePaths] } : {}),
62
+ });
63
+ return (0, neverthrow_1.okAsync)((0, types_js_1.success)(payload));
64
+ }
65
+ if (!(0, workflow_source_visibility_js_1.isCompositeWorkflowReader)(workflowReader)) {
66
+ const payload = output_schemas_js_1.V2WorkflowListOutputSchema.parse({
67
+ workflows: compiled.sort((a, b) => a.workflowId.localeCompare(b.workflowId)),
68
+ ...(stalePaths.length > 0 ? { staleRoots: [...stalePaths] } : {}),
69
+ sources: [],
70
+ });
71
+ return (0, neverthrow_1.okAsync)((0, types_js_1.success)(payload));
72
+ }
73
+ return neverthrow_1.ResultAsync.fromPromise((0, with_timeout_js_1.withTimeout)(buildSourceCatalog(workflowReader, rememberedRootRecords), TIMEOUT_MS, 'list_workflow_sources'), (err) => (0, error_mapper_js_1.mapUnknownErrorToToolError)(err)).map((sources) => {
74
+ const payload = output_schemas_js_1.V2WorkflowListOutputSchema.parse({
75
+ workflows: compiled.sort((a, b) => a.workflowId.localeCompare(b.workflowId)),
76
+ ...(stalePaths.length > 0 ? { staleRoots: [...stalePaths] } : {}),
77
+ sources,
78
+ });
79
+ return (0, types_js_1.success)(payload);
54
80
  });
55
- return (0, types_js_1.success)(payload);
56
81
  })
57
82
  .match((result) => Promise.resolve(result), (err) => Promise.resolve(err));
58
83
  }
@@ -68,7 +93,7 @@ async function handleV2InspectWorkflow(input, ctx) {
68
93
  return rememberedRootRecordsResult;
69
94
  const rememberedRootRecords = rememberedRootRecordsResult;
70
95
  const { crypto, pinnedStore } = guard.ctx.v2;
71
- const workflowReader = (0, request_workflow_reader_js_1.hasRequestWorkspaceSignal)({
96
+ const readerResult = (0, request_workflow_reader_js_1.hasRequestWorkspaceSignal)({
72
97
  workspacePath: input.workspacePath,
73
98
  resolvedRootUris: guard.ctx.v2.resolvedRootUris,
74
99
  })
@@ -78,7 +103,9 @@ async function handleV2InspectWorkflow(input, ctx) {
78
103
  resolvedRootUris: guard.ctx.v2.resolvedRootUris,
79
104
  rememberedRootsStore: guard.ctx.v2.rememberedRootsStore,
80
105
  })
81
- : ctx.workflowService;
106
+ : { reader: ctx.workflowService, stalePaths: [] };
107
+ const workflowReader = readerResult.reader;
108
+ const stalePaths = readerResult.stalePaths;
82
109
  return neverthrow_1.ResultAsync.fromPromise((0, with_timeout_js_1.withTimeout)(workflowReader.getWorkflowById(input.workflowId), TIMEOUT_MS, 'inspect_workflow'), (err) => (0, error_mapper_js_1.mapUnknownErrorToToolError)(err))
83
110
  .andThen((workflow) => {
84
111
  if (!workflow) {
@@ -113,6 +140,7 @@ async function handleV2InspectWorkflow(input, ctx) {
113
140
  mode: input.mode,
114
141
  compiled: body,
115
142
  ...(visibility ? { visibility } : {}),
143
+ ...(stalePaths.length > 0 ? { staleRoots: [...stalePaths] } : {}),
116
144
  ...(references != null && references.length > 0 ? { references } : {}),
117
145
  });
118
146
  return (0, neverthrow_1.okAsync)((0, types_js_1.success)(payload));
@@ -181,3 +209,90 @@ async function buildV2WorkflowListItem(options) {
181
209
  visibility,
182
210
  };
183
211
  }
212
+ async function buildSourceCatalog(workflowReader, rememberedRootRecords) {
213
+ const instances = workflowReader.getStorageInstances();
214
+ const seenIds = new Set();
215
+ const sourceEntryDataReversed = [];
216
+ for (let i = instances.length - 1; i >= 0; i--) {
217
+ const instance = instances[i];
218
+ const summaries = await instance.listWorkflowSummaries();
219
+ const allIds = summaries.map((s) => s.id);
220
+ const effectiveIds = allIds.filter((id) => !seenIds.has(id));
221
+ for (const id of allIds)
222
+ seenIds.add(id);
223
+ sourceEntryDataReversed.push({ source: instance.source, allIds, effectiveIds });
224
+ }
225
+ const sourceEntryData = sourceEntryDataReversed.reverse();
226
+ return sourceEntryData.map((data) => deriveSourceCatalogEntry({ ...data, rememberedRootRecords, sourceEntryData }));
227
+ }
228
+ function deriveSourceCatalogEntry(options) {
229
+ const { source, allIds, effectiveIds, rememberedRootRecords, sourceEntryData } = options;
230
+ const total = allIds.length;
231
+ const effective = effectiveIds.length;
232
+ const shadowed = total - effective;
233
+ const sourceKey = deriveSourceKey(source);
234
+ const displayName = deriveDisplayName(source);
235
+ switch (source.kind) {
236
+ case 'bundled':
237
+ return { sourceKey, category: 'built_in', source: { kind: source.kind, displayName }, sourceMode: 'built_in', effectiveWorkflowCount: effective, totalWorkflowCount: total, shadowedWorkflowCount: shadowed };
238
+ case 'user':
239
+ return { sourceKey, category: 'personal', source: { kind: source.kind, displayName }, sourceMode: 'personal', effectiveWorkflowCount: effective, totalWorkflowCount: total, shadowedWorkflowCount: shadowed };
240
+ case 'project': {
241
+ const thisIds = new Set(allIds);
242
+ const hasMigrationOverlap = sourceEntryData.some((e) => {
243
+ if (e.source === source || e.source.kind !== 'custom')
244
+ return false;
245
+ const rootedSharing = deriveRootedSharingForPath(e.source.directoryPath, rememberedRootRecords);
246
+ return rootedSharing != null && e.allIds.some((id) => thisIds.has(id));
247
+ });
248
+ const migration = hasMigrationOverlap
249
+ ? { preferredSource: 'rooted_sharing', currentSource: 'legacy_project', reason: 'legacy_project_precedence', summary: 'Project-scoped ./workflows currently overrides rooted .workrail/workflows during migration. Prefer rooted sharing for new team-shared workflows.' }
250
+ : undefined;
251
+ return { sourceKey, category: 'legacy_project', source: { kind: source.kind, displayName }, sourceMode: 'legacy_project', effectiveWorkflowCount: effective, totalWorkflowCount: total, shadowedWorkflowCount: shadowed, ...(migration ? { migration } : {}) };
252
+ }
253
+ case 'custom': {
254
+ const rootedSharing = deriveRootedSharingForPath(source.directoryPath, rememberedRootRecords);
255
+ const category = rootedSharing ? 'rooted_sharing' : 'external';
256
+ const sourceMode = rootedSharing ? 'rooted_sharing' : 'live_directory';
257
+ return { sourceKey, category, source: { kind: source.kind, displayName }, sourceMode, effectiveWorkflowCount: effective, totalWorkflowCount: total, shadowedWorkflowCount: shadowed, ...(rootedSharing ? { rootedSharing } : {}) };
258
+ }
259
+ case 'git':
260
+ case 'remote':
261
+ case 'plugin':
262
+ return { sourceKey, category: 'external', source: { kind: source.kind, displayName }, sourceMode: 'live_directory', effectiveWorkflowCount: effective, totalWorkflowCount: total, shadowedWorkflowCount: shadowed };
263
+ }
264
+ }
265
+ function deriveSourceKey(source) {
266
+ switch (source.kind) {
267
+ case 'bundled': return 'built_in';
268
+ case 'user': return `user:${source.directoryPath}`;
269
+ case 'project': return `project:${source.directoryPath}`;
270
+ case 'custom': return `custom:${source.directoryPath}`;
271
+ case 'git': return `git:${source.repositoryUrl}`;
272
+ case 'remote': return `remote:${source.registryUrl}`;
273
+ case 'plugin': return `plugin:${source.pluginName}`;
274
+ }
275
+ }
276
+ function deriveDisplayName(source) {
277
+ switch (source.kind) {
278
+ case 'bundled': return 'Built-in';
279
+ case 'user': return 'User Library';
280
+ case 'project': return 'Project';
281
+ case 'custom': return source.label ?? path_1.default.basename(source.directoryPath);
282
+ case 'git': return source.repositoryUrl;
283
+ case 'remote': return source.registryUrl;
284
+ case 'plugin': return source.pluginName;
285
+ }
286
+ }
287
+ function deriveRootedSharingForPath(sourcePath, rememberedRoots) {
288
+ const resolved = path_1.default.resolve(sourcePath);
289
+ for (const record of rememberedRoots) {
290
+ const rootPath = path_1.default.resolve(record.path);
291
+ const relative = path_1.default.relative(rootPath, resolved);
292
+ const isUnderRoot = relative.length === 0 || (!relative.startsWith('..') && !path_1.default.isAbsolute(relative));
293
+ if (!isUnderRoot)
294
+ continue;
295
+ return { kind: 'remembered_root', rootPath, groupLabel: (0, workflow_source_visibility_js_1.deriveGroupLabel)(rootPath, resolved) };
296
+ }
297
+ return undefined;
298
+ }