veryfront 0.1.1073 → 0.1.1076
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/cli/templates/manifest.js +1 -1
- package/esm/deno.js +1 -1
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts +8 -0
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts.map +1 -1
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.js +9 -1
- package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts +18 -0
- package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts.map +1 -1
- package/esm/src/agent/hosted/child-fork-step-message-preparation.js +12 -0
- package/esm/src/agent/hosted/default-chat-runtime.d.ts +2 -1
- package/esm/src/agent/hosted/default-chat-runtime.d.ts.map +1 -1
- package/esm/src/agent/hosted/default-chat-runtime.js +10 -3
- package/esm/src/agent/hosted/project-remote-tool-source.d.ts +8 -0
- package/esm/src/agent/hosted/project-remote-tool-source.d.ts.map +1 -1
- package/esm/src/agent/hosted/project-remote-tool-source.js +10 -1
- package/esm/src/agent/hosted/root-sandbox-tool-source.d.ts +29 -0
- package/esm/src/agent/hosted/root-sandbox-tool-source.d.ts.map +1 -0
- package/esm/src/agent/hosted/root-sandbox-tool-source.js +61 -0
- package/esm/src/agent/hosted/runtime-essential-tools.d.ts.map +1 -1
- package/esm/src/agent/hosted/runtime-essential-tools.js +20 -3
- package/esm/src/agent/hosted/veryfront-cloud-agent-service.d.ts.map +1 -1
- package/esm/src/agent/hosted/veryfront-cloud-agent-service.js +10 -1
- package/esm/src/agent/react/index.d.ts +3 -3
- package/esm/src/agent/react/index.d.ts.map +1 -1
- package/esm/src/agent/react/index.js +1 -1
- package/esm/src/agent/react/use-agent-metadata.d.ts +18 -1
- package/esm/src/agent/react/use-agent-metadata.d.ts.map +1 -1
- package/esm/src/agent/react/use-agent-metadata.js +19 -0
- package/esm/src/agent/react/use-chat/index.d.ts +1 -1
- package/esm/src/agent/react/use-chat/index.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/types.d.ts +16 -0
- package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.js +36 -3
- package/esm/src/agent/runtime/tool-discovery-context.d.ts +33 -0
- package/esm/src/agent/runtime/tool-discovery-context.d.ts.map +1 -0
- package/esm/src/agent/runtime/tool-discovery-context.js +1 -0
- package/esm/src/agent/streaming/fork-runtime-stream.d.ts +7 -0
- package/esm/src/agent/streaming/fork-runtime-stream.d.ts.map +1 -1
- package/esm/src/agent/streaming/fork-runtime-stream.js +8 -1
- package/esm/src/react/components/chat/agent-picker.d.ts +4 -4
- package/esm/src/react/components/chat/agent-picker.d.ts.map +1 -1
- package/esm/src/react/components/chat/agent-picker.js +3 -5
- package/esm/src/react/components/chat/chat/app-mode-chat.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/app-mode-chat.js +16 -31
- package/esm/src/react/components/chat/chat/chat-props.d.ts +11 -4
- package/esm/src/react/components/chat/chat/chat-props.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/sidebar.d.ts +10 -16
- package/esm/src/react/components/chat/chat/components/sidebar.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/sidebar.js +16 -10
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts +20 -19
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-composer.js +16 -46
- package/esm/src/react/components/chat/chat/composition/chat-empty.d.ts +12 -3
- package/esm/src/react/components/chat/chat/composition/chat-empty.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-empty.js +12 -2
- package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-message-list.js +5 -1
- package/esm/src/react/components/chat/chat/composition/chat-root.d.ts +7 -3
- package/esm/src/react/components/chat/chat/composition/chat-root.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-root.js +5 -1
- package/esm/src/react/components/chat/chat/composition/message-sources.d.ts +35 -0
- package/esm/src/react/components/chat/chat/composition/message-sources.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/composition/message-sources.js +31 -0
- package/esm/src/react/components/chat/chat/composition/message.d.ts +8 -10
- package/esm/src/react/components/chat/chat/composition/message.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/message.js +10 -17
- package/esm/src/react/components/chat/chat/composition/use-composer-value.d.ts +53 -0
- package/esm/src/react/components/chat/chat/composition/use-composer-value.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/composition/use-composer-value.js +78 -0
- package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts +10 -2
- package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/controlled-chat.d.ts +1 -1
- package/esm/src/react/components/chat/chat/controlled-chat.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/controlled-chat.js +5 -7
- package/esm/src/react/components/chat/chat/hooks/use-conversation-chat.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-conversation-chat.js +8 -5
- package/esm/src/react/components/chat/chat/hooks/use-conversation.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-conversation.js +3 -1
- package/esm/src/react/components/chat/chat/hooks/use-conversations.d.ts +5 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversations.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-conversations.js +2 -0
- package/esm/src/react/components/chat/chat-agent-picker.d.ts +6 -1
- package/esm/src/react/components/chat/chat-agent-picker.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat-agent-picker.js +7 -2
- package/esm/src/react/components/chat/model-selector.d.ts +2 -0
- package/esm/src/react/components/chat/model-selector.d.ts.map +1 -1
- package/esm/src/react/components/chat/model-selector.js +7 -6
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +198 -74
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -5
|
@@ -51,7 +51,7 @@ export default {
|
|
|
51
51
|
"app/api/ag-ui/route.ts": "import { createAgUiHandler } from \"veryfront/agent\";\nimport { store } from \"../../../store.ts\";\n\nexport const POST = createAgUiHandler(\"rag\", {\n beforeStream: async ({ lastUserText }) => {\n const query = lastUserText.trim();\n if (!query) return;\n\n try {\n const results = await store.search(query, { topK: 5 });\n if (results.length === 0) return;\n\n const contextBlock = results\n .map(\n (result) =>\n `[${result.title}] (score: ${\n result.score.toFixed(2)\n })\\n${result.text}`,\n )\n .join(\"\\n\\n---\\n\\n\");\n\n return {\n prepend: [\n {\n role: \"system\",\n parts: [\n {\n type: \"text\",\n text:\n `Here are relevant documents retrieved for your question:\\n\\n${contextBlock}\\n\\n` +\n \"Use these documents to answer. Cite the document title when referencing information.\",\n },\n ],\n },\n ],\n };\n } catch (e) {\n console.error(\"[RAG] Retrieval failed:\", e);\n return;\n }\n },\n});\n",
|
|
52
52
|
"app/api/ingest/route.ts": "import { store } from \"../../../store.ts\";\n\nexport async function POST() {\n await store.indexContentDir();\n return Response.json({ ok: true });\n}\n",
|
|
53
53
|
"app/api/uploads/route.ts": "import { createUploadHandler } from \"veryfront/embedding\";\nimport { store } from \"../../../store.ts\";\n\nexport const { POST, GET, DELETE } = createUploadHandler(store, {\n auth: { type: \"none\", allowUnauthenticated: true },\n});\n",
|
|
54
|
-
"app/layout.tsx": "'use client'\n\nimport \"../globals.css\";\nimport {\n AppShell,\n ChatSidebar,\n ChatThemeScope,\n ConversationsProvider,\n Tabs,\n TabsItem,\n} from \"veryfront/chat\";\nimport { Head } from \"veryfront/head\";\nimport { useRouter } from \"veryfront/router\";\n\nexport default function RootLayout({ children }: { children: React.ReactNode }): React.ReactNode {\n const router = useRouter();\n const activeTab = router.pathname.startsWith(\"/uploads\") ? \"uploads\" : \"chat\";\n\n return (\n <>\n <Head><title>Docs Agent</title></Head>\n <ChatThemeScope className=\"flex flex-col h-screen\">\n <ConversationsProvider storageKey=\"rag-conversations\">\n <AppShell className=\"flex-1 min-h-0\">\n <AppShell.Sidebar side=\"left\" className=\"border-r border-[var(--outline-border)]\">\n <AppShell.SidebarContent className=\"p-0\">\n <ChatSidebar
|
|
54
|
+
"app/layout.tsx": "'use client'\n\nimport \"../globals.css\";\nimport {\n AppShell,\n ChatSidebar,\n ChatThemeScope,\n ConversationsProvider,\n Tabs,\n TabsItem,\n} from \"veryfront/chat\";\nimport { Head } from \"veryfront/head\";\nimport { useRouter } from \"veryfront/router\";\n\nexport default function RootLayout({ children }: { children: React.ReactNode }): React.ReactNode {\n const router = useRouter();\n const activeTab = router.pathname.startsWith(\"/uploads\") ? \"uploads\" : \"chat\";\n\n return (\n <>\n <Head><title>Docs Agent</title></Head>\n <ChatThemeScope className=\"flex flex-col h-screen\">\n <ConversationsProvider storageKey=\"rag-conversations\">\n <AppShell className=\"flex-1 min-h-0\">\n <AppShell.Sidebar side=\"left\" className=\"border-r border-[var(--outline-border)]\">\n <AppShell.SidebarContent className=\"p-0\">\n <ChatSidebar.Root>\n <ChatSidebar.NewButton />\n <ChatSidebar.List />\n </ChatSidebar.Root>\n </AppShell.SidebarContent>\n </AppShell.Sidebar>\n <AppShell.Main>\n <AppShell.Header border className=\"h-16 gap-3 px-3\">\n <AppShell.Trigger side=\"left\" />\n <div className=\"flex flex-1 justify-center\">\n <Tabs\n value={activeTab}\n onValueChange={(value) => router.push(value === \"uploads\" ? \"/uploads\" : \"/\")}\n >\n <TabsItem value=\"chat\">Chat</TabsItem>\n <TabsItem value=\"uploads\">Uploads</TabsItem>\n </Tabs>\n </div>\n </AppShell.Header>\n <AppShell.Content className=\"flex flex-col min-h-0 pt-3\">\n {children}\n </AppShell.Content>\n </AppShell.Main>\n </AppShell>\n </ConversationsProvider>\n </ChatThemeScope>\n </>\n );\n}\n",
|
|
55
55
|
"app/page.tsx": "'use client'\n\nimport { Chat } from 'veryfront/chat'\n\nconst ACCEPT = '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.csv,.txt,.md,.mdx,.html,.rtf,.epub,.json,.xml'\n\nexport default function DocsChat() {\n return (\n <Chat\n agentId=\"rag\"\n api=\"/api/ag-ui\"\n uploadApi=\"/api/uploads\"\n attachAccept={ACCEPT}\n className=\"flex-1 min-h-0\"\n placeholder=\"Ask anything about your documents...\"\n />\n )\n}\n",
|
|
56
56
|
"app/uploads/page.tsx": "'use client'\n\nimport { AttachmentsPanel, useUploadsRegistry } from 'veryfront/chat'\n\nconst UPLOAD_API = '/api/uploads'\nconst ACCEPT = '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.csv,.txt,.md,.mdx,.html,.rtf,.epub,.json,.xml'\n\nexport default function UploadsPage(): React.JSX.Element {\n const uploads = useUploadsRegistry({ url: UPLOAD_API, storageKey: 'rag-uploads' })\n\n return (\n <AttachmentsPanel\n uploads={uploads.items}\n loading={uploads.isLoading}\n onAttach={uploads.upload}\n onRemoveUpload={uploads.remove}\n attachAccept={ACCEPT}\n className=\"flex-1 min-h-0\"\n />\n )\n}\n",
|
|
57
57
|
"content/architecture.md": "# Architecture\n\nAcme Platform uses a modular, event-driven architecture.\n\n## Core Components\n\n### API Gateway\nRoutes incoming requests to the appropriate microservice. Handles authentication, rate limiting, and request validation.\n\n### Event Bus\nAsynchronous message broker connecting all services. Supports pub/sub and point-to-point messaging patterns.\n\n### Data Layer\nMulti-tenant data storage with automatic sharding. Supports PostgreSQL for relational data and Redis for caching.\n\n## Request Flow\n\n1. Client sends request to API Gateway\n2. Gateway validates authentication token\n3. Request is routed to the target service\n4. Service processes request and publishes events\n5. Response is returned through the gateway\n\n## Scaling\n\nEach component scales independently. The API Gateway uses horizontal scaling with load balancing. Services auto-scale based on queue depth and CPU utilization.\n\n## Security\n\n- All inter-service communication uses mTLS\n- API tokens are rotated every 24 hours\n- Data at rest is encrypted with AES-256\n- Audit logs are retained for 90 days\n",
|
package/esm/deno.js
CHANGED
|
@@ -6,6 +6,7 @@ import { type HostedProjectRemoteToolSourceMutationHandler, type HostedProjectRe
|
|
|
6
6
|
import { type RuntimeClientProfile } from "../runtime/client-profile.js";
|
|
7
7
|
import { type HostedRuntimeAllowedToolNames } from "./runtime-essential-tools.js";
|
|
8
8
|
import type { HostedSubmittedFormInputResult } from "./chat-runtime-contract.js";
|
|
9
|
+
import type { RuntimeToolDiscoveryContext } from "../runtime/tool-discovery-context.js";
|
|
9
10
|
/** Context for hosted chat runtime tool assembly. */
|
|
10
11
|
export type HostedChatRuntimeToolAssemblyContext = DefaultResearchArtifactContext & {
|
|
11
12
|
authToken: string;
|
|
@@ -56,6 +57,13 @@ export type PrepareHostedChatRuntimeToolAssemblyInput<TTraceAttributes extends H
|
|
|
56
57
|
onSteeringMutation?: HostedProjectRemoteToolSourceMutationHandler;
|
|
57
58
|
onStudioProjectSwitch?: HostedProjectRemoteToolSourceProjectSwitchHandler;
|
|
58
59
|
preloadLatestConversationUserText?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Per-run tool discovery context. When provided, its `activatedRemoteToolNames`
|
|
62
|
+
* Set is passed (by reference) to every remote tool source as the live
|
|
63
|
+
* execution gate. The same Set is mutated by `load_tools`, so newly activated
|
|
64
|
+
* tools become executable without re-creating the sources.
|
|
65
|
+
*/
|
|
66
|
+
toolDiscoveryContext?: RuntimeToolDiscoveryContext;
|
|
59
67
|
};
|
|
60
68
|
/** Filter hosted chat runtime local tools. */
|
|
61
69
|
export declare function filterHostedChatRuntimeLocalTools(input: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-runtime-tool-assembly.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/chat-runtime-tool-assembly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,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AE,SAAS,MAAM,EAAE,CAAC;CAC7C,GAAG,WAAW,CAOd;AAED,iDAAiD;AACjD,wBAAsB,oCAAoC,CACxD,gBAAgB,SAAS,uBAAuB,GAAG,uBAAuB,EAE1E,KAAK,EAAE,yCAAyC,CAAC,gBAAgB,CAAC,GACjE,OAAO,CAAC,mCAAmC,CAAC,CA6G9C"}
|
|
@@ -87,6 +87,9 @@ export async function prepareHostedChatRuntimeToolAssembly(input) {
|
|
|
87
87
|
getActiveBranchId: input.getActiveBranchId ?? (() => activeBranchId(input.taskContext)),
|
|
88
88
|
conversationId: input.conversationId,
|
|
89
89
|
allowedToolNames,
|
|
90
|
+
...(input.toolDiscoveryContext?.activatedRemoteToolNames !== undefined
|
|
91
|
+
? { activatedRemoteToolNames: input.toolDiscoveryContext.activatedRemoteToolNames }
|
|
92
|
+
: {}),
|
|
90
93
|
projectScopedRemoteToolOptions: input.projectScopedRemoteToolOptions,
|
|
91
94
|
prepareToolInput: input.prepareRemoteToolInput,
|
|
92
95
|
shouldRetryWithTool: input.shouldRetryWithRemoteTool,
|
|
@@ -108,7 +111,12 @@ export async function prepareHostedChatRuntimeToolAssembly(input) {
|
|
|
108
111
|
? allowedToolNames.has(toolName)
|
|
109
112
|
: sourceProviderToolNames.has(toolName)));
|
|
110
113
|
const localToolNames = Object.keys(localHostTools);
|
|
111
|
-
|
|
114
|
+
// Initial inventory = configured-binding remote tools + local + provider-native.
|
|
115
|
+
// The full MCP catalog does not flood the union: remoteToolNames is already
|
|
116
|
+
// filtered by the agent's configured binding (allowedToolNames), so only the
|
|
117
|
+
// explicitly selected subset reaches the provider cap. On-demand activation
|
|
118
|
+
// via load_tools extends this set at runtime beyond what the binding pre-loads.
|
|
119
|
+
const availableToolNames = selectProviderCompatibleToolNames([...new Set([...localToolNames, ...providerToolNames, ...remoteToolNames])].sort(), {
|
|
112
120
|
model: input.taskContext.model,
|
|
113
121
|
requiredToolNames: localToolNames,
|
|
114
122
|
});
|
|
@@ -11,11 +11,29 @@ export type PrepareHostedChildForkRuntimeStepMessagesInput = {
|
|
|
11
11
|
buildInstructions: () => string;
|
|
12
12
|
forkToolNames: readonly string[];
|
|
13
13
|
resolveSystem?: HostedChildForkRuntimeStepSystemResolver;
|
|
14
|
+
/**
|
|
15
|
+
* Pinned tool names (local/essential) that are always present.
|
|
16
|
+
* Required when `getActivatedToolNames` is provided.
|
|
17
|
+
*/
|
|
18
|
+
pinnedToolNames?: readonly string[];
|
|
19
|
+
/**
|
|
20
|
+
* When provided, returns the current activated remote tool names from the
|
|
21
|
+
* live run context. The result is merged with `pinnedToolNames` and returned
|
|
22
|
+
* as `forkToolNames` in the step preparation result, enabling per-step tool
|
|
23
|
+
* schema refresh without mutating the caller's fixed forkToolNames array.
|
|
24
|
+
*/
|
|
25
|
+
getActivatedToolNames?: () => readonly string[];
|
|
14
26
|
};
|
|
15
27
|
/** Public API contract for hosted child fork runtime step messages. */
|
|
16
28
|
export type HostedChildForkRuntimeStepMessages = {
|
|
17
29
|
messages: AgentMessage[];
|
|
18
30
|
system: string;
|
|
31
|
+
/**
|
|
32
|
+
* Present only when `getActivatedToolNames` was provided in the input.
|
|
33
|
+
* Contains the live `pinned ∪ activated` set the caller should use for the
|
|
34
|
+
* current step instead of its fixed forkToolNames.
|
|
35
|
+
*/
|
|
36
|
+
forkToolNames?: readonly string[];
|
|
19
37
|
};
|
|
20
38
|
/** Convert compacted provider messages to child fork runtime messages. */
|
|
21
39
|
export declare function convertCompactedProviderMessagesToChildForkRuntimeMessages(compactedMessages: readonly ProviderModelMessage[]): AgentMessage[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"child-fork-step-message-preparation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/child-fork-step-message-preparation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAUhE,OAAO,KAAK,EAAE,OAAO,IAAI,YAAY,EAAe,MAAM,qBAAqB,CAAC;AAEhF,8EAA8E;AAC9E,MAAM,MAAM,wCAAwC,GAAG,CAAC,KAAK,EAAE;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACpD,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEhC,yEAAyE;AACzE,MAAM,MAAM,8CAA8C,GAAG;IAC3D,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,MAAM,CAAC;IAChC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"child-fork-step-message-preparation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/child-fork-step-message-preparation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAUhE,OAAO,KAAK,EAAE,OAAO,IAAI,YAAY,EAAe,MAAM,qBAAqB,CAAC;AAEhF,8EAA8E;AAC9E,MAAM,MAAM,wCAAwC,GAAG,CAAC,KAAK,EAAE;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACpD,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEhC,yEAAyE;AACzE,MAAM,MAAM,8CAA8C,GAAG;IAC3D,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,MAAM,CAAC;IAChC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,wCAAwC,CAAC;IACzD;;;OAGG;IACH,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,MAAM,SAAS,MAAM,EAAE,CAAC;CACjD,CAAC;AAEF,uEAAuE;AACvE,MAAM,MAAM,kCAAkC,GAAG;IAC/C,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,CAAC;AA+CF,0EAA0E;AAC1E,wBAAgB,0DAA0D,CACxE,iBAAiB,EAAE,SAAS,oBAAoB,EAAE,GACjD,YAAY,EAAE,CAOhB;AAED,uDAAuD;AACvD,wBAAgB,yCAAyC,CACvD,KAAK,EAAE,8CAA8C,GACpD,kCAAkC,CAuCpC"}
|
|
@@ -52,8 +52,20 @@ export function prepareHostedChildForkRuntimeStepMessages(input) {
|
|
|
52
52
|
system: currentInstructions,
|
|
53
53
|
compactedMessages,
|
|
54
54
|
});
|
|
55
|
+
// Compute live forkToolNames = pinned ∪ activated when the caller supplies
|
|
56
|
+
// a getActivatedToolNames getter. This allows each step to see newly
|
|
57
|
+
// activated tool schemas without the caller mutating its fixed array.
|
|
58
|
+
const liveForkToolNames = input.getActivatedToolNames
|
|
59
|
+
? [
|
|
60
|
+
...new Set([
|
|
61
|
+
...(input.pinnedToolNames ?? []),
|
|
62
|
+
...input.getActivatedToolNames(),
|
|
63
|
+
]),
|
|
64
|
+
].sort()
|
|
65
|
+
: undefined;
|
|
55
66
|
return {
|
|
56
67
|
messages: convertCompactedProviderMessagesToChildForkRuntimeMessages(compactedMessages),
|
|
57
68
|
system: typeof resolvedSystem === "string" ? resolvedSystem : currentInstructions,
|
|
69
|
+
...(liveForkToolNames !== undefined ? { forkToolNames: liveForkToolNames } : {}),
|
|
58
70
|
};
|
|
59
71
|
}
|
|
@@ -67,7 +67,8 @@ export type DefaultHostedChatRuntimeProjectSwitchInput = {
|
|
|
67
67
|
export type CreateDefaultHostedChatRuntimeOptions = {
|
|
68
68
|
options: DefaultHostedChatRuntimeCreationOptions;
|
|
69
69
|
config: DefaultHostedChatRuntimeConfig;
|
|
70
|
-
buildLocalTools: (taskContext: DefaultHostedChatRuntimeTaskContext) => HostToolSet
|
|
70
|
+
buildLocalTools: (taskContext: DefaultHostedChatRuntimeTaskContext) => HostToolSet | Promise<HostToolSet>;
|
|
71
|
+
cleanup?: () => Promise<void>;
|
|
71
72
|
createTaskContext?: (input: CreateDefaultHostedChatRuntimeContextInput) => DefaultHostedChatRuntimeTaskContext;
|
|
72
73
|
refreshSystem?: (input: DefaultHostedChatRuntimeSystemRefreshInput) => Promise<string> | string;
|
|
73
74
|
onSteeringMutation?: (input: DefaultHostedChatRuntimeSteeringMutationInput) => Promise<void> | void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-chat-runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/default-chat-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAqB7B,OAAO,KAAK,EACV,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,mCAAmC,EAExC,KAAK,yCAAyC,EAC/C,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,KAAK,EACV,8BAA8B,EAC9B,0BAA0B,EAC3B,MAAM,gCAAgC,CAAC;AAIxC,yDAAyD;AACzD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,2BAA2B,EAAE,CAAC;CACrD,CAAC;AAEF,kEAAkE;AAClE,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,CAA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D,OAAO,EAAE,uCAAuC,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,0CAA0C,GAAG;IACvD,WAAW,EAAE,mCAAmC,CAAC;IACjD,mBAAmB,EAAE,WAAW,CAAC,uCAAuC,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACjG,YAAY,EAAE,mCAAmC,CAAC;CACnD,CAAC;AAEF,uEAAuE;AACvE,MAAM,MAAM,6CAA6C,GAAG;IAC1D,QAAQ,EAAE,6BAA6B,CAAC;IACxC,WAAW,EAAE,mCAAmC,CAAC;CAClD,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,0CAA0C,GAAG;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,mCAAmC,CAAC;CAClD,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,qCAAqC,GAAG;IAClD,OAAO,EAAE,uCAAuC,CAAC;IACjD,MAAM,EAAE,8BAA8B,CAAC;IACvC,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"default-chat-runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/default-chat-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAqB7B,OAAO,KAAK,EACV,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,mCAAmC,EAExC,KAAK,yCAAyC,EAC/C,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAEL,KAAK,iCAAiC,EACvC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,KAAK,EACV,8BAA8B,EAC9B,0BAA0B,EAC3B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MAAM,CAAC,GAAG,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,CACnB,KAAK,EAAE,6CAA6C,KACjD,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1B,qBAAqB,CAAC,EAAE,CACtB,KAAK,EAAE,0CAA0C,KAC9C,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAChC,8BAA8B,CAAC,EAC7B,yCAAyC,CAAC,gCAAgC,CAAC,CAAC;IAC9E,sBAAsB,CAAC,EAAE,CAAC,MAAM,EAAE,yBAAyB,KAAK,gBAAgB,CAAC;IACjF,eAAe,CAAC,EAAE,yCAAyC,CAAC,iBAAiB,CAAC,CAAC;IAC/E,iCAAiC,CAAC,EAAE,OAAO,CAAC;IAC5C,MAAM,CAAC,EAAE,8BAA8B,CAAC;CACzC,CAAC;AA4KF,0CAA0C;AAC1C,wBAAsB,8BAA8B,CAClD,KAAK,EAAE,qCAAqC,GAC3C,OAAO,CAAC,+BAA+B,CAAC,CA+D1C"}
|
|
@@ -36,7 +36,7 @@ async function buildToolAssembly(input) {
|
|
|
36
36
|
return prepareHostedChatRuntimeToolAssembly({
|
|
37
37
|
taskContext: input.taskContext,
|
|
38
38
|
instructions: input.options.instructions,
|
|
39
|
-
localTools: input.buildLocalTools(input.taskContext),
|
|
39
|
+
localTools: await input.buildLocalTools(input.taskContext),
|
|
40
40
|
apiUrl: input.config.apiUrl,
|
|
41
41
|
apiMcpUrl: input.config.apiMcpUrl,
|
|
42
42
|
studioMcpUrl: input.config.studioMcpUrl,
|
|
@@ -147,7 +147,7 @@ export async function createDefaultHostedChatRuntime(input) {
|
|
|
147
147
|
const taskContext = input.createTaskContext
|
|
148
148
|
? input.createTaskContext({ options: input.options, modelId })
|
|
149
149
|
: createDefaultTaskContext({ options: input.options, modelId });
|
|
150
|
-
const cleanup = () => Promise.resolve();
|
|
150
|
+
const cleanup = input.cleanup ?? (() => Promise.resolve());
|
|
151
151
|
try {
|
|
152
152
|
const toolAssembly = await buildToolAssembly({
|
|
153
153
|
...input,
|
|
@@ -187,7 +187,14 @@ export async function createDefaultHostedChatRuntime(input) {
|
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
catch (error) {
|
|
190
|
-
|
|
190
|
+
try {
|
|
191
|
+
await cleanup();
|
|
192
|
+
}
|
|
193
|
+
catch (cleanupError) {
|
|
194
|
+
input.logger?.warn("Hosted chat runtime cleanup failed after setup error", {
|
|
195
|
+
error: cleanupError instanceof Error ? cleanupError.message : String(cleanupError),
|
|
196
|
+
});
|
|
197
|
+
}
|
|
191
198
|
throw error;
|
|
192
199
|
}
|
|
193
200
|
}
|
|
@@ -26,6 +26,14 @@ export type CreateHostedProjectRemoteToolSourceInput = {
|
|
|
26
26
|
defaultProjectId?: ProjectScopedRemoteToolDefaultProjectId;
|
|
27
27
|
getActiveBranchId?: () => string | null | undefined;
|
|
28
28
|
allowedToolNames?: ReadonlySet<string> | null;
|
|
29
|
+
/**
|
|
30
|
+
* Live activated remote tool names from the discovery context.
|
|
31
|
+
* When provided, this Set (passed by reference) is used as the execution
|
|
32
|
+
* gate for the remote tool catalog instead of `allowedToolNames`. Because
|
|
33
|
+
* the same Set is mutated by `load_tools`, newly activated tools become
|
|
34
|
+
* executable without any catalog re-creation.
|
|
35
|
+
*/
|
|
36
|
+
activatedRemoteToolNames?: ReadonlySet<string> | null;
|
|
29
37
|
projectScopedRemoteToolOptions?: ProjectScopedRemoteToolOptions;
|
|
30
38
|
filterToolDefinitions?: ProjectScopedRemoteToolCatalogOptions["filterToolDefinitions"];
|
|
31
39
|
prepareToolInput?: HostedProjectRemoteToolSourcePrepareToolInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-remote-tool-source.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/project-remote-tool-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,qCAAqC,EAC1C,KAAK,uCAAuC,EAC5C,KAAK,8BAA8B,EACnC,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AAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACpD,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC9C,8BAA8B,CAAC,EAAE,8BAA8B,CAAC;IAChE,qBAAqB,CAAC,EAAE,qCAAqC,CAAC,uBAAuB,CAAC,CAAC;IACvF,gBAAgB,CAAC,EAAE,6CAA6C,CAAC;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,wCAAwC,CAAC;IAC/D,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,eAAe,CAAC,EAAE,iDAAiD,CAAC;IACpE,kBAAkB,CAAC,EAAE,4CAA4C,CAAC;CACnE,CAAC;AAQF,gDAAgD;AAChD,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,wCAAwC,GAC9C,gBAAgB,
|
|
1
|
+
{"version":3,"file":"project-remote-tool-source.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/project-remote-tool-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,qCAAqC,EAC1C,KAAK,uCAAuC,EAC5C,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,2BAA2B,EAGjC,MAAM,iCAAiC,CAAC;AAGzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EAGL,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EAC1B,MAAM,iCAAiC,CAAC;AAGzC,8DAA8D;AAC9D,MAAM,MAAM,4CAA4C,GAAG,CACzD,QAAQ,EAAE,6BAA6B,KACpC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE1B,oEAAoE;AACpE,MAAM,MAAM,iDAAiD,GAAG,CAC9D,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,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BAAkB,CAAC,EAAE,4CAA4C,CAAC;CACnE,CAAC;AAQF,gDAAgD;AAChD,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,wCAAwC,GAC9C,gBAAgB,CAyHlB;AAED,mEAAmE;AACnE,MAAM,MAAM,yCAAyC,GACjD,IAAI,CACJ,wCAAwC,EACxC,QAAQ,GAAG,iBAAiB,CAC7B,GACC;IACA,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACpD,aAAa,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC5C,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,CAAC,EAAE,CAAC,MAAM,EAAE,yBAAyB,KAAK,gBAAgB,CAAC;IACjF,qBAAqB,CAAC,EAAE,iDAAiD,CAAC;CAC3E,CAAC;AAyGJ,iDAAiD;AACjD,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,yCAAyC,GAC/C,gBAAgB,EAAE,CA8BpB"}
|
|
@@ -9,10 +9,16 @@ function resolveActiveBranchId(getActiveBranchId) {
|
|
|
9
9
|
}
|
|
10
10
|
/** Create hosted project remote tool source. */
|
|
11
11
|
export function createHostedProjectRemoteToolSource(input) {
|
|
12
|
+
// When `activatedRemoteToolNames` is provided, it acts as the live execution
|
|
13
|
+
// gate: only tools in this Set (which grows as load_tools activates them)
|
|
14
|
+
// can be listed or executed. Falls back to `allowedToolNames` when absent.
|
|
15
|
+
const catalogAllowedToolNames = input.activatedRemoteToolNames !== undefined
|
|
16
|
+
? input.activatedRemoteToolNames
|
|
17
|
+
: input.allowedToolNames;
|
|
12
18
|
const toolCatalog = createProjectScopedRemoteToolCatalog({
|
|
13
19
|
source: input.source,
|
|
14
20
|
defaultProjectId: input.defaultProjectId,
|
|
15
|
-
allowedToolNames:
|
|
21
|
+
allowedToolNames: catalogAllowedToolNames,
|
|
16
22
|
projectScopedRemoteToolOptions: input.projectScopedRemoteToolOptions,
|
|
17
23
|
filterToolDefinitions: input.filterToolDefinitions,
|
|
18
24
|
});
|
|
@@ -116,6 +122,9 @@ function createHostedProjectRemoteToolSourceFromConfig(input, server, source, on
|
|
|
116
122
|
? { getActiveBranchId: input.getActiveBranchId }
|
|
117
123
|
: {}),
|
|
118
124
|
...(input.allowedToolNames !== undefined ? { allowedToolNames: input.allowedToolNames } : {}),
|
|
125
|
+
...(input.activatedRemoteToolNames !== undefined
|
|
126
|
+
? { activatedRemoteToolNames: input.activatedRemoteToolNames }
|
|
127
|
+
: {}),
|
|
119
128
|
...(input.projectScopedRemoteToolOptions !== undefined
|
|
120
129
|
? { projectScopedRemoteToolOptions: input.projectScopedRemoteToolOptions }
|
|
121
130
|
: {}),
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type AgentServiceSandboxToolsOptions, type AgentServiceSandboxToolsResult } from "../../sandbox/index.js";
|
|
2
|
+
import type { HostToolSet } from "../../tool/index.js";
|
|
3
|
+
import type { DefaultHostedChatRuntimeTaskContext } from "./default-chat-runtime.js";
|
|
4
|
+
type CreateAgentServiceSandboxTools = (input: AgentServiceSandboxToolsOptions) => Promise<Pick<AgentServiceSandboxToolsResult, "tools" | "closeSandbox">>;
|
|
5
|
+
/** Input used to prepare the hosted root sandbox tool source. */
|
|
6
|
+
export type PrepareHostedRootSandboxToolSourceInput = AgentServiceSandboxToolsOptions & {
|
|
7
|
+
allowedToolNames: readonly string[] | undefined;
|
|
8
|
+
createAgentServiceSandboxTools?: CreateAgentServiceSandboxTools;
|
|
9
|
+
};
|
|
10
|
+
/** Tool source and cleanup returned for a hosted root sandbox. */
|
|
11
|
+
export type HostedRootSandboxToolSource = {
|
|
12
|
+
tools: HostToolSet;
|
|
13
|
+
closeRuntime?: () => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
/** Input used to create the hosted root local tool lifecycle. */
|
|
16
|
+
export type CreateHostedRootLocalToolRuntimeInput = Omit<PrepareHostedRootSandboxToolSourceInput, "getProjectId"> & {
|
|
17
|
+
buildBaseTools: (taskContext: DefaultHostedChatRuntimeTaskContext) => HostToolSet;
|
|
18
|
+
};
|
|
19
|
+
/** Hosted root local tool builder and runtime cleanup. */
|
|
20
|
+
export type HostedRootLocalToolRuntime = {
|
|
21
|
+
buildLocalTools: (taskContext: DefaultHostedChatRuntimeTaskContext) => Promise<HostToolSet>;
|
|
22
|
+
cleanup: () => Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
/** Prepare sandbox tools only when the effective root selection includes a sandbox tool. */
|
|
25
|
+
export declare function prepareHostedRootSandboxToolSource(input: PrepareHostedRootSandboxToolSourceInput): Promise<HostedRootSandboxToolSource>;
|
|
26
|
+
/** Create the hosted root local tool builder with sandbox lifecycle ownership. */
|
|
27
|
+
export declare function createHostedRootLocalToolRuntime(input: CreateHostedRootLocalToolRuntimeInput): HostedRootLocalToolRuntime;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=root-sandbox-tool-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-sandbox-tool-source.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/root-sandbox-tool-source.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EAEpC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AAYrF,KAAK,8BAA8B,GAAG,CACpC,KAAK,EAAE,+BAA+B,KACnC,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC;AAE7E,iEAAiE;AACjE,MAAM,MAAM,uCAAuC,GAAG,+BAA+B,GAAG;IACtF,gBAAgB,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAChD,8BAA8B,CAAC,EAAE,8BAA8B,CAAC;CACjE,CAAC;AAEF,kEAAkE;AAClE,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,WAAW,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC,CAAC;AAEF,iEAAiE;AACjE,MAAM,MAAM,qCAAqC,GAC7C,IAAI,CACJ,uCAAuC,EACvC,cAAc,CACf,GACC;IACA,cAAc,EAAE,CAAC,WAAW,EAAE,mCAAmC,KAAK,WAAW,CAAC;CACnF,CAAC;AAEJ,0DAA0D;AAC1D,MAAM,MAAM,0BAA0B,GAAG;IACvC,eAAe,EAAE,CAAC,WAAW,EAAE,mCAAmC,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5F,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,4FAA4F;AAC5F,wBAAsB,kCAAkC,CACtD,KAAK,EAAE,uCAAuC,GAC7C,OAAO,CAAC,2BAA2B,CAAC,CAmBtC;AAED,kFAAkF;AAClF,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,qCAAqC,GAC3C,0BAA0B,CAmC5B"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createAgentServiceSandboxTools, } from "../../sandbox/index.js";
|
|
2
|
+
const HOSTED_ROOT_SANDBOX_TOOL_NAMES = new Set([
|
|
3
|
+
"bash",
|
|
4
|
+
"sandbox_read_file",
|
|
5
|
+
"sandbox_write_file",
|
|
6
|
+
"start_background_command",
|
|
7
|
+
"get_background_command",
|
|
8
|
+
"get_background_command_output",
|
|
9
|
+
"cancel_background_command",
|
|
10
|
+
]);
|
|
11
|
+
/** Prepare sandbox tools only when the effective root selection includes a sandbox tool. */
|
|
12
|
+
export async function prepareHostedRootSandboxToolSource(input) {
|
|
13
|
+
const { allowedToolNames, createAgentServiceSandboxTools: createSandboxToolsOverride, ...sandboxInput } = input;
|
|
14
|
+
if (allowedToolNames !== undefined &&
|
|
15
|
+
!allowedToolNames.some((toolName) => HOSTED_ROOT_SANDBOX_TOOL_NAMES.has(toolName))) {
|
|
16
|
+
return { tools: {} };
|
|
17
|
+
}
|
|
18
|
+
const createSandboxTools = createSandboxToolsOverride ?? createAgentServiceSandboxTools;
|
|
19
|
+
const sandboxResult = await createSandboxTools(sandboxInput);
|
|
20
|
+
return {
|
|
21
|
+
tools: sandboxResult.tools,
|
|
22
|
+
closeRuntime: sandboxResult.closeSandbox,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Create the hosted root local tool builder with sandbox lifecycle ownership. */
|
|
26
|
+
export function createHostedRootLocalToolRuntime(input) {
|
|
27
|
+
let closeRuntime;
|
|
28
|
+
let localToolsPromise;
|
|
29
|
+
let cleanupPromise;
|
|
30
|
+
const { buildBaseTools, ...sandboxInput } = input;
|
|
31
|
+
return {
|
|
32
|
+
buildLocalTools(taskContext) {
|
|
33
|
+
localToolsPromise ??= (async () => {
|
|
34
|
+
const baseTools = buildBaseTools(taskContext);
|
|
35
|
+
const sandboxSource = await prepareHostedRootSandboxToolSource({
|
|
36
|
+
...sandboxInput,
|
|
37
|
+
getProjectId: () => taskContext.projectId,
|
|
38
|
+
});
|
|
39
|
+
closeRuntime = sandboxSource.closeRuntime;
|
|
40
|
+
return {
|
|
41
|
+
...baseTools,
|
|
42
|
+
...sandboxSource.tools,
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
return localToolsPromise;
|
|
46
|
+
},
|
|
47
|
+
cleanup() {
|
|
48
|
+
cleanupPromise ??= (async () => {
|
|
49
|
+
try {
|
|
50
|
+
await localToolsPromise;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// Setup errors remain owned by the caller; cleanup only releases any
|
|
54
|
+
// handle that setup managed to establish before failing.
|
|
55
|
+
}
|
|
56
|
+
await closeRuntime?.();
|
|
57
|
+
})();
|
|
58
|
+
return cleanupPromise;
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-essential-tools.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/runtime-essential-tools.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,MAAM,6BAA6B,GAAG,SAAS,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAE3F,gEAAgE;AAChE,MAAM,MAAM,yCAAyC,GAAG;IACtD,gBAAgB,CAAC,EAAE,6BAA6B,CAAC;IACjD,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,gGAAgG;IAChG,qCAAqC,CAAC,EAAE,OAAO,CAAC;CACjD,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-essential-tools.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/runtime-essential-tools.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,MAAM,6BAA6B,GAAG,SAAS,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;AAE3F,gEAAgE;AAChE,MAAM,MAAM,yCAAyC,GAAG;IACtD,gBAAgB,CAAC,EAAE,6BAA6B,CAAC;IACjD,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,gGAAgG;IAChG,qCAAqC,CAAC,EAAE,OAAO,CAAC;CACjD,CAAC;AAWF,8CAA8C;AAC9C,wBAAgB,sCAAsC,CACpD,SAAS,EAAE,6BAA6B,GAAG,SAAS,GACnD,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAM5B;AAED,iFAAiF;AACjF,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,yCAAyC,GAC/C,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CA0C5B"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
const SKILL_RUNTIME_TOOL_NAMES = ["load_skill", "load_skill_reference"];
|
|
2
2
|
const SKILL_DELEGATION_TOOL_NAMES = ["invoke_agent"];
|
|
3
|
+
/**
|
|
4
|
+
* Tool discovery tools are unconditionally essential: they must never be
|
|
5
|
+
* truncated by the provider cap, regardless of skill availability.
|
|
6
|
+
*/
|
|
7
|
+
const TOOL_DISCOVERY_TOOL_NAMES = ["search_tools", "load_tools"];
|
|
3
8
|
/** Normalize hosted runtime allowed tools. */
|
|
4
9
|
export function normalizeHostedRuntimeAllowedToolNames(toolNames) {
|
|
5
10
|
if (!toolNames) {
|
|
@@ -14,11 +19,23 @@ export function resolveHostedRuntimeAllowedToolNames(input) {
|
|
|
14
19
|
(allowedToolNames.size === 0 && !input.includeRuntimeEssentialToolsWhenEmpty)) {
|
|
15
20
|
return allowedToolNames;
|
|
16
21
|
}
|
|
17
|
-
if (!input.availableSkillIds?.length) {
|
|
18
|
-
return allowedToolNames;
|
|
19
|
-
}
|
|
20
22
|
const localToolNames = new Set(input.localToolNames);
|
|
21
23
|
const resolvedToolNames = new Set(allowedToolNames);
|
|
24
|
+
// Tool discovery is essential only when the agent already has at least one
|
|
25
|
+
// tool in its resolved set. Under deny-all (empty allowedToolNames), discovery
|
|
26
|
+
// tools are intentionally excluded: activating new tools is a broader
|
|
27
|
+
// capability than running pre-configured skills (load_skill), so the two are
|
|
28
|
+
// treated asymmetrically when allowedToolNames is empty.
|
|
29
|
+
if (resolvedToolNames.size > 0) {
|
|
30
|
+
for (const toolName of TOOL_DISCOVERY_TOOL_NAMES) {
|
|
31
|
+
if (localToolNames.has(toolName)) {
|
|
32
|
+
resolvedToolNames.add(toolName);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (!input.availableSkillIds?.length) {
|
|
37
|
+
return resolvedToolNames;
|
|
38
|
+
}
|
|
22
39
|
for (const toolName of SKILL_RUNTIME_TOOL_NAMES) {
|
|
23
40
|
if (localToolNames.has(toolName)) {
|
|
24
41
|
resolvedToolNames.add(toolName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"veryfront-cloud-agent-service.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/veryfront-cloud-agent-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAqB9E,OAAO,EAGL,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAqB7B,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"veryfront-cloud-agent-service.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/veryfront-cloud-agent-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAqB9E,OAAO,EAGL,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAqB7B,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAoBzE,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAA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KrF;AAED,iDAAiD;AACjD,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,2BAA2B,CAAC,+CAA+C,CAAC,CAAC,CAgBvF;AAED,4BAA4B;AAC5B,wBAAsB,iBAAiB,CACrC,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,IAAI,CAAC,CAiDf"}
|
|
@@ -25,6 +25,7 @@ import { createHostedWebFetchTool } from "./web-fetch-tool.js";
|
|
|
25
25
|
import { createHostedAgentProjectSteering, } from "./agent-project-steering.js";
|
|
26
26
|
import { createLiveStudioMcpTools } from "../project/live-studio-mcp-tools.js";
|
|
27
27
|
import { createDefaultHostedChatRuntime, } from "./default-chat-runtime.js";
|
|
28
|
+
import { createHostedRootLocalToolRuntime } from "./root-sandbox-tool-source.js";
|
|
28
29
|
import { createVeryfrontCloudContextSummaryGenerator } from "./context-summary-generator.js";
|
|
29
30
|
import { createDefaultHostedInvokeAgentTool } from "./default-invoke-agent-tool.js";
|
|
30
31
|
import { createDefaultHostedProjectSteeringRefresh, fetchDefaultHostedProjectSteering, } from "./default-project-steering-refresh.js";
|
|
@@ -421,6 +422,13 @@ function createProjectSteeringRefresh(context) {
|
|
|
421
422
|
function createAgentRuntime(context, options) {
|
|
422
423
|
const config = context.infrastructure.getConfig();
|
|
423
424
|
const refreshSystem = createProjectSteeringRefresh(context);
|
|
425
|
+
const localToolRuntime = createHostedRootLocalToolRuntime({
|
|
426
|
+
allowedToolNames: options.allowedTools,
|
|
427
|
+
apiUrl: config.VERYFRONT_API_URL,
|
|
428
|
+
authToken: options.authToken,
|
|
429
|
+
createBashTool: context.options.createBashTool,
|
|
430
|
+
buildBaseTools: (taskContext) => buildLocalTools(context, options, taskContext),
|
|
431
|
+
});
|
|
424
432
|
return createDefaultHostedChatRuntime({
|
|
425
433
|
options,
|
|
426
434
|
config: {
|
|
@@ -429,7 +437,8 @@ function createAgentRuntime(context, options) {
|
|
|
429
437
|
studioMcpUrl: config.VERYFRONT_STUDIO_MCP_URL,
|
|
430
438
|
mcpServers: resolveMcpServers(context.options),
|
|
431
439
|
},
|
|
432
|
-
buildLocalTools:
|
|
440
|
+
buildLocalTools: localToolRuntime.buildLocalTools,
|
|
441
|
+
cleanup: localToolRuntime.cleanup,
|
|
433
442
|
refreshSystem,
|
|
434
443
|
onSteeringMutation: async ({ mutation, taskContext }) => {
|
|
435
444
|
if (mutation.skillsChanged) {
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @module agent/react
|
|
5
5
|
*/
|
|
6
6
|
export { useChat } from "./use-chat/index.js";
|
|
7
|
-
export type { BranchInfo, ChatDynamicToolPart, ChatFilePart, ChatFinishReason, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatStreamEvent, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./use-chat/index.js";
|
|
7
|
+
export type { BranchInfo, ChatDynamicToolPart, ChatFilePart, ChatFinishReason, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStatus, ChatStepPart, ChatStreamEvent, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./use-chat/index.js";
|
|
8
8
|
export { useAgent } from "./use-agent.js";
|
|
9
9
|
export type { UseAgentOptions, UseAgentResult } from "./use-agent.js";
|
|
10
|
-
export { getAgentPromptSuggestions, normalizeAgentMetadata, normalizeAgentMetadataResponse, useAgentMetadata, } from "./use-agent-metadata.js";
|
|
11
|
-
export type { AgentMetadata, AgentMetadataPromptSuggestion, AgentMetadataSuggestion, AgentMetadataSuggestions, AgentMetadataTaskSuggestion, UseAgentMetadataResult, } from "./use-agent-metadata.js";
|
|
10
|
+
export { getAgentPromptSuggestionItems, getAgentPromptSuggestions, normalizeAgentMetadata, normalizeAgentMetadataResponse, useAgentMetadata, } from "./use-agent-metadata.js";
|
|
11
|
+
export type { AgentMetadata, AgentMetadataPromptSuggestion, AgentMetadataSuggestion, AgentMetadataSuggestions, AgentMetadataTaskSuggestion, PromptSuggestion, UseAgentMetadataResult, } from "./use-agent-metadata.js";
|
|
12
12
|
export { normalizeAgentsListResponse, useAgents } from "./use-agents.js";
|
|
13
13
|
export type { UseAgentsOptions, UseAgentsResult } from "./use-agents.js";
|
|
14
14
|
export { useCompletion } from "./use-completion.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/react/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,8BAA8B,EAC9B,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,aAAa,EACb,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,2BAA2B,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACzE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,oBAAoB,E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qB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { useChat } from "./use-chat/index.js";
|
|
7
7
|
export { useAgent } from "./use-agent.js";
|
|
8
|
-
export { getAgentPromptSuggestions, normalizeAgentMetadata, normalizeAgentMetadataResponse, useAgentMetadata, } from "./use-agent-metadata.js";
|
|
8
|
+
export { getAgentPromptSuggestionItems, getAgentPromptSuggestions, normalizeAgentMetadata, normalizeAgentMetadataResponse, useAgentMetadata, } from "./use-agent-metadata.js";
|
|
9
9
|
export { normalizeAgentsListResponse, useAgents } from "./use-agents.js";
|
|
10
10
|
export { useCompletion } from "./use-completion.js";
|
|
11
11
|
export { useStreaming } from "./use-streaming.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Source-defined prompt suggestion shown by chat surfaces. */
|
|
2
2
|
export type AgentMetadataPromptSuggestion = {
|
|
3
3
|
type: "prompt";
|
|
4
|
-
title
|
|
4
|
+
title?: string;
|
|
5
5
|
prompt: string;
|
|
6
6
|
} | {
|
|
7
7
|
id: string;
|
|
@@ -42,6 +42,23 @@ export declare function normalizeAgentMetadata(value: unknown): AgentMetadata;
|
|
|
42
42
|
export declare function normalizeAgentMetadataResponse(value: unknown): AgentMetadata;
|
|
43
43
|
/** Return prompt text suggestions that the current Chat component can render. */
|
|
44
44
|
export declare function getAgentPromptSuggestions(agent: AgentMetadata | null): string[];
|
|
45
|
+
/**
|
|
46
|
+
* A prompt suggestion normalized for rendering: the short `label` shown on the
|
|
47
|
+
* chip and the full `prompt` sent when it is clicked.
|
|
48
|
+
*/
|
|
49
|
+
export interface PromptSuggestion {
|
|
50
|
+
/** Short chip label — the agent's `title`, falling back to the prompt. */
|
|
51
|
+
label: string;
|
|
52
|
+
/** Full text sent to the agent when the chip is clicked. */
|
|
53
|
+
prompt: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Normalize an agent's prompt suggestions to `{ label, prompt }[]`, ready to
|
|
57
|
+
* render — the chip shows the short `title` while the click sends the full
|
|
58
|
+
* `prompt`. Saves consumers from flat-mapping `agent.suggestions.suggestions`
|
|
59
|
+
* and reconciling the `title`/`prompt` fields themselves.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getAgentPromptSuggestionItems(agent: AgentMetadata | null): PromptSuggestion[];
|
|
45
62
|
/** React hook for browser-safe source-defined agent metadata. */
|
|
46
63
|
export declare function useAgentMetadata(agentId: string | null | undefined): UseAgentMetadataResult;
|
|
47
64
|
//# sourceMappingURL=use-agent-metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agent-metadata.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/react/use-agent-metadata.ts"],"names":[],"mappings":"AAGA,+DAA+D;AAC/D,MAAM,MAAM,6BAA6B,GACrC;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"use-agent-metadata.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/react/use-agent-metadata.ts"],"names":[],"mappings":"AAGA,+DAA+D;AAC/D,MAAM,MAAM,6BAA6B,GACrC;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,GACC;IACA,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEJ,6DAA6D;AAC7D,MAAM,MAAM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AG,IAAI,GAAG,SAAS,GAAG,sBAAsB,CAkD3F"}
|
|
@@ -93,6 +93,25 @@ export function getAgentPromptSuggestions(agent) {
|
|
|
93
93
|
return [suggestion.prompt];
|
|
94
94
|
}) ?? [];
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Normalize an agent's prompt suggestions to `{ label, prompt }[]`, ready to
|
|
98
|
+
* render — the chip shows the short `title` while the click sends the full
|
|
99
|
+
* `prompt`. Saves consumers from flat-mapping `agent.suggestions.suggestions`
|
|
100
|
+
* and reconciling the `title`/`prompt` fields themselves.
|
|
101
|
+
*/
|
|
102
|
+
export function getAgentPromptSuggestionItems(agent) {
|
|
103
|
+
const list = agent?.suggestions?.suggestions;
|
|
104
|
+
if (!Array.isArray(list))
|
|
105
|
+
return [];
|
|
106
|
+
return list.flatMap((suggestion) => {
|
|
107
|
+
if (suggestion.type !== "prompt" || !("prompt" in suggestion) || !suggestion.prompt) {
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
const title = suggestion.title;
|
|
111
|
+
const label = typeof title === "string" && title.length > 0 ? title : suggestion.prompt;
|
|
112
|
+
return [{ label, prompt: suggestion.prompt }];
|
|
113
|
+
});
|
|
114
|
+
}
|
|
96
115
|
/** React hook for browser-safe source-defined agent metadata. */
|
|
97
116
|
export function useAgentMetadata(agentId) {
|
|
98
117
|
const [agent, setAgent] = useState(null);
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* Build any interface you want.
|
|
6
6
|
*/
|
|
7
7
|
export { useChat } from "./use-chat.js";
|
|
8
|
-
export type { BranchInfo, ChatDynamicToolPart, ChatFilePart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./types.js";
|
|
8
|
+
export type { BranchInfo, ChatDynamicToolPart, ChatFilePart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStatus, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./types.js";
|
|
9
9
|
export type { ChatFinishReason, ChatStreamEvent, } from "./stream-protocol.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,sBAAsB,CAAC"}
|