@ajna-inc/workflow 0.6.2 → 0.6.4
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 +8 -8
- package/.npmvc/sbom.cdx.json +3 -3
- 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/PauseMessage.d.mts +2 -2
- package/build/protocol/messages/ProblemReportMessage.d.mts +2 -2
- package/build/protocol/messages/PublishTemplateMessage.d.mts +2 -2
- package/build/protocol/messages/ResumeMessage.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/WorkflowsMessage.d.mts +2 -2
- package/build/protocol/messages/WorkflowsMessage.d.mts.map +1 -1
- package/build/queue/PersistentCommandQueue.d.mts.map +1 -1
- package/build/queue/PersistentCommandQueue.mjs +13 -5
- package/build/queue/PersistentCommandQueue.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2,40 +2,40 @@
|
|
|
2
2
|
"schema": "https://npmvc.com/schemas/attestation-bundle/v1",
|
|
3
3
|
"package": {
|
|
4
4
|
"name": "@ajna-inc/workflow",
|
|
5
|
-
"version": "0.6.
|
|
5
|
+
"version": "0.6.4"
|
|
6
6
|
},
|
|
7
|
-
"bundledAt": "2026-04-
|
|
7
|
+
"bundledAt": "2026-04-30T07:25:21.828Z",
|
|
8
8
|
"envelopes": [
|
|
9
9
|
{
|
|
10
10
|
"payloadType": "application/vc+json",
|
|
11
|
-
"payload": "
|
|
11
|
+
"payload": "eyJAY29udGV4dCI6W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TVi7dP84MjSuEuco#z6MkhJ5YBSdBLHHJbji45kiJnRdLUDPuTVi7dP84MjSuEuco",
|
|
15
15
|
"alg": "Ed25519",
|
|
16
|
-
"sig": "
|
|
16
|
+
"sig": "jl8G4YJTMqWcNHkaH4qFCHDnd3aKsL8ZMA8zJID10xavHe70mdQUsVVJU2+J2sEd8rYxxodklImHTAgA2qOMDA=="
|
|
17
17
|
}
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"payloadType": "application/vc+json",
|
|
22
|
-
"payload": "
|
|
22
|
+
"payload": "eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiLCJodHRwczovL25wbXZjLmNvbS9zY2hlbWFzL3N1cHBseWNoYWluL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImRlY2xhcmVkU2NyaXB0cyI6WyJidWlsZCIsInByZXB1Ymxpc2hPbmx5IiwiY2xlYW4iLCJwcmVwYWNrIl0sImlkIjoicGtnOm5wbS9AYWpuYS1pbmMvd29ya2Zsb3dAMC42LjQiLCJwb3N0SW5zdGFsbFBvbGljeSI6ImZvcmJpZGRlbiIsInRhcmJhbGwiOnsiZGlnZXN0Ijp7fSwibmFtZSI6IkBham5hLWluYy93b3JrZmxvdyIsInZlcnNpb24iOiIwLjYuNCJ9LCJ3aGl0ZWxpc3RlZFNjcmlwdHMiOltdfSwiaWQiOiJ1cm46dXVpZDplOGE4YzhhMi05NTAwLTQ1ODUtYmI1MS1mMzNlMjczYzBkY2QiLCJpc3N1ZXIiOiJkaWQ6a2V5Ono2TWtoSjVZQlNkQkxISEpiamk0NWtpSm5SZExVRFB1VFZpN2RQODRNalN1RXVjbyIsInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJMaWZlY3ljbGVQb2xpY3lDcmVkZW50aWFsIl0sInZhbGlkRnJvbSI6IjIwMjYtMDQtMzBUMDc6MjU6MjEuNTgwWiJ9",
|
|
23
23
|
"signatures": [
|
|
24
24
|
{
|
|
25
25
|
"keyid": "did:key:z6MkhJ5YBSdBLHHJbji45kiJnRdLUDPuTVi7dP84MjSuEuco#z6MkhJ5YBSdBLHHJbji45kiJnRdLUDPuTVi7dP84MjSuEuco",
|
|
26
26
|
"alg": "Ed25519",
|
|
27
|
-
"sig": "
|
|
27
|
+
"sig": "KykQqdDBM7tJy9VvT40TV73Wm14X88njyz2KlxHzu6Ez4gJYs4RdYIHPP96ToUUAZ1EJR3uKqlvfiQu4xVFICQ=="
|
|
28
28
|
}
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"payloadType": "application/vc+json",
|
|
33
|
-
"payload": "
|
|
33
|
+
"payload": "eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiLCJodHRwczovL25wbXZjLmNvbS9zY2hlbWFzL3N1cHBseWNoYWluL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImZvcm1hdCI6ImN5Y2xvbmVkeC0xLjYiLCJpZCI6InBrZzpucG0vQGFqbmEtaW5jL3dvcmtmbG93QDAuNi40Iiwic2JvbURpZ2VzdCI6eyJhbGciOiJzaGEyNTYiLCJoZXgiOiIyNmY2MDc0MGQxMDg3M2UwYjBlNzU5NGY4Nzk1ZjI4MTQ1MzA3OWE0Nzc4YjZjZjA4ZTEyMmQzMjVjNTE1NWNmIn0sInNib21VcmwiOiIuLy5ucG12Yy9zYm9tLmNkeC5qc29uIiwidGFyYmFsbCI6eyJkaWdlc3QiOnt9LCJuYW1lIjoiQGFqbmEtaW5jL3dvcmtmbG93IiwidmVyc2lvbiI6IjAuNi40In19LCJpZCI6InVybjp1dWlkOjk3YmVjZGIwLTJiYTYtNGFmMS1hYjYwLTcxODRjZWZjY2Q2MCIsImlzc3VlciI6ImRpZDprZXk6ejZNa2hKNVlCU2RCTEhISmJqaTQ1a2lKblJkTFVEUHVUVmk3ZFA4NE1qU3VFdWNvIiwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlNib21DcmVkZW50aWFsIl0sInZhbGlkRnJvbSI6IjIwMjYtMDQtMzBUMDc6MjU6MjEuODI3WiJ9",
|
|
34
34
|
"signatures": [
|
|
35
35
|
{
|
|
36
36
|
"keyid": "did:key:z6MkhJ5YBSdBLHHJbji45kiJnRdLUDPuTVi7dP84MjSuEuco#z6MkhJ5YBSdBLHHJbji45kiJnRdLUDPuTVi7dP84MjSuEuco",
|
|
37
37
|
"alg": "Ed25519",
|
|
38
|
-
"sig": "
|
|
38
|
+
"sig": "q5wkI74ISni3Z7p+Odw0m7tQg3RW35OUxbcakl+6HP7mEaV7Q8AyxPvpQqMPeLKmIcGv1iEW5pM7a4z7fy8FCw=="
|
|
39
39
|
}
|
|
40
40
|
]
|
|
41
41
|
}
|
package/.npmvc/sbom.cdx.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"specVersion": "1.6",
|
|
4
4
|
"version": 1,
|
|
5
5
|
"metadata": {
|
|
6
|
-
"timestamp": "2026-04-
|
|
6
|
+
"timestamp": "2026-04-30T07:25:21.822Z",
|
|
7
7
|
"component": {
|
|
8
8
|
"type": "application",
|
|
9
9
|
"name": "@ajna-inc/workflow",
|
|
10
|
-
"version": "0.6.
|
|
11
|
-
"purl": "pkg:npm/%40ajna-inc/workflow@0.6.
|
|
10
|
+
"version": "0.6.4",
|
|
11
|
+
"purl": "pkg:npm/%40ajna-inc/workflow@0.6.4"
|
|
12
12
|
},
|
|
13
13
|
"tools": [
|
|
14
14
|
{
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _credo_ts_didcomm1 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_didcomm1.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_didcomm5 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_didcomm5.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,kBAAA,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_didcomm9 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_didcomm9.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_didcomm8 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_didcomm8.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
filters?: {
|
|
@@ -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/FetchTemplateMessage.d.ts
|
|
5
5
|
declare class FetchTemplateMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm11.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
template_id: string;
|
|
@@ -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/PauseMessage.d.ts
|
|
5
5
|
declare class PauseMessage 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,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/ProblemReportMessage.d.ts
|
|
5
5
|
declare class ProblemReportMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm4.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
code: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { WorkflowTemplate } 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/PublishTemplateMessage.d.ts
|
|
6
6
|
declare class PublishTemplateMessage extends DidCommMessage {
|
|
7
|
-
static readonly type:
|
|
7
|
+
static readonly type: _credo_ts_didcomm0.ParsedMessageType;
|
|
8
8
|
type: string;
|
|
9
9
|
body: {
|
|
10
10
|
template: WorkflowTemplate;
|
|
@@ -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/ResumeMessage.d.ts
|
|
5
5
|
declare class ResumeMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm7.ParsedMessageType;
|
|
7
7
|
type: string;
|
|
8
8
|
body: {
|
|
9
9
|
instance_id: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UiItem } from "../../model/types.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _credo_ts_didcomm3 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_didcomm3.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_didcomm2 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_didcomm2.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_didcomm12 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_didcomm12.ParsedMessageType;
|
|
8
8
|
type: string;
|
|
9
9
|
body: {
|
|
10
10
|
template: WorkflowTemplate;
|
|
@@ -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/WorkflowsMessage.d.ts
|
|
5
5
|
declare class WorkflowsMessage extends DidCommMessage {
|
|
6
|
-
static readonly type:
|
|
6
|
+
static readonly type: _credo_ts_didcomm10.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,mBAAA,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistentCommandQueue.d.mts","names":[],"sources":["../../src/queue/PersistentCommandQueue.ts"],"sourcesContent":[],"mappings":";;;;;UAOiB,6BAAA;;EAAA,WAAA,CAAA,EAAA,MAAA;EAWJ,mBAAA,CAAA,EAAA,MAAuB;EAqBpB,oBAAA,CAAA,EAAA,MAAA;EACK,iBAAA,CAAA,EAAA,MAAA;EACJ,kBAAA,CAAA,EAAA,MAAA;EACH,iBAAA,CAAA,EAAA,MAAA;EAiBY,WAAA,CAAA,EAAA,MAAA;;AAI8B,cA7C3C,sBAAA,YAAkC,YA6CS,CAAA;EAAqB,iBAAA,cAAA;EAgDrC,iBAAA,WAAA;EAAuB,iBAAA,mBAAA;EAAgB,iBAAA,oBAAA;EAgBxD,iBAAA,iBAAA;
|
|
1
|
+
{"version":3,"file":"PersistentCommandQueue.d.mts","names":[],"sources":["../../src/queue/PersistentCommandQueue.ts"],"sourcesContent":[],"mappings":";;;;;UAOiB,6BAAA;;EAAA,WAAA,CAAA,EAAA,MAAA;EAWJ,mBAAA,CAAA,EAAA,MAAuB;EAqBpB,oBAAA,CAAA,EAAA,MAAA;EACK,iBAAA,CAAA,EAAA,MAAA;EACJ,kBAAA,CAAA,EAAA,MAAA;EACH,iBAAA,CAAA,EAAA,MAAA;EAiBY,WAAA,CAAA,EAAA,MAAA;;AAI8B,cA7C3C,sBAAA,YAAkC,YA6CS,CAAA;EAAqB,iBAAA,cAAA;EAgDrC,iBAAA,WAAA;EAAuB,iBAAA,mBAAA;EAAgB,iBAAA,oBAAA;EAgBxD,iBAAA,iBAAA;EAmRM,iBAAA,kBAAA;EAhYkB,iBAAA,iBAAA;EAAY,iBAAA,WAAA;;;;;;;;;0BAqB3C,4CACK,mCACJ,wBACH;aAiBY;wBAIW,mBAAmB,qBAAqB;;2BAgDrC,uBAAuB,gBAAgB;UAgBxD;;;;;;;;gBAmRM"}
|
|
@@ -146,17 +146,25 @@ var PersistentCommandQueue = class {
|
|
|
146
146
|
attempts: record.attempts
|
|
147
147
|
});
|
|
148
148
|
if (errCode === "invalid_template") {
|
|
149
|
+
const maxTemplateFetches = 10;
|
|
150
|
+
if (record.attempts >= maxTemplateFetches) {
|
|
151
|
+
this.logger.error(`[PersistentQueue] Template fetch exhausted after ${record.attempts} attempts, marking failed`, {
|
|
152
|
+
cmd: record.cmd,
|
|
153
|
+
thid: record.thid
|
|
154
|
+
});
|
|
155
|
+
await this.repository.markFailed(this.rootContext, record, "Template not available after maximum fetch attempts");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
149
158
|
try {
|
|
150
|
-
await this.sleep(Math.min(
|
|
151
|
-
} catch {}
|
|
152
|
-
try {
|
|
153
|
-
if (record.attempts > 0) record.attempts -= 1;
|
|
159
|
+
await this.sleep(Math.min(200, this.pollIntervalMs * 2));
|
|
154
160
|
} catch {}
|
|
155
161
|
await this.repository.resetToPending(this.rootContext, record);
|
|
156
162
|
try {
|
|
157
163
|
this.logger.info("[PersistentQueue] Deferred command due to missing template; reset to pending", {
|
|
158
164
|
cmd: record.cmd,
|
|
159
|
-
thid: record.thid
|
|
165
|
+
thid: record.thid,
|
|
166
|
+
attempt: record.attempts,
|
|
167
|
+
maxAttempts: maxTemplateFetches
|
|
160
168
|
});
|
|
161
169
|
} catch {}
|
|
162
170
|
return;
|
|
@@ -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,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,OAAK,oBAAoB,SAAS,qBAAqB;AACvD,OAAK,cAAc,SAAS,eAAe;;CAG7C,MAAa,UAA4B;AACvC,SAAO;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D,MAAK,OAAO,MAAM,mCAAmC,EAAE,OAAQ,IAAc,SAAS,CAAC;;;;CAM/F,MAAc,eACZ,eACyE;EACzE,MAAM,SAAS,KAAK,YAAY;AAEhC,MAAI,CAAC,iBAAiB,kBAAkB,OACtC,QAAO;GAAE,SAAS,KAAK;GAAa,SAAS,YAAY;GAAI;AAG/D,MAAI;GAIF,MAAM,gBAAgB,MAAM,KAAK,gBAAgB,uCAAuC,cAAc;AACtG,UAAO;IACL,SAAS;IACT,SAAS,YAAY;AACnB,SAAI;AACF,YAAM,KAAK,gBAAgB,0BAA0B,cAAc;cAC5D,OAAO;AACd,WAAK,OAAO,MAAM,kDAAkD;OAClE,sBAAsB;OACtB,OAAQ,MAAgB;OACzB,CAAC;;;IAGP;WACM,OAAO;AACd,OAAI,KAAK,WAAW,KAAK,UAAU,OAAO,KAAK,OAAO,UAAU,WAC9D,MAAK,OAAO,MAAM,qEAAqE;IACrF,sBAAsB;IACtB,OAAQ,MAAgB;IACzB,CAAC;AAGJ,UAAO;IAAE,SAAS,KAAK;IAAa,SAAS,YAAY;IAAI;;;CAIjE,AAAQ,MAAM,IAA2B;AACvC,SAAO,IAAI,SAAS,iBAAiB;GACnC,MAAM,QAAQ;IAAE,OAAO;IAAwC,eAAe;IAAI;GAClF,MAAM,gBAAgB;AACpB,QAAI;AACF,mBAAc;cACN;AACR,UAAK,cAAc,OAAO,MAAM;;;AAGpC,SAAM,UAAU;AAChB,SAAM,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 // Deferral for missing template: retry up to 10 times, then fail\n if (errCode === 'invalid_template') {\n const maxTemplateFetches = 10\n if (record.attempts >= maxTemplateFetches) {\n this.logger.error(`[PersistentQueue] Template fetch exhausted after ${record.attempts} attempts, marking failed`, {\n cmd: record.cmd,\n thid: record.thid,\n })\n await this.repository.markFailed(this.rootContext, record, 'Template not available after maximum fetch attempts')\n return\n }\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 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 attempt: record.attempts,\n maxAttempts: maxTemplateFetches,\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,OAAK,oBAAoB,SAAS,qBAAqB;AACvD,OAAK,cAAc,SAAS,eAAe;;CAG7C,MAAa,UAA4B;AACvC,SAAO;;CAGT,MAAa,QAAQ,cAA4B,KAAwC;AAIvF,MAAI;AAEF,QADiB,MAAM,KAAK,WAAW,YAAY,K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