@tai42/api-client 16.0.1 → 17.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/agents.d.ts.map +1 -1
  2. package/dist/agents.js +1 -1
  3. package/dist/agents.js.map +1 -1
  4. package/dist/client/auth-client.d.ts +44 -2
  5. package/dist/client/auth-client.d.ts.map +1 -1
  6. package/dist/client/auth-client.js +15 -1
  7. package/dist/client/auth-client.js.map +1 -1
  8. package/dist/client/backup-client.js +1 -1
  9. package/dist/client/backup-client.js.map +1 -1
  10. package/dist/client/capabilities-client.d.ts +5 -0
  11. package/dist/client/capabilities-client.d.ts.map +1 -1
  12. package/dist/client/connectors-client.js +1 -1
  13. package/dist/client/connectors-client.js.map +1 -1
  14. package/dist/client/conversations-client.d.ts +20 -8
  15. package/dist/client/conversations-client.d.ts.map +1 -1
  16. package/dist/client/conversations-client.js +1 -1
  17. package/dist/client/conversations-client.js.map +1 -1
  18. package/dist/client/hooks-client.d.ts +1 -2
  19. package/dist/client/hooks-client.d.ts.map +1 -1
  20. package/dist/client/hooks-client.js +1 -1
  21. package/dist/client/hooks-client.js.map +1 -1
  22. package/dist/client/index.d.ts +91 -19
  23. package/dist/client/index.d.ts.map +1 -1
  24. package/dist/client/index.js +1 -1
  25. package/dist/client/index.js.map +1 -1
  26. package/dist/client/interactions-client.js +1 -1
  27. package/dist/client/interactions-client.js.map +1 -1
  28. package/dist/client/login-client.d.ts +15 -2
  29. package/dist/client/login-client.d.ts.map +1 -1
  30. package/dist/client/login-client.js +38 -4
  31. package/dist/client/login-client.js.map +1 -1
  32. package/dist/client/manifest-client.js +1 -1
  33. package/dist/client/manifest-client.js.map +1 -1
  34. package/dist/client/marketplace-client.js +1 -1
  35. package/dist/client/marketplace-client.js.map +1 -1
  36. package/dist/client/observability-client.js +1 -1
  37. package/dist/client/observability-client.js.map +1 -1
  38. package/dist/client/policy-client.js +1 -1
  39. package/dist/client/policy-client.js.map +1 -1
  40. package/dist/client/presets-client.d.ts +0 -1
  41. package/dist/client/presets-client.d.ts.map +1 -1
  42. package/dist/client/presets-client.js +1 -1
  43. package/dist/client/presets-client.js.map +1 -1
  44. package/dist/client/profiles-client.d.ts +0 -1
  45. package/dist/client/profiles-client.d.ts.map +1 -1
  46. package/dist/client/profiles-client.js +1 -1
  47. package/dist/client/profiles-client.js.map +1 -1
  48. package/dist/client/schedules-client.d.ts +0 -1
  49. package/dist/client/schedules-client.d.ts.map +1 -1
  50. package/dist/client/schedules-client.js +1 -1
  51. package/dist/client/schedules-client.js.map +1 -1
  52. package/dist/client/states-client.d.ts +0 -1
  53. package/dist/client/states-client.d.ts.map +1 -1
  54. package/dist/client/states-client.js +1 -1
  55. package/dist/client/states-client.js.map +1 -1
  56. package/dist/client/storage-client.js +1 -1
  57. package/dist/client/storage-client.js.map +1 -1
  58. package/dist/client/sub-mcp-client.js +1 -1
  59. package/dist/client/sub-mcp-client.js.map +1 -1
  60. package/dist/client/system-client.js +1 -1
  61. package/dist/client/system-client.js.map +1 -1
  62. package/dist/client/tool-extensions-client.d.ts +0 -1
  63. package/dist/client/tool-extensions-client.d.ts.map +1 -1
  64. package/dist/client/tool-extensions-client.js +1 -1
  65. package/dist/client/tool-extensions-client.js.map +1 -1
  66. package/dist/client/tool-meta-client.js +1 -1
  67. package/dist/client/tool-meta-client.js.map +1 -1
  68. package/dist/client/tools-client.d.ts +2 -2
  69. package/dist/client/tools-client.js +1 -1
  70. package/dist/client/tools-client.js.map +1 -1
  71. package/dist/client/trigger-links-client.d.ts +1 -1
  72. package/dist/client/trigger-links-client.js +1 -1
  73. package/dist/client/trigger-links-client.js.map +1 -1
  74. package/dist/client/web-entry-gate-client.js +1 -1
  75. package/dist/client/web-entry-gate-client.js.map +1 -1
  76. package/dist/errors.d.ts +11 -0
  77. package/dist/errors.d.ts.map +1 -1
  78. package/dist/errors.js +15 -0
  79. package/dist/errors.js.map +1 -1
  80. package/dist/generated/served-schemas.d.ts +34 -0
  81. package/dist/generated/served-schemas.d.ts.map +1 -1
  82. package/dist/generated/served-schemas.js +3 -2
  83. package/dist/generated/served-schemas.js.map +1 -1
  84. package/dist/index.d.ts +12 -12
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +6 -13
  87. package/dist/index.js.map +1 -1
  88. package/dist/schemas/api-keys.d.ts +9 -0
  89. package/dist/schemas/api-keys.d.ts.map +1 -1
  90. package/dist/schemas/api-keys.js +7 -0
  91. package/dist/schemas/api-keys.js.map +1 -1
  92. package/dist/schemas/auth-routes.d.ts +3 -3
  93. package/dist/schemas/backup.d.ts.map +1 -1
  94. package/dist/schemas/backup.js.map +1 -1
  95. package/dist/schemas/capabilities.d.ts +14 -4
  96. package/dist/schemas/capabilities.d.ts.map +1 -1
  97. package/dist/schemas/capabilities.js +8 -4
  98. package/dist/schemas/capabilities.js.map +1 -1
  99. package/dist/schemas/connectors.d.ts.map +1 -1
  100. package/dist/schemas/connectors.js.map +1 -1
  101. package/dist/schemas/conversations.d.ts +58 -4
  102. package/dist/schemas/conversations.d.ts.map +1 -1
  103. package/dist/schemas/conversations.js +18 -5
  104. package/dist/schemas/conversations.js.map +1 -1
  105. package/dist/schemas/fleet.d.ts.map +1 -1
  106. package/dist/schemas/fleet.js.map +1 -1
  107. package/dist/schemas/hooks.d.ts +2 -2
  108. package/dist/schemas/hooks.d.ts.map +1 -1
  109. package/dist/schemas/hooks.js.map +1 -1
  110. package/dist/schemas/index.d.ts +30 -28
  111. package/dist/schemas/index.d.ts.map +1 -1
  112. package/dist/schemas/index.js +30 -28
  113. package/dist/schemas/index.js.map +1 -1
  114. package/dist/schemas/interactions.d.ts.map +1 -1
  115. package/dist/schemas/interactions.js.map +1 -1
  116. package/dist/schemas/login.d.ts +12 -5
  117. package/dist/schemas/login.d.ts.map +1 -1
  118. package/dist/schemas/login.js +11 -4
  119. package/dist/schemas/login.js.map +1 -1
  120. package/dist/schemas/manifest-mcp.d.ts.map +1 -1
  121. package/dist/schemas/manifest-mcp.js.map +1 -1
  122. package/dist/schemas/notifications.d.ts.map +1 -1
  123. package/dist/schemas/notifications.js.map +1 -1
  124. package/dist/schemas/observability.d.ts.map +1 -1
  125. package/dist/schemas/observability.js.map +1 -1
  126. package/dist/schemas/policy.d.ts.map +1 -1
  127. package/dist/schemas/policy.js.map +1 -1
  128. package/dist/schemas/presets.d.ts.map +1 -1
  129. package/dist/schemas/presets.js.map +1 -1
  130. package/dist/schemas/principals.d.ts +54 -0
  131. package/dist/schemas/principals.d.ts.map +1 -0
  132. package/dist/schemas/principals.js +34 -0
  133. package/dist/schemas/principals.js.map +1 -0
  134. package/dist/schemas/profiles.d.ts.map +1 -1
  135. package/dist/schemas/profiles.js.map +1 -1
  136. package/dist/schemas/roles.d.ts.map +1 -1
  137. package/dist/schemas/roles.js.map +1 -1
  138. package/dist/schemas/schedules.d.ts.map +1 -1
  139. package/dist/schemas/schedules.js.map +1 -1
  140. package/dist/schemas/served.d.ts +23 -1
  141. package/dist/schemas/served.d.ts.map +1 -1
  142. package/dist/schemas/served.js +1 -1
  143. package/dist/schemas/served.js.map +1 -1
  144. package/dist/schemas/settings-schema.d.ts.map +1 -1
  145. package/dist/schemas/settings-schema.js.map +1 -1
  146. package/dist/schemas/setup.d.ts +43 -0
  147. package/dist/schemas/setup.d.ts.map +1 -0
  148. package/dist/schemas/setup.js +19 -0
  149. package/dist/schemas/setup.js.map +1 -0
  150. package/dist/schemas/states.d.ts.map +1 -1
  151. package/dist/schemas/states.js.map +1 -1
  152. package/dist/schemas/system-kinds.d.ts.map +1 -1
  153. package/dist/schemas/system-kinds.js.map +1 -1
  154. package/dist/schemas/templates.d.ts.map +1 -1
  155. package/dist/schemas/templates.js.map +1 -1
  156. package/dist/schemas/tools.d.ts.map +1 -1
  157. package/dist/schemas/tools.js.map +1 -1
  158. package/dist/schemas/trigger-links.d.ts +2 -2
  159. package/dist/schemas/trigger-links.d.ts.map +1 -1
  160. package/dist/schemas/trigger-links.js.map +1 -1
  161. package/dist/tool-runs.d.ts +4 -4
  162. package/dist/tool-runs.d.ts.map +1 -1
  163. package/dist/tool-runs.js.map +1 -1
  164. package/package.json +1 -1
  165. package/src/agents.ts +2 -2
  166. package/src/client/auth-client.ts +27 -1
  167. package/src/client/backup-client.ts +1 -1
  168. package/src/client/connectors-client.ts +1 -1
  169. package/src/client/conversations-client.ts +1 -1
  170. package/src/client/hooks-client.ts +1 -1
  171. package/src/client/index.ts +10 -10
  172. package/src/client/interactions-client.ts +1 -1
  173. package/src/client/login-client.ts +45 -4
  174. package/src/client/manifest-client.ts +1 -1
  175. package/src/client/marketplace-client.ts +1 -1
  176. package/src/client/observability-client.ts +1 -1
  177. package/src/client/policy-client.ts +1 -1
  178. package/src/client/presets-client.ts +1 -1
  179. package/src/client/profiles-client.ts +1 -1
  180. package/src/client/schedules-client.ts +1 -1
  181. package/src/client/states-client.ts +1 -1
  182. package/src/client/storage-client.ts +1 -1
  183. package/src/client/sub-mcp-client.ts +1 -1
  184. package/src/client/system-client.ts +1 -1
  185. package/src/client/tool-extensions-client.ts +1 -1
  186. package/src/client/tool-meta-client.ts +1 -1
  187. package/src/client/tools-client.ts +1 -1
  188. package/src/client/trigger-links-client.ts +1 -1
  189. package/src/client/web-entry-gate-client.ts +1 -1
  190. package/src/errors.ts +16 -0
  191. package/src/generated/served-schemas.ts +5 -2
  192. package/src/index.ts +231 -226
  193. package/src/schemas/api-keys.ts +8 -0
  194. package/src/schemas/backup.ts +1 -0
  195. package/src/schemas/capabilities.ts +9 -4
  196. package/src/schemas/connectors.ts +1 -0
  197. package/src/schemas/conversations.ts +19 -5
  198. package/src/schemas/fleet.ts +1 -0
  199. package/src/schemas/hooks.ts +1 -0
  200. package/src/schemas/index.ts +30 -28
  201. package/src/schemas/interactions.ts +1 -0
  202. package/src/schemas/login.ts +11 -4
  203. package/src/schemas/manifest-mcp.ts +1 -0
  204. package/src/schemas/notifications.ts +1 -0
  205. package/src/schemas/observability.ts +1 -0
  206. package/src/schemas/policy.ts +1 -0
  207. package/src/schemas/presets.ts +1 -0
  208. package/src/schemas/principals.ts +41 -0
  209. package/src/schemas/profiles.ts +1 -0
  210. package/src/schemas/roles.ts +1 -0
  211. package/src/schemas/schedules.ts +1 -0
  212. package/src/schemas/served.ts +2 -1
  213. package/src/schemas/settings-schema.ts +1 -0
  214. package/src/schemas/setup.ts +39 -0
  215. package/src/schemas/states.ts +1 -0
  216. package/src/schemas/system-kinds.ts +1 -0
  217. package/src/schemas/templates.ts +1 -0
  218. package/src/schemas/tools.ts +1 -0
  219. package/src/schemas/trigger-links.ts +1 -0
  220. package/src/tool-runs.ts +1 -1
@@ -1,6 +1,11 @@
1
1
  /** Public sign-in aggregator and session-logout sub-clients. */
2
+ import {
3
+ ApiError,
4
+ ApiLoginFailedError,
5
+ ApiSetupFailedError,
6
+ ApiUnauthorizedError,
7
+ } from '../errors';
2
8
  import * as s from '../schemas';
3
- import { ApiError, ApiLoginFailedError, ApiUnauthorizedError } from '../errors';
4
9
  import type { Transport } from './transport';
5
10
 
6
11
  /**
@@ -22,9 +27,9 @@ export function isSafeApiPath(path: string): boolean {
22
27
  *
23
28
  * A transport 401 arrives as `ApiUnauthorizedError` before any body is read, so
24
29
  * its message is generic by construction; the domain 4xx statuses carry the
25
- * server's informative envelope text (rate-limit, bootstrap-already-initialized,
26
- * password-policy, or the claim exchange's uniform "unknown or already used"
27
- * 404) straight through to the inline surface.
30
+ * server's informative envelope text (rate-limit, password-policy, or the claim
31
+ * exchange's uniform "unknown or already used" 404) straight through to the
32
+ * inline surface.
28
33
  */
29
34
  function asLoginError(error: unknown): never {
30
35
  if (error instanceof ApiUnauthorizedError) {
@@ -44,6 +49,29 @@ function asLoginError(error: unknown): never {
44
49
  throw error;
45
50
  }
46
51
 
52
+ /**
53
+ * Map a transport error from the setup submission onto an `ApiSetupFailedError`
54
+ * (rendered inline on the setup entry, keyed on `status`) or rethrow it unchanged
55
+ * (schema drift, network, any other status — the generic failure branch surfaces
56
+ * it loudly). The mapped statuses are the setup door's own: 403/429 (a bad or
57
+ * throttled token — no oracle), 409 (already initialized), 501 (setup
58
+ * unsupported), and 400/422 (an invalid body).
59
+ */
60
+ function asSetupError(error: unknown): never {
61
+ if (
62
+ error instanceof ApiError &&
63
+ (error.status === 400 ||
64
+ error.status === 403 ||
65
+ error.status === 409 ||
66
+ error.status === 422 ||
67
+ error.status === 429 ||
68
+ error.status === 501)
69
+ ) {
70
+ throw new ApiSetupFailedError(error.message, error.status);
71
+ }
72
+ throw error;
73
+ }
74
+
47
75
  export function loginClient(t: Transport) {
48
76
  const { req } = t;
49
77
  return {
@@ -93,6 +121,19 @@ export function loginClient(t: Transport) {
93
121
  return asLoginError(error);
94
122
  }
95
123
  },
124
+ // Initialize the deployment: create the owner principal, mint the owner's
125
+ // first key (returned once), and optionally attach the owner's login. PUBLIC
126
+ // (anonymous — no credential exists yet). A refused/throttled token, an
127
+ // already-initialized deployment, an unsupported setup door, or an invalid
128
+ // body becomes an inline `ApiSetupFailedError`; any other failure rethrows
129
+ // loudly.
130
+ submitSetup: async (body: s.SetupBody) => {
131
+ try {
132
+ return await req('/api/setup', s.setupResult, { method: 'POST', body });
133
+ } catch (error) {
134
+ return asSetupError(error);
135
+ }
136
+ },
96
137
  };
97
138
  }
98
139
 
@@ -1,6 +1,6 @@
1
1
  /** Manifest / MCP section, env-ref and config-reload sub-clients. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  /** Marketplace search, install, update and advisory sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  /** Run metrics, listing, trace and export sub-client. */
2
- import * as s from '../schemas';
3
2
  import { apiDownload, encodeSegment, type RequestOptions } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  /** The observability-metrics window + bucket size (GET query params). */
@@ -1,6 +1,6 @@
1
1
  /** Access-policy validation, versioning and rollback sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  /** Preset CRUD, versioning and validation sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  /** Settings-profile CRUD, versioning and apply sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  export function profilesClient(t: Transport) {
@@ -1,6 +1,6 @@
1
1
  /** Schedule listing and mutation sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  export function schedulesClient(t: Transport) {
@@ -1,6 +1,6 @@
1
1
  /** State declaration, record, template and consumer sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  /** Storage resource CRUD sub-client. */
2
- import * as s from '../schemas';
3
2
  import { apiDownload, isUnsafePathSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  /** Sub-MCP mount registry sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  export function subMcpClient(t: Transport) {
@@ -1,6 +1,6 @@
1
1
  /** System health and pluggable-kind status sub-client. */
2
- import * as s from '../schemas';
3
2
  import { apiText } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  export function systemClient(t: Transport) {
@@ -1,6 +1,6 @@
1
1
  /** Tool extension listing and authoring sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  export function toolExtensionsClient(t: Transport) {
@@ -1,6 +1,6 @@
1
1
  /** Tool-organization overlay (folders and meta) sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  /** Tool catalog, run, live-registry admin and tag sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import { getToolRun, listToolRuns, submitToolRun, type SubmitToolRunArgs } from '../tool-runs';
5
5
  import type { Transport } from './transport';
6
6
 
@@ -1,6 +1,6 @@
1
1
  /** Trigger-link mint, listing and revoke sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  /** Web-channel entry-gate sub-client. */
2
- import * as s from '../schemas';
3
2
  import { encodeSegment } from '../http';
3
+ import * as s from '../schemas';
4
4
  import type { Transport } from './transport';
5
5
 
6
6
  /**
package/src/errors.ts CHANGED
@@ -71,6 +71,22 @@ export class ApiLoginFailedError extends Error {
71
71
  }
72
72
  }
73
73
 
74
+ /**
75
+ * A setup attempt was REJECTED — a bad or throttled token (403/429), an
76
+ * already-initialized deployment (409), an unsupported setup door (501), or an
77
+ * invalid body (400/422). Like {@link ApiLoginFailedError} it is NOT an
78
+ * ApiUnauthorizedError: it renders inline on the setup entry, keyed on `status`
79
+ * so the page shows the right copy, never a global unauthorized redirect.
80
+ */
81
+ export class ApiSetupFailedError extends Error {
82
+ readonly status: number;
83
+ constructor(message: string, status: number) {
84
+ super(message);
85
+ this.name = 'ApiSetupFailedError';
86
+ this.status = status;
87
+ }
88
+ }
89
+
74
90
  /**
75
91
  * The response body did not match its declared zod schema. This is a contract
76
92
  * drift between the Studio and the skeleton — a loud, visible error, never a
@@ -18,6 +18,9 @@ export type MediaKind = z.infer<typeof mediaKind>;
18
18
  export const mediaItem = z.object({ "caption": z.union([z.string(), z.null()]).default(null), "filename": z.union([z.string(), z.null()]).default(null), "kind": mediaKind, "url": z.string() });
19
19
  export type MediaItem = z.infer<typeof mediaItem>;
20
20
 
21
+ export const overlapPolicy = z.object({ "deliver": z.enum(["one","all"]).default("one"), "running": z.enum(["continue","cancel"]).default("continue"), "settle_seconds": z.number().int().gte(0).lte(30).default(0) });
22
+ export type OverlapPolicy = z.infer<typeof overlapPolicy>;
23
+
21
24
  export const presetSeedToolMeta = z.object({ "display_name": z.union([z.string(), z.null()]).default(null), "folder_path": z.union([z.string(), z.null()]).default(null), "tags": z.union([z.array(z.string()), z.null()]).default(null) });
22
25
  export type PresetSeedToolMeta = z.infer<typeof presetSeedToolMeta>;
23
26
 
@@ -95,10 +98,10 @@ export const channelTemplate = z.object({ "body_parameters": z.array(z.string())
95
98
  })).default([]), "header_media": z.union([mediaItem, z.null()]).default(null), "language": z.string(), "name": z.string() });
96
99
  export type ChannelTemplate = z.infer<typeof channelTemplate>;
97
100
 
98
- export const conversationRoute = z.object({ "callback_secret": z.union([z.string(), z.null()]).default(null), "callback_url": z.union([z.string(), z.null()]).default(null), "channel": z.union([z.string(), z.null()]).default(null), "door": z.enum(["api","channel"]), "error_reply_text": z.union([z.string().min(1).max(2000), z.null()]).default(null), "execution_key": z.string().min(1), "execution_key_fingerprint": z.string().min(1), "initial_mode": z.enum(["agent","manual"]).default("agent"), "locale": z.union([z.string(), z.null()]).default(null), "our_identity": z.union([z.string(), z.null()]).default(null), "payload_expr": z.union([templatedText, z.null()]).default(null), "reply_expr": z.union([templatedText, z.null()]).default(null), "route_name": z.string(), "target_kind": z.enum(["agent","tool"]), "target_name": z.string().min(1), "turns_per_hour_override": z.union([z.number().int().gt(0), z.null()]).default(null) });
101
+ export const conversationRoute = z.object({ "callback_secret": z.union([z.string(), z.null()]).default(null), "callback_url": z.union([z.string(), z.null()]).default(null), "channel": z.union([z.string(), z.null()]).default(null), "door": z.enum(["api","channel"]), "error_reply_text": z.union([z.string().min(1).max(2000), z.null()]).default(null), "execution_key": z.string().min(1), "execution_key_fingerprint": z.string().min(1), "initial_mode": z.enum(["agent","manual"]).default("agent"), "locale": z.union([z.string(), z.null()]).default(null), "our_identity": z.union([z.string(), z.null()]).default(null), "overlap": overlapPolicy.default({"deliver":"one","running":"continue","settle_seconds":0}), "payload_expr": z.union([templatedText, z.null()]).default(null), "reply_expr": z.union([templatedText, z.null()]).default(null), "route_name": z.string(), "target_kind": z.enum(["agent","tool"]), "target_name": z.string().min(1), "turns_per_hour_override": z.union([z.number().int().gt(0), z.null()]).default(null) });
99
102
  export type ConversationRoute = z.infer<typeof conversationRoute>;
100
103
 
101
- export const conversationRouteCreate = z.object({ "callback_url": z.union([z.string(), z.null()]).default(null), "channel": z.union([z.string(), z.null()]).default(null), "door": z.enum(["api","channel"]), "error_reply_text": z.union([z.string().min(1).max(2000), z.null()]).default(null), "execution_key": z.string().min(1), "initial_mode": z.enum(["agent","manual"]).default("agent"), "locale": z.union([z.string(), z.null()]).default(null), "our_identity": z.union([z.string(), z.null()]).default(null), "payload_expr": z.union([templatedText, z.null()]).default(null), "reply_expr": z.union([templatedText, z.null()]).default(null), "route_name": z.string(), "target_kind": z.enum(["agent","tool"]), "target_name": z.string().min(1), "turns_per_hour_override": z.union([z.number().int().gt(0), z.null()]).default(null) });
104
+ export const conversationRouteCreate = z.object({ "callback_url": z.union([z.string(), z.null()]).default(null), "channel": z.union([z.string(), z.null()]).default(null), "door": z.enum(["api","channel"]), "error_reply_text": z.union([z.string().min(1).max(2000), z.null()]).default(null), "execution_key": z.string().min(1), "initial_mode": z.enum(["agent","manual"]).default("agent"), "locale": z.union([z.string(), z.null()]).default(null), "our_identity": z.union([z.string(), z.null()]).default(null), "overlap": overlapPolicy.default({"deliver":"one","running":"continue","settle_seconds":0}), "payload_expr": z.union([templatedText, z.null()]).default(null), "reply_expr": z.union([templatedText, z.null()]).default(null), "route_name": z.string(), "target_kind": z.enum(["agent","tool"]), "target_name": z.string().min(1), "turns_per_hour_override": z.union([z.number().int().gt(0), z.null()]).default(null) });
102
105
  export type ConversationRouteCreate = z.infer<typeof conversationRouteCreate>;
103
106
 
104
107
  export const hookParams = z.object({ "condition": z.union([templatedText, z.null()]).default(null), "execution_key": z.string().min(1), "execution_key_fingerprint": z.string().min(1), "expr": z.union([templatedText, z.null()]).default(null), "name": z.string().min(1), "state_binding": z.union([stateBinding, z.null()]).default(null), "subject": z.union([hookSubject, z.null()]).default(null), "tool": z.string().min(1), "tool_kwargs": z.record(z.string(), z.unknown()).default({}), "topic": z.string().min(1) });