assignment-user-matcher 1.3.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -212,6 +212,35 @@ console.log(instance.id, instance.currentStepId);
212
212
 
213
213
  You can still call `registerWorkflow()` and `startWorkflow()` separately if you want explicit lifecycle control.
214
214
 
215
+ #### Escalation ladders (`escalateTo`)
216
+
217
+ A step whose timeout expires normally fails the run (after any `maxRetries`). `escalateTo(stepId)` turns that timeout into a forward hop instead — the classic page-the-primary-then-the-secondary ladder:
218
+
219
+ ```typescript
220
+ const escalation = workflow('oncall', 'On-call escalation')
221
+ .step('page-primary')
222
+ .assignment({ tags: ['sev:1', 'oncall-primary'] })
223
+ .targetUser({ tag: 'oncall-primary' })
224
+ .timeout(60_000)
225
+ .escalateTo('page-secondary')
226
+ .route('result.acked === true', 'mitigate')
227
+ .done()
228
+ .step('page-secondary')
229
+ .assignment({ tags: ['sev:1', 'oncall-secondary'] })
230
+ .targetUser({ tag: 'oncall-secondary' })
231
+ .timeout(300_000)
232
+ .escalateTo('page-manager')
233
+ .done();
234
+ // … 'page-manager' has no escalateTo: the ladder ends and the run fails,
235
+ // which is the honest "escalated to the top and nobody answered" state.
236
+ ```
237
+
238
+ When a step escalates, its outstanding assignment is removed so a late responder cannot act on a superseded tier, `context._escalatedFrom` and `context._escalationDepth` are set, and a `step.escalated` transition is emitted (in addition to `step.expired`). Escalating does **not** consume `maxRetries` — a different person getting the work is not another attempt at the same one. `maxEscalationDepth(n)` (default 10) stops a mis-wired cycle from climbing forever.
239
+
240
+ Registration rejects an escalation target that doesn't exist, a step escalating to itself, escalation without a resolvable timeout, and escalation from inside a parallel group.
241
+
242
+ Targeting matters: `targetUser({ tag: '…' })` routes the step's assignment through ordinary tag matching (so fairness, backlog caps, and the rolling-window grant cap all apply), while `targetUser('<userId>')` makes it workflow-targeted and therefore exempt from the fairness window cap. For tiered escalation you almost always want the tag form.
243
+
215
244
  Plain object workflow definitions are also accepted. The library now fills in sensible defaults:
216
245
 
217
246
  - `version` defaults to `1`
@@ -312,12 +341,60 @@ Operator availability controls. A paused user stops receiving new assignments in
312
341
 
313
342
  When decision traces are enabled, paused users appear struck out in traces with a `paused` reason, and `explainMatch()` reports them as ineligible.
314
343
 
344
+ ### `releaseUserAssignments(userId: string): Promise<string[]>`
345
+
346
+ The redistribution counterpart to `pauseUser`: requeue every pending (matched but not yet accepted) assignment the user holds so other users can pick them up — for when a worker is gone rather than briefly away. Accepted assignments (work in progress) are never touched. Requeued assignments keep their original wait clock (`getQueueStats().oldestWaitingMs` does not reset), workflow subscribers receive an `EXPIRED` event per released assignment, and a still-paused user cannot win their released work back until resumed. Returns the released assignment ids (`[]` when the user holds nothing or is unknown). The idle auto-removal path (`processIdleUsers`) uses the same requeue mechanics internally.
347
+
315
348
  ### `assignToUser(assignmentId: string, userId: string, options?: { force?: boolean }): Promise<{ previousOwnerId: string | null }>`
316
349
 
317
350
  Operator override: hand an assignment directly to a user, bypassing tag/weight selection. Works on queued assignments and on pending assignments held by another user (the previous owner's backlog slot is released and the expiry clock restarts). Idempotent when the user already owns the assignment.
318
351
 
319
352
  Hard rules still apply unless `force: true`: the user must not be paused, must have backlog headroom, must not be vetoed on the assignment, and must not have previously rejected it. The learning layer is never fed by manual assignments. When tracing is active the override is recorded as a decision trace with mode `'manual'`, so supervisor actions land in the same audit trail as organic matches.
320
353
 
354
+ ### Response deadlines & escalation (`Assignment.escalation`)
355
+
356
+ By default an assignment nobody responds to is requeued after the matcher-wide `matchExpirationMs` — and the same user may win it straight back. Attach an `EscalationPolicy` to make that behaviour explicit: a per-assignment deadline, an optional block on the non-responder, a priority climb, and an optional tier ladder that moves the work to a different pool on each hop. **No workflow is required.**
357
+
358
+ ```ts
359
+ await matcher.addAssignment({
360
+ id: 'incident-1',
361
+ tags: ['sev:1', 'oncall-primary'],
362
+ priority: 1000,
363
+ escalation: {
364
+ respondWithinMs: 60_000,
365
+ onNoResponse: 'block', // don't offer it back to whoever ignored it
366
+ priorityBoost: 500, // ignored work climbs the queue
367
+ tiers: [['oncall-primary'], ['oncall-secondary'], ['oncall-manager']],
368
+ onExhausted: 'park', // nobody answered, all the way up
369
+ },
370
+ });
371
+
372
+ matcher.startMaintenance(); // deadlines don't fire unless something sweeps them
373
+ ```
374
+
375
+ | Field | Meaning | Default |
376
+ | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
377
+ | `respondWithinMs` | Per-assignment response deadline, overriding `matchExpirationMs` | required |
378
+ | `onNoResponse` | `'block'` treats a non-response as a soft rejection (same rejected set an explicit reject writes to); `'allow'` keeps the historical behaviour | `'allow'` |
379
+ | `priorityBoost` | Priority delta applied on each hop | `0` |
380
+ | `tiers` | Tag ladder. Tier tags are swapped per hop; tags not named by any tier survive untouched | none |
381
+ | `maxEscalations` | Hop ceiling | `tiers.length - 1`, else unlimited |
382
+ | `onExhausted` | `'queue'` keeps recirculating; `'park'` holds it out of matching | `'queue'` |
383
+
384
+ The wait clock always survives an escalation: requeues go through `addAssignment`, whose `NX` keeps the original first-enqueue time, so `getQueueStats().oldestWaitingMs` measures the work item rather than the current tier.
385
+
386
+ Subscribe via `onAssignmentLifecycle` for `escalated` (`{ fromWorkerId, level, blockedPreviousOwner }`) and `escalationExhausted` (`{ level, parked }`) events; `expired` is still emitted first, so existing consumers are unaffected. Parked assignments are reachable with `getParkedAssignments()`, returned to the queue with `unparkAssignment(id, { resetEscalation? })`, and report `_status: 'parked'` from `getAssignment()` — they never read as "not found". `getEscalationLevel(id)` reports how far an assignment has climbed.
387
+
388
+ ### `startMaintenance(options?)` / `stopMaintenance()` / `runMaintenanceOnce(options?)`
389
+
390
+ Deadlines are not self-firing — something has to sweep them. `startMaintenance()` runs every enabled sweep on one tick:
391
+
392
+ - `responseDeadlines` (default on) — expiry, escalation, parking.
393
+ - `workflowStepTimeouts` (default on when `enableWorkflows`) — the step-timeout index. **Note:** `startOrchestrator()` consumes the event stream but does not sweep step timeouts; without maintenance, `timeoutMs` on a workflow step never fires.
394
+ - `idleUsers` (default on when `idleUserTimeoutMs` is set).
395
+
396
+ `runMaintenanceOnce()` does one pass and returns a `MaintenanceReport` (`expiredMatches`, `escalations`, `parked`, `expiredSteps`, `releasedIdleUsers`, `tookMs`) — use it from a host that already owns a tick (a multi-tenant worker, a serverless schedule) instead of holding a timer per matcher. `startAutoReleaseInterval()` remains as a deprecated alias that sweeps response deadlines only.
397
+
321
398
  ### `getQueueStats(): Promise<QueueStats>`
322
399
 
323
400
  Live operational snapshot for dashboards:
@@ -608,6 +685,25 @@ assignments the current owner is flagged `chosen`). Because it evaluates _now_
608
685
  rather than at decision time, use it for support tooling and dry-runs
609
686
  ("who would get this?"), and decision traces for the compliance-grade record.
610
687
 
688
+ ### Hypothetical preview (`previewMatch`)
689
+
690
+ `previewMatch()` answers "who would receive this assignment if I created it?"
691
+ without persisting or claiming anything. It uses the same scoring and hard
692
+ rules as real matching, so the ranking mirrors what `explainMatch()` would
693
+ report after the assignment is added.
694
+
695
+ ```typescript
696
+ const preview = await matcher.previewMatch(
697
+ { tags: ['english', 'billing'], priority: 100, skillThresholds: { english: 50 } },
698
+ // optional: restrict to specific users
699
+ { userIds: ['alice', 'bob'] },
700
+ );
701
+ // { tags, priority, evaluatedAt, candidates: MatchCandidateTrace[] }
702
+ ```
703
+
704
+ Use it for autosuggestion UIs: render the ranked best-fit workers with score
705
+ breakdowns and blocked reasons before the operator commits the task.
706
+
611
707
  ## Adaptive Matching with Reinforcement Learning
612
708
 
613
709
  The matcher includes an opt-in, Redis-backed contextual bandit that learns from
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Escalation policy — pure logic.
3
+ *
4
+ * An assignment carries an optional `escalation` policy describing what should
5
+ * happen when the user it was matched to lets the response deadline run out.
6
+ * Everything here is deliberately side-effect free: `AssignmentMatcher` owns
7
+ * the Redis writes, this module owns the decisions.
8
+ *
9
+ * The same primitive backs both plain (non-workflow) escalation ladders and,
10
+ * via synthesised policies, workflow steps that escalate on timeout.
11
+ */
12
+ import type { Assignment, EscalationPolicy } from '../types/matcher';
13
+ /** A policy with every optional field resolved. */
14
+ export interface NormalizedEscalationPolicy {
15
+ respondWithinMs: number;
16
+ onNoResponse: 'block' | 'allow';
17
+ priorityBoost: number;
18
+ tiers?: string[][];
19
+ maxEscalations: number;
20
+ onExhausted: 'queue' | 'park';
21
+ }
22
+ /** Internal marker the matcher persists on the assignment between hops. */
23
+ export declare const ESCALATION_LEVEL_FIELD = "_escalationLevel";
24
+ /**
25
+ * Resolve an assignment's policy, or `null` when it has none (the overwhelming
26
+ * majority of assignments — callers use the null to stay on the untouched
27
+ * legacy path).
28
+ */
29
+ export declare function normalizeEscalationPolicy(policy: EscalationPolicy | undefined | null): NormalizedEscalationPolicy | null;
30
+ /** Current escalation level of an assignment (0 = never escalated). */
31
+ export declare function escalationLevelOf(assignment: Assignment): number;
32
+ /**
33
+ * How long the matched user has to respond, in ms. Falls back to the
34
+ * matcher-wide `matchExpirationMs` when the assignment declares no policy.
35
+ */
36
+ export declare function responseDeadlineMs(assignment: Assignment | null | undefined, fallbackMs: number): number;
37
+ /**
38
+ * Same question, answered from the stored JSON without paying for a parse on
39
+ * the claim hot path. Assignments without a policy — effectively all of them
40
+ * in a typical deployment — cost one `indexOf` and nothing else.
41
+ */
42
+ export declare function responseDeadlineFromJson(json: string | null | undefined, fallbackMs: number): number;
43
+ export interface EscalationDecision {
44
+ /** The assignment as it should be re-queued (tier tags + boosted priority + bumped level). */
45
+ assignment: Assignment;
46
+ /** Level after this hop (1 = first escalation). Equals the previous level when exhausted. */
47
+ level: number;
48
+ /** True when the ladder had no hop left — `assignment` is unchanged in that case. */
49
+ exhausted: boolean;
50
+ /** Whether the timed-out owner should be blocked from winning it back. */
51
+ blockPreviousOwner: boolean;
52
+ /** What to do with an exhausted assignment. */
53
+ onExhausted: 'queue' | 'park';
54
+ }
55
+ /**
56
+ * Decide the next state of an assignment whose response deadline elapsed.
57
+ *
58
+ * Tier tags are swapped rather than appended: the vocabulary of every tag
59
+ * named by any tier is removed first, then the target tier's tags are added,
60
+ * so a ladder like `[['oncall-primary'], ['oncall-secondary']]` moves the
61
+ * assignment cleanly from one tier to the next while non-tier tags
62
+ * (`sev:1`, `service:checkout`, …) survive untouched.
63
+ */
64
+ export declare function escalateAssignment(assignment: Assignment, policy: NormalizedEscalationPolicy): EscalationDecision;
65
+ //# sourceMappingURL=policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/escalation/policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAErE,mDAAmD;AACnD,MAAM,WAAW,0BAA0B;IACvC,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC;CACjC;AAED,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,GAAG,IAAI,GAAG,0BAA0B,GAAG,IAAI,CAsBxH;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAGhE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAIxG;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAOpG;AAED,MAAM,WAAW,kBAAkB;IAC/B,8FAA8F;IAC9F,UAAU,EAAE,UAAU,CAAC;IACvB,6FAA6F;IAC7F,KAAK,EAAE,MAAM,CAAC;IACd,qFAAqF;IACrF,SAAS,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,kBAAkB,EAAE,OAAO,CAAC;IAC5B,+CAA+C;IAC/C,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,0BAA0B,GAAG,kBAAkB,CAuCjH"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ /**
3
+ * Escalation policy — pure logic.
4
+ *
5
+ * An assignment carries an optional `escalation` policy describing what should
6
+ * happen when the user it was matched to lets the response deadline run out.
7
+ * Everything here is deliberately side-effect free: `AssignmentMatcher` owns
8
+ * the Redis writes, this module owns the decisions.
9
+ *
10
+ * The same primitive backs both plain (non-workflow) escalation ladders and,
11
+ * via synthesised policies, workflow steps that escalate on timeout.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.escalateAssignment = exports.responseDeadlineFromJson = exports.responseDeadlineMs = exports.escalationLevelOf = exports.normalizeEscalationPolicy = exports.ESCALATION_LEVEL_FIELD = void 0;
15
+ /** Internal marker the matcher persists on the assignment between hops. */
16
+ exports.ESCALATION_LEVEL_FIELD = '_escalationLevel';
17
+ /**
18
+ * Resolve an assignment's policy, or `null` when it has none (the overwhelming
19
+ * majority of assignments — callers use the null to stay on the untouched
20
+ * legacy path).
21
+ */
22
+ function normalizeEscalationPolicy(policy) {
23
+ if (!policy || typeof policy !== 'object')
24
+ return null;
25
+ const respondWithinMs = Number(policy.respondWithinMs);
26
+ if (!Number.isFinite(respondWithinMs) || respondWithinMs <= 0)
27
+ return null;
28
+ const tiers = Array.isArray(policy.tiers)
29
+ ? policy.tiers.filter((tier) => Array.isArray(tier) && tier.length > 0)
30
+ : undefined;
31
+ const declaredMax = Number(policy.maxEscalations);
32
+ // With a tier ladder the natural ceiling is "one hop per remaining tier".
33
+ const defaultMax = tiers && tiers.length > 0 ? tiers.length - 1 : Number.POSITIVE_INFINITY;
34
+ return {
35
+ respondWithinMs,
36
+ onNoResponse: policy.onNoResponse === 'block' ? 'block' : 'allow',
37
+ priorityBoost: Number.isFinite(Number(policy.priorityBoost)) ? Number(policy.priorityBoost) : 0,
38
+ tiers: tiers && tiers.length > 0 ? tiers : undefined,
39
+ maxEscalations: Number.isFinite(declaredMax) && declaredMax >= 0 ? declaredMax : defaultMax,
40
+ onExhausted: policy.onExhausted === 'park' ? 'park' : 'queue',
41
+ };
42
+ }
43
+ exports.normalizeEscalationPolicy = normalizeEscalationPolicy;
44
+ /** Current escalation level of an assignment (0 = never escalated). */
45
+ function escalationLevelOf(assignment) {
46
+ const raw = Number(assignment[exports.ESCALATION_LEVEL_FIELD]);
47
+ return Number.isFinite(raw) && raw > 0 ? Math.floor(raw) : 0;
48
+ }
49
+ exports.escalationLevelOf = escalationLevelOf;
50
+ /**
51
+ * How long the matched user has to respond, in ms. Falls back to the
52
+ * matcher-wide `matchExpirationMs` when the assignment declares no policy.
53
+ */
54
+ function responseDeadlineMs(assignment, fallbackMs) {
55
+ if (!assignment)
56
+ return fallbackMs;
57
+ const policy = normalizeEscalationPolicy(assignment.escalation);
58
+ return policy ? policy.respondWithinMs : fallbackMs;
59
+ }
60
+ exports.responseDeadlineMs = responseDeadlineMs;
61
+ /**
62
+ * Same question, answered from the stored JSON without paying for a parse on
63
+ * the claim hot path. Assignments without a policy — effectively all of them
64
+ * in a typical deployment — cost one `indexOf` and nothing else.
65
+ */
66
+ function responseDeadlineFromJson(json, fallbackMs) {
67
+ if (!json || json.indexOf('"escalation"') === -1)
68
+ return fallbackMs;
69
+ try {
70
+ return responseDeadlineMs(JSON.parse(json), fallbackMs);
71
+ }
72
+ catch {
73
+ return fallbackMs;
74
+ }
75
+ }
76
+ exports.responseDeadlineFromJson = responseDeadlineFromJson;
77
+ /**
78
+ * Decide the next state of an assignment whose response deadline elapsed.
79
+ *
80
+ * Tier tags are swapped rather than appended: the vocabulary of every tag
81
+ * named by any tier is removed first, then the target tier's tags are added,
82
+ * so a ladder like `[['oncall-primary'], ['oncall-secondary']]` moves the
83
+ * assignment cleanly from one tier to the next while non-tier tags
84
+ * (`sev:1`, `service:checkout`, …) survive untouched.
85
+ */
86
+ function escalateAssignment(assignment, policy) {
87
+ const currentLevel = escalationLevelOf(assignment);
88
+ const nextLevel = currentLevel + 1;
89
+ const outOfHops = nextLevel > policy.maxEscalations;
90
+ const outOfTiers = policy.tiers ? nextLevel >= policy.tiers.length : false;
91
+ if (outOfHops || outOfTiers) {
92
+ return {
93
+ assignment,
94
+ level: currentLevel,
95
+ exhausted: true,
96
+ // The non-responder is still blocked on the final hop: an exhausted
97
+ // ladder means nobody answered, not that the last person gets it back.
98
+ blockPreviousOwner: policy.onNoResponse === 'block',
99
+ onExhausted: policy.onExhausted,
100
+ };
101
+ }
102
+ const next = { ...assignment, [exports.ESCALATION_LEVEL_FIELD]: nextLevel };
103
+ if (policy.priorityBoost !== 0 && typeof assignment.priority === 'number') {
104
+ next.priority = assignment.priority + policy.priorityBoost;
105
+ }
106
+ if (policy.tiers) {
107
+ const tierVocabulary = new Set(policy.tiers.flat());
108
+ const preserved = (assignment.tags ?? []).filter((tag) => !tierVocabulary.has(tag));
109
+ const tierTags = policy.tiers[nextLevel];
110
+ next.tags = [...preserved, ...tierTags.filter((tag) => !preserved.includes(tag))];
111
+ }
112
+ return {
113
+ assignment: next,
114
+ level: nextLevel,
115
+ exhausted: false,
116
+ blockPreviousOwner: policy.onNoResponse === 'block',
117
+ onExhausted: policy.onExhausted,
118
+ };
119
+ }
120
+ exports.escalateAssignment = escalateAssignment;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import AssignmentMatcher from './matcher.class';
2
- export type { Assignment, MatcherOptions, options, Stats, QueueStats, UserLoadInfo, User, GeoMatchResult, GeoMatchingFunction, ReliabilityMetrics, AssignmentStatus, FairnessMode, FairnessConfig, MatchTraceReason, MatchCandidateTrace, MatchDecisionTrace, MatchDecisionMode, MatchExplanation, DecisionTraceQuery, } from './matcher.class';
3
- export type { WorkflowDefinition, WorkflowDefinitionInput, WorkflowDefinitionSummary, WorkflowInstance, WorkflowInstanceStatus, WorkflowStep, WorkflowRouting, WorkflowTargetUser, WorkflowMachineTask, WorkflowTaskType, WorkflowEvent, WorkflowEventType, AssignmentResult, ParallelBranchState, DeadLetterEntry, AuditEntry, CircuitBreakerState, WorkflowInstanceWithSnapshot, LearningOutcome, LearningRewards, LearningFeatures, LearningAssignmentContext, LearningFeatureExtractor, LearningDecisionRecord, LearningEpisodeRecord, LearningSignals, LearningSample, LearningStats, LearningTagStat, AutoRoutingWeightsOptions, PendingAssignmentInfo, WorkflowEngineMetrics, MachineTaskHandler, WorkflowHost, PaginationOptions, PaginationResult, AssignmentCounts, } from './matcher.class';
2
+ export type { Assignment, MatcherOptions, options, Stats, QueueStats, UserLoadInfo, User, GeoMatchResult, GeoMatchingFunction, ReliabilityMetrics, AssignmentStatus, FairnessMode, FairnessConfig, MatchTraceReason, MatchCandidateTrace, MatchDecisionTrace, MatchDecisionMode, MatchExplanation, MatchPreview, MatchPreviewInput, DecisionTraceQuery, AssignmentLifecycleEvent, EscalationPolicy, EscalationSweepResult, MaintenanceOptions, MaintenanceReport, } from './matcher.class';
3
+ export type { WorkflowDefinition, WorkflowDefinitionInput, WorkflowDefinitionSummary, WorkflowInstance, WorkflowInstanceStatus, WorkflowStep, WorkflowRouting, WorkflowTargetUser, WorkflowMachineTask, WorkflowExternalTask, WorkflowTaskType, WorkflowEvent, WorkflowEventType, AssignmentResult, ParallelBranchState, DeadLetterEntry, AuditEntry, CircuitBreakerState, WorkflowInstanceWithSnapshot, WorkflowInstanceQuery, WorkflowInstancePage, WorkflowTransition, LearningOutcome, LearningRewards, LearningFeatures, LearningAssignmentContext, LearningFeatureExtractor, LearningDecisionRecord, LearningEpisodeRecord, LearningSignals, LearningSample, LearningStats, LearningTagStat, AutoRoutingWeightsOptions, PendingAssignmentInfo, WorkflowEngineMetrics, MachineTaskHandler, WorkflowHost, PaginationOptions, PaginationResult, AssignmentCounts, } from './matcher.class';
4
4
  export { explainMatchScore, type MatchScoreExplanation } from './scoring/match-score';
5
5
  export { extractMatchFeatures, cosineSimilarity } from './learning/features';
6
6
  export { synthesizeRoutingWeights, DEFAULT_AUTO_WEIGHTS_OPTIONS } from './learning/auto-weights';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,iBAAiB,CAAC;AAEhD,YAAY,EACR,UAAU,EACV,cAAc,EACd,OAAO,EACP,KAAK,EACL,UAAU,EACV,YAAY,EACZ,IAAI,EACJ,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GACrB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACR,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,EACZ,iBAA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EACZ,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAGtF,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAGjG,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,QAAQ,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtH,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAGhG,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAExF,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,eAAe,iBAAiB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { RedisClientType, WorkflowDefinition, WorkflowDefinitionInput, WorkflowDefinitionSummary, WorkflowInstance, WorkflowStep, WorkflowEvent, Assignment, WorkflowInstanceWithSnapshot, WorkflowEngineMetrics } from '../types/matcher';
1
+ import { RedisClientType, WorkflowDefinition, WorkflowDefinitionInput, WorkflowDefinitionSummary, WorkflowInstance, WorkflowStep, WorkflowEvent, Assignment, WorkflowInstanceWithSnapshot, WorkflowEngineMetrics, WorkflowInstanceQuery, WorkflowInstancePage, WorkflowTransition } from '../types/matcher';
2
2
  import { KeyBuilders } from '../utils/keys';
3
3
  import { ReliabilityManager } from './ReliabilityManager';
4
4
  import { TelemetryManager } from './TelemetryManager';
@@ -11,6 +11,10 @@ export interface WorkflowHost {
11
11
  step: WorkflowStep;
12
12
  definition: WorkflowDefinition;
13
13
  }): Promise<Record<string, any> | void>;
14
+ /** Checked at run start when a step targets 'initiator' (the default target). Skipped if unimplemented. */
15
+ userExists?(userId: string): Promise<boolean>;
16
+ /** Used by cancelWorkflow to clean up a run's outstanding queued/pending assignment. Skipped if unimplemented. */
17
+ removeAssignment?(assignmentId: string): Promise<any>;
14
18
  }
15
19
  /** Signature for machine task handlers registered via registerMachineHandler(). */
16
20
  export type MachineTaskHandler = (args: {
@@ -50,7 +54,15 @@ export declare class WorkflowManager {
50
54
  pollBlockMs?: number;
51
55
  /** Per-replica cap on processed events per second; unlimited when unset */
52
56
  maxEventsPerSecond?: number;
57
+ /** Fired after every durably-applied transition; best-effort, errors swallowed */
58
+ onWorkflowEvent?: (transition: WorkflowTransition) => void;
53
59
  });
60
+ /**
61
+ * Fire the onWorkflowEvent hook, if configured. Best-effort: mirrors
62
+ * onMatchDecision's contract, errors thrown by the callback never affect
63
+ * workflow processing.
64
+ */
65
+ private emitTransition;
54
66
  init(): Promise<void>;
55
67
  private initStreamConsumerGroup;
56
68
  private isNoGroupError;
@@ -73,14 +85,52 @@ export declare class WorkflowManager {
73
85
  startWorkflow(workflowDefinitionId: string, userId: string, initialContext?: Record<string, any>): Promise<WorkflowInstance>;
74
86
  getWorkflowInstance(instanceId: string): Promise<WorkflowInstance | null>;
75
87
  getWorkflowInstanceWithSnapshot(instanceId: string): Promise<WorkflowInstanceWithSnapshot | null>;
88
+ /**
89
+ * List workflow instances (runs) newest-created first, optionally filtered
90
+ * by status and/or workflow definition. Paginated via an opaque cursor
91
+ * (the createdAt score of the last item returned) — pass it back as
92
+ * `cursor` for the next page.
93
+ */
94
+ listWorkflowInstances(query?: WorkflowInstanceQuery): Promise<WorkflowInstancePage>;
76
95
  getActiveWorkflowsForUser(userId: string): Promise<WorkflowInstance[]>;
96
+ /**
97
+ * Cancel a running workflow instance. Cleans up its outstanding
98
+ * assignment(s) — the current step's assignment, or any still-pending
99
+ * parallel branch assignments — so a cancelled run doesn't leave orphaned
100
+ * work queued/pending forever, and clears their step timeouts.
101
+ */
77
102
  cancelWorkflow(instanceId: string): Promise<boolean>;
78
103
  private executeWorkflowStep;
79
104
  private executeMachineStep;
80
105
  private setStepTimeout;
81
106
  processExpiredWorkflowSteps(): Promise<number>;
107
+ /**
108
+ * Complete (or fail) an external step from outside this process — the
109
+ * counterpart to the `step.ready` transition. Validates the step is
110
+ * actually the run's current step (or a pending parallel branch) and is
111
+ * really an external step, clears its timeout, then publishes the same
112
+ * COMPLETED/FAILED event onto the stream that in-process completions use,
113
+ * so the orchestrator advances the run through the ordinary transition
114
+ * pipeline (idempotency, retries, and DLQ all still apply).
115
+ */
116
+ completeWorkflowStep(instanceId: string, stepId: string, outcome: {
117
+ success: boolean;
118
+ data?: Record<string, any>;
119
+ error?: string;
120
+ }): Promise<boolean>;
82
121
  private createWorkflowAssignment;
83
122
  publishWorkflowEvent(event: WorkflowEvent): Promise<string>;
123
+ /**
124
+ * Non-blocking drain of up to `maxEvents` due workflow events, using the
125
+ * main Redis client (no duplicated subscriber connection, no BLOCK wait).
126
+ * Shares all processing internals with the orchestrator loop — idempotency,
127
+ * circuit breaker, retry scheduling, and DLQ all apply — but is meant to be
128
+ * called periodically by a host sweeping many workspaces/tenants rather
129
+ * than running one dedicated blocking loop per matcher instance. Returns
130
+ * the number of events successfully processed (retried/DLQ'd events still
131
+ * count as handled — only a hard read error returns early).
132
+ */
133
+ processWorkflowEvents(maxEvents?: number): Promise<number>;
84
134
  startOrchestrator(): Promise<void>;
85
135
  /**
86
136
  * Setup subscriber client with comprehensive reconnection handling
@@ -97,6 +147,14 @@ export declare class WorkflowManager {
97
147
  private handleStepCompletion;
98
148
  private handleStepFailure;
99
149
  private handleStepExpiry;
150
+ /**
151
+ * Advance a timed-out step to its `onTimeoutStepId` instead of failing the
152
+ * run — the escalation ladder (page primary, then secondary, then the
153
+ * manager). Returns false when the step declares no escalation target, or
154
+ * when the run has climbed past `maxEscalationDepth`, in which case the
155
+ * caller falls through to the ordinary failure path.
156
+ */
157
+ private tryEscalateExpiredStep;
100
158
  private evaluateCondition;
101
159
  reclaimOrphanedMessages(): Promise<number>;
102
160
  private saveInstance;
@@ -1 +1 @@
1
- {"version":3,"file":"WorkflowManager.d.ts","sourceRoot":"","sources":["../../src/managers/WorkflowManager.ts"],"names":[],"mappings":"AACA,OAAO,EACH,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EAEb,UAAU,EACV,4BAA4B,EAE5B,qBAAqB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,eAAO,MAAQ,OAAO,mCAAuB,CAAC;AAE9C,MAAM,WAAW,YAAY;IACzB,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3D,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACpD,kBAAkB,CAAC,CAAC,IAAI,EAAE;QACtB,QAAQ,EAAE,gBAAgB,CAAC;QAC3B,IAAI,EAAE,YAAY,CAAC;QACnB,UAAU,EAAE,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