@schlenkr/ragents 0.1.13 → 0.1.15

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 (145) hide show
  1. package/apps/server/package.json +1 -1
  2. package/apps/server/src/api/contracts.ts +19 -1
  3. package/apps/server/src/api/core-methods.ts +12 -0
  4. package/apps/server/src/chat-handler.ts +19 -0
  5. package/apps/server/src/host-api.json +2 -0
  6. package/apps/server/src/host-api.ts +2 -2
  7. package/apps/server/src/plugin-build/build.ts +1 -1
  8. package/apps/server/src/plugin-support/actor-programs/app-project.ts +61 -17
  9. package/apps/server/src/plugin-support/actor-programs/contract.ts +18 -1
  10. package/apps/server/src/plugin-support/actor-programs/service.ts +22 -1
  11. package/apps/server/src/plugin-support/plugin-folder.ts +14 -1
  12. package/apps/server/src/plugin-support/run-scripts.ts +27 -2
  13. package/apps/server/src/profile/compose.ts +2 -0
  14. package/apps/server/src/provider.ts +31 -6
  15. package/apps/server/src/ragents/chat-projection.ts +7 -0
  16. package/apps/server/src/ragents/global-chat.ts +5 -1
  17. package/apps/server/src/ragents/run-script-tools.ts +66 -0
  18. package/apps/server/src/ragents/session.ts +122 -60
  19. package/apps/server/src/title-compactor.ts +1 -1
  20. package/apps/web/dist/assets/{highlighted-body-KPVGNVTW-CpPi6QLr.js → highlighted-body-KPVGNVTW-BwD4uYEe.js} +1 -1
  21. package/apps/web/dist/assets/main-KBrc5Q77.js +11 -0
  22. package/apps/web/dist/assets/{mermaid-HWGCJPDP-q-mf1kLN.js → mermaid-HWGCJPDP-CSCkaArr.js} +88 -88
  23. package/apps/web/dist/assets/runPanel-BjG5NBKm.js +26 -0
  24. package/apps/web/dist/help/guide-clients.html +21 -4
  25. package/apps/web/dist/help/guide-clients.md +23 -4
  26. package/apps/web/dist/help/guide-plugins.html +12 -2
  27. package/apps/web/dist/help/guide-plugins.md +9 -2
  28. package/apps/web/dist/help/guide-programs.html +8 -2
  29. package/apps/web/dist/help/guide-programs.md +9 -2
  30. package/apps/web/dist/help/guide-runtime.html +3 -2
  31. package/apps/web/dist/help/guide-runtime.md +3 -2
  32. package/apps/web/dist/help/index.html +1 -1
  33. package/apps/web/dist/help/mini-app.css +16 -2
  34. package/apps/web/dist/host-web.json +13 -13
  35. package/apps/web/dist/index.html +2 -2
  36. package/apps/web/dist/run-panel.html +2 -2
  37. package/apps/web/package.json +1 -1
  38. package/apps/web/src/App.tsx +12 -1
  39. package/apps/web/src/PluginRegistry.tsx +2 -2
  40. package/apps/web/src/SessionList.tsx +7 -6
  41. package/apps/web/src/SettingsModal.tsx +3 -3
  42. package/apps/web/src/actor-programs/client-ui/FilePicker.tsx +1 -1
  43. package/apps/web/src/api.ts +2 -0
  44. package/apps/web/src/run-overview.ts +1 -1
  45. package/apps/web/src/run-panel/RunPanelApp.tsx +1 -1
  46. package/apps/web/src/run-panel/RunPanelMenu.tsx +47 -11
  47. package/apps/web/src/ui/relative-time.ts +1 -1
  48. package/bundles/ragents.activity/ragents-bundle.json +1 -1
  49. package/bundles/ragents.actor-programs/ragents-bundle.json +4 -2
  50. package/bundles/ragents.actor-programs/server/index.js +437 -24
  51. package/bundles/ragents.actor-programs/server/index.js.map +4 -4
  52. package/bundles/ragents.actor-programs/web/index.js.map +1 -1
  53. package/bundles/ragents.ask/ragents-bundle.json +2 -2
  54. package/bundles/ragents.ask/server/index.js +1 -0
  55. package/bundles/ragents.ask/server/index.js.map +2 -2
  56. package/bundles/ragents.browser/ragents-bundle.json +1 -1
  57. package/bundles/ragents.documents/ragents-bundle.json +2 -2
  58. package/bundles/ragents.documents/web/classes.json +1 -1
  59. package/bundles/ragents.documents/web/index.js +1 -1
  60. package/bundles/ragents.documents/web/index.js.map +2 -2
  61. package/bundles/ragents.lsp-fsharp/ragents-bundle.json +1 -1
  62. package/bundles/ragents.lsp-roslyn/ragents-bundle.json +1 -1
  63. package/bundles/ragents.lsp-typescript/ragents-bundle.json +1 -1
  64. package/bundles/ragents.model-relay/ragents-bundle.json +1 -1
  65. package/bundles/ragents.orchestration/ragents-bundle.json +7 -4
  66. package/bundles/ragents.orchestration/server/chunks/chunk-QS3WJ3D7.js +11 -0
  67. package/bundles/ragents.orchestration/server/chunks/chunk-QS3WJ3D7.js.map +7 -0
  68. package/bundles/ragents.orchestration/server/exports/server/contract.js +9 -0
  69. package/bundles/ragents.orchestration/server/exports/server/contract.js.map +7 -0
  70. package/bundles/ragents.orchestration/server/index.js +49 -3
  71. package/bundles/ragents.orchestration/server/index.js.map +2 -2
  72. package/bundles/ragents.orchestration/surface.hbs +5 -0
  73. package/bundles/ragents.orchestration/web/index.js +3 -3
  74. package/bundles/ragents.orchestration/web/index.js.map +2 -2
  75. package/bundles/ragents.overseer/ragents-bundle.json +4 -3
  76. package/bundles/ragents.overseer/web/classes.json +1 -1
  77. package/bundles/ragents.overseer/web/index.js +1 -1
  78. package/bundles/ragents.overseer/web/index.js.map +4 -4
  79. package/bundles/ragents.processes/ragents-bundle.json +2 -2
  80. package/bundles/ragents.processes/web/classes.json +1 -1
  81. package/bundles/ragents.processes/web/index.js +1 -1
  82. package/bundles/ragents.processes/web/index.js.map +2 -2
  83. package/bundles/ragents.product/ragents-bundle.json +1 -1
  84. package/bundles/ragents.profile-distribution/ragents-bundle.json +1 -1
  85. package/bundles/ragents.reference/actors/notebook/package.json +16 -0
  86. package/bundles/ragents.reference/actors/notebook/src/client.tsx +31 -0
  87. package/bundles/ragents.reference/actors/notebook/src/server.ts +27 -0
  88. package/bundles/ragents.reference/actors/notebook/tests/program.test.ts +27 -0
  89. package/bundles/ragents.reference/ragents-bundle.json +4 -3
  90. package/bundles/ragents.reference/run-scripts/quick-note/RUN.md +14 -0
  91. package/bundles/ragents.reference/run-scripts/quick-note/package.json +9 -0
  92. package/bundles/ragents.reference/run-scripts/quick-note/src/server.ts +29 -0
  93. package/bundles/ragents.reference/run-scripts/quick-note/tests/program.test.ts +43 -0
  94. package/bundles/ragents.reference/run-scripts/run-roster/RUN.md +19 -0
  95. package/bundles/ragents.reference/run-scripts/run-roster/package.json +9 -0
  96. package/bundles/ragents.reference/run-scripts/run-roster/src/server.ts +26 -0
  97. package/bundles/ragents.reference/run-scripts/run-roster/tests/program.test.ts +47 -0
  98. package/bundles/ragents.todo/ragents-bundle.json +1 -1
  99. package/bundles/ragents.transcript/ragents-bundle.json +1 -1
  100. package/bundles/ragents.watch/ragents-bundle.json +1 -1
  101. package/bundles/ragents.workspace/ragents-bundle.json +2 -2
  102. package/bundles/ragents.workspace/web/classes.json +1 -1
  103. package/bundles/ragents.workspace/web/index.js +1 -1
  104. package/bundles/ragents.workspace/web/index.js.map +2 -2
  105. package/package.json +3 -3
  106. package/packages/ragents/src/domain/vocabulary.ts +4 -0
  107. package/packages/ragents/src/index.ts +3 -1
  108. package/packages/ragents/src/plugin-host.ts +62 -10
  109. package/packages/ragents/src/plugin-types.ts +11 -0
  110. package/packages/ragents/src/runtime/guards.ts +2 -1
  111. package/packages/ragents/src/typescript/async-compiler.ts +11 -1
  112. package/plugins/ragents.actor-programs/server/index.ts +3 -0
  113. package/plugins/ragents.actor-programs/server/runtime.ts +424 -28
  114. package/plugins/ragents.actor-programs/server/script-state.ts +54 -0
  115. package/plugins/ragents.actor-programs/server/tool-contributor.ts +2 -0
  116. package/plugins/ragents.ask/server/ask-tool.ts +1 -0
  117. package/plugins/ragents.documents/web/DocumentViewer.tsx +2 -2
  118. package/plugins/ragents.orchestration/ragents-plugin.json +1 -0
  119. package/plugins/ragents.orchestration/server/contract.ts +14 -0
  120. package/plugins/ragents.orchestration/server/index.ts +4 -1
  121. package/plugins/ragents.orchestration/server/surface-tool.ts +58 -2
  122. package/plugins/ragents.orchestration/surface.hbs +5 -0
  123. package/plugins/ragents.orchestration/web/ExecutionsPanel.tsx +1 -1
  124. package/plugins/ragents.orchestration/web/FlowInspector.tsx +1 -1
  125. package/plugins/ragents.orchestration/web/JournalStatus.tsx +1 -1
  126. package/plugins/ragents.orchestration/web/format.ts +1 -1
  127. package/plugins/ragents.overseer/web/index.tsx +51 -3
  128. package/plugins/ragents.processes/web/processes.ts +1 -1
  129. package/plugins/ragents.reference/actors/notebook/package.json +16 -0
  130. package/plugins/ragents.reference/actors/notebook/src/client.tsx +31 -0
  131. package/plugins/ragents.reference/actors/notebook/src/server.ts +27 -0
  132. package/plugins/ragents.reference/actors/notebook/tests/program.test.ts +27 -0
  133. package/plugins/ragents.reference/run-scripts/quick-note/RUN.md +14 -0
  134. package/plugins/ragents.reference/run-scripts/quick-note/package.json +9 -0
  135. package/plugins/ragents.reference/run-scripts/quick-note/src/server.ts +29 -0
  136. package/plugins/ragents.reference/run-scripts/quick-note/tests/program.test.ts +43 -0
  137. package/plugins/ragents.reference/run-scripts/run-roster/RUN.md +19 -0
  138. package/plugins/ragents.reference/run-scripts/run-roster/package.json +9 -0
  139. package/plugins/ragents.reference/run-scripts/run-roster/src/server.ts +26 -0
  140. package/plugins/ragents.reference/run-scripts/run-roster/tests/program.test.ts +47 -0
  141. package/plugins/ragents.workspace/web/FileBrowser.tsx +1 -1
  142. package/scripts/agent/agent-cli.ts +46 -2
  143. package/scripts/package/ragents.mjs +3 -1
  144. package/apps/web/dist/assets/main-DJmCHGzM.js +0 -11
  145. package/apps/web/dist/assets/runPanel-nk_aMxSn.js +0 -21
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["ragents-host-read:read", "ragents-host-value:typebox#Type", "ragents-host-value:@ragents/engine/src/rpc/contract#defineChannel", "ragents-host-value:@ragents/engine/src/rpc/contract#defineOperation", "ragents-host-value:@ragents/engine/src/http/contracts#openJson", "../../../plugins/ragents.processes/contract.ts", "ragents-host-value:react#useEffect", "ragents-host-value:react#useLayoutEffect", "ragents-host-value:react#useRef", "ragents-host-value:react#useState", "ragents-host-value:@ragents/web/AccessContext#useAccess", "ragents-host-value:@ragents/web/ui#Dialog", "ragents-host-value:@ragents/web/ui#DialogBody", "ragents-host-value:@ragents/web/ui#DialogContent", "ragents-host-value:@ragents/web/ui#DialogHeader", "ragents-host-value:@ragents/web/ui#DialogTitle", "ragents-host-value:@ragents/web/ui#StopButton", "ragents-host-value:@ragents/web/ui#cn", "ragents-host-value:@ragents/web/Toolbar#ToolbarCopy", "ragents-host-value:@ragents/web/Toolbar#ToolbarItem", "ragents-host-value:@ragents/web/Toolbar#ToolbarLabel", "ragents-host-value:@ragents/web/Toolbar#ToolbarText", "ragents-host-value:@ragents/web/rpc#rpc", "ragents-host-value:@ragents/web/lib/guards#isRecord", "../../../plugins/ragents.processes/web/processes.ts", "ragents-host-value:react/jsx-runtime#Fragment", "ragents-host-value:react/jsx-runtime#jsx", "ragents-host-value:react/jsx-runtime#jsxs", "../../../plugins/ragents.processes/web/ProcessHeader.tsx", "../../../plugins/ragents.processes/web/index.tsx"],
4
- "sourcesContent": ["export const read = (specifier, name) => {\n const module = globalThis[\"__ragentsHostModules\"]?.[specifier];\n if (module === undefined) throw new Error(`The host does not provide ${specifier}`);\n if (!(name in module)) throw new Error(`The host does not provide ${name} from ${specifier}; the bundle was built against a newer host`);\n return module[name];\n};", "import { read } from \"ragents-host-read:read\";\nexport default read(\"typebox\", \"Type\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/engine/src/rpc/contract\", \"defineChannel\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/engine/src/rpc/contract\", \"defineOperation\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/engine/src/http/contracts\", \"openJson\");\n", "import { Type } from \"typebox\";\nimport { defineChannel, defineOperation } from \"@ragents/engine/src/rpc/contract\";\nimport { openJson } from \"@ragents/engine/src/http/contracts\";\n\nexport const PROCESSES_PLUGIN_ID = \"ragents.processes\";\n\nexport interface RunProcessPort {\n port: number;\n address: string;\n}\n\nexport type RunProcessOrigin = \"tool-call\" | \"background\";\n\nexport interface RunProcess {\n id: string;\n pid: number;\n label: string;\n command: string;\n origin: RunProcessOrigin;\n ports: RunProcessPort[];\n seenSince: string;\n}\n\nexport interface RunProcessSnapshot {\n runId: string;\n observedAt: string;\n processes: RunProcess[];\n}\n\nexport type RunProcessMessage =\n | { kind: \"snapshot\"; snapshot: RunProcessSnapshot }\n | { kind: \"error\"; error: string };\n\nconst runId = Type.String({ minLength: 1, maxLength: 64, description: \"Run id\" });\n\nexport const processesContracts = {\n snapshot: defineOperation({\n id: \"ragents.processes.snapshot\",\n description: \"The observed processes of a run with their open ports. Rights: runs.read and ragents.processes.read.\",\n rights: [\"runs.read\", \"ragents.processes.read\"],\n input: Type.Object({ runId }, { additionalProperties: false }),\n result: openJson<RunProcessSnapshot>(\"RunProcessSnapshot\"),\n }),\n stop: defineOperation({\n id: \"ragents.processes.stop\",\n description: \"End a process of the run. Rights: runs.read, runs.write and runs.inspect.\",\n rights: [\"runs.read\", \"runs.write\", \"runs.inspect\"],\n input: Type.Object({\n runId,\n processId: Type.String({ pattern: \"^[1-9][0-9]*-[a-f0-9]{64}$\", description: \"Process id from the snapshot\" }),\n }, { additionalProperties: false }),\n result: Type.Null(),\n }),\n live: defineChannel({\n id: \"ragents.processes\",\n description: \"The live state of a run's process monitoring. Rights: runs.read and ragents.processes.read.\",\n rights: [\"runs.read\", \"ragents.processes.read\"],\n params: Type.Object({ runId }, { additionalProperties: false }),\n message: openJson<RunProcessMessage>(\"RunProcessMessage\"),\n }),\n};\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react\", \"useEffect\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react\", \"useLayoutEffect\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react\", \"useRef\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react\", \"useState\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/AccessContext\", \"useAccess\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"Dialog\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"DialogBody\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"DialogContent\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"DialogHeader\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"DialogTitle\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"StopButton\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"cn\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/Toolbar\", \"ToolbarCopy\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/Toolbar\", \"ToolbarItem\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/Toolbar\", \"ToolbarLabel\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/Toolbar\", \"ToolbarText\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/rpc\", \"rpc\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/lib/guards\", \"isRecord\");\n", "import { isRecord } from \"@ragents/web/lib/guards\";\nimport type { RunProcess, RunProcessMessage, RunProcessPort, RunProcessSnapshot } from \"../contract\";\n\nexport const VISIBLE_PROCESSES = 4;\n\nconst ORIGINS = [\"tool-call\", \"background\"] as const;\n\nconst portFrom = (value: unknown): RunProcessPort => {\n if (!isRecord(value) || typeof value.port !== \"number\" || typeof value.address !== \"string\") {\n throw new Error(\"A port entry of the process monitoring is unreadable\");\n }\n return { port: value.port, address: value.address };\n};\n\nconst processFrom = (value: unknown): RunProcess => {\n if (!isRecord(value) || typeof value.id !== \"string\" || !value.id || typeof value.pid !== \"number\" || typeof value.label !== \"string\"\n || typeof value.command !== \"string\" || typeof value.seenSince !== \"string\"\n || !ORIGINS.includes(value.origin as RunProcess[\"origin\"]) || !Array.isArray(value.ports)) {\n throw new Error(\"A process entry of the process monitoring is unreadable\");\n }\n return {\n id: value.id,\n pid: value.pid,\n label: value.label,\n command: value.command,\n origin: value.origin as RunProcess[\"origin\"],\n ports: value.ports.map(portFrom),\n seenSince: value.seenSince,\n };\n};\n\nconst snapshotFrom = (value: unknown): RunProcessSnapshot => {\n if (!isRecord(value) || typeof value.runId !== \"string\" || typeof value.observedAt !== \"string\"\n || !Array.isArray(value.processes)) {\n throw new Error(\"The process monitoring snapshot is unreadable\");\n }\n return { runId: value.runId, observedAt: value.observedAt, processes: value.processes.map(processFrom) };\n};\n\nexport const messageFrom = (value: unknown): RunProcessMessage => {\n if (!isRecord(value)) throw new Error(\"The process monitoring message is unreadable\");\n if (value.kind === \"error\" && typeof value.error === \"string\") return { kind: \"error\", error: value.error };\n if (value.kind === \"snapshot\") return { kind: \"snapshot\", snapshot: snapshotFrom(value.snapshot) };\n throw new Error(\"The process monitoring message has an unknown kind\");\n};\n\nexport const serviceUrl = (hostname: string, port: number): string =>\n `http://${hostname.includes(\":\") ? `[${hostname}]` : hostname}:${port}/`;\n\nexport const kindLabel = (process: RunProcess): string => process.ports.length > 0 ? \"Service\" : \"Process\";\n\nconst originText = (origin: RunProcess[\"origin\"]): string =>\n origin === \"background\" ? \"keeps running in the background\" : \"runs in a tool call\";\n\nconst timeText = (iso: string): string => {\n const parsed = new Date(iso);\n return Number.isNaN(parsed.getTime()) ? iso : parsed.toLocaleTimeString(\"en-US\");\n};\n\nexport const titleOf = (process: RunProcess): string => {\n const ports = process.ports.length > 0\n ? `\\nListening on ${process.ports.map((port) => `${port.address}:${port.port}`).join(\", \")}`\n : \"\";\n return `${process.command}\\nPID ${process.pid}, ${originText(process.origin)}, observed since ${timeText(process.seenSince)}${ports}`;\n};\n\nexport interface VisibleProcesses {\n shown: readonly RunProcess[];\n hidden: number;\n}\n\nexport const visibleProcesses = (processes: readonly RunProcess[]): VisibleProcesses => ({\n shown: processes.slice(0, VISIBLE_PROCESSES),\n hidden: Math.max(0, processes.length - VISIBLE_PROCESSES),\n});\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react/jsx-runtime\", \"Fragment\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react/jsx-runtime\", \"jsx\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react/jsx-runtime\", \"jsxs\");\n", "import { useEffect, useLayoutEffect, useRef, useState, type ComponentType, type FocusEvent } from \"react\";\nimport { useAccess } from \"@ragents/web/AccessContext\";\nimport type { SessionHeaderContext } from \"@ragents/web/PluginRegistry\";\nimport { Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle, StopButton, cn } from \"@ragents/web/ui\";\nimport { ToolbarCopy, ToolbarItem, ToolbarLabel, ToolbarText } from \"@ragents/web/Toolbar\";\nimport { rpc } from \"@ragents/web/rpc\";\nimport { processesContracts, type RunProcess, type RunProcessSnapshot } from \"../contract\";\nimport { kindLabel, messageFrom, serviceUrl, titleOf, visibleProcesses } from \"./processes\";\n\ninterface ProcessWatchState {\n snapshot: RunProcessSnapshot | undefined;\n error: string | undefined;\n}\n\nconst idle: ProcessWatchState = { snapshot: undefined, error: undefined };\n\nconst pillClass = \"inline-flex h-6 min-w-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border-soft bg-card/78 pl-2.5 pr-0.5 text-xs font-medium text-muted-foreground data-[origin=background]:border-dashed [&>svg]:flex-none\";\nconst portClass = \"flex-none rounded-full bg-primary/14 px-1.5 py-px text-foreground tabular-nums underline underline-offset-2 hover:bg-primary/28 focus-visible:bg-primary/28\";\nconst stopClass = \"size-5 min-w-5 rounded-full p-0.75 [&_svg]:size-2.5\";\n\nconst useRunProcesses = (runId: string): ProcessWatchState => {\n const [state, setState] = useState<ProcessWatchState>(idle);\n useEffect(() => {\n setState(idle);\n return rpc.subscribe(processesContracts.live, { runId }, (data) => {\n try {\n const message = messageFrom(data);\n if (message.kind === \"snapshot\" && message.snapshot.runId !== runId) throw new Error(\"The process snapshot belongs to another run\");\n setState((current) => message.kind === \"snapshot\"\n ? { snapshot: message.snapshot, error: undefined }\n : { snapshot: current.snapshot, error: message.error });\n } catch (caught) {\n setState((current) => ({ ...current, error: caught instanceof Error ? caught.message : String(caught) }));\n }\n }, (message) => setState((current) => ({ ...current, error: message })));\n }, [runId]);\n return state;\n};\n\nfunction IconProcess() {\n return <svg aria-hidden fill=\"none\" height=\"12\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.8\" viewBox=\"0 0 24 24\" width=\"12\">\n <rect height=\"16\" rx=\"2\" width=\"18\" x=\"3\" y=\"4\" />\n <path d=\"m7 9 3 3-3 3M13 15h4\" />\n </svg>;\n}\n\ninterface StopState { busy?: boolean; error?: string }\n\nfunction ProcessPill({ process, state, writable, onStop, toolbar = false }: { process: RunProcess; state?: StopState; writable: boolean; onStop: () => void; toolbar?: boolean }) {\n const stop = <StopButton busy={state?.busy === true} className={stopClass} disabled={!writable || state?.busy}\n label={state?.busy ? `Stopping ${process.label}` : `Stop ${process.label}`}\n onClick={onStop} size=\"icon-xs\"\n title={!writable ? \"Write or inspect rights are missing to stop\" : state?.busy ? \"Stopping ...\" : `Stop ${process.label}`} />;\n const ports = process.ports.map((port) => <a className={portClass} href={serviceUrl(window.location.hostname, port.port)}\n key={`${port.address}:${port.port}`} rel=\"noreferrer\" target=\"_blank\" title={`Open ${port.address}:${port.port} in a new tab`}>\n :{port.port}\n </a>);\n return <div className={cn(\"flex min-w-0 flex-col\", toolbar ? \"flex-none self-stretch max-md:not-first:hidden\" : \"w-full\")} data-process-id={process.id}>\n {toolbar\n ? <ToolbarItem className=\"max-w-none flex-1 data-[origin=background]:[border-right-style:dashed]\" data-origin={process.origin} title={titleOf(process)}>\n <IconProcess />\n <ToolbarCopy className=\"w-35 flex-none\">\n <ToolbarLabel>{kindLabel(process)}</ToolbarLabel>\n <ToolbarText>{process.label}</ToolbarText>\n </ToolbarCopy>\n {ports}\n {stop}\n </ToolbarItem>\n : <span className={cn(pillClass, \"w-full\")} data-origin={process.origin} title={titleOf(process)}>\n <IconProcess />\n <em className=\"flex-none text-[0.56rem] font-bold uppercase not-italic tracking-[0.035em]\">{kindLabel(process)}</em>\n <span className=\"min-w-0 flex-1 overflow-hidden text-ellipsis text-foreground\">{process.label}</span>\n {ports}\n {stop}\n </span>}\n {state?.error && <span className={cn(\"text-[0.65rem] text-destructive\", toolbar ? \"max-w-62 overflow-hidden text-ellipsis whitespace-nowrap\" : \"[overflow-wrap:anywhere]\")}\n role=\"alert\" title={state.error}>{state.error}</span>}\n </div>;\n}\n\nfunction ProcessHeaderContent({ runId }: { runId: string }) {\n const access = useAccess();\n const writable = access.can(\"runs.write\") && access.can(\"runs.inspect\");\n const state = useRunProcesses(runId);\n const [stops, setStops] = useState<Record<string, StopState>>({});\n const [allOpen, setAllOpen] = useState(false);\n const requests = useRef(new Map<string, AbortController>());\n const rootRef = useRef<HTMLDivElement>(null);\n const dialogRef = useRef<HTMLDivElement>(null);\n const focused = useRef<HTMLElement>(null);\n const fallback = useRef<HTMLElement>(null);\n const processes = state.snapshot?.processes ?? [];\n const { shown, hidden } = visibleProcesses(processes);\n useEffect(() => {\n const active = requests.current;\n return () => { for (const controller of active.values()) controller.abort(); active.clear(); };\n }, []);\n useLayoutEffect(() => {\n if (!focused.current || focused.current.isConnected || document.activeElement !== document.body) return;\n const target = (allOpen ? dialogRef.current : rootRef.current)?.querySelector<HTMLElement>(\"button:not(:disabled), a[href]\")\n ?? (allOpen ? dialogRef.current : null) ?? fallback.current;\n focused.current = null;\n target?.focus({ preventScroll: true });\n }, [state.snapshot, allOpen]);\n const rememberFocus = (event: FocusEvent<HTMLElement>) => {\n if (!(event.target instanceof HTMLElement)) return;\n focused.current = event.target;\n const header = rootRef.current?.closest(\"header\");\n fallback.current = [...(header?.querySelectorAll<HTMLElement>(\"button:not(:disabled), a[href]\") ?? [])]\n .find((element) => !rootRef.current?.contains(element)) ?? null;\n };\n const stop = async (process: RunProcess) => {\n if (!writable || requests.current.has(process.id) || stops[process.id]?.busy) return;\n const controller = new AbortController();\n requests.current.set(process.id, controller);\n setStops((current) => ({ ...current, [process.id]: { busy: true } }));\n try {\n await rpc.call(processesContracts.stop, { runId, processId: process.id }, { signal: controller.signal });\n } catch (cause) {\n if (!controller.signal.aborted) setStops((current) => ({ ...current, [process.id]: { error: cause instanceof Error ? cause.message : String(cause) } }));\n } finally { requests.current.delete(process.id); }\n };\n const renderProcess = (process: RunProcess, toolbar = false) => <ProcessPill key={process.id} process={process} state={stops[process.id]} writable={writable} toolbar={toolbar} onStop={() => { void stop(process); }} />;\n if (shown.length === 0 && state.error === undefined && !allOpen) return null;\n return <>\n <div aria-label=\"Processes and ports of the run\" className=\"flex min-w-0 flex-none items-stretch self-stretch\" ref={rootRef} onFocusCapture={rememberFocus}>\n {shown.map((process) => renderProcess(process, true))}\n {(processes.length > 1 || allOpen) && <ToolbarItem as=\"button\" className=\"md:data-[hidden=false]:hidden\" data-hidden={hidden > 0 || allOpen} type=\"button\" onClick={() => setAllOpen(true)} title=\"Show all processes of the run\">\n <span className=\"max-md:hidden\">{hidden > 0 ? `+${hidden} more` : \"Processes\"}</span><span className=\"hidden max-md:inline\">All {processes.length}</span>\n </ToolbarItem>}\n {state.error !== undefined && <ToolbarItem className=\"w-42 text-destructive\" role=\"status\" title={state.error}><ToolbarCopy><ToolbarLabel>Processes</ToolbarLabel><ToolbarText>Monitoring disrupted</ToolbarText></ToolbarCopy></ToolbarItem>}\n </div>\n {allOpen && <Dialog open onOpenChange={(open) => {\n if (open) return;\n setAllOpen(false);\n if (processes.length === 0) requestAnimationFrame(() => fallback.current?.focus({ preventScroll: true }));\n }}>\n <DialogContent scope=\"run\">\n <DialogHeader><DialogTitle>Processes and ports</DialogTitle></DialogHeader>\n <DialogBody className=\"flex flex-col gap-3 outline-none\" ref={dialogRef} tabIndex={-1} onFocusCapture={rememberFocus}>\n {processes.length > 0 ? processes.map((process) => renderProcess(process)) : <p role=\"status\">No active processes.</p>}\n {state.error !== undefined && <p className=\"text-destructive\" role=\"alert\">{state.error}</p>}\n </DialogBody>\n </DialogContent>\n </Dialog>}\n </>;\n}\n\nexport const processHeader = (): ComponentType<SessionHeaderContext> =>\n function ProcessHeader({ session }: SessionHeaderContext) {\n const access = useAccess();\n return access.can(\"runs.read\") && access.can(\"ragents.processes.read\")\n ? <ProcessHeaderContent key={session.session.id} runId={session.session.id} /> : null;\n };\n", "import {\n type WebPlugin,\n type WebPluginDescriptor,\n} from \"@ragents/web/PluginRegistry\";\nimport { PROCESSES_PLUGIN_ID } from \"../contract\";\nimport { processHeader } from \"./ProcessHeader\";\n\nconst configuredPlugin = (descriptor: WebPluginDescriptor): WebPlugin => ({\n ...descriptor,\n sessionHeaders: [{\n readRight: \"ragents.processes.read\",\n requiresWorkspace: true,\n id: \"ragents.processes.live\",\n order: 110,\n Header: processHeader(),\n }],\n});\n\nconst descriptor: WebPluginDescriptor = { id: PROCESSES_PLUGIN_ID };\n\nexport const webPlugin: WebPlugin = {\n ...descriptor,\n activate: () => configuredPlugin(descriptor),\n};\n"],
5
- "mappings": "AAAO,IAAMA,EAAO,CAACC,EAAWC,IAAS,CACvC,IAAMC,EAAS,WAAW,uBAA0BF,CAAS,EAC7D,GAAIE,IAAW,OAAW,MAAM,IAAI,MAAM,6BAA6BF,CAAS,EAAE,EAClF,GAAI,EAAEC,KAAQC,GAAS,MAAM,IAAI,MAAM,6BAA6BD,CAAI,SAASD,CAAS,6CAA6C,EACvI,OAAOE,EAAOD,CAAI,CACpB,ECJA,IAAOE,EAAQC,EAAK,UAAW,MAAM,ECArC,IAAOC,EAAQC,EAAK,mCAAoC,eAAe,ECAvE,IAAOC,EAAQC,EAAK,mCAAoC,iBAAiB,ECAzE,IAAOC,EAAQC,EAAK,qCAAsC,UAAU,ECG7D,IAAMC,EAAsB,oBA6B7BC,EAAQC,EAAK,OAAO,CAAE,UAAW,EAAG,UAAW,GAAI,YAAa,QAAS,CAAC,EAEnEC,EAAqB,CAChC,SAAUC,EAAgB,CACxB,GAAI,6BACJ,YAAa,uGACb,OAAQ,CAAC,YAAa,wBAAwB,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AK,IACrF,EClJF,IAAMC,GAAoBC,IAAgD,CACxE,GAAGA,EACH,eAAgB,CAAC,CACf,UAAW,yBACX,kBAAmB,GACnB,GAAI,yBACJ,MAAO,IACP,OAAQC,GAAc,CACxB,CAAC,CACH,GAEMD,GAAkC,CAAE,GAAIE,CAAoB,EAErDC,GAAuB,CAClC,GAAGH,GACH,SAAU,IAAMD,GAAiBC,EAAU,CAC7C",
4
+ "sourcesContent": ["export const read = (specifier, name) => {\n const module = globalThis[\"__ragentsHostModules\"]?.[specifier];\n if (module === undefined) throw new Error(`The host does not provide ${specifier}`);\n if (!(name in module)) throw new Error(`The host does not provide ${name} from ${specifier}; the bundle was built against a newer host`);\n return module[name];\n};", "import { read } from \"ragents-host-read:read\";\nexport default read(\"typebox\", \"Type\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/engine/src/rpc/contract\", \"defineChannel\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/engine/src/rpc/contract\", \"defineOperation\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/engine/src/http/contracts\", \"openJson\");\n", "import { Type } from \"typebox\";\nimport { defineChannel, defineOperation } from \"@ragents/engine/src/rpc/contract\";\nimport { openJson } from \"@ragents/engine/src/http/contracts\";\n\nexport const PROCESSES_PLUGIN_ID = \"ragents.processes\";\n\nexport interface RunProcessPort {\n port: number;\n address: string;\n}\n\nexport type RunProcessOrigin = \"tool-call\" | \"background\";\n\nexport interface RunProcess {\n id: string;\n pid: number;\n label: string;\n command: string;\n origin: RunProcessOrigin;\n ports: RunProcessPort[];\n seenSince: string;\n}\n\nexport interface RunProcessSnapshot {\n runId: string;\n observedAt: string;\n processes: RunProcess[];\n}\n\nexport type RunProcessMessage =\n | { kind: \"snapshot\"; snapshot: RunProcessSnapshot }\n | { kind: \"error\"; error: string };\n\nconst runId = Type.String({ minLength: 1, maxLength: 64, description: \"Run id\" });\n\nexport const processesContracts = {\n snapshot: defineOperation({\n id: \"ragents.processes.snapshot\",\n description: \"The observed processes of a run with their open ports. Rights: runs.read and ragents.processes.read.\",\n rights: [\"runs.read\", \"ragents.processes.read\"],\n input: Type.Object({ runId }, { additionalProperties: false }),\n result: openJson<RunProcessSnapshot>(\"RunProcessSnapshot\"),\n }),\n stop: defineOperation({\n id: \"ragents.processes.stop\",\n description: \"End a process of the run. Rights: runs.read, runs.write and runs.inspect.\",\n rights: [\"runs.read\", \"runs.write\", \"runs.inspect\"],\n input: Type.Object({\n runId,\n processId: Type.String({ pattern: \"^[1-9][0-9]*-[a-f0-9]{64}$\", description: \"Process id from the snapshot\" }),\n }, { additionalProperties: false }),\n result: Type.Null(),\n }),\n live: defineChannel({\n id: \"ragents.processes\",\n description: \"The live state of a run's process monitoring. Rights: runs.read and ragents.processes.read.\",\n rights: [\"runs.read\", \"ragents.processes.read\"],\n params: Type.Object({ runId }, { additionalProperties: false }),\n message: openJson<RunProcessMessage>(\"RunProcessMessage\"),\n }),\n};\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react\", \"useEffect\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react\", \"useLayoutEffect\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react\", \"useRef\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react\", \"useState\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/AccessContext\", \"useAccess\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"Dialog\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"DialogBody\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"DialogContent\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"DialogHeader\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"DialogTitle\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"StopButton\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/ui\", \"cn\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/Toolbar\", \"ToolbarCopy\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/Toolbar\", \"ToolbarItem\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/Toolbar\", \"ToolbarLabel\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/Toolbar\", \"ToolbarText\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/rpc\", \"rpc\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"@ragents/web/lib/guards\", \"isRecord\");\n", "import { isRecord } from \"@ragents/web/lib/guards\";\nimport type { RunProcess, RunProcessMessage, RunProcessPort, RunProcessSnapshot } from \"../contract\";\n\nexport const VISIBLE_PROCESSES = 4;\n\nconst ORIGINS = [\"tool-call\", \"background\"] as const;\n\nconst portFrom = (value: unknown): RunProcessPort => {\n if (!isRecord(value) || typeof value.port !== \"number\" || typeof value.address !== \"string\") {\n throw new Error(\"A port entry of the process monitoring is unreadable\");\n }\n return { port: value.port, address: value.address };\n};\n\nconst processFrom = (value: unknown): RunProcess => {\n if (!isRecord(value) || typeof value.id !== \"string\" || !value.id || typeof value.pid !== \"number\" || typeof value.label !== \"string\"\n || typeof value.command !== \"string\" || typeof value.seenSince !== \"string\"\n || !ORIGINS.includes(value.origin as RunProcess[\"origin\"]) || !Array.isArray(value.ports)) {\n throw new Error(\"A process entry of the process monitoring is unreadable\");\n }\n return {\n id: value.id,\n pid: value.pid,\n label: value.label,\n command: value.command,\n origin: value.origin as RunProcess[\"origin\"],\n ports: value.ports.map(portFrom),\n seenSince: value.seenSince,\n };\n};\n\nconst snapshotFrom = (value: unknown): RunProcessSnapshot => {\n if (!isRecord(value) || typeof value.runId !== \"string\" || typeof value.observedAt !== \"string\"\n || !Array.isArray(value.processes)) {\n throw new Error(\"The process monitoring snapshot is unreadable\");\n }\n return { runId: value.runId, observedAt: value.observedAt, processes: value.processes.map(processFrom) };\n};\n\nexport const messageFrom = (value: unknown): RunProcessMessage => {\n if (!isRecord(value)) throw new Error(\"The process monitoring message is unreadable\");\n if (value.kind === \"error\" && typeof value.error === \"string\") return { kind: \"error\", error: value.error };\n if (value.kind === \"snapshot\") return { kind: \"snapshot\", snapshot: snapshotFrom(value.snapshot) };\n throw new Error(\"The process monitoring message has an unknown kind\");\n};\n\nexport const serviceUrl = (hostname: string, port: number): string =>\n `http://${hostname.includes(\":\") ? `[${hostname}]` : hostname}:${port}/`;\n\nexport const kindLabel = (process: RunProcess): string => process.ports.length > 0 ? \"Service\" : \"Process\";\n\nconst originText = (origin: RunProcess[\"origin\"]): string =>\n origin === \"background\" ? \"keeps running in the background\" : \"runs in a tool call\";\n\nconst timeText = (iso: string): string => {\n const parsed = new Date(iso);\n return Number.isNaN(parsed.getTime()) ? iso : parsed.toLocaleTimeString();\n};\n\nexport const titleOf = (process: RunProcess): string => {\n const ports = process.ports.length > 0\n ? `\\nListening on ${process.ports.map((port) => `${port.address}:${port.port}`).join(\", \")}`\n : \"\";\n return `${process.command}\\nPID ${process.pid}, ${originText(process.origin)}, observed since ${timeText(process.seenSince)}${ports}`;\n};\n\nexport interface VisibleProcesses {\n shown: readonly RunProcess[];\n hidden: number;\n}\n\nexport const visibleProcesses = (processes: readonly RunProcess[]): VisibleProcesses => ({\n shown: processes.slice(0, VISIBLE_PROCESSES),\n hidden: Math.max(0, processes.length - VISIBLE_PROCESSES),\n});\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react/jsx-runtime\", \"Fragment\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react/jsx-runtime\", \"jsx\");\n", "import { read } from \"ragents-host-read:read\";\nexport default read(\"react/jsx-runtime\", \"jsxs\");\n", "import { useEffect, useLayoutEffect, useRef, useState, type ComponentType, type FocusEvent } from \"react\";\nimport { useAccess } from \"@ragents/web/AccessContext\";\nimport type { SessionHeaderContext } from \"@ragents/web/PluginRegistry\";\nimport { Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle, StopButton, cn } from \"@ragents/web/ui\";\nimport { ToolbarCopy, ToolbarItem, ToolbarLabel, ToolbarText } from \"@ragents/web/Toolbar\";\nimport { rpc } from \"@ragents/web/rpc\";\nimport { processesContracts, type RunProcess, type RunProcessSnapshot } from \"../contract\";\nimport { kindLabel, messageFrom, serviceUrl, titleOf, visibleProcesses } from \"./processes\";\n\ninterface ProcessWatchState {\n snapshot: RunProcessSnapshot | undefined;\n error: string | undefined;\n}\n\nconst idle: ProcessWatchState = { snapshot: undefined, error: undefined };\n\nconst pillClass = \"inline-flex h-6 min-w-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border-soft bg-card/78 pl-2.5 pr-0.5 text-xs font-medium text-muted-foreground data-[origin=background]:border-dashed [&>svg]:flex-none\";\nconst portClass = \"flex-none rounded-full bg-primary/14 px-1.5 py-px text-foreground tabular-nums underline underline-offset-2 hover:bg-primary/28 focus-visible:bg-primary/28\";\nconst stopClass = \"size-5 min-w-5 rounded-full p-0.75 [&_svg]:size-2.5\";\n\nconst useRunProcesses = (runId: string): ProcessWatchState => {\n const [state, setState] = useState<ProcessWatchState>(idle);\n useEffect(() => {\n setState(idle);\n return rpc.subscribe(processesContracts.live, { runId }, (data) => {\n try {\n const message = messageFrom(data);\n if (message.kind === \"snapshot\" && message.snapshot.runId !== runId) throw new Error(\"The process snapshot belongs to another run\");\n setState((current) => message.kind === \"snapshot\"\n ? { snapshot: message.snapshot, error: undefined }\n : { snapshot: current.snapshot, error: message.error });\n } catch (caught) {\n setState((current) => ({ ...current, error: caught instanceof Error ? caught.message : String(caught) }));\n }\n }, (message) => setState((current) => ({ ...current, error: message })));\n }, [runId]);\n return state;\n};\n\nfunction IconProcess() {\n return <svg aria-hidden fill=\"none\" height=\"12\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.8\" viewBox=\"0 0 24 24\" width=\"12\">\n <rect height=\"16\" rx=\"2\" width=\"18\" x=\"3\" y=\"4\" />\n <path d=\"m7 9 3 3-3 3M13 15h4\" />\n </svg>;\n}\n\ninterface StopState { busy?: boolean; error?: string }\n\nfunction ProcessPill({ process, state, writable, onStop, toolbar = false }: { process: RunProcess; state?: StopState; writable: boolean; onStop: () => void; toolbar?: boolean }) {\n const stop = <StopButton busy={state?.busy === true} className={stopClass} disabled={!writable || state?.busy}\n label={state?.busy ? `Stopping ${process.label}` : `Stop ${process.label}`}\n onClick={onStop} size=\"icon-xs\"\n title={!writable ? \"Write or inspect rights are missing to stop\" : state?.busy ? \"Stopping ...\" : `Stop ${process.label}`} />;\n const ports = process.ports.map((port) => <a className={portClass} href={serviceUrl(window.location.hostname, port.port)}\n key={`${port.address}:${port.port}`} rel=\"noreferrer\" target=\"_blank\" title={`Open ${port.address}:${port.port} in a new tab`}>\n :{port.port}\n </a>);\n return <div className={cn(\"flex min-w-0 flex-col\", toolbar ? \"flex-none self-stretch max-md:not-first:hidden\" : \"w-full\")} data-process-id={process.id}>\n {toolbar\n ? <ToolbarItem className=\"max-w-none flex-1 data-[origin=background]:[border-right-style:dashed]\" data-origin={process.origin} title={titleOf(process)}>\n <IconProcess />\n <ToolbarCopy className=\"w-35 flex-none\">\n <ToolbarLabel>{kindLabel(process)}</ToolbarLabel>\n <ToolbarText>{process.label}</ToolbarText>\n </ToolbarCopy>\n {ports}\n {stop}\n </ToolbarItem>\n : <span className={cn(pillClass, \"w-full\")} data-origin={process.origin} title={titleOf(process)}>\n <IconProcess />\n <em className=\"flex-none text-[0.56rem] font-bold uppercase not-italic tracking-[0.035em]\">{kindLabel(process)}</em>\n <span className=\"min-w-0 flex-1 overflow-hidden text-ellipsis text-foreground\">{process.label}</span>\n {ports}\n {stop}\n </span>}\n {state?.error && <span className={cn(\"text-[0.65rem] text-destructive\", toolbar ? \"max-w-62 overflow-hidden text-ellipsis whitespace-nowrap\" : \"[overflow-wrap:anywhere]\")}\n role=\"alert\" title={state.error}>{state.error}</span>}\n </div>;\n}\n\nfunction ProcessHeaderContent({ runId }: { runId: string }) {\n const access = useAccess();\n const writable = access.can(\"runs.write\") && access.can(\"runs.inspect\");\n const state = useRunProcesses(runId);\n const [stops, setStops] = useState<Record<string, StopState>>({});\n const [allOpen, setAllOpen] = useState(false);\n const requests = useRef(new Map<string, AbortController>());\n const rootRef = useRef<HTMLDivElement>(null);\n const dialogRef = useRef<HTMLDivElement>(null);\n const focused = useRef<HTMLElement>(null);\n const fallback = useRef<HTMLElement>(null);\n const processes = state.snapshot?.processes ?? [];\n const { shown, hidden } = visibleProcesses(processes);\n useEffect(() => {\n const active = requests.current;\n return () => { for (const controller of active.values()) controller.abort(); active.clear(); };\n }, []);\n useLayoutEffect(() => {\n if (!focused.current || focused.current.isConnected || document.activeElement !== document.body) return;\n const target = (allOpen ? dialogRef.current : rootRef.current)?.querySelector<HTMLElement>(\"button:not(:disabled), a[href]\")\n ?? (allOpen ? dialogRef.current : null) ?? fallback.current;\n focused.current = null;\n target?.focus({ preventScroll: true });\n }, [state.snapshot, allOpen]);\n const rememberFocus = (event: FocusEvent<HTMLElement>) => {\n if (!(event.target instanceof HTMLElement)) return;\n focused.current = event.target;\n const header = rootRef.current?.closest(\"header\");\n fallback.current = [...(header?.querySelectorAll<HTMLElement>(\"button:not(:disabled), a[href]\") ?? [])]\n .find((element) => !rootRef.current?.contains(element)) ?? null;\n };\n const stop = async (process: RunProcess) => {\n if (!writable || requests.current.has(process.id) || stops[process.id]?.busy) return;\n const controller = new AbortController();\n requests.current.set(process.id, controller);\n setStops((current) => ({ ...current, [process.id]: { busy: true } }));\n try {\n await rpc.call(processesContracts.stop, { runId, processId: process.id }, { signal: controller.signal });\n } catch (cause) {\n if (!controller.signal.aborted) setStops((current) => ({ ...current, [process.id]: { error: cause instanceof Error ? cause.message : String(cause) } }));\n } finally { requests.current.delete(process.id); }\n };\n const renderProcess = (process: RunProcess, toolbar = false) => <ProcessPill key={process.id} process={process} state={stops[process.id]} writable={writable} toolbar={toolbar} onStop={() => { void stop(process); }} />;\n if (shown.length === 0 && state.error === undefined && !allOpen) return null;\n return <>\n <div aria-label=\"Processes and ports of the run\" className=\"flex min-w-0 flex-none items-stretch self-stretch\" ref={rootRef} onFocusCapture={rememberFocus}>\n {shown.map((process) => renderProcess(process, true))}\n {(processes.length > 1 || allOpen) && <ToolbarItem as=\"button\" className=\"md:data-[hidden=false]:hidden\" data-hidden={hidden > 0 || allOpen} type=\"button\" onClick={() => setAllOpen(true)} title=\"Show all processes of the run\">\n <span className=\"max-md:hidden\">{hidden > 0 ? `+${hidden} more` : \"Processes\"}</span><span className=\"hidden max-md:inline\">All {processes.length}</span>\n </ToolbarItem>}\n {state.error !== undefined && <ToolbarItem className=\"w-42 text-destructive\" role=\"status\" title={state.error}><ToolbarCopy><ToolbarLabel>Processes</ToolbarLabel><ToolbarText>Monitoring disrupted</ToolbarText></ToolbarCopy></ToolbarItem>}\n </div>\n {allOpen && <Dialog open onOpenChange={(open) => {\n if (open) return;\n setAllOpen(false);\n if (processes.length === 0) requestAnimationFrame(() => fallback.current?.focus({ preventScroll: true }));\n }}>\n <DialogContent scope=\"run\">\n <DialogHeader><DialogTitle>Processes and ports</DialogTitle></DialogHeader>\n <DialogBody className=\"flex flex-col gap-3 outline-none\" ref={dialogRef} tabIndex={-1} onFocusCapture={rememberFocus}>\n {processes.length > 0 ? processes.map((process) => renderProcess(process)) : <p role=\"status\">No active processes.</p>}\n {state.error !== undefined && <p className=\"text-destructive\" role=\"alert\">{state.error}</p>}\n </DialogBody>\n </DialogContent>\n </Dialog>}\n </>;\n}\n\nexport const processHeader = (): ComponentType<SessionHeaderContext> =>\n function ProcessHeader({ session }: SessionHeaderContext) {\n const access = useAccess();\n return access.can(\"runs.read\") && access.can(\"ragents.processes.read\")\n ? <ProcessHeaderContent key={session.session.id} runId={session.session.id} /> : null;\n };\n", "import {\n type WebPlugin,\n type WebPluginDescriptor,\n} from \"@ragents/web/PluginRegistry\";\nimport { PROCESSES_PLUGIN_ID } from \"../contract\";\nimport { processHeader } from \"./ProcessHeader\";\n\nconst configuredPlugin = (descriptor: WebPluginDescriptor): WebPlugin => ({\n ...descriptor,\n sessionHeaders: [{\n readRight: \"ragents.processes.read\",\n requiresWorkspace: true,\n id: \"ragents.processes.live\",\n order: 110,\n Header: processHeader(),\n }],\n});\n\nconst descriptor: WebPluginDescriptor = { id: PROCESSES_PLUGIN_ID };\n\nexport const webPlugin: WebPlugin = {\n ...descriptor,\n activate: () => configuredPlugin(descriptor),\n};\n"],
5
+ "mappings": "AAAO,IAAMA,EAAO,CAACC,EAAWC,IAAS,CACvC,IAAMC,EAAS,WAAW,uBAA0BF,CAAS,EAC7D,GAAIE,IAAW,OAAW,MAAM,IAAI,MAAM,6BAA6BF,CAAS,EAAE,EAClF,GAAI,EAAEC,KAAQC,GAAS,MAAM,IAAI,MAAM,6BAA6BD,CAAI,SAASD,CAAS,6CAA6C,EACvI,OAAOE,EAAOD,CAAI,CACpB,ECJA,IAAOE,EAAQC,EAAK,UAAW,MAAM,ECArC,IAAOC,EAAQC,EAAK,mCAAoC,eAAe,ECAvE,IAAOC,EAAQC,EAAK,mCAAoC,iBAAiB,ECAzE,IAAOC,EAAQC,EAAK,qCAAsC,UAAU,ECG7D,IAAMC,EAAsB,oBA6B7BC,EAAQC,EAAK,OAAO,CAAE,UAAW,EAAG,UAAW,GAAI,YAAa,QAAS,CAAC,EAEnEC,EAAqB,CAChC,SAAUC,EAAgB,CACxB,GAAI,6BACJ,YAAa,uGACb,OAAQ,CAAC,YAAa,wBAAwB,EAC9C,MAAOF,EAAK,OAAO,CAAE,MAAAD,CAAM,EAAG,CAAE,qBAAsB,EAAM,CAAC,EAC7D,OAAQI,EAA6B,oBAAoB,CAC3D,CAAC,EACD,KAAMD,EAAgB,CACpB,GAAI,yBACJ,YAAa,4EACb,OAAQ,CAAC,YAAa,aAAc,cAAc,EAClD,MAAOF,EAA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AU,IAAMD,GAAiBC,EAAU,CAC7C",
6
6
  "names": ["read", "specifier", "name", "module", "typebox_Type_default", "read", "contract_defineChannel_default", "read", "contract_defineOperation_default", "read", "contracts_openJson_default", "read", "PROCESSES_PLUGIN_ID", "runId", "typebox_Type_default", "processesContracts", "contract_defineOperation_default", "contracts_openJson_default", "contract_defineChannel_default", "react_useEffect_default", "read", "react_useLayoutEffect_default", "read", "react_useRef_default", "read", "react_useState_default", "read", "AccessContext_useAccess_default", "read", "ui_Dialog_default", "read", "ui_DialogBody_default", "read", "ui_DialogContent_default", "read", "ui_DialogHeader_default", "read", "ui_DialogTitle_default", "read", "ui_StopButton_default", "read", "ui_cn_default", "read", "Toolbar_ToolbarCopy_default", "read", "Toolbar_ToolbarItem_default", "read", "Toolbar_ToolbarLabel_default", "read", "Toolbar_ToolbarText_default", "read", "rpc_rpc_default", "read", "guards_isRecord_default", "read", "VISIBLE_PROCESSES", "ORIGINS", "portFrom", "value", "guards_isRecord_default", "processFrom", "snapshotFrom", "messageFrom", "serviceUrl", "hostname", "port", "kindLabel", "process", "originText", "origin", "timeText", "iso", "parsed", "titleOf", "ports", "visibleProcesses", "processes", "jsx_runtime_Fragment_default", "read", "jsx_runtime_jsx_default", "read", "jsx_runtime_jsxs_default", "read", "idle", "pillClass", "portClass", "stopClass", "useRunProcesses", "runId", "state", "setState", "react_useState_default", "react_useEffect_default", "rpc_rpc_default", "processesContracts", "data", "message", "messageFrom", "current", "caught", "IconProcess", "jsx_runtime_jsxs_default", "jsx_runtime_jsx_default", "ProcessPill", "process", "writable", "onStop", "toolbar", "stop", "ui_StopButton_default", "ports", "port", "serviceUrl", "ui_cn_default", "Toolbar_ToolbarItem_default", "titleOf", "Toolbar_ToolbarCopy_default", "Toolbar_ToolbarLabel_default", "kindLabel", "Toolbar_ToolbarText_default", "ProcessHeaderContent", "access", "AccessContext_useAccess_default", "stops", "setStops", "allOpen", "setAllOpen", "requests", "react_useRef_default", "rootRef", "dialogRef", "focused", "fallback", "processes", "shown", "hidden", "visibleProcesses", "active", "controller", "react_useLayoutEffect_default", "target", "rememberFocus", "event", "header", "element", "cause", "renderProcess", "jsx_runtime_Fragment_default", "ui_Dialog_default", "open", "ui_DialogContent_default", "ui_DialogHeader_default", "ui_DialogTitle_default", "ui_DialogBody_default", "processHeader", "session", "configuredPlugin", "descriptor", "processHeader", "PROCESSES_PLUGIN_ID", "webPlugin"]
7
7
  }
@@ -76,7 +76,7 @@
76
76
  }
77
77
  },
78
78
  "revision": "7a3eb7a847ce6a4c8324b9c073c3c7a13c760088a194d419fe21342575c4208f",
79
- "sourceRevision": "c6fefb62c103db8f057e3b61019810ffca13b46bcaa449ed5c53d7139a524cfe",
79
+ "sourceRevision": "7c8b3522ee90f89a7d3941ea396c458980ac53c83fa5096eab5a19b5f1a7aa81",
80
80
  "server": "server/index.js",
81
81
  "web": {
82
82
  "entry": "web/index.js",
@@ -53,7 +53,7 @@
53
53
  "web": {}
54
54
  },
55
55
  "revision": "3e99cf5cb8921685ad83aa6aaf9657da4c648f9d68cb744988a73f227c342e1d",
56
- "sourceRevision": "f86bd0f1a439a2c9d143101af2a58881306dd8910240226548afbebfc125682c",
56
+ "sourceRevision": "cbf9d98fe42583b619b84425e648666df7cafd04930cf0692b43a5943fb4bd39",
57
57
  "server": "server/index.js",
58
58
  "exports": {
59
59
  "server": {},
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "notebook",
3
+ "private": true,
4
+ "type": "module",
5
+ "ragents": {
6
+ "title": "Notebook",
7
+ "description": "Keeps the notes that run scripts send it, newest first.",
8
+ "backend": "src/server.ts",
9
+ "views": [
10
+ {
11
+ "id": "main",
12
+ "client": "src/client.tsx"
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import { context, useAppState } from "@ragents/client";
4
+ import * as UI from "@ragents/client/ui";
5
+
6
+ const App = () => {
7
+ const state = useAppState();
8
+ const notes = state.notes ?? [];
9
+ const [status, setStatus] = React.useState("Run scripts add their notes here.");
10
+
11
+ const clear = async (): Promise<void> => {
12
+ const answer = await context.capabilities.call("clear", {});
13
+ setStatus(`Cleared ${answer.cleared} ${answer.cleared === 1 ? "note" : "notes"}.`);
14
+ };
15
+
16
+ return (
17
+ <UI.AppLayout title="Notebook" description={<>{notes.length} {notes.length === 1 ? "note" : "notes"}</>}>
18
+ <UI.Stack>
19
+ <p className="text-muted-foreground" role="status">{status}</p>
20
+ <ul className="border-t border-border">
21
+ {notes.map((note, index) => <li className="min-h-8 border-b border-border-soft py-1.5 [overflow-wrap:anywhere]" key={index}>{note}</li>)}
22
+ </ul>
23
+ <UI.Button disabled={notes.length === 0} onClick={() => void clear()} variant="outline">Clear</UI.Button>
24
+ </UI.Stack>
25
+ </UI.AppLayout>
26
+ );
27
+ };
28
+
29
+ const root = document.getElementById("root");
30
+ if (!root) throw new Error("The #root element is missing.");
31
+ createRoot(root).render(<App />);
@@ -0,0 +1,27 @@
1
+ import { defineActor } from "@ragents/server";
2
+ import { Type } from "typebox";
3
+
4
+ const KEPT_NOTES = 50;
5
+
6
+ const contract = {
7
+ state: Type.Object({ notes: Type.Optional(Type.Array(Type.String())) }, { additionalProperties: false }),
8
+ functions: {
9
+ clear: { label: "Clear notes", input: Type.Object({}, { additionalProperties: false }), output: Type.Object({ cleared: Type.Integer() }, { additionalProperties: false }) },
10
+ },
11
+ input: { capabilities: [] },
12
+ } as const;
13
+
14
+ export default defineActor(contract, {
15
+ functions: {
16
+ clear: (_input, context) => {
17
+ const cleared = context.state.read().notes?.length ?? 0;
18
+ context.state.replace({ notes: [] });
19
+ return { cleared };
20
+ },
21
+ },
22
+ onInput: (input, context) => {
23
+ const note = input.content.trim();
24
+ if (!note) throw new Error("A note needs text.");
25
+ context.state.replace({ notes: [note, ...context.state.read().notes ?? []].slice(0, KEPT_NOTES) });
26
+ },
27
+ });
@@ -0,0 +1,27 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { createTestContext } from "@ragents/server/testing";
4
+ import program from "../src/server.ts";
5
+
6
+ const input = (content: string) => ({ id: "input-1", content, artifactIds: [], sourceEventIds: [], subscriptionId: null, event: null });
7
+
8
+ test("keeps notes newest first and at most fifty", async () => {
9
+ const context = createTestContext<{ notes?: string[] }>({ state: { notes: Array.from({ length: 50 }, (_, index) => `old ${index}`) } });
10
+ await program.onInput!(input(" new note "), context);
11
+ const notes = context.state.read().notes!;
12
+ assert.equal(notes.length, 50);
13
+ assert.equal(notes[0], "new note");
14
+ assert.equal(notes.at(-1), "old 48");
15
+ });
16
+
17
+ test("an empty note is refused and changes nothing", async () => {
18
+ const context = createTestContext<{ notes?: string[] }>({ state: { notes: ["kept"] } });
19
+ await assert.rejects(async () => program.onInput!(input(" "), context), /needs text/);
20
+ assert.deepEqual(context.state.read(), { notes: ["kept"] });
21
+ });
22
+
23
+ test("clear empties the notebook and names how many notes it removed", async () => {
24
+ const context = createTestContext<{ notes?: string[] }>({ state: { notes: ["one", "two"] } });
25
+ assert.deepEqual(await program.functions.clear({}, context), { cleared: 2 });
26
+ assert.deepEqual(context.state.read(), { notes: [] });
27
+ });
@@ -20,8 +20,8 @@
20
20
  ]
21
21
  }
22
22
  },
23
- "revision": "809c8770905fa2a4d557425abf27aee27a863aec8a80655b96e40bd82307f493",
24
- "sourceRevision": "abe068f9695702223dd49b2169ecca54e5a82fd4b37d02346d0c9df3582cff87",
23
+ "revision": "2c684e9daab9b2ffe4c002c03d4fa8549b2d4dd0b20513fb5eec0e4f10a396ee",
24
+ "sourceRevision": "0f2f0bb43908bed73e743ed21d07d35abed4bcc84563c893c5c32117ad559ade",
25
25
  "server": "server/index.js",
26
26
  "web": {
27
27
  "entry": "web/index.js",
@@ -34,6 +34,7 @@
34
34
  "uses": [],
35
35
  "assets": [
36
36
  "skills",
37
- "run-scripts"
37
+ "run-scripts",
38
+ "actors"
38
39
  ]
39
40
  }
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: Add a quick note
3
+ description: "A prepared one-step script shows a shared actor package: it adds a note to the notebook it shares with the roster check, in a new or a running run."
4
+ order: 180
5
+ coordinator: false
6
+ embeddable: true
7
+ shared-programs: notebook
8
+ tags: Run scripts, Concept demo, TypeScript actors
9
+ ---
10
+
11
+ The start value `{ "text": "..." }` is the note; without one, the script notes when it was
12
+ started. The script makes the shared notebook active with `actor_program_ensure`, sends it the
13
+ note, places the notebook's view with `canvas_layout_place`, and ends the start with
14
+ `context.finish`. Whether the roster check or this script comes first, the run has one notebook.
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "quick-note",
3
+ "private": true,
4
+ "type": "module",
5
+ "ragents": {
6
+ "title": "Quick note",
7
+ "backend": "src/server.ts"
8
+ }
9
+ }
@@ -0,0 +1,29 @@
1
+ import { defineActor } from "@ragents/server";
2
+ import { Type } from "typebox";
3
+
4
+ const contract = {
5
+ state: Type.Object({}, { additionalProperties: false }),
6
+ functions: {},
7
+ input: { capabilities: ["actor_program_ensure", "actor_input", "canvas_layout_place"] },
8
+ } as const;
9
+
10
+ const noteOf = (input: unknown, now: string): string => {
11
+ if (input === null) return `Started at ${now}.`;
12
+ const text = typeof input === "object" && input !== null && "text" in input ? (input as { text: unknown }).text : undefined;
13
+ if (typeof text !== "string" || !text.trim()) throw new Error('The start value is { "text": "..." } with the note, or none.');
14
+ return text.trim();
15
+ };
16
+
17
+ export default defineActor(contract, {
18
+ functions: {},
19
+ onInput: () => {
20
+ throw new Error("The quick note answers only starts; start it again with the note as its start value.");
21
+ },
22
+ onStart: async (start, context) => {
23
+ const note = noteOf(start.input, context.std.now());
24
+ const notebook = await context.functions.actor_program_ensure({ name: "notebook" });
25
+ await context.functions.actor_input({ actor: `@${notebook.handle}`, content: note });
26
+ await context.functions.canvas_layout_place({ entity: "app:notebook/main" });
27
+ context.finish({ note, notebook: notebook.status }, { summary: `Noted: ${note}` });
28
+ },
29
+ });
@@ -0,0 +1,43 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { createTestContext } from "@ragents/server/testing";
4
+ import program from "../src/server.ts";
5
+
6
+ const start = (input: unknown) => ({ input, options: {}, embedded: true, startedBy: "owner-id", count: 1 });
7
+
8
+ const note = (status: "active" | "installed" = "installed") => {
9
+ const calls: { name: string; input: unknown }[] = [];
10
+ const record = <T>(name: string, answer: T) => (input: unknown): T => { calls.push({ name, input }); return answer; };
11
+ const context = createTestContext<Record<string, never>>({ state: {}, functions: {
12
+ actor_program_ensure: record("actor_program_ensure", { actorId: "id-notebook", handle: "notebook", status }),
13
+ actor_input: record("actor_input", []),
14
+ canvas_layout_place: record("canvas_layout_place", { placed: status === "installed" }),
15
+ } });
16
+ return { calls, context };
17
+ };
18
+
19
+ test("sends the note to the shared notebook and reports it", async () => {
20
+ const { calls, context } = note();
21
+ await program.onStart!(start({ text: " Ask about the budget " }), context);
22
+ assert.deepEqual(calls.map((call) => [call.name, call.input]), [
23
+ ["actor_program_ensure", { name: "notebook" }],
24
+ ["actor_input", { actor: "@notebook", content: "Ask about the budget" }],
25
+ ["canvas_layout_place", { entity: "app:notebook/main" }],
26
+ ]);
27
+ assert.deepEqual(context.finished, [{ result: { note: "Ask about the budget", notebook: "installed" }, summary: "Noted: Ask about the budget" }]);
28
+ });
29
+
30
+ test("without a start value it notes when it started; an invalid value changes nothing", async () => {
31
+ const { calls, context } = note("active");
32
+ await program.onStart!(start(null), context);
33
+ assert.match(String((calls[1]!.input as { content: string }).content), /^Started at /);
34
+ const invalid = note();
35
+ await assert.rejects(async () => program.onStart!(start({ text: "" }), invalid.context), /start value/);
36
+ assert.deepEqual(invalid.calls, []);
37
+ assert.deepEqual(invalid.context.finished, []);
38
+ });
39
+
40
+ test("an ordinary message is refused", async () => {
41
+ const { context } = note();
42
+ await assert.rejects(async () => program.onInput!({ id: "input-1", content: "hello", artifactIds: [], sourceEventIds: [], subscriptionId: null, event: null }, context), /answers only starts/);
43
+ });
@@ -0,0 +1,19 @@
1
+ ---
2
+ title: Take stock of the run
3
+ description: "A prepared check shows a run script that also joins a running run. It lists the other participants, notes them in the shared notebook, and reports them back as its result."
4
+ order: 170
5
+ coordinator: false
6
+ embeddable: true
7
+ shared-programs: notebook
8
+ tags: Run scripts, Concept demo, TypeScript actors
9
+ ---
10
+
11
+ The TypeScript program reads the participants with `actor_list` and ends each start with
12
+ `context.finish`. The owner reads the summary in the chat; a coordinator that starts it through
13
+ `run_script_start` receives summary and list as a message. Started inside a running run through the
14
+ run menu, `ragents script`, or the coordinator, it changes neither the primary actor nor the tiles,
15
+ and a repeated start reuses the same actor. Started as a new run, it is the run's only participant.
16
+
17
+ It shares the notebook with the quick note script: `shared-programs: notebook` copies the plugin's
18
+ shared package into the run, `actor_program_ensure` makes it active once, and
19
+ `canvas_layout_place` puts its view next to what is arranged.
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "run-roster",
3
+ "private": true,
4
+ "type": "module",
5
+ "ragents": {
6
+ "title": "Run roster",
7
+ "backend": "src/server.ts"
8
+ }
9
+ }
@@ -0,0 +1,26 @@
1
+ import { defineActor } from "@ragents/server";
2
+ import { Type } from "typebox";
3
+
4
+ const contract = {
5
+ state: Type.Object({ reports: Type.Optional(Type.Number()) }, { additionalProperties: false }),
6
+ functions: {},
7
+ input: { capabilities: ["actor_list", "actor_program_ensure", "actor_input", "canvas_layout_place"] },
8
+ } as const;
9
+
10
+ export default defineActor(contract, {
11
+ functions: {},
12
+ onInput: () => {
13
+ throw new Error("The roster answers only starts; start it again from the run menu or with run_script_start.");
14
+ },
15
+ onStart: async (_start, context) => {
16
+ const actors = await context.functions.actor_list({});
17
+ const others = actors.filter((actor) => actor.kind !== "human" && actor.handle !== context.actor.handle);
18
+ const handles = others.map((actor) => `@${actor.handle}`);
19
+ const summary = handles.length === 0 ? "No other participants yet." : `${handles.length} participant${handles.length === 1 ? "" : "s"}: ${handles.join(", ")}.`;
20
+ const notebook = await context.functions.actor_program_ensure({ name: "notebook" });
21
+ await context.functions.actor_input({ actor: `@${notebook.handle}`, content: `Roster: ${summary}` });
22
+ await context.functions.canvas_layout_place({ entity: "app:notebook/main" });
23
+ context.state.replace({ reports: (context.state.read().reports ?? 0) + 1 });
24
+ context.finish({ actors: others.map(({ handle, kind, lifecycle }) => ({ handle, kind, lifecycle })) }, { summary });
25
+ },
26
+ });
@@ -0,0 +1,47 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { createTestContext } from "@ragents/server/testing";
4
+ import program from "../src/server.ts";
5
+
6
+ const start = { input: null, options: {}, embedded: true, startedBy: "owner-id", count: 1 };
7
+ const actor = (handle: string, kind: "human" | "agent" | "script", lifecycle = "idle") =>
8
+ ({ id: `id-${handle}`, handle, displayName: handle, kind, lifecycle, createdBy: null, description: null, toolCount: null });
9
+
10
+ const roster = (actors: ReturnType<typeof actor>[], state: { reports?: number } = {}) => {
11
+ const calls: { name: string; input: unknown }[] = [];
12
+ const record = <T>(name: string, answer: T) => (input: unknown): T => { calls.push({ name, input }); return answer; };
13
+ const context = createTestContext<{ reports?: number }>({ state, functions: {
14
+ actor_list: record("actor_list", actors),
15
+ actor_program_ensure: record("actor_program_ensure", { actorId: "id-notebook", handle: "notebook", status: "active" as const }),
16
+ actor_input: record("actor_input", []),
17
+ canvas_layout_place: record("canvas_layout_place", { placed: true }),
18
+ } });
19
+ return { calls, context };
20
+ };
21
+
22
+ test("reports the other participants as result and summary and notes them in the shared notebook", async () => {
23
+ const { calls, context } = roster([actor("owner", "human"), actor("coordinator", "agent", "running"), actor("helper", "agent"), actor("test", "script")]);
24
+ await program.onStart!(start, context);
25
+ assert.deepEqual(context.finished, [{
26
+ result: { actors: [{ handle: "coordinator", kind: "agent", lifecycle: "running" }, { handle: "helper", kind: "agent", lifecycle: "idle" }] },
27
+ summary: "2 participants: @coordinator, @helper.",
28
+ }]);
29
+ assert.deepEqual(calls.slice(1).map((call) => [call.name, call.input]), [
30
+ ["actor_program_ensure", { name: "notebook" }],
31
+ ["actor_input", { actor: "@notebook", content: "Roster: 2 participants: @coordinator, @helper." }],
32
+ ["canvas_layout_place", { entity: "app:notebook/main" }],
33
+ ]);
34
+ assert.deepEqual(context.state.read(), { reports: 1 });
35
+ });
36
+
37
+ test("a run without other participants still gets a result, and every start counts", async () => {
38
+ const { context } = roster([actor("owner", "human"), actor("test", "script")], { reports: 2 });
39
+ await program.onStart!({ ...start, embedded: false, count: 3 }, context);
40
+ assert.deepEqual(context.finished, [{ result: { actors: [] }, summary: "No other participants yet." }]);
41
+ assert.deepEqual(context.state.read(), { reports: 3 });
42
+ });
43
+
44
+ test("an ordinary message is refused", async () => {
45
+ const { context } = roster([]);
46
+ await assert.rejects(async () => program.onInput!({ id: "input-1", content: "hello", artifactIds: [], sourceEventIds: [], subscriptionId: null, event: null }, context), /answers only starts/);
47
+ });
@@ -33,7 +33,7 @@
33
33
  }
34
34
  },
35
35
  "revision": "5e18b249f3c8b53b61820ef05da59823d58163c6962e6d836dcb37c05034aad0",
36
- "sourceRevision": "cdb1c230450ed69e96cebcee9da392c02edb499417fc7e2de657b2f89c36c379",
36
+ "sourceRevision": "e69f899d1733ba54341bfc2fd8c6adbf6025126a4b21a74bdd8206378e86b87e",
37
37
  "server": "server/index.js",
38
38
  "web": {
39
39
  "entry": "web/index.js",
@@ -23,7 +23,7 @@
23
23
  "web": {}
24
24
  },
25
25
  "revision": "e3bb513053f6385f9d78d314d28302324095a5163c4e1563df6fc8b3251305f7",
26
- "sourceRevision": "ba610549f1f1b3e87940617518d45b4bc918362fb9c20283b2a5061877bed103",
26
+ "sourceRevision": "7df3be99d8024c7878a0afe2bcd698909b6389f4484d98f84a0e3bdead954ab4",
27
27
  "server": "server/index.js",
28
28
  "exports": {
29
29
  "server": {},
@@ -25,7 +25,7 @@
25
25
  "web": {}
26
26
  },
27
27
  "revision": "007ee50ab186e3070930f23e9795210fa36c723365657325d5440cc2f0b81d60",
28
- "sourceRevision": "ebb0ba3e7ca11870abab5787c259c3d2ad3b36247caeb4b4efd9bcceebbb7047",
28
+ "sourceRevision": "1ce434ee7a1752f72e3d7160d895130948b8bcd5bba466f5555fff6ff278cd19",
29
29
  "server": "server/index.js",
30
30
  "exports": {
31
31
  "server": {
@@ -136,8 +136,8 @@
136
136
  ]
137
137
  }
138
138
  },
139
- "revision": "53498a6dbf25ada77b6dcdf7bb1d188c16229a85c7ddeeafa10e6335a8230954",
140
- "sourceRevision": "f937fbba39f6d0ab90e55e494976d0d650054b722212d7e25cf8ddb835f91492",
139
+ "revision": "db9370b7b3449c44be49986b074806351b857c430963aa878e209d2d5c9ba4f8",
140
+ "sourceRevision": "f91d81de973c9c7b46f1882a8cb4f067fbdf72c2e7617f24f8865f92d9ed05bc",
141
141
  "server": "server/index.js",
142
142
  "web": {
143
143
  "entry": "web/index.js",