@ajna-inc/workflow 0.6.1 → 0.6.3
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 +17 -6
- package/.npmvc/sbom.cdx.json +23758 -0
- package/build/api/WorkflowApi.mjs +1 -1
- package/build/protocol/handlers/AdvanceHandler.mjs +1 -1
- package/build/protocol/handlers/CancelHandler.mjs +1 -1
- package/build/protocol/handlers/CompleteHandler.mjs +1 -1
- package/build/protocol/handlers/DiscoverHandler.mjs +1 -1
- package/build/protocol/handlers/FetchTemplateHandler.mjs +1 -1
- package/build/protocol/handlers/PauseHandler.mjs +1 -1
- package/build/protocol/handlers/PublishTemplateHandler.mjs +1 -1
- package/build/protocol/handlers/ResumeHandler.mjs +1 -1
- package/build/protocol/handlers/StartHandler.mjs +1 -1
- package/build/protocol/handlers/StatusHandler.mjs +1 -1
- package/build/protocol/handlers/TemplateHandler.mjs +1 -1
- package/build/protocol/messages/AdvanceMessage.d.mts +2 -2
- package/build/protocol/messages/CancelMessage.d.mts +2 -2
- package/build/protocol/messages/CancelMessage.d.mts.map +1 -1
- package/build/protocol/messages/CompleteMessage.d.mts +2 -2
- package/build/protocol/messages/DiscoverMessage.d.mts +2 -2
- package/build/protocol/messages/FetchTemplateMessage.d.mts +2 -2
- package/build/protocol/messages/FetchTemplateMessage.d.mts.map +1 -1
- package/build/protocol/messages/PauseMessage.d.mts +2 -2
- package/build/protocol/messages/PauseMessage.d.mts.map +1 -1
- package/build/protocol/messages/ProblemReportMessage.d.mts +2 -2
- package/build/protocol/messages/ProblemReportMessage.d.mts.map +1 -1
- package/build/protocol/messages/ResumeMessage.d.mts +2 -2
- package/build/protocol/messages/StartMessage.d.mts +2 -2
- package/build/protocol/messages/StatusMessage.d.mts +2 -2
- package/build/protocol/messages/StatusRequestMessage.d.mts +2 -2
- package/build/protocol/messages/TemplateMessage.d.mts +2 -2
- package/build/protocol/messages/TemplateMessage.d.mts.map +1 -1
- package/build/protocol/messages/WorkflowsMessage.d.mts +2 -2
- package/build/protocol/messages/WorkflowsMessage.d.mts.map +1 -1
- package/build/queue/PersistentCommandQueue.mjs +1 -1
- package/build/queue/PersistentCommandQueue.mjs.map +1 -1
- package/build/repository/WorkflowCommandRepository.mjs +1 -1
- package/build/repository/WorkflowInstanceRepository.mjs +1 -1
- package/build/repository/WorkflowTemplateRepository.mjs +1 -1
- package/build/services/WorkflowService.mjs +5 -5
- package/package.json +1 -1
|
@@ -221,7 +221,7 @@ let WorkflowApi = class WorkflowApi$1 {
|
|
|
221
221
|
return this.service.complete(this.agentContext, opts);
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
-
WorkflowApi = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
224
|
+
WorkflowApi = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowService, AgentContext])], WorkflowApi);
|
|
225
225
|
|
|
226
226
|
//#endregion
|
|
227
227
|
export { WorkflowApi };
|
|
@@ -141,7 +141,7 @@ let AdvanceHandler = class AdvanceHandler$1 {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
AdvanceHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
144
|
+
AdvanceHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowService])], AdvanceHandler);
|
|
145
145
|
|
|
146
146
|
//#endregion
|
|
147
147
|
export { AdvanceHandler };
|
|
@@ -96,7 +96,7 @@ let CancelHandler = class CancelHandler$1 {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
CancelHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
99
|
+
CancelHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowService])], CancelHandler);
|
|
100
100
|
|
|
101
101
|
//#endregion
|
|
102
102
|
export { CancelHandler };
|
|
@@ -96,7 +96,7 @@ let CompleteHandler = class CompleteHandler$1 {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
CompleteHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
99
|
+
CompleteHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowService])], CompleteHandler);
|
|
100
100
|
|
|
101
101
|
//#endregion
|
|
102
102
|
export { CompleteHandler };
|
|
@@ -66,7 +66,7 @@ let DiscoverHandler = class DiscoverHandler$1 {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
DiscoverHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
69
|
+
DiscoverHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowTemplateRepository])], DiscoverHandler);
|
|
70
70
|
|
|
71
71
|
//#endregion
|
|
72
72
|
export { DiscoverHandler };
|
|
@@ -57,7 +57,7 @@ let FetchTemplateHandler = class FetchTemplateHandler$1 {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
FetchTemplateHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
60
|
+
FetchTemplateHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowTemplateRepository])], FetchTemplateHandler);
|
|
61
61
|
|
|
62
62
|
//#endregion
|
|
63
63
|
export { FetchTemplateHandler };
|
|
@@ -96,7 +96,7 @@ let PauseHandler = class PauseHandler$1 {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
PauseHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
99
|
+
PauseHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowService])], PauseHandler);
|
|
100
100
|
|
|
101
101
|
//#endregion
|
|
102
102
|
export { PauseHandler };
|
|
@@ -40,7 +40,7 @@ let PublishTemplateHandler = class PublishTemplateHandler$1 {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
PublishTemplateHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
43
|
+
PublishTemplateHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowService])], PublishTemplateHandler);
|
|
44
44
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { PublishTemplateHandler };
|
|
@@ -96,7 +96,7 @@ let ResumeHandler = class ResumeHandler$1 {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
ResumeHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
99
|
+
ResumeHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowService])], ResumeHandler);
|
|
100
100
|
|
|
101
101
|
//#endregion
|
|
102
102
|
export { ResumeHandler };
|
|
@@ -231,7 +231,7 @@ let StartHandler = class StartHandler$1 {
|
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
|
-
StartHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
234
|
+
StartHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowService])], StartHandler);
|
|
235
235
|
|
|
236
236
|
//#endregion
|
|
237
237
|
export { StartHandler };
|
|
@@ -162,7 +162,7 @@ let StatusHandler = class StatusHandler$1 {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
|
-
StatusHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
165
|
+
StatusHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowService])], StatusHandler);
|
|
166
166
|
|
|
167
167
|
//#endregion
|
|
168
168
|
export { StatusHandler };
|
|
@@ -59,7 +59,7 @@ let TemplateHandler = class TemplateHandler$1 {
|
|
|
59
59
|
} catch {}
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
TemplateHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
62
|
+
TemplateHandler = __decorate([injectable(), __decorateMetadata("design:paramtypes", [WorkflowService])], TemplateHandler);
|
|
63
63
|
|
|
64
64
|
//#endregion
|
|
65
65
|
export { TemplateHandler };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm2 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocol/messages/AdvanceMessage.d.ts
|
|
5
5
|
declare class AdvanceMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm2.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
instance_id: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm11 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocol/messages/CancelMessage.d.ts
|
|
5
5
|
declare class CancelMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm11.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
instance_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CancelMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/CancelMessage.ts"],"sourcesContent":[],"mappings":";;;;cAEa,aAAA,SAAsB,cAAA;wBAAR,
|
|
1
|
+
{"version":3,"file":"CancelMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/CancelMessage.ts"],"sourcesContent":[],"mappings":";;;;cAEa,aAAA,SAAsB,cAAA;wBAAR,mBAAA,CACE;;EADhB,IAAA,EAAA;IAAc,WAAA,EACE,MAAA;IAOuB,MAAA,CAAA,EAAA,MAAA;EARjB,CAAA;EAAc,WAAA,CAAA,QAAA,EAAA;;UAQG"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm5 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocol/messages/CompleteMessage.d.ts
|
|
5
5
|
declare class CompleteMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm5.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
instance_id: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm4 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocol/messages/DiscoverMessage.d.ts
|
|
5
5
|
declare class DiscoverMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm4.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
filters?: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm9 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocol/messages/FetchTemplateMessage.d.ts
|
|
5
5
|
declare class FetchTemplateMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm9.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
template_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchTemplateMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/FetchTemplateMessage.ts"],"sourcesContent":[],"mappings":";;;;cAEa,oBAAA,SAA6B,cAAA;wBAAR,
|
|
1
|
+
{"version":3,"file":"FetchTemplateMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/FetchTemplateMessage.ts"],"sourcesContent":[],"mappings":";;;;cAEa,oBAAA,SAA6B,cAAA;wBAAR,kBAAA,CACL;;EADhB,IAAA,EAAA;IAAqB,WAAA,EACL,MAAA;IAOuB,gBAAA,CAAA,EAAA,MAAA;IARV,WAAA,CAAA,EAAA,MAAA;EAAc,CAAA;;;UAQJ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm12 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocol/messages/PauseMessage.d.ts
|
|
5
5
|
declare class PauseMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm12.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
instance_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PauseMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/PauseMessage.ts"],"sourcesContent":[],"mappings":";;;;cAEa,YAAA,SAAqB,cAAA;wBAAR,
|
|
1
|
+
{"version":3,"file":"PauseMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/PauseMessage.ts"],"sourcesContent":[],"mappings":";;;;cAEa,YAAA,SAAqB,cAAA;wBAAR,mBAAA,CACG;;EADhB,IAAA,EAAA;IAAa,WAAA,EACG,MAAA;IAOuB,MAAA,CAAA,EAAA,MAAA;EARlB,CAAA;EAAc,WAAA,CAAA,QAAA,EAAA;;UAQI"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm10 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocol/messages/ProblemReportMessage.d.ts
|
|
5
5
|
declare class ProblemReportMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm10.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
code: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProblemReportMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/ProblemReportMessage.ts"],"sourcesContent":[],"mappings":";;;;cAEa,oBAAA,SAA6B,cAAA;wBAAR,
|
|
1
|
+
{"version":3,"file":"ProblemReportMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/ProblemReportMessage.ts"],"sourcesContent":[],"mappings":";;;;cAEa,oBAAA,SAA6B,cAAA;wBAAR,mBAAA,CACL;;EADhB,IAAA,EAAA;IAAqB,IAAA,EAAA,MAAA;IAMuB,OAAA,CAAA,EAAA,MAAA;IAEL,IAAA,CAAA,EAFK,MAEL,CAAA,MAAA,EAAA,OAAA,CAAA;EARV,CAAA;EAAc,WAAA,CAAA,QAAA,EAAA;;UAQJ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm6 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocol/messages/ResumeMessage.d.ts
|
|
5
5
|
declare class ResumeMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm6.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
instance_id: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Participants } from "../../model/types.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _credo_ts_didcomm1 from "@credo-ts/didcomm";
|
|
3
3
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
4
4
|
|
|
5
5
|
//#region src/protocol/messages/StartMessage.d.ts
|
|
6
6
|
declare class StartMessage extends DidCommMessage {
|
|
7
|
-
static readonly type:
|
|
7
|
+
static readonly type: _credo_ts_didcomm1.ParsedMessageType;
|
|
8
8
|
type: string;
|
|
9
9
|
body: {
|
|
10
10
|
template_id: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UiItem } from "../../model/types.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _credo_ts_didcomm0 from "@credo-ts/didcomm";
|
|
3
3
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
4
4
|
|
|
5
5
|
//#region src/protocol/messages/StatusMessage.d.ts
|
|
6
6
|
declare class StatusMessage extends DidCommMessage {
|
|
7
|
-
static readonly type:
|
|
7
|
+
static readonly type: _credo_ts_didcomm0.ParsedMessageType;
|
|
8
8
|
type: string;
|
|
9
9
|
body: {
|
|
10
10
|
instance_id: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm3 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocol/messages/StatusRequestMessage.d.ts
|
|
5
5
|
declare class StatusRequestMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm3.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
instance_id: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { WorkflowTemplate } from "../../model/types.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _credo_ts_didcomm8 from "@credo-ts/didcomm";
|
|
3
3
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
4
4
|
|
|
5
5
|
//#region src/protocol/messages/TemplateMessage.d.ts
|
|
6
6
|
declare class TemplateMessage extends DidCommMessage {
|
|
7
|
-
static readonly type:
|
|
7
|
+
static readonly type: _credo_ts_didcomm8.ParsedMessageType;
|
|
8
8
|
type: string;
|
|
9
9
|
body: {
|
|
10
10
|
template: WorkflowTemplate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/TemplateMessage.ts"],"sourcesContent":[],"mappings":";;;;;cAIa,eAAA,SAAwB,cAAA;wBAAR,
|
|
1
|
+
{"version":3,"file":"TemplateMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/TemplateMessage.ts"],"sourcesContent":[],"mappings":";;;;;cAIa,eAAA,SAAwB,cAAA;wBAAR,kBAAA,CACA;;EADhB,IAAA,EAAA;IAAgB,QAAA,EAMD,gBALC;EAKD,CAAA;EAEwB,WAAA,CAAA,QAAA,EAAA;IARf,EAAA,CAAA,EAAA,MAAA;IAAc,IAAA,EAQC,eARD,CAAA,MAAA,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm7 from "@credo-ts/didcomm";
|
|
2
2
|
import { DidCommMessage } from "@credo-ts/didcomm";
|
|
3
3
|
|
|
4
4
|
//#region src/protocol/messages/WorkflowsMessage.d.ts
|
|
5
5
|
declare class WorkflowsMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm7.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
workflows: Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowsMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/WorkflowsMessage.ts"],"sourcesContent":[],"mappings":";;;;cAEa,gBAAA,SAAyB,cAAA;wBAAR,
|
|
1
|
+
{"version":3,"file":"WorkflowsMessage.d.mts","names":[],"sources":["../../../src/protocol/messages/WorkflowsMessage.ts"],"sourcesContent":[],"mappings":";;;;cAEa,gBAAA,SAAyB,cAAA;wBAAR,kBAAA,CACD;;EADhB,IAAA,EAAA;IAAiB,SAAA,EAOf,KANc,CAAA;MAMd,WAAA,EAAA,MAAA;MAIqC,QAAA,EAAA,MAAA,EAAA;MAXd,KAAA,CAAA,EAAA,MAAA;MAAc,IAAA,CAAA,EAAA,MAAA;;;;;;;;;UAWA"}
|
|
@@ -147,7 +147,7 @@ var PersistentCommandQueue = class {
|
|
|
147
147
|
});
|
|
148
148
|
if (errCode === "invalid_template") {
|
|
149
149
|
try {
|
|
150
|
-
await this.sleep(Math.min(
|
|
150
|
+
await this.sleep(Math.min(200, this.pollIntervalMs * 2));
|
|
151
151
|
} catch {}
|
|
152
152
|
try {
|
|
153
153
|
if (record.attempts > 0) record.attempts -= 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistentCommandQueue.mjs","names":["scoped: { context: AgentContext; release: () => Promise<void> } | null","job: WorkflowCommandJob"],"sources":["../../src/queue/PersistentCommandQueue.ts"],"sourcesContent":["import type { AgentContext, AgentContextProvider } from '@credo-ts/core'\nimport type { CommandQueue, WorkflowCommandJob } from './CommandQueue'\n\nimport { AgentConfig, InjectionSymbols } from '@credo-ts/core'\nimport { WorkflowCommandRecord } from '../repository/WorkflowCommandRecord'\nimport { WorkflowCommandRepository } from '../repository/WorkflowCommandRepository'\n\nexport interface PersistentCommandQueueOptions {\n pollIntervalMs?: number\n concurrency?: number\n processingTimeoutMs?: number\n staleCheckIntervalMs?: number\n cleanupIntervalMs?: number\n commandRetentionMs?: number\n failedRetentionMs?: number\n maxAttempts?: number\n}\n\nexport class PersistentCommandQueue implements CommandQueue {\n private readonly pollIntervalMs: number\n private readonly concurrency: number\n private readonly processingTimeoutMs: number\n private readonly staleCheckIntervalMs: number\n private readonly cleanupIntervalMs: number\n private readonly commandRetentionMs: number\n private readonly failedRetentionMs: number\n private readonly maxAttempts: number\n\n private running = false\n private activeCount = 0\n private onJobHandler?: (job: WorkflowCommandJob) => Promise<void>\n\n private readonly repository: WorkflowCommandRepository\n private readonly contextProvider: AgentContextProvider\n private readonly rootContext: AgentContext\n private readonly logger: AgentConfig['logger']\n private readonly pendingSleeps = new Set<{ timer: NodeJS.Timeout; resolve: () => void }>()\n\n public constructor(\n repository: WorkflowCommandRepository,\n contextProvider: AgentContextProvider,\n rootContext: AgentContext,\n options?: PersistentCommandQueueOptions\n ) {\n this.repository = repository\n this.contextProvider = contextProvider\n this.rootContext = rootContext\n this.logger = rootContext.dependencyManager.resolve(AgentConfig).logger\n\n this.pollIntervalMs = options?.pollIntervalMs ?? 100\n this.concurrency = Math.max(1, options?.concurrency ?? 3)\n this.processingTimeoutMs = options?.processingTimeoutMs ?? 30000\n this.staleCheckIntervalMs = options?.staleCheckIntervalMs ?? 5000\n this.cleanupIntervalMs = options?.cleanupIntervalMs ?? 60000\n this.commandRetentionMs = options?.commandRetentionMs ?? 3600000 // 1 hour\n this.failedRetentionMs = options?.failedRetentionMs ?? 86400000 // 24 hours\n this.maxAttempts = options?.maxAttempts ?? 3\n }\n\n public async isReady(): Promise<boolean> {\n return true // Always ready (uses existing storage)\n }\n\n public async enqueue(agentContext: AgentContext, job: WorkflowCommandJob): Promise<void> {\n // Always persist commands in the root context so a single worker can process\n // commands across tenants and resolve the proper context per job.\n // Deduplicate by (cmd, thid) when a command is already pending/processing\n try {\n const existing = await this.repository.findByQuery(this.rootContext, { thid: job.thid })\n if (\n existing?.some?.(\n (r) => r.cmd === job.cmd && (r.status === 'pending' || r.status === 'processing')\n )\n ) {\n this.logger.debug(\n `[PersistentQueue] Dedup enqueue: command already queued (${job.cmd}) for ${job.thid}`\n )\n return\n }\n } catch {\n // swallow and proceed to enqueue\n }\n\n const record = new WorkflowCommandRecord({\n cmd: job.cmd,\n thid: job.thid,\n connectionId: job.connectionId,\n idempotencyKey: job.idempotency_key,\n payload: job.payload,\n contextCorrelationId: job.contextCorrelationId,\n status: 'pending',\n attempts: 0,\n createdAt: new Date(),\n })\n\n await this.repository.save(this.rootContext, record)\n this.logger.debug(`[PersistentQueue] Enqueued command: ${job.cmd} for ${job.thid}`)\n\n // Trigger immediate poll (non-blocking)\n setImmediate(() => void this.poll())\n }\n\n public triggerPoll(): void {\n // Non-blocking immediate poll hint\n try {\n setImmediate(() => void this.poll())\n } catch {\n // best-effort only\n }\n }\n\n public async startWorker(onJob: (job: WorkflowCommandJob) => Promise<void>): Promise<void> {\n this.onJobHandler = onJob\n this.running = true\n\n this.logger.info('[PersistentQueue] Starting worker loops', {\n pollIntervalMs: this.pollIntervalMs,\n concurrency: this.concurrency,\n processingTimeoutMs: this.processingTimeoutMs,\n })\n\n // Start background loops (non-blocking)\n void this.pollLoop()\n void this.staleCheckLoop()\n void this.cleanupLoop()\n }\n\n public async stop(): Promise<void> {\n this.logger.info('[PersistentQueue] Stopping worker...')\n this.running = false\n\n // Cancel any pending sleep timers and resolve sleepers\n for (const entry of Array.from(this.pendingSleeps)) {\n try {\n clearTimeout(entry.timer)\n } catch {}\n try {\n entry.resolve()\n } catch {}\n this.pendingSleeps.delete(entry)\n }\n\n // Wait for active jobs to complete (with timeout)\n const maxWait = 10000\n const start = Date.now()\n while (this.activeCount > 0 && Date.now() - start < maxWait) {\n await this.sleep(100)\n }\n\n if (this.activeCount > 0) {\n this.logger.warn(`[PersistentQueue] Stopped with ${this.activeCount} active jobs`)\n } else {\n this.logger.info('[PersistentQueue] Stopped cleanly')\n }\n }\n\n private async pollLoop(): Promise<void> {\n while (this.running) {\n try {\n await this.poll()\n } catch (err) {\n if (this.running && this.logger && typeof this.logger.error === 'function') {\n this.logger.error('[PersistentQueue] Poll error', { error: (err as Error).message })\n }\n }\n await this.sleep(this.pollIntervalMs)\n }\n }\n\n private async poll(): Promise<void> {\n if (this.activeCount >= this.concurrency) return\n if (!this.onJobHandler) return\n\n const limit = this.concurrency - this.activeCount\n const pending = await this.repository.findPending(this.rootContext, limit)\n if (pending.length > 0) {\n try {\n this.logger.info('[PersistentQueue] Pending commands fetched', {\n count: pending.length,\n })\n } catch {}\n }\n\n for (const record of pending) {\n // Check max attempts before processing\n if (record.attempts >= this.maxAttempts) {\n await this.repository.markFailed(\n this.rootContext,\n record,\n `Max attempts (${this.maxAttempts}) exceeded`\n )\n this.logger.warn(`[PersistentQueue] Command ${record.id} failed after ${this.maxAttempts} attempts`)\n continue\n }\n\n // Mark as processing\n await this.repository.markProcessing(this.rootContext, record)\n this.activeCount++\n\n // Process in background\n void this.processCommand(record)\n }\n }\n\n private async processCommand(record: WorkflowCommandRecord): Promise<void> {\n let scoped: { context: AgentContext; release: () => Promise<void> } | null = null\n try {\n // Resolve tenant context\n scoped = await this.resolveContext(record.contextCorrelationId)\n\n if (!scoped) {\n throw new Error(`Unable to resolve context: ${record.contextCorrelationId}`)\n }\n\n const job: WorkflowCommandJob = {\n cmd: record.cmd,\n thid: record.thid,\n connectionId: record.connectionId,\n idempotency_key: record.idempotencyKey,\n payload: record.payload,\n contextCorrelationId: record.contextCorrelationId,\n }\n\n try {\n this.logger.info('[PersistentQueue] Processing command', {\n cmd: record.cmd,\n thid: record.thid,\n attempts: record.attempts,\n })\n } catch {}\n await this.onJobHandler!(job)\n\n // Mark as completed in root context (commands are stored centrally)\n await this.repository.markCompleted(this.rootContext, record)\n try {\n this.logger.info('[PersistentQueue] Completed command', {\n cmd: record.cmd,\n thid: record.thid,\n })\n } catch {}\n } catch (err) {\n const errorMsg = (err as Error).message || 'Unknown error'\n const errCode = (err as unknown as { code?: string })?.code\n if (this.running && this.logger && typeof this.logger.error === 'function') {\n this.logger.error(`[PersistentQueue] Command processing failed: ${record.cmd} for ${record.thid}`, {\n error: errorMsg,\n attempts: record.attempts,\n })\n }\n // Special deferral for missing template: keep retrying without exhausting attempts\n if (errCode === 'invalid_template') {\n try {\n // Small backoff to avoid tight retry loop\n await this.sleep(Math.min(1000, this.pollIntervalMs * 10))\n } catch {}\n try {\n // Undo the attempt increment performed when marking processing\n if (record.attempts > 0) record.attempts -= 1\n } catch {}\n await this.repository.resetToPending(this.rootContext, record)\n try {\n this.logger.info('[PersistentQueue] Deferred command due to missing template; reset to pending', {\n cmd: record.cmd,\n thid: record.thid,\n })\n } catch {}\n return\n }\n\n // Mark as failed if max attempts reached, otherwise reset to pending for retry\n if (record.attempts >= this.maxAttempts) {\n await this.repository.markFailed(this.rootContext, record, errorMsg)\n } else {\n await this.repository.resetToPending(this.rootContext, record)\n try {\n this.logger.info('[PersistentQueue] Resetting command to pending for retry', {\n cmd: record.cmd,\n thid: record.thid,\n attempts: record.attempts,\n })\n } catch {}\n }\n } finally {\n // Always release scoped context if obtained\n try {\n await scoped?.release?.()\n } catch {}\n this.activeCount--\n }\n }\n\n private async staleCheckLoop(): Promise<void> {\n while (this.running) {\n await this.sleep(this.staleCheckIntervalMs)\n try {\n const stale = await this.repository.findStale(this.rootContext, this.processingTimeoutMs)\n\n for (const record of stale) {\n this.logger.warn(`[PersistentQueue] Resetting stale command: ${record.cmd} for ${record.thid}`, {\n attempts: record.attempts,\n lastAttempt: record.lastAttemptAt?.toISOString(),\n })\n\n if (record.attempts >= this.maxAttempts) {\n await this.repository.markFailed(this.rootContext, record, 'Stale after max attempts')\n } else {\n await this.repository.resetToPending(this.rootContext, record)\n }\n }\n } catch (err) {\n if (this.running && this.logger && typeof this.logger.error === 'function') {\n this.logger.error('[PersistentQueue] Stale check error', { error: (err as Error).message })\n }\n }\n }\n }\n\n private async cleanupLoop(): Promise<void> {\n while (this.running) {\n await this.sleep(this.cleanupIntervalMs)\n try {\n const completedCutoff = new Date(Date.now() - this.commandRetentionMs)\n const failedCutoff = new Date(Date.now() - this.failedRetentionMs)\n\n const [completedDeleted, failedDeleted] = await Promise.all([\n this.repository.deleteCompleted(this.rootContext, completedCutoff),\n this.repository.deleteFailed(this.rootContext, failedCutoff),\n ])\n\n if (completedDeleted > 0 || failedDeleted > 0) {\n this.logger.debug(`[PersistentQueue] Cleanup: deleted ${completedDeleted} completed, ${failedDeleted} failed`)\n }\n } catch (err) {\n if (this.running && this.logger && typeof this.logger.error === 'function') {\n this.logger.error('[PersistentQueue] Cleanup error', { error: (err as Error).message })\n }\n }\n }\n }\n\n private async resolveContext(\n correlationId: string\n ): Promise<{ context: AgentContext; release: () => Promise<void> } | null> {\n const rootId = this.rootContext.contextCorrelationId\n\n if (!correlationId || correlationId === rootId) {\n return { context: this.rootContext, release: async () => {} }\n }\n\n try {\n // Some inbound paths may enqueue with base context id (e.g., 'default').\n // If we can resolve it, do so; otherwise, fall back to root tenant context so\n // jobs in this queue are still processed under the tenant.\n const scopedContext = await this.contextProvider.getAgentContextForContextCorrelationId(correlationId)\n return {\n context: scopedContext,\n release: async () => {\n try {\n await this.contextProvider.endSessionForAgentContext(scopedContext)\n } catch (error) {\n this.logger.debug('[PersistentQueue] Failed to end tenant session', {\n contextCorrelationId: correlationId,\n error: (error as Error).message,\n })\n }\n },\n }\n } catch (error) {\n if (this.running && this.logger && typeof this.logger.error === 'function') {\n this.logger.error('[PersistentQueue] Unable to resolve context, falling back to root', {\n contextCorrelationId: correlationId,\n error: (error as Error).message,\n })\n }\n // Fallback: use the root agent context bound to this queue\n return { context: this.rootContext, release: async () => {} }\n }\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((outerResolve) => {\n const entry = { timer: undefined as unknown as NodeJS.Timeout, resolve: () => {} }\n const resolve = () => {\n try {\n outerResolve()\n } finally {\n this.pendingSleeps.delete(entry)\n }\n }\n entry.resolve = resolve\n entry.timer = setTimeout(resolve, ms)\n this.pendingSleeps.add(entry)\n })\n }\n\n public async getMetrics(): Promise<{\n pending: number\n processing: number\n completed: number\n failed: number\n active: number\n }> {\n const repoMetrics = await this.repository.getMetrics(this.rootContext)\n return {\n ...repoMetrics,\n active: this.activeCount,\n }\n }\n}\n"],"mappings":";;;;;AAkBA,IAAa,yBAAb,MAA4D;CAoB1D,AAAO,YACL,YACA,iBACA,aACA,SACA;OAfM,UAAU;OACV,cAAc;OAOL,gCAAgB,IAAI,KAAqD;AAQxF,OAAK,aAAa;AAClB,OAAK,kBAAkB;AACvB,OAAK,cAAc;AACnB,OAAK,SAAS,YAAY,kBAAkB,QAAQ,YAAY,CAA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,QAAQ,WAAW,SAAS,GAAG;AACrC,QAAK,cAAc,IAAI,MAAM;IAC7B;;CAGJ,MAAa,aAMV;AAED,SAAO;GACL,GAFkB,MAAM,KAAK,WAAW,WAAW,KAAK,YAAY;GAGpE,QAAQ,KAAK;GACd"}
|
|
1
|
+
{"version":3,"file":"PersistentCommandQueue.mjs","names":["scoped: { context: AgentContext; release: () => Promise<void> } | null","job: WorkflowCommandJob"],"sources":["../../src/queue/PersistentCommandQueue.ts"],"sourcesContent":["import type { AgentContext, AgentContextProvider } from '@credo-ts/core'\nimport type { CommandQueue, WorkflowCommandJob } from './CommandQueue'\n\nimport { AgentConfig, InjectionSymbols } from '@credo-ts/core'\nimport { WorkflowCommandRecord } from '../repository/WorkflowCommandRecord'\nimport { WorkflowCommandRepository } from '../repository/WorkflowCommandRepository'\n\nexport interface PersistentCommandQueueOptions {\n pollIntervalMs?: number\n concurrency?: number\n processingTimeoutMs?: number\n staleCheckIntervalMs?: number\n cleanupIntervalMs?: number\n commandRetentionMs?: number\n failedRetentionMs?: number\n maxAttempts?: number\n}\n\nexport class PersistentCommandQueue implements CommandQueue {\n private readonly pollIntervalMs: number\n private readonly concurrency: number\n private readonly processingTimeoutMs: number\n private readonly staleCheckIntervalMs: number\n private readonly cleanupIntervalMs: number\n private readonly commandRetentionMs: number\n private readonly failedRetentionMs: number\n private readonly maxAttempts: number\n\n private running = false\n private activeCount = 0\n private onJobHandler?: (job: WorkflowCommandJob) => Promise<void>\n\n private readonly repository: WorkflowCommandRepository\n private readonly contextProvider: AgentContextProvider\n private readonly rootContext: AgentContext\n private readonly logger: AgentConfig['logger']\n private readonly pendingSleeps = new Set<{ timer: NodeJS.Timeout; resolve: () => void }>()\n\n public constructor(\n repository: WorkflowCommandRepository,\n contextProvider: AgentContextProvider,\n rootContext: AgentContext,\n options?: PersistentCommandQueueOptions\n ) {\n this.repository = repository\n this.contextProvider = contextProvider\n this.rootContext = rootContext\n this.logger = rootContext.dependencyManager.resolve(AgentConfig).logger\n\n this.pollIntervalMs = options?.pollIntervalMs ?? 100\n this.concurrency = Math.max(1, options?.concurrency ?? 3)\n this.processingTimeoutMs = options?.processingTimeoutMs ?? 30000\n this.staleCheckIntervalMs = options?.staleCheckIntervalMs ?? 5000\n this.cleanupIntervalMs = options?.cleanupIntervalMs ?? 60000\n this.commandRetentionMs = options?.commandRetentionMs ?? 3600000 // 1 hour\n this.failedRetentionMs = options?.failedRetentionMs ?? 86400000 // 24 hours\n this.maxAttempts = options?.maxAttempts ?? 3\n }\n\n public async isReady(): Promise<boolean> {\n return true // Always ready (uses existing storage)\n }\n\n public async enqueue(agentContext: AgentContext, job: WorkflowCommandJob): Promise<void> {\n // Always persist commands in the root context so a single worker can process\n // commands across tenants and resolve the proper context per job.\n // Deduplicate by (cmd, thid) when a command is already pending/processing\n try {\n const existing = await this.repository.findByQuery(this.rootContext, { thid: job.thid })\n if (\n existing?.some?.(\n (r) => r.cmd === job.cmd && (r.status === 'pending' || r.status === 'processing')\n )\n ) {\n this.logger.debug(\n `[PersistentQueue] Dedup enqueue: command already queued (${job.cmd}) for ${job.thid}`\n )\n return\n }\n } catch {\n // swallow and proceed to enqueue\n }\n\n const record = new WorkflowCommandRecord({\n cmd: job.cmd,\n thid: job.thid,\n connectionId: job.connectionId,\n idempotencyKey: job.idempotency_key,\n payload: job.payload,\n contextCorrelationId: job.contextCorrelationId,\n status: 'pending',\n attempts: 0,\n createdAt: new Date(),\n })\n\n await this.repository.save(this.rootContext, record)\n this.logger.debug(`[PersistentQueue] Enqueued command: ${job.cmd} for ${job.thid}`)\n\n // Trigger immediate poll (non-blocking)\n setImmediate(() => void this.poll())\n }\n\n public triggerPoll(): void {\n // Non-blocking immediate poll hint\n try {\n setImmediate(() => void this.poll())\n } catch {\n // best-effort only\n }\n }\n\n public async startWorker(onJob: (job: WorkflowCommandJob) => Promise<void>): Promise<void> {\n this.onJobHandler = onJob\n this.running = true\n\n this.logger.info('[PersistentQueue] Starting worker loops', {\n pollIntervalMs: this.pollIntervalMs,\n concurrency: this.concurrency,\n processingTimeoutMs: this.processingTimeoutMs,\n })\n\n // Start background loops (non-blocking)\n void this.pollLoop()\n void this.staleCheckLoop()\n void this.cleanupLoop()\n }\n\n public async stop(): Promise<void> {\n this.logger.info('[PersistentQueue] Stopping worker...')\n this.running = false\n\n // Cancel any pending sleep timers and resolve sleepers\n for (const entry of Array.from(this.pendingSleeps)) {\n try {\n clearTimeout(entry.timer)\n } catch {}\n try {\n entry.resolve()\n } catch {}\n this.pendingSleeps.delete(entry)\n }\n\n // Wait for active jobs to complete (with timeout)\n const maxWait = 10000\n const start = Date.now()\n while (this.activeCount > 0 && Date.now() - start < maxWait) {\n await this.sleep(100)\n }\n\n if (this.activeCount > 0) {\n this.logger.warn(`[PersistentQueue] Stopped with ${this.activeCount} active jobs`)\n } else {\n this.logger.info('[PersistentQueue] Stopped cleanly')\n }\n }\n\n private async pollLoop(): Promise<void> {\n while (this.running) {\n try {\n await this.poll()\n } catch (err) {\n if (this.running && this.logger && typeof this.logger.error === 'function') {\n this.logger.error('[PersistentQueue] Poll error', { error: (err as Error).message })\n }\n }\n await this.sleep(this.pollIntervalMs)\n }\n }\n\n private async poll(): Promise<void> {\n if (this.activeCount >= this.concurrency) return\n if (!this.onJobHandler) return\n\n const limit = this.concurrency - this.activeCount\n const pending = await this.repository.findPending(this.rootContext, limit)\n if (pending.length > 0) {\n try {\n this.logger.info('[PersistentQueue] Pending commands fetched', {\n count: pending.length,\n })\n } catch {}\n }\n\n for (const record of pending) {\n // Check max attempts before processing\n if (record.attempts >= this.maxAttempts) {\n await this.repository.markFailed(\n this.rootContext,\n record,\n `Max attempts (${this.maxAttempts}) exceeded`\n )\n this.logger.warn(`[PersistentQueue] Command ${record.id} failed after ${this.maxAttempts} attempts`)\n continue\n }\n\n // Mark as processing\n await this.repository.markProcessing(this.rootContext, record)\n this.activeCount++\n\n // Process in background\n void this.processCommand(record)\n }\n }\n\n private async processCommand(record: WorkflowCommandRecord): Promise<void> {\n let scoped: { context: AgentContext; release: () => Promise<void> } | null = null\n try {\n // Resolve tenant context\n scoped = await this.resolveContext(record.contextCorrelationId)\n\n if (!scoped) {\n throw new Error(`Unable to resolve context: ${record.contextCorrelationId}`)\n }\n\n const job: WorkflowCommandJob = {\n cmd: record.cmd,\n thid: record.thid,\n connectionId: record.connectionId,\n idempotency_key: record.idempotencyKey,\n payload: record.payload,\n contextCorrelationId: record.contextCorrelationId,\n }\n\n try {\n this.logger.info('[PersistentQueue] Processing command', {\n cmd: record.cmd,\n thid: record.thid,\n attempts: record.attempts,\n })\n } catch {}\n await this.onJobHandler!(job)\n\n // Mark as completed in root context (commands are stored centrally)\n await this.repository.markCompleted(this.rootContext, record)\n try {\n this.logger.info('[PersistentQueue] Completed command', {\n cmd: record.cmd,\n thid: record.thid,\n })\n } catch {}\n } catch (err) {\n const errorMsg = (err as Error).message || 'Unknown error'\n const errCode = (err as unknown as { code?: string })?.code\n if (this.running && this.logger && typeof this.logger.error === 'function') {\n this.logger.error(`[PersistentQueue] Command processing failed: ${record.cmd} for ${record.thid}`, {\n error: errorMsg,\n attempts: record.attempts,\n })\n }\n // Special deferral for missing template: keep retrying without exhausting attempts\n if (errCode === 'invalid_template') {\n try {\n // Short backoff — template usually arrives within ~1s of fetch-template\n await this.sleep(Math.min(200, this.pollIntervalMs * 2))\n } catch {}\n try {\n // Undo the attempt increment performed when marking processing\n if (record.attempts > 0) record.attempts -= 1\n } catch {}\n await this.repository.resetToPending(this.rootContext, record)\n try {\n this.logger.info('[PersistentQueue] Deferred command due to missing template; reset to pending', {\n cmd: record.cmd,\n thid: record.thid,\n })\n } catch {}\n return\n }\n\n // Mark as failed if max attempts reached, otherwise reset to pending for retry\n if (record.attempts >= this.maxAttempts) {\n await this.repository.markFailed(this.rootContext, record, errorMsg)\n } else {\n await this.repository.resetToPending(this.rootContext, record)\n try {\n this.logger.info('[PersistentQueue] Resetting command to pending for retry', {\n cmd: record.cmd,\n thid: record.thid,\n attempts: record.attempts,\n })\n } catch {}\n }\n } finally {\n // Always release scoped context if obtained\n try {\n await scoped?.release?.()\n } catch {}\n this.activeCount--\n }\n }\n\n private async staleCheckLoop(): Promise<void> {\n while (this.running) {\n await this.sleep(this.staleCheckIntervalMs)\n try {\n const stale = await this.repository.findStale(this.rootContext, this.processingTimeoutMs)\n\n for (const record of stale) {\n this.logger.warn(`[PersistentQueue] Resetting stale command: ${record.cmd} for ${record.thid}`, {\n attempts: record.attempts,\n lastAttempt: record.lastAttemptAt?.toISOString(),\n })\n\n if (record.attempts >= this.maxAttempts) {\n await this.repository.markFailed(this.rootContext, record, 'Stale after max attempts')\n } else {\n await this.repository.resetToPending(this.rootContext, record)\n }\n }\n } catch (err) {\n if (this.running && this.logger && typeof this.logger.error === 'function') {\n this.logger.error('[PersistentQueue] Stale check error', { error: (err as Error).message })\n }\n }\n }\n }\n\n private async cleanupLoop(): Promise<void> {\n while (this.running) {\n await this.sleep(this.cleanupIntervalMs)\n try {\n const completedCutoff = new Date(Date.now() - this.commandRetentionMs)\n const failedCutoff = new Date(Date.now() - this.failedRetentionMs)\n\n const [completedDeleted, failedDeleted] = await Promise.all([\n this.repository.deleteCompleted(this.rootContext, completedCutoff),\n this.repository.deleteFailed(this.rootContext, failedCutoff),\n ])\n\n if (completedDeleted > 0 || failedDeleted > 0) {\n this.logger.debug(`[PersistentQueue] Cleanup: deleted ${completedDeleted} completed, ${failedDeleted} failed`)\n }\n } catch (err) {\n if (this.running && this.logger && typeof this.logger.error === 'function') {\n this.logger.error('[PersistentQueue] Cleanup error', { error: (err as Error).message })\n }\n }\n }\n }\n\n private async resolveContext(\n correlationId: string\n ): Promise<{ context: AgentContext; release: () => Promise<void> } | null> {\n const rootId = this.rootContext.contextCorrelationId\n\n if (!correlationId || correlationId === rootId) {\n return { context: this.rootContext, release: async () => {} }\n }\n\n try {\n // Some inbound paths may enqueue with base context id (e.g., 'default').\n // If we can resolve it, do so; otherwise, fall back to root tenant context so\n // jobs in this queue are still processed under the tenant.\n const scopedContext = await this.contextProvider.getAgentContextForContextCorrelationId(correlationId)\n return {\n context: scopedContext,\n release: async () => {\n try {\n await this.contextProvider.endSessionForAgentContext(scopedContext)\n } catch (error) {\n this.logger.debug('[PersistentQueue] Failed to end tenant session', {\n contextCorrelationId: correlationId,\n error: (error as Error).message,\n })\n }\n },\n }\n } catch (error) {\n if (this.running && this.logger && typeof this.logger.error === 'function') {\n this.logger.error('[PersistentQueue] Unable to resolve context, falling back to root', {\n contextCorrelationId: correlationId,\n error: (error as Error).message,\n })\n }\n // Fallback: use the root agent context bound to this queue\n return { context: this.rootContext, release: async () => {} }\n }\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((outerResolve) => {\n const entry = { timer: undefined as unknown as NodeJS.Timeout, resolve: () => {} }\n const resolve = () => {\n try {\n outerResolve()\n } finally {\n this.pendingSleeps.delete(entry)\n }\n }\n entry.resolve = resolve\n entry.timer = setTimeout(resolve, ms)\n this.pendingSleeps.add(entry)\n })\n }\n\n public async getMetrics(): Promise<{\n pending: number\n processing: number\n completed: number\n failed: number\n active: number\n }> {\n const repoMetrics = await this.repository.getMetrics(this.rootContext)\n return {\n ...repoMetrics,\n active: this.activeCount,\n }\n }\n}\n"],"mappings":";;;;;AAkBA,IAAa,yBAAb,MAA4D;CAoB1D,AAAO,YACL,YACA,iBACA,aACA,SACA;OAfM,UAAU;OACV,cAAc;OAOL,gCAAgB,IAAI,KAAqD;AAQxF,OAAK,aAAa;AAClB,OAAK,kBAAkB;AACvB,OAAK,cAAc;AACnB,OAAK,SAAS,YAAY,kBAAkB,QAAQ,YAAY,CAAC;AAEjE,OAAK,iBAAiB,SAAS,kBAAkB;AACjD,OAAK,cAAc,KAAK,IAAI,GAAG,SAAS,eAAe,EAAE;AACzD,OAAK,sBAAsB,SAAS,uBAAuB;AAC3D,OAAK,uBAAuB,SAAS,wBAAwB;AAC7D,OAAK,oBAAoB,SAAS,qBAAqB;AACvD,OAAK,qBAAqB,SAAS,sBAAsB;AACzD,OAA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128
128
|
WorkflowCommandRepository = __decorate([
|
|
129
129
|
injectable(),
|
|
130
130
|
__decorateParam(0, inject(InjectionSymbols.StorageService)),
|
|
131
|
-
__decorateMetadata("design:paramtypes", [Object,
|
|
131
|
+
__decorateMetadata("design:paramtypes", [Object, EventEmitter])
|
|
132
132
|
], WorkflowCommandRepository);
|
|
133
133
|
|
|
134
134
|
//#endregion
|
|
@@ -40,7 +40,7 @@ let WorkflowInstanceRepository = class WorkflowInstanceRepository$1 extends Repo
|
|
|
40
40
|
WorkflowInstanceRepository = __decorate([
|
|
41
41
|
injectable(),
|
|
42
42
|
__decorateParam(0, inject(InjectionSymbols.StorageService)),
|
|
43
|
-
__decorateMetadata("design:paramtypes", [Object,
|
|
43
|
+
__decorateMetadata("design:paramtypes", [Object, EventEmitter])
|
|
44
44
|
], WorkflowInstanceRepository);
|
|
45
45
|
|
|
46
46
|
//#endregion
|
|
@@ -35,7 +35,7 @@ let WorkflowTemplateRepository = class WorkflowTemplateRepository$1 extends Repo
|
|
|
35
35
|
WorkflowTemplateRepository = __decorate([
|
|
36
36
|
injectable(),
|
|
37
37
|
__decorateParam(0, inject(InjectionSymbols.StorageService)),
|
|
38
|
-
__decorateMetadata("design:paramtypes", [Object,
|
|
38
|
+
__decorateMetadata("design:paramtypes", [Object, EventEmitter])
|
|
39
39
|
], WorkflowTemplateRepository);
|
|
40
40
|
|
|
41
41
|
//#endregion
|
|
@@ -570,11 +570,11 @@ let WorkflowService = class WorkflowService$1 {
|
|
|
570
570
|
}
|
|
571
571
|
};
|
|
572
572
|
WorkflowService = __decorate([injectable(), __decorateMetadata("design:paramtypes", [
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
573
|
+
WorkflowTemplateRepository,
|
|
574
|
+
WorkflowInstanceRepository,
|
|
575
|
+
WorkflowModuleConfig,
|
|
576
|
+
AgentConfig,
|
|
577
|
+
EventEmitter
|
|
578
578
|
])], WorkflowService);
|
|
579
579
|
|
|
580
580
|
//#endregion
|