@datalayer/agent-runtimes 0.0.5 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -22
- package/lib/components/chat/components/AgentDetails.d.ts +15 -2
- package/lib/components/chat/components/AgentDetails.js +9 -93
- package/lib/components/chat/components/AgentIdentity.d.ts +92 -0
- package/lib/components/chat/components/AgentIdentity.js +318 -0
- package/lib/components/chat/components/Chat.d.ts +24 -1
- package/lib/components/chat/components/Chat.js +41 -19
- package/lib/components/chat/components/ChatFloating.d.ts +6 -1
- package/lib/components/chat/components/ChatFloating.js +12 -6
- package/lib/components/chat/components/ContextDistribution.d.ts +47 -0
- package/lib/components/chat/components/ContextDistribution.js +146 -0
- package/lib/components/chat/components/ContextUsage.d.ts +33 -0
- package/lib/components/chat/components/ContextUsage.js +127 -0
- package/lib/components/chat/components/base/ChatBase.d.ts +51 -1
- package/lib/components/chat/components/base/ChatBase.js +278 -74
- package/lib/components/chat/components/display/ToolCallDisplay.d.ts +16 -2
- package/lib/components/chat/components/display/ToolCallDisplay.js +148 -6
- package/lib/components/chat/components/display/index.d.ts +1 -1
- package/lib/components/chat/components/display/index.js +1 -1
- package/lib/components/chat/components/elements/ChatInputPrompt.d.ts +12 -1
- package/lib/components/chat/components/elements/ChatInputPrompt.js +8 -3
- package/lib/components/chat/components/index.d.ts +3 -0
- package/lib/components/chat/components/index.js +3 -0
- package/lib/components/chat/components/parts/ToolPart.d.ts +1 -1
- package/lib/components/chat/components/parts/ToolPart.js +142 -6
- package/lib/components/chat/index.d.ts +1 -1
- package/lib/components/chat/index.js +1 -1
- package/lib/components/chat/protocols/A2AAdapter.d.ts +9 -0
- package/lib/components/chat/protocols/A2AAdapter.js +13 -2
- package/lib/components/chat/protocols/ACPAdapter.d.ts +9 -0
- package/lib/components/chat/protocols/ACPAdapter.js +13 -2
- package/lib/components/chat/protocols/AGUIAdapter.d.ts +9 -0
- package/lib/components/chat/protocols/AGUIAdapter.js +19 -1
- package/lib/components/chat/protocols/VercelAIAdapter.d.ts +7 -0
- package/lib/components/chat/protocols/VercelAIAdapter.js +19 -0
- package/lib/components/chat/types/execution.d.ts +78 -0
- package/lib/components/chat/types/execution.js +64 -0
- package/lib/components/chat/types/index.d.ts +1 -0
- package/lib/components/chat/types/index.js +1 -0
- package/lib/components/chat/types/protocol.d.ts +9 -0
- package/lib/components/ui/pagination.d.ts +2 -2
- package/lib/components/ui/pagination.js +4 -4
- package/lib/components/ui/resizable.d.ts +4 -4
- package/lib/components/ui/resizable.js +4 -4
- package/lib/examples/A2UiRestaurantExample.js +2 -2
- package/lib/examples/AgUiAgenticExample.js +2 -2
- package/lib/examples/AgUiBackendToolRenderingExample.js +2 -2
- package/lib/examples/AgUiHaikuGenUIExample.js +2 -2
- package/lib/examples/AgUiHumanInTheLoopExample.js +2 -2
- package/lib/examples/AgUiSharedStateExample.js +2 -2
- package/lib/examples/AgUiToolsBasedGenUIExample.js +2 -2
- package/lib/examples/AgentRuntimeCustomExample.js +2 -2
- package/lib/examples/AgentRuntimeLexical2Example.js +2 -1
- package/lib/examples/AgentRuntimeLexicalExample.js +5 -2
- package/lib/examples/AgentRuntimeLexicalSidebarExample.js +4 -2
- package/lib/examples/AgentRuntimeNotebookExample.js +1 -1
- package/lib/examples/AgentRuntimeStandaloneExample.js +2 -2
- package/lib/examples/AgentSpaceFormExample.d.ts +70 -2
- package/lib/examples/AgentSpaceFormExample.js +204 -35
- package/lib/examples/CopilotKitLexicalExample.js +2 -1
- package/lib/examples/components/AgentConfiguration.d.ts +37 -0
- package/lib/examples/components/AgentConfiguration.js +239 -8
- package/lib/examples/components/Header.d.ts +0 -2
- package/lib/examples/components/Header.js +2 -16
- package/lib/examples/components/LexicalEditor.js +2 -1
- package/lib/examples/components/MockFileBrowser.js +6 -2
- package/lib/examples/components/index.d.ts +0 -1
- package/lib/examples/components/index.js +0 -1
- package/lib/examples/example-selector.js +0 -1
- package/lib/examples/index.d.ts +0 -1
- package/lib/examples/index.js +0 -1
- package/lib/examples/lexical/editorConfig.d.ts +3 -2
- package/lib/examples/lexical/editorConfig.js +7 -1
- package/lib/examples/lexical/initial-content.json +2210 -0
- package/lib/examples/main.js +15 -1
- package/lib/identity/IdentityConnect.d.ts +90 -0
- package/lib/identity/IdentityConnect.js +316 -0
- package/lib/identity/OAuthCallback.d.ts +58 -0
- package/lib/identity/OAuthCallback.js +223 -0
- package/lib/identity/dcr.d.ts +257 -0
- package/lib/identity/dcr.js +282 -0
- package/lib/identity/identityStore.d.ts +72 -0
- package/lib/identity/identityStore.js +529 -0
- package/lib/identity/index.d.ts +46 -0
- package/lib/identity/index.js +17 -0
- package/lib/identity/pkce.d.ts +30 -0
- package/lib/identity/pkce.js +65 -0
- package/lib/identity/types.d.ts +293 -0
- package/lib/identity/types.js +73 -0
- package/lib/identity/useIdentity.d.ts +108 -0
- package/lib/identity/useIdentity.js +323 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/lib/utils.js +1 -1
- package/lib/renderers/a2ui/lib/utils.js +1 -1
- package/lib/runtime/index.d.ts +35 -0
- package/lib/runtime/index.js +40 -0
- package/lib/runtime/runtimeStore.d.ts +77 -0
- package/lib/runtime/runtimeStore.js +184 -0
- package/lib/runtime/types.d.ts +84 -0
- package/lib/runtime/types.js +15 -0
- package/lib/runtime/useAgentConnection.d.ts +46 -0
- package/lib/runtime/useAgentConnection.js +112 -0
- package/lib/runtime/useAgentRuntime.d.ts +94 -0
- package/lib/runtime/useAgentRuntime.js +125 -0
- package/lib/test-setup.d.ts +1 -1
- package/lib/test-setup.js +1 -0
- package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.js +32 -1
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.d.ts +6 -0
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.js +16 -17
- package/package.json +20 -7
- package/patches/@datalayer+jupyter-lexical+1.0.8.patch +11628 -0
- package/patches/@datalayer+jupyter-react+2.0.2.patch +5338 -0
- package/lib/examples/AgentSpaceHomeExample.d.ts +0 -8
- package/lib/examples/AgentSpaceHomeExample.js +0 -171
- package/lib/examples/components/AgentsDataTable.d.ts +0 -13
- package/lib/examples/components/AgentsDataTable.js +0 -74
- package/lib/examples/components/Rating.d.ts +0 -14
- package/lib/examples/components/Rating.js +0 -12
|
@@ -38,6 +38,34 @@ function isRecentDuplicate(toolName, params) {
|
|
|
38
38
|
executionCache.set(signature, Date.now());
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Process parameters to handle JSON strings that should be objects
|
|
43
|
+
* LLMs sometimes generate JSON strings instead of objects for nested parameters
|
|
44
|
+
*/
|
|
45
|
+
function processParameters(params) {
|
|
46
|
+
if (!params || typeof params !== 'object' || Array.isArray(params)) {
|
|
47
|
+
return params;
|
|
48
|
+
}
|
|
49
|
+
const processed = {};
|
|
50
|
+
for (const [key, value] of Object.entries(params)) {
|
|
51
|
+
// If value is a string that looks like JSON, try to parse it
|
|
52
|
+
if (typeof value === 'string' &&
|
|
53
|
+
(value.startsWith('{') || value.startsWith('['))) {
|
|
54
|
+
try {
|
|
55
|
+
processed[key] = JSON.parse(value);
|
|
56
|
+
console.log(`[agent-runtimes] 📝 Parsed JSON string for parameter '${key}'`);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// If parsing fails, keep the original string
|
|
60
|
+
processed[key] = value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
processed[key] = value;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return processed;
|
|
68
|
+
}
|
|
41
69
|
/**
|
|
42
70
|
* Converts unified tool definition to agent-runtimes tool format
|
|
43
71
|
*
|
|
@@ -67,8 +95,11 @@ export function createAgentRuntimesTool(definition, operation, context) {
|
|
|
67
95
|
};
|
|
68
96
|
}
|
|
69
97
|
try {
|
|
98
|
+
// Process parameters to handle JSON strings
|
|
99
|
+
const processedParams = processParameters(params);
|
|
100
|
+
console.log(`[agent-runtimes] Processed params:`, processedParams);
|
|
70
101
|
// Use OperationRunner to execute operation with TOON format
|
|
71
|
-
const result = await runner.execute(operation,
|
|
102
|
+
const result = await runner.execute(operation, processedParams, {
|
|
72
103
|
...context,
|
|
73
104
|
format: 'toon', // Return human/LLM-readable string
|
|
74
105
|
});
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React hooks for agent-runtimes lexical tool registration.
|
|
3
|
+
* Provides: useLexicalTools hook for ChatFloating integration.
|
|
4
|
+
*
|
|
5
|
+
* @module tools/adapters/agent-runtimes/lexicalHooks
|
|
6
|
+
*/
|
|
1
7
|
import type { ToolExecutionContext } from '@datalayer/jupyter-react';
|
|
2
8
|
import { type AgentRuntimesTool } from './AgentRuntimesToolAdapter';
|
|
3
9
|
/**
|
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
* React hooks for agent-runtimes lexical tool registration.
|
|
7
|
-
* Provides: useLexicalTools hook for ChatFloating integration.
|
|
8
|
-
*
|
|
9
|
-
* @module tools/adapters/agent-runtimes/lexicalHooks
|
|
10
|
-
*/
|
|
11
|
-
import { useMemo } from 'react';
|
|
12
5
|
import { useLexicalStore, DefaultExecutor as LexicalDefaultExecutor, lexicalToolDefinitions, lexicalToolOperations, } from '@datalayer/jupyter-lexical';
|
|
13
6
|
import { createAllAgentRuntimesTools, } from './AgentRuntimesToolAdapter';
|
|
14
7
|
/**
|
|
@@ -32,19 +25,25 @@ import { createAllAgentRuntimesTools, } from './AgentRuntimesToolAdapter';
|
|
|
32
25
|
* ```
|
|
33
26
|
*/
|
|
34
27
|
export function useLexicalTools(documentId, contextOverrides) {
|
|
35
|
-
|
|
28
|
+
console.log('[useLexicalTools] 🎣 Hook called with documentId:', documentId);
|
|
29
|
+
// Get fresh store state every render - NO MEMOIZATION
|
|
30
|
+
// This ensures we always use the latest patched methods after hot reload
|
|
36
31
|
const lexicalStoreState = useLexicalStore();
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
//
|
|
42
|
-
|
|
32
|
+
console.log('[useLexicalTools] 📦 Store state obtained:', !!lexicalStoreState);
|
|
33
|
+
// Create new executor every render - NO MEMOIZATION
|
|
34
|
+
console.log('[useLexicalTools] 🔧 Creating new executor for documentId:', documentId);
|
|
35
|
+
const executor = new LexicalDefaultExecutor(documentId, lexicalStoreState);
|
|
36
|
+
// Create new context every render - NO MEMOIZATION
|
|
37
|
+
console.log('[useLexicalTools] 📝 Creating context');
|
|
38
|
+
const context = {
|
|
43
39
|
documentId,
|
|
44
40
|
executor,
|
|
45
41
|
format: 'toon',
|
|
46
42
|
...contextOverrides,
|
|
47
|
-
}
|
|
48
|
-
// Create
|
|
49
|
-
|
|
43
|
+
};
|
|
44
|
+
// Create new tools array every render - NO MEMOIZATION
|
|
45
|
+
console.log('[useLexicalTools] 🛠️ Creating tools array');
|
|
46
|
+
const tools = createAllAgentRuntimesTools(lexicalToolDefinitions, lexicalToolOperations, context);
|
|
47
|
+
console.log('[useLexicalTools] ✅ Created', tools.length, 'tools');
|
|
48
|
+
return tools;
|
|
50
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/agent-runtimes",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"create:patches": "bash scripts/create-patches.sh",
|
|
70
70
|
"examples": "run-p server:start examples:vite",
|
|
71
71
|
"examples:fresh": "npm run clean:cache && npm run examples",
|
|
72
|
+
"examples:codemode-mcp": "EXAMPLE=AgentCodemodeMcpExample VITE_APP_TARGET=examples VITE_DATALAYER_RUN_URL=http://localhost:8888 vite",
|
|
72
73
|
"examples:nextjs": "npm run dev --workspace=nextjs-notebook-example",
|
|
73
74
|
"examples:vite": "VITE_APP_TARGET=examples VITE_DATALAYER_RUN_URL=http://localhost:8888 vite",
|
|
74
75
|
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,json,md}\" \"examples/**/*.{js,jsx,ts,tsx,css,json,md,mjs}\"",
|
|
@@ -88,7 +89,7 @@
|
|
|
88
89
|
"preview": "vite preview",
|
|
89
90
|
"rebuild:fresh": "npm run create:patches && npm install && npm run build && npm run clean:cache",
|
|
90
91
|
"server": "python -m agent_runtimes",
|
|
91
|
-
"server:start": "python -m agent_runtimes --port 8765 --reload --debug",
|
|
92
|
+
"server:start": "PYTHONIOENCODING=utf-8 python -m agent_runtimes --port 8765 --reload --debug",
|
|
92
93
|
"showcase:vercel-ai-elements": "VITE_APP_TARGET=showcase-vercel-ai-elements vite",
|
|
93
94
|
"start": "vite",
|
|
94
95
|
"start:acp": "run-p server:start start:acp:vite",
|
|
@@ -122,10 +123,10 @@
|
|
|
122
123
|
"@agentclientprotocol/sdk": "^0.8.0",
|
|
123
124
|
"@ai-sdk/react": "3.0.30",
|
|
124
125
|
"@anthropic-ai/sdk": "^0.52.0",
|
|
125
|
-
"@datalayer/core": "^0.0.
|
|
126
|
+
"@datalayer/core": "^0.0.25",
|
|
126
127
|
"@datalayer/icons-react": "^1.0.6",
|
|
127
|
-
"@datalayer/jupyter-lexical": "^1.0.
|
|
128
|
-
"@datalayer/jupyter-react": "^2.0.
|
|
128
|
+
"@datalayer/jupyter-lexical": "^1.0.9",
|
|
129
|
+
"@datalayer/jupyter-react": "^2.0.3",
|
|
129
130
|
"@datalayer/primer-addons": "^1.0.4",
|
|
130
131
|
"@datalayer/primer-rjsf": "^1.0.1",
|
|
131
132
|
"@jupyter-widgets/base-manager": "^1.0.12",
|
|
@@ -145,7 +146,7 @@
|
|
|
145
146
|
"@lumino/disposable": "^2.1.5",
|
|
146
147
|
"@lumino/polling": "^2.1.5",
|
|
147
148
|
"@lumino/signaling": "^2.1.5",
|
|
148
|
-
"@lumino/widgets": "^2.7.
|
|
149
|
+
"@lumino/widgets": "^2.7.3",
|
|
149
150
|
"@mcp-ui/client": "^5.17.1",
|
|
150
151
|
"@modelcontextprotocol/ext-apps": "^0.2.2",
|
|
151
152
|
"@primer/behaviors": "^1.8.4",
|
|
@@ -159,17 +160,24 @@
|
|
|
159
160
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
160
161
|
"@radix-ui/react-aspect-ratio": "^1.1.8",
|
|
161
162
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
163
|
+
"@radix-ui/react-checkbox": "^1.3.3",
|
|
162
164
|
"@radix-ui/react-collapsible": "^1.1.12",
|
|
165
|
+
"@radix-ui/react-context-menu": "^2.2.16",
|
|
163
166
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
164
167
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
165
168
|
"@radix-ui/react-hover-card": "^1.1.15",
|
|
169
|
+
"@radix-ui/react-icons": "^1.3.2",
|
|
170
|
+
"@radix-ui/react-label": "^2.1.8",
|
|
166
171
|
"@radix-ui/react-menubar": "^1.1.16",
|
|
167
172
|
"@radix-ui/react-navigation-menu": "^1.2.14",
|
|
168
173
|
"@radix-ui/react-progress": "^1.1.8",
|
|
174
|
+
"@radix-ui/react-radio-group": "^1.3.8",
|
|
169
175
|
"@radix-ui/react-scroll-area": "^1.2.10",
|
|
170
176
|
"@radix-ui/react-select": "^2.2.6",
|
|
171
177
|
"@radix-ui/react-separator": "^1.1.8",
|
|
178
|
+
"@radix-ui/react-slider": "^1.3.6",
|
|
172
179
|
"@radix-ui/react-slot": "^1.2.4",
|
|
180
|
+
"@radix-ui/react-switch": "^1.2.6",
|
|
173
181
|
"@radix-ui/react-toast": "^1.2.15",
|
|
174
182
|
"@radix-ui/react-toggle-group": "^1.1.11",
|
|
175
183
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
@@ -183,6 +191,7 @@
|
|
|
183
191
|
"ansi-to-html": "^0.7.2",
|
|
184
192
|
"axios": "^1.7.7",
|
|
185
193
|
"boring-avatars": "^2.0.1",
|
|
194
|
+
"class-variance-authority": "^0.7.1",
|
|
186
195
|
"cmdk": "^1.1.1",
|
|
187
196
|
"date-fns": "^2.29.3",
|
|
188
197
|
"deepmerge": "^4.3.1",
|
|
@@ -199,14 +208,16 @@
|
|
|
199
208
|
"mock-socket": "^9.3.1",
|
|
200
209
|
"motion": "^12.23.26",
|
|
201
210
|
"nanoid": "^5.1.6",
|
|
211
|
+
"next-themes": "^0.4.6",
|
|
202
212
|
"react": "18.3.1",
|
|
203
213
|
"react-confetti": "^6.4.0",
|
|
204
214
|
"react-dom": "18.3.1",
|
|
205
215
|
"react-hook-form": "^7.69.0",
|
|
206
216
|
"react-is": "^19.2.0",
|
|
217
|
+
"react-resizable-panels": "^4.4.1",
|
|
207
218
|
"react-router-dom": "^6.0.0",
|
|
208
219
|
"react-toastify": "^11.0.5",
|
|
209
|
-
"recharts": "^3.
|
|
220
|
+
"recharts": "^3.7.0",
|
|
210
221
|
"shiki": "^3.20.0",
|
|
211
222
|
"sonner": "^2.0.7",
|
|
212
223
|
"streamdown": "^1.6.10",
|
|
@@ -240,6 +251,8 @@
|
|
|
240
251
|
"@storybook/builder-vite": "^9.1.1",
|
|
241
252
|
"@storybook/react-vite": "^9.1.1",
|
|
242
253
|
"@tailwindcss/postcss": "^4.1.16",
|
|
254
|
+
"@testing-library/react": "^16.3.0",
|
|
255
|
+
"@testing-library/jest-dom": "^6.4.8",
|
|
243
256
|
"@types/node": "^20.11.0",
|
|
244
257
|
"@types/react": "18.3.20",
|
|
245
258
|
"@types/react-dom": "18.3.6",
|