moi-computer 0.8.1-next.0 → 0.9.1-next.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/client/assets/hermes.png +0 -0
- package/client/components/shared/IconGhost.tsx +15 -18
- package/client/components/ui/button.tsx +2 -2
- package/client/components/ui/hover-card.tsx +1 -1
- package/client/components/ui/popover.tsx +3 -1
- package/client/features/chat/ChatEmptyState.tsx +25 -7
- package/client/features/chat/ChatPanel.tsx +70 -28
- package/client/features/chat/ChatPopup.tsx +3 -2
- package/client/features/chat/ChatPromptBubbles.tsx +1 -1
- package/client/features/chat/MarkdownContent.tsx +1 -1
- package/client/features/chat/attachment-staging.ts +153 -0
- package/client/features/chat/chat-send.ts +55 -0
- package/client/features/chat/chat-store.ts +32 -8
- package/client/features/chat/composer/ChatComposer.tsx +190 -77
- package/client/features/chat/{ModelPicker.tsx → composer/ModelPicker.tsx} +29 -25
- package/client/features/chat/composer/banners/ComposerBanner.tsx +1 -1
- package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +4 -13
- package/client/features/chat/{model-order.ts → composer/model-order.ts} +16 -0
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +9 -4
- package/client/features/chat/tool-group/format/claude.ts +48 -0
- package/client/features/chat/tool-group/format/codex.ts +126 -0
- package/client/features/chat/tool-group/format/hermes.ts +68 -0
- package/client/features/chat/tool-group/format/index.ts +34 -0
- package/client/features/chat/tool-group/format/mcp.ts +64 -0
- package/client/features/chat/tool-group/format/openclaw.ts +116 -0
- package/client/features/chat/tool-group/format/shared.ts +49 -0
- package/client/features/chat/useChat.ts +5 -10
- package/client/features/dev/ChatStatesPage.tsx +40 -2
- package/client/features/drawings/DrawingLayer.tsx +49 -0
- package/client/features/drawings/DrawingToolbar.tsx +95 -0
- package/client/features/drawings/annotation-availability.ts +10 -0
- package/client/features/drawings/capture-element.ts +45 -0
- package/client/features/drawings/useChatAnnotation.ts +222 -0
- package/client/features/drawings/useDrawingLayer.ts +758 -0
- package/client/features/drawings/useViewBuilderSketch.ts +151 -0
- package/client/features/home/workspace-presentation.tsx +6 -2
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +12 -6
- package/client/features/scratchpad/ScratchpadControls.tsx +19 -5
- package/client/features/views/ViewBuilder.tsx +224 -0
- package/client/features/views/api.ts +1 -0
- package/client/features/views/useViewBuilderActions.ts +24 -3
- package/client/features/views/useViewBuilderDrafts.ts +66 -0
- package/client/features/widgets/Widgets.tsx +23 -39
- package/client/features/workspace/CustomizePanel.tsx +1 -1
- package/client/features/workspace/WorkspaceScreen.tsx +157 -57
- package/client/features/workspace/WorkspaceTabs.tsx +3 -3
- package/client/features/workspace/useFitsSplitLayout.ts +14 -8
- package/client/index.css +8 -0
- package/client/store/ui.ts +19 -0
- package/client/theme.css +33 -8
- package/dist/chunk-3becmq75.js +81 -0
- package/dist/{chunk-kkj86722.js → chunk-6w6j9g4b.js} +78 -78
- package/dist/{chunk-xeyxk7ep.js → chunk-8ew39cvq.js} +4 -4
- package/dist/chunk-c8gtrjwp.js +1 -0
- package/dist/{chunk-2vaafjp4.js → chunk-pp62fnxh.js} +1 -1
- package/dist/{chunk-35fq49qa.js → chunk-sxc24vfp.js} +1 -1
- package/dist/{chunk-xzx7c9hq.js → chunk-v964b5g7.js} +1 -1
- package/dist/chunk-zx33ts9d.css +1 -0
- package/dist/hermes-pznd63x9.png +0 -0
- package/dist/index.html +1 -1
- package/lib/format.ts +21 -7
- package/lib/themes.ts +8 -8
- package/lib/types.ts +8 -1
- package/lib/workspace-types.ts +2 -1
- package/package.json +6 -4
- package/server/api.ts +21 -2
- package/server/bundler/build-applet.ts +35 -44
- package/server/cli-env.ts +2 -2
- package/server/cli.ts +227 -56
- package/server/constants.ts +8 -0
- package/server/control-client.ts +124 -0
- package/server/control.ts +2 -2
- package/server/harness/README.md +74 -23
- package/server/harness/acp/adapter.ts +220 -0
- package/server/harness/acp/archived.ts +88 -0
- package/server/harness/acp/client.ts +328 -0
- package/server/harness/acp/discovery.ts +130 -0
- package/server/harness/acp/run-durations.ts +68 -0
- package/server/harness/acp/session.ts +788 -0
- package/server/harness/acp/wire.ts +132 -0
- package/server/harness/executable.ts +15 -1
- package/server/harness/hermes/NOTES.md +815 -0
- package/server/harness/hermes/discovery.ts +155 -0
- package/server/harness/hermes/index.ts +155 -0
- package/server/harness/hermes/models.ts +79 -0
- package/server/harness/openclaw/NOTES.md +196 -94
- package/server/harness/openclaw/adapter.ts +28 -55
- package/server/harness/openclaw/compat.ts +4 -8
- package/server/harness/openclaw/session.ts +257 -238
- package/server/harness/openclaw/strip.ts +10 -34
- package/server/harness/openclaw/thinking.ts +5 -53
- package/server/harness/registry.ts +3 -1
- package/server/service.ts +2 -2
- package/server/view-builders.ts +4 -2
- package/server/workspace-import.ts +30 -1
- package/workspace/.claude/skills/moi-workspace/SKILL.md +6 -6
- package/client/features/chat/tool-group/format.ts +0 -359
- package/client/features/views/ViewBuilderTab.tsx +0 -152
- package/dist/chunk-gny990qx.css +0 -1
- package/dist/chunk-gt7n06ef.js +0 -1
- package/dist/chunk-n7pga5x3.js +0 -80
- /package/workspace/.claude/skills/moi-workspace/{DESIGN.md → references/DESIGN.md} +0 -0
- /package/workspace/.claude/skills/moi-workspace/{SCRATCHPAD.md → references/SCRATCHPAD.md} +0 -0
package/dist/index.html
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
}
|
|
22
22
|
</script>
|
|
23
23
|
|
|
24
|
-
<link rel="stylesheet" crossorigin href="/chunk-
|
|
24
|
+
<link rel="stylesheet" crossorigin href="/chunk-zx33ts9d.css"><script type="module" crossorigin src="/chunk-v964b5g7.js"></script></head>
|
|
25
25
|
<body>
|
|
26
26
|
<div id="root"></div>
|
|
27
27
|
|
package/lib/format.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type ToolCall = {
|
|
|
36
36
|
// for the same canonical action (`read` vs `Read`, `exec` vs `Bash`).
|
|
37
37
|
// Adapters are responsible for setting it; UI defaults to a generic
|
|
38
38
|
// rendering when absent.
|
|
39
|
-
provider?: 'claude-code' | 'openclaw' | 'codex'
|
|
39
|
+
provider?: 'claude-code' | 'openclaw' | 'codex' | 'hermes'
|
|
40
40
|
mcpServer?: string
|
|
41
41
|
state: ToolState
|
|
42
42
|
input: unknown
|
|
@@ -115,9 +115,11 @@ export type Turn = {
|
|
|
115
115
|
parentTaskId?: string
|
|
116
116
|
parts: Part[]
|
|
117
117
|
timestamp?: string
|
|
118
|
-
//
|
|
119
|
-
// `__openclaw.seq`).
|
|
120
|
-
//
|
|
118
|
+
// The backend's own transcript position, when it reports one (OpenClaw's
|
|
119
|
+
// `__openclaw.seq`). `applyEvent` places a new seq-bearing turn by this
|
|
120
|
+
// value rather than by arrival, so a row that reaches us late still renders
|
|
121
|
+
// in transcript order. Backends that don't report a position omit it and
|
|
122
|
+
// keep plain append semantics.
|
|
121
123
|
seq?: number
|
|
122
124
|
meta?: TurnMeta
|
|
123
125
|
}
|
|
@@ -251,9 +253,21 @@ export function applyEvent(state: ViewState, ev: StreamEvent): ViewState {
|
|
|
251
253
|
return { ...state, snapshot: ev.snapshot }
|
|
252
254
|
case 'turn': {
|
|
253
255
|
const idx = state.turns.findIndex(t => t.id === ev.turn.id)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
256
|
+
// Known turn: replace in place. Its position was decided when it first
|
|
257
|
+
// landed and must not move under the reader mid-run.
|
|
258
|
+
if (idx >= 0) {
|
|
259
|
+
return { ...state, turns: state.turns.map((t, i) => (i === idx ? ev.turn : t)) }
|
|
260
|
+
}
|
|
261
|
+
// New turn: arrival order is the default, but a backend that reports a
|
|
262
|
+
// transcript position (`seq`) gets placed by it, so a row that arrives
|
|
263
|
+
// late — reconciled after a dropped frame, or replayed after a
|
|
264
|
+
// reconnect — lands where the transcript says it belongs instead of at
|
|
265
|
+
// the end. Only seq-bearing turns are reordered against each other;
|
|
266
|
+
// turns without one keep pure append semantics.
|
|
267
|
+
if (ev.turn.seq === undefined) return { ...state, turns: [...state.turns, ev.turn] }
|
|
268
|
+
const at = state.turns.findIndex(t => t.seq !== undefined && t.seq > ev.turn.seq!)
|
|
269
|
+
if (at < 0) return { ...state, turns: [...state.turns, ev.turn] }
|
|
270
|
+
return { ...state, turns: [...state.turns.slice(0, at), ev.turn, ...state.turns.slice(at)] }
|
|
257
271
|
}
|
|
258
272
|
case 'notice': {
|
|
259
273
|
if (state.notices.some(n => n.id === ev.notice.id)) {
|
package/lib/themes.ts
CHANGED
|
@@ -104,24 +104,24 @@ const THEME_COLOR_DERIVATIONS = {
|
|
|
104
104
|
workspace: {
|
|
105
105
|
primary: primary => primary,
|
|
106
106
|
primaryForeground: primary => foregroundForPrimary(primary),
|
|
107
|
-
background: () => 'color-mix(var(--primary) 3%, oklch(1 0 0) 97%)',
|
|
107
|
+
background: () => 'color-mix(in oklch, var(--primary) 3%, oklch(1 0 0) 97%)',
|
|
108
108
|
foreground: () => 'color-mix(var(--primary) 20%, oklch(0 0 0) 80%)',
|
|
109
|
-
muted: () => 'color-mix(var(--background)
|
|
109
|
+
muted: () => 'color-mix(in oklch, var(--background) 97%, var(--foreground) 3%)',
|
|
110
110
|
mutedForeground: () => 'color-mix(var(--background) 50%, var(--foreground) 50%)',
|
|
111
|
-
accent: () => 'color-mix(var(--primary) 4%, var(--foreground) 4%)',
|
|
111
|
+
accent: () => 'color-mix(in oklch, var(--primary) 4%, var(--foreground) 4%)',
|
|
112
112
|
accentForeground: () => 'var(--foreground)',
|
|
113
|
-
border: () => 'color-mix(var(--foreground) 7%, transparent)'
|
|
113
|
+
border: () => 'color-mix(in oklch, var(--foreground) 7%, transparent)'
|
|
114
114
|
},
|
|
115
115
|
widget: {
|
|
116
116
|
background: primary => primary,
|
|
117
117
|
foreground: primary => foregroundForPrimary(primary),
|
|
118
|
-
primary: () => 'color-mix(var(--background) 3%, oklch(1 0 0) 97%)',
|
|
118
|
+
primary: () => 'color-mix(in oklch, var(--background) 3%, oklch(1 0 0) 97%)',
|
|
119
119
|
primaryForeground: () => 'color-mix(var(--background) 20%, oklch(0 0 0) 80%)',
|
|
120
|
-
muted: () => 'color-mix(var(--background) 97%, var(--foreground) 3%)',
|
|
120
|
+
muted: () => 'color-mix(in oklch, var(--background) 97%, var(--foreground) 3%)',
|
|
121
121
|
mutedForeground: () => 'color-mix(var(--background) 50%, var(--foreground) 50%)',
|
|
122
|
-
accent: () => 'color-mix(var(--primary) 4%, var(--foreground) 4%)',
|
|
122
|
+
accent: () => 'color-mix(in oklch, var(--primary) 4%, var(--foreground) 4%)',
|
|
123
123
|
accentForeground: () => 'var(--foreground)',
|
|
124
|
-
border: () => 'color-mix(var(--foreground) 15%, transparent)'
|
|
124
|
+
border: () => 'color-mix(in oklch, var(--foreground) 15%, transparent)'
|
|
125
125
|
}
|
|
126
126
|
} satisfies Record<ThemeColorMode, Record<string, (primary: string) => string>>
|
|
127
127
|
|
package/lib/types.ts
CHANGED
|
@@ -381,7 +381,7 @@ export type WorkspaceSwitchMessage = {
|
|
|
381
381
|
workspaceId: string
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
export type WorkspaceType = 'claude-code' | 'openclaw' | 'codex'
|
|
384
|
+
export type WorkspaceType = 'claude-code' | 'openclaw' | 'codex' | 'hermes'
|
|
385
385
|
|
|
386
386
|
export type WorkspaceSkillStatus = {
|
|
387
387
|
name: string
|
|
@@ -626,6 +626,13 @@ export type Model = {
|
|
|
626
626
|
displayName: string
|
|
627
627
|
// " · "-joined blurb (Claude): "<headline> · <tagline> · …". Absent for OpenClaw.
|
|
628
628
|
description?: string
|
|
629
|
+
// Heading this model sits under in the picker (Hermes: the upstream provider,
|
|
630
|
+
// e.g. 'Ollama'). Absent when the backend serves one flat catalog.
|
|
631
|
+
group?: string
|
|
632
|
+
// Machine id of that group (Hermes: 'ollama-launch' for the 'Ollama' heading).
|
|
633
|
+
// Unlike `group`, the backend does not reword it — use it as the key whenever
|
|
634
|
+
// a provider needs pinning, ordering or storing.
|
|
635
|
+
providerId?: string
|
|
629
636
|
// Effort/reasoning support (Claude). `supportedEffortLevels` can include values
|
|
630
637
|
// the SDK under-types (e.g. 'xhigh'), so it stays string[].
|
|
631
638
|
supportsEffort?: boolean
|
package/lib/workspace-types.ts
CHANGED
|
@@ -3,7 +3,8 @@ import type { WorkspaceType } from './types'
|
|
|
3
3
|
export const WORKSPACE_TYPE_ORDER = [
|
|
4
4
|
'claude-code',
|
|
5
5
|
'codex',
|
|
6
|
-
'openclaw'
|
|
6
|
+
'openclaw',
|
|
7
|
+
'hermes'
|
|
7
8
|
] as const satisfies readonly WorkspaceType[]
|
|
8
9
|
|
|
9
10
|
export function orderWorkspaceTypes(types: Iterable<WorkspaceType>): WorkspaceType[] {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moi-computer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1-next.0",
|
|
4
4
|
"description": "Local AI workspace powered by the Claude Agent SDK, Bun, React, and Tailwind. Requires Bun.",
|
|
5
5
|
"license": "Elastic-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@anthropic-ai/claude-agent-sdk": "^0.3.197",
|
|
60
60
|
"@anthropic-ai/sdk": "^0.109.1",
|
|
61
|
+
"@babel/parser": "^7.29.8",
|
|
61
62
|
"@base-ui/react": "^1.2.0",
|
|
62
63
|
"@dnd-kit/core": "^6.3.1",
|
|
63
64
|
"@tabler/icons-react": "^3.44.0",
|
|
64
65
|
"@tailwindcss/typography": "^0.5.19",
|
|
65
66
|
"@tanstack/react-query": "^5.100.1",
|
|
66
|
-
"@typescript-eslint/typescript-estree": "^8.57.2",
|
|
67
67
|
"agentation": "^2.3.3",
|
|
68
68
|
"bun-plugin-tailwind": "^0.1.2",
|
|
69
69
|
"citty": "^0.2.1",
|
|
@@ -99,7 +99,6 @@
|
|
|
99
99
|
"tailwindcss": "^4.3.3",
|
|
100
100
|
"tldraw": "5.2.3",
|
|
101
101
|
"tw-animate-css": "^1.4.0",
|
|
102
|
-
"typescript": "^5.9.3",
|
|
103
102
|
"wouter": "^3.9.0",
|
|
104
103
|
"zustand": "^5.0.12"
|
|
105
104
|
},
|
|
@@ -107,12 +106,15 @@
|
|
|
107
106
|
"openclaw": "2026.7.1"
|
|
108
107
|
},
|
|
109
108
|
"devDependencies": {
|
|
109
|
+
"@agentclientprotocol/sdk": "^1.3.0",
|
|
110
|
+
"@babel/types": "^7.29.8",
|
|
110
111
|
"@types/bun": "latest",
|
|
111
112
|
"@types/culori": "^4.0.1",
|
|
112
113
|
"@types/react": "^19",
|
|
113
114
|
"@types/react-dom": "^19",
|
|
114
115
|
"@types/react-grid-layout": "^2.1.0",
|
|
115
116
|
"oxfmt": "^0.54.0",
|
|
116
|
-
"oxlint": "^1.69.0"
|
|
117
|
+
"oxlint": "^1.69.0",
|
|
118
|
+
"typescript": "^5.9.3"
|
|
117
119
|
}
|
|
118
120
|
}
|
package/server/api.ts
CHANGED
|
@@ -250,6 +250,7 @@ one.post('/view-builders/:builderId/submit', async c => {
|
|
|
250
250
|
fastMode?: boolean
|
|
251
251
|
stream?: boolean
|
|
252
252
|
availableIcons?: unknown
|
|
253
|
+
attachments?: unknown
|
|
253
254
|
}>()
|
|
254
255
|
if (typeof body?.input?.requirements !== 'string') {
|
|
255
256
|
return c.text('Expected { input: { requirements: string } }', 400)
|
|
@@ -259,6 +260,17 @@ one.post('/view-builders/:builderId/submit', async c => {
|
|
|
259
260
|
}
|
|
260
261
|
const availableIcons = parseAvailableViewIcons(body.availableIcons)
|
|
261
262
|
if (!availableIcons) return c.text('Available view icons are required', 400)
|
|
263
|
+
const attachments = body.attachments ?? []
|
|
264
|
+
if (
|
|
265
|
+
!Array.isArray(attachments) ||
|
|
266
|
+
attachments.length > 1 ||
|
|
267
|
+
!attachments.every(id => typeof id === 'string' && /^[a-f0-9]{64}$/.test(id))
|
|
268
|
+
) {
|
|
269
|
+
return c.text('Invalid sketch attachment', 400)
|
|
270
|
+
}
|
|
271
|
+
if (attachments.some(id => getUpload(ws.id, id)?.kind !== 'image')) {
|
|
272
|
+
return c.text('Sketch attachment not found or expired', 400)
|
|
273
|
+
}
|
|
262
274
|
const availability = await workspaceTypeAvailability(ws.type ?? 'claude-code')
|
|
263
275
|
if (!availability.available) return c.text(availability.reason, 400)
|
|
264
276
|
try {
|
|
@@ -266,14 +278,20 @@ one.post('/view-builders/:builderId/submit', async c => {
|
|
|
266
278
|
ws.id,
|
|
267
279
|
ws.path,
|
|
268
280
|
c.req.param('builderId'),
|
|
269
|
-
body.input.requirements
|
|
281
|
+
body.input.requirements,
|
|
282
|
+
attachments.length > 0
|
|
270
283
|
)
|
|
271
284
|
// The bootstrap instructions ride the moi-context envelope, injected by
|
|
272
285
|
// the harness like any other ambient context; the user text stays bare.
|
|
273
286
|
// The user submits from the builder's own tab, so that's the active tab.
|
|
274
287
|
const context: MoiContext = {
|
|
275
288
|
activeTab: `view-builder:${builder.id}`,
|
|
276
|
-
directives:
|
|
289
|
+
directives: [
|
|
290
|
+
...viewBuilderDirectives(builder.id, availableIcons),
|
|
291
|
+
...(attachments.length > 0
|
|
292
|
+
? ["The attached image is the user's sketch of the intended view layout."]
|
|
293
|
+
: [])
|
|
294
|
+
]
|
|
277
295
|
}
|
|
278
296
|
try {
|
|
279
297
|
publishSelectedSession(ws.id, await saveSelectedSession(ws.path, builder.sessionId))
|
|
@@ -283,6 +301,7 @@ one.post('/view-builders/:builderId/submit', async c => {
|
|
|
283
301
|
sessionId: builder.sessionId,
|
|
284
302
|
isNew: true,
|
|
285
303
|
content: builder.input.requirements,
|
|
304
|
+
attachments,
|
|
286
305
|
context,
|
|
287
306
|
optimisticId: body.optimisticId,
|
|
288
307
|
model: typeof body.model === 'string' ? body.model : undefined,
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
VariableDeclarator
|
|
4
|
-
} from '@typescript-eslint/types/dist/generated/ast-spec'
|
|
5
|
-
import { parse } from '@typescript-eslint/typescript-estree'
|
|
1
|
+
import { parse } from '@babel/parser'
|
|
2
|
+
import type { ObjectProperty, StringLiteral } from '@babel/types'
|
|
6
3
|
import type { BunPlugin } from 'bun'
|
|
7
4
|
import tailwind from 'bun-plugin-tailwind'
|
|
8
5
|
import { realpathSync } from 'node:fs'
|
|
@@ -74,43 +71,37 @@ const VALID_SPANS = [1, 2, 3, 4] as const
|
|
|
74
71
|
// The properties of an exported `const config = { … }` object literal, or null
|
|
75
72
|
// when the file declares no such export. Shared by the widget and view config
|
|
76
73
|
// extractors — they each interpret the properties under their own schema.
|
|
74
|
+
// Parsed with @babel/parser: it handles TS + JSX with no peer dependencies, so
|
|
75
|
+
// it always resolves from moi's own tree. A parser that peer-depends on
|
|
76
|
+
// `typescript` breaks under bun's shared global tree, where another globally
|
|
77
|
+
// installed package controls which `typescript` sits at the hoisted root.
|
|
77
78
|
function findConfigProperties(source: string) {
|
|
78
|
-
const ast = parse(source, {
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
node
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// Unwrap `as const` — AST wraps the object in TSAsExpression
|
|
97
|
-
const init = rawInit?.type === 'TSAsExpression' ? rawInit.expression : rawInit
|
|
98
|
-
if (init?.type !== 'ObjectExpression') return null
|
|
99
|
-
|
|
100
|
-
return init.properties
|
|
79
|
+
const ast = parse(source, { sourceType: 'module', plugins: ['typescript', 'jsx'] })
|
|
80
|
+
|
|
81
|
+
for (const node of ast.program.body) {
|
|
82
|
+
if (node.type !== 'ExportNamedDeclaration') continue
|
|
83
|
+
if (node.declaration?.type !== 'VariableDeclaration') continue
|
|
84
|
+
const decl = node.declaration.declarations.find(
|
|
85
|
+
d => d.id.type === 'Identifier' && d.id.name === 'config'
|
|
86
|
+
)
|
|
87
|
+
if (!decl) continue
|
|
88
|
+
|
|
89
|
+
const rawInit = decl.init
|
|
90
|
+
// Unwrap `as const` — AST wraps the object in TSAsExpression
|
|
91
|
+
const init = rawInit?.type === 'TSAsExpression' ? rawInit.expression : rawInit
|
|
92
|
+
if (init?.type !== 'ObjectExpression') return null
|
|
93
|
+
return init.properties
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return null
|
|
101
97
|
}
|
|
102
98
|
|
|
103
99
|
// `requiredEnv`: an array of string literals naming env vars the bundle needs.
|
|
104
100
|
// Advisory only — surfaced in the env UI, never enforced at build/load.
|
|
105
|
-
function readRequiredEnv(propValue:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
.filter(
|
|
110
|
-
(el): el is { type: 'Literal'; value: string } =>
|
|
111
|
-
(el as { type?: string })?.type === 'Literal' &&
|
|
112
|
-
typeof (el as { value?: unknown }).value === 'string'
|
|
113
|
-
)
|
|
101
|
+
function readRequiredEnv(propValue: ObjectProperty['value']): string[] | undefined {
|
|
102
|
+
if (propValue.type !== 'ArrayExpression') return undefined
|
|
103
|
+
const names = propValue.elements
|
|
104
|
+
.filter((el): el is StringLiteral => el?.type === 'StringLiteral')
|
|
114
105
|
.map(el => el.value)
|
|
115
106
|
return names.length ? names : undefined
|
|
116
107
|
}
|
|
@@ -125,8 +116,8 @@ export async function extractWidgetConfig(srcPath: string): Promise<WidgetConfig
|
|
|
125
116
|
const result: Partial<WidgetConfig> = {}
|
|
126
117
|
|
|
127
118
|
for (const prop of properties) {
|
|
128
|
-
if (prop.type !== '
|
|
129
|
-
const key = prop.key.name
|
|
119
|
+
if (prop.type !== 'ObjectProperty' || prop.key.type !== 'Identifier') continue
|
|
120
|
+
const key = prop.key.name
|
|
130
121
|
|
|
131
122
|
if (key === 'requiredEnv') {
|
|
132
123
|
const names = readRequiredEnv(prop.value)
|
|
@@ -135,7 +126,7 @@ export async function extractWidgetConfig(srcPath: string): Promise<WidgetConfig
|
|
|
135
126
|
}
|
|
136
127
|
|
|
137
128
|
if (key !== 'rowSpan' && key !== 'colSpan') continue
|
|
138
|
-
if (prop.value
|
|
129
|
+
if (prop.value.type !== 'NumericLiteral') continue
|
|
139
130
|
|
|
140
131
|
const val = prop.value.value
|
|
141
132
|
if (!(VALID_SPANS as readonly number[]).includes(val)) {
|
|
@@ -159,17 +150,17 @@ export async function extractViewConfig(srcPath: string): Promise<ViewConfig | n
|
|
|
159
150
|
const result: ViewConfig = {}
|
|
160
151
|
|
|
161
152
|
for (const prop of properties) {
|
|
162
|
-
if (prop.type !== '
|
|
163
|
-
const key = prop.key.name
|
|
153
|
+
if (prop.type !== 'ObjectProperty' || prop.key.type !== 'Identifier') continue
|
|
154
|
+
const key = prop.key.name
|
|
164
155
|
|
|
165
156
|
if (key === 'title') {
|
|
166
|
-
if (prop.value
|
|
157
|
+
if (prop.value.type === 'StringLiteral') {
|
|
167
158
|
result.title = prop.value.value
|
|
168
159
|
}
|
|
169
160
|
continue
|
|
170
161
|
}
|
|
171
162
|
if (key === 'icon') {
|
|
172
|
-
if (prop.value
|
|
163
|
+
if (prop.value.type === 'StringLiteral') {
|
|
173
164
|
const icon = prop.value.value
|
|
174
165
|
if (!isAppIconId(icon)) {
|
|
175
166
|
throw new Error(`Unknown view icon id "${icon}". Use one of: ${APP_ICON_IDS.join(', ')}`)
|
package/server/cli-env.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { WorkspaceEntry, WorkspaceEnvView } from '@/lib/types'
|
|
|
9
9
|
|
|
10
10
|
import pc from './cli-pc'
|
|
11
11
|
import { columns } from './cli-ui'
|
|
12
|
-
import {
|
|
12
|
+
import { CONTROL_URL } from './constants'
|
|
13
13
|
import { findWorkspaceForPath, listWorkspaces } from './registry'
|
|
14
14
|
import { discoverDotenvKeys, resolveWorkspaceEnv } from './workspace-env'
|
|
15
15
|
|
|
@@ -170,7 +170,7 @@ export function notifyEnvChanged(path: string): Promise<boolean> {
|
|
|
170
170
|
return new Promise(resolve => {
|
|
171
171
|
let ws: WebSocket
|
|
172
172
|
try {
|
|
173
|
-
ws = new WebSocket(
|
|
173
|
+
ws = new WebSocket(CONTROL_URL)
|
|
174
174
|
} catch {
|
|
175
175
|
resolve(false)
|
|
176
176
|
return
|