@ajna-inc/workflow 0.5.38 → 0.6.2
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/.npmvc/attestations.jsonld +43 -0
- package/.npmvc/sbom.cdx.json +23758 -0
- package/LICENSE +202 -0
- package/build/WorkflowEvents.d.mts +40 -0
- package/build/WorkflowEvents.d.mts.map +1 -0
- package/build/WorkflowEvents.mjs +11 -0
- package/build/WorkflowEvents.mjs.map +1 -0
- package/build/WorkflowModule.d.mts +17 -0
- package/build/WorkflowModule.d.mts.map +1 -0
- package/build/WorkflowModule.mjs +446 -0
- package/build/WorkflowModule.mjs.map +1 -0
- package/build/WorkflowModuleConfig.d.mts +39 -0
- package/build/WorkflowModuleConfig.d.mts.map +1 -0
- package/build/WorkflowModuleConfig.mjs +19 -0
- package/build/WorkflowModuleConfig.mjs.map +1 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorate.mjs +14 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateMetadata.mjs +11 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateParam.mjs +9 -0
- package/build/_virtual/rolldown_runtime.mjs +41 -0
- package/build/actions/ActionRegistry.d.mts +64 -0
- package/build/actions/ActionRegistry.d.mts.map +1 -0
- package/build/actions/ActionRegistry.mjs +304 -0
- package/build/actions/ActionRegistry.mjs.map +1 -0
- package/build/api/WorkflowApi.d.mts +99 -0
- package/build/api/WorkflowApi.d.mts.map +1 -0
- package/build/api/WorkflowApi.mjs +228 -0
- package/build/api/WorkflowApi.mjs.map +1 -0
- package/build/engine/AttributePlanner.d.mts +12 -0
- package/build/engine/AttributePlanner.d.mts.map +1 -0
- package/build/engine/AttributePlanner.mjs +58 -0
- package/build/engine/AttributePlanner.mjs.map +1 -0
- package/build/engine/GuardEvaluator.d.mts +16 -0
- package/build/engine/GuardEvaluator.d.mts.map +1 -0
- package/build/engine/GuardEvaluator.mjs +38 -0
- package/build/engine/GuardEvaluator.mjs.map +1 -0
- package/build/index.d.mts +46 -0
- package/build/index.mjs +53 -0
- package/build/index.mjs.map +1 -0
- package/build/model/TemplateValidation.d.mts +8 -0
- package/build/model/TemplateValidation.d.mts.map +1 -0
- package/build/model/TemplateValidation.mjs +278 -0
- package/build/model/TemplateValidation.mjs.map +1 -0
- package/build/model/types.d.mts +120 -0
- package/build/model/types.d.mts.map +1 -0
- package/build/model/types.mjs +11 -0
- package/build/model/types.mjs.map +1 -0
- package/build/protocol/WorkflowMessageTypes.d.mts +19 -0
- package/build/protocol/WorkflowMessageTypes.d.mts.map +1 -0
- package/build/protocol/WorkflowMessageTypes.mjs +20 -0
- package/build/protocol/WorkflowMessageTypes.mjs.map +1 -0
- package/build/protocol/handlers/AdvanceHandler.d.mts +16 -0
- package/build/protocol/handlers/AdvanceHandler.d.mts.map +1 -0
- package/build/protocol/handlers/AdvanceHandler.mjs +148 -0
- package/build/protocol/handlers/AdvanceHandler.mjs.map +1 -0
- package/build/protocol/handlers/CancelHandler.d.mts +16 -0
- package/build/protocol/handlers/CancelHandler.d.mts.map +1 -0
- package/build/protocol/handlers/CancelHandler.mjs +103 -0
- package/build/protocol/handlers/CancelHandler.mjs.map +1 -0
- package/build/protocol/handlers/CompleteHandler.d.mts +16 -0
- package/build/protocol/handlers/CompleteHandler.d.mts.map +1 -0
- package/build/protocol/handlers/CompleteHandler.mjs +103 -0
- package/build/protocol/handlers/CompleteHandler.mjs.map +1 -0
- package/build/protocol/handlers/DiscoverHandler.d.mts +15 -0
- package/build/protocol/handlers/DiscoverHandler.d.mts.map +1 -0
- package/build/protocol/handlers/DiscoverHandler.mjs +73 -0
- package/build/protocol/handlers/DiscoverHandler.mjs.map +1 -0
- package/build/protocol/handlers/FetchTemplateHandler.d.mts +16 -0
- package/build/protocol/handlers/FetchTemplateHandler.d.mts.map +1 -0
- package/build/protocol/handlers/FetchTemplateHandler.mjs +64 -0
- package/build/protocol/handlers/FetchTemplateHandler.mjs.map +1 -0
- package/build/protocol/handlers/PauseHandler.d.mts +16 -0
- package/build/protocol/handlers/PauseHandler.d.mts.map +1 -0
- package/build/protocol/handlers/PauseHandler.mjs +103 -0
- package/build/protocol/handlers/PauseHandler.mjs.map +1 -0
- package/build/protocol/handlers/ProblemReportHandler.d.mts +11 -0
- package/build/protocol/handlers/ProblemReportHandler.d.mts.map +1 -0
- package/build/protocol/handlers/ProblemReportHandler.mjs +26 -0
- package/build/protocol/handlers/ProblemReportHandler.mjs.map +1 -0
- package/build/protocol/handlers/PublishTemplateHandler.d.mts +15 -0
- package/build/protocol/handlers/PublishTemplateHandler.d.mts.map +1 -0
- package/build/protocol/handlers/PublishTemplateHandler.mjs +47 -0
- package/build/protocol/handlers/PublishTemplateHandler.mjs.map +1 -0
- package/build/protocol/handlers/ResumeHandler.d.mts +16 -0
- package/build/protocol/handlers/ResumeHandler.d.mts.map +1 -0
- package/build/protocol/handlers/ResumeHandler.mjs +103 -0
- package/build/protocol/handlers/ResumeHandler.mjs.map +1 -0
- package/build/protocol/handlers/StartHandler.d.mts +16 -0
- package/build/protocol/handlers/StartHandler.d.mts.map +1 -0
- package/build/protocol/handlers/StartHandler.mjs +238 -0
- package/build/protocol/handlers/StartHandler.mjs.map +1 -0
- package/build/protocol/handlers/StatusHandler.d.mts +16 -0
- package/build/protocol/handlers/StatusHandler.d.mts.map +1 -0
- package/build/protocol/handlers/StatusHandler.mjs +169 -0
- package/build/protocol/handlers/StatusHandler.mjs.map +1 -0
- package/build/protocol/handlers/TemplateHandler.d.mts +14 -0
- package/build/protocol/handlers/TemplateHandler.d.mts.map +1 -0
- package/build/protocol/handlers/TemplateHandler.mjs +66 -0
- package/build/protocol/handlers/TemplateHandler.mjs.map +1 -0
- package/build/protocol/messages/AdvanceMessage.d.mts +22 -0
- package/build/protocol/messages/AdvanceMessage.d.mts.map +1 -0
- package/build/protocol/messages/AdvanceMessage.mjs +25 -0
- package/build/protocol/messages/AdvanceMessage.mjs.map +1 -0
- package/build/protocol/messages/CancelMessage.d.mts +20 -0
- package/build/protocol/messages/CancelMessage.d.mts.map +1 -0
- package/build/protocol/messages/CancelMessage.mjs +25 -0
- package/build/protocol/messages/CancelMessage.mjs.map +1 -0
- package/build/protocol/messages/CompleteMessage.d.mts +20 -0
- package/build/protocol/messages/CompleteMessage.d.mts.map +1 -0
- package/build/protocol/messages/CompleteMessage.mjs +25 -0
- package/build/protocol/messages/CompleteMessage.mjs.map +1 -0
- package/build/protocol/messages/DiscoverMessage.d.mts +29 -0
- package/build/protocol/messages/DiscoverMessage.d.mts.map +1 -0
- package/build/protocol/messages/DiscoverMessage.mjs +25 -0
- package/build/protocol/messages/DiscoverMessage.mjs.map +1 -0
- package/build/protocol/messages/FetchTemplateMessage.d.mts +21 -0
- package/build/protocol/messages/FetchTemplateMessage.d.mts.map +1 -0
- package/build/protocol/messages/FetchTemplateMessage.mjs +31 -0
- package/build/protocol/messages/FetchTemplateMessage.mjs.map +1 -0
- package/build/protocol/messages/PauseMessage.d.mts +20 -0
- package/build/protocol/messages/PauseMessage.d.mts.map +1 -0
- package/build/protocol/messages/PauseMessage.mjs +25 -0
- package/build/protocol/messages/PauseMessage.mjs.map +1 -0
- package/build/protocol/messages/ProblemReportMessage.d.mts +21 -0
- package/build/protocol/messages/ProblemReportMessage.d.mts.map +1 -0
- package/build/protocol/messages/ProblemReportMessage.mjs +25 -0
- package/build/protocol/messages/ProblemReportMessage.mjs.map +1 -0
- package/build/protocol/messages/PublishTemplateMessage.d.mts +23 -0
- package/build/protocol/messages/PublishTemplateMessage.d.mts.map +1 -0
- package/build/protocol/messages/PublishTemplateMessage.mjs +24 -0
- package/build/protocol/messages/PublishTemplateMessage.mjs.map +1 -0
- package/build/protocol/messages/ResumeMessage.d.mts +20 -0
- package/build/protocol/messages/ResumeMessage.d.mts.map +1 -0
- package/build/protocol/messages/ResumeMessage.mjs +25 -0
- package/build/protocol/messages/ResumeMessage.mjs.map +1 -0
- package/build/protocol/messages/StartMessage.d.mts +27 -0
- package/build/protocol/messages/StartMessage.d.mts.map +1 -0
- package/build/protocol/messages/StartMessage.mjs +25 -0
- package/build/protocol/messages/StartMessage.mjs.map +1 -0
- package/build/protocol/messages/StatusMessage.d.mts +35 -0
- package/build/protocol/messages/StatusMessage.d.mts.map +1 -0
- package/build/protocol/messages/StatusMessage.mjs +25 -0
- package/build/protocol/messages/StatusMessage.mjs.map +1 -0
- package/build/protocol/messages/StatusRequestMessage.d.mts +29 -0
- package/build/protocol/messages/StatusRequestMessage.d.mts.map +1 -0
- package/build/protocol/messages/StatusRequestMessage.mjs +25 -0
- package/build/protocol/messages/StatusRequestMessage.mjs.map +1 -0
- package/build/protocol/messages/TemplateMessage.d.mts +20 -0
- package/build/protocol/messages/TemplateMessage.d.mts.map +1 -0
- package/build/protocol/messages/TemplateMessage.mjs +25 -0
- package/build/protocol/messages/TemplateMessage.mjs.map +1 -0
- package/build/protocol/messages/WorkflowsMessage.d.mts +28 -0
- package/build/protocol/messages/WorkflowsMessage.d.mts.map +1 -0
- package/build/protocol/messages/WorkflowsMessage.mjs +25 -0
- package/build/protocol/messages/WorkflowsMessage.mjs.map +1 -0
- package/build/queue/CommandQueue.d.mts +22 -0
- package/build/queue/CommandQueue.d.mts.map +1 -0
- package/build/queue/CommandQueue.mjs +6 -0
- package/build/queue/CommandQueue.mjs.map +1 -0
- package/build/queue/PersistentCommandQueue.d.mts +56 -0
- package/build/queue/PersistentCommandQueue.d.mts.map +1 -0
- package/build/queue/PersistentCommandQueue.mjs +273 -0
- package/build/queue/PersistentCommandQueue.mjs.map +1 -0
- package/build/repository/WorkflowCommandRecord.d.mts +50 -0
- package/build/repository/WorkflowCommandRecord.d.mts.map +1 -0
- package/build/repository/WorkflowCommandRecord.mjs +48 -0
- package/build/repository/WorkflowCommandRecord.mjs.map +1 -0
- package/build/repository/WorkflowCommandRepository.d.mts +59 -0
- package/build/repository/WorkflowCommandRepository.d.mts.map +1 -0
- package/build/repository/WorkflowCommandRepository.mjs +136 -0
- package/build/repository/WorkflowCommandRepository.mjs.map +1 -0
- package/build/repository/WorkflowInstanceRecord.d.mts +65 -0
- package/build/repository/WorkflowInstanceRecord.d.mts.map +1 -0
- package/build/repository/WorkflowInstanceRecord.mjs +44 -0
- package/build/repository/WorkflowInstanceRecord.mjs.map +1 -0
- package/build/repository/WorkflowInstanceRepository.d.mts +15 -0
- package/build/repository/WorkflowInstanceRepository.d.mts.map +1 -0
- package/build/repository/WorkflowInstanceRepository.mjs +48 -0
- package/build/repository/WorkflowInstanceRepository.mjs.map +1 -0
- package/build/repository/WorkflowTemplateRecord.d.mts +27 -0
- package/build/repository/WorkflowTemplateRecord.d.mts.map +1 -0
- package/build/repository/WorkflowTemplateRecord.mjs +29 -0
- package/build/repository/WorkflowTemplateRecord.mjs.map +1 -0
- package/build/repository/WorkflowTemplateRepository.d.mts +11 -0
- package/build/repository/WorkflowTemplateRepository.d.mts.map +1 -0
- package/build/repository/WorkflowTemplateRepository.mjs +43 -0
- package/build/repository/WorkflowTemplateRepository.mjs.map +1 -0
- package/build/services/WorkflowService.d.mts +107 -0
- package/build/services/WorkflowService.d.mts.map +1 -0
- package/build/services/WorkflowService.mjs +582 -0
- package/build/services/WorkflowService.mjs.map +1 -0
- package/build/ui/UiFilter.mjs +85 -0
- package/build/ui/UiFilter.mjs.map +1 -0
- package/package.json +27 -33
- package/build/WorkflowEvents.d.ts +0 -35
- package/build/WorkflowEvents.js +0 -10
- package/build/WorkflowEvents.js.map +0 -1
- package/build/WorkflowModule.d.ts +0 -13
- package/build/WorkflowModule.js +0 -647
- package/build/WorkflowModule.js.map +0 -1
- package/build/WorkflowModuleConfig.d.ts +0 -35
- package/build/WorkflowModuleConfig.js +0 -19
- package/build/WorkflowModuleConfig.js.map +0 -1
- package/build/actions/ActionRegistry.d.ts +0 -59
- package/build/actions/ActionRegistry.js +0 -367
- package/build/actions/ActionRegistry.js.map +0 -1
- package/build/api/WorkflowApi.d.ts +0 -94
- package/build/api/WorkflowApi.js +0 -241
- package/build/api/WorkflowApi.js.map +0 -1
- package/build/engine/AttributePlanner.d.ts +0 -7
- package/build/engine/AttributePlanner.js +0 -81
- package/build/engine/AttributePlanner.js.map +0 -1
- package/build/engine/GuardEvaluator.d.ts +0 -11
- package/build/engine/GuardEvaluator.js +0 -40
- package/build/engine/GuardEvaluator.js.map +0 -1
- package/build/index.d.ts +0 -45
- package/build/index.js +0 -69
- package/build/index.js.map +0 -1
- package/build/model/TemplateValidation.d.ts +0 -3
- package/build/model/TemplateValidation.js +0 -231
- package/build/model/TemplateValidation.js.map +0 -1
- package/build/model/types.d.ts +0 -116
- package/build/model/types.js +0 -15
- package/build/model/types.js.map +0 -1
- package/build/protocol/WorkflowMessageTypes.d.ts +0 -15
- package/build/protocol/WorkflowMessageTypes.js +0 -22
- package/build/protocol/WorkflowMessageTypes.js.map +0 -1
- package/build/protocol/handlers/AdvanceHandler.d.ts +0 -12
- package/build/protocol/handlers/AdvanceHandler.js +0 -149
- package/build/protocol/handlers/AdvanceHandler.js.map +0 -1
- package/build/protocol/handlers/CancelHandler.d.ts +0 -12
- package/build/protocol/handlers/CancelHandler.js +0 -124
- package/build/protocol/handlers/CancelHandler.js.map +0 -1
- package/build/protocol/handlers/CompleteHandler.d.ts +0 -12
- package/build/protocol/handlers/CompleteHandler.js +0 -125
- package/build/protocol/handlers/CompleteHandler.js.map +0 -1
- package/build/protocol/handlers/DiscoverHandler.d.ts +0 -11
- package/build/protocol/handlers/DiscoverHandler.js +0 -71
- package/build/protocol/handlers/DiscoverHandler.js.map +0 -1
- package/build/protocol/handlers/FetchTemplateHandler.d.ts +0 -12
- package/build/protocol/handlers/FetchTemplateHandler.js +0 -71
- package/build/protocol/handlers/FetchTemplateHandler.js.map +0 -1
- package/build/protocol/handlers/PauseHandler.d.ts +0 -12
- package/build/protocol/handlers/PauseHandler.js +0 -124
- package/build/protocol/handlers/PauseHandler.js.map +0 -1
- package/build/protocol/handlers/ProblemReportHandler.d.ts +0 -6
- package/build/protocol/handlers/ProblemReportHandler.js +0 -28
- package/build/protocol/handlers/ProblemReportHandler.js.map +0 -1
- package/build/protocol/handlers/PublishTemplateHandler.d.ts +0 -11
- package/build/protocol/handlers/PublishTemplateHandler.js +0 -53
- package/build/protocol/handlers/PublishTemplateHandler.js.map +0 -1
- package/build/protocol/handlers/ResumeHandler.d.ts +0 -12
- package/build/protocol/handlers/ResumeHandler.js +0 -124
- package/build/protocol/handlers/ResumeHandler.js.map +0 -1
- package/build/protocol/handlers/StartHandler.d.ts +0 -12
- package/build/protocol/handlers/StartHandler.js +0 -274
- package/build/protocol/handlers/StartHandler.js.map +0 -1
- package/build/protocol/handlers/StatusHandler.d.ts +0 -12
- package/build/protocol/handlers/StatusHandler.js +0 -202
- package/build/protocol/handlers/StatusHandler.js.map +0 -1
- package/build/protocol/handlers/TemplateHandler.d.ts +0 -9
- package/build/protocol/handlers/TemplateHandler.js +0 -83
- package/build/protocol/handlers/TemplateHandler.js.map +0 -1
- package/build/protocol/messages/AdvanceMessage.d.ts +0 -16
- package/build/protocol/messages/AdvanceMessage.js +0 -33
- package/build/protocol/messages/AdvanceMessage.js.map +0 -1
- package/build/protocol/messages/CancelMessage.d.ts +0 -14
- package/build/protocol/messages/CancelMessage.js +0 -33
- package/build/protocol/messages/CancelMessage.js.map +0 -1
- package/build/protocol/messages/CompleteMessage.d.ts +0 -14
- package/build/protocol/messages/CompleteMessage.js +0 -33
- package/build/protocol/messages/CompleteMessage.js.map +0 -1
- package/build/protocol/messages/DiscoverMessage.d.ts +0 -23
- package/build/protocol/messages/DiscoverMessage.js +0 -33
- package/build/protocol/messages/DiscoverMessage.js.map +0 -1
- package/build/protocol/messages/FetchTemplateMessage.d.ts +0 -15
- package/build/protocol/messages/FetchTemplateMessage.js +0 -33
- package/build/protocol/messages/FetchTemplateMessage.js.map +0 -1
- package/build/protocol/messages/PauseMessage.d.ts +0 -14
- package/build/protocol/messages/PauseMessage.js +0 -33
- package/build/protocol/messages/PauseMessage.js.map +0 -1
- package/build/protocol/messages/ProblemReportMessage.d.ts +0 -15
- package/build/protocol/messages/ProblemReportMessage.js +0 -33
- package/build/protocol/messages/ProblemReportMessage.js.map +0 -1
- package/build/protocol/messages/PublishTemplateMessage.d.ts +0 -17
- package/build/protocol/messages/PublishTemplateMessage.js +0 -31
- package/build/protocol/messages/PublishTemplateMessage.js.map +0 -1
- package/build/protocol/messages/ResumeMessage.d.ts +0 -14
- package/build/protocol/messages/ResumeMessage.js +0 -33
- package/build/protocol/messages/ResumeMessage.js.map +0 -1
- package/build/protocol/messages/StartMessage.d.ts +0 -21
- package/build/protocol/messages/StartMessage.js +0 -33
- package/build/protocol/messages/StartMessage.js.map +0 -1
- package/build/protocol/messages/StatusMessage.d.ts +0 -29
- package/build/protocol/messages/StatusMessage.js +0 -33
- package/build/protocol/messages/StatusMessage.js.map +0 -1
- package/build/protocol/messages/StatusRequestMessage.d.ts +0 -23
- package/build/protocol/messages/StatusRequestMessage.js +0 -33
- package/build/protocol/messages/StatusRequestMessage.js.map +0 -1
- package/build/protocol/messages/TemplateMessage.d.ts +0 -14
- package/build/protocol/messages/TemplateMessage.js +0 -33
- package/build/protocol/messages/TemplateMessage.js.map +0 -1
- package/build/protocol/messages/WorkflowsMessage.d.ts +0 -22
- package/build/protocol/messages/WorkflowsMessage.js +0 -33
- package/build/protocol/messages/WorkflowsMessage.js.map +0 -1
- package/build/queue/CommandQueue.d.ts +0 -18
- package/build/queue/CommandQueue.js +0 -8
- package/build/queue/CommandQueue.js.map +0 -1
- package/build/queue/PersistentCommandQueue.d.ts +0 -51
- package/build/queue/PersistentCommandQueue.js +0 -348
- package/build/queue/PersistentCommandQueue.js.map +0 -1
- package/build/repository/WorkflowCommandRecord.d.ts +0 -46
- package/build/repository/WorkflowCommandRecord.js +0 -52
- package/build/repository/WorkflowCommandRecord.js.map +0 -1
- package/build/repository/WorkflowCommandRepository.d.ts +0 -55
- package/build/repository/WorkflowCommandRepository.js +0 -149
- package/build/repository/WorkflowCommandRepository.js.map +0 -1
- package/build/repository/WorkflowInstanceRecord.d.ts +0 -61
- package/build/repository/WorkflowInstanceRecord.js +0 -43
- package/build/repository/WorkflowInstanceRecord.js.map +0 -1
- package/build/repository/WorkflowInstanceRepository.d.ts +0 -10
- package/build/repository/WorkflowInstanceRepository.js +0 -52
- package/build/repository/WorkflowInstanceRepository.js.map +0 -1
- package/build/repository/WorkflowTemplateRecord.d.ts +0 -23
- package/build/repository/WorkflowTemplateRecord.js +0 -28
- package/build/repository/WorkflowTemplateRecord.js.map +0 -1
- package/build/repository/WorkflowTemplateRepository.d.ts +0 -6
- package/build/repository/WorkflowTemplateRepository.js +0 -56
- package/build/repository/WorkflowTemplateRepository.js.map +0 -1
- package/build/services/WorkflowService.d.ts +0 -102
- package/build/services/WorkflowService.js +0 -712
- package/build/services/WorkflowService.js.map +0 -1
- package/build/ui/UiFilter.d.ts +0 -5
- package/build/ui/UiFilter.js +0 -104
- package/build/ui/UiFilter.js.map +0 -1
- package/build/ui/UiTypes.d.ts +0 -28
- package/build/ui/UiTypes.js +0 -3
- package/build/ui/UiTypes.js.map +0 -1
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PersistentCommandQueue = void 0;
|
|
4
|
-
const core_1 = require("@credo-ts/core");
|
|
5
|
-
const WorkflowCommandRecord_1 = require("../repository/WorkflowCommandRecord");
|
|
6
|
-
class PersistentCommandQueue {
|
|
7
|
-
constructor(repository, contextProvider, rootContext, options) {
|
|
8
|
-
this.running = false;
|
|
9
|
-
this.activeCount = 0;
|
|
10
|
-
this.pendingSleeps = new Set();
|
|
11
|
-
this.repository = repository;
|
|
12
|
-
this.contextProvider = contextProvider;
|
|
13
|
-
this.rootContext = rootContext;
|
|
14
|
-
this.logger = rootContext.dependencyManager.resolve(core_1.AgentConfig).logger;
|
|
15
|
-
this.pollIntervalMs = options?.pollIntervalMs ?? 100;
|
|
16
|
-
this.concurrency = Math.max(1, options?.concurrency ?? 3);
|
|
17
|
-
this.processingTimeoutMs = options?.processingTimeoutMs ?? 30000;
|
|
18
|
-
this.staleCheckIntervalMs = options?.staleCheckIntervalMs ?? 5000;
|
|
19
|
-
this.cleanupIntervalMs = options?.cleanupIntervalMs ?? 60000;
|
|
20
|
-
this.commandRetentionMs = options?.commandRetentionMs ?? 3600000; // 1 hour
|
|
21
|
-
this.failedRetentionMs = options?.failedRetentionMs ?? 86400000; // 24 hours
|
|
22
|
-
this.maxAttempts = options?.maxAttempts ?? 3;
|
|
23
|
-
}
|
|
24
|
-
async isReady() {
|
|
25
|
-
return true; // Always ready (uses existing storage)
|
|
26
|
-
}
|
|
27
|
-
async enqueue(agentContext, job) {
|
|
28
|
-
// Always persist commands in the root context so a single worker can process
|
|
29
|
-
// commands across tenants and resolve the proper context per job.
|
|
30
|
-
// Deduplicate by (cmd, thid) when a command is already pending/processing
|
|
31
|
-
try {
|
|
32
|
-
const existing = await this.repository.findByQuery(this.rootContext, { thid: job.thid });
|
|
33
|
-
if (existing?.some?.((r) => r.cmd === job.cmd && (r.status === 'pending' || r.status === 'processing'))) {
|
|
34
|
-
this.logger.debug(`[PersistentQueue] Dedup enqueue: command already queued (${job.cmd}) for ${job.thid}`);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
// swallow and proceed to enqueue
|
|
40
|
-
}
|
|
41
|
-
const record = new WorkflowCommandRecord_1.WorkflowCommandRecord({
|
|
42
|
-
cmd: job.cmd,
|
|
43
|
-
thid: job.thid,
|
|
44
|
-
connectionId: job.connectionId,
|
|
45
|
-
idempotencyKey: job.idempotency_key,
|
|
46
|
-
payload: job.payload,
|
|
47
|
-
contextCorrelationId: job.contextCorrelationId,
|
|
48
|
-
status: 'pending',
|
|
49
|
-
attempts: 0,
|
|
50
|
-
createdAt: new Date(),
|
|
51
|
-
});
|
|
52
|
-
await this.repository.save(this.rootContext, record);
|
|
53
|
-
this.logger.debug(`[PersistentQueue] Enqueued command: ${job.cmd} for ${job.thid}`);
|
|
54
|
-
// Trigger immediate poll (non-blocking)
|
|
55
|
-
setImmediate(() => void this.poll());
|
|
56
|
-
}
|
|
57
|
-
triggerPoll() {
|
|
58
|
-
// Non-blocking immediate poll hint
|
|
59
|
-
try {
|
|
60
|
-
setImmediate(() => void this.poll());
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
// best-effort only
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async startWorker(onJob) {
|
|
67
|
-
this.onJobHandler = onJob;
|
|
68
|
-
this.running = true;
|
|
69
|
-
this.logger.info('[PersistentQueue] Starting worker loops', {
|
|
70
|
-
pollIntervalMs: this.pollIntervalMs,
|
|
71
|
-
concurrency: this.concurrency,
|
|
72
|
-
processingTimeoutMs: this.processingTimeoutMs,
|
|
73
|
-
});
|
|
74
|
-
// Start background loops (non-blocking)
|
|
75
|
-
void this.pollLoop();
|
|
76
|
-
void this.staleCheckLoop();
|
|
77
|
-
void this.cleanupLoop();
|
|
78
|
-
}
|
|
79
|
-
async stop() {
|
|
80
|
-
this.logger.info('[PersistentQueue] Stopping worker...');
|
|
81
|
-
this.running = false;
|
|
82
|
-
// Cancel any pending sleep timers and resolve sleepers
|
|
83
|
-
for (const entry of Array.from(this.pendingSleeps)) {
|
|
84
|
-
try {
|
|
85
|
-
clearTimeout(entry.timer);
|
|
86
|
-
}
|
|
87
|
-
catch { }
|
|
88
|
-
try {
|
|
89
|
-
entry.resolve();
|
|
90
|
-
}
|
|
91
|
-
catch { }
|
|
92
|
-
this.pendingSleeps.delete(entry);
|
|
93
|
-
}
|
|
94
|
-
// Wait for active jobs to complete (with timeout)
|
|
95
|
-
const maxWait = 10000;
|
|
96
|
-
const start = Date.now();
|
|
97
|
-
while (this.activeCount > 0 && Date.now() - start < maxWait) {
|
|
98
|
-
await this.sleep(100);
|
|
99
|
-
}
|
|
100
|
-
if (this.activeCount > 0) {
|
|
101
|
-
this.logger.warn(`[PersistentQueue] Stopped with ${this.activeCount} active jobs`);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
this.logger.info('[PersistentQueue] Stopped cleanly');
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
async pollLoop() {
|
|
108
|
-
while (this.running) {
|
|
109
|
-
try {
|
|
110
|
-
await this.poll();
|
|
111
|
-
}
|
|
112
|
-
catch (err) {
|
|
113
|
-
if (this.running && this.logger && typeof this.logger.error === 'function') {
|
|
114
|
-
this.logger.error('[PersistentQueue] Poll error', { error: err.message });
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
await this.sleep(this.pollIntervalMs);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
async poll() {
|
|
121
|
-
if (this.activeCount >= this.concurrency)
|
|
122
|
-
return;
|
|
123
|
-
if (!this.onJobHandler)
|
|
124
|
-
return;
|
|
125
|
-
const limit = this.concurrency - this.activeCount;
|
|
126
|
-
const pending = await this.repository.findPending(this.rootContext, limit);
|
|
127
|
-
if (pending.length > 0) {
|
|
128
|
-
try {
|
|
129
|
-
this.logger.info('[PersistentQueue] Pending commands fetched', {
|
|
130
|
-
count: pending.length,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
catch { }
|
|
134
|
-
}
|
|
135
|
-
for (const record of pending) {
|
|
136
|
-
// Check max attempts before processing
|
|
137
|
-
if (record.attempts >= this.maxAttempts) {
|
|
138
|
-
await this.repository.markFailed(this.rootContext, record, `Max attempts (${this.maxAttempts}) exceeded`);
|
|
139
|
-
this.logger.warn(`[PersistentQueue] Command ${record.id} failed after ${this.maxAttempts} attempts`);
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
// Mark as processing
|
|
143
|
-
await this.repository.markProcessing(this.rootContext, record);
|
|
144
|
-
this.activeCount++;
|
|
145
|
-
// Process in background
|
|
146
|
-
void this.processCommand(record);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
async processCommand(record) {
|
|
150
|
-
let scoped = null;
|
|
151
|
-
try {
|
|
152
|
-
// Resolve tenant context
|
|
153
|
-
scoped = await this.resolveContext(record.contextCorrelationId);
|
|
154
|
-
if (!scoped) {
|
|
155
|
-
throw new Error(`Unable to resolve context: ${record.contextCorrelationId}`);
|
|
156
|
-
}
|
|
157
|
-
const job = {
|
|
158
|
-
cmd: record.cmd,
|
|
159
|
-
thid: record.thid,
|
|
160
|
-
connectionId: record.connectionId,
|
|
161
|
-
idempotency_key: record.idempotencyKey,
|
|
162
|
-
payload: record.payload,
|
|
163
|
-
contextCorrelationId: record.contextCorrelationId,
|
|
164
|
-
};
|
|
165
|
-
try {
|
|
166
|
-
this.logger.info('[PersistentQueue] Processing command', {
|
|
167
|
-
cmd: record.cmd,
|
|
168
|
-
thid: record.thid,
|
|
169
|
-
attempts: record.attempts,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
catch { }
|
|
173
|
-
await this.onJobHandler(job);
|
|
174
|
-
// Mark as completed in root context (commands are stored centrally)
|
|
175
|
-
await this.repository.markCompleted(this.rootContext, record);
|
|
176
|
-
try {
|
|
177
|
-
this.logger.info('[PersistentQueue] Completed command', {
|
|
178
|
-
cmd: record.cmd,
|
|
179
|
-
thid: record.thid,
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
catch { }
|
|
183
|
-
}
|
|
184
|
-
catch (err) {
|
|
185
|
-
const errorMsg = err.message || 'Unknown error';
|
|
186
|
-
const errCode = err?.code;
|
|
187
|
-
if (this.running && this.logger && typeof this.logger.error === 'function') {
|
|
188
|
-
this.logger.error(`[PersistentQueue] Command processing failed: ${record.cmd} for ${record.thid}`, {
|
|
189
|
-
error: errorMsg,
|
|
190
|
-
attempts: record.attempts,
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
// Special deferral for missing template: keep retrying without exhausting attempts
|
|
194
|
-
if (errCode === 'invalid_template') {
|
|
195
|
-
try {
|
|
196
|
-
// Small backoff to avoid tight retry loop
|
|
197
|
-
await this.sleep(Math.min(1000, this.pollIntervalMs * 10));
|
|
198
|
-
}
|
|
199
|
-
catch { }
|
|
200
|
-
try {
|
|
201
|
-
// Undo the attempt increment performed when marking processing
|
|
202
|
-
if (record.attempts > 0)
|
|
203
|
-
record.attempts -= 1;
|
|
204
|
-
}
|
|
205
|
-
catch { }
|
|
206
|
-
await this.repository.resetToPending(this.rootContext, record);
|
|
207
|
-
try {
|
|
208
|
-
this.logger.info('[PersistentQueue] Deferred command due to missing template; reset to pending', {
|
|
209
|
-
cmd: record.cmd,
|
|
210
|
-
thid: record.thid,
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
catch { }
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
// Mark as failed if max attempts reached, otherwise reset to pending for retry
|
|
217
|
-
if (record.attempts >= this.maxAttempts) {
|
|
218
|
-
await this.repository.markFailed(this.rootContext, record, errorMsg);
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
await this.repository.resetToPending(this.rootContext, record);
|
|
222
|
-
try {
|
|
223
|
-
this.logger.info('[PersistentQueue] Resetting command to pending for retry', {
|
|
224
|
-
cmd: record.cmd,
|
|
225
|
-
thid: record.thid,
|
|
226
|
-
attempts: record.attempts,
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
catch { }
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
finally {
|
|
233
|
-
// Always release scoped context if obtained
|
|
234
|
-
try {
|
|
235
|
-
await scoped?.release?.();
|
|
236
|
-
}
|
|
237
|
-
catch { }
|
|
238
|
-
this.activeCount--;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
async staleCheckLoop() {
|
|
242
|
-
while (this.running) {
|
|
243
|
-
await this.sleep(this.staleCheckIntervalMs);
|
|
244
|
-
try {
|
|
245
|
-
const stale = await this.repository.findStale(this.rootContext, this.processingTimeoutMs);
|
|
246
|
-
for (const record of stale) {
|
|
247
|
-
this.logger.warn(`[PersistentQueue] Resetting stale command: ${record.cmd} for ${record.thid}`, {
|
|
248
|
-
attempts: record.attempts,
|
|
249
|
-
lastAttempt: record.lastAttemptAt?.toISOString(),
|
|
250
|
-
});
|
|
251
|
-
if (record.attempts >= this.maxAttempts) {
|
|
252
|
-
await this.repository.markFailed(this.rootContext, record, 'Stale after max attempts');
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
await this.repository.resetToPending(this.rootContext, record);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
catch (err) {
|
|
260
|
-
if (this.running && this.logger && typeof this.logger.error === 'function') {
|
|
261
|
-
this.logger.error('[PersistentQueue] Stale check error', { error: err.message });
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
async cleanupLoop() {
|
|
267
|
-
while (this.running) {
|
|
268
|
-
await this.sleep(this.cleanupIntervalMs);
|
|
269
|
-
try {
|
|
270
|
-
const completedCutoff = new Date(Date.now() - this.commandRetentionMs);
|
|
271
|
-
const failedCutoff = new Date(Date.now() - this.failedRetentionMs);
|
|
272
|
-
const [completedDeleted, failedDeleted] = await Promise.all([
|
|
273
|
-
this.repository.deleteCompleted(this.rootContext, completedCutoff),
|
|
274
|
-
this.repository.deleteFailed(this.rootContext, failedCutoff),
|
|
275
|
-
]);
|
|
276
|
-
if (completedDeleted > 0 || failedDeleted > 0) {
|
|
277
|
-
this.logger.debug(`[PersistentQueue] Cleanup: deleted ${completedDeleted} completed, ${failedDeleted} failed`);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
catch (err) {
|
|
281
|
-
if (this.running && this.logger && typeof this.logger.error === 'function') {
|
|
282
|
-
this.logger.error('[PersistentQueue] Cleanup error', { error: err.message });
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
async resolveContext(correlationId) {
|
|
288
|
-
const rootId = this.rootContext.contextCorrelationId;
|
|
289
|
-
if (!correlationId || correlationId === rootId) {
|
|
290
|
-
return { context: this.rootContext, release: async () => { } };
|
|
291
|
-
}
|
|
292
|
-
try {
|
|
293
|
-
// Some inbound paths may enqueue with base context id (e.g., 'default').
|
|
294
|
-
// If we can resolve it, do so; otherwise, fall back to root tenant context so
|
|
295
|
-
// jobs in this queue are still processed under the tenant.
|
|
296
|
-
const scopedContext = await this.contextProvider.getAgentContextForContextCorrelationId(correlationId);
|
|
297
|
-
return {
|
|
298
|
-
context: scopedContext,
|
|
299
|
-
release: async () => {
|
|
300
|
-
try {
|
|
301
|
-
await this.contextProvider.endSessionForAgentContext(scopedContext);
|
|
302
|
-
}
|
|
303
|
-
catch (error) {
|
|
304
|
-
this.logger.debug('[PersistentQueue] Failed to end tenant session', {
|
|
305
|
-
contextCorrelationId: correlationId,
|
|
306
|
-
error: error.message,
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
catch (error) {
|
|
313
|
-
if (this.running && this.logger && typeof this.logger.error === 'function') {
|
|
314
|
-
this.logger.error('[PersistentQueue] Unable to resolve context, falling back to root', {
|
|
315
|
-
contextCorrelationId: correlationId,
|
|
316
|
-
error: error.message,
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
// Fallback: use the root agent context bound to this queue
|
|
320
|
-
return { context: this.rootContext, release: async () => { } };
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
sleep(ms) {
|
|
324
|
-
return new Promise((outerResolve) => {
|
|
325
|
-
const entry = { timer: undefined, resolve: () => { } };
|
|
326
|
-
const resolve = () => {
|
|
327
|
-
try {
|
|
328
|
-
outerResolve();
|
|
329
|
-
}
|
|
330
|
-
finally {
|
|
331
|
-
this.pendingSleeps.delete(entry);
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
entry.resolve = resolve;
|
|
335
|
-
entry.timer = setTimeout(resolve, ms);
|
|
336
|
-
this.pendingSleeps.add(entry);
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
async getMetrics() {
|
|
340
|
-
const repoMetrics = await this.repository.getMetrics(this.rootContext);
|
|
341
|
-
return {
|
|
342
|
-
...repoMetrics,
|
|
343
|
-
active: this.activeCount,
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
exports.PersistentCommandQueue = PersistentCommandQueue;
|
|
348
|
-
//# sourceMappingURL=PersistentCommandQueue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PersistentCommandQueue.js","sourceRoot":"","sources":["../../src/queue/PersistentCommandQueue.ts"],"names":[],"mappings":";;;AAGA,yCAA8D;AAC9D,+EAA2E;AAc3E,MAAa,sBAAsB;IAoBjC,YACE,UAAqC,EACrC,eAAqC,EACrC,WAAyB,EACzB,OAAuC;QAdjC,YAAO,GAAG,KAAK,CAAA;QACf,gBAAW,GAAG,CAAC,CAAA;QAON,kBAAa,GAAG,IAAI,GAAG,EAAkD,CAAA;QAQxF,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;QACtC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,kBAAW,CAAC,CAAC,MAAM,CAAA;QAEvE,IAAI,CAAC,cAAc,GAAG,OAAO,EAAE,cAAc,IAAI,GAAG,CAAA;QACpD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,IAAI,CAAC,CAAC,CAAA;QACzD,IAAI,CAAC,mBAAmB,GAAG,OAAO,EAAE,mBAAmB,IAAI,KAAK,CAAA;QAChE,IAAI,CAAC,oBAAoB,GAAG,OAAO,EAAE,oBAAoB,IAAI,IAAI,CAAA;QACjE,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,IAAI,KAA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AU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;YACrC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;IACJ,CAAC;IAEM,KAAK,CAAC,UAAU;QAOrB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACtE,OAAO;YACL,GAAG,WAAW;YACd,MAAM,EAAE,IAAI,CAAC,WAAW;SACzB,CAAA;IACH,CAAC;CACF;AAtYD,wDAsYC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { TagsBase } from '@credo-ts/core';
|
|
2
|
-
import { BaseRecord } from '@credo-ts/core';
|
|
3
|
-
export type WorkflowCommandType = 'start' | 'advance' | 'pause' | 'resume' | 'cancel' | 'complete';
|
|
4
|
-
export type WorkflowCommandStatus = 'pending' | 'processing' | 'completed' | 'failed';
|
|
5
|
-
export interface WorkflowCommandRecordProps {
|
|
6
|
-
id?: string;
|
|
7
|
-
cmd: WorkflowCommandType;
|
|
8
|
-
thid: string;
|
|
9
|
-
connectionId?: string;
|
|
10
|
-
idempotencyKey?: string;
|
|
11
|
-
payload: Record<string, unknown>;
|
|
12
|
-
contextCorrelationId: string;
|
|
13
|
-
status?: WorkflowCommandStatus;
|
|
14
|
-
attempts?: number;
|
|
15
|
-
lastAttemptAt?: Date;
|
|
16
|
-
error?: string;
|
|
17
|
-
createdAt?: Date;
|
|
18
|
-
completedAt?: Date;
|
|
19
|
-
}
|
|
20
|
-
export type WorkflowCommandRecordTags = TagsBase & {
|
|
21
|
-
status: WorkflowCommandStatus;
|
|
22
|
-
thid: string;
|
|
23
|
-
connectionId: string;
|
|
24
|
-
contextCorrelationId: string;
|
|
25
|
-
cmd: WorkflowCommandType;
|
|
26
|
-
templateId?: string;
|
|
27
|
-
templateVersion?: string;
|
|
28
|
-
};
|
|
29
|
-
export declare class WorkflowCommandRecord extends BaseRecord<WorkflowCommandRecordTags, TagsBase> {
|
|
30
|
-
static readonly type: "WorkflowCommandRecord";
|
|
31
|
-
readonly type: "WorkflowCommandRecord";
|
|
32
|
-
cmd: WorkflowCommandType;
|
|
33
|
-
thid: string;
|
|
34
|
-
connectionId?: string;
|
|
35
|
-
idempotencyKey?: string;
|
|
36
|
-
payload: Record<string, unknown>;
|
|
37
|
-
contextCorrelationId: string;
|
|
38
|
-
status: WorkflowCommandStatus;
|
|
39
|
-
attempts: number;
|
|
40
|
-
lastAttemptAt?: Date;
|
|
41
|
-
error?: string;
|
|
42
|
-
createdAt: Date;
|
|
43
|
-
completedAt?: Date;
|
|
44
|
-
constructor(props: WorkflowCommandRecordProps);
|
|
45
|
-
getTags(): WorkflowCommandRecordTags;
|
|
46
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkflowCommandRecord = void 0;
|
|
4
|
-
const core_1 = require("@credo-ts/core");
|
|
5
|
-
class WorkflowCommandRecord extends core_1.BaseRecord {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super();
|
|
8
|
-
this.type = WorkflowCommandRecord.type;
|
|
9
|
-
if (props) {
|
|
10
|
-
this.id = props.id ?? core_1.utils.uuid();
|
|
11
|
-
this.cmd = props.cmd;
|
|
12
|
-
this.thid = props.thid;
|
|
13
|
-
this.connectionId = props.connectionId;
|
|
14
|
-
this.idempotencyKey = props.idempotencyKey;
|
|
15
|
-
this.payload = props.payload;
|
|
16
|
-
this.contextCorrelationId = props.contextCorrelationId;
|
|
17
|
-
this.status = props.status ?? 'pending';
|
|
18
|
-
this.attempts = props.attempts ?? 0;
|
|
19
|
-
this.lastAttemptAt = props.lastAttemptAt;
|
|
20
|
-
this.error = props.error;
|
|
21
|
-
this.createdAt = props.createdAt ?? new Date();
|
|
22
|
-
this.completedAt = props.completedAt;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
getTags() {
|
|
26
|
-
const base = {
|
|
27
|
-
...this._tags,
|
|
28
|
-
status: this.status,
|
|
29
|
-
thid: this.thid,
|
|
30
|
-
connectionId: this.connectionId ?? '',
|
|
31
|
-
contextCorrelationId: this.contextCorrelationId,
|
|
32
|
-
cmd: this.cmd,
|
|
33
|
-
};
|
|
34
|
-
try {
|
|
35
|
-
if (this.cmd === 'start') {
|
|
36
|
-
const tId = this.payload?.template_id;
|
|
37
|
-
const tVer = this.payload?.template_version;
|
|
38
|
-
if (tId)
|
|
39
|
-
base.templateId = tId;
|
|
40
|
-
if (tVer)
|
|
41
|
-
base.templateVersion = tVer;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
/* noop */
|
|
46
|
-
}
|
|
47
|
-
return base;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.WorkflowCommandRecord = WorkflowCommandRecord;
|
|
51
|
-
WorkflowCommandRecord.type = 'WorkflowCommandRecord';
|
|
52
|
-
//# sourceMappingURL=WorkflowCommandRecord.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowCommandRecord.js","sourceRoot":"","sources":["../../src/repository/WorkflowCommandRecord.ts"],"names":[],"mappings":";;;AAEA,yCAAkD;AAkClD,MAAa,qBAAsB,SAAQ,iBAA+C;IAmBxF,YAAmB,KAAiC;QAClD,KAAK,EAAE,CAAA;QAlBO,SAAI,GAAG,qBAAqB,CAAC,IAAI,CAAA;QAoB/C,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,YAAK,CAAC,IAAI,EAAE,CAAA;YAClC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAA;YACpB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;YACtB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAA;YACtC,IAAI,CAAC,c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CAAA;IACb,CAAC;;AA7DH,sDA8DC;AA7DwB,0BAAI,GAAG,uBAAgC,AAAnC,CAAmC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { AgentContext } from '@credo-ts/core';
|
|
2
|
-
import { Repository, StorageService, EventEmitter } from '@credo-ts/core';
|
|
3
|
-
import { WorkflowCommandRecord } from './WorkflowCommandRecord';
|
|
4
|
-
export declare class WorkflowCommandRepository extends Repository<WorkflowCommandRecord> {
|
|
5
|
-
constructor(storageService: StorageService<WorkflowCommandRecord>, eventEmitter: EventEmitter);
|
|
6
|
-
/**
|
|
7
|
-
* Find pending commands (status='pending'), ordered by creation time
|
|
8
|
-
*/
|
|
9
|
-
findPending(agentContext: AgentContext, limit?: number): Promise<WorkflowCommandRecord[]>;
|
|
10
|
-
/**
|
|
11
|
-
* Find pending 'start' commands for a specific template (and optional version)
|
|
12
|
-
*/
|
|
13
|
-
findPendingStartsByTemplate(agentContext: AgentContext, templateId: string, version?: string): Promise<WorkflowCommandRecord[]>;
|
|
14
|
-
/**
|
|
15
|
-
* Find commands stuck in 'processing' state longer than timeoutMs
|
|
16
|
-
*/
|
|
17
|
-
findStale(agentContext: AgentContext, timeoutMs: number): Promise<WorkflowCommandRecord[]>;
|
|
18
|
-
/**
|
|
19
|
-
* Find command by thid (thread ID / instance ID)
|
|
20
|
-
*/
|
|
21
|
-
findByThid(agentContext: AgentContext, thid: string): Promise<WorkflowCommandRecord[]>;
|
|
22
|
-
/**
|
|
23
|
-
* Mark command as processing
|
|
24
|
-
*/
|
|
25
|
-
markProcessing(agentContext: AgentContext, record: WorkflowCommandRecord): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Mark command as completed
|
|
28
|
-
*/
|
|
29
|
-
markCompleted(agentContext: AgentContext, record: WorkflowCommandRecord): Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* Mark command as failed
|
|
32
|
-
*/
|
|
33
|
-
markFailed(agentContext: AgentContext, record: WorkflowCommandRecord, error: string): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Delete completed commands older than given date
|
|
36
|
-
*/
|
|
37
|
-
deleteCompleted(agentContext: AgentContext, olderThan: Date): Promise<number>;
|
|
38
|
-
/**
|
|
39
|
-
* Delete failed commands older than given date
|
|
40
|
-
*/
|
|
41
|
-
deleteFailed(agentContext: AgentContext, olderThan: Date): Promise<number>;
|
|
42
|
-
/**
|
|
43
|
-
* Reset stale command to pending for retry
|
|
44
|
-
*/
|
|
45
|
-
resetToPending(agentContext: AgentContext, record: WorkflowCommandRecord): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Get queue metrics
|
|
48
|
-
*/
|
|
49
|
-
getMetrics(agentContext: AgentContext): Promise<{
|
|
50
|
-
pending: number;
|
|
51
|
-
processing: number;
|
|
52
|
-
completed: number;
|
|
53
|
-
failed: number;
|
|
54
|
-
}>;
|
|
55
|
-
}
|