@elizaos/plugin-task-coordinator 2.0.3-beta.2 → 2.0.3-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/hero.png +0 -0
- package/dist/AgentTabsSection.d.ts +16 -0
- package/dist/AgentTabsSection.d.ts.map +1 -0
- package/dist/AgentTabsSection.js +169 -0
- package/dist/AgentTabsSection.js.map +1 -0
- package/dist/CodingAgentControlChip.d.ts +2 -0
- package/dist/CodingAgentControlChip.d.ts.map +1 -0
- package/dist/CodingAgentControlChip.js +73 -0
- package/dist/CodingAgentControlChip.js.map +1 -0
- package/dist/CodingAgentSettingsSection.d.ts +2 -0
- package/dist/CodingAgentSettingsSection.d.ts.map +1 -0
- package/dist/CodingAgentSettingsSection.js +379 -0
- package/dist/CodingAgentSettingsSection.js.map +1 -0
- package/dist/CodingAgentTasksPanel.d.ts +4 -0
- package/dist/CodingAgentTasksPanel.d.ts.map +1 -0
- package/dist/CodingAgentTasksPanel.interact.d.ts +2 -0
- package/dist/CodingAgentTasksPanel.interact.d.ts.map +1 -0
- package/dist/CodingAgentTasksPanel.interact.js +46 -0
- package/dist/CodingAgentTasksPanel.interact.js.map +1 -0
- package/dist/CodingAgentTasksPanel.js +740 -0
- package/dist/CodingAgentTasksPanel.js.map +1 -0
- package/dist/GitHubConnectionCard.d.ts +2 -0
- package/dist/GitHubConnectionCard.d.ts.map +1 -0
- package/dist/GitHubConnectionCard.js +172 -0
- package/dist/GitHubConnectionCard.js.map +1 -0
- package/dist/GlobalPrefsSection.d.ts +10 -0
- package/dist/GlobalPrefsSection.d.ts.map +1 -0
- package/dist/GlobalPrefsSection.js +166 -0
- package/dist/GlobalPrefsSection.js.map +1 -0
- package/dist/LlmProviderSection.d.ts +10 -0
- package/dist/LlmProviderSection.d.ts.map +1 -0
- package/dist/LlmProviderSection.js +161 -0
- package/dist/LlmProviderSection.js.map +1 -0
- package/dist/ModelConfigSection.d.ts +15 -0
- package/dist/ModelConfigSection.d.ts.map +1 -0
- package/dist/ModelConfigSection.js +86 -0
- package/dist/ModelConfigSection.js.map +1 -0
- package/dist/OrchestratorView.d.ts +20 -0
- package/dist/OrchestratorView.d.ts.map +1 -0
- package/dist/OrchestratorView.js +231 -0
- package/dist/OrchestratorView.js.map +1 -0
- package/dist/OrchestratorWorkbench.d.ts +32 -0
- package/dist/OrchestratorWorkbench.d.ts.map +1 -0
- package/dist/OrchestratorWorkbench.js +3200 -0
- package/dist/OrchestratorWorkbench.js.map +1 -0
- package/dist/PtyConsoleBase.d.ts +9 -0
- package/dist/PtyConsoleBase.d.ts.map +1 -0
- package/dist/PtyConsoleBase.js +174 -0
- package/dist/PtyConsoleBase.js.map +1 -0
- package/dist/PtyConsoleDrawer.d.ts +10 -0
- package/dist/PtyConsoleDrawer.d.ts.map +1 -0
- package/dist/PtyConsoleDrawer.js +77 -0
- package/dist/PtyConsoleDrawer.js.map +1 -0
- package/dist/PtyConsoleSidePanel.d.ts +8 -0
- package/dist/PtyConsoleSidePanel.d.ts.map +1 -0
- package/dist/PtyConsoleSidePanel.js +9 -0
- package/dist/PtyConsoleSidePanel.js.map +1 -0
- package/dist/PtyTerminalPane.d.ts +10 -0
- package/dist/PtyTerminalPane.d.ts.map +1 -0
- package/dist/PtyTerminalPane.js +147 -0
- package/dist/PtyTerminalPane.js.map +1 -0
- package/dist/TaskCardList.d.ts +76 -0
- package/dist/TaskCardList.d.ts.map +1 -0
- package/dist/TaskCardList.js +327 -0
- package/dist/TaskCardList.js.map +1 -0
- package/dist/TaskCoordinatorView.d.ts +20 -0
- package/dist/TaskCoordinatorView.d.ts.map +1 -0
- package/dist/TaskCoordinatorView.js +146 -0
- package/dist/TaskCoordinatorView.js.map +1 -0
- package/dist/__e2e__/dashboard-fixture.d.ts +9 -0
- package/dist/__e2e__/dashboard-fixture.d.ts.map +1 -0
- package/dist/__e2e__/dashboard-fixture.js +123 -0
- package/dist/__e2e__/dashboard-fixture.js.map +1 -0
- package/dist/api/coding-agents-auth-sanitize.d.ts +23 -0
- package/dist/api/coding-agents-auth-sanitize.d.ts.map +1 -0
- package/dist/api/coding-agents-auth-sanitize.js +22 -0
- package/dist/api/coding-agents-auth-sanitize.js.map +1 -0
- package/dist/api/coding-agents-preflight-normalize.d.ts +29 -0
- package/dist/api/coding-agents-preflight-normalize.d.ts.map +1 -0
- package/dist/api/coding-agents-preflight-normalize.js +20 -0
- package/dist/api/coding-agents-preflight-normalize.js.map +1 -0
- package/dist/coding-agent-settings-shared.d.ts +42 -0
- package/dist/coding-agent-settings-shared.d.ts.map +1 -0
- package/dist/coding-agent-settings-shared.js +121 -0
- package/dist/coding-agent-settings-shared.js.map +1 -0
- package/dist/components/OrchestratorSpatialView.d.ts +56 -0
- package/dist/components/OrchestratorSpatialView.d.ts.map +1 -0
- package/dist/components/OrchestratorSpatialView.js +501 -0
- package/dist/components/OrchestratorSpatialView.js.map +1 -0
- package/dist/components/TaskCoordinatorSpatialView.d.ts +59 -0
- package/dist/components/TaskCoordinatorSpatialView.d.ts.map +1 -0
- package/dist/components/TaskCoordinatorSpatialView.js +294 -0
- package/dist/components/TaskCoordinatorSpatialView.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +286 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator-capabilities.d.ts +3 -0
- package/dist/orchestrator-capabilities.d.ts.map +1 -0
- package/dist/orchestrator-capabilities.js +136 -0
- package/dist/orchestrator-capabilities.js.map +1 -0
- package/dist/orchestrator-command.d.ts +39 -0
- package/dist/orchestrator-command.d.ts.map +1 -0
- package/dist/orchestrator-command.js +52 -0
- package/dist/orchestrator-command.js.map +1 -0
- package/dist/orchestrator-diff.d.ts +19 -0
- package/dist/orchestrator-diff.d.ts.map +1 -0
- package/dist/orchestrator-diff.helpers.d.ts +18 -0
- package/dist/orchestrator-diff.helpers.d.ts.map +1 -0
- package/dist/orchestrator-diff.helpers.js +76 -0
- package/dist/orchestrator-diff.helpers.js.map +1 -0
- package/dist/orchestrator-diff.js +119 -0
- package/dist/orchestrator-diff.js.map +1 -0
- package/dist/orchestrator-markdown.d.ts +5 -0
- package/dist/orchestrator-markdown.d.ts.map +1 -0
- package/dist/orchestrator-markdown.helpers.d.ts +2 -0
- package/dist/orchestrator-markdown.helpers.d.ts.map +1 -0
- package/dist/orchestrator-markdown.helpers.js +21 -0
- package/dist/orchestrator-markdown.helpers.js.map +1 -0
- package/dist/orchestrator-markdown.js +199 -0
- package/dist/orchestrator-markdown.js.map +1 -0
- package/dist/orchestrator-params.d.ts +8 -0
- package/dist/orchestrator-params.d.ts.map +1 -0
- package/dist/orchestrator-params.js +27 -0
- package/dist/orchestrator-params.js.map +1 -0
- package/dist/orchestrator-plan.d.ts +5 -0
- package/dist/orchestrator-plan.d.ts.map +1 -0
- package/dist/orchestrator-plan.js +95 -0
- package/dist/orchestrator-plan.js.map +1 -0
- package/dist/orchestrator-reasoning.d.ts +21 -0
- package/dist/orchestrator-reasoning.d.ts.map +1 -0
- package/dist/orchestrator-reasoning.js +105 -0
- package/dist/orchestrator-reasoning.js.map +1 -0
- package/dist/orchestrator-stream.d.ts +15 -0
- package/dist/orchestrator-stream.d.ts.map +1 -0
- package/dist/orchestrator-stream.helpers.d.ts +89 -0
- package/dist/orchestrator-stream.helpers.d.ts.map +1 -0
- package/dist/orchestrator-stream.helpers.js +361 -0
- package/dist/orchestrator-stream.helpers.js.map +1 -0
- package/dist/orchestrator-stream.js +307 -0
- package/dist/orchestrator-stream.js.map +1 -0
- package/dist/pty-status-dots.d.ts +2 -0
- package/dist/pty-status-dots.d.ts.map +1 -0
- package/dist/pty-status-dots.js +6 -0
- package/dist/pty-status-dots.js.map +1 -0
- package/dist/register-slots.d.ts +20 -0
- package/dist/register-slots.d.ts.map +1 -0
- package/dist/register-slots.js +50 -0
- package/dist/register-slots.js.map +1 -0
- package/dist/register-terminal-view.d.ts +21 -0
- package/dist/register-terminal-view.d.ts.map +1 -0
- package/dist/register-terminal-view.js +46 -0
- package/dist/register-terminal-view.js.map +1 -0
- package/dist/register.d.ts +2 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +23 -0
- package/dist/register.js.map +1 -0
- package/dist/session-hydration.d.ts +2 -0
- package/dist/session-hydration.d.ts.map +1 -0
- package/dist/session-hydration.js +9 -0
- package/dist/session-hydration.js.map +1 -0
- package/dist/task-coordinator-view-bundle.d.ts +4 -0
- package/dist/task-coordinator-view-bundle.d.ts.map +1 -0
- package/dist/task-coordinator-view-bundle.js +9 -0
- package/dist/task-coordinator-view-bundle.js.map +1 -0
- package/dist/ui.d.ts +2 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +13 -0
- package/dist/ui.js.map +1 -0
- package/dist/view-format.d.ts +25 -0
- package/dist/view-format.d.ts.map +1 -0
- package/dist/view-format.js +64 -0
- package/dist/view-format.js.map +1 -0
- package/dist/views/bundle.js +1383 -0
- package/dist/views/bundle.js.map +1 -0
- package/package.json +7 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Plugin, ViewCapability } from \"@elizaos/core\";\nimport {\n orchestratorStatusCommandAction,\n registerOrchestratorCommands,\n} from \"./orchestrator-command.js\";\n\nconst ORCHESTRATOR_CAPABILITIES: ViewCapability[] = [\n { id: \"orchestrator-status\", description: \"Get orchestrator status\" },\n {\n id: \"orchestrator-list-tasks\",\n description: \"List orchestrator task threads\",\n params: {\n status: {\n type: \"string\",\n description: \"Filter by task status (e.g. active, paused, done)\",\n },\n search: { type: \"string\", description: \"Optional search query\" },\n includeArchived: {\n type: \"boolean\",\n description: \"Include archived task threads\",\n },\n limit: { type: \"number\", description: \"Maximum threads to return\" },\n },\n },\n {\n id: \"orchestrator-open-task\",\n description: \"Open an orchestrator task thread\",\n params: {\n taskId: {\n type: \"string\",\n description:\n \"Task thread id to open; opens the most recent task when omitted\",\n },\n },\n },\n {\n id: \"orchestrator-create-task\",\n description: \"Create an orchestrator task\",\n params: {\n title: { type: \"string\", description: \"Short task title\" },\n goal: {\n type: \"string\",\n description: \"Durable goal the sub-agent works until complete\",\n },\n originalRequest: {\n type: \"string\",\n description: \"The user's original request text, if any\",\n },\n kind: { type: \"string\", description: \"Optional task kind/category\" },\n priority: {\n type: \"string\",\n description: \"Priority: low, normal, high, or urgent\",\n },\n acceptanceCriteria: {\n type: \"array\",\n description: \"List of acceptance-criteria strings\",\n },\n },\n },\n {\n id: \"orchestrator-pause-task\",\n description: \"Pause an orchestrator task\",\n params: {\n taskId: { type: \"string\", description: \"Task thread id to pause\" },\n },\n },\n {\n id: \"orchestrator-resume-task\",\n description: \"Resume an orchestrator task\",\n params: {\n taskId: { type: \"string\", description: \"Task thread id to resume\" },\n },\n },\n {\n id: \"orchestrator-pause-all\",\n description: \"Pause all active orchestrator tasks\",\n },\n {\n id: \"orchestrator-resume-all\",\n description: \"Resume all paused orchestrator tasks\",\n },\n {\n id: \"orchestrator-delete-task\",\n description: \"Delete an orchestrator task\",\n params: {\n taskId: { type: \"string\", description: \"Task thread id to delete\" },\n },\n },\n {\n id: \"orchestrator-fork-task\",\n description: \"Fork an orchestrator task\",\n params: {\n taskId: { type: \"string\", description: \"Source task thread id\" },\n title: { type: \"string\", description: \"Title for the fork\" },\n goal: { type: \"string\", description: \"Goal override for the fork\" },\n priority: {\n type: \"string\",\n description: \"Priority: low, normal, high, or urgent\",\n },\n acceptanceCriteria: {\n type: \"array\",\n description: \"List of acceptance-criteria strings\",\n },\n },\n },\n {\n id: \"orchestrator-update-task\",\n description:\n \"Update an orchestrator task's title, goal, summary, priority, or acceptance criteria\",\n params: {\n taskId: { type: \"string\", description: \"Task thread id to update\" },\n title: { type: \"string\", description: \"New task title\" },\n goal: { type: \"string\", description: \"New durable goal\" },\n summary: { type: \"string\", description: \"New task summary\" },\n priority: {\n type: \"string\",\n description: \"Priority: low, normal, high, or urgent\",\n },\n acceptanceCriteria: {\n type: \"array\",\n description: \"List of acceptance-criteria strings\",\n },\n },\n },\n {\n id: \"orchestrator-validate-task\",\n description: \"Record a validation result for an orchestrator task\",\n params: {\n taskId: { type: \"string\", description: \"Task thread id to validate\" },\n passed: { type: \"boolean\", description: \"Whether validation passed\" },\n summary: { type: \"string\", description: \"Validation summary\" },\n evidence: {\n type: \"string\",\n description: \"Evidence supporting the result\",\n },\n verifier: {\n type: \"string\",\n description: \"Who or what performed validation\",\n },\n humanOverride: {\n type: \"boolean\",\n description: \"Whether a human explicitly overrode the result\",\n },\n },\n },\n {\n id: \"orchestrator-add-agent\",\n description: \"Add a sub-agent to an orchestrator task\",\n params: {\n taskId: { type: \"string\", description: \"Target task thread id\" },\n framework: {\n type: \"string\",\n description: \"Coding agent framework (claude, codex, opencode...)\",\n },\n providerSource: {\n type: \"string\",\n description: \"Provider/subscription source for the sub-agent\",\n },\n model: { type: \"string\", description: \"Model id to use\" },\n workdir: { type: \"string\", description: \"Working directory\" },\n repo: { type: \"string\", description: \"Repository to work in\" },\n label: { type: \"string\", description: \"Display label for the agent\" },\n task: { type: \"string\", description: \"Initial task text\" },\n },\n },\n {\n id: \"orchestrator-stop-agent\",\n description: \"Stop a sub-agent on an orchestrator task\",\n params: {\n taskId: { type: \"string\", description: \"Task thread id\" },\n sessionId: {\n type: \"string\",\n description: \"Sub-agent session id to stop\",\n },\n },\n },\n {\n id: \"orchestrator-send-message\",\n description: \"Send a message to an orchestrator task\",\n params: {\n taskId: { type: \"string\", description: \"Target task thread id\" },\n content: { type: \"string\", description: \"Message content to send\" },\n },\n },\n];\n\nconst taskCoordinatorPlugin: Plugin = {\n name: \"@elizaos/plugin-task-coordinator\",\n description: \"Coding agent task coordinator and session control surface.\",\n // Contribute the orchestrator view's slash command into the universal command\n // registry once the runtime is up. `@elizaos/plugin-commands` boots before app\n // plugins, so its per-runtime store already exists here (#8790).\n init: async (_config, runtime) => {\n registerOrchestratorCommands(runtime.agentId);\n },\n // Deterministic handler for the registered slash command.\n actions: [orchestratorStatusCommandAction],\n views: [\n // ONE declaration → GUI + XR + TUI, all drawn from the single\n // TaskCoordinatorView spatial source. `modalities` is a plain literal here\n // (index.ts is not in the view bundle), so no brand-new `@elizaos/core`\n // runtime export reaches the bundle build.\n {\n id: \"task-coordinator\",\n label: \"Task Coordinator\",\n description: \"Coding agent task threads, sessions, and controls\",\n icon: \"SquareTerminal\",\n path: \"/task-coordinator\",\n modalities: [\"gui\", \"xr\", \"tui\"],\n bundlePath: \"dist/views/bundle.js\",\n componentExport: \"TaskCoordinatorView\",\n capabilities: [\n {\n id: \"list-sessions\",\n description: \"List active coding-agent sessions\",\n },\n {\n id: \"list-task-threads\",\n description: \"List coding-agent task threads\",\n params: {\n search: { type: \"string\", description: \"Optional search query\" },\n includeArchived: {\n type: \"boolean\",\n description: \"Include archived task threads\",\n },\n limit: { type: \"number\", description: \"Maximum threads to return\" },\n },\n },\n {\n id: \"open-thread\",\n description: \"Open a coding-agent task thread\",\n params: {\n threadId: { type: \"string\", description: \"Task thread id\" },\n },\n },\n {\n id: \"stop-session\",\n description: \"Stop a running coding-agent session\",\n params: {\n sessionId: { type: \"string\", description: \"Session id to stop\" },\n },\n },\n { id: \"refresh\", description: \"Refresh task coordinator state\" },\n ],\n tags: [\n \"developer\",\n \"coding-agent\",\n \"coding\",\n \"build\",\n \"feature\",\n \"app builder\",\n \"tasks\",\n ],\n visibleInManager: true,\n desktopTabEnabled: true,\n },\n // ONE declaration → GUI + XR + TUI, all drawn from the single\n // OrchestratorView spatial source.\n {\n id: \"orchestrator\",\n label: \"Orchestrator\",\n description: \"Multi-agent task orchestration workbench\",\n icon: \"Layers\",\n path: \"/orchestrator\",\n modalities: [\"gui\", \"xr\", \"tui\"],\n bundlePath: \"dist/views/bundle.js\",\n componentExport: \"OrchestratorView\",\n capabilities: ORCHESTRATOR_CAPABILITIES,\n tags: [\"developer\", \"coding-agent\", \"orchestrator\"],\n visibleInManager: true,\n desktopTabEnabled: true,\n },\n ],\n};\n\nexport default taskCoordinatorPlugin;\nexport {\n ORCHESTRATOR_STATUS_COMMAND_ACTION,\n ORCHESTRATOR_STATUS_COMMAND_KEY,\n ORCHESTRATOR_VIEW_ID,\n orchestratorStatusCommandAction,\n registerOrchestratorCommands,\n} from \"./orchestrator-command.js\";\n"],"mappings":"AACA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,MAAM,4BAA8C;AAAA,EAClD,EAAE,IAAI,uBAAuB,aAAa,0BAA0B;AAAA,EACpE;AAAA,IACE,IAAI;AAAA,IACJ,aAAa;AAAA,IACb,QAAQ;AAAA,MACN,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,QAAQ,EAAE,MAAM,UAAU,aAAa,wBAAwB;AAAA,MAC/D,iBAAiB;AAAA,QACf,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,OAAO,EAAE,MAAM,UAAU,aAAa,4BAA4B;AAAA,IACpE;AAAA,EACF;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,aAAa;AAAA,IACb,QAAQ;AAAA,MACN,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,aACE;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,aAAa;AAAA,IACb,QAAQ;AAAA,MACN,OAAO,EAAE,MAAM,UAAU,aAAa,mBAAmB;AAAA,MACzD,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,iBAAiB;AAAA,QACf,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,MAAM,EAAE,MAAM,UAAU,aAAa,8BAA8B;AAAA,MACnE,UAAU;AAAA,QACR,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,oBAAoB;AAAA,QAClB,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,aAAa;AAAA,IACb,QAAQ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A;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,IACrB;AAAA;AAAA;AAAA,IAGA;AAAA,MACE,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,YAAY,CAAC,OAAO,MAAM,KAAK;AAAA,MAC/B,YAAY;AAAA,MACZ,iBAAiB;AAAA,MACjB,cAAc;AAAA,MACd,MAAM,CAAC,aAAa,gBAAgB,cAAc;AAAA,MAClD,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,IACrB;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;AACf;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,mCAAAA;AAAA,EACA,gCAAAC;AAAA,OACK;","names":["orchestratorStatusCommandAction","registerOrchestratorCommands"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-capabilities.d.ts","sourceRoot":"","sources":["../src/orchestrator-capabilities.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAgB1D,CAAC;AAEH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC,CA0GlB"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { client } from "@elizaos/ui";
|
|
2
|
+
import {
|
|
3
|
+
paramPriority,
|
|
4
|
+
paramString,
|
|
5
|
+
paramStringArray,
|
|
6
|
+
requireTaskId,
|
|
7
|
+
TASK_LIST_LIMIT
|
|
8
|
+
} from "./orchestrator-params.js";
|
|
9
|
+
const ORCHESTRATOR_CAPABILITY_IDS = /* @__PURE__ */ new Set([
|
|
10
|
+
"orchestrator-status",
|
|
11
|
+
"orchestrator-list-tasks",
|
|
12
|
+
"orchestrator-open-task",
|
|
13
|
+
"orchestrator-create-task",
|
|
14
|
+
"orchestrator-pause-task",
|
|
15
|
+
"orchestrator-resume-task",
|
|
16
|
+
"orchestrator-pause-all",
|
|
17
|
+
"orchestrator-resume-all",
|
|
18
|
+
"orchestrator-delete-task",
|
|
19
|
+
"orchestrator-fork-task",
|
|
20
|
+
"orchestrator-update-task",
|
|
21
|
+
"orchestrator-validate-task",
|
|
22
|
+
"orchestrator-add-agent",
|
|
23
|
+
"orchestrator-stop-agent",
|
|
24
|
+
"orchestrator-send-message"
|
|
25
|
+
]);
|
|
26
|
+
async function runOrchestratorCapability(capability, params) {
|
|
27
|
+
switch (capability) {
|
|
28
|
+
case "orchestrator-status":
|
|
29
|
+
return client.getOrchestratorStatus();
|
|
30
|
+
case "orchestrator-list-tasks":
|
|
31
|
+
return client.listCodingAgentTaskThreads({
|
|
32
|
+
includeArchived: params?.includeArchived === true,
|
|
33
|
+
status: paramString(params?.status),
|
|
34
|
+
search: paramString(params?.search),
|
|
35
|
+
limit: typeof params?.limit === "number" ? params.limit : TASK_LIST_LIMIT
|
|
36
|
+
});
|
|
37
|
+
case "orchestrator-open-task": {
|
|
38
|
+
const taskId = paramString(params?.taskId);
|
|
39
|
+
if (taskId) return client.getCodingAgentTaskThread(taskId);
|
|
40
|
+
const [first] = await client.listCodingAgentTaskThreads({ limit: 1 });
|
|
41
|
+
return first ? client.getCodingAgentTaskThread(first.id) : null;
|
|
42
|
+
}
|
|
43
|
+
case "orchestrator-create-task": {
|
|
44
|
+
const title = paramString(params?.title);
|
|
45
|
+
const goal = paramString(params?.goal);
|
|
46
|
+
if (!title || !goal) {
|
|
47
|
+
throw new Error("title and goal are required to create a task.");
|
|
48
|
+
}
|
|
49
|
+
return client.createOrchestratorTask({
|
|
50
|
+
title,
|
|
51
|
+
goal,
|
|
52
|
+
originalRequest: paramString(params?.originalRequest),
|
|
53
|
+
kind: paramString(params?.kind),
|
|
54
|
+
priority: paramPriority(params?.priority),
|
|
55
|
+
acceptanceCriteria: paramStringArray(params?.acceptanceCriteria)
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
case "orchestrator-pause-task":
|
|
59
|
+
return client.pauseOrchestratorTask(requireTaskId(params));
|
|
60
|
+
case "orchestrator-resume-task":
|
|
61
|
+
return client.resumeOrchestratorTask(requireTaskId(params));
|
|
62
|
+
case "orchestrator-pause-all":
|
|
63
|
+
return { paused: await client.pauseAllOrchestratorTasks() };
|
|
64
|
+
case "orchestrator-resume-all":
|
|
65
|
+
return { resumed: await client.resumeAllOrchestratorTasks() };
|
|
66
|
+
case "orchestrator-delete-task":
|
|
67
|
+
return {
|
|
68
|
+
deleted: await client.deleteOrchestratorTask(requireTaskId(params))
|
|
69
|
+
};
|
|
70
|
+
case "orchestrator-fork-task":
|
|
71
|
+
return client.forkOrchestratorTask(requireTaskId(params), {
|
|
72
|
+
title: paramString(params?.title),
|
|
73
|
+
goal: paramString(params?.goal),
|
|
74
|
+
priority: paramPriority(params?.priority),
|
|
75
|
+
acceptanceCriteria: paramStringArray(params?.acceptanceCriteria)
|
|
76
|
+
});
|
|
77
|
+
case "orchestrator-update-task":
|
|
78
|
+
return client.updateOrchestratorTask(requireTaskId(params), {
|
|
79
|
+
title: paramString(params?.title),
|
|
80
|
+
goal: paramString(params?.goal),
|
|
81
|
+
summary: paramString(params?.summary),
|
|
82
|
+
priority: paramPriority(params?.priority),
|
|
83
|
+
acceptanceCriteria: paramStringArray(params?.acceptanceCriteria)
|
|
84
|
+
});
|
|
85
|
+
case "orchestrator-validate-task": {
|
|
86
|
+
if (typeof params?.passed !== "boolean") {
|
|
87
|
+
throw new Error("passed (boolean) is required to validate a task.");
|
|
88
|
+
}
|
|
89
|
+
return client.validateOrchestratorTask(requireTaskId(params), {
|
|
90
|
+
passed: params.passed,
|
|
91
|
+
summary: paramString(params?.summary),
|
|
92
|
+
evidence: paramString(params?.evidence),
|
|
93
|
+
verifier: paramString(params?.verifier),
|
|
94
|
+
humanOverride: params?.humanOverride === true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
case "orchestrator-add-agent":
|
|
98
|
+
return client.addOrchestratorAgent(requireTaskId(params), {
|
|
99
|
+
framework: paramString(params?.framework),
|
|
100
|
+
providerSource: paramString(params?.providerSource),
|
|
101
|
+
model: paramString(params?.model),
|
|
102
|
+
workdir: paramString(params?.workdir),
|
|
103
|
+
repo: paramString(params?.repo),
|
|
104
|
+
label: paramString(params?.label),
|
|
105
|
+
task: paramString(params?.task)
|
|
106
|
+
});
|
|
107
|
+
case "orchestrator-stop-agent": {
|
|
108
|
+
const sessionId = paramString(params?.sessionId);
|
|
109
|
+
if (!sessionId)
|
|
110
|
+
throw new Error("sessionId is required to stop an agent.");
|
|
111
|
+
return {
|
|
112
|
+
stopped: await client.stopOrchestratorAgent(
|
|
113
|
+
requireTaskId(params),
|
|
114
|
+
sessionId
|
|
115
|
+
)
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
case "orchestrator-send-message": {
|
|
119
|
+
const content = paramString(params?.content);
|
|
120
|
+
if (!content) throw new Error("content is required to send a message.");
|
|
121
|
+
return {
|
|
122
|
+
sent: await client.postOrchestratorTaskMessage(
|
|
123
|
+
requireTaskId(params),
|
|
124
|
+
content
|
|
125
|
+
)
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
default:
|
|
129
|
+
throw new Error(`Orchestrator view does not support "${capability}".`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
ORCHESTRATOR_CAPABILITY_IDS,
|
|
134
|
+
runOrchestratorCapability
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=orchestrator-capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/orchestrator-capabilities.ts"],"sourcesContent":["// Voice/chat capability dispatch for the `/orchestrator` view, split out of\n// OrchestratorWorkbench.tsx so that file exports only React components and\n// stays Fast-Refresh-compatible. These ids are declared on the `/orchestrator`\n// view and routed through the bundle's shared `interact` export so the agent\n// can drive the workbench by voice or chat. Every handler maps 1:1 to a client\n// method.\nimport { client } from \"@elizaos/ui\";\nimport {\n paramPriority,\n paramString,\n paramStringArray,\n requireTaskId,\n TASK_LIST_LIMIT,\n} from \"./orchestrator-params.js\";\n\nexport const ORCHESTRATOR_CAPABILITY_IDS: ReadonlySet<string> = new Set([\n \"orchestrator-status\",\n \"orchestrator-list-tasks\",\n \"orchestrator-open-task\",\n \"orchestrator-create-task\",\n \"orchestrator-pause-task\",\n \"orchestrator-resume-task\",\n \"orchestrator-pause-all\",\n \"orchestrator-resume-all\",\n \"orchestrator-delete-task\",\n \"orchestrator-fork-task\",\n \"orchestrator-update-task\",\n \"orchestrator-validate-task\",\n \"orchestrator-add-agent\",\n \"orchestrator-stop-agent\",\n \"orchestrator-send-message\",\n]);\n\nexport async function runOrchestratorCapability(\n capability: string,\n params?: Record<string, unknown>,\n): Promise<unknown> {\n switch (capability) {\n case \"orchestrator-status\":\n return client.getOrchestratorStatus();\n case \"orchestrator-list-tasks\":\n return client.listCodingAgentTaskThreads({\n includeArchived: params?.includeArchived === true,\n status: paramString(params?.status),\n search: paramString(params?.search),\n limit:\n typeof params?.limit === \"number\" ? params.limit : TASK_LIST_LIMIT,\n });\n case \"orchestrator-open-task\": {\n const taskId = paramString(params?.taskId);\n if (taskId) return client.getCodingAgentTaskThread(taskId);\n const [first] = await client.listCodingAgentTaskThreads({ limit: 1 });\n return first ? client.getCodingAgentTaskThread(first.id) : null;\n }\n case \"orchestrator-create-task\": {\n const title = paramString(params?.title);\n const goal = paramString(params?.goal);\n if (!title || !goal) {\n throw new Error(\"title and goal are required to create a task.\");\n }\n return client.createOrchestratorTask({\n title,\n goal,\n originalRequest: paramString(params?.originalRequest),\n kind: paramString(params?.kind),\n priority: paramPriority(params?.priority),\n acceptanceCriteria: paramStringArray(params?.acceptanceCriteria),\n });\n }\n case \"orchestrator-pause-task\":\n return client.pauseOrchestratorTask(requireTaskId(params));\n case \"orchestrator-resume-task\":\n return client.resumeOrchestratorTask(requireTaskId(params));\n case \"orchestrator-pause-all\":\n return { paused: await client.pauseAllOrchestratorTasks() };\n case \"orchestrator-resume-all\":\n return { resumed: await client.resumeAllOrchestratorTasks() };\n case \"orchestrator-delete-task\":\n return {\n deleted: await client.deleteOrchestratorTask(requireTaskId(params)),\n };\n case \"orchestrator-fork-task\":\n return client.forkOrchestratorTask(requireTaskId(params), {\n title: paramString(params?.title),\n goal: paramString(params?.goal),\n priority: paramPriority(params?.priority),\n acceptanceCriteria: paramStringArray(params?.acceptanceCriteria),\n });\n case \"orchestrator-update-task\":\n return client.updateOrchestratorTask(requireTaskId(params), {\n title: paramString(params?.title),\n goal: paramString(params?.goal),\n summary: paramString(params?.summary),\n priority: paramPriority(params?.priority),\n acceptanceCriteria: paramStringArray(params?.acceptanceCriteria),\n });\n case \"orchestrator-validate-task\": {\n if (typeof params?.passed !== \"boolean\") {\n throw new Error(\"passed (boolean) is required to validate a task.\");\n }\n return client.validateOrchestratorTask(requireTaskId(params), {\n passed: params.passed,\n summary: paramString(params?.summary),\n evidence: paramString(params?.evidence),\n verifier: paramString(params?.verifier),\n humanOverride: params?.humanOverride === true,\n });\n }\n case \"orchestrator-add-agent\":\n return client.addOrchestratorAgent(requireTaskId(params), {\n framework: paramString(params?.framework),\n providerSource: paramString(params?.providerSource),\n model: paramString(params?.model),\n workdir: paramString(params?.workdir),\n repo: paramString(params?.repo),\n label: paramString(params?.label),\n task: paramString(params?.task),\n });\n case \"orchestrator-stop-agent\": {\n const sessionId = paramString(params?.sessionId);\n if (!sessionId)\n throw new Error(\"sessionId is required to stop an agent.\");\n return {\n stopped: await client.stopOrchestratorAgent(\n requireTaskId(params),\n sessionId,\n ),\n };\n }\n case \"orchestrator-send-message\": {\n const content = paramString(params?.content);\n if (!content) throw new Error(\"content is required to send a message.\");\n return {\n sent: await client.postOrchestratorTaskMessage(\n requireTaskId(params),\n content,\n ),\n };\n }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QAAQ;AAAA,QACtC,UAAU,YAAY,QAAQ,QAAQ;AAAA,QACtC,eAAe,QAAQ,kBAAkB;AAAA,MAC3C,CAAC;AAAA,IACH;AAAA,IACA,KAAK;AACH,aAAO,OAAO,qBAAqB,cAAc,MAAM,GAAG;AAAA,QACxD,WAAW,YAAY,QAAQ,SAAS;AAAA,QACxC,gBAAgB,YAAY,QAAQ,cAAc;AAAA,QAClD,OAAO,YAAY,QAAQ,KAAK;AAAA,QAChC,SAAS,YAAY,QAAQ,OAAO;AAAA,QACpC,MAAM,YAAY,QAAQ,IAAI;AAAA,QAC9B,OAAO,YAAY,QAAQ,KAAK;AAAA,QAChC,MAAM,YAAY,QAAQ,IAAI;AAAA,MAChC,CAAC;AAAA,IACH,KAAK,2BAA2B;AAC9B,YAAM,YAAY,YAAY,QAAQ,SAAS;AAC/C,UAAI,CAAC;AACH,cAAM,IAAI,MAAM,yCAAyC;AAC3D,aAAO;AAAA,QACL,SAAS,MAAM,OAAO;AAAA,UACpB,cAAc,MAAM;AAAA,UACpB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,KAAK,6BAA6B;AAChC,YAAM,UAAU,YAAY,QAAQ,OAAO;AAC3C,UAAI,CAAC,QAAS,OAAM,IAAI,MAAM,wCAAwC;AACtE,aAAO;AAAA,QACL,MAAM,MAAM,OAAO;AAAA,UACjB,cAAc,MAAM;AAAA,UACpB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA;AACE,YAAM,IAAI,MAAM,uCAAuC,UAAU,IAAI;AAAA,EACzE;AACF;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal slash-command contribution (#8790, #8798).
|
|
3
|
+
*
|
|
4
|
+
* The task-coordinator plugin owns the `orchestrator` view, so it contributes a
|
|
5
|
+
* view-scoped slash command for that view through the standard command system:
|
|
6
|
+
*
|
|
7
|
+
* - `registerOrchestratorCommands(agentId)` registers a `CommandDefinition`
|
|
8
|
+
* into the per-runtime registry of `@elizaos/plugin-commands`. The command
|
|
9
|
+
* is `views`-scoped to `orchestrator`, so it appears in `GET /api/commands`
|
|
10
|
+
* only while the orchestrator view is the active surface (#8798), and it is
|
|
11
|
+
* `target: { kind: "agent" }` so every surface routes it to this plugin's
|
|
12
|
+
* deterministic handler action.
|
|
13
|
+
* - `orchestratorStatusCommandAction` is that handler: a slash-only `Action`
|
|
14
|
+
* whose `validate()` matches `/orchestrator-status` and whose `handler()`
|
|
15
|
+
* returns a deterministic status reply — no LLM improvisation.
|
|
16
|
+
*
|
|
17
|
+
* This is the same contract the built-in commands and the connector bridges use;
|
|
18
|
+
* registering it here proves a non-core, view-owning plugin can light up the
|
|
19
|
+
* universal command surface end to end.
|
|
20
|
+
*/
|
|
21
|
+
import type { Action } from "@elizaos/core";
|
|
22
|
+
/** The orchestrator view id this command is scoped to. */
|
|
23
|
+
export declare const ORCHESTRATOR_VIEW_ID = "orchestrator";
|
|
24
|
+
/** Canonical key + handler-action name for the orchestrator status command. */
|
|
25
|
+
export declare const ORCHESTRATOR_STATUS_COMMAND_KEY = "orchestrator-status";
|
|
26
|
+
export declare const ORCHESTRATOR_STATUS_COMMAND_ACTION = "ORCHESTRATOR_STATUS_COMMAND";
|
|
27
|
+
/**
|
|
28
|
+
* Register the task-coordinator's view-scoped slash commands into the active
|
|
29
|
+
* per-runtime command registry. Call after `@elizaos/plugin-commands` has run
|
|
30
|
+
* `initForRuntime(agentId)` for this runtime (it boots before app plugins).
|
|
31
|
+
*/
|
|
32
|
+
export declare function registerOrchestratorCommands(agentId: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Deterministic handler for `/orchestrator-status`. Slash-only `validate()`
|
|
35
|
+
* (never intercepts conversational text) and a fixed reply so the command
|
|
36
|
+
* behaves identically on every surface.
|
|
37
|
+
*/
|
|
38
|
+
export declare const orchestratorStatusCommandAction: Action;
|
|
39
|
+
//# sourceMappingURL=orchestrator-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-command.d.ts","sourceRoot":"","sources":["../src/orchestrator-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,eAAe,CAAC;AAQnE,0DAA0D;AAC1D,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AAEnD,+EAA+E;AAC/E,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AACrE,eAAO,MAAM,kCAAkC,gCAAgC,CAAC;AAEhF;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAelE;AAED;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAE,MAqB7C,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
detectCommand,
|
|
3
|
+
hasCommand,
|
|
4
|
+
registerCommand,
|
|
5
|
+
useRuntime
|
|
6
|
+
} from "@elizaos/plugin-commands";
|
|
7
|
+
const ORCHESTRATOR_VIEW_ID = "orchestrator";
|
|
8
|
+
const ORCHESTRATOR_STATUS_COMMAND_KEY = "orchestrator-status";
|
|
9
|
+
const ORCHESTRATOR_STATUS_COMMAND_ACTION = "ORCHESTRATOR_STATUS_COMMAND";
|
|
10
|
+
function registerOrchestratorCommands(agentId) {
|
|
11
|
+
useRuntime(agentId);
|
|
12
|
+
registerCommand({
|
|
13
|
+
key: ORCHESTRATOR_STATUS_COMMAND_KEY,
|
|
14
|
+
nativeName: ORCHESTRATOR_STATUS_COMMAND_KEY,
|
|
15
|
+
description: "Show orchestrator status (in the orchestrator view)",
|
|
16
|
+
textAliases: ["/orchestrator-status"],
|
|
17
|
+
scope: "both",
|
|
18
|
+
category: "docks",
|
|
19
|
+
icon: "Layers",
|
|
20
|
+
surfaces: ["gui", "tui"],
|
|
21
|
+
views: [ORCHESTRATOR_VIEW_ID],
|
|
22
|
+
target: { kind: "agent", action: ORCHESTRATOR_STATUS_COMMAND_ACTION },
|
|
23
|
+
acceptsArgs: false
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const orchestratorStatusCommandAction = {
|
|
27
|
+
name: ORCHESTRATOR_STATUS_COMMAND_ACTION,
|
|
28
|
+
description: "Report the orchestrator surface status as a slash command.",
|
|
29
|
+
similes: ["/orchestrator-status"],
|
|
30
|
+
suppressEarlyReply: true,
|
|
31
|
+
suppressPostActionContinuation: true,
|
|
32
|
+
validate: async (runtime, message) => {
|
|
33
|
+
const text = message.content.text ?? "";
|
|
34
|
+
if (!hasCommand(text)) return false;
|
|
35
|
+
useRuntime(runtime.agentId);
|
|
36
|
+
const detection = detectCommand(text);
|
|
37
|
+
return detection.isCommand && detection.command?.key === ORCHESTRATOR_STATUS_COMMAND_KEY;
|
|
38
|
+
},
|
|
39
|
+
handler: async (_runtime, _message, _state, _options, callback) => {
|
|
40
|
+
const reply = "Orchestrator is online.";
|
|
41
|
+
if (callback) await callback({ text: reply, source: "command" });
|
|
42
|
+
return { success: true, text: reply };
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
ORCHESTRATOR_STATUS_COMMAND_ACTION,
|
|
47
|
+
ORCHESTRATOR_STATUS_COMMAND_KEY,
|
|
48
|
+
ORCHESTRATOR_VIEW_ID,
|
|
49
|
+
orchestratorStatusCommandAction,
|
|
50
|
+
registerOrchestratorCommands
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=orchestrator-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/orchestrator-command.ts"],"sourcesContent":["/**\n * Universal slash-command contribution (#8790, #8798).\n *\n * The task-coordinator plugin owns the `orchestrator` view, so it contributes a\n * view-scoped slash command for that view through the standard command system:\n *\n * - `registerOrchestratorCommands(agentId)` registers a `CommandDefinition`\n * into the per-runtime registry of `@elizaos/plugin-commands`. The command\n * is `views`-scoped to `orchestrator`, so it appears in `GET /api/commands`\n * only while the orchestrator view is the active surface (#8798), and it is\n * `target: { kind: \"agent\" }` so every surface routes it to this plugin's\n * deterministic handler action.\n * - `orchestratorStatusCommandAction` is that handler: a slash-only `Action`\n * whose `validate()` matches `/orchestrator-status` and whose `handler()`\n * returns a deterministic status reply — no LLM improvisation.\n *\n * This is the same contract the built-in commands and the connector bridges use;\n * registering it here proves a non-core, view-owning plugin can light up the\n * universal command surface end to end.\n */\n\nimport type { Action, IAgentRuntime, Memory } from \"@elizaos/core\";\nimport {\n detectCommand,\n hasCommand,\n registerCommand,\n useRuntime,\n} from \"@elizaos/plugin-commands\";\n\n/** The orchestrator view id this command is scoped to. */\nexport const ORCHESTRATOR_VIEW_ID = \"orchestrator\";\n\n/** Canonical key + handler-action name for the orchestrator status command. */\nexport const ORCHESTRATOR_STATUS_COMMAND_KEY = \"orchestrator-status\";\nexport const ORCHESTRATOR_STATUS_COMMAND_ACTION = \"ORCHESTRATOR_STATUS_COMMAND\";\n\n/**\n * Register the task-coordinator's view-scoped slash commands into the active\n * per-runtime command registry. Call after `@elizaos/plugin-commands` has run\n * `initForRuntime(agentId)` for this runtime (it boots before app plugins).\n */\nexport function registerOrchestratorCommands(agentId: string): void {\n useRuntime(agentId);\n registerCommand({\n key: ORCHESTRATOR_STATUS_COMMAND_KEY,\n nativeName: ORCHESTRATOR_STATUS_COMMAND_KEY,\n description: \"Show orchestrator status (in the orchestrator view)\",\n textAliases: [\"/orchestrator-status\"],\n scope: \"both\",\n category: \"docks\",\n icon: \"Layers\",\n surfaces: [\"gui\", \"tui\"],\n views: [ORCHESTRATOR_VIEW_ID],\n target: { kind: \"agent\", action: ORCHESTRATOR_STATUS_COMMAND_ACTION },\n acceptsArgs: false,\n });\n}\n\n/**\n * Deterministic handler for `/orchestrator-status`. Slash-only `validate()`\n * (never intercepts conversational text) and a fixed reply so the command\n * behaves identically on every surface.\n */\nexport const orchestratorStatusCommandAction: Action = {\n name: ORCHESTRATOR_STATUS_COMMAND_ACTION,\n description: \"Report the orchestrator surface status as a slash command.\",\n similes: [\"/orchestrator-status\"],\n suppressEarlyReply: true,\n suppressPostActionContinuation: true,\n validate: async (runtime: IAgentRuntime, message: Memory) => {\n const text = message.content.text ?? \"\";\n if (!hasCommand(text)) return false;\n useRuntime(runtime.agentId);\n const detection = detectCommand(text);\n return (\n detection.isCommand &&\n detection.command?.key === ORCHESTRATOR_STATUS_COMMAND_KEY\n );\n },\n handler: async (_runtime, _message, _state, _options, callback) => {\n const reply = \"Orchestrator is online.\";\n if (callback) await callback({ text: reply, source: \"command\" });\n return { success: true, text: reply };\n },\n};\n"],"mappings":"AAsBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,MAAM,uBAAuB;AAG7B,MAAM,kCAAkC;AACxC,MAAM,qCAAqC;AAO3C,SAAS,6BAA6B,SAAuB;AAClE,aAAW,OAAO;AAClB,kBAAgB;AAAA,IACd,KAAK;AAAA,IACL,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,aAAa,CAAC,sBAAsB;AAAA,IACpC,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU,CAAC,OAAO,KAAK;AAAA,IACvB,OAAO,CAAC,oBAAoB;AAAA,IAC5B,QAAQ,EAAE,MAAM,SAAS,QAAQ,mCAAmC;AAAA,IACpE,aAAa;AAAA,EACf,CAAC;AACH;AAOO,MAAM,kCAA0C;AAAA,EACrD,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS,CAAC,sBAAsB;AAAA,EAChC,oBAAoB;AAAA,EACpB,gCAAgC;AAAA,EAChC,UAAU,OAAO,SAAwB,YAAoB;AAC3D,UAAM,OAAO,QAAQ,QAAQ,QAAQ;AACrC,QAAI,CAAC,WAAW,IAAI,EAAG,QAAO;AAC9B,eAAW,QAAQ,OAAO;AAC1B,UAAM,YAAY,cAAc,IAAI;AACpC,WACE,UAAU,aACV,UAAU,SAAS,QAAQ;AAAA,EAE/B;AAAA,EACA,SAAS,OAAO,UAAU,UAAU,QAAQ,UAAU,aAAa;AACjE,UAAM,QAAQ;AACd,QAAI,SAAU,OAAM,SAAS,EAAE,MAAM,OAAO,QAAQ,UAAU,CAAC;AAC/D,WAAO,EAAE,SAAS,MAAM,MAAM,MAAM;AAAA,EACtC;AACF;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Compact '+N −M' magnitude badge for a tool-call header. Green addition count
|
|
4
|
+
* + red removal count (meaning-correct; see ROW_TONE), neutral otherwise.
|
|
5
|
+
*/
|
|
6
|
+
export declare function DiffStat({ added, removed, }: {
|
|
7
|
+
added: number;
|
|
8
|
+
removed: number;
|
|
9
|
+
}): ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Render an edit as an interleaved diff. When `oldText` is omitted (a file
|
|
12
|
+
* write rather than an edit) every line is shown as an addition. Long runs of
|
|
13
|
+
* unchanged context are folded to a quiet "⋯ N unchanged" divider.
|
|
14
|
+
*/
|
|
15
|
+
export declare function DiffView({ oldText, newText, }: {
|
|
16
|
+
oldText?: string;
|
|
17
|
+
newText: string;
|
|
18
|
+
}): ReactNode;
|
|
19
|
+
//# sourceMappingURL=orchestrator-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-diff.d.ts","sourceRoot":"","sources":["../src/orchestrator-diff.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASvC;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,SAAS,CAOZ;AAgGD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,OAAO,GACR,EAAE;IACD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,SAAS,CAyCZ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface DiffRow {
|
|
2
|
+
type: "context" | "add" | "remove";
|
|
3
|
+
/** 1-based line number in the old text, or null for an addition. */
|
|
4
|
+
oldLine: number | null;
|
|
5
|
+
/** 1-based line number in the new text, or null for a removal. */
|
|
6
|
+
newLine: number | null;
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
/** The minimal interleaved add/remove/context sequence aligning `oldText` to
|
|
10
|
+
* `newText`, via the classic LCS dynamic program. */
|
|
11
|
+
export declare function lineDiff(oldText: string, newText: string): DiffRow[];
|
|
12
|
+
/** Count added vs removed lines in an already-aligned diff, so a tool header
|
|
13
|
+
* can show the edit magnitude without re-running the alignment. */
|
|
14
|
+
export declare function countDiff(rows: DiffRow[]): {
|
|
15
|
+
added: number;
|
|
16
|
+
removed: number;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=orchestrator-diff.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-diff.helpers.d.ts","sourceRoot":"","sources":["../src/orchestrator-diff.helpers.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,oEAAoE;IACpE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,kEAAkE;IAClE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAMD;qDACqD;AACrD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAkEpE;AAED;mEACmE;AACnE,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAQ7E"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const MAX_ALIGN_LINES = 800;
|
|
2
|
+
function lineDiff(oldText, newText) {
|
|
3
|
+
const a = oldText.split("\n");
|
|
4
|
+
const b = newText.split("\n");
|
|
5
|
+
const n = a.length;
|
|
6
|
+
const m = b.length;
|
|
7
|
+
if (n + m > MAX_ALIGN_LINES) {
|
|
8
|
+
const flat = [];
|
|
9
|
+
for (let i2 = 0; i2 < n; i2++)
|
|
10
|
+
flat.push({ type: "remove", oldLine: i2 + 1, newLine: null, text: a[i2] });
|
|
11
|
+
for (let j2 = 0; j2 < m; j2++)
|
|
12
|
+
flat.push({ type: "add", oldLine: null, newLine: j2 + 1, text: b[j2] });
|
|
13
|
+
return flat;
|
|
14
|
+
}
|
|
15
|
+
const dp = Array.from(
|
|
16
|
+
{ length: n + 1 },
|
|
17
|
+
() => new Array(m + 1).fill(0)
|
|
18
|
+
);
|
|
19
|
+
for (let i2 = n - 1; i2 >= 0; i2--) {
|
|
20
|
+
for (let j2 = m - 1; j2 >= 0; j2--) {
|
|
21
|
+
dp[i2][j2] = a[i2] === b[j2] ? dp[i2 + 1][j2 + 1] + 1 : Math.max(dp[i2 + 1][j2], dp[i2][j2 + 1]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const rows = [];
|
|
25
|
+
let i = 0;
|
|
26
|
+
let j = 0;
|
|
27
|
+
let oldNo = 1;
|
|
28
|
+
let newNo = 1;
|
|
29
|
+
while (i < n && j < m) {
|
|
30
|
+
if (a[i] === b[j]) {
|
|
31
|
+
rows.push({
|
|
32
|
+
type: "context",
|
|
33
|
+
oldLine: oldNo++,
|
|
34
|
+
newLine: newNo++,
|
|
35
|
+
text: a[i]
|
|
36
|
+
});
|
|
37
|
+
i++;
|
|
38
|
+
j++;
|
|
39
|
+
} else if (dp[i + 1][j] >= dp[i][j + 1]) {
|
|
40
|
+
rows.push({
|
|
41
|
+
type: "remove",
|
|
42
|
+
oldLine: oldNo++,
|
|
43
|
+
newLine: null,
|
|
44
|
+
text: a[i]
|
|
45
|
+
});
|
|
46
|
+
i++;
|
|
47
|
+
} else {
|
|
48
|
+
rows.push({ type: "add", oldLine: null, newLine: newNo++, text: b[j] });
|
|
49
|
+
j++;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
while (i < n)
|
|
53
|
+
rows.push({
|
|
54
|
+
type: "remove",
|
|
55
|
+
oldLine: oldNo++,
|
|
56
|
+
newLine: null,
|
|
57
|
+
text: a[i++]
|
|
58
|
+
});
|
|
59
|
+
while (j < m)
|
|
60
|
+
rows.push({ type: "add", oldLine: null, newLine: newNo++, text: b[j++] });
|
|
61
|
+
return rows;
|
|
62
|
+
}
|
|
63
|
+
function countDiff(rows) {
|
|
64
|
+
let added = 0;
|
|
65
|
+
let removed = 0;
|
|
66
|
+
for (const row of rows) {
|
|
67
|
+
if (row.type === "add") added++;
|
|
68
|
+
else if (row.type === "remove") removed++;
|
|
69
|
+
}
|
|
70
|
+
return { added, removed };
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
countDiff,
|
|
74
|
+
lineDiff
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=orchestrator-diff.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/orchestrator-diff.helpers.ts"],"sourcesContent":["// Pure line-diff helpers for the tool-call cards, split out of orchestrator-diff.tsx\n// so that file exports only React components (+ the DiffRow type) and stays\n// Fast-Refresh-compatible. A real, interleaved, line-aligned diff — the way\n// Claude Code / Codex / opencode render an edit.\n\nexport interface DiffRow {\n type: \"context\" | \"add\" | \"remove\";\n /** 1-based line number in the old text, or null for an addition. */\n oldLine: number | null;\n /** 1-based line number in the new text, or null for a removal. */\n newLine: number | null;\n text: string;\n}\n\n/** Above this combined line count the O(n·m) alignment is skipped for a flat\n * remove-then-add render. Callers pass clamped text, so this is a backstop. */\nconst MAX_ALIGN_LINES = 800;\n\n/** The minimal interleaved add/remove/context sequence aligning `oldText` to\n * `newText`, via the classic LCS dynamic program. */\nexport function lineDiff(oldText: string, newText: string): DiffRow[] {\n const a = oldText.split(\"\\n\");\n const b = newText.split(\"\\n\");\n const n = a.length;\n const m = b.length;\n\n if (n + m > MAX_ALIGN_LINES) {\n const flat: DiffRow[] = [];\n for (let i = 0; i < n; i++)\n flat.push({ type: \"remove\", oldLine: i + 1, newLine: null, text: a[i] });\n for (let j = 0; j < m; j++)\n flat.push({ type: \"add\", oldLine: null, newLine: j + 1, text: b[j] });\n return flat;\n }\n\n // dp[i][j] = LCS length of a[i:] and b[j:].\n const dp: number[][] = Array.from({ length: n + 1 }, () =>\n new Array<number>(m + 1).fill(0),\n );\n for (let i = n - 1; i >= 0; i--) {\n for (let j = m - 1; j >= 0; j--) {\n dp[i][j] =\n a[i] === b[j]\n ? dp[i + 1][j + 1] + 1\n : Math.max(dp[i + 1][j], dp[i][j + 1]);\n }\n }\n\n const rows: DiffRow[] = [];\n let i = 0;\n let j = 0;\n let oldNo = 1;\n let newNo = 1;\n while (i < n && j < m) {\n if (a[i] === b[j]) {\n rows.push({\n type: \"context\",\n oldLine: oldNo++,\n newLine: newNo++,\n text: a[i],\n });\n i++;\n j++;\n } else if (dp[i + 1][j] >= dp[i][j + 1]) {\n rows.push({\n type: \"remove\",\n oldLine: oldNo++,\n newLine: null,\n text: a[i],\n });\n i++;\n } else {\n rows.push({ type: \"add\", oldLine: null, newLine: newNo++, text: b[j] });\n j++;\n }\n }\n while (i < n)\n rows.push({\n type: \"remove\",\n oldLine: oldNo++,\n newLine: null,\n text: a[i++],\n });\n while (j < m)\n rows.push({ type: \"add\", oldLine: null, newLine: newNo++, text: b[j++] });\n return rows;\n}\n\n/** Count added vs removed lines in an already-aligned diff, so a tool header\n * can show the edit magnitude without re-running the alignment. */\nexport function countDiff(rows: DiffRow[]): { added: number; removed: number } {\n let added = 0;\n let removed = 0;\n for (const row of rows) {\n if (row.type === \"add\") added++;\n else if (row.type === \"remove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B,WAAK,KAAK;AAAA,QACR,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,QACT,MAAM,EAAE,CAAC;AAAA,MACX,CAAC;AACD;AACA;AAAA,IACF,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG;AACvC,WAAK,KAAK;AAAA,QACR,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,QACT,MAAM,EAAE,CAAC;AAAA,MACX,CAAC;AACD;AAAA,IACF,OAAO;AACL,WAAK,KAAK,EAAE,MAAM,OAAO,SAAS,MAAM,SAAS,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC;AACtE;AAAA,IACF;AAAA,EACF;AACA,SAAO,IAAI;AACT,SAAK,KAAK;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,MAAM,EAAE,GAAG;AAAA,IACb,CAAC;AACH,SAAO,IAAI;AACT,SAAK,KAAK,EAAE,MAAM,OAAO,SAAS,MAAM,SAAS,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC;AAC1E,SAAO;AACT;AAIO,SAAS,UAAU,MAAqD;AAC7E,MAAI,QAAQ;AACZ,MAAI,UAAU;AACd,aAAW,OAAO,MAAM;AACtB,QAAI,IAAI,SAAS,MAAO;AAAA,aACf,IAAI,SAAS,SAAU;AAAA,EAClC;AACA,SAAO,EAAE,OAAO,QAAQ;AAC1B;","names":["i","j"]}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { lineDiff } from "./orchestrator-diff.helpers";
|
|
3
|
+
function DiffStat({
|
|
4
|
+
added,
|
|
5
|
+
removed
|
|
6
|
+
}) {
|
|
7
|
+
return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 font-mono text-2xs tabular-nums", children: [
|
|
8
|
+
/* @__PURE__ */ jsxs("span", { className: "text-ok", children: [
|
|
9
|
+
"+",
|
|
10
|
+
added
|
|
11
|
+
] }),
|
|
12
|
+
/* @__PURE__ */ jsxs("span", { className: "text-red-500", children: [
|
|
13
|
+
"\u2212",
|
|
14
|
+
removed
|
|
15
|
+
] })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
const ROW_TONE = {
|
|
19
|
+
context: "text-muted",
|
|
20
|
+
add: "bg-ok/10 text-ok",
|
|
21
|
+
remove: "bg-red-500/10 text-red-500"
|
|
22
|
+
};
|
|
23
|
+
const ROW_SIGN = {
|
|
24
|
+
context: "",
|
|
25
|
+
add: "+",
|
|
26
|
+
remove: "-"
|
|
27
|
+
};
|
|
28
|
+
const CONTEXT_FOLD_THRESHOLD = 6;
|
|
29
|
+
const CONTEXT_EDGE = 3;
|
|
30
|
+
function foldContext(rows) {
|
|
31
|
+
const out = [];
|
|
32
|
+
let i = 0;
|
|
33
|
+
while (i < rows.length) {
|
|
34
|
+
if (rows[i].type !== "context") {
|
|
35
|
+
out.push(rows[i]);
|
|
36
|
+
i++;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
let j = i;
|
|
40
|
+
while (j < rows.length && rows[j].type === "context") j++;
|
|
41
|
+
const run = rows.slice(i, j);
|
|
42
|
+
const atStart = i === 0;
|
|
43
|
+
const atEnd = j === rows.length;
|
|
44
|
+
const head = atStart ? 0 : CONTEXT_EDGE;
|
|
45
|
+
const tail = atEnd ? 0 : CONTEXT_EDGE;
|
|
46
|
+
const hidden = run.length - head - tail;
|
|
47
|
+
if (run.length > CONTEXT_FOLD_THRESHOLD && hidden > 0) {
|
|
48
|
+
for (let k = 0; k < head; k++) out.push(run[k]);
|
|
49
|
+
const before = head > 0 ? run[head - 1] : void 0;
|
|
50
|
+
const after = run[run.length - tail] ?? run[run.length - 1];
|
|
51
|
+
out.push({
|
|
52
|
+
type: "fold",
|
|
53
|
+
hidden,
|
|
54
|
+
key: `fold:${before?.oldLine ?? "_"}:${after?.newLine ?? "_"}`
|
|
55
|
+
});
|
|
56
|
+
for (let k = run.length - tail; k < run.length; k++) out.push(run[k]);
|
|
57
|
+
} else {
|
|
58
|
+
for (const row of run) out.push(row);
|
|
59
|
+
}
|
|
60
|
+
i = j;
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
function Gutter({ value }) {
|
|
65
|
+
return /* @__PURE__ */ jsx("span", { className: "w-8 shrink-0 select-none px-1 text-right text-muted/40 tabular-nums", children: value ?? "" });
|
|
66
|
+
}
|
|
67
|
+
function FoldDivider({ hidden }) {
|
|
68
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 border-border/30 border-y bg-bg-accent/40 px-2 py-0.5 text-muted/50 text-2xs", children: [
|
|
69
|
+
/* @__PURE__ */ jsx("span", { className: "select-none", children: "⋯" }),
|
|
70
|
+
/* @__PURE__ */ jsxs("span", { className: "select-none tabular-nums", children: [
|
|
71
|
+
hidden,
|
|
72
|
+
" unchanged ",
|
|
73
|
+
hidden === 1 ? "line" : "lines"
|
|
74
|
+
] })
|
|
75
|
+
] });
|
|
76
|
+
}
|
|
77
|
+
function DiffView({
|
|
78
|
+
oldText,
|
|
79
|
+
newText
|
|
80
|
+
}) {
|
|
81
|
+
const rows = oldText === void 0 ? newText.split("\n").map((text, idx) => ({
|
|
82
|
+
type: "add",
|
|
83
|
+
oldLine: null,
|
|
84
|
+
newLine: idx + 1,
|
|
85
|
+
text
|
|
86
|
+
})) : lineDiff(oldText, newText);
|
|
87
|
+
const view = foldContext(rows);
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
className: "overflow-x-hidden overflow-y-auto rounded-sm border border-border/40 bg-bg-accent font-mono text-2xs leading-snug",
|
|
92
|
+
style: { maxHeight: "18rem" },
|
|
93
|
+
"data-testid": "orchestrator-diff",
|
|
94
|
+
children: view.map(
|
|
95
|
+
(row) => row.type === "fold" ? /* @__PURE__ */ jsx(FoldDivider, { hidden: row.hidden }, row.key) : (
|
|
96
|
+
// (oldLine, newLine) pairs are unique within a diff, so no index key.
|
|
97
|
+
/* @__PURE__ */ jsxs(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
className: `flex ${ROW_TONE[row.type]}`,
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ jsx(Gutter, { value: row.oldLine }),
|
|
103
|
+
/* @__PURE__ */ jsx(Gutter, { value: row.newLine }),
|
|
104
|
+
/* @__PURE__ */ jsx("span", { className: "w-3 shrink-0 select-none text-center opacity-70", children: ROW_SIGN[row.type] }),
|
|
105
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 whitespace-pre-wrap break-all pr-2", children: row.text })
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
`${row.oldLine ?? "_"}:${row.newLine ?? "_"}:${row.type}`
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
DiffStat,
|
|
117
|
+
DiffView
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=orchestrator-diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/orchestrator-diff.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { type DiffRow, lineDiff } from \"./orchestrator-diff.helpers\";\n\n// A real, interleaved, line-aligned diff for the tool-call cards — the way\n// Claude Code / Codex / opencode render an edit. The tool view already carries\n// oldText/newText (parsed from the ACP tool input), so this is a pure\n// presentation concern: align the two texts (via lineDiff) and render\n// add/remove/context rows with old+new line-number gutters.\n\n/**\n * Compact '+N −M' magnitude badge for a tool-call header. Green addition count\n * + red removal count (meaning-correct; see ROW_TONE), neutral otherwise.\n */\nexport function DiffStat({\n added,\n removed,\n}: {\n added: number;\n removed: number;\n}): ReactNode {\n return (\n <span className=\"inline-flex items-center gap-1 font-mono text-2xs tabular-nums\">\n <span className=\"text-ok\">+{added}</span>\n <span className=\"text-red-500\">−{removed}</span>\n </span>\n );\n}\n\n// Meaning-only color: green for additions (--ok), red for deletions, muted for\n// everything unchanged. No fills heavier than /10 so the palette stays calm.\nconst ROW_TONE: Record<DiffRow[\"type\"], string> = {\n context: \"text-muted\",\n add: \"bg-ok/10 text-ok\",\n remove: \"bg-red-500/10 text-red-500\",\n};\n\nconst ROW_SIGN: Record<DiffRow[\"type\"], string> = {\n context: \"\",\n add: \"+\",\n remove: \"-\",\n};\n\n/** A run of unchanged lines longer than this is folded to a divider. Three\n * lines of context are kept on each inner edge of the fold (git/Codex style),\n * so a fold only appears when there is something to actually hide. */\nconst CONTEXT_FOLD_THRESHOLD = 6;\nconst CONTEXT_EDGE = 3;\n\n/** A folded gap stands in for `hidden` consecutive context rows. It is purely\n * derived from the row sequence — no state, no expansion — matching Codex's\n * non-interactive \"⋯ N unchanged\" divider. */\ninterface FoldRow {\n type: \"fold\";\n hidden: number;\n /** Stable key from the surrounding line numbers. */\n key: string;\n}\n\ntype ViewRow = DiffRow | FoldRow;\n\n/** Collapse long runs of context into fold dividers. Leading/trailing context\n * keeps only its inner-facing edge (no point showing context before the first\n * change or after the last one beyond what frames it). Pure + stateless. */\nfunction foldContext(rows: DiffRow[]): ViewRow[] {\n const out: ViewRow[] = [];\n let i = 0;\n while (i < rows.length) {\n if (rows[i].type !== \"context\") {\n out.push(rows[i]);\n i++;\n continue;\n }\n // Gather the maximal run of context rows starting at i.\n let j = i;\n while (j < rows.length && rows[j].type === \"context\") j++;\n const run = rows.slice(i, j);\n const atStart = i === 0;\n const atEnd = j === rows.length;\n const head = atStart ? 0 : CONTEXT_EDGE;\n const tail = atEnd ? 0 : CONTEXT_EDGE;\n const hidden = run.length - head - tail;\n\n // Fold only a genuinely long run, and only when the kept edges still leave\n // something worth tucking behind the divider.\n if (run.length > CONTEXT_FOLD_THRESHOLD && hidden > 0) {\n for (let k = 0; k < head; k++) out.push(run[k]);\n const before = head > 0 ? run[head - 1] : undefined;\n const after = run[run.length - tail] ?? run[run.length - 1];\n out.push({\n type: \"fold\",\n hidden,\n key: `fold:${before?.oldLine ?? \"_\"}:${after?.newLine ?? \"_\"}`,\n });\n for (let k = run.length - tail; k < run.length; k++) out.push(run[k]);\n } else {\n for (const row of run) out.push(row);\n }\n i = j;\n }\n return out;\n}\n\nfunction Gutter({ value }: { value: number | null }): ReactNode {\n return (\n <span className=\"w-8 shrink-0 select-none px-1 text-right text-muted/40 tabular-nums\">\n {value ?? \"\"}\n </span>\n );\n}\n\n/** The \"⋯ N unchanged\" divider for a folded run of context. */\nfunction FoldDivider({ hidden }: { hidden: number }): ReactNode {\n return (\n <div className=\"flex items-center gap-2 border-border/30 border-y bg-bg-accent/40 px-2 py-0.5 text-muted/50 text-2xs\">\n <span className=\"select-none\">⋯</span>\n <span className=\"select-none tabular-nums\">\n {hidden} unchanged {hidden === 1 ? \"line\" : \"lines\"}\n </span>\n </div>\n );\n}\n\n/**\n * Render an edit as an interleaved diff. When `oldText` is omitted (a file\n * write rather than an edit) every line is shown as an addition. Long runs of\n * unchanged context are folded to a quiet \"⋯ N unchanged\" divider.\n */\nexport function DiffView({\n oldText,\n newText,\n}: {\n oldText?: string;\n newText: string;\n}): ReactNode {\n const rows: DiffRow[] =\n oldText === undefined\n ? newText.split(\"\\n\").map((text, idx) => ({\n type: \"add\" as const,\n oldLine: null,\n newLine: idx + 1,\n text,\n }))\n : lineDiff(oldText, newText);\n\n const view = foldContext(rows);\n\n return (\n <div\n className=\"overflow-x-hidden overflow-y-auto rounded-sm border border-border/40 bg-bg-accent font-mono text-2xs leading-snug\"\n style={{ maxHeight: \"18rem\" }}\n data-testid=\"orchestrator-diff\"\n >\n {view.map((row) =>\n row.type === \"fold\" ? (\n <FoldDivider key={row.key} hidden={row.hidden} />\n ) : (\n // (oldLine, newLine) pairs are unique within a diff, so no index key.\n <div\n key={`${row.oldLine ?? \"_\"}:${row.newLine ?? \"_\"}:${row.type}`}\n className={`flex ${ROW_TONE[row.type]}`}\n >\n <Gutter value={row.oldLine} />\n <Gutter value={row.newLine} />\n <span className=\"w-3 shrink-0 select-none text-center opacity-70\">\n {ROW_SIGN[row.type]}\n </span>\n <span className=\"min-w-0 flex-1 whitespace-pre-wrap break-all pr-2\">\n {row.text}\n </span>\n </div>\n ),\n )}\n </div>\n );\n}\n"],"mappings":"AAsBM,SAkFF,KAlFE;AArBN,SAAuB,gBAAgB;AAYhC,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AACF,GAGc;AACZ,SACE,qBAAC,UAAK,WAAU,kEACd;AAAA,yBAAC,UAAK,WAAU,WAAU;AAAA;AAAA,MAAE;AAAA,OAAM;AAAA,IAClC,qBAAC,UAAK,WAAU,gBAAe;AAAA;AAAA,MAAQ;AAAA,OAAQ;AAAA,KACjD;AAEJ;AAIA,MAAM,WAA4C;AAAA,EAChD,SAAS;AAAA,EACT,KAAK;AAAA,EACL,QAAQ;AACV;AAEA,MAAM,WAA4C;AAAA,EAChD,SAAS;AAAA,EACT,KAAK;AAAA,EACL,QAAQ;AACV;AAKA,MAAM,yBAAyB;AAC/B,MAAM,eAAe;AAiBrB,SAAS,YAAY,MAA4B;AAC/C,QAAM,MAAiB,CAAC;AACxB,MAAI,IAAI;AACR,SAAO,IAAI,KAAK,QAAQ;AACtB,QAAI,KAAK,CAAC,EAAE,SAAS,WAAW;AAC9B,UAAI,KAAK,KAAK,CAAC,CAAC;AAChB;AACA;AAAA,IACF;AAEA,QAAI,IAAI;AACR,WAAO,IAAI,KAAK,UAAU,KAAK,CAAC,EAAE,SAAS,UAAW;AACtD,UAAM,MAAM,KAAK,MAAM,GAAG,CAAC;AAC3B,UAAM,UAAU,MAAM;AACtB,UAAM,QAAQ,MAAM,KAAK;AACzB,UAAM,OAAO,UAAU,IAAI;AAC3B,UAAM,OAAO,QAAQ,IAAI;AACzB,UAAM,SAAS,IAAI,SAAS,OAAO;AAInC,QAAI,IAAI,SAAS,0BAA0B,SAAS,GAAG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;AAAA,MAEX,eAAK;AAAA,QAAI,CAAC,QACT,IAAI,SAAS,SACX,oBAAC,eAA0B,QAAQ,IAAI,UAArB,IAAI,GAAyB;AAAA;AAAA,UAG/C;AAAA,YAAC;AAAA;AAAA,cAEC,WAAW,QAAQ,SAAS,IAAI,IAAI,CAAC;AAAA,cAErC;AAAA,oCAAC,UAAO,OAAO,IAAI,SAAS;AAAA,gBAC5B,oBAAC,UAAO,OAAO,IAAI,SAAS;AAAA,gBAC5B,oBAAC,UAAK,WAAU,mDACb,mBAAS,IAAI,IAAI,GACpB;AAAA,gBACA,oBAAC,UAAK,WAAU,qDACb,cAAI,MACP;AAAA;AAAA;AAAA,YAVK,GAAG,IAAI,WAAW,GAAG,IAAI,IAAI,WAAW,GAAG,IAAI,IAAI,IAAI;AAAA,UAW9D;AAAA;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-markdown.d.ts","sourceRoot":"","sources":["../src/orchestrator-markdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AA0QpE,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAmBlE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-markdown.helpers.d.ts","sourceRoot":"","sources":["../src/orchestrator-markdown.helpers.ts"],"names":[],"mappings":"AAIA,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CA4B5E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function sanitizeMarkdownUrl(value) {
|
|
2
|
+
if (!value) return null;
|
|
3
|
+
const trimmed = value.trim();
|
|
4
|
+
if (!trimmed) return null;
|
|
5
|
+
if (trimmed.startsWith("/") && !trimmed.startsWith("//") || trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("#")) {
|
|
6
|
+
return trimmed;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
const parsed = new URL(trimmed);
|
|
10
|
+
if (parsed.protocol === "http:" || parsed.protocol === "https:" || parsed.protocol === "mailto:") {
|
|
11
|
+
return trimmed;
|
|
12
|
+
}
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
sanitizeMarkdownUrl
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=orchestrator-markdown.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/orchestrator-markdown.helpers.ts"],"sourcesContent":["// Pure markdown URL sanitizer, split out of orchestrator-markdown.tsx so that\n// file exports only the MarkdownText component and stays Fast-Refresh-compatible.\n// Returns the URL only for safe schemes/relative forms, null otherwise — keeping\n// raw/unknown-scheme links (javascript:, data:, …) out of the rendered AST.\nexport function sanitizeMarkdownUrl(value: string | undefined): string | null {\n if (!value) return null;\n const trimmed = value.trim();\n if (!trimmed) return null;\n\n if (\n (trimmed.startsWith(\"/\") && !trimmed.startsWith(\"//\")) ||\n trimmed.startsWith(\"./\") ||\n trimmed.startsWith(\"../\") ||\n trimmed.startsWith(\"#\")\n ) {\n return trimmed;\n }\n\n try {\n const parsed = new URL(trimmed);\n if (\n parsed.protocol === \"http:\" ||\n parsed.protocol === \"https:\" ||\n parsed.protocol === \"mailto:\"\n ) {\n return trimmed;\n }\n } catch {\n return null;\n }\n\n return null;\n}\n"],"mappings":"AAIO,SAAS,oBAAoB,OAA0C;AAC5E,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,CAAC,QAAS,QAAO;AAErB,MACG,QAAQ,WAAW,GAAG,KAAK,CAAC,QAAQ,WAAW,IAAI,KACpD,QAAQ,WAAW,IAAI,KACvB,QAAQ,WAAW,KAAK,KACxB,QAAQ,WAAW,GAAG,GACtB;AACA,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,OAAO;AAC9B,QACE,OAAO,aAAa,WACpB,OAAO,aAAa,YACpB,OAAO,aAAa,WACpB;AACA,aAAO;AAAA,IACT;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
|