@burdenoff/microfe-vibecontrols 2026.602.8 → 2026.602.10
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/dist/components/actions/ActionForm.js +260 -252
- package/dist/components/actions/ActionForm.js.map +1 -1
- package/dist/components/ai/InstructionFilesManager.js +138 -135
- package/dist/components/ai/InstructionFilesManager.js.map +1 -1
- package/dist/components/aliases/AliasManager.js +225 -224
- package/dist/components/aliases/AliasManager.js.map +1 -1
- package/dist/components/common/ActionAgentTargetNotice.js +125 -0
- package/dist/components/common/ActionAgentTargetNotice.js.map +1 -0
- package/dist/components/common/CommandEditor.js +49 -0
- package/dist/components/common/CommandEditor.js.map +1 -0
- package/dist/components/common/actionAgentTarget.js +55 -0
- package/dist/components/common/actionAgentTarget.js.map +1 -0
- package/dist/components/common/commandHighlight.js +190 -0
- package/dist/components/common/commandHighlight.js.map +1 -0
- package/dist/components/vibecalendar/ScheduleTaskModal.js +151 -149
- package/dist/components/vibecalendar/ScheduleTaskModal.js.map +1 -1
- package/dist/components/vibedeck/VibeDeckButtonForm.js +231 -219
- package/dist/components/vibedeck/VibeDeckButtonForm.js.map +1 -1
- package/dist/generated/wspace-operations.js +1 -0
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/pages/ActionsPage.js +233 -224
- package/dist/pages/ActionsPage.js.map +1 -1
- package/dist/pages/AgentDetailsPage.js +490 -489
- package/dist/pages/AgentDetailsPage.js.map +1 -1
- package/dist/pages/SessionDetailsPage.js +401 -401
- package/dist/pages/SessionDetailsPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AliasManager.js","names":[],"sources":["../../../src/components/aliases/AliasManager.tsx"],"sourcesContent":["/**\n * AliasManager — per-agent CRUDL for shell aliases exposed by\n * vibecontrols-agent under `/api/agent/aliases/*` (mounted by the core\n * `agent` plugin's route module, not a standalone aliases plugin).\n *\n * Endpoints (proxied through wspace-vibecontrols-svc → agent):\n * GET /api/agent/aliases → { aliases: Alias[] }\n * GET /api/agent/aliases/:name → Alias\n * POST /api/agent/aliases → Alias\n * PUT /api/agent/aliases/:name → Alias\n * DELETE /api/agent/aliases/:name\n * POST /api/agent/aliases/:name/execute → { exit_code, stdout, stderr, duration_ms }\n */\n\nimport { useCallback, useEffect, useState } from 'react';\nimport { Plus, Trash2, Play, Pencil, Check, X, Loader2, Terminal, PackageOpen } from 'lucide-react';\nimport { agentAiGet, agentAiMutate } from '@/services/aiApi';\nimport { useTr } from '@/shared/hooks/useTr';\nimport { validateAliasName } from './aliasReservedNames';\n\n// Anchor 404 by surrounding punctuation, not `\\b404\\b` — `\\b` matches\n// `v1.2.404`. Same shape used for `not_found` below so we don't match\n// inside `user_not_found` / `config_not_found` etc.\n// Escape `[` for `u`/`v` Unicode-mode forward-compat.\n// eslint-disable-next-line no-useless-escape -- forward-compat for Unicode regex mode\nconst HTTP_404_PATTERN = /(?:^|[\\s\"'(:\\[])404(?=$|[\\s\"',.):;\\]])/;\n// eslint-disable-next-line no-useless-escape -- forward-compat for Unicode regex mode\nconst NOT_FOUND_TOKEN_PATTERN = /(?:^|[\\s\"'(:\\[])not_found(?=$|[\\s\"',.):;\\]])/;\nfunction isAliasesRouteUnavailable(msg: string): boolean {\n if (!msg) return false;\n const m = msg.toLowerCase();\n if (NOT_FOUND_TOKEN_PATTERN.test(m)) return true;\n if (HTTP_404_PATTERN.test(m)) return true;\n if (m.includes('not installed on the agent')) return true;\n return false;\n}\n\ninterface Alias {\n name: string;\n command: string;\n description?: string | null;\n /**\n * Per-alias working directory. The agent resolves `~/...` against\n * `$HOME` at execution time and falls back to `$HOME` when this is\n * null / undefined. Stored as the user typed it (portable across\n * hosts with different `$HOME`).\n */\n cwd?: string | null;\n updatedAt?: string | null;\n createdAt?: string | null;\n}\n\n// The agent's `GET /api/agent/aliases` returns `{ aliases: Alias[] }`.\n// We also tolerate `{ items: Alias[] }` and a bare array for forward-\n// compat with any future plugin shipment that returns the older shape.\ninterface AliasListResponse {\n aliases?: Alias[];\n items?: Alias[];\n}\n\ninterface AliasExecuteResult {\n exit_code: number;\n stdout: string;\n stderr: string;\n /**\n * Wall-clock milliseconds the child took to exit. Matches the\n * agent's `RunCapturedResult.duration_ms`. Not surfaced in the run\n * modal yet — declared so the type matches the documented response\n * shape and so a future UI can show it without a second TS pass.\n */\n duration_ms?: number;\n /**\n * Absolute path the command actually ran in (post `~`/HOME resolution).\n * Surfaced by the agent so the UI can show the user where the side\n * effects landed — particularly useful when the alias relied on the\n * `$HOME` default.\n */\n cwd?: string;\n}\n\ninterface AliasManagerProps {\n agent: { id: string; profile?: string };\n}\n\nconst TRUNCATE = 80;\n\nfunction truncate(str: string, n = TRUNCATE): string {\n if (!str) return '';\n return str.length > n ? `${str.slice(0, n)}…` : str;\n}\n\nexport function AliasManager({ agent }: AliasManagerProps) {\n const tr = useTr();\n // Canonical agent URL hierarchy: agent → profile → plugin → routes.\n // Alias CRUDL is owned by the core `agent` plugin, mounted at\n // `/api/profiles/<profile>/agent/aliases/*`. No client-side rewrites —\n // every consumer constructs the canonical path inline so the URL the\n // agent sees is the URL the FE wrote.\n const profile = encodeURIComponent(agent.profile ?? 'default');\n const aliasesBase = `/api/profiles/${profile}/agent/aliases`;\n const [aliases, setAliases] = useState<Alias[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n // Distinguish \"this agent build doesn't have the alias routes\" from a\n // generic error so we can show a clean empty-state with an actionable\n // hint instead of a scary stack-trace fragment. [BOFF-2613/2616]\n const [routeUnavailable, setRouteUnavailable] = useState(false);\n\n // Add-new form\n const [newName, setNewName] = useState('');\n const [newCommand, setNewCommand] = useState('');\n const [newDescription, setNewDescription] = useState('');\n const [newCwd, setNewCwd] = useState('');\n const [creating, setCreating] = useState(false);\n const [createError, setCreateError] = useState<string | null>(null);\n\n // Edit row\n const [editingName, setEditingName] = useState<string | null>(null);\n const [editCommand, setEditCommand] = useState('');\n const [editDescription, setEditDescription] = useState('');\n const [editCwd, setEditCwd] = useState('');\n const [savingEdit, setSavingEdit] = useState(false);\n\n // Run modal\n const [runTarget, setRunTarget] = useState<Alias | null>(null);\n const [runArgs, setRunArgs] = useState('');\n const [runResult, setRunResult] = useState<AliasExecuteResult | null>(null);\n const [runRunning, setRunRunning] = useState(false);\n const [runError, setRunError] = useState<string | null>(null);\n\n // Delete confirm\n const [deleteTarget, setDeleteTarget] = useState<Alias | null>(null);\n const [deleting, setDeleting] = useState(false);\n\n const refresh = useCallback(async () => {\n setLoading(true);\n setError(null);\n setRouteUnavailable(false);\n try {\n const data = await agentAiGet<AliasListResponse | Alias[]>(agent.id, aliasesBase);\n const items = Array.isArray(data) ? data : (data.aliases ?? data.items ?? []);\n setAliases(items);\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n if (isAliasesRouteUnavailable(msg)) {\n // Alias routes missing on this agent (or upstream context-required\n // error that we treat the same way for this tab) — show empty-state\n // instead of a scary error banner. [BOFF-2613/2616]\n setRouteUnavailable(true);\n } else {\n setError(msg);\n }\n } finally {\n setLoading(false);\n }\n }, [agent.id, aliasesBase]);\n\n useEffect(() => {\n void refresh();\n }, [refresh]);\n\n // ── Create ────────────────────────────────────────────────────────\n const handleCreate = async () => {\n setCreateError(null);\n const nameErr = validateAliasName(newName.trim());\n if (nameErr) {\n setCreateError(nameErr);\n return;\n }\n if (!newCommand.trim()) {\n setCreateError(tr('aliases.commandRequired', 'Command is required'));\n return;\n }\n setCreating(true);\n try {\n await agentAiMutate(agent.id, aliasesBase, 'POST', {\n name: newName.trim(),\n command: newCommand,\n description: newDescription || undefined,\n // Pass the trimmed cwd verbatim — the agent normalizes empty\n // → null and defers `~/...` expansion to execution time so the\n // stored value remains portable across machines.\n cwd: newCwd.trim() || undefined,\n });\n setNewName('');\n setNewCommand('');\n setNewDescription('');\n setNewCwd('');\n await refresh();\n } catch (e) {\n setCreateError(e instanceof Error ? e.message : String(e));\n } finally {\n setCreating(false);\n }\n };\n\n // ── Edit ──────────────────────────────────────────────────────────\n const startEdit = (alias: Alias) => {\n setEditingName(alias.name);\n setEditCommand(alias.command);\n setEditDescription(alias.description ?? '');\n setEditCwd(alias.cwd ?? '');\n };\n\n const cancelEdit = () => {\n setEditingName(null);\n setEditCommand('');\n setEditDescription('');\n setEditCwd('');\n };\n\n const saveEdit = async (alias: Alias) => {\n setSavingEdit(true);\n try {\n // Always send `cwd` (including empty string) so users can reset\n // an alias back to the `$HOME` default by clearing the field.\n // The agent maps \"\" → null at the storage layer.\n await agentAiMutate(agent.id, `${aliasesBase}/${encodeURIComponent(alias.name)}`, 'PUT', {\n command: editCommand,\n description: editDescription || undefined,\n cwd: editCwd.trim(),\n });\n cancelEdit();\n await refresh();\n } catch (e) {\n setError(e instanceof Error ? e.message : String(e));\n } finally {\n setSavingEdit(false);\n }\n };\n\n // ── Delete ────────────────────────────────────────────────────────\n const confirmDelete = async () => {\n if (!deleteTarget) return;\n setDeleting(true);\n try {\n await agentAiMutate(\n agent.id,\n `${aliasesBase}/${encodeURIComponent(deleteTarget.name)}`,\n 'DELETE'\n );\n setDeleteTarget(null);\n await refresh();\n } catch (e) {\n setError(e instanceof Error ? e.message : String(e));\n } finally {\n setDeleting(false);\n }\n };\n\n // ── Run ───────────────────────────────────────────────────────────\n const runAlias = async () => {\n if (!runTarget) return;\n setRunRunning(true);\n setRunError(null);\n setRunResult(null);\n try {\n const args = runArgs.split(/\\s+/).filter(Boolean);\n const result = await agentAiMutate<AliasExecuteResult>(\n agent.id,\n `${aliasesBase}/${encodeURIComponent(runTarget.name)}/execute`,\n 'POST',\n { args }\n );\n setRunResult(result);\n } catch (e) {\n setRunError(e instanceof Error ? e.message : String(e));\n } finally {\n setRunRunning(false);\n }\n };\n\n if (routeUnavailable) {\n // Alias routes not present on this agent build. Show a clean,\n // actionable empty-state instead of the form + the raw error string.\n // [BOFF-2613/2616]\n return (\n <div className=\"rounded-lg border border-border-default bg-bg-surface p-8 text-center space-y-3\">\n <PackageOpen className=\"size-8 mx-auto text-text-muted\" />\n <h3 className=\"text-base font-medium text-text-primary\">\n {tr('aliases.unavailableTitle', 'Aliases not available on this agent')}\n </h3>\n <p className=\"text-sm text-text-secondary max-w-md mx-auto\">\n {tr(\n 'aliases.unavailableBody',\n \"This agent version doesn't support shell aliases. Upgrade the agent to the latest @vibecontrols/agent release to enable per-agent shell aliases.\"\n )}\n </p>\n <button\n type=\"button\"\n onClick={refresh}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-text-secondary border border-border-default rounded-md hover:bg-bg-sunken transition-colors\"\n >\n {tr('aliases.retry', 'Retry')}\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4\">\n {/* Add new alias form */}\n <div className=\"rounded-lg border border-border-default bg-bg-sunken p-4 space-y-3\">\n <h3 className=\"text-sm font-medium text-text-primary flex items-center gap-2\">\n <Plus className=\"size-4\" />\n {tr('aliases.createTitle', 'New alias')}\n </h3>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n <input\n aria-label=\"control\"\n type=\"text\"\n value={newName}\n onChange={(e) => setNewName(e.target.value)}\n placeholder={tr('aliases.namePlaceholder', 'Name (a-z, 0-9, _, -)')}\n className=\"px-3 py-2 text-sm bg-bg-surface border border-border-default rounded-md text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-action-primary-bg font-mono\"\n />\n <input\n aria-label=\"control\"\n type=\"text\"\n value={newDescription}\n onChange={(e) => setNewDescription(e.target.value)}\n placeholder={tr('aliases.descriptionPlaceholder', 'Description (optional)')}\n className=\"px-3 py-2 text-sm bg-bg-surface border border-border-default rounded-md text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-action-primary-bg\"\n />\n </div>\n <input\n aria-label=\"control\"\n type=\"text\"\n value={newCwd}\n onChange={(e) => setNewCwd(e.target.value)}\n placeholder={tr(\n 'aliases.cwdPlaceholder',\n 'Working directory (optional, defaults to ~). Examples: ~/code/myrepo, /tmp, products/microfe'\n )}\n className=\"w-full px-3 py-2 text-sm bg-bg-surface border border-border-default rounded-md text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-action-primary-bg font-mono\"\n />\n <textarea\n aria-label=\"control\"\n value={newCommand}\n onChange={(e) => setNewCommand(e.target.value)}\n placeholder={tr('aliases.commandPlaceholder', 'Command (e.g. git status)')}\n rows={3}\n className=\"w-full px-3 py-2 text-sm bg-bg-surface border border-border-default rounded-md text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-action-primary-bg font-mono\"\n />\n {createError && <div className=\"text-xs text-status-error-text\">{createError}</div>}\n <div className=\"flex justify-end\">\n <button\n type=\"button\"\n onClick={handleCreate}\n disabled={creating || !newName.trim() || !newCommand.trim()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-action-primary-text bg-action-primary-bg rounded-md hover:bg-action-primary-bg-hover transition-colors disabled:opacity-50\"\n >\n {creating ? <Loader2 className=\"size-4 animate-spin\" /> : <Plus className=\"size-4\" />}\n {tr('aliases.create', 'Create')}\n </button>\n </div>\n </div>\n\n {/* List */}\n <div className=\"rounded-lg border border-border-default overflow-hidden\">\n {loading ? (\n <div className=\"p-8 text-center text-text-secondary\">\n <Loader2 className=\"size-5 animate-spin mx-auto\" />\n </div>\n ) : error ? (\n <div className=\"p-4 text-sm text-status-error-text\">{error}</div>\n ) : aliases.length === 0 ? (\n <div className=\"p-8 text-center text-sm text-text-secondary\">\n {tr('aliases.empty', 'No aliases yet. Create one above.')}\n </div>\n ) : (\n <table className=\"w-full text-sm\">\n <thead className=\"bg-bg-sunken text-text-secondary\">\n <tr>\n <th className=\"text-left px-3 py-2 font-medium\">{tr('aliases.colName', 'Name')}</th>\n <th className=\"text-left px-3 py-2 font-medium\">\n {tr('aliases.colCommand', 'Command')}\n </th>\n <th className=\"text-left px-3 py-2 font-medium\">\n {tr('aliases.colDescription', 'Description')}\n </th>\n <th className=\"text-left px-3 py-2 font-medium\">{tr('aliases.colCwd', 'Cwd')}</th>\n <th className=\"text-left px-3 py-2 font-medium\">\n {tr('aliases.colUpdatedAt', 'Updated')}\n </th>\n <th className=\"text-right px-3 py-2 font-medium\">\n {tr('aliases.colActions', 'Actions')}\n </th>\n </tr>\n </thead>\n <tbody>\n {aliases.map((alias) => {\n const isEditing = editingName === alias.name;\n return (\n <tr key={alias.name} className=\"border-t border-border-default\">\n <td className=\"px-3 py-2 font-mono text-text-primary align-top\">\n {alias.name}\n </td>\n <td className=\"px-3 py-2 align-top\">\n {isEditing ? (\n <textarea\n aria-label=\"control\"\n value={editCommand}\n onChange={(e) => setEditCommand(e.target.value)}\n rows={2}\n className=\"w-full px-2 py-1 text-xs bg-bg-surface border border-border-default rounded text-text-primary font-mono\"\n />\n ) : (\n <code className=\"text-xs text-text-primary\" title={alias.command}>\n {truncate(alias.command)}\n </code>\n )}\n </td>\n <td className=\"px-3 py-2 align-top\">\n {isEditing ? (\n <input\n aria-label=\"control\"\n value={editDescription}\n onChange={(e) => setEditDescription(e.target.value)}\n className=\"w-full px-2 py-1 text-xs bg-bg-surface border border-border-default rounded text-text-primary\"\n />\n ) : (\n <span className=\"text-xs text-text-secondary\">\n {alias.description ?? '—'}\n </span>\n )}\n </td>\n <td className=\"px-3 py-2 align-top\">\n {isEditing ? (\n <input\n aria-label=\"~\"\n value={editCwd}\n onChange={(e) => setEditCwd(e.target.value)}\n placeholder=\"~\"\n className=\"w-full px-2 py-1 text-xs bg-bg-surface border border-border-default rounded text-text-primary font-mono\"\n />\n ) : (\n <code\n className=\"text-xs text-text-secondary\"\n // Italicize the default fallback so users can tell\n // at a glance which aliases have an explicit cwd\n // vs. those riding the `$HOME` default.\n title={\n alias.cwd\n ? alias.cwd\n : tr(\n 'aliases.cwdDefaultTitle',\n 'No cwd set — runs in $HOME (the user home directory).'\n )\n }\n >\n {alias.cwd ?? <span className=\"italic text-text-placeholder\">~</span>}\n </code>\n )}\n </td>\n <td className=\"px-3 py-2 text-xs text-text-secondary align-top\">\n {alias.updatedAt ? new Date(alias.updatedAt).toLocaleString() : '—'}\n </td>\n <td className=\"px-3 py-2 align-top\">\n <div className=\"flex items-center justify-end gap-1\">\n {isEditing ? (\n <>\n <button\n type=\"button\"\n onClick={() => void saveEdit(alias)}\n disabled={savingEdit}\n className=\"p-1.5 rounded hover:bg-bg-sunken text-status-success-text\"\n title={tr('aliases.save', 'Save')}\n >\n {savingEdit ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Check className=\"size-4\" />\n )}\n </button>\n <button\n type=\"button\"\n onClick={cancelEdit}\n className=\"p-1.5 rounded hover:bg-bg-sunken text-text-secondary\"\n title={tr('common.cancel', 'Cancel')}\n >\n <X className=\"size-4\" />\n </button>\n </>\n ) : (\n <>\n <button\n type=\"button\"\n onClick={() => {\n setRunTarget(alias);\n setRunArgs('');\n setRunResult(null);\n setRunError(null);\n }}\n className=\"p-1.5 rounded hover:bg-bg-sunken text-action-primary-bg\"\n title={tr('aliases.run', 'Run')}\n >\n <Play className=\"size-4\" />\n </button>\n <button\n type=\"button\"\n onClick={() => startEdit(alias)}\n className=\"p-1.5 rounded hover:bg-bg-sunken text-text-secondary\"\n title={tr('aliases.edit', 'Edit')}\n >\n <Pencil className=\"size-4\" />\n </button>\n <button\n type=\"button\"\n onClick={() => setDeleteTarget(alias)}\n className=\"p-1.5 rounded hover:bg-bg-sunken text-status-error-text\"\n title={tr('aliases.delete', 'Delete')}\n >\n <Trash2 className=\"size-4\" />\n </button>\n </>\n )}\n </div>\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n )}\n </div>\n\n {/* Run modal */}\n {runTarget && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay\">\n <div className=\"w-full max-w-2xl bg-bg-surface rounded-lg shadow-xl max-h-[90vh] flex flex-col\">\n <div className=\"flex items-center justify-between px-6 py-4 border-b border-border-default\">\n <h2 className=\"text-lg font-semibold text-text-primary flex items-center gap-2\">\n <Terminal className=\"size-5\" />\n {tr('aliases.runTitle', 'Run alias')}: <code>{runTarget.name}</code>\n </h2>\n <button\n type=\"button\"\n onClick={() => setRunTarget(null)}\n className=\"p-1 rounded hover:bg-bg-sunken\"\n >\n <X className=\"size-5 text-text-secondary\" />\n </button>\n </div>\n <div className=\"flex-1 overflow-y-auto p-6 space-y-3\">\n <div className=\"text-xs text-text-secondary font-mono break-all\">\n $ {runTarget.command}\n </div>\n <input\n aria-label=\"control\"\n type=\"text\"\n value={runArgs}\n onChange={(e) => setRunArgs(e.target.value)}\n placeholder={tr('aliases.argsPlaceholder', 'Args (space-separated, optional)')}\n className=\"w-full px-3 py-2 text-sm bg-bg-sunken border border-border-default rounded-md text-text-primary font-mono\"\n />\n {runError && <div className=\"text-sm text-status-error-text\">{runError}</div>}\n {runResult && (\n <div className=\"space-y-2\">\n <div className=\"flex flex-wrap gap-x-4 gap-y-1 text-xs text-text-secondary\">\n <span>\n {tr('aliases.exitCode', 'Exit code')}:{' '}\n <span\n className={\n runResult.exit_code === 0\n ? 'text-status-success-text font-mono'\n : 'text-status-error-text font-mono'\n }\n >\n {runResult.exit_code}\n </span>\n </span>\n {runResult.cwd && (\n <span>\n {tr('aliases.runCwd', 'Cwd')}:{' '}\n <code className=\"font-mono text-text-primary\">{runResult.cwd}</code>\n </span>\n )}\n </div>\n {runResult.stdout && (\n <div>\n <div className=\"text-xs text-text-secondary mb-1\">stdout</div>\n <pre className=\"text-xs bg-bg-sunken p-3 rounded font-mono whitespace-pre-wrap break-all max-h-64 overflow-y-auto text-text-primary\">\n {runResult.stdout}\n </pre>\n </div>\n )}\n {runResult.stderr && (\n <div>\n <div className=\"text-xs text-text-secondary mb-1\">stderr</div>\n <pre className=\"text-xs bg-bg-sunken p-3 rounded font-mono whitespace-pre-wrap break-all max-h-64 overflow-y-auto text-status-error-text\">\n {runResult.stderr}\n </pre>\n </div>\n )}\n </div>\n )}\n </div>\n <div className=\"flex items-center justify-end gap-3 px-6 py-4 border-t border-border-default bg-bg-sunken\">\n <button\n type=\"button\"\n onClick={() => setRunTarget(null)}\n className=\"px-4 py-2 text-sm font-medium text-text-primary bg-bg-surface border border-border-default rounded-md hover:bg-bg-elevated\"\n >\n {tr('common.close', 'Close')}\n </button>\n <button\n type=\"button\"\n onClick={() => void runAlias()}\n disabled={runRunning}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-action-primary-text bg-action-primary-bg rounded-md hover:bg-action-primary-bg-hover disabled:opacity-50\"\n >\n {runRunning ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Play className=\"size-4\" />\n )}\n {tr('aliases.run', 'Run')}\n </button>\n </div>\n </div>\n </div>\n )}\n\n {/* Delete confirm */}\n {deleteTarget && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay\">\n <div className=\"w-full max-w-md bg-bg-surface rounded-lg shadow-xl p-6 space-y-4\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {tr('aliases.deleteTitle', 'Delete alias?')}\n </h2>\n <p className=\"text-sm text-text-secondary\">\n {tr('aliases.deleteConfirm', 'This permanently removes the alias from this profile.')}{' '}\n <code className=\"font-mono text-text-primary\">{deleteTarget.name}</code>\n </p>\n <div className=\"flex justify-end gap-3\">\n <button\n type=\"button\"\n onClick={() => setDeleteTarget(null)}\n className=\"px-3 py-1.5 text-sm bg-bg-sunken border border-border-default rounded-md text-text-primary hover:bg-bg-elevated\"\n >\n {tr('common.cancel', 'Cancel')}\n </button>\n <button\n type=\"button\"\n onClick={() => void confirmDelete()}\n disabled={deleting}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-status-error-text bg-status-error-bg rounded-md hover:opacity-80 disabled:opacity-50\"\n >\n {deleting ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Trash2 className=\"size-4\" />\n )}\n {tr('aliases.delete', 'Delete')}\n </button>\n </div>\n </div>\n </div>\n )}\n </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WAAU,uBAAwB,CAAA,GAE3C,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA,EAE5B,EAAG,eAAe,MAAM,CAClB;UACL;;MACF;;IACF,CAAA;GAIP,KACC,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,OAAD;KAAK,WAAU;eAAf;MACE,kBAAC,MAAD;OAAI,WAAU;iBACX,EAAG,uBAAuB,gBAAgB;OACxC,CAAA;MACL,kBAAC,KAAD;OAAG,WAAU;iBAAb;QACG,EAAG,yBAAyB,wDAAwD;QAAE;QACvF,kBAAC,QAAD;SAAM,WAAU;mBAA+B,EAAa;SAAY,CAAA;QACtE;;MACJ,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,UAAD;QACE,MAAK;QACL,eAAe,EAAgB,KAAK;QACpC,WAAU;kBAET,EAAG,iBAAiB,SAAS;QACvB,CAAA,EACT,kBAAC,UAAD;QACE,MAAK;QACL,eAAe,KAAK,IAAe;QACnC,UAAU;QACV,WAAU;kBAJZ,CAMG,IACC,kBAAC,GAAD,EAAS,WAAU,uBAAwB,CAAA,GAE3C,kBAAC,GAAD,EAAQ,WAAU,UAAW,CAAA,EAE9B,EAAG,kBAAkB,SAAS,CACxB;UACL;;MACF;;IACF,CAAA;GAEJ"}
|
|
1
|
+
{"version":3,"file":"AliasManager.js","names":[],"sources":["../../../src/components/aliases/AliasManager.tsx"],"sourcesContent":["/**\n * AliasManager — per-agent CRUDL for shell aliases exposed by\n * vibecontrols-agent under `/api/agent/aliases/*` (mounted by the core\n * `agent` plugin's route module, not a standalone aliases plugin).\n *\n * Endpoints (proxied through wspace-vibecontrols-svc → agent):\n * GET /api/agent/aliases → { aliases: Alias[] }\n * GET /api/agent/aliases/:name → Alias\n * POST /api/agent/aliases → Alias\n * PUT /api/agent/aliases/:name → Alias\n * DELETE /api/agent/aliases/:name\n * POST /api/agent/aliases/:name/execute → { exit_code, stdout, stderr, duration_ms }\n */\n\nimport { useCallback, useEffect, useState } from 'react';\nimport { Plus, Trash2, Play, Pencil, Check, X, Loader2, Terminal, PackageOpen } from 'lucide-react';\nimport { agentAiGet, agentAiMutate } from '@/services/aiApi';\nimport { useTr } from '@/shared/hooks/useTr';\nimport { CommandEditor } from '../common/CommandEditor';\nimport { validateAliasName } from './aliasReservedNames';\n\n// Anchor 404 by surrounding punctuation, not `\\b404\\b` — `\\b` matches\n// `v1.2.404`. Same shape used for `not_found` below so we don't match\n// inside `user_not_found` / `config_not_found` etc.\n// Escape `[` for `u`/`v` Unicode-mode forward-compat.\n// eslint-disable-next-line no-useless-escape -- forward-compat for Unicode regex mode\nconst HTTP_404_PATTERN = /(?:^|[\\s\"'(:\\[])404(?=$|[\\s\"',.):;\\]])/;\n// eslint-disable-next-line no-useless-escape -- forward-compat for Unicode regex mode\nconst NOT_FOUND_TOKEN_PATTERN = /(?:^|[\\s\"'(:\\[])not_found(?=$|[\\s\"',.):;\\]])/;\nfunction isAliasesRouteUnavailable(msg: string): boolean {\n if (!msg) return false;\n const m = msg.toLowerCase();\n if (NOT_FOUND_TOKEN_PATTERN.test(m)) return true;\n if (HTTP_404_PATTERN.test(m)) return true;\n if (m.includes('not installed on the agent')) return true;\n return false;\n}\n\ninterface Alias {\n name: string;\n command: string;\n description?: string | null;\n /**\n * Per-alias working directory. The agent resolves `~/...` against\n * `$HOME` at execution time and falls back to `$HOME` when this is\n * null / undefined. Stored as the user typed it (portable across\n * hosts with different `$HOME`).\n */\n cwd?: string | null;\n updatedAt?: string | null;\n createdAt?: string | null;\n}\n\n// The agent's `GET /api/agent/aliases` returns `{ aliases: Alias[] }`.\n// We also tolerate `{ items: Alias[] }` and a bare array for forward-\n// compat with any future plugin shipment that returns the older shape.\ninterface AliasListResponse {\n aliases?: Alias[];\n items?: Alias[];\n}\n\ninterface AliasExecuteResult {\n exit_code: number;\n stdout: string;\n stderr: string;\n /**\n * Wall-clock milliseconds the child took to exit. Matches the\n * agent's `RunCapturedResult.duration_ms`. Not surfaced in the run\n * modal yet — declared so the type matches the documented response\n * shape and so a future UI can show it without a second TS pass.\n */\n duration_ms?: number;\n /**\n * Absolute path the command actually ran in (post `~`/HOME resolution).\n * Surfaced by the agent so the UI can show the user where the side\n * effects landed — particularly useful when the alias relied on the\n * `$HOME` default.\n */\n cwd?: string;\n}\n\ninterface AliasManagerProps {\n agent: { id: string; profile?: string };\n}\n\nconst TRUNCATE = 80;\n\nfunction truncate(str: string, n = TRUNCATE): string {\n if (!str) return '';\n return str.length > n ? `${str.slice(0, n)}…` : str;\n}\n\nexport function AliasManager({ agent }: AliasManagerProps) {\n const tr = useTr();\n // Canonical agent URL hierarchy: agent → profile → plugin → routes.\n // Alias CRUDL is owned by the core `agent` plugin, mounted at\n // `/api/profiles/<profile>/agent/aliases/*`. No client-side rewrites —\n // every consumer constructs the canonical path inline so the URL the\n // agent sees is the URL the FE wrote.\n const profile = encodeURIComponent(agent.profile ?? 'default');\n const aliasesBase = `/api/profiles/${profile}/agent/aliases`;\n const [aliases, setAliases] = useState<Alias[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n // Distinguish \"this agent build doesn't have the alias routes\" from a\n // generic error so we can show a clean empty-state with an actionable\n // hint instead of a scary stack-trace fragment. [BOFF-2613/2616]\n const [routeUnavailable, setRouteUnavailable] = useState(false);\n\n // Add-new form\n const [newName, setNewName] = useState('');\n const [newCommand, setNewCommand] = useState('');\n const [newDescription, setNewDescription] = useState('');\n const [newCwd, setNewCwd] = useState('');\n const [creating, setCreating] = useState(false);\n const [createError, setCreateError] = useState<string | null>(null);\n\n // Edit row\n const [editingName, setEditingName] = useState<string | null>(null);\n const [editCommand, setEditCommand] = useState('');\n const [editDescription, setEditDescription] = useState('');\n const [editCwd, setEditCwd] = useState('');\n const [savingEdit, setSavingEdit] = useState(false);\n\n // Run modal\n const [runTarget, setRunTarget] = useState<Alias | null>(null);\n const [runArgs, setRunArgs] = useState('');\n const [runResult, setRunResult] = useState<AliasExecuteResult | null>(null);\n const [runRunning, setRunRunning] = useState(false);\n const [runError, setRunError] = useState<string | null>(null);\n\n // Delete confirm\n const [deleteTarget, setDeleteTarget] = useState<Alias | null>(null);\n const [deleting, setDeleting] = useState(false);\n\n const refresh = useCallback(async () => {\n setLoading(true);\n setError(null);\n setRouteUnavailable(false);\n try {\n const data = await agentAiGet<AliasListResponse | Alias[]>(agent.id, aliasesBase);\n const items = Array.isArray(data) ? data : (data.aliases ?? data.items ?? []);\n setAliases(items);\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n if (isAliasesRouteUnavailable(msg)) {\n // Alias routes missing on this agent (or upstream context-required\n // error that we treat the same way for this tab) — show empty-state\n // instead of a scary error banner. [BOFF-2613/2616]\n setRouteUnavailable(true);\n } else {\n setError(msg);\n }\n } finally {\n setLoading(false);\n }\n }, [agent.id, aliasesBase]);\n\n useEffect(() => {\n void refresh();\n }, [refresh]);\n\n // ── Create ────────────────────────────────────────────────────────\n const handleCreate = async () => {\n setCreateError(null);\n const nameErr = validateAliasName(newName.trim());\n if (nameErr) {\n setCreateError(nameErr);\n return;\n }\n if (!newCommand.trim()) {\n setCreateError(tr('aliases.commandRequired', 'Command is required'));\n return;\n }\n setCreating(true);\n try {\n await agentAiMutate(agent.id, aliasesBase, 'POST', {\n name: newName.trim(),\n command: newCommand,\n description: newDescription || undefined,\n // Pass the trimmed cwd verbatim — the agent normalizes empty\n // → null and defers `~/...` expansion to execution time so the\n // stored value remains portable across machines.\n cwd: newCwd.trim() || undefined,\n });\n setNewName('');\n setNewCommand('');\n setNewDescription('');\n setNewCwd('');\n await refresh();\n } catch (e) {\n setCreateError(e instanceof Error ? e.message : String(e));\n } finally {\n setCreating(false);\n }\n };\n\n // ── Edit ──────────────────────────────────────────────────────────\n const startEdit = (alias: Alias) => {\n setEditingName(alias.name);\n setEditCommand(alias.command);\n setEditDescription(alias.description ?? '');\n setEditCwd(alias.cwd ?? '');\n };\n\n const cancelEdit = () => {\n setEditingName(null);\n setEditCommand('');\n setEditDescription('');\n setEditCwd('');\n };\n\n const saveEdit = async (alias: Alias) => {\n setSavingEdit(true);\n try {\n // Always send `cwd` (including empty string) so users can reset\n // an alias back to the `$HOME` default by clearing the field.\n // The agent maps \"\" → null at the storage layer.\n await agentAiMutate(agent.id, `${aliasesBase}/${encodeURIComponent(alias.name)}`, 'PUT', {\n command: editCommand,\n description: editDescription || undefined,\n cwd: editCwd.trim(),\n });\n cancelEdit();\n await refresh();\n } catch (e) {\n setError(e instanceof Error ? e.message : String(e));\n } finally {\n setSavingEdit(false);\n }\n };\n\n // ── Delete ────────────────────────────────────────────────────────\n const confirmDelete = async () => {\n if (!deleteTarget) return;\n setDeleting(true);\n try {\n await agentAiMutate(\n agent.id,\n `${aliasesBase}/${encodeURIComponent(deleteTarget.name)}`,\n 'DELETE'\n );\n setDeleteTarget(null);\n await refresh();\n } catch (e) {\n setError(e instanceof Error ? e.message : String(e));\n } finally {\n setDeleting(false);\n }\n };\n\n // ── Run ───────────────────────────────────────────────────────────\n const runAlias = async () => {\n if (!runTarget) return;\n setRunRunning(true);\n setRunError(null);\n setRunResult(null);\n try {\n const args = runArgs.split(/\\s+/).filter(Boolean);\n const result = await agentAiMutate<AliasExecuteResult>(\n agent.id,\n `${aliasesBase}/${encodeURIComponent(runTarget.name)}/execute`,\n 'POST',\n { args }\n );\n setRunResult(result);\n } catch (e) {\n setRunError(e instanceof Error ? e.message : String(e));\n } finally {\n setRunRunning(false);\n }\n };\n\n if (routeUnavailable) {\n // Alias routes not present on this agent build. Show a clean,\n // actionable empty-state instead of the form + the raw error string.\n // [BOFF-2613/2616]\n return (\n <div className=\"rounded-lg border border-border-default bg-bg-surface p-8 text-center space-y-3\">\n <PackageOpen className=\"size-8 mx-auto text-text-muted\" />\n <h3 className=\"text-base font-medium text-text-primary\">\n {tr('aliases.unavailableTitle', 'Aliases not available on this agent')}\n </h3>\n <p className=\"text-sm text-text-secondary max-w-md mx-auto\">\n {tr(\n 'aliases.unavailableBody',\n \"This agent version doesn't support shell aliases. Upgrade the agent to the latest @vibecontrols/agent release to enable per-agent shell aliases.\"\n )}\n </p>\n <button\n type=\"button\"\n onClick={refresh}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-text-secondary border border-border-default rounded-md hover:bg-bg-sunken transition-colors\"\n >\n {tr('aliases.retry', 'Retry')}\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4\">\n {/* Add new alias form */}\n <div className=\"rounded-lg border border-border-default bg-bg-sunken p-4 space-y-3\">\n <h3 className=\"text-sm font-medium text-text-primary flex items-center gap-2\">\n <Plus className=\"size-4\" />\n {tr('aliases.createTitle', 'New alias')}\n </h3>\n <div className=\"grid grid-cols-1 sm:grid-cols-2 gap-3\">\n <input\n aria-label=\"control\"\n type=\"text\"\n value={newName}\n onChange={(e) => setNewName(e.target.value)}\n placeholder={tr('aliases.namePlaceholder', 'Name (a-z, 0-9, _, -)')}\n className=\"px-3 py-2 text-sm bg-bg-surface border border-border-default rounded-md text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-action-primary-bg font-mono\"\n />\n <input\n aria-label=\"control\"\n type=\"text\"\n value={newDescription}\n onChange={(e) => setNewDescription(e.target.value)}\n placeholder={tr('aliases.descriptionPlaceholder', 'Description (optional)')}\n className=\"px-3 py-2 text-sm bg-bg-surface border border-border-default rounded-md text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-action-primary-bg\"\n />\n </div>\n <input\n aria-label=\"control\"\n type=\"text\"\n value={newCwd}\n onChange={(e) => setNewCwd(e.target.value)}\n placeholder={tr(\n 'aliases.cwdPlaceholder',\n 'Working directory (optional, defaults to ~). Examples: ~/code/myrepo, /tmp, products/microfe'\n )}\n className=\"w-full px-3 py-2 text-sm bg-bg-surface border border-border-default rounded-md text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-action-primary-bg font-mono\"\n />\n <CommandEditor\n aria-label=\"control\"\n language=\"shell\"\n value={newCommand}\n onChange={(e) => setNewCommand(e.target.value)}\n placeholder={tr('aliases.commandPlaceholder', 'Command (e.g. git status)')}\n rows={3}\n />\n {createError && <div className=\"text-xs text-status-error-text\">{createError}</div>}\n <div className=\"flex justify-end\">\n <button\n type=\"button\"\n onClick={handleCreate}\n disabled={creating || !newName.trim() || !newCommand.trim()}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-action-primary-text bg-action-primary-bg rounded-md hover:bg-action-primary-bg-hover transition-colors disabled:opacity-50\"\n >\n {creating ? <Loader2 className=\"size-4 animate-spin\" /> : <Plus className=\"size-4\" />}\n {tr('aliases.create', 'Create')}\n </button>\n </div>\n </div>\n\n {/* List */}\n <div className=\"rounded-lg border border-border-default overflow-hidden\">\n {loading ? (\n <div className=\"p-8 text-center text-text-secondary\">\n <Loader2 className=\"size-5 animate-spin mx-auto\" />\n </div>\n ) : error ? (\n <div className=\"p-4 text-sm text-status-error-text\">{error}</div>\n ) : aliases.length === 0 ? (\n <div className=\"p-8 text-center text-sm text-text-secondary\">\n {tr('aliases.empty', 'No aliases yet. Create one above.')}\n </div>\n ) : (\n <table className=\"w-full text-sm\">\n <thead className=\"bg-bg-sunken text-text-secondary\">\n <tr>\n <th className=\"text-left px-3 py-2 font-medium\">{tr('aliases.colName', 'Name')}</th>\n <th className=\"text-left px-3 py-2 font-medium\">\n {tr('aliases.colCommand', 'Command')}\n </th>\n <th className=\"text-left px-3 py-2 font-medium\">\n {tr('aliases.colDescription', 'Description')}\n </th>\n <th className=\"text-left px-3 py-2 font-medium\">{tr('aliases.colCwd', 'Cwd')}</th>\n <th className=\"text-left px-3 py-2 font-medium\">\n {tr('aliases.colUpdatedAt', 'Updated')}\n </th>\n <th className=\"text-right px-3 py-2 font-medium\">\n {tr('aliases.colActions', 'Actions')}\n </th>\n </tr>\n </thead>\n <tbody>\n {aliases.map((alias) => {\n const isEditing = editingName === alias.name;\n return (\n <tr key={alias.name} className=\"border-t border-border-default\">\n <td className=\"px-3 py-2 font-mono text-text-primary align-top\">\n {alias.name}\n </td>\n <td className=\"px-3 py-2 align-top\">\n {isEditing ? (\n <CommandEditor\n aria-label=\"control\"\n language=\"shell\"\n value={editCommand}\n onChange={(e) => setEditCommand(e.target.value)}\n rows={2}\n />\n ) : (\n <code className=\"text-xs text-text-primary\" title={alias.command}>\n {truncate(alias.command)}\n </code>\n )}\n </td>\n <td className=\"px-3 py-2 align-top\">\n {isEditing ? (\n <input\n aria-label=\"control\"\n value={editDescription}\n onChange={(e) => setEditDescription(e.target.value)}\n className=\"w-full px-2 py-1 text-xs bg-bg-surface border border-border-default rounded text-text-primary\"\n />\n ) : (\n <span className=\"text-xs text-text-secondary\">\n {alias.description ?? '—'}\n </span>\n )}\n </td>\n <td className=\"px-3 py-2 align-top\">\n {isEditing ? (\n <input\n aria-label=\"~\"\n value={editCwd}\n onChange={(e) => setEditCwd(e.target.value)}\n placeholder=\"~\"\n className=\"w-full px-2 py-1 text-xs bg-bg-surface border border-border-default rounded text-text-primary font-mono\"\n />\n ) : (\n <code\n className=\"text-xs text-text-secondary\"\n // Italicize the default fallback so users can tell\n // at a glance which aliases have an explicit cwd\n // vs. those riding the `$HOME` default.\n title={\n alias.cwd\n ? alias.cwd\n : tr(\n 'aliases.cwdDefaultTitle',\n 'No cwd set — runs in $HOME (the user home directory).'\n )\n }\n >\n {alias.cwd ?? <span className=\"italic text-text-placeholder\">~</span>}\n </code>\n )}\n </td>\n <td className=\"px-3 py-2 text-xs text-text-secondary align-top\">\n {alias.updatedAt ? new Date(alias.updatedAt).toLocaleString() : '—'}\n </td>\n <td className=\"px-3 py-2 align-top\">\n <div className=\"flex items-center justify-end gap-1\">\n {isEditing ? (\n <>\n <button\n type=\"button\"\n onClick={() => void saveEdit(alias)}\n disabled={savingEdit}\n className=\"p-1.5 rounded hover:bg-bg-sunken text-status-success-text\"\n title={tr('aliases.save', 'Save')}\n >\n {savingEdit ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Check className=\"size-4\" />\n )}\n </button>\n <button\n type=\"button\"\n onClick={cancelEdit}\n className=\"p-1.5 rounded hover:bg-bg-sunken text-text-secondary\"\n title={tr('common.cancel', 'Cancel')}\n >\n <X className=\"size-4\" />\n </button>\n </>\n ) : (\n <>\n <button\n type=\"button\"\n onClick={() => {\n setRunTarget(alias);\n setRunArgs('');\n setRunResult(null);\n setRunError(null);\n }}\n className=\"p-1.5 rounded hover:bg-bg-sunken text-action-primary-bg\"\n title={tr('aliases.run', 'Run')}\n >\n <Play className=\"size-4\" />\n </button>\n <button\n type=\"button\"\n onClick={() => startEdit(alias)}\n className=\"p-1.5 rounded hover:bg-bg-sunken text-text-secondary\"\n title={tr('aliases.edit', 'Edit')}\n >\n <Pencil className=\"size-4\" />\n </button>\n <button\n type=\"button\"\n onClick={() => setDeleteTarget(alias)}\n className=\"p-1.5 rounded hover:bg-bg-sunken text-status-error-text\"\n title={tr('aliases.delete', 'Delete')}\n >\n <Trash2 className=\"size-4\" />\n </button>\n </>\n )}\n </div>\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n )}\n </div>\n\n {/* Run modal */}\n {runTarget && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay\">\n <div className=\"w-full max-w-2xl bg-bg-surface rounded-lg shadow-xl max-h-[90vh] flex flex-col\">\n <div className=\"flex items-center justify-between px-6 py-4 border-b border-border-default\">\n <h2 className=\"text-lg font-semibold text-text-primary flex items-center gap-2\">\n <Terminal className=\"size-5\" />\n {tr('aliases.runTitle', 'Run alias')}: <code>{runTarget.name}</code>\n </h2>\n <button\n type=\"button\"\n onClick={() => setRunTarget(null)}\n className=\"p-1 rounded hover:bg-bg-sunken\"\n >\n <X className=\"size-5 text-text-secondary\" />\n </button>\n </div>\n <div className=\"flex-1 overflow-y-auto p-6 space-y-3\">\n <div className=\"text-xs text-text-secondary font-mono break-all\">\n $ {runTarget.command}\n </div>\n <input\n aria-label=\"control\"\n type=\"text\"\n value={runArgs}\n onChange={(e) => setRunArgs(e.target.value)}\n placeholder={tr('aliases.argsPlaceholder', 'Args (space-separated, optional)')}\n className=\"w-full px-3 py-2 text-sm bg-bg-sunken border border-border-default rounded-md text-text-primary font-mono\"\n />\n {runError && <div className=\"text-sm text-status-error-text\">{runError}</div>}\n {runResult && (\n <div className=\"space-y-2\">\n <div className=\"flex flex-wrap gap-x-4 gap-y-1 text-xs text-text-secondary\">\n <span>\n {tr('aliases.exitCode', 'Exit code')}:{' '}\n <span\n className={\n runResult.exit_code === 0\n ? 'text-status-success-text font-mono'\n : 'text-status-error-text font-mono'\n }\n >\n {runResult.exit_code}\n </span>\n </span>\n {runResult.cwd && (\n <span>\n {tr('aliases.runCwd', 'Cwd')}:{' '}\n <code className=\"font-mono text-text-primary\">{runResult.cwd}</code>\n </span>\n )}\n </div>\n {runResult.stdout && (\n <div>\n <div className=\"text-xs text-text-secondary mb-1\">stdout</div>\n <pre className=\"text-xs bg-bg-sunken p-3 rounded font-mono whitespace-pre-wrap break-all max-h-64 overflow-y-auto text-text-primary\">\n {runResult.stdout}\n </pre>\n </div>\n )}\n {runResult.stderr && (\n <div>\n <div className=\"text-xs text-text-secondary mb-1\">stderr</div>\n <pre className=\"text-xs bg-bg-sunken p-3 rounded font-mono whitespace-pre-wrap break-all max-h-64 overflow-y-auto text-status-error-text\">\n {runResult.stderr}\n </pre>\n </div>\n )}\n </div>\n )}\n </div>\n <div className=\"flex items-center justify-end gap-3 px-6 py-4 border-t border-border-default bg-bg-sunken\">\n <button\n type=\"button\"\n onClick={() => setRunTarget(null)}\n className=\"px-4 py-2 text-sm font-medium text-text-primary bg-bg-surface border border-border-default rounded-md hover:bg-bg-elevated\"\n >\n {tr('common.close', 'Close')}\n </button>\n <button\n type=\"button\"\n onClick={() => void runAlias()}\n disabled={runRunning}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-action-primary-text bg-action-primary-bg rounded-md hover:bg-action-primary-bg-hover disabled:opacity-50\"\n >\n {runRunning ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Play className=\"size-4\" />\n )}\n {tr('aliases.run', 'Run')}\n </button>\n </div>\n </div>\n </div>\n )}\n\n {/* Delete confirm */}\n {deleteTarget && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay\">\n <div className=\"w-full max-w-md bg-bg-surface rounded-lg shadow-xl p-6 space-y-4\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {tr('aliases.deleteTitle', 'Delete alias?')}\n </h2>\n <p className=\"text-sm text-text-secondary\">\n {tr('aliases.deleteConfirm', 'This permanently removes the alias from this profile.')}{' '}\n <code className=\"font-mono text-text-primary\">{deleteTarget.name}</code>\n </p>\n <div className=\"flex justify-end gap-3\">\n <button\n type=\"button\"\n onClick={() => setDeleteTarget(null)}\n className=\"px-3 py-1.5 text-sm bg-bg-sunken border border-border-default rounded-md text-text-primary hover:bg-bg-elevated\"\n >\n {tr('common.cancel', 'Cancel')}\n </button>\n <button\n type=\"button\"\n onClick={() => void confirmDelete()}\n disabled={deleting}\n className=\"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium text-status-error-text bg-status-error-bg rounded-md hover:opacity-80 disabled:opacity-50\"\n >\n {deleting ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Trash2 className=\"size-4\" />\n )}\n {tr('aliases.delete', 'Delete')}\n </button>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AA0BA,IAAM,IAAmB,0CAEnB,IAA0B;AAChC,SAAS,GAA0B,GAAsB;AACvD,KAAI,CAAC,EAAK,QAAO;CACjB,IAAM,IAAI,EAAI,aAAa;AAI3B,QADA,GAFI,EAAwB,KAAK,EAAE,IAC/B,EAAiB,KAAK,EAAE,IACxB,EAAE,SAAS,6BAA6B;;AAmD9C,IAAM,IAAW;AAEjB,SAAS,GAAS,GAAa,IAAI,GAAkB;AAEnD,QADK,IACE,EAAI,SAAS,IAAI,GAAG,EAAI,MAAM,GAAG,EAAE,CAAC,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EAAa;SAAY,CAAA;QACtE;;MACJ,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,UAAD;QACE,MAAK;QACL,eAAe,EAAgB,KAAK;QACpC,WAAU;kBAET,EAAG,iBAAiB,SAAS;QACvB,CAAA,EACT,kBAAC,UAAD;QACE,MAAK;QACL,eAAe,KAAK,IAAe;QACnC,UAAU;QACV,WAAU;kBAJZ,CAMG,KACC,kBAAC,GAAD,EAAS,WAAU,uBAAwB,CAAA,GAE3C,kBAAC,GAAD,EAAQ,WAAU,UAAW,CAAA,EAE9B,EAAG,kBAAkB,SAAS,CACxB;UACL;;MACF;;IACF,CAAA;GAEJ"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { useListAgentsQuery as e, useVibecontrolsAgentHealthProbesQuery as t } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { useTr as n } from "../../shared/hooks/useTr.js";
|
|
3
|
+
import { AgentStatusBadge as r } from "../agents/AgentStatusBadge.js";
|
|
4
|
+
import { resolveAgentTarget as i } from "./actionAgentTarget.js";
|
|
5
|
+
import { useMemo as a } from "react";
|
|
6
|
+
import { AlertTriangle as o, ArrowUpRight as s, ServerCog as c } from "lucide-react";
|
|
7
|
+
import { useNavigate as l } from "react-router-dom";
|
|
8
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/common/ActionAgentTargetNotice.tsx
|
|
10
|
+
var p = {
|
|
11
|
+
info: "border-status-info-border bg-status-info-bg text-status-info-text",
|
|
12
|
+
success: "border-status-success-border bg-status-success-bg text-status-success-text",
|
|
13
|
+
warning: "border-status-warning-border bg-status-warning-bg text-status-warning-text",
|
|
14
|
+
error: "border-status-error-border bg-status-error-bg text-status-error-text"
|
|
15
|
+
};
|
|
16
|
+
function m({ action: m, className: h = "" }) {
|
|
17
|
+
let g = n(), _ = l(), v = m.actionType === "COMMAND" || m.actionType === "SCRIPT", { data: y } = e({
|
|
18
|
+
variables: { pagination: { limit: 200 } },
|
|
19
|
+
fetchPolicy: "cache-and-network",
|
|
20
|
+
skip: !v
|
|
21
|
+
}), b = t({
|
|
22
|
+
fetchPolicy: "cache-and-network",
|
|
23
|
+
nextFetchPolicy: "cache-first",
|
|
24
|
+
pollInterval: 6e4,
|
|
25
|
+
skip: !v
|
|
26
|
+
}), x = b.data === void 0, S = a(() => (y?.vibecontrolsAgents ?? []).map((e) => ({
|
|
27
|
+
id: e.id,
|
|
28
|
+
name: e.name,
|
|
29
|
+
isActive: e.isActive,
|
|
30
|
+
platform: e.platform ?? null,
|
|
31
|
+
metadata: e.metadata ?? null
|
|
32
|
+
})), [y]), C = a(() => {
|
|
33
|
+
let e = /* @__PURE__ */ new Map();
|
|
34
|
+
for (let t of b.data?.vibecontrolsAgentHealthProbes ?? []) e.set(t.agentId, {
|
|
35
|
+
agentId: t.agentId,
|
|
36
|
+
healthy: t.healthy,
|
|
37
|
+
errorMessage: t.errorMessage
|
|
38
|
+
});
|
|
39
|
+
return e;
|
|
40
|
+
}, [b.data]), w = a(() => i(m, S, C, x), [
|
|
41
|
+
m,
|
|
42
|
+
S,
|
|
43
|
+
C,
|
|
44
|
+
x
|
|
45
|
+
]), T = () => _("/vibecontrols/agents"), E = (e) => _(`/vibecontrols/agents/${encodeURIComponent(e)}`), D = () => _(`/vibecontrols/actions?editAction=${encodeURIComponent(m.id)}`);
|
|
46
|
+
if (w.mode === "no-agent") return m.actionType === "WEBHOOK" ? /* @__PURE__ */ f("div", {
|
|
47
|
+
className: `flex items-center gap-2 rounded-lg border border-border-default bg-bg-secondary px-3 py-2 text-xs text-text-tertiary ${h}`,
|
|
48
|
+
children: [/* @__PURE__ */ d(c, {
|
|
49
|
+
size: 14,
|
|
50
|
+
className: "flex-shrink-0"
|
|
51
|
+
}), /* @__PURE__ */ d("span", { children: g("vibecontrols.actions.agentTarget.webhook", "Runs as a webhook request — no agent needed.") })]
|
|
52
|
+
}) : null;
|
|
53
|
+
let O = ({ label: e, onClick: t }) => /* @__PURE__ */ f("button", {
|
|
54
|
+
type: "button",
|
|
55
|
+
onClick: t,
|
|
56
|
+
className: "inline-flex items-center gap-0.5 font-medium underline-offset-2 hover:underline",
|
|
57
|
+
children: [e, /* @__PURE__ */ d(s, { size: 12 })]
|
|
58
|
+
}), k = "info", A = /* @__PURE__ */ d(c, {
|
|
59
|
+
size: 14,
|
|
60
|
+
className: "mt-0.5 flex-shrink-0"
|
|
61
|
+
}), j = "", M = null, N = null;
|
|
62
|
+
if (w.mode === "any-available") w.noHealthyAgent ? (k = "warning", A = /* @__PURE__ */ d(o, {
|
|
63
|
+
size: 14,
|
|
64
|
+
className: "mt-0.5 flex-shrink-0"
|
|
65
|
+
}), j = g("vibecontrols.actions.agentTarget.anyTitle", "Runs on: any available agent"), M = g("vibecontrols.actions.agentTarget.anyNone", "No healthy agent is available right now, so this action will fail until you add or start one."), N = /* @__PURE__ */ d(O, {
|
|
66
|
+
label: g("vibecontrols.actions.agentTarget.manageAgents", "Manage agents"),
|
|
67
|
+
onClick: T
|
|
68
|
+
})) : (k = "info", j = g("vibecontrols.actions.agentTarget.anyTitle", "Runs on: any available agent"), M = x ? g("vibecontrols.actions.agentTarget.anyChecking", "Checking agent availability…") : g("vibecontrols.actions.agentTarget.anyOk", "A healthy agent is picked automatically when this runs.") + (w.healthyCount > 0 ? ` (${w.healthyCount} available)` : ""));
|
|
69
|
+
else if (w.missing) k = "error", A = /* @__PURE__ */ d(o, {
|
|
70
|
+
size: 14,
|
|
71
|
+
className: "mt-0.5 flex-shrink-0"
|
|
72
|
+
}), j = g("vibecontrols.actions.agentTarget.missingTitle", "The agent set for this action no longer exists"), M = g("vibecontrols.actions.agentTarget.missingBody", "Update the action to choose an available agent, otherwise it will fail when it runs."), N = /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(O, {
|
|
73
|
+
label: g("vibecontrols.actions.agentTarget.setAgent", "Set agent"),
|
|
74
|
+
onClick: D
|
|
75
|
+
}), /* @__PURE__ */ d(O, {
|
|
76
|
+
label: g("vibecontrols.actions.agentTarget.manageAgents", "Manage agents"),
|
|
77
|
+
onClick: T
|
|
78
|
+
})] });
|
|
79
|
+
else if (w.agent) {
|
|
80
|
+
let e = w.healthy;
|
|
81
|
+
k = e ? "success" : "warning", A = d(e ? c : o, {
|
|
82
|
+
size: 14,
|
|
83
|
+
className: "mt-0.5 flex-shrink-0"
|
|
84
|
+
}), j = `${g("vibecontrols.actions.agentTarget.runsOn", "Runs on")}: ${w.agent.name}`, M = e ? null : g("vibecontrols.actions.agentTarget.unhealthyBody", "This agent isn't healthy, so the action may fail. Pick a different agent or fix this one before linking."), N = e ? null : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(O, {
|
|
85
|
+
label: g("vibecontrols.actions.agentTarget.setAgent", "Set agent"),
|
|
86
|
+
onClick: D
|
|
87
|
+
}), /* @__PURE__ */ d(O, {
|
|
88
|
+
label: g("vibecontrols.actions.agentTarget.viewAgent", "View agent"),
|
|
89
|
+
onClick: () => w.agent && E(w.agent.id)
|
|
90
|
+
})] });
|
|
91
|
+
}
|
|
92
|
+
return /* @__PURE__ */ d("div", {
|
|
93
|
+
className: `rounded-lg border px-3 py-2 text-xs ${p[k]} ${h}`,
|
|
94
|
+
children: /* @__PURE__ */ f("div", {
|
|
95
|
+
className: "flex items-start gap-2",
|
|
96
|
+
children: [A, /* @__PURE__ */ f("div", {
|
|
97
|
+
className: "min-w-0 flex-1 space-y-1",
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ f("div", {
|
|
100
|
+
className: "flex flex-wrap items-center gap-2",
|
|
101
|
+
children: [/* @__PURE__ */ d("span", {
|
|
102
|
+
className: "font-medium",
|
|
103
|
+
children: j
|
|
104
|
+
}), w.mode === "specific" && w.agent && w.status && /* @__PURE__ */ d(r, {
|
|
105
|
+
status: w.status,
|
|
106
|
+
reason: w.reason
|
|
107
|
+
})]
|
|
108
|
+
}),
|
|
109
|
+
M && /* @__PURE__ */ d("p", {
|
|
110
|
+
className: "opacity-90",
|
|
111
|
+
children: M
|
|
112
|
+
}),
|
|
113
|
+
N && /* @__PURE__ */ d("div", {
|
|
114
|
+
className: "flex flex-wrap items-center gap-3 pt-0.5",
|
|
115
|
+
children: N
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
})]
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
export { m as ActionAgentTargetNotice };
|
|
124
|
+
|
|
125
|
+
//# sourceMappingURL=ActionAgentTargetNotice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionAgentTargetNotice.js","names":[],"sources":["../../../src/components/common/ActionAgentTargetNotice.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { AlertTriangle, ArrowUpRight, ServerCog } from 'lucide-react';\n\nimport {\n useListAgentsQuery,\n useVibecontrolsAgentHealthProbesQuery,\n} from '@/generated/wspace-operations';\nimport type { AgentHealthProbe } from '@/utils/agentStatus';\nimport { useTr } from '../../shared/hooks/useTr';\nimport { AgentStatusBadge } from '../agents/AgentStatusBadge';\nimport {\n resolveAgentTarget,\n type AgentTargetActionLike,\n type AgentTargetAgentLike,\n} from './actionAgentTarget';\n\ninterface ActionAgentTargetNoticeProps {\n /** The action being linked. Needs id + type + agent targeting fields. */\n action: AgentTargetActionLike & { id: string };\n className?: string;\n}\n\ntype Tone = 'info' | 'success' | 'warning' | 'error';\n\nconst TONE_CLASS: Record<Tone, string> = {\n info: 'border-status-info-border bg-status-info-bg text-status-info-text',\n success: 'border-status-success-border bg-status-success-bg text-status-success-text',\n warning: 'border-status-warning-border bg-status-warning-bg text-status-warning-text',\n error: 'border-status-error-border bg-status-error-bg text-status-error-text',\n};\n\n/**\n * Shown when an action is being linked to another surface (vibe-deck button,\n * scheduler, …). It tells the user which agent the action will run on and, when\n * that agent is unhealthy or no longer exists, warns them right in the linking\n * flow and links to the page where they can set the right agent.\n */\nexport function ActionAgentTargetNotice({ action, className = '' }: ActionAgentTargetNoticeProps) {\n const tr = useTr();\n const navigate = useNavigate();\n\n // Only COMMAND/SCRIPT actions run on an agent — skip the agent + health-probe\n // fetches entirely for webhook/workflow actions where the result is unused.\n const needsAgent = action.actionType === 'COMMAND' || action.actionType === 'SCRIPT';\n const { data: agentsData } = useListAgentsQuery({\n variables: { pagination: { limit: 200 } },\n fetchPolicy: 'cache-and-network',\n skip: !needsAgent,\n });\n const probeQuery = useVibecontrolsAgentHealthProbesQuery({\n fetchPolicy: 'cache-and-network',\n nextFetchPolicy: 'cache-first',\n pollInterval: 60_000,\n skip: !needsAgent,\n });\n const probesLoading = probeQuery.data === undefined;\n\n const agents = useMemo<AgentTargetAgentLike[]>(() => {\n const raw = agentsData?.vibecontrolsAgents ?? [];\n return raw.map((a: NonNullable<typeof raw>[number]) => ({\n id: a.id,\n name: a.name,\n isActive: a.isActive,\n platform: a.platform ?? null,\n metadata: (a.metadata as Record<string, unknown> | null) ?? null,\n }));\n }, [agentsData]);\n\n const probesById = useMemo(() => {\n const m = new Map<string, AgentHealthProbe>();\n for (const p of probeQuery.data?.vibecontrolsAgentHealthProbes ?? []) {\n m.set(p.agentId, { agentId: p.agentId, healthy: p.healthy, errorMessage: p.errorMessage });\n }\n return m;\n }, [probeQuery.data]);\n\n const res = useMemo(\n () => resolveAgentTarget(action, agents, probesById, probesLoading),\n [action, agents, probesById, probesLoading]\n );\n\n const goAgents = () => navigate('/vibecontrols/agents');\n const goAgent = (id: string) => navigate(`/vibecontrols/agents/${encodeURIComponent(id)}`);\n const goEditAction = () =>\n navigate(`/vibecontrols/actions?editAction=${encodeURIComponent(action.id)}`);\n\n // Webhook / workflow actions don't run on an agent.\n if (res.mode === 'no-agent') {\n if (action.actionType === 'WEBHOOK') {\n return (\n <div\n className={`flex items-center gap-2 rounded-lg border border-border-default bg-bg-secondary px-3 py-2 text-xs text-text-tertiary ${className}`}\n >\n <ServerCog size={14} className=\"flex-shrink-0\" />\n <span>\n {tr(\n 'vibecontrols.actions.agentTarget.webhook',\n 'Runs as a webhook request — no agent needed.'\n )}\n </span>\n </div>\n );\n }\n return null;\n }\n\n const LinkButton = ({ label, onClick }: { label: string; onClick: () => void }) => (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"inline-flex items-center gap-0.5 font-medium underline-offset-2 hover:underline\"\n >\n {label}\n <ArrowUpRight size={12} />\n </button>\n );\n\n let tone: Tone = 'info';\n let icon = <ServerCog size={14} className=\"mt-0.5 flex-shrink-0\" />;\n let title = '';\n let body: React.ReactNode = null;\n let links: React.ReactNode = null;\n\n if (res.mode === 'any-available') {\n if (res.noHealthyAgent) {\n tone = 'warning';\n icon = <AlertTriangle size={14} className=\"mt-0.5 flex-shrink-0\" />;\n title = tr('vibecontrols.actions.agentTarget.anyTitle', 'Runs on: any available agent');\n body = tr(\n 'vibecontrols.actions.agentTarget.anyNone',\n 'No healthy agent is available right now, so this action will fail until you add or start one.'\n );\n links = (\n <LinkButton\n label={tr('vibecontrols.actions.agentTarget.manageAgents', 'Manage agents')}\n onClick={goAgents}\n />\n );\n } else {\n tone = 'info';\n title = tr('vibecontrols.actions.agentTarget.anyTitle', 'Runs on: any available agent');\n body = probesLoading\n ? tr('vibecontrols.actions.agentTarget.anyChecking', 'Checking agent availability…')\n : tr(\n 'vibecontrols.actions.agentTarget.anyOk',\n 'A healthy agent is picked automatically when this runs.'\n ) + (res.healthyCount > 0 ? ` (${res.healthyCount} available)` : '');\n }\n } else if (res.missing) {\n tone = 'error';\n icon = <AlertTriangle size={14} className=\"mt-0.5 flex-shrink-0\" />;\n title = tr(\n 'vibecontrols.actions.agentTarget.missingTitle',\n 'The agent set for this action no longer exists'\n );\n body = tr(\n 'vibecontrols.actions.agentTarget.missingBody',\n 'Update the action to choose an available agent, otherwise it will fail when it runs.'\n );\n links = (\n <>\n <LinkButton\n label={tr('vibecontrols.actions.agentTarget.setAgent', 'Set agent')}\n onClick={goEditAction}\n />\n <LinkButton\n label={tr('vibecontrols.actions.agentTarget.manageAgents', 'Manage agents')}\n onClick={goAgents}\n />\n </>\n );\n } else if (res.agent) {\n const healthy = res.healthy;\n tone = healthy ? 'success' : 'warning';\n icon = healthy ? (\n <ServerCog size={14} className=\"mt-0.5 flex-shrink-0\" />\n ) : (\n <AlertTriangle size={14} className=\"mt-0.5 flex-shrink-0\" />\n );\n title = `${tr('vibecontrols.actions.agentTarget.runsOn', 'Runs on')}: ${res.agent.name}`;\n body = healthy\n ? null\n : tr(\n 'vibecontrols.actions.agentTarget.unhealthyBody',\n \"This agent isn't healthy, so the action may fail. Pick a different agent or fix this one before linking.\"\n );\n links = healthy ? null : (\n <>\n <LinkButton\n label={tr('vibecontrols.actions.agentTarget.setAgent', 'Set agent')}\n onClick={goEditAction}\n />\n <LinkButton\n label={tr('vibecontrols.actions.agentTarget.viewAgent', 'View agent')}\n onClick={() => res.agent && goAgent(res.agent.id)}\n />\n </>\n );\n }\n\n return (\n <div className={`rounded-lg border px-3 py-2 text-xs ${TONE_CLASS[tone]} ${className}`}>\n <div className=\"flex items-start gap-2\">\n {icon}\n <div className=\"min-w-0 flex-1 space-y-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"font-medium\">{title}</span>\n {res.mode === 'specific' && res.agent && res.status && (\n <AgentStatusBadge status={res.status} reason={res.reason} />\n )}\n </div>\n {body && <p className=\"opacity-90\">{body}</p>}\n {links && <div className=\"flex flex-wrap items-center gap-3 pt-0.5\">{links}</div>}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAyBA,IAAM,IAAmC;CACvC,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;CACR;AAQD,SAAgB,EAAwB,EAAE,WAAQ,eAAY,MAAoC;CAChG,IAAM,IAAK,GAAO,EACZ,IAAW,GAAa,EAIxB,IAAa,EAAO,eAAe,aAAa,EAAO,eAAe,UACtE,EAAE,MAAM,MAAe,EAAmB;EAC9C,WAAW,EAAE,YAAY,EAAE,OAA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AAD;GACE,OAAO,EAAG,8CAA8C,aAAa;GACrE,eAAe,EAAI,SAAS,EAAQ,EAAI,MAAM,GAAG;GACjD,CAAA,CACD,EAAA,CAAA;;AAIP,QACE,kBAAC,OAAD;EAAK,WAAW,uCAAuC,EAAW,GAAM,GAAG;YACzE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACG,GACD,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,QAAD;OAAM,WAAU;iBAAe;OAAa,CAAA,EAC3C,EAAI,SAAS,cAAc,EAAI,SAAS,EAAI,UAC3C,kBAAC,GAAD;OAAkB,QAAQ,EAAI;OAAQ,QAAQ,EAAI;OAAU,CAAA,CAE1D;;KACL,KAAQ,kBAAC,KAAD;MAAG,WAAU;gBAAc;MAAS,CAAA;KAC5C,KAAS,kBAAC,OAAD;MAAK,WAAU;gBAA4C;MAAY,CAAA;KAC7E;MACF;;EACF,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { tokenize as e } from "./commandHighlight.js";
|
|
2
|
+
import { forwardRef as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
3
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/common/CommandEditor.tsx
|
|
5
|
+
var s = t(function({ value: t, defaultValue: s, onChange: c, language: l = "shell", className: u = "", rows: d = 3, style: f, spellCheck: p = !1, ...m }, h) {
|
|
6
|
+
let g = t !== void 0, [_, v] = i(s ?? ""), y = g ? t ?? "" : _, b = r(null), x = r(null), S = (e) => {
|
|
7
|
+
x.current = e, typeof h == "function" ? h(e) : h && (h.current = e);
|
|
8
|
+
}, C = n(() => e(y, l), [y, l]), w = (e) => {
|
|
9
|
+
g || v(e.target.value), c?.(e);
|
|
10
|
+
}, T = (e) => {
|
|
11
|
+
let t = b.current;
|
|
12
|
+
t && (t.scrollTop = e.currentTarget.scrollTop, t.scrollLeft = e.currentTarget.scrollLeft);
|
|
13
|
+
}, E = "m-0 w-full px-3 py-2 font-mono text-sm leading-relaxed whitespace-pre-wrap break-words", D = {
|
|
14
|
+
tabSize: 2,
|
|
15
|
+
scrollbarGutter: "stable"
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ o("div", {
|
|
18
|
+
className: `relative overflow-hidden rounded-md border border-border-default bg-bg-sunken transition-all focus-within:border-transparent focus-within:ring-2 focus-within:ring-action-primary-bg ${u}`,
|
|
19
|
+
children: [/* @__PURE__ */ a("pre", {
|
|
20
|
+
ref: b,
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
className: `${E} pointer-events-none absolute inset-0 overflow-hidden text-text-primary`,
|
|
23
|
+
style: D,
|
|
24
|
+
children: /* @__PURE__ */ a("code", { children: C.map((e, t) => e.className ? /* @__PURE__ */ a("span", {
|
|
25
|
+
className: e.className,
|
|
26
|
+
children: e.value
|
|
27
|
+
}, t) : /* @__PURE__ */ a("span", { children: e.value }, t)) })
|
|
28
|
+
}), /* @__PURE__ */ a("textarea", {
|
|
29
|
+
...m,
|
|
30
|
+
ref: S,
|
|
31
|
+
rows: d,
|
|
32
|
+
spellCheck: p,
|
|
33
|
+
value: g ? y : void 0,
|
|
34
|
+
defaultValue: g ? void 0 : s,
|
|
35
|
+
onChange: w,
|
|
36
|
+
onScroll: T,
|
|
37
|
+
className: `${E} relative block resize-none overflow-auto bg-transparent text-transparent placeholder:text-text-placeholder focus:outline-none`,
|
|
38
|
+
style: {
|
|
39
|
+
...D,
|
|
40
|
+
caretColor: "var(--color-text-primary)",
|
|
41
|
+
...f
|
|
42
|
+
}
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { s as CommandEditor };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=CommandEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandEditor.js","names":[],"sources":["../../../src/components/common/CommandEditor.tsx"],"sourcesContent":["import {\n forwardRef,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type MutableRefObject,\n type TextareaHTMLAttributes,\n type UIEvent,\n} from 'react';\n\nimport { tokenize, type CommandLanguage } from './commandHighlight';\n\ntype NativeTextareaProps = Omit<\n TextareaHTMLAttributes<HTMLTextAreaElement>,\n 'onChange' | 'value' | 'defaultValue' | 'style'\n>;\n\nexport interface CommandEditorProps extends NativeTextareaProps {\n /** Controlled value. Omit (with `defaultValue`) for uncontrolled usage. */\n value?: string;\n defaultValue?: string;\n onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;\n /** Highlight language. Defaults to shell. */\n language?: CommandLanguage;\n /** Extra classes for the bordered wrapper (e.g. a different background). */\n className?: string;\n rows?: number;\n /** Inline styles forwarded to the textarea (e.g. minHeight). */\n style?: CSSProperties;\n}\n\n/**\n * A drop-in replacement for a command/script `<textarea>` that renders live\n * syntax highlighting. It overlays a transparent textarea (the real input,\n * which keeps native editing, selection, IME and a11y) on top of a `<pre>` that\n * paints the highlighted tokens. The two layers share an identical box model so\n * the colored text sits exactly under the caret.\n *\n * Works controlled (`value` + `onChange`) or uncontrolled (`defaultValue` + a\n * forwarded `ref`, so callers that read `ref.current.value` keep working).\n */\nexport const CommandEditor = forwardRef<HTMLTextAreaElement, CommandEditorProps>(\n function CommandEditor(\n {\n value,\n defaultValue,\n onChange,\n language = 'shell',\n className = '',\n rows = 3,\n style,\n spellCheck = false,\n ...rest\n },\n forwardedRef\n ) {\n const isControlled = value !== undefined;\n const [internal, setInternal] = useState<string>(defaultValue ?? '');\n const text = isControlled ? (value ?? '') : internal;\n\n const preRef = useRef<HTMLPreElement>(null);\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n\n const setRefs = (node: HTMLTextAreaElement | null) => {\n textareaRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n (forwardedRef as MutableRefObject<HTMLTextAreaElement | null>).current = node;\n }\n };\n\n const tokens = useMemo(() => tokenize(text, language), [text, language]);\n\n const handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => {\n if (!isControlled) setInternal(event.target.value);\n onChange?.(event);\n };\n\n const syncScroll = (event: UIEvent<HTMLTextAreaElement>) => {\n const pre = preRef.current;\n if (!pre) return;\n pre.scrollTop = event.currentTarget.scrollTop;\n pre.scrollLeft = event.currentTarget.scrollLeft;\n };\n\n // Both layers MUST carry identical typography + box metrics so the painted\n // tokens line up under the caret. `scrollbarGutter: stable` is critical: the\n // textarea is overflow-auto and grows a (gutter-consuming) scrollbar once\n // content overflows the fixed rows, which would otherwise shrink ITS wrap\n // width relative to the overflow-hidden <pre> and drift every wrapped line.\n // Reserving the gutter on both keeps their content-box widths identical in\n // every state, so wrapping — and therefore the highlight overlay — stays aligned.\n const layerClass =\n 'm-0 w-full px-3 py-2 font-mono text-sm leading-relaxed whitespace-pre-wrap break-words';\n const layerStyle: CSSProperties = { tabSize: 2, scrollbarGutter: 'stable' };\n\n return (\n <div\n className={`relative overflow-hidden rounded-md border border-border-default bg-bg-sunken transition-all focus-within:border-transparent focus-within:ring-2 focus-within:ring-action-primary-bg ${className}`}\n >\n <pre\n ref={preRef}\n aria-hidden=\"true\"\n className={`${layerClass} pointer-events-none absolute inset-0 overflow-hidden text-text-primary`}\n style={layerStyle}\n >\n <code>\n {tokens.map((token, index) =>\n token.className ? (\n <span key={index} className={token.className}>\n {token.value}\n </span>\n ) : (\n <span key={index}>{token.value}</span>\n )\n )}\n </code>\n </pre>\n <textarea\n {...rest}\n ref={setRefs}\n rows={rows}\n spellCheck={spellCheck}\n value={isControlled ? text : undefined}\n defaultValue={isControlled ? undefined : defaultValue}\n onChange={handleChange}\n onScroll={syncScroll}\n className={`${layerClass} relative block resize-none overflow-auto bg-transparent text-transparent placeholder:text-text-placeholder focus:outline-none`}\n style={{ ...layerStyle, caretColor: 'var(--color-text-primary)', ...style }}\n />\n </div>\n );\n }\n);\n"],"mappings":";;;;AA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Y;IAA6B,GAAG;IAAO;GAC3E,CAAA,CACE;;EAGX"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { deriveAgentStatus as e } from "../../utils/agentStatus.js";
|
|
2
|
+
//#region src/components/common/actionAgentTarget.ts
|
|
3
|
+
function t(e, t) {
|
|
4
|
+
return t.length === 0 ? !0 : e.platform != null && t.includes(e.platform);
|
|
5
|
+
}
|
|
6
|
+
function n(t, n, r) {
|
|
7
|
+
return e({
|
|
8
|
+
id: t.id,
|
|
9
|
+
isActive: t.isActive,
|
|
10
|
+
metadata: t.metadata ?? null
|
|
11
|
+
}, n, { probesLoading: r });
|
|
12
|
+
}
|
|
13
|
+
function r(e, r, i, a) {
|
|
14
|
+
if (!(e.actionType === "COMMAND" || e.actionType === "SCRIPT")) return {
|
|
15
|
+
mode: "no-agent",
|
|
16
|
+
missing: !1,
|
|
17
|
+
noHealthyAgent: !1,
|
|
18
|
+
healthyCount: 0,
|
|
19
|
+
healthy: !0
|
|
20
|
+
};
|
|
21
|
+
let o = (e.targetPlatformFilter ?? "").split(",").map((e) => e.trim()).filter(Boolean);
|
|
22
|
+
if (e.targetAgentId) {
|
|
23
|
+
let t = r.find((t) => t.id === e.targetAgentId);
|
|
24
|
+
if (!t) return {
|
|
25
|
+
mode: "specific",
|
|
26
|
+
missing: !0,
|
|
27
|
+
noHealthyAgent: !1,
|
|
28
|
+
healthyCount: 0,
|
|
29
|
+
healthy: !1
|
|
30
|
+
};
|
|
31
|
+
let o = n(t, i, a);
|
|
32
|
+
return {
|
|
33
|
+
mode: "specific",
|
|
34
|
+
agent: t,
|
|
35
|
+
status: o,
|
|
36
|
+
reason: i.get(t.id)?.errorMessage ?? null,
|
|
37
|
+
missing: !1,
|
|
38
|
+
noHealthyAgent: !1,
|
|
39
|
+
healthyCount: +(o === "ACTIVE"),
|
|
40
|
+
healthy: o === "ACTIVE"
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
let s = r.filter((e) => t(e, o) && n(e, i, a) === "ACTIVE").length;
|
|
44
|
+
return {
|
|
45
|
+
mode: "any-available",
|
|
46
|
+
missing: !1,
|
|
47
|
+
noHealthyAgent: !a && s === 0,
|
|
48
|
+
healthyCount: s,
|
|
49
|
+
healthy: s > 0
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { r as resolveAgentTarget };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=actionAgentTarget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionAgentTarget.js","names":[],"sources":["../../../src/components/common/actionAgentTarget.ts"],"sourcesContent":["import {\n deriveAgentStatus,\n type AgentHealthProbe,\n type DerivedAgentStatus,\n} from '@/utils/agentStatus';\n\n/**\n * Minimal shape of an Action needed to reason about which agent it runs on.\n * `targetAgentId === null` means the action is configured for \"any available\n * agent\" (resolved at run time by the backend).\n */\nexport interface AgentTargetActionLike {\n actionType: string;\n targetAgentId?: string | null;\n targetPlatformFilter?: string | null;\n}\n\nexport interface AgentTargetAgentLike {\n id: string;\n name: string;\n isActive: boolean;\n platform?: string | null;\n metadata?: Record<string, unknown> | null;\n}\n\nexport type AgentTargetMode = 'no-agent' | 'any-available' | 'specific';\n\nexport interface AgentTargetResolution {\n mode: AgentTargetMode;\n /** The resolved specific agent (mode === 'specific' and it still exists). */\n agent?: AgentTargetAgentLike;\n status?: DerivedAgentStatus;\n reason?: string | null;\n /** Specific agent was set but no longer exists in the workspace (deleted). */\n missing: boolean;\n /** Any-available action but zero healthy candidates match. */\n noHealthyAgent: boolean;\n /** Count of healthy candidates (for any-available mode). */\n healthyCount: number;\n /** True when the chosen/auto target is currently healthy enough to run. */\n healthy: boolean;\n}\n\nfunction matchesPlatform(agent: AgentTargetAgentLike, platforms: string[]): boolean {\n if (platforms.length === 0) return true;\n return agent.platform != null && platforms.includes(agent.platform);\n}\n\nfunction statusOf(\n agent: AgentTargetAgentLike,\n probesById: Map<string, AgentHealthProbe>,\n probesLoading: boolean\n): DerivedAgentStatus {\n return deriveAgentStatus(\n { id: agent.id, isActive: agent.isActive, metadata: agent.metadata ?? null },\n probesById,\n { probesLoading }\n );\n}\n\n/**\n * Work out where an action will execute and whether that target is healthy, so\n * a linking surface (vibe-deck button, scheduler, …) can tell the user the\n * agent up front and warn — before linking — if it's unhealthy or gone.\n */\nexport function resolveAgentTarget(\n action: AgentTargetActionLike,\n agents: AgentTargetAgentLike[],\n probesById: Map<string, AgentHealthProbe>,\n probesLoading: boolean\n): AgentTargetResolution {\n const needsAgent = action.actionType === 'COMMAND' || action.actionType === 'SCRIPT';\n if (!needsAgent) {\n return {\n mode: 'no-agent',\n missing: false,\n noHealthyAgent: false,\n healthyCount: 0,\n healthy: true,\n };\n }\n\n const platforms = (action.targetPlatformFilter ?? '')\n .split(',')\n .map((p) => p.trim())\n .filter(Boolean);\n\n if (action.targetAgentId) {\n const agent = agents.find((a) => a.id === action.targetAgentId);\n if (!agent) {\n return {\n mode: 'specific',\n missing: true,\n noHealthyAgent: false,\n healthyCount: 0,\n healthy: false,\n };\n }\n const status = statusOf(agent, probesById, probesLoading);\n return {\n mode: 'specific',\n agent,\n status,\n reason: probesById.get(agent.id)?.errorMessage ?? null,\n missing: false,\n noHealthyAgent: false,\n healthyCount: status === 'ACTIVE' ? 1 : 0,\n healthy: status === 'ACTIVE',\n };\n }\n\n const healthyCount = agents.filter(\n (a) => matchesPlatform(a, platforms) && statusOf(a, probesById, probesLoading) === 'ACTIVE'\n ).length;\n\n return {\n mode: 'any-available',\n missing: false,\n // Don't claim \"no agent\" until probes have actually reported.\n noHealthyAgent: !probesLoading && healthyCount === 0,\n healthyCount,\n healthy: healthyCount > 0,\n };\n}\n"],"mappings":";;AA2CA,SAAS,EAAgB,GAA6B,GAA8B;AAElF,QADI,EAAU,WAAW,IAAU,KAC5B,EAAM,YAAY,QAAQ,EAAU,SAAS,EAAM,SAAS;;AAGrE,SAAS,EACP,GACA,GACA,GACoB;AACpB,QAAO,EACL;EAAE,IAAI,EAAM;EAAI,UAAU,EAAM;EAAU,UAAU,EAAM,YAAY;EAAM,EAC5E,GACA,EAAE,kBAAe,CAClB;;AAQH,SAAgB,EACd,GACA,GACA,GACA,GACuB;AAEvB,KAAI,EADe,EAAO,eAAe,aAAa,EAAO,eAAe,UAE1E,QAAO;EACL,MAAM;EACN,SAAS;EACT,gBAAgB;EAChB,cAAc;EACd,SAAS;EACV;CAGH,IAAM,KAAa,EAAO,wBAAwB,IAC/C,MAAM,IAAI,CACV,KAAK,MAAM,EAAE,MAAM,CAAC,CACpB,OAAO,QAAQ;AAElB,KAAI,EAAO,eAAe;EACxB,IAAM,IAAQ,EAAO,MAAM,MAAM,EAAE,OAAO,EAAO,cAAc;AAC/D,MAAI,CAAC,EACH,QAAO;GACL,MAAM;GACN,SAAS;GACT,gBAAgB;GAChB,cAAc;GACd,SAAS;GACV;EAEH,IAAM,IAAS,EAAS,GAAO,GAAY,EAAc;AACzD,SAAO;GACL,MAAM;GACN;GACA;GACA,QAAQ,EAAW,IAAI,EAAM,GAAG,EAAE,gBAAgB;GAClD,SAAS;GACT,gBAAgB;GAChB,cAAc,QAAW;GACzB,SAAS,MAAW;GACrB;;CAGH,IAAM,IAAe,EAAO,QACzB,MAAM,EAAgB,GAAG,EAAU,IAAI,EAAS,GAAG,GAAY,EAAc,KAAK,SACpF,CAAC;AAEF,QAAO;EACL,MAAM;EACN,SAAS;EAET,gBAAgB,CAAC,KAAiB,MAAiB;EACnD;EACA,SAAS,IAAe;EACzB"}
|