@tai42/api-client 16.0.0 → 17.0.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/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +1 -1
- package/dist/agents.js.map +1 -1
- 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 +247 -0
- package/dist/client/auth-client.d.ts.map +1 -0
- package/dist/client/auth-client.js +73 -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 +40 -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 +398 -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 +112 -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} +2336 -2708
- 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 +69 -0
- package/dist/client/login-client.d.ts.map +1 -0
- package/dist/client/login-client.js +137 -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 +334 -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 +101 -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 +27 -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 +470 -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 +53 -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/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -1
- 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 +12 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -13
- package/dist/index.js.map +1 -1
- package/dist/schemas/api-keys.d.ts +43 -0
- package/dist/schemas/api-keys.d.ts.map +1 -0
- package/dist/schemas/api-keys.js +29 -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 +109 -0
- package/dist/schemas/capabilities.d.ts.map +1 -0
- package/dist/schemas/capabilities.js +78 -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 +40 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +40 -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 +93 -0
- package/dist/schemas/login.d.ts.map +1 -0
- package/dist/schemas/login.js +61 -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/principals.d.ts +54 -0
- package/dist/schemas/principals.d.ts.map +1 -0
- package/dist/schemas/principals.js +34 -0
- package/dist/schemas/principals.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/setup.d.ts +43 -0
- package/dist/schemas/setup.d.ts.map +1 -0
- package/dist/schemas/setup.js +19 -0
- package/dist/schemas/setup.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/tool-runs.d.ts.map +1 -1
- package/dist/tool-runs.js.map +1 -1
- package/package.json +1 -1
- package/src/agents.ts +2 -2
- package/src/client/agents-client.ts +23 -0
- package/src/client/auth-client.ts +170 -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 +150 -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/errors.ts +16 -0
- package/src/http.ts +48 -24
- package/src/index.ts +231 -226
- package/src/schemas/api-keys.ts +34 -0
- package/src/schemas/auth-routes.ts +48 -0
- package/src/schemas/backup.ts +43 -0
- package/src/schemas/capabilities.ts +92 -0
- package/src/schemas/channels.ts +11 -0
- package/src/schemas/config.ts +17 -0
- package/src/schemas/connectors.ts +139 -0
- package/src/schemas/conversations.ts +257 -0
- package/src/schemas/extensions.ts +34 -0
- package/src/schemas/fleet.ts +154 -0
- package/src/schemas/hooks.ts +57 -0
- package/src/schemas/index.ts +39 -0
- package/src/schemas/interactions.ts +147 -0
- package/src/schemas/login.ts +69 -0
- package/src/schemas/manifest-mcp.ts +70 -0
- package/src/schemas/marketplace.ts +447 -0
- package/src/schemas/notifications.ts +43 -0
- package/src/schemas/observability.ts +87 -0
- package/src/schemas/policy.ts +38 -0
- package/src/schemas/presets.ts +114 -0
- package/src/schemas/principals.ts +41 -0
- package/src/schemas/profiles.ts +120 -0
- package/src/schemas/roles.ts +58 -0
- package/src/schemas/schedules.ts +28 -0
- package/src/schemas/served.ts +50 -0
- package/src/schemas/settings-schema.ts +32 -0
- package/src/schemas/setup.ts +39 -0
- package/src/schemas/shared.ts +21 -0
- package/src/schemas/states.ts +273 -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 +47 -0
- package/src/schemas/templates.ts +12 -0
- package/src/schemas/tool-meta.ts +51 -0
- package/src/schemas/tools.ts +62 -0
- package/src/schemas/trigger-links.ts +55 -0
- package/src/schemas/web-entry.ts +46 -0
- package/src/tool-runs.ts +1 -1
- 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 -5172
- package/dist/schemas.d.ts.map +0 -1
- package/dist/schemas.js +0 -2268
- package/dist/schemas.js.map +0 -1
- package/src/client.ts +0 -1771
- package/src/schemas.ts +0 -2760
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** Caller capability projection and auth-capabilities schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import { principalRef } from './principals';
|
|
5
|
+
import { subMcpMount } from './sub-mcp';
|
|
6
|
+
|
|
7
|
+
/** A concrete route the caller can reach, with the methods that pass its jq fence. */
|
|
8
|
+
export const routeEntry = z.object({
|
|
9
|
+
path: z.string(),
|
|
10
|
+
methods: z.array(z.string()),
|
|
11
|
+
});
|
|
12
|
+
export type RouteEntry = z.infer<typeof routeEntry>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A dynamic route pattern the caller can reach — a mount/pattern surface not
|
|
16
|
+
* enumerable into concrete paths, projected only when its scope AND jq admit it.
|
|
17
|
+
*/
|
|
18
|
+
export const patternEntry = z.object({
|
|
19
|
+
pattern: z.string(),
|
|
20
|
+
scope_id: z.string(),
|
|
21
|
+
});
|
|
22
|
+
export type PatternEntry = z.infer<typeof patternEntry>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A sub-MCP mount the caller can reach, with the tools it exposes and its
|
|
26
|
+
* transport. Shares the {@link subMcpMount} shape with the registry list, adding
|
|
27
|
+
* the `slug` the projection carries inline (the list keys mounts by slug instead).
|
|
28
|
+
*/
|
|
29
|
+
export const subMcpEntry = subMcpMount.extend({ slug: z.string() });
|
|
30
|
+
export type SubMcpEntry = z.infer<typeof subMcpEntry>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* `GET /api/auth/me` — the caller's derived capability projection: the concrete
|
|
34
|
+
* (path, method) surface, dynamic patterns, sub-MCP mounts, tools, and agents it
|
|
35
|
+
* can reach RIGHT NOW (derived server-side, never stored). `admin` is the
|
|
36
|
+
* condition-free `"*"` discriminator (a TOTAL projection); a scoped
|
|
37
|
+
* session carries `admin: false` and a jq-exact `routes` list. `owner_user_id` is
|
|
38
|
+
* the key's owner claim, `null` for a key with no owner claim. `principal` is the
|
|
39
|
+
* caller's principal (kind + display name), `null` when no principal row backs the
|
|
40
|
+
* credential. The invariant is projection ⊆ gate: every projected surface is one
|
|
41
|
+
* the server would admit, so the UI can filter on it without ever advertising a
|
|
42
|
+
* door the gate denies.
|
|
43
|
+
*/
|
|
44
|
+
export const meProjection = z.object({
|
|
45
|
+
user_id: z.string(),
|
|
46
|
+
owner_user_id: z.string().nullable(),
|
|
47
|
+
principal: principalRef.nullable().optional(),
|
|
48
|
+
admin: z.boolean(),
|
|
49
|
+
scopes: z.array(z.string()),
|
|
50
|
+
routes: z.array(routeEntry),
|
|
51
|
+
route_patterns: z.array(patternEntry),
|
|
52
|
+
sub_mcp: z.array(subMcpEntry),
|
|
53
|
+
tools: z.array(z.string()),
|
|
54
|
+
agents: z.array(z.string()),
|
|
55
|
+
mintable: z.boolean(),
|
|
56
|
+
});
|
|
57
|
+
export type MeProjection = z.infer<typeof meProjection>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* `POST /api/auth/claim-links` — a one-time claim link minted in the key-create
|
|
61
|
+
* flow. `claim_path` is a fragment-carrier path (`/login#claim=<token>`, never an
|
|
62
|
+
* absolute URL — the Studio composes the origin); `token` is the raw claim token
|
|
63
|
+
* returned exactly ONCE; `expires_at` is an ISO-8601 instant.
|
|
64
|
+
*/
|
|
65
|
+
export const claimLinkCreated = z.object({
|
|
66
|
+
claim_path: z.string(),
|
|
67
|
+
token: z.string(),
|
|
68
|
+
expires_at: z.string(),
|
|
69
|
+
});
|
|
70
|
+
export type ClaimLinkCreated = z.infer<typeof claimLinkCreated>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* `POST /api/auth/logout` — the single authed logout dispatcher's result.
|
|
74
|
+
* `revoked` is `true` when a live accounts session was revoked; a plain `sk-` key
|
|
75
|
+
* has nothing to revoke and answers `404` (a loud absent-session signal), never a
|
|
76
|
+
* `revoked: false` body. Non-strict, so a SUCCESSFUL logout never throws
|
|
77
|
+
* `ApiSchemaError` on an additive field.
|
|
78
|
+
*/
|
|
79
|
+
export const logoutResult = z.object({ revoked: z.boolean() });
|
|
80
|
+
export type LogoutResult = z.infer<typeof logoutResult>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* `GET /api/auth/capabilities` — whether this deployment can MINT API keys
|
|
84
|
+
* locally. `mintable: false` means every configured identity provider is
|
|
85
|
+
* validator-only (keys are issued at an external issuer), so the key-creation
|
|
86
|
+
* UI disables up front instead of surfacing a raw mint failure. Non-strict.
|
|
87
|
+
*/
|
|
88
|
+
export const authCapabilities = z.object({
|
|
89
|
+
mintable: z.boolean(),
|
|
90
|
+
providers: z.array(z.object({ name: z.string(), mintable: z.boolean() })),
|
|
91
|
+
});
|
|
92
|
+
export type AuthCapabilities = z.infer<typeof authCapabilities>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Installed channel-plugin catalog response schema. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
// The installed channel-plugin catalog: names registered via the manifest's
|
|
5
|
+
// channel modules. A deployment with none bound answers questions only in this
|
|
6
|
+
// inbox (the Studio default).
|
|
7
|
+
|
|
8
|
+
export const channels = z.object({
|
|
9
|
+
channels: z.array(z.string()),
|
|
10
|
+
});
|
|
11
|
+
export type Channels = z.infer<typeof channels>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Environment-config and config-mode response schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export const envConfig = z.object({
|
|
5
|
+
env: z.record(z.string(), z.string()),
|
|
6
|
+
secret_keys: z.array(z.string()),
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* `GET /api/config/mode` — the active config backend mode (`file` / `k8s`). The
|
|
10
|
+
* skeleton emits only `config_mode`; `read_only` is a UI-side gate, tolerated-absent
|
|
11
|
+
* and defaulting to `false` (writable) so a normal response never drifts, while a
|
|
12
|
+
* genuinely read-only deployment can opt in by emitting `read_only: true`.
|
|
13
|
+
*/
|
|
14
|
+
export const configMode = z.object({
|
|
15
|
+
config_mode: z.string(),
|
|
16
|
+
read_only: z.boolean().default(false),
|
|
17
|
+
});
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/** Connector provider catalog and connection lifecycle schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import { fleetReportFanout } from './fleet';
|
|
5
|
+
|
|
6
|
+
export const subServiceView = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
display_name: z.string(),
|
|
9
|
+
description: z.string(),
|
|
10
|
+
scopes: z.array(z.string()),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const configFieldView = z.object({
|
|
14
|
+
key: z.string(),
|
|
15
|
+
label: z.string(),
|
|
16
|
+
target: z.enum(['env', 'header']),
|
|
17
|
+
required: z.boolean(),
|
|
18
|
+
secret: z.boolean(),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const providerView = z.object({
|
|
22
|
+
id: z.string(),
|
|
23
|
+
display_name: z.string(),
|
|
24
|
+
description: z.string(),
|
|
25
|
+
// Required and a real URL: the contract's `ProviderDescriptor.icon_url` runs
|
|
26
|
+
// `check_web_url(schemes=("https",))`, which rejects an empty/relative value, so
|
|
27
|
+
// an empty or malformed one here is drift and fails the parse loudly.
|
|
28
|
+
icon_url: z.url(),
|
|
29
|
+
kind: z.enum(['oauth', 'none']),
|
|
30
|
+
origin: z.enum(['system', 'community']),
|
|
31
|
+
category: z.string(),
|
|
32
|
+
sub_services: z.array(subServiceView),
|
|
33
|
+
config_fields: z.array(configFieldView),
|
|
34
|
+
});
|
|
35
|
+
export type ProviderView = z.infer<typeof providerView>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* One `connector_category` grouping row served alongside the catalog: the UI's
|
|
39
|
+
* label and sort key for the providers it groups, so the list can group, order,
|
|
40
|
+
* and label providers by category without a second read.
|
|
41
|
+
*/
|
|
42
|
+
export const connectorCategoryView = z.object({
|
|
43
|
+
id: z.string(),
|
|
44
|
+
display_name: z.string(),
|
|
45
|
+
sort_order: z.number(),
|
|
46
|
+
});
|
|
47
|
+
export type ConnectorCategoryView = z.infer<typeof connectorCategoryView>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* `GET /api/connectors/providers` — the provider catalog: the providers plus the
|
|
51
|
+
* category groupings the UI arranges them under. Reshaped from a bare provider
|
|
52
|
+
* array so the category label/order surface rides the same read.
|
|
53
|
+
*/
|
|
54
|
+
export const providers = z.object({
|
|
55
|
+
providers: z.array(providerView),
|
|
56
|
+
categories: z.array(connectorCategoryView),
|
|
57
|
+
});
|
|
58
|
+
export type ProviderCatalogResponse = z.infer<typeof providers>;
|
|
59
|
+
|
|
60
|
+
export const connectionView = z.object({
|
|
61
|
+
connection_id: z.string(),
|
|
62
|
+
provider_id: z.string(),
|
|
63
|
+
alias: z.string(),
|
|
64
|
+
kind: z.enum(['oauth', 'none']),
|
|
65
|
+
account_identity: z.string().nullable(),
|
|
66
|
+
enabled_sub_services: z.array(z.string()),
|
|
67
|
+
granted_scopes: z.array(z.string()),
|
|
68
|
+
// Sub-services whose MCP server did not answer a live reachability probe.
|
|
69
|
+
// Populated only on the single-connection GET (the list projection is
|
|
70
|
+
// probe-free and always sends `[]`). Reachability is distinct from
|
|
71
|
+
// `auth_health_state`: a healthy connection can still have a down sub-service.
|
|
72
|
+
// Defaulted so a projection that omits it (an older worker mid-rollout) still
|
|
73
|
+
// parses rather than false-failing the whole view.
|
|
74
|
+
unreachable_sub_services: z.array(z.string()).default([]),
|
|
75
|
+
auth_health_state: z.enum(['healthy', 'reconnect_required', 'refresh_failing']),
|
|
76
|
+
created_at: z.string(),
|
|
77
|
+
});
|
|
78
|
+
export type ConnectionView = z.infer<typeof connectionView>;
|
|
79
|
+
|
|
80
|
+
export const connectionsList = z.object({
|
|
81
|
+
items: z.array(connectionView),
|
|
82
|
+
total: z.number(),
|
|
83
|
+
// Count of connections whose `auth_health_state` is not healthy across the whole
|
|
84
|
+
// set (independent of any filter/limit) — the attention-badge count. Optional:
|
|
85
|
+
// no UI consumes it, and an older worker mid-rollout omits it.
|
|
86
|
+
unhealthy: z.number().optional(),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// A connector mutation that writes the manifest embeds the mode-wrapped fleet
|
|
90
|
+
// `fanout` of the reload it broadcast; it is `null` when the response path mutated no
|
|
91
|
+
// manifest (an OAuth START opens a flow before any write). Parsed EXPLICITLY so the
|
|
92
|
+
// shared fleet-report handler surfaces a failed propagation on every connector flow —
|
|
93
|
+
// zod's unknown-key stripping would otherwise drop it silently.
|
|
94
|
+
export const startConnectResult = z.union([
|
|
95
|
+
z.object({ flow_id: z.string(), authorize_url: z.string() }),
|
|
96
|
+
z.object({
|
|
97
|
+
connection_id: z.string(),
|
|
98
|
+
added_manifest_entries: z.array(z.string()),
|
|
99
|
+
fanout: fleetReportFanout.nullable(),
|
|
100
|
+
}),
|
|
101
|
+
]);
|
|
102
|
+
|
|
103
|
+
// A reconnect START opens an OAuth flow and writes no manifest, so it carries no
|
|
104
|
+
// fan-out (the manifest write lands when the flow completes).
|
|
105
|
+
export const reconnectResult = z.object({ flow_id: z.string(), authorize_url: z.string() });
|
|
106
|
+
|
|
107
|
+
export const disconnectResult = z.object({
|
|
108
|
+
connection_id: z.string(),
|
|
109
|
+
upstream_revoke_outcome: z.enum(['success', 'failed', 'skipped']),
|
|
110
|
+
upstream_revoke_status: z.number().nullable(),
|
|
111
|
+
removed_manifest_entries: z.array(z.string()),
|
|
112
|
+
fanout: fleetReportFanout.nullable(),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export const patchSubServicesResult = z.object({
|
|
116
|
+
connection_id: z.string(),
|
|
117
|
+
enabled_sub_services: z.array(z.string()),
|
|
118
|
+
consent_required: z.boolean(),
|
|
119
|
+
flow_id: z.string().nullable(),
|
|
120
|
+
authorize_url: z.string().nullable(),
|
|
121
|
+
added_manifest_entries: z.array(z.string()),
|
|
122
|
+
removed_manifest_entries: z.array(z.string()),
|
|
123
|
+
// `null` on a consent-only toggle that forks an OAuth flow without a manifest write.
|
|
124
|
+
fanout: fleetReportFanout.nullable(),
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export const oauthCompleteResult = z.discriminatedUnion('kind', [
|
|
128
|
+
z.object({
|
|
129
|
+
kind: z.literal('success'),
|
|
130
|
+
connection_id: z.string(),
|
|
131
|
+
return_url: z.string(),
|
|
132
|
+
// `null` when completing the flow mutated no manifest (a reconcile that changed
|
|
133
|
+
// nothing).
|
|
134
|
+
fanout: fleetReportFanout.nullable(),
|
|
135
|
+
}),
|
|
136
|
+
z.object({ kind: z.literal('failed'), reason: z.string() }),
|
|
137
|
+
z.object({ kind: z.literal('cancelled'), message: z.string() }),
|
|
138
|
+
]);
|
|
139
|
+
export type OAuthCompleteResult = z.infer<typeof oauthCompleteResult>;
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/** Conversation route, thread, transcript and config schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import { conversationRoute, targetConversationConfig } from './served';
|
|
5
|
+
import { pageWindow } from './shared';
|
|
6
|
+
|
|
7
|
+
// The cross-channel conversation monitor's READ side: the stored routing rows
|
|
8
|
+
// (the route picker) from `GET /api/conversations`, a route's threads from
|
|
9
|
+
// `GET /api/conversations/{route}/threads`, and one thread's transcript from
|
|
10
|
+
// `GET /api/conversations/{route}/transcript?thread_id=`. Timestamps are float
|
|
11
|
+
// epoch seconds, not ISO strings, and both paged doors carry the same window
|
|
12
|
+
// fields; the transcript adds the direction it was read in.
|
|
13
|
+
|
|
14
|
+
/** The inbound door a route is bound to: the authed API, or a channel medium. */
|
|
15
|
+
export const conversationDoor = z.enum(['api', 'channel']);
|
|
16
|
+
export type ConversationDoor = z.infer<typeof conversationDoor>;
|
|
17
|
+
|
|
18
|
+
/** What a route's turn runs: a registered agent, or a tool dispatch. */
|
|
19
|
+
export const conversationTargetKind = z.enum(['agent', 'tool']);
|
|
20
|
+
export type ConversationTargetKind = z.infer<typeof conversationTargetKind>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A route's default control mode (`initial_mode`) when a thread carries no
|
|
24
|
+
* per-thread override: `agent` runs the target turn, `manual` suppresses it for an
|
|
25
|
+
* operator to answer. The same value vocabulary as a per-thread mode override, but
|
|
26
|
+
* a distinct concept (the route default vs. one thread's override).
|
|
27
|
+
*/
|
|
28
|
+
export const conversationMode = z.enum(['agent', 'manual']);
|
|
29
|
+
export type ConversationMode = z.infer<typeof conversationMode>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Where a record sits between intake and a terminal outcome. `failed` is the one
|
|
33
|
+
* the monitor surfaces loudly; `shed` and `silent` are terminal by design and
|
|
34
|
+
* never send.
|
|
35
|
+
*/
|
|
36
|
+
export const conversationDeliveryStatus = z.enum([
|
|
37
|
+
'accepted',
|
|
38
|
+
'pending_delivery',
|
|
39
|
+
'provisional',
|
|
40
|
+
'delivered',
|
|
41
|
+
'failed',
|
|
42
|
+
'shed',
|
|
43
|
+
'silent',
|
|
44
|
+
]);
|
|
45
|
+
export type ConversationDeliveryStatus = z.infer<typeof conversationDeliveryStatus>;
|
|
46
|
+
|
|
47
|
+
/** The nature of a turn's outcome, orthogonal to where its delivery stands. */
|
|
48
|
+
export const conversationAnswerStatus = z.enum(['answered', 'error', 'silent']);
|
|
49
|
+
export type ConversationAnswerStatus = z.infer<typeof conversationAnswerStatus>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Who authored a record's outgoing side. `client` is the ordinary turn the flow
|
|
53
|
+
* answered; `operator` is a message a human sent into the thread, whose text
|
|
54
|
+
* rides `answer` (its `inbound_text` is empty).
|
|
55
|
+
*/
|
|
56
|
+
export const conversationRecordOrigin = z.enum(['client', 'operator']);
|
|
57
|
+
export type ConversationRecordOrigin = z.infer<typeof conversationRecordOrigin>;
|
|
58
|
+
|
|
59
|
+
export const conversationRoutes = z.object({
|
|
60
|
+
items: z.array(conversationRoute),
|
|
61
|
+
total: z.number(),
|
|
62
|
+
});
|
|
63
|
+
export type ConversationRoutes = z.infer<typeof conversationRoutes>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The create/replace reply: whether THIS call created the row (vs. replaced an
|
|
67
|
+
* existing one), the row itself (its `callback_secret` withheld), and the
|
|
68
|
+
* `callback_secret` returned ONCE for an `api`-door row (`null` for a `channel`
|
|
69
|
+
* row). The secret signs delivery callbacks and is never re-read from any door, so
|
|
70
|
+
* a caller that needs it must capture it from this reply.
|
|
71
|
+
*/
|
|
72
|
+
export const conversationRouteWritten = z.object({
|
|
73
|
+
created: z.boolean(),
|
|
74
|
+
route_name: z.string(),
|
|
75
|
+
route: conversationRoute,
|
|
76
|
+
callback_secret: z.string().nullable(),
|
|
77
|
+
});
|
|
78
|
+
export type ConversationRouteWritten = z.infer<typeof conversationRouteWritten>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The delete reply: `removed` says whether THIS call removed the routing row (a
|
|
82
|
+
* retryable reclamation of orphaned thread indexes answers `false` rather than a
|
|
83
|
+
* 404).
|
|
84
|
+
*/
|
|
85
|
+
export const conversationRouteDeleted = z.object({
|
|
86
|
+
removed: z.boolean(),
|
|
87
|
+
route_name: z.string(),
|
|
88
|
+
});
|
|
89
|
+
export type ConversationRouteDeleted = z.infer<typeof conversationRouteDeleted>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* One thread of a route, summarized from its newest record. A `thread_id` holds
|
|
93
|
+
* an api-door address (`{principal}/{end user}`, percent-encoded), so it never
|
|
94
|
+
* goes back into a URL as a path segment — the transcript door takes it as a
|
|
95
|
+
* query value.
|
|
96
|
+
*/
|
|
97
|
+
export const conversationThread = z.object({
|
|
98
|
+
thread_id: z.string(),
|
|
99
|
+
client_address: z.string(),
|
|
100
|
+
last_activity_at: z.number(),
|
|
101
|
+
message_count: z.number(),
|
|
102
|
+
last_delivery_status: conversationDeliveryStatus,
|
|
103
|
+
});
|
|
104
|
+
export type ConversationThread = z.infer<typeof conversationThread>;
|
|
105
|
+
|
|
106
|
+
export const conversationThreadsPage = z.object({
|
|
107
|
+
items: z.array(conversationThread),
|
|
108
|
+
...pageWindow,
|
|
109
|
+
});
|
|
110
|
+
export type ConversationThreadsPage = z.infer<typeof conversationThreadsPage>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* One exchange: the visitor's `inbound_text` — every record answers a message, so
|
|
114
|
+
* both projections always carry it — and the agent's `answer`, plus where that
|
|
115
|
+
* answer's delivery stands. The fields after `updated_at` are ADMIN ONLY —
|
|
116
|
+
* the same door serves a caller-scoped projection that withholds them — so they
|
|
117
|
+
* are optional here and absence means "not published to this reader".
|
|
118
|
+
*/
|
|
119
|
+
export const conversationMessage = z.object({
|
|
120
|
+
message_id: z.string(),
|
|
121
|
+
route_name: z.string(),
|
|
122
|
+
door: conversationDoor,
|
|
123
|
+
thread_id: z.string(),
|
|
124
|
+
client_address: z.string(),
|
|
125
|
+
caller_principal: z.string().nullable(),
|
|
126
|
+
inbound_text: z.string(),
|
|
127
|
+
answer_status: conversationAnswerStatus.nullable(),
|
|
128
|
+
answer: z.string().nullable(),
|
|
129
|
+
origin: conversationRecordOrigin,
|
|
130
|
+
delivery_status: conversationDeliveryStatus,
|
|
131
|
+
created_at: z.number(),
|
|
132
|
+
updated_at: z.number(),
|
|
133
|
+
channel: z.string().nullable().optional(),
|
|
134
|
+
our_identity: z.string().nullable().optional(),
|
|
135
|
+
provider_message_id: z.string().nullable().optional(),
|
|
136
|
+
callback_url: z.string().nullable().optional(),
|
|
137
|
+
error: z.string().nullable().optional(),
|
|
138
|
+
outbound_message_ids: z.array(z.string()).optional(),
|
|
139
|
+
attempts: z.number().optional(),
|
|
140
|
+
});
|
|
141
|
+
export type ConversationMessage = z.infer<typeof conversationMessage>;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The direction a transcript page reads in. `asc` is the reading order (oldest
|
|
145
|
+
* first); `desc` is the live-tail order, where page 1 is always the newest page
|
|
146
|
+
* and paging forward walks BACKWARDS through the thread's history.
|
|
147
|
+
*/
|
|
148
|
+
export const transcriptOrder = z.enum(['asc', 'desc']);
|
|
149
|
+
export type TranscriptOrder = z.infer<typeof transcriptOrder>;
|
|
150
|
+
|
|
151
|
+
/** A transcript page, echoing the order it was read in. */
|
|
152
|
+
export const conversationTranscriptPage = z.object({
|
|
153
|
+
items: z.array(conversationMessage),
|
|
154
|
+
...pageWindow,
|
|
155
|
+
order: transcriptOrder,
|
|
156
|
+
});
|
|
157
|
+
export type ConversationTranscriptPage = z.infer<typeof conversationTranscriptPage>;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* A route-scoped message search (`GET /api/conversations/{route}/messages/search?q`):
|
|
161
|
+
* every record on the route whose text matches `q`, across threads, newest first.
|
|
162
|
+
* The record shape is the transcript's exactly, so a hit renders with the same
|
|
163
|
+
* projection. `truncated` says the match set outran the door's scan cap — surfaced
|
|
164
|
+
* loudly, never a silent cut.
|
|
165
|
+
*/
|
|
166
|
+
export const conversationMessageSearchPage = z.object({
|
|
167
|
+
items: z.array(conversationMessage),
|
|
168
|
+
...pageWindow,
|
|
169
|
+
});
|
|
170
|
+
export type ConversationMessageSearchPage = z.infer<typeof conversationMessageSearchPage>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Who answers a thread's incoming messages: `agent` lets the flow reply on its
|
|
174
|
+
* own; `manual` holds the flow back so a human answers. `source` says whether the
|
|
175
|
+
* setting is the thread's own (`thread`) or inherited from its route (`route`).
|
|
176
|
+
*/
|
|
177
|
+
export const conversationThreadMode = z.enum(['agent', 'manual']);
|
|
178
|
+
export type ConversationThreadMode = z.infer<typeof conversationThreadMode>;
|
|
179
|
+
|
|
180
|
+
export const conversationThreadModeState = z.object({
|
|
181
|
+
mode: conversationThreadMode,
|
|
182
|
+
source: z.enum(['thread', 'route']),
|
|
183
|
+
});
|
|
184
|
+
export type ConversationThreadModeState = z.infer<typeof conversationThreadModeState>;
|
|
185
|
+
|
|
186
|
+
/** The receipt a thread-message write returns: the stored id and its thread. */
|
|
187
|
+
export const conversationThreadMessageSent = z.object({
|
|
188
|
+
message_id: z.string(),
|
|
189
|
+
thread_id: z.string(),
|
|
190
|
+
});
|
|
191
|
+
export type ConversationThreadMessageSent = z.infer<typeof conversationThreadMessageSent>;
|
|
192
|
+
|
|
193
|
+
/** Every stored per-target config (`GET /api/conversation-configs`). */
|
|
194
|
+
export const conversationConfigs = z.object({
|
|
195
|
+
items: z.array(targetConversationConfig),
|
|
196
|
+
total: z.number(),
|
|
197
|
+
});
|
|
198
|
+
export type ConversationConfigs = z.infer<typeof conversationConfigs>;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The upsert reply: whether THIS call created the config (vs. replaced an existing
|
|
202
|
+
* one), its key, and the stored row.
|
|
203
|
+
*/
|
|
204
|
+
export const conversationConfigWritten = z.object({
|
|
205
|
+
created: z.boolean(),
|
|
206
|
+
target_kind: conversationTargetKind,
|
|
207
|
+
target_name: z.string(),
|
|
208
|
+
config: targetConversationConfig,
|
|
209
|
+
});
|
|
210
|
+
export type ConversationConfigWritten = z.infer<typeof conversationConfigWritten>;
|
|
211
|
+
|
|
212
|
+
/** The config-delete reply: `removed` is always `true` on success (an unknown key is a 404). */
|
|
213
|
+
export const conversationConfigDeleted = z.object({
|
|
214
|
+
removed: z.boolean(),
|
|
215
|
+
target_kind: conversationTargetKind,
|
|
216
|
+
target_name: z.string(),
|
|
217
|
+
});
|
|
218
|
+
export type ConversationConfigDeleted = z.infer<typeof conversationConfigDeleted>;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* The admin-only failed-delivery listing (`GET /api/conversations/messages/failed`):
|
|
222
|
+
* every answer record whose delivery ended `failed`, across every route and caller.
|
|
223
|
+
* The records are the ADMIN projection (delivery bookkeeping and `error` included),
|
|
224
|
+
* so the row shape is {@link conversationMessage} exactly. It is NOT a paged window —
|
|
225
|
+
* the door returns `{items, total}` and nothing more.
|
|
226
|
+
*/
|
|
227
|
+
export const conversationFailedMessages = z.object({
|
|
228
|
+
items: z.array(conversationMessage),
|
|
229
|
+
total: z.number(),
|
|
230
|
+
});
|
|
231
|
+
export type ConversationFailedMessages = z.infer<typeof conversationFailedMessages>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* The thread-delete reply (`DELETE /api/conversations/{route_name}/thread?thread_id=`).
|
|
235
|
+
* `removed` is a COUNT of the answer records this call deleted — `0` when a prior
|
|
236
|
+
* run already cleared them, when they had aged out under retention, or when the id
|
|
237
|
+
* was never stored (forgetting is absolute, never a 404 on a valid id).
|
|
238
|
+
*/
|
|
239
|
+
export const conversationThreadDeleted = z.object({
|
|
240
|
+
removed: z.number(),
|
|
241
|
+
route_name: z.string(),
|
|
242
|
+
thread_id: z.string(),
|
|
243
|
+
});
|
|
244
|
+
export type ConversationThreadDeleted = z.infer<typeof conversationThreadDeleted>;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* The person-erase reply (`DELETE /api/conversations/persons/{person_id}`).
|
|
248
|
+
* `removed` counts the answer records deleted across the person's routes; `erased`
|
|
249
|
+
* says whether THIS call removed the person row (`false` on a retry or an
|
|
250
|
+
* already-gone person — never a 404).
|
|
251
|
+
*/
|
|
252
|
+
export const conversationPersonDeleted = z.object({
|
|
253
|
+
person_id: z.string(),
|
|
254
|
+
removed: z.number(),
|
|
255
|
+
erased: z.boolean(),
|
|
256
|
+
});
|
|
257
|
+
export type ConversationPersonDeleted = z.infer<typeof conversationPersonDeleted>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Extension element/combo and per-tool extension response schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export const extension = z.object({ name: z.string(), kind: z.string() });
|
|
5
|
+
export const extensions = z.array(extension);
|
|
6
|
+
export type Extension = z.infer<typeof extension>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* One element of an extension combo: a bare extension NAME, or a
|
|
10
|
+
* `{ name, config }` mapping binding author config (e.g. an `output_schema` JSON
|
|
11
|
+
* Schema, or an `ask_external` verifier). Both wire forms are admitted so a
|
|
12
|
+
* config-bearing combo parses without dropping server data. A drift throws
|
|
13
|
+
* `ApiSchemaError`.
|
|
14
|
+
*/
|
|
15
|
+
export const presetExtensionElement = z.union([
|
|
16
|
+
z.string(),
|
|
17
|
+
z.object({ name: z.string(), config: z.record(z.string(), z.unknown()) }),
|
|
18
|
+
]);
|
|
19
|
+
export type PresetExtensionElement = z.infer<typeof presetExtensionElement>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* `GET /api/tools/{name}/extensions` — a tool's FULL lossless list-of-combos plus
|
|
23
|
+
* the extension catalog. `combos` is a list of combos, each an ordered list of
|
|
24
|
+
* extension ELEMENTS (a bare name or a config-bearing `{ name, config }` mapping —
|
|
25
|
+
* `output_schema` carries its schema this way); `[]` when the tool has no map entry.
|
|
26
|
+
* It carries EVERY combo mapped to the base tool (the union across every `tools`/`mcp`
|
|
27
|
+
* config), never a single flattened one. `available` is the same flat catalog
|
|
28
|
+
* `GET /api/extensions` returns. A drift throws `ApiSchemaError`.
|
|
29
|
+
*/
|
|
30
|
+
export const toolExtensions = z.object({
|
|
31
|
+
combos: z.array(z.array(presetExtensionElement)),
|
|
32
|
+
available: extensions,
|
|
33
|
+
});
|
|
34
|
+
export type ToolExtensions = z.infer<typeof toolExtensions>;
|