@okrlinkhub/agent-factory 0.2.3 → 0.2.5
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 +44 -0
- package/dist/client/bridge.d.ts +1 -0
- package/dist/client/bridge.d.ts.map +1 -1
- package/dist/client/bridge.js +24 -6
- package/dist/client/bridge.js.map +1 -1
- package/dist/client/index.d.ts +145 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +192 -0
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +2 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +456 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/lib.d.ts +1 -0
- package/dist/component/lib.d.ts.map +1 -1
- package/dist/component/lib.js +1 -0
- package/dist/component/lib.js.map +1 -1
- package/dist/component/pushing.d.ts +226 -0
- package/dist/component/pushing.d.ts.map +1 -0
- package/dist/component/pushing.js +954 -0
- package/dist/component/pushing.js.map +1 -0
- package/dist/component/queue.d.ts +8 -5
- package/dist/component/queue.d.ts.map +1 -1
- package/dist/component/queue.js +28 -1
- package/dist/component/queue.js.map +1 -1
- package/dist/component/schema.d.ts +261 -8
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +104 -0
- package/dist/component/schema.js.map +1 -1
- package/package.json +1 -1
- package/src/client/bridge.test.ts +2 -0
- package/src/client/bridge.ts +32 -6
- package/src/client/index.test.ts +29 -19
- package/src/client/index.ts +209 -0
- package/src/component/_generated/api.ts +2 -0
- package/src/component/_generated/component.ts +448 -0
- package/src/component/lib.test.ts +103 -0
- package/src/component/lib.ts +17 -0
- package/src/component/pushing.ts +1111 -0
- package/src/component/queue.ts +45 -1
- package/src/component/schema.ts +138 -0
package/README.md
CHANGED
|
@@ -131,6 +131,32 @@ export default crons;
|
|
|
131
131
|
|
|
132
132
|
This cron is a safety net. The primary path remains enqueue-triggered reconcile.
|
|
133
133
|
|
|
134
|
+
### Agent pushing schedule (hourly dispatcher)
|
|
135
|
+
|
|
136
|
+
For agent pushing, the recommended scheduler is an hourly cron that dispatches due jobs:
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
import { cronJobs } from "convex/server";
|
|
140
|
+
import { api } from "./_generated/api";
|
|
141
|
+
|
|
142
|
+
const crons = cronJobs();
|
|
143
|
+
|
|
144
|
+
crons.cron(
|
|
145
|
+
"agent-factory push dispatch hourly",
|
|
146
|
+
"0 * * * *",
|
|
147
|
+
api.example.dispatchDuePushJobs,
|
|
148
|
+
{},
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
export default crons;
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Important product constraint:
|
|
155
|
+
- job configuration supports only fixed schedule slots (`HH:mm`, plus weekday/day-of-month)
|
|
156
|
+
- minute-based recurrence ("every N minutes") is intentionally not supported
|
|
157
|
+
|
|
158
|
+
Admin broadcast is also supported through `sendBroadcastToAllActiveAgents`, which enqueues one message per active target and records a dispatch audit.
|
|
159
|
+
|
|
134
160
|
### LLM configuration (Fly env)
|
|
135
161
|
|
|
136
162
|
The model/provider is controlled by Fly worker environment variables (for example `OPENCLAW_AGENT_MODEL`, `MOONSHOT_API_KEY`, `OPENAI_API_KEY`) and applied at runtime by the worker image bootstrap.
|
|
@@ -189,11 +215,23 @@ Naming convention supported by hydration resolver:
|
|
|
189
215
|
- per-agent service key: `agent-bridge.serviceKey.<agentKey>` (recommended)
|
|
190
216
|
- global service key fallback: `agent-bridge.serviceKey`
|
|
191
217
|
- optional profile override: `bridgeConfig.serviceKeySecretRef`
|
|
218
|
+
- per-agent base URL map JSON (for strict `execute-on-behalf` skills): `agent-bridge.baseUrlMapJson.<agentKey>`
|
|
219
|
+
- global base URL map JSON fallback: `agent-bridge.baseUrlMapJson`
|
|
192
220
|
- optional per-agent/global overrides for `baseUrl`, `serviceId`, `appKey` via:
|
|
193
221
|
- `agent-bridge.baseUrl.<agentKey>` / `agent-bridge.baseUrl`
|
|
194
222
|
- `agent-bridge.serviceId.<agentKey>` / `agent-bridge.serviceId`
|
|
195
223
|
- `agent-bridge.appKey.<agentKey>` / `agent-bridge.appKey`
|
|
196
224
|
|
|
225
|
+
Example value for `agent-bridge.baseUrlMapJson.<agentKey>`:
|
|
226
|
+
|
|
227
|
+
```json
|
|
228
|
+
{"linkhub-w4":"https://www.okrlink.app","amc":"https://amc-primogroup.convex.site"}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
This is still stored as a normal component secret ref (same naming convention as other
|
|
232
|
+
bridge secrets). The secret **value** is the JSON map expected by strict agent-bridge
|
|
233
|
+
skills (`APP_BASE_URL_MAP_JSON`).
|
|
234
|
+
|
|
197
235
|
Hydration includes `bridgeRuntimeConfig` for the worker loop.
|
|
198
236
|
|
|
199
237
|
3) In worker runtime use built-in helpers from this package:
|
|
@@ -229,6 +267,12 @@ Fallback env (worker-side only, used when hydration misses values):
|
|
|
229
267
|
- `OPENCLAW_SERVICE_KEY` or `AGENT_BRIDGE_SERVICE_KEY`
|
|
230
268
|
- `OPENCLAW_AGENT_APP` / `OPENCLAW_APP_KEY` / `AGENT_BRIDGE_APP_KEY`
|
|
231
269
|
|
|
270
|
+
Fly.io practical note (recommended for strict bridge flow):
|
|
271
|
+
- set `AGENT_BRIDGE_DEFAULT_APP_KEY`, `APP_BASE_URL_MAP_JSON`, `OPENCLAW_SERVICE_ID`,
|
|
272
|
+
and `OPENCLAW_SERVICE_KEY` directly in Fly app env/secrets (`fly secrets set` or `fly.toml [env]`).
|
|
273
|
+
- keep these runtime values in Fly even when component secrets are configured, so workers
|
|
274
|
+
can always resolve strict `execute-on-behalf` calls without depending on secret hydration timing.
|
|
275
|
+
|
|
232
276
|
### HTTP Routes
|
|
233
277
|
|
|
234
278
|
You can mount an ingress webhook route in your app:
|
package/dist/client/bridge.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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C,GACjC;IACE,OAAO,EAAE,KAAK,CAAC;CAChB,GACD;IACE,OAAO,EAAE,IAAI,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,qBAAqB,CAAC;CACjC,CAAC;AASN,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,2BAA2B,GAAG,IAAI,GAAG,SAAS,EAC9D,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAqD,GAEzF;IACE,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,2BAA2B,CAAC;CACrC,GACD;IACE,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf,CAsCJ;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK7E;AAED,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CA2ChC;AAED,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,gCAAgC,CAAC,CAiC3C"}
|
package/dist/client/bridge.js
CHANGED
|
@@ -5,10 +5,10 @@ const BRIDGE_ENV_KEYS = {
|
|
|
5
5
|
appKey: ["OPENCLAW_AGENT_APP", "OPENCLAW_APP_KEY", "AGENT_BRIDGE_APP_KEY"],
|
|
6
6
|
};
|
|
7
7
|
export function resolveBridgeRuntimeConfig(hydratedConfig, env = process.env) {
|
|
8
|
-
const
|
|
8
|
+
const appKey = pickValue(hydratedConfig?.appKey, readEnv(env, BRIDGE_ENV_KEYS.appKey));
|
|
9
|
+
const baseUrl = pickValue(hydratedConfig?.baseUrl, readEnv(env, BRIDGE_ENV_KEYS.baseUrl), resolveBaseUrlFromMap(hydratedConfig?.appBaseUrlMapJson, appKey));
|
|
9
10
|
const serviceId = pickValue(hydratedConfig?.serviceId, readEnv(env, BRIDGE_ENV_KEYS.serviceId));
|
|
10
11
|
const serviceKey = pickValue(hydratedConfig?.serviceKey, readEnv(env, BRIDGE_ENV_KEYS.serviceKey));
|
|
11
|
-
const appKey = pickValue(hydratedConfig?.appKey, readEnv(env, BRIDGE_ENV_KEYS.appKey));
|
|
12
12
|
const missing = [];
|
|
13
13
|
if (!baseUrl)
|
|
14
14
|
missing.push("baseUrl");
|
|
@@ -129,11 +129,29 @@ function readEnv(env, keys) {
|
|
|
129
129
|
}
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
132
|
-
function pickValue(
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
function pickValue(...values) {
|
|
133
|
+
for (const value of values) {
|
|
134
|
+
if (value && value.trim().length > 0) {
|
|
135
|
+
return value.trim();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
function resolveBaseUrlFromMap(appBaseUrlMapJson, appKey) {
|
|
141
|
+
if (!appBaseUrlMapJson || !appKey) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const parsed = JSON.parse(appBaseUrlMapJson);
|
|
146
|
+
const value = parsed?.[appKey];
|
|
147
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
148
|
+
return value.trim();
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return null;
|
|
135
154
|
}
|
|
136
|
-
return fallback;
|
|
137
155
|
}
|
|
138
156
|
function normalizeBaseUrl(baseUrl) {
|
|
139
157
|
return baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../src/client/bridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../src/client/bridge.ts"],"names":[],"m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
|
@@ -36,8 +36,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
36
36
|
rawUpdateJson?: string | undefined;
|
|
37
37
|
agentKey: string;
|
|
38
38
|
conversationId: string;
|
|
39
|
-
provider: string;
|
|
40
39
|
providerUserId: string;
|
|
40
|
+
provider: string;
|
|
41
41
|
messageText: string;
|
|
42
42
|
}, Promise<string>>;
|
|
43
43
|
workerStats: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
@@ -96,6 +96,7 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
96
96
|
}, Promise<{
|
|
97
97
|
agentKey: string;
|
|
98
98
|
bridgeRuntimeConfig: null | {
|
|
99
|
+
appBaseUrlMapJson: null | string;
|
|
99
100
|
appKey: null | string;
|
|
100
101
|
baseUrl: null | string;
|
|
101
102
|
serviceId: null | string;
|
|
@@ -159,8 +160,8 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
159
160
|
sizeBytes: number;
|
|
160
161
|
}, Promise<any>>;
|
|
161
162
|
workerFailSnapshotUpload: import("convex/server").RegisteredMutation<"public", {
|
|
162
|
-
workerId: string;
|
|
163
163
|
error: string;
|
|
164
|
+
workerId: string;
|
|
164
165
|
snapshotId: string;
|
|
165
166
|
}, Promise<any>>;
|
|
166
167
|
workerLatestSnapshotForRestore: import("convex/server").RegisteredQuery<"public", {
|
|
@@ -344,6 +345,148 @@ export declare function exposeApi(component: ComponentApi, options: {
|
|
|
344
345
|
pendingUpdateCount: number;
|
|
345
346
|
webhookUrl: string;
|
|
346
347
|
}>>;
|
|
348
|
+
createPushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
349
|
+
enabled?: boolean | undefined;
|
|
350
|
+
companyId: string;
|
|
351
|
+
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
352
|
+
text: string;
|
|
353
|
+
title: string;
|
|
354
|
+
actorUserId: string;
|
|
355
|
+
suggestedTimes: ({
|
|
356
|
+
kind: "daily";
|
|
357
|
+
time: string;
|
|
358
|
+
} | {
|
|
359
|
+
kind: "weekly";
|
|
360
|
+
time: string;
|
|
361
|
+
weekday: number;
|
|
362
|
+
} | {
|
|
363
|
+
kind: "monthly";
|
|
364
|
+
time: string;
|
|
365
|
+
dayOfMonth: number | "last";
|
|
366
|
+
})[];
|
|
367
|
+
templateKey: string;
|
|
368
|
+
}, Promise<any>>;
|
|
369
|
+
updatePushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
370
|
+
enabled?: boolean | undefined;
|
|
371
|
+
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
372
|
+
text?: string | undefined;
|
|
373
|
+
title?: string | undefined;
|
|
374
|
+
suggestedTimes?: ({
|
|
375
|
+
kind: "daily";
|
|
376
|
+
time: string;
|
|
377
|
+
} | {
|
|
378
|
+
kind: "weekly";
|
|
379
|
+
time: string;
|
|
380
|
+
weekday: number;
|
|
381
|
+
} | {
|
|
382
|
+
kind: "monthly";
|
|
383
|
+
time: string;
|
|
384
|
+
dayOfMonth: number | "last";
|
|
385
|
+
})[] | undefined;
|
|
386
|
+
templateId: string;
|
|
387
|
+
actorUserId: string;
|
|
388
|
+
}, Promise<any>>;
|
|
389
|
+
deletePushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
390
|
+
templateId: string;
|
|
391
|
+
}, Promise<any>>;
|
|
392
|
+
listPushTemplatesByCompany: import("convex/server").RegisteredQuery<"public", {
|
|
393
|
+
includeDisabled?: boolean | undefined;
|
|
394
|
+
companyId: string;
|
|
395
|
+
}, Promise<any>>;
|
|
396
|
+
createPushJobFromTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
397
|
+
enabled?: boolean | undefined;
|
|
398
|
+
schedule?: {
|
|
399
|
+
kind: "manual";
|
|
400
|
+
} | {
|
|
401
|
+
kind: "daily";
|
|
402
|
+
time: string;
|
|
403
|
+
} | {
|
|
404
|
+
kind: "weekly";
|
|
405
|
+
time: string;
|
|
406
|
+
weekday: number;
|
|
407
|
+
} | {
|
|
408
|
+
kind: "monthly";
|
|
409
|
+
time: string;
|
|
410
|
+
dayOfMonth: number | "last";
|
|
411
|
+
} | undefined;
|
|
412
|
+
consumerUserId: string;
|
|
413
|
+
companyId: string;
|
|
414
|
+
timezone: string;
|
|
415
|
+
templateId: string;
|
|
416
|
+
}, Promise<any>>;
|
|
417
|
+
createPushJobCustom: import("convex/server").RegisteredMutation<"public", {
|
|
418
|
+
enabled?: boolean | undefined;
|
|
419
|
+
consumerUserId: string;
|
|
420
|
+
companyId: string;
|
|
421
|
+
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
422
|
+
schedule: {
|
|
423
|
+
kind: "manual";
|
|
424
|
+
} | {
|
|
425
|
+
kind: "daily";
|
|
426
|
+
time: string;
|
|
427
|
+
} | {
|
|
428
|
+
kind: "weekly";
|
|
429
|
+
time: string;
|
|
430
|
+
weekday: number;
|
|
431
|
+
} | {
|
|
432
|
+
kind: "monthly";
|
|
433
|
+
time: string;
|
|
434
|
+
dayOfMonth: number | "last";
|
|
435
|
+
};
|
|
436
|
+
text: string;
|
|
437
|
+
timezone: string;
|
|
438
|
+
title: string;
|
|
439
|
+
}, Promise<any>>;
|
|
440
|
+
updatePushJob: import("convex/server").RegisteredMutation<"public", {
|
|
441
|
+
enabled?: boolean | undefined;
|
|
442
|
+
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
443
|
+
schedule?: {
|
|
444
|
+
kind: "manual";
|
|
445
|
+
} | {
|
|
446
|
+
kind: "daily";
|
|
447
|
+
time: string;
|
|
448
|
+
} | {
|
|
449
|
+
kind: "weekly";
|
|
450
|
+
time: string;
|
|
451
|
+
weekday: number;
|
|
452
|
+
} | {
|
|
453
|
+
kind: "monthly";
|
|
454
|
+
time: string;
|
|
455
|
+
dayOfMonth: number | "last";
|
|
456
|
+
} | undefined;
|
|
457
|
+
text?: string | undefined;
|
|
458
|
+
timezone?: string | undefined;
|
|
459
|
+
title?: string | undefined;
|
|
460
|
+
jobId: string;
|
|
461
|
+
}, Promise<any>>;
|
|
462
|
+
deletePushJob: import("convex/server").RegisteredMutation<"public", {
|
|
463
|
+
jobId: string;
|
|
464
|
+
}, Promise<any>>;
|
|
465
|
+
setPushJobEnabled: import("convex/server").RegisteredMutation<"public", {
|
|
466
|
+
enabled: boolean;
|
|
467
|
+
jobId: string;
|
|
468
|
+
}, Promise<any>>;
|
|
469
|
+
listPushJobsForUser: import("convex/server").RegisteredQuery<"public", {
|
|
470
|
+
includeDisabled?: boolean | undefined;
|
|
471
|
+
consumerUserId: string;
|
|
472
|
+
}, Promise<any>>;
|
|
473
|
+
triggerPushJobNow: import("convex/server").RegisteredMutation<"public", {
|
|
474
|
+
jobId: string;
|
|
475
|
+
}, Promise<any>>;
|
|
476
|
+
dispatchDuePushJobs: import("convex/server").RegisteredMutation<"public", {
|
|
477
|
+
nowMs?: number | undefined;
|
|
478
|
+
limit?: number | undefined;
|
|
479
|
+
}, Promise<any>>;
|
|
480
|
+
sendBroadcastToAllActiveAgents: import("convex/server").RegisteredMutation<"public", {
|
|
481
|
+
companyId: string;
|
|
482
|
+
text: string;
|
|
483
|
+
title: string;
|
|
484
|
+
requestedBy: string;
|
|
485
|
+
}, Promise<any>>;
|
|
486
|
+
listPushDispatchesByJob: import("convex/server").RegisteredQuery<"public", {
|
|
487
|
+
limit?: number | undefined;
|
|
488
|
+
jobId: string;
|
|
489
|
+
}, Promise<any>>;
|
|
347
490
|
};
|
|
348
491
|
/**
|
|
349
492
|
* Register a Telegram webhook ingress route.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA5MzzO;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,YAAY,EACvB,EACE,UAA6B,EAC7B,eAAe,EACf,0BAAiC,EACjC,gBAA4B,EAC5B,yBAAiC,EACjC,cAAc,GACf,GAAE;IACD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,MAAM,CAAC;IAC9C,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,cAAc,CAAC,EAAE,cAAc,CAAC;CAC5B,QA+KP"}
|
package/dist/client/index.js
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import { actionGeneric, httpActionGeneric, mutationGeneric, queryGeneric, } from "convex/server";
|
|
2
2
|
import { v } from "convex/values";
|
|
3
3
|
import { providerConfigValidator, scalingPolicyValidator, } from "../component/config.js";
|
|
4
|
+
const pushPeriodicityValidator = v.union(v.literal("manual"), v.literal("daily"), v.literal("weekly"), v.literal("monthly"));
|
|
5
|
+
const pushSuggestedTimeValidator = v.union(v.object({
|
|
6
|
+
kind: v.literal("daily"),
|
|
7
|
+
time: v.string(),
|
|
8
|
+
}), v.object({
|
|
9
|
+
kind: v.literal("weekly"),
|
|
10
|
+
weekday: v.number(),
|
|
11
|
+
time: v.string(),
|
|
12
|
+
}), v.object({
|
|
13
|
+
kind: v.literal("monthly"),
|
|
14
|
+
dayOfMonth: v.union(v.number(), v.literal("last")),
|
|
15
|
+
time: v.string(),
|
|
16
|
+
}));
|
|
17
|
+
const pushScheduleValidator = v.union(v.object({
|
|
18
|
+
kind: v.literal("manual"),
|
|
19
|
+
}), v.object({
|
|
20
|
+
kind: v.literal("daily"),
|
|
21
|
+
time: v.string(),
|
|
22
|
+
}), v.object({
|
|
23
|
+
kind: v.literal("weekly"),
|
|
24
|
+
weekday: v.number(),
|
|
25
|
+
time: v.string(),
|
|
26
|
+
}), v.object({
|
|
27
|
+
kind: v.literal("monthly"),
|
|
28
|
+
dayOfMonth: v.union(v.number(), v.literal("last")),
|
|
29
|
+
time: v.string(),
|
|
30
|
+
}));
|
|
4
31
|
export { bridgeFunctionKeyFromToolName, executeBridgeFunction, isBridgeToolName, maybeExecuteBridgeToolCall, resolveBridgeRuntimeConfig, } from "./bridge.js";
|
|
5
32
|
export function exposeApi(component, options) {
|
|
6
33
|
return {
|
|
@@ -418,6 +445,171 @@ export function exposeApi(component, options) {
|
|
|
418
445
|
return await ctx.runAction(component.lib.configureTelegramWebhook, args);
|
|
419
446
|
},
|
|
420
447
|
}),
|
|
448
|
+
createPushTemplate: mutationGeneric({
|
|
449
|
+
args: {
|
|
450
|
+
companyId: v.string(),
|
|
451
|
+
templateKey: v.string(),
|
|
452
|
+
title: v.string(),
|
|
453
|
+
text: v.string(),
|
|
454
|
+
periodicity: pushPeriodicityValidator,
|
|
455
|
+
suggestedTimes: v.array(pushSuggestedTimeValidator),
|
|
456
|
+
enabled: v.optional(v.boolean()),
|
|
457
|
+
actorUserId: v.string(),
|
|
458
|
+
},
|
|
459
|
+
handler: async (ctx, args) => {
|
|
460
|
+
await options.auth(ctx, { type: "write" });
|
|
461
|
+
return await ctx.runMutation(component.lib.createPushTemplate, args);
|
|
462
|
+
},
|
|
463
|
+
}),
|
|
464
|
+
updatePushTemplate: mutationGeneric({
|
|
465
|
+
args: {
|
|
466
|
+
templateId: v.string(),
|
|
467
|
+
title: v.optional(v.string()),
|
|
468
|
+
text: v.optional(v.string()),
|
|
469
|
+
periodicity: v.optional(pushPeriodicityValidator),
|
|
470
|
+
suggestedTimes: v.optional(v.array(pushSuggestedTimeValidator)),
|
|
471
|
+
enabled: v.optional(v.boolean()),
|
|
472
|
+
actorUserId: v.string(),
|
|
473
|
+
},
|
|
474
|
+
handler: async (ctx, args) => {
|
|
475
|
+
await options.auth(ctx, { type: "write" });
|
|
476
|
+
return await ctx.runMutation(component.lib.updatePushTemplate, args);
|
|
477
|
+
},
|
|
478
|
+
}),
|
|
479
|
+
deletePushTemplate: mutationGeneric({
|
|
480
|
+
args: {
|
|
481
|
+
templateId: v.string(),
|
|
482
|
+
},
|
|
483
|
+
handler: async (ctx, args) => {
|
|
484
|
+
await options.auth(ctx, { type: "write" });
|
|
485
|
+
return await ctx.runMutation(component.lib.deletePushTemplate, args);
|
|
486
|
+
},
|
|
487
|
+
}),
|
|
488
|
+
listPushTemplatesByCompany: queryGeneric({
|
|
489
|
+
args: {
|
|
490
|
+
companyId: v.string(),
|
|
491
|
+
includeDisabled: v.optional(v.boolean()),
|
|
492
|
+
},
|
|
493
|
+
handler: async (ctx, args) => {
|
|
494
|
+
await options.auth(ctx, { type: "read" });
|
|
495
|
+
return await ctx.runQuery(component.lib.listPushTemplatesByCompany, args);
|
|
496
|
+
},
|
|
497
|
+
}),
|
|
498
|
+
createPushJobFromTemplate: mutationGeneric({
|
|
499
|
+
args: {
|
|
500
|
+
companyId: v.string(),
|
|
501
|
+
consumerUserId: v.string(),
|
|
502
|
+
templateId: v.string(),
|
|
503
|
+
timezone: v.string(),
|
|
504
|
+
schedule: v.optional(pushScheduleValidator),
|
|
505
|
+
enabled: v.optional(v.boolean()),
|
|
506
|
+
},
|
|
507
|
+
handler: async (ctx, args) => {
|
|
508
|
+
await options.auth(ctx, { type: "write" });
|
|
509
|
+
return await ctx.runMutation(component.lib.createPushJobFromTemplate, args);
|
|
510
|
+
},
|
|
511
|
+
}),
|
|
512
|
+
createPushJobCustom: mutationGeneric({
|
|
513
|
+
args: {
|
|
514
|
+
companyId: v.string(),
|
|
515
|
+
consumerUserId: v.string(),
|
|
516
|
+
title: v.string(),
|
|
517
|
+
text: v.string(),
|
|
518
|
+
periodicity: pushPeriodicityValidator,
|
|
519
|
+
timezone: v.string(),
|
|
520
|
+
schedule: pushScheduleValidator,
|
|
521
|
+
enabled: v.optional(v.boolean()),
|
|
522
|
+
},
|
|
523
|
+
handler: async (ctx, args) => {
|
|
524
|
+
await options.auth(ctx, { type: "write" });
|
|
525
|
+
return await ctx.runMutation(component.lib.createPushJobCustom, args);
|
|
526
|
+
},
|
|
527
|
+
}),
|
|
528
|
+
updatePushJob: mutationGeneric({
|
|
529
|
+
args: {
|
|
530
|
+
jobId: v.string(),
|
|
531
|
+
title: v.optional(v.string()),
|
|
532
|
+
text: v.optional(v.string()),
|
|
533
|
+
periodicity: v.optional(pushPeriodicityValidator),
|
|
534
|
+
timezone: v.optional(v.string()),
|
|
535
|
+
schedule: v.optional(pushScheduleValidator),
|
|
536
|
+
enabled: v.optional(v.boolean()),
|
|
537
|
+
},
|
|
538
|
+
handler: async (ctx, args) => {
|
|
539
|
+
await options.auth(ctx, { type: "write" });
|
|
540
|
+
return await ctx.runMutation(component.lib.updatePushJob, args);
|
|
541
|
+
},
|
|
542
|
+
}),
|
|
543
|
+
deletePushJob: mutationGeneric({
|
|
544
|
+
args: {
|
|
545
|
+
jobId: v.string(),
|
|
546
|
+
},
|
|
547
|
+
handler: async (ctx, args) => {
|
|
548
|
+
await options.auth(ctx, { type: "write" });
|
|
549
|
+
return await ctx.runMutation(component.lib.deletePushJob, args);
|
|
550
|
+
},
|
|
551
|
+
}),
|
|
552
|
+
setPushJobEnabled: mutationGeneric({
|
|
553
|
+
args: {
|
|
554
|
+
jobId: v.string(),
|
|
555
|
+
enabled: v.boolean(),
|
|
556
|
+
},
|
|
557
|
+
handler: async (ctx, args) => {
|
|
558
|
+
await options.auth(ctx, { type: "write" });
|
|
559
|
+
return await ctx.runMutation(component.lib.setPushJobEnabled, args);
|
|
560
|
+
},
|
|
561
|
+
}),
|
|
562
|
+
listPushJobsForUser: queryGeneric({
|
|
563
|
+
args: {
|
|
564
|
+
consumerUserId: v.string(),
|
|
565
|
+
includeDisabled: v.optional(v.boolean()),
|
|
566
|
+
},
|
|
567
|
+
handler: async (ctx, args) => {
|
|
568
|
+
await options.auth(ctx, { type: "read" });
|
|
569
|
+
return await ctx.runQuery(component.lib.listPushJobsForUser, args);
|
|
570
|
+
},
|
|
571
|
+
}),
|
|
572
|
+
triggerPushJobNow: mutationGeneric({
|
|
573
|
+
args: {
|
|
574
|
+
jobId: v.string(),
|
|
575
|
+
},
|
|
576
|
+
handler: async (ctx, args) => {
|
|
577
|
+
await options.auth(ctx, { type: "write" });
|
|
578
|
+
return await ctx.runMutation(component.lib.triggerPushJobNow, args);
|
|
579
|
+
},
|
|
580
|
+
}),
|
|
581
|
+
dispatchDuePushJobs: mutationGeneric({
|
|
582
|
+
args: {
|
|
583
|
+
nowMs: v.optional(v.number()),
|
|
584
|
+
limit: v.optional(v.number()),
|
|
585
|
+
},
|
|
586
|
+
handler: async (ctx, args) => {
|
|
587
|
+
await options.auth(ctx, { type: "write" });
|
|
588
|
+
return await ctx.runMutation(component.lib.dispatchDuePushJobs, args);
|
|
589
|
+
},
|
|
590
|
+
}),
|
|
591
|
+
sendBroadcastToAllActiveAgents: mutationGeneric({
|
|
592
|
+
args: {
|
|
593
|
+
companyId: v.string(),
|
|
594
|
+
title: v.string(),
|
|
595
|
+
text: v.string(),
|
|
596
|
+
requestedBy: v.string(),
|
|
597
|
+
},
|
|
598
|
+
handler: async (ctx, args) => {
|
|
599
|
+
await options.auth(ctx, { type: "write" });
|
|
600
|
+
return await ctx.runMutation(component.lib.sendBroadcastToAllActiveAgents, args);
|
|
601
|
+
},
|
|
602
|
+
}),
|
|
603
|
+
listPushDispatchesByJob: queryGeneric({
|
|
604
|
+
args: {
|
|
605
|
+
jobId: v.string(),
|
|
606
|
+
limit: v.optional(v.number()),
|
|
607
|
+
},
|
|
608
|
+
handler: async (ctx, args) => {
|
|
609
|
+
await options.auth(ctx, { type: "read" });
|
|
610
|
+
return await ctx.runQuery(component.lib.listPushDispatchesByJob, args);
|
|
611
|
+
},
|
|
612
|
+
}),
|
|
421
613
|
};
|
|
422
614
|
}
|
|
423
615
|
/**
|