@gdrl/kronos-lib 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,208 @@
1
+ # kronos-lib
2
+
3
+ Lightweight TypeScript SDK for the [Kronos Knowledge Graph](https://github.com/your-org/kronos) API. Use it from Next.js, Node.js, or any JavaScript environment with `fetch` (Node 18+, browsers).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install kronos-lib
9
+ # or
10
+ pnpm add kronos-lib
11
+ # or
12
+ yarn add kronos-lib
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```typescript
18
+ import { KronosClient } from '@gdrl/kronos-lib';
19
+
20
+ const client = new KronosClient({
21
+ workerUrl: 'https://your-worker.workers.dev',
22
+ mastraUrl: 'https://your-mastra-server.com',
23
+ apiKey: 'your-app-api-key',
24
+ appId: 'your-app-id',
25
+ tenantUserId: 'user-123',
26
+ });
27
+
28
+ // Ingest a document
29
+ const { ingest_id } = await client.ingest({
30
+ source_type: 'email',
31
+ content: { type: 'text', text: 'Document content...' },
32
+ metadata: { sender: 'user@example.com' },
33
+ });
34
+
35
+ // Check ingest status
36
+ const status = await client.getIngestStatus(ingest_id);
37
+
38
+ // Create an MCP server
39
+ const mcp = await client.createMCPServer({
40
+ name: 'My MCP Server',
41
+ collection_ids: ['col-1', 'col-2'],
42
+ description: 'Optional description',
43
+ });
44
+
45
+ // Connect to the MCP server (short-lived access token, ~1 day)
46
+ const connection = await client.connectMCPServer({
47
+ serverId: mcp.mcp_server_id,
48
+ });
49
+ // connection.url is the full MCP endpoint; connection.access_token is the Bearer token.
50
+
51
+ // Query the knowledge graph
52
+ const results = await client.query({
53
+ query: 'What happened in Tokyo?',
54
+ collection_ids: ['col-1', 'col-2'],
55
+ });
56
+ // results.episodes, results.entities, results.attributes, results.direct_answer
57
+
58
+ // Create a collection
59
+ const collection = await client.createCollection({
60
+ spec: {
61
+ name: 'Work Emails',
62
+ include_query: 'work OR project',
63
+ scope: 'episode',
64
+ match_mode: 'broad',
65
+ },
66
+ created_by: 'user-123',
67
+ });
68
+ // collection.collection_id, collection.backfill_job_id
69
+
70
+ // Refresh collections for new episodes
71
+ await client.refreshCollections({ episode_ids: ['ep-1', 'ep-2'] });
72
+ ```
73
+
74
+ ## Configuration
75
+
76
+ | Option | Description |
77
+ |---------------|-----------------------------------------------------------------------------|
78
+ | `workerUrl` | Base URL of the Cloudflare Worker (ingest, MCP server create/rotate). |
79
+ | `mastraUrl` | Base URL of the Mastra server (query, collections). |
80
+ | `apiKey` | App API key; used as `Authorization: Bearer` for Worker endpoints. |
81
+ | `appId` | App ID; injected into Worker and Mastra request bodies. |
82
+ | `tenantUserId`| Tenant/user ID; injected into request bodies. |
83
+
84
+ ## API Overview
85
+
86
+ ### Ingest (Worker)
87
+
88
+ - **`ingest(params)`** – Submit a document. Requires `source_type` and `content: { type: 'text', text }`. Optional: `metadata`, `addToMemory`, `idempotencyKey`. `addToMemory` defaults to `true`; set it to `false` to run ingest-trigger workflows without chunking or adding the content to memory. If `idempotencyKey` is omitted, one is generated. Returns `{ ingest_id }`.
89
+ - **`getIngestStatus(ingestId)`** – Get status and progress of an ingest.
90
+
91
+ ### MCP Servers (Worker)
92
+
93
+ - **`createMCPServer(params)`** – Create an MCP server. Requires `name`, `collection_ids`. Optional: `description`. Returns MCP server metadata including `mcp_server_id`.
94
+ - **`listMCPServers(params)`** – List MCP servers for a user. Returns metadata only (no token).
95
+ - **`getMCPServer(params)`** – Get MCP server metadata by `serverId` (no token).
96
+ - **`connectMCPServer(params)`** – Issue a short-lived MCP access token for a server. Returns `{ mcp_server_id, url, access_token, expires_at }`.
97
+ - **`rotateMCPServerToken(serverId)`** – Legacy token rotation endpoint (generally not needed with short-lived connect tokens).
98
+
99
+ ### Query (Mastra)
100
+
101
+ - **`query(params)`** – Query the graph. Requires `query`, `collection_ids`. Returns `{ episodes, entities, attributes, direct_answer? }`.
102
+
103
+ ### Collections (Mastra)
104
+
105
+ - **`createCollection(params)`** – Create a collection. Requires `spec` (e.g. `name`, `include_query`, `scope`, `match_mode`), `created_by`. Optional: `description`. Returns `{ collection_id, backfill_job_id }`.
106
+ - **`refreshCollections(params)`** – Refresh collection membership for `episode_ids`. Optional: `mode` (default `'new_episodes_only'`). Returns `{ accepted: true }`.
107
+
108
+ ## Idempotency
109
+
110
+ For `ingest`, the Worker requires an `Idempotency-Key` header. You can pass `idempotencyKey` in the options; if omitted, the SDK generates one. For true idempotency (e.g. retries), pass a stable key (e.g. hash of `source_type` + `content.text` or your own id).
111
+
112
+ ## Error Handling
113
+
114
+ The SDK throws typed errors for HTTP failures:
115
+
116
+ - `KronosBadRequestError` (400)
117
+ - `KronosUnauthorizedError` (401)
118
+ - `KronosForbiddenError` (403)
119
+ - `KronosNotFoundError` (404)
120
+ - `KronosServerError` (5xx)
121
+ - `KronosError` (other)
122
+
123
+ All extend `KronosError` and include `status`, `code`, and `body` when available.
124
+
125
+ ```typescript
126
+ import { KronosClient, KronosNotFoundError } from '@gdrl/kronos-lib';
127
+
128
+ try {
129
+ await client.getIngestStatus('missing-id');
130
+ } catch (e) {
131
+ if (e instanceof KronosNotFoundError) {
132
+ console.log('Ingest not found:', e.body);
133
+ }
134
+ throw e;
135
+ }
136
+ ```
137
+
138
+ ## React integration (optional)
139
+
140
+ If you're building a React or Next.js app, you can use the optional React hook
141
+ exported from the `kronos-lib/react` subpath.
142
+
143
+ ### `useKronos` (triggers)
144
+
145
+ For now, `useKronos` focuses on trigger operations (more domains can be added over time):
146
+
147
+ ```tsx
148
+ import { useKronos, type KronosTriggerOps } from '@gdrl/kronos-lib/react';
149
+
150
+ const ops: KronosTriggerOps = {
151
+ async listTriggers() {
152
+ // Example: call your own app route that proxies to Kronos
153
+ const response = await fetch('/api/mercury/triggers');
154
+ const body = await response.json();
155
+ return {
156
+ triggers: body.triggers ?? [],
157
+ count: body.count ?? (body.triggers ?? []).length,
158
+ };
159
+ },
160
+ async createNlTrigger({ nl, actionDescription }) {
161
+ const response = await fetch('/api/mercury/triggers', {
162
+ method: 'POST',
163
+ headers: { 'Content-Type': 'application/json' },
164
+ body: JSON.stringify({ type: 'nl_webhook', nl, actionDescription }),
165
+ });
166
+ const body = await response.json();
167
+ return { triggerId: body.trigger_id ?? null };
168
+ },
169
+ };
170
+
171
+ function Automations() {
172
+ const {
173
+ triggers,
174
+ triggersLoading,
175
+ triggersError,
176
+ refreshTriggers,
177
+ createNlTrigger,
178
+ createLoading,
179
+ createError,
180
+ } = useKronos({ ops, tenantUserId: 'current-user' });
181
+
182
+ // ...render UI...
183
+ }
184
+ ```
185
+
186
+ This pattern lets you keep API keys and webhook secrets on the server (behind your own API routes),
187
+ while still getting a clean React hook surface for reading and creating triggers.
188
+
189
+ ## Types
190
+
191
+ All request/response types are exported:
192
+
193
+ - `IngestRequest`, `IngestResponse`, `IngestStatusResponse`
194
+ - `CreateMCPServerRequest`, `CreateMCPServerResponse`, `MCPServerDetails`, `ListMCPServersResponse`, `GetMCPServerResponse`, `ConnectMCPServerRequest`, `ConnectMCPServerResponse`
195
+ - `RotateMCPServerTokenRequest`, `RotateMCPServerTokenResponse`
196
+ - `QueryRequest`, `QueryResponse`, `EpisodeResult`, `EntityResult`, `AttributeResult`
197
+ - `CollectionSpec`, `CreateCollectionRequest`, `CreateCollectionResponse`
198
+ - `RefreshCollectionsRequest`, `RefreshCollectionsResponse`
199
+ - `KronosClientConfig`
200
+
201
+ ## Requirements
202
+
203
+ - Node.js 18+ or a modern browser (uses global `fetch`)
204
+ - TypeScript 4.7+ recommended for types
205
+
206
+ ## License
207
+
208
+ MIT
@@ -0,0 +1,336 @@
1
+ import { K as KronosClientConfig, I as IngestResponse, a as IngestStatusResponse, C as CreateMCPServerResponse, L as ListMCPServersResponse, G as GetMCPServerResponse, b as ConnectMCPServerResponse, R as RotateMCPServerTokenResponse, M as MemoryStatsResponse, S as ScratchsheetResponse, c as ListScopesResponse, d as GetScopeResponse, e as ScopeSpec, f as CreateScopeResponse, U as UpdateScopeResponse, g as ListTriggersResponse, h as CreateTriggerRequest, i as CreateTriggerResponse, T as TriggerRecord, j as UpdateTriggerRequest, k as UpdateTriggerResponse, D as DeleteTriggerResponse, l as CreateFrontendTokenResponse, m as SkillManageParams, n as SkillManageResponse, o as ContextGraphSummaryResponse, p as ContextGraphReadResponse } from './types-Gt5ZdRxW.mjs';
2
+ export { x as ConnectMCPServerRequest, Y as ContextGraphProcedureSummary, F as CreateFrontendTokenRequest, t as CreateMCPServerRequest, B as CreateScopeRequest, r as IngestMemoryDisposition, s as IngestRequest, q as IngestStatus, w as MCPServerDetails, u as MCPServerStatus, v as MCPServerToolCapabilities, O as OnTriggered, y as RotateMCPServerTokenRequest, A as ScopeDetail, z as ScopeSummary, N as SkillFileContentMode, P as SkillFileInput, Q as SkillFileRecord, H as SkillFileType, W as SkillMetadataRecord, J as SkillReadMode, X as SkillSummaryRecord, V as SkillTreeNode, E as TriggerType } from './types-Gt5ZdRxW.mjs';
3
+
4
+ declare class KronosClient {
5
+ private readonly workerUrl;
6
+ private readonly mastraUrl;
7
+ private readonly apiKey;
8
+ private readonly appId;
9
+ constructor(config: KronosClientConfig);
10
+ /**
11
+ * Perform a health check to verify the client can connect to the Kronos worker
12
+ * This is called automatically during initialization
13
+ */
14
+ private healthCheck;
15
+ private workerFetch;
16
+ private mastraFetch;
17
+ private handleResponse;
18
+ /**
19
+ * Submit a document for ingestion.
20
+ * @param params - source_type, content, optional metadata, addToMemory, and idempotencyKey
21
+ * @returns ingest_id
22
+ */
23
+ ingest(params: {
24
+ tenant_user_id: string;
25
+ source_type: string;
26
+ priority?: 'low' | 'medium' | 'high';
27
+ addToMemory?: boolean;
28
+ content: {
29
+ type: 'text';
30
+ text: string;
31
+ };
32
+ metadata?: Record<string, unknown>;
33
+ idempotencyKey?: string;
34
+ }): Promise<IngestResponse>;
35
+ /**
36
+ * Get the status of an ingest.
37
+ */
38
+ getIngestStatus(ingestId: string): Promise<IngestStatusResponse>;
39
+ /**
40
+ * Create an MCP server scoped to the given scopes.
41
+ * Use connectMCPServer() to get a short-lived access token for MCP auth.
42
+ */
43
+ createMCPServer(params: {
44
+ tenant_user_id: string;
45
+ name: string;
46
+ /** Omit or pass [] for all-memory access. */
47
+ scope_ids?: string[] | null;
48
+ description?: string;
49
+ options?: {
50
+ /** Expose `search_skills` and `read_skill`. Defaults to true. */
51
+ exposeSkillsTool?: boolean;
52
+ /** Expose the read-only `context_graph` tool. Defaults to false. */
53
+ exposeContextGraphTool?: boolean;
54
+ };
55
+ }): Promise<CreateMCPServerResponse>;
56
+ /**
57
+ * List MCP servers for a user. Returns metadata only (no token).
58
+ */
59
+ listMCPServers(params: {
60
+ tenant_user_id: string;
61
+ }): Promise<ListMCPServersResponse>;
62
+ /**
63
+ * Get MCP server details for a user by server ID. Returns metadata only (no token).
64
+ */
65
+ getMCPServer(params: {
66
+ tenant_user_id: string;
67
+ serverId: string;
68
+ }): Promise<GetMCPServerResponse>;
69
+ updateMCPServer(params: {
70
+ tenant_user_id: string;
71
+ serverId: string;
72
+ tool_capabilities: {
73
+ skills: boolean;
74
+ context_graph: boolean;
75
+ };
76
+ }): Promise<GetMCPServerResponse>;
77
+ /**
78
+ * Connect to an MCP server by ID and receive a short-lived access token.
79
+ * Use the returned access_token as Bearer token when calling the MCP endpoint.
80
+ */
81
+ connectMCPServer(params: {
82
+ tenant_user_id: string;
83
+ serverId: string;
84
+ }): Promise<ConnectMCPServerResponse>;
85
+ /**
86
+ * Rotate the token for an MCP server. The new token is returned only on rotate.
87
+ */
88
+ rotateMCPServerToken(params: {
89
+ tenant_user_id: string;
90
+ serverId: string;
91
+ }): Promise<RotateMCPServerTokenResponse>;
92
+ /**
93
+ * Get memory stats for a user (total claim count across entire memory graph).
94
+ * Worker caches the response for 5 minutes per user.
95
+ */
96
+ getMemoryStats(params: {
97
+ tenant_user_id: string;
98
+ }): Promise<MemoryStatsResponse>;
99
+ /**
100
+ * Read the current scratchsheet document for a user.
101
+ */
102
+ getScratchsheet(params: {
103
+ tenant_user_id: string;
104
+ }): Promise<ScratchsheetResponse>;
105
+ /**
106
+ * List scopes for a user. Returns full scope details. Cached 5 min per user.
107
+ */
108
+ listScopes(params: {
109
+ tenant_user_id: string;
110
+ }): Promise<ListScopesResponse>;
111
+ /**
112
+ * Get a single scope by ID. Returns full scope details.
113
+ */
114
+ getScope(params: {
115
+ tenant_user_id: string;
116
+ scope_id: string;
117
+ }): Promise<GetScopeResponse>;
118
+ /**
119
+ * Create a scope. A backfill job runs asynchronously to populate it.
120
+ * If spec.allowed_source_types is omitted, it defaults to ['all'].
121
+ * Uses the Worker so the scopes list cache is invalidated after create.
122
+ */
123
+ createScope(params: {
124
+ tenant_user_id: string;
125
+ spec: ScopeSpec;
126
+ created_by: string;
127
+ description?: string;
128
+ }): Promise<CreateScopeResponse>;
129
+ /**
130
+ * Update a scope. Only provided fields are updated.
131
+ * If include_query, exclude_query, match_mode, time_range, or allowed_source_types change,
132
+ * a backfill job runs to recompute membership (response includes backfill_job_id).
133
+ * Otherwise only DB and Neo4j metadata are updated.
134
+ */
135
+ updateScope(params: {
136
+ tenant_user_id: string;
137
+ scope_id: string;
138
+ name?: string;
139
+ description?: string | null;
140
+ include_query?: string;
141
+ exclude_query?: string | null;
142
+ match_mode?: 'strict' | 'broad';
143
+ time_range?: {
144
+ start?: string;
145
+ end?: string;
146
+ };
147
+ allowed_source_types?: string[] | 'all';
148
+ }): Promise<UpdateScopeResponse>;
149
+ /**
150
+ * Soft-delete a scope. Invalidates the scopes list cache for that user.
151
+ */
152
+ deleteScope(params: {
153
+ tenant_user_id: string;
154
+ scope_id: string;
155
+ }): Promise<{
156
+ deleted: boolean;
157
+ }>;
158
+ /**
159
+ * Verify a webhook secret for a trigger.
160
+ * This method calls the Kronos worker API to verify the webhook secret.
161
+ *
162
+ * @param params - app_id, tenant_user_id, trigger_id and received_secret to verify
163
+ * @returns true if secret is valid, false otherwise
164
+ */
165
+ verifyWebhookSecret(params: {
166
+ tenant_user_id: string;
167
+ trigger_id: string;
168
+ received_secret: string;
169
+ }): Promise<boolean>;
170
+ /**
171
+ * List triggers for a tenant user.
172
+ */
173
+ listTriggers(params: {
174
+ tenant_user_id: string;
175
+ }): Promise<ListTriggersResponse>;
176
+ /**
177
+ * Create a trigger.
178
+ * Supports NL creation (trigger_description) or manual creation (trigger_type/trigger_spec).
179
+ *
180
+ * @returns CreateTriggerResponse (accepted for NL, trigger_id for manual)
181
+ */
182
+ createTrigger(params: {
183
+ tenant_user_id: string;
184
+ webhook_url: string;
185
+ webhook_secret: string;
186
+ title?: string | null;
187
+ action_description?: string;
188
+ skill_id?: string;
189
+ skill_version_id?: string;
190
+ trigger_description?: string;
191
+ trigger_type?: CreateTriggerRequest['trigger_type'];
192
+ trigger_spec?: CreateTriggerRequest['trigger_spec'];
193
+ next_run_at?: string;
194
+ on_triggered?: CreateTriggerRequest['on_triggered'];
195
+ metadata?: Record<string, unknown>;
196
+ idempotencyKey?: string;
197
+ }): Promise<CreateTriggerResponse>;
198
+ /**
199
+ * Get details for a specific trigger.
200
+ * Uses listTriggers and filters by trigger_id.
201
+ */
202
+ getTriggerDetails(params: {
203
+ tenant_user_id: string;
204
+ trigger_id: string;
205
+ }): Promise<TriggerRecord>;
206
+ /**
207
+ * Update a trigger.
208
+ * Updates the webhook_url, action_description, status, or metadata of an existing trigger.
209
+ *
210
+ * @param params - app_id, tenant_user_id, trigger_id and fields to update
211
+ * @returns UpdateTriggerResponse with success status
212
+ */
213
+ updateTrigger(params: {
214
+ tenant_user_id: string;
215
+ trigger_id: string;
216
+ webhook_url?: string;
217
+ title?: string | null;
218
+ trigger_type?: UpdateTriggerRequest['trigger_type'];
219
+ trigger_spec?: UpdateTriggerRequest['trigger_spec'];
220
+ next_run_at?: UpdateTriggerRequest['next_run_at'];
221
+ action_description?: string;
222
+ skill_id?: string | null;
223
+ skill_version_id?: string | null;
224
+ on_triggered?: UpdateTriggerRequest['on_triggered'];
225
+ status?: string;
226
+ metadata?: Record<string, unknown>;
227
+ }): Promise<UpdateTriggerResponse>;
228
+ /**
229
+ * Delete a trigger.
230
+ */
231
+ deleteTrigger(params: {
232
+ tenant_user_id: string;
233
+ trigger_id: string;
234
+ }): Promise<DeleteTriggerResponse>;
235
+ /**
236
+ * Issue a short-lived, user-scoped frontend token.
237
+ * The browser can use this token directly against the Kronos worker for
238
+ * allowed operations (e.g. trigger CRUD) without needing the app API key.
239
+ *
240
+ * This method must be called from a trusted server environment.
241
+ */
242
+ createFrontendToken(params: {
243
+ tenantUserId: string;
244
+ ttlSeconds?: number;
245
+ ops?: string[];
246
+ }): Promise<CreateFrontendTokenResponse>;
247
+ /**
248
+ * Canonical skills API with operation-based contract.
249
+ */
250
+ manageSkill(params: SkillManageParams): Promise<SkillManageResponse>;
251
+ private resolveContextGraphSkillId;
252
+ private parseContextGraphProcedures;
253
+ getContextGraph(params: {
254
+ tenant_user_id: string;
255
+ }): Promise<ContextGraphSummaryResponse>;
256
+ readContextGraph(params: {
257
+ tenant_user_id: string;
258
+ path?: string;
259
+ }): Promise<ContextGraphReadResponse>;
260
+ }
261
+
262
+ /**
263
+ * Generate an idempotency key for ingest requests.
264
+ * Uses crypto.randomUUID() when available; falls back to a timestamp-based value.
265
+ * Callers can pass their own key via the ingest options to achieve true idempotency.
266
+ */
267
+ declare function generateIdempotencyKey(): string;
268
+
269
+ /**
270
+ * Webhook verification utilities for Kronos triggers
271
+ * Provides secure constant-time comparison for webhook secrets
272
+ */
273
+ /**
274
+ * Verify a webhook secret using constant-time comparison to prevent timing attacks.
275
+ *
276
+ * @param receivedSecret - The secret received in the webhook header
277
+ * @param storedSecret - The secret stored in the database for the trigger
278
+ * @returns true if secrets match, false otherwise
279
+ *
280
+ * @example
281
+ * ```typescript
282
+ * import { verifyWebhookSecret } from '@gdrl/kronos-lib/webhook-verification';
283
+ *
284
+ * const isValid = verifyWebhookSecret(
285
+ * request.headers.get('X-Kronos-Webhook-Secret'),
286
+ * trigger.webhook_secret
287
+ * );
288
+ *
289
+ * if (!isValid) {
290
+ * return new Response('Unauthorized', { status: 401 });
291
+ * }
292
+ * ```
293
+ */
294
+ declare function verifyWebhookSecret(receivedSecret: string | null | undefined, storedSecret: string | null | undefined): boolean;
295
+
296
+ /**
297
+ * Base error for Kronos API failures
298
+ */
299
+ declare class KronosError extends Error {
300
+ readonly status?: number | undefined;
301
+ readonly code?: string | undefined;
302
+ readonly body?: unknown | undefined;
303
+ constructor(message: string, status?: number | undefined, code?: string | undefined, body?: unknown | undefined);
304
+ }
305
+ /**
306
+ * 400 Bad Request - invalid or missing parameters
307
+ */
308
+ declare class KronosBadRequestError extends KronosError {
309
+ constructor(message: string, body?: unknown);
310
+ }
311
+ /**
312
+ * 401 Unauthorized - invalid or missing API key
313
+ */
314
+ declare class KronosUnauthorizedError extends KronosError {
315
+ constructor(message: string, body?: unknown);
316
+ }
317
+ /**
318
+ * 403 Forbidden - valid auth but insufficient permissions
319
+ */
320
+ declare class KronosForbiddenError extends KronosError {
321
+ constructor(message: string, body?: unknown);
322
+ }
323
+ /**
324
+ * 404 Not Found - resource does not exist
325
+ */
326
+ declare class KronosNotFoundError extends KronosError {
327
+ constructor(message: string, body?: unknown);
328
+ }
329
+ /**
330
+ * 5xx or network/unknown errors
331
+ */
332
+ declare class KronosServerError extends KronosError {
333
+ constructor(message: string, status?: number, body?: unknown);
334
+ }
335
+
336
+ export { ConnectMCPServerResponse, ContextGraphReadResponse, ContextGraphSummaryResponse, CreateFrontendTokenResponse, CreateMCPServerResponse, CreateScopeResponse, CreateTriggerRequest, CreateTriggerResponse, DeleteTriggerResponse, GetMCPServerResponse, GetScopeResponse, IngestResponse, IngestStatusResponse, KronosBadRequestError, KronosClient, KronosClientConfig, KronosError, KronosForbiddenError, KronosNotFoundError, KronosServerError, KronosUnauthorizedError, ListMCPServersResponse, ListScopesResponse, ListTriggersResponse, MemoryStatsResponse, RotateMCPServerTokenResponse, ScopeSpec, ScratchsheetResponse, SkillManageParams, SkillManageResponse, TriggerRecord, UpdateTriggerRequest, UpdateTriggerResponse, generateIdempotencyKey, verifyWebhookSecret };