@exaudeus/workrail 0.11.0 → 0.13.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 (131) hide show
  1. package/dist/application/services/enhanced-loop-validator.js +3 -3
  2. package/dist/application/services/step-output-decoder.d.ts +6 -0
  3. package/dist/application/services/step-output-decoder.js +49 -0
  4. package/dist/application/services/validation-engine.d.ts +9 -0
  5. package/dist/application/services/validation-engine.js +142 -18
  6. package/dist/application/services/workflow-interpreter.d.ts +1 -1
  7. package/dist/application/services/workflow-interpreter.js +147 -81
  8. package/dist/application/services/workflow-service.d.ts +2 -0
  9. package/dist/application/services/workflow-service.js +3 -3
  10. package/dist/application/use-cases/validate-step-output.d.ts +2 -0
  11. package/dist/config/feature-flags.js +1 -1
  12. package/dist/di/container.js +88 -0
  13. package/dist/di/tokens.d.ts +16 -0
  14. package/dist/di/tokens.js +16 -0
  15. package/dist/domain/execution/state.d.ts +6 -6
  16. package/dist/domain/workflow-id-policy.d.ts +17 -0
  17. package/dist/domain/workflow-id-policy.js +57 -0
  18. package/dist/infrastructure/storage/enhanced-multi-source-workflow-storage.js +33 -6
  19. package/dist/infrastructure/storage/file-workflow-storage.js +3 -1
  20. package/dist/infrastructure/storage/schema-validating-workflow-storage.js +13 -8
  21. package/dist/manifest.json +329 -161
  22. package/dist/mcp/error-mapper.d.ts +3 -8
  23. package/dist/mcp/error-mapper.js +41 -19
  24. package/dist/mcp/handlers/session.js +25 -11
  25. package/dist/mcp/handlers/v2-execution-helpers.d.ts +99 -0
  26. package/dist/mcp/handlers/v2-execution-helpers.js +249 -0
  27. package/dist/mcp/handlers/v2-execution.d.ts +4 -0
  28. package/dist/mcp/handlers/v2-execution.js +1044 -0
  29. package/dist/mcp/handlers/v2-workflow.js +21 -16
  30. package/dist/mcp/handlers/workflow.js +21 -12
  31. package/dist/mcp/index.d.ts +1 -1
  32. package/dist/mcp/index.js +4 -1
  33. package/dist/mcp/output-schemas.d.ts +411 -4
  34. package/dist/mcp/output-schemas.js +57 -1
  35. package/dist/mcp/server.d.ts +1 -1
  36. package/dist/mcp/server.js +96 -65
  37. package/dist/mcp/tool-descriptions.js +32 -15
  38. package/dist/mcp/tools.js +26 -14
  39. package/dist/mcp/types/tool-description-types.d.ts +1 -1
  40. package/dist/mcp/types/tool-description-types.js +7 -5
  41. package/dist/mcp/types.d.ts +40 -3
  42. package/dist/mcp/types.js +32 -3
  43. package/dist/mcp/v2/tool-registry.js +16 -1
  44. package/dist/mcp/v2/tools.d.ts +45 -0
  45. package/dist/mcp/v2/tools.js +21 -1
  46. package/dist/mcp/validation/workflow-next-prevalidate.d.ts +2 -3
  47. package/dist/mcp/validation/workflow-next-prevalidate.js +38 -27
  48. package/dist/v2/durable-core/constants.d.ts +15 -0
  49. package/dist/v2/durable-core/constants.js +18 -0
  50. package/dist/v2/durable-core/domain/ack-advance-append-plan.d.ts +32 -0
  51. package/dist/v2/durable-core/domain/ack-advance-append-plan.js +95 -0
  52. package/dist/v2/durable-core/domain/loop-runtime.d.ts +50 -0
  53. package/dist/v2/durable-core/domain/loop-runtime.js +95 -0
  54. package/dist/v2/durable-core/domain/notes-markdown.d.ts +4 -0
  55. package/dist/v2/durable-core/domain/notes-markdown.js +46 -0
  56. package/dist/v2/durable-core/domain/outputs.d.ts +12 -0
  57. package/dist/v2/durable-core/domain/outputs.js +18 -0
  58. package/dist/v2/durable-core/ids/index.d.ts +2 -0
  59. package/dist/v2/durable-core/ids/index.js +4 -0
  60. package/dist/v2/durable-core/schemas/compiled-workflow/index.d.ts +100 -6
  61. package/dist/v2/durable-core/schemas/compiled-workflow/index.js +18 -3
  62. package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +113 -113
  63. package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.js +11 -10
  64. package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +7129 -0
  65. package/dist/v2/durable-core/schemas/export-bundle/index.js +82 -0
  66. package/dist/v2/durable-core/schemas/lib/decision-trace-ref.d.ts +80 -0
  67. package/dist/v2/durable-core/schemas/lib/decision-trace-ref.js +38 -0
  68. package/dist/v2/durable-core/schemas/lib/dedupe-key.d.ts +8 -0
  69. package/dist/v2/durable-core/schemas/lib/dedupe-key.js +28 -0
  70. package/dist/v2/durable-core/schemas/lib/utf8-bounded-string.d.ts +6 -0
  71. package/dist/v2/durable-core/schemas/lib/utf8-bounded-string.js +12 -0
  72. package/dist/v2/durable-core/schemas/session/events.d.ts +238 -62
  73. package/dist/v2/durable-core/schemas/session/events.js +74 -29
  74. package/dist/v2/durable-core/schemas/session/manifest.d.ts +3 -3
  75. package/dist/v2/durable-core/schemas/session/manifest.js +6 -1
  76. package/dist/v2/durable-core/schemas/session/preferences.d.ts +5 -0
  77. package/dist/v2/durable-core/schemas/session/preferences.js +6 -0
  78. package/dist/v2/durable-core/schemas/session/session-health.d.ts +3 -0
  79. package/dist/v2/durable-core/tokens/index.d.ts +2 -1
  80. package/dist/v2/durable-core/tokens/index.js +4 -4
  81. package/dist/v2/durable-core/tokens/payloads.d.ts +4 -4
  82. package/dist/v2/durable-core/tokens/token-codec.d.ts +3 -2
  83. package/dist/v2/durable-core/tokens/token-codec.js +12 -6
  84. package/dist/v2/durable-core/tokens/token-signer.d.ts +3 -2
  85. package/dist/v2/durable-core/tokens/token-signer.js +8 -9
  86. package/dist/v2/infra/local/base64url/index.d.ts +5 -0
  87. package/dist/v2/infra/local/base64url/index.js +48 -0
  88. package/dist/v2/infra/local/fs/index.js +8 -4
  89. package/dist/v2/infra/local/keyring/index.d.ts +5 -1
  90. package/dist/v2/infra/local/keyring/index.js +41 -32
  91. package/dist/v2/infra/local/pinned-workflow-store/index.d.ts +6 -4
  92. package/dist/v2/infra/local/pinned-workflow-store/index.js +50 -62
  93. package/dist/v2/infra/local/random-entropy/index.d.ts +4 -0
  94. package/dist/v2/infra/local/random-entropy/index.js +10 -0
  95. package/dist/v2/infra/local/session-lock/index.d.ts +3 -1
  96. package/dist/v2/infra/local/session-lock/index.js +5 -4
  97. package/dist/v2/infra/local/session-store/index.d.ts +0 -1
  98. package/dist/v2/infra/local/session-store/index.js +372 -282
  99. package/dist/v2/infra/local/snapshot-store/index.js +20 -25
  100. package/dist/v2/infra/local/time-clock/index.d.ts +5 -0
  101. package/dist/v2/infra/local/time-clock/index.js +12 -0
  102. package/dist/v2/infra/local/utf8/index.d.ts +5 -0
  103. package/dist/v2/infra/local/utf8/index.js +12 -0
  104. package/dist/v2/ports/base64url.port.d.ts +12 -0
  105. package/dist/v2/ports/base64url.port.js +2 -0
  106. package/dist/v2/ports/pinned-workflow-store.port.d.ts +3 -3
  107. package/dist/v2/ports/random-entropy.port.d.ts +3 -0
  108. package/dist/v2/ports/random-entropy.port.js +2 -0
  109. package/dist/v2/ports/session-event-log-store.port.d.ts +1 -1
  110. package/dist/v2/ports/session-lock.port.d.ts +1 -1
  111. package/dist/v2/ports/time-clock.port.d.ts +4 -0
  112. package/dist/v2/ports/time-clock.port.js +2 -0
  113. package/dist/v2/ports/utf8.port.d.ts +3 -0
  114. package/dist/v2/ports/utf8.port.js +2 -0
  115. package/dist/v2/projections/node-outputs.js +28 -11
  116. package/dist/v2/projections/preferences.d.ts +1 -2
  117. package/dist/v2/projections/preferences.js +11 -4
  118. package/dist/v2/projections/run-dag.js +40 -28
  119. package/dist/v2/projections/run-status-signals.d.ts +1 -2
  120. package/dist/v2/read-only/v1-to-v2-shim.d.ts +6 -1
  121. package/dist/v2/read-only/v1-to-v2-shim.js +16 -4
  122. package/dist/v2/usecases/execution-session-gate.d.ts +3 -2
  123. package/dist/v2/usecases/execution-session-gate.js +81 -85
  124. package/package.json +4 -1
  125. package/spec/workflow.schema.json +2 -2
  126. package/workflows/coding-task-workflow-agentic.json +498 -78
  127. package/workflows/design-thinking-workflow-autonomous.agentic.json +1 -1
  128. package/workflows/design-thinking-workflow.json +1 -1
  129. package/workflows/relocation-workflow-us.json +430 -0
  130. package/dist/v2/durable-core/tokens/base64url.d.ts +0 -7
  131. package/dist/v2/durable-core/tokens/base64url.js +0 -16
@@ -6,9 +6,6 @@ const types_js_1 = require("../types.js");
6
6
  const error_mapper_js_1 = require("../error-mapper.js");
7
7
  const output_schemas_js_1 = require("../output-schemas.js");
8
8
  const v1_to_v2_shim_js_1 = require("../../v2/read-only/v1-to-v2-shim.js");
9
- const index_js_1 = require("../../v2/infra/local/crypto/index.js");
10
- const index_js_2 = require("../../v2/infra/local/data-dir/index.js");
11
- const index_js_3 = require("../../v2/infra/local/pinned-workflow-store/index.js");
12
9
  const hashing_js_1 = require("../../v2/durable-core/canonical/hashing.js");
13
10
  const TIMEOUT_MS = 30000;
14
11
  async function withTimeout(operation, timeoutMs, name) {
@@ -17,12 +14,19 @@ async function withTimeout(operation, timeoutMs, name) {
17
14
  });
18
15
  return Promise.race([operation, timeoutPromise]);
19
16
  }
17
+ function requireV2(ctx) {
18
+ if (!ctx.v2) {
19
+ return (0, types_js_1.errNotRetryable)('PRECONDITION_FAILED', 'v2 tools are not enabled');
20
+ }
21
+ return null;
22
+ }
20
23
  async function handleV2ListWorkflows(_input, ctx) {
24
+ const v2Err = requireV2(ctx);
25
+ if (v2Err)
26
+ return v2Err;
27
+ const { crypto, pinnedStore } = ctx.v2;
21
28
  try {
22
29
  const summaries = await withTimeout(ctx.workflowService.listWorkflowSummaries(), TIMEOUT_MS, 'list_workflows');
23
- const crypto = new index_js_1.NodeCryptoV2();
24
- const dataDir = new index_js_2.LocalDataDirV2(process.env);
25
- const pinnedStore = new index_js_3.LocalPinnedWorkflowStoreV2(dataDir);
26
30
  const compiled = await Promise.all(summaries.map(async (s) => {
27
31
  const wf = await ctx.workflowService.getWorkflowById(s.id);
28
32
  if (!wf) {
@@ -35,7 +39,7 @@ async function handleV2ListWorkflows(_input, ctx) {
35
39
  kind: 'workflow',
36
40
  };
37
41
  }
38
- const snapshot = (0, v1_to_v2_shim_js_1.compileV1WorkflowToV2CompiledSnapshotV1)(wf);
42
+ const snapshot = (0, v1_to_v2_shim_js_1.compileV1WorkflowToV2PreviewSnapshot)(wf);
39
43
  const hashRes = (0, hashing_js_1.workflowHashForCompiledSnapshot)(snapshot, crypto);
40
44
  if (hashRes.isErr()) {
41
45
  return {
@@ -68,29 +72,30 @@ async function handleV2ListWorkflows(_input, ctx) {
68
72
  }
69
73
  catch (err) {
70
74
  const mapped = (0, error_mapper_js_1.mapUnknownErrorToToolError)(err);
71
- return (0, types_js_1.error)(mapped.code, mapped.message, mapped.suggestion);
75
+ return mapped;
72
76
  }
73
77
  }
74
78
  async function handleV2InspectWorkflow(input, ctx) {
79
+ const v2Err = requireV2(ctx);
80
+ if (v2Err)
81
+ return v2Err;
82
+ const { crypto, pinnedStore } = ctx.v2;
75
83
  try {
76
84
  const workflow = await withTimeout(ctx.workflowService.getWorkflowById(input.workflowId), TIMEOUT_MS, 'inspect_workflow');
77
85
  if (!workflow) {
78
- return (0, types_js_1.error)('NOT_FOUND', `Workflow not found: ${input.workflowId}`);
86
+ return (0, types_js_1.errNotRetryable)('NOT_FOUND', `Workflow not found: ${input.workflowId}`);
79
87
  }
80
- const crypto = new index_js_1.NodeCryptoV2();
81
- const dataDir = new index_js_2.LocalDataDirV2(process.env);
82
- const pinnedStore = new index_js_3.LocalPinnedWorkflowStoreV2(dataDir);
83
- const snapshot = (0, v1_to_v2_shim_js_1.compileV1WorkflowToV2CompiledSnapshotV1)(workflow);
88
+ const snapshot = (0, v1_to_v2_shim_js_1.compileV1WorkflowToV2PreviewSnapshot)(workflow);
84
89
  const hashRes = (0, hashing_js_1.workflowHashForCompiledSnapshot)(snapshot, crypto);
85
90
  if (hashRes.isErr()) {
86
- return (0, types_js_1.error)('INTERNAL_ERROR', hashRes.error.message);
91
+ return (0, types_js_1.errNotRetryable)('INTERNAL_ERROR', hashRes.error.message);
87
92
  }
88
93
  const workflowHash = hashRes.value;
89
94
  const existing = await pinnedStore.get(workflowHash).match((v) => v, () => null);
90
95
  if (!existing) {
91
96
  const wrote = await pinnedStore.put(workflowHash, snapshot).match(() => ({ ok: true }), (e) => ({ ok: false, error: e }));
92
97
  if (!wrote.ok) {
93
- return (0, types_js_1.error)('INTERNAL_ERROR', wrote.error.message);
98
+ return (0, types_js_1.errNotRetryable)('INTERNAL_ERROR', wrote.error.message);
94
99
  }
95
100
  }
96
101
  const compiled = (await pinnedStore.get(workflowHash).match((v) => v, () => null)) ?? snapshot;
@@ -107,6 +112,6 @@ async function handleV2InspectWorkflow(input, ctx) {
107
112
  }
108
113
  catch (err) {
109
114
  const mapped = (0, error_mapper_js_1.mapUnknownErrorToToolError)(err);
110
- return (0, types_js_1.error)(mapped.code, mapped.message, mapped.suggestion);
115
+ return mapped;
111
116
  }
112
117
  }
@@ -58,7 +58,7 @@ async function handleWorkflowList(_input, ctx) {
58
58
  }
59
59
  catch (err) {
60
60
  const mapped = (0, error_mapper_js_1.mapUnknownErrorToToolError)(err);
61
- return (0, types_js_1.error)(mapped.code, mapped.message, mapped.suggestion);
61
+ return mapped;
62
62
  }
63
63
  }
64
64
  async function handleWorkflowGet(input, ctx) {
@@ -68,18 +68,22 @@ async function handleWorkflowGet(input, ctx) {
68
68
  const result = await withTimeout(getWorkflowUseCase(input.id, input.mode), TIMEOUT_MS, 'workflow_get');
69
69
  if (result.isErr()) {
70
70
  const mapped = (0, error_mapper_js_1.mapDomainErrorToToolError)(result.error);
71
- return (0, types_js_1.error)(mapped.code, mapped.message, mapped.suggestion);
71
+ return mapped;
72
72
  }
73
73
  const payload = output_schemas_js_1.WorkflowGetOutputSchema.parse({ workflow: result.value });
74
74
  return (0, types_js_1.success)(payload);
75
75
  }
76
76
  catch (err) {
77
- const message = err instanceof Error ? err.message : String(err);
78
- if (message.includes('timed out')) {
79
- return (0, types_js_1.error)('TIMEOUT', message);
77
+ if (err instanceof Error && err.name === 'TimeoutError') {
78
+ return {
79
+ type: 'error',
80
+ code: 'TIMEOUT',
81
+ message: err.message,
82
+ retry: { kind: 'retryable_immediate' },
83
+ };
80
84
  }
81
85
  const mapped = (0, error_mapper_js_1.mapUnknownErrorToToolError)(err);
82
- return (0, types_js_1.error)(mapped.code, mapped.message, mapped.suggestion);
86
+ return mapped;
83
87
  }
84
88
  }
85
89
  async function handleWorkflowNext(input, ctx) {
@@ -94,7 +98,7 @@ async function handleWorkflowNext(input, ctx) {
94
98
  `returned=${result.isOk() ? 'ok' : 'err'}`);
95
99
  if (result.isErr()) {
96
100
  const mapped = (0, error_mapper_js_1.mapDomainErrorToToolError)(result.error);
97
- return (0, types_js_1.error)(mapped.code, mapped.message, mapped.suggestion);
101
+ return mapped;
98
102
  }
99
103
  const payload = output_schemas_js_1.WorkflowNextOutputSchema.parse(result.value);
100
104
  return (0, types_js_1.success)(payload);
@@ -103,11 +107,16 @@ async function handleWorkflowNext(input, ctx) {
103
107
  const elapsed = Date.now() - startTime;
104
108
  const message = err instanceof Error ? err.message : String(err);
105
109
  console.error(`[workflow_next] Failed after ${elapsed}ms: ${message}`);
106
- if (message.includes('timed out')) {
107
- return (0, types_js_1.error)('TIMEOUT', message);
110
+ if (err instanceof Error && err.name === 'TimeoutError') {
111
+ return {
112
+ type: 'error',
113
+ code: 'TIMEOUT',
114
+ message: err.message,
115
+ retry: { kind: 'retryable_immediate' },
116
+ };
108
117
  }
109
118
  const mapped = (0, error_mapper_js_1.mapUnknownErrorToToolError)(err);
110
- return (0, types_js_1.error)(mapped.code, mapped.message, mapped.suggestion);
119
+ return mapped;
111
120
  }
112
121
  }
113
122
  async function handleWorkflowValidateJson(input, ctx) {
@@ -121,7 +130,7 @@ async function handleWorkflowValidateJson(input, ctx) {
121
130
  }
122
131
  catch (err) {
123
132
  const mapped = (0, error_mapper_js_1.mapUnknownErrorToToolError)(err);
124
- return (0, types_js_1.error)(mapped.code, mapped.message, mapped.suggestion);
133
+ return mapped;
125
134
  }
126
135
  }
127
136
  async function handleWorkflowGetSchema(_input, ctx) {
@@ -162,6 +171,6 @@ async function handleWorkflowGetSchema(_input, ctx) {
162
171
  }
163
172
  catch (err) {
164
173
  const message = err instanceof Error ? err.message : String(err);
165
- return (0, types_js_1.error)('INTERNAL_ERROR', message, 'Ensure the workflow schema file exists at spec/workflow.schema.json');
174
+ return (0, types_js_1.errNotRetryable)('INTERNAL_ERROR', message, { suggestion: 'Ensure the workflow schema file exists at spec/workflow.schema.json' });
166
175
  }
167
176
  }
@@ -1,5 +1,5 @@
1
1
  export type { ErrorCode, ToolSuccess, ToolError, ToolResult, ToolContext, ToolHandler, } from './types.js';
2
- export { success, error, } from './types.js';
2
+ export { success, error, errNotRetryable, errRetryAfterMs, errRetryImmediate, } from './types.js';
3
3
  export type { ToolAnnotations, ToolDefinition, ToolConfig, ToolBuilder, } from './tool-factory.js';
4
4
  export { createToolFactory } from './tool-factory.js';
5
5
  export type { DescriptionMode, WorkflowToolName, ToolDescriptionMap, DescriptionsByMode, } from './types/tool-description-types.js';
package/dist/mcp/index.js CHANGED
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zodToJsonSchema = exports.startServer = exports.createToolContext = exports.handleOpenDashboard = exports.handleReadSession = exports.handleUpdateSession = exports.handleCreateSession = exports.handleWorkflowGetSchema = exports.handleWorkflowValidateJson = exports.handleWorkflowNext = exports.handleWorkflowGet = exports.handleWorkflowList = exports.sessionTools = exports.openDashboardTool = exports.readSessionTool = exports.updateSessionTool = exports.createSessionTool = exports.OpenDashboardInput = exports.ReadSessionInput = exports.UpdateSessionInput = exports.CreateSessionInput = exports.WORKFLOW_TOOL_TITLES = exports.WORKFLOW_TOOL_ANNOTATIONS = exports.WorkflowGetSchemaInput = exports.WorkflowValidateJsonInput = exports.WorkflowNextInput = exports.WorkflowGetInput = exports.WorkflowListInput = exports.DESCRIPTIONS = exports.StaticToolDescriptionProvider = exports.ToolDescriptionProvider = exports.isWorkflowToolName = exports.isDescriptionMode = exports.WORKFLOW_TOOL_NAMES = exports.DESCRIPTION_MODES = exports.createToolFactory = exports.error = exports.success = void 0;
3
+ exports.zodToJsonSchema = exports.startServer = exports.createToolContext = exports.handleOpenDashboard = exports.handleReadSession = exports.handleUpdateSession = exports.handleCreateSession = exports.handleWorkflowGetSchema = exports.handleWorkflowValidateJson = exports.handleWorkflowNext = exports.handleWorkflowGet = exports.handleWorkflowList = exports.sessionTools = exports.openDashboardTool = exports.readSessionTool = exports.updateSessionTool = exports.createSessionTool = exports.OpenDashboardInput = exports.ReadSessionInput = exports.UpdateSessionInput = exports.CreateSessionInput = exports.WORKFLOW_TOOL_TITLES = exports.WORKFLOW_TOOL_ANNOTATIONS = exports.WorkflowGetSchemaInput = exports.WorkflowValidateJsonInput = exports.WorkflowNextInput = exports.WorkflowGetInput = exports.WorkflowListInput = exports.DESCRIPTIONS = exports.StaticToolDescriptionProvider = exports.ToolDescriptionProvider = exports.isWorkflowToolName = exports.isDescriptionMode = exports.WORKFLOW_TOOL_NAMES = exports.DESCRIPTION_MODES = exports.createToolFactory = exports.errRetryImmediate = exports.errRetryAfterMs = exports.errNotRetryable = exports.error = exports.success = void 0;
4
4
  var types_js_1 = require("./types.js");
5
5
  Object.defineProperty(exports, "success", { enumerable: true, get: function () { return types_js_1.success; } });
6
6
  Object.defineProperty(exports, "error", { enumerable: true, get: function () { return types_js_1.error; } });
7
+ Object.defineProperty(exports, "errNotRetryable", { enumerable: true, get: function () { return types_js_1.errNotRetryable; } });
8
+ Object.defineProperty(exports, "errRetryAfterMs", { enumerable: true, get: function () { return types_js_1.errRetryAfterMs; } });
9
+ Object.defineProperty(exports, "errRetryImmediate", { enumerable: true, get: function () { return types_js_1.errRetryImmediate; } });
7
10
  var tool_factory_js_1 = require("./tool-factory.js");
8
11
  Object.defineProperty(exports, "createToolFactory", { enumerable: true, get: function () { return tool_factory_js_1.createToolFactory; } });
9
12
  var tool_description_types_js_1 = require("./types/tool-description-types.js");
@@ -63,13 +63,13 @@ export declare const WorkflowNextOutputSchema: z.ZodObject<{
63
63
  next: z.ZodNullable<z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
64
64
  isComplete: z.ZodBoolean;
65
65
  }, "strip", z.ZodTypeAny, {
66
+ isComplete: boolean;
66
67
  state: import("../domain/execution/state.js").ExecutionState;
67
68
  next: JsonValue;
68
- isComplete: boolean;
69
69
  }, {
70
+ isComplete: boolean;
70
71
  state: import("../domain/execution/state.js").ExecutionState;
71
72
  next: JsonValue;
72
- isComplete: boolean;
73
73
  }>;
74
74
  export declare const WorkflowValidateJsonOutputSchema: z.ZodObject<{
75
75
  valid: z.ZodBoolean;
@@ -223,15 +223,422 @@ export declare const V2WorkflowInspectOutputSchema: z.ZodObject<{
223
223
  compiled: z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>;
224
224
  }, "strip", z.ZodTypeAny, {
225
225
  workflowId: string;
226
- mode: "metadata" | "preview";
227
226
  workflowHash: string;
227
+ mode: "metadata" | "preview";
228
228
  compiled: JsonValue;
229
229
  }, {
230
230
  workflowId: string;
231
- mode: "metadata" | "preview";
232
231
  workflowHash: string;
232
+ mode: "metadata" | "preview";
233
233
  compiled: JsonValue;
234
234
  }>;
235
+ export declare const V2PendingStepSchema: z.ZodObject<{
236
+ stepId: z.ZodString;
237
+ title: z.ZodString;
238
+ prompt: z.ZodString;
239
+ }, "strip", z.ZodTypeAny, {
240
+ title: string;
241
+ prompt: string;
242
+ stepId: string;
243
+ }, {
244
+ title: string;
245
+ prompt: string;
246
+ stepId: string;
247
+ }>;
248
+ export declare const V2BlockerReportSchema: z.ZodObject<{
249
+ blockers: z.ZodArray<z.ZodObject<{
250
+ code: z.ZodEnum<["USER_ONLY_DEPENDENCY", "MISSING_REQUIRED_OUTPUT", "INVALID_REQUIRED_OUTPUT", "REQUIRED_CAPABILITY_UNKNOWN", "REQUIRED_CAPABILITY_UNAVAILABLE", "INVARIANT_VIOLATION", "STORAGE_CORRUPTION_DETECTED"]>;
251
+ pointer: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
252
+ kind: z.ZodLiteral<"context_key">;
253
+ key: z.ZodString;
254
+ }, "strip", z.ZodTypeAny, {
255
+ key: string;
256
+ kind: "context_key";
257
+ }, {
258
+ key: string;
259
+ kind: "context_key";
260
+ }>, z.ZodObject<{
261
+ kind: z.ZodLiteral<"output_contract">;
262
+ contractRef: z.ZodString;
263
+ }, "strip", z.ZodTypeAny, {
264
+ kind: "output_contract";
265
+ contractRef: string;
266
+ }, {
267
+ kind: "output_contract";
268
+ contractRef: string;
269
+ }>, z.ZodObject<{
270
+ kind: z.ZodLiteral<"capability">;
271
+ capability: z.ZodEnum<["delegation", "web_browsing"]>;
272
+ }, "strip", z.ZodTypeAny, {
273
+ kind: "capability";
274
+ capability: "delegation" | "web_browsing";
275
+ }, {
276
+ kind: "capability";
277
+ capability: "delegation" | "web_browsing";
278
+ }>, z.ZodObject<{
279
+ kind: z.ZodLiteral<"workflow_step">;
280
+ stepId: z.ZodString;
281
+ }, "strip", z.ZodTypeAny, {
282
+ kind: "workflow_step";
283
+ stepId: string;
284
+ }, {
285
+ kind: "workflow_step";
286
+ stepId: string;
287
+ }>]>;
288
+ message: z.ZodString;
289
+ suggestedFix: z.ZodOptional<z.ZodString>;
290
+ }, "strip", z.ZodTypeAny, {
291
+ message: string;
292
+ code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
293
+ pointer: {
294
+ key: string;
295
+ kind: "context_key";
296
+ } | {
297
+ kind: "output_contract";
298
+ contractRef: string;
299
+ } | {
300
+ kind: "capability";
301
+ capability: "delegation" | "web_browsing";
302
+ } | {
303
+ kind: "workflow_step";
304
+ stepId: string;
305
+ };
306
+ suggestedFix?: string | undefined;
307
+ }, {
308
+ message: string;
309
+ code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
310
+ pointer: {
311
+ key: string;
312
+ kind: "context_key";
313
+ } | {
314
+ kind: "output_contract";
315
+ contractRef: string;
316
+ } | {
317
+ kind: "capability";
318
+ capability: "delegation" | "web_browsing";
319
+ } | {
320
+ kind: "workflow_step";
321
+ stepId: string;
322
+ };
323
+ suggestedFix?: string | undefined;
324
+ }>, "many">;
325
+ }, "strip", z.ZodTypeAny, {
326
+ blockers: {
327
+ message: string;
328
+ code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
329
+ pointer: {
330
+ key: string;
331
+ kind: "context_key";
332
+ } | {
333
+ kind: "output_contract";
334
+ contractRef: string;
335
+ } | {
336
+ kind: "capability";
337
+ capability: "delegation" | "web_browsing";
338
+ } | {
339
+ kind: "workflow_step";
340
+ stepId: string;
341
+ };
342
+ suggestedFix?: string | undefined;
343
+ }[];
344
+ }, {
345
+ blockers: {
346
+ message: string;
347
+ code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
348
+ pointer: {
349
+ key: string;
350
+ kind: "context_key";
351
+ } | {
352
+ kind: "output_contract";
353
+ contractRef: string;
354
+ } | {
355
+ kind: "capability";
356
+ capability: "delegation" | "web_browsing";
357
+ } | {
358
+ kind: "workflow_step";
359
+ stepId: string;
360
+ };
361
+ suggestedFix?: string | undefined;
362
+ }[];
363
+ }>;
364
+ export declare const V2ContinueWorkflowOutputSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
365
+ kind: z.ZodLiteral<"ok">;
366
+ stateToken: z.ZodString;
367
+ ackToken: z.ZodString;
368
+ checkpointToken: z.ZodString;
369
+ isComplete: z.ZodBoolean;
370
+ pending: z.ZodNullable<z.ZodObject<{
371
+ stepId: z.ZodString;
372
+ title: z.ZodString;
373
+ prompt: z.ZodString;
374
+ }, "strip", z.ZodTypeAny, {
375
+ title: string;
376
+ prompt: string;
377
+ stepId: string;
378
+ }, {
379
+ title: string;
380
+ prompt: string;
381
+ stepId: string;
382
+ }>>;
383
+ }, "strip", z.ZodTypeAny, {
384
+ kind: "ok";
385
+ pending: {
386
+ title: string;
387
+ prompt: string;
388
+ stepId: string;
389
+ } | null;
390
+ isComplete: boolean;
391
+ stateToken: string;
392
+ ackToken: string;
393
+ checkpointToken: string;
394
+ }, {
395
+ kind: "ok";
396
+ pending: {
397
+ title: string;
398
+ prompt: string;
399
+ stepId: string;
400
+ } | null;
401
+ isComplete: boolean;
402
+ stateToken: string;
403
+ ackToken: string;
404
+ checkpointToken: string;
405
+ }>, z.ZodObject<{
406
+ kind: z.ZodLiteral<"blocked">;
407
+ stateToken: z.ZodString;
408
+ ackToken: z.ZodString;
409
+ checkpointToken: z.ZodString;
410
+ isComplete: z.ZodBoolean;
411
+ pending: z.ZodNullable<z.ZodObject<{
412
+ stepId: z.ZodString;
413
+ title: z.ZodString;
414
+ prompt: z.ZodString;
415
+ }, "strip", z.ZodTypeAny, {
416
+ title: string;
417
+ prompt: string;
418
+ stepId: string;
419
+ }, {
420
+ title: string;
421
+ prompt: string;
422
+ stepId: string;
423
+ }>>;
424
+ blockers: z.ZodObject<{
425
+ blockers: z.ZodArray<z.ZodObject<{
426
+ code: z.ZodEnum<["USER_ONLY_DEPENDENCY", "MISSING_REQUIRED_OUTPUT", "INVALID_REQUIRED_OUTPUT", "REQUIRED_CAPABILITY_UNKNOWN", "REQUIRED_CAPABILITY_UNAVAILABLE", "INVARIANT_VIOLATION", "STORAGE_CORRUPTION_DETECTED"]>;
427
+ pointer: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
428
+ kind: z.ZodLiteral<"context_key">;
429
+ key: z.ZodString;
430
+ }, "strip", z.ZodTypeAny, {
431
+ key: string;
432
+ kind: "context_key";
433
+ }, {
434
+ key: string;
435
+ kind: "context_key";
436
+ }>, z.ZodObject<{
437
+ kind: z.ZodLiteral<"output_contract">;
438
+ contractRef: z.ZodString;
439
+ }, "strip", z.ZodTypeAny, {
440
+ kind: "output_contract";
441
+ contractRef: string;
442
+ }, {
443
+ kind: "output_contract";
444
+ contractRef: string;
445
+ }>, z.ZodObject<{
446
+ kind: z.ZodLiteral<"capability">;
447
+ capability: z.ZodEnum<["delegation", "web_browsing"]>;
448
+ }, "strip", z.ZodTypeAny, {
449
+ kind: "capability";
450
+ capability: "delegation" | "web_browsing";
451
+ }, {
452
+ kind: "capability";
453
+ capability: "delegation" | "web_browsing";
454
+ }>, z.ZodObject<{
455
+ kind: z.ZodLiteral<"workflow_step">;
456
+ stepId: z.ZodString;
457
+ }, "strip", z.ZodTypeAny, {
458
+ kind: "workflow_step";
459
+ stepId: string;
460
+ }, {
461
+ kind: "workflow_step";
462
+ stepId: string;
463
+ }>]>;
464
+ message: z.ZodString;
465
+ suggestedFix: z.ZodOptional<z.ZodString>;
466
+ }, "strip", z.ZodTypeAny, {
467
+ message: string;
468
+ code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
469
+ pointer: {
470
+ key: string;
471
+ kind: "context_key";
472
+ } | {
473
+ kind: "output_contract";
474
+ contractRef: string;
475
+ } | {
476
+ kind: "capability";
477
+ capability: "delegation" | "web_browsing";
478
+ } | {
479
+ kind: "workflow_step";
480
+ stepId: string;
481
+ };
482
+ suggestedFix?: string | undefined;
483
+ }, {
484
+ message: string;
485
+ code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
486
+ pointer: {
487
+ key: string;
488
+ kind: "context_key";
489
+ } | {
490
+ kind: "output_contract";
491
+ contractRef: string;
492
+ } | {
493
+ kind: "capability";
494
+ capability: "delegation" | "web_browsing";
495
+ } | {
496
+ kind: "workflow_step";
497
+ stepId: string;
498
+ };
499
+ suggestedFix?: string | undefined;
500
+ }>, "many">;
501
+ }, "strip", z.ZodTypeAny, {
502
+ blockers: {
503
+ message: string;
504
+ code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
505
+ pointer: {
506
+ key: string;
507
+ kind: "context_key";
508
+ } | {
509
+ kind: "output_contract";
510
+ contractRef: string;
511
+ } | {
512
+ kind: "capability";
513
+ capability: "delegation" | "web_browsing";
514
+ } | {
515
+ kind: "workflow_step";
516
+ stepId: string;
517
+ };
518
+ suggestedFix?: string | undefined;
519
+ }[];
520
+ }, {
521
+ blockers: {
522
+ message: string;
523
+ code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
524
+ pointer: {
525
+ key: string;
526
+ kind: "context_key";
527
+ } | {
528
+ kind: "output_contract";
529
+ contractRef: string;
530
+ } | {
531
+ kind: "capability";
532
+ capability: "delegation" | "web_browsing";
533
+ } | {
534
+ kind: "workflow_step";
535
+ stepId: string;
536
+ };
537
+ suggestedFix?: string | undefined;
538
+ }[];
539
+ }>;
540
+ }, "strip", z.ZodTypeAny, {
541
+ kind: "blocked";
542
+ pending: {
543
+ title: string;
544
+ prompt: string;
545
+ stepId: string;
546
+ } | null;
547
+ blockers: {
548
+ blockers: {
549
+ message: string;
550
+ code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
551
+ pointer: {
552
+ key: string;
553
+ kind: "context_key";
554
+ } | {
555
+ kind: "output_contract";
556
+ contractRef: string;
557
+ } | {
558
+ kind: "capability";
559
+ capability: "delegation" | "web_browsing";
560
+ } | {
561
+ kind: "workflow_step";
562
+ stepId: string;
563
+ };
564
+ suggestedFix?: string | undefined;
565
+ }[];
566
+ };
567
+ isComplete: boolean;
568
+ stateToken: string;
569
+ ackToken: string;
570
+ checkpointToken: string;
571
+ }, {
572
+ kind: "blocked";
573
+ pending: {
574
+ title: string;
575
+ prompt: string;
576
+ stepId: string;
577
+ } | null;
578
+ blockers: {
579
+ blockers: {
580
+ message: string;
581
+ code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
582
+ pointer: {
583
+ key: string;
584
+ kind: "context_key";
585
+ } | {
586
+ kind: "output_contract";
587
+ contractRef: string;
588
+ } | {
589
+ kind: "capability";
590
+ capability: "delegation" | "web_browsing";
591
+ } | {
592
+ kind: "workflow_step";
593
+ stepId: string;
594
+ };
595
+ suggestedFix?: string | undefined;
596
+ }[];
597
+ };
598
+ isComplete: boolean;
599
+ stateToken: string;
600
+ ackToken: string;
601
+ checkpointToken: string;
602
+ }>]>;
603
+ export declare const V2StartWorkflowOutputSchema: z.ZodObject<{
604
+ stateToken: z.ZodString;
605
+ ackToken: z.ZodString;
606
+ checkpointToken: z.ZodString;
607
+ isComplete: z.ZodBoolean;
608
+ pending: z.ZodNullable<z.ZodObject<{
609
+ stepId: z.ZodString;
610
+ title: z.ZodString;
611
+ prompt: z.ZodString;
612
+ }, "strip", z.ZodTypeAny, {
613
+ title: string;
614
+ prompt: string;
615
+ stepId: string;
616
+ }, {
617
+ title: string;
618
+ prompt: string;
619
+ stepId: string;
620
+ }>>;
621
+ }, "strip", z.ZodTypeAny, {
622
+ pending: {
623
+ title: string;
624
+ prompt: string;
625
+ stepId: string;
626
+ } | null;
627
+ isComplete: boolean;
628
+ stateToken: string;
629
+ ackToken: string;
630
+ checkpointToken: string;
631
+ }, {
632
+ pending: {
633
+ title: string;
634
+ prompt: string;
635
+ stepId: string;
636
+ } | null;
637
+ isComplete: boolean;
638
+ stateToken: string;
639
+ ackToken: string;
640
+ checkpointToken: string;
641
+ }>;
235
642
  export declare const CreateSessionOutputSchema: z.ZodObject<{
236
643
  sessionId: z.ZodString;
237
644
  workflowId: z.ZodString;