@kabmo-labs/kabmo 0.16.0 → 0.18.0
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/README.md +2 -2
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +552 -471
- package/dist/client/static/js/index-hp75vsv9.css +1 -0
- package/dist/client/static/js/{index-cpydmygd.js → index-tc09dtca.js} +897 -886
- package/package.json +1 -1
- package/src/client/components/common/MarkdownRenderer.tsx +136 -89
- package/src/client/components/common/anchored-menu/index.test.tsx +141 -0
- package/src/client/components/common/anchored-menu/index.tsx +143 -0
- package/src/client/components/common/code-surface/bracket-guide.test.ts +2 -2
- package/src/client/components/common/code-surface/bracket-guide.ts +2 -2
- package/src/client/components/common/code-surface/conflict-markers.ts +5 -5
- package/src/client/components/common/code-surface/extensions.ts +7 -4
- package/src/client/components/common/code-surface/theme.ts +34 -9
- package/src/client/components/common/code-surface/whitespace.test.ts +223 -0
- package/src/client/components/common/code-surface/whitespace.ts +140 -0
- package/src/client/components/common/markdown-review/ReviewPopover.tsx +144 -0
- package/src/client/components/common/markdown-review/ReviewSummary.tsx +108 -0
- package/src/client/components/common/markdown-review/index.tsx +129 -0
- package/src/client/components/common/{server-switcher/index.tsx → server-control/Panel.tsx} +92 -44
- package/src/client/components/common/server-control/index.test.tsx +217 -0
- package/src/client/components/common/server-control/index.tsx +120 -0
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +8 -50
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +42 -21
- package/src/client/components/layout/session-sidebar/CategoryHeader.worktree.test.tsx +36 -17
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +8 -7
- package/src/client/components/layout/session-sidebar/about-modal/NotesDialog.tsx +94 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.test.tsx +68 -0
- package/src/client/components/layout/session-sidebar/about-modal/VersionLine.tsx +36 -0
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +57 -34
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +28 -10
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +7 -6
- package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +1 -1
- package/src/client/components/layout/update-popup/ReleaseNotes.tsx +8 -3
- package/src/client/components/layout/update-popup/index.tsx +5 -1
- package/src/client/components/mobile/mobile-main-view/Header.tsx +6 -12
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +13 -15
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +23 -1
- package/src/client/components/mobile/mobile-right-sidebar/MissingFileBanner.tsx +30 -0
- package/src/client/components/mobile/mobile-right-sidebar/PreviewScroller.tsx +18 -2
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +41 -13
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +22 -67
- package/src/client/components/mobile/mobile-session-sidebar/ItemMenu.tsx +110 -0
- package/src/client/components/settings/Modal.tsx +9 -3
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +19 -9
- package/src/client/components/settings/SettingsSidebarList.tsx +20 -0
- package/src/client/components/settings/categories/AgentSettings.tsx +38 -44
- package/src/client/components/settings/categories/CommandSettings.tsx +2 -2
- package/src/client/components/settings/categories/McpSettings.tsx +4 -21
- package/src/client/components/settings/categories/OmpSettings.tsx +147 -194
- package/src/client/components/settings/categories/ProjectSettings.tsx +122 -156
- package/src/client/components/settings/categories/SkillCatalogSettings.tsx +220 -260
- package/src/client/components/settings/categories/SkillSettings.tsx +8 -5
- package/src/client/components/settings/categories/TokenUsageSettings.tsx +211 -229
- package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +229 -237
- package/src/client/components/settings/categories/agent-settings/ModelPicker.tsx +71 -0
- package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +14 -2
- package/src/client/components/settings/categories/agent-settings/levels.ts +38 -0
- package/src/client/components/settings/categories/behavior-settings/Editor.tsx +27 -7
- package/src/client/components/settings/categories/chat-settings/ToolRenderSection.tsx +23 -5
- package/src/client/components/settings/categories/command-settings/DetailPane.tsx +75 -33
- package/src/client/components/settings/categories/command-settings/SidebarList.tsx +7 -0
- package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +91 -76
- package/src/client/components/settings/categories/mcp-settings/EnvVarsSection.tsx +83 -0
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +26 -13
- package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +20 -0
- package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +97 -36
- package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +151 -0
- package/src/client/components/settings/categories/omp-settings/ExtensionsPanel.tsx +68 -32
- package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +119 -0
- package/src/client/components/settings/categories/omp-settings/PresetBar.tsx +14 -7
- package/src/client/components/settings/categories/omp-settings/RoleEditor.tsx +15 -6
- package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +165 -226
- package/src/client/components/settings/categories/omp-settings/types.ts +28 -0
- package/src/client/components/settings/categories/project-settings/AccentPalette.test.tsx +189 -0
- package/src/client/components/settings/categories/project-settings/AccentPalette.tsx +156 -24
- package/src/client/components/settings/categories/project-settings/AddProjectModal.tsx +175 -0
- package/src/client/components/settings/categories/project-settings/DeleteProjectModal.tsx +107 -0
- package/src/client/components/settings/categories/project-settings/DetailsForm.tsx +40 -24
- package/src/client/components/settings/categories/project-settings/DetailsHeader.tsx +17 -7
- package/src/client/components/settings/categories/project-settings/IconGrid.tsx +164 -69
- package/src/client/components/settings/categories/project-settings/ModelDropdown.test.tsx +122 -0
- package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +124 -53
- package/src/client/components/settings/categories/project-settings/NameInput.tsx +57 -11
- package/src/client/components/settings/categories/project-settings/PathField.tsx +122 -0
- package/src/client/components/settings/categories/project-settings/SidebarList.tsx +100 -59
- package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +253 -0
- package/src/client/components/settings/categories/skill-catalog/SkillCard.tsx +89 -0
- package/src/client/components/settings/categories/skill-catalog/SourceRail.tsx +122 -0
- package/src/client/components/settings/categories/skill-catalog/catalog-ui.test.tsx +179 -0
- package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +236 -0
- package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +164 -239
- package/src/client/components/settings/categories/skill-settings/InstructionsEditor.tsx +84 -0
- package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +144 -87
- package/src/client/components/settings/categories/skill-settings/pane.test.tsx +188 -0
- package/src/client/components/settings/categories/skill-settings/row-meta.ts +58 -0
- package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +242 -102
- package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +130 -56
- package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +135 -0
- package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +55 -33
- package/src/client/components/settings/categories/token-usage-settings/Provenance.tsx +59 -0
- package/src/client/components/settings/categories/token-usage-settings/panel.test.tsx +239 -0
- package/src/client/components/workspace/browser-panel/Screencast.test.ts +1 -0
- package/src/client/components/workspace/browser-panel/Screencast.tsx +17 -22
- package/src/client/components/workspace/browser-panel/TabStrip.test.tsx +158 -0
- package/src/client/components/workspace/browser-panel/TabStrip.tsx +90 -0
- package/src/client/components/workspace/browser-panel/index.tsx +50 -4
- package/src/client/components/workspace/browser-toolbar/index.tsx +41 -1
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +2 -0
- package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +13 -2
- package/src/client/components/workspace/chat-timeline/index.tsx +6 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +88 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +24 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.test.ts +46 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +15 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +34 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.test.ts +29 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +11 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +7 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.test.ts +24 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +6 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +237 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +191 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/styles.test.tsx +1 -1
- package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +21 -7
- package/src/client/components/workspace/diff-panel/changes.test.ts +51 -0
- package/src/client/components/workspace/diff-panel/changes.ts +28 -12
- package/src/client/components/workspace/diff-panel/merge.test.ts +28 -0
- package/src/client/components/workspace/diff-panel/merge.ts +21 -1
- package/src/client/components/workspace/editor/Body.tsx +7 -0
- package/src/client/components/workspace/editor/FileDocument.tsx +15 -21
- package/src/client/components/workspace/editor/FilePane.tsx +12 -0
- package/src/client/components/workspace/editor/PreviewPane.tsx +70 -0
- package/src/client/components/workspace/editor/Toolbar.tsx +17 -1
- package/src/client/components/workspace/editor/index.tsx +25 -22
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +14 -0
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +12 -86
- package/src/client/components/workspace/editor/toolbar-toggle.tsx +53 -0
- package/src/client/components/workspace/editor/toolbar-write-clusters.tsx +112 -0
- package/src/client/components/workspace/editor/viewers/SvgPreview.tsx +18 -2
- package/src/client/components/workspace/editor/viewers/viewers.test.ts +39 -0
- package/src/client/components/workspace/file-explorer/ContextMenu.tsx +18 -5
- package/src/client/components/workspace/file-explorer/Modals.tsx +15 -1
- package/src/client/components/workspace/file-explorer/RowLabel.tsx +68 -0
- package/src/client/components/workspace/file-explorer/TreeItem.tsx +47 -57
- package/src/client/components/workspace/file-explorer/collapsed-chain.test.ts +167 -0
- package/src/client/components/workspace/file-explorer/drag-props.ts +42 -0
- package/src/client/components/workspace/file-explorer/drag.test.ts +43 -0
- package/src/client/components/workspace/file-explorer/index.tsx +21 -20
- package/src/client/components/workspace/git-panel/commit-modal.test.ts +5 -3
- package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +201 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +112 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.test.tsx +225 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +217 -0
- package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +99 -0
- package/src/client/components/workspace/user-browser-panel/Frame.tsx +30 -1
- package/src/client/components/workspace/user-browser-panel/index.tsx +81 -2
- package/src/client/data/agent-data/builtin.ts +0 -10
- package/src/client/data/agent-data/orchestrator.ts +0 -45
- package/src/client/data/agent-data/specialist.ts +0 -100
- package/src/client/data/mock/token-usage.ts +170 -120
- package/src/client/data/settings/omp-schema.json +123 -4
- package/src/client/data/settings/project.ts +9 -28
- package/src/client/data/settings/skill.ts +6 -32
- package/src/client/hooks/browser/use-annotate.test.ts +143 -0
- package/src/client/hooks/browser/use-annotate.ts +98 -0
- package/src/client/hooks/browser/use-close-tab.test.ts +148 -0
- package/src/client/hooks/browser/use-close-tab.ts +67 -0
- package/src/client/hooks/browser/use-screencast.ts +13 -1
- package/src/client/hooks/chat/composer/browser-context.test.ts +117 -0
- package/src/client/hooks/chat/composer/browser-context.ts +40 -16
- package/src/client/hooks/chat/composer/items.test.ts +1 -1
- package/src/client/hooks/chat/composer/review-context.ts +38 -0
- package/src/client/hooks/chat/composer/use-draft.test.ts +132 -0
- package/src/client/hooks/chat/composer/use-draft.ts +31 -2
- package/src/client/hooks/chat/timeline/pending-model.ts +28 -0
- package/src/client/hooks/chat/timeline/row-window.test.ts +15 -2
- package/src/client/hooks/editor/use-document-annotations.ts +124 -0
- package/src/client/hooks/editor/use-editor-panel-ui.ts +52 -0
- package/src/client/hooks/editor/use-file-review-mode.ts +35 -0
- package/src/client/hooks/editor/use-preview-review.ts +148 -0
- package/src/client/hooks/settings/agents.ts +149 -0
- package/src/client/hooks/settings/crud-list.test.ts +28 -6
- package/src/client/hooks/settings/crud-list.ts +96 -57
- package/src/client/hooks/settings/omp-config.ts +164 -0
- package/src/client/hooks/settings/projects/index.ts +294 -0
- package/src/client/hooks/settings/projects.test.ts +237 -0
- package/src/client/hooks/settings/skill-catalog.ts +101 -9
- package/src/client/hooks/settings/skill-git-import.ts +153 -0
- package/src/client/hooks/settings/useTokenUsage.ts +125 -0
- package/src/client/hooks/settings/write-feedback.test.ts +104 -0
- package/src/client/hooks/settings/write-feedback.ts +63 -0
- package/src/client/hooks/shell/servers.test.ts +166 -0
- package/src/client/hooks/{desktop → shell}/servers.ts +17 -14
- package/src/client/hooks/ui/markdown-hydration.ts +125 -0
- package/src/client/hooks/ui/updates/index.test.ts +100 -1
- package/src/client/hooks/ui/updates/index.ts +50 -0
- package/src/client/hooks/ui/updates/notes.test.ts +138 -0
- package/src/client/hooks/ui/updates/notes.ts +57 -0
- package/src/client/hooks/ui/updates/shell-download.ts +1 -1
- package/src/client/hooks/ui/updates/shell-update.ts +2 -6
- package/src/client/hooks/workspace/file-row-drag.ts +41 -0
- package/src/client/hooks/workspace/file-tree-actions.ts +25 -1
- package/src/client/hooks/workspace/file-tree-edits.ts +23 -6
- package/src/client/hooks/workspace/root-drop-target.ts +77 -0
- package/src/client/hooks/workspace/unfolded-chains.ts +165 -0
- package/src/client/lib/browser/element-at.test.ts +229 -0
- package/src/client/lib/browser/element-at.ts +139 -0
- package/src/client/lib/desktop/dropped-paths.ts +1 -1
- package/src/client/lib/desktop/titlebar.test.ts +12 -3
- package/src/client/lib/desktop/titlebar.ts +1 -1
- package/src/client/lib/review/client.ts +73 -0
- package/src/client/lib/router/search-params.ts +42 -20
- package/src/client/lib/shell/desktop.ts +117 -0
- package/src/client/lib/shell/servers.ts +75 -0
- package/src/client/lib/shell/transport.ts +216 -0
- package/src/client/main.tsx +9 -0
- package/src/client/tailwind.css +65 -0
- package/src/server/lib/btw/lifecycle.server.ts +2 -2
- package/src/server/lib/db/schema.ts +7 -0
- package/src/server/lib/db/seed-terminal.test.ts +4 -0
- package/src/server/lib/fs/git-merge-conflict.test.ts +14 -1
- package/src/server/lib/omp/config/agent-definitions.test.ts +273 -0
- package/src/server/lib/omp/config/agents.ts +231 -61
- package/src/server/lib/omp/config/definitions.test.ts +9 -105
- package/src/server/lib/omp/config/extensions.ts +16 -7
- package/src/server/lib/omp/config/omp-config-files.test.ts +27 -0
- package/src/server/lib/omp/config/skill-sources.ts +49 -0
- package/src/server/lib/omp/config/skills-git-install.ts +155 -0
- package/src/server/lib/omp/config/skills-git-repo.ts +288 -0
- package/src/server/lib/omp/config/skills-git.test.ts +220 -0
- package/src/server/lib/omp/rpc/constants.test.ts +11 -0
- package/src/server/lib/omp/rpc/constants.ts +15 -0
- package/src/server/lib/omp/rpc/process.ts +11 -14
- package/src/server/lib/omp/rpc/session-commands.ts +6 -3
- package/src/server/lib/omp/rpc/utility-agent-dir.test.ts +134 -0
- package/src/server/lib/omp/rpc/utility-agent-dir.ts +138 -0
- package/src/server/lib/omp/rpc/utility.ts +12 -0
- package/src/server/lib/review/schema.server.ts +45 -0
- package/src/server/lib/review/store.server.ts +138 -0
- package/src/server/lib/terminal/attach-replay.test.ts +132 -0
- package/src/server/lib/terminal/output.test.ts +166 -0
- package/src/server/lib/terminal/output.ts +104 -0
- package/src/server/lib/terminal/runtime.server.ts +5 -0
- package/src/server/lib/terminal/send-result.test.ts +33 -0
- package/src/server/lib/terminal/send-result.ts +32 -0
- package/src/server/lib/terminal/session.server.ts +45 -11
- package/src/server/lib/terminal/store-liveness.test.ts +4 -0
- package/src/server/lib/updates/active-notes.test.ts +149 -0
- package/src/server/lib/updates/active-notes.ts +75 -0
- package/src/server/lib/updates/changelog-file.ts +42 -11
- package/src/server/lib/updates/changelog.test.ts +15 -1
- package/src/server/lib/updates/omp.ts +42 -15
- package/src/server/lib/updates/release-url.ts +27 -1
- package/src/server/lib/usage/index-parse.test.ts +200 -0
- package/src/server/lib/usage/index-parse.ts +178 -0
- package/src/server/lib/usage/index-query.server.ts +248 -0
- package/src/server/lib/usage/index-scan.server.ts +343 -0
- package/src/server/lib/usage/index-schema.server.ts +82 -0
- package/src/server/lib/usage/index.test.ts +234 -0
- package/src/server/lib/usage/providers.server.ts +4 -53
- package/src/server/lib/workspace/project-model.server.test.ts +102 -0
- package/src/server/lib/workspace/project-model.server.ts +47 -0
- package/src/server/lib/workspace/project-patch.server.ts +156 -0
- package/src/server/routes/agent/new.ts +8 -1
- package/src/server/routes/browser/index.ts +3 -0
- package/src/server/routes/browser/stream.ts +31 -2
- package/src/server/routes/browser/tabs.test.ts +94 -0
- package/src/server/routes/browser/tabs.ts +85 -0
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/review/bindings.ts +11 -0
- package/src/server/routes/review/index.ts +127 -0
- package/src/server/routes/review/routes.test.ts +191 -0
- package/src/server/routes/settings/agents.test.ts +180 -0
- package/src/server/routes/settings/agents.ts +99 -94
- package/src/server/routes/settings/mcp.test.ts +135 -0
- package/src/server/routes/settings/mcp.ts +14 -6
- package/src/server/routes/settings/projects.ts +53 -19
- package/src/server/routes/settings/settings-projects-routes.test.ts +214 -0
- package/src/server/routes/settings/settings-store-routes.test.ts +11 -115
- package/src/server/routes/settings/skills-catalog-actions.ts +195 -0
- package/src/server/routes/settings/skills.test.ts +225 -0
- package/src/server/routes/settings/skills.ts +18 -15
- package/src/server/routes/telemetry/tokens.test.ts +145 -0
- package/src/server/routes/telemetry/tokens.ts +70 -149
- package/src/server/routes/terminal/ws.ts +6 -5
- package/src/server/routes/updates/index.ts +2 -0
- package/src/server/routes/updates/notes.ts +34 -0
- package/src/server/routes/updates/routes.test.ts +49 -0
- package/src/shared/lib/browser/annotate.test.ts +283 -0
- package/src/shared/lib/browser/annotate.ts +231 -0
- package/src/shared/lib/browser/browser-viewer.test.ts +26 -4
- package/src/shared/lib/browser/frame-gate.test.ts +91 -0
- package/src/shared/lib/browser/frame-gate.ts +69 -0
- package/src/shared/lib/browser/frame-params.test.ts +43 -0
- package/src/shared/lib/browser/frame-params.ts +60 -0
- package/src/shared/lib/browser/frame-pipeline.test.ts +132 -0
- package/src/shared/lib/browser/frame-pipeline.ts +80 -0
- package/src/shared/lib/browser/page-context.ts +60 -4
- package/src/shared/lib/browser/snapshot.test.ts +115 -0
- package/src/shared/lib/browser/snapshot.ts +112 -0
- package/src/shared/lib/browser/tab-close.test.ts +74 -0
- package/src/shared/lib/browser/tab-close.ts +77 -0
- package/src/shared/lib/browser/viewer.ts +45 -26
- package/src/shared/lib/chat/timeline/block-chrome.ts +19 -0
- package/src/shared/lib/chat/timeline/tool-render-mode.ts +17 -4
- package/src/shared/lib/chat/tool/artifact.ts +55 -20
- package/src/shared/lib/chat/tool/bash-facts.ts +96 -0
- package/src/shared/lib/chat/tool/minimized.test.ts +98 -0
- package/src/shared/lib/chat/tool/minimized.ts +64 -0
- package/src/shared/lib/chat/tool/summary.test.ts +28 -8
- package/src/shared/lib/chat/tool/summary.ts +3 -32
- package/src/shared/lib/fs/folder-chain.test.ts +81 -1
- package/src/shared/lib/fs/folder-chain.ts +84 -0
- package/src/shared/lib/markdown/blocks/anchor.ts +63 -0
- package/src/shared/lib/markdown/blocks/blocks.test.ts +141 -0
- package/src/shared/lib/markdown/blocks/renderer.ts +120 -0
- package/src/shared/lib/markdown/blocks/scan.ts +100 -0
- package/src/shared/lib/markdown/blocks/types.ts +62 -0
- package/src/shared/lib/markdown/marked.ts +58 -147
- package/src/shared/lib/markdown/math-extensions.ts +168 -0
- package/src/shared/lib/markdown/review/prompt.ts +77 -0
- package/src/shared/lib/markdown/review/reconcile.ts +55 -0
- package/src/shared/lib/markdown/review/review.test.ts +96 -0
- package/src/shared/lib/markdown/xml-sections.test.ts +140 -0
- package/src/shared/lib/markdown/xml-sections.ts +139 -0
- package/src/shared/lib/models/provider/label.ts +57 -0
- package/src/shared/lib/omp/config/agent-file.test.ts +54 -0
- package/src/shared/lib/omp/config/agent-file.ts +43 -0
- package/src/shared/lib/omp/config/row-value.test.ts +95 -0
- package/src/shared/lib/omp/config/row-value.ts +97 -0
- package/src/shared/lib/omp/config/schema.test.ts +66 -0
- package/src/shared/lib/omp/config/schema.ts +6 -0
- package/src/shared/lib/omp/rpc/frame.test.ts +48 -47
- package/src/shared/lib/omp/rpc/frame.ts +49 -40
- package/src/shared/lib/omp/session/job-progress.test.ts +37 -1
- package/src/shared/lib/omp/session/job-progress.ts +31 -0
- package/src/shared/lib/omp/session/proc.ts +5 -0
- package/src/shared/lib/omp/session/wait.ts +5 -0
- package/src/shared/lib/ui/menu-anchor.test.ts +69 -0
- package/src/shared/lib/ui/menu-anchor.ts +89 -0
- package/src/shared/lib/ui/mobile-overlay.ts +61 -0
- package/src/shared/lib/ui/svg-scope.test.ts +97 -0
- package/src/shared/lib/ui/svg-scope.ts +134 -0
- package/src/shared/lib/usage/breakdown.test.ts +197 -0
- package/src/shared/lib/usage/breakdown.ts +241 -0
- package/src/shared/lib/usage/range.test.ts +204 -0
- package/src/shared/lib/usage/range.ts +240 -0
- package/src/shared/lib/usage/view.test.ts +85 -0
- package/src/shared/lib/usage/view.ts +74 -0
- package/src/shared/lib/workspace/project-accent.test.ts +69 -0
- package/src/shared/lib/workspace/project-accent.ts +63 -0
- package/src/shared/lib/workspace/project-icon.ts +40 -0
- package/src/shared/lib/workspace/project-model.test.ts +79 -0
- package/src/shared/lib/workspace/project-model.ts +64 -0
- package/src/shared/types/browser.ts +78 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/settings/agent.ts +28 -6
- package/src/shared/types/settings/skill.ts +53 -3
- package/src/shared/types/settings/state.ts +4 -3
- package/src/shared/types/settings/write.ts +6 -0
- package/src/shared/types/tokenUsage.ts +128 -21
- package/src/shared/types/updates.ts +20 -0
- package/src/test-support/file-explorer-disk.test-util.ts +25 -1
- package/src/test-support/file-explorer-drag.test-util.ts +88 -0
- package/src/test-support/file-explorer.test-util.ts +47 -47
- package/dist/client/static/js/index-fjnq2z2d.css +0 -1
- package/src/client/components/common/code-surface/indent-guide.ts +0 -104
- package/src/client/components/common/server-switcher/index.test.tsx +0 -150
- package/src/client/components/settings/categories/skill-catalog/AddSourceModal.tsx +0 -133
- package/src/client/hooks/desktop/servers.test.ts +0 -73
- package/src/client/lib/desktop/bridge.ts +0 -203
- package/src/server/lib/omp/session/usage/aggregate-shaping.test.ts +0 -149
- package/src/server/lib/omp/session/usage/aggregate.test.ts +0 -243
- package/src/server/lib/omp/session/usage/aggregate.ts +0 -330
- package/src/server/lib/omp/session/usage/shaping.ts +0 -130
- package/src/shared/lib/code/editor/indent-guide-rule.test.ts +0 -65
- package/src/shared/lib/code/editor/indent-guide-rule.ts +0 -47
package/src/client/tailwind.css
CHANGED
|
@@ -852,3 +852,68 @@ html[data-theme-variant="dark"] .shiki span { color: var(--shiki-dark); }
|
|
|
852
852
|
transform: translateX(33%);
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
|
+
|
|
856
|
+
/* ---------------------------------------------------------------------------
|
|
857
|
+
* Review mode on a rendered markdown document.
|
|
858
|
+
*
|
|
859
|
+
* The verdict lives on `data-md-verdict` on the block element, painted by the
|
|
860
|
+
* renderer after the annotations land. Two rules make it legible without
|
|
861
|
+
* spending the palette:
|
|
862
|
+
*
|
|
863
|
+
* - a LEFT RAIL is the mark. It is the only thing that survives a reflow —
|
|
864
|
+
* a background tint over a 3-line paragraph and over a 40-line code block
|
|
865
|
+
* read as unrelated states.
|
|
866
|
+
* - `needs-work` is the one state that uses chroma (`--theme-error`), because
|
|
867
|
+
* it is the one state the reader must not miss. Chroma stays reserved for it.
|
|
868
|
+
*
|
|
869
|
+
* `data-md-selected` is the block whose popover is open: it gets an outline, not
|
|
870
|
+
* a colour, so it composes with either verdict.
|
|
871
|
+
* ------------------------------------------------------------------------- */
|
|
872
|
+
|
|
873
|
+
.md-review-active .prose-content [data-md-block] {
|
|
874
|
+
position: relative;
|
|
875
|
+
cursor: pointer;
|
|
876
|
+
border-radius: 0.25rem;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/* The hover affordance exists only where a review is possible, and only for a
|
|
880
|
+
* block that has not been judged yet — a judged block already says so. */
|
|
881
|
+
.md-review-active .prose-content [data-md-block]:hover:not([data-md-verdict]) {
|
|
882
|
+
background: color-mix(in srgb, var(--theme-ink) 4%, transparent);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
.md-review-active .prose-content [data-md-verdict]::before {
|
|
886
|
+
content: '';
|
|
887
|
+
position: absolute;
|
|
888
|
+
inset-block: 0;
|
|
889
|
+
left: -0.6rem;
|
|
890
|
+
width: 3px;
|
|
891
|
+
border-radius: 2px;
|
|
892
|
+
background: color-mix(in srgb, var(--theme-ink) 35%, transparent);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
.md-review-active .prose-content [data-md-verdict='needs-work']::before {
|
|
896
|
+
background: var(--theme-error);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/* A judged block keeps a faint tint so the marks read as a set when scrolled
|
|
900
|
+
* past quickly; `needs-work` is the only one allowed to be a colour. */
|
|
901
|
+
.md-review-active .prose-content [data-md-verdict='good'] {
|
|
902
|
+
background: color-mix(in srgb, var(--theme-ink) 3%, transparent);
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
.md-review-active .prose-content [data-md-verdict='needs-work'] {
|
|
906
|
+
background: color-mix(in srgb, var(--theme-error) 8%, transparent);
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
.md-review-active .prose-content [data-md-selected] {
|
|
910
|
+
outline: 1px solid color-mix(in srgb, var(--theme-ink) 40%, transparent);
|
|
911
|
+
outline-offset: 2px;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/* Review mode is a reading mode: a link inside a block is part of what is being
|
|
915
|
+
* judged, and following it would leave the block. The handler consumes the
|
|
916
|
+
* click; this only says so. */
|
|
917
|
+
.md-review-active .prose-content [data-md-block] a {
|
|
918
|
+
cursor: pointer;
|
|
919
|
+
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import type { RpcProcess, RpcFrame } from '@/server/lib/omp/rpc/process';
|
|
18
|
-
import { GET_STATE_TIMEOUT_MS, IDLE_REAP_MS,
|
|
18
|
+
import { GET_STATE_TIMEOUT_MS, IDLE_REAP_MS, promptAckTimeoutMs } from '@/server/lib/omp/rpc/constants';
|
|
19
19
|
import { buildBtwPrompt } from '@/server/lib/btw/prompt';
|
|
20
20
|
import { boundSideReply } from '@/server/lib/btw/reply';
|
|
21
21
|
import { appendBtwTurn, settleRunningBtwTurns, updateBtwTurn } from '@/server/lib/btw/store.server';
|
|
@@ -63,7 +63,7 @@ export async function askSideQuestion(host: BtwLifecycleHost, question: string,
|
|
|
63
63
|
const proc = await host.start();
|
|
64
64
|
await proc.sendCommand(
|
|
65
65
|
{ type: 'prompt', message: buildBtwPrompt(question), ...(images?.length ? { images } : {}) },
|
|
66
|
-
|
|
66
|
+
promptAckTimeoutMs(images),
|
|
67
67
|
);
|
|
68
68
|
} catch (error) {
|
|
69
69
|
await settleSideTurn(host, 'error');
|
|
@@ -19,7 +19,9 @@ import { ensureWaitingSchema } from '@/server/lib/waiting/schema.server';
|
|
|
19
19
|
import { ensurePluginSchema } from '@/server/lib/plugins/schema.server';
|
|
20
20
|
import { ensureModelRolePresetSchema } from '@/server/lib/model-roles/schema.server';
|
|
21
21
|
import { ensureProviderIconSchema } from '@/server/lib/models/provider-icon-store.server';
|
|
22
|
+
import { ensureUsageIndexSchema } from '@/server/lib/usage/index-schema.server';
|
|
22
23
|
import { ensureWorktreeSchema } from '@/server/lib/db/worktree-registry.server';
|
|
24
|
+
import { ensureReviewSchema } from '@/server/lib/review/schema.server';
|
|
23
25
|
import { migrateWorkspaceFolderColumns } from '@/shared/lib/workspace/schema-migrations';
|
|
24
26
|
import { migrateSessionStreamStateColumns } from '@/shared/lib/omp/session/schema-migrations';
|
|
25
27
|
|
|
@@ -126,9 +128,14 @@ export async function initSchema(db: DbClient): Promise<void> {
|
|
|
126
128
|
// Named model-role presets (the role editor's preset picker).
|
|
127
129
|
await ensureModelRolePresetSchema(db);
|
|
128
130
|
await ensureProviderIconSchema(db);
|
|
131
|
+
// Token-usage index: the rollup the telemetry panel reads instead of
|
|
132
|
+
// re-scanning every transcript on each request.
|
|
133
|
+
await ensureUsageIndexSchema(db);
|
|
129
134
|
// Worktree registry: the ref each worktree branched from, and the identity
|
|
130
135
|
// cache that keys its folder.
|
|
131
136
|
await ensureWorktreeSchema(db);
|
|
137
|
+
// Review annotations on a rendered markdown document (per block, per file).
|
|
138
|
+
await ensureReviewSchema(db);
|
|
132
139
|
|
|
133
140
|
await db.exec(`
|
|
134
141
|
CREATE TABLE IF NOT EXISTS files (
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
type TerminalSession,
|
|
40
40
|
type TerminalViewer,
|
|
41
41
|
} from '@/server/lib/terminal/session.server';
|
|
42
|
+
import { createTerminalOutputQueue } from '@/server/lib/terminal/output';
|
|
42
43
|
import { clampTerminalSize } from '@/shared/lib/workspace/terminal/protocol';
|
|
43
44
|
import { testPosix } from '@/test-support/platform';
|
|
44
45
|
describe('clampTerminalSize and session constants', () => {
|
|
@@ -213,6 +214,9 @@ function fakeSession(
|
|
|
213
214
|
term: undefined as unknown as Bun.Terminal,
|
|
214
215
|
proc: null,
|
|
215
216
|
history: undefined as never,
|
|
217
|
+
// A real queue: `closeTerminalStream` disposes it, which is one of the
|
|
218
|
+
// behaviours this file pins.
|
|
219
|
+
output: createTerminalOutputQueue(() => {}),
|
|
216
220
|
viewers: new Set(viewers),
|
|
217
221
|
cols: 80,
|
|
218
222
|
rows: 24,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* a real failure (a bad ref, a dirty tree) leaves none.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
import { afterEach, describe, expect, test } from 'bun:test';
|
|
23
|
+
import { afterEach, describe, expect, setDefaultTimeout, test } from 'bun:test';
|
|
24
24
|
import fs from 'node:fs';
|
|
25
25
|
import os from 'node:os';
|
|
26
26
|
import path from 'node:path';
|
|
@@ -28,6 +28,19 @@ import { mergeBranch, rebaseOnto } from '@/server/lib/fs/git-merge';
|
|
|
28
28
|
import { applyStash, pushStash } from '@/server/lib/fs/git-stash';
|
|
29
29
|
import { readGitState } from '@/server/lib/fs/git-state';
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Every case here builds a real repository and drives several `git` processes
|
|
33
|
+
* through it (`init`, two `config`, `add`, two `commit`, `stash push`, `stash
|
|
34
|
+
* pop`), so Bun's 5s per-test default is a budget for the RUNNER rather than
|
|
35
|
+
* for the code. Measured on `windows-latest`: "applyStash resolves with the
|
|
36
|
+
* stash-pop state" timed out at 5011ms while the same suite is green locally in
|
|
37
|
+
* well under a second, and process spawn on that runner costs several times
|
|
38
|
+
* what it does on POSIX. A budget, not a skip: the behaviour is identical on
|
|
39
|
+
* both platforms. `git-actions-sync.test.ts` and the route's `git-merge.test.ts`
|
|
40
|
+
* set the same 30s for the same reason.
|
|
41
|
+
*/
|
|
42
|
+
setDefaultTimeout(30_000);
|
|
43
|
+
|
|
31
44
|
const repos: string[] = [];
|
|
32
45
|
|
|
33
46
|
afterEach(() => {
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Native agent definitions: discovery, and the writer that edits omp's own
|
|
8
|
+
* markdown files in place.
|
|
9
|
+
*
|
|
10
|
+
* The field set here is omp's contract, measured against the installed
|
|
11
|
+
* `@oh-my-pi/pi-coding-agent` 18.16.0 (`discovery/helpers.ts`
|
|
12
|
+
* `parseAgentFields`): `name`, `description`, `tools`, `spawns`, `model`,
|
|
13
|
+
* `thinkingLevel`, and the body as the system prompt. Two failures are pinned:
|
|
14
|
+
*
|
|
15
|
+
* - **A key omp ignores must not be offered or written.** `mode`,
|
|
16
|
+
* `temperature` and `top_p` are none of omp's business; a pane editing them
|
|
17
|
+
* changed a file to no effect.
|
|
18
|
+
* - **A write must not delete what it does not own.** A shipped agent's
|
|
19
|
+
* block-list `tools:`, its `spawns:` and its nested `output:` schema have to
|
|
20
|
+
* survive an edit to the prompt or the model.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
24
|
+
import fs from 'node:fs';
|
|
25
|
+
import { tmpdir } from 'node:os';
|
|
26
|
+
import { join } from 'node:path';
|
|
27
|
+
|
|
28
|
+
import { deleteAgentDefinition, discoverNativeAgents, writeAgentDefinition } from '@/server/lib/omp/config/agents';
|
|
29
|
+
|
|
30
|
+
let root = '';
|
|
31
|
+
let agentDir = '';
|
|
32
|
+
let userAgents = '';
|
|
33
|
+
let projectAgents = '';
|
|
34
|
+
let prevAgentDir: string | undefined;
|
|
35
|
+
|
|
36
|
+
/** Write a fixture file, creating its parent directory. */
|
|
37
|
+
function write(file: string, content: string): string {
|
|
38
|
+
fs.mkdirSync(join(file, '..'), { recursive: true });
|
|
39
|
+
fs.writeFileSync(file, content);
|
|
40
|
+
return file;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
beforeAll(() => {
|
|
44
|
+
root = fs.mkdtempSync(join(tmpdir(), 'kabmo-agent-definitions-'));
|
|
45
|
+
agentDir = join(root, 'agent');
|
|
46
|
+
userAgents = join(agentDir, 'agents');
|
|
47
|
+
projectAgents = join(root, 'project-agents');
|
|
48
|
+
fs.mkdirSync(userAgents, { recursive: true });
|
|
49
|
+
fs.mkdirSync(projectAgents, { recursive: true });
|
|
50
|
+
prevAgentDir = Bun.env.PI_CODING_AGENT_DIR;
|
|
51
|
+
Bun.env.PI_CODING_AGENT_DIR = agentDir;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
beforeEach(() => {
|
|
55
|
+
for (const dir of [userAgents, projectAgents]) {
|
|
56
|
+
for (const entry of fs.readdirSync(dir)) fs.rmSync(join(dir, entry), { recursive: true, force: true });
|
|
57
|
+
}
|
|
58
|
+
Bun.env.PI_CODING_AGENT_DIR = agentDir;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
afterAll(() => {
|
|
62
|
+
if (prevAgentDir === undefined) delete Bun.env.PI_CODING_AGENT_DIR;
|
|
63
|
+
else Bun.env.PI_CODING_AGENT_DIR = prevAgentDir;
|
|
64
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('discoverNativeAgents', () => {
|
|
68
|
+
/**
|
|
69
|
+
* Only the keys omp actually parses are surfaced. `mode` and `temperature`
|
|
70
|
+
* are NOT among them (measured against 18.16.0 `parseAgentFields`), so a
|
|
71
|
+
* panel that offered them was editing a file omp ignores.
|
|
72
|
+
*/
|
|
73
|
+
test('shapes the frontmatter keys omp parses and skips non-markdown entries', async () => {
|
|
74
|
+
write(join(userAgents, 'one.md'), [
|
|
75
|
+
'---',
|
|
76
|
+
'name: First',
|
|
77
|
+
'description: "a description"',
|
|
78
|
+
'model: kenari/deepseek-v4-flash',
|
|
79
|
+
'thinking: high',
|
|
80
|
+
'temperature: 0.5',
|
|
81
|
+
'spawns: "*"',
|
|
82
|
+
'---',
|
|
83
|
+
'',
|
|
84
|
+
' system prompt ',
|
|
85
|
+
'',
|
|
86
|
+
].join('\n'));
|
|
87
|
+
write(join(userAgents, 'two.md'), 'no frontmatter body\n');
|
|
88
|
+
write(join(userAgents, 'ignored.txt'), 'x');
|
|
89
|
+
fs.mkdirSync(join(userAgents, 'nested.md'), { recursive: true });
|
|
90
|
+
|
|
91
|
+
const found = await discoverNativeAgents();
|
|
92
|
+
expect(found.map((agent) => agent.id).sort()).toEqual(['omp-user-one', 'omp-user-two']);
|
|
93
|
+
// By id, never by index: `readdir` order is not guaranteed (Windows returned `two` first).
|
|
94
|
+
const byId = new Map(found.map((agent) => [agent.id, agent]));
|
|
95
|
+
expect(byId.get('omp-user-one')).toMatchObject({
|
|
96
|
+
name: 'First',
|
|
97
|
+
description: 'a description',
|
|
98
|
+
model: 'kenari/deepseek-v4-flash',
|
|
99
|
+
thinkingLevel: 'high',
|
|
100
|
+
spawns: '*',
|
|
101
|
+
systemPrompt: 'system prompt',
|
|
102
|
+
sourceRoot: 'user',
|
|
103
|
+
filePath: join(userAgents, 'one.md'),
|
|
104
|
+
});
|
|
105
|
+
// `temperature` is not an agent key omp reads, so it is not carried.
|
|
106
|
+
expect(byId.get('omp-user-one')).not.toHaveProperty('temperature');
|
|
107
|
+
expect(byId.get('omp-user-two')).toMatchObject({
|
|
108
|
+
name: 'two', description: '', systemPrompt: 'no frontmatter body',
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('a model written as a block list is read, not missed', async () => {
|
|
113
|
+
// omp writes `model:` as a YAML sequence (its own shipped agents do), which
|
|
114
|
+
// a scalar-only frontmatter parser reads as an empty value.
|
|
115
|
+
write(join(userAgents, 'block.md'), '---\nname: Block\nmodel:\n - "@smol"\nthinkingLevel: medium\n---\nbody\n');
|
|
116
|
+
const agent = (await discoverNativeAgents()).find((item) => item.id === 'omp-user-block');
|
|
117
|
+
expect(agent).toMatchObject({ model: '@smol', thinkingLevel: 'medium' });
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test('a user agent wins over a project agent with the same base name', async () => {
|
|
121
|
+
write(join(userAgents, 'shared.md'), '---\nname: FromUser\n---\nuser body\n');
|
|
122
|
+
write(join(projectAgents, 'shared.md'), '---\nname: FromProject\n---\nproject body\n');
|
|
123
|
+
write(join(projectAgents, 'project-only.md'), '---\nname: OnlyProject\n---\nbody\n');
|
|
124
|
+
|
|
125
|
+
const found = await discoverNativeAgents(projectAgents);
|
|
126
|
+
expect(found.find((agent) => agent.filePath === join(userAgents, 'shared.md'))?.name).toBe('FromUser');
|
|
127
|
+
expect(found.some((agent) => agent.filePath === join(projectAgents, 'shared.md'))).toBe(false);
|
|
128
|
+
expect(found.find((agent) => agent.id === 'omp-project-project-only')?.sourceRoot).toBe('project');
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test('an oversized definition is skipped and a missing directory is not an error', async () => {
|
|
132
|
+
write(join(userAgents, 'huge.md'), `---\nname: Huge\n---\n${'x'.repeat(512 * 1024 + 1)}\n`);
|
|
133
|
+
const found = await discoverNativeAgents();
|
|
134
|
+
expect(found.some((agent) => agent.name === 'Huge')).toBe(false);
|
|
135
|
+
expect(await discoverNativeAgents(join(root, 'no-such-dir'))).toEqual(found);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
describe('writeAgentDefinition', () => {
|
|
140
|
+
test('refuses an unsafe file name and an empty system prompt', async () => {
|
|
141
|
+
await expect(writeAgentDefinition({ fileName: '../escape', name: 'X', description: '', systemPrompt: 'x' }))
|
|
142
|
+
.rejects.toThrow(/may contain letters/);
|
|
143
|
+
await expect(writeAgentDefinition({ fileName: 'ok', name: 'X', description: '', systemPrompt: ' ' }))
|
|
144
|
+
.rejects.toThrow(/cannot be empty/);
|
|
145
|
+
expect(fs.existsSync(join(userAgents, 'ok.md'))).toBe(false);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
test('writes the keys omp reads, quoting scalars, then deletes on request', async () => {
|
|
149
|
+
const { path } = await writeAgentDefinition({
|
|
150
|
+
fileName: 'written',
|
|
151
|
+
name: 'Written Agent',
|
|
152
|
+
description: 'has "quotes" and \\ slashes',
|
|
153
|
+
model: 'kenari/deepseek-v4-flash',
|
|
154
|
+
thinkingLevel: 'low',
|
|
155
|
+
spawns: '*',
|
|
156
|
+
tools: ['read', 'bash'],
|
|
157
|
+
systemPrompt: 'do the thing',
|
|
158
|
+
});
|
|
159
|
+
expect(path).toBe(join(userAgents, 'written.md'));
|
|
160
|
+
const text = fs.readFileSync(path, 'utf8');
|
|
161
|
+
expect(text).toContain('name: "Written Agent"');
|
|
162
|
+
expect(text).toContain('model: "kenari/deepseek-v4-flash"');
|
|
163
|
+
expect(text).toContain('thinkingLevel: low');
|
|
164
|
+
expect(text).toContain('spawns: "*"');
|
|
165
|
+
expect(text).toContain('tools: read, bash');
|
|
166
|
+
expect(text).toContain('has \\"quotes\\" and \\\\ slashes');
|
|
167
|
+
// Keys omp ignores are never written: they would be dead config.
|
|
168
|
+
expect(text).not.toContain('mode:');
|
|
169
|
+
expect(text).not.toContain('temperature');
|
|
170
|
+
expect(text).not.toContain('top_p');
|
|
171
|
+
expect(text.endsWith('\n')).toBe(true);
|
|
172
|
+
|
|
173
|
+
expect(await deleteAgentDefinition('written')).toBe(true);
|
|
174
|
+
expect(await deleteAgentDefinition('written')).toBe(false);
|
|
175
|
+
await expect(deleteAgentDefinition('bad/name')).rejects.toThrow(/Invalid agent file name/);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test('editing a shipped definition keeps the keys the panel does not own', async () => {
|
|
179
|
+
// A real omp agent file: a tools block list, an `output:` schema, and a key
|
|
180
|
+
// order the panel has no business rewriting.
|
|
181
|
+
write(join(userAgents, 'shipped.md'), [
|
|
182
|
+
'---',
|
|
183
|
+
'name: shipped',
|
|
184
|
+
'description: "Ship it"',
|
|
185
|
+
'tools:',
|
|
186
|
+
' - read',
|
|
187
|
+
' - grep',
|
|
188
|
+
'model:',
|
|
189
|
+
' - "@smol"',
|
|
190
|
+
'thinkingLevel: medium',
|
|
191
|
+
'output:',
|
|
192
|
+
' properties:',
|
|
193
|
+
' summary:',
|
|
194
|
+
' type: string',
|
|
195
|
+
'---',
|
|
196
|
+
'',
|
|
197
|
+
'old prompt',
|
|
198
|
+
'',
|
|
199
|
+
].join('\n'));
|
|
200
|
+
|
|
201
|
+
await writeAgentDefinition({
|
|
202
|
+
fileName: 'shipped',
|
|
203
|
+
name: 'shipped',
|
|
204
|
+
description: 'Ship it',
|
|
205
|
+
model: 'kenari/deepseek-v4-flash',
|
|
206
|
+
thinkingLevel: 'high',
|
|
207
|
+
systemPrompt: 'new prompt',
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
const text = fs.readFileSync(join(userAgents, 'shipped.md'), 'utf8');
|
|
211
|
+
// Preserved verbatim: the panel never touched them.
|
|
212
|
+
expect(text).toContain('tools:\n - read\n - grep\n');
|
|
213
|
+
expect(text).toContain('output:\n properties:\n summary:\n type: string\n');
|
|
214
|
+
// Replaced where it stood, so a stale `model:` block list cannot survive.
|
|
215
|
+
expect(text).toContain('model: "kenari/deepseek-v4-flash"');
|
|
216
|
+
expect(text).toContain('thinkingLevel: high');
|
|
217
|
+
expect(text).not.toContain('"@smol"');
|
|
218
|
+
expect(text).toContain('new prompt');
|
|
219
|
+
expect(text).not.toContain('old prompt');
|
|
220
|
+
// One name and one description, never a duplicate appended below.
|
|
221
|
+
expect(text.match(/^name:/gm)).toHaveLength(1);
|
|
222
|
+
expect(text.match(/^description:/gm)).toHaveLength(1);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test('an untouched tools field leaves the block list exactly as it was', async () => {
|
|
226
|
+
// The pane's tools box is a CSV view of a YAML list. Re-sending the same
|
|
227
|
+
// names as CSV rewrote four lines into one, which is a silent reformat of a
|
|
228
|
+
// file the user never edited.
|
|
229
|
+
const original = [
|
|
230
|
+
'---',
|
|
231
|
+
'name: keep',
|
|
232
|
+
'description: "Keep the list"',
|
|
233
|
+
'tools:',
|
|
234
|
+
' - read',
|
|
235
|
+
' - grep',
|
|
236
|
+
'---',
|
|
237
|
+
'',
|
|
238
|
+
'body',
|
|
239
|
+
'',
|
|
240
|
+
].join('\n');
|
|
241
|
+
write(join(userAgents, 'keep.md'), original);
|
|
242
|
+
|
|
243
|
+
await writeAgentDefinition({
|
|
244
|
+
fileName: 'keep',
|
|
245
|
+
name: 'keep',
|
|
246
|
+
description: 'Keep the list',
|
|
247
|
+
systemPrompt: 'new body',
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
const text = fs.readFileSync(join(userAgents, 'keep.md'), 'utf8');
|
|
251
|
+
expect(text).toContain('tools:\n - read\n - grep\n');
|
|
252
|
+
expect(text).toContain('new body');
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
test('clearing the model removes the key so omp falls back to the role default', async () => {
|
|
256
|
+
await writeAgentDefinition({
|
|
257
|
+
fileName: 'clear',
|
|
258
|
+
name: 'clear',
|
|
259
|
+
description: '',
|
|
260
|
+
model: 'kenari/deepseek-v4-flash',
|
|
261
|
+
systemPrompt: 'body',
|
|
262
|
+
});
|
|
263
|
+
await writeAgentDefinition({
|
|
264
|
+
fileName: 'clear',
|
|
265
|
+
name: 'clear',
|
|
266
|
+
description: '',
|
|
267
|
+
model: '',
|
|
268
|
+
systemPrompt: 'body',
|
|
269
|
+
});
|
|
270
|
+
const text = fs.readFileSync(join(userAgents, 'clear.md'), 'utf8');
|
|
271
|
+
expect(text).not.toContain('model:');
|
|
272
|
+
});
|
|
273
|
+
});
|