moi-computer 0.9.0 → 0.9.1-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/client/api/app-config.ts +51 -0
  2. package/client/api/workspace-keys.ts +1 -0
  3. package/client/app/routes/WorkspaceRoute.tsx +4 -2
  4. package/client/assets/hermes.png +0 -0
  5. package/client/components/shared/IconGhost.tsx +15 -18
  6. package/client/components/ui/button.tsx +2 -2
  7. package/client/components/ui/hover-card.tsx +1 -1
  8. package/client/components/ui/popover.tsx +3 -1
  9. package/client/features/applets/api.ts +38 -0
  10. package/client/features/applets/applet-thumbnail.ts +208 -0
  11. package/client/features/chat/ChatEmptyState.tsx +30 -10
  12. package/client/features/chat/ChatPanel.tsx +67 -31
  13. package/client/features/chat/ChatPopup.tsx +3 -2
  14. package/client/features/chat/ChatPromptBubbles.tsx +1 -1
  15. package/client/features/chat/ChatSelector.tsx +29 -10
  16. package/client/features/chat/MarkdownContent.tsx +3 -3
  17. package/client/features/chat/attachment-staging.ts +153 -0
  18. package/client/features/chat/chat-send.ts +55 -0
  19. package/client/features/chat/chat-store.ts +32 -8
  20. package/client/features/chat/composer/ChatComposer.tsx +190 -77
  21. package/client/features/chat/{ModelPicker.tsx → composer/ModelPicker.tsx} +29 -25
  22. package/client/features/chat/composer/banners/ComposerBanner.tsx +1 -1
  23. package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +4 -13
  24. package/client/features/chat/{model-order.ts → composer/model-order.ts} +16 -0
  25. package/client/features/chat/composer/useWorkspaceComposerState.tsx +9 -4
  26. package/client/features/chat/tool-group/format/claude.ts +48 -0
  27. package/client/features/chat/tool-group/format/codex.ts +126 -0
  28. package/client/features/chat/tool-group/format/hermes.ts +68 -0
  29. package/client/features/chat/tool-group/format/index.ts +34 -0
  30. package/client/features/chat/tool-group/format/mcp.ts +64 -0
  31. package/client/features/chat/tool-group/format/openclaw.ts +116 -0
  32. package/client/features/chat/tool-group/format/shared.ts +49 -0
  33. package/client/features/chat/useChat.ts +5 -10
  34. package/client/features/drawings/DrawingLayer.tsx +49 -0
  35. package/client/features/drawings/DrawingToolbar.tsx +95 -0
  36. package/client/features/drawings/capture-element.ts +45 -0
  37. package/client/features/drawings/useChatAnnotation.ts +222 -0
  38. package/client/features/drawings/useDrawingLayer.ts +758 -0
  39. package/client/features/drawings/useViewBuilderSketch.ts +151 -0
  40. package/client/features/home/HomePage.tsx +13 -0
  41. package/client/features/home/WorkspacePreview.tsx +10 -5
  42. package/client/features/home/workspace-presentation.tsx +6 -2
  43. package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +9 -0
  44. package/client/features/home/workspace-setup/InstallMoiDialog.tsx +245 -0
  45. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +13 -7
  46. package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +1 -1
  47. package/client/features/scratchpad/ScratchpadControls.tsx +19 -5
  48. package/client/features/views/ViewBuilder.tsx +238 -0
  49. package/client/features/views/ViewManager.tsx +18 -2
  50. package/client/features/views/api.ts +1 -0
  51. package/client/features/views/useViewBuilderActions.ts +24 -3
  52. package/client/features/views/useViewBuilderDrafts.ts +66 -0
  53. package/client/features/widgets/WidgetFrame.tsx +1 -1
  54. package/client/features/widgets/WidgetGrid.tsx +1 -1
  55. package/client/features/widgets/Widgets.tsx +39 -54
  56. package/client/features/workspace/CustomizePanel.tsx +30 -9
  57. package/client/features/workspace/WorkspaceScreen.tsx +158 -64
  58. package/client/features/workspace/WorkspaceTabs.tsx +3 -3
  59. package/client/features/workspace/useFitsSplitLayout.ts +14 -8
  60. package/client/index.css +8 -0
  61. package/client/index.tsx +6 -1
  62. package/client/runtime/useWorkspaceEvents.ts +17 -0
  63. package/client/runtime/workspace-theme.ts +29 -6
  64. package/client/store/ui.ts +19 -0
  65. package/client/theme.css +33 -8
  66. package/dist/chunk-5c19v3zr.js +10 -0
  67. package/dist/chunk-6wx91x8j.js +1 -0
  68. package/dist/chunk-8s41nd3g.js +1 -0
  69. package/dist/{chunk-kkj86722.js → chunk-a7fzp0z0.js} +78 -78
  70. package/dist/{chunk-2vaafjp4.js → chunk-b959mdkj.js} +1 -1
  71. package/dist/chunk-cagtq45k.js +1 -0
  72. package/dist/chunk-cva7jpt4.js +82 -0
  73. package/dist/chunk-sapvd7he.css +1 -0
  74. package/dist/{chunk-35fq49qa.js → chunk-zbeq02yc.js} +1 -1
  75. package/dist/chunk-zbt8emsw.js +2 -0
  76. package/dist/chunk-zfz3b4xg.js +2 -0
  77. package/dist/hermes-pznd63x9.png +0 -0
  78. package/dist/index.html +1 -1
  79. package/lib/format.ts +1 -1
  80. package/lib/themes.ts +8 -8
  81. package/lib/types.ts +68 -42
  82. package/lib/workspace-types.ts +2 -1
  83. package/package.json +2 -1
  84. package/server/api.ts +90 -33
  85. package/server/app-config.ts +144 -0
  86. package/server/applets.ts +17 -0
  87. package/server/cli.ts +235 -14
  88. package/server/harness/README.md +64 -17
  89. package/server/harness/acp/adapter.ts +220 -0
  90. package/server/harness/acp/archived.ts +88 -0
  91. package/server/harness/acp/client.ts +328 -0
  92. package/server/harness/acp/discovery.ts +130 -0
  93. package/server/harness/acp/run-durations.ts +68 -0
  94. package/server/harness/acp/session.ts +788 -0
  95. package/server/harness/acp/wire.ts +132 -0
  96. package/server/harness/executable.ts +15 -1
  97. package/server/harness/hermes/NOTES.md +815 -0
  98. package/server/harness/hermes/discovery.ts +155 -0
  99. package/server/harness/hermes/index.ts +155 -0
  100. package/server/harness/hermes/models.ts +79 -0
  101. package/server/harness/registry.ts +3 -1
  102. package/server/layout.ts +40 -45
  103. package/server/moi-scaffold.ts +37 -1
  104. package/server/thumbnails.ts +197 -0
  105. package/server/view-builders.ts +4 -2
  106. package/server/views.ts +10 -1
  107. package/server/widgets.ts +4 -18
  108. package/server/workspace-import.ts +30 -1
  109. package/workspace/.claude/skills/moi-workspace/SKILL.md +13 -1
  110. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +153 -253
  111. package/client/features/chat/tool-group/format.ts +0 -384
  112. package/client/features/views/ViewBuilderTab.tsx +0 -152
  113. package/client/features/widgets/api.ts +0 -47
  114. package/client/features/widgets/useWidgetThumbnails.ts +0 -107
  115. package/client/features/widgets/widget-snapshot.ts +0 -71
  116. package/dist/chunk-3b3rkjet.js +0 -1
  117. package/dist/chunk-gt7n06ef.js +0 -1
  118. package/dist/chunk-ty1sqbmn.js +0 -80
  119. package/dist/chunk-xeyxk7ep.js +0 -10
  120. package/dist/chunk-yz6wd5vc.css +0 -1
@@ -1,107 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react'
2
-
3
- import { useWorkspaceLayoutCtx } from '@/client/features/workspace/WorkspaceLayoutContext'
4
- import { useSaveWidgetThumbnails } from '@/client/features/widgets/api'
5
- import {
6
- captureWidgetThumbnail,
7
- widgetThumbnailsKey
8
- } from '@/client/features/widgets/widget-snapshot'
9
- import type { RefObject } from 'react'
10
- import type { WidgetInfo } from '@/lib/types'
11
-
12
- // Grace period between "the grid changed" and the capture pass — lets widget
13
- // bundles mount and their data requests land so we don't snapshot skeletons.
14
- const SETTLE_MS = 5_000
15
-
16
- // Age-based invalidation: bundle tags only catch CODE changes, but widget
17
- // DATA drifts on its own (a dashboard captured in January still shows
18
- // January). A set older than this re-captures even with a matching key.
19
- const MAX_AGE_MS = 3 * 60 * 60 * 1000
20
-
21
- type UseWidgetThumbnailsArgs = {
22
- // Scope for [data-snapshot-widget] cell lookups.
23
- containerRef: RefObject<HTMLElement | null>
24
- // Widgets query data — supplies each widget's bundle tag.
25
- widgets: WidgetInfo[]
26
- // Widget ids currently on the grid.
27
- visibleIds: string[]
28
- // Edit mode pauses capture (cells wiggle, cards can be mid-drag).
29
- editing: boolean
30
- }
31
-
32
- // Keeps the workspace's widget thumbnails fresh while the Widgets tab is open.
33
- //
34
- // One-number invalidation: the grid state is fingerprinted into a single key
35
- // (visible ids + bundle tags). When the stored key differs, ALL visible
36
- // widgets are re-captured in one pass and saved through their own endpoint
37
- // (PUT .../thumbnails) — the layout PUT never carries the base64 map. The
38
- // key is stamped even if some captures fail, so a broken widget can't loop
39
- // the pass; entries merge server-side and are never pruned.
40
- export function useWidgetThumbnails({
41
- containerRef,
42
- widgets,
43
- visibleIds,
44
- editing
45
- }: UseWidgetThumbnailsArgs) {
46
- const { layout, workspaceId } = useWorkspaceLayoutCtx()
47
- const save = useSaveWidgetThumbnails(workspaceId)
48
- // Latest `mutate` without widening the effect deps (mirrors the saveRef
49
- // pattern in WorkspaceLayoutProvider).
50
- const saveRef = useRef(save.mutate)
51
- saveRef.current = save.mutate
52
- const busyRef = useRef(false)
53
- const [pass, setPass] = useState(0)
54
-
55
- const key = widgetThumbnailsKey(visibleIds, widgets)
56
- // A missing/unparsable timestamp counts as expired.
57
- const capturedAt = Date.parse(layout.widgetThumbnails?.at ?? '')
58
- const expired = !Number.isFinite(capturedAt) || Date.now() - capturedAt > MAX_AGE_MS
59
- const stale = key !== '' && (key !== layout.widgetThumbnails?.key || expired)
60
-
61
- useEffect(() => {
62
- if (!stale || editing) return
63
-
64
- // Hidden tab: timers are throttled and the captured frame may be stale —
65
- // wait for visibility instead, then re-run this effect.
66
- if (document.visibilityState !== 'visible') {
67
- const onVisible = () => setPass(p => p + 1)
68
- document.addEventListener('visibilitychange', onVisible, { once: true })
69
- return () => document.removeEventListener('visibilitychange', onVisible)
70
- }
71
-
72
- // Set when the effect re-runs or unmounts mid-pass (grid changed, tab
73
- // closed). A cancelled pass must not save: its captures are partial, and
74
- // stamping `key` over them would mark the set fresh with images missing.
75
- let cancelled = false
76
- const timer = setTimeout(async () => {
77
- if (busyRef.current) return
78
- busyRef.current = true
79
- try {
80
- const captured: Record<string, string> = {}
81
- for (const id of visibleIds) {
82
- if (cancelled) return
83
- const cell = containerRef.current?.querySelector<HTMLElement>(
84
- `[data-snapshot-widget="${CSS.escape(id)}"]`
85
- )
86
- const image = cell ? await captureWidgetThumbnail(cell) : null
87
- if (image) captured[id] = image
88
- }
89
- if (cancelled) return
90
- // The mutation's onMutate stamps the key into the local layout cache;
91
- // the PUT itself is best-effort (a failed save just means a
92
- // re-capture after reload).
93
- saveRef.current({ key, thumbnails: captured })
94
- } finally {
95
- busyRef.current = false
96
- // Re-evaluate: a pass skipped on `busy`, or a key that moved while
97
- // this pass ran, gets picked up next round; a fresh key is a no-op.
98
- setPass(p => p + 1)
99
- }
100
- }, SETTLE_MS)
101
- return () => {
102
- cancelled = true
103
- clearTimeout(timer)
104
- }
105
- // eslint-disable-next-line react-hooks/exhaustive-deps
106
- }, [key, stale, editing, pass])
107
- }
@@ -1,71 +0,0 @@
1
- // Widget thumbnail capture: renders one live grid cell (tagged with
2
- // `data-snapshot-widget` in WidgetGrid) to a WebP data URL via
3
- // modern-screenshot — white background, the widget's own aspect ratio, frame
4
- // chrome stripped. Shared by the automatic invalidation hook
5
- // (useWidgetThumbnails).
6
- import type { WidgetInfo } from '@/lib/types'
7
-
8
- // Long edge of a stored thumbnail, in output px. Placeholder until the real
9
- // target resolution is decided.
10
- export const THUMB_MAX_EDGE = 400
11
-
12
- // How long modern-screenshot waits per image/asset before rendering without
13
- // it. The library default is 30s, which reads as a hang on any widget whose
14
- // image never loads (lazy-loaded offscreen, CORS-blocked, dead URL).
15
- const ASSET_TIMEOUT_MS = 1_000
16
-
17
- // Hard cap for one widget's whole capture. If it blows past this, the capture
18
- // resolves null and the caller moves on — a snapshot pass must never wedge.
19
- const WIDGET_TIMEOUT_MS = 10_000
20
-
21
- export const thumbnailScale = (cell: HTMLElement) =>
22
- Math.min(1, THUMB_MAX_EDGE / Math.max(cell.offsetWidth, cell.offsetHeight))
23
-
24
- // Fingerprint of the grid state a thumbnail set was captured from: which
25
- // widgets are on the grid and which bundle build (`WidgetInfo.tag`) each one
26
- // runs. Order-independent. Any change — add, remove, rebundle — changes the
27
- // key and triggers a full re-capture.
28
- export const widgetThumbnailsKey = (visibleIds: string[], widgets: WidgetInfo[]) => {
29
- const tagById = new Map(widgets.map(w => [w.id, w.tag]))
30
- return [...visibleIds]
31
- .sort()
32
- .map(id => `${id}@${tagById.get(id) ?? ''}`)
33
- .join(' ')
34
- }
35
-
36
- const timeoutNull = (ms: number) =>
37
- new Promise<null>(resolve => {
38
- setTimeout(() => resolve(null), ms)
39
- })
40
-
41
- export async function captureWidgetThumbnail(cell: HTMLElement): Promise<string | null> {
42
- const { createContext, destroyContext, domToDataUrl } = await import('modern-screenshot')
43
-
44
- const run = async () => {
45
- const context = await createContext(cell, {
46
- scale: thumbnailScale(cell),
47
- type: 'image/webp',
48
- quality: 0.8,
49
- backgroundColor: '#ffffff',
50
- timeout: ASSET_TIMEOUT_MS,
51
- // Strip the frame chrome inside the capture only. Computed styles are
52
- // inlined onto the clone, so a wrapper selector can't reach them — but a
53
- // stylesheet injected into the generated SVG can: !important rules beat
54
- // inline styles and the copied ::after.
55
- onCreateForeignObjectSvg: svg => {
56
- const style = document.createElement('style')
57
- style.textContent =
58
- '[data-widget-chrome] { border-radius: 0 !important; box-shadow: none !important; }' +
59
- '[data-widget-chrome]::after { display: none !important; }'
60
- svg.append(style)
61
- }
62
- })
63
- try {
64
- return await domToDataUrl(context)
65
- } finally {
66
- destroyContext(context)
67
- }
68
- }
69
-
70
- return Promise.race([run(), timeoutNull(WIDGET_TIMEOUT_MS)])
71
- }
@@ -1 +0,0 @@
1
- import{Ic as t}from"/chunk-35fq49qa.js";if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);async function e(r){let{mount:a}=await import("/chunk-ty1sqbmn.js");a(r)}globalThis.__init=e;
@@ -1 +0,0 @@
1
- import{a}from"/chunk-pcnahct1.js";import"/chunk-35fq49qa.js";export{a as sanitizeSvg};