somora 2026.930.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.
- package/LICENSE +21 -0
- package/README.md +364 -0
- package/bin/node-version.d.mts +3 -0
- package/bin/node-version.mjs +45 -0
- package/bin/somora.mjs +77 -0
- package/config.example.yaml +896 -0
- package/docs/agents.md +677 -0
- package/docs/api.md +3194 -0
- package/docs/browser.md +317 -0
- package/docs/builder.md +331 -0
- package/docs/cache-strategy.md +373 -0
- package/docs/compaction.md +253 -0
- package/docs/display.md +154 -0
- package/docs/dream-phases.md +891 -0
- package/docs/files.md +387 -0
- package/docs/imagegen.md +366 -0
- package/docs/images/somora-hero.png +0 -0
- package/docs/images/somora-mobile-2026-05-23.png +0 -0
- package/docs/images/somora-tui-2026-05-23.png +0 -0
- package/docs/images/somora-web-2026-05-23.png +0 -0
- package/docs/index.md +178 -0
- package/docs/lsp.md +93 -0
- package/docs/mcp.md +332 -0
- package/docs/memory.md +407 -0
- package/docs/mobile.md +310 -0
- package/docs/models.md +379 -0
- package/docs/projects.md +425 -0
- package/docs/realtime-voice.md +293 -0
- package/docs/resources.md +230 -0
- package/docs/sampling.md +128 -0
- package/docs/security.md +189 -0
- package/docs/sentinel.md +295 -0
- package/docs/setup.md +1217 -0
- package/docs/skills.md +501 -0
- package/docs/team.md +189 -0
- package/docs/thinking.md +463 -0
- package/docs/tmux.md +399 -0
- package/docs/tools.md +117 -0
- package/docs/videogen.md +191 -0
- package/docs/voice.md +288 -0
- package/docs/web.md +893 -0
- package/docs/wiki.md +583 -0
- package/npm-shrinkwrap.json +5670 -0
- package/package.json +116 -0
- package/src/attachments/store.ts +196 -0
- package/src/browser/change-stream.ts +31 -0
- package/src/browser/display.ts +108 -0
- package/src/browser/policy.ts +121 -0
- package/src/browser/screencast.ts +374 -0
- package/src/browser/service.ts +1337 -0
- package/src/browser/session.ts +15 -0
- package/src/browser/snapshot.ts +40 -0
- package/src/cli/auth.ts +117 -0
- package/src/cli/codex.ts +41 -0
- package/src/cli/lsp.ts +71 -0
- package/src/cli/resolvers/clawhub.ts +400 -0
- package/src/cli/setup.ts +835 -0
- package/src/cli/skill.ts +619 -0
- package/src/cli/somora.ts +548 -0
- package/src/cli/systemd-unit.ts +72 -0
- package/src/cli/team.ts +148 -0
- package/src/cli/tui/activity-stream.ts +121 -0
- package/src/cli/tui/api.ts +479 -0
- package/src/cli/tui/app.tsx +1169 -0
- package/src/cli/tui/autocomplete.tsx +55 -0
- package/src/cli/tui/commands.ts +913 -0
- package/src/cli/tui/dream-glyphs.ts +22 -0
- package/src/cli/tui/footer.tsx +15 -0
- package/src/cli/tui/format.ts +28 -0
- package/src/cli/tui/header.tsx +279 -0
- package/src/cli/tui/index.tsx +120 -0
- package/src/cli/tui/markdown.tsx +63 -0
- package/src/cli/tui/sampling.ts +162 -0
- package/src/cli/tui/separator.tsx +13 -0
- package/src/cli/tui/state.ts +42 -0
- package/src/cli/tui/stream.ts +330 -0
- package/src/cli/tui/thinking-text.ts +54 -0
- package/src/cli/tui/turn-views.tsx +499 -0
- package/src/cli/tui/types.ts +410 -0
- package/src/cli/tui/work-queue.ts +161 -0
- package/src/cli/update-args.ts +55 -0
- package/src/cli/wiki.ts +406 -0
- package/src/compaction/index.ts +28 -0
- package/src/compaction/midturn.ts +210 -0
- package/src/compaction/policy.ts +154 -0
- package/src/compaction/summarize.ts +691 -0
- package/src/compaction/template.ts +90 -0
- package/src/compaction/types.ts +148 -0
- package/src/config/loader.ts +276 -0
- package/src/config/reload.ts +43 -0
- package/src/config/types.ts +2292 -0
- package/src/dream/deep-actions.ts +324 -0
- package/src/dream/deep-dispatcher.ts +237 -0
- package/src/dream/deep-llm.ts +388 -0
- package/src/dream/deep-prompts.ts +106 -0
- package/src/dream/deep-runner.ts +757 -0
- package/src/dream/deep-skip-cache.ts +199 -0
- package/src/dream/deep-worker.ts +229 -0
- package/src/dream/json-salvage.ts +34 -0
- package/src/dream/judge.ts +188 -0
- package/src/dream/loop-state.ts +286 -0
- package/src/dream/lucid-actions.ts +303 -0
- package/src/dream/lucid-batches.ts +94 -0
- package/src/dream/lucid-prompt.ts +82 -0
- package/src/dream/lucid-runner.ts +744 -0
- package/src/dream/lucid-storage.ts +277 -0
- package/src/dream/lucid-structure.ts +102 -0
- package/src/dream/lucid-types.ts +137 -0
- package/src/dream/lucid-worker.ts +224 -0
- package/src/dream/rem-dedup.ts +502 -0
- package/src/dream/rem-extract.ts +782 -0
- package/src/dream/rem-reset-run.ts +67 -0
- package/src/dream/rem-runner.ts +696 -0
- package/src/dream/rem-worker.ts +527 -0
- package/src/dream/review-window.ts +71 -0
- package/src/dream/scheduler-state.ts +129 -0
- package/src/dream/storage.ts +497 -0
- package/src/dream/types.ts +133 -0
- package/src/dream/wiki-context.ts +133 -0
- package/src/engine/a2a.ts +33 -0
- package/src/engine/availability.ts +63 -0
- package/src/engine/claude-cli.ts +969 -0
- package/src/engine/codex-app-server-client.ts +294 -0
- package/src/engine/codex-bin.ts +49 -0
- package/src/engine/codex-cli.ts +1014 -0
- package/src/engine/codex-dynamic-tools.ts +239 -0
- package/src/engine/codex-home.ts +63 -0
- package/src/engine/codex-thread-config.ts +74 -0
- package/src/engine/context-budget.ts +257 -0
- package/src/engine/engine-meta-labels.ts +211 -0
- package/src/engine/grok-cli.ts +941 -0
- package/src/engine/inline-think.ts +59 -0
- package/src/engine/model-availability.ts +105 -0
- package/src/engine/openai-compatible.ts +2464 -0
- package/src/engine/reasoning-retry.ts +83 -0
- package/src/engine/registry.ts +13 -0
- package/src/engine/replay.ts +195 -0
- package/src/engine/sampling.ts +90 -0
- package/src/engine/thinking-params.ts +264 -0
- package/src/engine/types.ts +269 -0
- package/src/engine/user-tag.ts +24 -0
- package/src/imagegen/aspect.ts +128 -0
- package/src/imagegen/generate.ts +642 -0
- package/src/imagegen/references.ts +75 -0
- package/src/imagegen/types.ts +154 -0
- package/src/lsp/client.ts +183 -0
- package/src/lsp/fake-server.helper.mjs +42 -0
- package/src/lsp/format.ts +29 -0
- package/src/lsp/index.ts +21 -0
- package/src/lsp/manager.ts +238 -0
- package/src/lsp/registry.ts +151 -0
- package/src/mcp/config.ts +117 -0
- package/src/mcp/hub/audit.ts +55 -0
- package/src/mcp/hub/bridge.ts +115 -0
- package/src/mcp/hub/catalog.ts +69 -0
- package/src/mcp/hub/credentials.ts +406 -0
- package/src/mcp/hub/env-expand.ts +14 -0
- package/src/mcp/hub/manager.ts +770 -0
- package/src/mcp/hub/normalize.ts +213 -0
- package/src/mcp/server.ts +368 -0
- package/src/mcp/tool-schema.ts +20 -0
- package/src/media/capabilities.ts +392 -0
- package/src/media/records.ts +175 -0
- package/src/media/store.ts +217 -0
- package/src/media/types.ts +69 -0
- package/src/memory/chunking.ts +168 -0
- package/src/memory/embeddings.ts +262 -0
- package/src/memory/index.ts +15 -0
- package/src/memory/inject.ts +197 -0
- package/src/memory/manager.ts +996 -0
- package/src/memory/registry.ts +176 -0
- package/src/memory/rescan.ts +101 -0
- package/src/memory/retrieval.ts +586 -0
- package/src/memory/shared-index.ts +372 -0
- package/src/memory/slug.ts +39 -0
- package/src/memory/storage.ts +385 -0
- package/src/memory/watcher.ts +134 -0
- package/src/multimodal/blocks.ts +101 -0
- package/src/multimodal/dimensions.ts +214 -0
- package/src/multimodal/load.ts +86 -0
- package/src/multimodal/mime.ts +135 -0
- package/src/multimodal/pdf-render.ts +80 -0
- package/src/multimodal/user-content.ts +266 -0
- package/src/persona/files.ts +144 -0
- package/src/persona/loader.ts +598 -0
- package/src/persona/skill-gating-store.ts +59 -0
- package/src/persona/tool-gating-store.ts +113 -0
- package/src/projects/focus.ts +186 -0
- package/src/projects/prompt-block.ts +106 -0
- package/src/projects/scheme.ts +107 -0
- package/src/projects/store.ts +144 -0
- package/src/projects/types.ts +73 -0
- package/src/sentinel/dispatcher.ts +97 -0
- package/src/sentinel/schedule.ts +271 -0
- package/src/sentinel/scheduler.ts +840 -0
- package/src/sentinel/store.ts +259 -0
- package/src/sentinel/types.ts +221 -0
- package/src/server/activity-stream.ts +160 -0
- package/src/server/ask-calls.ts +137 -0
- package/src/server/ask-wait-graph.ts +171 -0
- package/src/server/async-tasks.ts +199 -0
- package/src/server/builder-busy.ts +86 -0
- package/src/server/builder-prompt.ts +204 -0
- package/src/server/builder-questions.ts +117 -0
- package/src/server/builder-session.ts +249 -0
- package/src/server/chat-aborts.ts +83 -0
- package/src/server/claude-config-dir.ts +71 -0
- package/src/server/claude-credential-sync.ts +454 -0
- package/src/server/env-file.ts +100 -0
- package/src/server/env.ts +115 -0
- package/src/server/heal-session.ts +151 -0
- package/src/server/history-page.ts +46 -0
- package/src/server/index.ts +7244 -0
- package/src/server/lockfile.ts +89 -0
- package/src/server/logger.ts +67 -0
- package/src/server/logs.ts +187 -0
- package/src/server/loopback-fetch.ts +130 -0
- package/src/server/openai-client.ts +89 -0
- package/src/server/prompt-assembly.ts +334 -0
- package/src/server/restart-reconcile.ts +139 -0
- package/src/server/run-turn-fallback.ts +275 -0
- package/src/server/run-turn-types.ts +91 -0
- package/src/server/run-turn.ts +1474 -0
- package/src/server/sanitize-assistant-text.ts +112 -0
- package/src/server/session-export.ts +220 -0
- package/src/server/session-queue.ts +376 -0
- package/src/server/session-workdir.ts +49 -0
- package/src/server/sse-h2-safe.ts +61 -0
- package/src/server/sse-liveness.ts +162 -0
- package/src/server/sse-serializer.ts +161 -0
- package/src/server/start-turn.ts +249 -0
- package/src/server/steer-inbox.ts +107 -0
- package/src/server/tls-keeper.ts +153 -0
- package/src/server/tool-format.ts +167 -0
- package/src/server/turn-framing.ts +52 -0
- package/src/server/turn-origin-kind.ts +74 -0
- package/src/server/turn-origin.ts +40 -0
- package/src/server/work-ledger.ts +975 -0
- package/src/server/workspace.ts +114 -0
- package/src/setup/config-edit.ts +201 -0
- package/src/setup/presets.ts +71 -0
- package/src/setup/prompt.ts +163 -0
- package/src/setup/tailscale.ts +44 -0
- package/src/skills/bin-checks.ts +227 -0
- package/src/skills/bootstrap.ts +347 -0
- package/src/skills/env-scope.ts +175 -0
- package/src/skills/gating.ts +71 -0
- package/src/skills/lint.ts +202 -0
- package/src/skills/load.ts +368 -0
- package/src/skills/path-helpers.ts +102 -0
- package/src/skills/registry.ts +178 -0
- package/src/ssh/exec.ts +142 -0
- package/src/ssh/index.ts +12 -0
- package/src/ssh/known-hosts.ts +109 -0
- package/src/ssh/pool.ts +307 -0
- package/src/storage/sessions.ts +602 -0
- package/src/team/render.ts +149 -0
- package/src/team/resolve.ts +122 -0
- package/src/team/store.ts +124 -0
- package/src/team/types.ts +111 -0
- package/src/team/write.ts +95 -0
- package/src/testing/isolated-home.mts +46 -0
- package/src/tmux/attention-watcher.ts +272 -0
- package/src/tmux/attention.ts +336 -0
- package/src/tmux/list.ts +91 -0
- package/src/tmux/origin-store.ts +102 -0
- package/src/tmux/tui-markers.ts +267 -0
- package/src/tools/agents/ask-cancel.ts +94 -0
- package/src/tools/agents/ask-result.ts +235 -0
- package/src/tools/agents/ask.ts +704 -0
- package/src/tools/agents/builder-dispatch.ts +217 -0
- package/src/tools/agents/images.ts +104 -0
- package/src/tools/agents/index.ts +42 -0
- package/src/tools/agents/long-task-timeouts.ts +39 -0
- package/src/tools/agents/session-list.ts +136 -0
- package/src/tools/agents/session-model.ts +106 -0
- package/src/tools/agents/spawn.ts +845 -0
- package/src/tools/agents/status.ts +589 -0
- package/src/tools/browser/index.ts +6 -0
- package/src/tools/browser/ops.ts +145 -0
- package/src/tools/browser/tools.ts +184 -0
- package/src/tools/builder/short-descriptions.ts +80 -0
- package/src/tools/builder/tools.ts +222 -0
- package/src/tools/docs/index.ts +1 -0
- package/src/tools/docs/tools.ts +228 -0
- package/src/tools/dream/index.ts +11 -0
- package/src/tools/dream/tools.ts +1002 -0
- package/src/tools/exec/allowlist.ts +233 -0
- package/src/tools/exec/background-detach.helper.mts +27 -0
- package/src/tools/exec/blacklist.ts +336 -0
- package/src/tools/exec/concurrency.ts +150 -0
- package/src/tools/exec/fit-output.ts +82 -0
- package/src/tools/exec/index.ts +7 -0
- package/src/tools/exec/internal-env.ts +89 -0
- package/src/tools/exec/job-store.ts +403 -0
- package/src/tools/exec/local.ts +649 -0
- package/src/tools/exec/remote.ts +399 -0
- package/src/tools/exec/tools.ts +934 -0
- package/src/tools/file/analyze.ts +378 -0
- package/src/tools/file/index.ts +2 -0
- package/src/tools/file/local.ts +707 -0
- package/src/tools/file/lsp-hook.ts +72 -0
- package/src/tools/file/persona-guard.ts +61 -0
- package/src/tools/file/policy.ts +292 -0
- package/src/tools/file/read-format.ts +129 -0
- package/src/tools/file/remote.ts +680 -0
- package/src/tools/file/replace.ts +507 -0
- package/src/tools/file/search-window.ts +224 -0
- package/src/tools/file/tools.ts +658 -0
- package/src/tools/file/write-scope.ts +182 -0
- package/src/tools/gating.ts +106 -0
- package/src/tools/image/budget.ts +82 -0
- package/src/tools/image/index.ts +7 -0
- package/src/tools/image/tools.ts +601 -0
- package/src/tools/index.ts +99 -0
- package/src/tools/memory/index.ts +12 -0
- package/src/tools/memory/tools.ts +399 -0
- package/src/tools/projects/index.ts +1 -0
- package/src/tools/projects/tools.ts +643 -0
- package/src/tools/registry.ts +427 -0
- package/src/tools/resources/index.ts +8 -0
- package/src/tools/resources/tools.ts +176 -0
- package/src/tools/resources/visibility.ts +60 -0
- package/src/tools/sentinel/index.ts +1 -0
- package/src/tools/sentinel/tools.ts +592 -0
- package/src/tools/skill/index.ts +4 -0
- package/src/tools/skill/tools.ts +285 -0
- package/src/tools/time/index.ts +5 -0
- package/src/tools/time/tools.ts +123 -0
- package/src/tools/tmux/index.ts +1 -0
- package/src/tools/tmux/local.ts +277 -0
- package/src/tools/tmux/remote.ts +168 -0
- package/src/tools/tmux/tools.ts +1064 -0
- package/src/tools/tool-output.ts +97 -0
- package/src/tools/types.ts +227 -0
- package/src/tools/video/index.ts +1 -0
- package/src/tools/video/tools.ts +425 -0
- package/src/tools/web/fetch.ts +337 -0
- package/src/tools/web/index.ts +4 -0
- package/src/tools/web/tools.ts +186 -0
- package/src/tools/wiki/index.ts +1 -0
- package/src/tools/wiki/tools.ts +445 -0
- package/src/tts/cache-gc.ts +128 -0
- package/src/tts/prepare-for-tts.ts +114 -0
- package/src/tts/service.ts +332 -0
- package/src/types/events.ts +695 -0
- package/src/types/turn-origin.ts +53 -0
- package/src/version.ts +21 -0
- package/src/videogen/dialects.ts +222 -0
- package/src/videogen/generate.ts +484 -0
- package/src/videogen/jobs.ts +178 -0
- package/src/videogen/runner.ts +125 -0
- package/src/videogen/wake.ts +119 -0
- package/src/voice/realtime/call.ts +948 -0
- package/src/voice/realtime/consult.ts +293 -0
- package/src/voice/realtime/fake-provider.ts +134 -0
- package/src/voice/realtime/manager.ts +384 -0
- package/src/voice/realtime/openai-provider.ts +471 -0
- package/src/voice/realtime/persona.ts +227 -0
- package/src/voice/realtime/session-match.ts +116 -0
- package/src/voice/realtime/types.ts +182 -0
- package/src/wiki/conflict.ts +113 -0
- package/src/wiki/explorer.ts +578 -0
- package/src/wiki/index-builder.ts +172 -0
- package/src/wiki/language.ts +134 -0
- package/src/wiki/log-builder.ts +150 -0
- package/src/wiki/map.ts +258 -0
- package/src/wiki/migration/analyze.ts +304 -0
- package/src/wiki/migration/execute.ts +689 -0
- package/src/wiki/migration/refine.ts +402 -0
- package/src/wiki/migration/store.ts +100 -0
- package/src/wiki/move-page.ts +57 -0
- package/src/wiki/structure-file.ts +192 -0
- package/src/wiki/taxonomy.ts +140 -0
- package/src/wiki/templates.ts +163 -0
- package/src/wiki/types.ts +133 -0
- package/templates/skills/README.md +24 -0
- package/templates/skills/_templates/api-wrapper/SKILL.md +26 -0
- package/templates/skills/_templates/cli-wrapper/BOOTSTRAP.md +32 -0
- package/templates/skills/_templates/cli-wrapper/SKILL.md +24 -0
- package/templates/skills/_templates/default/SKILL.md +25 -0
- package/templates/skills/builder-handover/SKILL.md +96 -0
- package/templates/skills/builder-handover/assets/ORDER.md +12 -0
- package/templates/skills/skill-author/SKILL.md +110 -0
- package/tsconfig.json +22 -0
- package/web/dist/assets/index-BaVv6pB2.js +631 -0
- package/web/dist/assets/index-BaVv6pB2.js.map +1 -0
- package/web/dist/assets/index-V3FV3Z25.css +32 -0
- package/web/dist/favicon.svg +8 -0
- package/web/dist/index.html +20 -0
- package/web/package.json +36 -0
- package/web/tsconfig.json +25 -0
- package/web-mobile/dist/apple-touch-icon.png +0 -0
- package/web-mobile/dist/assets/index-BqKt7IMx.css +1 -0
- package/web-mobile/dist/assets/index-X_vRr6cd.js +88 -0
- package/web-mobile/dist/assets/index-X_vRr6cd.js.map +1 -0
- package/web-mobile/dist/favicon.svg +8 -0
- package/web-mobile/dist/icon-192.png +0 -0
- package/web-mobile/dist/icon-512.png +0 -0
- package/web-mobile/dist/index.html +27 -0
- package/web-mobile/dist/manifest.webmanifest +32 -0
- package/web-mobile/dist/service-worker.js +90 -0
- package/web-mobile/package.json +28 -0
- package/web-mobile/tsconfig.json +25 -0
package/docs/imagegen.md
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
# Image generation
|
|
2
|
+
|
|
3
|
+
Text-to-image against an OpenAI-shaped image endpoint. Both a human and
|
|
4
|
+
an agent drive the **same code path** — the web app's Media window
|
|
5
|
+
POSTs to `/images/generate`, agents call the `image_generate` tool —
|
|
6
|
+
so the two can't end up able to do different things.
|
|
7
|
+
|
|
8
|
+
Off by default. Nothing appears in the UI and no tool is exposed until
|
|
9
|
+
`imageGen` is configured.
|
|
10
|
+
|
|
11
|
+
## Nothing appears until it is configured
|
|
12
|
+
|
|
13
|
+
There is no image surface at all until an `imageGen` block with at least
|
|
14
|
+
one model exists. That holds in three independent places, and all three
|
|
15
|
+
are checked:
|
|
16
|
+
|
|
17
|
+
- **the model's tool list** — `image_generate` and friends are not
|
|
18
|
+
offered, so they cost no context and cannot be called;
|
|
19
|
+
- **HTTP** — `GET /images/status` reports `enabled: false`; generate,
|
|
20
|
+
listing, catalog and capability routes answer `503`;
|
|
21
|
+
- **the desktop** — the Media tile stays hidden, and the window says so
|
|
22
|
+
rather than opening an empty form.
|
|
23
|
+
|
|
24
|
+
The same applies per agent: `tools: deny: [toolset:image]` in an
|
|
25
|
+
agent.yaml removes `image_generate` and `image_models` for that agent
|
|
26
|
+
on every engine. `media_list` sits in its own `media` toolset, because a
|
|
27
|
+
video-only install needs it too.
|
|
28
|
+
|
|
29
|
+
## What is verified, and what is not
|
|
30
|
+
|
|
31
|
+
Everything in this document runs daily against a **self-hosted,
|
|
32
|
+
OpenAI-shaped endpoint** — a LiteLLM router in front of local models.
|
|
33
|
+
Verified there end to end: both wire dialects, reference images as
|
|
34
|
+
multipart, catalog-driven capabilities, the `503`-means-busy path, and
|
|
35
|
+
the fallback chain.
|
|
36
|
+
|
|
37
|
+
**OpenRouter verified live**: catalog read, text-to-image
|
|
38
|
+
and edits from reference images all work against `openrouter.ai`.
|
|
39
|
+
|
|
40
|
+
**Not yet tested against a live hosted account.** The `openai` dialect
|
|
41
|
+
is written to OpenAI's published API and its shape has been exercised
|
|
42
|
+
against a faithful local stand-in, but nobody has run it against
|
|
43
|
+
`api.openai.com` yet. It is expected to work; it is not proven to. If
|
|
44
|
+
you try it, the interesting bits are the response shapes — that is where
|
|
45
|
+
providers differ most.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Configure
|
|
49
|
+
|
|
50
|
+
Image models are **not** listed in `providers.<x>.models`. Same posture
|
|
51
|
+
as STT and TTS: a model listed there becomes selectable as a
|
|
52
|
+
conversation model, shows up in pickers and `/v1/models`, and fails on
|
|
53
|
+
the first turn. It's a separate service surface, and it reuses an
|
|
54
|
+
existing provider only for its `baseUrl` and `apiKey`:
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
providers:
|
|
58
|
+
openrouter:
|
|
59
|
+
engine: openai-compatible
|
|
60
|
+
baseUrl: https://openrouter.ai/api/v1
|
|
61
|
+
apiKey: <YOUR_OPENROUTER_KEY>
|
|
62
|
+
models: [...] # chat models, unrelated to the below
|
|
63
|
+
|
|
64
|
+
imageGen:
|
|
65
|
+
enabled: true
|
|
66
|
+
outputDir: ~/somoraworkspace/images
|
|
67
|
+
maxImagesPerTurn: 5
|
|
68
|
+
models:
|
|
69
|
+
- name: grok-imagine # handle used by tool + UI
|
|
70
|
+
provider: openrouter # ← baseUrl + apiKey from here
|
|
71
|
+
model: x-ai/grok-imagine-image-2.0
|
|
72
|
+
label: "Grok Imagine 2.0"
|
|
73
|
+
defaults:
|
|
74
|
+
resolution: 1K
|
|
75
|
+
aspect_ratio: "16:9"
|
|
76
|
+
output_format: png
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Which API key gets used**: the one on the provider the model points
|
|
80
|
+
at. No second key, no duplicated connection details. If you want image
|
|
81
|
+
generation billed separately, define a second provider entry with the
|
|
82
|
+
same `baseUrl` and a different key, and point `provider:` at that.
|
|
83
|
+
|
|
84
|
+
**Adding a model** needs three things: a handle, the provider it goes
|
|
85
|
+
through, and the wire id. `GET /images/catalog` lists what the provider
|
|
86
|
+
currently offers, so you don't have to hunt for the exact id — the
|
|
87
|
+
Media window surfaces it too. Config stays the source of truth for
|
|
88
|
+
what somora will actually call.
|
|
89
|
+
|
|
90
|
+
**Looking at what was made.** Picking a tile in the Media window shows
|
|
91
|
+
it below the gallery with its prompt, specs and cost. An image opens
|
|
92
|
+
large in the file viewer with a click (zoom cursor); a video plays
|
|
93
|
+
inline and has an **open** button in its corner for the same viewer —
|
|
94
|
+
a click on the video itself is play/pause, so it can't double as the
|
|
95
|
+
"open large" gesture. Both land in the same FileView window an agent's
|
|
96
|
+
link to the file would open.
|
|
97
|
+
|
|
98
|
+
**Endpoint paths differ by provider.** The default `/images` is
|
|
99
|
+
OpenRouter's; OpenAI direct wants `/images/generations`. Set
|
|
100
|
+
`endpoint:` per model when it differs, and `capabilitiesEndpoint: null`
|
|
101
|
+
when the provider has no model catalog at all (a local image server).
|
|
102
|
+
|
|
103
|
+
**Reference images are where providers really diverge.** Plain
|
|
104
|
+
generation is the same JSON POST everywhere, but working *from* an
|
|
105
|
+
existing image is a different request depending on the endpoint, so
|
|
106
|
+
each model declares which dialect it speaks:
|
|
107
|
+
|
|
108
|
+
| `wire:` | Reference images travel as | Sent to |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| `openrouter` (default) | `input_references`: one `{ "type": "image_url", "image_url": { "url": "data:<mime>;base64,…" } }` object per file | `endpoint` |
|
|
111
|
+
| `openai` | multipart, one `image[]` part per file | `editEndpoint` |
|
|
112
|
+
|
|
113
|
+
`openai` is the setting for OpenAI itself and for an OpenAI-compatible
|
|
114
|
+
router such as LiteLLM in front of a local image backend. There is no
|
|
115
|
+
autodetection: a wrong guess would only surface after the user already
|
|
116
|
+
waited for a render, and whoever configures the model knows the answer.
|
|
117
|
+
|
|
118
|
+
**On the `openai` wire, `aspect_ratio` is sent as `size`.** That wire
|
|
119
|
+
has no ratio field, and a router in front of a backend that does
|
|
120
|
+
understand ratios forwards the unknown key on `/images/generations` but
|
|
121
|
+
rebuilds the multipart body for `/images/edits` from a fixed whitelist
|
|
122
|
+
— so a "16:9" edit with reference images came back 1024×1024 without a
|
|
123
|
+
word (measured against LiteLLM). somora therefore translates
|
|
124
|
+
before sending: if the model's catalog says `size` also accepts named
|
|
125
|
+
ratios (`supported_parameters.size.also_accepts`, as a self-hosted
|
|
126
|
+
visual adapter may publish), the ratio string itself goes out as `size`
|
|
127
|
+
and the backend renders it exactly; else the listed size closest to
|
|
128
|
+
the ratio; else OpenAI's own sizes (1792×1024 / 1024×1792 — 7:4, not
|
|
129
|
+
16:9, and the result carries a warning saying so). An explicit `size`
|
|
130
|
+
always wins over `aspect_ratio`. One exception keeps existing setups
|
|
131
|
+
working: a backend whose catalog positively declares `aspect_ratio`
|
|
132
|
+
and offers no named sizes still receives `aspect_ratio` on the plain
|
|
133
|
+
generation path (routers forward unknown JSON keys there); only the
|
|
134
|
+
multipart edit path is always translated. The `openrouter` wire keeps
|
|
135
|
+
`aspect_ratio`, which is native there. What actually left somora is
|
|
136
|
+
logged per request (`imagegen.request`: endpoint, multipart or not,
|
|
137
|
+
the spec fields — never the image bytes) and stored on the record as
|
|
138
|
+
its `specs`.
|
|
139
|
+
|
|
140
|
+
**Responses come in three shapes, and all three end as a local file.**
|
|
141
|
+
An endpoint that does not want to serve files itself returns the image
|
|
142
|
+
inline as `data[].b64_json`; OpenAI direct returns an absolute URL on a
|
|
143
|
+
different host; an image server addressed directly tends to return a
|
|
144
|
+
*relative* path into its own output tree, because from its side the
|
|
145
|
+
client already knows the host. Relative paths are resolved against the
|
|
146
|
+
provider's `baseUrl`.
|
|
147
|
+
|
|
148
|
+
The provider's API key is sent when fetching such a URL **only if the
|
|
149
|
+
URL is on the same origin as `baseUrl`**. A pre-signed link on someone
|
|
150
|
+
else's host does not need it, and sending it there would hand the
|
|
151
|
+
credential to a third party.
|
|
152
|
+
|
|
153
|
+
**When a model is unavailable.** An image model can be configured and
|
|
154
|
+
still not be loaded right now — image backends commonly share a GPU box
|
|
155
|
+
that runs one profile at a time, and answer `503` when theirs isn't
|
|
156
|
+
active. `fallback:` on a model names another handle to try; that one may
|
|
157
|
+
name a fallback of its own.
|
|
158
|
+
|
|
159
|
+
Only *availability* walks the chain: unreachable, timing out, or a
|
|
160
|
+
server error. A rejected spec value or an empty prompt fails on the
|
|
161
|
+
first model instead, because the next one would reject it too and the
|
|
162
|
+
real message would be buried. When a fallback did happen, the tool
|
|
163
|
+
result and the HTTP response say so — a chain that has quietly settled
|
|
164
|
+
on its last resort is a cost and quality change worth noticing.
|
|
165
|
+
|
|
166
|
+
**Sampling knobs.** `steps`, `cfg` and `guidance` are passed through
|
|
167
|
+
when set and omitted when not, so a model's own defaults stand unless
|
|
168
|
+
someone deliberately overrides them. They are not part of OpenAI's image
|
|
169
|
+
API but are the common vocabulary of diffusion backends; which of them a
|
|
170
|
+
given model actually reads is answered by its capability list, not by
|
|
171
|
+
anything hardcoded. Useful in a loop: generate, look at the result
|
|
172
|
+
(`file_read` with a vision model, `analyze_file` without one), adjust,
|
|
173
|
+
regenerate.
|
|
174
|
+
|
|
175
|
+
**A substituted size is noticed here, not upstream.** Endpoints cap
|
|
176
|
+
dimensions, round to sizes they support, or only render squares — and
|
|
177
|
+
they answer `200` with a perfectly good image of the wrong shape. somora
|
|
178
|
+
reads the returned image's real pixel dimensions and compares them to
|
|
179
|
+
what was asked for; a mismatch becomes a note on the result naming both
|
|
180
|
+
numbers. The same check runs for the **shape**: when a ratio was asked
|
|
181
|
+
for (as `aspect_ratio`, or as a named `size`) and the pixels are more
|
|
182
|
+
than 1 % off, the result says which ratio was requested and what came
|
|
183
|
+
back (`imagegen.aspect_ratio_substituted` in the log) — the case that
|
|
184
|
+
would have stopped a series of accidental squares after the first
|
|
185
|
+
one. This deliberately does not depend on the endpoint reporting it,
|
|
186
|
+
because a strict OpenAI-shaped proxy in front of a backend drops any
|
|
187
|
+
non-standard response field — measured against exactly such a router.
|
|
188
|
+
Dimensions are kept on the image record.
|
|
189
|
+
|
|
190
|
+
Where a provider *does* report what it did differently, `ignored_params`
|
|
191
|
+
(names it accepted but did not use) and `warnings` (free text) are read
|
|
192
|
+
and relayed to the caller verbatim. Both are optional and absent almost
|
|
193
|
+
everywhere.
|
|
194
|
+
|
|
195
|
+
## How specs are validated
|
|
196
|
+
|
|
197
|
+
Allowed values differ per model — grok-imagine renders 1K and 2K,
|
|
198
|
+
others do 512 or 4K — so somora doesn't hardcode them. It reads the
|
|
199
|
+
provider's image-model catalog at runtime and validates against that.
|
|
200
|
+
Precedence:
|
|
201
|
+
|
|
202
|
+
1. `imageGen.models[].allow` — operator override, always wins
|
|
203
|
+
2. the provider catalog, cached per process
|
|
204
|
+
3. nothing known → **everything is allowed**
|
|
205
|
+
|
|
206
|
+
That third step is deliberate. A tool that refuses valid input because
|
|
207
|
+
a catalog was briefly unreachable would be worse than no validation at
|
|
208
|
+
all, so only a positively-known allow-list can reject something. The
|
|
209
|
+
same rule drives the UI: a spec the catalog pins down renders as a
|
|
210
|
+
dropdown of exactly its values, one it says nothing about renders as a
|
|
211
|
+
free-text field.
|
|
212
|
+
|
|
213
|
+
Rejections name the valid values:
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
resolution '4K' is not supported by Grok Imagine 2.0 — allowed: 1K, 2K
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
The caller is usually a language model, and one told only "invalid"
|
|
220
|
+
retries the same thing.
|
|
221
|
+
|
|
222
|
+
## Where images go
|
|
223
|
+
|
|
224
|
+
Every image lands in `imageGen.outputDir`, regardless of which agent
|
|
225
|
+
made it. That single directory is what the gallery and the file-serving
|
|
226
|
+
route index; resolving it per agent workspace would scatter images
|
|
227
|
+
across several and leave the gallery blind to most of them.
|
|
228
|
+
|
|
229
|
+
**One image, one place.** There is no second destination. Two paths for
|
|
230
|
+
the same bytes — one of them routinely a `<workspace>/<workspace>/…`
|
|
231
|
+
folder that a relative path creates by accident — would have the gallery
|
|
232
|
+
list the same picture under two names. An agent that needs the file uses
|
|
233
|
+
the path in the tool result. `save_to` is accepted by the tool and the
|
|
234
|
+
route so a persona line that names one does not fail a generation; it is
|
|
235
|
+
ignored, and the result says where the image actually is. The Media
|
|
236
|
+
window shows the one canonical path.
|
|
237
|
+
|
|
238
|
+
Filenames are `2026-08-26_143012_koala-im-weltraum.png`: chronologically
|
|
239
|
+
sortable and recognizable without opening them.
|
|
240
|
+
|
|
241
|
+
Metadata lives separately, one JSON file per item under
|
|
242
|
+
`~/.somora/media/` (images and videos share the store) — prompt, model,
|
|
243
|
+
every spec, cost, timestamp, agent, paths. The images directory itself is something you browse and clean
|
|
244
|
+
out, and provenance shouldn't vanish with a file you dragged elsewhere.
|
|
245
|
+
|
|
246
|
+
## Tools
|
|
247
|
+
|
|
248
|
+
| Tool | Purpose |
|
|
249
|
+
|---|---|
|
|
250
|
+
| `image_generate` | Generate and save. Returns path + metadata, not the bytes. |
|
|
251
|
+
| `media_list` | Find earlier images **and video** by prompt substring, type, model, agent, or date. |
|
|
252
|
+
| `image_models` | List configured handles, and what one model accepts. |
|
|
253
|
+
|
|
254
|
+
Specs travel as real request fields (`aspect_ratio: "16:9"`), never as
|
|
255
|
+
text inside the prompt. The prompt is passed through verbatim.
|
|
256
|
+
|
|
257
|
+
`image_generate` deliberately does **not** return the image by default:
|
|
258
|
+
a 2K PNG as base64 in a tool result is millions of characters of
|
|
259
|
+
context. `return_image: true` opts into it (~2k tokens) and requires a
|
|
260
|
+
vision-capable model; without one, the error points at `analyze_file`,
|
|
261
|
+
which dispatches to the configured `vision.worker`.
|
|
262
|
+
|
|
263
|
+
`media_list` exists because a path in a tool result doesn't survive
|
|
264
|
+
context compaction. "The koala one" has to stay findable. It is named
|
|
265
|
+
for the question, not for one medium: finding the thing made earlier is
|
|
266
|
+
the same question for a picture and for a video, and the gallery behind
|
|
267
|
+
it holds both.
|
|
268
|
+
|
|
269
|
+
`image_models` exists because the `model` argument is a free string:
|
|
270
|
+
with more than one model configured, nothing else tells the caller
|
|
271
|
+
which handles are available, and a wrong guess costs a round trip.
|
|
272
|
+
Listing handles is free; passing `model:` for one of them also reports
|
|
273
|
+
the values that model accepts per spec field, which is the other thing
|
|
274
|
+
that is otherwise learned only by being rejected. A field the catalog
|
|
275
|
+
takes as free text shows as `any value`; when the catalog also names
|
|
276
|
+
known-good values for it (`supported_parameters.<field>.recommended`),
|
|
277
|
+
they appear under `recommended` — not a restriction, but a value
|
|
278
|
+
outside that list is the usual reason for an upstream 400, so prefer
|
|
279
|
+
them.
|
|
280
|
+
|
|
281
|
+
**`reference_images` takes file paths**, not base64 — the tool reads
|
|
282
|
+
them itself, through the same read policy as `file_read`. Passing
|
|
283
|
+
several is how sources get combined into one picture. Whether a model
|
|
284
|
+
accepts more than one is its own business; `image_models` reports the
|
|
285
|
+
limit when the provider publishes it.
|
|
286
|
+
|
|
287
|
+
Image generation writes only into `imageGen.outputDir`, so it is not a
|
|
288
|
+
way around the `file_write` policy.
|
|
289
|
+
|
|
290
|
+
### Per-agent review stance
|
|
291
|
+
|
|
292
|
+
```yaml
|
|
293
|
+
# ~/.somora/agents/<name>/agent.yaml
|
|
294
|
+
imageReview: never # never (default) | always
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
`always` feeds each generated image back into that agent's context so
|
|
298
|
+
it can judge the result and re-prompt on its own. Meant for agents
|
|
299
|
+
whose job is images.
|
|
300
|
+
|
|
301
|
+
`never` is **not a lock**. The agent can still pass `return_image` per
|
|
302
|
+
call when the task demands it, and afterwards the file is on disk like
|
|
303
|
+
any other — "have a look at it" works via `file_read`. Nothing is lost,
|
|
304
|
+
it's only deferred until someone decides it's worth the tokens.
|
|
305
|
+
|
|
306
|
+
`maxImagesPerTurn` caps how many images one turn may produce. It's a
|
|
307
|
+
cost brake, not a rate limit: an agent set to `always` can otherwise
|
|
308
|
+
re-prompt in a loop at real money per round. Under claude-cli the tool
|
|
309
|
+
runs in an MCP child process with no turn id; there the per-call cap
|
|
310
|
+
still applies but nothing accumulates. codex-cli and openai-compatible
|
|
311
|
+
run it in-process with the turn id, so the cap accumulates.
|
|
312
|
+
|
|
313
|
+
## In the chat
|
|
314
|
+
|
|
315
|
+
Images generated during a turn appear on the assistant's bubble
|
|
316
|
+
automatically. The server publishes them after the turn finalizes —
|
|
317
|
+
the agent doesn't have to remember to send anything, because the
|
|
318
|
+
failure mode of relying on that is "Done!" with nothing to look at.
|
|
319
|
+
|
|
320
|
+
Mechanically it's an append-only `assistant_media` event paired to the
|
|
321
|
+
bubble by `turnId`, exactly like `assistant_audio`, persisted to JSONL
|
|
322
|
+
so a reloaded conversation still shows them. Each entry carries its own
|
|
323
|
+
`type` (`image` or `video`) rather than the event naming one medium: the
|
|
324
|
+
kind string lives in session files forever, and a second, nearly
|
|
325
|
+
identical event kind for the next medium would have to be understood by
|
|
326
|
+
every reader from then on.
|
|
327
|
+
|
|
328
|
+
`/mobile` deliberately renders no media — it marks the bubble with a
|
|
329
|
+
one-liner naming what exists and points at the web app, so a turn that
|
|
330
|
+
produced a picture doesn't read as an empty-handed answer on a phone.
|
|
331
|
+
|
|
332
|
+
## HTTP
|
|
333
|
+
|
|
334
|
+
| Route | Purpose |
|
|
335
|
+
|---|---|
|
|
336
|
+
| `GET /images/status` | Enabled? Configured models, output dir. Drives the desktop tile. |
|
|
337
|
+
| `GET /images` | Gallery listing. `query`, `model`, `agent`, `since`, `until`, `limit`, `offset`. |
|
|
338
|
+
| `GET /images/:id` | One record. |
|
|
339
|
+
| `GET /images/:id/file` | The image bytes. |
|
|
340
|
+
| `GET /images/models/:name/capabilities` | Spec vocabulary for one model. |
|
|
341
|
+
| `GET /images/catalog` | What the provider offers (`?provider=`). |
|
|
342
|
+
| `POST /images/generate` | Generate. Body: `prompt` plus any specs. |
|
|
343
|
+
| `DELETE /images/:id` | Forget the record. **The file stays.** |
|
|
344
|
+
|
|
345
|
+
Files are served **by record id, never by path**. The client can't name
|
|
346
|
+
a file; the id is looked up in the metadata store and the path comes
|
|
347
|
+
from there. That's what lets the images directory be user-chosen
|
|
348
|
+
without the route becoming a way to read arbitrary files.
|
|
349
|
+
|
|
350
|
+
`DELETE` removes the gallery entry only. Deleting user files from a
|
|
351
|
+
one-click gallery button is the wrong default, and an image may have a
|
|
352
|
+
hardlink somewhere that somora cannot reliably reach.
|
|
353
|
+
|
|
354
|
+
## Known gaps
|
|
355
|
+
|
|
356
|
+
- **Reference images** (image-to-image) work through the tool's
|
|
357
|
+
`reference_images` argument, but the Media window has no picker for
|
|
358
|
+
them — the browser path accepts base64 only.
|
|
359
|
+
- **No progress streaming.** The endpoint can stream partial renders;
|
|
360
|
+
somora waits for the finished image and shows a busy state.
|
|
361
|
+
- **No automatic cleanup.** Generated images are work product, not a
|
|
362
|
+
cache, so nothing is ever deleted on a timer. The gallery shows the
|
|
363
|
+
total size so the archive's growth stays visible.
|
|
364
|
+
- **Any agent that sees the toolset can generate.** Restrict it per
|
|
365
|
+
agent with the normal `tools:` gating in `agent.yaml`
|
|
366
|
+
(`deny: [toolset:image]`).
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# somora docs — start here
|
|
2
|
+
|
|
3
|
+
A short guide so you don't have to read every page to get started.
|
|
4
|
+
somora is a **local-first gateway for personal AI agents with persistent
|
|
5
|
+
memory**. It runs as a long-lived service on your own machine, exposes
|
|
6
|
+
an HTTP+SSE API plus three first-party clients (TUI, web desktop,
|
|
7
|
+
mobile PWA), and lets you route conversations across Claude /
|
|
8
|
+
ChatGPT / any OpenAI-compatible model — all without giving up
|
|
9
|
+
ownership of the chat log, the memory layer, or your knowledge base.
|
|
10
|
+
|
|
11
|
+
## What is somora — in one paragraph
|
|
12
|
+
|
|
13
|
+
You define **agents** (personas with their own model, memory inbox, and
|
|
14
|
+
session). They come in two kinds: **chat agents** — the ones you talk
|
|
15
|
+
to, that remember and coordinate — and **builders**, coding harnesses
|
|
16
|
+
that take a repository, plan, build, test and report
|
|
17
|
+
([builder.md](builder.md)). You talk to both from the TUI, the browser,
|
|
18
|
+
or your phone.
|
|
19
|
+
The server orchestrates the actual LLM call against the engine you
|
|
20
|
+
configured (subscription or API), persists every message as JSONL,
|
|
21
|
+
and runs a three-phase background **dream system** that turns raw
|
|
22
|
+
session content into curated memory notes and a shared wiki over time.
|
|
23
|
+
All of that stays on your machine.
|
|
24
|
+
|
|
25
|
+
## Choose your path
|
|
26
|
+
|
|
27
|
+
You probably don't need every page below right away.
|
|
28
|
+
|
|
29
|
+
**I just want to try it.** Start with the [project README](../README.md)
|
|
30
|
+
quickstart — one line installs everything and starts the setup
|
|
31
|
+
assistant, which connects a model, creates your first agent and sends
|
|
32
|
+
it a test message. ~10 minutes.
|
|
33
|
+
|
|
34
|
+
**I want to chat from the browser or my phone.** Read
|
|
35
|
+
[setup.md → HTTPS via Tailscale](setup.md#https-tailscale--required-for-the-web-client-at-scale)
|
|
36
|
+
(or run `somora setup access`, which does it for you)
|
|
37
|
+
to get a real cert, then open `https://<your-tailnet>.ts.net:18737/web/`
|
|
38
|
+
in the browser. The mobile PWA is the same URL with `/mobile/` — see
|
|
39
|
+
[mobile.md](mobile.md).
|
|
40
|
+
|
|
41
|
+
**I want to add a new provider / model.** [setup.md → Configuring
|
|
42
|
+
providers](setup.md#6-configuring-providers) plus the comment block in
|
|
43
|
+
[`config.example.yaml`](../config.example.yaml) is the full reference.
|
|
44
|
+
|
|
45
|
+
**I want an agent to build software.** Create one of kind `builder`
|
|
46
|
+
([builder.md](builder.md)): it plans in a repository, you press Go, it
|
|
47
|
+
builds, tests and reports; another agent can hand it the order with the
|
|
48
|
+
bundled `builder-handover` skill.
|
|
49
|
+
|
|
50
|
+
**I want my agent to do real work** — read files, run commands, search
|
|
51
|
+
the web, edit notes. The [tools overview](tools.md) lists the tool
|
|
52
|
+
families. [files.md](files.md), [resources.md](resources.md), and
|
|
53
|
+
[tmux.md](tmux.md) cover the heavy ones. [Skills](skills.md) are
|
|
54
|
+
markdown how-tos you install to teach an agent multi-step recipes.
|
|
55
|
+
|
|
56
|
+
**I want to decide what each agent may use.** Tools and skills are
|
|
57
|
+
shared by all agents; the web client's **Abilities** window (or
|
|
58
|
+
`agent.yaml`) hides any of them for a given agent. [mcp.md → Per-agent
|
|
59
|
+
tool control](mcp.md#per-agent-tool-control) and [skills.md → Per-agent
|
|
60
|
+
visibility](skills.md#per-agent-visibility).
|
|
61
|
+
|
|
62
|
+
**I want my agents to make video.** [videogen.md](videogen.md) — a
|
|
63
|
+
render takes minutes, so the agent starts one and is woken when it is
|
|
64
|
+
ready rather than holding its turn open. Off until `videoGen` is
|
|
65
|
+
configured; verified against a self-hosted endpoint, the hosted
|
|
66
|
+
providers are untested.
|
|
67
|
+
|
|
68
|
+
**I want my agents to make images.** [imagegen.md](imagegen.md) —
|
|
69
|
+
configure a model, then generate from the Media window or let an
|
|
70
|
+
agent call `image_generate`. Results land in your workspace and show
|
|
71
|
+
up in the chat.
|
|
72
|
+
|
|
73
|
+
**I want long-term memory + a shared knowledge base.** Read
|
|
74
|
+
[memory.md](memory.md) for the per-agent inbox, [wiki.md](wiki.md) for
|
|
75
|
+
the shared layer, and [dream-phases.md](dream-phases.md) for how
|
|
76
|
+
sessions automatically flow into both.
|
|
77
|
+
|
|
78
|
+
**I want to build a third-party client / integration.** [api.md](api.md)
|
|
79
|
+
is the HTTP+SSE contract — same surface the built-in clients use.
|
|
80
|
+
|
|
81
|
+
## Core concepts in one sentence each
|
|
82
|
+
|
|
83
|
+
- **agent** — a persona with its own `AGENTS.md`, memory inbox, default
|
|
84
|
+
model, and chat sessions. Lives at `~/.somora/agents/<name>/`.
|
|
85
|
+
- **session** — a single chat thread with one agent. Persisted as JSONL,
|
|
86
|
+
resumable, switchable mid-conversation.
|
|
87
|
+
- **engine** — the adapter that talks to an LLM backend. Four exist:
|
|
88
|
+
`claude-cli` (Claude subscription), `codex-cli` (ChatGPT subscription,
|
|
89
|
+
bundled), `grok-cli` (SuperGrok subscription), `openai-compatible`
|
|
90
|
+
(any `/v1/chat/completions` endpoint — OpenRouter, Ollama, oMLX,
|
|
91
|
+
LM Studio, …).
|
|
92
|
+
- **provider / model / alias** — `config.yaml` declares providers (with
|
|
93
|
+
baseUrl + apiKey if needed) and models on each. An `alias` lets you
|
|
94
|
+
refer to a model by short nickname anywhere.
|
|
95
|
+
- **memory** — three layers an agent reads from: its own per-agent
|
|
96
|
+
inbox (`~/.somora/agents/<name>/memory/*.md`), the shared wiki, and
|
|
97
|
+
the read-only Obsidian vault. Hybrid retrieval: vector + BM25.
|
|
98
|
+
- **wiki** — a curated long-term knowledge base shared across all
|
|
99
|
+
agents. Lives under your Obsidian vault. Written by the dream system,
|
|
100
|
+
editable by hand.
|
|
101
|
+
- **dream system** — three background phases. **REM** turns finished
|
|
102
|
+
sessions into memory-inbox notes (per-agent). **Deep** promotes
|
|
103
|
+
high-value notes into the shared wiki. **Lucid** cleans up the wiki
|
|
104
|
+
on a slower cadence. See [dream-phases.md](dream-phases.md).
|
|
105
|
+
- **project** — an explicit pin of "files / paths / vault notes /
|
|
106
|
+
research artifacts that belong to this chat session". Auto-injected
|
|
107
|
+
into the agent's system prompt. See [projects.md](projects.md).
|
|
108
|
+
- **resource** — a configured SSH host. `file_*`, `exec`, and `tmux`
|
|
109
|
+
tools dispatch against it via `target=<resource>`. See
|
|
110
|
+
[resources.md](resources.md).
|
|
111
|
+
- **skill** — a markdown how-to (agentskills.io format) installed at
|
|
112
|
+
`~/.somora/skills/<slug>/SKILL.md`. The agent loads the body on
|
|
113
|
+
demand via the `skill` tool when it recognizes the situation.
|
|
114
|
+
- **tools** — the things an agent can call. Memory reads, wiki edits,
|
|
115
|
+
file I/O, shell exec, tmux sessions, web search/fetch, sub-agent
|
|
116
|
+
spawning, etc. See [tools.md](tools.md).
|
|
117
|
+
- **voice** — two separate features that share only the word. Dictation
|
|
118
|
+
and spoken replies: a mic button on web/mobile, optional TTS for the
|
|
119
|
+
answer, plus a generic `/voice/turn` audio-in/audio-out endpoint, all
|
|
120
|
+
on the OpenAI-compatible audio shape with no extra credentials
|
|
121
|
+
([voice.md](voice.md)). And realtime voice: a standing, interruptible
|
|
122
|
+
call with an agent, where a second model does the talking and the
|
|
123
|
+
agent does the knowing ([realtime-voice.md](realtime-voice.md)).
|
|
124
|
+
|
|
125
|
+
## Where to next
|
|
126
|
+
|
|
127
|
+
If you've installed somora and chatted with the default agent, the
|
|
128
|
+
high-value next steps in rough order:
|
|
129
|
+
|
|
130
|
+
1. **Create a second agent** with a different persona — copy the
|
|
131
|
+
default `~/.somora/agents/<name>/AGENTS.md`, edit, restart.
|
|
132
|
+
2. **Configure a real provider** if you started on the subscription
|
|
133
|
+
defaults — see [setup.md → Configuring providers](setup.md).
|
|
134
|
+
3. **Enable the wiki** by pointing somora at your Obsidian vault in
|
|
135
|
+
`config.yaml`. The dream system then has somewhere to consolidate
|
|
136
|
+
memory into. [wiki.md](wiki.md).
|
|
137
|
+
4. **Install your phone as a PWA** for chatting from anywhere on your
|
|
138
|
+
tailnet. [mobile.md](mobile.md).
|
|
139
|
+
5. **Add an SSH resource** so an agent can read files and run commands
|
|
140
|
+
on a remote machine. [resources.md](resources.md).
|
|
141
|
+
6. **Pin a project** to a session so the agent has a persistent
|
|
142
|
+
working set. [projects.md](projects.md).
|
|
143
|
+
|
|
144
|
+
## Reference docs
|
|
145
|
+
|
|
146
|
+
| Doc | Reads like | When to open it |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| [setup.md](setup.md) | Operator runbook | First install; adding providers; HTTPS; mobile; ops |
|
|
149
|
+
| [agents.md](agents.md) | Persona + agent.yaml reference | Creating an agent; per-agent model, REM, tool/skill visibility |
|
|
150
|
+
| [builder.md](builder.md) | The builder kind | An agent that is a coding harness: plan → Go → build, task panel, questions, hand-over from an orchestrator |
|
|
151
|
+
| [lsp.md](lsp.md) | Language servers | A builder's writes come back with the compiler's errors; install, config, routes |
|
|
152
|
+
| [api.md](api.md) | HTTP/SSE contract | Building a third-party client; debugging streaming |
|
|
153
|
+
| [tools.md](tools.md) | Tool catalog overview | Wondering what an agent can do |
|
|
154
|
+
| [mcp.md](mcp.md) | External MCP servers | Plugging third-party MCP tools into your agents |
|
|
155
|
+
| [files.md](files.md) | File-tool deep dive | Working with `file_read`/`file_write`/`analyze_file` |
|
|
156
|
+
| [memory.md](memory.md) | Concept + mechanics | Tuning recall, writing notes by hand |
|
|
157
|
+
| [wiki.md](wiki.md) | Concept + mechanics | Shared knowledge base, hand-curation |
|
|
158
|
+
| [dream-phases.md](dream-phases.md) | Background workers | REM/Deep/Lucid cadence + triggers |
|
|
159
|
+
| [projects.md](projects.md) | Concept + workflow | Pinning a working set to a session |
|
|
160
|
+
| [resources.md](resources.md) | SSH-target config | Adding a remote machine |
|
|
161
|
+
| [skills.md](skills.md) | Markdown skill format | Writing or installing skills |
|
|
162
|
+
| [tmux.md](tmux.md) | Multi-turn shell sessions | Driving long-running CLIs from agents |
|
|
163
|
+
| [web.md](web.md) | Browser client | Web-UI specifics + HTTPS notes |
|
|
164
|
+
| [mobile.md](mobile.md) | Mobile PWA | iOS/Android install, scope |
|
|
165
|
+
| [voice.md](voice.md) | Dictation + spoken replies | Press-to-talk in web/mobile, optional TTS answers |
|
|
166
|
+
| [realtime-voice.md](realtime-voice.md) | Talking to an agent | A standing, interruptible call; the voice talks, the agent knows |
|
|
167
|
+
| [imagegen.md](imagegen.md) | Text-to-image | Generating images from the web app or an agent |
|
|
168
|
+
| [videogen.md](videogen.md) | Text-to-video | Job-based renders, and how an agent gets its result without waiting |
|
|
169
|
+
| [browser.md](browser.md) | Shared browser | A Chromium per agent profile that agents drive and you can take over for logins |
|
|
170
|
+
| [team.md](team.md) | Org chart → prompt block | Telling every agent who is who and who to involve |
|
|
171
|
+
| [sentinel.md](sentinel.md) | Trigger runtime | Scheduling proactive agent work |
|
|
172
|
+
| [models.md](models.md) | Model reference | Models known to run with somora, per engine, with the config values that work and why |
|
|
173
|
+
| [compaction.md](compaction.md) | Context management | When and how a session is summarised, which model does it, what `contextWindow` controls per engine |
|
|
174
|
+
| [thinking.md](thinking.md) | Reasoning depth | Per-engine thinking levels, session overrides |
|
|
175
|
+
| [sampling.md](sampling.md) | Sampling parameters | temperature, top_p and friends per model, agent and session |
|
|
176
|
+
| [display.md](display.md) | TUI toggles | What the terminal client shows, and `/queue` |
|
|
177
|
+
| [cache-strategy.md](cache-strategy.md) | Prompt-cache mechanics | Why the system prompt is ordered the way it is |
|
|
178
|
+
| [security.md](security.md) | Trust model | Network posture, sandbox stance |
|
package/docs/lsp.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Language servers — errors after every write
|
|
2
|
+
|
|
3
|
+
A builder agent ([builder.md](builder.md)) gets the compiler's verdict
|
|
4
|
+
on a file the moment it writes it. After `file_write` or `file_patch`
|
|
5
|
+
the tool result carries the errors a language server found — the same
|
|
6
|
+
programs VS Code runs behind its red squiggles — so the model fixes the
|
|
7
|
+
mistake in the same step instead of finding it when the tests run.
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"path": "/home/me/code/app/src/history.ts",
|
|
12
|
+
"replacements": 1,
|
|
13
|
+
"errors": [
|
|
14
|
+
"ERROR [42:11] Property 'finishedAt' does not exist on type 'SwitchEntry'."
|
|
15
|
+
],
|
|
16
|
+
"errors_in_other_files": {
|
|
17
|
+
"src/api.ts": ["ERROR [17:5] Expected 2 arguments, but got 1."]
|
|
18
|
+
},
|
|
19
|
+
"language_server": "typescript",
|
|
20
|
+
"hint": "Fix these before moving on — they are the compiler's word, not a guess."
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Errors only (severity *error*), at most 10 per file with a trailer for
|
|
25
|
+
the rest, and up to 5 other files whose verdict changed because of this
|
|
26
|
+
write — a renamed function breaks its callers, and the builder hears it
|
|
27
|
+
at once. Warnings are left out on purpose: a small model chases them
|
|
28
|
+
instead of the task. A clean file says `"hint": "No errors in this
|
|
29
|
+
file."` so the builder can trust it.
|
|
30
|
+
|
|
31
|
+
Chat agents never see any of this: the hook asks the server only for a
|
|
32
|
+
builder session, and a builder without a language server for the file's
|
|
33
|
+
language gets a plain result, as before.
|
|
34
|
+
|
|
35
|
+
## Which servers
|
|
36
|
+
|
|
37
|
+
| id | files | server | install |
|
|
38
|
+
|---|---|---|---|
|
|
39
|
+
| `typescript` | `.ts .tsx .js .jsx .mjs .cjs .mts .cts` | `typescript-language-server` (with `typescript@5`) | `somora lsp install typescript` |
|
|
40
|
+
| `pyright` | `.py .pyi` | `pyright-langserver` | `somora lsp install pyright` |
|
|
41
|
+
|
|
42
|
+
`somora lsp install` (no id) installs both; `somora lsp status` shows
|
|
43
|
+
what is found and where. The servers are installed with npm into
|
|
44
|
+
`~/.somora/lsp/` — nothing touches the system's global packages — and
|
|
45
|
+
found in this order: the `command` in config, `~/.somora/lsp`, then
|
|
46
|
+
`PATH`. Nothing is downloaded during a turn: a missing server means no
|
|
47
|
+
errors on the result, and the builder's environment block says so
|
|
48
|
+
(`pyright — not installed (somora lsp install pyright)`).
|
|
49
|
+
|
|
50
|
+
## How it runs
|
|
51
|
+
|
|
52
|
+
- One server process per project root and language, started when a
|
|
53
|
+
builder first reads or writes a matching file (a read pre-warms it,
|
|
54
|
+
so the first write does not wait for the cold start), stopped after
|
|
55
|
+
ten idle minutes or when somora shuts down.
|
|
56
|
+
- The root is the nearest folder at or above the file with a marker
|
|
57
|
+
(`tsconfig.json`, `package.json`, `pyproject.toml`, `setup.py`, …,
|
|
58
|
+
`.git`), never above the pinned project folder. Pyright is pointed at
|
|
59
|
+
the project's `.venv/bin/python` when there is one.
|
|
60
|
+
- After a write the server gets the new text and somora waits for its
|
|
61
|
+
verdict on that file: `lsp.waitMs` (default 3 s), longer for a
|
|
62
|
+
project's first verdict (the server loads the project). No verdict in
|
|
63
|
+
time → no errors on the result, one log line, the turn goes on.
|
|
64
|
+
- A server that fails to start is left alone for ten minutes, then
|
|
65
|
+
tried again.
|
|
66
|
+
- The servers live in the main somora process; the file tools ask over
|
|
67
|
+
loopback HTTP (`POST /lsp/diagnostics`), so the MCP child that serves
|
|
68
|
+
claude-cli and codex-cli gets the same verdicts.
|
|
69
|
+
|
|
70
|
+
## Config
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
lsp:
|
|
74
|
+
enabled: true # off = no server is started, results as before
|
|
75
|
+
waitMs: 3000 # wait for a verdict after a write (ms)
|
|
76
|
+
servers:
|
|
77
|
+
typescript:
|
|
78
|
+
enabled: true
|
|
79
|
+
# command: /usr/local/bin/typescript-language-server # instead of ~/.somora/lsp or PATH
|
|
80
|
+
pyright:
|
|
81
|
+
enabled: true
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Routes
|
|
85
|
+
|
|
86
|
+
- `POST /lsp/diagnostics` `{agent, session, path, touch?}` →
|
|
87
|
+
`{diagnostics: {server, errors, errors_in_other_files} | null}`; with
|
|
88
|
+
`touch: true` only starts the server for that file (`{touched: true}`).
|
|
89
|
+
`null` for a chat agent, a disabled feature, a file without a server,
|
|
90
|
+
or no verdict in time.
|
|
91
|
+
- `GET /lsp/status` → `{enabled, waitMs, servers: [{id, title,
|
|
92
|
+
extensions, enabled, command, source}], running: [{id, root, alive,
|
|
93
|
+
docs, idleMs}]}`.
|