moi-computer 0.11.1-next.0 → 0.11.1-next.2

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 (211) hide show
  1. package/client/AGENTS.md +2 -2
  2. package/client/components/ui/button.tsx +1 -53
  3. package/client/components/ui/collapsible.tsx +1 -15
  4. package/client/components/ui/dialog.tsx +1 -58
  5. package/client/components/ui/dropdown-menu.tsx +1 -254
  6. package/client/components/ui/hover-card.tsx +1 -44
  7. package/client/components/ui/input.tsx +1 -21
  8. package/client/components/ui/popover.tsx +1 -88
  9. package/client/components/ui/resizable.tsx +1 -40
  10. package/client/components/ui/skeleton.tsx +1 -13
  11. package/client/components/ui/slider.tsx +1 -70
  12. package/client/components/ui/spinner.tsx +1 -18
  13. package/client/components/ui/switch.tsx +1 -23
  14. package/client/components/ui/tabs.tsx +1 -0
  15. package/client/components/ui/textarea.tsx +1 -18
  16. package/client/components/ui/tooltip.tsx +1 -51
  17. package/client/features/chat/ChatPanel.tsx +6 -6
  18. package/client/features/chat/ChatPopup.tsx +3 -4
  19. package/client/features/chat/TurnView.tsx +5 -4
  20. package/client/features/chat/api.ts +5 -14
  21. package/client/features/chat/chat-frames.ts +9 -7
  22. package/client/features/chat/chat-send.ts +13 -2
  23. package/client/features/chat/chat-store.ts +1 -3
  24. package/client/features/chat/composer/ChatComposer.tsx +5 -1
  25. package/client/features/chat/composer/ModelPicker.tsx +44 -44
  26. package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
  27. package/client/features/chat/composer/model-order.ts +15 -0
  28. package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
  29. package/client/features/chat/group-turns.ts +12 -0
  30. package/client/features/chat/interleave-notices.ts +7 -11
  31. package/client/features/chat/session-view.ts +53 -0
  32. package/client/features/chat/tool-group/ToolCallGroup.tsx +1 -4
  33. package/client/features/chat/tool-group/format/codex.ts +4 -1
  34. package/client/features/chat/useChat.ts +10 -9
  35. package/client/features/dev/ChatStatesPage.tsx +3 -1
  36. package/client/features/dev/DevIndexPage.tsx +5 -0
  37. package/client/features/dev/DevRoutes.tsx +2 -0
  38. package/client/features/dev/HarnessDebugPage.tsx +1 -1
  39. package/client/features/dev/UiComponentPreviews.tsx +834 -0
  40. package/client/features/dev/UiComponentsPage.tsx +60 -0
  41. package/client/features/home/WorkspacePreview.tsx +1 -1
  42. package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
  43. package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
  44. package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
  45. package/client/features/settings/SettingsLayout.tsx +1 -1
  46. package/client/features/settings/WorkspaceSettings.tsx +4 -1
  47. package/client/features/views/ViewManager.tsx +14 -9
  48. package/client/features/widgets/WidgetFrame.tsx +1 -1
  49. package/client/features/widgets/Widgets.tsx +1 -3
  50. package/client/features/workspace/WorkspaceScreen.tsx +5 -1
  51. package/client/features/workspace/WorkspaceSplitLayout.tsx +6 -1
  52. package/client/features/workspace/api.ts +2 -4
  53. package/client/index.css +22 -29
  54. package/dist/chunk-245wt82v.css +1 -0
  55. package/dist/{chunk-tny85yt2.js → chunk-4s15axjs.js} +2 -2
  56. package/dist/{chunk-c9pjqx9m.js → chunk-53a7pxcz.js} +1 -1
  57. package/dist/{chunk-104m57qw.js → chunk-87thzbtw.js} +2 -2
  58. package/dist/chunk-a6jad1a6.js +1 -0
  59. package/dist/chunk-dghwstd2.js +9 -0
  60. package/dist/chunk-eg120aca.js +1 -0
  61. package/dist/{chunk-v7wr1df4.js → chunk-j3wvxjr7.js} +1 -1
  62. package/dist/chunk-j7hh2ab4.js +70 -0
  63. package/dist/chunk-w482ew2c.js +546 -0
  64. package/dist/chunk-y8eyahwx.js +1 -0
  65. package/dist/index.html +1 -1
  66. package/lib/format.ts +55 -6
  67. package/lib/themes.ts +6 -6
  68. package/lib/types.ts +10 -9
  69. package/package.json +12 -5
  70. package/registry.json +643 -0
  71. package/server/agent.ts +1 -1
  72. package/server/api.ts +26 -30
  73. package/server/applets.ts +30 -29
  74. package/server/bundler/applet-css.ts +7 -107
  75. package/server/bundler/build-applet.ts +5 -1
  76. package/server/bundler/build-worker.ts +178 -0
  77. package/server/cli-ui-components.ts +28 -33
  78. package/server/cli.ts +6 -11
  79. package/server/data-dir.ts +1 -1
  80. package/server/harness/README.md +41 -48
  81. package/server/harness/acp/NOTES.md +426 -0
  82. package/server/harness/acp/discovery.ts +27 -30
  83. package/server/harness/acp/model-state.ts +57 -0
  84. package/server/harness/acp/session.ts +18 -6
  85. package/server/harness/claude-code/NOTES.md +47 -12
  86. package/server/harness/claude-code/cli.ts +40 -0
  87. package/server/harness/claude-code/index.ts +11 -5
  88. package/server/harness/claude-code/models.ts +72 -19
  89. package/server/harness/claude-code/session.ts +408 -299
  90. package/server/harness/codex/NOTES.md +222 -350
  91. package/server/harness/codex/adapter.ts +94 -45
  92. package/server/harness/codex/auth.ts +1 -3
  93. package/server/harness/codex/client.ts +169 -249
  94. package/server/harness/codex/discovery.ts +9 -17
  95. package/server/harness/codex/index.ts +2 -1
  96. package/server/harness/codex/pagination.ts +24 -0
  97. package/server/harness/codex/permissions.ts +31 -7
  98. package/server/harness/codex/probe.ts +10 -13
  99. package/server/harness/codex/session.ts +549 -136
  100. package/server/harness/codex/transport.ts +184 -0
  101. package/server/harness/debug.ts +1 -1
  102. package/server/harness/hermes/NOTES.md +18 -0
  103. package/server/harness/hermes/discovery.ts +20 -0
  104. package/server/harness/hermes/index.ts +9 -0
  105. package/server/harness/hermes/models.ts +28 -8
  106. package/server/harness/types.ts +4 -2
  107. package/server/moi-scaffold.ts +1 -1
  108. package/server/preview.ts +3 -1
  109. package/server/registry.ts +63 -41
  110. package/server/tldraw-package.d.ts +4 -0
  111. package/server/ui-components.ts +101 -434
  112. package/server/view-builders.ts +2 -1
  113. package/server/web.ts +12 -5
  114. package/server/workspace-env.ts +3 -2
  115. package/tsconfig.json +0 -1
  116. package/ui-components/accordion.tsx +71 -0
  117. package/ui-components/alert-dialog.tsx +165 -0
  118. package/ui-components/alert.tsx +68 -0
  119. package/ui-components/attachment.tsx +195 -0
  120. package/ui-components/avatar.tsx +90 -0
  121. package/ui-components/badge.tsx +49 -0
  122. package/ui-components/button-group.tsx +78 -0
  123. package/ui-components/button.tsx +55 -0
  124. package/ui-components/calendar.tsx +180 -0
  125. package/ui-components/card.tsx +84 -0
  126. package/ui-components/carousel.tsx +235 -0
  127. package/ui-components/chart.tsx +338 -0
  128. package/ui-components/checkbox.tsx +28 -0
  129. package/ui-components/collapsible.tsx +15 -0
  130. package/ui-components/combobox.tsx +267 -0
  131. package/ui-components/context-menu.tsx +244 -0
  132. package/ui-components/dialog.tsx +138 -0
  133. package/ui-components/docs/accordion.md +463 -0
  134. package/ui-components/docs/alert-dialog.md +481 -0
  135. package/ui-components/docs/alert.md +301 -0
  136. package/ui-components/docs/attachment.md +689 -0
  137. package/ui-components/docs/avatar.md +495 -0
  138. package/ui-components/docs/badge.md +258 -0
  139. package/ui-components/docs/button-group.md +879 -0
  140. package/ui-components/docs/button.md +26 -0
  141. package/ui-components/docs/calendar.md +862 -0
  142. package/ui-components/docs/card.md +265 -0
  143. package/ui-components/docs/carousel.md +627 -0
  144. package/ui-components/docs/chart.md +1256 -0
  145. package/ui-components/docs/checkbox.md +477 -0
  146. package/ui-components/docs/collapsible.md +446 -0
  147. package/ui-components/docs/combobox.md +1003 -0
  148. package/ui-components/docs/context-menu.md +860 -0
  149. package/ui-components/docs/data-table.md +1580 -0
  150. package/ui-components/docs/date-picker.md +614 -0
  151. package/ui-components/docs/dialog.md +414 -0
  152. package/ui-components/docs/drawer.md +51 -0
  153. package/ui-components/docs/dropdown-menu.md +1000 -0
  154. package/ui-components/docs/field.md +1192 -0
  155. package/ui-components/docs/hover-card.md +275 -0
  156. package/ui-components/docs/input-group.md +866 -0
  157. package/ui-components/docs/input.md +456 -0
  158. package/ui-components/docs/label.md +295 -0
  159. package/ui-components/docs/pagination.md +416 -0
  160. package/ui-components/docs/popover.md +348 -0
  161. package/ui-components/docs/progress.md +214 -0
  162. package/ui-components/docs/radio-group.md +389 -0
  163. package/ui-components/docs/resizable.md +265 -0
  164. package/ui-components/docs/select.md +616 -0
  165. package/ui-components/docs/separator.md +216 -0
  166. package/ui-components/docs/skeleton.md +205 -0
  167. package/ui-components/docs/slider.md +226 -0
  168. package/ui-components/docs/spinner.md +332 -0
  169. package/ui-components/docs/switch.md +236 -0
  170. package/ui-components/docs/table.md +551 -0
  171. package/ui-components/docs/tabs.md +379 -0
  172. package/ui-components/docs/textarea.md +187 -0
  173. package/ui-components/docs/toggle-group.md +370 -0
  174. package/ui-components/docs/toggle.md +91 -0
  175. package/ui-components/docs/tooltip.md +290 -0
  176. package/ui-components/drawer.tsx +213 -0
  177. package/ui-components/dropdown-menu.tsx +263 -0
  178. package/ui-components/field.tsx +224 -0
  179. package/ui-components/hover-card.tsx +46 -0
  180. package/ui-components/input-group.tsx +146 -0
  181. package/ui-components/input.tsx +20 -0
  182. package/ui-components/label.tsx +17 -0
  183. package/ui-components/pagination.tsx +124 -0
  184. package/ui-components/popover.tsx +81 -0
  185. package/ui-components/progress.tsx +63 -0
  186. package/ui-components/radio-group.tsx +38 -0
  187. package/ui-components/resizable.tsx +40 -0
  188. package/ui-components/scoped-portal.tsx +31 -0
  189. package/ui-components/select.tsx +195 -0
  190. package/ui-components/separator.tsx +18 -0
  191. package/ui-components/skeleton.tsx +15 -0
  192. package/ui-components/slider.tsx +75 -0
  193. package/ui-components/spinner.tsx +20 -0
  194. package/ui-components/switch.tsx +27 -0
  195. package/ui-components/table.tsx +86 -0
  196. package/ui-components/tabs.tsx +75 -0
  197. package/ui-components/textarea.tsx +17 -0
  198. package/ui-components/toggle-group.tsx +85 -0
  199. package/ui-components/toggle.tsx +42 -0
  200. package/ui-components/tooltip.tsx +61 -0
  201. package/ui-components/utils.ts +8 -0
  202. package/workspace/.claude/skills/moi-workspace/SKILL.md +11 -20
  203. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +4 -3
  204. package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
  205. package/dist/chunk-59zf0m6n.js +0 -1
  206. package/dist/chunk-bj3akjs2.js +0 -1
  207. package/dist/chunk-j2w2vak4.js +0 -546
  208. package/dist/chunk-k2r9c95m.js +0 -10
  209. package/dist/chunk-kmbxhgwv.js +0 -1
  210. package/dist/chunk-p1yqa71k.js +0 -83
  211. package/dist/chunk-r5xrenjy.css +0 -1
@@ -1,9 +1,9 @@
1
1
  // CLI face of `moi ui-components` (see server/ui-components.ts for the
2
- // engine and docs/moi-shadcn.md for the spec). Three verbs:
2
+ // engine and docs/ui-components.md for the spec). Three verbs:
3
3
  //
4
4
  // moi ui-components → the curated catalog + installed state
5
- // moi ui-components add <name…> → fetch, transform, write to .moi/ui/
6
- // moi ui-components docs <name…> → official docs as markdown, on stdout
5
+ // moi ui-components add <name…> → copy registry components to .moi/ui/
6
+ // moi ui-components docs <name…> → component docs as markdown, on stdout
7
7
  //
8
8
  // The command is deliberately not smart: add never rebuilds and never edits
9
9
  // existing files, and installs dependencies only when asked to (--install) —
@@ -17,15 +17,16 @@ import pc from './cli-pc'
17
17
  import { resolveCwdWorkspace } from './cli-env'
18
18
  import { MOI_PACKAGE_JSON } from './moi-scaffold'
19
19
  import {
20
+ type LoadedUiComponents,
20
21
  UI_COMPONENTS,
21
22
  UI_COMPONENT_NAMES,
22
- UI_DOCS_BASE,
23
- fetchUiComponents,
23
+ loadUiComponentDocs,
24
+ loadUiComponents,
24
25
  partitionUiWrites,
25
26
  planUiWrites,
26
27
  resolveUiComponentRequest,
27
28
  suggestUiComponents,
28
- transformUiComponentSource
29
+ uiComponentFiles
29
30
  } from './ui-components'
30
31
 
31
32
  function uiDirFor(workspacePath: string): string {
@@ -37,7 +38,7 @@ function exitUnknownNames(unknown: string[]): never {
37
38
  const hints = suggestUiComponents(name)
38
39
  console.error(
39
40
  pc.red('✗') +
40
- ` "${name}" is not in the moi component set.` +
41
+ ` "${name}" is not in the component catalog.` +
41
42
  (hints.length ? pc.dim(` Did you mean: ${hints.join(', ')}?`) : '')
42
43
  )
43
44
  }
@@ -48,7 +49,7 @@ function exitUnknownNames(unknown: string[]): never {
48
49
  const add = defineCommand({
49
50
  meta: {
50
51
  name: 'add',
51
- description: 'Fetch components from the shadcn registry into .moi/ui/'
52
+ description: 'Add components from the local registry to .moi/ui/'
52
53
  },
53
54
  args: {
54
55
  name: {
@@ -74,35 +75,34 @@ const add = defineCommand({
74
75
  const entry = await resolveCwdWorkspace()
75
76
  const uiDir = uiDirFor(entry.path)
76
77
 
77
- let fetched
78
+ let loaded: LoadedUiComponents
78
79
  try {
79
- fetched = await fetchUiComponents(request.registryItems)
80
+ loaded = await loadUiComponents(request.entries)
80
81
  } catch (err) {
81
82
  console.error(
82
83
  '\n' +
83
84
  pc.red('✗') +
84
- ' Could not reach the shadcn registry (ui.shadcn.com). ' +
85
- 'The command needs network access; offline use is not supported.\n' +
85
+ ' Could not load the requested components from the local registry.\n' +
86
86
  pc.dim(` ${(err as Error).message}\n`)
87
87
  )
88
88
  process.exit(1)
89
89
  }
90
90
 
91
91
  const plans = planUiWrites({
92
- files: fetched.files,
93
- requestedItems: request.registryItems,
92
+ files: loaded.files,
93
+ requestedFiles: request.entries.flatMap(uiComponentFiles),
94
94
  uiDir,
95
95
  exists: existsSync
96
96
  })
97
97
 
98
98
  // Hand-customized components are never silently overwritten: without
99
99
  // --force a requested file that already exists is skipped and reported, so
100
- // a bulk add still installs everything new. Only when every requested
101
- // component already exists does the add fail. Existing support files
102
- // (utils, applet-portal, registry deps that rode along) are kept as-is
100
+ // a bulk add still installs everything new. Only when nothing needs to be
101
+ // written does the add fail. Existing support files
102
+ // (utils, scoped-portal, registry deps that rode along) are kept as-is
103
103
  // either way, even under --force.
104
104
  const partition = partitionUiWrites(plans, args.force)
105
- if (partition.allInstalled) {
105
+ if (partition.write.length === 0) {
106
106
  console.error(
107
107
  '\n' +
108
108
  pc.red('✗') +
@@ -118,10 +118,7 @@ const add = defineCommand({
118
118
  await mkdir(uiDir, { recursive: true })
119
119
  const written: string[] = []
120
120
  for (const plan of partition.write) {
121
- const content = plan.name.endsWith('.tsx')
122
- ? await transformUiComponentSource(plan.name, plan.content)
123
- : plan.content
124
- await Bun.write(plan.path, content)
121
+ await Bun.write(plan.path, plan.content)
125
122
  written.push(plan.name)
126
123
  }
127
124
  const kept = partition.keepSupport.map(plan => plan.name)
@@ -131,7 +128,7 @@ const add = defineCommand({
131
128
  // registry specifiers may be versioned (`recharts@3.8.0`), so compare by
132
129
  // package name.
133
130
  const baseline = new Set(Object.keys(MOI_PACKAGE_JSON.dependencies))
134
- const deps = [...new Set([...fetched.dependencies, ...request.extraDeps])]
131
+ const deps = [...new Set(loaded.dependencies)]
135
132
  .filter(spec => !baseline.has(spec.replace(/@[^@/]+$/, '')))
136
133
  .sort()
137
134
 
@@ -200,7 +197,7 @@ const add = defineCommand({
200
197
  const docs = defineCommand({
201
198
  meta: {
202
199
  name: 'docs',
203
- description: 'Print official component docs as markdown'
200
+ description: 'Print component docs as markdown'
204
201
  },
205
202
  args: {
206
203
  name: {
@@ -213,18 +210,16 @@ const docs = defineCommand({
213
210
  const request = resolveUiComponentRequest(args._)
214
211
  if (request.unknown.length > 0) exitUnknownNames(request.unknown)
215
212
 
213
+ console.log(
214
+ '> Import components relatively from `../ui/<name>` and use `@tabler/icons-react` for icons.\n'
215
+ )
216
216
  for (const name of request.entries) {
217
- const slug = UI_COMPONENTS[name].docsSlug ?? name
218
- const url = `${UI_DOCS_BASE}/${slug}.md`
219
217
  try {
220
- const res = await fetch(url, { signal: AbortSignal.timeout(20_000) })
221
- if (!res.ok) throw new Error(`HTTP ${res.status}`)
218
+ const markdown = await loadUiComponentDocs(name)
222
219
  if (request.entries.length > 1) console.log(`\n---\n# ${name}\n`)
223
- console.log(await res.text())
220
+ console.log(markdown)
224
221
  } catch (err) {
225
- console.error(
226
- pc.red('✗') + ` Could not fetch docs for "${name}" (${url}): ${(err as Error).message}`
227
- )
222
+ console.error(pc.red('✗') + ` Could not load docs for "${name}": ${(err as Error).message}`)
228
223
  process.exitCode = 1
229
224
  }
230
225
  }
@@ -240,7 +235,7 @@ function renderCatalog(uiDir: string, query?: string): void {
240
235
  if (needle && !name.includes(needle) && !entry.description.toLowerCase().includes(needle)) {
241
236
  continue
242
237
  }
243
- const installed = entry.registryItems.every(item => existsSync(join(uiDir, `${item}.tsx`)))
238
+ const installed = uiComponentFiles(name).every(file => existsSync(join(uiDir, file)))
244
239
  rows.push(
245
240
  ' ' +
246
241
  (installed ? pc.green('✓ ') : ' ') +
package/server/cli.ts CHANGED
@@ -790,7 +790,7 @@ const refresh = defineCommand({
790
790
  }
791
791
  })
792
792
 
793
- function hexToRgb(hex: string): [number, number, number] {
793
+ function swatchHexToRgb(hex: string): [number, number, number] {
794
794
  const value = Number.parseInt(hex.slice(1), 16)
795
795
  return [(value >> 16) & 0xff, (value >> 8) & 0xff, value & 0xff]
796
796
  }
@@ -799,8 +799,8 @@ function hexToRgb(hex: string): [number, number, number] {
799
799
  // Falls back to blank spaces when stdout is not a TTY, keeping piped output clean.
800
800
  function swatch(bg?: string, fg?: string): string {
801
801
  if (!process.stdout.isTTY || !bg) return ' '
802
- const [br, bgg, bb] = hexToRgb(bg)
803
- const [fr, fgg, fb] = hexToRgb(fg ?? '#000000')
802
+ const [br, bgg, bb] = swatchHexToRgb(bg)
803
+ const [fr, fgg, fb] = swatchHexToRgb(fg ?? '#000000')
804
804
  return `\x1b[48;2;${br};${bgg};${bb}m\x1b[38;2;${fr};${fgg};${fb}m Aa \x1b[0m`
805
805
  }
806
806
 
@@ -2946,17 +2946,12 @@ const version = defineCommand({
2946
2946
  }
2947
2947
  })
2948
2948
 
2949
- // A static shell over ./cli-ui-components, which reaches `shadcn` and
2950
- // `ts-morph` — ~31 MB of JS that costs ~300 ms to parse and evaluate. The meta
2951
- // is inlined here (duplicating the real command's) because it is all the root
2952
- // help needs: both citty's usage renderer and printMainHelp read only
2953
- // `meta.description`, so a lazily-resolved subcommand would be imported by
2954
- // every `moi --help`. Keeping the shell static defers the module to the point
2955
- // where a subcommand actually runs.
2949
+ // A static shell over ./cli-ui-components. The meta is inlined here because it
2950
+ // is all the root help needs; the registry loader stays lazy until used.
2956
2951
  const uiComponents = defineCommand({
2957
2952
  meta: {
2958
2953
  name: 'ui-components',
2959
- description: 'Standard UI components for applets (curated shadcn set)'
2954
+ description: 'UI components for applets'
2960
2955
  },
2961
2956
  subCommands: () => import('./cli-ui-components').then(m => m.uiComponentsSubCommands),
2962
2957
  async run({ rawArgs }) {
@@ -6,4 +6,4 @@
6
6
  // spawned CLI would otherwise read the developer's real data dir.
7
7
  import envPaths from 'env-paths'
8
8
 
9
- export const DATA_DIR = process.env.MOI_DATA_DIR || envPaths('moi', { suffix: false }).data
9
+ export const DATA_DIR = process.env.MOI_DATA_DIR || envPaths('moi', { suffix: '' }).data
@@ -57,8 +57,7 @@ Socket-protocol notes the layers rely on (all defined in `lib/types.ts`):
57
57
  lifecycle signal — never derived by counting sends vs results. The snapshot
58
58
  (sent on connect and re-broadcast periodically) is authoritative: the client
59
59
  rebuilds its whole activity map from it, so a lost terminal frame self-heals.
60
- `requires-action` (agent blocked on user input) is tracked but not rendered
61
- yet — the client shows no loader for it.
60
+ `requires-action` suppresses the loader.
62
61
  - **`preview`** — live token frames, cumulative text, never persisted;
63
62
  cleared when the turn with matching `meta.apiMessageId` lands.
64
63
 
@@ -75,9 +74,9 @@ server/harness/
75
74
  hand-written wire types it consumes
76
75
  session.ts live per-thread state machine (send/interrupt/turn
77
76
  accounting/preview forwarding)
78
- <transport>.ts process/connection management, named for what it is:
79
- codex/client.ts, openclaw/gateway.ts (CC has none — the
80
- Agent SDK is the transport)
77
+ <transport>.ts connection management: codex/client.ts owns processes and
78
+ codex/transport.ts frames stdio; openclaw/gateway.ts owns
79
+ the gateway connection (CC uses the Agent SDK)
81
80
  discovery.ts / models.ts / sessions.ts / mcp.ts as needed
82
81
  NOTES.md the backend's wire protocol, empirically verified
83
82
  *.test.ts tests live next to the code they cover
@@ -140,7 +139,9 @@ app-server protocol without moi).
140
139
  **Claude Code — shipped, primary harness.** Full chat integration: long-lived
141
140
  streaming-input sessions with mid-turn message queueing, resume after idle
142
141
  eviction/restart, interrupt, per-thread model + effort picker (backed by
143
- `supportedModels()`), opt-in live token streaming, image/file attachments,
142
+ `supportedModels()`, cached per CLI version so an in-place `claude` update
143
+ shows up without a server restart — `claude-code/NOTES.md` "Runtime
144
+ executable"), opt-in live token streaming, image/file attachments,
144
145
  subagent lanes, MCP status probe, and session list/history replay from the
145
146
  SDK's `.jsonl` files, with per-turn token usage folded into the final
146
147
  assistant turn. The Agent SDK remains the transport, while every query is
@@ -153,8 +154,9 @@ permission chain — settings rules, the `auto` mode classifier, and
153
154
  that reaches a prompt without passing through `PreToolUse`. This is strictly
154
155
  more access than the CLI default — the classifier's safety verdicts no longer
155
156
  apply — and is an interim policy until UI approvals land. Known gaps: no
156
- interactive approval flow yet, and effort/streaming changes require a
157
- teardown-and-resume because the SDK has no live setter for them.
157
+ interactive approval flow yet, and streaming changes require a
158
+ teardown-and-resume because the SDK has no live setter for them. Model, effort,
159
+ and fast-mode changes apply live before the next message.
158
160
 
159
161
  **OpenClaw — shipped.** Chat over the local gateway's WebSocket JSON-RPC
160
162
  (wire protocol 4 — the 2026.7.x and 2026.6.x lines; protocol-3 gateways are
@@ -189,29 +191,19 @@ tool calls left unsettled at turn end are closed (Hermes never completes file
189
191
  read/write calls live), and a completing `tool_call_update` carries no title, so
190
192
  the established name is kept. See `hermes/NOTES.md`.
191
193
 
192
- **Codex — shipped, experimental.** Chat over `codex app-server` (stdio
193
- JSON-RPC, one process per workspace so `workspaceEnv` injects at spawn —
194
- `codex/client.ts`): thread create/resume with temp-id rename, per-turn model +
195
- effort overrides (both live — no rebuild dance), opt-in token streaming from
196
- `item/*/delta`, reasoning summaries via `summary: 'auto'`, mid-turn sends
197
- steered into the running turn (`turn/steer` with `turn/start` fallback),
198
- interrupt, per-turn token usage folded into `TurnMeta`, native optimistic-id
199
- rendezvous, session list via `thread/list` (cwd-filtered) and history replay
200
- via `thread/read`, subagent (collab) child threads nested as live
201
- SubagentRecord transcripts on the parent card, semantic exec labels from
202
- `commandActions`, MCP status via `mcpServerStatus/list`, and hook / failed
203
- MCP-startup notices. Workspace discovery scans `~/.codex/sessions` rollout
204
- heads for cwds (`codex/discovery.ts` — no binary needed), and `availability()`
205
- reports a missing `codex` executable (PATH + login-shell PATH lookup, with a
206
- Codex Desktop app-bundle fallback — `executable.ts`) to setup flows and the
207
- workspace composer. Sessions use `workspace-write` with network disabled by
208
- default and `approvalPolicy: on-request`; server→client approval requests are
209
- accepted by moi at the transport — an interim default-approve policy until UI
210
- approvals land (`codex/permissions.ts`). The same policy is reapplied on
211
- thread start, resume, and every turn. Known gaps: no interactive approval flow
212
- yet. Per-turn application context tells Codex to request escalated localhost
213
- access before control-server commands. Images ride inline as data URLs only
214
- (no `localImage` path mode).
194
+ **Codex — shipped, experimental.** One `codex app-server` per workspace supplies
195
+ chat, model/session catalogs, history, steering, and interruption. The harness
196
+ maps items into shared display events, including subagent transcripts, reasoning
197
+ previews, usage, and hook/MCP failure notices.
198
+ Model, effort, and fast-mode choices apply on the next new turn; the sent model
199
+ matches the picker even when Codex config names an unavailable model.
200
+
201
+ Workspace env is fixed at process spawn. Executable lookup prefers PATH over
202
+ the desktop bundle; config and credentials remain owned by Codex. Sessions use
203
+ workspace-write access with network disabled, and moi automatically accepts
204
+ supported permission requests. Command-approval UI, native question forms, and
205
+ MCP elicitation are not implemented. See [Codex harness notes](codex/NOTES.md)
206
+ for module ownership, ordering rules, runtime diagnostics, and boundaries.
215
207
 
216
208
  Workspace availability also checks provider authentication when a workspace is
217
209
  given. Claude Code is probed with `claude auth status` under the effective
@@ -247,17 +239,18 @@ doubles as the evaluation rubric for new harnesses.
247
239
  `session_state_changed` when the CLI emits it; Codex: `turn/started` /
248
240
  `turn/completed`; OpenClaw: `agent` lifecycle phases). Flip to `running`
249
241
  optimistically on send; a session with live background tasks (CC
250
- `task_started`/`task_notification`) must not be idle-evicted.
242
+ `background_tasks_changed` snapshots, with task events as an older-CLI
243
+ fallback) must not be idle-evicted.
251
244
 
252
245
  ### Per-request configuration
253
246
 
254
247
  - **List supported models**, including per-model metadata such as supported
255
248
  effort levels (drives the picker).
256
249
  - **Set model** — ideally live mid-session.
257
- - **Set reasoning effort** — CC has no live setter, so `claude-code/session.ts`
258
- does a drain-then-teardown-then-resume dance; Codex takes it per turn.
259
- - **Thinking/reasoning display mode** (Codex: `summary: 'auto'` is required or
260
- reasoning items arrive empty).
250
+ - **Set reasoning effort** — CC applies `applyFlagSettings({ effortLevel })`
251
+ before the next message; Codex takes it per turn.
252
+ - **Thinking/reasoning display mode** (Codex requests `summary: 'detailed'`
253
+ so visible summaries do not depend on CLI defaults).
261
254
  - **Token streaming opt-in** (CC: `includePartialMessages`, construct-time;
262
255
  Codex: always streams, moi gates forwarding).
263
256
  - **Permissions / tool policy** — allowed tools, permission mode; backends
@@ -304,36 +297,36 @@ doubles as the evaluation rubric for new harnesses.
304
297
 
305
298
  ## Capability comparison
306
299
 
307
- Legend: ✅ supported · ⚠️ partial/workaround · ❌ missing.
300
+ Legend: ✅ supported · ⚠️ partial/workaround · ❌ missing. The Codex column
301
+ describes what moi exposes, not every RPC available in the upstream protocol.
308
302
 
309
303
  | Feature | Claude Agent SDK | OpenClaw gateway | Codex app-server | Hermes (ACP) |
310
304
  | ------------------------ | --------------------------------------------------- | ------------------------- | ------------------------------------- | ------------------------------------ |
311
305
  | Long-lived session | ✅ subprocess per session | ✅ gateway-side | ✅ server-side, N threads/process | ✅ process per workspace, N sessions |
312
306
  | Queue/steer mid-turn | ⚠️ queued next turn | ⚠️ | ✅ `turn/steer` into live turn | ⚠️ queued (ACP has no steer) |
313
- | Resume | ✅ | ✅ | ✅ + fork | ✅ `session/load` (+ fork) |
307
+ | Resume | ✅ | ✅ | ✅ `thread/resume` | ✅ `session/load` (+ fork) |
314
308
  | Interrupt | ✅ `interrupt()` | ✅ | ✅ `turn/interrupt` | ✅ `session/cancel` → `cancelled` |
315
309
  | List models | ✅ `supportedModels()` | ✅ `models.list` | ✅ `model/list` | ✅ inline on `session/new` |
316
310
  | Live model switch | ✅ `setModel()` | ✅ `sessions.patch` | ✅ per-turn override | ⚠️ drops session MCP servers |
317
- | Live effort switch | ❌ rebuild | ✅ `thinkingLevel` patch | ✅ per-turn | ❌ no effort concept in ACP |
311
+ | Live effort switch | ✅ `applyFlagSettings` | ✅ `thinkingLevel` patch | ✅ per-turn | ❌ no effort concept in ACP |
318
312
  | Token deltas | ✅ opt-in | ✅ `chat` frames | ✅ `item/*/delta` | ✅ always on, thinking + text |
319
- | Images in input | ✅ base64 blocks | ⚠️ materialize to path | ✅ data URL or path | ✅ base64 blocks |
313
+ | Images in input | ✅ base64 blocks | ⚠️ materialize to path | ✅ inline data URLs | ✅ base64 blocks |
320
314
  | Interactive approvals | ⚠️ (we bypass) | ✅ | ✅ server→client requests (we bypass) | ✅ real, with diffs (we bypass) |
321
315
  | Session list/history API | ✅ `listSessions()` + jsonl | ✅ `sessions.get` | ✅ `thread/list`/`read` | ✅ `session/list` (cwd + cursor) |
322
316
  | Home card preview | ✅ session file scan | ✅ cached first message | ⚠️ live app-server only | ⚠️ live process only |
323
317
  | MCP status | ✅ `mcpServerStatus()` | n/a | ✅ `mcpServerStatus/list` | ⚠️ per-session config, no status RPC |
324
- | Usage reporting | ⚠️ cost/duration on `result` (adapter drops tokens) | ✅ tokens + cost per turn | ✅ live + rate limits | ✅ tokens per turn |
325
- | Structured output | ❌ | ❌ | ✅ per turn | ❌ |
318
+ | Usage reporting | ⚠️ cost/duration on `result` (adapter drops tokens) | ✅ tokens + cost per turn | ✅ per-turn tokens and duration | ✅ tokens per turn |
319
+ | Structured output | ❌ | ❌ | ⚠️ title generation only | ❌ |
326
320
 
327
321
  ## Design lessons so far
328
322
 
329
- - Half of `claude-code/session.ts` exists because some settings are
330
- live-settable (`setModel`) and some are construct-time (effort, streaming).
323
+ - Claude Code settings are either live-settable (`setModel`, effort/fast mode
324
+ via `applyFlagSettings`) or construct-time (streaming).
331
325
  Encode that distinction per-setting in the adapter interface instead of
332
326
  hardcoding the drain-then-rebuild machinery.
333
- - Harnesses split into two topologies: **held-open** (CC subprocess, OpenClaw
334
- gateway, Codex app-server) and **spawn-per-turn** (Codex exec SDK — see
335
- `codex/NOTES.md` §1 for why we rejected it). The session manager should
336
- support both.
327
+ - Chat harnesses keep connections open (CC subprocess, OpenClaw gateway,
328
+ Codex app-server). Separate one-shot work, such as Codex title generation,
329
+ can use a short-lived process without changing chat session ownership.
337
330
  - Event vocabularies differ in kind, not just names: CC emits raw
338
331
  tool_use/tool_result pairs; Codex emits semantic items (a patch, a command)
339
332
  with their own lifecycle. The adapter layer is where that converges on