@didit-protocol/mcp-server 4.0.0 → 5.1.34
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/LICENSE +21 -0
- package/README.md +583 -227
- package/dist/audit-log.d.ts +22 -0
- package/dist/audit-log.d.ts.map +1 -0
- package/dist/audit-log.js +77 -0
- package/dist/audit-log.js.map +1 -0
- package/dist/auth/introspection-verifier.d.ts +16 -0
- package/dist/auth/introspection-verifier.d.ts.map +1 -0
- package/dist/auth/introspection-verifier.js +77 -0
- package/dist/auth/introspection-verifier.js.map +1 -0
- package/dist/auth/verifier.d.ts +19 -0
- package/dist/auth/verifier.d.ts.map +1 -0
- package/dist/auth/verifier.js +88 -0
- package/dist/auth/verifier.js.map +1 -0
- package/dist/blank-args.d.ts +10 -0
- package/dist/blank-args.d.ts.map +1 -0
- package/dist/blank-args.js +34 -0
- package/dist/blank-args.js.map +1 -0
- package/dist/chatgpt-app.d.ts +44 -0
- package/dist/chatgpt-app.d.ts.map +1 -0
- package/dist/chatgpt-app.js +52 -0
- package/dist/chatgpt-app.js.map +1 -0
- package/dist/config.d.ts +93 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +198 -27
- package/dist/config.js.map +1 -1
- package/dist/dates.d.ts +2 -0
- package/dist/dates.d.ts.map +1 -0
- package/dist/dates.js +23 -0
- package/dist/dates.js.map +1 -0
- package/dist/feature-config-schema.d.ts +66 -0
- package/dist/feature-config-schema.d.ts.map +1 -0
- package/dist/feature-config-schema.js +192 -0
- package/dist/feature-config-schema.js.map +1 -0
- package/dist/http.d.ts +4 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +230 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2397 -510
- package/dist/index.js.map +1 -1
- package/dist/internal-tools.d.ts +17 -0
- package/dist/internal-tools.d.ts.map +1 -0
- package/dist/internal-tools.js +26 -0
- package/dist/internal-tools.js.map +1 -0
- package/dist/mcp-modern.d.ts +36 -0
- package/dist/mcp-modern.d.ts.map +1 -0
- package/dist/mcp-modern.js +152 -0
- package/dist/mcp-modern.js.map +1 -0
- package/dist/orgapp.d.ts +34 -0
- package/dist/orgapp.d.ts.map +1 -0
- package/dist/orgapp.js +93 -0
- package/dist/orgapp.js.map +1 -0
- package/dist/permissions.d.ts +24 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +210 -0
- package/dist/permissions.js.map +1 -0
- package/dist/privileged-tools.d.ts +14 -0
- package/dist/privileged-tools.d.ts.map +1 -0
- package/dist/privileged-tools.js +21 -0
- package/dist/privileged-tools.js.map +1 -0
- package/dist/schema/feature-config-schema.json +4446 -0
- package/dist/security.d.ts +168 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +858 -0
- package/dist/security.js.map +1 -0
- package/dist/session-pdf-download.d.ts +8 -0
- package/dist/session-pdf-download.d.ts.map +1 -0
- package/dist/session-pdf-download.js +91 -0
- package/dist/session-pdf-download.js.map +1 -0
- package/dist/tools/analytics.d.ts +13 -0
- package/dist/tools/analytics.d.ts.map +1 -0
- package/dist/tools/analytics.js +171 -0
- package/dist/tools/analytics.js.map +1 -0
- package/dist/tools/auth.d.ts +10 -3
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +68 -11
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/billing.d.ts +2 -2
- package/dist/tools/billing.d.ts.map +1 -1
- package/dist/tools/billing.js +37 -4
- package/dist/tools/billing.js.map +1 -1
- package/dist/tools/blocklist.d.ts +5 -0
- package/dist/tools/blocklist.d.ts.map +1 -0
- package/dist/tools/blocklist.js +21 -0
- package/dist/tools/blocklist.js.map +1 -0
- package/dist/tools/businesses.d.ts +1 -1
- package/dist/tools/businesses.d.ts.map +1 -1
- package/dist/tools/businesses.js +31 -9
- package/dist/tools/businesses.js.map +1 -1
- package/dist/tools/cases.d.ts +6 -0
- package/dist/tools/cases.d.ts.map +1 -0
- package/dist/tools/cases.js +63 -0
- package/dist/tools/cases.js.map +1 -0
- package/dist/tools/compliance.d.ts +8 -0
- package/dist/tools/compliance.d.ts.map +1 -0
- package/dist/tools/compliance.js +95 -0
- package/dist/tools/compliance.js.map +1 -0
- package/dist/tools/context.d.ts +2 -0
- package/dist/tools/context.d.ts.map +1 -0
- package/dist/tools/context.js +37 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/customization.d.ts +10 -4
- package/dist/tools/customization.d.ts.map +1 -1
- package/dist/tools/customization.js +21 -11
- package/dist/tools/customization.js.map +1 -1
- package/dist/tools/feature-config.d.ts +53 -0
- package/dist/tools/feature-config.d.ts.map +1 -0
- package/dist/tools/feature-config.js +432 -0
- package/dist/tools/feature-config.js.map +1 -0
- package/dist/tools/lists.d.ts.map +1 -1
- package/dist/tools/lists.js +17 -16
- package/dist/tools/lists.js.map +1 -1
- package/dist/tools/members.d.ts +7 -0
- package/dist/tools/members.d.ts.map +1 -0
- package/dist/tools/members.js +60 -0
- package/dist/tools/members.js.map +1 -0
- package/dist/tools/observability.d.ts +4 -0
- package/dist/tools/observability.d.ts.map +1 -0
- package/dist/tools/observability.js +17 -0
- package/dist/tools/observability.js.map +1 -0
- package/dist/tools/questionnaires.d.ts +62 -3
- package/dist/tools/questionnaires.d.ts.map +1 -1
- package/dist/tools/questionnaires.js +131 -6
- package/dist/tools/questionnaires.js.map +1 -1
- package/dist/tools/reports.d.ts +5 -0
- package/dist/tools/reports.d.ts.map +1 -0
- package/dist/tools/reports.js +89 -0
- package/dist/tools/reports.js.map +1 -0
- package/dist/tools/search.d.ts +30 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +317 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/session-explain-levers.d.ts +17 -0
- package/dist/tools/session-explain-levers.d.ts.map +1 -0
- package/dist/tools/session-explain-levers.js +139 -0
- package/dist/tools/session-explain-levers.js.map +1 -0
- package/dist/tools/session-explain.d.ts +3 -0
- package/dist/tools/session-explain.d.ts.map +1 -0
- package/dist/tools/session-explain.js +180 -0
- package/dist/tools/session-explain.js.map +1 -0
- package/dist/tools/sessions.d.ts +9 -2
- package/dist/tools/sessions.d.ts.map +1 -1
- package/dist/tools/sessions.js +131 -22
- package/dist/tools/sessions.js.map +1 -1
- package/dist/tools/settings.d.ts +15 -1
- package/dist/tools/settings.d.ts.map +1 -1
- package/dist/tools/settings.js +143 -6
- package/dist/tools/settings.js.map +1 -1
- package/dist/tools/standalone.d.ts +7 -6
- package/dist/tools/standalone.d.ts.map +1 -1
- package/dist/tools/standalone.js +41 -26
- package/dist/tools/standalone.js.map +1 -1
- package/dist/tools/transactions.d.ts +9 -0
- package/dist/tools/transactions.d.ts.map +1 -1
- package/dist/tools/transactions.js +77 -4
- package/dist/tools/transactions.js.map +1 -1
- package/dist/tools/users.d.ts +1 -1
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +30 -9
- package/dist/tools/users.js.map +1 -1
- package/dist/tools/webhooks.d.ts.map +1 -1
- package/dist/tools/webhooks.js +22 -5
- package/dist/tools/webhooks.js.map +1 -1
- package/dist/tools/workflow-graph.d.ts +65 -0
- package/dist/tools/workflow-graph.d.ts.map +1 -0
- package/dist/tools/workflow-graph.js +686 -0
- package/dist/tools/workflow-graph.js.map +1 -0
- package/package.json +23 -6
package/dist/config.js
CHANGED
|
@@ -1,31 +1,160 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.requestContext = exports.MCP_SCOPES_SUPPORTED = exports.DIDIT_OIDC_REGISTRATION_URL = exports.DIDIT_OIDC_TOKEN_URL = exports.DIDIT_OIDC_AUTHORIZE_URL = exports.DIDIT_JWKS_URL = exports.DIDIT_OIDC_DISCOVERY_URL = exports.DIDIT_AUTH_ISSUER = exports.MCP_AUTHORIZATION_SERVER_ORIGIN = exports.MCP_DEFAULT_APP = exports.MCP_PUBLIC_DISCOVERY = exports.MCP_DEFAULT_ORG = exports.MCP_OAUTH_INTROSPECT_URL = exports.MCP_TOKEN_VERIFY_MODE = exports.MCP_OAUTH_CLIENT_SECRET = exports.MCP_OAUTH_CLIENT_ID = exports.MCP_RESOURCE_URI = exports.MCP_PORT = exports.DIDIT_API_BASE_URL = exports.DIDIT_AUTH_BASE_URL = exports.SERVER_VERSION = void 0;
|
|
4
|
+
exports.permissionMode = permissionMode;
|
|
5
|
+
exports.resolveOrganizationId = resolveOrganizationId;
|
|
6
|
+
exports.resolveApplicationId = resolveApplicationId;
|
|
7
|
+
exports.orgAppPath = orgAppPath;
|
|
8
|
+
exports.orgPath = orgPath;
|
|
9
|
+
exports.userAgent = userAgent;
|
|
4
10
|
exports.getHeaders = getHeaders;
|
|
5
|
-
exports.
|
|
11
|
+
exports.getMultipartHeaders = getMultipartHeaders;
|
|
6
12
|
exports.getAuthHeaders = getAuthHeaders;
|
|
7
13
|
exports.apiRequest = apiRequest;
|
|
8
14
|
exports.buildFormData = buildFormData;
|
|
9
|
-
|
|
10
|
-
const
|
|
15
|
+
exports.stripRoutingIds = stripRoutingIds;
|
|
16
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
17
|
+
const security_1 = require("./security");
|
|
18
|
+
// Single source of truth for the version: package.json (falls back if unreadable).
|
|
19
|
+
function readPackageVersion() {
|
|
20
|
+
try {
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
22
|
+
return require("../package.json").version || "5.0.0";
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return "5.0.0";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.SERVER_VERSION = readPackageVersion();
|
|
29
|
+
/**
|
|
30
|
+
* Per-tool permission pre-check (permissions.ts): `shadow` (default) only records what
|
|
31
|
+
* WOULD be denied on the audit line, `enforce` refuses the call and hides the tool from
|
|
32
|
+
* tools/list, `off` disables the check. Read per call so a deployment can flip it by env.
|
|
33
|
+
*/
|
|
34
|
+
function permissionMode() {
|
|
35
|
+
const mode = process.env.MCP_PERMISSION_MODE;
|
|
36
|
+
return mode === "enforce" || mode === "off" ? mode : "shadow";
|
|
37
|
+
}
|
|
11
38
|
exports.DIDIT_AUTH_BASE_URL = process.env.DIDIT_AUTH_BASE_URL || "https://apx.didit.me/auth/v2";
|
|
12
39
|
exports.DIDIT_API_BASE_URL = process.env.DIDIT_API_BASE_URL || "https://verification.didit.me/v3";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
40
|
+
// ── Hosted (HTTP/OAuth) mode configuration ─────────────────────────────────
|
|
41
|
+
// Only used by src/http.ts. The defaults target Didit production; every value is
|
|
42
|
+
// overridable per environment. service-didit-auth is the OAuth Authorization Server.
|
|
43
|
+
exports.MCP_PORT = parseInt(process.env.MCP_PORT || "3000", 10);
|
|
44
|
+
// The RFC 8707 / RFC 9728 resource identifier for this MCP server.
|
|
45
|
+
// It must match the actual Streamable HTTP transport endpoint.
|
|
46
|
+
exports.MCP_RESOURCE_URI = process.env.MCP_RESOURCE_URI || "https://mcp.didit.me/mcp";
|
|
47
|
+
// The dedicated OAuth client registered in service-didit-auth for the MCP.
|
|
48
|
+
exports.MCP_OAUTH_CLIENT_ID = process.env.MCP_OAUTH_CLIENT_ID || "";
|
|
49
|
+
// Client secret used for RFC 7662 token introspection (Basic auth to the auth service).
|
|
50
|
+
exports.MCP_OAUTH_CLIENT_SECRET = process.env.MCP_OAUTH_CLIENT_SECRET || "";
|
|
51
|
+
// How the resource server validates the caller's access token:
|
|
52
|
+
// "introspection" (default) — RFC 7662 call to the auth service. Required because
|
|
53
|
+
// service-didit-auth's OIDC code flow issues OPAQUE access tokens (not JWTs).
|
|
54
|
+
// "jwks" — local JWT signature validation against DIDIT_JWKS_URL (only correct if
|
|
55
|
+
// the auth service is configured to mint JWT access tokens for this client).
|
|
56
|
+
exports.MCP_TOKEN_VERIFY_MODE = (process.env.MCP_TOKEN_VERIFY_MODE || "introspection").toLowerCase();
|
|
57
|
+
exports.MCP_OAUTH_INTROSPECT_URL = process.env.MCP_OAUTH_INTROSPECT_URL || "https://apx.didit.me/auth/v2/introspect/";
|
|
58
|
+
// Optional: for single-org MCP deployments, the org to scope introspection to.
|
|
59
|
+
exports.MCP_DEFAULT_ORG = process.env.MCP_DEFAULT_ORG || "";
|
|
60
|
+
// "Mixed auth" (MCP 2026-07-28 + RFC 9728): serve the PROTOCOL-NEGOTIATION surface without a
|
|
61
|
+
// Bearer, and keep every tool behind OAuth exactly as before. `initialize`, its notification,
|
|
62
|
+
// and `server/discover` return only the server name, version, capabilities and supported
|
|
63
|
+
// protocol versions - none of which is private, and all of which a client must read BEFORE it
|
|
64
|
+
// can know how to authenticate. Several hosts (managed MCP hosting platforms, MCP directory crawlers)
|
|
65
|
+
// probe with `server/discover` before any OAuth dance and treat the 401 as a hard connection
|
|
66
|
+
// failure, so an all-or-nothing 401 makes the server undiscoverable to them.
|
|
67
|
+
//
|
|
68
|
+
// OFF by default: mcp.didit.me keeps answering 401 to every request, unchanged. Turn it on per
|
|
69
|
+
// deployment (a gateway-hosted copy, a directory listing) with MCP_PUBLIC_DISCOVERY=true.
|
|
70
|
+
// tools/list and tools/call are NEVER public under this flag - the catalog stays authenticated.
|
|
71
|
+
exports.MCP_PUBLIC_DISCOVERY = process.env.MCP_PUBLIC_DISCOVERY === "true";
|
|
72
|
+
// Optional: default application for single-app deployments (used when a tool call
|
|
73
|
+
// omits application_id and the user has no unambiguous default).
|
|
74
|
+
exports.MCP_DEFAULT_APP = process.env.MCP_DEFAULT_APP || "";
|
|
75
|
+
// Authorization Server = the Didit business console (it hosts the "log in + confirm"
|
|
76
|
+
// consent at /authorize and the token exchange at /api/auth/oauth-token, returning the
|
|
77
|
+
// user's Didit token). Token validation still goes to the auth service via introspection.
|
|
78
|
+
exports.MCP_AUTHORIZATION_SERVER_ORIGIN = process.env.MCP_AUTHORIZATION_SERVER_ORIGIN || "https://business.didit.me";
|
|
79
|
+
exports.DIDIT_AUTH_ISSUER = process.env.DIDIT_AUTH_ISSUER || exports.MCP_AUTHORIZATION_SERVER_ORIGIN;
|
|
80
|
+
exports.DIDIT_OIDC_DISCOVERY_URL = process.env.DIDIT_OIDC_DISCOVERY_URL || `${exports.MCP_AUTHORIZATION_SERVER_ORIGIN}/.well-known/oauth-authorization-server`;
|
|
81
|
+
exports.DIDIT_JWKS_URL = process.env.DIDIT_JWKS_URL || "https://apx.didit.me/auth/config/jwks/";
|
|
82
|
+
exports.DIDIT_OIDC_AUTHORIZE_URL = process.env.DIDIT_OIDC_AUTHORIZE_URL || `${exports.MCP_AUTHORIZATION_SERVER_ORIGIN}/authorize`;
|
|
83
|
+
exports.DIDIT_OIDC_TOKEN_URL = process.env.DIDIT_OIDC_TOKEN_URL || `${exports.MCP_AUTHORIZATION_SERVER_ORIGIN}/api/auth/oauth-token`;
|
|
84
|
+
exports.DIDIT_OIDC_REGISTRATION_URL = process.env.DIDIT_OIDC_REGISTRATION_URL || `${exports.MCP_AUTHORIZATION_SERVER_ORIGIN}/api/auth/oauth-register`;
|
|
85
|
+
// Scopes advertised in discovery metadata. These MUST match the scopes the Didit
|
|
86
|
+
// authorization server (business console) advertises and renders plain-language consent
|
|
87
|
+
// for — otherwise the consent screen shows "a permission Didit can't explain". The MCP
|
|
88
|
+
// acts as the user with management + verification access, so it requests those two scopes
|
|
89
|
+
// (NOT granular read:sessions/etc., which the console doesn't recognize). `didit:staff` is
|
|
90
|
+
// identity-only: the auth service issues it to staff users alone, and only a token carrying it
|
|
91
|
+
// introspects with `is_staff: true` — which is what opens the staff tools (see
|
|
92
|
+
// isPrivilegedCaller). Non-staff users simply never receive it.
|
|
93
|
+
exports.MCP_SCOPES_SUPPORTED = (process.env.MCP_SCOPES_SUPPORTED ||
|
|
94
|
+
"didit:management didit:verification didit:staff")
|
|
95
|
+
.split(/\s+/)
|
|
96
|
+
.filter(Boolean);
|
|
97
|
+
exports.requestContext = new node_async_hooks_1.AsyncLocalStorage();
|
|
98
|
+
function resolveOrganizationId(explicit) {
|
|
99
|
+
const org = explicit || exports.requestContext.getStore()?.organizationId || exports.MCP_DEFAULT_ORG;
|
|
100
|
+
if (!org) {
|
|
101
|
+
throw new Error("organization_id is required for this operation. Call didit_context_get to discover " +
|
|
102
|
+
"your organizations and applications in one call, then pass organization_id " +
|
|
103
|
+
"(or use a *_search tool to span all of them at once).");
|
|
104
|
+
}
|
|
105
|
+
return org;
|
|
106
|
+
}
|
|
107
|
+
function resolveApplicationId(explicit) {
|
|
108
|
+
const app = explicit || exports.requestContext.getStore()?.applicationId || exports.MCP_DEFAULT_APP;
|
|
109
|
+
if (!app) {
|
|
110
|
+
throw new Error("application_id is required for this operation. Call didit_context_get to list your " +
|
|
111
|
+
"applications, then pass application_id (or use a *_search tool to span all apps at once).");
|
|
20
112
|
}
|
|
21
|
-
return
|
|
113
|
+
return app;
|
|
114
|
+
}
|
|
115
|
+
/** `/organization/{org}/application/{app}{resource}` — org+app-scoped console path. */
|
|
116
|
+
function orgAppPath(resource, opts = {}) {
|
|
117
|
+
const org = resolveOrganizationId(opts.organizationId);
|
|
118
|
+
const app = resolveApplicationId(opts.applicationId);
|
|
119
|
+
return `/organization/${org}/application/${app}${resource}`;
|
|
22
120
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
121
|
+
/** `/organization/{org}{resource}` — org-only console path (e.g. billing). */
|
|
122
|
+
function orgPath(resource, opts = {}) {
|
|
123
|
+
return `/organization/${resolveOrganizationId(opts.organizationId)}${resource}`;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Auth headers for the Didit APIs. The MCP always authenticates as a Didit user via a
|
|
127
|
+
* Bearer access token (from the OAuth flow in hosted mode, or DIDIT_ACCESS_TOKEN in stdio
|
|
128
|
+
* mode). There is no API-key path — the user-scoped console endpoints reject x-api-key.
|
|
129
|
+
*/
|
|
130
|
+
function authHeaders() {
|
|
131
|
+
const ctx = exports.requestContext.getStore();
|
|
132
|
+
if (ctx?.accessToken) {
|
|
133
|
+
const headers = { Authorization: `Bearer ${ctx.accessToken}` };
|
|
134
|
+
// Tells the verification API which authorized org this request acts in
|
|
135
|
+
// (required for multi-org user tokens; harmless for single-org).
|
|
136
|
+
if (ctx.organizationId) {
|
|
137
|
+
headers["X-Didit-Organization-Id"] = ctx.organizationId;
|
|
138
|
+
}
|
|
139
|
+
return headers;
|
|
27
140
|
}
|
|
28
|
-
return
|
|
141
|
+
return {};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Identifies the MCP server (and the tool behind the request) to the backend. The
|
|
145
|
+
* backend's audit log stores the User-Agent, so every MCP-originated action shows up
|
|
146
|
+
* there attributed to its tool without any backend change.
|
|
147
|
+
*/
|
|
148
|
+
function userAgent() {
|
|
149
|
+
const tool = exports.requestContext.getStore()?.toolName;
|
|
150
|
+
return `didit-mcp-server/${exports.SERVER_VERSION}${tool ? ` tool/${tool}` : ""}`;
|
|
151
|
+
}
|
|
152
|
+
function getHeaders() {
|
|
153
|
+
return { "Content-Type": "application/json", ...authHeaders() };
|
|
154
|
+
}
|
|
155
|
+
function getMultipartHeaders() {
|
|
156
|
+
// Multipart calls: omit Content-Type so fetch sets the multipart boundary. Same Bearer auth.
|
|
157
|
+
return authHeaders();
|
|
29
158
|
}
|
|
30
159
|
function getAuthHeaders(accessToken) {
|
|
31
160
|
return {
|
|
@@ -48,8 +177,12 @@ async function apiRequest(path, opts = {}) {
|
|
|
48
177
|
url.searchParams.set(k, String(v));
|
|
49
178
|
}
|
|
50
179
|
}
|
|
51
|
-
const resolvedHeaders = headers ?? (form ?
|
|
52
|
-
const init = { method, headers: resolvedHeaders };
|
|
180
|
+
const resolvedHeaders = headers ?? (form ? getMultipartHeaders() : getHeaders());
|
|
181
|
+
const init = { method, headers: { "User-Agent": userAgent(), ...resolvedHeaders } };
|
|
182
|
+
if (opts.responseType === "pdf") {
|
|
183
|
+
init.redirect = "error";
|
|
184
|
+
init.signal = AbortSignal.timeout(60000);
|
|
185
|
+
}
|
|
53
186
|
if (form) {
|
|
54
187
|
init.body = form;
|
|
55
188
|
}
|
|
@@ -57,6 +190,16 @@ async function apiRequest(path, opts = {}) {
|
|
|
57
190
|
init.body = JSON.stringify(json);
|
|
58
191
|
}
|
|
59
192
|
const res = await fetch(url.toString(), init);
|
|
193
|
+
if (res.ok && opts.responseType === "pdf") {
|
|
194
|
+
if (res.headers.get("content-type")?.split(";")[0].trim().toLowerCase() !== "application/pdf") {
|
|
195
|
+
throw new Error("Didit did not return a PDF report.");
|
|
196
|
+
}
|
|
197
|
+
const bytes = Buffer.from(await res.arrayBuffer());
|
|
198
|
+
if (bytes.subarray(0, 5).toString("ascii") !== "%PDF-") {
|
|
199
|
+
throw new Error("Didit returned an invalid PDF report.");
|
|
200
|
+
}
|
|
201
|
+
return bytes;
|
|
202
|
+
}
|
|
60
203
|
if (res.status === 204)
|
|
61
204
|
return { success: true };
|
|
62
205
|
const text = await res.text();
|
|
@@ -70,22 +213,36 @@ async function apiRequest(path, opts = {}) {
|
|
|
70
213
|
}
|
|
71
214
|
}
|
|
72
215
|
if (!res.ok) {
|
|
73
|
-
const
|
|
74
|
-
throw new
|
|
216
|
+
const parsed = (0, security_1.parseErrorBody)(body);
|
|
217
|
+
throw new security_1.DiditError({
|
|
218
|
+
code: (0, security_1.statusToCode)(res.status),
|
|
219
|
+
message: parsed.message || `Request failed with status ${res.status}.`,
|
|
220
|
+
hint: (0, security_1.statusToHint)(res.status, body),
|
|
221
|
+
field: parsed.field,
|
|
222
|
+
allowed: parsed.allowed,
|
|
223
|
+
status: res.status,
|
|
224
|
+
});
|
|
75
225
|
}
|
|
76
226
|
return body;
|
|
77
227
|
}
|
|
78
228
|
/**
|
|
79
|
-
* Build a multipart/form-data body from file
|
|
80
|
-
* Shared by the standalone image endpoints and branding customization.
|
|
229
|
+
* Build a multipart/form-data body from file inputs and optional scalar fields.
|
|
230
|
+
* Shared by the standalone image endpoints and branding customization. Each
|
|
231
|
+
* file input is either a local absolute path (string — local/stdio runs) or a
|
|
232
|
+
* FileSource ({ path?, base64? }) so hosted callers can send file content
|
|
233
|
+
* inline. The record key doubles as the multipart field name and the
|
|
234
|
+
* error-message parameter stem.
|
|
81
235
|
*/
|
|
82
236
|
function buildFormData(files, scalars = {}) {
|
|
83
237
|
const form = new FormData();
|
|
84
|
-
for (const [key,
|
|
85
|
-
if (!
|
|
238
|
+
for (const [key, source] of Object.entries(files)) {
|
|
239
|
+
if (!source)
|
|
240
|
+
continue;
|
|
241
|
+
const normalized = typeof source === "string" ? { path: source } : source;
|
|
242
|
+
const resolved = (0, security_1.resolveFileSource)(normalized, key);
|
|
243
|
+
if (!resolved)
|
|
86
244
|
continue;
|
|
87
|
-
|
|
88
|
-
form.append(key, new Blob([buffer]), (0, path_1.basename)(filePath));
|
|
245
|
+
form.append(key, new Blob([resolved.buffer]), resolved.filename);
|
|
89
246
|
}
|
|
90
247
|
for (const [key, value] of Object.entries(scalars)) {
|
|
91
248
|
if (value === undefined || value === null)
|
|
@@ -94,4 +251,18 @@ function buildFormData(files, scalars = {}) {
|
|
|
94
251
|
}
|
|
95
252
|
return form;
|
|
96
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* Drop the routing ids from a tool call's arguments. They are read into
|
|
256
|
+
* `requestContext` by the CallTool dispatcher before the handler runs, so by
|
|
257
|
+
* the time a handler sees its args they are pure payload — which is what lets
|
|
258
|
+
* every app-scoped tool ADVERTISE `organization_id` / `application_id`
|
|
259
|
+
* (ORG_APP_PROPS) without the handlers that forward their args verbatim
|
|
260
|
+
* leaking them into a query string or a POST body.
|
|
261
|
+
*/
|
|
262
|
+
function stripRoutingIds(args) {
|
|
263
|
+
if (!args || typeof args !== "object")
|
|
264
|
+
return args;
|
|
265
|
+
const { organization_id: _org, application_id: _app, ...rest } = args;
|
|
266
|
+
return rest;
|
|
267
|
+
}
|
|
97
268
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAoBA,wCAIC;AA2GD,sDAUC;AAED,oDASC;AAGD,gCAIC;AAGD,0BAEC;AA0BD,8BAIC;AAED,gCAEC;AAED,kDAGC;AAED,wCAKC;AAwBD,gCA4DC;AAUD,sCAiBC;AAUD,0CAKC;AAhVD,uDAAqD;AACrD,yCAAuG;AAGvG,mFAAmF;AACnF,SAAS,kBAAkB;IACzB,IAAI,CAAC;QACH,8DAA8D;QAC9D,OAAO,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AACY,QAAA,cAAc,GAAG,kBAAkB,EAAE,CAAC;AAEnD;;;;GAIG;AACH,SAAgB,cAAc;IAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IAE7C,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChE,CAAC;AAEY,QAAA,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,8BAA8B,CAAC;AACxF,QAAA,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,kCAAkC,CAAC;AAEvG,8EAA8E;AAC9E,iFAAiF;AACjF,qFAAqF;AACxE,QAAA,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;AACrE,mEAAmE;AACnE,+DAA+D;AAClD,QAAA,gBAAgB,GAA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IACnE,CAAC;IACD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QACpD,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,IAAa;IAC3C,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAiB,CAAC;IAChE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,IAA+B,CAAC;IAEjG,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/dates.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../src/dates.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAalF"}
|
package/dist/dates.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyRelativeWindow = applyRelativeWindow;
|
|
4
|
+
// Relative-date convenience. Tools accept `last_n_days` so callers can say "last 15 days"
|
|
5
|
+
// without computing ISO dates. Returns a new params object with date_from/date_to filled
|
|
6
|
+
// (explicit date_from/date_to always win) and last_n_days stripped.
|
|
7
|
+
function applyRelativeWindow(args) {
|
|
8
|
+
const { last_n_days, ...rest } = args;
|
|
9
|
+
if (last_n_days === undefined || last_n_days === null)
|
|
10
|
+
return rest;
|
|
11
|
+
const n = Number(last_n_days);
|
|
12
|
+
if (!Number.isFinite(n) || n <= 0)
|
|
13
|
+
return rest;
|
|
14
|
+
const now = new Date();
|
|
15
|
+
const toIso = (d) => d.toISOString().slice(0, 10); // YYYY-MM-DD
|
|
16
|
+
const from = new Date(now.getTime() - n * 86400000);
|
|
17
|
+
return {
|
|
18
|
+
...rest,
|
|
19
|
+
date_from: rest.date_from ?? toIso(from),
|
|
20
|
+
date_to: rest.date_to ?? toIso(now),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=dates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates.js","sourceRoot":"","sources":["../src/dates.ts"],"names":[],"mappings":";;AAGA,kDAaC;AAhBD,0FAA0F;AAC1F,yFAAyF;AACzF,oEAAoE;AACpE,SAAgB,mBAAmB,CAAC,IAAyB;IAC3D,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IACtC,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnE,MAAM,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/C,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,KAAK,GAAG,CAAC,CAAO,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa;IACtE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,QAAU,CAAC,CAAC;IACtD,OAAO;QACL,GAAG,IAAI;QACP,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC;QACxC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export interface FeatureConfigField {
|
|
2
|
+
type: string;
|
|
3
|
+
required: boolean;
|
|
4
|
+
nullable: boolean;
|
|
5
|
+
description?: string;
|
|
6
|
+
shape?: string;
|
|
7
|
+
example?: unknown;
|
|
8
|
+
enum?: string[];
|
|
9
|
+
minimum?: number;
|
|
10
|
+
maximum?: number;
|
|
11
|
+
default?: unknown;
|
|
12
|
+
items?: FeatureConfigField & {
|
|
13
|
+
fields?: Record<string, FeatureConfigField>;
|
|
14
|
+
};
|
|
15
|
+
fields?: Record<string, FeatureConfigField>;
|
|
16
|
+
}
|
|
17
|
+
export interface FeatureConfigEntry {
|
|
18
|
+
serializer: string;
|
|
19
|
+
description: string;
|
|
20
|
+
notes?: string;
|
|
21
|
+
fields: Record<string, FeatureConfigField>;
|
|
22
|
+
}
|
|
23
|
+
export interface FeatureConfigSchema {
|
|
24
|
+
schema_version: number;
|
|
25
|
+
source: string;
|
|
26
|
+
checksum: string;
|
|
27
|
+
value_kinds: Record<string, string[]>;
|
|
28
|
+
features: Record<string, FeatureConfigEntry>;
|
|
29
|
+
}
|
|
30
|
+
export declare const FEATURE_CONFIG_SCHEMA: FeatureConfigSchema;
|
|
31
|
+
/** What the nightly drift check compares against the deployed backend. */
|
|
32
|
+
export declare const FEATURE_CONFIG_CHECKSUM: string;
|
|
33
|
+
/** Every feature a workflow node may run, from the contract - never a literal. */
|
|
34
|
+
export declare const WORKFLOW_FEATURES: string[];
|
|
35
|
+
/** The config keys one feature accepts. */
|
|
36
|
+
export declare function configKeys(feature: string): string[];
|
|
37
|
+
/** Every `FEATURE.key` pair in the contract - the set the contract test walks. */
|
|
38
|
+
export declare function allConfigKeys(): string[];
|
|
39
|
+
/**
|
|
40
|
+
* One feature's keys, in full but compressed.
|
|
41
|
+
*
|
|
42
|
+
* Every key is listed - a key an agent cannot see is a key it cannot set, which
|
|
43
|
+
* is the whole of an internal issue - but the repetition is squeezed out: shaped JSON
|
|
44
|
+
* blobs get their shape and an example, keys sharing a closed vocabulary are
|
|
45
|
+
* grouped under it once, and plain numeric/flag keys are listed with their
|
|
46
|
+
* bounds. Meaning-prose stays in the artifact and is one
|
|
47
|
+
* `didit_workflow_get_feature_config_schema` call away.
|
|
48
|
+
*/
|
|
49
|
+
export declare function renderFeatureDetail(feature: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* The generated block the workflow tool descriptions embed. Covers EVERY key of
|
|
52
|
+
* EVERY feature; the artifact's per-key prose is a tool call away.
|
|
53
|
+
*/
|
|
54
|
+
export declare function renderToolSchemaReference(): string;
|
|
55
|
+
/**
|
|
56
|
+
* The compact variant carried by the SIMPLE workflow tools (`features[].config`).
|
|
57
|
+
*
|
|
58
|
+
* Those tools build a linear graph and are the wrong place for a full config
|
|
59
|
+
* reference, so this names every feature and spells out only the keys whose
|
|
60
|
+
* value is a JSON shape no agent can invent - the rest is one
|
|
61
|
+
* `didit_workflow_get_feature_config_schema` call away.
|
|
62
|
+
*/
|
|
63
|
+
export declare function renderFeatureItemReference(): string;
|
|
64
|
+
/** The per-feature reference the README carries, generated so the two cannot disagree. */
|
|
65
|
+
export declare function renderMarkdownReference(): string;
|
|
66
|
+
//# sourceMappingURL=feature-config-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-config-schema.d.ts","sourceRoot":"","sources":["../src/feature-config-schema.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,E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AM,CA8B3D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAQlD;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAgBnD;AAED,0FAA0F;AAC1F,wBAAgB,uBAAuB,IAAI,MAAM,CA+BhD"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The feature-config contract, as published by the backend.
|
|
3
|
+
//
|
|
4
|
+
// `schema/feature-config-schema.json` is a byte-for-byte copy of
|
|
5
|
+
// `service-didit-verification/src/applications/config/feature_config_schema.json`,
|
|
6
|
+
// which that repo generates from `FEATURE_CONFIG_SERIALIZERS` - the serializers
|
|
7
|
+
// that actually validate a workflow save. Nothing here is hand-written: this
|
|
8
|
+
// module only RENDERS the artifact into the prose our tool schemas advertise.
|
|
9
|
+
//
|
|
10
|
+
// It exists because the alternative failed. The workflow tool descriptions used
|
|
11
|
+
// to carry a hand-maintained schema note, and DATABASE_VALIDATION never made it
|
|
12
|
+
// in: an agent asked for "a Database Validation workflow for Brazil" produced a
|
|
13
|
+
// node with no countries selected, the API accepted the config and threw the
|
|
14
|
+
// unknown keys away, and nothing anywhere went red. Every key an
|
|
15
|
+
// agent can set now comes from the artifact, and `test/feature-config-contract.test.mjs`
|
|
16
|
+
// fails if a single one stops being advertised.
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.WORKFLOW_FEATURES = exports.FEATURE_CONFIG_CHECKSUM = exports.FEATURE_CONFIG_SCHEMA = void 0;
|
|
22
|
+
exports.configKeys = configKeys;
|
|
23
|
+
exports.allConfigKeys = allConfigKeys;
|
|
24
|
+
exports.renderFeatureDetail = renderFeatureDetail;
|
|
25
|
+
exports.renderToolSchemaReference = renderToolSchemaReference;
|
|
26
|
+
exports.renderFeatureItemReference = renderFeatureItemReference;
|
|
27
|
+
exports.renderMarkdownReference = renderMarkdownReference;
|
|
28
|
+
const feature_config_schema_json_1 = __importDefault(require("./schema/feature-config-schema.json"));
|
|
29
|
+
exports.FEATURE_CONFIG_SCHEMA = feature_config_schema_json_1.default;
|
|
30
|
+
/** What the nightly drift check compares against the deployed backend. */
|
|
31
|
+
exports.FEATURE_CONFIG_CHECKSUM = exports.FEATURE_CONFIG_SCHEMA.checksum;
|
|
32
|
+
/** Every feature a workflow node may run, from the contract - never a literal. */
|
|
33
|
+
exports.WORKFLOW_FEATURES = Object.keys(exports.FEATURE_CONFIG_SCHEMA.features).sort();
|
|
34
|
+
/** The config keys one feature accepts. */
|
|
35
|
+
function configKeys(feature) {
|
|
36
|
+
const entry = exports.FEATURE_CONFIG_SCHEMA.features[feature];
|
|
37
|
+
return entry ? Object.keys(entry.fields).sort() : [];
|
|
38
|
+
}
|
|
39
|
+
/** Every `FEATURE.key` pair in the contract - the set the contract test walks. */
|
|
40
|
+
function allConfigKeys() {
|
|
41
|
+
return exports.WORKFLOW_FEATURES.flatMap((feature) => configKeys(feature).map((key) => `${feature}.${key}`));
|
|
42
|
+
}
|
|
43
|
+
// `status_rules` is on every feature and is documented once, on the graph
|
|
44
|
+
// schema itself, rather than repeated sixteen times.
|
|
45
|
+
const UNIVERSAL_KEYS = new Set(["status_rules"]);
|
|
46
|
+
function isInteresting(field) {
|
|
47
|
+
// A key an agent cannot infer from its name: a JSON blob with a shape, or a
|
|
48
|
+
// value with a closed vocabulary. Numeric thresholds and booleans read fine
|
|
49
|
+
// from the name plus their bounds.
|
|
50
|
+
return Boolean(field.shape) || Boolean(field.enum);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A closed vocabulary, in one canonical order.
|
|
54
|
+
*
|
|
55
|
+
* The artifact preserves each serializer's own declaration order, so the same
|
|
56
|
+
* three verdicts arrive as both DECLINE|REVIEW|NO_ACTION and
|
|
57
|
+
* NO_ACTION|REVIEW|DECLINE. Rendering them apart would list one vocabulary
|
|
58
|
+
* twice and read as two different contracts.
|
|
59
|
+
*/
|
|
60
|
+
function canonicalVocabulary(values) {
|
|
61
|
+
const sorted = [...values].sort();
|
|
62
|
+
for (const known of Object.values(exports.FEATURE_CONFIG_SCHEMA.value_kinds)) {
|
|
63
|
+
if (known.length === values.length && [...known].sort().every((v, i) => v === sorted[i])) {
|
|
64
|
+
return known.map((v) => `'${v}'`).join("|");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return sorted.map((v) => `'${v}'`).join("|");
|
|
68
|
+
}
|
|
69
|
+
function renderConstraint(field) {
|
|
70
|
+
if (field.shape)
|
|
71
|
+
return field.shape;
|
|
72
|
+
if (field.enum)
|
|
73
|
+
return canonicalVocabulary(field.enum);
|
|
74
|
+
const bounds = [];
|
|
75
|
+
if (field.minimum !== undefined)
|
|
76
|
+
bounds.push(`>=${field.minimum}`);
|
|
77
|
+
if (field.maximum !== undefined)
|
|
78
|
+
bounds.push(`<=${field.maximum}`);
|
|
79
|
+
return bounds.length ? `${field.type} ${bounds.join(" ")}` : field.type;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* One feature's keys, in full but compressed.
|
|
83
|
+
*
|
|
84
|
+
* Every key is listed - a key an agent cannot see is a key it cannot set, which
|
|
85
|
+
* is the whole of an internal issue - but the repetition is squeezed out: shaped JSON
|
|
86
|
+
* blobs get their shape and an example, keys sharing a closed vocabulary are
|
|
87
|
+
* grouped under it once, and plain numeric/flag keys are listed with their
|
|
88
|
+
* bounds. Meaning-prose stays in the artifact and is one
|
|
89
|
+
* `didit_workflow_get_feature_config_schema` call away.
|
|
90
|
+
*/
|
|
91
|
+
function renderFeatureDetail(feature) {
|
|
92
|
+
const entry = exports.FEATURE_CONFIG_SCHEMA.features[feature];
|
|
93
|
+
if (!entry)
|
|
94
|
+
return "";
|
|
95
|
+
const shaped = [];
|
|
96
|
+
const byVocabulary = new Map();
|
|
97
|
+
const plain = [];
|
|
98
|
+
for (const [key, field] of Object.entries(entry.fields).sort(([a], [b]) => a.localeCompare(b))) {
|
|
99
|
+
if (UNIVERSAL_KEYS.has(key))
|
|
100
|
+
continue;
|
|
101
|
+
if (field.shape) {
|
|
102
|
+
const example = field.example !== undefined ? ` e.g. ${JSON.stringify(field.example)}` : "";
|
|
103
|
+
shaped.push(`${key}: ${field.shape}${example}`);
|
|
104
|
+
}
|
|
105
|
+
else if (field.enum) {
|
|
106
|
+
const vocabulary = canonicalVocabulary(field.enum);
|
|
107
|
+
const group = byVocabulary.get(vocabulary) ?? [];
|
|
108
|
+
group.push(key);
|
|
109
|
+
byVocabulary.set(vocabulary, group);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
plain.push(`${key} (${renderConstraint(field)})`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const parts = [];
|
|
116
|
+
for (const shape of shaped)
|
|
117
|
+
parts.push(shape);
|
|
118
|
+
for (const [vocabulary, keys] of byVocabulary)
|
|
119
|
+
parts.push(`${vocabulary} — ${keys.join(", ")}`);
|
|
120
|
+
if (plain.length)
|
|
121
|
+
parts.push(plain.join(", "));
|
|
122
|
+
const header = entry.notes ? `${feature} — ${entry.notes}` : feature;
|
|
123
|
+
return parts.length ? `${header}\n • ${parts.join("\n • ")}` : `${header}\n • (no config keys)`;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The generated block the workflow tool descriptions embed. Covers EVERY key of
|
|
127
|
+
* EVERY feature; the artifact's per-key prose is a tool call away.
|
|
128
|
+
*/
|
|
129
|
+
function renderToolSchemaReference() {
|
|
130
|
+
const body = exports.WORKFLOW_FEATURES.map(renderFeatureDetail).join("\n");
|
|
131
|
+
return (`FEATURE CONFIG KEYS — generated from the backend serializers (contract ${exports.FEATURE_CONFIG_CHECKSUM}); ` +
|
|
132
|
+
`a key that is not here is not in the contract and the API will drop it silently. ` +
|
|
133
|
+
`Every feature additionally accepts status_rules. Call didit_workflow_get_feature_config_schema ` +
|
|
134
|
+
`for a feature's full types, defaults and per-key meaning.\n${body}`);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The compact variant carried by the SIMPLE workflow tools (`features[].config`).
|
|
138
|
+
*
|
|
139
|
+
* Those tools build a linear graph and are the wrong place for a full config
|
|
140
|
+
* reference, so this names every feature and spells out only the keys whose
|
|
141
|
+
* value is a JSON shape no agent can invent - the rest is one
|
|
142
|
+
* `didit_workflow_get_feature_config_schema` call away.
|
|
143
|
+
*/
|
|
144
|
+
function renderFeatureItemReference() {
|
|
145
|
+
const shaped = exports.WORKFLOW_FEATURES.flatMap((feature) => Object.entries(exports.FEATURE_CONFIG_SCHEMA.features[feature].fields)
|
|
146
|
+
.filter(([, field]) => Boolean(field.shape))
|
|
147
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
148
|
+
.map(([key, field]) => {
|
|
149
|
+
const example = field.example !== undefined ? ` e.g. ${JSON.stringify(field.example)}` : "";
|
|
150
|
+
return `${feature}.${key}: ${field.shape}${example}`;
|
|
151
|
+
}));
|
|
152
|
+
return (`Feature-specific settings, generated from the backend serializers (contract ${exports.FEATURE_CONFIG_CHECKSUM}); ` +
|
|
153
|
+
`a key outside the contract is dropped silently by the API. Features: ${exports.WORKFLOW_FEATURES.join(", ")}. ` +
|
|
154
|
+
`Call didit_workflow_get_feature_config_schema for a feature's full key list, types and meaning. ` +
|
|
155
|
+
`The keys whose value cannot be guessed:\n • ${shaped.join("\n • ")}`);
|
|
156
|
+
}
|
|
157
|
+
/** The per-feature reference the README carries, generated so the two cannot disagree. */
|
|
158
|
+
function renderMarkdownReference() {
|
|
159
|
+
const lines = [];
|
|
160
|
+
lines.push(`<!-- BEGIN GENERATED FEATURE CONFIG REFERENCE -->`);
|
|
161
|
+
lines.push("");
|
|
162
|
+
lines.push(`_Generated from \`schema/feature-config-schema.json\` (contract \`${exports.FEATURE_CONFIG_CHECKSUM}\`, ` +
|
|
163
|
+
`schema version ${exports.FEATURE_CONFIG_SCHEMA.schema_version}), which is a copy of the artifact ` +
|
|
164
|
+
`\`service-didit-verification\` generates from its feature-config serializers. Do not edit by hand — ` +
|
|
165
|
+
`run \`npm run schema:readme\`._`);
|
|
166
|
+
lines.push("");
|
|
167
|
+
for (const feature of exports.WORKFLOW_FEATURES) {
|
|
168
|
+
const entry = exports.FEATURE_CONFIG_SCHEMA.features[feature];
|
|
169
|
+
lines.push(`### ${feature}`);
|
|
170
|
+
lines.push("");
|
|
171
|
+
if (entry.description)
|
|
172
|
+
lines.push(entry.description);
|
|
173
|
+
if (entry.notes)
|
|
174
|
+
lines.push(`> ${entry.notes}`);
|
|
175
|
+
if (entry.description || entry.notes)
|
|
176
|
+
lines.push("");
|
|
177
|
+
lines.push("| Key | Type | Accepts | Meaning |");
|
|
178
|
+
lines.push("| --- | --- | --- | --- |");
|
|
179
|
+
for (const [key, field] of Object.entries(entry.fields).sort(([a], [b]) => a.localeCompare(b))) {
|
|
180
|
+
const accepts = isInteresting(field) ? renderConstraint(field) : renderConstraint(field);
|
|
181
|
+
lines.push(`| \`${key}\` | ${field.type}${field.nullable ? " \\| null" : ""} | ${escapeCell(accepts)} | ` +
|
|
182
|
+
`${escapeCell(field.description ?? "")} |`);
|
|
183
|
+
}
|
|
184
|
+
lines.push("");
|
|
185
|
+
}
|
|
186
|
+
lines.push(`<!-- END GENERATED FEATURE CONFIG REFERENCE -->`);
|
|
187
|
+
return lines.join("\n");
|
|
188
|
+
}
|
|
189
|
+
function escapeCell(value) {
|
|
190
|
+
return value.replace(/\|/g, "\\|").replace(/\n/g, " ");
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=feature-config-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-config-schema.js","sourceRoot":"","sources":["../src/feature-config-schema.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,EAAE;AACF,iEAAiE;AACjE,mFAAmF;AACnF,gFAAgF;AAChF,6EAA6E;AAC7E,8EA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