@datalayer/agent-runtimes 1.3.81 → 1.3.82

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 (66) hide show
  1. package/lib/chat/assistant/SpeechBalloon.js +16 -1
  2. package/lib/chat/base/ChatBase.js +40 -4
  3. package/lib/chat/indicators/McpStatusIndicator.d.ts +1 -1
  4. package/lib/chat/indicators/McpStatusIndicator.js +13 -6
  5. package/lib/chat/indicators/SkillsStatusIndicator.d.ts +1 -1
  6. package/lib/chat/indicators/SkillsStatusIndicator.js +7 -3
  7. package/lib/chat/prompt/InputPrompt.d.ts +4 -1
  8. package/lib/chat/prompt/InputPrompt.js +2 -2
  9. package/lib/chat/prompt/InputPromptBase.d.ts +4 -1
  10. package/lib/chat/prompt/InputPromptBase.js +2 -2
  11. package/lib/chat/prompt/InputPromptLexical.d.ts +7 -1
  12. package/lib/chat/prompt/InputPromptLexical.js +5 -3
  13. package/lib/components/teams/index.d.ts +1 -0
  14. package/lib/components/teams/index.js +1 -0
  15. package/lib/components/teams/usePeerSandbox.d.ts +13 -0
  16. package/lib/components/teams/usePeerSandbox.js +59 -0
  17. package/lib/examples/AgentA2ATeamExample.js +7 -2
  18. package/lib/loop/apps/AppComposer.d.ts +31 -0
  19. package/lib/loop/apps/AppComposer.js +67 -0
  20. package/lib/loop/apps/AppRenderer.d.ts +16 -5
  21. package/lib/loop/apps/AppRenderer.js +49 -16
  22. package/lib/loop/apps/appspec.d.ts +8 -1
  23. package/lib/loop/apps/appspec.js +87 -0
  24. package/lib/loop/apps/checks.js +108 -1
  25. package/lib/loop/apps/composer.d.ts +37 -0
  26. package/lib/loop/apps/composer.js +61 -0
  27. package/lib/loop/apps/index.d.ts +2 -0
  28. package/lib/loop/apps/index.js +2 -0
  29. package/lib/loop/core/index.d.ts +31 -0
  30. package/lib/loop/core/index.js +22 -0
  31. package/lib/loop/embed/AppEmbed.d.ts +46 -7
  32. package/lib/loop/embed/AppEmbed.js +108 -26
  33. package/lib/loop/embed/LoopEmbed.js +2 -0
  34. package/lib/loop/embed/element.js +19 -5
  35. package/lib/loop/embed/embedConfig.d.ts +10 -1
  36. package/lib/loop/embed/embedConfig.js +12 -1
  37. package/lib/loop/embed/embedSession.d.ts +79 -0
  38. package/lib/loop/embed/embedSession.js +136 -0
  39. package/lib/loop/embed/embedTheme.d.ts +12 -9
  40. package/lib/loop/embed/embedTheme.js +32 -22
  41. package/lib/loop/index.d.ts +4 -3
  42. package/lib/loop/index.js +4 -3
  43. package/lib/loop/plugins/agent-capacity/index.d.ts +3 -1
  44. package/lib/loop/plugins/agent-capacity/index.js +2 -1
  45. package/lib/loop/plugins/chat/ChatView.js +31 -4
  46. package/lib/loop/plugins/chat/index.d.ts +6 -1
  47. package/lib/loop/presets.d.ts +3 -1
  48. package/lib/loop/presets.js +2 -1
  49. package/lib/loop/shell/LoopWorkspace.js +3 -0
  50. package/lib/protocols/BrowserAgentAdapter.d.ts +18 -0
  51. package/lib/protocols/BrowserAgentAdapter.js +35 -2
  52. package/lib/runtimes/__tests__/fixtures/accounting-agent-card.json +8 -0
  53. package/lib/runtimes/browser/a2aPeer.d.ts +11 -0
  54. package/lib/runtimes/browser/a2aPeer.js +15 -1
  55. package/lib/runtimes/browser/protocol.d.ts +3 -0
  56. package/lib/runtimes/browser/protocol.js +2 -1
  57. package/lib/specs/apps.js +28 -0
  58. package/lib/specs/appspecSchema.js +191 -0
  59. package/lib/types/agentspecs.d.ts +58 -0
  60. package/lib/types/chat.d.ts +29 -1
  61. package/package.json +1 -1
  62. package/scripts/codegen/generate_agents.py +4 -2
  63. package/scripts/codegen/generate_backend_tools.py +4 -12
  64. package/scripts/codegen/generate_cogs.py +3 -1
  65. package/scripts/codegen/generate_ui_plugins.py +22 -9
  66. package/scripts/voice/transcribe.mjs +29 -21
@@ -104,18 +104,18 @@ def _py_calls(specs: list[dict[str, Any]]) -> list[str]:
104
104
  "# The components as typed calls (LOOP C-15)",
105
105
  "# " + "=" * 76,
106
106
  "",
107
- "#: A property bound to what the application publishes or takes: ``{\"path\": \"/runs\"}``.",
107
+ '#: A property bound to what the application publishes or takes: ``{"path": "/runs"}``.',
108
108
  "Bound = Mapping[str, str]",
109
109
  "",
110
110
  "",
111
111
  "class SurfaceComponents:",
112
- ' """Every component of the catalog as a typed call: ``app.ui.table(\"runs\", columns=[...])``.',
112
+ ' """Every component of the catalog as a typed call: ``app.ui.table("runs", columns=[...])``.',
113
113
  "",
114
114
  " Each places the node the Canvas and the YAML write, through",
115
115
  " `Application.component`, which checks it against the same JSON Schema; an",
116
116
  " IDE completes its properties, and a type checker refuses a wrong value",
117
117
  " before the application runs. A property may be bound instead",
118
- ' (``{\"path\": ...}``); a property left as ``None`` is not written.',
118
+ ' (``{"path": ...}``); a property left as ``None`` is not written.',
119
119
  ' """',
120
120
  "",
121
121
  " def __init__(self, place: Callable[..., Dict[str, Any]]) -> None:",
@@ -131,15 +131,21 @@ def _py_calls(specs: list[dict[str, Any]]) -> list[str]:
131
131
  bindings = component.get("bindings") or {}
132
132
  extra = [
133
133
  name
134
- for name in dict.fromkeys([*(bindings.get("shows") or []), *(bindings.get("sends") or [])])
134
+ for name in dict.fromkeys(
135
+ [*(bindings.get("shows") or []), *(bindings.get("sends") or [])]
136
+ )
135
137
  if name not in fields
136
138
  ]
137
139
  params = [" self,", " id: str,", " *,"]
138
- ordered = [n for n in fields if n in required] + [n for n in fields if n not in required]
140
+ ordered = [n for n in fields if n in required] + [
141
+ n for n in fields if n not in required
142
+ ]
139
143
  for name in ordered:
140
144
  kind = f"Union[{_py_type(fields[name])}, Bound]"
141
145
  params.append(
142
- f" {name}: {kind}," if name in required else f" {name}: Optional[{kind}] = None,"
146
+ f" {name}: {kind},"
147
+ if name in required
148
+ else f" {name}: Optional[{kind}] = None,"
143
149
  )
144
150
  for name in extra:
145
151
  params.append(f" {name}: Optional[Bound] = None,")
@@ -157,9 +163,16 @@ def _py_calls(specs: list[dict[str, Any]]) -> list[str]:
157
163
  ]
158
164
  for name in ordered:
159
165
  field = fields[name]
160
- doc += [f" {name} : {_py_type(field)} or Bound", f" {field.get('title', name)}: {field.get('description', '')}"]
166
+ doc += [
167
+ f" {name} : {_py_type(field)} or Bound",
168
+ f" {field.get('title', name)}: {field.get('description', '')}",
169
+ ]
161
170
  for name in extra:
162
- said = "What it shows" if name in (bindings.get("shows") or []) else "Where what a person does is written"
171
+ said = (
172
+ "What it shows"
173
+ if name in (bindings.get("shows") or [])
174
+ else "Where what a person does is written"
175
+ )
163
176
  doc += [f" {name} : Bound", f" {said}."]
164
177
  doc += [' """']
165
178
  names = [*ordered, *extra]
@@ -171,7 +184,7 @@ def _py_calls(specs: list[dict[str, Any]]) -> list[str]:
171
184
  f" def {call_name(component['id'])}(",
172
185
  *params,
173
186
  " ) -> Dict[str, Any]:",
174
- *[d.replace('\\', '\\\\') for d in doc],
187
+ *[d.replace("\\", "\\\\") for d in doc],
175
188
  " given = {",
176
189
  *[f" {json.dumps(name)}: {name}," for name in names],
177
190
  " }",
@@ -33,26 +33,34 @@ function readWav(path) {
33
33
  return samples;
34
34
  }
35
35
 
36
- const loading = performance.now();
37
- const transcribe = await pipeline('automatic-speech-recognition', model, {
38
- dtype: 'q8',
39
- device: 'cpu',
40
- });
41
- const loadMs = Math.round(performance.now() - loading);
42
- // Whisper is told the language; Moonshine hears English only.
43
- const options = model.startsWith('whisper')
44
- ? { language: language === 'fr' ? 'french' : 'english', task: 'transcribe' }
45
- : {};
46
- const results = [];
47
- for (const file of files) {
48
- const audio = readWav(file);
49
- const started = performance.now();
50
- const output = await transcribe(audio, options);
51
- results.push({
52
- file: file.split('/').pop(),
53
- text: output.text.trim(),
54
- ms: Math.round(performance.now() - started),
55
- audio_s: Math.round((audio.length / 16000) * 100) / 100,
36
+ /** Load the model, transcribe each file, print the JSON line. */
37
+ async function main() {
38
+ const loading = performance.now();
39
+ const transcribe = await pipeline('automatic-speech-recognition', model, {
40
+ dtype: 'q8',
41
+ device: 'cpu',
56
42
  });
43
+ const loadMs = Math.round(performance.now() - loading);
44
+ // Whisper is told the language; Moonshine hears English only.
45
+ const options = model.startsWith('whisper')
46
+ ? { language: language === 'fr' ? 'french' : 'english', task: 'transcribe' }
47
+ : {};
48
+ const results = [];
49
+ for (const file of files) {
50
+ const audio = readWav(file);
51
+ const started = performance.now();
52
+ const output = await transcribe(audio, options);
53
+ results.push({
54
+ file: file.split('/').pop(),
55
+ text: output.text.trim(),
56
+ ms: Math.round(performance.now() - started),
57
+ audio_s: Math.round((audio.length / 16000) * 100) / 100,
58
+ });
59
+ }
60
+ console.log(JSON.stringify({ model, language, load_ms: loadMs, results }));
57
61
  }
58
- console.log(JSON.stringify({ model, language, load_ms: loadMs, results }));
62
+
63
+ main().catch(error => {
64
+ console.error(error);
65
+ process.exit(1);
66
+ });