@exaudeus/workrail 3.41.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 (39) hide show
  1. package/dist/cli-worktrain.js +40 -11
  2. package/dist/console-ui/assets/{index-CQt4UhPB.js → index-DwfWMKvv.js} +1 -1
  3. package/dist/console-ui/index.html +1 -1
  4. package/dist/context-assembly/deps.d.ts +8 -0
  5. package/dist/context-assembly/deps.js +2 -0
  6. package/dist/context-assembly/index.d.ts +6 -0
  7. package/dist/context-assembly/index.js +50 -0
  8. package/dist/context-assembly/infra.d.ts +3 -0
  9. package/dist/context-assembly/infra.js +154 -0
  10. package/dist/context-assembly/types.d.ts +30 -0
  11. package/dist/context-assembly/types.js +2 -0
  12. package/dist/coordinators/pr-review.d.ts +3 -1
  13. package/dist/coordinators/pr-review.js +25 -4
  14. package/dist/daemon/workflow-runner.js +11 -0
  15. package/dist/domain/execution/state.d.ts +6 -6
  16. package/dist/manifest.json +64 -32
  17. package/dist/mcp/handlers/v2-workflow.d.ts +2 -2
  18. package/dist/mcp/output-schemas.d.ts +234 -234
  19. package/dist/mcp/tools.d.ts +2 -2
  20. package/dist/mcp/v2/tools.d.ts +24 -24
  21. package/dist/v2/durable-core/schemas/artifacts/assessment.d.ts +2 -2
  22. package/dist/v2/durable-core/schemas/artifacts/coordinator-signal.d.ts +2 -2
  23. package/dist/v2/durable-core/schemas/artifacts/loop-control.d.ts +6 -6
  24. package/dist/v2/durable-core/schemas/artifacts/review-verdict.d.ts +6 -6
  25. package/dist/v2/durable-core/schemas/compiled-workflow/index.d.ts +56 -56
  26. package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.d.ts +83 -83
  27. package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +1024 -1024
  28. package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +2336 -2336
  29. package/dist/v2/durable-core/schemas/session/dag-topology.d.ts +6 -6
  30. package/dist/v2/durable-core/schemas/session/events.d.ts +339 -339
  31. package/dist/v2/durable-core/schemas/session/gaps.d.ts +30 -30
  32. package/dist/v2/durable-core/schemas/session/manifest.d.ts +6 -6
  33. package/dist/v2/durable-core/schemas/session/outputs.d.ts +8 -8
  34. package/dist/v2/durable-core/schemas/session/validation-event.d.ts +3 -3
  35. package/docs/design/context-assembly-design-candidates.md +199 -0
  36. package/docs/design/context-assembly-implementation-plan.md +211 -0
  37. package/docs/design/context-assembly-review-findings.md +112 -0
  38. package/docs/ideas/backlog.md +64 -0
  39. package/package.json +1 -1
@@ -47,7 +47,9 @@ const child_process_1 = require("child_process");
47
47
  const util_1 = require("util");
48
48
  const crypto_1 = require("crypto");
49
49
  const interpret_result_js_1 = require("./cli/interpret-result.js");
50
- const index_js_1 = require("./cli/commands/index.js");
50
+ const index_js_1 = require("./context-assembly/index.js");
51
+ const infra_js_1 = require("./context-assembly/infra.js");
52
+ const index_js_2 = require("./cli/commands/index.js");
51
53
  const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
52
54
  const program = new commander_1.Command();
53
55
  program
@@ -65,7 +67,7 @@ program
65
67
  }
66
68
  const rl = (0, promises_1.createInterface)({ input: process_1.stdin, output: process_1.stdout, terminal: true });
67
69
  try {
68
- const result = await (0, index_js_1.executeWorktrainInitCommand)({
70
+ const result = await (0, index_js_2.executeWorktrainInitCommand)({
69
71
  prompt: async (question, defaultValue) => {
70
72
  if (options.yes) {
71
73
  return defaultValue ?? '';
@@ -119,7 +121,7 @@ program
119
121
  .choices(['high', 'normal', 'low'])
120
122
  .default('normal'))
121
123
  .action(async (message, options) => {
122
- const result = await (0, index_js_1.executeWorktrainTellCommand)(message, {
124
+ const result = await (0, index_js_2.executeWorktrainTellCommand)(message, {
123
125
  appendFile: (p, content) => fs_1.default.promises.appendFile(p, content, 'utf-8'),
124
126
  mkdir: (p, opts) => fs_1.default.promises.mkdir(p, opts),
125
127
  homedir: os_1.default.homedir,
@@ -138,7 +140,7 @@ program
138
140
  .description('Read unread messages from the WorkTrain daemon (~/.workrail/outbox.jsonl)')
139
141
  .option('-w, --watch', 'Watch for new messages in real time (not yet implemented)')
140
142
  .action(async (options) => {
141
- const result = await (0, index_js_1.executeWorktrainInboxCommand)({
143
+ const result = await (0, index_js_2.executeWorktrainInboxCommand)({
142
144
  readFile: (p) => fs_1.default.promises.readFile(p, 'utf-8'),
143
145
  writeFile: (p, content) => fs_1.default.promises.writeFile(p, content, 'utf-8'),
144
146
  mkdir: (p, opts) => fs_1.default.promises.mkdir(p, opts),
@@ -156,7 +158,7 @@ program
156
158
  .requiredOption('-W, --workspace <path>', 'Absolute path to the workspace directory')
157
159
  .option('-p, --port <n>', 'Console HTTP server port (default: auto-discover from lock file, then 3456)', parseInt)
158
160
  .action(async (options) => {
159
- const result = await (0, index_js_1.executeWorktrainSpawnCommand)({
161
+ const result = await (0, index_js_2.executeWorktrainSpawnCommand)({
160
162
  fetch: (url, opts) => globalThis.fetch(url, opts),
161
163
  readFile: (p) => fs_1.default.promises.readFile(p, 'utf-8'),
162
164
  stdout: (line) => process.stdout.write(line + '\n'),
@@ -182,7 +184,7 @@ program
182
184
  .option('-p, --port <n>', 'Console HTTP server port (default: auto-discover from lock file, then 3456)', parseInt)
183
185
  .action(async (options) => {
184
186
  const mode = options.mode === 'any' ? 'any' : 'all';
185
- const result = await (0, index_js_1.executeWorktrainAwaitCommand)({
187
+ const result = await (0, index_js_2.executeWorktrainAwaitCommand)({
186
188
  fetch: (url) => globalThis.fetch(url),
187
189
  readFile: (p) => fs_1.default.promises.readFile(p, 'utf-8'),
188
190
  stdout: (line) => process.stdout.write(line + '\n'),
@@ -243,7 +245,7 @@ program
243
245
  .action(async (options) => {
244
246
  const { execFile: execFileRaw } = await Promise.resolve().then(() => __importStar(require('child_process')));
245
247
  const execFilePromise = (0, util_1.promisify)(execFileRaw);
246
- const result = await (0, index_js_1.executeWorktrainDaemonCommand)({
248
+ const result = await (0, index_js_2.executeWorktrainDaemonCommand)({
247
249
  env: process_1.env,
248
250
  platform: process.platform,
249
251
  worktrainBinPath: process.argv[1],
@@ -572,9 +574,9 @@ program
572
574
  runHealthSummary(sessionId, raw);
573
575
  return;
574
576
  }
575
- await (0, index_js_1.executeWorktrainOverviewCommand)({
577
+ await (0, index_js_2.executeWorktrainOverviewCommand)({
576
578
  now: () => Date.now(),
577
- buildConsoleService: index_js_1.buildConsoleServiceFromDataDir,
579
+ buildConsoleService: index_js_2.buildConsoleServiceFromDataDir,
578
580
  homedir: os_1.default.homedir,
579
581
  joinPath: path_1.default.join,
580
582
  print: (line) => process.stdout.write(line + '\n'),
@@ -738,13 +740,18 @@ runCommand
738
740
  joinPath: path_1.default.join,
739
741
  }, options.port);
740
742
  const deps = {
741
- spawnSession: async (workflowId, goal, workspace) => {
743
+ spawnSession: async (workflowId, goal, workspace, context) => {
742
744
  const url = `http://127.0.0.1:${port}/api/v2/auto/dispatch`;
743
745
  try {
744
746
  const response = await globalThis.fetch(url, {
745
747
  method: 'POST',
746
748
  headers: { 'Content-Type': 'application/json' },
747
- body: JSON.stringify({ workflowId, goal, workspacePath: workspace }),
749
+ body: JSON.stringify({
750
+ workflowId,
751
+ goal,
752
+ workspacePath: workspace,
753
+ ...(context !== undefined ? { context } : {}),
754
+ }),
748
755
  signal: AbortSignal.timeout(30000),
749
756
  });
750
757
  const body = await response.json();
@@ -777,6 +784,28 @@ runCommand
777
784
  return { kind: 'err', error: `Dispatch request failed: ${msg}` };
778
785
  }
779
786
  },
787
+ contextAssembler: (0, index_js_1.createContextAssembler)({
788
+ execGit: async (args, cwd) => {
789
+ try {
790
+ const { stdout } = await execFileAsync('git', [...args], { cwd });
791
+ return { kind: 'ok', value: stdout };
792
+ }
793
+ catch (e) {
794
+ return { kind: 'err', error: e instanceof Error ? e.message : String(e) };
795
+ }
796
+ },
797
+ execGh: async (args, cwd) => {
798
+ try {
799
+ const { stdout } = await execFileAsync('gh', [...args], { cwd });
800
+ return { kind: 'ok', value: stdout };
801
+ }
802
+ catch (e) {
803
+ return { kind: 'err', error: e instanceof Error ? e.message : String(e) };
804
+ }
805
+ },
806
+ listRecentSessions: (0, infra_js_1.createListRecentSessions)(),
807
+ nowIso: () => new Date().toISOString(),
808
+ }),
780
809
  awaitSessions: async (handles, timeoutMs) => {
781
810
  const { executeWorktrainAwaitCommand } = await Promise.resolve().then(() => __importStar(require('./cli/commands/worktrain-await.js')));
782
811
  let resolvedResult = null;