@datalayer/agent-runtimes 1.3.60 → 1.3.62
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/chat/ChatFloating.js +138 -23
- package/lib/chat/assistant/AssistantStage.d.ts +6 -4
- package/lib/chat/assistant/AssistantStage.js +1 -1
- package/lib/chat/assistant/ConversationBalloon.d.ts +71 -0
- package/lib/chat/assistant/ConversationBalloon.js +102 -0
- package/lib/chat/assistant/SpeechBalloon.d.ts +10 -6
- package/lib/chat/assistant/SpeechBalloon.js +17 -12
- package/lib/chat/assistant/state.d.ts +1 -1
- package/lib/chat/assistant/state.js +1 -1
- package/lib/chat/base/ChatBase.js +22 -4
- package/lib/examples/AgentA2ATeamExample.d.ts +23 -0
- package/lib/examples/AgentA2ATeamExample.js +279 -0
- package/lib/examples/ChatAssistantExample.js +13 -2
- package/lib/examples/ChatAssistantGalleryExample.js +1 -1
- package/lib/examples/LoopStrategyExample.d.ts +12 -0
- package/lib/examples/{AgentStrategyExample.js → LoopStrategyExample.js} +9 -9
- package/lib/examples/example-selector.js +2 -1
- package/lib/examples/index.d.ts +2 -1
- package/lib/examples/index.js +2 -1
- package/lib/examples/main.js +3 -3
- package/lib/hooks/useA2A.d.ts +37 -1
- package/lib/loop/plugins/assistant/index.js +9 -1
- package/lib/runtimes/__tests__/fixtures/accounting-agent-card.json +60 -0
- package/lib/runtimes/browser/a2aPeer.d.ts +93 -0
- package/lib/runtimes/browser/a2aPeer.js +241 -0
- package/lib/specs/actions.js +54 -0
- package/lib/specs/apps.d.ts +2 -0
- package/lib/specs/apps.js +387 -0
- package/lib/specs/teams/teams.d.ts +1 -0
- package/lib/specs/teams/teams.js +80 -0
- package/lib/stories/loop/ReferenceScreens.d.ts +6 -2
- package/lib/stories/loop/ReferenceScreens.js +63 -6
- package/lib/types/chat.d.ts +12 -0
- package/lib/types/teams.d.ts +20 -0
- package/package.json +2 -2
- package/scripts/codegen/generate_teams.py +42 -3
- package/lib/examples/AgentStrategyExample.d.ts +0 -12
package/lib/types/chat.d.ts
CHANGED
|
@@ -964,6 +964,18 @@ export interface ChatBaseProps {
|
|
|
964
964
|
notebookToolSurfacesId?: string;
|
|
965
965
|
/** Custom footer content (rendered above input) */
|
|
966
966
|
footerContent?: ReactNode;
|
|
967
|
+
/**
|
|
968
|
+
* The agent's welcome, said as the first message of the history: drawn as
|
|
969
|
+
* the chat draws the agent's messages, and never sent nor kept. The floating
|
|
970
|
+
* assistant's balloon opens on it (LOOP T-23).
|
|
971
|
+
*/
|
|
972
|
+
welcome?: string;
|
|
973
|
+
/**
|
|
974
|
+
* What follows the last message, inside the history and scrolled with it:
|
|
975
|
+
* the floating assistant's balloon holds an approval there, as a message
|
|
976
|
+
* with *Approve* and *Deny* (T-23).
|
|
977
|
+
*/
|
|
978
|
+
trailingContent?: ReactNode;
|
|
967
979
|
/**
|
|
968
980
|
* Show the information icon in the header.
|
|
969
981
|
* When clicked, fires onInformationClick.
|
package/lib/types/teams.d.ts
CHANGED
|
@@ -56,6 +56,13 @@ export interface TeamDelegationSpec {
|
|
|
56
56
|
/** Whether members also get the general-purpose subagent. */
|
|
57
57
|
includeGeneralPurpose: boolean;
|
|
58
58
|
}
|
|
59
|
+
/** One member asking another directly, over a protocol (agentspecs `TeamLink`). */
|
|
60
|
+
export interface TeamLinkSpec {
|
|
61
|
+
/** The member asked, by its id in the team. */
|
|
62
|
+
member: string;
|
|
63
|
+
/** The protocol: `a2a`. */
|
|
64
|
+
over: 'a2a';
|
|
65
|
+
}
|
|
59
66
|
export interface TeamAgentspec {
|
|
60
67
|
/** Agent identifier within the team */
|
|
61
68
|
id: string;
|
|
@@ -68,6 +75,15 @@ export interface TeamAgentspec {
|
|
|
68
75
|
* the fields below then say what is different about it in this team.
|
|
69
76
|
*/
|
|
70
77
|
ref?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Application catalogue reference, in place of `ref`: the member is that
|
|
80
|
+
* application, with its agent, connections, rules and interface.
|
|
81
|
+
*/
|
|
82
|
+
app?: string;
|
|
83
|
+
/** Where its loop turns: in the person's `browser`, or on a `runtime`. */
|
|
84
|
+
runsIn?: 'browser' | 'runtime';
|
|
85
|
+
/** The members it asks directly while it works, and over what. */
|
|
86
|
+
talksTo?: TeamLinkSpec[];
|
|
71
87
|
/** Structural role: coordinator, initiator, contributor, reviewer, finalizer. */
|
|
72
88
|
role?: string;
|
|
73
89
|
/**
|
|
@@ -100,6 +116,8 @@ export interface TeamSupervisorSpec {
|
|
|
100
116
|
name: string;
|
|
101
117
|
/** Agent catalogue reference, `id` or `id:version`. */
|
|
102
118
|
ref?: string;
|
|
119
|
+
/** Application catalogue reference, in a team of applications. */
|
|
120
|
+
app?: string;
|
|
103
121
|
/** Model id, overriding the referenced agent's. */
|
|
104
122
|
model?: string;
|
|
105
123
|
/** What the supervisor is accountable for across the whole run. */
|
|
@@ -203,6 +221,8 @@ export interface TeamSpec {
|
|
|
203
221
|
supervisor: TeamSupervisorSpec;
|
|
204
222
|
/** Instructions for routing tasks between agents */
|
|
205
223
|
routingInstructions?: string;
|
|
224
|
+
/** The member a person talks to, by its id: the team's front door. */
|
|
225
|
+
entry?: string;
|
|
206
226
|
/**
|
|
207
227
|
* Openers shown in an empty chat.
|
|
208
228
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/agent-runtimes",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.62",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"watch:lib:src": "tsc -b -w"
|
|
133
133
|
},
|
|
134
134
|
"dependencies": {
|
|
135
|
-
"@a2a-js/sdk": "^
|
|
135
|
+
"@a2a-js/sdk": "^1.3.0",
|
|
136
136
|
"@a2ui/markdown-it": "0.2.0",
|
|
137
137
|
"@a2ui/react": "0.12.0",
|
|
138
138
|
"@a2ui/web_core": "0.12.0",
|
|
@@ -147,6 +147,19 @@ def _generate_team_agent_py(agent: Dict[str, Any]) -> str:
|
|
|
147
147
|
# The reference into the agent catalogue. Emitted before the overrides
|
|
148
148
|
# because it is what the member *is*; the rest says how it differs here.
|
|
149
149
|
lines.append(f' ref="{agent.get("ref", "")}",')
|
|
150
|
+
# A member that is an application, where it runs and whom it asks:
|
|
151
|
+
# emitted only when said, as a team of agents says none of them.
|
|
152
|
+
if agent.get("app"):
|
|
153
|
+
lines.append(f' app="{agent["app"]}",')
|
|
154
|
+
if agent.get("runs_in"):
|
|
155
|
+
lines.append(f' runs_in="{agent["runs_in"]}",')
|
|
156
|
+
links = agent.get("talks_to") or []
|
|
157
|
+
if links:
|
|
158
|
+
rendered_links = ", ".join(
|
|
159
|
+
f'TeamLinkSpec(member="{link["member"]}", over="{link.get("over", "a2a")}")'
|
|
160
|
+
for link in links
|
|
161
|
+
)
|
|
162
|
+
lines.append(f" talks_to=[{rendered_links}],")
|
|
150
163
|
lines.append(f' role="{agent.get("role", "contributor")}",')
|
|
151
164
|
goal = agent.get("goal", "").replace('"', '\\"').replace("\n", " ").strip()
|
|
152
165
|
lines.append(f' goal="{goal}",')
|
|
@@ -204,10 +217,25 @@ def _generate_team_agent_ts(agent: Dict[str, Any]) -> str:
|
|
|
204
217
|
if subagents
|
|
205
218
|
else "[]"
|
|
206
219
|
)
|
|
220
|
+
links = agent.get("talks_to") or []
|
|
221
|
+
application = (
|
|
222
|
+
(f"\n app: '{agent['app']}'," if agent.get("app") else "")
|
|
223
|
+
+ (f"\n runsIn: '{agent['runs_in']}'," if agent.get("runs_in") else "")
|
|
224
|
+
+ (
|
|
225
|
+
"\n talksTo: ["
|
|
226
|
+
+ ", ".join(
|
|
227
|
+
f"{{ member: '{link['member']}', over: '{link.get('over', 'a2a')}' }}"
|
|
228
|
+
for link in links
|
|
229
|
+
)
|
|
230
|
+
+ "],"
|
|
231
|
+
if links
|
|
232
|
+
else ""
|
|
233
|
+
)
|
|
234
|
+
)
|
|
207
235
|
return f""" {{
|
|
208
236
|
id: '{agent.get("id", "")}',
|
|
209
237
|
name: '{agent.get("name", "")}',
|
|
210
|
-
ref: '{agent.get("ref", "")}',
|
|
238
|
+
ref: '{agent.get("ref", "")}',{application}
|
|
211
239
|
role: '{agent.get("role", "contributor")}',
|
|
212
240
|
goal: `{goal}`,
|
|
213
241
|
dependsOn: {depends_on},
|
|
@@ -236,6 +264,7 @@ from typing import Dict, Optional
|
|
|
236
264
|
|
|
237
265
|
from agent_runtimes.types import (
|
|
238
266
|
TeamAgentspec,
|
|
267
|
+
TeamLinkSpec,
|
|
239
268
|
TeamContextSpec,
|
|
240
269
|
TeamDelegationSpec,
|
|
241
270
|
TeamSubagentspec,
|
|
@@ -314,8 +343,11 @@ from agent_runtimes.types import (
|
|
|
314
343
|
.replace("\n", " ")
|
|
315
344
|
.strip()
|
|
316
345
|
)
|
|
346
|
+
sup_app = (
|
|
347
|
+
f'app="{supervisor["app"]}", ' if supervisor.get("app") else ""
|
|
348
|
+
)
|
|
317
349
|
supervisor_code = (
|
|
318
|
-
f'TeamSupervisorSpec(name="{sup_name}", ref="{sup_ref}", '
|
|
350
|
+
f'TeamSupervisorSpec(name="{sup_name}", ref="{sup_ref}", {sup_app}'
|
|
319
351
|
f'model="{sup_model}", goal="{sup_goal}", '
|
|
320
352
|
f'instructions="{sup_instructions}", '
|
|
321
353
|
f'approval="{supervisor.get("approval", "auto")}", '
|
|
@@ -426,6 +458,8 @@ from agent_runtimes.types import (
|
|
|
426
458
|
)
|
|
427
459
|
code += f" supervisor={supervisor_code},\n"
|
|
428
460
|
code += f' routing_instructions="{routing}",\n'
|
|
461
|
+
if spec.get("entry"):
|
|
462
|
+
code += f' entry="{spec["entry"]}",\n'
|
|
429
463
|
suggestions = spec.get("suggestions") or []
|
|
430
464
|
if suggestions:
|
|
431
465
|
rendered = ", ".join(
|
|
@@ -596,8 +630,11 @@ import type {{ TeamSpec }} from '{types_import_path}';
|
|
|
596
630
|
.replace("\n", " ")
|
|
597
631
|
.strip()
|
|
598
632
|
)
|
|
633
|
+
sup_app_ts = (
|
|
634
|
+
f"app: '{supervisor['app']}', " if supervisor.get("app") else ""
|
|
635
|
+
)
|
|
599
636
|
supervisor_ts = (
|
|
600
|
-
f"{{ name: '{sup_name}', ref: '{sup_ref}', "
|
|
637
|
+
f"{{ name: '{sup_name}', ref: '{sup_ref}', {sup_app_ts}"
|
|
601
638
|
f"model: '{sup_model}', goal: `{sup_goal}`, "
|
|
602
639
|
f"instructions: `{sup_instructions}`, "
|
|
603
640
|
f"approval: '{supervisor.get('approval', 'auto')}', "
|
|
@@ -714,6 +751,8 @@ import type {{ TeamSpec }} from '{types_import_path}';
|
|
|
714
751
|
code += f" executionMode: '{spec.get('execution_mode', 'sequential')}',\n"
|
|
715
752
|
code += f" supervisor: {supervisor_ts},\n"
|
|
716
753
|
code += f" routingInstructions: `{routing}`,\n"
|
|
754
|
+
if spec.get("entry"):
|
|
755
|
+
code += f" entry: '{spec['entry']}',\n"
|
|
717
756
|
# What an empty chat offers. Emitted only when the team names
|
|
718
757
|
# some: an empty array in every generated team would be four
|
|
719
758
|
# hundred lines saying nothing.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ServiceManager } from '@jupyterlab/services';
|
|
2
|
-
interface AgentStrategyExampleInnerProps {
|
|
3
|
-
serviceManager?: ServiceManager.IManager;
|
|
4
|
-
}
|
|
5
|
-
export declare function AgentStrategyExampleInner({ serviceManager, }: AgentStrategyExampleInnerProps): import("react").JSX.Element;
|
|
6
|
-
/**
|
|
7
|
-
* Main example component with Jupyter provider wrapper.
|
|
8
|
-
*/
|
|
9
|
-
export declare function AgentStrategyExample({ serviceManager, }: {
|
|
10
|
-
serviceManager?: ServiceManager.IManager;
|
|
11
|
-
}): import("react").JSX.Element;
|
|
12
|
-
export default AgentStrategyExample;
|