@exaudeus/workrail 3.15.0 → 3.17.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.
- package/dist/application/services/workflow-service.d.ts +2 -0
- package/dist/application/services/workflow-service.js +3 -0
- package/dist/application/use-cases/raw-workflow-file-scanner.js +10 -13
- package/dist/cli/commands/index.d.ts +1 -1
- package/dist/cli/commands/index.js +2 -1
- package/dist/cli/commands/init.d.ts +10 -0
- package/dist/cli/commands/init.js +72 -0
- package/dist/cli.js +13 -1
- package/dist/config/config-file.d.ts +8 -0
- package/dist/config/config-file.js +141 -0
- package/dist/config/feature-flags.js +8 -0
- package/dist/console/assets/index-BZNM03t1.css +1 -0
- package/dist/console/assets/index-BwJelCXK.js +28 -0
- package/dist/console/index.html +2 -2
- package/dist/di/container.d.ts +1 -0
- package/dist/di/container.js +24 -7
- package/dist/infrastructure/session/HttpServer.d.ts +3 -4
- package/dist/infrastructure/session/HttpServer.js +58 -106
- package/dist/infrastructure/storage/caching-workflow-storage.d.ts +2 -0
- package/dist/infrastructure/storage/caching-workflow-storage.js +15 -6
- package/dist/infrastructure/storage/file-workflow-storage.js +3 -4
- package/dist/infrastructure/storage/schema-validating-workflow-storage.js +9 -8
- package/dist/manifest.json +303 -247
- package/dist/mcp/assert-output.d.ts +37 -0
- package/dist/mcp/assert-output.js +53 -0
- package/dist/mcp/boundary-coercion.d.ts +1 -0
- package/dist/mcp/boundary-coercion.js +44 -0
- package/dist/mcp/dev-mode.d.ts +2 -0
- package/dist/mcp/dev-mode.js +16 -0
- package/dist/mcp/handler-factory.d.ts +1 -1
- package/dist/mcp/handler-factory.js +20 -16
- package/dist/mcp/handlers/session.js +8 -9
- package/dist/mcp/handlers/shared/request-workflow-reader.d.ts +1 -0
- package/dist/mcp/handlers/shared/request-workflow-reader.js +90 -20
- package/dist/mcp/handlers/v2-advance-core/event-builders.d.ts +2 -0
- package/dist/mcp/handlers/v2-advance-core/event-builders.js +6 -6
- package/dist/mcp/handlers/v2-advance-core/index.d.ts +2 -0
- package/dist/mcp/handlers/v2-advance-core/index.js +4 -3
- package/dist/mcp/handlers/v2-advance-core/input-validation.d.ts +2 -0
- package/dist/mcp/handlers/v2-advance-core/input-validation.js +32 -9
- package/dist/mcp/handlers/v2-advance-core/outcome-blocked.d.ts +2 -0
- package/dist/mcp/handlers/v2-advance-core/outcome-blocked.js +1 -1
- package/dist/mcp/handlers/v2-advance-core/outcome-success.d.ts +2 -0
- package/dist/mcp/handlers/v2-advance-core/outcome-success.js +1 -1
- package/dist/mcp/handlers/v2-checkpoint.d.ts +1 -1
- package/dist/mcp/handlers/v2-checkpoint.js +5 -6
- package/dist/mcp/handlers/v2-execution/advance.d.ts +4 -2
- package/dist/mcp/handlers/v2-execution/advance.js +5 -7
- package/dist/mcp/handlers/v2-execution/continue-advance.d.ts +1 -0
- package/dist/mcp/handlers/v2-execution/continue-advance.js +59 -27
- package/dist/mcp/handlers/v2-execution/continue-rehydrate.d.ts +2 -1
- package/dist/mcp/handlers/v2-execution/continue-rehydrate.js +11 -10
- package/dist/mcp/handlers/v2-execution/index.js +2 -0
- package/dist/mcp/handlers/v2-execution/replay.d.ts +8 -4
- package/dist/mcp/handlers/v2-execution/replay.js +50 -30
- package/dist/mcp/handlers/v2-execution/start.d.ts +2 -3
- package/dist/mcp/handlers/v2-execution/start.js +58 -30
- package/dist/mcp/handlers/v2-execution/workflow-object-cache.d.ts +5 -0
- package/dist/mcp/handlers/v2-execution/workflow-object-cache.js +19 -0
- package/dist/mcp/handlers/v2-execution-helpers.d.ts +1 -0
- package/dist/mcp/handlers/v2-execution-helpers.js +23 -7
- package/dist/mcp/handlers/v2-resume.d.ts +1 -1
- package/dist/mcp/handlers/v2-resume.js +3 -4
- package/dist/mcp/handlers/v2-state-conversion.js +5 -1
- package/dist/mcp/handlers/v2-workflow.d.ts +80 -0
- package/dist/mcp/handlers/v2-workflow.js +40 -23
- package/dist/mcp/handlers/workflow.d.ts +2 -5
- package/dist/mcp/handlers/workflow.js +15 -12
- package/dist/mcp/output-schemas.d.ts +25 -27
- package/dist/mcp/output-schemas.js +7 -7
- package/dist/mcp/server.js +23 -4
- package/dist/mcp/tool-call-timing.d.ts +24 -0
- package/dist/mcp/tool-call-timing.js +85 -0
- package/dist/mcp/transports/http-entry.js +3 -2
- package/dist/mcp/transports/http-listener.d.ts +1 -0
- package/dist/mcp/transports/http-listener.js +25 -0
- package/dist/mcp/transports/shutdown-hooks.d.ts +4 -1
- package/dist/mcp/transports/shutdown-hooks.js +3 -2
- package/dist/mcp/transports/stdio-entry.js +6 -28
- package/dist/mcp/v2-response-formatter.d.ts +1 -1
- package/dist/mcp/v2-response-formatter.js +2 -5
- package/dist/mcp/validation/schema-introspection.d.ts +1 -0
- package/dist/mcp/validation/schema-introspection.js +15 -5
- package/dist/mcp/validation/suggestion-generator.js +2 -2
- package/dist/runtime/adapters/node-process-signals.d.ts +1 -0
- package/dist/runtime/adapters/node-process-signals.js +5 -0
- package/dist/runtime/adapters/noop-process-signals.d.ts +1 -0
- package/dist/runtime/adapters/noop-process-signals.js +2 -0
- package/dist/runtime/ports/process-signals.d.ts +1 -0
- package/dist/types/workflow-definition.d.ts +5 -1
- package/dist/types/workflow-definition.js +2 -0
- package/dist/types/workflow.d.ts +3 -0
- package/dist/types/workflow.js +35 -26
- package/dist/v2/durable-core/domain/context-template-resolver.js +2 -2
- package/dist/v2/durable-core/domain/function-definition-expander.js +2 -17
- package/dist/v2/durable-core/domain/prompt-renderer.d.ts +2 -0
- package/dist/v2/durable-core/domain/prompt-renderer.js +22 -18
- package/dist/v2/durable-core/domain/recap-recovery.js +23 -16
- package/dist/v2/durable-core/domain/retrieval-contract.js +13 -7
- package/dist/v2/durable-core/schemas/compiled-workflow/index.js +4 -3
- package/dist/v2/durable-core/session-index.d.ts +22 -0
- package/dist/v2/durable-core/session-index.js +58 -0
- package/dist/v2/durable-core/sorted-event-log.d.ts +6 -0
- package/dist/v2/durable-core/sorted-event-log.js +15 -0
- package/dist/v2/infra/local/fs/index.js +8 -8
- package/dist/v2/infra/local/pinned-workflow-store/index.d.ts +2 -0
- package/dist/v2/infra/local/pinned-workflow-store/index.js +49 -0
- package/dist/v2/infra/local/remembered-roots-store/index.d.ts +3 -1
- package/dist/v2/infra/local/remembered-roots-store/index.js +6 -3
- package/dist/v2/infra/local/session-store/index.d.ts +1 -1
- package/dist/v2/infra/local/session-store/index.js +71 -61
- package/dist/v2/infra/local/session-summary-provider/index.js +9 -4
- package/dist/v2/infra/local/snapshot-store/index.js +2 -1
- package/dist/v2/infra/local/workspace-anchor/index.js +4 -2
- package/dist/v2/ports/pinned-workflow-store.port.d.ts +2 -0
- package/dist/v2/ports/session-event-log-store.port.d.ts +1 -1
- package/dist/v2/projections/assessment-consequences.d.ts +2 -1
- package/dist/v2/projections/assessment-consequences.js +0 -5
- package/dist/v2/projections/assessments.d.ts +2 -1
- package/dist/v2/projections/assessments.js +2 -4
- package/dist/v2/projections/gaps.d.ts +2 -1
- package/dist/v2/projections/gaps.js +0 -5
- package/dist/v2/projections/preferences.d.ts +2 -1
- package/dist/v2/projections/preferences.js +0 -5
- package/dist/v2/projections/run-context.d.ts +2 -2
- package/dist/v2/projections/run-context.js +0 -5
- package/dist/v2/projections/run-dag.js +7 -1
- package/dist/v2/projections/run-execution-trace.d.ts +8 -0
- package/dist/v2/projections/run-execution-trace.js +124 -0
- package/dist/v2/projections/run-status-signals.d.ts +2 -2
- package/dist/v2/usecases/console-routes.d.ts +3 -1
- package/dist/v2/usecases/console-routes.js +124 -25
- package/dist/v2/usecases/console-service.d.ts +1 -0
- package/dist/v2/usecases/console-service.js +83 -25
- package/dist/v2/usecases/console-types.d.ts +53 -0
- package/dist/v2/usecases/worktree-service.js +32 -1
- package/package.json +6 -5
- package/spec/workflow.schema.json +18 -0
- package/workflows/adaptive-ticket-creation.json +23 -16
- package/workflows/architecture-scalability-audit.json +29 -22
- package/workflows/bug-investigation.agentic.v2.json +7 -0
- package/workflows/coding-task-workflow-agentic.json +7 -0
- package/workflows/coding-task-workflow-agentic.lean.v2.json +16 -8
- package/workflows/coding-task-workflow-agentic.v2.json +7 -0
- package/workflows/cross-platform-code-conversion.v2.json +7 -0
- package/workflows/document-creation-workflow.json +15 -8
- package/workflows/documentation-update-workflow.json +15 -8
- package/workflows/intelligent-test-case-generation.json +7 -0
- package/workflows/learner-centered-course-workflow.json +9 -2
- package/workflows/mr-review-workflow.agentic.v2.json +7 -0
- package/workflows/personal-learning-materials-creation-branched.json +15 -8
- package/workflows/presentation-creation.json +12 -5
- package/workflows/production-readiness-audit.json +7 -0
- package/workflows/relocation-workflow-us.json +39 -32
- package/workflows/scoped-documentation-workflow.json +33 -26
- package/workflows/ui-ux-design-workflow.json +7 -0
- package/workflows/workflow-diagnose-environment.json +6 -0
- package/workflows/workflow-for-workflows.json +7 -0
- package/workflows/workflow-for-workflows.v2.json +23 -11
- package/workflows/wr.discovery.json +8 -1
- package/dist/console/assets/index-BZYIjrzJ.js +0 -28
- package/dist/console/assets/index-OLCKbDdm.css +0 -1
- package/dist/mcp/handlers/v2-resolve-refs-envelope.d.ts +0 -5
- package/dist/mcp/handlers/v2-resolve-refs-envelope.js +0 -17
|
@@ -5,14 +5,28 @@ const neverthrow_1 = require("neverthrow");
|
|
|
5
5
|
const workflow_js_1 = require("../../../types/workflow.js");
|
|
6
6
|
const run_context_js_1 = require("../../../v2/projections/run-context.js");
|
|
7
7
|
const preferences_js_1 = require("../../../v2/projections/preferences.js");
|
|
8
|
+
const sorted_event_log_js_1 = require("../../../v2/durable-core/sorted-event-log.js");
|
|
8
9
|
const context_merge_js_1 = require("../../../v2/durable-core/domain/context-merge.js");
|
|
9
10
|
const constants_js_1 = require("../../../v2/durable-core/constants.js");
|
|
10
11
|
const assessment_validation_js_1 = require("./assessment-validation.js");
|
|
11
12
|
const assessment_consequences_js_1 = require("./assessment-consequences.js");
|
|
12
13
|
function validateAdvanceInputs(args) {
|
|
13
14
|
const { truth, runId, currentNodeId, inputContext, inputOutput, pinnedWorkflow, pendingStep } = args;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
let sortedEvents;
|
|
16
|
+
let storedContext;
|
|
17
|
+
if (args.precomputedIndex) {
|
|
18
|
+
sortedEvents = args.precomputedIndex.sortedEvents;
|
|
19
|
+
storedContext = args.precomputedIndex.runContextByRunId.get(String(runId));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const sortedEventsRes = (0, sorted_event_log_js_1.asSortedEventLog)(truth.events);
|
|
23
|
+
if (sortedEventsRes.isErr()) {
|
|
24
|
+
return (0, neverthrow_1.err)({ kind: 'invariant_violation', message: sortedEventsRes.error.message });
|
|
25
|
+
}
|
|
26
|
+
sortedEvents = sortedEventsRes.value;
|
|
27
|
+
const storedContextRes = (0, run_context_js_1.projectRunContextV2)(sortedEvents);
|
|
28
|
+
storedContext = storedContextRes.isOk() ? storedContextRes.value.byRunId[String(runId)]?.context : undefined;
|
|
29
|
+
}
|
|
16
30
|
const inputContextObj = inputContext && typeof inputContext === 'object' && inputContext !== null && !Array.isArray(inputContext)
|
|
17
31
|
? inputContext
|
|
18
32
|
: undefined;
|
|
@@ -39,14 +53,23 @@ function validateAdvanceInputs(args) {
|
|
|
39
53
|
const notesOptional = outputContract !== undefined ||
|
|
40
54
|
(step !== null && step !== undefined && 'notesOptional' in step && step.notesOptional === true);
|
|
41
55
|
const parentByNodeId = {};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
if (args.precomputedIndex) {
|
|
57
|
+
for (const [nodeId, evt] of args.precomputedIndex.nodeCreatedByNodeId) {
|
|
58
|
+
if (evt.scope.runId === String(runId)) {
|
|
59
|
+
parentByNodeId[nodeId] = evt.data.parentNodeId ?? null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
for (const e of truth.events) {
|
|
65
|
+
if (e.kind !== constants_js_1.EVENT_KIND.NODE_CREATED)
|
|
66
|
+
continue;
|
|
67
|
+
if (e.scope?.runId !== String(runId))
|
|
68
|
+
continue;
|
|
69
|
+
parentByNodeId[String(e.scope.nodeId)] = e.data.parentNodeId;
|
|
70
|
+
}
|
|
48
71
|
}
|
|
49
|
-
const prefs = (0, preferences_js_1.projectPreferencesV2)(
|
|
72
|
+
const prefs = (0, preferences_js_1.projectPreferencesV2)(sortedEvents, parentByNodeId);
|
|
50
73
|
const effectivePrefs = prefs.isOk() ? prefs.value.byNodeId[String(currentNodeId)]?.effective : undefined;
|
|
51
74
|
const rawAutonomy = effectivePrefs?.autonomy ?? 'guided';
|
|
52
75
|
const rawRiskPolicy = effectivePrefs?.riskPolicy ?? 'conservative';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ResultAsync as RA } from 'neverthrow';
|
|
2
|
+
import type { SessionIndex } from '../../../v2/durable-core/session-index.js';
|
|
2
3
|
import type { ExecutionSnapshotFileV1 } from '../../../v2/durable-core/schemas/execution-snapshot/index.js';
|
|
3
4
|
import type { SessionEventLogStoreError } from '../../../v2/ports/session-event-log-store.port.js';
|
|
4
5
|
import type { SnapshotStoreError } from '../../../v2/ports/snapshot-store.port.js';
|
|
@@ -15,4 +16,5 @@ export declare function buildBlockedOutcome(args: {
|
|
|
15
16
|
readonly v: ValidatedAdvanceInputs;
|
|
16
17
|
readonly lock: WithHealthySessionLock;
|
|
17
18
|
readonly ports: AdvanceCorePorts;
|
|
19
|
+
readonly lockedIndex: SessionIndex;
|
|
18
20
|
}): RA<void, InternalError | SessionEventLogStoreError | SnapshotStoreError>;
|
|
@@ -102,7 +102,7 @@ function buildBlockedOutcome(args) {
|
|
|
102
102
|
return snapshotStore.putExecutionSnapshotV1(blockedSnapshotRes.value).andThen((blockedSnapshotRef) => {
|
|
103
103
|
return (0, event_builders_js_1.buildAndAppendPlan)({
|
|
104
104
|
kind: 'blocked',
|
|
105
|
-
truth, sessionId, runId, currentNodeId, attemptId, workflowHash,
|
|
105
|
+
truth, lockedIndex: args.lockedIndex, sessionId, runId, currentNodeId, attemptId, workflowHash,
|
|
106
106
|
extraEventsToAppend, blockers: blockersRes.value, snapshotRef: blockedSnapshotRef,
|
|
107
107
|
outputsToAppend,
|
|
108
108
|
sessionStore, idFactory, lock,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ResultAsync as RA } from 'neverthrow';
|
|
2
|
+
import type { SessionIndex } from '../../../v2/durable-core/session-index.js';
|
|
2
3
|
import type { SessionEventLogStoreError } from '../../../v2/ports/session-event-log-store.port.js';
|
|
3
4
|
import type { SnapshotStoreError } from '../../../v2/ports/snapshot-store.port.js';
|
|
4
5
|
import type { WithHealthySessionLock } from '../../../v2/durable-core/ids/with-healthy-session-lock.js';
|
|
@@ -12,4 +13,5 @@ export declare function buildSuccessOutcome(args: {
|
|
|
12
13
|
readonly v: ValidatedAdvanceInputs;
|
|
13
14
|
readonly lock: WithHealthySessionLock;
|
|
14
15
|
readonly ports: AdvanceCorePorts;
|
|
16
|
+
readonly lockedIndex: SessionIndex;
|
|
15
17
|
}): RA<void, InternalError | SessionEventLogStoreError | SnapshotStoreError>;
|
|
@@ -149,7 +149,7 @@ function buildSuccessOutcome(args) {
|
|
|
149
149
|
const outputsToAppend = [...notesOutputs, ...artifactOutputsRes.value];
|
|
150
150
|
return (0, event_builders_js_1.buildAndAppendPlan)({
|
|
151
151
|
kind: 'advanced',
|
|
152
|
-
truth, sessionId, runId, currentNodeId, attemptId, workflowHash,
|
|
152
|
+
truth, lockedIndex: args.lockedIndex, sessionId, runId, currentNodeId, attemptId, workflowHash,
|
|
153
153
|
extraEventsToAppend, toNodeKind: successNodeKind(mode),
|
|
154
154
|
snapshotRef: newSnapshotRef, outputsToAppend,
|
|
155
155
|
sessionStore, idFactory, lock,
|
|
@@ -2,7 +2,7 @@ import type { z } from 'zod';
|
|
|
2
2
|
import type { ResultAsync as RA } from 'neverthrow';
|
|
3
3
|
import type { ToolContext, ToolResult, V2ToolContext } from '../types.js';
|
|
4
4
|
import type { V2CheckpointWorkflowInput } from '../v2/tools.js';
|
|
5
|
-
import { V2CheckpointWorkflowOutputSchema } from '../output-schemas.js';
|
|
5
|
+
import type { V2CheckpointWorkflowOutputSchema } from '../output-schemas.js';
|
|
6
6
|
import { type ToolFailure } from './v2-execution-helpers.js';
|
|
7
7
|
import type { ExecutionSessionGateErrorV2 } from '../../v2/usecases/execution-session-gate.js';
|
|
8
8
|
import type { SessionEventLogStoreError } from '../../v2/ports/session-event-log-store.port.js';
|
|
@@ -4,7 +4,6 @@ exports.handleV2CheckpointWorkflow = handleV2CheckpointWorkflow;
|
|
|
4
4
|
exports.executeCheckpoint = executeCheckpoint;
|
|
5
5
|
const neverthrow_1 = require("neverthrow");
|
|
6
6
|
const types_js_1 = require("../types.js");
|
|
7
|
-
const output_schemas_js_1 = require("../output-schemas.js");
|
|
8
7
|
const v2_token_ops_js_1 = require("./v2-token-ops.js");
|
|
9
8
|
const v2_execution_helpers_js_1 = require("./v2-execution-helpers.js");
|
|
10
9
|
const index_js_1 = require("../../v2/durable-core/ids/index.js");
|
|
@@ -107,11 +106,11 @@ function replayCheckpoint(events, dedupeKey, originalNode, sessionId, runId, nod
|
|
|
107
106
|
.andThen((resumeTokenValue) => (0, v2_token_ops_js_1.mintContinueAndCheckpointTokens)({
|
|
108
107
|
entry: { sessionId: String(sessionId), runId: String(runId), nodeId: String(nodeId), attemptId: String(attemptId), workflowHashRef },
|
|
109
108
|
ports: tokenCodecPorts, aliasStore, entropy,
|
|
110
|
-
}).andThen(({ continueToken }) => (0, neverthrow_1.okAsync)(
|
|
109
|
+
}).andThen(({ continueToken }) => (0, neverthrow_1.okAsync)({
|
|
111
110
|
checkpointNodeId,
|
|
112
111
|
resumeToken: resumeTokenValue,
|
|
113
112
|
nextCall: { tool: 'continue_workflow', params: { continueToken } },
|
|
114
|
-
})))
|
|
113
|
+
})))
|
|
115
114
|
.mapErr((e) => ({ kind: 'store_failed', cause: e }));
|
|
116
115
|
}
|
|
117
116
|
function writeCheckpoint(truth, dedupeKey, originalNode, sessionId, runId, nodeId, attemptId, checkpointNodeId, mintEventId, lock, sessionStore, tokenCodecPorts, aliasStore, entropy) {
|
|
@@ -161,7 +160,7 @@ function writeCheckpoint(truth, dedupeKey, originalNode, sessionId, runId, nodeI
|
|
|
161
160
|
eventIndex: truth.events.length,
|
|
162
161
|
createdByEventId: nodeCreatedEventId,
|
|
163
162
|
}];
|
|
164
|
-
return sessionStore.append(lock, { events: validated, snapshotPins })
|
|
163
|
+
return sessionStore.append(lock, { events: validated, snapshotPins }, truth)
|
|
165
164
|
.mapErr((cause) => ({ kind: 'store_failed', cause }))
|
|
166
165
|
.andThen(() => {
|
|
167
166
|
const workflowHashRefRes = (0, workflow_hash_ref_js_1.deriveWorkflowHashRef)(originalNode.data.workflowHash);
|
|
@@ -170,11 +169,11 @@ function writeCheckpoint(truth, dedupeKey, originalNode, sessionId, runId, nodeI
|
|
|
170
169
|
.andThen((resumeTokenValue) => (0, v2_token_ops_js_1.mintContinueAndCheckpointTokens)({
|
|
171
170
|
entry: { sessionId: String(sessionId), runId: String(runId), nodeId: String(nodeId), attemptId: String(attemptId), workflowHashRef },
|
|
172
171
|
ports: tokenCodecPorts, aliasStore, entropy,
|
|
173
|
-
}).andThen(({ continueToken }) => (0, neverthrow_1.okAsync)(
|
|
172
|
+
}).andThen(({ continueToken }) => (0, neverthrow_1.okAsync)({
|
|
174
173
|
checkpointNodeId: String(checkpointNodeId),
|
|
175
174
|
resumeToken: resumeTokenValue,
|
|
176
175
|
nextCall: { tool: 'continue_workflow', params: { continueToken } },
|
|
177
|
-
})))
|
|
176
|
+
})))
|
|
178
177
|
.mapErr((e) => ({ kind: 'store_failed', cause: e }));
|
|
179
178
|
});
|
|
180
179
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { V2ContinueWorkflowInput } from '../../v2/tools.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { SessionIndex } from '../../../v2/durable-core/session-index.js';
|
|
3
|
+
import type { Workflow } from '../../../types/workflow.js';
|
|
3
4
|
import { type AttemptId } from '../../../v2/durable-core/tokens/index.js';
|
|
4
5
|
import { type SessionId, type RunId, type NodeId, type WorkflowHash } from '../../../v2/durable-core/ids/index.js';
|
|
5
6
|
import type { LoadedSessionTruthV2 } from '../../../v2/ports/session-event-log-store.port.js';
|
|
@@ -21,7 +22,7 @@ export declare function advanceAndRecord(args: {
|
|
|
21
22
|
readonly inputContext: JsonValue | undefined;
|
|
22
23
|
readonly inputOutput: V2ContinueWorkflowInput['output'];
|
|
23
24
|
readonly lock: WithHealthySessionLock;
|
|
24
|
-
readonly pinnedWorkflow:
|
|
25
|
+
readonly pinnedWorkflow: Workflow;
|
|
25
26
|
readonly snapshotStore: import('../../../v2/ports/snapshot-store.port.js').SnapshotStorePortV2;
|
|
26
27
|
readonly sessionStore: import('../../../v2/ports/session-event-log-store.port.js').SessionEventLogAppendStorePortV2 & import('../../../v2/ports/session-event-log-store.port.js').SessionEventLogReadonlyStorePortV2;
|
|
27
28
|
readonly sha256: Sha256PortV2;
|
|
@@ -29,4 +30,5 @@ export declare function advanceAndRecord(args: {
|
|
|
29
30
|
readonly mintNodeId: () => NodeId;
|
|
30
31
|
readonly mintEventId: () => string;
|
|
31
32
|
};
|
|
33
|
+
readonly lockedIndex: SessionIndex;
|
|
32
34
|
}): RA<void, InternalError | SessionEventLogStoreError | SnapshotStoreError>;
|
|
@@ -3,18 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.advanceAndRecord = advanceAndRecord;
|
|
4
4
|
const neverthrow_1 = require("neverthrow");
|
|
5
5
|
const v2_advance_core_js_1 = require("../v2-advance-core.js");
|
|
6
|
-
const constants_js_1 = require("../../../v2/durable-core/constants.js");
|
|
7
6
|
function advanceAndRecord(args) {
|
|
8
7
|
const { truth, sessionId, runId, nodeId, attemptId, workflowHash, dedupeKey, inputContext, inputOutput, lock, pinnedWorkflow, snapshotStore, sessionStore, sha256, idFactory } = args;
|
|
9
|
-
const hasRun =
|
|
10
|
-
const
|
|
8
|
+
const hasRun = args.lockedIndex.runStartedByRunId.has(String(runId));
|
|
9
|
+
const nodeCreated = args.lockedIndex.nodeCreatedByNodeId.get(String(nodeId));
|
|
10
|
+
const hasNode = nodeCreated !== undefined;
|
|
11
11
|
if (!hasRun || !hasNode) {
|
|
12
12
|
return (0, neverthrow_1.errAsync)({ kind: 'missing_node_or_run' });
|
|
13
13
|
}
|
|
14
|
-
const nodeCreated = truth.events.find((e) => e.kind === constants_js_1.EVENT_KIND.NODE_CREATED && e.scope?.nodeId === String(nodeId));
|
|
15
|
-
if (!nodeCreated) {
|
|
16
|
-
return (0, neverthrow_1.errAsync)({ kind: 'missing_node_or_run' });
|
|
17
|
-
}
|
|
18
14
|
if (String(nodeCreated.data.workflowHash) !== String(workflowHash)) {
|
|
19
15
|
return (0, neverthrow_1.errAsync)({ kind: 'workflow_hash_mismatch' });
|
|
20
16
|
}
|
|
@@ -38,6 +34,7 @@ function advanceAndRecord(args) {
|
|
|
38
34
|
truth, sessionId, runId, attemptId, workflowHash, dedupeKey,
|
|
39
35
|
inputContext, inputOutput, lock, pinnedWorkflow,
|
|
40
36
|
ports: { snapshotStore, sessionStore, sha256, idFactory },
|
|
37
|
+
lockedIndex: args.lockedIndex,
|
|
41
38
|
});
|
|
42
39
|
}
|
|
43
40
|
return (0, v2_advance_core_js_1.executeAdvanceCore)({
|
|
@@ -45,6 +42,7 @@ function advanceAndRecord(args) {
|
|
|
45
42
|
truth, sessionId, runId, attemptId, workflowHash, dedupeKey,
|
|
46
43
|
inputContext, inputOutput, lock, pinnedWorkflow,
|
|
47
44
|
ports: { snapshotStore, sessionStore, sha256, idFactory },
|
|
45
|
+
lockedIndex: args.lockedIndex,
|
|
48
46
|
});
|
|
49
47
|
});
|
|
50
48
|
}
|
|
@@ -28,4 +28,5 @@ export declare function handleAdvanceIntent(args: {
|
|
|
28
28
|
readonly sha256: Sha256PortV2;
|
|
29
29
|
readonly aliasStore: import('../../../v2/ports/token-alias-store.port.js').TokenAliasStorePortV2;
|
|
30
30
|
readonly entropy: import('../../../v2/ports/random-entropy.port.js').RandomEntropyPortV2;
|
|
31
|
+
readonly cleanResponseFormat?: boolean;
|
|
31
32
|
}): RA<z.infer<typeof V2ContinueWorkflowOutputSchema>, ContinueWorkflowError>;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handleAdvanceIntent = handleAdvanceIntent;
|
|
4
|
-
const
|
|
4
|
+
const workflow_object_cache_js_1 = require("./workflow-object-cache.js");
|
|
5
5
|
const workflow_hash_ref_js_1 = require("../../../v2/durable-core/ids/workflow-hash-ref.js");
|
|
6
6
|
const neverthrow_1 = require("neverthrow");
|
|
7
|
-
const workflow_source_js_1 = require("../../../types/workflow-source.js");
|
|
8
7
|
const workflow_definition_js_1 = require("../../../types/workflow-definition.js");
|
|
9
8
|
const v2_error_mapping_js_1 = require("../v2-error-mapping.js");
|
|
10
|
-
const constants_js_1 = require("../../../v2/durable-core/constants.js");
|
|
11
9
|
const replay_js_1 = require("./replay.js");
|
|
12
10
|
const advance_js_1 = require("./advance.js");
|
|
11
|
+
const sorted_event_log_js_1 = require("../../../v2/durable-core/sorted-event-log.js");
|
|
12
|
+
const session_index_js_1 = require("../../../v2/durable-core/session-index.js");
|
|
13
13
|
function handleAdvanceIntent(args) {
|
|
14
|
-
const { input, sessionId, runId, nodeId, attemptId, workflowHashRef, truth, gate, sessionStore, snapshotStore, pinnedStore, tokenCodecPorts, idFactory, sha256, aliasStore, entropy } = args;
|
|
14
|
+
const { input, sessionId, runId, nodeId, attemptId, workflowHashRef, truth, gate, sessionStore, snapshotStore, pinnedStore, tokenCodecPorts, idFactory, sha256, aliasStore, entropy, cleanResponseFormat } = args;
|
|
15
15
|
const dedupeKey = `advance_recorded:${sessionId}:${nodeId}:${attemptId}`;
|
|
16
|
-
const
|
|
16
|
+
const preLockSortedResult = (0, sorted_event_log_js_1.asSortedEventLog)(truth.events);
|
|
17
|
+
if (preLockSortedResult.isErr()) {
|
|
18
|
+
return (0, neverthrow_1.errAsync)({
|
|
19
|
+
kind: 'invariant_violation',
|
|
20
|
+
message: `Session events are not sorted: ${preLockSortedResult.error.message}`,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const preLockIndex = (0, session_index_js_1.buildSessionIndex)(preLockSortedResult.value);
|
|
24
|
+
const runStarted = preLockIndex.runStartedByRunId.get(String(runId));
|
|
17
25
|
if (!runStarted) {
|
|
18
26
|
return (0, neverthrow_1.errAsync)({
|
|
19
27
|
kind: 'token_unknown_node',
|
|
@@ -37,7 +45,7 @@ function handleAdvanceIntent(args) {
|
|
|
37
45
|
suggestion: 'Use the continueToken returned by WorkRail for this run.',
|
|
38
46
|
});
|
|
39
47
|
}
|
|
40
|
-
const nodeCreated =
|
|
48
|
+
const nodeCreated = preLockIndex.nodeCreatedByNodeId.get(String(nodeId));
|
|
41
49
|
if (!nodeCreated) {
|
|
42
50
|
return (0, neverthrow_1.errAsync)({
|
|
43
51
|
kind: 'token_unknown_node',
|
|
@@ -45,22 +53,24 @@ function handleAdvanceIntent(args) {
|
|
|
45
53
|
suggestion: 'Use tokens returned by WorkRail for an existing node.',
|
|
46
54
|
});
|
|
47
55
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
if (nodeCreated.data.workflowHash !== workflowHash) {
|
|
57
|
+
const nodeRefRes = (0, workflow_hash_ref_js_1.deriveWorkflowHashRef)(nodeCreated.data.workflowHash);
|
|
58
|
+
if (nodeRefRes.isErr()) {
|
|
59
|
+
return (0, neverthrow_1.errAsync)({
|
|
60
|
+
kind: 'precondition_failed',
|
|
61
|
+
message: nodeRefRes.error.message,
|
|
62
|
+
suggestion: 'Re-pin the workflow via start_workflow.',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (String(nodeRefRes.value) !== String(workflowHashRef)) {
|
|
66
|
+
return (0, neverthrow_1.errAsync)({
|
|
67
|
+
kind: 'precondition_failed',
|
|
68
|
+
message: 'workflowHash mismatch for this node.',
|
|
69
|
+
suggestion: 'Use the continueToken returned by WorkRail for this node.',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
62
72
|
}
|
|
63
|
-
const existing =
|
|
73
|
+
const existing = preLockIndex.advanceRecordedByDedupeKey.get(dedupeKey);
|
|
64
74
|
return pinnedStore.get(workflowHash)
|
|
65
75
|
.mapErr((cause) => ({ kind: 'pinned_workflow_store_failed', cause }))
|
|
66
76
|
.andThen((compiled) => {
|
|
@@ -75,7 +85,7 @@ function handleAdvanceIntent(args) {
|
|
|
75
85
|
suggestion: 'Re-pin the workflow via start_workflow.',
|
|
76
86
|
});
|
|
77
87
|
}
|
|
78
|
-
const pinnedWorkflow = (0,
|
|
88
|
+
const pinnedWorkflow = (0, workflow_object_cache_js_1.getCachedWorkflow)(workflowHash, compiled.definition);
|
|
79
89
|
if (existing) {
|
|
80
90
|
return (0, replay_js_1.replayFromRecordedAdvance)({
|
|
81
91
|
recordedEvent: existing,
|
|
@@ -91,13 +101,22 @@ function handleAdvanceIntent(args) {
|
|
|
91
101
|
tokenCodecPorts,
|
|
92
102
|
aliasStore,
|
|
93
103
|
entropy,
|
|
104
|
+
cleanResponseFormat,
|
|
94
105
|
});
|
|
95
106
|
}
|
|
96
107
|
return gate
|
|
97
108
|
.withHealthySessionLock(sessionId, (lock) => sessionStore.load(sessionId).andThen((truthLocked) => {
|
|
98
|
-
const
|
|
109
|
+
const lockedSortedResult = (0, sorted_event_log_js_1.asSortedEventLog)(truthLocked.events);
|
|
110
|
+
if (lockedSortedResult.isErr()) {
|
|
111
|
+
return (0, neverthrow_1.errAsync)({
|
|
112
|
+
kind: 'invariant_violation',
|
|
113
|
+
message: `Locked session events are not sorted: ${lockedSortedResult.error.message}`,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const lockedIndex = (0, session_index_js_1.buildSessionIndex)(lockedSortedResult.value);
|
|
117
|
+
const existingLocked = lockedIndex.advanceRecordedByDedupeKey.get(dedupeKey);
|
|
99
118
|
if (existingLocked)
|
|
100
|
-
return (0, neverthrow_1.okAsync)({ kind: 'replay', truth: truthLocked, recordedEvent: existingLocked });
|
|
119
|
+
return (0, neverthrow_1.okAsync)({ kind: 'replay', truth: truthLocked, recordedEvent: existingLocked, precomputedIndex: lockedIndex });
|
|
101
120
|
return (0, advance_js_1.advanceAndRecord)({
|
|
102
121
|
truth: truthLocked,
|
|
103
122
|
sessionId,
|
|
@@ -114,9 +133,21 @@ function handleAdvanceIntent(args) {
|
|
|
114
133
|
sessionStore,
|
|
115
134
|
sha256,
|
|
116
135
|
idFactory,
|
|
136
|
+
lockedIndex,
|
|
117
137
|
}).andThen(() => sessionStore
|
|
118
138
|
.load(sessionId)
|
|
119
|
-
.
|
|
139
|
+
.andThen((truthAfter) => {
|
|
140
|
+
const afterSortedResult = (0, sorted_event_log_js_1.asSortedEventLog)(truthAfter.events);
|
|
141
|
+
if (afterSortedResult.isErr()) {
|
|
142
|
+
return (0, neverthrow_1.errAsync)({
|
|
143
|
+
kind: 'invariant_violation',
|
|
144
|
+
message: `Post-advance session events are not sorted: ${afterSortedResult.error.message}`,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
const index2 = (0, session_index_js_1.buildSessionIndex)(afterSortedResult.value);
|
|
148
|
+
const recordedEvent = index2.advanceRecordedByDedupeKey.get(dedupeKey) ?? null;
|
|
149
|
+
return (0, neverthrow_1.okAsync)({ kind: 'replay', truth: truthAfter, recordedEvent, precomputedIndex: index2 });
|
|
150
|
+
}));
|
|
120
151
|
}))
|
|
121
152
|
.mapErr((cause) => {
|
|
122
153
|
if ((0, v2_error_mapping_js_1.isInternalError)(cause)) {
|
|
@@ -146,8 +177,7 @@ function handleAdvanceIntent(args) {
|
|
|
146
177
|
})
|
|
147
178
|
.andThen((res) => {
|
|
148
179
|
const truth2 = res.truth;
|
|
149
|
-
const recordedEvent = res.recordedEvent
|
|
150
|
-
truth2.events.find((e) => e.kind === constants_js_1.EVENT_KIND.ADVANCE_RECORDED && e.dedupeKey === dedupeKey);
|
|
180
|
+
const recordedEvent = res.recordedEvent;
|
|
151
181
|
if (!recordedEvent) {
|
|
152
182
|
return (0, neverthrow_1.errAsync)({
|
|
153
183
|
kind: 'invariant_violation',
|
|
@@ -157,6 +187,7 @@ function handleAdvanceIntent(args) {
|
|
|
157
187
|
return (0, replay_js_1.replayFromRecordedAdvance)({
|
|
158
188
|
recordedEvent,
|
|
159
189
|
truth: truth2,
|
|
190
|
+
precomputedIndex: res.precomputedIndex,
|
|
160
191
|
sessionId,
|
|
161
192
|
runId,
|
|
162
193
|
nodeId,
|
|
@@ -168,6 +199,7 @@ function handleAdvanceIntent(args) {
|
|
|
168
199
|
tokenCodecPorts,
|
|
169
200
|
aliasStore,
|
|
170
201
|
entropy,
|
|
202
|
+
cleanResponseFormat,
|
|
171
203
|
});
|
|
172
204
|
});
|
|
173
205
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { V2ContinueWorkflowInput } from '../../v2/tools.js';
|
|
2
|
-
import { V2ContinueWorkflowOutputSchema } from '../../output-schemas.js';
|
|
2
|
+
import type { V2ContinueWorkflowOutputSchema } from '../../output-schemas.js';
|
|
3
3
|
import { type SessionId, type RunId, type NodeId } from '../../../v2/durable-core/ids/index.js';
|
|
4
4
|
import type { LoadedSessionTruthV2 } from '../../../v2/ports/session-event-log-store.port.js';
|
|
5
5
|
import type { TokenCodecPorts } from '../../../v2/durable-core/tokens/token-codec-ports.js';
|
|
@@ -27,4 +27,5 @@ export declare function handleRehydrateIntent(args: {
|
|
|
27
27
|
readonly aliasStore: import('../../../v2/ports/token-alias-store.port.js').TokenAliasStorePortV2;
|
|
28
28
|
readonly entropy: import('../../../v2/ports/random-entropy.port.js').RandomEntropyPortV2;
|
|
29
29
|
readonly resolvedRootUris?: readonly string[];
|
|
30
|
+
readonly cleanResponseFormat?: boolean;
|
|
30
31
|
}): RA<RehydrateResult, ContinueWorkflowError>;
|
|
@@ -6,11 +6,10 @@ const binding_drift_js_1 = require("../../../v2/durable-core/domain/binding-drif
|
|
|
6
6
|
const binding_registry_js_1 = require("../../../application/services/compiler/binding-registry.js");
|
|
7
7
|
const v2_workspace_resolution_js_1 = require("../v2-workspace-resolution.js");
|
|
8
8
|
const snapshot_state_js_1 = require("../../../v2/durable-core/projections/snapshot-state.js");
|
|
9
|
-
const
|
|
9
|
+
const workflow_object_cache_js_1 = require("./workflow-object-cache.js");
|
|
10
10
|
const index_js_1 = require("../../../v2/durable-core/ids/index.js");
|
|
11
11
|
const workflow_hash_ref_js_1 = require("../../../v2/durable-core/ids/workflow-hash-ref.js");
|
|
12
12
|
const neverthrow_1 = require("neverthrow");
|
|
13
|
-
const workflow_source_js_1 = require("../../../types/workflow-source.js");
|
|
14
13
|
const workflow_definition_js_1 = require("../../../types/workflow-definition.js");
|
|
15
14
|
const v2_execution_helpers_js_1 = require("../v2-execution-helpers.js");
|
|
16
15
|
const prompt_renderer_js_1 = require("../../../v2/durable-core/domain/prompt-renderer.js");
|
|
@@ -19,8 +18,9 @@ const v2_state_conversion_js_1 = require("../v2-state-conversion.js");
|
|
|
19
18
|
const constants_js_1 = require("../../../v2/durable-core/constants.js");
|
|
20
19
|
const index_js_2 = require("./index.js");
|
|
21
20
|
const step_content_envelope_js_1 = require("../../step-content-envelope.js");
|
|
21
|
+
const assert_output_js_1 = require("../../assert-output.js");
|
|
22
22
|
function handleRehydrateIntent(args) {
|
|
23
|
-
const { input, sessionId, runId, nodeId, workflowHashRef, truth, tokenCodecPorts, pinnedStore, snapshotStore, idFactory, aliasStore, entropy, resolvedRootUris } = args;
|
|
23
|
+
const { input, sessionId, runId, nodeId, workflowHashRef, truth, tokenCodecPorts, pinnedStore, snapshotStore, idFactory, aliasStore, entropy, resolvedRootUris, cleanResponseFormat } = args;
|
|
24
24
|
const runStarted = truth.events.find((e) => e.kind === constants_js_1.EVENT_KIND.RUN_STARTED && e.scope.runId === String(runId));
|
|
25
25
|
const workflowId = runStarted?.data.workflowId;
|
|
26
26
|
if (!runStarted || typeof workflowId !== 'string' || workflowId.trim() === '') {
|
|
@@ -93,15 +93,15 @@ function handleRehydrateIntent(args) {
|
|
|
93
93
|
if (!pending) {
|
|
94
94
|
const preferences = (0, v2_execution_helpers_js_1.derivePreferencesOrDefault)({ truth, runId, nodeId });
|
|
95
95
|
const nextIntent = (0, v2_state_conversion_js_1.deriveNextIntent)({ rehydrateOnly: true, isComplete, pending: null });
|
|
96
|
-
const parsed =
|
|
96
|
+
const parsed = (0, assert_output_js_1.assertOutput)({
|
|
97
97
|
kind: 'ok',
|
|
98
98
|
isComplete,
|
|
99
99
|
pending: null,
|
|
100
100
|
preferences,
|
|
101
101
|
nextIntent,
|
|
102
102
|
nextCall: null,
|
|
103
|
-
...(driftWarnings.length > 0 ? { warnings: driftWarnings } : {}),
|
|
104
|
-
});
|
|
103
|
+
...(driftWarnings.length > 0 ? { warnings: [...driftWarnings] } : {}),
|
|
104
|
+
}, assert_output_js_1.assertContinueTokenPresence);
|
|
105
105
|
return (0, neverthrow_1.okAsync)({ response: parsed });
|
|
106
106
|
}
|
|
107
107
|
const attemptId = (0, v2_token_ops_js_1.newAttemptId)(idFactory);
|
|
@@ -115,7 +115,7 @@ function handleRehydrateIntent(args) {
|
|
|
115
115
|
return (0, v2_token_ops_js_1.mintContinueAndCheckpointTokens)({ entry: entryBase, ports: tokenCodecPorts, aliasStore, entropy })
|
|
116
116
|
.mapErr((failure) => ({ kind: 'token_signing_failed', cause: failure }))
|
|
117
117
|
.andThen(({ continueToken: continueTokenValue, checkpointToken: checkpointTokenValue }) => {
|
|
118
|
-
const wf = (0,
|
|
118
|
+
const wf = (0, workflow_object_cache_js_1.getCachedWorkflow)(workflowHash, pinned.definition);
|
|
119
119
|
const metaRes = (0, prompt_renderer_js_1.renderPendingPrompt)({
|
|
120
120
|
workflow: wf,
|
|
121
121
|
stepId: String(pending.stepId),
|
|
@@ -124,6 +124,7 @@ function handleRehydrateIntent(args) {
|
|
|
124
124
|
runId: (0, index_js_1.asRunId)(String(runId)),
|
|
125
125
|
nodeId: (0, index_js_1.asNodeId)(String(nodeId)),
|
|
126
126
|
rehydrateOnly: true,
|
|
127
|
+
cleanResponseFormat,
|
|
127
128
|
});
|
|
128
129
|
if (metaRes.isErr()) {
|
|
129
130
|
return (0, neverthrow_1.errAsync)({
|
|
@@ -138,7 +139,7 @@ function handleRehydrateIntent(args) {
|
|
|
138
139
|
meta,
|
|
139
140
|
references: pinned.resolvedReferences ?? buildPinnedReferencesFallback(pinned.definition.references ?? []),
|
|
140
141
|
});
|
|
141
|
-
const parsed =
|
|
142
|
+
const parsed = (0, assert_output_js_1.assertOutput)({
|
|
142
143
|
kind: 'ok',
|
|
143
144
|
continueToken: continueTokenValue,
|
|
144
145
|
checkpointToken: checkpointTokenValue,
|
|
@@ -147,8 +148,8 @@ function handleRehydrateIntent(args) {
|
|
|
147
148
|
preferences,
|
|
148
149
|
nextIntent,
|
|
149
150
|
nextCall: (0, index_js_2.buildNextCall)({ continueToken: continueTokenValue, isComplete, pending: meta }),
|
|
150
|
-
...(driftWarnings.length > 0 ? { warnings: driftWarnings } : {}),
|
|
151
|
-
});
|
|
151
|
+
...(driftWarnings.length > 0 ? { warnings: [...driftWarnings] } : {}),
|
|
152
|
+
}, assert_output_js_1.assertContinueTokenPresence);
|
|
152
153
|
return (0, neverthrow_1.okAsync)({ response: parsed, contentEnvelope });
|
|
153
154
|
});
|
|
154
155
|
});
|
|
@@ -75,6 +75,7 @@ function loadAndRehydrate(args) {
|
|
|
75
75
|
aliasStore: tokenAliasStore,
|
|
76
76
|
entropy,
|
|
77
77
|
resolvedRootUris: args.ctx.v2.resolvedRootUris,
|
|
78
|
+
cleanResponseFormat: args.ctx.featureFlags?.isEnabled('cleanResponseFormat') ?? false,
|
|
78
79
|
}));
|
|
79
80
|
}
|
|
80
81
|
function executeContinueWorkflow(input, ctx) {
|
|
@@ -140,6 +141,7 @@ function executeContinueWorkflow(input, ctx) {
|
|
|
140
141
|
sha256,
|
|
141
142
|
aliasStore: tokenAliasStore,
|
|
142
143
|
entropy,
|
|
144
|
+
cleanResponseFormat: ctx.featureFlags?.isEnabled('cleanResponseFormat') ?? false,
|
|
143
145
|
}))
|
|
144
146
|
.map((response) => ({ response }));
|
|
145
147
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { V2ContinueWorkflowOutputSchema } from '../../output-schemas.js';
|
|
1
|
+
import type { V2ContinueWorkflowOutputSchema } from '../../output-schemas.js';
|
|
2
2
|
import type { ExecutionSnapshotFileV1 } from '../../../v2/durable-core/schemas/execution-snapshot/index.js';
|
|
3
3
|
import { type AttemptId } from '../../../v2/durable-core/tokens/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import type { Workflow } from '../../../types/workflow.js';
|
|
5
5
|
import type { DomainEventV1 } from '../../../v2/durable-core/schemas/session/index.js';
|
|
6
6
|
import { type SessionId, type RunId, type NodeId, type WorkflowHash } from '../../../v2/durable-core/ids/index.js';
|
|
7
7
|
import type { LoadedSessionTruthV2 } from '../../../v2/ports/session-event-log-store.port.js';
|
|
@@ -17,13 +17,15 @@ export declare function buildAdvancedReplayResponse(args: {
|
|
|
17
17
|
readonly toNodeId: NodeId;
|
|
18
18
|
readonly attemptId: AttemptId;
|
|
19
19
|
readonly toSnapshot: ExecutionSnapshotFileV1;
|
|
20
|
-
readonly workflow:
|
|
20
|
+
readonly workflow: Workflow;
|
|
21
21
|
readonly truth: LoadedSessionTruthV2;
|
|
22
22
|
readonly workflowHash: WorkflowHash;
|
|
23
23
|
readonly ports: TokenCodecPorts;
|
|
24
24
|
readonly sha256: Sha256PortV2;
|
|
25
25
|
readonly aliasStore: import('../../../v2/ports/token-alias-store.port.js').TokenAliasStorePortV2;
|
|
26
26
|
readonly entropy: import('../../../v2/ports/random-entropy.port.js').RandomEntropyPortV2;
|
|
27
|
+
readonly precomputedIndex?: import('../../../v2/durable-core/session-index.js').SessionIndex;
|
|
28
|
+
readonly cleanResponseFormat?: boolean;
|
|
27
29
|
}): RA<z.infer<typeof V2ContinueWorkflowOutputSchema>, ContinueWorkflowError>;
|
|
28
30
|
export declare function replayFromRecordedAdvance(args: {
|
|
29
31
|
readonly recordedEvent: Extract<DomainEventV1, {
|
|
@@ -35,10 +37,12 @@ export declare function replayFromRecordedAdvance(args: {
|
|
|
35
37
|
readonly nodeId: NodeId;
|
|
36
38
|
readonly workflowHash: WorkflowHash;
|
|
37
39
|
readonly attemptId: AttemptId;
|
|
38
|
-
readonly pinnedWorkflow:
|
|
40
|
+
readonly pinnedWorkflow: Workflow;
|
|
39
41
|
readonly snapshotStore: import('../../../v2/ports/snapshot-store.port.js').SnapshotStorePortV2;
|
|
40
42
|
readonly sha256: Sha256PortV2;
|
|
41
43
|
readonly tokenCodecPorts: TokenCodecPorts;
|
|
42
44
|
readonly aliasStore: import('../../../v2/ports/token-alias-store.port.js').TokenAliasStorePortV2;
|
|
43
45
|
readonly entropy: import('../../../v2/ports/random-entropy.port.js').RandomEntropyPortV2;
|
|
46
|
+
readonly precomputedIndex?: import('../../../v2/durable-core/session-index.js').SessionIndex;
|
|
47
|
+
readonly cleanResponseFormat?: boolean;
|
|
44
48
|
}): RA<z.infer<typeof V2ContinueWorkflowOutputSchema>, ContinueWorkflowError>;
|