assignment-user-matcher 1.2.5 → 1.6.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.
Files changed (40) hide show
  1. package/LICENCE +21 -53
  2. package/README.md +153 -1
  3. package/dist/index.d.ts +3 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +4 -1
  6. package/dist/managers/DecisionTraceManager.d.ts +34 -0
  7. package/dist/managers/DecisionTraceManager.d.ts.map +1 -0
  8. package/dist/managers/DecisionTraceManager.js +74 -0
  9. package/dist/managers/WorkflowManager.d.ts +57 -1
  10. package/dist/managers/WorkflowManager.d.ts.map +1 -1
  11. package/dist/managers/WorkflowManager.js +296 -2
  12. package/dist/matcher.class.d.ts +186 -3
  13. package/dist/matcher.class.d.ts.map +1 -1
  14. package/dist/matcher.class.js +891 -40
  15. package/dist/scoring/match-score.d.ts +17 -1
  16. package/dist/scoring/match-score.d.ts.map +1 -1
  17. package/dist/scoring/match-score.js +81 -1
  18. package/dist/tracing/decision-trace.d.ts +48 -0
  19. package/dist/tracing/decision-trace.d.ts.map +1 -0
  20. package/dist/tracing/decision-trace.js +152 -0
  21. package/dist/types/matcher.d.ts +327 -1
  22. package/dist/types/matcher.d.ts.map +1 -1
  23. package/dist/utils/keys.d.ts +5 -0
  24. package/dist/utils/keys.d.ts.map +1 -1
  25. package/dist/utils/keys.js +17 -0
  26. package/dist/workflow-builder.d.ts +6 -0
  27. package/dist/workflow-builder.d.ts.map +1 -1
  28. package/dist/workflow-builder.js +13 -0
  29. package/dist/workflow-validation.d.ts.map +1 -1
  30. package/dist/workflow-validation.js +20 -0
  31. package/package.json +2 -2
  32. package/dist/queries/index.d.ts +0 -5
  33. package/dist/queries/index.d.ts.map +0 -1
  34. package/dist/queries/index.js +0 -20
  35. package/dist/scoring/index.d.ts +0 -5
  36. package/dist/scoring/index.d.ts.map +0 -1
  37. package/dist/scoring/index.js +0 -20
  38. package/dist/utils/index.d.ts +0 -6
  39. package/dist/utils/index.d.ts.map +0 -1
  40. package/dist/utils/index.js +0 -21
package/LICENCE CHANGED
@@ -1,53 +1,21 @@
1
- This Strict Commercial License ("License") is a legal agreement between the Owner identified below ("Owner") and any natural person or legal entity that receives, accesses, or uses the Software ("Recipient"). By receiving, accessing, or using the Software, Recipient acknowledges and agrees to the terms below. All capitalized terms not otherwise defined herein have the meanings given in Section 1.
2
-
3
- 1. Definitions
4
- - "Software" means the source code, binaries, documentation, designs, examples, data, configuration, and any other materials provided by Owner.
5
- - "Use" means to copy, execute, run, display, distribute, host, provide as a service, sublicense, or otherwise employ the Software.
6
- - "Modify" means to alter, adapt, translate, create derivative works of, reverse engineer, decompile, disassemble, or otherwise change the Software.
7
-
8
- 2. No Grant
9
- - Except for a specific, express, written license signed by Owner, no rights, licenses, or permissions are granted to Recipient, whether by implication, estoppel, or otherwise. Owner expressly reserves all rights in the Software.
10
-
11
- 3. Prohibited Acts
12
- - Without Owner's prior written permission, Recipient shall not, directly or indirectly, Use, copy, publish, distribute, sublicense, make available, or Modify the Software in whole or in part.
13
- - Recipient shall not remove, alter, or obscure any proprietary, copyright, or other notices in or on the Software, nor attempt to bypass technological restrictions or authentication controls.
14
-
15
- 4. Remedies; Liquidated Damages; Fees
16
- - Each unauthorized Use or Modification of the Software (each an "Infringing Act") shall constitute a material breach and an actionable wrong.
17
- - For each Infringing Act, Recipient agrees that Owner shall be entitled to recover liquidated damages in the amount of USD 250,000 (Two Hundred Fifty Thousand United States Dollars) per Infringing Act, which the parties agree is a reasonable pre-estimate of damages and not a penalty. In addition, Owner may recover:
18
- - disgorgement of all profits and revenues derived from the Infringing Act;
19
- - statutory damages available under applicable law (if greater than the liquidated damages amount);
20
- - pre-judgment and post-judgment interest at the highest lawful rate;
21
- - Owner's reasonable attorneys' fees, costs, and expenses incurred to investigate or enforce this License; and
22
- - any other equitable or legal relief available, including injunctive and declaratory relief.
23
- - The remedies in this Section are cumulative, not exclusive, and shall not limit other remedies at law or in equity. Owner need not post a bond to obtain injunctive relief.
24
-
25
- 5. Indemnity
26
- - Recipient shall indemnify, defend, and hold Owner harmless from and against any and all claims, liabilities, losses, damages, costs and expenses (including reasonable attorneys' fees) arising from any unauthorized Use, Modification, distribution, or other breach of this License.
27
-
28
- 6. Termination and Return
29
- - Owner may terminate this License immediately upon written notice if Recipient commits any breach, including any Infringing Act. Upon termination, Recipient shall immediately cease all Use of the Software and destroy or return all copies of the Software and related materials and certify such destruction or return in writing to Owner.
30
-
31
- 7. Preservation of Notices
32
- - Recipient shall not remove, alter, or obscure any copyright, trademark, patent, or other proprietary notices, legends, or labels contained in or on the Software.
33
-
34
- 8. Warranty Disclaimer
35
- - THE SOFTWARE IS PROVIDED "AS IS" AND OWNER DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NONINFRINGEMENT. THIS DISCLAIMER DOES NOT AFFECT OWNER'S RIGHT TO SEEK EQUITABLE RELIEF OR DAMAGES FOR UNAUTHORIZED USE.
36
-
37
- 9. Limitation of Liability
38
- - EXCEPT FOR OWNER'S RIGHTS AND REMEDIES FOR UNAUTHORIZED USE (WHICH ARE PRESERVED), IN NO EVENT SHALL OWNER BE LIABLE TO RECIPIENT FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL, SPECIAL, PUNITIVE, OR EXEMPLARY DAMAGES ARISING OUT OF OR RELATED TO THIS LICENSE OR THE SOFTWARE, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY, OR OTHERWISE.
39
-
40
- 10. Governing Law and Venue
41
- - This License shall be governed by and construed in accordance with the laws of [INSERT STATE/PROVINCE/COUNTRY], without regard to its conflicts of laws rules. The exclusive venue and jurisdiction for any dispute arising out of or related to this License shall be the state and federal courts located in [INSERT CITY, STATE/PROVINCE/COUNTRY]. Recipient consents to personal jurisdiction in those courts.
42
-
43
- 11. Severability; Waiver; Entire Agreement
44
- - If any provision of this License is held to be invalid or unenforceable, the remainder of this License shall remain in full force and effect. No waiver by Owner of any breach shall be deemed a waiver of any other or subsequent breach. This License constitutes the entire agreement between the parties regarding the subject matter hereof.
45
-
46
- 12. Effective Date 21/05/2025 or since intiial commit of this repository
47
- - Effective Date: the date Recipient first receives, accesses, or uses the Software.
48
- - Owner: Viljar Võidula
49
- - Contact: viljar@forgemaster.ai
50
-
51
- Footnote — Non-Commercial Fair Use
52
- - As a limited exception to Sections 2 and 3, non-commercial fair use (e.g., academic evaluation, internal demonstrations, code review excerpts) is permitted provided that, prior to any such use, Recipient contacts the Owner at viljar@forgemaster.ai and receives written confirmation authorizing the specific use.
53
- - Any such authorization is non-exclusive, non-transferable, revocable at any time, and may be conditioned on additional terms. All other provisions of this License remain in full force and effect unless explicitly modified in the written confirmation.
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Viljar Võidula
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -273,6 +273,7 @@ Adds or updates a user in the system.
273
273
  - `user`: An object representing the user.
274
274
  - `id: string`: Unique identifier for the user.
275
275
  - `tags: string[]`: Array of tags associated with the user.
276
+ - `maxBacklogSize?: number`: Optional per-user backlog cap overriding the matcher-wide `maxUserBacklogSize` in every matching path (`0` = receive nothing; negative or non-numeric values are ignored). The fairness rolling-window auto-cap derivation stays team-level and keeps using the global value.
276
277
 
277
278
  ### `addAssignment(assignment: Assignment): Promise<void>`
278
279
 
@@ -305,6 +306,30 @@ Retrieves current pending assignments, including who owns each assignment and ho
305
306
  - `pendingSince`: Unix timestamp (ms) when the assignment entered pending state.
306
307
  - `expiresAt`: Unix timestamp (ms) when pending expiration is scheduled.
307
308
 
309
+ ### `pauseUser(userId: string): Promise<boolean>` / `resumeUser(userId: string): Promise<boolean>`
310
+
311
+ Operator availability controls. A paused user stops receiving new assignments in every matching path but keeps their pending backlog and can still accept, complete, or reject work they already hold. Paused users are exempt from idle auto-removal (`idleUserTimeoutMs`) — pausing is deliberate absence, not idleness. `pauseUser` returns `false` when the user is not in the pool; `resumeUser` returns `false` when the user was not paused, and records activity (resets the idle clock) when it succeeds. Inspect state with `isUserPaused(userId)` and `getPausedUsers()`.
312
+
313
+ When decision traces are enabled, paused users appear struck out in traces with a `paused` reason, and `explainMatch()` reports them as ineligible.
314
+
315
+ ### `releaseUserAssignments(userId: string): Promise<string[]>`
316
+
317
+ 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.
318
+
319
+ ### `assignToUser(assignmentId: string, userId: string, options?: { force?: boolean }): Promise<{ previousOwnerId: string | null }>`
320
+
321
+ 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.
322
+
323
+ 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.
324
+
325
+ ### `getQueueStats(): Promise<QueueStats>`
326
+
327
+ Live operational snapshot for dashboards:
328
+
329
+ - `queued` / `pending`: assignment counts by state.
330
+ - `oldestWaitingMs`: age of the longest-waiting unaccepted assignment, or `null`. The wait clock starts at first enqueue and survives reject/expiry requeues; it stops when a user accepts the assignment or it is removed.
331
+ - `perUser`: every user's `backlog` depth, effective `maxBacklogSize` cap, and `paused` state.
332
+
308
333
  ### `removeUser(userId: string): Promise<void>`
309
334
 
310
335
  Removes a user from the system and clears their assignment backlog.
@@ -437,6 +462,27 @@ type Options = {
437
462
  assignmentId?: string,
438
463
  ) => Promise<[number, number]>;
439
464
 
465
+ // ========== Decision Traces & Explainability ==========
466
+
467
+ // Persist an auditable decision trace for every routing decision. Each
468
+ // matched assignment gets a MatchDecisionTrace — winner, arbitration mode,
469
+ // and every evaluated candidate with score breakdown and exclusion
470
+ // reasons — appended to a capped Redis stream and queryable via
471
+ // getDecisionTraces(). Captured while the decision happens, never
472
+ // reconstructed. Toggleable at runtime via setDecisionTraces(enabled).
473
+ enableDecisionTraces?: boolean; // Default: false
474
+
475
+ // Retention (entry count) for the trace stream, and how many candidates
476
+ // are stored per trace (the chosen candidate is always kept).
477
+ decisionTraceMaxEntries?: number; // Default: 1000
478
+ decisionTraceMaxCandidates?: number; // Default: 25
479
+
480
+ // Real-time hook invoked with each MatchDecisionTrace as decisions are
481
+ // made (e.g. push to a websocket). Setting it activates capture even when
482
+ // enableDecisionTraces is false — traces then stream to the callback only
483
+ // and are not persisted. Callback errors never affect matching.
484
+ onMatchDecision?: (trace: MatchDecisionTrace) => void;
485
+
440
486
  // ========== Reinforcement Learning Options ==========
441
487
 
442
488
  // Enable the adaptive learning layer (contextual bandit re-ranking).
@@ -479,6 +525,112 @@ type Options = {
479
525
  };
480
526
  ```
481
527
 
528
+ ## Decision Traces & Explainability
529
+
530
+ Every routing decision the engine makes can be explained and audited. Two
531
+ complementary tools cover the two questions teams actually ask:
532
+
533
+ - **"Why did this assignment go to that user?"** — decision traces, the
534
+ auditable record captured _while the decision was made_.
535
+ - **"Who could receive this assignment right now, and why (not)?"** —
536
+ `explainMatch()`, an on-demand evaluation against live state.
537
+
538
+ ### Decision traces (`enableDecisionTraces`)
539
+
540
+ ```typescript
541
+ const matcher = new AssignmentMatcher(redisClient, {
542
+ enableDecisionTraces: true,
543
+ // Optional real-time feed (dashboards, sockets). Works even without
544
+ // persistence: setting only onMatchDecision streams traces to the
545
+ // callback and skips storage.
546
+ onMatchDecision: (trace) => io.emit('match:decision', trace),
547
+ });
548
+
549
+ await matcher.matchUsersAssignments();
550
+
551
+ const [trace] = await matcher.getDecisionTraces({ assignmentId: 'ticket-42' });
552
+ // {
553
+ // assignmentId: 'ticket-42',
554
+ // chosenUserId: 'alice',
555
+ // mode: 'best-match', // how the winner was arbitrated
556
+ // matchedAt: 1752404712345,
557
+ // candidates: [
558
+ // { userId: 'alice', eligible: true, chosen: true, score: 101,
559
+ // effectivePriority: 201, reasons: [ { kind: 'tagWeight', tag: 'english', weight: 100 }, ... ] },
560
+ // { userId: 'bob', eligible: false, chosen: false, score: 0,
561
+ // effectivePriority: 0, reasons: [ { kind: 'veto', tag: 'german', pattern: 'german' } ] },
562
+ // ],
563
+ // }
564
+ ```
565
+
566
+ Traces are appended to a capped Redis stream (`decisionTraceMaxEntries`,
567
+ default 1000), so the audit record survives restarts and is shared across
568
+ replicas. Query with `getDecisionTraces({ assignmentId?, userId?, limit? })`
569
+ (newest first), wipe with `clearDecisionTraces()`, and toggle at runtime with
570
+ `setDecisionTraces(enabled)` / `isDecisionTracesEnabled()`.
571
+
572
+ What a trace contains:
573
+
574
+ - The winner, the arbitration mode (`'first-come'`, `'best-match'`,
575
+ `'balanced'`, `'spread-work'`, `'direct'` for per-user matching, or
576
+ `'workflow'` for deterministic workflow-targeted handoffs), and the moment
577
+ of the decision.
578
+ - Every candidate evaluated in that matching pass with its full score
579
+ breakdown: matched routing weights (`tagWeight`, wildcard `pattern`
580
+ included), the implicit `defaultTag`, `tagOverlap` for unweighted users,
581
+ `geoDistance`/`geoBoost`, `learningBoost` (with `shadowMode` flag),
582
+ `skillThreshold` failures, `cidrMismatch`, and `customScore` when a custom
583
+ `matchingFunction` owns scoring.
584
+ - Users excluded before scoring by hard rules — zero-weight `veto` entries,
585
+ `assignmentVeto` (the assignment's `vetoedUsers`), and `rejectedPreviously` —
586
+ are struck out in the trace even though the Redis-side prefilter kept them
587
+ out of the scoring pass entirely.
588
+
589
+ Honesty notes: in the default `'first-come'` mode users evaluate and claim in
590
+ parallel, so a candidate whose snapshot read happened after the winner's claim
591
+ may be absent from the trace (they never evaluated it); fair modes evaluate
592
+ everyone read-only first and always capture the full candidate field. Reason
593
+ kinds are additive over time — treat unknown `kind` values as forward
594
+ compatibility, not errors.
595
+
596
+ ### On-demand explanations (`explainMatch`)
597
+
598
+ ```typescript
599
+ const explanation = await matcher.explainMatch('ticket-42');
600
+ // { assignmentId, status: 'queued' | 'pending' | 'accepted' | 'completed' | 'not_found',
601
+ // ownerId, evaluatedAt, candidates: MatchCandidateTrace[] }
602
+
603
+ // Or scope to specific users:
604
+ await matcher.explainMatch('ticket-42', { userIds: ['alice', 'bob'] });
605
+ ```
606
+
607
+ `explainMatch()` recomputes eligibility for every user (or the given ids)
608
+ against the assignment's current state using the engine's own scoring
609
+ internals — vetoes, prior rejections, backlog, thresholds, CIDR, geo, weight
610
+ breakdown, learning influence — and works in any lifecycle state (for matched
611
+ assignments the current owner is flagged `chosen`). Because it evaluates _now_
612
+ rather than at decision time, use it for support tooling and dry-runs
613
+ ("who would get this?"), and decision traces for the compliance-grade record.
614
+
615
+ ### Hypothetical preview (`previewMatch`)
616
+
617
+ `previewMatch()` answers "who would receive this assignment if I created it?"
618
+ without persisting or claiming anything. It uses the same scoring and hard
619
+ rules as real matching, so the ranking mirrors what `explainMatch()` would
620
+ report after the assignment is added.
621
+
622
+ ```typescript
623
+ const preview = await matcher.previewMatch(
624
+ { tags: ['english', 'billing'], priority: 100, skillThresholds: { english: 50 } },
625
+ // optional: restrict to specific users
626
+ { userIds: ['alice', 'bob'] },
627
+ );
628
+ // { tags, priority, evaluatedAt, candidates: MatchCandidateTrace[] }
629
+ ```
630
+
631
+ Use it for autosuggestion UIs: render the ranked best-fit workers with score
632
+ breakdowns and blocked reasons before the operator commits the task.
633
+
482
634
  ## Adaptive Matching with Reinforcement Learning
483
635
 
484
636
  The matcher includes an opt-in, Redis-backed contextual bandit that learns from
@@ -1085,4 +1237,4 @@ Consumers can `import AssignmentMatcher from 'assignment-user-matcher'` or `cons
1085
1237
 
1086
1238
  ## License
1087
1239
 
1088
- This library is proprietary, commercially-licensed software — see [`LICENCE`](./LICENCE) for the full terms. No use, copying, modification, or distribution is permitted without the Owner's prior written permission (the LICENCE file's non-commercial fair-use footnote covers limited evaluation/academic use with written confirmation from the Owner). Contact viljar@forgemaster.ai for licensing.
1240
+ [MIT](./LICENCE) — free for commercial and non-commercial use.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import AssignmentMatcher from './matcher.class';
2
- export type { Assignment, MatcherOptions, options, Stats, User, GeoMatchResult, GeoMatchingFunction, ReliabilityMetrics, AssignmentStatus, FairnessMode, FairnessConfig, } 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, } 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
+ export { explainMatchScore, type MatchScoreExplanation } from './scoring/match-score';
4
5
  export { extractMatchFeatures, cosineSimilarity } from './learning/features';
5
6
  export { synthesizeRoutingWeights, DEFAULT_AUTO_WEIGHTS_OPTIONS } from './learning/auto-weights';
6
7
  export { WorkflowBuilder, WorkflowStepBuilder, workflow, linearWorkflow, approvalWorkflow } from './workflow-builder';
@@ -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,IAAI,EACJ,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAc,GACjB,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,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,iBAAiB,CAAC;AAGzB,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
+ {"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,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,GAC3B,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACR,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,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"}
package/dist/index.js CHANGED
@@ -17,9 +17,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.AssignmentMatcher = exports.createKeyBuilders = exports.validateWorkflowDefinition = exports.normalizeWorkflowDefinition = exports.approvalWorkflow = exports.linearWorkflow = exports.workflow = exports.WorkflowStepBuilder = exports.WorkflowBuilder = exports.DEFAULT_AUTO_WEIGHTS_OPTIONS = exports.synthesizeRoutingWeights = exports.cosineSimilarity = exports.extractMatchFeatures = void 0;
20
+ exports.AssignmentMatcher = exports.createKeyBuilders = exports.validateWorkflowDefinition = exports.normalizeWorkflowDefinition = exports.approvalWorkflow = exports.linearWorkflow = exports.workflow = exports.WorkflowStepBuilder = exports.WorkflowBuilder = exports.DEFAULT_AUTO_WEIGHTS_OPTIONS = exports.synthesizeRoutingWeights = exports.cosineSimilarity = exports.extractMatchFeatures = exports.explainMatchScore = void 0;
21
21
  const matcher_class_1 = __importDefault(require("./matcher.class"));
22
22
  exports.AssignmentMatcher = matcher_class_1.default;
23
+ // Decision-trace scoring explainer (same numbers as calculateMatchScore, plus reasons)
24
+ var match_score_1 = require("./scoring/match-score");
25
+ Object.defineProperty(exports, "explainMatchScore", { enumerable: true, get: function () { return match_score_1.explainMatchScore; } });
23
26
  // Learning feature helpers (for custom feature extractors)
24
27
  var features_1 = require("./learning/features");
25
28
  Object.defineProperty(exports, "extractMatchFeatures", { enumerable: true, get: function () { return features_1.extractMatchFeatures; } });
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Decision trace persistence and querying.
3
+ *
4
+ * Traces are appended to a capped Redis stream (keys.decisionTraces()) so the
5
+ * audit record survives process restarts and is shared across replicas.
6
+ * Assembly of the traces themselves is pure and lives in
7
+ * src/tracing/decision-trace.ts; this manager only handles I/O and the
8
+ * real-time onDecision hook.
9
+ */
10
+ import type { DecisionTraceQuery, MatchDecisionTrace, RedisClientType } from '../types/matcher';
11
+ import type { KeyBuilders } from '../utils/keys';
12
+ export interface DecisionTraceManagerOptions {
13
+ /** Maximum entries retained in the trace stream */
14
+ maxEntries: number;
15
+ /** Real-time hook invoked per recorded trace; errors are swallowed */
16
+ onDecision?: (trace: MatchDecisionTrace) => void;
17
+ }
18
+ export declare class DecisionTraceManager {
19
+ private redisClient;
20
+ private keys;
21
+ private options;
22
+ constructor(redisClient: RedisClientType, keys: KeyBuilders, options: DecisionTraceManagerOptions);
23
+ get hasDecisionHook(): boolean;
24
+ /**
25
+ * Persist traces (when `persist`) and emit each to the onDecision hook.
26
+ * Consumer callback errors never propagate into the matching pass.
27
+ */
28
+ record(traces: MatchDecisionTrace[], persist: boolean): Promise<void>;
29
+ /** Query recorded traces, newest first. */
30
+ getTraces(query?: DecisionTraceQuery): Promise<MatchDecisionTrace[]>;
31
+ /** Delete every stored trace. Returns 1 when the stream existed. */
32
+ clear(): Promise<number>;
33
+ }
34
+ //# sourceMappingURL=DecisionTraceManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DecisionTraceManager.d.ts","sourceRoot":"","sources":["../../src/managers/DecisionTraceManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,2BAA2B;IACxC,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACpD;AAED,qBAAa,oBAAoB;IAEzB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;gBAFP,WAAW,EAAE,eAAe,EAC5B,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,2BAA2B;IAGhD,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB3E,2CAA2C;IACrC,SAAS,CAAC,KAAK,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAyB1E,oEAAoE;IAC9D,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;CAGjC"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DecisionTraceManager = void 0;
4
+ class DecisionTraceManager {
5
+ constructor(redisClient, keys, options) {
6
+ this.redisClient = redisClient;
7
+ this.keys = keys;
8
+ this.options = options;
9
+ }
10
+ get hasDecisionHook() {
11
+ return typeof this.options.onDecision === 'function';
12
+ }
13
+ /**
14
+ * Persist traces (when `persist`) and emit each to the onDecision hook.
15
+ * Consumer callback errors never propagate into the matching pass.
16
+ */
17
+ async record(traces, persist) {
18
+ if (traces.length === 0)
19
+ return;
20
+ if (persist) {
21
+ const streamKey = this.keys.decisionTraces();
22
+ const multi = this.redisClient.multi();
23
+ for (const trace of traces) {
24
+ multi.xAdd(streamKey, '*', { trace: JSON.stringify(trace) });
25
+ }
26
+ multi.xTrim(streamKey, 'MAXLEN', this.options.maxEntries);
27
+ await multi.exec();
28
+ }
29
+ if (this.options.onDecision) {
30
+ for (const trace of traces) {
31
+ try {
32
+ this.options.onDecision(trace);
33
+ }
34
+ catch {
35
+ // The hook is observability, not control flow.
36
+ }
37
+ }
38
+ }
39
+ }
40
+ /** Query recorded traces, newest first. */
41
+ async getTraces(query) {
42
+ const limit = query?.limit ?? 50;
43
+ if (limit <= 0)
44
+ return [];
45
+ const filtered = Boolean(query?.assignmentId || query?.userId);
46
+ // Unfiltered reads only need `limit` entries; filtered reads scan the
47
+ // whole (capped) stream, which is bounded by maxEntries.
48
+ const count = filtered ? this.options.maxEntries : limit;
49
+ const entries = await this.redisClient.xRevRange(this.keys.decisionTraces(), '+', '-', { COUNT: count });
50
+ const results = [];
51
+ for (const entry of entries) {
52
+ let trace;
53
+ try {
54
+ trace = JSON.parse(entry.message.trace);
55
+ }
56
+ catch {
57
+ continue;
58
+ }
59
+ if (query?.assignmentId && trace.assignmentId !== query.assignmentId)
60
+ continue;
61
+ if (query?.userId && trace.chosenUserId !== query.userId)
62
+ continue;
63
+ results.push(trace);
64
+ if (results.length >= limit)
65
+ break;
66
+ }
67
+ return results;
68
+ }
69
+ /** Delete every stored trace. Returns 1 when the stream existed. */
70
+ async clear() {
71
+ return this.redisClient.del(this.keys.decisionTraces());
72
+ }
73
+ }
74
+ exports.DecisionTraceManager = DecisionTraceManager;
@@ -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;
@@ -64,17 +76,61 @@ export declare class WorkflowManager {
64
76
  registerWorkflow(definition: WorkflowDefinitionInput | WorkflowDefinition): Promise<WorkflowDefinition>;
65
77
  getWorkflowDefinition(id: string): Promise<WorkflowDefinition | null>;
66
78
  listWorkflowDefinitions(): Promise<WorkflowDefinitionSummary[]>;
79
+ /**
80
+ * Delete a workflow definition and its listing entry. Running instances keep
81
+ * their own `definitionSnapshot`, so in-flight workflows are unaffected.
82
+ * Returns `false` if no definition with that id existed.
83
+ */
84
+ deleteWorkflowDefinition(id: string): Promise<boolean>;
67
85
  startWorkflow(workflowDefinitionId: string, userId: string, initialContext?: Record<string, any>): Promise<WorkflowInstance>;
68
86
  getWorkflowInstance(instanceId: string): Promise<WorkflowInstance | null>;
69
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>;
70
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
+ */
71
102
  cancelWorkflow(instanceId: string): Promise<boolean>;
72
103
  private executeWorkflowStep;
73
104
  private executeMachineStep;
74
105
  private setStepTimeout;
75
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>;
76
121
  private createWorkflowAssignment;
77
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>;
78
134
  startOrchestrator(): Promise<void>;
79
135
  /**
80
136
  * Setup subscriber client with comprehensive reconnection handling
@@ -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,kBAAkB,CAAC;KAClC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;CAC3C;AAED,mFAAmF;AACn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