@datalayer/agent-runtimes 0.0.11 → 0.0.12

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.
Files changed (136) hide show
  1. package/README.md +2 -2
  2. package/lib/Agent.d.ts +29 -0
  3. package/lib/Agent.js +131 -0
  4. package/lib/AgentLexical.d.ts +34 -0
  5. package/lib/AgentLexical.js +296 -0
  6. package/lib/AgentNotebook.d.ts +19 -0
  7. package/lib/AgentNotebook.js +192 -0
  8. package/lib/agent-lexical-main.d.ts +1 -0
  9. package/lib/agent-lexical-main.js +11 -0
  10. package/lib/agent-main.d.ts +1 -0
  11. package/lib/agent-main.js +11 -0
  12. package/lib/agent-notebook-main.d.ts +1 -0
  13. package/lib/agent-notebook-main.js +12 -0
  14. package/lib/components/AgentConfiguration.d.ts +4 -22
  15. package/lib/components/AgentConfiguration.js +8 -8
  16. package/lib/components/chat/components/AgentDetails.d.ts +3 -1
  17. package/lib/components/chat/components/AgentDetails.js +6 -6
  18. package/lib/components/chat/components/Chat.d.ts +29 -3
  19. package/lib/components/chat/components/Chat.js +64 -59
  20. package/lib/components/chat/components/ChatFloating.d.ts +34 -12
  21. package/lib/components/chat/components/ChatFloating.js +54 -21
  22. package/lib/components/chat/components/ChatInline.d.ts +5 -1
  23. package/lib/components/chat/components/ChatInline.js +8 -1
  24. package/lib/components/chat/components/ChatSidebar.d.ts +6 -1
  25. package/lib/components/chat/components/ChatSidebar.js +2 -2
  26. package/lib/components/chat/components/ChatStandalone.d.ts +6 -1
  27. package/lib/components/chat/components/ChatStandalone.js +2 -2
  28. package/lib/components/chat/components/base/ChatBase.d.ts +49 -8
  29. package/lib/components/chat/components/base/ChatBase.js +544 -149
  30. package/lib/components/chat/components/base/InputPrompt.d.ts +42 -0
  31. package/lib/components/chat/components/base/InputPrompt.js +131 -0
  32. package/lib/components/chat/components/index.d.ts +3 -3
  33. package/lib/components/chat/components/index.js +1 -1
  34. package/lib/components/chat/components/parts/ReasoningPart.js +2 -4
  35. package/lib/components/chat/components/parts/TextPart.js +2 -70
  36. package/lib/components/chat/components/styles/streamdownStyles.d.ts +23 -0
  37. package/lib/components/chat/components/styles/streamdownStyles.js +319 -0
  38. package/lib/components/chat/index.d.ts +1 -1
  39. package/lib/components/chat/index.js +1 -1
  40. package/lib/components/chat/inference/DatalayerInferenceProvider.js +16 -12
  41. package/lib/components/chat/inference/SelfHostedInferenceProvider.js +16 -12
  42. package/lib/components/chat/protocols/AGUIAdapter.d.ts +10 -3
  43. package/lib/components/chat/protocols/AGUIAdapter.js +123 -44
  44. package/lib/components/chat/types/tool.d.ts +5 -2
  45. package/lib/components/index.d.ts +1 -18
  46. package/lib/components/index.js +0 -9
  47. package/lib/config/index.d.ts +0 -4
  48. package/lib/config/index.js +0 -4
  49. package/lib/examples/A2UiRestaurantExample.js +1 -1
  50. package/lib/examples/AgentRuntimeChatExample.d.ts +15 -0
  51. package/lib/examples/AgentRuntimeChatExample.js +126 -0
  52. package/lib/examples/{AgentSpaceFormExample.d.ts → AgentRuntimeFormExample.d.ts} +3 -3
  53. package/lib/examples/{AgentSpaceFormExample.js → AgentRuntimeFormExample.js} +10 -8
  54. package/lib/examples/AgentRuntimeLexicalExample.js +6 -3
  55. package/lib/examples/AgentRuntimeLexicalSidebarExample.js +8 -1
  56. package/lib/examples/AgentRuntimeNotebookExample.js +6 -5
  57. package/lib/examples/CopilotKitNotebookExample.js +2 -2
  58. package/lib/examples/JupyterNotebookExample.js +2 -2
  59. package/lib/{components → examples/components}/Header.d.ts +2 -1
  60. package/lib/{components → examples/components}/HeaderControls.js +1 -1
  61. package/lib/{components → examples/components}/LexicalEditor.d.ts +6 -1
  62. package/lib/{components → examples/components}/LexicalEditor.js +4 -4
  63. package/lib/{components → examples/components}/MainContent.d.ts +1 -1
  64. package/lib/{components → examples/components}/MainContent.js +7 -5
  65. package/lib/examples/components/index.d.ts +16 -0
  66. package/lib/examples/components/index.js +13 -0
  67. package/lib/examples/example-selector.js +2 -1
  68. package/lib/examples/index.d.ts +1 -1
  69. package/lib/examples/index.js +1 -1
  70. package/lib/examples/main.js +2 -2
  71. package/lib/examples/stores/examplesStore.d.ts +2 -23
  72. package/lib/index.d.ts +2 -1
  73. package/lib/index.js +1 -0
  74. package/lib/lexical/ChatInlinePlugin.d.ts +13 -2
  75. package/lib/lexical/ChatInlinePlugin.js +41 -179
  76. package/lib/lexical/index.d.ts +1 -0
  77. package/lib/lexical/index.js +1 -0
  78. package/lib/lexical/useChatInlineToolbarItems.d.ts +28 -0
  79. package/lib/lexical/useChatInlineToolbarItems.js +163 -0
  80. package/lib/runtime/useAgentRuntime.d.ts +1 -1
  81. package/lib/runtime/useAgentRuntime.js +1 -1
  82. package/lib/{config/agents/code-ai → specs/agents/codeai}/agents.d.ts +5 -2
  83. package/lib/specs/agents/codeai/agents.js +151 -0
  84. package/lib/{config → specs}/agents/codemode-paper/agents.d.ts +4 -2
  85. package/lib/{config → specs}/agents/codemode-paper/agents.js +39 -19
  86. package/lib/{config → specs}/agents/datalayer-ai/agents.d.ts +4 -2
  87. package/lib/{config → specs}/agents/datalayer-ai/agents.js +17 -2
  88. package/lib/{config → specs}/agents/index.d.ts +3 -1
  89. package/lib/{config → specs}/agents/index.js +12 -3
  90. package/lib/{config → specs}/envvars.d.ts +1 -0
  91. package/lib/{config → specs}/envvars.js +10 -0
  92. package/lib/specs/index.d.ts +5 -0
  93. package/lib/specs/index.js +9 -0
  94. package/lib/{config → specs}/mcpServers.d.ts +2 -1
  95. package/lib/{config → specs}/mcpServers.js +23 -1
  96. package/lib/specs/models.d.ts +68 -0
  97. package/lib/specs/models.js +239 -0
  98. package/lib/state/substates/AIAgentState.d.ts +0 -1
  99. package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.d.ts +11 -22
  100. package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.js +5 -5
  101. package/lib/tools/adapters/agent-runtimes/lexicalHooks.d.ts +6 -6
  102. package/lib/tools/adapters/agent-runtimes/lexicalHooks.js +4 -4
  103. package/lib/tools/adapters/agent-runtimes/notebookHooks.d.ts +6 -6
  104. package/lib/tools/adapters/agent-runtimes/notebookHooks.js +4 -4
  105. package/lib/{types.d.ts → types/Types.d.ts} +32 -6
  106. package/lib/types/index.d.ts +1 -0
  107. package/lib/types/index.js +1 -0
  108. package/package.json +11 -5
  109. package/scripts/codegen/generate_agents.py +53 -13
  110. package/scripts/codegen/generate_envvars.py +1 -1
  111. package/scripts/codegen/generate_mcp_servers.py +5 -5
  112. package/scripts/codegen/generate_models.py +486 -0
  113. package/scripts/codegen/generate_skills.py +2 -2
  114. package/style/primer-primitives.css +22 -0
  115. package/lib/components/chat/components/elements/ChatInputPrompt.d.ts +0 -37
  116. package/lib/components/chat/components/elements/ChatInputPrompt.js +0 -150
  117. package/lib/config/agents/code-ai/agents.js +0 -70
  118. /package/lib/{components → examples/components}/FooterMetrics.d.ts +0 -0
  119. /package/lib/{components → examples/components}/FooterMetrics.js +0 -0
  120. /package/lib/{components → examples/components}/Header.js +0 -0
  121. /package/lib/{components → examples/components}/HeaderControls.d.ts +0 -0
  122. /package/lib/{components → examples/components}/MockFileBrowser.d.ts +0 -0
  123. /package/lib/{components → examples/components}/MockFileBrowser.js +0 -0
  124. /package/lib/{components → examples/components}/SessionTabs.d.ts +0 -0
  125. /package/lib/{components → examples/components}/SessionTabs.js +0 -0
  126. /package/lib/{components → examples/components}/TimeTravel.d.ts +0 -0
  127. /package/lib/{components → examples/components}/TimeTravel.js +0 -0
  128. /package/lib/{config/agents/code-ai → specs/agents/codeai}/index.d.ts +0 -0
  129. /package/lib/{config/agents/code-ai → specs/agents/codeai}/index.js +0 -0
  130. /package/lib/{config → specs}/agents/codemode-paper/index.d.ts +0 -0
  131. /package/lib/{config → specs}/agents/codemode-paper/index.js +0 -0
  132. /package/lib/{config → specs}/agents/datalayer-ai/index.d.ts +0 -0
  133. /package/lib/{config → specs}/agents/datalayer-ai/index.js +0 -0
  134. /package/lib/{config → specs}/skills.d.ts +0 -0
  135. /package/lib/{config → specs}/skills.js +0 -0
  136. /package/lib/{types.js → types/Types.js} +0 -0
@@ -9,7 +9,6 @@ Generates Python and TypeScript code from YAML agent specifications.
9
9
  """
10
10
 
11
11
  import argparse
12
- import subprocess
13
12
  import sys
14
13
  from pathlib import Path
15
14
  from typing import Any, Dict, List
@@ -165,12 +164,21 @@ from agent_runtimes.types import AgentSpec
165
164
  else "None"
166
165
  )
167
166
 
167
+ # Model field
168
+ model_id = spec.get("model")
169
+ model_str = f'"{model_id}"' if model_id else "None"
170
+
171
+ # Sandbox variant field
172
+ sandbox_variant = spec.get("sandbox_variant")
173
+ sandbox_variant_str = f'"{sandbox_variant}"' if sandbox_variant else "None"
174
+
168
175
  code += f'''{const_name} = AgentSpec(
169
176
  id="{full_agent_id}",
170
177
  name="{spec["name"]}",
171
178
  description="{description}",
172
179
  tags={_fmt_list(spec.get("tags", []))},
173
180
  enabled={spec.get("enabled", True)},
181
+ model={model_str},
174
182
  mcp_servers=[{mcp_servers_str}],
175
183
  skills={_fmt_list(spec.get("skills", []))},
176
184
  environment_name="{spec.get("environment_name", "ai-agents-env")}",
@@ -181,6 +189,7 @@ from agent_runtimes.types import AgentSpec
181
189
  welcome_message="{welcome}",
182
190
  welcome_notebook={f'"{welcome_notebook}"' if welcome_notebook else "None"},
183
191
  welcome_document={f'"{welcome_document}"' if welcome_document else "None"},
192
+ sandbox_variant={sandbox_variant_str},
184
193
  system_prompt={system_prompt_str},
185
194
  system_prompt_codemode_addons={system_prompt_codemode_addons_str},
186
195
  )
@@ -222,14 +231,20 @@ def get_agent_spec(agent_id: str) -> AgentSpec | None:
222
231
  return AGENT_SPECS.get(agent_id)
223
232
 
224
233
 
225
- def list_agent_specs() -> list[AgentSpec]:
234
+ def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
226
235
  \"\"\"
227
236
  List all available agent specifications.
228
237
 
238
+ Args:
239
+ prefix: If provided, only return specs whose ID starts with this prefix.
240
+
229
241
  Returns:
230
242
  List of all AgentSpec configurations.
231
243
  \"\"\"
232
- return list(AGENT_SPECS.values())
244
+ specs = list(AGENT_SPECS.values())
245
+ if prefix is not None:
246
+ specs = [s for s in specs if s.id.startswith(prefix)]
247
+ return specs
233
248
  """
234
249
 
235
250
  return code
@@ -299,7 +314,7 @@ def generate_typescript_code(
299
314
  * Generated from YAML specifications in specs/agents/
300
315
  */
301
316
 
302
- import type { AgentSpec } from '../../../types';
317
+ import type { AgentSpec } from '../../../types/Types';
303
318
  """
304
319
 
305
320
  # Only add MCP server imports if needed
@@ -449,12 +464,23 @@ function toAgentSkillSpec(skill: SkillSpec) {
449
464
  spec["description"].replace("\n", " ").replace(" ", " ").strip()
450
465
  )
451
466
 
467
+ # Model field
468
+ model_id = spec.get("model")
469
+ model_ts = f"'{model_id}'" if model_id else "undefined"
470
+
471
+ # Sandbox variant field
472
+ sandbox_variant = spec.get("sandbox_variant")
473
+ sandbox_variant_ts = (
474
+ f"'{sandbox_variant}'" if sandbox_variant else "undefined"
475
+ )
476
+
452
477
  code += f"""export const {const_name}: AgentSpec = {{
453
478
  id: '{full_agent_id}',
454
479
  name: '{spec["name"]}',
455
480
  description: `{description}`,
456
481
  tags: {tags_str},
457
482
  enabled: {str(spec.get("enabled", True)).lower()},
483
+ model: {model_ts},
458
484
  mcpServers: [{mcp_servers_str}],
459
485
  skills: [{skills_str}],
460
486
  environmentName: '{spec.get("environment_name", "ai-agents-env")}',
@@ -462,6 +488,7 @@ function toAgentSkillSpec(skill: SkillSpec) {
462
488
  emoji: {emoji},
463
489
  color: {color},
464
490
  suggestions: {suggestions_str},
491
+ sandboxVariant: {sandbox_variant_ts},
465
492
  systemPrompt: {f"`{system_prompt}`" if system_prompt else "undefined"},
466
493
  systemPromptCodemodeAddons: {f"`{system_prompt_codemode_addons}`" if system_prompt_codemode_addons else "undefined"},
467
494
  }};
@@ -497,9 +524,12 @@ export function getAgentSpecs(agentId: string): AgentSpec | undefined {
497
524
 
498
525
  /**
499
526
  * List all available agent specifications.
527
+ *
528
+ * @param prefix - If provided, only return specs whose ID starts with this prefix.
500
529
  */
501
- export function listAgentSpecs(): AgentSpec[] {
502
- return Object.values(AGENT_SPECS);
530
+ export function listAgentSpecs(prefix?: string): AgentSpec[] {
531
+ const specs = Object.values(AGENT_SPECS);
532
+ return prefix !== undefined ? specs.filter(s => s.id.startsWith(prefix)) : specs;
503
533
  }
504
534
 
505
535
  /**
@@ -621,7 +651,7 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
621
651
  # Create __init__.py for Python subfolder
622
652
  python_init = python_folder_dir / "__init__.py"
623
653
  with open(python_init, "w") as f:
624
- f.write(f"""# Copyright (c) 2025-2026 Datalayer, Inc.
654
+ f.write("""# Copyright (c) 2025-2026 Datalayer, Inc.
625
655
  # Distributed under the terms of the Modified BSD License.
626
656
 
627
657
  from .agents import *
@@ -651,7 +681,7 @@ __all__ = ["AGENT_SPECS", "get_agent_spec", "list_agent_specs"]
651
681
  # Create index.ts for TypeScript subfolder
652
682
  typescript_index = typescript_folder_dir / "index.ts"
653
683
  with open(typescript_index, "w") as f:
654
- f.write(f"""/*
684
+ f.write("""/*
655
685
  * Copyright (c) 2025-2026 Datalayer, Inc.
656
686
  * Distributed under the terms of the Modified BSD License.
657
687
  */
@@ -702,9 +732,16 @@ def get_agent_spec(agent_id: str) -> AgentSpec | None:
702
732
  return AGENT_SPECS.get(agent_id)
703
733
 
704
734
 
705
- def list_agent_specs() -> list[AgentSpec]:
706
- \"\"\"List all available agent specifications.\"\"\"
707
- return list(AGENT_SPECS.values())
735
+ def list_agent_specs(prefix: str | None = None) -> list[AgentSpec]:
736
+ \"\"\"List all available agent specifications.
737
+
738
+ Args:
739
+ prefix: If provided, only return specs whose ID starts with this prefix.
740
+ \"\"\"
741
+ specs = list(AGENT_SPECS.values())
742
+ if prefix is not None:
743
+ specs = [s for s in specs if s.id.startswith(prefix)]
744
+ return specs
708
745
 
709
746
  __all__ = ["AGENT_SPECS", "get_agent_spec", "list_agent_specs"]
710
747
  """
@@ -756,9 +793,12 @@ export function getAgentSpecs(agentId: string): AgentSpec | undefined {
756
793
 
757
794
  /**
758
795
  * List all available agent specifications.
796
+ *
797
+ * @param prefix - If provided, only return specs whose ID starts with this prefix.
759
798
  */
760
- export function listAgentSpecs(): AgentSpec[] {
761
- return Object.values(AGENT_SPECS);
799
+ export function listAgentSpecs(prefix?: string): AgentSpec[] {
800
+ const specs = Object.values(AGENT_SPECS);
801
+ return prefix !== undefined ? specs.filter(s => s.id.startsWith(prefix)) : specs;
762
802
  }
763
803
 
764
804
  /**
@@ -132,7 +132,7 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
132
132
  "def get_envvar_spec(envvar_id: str) -> EnvvarSpec:",
133
133
  ' """Get environment variable specification by ID."""',
134
134
  " if envvar_id not in ENVVAR_CATALOG:",
135
- f' raise ValueError(f"Unknown environment variable: {{envvar_id}}")',
135
+ ' raise ValueError(f"Unknown environment variable: {envvar_id}")',
136
136
  " return ENVVAR_CATALOG[envvar_id]",
137
137
  "",
138
138
  ]
@@ -217,7 +217,7 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
217
217
  " * DO NOT EDIT MANUALLY - run 'make specs' to regenerate.",
218
218
  " */",
219
219
  "",
220
- "import type { MCPServer } from '../types';",
220
+ "import type { MCPServer } from '../types/Types';",
221
221
  "",
222
222
  "// " + "=" * 76,
223
223
  "// MCP Server Definitions",
@@ -256,7 +256,7 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
256
256
  f" description: '{description}',",
257
257
  f" icon: {icon},",
258
258
  f" emoji: {emoji},",
259
- f" url: '',",
259
+ " url: '',",
260
260
  f" command: '{spec['command']}',",
261
261
  f" args: {args_formatted},",
262
262
  f" transport: '{spec.get('transport', 'stdio')}',",
@@ -410,14 +410,14 @@ def main():
410
410
  print(f"Loaded {len(specs)} MCP server specifications")
411
411
 
412
412
  # Generate Python code
413
- print(f"Generating Python code...")
413
+ print("Generating Python code...")
414
414
  python_code = generate_python_code(specs)
415
415
  args.python_output.parent.mkdir(parents=True, exist_ok=True)
416
416
  args.python_output.write_text(python_code)
417
417
  print(f"✓ Generated {args.python_output}")
418
418
 
419
419
  # Generate TypeScript code
420
- print(f"Generating TypeScript code...")
420
+ print("Generating TypeScript code...")
421
421
  typescript_code = generate_typescript_code(specs)
422
422
  args.typescript_output.parent.mkdir(parents=True, exist_ok=True)
423
423
  args.typescript_output.write_text(typescript_code)
@@ -426,7 +426,7 @@ def main():
426
426
  # Update __init__.py with correct imports
427
427
  init_file = args.python_output.parent / "__init__.py"
428
428
  if init_file.exists():
429
- print(f"Updating imports in __init__.py...")
429
+ print("Updating imports in __init__.py...")
430
430
  update_init_file(specs, init_file)
431
431
 
432
432
  print(f"\n✓ Successfully generated code from {len(specs)} MCP server specs")