Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat: replace ai crate with agent crate powered by RIG (#3472)

Eric Hayes5fd6350c3d2a
diff --git a/js/app/packages/block-chat/definition.ts b/js/app/packages/block-chat/definition.ts
index 9848ee9ca5..d1c11e6590 100644
--- a/js/app/packages/block-chat/definition.ts
+++ b/js/app/packages/block-chat/definition.ts
@@ -1,6 +1,6 @@
import { defineBlock, type ExtractLoadType, LoadErrors } from '@core/block';
import { cognitionApiServiceClient } from '@service-cognition/client';
-import { AllModels } from '@service-cognition/generated/schemas';
+import { AgentModel } from '@service-cognition/generated/schemas';
import type { Entity } from '@service-cognition/generated/schemas/entity';
import type { DocumentMetadata } from '@service-storage/generated/schemas/documentMetadata';
import { ok } from 'neverthrow';
@@ -38,7 +38,7 @@ export const definition = defineBlock({
return ok({
...chat,
- allModels: AllModels, // TODO maybe limit people with something more swag based on acoun
+ allModels: Object.values(AgentModel),
documentMetadata: {
documentId: chat.chat.id,
documentName: chat.chat.name,
diff --git a/js/app/packages/core/component/AI/component/debug/Component.tsx b/js/app/packages/core/component/AI/component/debug/Component.tsx
index 2396cdb759..7b46ff9652 100644
--- a/js/app/packages/core/component/AI/component/debug/Component.tsx
+++ b/js/app/packages/core/component/AI/component/debug/Component.tsx
@@ -332,7 +332,7 @@ function ToolCallResponseRender() {
{
type: 'toolCall',
tool: {
- name: 'web_search',
+ name: 'ContentSearch',
data: {
query: 'most important headlines today',
},
@@ -341,7 +341,7 @@ function ToolCallResponseRender() {
{
type: 'toolResponse',
tool: {
- name: 'web_search',
+ name: 'ContentSearch',
data: {
content: [
{
diff --git a/js/app/packages/core/component/AI/component/debug/Tool.tsx b/js/app/packages/core/component/AI/component/debug/Tool.tsx
index f23c9a2834..c106d90a09 100644
--- a/js/app/packages/core/component/AI/component/debug/Tool.tsx
+++ b/js/app/packages/core/component/AI/component/debug/Tool.tsx
@@ -25,7 +25,7 @@ function ToolCall() {
{
type: 'toolCall',
tool: {
- name: 'web_search',
+ name: 'ContentSearch',
data: {
query: 'Weather in nyc now',
},
@@ -48,7 +48,7 @@ function ToolResponse() {
{
type: 'toolCall',
tool: {
- name: 'web_search',
+ name: 'ContentSearch',
data: {
query: 'Weather in nyc now',
},
@@ -67,7 +67,7 @@ function ToolResponse() {
},
],
},
- name: 'web_search',
+ name: 'ContentSearch',
},
},
{
@@ -91,7 +91,7 @@ function ToolResponsStreamEnd() {
{
type: 'toolCall',
tool: {
- name: 'web_search',
+ name: 'ContentSearch',
data: {
query: 'Weather in nyc now',
},
@@ -110,7 +110,7 @@ function ToolResponsStreamEnd() {
},
],
},
- name: 'web_search',
+ name: 'ContentSearch',
},
},
{
diff --git a/js/app/packages/core/component/AI/component/input/ChatInput.tsx b/js/app/packages/core/component/AI/component/input/ChatInput.tsx
index fcd0abf460..0ce7addca5 100644
--- a/js/app/packages/core/component/AI/component/input/ChatInput.tsx
+++ b/js/app/packages/core/component/AI/component/input/ChatInput.tsx
@@ -167,9 +167,7 @@ export function ChatInput(props: ChatInputComponentProps) {
disabled={!canSendMessage()}
hidden={isMobile() && isEmptyInput()}
onClick={() =>
- sendMessage(
- isTouchDevice() ? { modelOverride: 'claude-opus-4-6' } : undefined
- )
+ sendMessage(isTouchDevice() ? { modelOverride: 'smart' } : undefined)
}
/>
);
diff --git a/js/app/packages/core/component/AI/component/tool/BashCodeExecution.tsx b/js/app/packages/core/component/AI/component/tool/BashCodeExecution.tsx
index e93744a159..e464ccd20b 100644
--- a/js/app/packages/core/component/AI/component/tool/BashCodeExecution.tsx
+++ b/js/app/packages/core/component/AI/component/tool/BashCodeExecution.tsx
@@ -92,7 +92,7 @@ function BashResult(props: { result: BashCodeExecutionResult }) {
}
const handler = createToolRenderer({
- name: 'bash_code_execution',
+ name: 'BashCodeExecution',
render: (ctx) => {
const [isExpanded, setIsExpanded] = createSignal(false);
@@ -104,7 +104,7 @@ const handler = createToolRenderer({
response={
isExpanded() ? (
<div class="flex flex-col gap-2">
- <CodeFence content={ctx.tool.data.command} collapsible={false} />
+ <CodeFence content={ctx.tool.data.input} collapsible={false} />
<Show when={ctx.response}>
{(response) => {
const isError =
diff --git a/js/app/packages/core/component/AI/component/tool/TextEditorCodeExecution.tsx b/js/app/packages/core/component/AI/component/tool/TextEditorCodeExecution.tsx
index 18fe7864a3..6326aee11a 100644
--- a/js/app/packages/core/component/AI/component/tool/TextEditorCodeExecution.tsx
+++ b/js/app/packages/core/component/AI/component/tool/TextEditorCodeExecution.tsx
@@ -152,14 +152,10 @@ function InlineTextEditorResult(props: {
}
const handler = createToolRenderer({
- name: 'text_editor_code_execution',
- handleCall: async (ctx) => {
- if (ctx.tool.data.command === 'create' && ctx.tool.data.file_text) {
- toolFileDataMap[ctx.tool.id] = {
- path: ctx.tool.data.path,
- fileText: ctx.tool.data.file_text,
- };
- }
+ name: 'TextEditorCodeExecution',
+ handleCall: async (_ctx) => {
+ // The new tool shape has a single `input` string field;
+ // file-creation side effects are no longer possible from the call data alone.
},
handleResponse: async (ctx) => {
const { content } = ctx.tool.data;
diff --git a/js/app/packages/core/component/AI/component/tool/WebFetch.tsx b/js/app/packages/core/component/AI/component/tool/WebFetch.tsx
index 0aa3a4c22b..04a83face6 100644
--- a/js/app/packages/core/component/AI/component/tool/WebFetch.tsx
+++ b/js/app/packages/core/component/AI/component/tool/WebFetch.tsx
@@ -4,17 +4,17 @@ import { createToolRenderer } from './ToolRenderer';
// Runtime type for successful web fetch (schema differs from generated types)
const handler = createToolRenderer({
- name: 'web_fetch',
+ name: 'WebFetch',
render: (ctx) => (
<BaseTool icon={Globe} renderContext={ctx.renderContext} type="call">
Fetched{' '}
<a
- href={ctx.tool.data.url}
+ href={ctx.tool.data.input}
target="_blank"
rel="noopener noreferrer"
class="italic text-accent hover:underline"
>
- {ctx.tool.data.url}
+ {ctx.tool.data.input}
</a>
</BaseTool>
),
diff --git a/js/app/packages/core/component/AI/component/tool/WebSearch.tsx b/js/app/packages/core/component/AI/component/tool/WebSearch.tsx
index 75c45b84a9..bccd9c5757 100644
--- a/js/app/packages/core/component/AI/component/tool/WebSearch.tsx
+++ b/js/app/packages/core/component/AI/component/tool/WebSearch.tsx
@@ -6,10 +6,13 @@ import { BaseTool } from './BaseTool';
import { createToolRenderer } from './ToolRenderer';
const handler = createToolRenderer({
- name: 'web_search',
+ name: 'WebSearch',
render: (ctx) => {
const [isExpanded, setIsExpanded] = createSignal(false);
- const results = () => ctx.response?.data.content ?? [];
+ const results = () => {
+ const content = ctx.response?.data.content;
+ return Array.isArray(content) ? content : [];
+ };
const hitCount = () => results().length;
const hasResults = () => hitCount() > 0;
const statusText = () => {
@@ -45,7 +48,7 @@ const handler = createToolRenderer({
<div class="flex min-w-0 flex-1 items-center gap-2">
<span>
Searched for{' '}
- <span class="text-accent">{ctx.tool.data.query}</span>
+ <span class="text-accent">{ctx.tool.data.input}</span>
</span>
</div>
<div class="flex shrink-0 items-center gap-1">
diff --git a/js/app/packages/core/component/AI/component/tool/handler.tsx b/js/app/packages/core/component/AI/component/tool/handler.tsx
index 988912ae4c..ebf9702bd6 100644
--- a/js/app/packages/core/component/AI/component/tool/handler.tsx
+++ b/js/app/packages/core/component/AI/component/tool/handler.tsx
@@ -54,7 +54,7 @@ const toolHandlers: ToolHandlerMap<RenderContext> = {
ListTeamMembers: listTeamMembersHandler,
MarkNotificationsDone: markNotificationsDoneHandler,
MarkNotificationsSeen: markNotificationsSeenHandler,
- bash_code_execution: bashCodeExecutionHandler,
+ BashCodeExecution: bashCodeExecutionHandler,
ContentSearch: contentSearchHandler,
CreateDocument: createDocumentHandler,
GetThread: getThreadHandler,
@@ -70,10 +70,10 @@ const toolHandlers: ToolHandlerMap<RenderContext> = {
SendEmail: sendEmailHandler,
SetEntityProperty: setEntityPropertyHandler,
Subagent: subagentHandler,
- text_editor_code_execution: textEditorCodeExecutionHandler,
+ TextEditorCodeExecution: textEditorCodeExecutionHandler,
UpdateThreadLabels: updateThreadLabelsHandler,
- web_fetch: webFetchHandler,
- web_search: webSearchHandler,
+ WebFetch: webFetchHandler,
+ WebSearch: webSearchHandler,
};
type ToolProps = {
diff --git a/js/app/packages/core/component/AI/constant/model.ts b/js/app/packages/core/component/AI/constant/model.ts
index c5d3625126..7317c3b97f 100644
--- a/js/app/packages/core/component/AI/constant/model.ts
+++ b/js/app/packages/core/component/AI/constant/model.ts
@@ -1,29 +1,28 @@
import AnthropicIcon from '@core/component/AI/assets/anthropic.svg';
-import type { Model } from '@core/component/AI/types';
-
-// import GoogleLogo from '@phosphor-icons/core/bold/google-logo-bold.svg?component-solid';
-// import OpenAiLogoIcon from '@phosphor-icons/core/regular/open-ai-logo.svg?component-solid';
+import type { TModel } from '@core/component/AI/types';
export { Model } from '@core/component/AI/types';
type ExhaustiveMap = {
- [K in Model]: any;
+ [K in TModel]: any;
};
-// export const MODEL_DESCRIPTION: ExhaustiveMap = {
-// 'anthropic/claude-sonnet-4': 'The best general purpose model from Anthropic',
-// } as const;
-
export const MODEL_PRETTYNAME: ExhaustiveMap = {
- 'claude-opus-4-6': 'Claude Opus 4.6',
- 'claude-haiku-4-5': 'Claude Haiku 4.5',
+ smart: 'Smart',
+ fast: 'Fast',
+ opus4_7: 'Opus 4.7',
+ sonnet4_6: 'Sonnet 4.6',
+ haiku4_5: 'Haiku 4.5',
+ retired: 'Retired',
} as const;
export const MODEL_PROVIDER_ICON: ExhaustiveMap = {
- 'claude-haiku-4-5': AnthropicIcon,
- 'claude-opus-4-6': AnthropicIcon,
+ smart: AnthropicIcon,
+ fast: AnthropicIcon,
+ opus4_7: AnthropicIcon,
+ sonnet4_6: AnthropicIcon,
+ haiku4_5: AnthropicIcon,
+ retired: AnthropicIcon,
};
-const _SMART_MODE_MODEL: Model = 'claude-opus-4-6';
-
-export const DEFAULT_MODEL: Model = 'claude-opus-4-6';
+export const DEFAULT_MODEL: TModel = 'smart';
diff --git a/js/app/packages/core/component/AI/types/index.ts b/js/app/packages/core/component/AI/types/index.ts
index 074554a0d0..15e7c66292 100644
--- a/js/app/packages/core/component/AI/types/index.ts
+++ b/js/app/packages/core/component/AI/types/index.ts
@@ -1,8 +1,8 @@
export type {
+ AgentModel as TModel,
AssistantMessagePart,
FileType,
- Model as TModel,
ToolSet,
} from '@service-cognition/generated/schemas';
-export { Model } from '@service-cognition/generated/schemas';
+export { AgentModel as Model } from '@service-cognition/generated/schemas';
export * from './attachment';
diff --git a/js/app/packages/core/component/AI/util/parse.ts b/js/app/packages/core/component/AI/util/parse.ts
index bbdab234a0..f6a8280b9a 100644
--- a/js/app/packages/core/component/AI/util/parse.ts
+++ b/js/app/packages/core/component/AI/util/parse.ts
@@ -1,15 +1,11 @@
-import { ModelEnum } from '@service-cognition/generated/schemas';
-import type { Model } from '../types';
+import { AgentModel } from '@service-cognition/generated/schemas';
+import type { TModel } from '../types';
-/**
- * Parses a Model type from a string.
- * Returns undefined if unable to parse
- */
export const parseModel = (
value: string | null | undefined
-): Model | undefined => {
+): TModel | undefined => {
if (!value) return undefined;
- const result = ModelEnum.safeParse(value);
- if (result.success) return result.data;
+ const values = Object.values(AgentModel) as string[];
+ if (values.includes(value)) return value as TModel;
return undefined;
};
diff --git a/js/app/packages/service-clients/service-cognition/generated/client.ts b/js/app/packages/service-clients/service-cognition/generated/client.ts
index 20bfd20e99..e8b67cc0bd 100644
--- a/js/app/packages/service-clients/service-cognition/generated/client.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/client.ts
@@ -20,7 +20,6 @@ import type {
GetChatPermissionsResponse,
GetChatResponse,
GetChatsForAttachmentResponse,
- GetModelsResponse,
HttpSendChatMessageRequest,
McpAuthCallbackParams,
MemoryErrorBody,
@@ -1419,42 +1418,6 @@ export const getMemoryHandler = async (
} as getMemoryHandlerResponse;
};
-/**
- * @summary Gets all available models
- */
-export type getModelsHandlerResponse200 = {
- data: GetModelsResponse;
- status: 200;
-};
-
-export type getModelsHandlerResponseSuccess = getModelsHandlerResponse200 & {
- headers: Headers;
-};
-
-export type getModelsHandlerResponse = getModelsHandlerResponseSuccess;
-
-export const getGetModelsHandlerUrl = () => {
- return `/models`;
-};
-
-export const getModelsHandler = async (
- options?: RequestInit
-): Promise<getModelsHandlerResponse> => {
- const res = await fetch(getGetModelsHandlerUrl(), {
- ...options,
- method: 'GET',
- });
-
- const body = [204, 205, 304].includes(res.status) ? null : await res.text();
-
- const data: getModelsHandlerResponse['data'] = body ? JSON.parse(body) : {};
- return {
- data,
- status: res.status,
- headers: res.headers,
- } as getModelsHandlerResponse;
-};
-
export type getBatchPreviewResponse200 = {
data: GetBatchPreviewResponse;
status: 200;
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/aIModel.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/aIModel.ts
deleted file mode 100644
index d4c03d9c74..0000000000
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/aIModel.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Generated by orval v7.21.0 🍺
- * Do not edit manually.
- * Document Cognition Service
- * OpenAPI spec version: 1.0.0
- */
-import type { ModelMetadata } from './modelMetadata';
-import type { Provider } from './provider';
-
-export interface AIModel {
- metadata: ModelMetadata;
- name: string;
- provider: Provider;
-}
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/agentModel.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/agentModel.ts
new file mode 100644
index 0000000000..05502a6954
--- /dev/null
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/agentModel.ts
@@ -0,0 +1,25 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * Document Cognition Service
+ * OpenAPI spec version: 1.0.0
+ */
+
+/**
+ * Model to use for completions.
+
+Unrecognized model strings (including retired Google/OpenAI variants
+from older data) deserialize to `Retired` via the manual
+`Deserialize` impl.
+ */
+export type AgentModel = (typeof AgentModel)[keyof typeof AgentModel];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const AgentModel = {
+ smart: 'smart',
+ fast: 'fast',
+ opus4_7: 'opus4_7',
+ sonnet4_6: 'sonnet4_6',
+ haiku4_5: 'haiku4_5',
+ retired: 'retired',
+} as const;
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePart.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePart.ts
index c510f7a52b..b053358cf8 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePart.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePart.ts
@@ -10,6 +10,13 @@ import type { AssistantMessagePartOneOfFive } from './assistantMessagePartOneOfF
import type { AssistantMessagePartOneOfOnezero } from './assistantMessagePartOneOfOnezero';
import type { AssistantMessagePartOneOfThree } from './assistantMessagePartOneOfThree';
+/**
+ * A structured part within an assistant message.
+
+When the model responds with tool calls the full turn is persisted as a
+flat sequence of these parts. [`crate::convert::to_rig_messages`]
+reconstructs the turn boundaries that providers expect.
+ */
export type AssistantMessagePart =
| AssistantMessagePartOneOf
| AssistantMessagePartOneOfThree
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOf.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOf.ts
index fa6e8a295e..3de9e15bc4 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOf.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOf.ts
@@ -6,7 +6,11 @@
*/
import type { AssistantMessagePartOneOfType } from './assistantMessagePartOneOfType';
+/**
+ * Plain text produced by the model.
+ */
export type AssistantMessagePartOneOf = {
+ /** The text content. */
text: string;
type: AssistantMessagePartOneOfType;
};
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfEight.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfEight.ts
index 914e1bf7f2..345235c0d3 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfEight.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfEight.ts
@@ -6,9 +6,15 @@
*/
import type { AssistantMessagePartOneOfEightType } from './assistantMessagePartOneOfEightType';
+/**
+ * A JSON response from a tool call.
+ */
export type AssistantMessagePartOneOfEight = {
+ /** Corresponding call id. */
id: string;
+ /** Response payload. */
json: unknown;
+ /** Tool name. */
name: string;
type: AssistantMessagePartOneOfEightType;
};
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfFive.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfFive.ts
index 1cd4acd0b3..e0a816fad0 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfFive.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfFive.ts
@@ -7,14 +7,19 @@
import type { AssistantMessagePartOneOfFiveDisplayName } from './assistantMessagePartOneOfFiveDisplayName';
import type { AssistantMessagePartOneOfFiveType } from './assistantMessagePartOneOfFiveType';
+/**
+ * A tool call routed through an MCP service.
+ */
export type AssistantMessagePartOneOfFive = {
- /** Human-readable title from the MCP server, if provided */
+ /** Optional human-readable name. */
display_name?: AssistantMessagePartOneOfFiveDisplayName;
+ /** Provider-assigned call id. */
id: string;
+ /** Tool arguments as JSON. */
json: unknown;
- /** Demangled tool name from the MCP server */
+ /** Tool name. */
name: string;
- /** MCP server name */
+ /** MCP service identifier. */
service: string;
type: AssistantMessagePartOneOfFiveType;
};
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfFiveDisplayName.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfFiveDisplayName.ts
index 1d15ac9549..567acbb817 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfFiveDisplayName.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfFiveDisplayName.ts
@@ -6,6 +6,6 @@
*/
/**
- * Human-readable title from the MCP server, if provided
+ * Optional human-readable name.
*/
export type AssistantMessagePartOneOfFiveDisplayName = string | null;
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfOnezero.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfOnezero.ts
index 6ac731fe41..5d65867435 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfOnezero.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfOnezero.ts
@@ -6,9 +6,15 @@
*/
import type { AssistantMessagePartOneOfOnezeroType } from './assistantMessagePartOneOfOnezeroType';
+/**
+ * An error response from a tool call.
+ */
export type AssistantMessagePartOneOfOnezero = {
+ /** Human-readable error description. */
description: string;
+ /** Corresponding call id. */
id: string;
+ /** Tool name. */
name: string;
type: AssistantMessagePartOneOfOnezeroType;
};
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfThree.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfThree.ts
index 2d8c98a135..bc058da747 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfThree.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/assistantMessagePartOneOfThree.ts
@@ -6,9 +6,15 @@
*/
import type { AssistantMessagePartOneOfThreeType } from './assistantMessagePartOneOfThreeType';
+/**
+ * A native tool call issued by the model.
+ */
export type AssistantMessagePartOneOfThree = {
+ /** Provider-assigned call id. */
id: string;
+ /** Tool arguments as JSON. */
json: unknown;
+ /** Tool name. */
name: string;
type: AssistantMessagePartOneOfThreeType;
};
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/chatMessageContent.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/chatMessageContent.ts
index 3558253922..0ee16a4ed9 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/chatMessageContent.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/chatMessageContent.ts
@@ -6,4 +6,11 @@
*/
import type { AssistantMessagePart } from './assistantMessagePart';
+/**
+ * The content of a [`ChatMessage`].
+
+For user and system messages the content is plain [`Text`](Self::Text).
+For assistant messages it may additionally be a sequence of
+[`AssistantMessagePart`]s that encode tool-call round trips.
+ */
export type ChatMessageContent = string | AssistantMessagePart[];
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/chatResponseModel.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/chatResponseModel.ts
index 7e3005b032..598646b4a7 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/chatResponseModel.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/chatResponseModel.ts
@@ -4,6 +4,6 @@
* Document Cognition Service
* OpenAPI spec version: 1.0.0
*/
-import type { Model } from './model';
+import type { AgentModel } from './agentModel';
-export type ChatResponseModel = null | Model;
+export type ChatResponseModel = null | AgentModel;
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/chatStreamOneOfOnefour.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/chatStreamOneOfOnefour.ts
index ec7099665b..105c5e7138 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/chatStreamOneOfOnefour.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/chatStreamOneOfOnefour.ts
@@ -4,16 +4,15 @@
* Document Cognition Service
* OpenAPI spec version: 1.0.0
*/
-
+import type { AgentModel } from './agentModel';
import type { ChatStreamOneOfOnefourNewModel } from './chatStreamOneOfOnefourNewModel';
import type { ChatStreamOneOfOnefourType } from './chatStreamOneOfOnefourType';
-import type { Model } from './model';
/**
* Notifies the client that the available models have changed
*/
export type ChatStreamOneOfOnefour = {
- available_models: Model[];
+ available_models: AgentModel[];
chat_id: string;
new_model?: ChatStreamOneOfOnefourNewModel;
type: ChatStreamOneOfOnefourType;
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/chatStreamOneOfOnefourNewModel.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/chatStreamOneOfOnefourNewModel.ts
index f2814f3a82..062d47029d 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/chatStreamOneOfOnefourNewModel.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/chatStreamOneOfOnefourNewModel.ts
@@ -4,6 +4,6 @@
* Document Cognition Service
* OpenAPI spec version: 1.0.0
*/
-import type { Model } from './model';
+import type { AgentModel } from './agentModel';
-export type ChatStreamOneOfOnefourNewModel = null | Model;
+export type ChatStreamOneOfOnefourNewModel = null | AgentModel;
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/dynamicSchema.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/dynamicSchema.ts
index 1ec8022d11..709cab9281 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/dynamicSchema.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/dynamicSchema.ts
@@ -6,8 +6,14 @@
*/
import type { DynamicSchemaDescription } from './dynamicSchemaDescription';
+/**
+ * Schema definition for dynamic structured completions.
+ */
export interface DynamicSchema {
+ /** Optional description of what the schema represents. */
description?: DynamicSchemaDescription;
+ /** Name of the schema. */
name: string;
+ /** The JSON schema to validate against. */
schema: unknown;
}
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/dynamicSchemaDescription.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/dynamicSchemaDescription.ts
index 0db1eb44f7..95d2e51f62 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/dynamicSchemaDescription.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/dynamicSchemaDescription.ts
@@ -5,4 +5,7 @@
* OpenAPI spec version: 1.0.0
*/
+/**
+ * Optional description of what the schema represents.
+ */
export type DynamicSchemaDescription = string | null;
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/getModelsResponse.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/getModelsResponse.ts
deleted file mode 100644
index 971b350b7f..0000000000
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/getModelsResponse.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * Generated by orval v7.21.0 🍺
- * Do not edit manually.
- * Document Cognition Service
- * OpenAPI spec version: 1.0.0
- */
-import type { AIModel } from './aIModel';
-
-export interface GetModelsResponse {
- models: AIModel[];
-}
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/httpSendChatMessageRequest.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/httpSendChatMessageRequest.ts
index 2aa9ab02b4..5b8ebc8691 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/httpSendChatMessageRequest.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/httpSendChatMessageRequest.ts
@@ -4,10 +4,11 @@
* Document Cognition Service
* OpenAPI spec version: 1.0.0
*/
+
+import type { AgentModel } from './agentModel';
import type { HttpSendChatMessageRequestAdditionalInstructions } from './httpSendChatMessageRequestAdditionalInstructions';
import type { HttpSendChatMessageRequestAttachments } from './httpSendChatMessageRequestAttachments';
import type { HttpSendChatMessageRequestChatId } from './httpSendChatMessageRequestChatId';
-import type { Model } from './model';
import type { ToolSet } from './toolSet';
/**
@@ -24,7 +25,7 @@ export interface HttpSendChatMessageRequest {
/** The content of the message */
content: string;
/** The model to respond with */
- model: Model;
+ model: AgentModel;
/** Which toolset to use. Defaults to `all` */
toolset?: ToolSet;
}
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/index.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/index.ts
index 5b81949174..3659c165c9 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/index.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/index.ts
@@ -7,7 +7,7 @@
export * from './accessLevel';
export * from './addServerRequest';
-export * from './aIModel';
+export * from './agentModel';
export * from './assistantMessagePart';
export * from './assistantMessagePartOneOf';
export * from './assistantMessagePartOneOfEight';
@@ -135,7 +135,6 @@ export * from './getChatPermissionsResponse';
export * from './getChatResponse';
export * from './getChatsForAttachmentResponse';
export * from './getChatsForAttachmentResponseRecentChat';
-export * from './getModelsResponse';
export * from './httpSendChatMessageRequest';
export * from './httpSendChatMessageRequestAdditionalInstructions';
export * from './httpSendChatMessageRequestAttachments';
@@ -145,8 +144,6 @@ export * from './mcpAuthCallbackParams';
export * from './memoryErrorBody';
export * from './memoryResponse';
export * from './messageWithAttachments';
-export * from './model';
-export * from './modelMetadata';
export * from './newAttachment';
export * from './newChatMessage';
export * from './newChatMessageAttachments';
@@ -156,7 +153,6 @@ export * from './patchChatRequest';
export * from './patchChatRequestName';
export * from './patchChatRequestProjectId';
export * from './patchChatRequestSharePermission';
-export * from './provider';
export * from './rejectToolCallRequest';
export * from './role';
export * from './sendChatMessagePayload';
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/model.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/model.ts
index df58b3cf9f..22efba2f13 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/model.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/model.ts
@@ -7,13 +7,13 @@ import { z } from 'zod';
export type Model = (typeof Model)[keyof typeof Model];
export const Model = {
+ 'claude-opus-4-7': 'claude-opus-4-7',
'claude-haiku-4-5': 'claude-haiku-4-5',
- 'claude-opus-4-6': 'claude-opus-4-6',
} as const;
export const AllModels: Model[] = [
+ 'claude-opus-4-7',
'claude-haiku-4-5',
- 'claude-opus-4-6',
] as const;
const values: [Model, ...Model[]] = [
Object.values(Model)[0],
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/modelMetadata.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/modelMetadata.ts
deleted file mode 100644
index fcb48a9299..0000000000
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/modelMetadata.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * Generated by orval v7.21.0 🍺
- * Do not edit manually.
- * Document Cognition Service
- * OpenAPI spec version: 1.0.0
- */
-
-export interface ModelMetadata {
- contextWindow: number;
-}
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/newChatMessage.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/newChatMessage.ts
index 6f135c4d25..6597c2d5dd 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/newChatMessage.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/newChatMessage.ts
@@ -5,8 +5,8 @@
* OpenAPI spec version: 1.0.0
*/
+import type { AgentModel } from './agentModel';
import type { ChatMessageContent } from './chatMessageContent';
-import type { Model } from './model';
import type { NewChatMessageAttachments } from './newChatMessageAttachments';
import type { NewChatMessageId } from './newChatMessageId';
import type { Role } from './role';
@@ -20,7 +20,7 @@ export interface NewChatMessage {
/** Optional pre-generated ID. If None, the database generates one. */
id?: NewChatMessageId;
/** The model used to generate the chat */
- model: Model;
+ model: AgentModel;
/** Whether the chat is from the user or system */
role: Role;
updatedAt: string;
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/provider.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/provider.ts
deleted file mode 100644
index 424e6d0499..0000000000
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/provider.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * Generated by orval v7.21.0 🍺
- * Do not edit manually.
- * Document Cognition Service
- * OpenAPI spec version: 1.0.0
- */
-
-export type Provider = (typeof Provider)[keyof typeof Provider];
-
-// eslint-disable-next-line @typescript-eslint/no-redeclare
-export const Provider = {
- openai: 'openai',
- google: 'google',
- anthropic: 'anthropic',
- googleanthropic: 'googleanthropic',
- xai: 'xai',
-} as const;
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/role.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/role.ts
index 0eefad0643..003732b31f 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/role.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/role.ts
@@ -5,6 +5,9 @@
* OpenAPI spec version: 1.0.0
*/
+/**
+ * The role of a message participant.
+ */
export type Role = (typeof Role)[keyof typeof Role];
// eslint-disable-next-line @typescript-eslint/no-redeclare
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/sendChatMessagePayloadAllOf.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/sendChatMessagePayloadAllOf.ts
index ffe401b91e..4e67dfdc62 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/sendChatMessagePayloadAllOf.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/sendChatMessagePayloadAllOf.ts
@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0
*/
-import type { Model } from './model';
+import type { AgentModel } from './agentModel';
import type { SendChatMessagePayloadAllOfAdditionalInstructions } from './sendChatMessagePayloadAllOfAdditionalInstructions';
import type { SendChatMessagePayloadAllOfAttachments } from './sendChatMessagePayloadAllOfAttachments';
import type { ToolSet } from './toolSet';
@@ -20,7 +20,7 @@ export type SendChatMessagePayloadAllOf = {
/** The content of the message */
content: string;
/** the chate model to respond with */
- model: Model;
+ model: AgentModel;
/** Stream ID for tracking the response */
stream_id: string;
/** Which toolset to use. Defaults to `all` */
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/streamErrorOneOf.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/streamErrorOneOf.ts
index f6dd8f44e9..5df3a9a957 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/streamErrorOneOf.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/streamErrorOneOf.ts
@@ -4,11 +4,11 @@
* Document Cognition Service
* OpenAPI spec version: 1.0.0
*/
-import type { Model } from './model';
+import type { AgentModel } from './agentModel';
import type { StreamErrorOneOfStreamError } from './streamErrorOneOfStreamError';
export type StreamErrorOneOf = {
- model: Model;
+ model: AgentModel;
stream_error: StreamErrorOneOfStreamError;
stream_id: string;
};
diff --git a/js/app/packages/service-clients/service-cognition/generated/schemas/structuredCompletionRequest.ts b/js/app/packages/service-clients/service-cognition/generated/schemas/structuredCompletionRequest.ts
index f8039a6053..7d3e7056f4 100644
--- a/js/app/packages/service-clients/service-cognition/generated/schemas/structuredCompletionRequest.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/schemas/structuredCompletionRequest.ts
@@ -5,14 +5,14 @@
* OpenAPI spec version: 1.0.0
*/
+import type { AgentModel } from './agentModel';
import type { DynamicSchema } from './dynamicSchema';
-import type { Model } from './model';
import type { StructuredCompletionRequestAdditionalInstructions } from './structuredCompletionRequestAdditionalInstructions';
import type { ToolSet } from './toolSet';
export interface StructuredCompletionRequest {
additional_instructions?: StructuredCompletionRequestAdditionalInstructions;
- model: Model;
+ model: AgentModel;
output_schema: DynamicSchema;
prompt: string;
toolset?: ToolSet;
diff --git a/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts b/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts
index 059d09fcfe..3b843ad242 100644
--- a/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/tools/schemas.ts
@@ -3,6 +3,74 @@
*/
import { z } from 'zod/v3';
+export const BashCodeExecution = z.object({ input: z.string() });
+
+export const BashCodeExecutionResponse = z.object({
+ content: z.any().superRefine((x, ctx) => {
+ const schemas = [
+ z.intersection(
+ z.object({
+ content: z
+ .union([z.array(z.object({ file_id: z.string() })), z.null()])
+ .optional(),
+ return_code: z.number().int(),
+ stderr: z.string(),
+ stdout: z.string(),
+ }),
+ z.object({ type: z.literal('bash_code_execution_result') })
+ ),
+ z.intersection(
+ z.object({
+ error_code: z.any().superRefine((x, ctx) => {
+ const schemas = [
+ z.literal('unavailable'),
+ z.literal('execution_time_exceeded'),
+ z.literal('container_expired'),
+ z.literal('invalid_input'),
+ z.literal('too_many_requests'),
+ z.literal('file_not_found'),
+ z.literal('string_not_found'),
+ ];
+ const errors = schemas.reduce<z.ZodError[]>(
+ (errors, schema) =>
+ ((result) =>
+ result.error ? [...errors, result.error] : errors)(
+ schema.safeParse(x)
+ ),
+ []
+ );
+ if (schemas.length - errors.length !== 1) {
+ ctx.addIssue({
+ path: ctx.path,
+ code: 'invalid_union',
+ unionErrors: errors,
+ message: 'Invalid input: Should pass single schema',
+ });
+ }
+ }),
+ }),
+ z.object({ type: z.literal('bash_code_execution_tool_result_error') })
+ ),
+ ];
+ const errors = schemas.reduce<z.ZodError[]>(
+ (errors, schema) =>
+ ((result) => (result.error ? [...errors, result.error] : errors))(
+ schema.safeParse(x)
+ ),
+ []
+ );
+ if (schemas.length - errors.length !== 1) {
+ ctx.addIssue({
+ path: ctx.path,
+ code: 'invalid_union',
+ unionErrors: errors,
+ message: 'Invalid input: Should pass single schema',
+ });
+ }
+ }),
+ tool_use_id: z.string(),
+});
+
export const ContentSearch = z.object({
entityTypes: z
.array(
@@ -1789,147 +1857,62 @@ export const Subagent = z.object({ task: z.string() });
export const SubagentResponse = z.object({ result: z.string() });
-export const UpdateThreadLabels = z.object({
- add: z.boolean(),
- label_id: z.string().uuid(),
- thread_id: z.string().uuid(),
-});
-
-export const UpdateThreadLabelsResponse = z.object({
- failedCount: z.number().int().gte(0),
- successfulCount: z.number().int().gte(0),
- summary: z.string(),
-});
+export const TextEditorCodeExecution = z.object({ input: z.string() });
-export const WebSearchToolCall = z.object({ query: z.string() });
-
-export const WebSearchResponse = z.object({
- content: z.array(
- z.object({
- title: z.string(),
- type: z.literal('web_search_result'),
- url: z.string(),
- })
- ),
- tool_use_id: z.string(),
-});
-
-export const WebFetchToolCall = z.object({ url: z.string() });
-
-export const WebFetchResponse = z.object({
+export const TextEditorCodeExecutionResponse = z.object({
content: z.any().superRefine((x, ctx) => {
const schemas = [
z.intersection(
z.object({
- content: z.object({
- citations: z
- .union([z.object({ enabled: z.boolean() }), z.null()])
- .optional(),
- source: z.any().superRefine((x, ctx) => {
- const schemas = [
- z.object({
- data: z.string(),
- media_type: z.string(),
- type: z.literal('text'),
- }),
- z.object({
- data: z.string(),
- media_type: z.string(),
- type: z.literal('base64'),
- }),
- ];
- const errors = schemas.reduce<z.ZodError[]>(
- (errors, schema) =>
- ((result) =>
- result.error ? [...errors, result.error] : errors)(
- schema.safeParse(x)
- ),
- []
- );
- if (schemas.length - errors.length !== 1) {
- ctx.addIssue({
- path: ctx.path,
- code: 'invalid_union',
- unionErrors: errors,
- message: 'Invalid input: Should pass single schema',
- });
- }
- }),
- title: z.union([z.string(), z.null()]).optional(),
- }),
- retrieved_at: z.string(),
- url: z.string(),
+ content: z.union([z.string(), z.null()]).optional(),
+ file_type: z.union([z.string(), z.null()]).optional(),
+ is_file_update: z.union([z.boolean(), z.null()]).optional(),
+ lines: z.union([z.array(z.string()), z.null()]).optional(),
+ newLines: z.union([z.number().int().gte(0), z.null()]).optional(),
+ newStart: z.union([z.number().int().gte(0), z.null()]).optional(),
+ numLines: z.union([z.number().int().gte(0), z.null()]).optional(),
+ oldLines: z.union([z.number().int().gte(0), z.null()]).optional(),
+ oldStart: z.union([z.number().int().gte(0), z.null()]).optional(),
+ startLine: z.union([z.number().int().gte(0), z.null()]).optional(),
+ totalLines: z.union([z.number().int().gte(0), z.null()]).optional(),
}),
- z.object({ type: z.literal('web_fetch_result') })
+ z.object({ type: z.literal('text_editor_code_execution_view_result') })
),
z.intersection(
z.object({
- error_code: z.any().superRefine((x, ctx) => {
- const schemas = [
- z.literal('invalid_input'),
- z.literal('url_too_long'),
- z.literal('url_not_allowed'),
- z.literal('url_not_accessible'),
- z.literal('too_many_requests'),
- z.literal('unsupported_content_type'),
- z.literal('max_uses_exceeded'),
- z.literal('unavailable'),
- ];
- const errors = schemas.reduce<z.ZodError[]>(
- (errors, schema) =>
- ((result) =>
- result.error ? [...errors, result.error] : errors)(
- schema.safeParse(x)
- ),
- []
- );
- if (schemas.length - errors.length !== 1) {
- ctx.addIssue({
- path: ctx.path,
- code: 'invalid_union',
- unionErrors: errors,
- message: 'Invalid input: Should pass single schema',
- });
- }
- }),
+ content: z.union([z.string(), z.null()]).optional(),
+ file_type: z.union([z.string(), z.null()]).optional(),
+ is_file_update: z.union([z.boolean(), z.null()]).optional(),
+ lines: z.union([z.array(z.string()), z.null()]).optional(),
+ newLines: z.union([z.number().int().gte(0), z.null()]).optional(),
+ newStart: z.union([z.number().int().gte(0), z.null()]).optional(),
+ numLines: z.union([z.number().int().gte(0), z.null()]).optional(),
+ oldLines: z.union([z.number().int().gte(0), z.null()]).optional(),
+ oldStart: z.union([z.number().int().gte(0), z.null()]).optional(),
+ startLine: z.union([z.number().int().gte(0), z.null()]).optional(),
+ totalLines: z.union([z.number().int().gte(0), z.null()]).optional(),
}),
- z.object({ type: z.literal('web_fetch_tool_result_error') })
+ z.object({
+ type: z.literal('text_editor_code_execution_create_result'),
+ })
),
- ];
- const errors = schemas.reduce<z.ZodError[]>(
- (errors, schema) =>
- ((result) => (result.error ? [...errors, result.error] : errors))(
- schema.safeParse(x)
- ),
- []
- );
- if (schemas.length - errors.length !== 1) {
- ctx.addIssue({
- path: ctx.path,
- code: 'invalid_union',
- unionErrors: errors,
- message: 'Invalid input: Should pass single schema',
- });
- }
- }),
- tool_use_id: z.string(),
-});
-
-export const BashCodeExecutionToolCall = z.object({ command: z.string() });
-
-export const BashCodeExecutionResponse = z.object({
- content: z.any().superRefine((x, ctx) => {
- const schemas = [
z.intersection(
z.object({
- content: z
- .union([z.array(z.object({ file_id: z.string() })), z.null()])
- .optional(),
- return_code: z.number().int(),
- stderr: z.string(),
- stdout: z.string(),
+ content: z.union([z.string(), z.null()]).optional(),
+ file_type: z.union([z.string(), z.null()]).optional(),
+ is_file_update: z.union([z.boolean(), z.null()]).optional(),
+ lines: z.union([z.array(z.string()), z.null()]).optional(),
+ newLines: z.union([z.number().int().gte(0), z.null()]).optional(),
+ newStart: z.union([z.number().int().gte(0), z.null()]).optional(),
+ numLines: z.union([z.number().int().gte(0), z.null()]).optional(),
+ oldLines: z.union([z.number().int().gte(0), z.null()]).optional(),
+ oldStart: z.union([z.number().int().gte(0), z.null()]).optional(),
+ startLine: z.union([z.number().int().gte(0), z.null()]).optional(),
+ totalLines: z.union([z.number().int().gte(0), z.null()]).optional(),
}),
- z.object({ type: z.literal('bash_code_execution_result') })
+ z.object({
+ type: z.literal('text_editor_code_execution_str_replace_result'),
+ })
),
z.intersection(
z.object({
@@ -1961,7 +1944,9 @@ export const BashCodeExecutionResponse = z.object({
}
}),
}),
- z.object({ type: z.literal('bash_code_execution_tool_result_error') })
+ z.object({
+ type: z.literal('text_editor_code_execution_tool_result_error'),
+ })
),
];
const errors = schemas.reduce<z.ZodError[]>(
@@ -1983,80 +1968,78 @@ export const BashCodeExecutionResponse = z.object({
tool_use_id: z.string(),
});
-export const TextEditorCodeExecutionToolCall = z.object({
- command: z.string(),
- file_text: z.union([z.string(), z.null()]).optional(),
- new_str: z.union([z.string(), z.null()]).optional(),
- old_str: z.union([z.string(), z.null()]).optional(),
- path: z.string(),
+export const UpdateThreadLabels = z.object({
+ add: z.boolean(),
+ label_id: z.string().uuid(),
+ thread_id: z.string().uuid(),
+});
+
+export const UpdateThreadLabelsResponse = z.object({
+ failedCount: z.number().int().gte(0),
+ successfulCount: z.number().int().gte(0),
+ summary: z.string(),
});
-export const TextEditorCodeExecutionResponse = z.object({
+export const WebFetch = z.object({ input: z.string() });
+
+export const WebFetchResponse = z.object({
content: z.any().superRefine((x, ctx) => {
const schemas = [
z.intersection(
z.object({
- content: z.union([z.string(), z.null()]).optional(),
- file_type: z.union([z.string(), z.null()]).optional(),
- is_file_update: z.union([z.boolean(), z.null()]).optional(),
- lines: z.union([z.array(z.string()), z.null()]).optional(),
- newLines: z.union([z.number().int().gte(0), z.null()]).optional(),
- newStart: z.union([z.number().int().gte(0), z.null()]).optional(),
- numLines: z.union([z.number().int().gte(0), z.null()]).optional(),
- oldLines: z.union([z.number().int().gte(0), z.null()]).optional(),
- oldStart: z.union([z.number().int().gte(0), z.null()]).optional(),
- startLine: z.union([z.number().int().gte(0), z.null()]).optional(),
- totalLines: z.union([z.number().int().gte(0), z.null()]).optional(),
- }),
- z.object({ type: z.literal('text_editor_code_execution_view_result') })
- ),
- z.intersection(
- z.object({
- content: z.union([z.string(), z.null()]).optional(),
- file_type: z.union([z.string(), z.null()]).optional(),
- is_file_update: z.union([z.boolean(), z.null()]).optional(),
- lines: z.union([z.array(z.string()), z.null()]).optional(),
- newLines: z.union([z.number().int().gte(0), z.null()]).optional(),
- newStart: z.union([z.number().int().gte(0), z.null()]).optional(),
- numLines: z.union([z.number().int().gte(0), z.null()]).optional(),
- oldLines: z.union([z.number().int().gte(0), z.null()]).optional(),
- oldStart: z.union([z.number().int().gte(0), z.null()]).optional(),
- startLine: z.union([z.number().int().gte(0), z.null()]).optional(),
- totalLines: z.union([z.number().int().gte(0), z.null()]).optional(),
- }),
- z.object({
- type: z.literal('text_editor_code_execution_create_result'),
- })
- ),
- z.intersection(
- z.object({
- content: z.union([z.string(), z.null()]).optional(),
- file_type: z.union([z.string(), z.null()]).optional(),
- is_file_update: z.union([z.boolean(), z.null()]).optional(),
- lines: z.union([z.array(z.string()), z.null()]).optional(),
- newLines: z.union([z.number().int().gte(0), z.null()]).optional(),
- newStart: z.union([z.number().int().gte(0), z.null()]).optional(),
- numLines: z.union([z.number().int().gte(0), z.null()]).optional(),
- oldLines: z.union([z.number().int().gte(0), z.null()]).optional(),
- oldStart: z.union([z.number().int().gte(0), z.null()]).optional(),
- startLine: z.union([z.number().int().gte(0), z.null()]).optional(),
- totalLines: z.union([z.number().int().gte(0), z.null()]).optional(),
+ content: z.object({
+ citations: z
+ .union([z.object({ enabled: z.boolean() }), z.null()])
+ .optional(),
+ source: z.any().superRefine((x, ctx) => {
+ const schemas = [
+ z.object({
+ data: z.string(),
+ media_type: z.string(),
+ type: z.literal('text'),
+ }),
+ z.object({
+ data: z.string(),
+ media_type: z.string(),
+ type: z.literal('base64'),
+ }),
+ ];
+ const errors = schemas.reduce<z.ZodError[]>(
+ (errors, schema) =>
+ ((result) =>
+ result.error ? [...errors, result.error] : errors)(
+ schema.safeParse(x)
+ ),
+ []
+ );
+ if (schemas.length - errors.length !== 1) {
+ ctx.addIssue({
+ path: ctx.path,
+ code: 'invalid_union',
+ unionErrors: errors,
+ message: 'Invalid input: Should pass single schema',
+ });
+ }
+ }),
+ title: z.union([z.string(), z.null()]).optional(),
+ }),
+ retrieved_at: z.string(),
+ url: z.string(),
}),
- z.object({
- type: z.literal('text_editor_code_execution_str_replace_result'),
- })
+ z.object({ type: z.literal('web_fetch_result') })
),
z.intersection(
z.object({
error_code: z.any().superRefine((x, ctx) => {
const schemas = [
- z.literal('unavailable'),
- z.literal('execution_time_exceeded'),
- z.literal('container_expired'),
z.literal('invalid_input'),
+ z.literal('url_too_long'),
+ z.literal('url_not_allowed'),
+ z.literal('url_not_accessible'),
z.literal('too_many_requests'),
- z.literal('file_not_found'),
- z.literal('string_not_found'),
+ z.literal('unsupported_content_type'),
+ z.literal('max_uses_exceeded'),
+ z.literal('unavailable'),
];
const errors = schemas.reduce<z.ZodError[]>(
(errors, schema) =>
@@ -2076,9 +2059,7 @@ export const TextEditorCodeExecutionResponse = z.object({
}
}),
}),
- z.object({
- type: z.literal('text_editor_code_execution_tool_result_error'),
- })
+ z.object({ type: z.literal('web_fetch_tool_result_error') })
),
];
const errors = schemas.reduce<z.ZodError[]>(
@@ -2100,6 +2081,24 @@ export const TextEditorCodeExecutionResponse = z.object({
tool_use_id: z.string(),
});
+export const WebSearch = z.object({ input: z.string() });
+
+export const WebSearchResponse = z.object({
+ content: z.union([
+ z.array(
+ z.object({
+ encrypted_content: z.union([z.string(), z.null()]).optional(),
+ page_age: z.union([z.string(), z.null()]).optional(),
+ title: z.string(),
+ type: z.literal('web_search_result'),
+ url: z.string(),
+ })
+ ),
+ z.object({ error_code: z.string(), type: z.string() }),
+ ]),
+ tool_use_id: z.string(),
+});
+
export const ReadThread = z.object({
contentType: z.enum([
'channel',
diff --git a/js/app/packages/service-clients/service-cognition/generated/tools/tool.ts b/js/app/packages/service-clients/service-cognition/generated/tools/tool.ts
index e1e0324a0f..763fdeb27c 100644
--- a/js/app/packages/service-clients/service-cognition/generated/tools/tool.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/tools/tool.ts
@@ -8,8 +8,8 @@ import * as schemas from './schemas';
import type * as types from './types';
type ToolParserMap = {
- bash_code_execution: {
- call: types.BashCodeExecutionToolCall;
+ BashCodeExecution: {
+ call: types.BashCodeExecution;
response: types.BashCodeExecutionResponse;
};
ContentSearch: {
@@ -80,24 +80,21 @@ type ToolParserMap = {
response: types.SetEntityPropertyResponse;
};
Subagent: { call: types.Subagent; response: types.SubagentResponse };
- text_editor_code_execution: {
- call: types.TextEditorCodeExecutionToolCall;
+ TextEditorCodeExecution: {
+ call: types.TextEditorCodeExecution;
response: types.TextEditorCodeExecutionResponse;
};
UpdateThreadLabels: {
call: types.UpdateThreadLabels;
response: types.UpdateThreadLabelsResponse;
};
- web_fetch: { call: types.WebFetchToolCall; response: types.WebFetchResponse };
- web_search: {
- call: types.WebSearchToolCall;
- response: types.WebSearchResponse;
- };
+ WebFetch: { call: types.WebFetch; response: types.WebFetchResponse };
+ WebSearch: { call: types.WebSearch; response: types.WebSearchResponse };
};
const toolParserMap = {
- bash_code_execution: {
- call: schemas.BashCodeExecutionToolCall,
+ BashCodeExecution: {
+ call: schemas.BashCodeExecution,
response: schemas.BashCodeExecutionResponse,
},
ContentSearch: {
@@ -177,22 +174,16 @@ const toolParserMap = {
response: schemas.SetEntityPropertyResponse,
},
Subagent: { call: schemas.Subagent, response: schemas.SubagentResponse },
- text_editor_code_execution: {
- call: schemas.TextEditorCodeExecutionToolCall,
+ TextEditorCodeExecution: {
+ call: schemas.TextEditorCodeExecution,
response: schemas.TextEditorCodeExecutionResponse,
},
UpdateThreadLabels: {
call: schemas.UpdateThreadLabels,
response: schemas.UpdateThreadLabelsResponse,
},
- web_fetch: {
- call: schemas.WebFetchToolCall,
- response: schemas.WebFetchResponse,
- },
- web_search: {
- call: schemas.WebSearchToolCall,
- response: schemas.WebSearchResponse,
- },
+ WebFetch: { call: schemas.WebFetch, response: schemas.WebFetchResponse },
+ WebSearch: { call: schemas.WebSearch, response: schemas.WebSearchResponse },
};
export type ToolName = keyof ToolParserMap;
@@ -204,8 +195,8 @@ type NamedRawTool = {
};
type ToolDataMap = {
- bash_code_execution: {
- call: types.BashCodeExecutionToolCall;
+ BashCodeExecution: {
+ call: types.BashCodeExecution;
response: types.BashCodeExecutionResponse;
};
ContentSearch: {
@@ -276,19 +267,16 @@ type ToolDataMap = {
response: types.SetEntityPropertyResponse;
};
Subagent: { call: types.Subagent; response: types.SubagentResponse };
- text_editor_code_execution: {
- call: types.TextEditorCodeExecutionToolCall;
+ TextEditorCodeExecution: {
+ call: types.TextEditorCodeExecution;
response: types.TextEditorCodeExecutionResponse;
};
UpdateThreadLabels: {
call: types.UpdateThreadLabels;
response: types.UpdateThreadLabelsResponse;
};
- web_fetch: { call: types.WebFetchToolCall; response: types.WebFetchResponse };
- web_search: {
- call: types.WebSearchToolCall;
- response: types.WebSearchResponse;
- };
+ WebFetch: { call: types.WebFetch; response: types.WebFetchResponse };
+ WebSearch: { call: types.WebSearch; response: types.WebSearchResponse };
};
export type NamedTool<
diff --git a/js/app/packages/service-clients/service-cognition/generated/tools/types.ts b/js/app/packages/service-clients/service-cognition/generated/tools/types.ts
index 7654cb1f20..2cec13caf0 100644
--- a/js/app/packages/service-clients/service-cognition/generated/tools/types.ts
+++ b/js/app/packages/service-clients/service-cognition/generated/tools/types.ts
@@ -185,6 +185,8 @@ export type ReadThreadReadContent =
* A single search result from web search
*/
export type SearchResult = {
+ encrypted_content?: string | null;
+ page_age?: string | null;
title: string;
type: 'web_search_result';
url: string;
@@ -291,7 +293,20 @@ export type WebFetchErrorCode =
| 'unsupported_content_type'
| 'max_uses_exceeded'
| 'unavailable';
+/**
+ * Content of a web search response — either search results or an error.
+ */
+export type WebSearchContent = SearchResult[] | WebSearchToolError;
+/**
+ * Execute a bash command in a sandboxed environment using Claude's built-in code execution tool.
+ */
+export interface BashCodeExecution {
+ /**
+ * The bash command or instruction to execute.
+ */
+ input: string;
+}
/**
* Successful bash code execution result
*/
@@ -335,15 +350,6 @@ export interface BashCodeExecutionResponse {
content: BashCodeExecutionContent;
tool_use_id: string;
}
-/**
- * The expected shape of the streamed JSON following a `server_tool_use` for bash_code_execution
- */
-export interface BashCodeExecutionToolCall {
- /**
- * The bash command to execute
- */
- command: string;
-}
export interface CallRecordMetadata {
attended: boolean;
channel_name?: string | null;
@@ -2337,6 +2343,15 @@ export interface Subagent {
export interface SubagentResponse {
result: string;
}
+/**
+ * Use a text editor in a sandboxed environment using Claude's built-in code execution tool.
+ */
+export interface TextEditorCodeExecution {
+ /**
+ * The text editing instruction.
+ */
+ input: string;
+}
/**
* Result from text editor operations (view, create, str_replace)
* Fields are optional as different operations return different fields
@@ -2400,31 +2415,6 @@ export interface TextEditorCodeExecutionResponse {
content: TextEditorCodeExecutionContent;
tool_use_id: string;
}
-/**
- * The expected shape of the streamed JSON following a `server_tool_use` for text_editor_code_execution
- */
-export interface TextEditorCodeExecutionToolCall {
- /**
- * The command to execute: "view", "create", or "str_replace"
- */
- command: string;
- /**
- * File content for create operations
- */
- file_text?: string | null;
- /**
- * Replacement string for str_replace operations
- */
- new_str?: string | null;
- /**
- * String to find for str_replace operations
- */
- old_str?: string | null;
- /**
- * Path to the file
- */
- path: string;
-}
/**
* Add or remove a single label from every message in a Gmail thread. In Gmail, nearly all inbox operations are just label add/remove operations, so this tool is the primitive for archiving, marking read/unread, starring, trashing, marking important/spam, and applying or removing custom labels.
*
@@ -2474,6 +2464,15 @@ export interface UpdateThreadLabelsResponse {
*/
summary: string;
}
+/**
+ * Fetch the contents of a web page using Claude's built-in web fetch tool.
+ */
+export interface WebFetch {
+ /**
+ * The URL to fetch or an instruction describing what to fetch.
+ */
+ input: string;
+}
/**
* Successful web fetch result containing the fetched content
*/
@@ -2516,25 +2515,25 @@ export interface WebFetchResponse {
tool_use_id: string;
}
/**
- * The expected shape of the streamed JSON following a `server_tool_use` in content_block_start event
+ * Search the web for information using Claude's built-in web search tool.
*/
-export interface WebFetchToolCall {
- url: string;
+export interface WebSearch {
+ /**
+ * The search query or instruction.
+ */
+ input: string;
}
/**
- * Web search response content returned by Claude when using the web_search tool
+ * Error returned when web search fails
*/
-export interface WebSearchResponse {
- /**
- * The search query that was executed
- * Array of search results
- */
- content: SearchResult[];
- tool_use_id: string;
+export interface WebSearchToolError {
+ error_code: string;
+ type: string;
}
/**
- * This is the expected shape of the streamed json following a `server_tool_use` in content_block_start event
+ * Web search response content returned by Claude when using the web_search tool
*/
-export interface WebSearchToolCall {
- query: string;
+export interface WebSearchResponse {
+ content: WebSearchContent;
+ tool_use_id: string;
}
diff --git a/js/app/packages/service-clients/service-cognition/openapi.json b/js/app/packages/service-clients/service-cognition/openapi.json
index 35de63541b..fadb142b2e 100644
--- a/js/app/packages/service-clients/service-cognition/openapi.json
+++ b/js/app/packages/service-clients/service-cognition/openapi.json
@@ -1196,25 +1196,6 @@
}
}
},
- "/models": {
- "get": {
- "tags": ["get_models"],
- "summary": "Gets all available models",
- "operationId": "get_models_handler",
- "responses": {
- "200": {
- "description": "",
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/GetModelsResponse"
- }
- }
- }
- }
- }
- }
- },
"/preview": {
"post": {
"tags": ["get_batch_preview"],
@@ -1409,21 +1390,6 @@
},
"components": {
"schemas": {
- "AIModel": {
- "type": "object",
- "required": ["name", "provider", "metadata"],
- "properties": {
- "metadata": {
- "$ref": "#/components/schemas/ModelMetadata"
- },
- "name": {
- "type": "string"
- },
- "provider": {
- "$ref": "#/components/schemas/Provider"
- }
- }
- },
"AccessLevel": {
"type": "string",
"description": "Ordered from least to most access top -> bottom",
@@ -1444,14 +1410,21 @@
}
}
},
+ "AgentModel": {
+ "type": "string",
+ "description": "Model to use for completions.\n\nUnrecognized model strings (including retired Google/OpenAI variants\nfrom older data) deserialize to `Retired` via the manual\n`Deserialize` impl.",
+ "enum": ["smart", "fast", "opus4_7", "sonnet4_6", "haiku4_5", "retired"]
+ },
"AssistantMessagePart": {
"oneOf": [
{
"type": "object",
+ "description": "Plain text produced by the model.",
"required": ["text", "type"],
"properties": {
"text": {
- "type": "string"
+ "type": "string",
+ "description": "The text content."
},
"type": {
"type": "string",
@@ -1461,14 +1434,19 @@
},
{
"type": "object",
+ "description": "A native tool call issued by the model.",
"required": ["name", "json", "id", "type"],
"properties": {
"id": {
- "type": "string"
+ "type": "string",
+ "description": "Provider-assigned call id."
+ },
+ "json": {
+ "description": "Tool arguments as JSON."
},
- "json": {},
"name": {
- "type": "string"
+ "type": "string",
+ "description": "Tool name."
},
"type": {
"type": "string",
@@ -1478,23 +1456,27 @@
},
{
"type": "object",
+ "description": "A tool call routed through an MCP service.",
"required": ["name", "service", "json", "id", "type"],
"properties": {
"display_name": {
"type": ["string", "null"],
- "description": "Human-readable title from the MCP server, if provided"
+ "description": "Optional human-readable name."
},
"id": {
- "type": "string"
+ "type": "string",
+ "description": "Provider-assigned call id."
+ },
+ "json": {
+ "description": "Tool arguments as JSON."
},
- "json": {},
"name": {
"type": "string",
- "description": "Demangled tool name from the MCP server"
+ "description": "Tool name."
},
"service": {
"type": "string",
- "description": "MCP server name"
+ "description": "MCP service identifier."
},
"type": {
"type": "string",
@@ -1504,14 +1486,19 @@
},
{
"type": "object",
+ "description": "A JSON response from a tool call.",
"required": ["name", "json", "id", "type"],
"properties": {
"id": {
- "type": "string"
+ "type": "string",
+ "description": "Corresponding call id."
+ },
+ "json": {
+ "description": "Response payload."
},
- "json": {},
"name": {
- "type": "string"
+ "type": "string",
+ "description": "Tool name."
},
"type": {
"type": "string",
@@ -1521,16 +1508,20 @@
},
{
"type": "object",
+ "description": "An error response from a tool call.",
"required": ["name", "description", "id", "type"],
"properties": {
"description": {
- "type": "string"
+ "type": "string",
+ "description": "Human-readable error description."
},
"id": {
- "type": "string"
+ "type": "string",
+ "description": "Corresponding call id."
},
"name": {
- "type": "string"
+ "type": "string",
+ "description": "Tool name."
},
"type": {
"type": "string",
@@ -1538,7 +1529,8 @@
}
}
}
- ]
+ ],
+ "description": "A structured part within an assistant message.\n\nWhen the model responds with tool calls the full turn is persisted as a\nflat sequence of these parts. [`crate::convert::to_rig_messages`]\nreconstructs the turn boundaries that providers expect."
},
"AttachmentMetadata": {
"oneOf": [
@@ -1797,15 +1789,18 @@
"ChatMessageContent": {
"oneOf": [
{
- "type": "string"
+ "type": "string",
+ "description": "Plain text content."
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/AssistantMessagePart"
- }
+ },
+ "description": "Structured assistant message parts."
}
- ]
+ ],
+ "description": "The content of a [`ChatMessage`].\n\nFor user and system messages the content is plain [`Text`](Self::Text).\nFor assistant messages it may additionally be a sequence of\n[`AssistantMessagePart`]s that encode tool-call round trips."
},
"ChatMessageError": {
"type": "object",
@@ -1946,7 +1941,7 @@
"type": "null"
},
{
- "$ref": "#/components/schemas/Model",
+ "$ref": "#/components/schemas/AgentModel",
"description": "The model used to generate the chat."
}
]
@@ -2121,7 +2116,7 @@
"available_models": {
"type": "array",
"items": {
- "$ref": "#/components/schemas/Model"
+ "$ref": "#/components/schemas/AgentModel"
}
},
"chat_id": {
@@ -2133,7 +2128,7 @@
"type": "null"
},
{
- "$ref": "#/components/schemas/Model"
+ "$ref": "#/components/schemas/AgentModel"
}
]
},
@@ -2342,15 +2337,20 @@
},
"DynamicSchema": {
"type": "object",
+ "description": "Schema definition for dynamic structured completions.",
"required": ["schema", "name"],
"properties": {
"description": {
- "type": ["string", "null"]
+ "type": ["string", "null"],
+ "description": "Optional description of what the schema represents."
},
"name": {
- "type": "string"
+ "type": "string",
+ "description": "Name of the schema."
},
- "schema": {}
+ "schema": {
+ "description": "The JSON schema to validate against."
+ }
}
},
"Entity": {
@@ -2952,18 +2952,6 @@
}
}
},
- "GetModelsResponse": {
- "type": "object",
- "required": ["models"],
- "properties": {
- "models": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/AIModel"
- }
- }
- }
- },
"HttpSendChatMessageRequest": {
"type": "object",
"description": "HTTP request payload for sending a chat message.\nUnlike the WebSocket payload, this does not include stream_id as it's generated server-side.",
@@ -2989,7 +2977,7 @@
"description": "The content of the message"
},
"model": {
- "$ref": "#/components/schemas/Model",
+ "$ref": "#/components/schemas/AgentModel",
"description": "The model to respond with"
},
"toolset": {
@@ -3047,40 +3035,6 @@
}
}
},
- "Model": {
- "type": "string",
- "enum": [
- "gemini-2.5-pro",
- "gemini-2.0-flash-001",
- "gemini-2.0-flash-lite-001",
- "gemini-pro-1.5",
- "gpt-5",
- "gpt-4.1",
- "gpt-4o",
- "gpt-4o-mini",
- "o1",
- "gpt-4o-search-preview",
- "o3",
- "claude-3-5-sonnet",
- "claude-3-7-sonnet",
- "claude-sonnet-4",
- "claude-sonnet-4-5",
- "claude-sonnet-4-6",
- "claude-haiku-4-5",
- "claude-opus-4-5",
- "claude-opus-4-6"
- ]
- },
- "ModelMetadata": {
- "type": "object",
- "required": ["contextWindow"],
- "properties": {
- "contextWindow": {
- "type": "integer",
- "format": "int32"
- }
- }
- },
"NewAttachment": {
"type": "object",
"required": ["attachment_type", "attachment_id"],
@@ -3117,7 +3071,7 @@
"description": "Optional pre-generated ID. If None, the database generates one."
},
"model": {
- "$ref": "#/components/schemas/Model",
+ "$ref": "#/components/schemas/AgentModel",
"description": "The model used to generate the chat"
},
"role": {
@@ -3170,10 +3124,6 @@
}
}
},
- "Provider": {
- "type": "string",
- "enum": ["openai", "google", "anthropic", "googleanthropic", "xai"]
- },
"RejectToolCallRequest": {
"type": "object",
"description": "Request body for rejecting a pending tool call.",
@@ -3191,6 +3141,7 @@
},
"Role": {
"type": "string",
+ "description": "The role of a message participant.",
"enum": ["user", "assistant", "system"]
},
"SendChatMessagePayload": {
@@ -3222,7 +3173,7 @@
"description": "The content of the message"
},
"model": {
- "$ref": "#/components/schemas/Model",
+ "$ref": "#/components/schemas/AgentModel",
"description": "the chate model to respond with"
},
"stream_id": {
@@ -3385,7 +3336,7 @@
"required": ["stream_id", "model", "stream_error"],
"properties": {
"model": {
- "$ref": "#/components/schemas/Model"
+ "$ref": "#/components/schemas/AgentModel"
},
"stream_error": {
"type": "string",
@@ -3450,7 +3401,7 @@
"type": ["string", "null"]
},
"model": {
- "$ref": "#/components/schemas/Model"
+ "$ref": "#/components/schemas/AgentModel"
},
"output_schema": {
"$ref": "#/components/schemas/DynamicSchema"
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/agentModel.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/agentModel.ts
new file mode 100644
index 0000000000..5b2be6cede
--- /dev/null
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/agentModel.ts
@@ -0,0 +1,26 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * scheduled_action
+ * API for managing scheduled actions
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Model to use for completions.
+
+Unrecognized model strings (including retired Google/OpenAI variants
+from older data) deserialize to `Retired` via the manual
+`Deserialize` impl.
+ */
+export type AgentModel = (typeof AgentModel)[keyof typeof AgentModel];
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const AgentModel = {
+ smart: 'smart',
+ fast: 'fast',
+ opus4_7: 'opus4_7',
+ sonnet4_6: 'sonnet4_6',
+ haiku4_5: 'haiku4_5',
+ retired: 'retired',
+} as const;
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/agentTask.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/agentTask.ts
index 5fd6e5bb04..1eaa396da1 100644
--- a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/agentTask.ts
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/agentTask.ts
@@ -5,10 +5,10 @@
* API for managing scheduled actions
* OpenAPI spec version: 0.1.0
*/
-import type { Model } from './model';
+import type { AgentModel } from './agentModel';
export interface AgentTask {
- model: Model;
+ model: AgentModel;
prompt: string;
user_prompt: string;
}
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/index.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/index.ts
index 3a98c0d3fd..68e756e0f0 100644
--- a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/index.ts
+++ b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/index.ts
@@ -11,13 +11,13 @@ export * from './actionExecutionRecordId';
export * from './actionExecutionRecordResourceId';
export * from './actionExecutionRecordResult';
export * from './actionKind';
+export * from './agentModel';
export * from './agentTask';
export * from './createScheduledAction';
export * from './createScheduledActionTask';
export * from './emptyResponse';
export * from './inProgressExecution';
export * from './inProgressExecutionChatId';
-export * from './model';
export * from './schedule';
export * from './scheduledAction';
export * from './scheduledActionClaimed';
diff --git a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/model.ts b/js/app/packages/service-clients/service-scheduled-action/generated/schemas/model.ts
deleted file mode 100644
index ce6120aa2c..0000000000
--- a/js/app/packages/service-clients/service-scheduled-action/generated/schemas/model.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Generated by orval v7.21.0 🍺
- * Do not edit manually.
- * scheduled_action
- * API for managing scheduled actions
- * OpenAPI spec version: 0.1.0
- */
-
-export type Model = (typeof Model)[keyof typeof Model];
-
-// eslint-disable-next-line @typescript-eslint/no-redeclare
-export const Model = {
- 'gemini-25-pro': 'gemini-2.5-pro',
- 'gemini-20-flash-001': 'gemini-2.0-flash-001',
- 'gemini-20-flash-lite-001': 'gemini-2.0-flash-lite-001',
- 'gemini-pro-15': 'gemini-pro-1.5',
- 'gpt-5': 'gpt-5',
- 'gpt-41': 'gpt-4.1',
- 'gpt-4o': 'gpt-4o',
- 'gpt-4o-mini': 'gpt-4o-mini',
- o1: 'o1',
- 'gpt-4o-search-preview': 'gpt-4o-search-preview',
- o3: 'o3',
- 'claude-3-5-sonnet': 'claude-3-5-sonnet',
- 'claude-3-7-sonnet': 'claude-3-7-sonnet',
- 'claude-sonnet-4': 'claude-sonnet-4',
- 'claude-sonnet-4-5': 'claude-sonnet-4-5',
- 'claude-sonnet-4-6': 'claude-sonnet-4-6',
- 'claude-haiku-4-5': 'claude-haiku-4-5',
- 'claude-opus-4-5': 'claude-opus-4-5',
- 'claude-opus-4-6': 'claude-opus-4-6',
-} as const;
diff --git a/js/app/packages/service-clients/service-scheduled-action/openapi.json b/js/app/packages/service-clients/service-scheduled-action/openapi.json
index 7eeac70b3b..e498438cc9 100644
--- a/js/app/packages/service-clients/service-scheduled-action/openapi.json
+++ b/js/app/packages/service-clients/service-scheduled-action/openapi.json
@@ -415,12 +415,17 @@
"type": "string",
"enum": ["Agent"]
},
+ "AgentModel": {
+ "type": "string",
+ "description": "Model to use for completions.\n\nUnrecognized model strings (including retired Google/OpenAI variants\nfrom older data) deserialize to `Retired` via the manual\n`Deserialize` impl.",
+ "enum": ["smart", "fast", "opus4_7", "sonnet4_6", "haiku4_5", "retired"]
+ },
"AgentTask": {
"type": "object",
"required": ["model", "prompt", "user_prompt"],
"properties": {
"model": {
- "$ref": "#/components/schemas/Model"
+ "$ref": "#/components/schemas/AgentModel"
},
"prompt": {
"type": "string"
@@ -472,30 +477,6 @@
}
}
},
- "Model": {
- "type": "string",
- "enum": [
- "gemini-2.5-pro",
- "gemini-2.0-flash-001",
- "gemini-2.0-flash-lite-001",
- "gemini-pro-1.5",
- "gpt-5",
- "gpt-4.1",
- "gpt-4o",
- "gpt-4o-mini",
- "o1",
- "gpt-4o-search-preview",
- "o3",
- "claude-3-5-sonnet",
- "claude-3-7-sonnet",
- "claude-sonnet-4",
- "claude-sonnet-4-5",
- "claude-sonnet-4-6",
- "claude-haiku-4-5",
- "claude-opus-4-5",
- "claude-opus-4-6"
- ]
- },
"Schedule": {
"type": "string"
},
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lock
index 33bc31dfe5..4ab868bbb8 100644
--- a/rust/cloud-storage/Cargo.lock
+++ b/rust/cloud-storage/Cargo.lock
@@ -4,9 +4,9 @@ version = 4
[[package]]
name = "adler2"
-version = "2.0.0"
+version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "aead"
@@ -44,61 +44,55 @@ dependencies = [
]
[[package]]
-name = "ahash"
-version = "0.8.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
-dependencies = [
- "cfg-if",
- "getrandom 0.2.15",
- "once_cell",
- "version_check",
- "zerocopy 0.7.35",
-]
-
-[[package]]
-name = "aho-corasick"
-version = "1.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
-dependencies = [
- "memchr",
-]
-
-[[package]]
-name = "ai"
+name = "agent"
version = "0.1.0"
dependencies = [
"ai_toolset",
- "anthropic",
"anyhow",
"async-openai",
"async-stream",
"async-trait",
"attachment",
- "chrono",
"futures",
- "lazy_static",
"macro_user_id",
- "model_file_type",
- "rand 0.9.3",
- "reqwest 0.13.3",
- "schemars",
- "secrecy",
+ "rig-core",
+ "schemars 1.2.1",
"serde",
"serde_json",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"utoipa",
]
+[[package]]
+name = "ahash"
+version = "0.8.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
+dependencies = [
+ "cfg-if",
+ "getrandom 0.3.4",
+ "once_cell",
+ "version_check",
+ "zerocopy",
+]
+
+[[package]]
+name = "aho-corasick"
+version = "1.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "ai_tools"
version = "0.1.0"
dependencies = [
- "ai",
+ "agent",
"ai_toolset",
"anthropic",
"anyhow",
@@ -143,11 +137,11 @@ dependencies = [
"non_empty",
"notification",
"properties",
- "rand 0.9.3",
+ "rand 0.9.4",
"readonly_pool",
"remote_env_var",
"rootcause",
- "schemars",
+ "schemars 1.2.1",
"search_service_client",
"secretsmanager_client",
"serde",
@@ -173,29 +167,23 @@ dependencies = [
"axum",
"axum-macros",
"macro_user_id",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"utoipa",
]
[[package]]
name = "aligned"
-version = "0.4.2"
+version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923"
+checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685"
dependencies = [
"as-slice",
]
-[[package]]
-name = "aligned-vec"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1"
-
[[package]]
name = "aligned-vec"
version = "0.6.4"
@@ -233,7 +221,7 @@ dependencies = [
"reqwest 0.13.3",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"tracing",
]
@@ -248,9 +236,9 @@ dependencies = [
[[package]]
name = "anstream"
-version = "0.6.18"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
+checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
dependencies = [
"anstyle",
"anstyle-parse",
@@ -263,55 +251,58 @@ dependencies = [
[[package]]
name = "anstyle"
-version = "1.0.10"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
+checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
[[package]]
name = "anstyle-parse"
-version = "0.2.6"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
+checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
-version = "1.1.2"
+version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
+checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
dependencies = [
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
name = "anstyle-wincon"
-version = "3.0.7"
+version = "3.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e"
+checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
dependencies = [
"anstyle",
- "once_cell",
- "windows-sys 0.59.0",
+ "once_cell_polyfill",
+ "windows-sys 0.61.2",
]
[[package]]
name = "anthropic"
version = "0.2.0"
dependencies = [
+ "ai_toolset",
+ "anyhow",
"async-openai",
"async-stream",
+ "async-trait",
"chrono",
"futures",
"lazy_static",
- "rand 0.9.3",
+ "rand 0.9.4",
"regex",
"reqwest 0.13.3",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tokio-stream",
"tokio-util",
@@ -340,9 +331,9 @@ dependencies = [
[[package]]
name = "arbitrary"
-version = "1.4.1"
+version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223"
+checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
dependencies = [
"derive_arbitrary",
]
@@ -370,6 +361,12 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+[[package]]
+name = "as-any"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b0f477b951e452a0b6b4a10b53ccd569042d1d01729b519e02074a9c0958a063"
+
[[package]]
name = "as-slice"
version = "0.2.1"
@@ -403,7 +400,7 @@ dependencies = [
"memchr",
"proc-macro2",
"quote",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"serde",
"serde_derive",
"syn 2.0.117",
@@ -418,7 +415,7 @@ dependencies = [
"memchr",
"serde",
"serde_derive",
- "winnow",
+ "winnow 0.7.15",
]
[[package]]
@@ -434,17 +431,27 @@ dependencies = [
[[package]]
name = "async-compression"
-version = "0.4.18"
+version = "0.4.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df895a515f70646414f4b45c0b79082783b80552b373a68283012928df56f522"
+checksum = "e79b3f8a79cccc2898f31920fc69f304859b3bd567490f75ebf51ae1c792a9ac"
dependencies = [
- "flate2",
- "futures-core",
- "memchr",
+ "compression-codecs",
+ "compression-core",
"pin-project-lite",
"tokio",
]
+[[package]]
+name = "async-lock"
+version = "3.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311"
+dependencies = [
+ "event-listener 5.4.1",
+ "event-listener-strategy",
+ "pin-project-lite",
+]
+
[[package]]
name = "async-openai"
version = "0.36.1"
@@ -458,14 +465,14 @@ dependencies = [
"derive_builder",
"eventsource-stream",
"futures",
- "getrandom 0.3.1",
- "rand 0.9.3",
+ "getrandom 0.3.4",
+ "rand 0.9.4",
"reqwest 0.13.3",
"secrecy",
"serde",
"serde_json",
"serde_urlencoded",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tokio-stream",
"tokio-util",
@@ -539,32 +546,33 @@ dependencies = [
[[package]]
name = "async-stripe-shared"
-version = "1.0.0-alpha.4"
+version = "1.0.0-rc.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "703a63ee0c2724d84d753ee534a011cff3075d30a41bd09a8500b8c4d65a650d"
+checksum = "a352c5e36a92aa8bdd4326c8211b9a26e822e6cb4b7516a47282396a4938a231"
dependencies = [
"async-stripe-types",
"miniserde",
"serde",
- "smol_str 0.3.4",
+ "smol_str 0.3.2",
+ "tracing",
]
[[package]]
name = "async-stripe-types"
-version = "1.0.0-alpha.4"
+version = "1.0.0-rc.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b4b4bec484de0ed516cda964f37e5ee626f950a20a8dcaa879b668a0bf148aa"
+checksum = "8e1ec9960b89b1f556bf885403dd208d173a8c42d028fcd7baeca9ad2bfb13f6"
dependencies = [
"miniserde",
"serde",
- "smol_str 0.3.4",
+ "smol_str 0.3.2",
]
[[package]]
name = "async-stripe-webhook"
-version = "1.0.0-alpha.4"
+version = "1.0.0-rc.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2818b532e71a52fab3584510d72af7d591a857625df67714c55ae1c776c90b28"
+checksum = "ca9c87559c92de1303032a73e632e080935abf10204831a01098d96c1e1a632e"
dependencies = [
"async-stripe-shared",
"async-stripe-types",
@@ -573,8 +581,9 @@ dependencies = [
"hmac 0.12.1",
"miniserde",
"serde",
- "sha2 0.10.8",
- "thiserror 2.0.17",
+ "sha2 0.10.9",
+ "thiserror 2.0.18",
+ "tracing",
]
[[package]]
@@ -616,7 +625,7 @@ dependencies = [
"model_file_type",
"non_empty",
"serde",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"webp",
]
@@ -645,7 +654,7 @@ dependencies = [
"futures",
"github",
"http-body-util",
- "jsonwebtoken 10.3.0 (git+https://github.com/whutchinson98/jsonwebtoken)",
+ "jsonwebtoken 10.3.0",
"last_online_tracker",
"macro_auth",
"macro_aws_config",
@@ -672,7 +681,7 @@ dependencies = [
"native_app_service",
"non_empty",
"notification",
- "rand 0.9.3",
+ "rand 0.9.4",
"rate_limit",
"redis",
"referral",
@@ -690,10 +699,10 @@ dependencies = [
"sqs_client",
"strum",
"teams",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"time",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-cookies",
"tower-http",
"tracing",
@@ -713,15 +722,15 @@ dependencies = [
"model",
"reqwest 0.13.3",
"serde",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
]
[[package]]
name = "autocfg"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
+checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "av-scenechange"
@@ -738,39 +747,39 @@ dependencies = [
"num-traits",
"pastey 0.1.1",
"rayon",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"v_frame",
"y4m",
]
[[package]]
name = "av1-grain"
-version = "0.2.3"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf"
+checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8"
dependencies = [
"anyhow",
"arrayvec",
"log",
- "nom 7.1.3",
+ "nom 8.0.0",
"num-rational",
"v_frame",
]
[[package]]
name = "avif-serialize"
-version = "0.8.6"
+version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "47c8fbc0f831f4519fe8b810b6a7a91410ec83031b8233f730a0480029f6a23f"
+checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38"
dependencies = [
"arrayvec",
]
[[package]]
name = "aws-config"
-version = "1.8.16"
+version = "1.8.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50f156acdd2cf55f5aa53ee416c4ac851cf1222694506c0b1f78c85695e9ca9d"
+checksum = "517aa062d8bd9015ee23d6daa5e1c1372328412fdae4e6c4c1be9b69c6ad37a2"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -782,12 +791,13 @@ dependencies = [
"aws-smithy-json",
"aws-smithy-runtime",
"aws-smithy-runtime-api",
+ "aws-smithy-schema",
"aws-smithy-types",
"aws-types",
"bytes",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"hex",
- "http 1.3.1",
+ "http 1.4.0",
"sha1 0.10.6",
"time",
"tokio",
@@ -810,9 +820,9 @@ dependencies = [
[[package]]
name = "aws-lc-rs"
-version = "1.16.2"
+version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a054912289d18629dc78375ba2c3726a3afe3ff71b4edba9dedfca0e3446d1fc"
+checksum = "5ec2f1fc3ec205783a5da9a7e6c1509cc69dedf09a1949e412c1e18469326d00"
dependencies = [
"aws-lc-sys",
"zeroize",
@@ -820,9 +830,9 @@ dependencies = [
[[package]]
name = "aws-lc-sys"
-version = "0.39.1"
+version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83a25cf98105baa966497416dbd42565ce3a8cf8dbfd59803ec9ad46f3126399"
+checksum = "1a2f9779ce85b93ab6170dd940ad0169b5766ff848247aff13bb788b832fe3f4"
dependencies = [
"cc",
"cmake",
@@ -832,9 +842,9 @@ dependencies = [
[[package]]
name = "aws-runtime"
-version = "1.7.3"
+version = "1.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5dcd93c82209ac7413532388067dce79be5a8780c1786e5fae3df22e4dee2864"
+checksum = "77ed8e8c52d2dc2390ad9f15647fe663f71e9780b4262c190fbb823a32721566"
dependencies = [
"aws-credential-types",
"aws-sigv4",
@@ -847,9 +857,9 @@ dependencies = [
"aws-types",
"bytes",
"bytes-utils",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 0.4.6",
"http-body 1.0.1",
"percent-encoding",
@@ -860,9 +870,9 @@ dependencies = [
[[package]]
name = "aws-sdk-dynamodb"
-version = "1.111.0"
+version = "1.112.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc418346e3cb248c7d59e642acbcb06488b7c7cd2ba6ebc79e8003f618c60099"
+checksum = "08d2b44e71eda015705fe8a2d3f8061003432ad722d4e321ac38b3e2680fbe49"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -875,18 +885,18 @@ dependencies = [
"aws-smithy-types",
"aws-types",
"bytes",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"regex-lite",
"tracing",
]
[[package]]
name = "aws-sdk-ecs"
-version = "1.124.0"
+version = "1.125.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e28ffb1fa2097067108e6a0a6dd92cf9075391b50c709b268ef5f42ae0642a0"
+checksum = "4446bf0d1b00acf735257983201c5d80de6540ac3ec3f0b63648c64de0ce28e2"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -899,18 +909,18 @@ dependencies = [
"aws-smithy-types",
"aws-types",
"bytes",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"regex-lite",
"tracing",
]
[[package]]
name = "aws-sdk-lambda"
-version = "1.122.0"
+version = "1.123.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e231021d78da565357c3a53466215114fb4e8e4fd1289e285abbc3968bb6c4d"
+checksum = "eb7dd5e3ae831b07e19ade7897d53284695e8ca6bf3490a8f15d68da73495247"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -924,18 +934,18 @@ dependencies = [
"aws-smithy-types",
"aws-types",
"bytes",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"regex-lite",
"tracing",
]
[[package]]
name = "aws-sdk-s3"
-version = "1.132.0"
+version = "1.133.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5575840a3a6b11f6011463ebe359320dfe5b67babb5e9b06fed6ddf809a9ab40"
+checksum = "237aba2985e3c0a83e199cc7aa9a64a16c599875bc98170f00932f6199f19922"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -952,11 +962,11 @@ dependencies = [
"aws-smithy-xml",
"aws-types",
"bytes",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"hex",
"hmac 0.13.0",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"lru",
"percent-encoding",
@@ -968,9 +978,9 @@ dependencies = [
[[package]]
name = "aws-sdk-secretsmanager"
-version = "1.104.0"
+version = "1.105.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "811bcb3da8bf26e571da7a248c0a93152bba9642aa4c8c907c58d949fa5f1d5c"
+checksum = "1c4e56ac810211dc33810c7aa3612eda29a8b1e8c7e2db6e960c8657e3d95e42"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -983,18 +993,18 @@ dependencies = [
"aws-smithy-types",
"aws-types",
"bytes",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"regex-lite",
"tracing",
]
[[package]]
name = "aws-sdk-sesv2"
-version = "1.118.0"
+version = "1.119.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b8d0642857f4fe76cd9a3d8c4f2b393546f7561f7725052dd9f268005fda92b7"
+checksum = "bf5a9e9bb406368fb7a1fc0134d0e7fa4b2ecdd1a7984bf528396ed1cede60b8"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -1007,18 +1017,18 @@ dependencies = [
"aws-smithy-types",
"aws-types",
"bytes",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"regex-lite",
"tracing",
]
[[package]]
name = "aws-sdk-sns"
-version = "1.99.0"
+version = "1.100.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a64402b1899af9b4fa137751df9efb18e8a1d265cdc6febffb76d978468bacda"
+checksum = "6fd3423cd6073c97787dd14cc7308714fcac9173afa2ddbc0ba09df874a9eeb5"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -1032,18 +1042,18 @@ dependencies = [
"aws-smithy-types",
"aws-smithy-xml",
"aws-types",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"regex-lite",
"tracing",
]
[[package]]
name = "aws-sdk-sqs"
-version = "1.98.0"
+version = "1.99.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d5ee88532abaf0f125d460659cb80fe1506322f69131ed789c32c8d84c520ab"
+checksum = "6ce61cf7e451891862a315dc96e1dbeb5e6a6f3740b354b5243217602b7e437b"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -1056,18 +1066,18 @@ dependencies = [
"aws-smithy-types",
"aws-types",
"bytes",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"regex-lite",
"tracing",
]
[[package]]
name = "aws-sdk-sso"
-version = "1.98.0"
+version = "1.99.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d69c77aafa20460c68b6b3213c84f6423b6e76dbf89accd3e1789a686ffd9489"
+checksum = "9f4055e6099b2ec264abdc0d9bbfffce306c1601809275c861594779a0b04b45"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -1080,18 +1090,18 @@ dependencies = [
"aws-smithy-types",
"aws-types",
"bytes",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"regex-lite",
"tracing",
]
[[package]]
name = "aws-sdk-ssooidc"
-version = "1.100.0"
+version = "1.101.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c7e7b09346d5ca22a2a08267555843a6a0127fb20d8964cb6ecfb8fdb190225"
+checksum = "02f009ba0284c5d696425fd7b4dcc5b189f5726f4041b7a5794daecb3a68d598"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -1104,18 +1114,18 @@ dependencies = [
"aws-smithy-types",
"aws-types",
"bytes",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"regex-lite",
"tracing",
]
[[package]]
name = "aws-sdk-sts"
-version = "1.103.0"
+version = "1.104.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2249b81a2e73a8027c41c378463a81ec39b8510f184f2caab87de912af0f49b"
+checksum = "6aa6622798e19e6a76b690562085dd4771c736cd48343464a53ab4ae2f2c9f84"
dependencies = [
"aws-credential-types",
"aws-runtime",
@@ -1129,18 +1139,18 @@ dependencies = [
"aws-smithy-types",
"aws-smithy-xml",
"aws-types",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"regex-lite",
"tracing",
]
[[package]]
name = "aws-sigv4"
-version = "1.4.3"
+version = "1.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68dc0b907359b120170613b5c09ccc61304eac3998ff6274b97d93ee6490115a"
+checksum = "b7083fb918b38474ac65ffbf8a69fc8792d36879f4ac5f1667b43aec61efe9a5"
dependencies = [
"aws-credential-types",
"aws-smithy-eventstream",
@@ -1148,15 +1158,14 @@ dependencies = [
"aws-smithy-runtime-api",
"aws-smithy-types",
"bytes",
- "crypto-bigint 0.5.5",
+ "crypto-bigint",
"form_urlencoded",
"hex",
"hmac 0.13.0",
"http 0.2.12",
- "http 1.3.1",
- "p256 0.11.1",
+ "http 1.4.0",
+ "p256",
"percent-encoding",
- "ring",
"sha2 0.11.0",
"subtle",
"time",
@@ -1186,7 +1195,7 @@ dependencies = [
"bytes",
"crc-fast",
"hex",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-body-util",
"md-5 0.11.0",
@@ -1220,7 +1229,7 @@ dependencies = [
"bytes-utils",
"futures-core",
"futures-util",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-body-util",
"percent-encoding",
@@ -1238,24 +1247,24 @@ dependencies = [
"aws-smithy-async",
"aws-smithy-runtime-api",
"aws-smithy-types",
- "h2 0.3.26",
- "h2 0.4.13",
+ "h2 0.3.27",
+ "h2 0.4.14",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 0.4.6",
"hyper 0.14.32",
- "hyper 1.6.0",
+ "hyper 1.9.0",
"hyper-rustls 0.24.2",
- "hyper-rustls 0.27.5",
+ "hyper-rustls 0.27.9",
"hyper-util",
"pin-project-lite",
"rustls 0.21.12",
- "rustls 0.23.36",
+ "rustls 0.23.40",
"rustls-native-certs",
"rustls-pki-types",
"tokio",
"tokio-rustls 0.26.4",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
]
@@ -1303,9 +1312,9 @@ dependencies = [
"aws-smithy-schema",
"aws-smithy-types",
"bytes",
- "fastrand 2.3.0",
+ "fastrand 2.4.1",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 0.4.6",
"http-body 1.0.1",
"http-body-util",
@@ -1326,7 +1335,7 @@ dependencies = [
"aws-smithy-types",
"bytes",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"pin-project-lite",
"tokio",
"tracing",
@@ -1352,7 +1361,7 @@ checksum = "7442cb268338f0eb8278140a107c046756aa01093d8ef5e99628d34ae09c94f5"
dependencies = [
"aws-smithy-runtime-api",
"aws-smithy-types",
- "http 1.3.1",
+ "http 1.4.0",
]
[[package]]
@@ -1366,7 +1375,7 @@ dependencies = [
"bytes-utils",
"futures-core",
"http 0.2.12",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 0.4.6",
"http-body 1.0.1",
"http-body-util",
@@ -1392,13 +1401,14 @@ dependencies = [
[[package]]
name = "aws-types"
-version = "1.3.15"
+version = "1.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f4bbcaa9304ea40902d3d5f42a0428d1bd895a2b0f6999436fb279ffddc58ac"
+checksum = "d16bf10b03a3c01e6b3b7d47cd964e873ffe9e7d4e80fad16bd4c077cb068531"
dependencies = [
"aws-credential-types",
"aws-smithy-async",
"aws-smithy-runtime-api",
+ "aws-smithy-schema",
"aws-smithy-types",
"rustc_version",
"tracing",
@@ -1406,14 +1416,14 @@ dependencies = [
[[package]]
name = "aws_lambda_events"
-version = "0.16.0"
+version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52ddb91585253ccc85be3f2e0d5635529efdeadaf8a1da3230b433d3bbe43648"
+checksum = "144ec7565561115498a288850cc6a42b279e09b6c4b88f623eecb9c8ca96c08c"
dependencies = [
"base64 0.22.1",
"bytes",
"chrono",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-serde",
"serde",
@@ -1423,9 +1433,9 @@ dependencies = [
[[package]]
name = "axum"
-version = "0.8.8"
+version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8"
+checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90"
dependencies = [
"axum-core",
"axum-macros",
@@ -1433,10 +1443,10 @@ dependencies = [
"bytes",
"form_urlencoded",
"futures-util",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-body-util",
- "hyper 1.6.0",
+ "hyper 1.9.0",
"hyper-util",
"itoa",
"matchit",
@@ -1452,8 +1462,8 @@ dependencies = [
"sha1 0.10.6",
"sync_wrapper",
"tokio",
- "tokio-tungstenite 0.28.0",
- "tower 0.5.2",
+ "tokio-tungstenite 0.29.0",
+ "tower 0.5.3",
"tower-layer",
"tower-service",
"tracing",
@@ -1467,7 +1477,7 @@ checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1"
dependencies = [
"bytes",
"futures-core",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-body-util",
"mime",
@@ -1490,7 +1500,7 @@ dependencies = [
"cookie",
"futures-util",
"headers",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-body-util",
"mime",
@@ -1504,9 +1514,9 @@ dependencies = [
[[package]]
name = "axum-macros"
-version = "0.5.0"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "604fde5e028fea851ce1d8570bbdc034bec850d157f7569d10f347d06808c05c"
+checksum = "7aa268c23bfbbd2c4363b9cd302a4f504fb2a9dfe7e3451d66f35dd392e20aca"
dependencies = [
"proc-macro2",
"quote",
@@ -1533,19 +1543,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1"
dependencies = [
"futures-core",
- "getrandom 0.2.15",
+ "getrandom 0.2.17",
"instant",
"pin-project-lite",
- "rand 0.8.5",
+ "rand 0.8.6",
"tokio",
]
-[[package]]
-name = "base16ct"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce"
-
[[package]]
name = "base16ct"
version = "0.2.0"
@@ -1582,9 +1586,9 @@ dependencies = [
[[package]]
name = "base64ct"
-version = "1.6.0"
+version = "1.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
+checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
[[package]]
name = "basic-toml"
@@ -1604,13 +1608,13 @@ dependencies = [
"bitflags 2.11.1",
"cexpr",
"clang-sys",
- "itertools 0.11.0",
+ "itertools 0.13.0",
"log",
"prettyplease",
"proc-macro2",
"quote",
"regex",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"shlex",
"syn 2.0.117",
]
@@ -1632,9 +1636,9 @@ checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
[[package]]
name = "bit_field"
-version = "0.10.2"
+version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
+checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"
[[package]]
name = "bitflags"
@@ -1653,11 +1657,11 @@ dependencies = [
[[package]]
name = "bitstream-io"
-version = "4.9.0"
+version = "4.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60d4bd9d1db2c6bdf285e223a7fa369d5ce98ec767dec949c6ca62863ce61757"
+checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f"
dependencies = [
- "core2",
+ "no_std_io2",
]
[[package]]
@@ -1689,18 +1693,28 @@ dependencies = [
[[package]]
name = "borsh"
-version = "1.5.7"
+version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce"
+checksum = "cfd1e3f8955a5d7de9fab72fc8373fade9fb8a703968cb200ae3dc6cf08e185a"
dependencies = [
+ "bytes",
"cfg_aliases",
]
+[[package]]
+name = "bs58"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4"
+dependencies = [
+ "tinyvec",
+]
+
[[package]]
name = "bstr"
-version = "1.11.3"
+version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "531a9155a481e2ee699d4f98f43c0ca4ff8ee1bfd55c31e9e98fb29d2b176fe0"
+checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab"
dependencies = [
"memchr",
"regex-automata",
@@ -1709,21 +1723,21 @@ dependencies = [
[[package]]
name = "built"
-version = "0.8.0"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4ad8f11f288f48ca24471bbd51ac257aaeaaa07adae295591266b792902ae64"
+checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9"
[[package]]
name = "bumpalo"
-version = "3.17.0"
+version = "3.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
+checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
[[package]]
name = "bytemuck"
-version = "1.21.0"
+version = "1.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3"
+checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec"
[[package]]
name = "byteorder"
@@ -1800,7 +1814,7 @@ version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f42a145ed2d10dce2191e1dcf30cfccfea9026660e143662ba5eec4017d5daa"
dependencies = [
- "darling 0.20.10",
+ "darling 0.20.11",
"proc-macro2",
"quote",
"syn 2.0.117",
@@ -1825,8 +1839,8 @@ dependencies = [
"rootcause",
"serde",
"serde_json",
- "sha2 0.10.8",
- "thiserror 2.0.17",
+ "sha2 0.10.9",
+ "thiserror 2.0.18",
"tracing",
"utoipa",
]
@@ -1835,7 +1849,8 @@ dependencies = [
name = "call"
version = "0.1.0"
dependencies = [
- "ai",
+ "agent",
+ "ai_toolset",
"anyhow",
"async-trait",
"aws-sdk-s3",
@@ -1861,11 +1876,11 @@ dependencies = [
"models_permissions",
"notification",
"pgvector",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"utoipa",
@@ -1874,9 +1889,9 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.2.51"
+version = "1.2.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203"
+checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98"
dependencies = [
"find-msvc-tools",
"jobserver",
@@ -1912,9 +1927,9 @@ dependencies = [
[[package]]
name = "cfg-if"
-version = "1.0.0"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
[[package]]
name = "cfg_aliases"
@@ -1930,14 +1945,14 @@ checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601"
dependencies = [
"cfg-if",
"cpufeatures 0.3.0",
- "rand_core 0.10.0",
+ "rand_core 0.10.1",
]
[[package]]
name = "channels"
version = "0.1.0"
dependencies = [
- "ai",
+ "ai_toolset",
"anyhow",
"async-trait",
"axum",
@@ -1950,13 +1965,13 @@ dependencies = [
"model-error-response",
"model_user",
"models_pagination",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
"utoipa",
"uuid",
@@ -1976,7 +1991,7 @@ dependencies = [
name = "chat"
version = "0.1.0"
dependencies = [
- "ai",
+ "agent",
"ai_toolset",
"anyhow",
"async-trait",
@@ -1998,13 +2013,13 @@ dependencies = [
"models_permissions",
"non_empty",
"roles_and_permissions",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
"unicode-segmentation",
"utoipa",
@@ -2013,9 +2028,9 @@ dependencies = [
[[package]]
name = "chrono"
-version = "0.4.42"
+version = "0.4.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2"
+checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0"
dependencies = [
"iana-time-zone",
"js-sys",
@@ -2054,14 +2069,14 @@ checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
dependencies = [
"glob",
"libc",
- "libloading",
+ "libloading 0.8.9",
]
[[package]]
name = "clap"
-version = "4.5.37"
+version = "4.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071"
+checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51"
dependencies = [
"clap_builder",
"clap_derive",
@@ -2069,21 +2084,21 @@ dependencies = [
[[package]]
name = "clap_builder"
-version = "4.5.37"
+version = "4.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2"
+checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
- "strsim",
+ "strsim 0.11.1",
]
[[package]]
name = "clap_derive"
-version = "4.5.32"
+version = "4.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7"
+checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -2093,9 +2108,9 @@ dependencies = [
[[package]]
name = "clap_lex"
-version = "0.7.4"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
+checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
[[package]]
name = "cloudfront_sign"
@@ -2111,9 +2126,9 @@ dependencies = [
[[package]]
name = "cmake"
-version = "0.1.57"
+version = "0.1.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75443c44cd6b379beb8c5b45d85d0773baf31cce901fe7bb252f4eff3008ef7d"
+checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"
dependencies = [
"cc",
]
@@ -2132,9 +2147,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]]
name = "colorchoice"
-version = "1.0.3"
+version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
+checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
[[package]]
name = "combine"
@@ -2177,7 +2192,7 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"utoipa",
@@ -2229,7 +2244,7 @@ dependencies = [
"frecency",
"futures",
"http-body-util",
- "jsonwebtoken 10.3.0 (git+https://github.com/whutchinson98/jsonwebtoken)",
+ "jsonwebtoken 10.3.0",
"last_online_tracker",
"macro_auth",
"macro_db_client",
@@ -2252,9 +2267,9 @@ dependencies = [
"serde_json",
"sqlx",
"sqs_client",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"utoipa",
@@ -2274,12 +2289,29 @@ dependencies = [
"reqwest 0.13.3",
"serde",
"serde_json",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"urlencoding",
"uuid",
]
+[[package]]
+name = "compression-codecs"
+version = "0.4.38"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce2548391e9c1929c21bf6aa2680af86fe4c1b33e6cea9ac1cfeec0bd11218cf"
+dependencies = [
+ "compression-core",
+ "flate2",
+ "memchr",
+]
+
+[[package]]
+name = "compression-core"
+version = "0.4.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cc14f565cf027a105f7a44ccf9e5b424348421a1d8952a8fc9d499d313107789"
+
[[package]]
name = "concurrent-queue"
version = "2.5.0"
@@ -2301,7 +2333,7 @@ dependencies = [
"model-entity",
"serde",
"serde_json",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"uuid",
]
@@ -2348,7 +2380,7 @@ dependencies = [
"strum",
"strum_macros",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"tungstenite 0.28.0",
@@ -2441,7 +2473,7 @@ dependencies = [
"sqlx",
"sqs_worker",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
"utoipa",
]
@@ -2472,12 +2504,21 @@ dependencies = [
"sqlx",
"sqs_worker",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
"utoipa",
"utoipa-swagger-ui",
]
+[[package]]
+name = "convert_case"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9"
+dependencies = [
+ "unicode-segmentation",
+]
+
[[package]]
name = "convert_service"
version = "0.1.0"
@@ -2511,7 +2552,7 @@ dependencies = [
"sqs_client",
"sqs_worker",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"utoipa",
@@ -2532,37 +2573,38 @@ dependencies = [
[[package]]
name = "cool_asserts"
-version = "2.0.3"
+version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee9f254e53f61e2688d3677fa2cbe4e9b950afd56f48819c98817417cf6b28ec"
+checksum = "aefc127fad829eb36edd748660d3ee55490889bc54005cef71d2cd6e25ca2bb2"
dependencies = [
"indent_write",
]
[[package]]
name = "core-foundation"
-version = "0.10.0"
+version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63"
+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
-name = "core-foundation-sys"
-version = "0.8.7"
+name = "core-foundation"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
+checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
[[package]]
-name = "core2"
-version = "0.4.0"
+name = "core-foundation-sys"
+version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505"
-dependencies = [
- "memchr",
-]
+checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
[[package]]
name = "cowlike"
@@ -2588,28 +2630,26 @@ dependencies = [
[[package]]
name = "crc"
-version = "3.3.0"
+version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675"
+checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d"
dependencies = [
"crc-catalog",
]
[[package]]
name = "crc-catalog"
-version = "2.4.0"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
+checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853"
[[package]]
name = "crc-fast"
-version = "1.9.0"
+version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fd92aca2c6001b1bf5ba0ff84ee74ec8501b52bbef0cac80bf25a6c1d87a83d"
+checksum = "e75b2483e97a5a7da73ac68a05b629f9c53cff58d8ed1c77866079e18b00dba5"
dependencies = [
- "crc",
"digest 0.10.7",
- "rustversion",
"spin 0.10.0",
]
@@ -2621,9 +2661,9 @@ checksum = "338089f42c427b86394a5ee60ff321da23a5c89c9d89514c829687b26359fcff"
[[package]]
name = "crc32fast"
-version = "1.4.2"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
+checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
dependencies = [
"cfg-if",
]
@@ -2647,7 +2687,7 @@ dependencies = [
"model-error-response",
"serde",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"unfurl",
@@ -2664,7 +2704,7 @@ dependencies = [
"chrono",
"once_cell",
"phf 0.11.3",
- "winnow",
+ "winnow 0.7.15",
]
[[package]]
@@ -2737,21 +2777,9 @@ dependencies = [
[[package]]
name = "crunchy"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929"
-
-[[package]]
-name = "crypto-bigint"
-version = "0.4.9"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef"
-dependencies = [
- "generic-array",
- "rand_core 0.6.4",
- "subtle",
- "zeroize",
-]
+checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "crypto-bigint"
@@ -2778,9 +2806,9 @@ dependencies = [
[[package]]
name = "crypto-common"
-version = "0.2.1"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710"
+checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
dependencies = [
"hybrid-array",
]
@@ -2811,6 +2839,19 @@ dependencies = [
"smallvec",
]
+[[package]]
+name = "cssparser"
+version = "0.36.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dae61cf9c0abb83bd659dab65b7e4e38d8236824c85f0f804f173567bda257d2"
+dependencies = [
+ "cssparser-macros",
+ "dtoa-short",
+ "itoa",
+ "phf 0.13.1",
+ "smallvec",
+]
+
[[package]]
name = "cssparser-macros"
version = "0.6.1"
@@ -2868,12 +2909,12 @@ dependencies = [
[[package]]
name = "darling"
-version = "0.20.10"
+version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
+checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
dependencies = [
- "darling_core 0.20.10",
- "darling_macro 0.20.10",
+ "darling_core 0.20.11",
+ "darling_macro 0.20.11",
]
[[package]]
@@ -2888,15 +2929,15 @@ dependencies = [
[[package]]
name = "darling_core"
-version = "0.20.10"
+version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
+checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
- "strsim",
+ "strsim 0.11.1",
"syn 2.0.117",
]
@@ -2909,17 +2950,17 @@ dependencies = [
"ident_case",
"proc-macro2",
"quote",
- "strsim",
+ "strsim 0.11.1",
"syn 2.0.117",
]
[[package]]
name = "darling_macro"
-version = "0.20.10"
+version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
+checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
dependencies = [
- "darling_core 0.20.10",
+ "darling_core 0.20.11",
"quote",
"syn 2.0.117",
]
@@ -2937,9 +2978,9 @@ dependencies = [
[[package]]
name = "dashmap"
-version = "6.1.0"
+version = "6.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
+checksum = "e6361d5c062261c78a176addb82d4c821ae42bed6089de0e12603cd25de2059c"
dependencies = [
"cfg-if",
"crossbeam-utils",
@@ -2951,9 +2992,9 @@ dependencies = [
[[package]]
name = "data-encoding"
-version = "2.8.0"
+version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010"
+checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8"
[[package]]
name = "dataloss_prevention_handler"
@@ -2992,7 +3033,7 @@ dependencies = [
"axum-extra",
"cookie",
"http-body-util",
- "jsonwebtoken 10.3.0 (git+https://github.com/whutchinson98/jsonwebtoken)",
+ "jsonwebtoken 10.3.0",
"macro_auth",
"macro_user_id",
"model-error-response",
@@ -3001,7 +3042,7 @@ dependencies = [
"serde_json",
"serde_urlencoded",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
"url",
"urlencoding",
@@ -3009,9 +3050,9 @@ dependencies = [
[[package]]
name = "deflate64"
-version = "0.1.9"
+version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b"
+checksum = "ac6b926516df9c60bfa16e107b21086399f8285a44ca9711344b9e553c5146e2"
[[package]]
name = "delete_chat_handler"
@@ -3054,20 +3095,51 @@ dependencies = [
]
[[package]]
-name = "der"
-version = "0.6.1"
+name = "deluxe"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de"
+checksum = "8ed332aaf752b459088acf3dd4eca323e3ef4b83c70a84ca48fb0ec5305f1488"
dependencies = [
- "const-oid 0.9.6",
- "zeroize",
+ "deluxe-core",
+ "deluxe-macros",
+ "once_cell",
+ "proc-macro2",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "deluxe-core"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eddada51c8576df9d6a8450c351ff63042b092c9458b8ac7d20f89cbd0ffd313"
+dependencies = [
+ "arrayvec",
+ "proc-macro2",
+ "quote",
+ "strsim 0.10.0",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "deluxe-macros"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f87546d9c837f0b7557e47b8bd6eae52c3c223141b76aa233c345c9ab41d9117"
+dependencies = [
+ "deluxe-core",
+ "heck 0.4.1",
+ "if_chain",
+ "proc-macro-crate 1.3.1",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
]
[[package]]
name = "der"
-version = "0.7.9"
+version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0"
+checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
dependencies = [
"const-oid 0.9.6",
"pem-rfc7468",
@@ -3076,9 +3148,9 @@ dependencies = [
[[package]]
name = "deranged"
-version = "0.5.5"
+version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587"
+checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
dependencies = [
"powerfmt",
"serde_core",
@@ -3086,9 +3158,9 @@ dependencies = [
[[package]]
name = "derive_arbitrary"
-version = "1.4.1"
+version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800"
+checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"
dependencies = [
"proc-macro2",
"quote",
@@ -3110,7 +3182,7 @@ version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8"
dependencies = [
- "darling 0.20.10",
+ "darling 0.20.11",
"proc-macro2",
"quote",
"syn 2.0.117",
@@ -3128,12 +3200,33 @@ dependencies = [
[[package]]
name = "derive_more"
-version = "0.99.19"
+version = "0.99.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "derive_more"
+version = "2.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134"
+dependencies = [
+ "derive_more-impl",
+]
+
+[[package]]
+name = "derive_more-impl"
+version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3da29a38df43d6f156149c9b43ded5e018ddff2a855cf2cfd62e8cd7d079c69f"
+checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb"
dependencies = [
"proc-macro2",
"quote",
+ "rustc_version",
"syn 2.0.117",
]
@@ -3143,10 +3236,10 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2ca8e71544c1b67dcdbc2699ab258828aff985e5bc8d5f6b486d90d7df2f848"
dependencies = [
- "core-foundation",
+ "core-foundation 0.10.1",
"jni 0.21.1",
"libc",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"wasm-bindgen",
"web-sys",
"windows-sys 0.59.0",
@@ -3172,7 +3265,7 @@ checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
dependencies = [
"block-buffer 0.12.0",
"const-oid 0.10.2",
- "crypto-common 0.2.1",
+ "crypto-common 0.2.2",
"ctutils",
]
@@ -3201,8 +3294,8 @@ dependencies = [
name = "document_cognition_service"
version = "0.1.0"
dependencies = [
+ "agent",
"aho-corasick",
- "ai",
"ai_tools",
"ai_toolset",
"anyhow",
@@ -3232,7 +3325,7 @@ dependencies = [
"entity_access_management",
"frecency",
"futures",
- "http 1.3.1",
+ "http 1.4.0",
"http-body-util",
"last_online_tracker",
"lazy_static",
@@ -3266,7 +3359,7 @@ dependencies = [
"regex",
"reqwest 0.13.3",
"roles_and_permissions",
- "schemars",
+ "schemars 1.2.1",
"search_service_client",
"secretsmanager_client",
"serde",
@@ -3278,11 +3371,11 @@ dependencies = [
"stream",
"strum",
"sync_service_client",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"time",
"tokio",
"tokio-util",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"unfurl_service",
@@ -3333,7 +3426,7 @@ dependencies = [
"github",
"hex",
"http-body-util",
- "jsonwebtoken 10.3.0 (git+https://github.com/whutchinson98/jsonwebtoken)",
+ "jsonwebtoken 10.3.0",
"last_online_tracker",
"lazy_static",
"lexical_client",
@@ -3375,7 +3468,7 @@ dependencies = [
"reqwest 0.13.3",
"s3_key",
"saved_views",
- "schemars",
+ "schemars 1.2.1",
"search_service",
"secretsmanager_client",
"serde",
@@ -3387,9 +3480,9 @@ dependencies = [
"sync_service",
"sync_service_client",
"system_properties",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"unicode-segmentation",
@@ -3411,7 +3504,7 @@ dependencies = [
"reqwest 0.13.3",
"serde",
"serde_json",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
]
@@ -3419,11 +3512,11 @@ dependencies = [
name = "document_sub_type"
version = "0.1.0"
dependencies = [
- "schemars",
+ "schemars 1.2.1",
"serde",
"sqlx",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"utoipa",
]
@@ -3431,7 +3524,7 @@ dependencies = [
name = "document_text_extractor"
version = "0.1.0"
dependencies = [
- "ai",
+ "agent",
"anyhow",
"aws-sdk-s3",
"aws_lambda_events",
@@ -3482,7 +3575,7 @@ dependencies = [
name = "documents"
version = "0.1.0"
dependencies = [
- "ai",
+ "ai_toolset",
"anyhow",
"async-trait",
"attachment",
@@ -3519,15 +3612,15 @@ dependencies = [
"non_empty",
"reqwest 0.13.3",
"s3_key",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"sqlx",
"sync_service_client",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
"unicode-segmentation",
"urlencoding",
@@ -3561,7 +3654,7 @@ dependencies = [
"s3_key",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"sqlx",
"sqs_client",
"tokio",
@@ -3627,9 +3720,9 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1"
[[package]]
name = "dtoa"
-version = "1.0.9"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653"
+checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590"
[[package]]
name = "dtoa-short"
@@ -3648,9 +3741,9 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
[[package]]
name = "dyn-clone"
-version = "1.0.18"
+version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "feeef44e73baff3a26d371801df019877a9866a8c493d315ab00177843314f35"
+checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
[[package]]
name = "dynamodb_client"
@@ -3663,35 +3756,23 @@ dependencies = [
"models_bulk_upload",
"s3_key",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
]
-[[package]]
-name = "ecdsa"
-version = "0.14.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c"
-dependencies = [
- "der 0.6.1",
- "elliptic-curve 0.12.3",
- "rfc6979 0.3.1",
- "signature 1.6.4",
-]
-
[[package]]
name = "ecdsa"
version = "0.16.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"
dependencies = [
- "der 0.7.9",
+ "der",
"digest 0.10.7",
- "elliptic-curve 0.13.8",
- "rfc6979 0.4.0",
- "signature 2.2.0",
- "spki 0.7.3",
+ "elliptic-curve",
+ "rfc6979",
+ "signature",
+ "spki",
]
[[package]]
@@ -3700,8 +3781,8 @@ version = "2.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
dependencies = [
- "pkcs8 0.10.2",
- "signature 2.2.0",
+ "pkcs8",
+ "signature",
]
[[package]]
@@ -3713,7 +3794,7 @@ dependencies = [
"curve25519-dalek",
"ed25519",
"serde",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"subtle",
"zeroize",
]
@@ -3726,50 +3807,30 @@ checksum = "12a0bb14ac04a9fcf170d0bbbef949b44cc492f4452bd20c095636956f653642"
[[package]]
name = "either"
-version = "1.13.0"
+version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
+checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
dependencies = [
"serde",
]
-[[package]]
-name = "elliptic-curve"
-version = "0.12.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3"
-dependencies = [
- "base16ct 0.1.1",
- "crypto-bigint 0.4.9",
- "der 0.6.1",
- "digest 0.10.7",
- "ff 0.12.1",
- "generic-array",
- "group 0.12.1",
- "pkcs8 0.9.0",
- "rand_core 0.6.4",
- "sec1 0.3.0",
- "subtle",
- "zeroize",
-]
-
[[package]]
name = "elliptic-curve"
version = "0.13.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
dependencies = [
- "base16ct 0.2.0",
- "crypto-bigint 0.5.5",
+ "base16ct",
+ "crypto-bigint",
"digest 0.10.7",
- "ff 0.13.1",
+ "ff",
"generic-array",
- "group 0.13.0",
+ "group",
"hkdf",
"pem-rfc7468",
- "pkcs8 0.10.2",
+ "pkcs8",
"rand_core 0.6.4",
- "sec1 0.7.3",
+ "sec1",
"subtle",
"zeroize",
]
@@ -3778,7 +3839,7 @@ dependencies = [
name = "email"
version = "0.1.0"
dependencies = [
- "ai",
+ "ai_toolset",
"anyhow",
"async-trait",
"attachment",
@@ -3806,13 +3867,13 @@ dependencies = [
"non_empty",
"recursion",
"redis",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"serde_with",
"sqlx",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"tracing-subscriber",
@@ -3856,7 +3917,7 @@ dependencies = [
"notification",
"rootcause",
"serde",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"tracing",
]
@@ -3964,12 +4025,12 @@ dependencies = [
"regex",
"reqwest 0.13.3",
"s3_client",
- "schemars",
+ "schemars 1.2.1",
"scraper",
"secretsmanager_client",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"sqlx",
"sqlx-core",
"sqs_client",
@@ -3977,9 +4038,9 @@ dependencies = [
"static_file_service_client",
"strum_macros",
"system_properties",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"unfurl",
@@ -4074,7 +4135,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"aws-sdk-dynamodb",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
]
@@ -4098,7 +4159,7 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"utoipa",
@@ -4138,7 +4199,7 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"uuid",
@@ -4178,18 +4239,18 @@ dependencies = [
[[package]]
name = "equivalent"
-version = "1.0.1"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "errno"
-version = "0.3.10"
+version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -4220,6 +4281,16 @@ dependencies = [
"pin-project-lite",
]
+[[package]]
+name = "event-listener-strategy"
+version = "0.5.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
+dependencies = [
+ "event-listener 5.4.1",
+ "pin-project-lite",
+]
+
[[package]]
name = "eventsource-stream"
version = "0.2.3"
@@ -4273,29 +4344,15 @@ dependencies = [
[[package]]
name = "fastrand"
-version = "2.3.0"
+version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
+checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
[[package]]
name = "fax"
-version = "0.2.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f05de7d48f37cd6730705cbca900770cab77a89f413d23e100ad7fad7795a0ab"
-dependencies = [
- "fax_derive",
-]
-
-[[package]]
-name = "fax_derive"
-version = "0.2.0"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0aca10fb742cb43f9e7bb8467c91aa9bcb8e3ffbc6a6f7389bb93ffc920577d"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.117",
-]
+checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a"
[[package]]
name = "fdeflate"
@@ -4306,16 +4363,6 @@ dependencies = [
"simd-adler32",
]
-[[package]]
-name = "ff"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160"
-dependencies = [
- "rand_core 0.6.4",
- "subtle",
-]
-
[[package]]
name = "ff"
version = "0.13.1"
@@ -4342,9 +4389,9 @@ dependencies = [
[[package]]
name = "find-msvc-tools"
-version = "0.1.6"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff"
+checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
[[package]]
name = "fixedbitset"
@@ -4382,9 +4429,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "foldhash"
-version = "0.1.4"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f"
+checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
[[package]]
name = "foldhash"
@@ -4394,18 +4441,21 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
[[package]]
name = "form_urlencoded"
-version = "1.2.1"
+version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
+checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
dependencies = [
"percent-encoding",
]
[[package]]
name = "fragile"
-version = "2.0.0"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa"
+checksum = "8878864ba14bb86e818a412bfd6f18f9eabd4ec0f008a28e8f7eb61db532fcf9"
+dependencies = [
+ "futures-core",
+]
[[package]]
name = "frecency"
@@ -4423,13 +4473,13 @@ dependencies = [
"model-entity",
"num-traits",
"ordered-float",
- "rand 0.9.3",
+ "rand 0.9.4",
"recursion",
"serde",
"serde_json",
"sqlx",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"uuid",
@@ -4452,7 +4502,7 @@ dependencies = [
"serde",
"serde_json",
"serde_urlencoded",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"urlencoding",
@@ -4470,9 +4520,9 @@ dependencies = [
[[package]]
name = "futures"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
+checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d"
dependencies = [
"futures-channel",
"futures-core",
@@ -4485,9 +4535,9 @@ dependencies = [
[[package]]
name = "futures-channel"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
+checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d"
dependencies = [
"futures-core",
"futures-sink",
@@ -4495,15 +4545,15 @@ dependencies = [
[[package]]
name = "futures-core"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
+checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
[[package]]
name = "futures-executor"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
+checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d"
dependencies = [
"futures-core",
"futures-task",
@@ -4523,9 +4573,9 @@ dependencies = [
[[package]]
name = "futures-io"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
+checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718"
[[package]]
name = "futures-lite"
@@ -4544,9 +4594,9 @@ dependencies = [
[[package]]
name = "futures-macro"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
+checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b"
dependencies = [
"proc-macro2",
"quote",
@@ -4555,21 +4605,27 @@ dependencies = [
[[package]]
name = "futures-sink"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
+checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893"
[[package]]
name = "futures-task"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
+checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
+
+[[package]]
+name = "futures-timer"
+version = "3.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af43fadb8a98512d547e37b4e92e0ced13e205c061b87b4623eff01d918d6968"
[[package]]
name = "futures-util"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
+checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
dependencies = [
"futures-channel",
"futures-core",
@@ -4579,7 +4635,6 @@ dependencies = [
"futures-task",
"memchr",
"pin-project-lite",
- "pin-utils",
"slab",
]
@@ -4603,9 +4658,9 @@ dependencies = [
[[package]]
name = "generic-array"
-version = "0.14.7"
+version = "0.14.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
+checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2"
dependencies = [
"typenum",
"version_check",
@@ -4614,21 +4669,21 @@ dependencies = [
[[package]]
name = "gethostname"
-version = "1.0.2"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc257fdb4038301ce4b9cd1b3b51704509692bb3ff716a410cbd07925d9dae55"
+checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8"
dependencies = [
"rustix",
- "windows-targets 0.52.6",
+ "windows-link",
]
[[package]]
name = "getopts"
-version = "0.2.21"
+version = "0.2.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5"
+checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df"
dependencies = [
- "unicode-width 0.1.14",
+ "unicode-width 0.2.2",
]
[[package]]
@@ -4644,29 +4699,29 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.15"
+version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
dependencies = [
"cfg-if",
"js-sys",
"libc",
- "wasi 0.11.0+wasi-snapshot-preview1",
+ "wasi 0.11.1+wasi-snapshot-preview1",
"wasm-bindgen",
]
[[package]]
name = "getrandom"
-version = "0.3.1"
+version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
+checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
dependencies = [
"cfg-if",
"js-sys",
"libc",
- "wasi 0.13.3+wasi-0.2.2",
+ "r-efi 5.3.0",
+ "wasip2",
"wasm-bindgen",
- "windows-targets 0.52.6",
]
[[package]]
@@ -4677,8 +4732,8 @@ checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555"
dependencies = [
"cfg-if",
"libc",
- "r-efi",
- "rand_core 0.10.0",
+ "r-efi 6.0.0",
+ "rand_core 0.10.1",
"wasip2",
"wasip3",
]
@@ -4695,9 +4750,9 @@ dependencies = [
[[package]]
name = "gif"
-version = "0.14.0"
+version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f954a9e9159ec994f73a30a12b96a702dde78f5547bcb561174597924f7d4162"
+checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159"
dependencies = [
"color_quant",
"weezl",
@@ -4718,7 +4773,7 @@ dependencies = [
"hex",
"hmac 0.12.1",
"http-body-util",
- "jsonwebtoken 10.3.0 (git+https://github.com/whutchinson98/jsonwebtoken)",
+ "jsonwebtoken 10.3.0",
"macro_db_migrator",
"macro_env",
"macro_service_urls",
@@ -4734,12 +4789,12 @@ dependencies = [
"reqwest 0.13.3",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"sqlx",
"subtle",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
"urlencoding",
"utoipa",
@@ -4748,9 +4803,9 @@ dependencies = [
[[package]]
name = "glob"
-version = "0.3.2"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
+checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
[[package]]
name = "gmail_client"
@@ -4759,7 +4814,7 @@ dependencies = [
"anyhow",
"base64 0.22.1",
"chrono",
- "jsonwebtoken 10.3.0 (git+https://github.com/whutchinson98/jsonwebtoken)",
+ "jsonwebtoken 10.3.0",
"mail-builder",
"mockall",
"models_email",
@@ -4772,33 +4827,22 @@ dependencies = [
"uuid",
]
-[[package]]
-name = "group"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7"
-dependencies = [
- "ff 0.12.1",
- "rand_core 0.6.4",
- "subtle",
-]
-
[[package]]
name = "group"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
dependencies = [
- "ff 0.13.1",
+ "ff",
"rand_core 0.6.4",
"subtle",
]
[[package]]
name = "h2"
-version = "0.3.26"
+version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8"
+checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d"
dependencies = [
"bytes",
"fnv",
@@ -4815,16 +4859,16 @@ dependencies = [
[[package]]
name = "h2"
-version = "0.4.13"
+version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54"
+checksum = "171fefbc92fe4a4de27e0698d6a5b392d6a0e333506bc49133760b3bcf948733"
dependencies = [
"atomic-waker",
"bytes",
"fnv",
"futures-core",
"futures-sink",
- "http 1.3.1",
+ "http 1.4.0",
"indexmap 2.14.0",
"slab",
"tokio",
@@ -4834,12 +4878,13 @@ dependencies = [
[[package]]
name = "half"
-version = "2.4.1"
+version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888"
+checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"
dependencies = [
"cfg-if",
"crunchy",
+ "zerocopy",
]
[[package]]
@@ -4860,13 +4905,13 @@ dependencies = [
[[package]]
name = "hashbrown"
-version = "0.15.2"
+version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
+checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
dependencies = [
"allocator-api2",
"equivalent",
- "foldhash 0.1.4",
+ "foldhash 0.1.5",
]
[[package]]
@@ -4882,9 +4927,14 @@ dependencies = [
[[package]]
name = "hashbrown"
-version = "0.17.0"
+version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
+dependencies = [
+ "allocator-api2",
+ "equivalent",
+ "foldhash 0.2.0",
+]
[[package]]
name = "hashlink"
@@ -4892,7 +4942,7 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"
dependencies = [
- "hashbrown 0.15.2",
+ "hashbrown 0.15.5",
]
[[package]]
@@ -4904,7 +4954,7 @@ dependencies = [
"base64 0.22.1",
"bytes",
"headers-core",
- "http 1.3.1",
+ "http 1.4.0",
"httpdate",
"mime",
"sha1 0.10.6",
@@ -4916,7 +4966,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4"
dependencies = [
- "http 1.3.1",
+ "http 1.4.0",
]
[[package]]
@@ -4953,9 +5003,9 @@ dependencies = [
"idna",
"ipnet",
"once_cell",
- "rand 0.9.3",
+ "rand 0.9.4",
"ring",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tinyvec",
"tokio",
"tracing",
@@ -4975,10 +5025,10 @@ dependencies = [
"moka",
"once_cell",
"parking_lot",
- "rand 0.9.3",
+ "rand 0.9.4",
"resolv-conf",
"smallvec",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
]
@@ -5012,11 +5062,11 @@ dependencies = [
[[package]]
name = "home"
-version = "0.5.11"
+version = "0.5.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf"
+checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
dependencies = [
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -5030,14 +5080,14 @@ dependencies = [
[[package]]
name = "html2text"
-version = "0.15.1"
+version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ccdcacfbf50bfa32830312fe5cef296925e1a04ace93c579e4c94f5045805d06"
+checksum = "389acaa5a86952dcdc88a43bc18021009cb9885b0ff8c2fff1cc44e4f34c2fae"
dependencies = [
- "html5ever 0.31.0",
+ "html5ever 0.35.0",
"tendril",
- "thiserror 2.0.17",
- "unicode-width 0.2.1",
+ "thiserror 2.0.18",
+ "unicode-width 0.2.2",
]
[[package]]
@@ -5054,18 +5104,6 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "html5ever"
-version = "0.31.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "953cbbe631aae7fc0a112702ad5d3aaf09da38beaf45ea84610d6e1c358f569c"
-dependencies = [
- "log",
- "mac",
- "markup5ever 0.16.1",
- "match_token 0.1.0",
-]
-
[[package]]
name = "html5ever"
version = "0.35.0"
@@ -5074,7 +5112,7 @@ checksum = "55d958c2f74b664487a2035fe1dadb032c48718a03b63f3ab0b8537db8549ed4"
dependencies = [
"log",
"markup5ever 0.35.0",
- "match_token 0.35.0",
+ "match_token",
]
[[package]]
@@ -5090,12 +5128,11 @@ dependencies = [
[[package]]
name = "http"
-version = "1.3.1"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
+checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
dependencies = [
"bytes",
- "fnv",
"itoa",
]
@@ -5117,7 +5154,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
dependencies = [
"bytes",
- "http 1.3.1",
+ "http 1.4.0",
]
[[package]]
@@ -5128,7 +5165,7 @@ checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"
dependencies = [
"bytes",
"futures-core",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"pin-project-lite",
]
@@ -5145,7 +5182,7 @@ version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f056c8559e3757392c8d091e796416e4649d8e49e88b8d76df6c002f05027fd"
dependencies = [
- "http 1.3.1",
+ "http 1.4.0",
"serde",
]
@@ -5172,9 +5209,9 @@ dependencies = [
[[package]]
name = "httparse"
-version = "1.10.0"
+version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2d708df4e7140240a16cd6ab0ab65c972d7433ab77819ea693fde9c43811e2a"
+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
[[package]]
name = "httpdate"
@@ -5184,9 +5221,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "hybrid-array"
-version = "0.4.10"
+version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3944cf8cf766b40e2a1a333ee5e9b563f854d5fa49d6a8ca2764e97c6eddb214"
+checksum = "9155a582abd142abc056962c29e3ce5ff2ad5469f4246b537ed42c5deba857da"
dependencies = [
"typenum",
]
@@ -5201,7 +5238,7 @@ dependencies = [
"futures-channel",
"futures-core",
"futures-util",
- "h2 0.3.26",
+ "h2 0.3.27",
"http 0.2.12",
"http-body 0.4.6",
"httparse",
@@ -5217,15 +5254,16 @@ dependencies = [
[[package]]
name = "hyper"
-version = "1.6.0"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80"
+checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca"
dependencies = [
+ "atomic-waker",
"bytes",
"futures-channel",
- "futures-util",
- "h2 0.4.13",
- "http 1.3.1",
+ "futures-core",
+ "h2 0.4.14",
+ "http 1.4.0",
"http-body 1.0.1",
"httparse",
"httpdate",
@@ -5254,21 +5292,19 @@ dependencies = [
[[package]]
name = "hyper-rustls"
-version = "0.27.5"
+version = "0.27.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2"
+checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f"
dependencies = [
- "futures-util",
- "http 1.3.1",
- "hyper 1.6.0",
+ "http 1.4.0",
+ "hyper 1.9.0",
"hyper-util",
- "rustls 0.23.36",
+ "rustls 0.23.40",
"rustls-native-certs",
- "rustls-pki-types",
"tokio",
"tokio-rustls 0.26.4",
"tower-service",
- "webpki-roots 0.26.11",
+ "webpki-roots 1.0.7",
]
[[package]]
@@ -5277,7 +5313,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0"
dependencies = [
- "hyper 1.6.0",
+ "hyper 1.9.0",
"hyper-util",
"pin-project-lite",
"tokio",
@@ -5286,38 +5322,40 @@ dependencies = [
[[package]]
name = "hyper-util"
-version = "0.1.17"
+version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8"
+checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
dependencies = [
"base64 0.22.1",
"bytes",
"futures-channel",
- "futures-core",
"futures-util",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
- "hyper 1.6.0",
+ "hyper 1.9.0",
"ipnet",
"libc",
"percent-encoding",
"pin-project-lite",
- "socket2 0.6.1",
+ "socket2 0.6.3",
+ "system-configuration",
"tokio",
"tower-service",
"tracing",
+ "windows-registry",
]
[[package]]
name = "iana-time-zone"
-version = "0.1.61"
+version = "0.1.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220"
+checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
+ "log",
"wasm-bindgen",
"windows-core",
]
@@ -5333,21 +5371,23 @@ dependencies = [
[[package]]
name = "icu_collections"
-version = "1.5.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526"
+checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c"
dependencies = [
"displaydoc",
+ "potential_utf",
+ "utf8_iter",
"yoke",
"zerofrom",
"zerovec",
]
[[package]]
-name = "icu_locid"
-version = "1.5.0"
+name = "icu_locale_core"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637"
+checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29"
dependencies = [
"displaydoc",
"litemap",
@@ -5356,99 +5396,61 @@ dependencies = [
"zerovec",
]
-[[package]]
-name = "icu_locid_transform"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e"
-dependencies = [
- "displaydoc",
- "icu_locid",
- "icu_locid_transform_data",
- "icu_provider",
- "tinystr",
- "zerovec",
-]
-
-[[package]]
-name = "icu_locid_transform_data"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e"
-
[[package]]
name = "icu_normalizer"
-version = "1.5.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f"
+checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4"
dependencies = [
- "displaydoc",
"icu_collections",
"icu_normalizer_data",
"icu_properties",
"icu_provider",
"smallvec",
- "utf16_iter",
- "utf8_iter",
- "write16",
"zerovec",
]
[[package]]
name = "icu_normalizer_data"
-version = "1.5.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516"
+checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38"
[[package]]
name = "icu_properties"
-version = "1.5.1"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5"
+checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de"
dependencies = [
- "displaydoc",
"icu_collections",
- "icu_locid_transform",
+ "icu_locale_core",
"icu_properties_data",
"icu_provider",
- "tinystr",
+ "zerotrie",
"zerovec",
]
[[package]]
name = "icu_properties_data"
-version = "1.5.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569"
+checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14"
[[package]]
name = "icu_provider"
-version = "1.5.0"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9"
+checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421"
dependencies = [
"displaydoc",
- "icu_locid",
- "icu_provider_macros",
- "stable_deref_trait",
- "tinystr",
+ "icu_locale_core",
"writeable",
"yoke",
"zerofrom",
+ "zerotrie",
"zerovec",
]
-[[package]]
-name = "icu_provider_macros"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.117",
-]
-
[[package]]
name = "id-arena"
version = "2.3.0"
@@ -5463,9 +5465,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
-version = "1.0.3"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e"
+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
dependencies = [
"idna_adapter",
"smallvec",
@@ -5474,19 +5476,25 @@ dependencies = [
[[package]]
name = "idna_adapter"
-version = "1.2.0"
+version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71"
+checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"
dependencies = [
"icu_normalizer",
"icu_properties",
]
+[[package]]
+name = "if_chain"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cd62e6b5e86ea8eeeb8db1de02880a6abc01a397b2ebb64b5d74ac255318f5cb"
+
[[package]]
name = "image"
-version = "0.25.9"
+version = "0.25.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6506c6c10786659413faa717ceebcb8f70731c0a60cbae39795fdf114519c1a"
+checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"
dependencies = [
"bytemuck",
"byteorder-lite",
@@ -5502,15 +5510,15 @@ dependencies = [
"rayon",
"rgb",
"tiff",
- "zune-core 0.5.0",
- "zune-jpeg 0.5.5",
+ "zune-core",
+ "zune-jpeg",
]
[[package]]
name = "image-webp"
-version = "0.2.1"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b77d01e822461baa8409e156015a1d91735549f0f2c17691bd2d996bef238f7f"
+checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"
dependencies = [
"byteorder-lite",
"quick-error",
@@ -5558,7 +5566,7 @@ dependencies = [
"serde",
"serde_json",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"url",
@@ -5568,9 +5576,9 @@ dependencies = [
[[package]]
name = "imgref"
-version = "1.11.0"
+version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408"
+checksum = "40fac9d56ed6437b198fddba683305e8e2d651aa42647f00f5ae542e7f5c94a2"
[[package]]
name = "include_dir"
@@ -5615,11 +5623,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
dependencies = [
"equivalent",
- "hashbrown 0.17.0",
+ "hashbrown 0.17.1",
"serde",
"serde_core",
]
+[[package]]
+name = "indoc"
+version = "2.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
+dependencies = [
+ "rustversion",
+]
+
[[package]]
name = "infer"
version = "0.2.3"
@@ -5637,9 +5654,9 @@ dependencies = [
[[package]]
name = "inout"
-version = "0.1.3"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
+checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
dependencies = [
"generic-array",
]
@@ -5703,7 +5720,7 @@ name = "ip_extractor"
version = "0.1.0"
dependencies = [
"axum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
]
@@ -5713,7 +5730,7 @@ version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d40460c0ce33d6ce4b0630ad68ff63d6661961c48b6dba35e5a4d81cfb48222"
dependencies = [
- "socket2 0.6.1",
+ "socket2 0.6.3",
"widestring",
"windows-registry",
"windows-result",
@@ -5722,25 +5739,15 @@ dependencies = [
[[package]]
name = "ipnet"
-version = "2.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130"
-
-[[package]]
-name = "iri-string"
-version = "0.7.8"
+version = "2.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2"
-dependencies = [
- "memchr",
- "serde",
-]
+checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2"
[[package]]
name = "is_terminal_polyfill"
-version = "1.70.1"
+version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
+checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
[[package]]
name = "item_filters"
@@ -5756,11 +5763,11 @@ dependencies = [
"nom 8.0.0",
"non_empty",
"rootcause",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"utoipa",
"uuid",
]
@@ -5783,6 +5790,24 @@ dependencies = [
"either",
]
+[[package]]
+name = "itertools"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "itertools"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
+dependencies = [
+ "either",
+]
+
[[package]]
name = "itertools"
version = "0.14.0"
@@ -5826,7 +5851,7 @@ dependencies = [
"jni-sys 0.4.1",
"log",
"simd_cesu8",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"walkdir",
"windows-link",
]
@@ -5874,18 +5899,19 @@ dependencies = [
[[package]]
name = "jobserver"
-version = "0.1.32"
+version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0"
+checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
dependencies = [
+ "getrandom 0.3.4",
"libc",
]
[[package]]
name = "js-sys"
-version = "0.3.97"
+version = "0.3.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf"
+checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08"
dependencies = [
"cfg-if",
"futures-util",
@@ -5896,44 +5922,45 @@ dependencies = [
[[package]]
name = "jsonwebtoken"
version = "10.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0529410abe238729a60b108898784df8984c87f6054c9c4fcacc47e4803c1ce1"
+source = "git+https://github.com/whutchinson98/jsonwebtoken#c8c0d19511a0e7ba9d456e21437a79d321e99f16"
dependencies = [
"base64 0.22.1",
"ed25519-dalek",
- "getrandom 0.2.15",
+ "getrandom 0.2.17",
"hmac 0.12.1",
"js-sys",
- "p256 0.13.2",
+ "p256",
"p384",
- "rand 0.8.5",
+ "pem",
+ "rand 0.8.6",
"rsa",
"serde",
"serde_json",
- "sha2 0.10.8",
- "signature 2.2.0",
+ "sha2 0.10.9",
+ "signature",
+ "simple_asn1",
]
[[package]]
name = "jsonwebtoken"
-version = "10.3.0"
-source = "git+https://github.com/whutchinson98/jsonwebtoken#c8c0d19511a0e7ba9d456e21437a79d321e99f16"
+version = "10.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eba32bfb4ffdeaca3e34431072faf01745c9b26d25504aa7a6cf5684334fc4fc"
dependencies = [
"base64 0.22.1",
"ed25519-dalek",
- "getrandom 0.2.15",
+ "getrandom 0.2.17",
"hmac 0.12.1",
"js-sys",
- "p256 0.13.2",
+ "p256",
"p384",
- "pem",
- "rand 0.8.5",
+ "rand 0.8.6",
"rsa",
"serde",
"serde_json",
- "sha2 0.10.8",
- "signature 2.2.0",
- "simple_asn1",
+ "sha2 0.10.9",
+ "signature",
+ "zeroize",
]
[[package]]
@@ -5958,11 +5985,11 @@ dependencies = [
"base64 0.22.1",
"bytes",
"futures",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-body-util",
"http-serde",
- "hyper 1.6.0",
+ "hyper 1.9.0",
"hyper-util",
"lambda_runtime_api_client",
"pin-project",
@@ -5985,10 +6012,10 @@ dependencies = [
"bytes",
"futures-channel",
"futures-util",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-body-util",
- "hyper 1.6.0",
+ "hyper 1.9.0",
"hyper-util",
"tokio",
"tower 0.4.13",
@@ -6026,9 +6053,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "lebe"
-version = "0.5.2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
+checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"
[[package]]
name = "lexical_client"
@@ -6051,15 +6078,15 @@ checksum = "0864a00c8d019e36216b69c2c4ce50b83b7bd966add3cf5ba554ec44f8bebcf5"
[[package]]
name = "libc"
-version = "0.2.172"
+version = "0.2.186"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
+checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
[[package]]
name = "libfuzzer-sys"
-version = "0.4.9"
+version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf78f52d400cf2d84a3a973a78a592b4adc535739e0a5597a0da6f0c357adc75"
+checksum = "f12a681b7dd8ce12bff52488013ba614b869148d54dd79836ab85aafdd53f08d"
dependencies = [
"arbitrary",
"cc",
@@ -6067,19 +6094,41 @@ dependencies = [
[[package]]
name = "libloading"
-version = "0.8.6"
+version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
+checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
dependencies = [
"cfg-if",
- "windows-targets 0.52.6",
+ "windows-link",
+]
+
+[[package]]
+name = "libloading"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60"
+dependencies = [
+ "cfg-if",
+ "windows-link",
]
[[package]]
name = "libm"
-version = "0.2.11"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
+
+[[package]]
+name = "libredox"
+version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa"
+checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c"
+dependencies = [
+ "bitflags 2.11.1",
+ "libc",
+ "plain",
+ "redox_syscall 0.7.5",
+]
[[package]]
name = "libsqlite3-sys"
@@ -6103,68 +6152,53 @@ dependencies = [
[[package]]
name = "linux-raw-sys"
-version = "0.9.4"
+version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
[[package]]
name = "litemap"
-version = "0.7.4"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
+checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
[[package]]
name = "livekit-api"
-version = "0.4.19"
+version = "0.4.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "900451a686a1ce8488c420e81a2135831383b03aade6bc3075cf80463d3dd6a4"
+checksum = "e2611299f65786fa733f38ef9aab9d796679e6f2f77572b84170949769ca9a25"
dependencies = [
"base64 0.21.7",
"device-info",
- "http 1.3.1",
- "jsonwebtoken 10.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "http 1.4.0",
+ "jsonwebtoken 10.4.0",
"livekit-protocol",
"log",
"os_info",
"parking_lot",
"pbjson-types",
"prost 0.12.6",
- "rand 0.9.3",
+ "rand 0.9.4",
"reqwest 0.12.28",
"scopeguard",
"serde",
"serde_json",
- "sha2 0.10.8",
- "thiserror 2.0.17",
- "tokio-tungstenite 0.20.1",
+ "sha2 0.10.9",
+ "thiserror 2.0.18",
+ "tokio-tungstenite 0.29.0",
"url",
]
[[package]]
name = "livekit-protocol"
-version = "0.7.5"
+version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6cf1cc4ab39d7857fb31be648f43aa7068acb54a6960270dccd300dd5c8d0a98"
+checksum = "dd59f3759f1a14e60b6bc6d4d415414e1aed686c8e4d2c7862542d95301cdc70"
dependencies = [
- "futures-util",
- "livekit-runtime",
- "parking_lot",
"pbjson",
"pbjson-types",
"prost 0.12.6",
"serde",
- "thiserror 2.0.17",
- "tokio",
-]
-
-[[package]]
-name = "livekit-runtime"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "532e84c6cdc5fe774f2b5d9912597b5f3bea561927a48296d03e24549d21c3f6"
-dependencies = [
- "tokio",
- "tokio-stream",
]
[[package]]
@@ -6173,7 +6207,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"futures",
- "http 1.3.1",
+ "http 1.4.0",
"reqwest 0.13.3",
"serde",
"serde_json",
@@ -6210,42 +6244,36 @@ dependencies = [
[[package]]
name = "lock_api"
-version = "0.4.12"
+version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
+checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
dependencies = [
- "autocfg",
"scopeguard",
]
-[[package]]
-name = "lockfree-object-pool"
-version = "0.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e"
-
[[package]]
name = "log"
-version = "0.4.26"
+version = "0.4.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
+checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
[[package]]
name = "lol_html"
-version = "2.4.0"
+version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26a24302899fc10d7a785ea5d810ba3c41faa37d0f77847d9f0b16195d3c7a6c"
+checksum = "00aad58f6ec3990e795943872f13651e7a5fa59dca2c8f31a74faf8a0e0fb652"
dependencies = [
"bitflags 2.11.1",
"cfg-if",
- "cssparser 0.35.0",
+ "cssparser 0.36.0",
"encoding_rs",
- "hashbrown 0.15.2",
+ "foldhash 0.2.0",
+ "hashbrown 0.17.1",
"memchr",
"mime",
"precomputed-hash",
- "selectors 0.27.0",
- "thiserror 2.0.17",
+ "selectors 0.37.0",
+ "thiserror 2.0.18",
]
[[package]]
@@ -6259,9 +6287,9 @@ dependencies = [
[[package]]
name = "lru"
-version = "0.16.3"
+version = "0.16.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1dc47f592c06f33f8e3aea9591776ec7c9f9e4124778ff8a3c3b87159f7e593"
+checksum = "7f66e8d5d03f609abc3a39e6f08e4164ebf1447a732906d39eb9b99b7919ef39"
dependencies = [
"hashbrown 0.16.1",
]
@@ -6307,15 +6335,15 @@ dependencies = [
"axum",
"axum-extra",
"cookie",
- "jsonwebtoken 10.3.0 (git+https://github.com/whutchinson98/jsonwebtoken)",
+ "jsonwebtoken 10.3.0",
"macro_env",
"macro_env_var",
"macro_user_id",
- "rand 0.9.3",
+ "rand 0.9.4",
"remote_env_var",
"serde",
"serde_json",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
]
@@ -6328,7 +6356,7 @@ dependencies = [
"aws-sdk-s3",
"aws-sdk-sqs",
"macro_env_var",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"url",
]
@@ -6359,7 +6387,7 @@ dependencies = [
name = "macro_db_client"
version = "0.1.0"
dependencies = [
- "ai",
+ "agent",
"anyhow",
"async-recursion",
"async-trait",
@@ -6380,12 +6408,12 @@ dependencies = [
"models_permissions",
"models_team",
"non_empty",
- "rand 0.9.3",
+ "rand 0.9.4",
"serde",
"serde_json",
"sqlx",
"system_properties",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"user_quota",
@@ -6423,7 +6451,7 @@ dependencies = [
"macro_env_var",
"serde",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
]
@@ -6432,7 +6460,7 @@ name = "macro_env_var"
version = "0.1.0"
dependencies = [
"paste",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
]
@@ -6462,9 +6490,9 @@ dependencies = [
"serde_json",
"serde_urlencoded",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
"url",
"urlencoding",
@@ -6514,9 +6542,9 @@ dependencies = [
name = "macro_tower_layers"
version = "0.1.0"
dependencies = [
- "http 1.3.1",
+ "http 1.4.0",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
]
@@ -6529,7 +6557,7 @@ dependencies = [
"doppleganger",
"nom 8.0.0",
"serde",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"utoipa",
]
@@ -6544,9 +6572,9 @@ dependencies = [
[[package]]
name = "mail-builder"
-version = "0.4.3"
+version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0926cff74776d4af100a95c90a6649486659526ce638bee6648ecc9c41051810"
+checksum = "900998f307338c4013a28ab14d760b784067324b164448c6d98a89e44810473b"
dependencies = [
"gethostname",
]
@@ -6582,17 +6610,6 @@ dependencies = [
"tendril",
]
-[[package]]
-name = "markup5ever"
-version = "0.16.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d0a8096766c229e8c88a3900c9b44b7e06aa7f7343cc229158c3e58ef8f9973a"
-dependencies = [
- "log",
- "tendril",
- "web_atoms",
-]
-
[[package]]
name = "markup5ever"
version = "0.35.0"
@@ -6604,17 +6621,6 @@ dependencies = [
"web_atoms",
]
-[[package]]
-name = "match_token"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88a9689d8d44bf9964484516275f5cd4c9b59457a6940c1d5d0ecbb94510a36b"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.117",
-]
-
[[package]]
name = "match_token"
version = "0.35.0"
@@ -6692,9 +6698,9 @@ dependencies = [
"redis",
"serde",
"serde_json",
- "sha2 0.10.8",
- "thiserror 2.0.17",
- "tower 0.5.2",
+ "sha2 0.10.9",
+ "thiserror 2.0.18",
+ "tower 0.5.3",
"tower-http",
"tracing",
"url",
@@ -6707,7 +6713,7 @@ name = "mcp_client"
version = "0.1.0"
dependencies = [
"aes-gcm",
- "ai",
+ "agent",
"ai_toolset",
"anyhow",
"async-openai",
@@ -6722,11 +6728,11 @@ dependencies = [
"redis",
"reqwest 0.13.3",
"rmcp",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"utoipa",
]
@@ -6752,7 +6758,7 @@ dependencies = [
"entity_access_management",
"frecency",
"fusionauth",
- "http 1.3.1",
+ "http 1.4.0",
"lexical_client",
"macro_auth",
"macro_aws_config",
@@ -6800,15 +6806,15 @@ dependencies = [
[[package]]
name = "memchr"
-version = "2.7.4"
+version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
+checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
[[package]]
name = "memory"
version = "0.1.0"
dependencies = [
- "ai",
+ "agent",
"ai_tools",
"ai_toolset",
"anyhow",
@@ -6843,7 +6849,7 @@ dependencies = [
"sqlx",
"sqs_client",
"sync_service_client",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"utoipa",
@@ -6858,7 +6864,7 @@ dependencies = [
"nom 8.0.0",
"serde",
"serde_json",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
]
[[package]]
@@ -6923,19 +6929,19 @@ checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
dependencies = [
"libc",
"log",
- "wasi 0.11.0+wasi-snapshot-preview1",
+ "wasi 0.11.1+wasi-snapshot-preview1",
"windows-sys 0.48.0",
]
[[package]]
name = "mio"
-version = "1.0.3"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
+checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
dependencies = [
"libc",
- "wasi 0.11.0+wasi-snapshot-preview1",
- "windows-sys 0.52.0",
+ "wasi 0.11.1+wasi-snapshot-preview1",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -6978,7 +6984,7 @@ dependencies = [
name = "model"
version = "0.1.0"
dependencies = [
- "ai",
+ "agent",
"anyhow",
"axum",
"base64 0.22.1",
@@ -6994,13 +7000,13 @@ dependencies = [
"models_comms",
"models_pagination",
"models_permissions",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"serde_repr",
"sqlx",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"utoipa",
"uuid",
@@ -7033,7 +7039,7 @@ dependencies = [
"serde",
"serde_json",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"utoipa",
]
@@ -7069,7 +7075,7 @@ dependencies = [
"axum",
"macro_user_id",
"serde",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"utoipa",
"uuid",
]
@@ -7094,7 +7100,7 @@ dependencies = [
"macro_user_id",
"serde",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"uuid",
]
@@ -7117,13 +7123,13 @@ dependencies = [
"email_utils",
"macro_user_id",
"models_pagination",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"serde_with",
"sqlx",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"utoipa",
"uuid",
]
@@ -7165,7 +7171,7 @@ dependencies = [
"ordered-float",
"serde",
"serde_json",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
]
@@ -7174,7 +7180,7 @@ name = "models_permissions"
version = "0.1.0"
dependencies = [
"model_file_type",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"sqlx",
@@ -7191,7 +7197,7 @@ dependencies = [
"serde_json",
"serde_with",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"utoipa",
"uuid",
@@ -7208,7 +7214,7 @@ dependencies = [
"models_opensearch",
"models_soup",
"opensearch_client",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"strum",
@@ -7289,9 +7295,9 @@ dependencies = [
[[package]]
name = "moxcms"
-version = "0.7.9"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fbdd3d7436f8b5e892b8b7ea114271ff0fa00bc5acae845d53b07d498616ef6"
+checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"
dependencies = [
"num-traits",
"pxfm",
@@ -7306,7 +7312,7 @@ dependencies = [
"bytes",
"encoding_rs",
"futures-util",
- "http 1.3.1",
+ "http 1.4.0",
"httparse",
"memchr",
"mime",
@@ -7340,12 +7346,21 @@ dependencies = [
"regex",
"serde",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"uuid",
]
+[[package]]
+name = "nanoid"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ffa00dec017b5b1a8b7cf5e2c008bfda1aa7e0697ac1508b491fdf2622fb4d8"
+dependencies = [
+ "rand 0.8.6",
+]
+
[[package]]
name = "native_app_server"
version = "0.1.0"
@@ -7354,7 +7369,7 @@ dependencies = [
"native_app_service",
"rootcause",
"semver",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"tokio",
"tower-http",
"tracing",
@@ -7374,9 +7389,9 @@ dependencies = [
"semver",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"url",
@@ -7411,9 +7426,9 @@ dependencies = [
[[package]]
name = "nix"
-version = "0.30.1"
+version = "0.31.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
+checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"
dependencies = [
"bitflags 2.11.1",
"cfg-if",
@@ -7421,6 +7436,15 @@ dependencies = [
"libc",
]
+[[package]]
+name = "no_std_io2"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "nom"
version = "7.1.3"
@@ -7458,7 +7482,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
name = "notification"
version = "0.1.0"
dependencies = [
- "ai",
+ "ai_toolset",
"anyhow",
"aquamarine",
"async-trait",
@@ -7490,15 +7514,15 @@ dependencies = [
"redis",
"reqwest 0.13.3",
"rootcause",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"sqlx",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
"url",
"utoipa",
@@ -7547,7 +7571,7 @@ dependencies = [
"rootcause",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"sqlx",
"tokio",
"tracing",
@@ -7600,12 +7624,12 @@ dependencies = [
"secretsmanager_client",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"sns_client",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"url",
@@ -7616,11 +7640,11 @@ dependencies = [
[[package]]
name = "nu-ansi-term"
-version = "0.50.1"
+version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399"
+checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
- "windows-sys 0.52.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -7644,16 +7668,16 @@ dependencies = [
"num-integer",
"num-iter",
"num-traits",
- "rand 0.8.5",
+ "rand 0.8.6",
"smallvec",
"zeroize",
]
[[package]]
name = "num-conv"
-version = "0.2.0"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050"
+checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"
[[package]]
name = "num-derive"
@@ -7715,13 +7739,13 @@ checksum = "51e219e79014df21a225b1860a479e2dcd7cbd9130f4defd4bd0e191ea31d67d"
dependencies = [
"base64 0.22.1",
"chrono",
- "getrandom 0.2.15",
- "http 1.3.1",
- "rand 0.8.5",
+ "getrandom 0.2.17",
+ "http 1.4.0",
+ "rand 0.8.6",
"serde",
"serde_json",
"serde_path_to_error",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"thiserror 1.0.69",
"url",
]
@@ -7887,14 +7911,20 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.21.3"
+version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
dependencies = [
"critical-section",
"portable-atomic",
]
+[[package]]
+name = "once_cell_polyfill"
+version = "1.70.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
+
[[package]]
name = "opaque-debug"
version = "0.3.1"
@@ -7903,16 +7933,16 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
name = "opensearch"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a62b025c3503d3d53eaba3b6f14adb955af9f69fc71141b4d030a4e5331f5d42"
+checksum = "2af6815a23449a0860c8fe049a828c3589d3ad56d3b5875d0d1f340d1291871e"
dependencies = [
"base64 0.22.1",
"bytes",
"dyn-clone",
"lazy_static",
"percent-encoding",
- "reqwest 0.12.28",
+ "reqwest 0.13.3",
"rustc_version",
"serde",
"serde_json",
@@ -7935,7 +7965,7 @@ dependencies = [
"serde",
"serde_json",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"uuid",
@@ -7951,9 +7981,9 @@ dependencies = [
[[package]]
name = "openssl-probe"
-version = "0.1.6"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
+checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
[[package]]
name = "opentelemetry"
@@ -7965,7 +7995,7 @@ dependencies = [
"futures-sink",
"js-sys",
"pin-project-lite",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
]
@@ -7977,23 +8007,23 @@ checksum = "d7a6d09a73194e6b66df7c8f1b680f156d916a1a942abf2de06823dd02b7855d"
dependencies = [
"async-trait",
"bytes",
- "http 1.3.1",
+ "http 1.4.0",
"opentelemetry",
]
[[package]]
name = "opentelemetry-otlp"
-version = "0.31.0"
+version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a2366db2dca4d2ad033cad11e6ee42844fd727007af5ad04a1730f4cb8163bf"
+checksum = "1f69cd6acbb9af919df949cd1ec9e5e7fdc2ef15d234b6b795aaa525cc02f71f"
dependencies = [
- "http 1.3.1",
+ "http 1.4.0",
"opentelemetry",
"opentelemetry-http",
"opentelemetry-proto",
"opentelemetry_sdk",
"prost 0.14.3",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tonic",
"tracing",
@@ -8023,17 +8053,17 @@ dependencies = [
"futures-util",
"opentelemetry",
"percent-encoding",
- "rand 0.9.3",
- "thiserror 2.0.17",
+ "rand 0.9.4",
+ "thiserror 2.0.18",
"tokio",
"tokio-stream",
]
[[package]]
name = "ordered-float"
-version = "5.1.0"
+version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f4779c6901a562440c3786d08192c6fbda7c1c2060edd10006b05ee35d10f2d"
+checksum = "b7d950ca161dc355eaf28f82b11345ed76c6e1f6eb1f4f4479e0323b9e2fbd0e"
dependencies = [
"num-traits",
]
@@ -8073,13 +8103,13 @@ dependencies = [
[[package]]
name = "os_info"
-version = "3.14.0"
+version = "3.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4022a17595a00d6a369236fdae483f0de7f0a339960a53118b818238e132224"
+checksum = "9cf20a545b305cf1da722b236b5155c9bb35f1d5ceb28c048bd96ca842f41b5b"
dependencies = [
"android_system_properties",
"log",
- "nix 0.30.1",
+ "nix 0.31.3",
"objc2",
"objc2-foundation",
"objc2-ui-kit",
@@ -8093,27 +8123,16 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e"
-[[package]]
-name = "p256"
-version = "0.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594"
-dependencies = [
- "ecdsa 0.14.8",
- "elliptic-curve 0.12.3",
- "sha2 0.10.8",
-]
-
[[package]]
name = "p256"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b"
dependencies = [
- "ecdsa 0.16.9",
- "elliptic-curve 0.13.8",
+ "ecdsa",
+ "elliptic-curve",
"primeorder",
- "sha2 0.10.8",
+ "sha2 0.10.9",
]
[[package]]
@@ -8122,10 +8141,10 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6"
dependencies = [
- "ecdsa 0.16.9",
- "elliptic-curve 0.13.8",
+ "ecdsa",
+ "elliptic-curve",
"primeorder",
- "sha2 0.10.8",
+ "sha2 0.10.9",
]
[[package]]
@@ -8136,9 +8155,9 @@ checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
[[package]]
name = "parking_lot"
-version = "0.12.3"
+version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
dependencies = [
"lock_api",
"parking_lot_core",
@@ -8146,15 +8165,15 @@ dependencies = [
[[package]]
name = "parking_lot_core"
-version = "0.9.10"
+version = "0.9.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
dependencies = [
"cfg-if",
"libc",
- "redox_syscall",
+ "redox_syscall 0.5.18",
"smallvec",
- "windows-targets 0.52.6",
+ "windows-link",
]
[[package]]
@@ -8171,9 +8190,9 @@ checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
[[package]]
name = "pastey"
-version = "0.2.1"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b867cad97c0791bbd3aaa6472142568c6c9e8f71937e98379f584cfb0cf35bec"
+checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4"
[[package]]
name = "pbjson"
@@ -8224,9 +8243,9 @@ dependencies = [
[[package]]
name = "pdfium-render"
-version = "0.8.30"
+version = "0.8.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2773a939ec2c736640f5f2e62a325c2e1a997d694961c50f17cadfb4c8682e84"
+checksum = "6553f6604a52b3203db7b4e9d51eb4dd193cf455af9e56d40cab6575b547b679"
dependencies = [
"bitflags 2.11.1",
"bytemuck",
@@ -8237,7 +8256,7 @@ dependencies = [
"image",
"itertools 0.14.0",
"js-sys",
- "libloading",
+ "libloading 0.9.0",
"log",
"maybe-owned",
"once_cell",
@@ -8250,12 +8269,12 @@ dependencies = [
[[package]]
name = "pem"
-version = "3.0.5"
+version = "3.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38af38e8470ac9dee3ce1bae1af9c1671fffc44ddfd8bd1d0a3445bf349a8ef3"
+checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be"
dependencies = [
"base64 0.22.1",
- "serde",
+ "serde_core",
]
[[package]]
@@ -8269,9 +8288,9 @@ dependencies = [
[[package]]
name = "percent-encoding"
-version = "2.3.1"
+version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
name = "petgraph"
@@ -8309,7 +8328,7 @@ version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
dependencies = [
- "phf_macros",
+ "phf_macros 0.11.3",
"phf_shared 0.11.3",
]
@@ -8322,6 +8341,17 @@ dependencies = [
"phf_shared 0.12.1",
]
+[[package]]
+name = "phf"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"
+dependencies = [
+ "phf_macros 0.13.1",
+ "phf_shared 0.13.1",
+ "serde",
+]
+
[[package]]
name = "phf_codegen"
version = "0.10.0"
@@ -8342,6 +8372,16 @@ dependencies = [
"phf_shared 0.11.3",
]
+[[package]]
+name = "phf_codegen"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1"
+dependencies = [
+ "phf_generator 0.13.1",
+ "phf_shared 0.13.1",
+]
+
[[package]]
name = "phf_generator"
version = "0.10.0"
@@ -8349,7 +8389,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
dependencies = [
"phf_shared 0.10.0",
- "rand 0.8.5",
+ "rand 0.8.6",
]
[[package]]
@@ -8359,7 +8399,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
dependencies = [
"phf_shared 0.11.3",
- "rand 0.8.5",
+ "rand 0.8.6",
+]
+
+[[package]]
+name = "phf_generator"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"
+dependencies = [
+ "fastrand 2.4.1",
+ "phf_shared 0.13.1",
]
[[package]]
@@ -8375,6 +8425,19 @@ dependencies = [
"syn 2.0.117",
]
+[[package]]
+name = "phf_macros"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef"
+dependencies = [
+ "phf_generator 0.13.1",
+ "phf_shared 0.13.1",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
[[package]]
name = "phf_shared"
version = "0.10.0"
@@ -8390,7 +8453,7 @@ version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
dependencies = [
- "siphasher 1.0.1",
+ "siphasher 1.0.3",
]
[[package]]
@@ -8399,23 +8462,32 @@ version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981"
dependencies = [
- "siphasher 1.0.1",
+ "siphasher 1.0.3",
+]
+
+[[package]]
+name = "phf_shared"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266"
+dependencies = [
+ "siphasher 1.0.3",
]
[[package]]
name = "pin-project"
-version = "1.1.9"
+version = "1.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dfe2e71e1471fe07709406bf725f710b02927c9c54b2b5b2ec0e8087d97c327d"
+checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
-version = "1.1.9"
+version = "1.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6e859e6e5bd50440ab63c47e3ebabc90f26251f7c73c3d3e837b74a1cc3fa67"
+checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b"
dependencies = [
"proc-macro2",
"quote",
@@ -8424,9 +8496,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
-version = "0.2.16"
+version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]]
name = "pin-utils"
@@ -8446,19 +8518,9 @@ version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
dependencies = [
- "der 0.7.9",
- "pkcs8 0.10.2",
- "spki 0.7.3",
-]
-
-[[package]]
-name = "pkcs8"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba"
-dependencies = [
- "der 0.6.1",
- "spki 0.6.0",
+ "der",
+ "pkcs8",
+ "spki",
]
[[package]]
@@ -8467,21 +8529,27 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
dependencies = [
- "der 0.7.9",
- "spki 0.7.3",
+ "der",
+ "spki",
]
[[package]]
name = "pkg-config"
-version = "0.3.31"
+version = "0.3.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e"
+
+[[package]]
+name = "plain"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
+checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
[[package]]
name = "png"
-version = "0.18.0"
+version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97baced388464909d42d89643fe4361939af9b7ce7a31ee32a168f832a70f2a0"
+checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
dependencies = [
"bitflags 2.11.1",
"crc32fast",
@@ -8521,7 +8589,7 @@ dependencies = [
"hmac 0.13.0",
"md-5 0.11.0",
"memchr",
- "rand 0.10.0",
+ "rand 0.10.1",
"sha2 0.11.0",
"stringprep",
]
@@ -8537,6 +8605,15 @@ dependencies = [
"postgres-protocol",
]
+[[package]]
+name = "potential_utf"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"
+dependencies = [
+ "zerovec",
+]
+
[[package]]
name = "powerfmt"
version = "0.2.0"
@@ -8545,11 +8622,11 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "ppv-lite86"
-version = "0.2.20"
+version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
+checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
dependencies = [
- "zerocopy 0.7.35",
+ "zerocopy",
]
[[package]]
@@ -8560,9 +8637,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
[[package]]
name = "predicates"
-version = "3.1.3"
+version = "3.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573"
+checksum = "ada8f2932f28a27ee7b70dd6c1c39ea0675c55a36879ab92f3a715eaa1e63cfe"
dependencies = [
"anstyle",
"predicates-core",
@@ -8570,15 +8647,15 @@ dependencies = [
[[package]]
name = "predicates-core"
-version = "1.0.9"
+version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa"
+checksum = "cad38746f3166b4031b1a0d39ad9f954dd291e7854fcc0eed52ee41a0b50d144"
[[package]]
name = "predicates-tree"
-version = "1.0.12"
+version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c"
+checksum = "d0de1b847b39c8131db0467e9df1ff60e6d0562ab8e9a16e568ad0fdb372e2f2"
dependencies = [
"predicates-core",
"termtree",
@@ -8586,9 +8663,9 @@ dependencies = [
[[package]]
name = "prettyplease"
-version = "0.2.32"
+version = "0.2.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6"
+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
dependencies = [
"proc-macro2",
"syn 2.0.117",
@@ -8600,7 +8677,26 @@ version = "0.13.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6"
dependencies = [
- "elliptic-curve 0.13.8",
+ "elliptic-curve",
+]
+
+[[package]]
+name = "proc-macro-crate"
+version = "1.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
+dependencies = [
+ "once_cell",
+ "toml_edit 0.19.15",
+]
+
+[[package]]
+name = "proc-macro-crate"
+version = "3.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f"
+dependencies = [
+ "toml_edit 0.25.11+spec-1.1.0",
]
[[package]]
@@ -8647,18 +8743,18 @@ dependencies = [
[[package]]
name = "profiling"
-version = "1.0.16"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d"
+checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5"
dependencies = [
"profiling-procmacros",
]
[[package]]
name = "profiling-procmacros"
-version = "1.0.16"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30"
+checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb"
dependencies = [
"quote",
"syn 2.0.117",
@@ -8668,7 +8764,7 @@ dependencies = [
name = "properties"
version = "0.1.0"
dependencies = [
- "ai",
+ "ai_toolset",
"anyhow",
"async-trait",
"chrono",
@@ -8686,12 +8782,12 @@ dependencies = [
"models_permissions",
"models_properties",
"notification",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"sqlx",
"system_properties",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"uuid",
@@ -8709,7 +8805,7 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"uuid",
]
@@ -8744,9 +8840,9 @@ dependencies = [
"serde_with",
"sqlx",
"system_properties",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"utoipa",
@@ -8781,7 +8877,7 @@ checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4"
dependencies = [
"bytes",
"heck 0.5.0",
- "itertools 0.11.0",
+ "itertools 0.12.1",
"log",
"multimap",
"once_cell",
@@ -8801,7 +8897,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1"
dependencies = [
"anyhow",
- "itertools 0.11.0",
+ "itertools 0.12.1",
"proc-macro2",
"quote",
"syn 2.0.117",
@@ -8831,12 +8927,9 @@ dependencies = [
[[package]]
name = "pxfm"
-version = "0.1.25"
+version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3cbdf373972bf78df4d3b518d07003938e2c7d1fb5891e55f9cb6df57009d84"
-dependencies = [
- "num-traits",
-]
+checksum = "e0c5ccf5294c6ccd63a74f1565028353830a9c2f5eb0c682c355c471726a6e3f"
[[package]]
name = "qoi"
@@ -8855,20 +8948,22 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
[[package]]
name = "quinn"
-version = "0.11.6"
+version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef"
+checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20"
dependencies = [
"bytes",
+ "cfg_aliases",
"pin-project-lite",
"quinn-proto",
"quinn-udp",
- "rustc-hash 2.1.1",
- "rustls 0.23.36",
- "socket2 0.5.10",
- "thiserror 2.0.17",
+ "rustc-hash 2.1.2",
+ "rustls 0.23.40",
+ "socket2 0.6.3",
+ "thiserror 2.0.18",
"tokio",
"tracing",
+ "web-time",
]
[[package]]
@@ -8879,15 +8974,15 @@ checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098"
dependencies = [
"aws-lc-rs",
"bytes",
- "getrandom 0.3.1",
+ "getrandom 0.3.4",
"lru-slab",
- "rand 0.9.3",
+ "rand 0.9.4",
"ring",
- "rustc-hash 2.1.1",
- "rustls 0.23.36",
+ "rustc-hash 2.1.2",
+ "rustls 0.23.40",
"rustls-pki-types",
"slab",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tinyvec",
"tracing",
"web-time",
@@ -8895,16 +8990,16 @@ dependencies = [
[[package]]
name = "quinn-udp"
-version = "0.5.9"
+version = "0.5.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c40286217b4ba3a71d644d752e6a0b71f13f1b6a2c5311acfcbe0c2418ed904"
+checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd"
dependencies = [
"cfg_aliases",
"libc",
"once_cell",
- "socket2 0.5.10",
+ "socket2 0.6.3",
"tracing",
- "windows-sys 0.59.0",
+ "windows-sys 0.60.2",
]
[[package]]
@@ -8918,9 +9013,15 @@ dependencies = [
[[package]]
name = "quoted_printable"
-version = "0.5.1"
+version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "640c9bd8497b02465aeef5375144c26062e0dcd5939dfcbb0f5db76cb8c17c73"
+checksum = "478e0585659a122aa407eb7e3c0e1fa51b1d8a870038bd29f0cf4a8551eea972"
+
+[[package]]
+name = "r-efi"
+version = "5.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]]
name = "r-efi"
@@ -8943,9 +9044,9 @@ dependencies = [
[[package]]
name = "rand"
-version = "0.8.5"
+version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
+checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
dependencies = [
"libc",
"rand_chacha 0.3.1",
@@ -8954,23 +9055,23 @@ dependencies = [
[[package]]
name = "rand"
-version = "0.9.3"
+version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ec095654a25171c2124e9e3393a930bddbffdc939556c914957a4c3e0a87166"
+checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea"
dependencies = [
"rand_chacha 0.9.0",
- "rand_core 0.9.0",
+ "rand_core 0.9.5",
]
[[package]]
name = "rand"
-version = "0.10.0"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc266eb313df6c5c09c1c7b1fbe2510961e5bcd3add930c1e31f7ed9da0feff8"
+checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207"
dependencies = [
"chacha20",
"getrandom 0.4.2",
- "rand_core 0.10.0",
+ "rand_core 0.10.1",
]
[[package]]
@@ -9000,7 +9101,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
- "rand_core 0.9.0",
+ "rand_core 0.9.5",
]
[[package]]
@@ -9018,24 +9119,23 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
- "getrandom 0.2.15",
+ "getrandom 0.2.17",
]
[[package]]
name = "rand_core"
-version = "0.9.0"
+version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b08f3c9802962f7e1b25113931d94f43ed9725bebc59db9d0c3e9a23b67e15ff"
+checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
dependencies = [
- "getrandom 0.3.1",
- "zerocopy 0.8.17",
+ "getrandom 0.3.4",
]
[[package]]
name = "rand_core"
-version = "0.10.0"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba"
+checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
[[package]]
name = "rand_hc"
@@ -9056,7 +9156,7 @@ dependencies = [
"redis",
"rootcause",
"serde",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"twox-hash",
@@ -9069,7 +9169,7 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b"
dependencies = [
- "aligned-vec 0.6.4",
+ "aligned-vec",
"arbitrary",
"arg_enum_proc_macro",
"arrayvec",
@@ -9090,19 +9190,19 @@ dependencies = [
"num-traits",
"paste",
"profiling",
- "rand 0.9.3",
+ "rand 0.9.4",
"rand_chacha 0.9.0",
"simd_helpers",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"v_frame",
"wasm-bindgen",
]
[[package]]
name = "ravif"
-version = "0.12.0"
+version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef69c1990ceef18a116855938e74793a5f7496ee907562bd0857b6ac734ab285"
+checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45"
dependencies = [
"avif-serialize",
"imgref",
@@ -9115,9 +9215,9 @@ dependencies = [
[[package]]
name = "rayon"
-version = "1.10.0"
+version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
+checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
dependencies = [
"either",
"rayon-core",
@@ -9125,9 +9225,9 @@ dependencies = [
[[package]]
name = "rayon-core"
-version = "1.12.1"
+version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
+checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
dependencies = [
"crossbeam-deque",
"crossbeam-utils",
@@ -9148,11 +9248,12 @@ checksum = "9dba2197bf7b1d87b4dd460c195f4edeb45a94e82e8054f8d5f317c1f0e93ca1"
[[package]]
name = "redis"
-version = "1.0.3"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e969d1d702793536d5fda739a82b88ad7cbe7d04f8386ee8cd16ad3eff4854a5"
+checksum = "72d32a1ac9123f0d84fda64bfc02a271d9868483162dd2d9099b5c362ece064c"
dependencies = [
"arcstr",
+ "async-lock",
"bytes",
"cfg-if",
"combine",
@@ -9163,12 +9264,12 @@ dependencies = [
"num-bigint",
"percent-encoding",
"pin-project-lite",
- "rand 0.9.3",
- "rustls 0.23.36",
+ "rand 0.9.4",
+ "rustls 0.23.40",
"rustls-native-certs",
"ryu",
"sha1_smol",
- "socket2 0.6.1",
+ "socket2 0.6.3",
"tokio",
"tokio-rustls 0.26.4",
"tokio-util",
@@ -9178,27 +9279,36 @@ dependencies = [
[[package]]
name = "redox_syscall"
-version = "0.5.8"
+version = "0.5.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
+dependencies = [
+ "bitflags 2.11.1",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
+checksum = "4666a1a60d8412eab19d94f6d13dcc9cea0a5ef4fdf6a5db306537413c661b1b"
dependencies = [
"bitflags 2.11.1",
]
[[package]]
name = "ref-cast"
-version = "1.0.24"
+version = "1.0.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf"
+checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d"
dependencies = [
"ref-cast-impl",
]
[[package]]
name = "ref-cast-impl"
-version = "1.0.24"
+version = "1.0.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7"
+checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da"
dependencies = [
"proc-macro2",
"quote",
@@ -9230,9 +9340,9 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
"url",
"urlencoding",
@@ -9242,9 +9352,9 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.12.2"
+version = "1.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
+checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
dependencies = [
"aho-corasick",
"memchr",
@@ -9254,9 +9364,9 @@ dependencies = [
[[package]]
name = "regex-automata"
-version = "0.4.13"
+version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
+checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
dependencies = [
"aho-corasick",
"memchr",
@@ -9265,22 +9375,22 @@ dependencies = [
[[package]]
name = "regex-lite"
-version = "0.1.6"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a"
+checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973"
[[package]]
name = "regex-syntax"
-version = "0.8.5"
+version = "0.8.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
+checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
[[package]]
name = "remote_env_var"
version = "0.1.0"
dependencies = [
"macro_env",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
]
@@ -9293,18 +9403,18 @@ dependencies = [
"base64 0.22.1",
"bytes",
"futures-core",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-body-util",
- "hyper 1.6.0",
- "hyper-rustls 0.27.5",
+ "hyper 1.9.0",
+ "hyper-rustls 0.27.9",
"hyper-util",
"js-sys",
"log",
"percent-encoding",
"pin-project-lite",
"quinn",
- "rustls 0.23.36",
+ "rustls 0.23.40",
"rustls-pki-types",
"serde",
"serde_json",
@@ -9312,14 +9422,14 @@ dependencies = [
"sync_wrapper",
"tokio",
"tokio-rustls 0.26.4",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
- "webpki-roots 1.0.5",
+ "webpki-roots 1.0.7",
]
[[package]]
@@ -9330,23 +9440,26 @@ checksum = "62e0021ea2c22aed41653bc7e1419abb2c97e038ff2c33d0e1309e49a97deec0"
dependencies = [
"base64 0.22.1",
"bytes",
+ "encoding_rs",
"futures-core",
"futures-util",
+ "h2 0.4.14",
"hickory-resolver",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-body-util",
- "hyper 1.6.0",
- "hyper-rustls 0.27.5",
+ "hyper 1.9.0",
+ "hyper-rustls 0.27.9",
"hyper-util",
"js-sys",
"log",
+ "mime",
"mime_guess",
"once_cell",
"percent-encoding",
"pin-project-lite",
"quinn",
- "rustls 0.23.36",
+ "rustls 0.23.40",
"rustls-pki-types",
"rustls-platform-verifier",
"serde",
@@ -9356,7 +9469,7 @@ dependencies = [
"tokio",
"tokio-rustls 0.26.4",
"tokio-util",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tower-service",
"url",
@@ -9372,17 +9485,6 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7"
-[[package]]
-name = "rfc6979"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb"
-dependencies = [
- "crypto-bigint 0.4.9",
- "hmac 0.12.1",
- "zeroize",
-]
-
[[package]]
name = "rfc6979"
version = "0.4.0"
@@ -9395,49 +9497,99 @@ dependencies = [
[[package]]
name = "rgb"
-version = "0.8.50"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
-
-[[package]]
-name = "ring"
-version = "0.17.14"
+version = "0.8.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
-dependencies = [
- "cc",
- "cfg-if",
- "getrandom 0.2.15",
- "libc",
- "untrusted",
- "windows-sys 0.52.0",
-]
+checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4"
[[package]]
-name = "rmcp"
-version = "1.7.0"
+name = "rig-core"
+version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0810a9f717d9828f475fe1f629f4c305c8464b7f496c3a854b58d29e65f4058e"
+checksum = "a6bd308c89a90f89ce7cd6641a078c7d2a2c55fb5a4147fd48b5a0989c3430bd"
dependencies = [
- "async-trait",
+ "as-any",
+ "async-stream",
"base64 0.22.1",
"bytes",
- "chrono",
+ "eventsource-stream",
+ "fastrand 2.4.1",
"futures",
- "http 1.3.1",
- "http-body 1.0.1",
- "http-body-util",
- "oauth2",
- "pastey 0.2.1",
+ "futures-timer",
+ "glob",
+ "http 1.4.0",
+ "mime",
+ "mime_guess",
+ "nanoid",
+ "ordered-float",
"pin-project-lite",
- "rand 0.10.0",
+ "reqwest 0.13.3",
+ "rig-derive",
+ "schemars 1.2.1",
+ "serde",
+ "serde_json",
+ "thiserror 2.0.18",
+ "tokio",
+ "tokio-tungstenite 0.23.1",
+ "tracing",
+ "tracing-futures",
+ "url",
+]
+
+[[package]]
+name = "rig-derive"
+version = "0.1.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ba9149c63403a49ddfd5d373860487e6feef0021bfe5329812d1c4e72ee207c"
+dependencies = [
+ "convert_case",
+ "deluxe",
+ "indoc",
+ "proc-macro-crate 3.5.0",
+ "proc-macro2",
+ "quote",
+ "serde_json",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "ring"
+version = "0.17.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
+dependencies = [
+ "cc",
+ "cfg-if",
+ "getrandom 0.2.17",
+ "libc",
+ "untrusted",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "rmcp"
+version = "1.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0810a9f717d9828f475fe1f629f4c305c8464b7f496c3a854b58d29e65f4058e"
+dependencies = [
+ "async-trait",
+ "base64 0.22.1",
+ "bytes",
+ "chrono",
+ "futures",
+ "http 1.4.0",
+ "http-body 1.0.1",
+ "http-body-util",
+ "oauth2",
+ "pastey 0.2.3",
+ "pin-project-lite",
+ "rand 0.10.1",
"reqwest 0.13.3",
"rmcp-macros",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"sse-stream",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tokio-stream",
"tokio-util",
@@ -9469,7 +9621,7 @@ dependencies = [
"macro_user_id",
"non_empty",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
]
@@ -9483,7 +9635,7 @@ dependencies = [
"hashbrown 0.16.1",
"indexmap 2.14.0",
"rootcause-internals",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
"triomphe",
]
@@ -9517,20 +9669,20 @@ dependencies = [
"num-integer",
"num-traits",
"pkcs1",
- "pkcs8 0.10.2",
+ "pkcs8",
"rand_core 0.6.4",
"sha1 0.10.6",
- "signature 2.2.0",
- "spki 0.7.3",
+ "signature",
+ "spki",
"subtle",
"zeroize",
]
[[package]]
name = "rust-embed"
-version = "8.6.0"
+version = "8.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b3aba5104622db5c9fc61098de54708feb732e7763d7faa2fa625899f00bf6f"
+checksum = "04113cb9355a377d83f06ef1f0a45b8ab8cd7d8b1288160717d66df5c7988d27"
dependencies = [
"rust-embed-impl",
"rust-embed-utils",
@@ -9539,9 +9691,9 @@ dependencies = [
[[package]]
name = "rust-embed-impl"
-version = "8.6.0"
+version = "8.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f198c73be048d2c5aa8e12f7960ad08443e56fd39cc26336719fdb4ea0ebaae"
+checksum = "da0902e4c7c8e997159ab384e6d0fc91c221375f6894346ae107f47dd0f3ccaa"
dependencies = [
"proc-macro2",
"quote",
@@ -9552,11 +9704,11 @@ dependencies = [
[[package]]
name = "rust-embed-utils"
-version = "8.6.0"
+version = "8.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a2fcdc9f40c8dc2922842ca9add611ad19f332227fc651d015881ad1552bd9a"
+checksum = "5bcdef0be6fe7f6fa333b1073c949729274b05f123a0ad7efcb8efd878e5c3b1"
dependencies = [
- "sha2 0.10.8",
+ "sha2 0.10.9",
"walkdir",
]
@@ -9568,9 +9720,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc-hash"
-version = "2.1.1"
+version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
+checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
[[package]]
name = "rustc_version"
@@ -9583,15 +9735,15 @@ dependencies = [
[[package]]
name = "rustix"
-version = "1.0.5"
+version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf"
+checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
dependencies = [
"bitflags 2.11.1",
"errno",
"libc",
"linux-raw-sys",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -9608,24 +9760,24 @@ dependencies = [
[[package]]
name = "rustls"
-version = "0.23.36"
+version = "0.23.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b"
+checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b"
dependencies = [
"aws-lc-rs",
"once_cell",
"ring",
"rustls-pki-types",
- "rustls-webpki 0.103.12",
+ "rustls-webpki 0.103.13",
"subtle",
"zeroize",
]
[[package]]
name = "rustls-native-certs"
-version = "0.8.1"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3"
+checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63"
dependencies = [
"openssl-probe",
"rustls-pki-types",
@@ -9635,9 +9787,9 @@ dependencies = [
[[package]]
name = "rustls-pki-types"
-version = "1.13.2"
+version = "1.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282"
+checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9"
dependencies = [
"web-time",
"zeroize",
@@ -9649,15 +9801,15 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0"
dependencies = [
- "core-foundation",
+ "core-foundation 0.10.1",
"core-foundation-sys",
"jni 0.22.4",
"log",
"once_cell",
- "rustls 0.23.36",
+ "rustls 0.23.40",
"rustls-native-certs",
"rustls-platform-verifier-android",
- "rustls-webpki 0.103.12",
+ "rustls-webpki 0.103.13",
"security-framework",
"security-framework-sys",
"webpki-root-certs",
@@ -9682,9 +9834,9 @@ dependencies = [
[[package]]
name = "rustls-webpki"
-version = "0.103.12"
+version = "0.103.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8279bb85272c9f10811ae6a6c547ff594d6a7f3c6c6b02ee9726d1d0dcfcdd06"
+checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
dependencies = [
"aws-lc-rs",
"ring",
@@ -9694,9 +9846,9 @@ dependencies = [
[[package]]
name = "rustversion"
-version = "1.0.19"
+version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
+checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "ryu"
@@ -9757,18 +9909,18 @@ dependencies = [
[[package]]
name = "schannel"
-version = "0.1.27"
+version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d"
+checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939"
dependencies = [
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
name = "scheduled_action"
version = "0.1.0"
dependencies = [
- "ai",
+ "agent",
"ai_tools",
"ai_toolset",
"anyhow",
@@ -9809,9 +9961,21 @@ dependencies = [
[[package]]
name = "schemars"
-version = "1.0.4"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f"
+dependencies = [
+ "dyn-clone",
+ "ref-cast",
+ "serde",
+ "serde_json",
+]
+
+[[package]]
+name = "schemars"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
+checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc"
dependencies = [
"chrono",
"dyn-clone",
@@ -9824,9 +9988,9 @@ dependencies = [
[[package]]
name = "schemars_derive"
-version = "1.0.4"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33d020396d1d138dc19f1165df7545479dcd58d93810dc5d646a16e55abefa80"
+checksum = "7d115b50f4aaeea07e79c1912f645c7513d81715d0420f8bc77a18c6260b307f"
dependencies = [
"proc-macro2",
"quote",
@@ -9917,10 +10081,10 @@ dependencies = [
"sqs_client",
"sqs_worker",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tokio-util",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"utoipa",
@@ -9966,9 +10130,9 @@ dependencies = [
"serde_json",
"sqlx",
"strum",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"utoipa",
@@ -10001,30 +10165,16 @@ dependencies = [
"tracing",
]
-[[package]]
-name = "sec1"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928"
-dependencies = [
- "base16ct 0.1.1",
- "der 0.6.1",
- "generic-array",
- "pkcs8 0.9.0",
- "subtle",
- "zeroize",
-]
-
[[package]]
name = "sec1"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
dependencies = [
- "base16ct 0.2.0",
- "der 0.7.9",
+ "base16ct",
+ "der",
"generic-array",
- "pkcs8 0.10.2",
+ "pkcs8",
"subtle",
"zeroize",
]
@@ -10047,7 +10197,7 @@ dependencies = [
"macro_env",
"mockall",
"remote_env_var",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
]
@@ -10058,7 +10208,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
dependencies = [
"bitflags 2.11.1",
- "core-foundation",
+ "core-foundation 0.10.1",
"core-foundation-sys",
"libc",
"security-framework-sys",
@@ -10099,7 +10249,7 @@ dependencies = [
"model-entity",
"models_email",
"models_permissions",
- "rand 0.9.3",
+ "rand 0.9.4",
"reqwest 0.13.3",
"serde",
"serde_json",
@@ -10119,7 +10269,7 @@ checksum = "4eb30575f3638fc8f6815f448d50cb1a2e255b0897985c8c59f4d37b72a07b06"
dependencies = [
"bitflags 2.11.1",
"cssparser 0.31.2",
- "derive_more",
+ "derive_more 0.99.20",
"fxhash",
"log",
"new_debug_unreachable",
@@ -10132,30 +10282,31 @@ dependencies = [
[[package]]
name = "selectors"
-version = "0.27.0"
+version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b75e048a93e14929e68e37b82e207db957cbb368375a80ed3ca28ac75080856"
+checksum = "2cfaaa6035167f0e604e42723c7650d59ee269ef220d7bbe0565602c8a0173b9"
dependencies = [
"bitflags 2.11.1",
- "cssparser 0.35.0",
- "derive_more",
- "fxhash",
+ "cssparser 0.36.0",
+ "derive_more 2.1.1",
"log",
"new_debug_unreachable",
- "phf 0.11.3",
- "phf_codegen 0.11.3",
+ "phf 0.13.1",
+ "phf_codegen 0.13.1",
"precomputed-hash",
- "servo_arc 0.4.0",
+ "rustc-hash 2.1.2",
+ "servo_arc 0.4.3",
"smallvec",
]
[[package]]
name = "semver"
-version = "1.0.25"
+version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03"
+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
dependencies = [
"serde",
+ "serde_core",
]
[[package]]
@@ -10201,35 +10352,38 @@ dependencies = [
[[package]]
name = "serde_dynamo"
-version = "4.2.14"
+version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e36c1b1792cfd9de29eb373ee6a4b74650369c096f55db7198ceb7b8921d1f7f"
+checksum = "873a97c3f7a67dd042bceb47d056d288424b82d4c66b0a25e1a3b34675620951"
dependencies = [
"aws-sdk-dynamodb",
"base64 0.21.7",
"serde",
+ "serde_core",
]
[[package]]
name = "serde_json"
-version = "1.0.141"
+version = "1.0.150"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3"
+checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
dependencies = [
"itoa",
"memchr",
- "ryu",
"serde",
+ "serde_core",
+ "zmij",
]
[[package]]
name = "serde_path_to_error"
-version = "0.1.16"
+version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6"
+checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457"
dependencies = [
"itoa",
"serde",
+ "serde_core",
]
[[package]]
@@ -10291,17 +10445,19 @@ dependencies = [
[[package]]
name = "serde_with"
-version = "3.12.0"
+version = "3.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa"
+checksum = "e72c1c2cb7b223fafb600a619537a871c2818583d619401b785e7c0b746ccde2"
dependencies = [
"base64 0.22.1",
+ "bs58",
"chrono",
"hex",
"indexmap 1.9.3",
"indexmap 2.14.0",
- "serde",
- "serde_derive",
+ "schemars 0.9.0",
+ "schemars 1.2.1",
+ "serde_core",
"serde_json",
"serde_with_macros",
"time",
@@ -10309,11 +10465,11 @@ dependencies = [
[[package]]
name = "serde_with_macros"
-version = "3.12.0"
+version = "3.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e"
+checksum = "b90c488738ecb4fb0262f41f43bc40efc5868d9fb744319ddf5f5317f417bfac"
dependencies = [
- "darling 0.20.10",
+ "darling 0.23.0",
"proc-macro2",
"quote",
"syn 2.0.117",
@@ -10321,9 +10477,9 @@ dependencies = [
[[package]]
name = "serial_test"
-version = "3.3.1"
+version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d0b343e184fc3b7bb44dff0705fffcf4b3756ba6aff420dddd8b24ca145e555"
+checksum = "911bd979bf1070a3f3aa7b691a3b3e9968f339ceeec89e08c280a8a22207a32f"
dependencies = [
"futures-executor",
"futures-util",
@@ -10336,9 +10492,9 @@ dependencies = [
[[package]]
name = "serial_test_derive"
-version = "3.3.1"
+version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f50427f258fb77356e4cd4aa0e87e2bd2c66dbcee41dc405282cae2bfc26c83"
+checksum = "0a7d91949b85b0d2fb687445e448b40d322b6b3e4af6b44a29b21d9a5f33e6d9"
dependencies = [
"proc-macro2",
"quote",
@@ -10356,9 +10512,9 @@ dependencies = [
[[package]]
name = "servo_arc"
-version = "0.4.0"
+version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae65c4249478a2647db249fb43e23cec56a2c8974a427e7bd8cb5a1d0964921a"
+checksum = "170fb83ab34de17dc69aa7c67482b22218ddb85da56546f9bd6b929e32a05930"
dependencies = [
"stable_deref_trait",
]
@@ -10403,9 +10559,9 @@ checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
[[package]]
name = "sha2"
-version = "0.10.8"
+version = "0.10.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
dependencies = [
"cfg-if",
"cpufeatures 0.2.17",
@@ -10478,23 +10634,14 @@ dependencies = [
[[package]]
name = "signal-hook-registry"
-version = "1.4.2"
+version = "1.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
+checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
dependencies = [
+ "errno",
"libc",
]
-[[package]]
-name = "signature"
-version = "1.6.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c"
-dependencies = [
- "digest 0.10.7",
- "rand_core 0.6.4",
-]
-
[[package]]
name = "signature"
version = "2.2.0"
@@ -10507,9 +10654,9 @@ dependencies = [
[[package]]
name = "simd-adler32"
-version = "0.3.7"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
+checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
[[package]]
name = "simd_cesu8"
@@ -10538,13 +10685,13 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
[[package]]
name = "simple_asn1"
-version = "0.6.3"
+version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "297f631f50729c8c99b84667867963997ec0b50f32b2a7dbcab828ef0541e8bb"
+checksum = "0d585997b0ac10be3c5ee635f1bab02d512760d14b7c468801ac8a01d9ae5f1d"
dependencies = [
"num-bigint",
"num-traits",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"time",
]
@@ -10556,24 +10703,21 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "siphasher"
-version = "1.0.1"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
+checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649"
[[package]]
name = "slab"
-version = "0.4.9"
+version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
-dependencies = [
- "autocfg",
-]
+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "smallvec"
-version = "1.13.2"
+version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
+checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
dependencies = [
"serde",
]
@@ -10600,12 +10744,12 @@ dependencies = [
[[package]]
name = "smol_str"
-version = "0.3.4"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3498b0a27f93ef1402f20eefacfaa1691272ac4eca1cdc8c596cb0a245d6cbf5"
+checksum = "9676b89cd56310a87b93dec47b11af744f34d5fc9f367b829474eec0a891350d"
dependencies = [
"borsh",
- "serde_core",
+ "serde",
]
[[package]]
@@ -10631,19 +10775,19 @@ dependencies = [
[[package]]
name = "socket2"
-version = "0.6.1"
+version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881"
+checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
dependencies = [
"libc",
- "windows-sys 0.60.2",
+ "windows-sys 0.61.2",
]
[[package]]
name = "soup"
version = "0.1.0"
dependencies = [
- "ai",
+ "ai_toolset",
"anyhow",
"async-trait",
"axum",
@@ -10680,14 +10824,14 @@ dependencies = [
"readonly_pool",
"recursion",
"rootcause",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"sqlx",
"system_properties",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tracing",
"utoipa",
"uuid",
@@ -10708,16 +10852,6 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591"
-[[package]]
-name = "spki"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b"
-dependencies = [
- "base64ct",
- "der 0.6.1",
-]
-
[[package]]
name = "spki"
version = "0.7.3"
@@ -10725,7 +10859,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
dependencies = [
"base64ct",
- "der 0.7.9",
+ "der",
]
[[package]]
@@ -10758,19 +10892,19 @@ dependencies = [
"futures-intrusive",
"futures-io",
"futures-util",
- "hashbrown 0.15.2",
+ "hashbrown 0.15.5",
"hashlink",
"indexmap 2.14.0",
"log",
"memchr",
"once_cell",
"percent-encoding",
- "rustls 0.23.36",
+ "rustls 0.23.40",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"smallvec",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tokio-stream",
"tracing",
@@ -10807,7 +10941,7 @@ dependencies = [
"quote",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"sqlx-core",
"sqlx-mysql",
"sqlx-postgres",
@@ -10847,15 +10981,15 @@ dependencies = [
"memchr",
"once_cell",
"percent-encoding",
- "rand 0.8.5",
+ "rand 0.8.6",
"rsa",
"serde",
"sha1 0.10.6",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"smallvec",
"sqlx-core",
"stringprep",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"uuid",
"whoami",
@@ -10887,14 +11021,14 @@ dependencies = [
"md-5 0.10.6",
"memchr",
"once_cell",
- "rand 0.8.5",
+ "rand 0.8.6",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"smallvec",
"sqlx-core",
"stringprep",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"uuid",
"whoami",
@@ -10920,7 +11054,7 @@ dependencies = [
"serde",
"serde_urlencoded",
"sqlx-core",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"url",
"uuid",
@@ -10956,9 +11090,9 @@ dependencies = [
[[package]]
name = "sse-stream"
-version = "0.2.1"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb4dc4d33c68ec1f27d386b5610a351922656e1fdf5c05bbaad930cd1519479a"
+checksum = "f3962b63f038885f15bce2c6e02c0e7925c072f1ac86bb60fd44c5c6b762fb72"
dependencies = [
"bytes",
"futures-util",
@@ -10969,9 +11103,9 @@ dependencies = [
[[package]]
name = "stable_deref_trait"
-version = "1.2.0"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "static_file"
@@ -11013,9 +11147,9 @@ dependencies = [
"serde_dynamo",
"serde_json",
"strum_macros",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"tracing-tree",
@@ -11053,7 +11187,7 @@ dependencies = [
"serde_json",
"serial_test",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tokio-test",
"tracing",
@@ -11062,9 +11196,9 @@ dependencies = [
[[package]]
name = "string_cache"
-version = "0.8.8"
+version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "938d512196766101d333398efde81bc1f37b00cb42c2f8350e5df639f040bbbe"
+checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f"
dependencies = [
"new_debug_unreachable",
"parking_lot",
@@ -11096,6 +11230,12 @@ dependencies = [
"unicode-properties",
]
+[[package]]
+name = "strsim"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
+
[[package]]
name = "strsim"
version = "0.11.1"
@@ -11104,23 +11244,22 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "strum"
-version = "0.27.1"
+version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32"
+checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf"
dependencies = [
"strum_macros",
]
[[package]]
name = "strum_macros"
-version = "0.27.1"
+version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8"
+checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7"
dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
- "rustversion",
"syn 2.0.117",
]
@@ -11185,15 +11324,36 @@ dependencies = [
[[package]]
name = "synstructure"
-version = "0.13.1"
+version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.117",
]
+[[package]]
+name = "system-configuration"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
+dependencies = [
+ "bitflags 2.11.1",
+ "core-foundation 0.9.4",
+ "system-configuration-sys",
+]
+
+[[package]]
+name = "system-configuration-sys"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
[[package]]
name = "system_properties"
version = "0.1.0"
@@ -11206,7 +11366,7 @@ dependencies = [
"serde",
"serde_json",
"sqlx",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tracing",
"uuid",
]
@@ -11221,7 +11381,7 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
name = "teams"
version = "0.1.0"
dependencies = [
- "ai",
+ "ai_toolset",
"anyhow",
"async-stripe",
"async-trait",
@@ -11240,12 +11400,12 @@ dependencies = [
"notification",
"roles_and_permissions",
"rootcause",
- "schemars",
+ "schemars 1.2.1",
"serde",
"serde_json",
"sqlx",
"sqs_client",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"url",
@@ -11255,15 +11415,15 @@ dependencies = [
[[package]]
name = "tempfile"
-version = "3.19.1"
+version = "3.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf"
+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
- "fastrand 2.3.0",
- "getrandom 0.3.1",
+ "fastrand 2.4.1",
+ "getrandom 0.4.2",
"once_cell",
"rustix",
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -11294,11 +11454,11 @@ dependencies = [
[[package]]
name = "thiserror"
-version = "2.0.17"
+version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
+checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
dependencies = [
- "thiserror-impl 2.0.17",
+ "thiserror-impl 2.0.18",
]
[[package]]
@@ -11314,9 +11474,9 @@ dependencies = [
[[package]]
name = "thiserror-impl"
-version = "2.0.17"
+version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
+checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
dependencies = [
"proc-macro2",
"quote",
@@ -11325,26 +11485,25 @@ dependencies = [
[[package]]
name = "thread_local"
-version = "1.1.8"
+version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
+checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
dependencies = [
"cfg-if",
- "once_cell",
]
[[package]]
name = "tiff"
-version = "0.10.3"
+version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af9605de7fee8d9551863fd692cce7637f548dbd9db9180fcc07ccc6d26c336f"
+checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52"
dependencies = [
"fax",
"flate2",
"half",
"quick-error",
"weezl",
- "zune-jpeg 0.4.21",
+ "zune-jpeg",
]
[[package]]
@@ -11395,9 +11554,9 @@ dependencies = [
[[package]]
name = "tinystr"
-version = "0.7.6"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f"
+checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
dependencies = [
"displaydoc",
"zerovec",
@@ -11405,9 +11564,9 @@ dependencies = [
[[package]]
name = "tinyvec"
-version = "1.8.1"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8"
+checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3"
dependencies = [
"tinyvec_macros",
]
@@ -11420,26 +11579,26 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.50.0"
+version = "1.52.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d"
+checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe"
dependencies = [
"bytes",
"libc",
- "mio 1.0.3",
+ "mio 1.2.0",
"parking_lot",
"pin-project-lite",
"signal-hook-registry",
- "socket2 0.6.1",
+ "socket2 0.6.3",
"tokio-macros",
"windows-sys 0.61.2",
]
[[package]]
name = "tokio-macros"
-version = "2.6.0"
+version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5"
+checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496"
dependencies = [
"proc-macro2",
"quote",
@@ -11462,15 +11621,15 @@ version = "0.26.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"
dependencies = [
- "rustls 0.23.36",
+ "rustls 0.23.40",
"tokio",
]
[[package]]
name = "tokio-stream"
-version = "0.1.17"
+version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047"
+checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70"
dependencies = [
"futures-core",
"pin-project-lite",
@@ -11490,17 +11649,18 @@ dependencies = [
[[package]]
name = "tokio-tungstenite"
-version = "0.20.1"
+version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c"
+checksum = "c6989540ced10490aaf14e6bad2e3d33728a2813310a0c71d1574304c49631cd"
dependencies = [
"futures-util",
"log",
- "rustls 0.21.12",
+ "rustls 0.23.40",
+ "rustls-pki-types",
"tokio",
- "tokio-rustls 0.24.1",
- "tungstenite 0.20.1",
- "webpki-roots 0.25.4",
+ "tokio-rustls 0.26.4",
+ "tungstenite 0.23.0",
+ "webpki-roots 0.26.11",
]
[[package]]
@@ -11511,7 +11671,7 @@ checksum = "d25a406cddcc431a75d3d9afc6a7c0f7428d4891dd973e4d54c56b46127bf857"
dependencies = [
"futures-util",
"log",
- "rustls 0.23.36",
+ "rustls 0.23.40",
"rustls-pki-types",
"tokio",
"tokio-rustls 0.26.4",
@@ -11519,6 +11679,22 @@ dependencies = [
"webpki-roots 0.26.11",
]
+[[package]]
+name = "tokio-tungstenite"
+version = "0.29.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f72a05e828585856dacd553fba484c242c46e391fb0e58917c942ee9202915c"
+dependencies = [
+ "futures-util",
+ "log",
+ "rustls 0.23.40",
+ "rustls-pki-types",
+ "tokio",
+ "tokio-rustls 0.26.4",
+ "tungstenite 0.29.0",
+ "webpki-roots 0.26.11",
+]
+
[[package]]
name = "tokio-util"
version = "0.7.18"
@@ -11532,19 +11708,66 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "toml_datetime"
+version = "0.6.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
+
+[[package]]
+name = "toml_datetime"
+version = "1.1.1+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
+dependencies = [
+ "serde_core",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.19.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
+dependencies = [
+ "indexmap 2.14.0",
+ "toml_datetime 0.6.11",
+ "winnow 0.5.40",
+]
+
+[[package]]
+name = "toml_edit"
+version = "0.25.11+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b"
+dependencies = [
+ "indexmap 2.14.0",
+ "toml_datetime 1.1.1+spec-1.1.0",
+ "toml_parser",
+ "winnow 1.0.3",
+]
+
+[[package]]
+name = "toml_parser"
+version = "1.1.2+spec-1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"
+dependencies = [
+ "winnow 1.0.3",
+]
+
[[package]]
name = "tonic"
-version = "0.14.3"
+version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a286e33f82f8a1ee2df63f4fa35c0becf4a85a0cb03091a15fd7bf0b402dc94a"
+checksum = "ac2a5518c70fa84342385732db33fb3f44bc4cc748936eb5833d2df34d6445ef"
dependencies = [
"async-trait",
"base64 0.22.1",
"bytes",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-body-util",
- "hyper 1.6.0",
+ "hyper 1.9.0",
"hyper-timeout",
"hyper-util",
"percent-encoding",
@@ -11552,7 +11775,7 @@ dependencies = [
"sync_wrapper",
"tokio",
"tokio-stream",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-layer",
"tower-service",
"tracing",
@@ -11560,9 +11783,9 @@ dependencies = [
[[package]]
name = "tonic-prost"
-version = "0.14.3"
+version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6c55a2d6a14174563de34409c9f92ff981d006f56da9c6ecd40d9d4a31500b0"
+checksum = "50849f68853be452acf590cde0b146665b8d507b3b8af17261df47e02c209ea0"
dependencies = [
"bytes",
"prost 0.14.3",
@@ -11586,9 +11809,9 @@ dependencies = [
[[package]]
name = "tower"
-version = "0.5.2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
dependencies = [
"futures-core",
"futures-util",
@@ -11612,7 +11835,7 @@ dependencies = [
"axum-core",
"cookie",
"futures-util",
- "http 1.3.1",
+ "http 1.4.0",
"parking_lot",
"pin-project-lite",
"tower-layer",
@@ -11621,31 +11844,31 @@ dependencies = [
[[package]]
name = "tower-http"
-version = "0.6.8"
+version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
+checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"
dependencies = [
"async-compression",
"bitflags 2.11.1",
"bytes",
"futures-core",
"futures-util",
- "http 1.3.1",
+ "http 1.4.0",
"http-body 1.0.1",
"http-body-util",
"http-range-header",
"httpdate",
- "iri-string",
"mime",
"mime_guess",
"percent-encoding",
"pin-project-lite",
"tokio",
"tokio-util",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-layer",
"tower-service",
"tracing",
+ "url",
"uuid",
]
@@ -11694,6 +11917,18 @@ dependencies = [
"valuable",
]
+[[package]]
+name = "tracing-futures"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
+dependencies = [
+ "futures",
+ "futures-task",
+ "pin-project",
+ "tracing",
+]
+
[[package]]
name = "tracing-log"
version = "0.2.0"
@@ -11743,9 +11978,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
-version = "0.3.22"
+version = "0.3.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e"
+checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
dependencies = [
"matchers",
"nu-ansi-term",
@@ -11764,9 +11999,9 @@ dependencies = [
[[package]]
name = "tracing-tree"
-version = "0.4.0"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f459ca79f1b0d5f71c54ddfde6debfc59c8b6eeb46808ae492077f739dc7b49c"
+checksum = "ac87aa03b6a4d5a7e4810d1a80c19601dbe0f8a837e9177f23af721c7ba7beec"
dependencies = [
"nu-ansi-term",
"tracing-core",
@@ -11788,21 +12023,21 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "tungstenite"
-version = "0.20.1"
+version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9"
+checksum = "6e2e2ce1e47ed2994fd43b04c8f618008d4cabdd5ee34027cf14f9d918edd9c8"
dependencies = [
"byteorder",
"bytes",
"data-encoding",
- "http 0.2.12",
+ "http 1.4.0",
"httparse",
"log",
- "rand 0.8.5",
- "rustls 0.21.12",
+ "rand 0.8.6",
+ "rustls 0.23.40",
+ "rustls-pki-types",
"sha1 0.10.6",
"thiserror 1.0.69",
- "url",
"utf-8",
]
@@ -11814,32 +12049,51 @@ checksum = "8628dcc84e5a09eb3d8423d6cb682965dea9133204e8fb3efee74c2a0c259442"
dependencies = [
"bytes",
"data-encoding",
- "http 1.3.1",
+ "http 1.4.0",
"httparse",
"log",
- "rand 0.9.3",
- "rustls 0.23.36",
+ "rand 0.9.4",
+ "rustls 0.23.40",
"rustls-pki-types",
"sha1 0.10.6",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"url",
"utf-8",
]
+[[package]]
+name = "tungstenite"
+version = "0.29.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c01152af293afb9c7c2a57e4b559c5620b421f6d133261c60dd2d0cdb38e6b8"
+dependencies = [
+ "bytes",
+ "data-encoding",
+ "http 1.4.0",
+ "httparse",
+ "log",
+ "rand 0.9.4",
+ "rustls 0.23.40",
+ "rustls-pki-types",
+ "sha1 0.10.6",
+ "thiserror 2.0.18",
+ "url",
+]
+
[[package]]
name = "twox-hash"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c"
dependencies = [
- "rand 0.9.3",
+ "rand 0.9.4",
]
[[package]]
name = "typenum"
-version = "1.17.0"
+version = "1.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
+checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de"
[[package]]
name = "unfurl"
@@ -11853,7 +12107,7 @@ dependencies = [
"reqwest 0.13.3",
"scraper",
"serde",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"tokio",
"tracing",
"url",
@@ -11868,7 +12122,7 @@ dependencies = [
"axum",
"bytes",
"futures",
- "http 1.3.1",
+ "http 1.4.0",
"http-body-util",
"macro_cors",
"macro_entrypoint",
@@ -11878,7 +12132,7 @@ dependencies = [
"serde",
"serde_json",
"tokio",
- "tower 0.5.2",
+ "tower 0.5.3",
"tower-http",
"tracing",
"unfurl",
@@ -11889,9 +12143,9 @@ dependencies = [
[[package]]
name = "unicase"
-version = "2.8.1"
+version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539"
+checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
[[package]]
name = "unicode-bidi"
@@ -11901,30 +12155,30 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"
[[package]]
name = "unicode-ident"
-version = "1.0.16"
+version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034"
+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
[[package]]
name = "unicode-normalization"
-version = "0.1.24"
+version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
+checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"
dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-properties"
-version = "0.1.3"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0"
+checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d"
[[package]]
name = "unicode-segmentation"
-version = "1.12.0"
+version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
+checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c"
[[package]]
name = "unicode-width"
@@ -11934,9 +12188,9 @@ checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
[[package]]
name = "unicode-width"
-version = "0.2.1"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c"
+checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
[[package]]
name = "unicode-xid"
@@ -11962,7 +12216,7 @@ checksum = "501a7adf1a4bd9951501e5c66621e972ef8874d787628b7f90e64f936ef7ec0a"
dependencies = [
"mutants",
"proc-macro2",
- "rustc-hash 2.1.1",
+ "rustc-hash 2.1.2",
]
[[package]]
@@ -11992,7 +12246,7 @@ dependencies = [
"models_bulk_upload",
"serde",
"serde_json",
- "sha2 0.10.8",
+ "sha2 0.10.9",
"sqs_client",
"tempfile",
"tokio",
@@ -12025,14 +12279,15 @@ dependencies = [
[[package]]
name = "url"
-version = "2.5.4"
+version = "2.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
+checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
"serde",
+ "serde_derive",
]
[[package]]
@@ -12073,12 +12328,6 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
-[[package]]
-name = "utf16_iter"
-version = "1.0.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246"
-
[[package]]
name = "utf16string"
version = "0.2.0"
@@ -12090,9 +12339,9 @@ dependencies = [
[[package]]
name = "utf8-width"
-version = "0.1.7"
+version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3"
+checksum = "1292c0d970b54115d14f2492fe0170adf21d68a1de108eebc51c1df4f346a091"
[[package]]
name = "utf8_iter"
@@ -12108,9 +12357,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "utoipa"
-version = "5.4.0"
+version = "5.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fcc29c80c21c31608227e0912b2d7fddba57ad76b606890627ba8ee7964e993"
+checksum = "8bde15df68e80b16c7d16b9616e80770ad158988daa56a27dccd1e55558b0160"
dependencies = [
"indexmap 2.14.0",
"serde",
@@ -12120,9 +12369,9 @@ dependencies = [
[[package]]
name = "utoipa-gen"
-version = "5.4.0"
+version = "5.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d79d08d92ab8af4c5e8a6da20c47ae3f61a0f1dabc1997cdf2d082b757ca08b"
+checksum = "6ba0b99ee52df3028635d93840c797102da61f8a7bb3cf751032455895b52ef8"
dependencies = [
"proc-macro2",
"quote",
@@ -12158,24 +12407,24 @@ checksum = "e2eebbbfe4093922c2b6734d7c679ebfebd704a0d7e56dfcb0d05818ce28977d"
[[package]]
name = "uuid"
-version = "1.18.1"
+version = "1.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2"
+checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76"
dependencies = [
- "getrandom 0.3.1",
+ "getrandom 0.4.2",
"js-sys",
- "rand 0.9.3",
- "serde",
+ "rand 0.10.1",
+ "serde_core",
"wasm-bindgen",
]
[[package]]
name = "v_frame"
-version = "0.3.8"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b"
+checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2"
dependencies = [
- "aligned-vec 0.5.0",
+ "aligned-vec",
"num-traits",
"wasm-bindgen",
]
@@ -12252,26 +12501,17 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
-version = "0.11.0+wasi-snapshot-preview1"
+version = "0.11.1+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
-
-[[package]]
-name = "wasi"
-version = "0.13.3+wasi-0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
-dependencies = [
- "wit-bindgen-rt",
-]
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
name = "wasip2"
-version = "1.0.2+wasi-0.2.9"
+version = "1.0.3+wasi-0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"
+checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6"
dependencies = [
- "wit-bindgen",
+ "wit-bindgen 0.57.1",
]
[[package]]
@@ -12280,7 +12520,7 @@ version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
dependencies = [
- "wit-bindgen",
+ "wit-bindgen 0.51.0",
]
[[package]]
@@ -12291,9 +12531,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
[[package]]
name = "wasm-bindgen"
-version = "0.2.120"
+version = "0.2.121"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1"
+checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790"
dependencies = [
"cfg-if",
"once_cell",
@@ -12304,9 +12544,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.70"
+version = "0.4.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af934872acec734c2d80e6617bbb5ff4f12b052dd8e6332b0817bce889516084"
+checksum = "96492d0d3ffba25305a7dc88720d250b1401d7edca02cc3bcd50633b424673b8"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -12314,9 +12554,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.120"
+version = "0.2.121"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103"
+checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -12324,9 +12564,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.120"
+version = "0.2.121"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41"
+checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2"
dependencies = [
"bumpalo",
"proc-macro2",
@@ -12337,9 +12577,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.120"
+version = "0.2.121"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea"
+checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441"
dependencies = [
"unicode-ident",
]
@@ -12386,16 +12626,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
dependencies = [
"bitflags 2.11.1",
- "hashbrown 0.15.2",
+ "hashbrown 0.15.5",
"indexmap 2.14.0",
"semver",
]
[[package]]
name = "web-sys"
-version = "0.3.97"
+version = "0.3.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eadbac71025cd7b0834f20d1fe8472e8495821b4e9801eb0a60bd1f19827602"
+checksum = "4b572dff8bcf38bad0fa19729c89bb5748b2b9b1d8be70cf90df697e3a8f32aa"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -12413,9 +12653,9 @@ dependencies = [
[[package]]
name = "web_atoms"
-version = "0.1.0"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "954c5a41f2bcb7314344079d0891505458cc2f4b422bdea1d5bfbe6d1a04903b"
+checksum = "57ffde1dc01240bdf9992e3205668b235e59421fd085e8a317ed98da0178d414"
dependencies = [
"phf 0.11.3",
"phf_codegen 0.11.3",
@@ -12454,14 +12694,14 @@ version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
- "webpki-roots 1.0.5",
+ "webpki-roots 1.0.7",
]
[[package]]
name = "webpki-roots"
-version = "1.0.5"
+version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12bed680863276c63889429bfd6cab3b99943659923822de1c8a39c49e4d722c"
+checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d"
dependencies = [
"rustls-pki-types",
]
@@ -12474,11 +12714,11 @@ checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
[[package]]
name = "whoami"
-version = "1.5.2"
+version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d"
+checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d"
dependencies = [
- "redox_syscall",
+ "libredox",
"wasite",
]
@@ -12506,11 +12746,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
-version = "0.1.9"
+version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
+checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
]
[[package]]
@@ -12521,11 +12761,37 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-core"
-version = "0.52.0"
+version = "0.62.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
+checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
dependencies = [
- "windows-targets 0.52.6",
+ "windows-implement",
+ "windows-interface",
+ "windows-link",
+ "windows-result",
+ "windows-strings",
+]
+
+[[package]]
+name = "windows-implement"
+version = "0.60.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "windows-interface"
+version = "0.59.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
]
[[package]]
@@ -12862,9 +13128,27 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
[[package]]
name = "winnow"
-version = "0.7.14"
+version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"
+checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "winnow"
+version = "0.7.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "winnow"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1"
dependencies = [
"memchr",
]
@@ -12878,6 +13162,12 @@ dependencies = [
"wit-bindgen-rust-macro",
]
+[[package]]
+name = "wit-bindgen"
+version = "0.57.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
+
[[package]]
name = "wit-bindgen-core"
version = "0.51.0"
@@ -12889,15 +13179,6 @@ dependencies = [
"wit-parser",
]
-[[package]]
-name = "wit-bindgen-rt"
-version = "0.33.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
-dependencies = [
- "bitflags 2.11.1",
-]
-
[[package]]
name = "wit-bindgen-rust"
version = "0.51.0"
@@ -12983,17 +13264,11 @@ dependencies = [
"tracing",
]
-[[package]]
-name = "write16"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936"
-
[[package]]
name = "writeable"
-version = "0.5.5"
+version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
+checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
[[package]]
name = "xmlparser"
@@ -13024,11 +13299,10 @@ checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"
[[package]]
name = "yoke"
-version = "0.7.5"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40"
+checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca"
dependencies = [
- "serde",
"stable_deref_trait",
"yoke-derive",
"zerofrom",
@@ -13036,9 +13310,9 @@ dependencies = [
[[package]]
name = "yoke-derive"
-version = "0.7.5"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
+checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
dependencies = [
"proc-macro2",
"quote",
@@ -13048,39 +13322,18 @@ dependencies = [
[[package]]
name = "zerocopy"
-version = "0.7.35"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
-dependencies = [
- "byteorder",
- "zerocopy-derive 0.7.35",
-]
-
-[[package]]
-name = "zerocopy"
-version = "0.8.17"
+version = "0.8.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa91407dacce3a68c56de03abe2760159582b846c6a4acd2f456618087f12713"
+checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9"
dependencies = [
- "zerocopy-derive 0.8.17",
-]
-
-[[package]]
-name = "zerocopy-derive"
-version = "0.7.35"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.117",
+ "zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
-version = "0.8.17"
+version = "0.8.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06718a168365cad3d5ff0bb133aad346959a2074bd4a85c121255a11304a8626"
+checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4"
dependencies = [
"proc-macro2",
"quote",
@@ -13089,18 +13342,18 @@ dependencies = [
[[package]]
name = "zerofrom"
-version = "0.1.5"
+version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e"
+checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
dependencies = [
"zerofrom-derive",
]
[[package]]
name = "zerofrom-derive"
-version = "0.1.5"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
+checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
dependencies = [
"proc-macro2",
"quote",
@@ -13110,29 +13363,40 @@ dependencies = [
[[package]]
name = "zeroize"
-version = "1.8.1"
+version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
+checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
dependencies = [
"zeroize_derive",
]
[[package]]
name = "zeroize_derive"
-version = "1.4.2"
+version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
+checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.117",
]
+[[package]]
+name = "zerotrie"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
+dependencies = [
+ "displaydoc",
+ "yoke",
+ "zerofrom",
+]
+
[[package]]
name = "zerovec"
-version = "0.10.4"
+version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079"
+checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
dependencies = [
"yoke",
"zerofrom",
@@ -13141,9 +13405,9 @@ dependencies = [
[[package]]
name = "zerovec-derive"
-version = "0.10.3"
+version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
+checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
dependencies = [
"proc-macro2",
"quote",
@@ -13165,14 +13429,14 @@ dependencies = [
"deflate64",
"displaydoc",
"flate2",
- "getrandom 0.3.1",
+ "getrandom 0.3.4",
"hmac 0.12.1",
"indexmap 2.14.0",
"lzma-rs",
"memchr",
"pbkdf2",
"sha1 0.10.6",
- "thiserror 2.0.17",
+ "thiserror 2.0.18",
"time",
"xz2",
"zeroize",
@@ -13208,15 +13472,13 @@ checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
[[package]]
name = "zopfli"
-version = "0.8.1"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946"
+checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249"
dependencies = [
"bumpalo",
"crc32fast",
- "lockfree-object-pool",
"log",
- "once_cell",
"simd-adler32",
]
@@ -13231,18 +13493,18 @@ dependencies = [
[[package]]
name = "zstd-safe"
-version = "7.2.3"
+version = "7.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3051792fbdc2e1e143244dc28c60f73d8470e93f3f9cbd0ead44da5ed802722"
+checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d"
dependencies = [
"zstd-sys",
]
[[package]]
name = "zstd-sys"
-version = "2.0.14+zstd.1.5.7"
+version = "2.0.16+zstd.1.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fb060d4926e4ac3a3ad15d864e99ceb5f343c6b34f5bd6d81ae6ed417311be5"
+checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748"
dependencies = [
"cc",
"pkg-config",
@@ -13250,15 +13512,9 @@ dependencies = [
[[package]]
name = "zune-core"
-version = "0.4.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a"
-
-[[package]]
-name = "zune-core"
-version = "0.5.0"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "111f7d9820f05fd715df3144e254d6fc02ee4088b0644c0ffd0efc9e6d9d2773"
+checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9"
[[package]]
name = "zune-inflate"
@@ -13271,18 +13527,9 @@ dependencies = [
[[package]]
name = "zune-jpeg"
-version = "0.4.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29ce2c8a9384ad323cf564b67da86e21d3cfdff87908bc1223ed5c99bc792713"
-dependencies = [
- "zune-core 0.4.12",
-]
-
-[[package]]
-name = "zune-jpeg"
-version = "0.5.5"
+version = "0.5.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc6fb7703e32e9a07fb3f757360338b3a567a5054f21b5f52a666752e333d58e"
+checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296"
dependencies = [
- "zune-core 0.5.0",
+ "zune-core",
]
diff --git a/rust/cloud-storage/Cargo.toml b/rust/cloud-storage/Cargo.toml
index daeec3cc24..06cb28307f 100644
--- a/rust/cloud-storage/Cargo.toml
+++ b/rust/cloud-storage/Cargo.toml
@@ -2,6 +2,7 @@
resolver = "2"
members = [
+ "agent",
"authentication_service",
"backfill_entity_access",
"comms_service",
diff --git a/rust/cloud-storage/ai/Cargo.toml b/rust/cloud-storage/agent/Cargo.toml
similarity index 64%
rename from rust/cloud-storage/ai/Cargo.toml
rename to rust/cloud-storage/agent/Cargo.toml
index 89e0badb36..b61663f121 100644
--- a/rust/cloud-storage/ai/Cargo.toml
+++ b/rust/cloud-storage/agent/Cargo.toml
@@ -1,36 +1,27 @@
[package]
edition = "2024"
-name = "ai"
+name = "agent"
publish = false
version = "0.1.0"
-[[bin]]
-name = "cli"
-path = "src/bin/cli.rs"
-
-[dev-dependencies]
+[features]
+debug-messages = []
[dependencies]
anyhow = { workspace = true }
async-openai = { workspace = true }
async-stream = { workspace = true }
async-trait = { workspace = true }
-chrono = { workspace = true }
futures = { workspace = true }
-lazy_static = { workspace = true }
-rand.workspace = true
-reqwest = { workspace = true }
+rig-core = "0.37"
schemars = { workspace = true }
-secrecy = "0.10.3"
serde = { workspace = true }
serde_json = { workspace = true }
strum = { workspace = true }
thiserror = { workspace = true }
-tokio.workspace = true
-tracing = { workspace = true }
utoipa = { workspace = true }
-anthropic = { path = "../anthropic" }
+tokio = { workspace = true }
+tracing = { workspace = true }
ai_toolset = { path = "../ai_toolset" }
-macro_user_id = { path = "../macro_user_id" }
-model_file_type = { path = "../model_file_type"}
attachment = { path = "../attachment" }
+macro_user_id = { path = "../macro_user_id" }
diff --git a/rust/cloud-storage/agent/src/agent_loop.rs b/rust/cloud-storage/agent/src/agent_loop.rs
new file mode 100644
index 0000000000..aff9ba3fea
--- /dev/null
+++ b/rust/cloud-storage/agent/src/agent_loop.rs
@@ -0,0 +1,207 @@
+/// The main entry point: [`AgentLoop`] and [`Session`].
+use crate::anthropic_model::AnthropicModel;
+use crate::error::AgentError;
+use crate::hook::StreamBridge;
+use crate::model::AgentModel;
+use crate::stream::{ChatCompletionStream, StreamPart};
+use crate::tool_adapter::DynToolSetAdapter;
+use ai_toolset::{RequestContext, ToolSet as AiToolSet};
+use futures::StreamExt;
+use macro_user_id::user_id::MacroUserIdStr;
+use rig_core::agent::{Agent, MultiTurnStreamItem};
+use rig_core::client::{CompletionClient, ProviderClient};
+use rig_core::message::Message;
+use rig_core::providers::anthropic;
+use rig_core::streaming::StreamingPrompt;
+use rig_core::tool::server::ToolServer;
+use std::sync::{Arc, RwLock};
+
+const DEFAULT_MAX_TURNS: usize = 16;
+const DEFAULT_MAX_TOKENS: u64 = 16_000;
+
+/// Factory for creating per-request agent sessions.
+///
+/// Holds the Anthropic client. Tools and system prompt are provided
+/// per-session since they vary by request (MCP tools are per-user,
+/// system prompt depends on toolset selection).
+pub struct AgentLoop {
+ client: anthropic::Client,
+ model: AgentModel,
+ max_turns: usize,
+ max_tokens: u64,
+}
+
+impl Default for AgentLoop {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
+impl AgentLoop {
+ /// Create an `AgentLoop` with the Anthropic client from the environment
+ /// and the default model (Opus 4.7).
+ pub fn new() -> Self {
+ let client = anthropic::Client::from_env().expect("ANTHROPIC_API_KEY must be set");
+ Self {
+ client,
+ model: AgentModel::default(),
+ max_turns: DEFAULT_MAX_TURNS,
+ max_tokens: DEFAULT_MAX_TOKENS,
+ }
+ }
+
+ /// Override the model.
+ pub fn with_model(mut self, model: AgentModel) -> Self {
+ self.model = model;
+ self
+ }
+
+ /// Override the default max tool-calling turns.
+ pub fn with_max_turns(mut self, n: usize) -> Self {
+ self.max_turns = n;
+ self
+ }
+
+ /// Override the default max output tokens.
+ pub fn with_max_tokens(mut self, n: u64) -> Self {
+ self.max_tokens = n;
+ self
+ }
+
+ /// Start a new streaming session.
+ ///
+ /// `toolset` is the combined tool set (static + MCP) for this request.
+ /// `context` is the shared service context passed to tool calls.
+ /// `system_prompt` is the system prompt for this request.
+ /// `user_id` identifies the calling user for tool dispatch.
+ pub async fn session<Context>(
+ &self,
+ toolset: Arc<dyn AiToolSet<Context> + Send + Sync>,
+ context: Arc<Context>,
+ system_prompt: &str,
+ user_id: MacroUserIdStr<'static>,
+ ) -> Session
+ where
+ Context: Clone + Send + Sync + 'static,
+ {
+ let request_context = Arc::new(RwLock::new(RequestContext { user_id }));
+
+ let adapters = DynToolSetAdapter::from_toolset(toolset, context, request_context);
+
+ let handle = ToolServer::new().run();
+ for adapter in adapters {
+ handle
+ .add_tool(adapter)
+ .await
+ .expect("failed to register tool");
+ }
+
+ let raw_model = self.client.completion_model(self.model.api_id());
+ let model = AnthropicModel::new(raw_model);
+
+ let agent = rig_core::agent::AgentBuilder::new(model)
+ .tool_server_handle(handle)
+ .default_max_turns(self.max_turns)
+ .max_tokens(self.max_tokens)
+ .preamble(system_prompt)
+ .build();
+
+ Session {
+ agent,
+ history: Vec::new(),
+ max_turns: self.max_turns,
+ }
+ }
+}
+
+/// A single streaming conversation session.
+pub struct Session {
+ agent: Agent<AnthropicModel>,
+ history: Vec<Message>,
+ max_turns: usize,
+}
+
+impl Session {
+ /// Send a message and stream the response.
+ ///
+ /// The returned stream yields [`StreamPart`] items compatible with the
+ /// existing DCS consumer code.
+ #[tracing::instrument(name = "invoke_agent", skip_all)]
+ pub async fn send_message(
+ &mut self,
+ messages: Vec<Message>,
+ ) -> Result<ChatCompletionStream<'_>, AgentError> {
+ self.history = messages;
+
+ let Some((prompt, history)) = self.history.split_last() else {
+ return Err(AgentError::Other(anyhow::anyhow!(
+ "messages must not be empty"
+ )));
+ };
+
+ #[cfg(feature = "debug-messages")]
+ dump_messages("agent_input.log", &self.history);
+
+ let (bridge, mut rx) = StreamBridge::channel();
+
+ let mut rig_stream = self
+ .agent
+ .stream_prompt(prompt.clone())
+ .with_history(history.to_vec())
+ .multi_turn(self.max_turns)
+ .with_hook(bridge)
+ .await;
+
+ let stream = async_stream::stream! {
+ while let Some(item) = rig_stream.next().await {
+ while let Ok(part) = rx.try_recv() {
+ yield part;
+ }
+ match item {
+ Ok(MultiTurnStreamItem::FinalResponse(final_resp)) => {
+ #[cfg(feature = "debug-messages")]
+ if let Some(history) = final_resp.history() {
+ dump_messages("agent_output.log", history);
+ }
+ let usage = final_resp.usage();
+ yield Ok(StreamPart::Usage(crate::stream::Usage {
+ input_tokens: usage.input_tokens,
+ output_tokens: usage.output_tokens,
+ }));
+ }
+ Err(e) => {
+ yield Err(AgentError::Streaming(e));
+ }
+ _ => {}
+ }
+ }
+ while let Ok(part) = rx.try_recv() {
+ yield part;
+ }
+ };
+
+ Ok(Box::pin(stream))
+ }
+
+ /// Get the conversation messages accumulated during this session.
+ pub fn get_history(&self) -> &[Message] {
+ &self.history
+ }
+}
+
+#[cfg(feature = "debug-messages")]
+fn dump_messages(filename: &str, messages: &[Message]) {
+ use std::io::Write;
+
+ let path = std::path::PathBuf::from(filename);
+ match serde_json::to_string_pretty(messages) {
+ Ok(json) => match std::fs::File::create(&path) {
+ Ok(mut f) => {
+ let _ = f.write_all(json.as_bytes());
+ tracing::info!(path = %path.display(), "wrote message chain");
+ }
+ Err(e) => tracing::warn!(error = %e, path = %path.display(), "failed to write"),
+ },
+ Err(e) => tracing::warn!(error = %e, "failed to serialize message chain"),
+ }
+}
diff --git a/rust/cloud-storage/agent/src/anthropic_model.rs b/rust/cloud-storage/agent/src/anthropic_model.rs
new file mode 100644
index 0000000000..e1232f910a
--- /dev/null
+++ b/rust/cloud-storage/agent/src/anthropic_model.rs
@@ -0,0 +1,95 @@
+use rig_core::OneOrMany;
+/// Newtype around the Anthropic [`CompletionModel`] that merges consecutive
+/// `User` messages before each request.
+///
+/// RIG's agentic loop creates one `User` message per tool result, but the
+/// Anthropic API requires all `tool_result` blocks for a batch of
+/// `tool_use` calls to appear in a single `User` message. This wrapper
+/// fixes that at the model boundary so the rest of the stack is unaware.
+use rig_core::completion::{
+ CompletionError, CompletionModel, CompletionRequest, CompletionRequestBuilder,
+ CompletionResponse,
+};
+use rig_core::message::Message;
+use rig_core::providers::anthropic;
+use rig_core::streaming::StreamingCompletionResponse;
+
+type Inner = anthropic::completion::CompletionModel;
+
+/// Anthropic completion model that merges consecutive user messages.
+#[derive(Clone)]
+pub struct AnthropicModel(Inner);
+
+impl AnthropicModel {
+ /// Wrap a raw Anthropic completion model.
+ pub fn new(inner: Inner) -> Self {
+ Self(inner)
+ }
+}
+
+impl CompletionModel for AnthropicModel {
+ type Response = <Inner as CompletionModel>::Response;
+ type StreamingResponse = <Inner as CompletionModel>::StreamingResponse;
+ type Client = <Inner as CompletionModel>::Client;
+
+ fn make(client: &Self::Client, model: impl Into<String>) -> Self {
+ Self(Inner::make(client, model))
+ }
+
+ async fn completion(
+ &self,
+ mut request: CompletionRequest,
+ ) -> Result<CompletionResponse<Self::Response>, CompletionError> {
+ request.chat_history = merge_consecutive_user(request.chat_history);
+ self.0.completion(request).await
+ }
+
+ async fn stream(
+ &self,
+ mut request: CompletionRequest,
+ ) -> Result<StreamingCompletionResponse<Self::StreamingResponse>, CompletionError> {
+ request.chat_history = merge_consecutive_user(request.chat_history);
+ self.0.stream(request).await
+ }
+
+ fn completion_request(&self, prompt: impl Into<Message>) -> CompletionRequestBuilder<Self> {
+ CompletionRequestBuilder::new(self.clone(), prompt)
+ }
+}
+
+fn merge_consecutive_user(history: OneOrMany<Message>) -> OneOrMany<Message> {
+ let messages: Vec<Message> = history.into_iter().collect();
+ if messages.len() < 2 {
+ return OneOrMany::many(messages).unwrap_or_else(|_| OneOrMany::one(Message::user("")));
+ }
+
+ let mut merged: Vec<Message> = Vec::with_capacity(messages.len());
+
+ for msg in messages {
+ if matches!(&msg, Message::User { .. })
+ && merged
+ .last()
+ .is_some_and(|m| matches!(m, Message::User { .. }))
+ {
+ let Message::User {
+ content: new_content,
+ } = msg
+ else {
+ unreachable!()
+ };
+ let Some(Message::User { content: existing }) = merged.last_mut() else {
+ unreachable!()
+ };
+ for item in new_content {
+ existing.push(item);
+ }
+ } else {
+ merged.push(msg);
+ }
+ }
+
+ OneOrMany::many(merged).unwrap_or_else(|_| OneOrMany::one(Message::user("")))
+}
+
+#[cfg(test)]
+mod test;
diff --git a/rust/cloud-storage/agent/src/anthropic_model/test.rs b/rust/cloud-storage/agent/src/anthropic_model/test.rs
new file mode 100644
index 0000000000..d65fad8e47
--- /dev/null
+++ b/rust/cloud-storage/agent/src/anthropic_model/test.rs
@@ -0,0 +1,63 @@
+use super::*;
+use rig_core::message::{Message, ToolResultContent, UserContent};
+
+#[test]
+fn no_merge_needed() {
+ let history = OneOrMany::many(vec![
+ Message::user("hello"),
+ Message::assistant("hi"),
+ Message::user("bye"),
+ ])
+ .unwrap();
+ let merged = merge_consecutive_user(history);
+ assert_eq!(merged.len(), 3);
+}
+
+#[test]
+fn merges_two_consecutive_user_messages() {
+ let history = OneOrMany::many(vec![Message::user("a"), Message::user("b")]).unwrap();
+ let merged = merge_consecutive_user(history);
+ assert_eq!(merged.len(), 1);
+ let Message::User { content } = merged.first() else {
+ panic!("expected user");
+ };
+ assert_eq!(content.len(), 2);
+}
+
+#[test]
+fn merges_tool_results_after_tool_calls() {
+ let tr1 = UserContent::tool_result(
+ "call_1",
+ OneOrMany::one(ToolResultContent::text("result 1")),
+ );
+ let tr2 = UserContent::tool_result(
+ "call_2",
+ OneOrMany::one(ToolResultContent::text("result 2")),
+ );
+ let history = OneOrMany::many(vec![
+ Message::user("do stuff"),
+ Message::assistant("calling tools"),
+ Message::User {
+ content: OneOrMany::one(tr1),
+ },
+ Message::User {
+ content: OneOrMany::one(tr2),
+ },
+ ])
+ .unwrap();
+
+ let merged = merge_consecutive_user(history);
+ assert_eq!(merged.len(), 3, "user, assistant, merged-user");
+
+ let Message::User { content } = &merged.iter().collect::<Vec<_>>()[2] else {
+ panic!("expected user");
+ };
+ assert_eq!(content.len(), 2, "both tool results in one message");
+}
+
+#[test]
+fn single_message_unchanged() {
+ let history = OneOrMany::one(Message::user("only"));
+ let merged = merge_consecutive_user(history);
+ assert_eq!(merged.len(), 1);
+}
diff --git a/rust/cloud-storage/agent/src/completion.rs b/rust/cloud-storage/agent/src/completion.rs
new file mode 100644
index 0000000000..cf628c1224
--- /dev/null
+++ b/rust/cloud-storage/agent/src/completion.rs
@@ -0,0 +1,58 @@
+/// One-shot completion — send a prompt and get a string response.
+use crate::anthropic_model::AnthropicModel;
+use crate::model::AgentModel;
+use rig_core::client::{CompletionClient, ProviderClient};
+use rig_core::completion::Prompt;
+use rig_core::message::Message;
+use rig_core::providers::anthropic;
+
+/// Send a system prompt + user message and return the model's text response.
+///
+/// This is the simple, non-streaming path for one-shot tasks like
+/// summarization.
+#[tracing::instrument(skip(system_prompt, user_message), err)]
+pub async fn complete(
+ model: AgentModel,
+ system_prompt: &str,
+ user_message: &str,
+) -> anyhow::Result<String> {
+ let client = anthropic::Client::from_env()?;
+ let raw_model = client.completion_model(model.api_id());
+ let wrapped = AnthropicModel::new(raw_model);
+
+ let agent = rig_core::agent::AgentBuilder::new(wrapped)
+ .preamble(system_prompt)
+ .max_tokens(16_000)
+ .build();
+
+ let response = agent.prompt(user_message).await?;
+ Ok(response)
+}
+
+/// Send a system prompt + conversation history and return the model's text
+/// response.
+#[tracing::instrument(skip(system_prompt, messages), err)]
+pub async fn complete_with_history(
+ model: AgentModel,
+ system_prompt: &str,
+ messages: Vec<Message>,
+) -> anyhow::Result<String> {
+ let client = anthropic::Client::from_env()?;
+ let raw_model = client.completion_model(model.api_id());
+ let wrapped = AnthropicModel::new(raw_model);
+
+ let agent = rig_core::agent::AgentBuilder::new(wrapped)
+ .preamble(system_prompt)
+ .max_tokens(16_000)
+ .build();
+
+ let Some((prompt, history)) = messages.split_last() else {
+ anyhow::bail!("messages must not be empty");
+ };
+
+ let response = agent
+ .prompt(prompt.clone())
+ .with_history(history.to_vec())
+ .await?;
+ Ok(response)
+}
diff --git a/rust/cloud-storage/agent/src/convert.rs b/rust/cloud-storage/agent/src/convert.rs
new file mode 100644
index 0000000000..48859da5b8
--- /dev/null
+++ b/rust/cloud-storage/agent/src/convert.rs
@@ -0,0 +1,113 @@
+#[cfg(test)]
+mod test;
+
+/// Conversions between agent message types and `rig` message types.
+use crate::types::{AssistantMessagePart, ChatMessage, ChatMessageContent, Role};
+use rig_core::OneOrMany;
+use rig_core::message::{
+ AssistantContent, Message, ToolCall, ToolFunction, ToolResultContent, UserContent,
+};
+
+/// Convert a slice of [`ChatMessage`] into RIG [`Message`]s.
+///
+/// System messages are skipped (the system prompt is set on the agent).
+///
+/// A single persisted assistant message may contain a flattened multi-turn
+/// tool loop: `[text, tool_calls, tool_results, text]`. This function
+/// reconstructs the turn boundaries Anthropic expects:
+/// `assistant(text + tool_calls)`, `user(tool_results)`, `assistant(text)`.
+pub fn to_rig_messages(messages: &[ChatMessage]) -> Vec<Message> {
+ messages.iter().flat_map(convert_one).collect()
+}
+
+fn convert_one(msg: &ChatMessage) -> Vec<Message> {
+ match msg.role {
+ Role::System => vec![],
+ Role::User => {
+ let text = msg.content.message_text();
+ vec![Message::user(text)]
+ }
+ Role::Assistant => convert_assistant(msg),
+ }
+}
+
+fn convert_assistant(msg: &ChatMessage) -> Vec<Message> {
+ let parts = match &msg.content {
+ ChatMessageContent::Text(text) => {
+ return vec![Message::assistant(text)];
+ }
+ ChatMessageContent::AssistantMessageParts(parts) => parts,
+ };
+
+ let mut out: Vec<Message> = Vec::new();
+ let mut assistant_parts: Vec<AssistantContent> = Vec::new();
+ let mut tool_results: Vec<UserContent> = Vec::new();
+ let mut saw_tool_call = false;
+
+ for part in parts {
+ match part {
+ AssistantMessagePart::Text { text } => {
+ if saw_tool_call {
+ flush(&mut out, &mut assistant_parts, &mut tool_results);
+ saw_tool_call = false;
+ }
+ if let Some(AssistantContent::Text(prev)) = assistant_parts.last_mut() {
+ prev.text.push_str(text);
+ } else {
+ assistant_parts.push(AssistantContent::text(text));
+ }
+ }
+ AssistantMessagePart::ToolCall { name, json, id } => {
+ saw_tool_call = true;
+ assistant_parts.push(AssistantContent::ToolCall(ToolCall::new(
+ id.clone(),
+ ToolFunction::new(name.clone(), json.clone()),
+ )));
+ }
+ AssistantMessagePart::McpToolCall { name, json, id, .. } => {
+ saw_tool_call = true;
+ assistant_parts.push(AssistantContent::ToolCall(ToolCall::new(
+ id.clone(),
+ ToolFunction::new(name.clone(), json.clone()),
+ )));
+ }
+ AssistantMessagePart::ToolCallResponseJson { id, json, .. } => {
+ let text = serde_json::to_string(json).unwrap_or_default();
+ tool_results.push(UserContent::tool_result(
+ id.clone(),
+ OneOrMany::one(ToolResultContent::text(text)),
+ ));
+ }
+ AssistantMessagePart::ToolCallErr {
+ id, description, ..
+ } => {
+ tool_results.push(UserContent::tool_result(
+ id.clone(),
+ OneOrMany::one(ToolResultContent::text(description.clone())),
+ ));
+ }
+ }
+ }
+
+ flush(&mut out, &mut assistant_parts, &mut tool_results);
+ out
+}
+
+fn flush(
+ out: &mut Vec<Message>,
+ assistant_parts: &mut Vec<AssistantContent>,
+ tool_results: &mut Vec<UserContent>,
+) {
+ if !assistant_parts.is_empty() {
+ let parts = std::mem::take(assistant_parts);
+ if let Ok(content) = OneOrMany::many(parts) {
+ out.push(Message::Assistant { id: None, content });
+ }
+ }
+ if !tool_results.is_empty() {
+ let results = std::mem::take(tool_results);
+ if let Ok(content) = OneOrMany::many(results) {
+ out.push(Message::User { content });
+ }
+ }
+}
diff --git a/rust/cloud-storage/agent/src/convert/test.rs b/rust/cloud-storage/agent/src/convert/test.rs
new file mode 100644
index 0000000000..88bd00e42e
--- /dev/null
+++ b/rust/cloud-storage/agent/src/convert/test.rs
@@ -0,0 +1,349 @@
+use super::*;
+use rig_core::message::{AssistantContent, Message, UserContent};
+use serde_json::json;
+
+fn user_msg(text: &str) -> ChatMessage {
+ ChatMessage {
+ role: Role::User,
+ content: ChatMessageContent::Text(text.to_owned()),
+ attachments: None,
+ }
+}
+
+fn assistant_text(text: &str) -> ChatMessage {
+ ChatMessage {
+ role: Role::Assistant,
+ content: ChatMessageContent::Text(text.to_owned()),
+ attachments: None,
+ }
+}
+
+fn system_msg(text: &str) -> ChatMessage {
+ ChatMessage {
+ role: Role::System,
+ content: ChatMessageContent::Text(text.to_owned()),
+ attachments: None,
+ }
+}
+
+fn assistant_parts(parts: Vec<AssistantMessagePart>) -> ChatMessage {
+ ChatMessage {
+ role: Role::Assistant,
+ content: ChatMessageContent::AssistantMessageParts(parts),
+ attachments: None,
+ }
+}
+
+#[test]
+fn user_message_converts_to_rig_user() {
+ let messages = to_rig_messages(&[user_msg("hello")]);
+ assert_eq!(messages.len(), 1);
+ assert!(matches!(&messages[0], Message::User { .. }));
+ let Message::User { content } = &messages[0] else {
+ panic!("expected user message");
+ };
+ let UserContent::Text(text) = content.first() else {
+ panic!("expected text content");
+ };
+ assert_eq!(text.text, "hello");
+}
+
+#[test]
+fn assistant_text_converts_to_rig_assistant() {
+ let messages = to_rig_messages(&[assistant_text("hi back")]);
+ assert_eq!(messages.len(), 1);
+ assert!(matches!(&messages[0], Message::Assistant { .. }));
+}
+
+#[test]
+fn system_messages_are_skipped() {
+ let messages = to_rig_messages(&[system_msg("you are helpful"), user_msg("hi")]);
+ assert_eq!(messages.len(), 1);
+ assert!(matches!(&messages[0], Message::User { .. }));
+}
+
+#[test]
+fn empty_input_produces_empty_output() {
+ let messages = to_rig_messages(&[]);
+ assert!(messages.is_empty());
+}
+
+#[test]
+fn multi_turn_conversation() {
+ let messages = to_rig_messages(&[
+ user_msg("what is 2+2?"),
+ assistant_text("4"),
+ user_msg("thanks"),
+ ]);
+ assert_eq!(messages.len(), 3);
+ assert!(matches!(&messages[0], Message::User { .. }));
+ assert!(matches!(&messages[1], Message::Assistant { .. }));
+ assert!(matches!(&messages[2], Message::User { .. }));
+}
+
+#[test]
+fn tool_call_produces_assistant_with_tool_use() {
+ let msg = assistant_parts(vec![AssistantMessagePart::ToolCall {
+ name: "search".to_owned(),
+ json: json!({"query": "test"}),
+ id: "call_1".to_owned(),
+ }]);
+ let messages = to_rig_messages(&[msg]);
+ assert_eq!(messages.len(), 1);
+ let Message::Assistant { content, .. } = &messages[0] else {
+ panic!("expected assistant message");
+ };
+ assert!(matches!(content.first(), AssistantContent::ToolCall(_)));
+}
+
+#[test]
+fn tool_call_with_response_splits_into_two_messages() {
+ let msg = assistant_parts(vec![
+ AssistantMessagePart::ToolCall {
+ name: "search".to_owned(),
+ json: json!({"query": "test"}),
+ id: "call_1".to_owned(),
+ },
+ AssistantMessagePart::ToolCallResponseJson {
+ name: "search".to_owned(),
+ json: json!({"results": []}),
+ id: "call_1".to_owned(),
+ },
+ ]);
+ let messages = to_rig_messages(&[msg]);
+ assert_eq!(messages.len(), 2);
+ assert!(matches!(&messages[0], Message::Assistant { .. }));
+ assert!(matches!(&messages[1], Message::User { .. }));
+
+ let Message::User { content } = &messages[1] else {
+ panic!("expected user message with tool result");
+ };
+ assert!(matches!(content.first(), UserContent::ToolResult(_)));
+}
+
+#[test]
+fn multiple_tool_calls_with_responses_stay_grouped() {
+ let msg = assistant_parts(vec![
+ AssistantMessagePart::ToolCall {
+ name: "search".to_owned(),
+ json: json!({"query": "a"}),
+ id: "call_1".to_owned(),
+ },
+ AssistantMessagePart::ToolCall {
+ name: "read".to_owned(),
+ json: json!({"id": "doc_1"}),
+ id: "call_2".to_owned(),
+ },
+ AssistantMessagePart::ToolCallResponseJson {
+ name: "search".to_owned(),
+ json: json!({"results": ["x"]}),
+ id: "call_1".to_owned(),
+ },
+ AssistantMessagePart::ToolCallResponseJson {
+ name: "read".to_owned(),
+ json: json!({"content": "hello"}),
+ id: "call_2".to_owned(),
+ },
+ ]);
+ let messages = to_rig_messages(&[msg]);
+ assert_eq!(messages.len(), 2, "should be one assistant + one user");
+
+ let Message::Assistant { content, .. } = &messages[0] else {
+ panic!("expected assistant");
+ };
+ assert_eq!(content.len(), 2, "two tool calls in assistant message");
+
+ let Message::User { content } = &messages[1] else {
+ panic!("expected user");
+ };
+ assert_eq!(content.len(), 2, "two tool results in user message");
+}
+
+#[test]
+fn tool_call_error_becomes_tool_result() {
+ let msg = assistant_parts(vec![
+ AssistantMessagePart::ToolCall {
+ name: "delete".to_owned(),
+ json: json!({"id": "x"}),
+ id: "call_1".to_owned(),
+ },
+ AssistantMessagePart::ToolCallErr {
+ name: "delete".to_owned(),
+ description: "permission denied".to_owned(),
+ id: "call_1".to_owned(),
+ },
+ ]);
+ let messages = to_rig_messages(&[msg]);
+ assert_eq!(messages.len(), 2);
+
+ let Message::User { content } = &messages[1] else {
+ panic!("expected user message with tool result");
+ };
+ let UserContent::ToolResult(result) = content.first() else {
+ panic!("expected tool result");
+ };
+ assert_eq!(result.id, "call_1");
+}
+
+#[test]
+fn mcp_tool_call_converts_like_regular_tool_call() {
+ let msg = assistant_parts(vec![AssistantMessagePart::McpToolCall {
+ name: "slack_search".to_owned(),
+ service: "slack".to_owned(),
+ display_name: Some("Search Slack".to_owned()),
+ json: json!({"query": "standup"}),
+ id: "call_mcp".to_owned(),
+ }]);
+ let messages = to_rig_messages(&[msg]);
+ assert_eq!(messages.len(), 1);
+
+ let Message::Assistant { content, .. } = &messages[0] else {
+ panic!("expected assistant");
+ };
+ let AssistantContent::ToolCall(tc) = content.first() else {
+ panic!("expected tool call");
+ };
+ assert_eq!(tc.function.name, "slack_search");
+}
+
+#[test]
+fn adjacent_text_parts_are_merged() {
+ let msg = assistant_parts(vec![
+ AssistantMessagePart::Text {
+ text: "I'll dem".to_owned(),
+ },
+ AssistantMessagePart::Text {
+ text: "o a few tools.".to_owned(),
+ },
+ AssistantMessagePart::Text {
+ text: " Here we go.".to_owned(),
+ },
+ ]);
+ let messages = to_rig_messages(&[msg]);
+ assert_eq!(messages.len(), 1);
+
+ let Message::Assistant { content, .. } = &messages[0] else {
+ panic!("expected assistant");
+ };
+ assert_eq!(content.len(), 1);
+ let AssistantContent::Text(text) = content.first() else {
+ panic!("expected text");
+ };
+ assert_eq!(text.text, "I'll demo a few tools. Here we go.");
+}
+
+#[test]
+fn text_after_tool_calls_splits_into_new_assistant_message() {
+ let msg = assistant_parts(vec![
+ AssistantMessagePart::Text {
+ text: "Let me ".to_owned(),
+ },
+ AssistantMessagePart::Text {
+ text: "search.".to_owned(),
+ },
+ AssistantMessagePart::ToolCall {
+ name: "search".to_owned(),
+ json: json!({"q": "x"}),
+ id: "c1".to_owned(),
+ },
+ AssistantMessagePart::Text {
+ text: "Found ".to_owned(),
+ },
+ AssistantMessagePart::Text {
+ text: "results.".to_owned(),
+ },
+ ]);
+ let messages = to_rig_messages(&[msg]);
+ assert_eq!(
+ messages.len(),
+ 2,
+ "first assistant (text+tool), second assistant (text)"
+ );
+
+ let Message::Assistant { content, .. } = &messages[0] else {
+ panic!("expected first assistant");
+ };
+ assert_eq!(content.len(), 2, "merged text + tool call");
+
+ let Message::Assistant { content, .. } = &messages[1] else {
+ panic!("expected second assistant");
+ };
+ assert_eq!(content.len(), 1);
+ let AssistantContent::Text(text) = content.first() else {
+ panic!("expected text");
+ };
+ assert_eq!(text.text, "Found results.");
+}
+
+#[test]
+fn text_and_tool_calls_coexist_in_assistant_message() {
+ let msg = assistant_parts(vec![
+ AssistantMessagePart::Text {
+ text: "Let me search for that.".to_owned(),
+ },
+ AssistantMessagePart::ToolCall {
+ name: "search".to_owned(),
+ json: json!({"q": "foo"}),
+ id: "call_1".to_owned(),
+ },
+ ]);
+ let messages = to_rig_messages(&[msg]);
+ assert_eq!(messages.len(), 1);
+
+ let Message::Assistant { content, .. } = &messages[0] else {
+ panic!("expected assistant");
+ };
+ assert_eq!(content.len(), 2);
+ assert!(matches!(
+ &content.iter().next().unwrap(),
+ AssistantContent::Text(_)
+ ));
+}
+
+#[test]
+fn full_conversation_with_tool_round_trip() {
+ let messages = to_rig_messages(&[
+ user_msg("search for cats"),
+ assistant_parts(vec![
+ AssistantMessagePart::Text {
+ text: "Searching...".to_owned(),
+ },
+ AssistantMessagePart::ToolCall {
+ name: "search".to_owned(),
+ json: json!({"query": "cats"}),
+ id: "c1".to_owned(),
+ },
+ AssistantMessagePart::ToolCallResponseJson {
+ name: "search".to_owned(),
+ json: json!({"results": ["cat1", "cat2"]}),
+ id: "c1".to_owned(),
+ },
+ AssistantMessagePart::Text {
+ text: "Found 2 cats.".to_owned(),
+ },
+ ]),
+ user_msg("tell me more about cat1"),
+ ]);
+
+ // The flattened assistant message splits into 3 messages:
+ // assistant(text + tool_call), user(tool_result), assistant(text)
+ assert_eq!(messages.len(), 5);
+ assert!(matches!(&messages[0], Message::User { .. }));
+ assert!(matches!(&messages[1], Message::Assistant { .. }));
+ assert!(matches!(&messages[2], Message::User { .. }));
+ assert!(matches!(&messages[3], Message::Assistant { .. }));
+ assert!(matches!(&messages[4], Message::User { .. }));
+
+ let Message::User { content } = &messages[2] else {
+ panic!("expected tool result user message");
+ };
+ assert!(matches!(content.first(), UserContent::ToolResult(_)));
+
+ let Message::Assistant { content, .. } = &messages[3] else {
+ panic!("expected second assistant message");
+ };
+ let AssistantContent::Text(text) = content.first() else {
+ panic!("expected text");
+ };
+ assert_eq!(text.text, "Found 2 cats.");
+}
diff --git a/rust/cloud-storage/agent/src/error.rs b/rust/cloud-storage/agent/src/error.rs
new file mode 100644
index 0000000000..0e023ba516
--- /dev/null
+++ b/rust/cloud-storage/agent/src/error.rs
@@ -0,0 +1,19 @@
+/// Errors produced by the agent crate.
+#[derive(Debug, thiserror::Error)]
+pub enum AgentError {
+ /// An error from the RIG completion layer.
+ #[error(transparent)]
+ Completion(#[from] rig_core::completion::CompletionError),
+ /// An error from the RIG prompt/agentic loop.
+ #[error(transparent)]
+ Prompt(#[from] rig_core::completion::PromptError),
+ /// An error from the RIG streaming layer.
+ #[error(transparent)]
+ Streaming(#[from] rig_core::agent::StreamingError),
+ /// Serialization / deserialization failure.
+ #[error(transparent)]
+ Json(#[from] serde_json::Error),
+ /// Catch-all.
+ #[error(transparent)]
+ Other(#[from] anyhow::Error),
+}
diff --git a/rust/cloud-storage/agent/src/hook.rs b/rust/cloud-storage/agent/src/hook.rs
new file mode 100644
index 0000000000..1e021eec5f
--- /dev/null
+++ b/rust/cloud-storage/agent/src/hook.rs
@@ -0,0 +1,94 @@
+use crate::AgentError;
+/// A [`rig_core::agent::PromptHook`] that bridges RIG lifecycle events into
+/// [`StreamPart`] items sent through a channel.
+use crate::stream::{StreamPart, ToolCall, ToolResponse, Usage};
+use rig_core::agent::{HookAction, PromptHook, ToolCallHookAction};
+use rig_core::completion::{CompletionModel, GetTokenUsage};
+use rig_core::message::Message;
+use tokio::sync::mpsc;
+
+/// Sends [`StreamPart`] items through an unbounded channel as the RIG agentic
+/// loop produces events.
+#[derive(Clone)]
+pub struct StreamBridge {
+ tx: mpsc::UnboundedSender<Result<StreamPart, AgentError>>,
+}
+
+impl StreamBridge {
+ /// Create a bridge and its receiving half.
+ pub fn channel() -> (
+ Self,
+ mpsc::UnboundedReceiver<Result<StreamPart, AgentError>>,
+ ) {
+ let (tx, rx) = mpsc::unbounded_channel();
+ (Self { tx }, rx)
+ }
+}
+
+impl<M> PromptHook<M> for StreamBridge
+where
+ M: CompletionModel,
+ M::StreamingResponse: GetTokenUsage + Send + Sync,
+{
+ async fn on_text_delta(&self, text_delta: &str, _aggregated_text: &str) -> HookAction {
+ let _ = self.tx.send(Ok(StreamPart::Content(text_delta.to_owned())));
+ HookAction::Continue
+ }
+
+ async fn on_tool_call(
+ &self,
+ tool_name: &str,
+ tool_call_id: Option<String>,
+ internal_call_id: &str,
+ args: &str,
+ ) -> ToolCallHookAction {
+ let json = serde_json::from_str(args).unwrap_or(serde_json::Value::Null);
+ let id = tool_call_id.unwrap_or_else(|| internal_call_id.to_owned());
+ let _ = self.tx.send(Ok(StreamPart::ToolCall(ToolCall {
+ id,
+ name: tool_name.to_owned(),
+ json,
+ mcp: None,
+ })));
+ ToolCallHookAction::Continue
+ }
+
+ async fn on_tool_result(
+ &self,
+ tool_name: &str,
+ tool_call_id: Option<String>,
+ internal_call_id: &str,
+ _args: &str,
+ result: &str,
+ ) -> HookAction {
+ let id = tool_call_id.unwrap_or_else(|| internal_call_id.to_owned());
+ let response = match serde_json::from_str::<serde_json::Value>(result) {
+ Ok(json) => ToolResponse::Json {
+ id,
+ json,
+ name: tool_name.to_owned(),
+ },
+ Err(_) => ToolResponse::Err {
+ id,
+ name: tool_name.to_owned(),
+ description: result.to_owned(),
+ },
+ };
+ let _ = self.tx.send(Ok(StreamPart::ToolResponse(response)));
+ HookAction::Continue
+ }
+
+ async fn on_stream_completion_response_finish(
+ &self,
+ _prompt: &Message,
+ response: &M::StreamingResponse,
+ ) -> HookAction {
+ if let Some(usage) = response.token_usage() {
+ let _ = self.tx.send(Ok(StreamPart::Usage(Usage {
+ input_tokens: usage.input_tokens,
+ output_tokens: usage.output_tokens,
+ })));
+ }
+ HookAction::Continue
+ }
+}
diff --git a/rust/cloud-storage/agent/src/lib.rs b/rust/cloud-storage/agent/src/lib.rs
new file mode 100644
index 0000000000..87e6ed1483
--- /dev/null
+++ b/rust/cloud-storage/agent/src/lib.rs
@@ -0,0 +1,27 @@
+#![deny(missing_docs)]
+
+//! Agent crate — agentic loop
+
+mod agent_loop;
+mod anthropic_model;
+mod completion;
+mod convert;
+mod error;
+mod hook;
+mod model;
+mod stream;
+/// Structured output via prompted JSON generation.
+pub mod structured_output;
+mod tool_adapter;
+pub mod types;
+
+pub use agent_loop::{AgentLoop, Session};
+pub use completion::{complete, complete_with_history};
+pub use convert::to_rig_messages;
+pub use error::AgentError;
+pub use hook::StreamBridge;
+pub use model::AgentModel;
+pub use stream::{ChatCompletionStream, McpInfo, StreamPart, ToolCall, ToolResponse, Usage};
+pub use tool_adapter::{DynToolSetAdapter, ToolsetToolAdapter};
+
+pub use rig_core::tool::{Tool, ToolDyn};
diff --git a/rust/cloud-storage/agent/src/model.rs b/rust/cloud-storage/agent/src/model.rs
new file mode 100644
index 0000000000..ab2e5eb89a
--- /dev/null
+++ b/rust/cloud-storage/agent/src/model.rs
@@ -0,0 +1,87 @@
+/// Supported models for the agent loop.
+use rig_core::providers::anthropic;
+use serde::{Deserialize, Serialize};
+use strum::{Display, EnumIter, EnumString};
+use utoipa::ToSchema;
+
+/// Model to use for completions.
+///
+/// Unrecognized model strings (including retired Google/OpenAI variants
+/// from older data) deserialize to `Retired` via the manual
+/// `Deserialize` impl.
+#[derive(
+ Serialize, Debug, Clone, Copy, PartialEq, Eq, Display, EnumString, EnumIter, ToSchema, Default,
+)]
+#[serde(rename_all = "camelCase")]
+pub enum AgentModel {
+ /// Best available model
+ #[default]
+ Smart,
+ /// Fastest available model
+ Fast,
+ /// Claude Opus 4.7
+ Opus4_7,
+ /// Claude Sonnet 4.6
+ Sonnet4_6,
+ /// Claude Haiku 4.5
+ Haiku4_5,
+ /// Retired or unrecognized model, routes to the default
+ Retired,
+}
+
+impl<'de> Deserialize<'de> for AgentModel {
+ fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
+ let s = String::deserialize(deserializer)?;
+ #[derive(Deserialize)]
+ #[serde(rename_all = "camelCase")]
+ enum Known {
+ Smart,
+ Fast,
+ Opus4_7,
+ Sonnet4_6,
+ Haiku4_5,
+ Retired,
+ }
+ match serde_json::from_value::<Known>(serde_json::Value::String(s)) {
+ Ok(Known::Smart) => Ok(Self::Smart),
+ Ok(Known::Fast) => Ok(Self::Fast),
+ Ok(Known::Opus4_7) => Ok(Self::Opus4_7),
+ Ok(Known::Sonnet4_6) => Ok(Self::Sonnet4_6),
+ Ok(Known::Haiku4_5) => Ok(Self::Haiku4_5),
+ Ok(Known::Retired) => Ok(Self::Retired),
+ Err(_) => Ok(Self::Retired),
+ }
+ }
+}
+
+impl AgentModel {
+ /// Returns the Anthropic API model identifier.
+ pub fn api_id(&self) -> &'static str {
+ match self {
+ Self::Smart | Self::Opus4_7 | Self::Retired => anthropic::completion::CLAUDE_OPUS_4_7,
+ Self::Fast | Self::Haiku4_5 => anthropic::completion::CLAUDE_HAIKU_4_5,
+ Self::Sonnet4_6 => anthropic::completion::CLAUDE_SONNET_4_6,
+ }
+ }
+
+ /// Context window size in tokens.
+ pub fn context_window(&self) -> u64 {
+ match self {
+ Self::Smart | Self::Opus4_7 | Self::Sonnet4_6 | Self::Retired => 1_000_000,
+ Self::Fast | Self::Haiku4_5 => 200_000,
+ }
+ }
+
+ /// API provider name.
+ pub fn provider(&self) -> &'static str {
+ "anthropic"
+ }
+
+ /// from json or Retired
+ pub fn from_json_or_default(json: &str) -> Self {
+ serde_json::from_str(json).unwrap_or(Self::Retired)
+ }
+}
+
+#[cfg(test)]
+mod test;
diff --git a/rust/cloud-storage/agent/src/model/test.rs b/rust/cloud-storage/agent/src/model/test.rs
new file mode 100644
index 0000000000..487f7b5c28
--- /dev/null
+++ b/rust/cloud-storage/agent/src/model/test.rs
@@ -0,0 +1,60 @@
+use super::*;
+
+#[test]
+fn retired_model_deserializes_to_retired() {
+ let m: AgentModel = serde_json::from_str(r#""claude-opus-4-6""#).unwrap();
+ assert_eq!(m, AgentModel::Retired);
+}
+
+#[test]
+fn smart_deserializes() {
+ let m: AgentModel = serde_json::from_str(r#""smart""#).unwrap();
+ assert_eq!(m, AgentModel::Smart);
+}
+
+#[test]
+fn fast_deserializes() {
+ let m: AgentModel = serde_json::from_str(r#""fast""#).unwrap();
+ assert_eq!(m, AgentModel::Fast);
+}
+
+#[test]
+fn smart_routes_to_opus() {
+ assert_eq!(AgentModel::Smart.api_id(), AgentModel::Opus4_7.api_id());
+}
+
+#[test]
+fn fast_routes_to_haiku() {
+ assert_eq!(AgentModel::Fast.api_id(), AgentModel::Haiku4_5.api_id());
+}
+
+#[test]
+fn retired_google_model_falls_back() {
+ let m: AgentModel = serde_json::from_str(r#""gemini-2.5-pro""#).unwrap();
+ assert_eq!(m, AgentModel::Retired);
+}
+
+#[test]
+fn retired_openai_model_falls_back() {
+ let m: AgentModel = serde_json::from_str(r#""gpt-4o""#).unwrap();
+ assert_eq!(m, AgentModel::Retired);
+}
+
+#[test]
+fn retired_uses_default_api_id() {
+ assert_eq!(AgentModel::Retired.api_id(), AgentModel::Smart.api_id());
+}
+
+#[test]
+fn round_trip_serialization() {
+ let m = AgentModel::Sonnet4_6;
+ let json = serde_json::to_string(&m).unwrap();
+ assert_eq!(json, r#""sonnet4_6""#);
+ let back: AgentModel = serde_json::from_str(&json).unwrap();
+ assert_eq!(back, m);
+}
+
+#[test]
+fn default_is_smart() {
+ assert_eq!(AgentModel::default(), AgentModel::Smart);
+}
diff --git a/rust/cloud-storage/agent/src/stream.rs b/rust/cloud-storage/agent/src/stream.rs
new file mode 100644
index 0000000000..49b1e6a40b
--- /dev/null
+++ b/rust/cloud-storage/agent/src/stream.rs
@@ -0,0 +1,78 @@
+/// Stream of agent events, compatible with existing DCS consumers.
+use crate::error::AgentError;
+use futures::stream::Stream;
+use serde::Serialize;
+use std::pin::Pin;
+
+/// The main streaming type returned by [`crate::Session::send_message`].
+pub type ChatCompletionStream<'a> =
+ Pin<Box<dyn Stream<Item = Result<StreamPart, AgentError>> + Send + 'a>>;
+
+/// An individual event in the agent stream.
+#[derive(Debug, Clone)]
+pub enum StreamPart {
+ /// A text delta from the assistant.
+ Content(String),
+ /// A complete tool invocation by the assistant.
+ ToolCall(ToolCall),
+ /// The result of executing a tool.
+ ToolResponse(ToolResponse),
+ /// Token usage for one completion round-trip.
+ Usage(Usage),
+}
+
+/// Metadata identifying an MCP (external) tool.
+#[derive(Debug, Clone, Serialize)]
+pub struct McpInfo {
+ /// The MCP server name.
+ pub service: String,
+ /// The original (un-mangled) tool name.
+ pub tool_name: String,
+ /// Human-readable display name, if the server provides one.
+ pub display_name: Option<String>,
+}
+
+/// A tool call made by the assistant.
+#[derive(Debug, Clone, Serialize)]
+pub struct ToolCall {
+ /// Provider-assigned call ID.
+ pub id: String,
+ /// Tool name (mangled for MCP tools).
+ pub name: String,
+ /// Parsed JSON arguments.
+ pub json: serde_json::Value,
+ /// Present when this is an MCP tool call.
+ pub mcp: Option<McpInfo>,
+}
+
+/// Result of a tool execution.
+#[derive(Debug, Clone)]
+pub enum ToolResponse {
+ /// Successful execution with JSON output.
+ Json {
+ /// The call ID this response corresponds to.
+ id: String,
+ /// The JSON output from the tool.
+ json: serde_json::Value,
+ /// The tool name.
+ name: String,
+ },
+ /// Failed execution.
+ Err {
+ /// The call ID this response corresponds to.
+ id: String,
+ /// The tool name.
+ name: String,
+ /// Human-readable error description.
+ description: String,
+ },
+}
+
+/// Token usage for a completion round-trip.
+#[derive(Debug, Clone)]
+pub struct Usage {
+ /// Tokens consumed by the input.
+ pub input_tokens: u64,
+ /// Tokens generated in the output.
+ pub output_tokens: u64,
+}
diff --git a/rust/cloud-storage/agent/src/structured_output.rs b/rust/cloud-storage/agent/src/structured_output.rs
new file mode 100644
index 0000000000..2c7ae7b9d0
--- /dev/null
+++ b/rust/cloud-storage/agent/src/structured_output.rs
@@ -0,0 +1,58 @@
+/// Structured output via prompted JSON generation.
+use anyhow::Context;
+use rig_core::message::Message;
+use serde::{Deserialize, Serialize};
+use utoipa::ToSchema;
+
+use crate::model::AgentModel;
+
+/// Schema definition for dynamic structured completions.
+#[derive(Debug, Serialize, Deserialize, ToSchema)]
+pub struct DynamicSchema {
+ /// The JSON schema to validate against.
+ pub schema: serde_json::Value,
+ /// Name of the schema.
+ pub name: String,
+ /// Optional description of what the schema represents.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
+}
+
+/// Run a completion with conversation history and return a JSON value
+/// conforming to `schema`.
+#[tracing::instrument(skip(system_prompt, messages, schema), err)]
+pub async fn dynamic_structured_completion(
+ model: AgentModel,
+ system_prompt: &str,
+ messages: Vec<Message>,
+ schema: DynamicSchema,
+) -> anyhow::Result<serde_json::Value> {
+ let structured_prompt = format!(
+ "{system_prompt}\n\n\
+ You MUST respond with ONLY a valid JSON object matching this schema.\n\
+ Schema name: {name}\n\
+ {desc}\
+ Schema:\n```json\n{schema_json}\n```\n\
+ Respond with ONLY the raw JSON object. No markdown fences, no explanation.",
+ name = schema.name,
+ desc = schema
+ .description
+ .as_deref()
+ .map(|d| format!("{d}\n"))
+ .unwrap_or_default(),
+ schema_json = serde_json::to_string_pretty(&schema.schema)?,
+ );
+
+ let response =
+ crate::completion::complete_with_history(model, &structured_prompt, messages).await?;
+
+ let trimmed = response.trim();
+ let json_str = if let Some(rest) = trimmed.strip_prefix("```") {
+ let inner = rest.strip_prefix("json").unwrap_or(rest);
+ inner.strip_suffix("```").unwrap_or(inner).trim()
+ } else {
+ trimmed
+ };
+
+ serde_json::from_str(json_str).context("Failed to parse structured output as JSON")
+}
diff --git a/rust/cloud-storage/agent/src/tool_adapter.rs b/rust/cloud-storage/agent/src/tool_adapter.rs
new file mode 100644
index 0000000000..ed7b08cf1c
--- /dev/null
+++ b/rust/cloud-storage/agent/src/tool_adapter.rs
@@ -0,0 +1,205 @@
+/// Adapts `ai_toolset` tool types into RIG [`ToolDyn`] objects.
+use ai_toolset::tool_object::ToolSetCallable;
+use ai_toolset::{AsyncToolCollection, RequestContext, RequestSchema, ToolSet as AiToolSet};
+use rig_core::completion::ToolDefinition;
+use rig_core::tool::{ToolDyn, ToolError};
+use rig_core::wasm_compat::WasmBoxedFuture;
+use std::sync::{Arc, RwLock};
+
+type Deserializer<Context> = Box<
+ dyn Fn(
+ &serde_json::Value,
+ ) -> Result<Box<dyn ToolSetCallable<Context> + Send + Sync>, serde_json::Error>
+ + Send
+ + Sync,
+>;
+
+/// Wraps a single tool from an [`AsyncToolCollection`] as a RIG [`ToolDyn`].
+///
+/// The adapter captures the shared service context and a mutable request
+/// context (user ID) so that `ai_toolset` tools can be called through
+/// RIG's agentic loop without modification.
+pub struct ToolsetToolAdapter<Context> {
+ name: String,
+ description: String,
+ input_schema: serde_json::Value,
+ deserializer: Deserializer<Context>,
+ context: Arc<Context>,
+ request_context: Arc<RwLock<RequestContext>>,
+}
+
+impl<Context> ToolsetToolAdapter<Context>
+where
+ Context: Clone + Send + Sync + 'static,
+{
+ /// Consume an [`AsyncToolCollection`] and produce one [`ToolsetToolAdapter`]
+ /// per registered tool.
+ ///
+ /// `context` is the shared service context (e.g. `ToolServiceContext`).
+ /// `request_context` is shared across all adapters and should be set before
+ /// each session.
+ pub fn from_collection(
+ collection: AsyncToolCollection<Context>,
+ context: Arc<Context>,
+ request_context: Arc<RwLock<RequestContext>>,
+ ) -> Vec<Self> {
+ collection
+ .tools
+ .into_iter()
+ .map(|(name, tool_object)| {
+ let description = tool_object.description.clone();
+ let input_schema = serde_json::Value::Object(tool_object.input_schema.clone());
+ let deserializer = Box::new(
+ move |json: &serde_json::Value| -> Result<
+ Box<dyn ToolSetCallable<Context> + Send + Sync>,
+ serde_json::Error,
+ > { tool_object.try_deserialize(json) },
+ );
+
+ ToolsetToolAdapter {
+ name,
+ description,
+ input_schema,
+ deserializer,
+ context: context.clone(),
+ request_context: request_context.clone(),
+ }
+ })
+ .collect()
+ }
+}
+
+// Safety: inner fields are all Send + Sync.
+unsafe impl<C: Send + Sync> Send for ToolsetToolAdapter<C> {}
+unsafe impl<C: Send + Sync> Sync for ToolsetToolAdapter<C> {}
+
+impl<Context> ToolDyn for ToolsetToolAdapter<Context>
+where
+ Context: Clone + Send + Sync + 'static,
+{
+ fn name(&self) -> String {
+ self.name.clone()
+ }
+
+ fn definition<'a>(&'a self, _prompt: String) -> WasmBoxedFuture<'a, ToolDefinition> {
+ let def = ToolDefinition {
+ name: self.name.clone(),
+ description: self.description.clone(),
+ parameters: self.input_schema.clone(),
+ };
+ Box::pin(async move { def })
+ }
+
+ fn call<'a>(&'a self, args: String) -> WasmBoxedFuture<'a, Result<String, ToolError>> {
+ Box::pin(async move {
+ let json: serde_json::Value =
+ serde_json::from_str(&args).map_err(ToolError::JsonError)?;
+ let callable = (self.deserializer)(&json).map_err(ToolError::JsonError)?;
+ let ctx = (*self.context).clone();
+ let req_ctx = self
+ .request_context
+ .read()
+ .expect("request_context lock poisoned")
+ .clone();
+ match callable.call(ctx, req_ctx).await {
+ Ok(value) => serde_json::to_string(&value).map_err(ToolError::JsonError),
+ Err(e) => {
+ tracing::error!(error = ?e.internal_error, "toolset tool error");
+ Err(ToolError::ToolCallError(e.description.into()))
+ }
+ }
+ })
+ }
+}
+
+/// Wraps a single tool from a [`dyn AiToolSet`] as a RIG [`ToolDyn`].
+///
+/// Unlike [`ToolsetToolAdapter`] which takes ownership of tools from an
+/// `AsyncToolCollection`, this adapter delegates every call through the
+/// shared [`AiToolSet`] trait object. This supports `CombinedToolSet`
+/// (static tools + MCP tools) without decomposing it.
+pub struct DynToolSetAdapter<Context> {
+ name: String,
+ schema: serde_json::Value,
+ toolset: Arc<dyn AiToolSet<Context> + Send + Sync>,
+ context: Arc<Context>,
+ request_context: Arc<RwLock<RequestContext>>,
+}
+
+impl<Context> DynToolSetAdapter<Context>
+where
+ Context: Clone + Send + Sync + 'static,
+{
+ /// Create one [`DynToolSetAdapter`] per tool in `toolset`.
+ ///
+ /// Tool names and schemas are read from
+ /// [`AiToolSet::request_schemas`]. Calls are dispatched through the
+ /// shared `toolset`.
+ pub fn from_toolset(
+ toolset: Arc<dyn AiToolSet<Context> + Send + Sync>,
+ context: Arc<Context>,
+ request_context: Arc<RwLock<RequestContext>>,
+ ) -> Vec<Self> {
+ let schemas = toolset.request_schemas().unwrap_or_default();
+ schemas
+ .into_iter()
+ .map(|RequestSchema { name, schema }| {
+ let schema_json = serde_json::to_value(&schema)
+ .unwrap_or(serde_json::Value::Object(serde_json::Map::new()));
+ DynToolSetAdapter {
+ name,
+ schema: schema_json,
+ toolset: toolset.clone(),
+ context: context.clone(),
+ request_context: request_context.clone(),
+ }
+ })
+ .collect()
+ }
+}
+
+unsafe impl<C: Send + Sync> Send for DynToolSetAdapter<C> {}
+unsafe impl<C: Send + Sync> Sync for DynToolSetAdapter<C> {}
+
+impl<Context> ToolDyn for DynToolSetAdapter<Context>
+where
+ Context: Clone + Send + Sync + 'static,
+{
+ fn name(&self) -> String {
+ self.name.clone()
+ }
+
+ fn definition<'a>(&'a self, _prompt: String) -> WasmBoxedFuture<'a, ToolDefinition> {
+ let def = ToolDefinition {
+ name: self.name.clone(),
+ description: String::new(),
+ parameters: self.schema.clone(),
+ };
+ Box::pin(async move { def })
+ }
+
+ fn call<'a>(&'a self, args: String) -> WasmBoxedFuture<'a, Result<String, ToolError>> {
+ Box::pin(async move {
+ let json: serde_json::Value =
+ serde_json::from_str(&args).map_err(ToolError::JsonError)?;
+ let ctx = (*self.context).clone();
+ let req_ctx = self
+ .request_context
+ .read()
+ .expect("request_context lock poisoned")
+ .clone();
+ match self
+ .toolset
+ .try_tool_call(ctx, req_ctx, &self.name, &json)
+ .await
+ {
+ Ok(Ok(value)) => serde_json::to_string(&value).map_err(ToolError::JsonError),
+ Ok(Err(e)) => {
+ tracing::error!(error = ?e.internal_error, "tool error");
+ Err(ToolError::ToolCallError(e.description.into()))
+ }
+ Err(e) => Err(ToolError::ToolCallError(e.to_string().into())),
+ }
+ })
+ }
+}
diff --git a/rust/cloud-storage/agent/src/types.rs b/rust/cloud-storage/agent/src/types.rs
new file mode 100644
index 0000000000..3acbb1a456
--- /dev/null
+++ b/rust/cloud-storage/agent/src/types.rs
@@ -0,0 +1,269 @@
+//! Message and model types previously exported from `ai::types`.
+//!
+//! These live in the `agent` crate so that consumers which relied on
+//! `ai::types::{Role, ChatMessage, …}` can import them from `agent::types`
+//! instead.
+
+use attachment::Attachments;
+use serde::{Deserialize, Serialize};
+use std::fmt;
+use strum::{Display, EnumString};
+use utoipa::ToSchema;
+
+// ---------------------------------------------------------------------------
+// Role
+// ---------------------------------------------------------------------------
+
+/// The role of a message participant.
+#[derive(
+ Serialize,
+ Deserialize,
+ Debug,
+ Clone,
+ Copy,
+ PartialEq,
+ Eq,
+ Display,
+ EnumString,
+ ToSchema,
+ strum::AsRefStr,
+)]
+#[strum(serialize_all = "lowercase")]
+#[serde(rename_all = "lowercase")]
+pub enum Role {
+ /// A user message.
+ User,
+ /// An assistant (model) message.
+ Assistant,
+ /// A system prompt.
+ System,
+}
+
+// ---------------------------------------------------------------------------
+// AssistantMessagePart
+// ---------------------------------------------------------------------------
+
+/// A structured part within an assistant message.
+///
+/// When the model responds with tool calls the full turn is persisted as a
+/// flat sequence of these parts. [`crate::convert::to_rig_messages`]
+/// reconstructs the turn boundaries that providers expect.
+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]
+#[serde(tag = "type", rename_all = "camelCase")]
+pub enum AssistantMessagePart {
+ /// Plain text produced by the model.
+ Text {
+ /// The text content.
+ text: String,
+ },
+ /// A native tool call issued by the model.
+ ToolCall {
+ /// Tool name.
+ name: String,
+ /// Tool arguments as JSON.
+ json: serde_json::Value,
+ /// Provider-assigned call id.
+ id: String,
+ },
+ /// A tool call routed through an MCP service.
+ McpToolCall {
+ /// Tool name.
+ name: String,
+ /// MCP service identifier.
+ service: String,
+ /// Optional human-readable name.
+ display_name: Option<String>,
+ /// Tool arguments as JSON.
+ json: serde_json::Value,
+ /// Provider-assigned call id.
+ id: String,
+ },
+ /// A JSON response from a tool call.
+ ToolCallResponseJson {
+ /// Tool name.
+ name: String,
+ /// Response payload.
+ json: serde_json::Value,
+ /// Corresponding call id.
+ id: String,
+ },
+ /// An error response from a tool call.
+ ToolCallErr {
+ /// Tool name.
+ name: String,
+ /// Human-readable error description.
+ description: String,
+ /// Corresponding call id.
+ id: String,
+ },
+}
+
+impl fmt::Display for AssistantMessagePart {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ Self::Text { text } => write!(f, "{text}"),
+ Self::ToolCall { name, id, .. } => write!(f, "[tool_call:{name}({id})]"),
+ Self::McpToolCall {
+ name, service, id, ..
+ } => write!(f, "[mcp_tool_call:{service}/{name}({id})]"),
+ Self::ToolCallResponseJson { name, id, .. } => {
+ write!(f, "[tool_response:{name}({id})]")
+ }
+ Self::ToolCallErr {
+ name, description, ..
+ } => write!(f, "[tool_err:{name}: {description}]"),
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// ChatMessageContent
+// ---------------------------------------------------------------------------
+
+/// The content of a [`ChatMessage`].
+///
+/// For user and system messages the content is plain [`Text`](Self::Text).
+/// For assistant messages it may additionally be a sequence of
+/// [`AssistantMessagePart`]s that encode tool-call round trips.
+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]
+#[serde(untagged)]
+pub enum ChatMessageContent {
+ /// Plain text content.
+ Text(String),
+ /// Structured assistant message parts.
+ AssistantMessageParts(Vec<AssistantMessagePart>),
+}
+
+impl Default for ChatMessageContent {
+ fn default() -> Self {
+ Self::Text(String::default())
+ }
+}
+
+impl ChatMessageContent {
+ /// Extract text suitable for display from a user message.
+ ///
+ /// Returns the full text for [`Text`](Self::Text) or an empty string for
+ /// structured parts (which belong to assistant messages).
+ pub fn user_message_text(&self) -> Option<String> {
+ match self {
+ Self::Text(t) => Some(t.clone()),
+ Self::AssistantMessageParts(_) => None,
+ }
+ }
+
+ /// Extract text from an assistant message, ignoring tool parts.
+ pub fn assistant_message_text(&self) -> Option<String> {
+ match self {
+ Self::Text(t) => Some(t.clone()),
+ Self::AssistantMessageParts(parts) => {
+ let mut s = String::new();
+ for p in parts {
+ if let AssistantMessagePart::Text { text } = p {
+ s.push_str(text);
+ }
+ }
+ Some(s)
+ }
+ }
+ }
+
+ /// Extract text from an assistant message, including a summary of tool
+ /// calls.
+ pub fn assistant_message_text_with_tools(&self) -> Option<String> {
+ match self {
+ Self::Text(t) => Some(t.clone()),
+ Self::AssistantMessageParts(parts) => {
+ let mut s = String::new();
+ for p in parts {
+ use std::fmt::Write;
+ let _ = write!(s, "{p}");
+ }
+ Some(s)
+ }
+ }
+ }
+
+ /// Extract text from a system message.
+ pub fn system_message_text(&self) -> Option<String> {
+ match self {
+ Self::Text(t) => Some(t.clone()),
+ Self::AssistantMessageParts(_) => None,
+ }
+ }
+
+ /// Extract the text content regardless of role.
+ pub fn message_text(&self) -> String {
+ match self {
+ Self::Text(t) => t.clone(),
+ Self::AssistantMessageParts(parts) => {
+ let mut s = String::new();
+ for p in parts {
+ if let AssistantMessagePart::Text { text } = p {
+ s.push_str(text);
+ }
+ }
+ s
+ }
+ }
+ }
+
+ /// Like [`message_text`](Self::message_text) but includes tool-call
+ /// summaries.
+ pub fn message_text_with_tools(&self) -> String {
+ match self {
+ Self::Text(t) => t.clone(),
+ Self::AssistantMessageParts(parts) => {
+ let mut s = String::new();
+ for p in parts {
+ use std::fmt::Write;
+ let _ = write!(s, "{p}");
+ }
+ s
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// ChatMessage
+// ---------------------------------------------------------------------------
+
+/// A single chat message with its role, content, and optional attachments.
+#[derive(Debug)]
+pub struct ChatMessage {
+ /// The content of the message.
+ pub content: ChatMessageContent,
+ /// Which participant produced this message.
+ pub role: Role,
+ /// Resolved attachments (if any) associated with this message.
+ pub attachments: Option<Attachments<'static>>,
+}
+
+// ---------------------------------------------------------------------------
+// ChatMessages
+// ---------------------------------------------------------------------------
+
+/// A sequence of [`ChatMessage`]s.
+#[derive(Debug)]
+pub struct ChatMessages(pub Vec<ChatMessage>);
+
+impl ChatMessages {
+ /// Borrow the inner slice.
+ pub fn as_slice(&self) -> &[ChatMessage] {
+ &self.0
+ }
+}
+
+impl From<Vec<ChatMessage>> for ChatMessages {
+ fn from(v: Vec<ChatMessage>) -> Self {
+ Self(v)
+ }
+}
+
+impl std::ops::Deref for ChatMessages {
+ type Target = [ChatMessage];
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
diff --git a/rust/cloud-storage/ai/examples/searchington.rs b/rust/cloud-storage/ai/examples/searchington.rs
deleted file mode 100644
index 881ef014a2..0000000000
--- a/rust/cloud-storage/ai/examples/searchington.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-use ai::web_search::PerplexityClient;
-
-#[tokio::main]
-async fn main() {
- let client = PerplexityClient::from_env().expect("Perplexity client");
- let search_results = client
- .simple_search(
- "what is the price of plntr today",
- "You are an internal search tool provide good results ok yes",
- )
- .await
- .inspect_err(|err| println!("request failed: {:#?}", err))
- .unwrap();
- println!("{:#?}", search_results);
-}
diff --git a/rust/cloud-storage/ai/src/bin/cli.rs b/rust/cloud-storage/ai/src/bin/cli.rs
deleted file mode 100644
index 369a434484..0000000000
--- a/rust/cloud-storage/ai/src/bin/cli.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-use ai::tool::Cli;
-
-#[tokio::main]
-async fn main() {
- Cli::default().run().await;
-}
diff --git a/rust/cloud-storage/ai/src/chat_completion.rs b/rust/cloud-storage/ai/src/chat_completion.rs
deleted file mode 100644
index a4d5d1ad0b..0000000000
--- a/rust/cloud-storage/ai/src/chat_completion.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Non-streaming chat completion via Anthropic */
-use crate::types::{AnthropicClient, ChatCompletionError, ChatCompletionRequest, ExtendedClient};
-use async_openai::types::chat::CreateChatCompletionRequest;
-use futures::StreamExt;
-
-#[tracing::instrument(skip(request), fields(model=?request.model, message_count=?request.messages.len()))]
-pub async fn get_chat_completion(
- request: ChatCompletionRequest,
-) -> Result<String, ChatCompletionError> {
- let openai_request: CreateChatCompletionRequest = request
- .try_into()
- .map_err(ChatCompletionError::RequestError)?;
-
- collect_anthropic_stream(openai_request).await
-}
-
-pub async fn get_chat_completion_openai_request(
- request: CreateChatCompletionRequest,
-) -> Result<String, ChatCompletionError> {
- collect_anthropic_stream(request).await
-}
-
-async fn collect_anthropic_stream(
- request: CreateChatCompletionRequest,
-) -> Result<String, ChatCompletionError> {
- let client = AnthropicClient::default();
- let mut stream = client
- .chat_stream(request)
- .await
- .map_err(|e| ChatCompletionError::RequestError(e.into()))?;
-
- let mut content = String::new();
-
- while let Some(item) = stream.next().await {
- let item = item?;
- if let crate::types::ExtendedOpenAIStreamItem::Response(response) = item {
- for choice in response.choices {
- if let Some(text) = choice.delta.content {
- content.push_str(&text);
- }
- if let Some(refusal) = choice.delta.refusal {
- return Err(ChatCompletionError::Refusal(refusal));
- }
- }
- }
- }
-
- if content.is_empty() {
- return Err(ChatCompletionError::NoContent);
- }
-
- Ok(content)
-}
diff --git a/rust/cloud-storage/ai/src/chat_stream.rs b/rust/cloud-storage/ai/src/chat_stream.rs
deleted file mode 100644
index b0e2dffb4a..0000000000
--- a/rust/cloud-storage/ai/src/chat_stream.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Streaming chat completion */
-use crate::types::OpenRouterClient;
-use crate::types::{ChatCompletionRequest, ChatStreamCompletionResponse};
-use anyhow::{Context, Result};
-use async_openai::types::chat::CreateChatCompletionRequest;
-use futures::{Stream, StreamExt};
-use std::pin::Pin;
-
-pub type ChatStream = Pin<
- Box<
- dyn Stream<Item = Result<Vec<ChatStreamCompletionResponse>, anyhow::Error>>
- + Send
- + 'static,
- >,
->;
-
-#[tracing::instrument(skip(request), fields(model=?request.model, message_count=?request.messages.len()), err)]
-pub async fn get_chat_stream(request: ChatCompletionRequest) -> Result<ChatStream> {
- let client = OpenRouterClient::new();
- let mut openai_request: CreateChatCompletionRequest =
- request.try_into().context("into openai_request")?;
-
- // bastard async_openai feature
- // when the byot feature is enabled create_stream doesn't automatically set this and the api returns an error
- openai_request.stream = Some(true);
-
- let stream = client
- .chat()
- .create_stream(openai_request)
- .await
- .context("error creating openai stream")?;
-
- Ok(Box::pin(stream.map(|response| {
- Ok(vec![
- response
- .context("bad request - no stream returned")?
- .try_into()
- .context("unexpected response")?,
- ])
- })))
-}
diff --git a/rust/cloud-storage/ai/src/lib.rs b/rust/cloud-storage/ai/src/lib.rs
deleted file mode 100644
index c0997b02e7..0000000000
--- a/rust/cloud-storage/ai/src/lib.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-pub mod chat_completion;
-pub mod chat_stream;
-pub mod model_selection;
-pub mod openai_toolset;
-pub mod prompts;
-pub mod simple_completion;
-pub mod structured_output_v2;
-pub mod tool;
-pub mod traits;
-pub mod types;
-pub mod web_search;
-
-pub use ai_toolset::generate_tool_input_schema;
-pub use ai_toolset::generate_tool_output_schema;
diff --git a/rust/cloud-storage/ai/src/model_selection.rs b/rust/cloud-storage/ai/src/model_selection.rs
deleted file mode 100644
index 7ace84c5f8..0000000000
--- a/rust/cloud-storage/ai/src/model_selection.rs
+++ /dev/null
@@ -1,118 +0,0 @@
-use crate::types::{Model, ModelWithMetadataAndProvider};
-use anyhow::{Context, Result};
-
-/// 15 percent of the context window as a threshold
-/// this is to account fot the difference in tokenization between different models
-const THRESHOLD_PERCENTAGE: f64 = 0.15;
-
-#[derive(Debug)]
-pub struct ModelSelection {
- pub available_models: Vec<Model>,
- pub new_model: Option<Model>,
-}
-
-/// Returns the threshold for a given model
-pub fn get_threshold_for_model(model: &Model) -> i64 {
- let context_window = model.metadata().context_window as f64;
- (context_window * THRESHOLD_PERCENTAGE) as i64
-}
-
-#[tracing::instrument]
-pub fn select_model(
- current_model: Option<Model>,
- token_count: i64,
- models: Vec<Model>,
-) -> Result<ModelSelection> {
- // Filter out models that don't have enough of a context window
- let available_models = models
- .into_iter()
- .filter(|m| {
- (m.metadata().context_window as i64 - get_threshold_for_model(m)) >= token_count
- })
- .collect::<Vec<Model>>();
-
- tracing::trace!("available models: {:#?}", available_models);
-
- // Selects a model from the available models
- // disregarding provider preference
- let select_model_without_provider = |available_models: &Vec<Model>| -> Result<Model> {
- Ok(*available_models
- .iter()
- .map(|m| (m, m.metadata().context_window as i64))
- .max_by(|a, b| a.1.cmp(&b.1))
- .iter()
- .next_back()
- .context("no available models")?
- .0)
- };
-
- // If the current model is not in the list of available models, find the closest model
- if available_models.iter().any(|m| Some(*m) == current_model) {
- Ok(ModelSelection {
- available_models,
- new_model: None,
- })
- } else {
- let new_model = select_model_without_provider(&available_models)?;
- tracing::info!(
- "switching model from {:?} to {}, for token count {}",
- current_model,
- new_model,
- token_count
- );
-
- Ok(ModelSelection {
- available_models,
- new_model: Some(new_model),
- })
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use crate::types::Model;
- use strum::IntoEnumIterator;
- #[test]
- #[ignore]
- fn test_model_selection() {
- // Without a current model, we should still select a model
- let without_current = select_model(None, 250000, Model::iter().collect()).unwrap();
- assert_eq!(without_current.available_models.len(), 2);
- assert!(without_current.new_model.is_some());
- assert_eq!(without_current.new_model.unwrap(), Model::Gemini20Flash);
-
- // current model that is available should not change the selection
- let with_current =
- select_model(Some(Model::Gemini20Flash), 250000, Model::iter().collect()).unwrap();
- assert_eq!(with_current.available_models.len(), 2);
- assert!(with_current.new_model.is_none());
-
- // current model that is not available should select the closest model
- let with_bad_current =
- select_model(Some(Model::Gemini20Flash), 500000, Model::iter().collect()).unwrap();
- assert_eq!(with_bad_current.available_models.len(), 2);
- assert!(with_bad_current.new_model.is_some());
- assert_eq!(with_bad_current.new_model.unwrap(), Model::Gemini20Flash);
- }
-
- #[test]
- fn test_model_gemini() {
- let token_count = 56292;
- let models = &[
- Model::Gemini25Pro,
- Model::Gemini15Pro,
- Model::Gemini20Flash,
- Model::OpenAiGpt41,
- Model::OpenAIo3,
- Model::Claude4Sonnet,
- ];
- let new_model = select_model(Some(Model::Gemini20Flash), token_count, models.to_vec())
- .expect("model selection");
- assert_eq!(new_model.new_model, None);
-
- let new_model = select_model(Some(Model::Gemini15Pro), token_count, models.to_vec())
- .expect("model selection");
- assert_eq!(new_model.new_model, None);
- }
-}
diff --git a/rust/cloud-storage/ai/src/openai_toolset.rs b/rust/cloud-storage/ai/src/openai_toolset.rs
deleted file mode 100644
index 38802b159e..0000000000
--- a/rust/cloud-storage/ai/src/openai_toolset.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-//! OpenAI API integration for toolsets.
-//!
-//! This module provides conversions to OpenAI's tool types for use with
-//! the `async-openai` crate.
-
-use ai_toolset::ToolCollection;
-use ai_toolset::tool_object::ToolObject;
-use async_openai::types::chat::{ChatCompletionTool, ChatCompletionTools, FunctionObject};
-
-/// Converts a ToolObject to an OpenAI ChatCompletionTool.
-pub fn tool_object_to_chat_completion_tool<T>(value: &ToolObject<T>) -> ChatCompletionTool {
- ChatCompletionTool {
- function: FunctionObject {
- name: value.name.clone(),
- description: Some(value.description.clone()),
- parameters: Some(serde_json::Value::Object(value.input_schema.clone())),
- strict: Some(true),
- },
- }
-}
-
-/// Extension trait for ToolSet to convert to OpenAI chat completion tools.
-pub trait OpenAIToolSetExt {
- /// Converts this toolset to a vector of OpenAI chat completion tools.
- ///
- /// Returns tool definitions suitable for use with OpenAI's function calling API.
- fn openai_chatcompletion_toolset(&self) -> Vec<ChatCompletionTools>;
-}
-
-impl<T> OpenAIToolSetExt for ToolCollection<ToolObject<T>> {
- fn openai_chatcompletion_toolset(&self) -> Vec<ChatCompletionTools> {
- self.tools
- .values()
- .map(|t| ChatCompletionTools::Function(tool_object_to_chat_completion_tool(t)))
- .collect()
- }
-}
diff --git a/rust/cloud-storage/ai/src/prompts/base.md b/rust/cloud-storage/ai/src/prompts/base.md
deleted file mode 100644
index b63059863d..0000000000
--- a/rust/cloud-storage/ai/src/prompts/base.md
+++ /dev/null
@@ -1,110 +0,0 @@
-# Tone and Style
-
-- Be correctness-obsessed, precise, and confident.
-- Use a casual, natural tone, but avoid hedging (no "maybe", "perhaps").
-- Do not be whiny. Do not use the word "however."
-- Always use Markdown for formatting.
-
----
-
-# Math Rendering Rules
-
-- Render **all mathematical expressions** (even simple arithmetic) in LaTeX enclosed with double dollar signs `$$ ... $$`.
-- Examples:
- - Simple: $$ 2 + 2 = 4 $$
- - Fractions: $$ \frac{1}{2} $$
- - Quadratic formula: $$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $$
- - Multi-line:
- $$
- \begin{aligned}
- f(x) &= x^2 + 3x + 2 \\
- &= (x+1)(x+2)
- \end{aligned}
- $$
-
----
-
-# Citation Rules
-
-There are two systems: `[[...]]` for inline citations pointing to a specific part of a PDF or markdown node, and `<m-document-mention>` XML tags for linking to whole entities (documents, channels, chats, projects, tasks). Never mix them.
-
-General citation rules:
-
-- You must include citations from the provided source text when answering.
-- Never fabricate citations.
-- You may cite links by using a standard markdown link: [text](url)
-- To cite documents use the following citation formats. If no id's are present in your converstation chain do not
- cite documents.
-
-Citing Pdfs:
-You can cite a specific part of a pdf by using the ID's that are included in the PDF context.They
-appear in the pdf context as 36-character UUIDs enclosed in double quare brackets `[[uuid]]`
-
-- Include a citation at most once in your final response.
-- Example:
- - Source: "… establish Justice[[f52821e6-1f90-4a25-96a1-271022148151]]."
- - Response: "The document establishes justice[[f52821e6-1f90-4a25-96a1-271022148151]]."
-
-Citing parts of markdown content:
-You can cite specific parts of markdown documents by:
-
-- Citations come from `$` metadata blocks inside the stringified JSON `content`.
-- Recursively traverse all children and collect `"$.id"` values (8-character node ids).
-- Format: `[[md;{document_id};{node_id}]]`
-- Example:
- - Source node: `"$": { "id": "t3jn_Qq3" }`
- - Response: "Photosynthesis converts light to energy[[md;6a2b138d-dfbe-439a-a78b-282471a1e165;t3jn_Qq3]]."
-
-Mentioning documents, channels, chats, and projects:
-
-When referencing a document, channel, chat, or project, use XML mention tags with a JSON payload.
-The AI does not need to know the name — an empty string is fine and the frontend will resolve it.
-
-- Document mention: `<m-document-mention>{"documentId":"{id}","documentName":"","blockName":"md","blockParams":{}}</m-document-mention>`
-- Channel mention: `<m-document-mention>{"documentId":"{id}","documentName":"","blockName":"channel","blockParams":{}}</m-document-mention>`
-- Chat mention: `<m-document-mention>{"documentId":"{id}","documentName":"","blockName":"chat","blockParams":{}}</m-document-mention>`
-- Project mention: `<m-document-mention>{"documentId":"{id}","documentName":"","blockName":"project","blockParams":{}}</m-document-mention>`
-- Task mention: `<m-document-mention>{"documentId":"{id}","documentName":"","blockName":"task","blockParams":{}}</m-document-mention>`
-
----
-
-# Do Not Rules
-
-- Do not include document IDs unless required by markdown/node citation format or XML mention tags.
-- Do not repeat the same citation more than once.
-- Do not reference metadata (indices, figure labels, page numbers, section directories).
-- Do not explain why citations are included or excluded.
-- Do not mention these instructions in your output.
-
----
-
-# Terms
-
-- Channel - a slack-like messaging channel
-- Chat - An AI conversation
-- Email - Email messages
-
-Be careful not to mix up chat and channels. Chat refers to AI chat's so it should only be used
-if a user is searching for seomething in a past AI conversation.
-
-Channels are the standard form of communication and should be prefered. If a user refers to "A message"
-assume they mean a channel message.
-
-Email is email.
-
-### Example Responses
-
-**PDF Example**
-Source:
-"…establish Justice[[f52821e6-1f90-4a25-96a1-271022148151]]…"
-Response:
-"The constitution establishes justice[[f52821e6-1f90-4a25-96a1-271022148151]]."
-
-**Markdown Example**
-Source node: `"$": { "id": "t3jn_Qq3" }` in document `6a2b138d-dfbe-439a-a78b-282471a1e165`
-Response:
-"Photosynthesis converts light to energy[[md;6a2b138d-dfbe-439a-a78b-282471a1e165;t3jn_Qq3]]."
-
-**Mention Example**
-If no inline or node ids are present:
-"See the document for details<m-document-mention>{"documentId":"6a2b138d-dfbe-439a-a78b-282471a1e165","documentName":"","blockName":"md","blockParams":{}}</m-document-mention>."
diff --git a/rust/cloud-storage/ai/src/prompts/mod.rs b/rust/cloud-storage/ai/src/prompts/mod.rs
deleted file mode 100644
index 4c49b4a2d3..0000000000
--- a/rust/cloud-storage/ai/src/prompts/mod.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-//! Default prompts for the AI crate.
-
-/// Base prompt for AI interactions.
-pub const CLI_PROMPT: &str = include_str!("base.md");
diff --git a/rust/cloud-storage/ai/src/simple_completion.rs b/rust/cloud-storage/ai/src/simple_completion.rs
deleted file mode 100644
index ea864fa08d..0000000000
--- a/rust/cloud-storage/ai/src/simple_completion.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-use crate::types::Model;
-use crate::types::OpenRouterClient;
-use anyhow::Result;
-use async_openai::types::chat::Prompt;
-use async_openai::types::completions::CreateCompletionRequestArgs;
-
-pub async fn simple_completion(prompt: &str, request: &str, model: Model) -> Result<String> {
- let client = OpenRouterClient::new();
- let prompt = format!(
- "___SYSTEM PROMPT___\n{}\n___END SYSTEM PROMPT___\n___BEGIN REQUEST___\n{}",
- prompt, request
- );
- let request = CreateCompletionRequestArgs::default()
- .model(model.to_string())
- .prompt(Prompt::String(prompt))
- .stream(false)
- .build()?;
-
- let response = client.completions().create(request).await?;
-
- for choice in response.choices {
- if !choice.text.is_empty() {
- return Ok(choice.text);
- }
- }
- Err(anyhow::anyhow!("completion returned empty response"))
-}
diff --git a/rust/cloud-storage/ai/src/structured_output_v2.rs b/rust/cloud-storage/ai/src/structured_output_v2.rs
deleted file mode 100644
index 24a9195821..0000000000
--- a/rust/cloud-storage/ai/src/structured_output_v2.rs
+++ /dev/null
@@ -1,92 +0,0 @@
-use crate::traits::Metadata;
-use crate::types::{ChatCompletionRequest, OpenRouterClient};
-use anyhow::{Context, Result};
-use async_openai::types::chat::{
- CreateChatCompletionRequestArgs, ResponseFormat, ResponseFormatJsonSchema,
-};
-use schemars::JsonSchema;
-use serde::{Deserialize, Serialize};
-use serde_json;
-use utoipa::ToSchema;
-
-#[derive(Debug, Serialize, Deserialize, ToSchema)]
-pub struct DynamicSchema {
- pub schema: serde_json::Value,
- pub name: String,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub description: Option<String>,
-}
-
-/// this doesn't work with anything that serialized as "OneOf" / "AnyOf" (enums)
-#[tracing::instrument]
-pub async fn structured_completion_v2<S>(request: ChatCompletionRequest) -> Result<S>
-where
- S: Metadata + JsonSchema,
-{
- let request = request.as_structured_request::<S>(false)?;
- let client = OpenRouterClient::new();
- let response = client.chat().create(request).await;
-
- match response {
- Ok(chat_response) => {
- // Add better error handling here
- if !chat_response.choices.is_empty() {
- for choice in chat_response.choices {
- if let Some(content) = choice.message.content {
- return serde_json::from_str::<S>(&content)
- .map_err(anyhow::Error::from)
- .context("Unable to deserialize structured output");
- }
- }
- }
- }
- Err(e) => {
- tracing::error!("API call failed with error: {:?}", e);
- anyhow::bail!("API call failed: {}", e);
- }
- }
-
- anyhow::bail!("Expected structured response")
-}
-
-#[tracing::instrument(skip(request), err)]
-pub async fn dynamic_structured_completion(
- request: ChatCompletionRequest,
- schema: DynamicSchema,
-) -> Result<serde_json::Value> {
- let response_format = ResponseFormat::JsonSchema {
- json_schema: ResponseFormatJsonSchema {
- description: schema.description,
- name: schema.name,
- schema: Some(schema.schema),
- strict: Some(true),
- },
- };
-
- let model = request.model();
- let openai_request = CreateChatCompletionRequestArgs::default()
- .model(format!("{}/{}", model.to_provider_model_string().0, model))
- .messages(request.openai_messages())
- .response_format(response_format)
- .build()
- .context("Could not build structured completion request")?;
-
- let client = OpenRouterClient::new();
- let response = client.chat().create(openai_request).await;
-
- match response {
- Ok(chat_response) => {
- for choice in chat_response.choices {
- if let Some(content) = choice.message.content {
- return serde_json::from_str::<serde_json::Value>(&content)
- .context("Failed to parse structured output as JSON");
- }
- }
- anyhow::bail!("Structured completion returned no content")
- }
- Err(e) => {
- tracing::error!(error=?e, "Structured completion API call failed");
- anyhow::bail!("Structured completion failed: {}", e)
- }
- }
-}
diff --git a/rust/cloud-storage/ai/src/tool/completion.rs b/rust/cloud-storage/ai/src/tool/completion.rs
deleted file mode 100644
index c10fb37ad9..0000000000
--- a/rust/cloud-storage/ai/src/tool/completion.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-use super::types::ToolCall;
-use super::types::tool_object::ToolObject;
-use crate::openai_toolset::tool_object_to_chat_completion_tool;
-use crate::types::{AiError, Result};
-use crate::types::{ChatCompletionRequest, OpenRouterClient};
-use async_openai::types::chat::{
- ChatCompletionMessageToolCalls, ChatCompletionToolChoiceOption, ChatCompletionTools,
- CreateChatCompletionRequest, ToolChoiceOptions,
-};
-
-#[tracing::instrument(skip(tool))]
-pub async fn tool_completion<T>(
- request: ChatCompletionRequest,
- tool: &ToolObject<T>,
-) -> Result<ToolCall> {
- let mut request: CreateChatCompletionRequest = request.try_into()?;
- request.tools = Some(vec![ChatCompletionTools::Function(
- tool_object_to_chat_completion_tool(tool),
- )]);
- request.n = Some(1);
- request.tool_choice = Some(ChatCompletionToolChoiceOption::Mode(
- ToolChoiceOptions::Required,
- ));
-
- let client = OpenRouterClient::new();
- let response = client.chat().create(request).await?;
-
- response
- .choices
- .first()
- .ok_or_else(|| anyhow::anyhow!("No choices").into())
- .and_then(|choice| {
- let call = choice
- .message
- .tool_calls
- .as_ref()
- .ok_or_else(|| AiError::from(anyhow::anyhow!("No tool calls")))?
- .first()
- .ok_or_else(|| AiError::from(anyhow::anyhow!("No tool calls")))?;
- match call {
- ChatCompletionMessageToolCalls::Function(tool_call) => Ok(ToolCall {
- id: tool_call.id.clone(),
- json: serde_json::from_str(&tool_call.function.arguments)?,
- name: tool_call.function.name.clone(),
- mcp: None,
- }),
- ChatCompletionMessageToolCalls::Custom(_) => Err(AiError::from(anyhow::anyhow!(
- "Unexpected custom tool call"
- ))),
- }
- })
-}
diff --git a/rust/cloud-storage/ai/src/tool/mod.rs b/rust/cloud-storage/ai/src/tool/mod.rs
deleted file mode 100644
index c2c191f1ea..0000000000
--- a/rust/cloud-storage/ai/src/tool/mod.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-pub mod completion;
-pub mod tool_loop;
-pub mod types;
-
-pub use ai_toolset::generate_tool_input_schema;
-pub use ai_toolset::generate_tool_output_schema;
-pub use tool_loop::ai_client::ToolLoop;
-pub use tool_loop::cli::Cli;
-pub use types::tool_object::minimized_output_schema_generator;
-pub use types::{
- AiStream, AsyncTool, AsyncToolCollection, ChatCompletionStream, NoContext, RequestContext,
- RequestSchema, ServiceContext, StreamPart, ToolCall, ToolCallError, ToolCollection, ToolInfo,
- ToolResponse, ToolResult, ToolSchema, ToolSet, ToolSetCreationError, ToolSetError, schema,
- tool_object,
-};
diff --git a/rust/cloud-storage/ai/src/tool/tool_loop/ai_client.rs b/rust/cloud-storage/ai/src/tool/tool_loop/ai_client.rs
deleted file mode 100644
index 649507a9aa..0000000000
--- a/rust/cloud-storage/ai/src/tool/tool_loop/ai_client.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-use super::chat::Chat;
-use crate::openai_toolset::OpenAIToolSetExt;
-use crate::tool::types::{AsyncToolCollection, ToolSet};
-use crate::types::AnthropicClient;
-use crate::types::ExtendedClient;
-use anthropic::openai::request::{AnthropicRequestExtension, AnthropicRequestExtensions};
-use std::sync::Arc;
-
-pub struct ToolLoop<I, T, S = AsyncToolCollection<T>>
-where
- I: ExtendedClient + Clone + Send + Sync,
- T: Clone + Send + Sync,
-{
- client: I,
- context: T,
- toolset: Arc<S>,
-}
-
-impl<T, S> ToolLoop<AnthropicClient, T, S>
-where
- T: Clone + Send + Sync,
-{
- pub fn new(toolset: Arc<S>, context: T) -> Self {
- let extensions = AnthropicRequestExtensions(vec![
- AnthropicRequestExtension::WebSearchTool,
- AnthropicRequestExtension::FetchTool,
- AnthropicRequestExtension::CodeExecutionTool,
- ]);
- let client = AnthropicClient::new(extensions);
- Self {
- client,
- context,
- toolset,
- }
- }
-}
-
-impl<I, T, S> ToolLoop<I, T, S>
-where
- I: ExtendedClient + Clone + Send + Sync,
- T: Clone + Send + Sync,
- S: ToolSet<T> + OpenAIToolSetExt,
-{
- pub fn chat(&self) -> Chat<I, T, S> {
- Chat::new(
- self.client.clone(),
- self.toolset.clone(),
- self.context.clone(),
- )
- }
-}
diff --git a/rust/cloud-storage/ai/src/tool/tool_loop/chat/agent.rs b/rust/cloud-storage/ai/src/tool/tool_loop/chat/agent.rs
deleted file mode 100644
index 98110835fa..0000000000
--- a/rust/cloud-storage/ai/src/tool/tool_loop/chat/agent.rs
+++ /dev/null
@@ -1,565 +0,0 @@
-use super::MAX_RECURSIONS;
-use crate::openai_toolset::OpenAIToolSetExt;
-use crate::tool::types::{ChatCompletionStream, ExtendedPartStream, PartOrExt, ToolResponse};
-use crate::tool::types::{
- McpInfo, PartialToolCall, RequestContext, StreamPart, ToolCall, ToolInfo, ToolResult, ToolSet,
-};
-use crate::types::openai::message::convert_message;
-use crate::types::traits::{ExtendedOpenAIStream, ExtendedOpenAIStreamItem};
-use crate::types::{
- AssistantMessagePart, ChatCompletionRequest, ChatMessage, ChatMessageContent, ChatMessages,
-};
-use crate::types::{ExtendedClient, Result};
-use async_openai::types::chat::{
- ChatCompletionMessageToolCall, ChatCompletionMessageToolCalls,
- ChatCompletionRequestAssistantMessage, ChatCompletionRequestAssistantMessageContent,
- ChatCompletionRequestMessage, ChatCompletionRequestToolMessage, ChatCompletionStreamOptions,
- CreateChatCompletionRequest, FinishReason, FunctionCall,
-};
-use async_stream::stream;
-use futures::stream::StreamExt;
-use std::collections::{HashMap, HashSet};
-use std::sync::Arc;
-
-struct ProcessedStream {
- pub new_messages: Vec<ChatCompletionRequestMessage>,
- pub tool_responses: Vec<ToolResponse>,
-}
-
-pub struct Chat<I, T, S>
-where
- I: ExtendedClient + Send + Sync,
- T: Clone + Send + Sync + 'static,
-{
- client: I,
- toolset: Arc<S>,
- request: CreateChatCompletionRequest,
- pub(crate) messages: Vec<ChatCompletionRequestMessage>,
- context: T,
- pub(crate) initial_message_count: usize,
- pub(crate) tool_call_id_name_mapping: HashMap<String, String>, // tool_call_id -> tool_name
- user_id: String,
-}
-
-impl<I, T, S> Chat<I, T, S>
-where
- I: ExtendedClient + Send + Sync,
- T: Clone + Send + Sync,
- S: ToolSet<T> + OpenAIToolSetExt,
-{
- pub fn new(client: I, toolset: Arc<S>, context: T) -> Chat<I, T, S> {
- Chat {
- client,
- toolset,
- messages: vec![],
- context,
- request: CreateChatCompletionRequest::default(),
- initial_message_count: 0,
- tool_call_id_name_mapping: HashMap::new(),
- user_id: "Uninitialized".into(),
- }
- }
-
- #[tracing::instrument(skip(self, request_context), err)]
- pub async fn send_message(
- &mut self,
- request: ChatCompletionRequest,
- request_context: RequestContext,
- user_id: String,
- ) -> Result<ChatCompletionStream<'_>> {
- self.request = request.try_into()?;
- self.messages = self.request.messages.clone();
- self.initial_message_count = self.messages.len();
- self.user_id = user_id;
-
- self.make_chat_completion_stream(request_context).await
- }
-
- pub fn get_new_conversation_messages(&self) -> Vec<ChatMessage> {
- let messages: ChatMessages = self
- .messages
- .iter()
- .skip(self.initial_message_count)
- .map(|msg| convert_message(msg.clone(), Some(&self.tool_call_id_name_mapping)))
- .collect::<Vec<_>>()
- .into();
- messages
- .0
- .into_iter()
- .map(|msg| self.rewrite_mcp_tool_calls(msg))
- .collect()
- }
-
- fn rewrite_mcp_tool_calls(&self, mut msg: ChatMessage) -> ChatMessage {
- if let ChatMessageContent::AssistantMessageParts(parts) = msg.content {
- let parts = parts
- .into_iter()
- .map(|part| {
- let AssistantMessagePart::ToolCall { ref name, .. } = part else {
- return part;
- };
- let Some(ToolInfo::ExternalTool {
- service_name,
- tool_name,
- display_name,
- }) = self.toolset.routing_description(name)
- else {
- return part;
- };
- let AssistantMessagePart::ToolCall { json, id, .. } = part else {
- unreachable!()
- };
- AssistantMessagePart::McpToolCall {
- name: tool_name,
- service: service_name,
- display_name,
- json,
- id,
- }
- })
- .collect();
- msg.content = ChatMessageContent::AssistantMessageParts(parts);
- }
- msg
- }
-}
-
-impl<I, T, S> Chat<I, T, S>
-where
- I: ExtendedClient + Send + Sync,
- T: Clone + Send + Sync,
- S: ToolSet<T> + OpenAIToolSetExt,
-{
- #[tracing::instrument(err, skip_all)]
- async fn make_chat_completion_stream(
- &mut self,
- request_context: RequestContext,
- ) -> Result<ChatCompletionStream<'_>> {
- let item_stream = stream!({
- let mut stream_parts = vec![];
- 'outer: for _ in 0..MAX_RECURSIONS {
- let stream = match self.make_openai_chat_completion_stream().await {
- Ok(stream) => stream,
- Err(err) => {
- yield Err(err);
- break;
- }
- };
- {
- let mut stream = Self::map_stream(stream);
- // consume stream
- // accumulate to stream_parts
- while let Some(item) = stream.next().await {
- if let Err(e) = item {
- yield Err(e);
- break 'outer;
- }
-
- let part_or_ext = item.unwrap();
- match part_or_ext {
- ref part @ PartOrExt::Part(ref p) => {
- let enriched = self.enrich_stream_part(p);
- yield Ok(enriched);
- stream_parts.push(part.to_owned());
- }
- ref part @ PartOrExt::Ext(ref e) => {
- if let Some(p) = self.client.handle_extension_item(e.to_owned()) {
- let enriched = self.enrich_stream_part(&p);
- yield Ok(enriched);
- }
- stream_parts.push(part.to_owned());
- }
- }
- }
- }
- // call tools, aggregate response to a new request
- let mut processed = self
- .process_stream_parts(stream_parts, request_context.clone())
- .await;
-
- for response in &processed.tool_responses {
- yield Ok(StreamPart::ToolResponse(response.clone()));
- }
-
- self.messages.append(&mut processed.new_messages);
- // if there are no tool calls, then done
- if processed.tool_responses.is_empty() {
- break;
- }
- stream_parts = vec![];
- }
- });
- Ok(Box::pin(item_stream))
- }
-
- async fn process_stream_parts(
- &mut self,
- stream_parts: Vec<PartOrExt<I::ResponseExtension>>,
- request_context: RequestContext,
- ) -> ProcessedStream {
- let mut new_messages: Vec<ChatCompletionRequestMessage> = vec![];
- // yielded to consumer
- let mut tool_responses: Vec<ToolResponse> = vec![];
-
- // Current assistant segment being built
- let mut content = String::new();
- let mut tool_calls: Vec<ChatCompletionMessageToolCalls> = vec![];
- let mut pending_tool_messages: Vec<ChatCompletionRequestMessage> = vec![];
- let mut pending_part_tool_calls: Vec<ToolCall> = vec![];
-
- for item in stream_parts {
- match item {
- PartOrExt::Ext(ext) => {
- if let Some(stream_part) = self.client.handle_extension_item(ext) {
- match stream_part {
- StreamPart::ToolCall(call) => {
- self.tool_call_id_name_mapping
- .insert(call.id.clone(), call.name.clone());
- tool_calls.push(ChatCompletionMessageToolCalls::Function(
- ChatCompletionMessageToolCall {
- id: call.id.clone(),
- function: FunctionCall {
- arguments: call.json.to_string(),
- name: call.name.clone(),
- },
- },
- ));
- }
- StreamPart::Content(text) => content.push_str(text.as_str()),
- StreamPart::ToolResponse(ToolResponse::Json { id, json, .. }) => {
- // Server-side tool response - flush current assistant and start new segment
- if !content.is_empty() || !tool_calls.is_empty() {
- new_messages.push(
- self.make_assistant_message(&mut content, &mut tool_calls),
- );
- new_messages.append(&mut pending_tool_messages);
- }
- let content_text = serde_json::to_string_pretty(&json)
- .unwrap_or_else(|_| "internal error parsing".into());
- new_messages.push(ChatCompletionRequestMessage::Tool(
- ChatCompletionRequestToolMessage {
- content: async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
- content_text,
- ),
- tool_call_id: id,
- },
- ));
- }
- StreamPart::Usage { .. } | StreamPart::ToolResponse(_) => {}
- }
- }
- }
- PartOrExt::Part(part) => match part {
- StreamPart::ToolCall(call) => {
- self.tool_call_id_name_mapping
- .insert(call.id.clone(), call.name.clone());
- tool_calls.push(ChatCompletionMessageToolCalls::Function(
- ChatCompletionMessageToolCall {
- id: call.id.clone(),
- function: FunctionCall {
- arguments: call.json.to_string(),
- name: call.name.clone(),
- },
- },
- ));
- pending_part_tool_calls.push(call);
- }
- StreamPart::Content(text) => content.push_str(text.as_str()),
- StreamPart::Usage { .. } | StreamPart::ToolResponse(_) => {}
- },
- }
- }
-
- // Execute all tool calls concurrently
- if !pending_part_tool_calls.is_empty() {
- let tool_futures: Vec<_> = pending_part_tool_calls
- .iter()
- .map(|call| {
- let toolset = self.toolset.clone();
- let context = self.context.clone();
- let request_context = request_context.clone();
- let name = call.name.clone();
- let json = call.json.clone();
- async move {
- toolset
- .try_tool_call(context, request_context, &name, &json)
- .await
- }
- })
- .collect();
-
- let results = futures::future::join_all(tool_futures).await;
-
- for (call, result) in pending_part_tool_calls.iter().zip(results) {
- let tool_response_text = match result {
- Ok(ToolResult::Ok(output)) => {
- let json_string = serde_json::to_string_pretty(&output)
- .unwrap_or_else(|_| "internal error formatting response".to_string());
- tool_responses.push(ToolResponse::Json {
- id: call.id.clone(),
- json: output,
- name: call.name.clone(),
- });
- json_string
- }
- Ok(ToolResult::Err(fail)) => {
- tracing::error!(error=?fail, "tool execution error");
- tool_responses.push(ToolResponse::Err {
- id: call.id.clone(),
- description: fail.description.clone(),
- name: call.name.clone(),
- });
- fail.description
- }
- Err(err) => {
- tracing::error!(error=?err, "error calling tool");
- let desc = format!("Error calling tool: {}", err);
- tool_responses.push(ToolResponse::Err {
- id: call.id.clone(),
- description: desc.clone(),
- name: call.name.clone(),
- });
- desc
- }
- };
-
- pending_tool_messages.push(ChatCompletionRequestMessage::Tool(
- ChatCompletionRequestToolMessage {
- content:
- async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
- tool_response_text,
- ),
- tool_call_id: call.id.clone(),
- },
- ));
- }
- }
-
- // Flush remaining assistant content
- new_messages.push(self.make_assistant_message(&mut content, &mut tool_calls));
- new_messages.append(&mut pending_tool_messages);
-
- ProcessedStream {
- new_messages,
- tool_responses,
- }
- }
-
- fn make_assistant_message(
- &self,
- content: &mut String,
- tool_calls: &mut Vec<ChatCompletionMessageToolCalls>,
- ) -> ChatCompletionRequestMessage {
- ChatCompletionRequestMessage::Assistant(ChatCompletionRequestAssistantMessage {
- content: if content.is_empty() {
- None
- } else {
- Some(ChatCompletionRequestAssistantMessageContent::Text(
- std::mem::take(content),
- ))
- },
- tool_calls: if tool_calls.is_empty() {
- None
- } else {
- Some(std::mem::take(tool_calls))
- },
- ..Default::default()
- })
- }
-
- fn enrich_stream_part(&self, part: &StreamPart) -> StreamPart {
- match part {
- StreamPart::ToolCall(call) => {
- let mcp = self
- .toolset
- .routing_description(&call.name)
- .map(|info| match info {
- ToolInfo::ExternalTool {
- service_name,
- tool_name,
- display_name,
- } => McpInfo {
- service: service_name,
- tool_name,
- display_name,
- },
- });
- StreamPart::ToolCall(ToolCall {
- mcp,
- ..call.clone()
- })
- }
- other => other.clone(),
- }
- }
-
- fn map_stream<'a>(
- mut stream: ExtendedOpenAIStream<I::ResponseExtension>,
- ) -> ExtendedPartStream<'a, I::ResponseExtension> {
- let stream = stream!({
- let mut tool_calls: HashMap<u32, PartialToolCall> = HashMap::new();
- while let Some(item) = stream.next().await {
- match item {
- Ok(ExtendedOpenAIStreamItem::Response(part)) => {
- if let Some(usage) = &part.usage {
- yield Ok(PartOrExt::Part(StreamPart::Usage(usage.clone().into())))
- }
- let first = part.choices.first();
- if first.is_none() {
- continue;
- }
- let first = first.unwrap();
- if let Some(content) = &first.delta.content {
- yield Ok(PartOrExt::Part(StreamPart::Content(content.clone())));
- }
-
- if let Some(calls) = &first.delta.tool_calls {
- for call in calls {
- if let Some(function) = &call.function {
- tool_calls
- .entry(call.index)
- .and_modify(|partial| {
- if let Some(n) = &function.name {
- partial.name = n.to_owned();
- }
- if let Some(a) = &function.arguments.clone() {
- partial.json = format!("{}{}", partial.json, a);
- }
- if let Some(id) = &call.id {
- partial.id = id.clone();
- }
- })
- .or_insert_with(|| {
- let mut partial = PartialToolCall::default();
- if let Some(n) = function.name.clone() {
- partial.name = n;
- }
- if let Some(a) = function.arguments.clone() {
- partial.json = a;
- }
- if let Some(id) = &call.id {
- partial.id = id.clone();
- }
- partial
- });
- }
- }
- }
- if let Some(FinishReason::ToolCalls) = first.finish_reason {
- for call in tool_calls.into_values() {
- match ToolCall::try_from(call.clone()) {
- Ok(call) => {
- yield Ok(PartOrExt::Part(StreamPart::ToolCall(call)))
- }
- Err(e) => {
- tracing::error!(
- err=?e,
- "ToolCall::try_from failed from {:#?}",
- call
- );
- }
- }
- }
- tool_calls = HashMap::new();
- }
- }
- Ok(ExtendedOpenAIStreamItem::Extension(ext)) => {
- // Handle provider-specific extension items (Anthropic server tools)
- yield Ok(PartOrExt::Ext(ext));
- }
- Err(error) => yield Err(error.into()),
- }
- }
- });
- Box::pin(stream)
- }
-
- #[tracing::instrument(err, skip(self))]
- async fn make_openai_chat_completion_stream(
- &mut self,
- ) -> Result<ExtendedOpenAIStream<I::ResponseExtension>> {
- self.request.messages = correct_message_chain(self.messages.clone());
- self.request.tools = Some(self.toolset.openai_chatcompletion_toolset());
- self.request.stream = Some(true);
- self.request.stream_options = Some(ChatCompletionStreamOptions {
- include_usage: Some(true),
- include_obfuscation: None,
- });
-
- self.client.chat_stream(self.request.clone()).await
- }
-}
-
-// anthropic sometimes doesn't return responses for their servier tools. this causes 400's
-#[tracing::instrument(skip_all)]
-fn correct_message_chain(
- messages: Vec<ChatCompletionRequestMessage>,
-) -> Vec<ChatCompletionRequestMessage> {
- let mut corrected = vec![];
- let mut pending_tool_call_ids: Option<Vec<String>> = None;
- let mut i = 0;
-
- while i < messages.len() {
- let msg = &messages[i];
-
- if let Some(expected_ids) = pending_tool_call_ids.take() {
- // Consume as many matching tool responses as we can
- let mut responded: HashSet<String> = HashSet::new();
- while i < messages.len() {
- if let ChatCompletionRequestMessage::Tool(tool_msg) = &messages[i] {
- responded.insert(tool_msg.tool_call_id.clone());
- corrected.push(messages[i].clone());
- i += 1;
- } else {
- break;
- }
- }
- // Backfill any missing tool responses
- for id in &expected_ids {
- if !responded.contains(id) {
- tracing::warn!(call_id=?id, "missing tool response");
- corrected.push(ChatCompletionRequestMessage::Tool(
- ChatCompletionRequestToolMessage {
- tool_call_id: id.clone(),
- content:
- async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
- "No response from server".into(),
- ),
- },
- ));
- }
- }
- } else {
- if let ChatCompletionRequestMessage::Assistant(assistant) = msg {
- pending_tool_call_ids = assistant.tool_calls.as_ref().map(|calls| {
- calls
- .iter()
- .filter_map(|c| match c {
- ChatCompletionMessageToolCalls::Function(f) => Some(f.id.clone()),
- _ => None,
- })
- .collect()
- });
- }
- corrected.push(messages[i].clone());
- i += 1;
- }
- }
-
- // Handle trailing assistant with tool_calls but no responses at end of messages
- if let Some(expected_ids) = pending_tool_call_ids {
- for id in &expected_ids {
- tracing::warn!(call_id=?id, "missing tool response");
- corrected.push(ChatCompletionRequestMessage::Tool(
- ChatCompletionRequestToolMessage {
- tool_call_id: id.clone(),
- content:
- async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
- "No response from server".into(),
- ),
- },
- ));
- }
- }
- corrected
-}
diff --git a/rust/cloud-storage/ai/src/tool/tool_loop/chat/mod.rs b/rust/cloud-storage/ai/src/tool/tool_loop/chat/mod.rs
deleted file mode 100644
index 719c77f8e4..0000000000
--- a/rust/cloud-storage/ai/src/tool/tool_loop/chat/mod.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-mod agent;
-
-#[cfg(test)]
-mod test;
-
-use crate::types::Model;
-pub use agent::Chat;
-pub const MAX_RECURSIONS: u32 = 100;
-pub const TOOL_GENERATOR: Model = Model::Gemini20Flash;
diff --git a/rust/cloud-storage/ai/src/tool/tool_loop/chat/test.rs b/rust/cloud-storage/ai/src/tool/tool_loop/chat/test.rs
deleted file mode 100644
index c839479a7a..0000000000
--- a/rust/cloud-storage/ai/src/tool/tool_loop/chat/test.rs
+++ /dev/null
@@ -1,633 +0,0 @@
-use super::*;
-use crate::openai_toolset::OpenAIToolSetExt;
-use crate::tool::types::{
- AsyncToolCollection, PartialToolCall, RequestContext, StreamPart, ToolCall, ToolResult, ToolSet,
-};
-use crate::tool::types::{ChatCompletionStream, ExtendedPartStream, PartOrExt, ToolResponse};
-use crate::types::noop::NoOpClient;
-use crate::types::openai::message::convert_message;
-use crate::types::traits::{ExtendedOpenAIStream, ExtendedOpenAIStreamItem};
-use crate::types::{AssistantMessagePart, ChatMessageContent, Role};
-use crate::types::{ChatCompletionRequest, ChatMessage, ChatMessages};
-use crate::types::{ExtendedClient, Result};
-use async_openai::types::chat::{
- ChatCompletionMessageToolCall, ChatCompletionMessageToolCalls,
- ChatCompletionRequestAssistantMessage, ChatCompletionRequestAssistantMessageContent,
- ChatCompletionRequestMessage, ChatCompletionRequestToolMessage,
- ChatCompletionRequestToolMessageContent, ChatCompletionStreamOptions,
- CreateChatCompletionRequest, FinishReason, FunctionCall,
-};
-use async_stream::stream;
-use futures::stream::StreamExt;
-use serde_json::json;
-use std::collections::HashMap;
-use std::sync::Arc;
-
-// Chat test infrastructure — used by #[cfg(test)] mod tests below.
-#[cfg(test)]
-#[allow(dead_code)]
-struct ProcessedStream {
- pub new_messages: Vec<ChatCompletionRequestMessage>,
- pub tool_responses: Vec<ToolResponse>,
-}
-
-#[cfg(test)]
-#[allow(dead_code)]
-pub struct Chat<I, T>
-where
- I: ExtendedClient + Send + Sync,
- T: Clone + Send + Sync + 'static,
-{
- client: I,
- toolset: Arc<AsyncToolCollection<T>>,
- request: CreateChatCompletionRequest,
- messages: Vec<ChatCompletionRequestMessage>,
- context: T,
- initial_message_count: usize,
- tool_call_id_name_mapping: HashMap<String, String>, // tool_call_id -> tool_name
- user_id: String,
-}
-
-#[allow(dead_code)]
-impl<I, T> Chat<I, T>
-where
- I: ExtendedClient + Send + Sync,
- T: Clone + Send + Sync,
-{
- pub fn new(client: I, toolset: Arc<AsyncToolCollection<T>>, context: T) -> Chat<I, T> {
- Chat {
- client,
- toolset,
- messages: vec![],
- context,
- request: CreateChatCompletionRequest::default(),
- initial_message_count: 0,
- tool_call_id_name_mapping: HashMap::new(),
- user_id: "Uninitialized".into(),
- }
- }
-
- #[tracing::instrument(skip(self, request_context), err)]
- pub async fn send_message(
- &mut self,
- request: ChatCompletionRequest,
- request_context: RequestContext,
- user_id: String,
- ) -> Result<ChatCompletionStream<'_>> {
- self.request = request.try_into()?;
- self.messages = self.request.messages.clone();
- self.initial_message_count = self.messages.len();
- self.user_id = user_id;
-
- self.make_chat_completion_stream(request_context).await
- }
-
- pub fn get_new_conversation_messages(&self) -> Vec<ChatMessage> {
- let messages: ChatMessages = self
- .messages
- .iter()
- .skip(self.initial_message_count)
- .map(|msg| convert_message(msg.clone(), Some(&self.tool_call_id_name_mapping)))
- .collect::<Vec<_>>()
- .into();
- messages.0
- }
-
- #[tracing::instrument(err, skip_all)]
- async fn make_chat_completion_stream(
- &mut self,
- request_context: RequestContext,
- ) -> Result<ChatCompletionStream<'_>> {
- let item_stream = stream!({
- let mut stream_parts = vec![];
- 'outer: for _ in 0..MAX_RECURSIONS {
- let stream = match self.make_openai_chat_completion_stream().await {
- Ok(stream) => stream,
- Err(err) => {
- yield Err(err);
- break;
- }
- };
- {
- let mut stream = Self::map_stream(stream);
- // consume stream
- // accumulate to stream_parts
- while let Some(item) = stream.next().await {
- if let Err(e) = item {
- yield Err(e);
- break 'outer;
- }
-
- let part_or_ext = item.unwrap();
- match part_or_ext {
- ref part @ PartOrExt::Part(ref p) => {
- yield Ok(p.to_owned());
- stream_parts.push(part.to_owned());
- }
- ref part @ PartOrExt::Ext(ref e) => {
- if let Some(p) = self.client.handle_extension_item(e.to_owned()) {
- yield Ok(p);
- }
- stream_parts.push(part.to_owned());
- }
- }
- }
- }
- // call tools, aggregate response to a new request
- let mut processed = self
- .process_stream_parts(stream_parts, request_context.clone())
- .await;
-
- for response in &processed.tool_responses {
- yield Ok(StreamPart::ToolResponse(response.clone()));
- }
-
- self.messages.append(&mut processed.new_messages);
- // if there are no tool calls, then done
- if processed.tool_responses.is_empty() {
- break;
- }
- stream_parts = vec![];
- }
- });
- Ok(Box::pin(item_stream))
- }
-
- async fn process_stream_parts(
- &mut self,
- stream_parts: Vec<PartOrExt<I::ResponseExtension>>,
- request_context: RequestContext,
- ) -> ProcessedStream {
- let mut messages: Vec<ChatCompletionRequestMessage> = vec![];
- let mut tool_stream_parts: Vec<ToolResponse> = vec![];
-
- // Current assistant segment being built
- let mut content = String::new();
- let mut tool_calls: Vec<ChatCompletionMessageToolCalls> = vec![];
- let mut pending_tool_messages: Vec<ChatCompletionRequestMessage> = vec![];
-
- for item in stream_parts {
- match item {
- PartOrExt::Ext(ext) => {
- if let Some(stream_part) = self.client.handle_extension_item(ext) {
- match stream_part {
- StreamPart::ToolCall(call) => {
- self.tool_call_id_name_mapping
- .insert(call.id.clone(), call.name.clone());
- tool_calls.push(ChatCompletionMessageToolCalls::Function(
- ChatCompletionMessageToolCall {
- id: call.id.clone(),
- function: FunctionCall {
- arguments: call.json.to_string(),
- name: call.name.clone(),
- },
- },
- ));
- }
- StreamPart::Content(text) => content.push_str(text.as_str()),
- StreamPart::ToolResponse(ToolResponse::Json { id, json, .. }) => {
- // Server-side tool response - flush current assistant and start new segment
- if !content.is_empty() || !tool_calls.is_empty() {
- messages.push(
- self.make_assistant_message(&mut content, &mut tool_calls),
- );
- messages.append(&mut pending_tool_messages);
- }
- let content_text = serde_json::to_string_pretty(&json)
- .unwrap_or_else(|_| "internal error parsing".into());
- messages.push(ChatCompletionRequestMessage::Tool(
- ChatCompletionRequestToolMessage {
- content: async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
- content_text,
- ),
- tool_call_id: id,
- },
- ));
- }
- StreamPart::Usage { .. } | StreamPart::ToolResponse(_) => {}
- }
- }
- }
- PartOrExt::Part(part) => match part {
- StreamPart::ToolCall(call) => {
- self.tool_call_id_name_mapping
- .insert(call.id.clone(), call.name.clone());
- tool_calls.push(ChatCompletionMessageToolCalls::Function(
- ChatCompletionMessageToolCall {
- id: call.id.clone(),
- function: FunctionCall {
- arguments: call.json.to_string(),
- name: call.name.clone(),
- },
- },
- ));
-
- let tool_response = match self
- .toolset
- .try_tool_call(
- self.context.clone(),
- request_context.clone(),
- &call.name,
- &call.json,
- )
- .await
- {
- Ok(ToolResult::Ok(output)) => {
- let content_text = serde_json::to_string_pretty(&output)
- .unwrap_or_else(|_| {
- "internal error formatting response".to_string()
- });
- tool_stream_parts.push(ToolResponse::Json {
- id: call.id.clone(),
- json: output,
- name: call.name.clone(),
- });
- content_text
- }
- Ok(ToolResult::Err(fail)) => {
- tool_stream_parts.push(ToolResponse::Err {
- id: call.id.clone(),
- description: fail.description.clone(),
- name: call.name.clone(),
- });
- fail.description
- }
- Err(err) => {
- tracing::error!(error=?err, "error calling tool");
- let desc = format!("Error calling tool: {}", err);
- tool_stream_parts.push(ToolResponse::Err {
- id: call.id.clone(),
- description: desc.clone(),
- name: call.name.clone(),
- });
- desc
- }
- };
-
- pending_tool_messages.push(ChatCompletionRequestMessage::Tool(
- ChatCompletionRequestToolMessage {
- content: async_openai::types::chat::ChatCompletionRequestToolMessageContent::Text(
- tool_response,
- ),
- tool_call_id: call.id,
- },
- ));
- }
- StreamPart::Content(text) => content.push_str(text.as_str()),
- StreamPart::Usage { .. } | StreamPart::ToolResponse(_) => {}
- },
- }
- }
-
- // Flush remaining assistant content
- messages.push(self.make_assistant_message(&mut content, &mut tool_calls));
- messages.append(&mut pending_tool_messages);
-
- ProcessedStream {
- new_messages: messages,
- tool_responses: tool_stream_parts,
- }
- }
-
- fn make_assistant_message(
- &self,
- content: &mut String,
- tool_calls: &mut Vec<ChatCompletionMessageToolCalls>,
- ) -> ChatCompletionRequestMessage {
- ChatCompletionRequestMessage::Assistant(ChatCompletionRequestAssistantMessage {
- content: if content.is_empty() {
- None
- } else {
- Some(ChatCompletionRequestAssistantMessageContent::Text(
- std::mem::take(content),
- ))
- },
- tool_calls: if tool_calls.is_empty() {
- None
- } else {
- Some(std::mem::take(tool_calls))
- },
- ..Default::default()
- })
- }
-
- fn map_stream<'a>(
- mut stream: ExtendedOpenAIStream<I::ResponseExtension>,
- ) -> ExtendedPartStream<'a, I::ResponseExtension> {
- let stream = stream!({
- let mut tool_calls: HashMap<u32, PartialToolCall> = HashMap::new();
- while let Some(item) = stream.next().await {
- match item {
- Ok(ExtendedOpenAIStreamItem::Response(part)) => {
- if let Some(usage) = &part.usage {
- yield Ok(PartOrExt::Part(StreamPart::Usage(usage.clone().into())))
- }
- let first = part.choices.first();
- if first.is_none() {
- continue;
- }
- let first = first.unwrap();
- if let Some(content) = &first.delta.content {
- yield Ok(PartOrExt::Part(StreamPart::Content(content.clone())));
- }
-
- if let Some(calls) = &first.delta.tool_calls {
- for call in calls {
- if let Some(function) = &call.function {
- tool_calls
- .entry(call.index)
- .and_modify(|partial| {
- if let Some(n) = &function.name {
- partial.name = n.to_owned();
- }
- if let Some(a) = &function.arguments.clone() {
- partial.json = format!("{}{}", partial.json, a);
- }
- if let Some(id) = &call.id {
- partial.id = id.clone();
- }
- })
- .or_insert_with(|| {
- let mut partial = PartialToolCall::default();
- if let Some(n) = function.name.clone() {
- partial.name = n;
- }
- if let Some(a) = function.arguments.clone() {
- partial.json = a;
- }
- if let Some(id) = &call.id {
- partial.id = id.clone();
- }
- partial
- });
- }
- }
- }
- if let Some(FinishReason::ToolCalls) = first.finish_reason {
- for call in tool_calls.into_values() {
- match ToolCall::try_from(call.clone()) {
- Ok(call) => {
- yield Ok(PartOrExt::Part(StreamPart::ToolCall(call)))
- }
- Err(e) => {
- tracing::error!(
- err=?e,
- "ToolCall::try_from failed from {:#?}",
- call
- );
- }
- }
- }
- tool_calls = HashMap::new();
- }
- }
- Ok(ExtendedOpenAIStreamItem::Extension(ext)) => {
- // Handle provider-specific extension items (Anthropic server tools)
- yield Ok(PartOrExt::Ext(ext));
- }
- Err(error) => yield Err(error.into()),
- }
- }
- });
- Box::pin(stream)
- }
-
- #[tracing::instrument(err, skip(self))]
- async fn make_openai_chat_completion_stream(
- &mut self,
- ) -> Result<ExtendedOpenAIStream<I::ResponseExtension>> {
- self.request.messages = self.messages.clone();
- self.request.tools = Some(self.toolset.openai_chatcompletion_toolset());
- self.request.stream = Some(true);
- self.request.stream_options = Some(ChatCompletionStreamOptions {
- include_usage: Some(true),
- include_obfuscation: None,
- });
-
- self.client.chat_stream(self.request.clone()).await
- }
-}
-
-fn create_mock_chat() -> Chat<NoOpClient, String> {
- let client = NoOpClient;
- let toolset = Arc::new(AsyncToolCollection::new());
- Chat::new(client, toolset, "test_context".to_string())
-}
-
-#[test]
-fn test_get_new_conversation_messages_empty() {
- let chat = create_mock_chat();
- let messages = chat.get_new_conversation_messages();
- assert!(messages.is_empty());
-}
-
-#[test]
-fn test_get_new_conversation_messages_skips_initial() {
- let mut chat = create_mock_chat();
-
- // Add some initial messages
- chat.messages = vec![
- ChatCompletionRequestMessage::System(
- async_openai::types::chat::ChatCompletionRequestSystemMessage {
- content: async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Text(
- "System message".to_string(),
- ),
- ..Default::default()
- },
- ),
- ChatCompletionRequestMessage::User(
- async_openai::types::chat::ChatCompletionRequestUserMessage {
- content: async_openai::types::chat::ChatCompletionRequestUserMessageContent::Text(
- "User message".to_string(),
- ),
- ..Default::default()
- },
- ),
- ];
- chat.initial_message_count = 2;
-
- // Add new messages
- chat.messages.push(ChatCompletionRequestMessage::Assistant(
- ChatCompletionRequestAssistantMessage {
- content: Some(ChatCompletionRequestAssistantMessageContent::Text(
- "New assistant response".to_string(),
- )),
- ..Default::default()
- },
- ));
-
- let new_messages = chat.get_new_conversation_messages();
-
- assert_eq!(new_messages.len(), 1);
- assert_eq!(new_messages[0].role, Role::Assistant);
- if let ChatMessageContent::Text(text) = &new_messages[0].content {
- assert_eq!(text, "New assistant response");
- } else {
- panic!("Expected text content");
- }
-}
-
-#[test]
-fn test_get_new_conversation_messages_with_tool_calls() {
- let mut chat = create_mock_chat();
- chat.initial_message_count = 0;
-
- let tool_call_id = "call_123".to_string();
- let tool_name = "test_tool".to_string();
-
- // Add tool call mapping
- chat.tool_call_id_name_mapping
- .insert(tool_call_id.clone(), tool_name.clone());
-
- // Add messages with tool calls
- chat.messages = vec![
- ChatCompletionRequestMessage::Assistant(ChatCompletionRequestAssistantMessage {
- content: Some(ChatCompletionRequestAssistantMessageContent::Text(
- "I'll help you with that.".to_string(),
- )),
- tool_calls: Some(vec![ChatCompletionMessageToolCalls::Function(
- ChatCompletionMessageToolCall {
- id: tool_call_id.clone(),
- function: FunctionCall {
- name: tool_name.clone(),
- arguments: json!({"param": "value"}).to_string(),
- },
- },
- )]),
- ..Default::default()
- }),
- ChatCompletionRequestMessage::Tool(ChatCompletionRequestToolMessage {
- tool_call_id: tool_call_id.clone(),
- content: ChatCompletionRequestToolMessageContent::Text(
- json!({"result": "success"}).to_string(),
- ),
- }),
- ];
-
- let new_messages = chat.get_new_conversation_messages();
-
- // The ChatMessages conversion merges adjacent assistant messages into one
- assert_eq!(new_messages.len(), 1);
-
- // The message should be assistant with merged parts (text + tool call + tool response)
- assert_eq!(new_messages[0].role, Role::Assistant);
- if let ChatMessageContent::AssistantMessageParts(parts) = &new_messages[0].content {
- assert_eq!(parts.len(), 3);
-
- // Should have text part
- if let AssistantMessagePart::Text { text } = &parts[0] {
- assert_eq!(text, "I'll help you with that.");
- } else {
- panic!("Expected text part at index 0");
- }
-
- // Should have tool call part with correct name from mapping
- if let AssistantMessagePart::ToolCall { name, id, json } = &parts[1] {
- assert_eq!(name, &tool_name);
- assert_eq!(id, &tool_call_id);
- assert_eq!(json["param"], "value");
- } else {
- panic!("Expected tool call part at index 1");
- }
-
- // Should have tool response part
- if let AssistantMessagePart::ToolCallResponseJson { name, id, json } = &parts[2] {
- assert_eq!(name, &tool_name);
- assert_eq!(id, &tool_call_id);
- assert_eq!(json["result"], "success");
- } else {
- panic!("Expected tool response part at index 2");
- }
- } else {
- panic!("Expected assistant message parts");
- }
-}
-
-#[test]
-fn test_get_new_conversation_messages_preserves_tool_mapping() {
- let mut chat = create_mock_chat();
- chat.initial_message_count = 0;
-
- let tool_call_id = "call_456".to_string();
- let tool_name = "search_documents".to_string();
-
- // Add tool call mapping
- chat.tool_call_id_name_mapping
- .insert(tool_call_id.clone(), tool_name.clone());
-
- // Add tool response message
- chat.messages = vec![ChatCompletionRequestMessage::Tool(
- ChatCompletionRequestToolMessage {
- tool_call_id: tool_call_id.clone(),
- content: ChatCompletionRequestToolMessageContent::Text(
- json!({"documents": ["doc1", "doc2"]}).to_string(),
- ),
- },
- )];
-
- let new_messages = chat.get_new_conversation_messages();
-
- assert_eq!(new_messages.len(), 1);
- assert_eq!(new_messages[0].role, Role::Assistant);
-
- if let ChatMessageContent::AssistantMessageParts(parts) = &new_messages[0].content {
- assert_eq!(parts.len(), 1);
-
- if let AssistantMessagePart::ToolCallResponseJson { name, id, json } = &parts[0] {
- assert_eq!(name, &tool_name); // Verify tool name is preserved from mapping
- assert_eq!(id, &tool_call_id);
- assert_eq!(json["documents"][0], "doc1");
- assert_eq!(json["documents"][1], "doc2");
- } else {
- panic!("Expected tool response part");
- }
- } else {
- panic!("Expected assistant message parts");
- }
-}
-
-#[test]
-fn test_get_new_conversation_messages_with_error_response() {
- let mut chat = create_mock_chat();
- chat.initial_message_count = 0;
-
- let tool_call_id = "call_error".to_string();
- let tool_name = "failing_tool".to_string();
-
- // Add tool call mapping
- chat.tool_call_id_name_mapping
- .insert(tool_call_id.clone(), tool_name.clone());
-
- // Add tool error response message
- chat.messages = vec![ChatCompletionRequestMessage::Tool(
- ChatCompletionRequestToolMessage {
- tool_call_id: tool_call_id.clone(),
- content: ChatCompletionRequestToolMessageContent::Text("Tool execution failed".into()),
- },
- )];
-
- let new_messages = chat.get_new_conversation_messages();
-
- assert_eq!(new_messages.len(), 1);
- assert_eq!(new_messages[0].role, Role::Assistant);
-
- if let ChatMessageContent::AssistantMessageParts(parts) = &new_messages[0].content {
- assert_eq!(parts.len(), 1);
-
- if let AssistantMessagePart::ToolCallErr {
- name,
- id,
- description,
- } = &parts[0]
- {
- assert_eq!(name, &tool_name);
- assert_eq!(id, &tool_call_id);
- assert_eq!(description, "Tool execution failed");
- } else {
- eprintln!("{:#?}", parts[0]);
- panic!("Expected tool error part");
- }
- } else {
- panic!("Expected assistant message parts");
- }
-}
diff --git a/rust/cloud-storage/ai/src/tool/tool_loop/cli.rs b/rust/cloud-storage/ai/src/tool/tool_loop/cli.rs
deleted file mode 100644
index 26dea82ede..0000000000
--- a/rust/cloud-storage/ai/src/tool/tool_loop/cli.rs
+++ /dev/null
@@ -1,288 +0,0 @@
-//! CLI interface for the Chat tool loop.
-//!
-//! This module provides a simple CLI frontend that consumes the existing
-//! `Chat` tool loop, allowing developers to test toolsets interactively
-//! from the command line.
-//!
-//! # Example with custom toolset
-//!
-//! ```rust,ignore
-//! use ai::tool::tool_loop::cli::Cli;
-//! use ai::tool::{AsyncToolCollection, RequestContext};
-//! use ai::types::Model;
-//! use macro_user_id::user_id::MacroUserIdStr;
-//! use std::sync::Arc;
-//!
-//! #[tokio::main]
-//! async fn main() {
-//! let toolset = AsyncToolCollection::new()
-//! .add_tool::<MyTool>()
-//! .expect("failed to add tool");
-//!
-//! let cli = Cli::new(
-//! toolset,
-//! MyServiceContext::new(),
-//! "You are a helpful assistant.",
-//! Model::Claude35Sonnet,
-//! || RequestContext {
-//! user_id: Arc::new(MacroUserIdStr::try_from_email("[email protected]").unwrap()),
-//! },
-//! );
-//! cli.run().await;
-//! }
-//! ```
-//!
-//! # Example with default (no tools)
-//!
-//! ```rust,ignore
-//! use ai::tool::tool_loop::cli::Cli;
-//!
-//! #[tokio::main]
-//! async fn main() {
-//! Cli::default().run().await;
-//! }
-//! ```
-
-use crate::openai_toolset::OpenAIToolSetExt;
-use crate::prompts::CLI_PROMPT;
-use crate::tool::ToolLoop;
-use crate::tool::types::{AsyncToolCollection, RequestContext, StreamPart, ToolResponse, ToolSet};
-use crate::types::{ChatMessage, MessageBuilder, Model, RequestBuilder, Role};
-use futures::stream::StreamExt;
-use macro_user_id::user_id::MacroUserIdStr;
-use std::io::{self, BufRead, Write};
-use std::sync::Arc;
-
-/// CLI interface for the Chat tool loop.
-///
-/// This struct wraps the tool loop and provides an interactive readline-style
-/// interface for multi-turn conversations with tool support.
-pub struct Cli<T, F, S = AsyncToolCollection<T>>
-where
- T: Clone + Send + Sync + 'static,
- F: Fn() -> RequestContext,
-{
- toolset: S,
- service_context: T,
- system_prompt: String,
- model: Model,
- request_context_fn: F,
-}
-
-impl Default for Cli<(), fn() -> RequestContext> {
- fn default() -> Self {
- Self {
- toolset: AsyncToolCollection::new(),
- service_context: (),
- system_prompt: CLI_PROMPT.to_string(),
- model: Model::Claude45Opus,
- request_context_fn: || RequestContext {
- user_id: MacroUserIdStr::try_from_email("cli@localhost").expect("valid email"),
- },
- }
- }
-}
-
-impl<T, F, S> Cli<T, F, S>
-where
- T: Clone + Send + Sync + 'static,
- F: Fn() -> RequestContext,
- S: ToolSet<T> + OpenAIToolSetExt,
-{
- /// Create a new CLI with the given configuration.
- ///
- /// # Arguments
- ///
- /// * `toolset` - The async toolset to use for tool calls
- /// * `service_context` - The service context passed to tools
- /// * `system_prompt` - The system prompt for the AI
- /// * `model` - The model to use for completions
- /// * `request_context_fn` - A function that creates a request context for each message
- pub fn new(
- toolset: S,
- service_context: T,
- system_prompt: impl Into<String>,
- model: Model,
- request_context_fn: F,
- ) -> Self {
- Self {
- toolset,
- service_context,
- system_prompt: system_prompt.into(),
- model,
- request_context_fn,
- }
- }
-
- /// Run the interactive CLI session.
- ///
- /// This provides a readline-style interface that:
- /// - Reads user input from stdin
- /// - Sends messages through the Chat tool loop
- /// - Streams responses to stdout
- /// - Displays tool calls and responses
- /// - Maintains conversation history across turns
- ///
- /// The session ends when the user types "exit" or "quit", or when stdin closes.
- pub async fn run(self) {
- // Print startup info
- println!("Model: {}", self.model);
- let tool_names: Vec<String> = self
- .toolset
- .request_schemas()
- .map(|schemas| schemas.into_iter().map(|s| s.name).collect())
- .unwrap_or_default();
- if tool_names.is_empty() {
- println!("Tools: (none)");
- } else {
- println!("Tools: {}", tool_names.join(", "));
- }
- println!("---");
-
- let tool_loop = ToolLoop::new(Arc::new(self.toolset), self.service_context);
-
- let stdin = io::stdin();
- let mut stdout = io::stdout();
- let mut messages: Vec<ChatMessage> = Vec::new();
-
- println!("Type 'exit' or 'quit' to end.");
- println!("---");
-
- loop {
- print!("> ");
- if stdout.flush().is_err() {
- break;
- }
-
- let input = {
- let handle = stdin.lock();
- match handle.lines().next() {
- Some(Ok(line)) => line,
- Some(Err(_)) | None => break,
- }
- };
-
- let input = input.trim();
-
- if input.eq_ignore_ascii_case("exit") || input.eq_ignore_ascii_case("quit") {
- println!("Goodbye!");
- break;
- }
-
- if input.is_empty() {
- continue;
- }
-
- messages.push(
- MessageBuilder::new()
- .content(input)
- .role(Role::User)
- .build(),
- );
-
- let request_messages = messages
- .iter()
- .map(|m| ChatMessage {
- content: m.content.clone(),
- role: m.role,
- attachments: None,
- })
- .collect();
-
- let request = RequestBuilder::new()
- .system_prompt(&self.system_prompt)
- .messages(request_messages)
- .model(self.model)
- .build();
-
- let mut chat = tool_loop.chat();
- let request_context = (self.request_context_fn)();
-
- // Process stream in a scope so it's dropped before accessing chat
- let stream_error = {
- let stream_result = chat
- .send_message(request, request_context, "cli-user".to_string())
- .await;
-
- let mut stream = match stream_result {
- Ok(s) => s,
- Err(e) => {
- eprintln!("\nError: {}", e);
- messages.pop();
- continue;
- }
- };
-
- let mut has_content = false;
- let mut error_occurred = false;
-
- while let Some(result) = stream.next().await {
- match result {
- Ok(part) => match part {
- StreamPart::Content(content) => {
- print!("{}", content);
- let _ = stdout.flush();
- has_content = true;
- }
- StreamPart::ToolCall(call) => {
- if has_content {
- println!();
- }
- println!("\n[Tool Call: {}]", call.name);
- if let Ok(pretty) = serde_json::to_string_pretty(&call.json) {
- println!("{}", pretty);
- }
- has_content = false;
- }
- StreamPart::ToolResponse(response) => {
- match &response {
- ToolResponse::Json { name, json, .. } => {
- println!("\n[Tool Response: {}]", name);
- if let Ok(pretty) = serde_json::to_string_pretty(json) {
- let display = if pretty.len() > 500 {
- format!("{}...(truncated)", &pretty[..500])
- } else {
- pretty
- };
- println!("{}", display);
- }
- }
- ToolResponse::Err {
- name, description, ..
- } => {
- println!("\n[Tool Error: {}]", name);
- println!("{}", description);
- }
- }
- println!();
- }
- StreamPart::Usage(usage) => {
- tracing::debug!(usage=?usage, "token usage");
- }
- },
- Err(e) => {
- eprintln!("\nStream error: {}", e);
- error_occurred = true;
- break;
- }
- }
- }
-
- if has_content {
- println!();
- }
- println!("---");
-
- error_occurred
- };
-
- if stream_error {
- messages.pop();
- continue;
- }
-
- let new_messages = chat.get_new_conversation_messages();
- messages.extend(new_messages);
- }
- }
-}
diff --git a/rust/cloud-storage/ai/src/tool/tool_loop/constant.rs b/rust/cloud-storage/ai/src/tool/tool_loop/constant.rs
deleted file mode 100644
index 8b13789179..0000000000
--- a/rust/cloud-storage/ai/src/tool/tool_loop/constant.rs
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/rust/cloud-storage/ai/src/tool/tool_loop/mod.rs b/rust/cloud-storage/ai/src/tool/tool_loop/mod.rs
deleted file mode 100644
index 164d76b21b..0000000000
--- a/rust/cloud-storage/ai/src/tool/tool_loop/mod.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-pub mod ai_client;
-pub mod chat;
-pub mod cli;
-pub mod constant;
diff --git a/rust/cloud-storage/ai/src/tool/types/mod.rs b/rust/cloud-storage/ai/src/tool/types/mod.rs
deleted file mode 100644
index 4760d3ca7d..0000000000
--- a/rust/cloud-storage/ai/src/tool/types/mod.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-mod stream;
-
-pub use ai_toolset::schema;
-pub use ai_toolset::tool_object;
-pub use ai_toolset::{
- AsyncTool, AsyncToolCollection, NoContext, RequestContext, RequestSchema, ServiceContext,
- ToolCallError, ToolCollection, ToolInfo, ToolResult, ToolSchema, ToolSet, ToolSetCreationError,
- ToolSetError,
-};
-pub use stream::{AiStream, ChatCompletionStream, McpInfo, StreamPart, ToolCall, ToolResponse};
-pub(crate) use stream::{ExtendedPartStream, PartOrExt, PartialToolCall};
diff --git a/rust/cloud-storage/ai/src/tool/types/stream.rs b/rust/cloud-storage/ai/src/tool/types/stream.rs
deleted file mode 100644
index 653e237cb8..0000000000
--- a/rust/cloud-storage/ai/src/tool/types/stream.rs
+++ /dev/null
@@ -1,76 +0,0 @@
-use crate::types::{AiError, Usage};
-use futures::stream::Stream;
-use serde::Serialize;
-use std::fmt::Debug;
-use std::pin::Pin;
-
-pub type AiStream<'a, T> = Pin<Box<dyn Stream<Item = Result<T, AiError>> + Send + 'a>>;
-pub type ChatCompletionStream<'a> = AiStream<'a, StreamPart>;
-pub(crate) type ExtendedPartStream<'a, T> = AiStream<'a, PartOrExt<T>>;
-
-#[derive(Debug, Clone)]
-pub(crate) enum PartOrExt<T: Debug> {
- Part(StreamPart),
- Ext(T),
-}
-
-#[derive(Debug, Clone)]
-pub enum StreamPart {
- Content(String),
- ToolCall(ToolCall),
- ToolResponse(ToolResponse),
- Usage(Usage),
-}
-
-#[derive(Debug, Clone)]
-pub enum ToolResponse {
- Json {
- id: String,
- json: serde_json::Value,
- name: String,
- },
- Err {
- id: String,
- name: String,
- description: String,
- },
-}
-
-impl TryFrom<PartialToolCall> for ToolCall {
- type Error = serde_json::Error;
- fn try_from(value: PartialToolCall) -> Result<Self, Self::Error> {
- let raw = if value.json.is_empty() {
- "{}"
- } else {
- &value.json
- };
- serde_json::from_str(raw).map(|json| Self {
- id: value.id,
- name: value.name,
- json,
- mcp: None,
- })
- }
-}
-
-#[derive(Debug, Clone, Serialize)]
-pub struct McpInfo {
- pub service: String,
- pub tool_name: String,
- pub display_name: Option<String>,
-}
-
-#[derive(Debug, Clone, Serialize)]
-pub struct ToolCall {
- pub id: String,
- pub name: String,
- pub json: serde_json::Value,
- pub mcp: Option<McpInfo>,
-}
-
-#[derive(Debug, Clone, Default, Serialize)]
-pub(crate) struct PartialToolCall {
- pub id: String,
- pub name: String,
- pub json: String,
-}
diff --git a/rust/cloud-storage/ai/src/traits.rs b/rust/cloud-storage/ai/src/traits.rs
deleted file mode 100644
index 03e11024b0..0000000000
--- a/rust/cloud-storage/ai/src/traits.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-use serde::Deserialize;
-
-pub trait Metadata: for<'de> Deserialize<'de> {
- fn name() -> String;
- fn description() -> Option<String>;
-}
diff --git a/rust/cloud-storage/ai/src/types/client/anthropic.rs b/rust/cloud-storage/ai/src/types/client/anthropic.rs
deleted file mode 100644
index 8b63044249..0000000000
--- a/rust/cloud-storage/ai/src/types/client/anthropic.rs
+++ /dev/null
@@ -1,111 +0,0 @@
-use super::{ExtendedClient, ExtendedOpenAIStreamItem};
-use crate::{
- tool::{StreamPart, ToolResponse, types::ToolCall},
- types::AiError,
-};
-use anthropic::openai::{
- request::AnthropicRequestExtensions,
- stream_extension::{AnthropicResponseExtension, ExtendedAnthropicStreamItem},
-};
-use futures::StreamExt;
-
-#[derive(Clone, Debug)]
-pub struct AnthropicClient {
- inner: anthropic::client::Client,
- extensions: AnthropicRequestExtensions,
-}
-
-impl AnthropicClient {
- pub fn new(extensions: AnthropicRequestExtensions) -> Self {
- let client = anthropic::client::Client::dangerously_try_from_env(Some(extensions.clone()));
- Self {
- inner: client,
- extensions,
- }
- }
-}
-
-impl Default for AnthropicClient {
- fn default() -> Self {
- Self::new(AnthropicRequestExtensions(vec![]))
- }
-}
-
-impl From<ExtendedAnthropicStreamItem> for ExtendedOpenAIStreamItem<AnthropicResponseExtension> {
- fn from(value: ExtendedAnthropicStreamItem) -> Self {
- match value {
- ExtendedAnthropicStreamItem::Extension(ext) => ExtendedOpenAIStreamItem::Extension(ext),
- ExtendedAnthropicStreamItem::OpenAI(oai) => ExtendedOpenAIStreamItem::Response(oai),
- }
- }
-}
-
-impl ExtendedClient for AnthropicClient {
- type ResponseExtension = AnthropicResponseExtension;
- async fn chat_stream(
- &self,
- request: async_openai::types::chat::CreateChatCompletionRequest,
- ) -> anyhow::Result<super::traits::ExtendedOpenAIStream<Self::ResponseExtension>, AiError> {
- Ok(Box::pin(
- self.inner
- .chat()
- .create_stream_openai_extended(request, &self.extensions)
- .await
- .map(|f| f.map(ExtendedOpenAIStreamItem::from)),
- ))
- }
-
- fn handle_extension_item(&self, item: Self::ResponseExtension) -> Option<StreamPart> {
- match item {
- AnthropicResponseExtension::Citation(_) => None,
- AnthropicResponseExtension::ServerToolUse(tool_call) => {
- Some(StreamPart::ToolCall(ToolCall {
- id: tool_call.id,
- json: tool_call.input,
- name: tool_call.name,
- mcp: None,
- }))
- }
- AnthropicResponseExtension::WebSearchToolResponse(response) => {
- let id = response.tool_use_id.clone();
- let json = serde_json::to_value(&response).ok()?;
-
- Some(StreamPart::ToolResponse(ToolResponse::Json {
- id,
- json,
- name: "web_search".into(),
- }))
- }
- AnthropicResponseExtension::WebFetchToolResponse(response) => {
- let id = response.tool_use_id.clone();
- let json = serde_json::to_value(&response).ok()?;
-
- Some(StreamPart::ToolResponse(ToolResponse::Json {
- id,
- json,
- name: "web_fetch".into(),
- }))
- }
- AnthropicResponseExtension::BashCodeExecutionToolResponse(response) => {
- let id = response.tool_use_id.clone();
- let json = serde_json::to_value(&response).ok()?;
-
- Some(StreamPart::ToolResponse(ToolResponse::Json {
- id,
- json,
- name: "bash_code_execution".into(),
- }))
- }
- AnthropicResponseExtension::TextEditorCodeExecutionToolResponse(response) => {
- let id = response.tool_use_id.clone();
- let json = serde_json::to_value(&response).ok()?;
-
- Some(StreamPart::ToolResponse(ToolResponse::Json {
- id,
- json,
- name: "text_editor_code_execution".into(),
- }))
- }
- }
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/client/mod.rs b/rust/cloud-storage/ai/src/types/client/mod.rs
deleted file mode 100644
index ea47c22f08..0000000000
--- a/rust/cloud-storage/ai/src/types/client/mod.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-pub mod anthropic;
-pub mod openrouter;
-pub mod traits;
-pub use anthropic::AnthropicClient;
-pub use openrouter::OpenRouterClient;
-pub use traits::{ExtendedClient, ExtendedOpenAIStream, ExtendedOpenAIStreamItem};
-pub mod noop;
diff --git a/rust/cloud-storage/ai/src/types/client/noop.rs b/rust/cloud-storage/ai/src/types/client/noop.rs
deleted file mode 100644
index d6c6ba2ba7..0000000000
--- a/rust/cloud-storage/ai/src/types/client/noop.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-use super::traits::{ExtendedClient, ExtendedOpenAIStream};
-use crate::tool::StreamPart;
-use crate::types::AiError;
-use anyhow::anyhow;
-
-#[derive(Debug, Clone, Default)]
-pub struct NoOpClient;
-
-#[derive(Debug, Clone)]
-pub enum NoOpExtension {}
-
-impl ExtendedClient for NoOpClient {
- type ResponseExtension = NoOpExtension;
-
- async fn chat_stream(
- &self,
- _: async_openai::types::chat::CreateChatCompletionRequest,
- ) -> Result<ExtendedOpenAIStream<Self::ResponseExtension>, AiError> {
- Err(anyhow!("noop").into())
- }
-
- fn handle_extension_item(&self, _: Self::ResponseExtension) -> Option<StreamPart> {
- None
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/client/openrouter/client.rs b/rust/cloud-storage/ai/src/types/client/openrouter/client.rs
deleted file mode 100644
index 76736447b5..0000000000
--- a/rust/cloud-storage/ai/src/types/client/openrouter/client.rs
+++ /dev/null
@@ -1,75 +0,0 @@
-use super::config::OpenRouterConfig;
-use crate::tool::types::StreamPart;
-use crate::types::client::traits::ExtendedClient;
-use crate::types::{
- AiError, ExtendedOpenAIStream, ExtendedOpenAIStreamItem, Model, ModelWithMetadataAndProvider,
-};
-
-use async_openai::Client as OpenAiClient;
-use async_openai::types::chat::{CreateChatCompletionRequest, CreateChatCompletionStreamResponse};
-use futures::StreamExt;
-
-#[derive(Clone)]
-pub struct OpenRouterClient {
- inner: OpenAiClient<OpenRouterConfig>,
-}
-
-impl OpenRouterClient {
- pub fn new() -> Self {
- OpenRouterClient {
- inner: OpenAiClient::with_config(OpenRouterConfig::new()),
- }
- }
-}
-
-impl std::ops::Deref for OpenRouterClient {
- type Target = OpenAiClient<OpenRouterConfig>;
- fn deref(&self) -> &Self::Target {
- &self.inner
- }
-}
-
-impl Default for OpenRouterClient {
- fn default() -> Self {
- Self::new()
- }
-}
-
-impl OpenRouterClient {
- pub fn preprocess_request(
- &self,
- mut request: CreateChatCompletionRequest,
- ) -> CreateChatCompletionRequest {
- let model = serde_json::from_str::<Model>(&request.model).unwrap_or(Model::Gemini20Flash);
- let model_str = format!("{}/{}", model.provider(), model);
- request.model = model_str;
- request
- }
-}
-
-impl ExtendedClient for OpenRouterClient {
- // not yet implemented
- type ResponseExtension = ();
-
- async fn chat_stream(
- &self,
- request: CreateChatCompletionRequest,
- ) -> anyhow::Result<ExtendedOpenAIStream<Self::ResponseExtension>, AiError> {
- let request = self.preprocess_request(request);
- self.inner
- .chat()
- .create_stream_byot::<_, CreateChatCompletionStreamResponse>(request)
- .await
- .map(|stream| {
- Box::pin(
- stream.map(|item_result| item_result.map(ExtendedOpenAIStreamItem::Response)),
- ) as _
- })
- .map_err(AiError::from)
- }
-
- // extensions are not yet supported so this will never be called
- fn handle_extension_item(&self, _: Self::ResponseExtension) -> Option<StreamPart> {
- None
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/client/openrouter/config.rs b/rust/cloud-storage/ai/src/types/client/openrouter/config.rs
deleted file mode 100644
index afb9a38adb..0000000000
--- a/rust/cloud-storage/ai/src/types/client/openrouter/config.rs
+++ /dev/null
@@ -1,67 +0,0 @@
-use anyhow::{Context, Result};
-use async_openai::config::Config;
-use lazy_static::lazy_static;
-use reqwest::header::{AUTHORIZATION, HeaderMap};
-use secrecy::{ExposeSecret, SecretBox, SecretString};
-
-lazy_static! {
- static ref OPEN_ROUTER_CONFIG: OpenRouterConfig =
- try_from_env().expect("Failed to load OpenRouter Config");
-}
-
-const OPEN_ROUTER_BASE_URL: &str = "https://openrouter.ai/api/v1";
-const OPEN_ROUTER_API_KEY: &str = "OPEN_ROUTER_API_KEY";
-
-fn try_from_env() -> Result<OpenRouterConfig> {
- let api_key = std::env::var(OPEN_ROUTER_API_KEY).context(OPEN_ROUTER_API_KEY)?;
- let boxed_key = Box::new(api_key);
- let secret = SecretBox::new(boxed_key.into_boxed_str());
- Ok(OpenRouterConfig { api_key: secret })
-}
-
-#[derive(Clone, Debug)]
-pub struct OpenRouterConfig {
- api_key: SecretString,
-}
-
-impl Default for OpenRouterConfig {
- fn default() -> Self {
- Self::new()
- }
-}
-
-impl OpenRouterConfig {
- pub fn new() -> Self {
- OPEN_ROUTER_CONFIG.clone()
- }
-}
-
-impl Config for OpenRouterConfig {
- fn api_base(&self) -> &str {
- OPEN_ROUTER_BASE_URL
- }
-
- fn api_key(&self) -> &SecretString {
- &self.api_key
- }
-
- fn headers(&self) -> HeaderMap {
- let mut headers = HeaderMap::new();
- headers.insert(
- AUTHORIZATION,
- format!("Bearer {}", self.api_key.expose_secret())
- .as_str()
- .parse()
- .unwrap(),
- );
- headers
- }
-
- fn query(&self) -> Vec<(&str, &str)> {
- vec![]
- }
-
- fn url(&self, path: &str) -> String {
- format!("{}{}", OPEN_ROUTER_BASE_URL, path)
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/client/openrouter/mod.rs b/rust/cloud-storage/ai/src/types/client/openrouter/mod.rs
deleted file mode 100644
index 38ac6f60e0..0000000000
--- a/rust/cloud-storage/ai/src/types/client/openrouter/mod.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-mod client;
-mod config;
-
-pub use client::OpenRouterClient;
-pub use config::OpenRouterConfig;
diff --git a/rust/cloud-storage/ai/src/types/client/traits.rs b/rust/cloud-storage/ai/src/types/client/traits.rs
deleted file mode 100644
index 27734585fe..0000000000
--- a/rust/cloud-storage/ai/src/types/client/traits.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-use crate::tool::StreamPart;
-use crate::types::AiError;
-use anyhow::Result;
-use async_openai::error::OpenAIError;
-use async_openai::types::chat::{CreateChatCompletionRequest, CreateChatCompletionStreamResponse};
-use futures::Stream;
-use std::fmt::Debug;
-use std::future::Future;
-use std::pin::Pin;
-
-#[derive(Debug, Clone)]
-pub enum ExtendedOpenAIStreamItem<T: Send + Debug> {
- /// A standard OpenAI compatible item
- Response(CreateChatCompletionStreamResponse),
- /// A client-defined item
- Extension(T),
-}
-
-pub type ExtendedOpenAIStream<T> =
- Pin<Box<dyn Stream<Item = Result<ExtendedOpenAIStreamItem<T>, OpenAIError>> + Send>>;
-
-/// A client that is openai compatible may implement this trait.
-/// Extension items may be used to support non-openai compatible featuture (ie server tools)
-pub trait ExtendedClient {
- type ResponseExtension: Send + Sync + Clone + Debug + 'static;
- fn chat_stream(
- &self,
- request: CreateChatCompletionRequest,
- ) -> impl Future<Output = Result<ExtendedOpenAIStream<Self::ResponseExtension>, AiError>> + Send;
-
- fn handle_extension_item(&self, item: Self::ResponseExtension) -> Option<StreamPart>;
-}
diff --git a/rust/cloud-storage/ai/src/types/error.rs b/rust/cloud-storage/ai/src/types/error.rs
deleted file mode 100644
index a095651fe0..0000000000
--- a/rust/cloud-storage/ai/src/types/error.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-use thiserror::Error;
-
-pub type Result<T> = std::result::Result<T, AiError>;
-
-#[derive(Debug, Error)]
-pub enum AiError {
- #[error("Context is too large for current model")]
- ContextWindowExceeded,
- #[error("Unknown error")]
- Generic(anyhow::Error),
-}
-
-impl From<anyhow::Error> for AiError {
- fn from(value: anyhow::Error) -> Self {
- Self::Generic(value)
- }
-}
-
-impl From<serde_json::Error> for AiError {
- fn from(value: serde_json::Error) -> Self {
- Self::Generic(value.into())
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/message/chat_message.rs b/rust/cloud-storage/ai/src/types/message/chat_message.rs
deleted file mode 100644
index fce6ac04b0..0000000000
--- a/rust/cloud-storage/ai/src/types/message/chat_message.rs
+++ /dev/null
@@ -1,184 +0,0 @@
-use super::Role;
-use attachment::Attachments;
-use serde::{self, Deserialize, Serialize};
-use std::fmt::{Display, Write};
-use utoipa::ToSchema;
-
-#[derive(Debug)]
-pub struct ChatMessages(pub Vec<ChatMessage>);
-
-#[derive(Debug)]
-pub struct ChatMessage {
- pub content: ChatMessageContent,
- pub role: Role,
- pub attachments: Option<Attachments<'static>>,
-}
-
-#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone, ToSchema)]
-#[serde(untagged)]
-pub enum ChatMessageContent {
- Text(String),
- AssistantMessageParts(Vec<AssistantMessagePart>),
-}
-
-impl From<&str> for ChatMessageContent {
- fn from(value: &str) -> Self {
- Self::Text(value.into())
- }
-}
-
-impl From<String> for ChatMessageContent {
- fn from(value: String) -> Self {
- Self::Text(value)
- }
-}
-
-impl std::default::Default for ChatMessageContent {
- fn default() -> Self {
- ChatMessageContent::Text(String::default())
- }
-}
-
-#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone, ToSchema)]
-#[serde(tag = "type", rename_all = "camelCase")]
-pub enum UserMessagePart {
- Text(String),
-}
-
-#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone, ToSchema)]
-#[serde(tag = "type", rename_all = "camelCase")]
-pub enum AssistantMessagePart {
- Text {
- text: String,
- },
- ToolCall {
- name: String,
- json: serde_json::Value,
- id: String,
- },
- McpToolCall {
- /// Demangled tool name from the MCP server
- name: String,
- /// MCP server name
- service: String,
- /// Human-readable title from the MCP server, if provided
- #[serde(skip_serializing_if = "Option::is_none")]
- display_name: Option<String>,
- json: serde_json::Value,
- id: String,
- },
- ToolCallResponseJson {
- name: String,
- json: serde_json::Value,
- id: String,
- },
- ToolCallErr {
- name: String,
- description: String,
- id: String,
- },
-}
-
-#[derive(Serialize, Deserialize, Eq, PartialEq, Debug, Clone, ToSchema)]
-#[serde(tag = "type", rename_all = "camelCase")]
-pub enum ToolResponseMessage {
- ToolCallResponseText {
- name: String,
- response: String,
- id: String,
- },
-}
-
-impl ChatMessageContent {
- pub fn user_message_text(&self) -> Option<String> {
- match self {
- Self::Text(text) => Some(text.to_owned()),
- Self::AssistantMessageParts(_) => None,
- }
- }
-
- pub fn assistant_message_text_with_tools(&self) -> Option<String> {
- match self {
- Self::Text(text) => Some(text.to_owned()),
- Self::AssistantMessageParts(parts) => {
- let mut response = String::new();
- parts.iter().for_each(|part| {
- let _ = write!(response, "{}", part);
- });
- Some(response)
- }
- }
- }
-
- pub fn assistant_message_text(&self) -> Option<String> {
- match self {
- Self::Text(text) => Some(text.to_owned()),
- Self::AssistantMessageParts(parts) => {
- let mut response = String::new();
- parts.iter().for_each(|part| {
- if let AssistantMessagePart::Text { text } = part {
- let _ = write!(response, "{}", text);
- }
- });
- Some(response)
- }
- }
- }
-
- pub fn system_message_text(&self) -> Option<String> {
- if let Self::Text(text) = self {
- Some(text.to_owned())
- } else {
- None
- }
- }
- pub fn message_text(&self) -> String {
- match self {
- Self::Text(text) => text.to_owned(),
- Self::AssistantMessageParts(parts) => {
- let mut response = String::new();
- parts.iter().for_each(|part| {
- if let AssistantMessagePart::Text { text } = part {
- let _ = write!(response, "{}", text);
- }
- });
- response
- }
- }
- }
- pub fn message_text_with_tools(&self) -> String {
- match self {
- Self::Text(text) => text.to_owned(),
- Self::AssistantMessageParts(parts) => {
- let mut response = String::new();
- parts.iter().for_each(|part| {
- let _ = write!(response, "{}", part);
- });
- response
- }
- }
- }
-}
-
-impl Display for AssistantMessagePart {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- match self {
- Self::Text { text } => write!(f, "{}", text),
- Self::ToolCall { name, json, .. } => write!(f, "tool call: {}\n{}", name, json),
- Self::McpToolCall {
- name,
- service,
- json,
- ..
- } => write!(f, "mcp tool call: {}/{}\n{}", service, name, json),
- Self::ToolCallResponseJson { name, json, .. } => {
- write!(f, "tool response {}: {}", name, json)
- }
- Self::ToolCallErr {
- name, description, ..
- } => {
- write!(f, "tool call failed {}: {}", name, description)
- }
- }
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/message/message_builder.rs b/rust/cloud-storage/ai/src/types/message/message_builder.rs
deleted file mode 100644
index 12577dd289..0000000000
--- a/rust/cloud-storage/ai/src/types/message/message_builder.rs
+++ /dev/null
@@ -1,107 +0,0 @@
-use crate::types::{ChatMessage, ChatMessageContent, Role};
-use attachment::Attachments;
-
-pub struct MessageBuilder<R, C> {
- content: C,
- role: R,
- attachments: Option<Attachments<'static>>,
-}
-
-impl MessageBuilder<Role, ChatMessageContent> {
- pub fn build(self) -> ChatMessage {
- ChatMessage {
- content: self.content,
- role: self.role,
- attachments: self.attachments,
- }
- }
-}
-
-impl From<MessageBuilder<Role, ChatMessageContent>> for ChatMessage {
- fn from(val: MessageBuilder<Role, ChatMessageContent>) -> Self {
- val.build()
- }
-}
-
-impl Default for MessageBuilder<(), ()> {
- fn default() -> Self {
- Self::new()
- }
-}
-
-impl MessageBuilder<(), ()> {
- pub fn new() -> Self {
- Self {
- content: (),
- role: (),
- attachments: None,
- }
- }
-}
-
-pub type NoRole = ();
-// convenience methods to set role
-impl<C> MessageBuilder<NoRole, C> {
- pub fn user(self) -> MessageBuilder<Role, C> {
- MessageBuilder {
- content: self.content,
- attachments: self.attachments,
- role: Role::User,
- }
- }
-
- pub fn assistant(self) -> MessageBuilder<Role, C> {
- MessageBuilder {
- content: self.content,
- attachments: self.attachments,
- role: Role::Assistant,
- }
- }
-
- pub fn system(self) -> MessageBuilder<Role, C> {
- MessageBuilder {
- content: self.content,
- attachments: self.attachments,
- role: Role::System,
- }
- }
-
- pub fn role(self, role: Role) -> MessageBuilder<Role, C> {
- MessageBuilder {
- content: self.content,
- attachments: self.attachments,
- role,
- }
- }
-}
-
-pub type NoContent = ();
-impl<R> MessageBuilder<R, NoContent> {
- /// set content where T implements Into<ChatMessageContent>
- /// note: String can be converted to ChatMessageContent::Text
- pub fn content<T>(self, content: T) -> MessageBuilder<R, ChatMessageContent>
- where
- T: Into<ChatMessageContent>,
- {
- MessageBuilder {
- content: content.into(),
- attachments: self.attachments,
- role: self.role,
- }
- }
-
- pub fn text<T: Into<String>>(self, content: T) -> MessageBuilder<R, ChatMessageContent> {
- MessageBuilder {
- content: ChatMessageContent::Text(content.into()),
- attachments: self.attachments,
- role: self.role,
- }
- }
-}
-
-impl<R, C> MessageBuilder<R, C> {
- pub fn attachments(mut self, attachments: Attachments<'static>) -> Self {
- self.attachments = Some(attachments);
- self
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/message/mod.rs b/rust/cloud-storage/ai/src/types/message/mod.rs
deleted file mode 100644
index d306b0c229..0000000000
--- a/rust/cloud-storage/ai/src/types/message/mod.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-mod chat_message;
-mod message_builder;
-mod system_prompt;
-
-pub use chat_message::{
- AssistantMessagePart, ChatMessage, ChatMessageContent, ChatMessages, ToolResponseMessage,
- UserMessagePart,
-};
-pub use message_builder::{MessageBuilder, NoContent, NoRole};
-pub use system_prompt::SystemPrompt;
-
-use serde::{Deserialize, Serialize};
-use strum::{AsRefStr, Display, EnumString};
-use utoipa::ToSchema;
-
-#[derive(
- Debug,
- Serialize,
- Deserialize,
- Display,
- Copy,
- Clone,
- EnumString,
- PartialEq,
- ToSchema,
- AsRefStr,
- Eq,
-)]
-#[strum(serialize_all = "lowercase")]
-#[serde(rename_all = "lowercase")]
-pub enum Role {
- User,
- Assistant,
- System,
-}
diff --git a/rust/cloud-storage/ai/src/types/message/system_prompt.rs b/rust/cloud-storage/ai/src/types/message/system_prompt.rs
deleted file mode 100644
index 94bac8ac52..0000000000
--- a/rust/cloud-storage/ai/src/types/message/system_prompt.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-use attachment::Attachments;
-
-#[derive(Debug)]
-pub struct SystemPrompt {
- pub instructions: String,
- pub attachments: Option<Attachments<'static>>,
-}
diff --git a/rust/cloud-storage/ai/src/types/mod.rs b/rust/cloud-storage/ai/src/types/mod.rs
deleted file mode 100644
index 3f6811ba5b..0000000000
--- a/rust/cloud-storage/ai/src/types/mod.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-mod client;
-mod error;
-mod message;
-mod model;
-mod providers;
-mod request;
-mod request_builder;
-mod response;
-
-pub use client::{
- AnthropicClient, ExtendedClient, ExtendedOpenAIStream, ExtendedOpenAIStreamItem,
- OpenRouterClient, anthropic, noop, openrouter, traits,
-};
-pub use error::{AiError, Result};
-pub use message::{
- AssistantMessagePart, ChatMessage, ChatMessageContent, ChatMessages, MessageBuilder, NoContent,
- NoRole, Role, SystemPrompt, ToolResponseMessage, UserMessagePart,
-};
-pub use model::{Model, ModelMetadata, ModelWithMetadataAndProvider, Provider, constants};
-pub(crate) use providers::*;
-pub use request::ChatCompletionRequest;
-pub use request_builder::{NotSet, RequestBuilder};
-pub use response::{
- ChatCompletionError, ChatStreamCompletionContent, ChatStreamCompletionResponse,
- ConversionError, Usage,
-};
diff --git a/rust/cloud-storage/ai/src/types/model/metadata.rs b/rust/cloud-storage/ai/src/types/model/metadata.rs
deleted file mode 100644
index 82a4cff4d6..0000000000
--- a/rust/cloud-storage/ai/src/types/model/metadata.rs
+++ /dev/null
@@ -1,145 +0,0 @@
-use super::Model;
-use serde::{Deserialize, Serialize};
-use strum::Display;
-use utoipa::ToSchema;
-
-#[derive(Serialize, Deserialize, Debug, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct ModelMetadata {
- pub context_window: i32,
-}
-
-#[derive(Display, Debug, Serialize, Deserialize, ToSchema, PartialEq, PartialOrd, Clone)]
-#[serde(rename_all = "lowercase")]
-pub enum Provider {
- // OpenAI
- OpenAI,
- // Google
- Google,
- // Anthropic
- Anthropic,
- // Anthropic via Google
- GoogleAnthropic,
- // XAI
- XAI,
-}
-
-pub trait ModelWithMetadataAndProvider {
- fn metadata(&self) -> ModelMetadata;
- fn provider(&self) -> Provider;
- fn is_valid_provider(&self, provider: &Provider) -> bool;
-}
-
-impl ModelWithMetadataAndProvider for Model {
- fn metadata(&self) -> ModelMetadata {
- match self {
- Model::Gemini25Pro => ModelMetadata {
- context_window: 1_000_000,
- },
-
- Model::OpenAiGpt5 => ModelMetadata {
- context_window: 400_000,
- },
- Model::OpenAiGpt41 => ModelMetadata {
- context_window: 1_047_576,
- },
- Model::OpenAIGPT4o => ModelMetadata {
- context_window: 128000,
- },
- Model::OpenAIo1 => ModelMetadata {
- context_window: 128000,
- },
- Model::OpenAIo3 => ModelMetadata {
- context_window: 200_000,
- },
- Model::Gemini20Flash => ModelMetadata {
- context_window: 1_048_576,
- },
- Model::Gemini20FlashLite => ModelMetadata {
- context_window: 1_048_576,
- },
- Model::Gemini15Pro => ModelMetadata {
- context_window: 2_097_152,
- },
- Model::Claude35Sonnet => ModelMetadata {
- context_window: 200_000,
- },
- Model::Claude37Sonnet => ModelMetadata {
- context_window: 200_000,
- },
-
- Model::Claude46Sonnet => ModelMetadata {
- context_window: 1_000_000,
- },
-
- Model::Claude45Sonnet => ModelMetadata {
- context_window: 200_000,
- },
- Model::Claude45Haiku => ModelMetadata {
- context_window: 200_000,
- },
- Model::Claude45Opus => ModelMetadata {
- context_window: 200_000,
- },
- Model::Claude46Opus => ModelMetadata {
- context_window: 200_000,
- },
- Model::Claude4Sonnet => ModelMetadata {
- context_window: 200_000,
- },
- Model::OpenAIGPT4oMini => ModelMetadata {
- context_window: 128_000,
- },
- Model::OpenAIGPT4oSearchPreview => ModelMetadata {
- context_window: 128_000,
- },
- }
- }
-
- fn provider(&self) -> Provider {
- match self {
- // OpenAI models //
- Model::OpenAiGpt5 => Provider::OpenAI,
- Model::OpenAiGpt41 => Provider::OpenAI,
- Model::OpenAIGPT4o => Provider::OpenAI,
- Model::OpenAIo1 => Provider::OpenAI,
- Model::OpenAIGPT4oMini => Provider::OpenAI,
- Model::OpenAIGPT4oSearchPreview => Provider::OpenAI,
- Model::OpenAIo3 => Provider::OpenAI,
- // Google models /
- Model::Gemini25Pro => Provider::Google,
- Model::Gemini20Flash => Provider::Google,
- Model::Gemini15Pro => Provider::Google,
- Model::Gemini20FlashLite => Provider::Google,
- // Anthropic models //
- Model::Claude4Sonnet => Provider::Anthropic,
- Model::Claude37Sonnet => Provider::Anthropic,
- Model::Claude35Sonnet => Provider::Anthropic,
- Model::Claude45Sonnet => Provider::Anthropic,
- Model::Claude45Haiku => Provider::Anthropic,
- Model::Claude45Opus => Provider::Anthropic,
- Model::Claude46Opus => Provider::Anthropic,
- Model::Claude46Sonnet => Provider::Anthropic,
- // XAI models //
- }
- }
-
- fn is_valid_provider(&self, provider: &Provider) -> bool {
- match (self, provider) {
- // Google models //
- (Model::Gemini25Pro, Provider::Google) => true,
- (Model::Gemini20Flash, Provider::Google) => true,
- (Model::Gemini15Pro, Provider::Google) => true,
-
- // OpenAI models //
- (Model::OpenAiGpt41, Provider::OpenAI) => true,
- (Model::OpenAIGPT4o, Provider::OpenAI) => true,
- (Model::OpenAIo1, Provider::OpenAI) => true,
- (Model::OpenAIGPT4oMini, Provider::OpenAI) => true,
- // Anthropic models //
- (Model::Claude37Sonnet, Provider::Anthropic) => true,
- (Model::Claude37Sonnet, Provider::GoogleAnthropic) => true,
- _ => false,
- }
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/model/mod.rs b/rust/cloud-storage/ai/src/types/model/mod.rs
deleted file mode 100644
index 9a45e84877..0000000000
--- a/rust/cloud-storage/ai/src/types/model/mod.rs
+++ /dev/null
@@ -1,181 +0,0 @@
-use serde::{Deserialize, Serialize};
-use strum::{Display, EnumIter, EnumString};
-use utoipa::ToSchema;
-mod metadata;
-pub use metadata::{ModelMetadata, ModelWithMetadataAndProvider, Provider};
-#[derive(
- Serialize,
- Deserialize,
- Debug,
- Clone,
- PartialEq,
- Eq,
- Display,
- EnumString,
- EnumIter,
- Copy,
- ToSchema,
- Default,
-)]
-pub enum Model {
- // Google models ------------------------------------------------------------ //
- #[strum(serialize = "gemini-2.5-pro")]
- #[serde(rename = "gemini-2.5-pro")]
- Gemini25Pro,
-
- #[strum(serialize = "gemini-2.0-flash-001")]
- #[serde(rename = "gemini-2.0-flash-001")]
- Gemini20Flash,
-
- #[strum(serialize = "gemini-2.0-flash-lite-001")]
- #[serde(rename = "gemini-2.0-flash-lite-001")]
- Gemini20FlashLite,
-
- #[serde(rename = "gemini-pro-1.5")]
- #[strum(serialize = "gemini-pro-1.5")]
- Gemini15Pro,
-
- // OpenAI models ------------------------------------------------------------ //
- #[serde(rename = "gpt-5")]
- #[strum(serialize = "gpt-5")]
- OpenAiGpt5,
-
- #[serde(rename = "gpt-4.1")]
- #[strum(serialize = "gpt-4.1")]
- OpenAiGpt41,
-
- #[strum(serialize = "gpt-4o")]
- #[serde(rename = "gpt-4o")]
- OpenAIGPT4o,
-
- #[strum(serialize = "gpt-4o-mini")]
- #[serde(rename = "gpt-4o-mini")]
- OpenAIGPT4oMini,
-
- #[strum(serialize = "o1")]
- #[serde(rename = "o1")]
- OpenAIo1,
-
- #[strum(serialize = "gpt-4o-search-preview")]
- #[serde(rename = "gpt-4o-search-preview")]
- OpenAIGPT4oSearchPreview,
-
- #[strum(serialize = "o3")]
- #[serde(rename = "o3")]
- OpenAIo3,
-
- #[serde(rename = "claude-3-5-sonnet")]
- #[strum(serialize = "claude-3-5-sonnet")]
- Claude35Sonnet,
-
- #[serde(rename = "claude-3-7-sonnet")]
- #[strum(serialize = "claude-3-7-sonnet")]
- Claude37Sonnet,
-
- #[serde(rename = "claude-sonnet-4")]
- #[strum(serialize = "claude-sonnet-4")]
- Claude4Sonnet,
-
- #[serde(rename = "claude-sonnet-4-5")]
- #[strum(serialize = "claude-sonnet-4-5")]
- Claude45Sonnet,
-
- #[serde(rename = "claude-sonnet-4-6")]
- #[strum(serialize = "claude-sonnet-4-6")]
- Claude46Sonnet,
-
- #[serde(rename = "claude-haiku-4-5")]
- #[strum(serialize = "claude-haiku-4-5")]
- #[default]
- Claude45Haiku,
-
- #[serde(rename = "claude-opus-4-5")]
- #[strum(serialize = "claude-opus-4-5")]
- Claude45Opus,
-
- #[serde(rename = "claude-opus-4-6")]
- #[strum(serialize = "claude-opus-4-6")]
- Claude46Opus,
-}
-
-pub mod constants {
- /// String versions of models, without a version (the default [`super::Model`] serialization
- /// includes the version of the model).
- pub mod models {
- pub const GEMINI_25_PRO_PREVIEW: &str = "gemini-2.5-pro-preview";
- pub const GEMINI_20_FLASH: &str = "gemini-2.0-flash";
- pub const GEMINI_20_FLASH_LITE: &str = "gemini-2.0-flash-lite";
- pub const GEMINI_15_PRO: &str = "gemini-pro";
- pub const OPEN_AI_GPT_5: &str = "gpt-5";
- pub const OPEN_AI_GPT_41: &str = "gpt-4.1";
- pub const OPEN_AI_GPT_4O: &str = "gpt-4o";
- pub const OPEN_AI_GPT_4O_MINI: &str = "gpt-4o-mini";
- pub const OPEN_AI_O1: &str = "o1";
- pub const OPEN_AI_GPT_4O_SEARCH_PREVIEW: &str = "gpt-4o-search-preview";
- pub const OPEN_AI_O3: &str = "o3";
- pub const CLAUDE_35_SONNET: &str = "claude-3.5-sonnet";
- pub const CLAUDE_37_SONNET: &str = "claude-3.7-sonnet";
- pub const CLAUDE_4_SONNET: &str = "claude-sonnet-4";
- pub const CLAUDE_45_SONNET: &str = "claude-4.5-sonnet";
- pub const CLAUDE_46_SONNET: &str = "claude-4.6-sonnet";
- pub const CLAUDE_45_HAIKU: &str = "claude-4.5-haiku";
- pub const CLAUDE_45_OPUS: &str = "claude-4.5-opus";
- pub const CLAUDE_46_OPUS: &str = "claude-4.6-opus";
- }
-
- /// String versions of providers
- pub mod providers {
- pub const GOOGLE: &str = "google";
- pub const OPEN_AI: &str = "openai";
- pub const ANTHROPIC: &str = "anthropic";
- }
-}
-
-impl Model {
- pub fn to_provider_model_string(&self) -> (&'static str, &'static str) {
- use constants::models::*;
- use constants::providers::*;
- match self {
- Model::Gemini25Pro => (GOOGLE, GEMINI_25_PRO_PREVIEW),
- Model::Gemini20Flash => (GOOGLE, GEMINI_20_FLASH),
- Model::Gemini20FlashLite => (GOOGLE, GEMINI_20_FLASH_LITE),
- Model::Gemini15Pro => (GOOGLE, GEMINI_15_PRO),
- Model::OpenAiGpt5 => (OPEN_AI, OPEN_AI_GPT_5),
- Model::OpenAiGpt41 => (OPEN_AI, OPEN_AI_GPT_41),
- Model::OpenAIGPT4o => (OPEN_AI, OPEN_AI_GPT_4O),
- Model::OpenAIGPT4oMini => (OPEN_AI, OPEN_AI_GPT_4O_MINI),
- Model::OpenAIo1 => (OPEN_AI, OPEN_AI_O1),
- Model::OpenAIGPT4oSearchPreview => (OPEN_AI, OPEN_AI_GPT_4O_SEARCH_PREVIEW),
- Model::OpenAIo3 => (OPEN_AI, OPEN_AI_O3),
- Model::Claude35Sonnet => (ANTHROPIC, CLAUDE_35_SONNET),
- Model::Claude37Sonnet => (ANTHROPIC, CLAUDE_37_SONNET),
- Model::Claude4Sonnet => (ANTHROPIC, CLAUDE_4_SONNET),
- Model::Claude45Sonnet => (ANTHROPIC, CLAUDE_45_SONNET),
- Model::Claude46Sonnet => (ANTHROPIC, CLAUDE_46_SONNET),
- Model::Claude45Haiku => (ANTHROPIC, CLAUDE_45_HAIKU),
- Model::Claude45Opus => (ANTHROPIC, CLAUDE_45_OPUS),
- Model::Claude46Opus => (ANTHROPIC, CLAUDE_46_OPUS),
- }
- }
- pub fn from_model_str(model: &str) -> Option<Self> {
- use constants::models::*;
- Some(match model {
- GEMINI_25_PRO_PREVIEW => Model::Gemini25Pro,
- GEMINI_20_FLASH => Model::Gemini20Flash,
- GEMINI_20_FLASH_LITE => Model::Gemini20FlashLite,
- GEMINI_15_PRO => Model::Gemini15Pro,
- OPEN_AI_GPT_41 => Model::OpenAiGpt41,
- OPEN_AI_GPT_4O => Model::OpenAIGPT4o,
- OPEN_AI_GPT_4O_MINI => Model::OpenAIGPT4oMini,
- OPEN_AI_O1 => Model::OpenAIo1,
- OPEN_AI_GPT_4O_SEARCH_PREVIEW => Model::OpenAIGPT4oSearchPreview,
- OPEN_AI_O3 => Model::OpenAIo3,
- CLAUDE_35_SONNET => Model::Claude35Sonnet,
- CLAUDE_37_SONNET => Model::Claude37Sonnet,
- CLAUDE_45_SONNET => Model::Claude45Sonnet,
- CLAUDE_45_HAIKU => Model::Claude45Haiku,
- CLAUDE_46_OPUS => Model::Claude46Opus,
- _unknown => return None,
- })
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/providers/mod.rs b/rust/cloud-storage/ai/src/types/providers/mod.rs
deleted file mode 100644
index d8c308735b..0000000000
--- a/rust/cloud-storage/ai/src/types/providers/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub mod openai;
diff --git a/rust/cloud-storage/ai/src/types/providers/openai/error.rs b/rust/cloud-storage/ai/src/types/providers/openai/error.rs
deleted file mode 100644
index 12b99e462f..0000000000
--- a/rust/cloud-storage/ai/src/types/providers/openai/error.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-use crate::types::AiError;
-use async_openai::error::OpenAIError;
-
-impl From<OpenAIError> for AiError {
- fn from(value: OpenAIError) -> Self {
- match &value {
- OpenAIError::ApiError(api_err) => {
- // for anthropic error formatting
- if api_err.message.contains("tokens >") {
- Self::ContextWindowExceeded
- } else {
- Self::Generic(value.into())
- }
- }
- _ => Self::Generic(value.into()),
- }
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/providers/openai/message.rs b/rust/cloud-storage/ai/src/types/providers/openai/message.rs
deleted file mode 100644
index b2de3a653b..0000000000
--- a/rust/cloud-storage/ai/src/types/providers/openai/message.rs
+++ /dev/null
@@ -1,689 +0,0 @@
-use async_openai::types::chat::{
- ChatCompletionMessageToolCall, ChatCompletionMessageToolCalls,
- ChatCompletionRequestAssistantMessage, ChatCompletionRequestAssistantMessageContent,
- ChatCompletionRequestAssistantMessageContentPart, ChatCompletionRequestMessage,
- ChatCompletionRequestMessageContentPartImage, ChatCompletionRequestMessageContentPartText,
- ChatCompletionRequestSystemMessage, ChatCompletionRequestToolMessage,
- ChatCompletionRequestToolMessageContent, ChatCompletionRequestUserMessage,
- ChatCompletionRequestUserMessageContent, ChatCompletionRequestUserMessageContentPart,
- FunctionCall, ImageDetail, ImageUrl,
-};
-
-use crate::types::{AssistantMessagePart, ChatMessage, ChatMessageContent, ChatMessages, Role};
-use attachment::{Attachable, TextOrImage, image::ImageData};
-use std::collections::HashMap;
-
-const IMAGE_PROCESS_QUALITY: Option<ImageDetail> = Some(ImageDetail::High);
-
-fn image_into_openai_image_url(image: ImageData) -> ImageUrl {
- match image {
- ImageData::StaticUrl(url) => ImageUrl {
- url,
- detail: IMAGE_PROCESS_QUALITY,
- },
- ImageData::Base64(base_64_image) => ImageUrl {
- url: base_64_image.to_string(),
- detail: IMAGE_PROCESS_QUALITY,
- },
- }
-}
-
-impl From<ChatMessage> for Vec<ChatCompletionRequestMessage> {
- fn from(value: ChatMessage) -> Self {
- match value.content {
- ChatMessageContent::Text(text) => match value.role {
- Role::Assistant => {
- vec![ChatCompletionRequestMessage::Assistant(
- ChatCompletionRequestAssistantMessage {
- content: Some(ChatCompletionRequestAssistantMessageContent::Text(
- text.to_owned(),
- )),
- ..Default::default()
- },
- )]
- }
- Role::User => {
- if let Some(attachments) = value.attachments {
- let formatted = attachments.into_formatted_parts().compact();
- let mut user_message_content =
- vec![ChatCompletionRequestUserMessageContentPart::Text(
- ChatCompletionRequestMessageContentPartText { text },
- )];
-
- for part in formatted.into_parts().into_inner() {
- match part {
- TextOrImage::Text(attachment_text) => {
- user_message_content.push(
- ChatCompletionRequestUserMessageContentPart::Text(
- ChatCompletionRequestMessageContentPartText {
- text: attachment_text,
- },
- ),
- );
- }
- TextOrImage::Image(image) => {
- user_message_content.push(
- ChatCompletionRequestUserMessageContentPart::ImageUrl(
- ChatCompletionRequestMessageContentPartImage {
- image_url: image_into_openai_image_url(image),
- },
- ),
- );
- }
- }
- }
-
- vec![ChatCompletionRequestMessage::User(
- ChatCompletionRequestUserMessage {
- name: None,
- content: ChatCompletionRequestUserMessageContent::Array(
- user_message_content,
- ),
- },
- )]
- } else {
- vec![ChatCompletionRequestMessage::User(
- ChatCompletionRequestUserMessage {
- name: None,
- content: ChatCompletionRequestUserMessageContent::Text(text),
- },
- )]
- }
- }
- Role::System => {
- vec![ChatCompletionRequestMessage::System(ChatCompletionRequestSystemMessage {
- content:
- async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Text(
- text,
- ),
- ..Default::default()
- })]
- }
- },
- ChatMessageContent::AssistantMessageParts(parts) => {
- let mut messages = Vec::new();
- let mut pending_text = None::<String>;
- let mut pending_tool_calls: Vec<ChatCompletionMessageToolCalls> = Vec::new();
-
- fn flush_pending(
- messages: &mut Vec<ChatCompletionRequestMessage>,
- pending_text: &mut Option<String>,
- pending_tool_calls: &mut Vec<ChatCompletionMessageToolCalls>,
- ) {
- if pending_text.is_some() || !pending_tool_calls.is_empty() {
- messages.push(ChatCompletionRequestMessage::Assistant(
- ChatCompletionRequestAssistantMessage {
- content: pending_text.as_ref().map(|v| {
- ChatCompletionRequestAssistantMessageContent::Text(v.to_owned())
- }),
- refusal: None,
- name: None,
- audio: None,
- tool_calls: if !pending_tool_calls.is_empty() {
- Some(pending_tool_calls.to_owned())
- } else {
- None
- },
- #[allow(deprecated)]
- function_call: None,
- },
- ));
- }
- *pending_text = None;
- *pending_tool_calls = vec![];
- }
-
- for part in parts {
- match part {
- AssistantMessagePart::Text { text } => {
- if text.is_empty() {
- continue;
- }
- match pending_text.as_mut() {
- Some(pending) => pending.push_str(&text),
- None => pending_text = Some(text),
- }
- }
- AssistantMessagePart::ToolCall { name, json, id } => {
- let tool_call = ChatCompletionMessageToolCalls::Function(
- ChatCompletionMessageToolCall {
- function: FunctionCall {
- arguments: serde_json::to_string(&json)
- .unwrap_or(String::new()),
- name: name.clone(),
- },
- id: id.clone(),
- },
- );
- pending_tool_calls.push(tool_call);
- }
- AssistantMessagePart::McpToolCall {
- name,
- service,
- json,
- id,
- ..
- } => {
- let mangled = format!("mcp__{}__{}", service, name);
- let tool_call = ChatCompletionMessageToolCalls::Function(
- ChatCompletionMessageToolCall {
- function: FunctionCall {
- arguments: serde_json::to_string(&json)
- .unwrap_or(String::new()),
- name: mangled,
- },
- id: id.clone(),
- },
- );
- pending_tool_calls.push(tool_call);
- }
- AssistantMessagePart::ToolCallResponseJson { json, id, .. } => {
- // flush pending text and tool calls as an assistant message
- flush_pending(
- &mut messages,
- &mut pending_text,
- &mut pending_tool_calls,
- );
- // Create a separate tool response message
- messages.push(ChatCompletionRequestMessage::Tool(
- ChatCompletionRequestToolMessage {
- tool_call_id: id.clone(),
- content: ChatCompletionRequestToolMessageContent::Text(
- serde_json::to_string_pretty(&json)
- .inspect_err(|e| tracing::error!(err=?e, "failed to serialize tool"))
- .unwrap_or_default()
- ),
- },
- ));
- }
- AssistantMessagePart::ToolCallErr {
- description, id, ..
- } => {
- flush_pending(
- &mut messages,
- &mut pending_text,
- &mut pending_tool_calls,
- );
-
- messages.push(ChatCompletionRequestMessage::Tool(
- ChatCompletionRequestToolMessage {
- tool_call_id: id.clone(),
- content: ChatCompletionRequestToolMessageContent::Text(
- description,
- ),
- },
- ));
- }
- }
- }
-
- flush_pending(&mut messages, &mut pending_text, &mut pending_tool_calls);
-
- messages
- }
- }
- }
-}
-
-/// Convert ChatCompletionRequestMessage to ChatMessage with optional tool call name mapping
-/// This function provides a way to preserve tool names that would otherwise be lost in conversion
-pub fn convert_message(
- msg: ChatCompletionRequestMessage,
- tool_call_id_name_mapping: Option<&HashMap<String, String>>,
-) -> ChatMessage {
- match msg {
- ChatCompletionRequestMessage::System(system_msg) => ChatMessage {
- role: Role::System,
- content: match system_msg.content {
- async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Text(
- text,
- ) => ChatMessageContent::Text(text),
- async_openai::types::chat::ChatCompletionRequestSystemMessageContent::Array(
- parts,
- ) => {
- let text_parts: Vec<String> = parts.iter().map(|part| {
- let async_openai::types::chat::ChatCompletionRequestSystemMessageContentPart::Text(text_part) = part;
- text_part.text.clone()
- }).collect();
- ChatMessageContent::Text(text_parts.join(" "))
- }
- },
- attachments: None,
- },
- ChatCompletionRequestMessage::User(user_msg) => {
- let content = match user_msg.content {
- ChatCompletionRequestUserMessageContent::Text(text) => {
- ChatMessageContent::Text(text)
- }
- ChatCompletionRequestUserMessageContent::Array(parts) => {
- let text_parts: Vec<String> = parts
- .into_iter()
- .filter_map(|part| match part {
- ChatCompletionRequestUserMessageContentPart::Text(text_part) => {
- Some(text_part.text)
- }
- _ => None,
- })
- .collect();
- ChatMessageContent::Text(text_parts.join(" "))
- }
- };
-
- ChatMessage {
- role: Role::User,
- content,
- attachments: None,
- }
- }
- ChatCompletionRequestMessage::Assistant(assistant_msg) => {
- let mut parts = Vec::new();
-
- if let Some(content) = assistant_msg.content {
- match content {
- ChatCompletionRequestAssistantMessageContent::Text(text) => {
- if !text.is_empty() {
- parts.push(AssistantMessagePart::Text { text });
- }
- }
- ChatCompletionRequestAssistantMessageContent::Array(content_parts) => {
- // Collect all text parts and combine them into a single text part
- let mut combined_text = String::new();
- for part in content_parts {
- match part {
- ChatCompletionRequestAssistantMessageContentPart::Text(
- text_part,
- ) => {
- if !text_part.text.is_empty() {
- if !combined_text.is_empty() {
- combined_text.push(' ');
- }
- combined_text.push_str(&text_part.text);
- }
- }
- ChatCompletionRequestAssistantMessageContentPart::Refusal(_) => {}
- }
- }
- if !combined_text.is_empty() {
- parts.push(AssistantMessagePart::Text {
- text: combined_text,
- });
- }
- }
- }
- }
-
- if let Some(tool_calls) = assistant_msg.tool_calls {
- for tool_call in tool_calls {
- if let async_openai::types::chat::ChatCompletionMessageToolCalls::Function(
- tool_call,
- ) = tool_call
- && let Ok(json_value) = serde_json::from_str(&tool_call.function.arguments)
- {
- parts.push(AssistantMessagePart::ToolCall {
- name: tool_call.function.name,
- json: json_value,
- id: tool_call.id,
- });
- }
- }
- }
-
- let content = if parts.len() == 1 {
- if let AssistantMessagePart::Text { text } = &parts[0] {
- ChatMessageContent::Text(text.clone())
- } else {
- ChatMessageContent::AssistantMessageParts(parts)
- }
- } else if parts.is_empty() {
- ChatMessageContent::Text(String::new())
- } else {
- ChatMessageContent::AssistantMessageParts(parts)
- };
-
- ChatMessage {
- role: Role::Assistant,
- content,
- attachments: None,
- }
- }
- ChatCompletionRequestMessage::Tool(tool_msg) => {
- let response_text = match tool_msg.content {
- ChatCompletionRequestToolMessageContent::Text(text) => text,
- ChatCompletionRequestToolMessageContent::Array(_) => {
- tracing::error!("Multi part tool messages are unsupported");
- serde_json::to_string(&serde_json::json!({"error": "Unexpected tool response"}))
- .expect("json")
- }
- };
-
- // Use the mapping to recover the original tool name
- let tool_name = tool_call_id_name_mapping
- .and_then(|mapping| mapping.get(&tool_msg.tool_call_id).cloned())
- .unwrap_or_else(|| {
- tracing::warn!(
- "No mapping found for tool_call_id: {}",
- tool_msg.tool_call_id
- );
- // fallback to ID
- tool_msg.tool_call_id.clone()
- });
-
- let assistant_part = match serde_json::from_str::<serde_json::Value>(&response_text) {
- Ok(json) => AssistantMessagePart::ToolCallResponseJson {
- name: tool_name,
- json,
- id: tool_msg.tool_call_id,
- },
- Err(_) => AssistantMessagePart::ToolCallErr {
- name: tool_name,
- description: response_text,
- id: tool_msg.tool_call_id,
- },
- };
-
- ChatMessage {
- role: Role::Assistant,
- content: ChatMessageContent::AssistantMessageParts(vec![assistant_part]),
- attachments: None,
- }
- }
- ChatCompletionRequestMessage::Function(_) => ChatMessage {
- role: Role::Assistant,
- content: ChatMessageContent::Text(String::new()),
- attachments: None,
- },
- ChatCompletionRequestMessage::Developer(developer_msg) => ChatMessage {
- role: Role::System,
- content: ChatMessageContent::Text(format!("{:?}", developer_msg.content)),
- attachments: None,
- },
- }
-}
-
-impl From<Vec<ChatMessage>> for ChatMessages {
- fn from(messages: Vec<ChatMessage>) -> Self {
- fn make_content_multipart(content: ChatMessageContent) -> Vec<AssistantMessagePart> {
- match content {
- ChatMessageContent::AssistantMessageParts(parts) => parts,
- ChatMessageContent::Text(text) => vec![AssistantMessagePart::Text { text }],
- }
- }
-
- let (mut messages, current) = messages.into_iter().fold(
- (vec![], None::<ChatMessage>),
- |(mut messages, current), msg| match (msg.role, current) {
- (Role::Assistant, Some(mut current)) => {
- // 1. transform both assistant messages to multi part messages;
- let mut current_content =
- make_content_multipart(std::mem::take(&mut current.content));
- let mut msg_content = make_content_multipart(msg.content);
- // 2. append msg parts to current parts
- current_content.append(&mut msg_content);
- current.content = ChatMessageContent::AssistantMessageParts(current_content);
- (messages, Some(current))
- }
- (Role::Assistant, None) => (messages, Some(msg)),
- (_, Some(current)) => {
- messages.push(current);
- messages.push(msg);
- (messages, None)
- }
- (_, None) => {
- messages.push(msg);
- (messages, None)
- }
- },
- );
- if let Some(current) = current {
- messages.push(current);
- }
- ChatMessages(messages)
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use serde_json::json;
-
- fn assert_msg(msg: &ChatMessage, role: Role, content: ChatMessageContent) {
- assert_eq!(msg.role, role);
- assert_eq!(msg.content, content);
- assert!(msg.attachments.is_none());
- }
-
- #[test]
- fn test_system_message_roundtrip() {
- let msg = ChatMessage {
- role: Role::System,
- content: ChatMessageContent::Text("You are a helpful assistant.".to_string()),
- attachments: None,
- };
-
- let openai_msgs: Vec<ChatCompletionRequestMessage> = msg.into();
- let converted = convert_message(openai_msgs.into_iter().next().unwrap(), None);
-
- assert_msg(
- &converted,
- Role::System,
- ChatMessageContent::Text("You are a helpful assistant.".to_string()),
- );
- }
-
- #[test]
- fn test_user_text_message_roundtrip() {
- let msg = ChatMessage {
- role: Role::User,
- content: ChatMessageContent::Text("Hello, how are you?".to_string()),
- attachments: None,
- };
-
- let openai_msgs: Vec<ChatCompletionRequestMessage> = msg.into();
- let converted = convert_message(openai_msgs.into_iter().next().unwrap(), None);
-
- assert_msg(
- &converted,
- Role::User,
- ChatMessageContent::Text("Hello, how are you?".to_string()),
- );
- }
-
- #[test]
- fn test_assistant_text_message_roundtrip() {
- let msg = ChatMessage {
- role: Role::Assistant,
- content: ChatMessageContent::Text("I'm doing well, thank you!".to_string()),
- attachments: None,
- };
-
- let openai_msgs: Vec<ChatCompletionRequestMessage> = msg.into();
- let converted = convert_message(openai_msgs.into_iter().next().unwrap(), None);
-
- assert_msg(
- &converted,
- Role::Assistant,
- ChatMessageContent::Text("I'm doing well, thank you!".to_string()),
- );
- }
-
- #[test]
- fn test_assistant_with_tool_call_roundtrip() {
- let tool_call_id = "call_123".to_string();
- let tool_name = "get_weather".to_string();
- let expected_content = ChatMessageContent::AssistantMessageParts(vec![
- AssistantMessagePart::Text {
- text: "Let me check the weather for you.".to_string(),
- },
- AssistantMessagePart::ToolCall {
- name: tool_name.clone(),
- json: json!({"location": "San Francisco"}),
- id: tool_call_id.clone(),
- },
- ]);
-
- let msg = ChatMessage {
- role: Role::Assistant,
- content: ChatMessageContent::AssistantMessageParts(vec![
- AssistantMessagePart::Text {
- text: "Let me check the weather for you.".to_string(),
- },
- AssistantMessagePart::ToolCall {
- name: tool_name.clone(),
- json: json!({"location": "San Francisco"}),
- id: tool_call_id.clone(),
- },
- ]),
- attachments: None,
- };
-
- let openai_msgs: Vec<ChatCompletionRequestMessage> = msg.into();
-
- let mut tool_mapping = HashMap::new();
- tool_mapping.insert(tool_call_id, tool_name);
-
- let converted_messages: Vec<ChatMessage> = openai_msgs
- .into_iter()
- .map(|msg| convert_message(msg, Some(&tool_mapping)))
- .collect();
-
- let chat_messages = ChatMessages::from(converted_messages);
- let converted = &chat_messages.0[0];
-
- assert_eq!(converted.role, Role::Assistant);
- assert_eq!(converted.content, expected_content);
- }
-
- #[test]
- fn test_assistant_with_tool_response_roundtrip() {
- let tool_call_id = "call_123".to_string();
- let tool_name = "get_weather".to_string();
- let expected_content = ChatMessageContent::AssistantMessageParts(vec![
- AssistantMessagePart::ToolCallResponseJson {
- name: tool_name.clone(),
- json: json!({"temperature": "72°F", "condition": "sunny"}),
- id: tool_call_id.clone(),
- },
- ]);
-
- let msg = ChatMessage {
- role: Role::Assistant,
- content: ChatMessageContent::AssistantMessageParts(vec![
- AssistantMessagePart::ToolCallResponseJson {
- name: tool_name.clone(),
- json: json!({"temperature": "72°F", "condition": "sunny"}),
- id: tool_call_id.clone(),
- },
- ]),
- attachments: None,
- };
-
- let openai_msgs: Vec<ChatCompletionRequestMessage> = msg.into();
-
- let mut tool_mapping = HashMap::new();
- tool_mapping.insert(tool_call_id, tool_name);
-
- let converted =
- convert_message(openai_msgs.into_iter().next().unwrap(), Some(&tool_mapping));
-
- assert_eq!(converted.role, Role::Assistant);
- assert_eq!(converted.content, expected_content);
- }
-
- #[test]
- fn test_assistant_with_tool_error_roundtrip() {
- let tool_call_id = "call_123".to_string();
- let tool_name = "get_weather".to_string();
- let expected_content =
- ChatMessageContent::AssistantMessageParts(vec![AssistantMessagePart::ToolCallErr {
- name: tool_name.clone(),
- description: "<Error message here>".to_string(),
- id: tool_call_id.clone(),
- }]);
-
- let msg = ChatMessage {
- role: Role::Assistant,
- content: ChatMessageContent::AssistantMessageParts(vec![
- AssistantMessagePart::ToolCallErr {
- name: tool_name.clone(),
- description: "<Error message here>".to_string(),
- id: tool_call_id.clone(),
- },
- ]),
- attachments: None,
- };
-
- let openai_msgs: Vec<ChatCompletionRequestMessage> = msg.into();
-
- let mut tool_mapping = HashMap::new();
- tool_mapping.insert(tool_call_id, tool_name);
-
- let converted =
- convert_message(openai_msgs.into_iter().next().unwrap(), Some(&tool_mapping));
-
- assert_eq!(converted.role, Role::Assistant);
- assert_eq!(converted.content, expected_content);
- }
-
- #[test]
- fn test_complex_assistant_message_roundtrip() {
- let tool_call_id = "call_123".to_string();
- let tool_name = "calculate".to_string();
- let expected_content = ChatMessageContent::AssistantMessageParts(vec![
- AssistantMessagePart::Text {
- text: "Let me calculate that for you.".to_string(),
- },
- AssistantMessagePart::ToolCall {
- name: tool_name.clone(),
- json: json!({"expression": "2 + 2"}),
- id: tool_call_id.clone(),
- },
- AssistantMessagePart::ToolCallResponseJson {
- name: tool_name.clone(),
- json: json!({"result": 4}),
- id: tool_call_id.clone(),
- },
- AssistantMessagePart::Text {
- text: "The answer is 4.".to_string(),
- },
- ]);
-
- let msg = ChatMessage {
- role: Role::Assistant,
- content: ChatMessageContent::AssistantMessageParts(vec![
- AssistantMessagePart::Text {
- text: "Let me calculate that for you.".to_string(),
- },
- AssistantMessagePart::ToolCall {
- name: tool_name.clone(),
- json: json!({"expression": "2 + 2"}),
- id: tool_call_id.clone(),
- },
- AssistantMessagePart::ToolCallResponseJson {
- name: tool_name.clone(),
- json: json!({"result": 4}),
- id: tool_call_id.clone(),
- },
- AssistantMessagePart::Text {
- text: "The answer is 4.".to_string(),
- },
- ]),
- attachments: None,
- };
-
- let openai_msgs: Vec<ChatCompletionRequestMessage> = msg.into();
-
- let mut tool_mapping = HashMap::new();
- tool_mapping.insert(tool_call_id, tool_name);
-
- let converted_messages: Vec<ChatMessage> = openai_msgs
- .into_iter()
- .map(|msg| convert_message(msg, Some(&tool_mapping)))
- .collect();
-
- let chat_messages = ChatMessages::from(converted_messages);
- let converted = &chat_messages.0[0];
-
- assert_eq!(converted.role, Role::Assistant);
- assert_eq!(converted.content, expected_content);
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/providers/openai/mod.rs b/rust/cloud-storage/ai/src/types/providers/openai/mod.rs
deleted file mode 100644
index e265631470..0000000000
--- a/rust/cloud-storage/ai/src/types/providers/openai/mod.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-mod error;
-pub(crate) mod message;
-mod request;
-mod response;
diff --git a/rust/cloud-storage/ai/src/types/providers/openai/request.rs b/rust/cloud-storage/ai/src/types/providers/openai/request.rs
deleted file mode 100644
index ff8ad9dd30..0000000000
--- a/rust/cloud-storage/ai/src/types/providers/openai/request.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-use crate::traits::Metadata;
-use crate::types::ChatCompletionRequest;
-use anyhow::Context;
-use async_openai::types::chat::{
- ChatCompletionRequestMessage, ChatCompletionRequestSystemMessage,
- ChatCompletionRequestSystemMessageContent, CreateChatCompletionRequest,
- CreateChatCompletionRequestArgs, ResponseFormat, ResponseFormatJsonSchema,
-};
-use schemars::{JsonSchema, schema_for};
-use serde::Deserialize;
-
-impl ChatCompletionRequest {
- pub fn openai_messages(self) -> Vec<ChatCompletionRequestMessage> {
- let system_message =
- ChatCompletionRequestMessage::System(ChatCompletionRequestSystemMessage {
- content: ChatCompletionRequestSystemMessageContent::Text(
- self.system_prompt.instructions,
- ),
- name: None,
- });
-
- let mut all_messages = vec![system_message];
- all_messages.extend(
- self.messages
- .into_iter()
- .flat_map(Vec::<ChatCompletionRequestMessage>::from),
- );
- all_messages
- }
-}
-
-impl ChatCompletionRequest {
- /// misnomer this actually uses the -- tools api
- pub fn as_structured_request<S>(
- self,
- stream: bool,
- ) -> anyhow::Result<CreateChatCompletionRequest>
- where
- S: JsonSchema + Metadata + for<'de> Deserialize<'de>,
- {
- let schema = schema_for!(S);
- let json_schema = serde_json::to_value(schema).context("failed to form json_schema")?;
- tracing::debug!(
- "{}",
- serde_json::to_string_pretty(&json_schema).expect("json_string")
- );
-
- let response_format = ResponseFormat::JsonSchema {
- json_schema: ResponseFormatJsonSchema {
- description: S::description(),
- name: S::name(),
- schema: Some(json_schema),
- strict: Some(true),
- },
- };
-
- CreateChatCompletionRequestArgs::default()
- .stream(stream)
- .model(format!(
- "{}/{}",
- self.model.to_provider_model_string().0,
- self.model
- ))
- .messages(self.openai_messages())
- .response_format(response_format)
- .build()
- .context("Could not build openai request")
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/providers/openai/response.rs b/rust/cloud-storage/ai/src/types/providers/openai/response.rs
deleted file mode 100644
index e78d3dc6f8..0000000000
--- a/rust/cloud-storage/ai/src/types/providers/openai/response.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-use crate::types::{ChatCompletionRequest, response::ChatStreamCompletionResponse};
-use anyhow::Context;
-use async_openai::types::chat::{
- ChatCompletionRequestMessage, ChatCompletionRequestSystemMessage,
- ChatCompletionRequestSystemMessageContent, CreateChatCompletionRequest,
- CreateChatCompletionRequestArgs, CreateChatCompletionStreamResponse,
- FinishReason as OpenAIFinishReason, ReasoningEffort,
-};
-
-/// OPENAI
-impl TryFrom<ChatCompletionRequest> for CreateChatCompletionRequest {
- type Error = anyhow::Error;
-
- fn try_from(value: ChatCompletionRequest) -> anyhow::Result<Self> {
- let mut all_messages: Vec<ChatCompletionRequestMessage> = vec![];
- // text parts are used for anthropic caching and have no effect on other models
-
- let system_message =
- ChatCompletionRequestMessage::System(ChatCompletionRequestSystemMessage {
- content: ChatCompletionRequestSystemMessageContent::Text(
- value.system_prompt.instructions,
- ),
- name: None,
- });
-
- let messages: Vec<ChatCompletionRequestMessage> = value
- .messages
- .into_iter()
- .flat_map(Vec::<ChatCompletionRequestMessage>::from)
- .collect();
-
- all_messages.push(system_message);
- all_messages.extend(messages);
-
- let model = value.model.to_string();
-
- Ok(if value.model.to_string().starts_with("o") {
- CreateChatCompletionRequestArgs::default()
- .model(model)
- .reasoning_effort(ReasoningEffort::High)
- .messages(all_messages)
- .build()?
- } else {
- CreateChatCompletionRequestArgs::default()
- .model(model)
- .reasoning_effort(ReasoningEffort::Medium)
- .messages(all_messages)
- .build()?
- })
- }
-}
-
-// Response
-impl TryFrom<CreateChatCompletionStreamResponse> for ChatStreamCompletionResponse {
- type Error = anyhow::Error;
-
- fn try_from(value: CreateChatCompletionStreamResponse) -> anyhow::Result<Self> {
- let choices = value.choices.first().context("no choices");
- let content = if let Ok(choices) = choices {
- let content = choices.delta.content.clone().unwrap_or("".to_string());
- if let Some(finish_reason) = choices.finish_reason {
- match finish_reason {
- OpenAIFinishReason::Stop => {}
- _ => {
- tracing::error!(
- "unexpected finish reason for openai response: {:?}",
- finish_reason,
- );
- }
- }
- }
- content
- } else {
- String::new()
- };
- Ok(ChatStreamCompletionResponse::new_content(
- content,
- value.usage,
- ))
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/request.rs b/rust/cloud-storage/ai/src/types/request.rs
deleted file mode 100644
index 47e3ca2c8c..0000000000
--- a/rust/cloud-storage/ai/src/types/request.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-use super::{ChatMessage, SystemPrompt, model::Model};
-
-#[derive(Debug)]
-pub struct ChatCompletionRequest {
- /// can either be openai or google
- pub(crate) model: Model,
- /// List of messages NOT including the system prompt
- pub(crate) messages: Vec<ChatMessage>,
- /// System prompt for the chat request
- pub(crate) system_prompt: SystemPrompt,
-}
-
-impl ChatCompletionRequest {
- pub fn model(&self) -> Model {
- self.model
- }
-
- pub fn messages(&self) -> &[ChatMessage] {
- &self.messages
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/request_builder.rs b/rust/cloud-storage/ai/src/types/request_builder.rs
deleted file mode 100644
index e37eec4d9f..0000000000
--- a/rust/cloud-storage/ai/src/types/request_builder.rs
+++ /dev/null
@@ -1,207 +0,0 @@
-use crate::types::{
- ChatCompletionRequest, ChatMessage, ChatMessageContent, Model, Role, SystemPrompt,
-};
-use attachment::Attachments;
-
-pub type NotSet = ();
-
-pub struct RequestBuilder<ChatModel, Messages, Prompt> {
- /// Some function that expects a specific type.
- ///
- /// correct usage
- /// ```rust
- /// # use ai::types::{Model, MessageBuilder, Role, RequestBuilder};
- /// let request = RequestBuilder::new()
- /// .system_prompt("do_stuff")
- /// .messages(vec![
- /// MessageBuilder::new()
- /// .content("user message")
- /// .role(Role::User)
- /// .build() ,
- /// MessageBuilder::new()
- /// .content("assistant message")
- /// .role(Role::Assistant)
- /// .build()
- /// ])
- /// .model(Model::Claude35Sonnet)
- /// .build();
- /// ```
- /// # Example
- /// incorrect usage
- /// ```rust,compile_fail
- /// // forgot model so compile fail :(
- /// let request = RequestBuilder::new()
- /// .system_prompt("do a thing chat".into())
- /// .messages(vec![
- /// MessageBuilder::new()
- /// .content("hi")
- /// .role(Role::User)]
- /// )
- /// .build(); // doesn't exist :( bc model is not specified
- ///
- /// ```
- ///
-
- /// required model enum
- model: ChatModel,
- /// required chain of messages
- messages: Messages,
- /// required system prompt
- system_prompt: Prompt,
- /// optional max tokens (input + output)
- max_tokens: Option<u32>,
- /// optional list of attachments (prefetched)
- attachments: Option<Attachments<'static>>,
-}
-
-/// the build method only works if we have model, messages, and system prompt
-impl RequestBuilder<Model, Vec<ChatMessage>, String> {
- pub fn build(mut self) -> ChatCompletionRequest {
- if let Some(attachments) = self.attachments.take()
- && let Some(message) = self
- .messages
- .iter_mut()
- .rev()
- .find(|message| message.role == Role::User)
- {
- message.attachments = Some(attachments);
- }
-
- ChatCompletionRequest {
- system_prompt: SystemPrompt {
- attachments: Default::default(),
- instructions: self.system_prompt,
- },
- messages: self.messages,
- model: self.model,
- }
- }
-}
-
-impl From<RequestBuilder<Model, Vec<ChatMessage>, String>> for ChatCompletionRequest {
- fn from(val: RequestBuilder<Model, Vec<ChatMessage>, String>) -> Self {
- val.build()
- }
-}
-
-impl Default for RequestBuilder<(), (), ()> {
- fn default() -> Self {
- Self::new()
- }
-}
-
-impl RequestBuilder<(), (), ()> {
- pub fn new() -> Self {
- Self {
- attachments: None,
- max_tokens: None,
- messages: (),
- model: (),
- system_prompt: (),
- }
- }
-}
-
-// these methods set things and can be called in any order
-impl<ChatModel, Messages, Prompt> RequestBuilder<ChatModel, Messages, Prompt> {
- /// set system prompt: Self<any, any, any> -> Self<any, any, String>
- pub fn system_prompt(
- self,
- system_prompt: impl Into<String>,
- ) -> RequestBuilder<ChatModel, Messages, String> {
- RequestBuilder {
- attachments: self.attachments,
- max_tokens: self.max_tokens,
- messages: self.messages,
- model: self.model,
- system_prompt: system_prompt.into(),
- }
- }
-
- pub fn attachments(mut self, attachments: Attachments<'static>) -> Self {
- self.attachments = Some(attachments);
- self
- }
-
- pub fn user_message(
- self,
- message: impl Into<String>,
- ) -> RequestBuilder<ChatModel, Vec<ChatMessage>, Prompt> {
- self.messages(vec![ChatMessage {
- content: ChatMessageContent::Text(message.into()),
- role: Role::User,
- attachments: None,
- }])
- }
-
- // set messages
- pub fn messages(
- self,
- messages: Vec<ChatMessage>,
- ) -> RequestBuilder<ChatModel, Vec<ChatMessage>, Prompt> {
- RequestBuilder {
- attachments: self.attachments,
- max_tokens: self.max_tokens,
- messages,
- model: self.model,
- system_prompt: self.system_prompt,
- }
- }
-
- // set max tokens
- pub fn max_tokens(mut self, max_tokens: u32) -> Self {
- self.max_tokens = Some(max_tokens);
- self
- }
-
- // set model
- pub fn model(self, model: Model) -> RequestBuilder<Model, Messages, Prompt> {
- RequestBuilder {
- attachments: self.attachments,
- max_tokens: self.max_tokens,
- messages: self.messages,
- model,
- system_prompt: self.system_prompt,
- }
- }
-}
-
-#[cfg(test)]
-mod test {
- use super::*;
- use crate::types::{MessageBuilder, Model, Role};
-
- #[test]
- fn test_good_builder_no_options() {
- let messages = vec![
- MessageBuilder::new()
- .content("user message")
- .role(Role::User)
- .build(),
- MessageBuilder::new()
- .content("assistant response")
- .role(Role::Assistant)
- .build(),
- ];
-
- let request = RequestBuilder::new()
- .system_prompt("Basic system prompt".to_string())
- .messages(messages)
- .model(Model::Claude35Sonnet)
- .build();
-
- // Verify system prompt (no attachments)
- assert_eq!(request.system_prompt.instructions, "Basic system prompt");
- assert!(request.system_prompt.attachments.is_none());
-
- // Verify model and default max_tokens
- assert_eq!(request.model, Model::Claude35Sonnet);
-
- // Verify messages count
- assert_eq!(request.messages.len(), 2);
-
- for message in &request.messages {
- assert!(message.attachments.is_none());
- }
- }
-}
diff --git a/rust/cloud-storage/ai/src/types/response.rs b/rust/cloud-storage/ai/src/types/response.rs
deleted file mode 100644
index 15de47a09e..0000000000
--- a/rust/cloud-storage/ai/src/types/response.rs
+++ /dev/null
@@ -1,114 +0,0 @@
-use async_openai::{error::OpenAIError, types::chat::CompletionUsage};
-
-#[derive(Debug, Clone)]
-pub struct Usage {
- input_tokens: usize,
- output_tokens: usize,
- resp_obj: CompletionUsage,
-}
-
-impl From<CompletionUsage> for Usage {
- fn from(value: CompletionUsage) -> Self {
- Self {
- input_tokens: value.prompt_tokens as usize,
- output_tokens: value.completion_tokens as usize,
- resp_obj: value,
- }
- }
-}
-
-impl Usage {
- pub fn total_tokens(&self) -> usize {
- self.input_tokens + self.output_tokens
- }
- pub fn get_response_obj(&self) -> CompletionUsage {
- self.resp_obj.clone()
- }
- pub fn get_input_and_output_tokens(&self) -> (usize, usize) {
- (self.input_tokens, self.output_tokens)
- }
-}
-
-#[derive(Clone, Debug)]
-pub struct ChatStreamCompletionContent {
- pub content: String,
- pub usage: Option<Usage>,
-}
-
-impl ChatStreamCompletionContent {
- fn new(content: String, usage: Option<Usage>) -> Self {
- Self { content, usage }
- }
-}
-
-#[derive(Clone, Debug)]
-pub enum ChatStreamCompletionResponse {
- Content(ChatStreamCompletionContent),
-}
-
-impl ChatStreamCompletionResponse {
- pub fn new_content(content: String, usage: Option<CompletionUsage>) -> Self {
- Self::Content(ChatStreamCompletionContent::new(
- content,
- usage.map(Into::into),
- ))
- }
-}
-
-#[derive(Debug)]
-pub enum ConversionError {
- NoConversion,
- Other(anyhow::Error),
-}
-
-#[derive(Debug)]
-pub enum ChatCompletionError {
- /// The request was rejected the provider
- RequestError(anyhow::Error),
- /// The model refused to generate content
- Refusal(String),
- /// The model did not return any content
- NoContent,
- /// This provider is not supported
- Unsupported,
-}
-
-impl std::fmt::Display for ChatCompletionError {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- match self {
- ChatCompletionError::RequestError(e) => {
- write!(f, "ChatCompletionError::RequestError({})", e)
- }
- ChatCompletionError::Refusal(s) => {
- write!(f, "ChatCompletionError::Refusal({})", s)
- }
- ChatCompletionError::NoContent => {
- write!(f, "ChatCompletionError::NoContent")
- }
- ChatCompletionError::Unsupported => {
- write!(f, "ChatCompletionError::Unsupported")
- }
- }
- }
-}
-
-impl std::error::Error for ChatCompletionError {
- fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
- match self {
- ChatCompletionError::RequestError(err) => err.source(),
- _ => None,
- }
- }
-}
-
-impl From<anyhow::Error> for ConversionError {
- fn from(err: anyhow::Error) -> Self {
- ConversionError::Other(err)
- }
-}
-
-impl From<OpenAIError> for ChatCompletionError {
- fn from(value: OpenAIError) -> Self {
- ChatCompletionError::RequestError(value.into())
- }
-}
diff --git a/rust/cloud-storage/ai/src/web_search/client.rs b/rust/cloud-storage/ai/src/web_search/client.rs
deleted file mode 100644
index 9491abf014..0000000000
--- a/rust/cloud-storage/ai/src/web_search/client.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-use super::types::{RequestBody, Response};
-use std::env::VarError;
-
-use reqwest;
-
-const PERPLEXITY_API_KEY: &str = "PERPLEXITY_API_KEY";
-const PERPLEXITY_ENDPOINT: &str = "https://api.perplexity.ai/chat/completions";
-
-pub struct PerplexityClient {
- inner: reqwest::Client,
-}
-
-impl PerplexityClient {
- pub fn new(api_key: String) -> Self {
- let mut headers = reqwest::header::HeaderMap::new();
- headers.insert(
- "Authorization",
- format!("Bearer {}", api_key).parse().unwrap(),
- );
-
- let inner = reqwest::Client::builder()
- .default_headers(headers)
- .build()
- .unwrap();
-
- PerplexityClient { inner }
- }
-
- pub fn from_env() -> Result<Self, VarError> {
- let key = std::env::var(PERPLEXITY_API_KEY)?;
- Ok(Self::new(key))
- }
-}
-
-impl PerplexityClient {
- pub async fn simple_search<T: Into<String>>(
- &self,
- query: T,
- system_prompt: T,
- ) -> Result<Response, anyhow::Error> {
- let body = RequestBody::default_query(query.into(), system_prompt.into());
- self.inner
- .post(PERPLEXITY_ENDPOINT)
- .json(&body)
- .send()
- .await?
- .json::<Response>()
- .await
- .map_err(anyhow::Error::from)
- }
-}
diff --git a/rust/cloud-storage/ai/src/web_search/mod.rs b/rust/cloud-storage/ai/src/web_search/mod.rs
deleted file mode 100644
index 89e4eee93f..0000000000
--- a/rust/cloud-storage/ai/src/web_search/mod.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-mod client;
-pub mod types;
-
-pub use client::PerplexityClient;
diff --git a/rust/cloud-storage/ai/src/web_search/types.rs b/rust/cloud-storage/ai/src/web_search/types.rs
deleted file mode 100644
index 7be53ab5e0..0000000000
--- a/rust/cloud-storage/ai/src/web_search/types.rs
+++ /dev/null
@@ -1,87 +0,0 @@
-use serde::{Deserialize, Serialize};
-// https://docs.perplexity.ai/api-reference/chat-completions-post
-
-#[derive(Serialize, Deserialize, Debug, Copy, Clone)]
-#[serde(rename_all = "lowercase")]
-pub enum Role {
- User,
- System,
- Assistant,
-}
-
-pub const SEARCH_MODEL: &str = "sonar";
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct Message {
- pub role: Role,
- pub content: String,
-}
-
-#[derive(Debug, Serialize, Deserialize, Clone, Default)]
-pub struct RequestBody {
- pub model: String,
- pub messages: Vec<Message>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub max_tokens: Option<f64>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub search_mode: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub search_domain_filter: Option<Vec<String>>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub search_recency_filter: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub stream: Option<bool>,
-}
-
-impl RequestBody {
- pub fn default_query(query: String, system_prompt: String) -> Self {
- let messages = vec![
- Message {
- role: Role::System,
- content: system_prompt,
- },
- Message {
- role: Role::User,
- content: query,
- },
- ];
- Self {
- model: SEARCH_MODEL.to_string(),
- messages,
- ..Default::default()
- }
- }
-}
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct Usage {
- pub prompt_tokens: f64,
- pub completion_tokens: f64,
- pub total_tokens: f64, // there's some other shit in here that you can define if you need (all optional)
-}
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct Choice {
- pub index: i64,
- pub message: Message,
- // this is an enum
- pub finish_reason: Option<String>,
-}
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct SearchResult {
- pub title: String,
- pub url: String,
- pub date: Option<String>,
-}
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct Response {
- pub id: String,
- pub model: String,
- pub created: i64,
- pub usage: Usage,
- pub object: String,
- pub choices: Vec<Choice>,
- pub search_results: Vec<SearchResult>,
-}
diff --git a/rust/cloud-storage/ai_tools/Cargo.toml b/rust/cloud-storage/ai_tools/Cargo.toml
index 1838f503bd..b0b9aa030a 100644
--- a/rust/cloud-storage/ai_tools/Cargo.toml
+++ b/rust/cloud-storage/ai_tools/Cargo.toml
@@ -8,11 +8,11 @@ version = "0.1.0"
test-support = []
[dependencies]
-ai = { path = "../ai" }
+agent = { path = "../agent" }
+anthropic = { path = "../anthropic", features = ["toolset"] }
attachment = { path = "../attachment" }
non_empty = { path = "../non_empty" }
ai_toolset = { path = "../ai_toolset" }
-anthropic = { path = "../anthropic" }
anyhow.workspace = true
async-trait.workspace = true
axum = { workspace = true, features = ["macros"] }
diff --git a/rust/cloud-storage/ai_tools/src/build_context.rs b/rust/cloud-storage/ai_tools/src/build_context.rs
index fd32855e5d..2ff116a2e8 100644
--- a/rust/cloud-storage/ai_tools/src/build_context.rs
+++ b/rust/cloud-storage/ai_tools/src/build_context.rs
@@ -8,6 +8,7 @@ use crate::tool_context::{
NoOpCallRtcClient, NoOpConnectionService, NoOpNotificationIngress, NoOpNotificationService,
NoOpSnsEndpointManager, NoOpTaskProperties, ToolNotificationQueue, ToolServiceContext,
};
+use anthropic::toolset::AnthropicToolContext;
use anyhow::Context;
use comms::domain::service::ChannelServiceImpl;
use comms::outbound::postgres::comms_repo::PgCommsRepo;
@@ -287,6 +288,8 @@ pub async fn build_tool_service_context_from_env(
(*entity_access_service).clone(),
);
+ let anthropic_tool_context = build_anthropic_tool_context();
+
Ok(ToolServiceContext {
search_service_client: search_client,
email_service_client: email_ext_client,
@@ -301,5 +304,32 @@ pub async fn build_tool_service_context_from_env(
channel_tool_context,
team_tool_context: crate::tool_context::build_team_tool_context(pool.clone()),
schedule_tool_context: crate::NoOpScheduleContext,
+ anthropic_tool_context,
})
}
+
+/// Build an [`AnthropicToolContext`] from environment variables.
+///
+/// Reads `ANTHROPIC_API_KEY` and configures the client with the beta headers
+/// required for web fetch and code execution server tools.
+pub fn build_anthropic_tool_context() -> AnthropicToolContext {
+ let mut config = anthropic::config::Config::dangrously_try_from_env();
+ config.headers.append(
+ anthropic::prelude::WEB_FETCH_TOOL_HEADER.0.clone(),
+ anthropic::prelude::WEB_FETCH_TOOL_HEADER.1.clone(),
+ );
+ config.headers.append(
+ anthropic::prelude::CODE_EXECUTION_TOOL_HEADER.0.clone(),
+ anthropic::prelude::CODE_EXECUTION_TOOL_HEADER.1.clone(),
+ );
+ let client = anthropic::client::Client::with_config(config);
+ AnthropicToolContext::new(client, "claude-haiku-4-5".into())
+}
+
+/// Dummy [`AnthropicToolContext`] that does not require an API key.
+#[cfg(any(test, feature = "test-support"))]
+pub fn build_anthropic_tool_context_test() -> AnthropicToolContext {
+ let config = anthropic::config::Config::default();
+ let client = anthropic::client::Client::with_config(config);
+ AnthropicToolContext::new(client, "test-model".into())
+}
diff --git a/rust/cloud-storage/ai_tools/src/lib.rs b/rust/cloud-storage/ai_tools/src/lib.rs
index 5a9fe72d9f..da1b931818 100644
--- a/rust/cloud-storage/ai_tools/src/lib.rs
+++ b/rust/cloud-storage/ai_tools/src/lib.rs
@@ -10,6 +10,8 @@ pub mod serde_utils;
mod subagent;
mod tool_context;
+pub use anthropic::toolset::AnthropicToolContext;
+use anthropic::toolset::anthropic_toolset;
use call::inbound::toolset::call_toolset;
use channels::inbound::toolset::channel_toolset;
use chat::inbound::toolset::chat_toolset;
@@ -17,13 +19,15 @@ use documents::inbound::toolset::document_toolset;
use email::inbound::toolset::{email_toolset, mcp_toolset as email_mcp_toolset};
use notification::inbound::ai_tool::notification_toolset;
use properties::inbound::toolset::properties_toolset;
-use schemas::{anthropic_tools, read};
+use schemas::read;
use soup::inbound::toolset::{ListEntities, SoupToolContext};
use std::sync::Arc;
use subagent::Subagent;
use teams::inbound::toolset::team_toolset;
-pub use build_context::build_tool_service_context_from_env;
+#[cfg(any(test, feature = "test-support"))]
+pub use build_context::build_anthropic_tool_context_test;
+pub use build_context::{build_anthropic_tool_context, build_tool_service_context_from_env};
pub use search::search_toolset;
#[cfg(any(test, feature = "test-support"))]
pub use tool_context::no_op_schedule_context;
@@ -71,6 +75,7 @@ pub(crate) fn subagent_toolset() -> AiToolSet {
.add_subtoolset::<ToolChatToolContext>(chat_toolset())
.add_subtoolset::<ToolChannelToolContext>(channel_toolset())
.add_subtoolset::<ToolTeamToolContext>(team_toolset())
+ .add_subtoolset::<AnthropicToolContext>(anthropic_toolset())
}
/// These are actually sent to the AI provider
@@ -88,10 +93,6 @@ pub fn all_tools() -> ToolSetWithPrompt {
pub fn all_tool_combined_schema() -> CombinedToolSchemas {
CombinedToolSchemas::builder()
.merge(&all_tools())
- .merge(&anthropic_tools::web_search())
- .merge(&anthropic_tools::web_fetch())
- .merge(&anthropic_tools::bash_code_execution())
- .merge(&anthropic_tools::text_editor_code_execution())
.merge(&read::read_thread())
.build()
}
diff --git a/rust/cloud-storage/ai_tools/src/schemas/mod.rs b/rust/cloud-storage/ai_tools/src/schemas/mod.rs
index 1bf990514f..8d2483f794 100644
--- a/rust/cloud-storage/ai_tools/src/schemas/mod.rs
+++ b/rust/cloud-storage/ai_tools/src/schemas/mod.rs
@@ -3,5 +3,4 @@
//! These are just schemas _not_ tools and aren't sent to AI. The
//! schemas are kept here so that typegen and frontend rendering works.
-pub mod anthropic_tools;
pub mod read;
diff --git a/rust/cloud-storage/ai_tools/src/search/mod.rs b/rust/cloud-storage/ai_tools/src/search/mod.rs
index 5cb21a2338..f883aea9f8 100644
--- a/rust/cloud-storage/ai_tools/src/search/mod.rs
+++ b/rust/cloud-storage/ai_tools/src/search/mod.rs
@@ -2,7 +2,6 @@ use crate::AiToolSet;
use ai_toolset::AsyncToolCollection;
mod search_service;
-pub mod web;
pub fn search_toolset() -> AiToolSet {
AsyncToolCollection::new()
diff --git a/rust/cloud-storage/ai_tools/src/search/web/mod.rs b/rust/cloud-storage/ai_tools/src/search/web/mod.rs
deleted file mode 100644
index d356908d1f..0000000000
--- a/rust/cloud-storage/ai_tools/src/search/web/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub mod perplexity_search;
diff --git a/rust/cloud-storage/ai_tools/src/search/web/perplexity_search.rs b/rust/cloud-storage/ai_tools/src/search/web/perplexity_search.rs
deleted file mode 100644
index 6ca0e0a6cc..0000000000
--- a/rust/cloud-storage/ai_tools/src/search/web/perplexity_search.rs
+++ /dev/null
@@ -1,95 +0,0 @@
-use ai_toolset::{AsyncTool, NoContext, RequestContext, ServiceContext, ToolCallError, ToolResult};
-use async_trait::async_trait;
-use schemars::JsonSchema;
-use serde::{Deserialize, Serialize};
-
-#[derive(Debug, Clone, JsonSchema, Serialize)]
-pub struct SearchResult {
- pub url: String,
- pub name: String,
-}
-
-#[derive(Debug, Clone, JsonSchema, Serialize)]
-pub struct SearchResults {
- pub content: String,
- pub results: Vec<SearchResult>,
-}
-
-const WEB_SEARCH_DESCRIPTION: &str = concat!(
- "Trigger an intelligent internet search tool with a search query. ",
- "Phrase the query as a natural language question. ",
- "The search tool only has the information passed into the query string to include any relevant context ",
- "from the conversation. Use this tool when the user specifically requests a web search, asks for resources, asks for links, asks you to read documentation",
- "When referencing links returned by search remember to use github markdown notation to format them like this [description](https://example.com)",
- r#"Our CEO describes when to use web search like this: I think some important criteria for choosing to search the web are",
- if the user is asking for time-sensitive information (sports scores, news, current happenings, etc) that would have changed since the knowledge cutoff date
- Specific questions that reference external sources, eg contain a hyperlink in the user message or explicitly say “use webmd” or “check arxiv”
- do not use web search for things that are likely to find SEO slop content; this will make it worse than if it didn’t do it
- the LLM is be allowed to guess an answer and then use the web search tool to check AFTER providing the answer, if it feels it’s necessary. E.g. user asks “when was Caesar stabbed” -> llm gives answer -> if needed use web to double check"
- "#,
- "do not use this tool many times in a single response, you think the user may need more information ask them before calling web search again. You should always share",
- "the results of your search with the user even if you are not sure if they are useful"
-);
-
-const WEB_SEARCH_SYSTEM_PROMPT: &str = concat!(
- "You are an internal search tool used for augmenting and grounding agentic responses.",
- "Be concise and informational in your responses. Format your responses with plaintext"
-);
-
-#[derive(Debug, Clone, JsonSchema, Deserialize)]
-#[serde(rename_all = "camelCase")]
-#[schemars(
- description = WEB_SEARCH_DESCRIPTION
-)]
-pub struct PerplexitySearch {
- #[schemars(description = "The search string to search for. Should be long / descriptive")]
- pub query: String,
-}
-
-#[async_trait]
-impl AsyncTool<NoContext> for PerplexitySearch {
- type Output = SearchResults;
-
- #[tracing::instrument(skip_all, fields(user_id=?(*_request_context.user_id).as_ref()), err)]
- async fn call(
- &self,
- _service_context: ServiceContext<NoContext>,
- _request_context: RequestContext,
- ) -> ToolResult<Self::Output> {
- let client = ai::web_search::PerplexityClient::from_env().map_err(|err| ToolCallError {
- description: "Search failed due to an internal error. Do not try to search again."
- .to_string(),
- internal_error: anyhow::Error::from(err),
- })?;
-
- let results = client
- .simple_search(self.query.as_str(), WEB_SEARCH_SYSTEM_PROMPT)
- .await
- .map_err(|err| ToolCallError {
- description: "web search failed due to an internal server error".to_string(),
- internal_error: err,
- })?;
-
- let content = results
- .choices
- .first()
- .ok_or_else(|| ToolCallError {
- description: "The search didn't return any results".to_string(),
- internal_error: anyhow::anyhow!("No choices returned by search"),
- })?
- .message
- .content
- .clone();
-
- let results = results
- .search_results
- .into_iter()
- .map(|result| SearchResult {
- name: result.title,
- url: result.url,
- })
- .collect();
-
- Ok(SearchResults { content, results })
- }
-}
diff --git a/rust/cloud-storage/ai_tools/src/subagent.rs b/rust/cloud-storage/ai_tools/src/subagent.rs
index 5f17b8ae91..5b6a3adc02 100644
--- a/rust/cloud-storage/ai_tools/src/subagent.rs
+++ b/rust/cloud-storage/ai_tools/src/subagent.rs
@@ -1,14 +1,12 @@
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolLoop, ToolResult};
-use ai::types::{Model, RequestBuilder};
+use agent::AgentModel;
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
-use futures::stream::StreamExt;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
-use std::sync::Arc;
-use crate::{ToolServiceContext, subagent_toolset};
+use crate::ToolServiceContext;
-static SUBAGENT_MODEL: Model = Model::Claude46Sonnet;
+static SUBAGENT_MODEL: AgentModel = AgentModel::Smart;
static SUBAGENT_PROMPT: &str = include_str!("prompts/subagent.md");
@@ -33,49 +31,19 @@ pub struct Subagent {
impl AsyncTool<ToolServiceContext> for Subagent {
type Output = SubagentResponse;
- #[tracing::instrument(skip_all, fields(user_id=?request_context.user_id), err)]
+ #[tracing::instrument(skip_all, err)]
async fn call(
&self,
- service_context: ServiceContext<ToolServiceContext>,
- request_context: RequestContext,
+ _service_context: ServiceContext<ToolServiceContext>,
+ _request_context: RequestContext,
) -> ToolResult<Self::Output> {
- let toolset = Arc::new(subagent_toolset());
-
- let request = RequestBuilder::new()
- .model(SUBAGENT_MODEL)
- .system_prompt(SUBAGENT_PROMPT)
- .user_message(&self.task)
- .build();
-
- let mut chat = ToolLoop::new(toolset, service_context.0.clone()).chat();
-
- {
- let mut stream = chat
- .send_message(
- request,
- request_context.clone(),
- request_context.user_id.to_string(),
- )
- .await
- .map_err(|e| ToolCallError {
- description: "failed to start subagent".to_string(),
- internal_error: e.into(),
- })?;
-
- while let Some(next) = stream.next().await {
- next.map_err(|e| ToolCallError {
- description: "subagent encountered an error".to_string(),
- internal_error: e.into(),
- })?;
- }
- }
-
- let messages = chat.get_new_conversation_messages();
- let text = messages
- .last()
- .map(|m| m.content.message_text())
- .unwrap_or_default();
-
- Ok(SubagentResponse { result: text })
+ let result = agent::complete(SUBAGENT_MODEL, SUBAGENT_PROMPT, &self.task)
+ .await
+ .map_err(|e| ToolCallError {
+ description: "subagent encountered an error".to_string(),
+ internal_error: e,
+ })?;
+
+ Ok(SubagentResponse { result })
}
}
diff --git a/rust/cloud-storage/ai_tools/src/tool_context.rs b/rust/cloud-storage/ai_tools/src/tool_context.rs
index bf8fabfd45..478be89e08 100644
--- a/rust/cloud-storage/ai_tools/src/tool_context.rs
+++ b/rust/cloud-storage/ai_tools/src/tool_context.rs
@@ -1,3 +1,4 @@
+use anthropic::toolset::AnthropicToolContext;
use axum::extract::FromRef;
use call::domain::models::{CallError, CallWebhookEvent, EgressS3Config};
use call::domain::ports::CallRtcClient;
@@ -456,6 +457,7 @@ pub struct ToolServiceContext {
pub channel_tool_context: ToolChannelToolContext,
pub team_tool_context: ToolTeamToolContext,
pub schedule_tool_context: NoOpScheduleContext,
+ pub anthropic_tool_context: AnthropicToolContext,
}
impl FromRef<ToolServiceContext> for ai_toolset::NoContext {
diff --git a/rust/cloud-storage/anthropic/Cargo.toml b/rust/cloud-storage/anthropic/Cargo.toml
index ef9357d8e4..9750488ad2 100644
--- a/rust/cloud-storage/anthropic/Cargo.toml
+++ b/rust/cloud-storage/anthropic/Cargo.toml
@@ -7,6 +7,7 @@ version = "0.2.0"
[features]
default = ["openai"]
openai = ["dep:async-openai"]
+toolset = ["dep:ai_toolset", "dep:async-trait", "dep:anyhow"]
[dev-dependencies]
rand = { workspace = true }
@@ -28,3 +29,6 @@ async-openai = { workspace = true, optional = true}
chrono.workspace = true
lazy_static = {workspace = true}
regex = { workspace = true }
+ai_toolset = { path = "../ai_toolset", optional = true }
+async-trait = { workspace = true, optional = true }
+anyhow = { workspace = true, optional = true }
diff --git a/rust/cloud-storage/anthropic/src/client/chat.rs b/rust/cloud-storage/anthropic/src/client/chat.rs
index 10562fdbff..9e379f078b 100644
--- a/rust/cloud-storage/anthropic/src/client/chat.rs
+++ b/rust/cloud-storage/anthropic/src/client/chat.rs
@@ -7,7 +7,7 @@ use super::Client;
use crate::error::AnthropicError;
use crate::types::request::CreateMessageRequestBody;
use crate::types::request::transform_request_web_fetch;
-use crate::types::response::StreamEvent;
+use crate::types::response::{MessageResponse, StreamEvent};
pub type MessageCompletionResponseStream =
Pin<Box<dyn Stream<Item = Result<StreamEvent, AnthropicError>> + Send>>;
@@ -23,6 +23,18 @@ impl Client {
}
impl<'c> Chat<'c> {
+ pub async fn create<I>(
+ &self,
+ request: I,
+ ) -> Result<MessageResponse, crate::error::AnthropicError>
+ where
+ I: Into<CreateMessageRequestBody>,
+ {
+ let request = request.into();
+ let request = transform_request_web_fetch(request);
+ self.inner.post("/v1/messages", request).await
+ }
+
pub async fn create_stream<I>(&self, request: I) -> MessageCompletionResponseStream
where
I: Into<CreateMessageRequestBody>,
@@ -41,7 +53,6 @@ impl<'c> Chat<'c> {
I: Serialize + Debug,
O: DeserializeOwned + Send + Sync + 'static,
{
- tracing::debug!("{:#?}", request);
self.inner.post_stream("/v1/messages", request).await
}
}
diff --git a/rust/cloud-storage/anthropic/src/client/mod.rs b/rust/cloud-storage/anthropic/src/client/mod.rs
index bebe9f22bf..8cd68b68db 100644
--- a/rust/cloud-storage/anthropic/src/client/mod.rs
+++ b/rust/cloud-storage/anthropic/src/client/mod.rs
@@ -65,6 +65,41 @@ impl Client {
}
impl Client {
+ pub(crate) async fn post<I, O>(&self, path: &str, request: I) -> Result<O, AnthropicError>
+ where
+ I: Serialize + std::fmt::Debug,
+ O: DeserializeOwned,
+ {
+ let response = self
+ .http_client
+ .post(format!("{}{}", self.config.api_base, path))
+ .headers(self.config.headers.clone())
+ .json(&request)
+ .send()
+ .await?;
+
+ let status = response.status();
+ let body = response.text().await.map_err(AnthropicError::Reqwest)?;
+
+ if !status.is_success() {
+ return match serde_json::from_str::<ApiError>(&body) {
+ Ok(api_error) => Err(AnthropicError::ApiError {
+ api_error,
+ status_code: status,
+ }),
+ Err(e) => {
+ tracing::error!(%body, "failed to parse API error response");
+ Err(AnthropicError::JsonDeserialize(e))
+ }
+ };
+ }
+
+ serde_json::from_str::<O>(&body).map_err(|e| {
+ tracing::error!(%body, "failed to deserialize response");
+ AnthropicError::JsonDeserialize(e)
+ })
+ }
+
pub(crate) async fn post_stream<I, O>(
&self,
path: &str,
diff --git a/rust/cloud-storage/anthropic/src/lib.rs b/rust/cloud-storage/anthropic/src/lib.rs
index b505305bbb..4587b84984 100644
--- a/rust/cloud-storage/anthropic/src/lib.rs
+++ b/rust/cloud-storage/anthropic/src/lib.rs
@@ -6,3 +6,6 @@ pub mod types;
#[cfg(feature = "openai")]
pub mod openai;
+
+#[cfg(feature = "toolset")]
+pub mod toolset;
diff --git a/rust/cloud-storage/anthropic/src/toolset/bash_code_execution.rs b/rust/cloud-storage/anthropic/src/toolset/bash_code_execution.rs
new file mode 100644
index 0000000000..d807814c74
--- /dev/null
+++ b/rust/cloud-storage/anthropic/src/toolset/bash_code_execution.rs
@@ -0,0 +1,51 @@
+use super::AnthropicToolContext;
+use crate::types::request::CODE_EXECUTION_TOOL;
+use crate::types::response::ResponseContentKind;
+use crate::types::response::code_execution::BashCodeExecutionResponse;
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use async_trait::async_trait;
+use schemars::JsonSchema;
+use serde::Deserialize;
+
+/// Execute a bash command using Claude's built-in code execution sandbox.
+#[derive(Deserialize, JsonSchema, Clone)]
+#[schemars(
+ title = "BashCodeExecution",
+ description = "Execute a bash command in a sandboxed environment using Claude's built-in code execution tool."
+)]
+pub struct BashCodeExecution {
+ /// The bash command or instruction to execute.
+ pub input: String,
+}
+
+#[async_trait]
+impl AsyncTool<AnthropicToolContext> for BashCodeExecution {
+ type Output = BashCodeExecutionResponse;
+
+ #[tracing::instrument(skip_all, err)]
+ async fn call(
+ &self,
+ service_context: ServiceContext<AnthropicToolContext>,
+ _request_context: RequestContext,
+ ) -> ToolResult<Self::Output> {
+ let ctx = &*service_context;
+ let blocks = super::invoke_server_tool(
+ &ctx.client,
+ &ctx.model,
+ CODE_EXECUTION_TOOL.clone(),
+ &self.input,
+ )
+ .await?;
+
+ blocks
+ .into_iter()
+ .find_map(|b| match b {
+ ResponseContentKind::BashCodeExecutionToolResult(r) => Some(r),
+ _ => None,
+ })
+ .ok_or_else(|| ToolCallError {
+ internal_error: anyhow::anyhow!("no bash code execution result in response"),
+ description: "No bash code execution result returned".into(),
+ })
+ }
+}
diff --git a/rust/cloud-storage/anthropic/src/toolset/mod.rs b/rust/cloud-storage/anthropic/src/toolset/mod.rs
new file mode 100644
index 0000000000..05d247c8a0
--- /dev/null
+++ b/rust/cloud-storage/anthropic/src/toolset/mod.rs
@@ -0,0 +1,91 @@
+mod bash_code_execution;
+#[cfg(test)]
+mod test;
+mod text_editor_code_execution;
+mod web_fetch;
+mod web_search;
+
+pub use bash_code_execution::BashCodeExecution;
+pub use text_editor_code_execution::TextEditorCodeExecution;
+pub use web_fetch::WebFetch;
+pub use web_search::WebSearch;
+
+use crate::client::Client;
+use crate::types::request::{
+ CreateMessageRequestBody, RequestContent, RequestMessage, Role, ServerTool, SystemPrompt, Tool,
+};
+use crate::types::response::{Content, MessageResponse, ResponseContentKind};
+use ai_toolset::{AsyncToolCollection, ToolCallError};
+use std::sync::Arc;
+
+/// Service context for Anthropic server tools.
+pub struct AnthropicToolContext {
+ /// The Anthropic API client.
+ pub client: Arc<Client>,
+ /// The model to use for server tool invocations.
+ pub model: String,
+}
+
+impl Clone for AnthropicToolContext {
+ fn clone(&self) -> Self {
+ Self {
+ client: self.client.clone(),
+ model: self.model.clone(),
+ }
+ }
+}
+
+impl AnthropicToolContext {
+ /// Create a new context from a client and model name.
+ pub fn new(client: Client, model: String) -> Self {
+ Self {
+ client: Arc::new(client),
+ model,
+ }
+ }
+}
+
+/// Create the Anthropic server tools toolset.
+pub fn anthropic_toolset() -> AsyncToolCollection<AnthropicToolContext> {
+ AsyncToolCollection::new()
+ .add_tool::<WebSearch, AnthropicToolContext>()
+ .add_tool::<WebFetch, AnthropicToolContext>()
+ .add_tool::<BashCodeExecution, AnthropicToolContext>()
+ .add_tool::<TextEditorCodeExecution, AnthropicToolContext>()
+}
+
+pub(crate) async fn invoke_server_tool(
+ client: &Client,
+ model: &str,
+ server_tool: ServerTool,
+ input: &str,
+) -> Result<Vec<ResponseContentKind>, ToolCallError> {
+ let request = CreateMessageRequestBody {
+ model: model.to_string(),
+ messages: vec![RequestMessage {
+ role: Role::User,
+ content: RequestContent::Text(input.to_string()),
+ }],
+ max_tokens: 16000,
+ tools: Some(vec![Tool::Server(server_tool)]),
+ system: Some(SystemPrompt::Text(
+ "Use the provided tool to fulfill the user's request.".into(),
+ )),
+ ..Default::default()
+ };
+
+ let response: MessageResponse =
+ client
+ .chat()
+ .create(request)
+ .await
+ .map_err(|e| ToolCallError {
+ description: format!("Anthropic API error: {e:?}"),
+ internal_error: e.into(),
+ })?;
+
+ match response.content {
+ Some(Content::Array(blocks)) => Ok(blocks),
+ _ => Ok(Vec::new()),
+ }
+}
diff --git a/rust/cloud-storage/anthropic/src/toolset/test.rs b/rust/cloud-storage/anthropic/src/toolset/test.rs
new file mode 100644
index 0000000000..2401c73b3f
--- /dev/null
+++ b/rust/cloud-storage/anthropic/src/toolset/test.rs
@@ -0,0 +1,146 @@
+use crate::types::response::{Content, MessageResponse, ResponseContentKind};
+
+#[test]
+fn deserialize_web_search_response() {
+ // From the Anthropic docs: https://platform.claude.com/docs/en/docs/build-with-claude/tool-use/web-search-tool
+ let json = serde_json::json!({
+ "id": "msg_a930390d3a",
+ "type": "message",
+ "role": "assistant",
+ "model": "claude-sonnet-4-5-20250929",
+ "content": [
+ {
+ "type": "text",
+ "text": "I'll search for when Claude Shannon was born."
+ },
+ {
+ "type": "server_tool_use",
+ "id": "srvtoolu_01WYG3ziw53XMcoyKL4XcZmE",
+ "name": "web_search",
+ "input": {
+ "query": "claude shannon birth date"
+ }
+ },
+ {
+ "type": "web_search_tool_result",
+ "tool_use_id": "srvtoolu_01WYG3ziw53XMcoyKL4XcZmE",
+ "content": [
+ {
+ "type": "web_search_result",
+ "url": "https://en.wikipedia.org/wiki/Claude_Shannon",
+ "title": "Claude Shannon - Wikipedia",
+ "encrypted_content": "EqgfCioIARgB...",
+ "page_age": "April 30, 2025"
+ }
+ ]
+ },
+ {
+ "text": "Based on the search results, ",
+ "type": "text"
+ },
+ {
+ "text": "Claude Shannon was born on April 30, 1916",
+ "type": "text",
+ "citations": [
+ {
+ "type": "web_search_result_location",
+ "url": "https://en.wikipedia.org/wiki/Claude_Shannon",
+ "title": "Claude Shannon - Wikipedia",
+ "encrypted_index": "Eo8BCioIAhgB...",
+ "cited_text": "Claude Elwood Shannon (April 30, 1916 – February 24, 2001)..."
+ }
+ ]
+ }
+ ],
+ "stop_reason": "end_turn",
+ "stop_sequence": null,
+ "usage": {
+ "input_tokens": 6039,
+ "output_tokens": 931,
+ "server_tool_use": {
+ "web_search_requests": 1
+ }
+ }
+ });
+
+ let result = serde_json::from_value::<MessageResponse>(json);
+ match &result {
+ Err(e) => panic!("Failed to deserialize web search response: {e}"),
+ Ok(msg) => {
+ let content = msg.content.as_ref().expect("content");
+ match content {
+ Content::Array(blocks) => {
+ assert!(
+ blocks.len() >= 4,
+ "expected at least 4 content blocks, got {}",
+ blocks.len()
+ );
+ assert!(
+ blocks
+ .iter()
+ .any(|b| matches!(b, ResponseContentKind::WebSearchToolResult(_))),
+ "expected a WebSearchToolResult block"
+ );
+ }
+ _ => panic!("expected Content::Array"),
+ }
+ }
+ }
+}
+
+#[test]
+fn deserialize_web_search_error_response() {
+ // Error case from docs — content is a single object, not an array
+ let json = serde_json::json!({
+ "type": "web_search_tool_result",
+ "tool_use_id": "srvtoolu_a93jad",
+ "content": {
+ "type": "web_search_tool_result_error",
+ "error_code": "max_uses_exceeded"
+ }
+ });
+
+ let result = serde_json::from_value::<ResponseContentKind>(json);
+ match &result {
+ Err(e) => panic!("Failed to deserialize web search error: {e}"),
+ Ok(block) => assert!(matches!(block, ResponseContentKind::WebSearchToolResult(_))),
+ }
+}
+
+#[test]
+fn deserialize_text_without_citations() {
+ // Text block WITHOUT citations field — common in API responses
+ let json = serde_json::json!({
+ "type": "text",
+ "text": "Based on the search results, "
+ });
+
+ let result = serde_json::from_value::<ResponseContentKind>(json);
+ match &result {
+ Err(e) => panic!("Failed to deserialize text without citations: {e}"),
+ Ok(block) => assert!(matches!(block, ResponseContentKind::Text(_))),
+ }
+}
+
+#[test]
+fn deserialize_text_with_citations() {
+ let json = serde_json::json!({
+ "type": "text",
+ "text": "Claude Shannon was born on April 30, 1916",
+ "citations": [
+ {
+ "type": "web_search_result_location",
+ "url": "https://example.com",
+ "title": "Example",
+ "encrypted_index": "abc123",
+ "cited_text": "some text"
+ }
+ ]
+ });
+
+ let result = serde_json::from_value::<ResponseContentKind>(json);
+ match &result {
+ Err(e) => panic!("Failed to deserialize text with citations: {e}"),
+ Ok(block) => assert!(matches!(block, ResponseContentKind::Text(_))),
+ }
+}
diff --git a/rust/cloud-storage/anthropic/src/toolset/text_editor_code_execution.rs b/rust/cloud-storage/anthropic/src/toolset/text_editor_code_execution.rs
new file mode 100644
index 0000000000..65563ce600
--- /dev/null
+++ b/rust/cloud-storage/anthropic/src/toolset/text_editor_code_execution.rs
@@ -0,0 +1,51 @@
+use super::AnthropicToolContext;
+use crate::types::request::CODE_EXECUTION_TOOL;
+use crate::types::response::ResponseContentKind;
+use crate::types::response::code_execution::TextEditorCodeExecutionResponse;
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use async_trait::async_trait;
+use schemars::JsonSchema;
+use serde::Deserialize;
+
+/// Use Claude's built-in text editor in a sandboxed code execution environment.
+#[derive(Deserialize, JsonSchema, Clone)]
+#[schemars(
+ title = "TextEditorCodeExecution",
+ description = "Use a text editor in a sandboxed environment using Claude's built-in code execution tool."
+)]
+pub struct TextEditorCodeExecution {
+ /// The text editing instruction.
+ pub input: String,
+}
+
+#[async_trait]
+impl AsyncTool<AnthropicToolContext> for TextEditorCodeExecution {
+ type Output = TextEditorCodeExecutionResponse;
+
+ #[tracing::instrument(skip_all, err)]
+ async fn call(
+ &self,
+ service_context: ServiceContext<AnthropicToolContext>,
+ _request_context: RequestContext,
+ ) -> ToolResult<Self::Output> {
+ let ctx = &*service_context;
+ let blocks = super::invoke_server_tool(
+ &ctx.client,
+ &ctx.model,
+ CODE_EXECUTION_TOOL.clone(),
+ &self.input,
+ )
+ .await?;
+
+ blocks
+ .into_iter()
+ .find_map(|b| match b {
+ ResponseContentKind::TextEditorCodeExecutionToolResult(r) => Some(r),
+ _ => None,
+ })
+ .ok_or_else(|| ToolCallError {
+ internal_error: anyhow::anyhow!("no text editor code execution result in response"),
+ description: "No text editor code execution result returned".into(),
+ })
+ }
+}
diff --git a/rust/cloud-storage/anthropic/src/toolset/web_fetch.rs b/rust/cloud-storage/anthropic/src/toolset/web_fetch.rs
new file mode 100644
index 0000000000..d223a0e306
--- /dev/null
+++ b/rust/cloud-storage/anthropic/src/toolset/web_fetch.rs
@@ -0,0 +1,47 @@
+use super::AnthropicToolContext;
+use crate::types::request::WEB_FETCH_TOOL;
+use crate::types::response::ResponseContentKind;
+use crate::types::response::web_fetch::WebFetchResponse;
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use async_trait::async_trait;
+use schemars::JsonSchema;
+use serde::Deserialize;
+
+/// Fetch a web page using Claude's built-in web fetch tool.
+#[derive(Deserialize, JsonSchema, Clone)]
+#[schemars(
+ title = "WebFetch",
+ description = "Fetch the contents of a web page using Claude's built-in web fetch tool."
+)]
+pub struct WebFetch {
+ /// The URL to fetch or an instruction describing what to fetch.
+ pub input: String,
+}
+
+#[async_trait]
+impl AsyncTool<AnthropicToolContext> for WebFetch {
+ type Output = WebFetchResponse;
+
+ #[tracing::instrument(skip_all, err)]
+ async fn call(
+ &self,
+ service_context: ServiceContext<AnthropicToolContext>,
+ _request_context: RequestContext,
+ ) -> ToolResult<Self::Output> {
+ let ctx = &*service_context;
+ let blocks =
+ super::invoke_server_tool(&ctx.client, &ctx.model, WEB_FETCH_TOOL.clone(), &self.input)
+ .await?;
+
+ blocks
+ .into_iter()
+ .find_map(|b| match b {
+ ResponseContentKind::WebFetchToolResult(r) => Some(r),
+ _ => None,
+ })
+ .ok_or_else(|| ToolCallError {
+ internal_error: anyhow::anyhow!("no web fetch result in response"),
+ description: "No web fetch result returned".into(),
+ })
+ }
+}
diff --git a/rust/cloud-storage/anthropic/src/toolset/web_search.rs b/rust/cloud-storage/anthropic/src/toolset/web_search.rs
new file mode 100644
index 0000000000..af4fc44800
--- /dev/null
+++ b/rust/cloud-storage/anthropic/src/toolset/web_search.rs
@@ -0,0 +1,51 @@
+use super::AnthropicToolContext;
+use crate::types::request::WEB_SEARCH_TOOL;
+use crate::types::response::ResponseContentKind;
+use crate::types::response::web_search::WebSearchResponse;
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use async_trait::async_trait;
+use schemars::JsonSchema;
+use serde::Deserialize;
+
+/// Search the web using Claude's built-in web search.
+#[derive(Deserialize, JsonSchema, Clone)]
+#[schemars(
+ title = "WebSearch",
+ description = "Search the web for information using Claude's built-in web search tool."
+)]
+pub struct WebSearch {
+ /// The search query or instruction.
+ pub input: String,
+}
+
+#[async_trait]
+impl AsyncTool<AnthropicToolContext> for WebSearch {
+ type Output = WebSearchResponse;
+
+ #[tracing::instrument(skip_all, err)]
+ async fn call(
+ &self,
+ service_context: ServiceContext<AnthropicToolContext>,
+ _request_context: RequestContext,
+ ) -> ToolResult<Self::Output> {
+ let ctx = &*service_context;
+ let blocks = super::invoke_server_tool(
+ &ctx.client,
+ &ctx.model,
+ WEB_SEARCH_TOOL.clone(),
+ &self.input,
+ )
+ .await?;
+
+ blocks
+ .into_iter()
+ .find_map(|b| match b {
+ ResponseContentKind::WebSearchToolResult(r) => Some(r),
+ _ => None,
+ })
+ .ok_or_else(|| ToolCallError {
+ internal_error: anyhow::anyhow!("no web search result in response"),
+ description: "No web search result returned".into(),
+ })
+ }
+}
diff --git a/rust/cloud-storage/anthropic/src/types/response/types.rs b/rust/cloud-storage/anthropic/src/types/response/types.rs
index 7855b78317..306b1b3de2 100644
--- a/rust/cloud-storage/anthropic/src/types/response/types.rs
+++ b/rust/cloud-storage/anthropic/src/types/response/types.rs
@@ -1,4 +1,9 @@
use crate::types::request::Role;
+use crate::types::response::code_execution::{
+ BashCodeExecutionResponse, TextEditorCodeExecutionResponse,
+};
+use crate::types::response::web_fetch::WebFetchResponse;
+use crate::types::response::web_search::WebSearchResponse;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
@@ -8,8 +13,12 @@ pub enum ResponseContentKind {
Thinking(ThinkingResponse),
ToolUse(ToolUse),
ServerToolUse(ServerToolUse),
- // there are many more options that could be implemented here
- // https://docs.claude.com/en/api/messages#responsewebfetchtoolresultblock
+ WebSearchToolResult(WebSearchResponse),
+ WebFetchToolResult(WebFetchResponse),
+ BashCodeExecutionToolResult(BashCodeExecutionResponse),
+ TextEditorCodeExecutionToolResult(TextEditorCodeExecutionResponse),
+ #[serde(other)]
+ Unknown,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
@@ -46,6 +55,7 @@ pub struct RedactedThinking {
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct TextResponse {
+ #[serde(default)]
citations: Vec<serde_json::Value>,
text: String,
}
diff --git a/rust/cloud-storage/anthropic/src/types/response/web_search.rs b/rust/cloud-storage/anthropic/src/types/response/web_search.rs
index 00cabe04c5..d7f46dfb4f 100644
--- a/rust/cloud-storage/anthropic/src/types/response/web_search.rs
+++ b/rust/cloud-storage/anthropic/src/types/response/web_search.rs
@@ -5,17 +5,37 @@ use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct WebSearchResponse {
- /// The search query that was executed
- /// Array of search results
- pub content: Vec<SearchResult>,
+ pub content: WebSearchContent,
pub tool_use_id: String,
}
+/// Content of a web search response — either search results or an error.
+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
+#[serde(untagged)]
+pub enum WebSearchContent {
+ Results(Vec<SearchResult>),
+ Error(WebSearchToolError),
+}
+
/// A single search result from web search
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum SearchResult {
- WebSearchResult { title: String, url: String },
+ WebSearchResult {
+ title: String,
+ url: String,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ encrypted_content: Option<String>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ page_age: Option<String>,
+ },
+}
+
+/// Error returned when web search fails
+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
+pub struct WebSearchToolError {
+ pub r#type: String,
+ pub error_code: String,
}
/// This is the expected shape of the streamed json following a `server_tool_use` in content_block_start event
diff --git a/rust/cloud-storage/call/Cargo.toml b/rust/cloud-storage/call/Cargo.toml
index d559101fe6..f0da5f99ca 100644
--- a/rust/cloud-storage/call/Cargo.toml
+++ b/rust/cloud-storage/call/Cargo.toml
@@ -5,7 +5,7 @@ publish = false
version = "0.1.0"
[features]
-ai_tools = ["dep:ai", "dep:async-trait", "dep:schemars", "ports"]
+ai_tools = ["dep:ai_toolset", "dep:async-trait", "dep:schemars", "ports"]
default = ["ai_tools", "inbound", "outbound", "ports"]
inbound = [
"dep:axum",
@@ -16,7 +16,7 @@ inbound = [
"ports",
]
outbound = [
- "dep:ai",
+ "dep:agent",
"dep:aws-sdk-s3",
"comms/outbound",
"dep:entity_access_db_utils",
@@ -30,7 +30,8 @@ outbound = [
ports = ["dep:entity_access", "dep:tokio"]
[dependencies]
-ai = { path = "../ai", optional = true }
+agent = { path = "../agent", optional = true }
+ai_toolset = { path = "../ai_toolset", optional = true }
anyhow = { workspace = true }
async-trait = { workspace = true, optional = true }
aws-sdk-s3 = { workspace = true, optional = true }
diff --git a/rust/cloud-storage/call/src/inbound/toolset/list_call_records.rs b/rust/cloud-storage/call/src/inbound/toolset/list_call_records.rs
index c72c1b52c7..856a411729 100644
--- a/rust/cloud-storage/call/src/inbound/toolset/list_call_records.rs
+++ b/rust/cloud-storage/call/src/inbound/toolset/list_call_records.rs
@@ -6,7 +6,7 @@ use crate::domain::{
models::GetCallRecordsRequest,
ports::{CallRecordQueryService, CallService},
};
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use entity_access::domain::ports::EntityAccessService;
diff --git a/rust/cloud-storage/call/src/inbound/toolset/mod.rs b/rust/cloud-storage/call/src/inbound/toolset/mod.rs
index 2be2d0b78f..c2506c9fbb 100644
--- a/rust/cloud-storage/call/src/inbound/toolset/mod.rs
+++ b/rust/cloud-storage/call/src/inbound/toolset/mod.rs
@@ -7,7 +7,7 @@ mod read_call_record;
mod test;
use crate::domain::ports::{CallRecordQueryService, CallService};
-use ai::tool::AsyncToolCollection;
+use ai_toolset::AsyncToolCollection;
use entity_access::domain::ports::EntityAccessService;
use std::sync::Arc;
diff --git a/rust/cloud-storage/call/src/inbound/toolset/read_call_record.rs b/rust/cloud-storage/call/src/inbound/toolset/read_call_record.rs
index ecd6ae7688..e09cfbf902 100644
--- a/rust/cloud-storage/call/src/inbound/toolset/read_call_record.rs
+++ b/rust/cloud-storage/call/src/inbound/toolset/read_call_record.rs
@@ -1,7 +1,7 @@
//! ReadCallRecord tool for fetching a single call's transcript.
use crate::domain::ports::{CallRecordQueryService, CallService};
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use entity_access::domain::{
diff --git a/rust/cloud-storage/call/src/inbound/toolset/test.rs b/rust/cloud-storage/call/src/inbound/toolset/test.rs
index ddf0f0c7e9..b92333e883 100644
--- a/rust/cloud-storage/call/src/inbound/toolset/test.rs
+++ b/rust/cloud-storage/call/src/inbound/toolset/test.rs
@@ -1,7 +1,7 @@
use super::list_call_records::ListCallRecords;
use super::read_call_record::ReadCallRecord;
-use ai::generate_tool_input_schema;
-use ai::tool::types::tool_object::validate_tool_schema;
+use ai_toolset::generate_tool_input_schema;
+use ai_toolset::tool_object::validate_tool_schema;
#[test]
fn test_list_call_records_schema_validation() {
diff --git a/rust/cloud-storage/call/src/outbound/ai_call_summarizer.rs b/rust/cloud-storage/call/src/outbound/ai_call_summarizer.rs
index f77a76b8b5..352d9b13c7 100644
--- a/rust/cloud-storage/call/src/outbound/ai_call_summarizer.rs
+++ b/rust/cloud-storage/call/src/outbound/ai_call_summarizer.rs
@@ -1,16 +1,12 @@
//! AI-backed implementation of [`CallSummarizer`](crate::domain::ports::CallSummarizer).
//!
-//! Wraps the [`ai`] crate's `get_chat_completion` entry point to generate a
-//! natural-language summary of a finished call from its finalized transcript.
-//! No external client handle is required — [`ai::chat_completion::get_chat_completion`]
-//! internally constructs its own provider client (see the `memory` crate's
-//! `judge_memory` for the same pattern this mirrors).
+//! Uses [`agent::complete`] to generate a natural-language summary of a
+//! finished call from its finalized transcript.
use std::collections::HashSet;
use std::fmt::Write as _;
-use ai::chat_completion::get_chat_completion;
-use ai::types::{Model, RequestBuilder};
+use agent::AgentModel;
use uuid::Uuid;
use macro_user_id::user_id::MacroUserIdStr;
@@ -21,7 +17,7 @@ use crate::domain::models::{
use crate::domain::ports::CallSummarizer;
/// Default model used when summarizing a call transcript.
-const SUMMARIZATION_MODEL: Model = Model::Claude46Sonnet;
+const SUMMARIZATION_MODEL: AgentModel = AgentModel::Sonnet4_6;
/// System prompt framing the LLM's task: produce a concise, factual call summary.
const SUMMARIZATION_SYSTEM_PROMPT: &str = "\
@@ -122,12 +118,7 @@ const CALL_NAME_SUMMARY_CHAR_CAP: usize = 4_000;
/// output regardless of the system prompt.
const CALL_NAME_MAX_CHARS: usize = 80;
-/// AI-powered [`CallSummarizer`] that delegates to
-/// [`ai::chat_completion::get_chat_completion`].
-///
-/// Stateless on purpose: the underlying `ai` crate builds its provider client
-/// per request, so this adapter does not need to cache one. Construct once at
-/// service startup and share via the [`CallSummarizer`] trait.
+/// AI-powered [`CallSummarizer`] that delegates to [`agent::complete`].
#[derive(Debug, Default, Clone, Copy)]
pub struct AiCallSummarizer;
@@ -149,18 +140,15 @@ impl CallSummarizer for AiCallSummarizer {
) -> Result<Option<String>, Self::Err> {
let user_message = format_transcript_prompt(call_id, &transcript);
- let request = RequestBuilder::new()
- .model(SUMMARIZATION_MODEL)
- .system_prompt(SUMMARIZATION_SYSTEM_PROMPT)
- .user_message(user_message)
- .build();
-
- let raw = get_chat_completion(request)
- .await
- .map_err(|e| anyhow::anyhow!(e))
- .inspect_err(|e| {
- tracing::error!(error = ?e, %call_id, "ai call summarization failed");
- })?;
+ let raw = agent::complete(
+ SUMMARIZATION_MODEL,
+ SUMMARIZATION_SYSTEM_PROMPT,
+ &user_message,
+ )
+ .await
+ .inspect_err(|e| {
+ tracing::error!(error = ?e, %call_id, "ai call summarization failed");
+ })?;
Ok(parse_summary(&raw))
}
@@ -188,15 +176,8 @@ impl CallSummarizer for AiCallSummarizer {
let user_message = format!("Summary:\n\n{summary_for_prompt}");
- let request = RequestBuilder::new()
- .model(SUMMARIZATION_MODEL)
- .system_prompt(CALL_NAME_SYSTEM_PROMPT)
- .user_message(user_message)
- .build();
-
- let raw = get_chat_completion(request)
+ let raw = agent::complete(SUMMARIZATION_MODEL, CALL_NAME_SYSTEM_PROMPT, &user_message)
.await
- .map_err(|e| anyhow::anyhow!(e))
.inspect_err(|e| {
tracing::error!(error = ?e, %call_id, "ai call naming failed");
})?;
@@ -225,18 +206,15 @@ impl CallSummarizer for AiCallSummarizer {
.collect();
let user_message = format_custom_speakers_prompt(&transcript, &candidate_speakers);
- let request = RequestBuilder::new()
- .model(SUMMARIZATION_MODEL)
- .system_prompt(CUSTOM_SPEAKER_SYSTEM_PROMPT)
- .user_message(user_message)
- .build();
-
- let raw = get_chat_completion(request)
- .await
- .map_err(|e| anyhow::anyhow!(e))
- .inspect_err(|e| {
- tracing::error!(error = ?e, "ai custom-speaker generation failed");
- })?;
+ let raw = agent::complete(
+ SUMMARIZATION_MODEL,
+ CUSTOM_SPEAKER_SYSTEM_PROMPT,
+ &user_message,
+ )
+ .await
+ .inspect_err(|e| {
+ tracing::error!(error = ?e, "ai custom-speaker generation failed");
+ })?;
parse_custom_speaker_results(&raw, &transcript_ids, &candidate_user_ids)
}
diff --git a/rust/cloud-storage/channels/Cargo.toml b/rust/cloud-storage/channels/Cargo.toml
index ab5b98e5d0..5e1102e392 100644
--- a/rust/cloud-storage/channels/Cargo.toml
+++ b/rust/cloud-storage/channels/Cargo.toml
@@ -6,7 +6,7 @@ version = "0.1.0"
[features]
ai_tools = [
- "dep:ai",
+ "dep:ai_toolset",
"dep:async-trait",
"dep:entity_access",
"dep:schemars",
@@ -44,7 +44,7 @@ utoipa = { workspace = true, optional = true }
uuid = { workspace = true }
# AI Tool dependencies
-ai = { path = "../ai", optional = true }
+ai_toolset = { path = "../ai_toolset", optional = true }
async-trait = { workspace = true, optional = true }
schemars = { workspace = true, optional = true }
diff --git a/rust/cloud-storage/channels/src/inbound/toolset/mod.rs b/rust/cloud-storage/channels/src/inbound/toolset/mod.rs
index 5aecdca264..dcf2b64a70 100644
--- a/rust/cloud-storage/channels/src/inbound/toolset/mod.rs
+++ b/rust/cloud-storage/channels/src/inbound/toolset/mod.rs
@@ -9,7 +9,7 @@ mod types;
mod test;
use crate::domain::ports::ChannelMessagesService;
-use ai::tool::{AsyncToolCollection, RequestContext, ToolCallError};
+use ai_toolset::{AsyncToolCollection, RequestContext, ToolCallError};
use entity_access::domain::{
models::{AccessError, AccessLevel, EntityType},
ports::EntityAccessService,
diff --git a/rust/cloud-storage/channels/src/inbound/toolset/read_channel_message_context.rs b/rust/cloud-storage/channels/src/inbound/toolset/read_channel_message_context.rs
index 8c40a6cc36..77bb02529f 100644
--- a/rust/cloud-storage/channels/src/inbound/toolset/read_channel_message_context.rs
+++ b/rust/cloud-storage/channels/src/inbound/toolset/read_channel_message_context.rs
@@ -7,7 +7,7 @@ use super::types::{
};
use crate::domain::models::ChannelMessageKind;
use crate::domain::ports::ChannelMessagesService;
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use entity_access::domain::ports::EntityAccessService;
use schemars::JsonSchema;
diff --git a/rust/cloud-storage/channels/src/inbound/toolset/read_channel_messages.rs b/rust/cloud-storage/channels/src/inbound/toolset/read_channel_messages.rs
index 035815ea62..ba213d16ff 100644
--- a/rust/cloud-storage/channels/src/inbound/toolset/read_channel_messages.rs
+++ b/rust/cloud-storage/channels/src/inbound/toolset/read_channel_messages.rs
@@ -7,7 +7,7 @@ use super::types::{
};
use crate::domain::models::{ChannelMessageFilters, MessagePageDirection};
use crate::domain::ports::{ChannelMessagesQueryResult, ChannelMessagesService};
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use entity_access::domain::ports::EntityAccessService;
diff --git a/rust/cloud-storage/channels/src/inbound/toolset/read_channel_thread.rs b/rust/cloud-storage/channels/src/inbound/toolset/read_channel_thread.rs
index e122dd599c..f7ce6afeb2 100644
--- a/rust/cloud-storage/channels/src/inbound/toolset/read_channel_thread.rs
+++ b/rust/cloud-storage/channels/src/inbound/toolset/read_channel_thread.rs
@@ -6,7 +6,7 @@ use super::types::{
clamp_limit, clamp_max_chars, content_truncation_omissions,
};
use crate::domain::ports::ChannelMessagesService;
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use entity_access::domain::ports::EntityAccessService;
diff --git a/rust/cloud-storage/channels/src/inbound/toolset/test.rs b/rust/cloud-storage/channels/src/inbound/toolset/test.rs
index b60ab9ab08..1b3becfab4 100644
--- a/rust/cloud-storage/channels/src/inbound/toolset/test.rs
+++ b/rust/cloud-storage/channels/src/inbound/toolset/test.rs
@@ -1,6 +1,6 @@
use super::{ReadChannelMessageContext, ReadChannelMessages, ReadChannelThread};
-use ai::tool::tool_object::validate_tool_schema;
-use ai::{generate_tool_input_schema, generate_tool_output_schema};
+use ai_toolset::tool_object::validate_tool_schema;
+use ai_toolset::{generate_tool_input_schema, generate_tool_output_schema};
#[test]
fn read_channel_messages_schema_is_valid() {
diff --git a/rust/cloud-storage/chat/Cargo.toml b/rust/cloud-storage/chat/Cargo.toml
index aa010d0a4f..f89239cddc 100644
--- a/rust/cloud-storage/chat/Cargo.toml
+++ b/rust/cloud-storage/chat/Cargo.toml
@@ -23,7 +23,7 @@ ports = []
[dependencies]
# Domain (always included)
-ai = { path = "../ai" }
+agent = { path = "../agent" }
ai_toolset = { path = "../ai_toolset" }
anyhow = { workspace = true }
attachment = { path = "../attachment" }
diff --git a/rust/cloud-storage/chat/src/domain/models/chat.rs b/rust/cloud-storage/chat/src/domain/models/chat.rs
index 45e744fd7c..8c2452334f 100644
--- a/rust/cloud-storage/chat/src/domain/models/chat.rs
+++ b/rust/cloud-storage/chat/src/domain/models/chat.rs
@@ -1,4 +1,4 @@
-use ai::types::Model;
+use agent::AgentModel;
use model::chat::ChatMessageWithAttachments;
use models_permissions::share_permission::access_level::AccessLevel;
use serde::{Deserialize, Serialize};
@@ -59,7 +59,7 @@ pub struct ChatResponse {
/// The messages in the chat.
pub messages: Vec<ChatMessageWithAttachments>,
/// The model used to generate the chat.
- pub model: Option<Model>,
+ pub model: Option<AgentModel>,
/// The time the chat was created.
pub created_at: Option<chrono::DateTime<chrono::Utc>>,
/// The time the chat was last updated.
diff --git a/rust/cloud-storage/chat/src/domain/models/message.rs b/rust/cloud-storage/chat/src/domain/models/message.rs
index 6cfb71d0f1..0d787cb49e 100644
--- a/rust/cloud-storage/chat/src/domain/models/message.rs
+++ b/rust/cloud-storage/chat/src/domain/models/message.rs
@@ -1,4 +1,4 @@
-use ai::types::ChatMessageContent;
+use agent::types::ChatMessageContent;
use attachment::FormattedParts;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
diff --git a/rust/cloud-storage/chat/src/domain/ports/chat.rs b/rust/cloud-storage/chat/src/domain/ports/chat.rs
index db7789850b..fae69d4b5f 100644
--- a/rust/cloud-storage/chat/src/domain/ports/chat.rs
+++ b/rust/cloud-storage/chat/src/domain/ports/chat.rs
@@ -2,7 +2,7 @@ use crate::domain::models::{
ChatResponse, CopyChatArgs, CreateChatArgs, GetChatResponse, PatchChatArgs,
PatchChatMessageArgs, Result,
};
-use ai::types::ChatMessageContent;
+use agent::types::ChatMessageContent;
use ai_toolset::tool_object::UserToolResponse;
use attachment::FormattedParts;
use entity_access::domain::models::{
diff --git a/rust/cloud-storage/chat/src/domain/ports/message.rs b/rust/cloud-storage/chat/src/domain/ports/message.rs
index 9f1ecad364..4eab72d18f 100644
--- a/rust/cloud-storage/chat/src/domain/ports/message.rs
+++ b/rust/cloud-storage/chat/src/domain/ports/message.rs
@@ -1,4 +1,4 @@
-use ai::types::ChatMessageContent;
+use agent::types::ChatMessageContent;
use attachment::FormattedParts;
use macro_user_id::user_id::MacroUserIdStr;
use model::chat::{ChatMessageWithAttachments, NewChatMessage};
diff --git a/rust/cloud-storage/chat/src/domain/service/chat.rs b/rust/cloud-storage/chat/src/domain/service/chat.rs
index e3dede43ea..59f41d4e0f 100644
--- a/rust/cloud-storage/chat/src/domain/service/chat.rs
+++ b/rust/cloud-storage/chat/src/domain/service/chat.rs
@@ -4,7 +4,7 @@ use crate::domain::{
models::{ChatErr, CopyChatArgs, CreateChatArgs, GetChatResponse, PatchChatArgs, Result},
ports::{ChatRepo, ChatService},
};
-use ai::types::{AssistantMessagePart, ChatMessageContent};
+use agent::types::{AssistantMessagePart, ChatMessageContent};
use ai_toolset::{AsyncToolCollection, RequestContext, tool_object::UserToolResponse};
use entity_access::domain::models::{
EditAccessLevel, EntityAccessReceipt, OwnerAccessLevel, ViewAccessLevel,
diff --git a/rust/cloud-storage/chat/src/domain/service/message.rs b/rust/cloud-storage/chat/src/domain/service/message.rs
index c2f8670c0f..dce27234aa 100644
--- a/rust/cloud-storage/chat/src/domain/service/message.rs
+++ b/rust/cloud-storage/chat/src/domain/service/message.rs
@@ -1,6 +1,6 @@
//! Default [`MessageService`] implementation.
-use ai::types::ChatMessageContent;
+use agent::types::ChatMessageContent;
use attachment::{Attachable, AttachmentService, FormattedParts};
use macro_user_id::user_id::MacroUserIdStr;
use model::chat::{AttachmentType, NewChatMessage};
@@ -135,7 +135,7 @@ impl<R: MessageRepo, A: AttachmentService> MessageService for MessageServiceImpl
let messages = self.repo.get_messages(chat_id).await?;
let mut chain = Vec::new();
for msg in &messages {
- if msg.role != ai::types::Role::User || msg.attachments.is_empty() {
+ if msg.role != agent::types::Role::User || msg.attachments.is_empty() {
continue;
}
match self.repo.get_resolved_message(&msg.id).await {
diff --git a/rust/cloud-storage/chat/src/inbound/attachment.rs b/rust/cloud-storage/chat/src/inbound/attachment.rs
index d52d5e915d..8abfca4405 100644
--- a/rust/cloud-storage/chat/src/inbound/attachment.rs
+++ b/rust/cloud-storage/chat/src/inbound/attachment.rs
@@ -97,9 +97,9 @@ fn format_message(msg: &ChatMessageWithAttachments) -> Option<AttachmentPart<'st
return None;
}
let role = match msg.role {
- ai::types::Role::User => "user",
- ai::types::Role::Assistant => "assistant",
- ai::types::Role::System => "system",
+ agent::types::Role::User => "user",
+ agent::types::Role::Assistant => "assistant",
+ agent::types::Role::System => "system",
};
let formatted = XmlTag {
name: "message",
diff --git a/rust/cloud-storage/chat/src/inbound/http/extractors.rs b/rust/cloud-storage/chat/src/inbound/http/extractors.rs
index 9f9d264bda..254e59774a 100644
--- a/rust/cloud-storage/chat/src/inbound/http/extractors.rs
+++ b/rust/cloud-storage/chat/src/inbound/http/extractors.rs
@@ -1,6 +1,6 @@
//! Axum extractors for chat inbound handlers.
-use ai::types::Model;
+use agent::AgentModel;
use axum::extract::FromRequestParts;
use axum::http::StatusCode;
use axum::http::request::Parts;
@@ -14,11 +14,11 @@ use roles_and_permissions::domain::model::PermissionId;
/// The permission hierarchy is: Opus > Sonnet > Haiku. If the user has none
/// of these permissions the extractor rejects with `402 Payment Required`.
#[derive(Debug)]
-pub struct ChatModelAccess(Model);
+pub struct ChatModelAccess(AgentModel);
impl ChatModelAccess {
/// Returns the resolved model.
- pub fn model(&self) -> Model {
+ pub fn model(&self) -> AgentModel {
self.0
}
}
@@ -68,11 +68,11 @@ impl<S: Send + Sync> FromRequestParts<S> for ChatModelAccess {
.ok_or(ChatModelAccessRejection::MissingPermissions)?;
let model = if permissions.contains(&PermissionId::WriteOpus.to_string()) {
- Model::Claude46Opus
+ AgentModel::Opus4_7
} else if permissions.contains(&PermissionId::WriteSonnet.to_string()) {
- Model::Claude46Sonnet
+ AgentModel::Sonnet4_6
} else if permissions.contains(&PermissionId::WriteHaiku.to_string()) {
- Model::Claude45Haiku
+ AgentModel::Haiku4_5
} else {
return Err(ChatModelAccessRejection::NoModelAccess);
};
diff --git a/rust/cloud-storage/chat/src/inbound/toolset/mod.rs b/rust/cloud-storage/chat/src/inbound/toolset/mod.rs
index 4e761e71e7..f3e32c049f 100644
--- a/rust/cloud-storage/chat/src/inbound/toolset/mod.rs
+++ b/rust/cloud-storage/chat/src/inbound/toolset/mod.rs
@@ -6,7 +6,7 @@ mod read_chat;
mod test;
use crate::domain::ports::ChatService;
-use ai::tool::AsyncToolCollection;
+use ai_toolset::AsyncToolCollection;
use entity_access::domain::ports::EntityAccessService;
use read_chat::ReadChat;
use std::sync::Arc;
diff --git a/rust/cloud-storage/chat/src/inbound/toolset/read_chat.rs b/rust/cloud-storage/chat/src/inbound/toolset/read_chat.rs
index 60322dc503..d66da9dbbb 100644
--- a/rust/cloud-storage/chat/src/inbound/toolset/read_chat.rs
+++ b/rust/cloud-storage/chat/src/inbound/toolset/read_chat.rs
@@ -1,7 +1,7 @@
//! ReadChat tool for fetching a chat's message history.
use crate::domain::ports::ChatService;
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use entity_access::domain::{
models::{EntityType, ViewAccessLevel},
diff --git a/rust/cloud-storage/chat/src/inbound/toolset/test.rs b/rust/cloud-storage/chat/src/inbound/toolset/test.rs
index c28936ecf1..18944a8316 100644
--- a/rust/cloud-storage/chat/src/inbound/toolset/test.rs
+++ b/rust/cloud-storage/chat/src/inbound/toolset/test.rs
@@ -1,6 +1,6 @@
use super::read_chat::ReadChat;
-use ai::generate_tool_input_schema;
-use ai::tool::types::tool_object::validate_tool_schema;
+use ai_toolset::generate_tool_input_schema;
+use ai_toolset::tool_object::validate_tool_schema;
#[test]
fn test_read_chat_schema_validation() {
diff --git a/rust/cloud-storage/chat/src/outbound/postgres/mod.rs b/rust/cloud-storage/chat/src/outbound/postgres/mod.rs
index 01e545e89f..e44ee21f93 100644
--- a/rust/cloud-storage/chat/src/outbound/postgres/mod.rs
+++ b/rust/cloud-storage/chat/src/outbound/postgres/mod.rs
@@ -9,7 +9,8 @@ use crate::domain::models::{
Result, WebCitation,
};
use crate::domain::ports::{ChatRepo, MessageRepo};
-use ai::types::{ChatMessageContent, Model};
+use agent::AgentModel;
+use agent::types::ChatMessageContent;
use attachment::FormattedParts;
use macro_user_id::cowlike::CowLike;
use macro_user_id::user_id::MacroUserIdStr;
@@ -20,7 +21,7 @@ use models_permissions::share_permission::access_level::AccessLevel;
use sqlx::PgPool;
/// The default model used when no model is set on a chat.
-const FALLBACK_MODEL: Model = Model::Claude45Haiku;
+const FALLBACK_MODEL: AgentModel = AgentModel::Haiku4_5;
/// Convert an [`anyhow::Error`] to a [`ChatErr`], detecting `sqlx::RowNotFound`.
fn to_chat_err(e: anyhow::Error) -> ChatErr {
@@ -122,7 +123,7 @@ impl ChatRepo for PgChatRepo {
async fn get_chat(&self, chat_id: &str) -> Result<ChatResponse> {
let chat = self.get_metadata(chat_id).await?;
let mut messages = self.get_messages(chat_id).await.map_err(to_chat_err)?;
- messages.retain(|m| m.role != ai::types::Role::System);
+ messages.retain(|m| m.role != agent::types::Role::System);
Ok(ChatResponse {
id: chat.id,
user_id: chat.user_id,
diff --git a/rust/cloud-storage/chat/src/outbound/postgres/queries/create_message.rs b/rust/cloud-storage/chat/src/outbound/postgres/queries/create_message.rs
index 3702f65129..9f6f412e26 100644
--- a/rust/cloud-storage/chat/src/outbound/postgres/queries/create_message.rs
+++ b/rust/cloud-storage/chat/src/outbound/postgres/queries/create_message.rs
@@ -1,6 +1,6 @@
//! Insert a new chat message with optional attachments.
-use ai::types::Role;
+use agent::types::Role;
use model::chat::{AttachmentType, NewChatMessage};
use model_entity::EntityType;
use sqlx::PgPool;
diff --git a/rust/cloud-storage/chat/src/outbound/postgres/queries/get_message_content.rs b/rust/cloud-storage/chat/src/outbound/postgres/queries/get_message_content.rs
index 5a422b1d78..0b3059a097 100644
--- a/rust/cloud-storage/chat/src/outbound/postgres/queries/get_message_content.rs
+++ b/rust/cloud-storage/chat/src/outbound/postgres/queries/get_message_content.rs
@@ -1,6 +1,6 @@
//! Query to fetch a single message's content by ID, scoped to a chat.
-use ai::types::ChatMessageContent;
+use agent::types::ChatMessageContent;
use sqlx::PgPool;
/// Fetch the content of a single message by ID, scoped to the given chat.
diff --git a/rust/cloud-storage/chat/src/outbound/postgres/queries/get_messages.rs b/rust/cloud-storage/chat/src/outbound/postgres/queries/get_messages.rs
index bd0126043f..42ba3526f2 100644
--- a/rust/cloud-storage/chat/src/outbound/postgres/queries/get_messages.rs
+++ b/rust/cloud-storage/chat/src/outbound/postgres/queries/get_messages.rs
@@ -1,6 +1,6 @@
//! Fetch all messages for a chat with their attachments.
-use ai::types::{ChatMessageContent, Role};
+use agent::types::{ChatMessageContent, Role};
use model::chat::ChatMessageWithAttachments;
use model_entity::{Entity, EntityType};
use sqlx::PgPool;
diff --git a/rust/cloud-storage/chat/src/outbound/postgres/queries/update_message_content.rs b/rust/cloud-storage/chat/src/outbound/postgres/queries/update_message_content.rs
index 0c6c1a0e07..5c7ba63d00 100644
--- a/rust/cloud-storage/chat/src/outbound/postgres/queries/update_message_content.rs
+++ b/rust/cloud-storage/chat/src/outbound/postgres/queries/update_message_content.rs
@@ -1,6 +1,6 @@
//! Query to update a chat message's content.
-use ai::types::ChatMessageContent;
+use agent::types::ChatMessageContent;
use sqlx::PgPool;
/// Update the content of a specific message, scoped to the chat.
diff --git a/rust/cloud-storage/document_cognition_service/Cargo.toml b/rust/cloud-storage/document_cognition_service/Cargo.toml
index a202ad5205..67f316c6ad 100644
--- a/rust/cloud-storage/document_cognition_service/Cargo.toml
+++ b/rust/cloud-storage/document_cognition_service/Cargo.toml
@@ -24,8 +24,8 @@ local_queue = []
[dependencies]
+agent = { path = "../agent", features = ["debug-messages"] }
aho-corasick = "1.1.3"
-ai = { path = "../ai" }
attachment = { path = "../attachment", features = ["provider"] }
non_empty = { path = "../non_empty" }
ai_tools = { path = "../ai_tools" }
diff --git a/rust/cloud-storage/document_cognition_service/out.log b/rust/cloud-storage/document_cognition_service/out.log
deleted file mode 100644
index f222a3b65a..0000000000
--- a/rust/cloud-storage/document_cognition_service/out.log
+++ /dev/null
@@ -1,294 +0,0 @@
- 2026-05-14T20:08:56.785327Z  INFO document_cognition_service: initialized config
- at document_cognition_service/src/main.rs:61
-
- 2026-05-14T20:08:56.913991Z  INFO document_cognition_service: initialized db connection, min_connections: 3, max_connections: 10
- at document_cognition_service/src/main.rs:76
-
- 2026-05-14T20:08:57.010698Z  INFO document_cognition_service: initialized dss client
- at document_cognition_service/src/main.rs:105
-
- 2026-05-14T20:08:57.010815Z  INFO document_cognition_service: initialized comms client
- at document_cognition_service/src/main.rs:109
-
- 2026-05-14T20:08:57.010940Z  INFO document_cognition_service: initialized sync service client
- at document_cognition_service/src/main.rs:124
-
- 2026-05-14T20:08:57.011038Z  INFO document_cognition_service: initialized search service client
- at document_cognition_service/src/main.rs:130
-
- 2026-05-14T20:08:57.011663Z  INFO document_cognition_service: initialized static file service client
- at document_cognition_service/src/main.rs:146
-
- 2026-05-14T20:08:57.015804Z  INFO document_cognition_service: initialized stream repo
- at document_cognition_service/src/main.rs:164
-
- 2026-05-14T20:08:57.193061Z  INFO ensure_exists::dynamodb: return: Some(Runtime("connection-gateway-table-dev-f2b369a"))
- at ensure_exists/src/dynamodb.rs:89
- in ensure_exists::dynamodb::check_exists
-
- 2026-05-14T20:08:57.193174Z  INFO connection_gateway::service::connection: creating new connection manager
- at connection_gateway/src/service/connection.rs:81
-
- 2026-05-14T20:08:57.193360Z  INFO document_cognition_service: initialized connection repo
- at document_cognition_service/src/main.rs:171
-
- 2026-05-14T20:08:57.195388Z  INFO document_cognition_service: initialized notification ingress service
- at document_cognition_service/src/main.rs:198
-
- 2026-05-14T20:08:57.195663Z  INFO document_cognition_service: initialized soup service
- at document_cognition_service/src/main.rs:225
-
- 2026-05-14T20:08:57.199383Z  INFO document_cognition_service: initialized document tool context
- at document_cognition_service/src/main.rs:268
-
- 2026-05-14T20:08:57.199600Z  INFO document_cognition_service: initialized attachment provider
- at document_cognition_service/src/main.rs:297
-
- 2026-05-14T20:08:57.199803Z  INFO document_cognition_service: initialized properties tool context
- at document_cognition_service/src/main.rs:316
-
- 2026-05-14T20:08:57.199829Z  INFO document_cognition_service: initialized email tool context
- at document_cognition_service/src/main.rs:331
-
- 2026-05-14T20:08:57.199864Z  INFO document_cognition_service: initialized call tool context
- at document_cognition_service/src/main.rs:349
-
- 2026-05-14T20:08:57.199911Z  INFO document_cognition_service: initialized chat tool context
- at document_cognition_service/src/main.rs:363
-
- 2026-05-14T20:08:57.213968Z  INFO document_cognition_service: initialized memory service
- at document_cognition_service/src/main.rs:392
-
- 2026-05-14T20:08:57.220057Z  INFO document_cognition_service::api: document cognition service is up and running, port: 8085, environment: Local
- at document_cognition_service/src/api/mod.rs:62
- in document_cognition_service::api::setup_and_serve
-
- 2026-05-14T20:10:52.880604Z  INFO document_cognition_service::api::utils::log: metric: TIME-TO-SEND-REQUEST, model_name: claude-opus-4-6, duration_ms: 39
- at document_cognition_service/src/api/utils/log.rs:13
- in document_cognition_service::api::stream::chat_message::send_chat_message with chat_id: Some("f3d025f9-b425-493b-82f4-a60e167fd6b1"), user_id: macro|[email protected], attachment_ids: []
- in macro_middleware::user_permissions::attach_user_permissions::handler with user_id: "macro|[email protected]"
-
- 2026-05-14T20:10:52.884643Z  INFO document_cognition_service::api::stream::chat_message: return: Json(SendChatMessageResponse { stream_id: "280e330a-2692-4340-a416-f258afe5545c", message_id: "280e330a-2692-4340-a416-f258afe5545c", chat_id: "f3d025f9-b425-493b-82f4-a60e167fd6b1" })
- at document_cognition_service/src/api/stream/chat_message.rs:138
- in document_cognition_service::api::stream::chat_message::send_chat_message with chat_id: Some("f3d025f9-b425-493b-82f4-a60e167fd6b1"), user_id: macro|[email protected], attachment_ids: []
- in macro_middleware::user_permissions::attach_user_permissions::handler with user_id: "macro|[email protected]"
-
- 2026-05-14T20:10:53.467875Z  INFO rmcp::service: Service initialized as client, peer_info: Some(InitializeResult { protocol_version: ProtocolVersion("2025-11-25"), capabilities: ServerCapabilities { experimental: None, extensions: None, logging: None, completions: None, prompts: None, resources: None, tools: Some(ToolsCapability { list_changed: Some(true) }), tasks: None }, server_info: Implementation { name: "Linear MCP", title: Some("Linear"), version: "1.0.0", description: None, icons: Some([Icon { src: "https://static.linear.app/integrations/mcp/icon.svg", mime_type: Some("image/svg+xml"), sizes: None, theme: None }]), website_url: Some("https://linear.app") }, instructions: Some("When passing string values to tools, send the content directly without escape sequences. For example, use real newlines in markdown content rather than literal backslash-n (\\n) characters.") })
- at /Users/eric/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-1.6.0/src/service.rs:759
- in rmcp::service::serve_inner
- in mcp_client::domain::models::server::connect
- in mcp_client::domain::service::toolset::new
-
- 2026-05-14T20:10:53.545232Z  INFO ai::tool::tool_loop::chat::agent: tool_loop iteration start, iteration: 0
- at ai/src/tool/tool_loop/chat/agent.rs:141
-
- 2026-05-14T20:10:53.545282Z  INFO ai::tool::tool_loop::chat::agent: make_openai_chat_completion_stream: pre-correction message count, message_count: 16
- at ai/src/tool/tool_loop/chat/agent.rs:550
- in ai::tool::tool_loop::chat::agent::make_openai_chat_completion_stream
-
- 2026-05-14T20:10:53.545350Z  INFO ai::tool::tool_loop::chat::agent: make_openai_chat_completion_stream: post-correction message count, message_count: 16
- at ai/src/tool/tool_loop/chat/agent.rs:555
- in ai::tool::tool_loop::chat::agent::make_openai_chat_completion_stream
-
- 2026-05-14T20:10:55.887805Z  INFO document_cognition_service::api::utils::log: metric: TIME-TO-FIRST-TOKEN, model_name: claude-opus-4-6, duration_ms: 3046
- at document_cognition_service/src/api/utils/log.rs:13
-
- 2026-05-14T20:10:57.672361Z  INFO ai::tool::tool_loop::chat::agent: tool_loop processing stream_parts, iteration: 0, ext_count: 0, part_count: 6, total: 6
- at ai/src/tool/tool_loop/chat/agent.rs:184
-
- 2026-05-14T20:10:57.672441Z  INFO ai::tool::tool_loop::chat::agent: process_stream_parts: tool call summary before execution, pending_part_tool_calls: 0, ext_tool_calls: 0
- at ai/src/tool/tool_loop/chat/agent.rs:314
-
- 2026-05-14T20:10:57.672486Z  INFO ai::tool::tool_loop::chat::agent: process_stream_parts complete, msg_types: ["assistant"], tool_responses: 0
- at ai/src/tool/tool_loop/chat/agent.rs:405
-
- 2026-05-14T20:10:57.672510Z  INFO ai::tool::tool_loop::chat::agent: tool_loop process_stream_parts result, iteration: 0, tool_responses: 0, new_messages: 1
- at ai/src/tool/tool_loop/chat/agent.rs:196
-
- 2026-05-14T20:10:57.672534Z  INFO ai::tool::tool_loop::chat::agent: tool_loop breaking: no tool_responses, iteration: 0
- at ai/src/tool/tool_loop/chat/agent.rs:209
-
- 2026-05-14T20:10:57.681599Z  INFO rmcp::service: task cancelled
- at /Users/eric/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-1.6.0/src/service.rs:845
- in rmcp::service::serve_inner
- in mcp_client::domain::models::server::connect
- in mcp_client::domain::service::toolset::new
-
- 2026-05-14T20:10:57.682620Z  INFO rmcp::service: serve finished, quit_reason: Cancelled
- at /Users/eric/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-1.6.0/src/service.rs:1082
- in rmcp::service::serve_inner
- in mcp_client::domain::models::server::connect
- in mcp_client::domain::service::toolset::new
-
- 2026-05-14T20:11:03.744220Z  INFO document_cognition_service::api::utils::log: metric: TIME-TO-SEND-REQUEST, model_name: claude-opus-4-6, duration_ms: 16
- at document_cognition_service/src/api/utils/log.rs:13
- in document_cognition_service::api::stream::chat_message::send_chat_message with chat_id: Some("f3d025f9-b425-493b-82f4-a60e167fd6b1"), user_id: macro|[email protected], attachment_ids: []
- in macro_middleware::user_permissions::attach_user_permissions::handler with user_id: "macro|[email protected]"
-
- 2026-05-14T20:11:03.747230Z  INFO document_cognition_service::api::stream::chat_message: return: Json(SendChatMessageResponse { stream_id: "32176619-d752-4626-9928-f989cc2e103e", message_id: "32176619-d752-4626-9928-f989cc2e103e", chat_id: "f3d025f9-b425-493b-82f4-a60e167fd6b1" })
- at document_cognition_service/src/api/stream/chat_message.rs:138
- in document_cognition_service::api::stream::chat_message::send_chat_message with chat_id: Some("f3d025f9-b425-493b-82f4-a60e167fd6b1"), user_id: macro|[email protected], attachment_ids: []
- in macro_middleware::user_permissions::attach_user_permissions::handler with user_id: "macro|[email protected]"
-
- 2026-05-14T20:11:04.204545Z  INFO rmcp::service: Service initialized as client, peer_info: Some(InitializeResult { protocol_version: ProtocolVersion("2025-11-25"), capabilities: ServerCapabilities { experimental: None, extensions: None, logging: None, completions: None, prompts: None, resources: None, tools: Some(ToolsCapability { list_changed: Some(true) }), tasks: None }, server_info: Implementation { name: "Linear MCP", title: Some("Linear"), version: "1.0.0", description: None, icons: Some([Icon { src: "https://static.linear.app/integrations/mcp/icon.svg", mime_type: Some("image/svg+xml"), sizes: None, theme: None }]), website_url: Some("https://linear.app") }, instructions: Some("When passing string values to tools, send the content directly without escape sequences. For example, use real newlines in markdown content rather than literal backslash-n (\\n) characters.") })
- at /Users/eric/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-1.6.0/src/service.rs:759
- in rmcp::service::serve_inner
- in mcp_client::domain::models::server::connect
- in mcp_client::domain::service::toolset::new
-
- 2026-05-14T20:11:04.310990Z  INFO ai::tool::tool_loop::chat::agent: tool_loop iteration start, iteration: 0
- at ai/src/tool/tool_loop/chat/agent.rs:141
-
- 2026-05-14T20:11:04.311129Z  INFO ai::tool::tool_loop::chat::agent: make_openai_chat_completion_stream: pre-correction message count, message_count: 18
- at ai/src/tool/tool_loop/chat/agent.rs:550
- in ai::tool::tool_loop::chat::agent::make_openai_chat_completion_stream
-
- 2026-05-14T20:11:04.311295Z  INFO ai::tool::tool_loop::chat::agent: make_openai_chat_completion_stream: post-correction message count, message_count: 18
- at ai/src/tool/tool_loop/chat/agent.rs:555
- in ai::tool::tool_loop::chat::agent::make_openai_chat_completion_stream
-
- 2026-05-14T20:11:06.641693Z  INFO document_cognition_service::api::utils::log: metric: TIME-TO-FIRST-TOKEN, model_name: claude-opus-4-6, duration_ms: 2913
- at document_cognition_service/src/api/utils/log.rs:13
-
- 2026-05-14T20:11:06.649468Z  INFO ai::tool::tool_loop::chat::agent: tool_loop processing stream_parts, iteration: 0, ext_count: 0, part_count: 2, total: 2
- at ai/src/tool/tool_loop/chat/agent.rs:184
-
- 2026-05-14T20:11:06.649585Z  INFO ai::tool::tool_loop::chat::agent: Part: tool_call queued for local execution, id: toolu_01JwXCvb4vpERiLrGFw1pMns, name: mcp__Linear__list_issue_labels
- at ai/src/tool/tool_loop/chat/agent.rs:290
-
- 2026-05-14T20:11:06.649716Z  INFO ai::tool::tool_loop::chat::agent: process_stream_parts: tool call summary before execution, pending_part_tool_calls: 1, ext_tool_calls: 1
- at ai/src/tool/tool_loop/chat/agent.rs:314
-
- 2026-05-14T20:11:08.480268Z  INFO ai::tool::tool_loop::chat::agent: tool execution succeeded, id: toolu_01JwXCvb4vpERiLrGFw1pMns, name: mcp__Linear__list_issue_labels
- at ai/src/tool/tool_loop/chat/agent.rs:342
-
- 2026-05-14T20:11:08.480410Z  INFO ai::tool::tool_loop::chat::agent: process_stream_parts complete, msg_types: ["assistant", "tool"], tool_responses: 1
- at ai/src/tool/tool_loop/chat/agent.rs:405
-
- 2026-05-14T20:11:08.480448Z  INFO ai::tool::tool_loop::chat::agent: tool_loop process_stream_parts result, iteration: 0, tool_responses: 1, new_messages: 2
- at ai/src/tool/tool_loop/chat/agent.rs:196
-
- 2026-05-14T20:11:08.485137Z  INFO ai::tool::tool_loop::chat::agent: tool_loop iteration start, iteration: 1
- at ai/src/tool/tool_loop/chat/agent.rs:141
-
- 2026-05-14T20:11:08.485176Z  INFO ai::tool::tool_loop::chat::agent: make_openai_chat_completion_stream: pre-correction message count, message_count: 20
- at ai/src/tool/tool_loop/chat/agent.rs:550
- in ai::tool::tool_loop::chat::agent::make_openai_chat_completion_stream
-
- 2026-05-14T20:11:08.485254Z  INFO ai::tool::tool_loop::chat::agent: make_openai_chat_completion_stream: post-correction message count, message_count: 20
- at ai/src/tool/tool_loop/chat/agent.rs:555
- in ai::tool::tool_loop::chat::agent::make_openai_chat_completion_stream
-
- 2026-05-14T20:11:11.535928Z  INFO ai::tool::tool_loop::chat::agent: tool_loop processing stream_parts, iteration: 1, ext_count: 0, part_count: 5, total: 5
- at ai/src/tool/tool_loop/chat/agent.rs:184
-
- 2026-05-14T20:11:11.536244Z  INFO ai::tool::tool_loop::chat::agent: process_stream_parts: tool call summary before execution, pending_part_tool_calls: 0, ext_tool_calls: 0
- at ai/src/tool/tool_loop/chat/agent.rs:314
-
- 2026-05-14T20:11:11.536413Z  INFO ai::tool::tool_loop::chat::agent: process_stream_parts complete, msg_types: ["assistant"], tool_responses: 0
- at ai/src/tool/tool_loop/chat/agent.rs:405
-
- 2026-05-14T20:11:11.536524Z  INFO ai::tool::tool_loop::chat::agent: tool_loop process_stream_parts result, iteration: 1, tool_responses: 0, new_messages: 1
- at ai/src/tool/tool_loop/chat/agent.rs:196
-
- 2026-05-14T20:11:11.536607Z  INFO ai::tool::tool_loop::chat::agent: tool_loop breaking: no tool_responses, iteration: 1
- at ai/src/tool/tool_loop/chat/agent.rs:209
-
- 2026-05-14T20:11:11.556560Z  INFO rmcp::service: task cancelled
- at /Users/eric/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-1.6.0/src/service.rs:845
- in rmcp::service::serve_inner
- in mcp_client::domain::models::server::connect
- in mcp_client::domain::service::toolset::new
-
- 2026-05-14T20:11:11.557801Z  INFO rmcp::service: serve finished, quit_reason: Cancelled
- at /Users/eric/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-1.6.0/src/service.rs:1082
- in rmcp::service::serve_inner
- in mcp_client::domain::models::server::connect
- in mcp_client::domain::service::toolset::new
-
- 2026-05-14T20:11:16.687137Z  INFO document_cognition_service::api::utils::log: metric: TIME-TO-SEND-REQUEST, model_name: claude-opus-4-6, duration_ms: 22
- at document_cognition_service/src/api/utils/log.rs:13
- in document_cognition_service::api::stream::chat_message::send_chat_message with chat_id: Some("f3d025f9-b425-493b-82f4-a60e167fd6b1"), user_id: macro|[email protected], attachment_ids: []
- in macro_middleware::user_permissions::attach_user_permissions::handler with user_id: "macro|[email protected]"
-
- 2026-05-14T20:11:16.690201Z  INFO document_cognition_service::api::stream::chat_message: return: Json(SendChatMessageResponse { stream_id: "9d417992-88ab-49b3-82ef-21bb4d464f21", message_id: "9d417992-88ab-49b3-82ef-21bb4d464f21", chat_id: "f3d025f9-b425-493b-82f4-a60e167fd6b1" })
- at document_cognition_service/src/api/stream/chat_message.rs:138
- in document_cognition_service::api::stream::chat_message::send_chat_message with chat_id: Some("f3d025f9-b425-493b-82f4-a60e167fd6b1"), user_id: macro|[email protected], attachment_ids: []
- in macro_middleware::user_permissions::attach_user_permissions::handler with user_id: "macro|[email protected]"
-
- 2026-05-14T20:11:17.034683Z  INFO rmcp::service: Service initialized as client, peer_info: Some(InitializeResult { protocol_version: ProtocolVersion("2025-11-25"), capabilities: ServerCapabilities { experimental: None, extensions: None, logging: None, completions: None, prompts: None, resources: None, tools: Some(ToolsCapability { list_changed: Some(true) }), tasks: None }, server_info: Implementation { name: "Linear MCP", title: Some("Linear"), version: "1.0.0", description: None, icons: Some([Icon { src: "https://static.linear.app/integrations/mcp/icon.svg", mime_type: Some("image/svg+xml"), sizes: None, theme: None }]), website_url: Some("https://linear.app") }, instructions: Some("When passing string values to tools, send the content directly without escape sequences. For example, use real newlines in markdown content rather than literal backslash-n (\\n) characters.") })
- at /Users/eric/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-1.6.0/src/service.rs:759
- in rmcp::service::serve_inner
- in mcp_client::domain::models::server::connect
- in mcp_client::domain::service::toolset::new
-
- 2026-05-14T20:11:17.151405Z  INFO ai::tool::tool_loop::chat::agent: tool_loop iteration start, iteration: 0
- at ai/src/tool/tool_loop/chat/agent.rs:141
-
- 2026-05-14T20:11:17.151532Z  INFO ai::tool::tool_loop::chat::agent: make_openai_chat_completion_stream: pre-correction message count, message_count: 22
- at ai/src/tool/tool_loop/chat/agent.rs:550
- in ai::tool::tool_loop::chat::agent::make_openai_chat_completion_stream
-
- 2026-05-14T20:11:17.151658Z  INFO ai::tool::tool_loop::chat::agent: make_openai_chat_completion_stream: post-correction message count, message_count: 22
- at ai/src/tool/tool_loop/chat/agent.rs:555
- in ai::tool::tool_loop::chat::agent::make_openai_chat_completion_stream
-
- 2026-05-14T20:11:19.541004Z  INFO document_cognition_service::api::utils::log: metric: TIME-TO-FIRST-TOKEN, model_name: claude-opus-4-6, duration_ms: 2876
- at document_cognition_service/src/api/utils/log.rs:13
-
- 2026-05-14T20:11:19.546119Z  INFO ai::tool::tool_loop::chat::agent: tool_loop processing stream_parts, iteration: 0, ext_count: 0, part_count: 2, total: 2
- at ai/src/tool/tool_loop/chat/agent.rs:184
-
- 2026-05-14T20:11:19.546173Z  INFO ai::tool::tool_loop::chat::agent: Part: tool_call queued for local execution, id: toolu_01FDuXRYHQ3v6JG2DbqUrcr9, name: mcp__Linear__list_teams
- at ai/src/tool/tool_loop/chat/agent.rs:290
-
- 2026-05-14T20:11:19.546222Z  INFO ai::tool::tool_loop::chat::agent: process_stream_parts: tool call summary before execution, pending_part_tool_calls: 1, ext_tool_calls: 1
- at ai/src/tool/tool_loop/chat/agent.rs:314
-
- 2026-05-14T20:11:19.765853Z  INFO ai::tool::tool_loop::chat::agent: tool execution succeeded, id: toolu_01FDuXRYHQ3v6JG2DbqUrcr9, name: mcp__Linear__list_teams
- at ai/src/tool/tool_loop/chat/agent.rs:342
-
- 2026-05-14T20:11:19.766113Z  INFO ai::tool::tool_loop::chat::agent: process_stream_parts complete, msg_types: ["assistant", "tool"], tool_responses: 1
- at ai/src/tool/tool_loop/chat/agent.rs:405
-
- 2026-05-14T20:11:19.766149Z  INFO ai::tool::tool_loop::chat::agent: tool_loop process_stream_parts result, iteration: 0, tool_responses: 1, new_messages: 2
- at ai/src/tool/tool_loop/chat/agent.rs:196
-
- 2026-05-14T20:11:19.771725Z  INFO ai::tool::tool_loop::chat::agent: tool_loop iteration start, iteration: 1
- at ai/src/tool/tool_loop/chat/agent.rs:141
-
- 2026-05-14T20:11:19.771850Z  INFO ai::tool::tool_loop::chat::agent: make_openai_chat_completion_stream: pre-correction message count, message_count: 24
- at ai/src/tool/tool_loop/chat/agent.rs:550
- in ai::tool::tool_loop::chat::agent::make_openai_chat_completion_stream
-
- 2026-05-14T20:11:19.772155Z  INFO ai::tool::tool_loop::chat::agent: make_openai_chat_completion_stream: post-correction message count, message_count: 24
- at ai/src/tool/tool_loop/chat/agent.rs:555
- in ai::tool::tool_loop::chat::agent::make_openai_chat_completion_stream
-
- 2026-05-14T20:11:22.660325Z  INFO ai::tool::tool_loop::chat::agent: tool_loop processing stream_parts, iteration: 1, ext_count: 0, part_count: 5, total: 5
- at ai/src/tool/tool_loop/chat/agent.rs:184
-
- 2026-05-14T20:11:22.660514Z  INFO ai::tool::tool_loop::chat::agent: process_stream_parts: tool call summary before execution, pending_part_tool_calls: 0, ext_tool_calls: 0
- at ai/src/tool/tool_loop/chat/agent.rs:314
-
- 2026-05-14T20:11:22.660623Z  INFO ai::tool::tool_loop::chat::agent: process_stream_parts complete, msg_types: ["assistant"], tool_responses: 0
- at ai/src/tool/tool_loop/chat/agent.rs:405
-
- 2026-05-14T20:11:22.660694Z  INFO ai::tool::tool_loop::chat::agent: tool_loop process_stream_parts result, iteration: 1, tool_responses: 0, new_messages: 1
- at ai/src/tool/tool_loop/chat/agent.rs:196
-
- 2026-05-14T20:11:22.660755Z  INFO ai::tool::tool_loop::chat::agent: tool_loop breaking: no tool_responses, iteration: 1
- at ai/src/tool/tool_loop/chat/agent.rs:209
-
- 2026-05-14T20:11:22.677425Z  INFO rmcp::service: task cancelled
- at /Users/eric/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-1.6.0/src/service.rs:845
- in rmcp::service::serve_inner
- in mcp_client::domain::models::server::connect
- in mcp_client::domain::service::toolset::new
-
- 2026-05-14T20:11:22.679083Z  INFO rmcp::service: serve finished, quit_reason: Cancelled
- at /Users/eric/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-1.6.0/src/service.rs:1082
- in rmcp::service::serve_inner
- in mcp_client::domain::models::server::connect
- in mcp_client::domain::service::toolset::new
-
diff --git a/rust/cloud-storage/document_cognition_service/src/api/context/test.rs b/rust/cloud-storage/document_cognition_service/src/api/context/test.rs
index 0b50865af6..92d6838061 100644
--- a/rust/cloud-storage/document_cognition_service/src/api/context/test.rs
+++ b/rust/cloud-storage/document_cognition_service/src/api/context/test.rs
@@ -325,6 +325,7 @@ pub async fn test_api_context(pool: sqlx::Pool<sqlx::Postgres>) -> std::sync::Ar
channel_tool_context: ai_tools::build_channel_tool_context(pool.clone()),
team_tool_context: ai_tools::build_team_tool_context(pool.clone()),
schedule_tool_context: ai_tools::no_op_schedule_context(),
+ anthropic_tool_context: ai_tools::build_anthropic_tool_context_test(),
};
let all_tools = ai_tools::all_tools();
let all_tools_toolset = all_tools.toolset.clone();
diff --git a/rust/cloud-storage/document_cognition_service/src/api/mod.rs b/rust/cloud-storage/document_cognition_service/src/api/mod.rs
index 7b817ad187..0f08bf8822 100644
--- a/rust/cloud-storage/document_cognition_service/src/api/mod.rs
+++ b/rust/cloud-storage/document_cognition_service/src/api/mod.rs
@@ -17,7 +17,6 @@ mod completions;
pub mod context;
mod health;
mod id_mapping;
-mod models;
mod preview;
pub mod stream;
pub(crate) mod swagger;
@@ -104,7 +103,6 @@ fn api_router(api_context: ApiContext) -> Router {
axum::middleware::from_fn(macro_middleware::auth::ensure_user_exists::handler),
)),
)
- .nest("/models", models::router())
.layer(
ServiceBuilder::new()
.layer(axum::middleware::from_fn(
diff --git a/rust/cloud-storage/document_cognition_service/src/api/models/get_models.rs b/rust/cloud-storage/document_cognition_service/src/api/models/get_models.rs
deleted file mode 100644
index fd505a3249..0000000000
--- a/rust/cloud-storage/document_cognition_service/src/api/models/get_models.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-use crate::core::model::CHAT_MODELS;
-use crate::model::response::models::{AIModel, GetModelsResponse};
-use ai::types::ModelWithMetadataAndProvider;
-
-use axum::{Json, http::StatusCode, response::IntoResponse};
-
-/// Gets all available models
-#[utoipa::path(
- get,
- path = "/models",
- responses(
- (status = 200, body=GetModelsResponse),
- )
- )]
-#[tracing::instrument()]
-pub async fn get_models_handler() -> impl IntoResponse {
- let models = CHAT_MODELS
- .iter()
- .map(|m| AIModel {
- name: m.to_string(),
- provider: m.provider(),
- metadata: m.metadata(),
- })
- .collect::<Vec<AIModel>>();
- let data = GetModelsResponse { models };
- (StatusCode::OK, Json(data))
-}
diff --git a/rust/cloud-storage/document_cognition_service/src/api/models/mod.rs b/rust/cloud-storage/document_cognition_service/src/api/models/mod.rs
deleted file mode 100644
index 28bfebc5aa..0000000000
--- a/rust/cloud-storage/document_cognition_service/src/api/models/mod.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-pub mod get_models;
-use axum::{Router, routing::get};
-
-pub fn router() -> Router {
- Router::new().route("/", get(get_models::get_models_handler))
-}
diff --git a/rust/cloud-storage/document_cognition_service/src/api/stream/chat_message.rs b/rust/cloud-storage/document_cognition_service/src/api/stream/chat_message.rs
index e934d2cee2..e3b60b5bf7 100644
--- a/rust/cloud-storage/document_cognition_service/src/api/stream/chat_message.rs
+++ b/rust/cloud-storage/document_cognition_service/src/api/stream/chat_message.rs
@@ -1,5 +1,5 @@
//! HTTP endpoint for sending chat messages with streaming responses.
-use super::util::chat_message::ai_request::build_chat_completion_request;
+use super::util::chat_message::ai_request::build_chat_messages;
use super::util::chat_message::toolset::choose_tools_prompt;
use super::util::chat_message::{store_conversation_messages, store_incoming_message};
use super::util::chat_permissions;
@@ -10,10 +10,9 @@ use crate::model::stream::{ChatStream, JwtPayload, SendChatMessagePayload, Strea
use crate::service::ai_stream_registry::CancellationSubscription;
use crate::service::get_chat::get_chat;
use crate::service::notification::notify;
-use ai::tool::ToolLoop;
-use ai::tool::types::StreamPart;
-use ai::types::{AssistantMessagePart, ChatMessageContent, Model};
-use ai_tools::RequestContext;
+use agent::AgentModel;
+use agent::types::{AssistantMessagePart, ChatMessage, ChatMessageContent};
+use agent::{AgentLoop, StreamPart};
use async_stream::stream;
use attachment::FormattedParts;
use axum::Json;
@@ -74,7 +73,7 @@ pub struct HttpSendChatMessageRequest {
/// Id of the chat the message belongs to (optional - if not provided, a new chat is created)
pub chat_id: Option<String>,
/// The model to respond with
- pub model: Model,
+ pub model: AgentModel,
/// Additional system instructions appended to the base system prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_instructions: Option<String>,
@@ -276,17 +275,10 @@ async fn send_chat_message_inner(
.ok()
.flatten();
- // Build the completion request
+ // Build the chat messages
let tools_prompt = choose_tools_prompt(&payload, ctx.all_tools_prompt);
- let ai_request = build_chat_completion_request(
- &chat,
- &payload,
- tools_prompt,
- user_memory.as_deref(),
- all_resolved_parts,
- )
- .map_err(|err| {
- tracing::error!(error=?err, "failed to build chat completion request");
+ let ai_request = build_chat_messages(&chat, &payload, all_resolved_parts).map_err(|err| {
+ tracing::error!(error=?err, "failed to build chat messages");
ChatMessageError {
error: "Failed to build request".to_string(),
stream_id: Some(stream_id.clone()),
@@ -308,10 +300,26 @@ async fn send_chat_message_inner(
// moved into the spawned stream task and dropped when it finishes.
let cancellation_sub = ctx.ai_stream_registry.register(stream_id.clone()).await;
+ // Build the system prompt for the agent session.
+ let system_prompt = {
+ let additional = payload
+ .additional_instructions
+ .as_deref()
+ .unwrap_or_default();
+ let mut prompt = format!("{}\n{}", tools_prompt, additional);
+ if let Some(memory) = user_memory.as_deref() {
+ prompt.push_str("\n\n<user_memory>\n");
+ prompt.push_str(memory);
+ prompt.push_str("\n</user_memory>");
+ }
+ prompt
+ };
+
// Stream the AI response, save messages when complete
stream_and_save_message(
ctx.clone(),
ai_request,
+ system_prompt,
(*user_id).clone(),
jwt_token,
actual_chat_id.clone(),
@@ -337,7 +345,7 @@ async fn send_chat_message_inner(
async fn create_new_chat(
ctx: &Arc<ApiContext>,
user_id: &Arc<MacroUserIdStr<'static>>,
- model: Model,
+ model: AgentModel,
stream_id: &str,
) -> Result<(crate::model::chats::ChatResponse, String), ChatMessageError> {
let share_permission = SharePermissionV2::new_chat_share_permission();
@@ -433,13 +441,14 @@ fn resolve_pending_tool_calls(parts: Vec<AssistantMessagePart>) -> Vec<Assistant
#[tracing::instrument(skip(ctx, request, user_message_content, cancellation_sub))]
fn stream_and_save_message(
ctx: Arc<ApiContext>,
- request: ai::types::ChatCompletionRequest,
+ request: Vec<ChatMessage>,
+ system_prompt: String,
user_id: MacroUserIdStr<'static>,
jwt_token: String,
chat_id: String,
message_id: String,
stream_id: String,
- model: Model,
+ model: AgentModel,
now: std::time::Instant,
user_message_content: String,
user_message_id: String,
@@ -452,9 +461,6 @@ fn stream_and_save_message(
let static_tools = ctx.all_tools.clone();
let mcp_store = ctx.mcp_state.store();
- let request_context = RequestContext {
- user_id: user_id.clone(),
- };
let ctx_outer = ctx.clone();
// Pull the token out so the select below can reference it without moving
// the whole subscription; the subscription itself is moved into the
@@ -481,29 +487,22 @@ fn stream_and_save_message(
}
let mcp_records = mcp_store.list(&user_id).await.unwrap_or_default();
- let toolset = Arc::new(
+ let toolset: Arc<dyn ai_toolset::ToolSet<_> + Send + Sync> = Arc::new(
mcp_client::domain::service::CombinedToolSet::new(static_tools, &mcp_records).await,
);
- let client = ToolLoop::new(toolset, tool_context);
- let mut chat = client.chat();
+ let agent_loop = AgentLoop::new();
+ let rig_messages = agent::to_rig_messages(&request);
+ let mut session = agent_loop
+ .session(toolset, Arc::new(tool_context), &system_prompt, user_id.clone())
+ .await;
// Create the AI stream - yield error if it fails
- let mut ai_stream = match chat
- .send_message(request, request_context, user_id.as_ref().to_string())
- .await
- {
+ let mut ai_stream = match session.send_message(rig_messages).await {
Ok(stream) => stream,
Err(e) => {
tracing::error!(error=?e, chat_id = %chat_id, user_id = %user_id, stream_id = %stream_id, "failed to create AI stream");
- let stream_error = match e {
- ai::types::AiError::ContextWindowExceeded => {
- StreamError::ModelContextOverflow {
- stream_id: stream_id.clone(),
- }
- }
- ai::types::AiError::Generic(_) => StreamError::InternalError {
- stream_id: stream_id.clone(),
- },
+ let stream_error = StreamError::InternalError {
+ stream_id: stream_id.clone(),
};
if let Ok(json) = serde_json::to_value(ChatStream::Error(stream_error)) {
yield json;
@@ -515,11 +514,6 @@ fn stream_and_save_message(
let mut is_first_token = false;
let idle_timeout = std::time::Duration::from_secs(3 * 60);
let mut was_cancelled = false;
- // Track every AssistantMessagePart we yield so we can persist the
- // exact partial response if the stream is cancelled. The ToolLoop's
- // internal conversation state is only flushed after its inner stream
- // completes, so on cancellation `chat.get_new_conversation_messages()`
- // returns empty — we build the partial message from this buffer instead.
let mut yielded_parts: Vec<AssistantMessagePart> = Vec::new();
loop {
@@ -550,7 +544,6 @@ fn stream_and_save_message(
let Some(response) = next_item else { break; };
tracing::trace!("{:#?}", response);
- // Log time to first token
if !is_first_token {
is_first_token = true;
log::log_timing(log::LatencyMetric::TimeToFirstToken, model, now.elapsed());
@@ -580,15 +573,15 @@ fn stream_and_save_message(
},
},
StreamPart::Usage(usage) => {
- tracing::debug!(record=?usage, "usage");
+ tracing::debug!(?usage, "usage");
continue;
}
- StreamPart::ToolResponse(ai::tool::types::ToolResponse::Json {
+ StreamPart::ToolResponse(agent::ToolResponse::Json {
id,
json,
name,
}) => AssistantMessagePart::ToolCallResponseJson { name, json, id },
- StreamPart::ToolResponse(ai::tool::types::ToolResponse::Err {
+ StreamPart::ToolResponse(agent::ToolResponse::Err {
id,
name,
description,
@@ -614,15 +607,8 @@ fn stream_and_save_message(
}
Err(e) => {
tracing::error!(error=?e, chat_id = %chat_id, user_id = %user_id, stream_id = %stream_id, "error in AI stream");
- let stream_error = match e {
- ai::types::AiError::ContextWindowExceeded => {
- StreamError::ModelContextOverflow {
- stream_id: stream_id.clone(),
- }
- }
- ai::types::AiError::Generic(_) => StreamError::InternalError {
- stream_id: stream_id.clone(),
- },
+ let stream_error = StreamError::InternalError {
+ stream_id: stream_id.clone(),
};
if let Ok(json) = serde_json::to_value(ChatStream::Error(stream_error)) {
yield json;
@@ -632,7 +618,6 @@ fn stream_and_save_message(
}
}
- // Drop the AI stream before accessing chat
drop(ai_stream);
// Send stream end message
@@ -642,43 +627,25 @@ fn stream_and_save_message(
if let Ok(json) = serde_json::to_value(&end_msg) {
yield json;
}
- // Build the set of messages to persist.
- //
- // Natural completion: the ToolLoop has flushed its in-progress stream
- // into its own `self.messages`, so `get_new_conversation_messages`
- // returns the full assistant (+ any tool) messages. Use those.
- //
- // Early termination (cancellation or mid-stream error): the ToolLoop
- // never flushed, so that call returns empty. Build a ChatMessage from
- // the parts we actually yielded — that's exactly what the user saw in
- // the chunks pushed to the durable stream, so the saved message
- // matches the UI deterministically.
+ // Build the set of messages to persist from the parts we yielded.
+ // This matches exactly what the user saw in the streamed chunks.
let new_messages = {
- let flushed = if was_cancelled {
+ let resolved_parts = resolve_pending_tool_calls(yielded_parts);
+ if resolved_parts.is_empty() {
vec![]
} else {
- chat.get_new_conversation_messages()
- };
- if !flushed.is_empty() {
- flushed
- } else {
- let resolved_parts = resolve_pending_tool_calls(yielded_parts);
- if resolved_parts.is_empty() {
- vec![]
- } else {
- vec![ai::types::ChatMessage {
- role: ai::types::Role::Assistant,
- content: ChatMessageContent::AssistantMessageParts(resolved_parts),
- attachments: None,
- }]
- }
+ vec![agent::types::ChatMessage {
+ role: agent::types::Role::Assistant,
+ content: ChatMessageContent::AssistantMessageParts(resolved_parts),
+ attachments: None,
+ }]
}
};
// Extract assistant response text before moving new_messages into store
let assistant_text = new_messages
.iter()
- .find(|m| m.role == ai::types::Role::Assistant)
+ .find(|m| m.role == agent::types::Role::Assistant)
.and_then(|m| m.content.assistant_message_text());
if let Err(err) = store_conversation_messages(
diff --git a/rust/cloud-storage/document_cognition_service/src/api/stream/util/chat_message/ai_request.rs b/rust/cloud-storage/document_cognition_service/src/api/stream/util/chat_message/ai_request.rs
index 5f9aa15fa0..abf2bc4d31 100644
--- a/rust/cloud-storage/document_cognition_service/src/api/stream/util/chat_message/ai_request.rs
+++ b/rust/cloud-storage/document_cognition_service/src/api/stream/util/chat_message/ai_request.rs
@@ -1,68 +1,38 @@
-use crate::{core::constants::DEFAULT_MAX_TOKENS, model::stream::SendChatMessagePayload};
+use crate::model::stream::SendChatMessagePayload;
use crate::model::chats::ChatResponse;
-use ai::types::{ChatCompletionRequest, MessageBuilder, RequestBuilder};
+use agent::types::{ChatMessage, ChatMessageContent, Role};
use anyhow::Result;
use attachment::{AttachmentContent, AttachmentPart, Attachments, FormattedParts, TextOrImage};
use model_entity::EntityType;
use non_empty::NonEmpty;
-#[tracing::instrument(
- skip(chat, incoming_message, static_system_prompt, resolved_parts),
- err
-)]
-pub fn build_chat_completion_request(
+#[tracing::instrument(skip(chat, incoming_message, resolved_parts), err)]
+pub fn build_chat_messages(
chat: &ChatResponse,
incoming_message: &SendChatMessagePayload,
- static_system_prompt: &str,
- user_memory: Option<&str>,
resolved_parts: Vec<FormattedParts>,
-) -> Result<ChatCompletionRequest> {
+) -> Result<Vec<ChatMessage>> {
let attachments = merge_formatted_parts_to_attachments(resolved_parts);
- let mut messages = chat
+ let mut messages: Vec<ChatMessage> = chat
.messages
.iter()
- .map(|message| {
- MessageBuilder::new()
- .content(message.content.clone())
- .role(message.role)
- .build()
+ .map(|message| ChatMessage {
+ role: message.role,
+ content: message.content.clone(),
+ attachments: None,
})
- .collect::<Vec<_>>();
-
- messages.push(
- MessageBuilder::new()
- .user()
- .content(incoming_message.content.clone())
- .build(),
- );
-
- let additional_instructions = incoming_message
- .additional_instructions
- .as_deref()
- .unwrap_or_default();
-
- let mut system_prompt = format!("{}\n{}", static_system_prompt, additional_instructions);
-
- if let Some(memory) = user_memory {
- system_prompt.push_str("\n\n<user_memory>\n");
- system_prompt.push_str(memory);
- system_prompt.push_str("\n</user_memory>");
- }
-
- let mut builder = RequestBuilder::new()
- .model(incoming_message.model)
- .messages(messages)
- .system_prompt(system_prompt)
- .max_tokens(DEFAULT_MAX_TOKENS);
+ .collect();
- if let Some(attachments) = attachments {
- builder = builder.attachments(attachments);
- }
+ messages.push(ChatMessage {
+ role: Role::User,
+ content: ChatMessageContent::Text(incoming_message.content.clone()),
+ attachments,
+ });
- Ok(builder.build())
+ Ok(messages)
}
fn merge_formatted_parts_to_attachments(
diff --git a/rust/cloud-storage/document_cognition_service/src/api/stream/util/chat_message/mod.rs b/rust/cloud-storage/document_cognition_service/src/api/stream/util/chat_message/mod.rs
index 81b4e104c7..422ce7b5df 100644
--- a/rust/cloud-storage/document_cognition_service/src/api/stream/util/chat_message/mod.rs
+++ b/rust/cloud-storage/document_cognition_service/src/api/stream/util/chat_message/mod.rs
@@ -7,9 +7,9 @@ use crate::{
model::stream::SendChatMessagePayload,
};
-use ai::types::Model;
-use ai::types::Role;
-use ai::types::{ChatMessage, ChatMessageContent};
+use agent::AgentModel;
+use agent::types::Role;
+use agent::types::{ChatMessage, ChatMessageContent};
use anyhow::{Context, Result};
use chat::domain::models::ResolvedMessageContent;
use chat::domain::ports::MessageService;
@@ -23,7 +23,7 @@ pub async fn store_incoming_message(
ctx: Arc<ApiContext>,
user_id: &str,
chat: &ChatResponse,
- model: Model,
+ model: AgentModel,
incoming_message: &SendChatMessagePayload,
) -> Result<ResolvedMessageContent> {
let created_at = chrono::Utc::now();
@@ -83,7 +83,7 @@ pub async fn store_conversation_messages(
user_id: &str,
chat_id: &str,
messages: Vec<ChatMessage>,
- model: Model,
+ model: AgentModel,
first_message_id: Option<String>,
) -> Result<Vec<String>> {
if messages.is_empty() {
diff --git a/rust/cloud-storage/document_cognition_service/src/api/structured_completion.rs b/rust/cloud-storage/document_cognition_service/src/api/structured_completion.rs
index e49c4c5d9b..2ffa6de0c8 100644
--- a/rust/cloud-storage/document_cognition_service/src/api/structured_completion.rs
+++ b/rust/cloud-storage/document_cognition_service/src/api/structured_completion.rs
@@ -1,10 +1,8 @@
use crate::api::context::ApiContext;
-use crate::core::constants::DEFAULT_MAX_TOKENS;
use crate::model::stream::ToolSet;
-use ai::structured_output_v2::DynamicSchema;
-use ai::tool::ToolLoop;
-use ai::types::{MessageBuilder, Model, RequestBuilder, Role};
-use ai_tools::RequestContext;
+use agent::structured_output::DynamicSchema;
+use agent::types::{AssistantMessagePart, ChatMessage, ChatMessageContent, Role};
+use agent::{AgentLoop, AgentModel, StreamPart};
use axum::Json;
use axum::extract::{Extension, State};
use axum::http::StatusCode;
@@ -22,7 +20,7 @@ use utoipa::ToSchema;
#[derive(Debug, Serialize, Deserialize, ToSchema)]
pub struct StructuredCompletionRequest {
pub prompt: String,
- pub model: Model,
+ pub model: AgentModel,
pub output_schema: DynamicSchema,
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_instructions: Option<String>,
@@ -92,70 +90,117 @@ pub async fn structured_completion(
None => tools_prompt.to_string(),
};
- let ai_request = RequestBuilder::new()
- .model(request.model)
- .user_message(&request.prompt)
- .system_prompt(system_prompt.clone())
- .max_tokens(DEFAULT_MAX_TOKENS)
- .build();
-
// Phase 1: Run agent loop to gather information
let mcp_store = ctx.mcp_state.store();
let mcp_records = mcp_store.list(&user_id).await.unwrap_or_default();
- let toolset = Arc::new(
+ let toolset: Arc<dyn ai_toolset::ToolSet<_> + Send + Sync> = Arc::new(
mcp_client::domain::service::CombinedToolSet::new(ctx.all_tools.clone(), &mcp_records)
.await,
);
- let client = ToolLoop::new(toolset, ctx.tool_service_context.clone());
- let mut chat = client.chat();
- let request_context = RequestContext {
- user_id: user_id.clone(),
+ let user_message = ChatMessage {
+ role: Role::User,
+ content: ChatMessageContent::Text(request.prompt.clone()),
+ attachments: None,
};
- let mut stream = chat
- .send_message(ai_request, request_context, user_id.as_ref().to_string())
- .await
- .map_err(|e| StructuredCompletionError {
- error: format!("Agent loop failed: {e}"),
- status: StatusCode::INTERNAL_SERVER_ERROR,
- })?;
-
- while let Some(item) = stream.next().await {
- if let Err(e) = item {
- return Err(StructuredCompletionError {
- error: format!("Agent loop error: {e}"),
+ let rig_messages = agent::to_rig_messages(&[user_message]);
+
+ let agent_loop = AgentLoop::new().with_model(request.model);
+ let mut session = agent_loop
+ .session(
+ toolset,
+ Arc::new(ctx.tool_service_context.clone()),
+ &system_prompt,
+ user_id,
+ )
+ .await;
+
+ let mut ai_stream =
+ session
+ .send_message(rig_messages)
+ .await
+ .map_err(|e| StructuredCompletionError {
+ error: format!("Agent loop failed: {e}"),
status: StatusCode::INTERNAL_SERVER_ERROR,
- });
+ })?;
+
+ let mut yielded_parts: Vec<AssistantMessagePart> = Vec::new();
+ while let Some(item) = ai_stream.next().await {
+ match item {
+ Ok(part) => match part {
+ StreamPart::Content(content) if !content.is_empty() => {
+ yielded_parts.push(AssistantMessagePart::Text { text: content });
+ }
+ StreamPart::ToolCall(call) => match call.mcp {
+ Some(mcp) => yielded_parts.push(AssistantMessagePart::McpToolCall {
+ name: mcp.tool_name,
+ service: mcp.service,
+ display_name: mcp.display_name,
+ json: call.json,
+ id: call.id,
+ }),
+ None => yielded_parts.push(AssistantMessagePart::ToolCall {
+ name: call.name,
+ json: call.json,
+ id: call.id,
+ }),
+ },
+ StreamPart::ToolResponse(agent::ToolResponse::Json { id, json, name }) => {
+ yielded_parts.push(AssistantMessagePart::ToolCallResponseJson {
+ name,
+ json,
+ id,
+ });
+ }
+ StreamPart::ToolResponse(agent::ToolResponse::Err {
+ id,
+ name,
+ description,
+ }) => {
+ yielded_parts.push(AssistantMessagePart::ToolCallErr {
+ name,
+ description,
+ id,
+ });
+ }
+ _ => {}
+ },
+ Err(e) => {
+ return Err(StructuredCompletionError {
+ error: format!("Agent loop error: {e}"),
+ status: StatusCode::INTERNAL_SERVER_ERROR,
+ });
+ }
}
}
- drop(stream);
+ drop(ai_stream);
// Phase 2: Structured completion with the gathered context
- let new_messages = chat.get_new_conversation_messages();
-
- let mut all_messages = vec![
- MessageBuilder::new()
- .role(Role::User)
- .content(request.prompt)
- .build(),
+ let conversation: Vec<ChatMessage> = vec![
+ ChatMessage {
+ role: Role::User,
+ content: ChatMessageContent::Text(request.prompt),
+ attachments: None,
+ },
+ ChatMessage {
+ role: Role::Assistant,
+ content: ChatMessageContent::AssistantMessageParts(yielded_parts),
+ attachments: None,
+ },
+ ChatMessage {
+ role: Role::User,
+ content: ChatMessageContent::Text(
+ "Based on the information gathered above, produce a structured response matching the required schema.".to_string(),
+ ),
+ attachments: None,
+ },
];
- all_messages.extend(new_messages);
- all_messages.push(
- MessageBuilder::new()
- .role(Role::User)
- .content("Based on the information gathered above, produce a structured response matching the required schema.")
- .build(),
- );
-
- let structured_request = RequestBuilder::new()
- .model(request.model)
- .messages(all_messages)
- .system_prompt(system_prompt)
- .max_tokens(DEFAULT_MAX_TOKENS)
- .build();
+ let rig_messages = agent::to_rig_messages(&conversation);
- let result = ai::structured_output_v2::dynamic_structured_completion(
- structured_request,
+ let result = agent::structured_output::dynamic_structured_completion(
+ request.model,
+ &system_prompt,
+ rig_messages,
request.output_schema,
)
.await
diff --git a/rust/cloud-storage/document_cognition_service/src/api/swagger.rs b/rust/cloud-storage/document_cognition_service/src/api/swagger.rs
index 1ab40f9d26..2a16cd4cf1 100644
--- a/rust/cloud-storage/document_cognition_service/src/api/swagger.rs
+++ b/rust/cloud-storage/document_cognition_service/src/api/swagger.rs
@@ -2,7 +2,6 @@ use crate::api::{
attachments::get_chats_for_attachment,
chats::{chat_history, chat_history_batch_messages},
citations, health,
- models::get_models,
preview::get_batch_preview,
stream::chat_message::{
self, ChatMessageError, HttpSendChatMessageRequest, SendChatMessageResponse,
@@ -15,11 +14,10 @@ use crate::api::{
},
};
use crate::model::{
- response::{
- attachments::GetChatsForAttachmentResponse, models::AIModel, models::GetModelsResponse,
- },
+ response::attachments::GetChatsForAttachmentResponse,
stream::{ChatStream, SendChatMessagePayload, StreamError, ToolSet},
};
+use agent::AgentModel;
use mcp_client::inbound::axum_router::{
self as mcp_api, AddServerRequest, ServerResponse, StartAuthRequest, StartAuthResponse,
UpdateServerRequest,
@@ -28,8 +26,6 @@ use memory::inbound::axum_router::{self as memory_api, MemoryErrorBody, MemoryRe
use crate::api::preview::get_batch_preview::{GetBatchPreviewRequest, GetBatchPreviewResponse};
-use ai::types::{ModelMetadata, Provider};
-
use chat::domain::models::{ChatResponse, GetChatResponse, WebCitation};
use chat::inbound::http::router::{
self as chat_router, CallToolRequest, CallToolResponse, CreateChatRequest,
@@ -75,7 +71,6 @@ use utoipa::OpenApi;
chat_router::update_tool_response_handler,
chat_router::call_tool_handler,
chat_router::reject_tool_call_handler,
- get_models::get_models_handler,
get_chats_for_attachment::get_chats_for_attachment_handler,
citations::get_citation_handler,
get_batch_preview::handler,
@@ -95,11 +90,7 @@ use utoipa::OpenApi;
components(
schemas(
DocumentCognitionServiceApiVersion,
- // Models
- GetModelsResponse,
- Provider,
- ModelMetadata,
- AIModel,
+ AgentModel,
// Generic
StringIDResponse,
GenericErrorResponse,
@@ -170,7 +161,7 @@ use utoipa::OpenApi;
StructuredCompletionRequest,
StructuredCompletionResponse,
StructuredCompletionError,
- ai::structured_output_v2::DynamicSchema,
+ agent::structured_output::DynamicSchema,
// Memory
MemoryResponse,
@@ -185,8 +176,8 @@ use utoipa::OpenApi;
model_error_response::ErrorResponse,
// Tools
- ai::tool::schema::ToolSchema,
- ai::tool::schema::ToolSchemas,
+ ai_toolset::schema::ToolSchema,
+ ai_toolset::schema::ToolSchemas,
),
),
tags(
diff --git a/rust/cloud-storage/document_cognition_service/src/api/utils/log.rs b/rust/cloud-storage/document_cognition_service/src/api/utils/log.rs
index bb0d7a77ae..a039a204c1 100644
--- a/rust/cloud-storage/document_cognition_service/src/api/utils/log.rs
+++ b/rust/cloud-storage/document_cognition_service/src/api/utils/log.rs
@@ -1,4 +1,4 @@
-use ai::types::Model;
+use agent::AgentModel;
use std::time::Duration;
use strum::{Display, EnumString};
@@ -9,7 +9,7 @@ pub enum LatencyMetric {
TimeToFirstToken,
}
-pub fn log_timing(metric: LatencyMetric, model: Model, duration: Duration) {
+pub fn log_timing(metric: LatencyMetric, model: AgentModel, duration: Duration) {
tracing::info!(
metric = %metric,
model_name = %model,
diff --git a/rust/cloud-storage/document_cognition_service/src/core/constants.rs b/rust/cloud-storage/document_cognition_service/src/core/constants.rs
index db258dff9d..894da4ae7b 100644
--- a/rust/cloud-storage/document_cognition_service/src/core/constants.rs
+++ b/rust/cloud-storage/document_cognition_service/src/core/constants.rs
@@ -1,6 +1,4 @@
pub const DEFAULT_CHAT_NAME: &str = "New Chat";
-/// max tokens the a model can respond with
-pub const DEFAULT_MAX_TOKENS: u32 = 16000;
/// Default batch size for querying documents from rds
pub const DEFAULT_DOCUMENT_BATCH_LIMIT: i64 = 1000;
diff --git a/rust/cloud-storage/document_cognition_service/src/core/model.rs b/rust/cloud-storage/document_cognition_service/src/core/model.rs
index 0e010eeb4c..19e297d0e9 100644
--- a/rust/cloud-storage/document_cognition_service/src/core/model.rs
+++ b/rust/cloud-storage/document_cognition_service/src/core/model.rs
@@ -1,4 +1,4 @@
-use ai::types::Model;
+use agent::AgentModel;
-pub static CHAT_MODELS: &[Model] = &[Model::Claude45Haiku, Model::Claude46Opus];
-pub static FALLBACK_MODEL: Model = Model::Claude45Haiku;
+pub static CHAT_MODELS: &[AgentModel] = &[AgentModel::Smart, AgentModel::Fast];
+pub static FALLBACK_MODEL: AgentModel = AgentModel::Haiku4_5;
diff --git a/rust/cloud-storage/document_cognition_service/src/main.rs b/rust/cloud-storage/document_cognition_service/src/main.rs
index 8254c56484..53e7c019f0 100644
--- a/rust/cloud-storage/document_cognition_service/src/main.rs
+++ b/rust/cloud-storage/document_cognition_service/src/main.rs
@@ -383,6 +383,7 @@ async fn main() -> anyhow::Result<()> {
channel_tool_context: ai_tools::build_channel_tool_context(db.clone()),
team_tool_context: ai_tools::build_team_tool_context(db.clone()),
schedule_tool_context: ai_tools::NoOpScheduleContext,
+ anthropic_tool_context: ai_tools::build_anthropic_tool_context(),
};
let all_tools = ai_tools::all_tools();
let all_tools_toolset = all_tools.toolset.clone();
diff --git a/rust/cloud-storage/document_cognition_service/src/model/chats.rs b/rust/cloud-storage/document_cognition_service/src/model/chats.rs
index 1e941e53bb..81e50e0b89 100644
--- a/rust/cloud-storage/document_cognition_service/src/model/chats.rs
+++ b/rust/cloud-storage/document_cognition_service/src/model/chats.rs
@@ -1,5 +1,5 @@
#![allow(deprecated)]
-use ai::types::Model;
+use agent::AgentModel;
use model::chat::ChatMessageWithAttachments;
use model_entity::Entity;
use serde::{Deserialize, Serialize};
@@ -20,7 +20,7 @@ pub struct ChatResponse {
/// The messages in the chat
pub messages: Vec<ChatMessageWithAttachments>,
/// The model used to generate the chat
- pub model: Option<Model>,
+ pub model: Option<AgentModel>,
/// The time the chat was created
pub created_at: Option<chrono::DateTime<chrono::Utc>>,
/// The time the chat was last updated
@@ -33,7 +33,7 @@ pub struct ChatResponse {
pub token_count: Option<i64>,
/// Available models for the chat
// kill
- pub available_models: Vec<Model>,
+ pub available_models: Vec<AgentModel>,
/// message_id - web citation list
// kill
pub web_citations: Vec<(String, Vec<GetUnfurlResponse>)>,
diff --git a/rust/cloud-storage/document_cognition_service/src/model/response/mod.rs b/rust/cloud-storage/document_cognition_service/src/model/response/mod.rs
index 136534e98c..446f88017a 100644
--- a/rust/cloud-storage/document_cognition_service/src/model/response/mod.rs
+++ b/rust/cloud-storage/document_cognition_service/src/model/response/mod.rs
@@ -1,2 +1 @@
pub mod attachments;
-pub mod models;
diff --git a/rust/cloud-storage/document_cognition_service/src/model/response/models.rs b/rust/cloud-storage/document_cognition_service/src/model/response/models.rs
deleted file mode 100644
index 70d7540122..0000000000
--- a/rust/cloud-storage/document_cognition_service/src/model/response/models.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-use ai::types::{ModelMetadata, Provider};
-use serde::{Deserialize, Serialize};
-use utoipa::ToSchema;
-
-#[derive(Serialize, Deserialize, Debug, ToSchema)]
-pub struct AIModel {
- pub name: String,
- pub provider: Provider,
- pub metadata: ModelMetadata,
-}
-
-#[derive(Serialize, Deserialize, Debug, ToSchema)]
-pub struct GetModelsResponse {
- pub models: Vec<AIModel>,
-}
diff --git a/rust/cloud-storage/document_cognition_service/src/model/stream.rs b/rust/cloud-storage/document_cognition_service/src/model/stream.rs
index dc7fcb0916..9431a5b66e 100644
--- a/rust/cloud-storage/document_cognition_service/src/model/stream.rs
+++ b/rust/cloud-storage/document_cognition_service/src/model/stream.rs
@@ -1,5 +1,5 @@
-use ai::types::AssistantMessagePart;
-use ai::types::Model;
+use agent::AgentModel;
+use agent::types::AssistantMessagePart;
use model_entity::Entity;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
@@ -26,7 +26,7 @@ pub struct SendChatMessagePayload {
/// Id of the chat the message belongs to
pub chat_id: String,
/// the chate model to respond with
- pub model: Model,
+ pub model: AgentModel,
/// Additional system instructions appended to the base system prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_instructions: Option<String>,
@@ -121,8 +121,8 @@ pub enum ChatStream {
/// Notifies the client that the available models have changed
ModelSelectionChanged {
chat_id: String,
- available_models: Vec<Model>,
- new_model: Option<Model>,
+ available_models: Vec<AgentModel>,
+ new_model: Option<AgentModel>,
},
TokenCountChanged {
@@ -174,7 +174,10 @@ pub enum ChatStream {
#[serde(rename_all = "snake_case", tag = "stream_error")]
pub enum StreamError {
#[error("provider error")]
- ProviderError { stream_id: String, model: Model },
+ ProviderError {
+ stream_id: String,
+ model: AgentModel,
+ },
#[error("model context overflow")]
ModelContextOverflow { stream_id: String },
diff --git a/rust/cloud-storage/document_cognition_service/src/models_bin.rs b/rust/cloud-storage/document_cognition_service/src/models_bin.rs
index 86ad384769..fbec6bf0a1 100644
--- a/rust/cloud-storage/document_cognition_service/src/models_bin.rs
+++ b/rust/cloud-storage/document_cognition_service/src/models_bin.rs
@@ -10,18 +10,45 @@ mod service;
pub use config::Config;
use crate::core::model::CHAT_MODELS;
-use crate::model::response::models::{AIModel, GetModelsResponse};
-use ai::types::ModelWithMetadataAndProvider;
+use agent::AgentModel;
+use serde::Serialize;
+
+#[derive(Serialize)]
+#[serde(rename_all = "camelCase")]
+struct ModelSchema {
+ pub name: String,
+ pub provider: &'static str,
+ pub metadata: ModelMetadata,
+}
+
+#[derive(Serialize)]
+#[serde(rename_all = "camelCase")]
+struct ModelMetadata {
+ pub context_window: u64,
+}
+
+#[derive(Serialize)]
+struct ModelsResponse {
+ pub models: Vec<ModelSchema>,
+}
+
+impl From<AgentModel> for ModelSchema {
+ fn from(m: AgentModel) -> Self {
+ Self {
+ name: m.api_id().to_owned(),
+ provider: m.provider(),
+ metadata: ModelMetadata {
+ context_window: m.context_window(),
+ },
+ }
+ }
+}
fn main() {
let models = CHAT_MODELS
.iter()
- .map(|m| AIModel {
- name: m.to_string(),
- provider: m.provider(),
- metadata: m.metadata(),
- })
- .collect::<Vec<AIModel>>();
- let data = GetModelsResponse { models };
+ .map(|m| ModelSchema::from(*m))
+ .collect::<Vec<_>>();
+ let data = ModelsResponse { models };
println!("{}", serde_json::to_string_pretty(&data).unwrap());
}
diff --git a/rust/cloud-storage/document_cognition_service/src/service/get_chat.rs b/rust/cloud-storage/document_cognition_service/src/service/get_chat.rs
index 9370a274a5..51759ad97c 100644
--- a/rust/cloud-storage/document_cognition_service/src/service/get_chat.rs
+++ b/rust/cloud-storage/document_cognition_service/src/service/get_chat.rs
@@ -1,8 +1,7 @@
// biohazard
use crate::api::context::ApiContext;
-use crate::core::model::FALLBACK_MODEL;
+use crate::core::model::{CHAT_MODELS, FALLBACK_MODEL};
use crate::model::chats::ChatResponse;
-use ai::model_selection::ModelSelection;
use anyhow::Context;
use macro_db_client::dcs::get_chat::{get_chat_db, get_messages, get_web_citations};
use unfurl_service::GetUnfurlResponse;
@@ -23,12 +22,6 @@ pub async fn get_chat(
let model = Some(FALLBACK_MODEL);
- // relic of model selection
- let model_selection = ModelSelection {
- available_models: vec![FALLBACK_MODEL],
- new_model: None,
- };
-
let web_citations = get_web_citations(&ctx.db, chat_id)
.await
.unwrap_or_default()
@@ -61,7 +54,7 @@ pub async fn get_chat(
updated_at: chat.updated_at,
attachments: vec![],
token_count: chat.token_count,
- available_models: model_selection.available_models,
+ available_models: CHAT_MODELS.to_vec(),
web_citations,
is_persistent: chat.is_persistent,
})
diff --git a/rust/cloud-storage/document_text_extractor/Cargo.toml b/rust/cloud-storage/document_text_extractor/Cargo.toml
index b9d47e8211..03c4c302f7 100644
--- a/rust/cloud-storage/document_text_extractor/Cargo.toml
+++ b/rust/cloud-storage/document_text_extractor/Cargo.toml
@@ -10,7 +10,7 @@ local-extract = []
macos = []
[dependencies]
-ai = { path = "../ai" }
+agent = { path = "../agent" }
anyhow = { workspace = true }
aws-sdk-s3 = { workspace = true }
macro_aws_config = { path = "../macro_aws_config", features = ["s3"] }
diff --git a/rust/cloud-storage/documents/Cargo.toml b/rust/cloud-storage/documents/Cargo.toml
index 1144f9a592..386a9d12c1 100644
--- a/rust/cloud-storage/documents/Cargo.toml
+++ b/rust/cloud-storage/documents/Cargo.toml
@@ -12,14 +12,14 @@ required-features = ["backfill_binary"]
[features]
attachment = [
"dep:attachment",
- "dep:ai",
+ "dep:ai_toolset",
"dep:lexical_client",
"dep:model_file_type",
"dep:reqwest",
"ports",
]
ai_tools = [
- "dep:ai",
+ "dep:ai_toolset",
"dep:async-trait",
"dep:model_file_type",
"dep:schemars",
@@ -115,7 +115,7 @@ sync_service_client = { path = "../sync_service_client" }
urlencoding = { workspace = true }
# AI Tool dependencies
-ai = { path = "../ai", optional = true }
+ai_toolset = { path = "../ai_toolset", optional = true }
async-trait = { workspace = true, optional = true }
lexical_client = { path = "../lexical_client", optional = true }
model_file_type = { path = "../model_file_type", optional = true }
diff --git a/rust/cloud-storage/documents/examples/documents_toolset.rs b/rust/cloud-storage/documents/examples/documents_toolset.rs
deleted file mode 100644
index 49ef9bc2f2..0000000000
--- a/rust/cloud-storage/documents/examples/documents_toolset.rs
+++ /dev/null
@@ -1,219 +0,0 @@
-#![recursion_limit = "256"]
-//! CLI example for testing documents AI tools interactively.
-//!
-//! This example creates a CLI interface to test the documents toolset with real database connections.
-//!
-//! # Usage
-//!
-//! ```bash
-//! DATABASE_URL=postgres://...
-//! ANTHROPIC_API_KEY=sk_abcdefl...
-//! LOCAL_USER_ID=macro|<email>
-//! SYNC_SERVICE_URL=...
-//! SYNC_SERVICE_AUTH_KEY=...
-//! DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_DISTRIBUTION_URL=...
-//! DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME=THE PRIVATE KEY
-//! DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PUBLIC_KEY_ID=...
-//! DOCUMENT_STORAGE_BUCKET=...
-//! DOCX_DOCUMENT_UPLOAD_BUCKET=...
-//! cargo run --example documents_toolset
-//! ```
-
-use ai::tool::tool_loop::cli::Cli;
-use ai::tool::types::RequestContext;
-use ai::types::Model;
-use connection::domain::ports::ConnectionService;
-use documents::domain::models::CloudFrontConfig;
-use documents::domain::ports::TaskPropertiesPort;
-use documents::domain::service::DocumentServiceImpl;
-use documents::inbound::toolset::{DocumentToolContext, document_toolset};
-use documents::outbound::pg_document_repo::PgDocumentRepo;
-use documents::outbound::s3_upload_url::S3UploadUrlAdapter;
-use entity_access::domain::service::EntityAccessServiceImpl;
-use entity_access::outbound::PgAccessRepository;
-use lexical_client::LexicalClient;
-use macro_user_id::user_id::MacroUserIdStr;
-use sqlx::PgPool;
-use sync_service_client::SyncServiceClient;
-
-/// No-op connection service
-#[derive(Clone)]
-struct NoOpConnectionService;
-
-impl ConnectionService for NoOpConnectionService {
- async fn send_invalidation_event<'a, T: std::fmt::Debug + serde::Serialize + Send>(
- &self,
- _invalidation_event: connection::domain::models::InvalidationEvent<'a, T>,
- ) -> Result<(), connection::domain::models::ConnectionError> {
- Ok(())
- }
-
- async fn send_channel_message<'a>(
- &self,
- _users: &[MacroUserIdStr<'a>],
- _message_type: &str,
- _message: serde_json::Value,
- ) -> Result<(), connection::domain::models::ConnectionError> {
- Ok(())
- }
-}
-
-/// No-op task properties service (not needed for toolset example).
-#[derive(Clone)]
-struct NoOpTaskProperties;
-
-impl TaskPropertiesPort for NoOpTaskProperties {
- async fn attach_task_properties(&self, _entity_ids: Vec<String>) -> anyhow::Result<()> {
- Ok(())
- }
-
- async fn update_task_status(&self, _task_id: &str, _status: &str) -> anyhow::Result<()> {
- Ok(())
- }
-
- async fn set_entity_property(
- &self,
- _user_id: &str,
- _entity_id: &str,
- _property_definition_id: uuid::Uuid,
- _value: Option<models_properties::api::requests::SetPropertyValue>,
- ) -> anyhow::Result<()> {
- Ok(())
- }
-
- async fn copy_task_properties(
- &self,
- _from_task_id: &str,
- _to_task_id: &str,
- ) -> anyhow::Result<()> {
- Ok(())
- }
-}
-
-/// No-op entity access management service (not needed for toolset example).
-#[derive(Clone)]
-struct NoOpEntityAccessManagementService;
-
-impl entity_access_management::domain::ports::EntityAccessManagementService
- for NoOpEntityAccessManagementService
-{
- async fn add_entity_to_project(
- &self,
- _entity_id: &uuid::Uuid,
- _entity_type: model_entity::EntityType,
- _project_id: &uuid::Uuid,
- ) -> Result<(), entity_access_management::domain::models::EntityAccessManagementError> {
- Ok(())
- }
-
- async fn remove_entity_from_project(
- &self,
- _entity_id: &uuid::Uuid,
- _entity_type: model_entity::EntityType,
- _old_project_id: &uuid::Uuid,
- ) -> Result<(), entity_access_management::domain::models::EntityAccessManagementError> {
- Ok(())
- }
-
- async fn move_project(
- &self,
- _project_id: &uuid::Uuid,
- _old_project_id: Option<&uuid::Uuid>,
- _new_project_id: Option<&uuid::Uuid>,
- ) -> Result<(), entity_access_management::domain::models::EntityAccessManagementError> {
- Ok(())
- }
-}
-
-/// The prompt to use in the example.
-const PROMPT: &str = "You are an assistant that helps users explore, create and manage their documents. Use the available tools to create and read documents.";
-
-#[tokio::main]
-async fn main() {
- dotenvy::dotenv().ok();
-
- // Get database URL from environment
- let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
- let usr = std::env::var("LOCAL_USER_ID").expect("LOCAL_USER_ID must bes set");
- let user_id: MacroUserIdStr<'static> = usr.try_into().expect("valid user id macro|<email>");
-
- let sync_service_url = std::env::var("SYNC_SERVICE_URL").expect("SYNC_SERVICE_URL must be set");
- let lexical_service_url =
- std::env::var("LEXICAL_SERVICE_URL").expect("LEXICAL_SERVICE_URL must be set");
- let sync_service_auth_key =
- std::env::var("SYNC_SERVICE_AUTH_KEY").expect("SYNC_SERVICE_AUTH_KEY must be set");
-
- println!(
- "Running with\nuser [{}]\ndatabase [{}]",
- user_id, database_url
- );
-
- // Connect to the database
- let pool = PgPool::connect(&database_url)
- .await
- .expect("Failed to connect to database");
-
- let entity_access_repo = PgAccessRepository::new(pool.clone());
- let entity_access_service = EntityAccessServiceImpl::new(entity_access_repo);
-
- let document_storage_bucket =
- std::env::var("DOCUMENT_STORAGE_BUCKET").expect("DOCUMENT_STORAGE_BUCKET must be set");
- let docx_upload_bucket = std::env::var("DOCX_DOCUMENT_UPLOAD_BUCKET")
- .expect("DOCX_DOCUMENT_UPLOAD_BUCKET must be set");
-
- let s3_client = macro_aws_config::s3_client().await;
- let s3_upload_adapter =
- S3UploadUrlAdapter::new(s3_client, document_storage_bucket, docx_upload_bucket);
-
- let documents_repo = PgDocumentRepo::new(pool.clone());
- let documents_service = DocumentServiceImpl::new(
- documents_repo,
- CloudFrontConfig {
- distribution_url: std::env::var("DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_DISTRIBUTION_URL")
- .expect("DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_DISTRIBUTION_URL must be set"),
- signer_public_key_id: std::env::var(
- "DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PUBLIC_KEY_ID",
- )
- .expect("DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PUBLIC_KEY_ID must be set"),
- signer_private_key: std::env::var(
- "DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME",
- )
- .expect(
- "DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME must be set",
- ),
- presigned_url_expiry_seconds: 840,
- browser_cache_expiry_seconds: 900,
- },
- SyncServiceClient::new(sync_service_auth_key.clone(), sync_service_url.clone()),
- s3_upload_adapter,
- NoOpTaskProperties,
- NoOpConnectionService,
- NoOpEntityAccessManagementService,
- );
-
- let lexical_client = LexicalClient::new(sync_service_auth_key.clone(), lexical_service_url);
-
- let sync_service_client = SyncServiceClient::new(sync_service_auth_key, sync_service_url);
- let document_tool_context = DocumentToolContext::new(
- documents_service,
- entity_access_service,
- lexical_client,
- sync_service_client,
- );
-
- let toolset = document_toolset();
-
- let context = RequestContext { user_id };
-
- // Create the CLI
- let cli = Cli::new(
- toolset,
- document_tool_context,
- PROMPT,
- Model::Claude45Haiku,
- move || context.clone(),
- );
-
- // Run the CLI
- cli.run().await;
-}
diff --git a/rust/cloud-storage/documents/src/inbound/toolset/create_document.rs b/rust/cloud-storage/documents/src/inbound/toolset/create_document.rs
index 55078d1b7d..5be57c28af 100644
--- a/rust/cloud-storage/documents/src/inbound/toolset/create_document.rs
+++ b/rust/cloud-storage/documents/src/inbound/toolset/create_document.rs
@@ -6,7 +6,7 @@ use crate::domain::create::{NewDocumentMetadata, NewPlainTextDocument};
use crate::domain::models::DocumentError;
use crate::domain::ports::DocumentService;
use crate::domain::ports::create::DocumentCreationService;
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use anyhow::Context;
use async_trait::async_trait;
use entity_access::domain::ports::EntityAccessService;
diff --git a/rust/cloud-storage/documents/src/inbound/toolset/mod.rs b/rust/cloud-storage/documents/src/inbound/toolset/mod.rs
index a33dfec3cc..9d90e6f8d7 100644
--- a/rust/cloud-storage/documents/src/inbound/toolset/mod.rs
+++ b/rust/cloud-storage/documents/src/inbound/toolset/mod.rs
@@ -19,7 +19,7 @@ use crate::{
markdown_init::LexicalSyncMarkdownInitializer,
},
};
-use ai::tool::AsyncToolCollection;
+use ai_toolset::AsyncToolCollection;
use entity_access::domain::ports::EntityAccessService;
use lexical_client::LexicalClient;
use std::sync::Arc;
diff --git a/rust/cloud-storage/documents/src/inbound/toolset/read_content.rs b/rust/cloud-storage/documents/src/inbound/toolset/read_content.rs
index 766bf4a13e..b63fd33bc5 100644
--- a/rust/cloud-storage/documents/src/inbound/toolset/read_content.rs
+++ b/rust/cloud-storage/documents/src/inbound/toolset/read_content.rs
@@ -7,7 +7,7 @@ use crate::domain::{
ports::{DocumentService, create::DocumentCreationService},
response::LocationResponseV3,
};
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use entity_access::domain::{
models::{EntityAccessReceipt, EntityType, ViewAccessLevel},
diff --git a/rust/cloud-storage/documents/src/inbound/toolset/read_metadata.rs b/rust/cloud-storage/documents/src/inbound/toolset/read_metadata.rs
index 92eae5568a..f481ecd6ff 100644
--- a/rust/cloud-storage/documents/src/inbound/toolset/read_metadata.rs
+++ b/rust/cloud-storage/documents/src/inbound/toolset/read_metadata.rs
@@ -2,7 +2,7 @@
use crate::domain::ports::{DocumentService, create::DocumentCreationService};
use crate::domain::response::DocumentMetadataWithContent;
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use entity_access::domain::{
models::{AccessLevel, EntityType},
diff --git a/rust/cloud-storage/documents/src/inbound/toolset/test.rs b/rust/cloud-storage/documents/src/inbound/toolset/test.rs
index cd22bc212a..8368902639 100644
--- a/rust/cloud-storage/documents/src/inbound/toolset/test.rs
+++ b/rust/cloud-storage/documents/src/inbound/toolset/test.rs
@@ -1,6 +1,6 @@
use super::*;
-use ai::generate_tool_input_schema;
-use ai::tool::types::tool_object::validate_tool_schema;
+use ai_toolset::generate_tool_input_schema;
+use ai_toolset::tool_object::validate_tool_schema;
#[test]
fn test_read_metadata_schema_validation() {
diff --git a/rust/cloud-storage/email/Cargo.toml b/rust/cloud-storage/email/Cargo.toml
index e28cadaa7e..a50fbea6f3 100644
--- a/rust/cloud-storage/email/Cargo.toml
+++ b/rust/cloud-storage/email/Cargo.toml
@@ -19,7 +19,7 @@ attachment = [
]
ai_schema = ["dep:schemars"]
ai_tools = [
- "dep:ai",
+ "dep:ai_toolset",
"dep:async-trait",
"dep:schemars",
"ports",
@@ -39,7 +39,7 @@ outbound = ["dep:sqlx", "ports"]
ports = ["crm/ports", "dep:tokio", "frecency/ports"]
[dependencies]
-ai = { path = "../ai", optional = true }
+ai_toolset = { path = "../ai_toolset", optional = true }
attachment = { path = "../attachment", optional = true }
anyhow = { workspace = true }
async-trait = { workspace = true, optional = true }
@@ -84,7 +84,3 @@ frecency = { path = "../frecency", features = ["outbound", "postgres"] }
macro_db_migrator = { path = "../macro_db_migrator" }
serde_json = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }
-
-[[example]]
-name = "ai_tools_cli"
-required-features = ["all"]
diff --git a/rust/cloud-storage/email/examples/ai_tools_cli.rs b/rust/cloud-storage/email/examples/ai_tools_cli.rs
deleted file mode 100644
index 6e0994cbf4..0000000000
--- a/rust/cloud-storage/email/examples/ai_tools_cli.rs
+++ /dev/null
@@ -1,111 +0,0 @@
-//! CLI example for testing email AI tools interactively.
-//!
-//! This example creates a CLI interface to test the email toolset with real
-//! database connections and Gmail integration (for UpdateThreadLabels).
-//!
-//! # Usage
-//!
-//! ```bash
-//! DATABASE_URL=postgres://...
-//! ANTHROPIC_API_KEY=sk_abcdefl...
-//! LOCAL_USER_ID=macro|<email>
-//! REDIS_URL=redis://localhost:6379
-//! AUTHENTICATION_SERVICE_URL=http://...
-//! AUTHENTICATION_SERVICE_SECRET_KEY=...
-//! cargo run -p email --example ai_tools_cli --features all
-//! ```
-
-use ai::tool::tool_loop::cli::Cli;
-use ai::tool::types::RequestContext;
-use ai::types::Model;
-use email::domain::service::EmailServiceImpl;
-use email::inbound::toolset::{EmailToolContext, email_toolset};
-use email::outbound::{EmailPgRepo, GmailTokenProviderImpl};
-use frecency::domain::services::FrecencyQueryServiceImpl;
-use frecency::outbound::postgres::FrecencyPgStorage;
-use macro_user_id::user_id::MacroUserIdStr;
-use sqlx::PgPool;
-use std::sync::Arc;
-
-#[tokio::main]
-async fn main() {
- tracing_subscriber::fmt()
- .with_env_filter(
- tracing_subscriber::EnvFilter::try_from_default_env()
- .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("email=debug,ai=debug")),
- )
- .init();
-
- let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
- let usr = std::env::var("LOCAL_USER_ID").expect("LOCAL_USER_ID must be set");
- let user_id: MacroUserIdStr<'static> = usr.try_into().expect("valid user id macro|<email>");
- let redis_url =
- std::env::var("REDIS_URL").unwrap_or_else(|_| "redis://localhost:6379".to_string());
- let auth_service_url = std::env::var("AUTHENTICATION_SERVICE_URL")
- .expect("AUTHENTICATION_SERVICE_URL must be set");
- let auth_service_key = std::env::var("AUTHENTICATION_SERVICE_SECRET_KEY")
- .expect("AUTHENTICATION_SERVICE_SECRET_KEY must be set");
-
- println!(
- "Running with\nuser [{}]\ndatabase [{}]\nredis [{}]\nauth_service [{}]",
- user_id, database_url, redis_url, auth_service_url
- );
-
- let pool = PgPool::connect(&database_url)
- .await
- .expect("Failed to connect to database");
-
- let redis_client = redis::Client::open(redis_url).expect("Failed to create redis client");
- let redis_conn = redis_client
- .get_multiplexed_async_connection()
- .await
- .expect("Failed to connect to redis");
-
- let auth_service_client = Arc::new(authentication_service_client::AuthServiceClient::new(
- auth_service_key,
- auth_service_url,
- ));
-
- let gmail_token_provider =
- Arc::new(GmailTokenProviderImpl::new(redis_conn, auth_service_client));
- let frecency_storage = FrecencyPgStorage::new(pool.clone());
- let frecency_service = FrecencyQueryServiceImpl::new(frecency_storage);
-
- let entity_access_service = Arc::new(
- entity_access::domain::service::EntityAccessServiceImpl::new(
- entity_access::outbound::PgAccessRepository::new(pool.clone()),
- ),
- );
-
- let email_repo = EmailPgRepo::new(pool.clone());
- let crm_service = crm::domain::service::CrmServiceImpl::new(
- crm::outbound::companies_repo::CompaniesRepositoryImpl::new(pool),
- crm::outbound::no_op_resolver::NoOpCompanyMetadataResolver,
- );
- let email_service = EmailServiceImpl::new(
- email_repo,
- frecency_service,
- email::domain::ports::NoOpEnqueuer,
- crm_service,
- 0,
- );
-
- let email_context = EmailToolContext::new(
- Arc::new(email_service),
- gmail_token_provider,
- entity_access_service,
- );
- let toolset = email_toolset();
-
- let context = RequestContext { user_id };
-
- let cli = Cli::new(
- toolset,
- email_context,
- "You are an assistant that helps users manage their email. Use the available tools to list labels, add/remove labels from threads, create drafts, and read email threads.",
- Model::Claude45Haiku,
- move || context.clone(),
- );
-
- cli.run().await;
-}
diff --git a/rust/cloud-storage/email/src/inbound/toolset/get_thread.rs b/rust/cloud-storage/email/src/inbound/toolset/get_thread.rs
index acbba3880f..8d310e82e6 100644
--- a/rust/cloud-storage/email/src/inbound/toolset/get_thread.rs
+++ b/rust/cloud-storage/email/src/inbound/toolset/get_thread.rs
@@ -4,7 +4,7 @@ use crate::domain::{
models::{ContactInfo, ParsedMessage, ParsedThread},
ports::{EmailService, GmailTokenProvider},
};
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use entity_access::domain::{
models::{EntityType, ViewAccessLevel},
diff --git a/rust/cloud-storage/email/src/inbound/toolset/list_labels.rs b/rust/cloud-storage/email/src/inbound/toolset/list_labels.rs
index 14ad65db56..8260f3a5a0 100644
--- a/rust/cloud-storage/email/src/inbound/toolset/list_labels.rs
+++ b/rust/cloud-storage/email/src/inbound/toolset/list_labels.rs
@@ -4,7 +4,7 @@ use crate::domain::{
models::{LabelType, LinkLabel},
ports::{EmailService, GmailTokenProvider},
};
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use entity_access::domain::ports::EntityAccessService;
use macro_user_id::user_id::MacroUserIdStr;
diff --git a/rust/cloud-storage/email/src/inbound/toolset/mod.rs b/rust/cloud-storage/email/src/inbound/toolset/mod.rs
index f8637e2d4b..a7d15acb62 100644
--- a/rust/cloud-storage/email/src/inbound/toolset/mod.rs
+++ b/rust/cloud-storage/email/src/inbound/toolset/mod.rs
@@ -12,7 +12,7 @@ use crate::domain::{
models::Link,
ports::{EmailService, GmailTokenProvider},
};
-use ai::tool::{AsyncToolCollection, ToolCallError};
+use ai_toolset::{AsyncToolCollection, ToolCallError};
use entity_access::domain::ports::EntityAccessService;
use macro_user_id::user_id::MacroUserIdStr;
use std::sync::Arc;
diff --git a/rust/cloud-storage/email/src/inbound/toolset/send_email.rs b/rust/cloud-storage/email/src/inbound/toolset/send_email.rs
index f8fa8dc237..88215b2d57 100644
--- a/rust/cloud-storage/email/src/inbound/toolset/send_email.rs
+++ b/rust/cloud-storage/email/src/inbound/toolset/send_email.rs
@@ -4,7 +4,7 @@ use crate::domain::{
models::{ContactInfo, CreateDraftInput},
ports::{EmailService, GmailTokenProvider},
};
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use entity_access::domain::ports::EntityAccessService;
use macro_user_id::user_id::MacroUserIdStr;
diff --git a/rust/cloud-storage/email/src/inbound/toolset/test.rs b/rust/cloud-storage/email/src/inbound/toolset/test.rs
index 27f52d869e..b089329caa 100644
--- a/rust/cloud-storage/email/src/inbound/toolset/test.rs
+++ b/rust/cloud-storage/email/src/inbound/toolset/test.rs
@@ -1,7 +1,7 @@
use super::list_labels::build_summary;
use super::*;
-use ai::generate_tool_input_schema;
-use ai::tool::types::tool_object::validate_tool_schema;
+use ai_toolset::generate_tool_input_schema;
+use ai_toolset::tool_object::validate_tool_schema;
#[test]
fn test_build_summary_empty() {
diff --git a/rust/cloud-storage/email/src/inbound/toolset/update_thread_labels.rs b/rust/cloud-storage/email/src/inbound/toolset/update_thread_labels.rs
index 4613af90eb..f228952869 100644
--- a/rust/cloud-storage/email/src/inbound/toolset/update_thread_labels.rs
+++ b/rust/cloud-storage/email/src/inbound/toolset/update_thread_labels.rs
@@ -1,7 +1,7 @@
//! UpdateThreadLabels tool for adding or removing a label from all messages in a thread.
use crate::domain::ports::{EmailService, GmailTokenProvider};
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use entity_access::domain::ports::EntityAccessService;
use macro_user_id::user_id::MacroUserIdStr;
diff --git a/rust/cloud-storage/macro_db_client/Cargo.toml b/rust/cloud-storage/macro_db_client/Cargo.toml
index 91bd1c0363..479c7ef240 100644
--- a/rust/cloud-storage/macro_db_client/Cargo.toml
+++ b/rust/cloud-storage/macro_db_client/Cargo.toml
@@ -10,7 +10,7 @@ default = ["account_merge_request", "team"]
team = ["dep:models_team"]
[dependencies]
-ai = { path = "../ai" }
+agent = { path = "../agent" }
anyhow = { workspace = true }
async-recursion = "1.1.1"
async-trait = { workspace = true }
diff --git a/rust/cloud-storage/macro_db_client/src/chat/get.rs b/rust/cloud-storage/macro_db_client/src/chat/get.rs
index 37682279ef..02cc071baf 100644
--- a/rust/cloud-storage/macro_db_client/src/chat/get.rs
+++ b/rust/cloud-storage/macro_db_client/src/chat/get.rs
@@ -1,4 +1,4 @@
-use ai::types::ChatMessageContent;
+use agent::types::ChatMessageContent;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
diff --git a/rust/cloud-storage/macro_db_client/src/dcs/create_chat.rs b/rust/cloud-storage/macro_db_client/src/dcs/create_chat.rs
index f03c5e03de..01ee18a2fd 100644
--- a/rust/cloud-storage/macro_db_client/src/dcs/create_chat.rs
+++ b/rust/cloud-storage/macro_db_client/src/dcs/create_chat.rs
@@ -1,6 +1,6 @@
use super::append_attachment_to_chat::append_attachment_to_chat;
use crate::history::{upsert_item_last_accessed, upsert_user_history};
-use ai::types::Model;
+use agent::AgentModel;
use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
use model::{IDWithTimeStamps, chat::NewChatAttachment};
use model_entity::EntityType;
@@ -15,7 +15,7 @@ pub async fn create_chat_v2(
db: &Pool<Postgres>,
user_id: MacroUserIdStr<'static>,
name: &str,
- model: Model,
+ model: AgentModel,
project_id: Option<&str>,
share_permission: &SharePermissionV2,
attachments: Vec<NewChatAttachment>,
diff --git a/rust/cloud-storage/macro_db_client/src/dcs/create_chat_message.rs b/rust/cloud-storage/macro_db_client/src/dcs/create_chat_message.rs
index bcc86ec33d..a46b281012 100644
--- a/rust/cloud-storage/macro_db_client/src/dcs/create_chat_message.rs
+++ b/rust/cloud-storage/macro_db_client/src/dcs/create_chat_message.rs
@@ -1,4 +1,4 @@
-use ai::types::Role;
+use agent::types::Role;
use anyhow::Context;
use model::chat::{AttachmentType, NewChatMessage};
use model_entity::EntityType;
diff --git a/rust/cloud-storage/macro_db_client/src/dcs/get_chat.rs b/rust/cloud-storage/macro_db_client/src/dcs/get_chat.rs
index 62e4aee0d1..f611d9d991 100644
--- a/rust/cloud-storage/macro_db_client/src/dcs/get_chat.rs
+++ b/rust/cloud-storage/macro_db_client/src/dcs/get_chat.rs
@@ -1,6 +1,6 @@
// biohazard
-use ai::types::ChatMessageContent;
-use ai::types::Role;
+use agent::types::ChatMessageContent;
+use agent::types::Role;
use anyhow::{Error, Result};
use model::chat::{AttachmentType, Chat, ChatAttachment, ChatMessageWithAttachments};
use model_entity::{Entity, EntityType};
diff --git a/rust/cloud-storage/mcp_client/Cargo.toml b/rust/cloud-storage/mcp_client/Cargo.toml
index 533613464a..29641b8073 100644
--- a/rust/cloud-storage/mcp_client/Cargo.toml
+++ b/rust/cloud-storage/mcp_client/Cargo.toml
@@ -10,7 +10,7 @@ providers = ["macro_env_var"]
[dependencies]
aes-gcm = "0.10"
-ai = { path = "../ai" }
+agent = { path = "../agent" }
ai_toolset = { path = "../ai_toolset" }
anyhow.workspace = true
oauth2 = { version = "5.0", default-features = false }
diff --git a/rust/cloud-storage/mcp_client/src/domain/service/toolset.rs b/rust/cloud-storage/mcp_client/src/domain/service/toolset.rs
index 43b9d3334d..0821aabc74 100644
--- a/rust/cloud-storage/mcp_client/src/domain/service/toolset.rs
+++ b/rust/cloud-storage/mcp_client/src/domain/service/toolset.rs
@@ -1,11 +1,9 @@
use crate::domain::models::{Error, McpServer, McpServerRecord};
use crate::domain::ports::McpConnector;
-use ai::openai_toolset::OpenAIToolSetExt;
use ai_toolset::{
AsyncToolCollection, RequestContext, RequestSchema, ToolCallError, ToolInfo, ToolResult,
ToolSet, ToolSetError,
};
-use async_openai::types::chat::{ChatCompletionTool, ChatCompletionTools, FunctionObject};
use rmcp::RoleClient;
use rmcp::model::{CallToolRequestParams, CallToolResult, Tool};
use rmcp::service::Peer;
@@ -223,26 +221,6 @@ impl<Context: Send + Sync + 'static> ToolSet<Context> for McpToolSet {
}
}
-impl OpenAIToolSetExt for McpToolSet {
- fn openai_chatcompletion_toolset(&self) -> Vec<ChatCompletionTools> {
- self.tools
- .iter()
- .map(|(mangled, entry)| {
- ChatCompletionTools::Function(ChatCompletionTool {
- function: FunctionObject {
- name: mangled.as_str().to_string(),
- description: entry.tool.description.as_ref().map(|d| d.to_string()),
- parameters: Some(
- serde_json::to_value(&*entry.tool.input_schema).unwrap_or_default(),
- ),
- strict: Some(false),
- },
- })
- })
- .collect()
- }
-}
-
/// Wraps a static [`AsyncToolCollection`] and an optional [`McpToolSet`],
/// presenting them as a single toolset to the AI loop.
pub struct CombinedToolSet<T> {
@@ -303,11 +281,3 @@ impl<T: Send + Sync + 'static> ToolSet<T> for CombinedToolSet<T> {
}
}
}
-
-impl<T: Send + Sync + 'static> OpenAIToolSetExt for CombinedToolSet<T> {
- fn openai_chatcompletion_toolset(&self) -> Vec<ChatCompletionTools> {
- let mut tools = self.static_tools.openai_chatcompletion_toolset();
- tools.extend(self.mcp_tools.openai_chatcompletion_toolset());
- tools
- }
-}
diff --git a/rust/cloud-storage/mcp_client/src/outbound/pg_server_repo.rs b/rust/cloud-storage/mcp_client/src/outbound/pg_server_repo.rs
index 02dae4356f..6136f5268a 100644
--- a/rust/cloud-storage/mcp_client/src/outbound/pg_server_repo.rs
+++ b/rust/cloud-storage/mcp_client/src/outbound/pg_server_repo.rs
@@ -3,7 +3,7 @@ use crate::domain::{
ports::McpServerStore,
};
use aes_gcm::{
- Aes256Gcm, Key, Nonce,
+ Aes256Gcm,
aead::{Aead, AeadCore, KeyInit, OsRng},
};
use macro_user_id::cowlike::CowLike;
@@ -31,7 +31,7 @@ impl PgServerRepo {
fn encrypt(&self, creds: &StoredCredentials) -> Result<Vec<u8>, sqlx::Error> {
let plaintext =
serde_json::to_vec(creds).map_err(|e| sqlx::Error::Protocol(e.to_string()))?;
- let cipher = Aes256Gcm::new(Key::<Aes256Gcm>::from_slice(self.encryption_key.as_bytes()));
+ let cipher = Aes256Gcm::new(self.encryption_key.as_bytes().into());
let nonce = Aes256Gcm::generate_nonce(&mut OsRng);
let ciphertext = cipher
.encrypt(&nonce, plaintext.as_ref())
@@ -50,9 +50,11 @@ impl PgServerRepo {
));
}
let (nonce_bytes, ciphertext) = data.split_at(NONCE_LEN);
- let nonce = Nonce::from_slice(nonce_bytes);
- let cipher = Aes256Gcm::new(Key::<Aes256Gcm>::from_slice(self.encryption_key.as_bytes()));
- let plaintext = cipher.decrypt(nonce, ciphertext).map_err(|e| {
+ let nonce: &[u8; NONCE_LEN] = nonce_bytes
+ .try_into()
+ .map_err(|_| sqlx::Error::Decode("invalid nonce length".into()))?;
+ let cipher = Aes256Gcm::new(self.encryption_key.as_bytes().into());
+ let plaintext = cipher.decrypt(nonce.into(), ciphertext).map_err(|e| {
sqlx::Error::Decode(format!("credential decryption failed: {e}").into())
})?;
serde_json::from_slice(&plaintext).map_err(|e| sqlx::Error::Decode(Box::new(e)))
diff --git a/rust/cloud-storage/mcp_service/src/context.rs b/rust/cloud-storage/mcp_service/src/context.rs
index ba55d0c417..fd225005ea 100644
--- a/rust/cloud-storage/mcp_service/src/context.rs
+++ b/rust/cloud-storage/mcp_service/src/context.rs
@@ -324,6 +324,7 @@ async fn build_tool_context(
channel_tool_context: ai_tools::build_channel_tool_context(db.clone()),
team_tool_context: ai_tools::build_team_tool_context(db.clone()),
schedule_tool_context: NoOpScheduleContext,
+ anthropic_tool_context: ai_tools::build_anthropic_tool_context(),
};
tracing::info!("initialized tool context");
diff --git a/rust/cloud-storage/memory/Cargo.toml b/rust/cloud-storage/memory/Cargo.toml
index bc17d99019..da92058f74 100644
--- a/rust/cloud-storage/memory/Cargo.toml
+++ b/rust/cloud-storage/memory/Cargo.toml
@@ -6,7 +6,7 @@ version = "0.1.0"
[dependencies]
-ai = { path = "../ai" }
+agent = { path = "../agent" }
ai_tools = { path = "../ai_tools" }
ai_toolset = { path = "../ai_toolset" }
anyhow = { workspace = true }
diff --git a/rust/cloud-storage/memory/src/context.rs b/rust/cloud-storage/memory/src/context.rs
index 2032827558..1a7e218e5f 100644
--- a/rust/cloud-storage/memory/src/context.rs
+++ b/rust/cloud-storage/memory/src/context.rs
@@ -220,5 +220,6 @@ pub async fn build_tool_service_context(
channel_tool_context: ai_tools::build_channel_tool_context(pool.clone()),
team_tool_context: ai_tools::build_team_tool_context(pool.clone()),
schedule_tool_context: ai_tools::NoOpScheduleContext,
+ anthropic_tool_context: ai_tools::build_anthropic_tool_context(),
})
}
diff --git a/rust/cloud-storage/memory/src/domain/ports.rs b/rust/cloud-storage/memory/src/domain/ports.rs
index df34f860d7..45f87ef05d 100644
--- a/rust/cloud-storage/memory/src/domain/ports.rs
+++ b/rust/cloud-storage/memory/src/domain/ports.rs
@@ -1,4 +1,4 @@
-use ai::types::AiError;
+use agent::AgentError;
use chrono::{DateTime, Utc};
use macro_user_id::user_id::MacroUserIdStr;
use macro_uuid::Uuid;
@@ -7,7 +7,7 @@ use thiserror::Error;
#[derive(Debug, Error)]
pub enum MemoryError {
#[error(transparent)]
- AiError(#[from] AiError),
+ AgentError(#[from] AgentError),
#[error("Nothing was generated")]
NoGeneration,
#[error("memory rejected by judge: {0}")]
diff --git a/rust/cloud-storage/memory/src/domain/service.rs b/rust/cloud-storage/memory/src/domain/service.rs
index c920ff062a..e0ce9717ac 100644
--- a/rust/cloud-storage/memory/src/domain/service.rs
+++ b/rust/cloud-storage/memory/src/domain/service.rs
@@ -1,16 +1,15 @@
use super::ports::*;
-use ai::chat_completion::get_chat_completion;
-use ai::tool::tool_loop::ai_client::ToolLoop;
-use ai::types::*;
+use agent::types::{ChatMessage, ChatMessageContent, Role};
+use agent::{AgentLoop, AgentModel, StreamPart};
use ai_tools::{ToolServiceContext, ToolSetWithPrompt};
-use ai_toolset::RequestContext;
use chrono::Utc;
use futures::stream::StreamExt;
use macro_env::Environment;
use serde::Deserialize;
+use std::sync::Arc;
-static GENERATION_MODEL: Model = Model::Claude46Opus;
-static JUDGE_MODEL: Model = Model::Claude46Sonnet;
+static GENERATION_MODEL: AgentModel = AgentModel::Smart;
+static JUDGE_MODEL: AgentModel = AgentModel::Sonnet4_6;
static GENERATE_MEMORY_PROMPT: &str = "\
Use tool calls to research who I am, what I care about, what I'm working on, \
@@ -141,7 +140,7 @@ where
&self,
user: macro_user_id::user_id::MacroUserIdStr<'static>,
) -> super::Result<Memory> {
- // append user data + datetimeto prompt
+ // append user data + datetime to prompt
let system_prompt = format!(
"{}\n<user_id>{:?}</user_id>\n<datetime>{}</datetime>",
self.tools.prompt,
@@ -149,40 +148,41 @@ where
Utc::now().to_rfc2822()
);
- let request = RequestBuilder::new()
- .model(GENERATION_MODEL)
- .system_prompt(system_prompt)
- .user_message(GENERATE_MEMORY_PROMPT)
- .build();
-
- let mut agent = ToolLoop::new(self.tools.toolset.clone(), self.tool_context.clone()).chat();
-
- let request_context = RequestContext {
- user_id: user.clone(),
+ let agent_loop = AgentLoop::new().with_model(GENERATION_MODEL);
+ let toolset: Arc<dyn ai_toolset::ToolSet<_> + Send + Sync> =
+ self.tools.toolset.clone() as _;
+ let mut session = agent_loop
+ .session(
+ toolset,
+ Arc::new(self.tool_context.clone()),
+ &system_prompt,
+ user.clone(),
+ )
+ .await;
+
+ let user_msg = ChatMessage {
+ content: ChatMessageContent::Text(GENERATE_MEMORY_PROMPT.to_string()),
+ role: Role::User,
+ attachments: None,
};
+ let rig_messages = agent::to_rig_messages(&[user_msg]);
+ let mut content = String::new();
{
- let mut stream = agent
- .send_message(request, request_context, user.clone().into())
- .await?;
+ let mut stream = session.send_message(rig_messages).await?;
while let Some(next) = stream.next().await {
- next?;
+ let part = next?;
+ if let StreamPart::Content(text) = part {
+ content.push_str(&text);
+ }
}
}
- let messages = agent.get_new_conversation_messages();
-
- let Some(memory) = messages.last().and_then(|message| {
- let text = message.content.message_text();
- if text.trim().is_empty() {
- None
- } else {
- Some(text)
- }
- }) else {
+ let memory = content.trim().to_string();
+ if memory.is_empty() {
return Err(MemoryError::NoGeneration);
- };
+ }
// 2nd pass: judge the memory quality
judge_memory(&memory).await?;
@@ -201,13 +201,7 @@ async fn judge_memory(memory: &str) -> super::Result<()> {
---\n\n{memory}"
);
- let request = RequestBuilder::new()
- .model(JUDGE_MODEL)
- .system_prompt(JUDGE_PROMPT)
- .user_message(&user_message)
- .build();
-
- let response = get_chat_completion(request)
+ let response = agent::complete(JUDGE_MODEL, JUDGE_PROMPT, &user_message)
.await
.map_err(|e| anyhow::anyhow!(e))?;
diff --git a/rust/cloud-storage/model/Cargo.toml b/rust/cloud-storage/model/Cargo.toml
index f17f2bea46..a6bf33c4dc 100644
--- a/rust/cloud-storage/model/Cargo.toml
+++ b/rust/cloud-storage/model/Cargo.toml
@@ -5,7 +5,7 @@ publish = false
version = "0.1.0"
[dependencies]
-ai = { path = "../ai" }
+agent = { path = "../agent" }
anyhow = { workspace = true }
axum = { workspace = true }
base64 = { workspace = true }
diff --git a/rust/cloud-storage/model/src/chat/message.rs b/rust/cloud-storage/model/src/chat/message.rs
index 066afbf766..099b287d30 100644
--- a/rust/cloud-storage/model/src/chat/message.rs
+++ b/rust/cloud-storage/model/src/chat/message.rs
@@ -1,5 +1,6 @@
use super::NewAttachment;
-use ai::types::{ChatMessageContent, Model, Role};
+use agent::AgentModel;
+use agent::types::{ChatMessageContent, Role};
use chrono::{DateTime, Utc};
use model_entity::Entity;
use serde::{self, Deserialize, Serialize};
@@ -44,7 +45,7 @@ pub struct NewChatMessage {
/// The ids of the attachments used to generate the message
pub attachments: Option<Vec<NewAttachment>>,
/// The model used to generate the chat
- pub model: Model,
+ pub model: AgentModel,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
diff --git a/rust/cloud-storage/notification/Cargo.toml b/rust/cloud-storage/notification/Cargo.toml
index 6febfcfb95..77e13be651 100644
--- a/rust/cloud-storage/notification/Cargo.toml
+++ b/rust/cloud-storage/notification/Cargo.toml
@@ -6,7 +6,7 @@ version = "0.1.0"
[features]
-ai_tool = ["dep:ai", "dep:anyhow", "dep:async-trait", "dep:schemars"]
+ai_tool = ["dep:ai_toolset", "dep:anyhow", "dep:async-trait", "dep:schemars"]
axum = [
"dep:axum",
"dep:model-error-response",
@@ -19,7 +19,7 @@ redis-tests = []
schema = ["dep:utoipa", "macro_user_id/schema"]
[dependencies]
-ai = { path = "../ai", optional = true }
+ai_toolset = { path = "../ai_toolset", optional = true }
anyhow = { workspace = true, optional = true }
aquamarine = { version = "0.6", optional = true }
async-trait = { workspace = true, optional = true }
diff --git a/rust/cloud-storage/notification/src/inbound/ai_tool/mod.rs b/rust/cloud-storage/notification/src/inbound/ai_tool/mod.rs
index 8fbe66afd7..e78bc77439 100644
--- a/rust/cloud-storage/notification/src/inbound/ai_tool/mod.rs
+++ b/rust/cloud-storage/notification/src/inbound/ai_tool/mod.rs
@@ -13,7 +13,7 @@ use crate::domain::{
},
service::NotificationReader,
};
-use ai::tool::{
+use ai_toolset::{
AsyncTool, AsyncToolCollection, RequestContext, ServiceContext, ToolCallError, ToolResult,
};
use async_trait::async_trait;
diff --git a/rust/cloud-storage/notification/src/inbound/ai_tool/test.rs b/rust/cloud-storage/notification/src/inbound/ai_tool/test.rs
index f486bff84f..9155981a48 100644
--- a/rust/cloud-storage/notification/src/inbound/ai_tool/test.rs
+++ b/rust/cloud-storage/notification/src/inbound/ai_tool/test.rs
@@ -1,6 +1,6 @@
use super::*;
-use ai::generate_tool_input_schema;
-use ai::tool::types::tool_object::validate_tool_schema;
+use ai_toolset::generate_tool_input_schema;
+use ai_toolset::tool_object::validate_tool_schema;
#[test]
fn test_list_notifications_schema_validation() {
@@ -65,7 +65,7 @@ fn print_list_notifications_input_schema() {
#[test]
#[ignore = "prints the output schema"]
fn print_list_notifications_output_schema() {
- let generator = ai::tool::minimized_output_schema_generator();
+ let generator = ai_toolset::tool_object::minimized_output_schema_generator();
let schema = generator.into_root_schema_for::<ListNotificationsResponse>();
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
}
@@ -133,7 +133,7 @@ fn print_mark_done_input_schema() {
#[test]
#[ignore = "prints the output schema"]
fn print_output_schema() {
- let generator = ai::tool::minimized_output_schema_generator();
+ let generator = ai_toolset::tool_object::minimized_output_schema_generator();
let schema = generator.into_root_schema_for::<MarkNotificationsResponse>();
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
}
diff --git a/rust/cloud-storage/properties/Cargo.toml b/rust/cloud-storage/properties/Cargo.toml
index 7d5b8b9299..c769734deb 100644
--- a/rust/cloud-storage/properties/Cargo.toml
+++ b/rust/cloud-storage/properties/Cargo.toml
@@ -6,14 +6,14 @@ version = "0.1.0"
[features]
ai_tools = [
- "dep:ai",
+ "dep:ai_toolset",
"dep:async-trait",
"dep:chrono",
"dep:schemars",
]
[dependencies]
-ai = { path = "../ai", optional = true }
+ai_toolset = { path = "../ai_toolset", optional = true }
anyhow = { workspace = true }
async-trait = { workspace = true, optional = true }
chrono = { workspace = true, optional = true }
@@ -39,7 +39,7 @@ tracing = { workspace = true }
uuid = { workspace = true }
[dev-dependencies]
-ai = { path = "../ai" }
+ai_toolset = { path = "../ai_toolset" }
mockall = { workspace = true }
macro_db_migrator = { path = "../macro_db_migrator" }
serde_json = { workspace = true }
diff --git a/rust/cloud-storage/properties/src/inbound/toolset/get_entity_properties.rs b/rust/cloud-storage/properties/src/inbound/toolset/get_entity_properties.rs
index 6b57f4f8e3..f8d4b46133 100644
--- a/rust/cloud-storage/properties/src/inbound/toolset/get_entity_properties.rs
+++ b/rust/cloud-storage/properties/src/inbound/toolset/get_entity_properties.rs
@@ -2,7 +2,7 @@
use crate::domain::model::{EntityPropertyInfo, PropertyOptionInfo};
use crate::domain::service::PropertiesService;
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use models_properties::service::property_option::PropertyOptionValue;
use models_properties::service::property_value::PropertyValue;
diff --git a/rust/cloud-storage/properties/src/inbound/toolset/mod.rs b/rust/cloud-storage/properties/src/inbound/toolset/mod.rs
index 11260563f3..2e6f7a6395 100644
--- a/rust/cloud-storage/properties/src/inbound/toolset/mod.rs
+++ b/rust/cloud-storage/properties/src/inbound/toolset/mod.rs
@@ -7,7 +7,7 @@ mod set_entity_property;
mod test;
use crate::domain::service::PropertiesService;
-use ai::tool::AsyncToolCollection;
+use ai_toolset::AsyncToolCollection;
use std::sync::Arc;
pub use get_entity_properties::{GetEntityProperties, GetEntityPropertiesResponse};
diff --git a/rust/cloud-storage/properties/src/inbound/toolset/set_entity_property.rs b/rust/cloud-storage/properties/src/inbound/toolset/set_entity_property.rs
index 8a9e1b5e6c..58f524624a 100644
--- a/rust/cloud-storage/properties/src/inbound/toolset/set_entity_property.rs
+++ b/rust/cloud-storage/properties/src/inbound/toolset/set_entity_property.rs
@@ -1,7 +1,7 @@
//! SetEntityProperty tool for updating property values on entities.
use crate::domain::service::PropertiesService;
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use models_properties::EntityType;
diff --git a/rust/cloud-storage/properties/src/inbound/toolset/test.rs b/rust/cloud-storage/properties/src/inbound/toolset/test.rs
index 4ec76267d9..000f5bd54f 100644
--- a/rust/cloud-storage/properties/src/inbound/toolset/test.rs
+++ b/rust/cloud-storage/properties/src/inbound/toolset/test.rs
@@ -1,7 +1,7 @@
#[allow(unused_imports)]
use super::*;
-use ai::generate_tool_input_schema;
-use ai::tool::types::tool_object::validate_tool_schema;
+use ai_toolset::generate_tool_input_schema;
+use ai_toolset::tool_object::validate_tool_schema;
#[test]
fn test_get_entity_properties_schema_validation() {
@@ -53,7 +53,7 @@ fn print_set_input_schema() {
#[test]
#[ignore = "prints the output schema"]
fn print_get_output_schema() {
- let generator = ai::tool::minimized_output_schema_generator();
+ let generator = ai_toolset::tool_object::minimized_output_schema_generator();
let schema = generator.into_root_schema_for::<GetEntityPropertiesResponse>();
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
}
@@ -62,7 +62,7 @@ fn print_get_output_schema() {
#[test]
#[ignore = "prints the output schema"]
fn print_set_output_schema() {
- let generator = ai::tool::minimized_output_schema_generator();
+ let generator = ai_toolset::tool_object::minimized_output_schema_generator();
let schema = generator.into_root_schema_for::<SetEntityPropertyResponse>();
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
}
diff --git a/rust/cloud-storage/scheduled_action/Cargo.toml b/rust/cloud-storage/scheduled_action/Cargo.toml
index cdaa91f971..7ab0b60082 100644
--- a/rust/cloud-storage/scheduled_action/Cargo.toml
+++ b/rust/cloud-storage/scheduled_action/Cargo.toml
@@ -27,7 +27,7 @@ anyhow = { workspace = true }
macro_uuid = { path = "../macro_uuid"}
chrono = { workspace = true}
chrono-tz = { version = "0.10.4", features = ["serde"] }
-ai = { path = "../ai" }
+agent = { path = "../agent" }
tokio = { workspace = true }
futures = { workspace = true }
tracing = { workspace = true }
diff --git a/rust/cloud-storage/scheduled_action/src/domain/models.rs b/rust/cloud-storage/scheduled_action/src/domain/models.rs
index 575b8c526f..6ff915cf24 100644
--- a/rust/cloud-storage/scheduled_action/src/domain/models.rs
+++ b/rust/cloud-storage/scheduled_action/src/domain/models.rs
@@ -1,4 +1,4 @@
-use ai::types::Model;
+use agent::AgentModel;
use anyhow::Result;
use chrono::{DateTime, Duration, Utc};
use chrono_tz::Tz;
@@ -57,7 +57,7 @@ pub enum ActionKind {
#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)]
pub struct AgentTask {
- pub model: Model,
+ pub model: AgentModel,
pub prompt: String,
pub user_prompt: String,
}
diff --git a/rust/cloud-storage/scheduled_action/src/outbound/inprocess_executor/agent_task.rs b/rust/cloud-storage/scheduled_action/src/outbound/inprocess_executor/agent_task.rs
index 9d41e439d2..abf94171d4 100644
--- a/rust/cloud-storage/scheduled_action/src/outbound/inprocess_executor/agent_task.rs
+++ b/rust/cloud-storage/scheduled_action/src/outbound/inprocess_executor/agent_task.rs
@@ -1,10 +1,10 @@
use super::notify::notify_completion;
use std::sync::Arc;
-use ai::tool::ToolLoop;
-use ai::types::{ChatMessage, ChatMessageContent, RequestBuilder, Role};
+use agent::types::{AssistantMessagePart, ChatMessage, ChatMessageContent, Role};
+use agent::{AgentLoop, StreamPart};
use ai_tools::{ToolServiceContext, ToolSetWithPrompt, all_tools};
-use ai_toolset::RequestContext;
+use ai_toolset::ToolSet as AiToolSet;
use anyhow::{Context, Result};
use chat::domain::models::CreateChatArgs;
use chat::domain::ports::ChatRepo;
@@ -21,16 +21,10 @@ use sqlx::PgPool;
use crate::domain::models::{AgentTask, ScheduledAction};
-/// Create the chat that will hold this run's transcript. Called synchronously
-/// by the executor so the chat_id can be returned to the caller and persisted
-/// on the execution record before the background task starts.
pub async fn create_run_chat(db: &PgPool, action: &ScheduledAction) -> Result<String> {
create_chat(db, action).await
}
-/// Runs the agent tool loop against an already-created chat. Stores the user
-/// prompt and the resulting conversation into that chat, then fires a
-/// best-effort notification so the owner knows the run finished.
pub async fn run_agent_task(
db: &PgPool,
tool_context: &ToolServiceContext,
@@ -43,28 +37,25 @@ pub async fn run_agent_task(
store_user_message(db, chat_id, &agent_task).await?;
- let messages = run_tool_loop(db, tool_context, action, &agent_task).await?;
+ let parts = run_tool_loop(db, tool_context, action, &agent_task).await?;
- let final_assistant_text = messages
+ let final_text: String = parts
.iter()
- .rev()
- .find(|m| m.role == Role::Assistant)
- .and_then(|m| m.content.assistant_message_text());
+ .filter_map(|p| match p {
+ AssistantMessagePart::Text { text } => Some(text.as_str()),
+ _ => None,
+ })
+ .collect();
- store_conversation(db, chat_id, messages, &agent_task).await?;
+ store_conversation(db, chat_id, &parts, &agent_task).await?;
- if let Some(text) = final_assistant_text {
- notify_completion(notification_ingress, chat_id, action, &text);
+ if !final_text.is_empty() {
+ notify_completion(notification_ingress, chat_id, action, &final_text);
}
Ok(())
}
-/// Fetch the owner's persisted memory to inject as system-prompt context.
-///
-/// [`MemoryServiceImpl::get_or_generate_memory`] returns the existing memory
-/// (if any) synchronously and spawns a background refresh when the memory is
-/// missing or stale, so this call does not block agent execution on generation.
async fn fetch_user_memory(
db: &PgPool,
tool_context: &ToolServiceContext,
@@ -126,7 +117,7 @@ async fn run_tool_loop(
tool_context: &ToolServiceContext,
action: &ScheduledAction,
agent_task: &AgentTask,
-) -> Result<Vec<ChatMessage>> {
+) -> Result<Vec<AssistantMessagePart>> {
let tools = all_tools();
let user_memory = fetch_user_memory(db, tool_context, &action.owner).await;
let system_prompt = match user_memory {
@@ -136,31 +127,65 @@ async fn run_tool_loop(
),
None => format!("{}\n{}", tools.prompt, agent_task.prompt),
};
- let request = RequestBuilder::new()
- .model(agent_task.model)
- .messages(vec![ChatMessage {
- content: ChatMessageContent::Text(agent_task.user_prompt.clone()),
- attachments: None,
- role: Role::User,
- }])
- .system_prompt(system_prompt)
- .max_tokens(16000)
- .build();
-
- let request_context = RequestContext {
- user_id: action.owner.clone(),
- };
- let mut chat = ToolLoop::new(tools.toolset, tool_context.clone()).chat();
- let mut stream = chat
- .send_message(request, request_context, action.owner.to_string())
+ let toolset: Arc<dyn AiToolSet<_> + Send + Sync> = tools.toolset;
+ let agent_loop = AgentLoop::new().with_model(agent_task.model);
+ let mut session = agent_loop
+ .session(
+ toolset,
+ Arc::new(tool_context.clone()),
+ &system_prompt,
+ action.owner.clone(),
+ )
+ .await;
+
+ let user_msg = ChatMessage {
+ content: ChatMessageContent::Text(agent_task.user_prompt.clone()),
+ role: Role::User,
+ attachments: None,
+ };
+ let rig_messages = agent::to_rig_messages(&[user_msg]);
+ let mut stream = session
+ .send_message(rig_messages)
.await
.context("failed to start agent stream")?;
let idle_timeout = std::time::Duration::from_secs(3 * 60);
+ let mut yielded_parts: Vec<AssistantMessagePart> = Vec::new();
+
loop {
match tokio::time::timeout(idle_timeout, stream.next()).await {
- Ok(Some(Ok(_))) => {}
+ Ok(Some(Ok(part))) => match part {
+ StreamPart::Content(text) if !text.is_empty() => {
+ yielded_parts.push(AssistantMessagePart::Text { text });
+ }
+ StreamPart::ToolCall(call) => {
+ yielded_parts.push(AssistantMessagePart::ToolCall {
+ name: call.name,
+ json: call.json,
+ id: call.id,
+ });
+ }
+ StreamPart::ToolResponse(agent::ToolResponse::Json { id, json, name }) => {
+ yielded_parts.push(AssistantMessagePart::ToolCallResponseJson {
+ name,
+ json,
+ id,
+ });
+ }
+ StreamPart::ToolResponse(agent::ToolResponse::Err {
+ id,
+ name,
+ description,
+ }) => {
+ yielded_parts.push(AssistantMessagePart::ToolCallErr {
+ name,
+ description,
+ id,
+ });
+ }
+ _ => {}
+ },
Ok(Some(Err(e))) => {
tracing::error!(error=?e, "agent stream error");
break;
@@ -173,30 +198,30 @@ async fn run_tool_loop(
}
}
- drop(stream);
- Ok(chat.get_new_conversation_messages())
+ Ok(yielded_parts)
}
async fn store_conversation(
db: &PgPool,
chat_id: &str,
- messages: Vec<ChatMessage>,
+ parts: &[AssistantMessagePart],
agent_task: &AgentTask,
) -> Result<()> {
- let now = chrono::Utc::now();
- for message in messages {
- let new_message = NewChatMessage {
- id: None,
- content: message.content,
- role: message.role,
- attachments: None,
- created_at: now,
- updated_at: now,
- model: agent_task.model,
- };
- create_chat_message(db.clone(), chat_id, new_message)
- .await
- .context("failed to store conversation message")?;
+ if parts.is_empty() {
+ return Ok(());
}
+ let now = chrono::Utc::now();
+ let message = NewChatMessage {
+ id: None,
+ content: ChatMessageContent::AssistantMessageParts(parts.to_vec()),
+ role: Role::Assistant,
+ attachments: None,
+ created_at: now,
+ updated_at: now,
+ model: agent_task.model,
+ };
+ create_chat_message(db.clone(), chat_id, message)
+ .await
+ .context("failed to store conversation message")?;
Ok(())
}
diff --git a/rust/cloud-storage/soup/Cargo.toml b/rust/cloud-storage/soup/Cargo.toml
index c9fd07c005..c0644c9886 100644
--- a/rust/cloud-storage/soup/Cargo.toml
+++ b/rust/cloud-storage/soup/Cargo.toml
@@ -7,7 +7,7 @@ version = "0.1.0"
[features]
ai_tools = [
"comms/outbound",
- "dep:ai",
+ "dep:ai_toolset",
"dep:async-trait",
"dep:schemars",
"email/outbound",
@@ -35,7 +35,7 @@ ports = ["dep:tokio", "frecency/ports"]
[dependencies]
-ai = { path = "../ai", optional = true }
+ai_toolset = { path = "../ai_toolset", optional = true }
anyhow = { workspace = true }
async-trait = { workspace = true, optional = true }
axum = { workspace = true, optional = true }
@@ -78,7 +78,7 @@ utoipa = { workspace = true, optional = true }
uuid = { workspace = true }
[dev-dependencies]
-ai = { path = "../ai" }
+ai_toolset = { path = "../ai_toolset" }
cool_asserts = "2"
filter_ast = { path = "../filter_ast" }
frecency = { path = "../frecency", features = ["mock", "outbound"] }
@@ -91,7 +91,3 @@ ordered-float = { workspace = true }
rootcause = { workspace = true }
tokio = { workspace = true }
tower = { workspace = true }
-
-[[example]]
-name = "ai_tools_cli"
-required-features = ["all"]
diff --git a/rust/cloud-storage/soup/examples/ai_tools_cli.rs b/rust/cloud-storage/soup/examples/ai_tools_cli.rs
deleted file mode 100644
index 6028cb7c6a..0000000000
--- a/rust/cloud-storage/soup/examples/ai_tools_cli.rs
+++ /dev/null
@@ -1,100 +0,0 @@
-#![recursion_limit = "256"]
-//! CLI example for testing soup AI tools interactively.
-//!
-//! This example creates a CLI interface to test the soup toolset with real database connections.
-//!
-//! # Usage
-//!
-//! ```bash
-//! DATABASE_URL=postgres://...
-//! ANTHROPIC_API_KEY=sk_abcdefl...
-//! LOCAL_USER_ID=macro|<email>
-//! cargo run --example ai_tools_cli --features all
-//! ```
-
-use ai::tool::tool_loop::cli::Cli;
-use ai::tool::types::RequestContext;
-use ai::types::Model;
-use comms::domain::service::ChannelServiceImpl;
-use comms::outbound::postgres::comms_repo::PgCommsRepo;
-use comms::outbound::postgres::user_repo::PgUserRepo;
-use email::domain::ports::ReadonlyEmailPreviewAdapter;
-use email::domain::service::EmailServiceImpl;
-use email::outbound::EmailPgRepo;
-use frecency::domain::services::FrecencyQueryServiceImpl;
-use frecency::outbound::postgres::FrecencyPgStorage;
-use macro_user_id::user_id::MacroUserIdStr;
-use soup::domain::service::SoupImpl;
-use soup::inbound::toolset::{SoupToolContext, soup_toolset};
-use soup::outbound::pg_soup_repo::PgSoupRepo;
-use sqlx::PgPool;
-#[tokio::main]
-async fn main() {
- // Get database URL from environment
- let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
- let usr = std::env::var("LOCAL_USER_ID").expect("LOCAL_USER_ID must bes set");
- let user_id: MacroUserIdStr<'static> = usr.try_into().expect("valid user id macro|<email>");
-
- println!(
- "Running with\nuser [{}]\ndatabase [{}]",
- user_id, database_url
- );
-
- // Connect to the database
- let pool = PgPool::connect(&database_url)
- .await
- .expect("Failed to connect to database");
-
- // Create the frecency service (shared by multiple services)
- let frecency_storage = FrecencyPgStorage::new(pool.clone());
- let frecency_service = FrecencyQueryServiceImpl::new(frecency_storage.clone());
-
- // Create the email service with real database connections
- let email_repo = EmailPgRepo::new(pool.clone());
- let crm_service = crm::domain::service::CrmServiceImpl::new(
- crm::outbound::companies_repo::CompaniesRepositoryImpl::new(pool.clone()),
- crm::outbound::no_op_resolver::NoOpCompanyMetadataResolver,
- );
- let email_service = EmailServiceImpl::new(
- email_repo,
- frecency_service.clone(),
- email::domain::ports::NoOpEnqueuer,
- crm_service,
- 0,
- );
-
- // Create the channels service with real database connections
- let comms_repo = PgCommsRepo::new(readonly_pool::ReadOnlyPool(pool.clone()));
- let user_repo = PgUserRepo::new(pool.clone());
- let channels_service = ChannelServiceImpl::new(comms_repo, user_repo, frecency_storage);
-
- // Create the soup service with real database connections
- let soup_repo = PgSoupRepo::new(readonly_pool::ReadOnlyPool(pool));
- let soup_service = SoupImpl::new(
- soup_repo,
- frecency_service,
- ReadonlyEmailPreviewAdapter(email_service.clone()),
- channels_service,
- call::domain::ports::NoOpCallRecordQueryService,
- );
-
- // Create the soup tool context
- let soup_context = SoupToolContext::new(soup_service, email_service.clone());
-
- // Create the soup toolset
- let toolset = soup_toolset();
-
- let context = RequestContext { user_id };
-
- // Create the CLI
- let cli = Cli::new(
- toolset,
- soup_context,
- "You are an assistant that helps users explore and manage their documents, projects, and other entities. Use the available tools to list and find entities.",
- Model::Claude45Haiku,
- move || context.clone(),
- );
-
- // Run the CLI
- cli.run().await;
-}
diff --git a/rust/cloud-storage/soup/src/inbound/toolset/list_entities.rs b/rust/cloud-storage/soup/src/inbound/toolset/list_entities.rs
index 7af9d04c56..9b589f1418 100644
--- a/rust/cloud-storage/soup/src/inbound/toolset/list_entities.rs
+++ b/rust/cloud-storage/soup/src/inbound/toolset/list_entities.rs
@@ -4,7 +4,7 @@ use crate::domain::{
models::{FrecencySoupItem, SoupQuery, SoupRequest, SoupType},
ports::SoupService,
};
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use email::domain::{models::PreviewView, ports::EmailService};
use filter_ast::Expr;
diff --git a/rust/cloud-storage/soup/src/inbound/toolset/mod.rs b/rust/cloud-storage/soup/src/inbound/toolset/mod.rs
index ea6efdb0ae..4bb50eb48c 100644
--- a/rust/cloud-storage/soup/src/inbound/toolset/mod.rs
+++ b/rust/cloud-storage/soup/src/inbound/toolset/mod.rs
@@ -6,7 +6,7 @@ mod list_entities;
mod test;
use crate::domain::ports::SoupService;
-use ai::tool::AsyncToolCollection;
+use ai_toolset::AsyncToolCollection;
use email::domain::ports::EmailService;
use std::sync::Arc;
diff --git a/rust/cloud-storage/soup/src/inbound/toolset/test.rs b/rust/cloud-storage/soup/src/inbound/toolset/test.rs
index 70265722f1..a14c31bdc7 100644
--- a/rust/cloud-storage/soup/src/inbound/toolset/test.rs
+++ b/rust/cloud-storage/soup/src/inbound/toolset/test.rs
@@ -1,8 +1,8 @@
use super::list_entities::build_summary;
#[allow(unused_imports)]
use super::*;
-use ai::generate_tool_input_schema;
-use ai::tool::types::tool_object::validate_tool_schema;
+use ai_toolset::generate_tool_input_schema;
+use ai_toolset::tool_object::validate_tool_schema;
use non_empty::IsEmpty;
use uuid::Uuid;
@@ -137,7 +137,7 @@ fn print_input_schema() {
#[test]
#[ignore = "prints the output schema"]
fn print_output_schema() {
- let generator = ai::tool::minimized_output_schema_generator();
+ let generator = ai_toolset::tool_object::minimized_output_schema_generator();
let schema = generator.into_root_schema_for::<ListEntitiesResponse>();
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
}
diff --git a/rust/cloud-storage/teams/Cargo.toml b/rust/cloud-storage/teams/Cargo.toml
index 2de7cc905c..0ea40e1a96 100644
--- a/rust/cloud-storage/teams/Cargo.toml
+++ b/rust/cloud-storage/teams/Cargo.toml
@@ -6,7 +6,7 @@ version = "0.1.0"
[features]
ai_tools = [
- "dep:ai",
+ "dep:ai_toolset",
"dep:async-trait",
"dep:schemars",
"entity_access/ports",
@@ -39,7 +39,7 @@ ports = [
[dependencies]
# Core
-ai = { path = "../ai", optional = true }
+ai_toolset = { path = "../ai_toolset", optional = true }
anyhow = { workspace = true }
async-stripe = { workspace = true, default-features = false, features = [
"billing",
diff --git a/rust/cloud-storage/teams/src/inbound/toolset/list_team_members.rs b/rust/cloud-storage/teams/src/inbound/toolset/list_team_members.rs
index 02340c8d56..40fb23eeb0 100644
--- a/rust/cloud-storage/teams/src/inbound/toolset/list_team_members.rs
+++ b/rust/cloud-storage/teams/src/inbound/toolset/list_team_members.rs
@@ -5,7 +5,7 @@ use crate::domain::{
model::{TeamInviteDetails, TeamMember},
team_repo::TeamMembersService,
};
-use ai::tool::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
+use ai_toolset::{AsyncTool, RequestContext, ServiceContext, ToolCallError, ToolResult};
use async_trait::async_trait;
use entity_access::domain::{
models::{
diff --git a/rust/cloud-storage/teams/src/inbound/toolset/mod.rs b/rust/cloud-storage/teams/src/inbound/toolset/mod.rs
index f4f71de0e4..c07ab822f0 100644
--- a/rust/cloud-storage/teams/src/inbound/toolset/mod.rs
+++ b/rust/cloud-storage/teams/src/inbound/toolset/mod.rs
@@ -6,7 +6,7 @@ mod list_team_members;
mod test;
use crate::domain::team_repo::TeamMembersService;
-use ai::tool::AsyncToolCollection;
+use ai_toolset::AsyncToolCollection;
use entity_access::domain::ports::EntityAccessService;
use list_team_members::ListTeamMembers;
use std::sync::Arc;
diff --git a/rust/cloud-storage/teams/src/inbound/toolset/test.rs b/rust/cloud-storage/teams/src/inbound/toolset/test.rs
index cf057dc6af..d930f54f53 100644
--- a/rust/cloud-storage/teams/src/inbound/toolset/test.rs
+++ b/rust/cloud-storage/teams/src/inbound/toolset/test.rs
@@ -1,6 +1,6 @@
use super::list_team_members::ListTeamMembers;
-use ai::generate_tool_input_schema;
-use ai::tool::types::tool_object::validate_tool_schema;
+use ai_toolset::generate_tool_input_schema;
+use ai_toolset::tool_object::validate_tool_schema;
#[test]
fn test_list_team_members_schema_validation() {