@tai42/api-client 20.0.0 → 22.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/README.md +29 -0
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +6 -4
- package/dist/agents.js.map +1 -1
- package/dist/client/agents-client.d.ts.map +1 -1
- package/dist/client/agents-client.js +3 -2
- package/dist/client/agents-client.js.map +1 -1
- package/dist/client/auth-client.d.ts +129 -127
- package/dist/client/auth-client.d.ts.map +1 -1
- package/dist/client/auth-client.js +68 -28
- package/dist/client/auth-client.js.map +1 -1
- package/dist/client/backend-client.d.ts +14 -13
- package/dist/client/backend-client.d.ts.map +1 -1
- package/dist/client/backend-client.js +7 -3
- package/dist/client/backend-client.js.map +1 -1
- package/dist/client/backup-client.d.ts +45 -19
- package/dist/client/backup-client.d.ts.map +1 -1
- package/dist/client/backup-client.js +8 -3
- package/dist/client/backup-client.js.map +1 -1
- package/dist/client/capabilities-client.d.ts +20 -16
- package/dist/client/capabilities-client.d.ts.map +1 -1
- package/dist/client/capabilities-client.js +3 -2
- package/dist/client/capabilities-client.js.map +1 -1
- package/dist/client/channels-client.d.ts.map +1 -1
- package/dist/client/channels-client.js +2 -1
- package/dist/client/channels-client.js.map +1 -1
- package/dist/client/config-client.d.ts +44 -17
- package/dist/client/config-client.d.ts.map +1 -1
- package/dist/client/config-client.js +10 -4
- package/dist/client/config-client.js.map +1 -1
- package/dist/client/connectors-client.d.ts +270 -81
- package/dist/client/connectors-client.d.ts.map +1 -1
- package/dist/client/connectors-client.js +38 -10
- package/dist/client/connectors-client.js.map +1 -1
- package/dist/client/conversations-client.d.ts +440 -86
- package/dist/client/conversations-client.d.ts.map +1 -1
- package/dist/client/conversations-client.js +46 -17
- package/dist/client/conversations-client.js.map +1 -1
- package/dist/client/hooks-client.d.ts +3 -3
- package/dist/client/hooks-client.d.ts.map +1 -1
- package/dist/client/hooks-client.js +12 -7
- package/dist/client/hooks-client.js.map +1 -1
- package/dist/client/index.d.ts +2272 -914
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +10 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/interactions-client.d.ts +19 -14
- package/dist/client/interactions-client.d.ts.map +1 -1
- package/dist/client/interactions-client.js +21 -9
- package/dist/client/interactions-client.js.map +1 -1
- package/dist/client/login-client.d.ts +18 -17
- package/dist/client/login-client.d.ts.map +1 -1
- package/dist/client/login-client.js +8 -4
- package/dist/client/login-client.js.map +1 -1
- package/dist/client/manifest-client.d.ts +276 -105
- package/dist/client/manifest-client.d.ts.map +1 -1
- package/dist/client/manifest-client.js +22 -16
- package/dist/client/manifest-client.js.map +1 -1
- package/dist/client/marketplace-client.d.ts +181 -51
- package/dist/client/marketplace-client.d.ts.map +1 -1
- package/dist/client/marketplace-client.js +23 -12
- package/dist/client/marketplace-client.js.map +1 -1
- package/dist/client/mcp-config-schema-client.d.ts.map +1 -1
- package/dist/client/mcp-config-schema-client.js +2 -1
- package/dist/client/mcp-config-schema-client.js.map +1 -1
- package/dist/client/notifications-client.d.ts +43 -6
- package/dist/client/notifications-client.d.ts.map +1 -1
- package/dist/client/notifications-client.js +2 -1
- package/dist/client/notifications-client.js.map +1 -1
- package/dist/client/observability-client.d.ts +78 -38
- package/dist/client/observability-client.d.ts.map +1 -1
- package/dist/client/observability-client.js +29 -6
- package/dist/client/observability-client.js.map +1 -1
- package/dist/client/plugins-client.d.ts +8 -6
- package/dist/client/plugins-client.d.ts.map +1 -1
- package/dist/client/plugins-client.js +2 -1
- package/dist/client/plugins-client.js.map +1 -1
- package/dist/client/policy-client.d.ts +4 -4
- package/dist/client/policy-client.d.ts.map +1 -1
- package/dist/client/policy-client.js +11 -4
- package/dist/client/policy-client.js.map +1 -1
- package/dist/client/presets-client.d.ts +84 -39
- package/dist/client/presets-client.d.ts.map +1 -1
- package/dist/client/presets-client.js +25 -13
- package/dist/client/presets-client.js.map +1 -1
- package/dist/client/profiles-client.d.ts +40 -33
- package/dist/client/profiles-client.d.ts.map +1 -1
- package/dist/client/profiles-client.js +15 -10
- package/dist/client/profiles-client.js.map +1 -1
- package/dist/client/schedules-client.d.ts +21 -17
- package/dist/client/schedules-client.d.ts.map +1 -1
- package/dist/client/schedules-client.js +8 -5
- package/dist/client/schedules-client.js.map +1 -1
- package/dist/client/settings-schema-client.d.ts +1 -1
- package/dist/client/settings-schema-client.d.ts.map +1 -1
- package/dist/client/settings-schema-client.js +2 -1
- package/dist/client/settings-schema-client.js.map +1 -1
- package/dist/client/states-client.d.ts +215 -87
- package/dist/client/states-client.d.ts.map +1 -1
- package/dist/client/states-client.js +98 -37
- package/dist/client/states-client.js.map +1 -1
- package/dist/client/storage-client.d.ts +5 -5
- package/dist/client/storage-client.d.ts.map +1 -1
- package/dist/client/storage-client.js +24 -12
- package/dist/client/storage-client.js.map +1 -1
- package/dist/client/sub-mcp-client.d.ts +3 -1
- package/dist/client/sub-mcp-client.d.ts.map +1 -1
- package/dist/client/sub-mcp-client.js +9 -4
- package/dist/client/sub-mcp-client.js.map +1 -1
- package/dist/client/system-client.d.ts +2 -2
- package/dist/client/system-client.d.ts.map +1 -1
- package/dist/client/system-client.js +2 -1
- package/dist/client/system-client.js.map +1 -1
- package/dist/client/templates-client.d.ts +65 -6
- package/dist/client/templates-client.d.ts.map +1 -1
- package/dist/client/templates-client.js +25 -7
- package/dist/client/templates-client.js.map +1 -1
- package/dist/client/tool-extensions-client.d.ts +41 -16
- package/dist/client/tool-extensions-client.d.ts.map +1 -1
- package/dist/client/tool-extensions-client.js +6 -4
- package/dist/client/tool-extensions-client.js.map +1 -1
- package/dist/client/tool-meta-client.d.ts +8 -8
- package/dist/client/tool-meta-client.d.ts.map +1 -1
- package/dist/client/tool-meta-client.js +12 -8
- package/dist/client/tool-meta-client.js.map +1 -1
- package/dist/client/tools-client.d.ts +150 -23
- package/dist/client/tools-client.d.ts.map +1 -1
- package/dist/client/tools-client.js +8 -8
- package/dist/client/tools-client.js.map +1 -1
- package/dist/client/trigger-links-client.d.ts +11 -9
- package/dist/client/trigger-links-client.d.ts.map +1 -1
- package/dist/client/trigger-links-client.js +4 -4
- package/dist/client/trigger-links-client.js.map +1 -1
- package/dist/fleet-report.d.ts +21 -5
- package/dist/fleet-report.d.ts.map +1 -1
- package/dist/fleet-report.js +31 -6
- package/dist/fleet-report.js.map +1 -1
- package/dist/generated/api-routes.d.ts +1014 -0
- package/dist/generated/api-routes.d.ts.map +1 -0
- package/dist/generated/api-routes.js +322 -0
- package/dist/generated/api-routes.js.map +1 -0
- package/dist/generated/openapi-schemas.d.ts +12425 -0
- package/dist/generated/openapi-schemas.d.ts.map +1 -0
- package/dist/generated/openapi-schemas.js +671 -0
- package/dist/generated/openapi-schemas.js.map +1 -0
- package/dist/generated/served-schemas.d.ts +6698 -349
- package/dist/generated/served-schemas.d.ts.map +1 -1
- package/dist/generated/served-schemas.js +7062 -21
- package/dist/generated/served-schemas.js.map +1 -1
- package/dist/headers.d.ts +4 -0
- package/dist/headers.d.ts.map +1 -0
- package/dist/headers.js +4 -0
- package/dist/headers.js.map +1 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +4 -3
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/schemas/api-keys.d.ts +14 -12
- package/dist/schemas/api-keys.d.ts.map +1 -1
- package/dist/schemas/api-keys.js +9 -23
- package/dist/schemas/api-keys.js.map +1 -1
- package/dist/schemas/auth-routes.d.ts +34 -29
- package/dist/schemas/auth-routes.d.ts.map +1 -1
- package/dist/schemas/auth-routes.js +22 -27
- package/dist/schemas/auth-routes.js.map +1 -1
- package/dist/schemas/backup.d.ts +157 -36
- package/dist/schemas/backup.d.ts.map +1 -1
- package/dist/schemas/backup.js +27 -26
- package/dist/schemas/backup.js.map +1 -1
- package/dist/schemas/capabilities.d.ts +32 -22
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/capabilities.js +15 -40
- package/dist/schemas/capabilities.js.map +1 -1
- package/dist/schemas/channels.d.ts +1 -1
- package/dist/schemas/channels.d.ts.map +1 -1
- package/dist/schemas/channels.js +2 -5
- package/dist/schemas/channels.js.map +1 -1
- package/dist/schemas/config.d.ts.map +1 -1
- package/dist/schemas/config.js +4 -6
- package/dist/schemas/config.js.map +1 -1
- package/dist/schemas/connectors.d.ts +381 -185
- package/dist/schemas/connectors.d.ts.map +1 -1
- package/dist/schemas/connectors.js +54 -101
- package/dist/schemas/connectors.js.map +1 -1
- package/dist/schemas/conversations.d.ts +977 -248
- package/dist/schemas/conversations.d.ts.map +1 -1
- package/dist/schemas/conversations.js +40 -134
- package/dist/schemas/conversations.js.map +1 -1
- package/dist/schemas/extensions.d.ts +9 -6
- package/dist/schemas/extensions.d.ts.map +1 -1
- package/dist/schemas/extensions.js +6 -4
- package/dist/schemas/extensions.js.map +1 -1
- package/dist/schemas/fleet.d.ts +153 -99
- package/dist/schemas/fleet.d.ts.map +1 -1
- package/dist/schemas/fleet.js +41 -51
- package/dist/schemas/fleet.js.map +1 -1
- package/dist/schemas/hooks.d.ts +34 -34
- package/dist/schemas/hooks.d.ts.map +1 -1
- package/dist/schemas/hooks.js +15 -34
- package/dist/schemas/hooks.js.map +1 -1
- package/dist/schemas/index.d.ts +0 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +0 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/interactions.d.ts +400 -128
- package/dist/schemas/interactions.d.ts.map +1 -1
- package/dist/schemas/interactions.js +202 -131
- package/dist/schemas/interactions.js.map +1 -1
- package/dist/schemas/login.d.ts +36 -37
- package/dist/schemas/login.d.ts.map +1 -1
- package/dist/schemas/login.js +8 -42
- package/dist/schemas/login.js.map +1 -1
- package/dist/schemas/manifest-mcp.d.ts +61 -35
- package/dist/schemas/manifest-mcp.d.ts.map +1 -1
- package/dist/schemas/manifest-mcp.js +13 -19
- package/dist/schemas/manifest-mcp.js.map +1 -1
- package/dist/schemas/marketplace.d.ts +219 -133
- package/dist/schemas/marketplace.d.ts.map +1 -1
- package/dist/schemas/marketplace.js +35 -120
- package/dist/schemas/marketplace.js.map +1 -1
- package/dist/schemas/members.d.ts +59 -52
- package/dist/schemas/members.d.ts.map +1 -1
- package/dist/schemas/members.js +20 -52
- package/dist/schemas/members.js.map +1 -1
- package/dist/schemas/notifications.d.ts +115 -17
- package/dist/schemas/notifications.d.ts.map +1 -1
- package/dist/schemas/notifications.js +9 -35
- package/dist/schemas/notifications.js.map +1 -1
- package/dist/schemas/observability.d.ts +174 -72
- package/dist/schemas/observability.d.ts.map +1 -1
- package/dist/schemas/observability.js +23 -76
- package/dist/schemas/observability.js.map +1 -1
- package/dist/schemas/policy.d.ts +11 -11
- package/dist/schemas/policy.d.ts.map +1 -1
- package/dist/schemas/policy.js +5 -12
- package/dist/schemas/policy.js.map +1 -1
- package/dist/schemas/presets.d.ts +109 -64
- package/dist/schemas/presets.d.ts.map +1 -1
- package/dist/schemas/presets.js +12 -48
- package/dist/schemas/presets.js.map +1 -1
- package/dist/schemas/principals.d.ts +28 -21
- package/dist/schemas/principals.d.ts.map +1 -1
- package/dist/schemas/principals.js +13 -25
- package/dist/schemas/principals.js.map +1 -1
- package/dist/schemas/profiles.d.ts +75 -63
- package/dist/schemas/profiles.d.ts.map +1 -1
- package/dist/schemas/profiles.js +24 -54
- package/dist/schemas/profiles.js.map +1 -1
- package/dist/schemas/roles.d.ts +22 -22
- package/dist/schemas/roles.d.ts.map +1 -1
- package/dist/schemas/roles.js +10 -17
- package/dist/schemas/roles.js.map +1 -1
- package/dist/schemas/schedules.d.ts +21 -15
- package/dist/schemas/schedules.d.ts.map +1 -1
- package/dist/schemas/schedules.js +4 -13
- package/dist/schemas/schedules.js.map +1 -1
- package/dist/schemas/served.d.ts +6373 -181
- package/dist/schemas/served.d.ts.map +1 -1
- package/dist/schemas/served.js +21 -0
- package/dist/schemas/served.js.map +1 -1
- package/dist/schemas/settings-schema.d.ts +1 -1
- package/dist/schemas/settings-schema.d.ts.map +1 -1
- package/dist/schemas/settings-schema.js +17 -19
- package/dist/schemas/settings-schema.js.map +1 -1
- package/dist/schemas/setup.d.ts +6 -6
- package/dist/schemas/setup.d.ts.map +1 -1
- package/dist/schemas/setup.js +2 -11
- package/dist/schemas/setup.js.map +1 -1
- package/dist/schemas/states.d.ts +450 -135
- package/dist/schemas/states.d.ts.map +1 -1
- package/dist/schemas/states.js +76 -140
- package/dist/schemas/states.js.map +1 -1
- package/dist/schemas/storage.d.ts +7 -8
- package/dist/schemas/storage.d.ts.map +1 -1
- package/dist/schemas/storage.js +8 -17
- package/dist/schemas/storage.js.map +1 -1
- package/dist/schemas/studio-plugins.d.ts +24 -18
- package/dist/schemas/studio-plugins.d.ts.map +1 -1
- package/dist/schemas/studio-plugins.js +5 -19
- package/dist/schemas/studio-plugins.js.map +1 -1
- package/dist/schemas/sub-mcp.d.ts +11 -8
- package/dist/schemas/sub-mcp.d.ts.map +1 -1
- package/dist/schemas/sub-mcp.js +10 -19
- package/dist/schemas/sub-mcp.js.map +1 -1
- package/dist/schemas/system-kinds.d.ts +76 -46
- package/dist/schemas/system-kinds.d.ts.map +1 -1
- package/dist/schemas/system-kinds.js +11 -28
- package/dist/schemas/system-kinds.js.map +1 -1
- package/dist/schemas/templates.d.ts +83 -25
- package/dist/schemas/templates.d.ts.map +1 -1
- package/dist/schemas/templates.js +8 -9
- package/dist/schemas/templates.js.map +1 -1
- package/dist/schemas/tool-meta.d.ts +15 -15
- package/dist/schemas/tool-meta.d.ts.map +1 -1
- package/dist/schemas/tool-meta.js +6 -21
- package/dist/schemas/tool-meta.js.map +1 -1
- package/dist/schemas/tools.d.ts +177 -56
- package/dist/schemas/tools.d.ts.map +1 -1
- package/dist/schemas/tools.js +20 -41
- package/dist/schemas/tools.js.map +1 -1
- package/dist/schemas/trigger-links.d.ts +22 -17
- package/dist/schemas/trigger-links.d.ts.map +1 -1
- package/dist/schemas/trigger-links.js +7 -27
- package/dist/schemas/trigger-links.js.map +1 -1
- package/dist/tool-runs.d.ts +175 -54
- package/dist/tool-runs.d.ts.map +1 -1
- package/dist/tool-runs.js +33 -34
- package/dist/tool-runs.js.map +1 -1
- package/package.json +4 -3
- package/src/agents.ts +16 -4
- package/src/client/agents-client.ts +3 -2
- package/src/client/auth-client.ts +102 -37
- package/src/client/backend-client.ts +8 -3
- package/src/client/backup-client.ts +8 -3
- package/src/client/capabilities-client.ts +4 -2
- package/src/client/channels-client.ts +3 -1
- package/src/client/config-client.ts +13 -5
- package/src/client/connectors-client.ts +91 -16
- package/src/client/conversations-client.ts +79 -30
- package/src/client/hooks-client.ts +25 -12
- package/src/client/index.ts +16 -4
- package/src/client/interactions-client.ts +40 -16
- package/src/client/login-client.ts +8 -4
- package/src/client/manifest-client.ts +48 -24
- package/src/client/marketplace-client.ts +23 -12
- package/src/client/mcp-config-schema-client.ts +2 -1
- package/src/client/notifications-client.ts +2 -1
- package/src/client/observability-client.ts +60 -8
- package/src/client/plugins-client.ts +2 -1
- package/src/client/policy-client.ts +24 -9
- package/src/client/presets-client.ts +26 -13
- package/src/client/profiles-client.ts +53 -24
- package/src/client/schedules-client.ts +14 -20
- package/src/client/settings-schema-client.ts +2 -1
- package/src/client/states-client.ts +151 -49
- package/src/client/storage-client.ts +43 -14
- package/src/client/sub-mcp-client.ts +10 -4
- package/src/client/system-client.ts +2 -1
- package/src/client/templates-client.ts +26 -7
- package/src/client/tool-extensions-client.ts +14 -7
- package/src/client/tool-meta-client.ts +46 -21
- package/src/client/tools-client.ts +13 -8
- package/src/client/trigger-links-client.ts +10 -6
- package/src/fleet-report.ts +48 -7
- package/src/generated/api-routes.ts +327 -0
- package/src/generated/openapi-schemas.ts +1508 -0
- package/src/generated/served-schemas.ts +7120 -40
- package/src/headers.ts +4 -0
- package/src/http.ts +4 -3
- package/src/index.ts +54 -10
- package/src/schemas/api-keys.ts +9 -25
- package/src/schemas/auth-routes.ts +27 -28
- package/src/schemas/backup.ts +33 -31
- package/src/schemas/capabilities.ts +16 -39
- package/src/schemas/channels.ts +4 -4
- package/src/schemas/config.ts +6 -6
- package/src/schemas/connectors.ts +61 -102
- package/src/schemas/conversations.ts +43 -133
- package/src/schemas/extensions.ts +7 -4
- package/src/schemas/fleet.ts +51 -51
- package/src/schemas/hooks.ts +18 -37
- package/src/schemas/index.ts +0 -1
- package/src/schemas/interactions.ts +227 -131
- package/src/schemas/login.ts +10 -41
- package/src/schemas/manifest-mcp.ts +13 -19
- package/src/schemas/marketplace.ts +37 -120
- package/src/schemas/members.ts +21 -51
- package/src/schemas/notifications.ts +10 -34
- package/src/schemas/observability.ts +34 -79
- package/src/schemas/policy.ts +5 -12
- package/src/schemas/presets.ts +13 -48
- package/src/schemas/principals.ts +17 -24
- package/src/schemas/profiles.ts +25 -55
- package/src/schemas/roles.ts +11 -17
- package/src/schemas/schedules.ts +4 -15
- package/src/schemas/served.ts +33 -0
- package/src/schemas/settings-schema.ts +18 -23
- package/src/schemas/setup.ts +4 -10
- package/src/schemas/states.ts +88 -139
- package/src/schemas/storage.ts +10 -16
- package/src/schemas/studio-plugins.ts +8 -19
- package/src/schemas/sub-mcp.ts +12 -18
- package/src/schemas/system-kinds.ts +12 -29
- package/src/schemas/templates.ts +8 -10
- package/src/schemas/tool-meta.ts +8 -20
- package/src/schemas/tools.ts +22 -45
- package/src/schemas/trigger-links.ts +8 -26
- package/src/tool-runs.ts +47 -38
- package/dist/client/web-entry-gate-client.d.ts +0 -34
- package/dist/client/web-entry-gate-client.d.ts.map +0 -1
- package/dist/client/web-entry-gate-client.js +0 -25
- package/dist/client/web-entry-gate-client.js.map +0 -1
- package/dist/schemas/web-entry.d.ts +0 -45
- package/dist/schemas/web-entry.d.ts.map +0 -1
- package/dist/schemas/web-entry.js +0 -36
- package/dist/schemas/web-entry.js.map +0 -1
- package/src/client/web-entry-gate-client.ts +0 -45
- package/src/schemas/web-entry.ts +0 -46
|
@@ -1,69 +1,41 @@
|
|
|
1
1
|
/** Interaction question, answer and media response schemas. */
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import * as openapi from '../generated/openapi-schemas';
|
|
5
|
+
import * as served from '../generated/served-schemas';
|
|
5
6
|
|
|
6
7
|
// Shapes match the skeleton's interactions SSE contract: the SSE
|
|
7
8
|
// `interaction.add` frame carries the question and its answer format; the answer
|
|
8
9
|
// door returns { interaction_id, status }. `answered` is not a wire field — it
|
|
9
10
|
// is a client-side flag the stream hook flips on an `interaction.answered` event.
|
|
10
11
|
|
|
11
|
-
export const answerFormat =
|
|
12
|
+
export const answerFormat = openapi.answerFormat;
|
|
12
13
|
export type AnswerFormat = z.infer<typeof answerFormat>;
|
|
13
14
|
|
|
14
|
-
/** The kind of a
|
|
15
|
-
export const mediaKind =
|
|
15
|
+
/** The kind of a display-only media item: an image, a link, or a document, video or audio file. */
|
|
16
|
+
export const mediaKind = openapi.mediaKind;
|
|
16
17
|
export type MediaKind = z.infer<typeof mediaKind>;
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
|
-
* One item of a question's display-only media.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* so one malformed/hostile item is a loud per-item notice, not a whole-frame parse
|
|
23
|
-
* failure that would silently vanish an answerable question.
|
|
24
|
-
*
|
|
25
|
-
* `caption` is `.nullish()` (absent OR `null` both parse to a caption-less item):
|
|
26
|
-
* a caption-less item may arrive with the key omitted OR with an explicit `null`, so
|
|
27
|
-
* `.optional()` here would false-fail the explicit `null` and render a good image as
|
|
28
|
-
* malformed. `url` and `kind` are the only load-bearing fields; the image
|
|
29
|
-
* src scheme gate and the link neutralization are enforced by the renderer.
|
|
20
|
+
* One item of a question's display-only media. The renderer resolves `url` (the image src
|
|
21
|
+
* scheme gate and the link neutralization are enforced there); `caption` and `filename`
|
|
22
|
+
* are `null` when absent.
|
|
30
23
|
*/
|
|
31
|
-
export const interactionMediaItem =
|
|
32
|
-
kind: mediaKind,
|
|
33
|
-
url: z.string(),
|
|
34
|
-
caption: z.string().nullish(),
|
|
35
|
-
});
|
|
24
|
+
export const interactionMediaItem = openapi.mediaItem;
|
|
36
25
|
export type InteractionMediaItem = z.infer<typeof interactionMediaItem>;
|
|
37
26
|
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
* fetchable file — `image`/`document`/`audio`/`video` — never a `link`: a labelled
|
|
41
|
-
* anchor is question CONTEXT (see {@link mediaKind}), not a participant's sent file.
|
|
42
|
-
*/
|
|
43
|
-
export const attachmentMediaKind = z.enum(['image', 'document', 'audio', 'video']);
|
|
27
|
+
/** The kind of an inbound attachment carried on a transcript record. */
|
|
28
|
+
export const attachmentMediaKind = openapi.mediaKind;
|
|
44
29
|
export type AttachmentMediaKind = z.infer<typeof attachmentMediaKind>;
|
|
45
30
|
|
|
46
31
|
/**
|
|
47
32
|
* One inbound attachment a participant sent, projected onto a transcript record's
|
|
48
|
-
* `inbound_attachments`.
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* `url` is the served-media reference the renderer resolves to the API origin (the
|
|
54
|
-
* same served-url discipline the ask-media renderer uses); the image src scheme gate
|
|
55
|
-
* and the per-item load-failure notice are enforced there. `caption` and `filename`
|
|
56
|
-
* are `.nullish()` (absent OR explicit `null` both parse to absent): the projection
|
|
57
|
-
* may omit the key OR emit `null`, so `.optional()` alone would false-fail an explicit
|
|
58
|
-
* `null`. `filename` is meaningful only for a `document`; the renderer shows it as the
|
|
59
|
-
* download label.
|
|
33
|
+
* `inbound_attachments`. `url` is the served-media reference the renderer resolves to the
|
|
34
|
+
* API origin (the same served-url discipline the ask-media renderer uses); the image src
|
|
35
|
+
* scheme gate and the per-item load-failure notice are enforced there. `filename` is
|
|
36
|
+
* meaningful only for a `document`; the renderer shows it as the download label.
|
|
60
37
|
*/
|
|
61
|
-
export const attachmentMediaItem =
|
|
62
|
-
kind: attachmentMediaKind,
|
|
63
|
-
url: z.string(),
|
|
64
|
-
caption: z.string().nullish(),
|
|
65
|
-
filename: z.string().nullish(),
|
|
66
|
-
});
|
|
38
|
+
export const attachmentMediaItem = openapi.mediaItem;
|
|
67
39
|
export type AttachmentMediaItem = z.infer<typeof attachmentMediaItem>;
|
|
68
40
|
|
|
69
41
|
/**
|
|
@@ -73,10 +45,7 @@ export type AttachmentMediaItem = z.infer<typeof attachmentMediaItem>;
|
|
|
73
45
|
* `enum` this way for one ask without republishing the form. Applied per property by
|
|
74
46
|
* the form preview (safeParsed), so a malformed entry is a loud notice, never silent.
|
|
75
47
|
*/
|
|
76
|
-
export const formOption =
|
|
77
|
-
value: z.string(),
|
|
78
|
-
label: z.string().nullish(),
|
|
79
|
-
});
|
|
48
|
+
export const formOption = openapi.formOption;
|
|
80
49
|
export type FormOption = z.infer<typeof formOption>;
|
|
81
50
|
|
|
82
51
|
/**
|
|
@@ -85,14 +54,11 @@ export type FormOption = z.infer<typeof formOption>;
|
|
|
85
54
|
* default to empty. The form preview safeParses this off `format_payload.data`, so a
|
|
86
55
|
* malformed block is a loud notice rather than a whole-frame parse failure.
|
|
87
56
|
*/
|
|
88
|
-
export const formData =
|
|
89
|
-
values: z.record(z.string(), z.unknown()).default({}),
|
|
90
|
-
options: z.record(z.string(), z.array(formOption)).default({}),
|
|
91
|
-
});
|
|
57
|
+
export const formData = openapi.formData;
|
|
92
58
|
export type FormData = z.infer<typeof formData>;
|
|
93
59
|
|
|
94
60
|
/** The kind of an ordered display block a page may carry alongside its input fields. */
|
|
95
|
-
export const displayBlockKind =
|
|
61
|
+
export const displayBlockKind = openapi.displayBlock.shape.kind;
|
|
96
62
|
export type DisplayBlockKind = z.infer<typeof displayBlockKind>;
|
|
97
63
|
|
|
98
64
|
/**
|
|
@@ -106,17 +72,11 @@ export type DisplayBlockKind = z.infer<typeof displayBlockKind>;
|
|
|
106
72
|
* whole-page parse failure. Applied per block by the preview (safeParsed via its page),
|
|
107
73
|
* so a malformed block is a loud notice, never silent.
|
|
108
74
|
*/
|
|
109
|
-
export const displayBlock =
|
|
110
|
-
kind: displayBlockKind,
|
|
111
|
-
text: z.string().nullish(),
|
|
112
|
-
src: z.string().nullish(),
|
|
113
|
-
alt: z.string().nullish(),
|
|
114
|
-
slot: z.string().nullish(),
|
|
115
|
-
});
|
|
75
|
+
export const displayBlock = openapi.displayBlock;
|
|
116
76
|
export type DisplayBlock = z.infer<typeof displayBlock>;
|
|
117
77
|
|
|
118
78
|
/** A page's role: an ordinary `input` page (default) or a terminal `review` summary. */
|
|
119
|
-
export const formPageKind =
|
|
79
|
+
export const formPageKind = openapi.formPage.shape.kind.unwrap();
|
|
120
80
|
export type FormPageKind = z.infer<typeof formPageKind>;
|
|
121
81
|
|
|
122
82
|
/**
|
|
@@ -128,14 +88,14 @@ export type FormPageKind = z.infer<typeof formPageKind>;
|
|
|
128
88
|
* instead of, for a review page) its input fields; it defaults to empty, so a page that
|
|
129
89
|
* carries none renders exactly as before. `kind` marks a `review` page — a terminal
|
|
130
90
|
* summary step that shows the readback of entered values and the confirm/submit footer
|
|
131
|
-
* and carries no new input fields; it defaults to `input`.
|
|
91
|
+
* and carries no new input fields; it defaults to `input`. `button_label` is the text of
|
|
92
|
+
* the page's primary button — the one that advances from an input page, or submits from
|
|
93
|
+
* the last — in the sender's words and the end-user's language; absent (`null`), the
|
|
94
|
+
* surface shows its own generic word ("Next"/"Submit"/"Confirm"). All additive: an older
|
|
132
95
|
* payload ({title, fields}) parses unchanged.
|
|
133
96
|
*/
|
|
134
|
-
export const formPage =
|
|
135
|
-
|
|
136
|
-
fields: z.array(z.string()),
|
|
137
|
-
display: z.array(displayBlock).default([]),
|
|
138
|
-
kind: formPageKind.default('input'),
|
|
97
|
+
export const formPage = openapi.formPage.extend({
|
|
98
|
+
button_label: z.string().nullable().default(null),
|
|
139
99
|
});
|
|
140
100
|
export type FormPage = z.infer<typeof formPage>;
|
|
141
101
|
|
|
@@ -143,6 +103,183 @@ export type FormPage = z.infer<typeof formPage>;
|
|
|
143
103
|
export const formPages = z.array(formPage);
|
|
144
104
|
export type FormPages = z.infer<typeof formPages>;
|
|
145
105
|
|
|
106
|
+
// The one catalogue of a send's platform-drawn texts (`format_payload.wording`): a
|
|
107
|
+
// question's or a notification's buttons, headings, input hints, message lines,
|
|
108
|
+
// answer-page sentences, refusal sentences, settled-card badges and screen-reader labels,
|
|
109
|
+
// grouped into six chapters. Every leaf is the sender's own words in the end-user's
|
|
110
|
+
// language; absent (or `null`), the surface shows its own generic word. Mirrors the
|
|
111
|
+
// skeleton's `Wording` model member-for-member. A renderer safeParses this off the loose
|
|
112
|
+
// `format_payload`, so a malformed shape falls back to the default words rather than
|
|
113
|
+
// crashing the card (the labels are chrome, never an answer). The Studio inbox draws only
|
|
114
|
+
// the subset of members it has a control for; the rest parse and are ignored.
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* One form field's platform-drawn words (`wording.form.fields[name]`): `choice_label` is
|
|
118
|
+
* the placeholder of the field's picker (its empty-state prompt).
|
|
119
|
+
*/
|
|
120
|
+
export const fieldWording = z.object({
|
|
121
|
+
choice_label: z.string().nullish(),
|
|
122
|
+
});
|
|
123
|
+
export type FieldWording = z.infer<typeof fieldWording>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* A form's platform-drawn chrome (`wording.form`): `title` heads the form surface;
|
|
127
|
+
* `open`/`cancel` label the buttons that open and close it; `back` the button that returns
|
|
128
|
+
* to the previous step; `submit` the terminal button of a form with no pages;
|
|
129
|
+
* `review_empty` the review step's line before anything is filled; `fields` carries
|
|
130
|
+
* per-field words keyed by property name. The inbox draws the form inline, so it reads
|
|
131
|
+
* `back`, `submit` and `fields`; `title`/`open`/`cancel`/`review_empty` parse unused.
|
|
132
|
+
*/
|
|
133
|
+
export const formWording = z.object({
|
|
134
|
+
title: z.string().nullish(),
|
|
135
|
+
open: z.string().nullish(),
|
|
136
|
+
cancel: z.string().nullish(),
|
|
137
|
+
back: z.string().nullish(),
|
|
138
|
+
submit: z.string().nullish(),
|
|
139
|
+
review_empty: z.string().nullish(),
|
|
140
|
+
fields: z.record(z.string(), fieldWording).nullish(),
|
|
141
|
+
});
|
|
142
|
+
export type FormWording = z.infer<typeof formWording>;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* A choice list's platform-drawn words (`wording.choice`): `label` is the word on the
|
|
146
|
+
* control that presents the list, `reply_hint` the line under a numbered-text list, and
|
|
147
|
+
* `group_label` the accessible name of a flat group of option buttons. The inbox reads
|
|
148
|
+
* `label` (the select field's label and picker placeholder); the rest parse unused.
|
|
149
|
+
*/
|
|
150
|
+
export const choiceWording = z.object({
|
|
151
|
+
label: z.string().nullish(),
|
|
152
|
+
reply_hint: z.string().nullish(),
|
|
153
|
+
group_label: z.string().nullish(),
|
|
154
|
+
});
|
|
155
|
+
export type ChoiceWording = z.infer<typeof choiceWording>;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* A non-form question's answer controls and refusal sentences (`wording.answer`): `open`
|
|
159
|
+
* labels the control that opens a `confirm`/`external` question's answer page, `confirm`
|
|
160
|
+
* its affirmative control, `decline` its negative control, `submit` the button that sends a
|
|
161
|
+
* typed or picked answer, `reply_hint` the hint in an empty reply input. `rejected` /
|
|
162
|
+
* `rejected_final` are the sentences the end user reads when an answer is refused; the
|
|
163
|
+
* inbox draws neither (web-only). The inbox reads `open`, `confirm`, `decline`, `submit`
|
|
164
|
+
* and `reply_hint` where it draws the matching control.
|
|
165
|
+
*/
|
|
166
|
+
export const answerWording = z.object({
|
|
167
|
+
open: z.string().nullish(),
|
|
168
|
+
confirm: z.string().nullish(),
|
|
169
|
+
decline: z.string().nullish(),
|
|
170
|
+
submit: z.string().nullish(),
|
|
171
|
+
reply_hint: z.string().nullish(),
|
|
172
|
+
rejected: z.string().nullish(),
|
|
173
|
+
rejected_final: z.string().nullish(),
|
|
174
|
+
});
|
|
175
|
+
export type AnswerWording = z.infer<typeof answerWording>;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The lines of a delivery message (`wording.lines`): `answer_link` carries the tappable
|
|
179
|
+
* answer link, `deadline` names the deadline, `reply` tells the end user how to reply, and
|
|
180
|
+
* `options` lists the choices. Drawn by the chat channels; the inbox draws none of them.
|
|
181
|
+
*/
|
|
182
|
+
export const lineWording = z.object({
|
|
183
|
+
answer_link: z.string().nullish(),
|
|
184
|
+
deadline: z.string().nullish(),
|
|
185
|
+
reply: z.string().nullish(),
|
|
186
|
+
options: z.string().nullish(),
|
|
187
|
+
});
|
|
188
|
+
export type LineWording = z.infer<typeof lineWording>;
|
|
189
|
+
|
|
190
|
+
/** The heading and sentence of one platform-drawn answer page (`wording.answer_page.*`). */
|
|
191
|
+
export const pageCopy = z.object({
|
|
192
|
+
heading: z.string().nullish(),
|
|
193
|
+
text: z.string().nullish(),
|
|
194
|
+
});
|
|
195
|
+
export type PageCopy = z.infer<typeof pageCopy>;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The form page's own sentences (`wording.answer_page.form`): `failed` when a send did not
|
|
199
|
+
* land, `network_error` when the browser could not reach the server, `update_failed` when a
|
|
200
|
+
* reacting form could not refresh, `choose_one` for an empty required multi-choice, and
|
|
201
|
+
* `date_unavailable` for a blocked date. Drawn by the callback form page; the inbox draws
|
|
202
|
+
* none of them.
|
|
203
|
+
*/
|
|
204
|
+
export const formPageWording = z.object({
|
|
205
|
+
failed: z.string().nullish(),
|
|
206
|
+
network_error: z.string().nullish(),
|
|
207
|
+
update_failed: z.string().nullish(),
|
|
208
|
+
choose_one: z.string().nullish(),
|
|
209
|
+
date_unavailable: z.string().nullish(),
|
|
210
|
+
});
|
|
211
|
+
export type FormPageWording = z.infer<typeof formPageWording>;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* The pages a question's link opens (`wording.answer_page`): `confirm` the confirm page's
|
|
215
|
+
* copy, `done` the already-answered page's, `awaiting` the reply-on-the-channel page's,
|
|
216
|
+
* `submitted` the form page's post-submit copy, and `form` the form page's own
|
|
217
|
+
* validation/error sentences. Drawn by the callback pages; the inbox draws none of them.
|
|
218
|
+
*/
|
|
219
|
+
export const answerPageWording = z.object({
|
|
220
|
+
confirm: pageCopy.nullish(),
|
|
221
|
+
done: pageCopy.nullish(),
|
|
222
|
+
awaiting: pageCopy.nullish(),
|
|
223
|
+
submitted: pageCopy.nullish(),
|
|
224
|
+
form: formPageWording.nullish(),
|
|
225
|
+
});
|
|
226
|
+
export type AnswerPageWording = z.infer<typeof answerPageWording>;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* A live question card's countdown words (`wording.status.countdown`): `seconds_left` the
|
|
230
|
+
* visible plural line, `one_second_left` the visible singular, and `under_minute` /
|
|
231
|
+
* `under_half_minute` / `under_ten_seconds` the spoken lines at the three thresholds. Drawn
|
|
232
|
+
* by the web widget; the inbox draws no countdown.
|
|
233
|
+
*/
|
|
234
|
+
export const countdownWording = z.object({
|
|
235
|
+
seconds_left: z.string().nullish(),
|
|
236
|
+
one_second_left: z.string().nullish(),
|
|
237
|
+
under_minute: z.string().nullish(),
|
|
238
|
+
under_half_minute: z.string().nullish(),
|
|
239
|
+
under_ten_seconds: z.string().nullish(),
|
|
240
|
+
});
|
|
241
|
+
export type CountdownWording = z.infer<typeof countdownWording>;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* In-flight and settled status copy (`wording.status`): `sending` the screen-reader label
|
|
245
|
+
* while a send is in flight, `answered` / `expired` / `closed` the badges once a question
|
|
246
|
+
* settles, `sent` the badge after an ask-less form is submitted, `unavailable` the line
|
|
247
|
+
* when a form's door no longer resolves, and `countdown` the live-countdown words. Drawn by
|
|
248
|
+
* the web widget; the inbox draws none of them.
|
|
249
|
+
*/
|
|
250
|
+
export const statusWording = z.object({
|
|
251
|
+
sending: z.string().nullish(),
|
|
252
|
+
answered: z.string().nullish(),
|
|
253
|
+
expired: z.string().nullish(),
|
|
254
|
+
closed: z.string().nullish(),
|
|
255
|
+
sent: z.string().nullish(),
|
|
256
|
+
unavailable: z.string().nullish(),
|
|
257
|
+
countdown: countdownWording.nullish(),
|
|
258
|
+
});
|
|
259
|
+
export type StatusWording = z.infer<typeof statusWording>;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* The one catalogue of a send's platform-drawn texts (`format_payload.wording`), grouped
|
|
263
|
+
* by what each word decorates: the form (`form`), the choice list (`choice`), a question's
|
|
264
|
+
* answer controls and refusal sentences (`answer`), the lines of the delivery message
|
|
265
|
+
* (`lines`), the pages a question's link opens (`answer_page`), and in-flight and settled
|
|
266
|
+
* status (`status`). A page's primary button is the one text not here — it is on the page
|
|
267
|
+
* (`pages[].button_label`). Every leaf is the sender's own words in the end-user's
|
|
268
|
+
* language; absent (or `null`), the surface shows its own word.
|
|
269
|
+
*/
|
|
270
|
+
export const wording = z.object({
|
|
271
|
+
form: formWording.nullish(),
|
|
272
|
+
choice: choiceWording.nullish(),
|
|
273
|
+
answer: answerWording.nullish(),
|
|
274
|
+
lines: lineWording.nullish(),
|
|
275
|
+
answer_page: answerPageWording.nullish(),
|
|
276
|
+
status: statusWording.nullish(),
|
|
277
|
+
});
|
|
278
|
+
export type Wording = z.infer<typeof wording>;
|
|
279
|
+
|
|
280
|
+
// The form reactions and the form update are hand-written: the spec carries them inside an
|
|
281
|
+
// open `format_payload` and an open reaction `update`.
|
|
282
|
+
|
|
146
283
|
/**
|
|
147
284
|
* When a `form` reacts while it is open (`format_payload.reactions`): the plain,
|
|
148
285
|
* renderer-readable description of WHEN the form calls its reaction handler. Absent ⇒ a
|
|
@@ -163,12 +300,12 @@ export const formReactions = z.object({
|
|
|
163
300
|
export type FormReactions = z.infer<typeof formReactions>;
|
|
164
301
|
|
|
165
302
|
/**
|
|
166
|
-
* The form update a reaction door returns (`POST /api/interactions/{id}/react
|
|
167
|
-
* same kind of data a form is sent with, applied to the open form. `values`
|
|
168
|
-
* values; `options` replaces the per-send choice list of option-bearing fields;
|
|
169
|
-
* shows per-field messages (keyed by field name); `display` fills display slots
|
|
170
|
-
* slot name) — a computed total among them. Every member defaults to empty, so a
|
|
171
|
-
* that touches only one of them returns only that one. The door response is safeParsed, so
|
|
303
|
+
* The form update a reaction door returns (`POST /api/interactions/{id}/react`, its
|
|
304
|
+
* `update`): the same kind of data a form is sent with, applied to the open form. `values`
|
|
305
|
+
* sets field values; `options` replaces the per-send choice list of option-bearing fields;
|
|
306
|
+
* `errors` shows per-field messages (keyed by field name); `display` fills display slots
|
|
307
|
+
* (keyed by slot name) — a computed total among them. Every member defaults to empty, so a
|
|
308
|
+
* reaction that touches only one of them returns only that one. The door response is safeParsed, so
|
|
172
309
|
* a malformed update surfaces loudly rather than applying a half-understood change.
|
|
173
310
|
*/
|
|
174
311
|
export const formUpdate = z.object({
|
|
@@ -180,68 +317,33 @@ export const formUpdate = z.object({
|
|
|
180
317
|
export type FormUpdate = z.infer<typeof formUpdate>;
|
|
181
318
|
|
|
182
319
|
/**
|
|
183
|
-
* The event a reaction round-trip reports to the door
|
|
184
|
-
* declared events fired, `field` names the changed
|
|
185
|
-
* `page` names the advanced-from page (by title) for a
|
|
186
|
-
* `submitted` event carries neither. The body also carries the
|
|
187
|
-
* far (see {@link interactionsClient}'s `reactInteraction`).
|
|
320
|
+
* The event a reaction round-trip reports to the door (the contract's `FormReactionEvent`
|
|
321
|
+
* document): `kind` is which of the three declared events fired, `field` names the changed
|
|
322
|
+
* field for a `field_changed` event, and `page` names the advanced-from page (by title) for a
|
|
323
|
+
* `page_advanced` event. A `submitted` event carries neither. The body also carries the
|
|
324
|
+
* partial `values` filled so far (see {@link interactionsClient}'s `reactInteraction`).
|
|
188
325
|
*/
|
|
189
|
-
export const
|
|
190
|
-
export type ReactionEventKind = z.infer<typeof reactionEventKind>;
|
|
191
|
-
|
|
192
|
-
export const reactionEvent = z.object({
|
|
193
|
-
kind: reactionEventKind,
|
|
194
|
-
field: z.string().optional(),
|
|
195
|
-
page: z.string().optional(),
|
|
196
|
-
});
|
|
326
|
+
export const reactionEvent = served.formReactionEvent;
|
|
197
327
|
export type ReactionEvent = z.infer<typeof reactionEvent>;
|
|
328
|
+
export type ReactionEventKind = ReactionEvent['kind'];
|
|
198
329
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
//
|
|
205
|
-
// `data` and `pages
|
|
330
|
+
/** The reaction door's reply: the interaction id and the form `update` to apply. */
|
|
331
|
+
export const interactionReaction = openapi.interactionReactionResult.extend({ update: formUpdate });
|
|
332
|
+
export type InteractionReaction = z.infer<typeof interactionReaction>;
|
|
333
|
+
|
|
334
|
+
export const interaction = openapi.interactionFrame.extend({
|
|
335
|
+
// Hand-written: the format-specific payload (select options, form JSON schema with
|
|
336
|
+
// optional per-send `data` and `pages`, external url) is `null` for formats that carry
|
|
206
337
|
// none (text/confirm); it is normalized to `{}` so consumers always see an object.
|
|
207
338
|
format_payload: z
|
|
208
339
|
.record(z.string(), z.unknown())
|
|
209
340
|
.nullish()
|
|
210
341
|
.transform((value) => value ?? {}),
|
|
211
|
-
created_at: z.string(),
|
|
212
|
-
timeout_at: z.string(),
|
|
213
|
-
// Whether the answer body is sensitive and never persisted server-side. Rides
|
|
214
|
-
// every add frame; an absent value (older frame) normalizes to false.
|
|
215
|
-
sensitive: z.boolean().default(false),
|
|
216
|
-
// True only for an external question answered by a signed server-to-server
|
|
217
|
-
// callback (never by a human); the frame never carries the verifier object.
|
|
218
|
-
// Absent/undefined for every other question.
|
|
219
|
-
server_verified: z.boolean().optional(),
|
|
220
|
-
// Name of the channel plugin the question was also delivered through (e.g.
|
|
221
|
-
// "telegram"); absent when the question lives only in this inbox.
|
|
222
|
-
channel: z.string().optional(),
|
|
223
|
-
// Interaction attribution, each additive and absent when unset. `recipient` is
|
|
224
|
-
// the channel delivery address the question went to; `origin` is the run id of
|
|
225
|
-
// the background tool run that asked; `audience` is the user_id the question is
|
|
226
|
-
// addressed to. Display/binding data only, never an authorization axis; a
|
|
227
|
-
// present non-string is malformed.
|
|
228
|
-
recipient: z.string().optional(),
|
|
229
|
-
origin: z.string().optional(),
|
|
230
|
-
audience: z.string().optional(),
|
|
231
|
-
// Display-only media shown WITH the question (images and/or links). Absent when
|
|
232
|
-
// the question carries none. Deliberately LOOSE (`z.array(z.unknown())`): each
|
|
233
|
-
// item is `safeParse`d per item by the renderer against `interactionMediaItem`,
|
|
234
|
-
// so one malformed/hostile item can never fail the whole frame parse and hide an
|
|
235
|
-
// answerable question. A present non-array value is still malformed.
|
|
236
|
-
media: z.array(z.unknown()).optional(),
|
|
237
342
|
});
|
|
238
343
|
export type Interaction = z.infer<typeof interaction>;
|
|
239
344
|
|
|
240
345
|
/** The answer door's response — the blocked caller was woken. */
|
|
241
|
-
export const interactionAnswered =
|
|
242
|
-
interaction_id: z.string(),
|
|
243
|
-
status: z.string(),
|
|
244
|
-
});
|
|
346
|
+
export const interactionAnswered = openapi.interactionActionResult;
|
|
245
347
|
export type InteractionAnswered = z.infer<typeof interactionAnswered>;
|
|
246
348
|
|
|
247
349
|
/**
|
|
@@ -250,10 +352,7 @@ export type InteractionAnswered = z.infer<typeof interactionAnswered>;
|
|
|
250
352
|
* answer door's terminal reply, but the door is distinct so it carries its own
|
|
251
353
|
* schema.
|
|
252
354
|
*/
|
|
253
|
-
export const interactionCancelled =
|
|
254
|
-
interaction_id: z.string(),
|
|
255
|
-
status: z.string(),
|
|
256
|
-
});
|
|
355
|
+
export const interactionCancelled = openapi.interactionActionResult;
|
|
257
356
|
export type InteractionCancelled = z.infer<typeof interactionCancelled>;
|
|
258
357
|
|
|
259
358
|
/**
|
|
@@ -261,8 +360,5 @@ export type InteractionCancelled = z.infer<typeof interactionCancelled>;
|
|
|
261
360
|
* item is the same record the stream's `interaction.add` frame carries. The pending
|
|
262
361
|
* set is the paged base the tail-only stream applies live deltas over.
|
|
263
362
|
*/
|
|
264
|
-
export const interactionsPage = z.
|
|
265
|
-
items: z.array(interaction),
|
|
266
|
-
...pageWindow,
|
|
267
|
-
});
|
|
363
|
+
export const interactionsPage = openapi.interactionWindow.extend({ items: z.array(interaction) });
|
|
268
364
|
export type InteractionsPage = z.infer<typeof interactionsPage>;
|
package/src/schemas/login.ts
CHANGED
|
@@ -1,67 +1,36 @@
|
|
|
1
1
|
/** Public login-method aggregator and login-result schemas. */
|
|
2
|
-
import { z } from 'zod';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import * as openapi from '../generated/openapi-schemas';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* One field of a `form` login method. `secret` fields render as password
|
|
6
8
|
* inputs; `autocomplete` passes through to the input (e.g. "email",
|
|
7
9
|
* "current-password", "new-password").
|
|
8
10
|
*/
|
|
9
|
-
export const loginFormField =
|
|
10
|
-
name: z.string().min(1),
|
|
11
|
-
label: z.string().min(1),
|
|
12
|
-
secret: z.boolean(),
|
|
13
|
-
autocomplete: z.string().optional(),
|
|
14
|
-
});
|
|
11
|
+
export const loginFormField = openapi.formField;
|
|
15
12
|
|
|
16
13
|
/**
|
|
17
14
|
* The two — and only two — login-method shapes. Discriminated on `shape`; an
|
|
18
15
|
* unknown shape fails validation loudly (contract drift, not a soft skip).
|
|
19
|
-
* Optional fields are `.optional()` (absent), never `.nullable()`: the server
|
|
20
|
-
* serializes with `exclude_none`, so an absent field is OMITTED, never `null`.
|
|
21
16
|
*/
|
|
22
|
-
export const loginMethod =
|
|
23
|
-
z.object({
|
|
24
|
-
shape: z.literal('form'),
|
|
25
|
-
id: z.string().min(1),
|
|
26
|
-
title: z.string().min(1),
|
|
27
|
-
purpose: z.enum(['login', 'invite']).default('login'),
|
|
28
|
-
fields: z.array(loginFormField).min(1),
|
|
29
|
-
submit_path: z.string().min(1),
|
|
30
|
-
}),
|
|
31
|
-
z.object({
|
|
32
|
-
shape: z.literal('button'),
|
|
33
|
-
id: z.string().min(1),
|
|
34
|
-
label: z.string().min(1),
|
|
35
|
-
icon: z.string().optional(),
|
|
36
|
-
href: z.string().min(1),
|
|
37
|
-
}),
|
|
38
|
-
]);
|
|
17
|
+
export const loginMethod = openapi.loginMethodsListing.shape.methods.element;
|
|
39
18
|
|
|
40
19
|
/**
|
|
41
20
|
* `GET /api/login/methods` (PUBLIC). `needs_setup: true` ⇒ no principal exists
|
|
42
21
|
* yet, so the deployment must be initialized through the setup door before anyone
|
|
43
22
|
* can sign in. `setup_login` names the login-credential kinds the setup door can
|
|
44
|
-
* attach the owner's login with; it is `null
|
|
45
|
-
*
|
|
46
|
-
*
|
|
23
|
+
* attach the owner's login with; it is `null` when no login-attaching accounts
|
|
24
|
+
* provider is configured (a keys-only deployment). `claim_fragment_key` names the
|
|
25
|
+
* URL-fragment key a claim link carries its token under.
|
|
47
26
|
*/
|
|
48
|
-
export const loginMethods =
|
|
49
|
-
methods: z.array(loginMethod),
|
|
50
|
-
needs_setup: z.boolean(),
|
|
51
|
-
setup_login: z
|
|
52
|
-
.object({ kinds: z.array(z.enum(['password', 'invite'])) })
|
|
53
|
-
.nullable()
|
|
54
|
-
.optional(),
|
|
55
|
-
});
|
|
27
|
+
export const loginMethods = openapi.loginMethodsListing;
|
|
56
28
|
|
|
57
29
|
/**
|
|
58
30
|
* A successful login/exchange: the minted session token (opaque, `tai-sess-`
|
|
59
31
|
* prefixed — the client treats it as an opaque string) + its user.
|
|
60
32
|
*/
|
|
61
|
-
export const loginResult =
|
|
62
|
-
token: z.string().min(1),
|
|
63
|
-
user_id: z.string().min(1),
|
|
64
|
-
});
|
|
33
|
+
export const loginResult = openapi.claimExchangeResult;
|
|
65
34
|
|
|
66
35
|
export type LoginFormField = z.infer<typeof loginFormField>;
|
|
67
36
|
export type LoginMethod = z.infer<typeof loginMethod>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Live-manifest MCP section, env-ref and config-reload schemas. */
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
|
+
import * as openapi from '../generated/openapi-schemas';
|
|
4
5
|
import { fleetReportFanout } from './fleet';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -16,7 +17,8 @@ export const connectorRef = z.object({
|
|
|
16
17
|
export type ConnectorRef = z.infer<typeof connectorRef>;
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
|
-
* One entry of the live manifest's MCP section
|
|
20
|
+
* One entry of the live manifest's MCP section, hand-typed: the spec publishes an entry as
|
|
21
|
+
* an open object. Only the `managed` provenance
|
|
20
22
|
* marker is typed — the connect/disconnect flows write it server-side to point a
|
|
21
23
|
* connector-owned entry back at its connection, and the editor renders such
|
|
22
24
|
* entries read-only. `.nullish()` because a hand-authored entry carries `null`
|
|
@@ -31,9 +33,8 @@ export const manifestMcpEntry = z
|
|
|
31
33
|
.loose();
|
|
32
34
|
export type ManifestMcpEntry = z.infer<typeof manifestMcpEntry>;
|
|
33
35
|
|
|
34
|
-
export const manifestView =
|
|
36
|
+
export const manifestView = openapi.preservedManifestView.extend({
|
|
35
37
|
mcp: z.array(manifestMcpEntry),
|
|
36
|
-
user_tools: z.array(z.string()),
|
|
37
38
|
});
|
|
38
39
|
|
|
39
40
|
/**
|
|
@@ -45,26 +46,19 @@ export const manifestView = z.object({
|
|
|
45
46
|
* dangling refusal reads), so a var supplied by the deployment shows green, never
|
|
46
47
|
* a false red. The checklist derives from THIS alone — no env value is ever fetched.
|
|
47
48
|
*/
|
|
48
|
-
export const mcpEnvRef =
|
|
49
|
-
var: z.string(),
|
|
50
|
-
pointer: z.string(),
|
|
51
|
-
has_default: z.boolean(),
|
|
52
|
-
set: z.boolean(),
|
|
53
|
-
});
|
|
49
|
+
export const mcpEnvRef = openapi.mcpEnvRef;
|
|
54
50
|
export type McpEnvRef = z.infer<typeof mcpEnvRef>;
|
|
55
|
-
export const mcpEnvRefs =
|
|
51
|
+
export const mcpEnvRefs = openapi.mcpEnvRefList;
|
|
56
52
|
export type McpEnvRefs = z.infer<typeof mcpEnvRefs>;
|
|
57
53
|
/**
|
|
58
54
|
* The apply result every config-writer mutation returns (`POST /api/mcp-config`,
|
|
59
55
|
* `POST /api/config/env`): the serving worker's local reload result (`status` +
|
|
60
|
-
* `env_keys`)
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
56
|
+
* `env_keys`), the mode-wrapped fleet fan-out of the reload it broadcast, `recycle` — the
|
|
57
|
+
* fleet recycle roll an env change carrying a recycle-class key ran (`null` when it carried
|
|
58
|
+
* none) — and `awaiting_respawn`, the workers (name + keys) still awaiting a respawn after
|
|
59
|
+
* it, empty when its roll converged. The `fanout` is hand-typed (the spec publishes it as
|
|
60
|
+
* one object with optional fields) so the shared fleet-report handler can surface a failed
|
|
61
|
+
* propagation. A drift throws `ApiSchemaError`.
|
|
64
62
|
*/
|
|
65
|
-
export const reloadConfigResult =
|
|
66
|
-
status: z.string(),
|
|
67
|
-
env_keys: z.number(),
|
|
68
|
-
fanout: fleetReportFanout,
|
|
69
|
-
});
|
|
63
|
+
export const reloadConfigResult = openapi.applyResponse.extend({ fanout: fleetReportFanout });
|
|
70
64
|
export type ReloadConfigResult = z.infer<typeof reloadConfigResult>;
|