@tai42/api-client 15.0.0 → 16.0.1
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/dist/client/agents-client.d.ts +26 -0
- package/dist/client/agents-client.d.ts.map +1 -0
- package/dist/client/agents-client.js +19 -0
- package/dist/client/agents-client.js.map +1 -0
- package/dist/client/auth-client.d.ts +205 -0
- package/dist/client/auth-client.d.ts.map +1 -0
- package/dist/client/auth-client.js +59 -0
- package/dist/client/auth-client.js.map +1 -0
- package/dist/client/backend-client.d.ts +39 -0
- package/dist/client/backend-client.d.ts.map +1 -0
- package/dist/client/backend-client.js +22 -0
- package/dist/client/backend-client.js.map +1 -0
- package/dist/client/backup-client.d.ts +56 -0
- package/dist/client/backup-client.d.ts.map +1 -0
- package/dist/client/backup-client.js +12 -0
- package/dist/client/backup-client.js.map +1 -0
- package/dist/client/capabilities-client.d.ts +35 -0
- package/dist/client/capabilities-client.d.ts.map +1 -0
- package/dist/client/capabilities-client.js +19 -0
- package/dist/client/capabilities-client.js.map +1 -0
- package/dist/client/channels-client.d.ts +7 -0
- package/dist/client/channels-client.d.ts.map +1 -0
- package/dist/client/channels-client.js +10 -0
- package/dist/client/channels-client.js.map +1 -0
- package/dist/client/config-client.d.ts +59 -0
- package/dist/client/config-client.d.ts.map +1 -0
- package/dist/client/config-client.js +18 -0
- package/dist/client/config-client.js.map +1 -0
- package/dist/client/connectors-client.d.ts +225 -0
- package/dist/client/connectors-client.d.ts.map +1 -0
- package/dist/client/connectors-client.js +31 -0
- package/dist/client/connectors-client.js.map +1 -0
- package/dist/client/conversations-client.d.ts +399 -0
- package/dist/client/conversations-client.d.ts.map +1 -0
- package/dist/client/conversations-client.js +120 -0
- package/dist/client/conversations-client.js.map +1 -0
- package/dist/client/hooks-client.d.ts +113 -0
- package/dist/client/hooks-client.d.ts.map +1 -0
- package/dist/client/hooks-client.js +25 -0
- package/dist/client/hooks-client.js.map +1 -0
- package/dist/{client.d.ts → client/index.d.ts} +2199 -2508
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +79 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/interactions-client.d.ts +52 -0
- package/dist/client/interactions-client.d.ts.map +1 -0
- package/dist/client/interactions-client.js +84 -0
- package/dist/client/interactions-client.js.map +1 -0
- package/dist/client/login-client.d.ts +56 -0
- package/dist/client/login-client.d.ts.map +1 -0
- package/dist/client/login-client.js +103 -0
- package/dist/client/login-client.js.map +1 -0
- package/dist/client/manifest-client.d.ts +354 -0
- package/dist/client/manifest-client.d.ts.map +1 -0
- package/dist/client/manifest-client.js +76 -0
- package/dist/client/manifest-client.js.map +1 -0
- package/dist/client/marketplace-client.d.ts +274 -0
- package/dist/client/marketplace-client.d.ts.map +1 -0
- package/dist/client/marketplace-client.js +46 -0
- package/dist/client/marketplace-client.js.map +1 -0
- package/dist/client/mcp-config-schema-client.d.ts +5 -0
- package/dist/client/mcp-config-schema-client.d.ts.map +1 -0
- package/dist/client/mcp-config-schema-client.js +9 -0
- package/dist/client/mcp-config-schema-client.js.map +1 -0
- package/dist/client/notifications-client.d.ts +27 -0
- package/dist/client/notifications-client.d.ts.map +1 -0
- package/dist/client/notifications-client.js +11 -0
- package/dist/client/notifications-client.js.map +1 -0
- package/dist/client/observability-client.d.ts +103 -0
- package/dist/client/observability-client.d.ts.map +1 -0
- package/dist/client/observability-client.js +43 -0
- package/dist/client/observability-client.js.map +1 -0
- package/dist/client/plugins-client.d.ts +17 -0
- package/dist/client/plugins-client.d.ts.map +1 -0
- package/dist/client/plugins-client.js +9 -0
- package/dist/client/plugins-client.js.map +1 -0
- package/dist/client/policy-client.d.ts +37 -0
- package/dist/client/policy-client.d.ts.map +1 -0
- package/dist/client/policy-client.js +26 -0
- package/dist/client/policy-client.js.map +1 -0
- package/dist/client/presets-client.d.ts +335 -0
- package/dist/client/presets-client.d.ts.map +1 -0
- package/dist/client/presets-client.js +38 -0
- package/dist/client/presets-client.js.map +1 -0
- package/dist/client/profiles-client.d.ts +102 -0
- package/dist/client/profiles-client.d.ts.map +1 -0
- package/dist/client/profiles-client.js +37 -0
- package/dist/client/profiles-client.js.map +1 -0
- package/dist/client/schedules-client.d.ts +28 -0
- package/dist/client/schedules-client.d.ts.map +1 -0
- package/dist/client/schedules-client.js +13 -0
- package/dist/client/schedules-client.js.map +1 -0
- package/dist/client/settings-schema-client.d.ts +23 -0
- package/dist/client/settings-schema-client.d.ts.map +1 -0
- package/dist/client/settings-schema-client.js +9 -0
- package/dist/client/settings-schema-client.js.map +1 -0
- package/dist/client/states-client.d.ts +471 -0
- package/dist/client/states-client.d.ts.map +1 -0
- package/dist/client/states-client.js +144 -0
- package/dist/client/states-client.js.map +1 -0
- package/dist/client/storage-client.d.ts +40 -0
- package/dist/client/storage-client.d.ts.map +1 -0
- package/dist/client/storage-client.js +43 -0
- package/dist/client/storage-client.js.map +1 -0
- package/dist/client/sub-mcp-client.d.ts +17 -0
- package/dist/client/sub-mcp-client.d.ts.map +1 -0
- package/dist/client/sub-mcp-client.js +14 -0
- package/dist/client/sub-mcp-client.js.map +1 -0
- package/dist/client/system-client.d.ts +11 -0
- package/dist/client/system-client.d.ts.map +1 -0
- package/dist/client/system-client.js +13 -0
- package/dist/client/system-client.js.map +1 -0
- package/dist/client/templates-client.d.ts +29 -0
- package/dist/client/templates-client.d.ts.map +1 -0
- package/dist/client/templates-client.js +21 -0
- package/dist/client/templates-client.js.map +1 -0
- package/dist/client/tool-extensions-client.d.ts +54 -0
- package/dist/client/tool-extensions-client.d.ts.map +1 -0
- package/dist/client/tool-extensions-client.js +21 -0
- package/dist/client/tool-extensions-client.js.map +1 -0
- package/dist/client/tool-meta-client.d.ts +69 -0
- package/dist/client/tool-meta-client.d.ts.map +1 -0
- package/dist/client/tool-meta-client.js +38 -0
- package/dist/client/tool-meta-client.js.map +1 -0
- package/dist/client/tools-client.d.ts +83 -0
- package/dist/client/tools-client.d.ts.map +1 -0
- package/dist/client/tools-client.js +38 -0
- package/dist/client/tools-client.js.map +1 -0
- package/dist/client/transport.d.ts +13 -0
- package/dist/client/transport.d.ts.map +1 -0
- package/dist/client/transport.js +10 -0
- package/dist/client/transport.js.map +1 -0
- package/dist/client/trigger-links-client.d.ts +44 -0
- package/dist/client/trigger-links-client.d.ts.map +1 -0
- package/dist/client/trigger-links-client.js +30 -0
- package/dist/client/trigger-links-client.js.map +1 -0
- package/dist/client/web-entry-gate-client.d.ts +34 -0
- package/dist/client/web-entry-gate-client.d.ts.map +1 -0
- package/dist/client/web-entry-gate-client.js +25 -0
- package/dist/client/web-entry-gate-client.js.map +1 -0
- package/dist/generated/served-schemas.d.ts +748 -0
- package/dist/generated/served-schemas.d.ts.map +1 -0
- package/dist/generated/served-schemas.js +60 -0
- package/dist/generated/served-schemas.js.map +1 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +33 -17
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/schemas/api-keys.d.ts +34 -0
- package/dist/schemas/api-keys.d.ts.map +1 -0
- package/dist/schemas/api-keys.js +22 -0
- package/dist/schemas/api-keys.js.map +1 -0
- package/dist/schemas/auth-routes.d.ts +78 -0
- package/dist/schemas/auth-routes.d.ts.map +1 -0
- package/dist/schemas/auth-routes.js +42 -0
- package/dist/schemas/auth-routes.js.map +1 -0
- package/dist/schemas/backup.d.ts +78 -0
- package/dist/schemas/backup.d.ts.map +1 -0
- package/dist/schemas/backup.js +33 -0
- package/dist/schemas/backup.js.map +1 -0
- package/dist/schemas/capabilities.d.ts +99 -0
- package/dist/schemas/capabilities.d.ts.map +1 -0
- package/dist/schemas/capabilities.js +74 -0
- package/dist/schemas/capabilities.js.map +1 -0
- package/dist/schemas/channels.d.ts +7 -0
- package/dist/schemas/channels.d.ts.map +1 -0
- package/dist/schemas/channels.js +9 -0
- package/dist/schemas/channels.js.map +1 -0
- package/dist/schemas/config.d.ts +17 -0
- package/dist/schemas/config.d.ts.map +1 -0
- package/dist/schemas/config.js +17 -0
- package/dist/schemas/config.js.map +1 -0
- package/dist/schemas/connectors.d.ts +383 -0
- package/dist/schemas/connectors.d.ts.map +1 -0
- package/dist/schemas/connectors.js +122 -0
- package/dist/schemas/connectors.js.map +1 -0
- package/dist/schemas/conversations.d.ts +600 -0
- package/dist/schemas/conversations.d.ts.map +1 -0
- package/dist/schemas/conversations.js +208 -0
- package/dist/schemas/conversations.js.map +1 -0
- package/dist/schemas/extensions.d.ts +44 -0
- package/dist/schemas/extensions.d.ts.map +1 -0
- package/dist/schemas/extensions.js +29 -0
- package/dist/schemas/extensions.js.map +1 -0
- package/dist/schemas/fleet.d.ts +271 -0
- package/dist/schemas/fleet.d.ts.map +1 -0
- package/dist/schemas/fleet.js +132 -0
- package/dist/schemas/fleet.js.map +1 -0
- package/dist/schemas/hooks.d.ts +120 -0
- package/dist/schemas/hooks.d.ts.map +1 -0
- package/dist/schemas/hooks.js +44 -0
- package/dist/schemas/hooks.js.map +1 -0
- package/dist/schemas/index.d.ts +38 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +38 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/interactions.d.ts +156 -0
- package/dist/schemas/interactions.d.ts.map +1 -0
- package/dist/schemas/interactions.js +124 -0
- package/dist/schemas/interactions.js.map +1 -0
- package/dist/schemas/login.d.ts +86 -0
- package/dist/schemas/login.d.ts.map +1 -0
- package/dist/schemas/login.js +54 -0
- package/dist/schemas/login.js.map +1 -0
- package/dist/schemas/manifest-mcp.d.ts +125 -0
- package/dist/schemas/manifest-mcp.d.ts.map +1 -0
- package/dist/schemas/manifest-mcp.js +61 -0
- package/dist/schemas/manifest-mcp.js.map +1 -0
- package/dist/schemas/marketplace.d.ts +708 -0
- package/dist/schemas/marketplace.d.ts.map +1 -0
- package/dist/schemas/marketplace.js +387 -0
- package/dist/schemas/marketplace.js.map +1 -0
- package/dist/schemas/notifications.d.ts +61 -0
- package/dist/schemas/notifications.d.ts.map +1 -0
- package/dist/schemas/notifications.js +38 -0
- package/dist/schemas/notifications.js.map +1 -0
- package/dist/schemas/observability.d.ts +114 -0
- package/dist/schemas/observability.d.ts.map +1 -0
- package/dist/schemas/observability.js +74 -0
- package/dist/schemas/observability.js.map +1 -0
- package/dist/schemas/policy.d.ts +58 -0
- package/dist/schemas/policy.d.ts.map +1 -0
- package/dist/schemas/policy.js +32 -0
- package/dist/schemas/policy.js.map +1 -0
- package/dist/schemas/presets.d.ts +258 -0
- package/dist/schemas/presets.d.ts.map +1 -0
- package/dist/schemas/presets.js +95 -0
- package/dist/schemas/presets.js.map +1 -0
- package/dist/schemas/profiles.d.ts +180 -0
- package/dist/schemas/profiles.d.ts.map +1 -0
- package/dist/schemas/profiles.js +100 -0
- package/dist/schemas/profiles.js.map +1 -0
- package/dist/schemas/roles.d.ts +125 -0
- package/dist/schemas/roles.d.ts.map +1 -0
- package/dist/schemas/roles.js +46 -0
- package/dist/schemas/roles.js.map +1 -0
- package/dist/schemas/schedules.d.ts +25 -0
- package/dist/schemas/schedules.d.ts.map +1 -0
- package/dist/schemas/schedules.js +24 -0
- package/dist/schemas/schedules.js.map +1 -0
- package/dist/schemas/served.d.ts +626 -0
- package/dist/schemas/served.d.ts.map +1 -0
- package/dist/schemas/served.js +28 -0
- package/dist/schemas/served.js.map +1 -0
- package/dist/schemas/settings-schema.d.ts +23 -0
- package/dist/schemas/settings-schema.d.ts.map +1 -0
- package/dist/schemas/settings-schema.js +25 -0
- package/dist/schemas/settings-schema.js.map +1 -0
- package/dist/schemas/shared.d.ts +20 -0
- package/dist/schemas/shared.d.ts.map +1 -0
- package/dist/schemas/shared.js +20 -0
- package/dist/schemas/shared.js.map +1 -0
- package/dist/schemas/states.d.ts +499 -0
- package/dist/schemas/states.d.ts.map +1 -0
- package/dist/schemas/states.js +220 -0
- package/dist/schemas/states.js.map +1 -0
- package/dist/schemas/storage.d.ts +37 -0
- package/dist/schemas/storage.d.ts.map +1 -0
- package/dist/schemas/storage.js +24 -0
- package/dist/schemas/storage.js.map +1 -0
- package/dist/schemas/studio-plugins.d.ts +30 -0
- package/dist/schemas/studio-plugins.d.ts.map +1 -0
- package/dist/schemas/studio-plugins.js +20 -0
- package/dist/schemas/studio-plugins.js.map +1 -0
- package/dist/schemas/sub-mcp.d.ts +29 -0
- package/dist/schemas/sub-mcp.d.ts.map +1 -0
- package/dist/schemas/sub-mcp.js +22 -0
- package/dist/schemas/sub-mcp.js.map +1 -0
- package/dist/schemas/system-kinds.d.ts +122 -0
- package/dist/schemas/system-kinds.d.ts.map +1 -0
- package/dist/schemas/system-kinds.js +40 -0
- package/dist/schemas/system-kinds.js.map +1 -0
- package/dist/schemas/templates.d.ts +26 -0
- package/dist/schemas/templates.d.ts.map +1 -0
- package/dist/schemas/templates.js +11 -0
- package/dist/schemas/templates.js.map +1 -0
- package/dist/schemas/tool-meta.d.ts +64 -0
- package/dist/schemas/tool-meta.d.ts.map +1 -0
- package/dist/schemas/tool-meta.js +44 -0
- package/dist/schemas/tool-meta.js.map +1 -0
- package/dist/schemas/tools.d.ts +62 -0
- package/dist/schemas/tools.d.ts.map +1 -0
- package/dist/schemas/tools.js +53 -0
- package/dist/schemas/tools.js.map +1 -0
- package/dist/schemas/trigger-links.d.ts +71 -0
- package/dist/schemas/trigger-links.d.ts.map +1 -0
- package/dist/schemas/trigger-links.js +46 -0
- package/dist/schemas/trigger-links.js.map +1 -0
- package/dist/schemas/web-entry.d.ts +45 -0
- package/dist/schemas/web-entry.d.ts.map +1 -0
- package/dist/schemas/web-entry.js +36 -0
- package/dist/schemas/web-entry.js.map +1 -0
- package/dist/templated-text.d.ts +30 -0
- package/dist/templated-text.d.ts.map +1 -0
- package/dist/templated-text.js +30 -0
- package/dist/templated-text.js.map +1 -0
- package/dist/tool-runs.d.ts +4 -4
- package/package.json +6 -2
- package/src/client/agents-client.ts +23 -0
- package/src/client/auth-client.ts +144 -0
- package/src/client/backend-client.ts +25 -0
- package/src/client/backup-client.ts +16 -0
- package/src/client/capabilities-client.ts +22 -0
- package/src/client/channels-client.ts +11 -0
- package/src/client/config-client.ts +21 -0
- package/src/client/connectors-client.ts +52 -0
- package/src/client/conversations-client.ts +240 -0
- package/src/client/hooks-client.ts +44 -0
- package/src/client/index.ts +122 -0
- package/src/client/interactions-client.ts +89 -0
- package/src/client/login-client.ts +109 -0
- package/src/client/manifest-client.ts +118 -0
- package/src/client/marketplace-client.ts +122 -0
- package/src/client/mcp-config-schema-client.ts +11 -0
- package/src/client/notifications-client.ts +13 -0
- package/src/client/observability-client.ts +82 -0
- package/src/client/plugins-client.ts +11 -0
- package/src/client/policy-client.ts +41 -0
- package/src/client/presets-client.ts +124 -0
- package/src/client/profiles-client.ts +51 -0
- package/src/client/schedules-client.ts +22 -0
- package/src/client/settings-schema-client.ts +11 -0
- package/src/client/states-client.ts +292 -0
- package/src/client/storage-client.ts +63 -0
- package/src/client/sub-mcp-client.ts +17 -0
- package/src/client/system-client.ts +16 -0
- package/src/client/templates-client.ts +28 -0
- package/src/client/tool-extensions-client.ts +24 -0
- package/src/client/tool-meta-client.ts +65 -0
- package/src/client/tools-client.ts +66 -0
- package/src/client/transport.ts +18 -0
- package/src/client/trigger-links-client.ts +51 -0
- package/src/client/web-entry-gate-client.ts +45 -0
- package/src/generated/served-schemas.ts +126 -0
- package/src/http.ts +48 -24
- package/src/index.ts +1 -0
- package/src/schemas/api-keys.ts +26 -0
- package/src/schemas/auth-routes.ts +48 -0
- package/src/schemas/backup.ts +42 -0
- package/src/schemas/capabilities.ts +87 -0
- package/src/schemas/channels.ts +11 -0
- package/src/schemas/config.ts +17 -0
- package/src/schemas/connectors.ts +138 -0
- package/src/schemas/conversations.ts +256 -0
- package/src/schemas/extensions.ts +34 -0
- package/src/schemas/fleet.ts +153 -0
- package/src/schemas/hooks.ts +56 -0
- package/src/schemas/index.ts +37 -0
- package/src/schemas/interactions.ts +146 -0
- package/src/schemas/login.ts +62 -0
- package/src/schemas/manifest-mcp.ts +69 -0
- package/src/schemas/marketplace.ts +447 -0
- package/src/schemas/notifications.ts +42 -0
- package/src/schemas/observability.ts +86 -0
- package/src/schemas/policy.ts +37 -0
- package/src/schemas/presets.ts +113 -0
- package/src/schemas/profiles.ts +119 -0
- package/src/schemas/roles.ts +57 -0
- package/src/schemas/schedules.ts +27 -0
- package/src/schemas/served.ts +49 -0
- package/src/schemas/settings-schema.ts +31 -0
- package/src/schemas/shared.ts +21 -0
- package/src/schemas/states.ts +272 -0
- package/src/schemas/storage.ts +31 -0
- package/src/schemas/studio-plugins.ts +21 -0
- package/src/schemas/sub-mcp.ts +24 -0
- package/src/schemas/system-kinds.ts +46 -0
- package/src/schemas/templates.ts +11 -0
- package/src/schemas/tool-meta.ts +51 -0
- package/src/schemas/tools.ts +61 -0
- package/src/schemas/trigger-links.ts +54 -0
- package/src/schemas/web-entry.ts +46 -0
- package/src/templated-text.ts +35 -0
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -920
- package/dist/client.js.map +0 -1
- package/dist/schemas.d.ts +0 -5152
- package/dist/schemas.d.ts.map +0 -1
- package/dist/schemas.js +0 -2556
- package/dist/schemas.js.map +0 -1
- package/src/client.ts +0 -1765
- package/src/schemas.ts +0 -3067
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/** Backend identity and worker-bus fleet/fan-out response schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { jsonValue } from './shared';
|
|
4
|
+
|
|
5
|
+
/** `GET /api/backend` — the execution-backend identity, or the absent sentinel
|
|
6
|
+
* (`present: false`, a 200) when no backend plugin is registered. Backend identity
|
|
7
|
+
* is kept distinct from the fleet: the fleet doors ride the app's worker bus and
|
|
8
|
+
* need no backend at all. */
|
|
9
|
+
export const backendInfo = z.object({
|
|
10
|
+
present: z.boolean(),
|
|
11
|
+
backend: z.string().nullable(),
|
|
12
|
+
module: z.string().nullable(),
|
|
13
|
+
});
|
|
14
|
+
export type BackendInfo = z.infer<typeof backendInfo>;
|
|
15
|
+
|
|
16
|
+
/** The two worker kinds that join the bus: an ASGI `serve` worker or a
|
|
17
|
+
* `backend` runtime process. A drift throws `ApiSchemaError`. */
|
|
18
|
+
export const workerKind = z.enum(['serve', 'backend']);
|
|
19
|
+
export type WorkerKind = z.infer<typeof workerKind>;
|
|
20
|
+
|
|
21
|
+
/** The lifecycle state a worker advertises in its presence value: `ready` once its
|
|
22
|
+
* resync has converged, `resyncing` while a boot/reconnect resync runs, `recycling`
|
|
23
|
+
* once it has begun a graceful self-exit. A drift throws `ApiSchemaError`. */
|
|
24
|
+
export const workerState = z.enum(['ready', 'resyncing', 'recycling']);
|
|
25
|
+
export type WorkerState = z.infer<typeof workerState>;
|
|
26
|
+
|
|
27
|
+
/** The last op a worker applied, stamped onto its presence row after the terminal
|
|
28
|
+
* reply. `outcome` is the free op-outcome string; `at` is the ISO instant it landed. */
|
|
29
|
+
export const workerLastOp = z.object({
|
|
30
|
+
op: z.string(),
|
|
31
|
+
outcome: z.string(),
|
|
32
|
+
at: z.string(),
|
|
33
|
+
});
|
|
34
|
+
export type WorkerLastOp = z.infer<typeof workerLastOp>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* One live worker on the bus — a presence-census row. `name` is the stable slot
|
|
38
|
+
* (`{kind}-{n}`) that doubles as a reload target; `generation` is the monotonic life
|
|
39
|
+
* counter minted with the worker's claim; `kind` tells the two worker kinds apart;
|
|
40
|
+
* `pid` is the process id. `joined_at`/`beat_at` are ISO instants (first-seen and last
|
|
41
|
+
* heartbeat) for the cosmetic seen-since display; `state` is the advertised lifecycle
|
|
42
|
+
* state; `stale` is SERVER-computed from the row's remaining presence TTL against the
|
|
43
|
+
* bus cadence (a quiet row past the freshness bound — reconnecting or dead) and is the
|
|
44
|
+
* only freshness signal a client reads, never a client-side threshold; `last_op` is the
|
|
45
|
+
* worker's last applied op, or `null` before it has applied one.
|
|
46
|
+
*/
|
|
47
|
+
export const fleetWorker = z.object({
|
|
48
|
+
name: z.string(),
|
|
49
|
+
kind: workerKind,
|
|
50
|
+
pid: z.number(),
|
|
51
|
+
generation: z.number(),
|
|
52
|
+
joined_at: z.string(),
|
|
53
|
+
beat_at: z.string(),
|
|
54
|
+
state: workerState,
|
|
55
|
+
stale: z.boolean(),
|
|
56
|
+
last_op: workerLastOp.nullable(),
|
|
57
|
+
});
|
|
58
|
+
export type FleetWorker = z.infer<typeof fleetWorker>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* `GET /api/fleet/workers` — the live worker fleet from the bus presence census.
|
|
62
|
+
* The census lists ALL subscribed workers (ASGI `serve` workers and backend-runtime
|
|
63
|
+
* processes alike), not only backend workers. A census read that fails surfaces as a
|
|
64
|
+
* loud 500, never a fabricated empty fleet.
|
|
65
|
+
*/
|
|
66
|
+
export const fleetWorkers = z.object({ workers: z.array(fleetWorker) });
|
|
67
|
+
export type FleetWorkers = z.infer<typeof fleetWorkers>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* One worker's outcome within a fleet broadcast. `applied`/`failed` are terminal wire
|
|
71
|
+
* replies from a subscriber; `missing`/`departed`/`timed_out` are publisher-computed
|
|
72
|
+
* from the presence census (a silent worker never sends them); `resyncing`/`recycling`/
|
|
73
|
+
* `stale` are the gap outcomes for a row that failed the ready+fresh gate — reported as
|
|
74
|
+
* its own actual condition rather than dropped (`resyncing` converges on its resync,
|
|
75
|
+
* `recycling` is departing, `stale` is a quiet row past the freshness bound carrying no
|
|
76
|
+
* convergence promise).
|
|
77
|
+
*/
|
|
78
|
+
export const fleetOutcome = z.enum([
|
|
79
|
+
'applied',
|
|
80
|
+
'failed',
|
|
81
|
+
'missing',
|
|
82
|
+
'departed',
|
|
83
|
+
'timed_out',
|
|
84
|
+
'resyncing',
|
|
85
|
+
'recycling',
|
|
86
|
+
'stale',
|
|
87
|
+
]);
|
|
88
|
+
export type FleetOutcome = z.infer<typeof fleetOutcome>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* One worker's result within a {@link fleetResult}. `payload` carries query-op data
|
|
92
|
+
* (opaque to the UI); `error` carries a failed apply's message; `detail` carries the
|
|
93
|
+
* publisher's report text for a computed gap outcome (`missing`/`departed`/`timed_out`/
|
|
94
|
+
* `resyncing`/`recycling`/`stale`). A drift throws `ApiSchemaError`.
|
|
95
|
+
*/
|
|
96
|
+
export const fleetWorkerResult = z.object({
|
|
97
|
+
name: z.string(),
|
|
98
|
+
outcome: fleetOutcome,
|
|
99
|
+
payload: jsonValue,
|
|
100
|
+
error: z.string().nullable(),
|
|
101
|
+
detail: z.string().nullable(),
|
|
102
|
+
});
|
|
103
|
+
export type FleetWorkerResult = z.infer<typeof fleetWorkerResult>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The awaited per-worker report of one fleet broadcast. Two honest shapes ride the
|
|
107
|
+
* same schema. Reachable (`reachable: true`): `results` holds one entry per expected
|
|
108
|
+
* worker (the serving worker's own entry included) plus the gap rows, so an unconfirmed
|
|
109
|
+
* sibling is a visible `failed`/`missing`/`departed`/`timed_out`/`resyncing`/`recycling`/
|
|
110
|
+
* `stale` entry, never a silent stale worker. Bus-unreachable (`reachable: false`): the
|
|
111
|
+
* transport failed before any worker could reply, so `results` is empty and only `error`
|
|
112
|
+
* is carried. This is the bare body of `POST /api/fleet/reload-config` and the single-MCP
|
|
113
|
+
* reload; it is also the body the mode-wrapped {@link fleetReportFanout} carries under its
|
|
114
|
+
* `fleet` / `unreachable` modes.
|
|
115
|
+
*/
|
|
116
|
+
export const fleetResult = z.object({
|
|
117
|
+
op: z.string(),
|
|
118
|
+
reachable: z.boolean(),
|
|
119
|
+
local_only: z.boolean(),
|
|
120
|
+
results: z.array(fleetWorkerResult),
|
|
121
|
+
error: z.string().nullable(),
|
|
122
|
+
});
|
|
123
|
+
export type FleetResult = z.infer<typeof fleetResult>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* `POST /api/fleet/reload-config` — soft-restart the fleet and report per-worker. The
|
|
127
|
+
* serving worker applies its own reload first, then broadcasts; the returned report
|
|
128
|
+
* names every worker's outcome. A failed local apply does not abort the broadcast, so
|
|
129
|
+
* the report is embedded even on the convergence-failure path.
|
|
130
|
+
*/
|
|
131
|
+
export const fleetReloadResult = fleetResult;
|
|
132
|
+
export type FleetReloadResult = z.infer<typeof fleetReloadResult>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The mode-wrapped fan-out summary a mutation embeds under its `fanout` field. Three
|
|
136
|
+
* honest modes, discriminated on `mode`:
|
|
137
|
+
* - `local-only` — the broadcast reached no sibling (a lone worker / no bus), a
|
|
138
|
+
* benign single-process note.
|
|
139
|
+
* - `fleet` — a reachable multi-worker broadcast; carries the full {@link
|
|
140
|
+
* fleetResult} so an unconfirmed sibling is visible.
|
|
141
|
+
* - `unreachable` — the bus itself could not be reached; carries the
|
|
142
|
+
* bus-unreachable {@link fleetResult} (no worker list, only `error`).
|
|
143
|
+
*
|
|
144
|
+
* Every mutation whose response embeds this parses it EXPLICITLY: zod's default
|
|
145
|
+
* unknown-key stripping would otherwise silently drop the field, hiding a failed
|
|
146
|
+
* propagation from the shared fleet-report handler. A drift throws `ApiSchemaError`.
|
|
147
|
+
*/
|
|
148
|
+
export const fleetReportFanout = z.discriminatedUnion('mode', [
|
|
149
|
+
z.object({ mode: z.literal('local-only'), note: z.string() }),
|
|
150
|
+
fleetResult.extend({ mode: z.literal('fleet') }),
|
|
151
|
+
fleetResult.extend({ mode: z.literal('unreachable') }),
|
|
152
|
+
]);
|
|
153
|
+
export type FleetReportFanout = z.infer<typeof fleetReportFanout>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** Hook listing, registration and topic-verifier response schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { hookParams } from './served';
|
|
4
|
+
|
|
5
|
+
// The hand-written hook response DTOs: the fire-door authority enum, the list rows and
|
|
6
|
+
// their wrapper, and the per-topic verifier/trigger metadata. The served hook DOCUMENT
|
|
7
|
+
// schemas (`hookSubject`/`hookParams`/`hookRegister`) are generated from the contract
|
|
8
|
+
// bundle and re-exported at the top of this file, not defined here.
|
|
9
|
+
|
|
10
|
+
/** A fire door — who may trigger a path, not what the fire may do. A string enum. */
|
|
11
|
+
export const triggerAuth = z.enum([
|
|
12
|
+
'public',
|
|
13
|
+
'verifier',
|
|
14
|
+
'token',
|
|
15
|
+
'token+api_key',
|
|
16
|
+
'out-of-service',
|
|
17
|
+
]);
|
|
18
|
+
export type TriggerAuth = z.infer<typeof triggerAuth>;
|
|
19
|
+
|
|
20
|
+
export const hookList = z.object({
|
|
21
|
+
items: z.array(hookParams),
|
|
22
|
+
total: z.number(),
|
|
23
|
+
// Per-topic verifier bindings: the topic name maps to the verifier bound to it
|
|
24
|
+
// and that verifier's config (which carries a `secret_env` name, never a secret
|
|
25
|
+
// value). Tolerant of an older/empty response, which omits the key entirely.
|
|
26
|
+
topic_verifiers: z
|
|
27
|
+
.record(
|
|
28
|
+
z.string(),
|
|
29
|
+
z.object({ verifier: z.string(), config: z.record(z.string(), z.unknown()) }),
|
|
30
|
+
)
|
|
31
|
+
.default({}),
|
|
32
|
+
// Per-topic fire door (topic → door). Tolerant of an older response omitting it.
|
|
33
|
+
trigger_auth: z.record(z.string(), triggerAuth).default({}),
|
|
34
|
+
});
|
|
35
|
+
export type HookList = z.infer<typeof hookList>;
|
|
36
|
+
|
|
37
|
+
export const hookRegistered = z.object({
|
|
38
|
+
registered: z.boolean(),
|
|
39
|
+
name: z.string(),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const hookRemoved = z.object({
|
|
43
|
+
removed: z.boolean(),
|
|
44
|
+
name: z.string(),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// The registered webhook-verifier catalog (`GET /api/hooks/verifiers`) — the
|
|
48
|
+
// sorted verifier NAMES only, never any verifier's config. An empty registry is a
|
|
49
|
+
// valid empty array. This is the ONLY source the topic-verifier bind picker reads.
|
|
50
|
+
export const hookVerifiers = z.array(z.string());
|
|
51
|
+
|
|
52
|
+
/** `PUT /api/hooks/topics/{topic}/verifier` — the bound topic + verifier name. */
|
|
53
|
+
export const topicVerifierSet = z.object({ topic: z.string(), verifier: z.string() });
|
|
54
|
+
|
|
55
|
+
/** `DELETE /api/hooks/topics/{topic}/verifier` — the unbound topic. */
|
|
56
|
+
export const topicVerifierRemoved = z.object({ removed: z.boolean(), topic: z.string() });
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Public barrel for the api-client response/DTO schemas. */
|
|
2
|
+
export * from './served';
|
|
3
|
+
export { jsonSchema, jsonValue } from './shared';
|
|
4
|
+
export * from './tools';
|
|
5
|
+
export * from './extensions';
|
|
6
|
+
export * from './presets';
|
|
7
|
+
export * from './tool-meta';
|
|
8
|
+
export * from './templates';
|
|
9
|
+
export * from './storage';
|
|
10
|
+
export * from './fleet';
|
|
11
|
+
export * from './manifest-mcp';
|
|
12
|
+
export * from './system-kinds';
|
|
13
|
+
export * from './sub-mcp';
|
|
14
|
+
export * from './config';
|
|
15
|
+
export * from './profiles';
|
|
16
|
+
export * from './connectors';
|
|
17
|
+
export * from './studio-plugins';
|
|
18
|
+
export * from './interactions';
|
|
19
|
+
export * from './channels';
|
|
20
|
+
export * from './conversations';
|
|
21
|
+
export * from './web-entry';
|
|
22
|
+
export * from './notifications';
|
|
23
|
+
export * from './hooks';
|
|
24
|
+
export * from './trigger-links';
|
|
25
|
+
export * from './settings-schema';
|
|
26
|
+
export * from './auth-routes';
|
|
27
|
+
export * from './roles';
|
|
28
|
+
export * from './api-keys';
|
|
29
|
+
export * from './login';
|
|
30
|
+
export * from './capabilities';
|
|
31
|
+
export * from './policy';
|
|
32
|
+
export * from './backup';
|
|
33
|
+
export * from './schedules';
|
|
34
|
+
export * from './observability';
|
|
35
|
+
export * from './marketplace';
|
|
36
|
+
export * from './states';
|
|
37
|
+
export { toolRunSubmitResult, toolRunRecord, toolRunList } from '../tool-runs';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/** Interaction question, answer and media response schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { pageWindow } from './shared';
|
|
4
|
+
|
|
5
|
+
// Shapes match the skeleton's interactions SSE contract: the SSE
|
|
6
|
+
// `interaction.add` frame carries the question and its answer format; the answer
|
|
7
|
+
// door returns { interaction_id, status }. `answered` is not a wire field — it
|
|
8
|
+
// is a client-side flag the stream hook flips on an `interaction.answered` event.
|
|
9
|
+
|
|
10
|
+
export const answerFormat = z.enum(['text', 'confirm', 'select', 'form', 'external']);
|
|
11
|
+
export type AnswerFormat = z.infer<typeof answerFormat>;
|
|
12
|
+
|
|
13
|
+
/** The kind of a question's display-only media item: a remote/inline image, or a link. */
|
|
14
|
+
export const mediaKind = z.enum(['image', 'link']);
|
|
15
|
+
export type MediaKind = z.infer<typeof mediaKind>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* One item of a question's display-only media. Applied PER ITEM by the renderer
|
|
19
|
+
* (never as a strict array on the frame): the frame's `media` field is a loose
|
|
20
|
+
* `z.array(z.unknown())`, and the renderer `safeParse`s each item with this schema
|
|
21
|
+
* so one malformed/hostile item is a loud per-item notice, not a whole-frame parse
|
|
22
|
+
* failure that would silently vanish an answerable question.
|
|
23
|
+
*
|
|
24
|
+
* `caption` is `.nullish()` (absent OR `null` both parse to a caption-less item):
|
|
25
|
+
* a caption-less item may arrive with the key omitted OR with an explicit `null`, so
|
|
26
|
+
* `.optional()` here would false-fail the explicit `null` and render a good image as
|
|
27
|
+
* malformed. `url` and `kind` are the only load-bearing fields; the image
|
|
28
|
+
* src scheme gate and the link neutralization are enforced by the renderer.
|
|
29
|
+
*/
|
|
30
|
+
export const interactionMediaItem = z.object({
|
|
31
|
+
kind: mediaKind,
|
|
32
|
+
url: z.string(),
|
|
33
|
+
caption: z.string().nullish(),
|
|
34
|
+
});
|
|
35
|
+
export type InteractionMediaItem = z.infer<typeof interactionMediaItem>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* One per-send choice for a `form` property whose schema is a string (or array of
|
|
39
|
+
* strings). `value` is what the answer carries; `label` (absent OR null both parse
|
|
40
|
+
* to no label) is the human text shown in its place. A send may replace a property's
|
|
41
|
+
* `enum` this way for one ask without republishing the form. Applied per property by
|
|
42
|
+
* the form preview (safeParsed), so a malformed entry is a loud notice, never silent.
|
|
43
|
+
*/
|
|
44
|
+
export const formOption = z.object({
|
|
45
|
+
value: z.string(),
|
|
46
|
+
label: z.string().nullish(),
|
|
47
|
+
});
|
|
48
|
+
export type FormOption = z.infer<typeof formOption>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Per-send `form` data: `values` prefills top-level properties (keyed by property
|
|
52
|
+
* name), `options` supplies per-send choice lists (keyed by property name). Both
|
|
53
|
+
* default to empty. The form preview safeParses this off `format_payload.data`, so a
|
|
54
|
+
* malformed block is a loud notice rather than a whole-frame parse failure.
|
|
55
|
+
*/
|
|
56
|
+
export const formData = z.object({
|
|
57
|
+
values: z.record(z.string(), z.unknown()).default({}),
|
|
58
|
+
options: z.record(z.string(), z.array(formOption)).default({}),
|
|
59
|
+
});
|
|
60
|
+
export type FormData = z.infer<typeof formData>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* One page of a stepped `form`: a `title` and the ordered top-level property names it
|
|
64
|
+
* groups. `format_payload.pages` is the ordered list of these; absent = one page. The
|
|
65
|
+
* form preview safeParses the list, so a malformed page is a loud notice, never silent.
|
|
66
|
+
*/
|
|
67
|
+
export const formPage = z.object({
|
|
68
|
+
title: z.string(),
|
|
69
|
+
fields: z.array(z.string()),
|
|
70
|
+
});
|
|
71
|
+
export type FormPage = z.infer<typeof formPage>;
|
|
72
|
+
|
|
73
|
+
/** The `form` pages list (`format_payload.pages`), safeParsed as a whole by the preview. */
|
|
74
|
+
export const formPages = z.array(formPage);
|
|
75
|
+
export type FormPages = z.infer<typeof formPages>;
|
|
76
|
+
|
|
77
|
+
export const interaction = z.object({
|
|
78
|
+
interaction_id: z.string(),
|
|
79
|
+
group_id: z.string(),
|
|
80
|
+
question: z.string().default(''),
|
|
81
|
+
answer_format: answerFormat,
|
|
82
|
+
// Format-specific payload: select options, form JSON schema (with optional per-send
|
|
83
|
+
// `data` and `pages`), external url. The wire sends `null` for formats that carry
|
|
84
|
+
// none (text/confirm); it is normalized to `{}` so consumers always see an object.
|
|
85
|
+
format_payload: z
|
|
86
|
+
.record(z.string(), z.unknown())
|
|
87
|
+
.nullish()
|
|
88
|
+
.transform((value) => value ?? {}),
|
|
89
|
+
created_at: z.string(),
|
|
90
|
+
timeout_at: z.string(),
|
|
91
|
+
// Whether the answer body is sensitive and never persisted server-side. Rides
|
|
92
|
+
// every add frame; an absent value (older frame) normalizes to false.
|
|
93
|
+
sensitive: z.boolean().default(false),
|
|
94
|
+
// True only for an external question answered by a signed server-to-server
|
|
95
|
+
// callback (never by a human); the frame never carries the verifier object.
|
|
96
|
+
// Absent/undefined for every other question.
|
|
97
|
+
server_verified: z.boolean().optional(),
|
|
98
|
+
// Name of the channel plugin the question was also delivered through (e.g.
|
|
99
|
+
// "telegram"); absent when the question lives only in this inbox.
|
|
100
|
+
channel: z.string().optional(),
|
|
101
|
+
// Interaction attribution, each additive and absent when unset. `recipient` is
|
|
102
|
+
// the channel delivery address the question went to; `origin` is the run id of
|
|
103
|
+
// the background tool run that asked; `audience` is the user_id the question is
|
|
104
|
+
// addressed to. Display/binding data only, never an authorization axis; a
|
|
105
|
+
// present non-string is malformed.
|
|
106
|
+
recipient: z.string().optional(),
|
|
107
|
+
origin: z.string().optional(),
|
|
108
|
+
audience: z.string().optional(),
|
|
109
|
+
// Display-only media shown WITH the question (images and/or links). Absent when
|
|
110
|
+
// the question carries none. Deliberately LOOSE (`z.array(z.unknown())`): each
|
|
111
|
+
// item is `safeParse`d per item by the renderer against `interactionMediaItem`,
|
|
112
|
+
// so one malformed/hostile item can never fail the whole frame parse and hide an
|
|
113
|
+
// answerable question. A present non-array value is still malformed.
|
|
114
|
+
media: z.array(z.unknown()).optional(),
|
|
115
|
+
});
|
|
116
|
+
export type Interaction = z.infer<typeof interaction>;
|
|
117
|
+
|
|
118
|
+
/** The answer door's response — the blocked caller was woken. */
|
|
119
|
+
export const interactionAnswered = z.object({
|
|
120
|
+
interaction_id: z.string(),
|
|
121
|
+
status: z.string(),
|
|
122
|
+
});
|
|
123
|
+
export type InteractionAnswered = z.infer<typeof interactionAnswered>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The cancel door's response — a pending ask was WITHDRAWN without an answer (the
|
|
127
|
+
* asking flow does not resume). `status` is `"cancelled"`; the shape mirrors the
|
|
128
|
+
* answer door's terminal reply, but the door is distinct so it carries its own
|
|
129
|
+
* schema.
|
|
130
|
+
*/
|
|
131
|
+
export const interactionCancelled = z.object({
|
|
132
|
+
interaction_id: z.string(),
|
|
133
|
+
status: z.string(),
|
|
134
|
+
});
|
|
135
|
+
export type InteractionCancelled = z.infer<typeof interactionCancelled>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* A page of pending interactions from `GET /api/interactions?page=&pageSize=`. Each
|
|
139
|
+
* item is the same record the stream's `interaction.add` frame carries. The pending
|
|
140
|
+
* set is the paged base the tail-only stream applies live deltas over.
|
|
141
|
+
*/
|
|
142
|
+
export const interactionsPage = z.object({
|
|
143
|
+
items: z.array(interaction),
|
|
144
|
+
...pageWindow,
|
|
145
|
+
});
|
|
146
|
+
export type InteractionsPage = z.infer<typeof interactionsPage>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Public login-method aggregator and login-result schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One field of a `form` login method. `secret` fields render as password
|
|
6
|
+
* inputs; `autocomplete` passes through to the input (e.g. "email",
|
|
7
|
+
* "current-password", "new-password").
|
|
8
|
+
*/
|
|
9
|
+
export const loginFormField = z.object({
|
|
10
|
+
name: z.string().min(1),
|
|
11
|
+
label: z.string().min(1),
|
|
12
|
+
secret: z.boolean(),
|
|
13
|
+
autocomplete: z.string().optional(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The two — and only two — login-method shapes. Discriminated on `shape`; an
|
|
18
|
+
* unknown shape fails validation loudly (contract drift, not a soft skip).
|
|
19
|
+
* Optional fields are `.optional()` (absent), never `.nullable()`: the server
|
|
20
|
+
* serializes with `exclude_none`, so an absent field is OMITTED, never `null`.
|
|
21
|
+
*/
|
|
22
|
+
export const loginMethod = z.discriminatedUnion('shape', [
|
|
23
|
+
z.object({
|
|
24
|
+
shape: z.literal('form'),
|
|
25
|
+
id: z.string().min(1),
|
|
26
|
+
title: z.string().min(1),
|
|
27
|
+
purpose: z.enum(['login', 'bootstrap', 'invite']).default('login'),
|
|
28
|
+
fields: z.array(loginFormField).min(1),
|
|
29
|
+
submit_path: z.string().min(1),
|
|
30
|
+
}),
|
|
31
|
+
z.object({
|
|
32
|
+
shape: z.literal('button'),
|
|
33
|
+
id: z.string().min(1),
|
|
34
|
+
label: z.string().min(1),
|
|
35
|
+
icon: z.string().optional(),
|
|
36
|
+
href: z.string().min(1),
|
|
37
|
+
}),
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* `GET /api/login/methods` (PUBLIC). `bootstrap: true` ⇒ the deployment has zero
|
|
42
|
+
* accounts and `methods` contains the owner-creation form. Non-strict — the
|
|
43
|
+
* skeleton may grow additive fields.
|
|
44
|
+
*/
|
|
45
|
+
export const loginMethods = z.object({
|
|
46
|
+
methods: z.array(loginMethod),
|
|
47
|
+
bootstrap: z.boolean(),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A successful login/exchange: the minted session token (opaque, `tai-sess-`
|
|
52
|
+
* prefixed — the client treats it as an opaque string) + its user.
|
|
53
|
+
*/
|
|
54
|
+
export const loginResult = z.object({
|
|
55
|
+
token: z.string().min(1),
|
|
56
|
+
user_id: z.string().min(1),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export type LoginFormField = z.infer<typeof loginFormField>;
|
|
60
|
+
export type LoginMethod = z.infer<typeof loginMethod>;
|
|
61
|
+
export type LoginMethods = z.infer<typeof loginMethods>;
|
|
62
|
+
export type LoginResult = z.infer<typeof loginResult>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** Live-manifest MCP section, env-ref and config-reload schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { fleetReportFanout } from './fleet';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The back-reference a connector writes onto a manifest MCP entry to mark it
|
|
7
|
+
* connector-owned: the connection and the provider sub-service that own it.
|
|
8
|
+
* Hand-authored entries carry no `managed` marker.
|
|
9
|
+
*/
|
|
10
|
+
export const connectorRef = z.object({
|
|
11
|
+
connection_id: z.string(),
|
|
12
|
+
provider_id: z.string(),
|
|
13
|
+
sub_service: z.string(),
|
|
14
|
+
});
|
|
15
|
+
export type ConnectorRef = z.infer<typeof connectorRef>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* One entry of the live manifest's MCP section. Only the `managed` provenance
|
|
19
|
+
* marker is typed — the connect/disconnect flows write it server-side to point a
|
|
20
|
+
* connector-owned entry back at its connection, and the editor renders such
|
|
21
|
+
* entries read-only. `.nullish()` because a hand-authored entry carries `null`
|
|
22
|
+
* (present) or omits the key. Every other field (title, config, extensions) rides
|
|
23
|
+
* through `.loose()` unmodeled so the config editor keeps editing the whole
|
|
24
|
+
* entry — narrowing it to a typed subset would silently strip the fields it saves.
|
|
25
|
+
*/
|
|
26
|
+
export const manifestMcpEntry = z
|
|
27
|
+
.object({
|
|
28
|
+
managed: connectorRef.nullish(),
|
|
29
|
+
})
|
|
30
|
+
.loose();
|
|
31
|
+
export type ManifestMcpEntry = z.infer<typeof manifestMcpEntry>;
|
|
32
|
+
|
|
33
|
+
export const manifestView = z.object({
|
|
34
|
+
mcp: z.array(manifestMcpEntry),
|
|
35
|
+
user_tools: z.array(z.string()),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* One `!ENV ${VAR[:default]}` marker the manifest's MCP section carries
|
|
40
|
+
* (`GET /api/manifest/mcp-env-refs`) — NAMES and BOOLEANS only, NEVER values.
|
|
41
|
+
* `pointer` is the RFC 6901 json-pointer of the leaf (`/mcp/<i>/config/...`);
|
|
42
|
+
* `has_default` is whether the marker carries a `:default`; `set` is whether the
|
|
43
|
+
* var resolves in the EFFECTIVE env (the resolution truth the install-time
|
|
44
|
+
* dangling refusal reads), so a var supplied by the deployment shows green, never
|
|
45
|
+
* a false red. The checklist derives from THIS alone — no env value is ever fetched.
|
|
46
|
+
*/
|
|
47
|
+
export const mcpEnvRef = z.object({
|
|
48
|
+
var: z.string(),
|
|
49
|
+
pointer: z.string(),
|
|
50
|
+
has_default: z.boolean(),
|
|
51
|
+
set: z.boolean(),
|
|
52
|
+
});
|
|
53
|
+
export type McpEnvRef = z.infer<typeof mcpEnvRef>;
|
|
54
|
+
export const mcpEnvRefs = z.array(mcpEnvRef);
|
|
55
|
+
export type McpEnvRefs = z.infer<typeof mcpEnvRefs>;
|
|
56
|
+
/**
|
|
57
|
+
* The apply result every config-writer mutation returns (`POST /api/mcp-config`,
|
|
58
|
+
* `POST /api/config/env`): the serving worker's local reload result (`status` +
|
|
59
|
+
* `env_keys`) plus the mode-wrapped fleet fan-out of the reload it broadcast. The
|
|
60
|
+
* `fanout` is parsed EXPLICITLY so the shared fleet-report handler can surface a
|
|
61
|
+
* failed propagation — zod's unknown-key stripping would otherwise hide it. A drift
|
|
62
|
+
* throws `ApiSchemaError`.
|
|
63
|
+
*/
|
|
64
|
+
export const reloadConfigResult = z.object({
|
|
65
|
+
status: z.string(),
|
|
66
|
+
env_keys: z.number(),
|
|
67
|
+
fanout: fleetReportFanout,
|
|
68
|
+
});
|
|
69
|
+
export type ReloadConfigResult = z.infer<typeof reloadConfigResult>;
|