@kabmo-labs/kabmo 0.17.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/dist/client/index.html +1 -1
- package/dist/client/index.js +538 -457
- package/dist/client/static/js/index-hp75vsv9.css +1 -0
- package/dist/client/static/js/{index-rerjq5th.js → index-tc09dtca.js} +823 -814
- 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/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-control/Panel.tsx +33 -23
- package/src/client/components/common/server-control/index.test.tsx +11 -5
- package/src/client/components/common/server-control/index.tsx +10 -8
- 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-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/Item.tsx +22 -67
- package/src/client/components/mobile/mobile-session-sidebar/ItemMenu.tsx +110 -0
- package/src/client/components/settings/SettingsSidebarList.tsx +20 -0
- package/src/client/components/settings/categories/AgentSettings.tsx +23 -50
- 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/SkillSettings.tsx +2 -2
- 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 +9 -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/skill-settings/DetailHeader.tsx +35 -7
- package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +34 -14
- package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +21 -0
- package/src/client/components/settings/categories/skill-settings/pane.test.tsx +15 -6
- 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/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/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/shared/ArtifactChip.tsx +7 -6
- 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/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 +33 -1
- 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/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/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/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/lib/browser/element-at.test.ts +229 -0
- package/src/client/lib/browser/element-at.ts +139 -0
- package/src/client/lib/review/client.ts +73 -0
- package/src/client/lib/router/search-params.ts +42 -20
- 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/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/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/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 +95 -102
- package/src/server/routes/settings/mcp.test.ts +135 -0
- package/src/server/routes/settings/mcp.ts +14 -6
- package/src/server/routes/settings/settings-store-routes.test.ts +6 -113
- 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/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 +31 -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/ui/menu-anchor.test.ts +69 -0
- package/src/shared/lib/ui/menu-anchor.ts +89 -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/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/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/dist/client/static/js/index-3ve31rzx.css +0 -1
- 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
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The drawing surface over the user's page.
|
|
8
|
+
*
|
|
9
|
+
* It sits INSIDE the wrapper that carries the panel's CSS `zoom` and viewport
|
|
10
|
+
* preset, so `inset: 0` already covers the iframe exactly — verified in
|
|
11
|
+
* Chromium at 150% zoom: iframe and overlay both measured 900×450. Pointer
|
|
12
|
+
* positions are normalized against this element's own measured rect, which is
|
|
13
|
+
* why a mark survives a zoom change: the ratio is the same at every scale.
|
|
14
|
+
*
|
|
15
|
+
* While the layer is mounted the iframe is inert — the overlay takes every
|
|
16
|
+
* pointer event, because a drag that reached the page would both navigate the
|
|
17
|
+
* user away and lose the mark. The bar above says so in words.
|
|
18
|
+
*
|
|
19
|
+
* Marks are geometry only. The page inside is cross-origin, so there are no
|
|
20
|
+
* pixels to draw them on: what the agent receives is the region and the words
|
|
21
|
+
* (`shared/lib/browser/annotate.ts`).
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { useEffect, useRef, useState } from 'preact/hooks';
|
|
25
|
+
import { normalizePoint, shapeRegion } from '@/shared/lib/browser/annotate';
|
|
26
|
+
import { nextShapeId } from '@/client/hooks/browser/use-annotate';
|
|
27
|
+
import type { AnnotatePoint, AnnotateShape, AnnotateTool } from '@/shared/types';
|
|
28
|
+
|
|
29
|
+
export interface AnnotateLayerProps {
|
|
30
|
+
shapes: AnnotateShape[];
|
|
31
|
+
tool: AnnotateTool;
|
|
32
|
+
selectedId: string | null;
|
|
33
|
+
/** Logical panel size in CSS px (zoom removed), for the prompt. */
|
|
34
|
+
onMeasure: (size: { width: number; height: number }) => void;
|
|
35
|
+
onAdd: (shape: AnnotateShape) => void;
|
|
36
|
+
onSelect: (id: string | null) => void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Below this, a drag is a click: not a region, so it is not a mark. */
|
|
40
|
+
const MIN_DRAG_PX = 4;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Marks are drawn with the error colour, the one chroma the palette allows
|
|
44
|
+
* outside Shiki. A mark is a complaint about the page, and it must not read as
|
|
45
|
+
* part of the page it is drawn over.
|
|
46
|
+
*/
|
|
47
|
+
const MARK_COLOR = 'var(--theme-error)';
|
|
48
|
+
|
|
49
|
+
export function AnnotateLayer({ shapes, tool, selectedId, onMeasure, onAdd, onSelect }: AnnotateLayerProps) {
|
|
50
|
+
const surfaceRef = useRef<HTMLDivElement | null>(null);
|
|
51
|
+
// The mark being dragged lives in a REF, and the state copy exists only to
|
|
52
|
+
// paint it. A pointerdown → pointerup pair that lands inside one frame would
|
|
53
|
+
// otherwise read the closure's `null` draft and drop the mark: measured with
|
|
54
|
+
// this component's own tests, a fast drag never reached `onAdd`.
|
|
55
|
+
const draftRef = useRef<AnnotateShape | null>(null);
|
|
56
|
+
const [draft, setDraft] = useState<AnnotateShape | null>(null);
|
|
57
|
+
const [box, setBox] = useState({ width: 0, height: 0 });
|
|
58
|
+
|
|
59
|
+
// The panel's own size, reported on every resize so the prompt states the box
|
|
60
|
+
// the marks were actually drawn against.
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
const surface = surfaceRef.current;
|
|
63
|
+
if (!surface) return;
|
|
64
|
+
const report = () => {
|
|
65
|
+
const rect = surface.getBoundingClientRect();
|
|
66
|
+
if (rect.width <= 0 || rect.height <= 0) return;
|
|
67
|
+
setBox((prev) => (prev.width === rect.width && prev.height === rect.height ? prev : { width: rect.width, height: rect.height }));
|
|
68
|
+
onMeasure({ width: rect.width, height: rect.height });
|
|
69
|
+
};
|
|
70
|
+
report();
|
|
71
|
+
if (typeof ResizeObserver !== 'function') return;
|
|
72
|
+
const observer = new ResizeObserver(report);
|
|
73
|
+
observer.observe(surface);
|
|
74
|
+
return () => observer.disconnect();
|
|
75
|
+
}, [onMeasure]);
|
|
76
|
+
|
|
77
|
+
const pointOf = (event: PointerEvent): { normalized: AnnotatePoint; px: number; py: number } | null => {
|
|
78
|
+
const surface = surfaceRef.current;
|
|
79
|
+
if (!surface) return null;
|
|
80
|
+
const rect = surface.getBoundingClientRect();
|
|
81
|
+
const local = { x: event.clientX - rect.left, y: event.clientY - rect.top };
|
|
82
|
+
return { normalized: normalizePoint(rect, local), px: local.x, py: local.y };
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const handlePointerDown = (event: PointerEvent) => {
|
|
86
|
+
if (event.button !== 0) return;
|
|
87
|
+
const point = pointOf(event);
|
|
88
|
+
if (!point) return;
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
onSelect(null);
|
|
91
|
+
(event.currentTarget as HTMLElement).setPointerCapture?.(event.pointerId);
|
|
92
|
+
const next: AnnotateShape = { id: nextShapeId(), tool, start: point.normalized, end: point.normalized, label: '', note: '' };
|
|
93
|
+
draftRef.current = next;
|
|
94
|
+
setDraft(next);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const handlePointerMove = (event: PointerEvent) => {
|
|
98
|
+
const current = draftRef.current;
|
|
99
|
+
if (!current) return;
|
|
100
|
+
const point = pointOf(event);
|
|
101
|
+
if (!point) return;
|
|
102
|
+
const next = { ...current, end: point.normalized };
|
|
103
|
+
draftRef.current = next;
|
|
104
|
+
setDraft(next);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const handlePointerUp = (event: PointerEvent) => {
|
|
108
|
+
const current = draftRef.current;
|
|
109
|
+
if (!current) return;
|
|
110
|
+
const point = pointOf(event);
|
|
111
|
+
const finished = point ? { ...current, end: point.normalized } : current;
|
|
112
|
+
draftRef.current = null;
|
|
113
|
+
setDraft(null);
|
|
114
|
+
(event.currentTarget as HTMLElement).releasePointerCapture?.(event.pointerId);
|
|
115
|
+
// A click with no drag is not a region. A pin IS a point, so it always counts.
|
|
116
|
+
if (finished.tool !== 'pin') {
|
|
117
|
+
const rect = surfaceRef.current?.getBoundingClientRect();
|
|
118
|
+
const dragPx = rect
|
|
119
|
+
? Math.hypot((finished.end.x - finished.start.x) * rect.width, (finished.end.y - finished.start.y) * rect.height)
|
|
120
|
+
: 0;
|
|
121
|
+
if (dragPx < MIN_DRAG_PX) return;
|
|
122
|
+
}
|
|
123
|
+
onAdd(finished);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const cancel = () => {
|
|
127
|
+
draftRef.current = null;
|
|
128
|
+
setDraft(null);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const painted = draft ? [...shapes, draft] : shapes;
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<div
|
|
135
|
+
ref={surfaceRef}
|
|
136
|
+
className="absolute inset-0 cursor-crosshair touch-none"
|
|
137
|
+
onPointerDown={handlePointerDown}
|
|
138
|
+
onPointerMove={handlePointerMove}
|
|
139
|
+
onPointerUp={handlePointerUp}
|
|
140
|
+
onPointerCancel={cancel}
|
|
141
|
+
>
|
|
142
|
+
<svg
|
|
143
|
+
className="absolute inset-0 w-full h-full"
|
|
144
|
+
viewBox={`0 0 ${Math.max(1, box.width)} ${Math.max(1, box.height)}`}
|
|
145
|
+
preserveAspectRatio="none"
|
|
146
|
+
aria-label="Area anotasi halaman"
|
|
147
|
+
>
|
|
148
|
+
{painted.map((shape, index) => (
|
|
149
|
+
<ShapeMark
|
|
150
|
+
key={shape.id}
|
|
151
|
+
shape={shape}
|
|
152
|
+
index={index + 1}
|
|
153
|
+
box={box}
|
|
154
|
+
selected={shape.id === selectedId}
|
|
155
|
+
onSelect={() => onSelect(shape.id)}
|
|
156
|
+
/>
|
|
157
|
+
))}
|
|
158
|
+
</svg>
|
|
159
|
+
</div>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
interface ShapeMarkProps {
|
|
164
|
+
shape: AnnotateShape;
|
|
165
|
+
index: number;
|
|
166
|
+
box: { width: number; height: number };
|
|
167
|
+
selected: boolean;
|
|
168
|
+
onSelect: () => void;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* One mark. The number is drawn at the mark's own anchor so the prompt's
|
|
173
|
+
* "1." can be found on screen without reading the whole overlay.
|
|
174
|
+
*/
|
|
175
|
+
function ShapeMark({ shape, index, box, selected, onSelect }: ShapeMarkProps) {
|
|
176
|
+
const start = { x: shape.start.x * box.width, y: shape.start.y * box.height };
|
|
177
|
+
const end = { x: shape.end.x * box.width, y: shape.end.y * box.height };
|
|
178
|
+
const region = shapeRegion(shape);
|
|
179
|
+
const stroke = selected ? 3 : 2;
|
|
180
|
+
const label = String(index);
|
|
181
|
+
|
|
182
|
+
const select = (event: PointerEvent) => {
|
|
183
|
+
event.stopPropagation();
|
|
184
|
+
event.preventDefault();
|
|
185
|
+
onSelect();
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<g onPointerDown={select} className="cursor-pointer">
|
|
190
|
+
{shape.tool === 'box' && (
|
|
191
|
+
<rect
|
|
192
|
+
x={region.x * box.width}
|
|
193
|
+
y={region.y * box.height}
|
|
194
|
+
width={Math.max(1, region.width * box.width)}
|
|
195
|
+
height={Math.max(1, region.height * box.height)}
|
|
196
|
+
fill={MARK_COLOR}
|
|
197
|
+
fillOpacity={selected ? 0.16 : 0.1}
|
|
198
|
+
stroke={MARK_COLOR}
|
|
199
|
+
strokeWidth={stroke}
|
|
200
|
+
vectorEffect="non-scaling-stroke"
|
|
201
|
+
rx={3}
|
|
202
|
+
/>
|
|
203
|
+
)}
|
|
204
|
+
{shape.tool === 'arrow' && (
|
|
205
|
+
<>
|
|
206
|
+
<line x1={start.x} y1={start.y} x2={end.x} y2={end.y} stroke={MARK_COLOR} strokeWidth={stroke} vectorEffect="non-scaling-stroke" />
|
|
207
|
+
<circle cx={end.x} cy={end.y} r={4} fill={MARK_COLOR} />
|
|
208
|
+
</>
|
|
209
|
+
)}
|
|
210
|
+
{shape.tool === 'pin' && <circle cx={start.x} cy={start.y} r={7} fill={MARK_COLOR} fillOpacity={selected ? 0.5 : 0.3} stroke={MARK_COLOR} strokeWidth={stroke} />}
|
|
211
|
+
<circle cx={start.x} cy={start.y} r={9} fill={MARK_COLOR} />
|
|
212
|
+
<text x={start.x} y={start.y} textAnchor="middle" dominantBaseline="central" fontSize={11} fontWeight={700} fill="var(--theme-paper)">
|
|
213
|
+
{label}
|
|
214
|
+
</text>
|
|
215
|
+
</g>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Naming one mark: which part of the page it is, what is wrong there, and what
|
|
8
|
+
* the panel could read underneath it.
|
|
9
|
+
*
|
|
10
|
+
* The label is the user's own vocabulary and is always available; the element
|
|
11
|
+
* is only available when the frame happens to be same-origin. Those are two
|
|
12
|
+
* different facts and the panel states them separately — a missing element is
|
|
13
|
+
* never rendered as a blank or as "unknown", because the reason (cross-origin,
|
|
14
|
+
* or nothing under the mark) changes what the agent should do next.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { ANNOTATE_LABEL_SUGGESTIONS, ANNOTATE_TOOL_LABEL } from '@/shared/lib/browser/annotate';
|
|
18
|
+
import type { AnnotateShape } from '@/shared/types';
|
|
19
|
+
import type { ElementAtResult } from '@/client/lib/browser/element-at';
|
|
20
|
+
|
|
21
|
+
interface AnnotateTargetProps {
|
|
22
|
+
shape: AnnotateShape;
|
|
23
|
+
index: number;
|
|
24
|
+
/** The last element resolution, which is what says WHY an element is absent. */
|
|
25
|
+
readability: ElementAtResult | null;
|
|
26
|
+
onLabel: (label: string) => void;
|
|
27
|
+
onNote: (note: string) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const FIELD =
|
|
31
|
+
'w-full min-w-0 bg-canvas border border-ink/15 rounded px-2 py-1 text-[11px] font-mono text-ink placeholder:text-ink/35 focus:outline-none focus:border-ink/40';
|
|
32
|
+
|
|
33
|
+
/** Why the marked spot carries no element, in words the user can act on. */
|
|
34
|
+
export function missingElementReason(readability: ElementAtResult | null): string | null {
|
|
35
|
+
if (!readability || readability.ok) return null;
|
|
36
|
+
if (readability.reason === 'cross-origin') return 'Halaman ini beda origin — elemen tidak bisa dibaca, cukup beri nama bagian + catatan.';
|
|
37
|
+
if (readability.reason === 'no-frame') return 'Halaman belum dimuat — elemen belum bisa dibaca.';
|
|
38
|
+
return 'Di titik ini tidak ada elemen (ruang kosong) — beri nama bagiannya.';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function AnnotateTarget({ shape, index, readability, onLabel, onNote }: AnnotateTargetProps) {
|
|
42
|
+
const reason = missingElementReason(readability);
|
|
43
|
+
const element = shape.element;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className="flex items-start gap-1.5 min-w-0">
|
|
47
|
+
<span className="text-[11px] font-mono text-ink/45 pt-1 flex-shrink-0">
|
|
48
|
+
{ANNOTATE_TOOL_LABEL[shape.tool]} #{index}
|
|
49
|
+
</span>
|
|
50
|
+
|
|
51
|
+
<div className="flex-1 min-w-0 space-y-1">
|
|
52
|
+
<div className="flex items-center gap-1 flex-wrap">
|
|
53
|
+
<span className="text-[10px] uppercase font-mono text-ink/40">bagian</span>
|
|
54
|
+
{ANNOTATE_LABEL_SUGGESTIONS.map((suggestion) => {
|
|
55
|
+
const picked = shape.label === suggestion;
|
|
56
|
+
return (
|
|
57
|
+
<button
|
|
58
|
+
key={suggestion}
|
|
59
|
+
type="button"
|
|
60
|
+
onClick={() => onLabel(picked ? '' : suggestion)}
|
|
61
|
+
aria-pressed={picked}
|
|
62
|
+
className={`px-1.5 py-0.5 rounded-full border text-[10px] font-mono transition-colors cursor-pointer ${
|
|
63
|
+
picked ? 'bg-ink text-canvas border-ink' : 'bg-canvas text-ink/65 border-ink/15 hover:border-ink/40'
|
|
64
|
+
}`}
|
|
65
|
+
>
|
|
66
|
+
{suggestion}
|
|
67
|
+
</button>
|
|
68
|
+
);
|
|
69
|
+
})}
|
|
70
|
+
<input
|
|
71
|
+
value={shape.label}
|
|
72
|
+
onInput={(event) => onLabel(event.currentTarget.value)}
|
|
73
|
+
placeholder="atau ketik sendiri…"
|
|
74
|
+
aria-label="Nama bagian yang ditandai"
|
|
75
|
+
spellcheck={false}
|
|
76
|
+
className={`${FIELD} flex-1 min-w-[110px]`}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<textarea
|
|
81
|
+
value={shape.note}
|
|
82
|
+
onInput={(event) => onNote(event.currentTarget.value)}
|
|
83
|
+
placeholder="Apa yang salah di bagian ini? (mis. tombol Bayar terlihat nonaktif)"
|
|
84
|
+
rows={2}
|
|
85
|
+
aria-label="Catatan anotasi"
|
|
86
|
+
className={`${FIELD} resize-y`}
|
|
87
|
+
/>
|
|
88
|
+
|
|
89
|
+
{element ? (
|
|
90
|
+
<p className="text-[10px] font-mono text-ink/45 truncate" title={element.path}>
|
|
91
|
+
elemen: {element.path}
|
|
92
|
+
{element.state ? ` · ${element.state}` : ''}
|
|
93
|
+
</p>
|
|
94
|
+
) : null}
|
|
95
|
+
{reason ? <p className="text-[10px] text-ink/40">{reason}</p> : null}
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Globe, Loader2 } from 'lucide-preact';
|
|
2
2
|
import { VIEWPORT_CLASSES } from '@/client/components/common/viewport';
|
|
3
|
+
import type { ComponentChildren } from 'preact';
|
|
3
4
|
import type { ViewportMode } from '@/shared/types';
|
|
4
5
|
|
|
5
6
|
interface UserBrowserFrameProps {
|
|
@@ -12,6 +13,14 @@ interface UserBrowserFrameProps {
|
|
|
12
13
|
/** False while the panel is hidden: no iframe is mounted, so a background
|
|
13
14
|
* page cannot keep loading scripts or animating behind the panel. */
|
|
14
15
|
active?: boolean;
|
|
16
|
+
/** The annotation surface, rendered over the page while the mode is on. */
|
|
17
|
+
overlay?: ComponentChildren;
|
|
18
|
+
/**
|
|
19
|
+
* The live `<iframe>`. A mark's element is read through this handle, which is
|
|
20
|
+
* why it is reported rather than left to a query across the DOM: only THIS
|
|
21
|
+
* frame holds the page the user is annotating.
|
|
22
|
+
*/
|
|
23
|
+
onFrame?: (frame: HTMLIFrameElement | null) => void;
|
|
15
24
|
}
|
|
16
25
|
|
|
17
26
|
const ALLOW = 'clipboard-read; clipboard-write; fullscreen';
|
|
@@ -20,8 +29,22 @@ const ALLOW = 'clipboard-read; clipboard-write; fullscreen';
|
|
|
20
29
|
* The user's browsing surface: a plain iframe. Interaction (scroll, click,
|
|
21
30
|
* typing, cookies, logins) is the browser's own, so this costs nothing to keep
|
|
22
31
|
* mounted. Cross-origin pages cannot read this app, and vice versa.
|
|
32
|
+
*
|
|
33
|
+
* The annotation overlay is a child of the wrapper that carries the zoom and
|
|
34
|
+
* the viewport preset, so `inset: 0` covers the page exactly at every scale —
|
|
35
|
+
* measured in Chromium at 150%: iframe 900×450, overlay 900×450.
|
|
23
36
|
*/
|
|
24
|
-
export function UserBrowserFrame({
|
|
37
|
+
export function UserBrowserFrame({
|
|
38
|
+
url,
|
|
39
|
+
frameKey,
|
|
40
|
+
loading,
|
|
41
|
+
viewportMode,
|
|
42
|
+
zoomLevel,
|
|
43
|
+
onLoad,
|
|
44
|
+
active = true,
|
|
45
|
+
overlay,
|
|
46
|
+
onFrame,
|
|
47
|
+
}: UserBrowserFrameProps) {
|
|
25
48
|
if (!active) return null;
|
|
26
49
|
if (!url) {
|
|
27
50
|
return (
|
|
@@ -59,13 +82,19 @@ export function UserBrowserFrame({ url, frameKey, loading, viewportMode, zoomLev
|
|
|
59
82
|
>
|
|
60
83
|
<iframe
|
|
61
84
|
key={frameKey}
|
|
85
|
+
ref={(node: HTMLIFrameElement | null) => onFrame?.(node)}
|
|
62
86
|
src={url}
|
|
63
87
|
title="Browser pengguna"
|
|
64
88
|
onLoad={onLoad}
|
|
65
89
|
referrerPolicy="no-referrer"
|
|
66
90
|
allow={ALLOW}
|
|
67
91
|
className="w-full h-full bg-white border-0"
|
|
92
|
+
// While annotating, the page must not receive a drag: the overlay owns
|
|
93
|
+
// every pointer event, and a click reaching the page would navigate the
|
|
94
|
+
// user away from the thing they were marking.
|
|
95
|
+
style={overlay ? { pointerEvents: 'none' } : undefined}
|
|
68
96
|
/>
|
|
97
|
+
{overlay}
|
|
69
98
|
</div>
|
|
70
99
|
</div>
|
|
71
100
|
);
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { useCallback } from 'preact/hooks';
|
|
1
|
+
import { useCallback, useState } from 'preact/hooks';
|
|
2
2
|
import { UserBrowserAddressBar } from '@/client/components/workspace/user-browser-panel/AddressBar';
|
|
3
3
|
import { UserBrowserFrame } from '@/client/components/workspace/user-browser-panel/Frame';
|
|
4
|
+
import { AnnotateBar } from '@/client/components/workspace/user-browser-panel/AnnotateBar';
|
|
5
|
+
import { AnnotateLayer } from '@/client/components/workspace/user-browser-panel/AnnotateLayer';
|
|
4
6
|
import { useUserBrowser } from '@/client/hooks/browser/use-user-browser';
|
|
7
|
+
import { elementAtPoint, type ElementAtResult } from '@/client/lib/browser/element-at';
|
|
8
|
+
import { useAnnotate } from '@/client/hooks/browser/use-annotate';
|
|
5
9
|
import { useSessionState } from '@/client/hooks/workspace/session-state';
|
|
6
10
|
import { emitBrowserPageContext } from '@/shared/lib/browser/page-context';
|
|
7
|
-
import type { ViewportMode } from '@/shared/types';
|
|
11
|
+
import type { AnnotateShape, ViewportMode } from '@/shared/types';
|
|
8
12
|
|
|
9
13
|
interface UserBrowserPanelProps {
|
|
10
14
|
className?: string;
|
|
@@ -19,10 +23,18 @@ interface UserBrowserPanelProps {
|
|
|
19
23
|
* It is private to the user — the omp agent has no handle to this frame. Sites
|
|
20
24
|
* that forbid embedding (Google, GitHub) show an empty frame; the toolbar's
|
|
21
25
|
* open-in-new-tab action is the escape hatch for those.
|
|
26
|
+
*
|
|
27
|
+
* Annotating it therefore hands the agent GEOMETRY, not a picture: the page is
|
|
28
|
+
* cross-origin, so nothing here can read or paint it (see `shared/lib/browser/annotate.ts`).
|
|
22
29
|
*/
|
|
23
30
|
export function UserBrowserPanel({ className = '', active = true }: UserBrowserPanelProps) {
|
|
24
31
|
const [viewportMode, setViewportMode] = useSessionState<ViewportMode>('userBrowser.viewportMode', 'responsive');
|
|
25
32
|
const [zoomLevel, setZoomLevel] = useSessionState<number>('userBrowser.zoomLevel', 100);
|
|
33
|
+
const [panelSize, setPanelSize] = useState<{ width: number; height: number } | null>(null);
|
|
34
|
+
// The frame the marks are drawn over, needed to read the element under one.
|
|
35
|
+
const [frame, setFrame] = useState<HTMLIFrameElement | null>(null);
|
|
36
|
+
// How the LAST lookup went, so the bar can say why a mark has no element.
|
|
37
|
+
const [readability, setReadability] = useState<ElementAtResult | null>(null);
|
|
26
38
|
const {
|
|
27
39
|
url,
|
|
28
40
|
input,
|
|
@@ -38,6 +50,7 @@ export function UserBrowserPanel({ className = '', active = true }: UserBrowserP
|
|
|
38
50
|
reload,
|
|
39
51
|
markLoaded,
|
|
40
52
|
} = useUserBrowser();
|
|
53
|
+
const annotate = useAnnotate(frameKey);
|
|
41
54
|
|
|
42
55
|
const handleOpenExternal = useCallback(() => {
|
|
43
56
|
if (!url) return;
|
|
@@ -49,6 +62,41 @@ export function UserBrowserPanel({ className = '', active = true }: UserBrowserP
|
|
|
49
62
|
emitBrowserPageContext({ url });
|
|
50
63
|
}, [url]);
|
|
51
64
|
|
|
65
|
+
const handleMeasure = useCallback((size: { width: number; height: number }) => {
|
|
66
|
+
setPanelSize((prev) => (prev && prev.width === size.width && prev.height === size.height ? prev : size));
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
// The element is resolved at the mark's own anchor, the moment it is drawn:
|
|
70
|
+
// the page can change under a mark, and a lookup deferred to Send would
|
|
71
|
+
// describe whatever the page became, not what the user pointed at. A frame
|
|
72
|
+
// that is not same-origin answers a reason instead, and the bar states it.
|
|
73
|
+
const handleAddShape = useCallback((shape: AnnotateShape) => {
|
|
74
|
+
const resolution = elementAtPoint(frame, shape.start);
|
|
75
|
+
setReadability(resolution);
|
|
76
|
+
annotate.add(resolution.ok ? { ...shape, element: resolution.element } : shape);
|
|
77
|
+
}, [annotate, frame]);
|
|
78
|
+
|
|
79
|
+
// The marks travel with the panel box they were normalized against: `12%` of
|
|
80
|
+
// a laptop and `12%` of a phone are different places, and CSS zoom is undone
|
|
81
|
+
// here so the agent receives the page's own size rather than the display's.
|
|
82
|
+
const handleSendAnnotations = useCallback(() => {
|
|
83
|
+
if (!url || annotate.shapes.length === 0) return;
|
|
84
|
+
const scale = zoomLevel / 100;
|
|
85
|
+
emitBrowserPageContext({
|
|
86
|
+
url,
|
|
87
|
+
annotations: annotate.shapes,
|
|
88
|
+
panel: {
|
|
89
|
+
width: (panelSize?.width ?? 0) / scale,
|
|
90
|
+
height: (panelSize?.height ?? 0) / scale,
|
|
91
|
+
viewportMode,
|
|
92
|
+
zoom: zoomLevel,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
annotate.close();
|
|
96
|
+
}, [url, annotate, panelSize, viewportMode, zoomLevel]);
|
|
97
|
+
|
|
98
|
+
const annotateActive = annotate.active && Boolean(url);
|
|
99
|
+
|
|
52
100
|
return (
|
|
53
101
|
<div className={`flex flex-col h-full w-full bg-paper text-ink overflow-hidden ${className}`}>
|
|
54
102
|
<UserBrowserAddressBar
|
|
@@ -72,7 +120,27 @@ export function UserBrowserPanel({ className = '', active = true }: UserBrowserP
|
|
|
72
120
|
onZoomOut={() => setZoomLevel((prev) => Math.max(50, prev - 10))}
|
|
73
121
|
onResetZoom={() => setZoomLevel(100)}
|
|
74
122
|
onSetZoom={setZoomLevel}
|
|
123
|
+
annotate={{
|
|
124
|
+
active: annotateActive,
|
|
125
|
+
count: annotate.shapes.length,
|
|
126
|
+
onToggle: annotate.toggle,
|
|
127
|
+
}}
|
|
75
128
|
/>
|
|
129
|
+
{annotateActive && (
|
|
130
|
+
<AnnotateBar
|
|
131
|
+
tool={annotate.tool}
|
|
132
|
+
shapes={annotate.shapes}
|
|
133
|
+
selectedId={annotate.selectedId}
|
|
134
|
+
readability={readability}
|
|
135
|
+
onTool={annotate.setTool}
|
|
136
|
+
onLabel={annotate.setLabel}
|
|
137
|
+
onNote={annotate.setNote}
|
|
138
|
+
onRemove={annotate.remove}
|
|
139
|
+
onReset={annotate.reset}
|
|
140
|
+
onCancel={annotate.close}
|
|
141
|
+
onSend={handleSendAnnotations}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
76
144
|
<UserBrowserFrame
|
|
77
145
|
url={url}
|
|
78
146
|
frameKey={frameKey}
|
|
@@ -80,7 +148,18 @@ export function UserBrowserPanel({ className = '', active = true }: UserBrowserP
|
|
|
80
148
|
viewportMode={viewportMode}
|
|
81
149
|
zoomLevel={zoomLevel}
|
|
82
150
|
onLoad={markLoaded}
|
|
151
|
+
onFrame={setFrame}
|
|
83
152
|
active={active}
|
|
153
|
+
overlay={annotateActive ? (
|
|
154
|
+
<AnnotateLayer
|
|
155
|
+
shapes={annotate.shapes}
|
|
156
|
+
tool={annotate.tool}
|
|
157
|
+
selectedId={annotate.selectedId}
|
|
158
|
+
onMeasure={handleMeasure}
|
|
159
|
+
onAdd={handleAddShape}
|
|
160
|
+
onSelect={annotate.select}
|
|
161
|
+
/>
|
|
162
|
+
) : null}
|
|
84
163
|
/>
|
|
85
164
|
</div>
|
|
86
165
|
);
|
|
@@ -7,11 +7,6 @@ export const builtinAgents: AgentItem[] = [
|
|
|
7
7
|
name: 'explore',
|
|
8
8
|
description: 'Contextual grep for codebases. Locates keywords, definitions, and code structures.',
|
|
9
9
|
scope: 'system',
|
|
10
|
-
mode: 'subagent',
|
|
11
|
-
overrideModel: 'Not selected',
|
|
12
|
-
thinkingVariant: 'default',
|
|
13
|
-
temperature: null,
|
|
14
|
-
topP: null,
|
|
15
10
|
systemPrompt: `You are an expert exploratory assistant designed to quickly search, grep, and analyze codebases without modifying files. Report precise file paths and line numbers.`,
|
|
16
11
|
isBuiltIn: true,
|
|
17
12
|
},
|
|
@@ -20,11 +15,6 @@ export const builtinAgents: AgentItem[] = [
|
|
|
20
15
|
name: 'general',
|
|
21
16
|
description: 'General-purpose agent untuk multi-turn development, edits, and refactoring.',
|
|
22
17
|
scope: 'system',
|
|
23
|
-
mode: 'all',
|
|
24
|
-
overrideModel: 'Not selected',
|
|
25
|
-
thinkingVariant: 'default',
|
|
26
|
-
temperature: null,
|
|
27
|
-
topP: null,
|
|
28
18
|
systemPrompt: `You are a general-purpose programming assistant. Solve tasks concisely, edit code surgically, and preserve formatting conventions.`,
|
|
29
19
|
isBuiltIn: true,
|
|
30
20
|
},
|
|
@@ -7,11 +7,6 @@ export const orchestratorAgents: AgentItem[] = [
|
|
|
7
7
|
name: 'Sisyphus - ultraworker',
|
|
8
8
|
description: 'Powerful AI orchestrator. Plans, coordinates subagents, and drives feature implementations.',
|
|
9
9
|
scope: 'user',
|
|
10
|
-
mode: 'primary',
|
|
11
|
-
overrideModel: 'Not selected',
|
|
12
|
-
thinkingVariant: 'default',
|
|
13
|
-
temperature: null,
|
|
14
|
-
topP: null,
|
|
15
10
|
systemPrompt: `You are Sisyphus, an elite autonomous software orchestrator. Analyze the whole problem, formulate a phased plan, and lead execution with zero regression.`,
|
|
16
11
|
},
|
|
17
12
|
{
|
|
@@ -19,11 +14,6 @@ export const orchestratorAgents: AgentItem[] = [
|
|
|
19
14
|
name: 'Prometheus - Plan Builder',
|
|
20
15
|
description: 'Planning and analysis without changes. Outlines architecture and verification gates.',
|
|
21
16
|
scope: 'user',
|
|
22
|
-
mode: 'subagent',
|
|
23
|
-
overrideModel: 'Not selected',
|
|
24
|
-
thinkingVariant: 'default',
|
|
25
|
-
temperature: null,
|
|
26
|
-
topP: null,
|
|
27
17
|
systemPrompt: `You are Prometheus. Produce detailed, step-by-step engineering blueprints. Never apply code modifications directly.`,
|
|
28
18
|
},
|
|
29
19
|
{
|
|
@@ -31,11 +21,6 @@ export const orchestratorAgents: AgentItem[] = [
|
|
|
31
21
|
name: 'Atlas - Plan Executor',
|
|
32
22
|
description: 'Orchestrates work via task() to subagents, executes stages sequentially.',
|
|
33
23
|
scope: 'user',
|
|
34
|
-
mode: 'subagent',
|
|
35
|
-
overrideModel: 'Not selected',
|
|
36
|
-
thinkingVariant: 'default',
|
|
37
|
-
temperature: null,
|
|
38
|
-
topP: null,
|
|
39
24
|
systemPrompt: `You are Atlas. You receive architectural blueprints and drive execution across subagents, tracking completion at each milestone.`,
|
|
40
25
|
},
|
|
41
26
|
{
|
|
@@ -43,11 +28,6 @@ export const orchestratorAgents: AgentItem[] = [
|
|
|
43
28
|
name: 'Metis - Plan Consultant',
|
|
44
29
|
description: 'Pre-planning consultant that analyzes edge cases, prerequisites, and risks.',
|
|
45
30
|
scope: 'user',
|
|
46
|
-
mode: 'subagent',
|
|
47
|
-
overrideModel: 'Not selected',
|
|
48
|
-
thinkingVariant: 'default',
|
|
49
|
-
temperature: null,
|
|
50
|
-
topP: null,
|
|
51
31
|
systemPrompt: `You are Metis. You identify hidden blockers, security concerns, race conditions, and edge cases prior to implementation.`,
|
|
52
32
|
},
|
|
53
33
|
{
|
|
@@ -55,11 +35,6 @@ export const orchestratorAgents: AgentItem[] = [
|
|
|
55
35
|
name: 'Momus - Plan Critic',
|
|
56
36
|
description: 'Expert reviewer for evaluating work, code consistency, and architecture.',
|
|
57
37
|
scope: 'user',
|
|
58
|
-
mode: 'subagent',
|
|
59
|
-
overrideModel: 'Not selected',
|
|
60
|
-
thinkingVariant: 'default',
|
|
61
|
-
temperature: null,
|
|
62
|
-
topP: null,
|
|
63
38
|
systemPrompt: `You are Momus, a rigorous plan and code critic. Scrutinize proposals and output candid, prioritized critiques.`,
|
|
64
39
|
},
|
|
65
40
|
{
|
|
@@ -67,11 +42,6 @@ export const orchestratorAgents: AgentItem[] = [
|
|
|
67
42
|
name: 'Sisyphus-Junior',
|
|
68
43
|
description: 'Focused task executor. Same discipline as Sisyphus but scoped to atomic modules.',
|
|
69
44
|
scope: 'user',
|
|
70
|
-
mode: 'subagent',
|
|
71
|
-
overrideModel: 'Not selected',
|
|
72
|
-
thinkingVariant: 'default',
|
|
73
|
-
temperature: null,
|
|
74
|
-
topP: null,
|
|
75
45
|
systemPrompt: `You are Sisyphus-Junior. You focus on single, atomic implementation tasks and report back cleanly to parent orchestrators.`,
|
|
76
46
|
},
|
|
77
47
|
{
|
|
@@ -79,11 +49,6 @@ export const orchestratorAgents: AgentItem[] = [
|
|
|
79
49
|
name: 'architect',
|
|
80
50
|
description: 'System architect untuk design, planning, dan architectural blueprints.',
|
|
81
51
|
scope: 'user',
|
|
82
|
-
mode: 'all',
|
|
83
|
-
overrideModel: 'Not selected',
|
|
84
|
-
thinkingVariant: 'default',
|
|
85
|
-
temperature: null,
|
|
86
|
-
topP: null,
|
|
87
52
|
systemPrompt: `You are the lead Software Architect. You define modular boundaries, type contracts, and scalable design patterns.`,
|
|
88
53
|
},
|
|
89
54
|
{
|
|
@@ -91,11 +56,6 @@ export const orchestratorAgents: AgentItem[] = [
|
|
|
91
56
|
name: 'code-reviewer',
|
|
92
57
|
description: 'Reviews code untuk best practices, potential bugs, syntax correctness, dan tests.',
|
|
93
58
|
scope: 'user',
|
|
94
|
-
mode: 'subagent',
|
|
95
|
-
overrideModel: 'Not selected',
|
|
96
|
-
thinkingVariant: 'default',
|
|
97
|
-
temperature: null,
|
|
98
|
-
topP: null,
|
|
99
59
|
systemPrompt: `You are a strict Code Reviewer. Check for logic regressions, accessibility, type safety, and clean code style.`,
|
|
100
60
|
},
|
|
101
61
|
{
|
|
@@ -103,11 +63,6 @@ export const orchestratorAgents: AgentItem[] = [
|
|
|
103
63
|
name: 'coder',
|
|
104
64
|
description: 'You are **Coder**, the primary developer agent for rapid writing and debugging.',
|
|
105
65
|
scope: 'user',
|
|
106
|
-
mode: 'primary',
|
|
107
|
-
overrideModel: 'Not selected',
|
|
108
|
-
thinkingVariant: 'default',
|
|
109
|
-
temperature: null,
|
|
110
|
-
topP: null,
|
|
111
66
|
systemPrompt: `You are Coder. Write performant, elegant, and clean code according to project guidelines and modern TypeScript best practices.`,
|
|
112
67
|
},
|
|
113
68
|
];
|