assignment-user-matcher 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +505 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/learning/features.d.ts +19 -0
- package/dist/learning/features.d.ts.map +1 -0
- package/dist/learning/features.js +55 -0
- package/dist/managers/LearningManager.d.ts +94 -0
- package/dist/managers/LearningManager.d.ts.map +1 -0
- package/dist/managers/LearningManager.js +194 -0
- package/dist/managers/WorkflowManager.d.ts +3 -6
- package/dist/managers/WorkflowManager.d.ts.map +1 -1
- package/dist/managers/WorkflowManager.js +15 -4
- package/dist/matcher.class.d.ts +78 -8
- package/dist/matcher.class.d.ts.map +1 -1
- package/dist/matcher.class.js +329 -13
- package/dist/types/matcher.d.ts +119 -9
- package/dist/types/matcher.d.ts.map +1 -1
- package/dist/utils/keys.d.ts +5 -0
- package/dist/utils/keys.d.ts.map +1 -1
- package/dist/utils/keys.js +6 -0
- package/dist/workflow-builder.d.ts +2 -4
- package/dist/workflow-builder.d.ts.map +1 -1
- package/dist/workflow-builder.js +4 -46
- package/dist/workflow-validation.d.ts +4 -0
- package/dist/workflow-validation.d.ts.map +1 -0
- package/dist/workflow-validation.js +85 -0
- package/package.json +4 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LearningManager - Redis-backed contextual bandit for adaptive matchmaking.
|
|
3
|
+
*
|
|
4
|
+
* Maintains an online linear reward model: each feature has a learned weight
|
|
5
|
+
* stored in a Redis hash. Predictions are dot products of the feature vector
|
|
6
|
+
* with the learned weights; updates use stochastic gradient descent on the
|
|
7
|
+
* observed reward for each assignment outcome.
|
|
8
|
+
*
|
|
9
|
+
* The model only re-ranks candidates that already passed the hard matching
|
|
10
|
+
* rules (tags/weights, CIDR, skill thresholds) - it never makes an ineligible
|
|
11
|
+
* assignment eligible.
|
|
12
|
+
*/
|
|
13
|
+
import type { RedisClientType, LearningFeatures, LearningOutcome, LearningRewards, LearningDecisionRecord, LearningEpisodeRecord, LearningSignals, LearningSample, LearningStats } from '../types/matcher';
|
|
14
|
+
import type { KeyBuilders } from '../utils/keys';
|
|
15
|
+
export declare const DEFAULT_LEARNING_REWARDS: LearningRewards;
|
|
16
|
+
export interface LearningManagerOptions {
|
|
17
|
+
/** SGD learning rate (default: 0.1) */
|
|
18
|
+
learningRate?: number;
|
|
19
|
+
/** Epsilon-greedy exploration rate (default: 0.05) */
|
|
20
|
+
explorationRate?: number;
|
|
21
|
+
/** Shadow mode: learn and record but never alter ranking (default: false) */
|
|
22
|
+
shadowMode?: boolean;
|
|
23
|
+
/** Multiplier applied to predicted reward when re-ranking (default: 1) */
|
|
24
|
+
boostFactor?: number;
|
|
25
|
+
/** Reward overrides merged with defaults */
|
|
26
|
+
rewards?: Partial<LearningRewards>;
|
|
27
|
+
/** TTL for stored decision contexts in ms (default: 7 days) */
|
|
28
|
+
decisionTtlMs?: number;
|
|
29
|
+
/** Weights applied to named external feedback signals (default weight: 1) */
|
|
30
|
+
signalWeights?: Record<string, number>;
|
|
31
|
+
/** TTL for archived episodes awaiting external feedback in ms (default: 7 days) */
|
|
32
|
+
feedbackTtlMs?: number;
|
|
33
|
+
}
|
|
34
|
+
export declare class LearningManager {
|
|
35
|
+
private redisClient;
|
|
36
|
+
private keys;
|
|
37
|
+
readonly learningRate: number;
|
|
38
|
+
readonly explorationRate: number;
|
|
39
|
+
readonly shadowMode: boolean;
|
|
40
|
+
readonly boostFactor: number;
|
|
41
|
+
readonly rewards: LearningRewards;
|
|
42
|
+
readonly decisionTtlMs: number;
|
|
43
|
+
readonly signalWeights: Record<string, number>;
|
|
44
|
+
readonly feedbackTtlMs: number;
|
|
45
|
+
constructor(redisClient: RedisClientType, keys: KeyBuilders, options?: LearningManagerOptions);
|
|
46
|
+
/** Load the full model weights hash from Redis */
|
|
47
|
+
getModel(): Promise<Record<string, string>>;
|
|
48
|
+
/** Predict expected reward for a feature vector against given model weights */
|
|
49
|
+
predict(features: LearningFeatures, weights: Record<string, string | number>): number;
|
|
50
|
+
/** Epsilon-greedy exploration check */
|
|
51
|
+
shouldExplore(): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Persist the decision context for an assignment so the eventual outcome
|
|
54
|
+
* can be attributed back to the features that drove the match.
|
|
55
|
+
*/
|
|
56
|
+
recordDecision(userId: string, assignmentId: string, features: LearningFeatures, predictedReward: number): Promise<void>;
|
|
57
|
+
/** Fetch a stored decision record, or null when absent/expired */
|
|
58
|
+
getDecision(assignmentId: string): Promise<LearningDecisionRecord | null>;
|
|
59
|
+
/**
|
|
60
|
+
* Apply a lifecycle outcome as a reward update.
|
|
61
|
+
* Terminal outcomes archive the decision as an episode (with TTL) so late
|
|
62
|
+
* external feedback can still be attributed to the original features.
|
|
63
|
+
* Returns false if no decision context exists for the assignment.
|
|
64
|
+
*/
|
|
65
|
+
applyOutcome(assignmentId: string, outcome: LearningOutcome): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Apply a manually chosen reward (terminal: removes the decision record).
|
|
68
|
+
* Enables external reward shaping beyond the built-in lifecycle outcomes.
|
|
69
|
+
*/
|
|
70
|
+
recordReward(assignmentId: string, reward: number): Promise<boolean>;
|
|
71
|
+
private applyReward;
|
|
72
|
+
/** Apply an SGD update for a single (features, reward) observation */
|
|
73
|
+
private updateModel;
|
|
74
|
+
/** Fetch an archived episode record, or null when absent/expired */
|
|
75
|
+
getEpisode(assignmentId: string): Promise<LearningEpisodeRecord | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Apply named external feedback signals (e.g. { accuracy: 0.95 }) against
|
|
78
|
+
* the live decision or the archived episode of an assignment.
|
|
79
|
+
* Reward = sum(signalValue * signalWeight), default weight 1 per signal.
|
|
80
|
+
* Returns false when no learning context exists for the assignment.
|
|
81
|
+
*/
|
|
82
|
+
recordFeedback(assignmentId: string, signals: LearningSignals): Promise<boolean>;
|
|
83
|
+
/**
|
|
84
|
+
* Train the model directly with raw (features, reward) samples.
|
|
85
|
+
* Enables offline/batch imports from external pipelines (data warehouses,
|
|
86
|
+
* historical logs, post-processing jobs) without a live decision context.
|
|
87
|
+
*/
|
|
88
|
+
trainSamples(samples: LearningSample[]): Promise<number>;
|
|
89
|
+
/** Aggregate learning statistics */
|
|
90
|
+
getStats(): Promise<LearningStats>;
|
|
91
|
+
/** Reset model weights and statistics */
|
|
92
|
+
resetModel(): Promise<void>;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=LearningManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LearningManager.d.ts","sourceRoot":"","sources":["../../src/managers/LearningManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3M,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,eAAO,MAAM,wBAAwB,EAAE,eAMtC,CAAC;AAKF,MAAM,WAAW,sBAAsB;IACnC,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACnC,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,mFAAmF;IACnF,aAAa,CAAC,EAAE,M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AE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;YAI5D,WAAW;IA0BzB,sEAAsE;YACxD,WAAW;IAezB,oEAAoE;IAC9D,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAU7E;;;;;OAKG;IACG,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IActF;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAS9D,oCAAoC;IAC9B,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC;IAaxC,yCAAyC;IACnC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAMpC"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LearningManager = exports.DEFAULT_LEARNING_REWARDS = void 0;
|
|
4
|
+
exports.DEFAULT_LEARNING_REWARDS = {
|
|
5
|
+
accept: 0.3,
|
|
6
|
+
complete: 1,
|
|
7
|
+
reject: -0.6,
|
|
8
|
+
expire: -0.3,
|
|
9
|
+
fail: -0.8,
|
|
10
|
+
};
|
|
11
|
+
/** Outcomes that end an assignment's learning episode (decision record is removed) */
|
|
12
|
+
const TERMINAL_OUTCOMES = new Set(['complete', 'reject', 'expire', 'fail']);
|
|
13
|
+
class LearningManager {
|
|
14
|
+
constructor(redisClient, keys, options) {
|
|
15
|
+
this.redisClient = redisClient;
|
|
16
|
+
this.keys = keys;
|
|
17
|
+
this.learningRate = options?.learningRate ?? 0.1;
|
|
18
|
+
this.explorationRate = options?.explorationRate ?? 0.05;
|
|
19
|
+
this.shadowMode = options?.shadowMode ?? false;
|
|
20
|
+
this.boostFactor = options?.boostFactor ?? 1;
|
|
21
|
+
this.rewards = { ...exports.DEFAULT_LEARNING_REWARDS, ...options?.rewards };
|
|
22
|
+
this.decisionTtlMs = options?.decisionTtlMs ?? 604800000;
|
|
23
|
+
this.signalWeights = options?.signalWeights ?? {};
|
|
24
|
+
this.feedbackTtlMs = options?.feedbackTtlMs ?? 604800000;
|
|
25
|
+
}
|
|
26
|
+
/** Load the full model weights hash from Redis */
|
|
27
|
+
async getModel() {
|
|
28
|
+
return this.redisClient.hGetAll(this.keys.learningModel());
|
|
29
|
+
}
|
|
30
|
+
/** Predict expected reward for a feature vector against given model weights */
|
|
31
|
+
predict(features, weights) {
|
|
32
|
+
let sum = 0;
|
|
33
|
+
for (const [feature, value] of Object.entries(features)) {
|
|
34
|
+
const w = Number(weights[feature]);
|
|
35
|
+
if (!Number.isNaN(w) && w !== 0)
|
|
36
|
+
sum += w * value;
|
|
37
|
+
}
|
|
38
|
+
return sum;
|
|
39
|
+
}
|
|
40
|
+
/** Epsilon-greedy exploration check */
|
|
41
|
+
shouldExplore() {
|
|
42
|
+
return this.explorationRate > 0 && Math.random() < this.explorationRate;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Persist the decision context for an assignment so the eventual outcome
|
|
46
|
+
* can be attributed back to the features that drove the match.
|
|
47
|
+
*/
|
|
48
|
+
async recordDecision(userId, assignmentId, features, predictedReward) {
|
|
49
|
+
const record = {
|
|
50
|
+
userId,
|
|
51
|
+
assignmentId,
|
|
52
|
+
features,
|
|
53
|
+
predictedReward,
|
|
54
|
+
timestamp: Date.now(),
|
|
55
|
+
};
|
|
56
|
+
const multi = this.redisClient.multi();
|
|
57
|
+
multi.set(this.keys.learningDecision(assignmentId), JSON.stringify(record), {
|
|
58
|
+
PX: this.decisionTtlMs,
|
|
59
|
+
});
|
|
60
|
+
multi.hIncrBy(this.keys.learningStats(), 'decisions', 1);
|
|
61
|
+
await multi.exec();
|
|
62
|
+
}
|
|
63
|
+
/** Fetch a stored decision record, or null when absent/expired */
|
|
64
|
+
async getDecision(assignmentId) {
|
|
65
|
+
const json = await this.redisClient.get(this.keys.learningDecision(assignmentId));
|
|
66
|
+
if (!json)
|
|
67
|
+
return null;
|
|
68
|
+
try {
|
|
69
|
+
return JSON.parse(json);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Apply a lifecycle outcome as a reward update.
|
|
77
|
+
* Terminal outcomes archive the decision as an episode (with TTL) so late
|
|
78
|
+
* external feedback can still be attributed to the original features.
|
|
79
|
+
* Returns false if no decision context exists for the assignment.
|
|
80
|
+
*/
|
|
81
|
+
async applyOutcome(assignmentId, outcome) {
|
|
82
|
+
return this.applyReward(assignmentId, this.rewards[outcome], TERMINAL_OUTCOMES.has(outcome), outcome);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Apply a manually chosen reward (terminal: removes the decision record).
|
|
86
|
+
* Enables external reward shaping beyond the built-in lifecycle outcomes.
|
|
87
|
+
*/
|
|
88
|
+
async recordReward(assignmentId, reward) {
|
|
89
|
+
return this.applyReward(assignmentId, reward, true);
|
|
90
|
+
}
|
|
91
|
+
async applyReward(assignmentId, reward, terminal, outcome) {
|
|
92
|
+
const decision = await this.getDecision(assignmentId);
|
|
93
|
+
if (!decision)
|
|
94
|
+
return false;
|
|
95
|
+
await this.updateModel(decision.features, reward);
|
|
96
|
+
if (terminal) {
|
|
97
|
+
// Archive as episode so external post-processing feedback can
|
|
98
|
+
// still reach the model after the assignment is closed.
|
|
99
|
+
const episode = {
|
|
100
|
+
userId: decision.userId,
|
|
101
|
+
assignmentId,
|
|
102
|
+
features: decision.features,
|
|
103
|
+
outcome,
|
|
104
|
+
timestamp: Date.now(),
|
|
105
|
+
};
|
|
106
|
+
const multi = this.redisClient.multi();
|
|
107
|
+
multi.set(this.keys.learningEpisode(assignmentId), JSON.stringify(episode), {
|
|
108
|
+
PX: this.feedbackTtlMs,
|
|
109
|
+
});
|
|
110
|
+
multi.del(this.keys.learningDecision(assignmentId));
|
|
111
|
+
await multi.exec();
|
|
112
|
+
}
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
/** Apply an SGD update for a single (features, reward) observation */
|
|
116
|
+
async updateModel(features, reward) {
|
|
117
|
+
const weights = await this.getModel();
|
|
118
|
+
const prediction = this.predict(features, weights);
|
|
119
|
+
const error = reward - prediction;
|
|
120
|
+
const multi = this.redisClient.multi();
|
|
121
|
+
for (const [feature, value] of Object.entries(features)) {
|
|
122
|
+
if (value === 0)
|
|
123
|
+
continue;
|
|
124
|
+
multi.hIncrByFloat(this.keys.learningModel(), feature, this.learningRate * error * value);
|
|
125
|
+
}
|
|
126
|
+
multi.hIncrBy(this.keys.learningStats(), 'rewards', 1);
|
|
127
|
+
multi.hIncrByFloat(this.keys.learningStats(), 'totalReward', reward);
|
|
128
|
+
await multi.exec();
|
|
129
|
+
}
|
|
130
|
+
/** Fetch an archived episode record, or null when absent/expired */
|
|
131
|
+
async getEpisode(assignmentId) {
|
|
132
|
+
const json = await this.redisClient.get(this.keys.learningEpisode(assignmentId));
|
|
133
|
+
if (!json)
|
|
134
|
+
return null;
|
|
135
|
+
try {
|
|
136
|
+
return JSON.parse(json);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Apply named external feedback signals (e.g. { accuracy: 0.95 }) against
|
|
144
|
+
* the live decision or the archived episode of an assignment.
|
|
145
|
+
* Reward = sum(signalValue * signalWeight), default weight 1 per signal.
|
|
146
|
+
* Returns false when no learning context exists for the assignment.
|
|
147
|
+
*/
|
|
148
|
+
async recordFeedback(assignmentId, signals) {
|
|
149
|
+
const context = (await this.getDecision(assignmentId)) ?? (await this.getEpisode(assignmentId));
|
|
150
|
+
if (!context)
|
|
151
|
+
return false;
|
|
152
|
+
let reward = 0;
|
|
153
|
+
for (const [signal, value] of Object.entries(signals)) {
|
|
154
|
+
const weight = this.signalWeights[signal] ?? 1;
|
|
155
|
+
reward += value * weight;
|
|
156
|
+
}
|
|
157
|
+
await this.updateModel(context.features, reward);
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Train the model directly with raw (features, reward) samples.
|
|
162
|
+
* Enables offline/batch imports from external pipelines (data warehouses,
|
|
163
|
+
* historical logs, post-processing jobs) without a live decision context.
|
|
164
|
+
*/
|
|
165
|
+
async trainSamples(samples) {
|
|
166
|
+
let applied = 0;
|
|
167
|
+
for (const sample of samples) {
|
|
168
|
+
await this.updateModel(sample.features, sample.reward);
|
|
169
|
+
applied++;
|
|
170
|
+
}
|
|
171
|
+
return applied;
|
|
172
|
+
}
|
|
173
|
+
/** Aggregate learning statistics */
|
|
174
|
+
async getStats() {
|
|
175
|
+
const raw = await this.redisClient.hGetAll(this.keys.learningStats());
|
|
176
|
+
const decisions = Number(raw.decisions) || 0;
|
|
177
|
+
const rewards = Number(raw.rewards) || 0;
|
|
178
|
+
const totalReward = Number(raw.totalReward) || 0;
|
|
179
|
+
return {
|
|
180
|
+
decisions,
|
|
181
|
+
rewards,
|
|
182
|
+
totalReward,
|
|
183
|
+
averageReward: rewards > 0 ? totalReward / rewards : 0,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/** Reset model weights and statistics */
|
|
187
|
+
async resetModel() {
|
|
188
|
+
const multi = this.redisClient.multi();
|
|
189
|
+
multi.del(this.keys.learningModel());
|
|
190
|
+
multi.del(this.keys.learningStats());
|
|
191
|
+
await multi.exec();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
exports.LearningManager = LearningManager;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RedisClientType, WorkflowDefinition, WorkflowInstance, WorkflowStep, WorkflowEvent, Assignment, WorkflowInstanceWithSnapshot } from '../types/matcher';
|
|
1
|
+
import { RedisClientType, WorkflowDefinition, WorkflowDefinitionInput, WorkflowDefinitionSummary, WorkflowInstance, WorkflowStep, WorkflowEvent, Assignment, WorkflowInstanceWithSnapshot } from '../types/matcher';
|
|
2
2
|
import { KeyBuilders } from '../utils/keys';
|
|
3
3
|
import { ReliabilityManager } from './ReliabilityManager';
|
|
4
4
|
import { TelemetryManager } from './TelemetryManager';
|
|
@@ -32,12 +32,9 @@ export declare class WorkflowManager {
|
|
|
32
32
|
init(): Promise<void>;
|
|
33
33
|
private initStreamConsumerGroup;
|
|
34
34
|
setLuaScriptSha(sha: string): void;
|
|
35
|
-
registerWorkflow(definition: WorkflowDefinition): Promise<WorkflowDefinition>;
|
|
35
|
+
registerWorkflow(definition: WorkflowDefinitionInput | WorkflowDefinition): Promise<WorkflowDefinition>;
|
|
36
36
|
getWorkflowDefinition(id: string): Promise<WorkflowDefinition | null>;
|
|
37
|
-
listWorkflowDefinitions(): Promise<
|
|
38
|
-
id: string;
|
|
39
|
-
name: string;
|
|
40
|
-
}>>;
|
|
37
|
+
listWorkflowDefinitions(): Promise<WorkflowDefinitionSummary[]>;
|
|
41
38
|
startWorkflow(workflowDefinitionId: string, userId: string, initialContext?: Record<string, any>): Promise<WorkflowInstance>;
|
|
42
39
|
getWorkflowInstance(instanceId: string): Promise<WorkflowInstance | null>;
|
|
43
40
|
getWorkflowInstanceWithSnapshot(instanceId: string): Promise<WorkflowInstanceWithSnapshot | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowManager.d.ts","sourceRoot":"","sources":["../../src/managers/WorkflowManager.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
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,EAE/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;A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,MAAM,EACvB,SAAS,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EACrC,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnC,YAAY,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAC9C,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAgB3E"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WorkflowManager = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
|
+
const workflow_validation_1 = require("../workflow-validation");
|
|
5
6
|
class WorkflowManager {
|
|
6
7
|
constructor(redisClient, keys, reliability, telemetry, host, options) {
|
|
7
8
|
this.redisClient = redisClient;
|
|
@@ -37,10 +38,11 @@ class WorkflowManager {
|
|
|
37
38
|
this.luaScriptSha = sha;
|
|
38
39
|
}
|
|
39
40
|
async registerWorkflow(definition) {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
await this.redisClient.
|
|
43
|
-
|
|
41
|
+
const normalizedDefinition = (0, workflow_validation_1.normalizeWorkflowDefinition)(definition);
|
|
42
|
+
const key = this.keys.workflowDefinition(normalizedDefinition.id);
|
|
43
|
+
await this.redisClient.set(key, JSON.stringify(normalizedDefinition));
|
|
44
|
+
await this.redisClient.hSet(this.keys.workflowDefinitions(), normalizedDefinition.id, normalizedDefinition.name);
|
|
45
|
+
return normalizedDefinition;
|
|
44
46
|
}
|
|
45
47
|
async getWorkflowDefinition(id) {
|
|
46
48
|
const key = this.keys.workflowDefinition(id);
|
|
@@ -52,6 +54,12 @@ class WorkflowManager {
|
|
|
52
54
|
return Object.entries(definitions).map(([id, name]) => ({ id, name }));
|
|
53
55
|
}
|
|
54
56
|
async startWorkflow(workflowDefinitionId, userId, initialContext) {
|
|
57
|
+
if (!workflowDefinitionId.trim()) {
|
|
58
|
+
throw new Error('Workflow definition ID is required');
|
|
59
|
+
}
|
|
60
|
+
if (!userId.trim()) {
|
|
61
|
+
throw new Error('Workflow user ID is required');
|
|
62
|
+
}
|
|
55
63
|
const { span, end: endSpan } = this.telemetry.startSpan('workflow.start', {
|
|
56
64
|
'workflow.definition_id': workflowDefinitionId,
|
|
57
65
|
'workflow.user_id': userId,
|
|
@@ -592,6 +600,9 @@ class WorkflowManager {
|
|
|
592
600
|
type: 'COMPLETED',
|
|
593
601
|
});
|
|
594
602
|
}
|
|
603
|
+
else {
|
|
604
|
+
await this.saveInstance(instance, expectedVersion);
|
|
605
|
+
}
|
|
595
606
|
return;
|
|
596
607
|
}
|
|
597
608
|
}
|
package/dist/matcher.class.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type PaginationOptions, type PaginationResult, type AssignmentCounts } from './queries/pagination';
|
|
2
2
|
import { type WorkflowHost } from './managers/WorkflowManager';
|
|
3
|
-
import type { RedisClientType, User, Assignment, Stats, MatcherOptions, WorkflowDefinition, WorkflowInstance, WorkflowEvent, AssignmentResult, DeadLetterEntry, AuditEntry, WorkflowInstanceWithSnapshot } from './types/matcher';
|
|
4
|
-
export type { RedisClientType, User, Assignment, Stats, MatcherOptions, options } from './types/matcher';
|
|
5
|
-
export type { WorkflowDefinition, WorkflowInstance, WorkflowStep, WorkflowTaskType, WorkflowEvent, WorkflowEventType, AssignmentResult, ParallelBranchState, DeadLetterEntry, AuditEntry, CircuitBreakerState, WorkflowInstanceWithSnapshot, } from './types/matcher';
|
|
3
|
+
import type { RedisClientType, User, Assignment, Stats, PendingAssignmentInfo, MatcherOptions, WorkflowDefinition, WorkflowDefinitionInput, WorkflowDefinitionSummary, WorkflowInstance, WorkflowEvent, AssignmentResult, DeadLetterEntry, AuditEntry, WorkflowInstanceWithSnapshot, LearningSignals, LearningSample, LearningStats } from './types/matcher';
|
|
4
|
+
export type { RedisClientType, User, Assignment, Stats, PendingAssignmentInfo, MatcherOptions, options } from './types/matcher';
|
|
5
|
+
export type { WorkflowDefinition, WorkflowDefinitionInput, WorkflowDefinitionSummary, WorkflowInstance, WorkflowStep, WorkflowTargetUser, WorkflowMachineTask, WorkflowTaskType, WorkflowEvent, WorkflowEventType, AssignmentResult, ParallelBranchState, DeadLetterEntry, AuditEntry, CircuitBreakerState, WorkflowInstanceWithSnapshot, LearningOutcome, LearningRewards, LearningFeatures, LearningAssignmentContext, LearningFeatureExtractor, LearningDecisionRecord, LearningEpisodeRecord, LearningSignals, LearningSample, LearningStats, } from './types/matcher';
|
|
6
6
|
export default class AssignmentMatcher implements WorkflowHost {
|
|
7
7
|
redisClient: RedisClientType;
|
|
8
8
|
relevantBatchSize: number;
|
|
@@ -13,6 +13,7 @@ export default class AssignmentMatcher implements WorkflowHost {
|
|
|
13
13
|
maxUserBacklogSize: number;
|
|
14
14
|
enableDefaultMatching: boolean;
|
|
15
15
|
matchExpirationMs: number;
|
|
16
|
+
idleUserTimeoutMs: number | null;
|
|
16
17
|
pendingAssignmentsKey: string;
|
|
17
18
|
pendingAssignmentsExpiryKey: string;
|
|
18
19
|
assignmentOwnerKey: string;
|
|
@@ -28,10 +29,18 @@ export default class AssignmentMatcher implements WorkflowHost {
|
|
|
28
29
|
private telemetry;
|
|
29
30
|
private luaScriptSha;
|
|
30
31
|
private usingDefaultMatchScore;
|
|
32
|
+
private readonly readyPromise;
|
|
33
|
+
private enableLearning;
|
|
34
|
+
private learning;
|
|
35
|
+
private learningFeatureExtractor;
|
|
31
36
|
constructor(redisClient: RedisClientType, options?: MatcherOptions);
|
|
32
37
|
/** Keys for the three assignment stores (used by pagination queries) */
|
|
33
38
|
private get assignmentStoreKeys();
|
|
34
39
|
private initRedis;
|
|
40
|
+
/**
|
|
41
|
+
* Wait until the matcher has connected and initialized workflow internals.
|
|
42
|
+
*/
|
|
43
|
+
waitUntilReady(): Promise<this>;
|
|
35
44
|
/**
|
|
36
45
|
* Load Lua scripts into Redis for atomic operations.
|
|
37
46
|
*/
|
|
@@ -62,6 +71,38 @@ export default class AssignmentMatcher implements WorkflowHost {
|
|
|
62
71
|
* Get audit events from the audit stream.
|
|
63
72
|
*/
|
|
64
73
|
getAuditEvents(count?: number): Promise<AuditEntry[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Get the learned model weights (feature -> weight).
|
|
76
|
+
*/
|
|
77
|
+
getLearningModel(): Promise<Record<string, string>>;
|
|
78
|
+
/**
|
|
79
|
+
* Get aggregate learning statistics (decisions, rewards, average reward).
|
|
80
|
+
*/
|
|
81
|
+
getLearningStats(): Promise<LearningStats>;
|
|
82
|
+
/**
|
|
83
|
+
* Apply a manual reward to a matched assignment's decision context.
|
|
84
|
+
* Enables custom reward shaping beyond the built-in lifecycle outcomes.
|
|
85
|
+
* Returns false when no decision context exists for the assignment.
|
|
86
|
+
*/
|
|
87
|
+
recordLearningReward(assignmentId: string, reward: number): Promise<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* Feed external post-processing signals into the model for an assignment
|
|
90
|
+
* (e.g. { accuracy: 0.95, csat: 0.8 }). Works for live decisions and for
|
|
91
|
+
* archived episodes of already-completed assignments (within the feedback TTL).
|
|
92
|
+
* Signal values are weighted via the `learningSignalWeights` option (default 1).
|
|
93
|
+
* Returns false when no learning context exists for the assignment.
|
|
94
|
+
*/
|
|
95
|
+
recordLearningFeedback(assignmentId: string, signals: LearningSignals): Promise<boolean>;
|
|
96
|
+
/**
|
|
97
|
+
* Train the model directly with raw (features, reward) samples from an
|
|
98
|
+
* external pipeline (offline evaluation jobs, historical data imports).
|
|
99
|
+
* Returns the number of samples applied.
|
|
100
|
+
*/
|
|
101
|
+
trainLearningSamples(samples: LearningSample[]): Promise<number>;
|
|
102
|
+
/**
|
|
103
|
+
* Reset the learned model weights and statistics.
|
|
104
|
+
*/
|
|
105
|
+
resetLearningModel(): Promise<void>;
|
|
65
106
|
/**
|
|
66
107
|
* Set the OpenTelemetry tracer instance.
|
|
67
108
|
*/
|
|
@@ -105,6 +146,10 @@ export default class AssignmentMatcher implements WorkflowHost {
|
|
|
105
146
|
* Get multiple assignments by IDs efficiently.
|
|
106
147
|
*/
|
|
107
148
|
getAssignmentsByIds(ids: string[]): Promise<Assignment[]>;
|
|
149
|
+
/**
|
|
150
|
+
* Get all pending assignments with owner and pending duration metadata.
|
|
151
|
+
*/
|
|
152
|
+
getPendingAssignmentsWithAge(): Promise<PendingAssignmentInfo[]>;
|
|
108
153
|
/** Default match score implementation using extracted scoring module */
|
|
109
154
|
private defaultMatchScore;
|
|
110
155
|
private matchScore;
|
|
@@ -150,7 +195,7 @@ export default class AssignmentMatcher implements WorkflowHost {
|
|
|
150
195
|
/**
|
|
151
196
|
* Register a new workflow definition.
|
|
152
197
|
*/
|
|
153
|
-
registerWorkflow(definition: WorkflowDefinition): Promise<WorkflowDefinition>;
|
|
198
|
+
registerWorkflow(definition: WorkflowDefinitionInput | WorkflowDefinition): Promise<WorkflowDefinition>;
|
|
154
199
|
/**
|
|
155
200
|
* Get a workflow definition by ID.
|
|
156
201
|
*/
|
|
@@ -158,10 +203,11 @@ export default class AssignmentMatcher implements WorkflowHost {
|
|
|
158
203
|
/**
|
|
159
204
|
* List all registered workflow definitions.
|
|
160
205
|
*/
|
|
161
|
-
listWorkflowDefinitions(): Promise<
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
206
|
+
listWorkflowDefinitions(): Promise<WorkflowDefinitionSummary[]>;
|
|
207
|
+
/**
|
|
208
|
+
* Register and start a workflow in one call, or start an already-registered workflow by ID.
|
|
209
|
+
*/
|
|
210
|
+
executeWorkflow(workflowOrId: WorkflowDefinitionInput | WorkflowDefinition | string, userId: string, initialContext?: Record<string, any>): Promise<WorkflowInstance>;
|
|
165
211
|
/**
|
|
166
212
|
* Start a new workflow instance for a user.
|
|
167
213
|
*/
|
|
@@ -204,6 +250,30 @@ export default class AssignmentMatcher implements WorkflowHost {
|
|
|
204
250
|
private autoReleaseInterval;
|
|
205
251
|
startAutoReleaseInterval(intervalMs?: number): void;
|
|
206
252
|
stopAutoReleaseInterval(): void;
|
|
253
|
+
/**
|
|
254
|
+
* Record activity for a user (heartbeat). Resets the idle clock used by
|
|
255
|
+
* processIdleUsers(). Called automatically on addUser, acceptAssignment,
|
|
256
|
+
* and rejectAssignment; consumers can also call it directly as a heartbeat.
|
|
257
|
+
*/
|
|
258
|
+
touchUser(userId: string): Promise<void>;
|
|
259
|
+
/**
|
|
260
|
+
* Detect users that have been idle longer than idleUserTimeoutMs while
|
|
261
|
+
* holding pending (unactioned) assignments. Idle users are removed from
|
|
262
|
+
* the matching pool and their pending assignments are requeued for
|
|
263
|
+
* distribution to other users.
|
|
264
|
+
*
|
|
265
|
+
* No-op (returns []) when idleUserTimeoutMs is not configured.
|
|
266
|
+
*
|
|
267
|
+
* @returns IDs of users that were removed
|
|
268
|
+
*/
|
|
269
|
+
processIdleUsers(): Promise<string[]>;
|
|
270
|
+
/**
|
|
271
|
+
* Requeue all pending assignments currently held by a user.
|
|
272
|
+
*/
|
|
273
|
+
private releaseUserPendingAssignments;
|
|
274
|
+
private idleUserInterval;
|
|
275
|
+
startIdleUserInterval(intervalMs?: number): void;
|
|
276
|
+
stopIdleUserInterval(): void;
|
|
207
277
|
/**
|
|
208
278
|
* Get assignments specifically targeted at a user through active workflows.
|
|
209
279
|
* These take priority over general pool assignments for deterministic matching.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matcher.class.d.ts","sourceRoot":"","sources":["../src/matcher.class.ts"],"names":[],"mappings":"AAKA,OAAO,EAMH,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACxB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"matcher.class.d.ts","sourceRoot":"","sources":["../src/matcher.class.ts"],"names":[],"mappings":"AAKA,OAAO,EAMH,KAAK,iBAAiB,EAC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