@didit-protocol/mcp-server 5.1.63 → 5.1.65
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 +25 -0
- package/dist/backend-events.d.ts +88 -0
- package/dist/backend-events.d.ts.map +1 -0
- package/dist/backend-events.js +139 -0
- package/dist/backend-events.js.map +1 -0
- package/dist/guidance.d.ts +2 -0
- package/dist/guidance.d.ts.map +1 -1
- package/dist/guidance.js +4 -1
- package/dist/guidance.js.map +1 -1
- package/dist/http.d.ts +8 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +75 -0
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -11
- package/dist/index.js.map +1 -1
- package/dist/mcp-modern.d.ts +3 -0
- package/dist/mcp-modern.d.ts.map +1 -1
- package/dist/mcp-modern.js +1 -0
- package/dist/mcp-modern.js.map +1 -1
- package/dist/tools/search.js +2 -2
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/sessions.js +2 -2
- package/dist/tools/sessions.js.map +1 -1
- package/dist/tools/shared-schema.d.ts +8 -0
- package/dist/tools/shared-schema.d.ts.map +1 -1
- package/dist/tools/shared-schema.js +9 -1
- package/dist/tools/shared-schema.js.map +1 -1
- package/dist/wakeshift.d.ts +221 -0
- package/dist/wakeshift.d.ts.map +1 -0
- package/dist/wakeshift.js +524 -0
- package/dist/wakeshift.js.map +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Wakeshift events: wake the agent that asked when something happens in Didit,
|
|
4
|
+
* instead of having it poll.
|
|
5
|
+
*
|
|
6
|
+
* session.status.updated a verification session reached a final status (Approved, Declined, Expired…).
|
|
7
|
+
* Subscribed by didit_session_create and didit_session_watch.
|
|
8
|
+
* session.in_review a session of an application went to In Review (the manual-review queue).
|
|
9
|
+
* Subscribed by didit_session_watch_reviews.
|
|
10
|
+
* session.webhook_delivery.logged Didit logged a webhook delivery attempt for a session.
|
|
11
|
+
* Subscribed by didit_session_webhooks.
|
|
12
|
+
* session_import.finished an import job finished: a dry run ended READY, or the import COMPLETED,
|
|
13
|
+
* FAILED or was CANCELLED. Subscribed by didit_session_create_import and
|
|
14
|
+
* didit_session_manage_import (start, resume, retry).
|
|
15
|
+
* transaction.status.updated a monitored transaction reached a final status. Subscribed by didit_transaction_create.
|
|
16
|
+
* transaction.in_review a transaction of an application went to IN_REVIEW.
|
|
17
|
+
* Subscribed by didit_transaction_watch_reviews.
|
|
18
|
+
*
|
|
19
|
+
* The Didit backend reports each change to POST /internal/events/<event>
|
|
20
|
+
* (backend-events.ts, docs/backend-events.md), and those routes emit. Nothing polls.
|
|
21
|
+
* Payloads carry IDs, statuses, counts and times only: never personal data,
|
|
22
|
+
* decisions, documents or webhook payloads. The agent reads the details with the
|
|
23
|
+
* existing tools, under its own credential.
|
|
24
|
+
*
|
|
25
|
+
* This module is loaded only when Wakeshift is on (HTTP, with both WAKESHIFT_KEY
|
|
26
|
+
* and DIDIT_EVENTS_SECRET set; see http.ts). Otherwise nothing here runs and
|
|
27
|
+
* every tool behaves as it did before.
|
|
28
|
+
*/
|
|
29
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
32
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
33
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
34
|
+
}
|
|
35
|
+
Object.defineProperty(o, k2, desc);
|
|
36
|
+
}) : (function(o, m, k, k2) {
|
|
37
|
+
if (k2 === undefined) k2 = k;
|
|
38
|
+
o[k2] = m[k];
|
|
39
|
+
}));
|
|
40
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
41
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
42
|
+
}) : function(o, v) {
|
|
43
|
+
o["default"] = v;
|
|
44
|
+
});
|
|
45
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
46
|
+
var ownKeys = function(o) {
|
|
47
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
48
|
+
var ar = [];
|
|
49
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
50
|
+
return ar;
|
|
51
|
+
};
|
|
52
|
+
return ownKeys(o);
|
|
53
|
+
};
|
|
54
|
+
return function (mod) {
|
|
55
|
+
if (mod && mod.__esModule) return mod;
|
|
56
|
+
var result = {};
|
|
57
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
58
|
+
__setModuleDefault(result, mod);
|
|
59
|
+
return result;
|
|
60
|
+
};
|
|
61
|
+
})();
|
|
62
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
+
exports.WAKESHIFT_TOOL_NAMES = exports.REVIEW_WATCH_TTL = exports.DELIVERY_WATCH_TTL = exports.STATUS_WATCH_TTL = void 0;
|
|
64
|
+
exports.userIdFor = userIdFor;
|
|
65
|
+
exports.emitId = emitId;
|
|
66
|
+
exports.wakeConfirmed = wakeConfirmed;
|
|
67
|
+
exports.createDiditWakeshift = createDiditWakeshift;
|
|
68
|
+
exports.createWakeshiftFromEnv = createWakeshiftFromEnv;
|
|
69
|
+
const node_crypto_1 = require("node:crypto");
|
|
70
|
+
const sdk_1 = require("@wakeshift/sdk");
|
|
71
|
+
const zod_1 = require("zod");
|
|
72
|
+
const sessions = __importStar(require("./tools/sessions"));
|
|
73
|
+
const transactions = __importStar(require("./tools/transactions"));
|
|
74
|
+
const config_1 = require("./config");
|
|
75
|
+
const orgapp_1 = require("./orgapp");
|
|
76
|
+
const api_key_connection_1 = require("./api-key-connection");
|
|
77
|
+
const discovery_1 = require("./tools/discovery");
|
|
78
|
+
const backend_events_1 = require("./backend-events");
|
|
79
|
+
/** A watch on a session or transaction ends after this long with no change and no renewal. */
|
|
80
|
+
exports.STATUS_WATCH_TTL = "7d";
|
|
81
|
+
/** A watch on a session's webhook deliveries ends after this long with no delivery. */
|
|
82
|
+
exports.DELIVERY_WATCH_TTL = "1h";
|
|
83
|
+
/** A watch on an application's review queue ends after this long with nothing new in review. */
|
|
84
|
+
exports.REVIEW_WATCH_TTL = "7d";
|
|
85
|
+
/**
|
|
86
|
+
* How far back a subscribe also delivers the latest occurrence, so one emitted
|
|
87
|
+
* between the tool's API call and its subscribe isn't missed. Every event this
|
|
88
|
+
* applies to is keyed by an ID the call just created or read.
|
|
89
|
+
*/
|
|
90
|
+
const CATCH_UP = "10m";
|
|
91
|
+
/** An import can finish within seconds of being created, or between create and subscribe. */
|
|
92
|
+
const IMPORT_CATCH_UP = "1h";
|
|
93
|
+
/**
|
|
94
|
+
* The watch tools read first (the access check), then subscribe: a change reported in between
|
|
95
|
+
* is delivered too. Short, so a change from before the read (which the read already showed)
|
|
96
|
+
* rarely wakes the agent again.
|
|
97
|
+
*/
|
|
98
|
+
const READ_CATCH_UP = "2m";
|
|
99
|
+
/**
|
|
100
|
+
* The session statuses that wake an agent watching a session: the final ones.
|
|
101
|
+
* The others (Not Started, In Progress, In Review, Resubmitted, Awaiting User)
|
|
102
|
+
* mean the decision is still to come; In Review has its own event for the
|
|
103
|
+
* review queue (session.in_review).
|
|
104
|
+
*/
|
|
105
|
+
const FINAL_SESSION_STATUSES = new Set(["Approved", "Declined", "Expired", "Abandoned", "Kyc Expired"]);
|
|
106
|
+
/** The same for transactions; IN_REVIEW has its own event (transaction.in_review). */
|
|
107
|
+
const FINAL_TRANSACTION_STATUSES = new Set(["APPROVED", "DECLINED", "CANCELLED"]);
|
|
108
|
+
/**
|
|
109
|
+
* The tools this module adds to the hosted full profile. Their names put them in the toolsets of
|
|
110
|
+
* the tools they extend (toolsets.ts matches by prefix): `sessions` and `transactions`.
|
|
111
|
+
*/
|
|
112
|
+
exports.WAKESHIFT_TOOL_NAMES = ["didit_session_watch", "didit_session_watch_reviews", "didit_transaction_watch_reviews"];
|
|
113
|
+
/**
|
|
114
|
+
* The Didit tool whose role permission each watch tool needs (permissions.ts): the read it
|
|
115
|
+
* makes as its access check. A role that may not list transactions is not offered the watch on
|
|
116
|
+
* them, exactly as it is not offered the list.
|
|
117
|
+
*/
|
|
118
|
+
const PERMISSION_AS = {
|
|
119
|
+
didit_session_watch: "didit_session_get_decision",
|
|
120
|
+
didit_session_watch_reviews: "didit_session_list",
|
|
121
|
+
didit_transaction_watch_reviews: "didit_transaction_list",
|
|
122
|
+
};
|
|
123
|
+
/** Existing tools that subscribe and only read Didit (annotated read-only in index.ts). */
|
|
124
|
+
const READ_TOOLS_THAT_SUBSCRIBE = new Set(["didit_session_webhooks"]);
|
|
125
|
+
/**
|
|
126
|
+
* A Wakeshift user ID for the caller, never a credential.
|
|
127
|
+
*
|
|
128
|
+
* A person's sign-in: an opaque hash of the token's subject (the person).
|
|
129
|
+
* An application API key (api-key-connection.ts): no person is behind it, so an opaque hash of
|
|
130
|
+
* the application and the key's id (the primary key has none). Each key is its own subscriber:
|
|
131
|
+
* a restricted key never lists or ends what a full-access key of the same application
|
|
132
|
+
* subscribed. The key itself never goes into the hash. The prefixes keep the two apart.
|
|
133
|
+
*/
|
|
134
|
+
function userIdFor(authInfo) {
|
|
135
|
+
const key = (0, api_key_connection_1.apiKeyScopeOf)(authInfo);
|
|
136
|
+
if (key) {
|
|
137
|
+
if (!key.applicationId)
|
|
138
|
+
return undefined;
|
|
139
|
+
const hash = (0, node_crypto_1.createHash)("sha256").update(`didit-api-key\n${key.applicationId}\n${key.keyId ?? "primary"}`).digest("hex");
|
|
140
|
+
return "didit-key-" + hash.slice(0, 32);
|
|
141
|
+
}
|
|
142
|
+
const sub = authInfo?.extra?.sub;
|
|
143
|
+
if (typeof sub !== "string" && typeof sub !== "number")
|
|
144
|
+
return undefined;
|
|
145
|
+
return "didit-" + (0, node_crypto_1.createHash)("sha256").update(`didit-user\n${sub}`).digest("hex").slice(0, 32);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* An emit id: a hash of the event and the notification's own IDs, so it has a
|
|
149
|
+
* fixed length (Wakeshift takes at most 200 characters) and a retried
|
|
150
|
+
* notification emits once.
|
|
151
|
+
*/
|
|
152
|
+
function emitId(event, ...ids) {
|
|
153
|
+
return (0, node_crypto_1.createHash)("sha256").update([event, ...ids].join("\n")).digest("hex");
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Runs one emit. An id Wakeshift already took with a different payload (a retry
|
|
157
|
+
* whose body changed, say a recomputed timestamp) means this change was already
|
|
158
|
+
* emitted: it counts as done, not as a failure the backend should retry forever.
|
|
159
|
+
*/
|
|
160
|
+
async function once(event, emit) {
|
|
161
|
+
try {
|
|
162
|
+
const out = (await emit());
|
|
163
|
+
// One line per emit, so a 204 can be read later: how many conversations it reached.
|
|
164
|
+
// The event's name and counts only, never its arguments or payload.
|
|
165
|
+
console.error(`[didit-mcp] wakeshift: ${event} ${out?.duplicate ? "duplicate (already emitted)" : `emitted, matched ${out?.matched ?? 0}`}`);
|
|
166
|
+
}
|
|
167
|
+
catch (err) {
|
|
168
|
+
if ((0, sdk_1.isWakeshiftError)(err, "id_reused")) {
|
|
169
|
+
console.error(`[didit-mcp] wakeshift: ${event} already emitted`);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
throw err;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Whether a subscribe will wake the calling conversation: a subscription created or renewed, for
|
|
177
|
+
* an agent program Wakeshift recognized. A native (MCP Events) client's, one for an agent
|
|
178
|
+
* Wakeshift didn't recognize, and every unavailable or disabled state are not.
|
|
179
|
+
*/
|
|
180
|
+
function wakeConfirmed(sub) {
|
|
181
|
+
return (sub.state === "created" || sub.state === "renewed") && !!sub.recognized?.harness;
|
|
182
|
+
}
|
|
183
|
+
/** Defines Didit's events on a Wakeshift client, and everything that subscribes and emits them. */
|
|
184
|
+
function createDiditWakeshift(wake) {
|
|
185
|
+
// Every argument is an ID: encodeArgValue keeps case-sensitive IDs apart.
|
|
186
|
+
const arg = (value) => (0, sdk_1.encodeArgValue)(value);
|
|
187
|
+
const sessionStatus = wake.defineEvent("session.status.updated", {
|
|
188
|
+
description: "A Didit verification session reached a final status",
|
|
189
|
+
args: zod_1.z.object({ session: zod_1.z.string() }),
|
|
190
|
+
payload: zod_1.z.object({
|
|
191
|
+
session_id: zod_1.z.string(),
|
|
192
|
+
application_id: zod_1.z.string(),
|
|
193
|
+
status: zod_1.z.string(),
|
|
194
|
+
updated_at: zod_1.z.string(),
|
|
195
|
+
}),
|
|
196
|
+
text: (p) => `Didit verification session ${p.session_id} is now ${p.status}. Read it with didit_session_get_decision.`,
|
|
197
|
+
});
|
|
198
|
+
const sessionInReview = wake.defineEvent("session.in_review", {
|
|
199
|
+
description: "A Didit verification session went to In Review (manual review)",
|
|
200
|
+
args: zod_1.z.object({ application: zod_1.z.string() }),
|
|
201
|
+
payload: zod_1.z.object({
|
|
202
|
+
session_id: zod_1.z.string(),
|
|
203
|
+
application_id: zod_1.z.string(),
|
|
204
|
+
updated_at: zod_1.z.string(),
|
|
205
|
+
}),
|
|
206
|
+
text: (p) => `Didit verification session ${p.session_id} is In Review. Read it with didit_session_get_decision.`,
|
|
207
|
+
});
|
|
208
|
+
const deliveryLogged = wake.defineEvent("session.webhook_delivery.logged", {
|
|
209
|
+
description: "Didit logged a webhook delivery attempt for a verification session",
|
|
210
|
+
args: zod_1.z.object({ session: zod_1.z.string() }),
|
|
211
|
+
payload: zod_1.z.object({
|
|
212
|
+
session_id: zod_1.z.string(),
|
|
213
|
+
delivery_id: zod_1.z.string(),
|
|
214
|
+
webhook_type: zod_1.z.string(),
|
|
215
|
+
destination_host: zod_1.z.string(),
|
|
216
|
+
response_status: zod_1.z.number().nullable(),
|
|
217
|
+
attempted_at: zod_1.z.string(),
|
|
218
|
+
}),
|
|
219
|
+
text: (p) => `Didit sent ${p.webhook_type} for session ${p.session_id} to ${p.destination_host}: ` +
|
|
220
|
+
`${p.response_status === null ? "no response" : `HTTP ${p.response_status}`}. Details with didit_session_webhooks.`,
|
|
221
|
+
});
|
|
222
|
+
const importFinished = wake.defineEvent("session_import.finished", {
|
|
223
|
+
description: "A Didit import job finished",
|
|
224
|
+
// run: "dry_run" for a dry run ending READY, "import" for an import ending
|
|
225
|
+
// COMPLETED, FAILED or CANCELLED, so a watch on the real import is never
|
|
226
|
+
// ended by the dry run's earlier occurrence.
|
|
227
|
+
args: zod_1.z.object({ import: zod_1.z.string(), run: zod_1.z.enum(["dry_run", "import"]) }),
|
|
228
|
+
payload: zod_1.z.object({
|
|
229
|
+
import_id: zod_1.z.string(),
|
|
230
|
+
status: zod_1.z.string(),
|
|
231
|
+
import_type: zod_1.z.string(),
|
|
232
|
+
total_rows: zod_1.z.number().nullable(),
|
|
233
|
+
processed_rows: zod_1.z.number().nullable(),
|
|
234
|
+
created_count: zod_1.z.number().nullable(),
|
|
235
|
+
updated_count: zod_1.z.number().nullable(),
|
|
236
|
+
skipped_count: zod_1.z.number().nullable(),
|
|
237
|
+
failed_count: zod_1.z.number().nullable(),
|
|
238
|
+
finished_at: zod_1.z.string(),
|
|
239
|
+
}),
|
|
240
|
+
text: (p) => p.status === "READY"
|
|
241
|
+
? `Didit import ${p.import_id} finished its dry run (READY). Read it with didit_session_get_import; start it with didit_session_manage_import.`
|
|
242
|
+
: `Didit import ${p.import_id} is ${p.status}. Read it with didit_session_get_import${p.failed_count ? " and didit_session_get_import_errors" : ""}.`,
|
|
243
|
+
});
|
|
244
|
+
const transactionStatus = wake.defineEvent("transaction.status.updated", {
|
|
245
|
+
description: "A monitored Didit transaction reached a final status",
|
|
246
|
+
args: zod_1.z.object({ application: zod_1.z.string(), transaction: zod_1.z.string() }),
|
|
247
|
+
payload: zod_1.z.object({
|
|
248
|
+
transaction_id: zod_1.z.string(),
|
|
249
|
+
txn_id: zod_1.z.string(),
|
|
250
|
+
application_id: zod_1.z.string(),
|
|
251
|
+
status: zod_1.z.string(),
|
|
252
|
+
updated_at: zod_1.z.string(),
|
|
253
|
+
}),
|
|
254
|
+
text: (p) => `Didit transaction ${p.txn_id} is now ${p.status}. Read it with didit_transaction_get.`,
|
|
255
|
+
});
|
|
256
|
+
const transactionInReview = wake.defineEvent("transaction.in_review", {
|
|
257
|
+
description: "A monitored Didit transaction went to IN_REVIEW",
|
|
258
|
+
args: zod_1.z.object({ application: zod_1.z.string() }),
|
|
259
|
+
payload: zod_1.z.object({
|
|
260
|
+
transaction_id: zod_1.z.string(),
|
|
261
|
+
txn_id: zod_1.z.string(),
|
|
262
|
+
application_id: zod_1.z.string(),
|
|
263
|
+
updated_at: zod_1.z.string(),
|
|
264
|
+
}),
|
|
265
|
+
text: (p) => `Didit transaction ${p.txn_id} is IN_REVIEW. Read it with didit_transaction_get.`,
|
|
266
|
+
});
|
|
267
|
+
// ── Emits, one per backend notification ─────────────────────────────
|
|
268
|
+
async function emitSessionStatus(b) {
|
|
269
|
+
if (!FINAL_SESSION_STATUSES.has(b.status) && b.status !== "In Review") {
|
|
270
|
+
console.error(`[didit-mcp] wakeshift: ${sessionStatus.name} not emitted, status not final`);
|
|
271
|
+
}
|
|
272
|
+
if (FINAL_SESSION_STATUSES.has(b.status)) {
|
|
273
|
+
const payload = { session_id: b.session_id, application_id: b.application_id, status: b.status, updated_at: b.updated_at };
|
|
274
|
+
await once(sessionStatus.name, () => sessionStatus.emit({ session: arg(b.session_id) }, payload, { id: emitId(sessionStatus.name, b.event_id) }));
|
|
275
|
+
}
|
|
276
|
+
if (b.status === "In Review") {
|
|
277
|
+
await once(sessionInReview.name, () => sessionInReview.emit({ application: arg(b.application_id) }, { session_id: b.session_id, application_id: b.application_id, updated_at: b.updated_at }, { id: emitId(sessionInReview.name, b.event_id) }));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
async function emitDelivery(b) {
|
|
281
|
+
await once(deliveryLogged.name, () => deliveryLogged.emit({ session: arg(b.session_id) }, b, { id: emitId(deliveryLogged.name, b.session_id, b.delivery_id) }));
|
|
282
|
+
}
|
|
283
|
+
async function emitImportFinished(b) {
|
|
284
|
+
const run = b.status === "READY" ? "dry_run" : "import";
|
|
285
|
+
// The emit's id is the finish's own (event_id), never the job and its status: a job that
|
|
286
|
+
// fails, is resumed and fails again finishes twice the same way, and an id made of job and
|
|
287
|
+
// status would have Wakeshift drop the second finish as a repeat of the first, leaving the
|
|
288
|
+
// agent that resumed it waiting for a wake that never comes.
|
|
289
|
+
const { event_id, ...payload } = b;
|
|
290
|
+
await once(importFinished.name, () => importFinished.emit({ import: arg(b.import_id), run }, payload, { id: emitId(importFinished.name, event_id) }));
|
|
291
|
+
}
|
|
292
|
+
async function emitTransactionStatus(b) {
|
|
293
|
+
if (FINAL_TRANSACTION_STATUSES.has(b.status.toUpperCase())) {
|
|
294
|
+
const payload = { transaction_id: b.transaction_id, txn_id: b.txn_id, application_id: b.application_id, status: b.status, updated_at: b.updated_at };
|
|
295
|
+
await once(transactionStatus.name, () => transactionStatus.emit({ application: arg(b.application_id), transaction: arg(b.txn_id) }, payload, { id: emitId(transactionStatus.name, b.event_id) }));
|
|
296
|
+
}
|
|
297
|
+
if (b.status === "IN_REVIEW") {
|
|
298
|
+
await once(transactionInReview.name, () => transactionInReview.emit({ application: arg(b.application_id) }, { transaction_id: b.transaction_id, txn_id: b.txn_id, application_id: b.application_id, updated_at: b.updated_at }, { id: emitId(transactionInReview.name, b.event_id) }));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/** The backend's routes: path, body schema, emit. Mounted by http.ts. */
|
|
302
|
+
const routes = [
|
|
303
|
+
{ path: "/internal/events/session-status-updated", schema: backend_events_1.sessionStatusUpdatedBody, emit: emitSessionStatus },
|
|
304
|
+
{ path: "/internal/events/session-webhook-delivery", schema: backend_events_1.sessionWebhookDeliveryBody, emit: emitDelivery },
|
|
305
|
+
{ path: "/internal/events/session-import-finished", schema: backend_events_1.sessionImportFinishedBody, emit: emitImportFinished },
|
|
306
|
+
{ path: "/internal/events/transaction-status-updated", schema: backend_events_1.transactionStatusUpdatedBody, emit: emitTransactionStatus },
|
|
307
|
+
];
|
|
308
|
+
// ── Subscribes ──────────────────────────────────────────────────────
|
|
309
|
+
const watchSession = (sessionId, replay) => wake.currentCall().subscribe(sessionStatus, { session: arg(sessionId) }, {
|
|
310
|
+
ttl: exports.STATUS_WATCH_TTL,
|
|
311
|
+
replay,
|
|
312
|
+
reason: `Watching Didit session ${sessionId}`,
|
|
313
|
+
});
|
|
314
|
+
/** Tools that subscribe, each with its events. */
|
|
315
|
+
const subscribing = {
|
|
316
|
+
didit_session_create: [sessionStatus],
|
|
317
|
+
didit_session_watch: [sessionStatus],
|
|
318
|
+
didit_session_watch_reviews: [sessionInReview],
|
|
319
|
+
didit_session_webhooks: [deliveryLogged],
|
|
320
|
+
didit_session_create_import: [importFinished],
|
|
321
|
+
didit_session_manage_import: [importFinished],
|
|
322
|
+
didit_transaction_create: [transactionStatus],
|
|
323
|
+
didit_transaction_watch_reviews: [transactionInReview],
|
|
324
|
+
};
|
|
325
|
+
const isRead = (name) => exports.WAKESHIFT_TOOL_NAMES.includes(name) || READ_TOOLS_THAT_SUBSCRIBE.has(name);
|
|
326
|
+
const eventsOf = (names) => [...new Set(names.flatMap((name) => subscribing[name]))];
|
|
327
|
+
/**
|
|
328
|
+
* A connection that lists only some toolsets reaches the rest through didit_tool_call_read and
|
|
329
|
+
* didit_tool_call_write (tools/discovery.ts). The tool they run is unwrapped inside Didit's
|
|
330
|
+
* handler, so Wakeshift sees the proxy: each proxy subscribes to what the tools it may run do
|
|
331
|
+
* (the read one runs only read-only tools). Its call then carries Wakeshift's arguments, and
|
|
332
|
+
* the subscribe of the tool it runs works.
|
|
333
|
+
*/
|
|
334
|
+
const viaProxy = {
|
|
335
|
+
[discovery_1.TOOL_CALL_READ]: eventsOf(Object.keys(subscribing).filter(isRead)),
|
|
336
|
+
[discovery_1.TOOL_CALL_WRITE]: eventsOf(Object.keys(subscribing)),
|
|
337
|
+
};
|
|
338
|
+
/**
|
|
339
|
+
* attach's `wrap`. A function rather than a table: a connection's toolsets decide which of
|
|
340
|
+
* these tools it lists, and a tool it does not list still runs when called by name.
|
|
341
|
+
*/
|
|
342
|
+
const own = (table, tool) => Object.prototype.hasOwnProperty.call(table, tool) ? table[tool] : undefined;
|
|
343
|
+
const wrap = (tool) => own(subscribing, tool) ?? own(viaProxy, tool);
|
|
344
|
+
/**
|
|
345
|
+
* Subscribes after an existing tool succeeded. The tool already did its work
|
|
346
|
+
* (a created session may be billed), so a Wakeshift failure is logged and
|
|
347
|
+
* never turns the result into an error.
|
|
348
|
+
*/
|
|
349
|
+
async function after(name, args, result) {
|
|
350
|
+
try {
|
|
351
|
+
switch (name) {
|
|
352
|
+
case "didit_session_create": {
|
|
353
|
+
// replay: a sandbox session can change status before this subscribe.
|
|
354
|
+
if (typeof result?.session_id === "string")
|
|
355
|
+
await watchSession(result.session_id, CATCH_UP);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
case "didit_session_webhooks": {
|
|
359
|
+
// The agent chose to wait for deliveries in this call (wait_seconds): respect it,
|
|
360
|
+
// and subscribe nothing. 0 (the default) asks for no wait, so a watch replaces nothing.
|
|
361
|
+
if (Number(args.wait_seconds ?? 0) > 0)
|
|
362
|
+
return;
|
|
363
|
+
// The read just checked the caller can see the session's deliveries.
|
|
364
|
+
await wake.currentCall().subscribe(deliveryLogged, { session: arg(String(args.session_id)) }, {
|
|
365
|
+
ttl: exports.DELIVERY_WATCH_TTL,
|
|
366
|
+
replay: CATCH_UP,
|
|
367
|
+
reason: `Watching webhook deliveries of Didit session ${args.session_id}`,
|
|
368
|
+
});
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
case "didit_session_create_import": {
|
|
372
|
+
if (typeof result?.uuid !== "string")
|
|
373
|
+
return;
|
|
374
|
+
await wake.currentCall().subscribe(importFinished, { import: arg(result.uuid), run: args.dry_run === true ? "dry_run" : "import" }, { once: true, replay: IMPORT_CATCH_UP, reason: `Watching Didit import ${result.uuid}` });
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
case "didit_session_manage_import": {
|
|
378
|
+
// start and resume run the same job; retry answers with a new one.
|
|
379
|
+
if (!["start", "resume", "retry"].includes(args.action))
|
|
380
|
+
return;
|
|
381
|
+
const job = typeof result?.uuid === "string" ? result.uuid : String(args.import_id);
|
|
382
|
+
await wake.currentCall().subscribe(importFinished, { import: arg(job), run: "import" }, { once: true, replay: IMPORT_CATCH_UP, reason: `Watching Didit import ${job}` });
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
case "didit_transaction_create": {
|
|
386
|
+
// transaction_id here is the customer's own ID (txn_id in Didit's webhooks),
|
|
387
|
+
// unique within the application the transaction was created in.
|
|
388
|
+
const txn = typeof args.transaction_id === "string" ? args.transaction_id : undefined;
|
|
389
|
+
if (!txn)
|
|
390
|
+
return;
|
|
391
|
+
await wake.currentCall().subscribe(transactionStatus, { application: arg((0, config_1.resolveApplicationId)()), transaction: arg(txn) }, { ttl: exports.STATUS_WATCH_TTL, replay: CATCH_UP, reason: `Watching Didit transaction ${txn}` });
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
catch (err) {
|
|
397
|
+
console.error(`[didit-mcp] wakeshift: ${name} could not subscribe: ${err instanceof Error ? err.name : typeof err}`);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
// ── The watch tools ─────────────────────────────────────────────────
|
|
401
|
+
const toolDefinitions = [
|
|
402
|
+
{
|
|
403
|
+
name: "didit_session_watch",
|
|
404
|
+
description: "Watch an existing verification session, to wait for its decision without polling: you're woken when it reaches " +
|
|
405
|
+
"a final status (Approved, Declined, " +
|
|
406
|
+
`Expired, Abandoned), until ${exports.STATUS_WATCH_TTL.replace("d", " days")} pass with none. ` +
|
|
407
|
+
"didit_session_create already watches the sessions it creates. Returns the session's current status; read the " +
|
|
408
|
+
"decision with didit_session_get_decision.",
|
|
409
|
+
inputSchema: {
|
|
410
|
+
type: "object",
|
|
411
|
+
properties: { session_id: { type: "string", description: "Session UUID" } },
|
|
412
|
+
required: ["session_id"],
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: "didit_session_watch_reviews",
|
|
417
|
+
description: "Watch ONE application's manual-review queue: you're woken whenever one of its verification sessions goes to In " +
|
|
418
|
+
`Review, until ${exports.REVIEW_WATCH_TTL.replace("d", " days")} pass with none. Returns how many sessions are in review now.`,
|
|
419
|
+
inputSchema: { type: "object", properties: { ...orgapp_1.ORG_APP_PROPS } },
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
name: "didit_transaction_watch_reviews",
|
|
423
|
+
description: "Watch ONE application's flagged transactions: you're woken whenever one of its monitored transactions goes to " +
|
|
424
|
+
`IN_REVIEW, until ${exports.REVIEW_WATCH_TTL.replace("d", " days")} pass with none. didit_transaction_create already ` +
|
|
425
|
+
"watches the transactions it submits.",
|
|
426
|
+
inputSchema: { type: "object", properties: { ...orgapp_1.ORG_APP_PROPS } },
|
|
427
|
+
},
|
|
428
|
+
];
|
|
429
|
+
/**
|
|
430
|
+
* A watch tool's subscribe, after its access check: whether Wakeshift will wake the calling
|
|
431
|
+
* conversation (wakeConfirmed). When it won't, the subscription made (if any) is ended and the
|
|
432
|
+
* tool answers with what it read and watching false, as a read without Wakeshift would. A
|
|
433
|
+
* Wakeshift failure is logged and answers the same: the read already succeeded.
|
|
434
|
+
*/
|
|
435
|
+
async function watch(name, event, args, opts) {
|
|
436
|
+
const current = wake.currentCall();
|
|
437
|
+
let sub;
|
|
438
|
+
try {
|
|
439
|
+
sub = await current.subscribe(event, args, opts);
|
|
440
|
+
}
|
|
441
|
+
catch (err) {
|
|
442
|
+
console.error(`[didit-mcp] wakeshift: ${name} could not subscribe: ${err instanceof Error ? err.name : typeof err}`);
|
|
443
|
+
return false;
|
|
444
|
+
}
|
|
445
|
+
if (wakeConfirmed(sub))
|
|
446
|
+
return true;
|
|
447
|
+
if (sub.state === "created" || sub.state === "renewed" || sub.state === "native") {
|
|
448
|
+
await current.unsubscribe(event, args).catch((err) => {
|
|
449
|
+
console.error(`[didit-mcp] wakeshift: ${name} could not end a watch that won't wake: ${err instanceof Error ? err.name : typeof err}`);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
async function call(name, args) {
|
|
455
|
+
switch (name) {
|
|
456
|
+
case "didit_session_watch": {
|
|
457
|
+
const sessionId = String(args.session_id ?? "");
|
|
458
|
+
// The access check: the caller's own credential must read the session.
|
|
459
|
+
// Only its status is returned; the decision stays unread by the agent.
|
|
460
|
+
const decision = await sessions.getSessionDecision(sessionId);
|
|
461
|
+
const watching = await watch(name, sessionStatus, { session: arg(sessionId) }, {
|
|
462
|
+
ttl: exports.STATUS_WATCH_TTL,
|
|
463
|
+
replay: READ_CATCH_UP,
|
|
464
|
+
reason: `Watching Didit session ${sessionId}`,
|
|
465
|
+
});
|
|
466
|
+
return { session_id: sessionId, status: typeof decision?.status === "string" ? decision.status : null, watching };
|
|
467
|
+
}
|
|
468
|
+
case "didit_session_watch_reviews": {
|
|
469
|
+
// The access check: the caller's own credential must list the application's sessions.
|
|
470
|
+
const page = await sessions.listSessions({ status: "In Review", limit: "1" });
|
|
471
|
+
const application = (0, config_1.resolveApplicationId)();
|
|
472
|
+
const watching = await watch(name, sessionInReview, { application: arg(application) }, {
|
|
473
|
+
ttl: exports.REVIEW_WATCH_TTL,
|
|
474
|
+
replay: READ_CATCH_UP,
|
|
475
|
+
reason: `Watching the review queue of Didit application ${application}`,
|
|
476
|
+
});
|
|
477
|
+
return { application_id: application, in_review_now: page?.total_count ?? page?.count ?? null, watching };
|
|
478
|
+
}
|
|
479
|
+
case "didit_transaction_watch_reviews": {
|
|
480
|
+
// The access check: the caller's own credential must list the application's transactions.
|
|
481
|
+
await transactions.listTransactions({ limit: "1" });
|
|
482
|
+
const application = (0, config_1.resolveApplicationId)();
|
|
483
|
+
const watching = await watch(name, transactionInReview, { application: arg(application) }, {
|
|
484
|
+
ttl: exports.REVIEW_WATCH_TTL,
|
|
485
|
+
replay: READ_CATCH_UP,
|
|
486
|
+
reason: `Watching flagged transactions of Didit application ${application}`,
|
|
487
|
+
});
|
|
488
|
+
return { application_id: application, watching };
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
492
|
+
}
|
|
493
|
+
const hooks = {
|
|
494
|
+
toolDefinitions,
|
|
495
|
+
// Didit's descriptions stay as written: whether a call can be woken depends on the agent,
|
|
496
|
+
// which a description can't know (Wakeshift adds its own sentence to tools that subscribe).
|
|
497
|
+
describe: (_name, description) => description,
|
|
498
|
+
handles: (name) => exports.WAKESHIFT_TOOL_NAMES.includes(name),
|
|
499
|
+
readOnly: (name) => exports.WAKESHIFT_TOOL_NAMES.includes(name),
|
|
500
|
+
permissionAs: (name) => (Object.prototype.hasOwnProperty.call(PERMISSION_AS, name) ? PERMISSION_AS[name] : undefined),
|
|
501
|
+
call,
|
|
502
|
+
after,
|
|
503
|
+
attach(server) {
|
|
504
|
+
wake.attach(server, {
|
|
505
|
+
wrap,
|
|
506
|
+
identify: (extra) => {
|
|
507
|
+
const user = userIdFor(extra?.authInfo);
|
|
508
|
+
return user ? { user } : undefined;
|
|
509
|
+
},
|
|
510
|
+
});
|
|
511
|
+
},
|
|
512
|
+
};
|
|
513
|
+
return {
|
|
514
|
+
wake,
|
|
515
|
+
hooks,
|
|
516
|
+
routes,
|
|
517
|
+
events: { sessionStatus, sessionInReview, deliveryLogged, importFinished, transactionStatus, transactionInReview },
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
/** The production client: WAKESHIFT_KEY from the environment. */
|
|
521
|
+
function createWakeshiftFromEnv() {
|
|
522
|
+
return createDiditWakeshift(new sdk_1.Wakeshift());
|
|
523
|
+
}
|
|
524
|
+
//# sourceMappingURL=wakeshift.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wakeshift.js","sourceRoot":"","sources":["../src/wakeshift.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2GH,8BAUC;AAOD,wBAEC;AA2BD,sCAEC;AAGD,oDAkYC;AAKD,wDAEC;AAriBD,6CAAyC;AAEzC,wCAAsI;AACtI,6BAAwB;AACxB,2DAA6C;AAC7C,mEAAqD;AACrD,qCAAgD;AAChD,qCAAyC;AACzC,6DAAqD;AACrD,iDAAoE;AACpE,qDAS0B;AAE1B,8FAA8F;AACjF,QAAA,gBAAgB,GAAG,IAAI,CAAC;AACrC,uFAAuF;AAC1E,QAAA,kBAAkB,GAAG,IAAI,CAAC;AACvC,gGAAgG;AACnF,QAAA,gBAAgB,GAAG,IAAI,CAAC;AACrC;;;;GAIG;AACH,MAAM,QAAQ,GAAG,KAAK,CAAC;AACvB,6FAA6F;AAC7F,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B;;;;GAIG;AACH,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AACxG,sFAAsF;AACtF,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;AAElF;;;GAGG;AACU,QAAA,oBAAoB,GAAG,CAAC,qBAAqB,EAAE,6BAA6B,EAAE,iCAAiC,CAAC,CAAC;AAE9H;;;;GAIG;AACH,MAAM,aAAa,GAAqC;IACtD,mBAA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AE,CAAC,IAAI,EAAE,EAAE,CAAC,4BAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC;QACvD,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACrH,IAAI;QACJ,KAAK;QACL,MAAM,CAAC,MAAM;YACX,IAAI,CAAC,MAAM,CAAC,MAAa,EAAE;gBACzB,IAAI;gBACJ,QAAQ,EAAE,CAAC,KAAU,EAAE,EAAE;oBACvB,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;oBACxC,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;gBACrC,CAAC;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,KAAK;QACL,MAAM;QACN,MAAM,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAE;KACnH,CAAC;AACJ,CAAC;AAID,iEAAiE;AACjE,SAAgB,sBAAsB;IACpC,OAAO,oBAAoB,CAAC,IAAI,eAAS,EAAE,CAAC,CAAC;AAC/C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@didit-protocol/mcp-server",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.65",
|
|
4
4
|
"description": "Didit MCP Server - AI agent integration for identity verification APIs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -36,13 +36,15 @@
|
|
|
36
36
|
"compression": "^1.8.2",
|
|
37
37
|
"express": "^5.0.0",
|
|
38
38
|
"jose": "^6.0.0",
|
|
39
|
-
"on-headers": "^1.1.0"
|
|
39
|
+
"on-headers": "^1.1.0",
|
|
40
|
+
"zod": "^4.3.6"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@types/compression": "^1.8.1",
|
|
43
44
|
"@types/express": "^5.0.0",
|
|
44
45
|
"@types/node": "^20.0.0",
|
|
45
46
|
"@types/on-headers": "^1.0.4",
|
|
47
|
+
"@wakeshift/sdk": "0.11.1",
|
|
46
48
|
"ts-node": "^10.9.0",
|
|
47
49
|
"typescript": "^5.3.0"
|
|
48
50
|
},
|