@shipfox/api-workflows 14.0.0 → 15.0.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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +30 -0
- package/dist/core/entities/workflow-run.d.ts +2 -2
- package/dist/core/entities/workflow-run.d.ts.map +1 -1
- package/dist/core/entities/workflow-run.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/run-workflow.d.ts +26 -1
- package/dist/core/run-workflow.d.ts.map +1 -1
- package/dist/core/run-workflow.js +26 -0
- package/dist/core/run-workflow.js.map +1 -1
- package/dist/db/workflow-runs/run-create.d.ts +4 -1
- package/dist/db/workflow-runs/run-create.d.ts.map +1 -1
- package/dist/db/workflow-runs/run-create.js +14 -1
- package/dist/db/workflow-runs/run-create.js.map +1 -1
- package/dist/presentation/inter-module.d.ts +1 -0
- package/dist/presentation/inter-module.d.ts.map +1 -1
- package/dist/presentation/inter-module.js +41 -4
- package/dist/presentation/inter-module.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/src/core/entities/workflow-run.ts +4 -2
- package/src/core/index.ts +2 -2
- package/src/core/run-workflow.test.ts +101 -2
- package/src/core/run-workflow.ts +58 -2
- package/src/db/workflow-runs/run-create.test.ts +48 -0
- package/src/db/workflow-runs/run-create.ts +23 -1
- package/src/presentation/inter-module.test.ts +131 -1
- package/src/presentation/inter-module.ts +48 -3
- package/tsconfig.build.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
$ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
|
|
2
|
-
Successfully compiled: 123 files with swc (
|
|
3
|
-
2026-08-
|
|
2
|
+
Successfully compiled: 123 files with swc (636.77ms)
|
|
3
|
+
2026-08-24T12:31:39.373Z [INFO] asset workflow-bundle-4d88ac6c229f6c77759a.js 3.31 MiB [emitted] [immutable] (name: main)
|
|
4
4
|
orphan modules 33.5 KiB [orphan] 21 modules
|
|
5
5
|
runtime modules 1.13 KiB 5 modules
|
|
6
6
|
modules by path ../../../node_modules/.pnpm/ 970 KiB 196 modules
|
|
@@ -16,6 +16,6 @@ optional modules 30 bytes [optional]
|
|
|
16
16
|
__temporal_custom_payload_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
17
17
|
__temporal_custom_failure_converter (ignored) 15 bytes [optional] [built] [code generated]
|
|
18
18
|
../../shared/node/temporal/dist/workflow-error-interceptor.js 1.21 KiB [built] [code generated]
|
|
19
|
-
webpack 5.107.2 compiled successfully in
|
|
20
|
-
2026-08-
|
|
19
|
+
webpack 5.107.2 compiled successfully in 5437 ms
|
|
20
|
+
2026-08-24T12:31:39.386Z [INFO] Workflow bundle created { size: '3.31MB' }
|
|
21
21
|
/home/runner/work/shipfox/shipfox/libs/api/workflows/dist/temporal/workflows/index.js: 3469609 bytes
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @shipfox/api-workflows
|
|
2
2
|
|
|
3
|
+
## 15.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- af095a4: Adds the `startDevRun` inter-module method that creates a workflow run from an inline model and snapshot with `origin: 'dev'` and dev provenance, numbered by the workflow lineage id. Manual `subscriptionId` and cron `scheduleId` trigger payload fields become optional so a dev trigger can fire without a subscription row.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [a7804a8]
|
|
12
|
+
- Updated dependencies [af095a4]
|
|
13
|
+
- Updated dependencies [07410fe]
|
|
14
|
+
- Updated dependencies [989eb11]
|
|
15
|
+
- Updated dependencies [b7d522a]
|
|
16
|
+
- Updated dependencies [050b796]
|
|
17
|
+
- Updated dependencies [0b6addb]
|
|
18
|
+
- @shipfox/api-definitions-dto@15.0.0
|
|
19
|
+
- @shipfox/api-workflows-dto@15.0.0
|
|
20
|
+
- @shipfox/api-agent-dto@15.0.0
|
|
21
|
+
- @shipfox/expression@2.3.0
|
|
22
|
+
- @shipfox/workflow-document@3.2.0
|
|
23
|
+
- @shipfox/api-integration-core-dto@15.0.0
|
|
24
|
+
- @shipfox/node-opentelemetry@0.6.5
|
|
25
|
+
- @shipfox/api-auth-dto@15.0.0
|
|
26
|
+
- @shipfox/api-projects-dto@15.0.0
|
|
27
|
+
- @shipfox/api-workspaces-dto@15.0.0
|
|
28
|
+
- @shipfox/node-fastify@0.4.3
|
|
29
|
+
- @shipfox/node-module@1.0.7
|
|
30
|
+
- @shipfox/node-temporal@0.4.6
|
|
31
|
+
- @shipfox/api-auth-context@15.0.0
|
|
32
|
+
|
|
3
33
|
## 14.0.0
|
|
4
34
|
|
|
5
35
|
### Minor Changes
|
|
@@ -41,13 +41,13 @@ export type TriggerPayload = {
|
|
|
41
41
|
source: 'manual';
|
|
42
42
|
provider?: 'manual' | undefined;
|
|
43
43
|
event: 'fire';
|
|
44
|
-
subscriptionId
|
|
44
|
+
subscriptionId?: string | undefined;
|
|
45
45
|
userId: string;
|
|
46
46
|
} | {
|
|
47
47
|
source: 'cron';
|
|
48
48
|
provider?: 'cron' | undefined;
|
|
49
49
|
event: 'tick';
|
|
50
|
-
scheduleId
|
|
50
|
+
scheduleId?: string | undefined;
|
|
51
51
|
} | {
|
|
52
52
|
source: string;
|
|
53
53
|
provider?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-run.d.ts","sourceRoot":"","sources":["../../../src/core/entities/workflow-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;AAClC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAC,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c,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,cAAc,CAAC;IAC/B,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,2BAA2B,GAAG,IAAI,GAAG,SAAS,CAAC;IAClE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvC,cAAc,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC9C,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,UAAW,SAAQ,IAAI;IACtC,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,iBAAkB,SAAQ,GAAG;IAC5C,aAAa,EAAE,kBAAkB,EAAE,CAAC;CACrC;AAED,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAC5C,UAAU,EAAE,kBAAkB,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC1B;oDACgD;IAChD,sBAAsB,EAAE,OAAO,CAAC;CACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/entities/workflow-run.ts"],"sourcesContent":["import type {Job} from './job.js';\nimport type {JobExecution} from './job-execution.js';\nimport type {Step, StepAttempt} from './step.js';\nimport type {WorkflowRunAttempt} from './workflow-run-attempt.js';\n\nexport type WorkflowRunStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';\n\nexport type WorkflowRunOrigin = 'synced' | 'dev';\n\n/**\n * Why a dev run was created: the ref and pinned commit the definition came from, the\n * file that ran, the user who started it, and the journaled event it replays when any.\n */\nexport interface WorkflowRunDevSource {\n ref: string;\n commit: string;\n configPath: string;\n initiatedByUserId: string;\n replayOfEventId: string | null;\n}\n\nexport type WorkflowRunOriginState =\n | {origin: 'synced'; devSource: null}\n | {origin: 'dev'; devSource: WorkflowRunDevSource};\n\nexport type TerminalWorkflowRunStatus = Extract<\n WorkflowRunStatus,\n 'succeeded' | 'failed' | 'cancelled'\n>;\n\nconst TERMINAL_WORKFLOW_RUN_STATUSES = new Set<WorkflowRunStatus>([\n 'succeeded',\n 'failed',\n 'cancelled',\n]);\n\nexport function isWorkflowRunTerminal(\n status: WorkflowRunStatus,\n): status is TerminalWorkflowRunStatus {\n return TERMINAL_WORKFLOW_RUN_STATUSES.has(status);\n}\n\nexport interface WorkflowRunTriggerReference {\n project: {id: string} | null;\n repository: string | null;\n ref: string | null;\n commit: string | null;\n actor: string | null;\n}\n\nexport interface WorkflowSourceSnapshot {\n content: string;\n format: 'yaml';\n}\n\nexport type TriggerPayload =\n | {\n source: 'manual';\n provider?: 'manual' | undefined;\n event: 'fire';\n subscriptionId
|
|
1
|
+
{"version":3,"sources":["../../../src/core/entities/workflow-run.ts"],"sourcesContent":["import type {Job} from './job.js';\nimport type {JobExecution} from './job-execution.js';\nimport type {Step, StepAttempt} from './step.js';\nimport type {WorkflowRunAttempt} from './workflow-run-attempt.js';\n\nexport type WorkflowRunStatus = 'pending' | 'running' | 'succeeded' | 'failed' | 'cancelled';\n\nexport type WorkflowRunOrigin = 'synced' | 'dev';\n\n/**\n * Why a dev run was created: the ref and pinned commit the definition came from, the\n * file that ran, the user who started it, and the journaled event it replays when any.\n */\nexport interface WorkflowRunDevSource {\n ref: string;\n commit: string;\n configPath: string;\n initiatedByUserId: string;\n replayOfEventId: string | null;\n}\n\nexport type WorkflowRunOriginState =\n | {origin: 'synced'; devSource: null}\n | {origin: 'dev'; devSource: WorkflowRunDevSource};\n\nexport type TerminalWorkflowRunStatus = Extract<\n WorkflowRunStatus,\n 'succeeded' | 'failed' | 'cancelled'\n>;\n\nconst TERMINAL_WORKFLOW_RUN_STATUSES = new Set<WorkflowRunStatus>([\n 'succeeded',\n 'failed',\n 'cancelled',\n]);\n\nexport function isWorkflowRunTerminal(\n status: WorkflowRunStatus,\n): status is TerminalWorkflowRunStatus {\n return TERMINAL_WORKFLOW_RUN_STATUSES.has(status);\n}\n\nexport interface WorkflowRunTriggerReference {\n project: {id: string} | null;\n repository: string | null;\n ref: string | null;\n commit: string | null;\n actor: string | null;\n}\n\nexport interface WorkflowSourceSnapshot {\n content: string;\n format: 'yaml';\n}\n\nexport type TriggerPayload =\n | {\n source: 'manual';\n provider?: 'manual' | undefined;\n event: 'fire';\n // A dev trigger has no subscription row, so the id is optional here.\n subscriptionId?: string | undefined;\n userId: string;\n }\n | {\n source: 'cron';\n provider?: 'cron' | undefined;\n event: 'tick';\n // A dev trigger has no schedule row, so the id is optional here.\n scheduleId?: string | undefined;\n }\n // Integration sources (github, gitlab, sentry, …) flow through opaquely: the\n // run records what fired it and carries the raw event payload, without the\n // triggers module having to know each source's shape.\n | {\n source: string;\n provider?: string | undefined;\n event: string;\n deliveryId: string;\n data: unknown;\n };\n\nexport type WorkflowRun = WorkflowRunOriginState & {\n id: string;\n workspaceId: string;\n projectId: string;\n definitionId: string;\n number: number;\n /** Effective runtime name: the resolved override, or workflowName when absent. */\n name: string;\n /** Static workflow-name snapshot preserved from the definition at creation. */\n workflowName: string;\n /** Nullable resolved override retained for rerun fidelity. */\n nameOverride: string | null;\n status: WorkflowRunStatus;\n currentAttempt: number;\n triggerProvider: string | null;\n triggerSource: string;\n triggerEvent: string;\n triggerPayload: TriggerPayload;\n /** Provider-neutral trigger facts captured at run creation, when available. */\n triggerReference?: WorkflowRunTriggerReference | null | undefined;\n inputs: Record<string, unknown> | null;\n sourceSnapshot: WorkflowSourceSnapshot | null;\n triggerIdempotencyKey: string | null;\n timeoutMs: number;\n version: number;\n createdAt: Date;\n updatedAt: Date;\n startedAt: Date | null;\n finishedAt: Date | null;\n};\n\nexport interface StepDetail extends Step {\n attempts: StepAttempt[];\n}\n\nexport interface JobExecutionDetail extends JobExecution {\n steps: StepDetail[];\n}\n\nexport interface WorkflowJobDetail extends Job {\n jobExecutions: JobExecutionDetail[];\n}\n\nexport type WorkflowRunDetail = WorkflowRun & {\n runAttempt: WorkflowRunAttempt;\n latestAttempt: number;\n jobs: WorkflowJobDetail[];\n /** Whether any job execution of this attempt reached its runner, decided here so the detail\n * and the list cannot answer it differently. */\n hasStartedJobExecution: boolean;\n};\n"],"names":["TERMINAL_WORKFLOW_RUN_STATUSES","Set","isWorkflowRunTerminal","status","has"],"mappings":"AA8BA,MAAMA,iCAAiC,IAAIC,IAAuB;IAChE;IACA;IACA;CACD;AAED,OAAO,SAASC,sBACdC,MAAyB;IAEzB,OAAOH,+BAA+BI,GAAG,CAACD;AAC5C"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export { AgentConfigUnresolvableError, AgentIntegrationMaterializationError, Def
|
|
|
6
6
|
export type { NextStep, RecordStepResultOutcome, RecordStepResultParams } from './job-execution.js';
|
|
7
7
|
export { nextStepForJob, recordStepResult } from './job-execution.js';
|
|
8
8
|
export { type DecideJobActivationInput, type DeriveJobSuccessResult, decideJobActivation, deriveJobExecutionOutputs, deriveJobSuccess, type JobActivationDecision, } from './job-transition/index.js';
|
|
9
|
-
export type { RunWorkflowParams } from './run-workflow.js';
|
|
10
|
-
export { runWorkflow } from './run-workflow.js';
|
|
9
|
+
export type { RunDevWorkflowParams, RunWorkflowParams } from './run-workflow.js';
|
|
10
|
+
export { runDevWorkflow, runWorkflow } from './run-workflow.js';
|
|
11
11
|
export { type MaterializedWorkflowJob, type MaterializedWorkflowStep, materializeWorkflowModel, modelHasAgentStep, } from './step-config/index.js';
|
|
12
12
|
export { deriveInitialJobExecutionPlan, deriveJobExecutionRunner, materializeWorkflowRunJobs, } from './workflow-run-creation.js';
|
|
13
13
|
export { type ScheduleRuntimeDagInput, scheduleRuntimeDag, } from './workflow-scheduling/index.js';
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,GAAG,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AACtD,YAAY,EACV,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AACzD,YAAY,EACV,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,4BAA4B,EAC5B,oCAAoC,EACpC,uBAAuB,EACvB,8BAA8B,EAC9B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAC,QAAQ,EAAE,uBAAuB,EAAE,sBAAsB,EAAC,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":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package/dist/core/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { AgentConfigUnresolvableError, AgentIntegrationMaterializationError, DefinitionNotFoundError, InterpolationUnresolvableError, isPermanentRunWorkflowError, JobNotFoundError, NoFailedJobsError, ProjectMismatchError, RunNotTerminalError, SourceRunNotFoundError, StepNotFoundError, StepNotRunningError, WorkflowRunNotCancellableError } from './errors.js';
|
|
2
2
|
export { nextStepForJob, recordStepResult } from './job-execution.js';
|
|
3
3
|
export { decideJobActivation, deriveJobExecutionOutputs, deriveJobSuccess } from './job-transition/index.js';
|
|
4
|
-
export { runWorkflow } from './run-workflow.js';
|
|
4
|
+
export { runDevWorkflow, runWorkflow } from './run-workflow.js';
|
|
5
5
|
export { materializeWorkflowModel, modelHasAgentStep } from './step-config/index.js';
|
|
6
6
|
export { deriveInitialJobExecutionPlan, deriveJobExecutionRunner, materializeWorkflowRunJobs } from './workflow-run-creation.js';
|
|
7
7
|
export { scheduleRuntimeDag } from './workflow-scheduling/index.js';
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["export type {Job, JobStatus} from './entities/job.js';\nexport type {\n JobListenerEvent,\n JobListenerEventDisposition,\n} from './entities/job-listener-event.js';\nexport type {Step, StepStatus} from './entities/step.js';\nexport type {\n TriggerPayload,\n WorkflowRun,\n WorkflowRunStatus,\n WorkflowSourceSnapshot,\n} from './entities/workflow-run.js';\nexport {\n AgentConfigUnresolvableError,\n AgentIntegrationMaterializationError,\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n isPermanentRunWorkflowError,\n JobNotFoundError,\n NoFailedJobsError,\n ProjectMismatchError,\n RunNotTerminalError,\n SourceRunNotFoundError,\n StepNotFoundError,\n StepNotRunningError,\n WorkflowRunNotCancellableError,\n} from './errors.js';\nexport type {NextStep, RecordStepResultOutcome, RecordStepResultParams} from './job-execution.js';\nexport {nextStepForJob, recordStepResult} from './job-execution.js';\nexport {\n type DecideJobActivationInput,\n type DeriveJobSuccessResult,\n decideJobActivation,\n deriveJobExecutionOutputs,\n deriveJobSuccess,\n type JobActivationDecision,\n} from './job-transition/index.js';\nexport type {RunWorkflowParams} from './run-workflow.js';\nexport {runWorkflow} from './run-workflow.js';\nexport {\n type MaterializedWorkflowJob,\n type MaterializedWorkflowStep,\n materializeWorkflowModel,\n modelHasAgentStep,\n} from './step-config/index.js';\nexport {\n deriveInitialJobExecutionPlan,\n deriveJobExecutionRunner,\n materializeWorkflowRunJobs,\n} from './workflow-run-creation.js';\nexport {\n type ScheduleRuntimeDagInput,\n scheduleRuntimeDag,\n} from './workflow-scheduling/index.js';\n"],"names":["AgentConfigUnresolvableError","AgentIntegrationMaterializationError","DefinitionNotFoundError","InterpolationUnresolvableError","isPermanentRunWorkflowError","JobNotFoundError","NoFailedJobsError","ProjectMismatchError","RunNotTerminalError","SourceRunNotFoundError","StepNotFoundError","StepNotRunningError","WorkflowRunNotCancellableError","nextStepForJob","recordStepResult","decideJobActivation","deriveJobExecutionOutputs","deriveJobSuccess","runWorkflow","materializeWorkflowModel","modelHasAgentStep","deriveInitialJobExecutionPlan","deriveJobExecutionRunner","materializeWorkflowRunJobs","scheduleRuntimeDag"],"mappings":"AAYA,SACEA,4BAA4B,EAC5BC,oCAAoC,EACpCC,uBAAuB,EACvBC,8BAA8B,EAC9BC,2BAA2B,EAC3BC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,mBAAmB,EACnBC,sBAAsB,EACtBC,iBAAiB,EACjBC,mBAAmB,EACnBC,8BAA8B,QACzB,cAAc;AAErB,SAAQC,cAAc,EAAEC,gBAAgB,QAAO,qBAAqB;AACpE,SAGEC,mBAAmB,EACnBC,yBAAyB,EACzBC,gBAAgB,QAEX,4BAA4B;AAEnC,SAAQC,WAAW,QAAO,oBAAoB;
|
|
1
|
+
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["export type {Job, JobStatus} from './entities/job.js';\nexport type {\n JobListenerEvent,\n JobListenerEventDisposition,\n} from './entities/job-listener-event.js';\nexport type {Step, StepStatus} from './entities/step.js';\nexport type {\n TriggerPayload,\n WorkflowRun,\n WorkflowRunStatus,\n WorkflowSourceSnapshot,\n} from './entities/workflow-run.js';\nexport {\n AgentConfigUnresolvableError,\n AgentIntegrationMaterializationError,\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n isPermanentRunWorkflowError,\n JobNotFoundError,\n NoFailedJobsError,\n ProjectMismatchError,\n RunNotTerminalError,\n SourceRunNotFoundError,\n StepNotFoundError,\n StepNotRunningError,\n WorkflowRunNotCancellableError,\n} from './errors.js';\nexport type {NextStep, RecordStepResultOutcome, RecordStepResultParams} from './job-execution.js';\nexport {nextStepForJob, recordStepResult} from './job-execution.js';\nexport {\n type DecideJobActivationInput,\n type DeriveJobSuccessResult,\n decideJobActivation,\n deriveJobExecutionOutputs,\n deriveJobSuccess,\n type JobActivationDecision,\n} from './job-transition/index.js';\nexport type {RunDevWorkflowParams, RunWorkflowParams} from './run-workflow.js';\nexport {runDevWorkflow, runWorkflow} from './run-workflow.js';\nexport {\n type MaterializedWorkflowJob,\n type MaterializedWorkflowStep,\n materializeWorkflowModel,\n modelHasAgentStep,\n} from './step-config/index.js';\nexport {\n deriveInitialJobExecutionPlan,\n deriveJobExecutionRunner,\n materializeWorkflowRunJobs,\n} from './workflow-run-creation.js';\nexport {\n type ScheduleRuntimeDagInput,\n scheduleRuntimeDag,\n} from './workflow-scheduling/index.js';\n"],"names":["AgentConfigUnresolvableError","AgentIntegrationMaterializationError","DefinitionNotFoundError","InterpolationUnresolvableError","isPermanentRunWorkflowError","JobNotFoundError","NoFailedJobsError","ProjectMismatchError","RunNotTerminalError","SourceRunNotFoundError","StepNotFoundError","StepNotRunningError","WorkflowRunNotCancellableError","nextStepForJob","recordStepResult","decideJobActivation","deriveJobExecutionOutputs","deriveJobSuccess","runDevWorkflow","runWorkflow","materializeWorkflowModel","modelHasAgentStep","deriveInitialJobExecutionPlan","deriveJobExecutionRunner","materializeWorkflowRunJobs","scheduleRuntimeDag"],"mappings":"AAYA,SACEA,4BAA4B,EAC5BC,oCAAoC,EACpCC,uBAAuB,EACvBC,8BAA8B,EAC9BC,2BAA2B,EAC3BC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,mBAAmB,EACnBC,sBAAsB,EACtBC,iBAAiB,EACjBC,mBAAmB,EACnBC,8BAA8B,QACzB,cAAc;AAErB,SAAQC,cAAc,EAAEC,gBAAgB,QAAO,qBAAqB;AACpE,SAGEC,mBAAmB,EACnBC,yBAAyB,EACzBC,gBAAgB,QAEX,4BAA4B;AAEnC,SAAQC,cAAc,EAAEC,WAAW,QAAO,oBAAoB;AAC9D,SAGEC,wBAAwB,EACxBC,iBAAiB,QACZ,yBAAyB;AAChC,SACEC,6BAA6B,EAC7BC,wBAAwB,EACxBC,0BAA0B,QACrB,6BAA6B;AACpC,SAEEC,kBAAkB,QACb,iCAAiC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AgentInterModuleClient } from '@shipfox/api-agent-dto/inter-module';
|
|
2
|
+
import { type WorkflowModelSnapshot } from '@shipfox/api-definitions-dto';
|
|
2
3
|
import type { DefinitionsInterModuleClient } from '@shipfox/api-definitions-dto/inter-module';
|
|
3
4
|
import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto/inter-module';
|
|
4
5
|
import type { ProjectsModuleClient } from '@shipfox/api-projects-dto/inter-module';
|
|
5
6
|
import type { SecretsInterModuleClient } from '@shipfox/api-secrets-dto/inter-module';
|
|
6
|
-
import type { TriggerPayload, WorkflowRun } from './entities/workflow-run.js';
|
|
7
|
+
import type { TriggerPayload, WorkflowRun, WorkflowRunDevSource, WorkflowSourceSnapshot } from './entities/workflow-run.js';
|
|
7
8
|
export interface RunWorkflowParams {
|
|
8
9
|
workspaceId: string;
|
|
9
10
|
projectId: string;
|
|
@@ -20,4 +21,28 @@ export declare function runWorkflow(definitions: DefinitionsInterModuleClient, p
|
|
|
20
21
|
}, options?: {
|
|
21
22
|
secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>;
|
|
22
23
|
}): Promise<WorkflowRun>;
|
|
24
|
+
export interface RunDevWorkflowParams {
|
|
25
|
+
workspaceId: string;
|
|
26
|
+
projectId: string;
|
|
27
|
+
/** Workflow lineage id, becomes the run's definition_id. */
|
|
28
|
+
workflowId: string;
|
|
29
|
+
model: WorkflowModelSnapshot;
|
|
30
|
+
sourceSnapshot: WorkflowSourceSnapshot;
|
|
31
|
+
devSource: WorkflowRunDevSource;
|
|
32
|
+
triggerPayload: TriggerPayload;
|
|
33
|
+
triggerConnectionId?: string | undefined;
|
|
34
|
+
inputs?: Record<string, unknown> | undefined;
|
|
35
|
+
integrations?: IntegrationsModuleClient | undefined;
|
|
36
|
+
projects?: ProjectsModuleClient | undefined;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Creates a dev run from an inline model and snapshot. Unlike
|
|
40
|
+
* trigger-originated runs, dev runs do not carry an idempotency key because
|
|
41
|
+
* each call represents a distinct intent. The lineage id is used as the run's
|
|
42
|
+
* definition_id so dev runs share the workflow numbering sequence before and
|
|
43
|
+
* after the file merges.
|
|
44
|
+
*/
|
|
45
|
+
export declare function runDevWorkflow(agent: AgentInterModuleClient, params: RunDevWorkflowParams, options?: {
|
|
46
|
+
secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>;
|
|
47
|
+
}): Promise<WorkflowRun>;
|
|
23
48
|
//# sourceMappingURL=run-workflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-workflow.d.ts","sourceRoot":"","sources":["../../src/core/run-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"run-workflow.d.ts","sourceRoot":"","sources":["../../src/core/run-workflow.ts"],"names":[],"mappings":"A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ClB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,qBAAqB,CAAC;IAC7B,cAAc,EAAE,sBAAsB,CAAC;IACvC,SAAS,EAAE,oBAAoB,CAAC;IAChC,cAAc,EAAE,cAAc,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7C,YAAY,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,sBAAsB,EAC7B,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE;IAAC,OAAO,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAA;CAAM,GAClF,OAAO,CAAC,WAAW,CAAC,CAuBtB"}
|
|
@@ -30,5 +30,31 @@ export async function runWorkflow(definitions, params, options = {}) {
|
|
|
30
30
|
projects: params.projects
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a dev run from an inline model and snapshot. Unlike
|
|
35
|
+
* trigger-originated runs, dev runs do not carry an idempotency key because
|
|
36
|
+
* each call represents a distinct intent. The lineage id is used as the run's
|
|
37
|
+
* definition_id so dev runs share the workflow numbering sequence before and
|
|
38
|
+
* after the file merges.
|
|
39
|
+
*/ export function runDevWorkflow(agent, params, options = {}) {
|
|
40
|
+
const model = workflowModelFromSnapshot(params.model);
|
|
41
|
+
const resolveAgentDefaults = createAgentDefaultsResolver(agent, modelHasAgentStep(model) ? params.workspaceId : null);
|
|
42
|
+
return createWorkflowRun({
|
|
43
|
+
workspaceId: params.workspaceId,
|
|
44
|
+
projectId: params.projectId,
|
|
45
|
+
definitionId: params.workflowId,
|
|
46
|
+
model,
|
|
47
|
+
triggerPayload: params.triggerPayload,
|
|
48
|
+
triggerConnectionId: params.triggerConnectionId,
|
|
49
|
+
inputs: params.inputs,
|
|
50
|
+
sourceSnapshot: params.sourceSnapshot,
|
|
51
|
+
origin: 'dev',
|
|
52
|
+
devSource: params.devSource,
|
|
53
|
+
resolveAgentDefaults,
|
|
54
|
+
secrets: options.secrets,
|
|
55
|
+
integrations: params.integrations,
|
|
56
|
+
projects: params.projects
|
|
57
|
+
});
|
|
58
|
+
}
|
|
33
59
|
|
|
34
60
|
//# sourceMappingURL=run-workflow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/run-workflow.ts"],"sourcesContent":["import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport {workflowModelFromSnapshot} from '@shipfox/api-definitions-dto';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {createWorkflowRun} from '#db/workflow-runs.js';\nimport {createAgentDefaultsResolver} from './agent-defaults.js';\nimport type {TriggerPayload
|
|
1
|
+
{"version":3,"sources":["../../src/core/run-workflow.ts"],"sourcesContent":["import type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport {type WorkflowModelSnapshot, workflowModelFromSnapshot} from '@shipfox/api-definitions-dto';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {createWorkflowRun} from '#db/workflow-runs.js';\nimport {createAgentDefaultsResolver} from './agent-defaults.js';\nimport type {\n TriggerPayload,\n WorkflowRun,\n WorkflowRunDevSource,\n WorkflowSourceSnapshot,\n} from './entities/workflow-run.js';\nimport {DefinitionNotFoundError, ProjectMismatchError} from './errors.js';\nimport {modelHasAgentStep} from './step-config/materialize-workflow-model.js';\n\nexport interface RunWorkflowParams {\n workspaceId: string;\n projectId: string;\n definitionId: string;\n triggerPayload: TriggerPayload;\n triggerConnectionId?: string | undefined;\n inputs?: Record<string, unknown> | undefined;\n triggerIdempotencyKey?: string | undefined;\n integrations?: IntegrationsModuleClient | undefined;\n projects?: ProjectsModuleClient | undefined;\n}\n\nexport async function runWorkflow(\n definitions: DefinitionsInterModuleClient,\n params: RunWorkflowParams & {agent: AgentInterModuleClient},\n options: {secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>} = {},\n): Promise<WorkflowRun> {\n const {definition} = await definitions.getDefinitionForWorkflowRun({\n definitionId: params.definitionId,\n });\n if (!definition) throw new DefinitionNotFoundError(params.definitionId);\n\n if (definition.projectId !== params.projectId) {\n throw new ProjectMismatchError(definition.projectId, params.projectId);\n }\n const model = workflowModelFromSnapshot(definition.model);\n const resolveAgentDefaults = createAgentDefaultsResolver(\n params.agent,\n modelHasAgentStep(model) ? params.workspaceId : null,\n );\n\n return createWorkflowRun({\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n definitionId: definition.workflowId,\n name: definition.name,\n model,\n triggerPayload: params.triggerPayload,\n triggerConnectionId: params.triggerConnectionId,\n inputs: params.inputs,\n sourceSnapshot: definition.sourceSnapshot,\n triggerIdempotencyKey: params.triggerIdempotencyKey,\n resolveAgentDefaults,\n secrets: options.secrets,\n integrations: params.integrations,\n projects: params.projects,\n });\n}\n\nexport interface RunDevWorkflowParams {\n workspaceId: string;\n projectId: string;\n /** Workflow lineage id, becomes the run's definition_id. */\n workflowId: string;\n model: WorkflowModelSnapshot;\n sourceSnapshot: WorkflowSourceSnapshot;\n devSource: WorkflowRunDevSource;\n triggerPayload: TriggerPayload;\n triggerConnectionId?: string | undefined;\n inputs?: Record<string, unknown> | undefined;\n integrations?: IntegrationsModuleClient | undefined;\n projects?: ProjectsModuleClient | undefined;\n}\n\n/**\n * Creates a dev run from an inline model and snapshot. Unlike\n * trigger-originated runs, dev runs do not carry an idempotency key because\n * each call represents a distinct intent. The lineage id is used as the run's\n * definition_id so dev runs share the workflow numbering sequence before and\n * after the file merges.\n */\nexport function runDevWorkflow(\n agent: AgentInterModuleClient,\n params: RunDevWorkflowParams,\n options: {secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'>} = {},\n): Promise<WorkflowRun> {\n const model = workflowModelFromSnapshot(params.model);\n const resolveAgentDefaults = createAgentDefaultsResolver(\n agent,\n modelHasAgentStep(model) ? params.workspaceId : null,\n );\n\n return createWorkflowRun({\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n definitionId: params.workflowId,\n model,\n triggerPayload: params.triggerPayload,\n triggerConnectionId: params.triggerConnectionId,\n inputs: params.inputs,\n sourceSnapshot: params.sourceSnapshot,\n origin: 'dev',\n devSource: params.devSource,\n resolveAgentDefaults,\n secrets: options.secrets,\n integrations: params.integrations,\n projects: params.projects,\n });\n}\n"],"names":["workflowModelFromSnapshot","createWorkflowRun","createAgentDefaultsResolver","DefinitionNotFoundError","ProjectMismatchError","modelHasAgentStep","runWorkflow","definitions","params","options","definition","getDefinitionForWorkflowRun","definitionId","projectId","model","resolveAgentDefaults","agent","workspaceId","workflowId","name","triggerPayload","triggerConnectionId","inputs","sourceSnapshot","triggerIdempotencyKey","secrets","integrations","projects","runDevWorkflow","origin","devSource"],"mappings":"AACA,SAAoCA,yBAAyB,QAAO,+BAA+B;AAKnG,SAAQC,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,2BAA2B,QAAO,sBAAsB;AAOhE,SAAQC,uBAAuB,EAAEC,oBAAoB,QAAO,cAAc;AAC1E,SAAQC,iBAAiB,QAAO,8CAA8C;AAc9E,OAAO,eAAeC,YACpBC,WAAyC,EACzCC,MAA2D,EAC3DC,UAAiF,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AmB;QAC/CC,QAAQd,OAAOc,MAAM;QACrBC,gBAAgBf,OAAOe,cAAc;QACrCM,QAAQ;QACRC,WAAWtB,OAAOsB,SAAS;QAC3Bf;QACAU,SAAShB,QAAQgB,OAAO;QACxBC,cAAclB,OAAOkB,YAAY;QACjCC,UAAUnB,OAAOmB,QAAQ;IAC3B;AACF"}
|
|
@@ -3,7 +3,7 @@ import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto
|
|
|
3
3
|
import type { ProjectsModuleClient } from '@shipfox/api-projects-dto/inter-module';
|
|
4
4
|
import type { SecretsInterModuleClient } from '@shipfox/api-secrets-dto/inter-module';
|
|
5
5
|
import type { AgentDefaultsResolver } from '#core/agent-defaults.js';
|
|
6
|
-
import type { TriggerPayload, WorkflowRun, WorkflowSourceSnapshot } from '#core/entities/workflow-run.js';
|
|
6
|
+
import type { TriggerPayload, WorkflowRun, WorkflowRunDevSource, WorkflowRunOrigin, WorkflowSourceSnapshot } from '#core/entities/workflow-run.js';
|
|
7
7
|
import { InterpolationUnresolvableError } from '#core/errors.js';
|
|
8
8
|
export type WorkflowModelJob = WorkflowModel['jobs'][number];
|
|
9
9
|
export interface ReferencedVariable {
|
|
@@ -23,6 +23,9 @@ export interface CreateWorkflowRunParams {
|
|
|
23
23
|
inputs?: Record<string, unknown> | undefined;
|
|
24
24
|
sourceSnapshot?: WorkflowSourceSnapshot | null | undefined;
|
|
25
25
|
triggerIdempotencyKey?: string | undefined;
|
|
26
|
+
/** Run provenance. Defaults to a synced run with no dev source. */
|
|
27
|
+
origin?: WorkflowRunOrigin | undefined;
|
|
28
|
+
devSource?: WorkflowRunDevSource | null | undefined;
|
|
26
29
|
resolveAgentDefaults?: AgentDefaultsResolver | undefined;
|
|
27
30
|
secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'> | undefined;
|
|
28
31
|
integrations?: IntegrationsModuleClient | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-create.d.ts","source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AAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,GAAG,SAAS,CAAC;CAC1F,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAkC9C"}
|
|
@@ -66,7 +66,9 @@ export async function createWorkflowRun(params) {
|
|
|
66
66
|
triggerReference,
|
|
67
67
|
inputs: params.inputs ?? null,
|
|
68
68
|
sourceSnapshot: params.sourceSnapshot ?? null,
|
|
69
|
-
triggerIdempotencyKey: params.triggerIdempotencyKey ?? null
|
|
69
|
+
triggerIdempotencyKey: params.triggerIdempotencyKey ?? null,
|
|
70
|
+
origin: params.origin ?? 'synced',
|
|
71
|
+
devSource: params.devSource === undefined || params.devSource === null ? null : toWorkflowRunDevSourceDb(params.devSource)
|
|
70
72
|
}).onConflictDoNothing({
|
|
71
73
|
target: workflowRuns.triggerIdempotencyKey
|
|
72
74
|
}).returning();
|
|
@@ -193,6 +195,17 @@ async function allocateWorkflowRunNumber(tx, definitionId) {
|
|
|
193
195
|
if (!counterRow) throw new Error('Run counter allocation returned no rows');
|
|
194
196
|
return counterRow.number;
|
|
195
197
|
}
|
|
198
|
+
// The run entity carries camelCase dev-source fields while the persisted jsonb uses
|
|
199
|
+
// snake_case keys, so the write boundary maps explicitly rather than spreading.
|
|
200
|
+
function toWorkflowRunDevSourceDb(source) {
|
|
201
|
+
return {
|
|
202
|
+
ref: source.ref,
|
|
203
|
+
commit: source.commit,
|
|
204
|
+
config_path: source.configPath,
|
|
205
|
+
initiated_by_user_id: source.initiatedByUserId,
|
|
206
|
+
replay_of_event_id: source.replayOfEventId
|
|
207
|
+
};
|
|
208
|
+
}
|
|
196
209
|
export async function loadReferencedVariables(params) {
|
|
197
210
|
const references = referencedVariables(params.model, params.jobs ?? params.model.jobs);
|
|
198
211
|
const keys = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/db/workflow-runs/run-create.ts"],"sourcesContent":["import {\n createWorkflowModelSnapshot,\n WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS,\n type WorkflowModel,\n} from '@shipfox/api-definitions-dto';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {\n analyzeContextKeyAccess,\n type ResolvedFieldSegment,\n type WorkflowExpression,\n} from '@shipfox/expression';\nimport {logger} from '@shipfox/node-opentelemetry';\nimport {eq, sql} from 'drizzle-orm';\nimport type {AgentDefaultsResolver} from '#core/agent-defaults.js';\nimport {\n createAgentToolMaterializationSnapshot,\n loadAgentToolMaterializationContext,\n} from '#core/agent-tools.js';\nimport type {\n TriggerPayload,\n WorkflowRun,\n WorkflowSourceSnapshot,\n} from '#core/entities/workflow-run.js';\nimport {InterpolationUnresolvableError} from '#core/errors.js';\nimport {resolveWorkflowRunTriggerReference} from '#core/resolve-trigger-reference.js';\nimport {assembleCreationContext} from '#core/step-config/assemble-run-context.js';\nimport type {MaterializedWorkflowJob} from '#core/step-config/materialize-workflow-model.js';\nimport type {WorkflowStepTemplateDiagnostic} from '#core/step-config/resolve-step-config.js';\nimport {resolveWorkflowRunName} from '#core/step-config/resolve-workflow-run-name.js';\nimport {\n deriveInitialJobExecutionPlan,\n materializeWorkflowRunJobs,\n} from '#core/workflow-run-creation.js';\nimport {\n recordWorkflowDisplayNameResolutionDegraded,\n recordWorkflowRunCreated,\n} from '#metrics/instance.js';\nimport {db, type Tx} from '../db.js';\nimport {workflowRunAttempts} from '../schema/workflow-run-attempts.js';\nimport {workflowRunCounters} from '../schema/workflow-run-counters.js';\nimport {toWorkflowRun, workflowRuns} from '../schema/workflow-runs.js';\nimport {type MaterializedRunGraphJob, persistMaterializedRunGraph} from './run-graph.js';\n\nexport type WorkflowModelJob = WorkflowModel['jobs'][number];\n\nexport interface ReferencedVariable {\n readonly key: string;\n readonly field: InterpolationUnresolvableError['field'];\n readonly source: string;\n readonly envKey?: string | undefined;\n}\n\nexport interface CreateWorkflowRunParams {\n workspaceId: string;\n projectId: string;\n definitionId: string;\n name?: string | undefined;\n model: WorkflowModel;\n triggerPayload: TriggerPayload;\n triggerConnectionId?: string | undefined;\n inputs?: Record<string, unknown> | undefined;\n sourceSnapshot?: WorkflowSourceSnapshot | null | undefined;\n triggerIdempotencyKey?: string | undefined;\n resolveAgentDefaults?: AgentDefaultsResolver | undefined;\n secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'> | undefined;\n integrations?: IntegrationsModuleClient | undefined;\n projects?: ProjectsModuleClient | undefined;\n}\n\nexport async function createWorkflowRun(params: CreateWorkflowRunParams): Promise<WorkflowRun> {\n const triggerReference = await resolveWorkflowRunTriggerReference({\n workspaceId: params.workspaceId,\n triggerConnectionId: params.triggerConnectionId,\n triggerPayload: params.triggerPayload,\n integrations: params.integrations,\n projects: params.projects,\n });\n const staticName = params.name ?? params.model.name;\n const agentToolContext =\n params.integrations === undefined\n ? undefined\n : await loadAgentToolMaterializationContext({\n model: params.model,\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n integrations: params.integrations,\n projects: params.projects,\n });\n const agentToolMaterialization = createAgentToolMaterializationSnapshot({\n model: params.model,\n context: agentToolContext,\n });\n const result = await db().transaction(async (tx) => {\n // Serialize idempotent trigger resolution separately from per-definition number\n // allocation so a replay never consumes a number, including when two deliveries\n // race before either run is visible.\n if (params.triggerIdempotencyKey) {\n await tx.execute(\n sql`select pg_advisory_xact_lock(hashtext(${params.triggerIdempotencyKey}))`,\n );\n const existing = await tx\n .select()\n .from(workflowRuns)\n .where(eq(workflowRuns.triggerIdempotencyKey, params.triggerIdempotencyKey))\n .limit(1);\n const existingRow = existing[0];\n if (existingRow) return {run: toWorkflowRun(existingRow), created: false};\n }\n\n // Keep allocation on the existing transaction so a trigger burst cannot pin\n // every pool connection and then wait for a second connection per run.\n const number = await allocateWorkflowRunNumber(tx, params.definitionId);\n\n const insertResult = await tx\n .insert(workflowRuns)\n .values({\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n definitionId: params.definitionId,\n number,\n name: null,\n workflowName: staticName,\n status: 'pending',\n currentAttempt: 1,\n triggerProvider: params.triggerPayload.provider ?? null,\n triggerSource: params.triggerPayload.source,\n triggerEvent: params.triggerPayload.event,\n triggerPayload: params.triggerPayload,\n triggerReference,\n inputs: params.inputs ?? null,\n sourceSnapshot: params.sourceSnapshot ?? null,\n triggerIdempotencyKey: params.triggerIdempotencyKey ?? null,\n })\n .onConflictDoNothing({target: workflowRuns.triggerIdempotencyKey})\n .returning();\n\n const runRow = insertResult[0];\n if (!runRow) {\n // Conflict path: skip jobs/steps/outbox so the first insert keeps ownership of side effects.\n if (!params.triggerIdempotencyKey) {\n throw new Error('Insert returned no rows');\n }\n const existing = await tx\n .select()\n .from(workflowRuns)\n .where(eq(workflowRuns.triggerIdempotencyKey, params.triggerIdempotencyKey))\n .limit(1);\n const existingRow = existing[0];\n if (!existingRow) {\n throw new Error(\n `Idempotency conflict but existing run missing for key ${params.triggerIdempotencyKey}`,\n );\n }\n return {run: toWorkflowRun(existingRow), created: false};\n }\n\n // Resolving run-creation templates and predicates here gives them a stable variable snapshot\n // and interpolation access to the inserted run id. Run-name resolution is display-only and\n // persists only a resolved override. If resolution fails, the transaction rolls back the run,\n // jobs, steps, and outbox event together. Listening steps are resolved later when a job\n // execution is created.\n const provisionalRun = toWorkflowRun(runRow);\n const oneShotJobs = params.model.jobs.filter((job) => job.mode !== 'listening');\n const vars = await loadReferencedVariables({\n model: params.model,\n jobs: oneShotJobs,\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n definitionId: params.definitionId,\n secrets: params.secrets,\n });\n const runNameResolution = resolveWorkflowRunName({\n runName: params.model.runName,\n context: assembleCreationContext({\n run: provisionalRun,\n triggerPayload: params.triggerPayload,\n inputs: params.inputs ?? null,\n vars,\n }).values,\n });\n const [resolvedRunRow] = await tx\n .update(workflowRuns)\n .set({name: runNameResolution.value, updatedAt: new Date()})\n .where(eq(workflowRuns.id, provisionalRun.id))\n .returning();\n if (!resolvedRunRow)\n throw new Error(`Workflow run missing after name resolution: ${runRow.id}`);\n const run = toWorkflowRun(resolvedRunRow);\n const [attemptRow] = await tx\n .insert(workflowRunAttempts)\n .values({\n workflowRunId: runRow.id,\n attempt: 1,\n status: 'pending',\n model: createWorkflowModelSnapshot(params.model),\n vars,\n agentToolMaterialization,\n })\n .returning();\n if (!attemptRow) throw new Error('Insert returned no rows');\n\n const materializedJobs = await materializeWorkflowRunJobs({\n run,\n model: params.model,\n triggerPayload: params.triggerPayload,\n inputs: params.inputs ?? null,\n vars,\n resolveAgentDefaults: params.resolveAgentDefaults,\n definitionId: params.definitionId,\n agentToolContext,\n agentToolSnapshot: agentToolMaterialization,\n });\n\n const graphJobs = materializeRunGraphJobs({\n params,\n run,\n vars,\n materializedJobs,\n });\n await persistMaterializedRunGraph(tx, {\n run,\n workflowRunAttempt: attemptRow,\n materializedJobs: graphJobs,\n });\n\n logTemplateDiagnostics({\n workflowRunId: runRow.id,\n diagnostics: materializedJobs.flatMap((job) =>\n job.steps.flatMap((step) =>\n (step.diagnostics ?? []).map((diagnostic) => ({\n jobKey: job.key,\n stepName: step.name,\n ...diagnostic,\n })),\n ),\n ),\n });\n\n return {\n run,\n created: true,\n nameDegradation: runNameResolution.degradation,\n };\n });\n\n if (result.created && result.nameDegradation !== undefined) {\n recordWorkflowDisplayNameResolutionDegraded('workflow.run_name', result.nameDegradation.cause);\n logger().warn(\n {\n workflowRunId: result.run.id,\n definitionId: result.run.definitionId,\n field: 'workflow.run_name',\n cause: result.nameDegradation.cause,\n ...(result.nameDegradation.expression === undefined\n ? {}\n : {expression: result.nameDegradation.expression.slice(0, 256)}),\n },\n 'Workflow run name resolution degraded to the static workflow name',\n );\n }\n\n if (result.created) {\n recordWorkflowRunCreated(result.run.triggerPayload.provider ?? result.run.triggerSource);\n }\n\n return result.run;\n}\n\nasync function allocateWorkflowRunNumber(tx: Tx, definitionId: string): Promise<number> {\n const [counterRow] = await tx\n .insert(workflowRunCounters)\n .values({definitionId, nextNumber: 2})\n .onConflictDoUpdate({\n target: workflowRunCounters.definitionId,\n set: {nextNumber: sql`${workflowRunCounters.nextNumber} + 1`},\n })\n .returning({number: sql<number>`${workflowRunCounters.nextNumber} - 1`});\n if (!counterRow) throw new Error('Run counter allocation returned no rows');\n return counterRow.number;\n}\n\nexport async function loadReferencedVariables(params: {\n readonly model: WorkflowModel;\n readonly jobs?: readonly WorkflowModelJob[] | undefined;\n readonly workspaceId: string;\n readonly projectId: string;\n readonly definitionId: string;\n readonly secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'> | undefined;\n}): Promise<Record<string, string> | undefined> {\n const references = referencedVariables(params.model, params.jobs ?? params.model.jobs);\n const keys = [...new Set(references.map((reference) => reference.key))].sort();\n if (keys.length === 0) return undefined;\n\n const requiresSecrets = (reference: ReferencedVariable) =>\n reference.field !== 'job.execution_name' && reference.field !== 'workflow.run_name';\n const requiredReferences = references.filter(requiresSecrets);\n const requiredKeys = new Set(requiredReferences.map((reference) => reference.key));\n if (!params.secrets) {\n if (requiredKeys.size === 0) return undefined;\n throw new Error('Secrets client is not configured.');\n }\n const {values: vars} = await params.secrets.getVariablesByNamespace({\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n namespace: '',\n });\n const missingKey = [...requiredKeys].find((key) => !(key in vars));\n if (missingKey !== undefined) {\n const reference = requiredReferences.find((candidate) => candidate.key === missingKey);\n throw new InterpolationUnresolvableError(params.definitionId, {\n field: reference?.field ?? 'env',\n source: reference?.source ?? `vars.${missingKey}`,\n ...(reference?.envKey === undefined ? {} : {envKey: reference.envKey}),\n });\n }\n\n const referencedVars: Record<string, string> = {};\n for (const key of keys) {\n const value = vars[key];\n if (value !== undefined) referencedVars[key] = value;\n }\n return referencedVars;\n}\n\nfunction materializeRunGraphJobs(params: {\n readonly params: CreateWorkflowRunParams;\n readonly run: WorkflowRun;\n readonly vars: Record<string, string> | undefined;\n readonly materializedJobs: readonly MaterializedWorkflowJob[];\n}): readonly MaterializedRunGraphJob[] {\n return params.materializedJobs.map((job, jobIndex) => ({\n job: {\n key: job.key,\n mode: job.mode,\n name: job.name ?? null,\n status: 'pending' as const,\n checkoutPersistCredentials: job.checkout.persistCredentials,\n checkoutPermissionsContents: job.checkout.permissions.contents,\n success: job.success ?? null,\n executionTimeoutMs: job.executionTimeoutMs ?? null,\n listeningTimeoutMs: job.listening?.timeoutMs ?? null,\n maxExecutions: job.listening?.maxExecutions ?? null,\n onResolve: job.listening?.onResolve ?? null,\n batchDebounceMs: job.listening?.batch?.debounceMs ?? null,\n batchMaxSize: job.listening?.batch?.maxSize ?? null,\n batchMaxWaitMs: job.listening?.batch?.maxWaitMs ?? null,\n listeningOn: job.listening?.on ? [...job.listening.on] : null,\n listeningUntil: job.listening?.until ? [...job.listening.until] : null,\n dependencies: [...job.dependencies],\n runner: job.runner.length === 0 ? null : [...job.runner],\n position: job.position,\n },\n createExecution: (jobRow) => {\n if (jobRow.mode === 'listening') return undefined;\n\n const fallbackName = jobRow.name ?? jobRow.key;\n const modelJob = params.params.model.jobs[jobIndex];\n if (!modelJob) return undefined;\n const executionPlan = deriveInitialJobExecutionPlan({\n run: params.run,\n modelJob,\n job,\n jobId: jobRow.id,\n sequence: 1,\n fallbackName,\n triggerPayload: params.params.triggerPayload,\n inputs: params.params.inputs ?? null,\n vars: params.vars,\n });\n\n return {\n sequence: 1,\n // Persist only the resolved override. The core entity supplies the\n // static job name/key when this is null.\n name: executionPlan.nameOverride,\n runner: [...executionPlan.runner],\n status: 'pending' as const,\n evaluationTrace:\n executionPlan.evaluationTrace?.length === 0 ? null : executionPlan.evaluationTrace,\n };\n },\n createSteps: () =>\n job.steps.map((step) => ({\n key: step.key,\n name: step.name,\n sourceLocation: step.sourceLocation,\n status: step.status,\n type: step.type,\n config: step.config,\n condition: step.condition ?? null,\n configPlan: step.configPlan ?? null,\n authoredConfig: step.authoredConfig,\n position: step.position,\n })),\n }));\n}\n\nfunction referencedVariables(\n model: WorkflowModel,\n jobs: readonly WorkflowModelJob[],\n): readonly ReferencedVariable[] {\n const references: ReferencedVariable[] = [];\n\n for (const job of model.jobs) {\n collectPredicateVariableReferences(job.if, references);\n collectPredicateVariableReferences(job.success, references);\n\n for (const trigger of [...(job.listening?.on ?? []), ...(job.listening?.until ?? [])]) {\n collectPredicateVariableReferences(trigger.filter, references);\n }\n\n for (const step of job.steps) {\n collectPredicateVariableReferences(step.if, references);\n collectPredicateVariableReferences(step.gate?.success, references);\n }\n }\n\n collectFieldVariableReferences(model.runName, references, {field: 'workflow.run_name'});\n\n if (jobs.length > 0) {\n collectTemplateVariableReferences(model.templates?.env, references);\n }\n\n for (const job of jobs) {\n collectFieldVariableReferences(job.executionName, references, {field: 'job.execution_name'});\n for (const template of job.runnerTemplates ?? []) {\n collectFieldVariableReferences(template, references, {field: 'job.runner'});\n }\n collectTemplateVariableReferences(job.outputs, references, {field: 'job.outputs'});\n collectTemplateVariableReferences(job.templates?.env, references);\n\n for (const step of job.steps) {\n collectFieldVariableReferences(step.templates?.name, references, {field: 'step.name'});\n collectFieldVariableReferences(step.templates?.workingDirectory, references, {\n field: 'step.working_directory',\n });\n if (step.kind === 'run') {\n collectFieldVariableReferences(step.templates?.command, references, {field: 'run'});\n collectTemplateVariableReferences(step.templates?.env, references);\n } else if (step.kind === 'agent') {\n collectFieldVariableReferences(step.templates?.prompt, references, {field: 'agent.prompt'});\n collectFieldVariableReferences(step.templates?.model, references, {field: 'agent.model'});\n collectFieldVariableReferences(step.templates?.provider, references, {\n field: 'agent.provider',\n });\n } else if (step.kind === 'checkout') {\n for (const [key, field] of WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS) {\n collectFieldVariableReferences(step.checkout.templates?.[key], references, {field});\n }\n }\n }\n }\n\n return references;\n}\n\nfunction collectPredicateVariableReferences(\n expression: WorkflowExpression | string | undefined,\n references: ReferencedVariable[],\n): void {\n if (expression === undefined) return;\n\n const keyAccess = analyzeContextKeyAccess(expression);\n for (const reference of keyAccess.references) {\n if (reference.root !== 'vars') continue;\n references.push({\n key: reference.key,\n field: 'env',\n source: typeof expression === 'string' ? expression : expression.source,\n });\n }\n}\n\nfunction collectTemplateVariableReferences(\n templates: Readonly<Record<string, readonly ResolvedFieldSegment[]>> | undefined,\n references: ReferencedVariable[],\n source?: {\n readonly field: InterpolationUnresolvableError['field'];\n },\n): void {\n for (const [envKey, template] of Object.entries(templates ?? {})) {\n collectFieldVariableReferences(\n template,\n references,\n source === undefined ? {field: 'env', envKey} : source,\n );\n }\n}\n\nfunction collectFieldVariableReferences(\n template: readonly ResolvedFieldSegment[] | undefined,\n references: ReferencedVariable[],\n source: {\n readonly field: InterpolationUnresolvableError['field'];\n readonly envKey?: string | undefined;\n },\n): void {\n for (const segment of template ?? []) {\n if (segment.kind === 'literal') continue;\n const keyAccess = analyzeContextKeyAccess(segment.expression);\n for (const reference of keyAccess.references) {\n if (reference.root !== 'vars') continue;\n references.push({\n key: reference.key,\n field: source.field,\n source: segment.expression.source,\n envKey: source.envKey,\n });\n }\n }\n}\n\nfunction logTemplateDiagnostics(params: {\n readonly workflowRunId: string;\n readonly diagnostics: readonly (WorkflowStepTemplateDiagnostic & {\n readonly jobKey: string;\n readonly stepName: string;\n })[];\n}): void {\n if (params.diagnostics.length === 0) return;\n\n logger().warn(\n {workflowRunId: params.workflowRunId, diagnostics: params.diagnostics},\n 'Workflow interpolation resolved with diagnostics',\n );\n}\n"],"names":["createWorkflowModelSnapshot","WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS","analyzeContextKeyAccess","logger","eq","sql","createAgentToolMaterializationSnapshot","loadAgentToolMaterializationContext","InterpolationUnresolvableError","resolveWorkflowRunTriggerReference","assembleCreationContext","resolveWorkflowRunName","deriveInitialJobExecutionPlan","materializeWorkflowRunJobs","recordWorkflowDisplayNameResolutionDegraded","recordWorkflowRunCreated","db","workflowRunAttempts","workflowRunCounters","toWorkflowRun","workflowRuns","persistMaterializedRunGraph","createWorkflowRun","params","triggerReference","workspaceId","triggerConnectionId","triggerPayload","integrations","projects","staticName","name","model","agentToolContext","undefined","projectId","agentToolMaterialization","context","result","transaction","tx","triggerIdempotencyKey","execute","existing","select","from","where","limit","existingRow","run","created","number","allocateWorkflowRunNumber","definitionId","insertResult","insert","values","workflowName","status","currentAttempt","triggerProvider","provider","triggerSource","source","triggerEvent","event","inputs","sourceSnapshot","onConflictDoNothing","target","returning","runRow","Error","provisionalRun","oneShotJobs","jobs","filter","job","mode","vars","loadReferencedVariables","secrets","runNameResolution","runName","resolvedRunRow","update","set","value","updatedAt","Date","id","attemptRow","workflowRunId","attempt","materializedJobs","resolveAgentDefaults","agentToolSnapshot","graphJobs","materializeRunGraphJobs","workflowRunAttempt","logTemplateDiagnostics","diagnostics","flatMap","steps","step","map","diagnostic","jobKey","key","stepName","nameDegradation","degradation","cause","warn","field","expression","slice","counterRow","nextNumber","onConflictDoUpdate","references","referencedVariables","keys","Set","reference","sort","length","requiresSecrets","requiredReferences","requiredKeys","size","getVariablesByNamespace","namespace","missingKey","find","candidate","envKey","referencedVars","jobIndex","checkoutPersistCredentials","checkout","persistCredentials","checkoutPermissionsContents","permissions","contents","success","executionTimeoutMs","listeningTimeoutMs","listening","timeoutMs","maxExecutions","onResolve","batchDebounceMs","batch","debounceMs","batchMaxSize","maxSize","batchMaxWaitMs","maxWaitMs","listeningOn","on","listeningUntil","until","dependencies","runner","position","createExecution","jobRow","fallbackName","modelJob","executionPlan","jobId","sequence","nameOverride","evaluationTrace","createSteps","sourceLocation","type","config","condition","configPlan","authoredConfig","collectPredicateVariableReferences","if","trigger","gate","collectFieldVariableReferences","collectTemplateVariableReferences","templates","env","executionName","template","runnerTemplates","outputs","workingDirectory","kind","command","prompt","keyAccess","root","push","Object","entries","segment"],"mappings":"AAAA,SACEA,2BAA2B,EAC3BC,qCAAqC,QAEhC,+BA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MAGC;IAED,KAAK,MAAM4I,WAAWZ,YAAY,EAAE,CAAE;QACpC,IAAIY,QAAQR,IAAI,KAAK,WAAW;QAChC,MAAMG,YAAYpM,wBAAwByM,QAAQxF,UAAU;QAC5D,KAAK,MAAMS,aAAa0E,UAAU9E,UAAU,CAAE;YAC5C,IAAII,UAAU2E,IAAI,KAAK,QAAQ;YAC/B/E,WAAWgF,IAAI,CAAC;gBACd5F,KAAKgB,UAAUhB,GAAG;gBAClBM,OAAOnD,OAAOmD,KAAK;gBACnBnD,QAAQ4I,QAAQxF,UAAU,CAACpD,MAAM;gBACjCyE,QAAQzE,OAAOyE,MAAM;YACvB;QACF;IACF;AACF;AAEA,SAASpC,uBAAuB7E,MAM/B;IACC,IAAIA,OAAO8E,WAAW,CAACyB,MAAM,KAAK,GAAG;IAErC3H,SAAS8G,IAAI,CACX;QAACrB,eAAerE,OAAOqE,aAAa;QAAES,aAAa9E,OAAO8E,WAAW;IAAA,GACrE;AAEJ"}
|
|
1
|
+
{"version":3,"sources":["../../../src/db/workflow-runs/run-create.ts"],"sourcesContent":["import {\n createWorkflowModelSnapshot,\n WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS,\n type WorkflowModel,\n} from '@shipfox/api-definitions-dto';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {\n analyzeContextKeyAccess,\n type ResolvedFieldSegment,\n type WorkflowExpression,\n} from '@shipfox/expression';\nimport {logger} from '@shipfox/node-opentelemetry';\nimport {eq, sql} from 'drizzle-orm';\nimport type {AgentDefaultsResolver} from '#core/agent-defaults.js';\nimport {\n createAgentToolMaterializationSnapshot,\n loadAgentToolMaterializationContext,\n} from '#core/agent-tools.js';\nimport type {\n TriggerPayload,\n WorkflowRun,\n WorkflowRunDevSource,\n WorkflowRunOrigin,\n WorkflowSourceSnapshot,\n} from '#core/entities/workflow-run.js';\nimport {InterpolationUnresolvableError} from '#core/errors.js';\nimport {resolveWorkflowRunTriggerReference} from '#core/resolve-trigger-reference.js';\nimport {assembleCreationContext} from '#core/step-config/assemble-run-context.js';\nimport type {MaterializedWorkflowJob} from '#core/step-config/materialize-workflow-model.js';\nimport type {WorkflowStepTemplateDiagnostic} from '#core/step-config/resolve-step-config.js';\nimport {resolveWorkflowRunName} from '#core/step-config/resolve-workflow-run-name.js';\nimport {\n deriveInitialJobExecutionPlan,\n materializeWorkflowRunJobs,\n} from '#core/workflow-run-creation.js';\nimport {\n recordWorkflowDisplayNameResolutionDegraded,\n recordWorkflowRunCreated,\n} from '#metrics/instance.js';\nimport {db, type Tx} from '../db.js';\nimport {workflowRunAttempts} from '../schema/workflow-run-attempts.js';\nimport {workflowRunCounters} from '../schema/workflow-run-counters.js';\nimport {toWorkflowRun, type WorkflowRunDevSourceDb, workflowRuns} from '../schema/workflow-runs.js';\nimport {type MaterializedRunGraphJob, persistMaterializedRunGraph} from './run-graph.js';\n\nexport type WorkflowModelJob = WorkflowModel['jobs'][number];\n\nexport interface ReferencedVariable {\n readonly key: string;\n readonly field: InterpolationUnresolvableError['field'];\n readonly source: string;\n readonly envKey?: string | undefined;\n}\n\nexport interface CreateWorkflowRunParams {\n workspaceId: string;\n projectId: string;\n definitionId: string;\n name?: string | undefined;\n model: WorkflowModel;\n triggerPayload: TriggerPayload;\n triggerConnectionId?: string | undefined;\n inputs?: Record<string, unknown> | undefined;\n sourceSnapshot?: WorkflowSourceSnapshot | null | undefined;\n triggerIdempotencyKey?: string | undefined;\n /** Run provenance. Defaults to a synced run with no dev source. */\n origin?: WorkflowRunOrigin | undefined;\n devSource?: WorkflowRunDevSource | null | undefined;\n resolveAgentDefaults?: AgentDefaultsResolver | undefined;\n secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'> | undefined;\n integrations?: IntegrationsModuleClient | undefined;\n projects?: ProjectsModuleClient | undefined;\n}\n\nexport async function createWorkflowRun(params: CreateWorkflowRunParams): Promise<WorkflowRun> {\n const triggerReference = await resolveWorkflowRunTriggerReference({\n workspaceId: params.workspaceId,\n triggerConnectionId: params.triggerConnectionId,\n triggerPayload: params.triggerPayload,\n integrations: params.integrations,\n projects: params.projects,\n });\n const staticName = params.name ?? params.model.name;\n const agentToolContext =\n params.integrations === undefined\n ? undefined\n : await loadAgentToolMaterializationContext({\n model: params.model,\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n integrations: params.integrations,\n projects: params.projects,\n });\n const agentToolMaterialization = createAgentToolMaterializationSnapshot({\n model: params.model,\n context: agentToolContext,\n });\n const result = await db().transaction(async (tx) => {\n // Serialize idempotent trigger resolution separately from per-definition number\n // allocation so a replay never consumes a number, including when two deliveries\n // race before either run is visible.\n if (params.triggerIdempotencyKey) {\n await tx.execute(\n sql`select pg_advisory_xact_lock(hashtext(${params.triggerIdempotencyKey}))`,\n );\n const existing = await tx\n .select()\n .from(workflowRuns)\n .where(eq(workflowRuns.triggerIdempotencyKey, params.triggerIdempotencyKey))\n .limit(1);\n const existingRow = existing[0];\n if (existingRow) return {run: toWorkflowRun(existingRow), created: false};\n }\n\n // Keep allocation on the existing transaction so a trigger burst cannot pin\n // every pool connection and then wait for a second connection per run.\n const number = await allocateWorkflowRunNumber(tx, params.definitionId);\n\n const insertResult = await tx\n .insert(workflowRuns)\n .values({\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n definitionId: params.definitionId,\n number,\n name: null,\n workflowName: staticName,\n status: 'pending',\n currentAttempt: 1,\n triggerProvider: params.triggerPayload.provider ?? null,\n triggerSource: params.triggerPayload.source,\n triggerEvent: params.triggerPayload.event,\n triggerPayload: params.triggerPayload,\n triggerReference,\n inputs: params.inputs ?? null,\n sourceSnapshot: params.sourceSnapshot ?? null,\n triggerIdempotencyKey: params.triggerIdempotencyKey ?? null,\n origin: params.origin ?? 'synced',\n devSource:\n params.devSource === undefined || params.devSource === null\n ? null\n : toWorkflowRunDevSourceDb(params.devSource),\n })\n .onConflictDoNothing({target: workflowRuns.triggerIdempotencyKey})\n .returning();\n\n const runRow = insertResult[0];\n if (!runRow) {\n // Conflict path: skip jobs/steps/outbox so the first insert keeps ownership of side effects.\n if (!params.triggerIdempotencyKey) {\n throw new Error('Insert returned no rows');\n }\n const existing = await tx\n .select()\n .from(workflowRuns)\n .where(eq(workflowRuns.triggerIdempotencyKey, params.triggerIdempotencyKey))\n .limit(1);\n const existingRow = existing[0];\n if (!existingRow) {\n throw new Error(\n `Idempotency conflict but existing run missing for key ${params.triggerIdempotencyKey}`,\n );\n }\n return {run: toWorkflowRun(existingRow), created: false};\n }\n\n // Resolving run-creation templates and predicates here gives them a stable variable snapshot\n // and interpolation access to the inserted run id. Run-name resolution is display-only and\n // persists only a resolved override. If resolution fails, the transaction rolls back the run,\n // jobs, steps, and outbox event together. Listening steps are resolved later when a job\n // execution is created.\n const provisionalRun = toWorkflowRun(runRow);\n const oneShotJobs = params.model.jobs.filter((job) => job.mode !== 'listening');\n const vars = await loadReferencedVariables({\n model: params.model,\n jobs: oneShotJobs,\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n definitionId: params.definitionId,\n secrets: params.secrets,\n });\n const runNameResolution = resolveWorkflowRunName({\n runName: params.model.runName,\n context: assembleCreationContext({\n run: provisionalRun,\n triggerPayload: params.triggerPayload,\n inputs: params.inputs ?? null,\n vars,\n }).values,\n });\n const [resolvedRunRow] = await tx\n .update(workflowRuns)\n .set({name: runNameResolution.value, updatedAt: new Date()})\n .where(eq(workflowRuns.id, provisionalRun.id))\n .returning();\n if (!resolvedRunRow)\n throw new Error(`Workflow run missing after name resolution: ${runRow.id}`);\n const run = toWorkflowRun(resolvedRunRow);\n const [attemptRow] = await tx\n .insert(workflowRunAttempts)\n .values({\n workflowRunId: runRow.id,\n attempt: 1,\n status: 'pending',\n model: createWorkflowModelSnapshot(params.model),\n vars,\n agentToolMaterialization,\n })\n .returning();\n if (!attemptRow) throw new Error('Insert returned no rows');\n\n const materializedJobs = await materializeWorkflowRunJobs({\n run,\n model: params.model,\n triggerPayload: params.triggerPayload,\n inputs: params.inputs ?? null,\n vars,\n resolveAgentDefaults: params.resolveAgentDefaults,\n definitionId: params.definitionId,\n agentToolContext,\n agentToolSnapshot: agentToolMaterialization,\n });\n\n const graphJobs = materializeRunGraphJobs({\n params,\n run,\n vars,\n materializedJobs,\n });\n await persistMaterializedRunGraph(tx, {\n run,\n workflowRunAttempt: attemptRow,\n materializedJobs: graphJobs,\n });\n\n logTemplateDiagnostics({\n workflowRunId: runRow.id,\n diagnostics: materializedJobs.flatMap((job) =>\n job.steps.flatMap((step) =>\n (step.diagnostics ?? []).map((diagnostic) => ({\n jobKey: job.key,\n stepName: step.name,\n ...diagnostic,\n })),\n ),\n ),\n });\n\n return {\n run,\n created: true,\n nameDegradation: runNameResolution.degradation,\n };\n });\n\n if (result.created && result.nameDegradation !== undefined) {\n recordWorkflowDisplayNameResolutionDegraded('workflow.run_name', result.nameDegradation.cause);\n logger().warn(\n {\n workflowRunId: result.run.id,\n definitionId: result.run.definitionId,\n field: 'workflow.run_name',\n cause: result.nameDegradation.cause,\n ...(result.nameDegradation.expression === undefined\n ? {}\n : {expression: result.nameDegradation.expression.slice(0, 256)}),\n },\n 'Workflow run name resolution degraded to the static workflow name',\n );\n }\n\n if (result.created) {\n recordWorkflowRunCreated(result.run.triggerPayload.provider ?? result.run.triggerSource);\n }\n\n return result.run;\n}\n\nasync function allocateWorkflowRunNumber(tx: Tx, definitionId: string): Promise<number> {\n const [counterRow] = await tx\n .insert(workflowRunCounters)\n .values({definitionId, nextNumber: 2})\n .onConflictDoUpdate({\n target: workflowRunCounters.definitionId,\n set: {nextNumber: sql`${workflowRunCounters.nextNumber} + 1`},\n })\n .returning({number: sql<number>`${workflowRunCounters.nextNumber} - 1`});\n if (!counterRow) throw new Error('Run counter allocation returned no rows');\n return counterRow.number;\n}\n\n// The run entity carries camelCase dev-source fields while the persisted jsonb uses\n// snake_case keys, so the write boundary maps explicitly rather than spreading.\nfunction toWorkflowRunDevSourceDb(source: WorkflowRunDevSource): WorkflowRunDevSourceDb {\n return {\n ref: source.ref,\n commit: source.commit,\n config_path: source.configPath,\n initiated_by_user_id: source.initiatedByUserId,\n replay_of_event_id: source.replayOfEventId,\n };\n}\n\nexport async function loadReferencedVariables(params: {\n readonly model: WorkflowModel;\n readonly jobs?: readonly WorkflowModelJob[] | undefined;\n readonly workspaceId: string;\n readonly projectId: string;\n readonly definitionId: string;\n readonly secrets?: Pick<SecretsInterModuleClient, 'getVariablesByNamespace'> | undefined;\n}): Promise<Record<string, string> | undefined> {\n const references = referencedVariables(params.model, params.jobs ?? params.model.jobs);\n const keys = [...new Set(references.map((reference) => reference.key))].sort();\n if (keys.length === 0) return undefined;\n\n const requiresSecrets = (reference: ReferencedVariable) =>\n reference.field !== 'job.execution_name' && reference.field !== 'workflow.run_name';\n const requiredReferences = references.filter(requiresSecrets);\n const requiredKeys = new Set(requiredReferences.map((reference) => reference.key));\n if (!params.secrets) {\n if (requiredKeys.size === 0) return undefined;\n throw new Error('Secrets client is not configured.');\n }\n const {values: vars} = await params.secrets.getVariablesByNamespace({\n workspaceId: params.workspaceId,\n projectId: params.projectId,\n namespace: '',\n });\n const missingKey = [...requiredKeys].find((key) => !(key in vars));\n if (missingKey !== undefined) {\n const reference = requiredReferences.find((candidate) => candidate.key === missingKey);\n throw new InterpolationUnresolvableError(params.definitionId, {\n field: reference?.field ?? 'env',\n source: reference?.source ?? `vars.${missingKey}`,\n ...(reference?.envKey === undefined ? {} : {envKey: reference.envKey}),\n });\n }\n\n const referencedVars: Record<string, string> = {};\n for (const key of keys) {\n const value = vars[key];\n if (value !== undefined) referencedVars[key] = value;\n }\n return referencedVars;\n}\n\nfunction materializeRunGraphJobs(params: {\n readonly params: CreateWorkflowRunParams;\n readonly run: WorkflowRun;\n readonly vars: Record<string, string> | undefined;\n readonly materializedJobs: readonly MaterializedWorkflowJob[];\n}): readonly MaterializedRunGraphJob[] {\n return params.materializedJobs.map((job, jobIndex) => ({\n job: {\n key: job.key,\n mode: job.mode,\n name: job.name ?? null,\n status: 'pending' as const,\n checkoutPersistCredentials: job.checkout.persistCredentials,\n checkoutPermissionsContents: job.checkout.permissions.contents,\n success: job.success ?? null,\n executionTimeoutMs: job.executionTimeoutMs ?? null,\n listeningTimeoutMs: job.listening?.timeoutMs ?? null,\n maxExecutions: job.listening?.maxExecutions ?? null,\n onResolve: job.listening?.onResolve ?? null,\n batchDebounceMs: job.listening?.batch?.debounceMs ?? null,\n batchMaxSize: job.listening?.batch?.maxSize ?? null,\n batchMaxWaitMs: job.listening?.batch?.maxWaitMs ?? null,\n listeningOn: job.listening?.on ? [...job.listening.on] : null,\n listeningUntil: job.listening?.until ? [...job.listening.until] : null,\n dependencies: [...job.dependencies],\n runner: job.runner.length === 0 ? null : [...job.runner],\n position: job.position,\n },\n createExecution: (jobRow) => {\n if (jobRow.mode === 'listening') return undefined;\n\n const fallbackName = jobRow.name ?? jobRow.key;\n const modelJob = params.params.model.jobs[jobIndex];\n if (!modelJob) return undefined;\n const executionPlan = deriveInitialJobExecutionPlan({\n run: params.run,\n modelJob,\n job,\n jobId: jobRow.id,\n sequence: 1,\n fallbackName,\n triggerPayload: params.params.triggerPayload,\n inputs: params.params.inputs ?? null,\n vars: params.vars,\n });\n\n return {\n sequence: 1,\n // Persist only the resolved override. The core entity supplies the\n // static job name/key when this is null.\n name: executionPlan.nameOverride,\n runner: [...executionPlan.runner],\n status: 'pending' as const,\n evaluationTrace:\n executionPlan.evaluationTrace?.length === 0 ? null : executionPlan.evaluationTrace,\n };\n },\n createSteps: () =>\n job.steps.map((step) => ({\n key: step.key,\n name: step.name,\n sourceLocation: step.sourceLocation,\n status: step.status,\n type: step.type,\n config: step.config,\n condition: step.condition ?? null,\n configPlan: step.configPlan ?? null,\n authoredConfig: step.authoredConfig,\n position: step.position,\n })),\n }));\n}\n\nfunction referencedVariables(\n model: WorkflowModel,\n jobs: readonly WorkflowModelJob[],\n): readonly ReferencedVariable[] {\n const references: ReferencedVariable[] = [];\n\n for (const job of model.jobs) {\n collectPredicateVariableReferences(job.if, references);\n collectPredicateVariableReferences(job.success, references);\n\n for (const trigger of [...(job.listening?.on ?? []), ...(job.listening?.until ?? [])]) {\n collectPredicateVariableReferences(trigger.filter, references);\n }\n\n for (const step of job.steps) {\n collectPredicateVariableReferences(step.if, references);\n collectPredicateVariableReferences(step.gate?.success, references);\n }\n }\n\n collectFieldVariableReferences(model.runName, references, {field: 'workflow.run_name'});\n\n if (jobs.length > 0) {\n collectTemplateVariableReferences(model.templates?.env, references);\n }\n\n for (const job of jobs) {\n collectFieldVariableReferences(job.executionName, references, {field: 'job.execution_name'});\n for (const template of job.runnerTemplates ?? []) {\n collectFieldVariableReferences(template, references, {field: 'job.runner'});\n }\n collectTemplateVariableReferences(job.outputs, references, {field: 'job.outputs'});\n collectTemplateVariableReferences(job.templates?.env, references);\n\n for (const step of job.steps) {\n collectFieldVariableReferences(step.templates?.name, references, {field: 'step.name'});\n collectFieldVariableReferences(step.templates?.workingDirectory, references, {\n field: 'step.working_directory',\n });\n if (step.kind === 'run') {\n collectFieldVariableReferences(step.templates?.command, references, {field: 'run'});\n collectTemplateVariableReferences(step.templates?.env, references);\n } else if (step.kind === 'agent') {\n collectFieldVariableReferences(step.templates?.prompt, references, {field: 'agent.prompt'});\n collectFieldVariableReferences(step.templates?.model, references, {field: 'agent.model'});\n collectFieldVariableReferences(step.templates?.provider, references, {\n field: 'agent.provider',\n });\n } else if (step.kind === 'checkout') {\n for (const [key, field] of WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS) {\n collectFieldVariableReferences(step.checkout.templates?.[key], references, {field});\n }\n }\n }\n }\n\n return references;\n}\n\nfunction collectPredicateVariableReferences(\n expression: WorkflowExpression | string | undefined,\n references: ReferencedVariable[],\n): void {\n if (expression === undefined) return;\n\n const keyAccess = analyzeContextKeyAccess(expression);\n for (const reference of keyAccess.references) {\n if (reference.root !== 'vars') continue;\n references.push({\n key: reference.key,\n field: 'env',\n source: typeof expression === 'string' ? expression : expression.source,\n });\n }\n}\n\nfunction collectTemplateVariableReferences(\n templates: Readonly<Record<string, readonly ResolvedFieldSegment[]>> | undefined,\n references: ReferencedVariable[],\n source?: {\n readonly field: InterpolationUnresolvableError['field'];\n },\n): void {\n for (const [envKey, template] of Object.entries(templates ?? {})) {\n collectFieldVariableReferences(\n template,\n references,\n source === undefined ? {field: 'env', envKey} : source,\n );\n }\n}\n\nfunction collectFieldVariableReferences(\n template: readonly ResolvedFieldSegment[] | undefined,\n references: ReferencedVariable[],\n source: {\n readonly field: InterpolationUnresolvableError['field'];\n readonly envKey?: string | undefined;\n },\n): void {\n for (const segment of template ?? []) {\n if (segment.kind === 'literal') continue;\n const keyAccess = analyzeContextKeyAccess(segment.expression);\n for (const reference of keyAccess.references) {\n if (reference.root !== 'vars') continue;\n references.push({\n key: reference.key,\n field: source.field,\n source: segment.expression.source,\n envKey: source.envKey,\n });\n }\n }\n}\n\nfunction logTemplateDiagnostics(params: {\n readonly workflowRunId: string;\n readonly diagnostics: readonly (WorkflowStepTemplateDiagnostic & {\n readonly jobKey: string;\n readonly stepName: string;\n })[];\n}): void {\n if (params.diagnostics.length === 0) return;\n\n logger().warn(\n {workflowRunId: params.workflowRunId, diagnostics: params.diagnostics},\n 'Workflow interpolation resolved with diagnostics',\n );\n}\n"],"names":["createWorkflowModelSnapshot","WORKFLOW_MODEL_CHECKOUT_TARGET_FIELDS","analyzeContextKeyAccess","logger","eq","sql","createAgentToolMaterializationSnapshot","loadAgentToolMaterializationContext","InterpolationUnresolvableError","resolveWorkflowRunTriggerReference","assembleCreationContext","resolveWorkflowRunName","deriveInitialJobExecutionPlan","materializeWorkflowRunJobs","recordWorkflowDisplayNameResolutionDegraded","recordWorkflowRunCreated","db","workflowRunAttempts","workflowRunCounters","toWorkflowRun","workflowRuns","persistMaterializedRunGraph","createWorkflowRun","params","triggerReference","workspaceId","triggerConnectionId","triggerPayload","integrations","projects","staticName","name","model","agentToolContext","undefined","projectId","agentToolMaterialization","context","result","transaction","tx","triggerIdempotencyKey","execute","existing","select","from","where","limit","existingRow","run","created","number","allocateWorkflowRunNumber","definitionId","insertResult","insert","values","workflowName","status","currentAttempt","triggerProvider","provider","triggerSource","source","triggerEvent","event","inputs","sourceSnapshot","origin","devSource","toWorkflowRunDevSourceDb","onConflictDoNothing","target","returning","runRow","Error","provisionalRun","oneShotJobs","jobs","filter","job","mode","vars","loadReferencedVariables","secrets","runNameResolution","runName","resolvedRunRow","update","set","value","updatedAt","Date","id","attemptRow","workflowRunId","attempt","materializedJobs","resolveAgentDefaults","agentToolSnapshot","graphJobs","materializeRunGraphJobs","workflowRunAttempt","logTemplateDiagnostics","diagnostics","flatMap","steps","step","map","diagnostic","jobKey","key","stepName","nameDegradation","degradation","cause","warn","field","expression","slice","counterRow","nextNumber","onConflictDoUpdate","ref","commit","config_path","configPath","initiated_by_user_id","initiatedByUserId","replay_of_event_id","replayOfEventId","references","referencedVariables","keys","Set","reference","sort","length","requiresSecrets","requiredReferences","requiredKeys","size","getVariablesByNamespace","namespace","missingKey","find","candidate","envKey","referencedVars","jobIndex","checkoutPersistCredentials","checkout","persistCredentials","checkoutPermissionsContents","permissions","contents","success","executionTimeoutMs","listeningTimeoutMs","listening","timeoutMs","maxExecutions","onResolve","batchDebounceMs","batch","debounceMs","batchMaxSize","maxSize","batchMaxWaitMs","maxWaitMs","listeningOn","on","listeningUntil","until","dependencies","runner","position","createExecution","jobRow","fallbackName","modelJob","executionPlan","jobId","sequence","nameOverride","evaluationTrace","createSteps","sourceLocation","type","config","condition","configPlan","authoredConfig","collectPredicateVariableReferences","if","trigger","gate","collectFieldVariableReferences","collectTemplateVariableReferences","templates","env","executionName","template","runnerTemplates","outputs","workingDirectory","kind","command","prompt","keyAccess","root","push","Object","entries","segment"],"mappings":"AAAA,SACEA,2BAA2B,EAC3BC,qCAAqC,QAEhC,+BAA+B;AAItC,SACEC,uBAAuB,QAGlB,sBAAsB;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YAClBM,OAAO;YACPtD,QAAQ,OAAOuD,eAAe,WAAWA,aAAaA,WAAWvD,MAAM;QACzE;IACF;AACF;AAEA,SAASuI,kCACPC,SAAgF,EAChFpE,UAAgC,EAChCpE,MAEC;IAED,KAAK,MAAM,CAACoF,QAAQuD,SAAS,IAAIU,OAAOC,OAAO,CAACd,aAAa,CAAC,GAAI;QAChEF,+BACEK,UACAvE,YACApE,WAAW7B,YAAY;YAACmF,OAAO;YAAO8B;QAAM,IAAIpF;IAEpD;AACF;AAEA,SAASsI,+BACPK,QAAqD,EACrDvE,UAAgC,EAChCpE,MAGC;IAED,KAAK,MAAMuJ,WAAWZ,YAAY,EAAE,CAAE;QACpC,IAAIY,QAAQR,IAAI,KAAK,WAAW;QAChC,MAAMG,YAAY/M,wBAAwBoN,QAAQhG,UAAU;QAC5D,KAAK,MAAMiB,aAAa0E,UAAU9E,UAAU,CAAE;YAC5C,IAAII,UAAU2E,IAAI,KAAK,QAAQ;YAC/B/E,WAAWgF,IAAI,CAAC;gBACdpG,KAAKwB,UAAUxB,GAAG;gBAClBM,OAAOtD,OAAOsD,KAAK;gBACnBtD,QAAQuJ,QAAQhG,UAAU,CAACvD,MAAM;gBACjCoF,QAAQpF,OAAOoF,MAAM;YACvB;QACF;IACF;AACF;AAEA,SAAS5C,uBAAuBhF,MAM/B;IACC,IAAIA,OAAOiF,WAAW,CAACiC,MAAM,KAAK,GAAG;IAErCtI,SAASiH,IAAI,CACX;QAACrB,eAAexE,OAAOwE,aAAa;QAAES,aAAajF,OAAOiF,WAAW;IAAA,GACrE;AAEJ"}
|
|
@@ -17,4 +17,5 @@ export declare function createWorkflowsInterModulePresentation(params: {
|
|
|
17
17
|
projects: ProjectsModuleClient;
|
|
18
18
|
}): InterModulePresentation<typeof workflowsInterModuleContract>;
|
|
19
19
|
export declare function toStartRunKnownError(error: unknown, definitionId: string): unknown;
|
|
20
|
+
export declare function toStartDevRunKnownError(error: unknown): unknown;
|
|
20
21
|
//# sourceMappingURL=inter-module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inter-module.d.ts","sourceRoot":"","sources":["../../src/presentation/inter-module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,2CAA2C,CAAC;AAC5F,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAC,4BAA4B,EAAC,MAAM,yCAAyC,CAAC;AACrF,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"inter-module.d.ts","sourceRoot":"","sources":["../../src/presentation/inter-module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,2CAA2C,CAAC;AAC5F,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAC,4BAA4B,EAAC,MAAM,yCAAyC,CAAC;AACrF,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAIL,KAAK,uBA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