@meistrari/chat-nuxt 4.10.0-rc.2 → 4.10.0-rc.21

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 (135) hide show
  1. package/README.md +8 -6
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +2 -0
  4. package/dist/runtime/conversations/components/chat-conversation-export-modal.d.vue.ts +10 -0
  5. package/dist/runtime/conversations/components/chat-conversation-export-modal.vue +126 -0
  6. package/dist/runtime/conversations/components/chat-conversation-export-modal.vue.d.ts +10 -0
  7. package/dist/runtime/conversations/components/chat-conversation-list.vue +8 -1
  8. package/dist/runtime/{rendering/components/openui/bar-chart.d.vue.ts → conversations/components/chat-export-document.d.vue.ts} +2 -5
  9. package/dist/runtime/conversations/components/chat-export-document.vue +26 -0
  10. package/dist/runtime/{rendering/components/openui/bar-chart.vue.d.ts → conversations/components/chat-export-document.vue.d.ts} +2 -5
  11. package/dist/runtime/{rendering/components/openui/checkbox.d.vue.ts → conversations/components/chat-export-file.d.vue.ts} +1 -1
  12. package/dist/runtime/conversations/components/chat-export-file.vue +12 -0
  13. package/dist/runtime/{rendering/components/openui/checkbox.vue.d.ts → conversations/components/chat-export-file.vue.d.ts} +1 -1
  14. package/dist/runtime/{rendering/components/openui/buttons.d.vue.ts → conversations/components/chat-export-message.d.vue.ts} +2 -3
  15. package/dist/runtime/conversations/components/chat-export-message.vue +84 -0
  16. package/dist/runtime/{rendering/components/openui/bar.vue.d.ts → conversations/components/chat-export-message.vue.d.ts} +2 -5
  17. package/dist/runtime/{rendering/components/openui/bar.d.vue.ts → conversations/components/chat-export-openui.d.vue.ts} +3 -4
  18. package/dist/runtime/conversations/components/chat-export-openui.vue +19 -0
  19. package/dist/runtime/conversations/components/chat-export-openui.vue.d.ts +9 -0
  20. package/dist/runtime/{rendering/components/openui/callout.d.vue.ts → conversations/components/chat-export-questions.d.vue.ts} +12 -4
  21. package/dist/runtime/conversations/components/chat-export-questions.vue +22 -0
  22. package/dist/runtime/{rendering/components/openui/callout.vue.d.ts → conversations/components/chat-export-questions.vue.d.ts} +12 -4
  23. package/dist/runtime/conversations/composables/conversation-list.d.ts +2 -1
  24. package/dist/runtime/conversations/composables/conversation-list.js +4 -13
  25. package/dist/runtime/conversations/export-document.d.ts +1 -0
  26. package/dist/runtime/conversations/export-document.js +154 -0
  27. package/dist/runtime/conversations/export.d.ts +4 -0
  28. package/dist/runtime/conversations/export.js +69 -4
  29. package/dist/runtime/embed/components/chat-embed-inner.vue +81 -7
  30. package/dist/runtime/embed/components/mobile/chat-mobile-shell.d.vue.ts +3 -2
  31. package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue +2 -0
  32. package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue.d.ts +3 -2
  33. package/dist/runtime/embed/execution-controls.d.ts +2 -1
  34. package/dist/runtime/embed/execution-controls.js +2 -2
  35. package/dist/runtime/messages/components/chat-execution-mode-selector.vue +10 -6
  36. package/dist/runtime/messages/components/chat-message-bubble.vue +7 -0
  37. package/dist/runtime/messages/components/chat-message-input.d.vue.ts +2 -0
  38. package/dist/runtime/messages/components/chat-message-input.vue +18 -1
  39. package/dist/runtime/messages/components/chat-message-input.vue.d.ts +2 -0
  40. package/dist/runtime/messages/composables/chat.d.ts +15 -0
  41. package/dist/runtime/messages/composables/chat.js +49 -5
  42. package/dist/runtime/messages/composer-draft.d.ts +16 -0
  43. package/dist/runtime/messages/composer-draft.js +61 -0
  44. package/dist/runtime/messages/composer-pending-send.d.ts +8 -0
  45. package/dist/runtime/messages/composer-pending-send.js +34 -0
  46. package/dist/runtime/messages/conversation-timeline.js +1 -1
  47. package/dist/runtime/rendering/components/openui/{markdown.d.vue.ts → markdown-prose.d.vue.ts} +1 -3
  48. package/dist/runtime/rendering/components/openui/{markdown.vue → markdown-prose.vue} +3 -3
  49. package/dist/runtime/rendering/components/openui/{markdown.vue.d.ts → markdown-prose.vue.d.ts} +1 -3
  50. package/dist/runtime/rendering/components/openui-block.vue +26 -52
  51. package/dist/runtime/rendering/openui/context.d.ts +2 -17
  52. package/dist/runtime/rendering/openui/context.js +0 -2
  53. package/dist/runtime/server/utils/chat-api-proxy.d.ts +1 -1
  54. package/dist/runtime/server/utils/chat-api-proxy.js +3 -2
  55. package/dist/runtime/types/composer.d.ts +6 -0
  56. package/dist/runtime/types/schemas/chat/chat-config.d.ts +6 -2
  57. package/dist/runtime/types/schemas/chat/chat-config.js +1 -0
  58. package/dist/runtime/types/schemas/chat/conversation-runtime.d.ts +8 -0
  59. package/dist/runtime/types/schemas/chat/conversations.d.ts +8 -0
  60. package/dist/runtime/types/schemas/chat/messages.d.ts +12 -0
  61. package/dist/runtime/types/schemas/chat/ui-language.d.ts +19 -2
  62. package/dist/runtime/types/schemas/chat/ui-language.js +8 -3
  63. package/dist/runtime/types/schemas/chat/v3.d.ts +160 -2
  64. package/dist/runtime/types/schemas/chat/v3.js +91 -5
  65. package/dist/runtime/types/schemas/integrations/slack-apps.d.ts +53 -0
  66. package/dist/runtime/types/schemas/integrations/slack-apps.js +6 -0
  67. package/dist/runtime/types/schemas/integrations/slack-identity.d.ts +26 -0
  68. package/dist/runtime/types/schemas/integrations/slack-identity.js +23 -0
  69. package/dist/runtime/types/schemas/integrations/tela-agent-api.d.ts +40 -0
  70. package/dist/runtime/types/schemas/integrations/tela-agent-api.js +3 -0
  71. package/dist/runtime/types/schemas/integrations/tela-api.d.ts +11 -0
  72. package/dist/runtime/types/schemas/integrations/tela-api.js +8 -0
  73. package/dist/runtime/types/schemas/integrations/tela-auth.d.ts +39 -0
  74. package/dist/runtime/types/schemas/integrations/tela-auth.js +12 -0
  75. package/dist/runtime/types/schemas/slack/apps.d.ts +144 -0
  76. package/dist/runtime/types/schemas/slack/apps.js +53 -0
  77. package/dist/runtime/types/schemas/slack/identities.d.ts +58 -0
  78. package/dist/runtime/types/schemas/slack/identities.js +19 -0
  79. package/dist/runtime/types/schemas/slack/installations.d.ts +39 -0
  80. package/dist/runtime/types/schemas/slack/installations.js +18 -0
  81. package/package.json +2 -2
  82. package/dist/runtime/rendering/components/openui/bar-chart.vue +0 -39
  83. package/dist/runtime/rendering/components/openui/bar.vue +0 -12
  84. package/dist/runtime/rendering/components/openui/button.d.vue.ts +0 -11
  85. package/dist/runtime/rendering/components/openui/button.vue +0 -30
  86. package/dist/runtime/rendering/components/openui/button.vue.d.ts +0 -11
  87. package/dist/runtime/rendering/components/openui/buttons.vue +0 -14
  88. package/dist/runtime/rendering/components/openui/buttons.vue.d.ts +0 -8
  89. package/dist/runtime/rendering/components/openui/callout.vue +0 -27
  90. package/dist/runtime/rendering/components/openui/card.d.vue.ts +0 -9
  91. package/dist/runtime/rendering/components/openui/card.vue +0 -19
  92. package/dist/runtime/rendering/components/openui/card.vue.d.ts +0 -9
  93. package/dist/runtime/rendering/components/openui/checkbox.vue +0 -26
  94. package/dist/runtime/rendering/components/openui/col.d.vue.ts +0 -10
  95. package/dist/runtime/rendering/components/openui/col.vue +0 -16
  96. package/dist/runtime/rendering/components/openui/col.vue.d.ts +0 -10
  97. package/dist/runtime/rendering/components/openui/form.d.vue.ts +0 -10
  98. package/dist/runtime/rendering/components/openui/form.vue +0 -60
  99. package/dist/runtime/rendering/components/openui/form.vue.d.ts +0 -10
  100. package/dist/runtime/rendering/components/openui/input.d.vue.ts +0 -10
  101. package/dist/runtime/rendering/components/openui/input.vue +0 -23
  102. package/dist/runtime/rendering/components/openui/input.vue.d.ts +0 -10
  103. package/dist/runtime/rendering/components/openui/metric.d.vue.ts +0 -11
  104. package/dist/runtime/rendering/components/openui/metric.vue +0 -20
  105. package/dist/runtime/rendering/components/openui/metric.vue.d.ts +0 -11
  106. package/dist/runtime/rendering/components/openui/option.d.vue.ts +0 -10
  107. package/dist/runtime/rendering/components/openui/option.vue +0 -12
  108. package/dist/runtime/rendering/components/openui/option.vue.d.ts +0 -10
  109. package/dist/runtime/rendering/components/openui/question.d.vue.ts +0 -11
  110. package/dist/runtime/rendering/components/openui/question.vue +0 -15
  111. package/dist/runtime/rendering/components/openui/question.vue.d.ts +0 -11
  112. package/dist/runtime/rendering/components/openui/questions.d.vue.ts +0 -9
  113. package/dist/runtime/rendering/components/openui/questions.vue +0 -91
  114. package/dist/runtime/rendering/components/openui/questions.vue.d.ts +0 -9
  115. package/dist/runtime/rendering/components/openui/select.d.vue.ts +0 -10
  116. package/dist/runtime/rendering/components/openui/select.vue +0 -27
  117. package/dist/runtime/rendering/components/openui/select.vue.d.ts +0 -10
  118. package/dist/runtime/rendering/components/openui/stack.d.vue.ts +0 -9
  119. package/dist/runtime/rendering/components/openui/stack.vue +0 -18
  120. package/dist/runtime/rendering/components/openui/stack.vue.d.ts +0 -9
  121. package/dist/runtime/rendering/components/openui/table.d.vue.ts +0 -9
  122. package/dist/runtime/rendering/components/openui/table.vue +0 -41
  123. package/dist/runtime/rendering/components/openui/table.vue.d.ts +0 -9
  124. package/dist/runtime/rendering/openui/actions.d.ts +0 -15
  125. package/dist/runtime/rendering/openui/actions.js +0 -40
  126. package/dist/runtime/rendering/openui/form-fields.d.ts +0 -10
  127. package/dist/runtime/rendering/openui/form-fields.js +0 -30
  128. package/dist/runtime/rendering/openui/program.d.ts +0 -15
  129. package/dist/runtime/rendering/openui/program.js +0 -74
  130. package/dist/runtime/rendering/openui/registry.d.ts +0 -5
  131. package/dist/runtime/rendering/openui/registry.js +0 -44
  132. package/dist/runtime/rendering/openui/render.d.ts +0 -21
  133. package/dist/runtime/rendering/openui/render.js +0 -45
  134. package/dist/runtime/rendering/openui/use-openui-context.d.ts +0 -2
  135. package/dist/runtime/rendering/openui/use-openui-context.js +0 -8
@@ -1,14 +1,31 @@
1
1
  import { z } from 'zod';
2
2
  export declare const uiLanguageIds: readonly ["openui"];
3
- export declare const uiLanguageSchema: z.ZodEnum<{
4
- openui: "openui";
3
+ export declare const uiProfileIds: readonly ["web", "slack"];
4
+ export declare const uiProfileSchema: z.ZodEnum<{
5
+ web: "web";
6
+ slack: "slack";
5
7
  }>;
8
+ export type UiProfile = z.infer<typeof uiProfileSchema>;
9
+ /** What a turn asks the agent for: the widget language and the catalogue profile of the surface that renders the answer. */
10
+ export declare const uiLanguageSchema: z.ZodObject<{
11
+ id: z.ZodEnum<{
12
+ openui: "openui";
13
+ }>;
14
+ profile: z.ZodEnum<{
15
+ web: "web";
16
+ slack: "slack";
17
+ }>;
18
+ }, z.core.$strip>;
6
19
  export type UiLanguage = z.infer<typeof uiLanguageSchema>;
7
20
  /** Set on the assistant message when the turn asked the agent for widgets; the library version arrives with the result. */
8
21
  export declare const uiLanguageStampSchema: z.ZodObject<{
9
22
  id: z.ZodEnum<{
10
23
  openui: "openui";
11
24
  }>;
25
+ profile: z.ZodEnum<{
26
+ web: "web";
27
+ slack: "slack";
28
+ }>;
12
29
  libraryVersion: z.ZodOptional<z.ZodString>;
13
30
  }, z.core.$strip>;
14
31
  export type UiLanguageStamp = z.infer<typeof uiLanguageStampSchema>;
@@ -1,8 +1,13 @@
1
1
  import { z } from 'zod';
2
2
  export const uiLanguageIds = ['openui'];
3
- export const uiLanguageSchema = z.enum(uiLanguageIds);
3
+ export const uiProfileIds = ['web', 'slack'];
4
+ export const uiProfileSchema = z.enum(uiProfileIds);
5
+ /** What a turn asks the agent for: the widget language and the catalogue profile of the surface that renders the answer. */
6
+ export const uiLanguageSchema = z.object({
7
+ id: z.enum(uiLanguageIds),
8
+ profile: uiProfileSchema,
9
+ });
4
10
  /** Set on the assistant message when the turn asked the agent for widgets; the library version arrives with the result. */
5
- export const uiLanguageStampSchema = z.object({
6
- id: uiLanguageSchema,
11
+ export const uiLanguageStampSchema = uiLanguageSchema.extend({
7
12
  libraryVersion: z.string().min(1).optional(),
8
13
  });
@@ -1,10 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
3
  * Chat API v3 (`/v3/chat`): the conversational surface over agent-api v5 events-v1.
4
- * The chat-api owns the conversation; agent-api owns the session and its history.
4
+ * The chat-api owns the thread; agent-api owns the session and its history.
5
5
  */
6
6
  export declare const CHAT_V3_CONTRACT_VERSION = "events-v1";
7
- /** Where the agent of the request stands in the v5 catalog. */
7
+ /** Where the agent of the request stands in agent-api, where the agent lives. */
8
8
  export declare const chatV3AgentStatusSchema: z.ZodEnum<{
9
9
  ready: "ready";
10
10
  not_requested: "not_requested";
@@ -53,3 +53,161 @@ export declare const chatV3ConfigurationSchema: z.ZodObject<{
53
53
  }, z.core.$strip>;
54
54
  }, z.core.$strip>;
55
55
  export type ChatV3Configuration = z.infer<typeof chatV3ConfigurationSchema>;
56
+ export declare const CHAT_V3_TITLE_CHARS = 200;
57
+ export declare const CHAT_V3_CREATION_KEY_CHARS = 128;
58
+ export declare const CHAT_V3_THREAD_PAGE: {
59
+ readonly default: 30;
60
+ readonly max: 100;
61
+ };
62
+ /** A thread as the chat owns it: access and title here, history in the agent-api session. */
63
+ export declare const chatV3ThreadSchema: z.ZodObject<{
64
+ threadId: z.ZodString;
65
+ agentId: z.ZodString;
66
+ sessionId: z.ZodString;
67
+ title: z.ZodString;
68
+ createdAt: z.ZodString;
69
+ updatedAt: z.ZodString;
70
+ }, z.core.$strip>;
71
+ export type ChatV3Thread = z.infer<typeof chatV3ThreadSchema>;
72
+ /** The session behind a thread, read live from agent-api; `null` when agent-api no longer has it. */
73
+ export declare const chatV3SessionSummarySchema: z.ZodNullable<z.ZodObject<{
74
+ status: z.ZodString;
75
+ harness: z.ZodString;
76
+ model: z.ZodNullable<z.ZodString>;
77
+ reasoningEffort: z.ZodNullable<z.ZodString>;
78
+ }, z.core.$strip>>;
79
+ export declare const chatV3ThreadDetailSchema: z.ZodObject<{
80
+ threadId: z.ZodString;
81
+ agentId: z.ZodString;
82
+ sessionId: z.ZodString;
83
+ title: z.ZodString;
84
+ createdAt: z.ZodString;
85
+ updatedAt: z.ZodString;
86
+ session: z.ZodNullable<z.ZodObject<{
87
+ status: z.ZodString;
88
+ harness: z.ZodString;
89
+ model: z.ZodNullable<z.ZodString>;
90
+ reasoningEffort: z.ZodNullable<z.ZodString>;
91
+ }, z.core.$strip>>;
92
+ }, z.core.$strip>;
93
+ export type ChatV3ThreadDetail = z.infer<typeof chatV3ThreadDetailSchema>;
94
+ /** Creation also opens the agent-api session; send an `Idempotency-Key` header to retry safely. */
95
+ export declare const chatV3CreateThreadSchema: z.ZodObject<{
96
+ agentId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
97
+ title: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strict>;
99
+ export type ChatV3CreateThread = z.infer<typeof chatV3CreateThreadSchema>;
100
+ export declare const chatV3UpdateThreadSchema: z.ZodObject<{
101
+ title: z.ZodString;
102
+ }, z.core.$strict>;
103
+ export type ChatV3UpdateThread = z.infer<typeof chatV3UpdateThreadSchema>;
104
+ export declare const chatV3ThreadListQuerySchema: z.ZodObject<{
105
+ agentId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
106
+ before: z.ZodOptional<z.ZodString>;
107
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
108
+ }, z.core.$strict>;
109
+ export type ChatV3ThreadListQuery = z.infer<typeof chatV3ThreadListQuerySchema>;
110
+ export declare const chatV3ThreadListSchema: z.ZodObject<{
111
+ threads: z.ZodArray<z.ZodObject<{
112
+ threadId: z.ZodString;
113
+ agentId: z.ZodString;
114
+ sessionId: z.ZodString;
115
+ title: z.ZodString;
116
+ createdAt: z.ZodString;
117
+ updatedAt: z.ZodString;
118
+ }, z.core.$strip>>;
119
+ nextCursor: z.ZodNullable<z.ZodString>;
120
+ }, z.core.$strip>;
121
+ export type ChatV3ThreadList = z.infer<typeof chatV3ThreadListSchema>;
122
+ export declare const CHAT_V3_MESSAGE_PAGE: {
123
+ readonly default: 30;
124
+ readonly max: 100;
125
+ };
126
+ /** A message's text; above the inline limit agent-api keeps it in Vault and the event points at it. */
127
+ export declare const chatV3SendMessageSchema: z.ZodObject<{
128
+ text: z.ZodString;
129
+ }, z.core.$strict>;
130
+ export type ChatV3SendMessage = z.infer<typeof chatV3SendMessageSchema>;
131
+ /** Cancels the running turn; the turnId comes from the message that started it. */
132
+ export declare const chatV3CancelTurnSchema: z.ZodObject<{
133
+ turnId: z.ZodString;
134
+ }, z.core.$strict>;
135
+ export type ChatV3CancelTurn = z.infer<typeof chatV3CancelTurnSchema>;
136
+ /** The answer of every write: agent-api admitted the user event. `messageId` is its v5 eventId. */
137
+ export declare const chatV3MessageReceiptSchema: z.ZodObject<{
138
+ messageId: z.ZodString;
139
+ turnId: z.ZodNullable<z.ZodString>;
140
+ status: z.ZodString;
141
+ }, z.core.$strip>;
142
+ export type ChatV3MessageReceipt = z.infer<typeof chatV3MessageReceiptSchema>;
143
+ export declare const chatV3MessageStatusSchema: z.ZodEnum<{
144
+ running: "running";
145
+ completed: "completed";
146
+ failed: "failed";
147
+ cancelled: "cancelled";
148
+ queued: "queued";
149
+ uncertain: "uncertain";
150
+ }>;
151
+ export type ChatV3MessageStatus = z.infer<typeof chatV3MessageStatusSchema>;
152
+ /**
153
+ * One message of the user and the agent's reply to it, rebuilt from the session's events on
154
+ * every read. `text` is `null` while it is only in Vault (`textInVault`); `reply` is the
155
+ * canonical text the agent stored so far, without the live drafts.
156
+ */
157
+ export declare const chatV3MessageSchema: z.ZodObject<{
158
+ messageId: z.ZodString;
159
+ turnId: z.ZodNullable<z.ZodString>;
160
+ mode: z.ZodEnum<{
161
+ queue: "queue";
162
+ steer: "steer";
163
+ answer: "answer";
164
+ }>;
165
+ status: z.ZodEnum<{
166
+ running: "running";
167
+ completed: "completed";
168
+ failed: "failed";
169
+ cancelled: "cancelled";
170
+ queued: "queued";
171
+ uncertain: "uncertain";
172
+ }>;
173
+ text: z.ZodNullable<z.ZodString>;
174
+ textInVault: z.ZodBoolean;
175
+ reply: z.ZodString;
176
+ createdAt: z.ZodString;
177
+ }, z.core.$strip>;
178
+ export type ChatV3Message = z.infer<typeof chatV3MessageSchema>;
179
+ export declare const chatV3MessageListQuerySchema: z.ZodObject<{
180
+ before: z.ZodOptional<z.ZodString>;
181
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
182
+ }, z.core.$strict>;
183
+ export type ChatV3MessageListQuery = z.infer<typeof chatV3MessageListQuerySchema>;
184
+ /**
185
+ * The latest messages, oldest first. `eventCursor` is the last event the page was built from:
186
+ * open the event stream with it as `Last-Event-ID` and nothing falls between the two.
187
+ */
188
+ export declare const chatV3MessageListSchema: z.ZodObject<{
189
+ messages: z.ZodArray<z.ZodObject<{
190
+ messageId: z.ZodString;
191
+ turnId: z.ZodNullable<z.ZodString>;
192
+ mode: z.ZodEnum<{
193
+ queue: "queue";
194
+ steer: "steer";
195
+ answer: "answer";
196
+ }>;
197
+ status: z.ZodEnum<{
198
+ running: "running";
199
+ completed: "completed";
200
+ failed: "failed";
201
+ cancelled: "cancelled";
202
+ queued: "queued";
203
+ uncertain: "uncertain";
204
+ }>;
205
+ text: z.ZodNullable<z.ZodString>;
206
+ textInVault: z.ZodBoolean;
207
+ reply: z.ZodString;
208
+ createdAt: z.ZodString;
209
+ }, z.core.$strip>>;
210
+ nextCursor: z.ZodNullable<z.ZodString>;
211
+ eventCursor: z.ZodNullable<z.ZodString>;
212
+ }, z.core.$strip>;
213
+ export type ChatV3MessageList = z.infer<typeof chatV3MessageListSchema>;
@@ -1,15 +1,15 @@
1
1
  import { z } from 'zod';
2
- import { v5HarnessSchema } from '../integrations/agent-events';
2
+ import { v5EventIdSchema, v5HarnessSchema, v5Limits, v5TurnIdSchema } from '../integrations/agent-events';
3
3
  /**
4
4
  * Chat API v3 (`/v3/chat`): the conversational surface over agent-api v5 events-v1.
5
- * The chat-api owns the conversation; agent-api owns the session and its history.
5
+ * The chat-api owns the thread; agent-api owns the session and its history.
6
6
  */
7
7
  export const CHAT_V3_CONTRACT_VERSION = 'events-v1';
8
- /** Where the agent of the request stands in the v5 catalog. */
8
+ /** Where the agent of the request stands in agent-api, where the agent lives. */
9
9
  export const chatV3AgentStatusSchema = z.enum([
10
- /** No `telaAgentId` on the request: nothing to resolve yet. */
10
+ /** No `agentId` on the request: nothing to look up yet. */
11
11
  'not_requested',
12
- /** Tela knows the agent, but the v5 catalog does not: Tela has to create it there. */
12
+ /** agent-api has no such agent in the caller's workspace. */
13
13
  'not_in_catalog',
14
14
  /** In the catalog without a publication: `POST /v5/agents/snapshots` first. */
15
15
  'not_published',
@@ -35,3 +35,89 @@ export const chatV3ConfigurationSchema = z.object({
35
35
  eventsPerRequest: z.number().int().positive(),
36
36
  }),
37
37
  });
38
+ export const CHAT_V3_TITLE_CHARS = 200;
39
+ export const CHAT_V3_CREATION_KEY_CHARS = 128;
40
+ export const CHAT_V3_THREAD_PAGE = { default: 30, max: 100 };
41
+ /**
42
+ * The agent's id in agent-api, the only one the chat uses. Lowercased, as agent-api and Postgres
43
+ * write uuids, so the same agent always compares equal.
44
+ */
45
+ const agentIdSchema = z.string().uuid().transform(id => id.toLowerCase());
46
+ /** A thread as the chat owns it: access and title here, history in the agent-api session. */
47
+ export const chatV3ThreadSchema = z.object({
48
+ threadId: z.string().uuid(),
49
+ agentId: z.string().uuid(),
50
+ sessionId: z.string().uuid(),
51
+ title: z.string(),
52
+ createdAt: z.string(),
53
+ updatedAt: z.string(),
54
+ });
55
+ /** The session behind a thread, read live from agent-api; `null` when agent-api no longer has it. */
56
+ export const chatV3SessionSummarySchema = z.object({
57
+ status: z.string(),
58
+ harness: z.string(),
59
+ model: z.string().nullable(),
60
+ reasoningEffort: z.string().nullable(),
61
+ }).nullable();
62
+ export const chatV3ThreadDetailSchema = chatV3ThreadSchema.extend({ session: chatV3SessionSummarySchema });
63
+ /** Creation also opens the agent-api session; send an `Idempotency-Key` header to retry safely. */
64
+ export const chatV3CreateThreadSchema = z.object({
65
+ agentId: agentIdSchema,
66
+ title: z.string().trim().max(CHAT_V3_TITLE_CHARS).optional(),
67
+ }).strict();
68
+ export const chatV3UpdateThreadSchema = z.object({
69
+ title: z.string().trim().max(CHAT_V3_TITLE_CHARS),
70
+ }).strict();
71
+ export const chatV3ThreadListQuerySchema = z.object({
72
+ agentId: agentIdSchema.optional(),
73
+ /** Exclusive cursor: the last `threadId` of the previous page. */
74
+ before: z.string().uuid().optional(),
75
+ limit: z.coerce.number().int().min(1).max(CHAT_V3_THREAD_PAGE.max).default(CHAT_V3_THREAD_PAGE.default),
76
+ }).strict();
77
+ export const chatV3ThreadListSchema = z.object({
78
+ threads: z.array(chatV3ThreadSchema),
79
+ nextCursor: z.string().uuid().nullable(),
80
+ });
81
+ export const CHAT_V3_MESSAGE_PAGE = { default: 30, max: 100 };
82
+ /** A message's text; above the inline limit agent-api keeps it in Vault and the event points at it. */
83
+ export const chatV3SendMessageSchema = z.object({
84
+ text: z.string().min(1).max(v5Limits.messageTextChars),
85
+ }).strict();
86
+ /** Cancels the running turn; the turnId comes from the message that started it. */
87
+ export const chatV3CancelTurnSchema = z.object({ turnId: v5TurnIdSchema }).strict();
88
+ /** The answer of every write: agent-api admitted the user event. `messageId` is its v5 eventId. */
89
+ export const chatV3MessageReceiptSchema = z.object({
90
+ messageId: v5EventIdSchema,
91
+ turnId: v5TurnIdSchema.nullable(),
92
+ status: z.string(),
93
+ });
94
+ export const chatV3MessageStatusSchema = z.enum(['queued', 'running', 'completed', 'failed', 'cancelled', 'uncertain']);
95
+ /**
96
+ * One message of the user and the agent's reply to it, rebuilt from the session's events on
97
+ * every read. `text` is `null` while it is only in Vault (`textInVault`); `reply` is the
98
+ * canonical text the agent stored so far, without the live drafts.
99
+ */
100
+ export const chatV3MessageSchema = z.object({
101
+ messageId: v5EventIdSchema,
102
+ turnId: v5TurnIdSchema.nullable(),
103
+ mode: z.enum(['queue', 'steer', 'answer']),
104
+ status: chatV3MessageStatusSchema,
105
+ text: z.string().nullable(),
106
+ textInVault: z.boolean(),
107
+ reply: z.string(),
108
+ createdAt: z.string(),
109
+ });
110
+ export const chatV3MessageListQuerySchema = z.object({
111
+ /** Exclusive cursor: the `nextCursor` of the previous page, which reads older messages. */
112
+ before: v5EventIdSchema.optional(),
113
+ limit: z.coerce.number().int().min(1).max(CHAT_V3_MESSAGE_PAGE.max).default(CHAT_V3_MESSAGE_PAGE.default),
114
+ }).strict();
115
+ /**
116
+ * The latest messages, oldest first. `eventCursor` is the last event the page was built from:
117
+ * open the event stream with it as `Last-Event-ID` and nothing falls between the two.
118
+ */
119
+ export const chatV3MessageListSchema = z.object({
120
+ messages: z.array(chatV3MessageSchema),
121
+ nextCursor: v5EventIdSchema.nullable(),
122
+ eventCursor: v5EventIdSchema.nullable(),
123
+ });
@@ -0,0 +1,53 @@
1
+ import { z } from 'zod';
2
+ export type SlackOutcome<T> = {
3
+ kind: 'ok';
4
+ value: T;
5
+ } | {
6
+ kind: 'rejected';
7
+ error: string;
8
+ } | {
9
+ kind: 'rate_limited';
10
+ retryAfter: number;
11
+ } | {
12
+ kind: 'unknown';
13
+ appId?: string;
14
+ };
15
+ export interface CreatedApp {
16
+ appId: string;
17
+ credentials: {
18
+ clientId: string;
19
+ clientSecret: string;
20
+ signingSecret: string;
21
+ };
22
+ }
23
+ export interface RotatedConfigToken {
24
+ token: string;
25
+ refreshToken: string;
26
+ teamId: string;
27
+ userId: string;
28
+ exp: number;
29
+ }
30
+ export declare const slackAppIdSchema: z.ZodString;
31
+ export declare const slackApiResponseSchema: z.ZodObject<{
32
+ ok: z.ZodBoolean;
33
+ error: z.ZodOptional<z.ZodString>;
34
+ app_id: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$loose>;
36
+ export declare const slackCreatedAppResponseSchema: z.ZodObject<{
37
+ app_id: z.ZodString;
38
+ credentials: z.ZodObject<{
39
+ client_id: z.ZodString;
40
+ client_secret: z.ZodString;
41
+ signing_secret: z.ZodString;
42
+ }, z.core.$strip>;
43
+ }, z.core.$strip>;
44
+ export declare const slackExportedManifestResponseSchema: z.ZodObject<{
45
+ manifest: z.ZodRecord<z.ZodString, z.ZodUnknown>;
46
+ }, z.core.$strip>;
47
+ export declare const slackRotatedConfigTokenResponseSchema: z.ZodObject<{
48
+ token: z.ZodString;
49
+ refresh_token: z.ZodString;
50
+ team_id: z.ZodString;
51
+ user_id: z.ZodString;
52
+ exp: z.ZodNumber;
53
+ }, z.core.$strip>;
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ export const slackAppIdSchema = z.string().regex(/^A[A-Z0-9]+$/).max(100);
3
+ export const slackApiResponseSchema = z.object({ ok: z.boolean(), error: z.string().max(200).optional(), app_id: slackAppIdSchema.optional() }).passthrough();
4
+ export const slackCreatedAppResponseSchema = z.object({ app_id: slackAppIdSchema, credentials: z.object({ client_id: z.string().regex(/^\d+\.\d+$/).max(100), client_secret: z.string().min(1).max(2000), signing_secret: z.string().min(1).max(2000) }) });
5
+ export const slackExportedManifestResponseSchema = z.object({ manifest: z.record(z.string(), z.unknown()) });
6
+ export const slackRotatedConfigTokenResponseSchema = z.object({ token: z.string().regex(/^xoxe\.xoxp-[\w-]+$/).max(4000), refresh_token: z.string().regex(/^xoxe-[\w-]+$/).max(4000), team_id: z.string().regex(/^T[A-Z0-9]+$/).max(100), user_id: z.string().regex(/^U[A-Z0-9]+$/).max(100), exp: z.number().int().positive() });
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ export declare const slackIdTokenHeaderSchema: z.ZodObject<{
3
+ alg: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export declare const slackIdTokenClaimsSchema: z.ZodObject<{
6
+ iss: z.ZodLiteral<"https://slack.com">;
7
+ sub: z.ZodString;
8
+ aud: z.ZodString;
9
+ exp: z.ZodNumber;
10
+ nonce: z.ZodString;
11
+ 'https://slack.com/team_id': z.ZodString;
12
+ 'https://slack.com/user_id': z.ZodString;
13
+ }, z.core.$strip>;
14
+ export declare const slackOpenIdTokenSchema: z.ZodObject<{
15
+ ok: z.ZodLiteral<true>;
16
+ access_token: z.ZodString;
17
+ id_token: z.ZodString;
18
+ }, z.core.$strip>;
19
+ export declare const slackUserInfoSchema: z.ZodObject<{
20
+ ok: z.ZodLiteral<true>;
21
+ sub: z.ZodString;
22
+ 'https://slack.com/user_id': z.ZodString;
23
+ 'https://slack.com/team_id': z.ZodString;
24
+ 'https://slack.com/team_name': z.ZodOptional<z.ZodString>;
25
+ name: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strip>;
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ const slackUserId = z.string().regex(/^[UW][A-Z0-9]{1,99}$/);
3
+ const slackTeamId = z.string().regex(/^T[A-Z0-9]{1,99}$/);
4
+ export const slackIdTokenHeaderSchema = z.object({ alg: z.string().min(1).max(20) });
5
+ export const slackIdTokenClaimsSchema = z.object({
6
+ 'iss': z.literal('https://slack.com'),
7
+ 'sub': slackUserId,
8
+ 'aud': z.string(),
9
+ 'exp': z.number(),
10
+ 'nonce': z.string(),
11
+ 'https://slack.com/team_id': slackTeamId,
12
+ 'https://slack.com/user_id': slackUserId,
13
+ });
14
+ export const slackOpenIdTokenSchema = z.object({ ok: z.literal(true), access_token: z.string().min(1).max(4096), id_token: z.string().min(1).max(16_384) });
15
+ // openid.connect.userInfo documents the workspace name; the ID token does not.
16
+ export const slackUserInfoSchema = z.object({
17
+ 'ok': z.literal(true),
18
+ 'sub': z.string(),
19
+ 'https://slack.com/user_id': z.string(),
20
+ 'https://slack.com/team_id': z.string(),
21
+ 'https://slack.com/team_name': z.string().min(1).optional(),
22
+ 'name': z.string().min(1).optional(),
23
+ });
@@ -221,6 +221,16 @@ export declare const telaAgentSessionResultSchema: z.ZodObject<{
221
221
  content: z.ZodOptional<z.ZodString>;
222
222
  structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
223
223
  childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
224
+ uiLanguage: z.ZodCatch<z.ZodOptional<z.ZodNullable<z.ZodObject<{
225
+ id: z.ZodEnum<{
226
+ openui: "openui";
227
+ }>;
228
+ profile: z.ZodEnum<{
229
+ web: "web";
230
+ slack: "slack";
231
+ }>;
232
+ libraryVersion: z.ZodOptional<z.ZodString>;
233
+ }, z.core.$strip>>>>;
224
234
  }, z.core.$catchall<z.ZodUnknown>>;
225
235
  export declare const telaAgentDirectStreamSchema: z.ZodObject<{
226
236
  url: z.ZodString;
@@ -270,6 +280,16 @@ export declare const telaAgentSessionSchema: z.ZodObject<{
270
280
  content: z.ZodOptional<z.ZodString>;
271
281
  structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
272
282
  childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
283
+ uiLanguage: z.ZodCatch<z.ZodOptional<z.ZodNullable<z.ZodObject<{
284
+ id: z.ZodEnum<{
285
+ openui: "openui";
286
+ }>;
287
+ profile: z.ZodEnum<{
288
+ web: "web";
289
+ slack: "slack";
290
+ }>;
291
+ libraryVersion: z.ZodOptional<z.ZodString>;
292
+ }, z.core.$strip>>>>;
273
293
  }, z.core.$catchall<z.ZodUnknown>>>;
274
294
  error: z.ZodOptional<z.ZodString>;
275
295
  createdAt: z.ZodOptional<z.ZodNumber>;
@@ -364,6 +384,16 @@ export declare const telaAgentV4SessionResultEventSchema: z.ZodObject<{
364
384
  content: z.ZodOptional<z.ZodString>;
365
385
  structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
366
386
  childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
387
+ uiLanguage: z.ZodCatch<z.ZodOptional<z.ZodNullable<z.ZodObject<{
388
+ id: z.ZodEnum<{
389
+ openui: "openui";
390
+ }>;
391
+ profile: z.ZodEnum<{
392
+ web: "web";
393
+ slack: "slack";
394
+ }>;
395
+ libraryVersion: z.ZodOptional<z.ZodString>;
396
+ }, z.core.$strip>>>>;
367
397
  }, z.core.$catchall<z.ZodUnknown>>;
368
398
  nextCursor: z.ZodNullable<z.ZodNumber>;
369
399
  createdAt: z.ZodNumber;
@@ -431,6 +461,16 @@ export declare const telaAgentV4SessionStreamEventSchema: z.ZodDiscriminatedUnio
431
461
  content: z.ZodOptional<z.ZodString>;
432
462
  structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
433
463
  childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
464
+ uiLanguage: z.ZodCatch<z.ZodOptional<z.ZodNullable<z.ZodObject<{
465
+ id: z.ZodEnum<{
466
+ openui: "openui";
467
+ }>;
468
+ profile: z.ZodEnum<{
469
+ web: "web";
470
+ slack: "slack";
471
+ }>;
472
+ libraryVersion: z.ZodOptional<z.ZodString>;
473
+ }, z.core.$strip>>>>;
434
474
  }, z.core.$catchall<z.ZodUnknown>>;
435
475
  nextCursor: z.ZodNullable<z.ZodNumber>;
436
476
  createdAt: z.ZodNumber;
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { chatModelSchema } from '../chat/models';
3
+ import { uiLanguageStampSchema } from '../chat/ui-language';
3
4
  export const telaAgentAttachmentSchema = z.object({
4
5
  vaultRef: z.string().startsWith('vault://'),
5
6
  filename: z.string().min(1).max(255),
@@ -122,6 +123,8 @@ export const telaAgentSessionResultSchema = z.object({
122
123
  content: z.string().optional(),
123
124
  structuredContent: z.record(z.string(), z.unknown()).optional(),
124
125
  childEventIds: z.array(z.string()).optional(),
126
+ // The stamp only informs: one the chat-api cannot read never fails the turn.
127
+ uiLanguage: uiLanguageStampSchema.nullable().optional().catch(null),
125
128
  }).catchall(z.unknown());
126
129
  export const telaAgentDirectStreamSchema = z.object({
127
130
  url: z.string().url(),
@@ -56,3 +56,14 @@ export declare const telaWorkstationSchema: z.ZodObject<{
56
56
  updatedAt: z.ZodString;
57
57
  }, z.core.$catchall<z.ZodUnknown>>;
58
58
  export type TelaWorkstation = z.infer<typeof telaWorkstationSchema>;
59
+ export declare const telaAgentCatalogEntrySchema: z.ZodObject<{
60
+ id: z.ZodString;
61
+ workspaceId: z.ZodString;
62
+ title: z.ZodString;
63
+ description: z.ZodNullable<z.ZodString>;
64
+ isMultiturn: z.ZodNullable<z.ZodBoolean>;
65
+ inputSchema: z.ZodNullable<z.ZodArray<z.ZodObject<{
66
+ required: z.ZodOptional<z.ZodBoolean>;
67
+ }, z.core.$catchall<z.ZodUnknown>>>>;
68
+ }, z.core.$strip>;
69
+ export type TelaAgentCatalogEntry = z.infer<typeof telaAgentCatalogEntrySchema>;
@@ -41,3 +41,11 @@ export const telaWorkstationSchema = z.object({
41
41
  createdAt: z.string(),
42
42
  updatedAt: z.string(),
43
43
  }).catchall(z.unknown());
44
+ export const telaAgentCatalogEntrySchema = z.object({
45
+ id: z.string().min(1),
46
+ workspaceId: z.string().min(1),
47
+ title: z.string(),
48
+ description: z.string().nullable(),
49
+ isMultiturn: z.boolean().nullable(),
50
+ inputSchema: z.array(z.object({ required: z.boolean().optional() }).catchall(z.unknown())).nullable(),
51
+ });
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ export declare const organizationSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export declare const identitySchema: z.ZodObject<{
7
+ user: z.ZodObject<{
8
+ id: z.ZodString;
9
+ name: z.ZodOptional<z.ZodString>;
10
+ email: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strip>;
12
+ organization: z.ZodObject<{
13
+ id: z.ZodString;
14
+ name: z.ZodString;
15
+ }, z.core.$strip>;
16
+ }, z.core.$strip>;
17
+ export declare const tokensSchema: z.ZodObject<{
18
+ user: z.ZodObject<{
19
+ id: z.ZodString;
20
+ name: z.ZodOptional<z.ZodString>;
21
+ email: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strip>;
23
+ organization: z.ZodObject<{
24
+ id: z.ZodString;
25
+ name: z.ZodString;
26
+ }, z.core.$strip>;
27
+ accessToken: z.ZodString;
28
+ refreshToken: z.ZodString;
29
+ }, z.core.$strip>;
30
+ export declare const deviceSchema: z.ZodObject<{
31
+ device_code: z.ZodString;
32
+ user_code: z.ZodString;
33
+ verification_uri: z.ZodURL;
34
+ verification_uri_complete: z.ZodURL;
35
+ expires_in: z.ZodNumber;
36
+ interval: z.ZodNumber;
37
+ }, z.core.$strip>;
38
+ export type AuthTokens = z.infer<typeof tokensSchema>;
39
+ export type DeviceAuthorization = z.infer<typeof deviceSchema>;
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ export const organizationSchema = z.object({ id: z.string().min(1), name: z.string() });
3
+ export const identitySchema = z.object({ user: z.object({ id: z.string().min(1), name: z.string().max(300).optional(), email: z.string().max(320).optional() }), organization: organizationSchema });
4
+ export const tokensSchema = identitySchema.extend({ accessToken: z.string().min(1), refreshToken: z.string().min(1) });
5
+ export const deviceSchema = z.object({
6
+ device_code: z.string().min(1),
7
+ user_code: z.string().min(1),
8
+ verification_uri: z.url(),
9
+ verification_uri_complete: z.url(),
10
+ expires_in: z.number().int().positive(),
11
+ interval: z.number().int().positive(),
12
+ });