@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,5 +1,5 @@
|
|
|
1
1
|
/** Conversation route, thread, transcript, config and admin sub-client. */
|
|
2
|
-
import {
|
|
2
|
+
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
3
3
|
import * as s from '../schemas';
|
|
4
4
|
import type { Transport } from './transport';
|
|
5
5
|
|
|
@@ -63,22 +63,32 @@ function conversationRouteMethods(t: Transport) {
|
|
|
63
63
|
// The stored routing rows, each with its `callback_secret` withheld — the
|
|
64
64
|
// conversation monitor's route picker.
|
|
65
65
|
listConversationRoutes: (signal?: AbortSignal) =>
|
|
66
|
-
req(
|
|
66
|
+
req(apiRoutes.get_api_conversations.path, s.conversationRoutes, { signal }),
|
|
67
67
|
// Create or REPLACE a route (an UPSERT: the same door is the create and the
|
|
68
68
|
// edit path). `route_name` rides the URL path AND the body; the door rejects a
|
|
69
69
|
// disagreeing pair, so both come from the one create object. The reply carries
|
|
70
70
|
// the freshly-minted `callback_secret` for an `api`-door row, returned ONCE.
|
|
71
71
|
createOrReplaceConversationRoute: (route: s.ConversationRouteCreate) =>
|
|
72
|
-
req(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
req(
|
|
73
|
+
buildPath(apiRoutes.post_api_conversations_route_name.path, {
|
|
74
|
+
route_name: route.route_name,
|
|
75
|
+
}),
|
|
76
|
+
s.conversationRouteWritten,
|
|
77
|
+
{
|
|
78
|
+
method: 'POST',
|
|
79
|
+
body: route,
|
|
80
|
+
},
|
|
81
|
+
),
|
|
76
82
|
// Delete a route by name (destructive + authority-changing server-side): it
|
|
77
83
|
// drops the routing row and reclaims the thread indexes it owned.
|
|
78
84
|
deleteConversationRoute: (routeName: string) =>
|
|
79
|
-
req(
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
req(
|
|
86
|
+
buildPath(apiRoutes.delete_api_conversations_route_name.path, { route_name: routeName }),
|
|
87
|
+
s.conversationRouteDeleted,
|
|
88
|
+
{
|
|
89
|
+
method: 'DELETE',
|
|
90
|
+
},
|
|
91
|
+
),
|
|
82
92
|
};
|
|
83
93
|
}
|
|
84
94
|
|
|
@@ -95,10 +105,16 @@ function conversationThreadMethods(t: Transport) {
|
|
|
95
105
|
filters: ConversationThreadFilters = {},
|
|
96
106
|
signal?: AbortSignal,
|
|
97
107
|
) =>
|
|
98
|
-
req(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
req(
|
|
109
|
+
buildPath(apiRoutes.get_api_conversations_route_name_threads.path, {
|
|
110
|
+
route_name: routeName,
|
|
111
|
+
}),
|
|
112
|
+
s.conversationThreadsPage,
|
|
113
|
+
{
|
|
114
|
+
signal,
|
|
115
|
+
query: { page, pageSize, status: filters.status, address: filters.address },
|
|
116
|
+
},
|
|
117
|
+
),
|
|
102
118
|
// One thread's transcript, caller-scoped, read in the asked-for direction.
|
|
103
119
|
// The `thread_id` rides the QUERY STRING, never the path: it embeds the api
|
|
104
120
|
// door's `{principal}/{end user}` address with the principal already
|
|
@@ -107,7 +123,9 @@ function conversationThreadMethods(t: Transport) {
|
|
|
107
123
|
// exactly once whatever it holds, so it is passed through verbatim.
|
|
108
124
|
readConversationTranscript: (query: ConversationTranscriptQuery, signal?: AbortSignal) =>
|
|
109
125
|
req(
|
|
110
|
-
|
|
126
|
+
buildPath(apiRoutes.get_api_conversations_route_name_transcript.path, {
|
|
127
|
+
route_name: query.routeName,
|
|
128
|
+
}),
|
|
111
129
|
s.conversationTranscriptPage,
|
|
112
130
|
{
|
|
113
131
|
signal,
|
|
@@ -125,7 +143,9 @@ function conversationThreadMethods(t: Transport) {
|
|
|
125
143
|
// page's `truncated` flag says the match set outran the door's scan cap.
|
|
126
144
|
searchConversationMessages: (query: ConversationMessageSearchQuery, signal?: AbortSignal) =>
|
|
127
145
|
req(
|
|
128
|
-
|
|
146
|
+
buildPath(apiRoutes.get_api_conversations_route_name_messages_search.path, {
|
|
147
|
+
route_name: query.routeName,
|
|
148
|
+
}),
|
|
129
149
|
s.conversationMessageSearchPage,
|
|
130
150
|
{ signal, query: { q: query.q, page: query.page, pageSize: query.pageSize } },
|
|
131
151
|
),
|
|
@@ -133,7 +153,9 @@ function conversationThreadMethods(t: Transport) {
|
|
|
133
153
|
// never a path segment) — same encode-once reasoning as the transcript read.
|
|
134
154
|
sendConversationThreadMessage: (routeName: string, body: ConversationThreadMessageBody) =>
|
|
135
155
|
req(
|
|
136
|
-
|
|
156
|
+
buildPath(apiRoutes.post_api_conversations_route_name_thread_messages.path, {
|
|
157
|
+
route_name: routeName,
|
|
158
|
+
}),
|
|
137
159
|
s.conversationThreadMessageSent,
|
|
138
160
|
{ method: 'POST', body },
|
|
139
161
|
),
|
|
@@ -141,7 +163,9 @@ function conversationThreadMethods(t: Transport) {
|
|
|
141
163
|
// `thread_id` rides the QUERY value, encoded once, as the transcript read does.
|
|
142
164
|
getConversationThreadMode: (routeName: string, threadId: string, signal?: AbortSignal) =>
|
|
143
165
|
req(
|
|
144
|
-
|
|
166
|
+
buildPath(apiRoutes.get_api_conversations_route_name_thread_mode.path, {
|
|
167
|
+
route_name: routeName,
|
|
168
|
+
}),
|
|
145
169
|
s.conversationThreadModeState,
|
|
146
170
|
{ signal, query: { thread_id: threadId } },
|
|
147
171
|
),
|
|
@@ -152,7 +176,9 @@ function conversationThreadMethods(t: Transport) {
|
|
|
152
176
|
mode: s.ConversationThreadMode,
|
|
153
177
|
) =>
|
|
154
178
|
req(
|
|
155
|
-
|
|
179
|
+
buildPath(apiRoutes.put_api_conversations_route_name_thread_mode.path, {
|
|
180
|
+
route_name: routeName,
|
|
181
|
+
}),
|
|
156
182
|
s.conversationThreadModeState,
|
|
157
183
|
{ method: 'PUT', body: { thread_id: threadId, mode } },
|
|
158
184
|
),
|
|
@@ -166,7 +192,7 @@ function conversationConfigMethods(t: Transport) {
|
|
|
166
192
|
// The stored per-target presentation configs (each `(target_kind, target_name)`
|
|
167
193
|
// pair's multichannel flag + first-contact greeting). Admin config surface.
|
|
168
194
|
listConversationConfigs: (signal?: AbortSignal) =>
|
|
169
|
-
req(
|
|
195
|
+
req(apiRoutes.get_api_conversation_configs.path, s.conversationConfigs, { signal }),
|
|
170
196
|
// One config by its `(target_kind, target_name)` key. 404 when unknown.
|
|
171
197
|
getConversationConfig: (
|
|
172
198
|
targetKind: s.ConversationTargetKind,
|
|
@@ -174,7 +200,10 @@ function conversationConfigMethods(t: Transport) {
|
|
|
174
200
|
signal?: AbortSignal,
|
|
175
201
|
) =>
|
|
176
202
|
req(
|
|
177
|
-
|
|
203
|
+
buildPath(apiRoutes.get_api_conversation_configs_target_kind_target_name.path, {
|
|
204
|
+
target_kind: targetKind,
|
|
205
|
+
target_name: targetName,
|
|
206
|
+
}),
|
|
178
207
|
s.targetConversationConfig,
|
|
179
208
|
{ signal },
|
|
180
209
|
),
|
|
@@ -183,14 +212,20 @@ function conversationConfigMethods(t: Transport) {
|
|
|
183
212
|
// rejects a body whose key disagrees, so both come from the one config object.
|
|
184
213
|
setConversationConfig: (config: s.TargetConversationConfig) =>
|
|
185
214
|
req(
|
|
186
|
-
|
|
215
|
+
buildPath(apiRoutes.put_api_conversation_configs_target_kind_target_name.path, {
|
|
216
|
+
target_kind: config.target_kind,
|
|
217
|
+
target_name: config.target_name,
|
|
218
|
+
}),
|
|
187
219
|
s.conversationConfigWritten,
|
|
188
220
|
{ method: 'PUT', body: config },
|
|
189
221
|
),
|
|
190
222
|
// Delete a config by its key. 404 when the key is unknown.
|
|
191
223
|
deleteConversationConfig: (targetKind: s.ConversationTargetKind, targetName: string) =>
|
|
192
224
|
req(
|
|
193
|
-
|
|
225
|
+
buildPath(apiRoutes.delete_api_conversation_configs_target_kind_target_name.path, {
|
|
226
|
+
target_kind: targetKind,
|
|
227
|
+
target_name: targetName,
|
|
228
|
+
}),
|
|
194
229
|
s.conversationConfigDeleted,
|
|
195
230
|
{ method: 'DELETE' },
|
|
196
231
|
),
|
|
@@ -204,26 +239,40 @@ function conversationAdminMethods(t: Transport) {
|
|
|
204
239
|
// Every answer record whose delivery ended `failed`, across every route and
|
|
205
240
|
// caller. Admin-only server-side; not a paged window (returns `{items, total}`).
|
|
206
241
|
listFailedConversationMessages: (signal?: AbortSignal) =>
|
|
207
|
-
req(
|
|
242
|
+
req(apiRoutes.get_api_conversations_messages_failed.path, s.conversationFailedMessages, {
|
|
243
|
+
signal,
|
|
244
|
+
}),
|
|
208
245
|
// Forget ONE thread on a route (destructive): its checkpoint, answer records and
|
|
209
246
|
// thread indexes. The `thread_id` rides the QUERY value, encoded once — it embeds
|
|
210
247
|
// the api door's percent-encoded `{principal}/{end user}` address, which a path
|
|
211
248
|
// segment would encode a second time. `removed` counts the records this call
|
|
212
249
|
// cleared; a valid id on its own route always succeeds, never a 404.
|
|
213
250
|
deleteConversationThread: (routeName: string, threadId: string) =>
|
|
214
|
-
req(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
251
|
+
req(
|
|
252
|
+
buildPath(apiRoutes.delete_api_conversations_route_name_thread.path, {
|
|
253
|
+
route_name: routeName,
|
|
254
|
+
}),
|
|
255
|
+
s.conversationThreadDeleted,
|
|
256
|
+
{
|
|
257
|
+
method: 'DELETE',
|
|
258
|
+
query: { thread_id: threadId },
|
|
259
|
+
},
|
|
260
|
+
),
|
|
218
261
|
// Erase a LINKED person ENTIRELY (GDPR, wide blast radius): its aggregated thread
|
|
219
262
|
// and checkpoint, its person row, and every address→person index mapping, across
|
|
220
263
|
// EVERY route it wrote under. The `person_id` is a uuid4 with no percent-encoded
|
|
221
264
|
// principal, so it rides the PATH cleanly. `erased` says whether this call removed
|
|
222
265
|
// the person row (idempotent — a retry answers `false`, never a 404).
|
|
223
266
|
deleteConversationPerson: (personId: string) =>
|
|
224
|
-
req(
|
|
225
|
-
|
|
226
|
-
|
|
267
|
+
req(
|
|
268
|
+
buildPath(apiRoutes.delete_api_conversations_persons_person_id.path, {
|
|
269
|
+
person_id: personId,
|
|
270
|
+
}),
|
|
271
|
+
s.conversationPersonDeleted,
|
|
272
|
+
{
|
|
273
|
+
method: 'DELETE',
|
|
274
|
+
},
|
|
275
|
+
),
|
|
227
276
|
};
|
|
228
277
|
}
|
|
229
278
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Hook listing, registration and topic-verifier sub-client. */
|
|
2
|
-
import {
|
|
2
|
+
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
3
3
|
import * as s from '../schemas';
|
|
4
4
|
import type { Transport } from './transport';
|
|
5
5
|
|
|
@@ -19,26 +19,39 @@ export function hooksClient(t: Transport) {
|
|
|
19
19
|
const { req } = t;
|
|
20
20
|
return {
|
|
21
21
|
listHooks: (topic?: string, signal?: AbortSignal) =>
|
|
22
|
-
req(
|
|
22
|
+
req(apiRoutes.get_api_hooks.path, s.hookList, {
|
|
23
|
+
signal,
|
|
24
|
+
query: topic === undefined ? undefined : { topic },
|
|
25
|
+
}),
|
|
23
26
|
registerHook: (params: s.HookRegister) =>
|
|
24
|
-
req(
|
|
27
|
+
req(apiRoutes.post_api_hooks.path, s.hookRegistered, { method: 'POST', body: params }),
|
|
25
28
|
unregisterHook: (name: string) =>
|
|
26
|
-
req(
|
|
29
|
+
req(buildPath(apiRoutes.delete_api_hooks_name.path, { name }), s.hookRemoved, {
|
|
30
|
+
method: 'DELETE',
|
|
31
|
+
}),
|
|
27
32
|
// The registered webhook-verifier catalog — the only source the bind picker
|
|
28
33
|
// reads (names only; an empty registry is a valid empty list).
|
|
29
34
|
listHookVerifiers: (signal?: AbortSignal) =>
|
|
30
|
-
req(
|
|
35
|
+
req(apiRoutes.get_api_hooks_verifiers.path, s.hookVerifiers, { signal }),
|
|
31
36
|
// Bind a verifier to a topic (locks its otherwise-open public ingress). A PUT
|
|
32
37
|
// replaces any existing binding; an unknown verifier name is a loud 400.
|
|
33
38
|
setTopicVerifier: (topic: string, body: TopicVerifierBody) =>
|
|
34
|
-
req(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
req(
|
|
40
|
+
buildPath(apiRoutes.put_api_hooks_topics_topic_verifier.path, { topic }),
|
|
41
|
+
s.topicVerifierSet,
|
|
42
|
+
{
|
|
43
|
+
method: 'PUT',
|
|
44
|
+
body,
|
|
45
|
+
},
|
|
46
|
+
),
|
|
38
47
|
// Unbind a topic's verifier (re-opens its public ingress). 404 when no binding.
|
|
39
48
|
deleteTopicVerifier: (topic: string) =>
|
|
40
|
-
req(
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
req(
|
|
50
|
+
buildPath(apiRoutes.delete_api_hooks_topics_topic_verifier.path, { topic }),
|
|
51
|
+
s.topicVerifierRemoved,
|
|
52
|
+
{
|
|
53
|
+
method: 'DELETE',
|
|
54
|
+
},
|
|
55
|
+
),
|
|
43
56
|
};
|
|
44
57
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Composition root: assembles the per-resource sub-clients into the client. */
|
|
2
2
|
import type { ApiConfig } from '../http';
|
|
3
|
+
import { servedConstants } from '../schemas';
|
|
3
4
|
import { agentsClient } from './agents-client';
|
|
4
5
|
import { authClient } from './auth-client';
|
|
5
6
|
import { backendClient } from './backend-client';
|
|
@@ -33,7 +34,6 @@ import { toolMetaClient } from './tool-meta-client';
|
|
|
33
34
|
import { toolsClient } from './tools-client';
|
|
34
35
|
import { makeTransport } from './transport';
|
|
35
36
|
import { triggerLinksClient } from './trigger-links-client';
|
|
36
|
-
import { webEntryGateClient } from './web-entry-gate-client';
|
|
37
37
|
|
|
38
38
|
export type {
|
|
39
39
|
AddUrlToScopeBody,
|
|
@@ -43,7 +43,12 @@ export type {
|
|
|
43
43
|
RoleCreateBody,
|
|
44
44
|
RoleUpdateBody,
|
|
45
45
|
} from './auth-client';
|
|
46
|
-
export type {
|
|
46
|
+
export type {
|
|
47
|
+
AddServerArgs,
|
|
48
|
+
DiscoverServerTarget,
|
|
49
|
+
SetProviderClientArgs,
|
|
50
|
+
StartConnectArgs,
|
|
51
|
+
} from './connectors-client';
|
|
47
52
|
export type {
|
|
48
53
|
ConversationMessageSearchQuery,
|
|
49
54
|
ConversationThreadFilters,
|
|
@@ -73,12 +78,20 @@ export type { StorageUploadBody } from './storage-client';
|
|
|
73
78
|
export type { ToolMetaPatch } from './tool-meta-client';
|
|
74
79
|
export type { RunToolArgs, ToolAdminArgs } from './tools-client';
|
|
75
80
|
export type { TriggerLinkCreateBody } from './trigger-links-client';
|
|
76
|
-
export type { WebEntryCodeMintBody } from './web-entry-gate-client';
|
|
77
81
|
|
|
78
82
|
export function createApiClient(config: ApiConfig) {
|
|
79
83
|
const t = makeTransport(config);
|
|
80
84
|
return {
|
|
81
85
|
baseUrl: config.baseUrl ?? '',
|
|
86
|
+
/**
|
|
87
|
+
* The platform constants the contract serves, read instead of re-spelled (`PERSON_KIND`,
|
|
88
|
+
* `MEDIA_ROUTE_PREFIX`, `MEDIA_ID_PATTERN`).
|
|
89
|
+
*/
|
|
90
|
+
constants: servedConstants,
|
|
91
|
+
/** The host's authenticated request for a plugin's own routes: the same auth header,
|
|
92
|
+
* 401 handling, error classes and `{ data }` unwrap as every core call. Core routes
|
|
93
|
+
* use the named methods. */
|
|
94
|
+
request: t.req,
|
|
82
95
|
...toolsClient(t),
|
|
83
96
|
...presetsClient(t),
|
|
84
97
|
...statesClient(t),
|
|
@@ -97,7 +110,6 @@ export function createApiClient(config: ApiConfig) {
|
|
|
97
110
|
...interactionsClient(t),
|
|
98
111
|
...channelsClient(t),
|
|
99
112
|
...conversationsClient(t),
|
|
100
|
-
...webEntryGateClient(t),
|
|
101
113
|
...notificationsClient(t),
|
|
102
114
|
...agentsClient(t),
|
|
103
115
|
...hooksClient(t),
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** Interaction listing/answer and the SSE stream sub-clients. */
|
|
2
2
|
import { ApiError, ApiUnauthorizedError } from '../errors';
|
|
3
|
-
import {
|
|
3
|
+
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
4
|
+
import { API_KEY_HEADER } from '../headers';
|
|
5
|
+
import { extractError } from '../http';
|
|
4
6
|
import * as s from '../schemas';
|
|
5
7
|
import { readSseFrames, sseOpenToken } from '../sse';
|
|
6
8
|
import type { Transport } from './transport';
|
|
@@ -13,24 +15,40 @@ export function interactionsClient(t: Transport) {
|
|
|
13
15
|
// so `total` is the caller's own count, and every terminal frame it later receives
|
|
14
16
|
// refers to a question within that `total`.
|
|
15
17
|
listInteractions: (page: number, pageSize: number, signal?: AbortSignal) =>
|
|
16
|
-
req(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
method: 'POST',
|
|
20
|
-
body: { answer },
|
|
18
|
+
req(apiRoutes.get_api_interactions.path, s.interactionsPage, {
|
|
19
|
+
signal,
|
|
20
|
+
query: { page, pageSize },
|
|
21
21
|
}),
|
|
22
|
+
answerInteraction: (interactionId: string, answer: unknown) =>
|
|
23
|
+
req(
|
|
24
|
+
buildPath(apiRoutes.post_api_interactions_interaction_id_answer.path, {
|
|
25
|
+
interaction_id: interactionId,
|
|
26
|
+
}),
|
|
27
|
+
s.interactionAnswered,
|
|
28
|
+
{
|
|
29
|
+
method: 'POST',
|
|
30
|
+
body: { answer },
|
|
31
|
+
},
|
|
32
|
+
),
|
|
22
33
|
// React to a still-open form while it is being filled: the in-app, authenticated
|
|
23
34
|
// sibling of the answer door (`POST /api/interactions/{id}/react`). It carries the
|
|
24
35
|
// event that fired (a field changed / a page advanced / the form submitted) and the
|
|
25
|
-
// partial `values` filled so far, and returns
|
|
36
|
+
// partial `values` filled so far, and returns the form update to apply (the reply's
|
|
37
|
+
// `update`). It is STATELESS
|
|
26
38
|
// on the server — it records no answer and resolves no interaction — so it never
|
|
27
39
|
// substitutes for the answer door. A handler error/timeout surfaces as the shared
|
|
28
40
|
// `apiRequest` status handling (loud), never a stale value.
|
|
29
41
|
reactInteraction: (interactionId: string, event: s.ReactionEvent, values: unknown) =>
|
|
30
|
-
req(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
req(
|
|
43
|
+
buildPath(apiRoutes.post_api_interactions_interaction_id_react.path, {
|
|
44
|
+
interaction_id: interactionId,
|
|
45
|
+
}),
|
|
46
|
+
s.interactionReaction,
|
|
47
|
+
{
|
|
48
|
+
method: 'POST',
|
|
49
|
+
body: { event, values },
|
|
50
|
+
},
|
|
51
|
+
).then((reply) => reply.update),
|
|
34
52
|
// Withdraw a pending ask WITHOUT answering it (a bodyless POST): the question is
|
|
35
53
|
// resolved as cancelled and the flow that asked never resumes. Terminal like an
|
|
36
54
|
// answer, so the loud failure mappings mirror it — a 409 (already answered, so no
|
|
@@ -38,9 +56,15 @@ export function interactionsClient(t: Transport) {
|
|
|
38
56
|
// and a 403 (not this caller's audience) as `ApiError` — all via the shared
|
|
39
57
|
// `apiRequest` status handling.
|
|
40
58
|
cancelInteraction: (interactionId: string) =>
|
|
41
|
-
req(
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
req(
|
|
60
|
+
buildPath(apiRoutes.post_api_interactions_interaction_id_cancel.path, {
|
|
61
|
+
interaction_id: interactionId,
|
|
62
|
+
}),
|
|
63
|
+
s.interactionCancelled,
|
|
64
|
+
{
|
|
65
|
+
method: 'POST',
|
|
66
|
+
},
|
|
67
|
+
),
|
|
44
68
|
};
|
|
45
69
|
}
|
|
46
70
|
|
|
@@ -65,11 +89,11 @@ export function interactionsStreamClient(t: Transport) {
|
|
|
65
89
|
const doFetch = config.fetch ?? globalThis.fetch;
|
|
66
90
|
const token = config.getToken();
|
|
67
91
|
const headers: Record<string, string> = { accept: 'text/event-stream' };
|
|
68
|
-
if (token) headers[
|
|
92
|
+
if (token) headers[API_KEY_HEADER] = token;
|
|
69
93
|
if (lastEventId) headers['last-event-id'] = lastEventId;
|
|
70
94
|
// Distinct-URL per open — see the canonical constraint on `sseOpenToken`.
|
|
71
95
|
const resume = lastEventId ? `&last_event_id=${encodeURIComponent(lastEventId)}` : '';
|
|
72
|
-
const url = `${config.baseUrl ?? ''}
|
|
96
|
+
const url = `${config.baseUrl ?? ''}${apiRoutes.get_api_interactions_stream.path}?_=${sseOpenToken()}${resume}`;
|
|
73
97
|
const response = await doFetch(url, {
|
|
74
98
|
headers,
|
|
75
99
|
signal,
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
ApiSetupFailedError,
|
|
6
6
|
ApiUnauthorizedError,
|
|
7
7
|
} from '../errors';
|
|
8
|
+
import { apiRoutes } from '../generated/api-routes';
|
|
8
9
|
import * as s from '../schemas';
|
|
9
10
|
import type { Transport } from './transport';
|
|
10
11
|
|
|
@@ -79,7 +80,7 @@ export function loginClient(t: Transport) {
|
|
|
79
80
|
// exists, so the unauthenticated call carries no auth header — no transport
|
|
80
81
|
// change needed.
|
|
81
82
|
getLoginMethods: (options?: { signal?: AbortSignal }) =>
|
|
82
|
-
req(
|
|
83
|
+
req(apiRoutes.get_api_login_methods.path, s.loginMethods, { signal: options?.signal }),
|
|
83
84
|
// Submit a `form` method's field VALUES as a flat top-level JSON body (the
|
|
84
85
|
// server's request models take the declared field names top-level). `path`
|
|
85
86
|
// is re-checked with the same relative-`/api/` guard the renderer uses — an
|
|
@@ -116,7 +117,10 @@ export function loginClient(t: Transport) {
|
|
|
116
117
|
// unauthorized redirect. The caller latches the exchange so it fires once.
|
|
117
118
|
claimLogin: async (body: { token: string }) => {
|
|
118
119
|
try {
|
|
119
|
-
return await req(
|
|
120
|
+
return await req(apiRoutes.post_api_login_claim.path, s.loginResult, {
|
|
121
|
+
method: 'POST',
|
|
122
|
+
body,
|
|
123
|
+
});
|
|
120
124
|
} catch (error) {
|
|
121
125
|
return asLoginError(error);
|
|
122
126
|
}
|
|
@@ -129,7 +133,7 @@ export function loginClient(t: Transport) {
|
|
|
129
133
|
// loudly.
|
|
130
134
|
submitSetup: async (body: s.SetupBody) => {
|
|
131
135
|
try {
|
|
132
|
-
return await req(
|
|
136
|
+
return await req(apiRoutes.post_api_setup.path, s.setupResult, { method: 'POST', body });
|
|
133
137
|
} catch (error) {
|
|
134
138
|
return asSetupError(error);
|
|
135
139
|
}
|
|
@@ -145,6 +149,6 @@ export function logoutClient(t: Transport) {
|
|
|
145
149
|
// has nothing to revoke and answers 404 (surfaced as an `ApiError`, quiet at
|
|
146
150
|
// the call site); a 5xx/network failure is a real revoke failure the shell
|
|
147
151
|
// surfaces loudly.
|
|
148
|
-
logout: () => req(
|
|
152
|
+
logout: () => req(apiRoutes.post_api_auth_logout.path, s.logoutResult, { method: 'POST' }),
|
|
149
153
|
};
|
|
150
154
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Manifest / MCP section, env-ref and config-reload sub-clients. */
|
|
2
|
-
import {
|
|
2
|
+
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
3
3
|
import * as s from '../schemas';
|
|
4
4
|
import type { Transport } from './transport';
|
|
5
5
|
|
|
@@ -31,14 +31,23 @@ export interface SetMcpSecretEnvBody {
|
|
|
31
31
|
export function manifestClient(t: Transport) {
|
|
32
32
|
const { req } = t;
|
|
33
33
|
return {
|
|
34
|
-
getManifest: (signal?: AbortSignal) =>
|
|
34
|
+
getManifest: (signal?: AbortSignal) =>
|
|
35
|
+
req(apiRoutes.get_api_manifest.path, s.manifestView, { signal }),
|
|
35
36
|
setMcpConfig: (mcp: unknown[]) =>
|
|
36
|
-
req(
|
|
37
|
-
getMcpStatus: (signal?: AbortSignal) => req('/api/mcp-status', s.mcpStatus, { signal }),
|
|
38
|
-
reloadMcp: (title: string) =>
|
|
39
|
-
req(`/api/mcp-status/${encodeSegment(title)}/reload`, s.mcpReloadResult, {
|
|
37
|
+
req(apiRoutes.post_api_mcp_config.path, s.reloadConfigResult, {
|
|
40
38
|
method: 'POST',
|
|
39
|
+
body: { mcp },
|
|
41
40
|
}),
|
|
41
|
+
getMcpStatus: (signal?: AbortSignal) =>
|
|
42
|
+
req(apiRoutes.get_api_mcp_status.path, s.mcpStatus, { signal }),
|
|
43
|
+
reloadMcp: (title: string) =>
|
|
44
|
+
req(
|
|
45
|
+
buildPath(apiRoutes.post_api_mcp_status_title_reload.path, { title }),
|
|
46
|
+
s.mcpReloadResult,
|
|
47
|
+
{
|
|
48
|
+
method: 'POST',
|
|
49
|
+
},
|
|
50
|
+
),
|
|
42
51
|
|
|
43
52
|
// Granular manifest-section entry edits — add/replace or remove ONE entry by
|
|
44
53
|
// title, leaving the rest of the section untouched (the surgical counterpart to
|
|
@@ -46,28 +55,36 @@ export function manifestClient(t: Transport) {
|
|
|
46
55
|
// the shared apply-result (`status` + `env_keys` + fleet `fanout`). `replace` lets
|
|
47
56
|
// an entry whose title already exists swap in; without it a collision is refused.
|
|
48
57
|
addToolsEntries: (entries: readonly unknown[], replace = false) =>
|
|
49
|
-
req(
|
|
58
|
+
req(apiRoutes.post_api_tools_config_entries.path, s.reloadConfigResult, {
|
|
50
59
|
method: 'POST',
|
|
51
60
|
body: { entries, replace },
|
|
52
61
|
}),
|
|
53
62
|
removeToolsEntry: (title: string) =>
|
|
54
|
-
req(
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
req(
|
|
64
|
+
buildPath(apiRoutes.delete_api_tools_config_entries_title.path, { title }),
|
|
65
|
+
s.reloadConfigResult,
|
|
66
|
+
{
|
|
67
|
+
method: 'DELETE',
|
|
68
|
+
},
|
|
69
|
+
),
|
|
57
70
|
addAgentsEntries: (entries: readonly unknown[], replace = false) =>
|
|
58
|
-
req(
|
|
71
|
+
req(apiRoutes.post_api_agents_config_entries.path, s.reloadConfigResult, {
|
|
59
72
|
method: 'POST',
|
|
60
73
|
body: { entries, replace },
|
|
61
74
|
}),
|
|
62
75
|
removeAgentsEntry: (title: string) =>
|
|
63
|
-
req(
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
req(
|
|
77
|
+
buildPath(apiRoutes.delete_api_agents_config_entries_title.path, { title }),
|
|
78
|
+
s.reloadConfigResult,
|
|
79
|
+
{
|
|
80
|
+
method: 'DELETE',
|
|
81
|
+
},
|
|
82
|
+
),
|
|
66
83
|
// Edit the manifest `api_tools` include/exclude name lists by delta (add/remove
|
|
67
84
|
// names on either list). Absent fields default to empty; the server refuses a body
|
|
68
85
|
// whose four lists are all empty. Returns the shared apply-result.
|
|
69
86
|
updateApiTools: (body: ApiToolsListsBody) =>
|
|
70
|
-
req(
|
|
87
|
+
req(apiRoutes.post_api_api_tools.path, s.reloadConfigResult, {
|
|
71
88
|
method: 'POST',
|
|
72
89
|
body: {
|
|
73
90
|
include_add: body.include_add ?? [],
|
|
@@ -83,17 +100,21 @@ export function manifestClient(t: Transport) {
|
|
|
83
100
|
// every failed server; deregister detaches one server's tools by title. Each op
|
|
84
101
|
// returns the bare per-worker `fleetResult`.
|
|
85
102
|
listFailedMcps: (signal?: AbortSignal) =>
|
|
86
|
-
req(
|
|
103
|
+
req(apiRoutes.get_api_mcp_status_failed.path, s.fleetResult, { signal }),
|
|
87
104
|
reloadFailedMcps: () =>
|
|
88
|
-
req(
|
|
105
|
+
req(apiRoutes.post_api_mcp_status_reload_failed.path, s.fleetResult, {
|
|
89
106
|
method: 'POST',
|
|
90
107
|
body: { targets: null },
|
|
91
108
|
}),
|
|
92
109
|
deregisterMcp: (title: string) =>
|
|
93
|
-
req(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
110
|
+
req(
|
|
111
|
+
buildPath(apiRoutes.post_api_mcp_status_title_deregister.path, { title }),
|
|
112
|
+
s.fleetResult,
|
|
113
|
+
{
|
|
114
|
+
method: 'POST',
|
|
115
|
+
body: { targets: null },
|
|
116
|
+
},
|
|
117
|
+
),
|
|
97
118
|
};
|
|
98
119
|
}
|
|
99
120
|
|
|
@@ -103,16 +124,19 @@ export function manifestSecretEnvClient(t: Transport) {
|
|
|
103
124
|
// The SecretRefField server half: one atomic env-value + `!ENV` manifest
|
|
104
125
|
// write, returning the shared apply-result shape (reload + fleet fanout).
|
|
105
126
|
setMcpSecretEnv: (body: SetMcpSecretEnvBody) =>
|
|
106
|
-
req(
|
|
127
|
+
req(apiRoutes.post_api_mcp_config_secret_env.path, s.reloadConfigResult, {
|
|
128
|
+
method: 'POST',
|
|
129
|
+
body,
|
|
130
|
+
}),
|
|
107
131
|
// The PRESERVED manifest (`!ENV` markers intact, no resolved secrets) — the
|
|
108
132
|
// connectors page's McpServersSection reads this so round-trips never inline
|
|
109
133
|
// resolved values.
|
|
110
134
|
getManifestPreserved: (signal?: AbortSignal) =>
|
|
111
|
-
req(
|
|
135
|
+
req(apiRoutes.get_api_manifest_preserved.path, s.manifestView, { signal }),
|
|
112
136
|
// The manifest MCP section's `!ENV ${VAR[:default]}` marker refs — NAMES and
|
|
113
137
|
// set/unset BOOLEANS only, never values. Drives the McpServersSection env-refs
|
|
114
138
|
// checklist on the connectors page.
|
|
115
139
|
getMcpEnvRefs: (signal?: AbortSignal) =>
|
|
116
|
-
req(
|
|
140
|
+
req(apiRoutes.get_api_manifest_mcp_env_refs.path, s.mcpEnvRefs, { signal }),
|
|
117
141
|
};
|
|
118
142
|
}
|