@exaudeus/workrail 1.4.0 → 1.5.1

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 (168) hide show
  1. package/dist/manifest.json +464 -200
  2. package/dist/mcp/handlers/v2-advance-core/event-builders.d.ts +37 -0
  3. package/dist/mcp/handlers/v2-advance-core/event-builders.js +114 -0
  4. package/dist/mcp/handlers/v2-advance-core/index.d.ts +67 -0
  5. package/dist/mcp/handlers/v2-advance-core/index.js +100 -0
  6. package/dist/mcp/handlers/v2-advance-core/input-validation.d.ts +44 -0
  7. package/dist/mcp/handlers/v2-advance-core/input-validation.js +58 -0
  8. package/dist/mcp/handlers/v2-advance-core/outcome-blocked.d.ts +16 -0
  9. package/dist/mcp/handlers/v2-advance-core/outcome-blocked.js +64 -0
  10. package/dist/mcp/handlers/v2-advance-core/outcome-success.d.ts +15 -0
  11. package/dist/mcp/handlers/v2-advance-core/outcome-success.js +136 -0
  12. package/dist/mcp/handlers/v2-advance-core.d.ts +3 -45
  13. package/dist/mcp/handlers/v2-advance-core.js +3 -431
  14. package/dist/mcp/handlers/v2-advance-events.d.ts +61 -0
  15. package/dist/mcp/handlers/v2-advance-events.js +126 -0
  16. package/dist/mcp/handlers/v2-checkpoint.js +5 -4
  17. package/dist/mcp/handlers/v2-context-budget.js +2 -2
  18. package/dist/mcp/handlers/v2-execution/advance.d.ts +32 -0
  19. package/dist/mcp/handlers/v2-execution/advance.js +50 -0
  20. package/dist/mcp/handlers/v2-execution/continue-advance.d.ts +29 -0
  21. package/dist/mcp/handlers/v2-execution/continue-advance.js +170 -0
  22. package/dist/mcp/handlers/v2-execution/continue-rehydrate.d.ts +22 -0
  23. package/dist/mcp/handlers/v2-execution/continue-rehydrate.js +146 -0
  24. package/dist/mcp/handlers/v2-execution/index.d.ts +23 -0
  25. package/dist/mcp/handlers/v2-execution/index.js +113 -0
  26. package/dist/mcp/handlers/v2-execution/replay.d.ts +55 -0
  27. package/dist/mcp/handlers/v2-execution/replay.js +227 -0
  28. package/dist/mcp/handlers/v2-execution/start.d.ts +52 -0
  29. package/dist/mcp/handlers/v2-execution/start.js +350 -0
  30. package/dist/mcp/handlers/v2-execution-helpers.d.ts +23 -0
  31. package/dist/mcp/handlers/v2-execution-helpers.js +42 -1
  32. package/dist/mcp/handlers/v2-execution.d.ts +1 -23
  33. package/dist/mcp/handlers/v2-execution.js +5 -898
  34. package/dist/mcp/handlers/v2-resume.d.ts +8 -0
  35. package/dist/mcp/handlers/v2-resume.js +70 -0
  36. package/dist/mcp/handlers/v2-state-conversion.d.ts +0 -5
  37. package/dist/mcp/handlers/v2-state-conversion.js +2 -21
  38. package/dist/mcp/handlers/v2-token-ops.d.ts +1 -1
  39. package/dist/mcp/handlers/v2-workflow.js +76 -64
  40. package/dist/mcp/output-schemas.d.ts +40 -0
  41. package/dist/mcp/output-schemas.js +17 -1
  42. package/dist/mcp/server.js +12 -0
  43. package/dist/mcp/tool-descriptions.js +22 -0
  44. package/dist/mcp/tools.js +6 -0
  45. package/dist/mcp/types/tool-description-types.d.ts +1 -1
  46. package/dist/mcp/types/tool-description-types.js +1 -0
  47. package/dist/mcp/types/workflow-tool-edition.d.ts +1 -1
  48. package/dist/mcp/types.d.ts +6 -0
  49. package/dist/mcp/v2/tool-registry.js +8 -0
  50. package/dist/mcp/v2/tools.d.ts +15 -0
  51. package/dist/mcp/v2/tools.js +8 -1
  52. package/dist/v2/durable-core/constants.d.ts +60 -0
  53. package/dist/v2/durable-core/constants.js +55 -1
  54. package/dist/v2/durable-core/domain/ack-advance-append-plan.d.ts +23 -13
  55. package/dist/v2/durable-core/domain/ack-advance-append-plan.js +160 -113
  56. package/dist/v2/durable-core/domain/blocked-node-builder.js +8 -2
  57. package/dist/v2/durable-core/domain/blocking-decision.d.ts +2 -0
  58. package/dist/v2/durable-core/domain/blocking-decision.js +29 -12
  59. package/dist/v2/durable-core/domain/bundle-builder.d.ts +1 -0
  60. package/dist/v2/durable-core/domain/bundle-builder.js +1 -1
  61. package/dist/v2/durable-core/domain/bundle-validator.js +3 -2
  62. package/dist/v2/durable-core/domain/decision-trace-builder.js +7 -9
  63. package/dist/v2/durable-core/domain/function-definition-expander.js +1 -3
  64. package/dist/v2/durable-core/domain/gap-builder.js +2 -1
  65. package/dist/v2/durable-core/domain/observation-builder.js +2 -1
  66. package/dist/v2/durable-core/domain/outputs.d.ts +2 -1
  67. package/dist/v2/durable-core/domain/outputs.js +3 -2
  68. package/dist/v2/durable-core/domain/reason-model.d.ts +1 -1
  69. package/dist/v2/durable-core/domain/reason-model.js +4 -9
  70. package/dist/v2/durable-core/domain/validation-criteria-validator.js +2 -2
  71. package/dist/v2/durable-core/domain/validation-event-builder.js +4 -6
  72. package/dist/v2/durable-core/domain/validation-loader.js +2 -1
  73. package/dist/v2/durable-core/domain/validation-requirements-extractor.js +12 -18
  74. package/dist/v2/durable-core/encoding/base32-lower.d.ts +13 -1
  75. package/dist/v2/durable-core/encoding/base32-lower.js +13 -3
  76. package/dist/v2/durable-core/encoding/hex-to-bytes.d.ts +6 -0
  77. package/dist/v2/durable-core/encoding/hex-to-bytes.js +19 -0
  78. package/dist/v2/durable-core/ids/attempt-id-derivation.d.ts +6 -1
  79. package/dist/v2/durable-core/ids/attempt-id-derivation.js +9 -19
  80. package/dist/v2/durable-core/ids/event-ids.d.ts +9 -0
  81. package/dist/v2/durable-core/ids/event-ids.js +18 -0
  82. package/dist/v2/durable-core/ids/index.d.ts +13 -33
  83. package/dist/v2/durable-core/ids/index.js +22 -63
  84. package/dist/v2/durable-core/ids/session-ids.d.ts +9 -0
  85. package/dist/v2/durable-core/ids/session-ids.js +18 -0
  86. package/dist/v2/durable-core/ids/snapshot-ids.d.ts +6 -0
  87. package/dist/v2/durable-core/ids/snapshot-ids.js +10 -0
  88. package/dist/v2/durable-core/ids/token-ids.d.ts +3 -0
  89. package/dist/v2/durable-core/ids/token-ids.js +6 -0
  90. package/dist/v2/durable-core/ids/workflow-hash-ref.d.ts +3 -0
  91. package/dist/v2/durable-core/ids/workflow-hash-ref.js +5 -4
  92. package/dist/v2/durable-core/ids/workflow-ids.d.ts +11 -0
  93. package/dist/v2/durable-core/ids/workflow-ids.js +21 -0
  94. package/dist/v2/durable-core/lib/utf8-byte-length.d.ts +1 -0
  95. package/dist/v2/durable-core/lib/utf8-byte-length.js +6 -0
  96. package/dist/v2/durable-core/schemas/artifacts/loop-control.js +2 -1
  97. package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.d.ts +24 -24
  98. package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.js +5 -7
  99. package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +180 -180
  100. package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +282 -287
  101. package/dist/v2/durable-core/schemas/export-bundle/index.js +0 -8
  102. package/dist/v2/durable-core/schemas/lib/dedupe-key.d.ts +9 -1
  103. package/dist/v2/durable-core/schemas/lib/dedupe-key.js +4 -3
  104. package/dist/v2/durable-core/schemas/lib/utf8-byte-length.d.ts +1 -0
  105. package/dist/v2/durable-core/schemas/lib/utf8-byte-length.js +6 -0
  106. package/dist/v2/durable-core/schemas/session/blockers.d.ts +305 -0
  107. package/dist/v2/durable-core/schemas/session/blockers.js +80 -0
  108. package/dist/v2/durable-core/schemas/session/dag-topology.d.ts +77 -0
  109. package/dist/v2/durable-core/schemas/session/dag-topology.js +45 -0
  110. package/dist/v2/durable-core/schemas/session/events.d.ts +36 -36
  111. package/dist/v2/durable-core/schemas/session/events.js +11 -182
  112. package/dist/v2/durable-core/schemas/session/gaps.d.ts +211 -0
  113. package/dist/v2/durable-core/schemas/session/gaps.js +37 -0
  114. package/dist/v2/durable-core/schemas/session/outputs.d.ts +148 -0
  115. package/dist/v2/durable-core/schemas/session/outputs.js +44 -0
  116. package/dist/v2/durable-core/schemas/session/validation-event.js +5 -7
  117. package/dist/v2/durable-core/tokens/token-codec.d.ts +1 -18
  118. package/dist/v2/durable-core/tokens/token-codec.js +0 -67
  119. package/dist/v2/durable-core/tokens/token-signer.d.ts +1 -8
  120. package/dist/v2/durable-core/tokens/token-signer.js +0 -43
  121. package/dist/v2/infra/local/base32/index.js +1 -23
  122. package/dist/v2/infra/local/bech32m/index.js +1 -1
  123. package/dist/v2/infra/local/data-dir/index.d.ts +7 -6
  124. package/dist/v2/infra/local/data-dir/index.js +3 -3
  125. package/dist/v2/infra/local/directory-listing/index.d.ts +8 -0
  126. package/dist/v2/infra/local/directory-listing/index.js +18 -0
  127. package/dist/v2/infra/local/fs/index.d.ts +1 -0
  128. package/dist/v2/infra/local/fs/index.js +3 -0
  129. package/dist/v2/infra/local/session-store/index.js +198 -182
  130. package/dist/v2/infra/local/session-summary-provider/index.d.ts +18 -0
  131. package/dist/v2/infra/local/session-summary-provider/index.js +144 -0
  132. package/dist/v2/infra/local/snapshot-store/index.js +2 -2
  133. package/dist/v2/ports/data-dir.port.d.ts +7 -6
  134. package/dist/v2/ports/directory-listing.port.d.ts +5 -0
  135. package/dist/v2/ports/directory-listing.port.js +2 -0
  136. package/dist/v2/ports/fs.port.d.ts +19 -7
  137. package/dist/v2/ports/session-event-log-store.port.d.ts +5 -2
  138. package/dist/v2/ports/session-summary-provider.port.d.ts +9 -0
  139. package/dist/v2/ports/session-summary-provider.port.js +2 -0
  140. package/dist/v2/projections/advance-outcomes.d.ts +1 -7
  141. package/dist/v2/projections/advance-outcomes.js +2 -1
  142. package/dist/v2/projections/artifacts.js +3 -2
  143. package/dist/v2/projections/capabilities.d.ts +1 -7
  144. package/dist/v2/projections/capabilities.js +2 -1
  145. package/dist/v2/projections/gaps.d.ts +1 -7
  146. package/dist/v2/projections/gaps.js +2 -1
  147. package/dist/v2/projections/node-outputs.d.ts +1 -7
  148. package/dist/v2/projections/node-outputs.js +4 -3
  149. package/dist/v2/projections/preferences.d.ts +1 -7
  150. package/dist/v2/projections/preferences.js +2 -1
  151. package/dist/v2/projections/projection-error.d.ts +7 -0
  152. package/dist/v2/projections/projection-error.js +2 -0
  153. package/dist/v2/projections/resume-ranking.d.ts +62 -0
  154. package/dist/v2/projections/resume-ranking.js +105 -0
  155. package/dist/v2/projections/run-context.d.ts +1 -7
  156. package/dist/v2/projections/run-context.js +4 -2
  157. package/dist/v2/projections/run-dag.d.ts +9 -9
  158. package/dist/v2/projections/run-dag.js +88 -65
  159. package/dist/v2/projections/run-status-signals.d.ts +1 -7
  160. package/dist/v2/projections/run-status-signals.js +3 -2
  161. package/dist/v2/usecases/enumerate-sessions.d.ts +9 -0
  162. package/dist/v2/usecases/enumerate-sessions.js +13 -0
  163. package/dist/v2/usecases/execution-session-gate.js +2 -5
  164. package/dist/v2/usecases/export-session.js +4 -2
  165. package/dist/v2/usecases/import-session.d.ts +3 -3
  166. package/dist/v2/usecases/resume-session.d.ts +4 -0
  167. package/dist/v2/usecases/resume-session.js +9 -0
  168. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import type { z } from 'zod';
2
+ import type { V2ResumeSessionInput } from '../v2/tools.js';
3
+ import type { ToolContext, ToolResult } from '../types.js';
4
+ import { V2ResumeSessionOutputSchema } from '../output-schemas.js';
5
+ type ResumeInput = z.infer<typeof V2ResumeSessionInput>;
6
+ type ResumeOutput = z.infer<typeof V2ResumeSessionOutputSchema>;
7
+ export declare function handleV2ResumeSession(input: ResumeInput, ctx: ToolContext): Promise<ToolResult<ResumeOutput>>;
8
+ export {};
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleV2ResumeSession = handleV2ResumeSession;
4
+ const types_js_1 = require("../types.js");
5
+ const output_schemas_js_1 = require("../output-schemas.js");
6
+ const v2_token_ops_js_1 = require("./v2-token-ops.js");
7
+ const index_js_1 = require("../../v2/durable-core/ids/index.js");
8
+ const resume_session_js_1 = require("../../v2/usecases/resume-session.js");
9
+ function anchorValue(anchors, key) {
10
+ const anchor = anchors.find((a) => a.key === key);
11
+ return anchor?.value;
12
+ }
13
+ async function handleV2ResumeSession(input, ctx) {
14
+ const v2 = ctx.v2;
15
+ if (!v2) {
16
+ return (0, types_js_1.errNotRetryable)('INTERNAL_ERROR', 'v2 dependencies not available');
17
+ }
18
+ if (!v2.sessionSummaryProvider) {
19
+ return (0, types_js_1.errNotRetryable)('INTERNAL_ERROR', 'resume_session requires sessionSummaryProvider port');
20
+ }
21
+ let anchors = [];
22
+ if (v2.workspaceAnchor) {
23
+ const anchorRes = await v2.workspaceAnchor.resolveAnchors();
24
+ if (anchorRes.isOk()) {
25
+ anchors = anchorRes.value;
26
+ }
27
+ }
28
+ const query = {
29
+ gitHeadSha: input.gitHeadSha ?? anchorValue(anchors, 'git_head_sha'),
30
+ gitBranch: input.gitBranch ?? anchorValue(anchors, 'git_branch'),
31
+ freeTextQuery: input.query,
32
+ };
33
+ const resumeResult = await (0, resume_session_js_1.resumeSession)(query, v2.sessionSummaryProvider);
34
+ if (resumeResult.isErr()) {
35
+ return (0, types_js_1.errNotRetryable)('INTERNAL_ERROR', `Resume failed: ${resumeResult.error.message}`);
36
+ }
37
+ const candidates = resumeResult.value;
38
+ const outputCandidates = [];
39
+ for (const candidate of candidates) {
40
+ const stateTokenRes = (0, v2_token_ops_js_1.signTokenOrErr)({
41
+ payload: {
42
+ tokenVersion: 1,
43
+ tokenKind: 'state',
44
+ sessionId: candidate.sessionId,
45
+ runId: (0, index_js_1.asRunId)(candidate.runId),
46
+ nodeId: (0, index_js_1.asNodeId)(candidate.preferredTipNodeId),
47
+ workflowHashRef: (0, index_js_1.asWorkflowHashRef)(''),
48
+ },
49
+ ports: v2.tokenCodecPorts,
50
+ });
51
+ if (stateTokenRes.isErr()) {
52
+ continue;
53
+ }
54
+ outputCandidates.push({
55
+ sessionId: candidate.sessionId,
56
+ runId: candidate.runId,
57
+ stateToken: stateTokenRes.value,
58
+ snippet: candidate.snippet,
59
+ whyMatched: [...candidate.whyMatched],
60
+ });
61
+ }
62
+ const output = output_schemas_js_1.V2ResumeSessionOutputSchema.parse({
63
+ candidates: outputCandidates,
64
+ totalEligible: candidates.length,
65
+ });
66
+ return {
67
+ type: 'success',
68
+ data: output,
69
+ };
70
+ }
@@ -2,7 +2,6 @@ import type { EngineStateV1 } from '../../v2/durable-core/schemas/execution-snap
2
2
  import type { ExecutionState } from '../../domain/execution/state.js';
3
3
  import type { RunId, NodeId } from '../../v2/durable-core/ids/index.js';
4
4
  import type { LoadedSessionTruthV2 } from '../../v2/ports/session-event-log-store.port.js';
5
- import { createWorkflow } from '../../types/workflow.js';
6
5
  export declare function toV1ExecutionState(engineState: EngineStateV1): ExecutionState;
7
6
  export declare function convertRunningExecutionStateToEngineState(state: Extract<ExecutionState, {
8
7
  kind: 'running';
@@ -18,10 +17,6 @@ export interface StepMetadata {
18
17
  readonly prompt: string;
19
18
  readonly requireConfirmation: boolean;
20
19
  }
21
- export declare function extractStepMetadata(workflow: ReturnType<typeof createWorkflow>, stepId: string | null, options?: {
22
- defaultTitle?: string;
23
- defaultPrompt?: string;
24
- }): StepMetadata;
25
20
  export type PreferencesV2 = {
26
21
  readonly autonomy: 'guided' | 'full_auto_stop_on_user_deps' | 'full_auto_never_stop';
27
22
  readonly riskPolicy: 'conservative' | 'balanced' | 'aggressive';
@@ -5,12 +5,11 @@ exports.toV1ExecutionState = toV1ExecutionState;
5
5
  exports.convertRunningExecutionStateToEngineState = convertRunningExecutionStateToEngineState;
6
6
  exports.fromV1ExecutionState = fromV1ExecutionState;
7
7
  exports.mapWorkflowSourceKind = mapWorkflowSourceKind;
8
- exports.extractStepMetadata = extractStepMetadata;
9
8
  exports.derivePreferencesForNode = derivePreferencesForNode;
10
9
  exports.deriveNextIntent = deriveNextIntent;
11
10
  const step_instance_key_js_1 = require("../../v2/durable-core/schemas/execution-snapshot/step-instance-key.js");
12
11
  const preferences_js_1 = require("../../v2/projections/preferences.js");
13
- const workflow_js_1 = require("../../types/workflow.js");
12
+ const constants_js_1 = require("../../v2/durable-core/constants.js");
14
13
  function toV1ExecutionState(engineState) {
15
14
  if (engineState.kind === 'init')
16
15
  return { kind: 'init' };
@@ -85,29 +84,11 @@ function mapWorkflowSourceKind(kind) {
85
84
  const mapped = workflowSourceKindMap[kind];
86
85
  return mapped ?? 'project';
87
86
  }
88
- function extractStepMetadata(workflow, stepId, options) {
89
- const resolvedStepId = stepId ?? '';
90
- const step = stepId ? (0, workflow_js_1.getStepById)(workflow, stepId) : null;
91
- const hasStringProp = (obj, prop) => typeof obj === 'object' &&
92
- obj !== null &&
93
- prop in obj &&
94
- typeof obj[prop] === 'string';
95
- const title = hasStringProp(step, 'title')
96
- ? String(step.title)
97
- : options?.defaultTitle ?? resolvedStepId;
98
- const prompt = hasStringProp(step, 'prompt')
99
- ? String(step.prompt)
100
- : options?.defaultPrompt ?? (stepId ? `Pending step: ${stepId}` : '');
101
- const requireConfirmation = typeof step === 'object' && step !== null && 'requireConfirmation' in step
102
- ? Boolean(step.requireConfirmation)
103
- : false;
104
- return { stepId: resolvedStepId, title, prompt, requireConfirmation };
105
- }
106
87
  exports.defaultPreferences = { autonomy: 'guided', riskPolicy: 'conservative' };
107
88
  function derivePreferencesForNode(args) {
108
89
  const parentByNodeId = {};
109
90
  for (const e of args.truth.events) {
110
- if (e.kind !== 'node_created')
91
+ if (e.kind !== constants_js_1.EVENT_KIND.NODE_CREATED)
111
92
  continue;
112
93
  if (e.scope?.runId !== String(args.runId))
113
94
  continue;
@@ -36,7 +36,7 @@ export declare function parseCheckpointTokenOrFail(raw: string, ports: TokenCode
36
36
  export declare function newAttemptId(idFactory: {
37
37
  readonly mintAttemptId: () => AttemptId;
38
38
  }): AttemptId;
39
- export declare function attemptIdForNextNode(parentAttemptId: AttemptId, sha256: Sha256PortV2): AttemptId;
39
+ export declare function attemptIdForNextNode(parentAttemptId: AttemptId, sha256: Sha256PortV2): Result<AttemptId, import('../../v2/durable-core/ids/attempt-id-derivation.js').AttemptIdDerivationError>;
40
40
  export declare function signTokenOrErr(args: {
41
41
  payload: TokenPayloadV1;
42
42
  ports: TokenCodecPorts;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handleV2ListWorkflows = handleV2ListWorkflows;
4
4
  exports.handleV2InspectWorkflow = handleV2InspectWorkflow;
5
+ const neverthrow_1 = require("neverthrow");
5
6
  const types_js_1 = require("../types.js");
6
7
  const error_mapper_js_1 = require("../error-mapper.js");
7
8
  const output_schemas_js_1 = require("../output-schemas.js");
@@ -20,93 +21,104 @@ async function handleV2ListWorkflows(_input, ctx) {
20
21
  if (v2Err)
21
22
  return v2Err;
22
23
  const { crypto, pinnedStore } = ctx.v2;
23
- try {
24
- const summaries = await (0, with_timeout_js_1.withTimeout)(ctx.workflowService.listWorkflowSummaries(), TIMEOUT_MS, 'list_workflows');
25
- const compiled = await Promise.all(summaries.map(async (s) => {
26
- const wf = await ctx.workflowService.getWorkflowById(s.id);
27
- if (!wf) {
28
- return {
29
- workflowId: s.id,
30
- name: s.name,
31
- description: s.description,
32
- version: s.version,
33
- workflowHash: null,
34
- kind: 'workflow',
35
- };
36
- }
37
- const snapshot = (0, v1_to_v2_shim_js_1.compileV1WorkflowToV2PreviewSnapshot)(wf);
38
- const hashRes = (0, hashing_js_1.workflowHashForCompiledSnapshot)(snapshot, crypto);
39
- if (hashRes.isErr()) {
40
- return {
41
- workflowId: s.id,
42
- name: s.name,
43
- description: s.description,
44
- version: s.version,
45
- workflowHash: null,
46
- kind: 'workflow',
47
- };
48
- }
49
- const hash = hashRes.value;
50
- const existing = await pinnedStore.get(hash).match((v) => v, () => null);
51
- if (!existing) {
52
- await pinnedStore.put(hash, snapshot).match(() => undefined, () => undefined);
53
- }
54
- return {
24
+ return neverthrow_1.ResultAsync.fromPromise((0, with_timeout_js_1.withTimeout)(ctx.workflowService.listWorkflowSummaries(), TIMEOUT_MS, 'list_workflows'), (err) => (0, error_mapper_js_1.mapUnknownErrorToToolError)(err))
25
+ .andThen((summaries) => neverthrow_1.ResultAsync.combine(summaries.map((s) => neverthrow_1.ResultAsync.fromPromise(ctx.workflowService.getWorkflowById(s.id), (err) => (0, error_mapper_js_1.mapUnknownErrorToToolError)(err)).andThen((wf) => {
26
+ if (!wf) {
27
+ return (0, neverthrow_1.okAsync)({
28
+ workflowId: s.id,
29
+ name: s.name,
30
+ description: s.description,
31
+ version: s.version,
32
+ workflowHash: null,
33
+ kind: 'workflow',
34
+ });
35
+ }
36
+ const snapshot = (0, v1_to_v2_shim_js_1.compileV1WorkflowToV2PreviewSnapshot)(wf);
37
+ const hashRes = (0, hashing_js_1.workflowHashForCompiledSnapshot)(snapshot, crypto);
38
+ if (hashRes.isErr()) {
39
+ return (0, neverthrow_1.okAsync)({
55
40
  workflowId: s.id,
56
41
  name: s.name,
57
42
  description: s.description,
58
43
  version: s.version,
59
- workflowHash: hash,
44
+ workflowHash: null,
60
45
  kind: 'workflow',
61
- };
46
+ });
47
+ }
48
+ const hash = hashRes.value;
49
+ return pinnedStore
50
+ .get(hash)
51
+ .andThen((existing) => {
52
+ if (!existing) {
53
+ return pinnedStore.put(hash, snapshot).map(() => undefined);
54
+ }
55
+ return (0, neverthrow_1.okAsync)(undefined);
56
+ })
57
+ .map(() => ({
58
+ workflowId: s.id,
59
+ name: s.name,
60
+ description: s.description,
61
+ version: s.version,
62
+ workflowHash: hash,
63
+ kind: 'workflow',
64
+ }))
65
+ .orElse(() => (0, neverthrow_1.okAsync)({
66
+ workflowId: s.id,
67
+ name: s.name,
68
+ description: s.description,
69
+ version: s.version,
70
+ workflowHash: hash,
71
+ kind: 'workflow',
62
72
  }));
73
+ }))))
74
+ .map((compiled) => {
63
75
  const payload = output_schemas_js_1.V2WorkflowListOutputSchema.parse({
64
76
  workflows: compiled.sort((a, b) => a.workflowId.localeCompare(b.workflowId)),
65
77
  });
66
78
  return (0, types_js_1.success)(payload);
67
- }
68
- catch (err) {
69
- const mapped = (0, error_mapper_js_1.mapUnknownErrorToToolError)(err);
70
- return mapped;
71
- }
79
+ })
80
+ .match((result) => Promise.resolve(result), (err) => Promise.resolve(err));
72
81
  }
73
82
  async function handleV2InspectWorkflow(input, ctx) {
74
83
  const v2Err = requireV2(ctx);
75
84
  if (v2Err)
76
85
  return v2Err;
77
86
  const { crypto, pinnedStore } = ctx.v2;
78
- try {
79
- const workflow = await (0, with_timeout_js_1.withTimeout)(ctx.workflowService.getWorkflowById(input.workflowId), TIMEOUT_MS, 'inspect_workflow');
87
+ return neverthrow_1.ResultAsync.fromPromise((0, with_timeout_js_1.withTimeout)(ctx.workflowService.getWorkflowById(input.workflowId), TIMEOUT_MS, 'inspect_workflow'), (err) => (0, error_mapper_js_1.mapUnknownErrorToToolError)(err))
88
+ .andThen((workflow) => {
80
89
  if (!workflow) {
81
- return (0, types_js_1.errNotRetryable)('NOT_FOUND', `Workflow not found: ${input.workflowId}`);
90
+ return (0, neverthrow_1.errAsync)((0, types_js_1.errNotRetryable)('NOT_FOUND', `Workflow not found: ${input.workflowId}`));
82
91
  }
83
92
  const snapshot = (0, v1_to_v2_shim_js_1.compileV1WorkflowToV2PreviewSnapshot)(workflow);
84
93
  const hashRes = (0, hashing_js_1.workflowHashForCompiledSnapshot)(snapshot, crypto);
85
94
  if (hashRes.isErr()) {
86
- return (0, types_js_1.errNotRetryable)('INTERNAL_ERROR', hashRes.error.message);
95
+ return (0, neverthrow_1.errAsync)((0, types_js_1.errNotRetryable)('INTERNAL_ERROR', hashRes.error.message));
87
96
  }
88
97
  const workflowHash = hashRes.value;
89
- const existing = await pinnedStore.get(workflowHash).match((v) => v, () => null);
90
- if (!existing) {
91
- const wrote = await pinnedStore.put(workflowHash, snapshot).match(() => ({ ok: true }), (e) => ({ ok: false, error: e }));
92
- if (!wrote.ok) {
93
- return (0, types_js_1.errNotRetryable)('INTERNAL_ERROR', wrote.error.message);
98
+ return pinnedStore
99
+ .get(workflowHash)
100
+ .andThen((existing) => {
101
+ if (!existing) {
102
+ return pinnedStore.put(workflowHash, snapshot).map(() => snapshot);
94
103
  }
95
- }
96
- const compiled = (await pinnedStore.get(workflowHash).match((v) => v, () => null)) ?? snapshot;
97
- const body = input.mode === 'metadata'
98
- ? { schemaVersion: compiled.schemaVersion, sourceKind: compiled.sourceKind, workflowId: compiled.workflowId }
99
- : compiled;
100
- const payload = output_schemas_js_1.V2WorkflowInspectOutputSchema.parse({
101
- workflowId: input.workflowId,
102
- workflowHash,
103
- mode: input.mode,
104
- compiled: body,
104
+ return (0, neverthrow_1.okAsync)(existing);
105
+ })
106
+ .orElse(() => (0, neverthrow_1.okAsync)(snapshot))
107
+ .map((compiled) => {
108
+ if (!compiled) {
109
+ throw new Error('Compiled workflow unexpectedly null');
110
+ }
111
+ const body = input.mode === 'metadata'
112
+ ? { schemaVersion: compiled.schemaVersion, sourceKind: compiled.sourceKind, workflowId: compiled.workflowId }
113
+ : compiled;
114
+ const payload = output_schemas_js_1.V2WorkflowInspectOutputSchema.parse({
115
+ workflowId: input.workflowId,
116
+ workflowHash,
117
+ mode: input.mode,
118
+ compiled: body,
119
+ });
120
+ return (0, types_js_1.success)(payload);
105
121
  });
106
- return (0, types_js_1.success)(payload);
107
- }
108
- catch (err) {
109
- const mapped = (0, error_mapper_js_1.mapUnknownErrorToToolError)(err);
110
- return mapped;
111
- }
122
+ })
123
+ .match((result) => Promise.resolve(result), (err) => Promise.resolve(err));
112
124
  }
@@ -1067,6 +1067,46 @@ export declare const V2ContinueWorkflowOutputSchema: z.ZodEffects<z.ZodDiscrimin
1067
1067
  retryable?: boolean | undefined;
1068
1068
  retryAckToken?: string | undefined;
1069
1069
  }>;
1070
+ export declare const V2ResumeSessionOutputSchema: z.ZodObject<{
1071
+ candidates: z.ZodArray<z.ZodObject<{
1072
+ sessionId: z.ZodString;
1073
+ runId: z.ZodString;
1074
+ stateToken: z.ZodString;
1075
+ snippet: z.ZodString;
1076
+ whyMatched: z.ZodArray<z.ZodEnum<["matched_head_sha", "matched_branch", "matched_notes", "matched_workflow_id", "recency_fallback"]>, "many">;
1077
+ }, "strip", z.ZodTypeAny, {
1078
+ sessionId: string;
1079
+ runId: string;
1080
+ stateToken: string;
1081
+ snippet: string;
1082
+ whyMatched: ("matched_head_sha" | "matched_branch" | "matched_notes" | "matched_workflow_id" | "recency_fallback")[];
1083
+ }, {
1084
+ sessionId: string;
1085
+ runId: string;
1086
+ stateToken: string;
1087
+ snippet: string;
1088
+ whyMatched: ("matched_head_sha" | "matched_branch" | "matched_notes" | "matched_workflow_id" | "recency_fallback")[];
1089
+ }>, "many">;
1090
+ totalEligible: z.ZodNumber;
1091
+ }, "strip", z.ZodTypeAny, {
1092
+ candidates: {
1093
+ sessionId: string;
1094
+ runId: string;
1095
+ stateToken: string;
1096
+ snippet: string;
1097
+ whyMatched: ("matched_head_sha" | "matched_branch" | "matched_notes" | "matched_workflow_id" | "recency_fallback")[];
1098
+ }[];
1099
+ totalEligible: number;
1100
+ }, {
1101
+ candidates: {
1102
+ sessionId: string;
1103
+ runId: string;
1104
+ stateToken: string;
1105
+ snippet: string;
1106
+ whyMatched: ("matched_head_sha" | "matched_branch" | "matched_notes" | "matched_workflow_id" | "recency_fallback")[];
1107
+ }[];
1108
+ totalEligible: number;
1109
+ }>;
1070
1110
  export declare const V2CheckpointWorkflowOutputSchema: z.ZodObject<{
1071
1111
  checkpointNodeId: z.ZodString;
1072
1112
  stateToken: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OpenDashboardOutputSchema = exports.ReadSessionSchemaOutputSchema = exports.ReadSessionOutputSchema = exports.UpdateSessionOutputSchema = exports.CreateSessionOutputSchema = exports.V2StartWorkflowOutputSchema = exports.V2CheckpointWorkflowOutputSchema = exports.V2ContinueWorkflowOutputSchema = exports.V2BlockerReportSchema = exports.V2NextCallSchema = exports.V2NextIntentSchema = exports.V2PreferencesSchema = exports.V2PendingStepSchema = exports.V2WorkflowInspectOutputSchema = exports.V2WorkflowListOutputSchema = exports.V2WorkflowListItemSchema = exports.WorkflowGetSchemaOutputSchema = exports.WorkflowValidateJsonOutputSchema = exports.WorkflowNextOutputSchema = exports.WorkflowGetOutputSchema = exports.WorkflowListOutputSchema = exports.WorkflowSummarySchema = exports.JsonValueSchema = void 0;
3
+ exports.OpenDashboardOutputSchema = exports.ReadSessionSchemaOutputSchema = exports.ReadSessionOutputSchema = exports.UpdateSessionOutputSchema = exports.CreateSessionOutputSchema = exports.V2StartWorkflowOutputSchema = exports.V2CheckpointWorkflowOutputSchema = exports.V2ResumeSessionOutputSchema = exports.V2ContinueWorkflowOutputSchema = exports.V2BlockerReportSchema = exports.V2NextCallSchema = exports.V2NextIntentSchema = exports.V2PreferencesSchema = exports.V2PendingStepSchema = exports.V2WorkflowInspectOutputSchema = exports.V2WorkflowListOutputSchema = exports.V2WorkflowListItemSchema = exports.WorkflowGetSchemaOutputSchema = exports.WorkflowValidateJsonOutputSchema = exports.WorkflowNextOutputSchema = exports.WorkflowGetOutputSchema = exports.WorkflowListOutputSchema = exports.WorkflowSummarySchema = exports.JsonValueSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const state_js_1 = require("../domain/execution/state.js");
6
6
  const JsonPrimitiveSchema = zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean(), zod_1.z.null()]);
@@ -204,6 +204,22 @@ exports.V2ContinueWorkflowOutputSchema = zod_1.z.discriminatedUnion('kind', [
204
204
  V2ContinueWorkflowOkSchema,
205
205
  V2ContinueWorkflowBlockedSchema,
206
206
  ]).refine((data) => (data.pending ? data.ackToken != null : true), { message: 'ackToken is required when a pending step exists' });
207
+ exports.V2ResumeSessionOutputSchema = zod_1.z.object({
208
+ candidates: zod_1.z.array(zod_1.z.object({
209
+ sessionId: zod_1.z.string().min(1),
210
+ runId: zod_1.z.string().min(1),
211
+ stateToken: zod_1.z.string().regex(/^st1[023456789acdefghjklmnpqrstuvwxyz]+$/, 'Invalid stateToken format'),
212
+ snippet: zod_1.z.string().max(1024),
213
+ whyMatched: zod_1.z.array(zod_1.z.enum([
214
+ 'matched_head_sha',
215
+ 'matched_branch',
216
+ 'matched_notes',
217
+ 'matched_workflow_id',
218
+ 'recency_fallback',
219
+ ])),
220
+ })).max(5),
221
+ totalEligible: zod_1.z.number().int().min(0),
222
+ });
207
223
  exports.V2CheckpointWorkflowOutputSchema = zod_1.z.object({
208
224
  checkpointNodeId: zod_1.z.string().min(1),
209
225
  stateToken: zod_1.z.string().regex(/^st1[023456789acdefghjklmnpqrstuvwxyz]+$/, 'Invalid stateToken format'),
@@ -41,6 +41,8 @@ const tokens_js_1 = require("../di/tokens.js");
41
41
  const assert_never_js_1 = require("../runtime/assert-never.js");
42
42
  const token_codec_ports_js_1 = require("../v2/durable-core/tokens/token-codec-ports.js");
43
43
  const index_js_1 = require("../v2/infra/local/workspace-anchor/index.js");
44
+ const index_js_2 = require("../v2/infra/local/directory-listing/index.js");
45
+ const index_js_3 = require("../v2/infra/local/session-summary-provider/index.js");
44
46
  const tool_factory_js_1 = require("./tool-factory.js");
45
47
  const handler_factory_js_1 = require("./handler-factory.js");
46
48
  const workflow_tool_edition_selector_js_1 = require("./workflow-tool-edition-selector.js");
@@ -87,6 +89,9 @@ async function createToolContext() {
87
89
  base32,
88
90
  bech32m,
89
91
  });
92
+ const dataDir = container_js_1.container.resolve(tokens_js_1.DI.V2.DataDir);
93
+ const fsPort = container_js_1.container.resolve(tokens_js_1.DI.V2.FileSystem);
94
+ const directoryListing = new index_js_2.LocalDirectoryListingV2(fsPort);
90
95
  v2 = {
91
96
  gate,
92
97
  sessionStore,
@@ -97,6 +102,13 @@ async function createToolContext() {
97
102
  idFactory,
98
103
  tokenCodecPorts,
99
104
  workspaceAnchor: new index_js_1.LocalWorkspaceAnchorV2(process.cwd()),
105
+ dataDir,
106
+ directoryListing,
107
+ sessionSummaryProvider: new index_js_3.LocalSessionSummaryProviderV2({
108
+ directoryListing,
109
+ dataDir,
110
+ sessionStore,
111
+ }),
100
112
  };
101
113
  console.error('[FeatureFlags] v2 tools enabled');
102
114
  }
@@ -123,6 +123,18 @@ Requires: checkpointToken (from the most recent start_workflow or continue_workf
123
123
  Idempotent: calling with the same checkpointToken multiple times is safe and returns the same result.
124
124
 
125
125
  Returns: checkpointNodeId + a fresh stateToken.`,
126
+ resume_session: `Find and reconnect to an existing workflow session (WorkRail v2, feature-flagged).
127
+
128
+ Use this when you need to resume a previously started workflow but don't have the stateToken (e.g., new chat, lost context).
129
+
130
+ WorkRail ranks sessions using a 5-tier matching algorithm:
131
+ 1. Exact git HEAD SHA match
132
+ 2. Git branch match (exact or prefix)
133
+ 3. Free text match against session notes
134
+ 4. Free text match against workflow ID
135
+ 5. Recency fallback
136
+
137
+ Returns: Up to 5 ranked candidates, each with a stateToken you can use with continue_workflow.`,
126
138
  },
127
139
  authoritative: {
128
140
  discover_workflows: `Check for workflows that apply to the user's request. Workflows are the user's pre-defined instructions that you MUST follow when they exist.
@@ -268,5 +280,15 @@ Creates a durable checkpoint without advancing. Use for long-running steps to sa
268
280
  Requires: checkpointToken from the most recent response. Idempotent.
269
281
 
270
282
  Returns: checkpointNodeId + fresh stateToken.`,
283
+ resume_session: `Find and reconnect to an existing workflow session (WorkRail v2, feature-flagged).
284
+
285
+ Call this when resuming a workflow without a stateToken. WorkRail ranks sessions deterministically:
286
+ 1. Exact git HEAD SHA match (tier 1)
287
+ 2. Git branch match (tier 2)
288
+ 3. Notes content match (tier 3)
289
+ 4. Workflow ID match (tier 4)
290
+ 5. Recency (tier 5)
291
+
292
+ Returns: Up to 5 candidates with stateTokens. Use the best match's stateToken with continue_workflow.`,
271
293
  },
272
294
  };
package/dist/mcp/tools.js CHANGED
@@ -87,6 +87,11 @@ exports.WORKFLOW_TOOL_ANNOTATIONS = {
87
87
  destructiveHint: false,
88
88
  idempotentHint: true,
89
89
  },
90
+ resume_session: {
91
+ readOnlyHint: true,
92
+ destructiveHint: false,
93
+ idempotentHint: true,
94
+ },
90
95
  };
91
96
  exports.WORKFLOW_TOOL_TITLES = {
92
97
  discover_workflows: 'Discover Available Workflows',
@@ -99,6 +104,7 @@ exports.WORKFLOW_TOOL_TITLES = {
99
104
  start_workflow: 'Start Workflow (v2)',
100
105
  continue_workflow: 'Continue Workflow (v2)',
101
106
  checkpoint_workflow: 'Checkpoint Workflow (v2)',
107
+ resume_session: 'Resume Session (v2)',
102
108
  };
103
109
  exports.CreateSessionInput = zod_1.z.object({
104
110
  workflowId: zod_1.z
@@ -1,6 +1,6 @@
1
1
  export declare const DESCRIPTION_MODES: readonly ["standard", "authoritative"];
2
2
  export type DescriptionMode = typeof DESCRIPTION_MODES[number];
3
- export declare const WORKFLOW_TOOL_NAMES: readonly ["discover_workflows", "preview_workflow", "advance_workflow", "validate_workflow", "get_workflow_schema", "list_workflows", "inspect_workflow", "start_workflow", "continue_workflow", "checkpoint_workflow"];
3
+ export declare const WORKFLOW_TOOL_NAMES: readonly ["discover_workflows", "preview_workflow", "advance_workflow", "validate_workflow", "get_workflow_schema", "list_workflows", "inspect_workflow", "start_workflow", "continue_workflow", "checkpoint_workflow", "resume_session"];
4
4
  export type WorkflowToolName = typeof WORKFLOW_TOOL_NAMES[number];
5
5
  export type ToolDescriptionMap = Readonly<Record<WorkflowToolName, string>>;
6
6
  export type DescriptionsByMode = Readonly<Record<DescriptionMode, ToolDescriptionMap>>;
@@ -18,6 +18,7 @@ exports.WORKFLOW_TOOL_NAMES = [
18
18
  'start_workflow',
19
19
  'continue_workflow',
20
20
  'checkpoint_workflow',
21
+ 'resume_session',
21
22
  ];
22
23
  function isDescriptionMode(value) {
23
24
  return exports.DESCRIPTION_MODES.includes(value);
@@ -2,7 +2,7 @@ import type { z } from 'zod';
2
2
  import type { ToolDefinition } from '../tool-factory.js';
3
3
  import type { ToolContext } from '../types.js';
4
4
  export type V1WorkflowToolName = 'discover_workflows' | 'preview_workflow' | 'advance_workflow' | 'validate_workflow' | 'get_workflow_schema';
5
- export type V2WorkflowToolName = 'list_workflows' | 'inspect_workflow' | 'start_workflow' | 'continue_workflow' | 'checkpoint_workflow';
5
+ export type V2WorkflowToolName = 'list_workflows' | 'inspect_workflow' | 'start_workflow' | 'continue_workflow' | 'checkpoint_workflow' | 'resume_session';
6
6
  export type McpCallToolResult = {
7
7
  readonly content: ReadonlyArray<{
8
8
  readonly type: 'text';
@@ -13,6 +13,9 @@ import type { IdFactoryV2 } from '../v2/infra/local/id-factory/index.js';
13
13
  import type { JsonValue } from './output-schemas.js';
14
14
  import type { TokenCodecPorts } from '../v2/durable-core/tokens/token-codec-ports.js';
15
15
  import type { WorkspaceAnchorPortV2 } from '../v2/ports/workspace-anchor.port.js';
16
+ import type { DataDirPortV2 } from '../v2/ports/data-dir.port.js';
17
+ import type { DirectoryListingPortV2 } from '../v2/ports/directory-listing.port.js';
18
+ import type { SessionSummaryProviderPortV2 } from '../v2/ports/session-summary-provider.port.js';
16
19
  export interface SessionHealthDetails {
17
20
  readonly health: SessionHealthV2;
18
21
  }
@@ -53,6 +56,9 @@ export interface V2Dependencies {
53
56
  readonly idFactory: IdFactoryV2;
54
57
  readonly tokenCodecPorts: TokenCodecPorts;
55
58
  readonly workspaceAnchor?: WorkspaceAnchorPortV2;
59
+ readonly dataDir?: DataDirPortV2;
60
+ readonly directoryListing?: DirectoryListingPortV2;
61
+ readonly sessionSummaryProvider?: SessionSummaryProviderPortV2;
56
62
  }
57
63
  export interface ToolContext {
58
64
  readonly workflowService: WorkflowService;
@@ -6,6 +6,7 @@ const tools_js_1 = require("./tools.js");
6
6
  const v2_execution_js_1 = require("../handlers/v2-execution.js");
7
7
  const v2_workflow_js_1 = require("../handlers/v2-workflow.js");
8
8
  const v2_checkpoint_js_1 = require("../handlers/v2-checkpoint.js");
9
+ const v2_resume_js_1 = require("../handlers/v2-resume.js");
9
10
  function buildV2ToolRegistry(buildTool) {
10
11
  const tools = [
11
12
  buildTool({
@@ -38,6 +39,12 @@ function buildV2ToolRegistry(buildTool) {
38
39
  inputSchema: tools_js_1.V2CheckpointWorkflowInput,
39
40
  annotations: tools_js_1.V2_TOOL_ANNOTATIONS.checkpoint_workflow,
40
41
  }),
42
+ buildTool({
43
+ name: 'resume_session',
44
+ title: tools_js_1.V2_TOOL_TITLES.resume_session,
45
+ inputSchema: tools_js_1.V2ResumeSessionInput,
46
+ annotations: tools_js_1.V2_TOOL_ANNOTATIONS.resume_session,
47
+ }),
41
48
  ];
42
49
  const handlers = {
43
50
  list_workflows: (0, handler_factory_js_1.createHandler)(tools_js_1.V2ListWorkflowsInput, v2_workflow_js_1.handleV2ListWorkflows),
@@ -45,6 +52,7 @@ function buildV2ToolRegistry(buildTool) {
45
52
  start_workflow: (0, handler_factory_js_1.createHandler)(tools_js_1.V2StartWorkflowInput, v2_execution_js_1.handleV2StartWorkflow),
46
53
  continue_workflow: (0, handler_factory_js_1.createHandler)(tools_js_1.V2ContinueWorkflowInput, v2_execution_js_1.handleV2ContinueWorkflow),
47
54
  checkpoint_workflow: (0, handler_factory_js_1.createHandler)(tools_js_1.V2CheckpointWorkflowInput, v2_checkpoint_js_1.handleV2CheckpointWorkflow),
55
+ resume_session: (0, handler_factory_js_1.createHandler)(tools_js_1.V2ResumeSessionInput, v2_resume_js_1.handleV2ResumeSession),
48
56
  };
49
57
  return { tools, handlers };
50
58
  }
@@ -77,6 +77,20 @@ export declare const V2ContinueWorkflowInput: z.ZodEffects<z.ZodObject<{
77
77
  ackToken?: string | undefined;
78
78
  }>;
79
79
  export type V2ContinueWorkflowInput = z.infer<typeof V2ContinueWorkflowInput>;
80
+ export declare const V2ResumeSessionInput: z.ZodObject<{
81
+ query: z.ZodOptional<z.ZodString>;
82
+ gitBranch: z.ZodOptional<z.ZodString>;
83
+ gitHeadSha: z.ZodOptional<z.ZodString>;
84
+ }, "strict", z.ZodTypeAny, {
85
+ query?: string | undefined;
86
+ gitBranch?: string | undefined;
87
+ gitHeadSha?: string | undefined;
88
+ }, {
89
+ query?: string | undefined;
90
+ gitBranch?: string | undefined;
91
+ gitHeadSha?: string | undefined;
92
+ }>;
93
+ export type V2ResumeSessionInput = z.infer<typeof V2ResumeSessionInput>;
80
94
  export declare const V2CheckpointWorkflowInput: z.ZodObject<{
81
95
  checkpointToken: z.ZodString;
82
96
  }, "strict", z.ZodTypeAny, {
@@ -91,5 +105,6 @@ export declare const V2_TOOL_TITLES: {
91
105
  readonly start_workflow: "Start Workflow (v2)";
92
106
  readonly continue_workflow: "Continue Workflow (v2)";
93
107
  readonly checkpoint_workflow: "Checkpoint Workflow (v2)";
108
+ readonly resume_session: "Resume Session (v2)";
94
109
  };
95
110
  export declare const V2_TOOL_ANNOTATIONS: Readonly<Record<keyof typeof V2_TOOL_TITLES, ToolAnnotations>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.V2_TOOL_ANNOTATIONS = exports.V2_TOOL_TITLES = exports.V2CheckpointWorkflowInput = exports.V2ContinueWorkflowInput = exports.V2StartWorkflowInput = exports.V2InspectWorkflowInput = exports.V2ListWorkflowsInput = void 0;
3
+ exports.V2_TOOL_ANNOTATIONS = exports.V2_TOOL_TITLES = exports.V2CheckpointWorkflowInput = exports.V2ResumeSessionInput = exports.V2ContinueWorkflowInput = exports.V2StartWorkflowInput = exports.V2InspectWorkflowInput = exports.V2ListWorkflowsInput = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.V2ListWorkflowsInput = zod_1.z.object({});
6
6
  exports.V2InspectWorkflowInput = zod_1.z.object({
@@ -54,6 +54,11 @@ exports.V2ContinueWorkflowInput = zod_1.z.object({
54
54
  });
55
55
  }
56
56
  });
57
+ exports.V2ResumeSessionInput = zod_1.z.object({
58
+ query: zod_1.z.string().max(256).optional().describe('Free text search to find a relevant session. Matches against recap notes and workflow IDs.'),
59
+ gitBranch: zod_1.z.string().max(256).optional().describe('Git branch name to match against session observations. Overrides auto-detected branch.'),
60
+ gitHeadSha: zod_1.z.string().regex(/^[0-9a-f]{40}$/).optional().describe('Git HEAD SHA to match against session observations. Overrides auto-detected HEAD.'),
61
+ }).strict();
57
62
  exports.V2CheckpointWorkflowInput = zod_1.z.object({
58
63
  checkpointToken: zod_1.z.string().min(1).describe('The checkpoint token from the most recent start_workflow or continue_workflow response. ' +
59
64
  'Creates a checkpoint on the current step without advancing. Idempotent — calling with the same token is safe.'),
@@ -64,6 +69,7 @@ exports.V2_TOOL_TITLES = {
64
69
  start_workflow: 'Start Workflow (v2)',
65
70
  continue_workflow: 'Continue Workflow (v2)',
66
71
  checkpoint_workflow: 'Checkpoint Workflow (v2)',
72
+ resume_session: 'Resume Session (v2)',
67
73
  };
68
74
  exports.V2_TOOL_ANNOTATIONS = {
69
75
  list_workflows: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
@@ -71,4 +77,5 @@ exports.V2_TOOL_ANNOTATIONS = {
71
77
  start_workflow: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
72
78
  continue_workflow: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
73
79
  checkpoint_workflow: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
80
+ resume_session: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
74
81
  };