moi-computer 0.5.2-next.0 → 0.6.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.
Files changed (89) hide show
  1. package/client/AGENTS.md +9 -0
  2. package/client/api/app-ui-keys.ts +4 -0
  3. package/client/api/workspace-keys.ts +2 -2
  4. package/client/app/routes/WorkspaceRoute.tsx +8 -28
  5. package/client/app/shell/SidebarLayout.tsx +1 -1
  6. package/client/components/shared/Composer.tsx +15 -9
  7. package/client/components/shared/IconGhost.tsx +130 -0
  8. package/client/components/ui/dropdown-menu.tsx +2 -5
  9. package/client/components/ui/popover.tsx +11 -4
  10. package/client/components/ui/slider.tsx +70 -0
  11. package/client/components/ui/spinner.tsx +18 -0
  12. package/client/components/ui/toast.tsx +220 -0
  13. package/client/components/ui/tooltip.tsx +1 -1
  14. package/client/features/chat/ChatComposer.tsx +11 -14
  15. package/client/features/chat/ChatPanel.tsx +15 -14
  16. package/client/features/chat/ChatPopup.tsx +10 -4
  17. package/client/features/chat/ChatSelector.tsx +263 -48
  18. package/client/features/chat/ModelPicker.tsx +295 -121
  19. package/client/features/chat/TurnView.tsx +1 -1
  20. package/client/features/chat/api.ts +36 -9
  21. package/client/features/chat/chat-frames.ts +35 -6
  22. package/client/features/chat/chat-send.ts +40 -6
  23. package/client/features/chat/chat-store.ts +52 -40
  24. package/client/features/chat/model-order.ts +50 -28
  25. package/client/features/chat/useChat.ts +71 -60
  26. package/client/features/chat/useSelectedSession.ts +151 -0
  27. package/client/features/chat/useStickToBottom.ts +3 -3
  28. package/client/features/home/api.ts +0 -2
  29. package/client/features/scratchpad/ScratchpadControls.tsx +2 -2
  30. package/client/features/settings/IconPicker.tsx +2 -2
  31. package/client/features/settings/WorkspaceSettings.tsx +6 -6
  32. package/client/features/views/ViewBuilderTab.tsx +3 -4
  33. package/client/features/views/api.ts +1 -0
  34. package/client/features/views/useViewBuilderActions.ts +7 -3
  35. package/client/features/workspace/WorkspaceScreen.tsx +40 -19
  36. package/client/features/workspace/WorkspaceSkillUpdateBanner.tsx +2 -2
  37. package/client/features/workspace/WorkspaceTabs.tsx +10 -1
  38. package/client/index.css +5 -3
  39. package/client/main.tsx +2 -0
  40. package/client/runtime/useWorkspaceEvents.ts +1 -0
  41. package/client/store/ui.ts +13 -3
  42. package/dist/{chunk-m9qja0nx.js → chunk-0pcdwjkp.js} +1 -1
  43. package/dist/chunk-55sh4dty.js +2 -0
  44. package/dist/{chunk-h3evrtyp.js → chunk-9y2zbzqz.js} +1 -1
  45. package/dist/{chunk-7bzpmtxp.js → chunk-afgbg75t.js} +1 -1
  46. package/dist/chunk-agtetn7n.css +1 -0
  47. package/dist/chunk-bv6vrvqf.js +27 -0
  48. package/dist/chunk-dfs36zgc.js +1 -0
  49. package/dist/chunk-exj6hr30.js +9 -0
  50. package/dist/{chunk-v797g6ap.js → chunk-m11ckkxd.js} +1 -1
  51. package/dist/chunk-n6t40enm.js +1 -0
  52. package/dist/{chunk-jg6ezptn.js → chunk-rxvx4ta9.js} +3 -3
  53. package/dist/index.html +1 -1
  54. package/lib/attachment-note.ts +18 -0
  55. package/lib/chat-title.ts +6 -0
  56. package/lib/types.ts +33 -10
  57. package/package.json +1 -1
  58. package/server/api.ts +100 -10
  59. package/server/app-settings.ts +1 -1
  60. package/server/data-dir.ts +1 -1
  61. package/server/harness/README.md +6 -0
  62. package/server/harness/claude-code/adapter.ts +2 -2
  63. package/server/harness/claude-code/index.ts +7 -1
  64. package/server/harness/claude-code/models.ts +25 -2
  65. package/server/harness/claude-code/session-title.ts +106 -0
  66. package/server/harness/claude-code/session.ts +114 -17
  67. package/server/harness/claude-code/sessions.ts +35 -4
  68. package/server/harness/codex/adapter.ts +27 -2
  69. package/server/harness/codex/client.ts +56 -9
  70. package/server/harness/codex/index.ts +2 -0
  71. package/server/harness/codex/session-title.ts +149 -0
  72. package/server/harness/codex/session.ts +96 -14
  73. package/server/harness/openclaw/adapter.ts +4 -2
  74. package/server/harness/openclaw/discovery.ts +2 -0
  75. package/server/harness/openclaw/session.ts +15 -7
  76. package/server/harness/session-title.ts +96 -0
  77. package/server/harness/types.ts +5 -2
  78. package/server/selected-session.ts +132 -0
  79. package/server/session-config.ts +146 -0
  80. package/server/web.ts +15 -1
  81. package/workspace/.claude/skills/moi-workspace/DESIGN.md +54 -68
  82. package/workspace/.claude/skills/moi-workspace/SKILL.md +8 -2
  83. package/dist/chunk-5vaevt8z.js +0 -2
  84. package/dist/chunk-fhhv99bd.js +0 -1
  85. package/dist/chunk-h0hk61pm.js +0 -9
  86. package/dist/chunk-k5sjx9s5.js +0 -1
  87. package/dist/chunk-rs9nb0fr.js +0 -27
  88. package/dist/chunk-s7za1qsv.css +0 -1
  89. package/server/thread-config.ts +0 -124
@@ -1,124 +0,0 @@
1
- import { mkdir, rename } from 'node:fs/promises'
2
- import { join } from 'path'
3
-
4
- import type { ThreadConfig } from '@/lib/types'
5
-
6
- import { DATA_DIR } from './data-dir'
7
-
8
- // Per-thread model/effort overrides for chat threads. Stored OUTSIDE the user's
9
- // workspace (no repo churn) in ONE global JSON file in moi's data dir, alongside
10
- // the workspace registry. Keyed by workspace path then sessionId:
11
- // { "<workspacePath>": { "<sessionId>": { model?, effort? } } }
12
- // Path (not registry id) is the key so config survives re-registration and lines
13
- // up with the SDK's path-based session storage.
14
-
15
- // A patch may clear a field with `null` (vs `undefined`, which leaves it alone).
16
- export type ThreadConfigPatch = {
17
- model?: string | null
18
- effort?: string | null
19
- }
20
-
21
- type Store = Record<string, Record<string, ThreadConfig>>
22
-
23
- let _path = join(DATA_DIR, 'thread-config.json')
24
-
25
- // Test seam: point the store at a scratch file (mirrors registry.setRegistryPath).
26
- export function setThreadConfigPath(path: string): void {
27
- _path = path
28
- }
29
-
30
- function clean(cfg: ThreadConfig | undefined): ThreadConfig {
31
- const out: ThreadConfig = {}
32
- if (typeof cfg?.model === 'string') out.model = cfg.model
33
- if (typeof cfg?.effort === 'string') out.effort = cfg.effort
34
- return out
35
- }
36
-
37
- function isEmpty(cfg: ThreadConfig): boolean {
38
- return cfg.model === undefined && cfg.effort === undefined
39
- }
40
-
41
- async function readStore(): Promise<Store> {
42
- try {
43
- const parsed = JSON.parse(await Bun.file(_path).text())
44
- return parsed && typeof parsed === 'object' ? (parsed as Store) : {}
45
- } catch {
46
- return {}
47
- }
48
- }
49
-
50
- async function writeStore(store: Store): Promise<void> {
51
- await mkdir(join(_path, '..'), { recursive: true })
52
- const tmp = `${_path}.${process.pid}.tmp`
53
- await Bun.write(tmp, JSON.stringify(store, null, 2))
54
- await rename(tmp, _path)
55
- }
56
-
57
- // Serialize read-modify-write so concurrent save/rename calls can't clobber the
58
- // single shared file (last writer would otherwise drop the other's update).
59
- let writeChain: Promise<unknown> = Promise.resolve()
60
- function locked<T>(fn: () => Promise<T>): Promise<T> {
61
- const run = writeChain.then(fn, fn)
62
- writeChain = run.catch(() => {})
63
- return run
64
- }
65
-
66
- export async function getThreadConfig(
67
- workspacePath: string,
68
- sessionId: string
69
- ): Promise<ThreadConfig> {
70
- const store = await readStore()
71
- return clean(store[workspacePath]?.[sessionId])
72
- }
73
-
74
- export async function hasThreadConfig(workspacePath: string, sessionId: string): Promise<boolean> {
75
- return !isEmpty(await getThreadConfig(workspacePath, sessionId))
76
- }
77
-
78
- // Merge a patch over the stored config and write it back. `null` clears a field,
79
- // `undefined` leaves it untouched, a string sets it. An emptied entry is dropped
80
- // to keep the file tidy. Returns the merged config.
81
- export async function saveThreadConfig(
82
- workspacePath: string,
83
- sessionId: string,
84
- patch: ThreadConfigPatch
85
- ): Promise<ThreadConfig> {
86
- return locked(async () => {
87
- const store = await readStore()
88
- const threads = store[workspacePath] ?? {}
89
- const next = clean(threads[sessionId])
90
- for (const key of ['model', 'effort'] as const) {
91
- const value = patch[key]
92
- if (value === undefined) continue
93
- if (value === null) delete next[key]
94
- else next[key] = value
95
- }
96
- if (isEmpty(next)) delete threads[sessionId]
97
- else threads[sessionId] = next
98
- if (Object.keys(threads).length === 0) delete store[workspacePath]
99
- else store[workspacePath] = threads
100
- await writeStore(store)
101
- return next
102
- })
103
- }
104
-
105
- // Move a thread's config from one id to another (temp id → SDK real id on
106
- // rename). Merges onto whatever the destination already holds (destination wins,
107
- // so a concurrent write under the real id isn't lost) and removes the source.
108
- export async function renameThreadConfig(
109
- workspacePath: string,
110
- from: string,
111
- to: string
112
- ): Promise<void> {
113
- if (from === to) return
114
- await locked(async () => {
115
- const store = await readStore()
116
- const threads = store[workspacePath]
117
- const src = clean(threads?.[from])
118
- if (isEmpty(src)) return
119
- threads![to] = { ...src, ...clean(threads![to]) }
120
- delete threads![from]
121
- store[workspacePath] = threads!
122
- await writeStore(store)
123
- })
124
- }