@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,447 @@
|
|
|
1
|
+
/** Marketplace listing, version, install and advisory schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The CLOSED HTTP-method enum fixed by the contract's RouteMethod, the one source
|
|
6
|
+
* for every route-method field (declaration and install/preview responses alike):
|
|
7
|
+
* a wire method the contract does not define fails loudly as drift rather than
|
|
8
|
+
* passing through silently.
|
|
9
|
+
*/
|
|
10
|
+
export const routeMethod = z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);
|
|
11
|
+
export type RouteMethod = z.infer<typeof routeMethod>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* How the plugin is delivered, derived server-side from whether its spec names a
|
|
15
|
+
* package: `package` is pip-installed, `descriptor` (marketplace `source` `spec`)
|
|
16
|
+
* installs nothing but the manifest entry. A CLOSED enum, so a wire value the
|
|
17
|
+
* server does not derive fails loudly as drift.
|
|
18
|
+
*/
|
|
19
|
+
export const marketplaceDelivery = z.enum(['package', 'descriptor']);
|
|
20
|
+
export type MarketplaceDelivery = z.infer<typeof marketplaceDelivery>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The install-provenance vocabulary a listing/version resolves from: a pip index
|
|
24
|
+
* (`pypi`), a git tag (`github`), or a descriptor yml (`spec`). CLOSED, so a wire
|
|
25
|
+
* value outside it fails as drift.
|
|
26
|
+
*/
|
|
27
|
+
export const marketplaceSource = z.enum(['pypi', 'github', 'spec']);
|
|
28
|
+
export type MarketplaceSource = z.infer<typeof marketplaceSource>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* One env var an item requires before install: its `name` and whether its value is
|
|
32
|
+
* a `secret` (an OAuth client secret is; a client id or a plain marker var is not).
|
|
33
|
+
* The install dialog seeds each toggle from `secret` and collects the missing ones.
|
|
34
|
+
*/
|
|
35
|
+
export const marketplaceRequiredEnvVar = z.object({ name: z.string(), secret: z.boolean() });
|
|
36
|
+
export type MarketplaceRequiredEnvVar = z.infer<typeof marketplaceRequiredEnvVar>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* One HTTP route an item declares in its `tai-plugin.yml`: a `path` relative to
|
|
40
|
+
* the item's mount base, the `methods` it answers, and whether it is served
|
|
41
|
+
* `public` (without authentication). The absolute path an operator sees is
|
|
42
|
+
* resolved from the base at install time.
|
|
43
|
+
*/
|
|
44
|
+
export const marketplaceRouteDecl = z.object({
|
|
45
|
+
path: z.string(),
|
|
46
|
+
methods: z.array(routeMethod),
|
|
47
|
+
public: z.boolean(),
|
|
48
|
+
});
|
|
49
|
+
export type MarketplaceRouteDecl = z.infer<typeof marketplaceRouteDecl>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A route-carrying item's declared mount: the default `base` prefix the routes
|
|
53
|
+
* hang off (an operator may remap it at install) and the `paths` it registers.
|
|
54
|
+
*/
|
|
55
|
+
export const marketplaceRoutesDecl = z.object({
|
|
56
|
+
base: z.string(),
|
|
57
|
+
paths: z.array(marketplaceRouteDecl),
|
|
58
|
+
});
|
|
59
|
+
export type MarketplaceRoutesDecl = z.infer<typeof marketplaceRoutesDecl>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* One contained item of a marketplace plugin's published version: its kind
|
|
63
|
+
* (tool / agent / extension / …), name, description, free-form tags, and the
|
|
64
|
+
* logical group it belongs to (`null` when ungrouped). `routes` is present only
|
|
65
|
+
* on a route-carrying item (a router or channel); absent/null on every other.
|
|
66
|
+
* `required_env` is the env vars the item needs before install — but the REGISTRY's
|
|
67
|
+
* plugin-detail body does NOT carry it per item: required-env is server-computed
|
|
68
|
+
* (`required_env_for_spec`) and rides the install PREVIEW, never the listing detail,
|
|
69
|
+
* so the registry OMITS it here and it parses as `undefined`. Optional (not
|
|
70
|
+
* defaulted) so the type mirrors the wire; the authority the install dialog collects
|
|
71
|
+
* from is the preview's `required_env`/`missing_env`, never this field.
|
|
72
|
+
*/
|
|
73
|
+
export const marketplaceItem = z.object({
|
|
74
|
+
kind: z.string(),
|
|
75
|
+
name: z.string(),
|
|
76
|
+
description: z.string(),
|
|
77
|
+
tags: z.array(z.string()),
|
|
78
|
+
group: z.string().nullable(),
|
|
79
|
+
routes: marketplaceRoutesDecl.nullish(),
|
|
80
|
+
required_env: z.array(marketplaceRequiredEnvVar).optional(),
|
|
81
|
+
});
|
|
82
|
+
export type MarketplaceItem = z.infer<typeof marketplaceItem>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* One kind summary of a search row: an item kind, how many UNGROUPED items of
|
|
86
|
+
* that kind the listing's latest published version carries, and their names.
|
|
87
|
+
* The registry orders the array count DESC then kind ASC, and each entry's
|
|
88
|
+
* `names` ASC; the UI renders in that order.
|
|
89
|
+
*/
|
|
90
|
+
export const marketplaceSearchKind = z.object({
|
|
91
|
+
kind: z.string(),
|
|
92
|
+
count: z.number(),
|
|
93
|
+
names: z.array(z.string()),
|
|
94
|
+
});
|
|
95
|
+
export type MarketplaceSearchKind = z.infer<typeof marketplaceSearchKind>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* One logical group of a search row: the group name and how many items the
|
|
99
|
+
* listing's latest published version places in it. The registry orders the
|
|
100
|
+
* array count DESC then name ASC; the UI renders in that order.
|
|
101
|
+
*/
|
|
102
|
+
export const marketplaceSearchGroup = z.object({
|
|
103
|
+
name: z.string(),
|
|
104
|
+
count: z.number(),
|
|
105
|
+
});
|
|
106
|
+
export type MarketplaceSearchGroup = z.infer<typeof marketplaceSearchGroup>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* One listing-level search row (`GET /api/marketplace/search`). `ref` is the
|
|
110
|
+
* "namespace/name" install target, so every row carries enough to link to its
|
|
111
|
+
* plugin. `latest_version` is nullable defensively; the search relation only
|
|
112
|
+
* emits listings with a published version. `kinds` summarizes that latest
|
|
113
|
+
* version's UNGROUPED items; `groups` summarizes its logical groups (`[]` when
|
|
114
|
+
* none). Both keys are always present.
|
|
115
|
+
*/
|
|
116
|
+
export const marketplaceSearchRow = z.object({
|
|
117
|
+
ref: z.string(),
|
|
118
|
+
namespace: z.string(),
|
|
119
|
+
name: z.string(),
|
|
120
|
+
display_name: z.string().nullable(),
|
|
121
|
+
icon_url: z.string().nullable(),
|
|
122
|
+
// Null for a descriptor listing (`source` `spec`): it names no package.
|
|
123
|
+
package: z.string().nullable(),
|
|
124
|
+
description: z.string(),
|
|
125
|
+
categories: z.array(z.string()),
|
|
126
|
+
tags: z.array(z.string()),
|
|
127
|
+
trust_tier: z.string(),
|
|
128
|
+
pricing: z.string(),
|
|
129
|
+
// A display-only premium flag: a badge, never a payment surface. Nullable
|
|
130
|
+
// + optional: an older registry omits it, and it is absent on non-premium rows.
|
|
131
|
+
premium: z.boolean().nullish(),
|
|
132
|
+
latest_version: z.string().nullable(),
|
|
133
|
+
downloads: z.number(),
|
|
134
|
+
updated_at: z.string(),
|
|
135
|
+
kinds: z.array(marketplaceSearchKind),
|
|
136
|
+
groups: z.array(marketplaceSearchGroup),
|
|
137
|
+
});
|
|
138
|
+
export type MarketplaceSearchRow = z.infer<typeof marketplaceSearchRow>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* One page of listing rows. The wire carries no next-page field — has-next is
|
|
142
|
+
* COMPUTED: `page * page_size < total`.
|
|
143
|
+
*/
|
|
144
|
+
export const marketplaceSearchPage = z.object({
|
|
145
|
+
listings: z.array(marketplaceSearchRow),
|
|
146
|
+
total: z.number(),
|
|
147
|
+
page: z.number(),
|
|
148
|
+
page_size: z.number(),
|
|
149
|
+
});
|
|
150
|
+
export type MarketplaceSearchPage = z.infer<typeof marketplaceSearchPage>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* One version of a listing as the versions list carries it (`version`, its
|
|
154
|
+
* publication `status`, the `contract_range` it was validated against, and when
|
|
155
|
+
* it was `published_at`). `contract_range` and `published_at` are null until a
|
|
156
|
+
* version reaches the published state, so both are nullable.
|
|
157
|
+
*/
|
|
158
|
+
export const marketplaceVersion = z.object({
|
|
159
|
+
version: z.string(),
|
|
160
|
+
contract_range: z.string().nullable(),
|
|
161
|
+
status: z.string(),
|
|
162
|
+
published_at: z.string().nullable(),
|
|
163
|
+
});
|
|
164
|
+
export type MarketplaceVersion = z.infer<typeof marketplaceVersion>;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The listing's latest published version as embedded in its detail: the version
|
|
168
|
+
* (with the `marketplaceVersion` lifecycle fields) and the items it contains. The
|
|
169
|
+
* registry's detail body carries NO per-version `delivery` field — delivery is
|
|
170
|
+
* server-computed from whether the spec names a package, and the detail surface
|
|
171
|
+
* derives it from the listing's `package` (null ⇒ `descriptor`, else `package`).
|
|
172
|
+
* Env to collect comes from the install preview (`required_env` / `missing_env`),
|
|
173
|
+
* never from these items.
|
|
174
|
+
*/
|
|
175
|
+
export const marketplaceLatestVersion = marketplaceVersion.extend({
|
|
176
|
+
items: z.array(marketplaceItem),
|
|
177
|
+
});
|
|
178
|
+
export type MarketplaceLatestVersion = z.infer<typeof marketplaceLatestVersion>;
|
|
179
|
+
|
|
180
|
+
/** One advisory row; `withdrawn_at` non-null means it no longer applies. */
|
|
181
|
+
export const marketplaceAdvisory = z.object({
|
|
182
|
+
id: z.number(),
|
|
183
|
+
// The "namespace/name" listing ref exactly as the registry serves it — the
|
|
184
|
+
// wire field consumers match installed plugins against.
|
|
185
|
+
listing: z.string(),
|
|
186
|
+
affected_versions: z.string(),
|
|
187
|
+
severity: z.string(),
|
|
188
|
+
summary: z.string(),
|
|
189
|
+
created_at: z.string(),
|
|
190
|
+
withdrawn_at: z.string().nullable(),
|
|
191
|
+
});
|
|
192
|
+
export type MarketplaceAdvisory = z.infer<typeof marketplaceAdvisory>;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* A plugin's full detail (`GET /api/marketplace/plugins/{ns}/{name}`): the
|
|
196
|
+
* listing, its latest published version (`null` when nothing is published yet,
|
|
197
|
+
* carrying the contained items), and the known version history.
|
|
198
|
+
*/
|
|
199
|
+
export const marketplacePluginDetail = z.object({
|
|
200
|
+
namespace: z.string(),
|
|
201
|
+
name: z.string(),
|
|
202
|
+
display_name: z.string().nullable(),
|
|
203
|
+
icon_url: z.string().nullable(),
|
|
204
|
+
// Null for a descriptor listing (`source` `spec`): it names no package.
|
|
205
|
+
package: z.string().nullable(),
|
|
206
|
+
// The install-provenance vocabulary (`pypi` / `github` / `spec`). Nullish: an
|
|
207
|
+
// older registry omits it, and a listing with nothing published carries none.
|
|
208
|
+
source: marketplaceSource.nullish(),
|
|
209
|
+
description: z.string(),
|
|
210
|
+
readme_md: z.string().nullable(),
|
|
211
|
+
license: z.string().nullable(),
|
|
212
|
+
homepage_url: z.string().nullable(),
|
|
213
|
+
repository_url: z.string().nullable(),
|
|
214
|
+
// The marketplace-stored docs-site URL: the store is the source, the UI a
|
|
215
|
+
// link. Nullable + optional: absent on a listing with no published docs.
|
|
216
|
+
docs_url: z.string().nullish(),
|
|
217
|
+
categories: z.array(z.string()),
|
|
218
|
+
tags: z.array(z.string()),
|
|
219
|
+
trust_tier: z.string(),
|
|
220
|
+
pricing: z.string(),
|
|
221
|
+
// A display-only premium flag: a badge, never a payment surface.
|
|
222
|
+
premium: z.boolean().nullish(),
|
|
223
|
+
downloads: z.number(),
|
|
224
|
+
latest: marketplaceLatestVersion.nullable(),
|
|
225
|
+
versions: z.array(marketplaceVersion),
|
|
226
|
+
});
|
|
227
|
+
export type MarketplacePluginDetail = z.infer<typeof marketplacePluginDetail>;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* One installed plugin's compat verdict against the RUNNING tai42-contract:
|
|
231
|
+
* `compatible` / `incompatible` per its declared contract range, `unknown` when
|
|
232
|
+
* no verdict could be computed. `reason` is the human-readable explanation of a
|
|
233
|
+
* non-`compatible` verdict, `null` when compatible. CLOSED (`.strict()`): the
|
|
234
|
+
* server is built against exactly this shape, so an unknown key is drift and
|
|
235
|
+
* throws instead of being stripped.
|
|
236
|
+
*/
|
|
237
|
+
export const marketplaceInstalledCompat = z
|
|
238
|
+
.object({
|
|
239
|
+
status: z.enum(['compatible', 'incompatible', 'unknown']),
|
|
240
|
+
reason: z.string().nullable(),
|
|
241
|
+
})
|
|
242
|
+
.strict();
|
|
243
|
+
export type MarketplaceInstalledCompat = z.infer<typeof marketplaceInstalledCompat>;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* One installed marketplace plugin as the local attribution store records it.
|
|
247
|
+
* `latest` is the newest registry version (`null` when unknown);
|
|
248
|
+
* `update_available` advertises only a newer COMPATIBLE version, and
|
|
249
|
+
* `incompatible_newer` names the newest version blocked by the running
|
|
250
|
+
* contract (`null` when none), so "an update exists but needs a newer core" is
|
|
251
|
+
* visible. `missing_upstream` flags a plugin the registry no longer lists.
|
|
252
|
+
* `compat` is the row's verdict against the running contract. CLOSED, like
|
|
253
|
+
* every shape of the installed listing.
|
|
254
|
+
*/
|
|
255
|
+
export const marketplaceInstalledPlugin = z
|
|
256
|
+
.object({
|
|
257
|
+
ref: z.string(),
|
|
258
|
+
version: z.string(),
|
|
259
|
+
source: z.string(),
|
|
260
|
+
// How the row was delivered: `package` for a pip-installed plugin, `descriptor`
|
|
261
|
+
// for a descriptor-only plugin whose stored spec names no package.
|
|
262
|
+
delivery: marketplaceDelivery,
|
|
263
|
+
installed_at: z.string(),
|
|
264
|
+
latest: z.string().nullable(),
|
|
265
|
+
update_available: z.boolean(),
|
|
266
|
+
incompatible_newer: z.string().nullable(),
|
|
267
|
+
missing_upstream: z.boolean(),
|
|
268
|
+
compat: marketplaceInstalledCompat,
|
|
269
|
+
// The `{kind, name}` of every item this plugin's stored spec provides
|
|
270
|
+
// (local truth). The connectors page's McpServersSection joins the mcp-server
|
|
271
|
+
// item names against the manifest's mcp-entry titles to render an
|
|
272
|
+
// installer-written entry read-only.
|
|
273
|
+
items: z.array(marketplaceItem.pick({ kind: true, name: true })),
|
|
274
|
+
// The persisted `{item_name: base}` mount this plugin is installed at (local
|
|
275
|
+
// truth; `{}` means every item at its declared base). Studio seeds the update
|
|
276
|
+
// flow and renders routes at the ACTUAL mounted base from this.
|
|
277
|
+
route_mounts: z.record(z.string(), z.string()),
|
|
278
|
+
})
|
|
279
|
+
.strict();
|
|
280
|
+
export type MarketplaceInstalledPlugin = z.infer<typeof marketplaceInstalledPlugin>;
|
|
281
|
+
|
|
282
|
+
/** One plugin the boot pass quarantined instead of loading, with why. CLOSED. */
|
|
283
|
+
export const marketplaceQuarantinedPlugin = z
|
|
284
|
+
.object({
|
|
285
|
+
name: z.string(),
|
|
286
|
+
reason: z.string(),
|
|
287
|
+
})
|
|
288
|
+
.strict();
|
|
289
|
+
export type MarketplaceQuarantinedPlugin = z.infer<typeof marketplaceQuarantinedPlugin>;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* The installed inventory (`GET /api/marketplace/installed`): the attributed
|
|
293
|
+
* rows plus every plugin the boot pass quarantined instead of loading. CLOSED.
|
|
294
|
+
*/
|
|
295
|
+
export const marketplaceInstalled = z
|
|
296
|
+
.object({
|
|
297
|
+
installed: z.array(marketplaceInstalledPlugin),
|
|
298
|
+
quarantined: z.array(marketplaceQuarantinedPlugin),
|
|
299
|
+
})
|
|
300
|
+
.strict();
|
|
301
|
+
export type MarketplaceInstalled = z.infer<typeof marketplaceInstalled>;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* One per-plugin outcome of `POST /api/marketplace/upgrade-all`: `upgraded`,
|
|
305
|
+
* already `up-to-date`, `no-compatible-version` in the registry, or `failed`;
|
|
306
|
+
* `detail` always carries the human-readable specifics. CLOSED.
|
|
307
|
+
*/
|
|
308
|
+
export const marketplaceUpgradeAllRow = z
|
|
309
|
+
.object({
|
|
310
|
+
ref: z.string(),
|
|
311
|
+
outcome: z.enum(['upgraded', 'up-to-date', 'no-compatible-version', 'failed']),
|
|
312
|
+
detail: z.string(),
|
|
313
|
+
})
|
|
314
|
+
.strict();
|
|
315
|
+
export type MarketplaceUpgradeAllRow = z.infer<typeof marketplaceUpgradeAllRow>;
|
|
316
|
+
|
|
317
|
+
/** The whole upgrade-all readout: one outcome row per installed plugin. CLOSED. */
|
|
318
|
+
export const marketplaceUpgradeAllResult = z
|
|
319
|
+
.object({
|
|
320
|
+
results: z.array(marketplaceUpgradeAllRow),
|
|
321
|
+
})
|
|
322
|
+
.strict();
|
|
323
|
+
export type MarketplaceUpgradeAllResult = z.infer<typeof marketplaceUpgradeAllResult>;
|
|
324
|
+
|
|
325
|
+
/** The advisory state for installed plugins, with when it was last fetched. */
|
|
326
|
+
export const marketplaceAdvisories = z.object({
|
|
327
|
+
advisories: z.array(marketplaceAdvisory),
|
|
328
|
+
fetched_at: z.string(),
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
/** The registry's controlled category list, proxied through the skeleton. */
|
|
332
|
+
export const marketplaceCategories = z.array(z.string());
|
|
333
|
+
|
|
334
|
+
/** The registry's controlled item-kind list, proxied through the skeleton. */
|
|
335
|
+
export const marketplaceKinds = z.array(z.string());
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* One route the install / update actually mounted: the item that owns it, the
|
|
339
|
+
* absolute `full_path` it now answers, the `methods`, and whether it is served
|
|
340
|
+
* `public`. The receipt lists these so the operator sees what was opened where.
|
|
341
|
+
*/
|
|
342
|
+
export const marketplaceMountedRoute = z.object({
|
|
343
|
+
item: z.string(),
|
|
344
|
+
full_path: z.string(),
|
|
345
|
+
methods: z.array(routeMethod),
|
|
346
|
+
public: z.boolean(),
|
|
347
|
+
});
|
|
348
|
+
export type MarketplaceMountedRoute = z.infer<typeof marketplaceMountedRoute>;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* The receipt of an install / update: what landed and at which version.
|
|
352
|
+
* `notes` (env-selected items naming their activating env var) and any
|
|
353
|
+
* non-critical `advisories` ride BOTH the install and update receipts.
|
|
354
|
+
* `routes` is the mounted-route list — empty for a plugin that registers none.
|
|
355
|
+
* The wire also carries `package`, `reload`, and `pip_output`, which the receipt
|
|
356
|
+
* does not model — zod's default strip drops them; the UI renders the receipt,
|
|
357
|
+
* not the raw install log.
|
|
358
|
+
*/
|
|
359
|
+
export const marketplaceInstallResult = z.object({
|
|
360
|
+
ref: z.string(),
|
|
361
|
+
version: z.string(),
|
|
362
|
+
notes: z.array(z.string()),
|
|
363
|
+
advisories: z.array(marketplaceAdvisory),
|
|
364
|
+
routes: z.array(marketplaceMountedRoute),
|
|
365
|
+
});
|
|
366
|
+
export type MarketplaceInstallResult = z.infer<typeof marketplaceInstallResult>;
|
|
367
|
+
|
|
368
|
+
/** One resolved route in an install preview: the declared `path`, its resolved
|
|
369
|
+
* absolute `full_path`, the `methods`, and whether it is `public`. */
|
|
370
|
+
export const marketplacePreviewRoute = z.object({
|
|
371
|
+
path: z.string(),
|
|
372
|
+
full_path: z.string(),
|
|
373
|
+
methods: z.array(routeMethod),
|
|
374
|
+
public: z.boolean(),
|
|
375
|
+
});
|
|
376
|
+
export type MarketplacePreviewRoute = z.infer<typeof marketplacePreviewRoute>;
|
|
377
|
+
|
|
378
|
+
/** One route-carrying item in an install preview: its resolved `base` (the
|
|
379
|
+
* override or the default), the `default_base` it declares, and the routes that
|
|
380
|
+
* mount under it. */
|
|
381
|
+
export const marketplacePreviewItem = z.object({
|
|
382
|
+
item: z.string(),
|
|
383
|
+
kind: z.string(),
|
|
384
|
+
base: z.string(),
|
|
385
|
+
default_base: z.string(),
|
|
386
|
+
routes: z.array(marketplacePreviewRoute),
|
|
387
|
+
});
|
|
388
|
+
export type MarketplacePreviewItem = z.infer<typeof marketplacePreviewItem>;
|
|
389
|
+
|
|
390
|
+
/** One collision the preview found: a route whose resolved shape+method clashes
|
|
391
|
+
* with an already-owned route. `conflict_owner` is `core` or `plugin:<ref>`; the
|
|
392
|
+
* remedy is to remap the item's base. */
|
|
393
|
+
export const marketplacePreviewCollision = z.object({
|
|
394
|
+
item: z.string(),
|
|
395
|
+
full_path: z.string(),
|
|
396
|
+
methods: z.array(routeMethod),
|
|
397
|
+
conflict_owner: z.string(),
|
|
398
|
+
conflict_path: z.string(),
|
|
399
|
+
});
|
|
400
|
+
export type MarketplacePreviewCollision = z.infer<typeof marketplacePreviewCollision>;
|
|
401
|
+
|
|
402
|
+
/** One public route the operator is asked to accept: served WITHOUT
|
|
403
|
+
* authentication once installed. */
|
|
404
|
+
export const marketplacePreviewPublicRoute = z.object({
|
|
405
|
+
item: z.string(),
|
|
406
|
+
full_path: z.string(),
|
|
407
|
+
methods: z.array(routeMethod),
|
|
408
|
+
});
|
|
409
|
+
export type MarketplacePreviewPublicRoute = z.infer<typeof marketplacePreviewPublicRoute>;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* The install preview (`POST /api/marketplace/install/preview`): the resolved
|
|
413
|
+
* routes per item with any base overrides applied, the collisions against the
|
|
414
|
+
* live registry, the public routes requiring acceptance, and whether acceptance
|
|
415
|
+
* is required at all. `new_public_routes` narrows to rows not already approved
|
|
416
|
+
* (the update case); on a fresh install it equals `public_routes`.
|
|
417
|
+
*
|
|
418
|
+
* `required_env` is every env var the spec requires with its derived secret-ness;
|
|
419
|
+
* `missing_env` is the bare names not already present in the env store union
|
|
420
|
+
* process env (server-computed — the ONE authority the dialog collects), and
|
|
421
|
+
* `delivery` is the one word the surface shows (`package` / `descriptor`).
|
|
422
|
+
*/
|
|
423
|
+
export const marketplaceInstallPreview = z.object({
|
|
424
|
+
ref: z.string(),
|
|
425
|
+
version: z.string(),
|
|
426
|
+
items: z.array(marketplacePreviewItem),
|
|
427
|
+
collisions: z.array(marketplacePreviewCollision),
|
|
428
|
+
public_routes: z.array(marketplacePreviewPublicRoute),
|
|
429
|
+
new_public_routes: z.array(marketplacePreviewPublicRoute),
|
|
430
|
+
requires_public_acceptance: z.boolean(),
|
|
431
|
+
required_env: z.array(marketplaceRequiredEnvVar),
|
|
432
|
+
missing_env: z.array(z.string()),
|
|
433
|
+
delivery: marketplaceDelivery,
|
|
434
|
+
});
|
|
435
|
+
export type MarketplaceInstallPreview = z.infer<typeof marketplaceInstallPreview>;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* The receipt of an uninstall. `notes` carries operator warnings (e.g. a config
|
|
439
|
+
* provider still selected by its env var); render them like the install
|
|
440
|
+
* receipt's notes.
|
|
441
|
+
*/
|
|
442
|
+
export const marketplaceUninstallResult = z.object({
|
|
443
|
+
ref: z.string(),
|
|
444
|
+
uninstalled: z.literal(true),
|
|
445
|
+
notes: z.array(z.string()),
|
|
446
|
+
});
|
|
447
|
+
export type MarketplaceUninstallResult = z.infer<typeof marketplaceUninstallResult>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Notification-sink record response schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { channelTemplate } from './served';
|
|
4
|
+
|
|
5
|
+
// The internal notifications sink: the messages the `notify_user` operation records
|
|
6
|
+
// with no channel, so they land only in the Studio inbox. Each record carries the
|
|
7
|
+
// server-minted id + timestamp; `recipient` is null when the message names none.
|
|
8
|
+
// The sink also stores the richer-send forms a notify carried — `media`
|
|
9
|
+
// (images/links shown WITH the message), `template` (a pre-approved out-of-window
|
|
10
|
+
// send), `options` (tappable option labels) — plus the `audience` identity the
|
|
11
|
+
// record is addressed to; the inbox renders them.
|
|
12
|
+
|
|
13
|
+
export const notification = z.object({
|
|
14
|
+
id: z.string(),
|
|
15
|
+
message: z.string(),
|
|
16
|
+
// A channel DELIVERY address the message went to; null when the send named none.
|
|
17
|
+
recipient: z.string().nullable(),
|
|
18
|
+
// The IDENTITY (a user_id) whose in-app inbox the record is addressed to, distinct
|
|
19
|
+
// from `recipient`. `.nullish()` accepts both an older record that predates the
|
|
20
|
+
// field (key omitted) and a broadcast send (explicit null) — both parse to "none".
|
|
21
|
+
audience: z.string().nullish(),
|
|
22
|
+
// Display-only media stored WITH the message (images and/or links). Deliberately
|
|
23
|
+
// LOOSE (`z.array(z.unknown())`), like the interactions frame: each item is
|
|
24
|
+
// `safeParse`d per item by the renderer against `interactionMediaItem`, so one
|
|
25
|
+
// malformed/hostile item is a loud per-item notice, never a whole-feed parse
|
|
26
|
+
// failure that would silently vanish every other notification. `.nullish()` covers
|
|
27
|
+
// an older record (key omitted) and a plain send (explicit null).
|
|
28
|
+
media: z.array(z.unknown()).nullish(),
|
|
29
|
+
// A pre-approved template the notify carried, parsed strictly: a drifting one is a
|
|
30
|
+
// loud feed-level `ApiSchemaError`, consistent with the record contract.
|
|
31
|
+
template: channelTemplate.nullish(),
|
|
32
|
+
// Tappable option labels the notify offered; display-only in the operator inbox
|
|
33
|
+
// (there is no conversation for the sink to enter). Strictly a string list.
|
|
34
|
+
options: z.array(z.string()).nullish(),
|
|
35
|
+
created_at: z.string(),
|
|
36
|
+
});
|
|
37
|
+
export type Notification = z.infer<typeof notification>;
|
|
38
|
+
|
|
39
|
+
export const notifications = z.object({
|
|
40
|
+
notifications: z.array(notification),
|
|
41
|
+
});
|
|
42
|
+
export type Notifications = z.infer<typeof notifications>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Run metrics, listing, span and trace response schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { jsonValue } from './shared';
|
|
4
|
+
|
|
5
|
+
export const dashboardMetrics = z.object({
|
|
6
|
+
summary: z.object({
|
|
7
|
+
totalRuns: z.number(),
|
|
8
|
+
totalCost: z.number(),
|
|
9
|
+
totalTokens: z.number(),
|
|
10
|
+
averageLatencyMs: z.number(),
|
|
11
|
+
avgCostPerRun: z.number(),
|
|
12
|
+
avgTokensPerRun: z.number(),
|
|
13
|
+
timeToFirstTokenMs: z.number().nullable(),
|
|
14
|
+
}),
|
|
15
|
+
timeSeries: z.array(
|
|
16
|
+
z.object({
|
|
17
|
+
bucket: z.string().nullable(),
|
|
18
|
+
runs: z.number(),
|
|
19
|
+
cost: z.number(),
|
|
20
|
+
avgLatencyMs: z.number(),
|
|
21
|
+
totalTokens: z.number(),
|
|
22
|
+
}),
|
|
23
|
+
),
|
|
24
|
+
byModel: z.array(
|
|
25
|
+
z.object({
|
|
26
|
+
model: z.string(),
|
|
27
|
+
calls: z.number(),
|
|
28
|
+
cost: z.number(),
|
|
29
|
+
totalTokens: z.number(),
|
|
30
|
+
avgLatencyMs: z.number(),
|
|
31
|
+
}),
|
|
32
|
+
),
|
|
33
|
+
granularity: z.enum(['hour', 'day', 'week']),
|
|
34
|
+
});
|
|
35
|
+
export type DashboardMetrics = z.infer<typeof dashboardMetrics>;
|
|
36
|
+
|
|
37
|
+
export const run = z.object({
|
|
38
|
+
id: z.string(),
|
|
39
|
+
traceId: z.string(),
|
|
40
|
+
createdAt: z.string().nullable(),
|
|
41
|
+
tags: z.array(z.string()),
|
|
42
|
+
status: z.enum(['error', 'success']),
|
|
43
|
+
cost: z.number().nullable(),
|
|
44
|
+
latencyMs: z.number().nullable(),
|
|
45
|
+
totalTokens: z.number().nullable(),
|
|
46
|
+
inputPreview: jsonValue,
|
|
47
|
+
outputPreview: jsonValue,
|
|
48
|
+
});
|
|
49
|
+
export type Run = z.infer<typeof run>;
|
|
50
|
+
|
|
51
|
+
export const runsPage = z.object({
|
|
52
|
+
items: z.array(run),
|
|
53
|
+
page: z.number(),
|
|
54
|
+
nextPage: z.number().nullable(),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export const runSpan = z.object({
|
|
58
|
+
id: z.string(),
|
|
59
|
+
parentId: z.string().nullable(),
|
|
60
|
+
traceId: z.string().nullable(),
|
|
61
|
+
name: z.string().nullable(),
|
|
62
|
+
type: z.string().nullable(),
|
|
63
|
+
level: z.string().nullable(),
|
|
64
|
+
statusMessage: z.string().nullable(),
|
|
65
|
+
start: z.string().nullable(),
|
|
66
|
+
end: z.string().nullable(),
|
|
67
|
+
model: z.string().nullable(),
|
|
68
|
+
usage: jsonValue.nullable(),
|
|
69
|
+
metadata: jsonValue.nullable(),
|
|
70
|
+
input: jsonValue,
|
|
71
|
+
output: jsonValue,
|
|
72
|
+
nodeId: z.string().nullable(),
|
|
73
|
+
});
|
|
74
|
+
export type RunSpan = z.infer<typeof runSpan>;
|
|
75
|
+
|
|
76
|
+
export const runTrace = z.object({
|
|
77
|
+
traceId: z.string(),
|
|
78
|
+
timestamp: z.string().nullable(),
|
|
79
|
+
tags: z.array(z.string()),
|
|
80
|
+
totalCost: z.number().nullable(),
|
|
81
|
+
input: jsonValue,
|
|
82
|
+
output: jsonValue,
|
|
83
|
+
metadata: jsonValue.nullable(),
|
|
84
|
+
spans: z.array(runSpan),
|
|
85
|
+
});
|
|
86
|
+
export type RunTrace = z.infer<typeof runTrace>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Access-policy validation, version and rollback response schemas. */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { policyBody } from './served';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `POST /api/auth/validate-condition` — the fail-closed jq guard. `ok` is the
|
|
7
|
+
* compile/render result; `result` is the boolean of a sample evaluation, or
|
|
8
|
+
* `null` when no `sample_context` was supplied (compile-only). A broken condition
|
|
9
|
+
* is a `400 {error}` surfaced by the transport, NEVER a false `ok` — so a
|
|
10
|
+
* syntactically-broken condition can be caught before it locks a key out. A drift
|
|
11
|
+
* throws `ApiSchemaError`.
|
|
12
|
+
*/
|
|
13
|
+
export const validateConditionResult = z.object({
|
|
14
|
+
ok: z.boolean(),
|
|
15
|
+
result: z.boolean().nullable(),
|
|
16
|
+
});
|
|
17
|
+
export type ValidateConditionResult = z.infer<typeof validateConditionResult>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* One immutable policy version row
|
|
21
|
+
* (`GET /api/auth/api-keys/{user_id}/policy/versions`). `is_current` flags the
|
|
22
|
+
* active pointer; `tags` is the generic per-version label list (kind-agnostic),
|
|
23
|
+
* mirroring the preset version shape.
|
|
24
|
+
*/
|
|
25
|
+
export const policyVersion = z.object({
|
|
26
|
+
version: z.number(),
|
|
27
|
+
body: policyBody,
|
|
28
|
+
tags: z.array(z.string()),
|
|
29
|
+
created_at: z.string(),
|
|
30
|
+
is_current: z.boolean(),
|
|
31
|
+
});
|
|
32
|
+
export type PolicyVersion = z.infer<typeof policyVersion>;
|
|
33
|
+
|
|
34
|
+
export const policyVersionList = z.array(policyVersion);
|
|
35
|
+
|
|
36
|
+
/** `POST /api/auth/api-keys/{user_id}/policy/rollback` — the re-pointed version. */
|
|
37
|
+
export const policyRollback = z.object({ user_id: z.string(), active_version: z.number() });
|