@datalayer/agent-runtimes 0.0.2 → 0.0.4
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/lib/components/chat/components/AgentDetails.js +65 -2
- package/lib/components/chat/components/ChatFloating.d.ts +13 -3
- package/lib/components/chat/components/ChatFloating.js +20 -9
- package/lib/components/chat/components/base/ChatBase.d.ts +25 -0
- package/lib/components/chat/components/base/ChatBase.js +208 -18
- package/lib/components/chat/components/index.d.ts +1 -1
- package/lib/components/chat/components/parts/TextPart.js +5 -1
- package/lib/components/chat/index.d.ts +1 -1
- package/lib/components/chat/protocols/A2AAdapter.d.ts +2 -0
- package/lib/components/chat/protocols/A2AAdapter.js +9 -0
- package/lib/components/chat/protocols/ACPAdapter.d.ts +2 -0
- package/lib/components/chat/protocols/ACPAdapter.js +13 -0
- package/lib/components/chat/protocols/AGUIAdapter.d.ts +2 -0
- package/lib/components/chat/protocols/AGUIAdapter.js +5 -0
- package/lib/components/chat/protocols/BaseProtocolAdapter.d.ts +2 -0
- package/lib/components/chat/protocols/VercelAIAdapter.d.ts +6 -0
- package/lib/components/chat/protocols/VercelAIAdapter.js +10 -0
- package/lib/components/chat/types/protocol.d.ts +4 -0
- package/lib/examples/AgentRuntimeCustomExample.d.ts +2 -1
- package/lib/examples/AgentRuntimeCustomExample.js +120 -5
- package/lib/examples/AgentRuntimeLexicalExample.js +1 -1
- package/lib/examples/components/AgentConfiguration.d.ts +22 -0
- package/lib/examples/components/AgentConfiguration.js +39 -3
- package/lib/examples/components/index.d.ts +1 -1
- package/lib/hooks/useNotebookAIAgent.d.ts +2 -2
- package/lib/hooks/useNotebookAIAgent.js +26 -9
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/state/substates/AIAgentState.d.ts +80 -10
- package/lib/state/substates/AIAgentState.js +89 -23
- package/lib/stubs/keytar.d.ts +30 -0
- package/lib/stubs/keytar.js +28 -0
- package/package.json +9 -7
- package/style/base.css +1 -43
|
@@ -4,39 +4,105 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { createStore } from 'zustand/vanilla';
|
|
6
6
|
import { useStore } from 'zustand';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
8
|
+
export const agentStore = createStore()(persist((set, get) => ({
|
|
9
|
+
agents: [],
|
|
10
|
+
upsertAgent: agentData => {
|
|
11
|
+
set(state => {
|
|
12
|
+
const existingIndex = state.agents.findIndex(a => a.id === agentData.id);
|
|
13
|
+
const now = Date.now();
|
|
14
|
+
if (existingIndex >= 0) {
|
|
15
|
+
// Update existing agent
|
|
16
|
+
const updatedAgents = [...state.agents];
|
|
17
|
+
updatedAgents[existingIndex] = {
|
|
18
|
+
...updatedAgents[existingIndex],
|
|
19
|
+
...agentData,
|
|
20
|
+
lastUpdated: now,
|
|
21
|
+
};
|
|
22
|
+
return { agents: updatedAgents };
|
|
13
23
|
}
|
|
14
24
|
else {
|
|
15
|
-
|
|
25
|
+
// Add new agent
|
|
26
|
+
const newAgent = {
|
|
27
|
+
name: agentData.name || agentData.id,
|
|
28
|
+
description: agentData.description || '',
|
|
29
|
+
status: agentData.status || 'initializing',
|
|
30
|
+
lastUpdated: now,
|
|
31
|
+
...agentData,
|
|
32
|
+
};
|
|
33
|
+
return { agents: [...state.agents, newAgent] };
|
|
16
34
|
}
|
|
17
35
|
});
|
|
18
36
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
37
|
+
getAgentById: (id) => {
|
|
38
|
+
const { agents } = get();
|
|
39
|
+
return agents.find(agent => agent.id === id);
|
|
40
|
+
},
|
|
41
|
+
getAgentByUrl: (baseUrl, transport) => {
|
|
42
|
+
const { agents } = get();
|
|
43
|
+
return agents.find(agent => agent.baseUrl === baseUrl && agent.transport === transport);
|
|
25
44
|
},
|
|
26
|
-
|
|
27
|
-
set(
|
|
28
|
-
const index = state.
|
|
45
|
+
updateAgentStatus: (id, status, error = null) => {
|
|
46
|
+
set(state => {
|
|
47
|
+
const index = state.agents.findIndex(a => a.id === id);
|
|
29
48
|
if (index >= 0) {
|
|
30
|
-
state.
|
|
31
|
-
|
|
49
|
+
const updatedAgents = [...state.agents];
|
|
50
|
+
updatedAgents[index] = {
|
|
51
|
+
...updatedAgents[index],
|
|
52
|
+
status,
|
|
53
|
+
error,
|
|
54
|
+
lastUpdated: Date.now(),
|
|
55
|
+
};
|
|
56
|
+
return { agents: updatedAgents };
|
|
32
57
|
}
|
|
33
|
-
|
|
34
|
-
|
|
58
|
+
return {};
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
toggleAgentStatus: (id) => {
|
|
62
|
+
set(state => {
|
|
63
|
+
const index = state.agents.findIndex(a => a.id === id);
|
|
64
|
+
if (index >= 0) {
|
|
65
|
+
const updatedAgents = [...state.agents];
|
|
66
|
+
const currentStatus = updatedAgents[index].status;
|
|
67
|
+
updatedAgents[index] = {
|
|
68
|
+
...updatedAgents[index],
|
|
69
|
+
status: currentStatus === 'running' ? 'paused' : 'running',
|
|
70
|
+
lastUpdated: Date.now(),
|
|
71
|
+
};
|
|
72
|
+
return { agents: updatedAgents };
|
|
35
73
|
}
|
|
74
|
+
return {};
|
|
36
75
|
});
|
|
37
76
|
},
|
|
77
|
+
deleteAgent: (id) => {
|
|
78
|
+
set(state => ({
|
|
79
|
+
agents: state.agents.filter(a => a.id !== id),
|
|
80
|
+
}));
|
|
81
|
+
},
|
|
82
|
+
clearAgents: () => {
|
|
83
|
+
set({ agents: [] });
|
|
84
|
+
},
|
|
85
|
+
}), {
|
|
86
|
+
name: 'agent-runtimes-storage',
|
|
87
|
+
storage: createJSONStorage(() => localStorage),
|
|
88
|
+
// Only persist essential fields
|
|
89
|
+
partialize: state => ({
|
|
90
|
+
agents: state.agents.map(agent => ({
|
|
91
|
+
id: agent.id,
|
|
92
|
+
name: agent.name,
|
|
93
|
+
description: agent.description,
|
|
94
|
+
baseUrl: agent.baseUrl,
|
|
95
|
+
transport: agent.transport,
|
|
96
|
+
status: agent.status,
|
|
97
|
+
lastUpdated: agent.lastUpdated,
|
|
98
|
+
documentId: agent.documentId,
|
|
99
|
+
runtimeId: agent.runtimeId,
|
|
100
|
+
})),
|
|
101
|
+
}),
|
|
38
102
|
}));
|
|
39
|
-
export function
|
|
40
|
-
return useStore(
|
|
103
|
+
export function useAgentStore(selector) {
|
|
104
|
+
return useStore(agentStore, selector);
|
|
41
105
|
}
|
|
42
|
-
export
|
|
106
|
+
export const aiAgentStore = agentStore;
|
|
107
|
+
export const useAIAgentStore = useAgentStore;
|
|
108
|
+
export default useAgentStore;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub for keytar module in browser environments.
|
|
3
|
+
* keytar is a native Node.js module for system keychain access
|
|
4
|
+
* and cannot run in the browser.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getPassword: (_service: string, _account: string) => Promise<string | null>;
|
|
7
|
+
export declare const setPassword: (_service: string, _account: string, _password: string) => Promise<void>;
|
|
8
|
+
export declare const deletePassword: (_service: string, _account: string) => Promise<boolean>;
|
|
9
|
+
export declare const findPassword: (_service: string) => Promise<string | null>;
|
|
10
|
+
export declare const findCredentials: (_service: string) => Promise<Array<{
|
|
11
|
+
account: string;
|
|
12
|
+
password: string;
|
|
13
|
+
}>>;
|
|
14
|
+
export declare const getPasswordSync: (_service: string, _account: string) => string | null;
|
|
15
|
+
export declare const setPasswordSync: (_service: string, _account: string, _password: string) => void;
|
|
16
|
+
export declare const deletePasswordSync: (_service: string, _account: string) => boolean;
|
|
17
|
+
declare const _default: {
|
|
18
|
+
getPassword: (_service: string, _account: string) => Promise<string | null>;
|
|
19
|
+
setPassword: (_service: string, _account: string, _password: string) => Promise<void>;
|
|
20
|
+
deletePassword: (_service: string, _account: string) => Promise<boolean>;
|
|
21
|
+
findPassword: (_service: string) => Promise<string | null>;
|
|
22
|
+
findCredentials: (_service: string) => Promise<Array<{
|
|
23
|
+
account: string;
|
|
24
|
+
password: string;
|
|
25
|
+
}>>;
|
|
26
|
+
getPasswordSync: (_service: string, _account: string) => string | null;
|
|
27
|
+
setPasswordSync: (_service: string, _account: string, _password: string) => void;
|
|
28
|
+
deletePasswordSync: (_service: string, _account: string) => boolean;
|
|
29
|
+
};
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Stub for keytar module in browser environments.
|
|
7
|
+
* keytar is a native Node.js module for system keychain access
|
|
8
|
+
* and cannot run in the browser.
|
|
9
|
+
*/
|
|
10
|
+
export const getPassword = async (_service, _account) => null;
|
|
11
|
+
export const setPassword = async (_service, _account, _password) => { };
|
|
12
|
+
export const deletePassword = async (_service, _account) => false;
|
|
13
|
+
export const findPassword = async (_service) => null;
|
|
14
|
+
export const findCredentials = async (_service) => [];
|
|
15
|
+
// Sync versions (if any code tries to use them)
|
|
16
|
+
export const getPasswordSync = (_service, _account) => null;
|
|
17
|
+
export const setPasswordSync = (_service, _account, _password) => { };
|
|
18
|
+
export const deletePasswordSync = (_service, _account) => false;
|
|
19
|
+
export default {
|
|
20
|
+
getPassword,
|
|
21
|
+
setPassword,
|
|
22
|
+
deletePassword,
|
|
23
|
+
findPassword,
|
|
24
|
+
findCredentials,
|
|
25
|
+
getPasswordSync,
|
|
26
|
+
setPasswordSync,
|
|
27
|
+
deletePasswordSync,
|
|
28
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/agent-runtimes",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"clean:dist": "rimraf dist",
|
|
66
66
|
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
|
|
67
67
|
"create:patches": "bash scripts/create-patches.sh",
|
|
68
|
-
"examples": "run-p
|
|
68
|
+
"examples": "run-p server:start examples:vite",
|
|
69
69
|
"examples:fresh": "npm run clean:cache && npm run examples",
|
|
70
70
|
"examples:nextjs": "npm run dev --workspace=nextjs-notebook-example",
|
|
71
71
|
"examples:vite": "VITE_APP_TARGET=examples VITE_DATALAYER_RUN_URL=http://localhost:8888 vite",
|
|
@@ -118,9 +118,9 @@
|
|
|
118
118
|
"@ag-ui/encoder": "^0.0.42",
|
|
119
119
|
"@ag-ui/proto": "^0.0.42",
|
|
120
120
|
"@agentclientprotocol/sdk": "^0.8.0",
|
|
121
|
-
"@ai-sdk/react": "
|
|
121
|
+
"@ai-sdk/react": "3.0.30",
|
|
122
122
|
"@anthropic-ai/sdk": "^0.52.0",
|
|
123
|
-
"@datalayer/core": "^0.0.
|
|
123
|
+
"@datalayer/core": "^0.0.24",
|
|
124
124
|
"@datalayer/icons-react": "^1.0.6",
|
|
125
125
|
"@datalayer/jupyter-lexical": "^1.0.6",
|
|
126
126
|
"@datalayer/jupyter-react": "^2.0.0",
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
"@tanstack/react-query": "^5.90.6",
|
|
178
178
|
"@toon-format/toon": "^1.3.0",
|
|
179
179
|
"@xyflow/react": "^12.10.0",
|
|
180
|
-
"ai": "
|
|
180
|
+
"ai": "6.0.28",
|
|
181
181
|
"ansi-to-html": "^0.7.2",
|
|
182
182
|
"axios": "^1.7.7",
|
|
183
183
|
"boring-avatars": "^2.0.1",
|
|
@@ -281,6 +281,7 @@
|
|
|
281
281
|
"vitest": "^3.2.4"
|
|
282
282
|
},
|
|
283
283
|
"resolutions": {
|
|
284
|
+
"@ai-sdk/react": "3.0.30",
|
|
284
285
|
"@microsoft/fast-colors": "5.3.1",
|
|
285
286
|
"@microsoft/fast-components": "2.30.6",
|
|
286
287
|
"@microsoft/fast-element": "1.13.0",
|
|
@@ -290,13 +291,14 @@
|
|
|
290
291
|
"@microsoft/load-themed-styles": "1.10.295",
|
|
291
292
|
"@types/react": "18.3.20",
|
|
292
293
|
"@types/react-dom": "18.3.6",
|
|
293
|
-
"ai": "
|
|
294
|
+
"ai": "6.0.28",
|
|
294
295
|
"pyodide": "0.28.0",
|
|
295
296
|
"react": "18.3.1",
|
|
296
297
|
"react-dom": "18.3.1",
|
|
297
298
|
"typescript": "^5.8.3"
|
|
298
299
|
},
|
|
299
300
|
"overrides": {
|
|
301
|
+
"@ai-sdk/react": "3.0.30",
|
|
300
302
|
"@microsoft/fast-colors": "5.3.1",
|
|
301
303
|
"@microsoft/fast-components": "2.30.6",
|
|
302
304
|
"@microsoft/fast-element": "1.13.0",
|
|
@@ -306,7 +308,7 @@
|
|
|
306
308
|
"@microsoft/load-themed-styles": "1.10.295",
|
|
307
309
|
"@types/react": "18.3.20",
|
|
308
310
|
"@types/react-dom": "18.3.6",
|
|
309
|
-
"ai": "
|
|
311
|
+
"ai": "6.0.28",
|
|
310
312
|
"pyodide": "0.28.0",
|
|
311
313
|
"react": "18.3.1",
|
|
312
314
|
"react-dom": "18.3.1",
|
package/style/base.css
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
/*
|
|
6
7
|
---break---
|
|
7
8
|
*/
|
|
@@ -64,49 +65,6 @@ body {
|
|
|
64
65
|
/* --jp-ui-font-size1: 12px; */
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
.Primer_Brand__Hero-module__Hero___EM3jf {
|
|
68
|
-
padding-top: 88px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
#dla-hero .Primer_Brand__Heading-module__Heading--1___Ufc7G {
|
|
72
|
-
font-size: 62px;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
#dla-hero .Primer_Brand__Grid-module__Grid___q48mT {
|
|
76
|
-
grid-column-gap: 12px !important;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
#dla-hero .Primer_Brand__Text-module__Text___pecHN {
|
|
80
|
-
max-width: 1000px;
|
|
81
|
-
padding-right: 15px;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
#dla-hero .Primer_Brand__Text-module__Text___pecHN {
|
|
85
|
-
line-height: 16px;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/* TODO Check the specificity of this rule */
|
|
89
|
-
.jp-ThemedContainer a {
|
|
90
|
-
color: var(--jp-brand-color1, #1976d2) !important;
|
|
91
|
-
text-decoration: none !important
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.jp-Shout-button {
|
|
95
|
-
height: 30px;
|
|
96
|
-
width: 150px;
|
|
97
|
-
margin: 8px;
|
|
98
|
-
padding-top: 9px;
|
|
99
|
-
text-align: center;
|
|
100
|
-
vertical-align: middle;
|
|
101
|
-
border-radius: 2px;
|
|
102
|
-
background-color: #2296f3;
|
|
103
|
-
color: #212121;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.jp-Shout-summary {
|
|
107
|
-
margin: 4px;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
68
|
/*
|
|
111
69
|
---break---
|
|
112
70
|
*/
|