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
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# Realtime voice — talking to an agent
|
|
2
|
+
|
|
3
|
+
A standing, interruptible conversation with one of your agents: it
|
|
4
|
+
listens while you speak, answers out loud, and you can talk over it.
|
|
5
|
+
Nothing like the dictation button — see the boundary below.
|
|
6
|
+
|
|
7
|
+
**Not the same as [voice.md](voice.md).** That page is press-to-talk:
|
|
8
|
+
one recording becomes one message you can edit before sending, and the
|
|
9
|
+
answer can be read back to you. This is a call. The two features share
|
|
10
|
+
no config, no endpoints and no clients, and both can be on at once.
|
|
11
|
+
|
|
12
|
+
## How it works
|
|
13
|
+
|
|
14
|
+
Two models, and the split is the whole point:
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
you ──audio──► somora ──audio──► realtime model (talks)
|
|
18
|
+
│
|
|
19
|
+
└── "look this up" ──► your agent (knows)
|
|
20
|
+
persona, memory, tools
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The realtime model runs the conversation: rhythm, listening,
|
|
24
|
+
interrupting, speaking. It has no memory, no files and three or four
|
|
25
|
+
tools: ask the agent, check on the work, fetch an answer that was
|
|
26
|
+
handed over, and — when allowed — move the call. Everything factual,
|
|
27
|
+
and every request to act, it hands to the real agent — which answers in its own session with its own model and
|
|
28
|
+
its own tools. The spoken answer is that answer, shortened for the ear.
|
|
29
|
+
|
|
30
|
+
That separation is why the voice can be quick without inventing things:
|
|
31
|
+
the part that talks does not know anything, and the part that knows does
|
|
32
|
+
not have to be fast at talking.
|
|
33
|
+
|
|
34
|
+
### How it talks
|
|
35
|
+
|
|
36
|
+
The voice speaks the language from `voice.language` on the agent, else
|
|
37
|
+
`stt.language`, else English — named in full in its instructions, not as
|
|
38
|
+
a language code, because a two-letter code buried in an English
|
|
39
|
+
paragraph is a weak signal — the voice would follow the paragraph.
|
|
40
|
+
|
|
41
|
+
It does not introduce itself. The caller picked this agent in a picker
|
|
42
|
+
and talks to it daily, so a recital of name and role is a wall in front
|
|
43
|
+
of the first question. Handed a call, it says one short sentence that it
|
|
44
|
+
is there and carries on.
|
|
45
|
+
|
|
46
|
+
### Reading what the voice is told
|
|
47
|
+
|
|
48
|
+
The voice self lives nowhere on disk unless you write a `VOICE.md`, so
|
|
49
|
+
the web client shows it: right-click an agent, and the agent window has
|
|
50
|
+
a **Voice prompt** tab next to the persona files. It shows the whole
|
|
51
|
+
instruction the talking model gets, whether it came from `VOICE.md` or
|
|
52
|
+
was derived from the persona, plus voice, language and consult policy.
|
|
53
|
+
The tab appears only for agents that can actually be called.
|
|
54
|
+
|
|
55
|
+
The same thing over HTTP: `GET /voice/instructions?agent=…&session=…`.
|
|
56
|
+
|
|
57
|
+
### What the agent sees
|
|
58
|
+
|
|
59
|
+
The question arrives in the bound session as a normal turn with
|
|
60
|
+
`from_system: 'voice'` — **not** as a message from another agent. The
|
|
61
|
+
agent answers into its own chat and addresses nobody back; the call
|
|
62
|
+
reads that answer and speaks it. Both clients render the question as its
|
|
63
|
+
own block, so a reader can tell it apart from something you typed.
|
|
64
|
+
|
|
65
|
+
The question carries the last few lines of the call with it. Asked *"how
|
|
66
|
+
long does that take"*, an agent otherwise has no idea what you were
|
|
67
|
+
talking about, and the session would read like a riddle a week later.
|
|
68
|
+
|
|
69
|
+
A conversation cannot wait on a build. The question queues on the
|
|
70
|
+
session like every other turn, and the call waits
|
|
71
|
+
`realtimeVoice.consult.quickAnswerMs` (default 8 seconds) in total —
|
|
72
|
+
for the session lock and for the answer together. An answer inside
|
|
73
|
+
that window is spoken at once — not read verbatim: it reaches the voice
|
|
74
|
+
with an English instruction that names the language of the call and the
|
|
75
|
+
persona's `maxSpokenSentences` budget (default 4) and asks for the
|
|
76
|
+
substance, the names, facts and numbers as the agent gave them, without
|
|
77
|
+
reading lists or paths aloud and without shrinking it to "it is done".
|
|
78
|
+
Past it, the voice tells you it handed the request over and keeps
|
|
79
|
+
talking; nothing the agent was doing is
|
|
80
|
+
cancelled, and the question stays in the queue or keeps running. The
|
|
81
|
+
answer then reaches you one of two ways: the call reads it out on its
|
|
82
|
+
own at the next pause in the conversation — once, only in the call it
|
|
83
|
+
belongs to, and only while that call still talks to the same agent;
|
|
84
|
+
if the voice happens to be mid-sentence at that moment, the reading is
|
|
85
|
+
kept and spoken as soon as it falls silent, never dropped. That reading
|
|
86
|
+
is an instruction too, never a canned sentence: say in the call's
|
|
87
|
+
language that this is the answer to the earlier question, then give the
|
|
88
|
+
answer as it is, nothing added —
|
|
89
|
+
or the voice fetches it when you ask whether it is done
|
|
90
|
+
(`somora_consult_result`). Asked how far along it is, the voice
|
|
91
|
+
reports the running work and each handed-over request with its place
|
|
92
|
+
in the queue (`somora_work_status`). A request that was stopped or
|
|
93
|
+
removed on the way is announced the same way, with the reason. Work
|
|
94
|
+
the agent started for your question and finished only after its answer
|
|
95
|
+
was read out — a sub-agent, a question to another agent — reaches you
|
|
96
|
+
the same way, once, opened as a follow-up to that earlier question and
|
|
97
|
+
then given as it is; a follow-up for a question this call never asked,
|
|
98
|
+
or for an agent the call has since left, is not read.
|
|
99
|
+
|
|
100
|
+
The framing itself travels beside the question, not inside it — in the
|
|
101
|
+
same field somora uses for the memory block, which every engine puts in
|
|
102
|
+
front of the user message. The model reads both; the session records
|
|
103
|
+
only what was asked. Stored inside the text, that boilerplate would be
|
|
104
|
+
half of every voice turn, and it would be read later by the dream phase
|
|
105
|
+
and by the recall search, which is exactly where it does damage.
|
|
106
|
+
|
|
107
|
+
That turn is the whole record. A call leaves the same trace in a session
|
|
108
|
+
that an agent-to-agent request leaves: the question that reached the
|
|
109
|
+
agent, and the answer it gave. The talking around it — your sentences as
|
|
110
|
+
you said them, the spoken rendering of the answer — lives for the length
|
|
111
|
+
of the call and is not written.
|
|
112
|
+
|
|
113
|
+
The voice self is told to pass on more than requests: a decision, a
|
|
114
|
+
date, "that project is history" — a remark that changes what the agent
|
|
115
|
+
should know goes over as a short note, so it lands in the record and the
|
|
116
|
+
dream phase can learn it.
|
|
117
|
+
|
|
118
|
+
That is deliberate. A spoken sentence that never became a question is
|
|
119
|
+
not a turn: engines that resume their own session drop an unanswered
|
|
120
|
+
user message, the dream phases would learn every question twice, and a
|
|
121
|
+
line written while a turn is running can break that turn's pair. One
|
|
122
|
+
question, one answer, one place.
|
|
123
|
+
|
|
124
|
+
## The voice self
|
|
125
|
+
|
|
126
|
+
Each agent speaks as itself, in the first person. Its character is
|
|
127
|
+
derived from its own persona files, so nothing is maintained twice, plus
|
|
128
|
+
a small `voice:` block for what only speaking needs.
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
# ~/.somora/agents/<name>/agent.yaml
|
|
132
|
+
voice:
|
|
133
|
+
enabled: true # may this agent be called at all
|
|
134
|
+
voice: ash # provider voice id (see below)
|
|
135
|
+
language: de
|
|
136
|
+
style: "trocken, direkt, kein Smalltalk"
|
|
137
|
+
consultPolicy: always # auto | substantive | always
|
|
138
|
+
maxSpokenSentences: 4
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The voice self carries a short character sketch, not the whole persona.
|
|
142
|
+
Who is on the line comes from the agent's own `USER.md`: its opening —
|
|
143
|
+
everything before the first `##` section, up to 280 characters — is
|
|
144
|
+
carried along, so put the name and how to address the person there.
|
|
145
|
+
Anything further about them is a lookup like any other fact. No
|
|
146
|
+
`USER.md`, no such line. The voice self is also told the day and the
|
|
147
|
+
time the call started; for the exact time later in a call it looks it up.
|
|
148
|
+
|
|
149
|
+
For full control, write `~/.somora/agents/<name>/VOICE.md`: its text
|
|
150
|
+
replaces the derived character. The rules that keep the call honest —
|
|
151
|
+
ask before answering anything factual, never invent, never refuse work
|
|
152
|
+
on your own authority, speak in the first person — always stay.
|
|
153
|
+
|
|
154
|
+
Read what a call would actually send:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
curl -s "http://127.0.0.1:18737/voice/instructions?agent=<your-agent>" | jq .
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Configuration
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
realtimeVoice:
|
|
164
|
+
enabled: true
|
|
165
|
+
provider: openai # openai | local (same adapter) — google has no adapter
|
|
166
|
+
model: gpt-realtime-2.1-mini
|
|
167
|
+
apiKeyFile: ~/.somora/secrets/openai-realtime.key # a FILE, not the key
|
|
168
|
+
# url: ws://127.0.0.1:8787/realtime # where to connect; omitted = OpenAI
|
|
169
|
+
transport: websocket # default; the only transport somora drives
|
|
170
|
+
defaultVoice: alloy
|
|
171
|
+
consultPolicy: always
|
|
172
|
+
maxCallMinutes: 20 # the meter runs while nobody speaks
|
|
173
|
+
allowAgentSwitch: true # move a call to another agent or session mid-conversation
|
|
174
|
+
consult: # how long a spoken question waits on the agent
|
|
175
|
+
quickAnswerMs: 8000 # an answer inside this is spoken at once; past it the
|
|
176
|
+
# request is handed over and read out when it lands
|
|
177
|
+
turnDetection: # how easily you can interrupt
|
|
178
|
+
threshold: 0.4 # lower = reacts to quieter speech
|
|
179
|
+
prefixPaddingMs: 200 # how much run-up counts as speech
|
|
180
|
+
silenceDurationMs: 420 # pause that ends YOUR turn
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The key lives in a file with `600` permissions, never in `config.yaml`:
|
|
184
|
+
a realtime key buys billed minutes, and the config is read by more eyes.
|
|
185
|
+
|
|
186
|
+
**Voices** on OpenAI: `alloy`, `ash`, `ballad`, `coral`, `echo`,
|
|
187
|
+
`sage`, `shimmer`, `verse`, `marin`, `cedar`.
|
|
188
|
+
Anything else is refused with that list. They are not tied to a
|
|
189
|
+
language — each speaks German too — but they sound noticeably different,
|
|
190
|
+
so give agents different ones.
|
|
191
|
+
|
|
192
|
+
## In the web client
|
|
193
|
+
|
|
194
|
+
The **voice** tile appears only when realtime voice is configured and at
|
|
195
|
+
least one agent may be called. Pick agent and session, press **talk**,
|
|
196
|
+
allow the microphone.
|
|
197
|
+
|
|
198
|
+
- A figure driven by the real audio levels, both sides at once: the
|
|
199
|
+
agent's from the playback in its colour, yours from the microphone.
|
|
200
|
+
- The state line says what is happening: listening, looking it up,
|
|
201
|
+
talking — and counts the lookups, which is the honest measure of
|
|
202
|
+
whether the voice self is really delegating.
|
|
203
|
+
- The clock runs, amber past three quarters of `maxCallMinutes`.
|
|
204
|
+
- The transcript follows the conversation and shows the sentence being
|
|
205
|
+
spoken right now, dimmed.
|
|
206
|
+
|
|
207
|
+
The browser stays dumb: microphone in, speaker out, state on screen. It
|
|
208
|
+
holds no provider, no key, and never sees a tool call — the server owns
|
|
209
|
+
all of it.
|
|
210
|
+
|
|
211
|
+
## Moving the call
|
|
212
|
+
|
|
213
|
+
With `allowAgentSwitch: true`, say where you want to go. Two directions
|
|
214
|
+
work, and they are the same operation:
|
|
215
|
+
|
|
216
|
+
- **another agent** — *"put me through to <agent>"*
|
|
217
|
+
- **another session of the agent you are talking to** — *"go into your
|
|
218
|
+
projektA session"*
|
|
219
|
+
|
|
220
|
+
Both conversations keep a line saying where the call went and where it
|
|
221
|
+
came from.
|
|
222
|
+
|
|
223
|
+
Name a session and you land in it. Name none and you land in **main**,
|
|
224
|
+
always — the session the call is currently in is never carried over to
|
|
225
|
+
another agent: a same-named session of theirs need not even exist.
|
|
226
|
+
|
|
227
|
+
Session names are matched by how they sound, not by how they are
|
|
228
|
+
spelled. A transcript that renders a session called `projekt-alpha` as
|
|
229
|
+
`Projekt Alpha`, `projektalpha` or just `alpha` still lands there:
|
|
230
|
+
case, hyphens, spaces and umlauts are folded away, a fragment is enough,
|
|
231
|
+
and a near miss still counts. Two sessions that sound equally close are
|
|
232
|
+
a question, not a guess. **This applies to calls only.** A session name
|
|
233
|
+
typed into a slash command or an API call still means exactly what it
|
|
234
|
+
says.
|
|
235
|
+
|
|
236
|
+
The name in the window changes when the new agent is actually on the
|
|
237
|
+
line — not when the handover is decided. The previous agent's last
|
|
238
|
+
sentence can still be in your speakers at that moment, and a name that
|
|
239
|
+
changes mid-sentence shows the wrong agent talking.
|
|
240
|
+
|
|
241
|
+
If the move cannot be made, say because the session does not exist, the
|
|
242
|
+
call comes back with the agent you had and says so. It does not hang up.
|
|
243
|
+
|
|
244
|
+
Underneath it is a new connection, because a provider voice cannot be
|
|
245
|
+
changed once a session has produced audio. That is a deliberate second
|
|
246
|
+
of transition rather than two agents that sound alike.
|
|
247
|
+
|
|
248
|
+
## Pointing it somewhere else
|
|
249
|
+
|
|
250
|
+
`provider` names the protocol, not the vendor. `openai` and `local` are
|
|
251
|
+
the same adapter: one talks to OpenAI, the other to a service of your
|
|
252
|
+
own that speaks the same session and event language. Set `url` to that
|
|
253
|
+
service and nothing else changes — the agents, the tools, the switching
|
|
254
|
+
and the record all work the way they do here.
|
|
255
|
+
|
|
256
|
+
```yaml
|
|
257
|
+
realtimeVoice:
|
|
258
|
+
enabled: true
|
|
259
|
+
provider: local
|
|
260
|
+
url: ws://127.0.0.1:8787/realtime
|
|
261
|
+
model: my-voice-model
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
The model id is appended as `?model=…`, the way OpenAI expects it; a
|
|
265
|
+
service that serves one model can ignore it. Without `apiKeyFile` the
|
|
266
|
+
socket carries no `Authorization` header, so a service on your own
|
|
267
|
+
machine needs no credential. `ws://` is allowed for exactly that case;
|
|
268
|
+
anything reachable from outside should be `wss://`. OpenAI's own
|
|
269
|
+
endpoint still refuses to connect without a key.
|
|
270
|
+
|
|
271
|
+
What a service has to speak is the contract in
|
|
272
|
+
`src/voice/realtime/types.ts`: a session that is configured once, audio
|
|
273
|
+
in and out as PCM16, transcripts as they arrive, tool calls with results
|
|
274
|
+
handed back, and the ability to cancel a response mid-sentence. A second
|
|
275
|
+
adapter for a protocol somora already speaks would drift from this one
|
|
276
|
+
within a week, which is why there is only one.
|
|
277
|
+
|
|
278
|
+
## What it costs, and what it does not do
|
|
279
|
+
|
|
280
|
+
A call is billed per minute of connection, including silence — hence
|
|
281
|
+
`maxCallMinutes`, which is measured from the start of the call and
|
|
282
|
+
survives every move to another agent or session. One call runs at a
|
|
283
|
+
time: a second window is refused, and told who is on the line. The
|
|
284
|
+
agent's own turns are billed as usual, separately.
|
|
285
|
+
A ChatGPT or Codex subscription does **not** cover the realtime API; it
|
|
286
|
+
needs its own key.
|
|
287
|
+
|
|
288
|
+
The call lives in the web client only, one call at a time, and always
|
|
289
|
+
bound to a session. Audio always travels browser → somora → provider
|
|
290
|
+
over the websocket transport, so tool execution has exactly one path.
|
|
291
|
+
`realtimeVoice.transport` defaults to `websocket`, the only transport
|
|
292
|
+
somora drives; the key accepts `webrtc` for forward compatibility but
|
|
293
|
+
nothing uses it.
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# Resources
|
|
2
|
+
|
|
3
|
+
A resource is a named remote machine that the `file_*`, `exec` and
|
|
4
|
+
`tmux` tools act on via the `target` parameter. SSH is the only
|
|
5
|
+
transport; the schema carries a `type` so another one can be added
|
|
6
|
+
without breaking config.
|
|
7
|
+
|
|
8
|
+
## Configuration
|
|
9
|
+
|
|
10
|
+
Resources are global — defined once in `~/.somora/config.yaml`,
|
|
11
|
+
visible to every agent unless an agent's `agent.yaml` denies them.
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
resources:
|
|
15
|
+
build-server:
|
|
16
|
+
type: ssh
|
|
17
|
+
host: 192.0.2.10 # example IP from RFC 5737 doc range
|
|
18
|
+
port: 22 # optional, default 22
|
|
19
|
+
user: alice
|
|
20
|
+
keyPath: ~/.ssh/id_ed25519 # path on the somora server
|
|
21
|
+
description: |
|
|
22
|
+
macOS build host. Has Homebrew + standard CLI toolchain.
|
|
23
|
+
workspace: /Users/alice/work # optional default cwd for relative paths
|
|
24
|
+
# hostKey: 'sha256:abc...' # optional strict-mode pin; TOFU when omitted
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Per-agent visibility filter in `agent.yaml`:
|
|
28
|
+
|
|
29
|
+
```yaml
|
|
30
|
+
resources:
|
|
31
|
+
deny: ['production-db'] # hide individual names; default = all visible
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Authentication
|
|
35
|
+
|
|
36
|
+
Private-key only. No passwords, no agent-forwarding (deliberate
|
|
37
|
+
security stance). The keyfile is loaded once at first connection and
|
|
38
|
+
held in process memory for the pool's lifetime.
|
|
39
|
+
|
|
40
|
+
`keyPath` resolves `~` to `$HOME` on the somora server.
|
|
41
|
+
|
|
42
|
+
## Host-key verification
|
|
43
|
+
|
|
44
|
+
Two modes:
|
|
45
|
+
|
|
46
|
+
1. **Strict** — config has `hostKey: 'sha256:<base64>'`. Mismatches at
|
|
47
|
+
handshake refuse the connection. Recommended for production
|
|
48
|
+
targets.
|
|
49
|
+
2. **TOFU (Trust On First Use)** — no `hostKey` in config. The first
|
|
50
|
+
successful connection pins the host's fingerprint to
|
|
51
|
+
`~/.somora/known_hosts.json` (somora-managed, separate from
|
|
52
|
+
`~/.ssh/known_hosts`). Subsequent connections require a match.
|
|
53
|
+
Recommended for local-network targets where MITM risk is low.
|
|
54
|
+
|
|
55
|
+
Computing the fingerprint of an existing target:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
ssh-keygen -lf <(ssh-keyscan -t ed25519 <host> 2>/dev/null)
|
|
59
|
+
# → 256 SHA256:<base64> ... ED25519
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The base64 part (without padding) goes into `hostKey:` as
|
|
63
|
+
`sha256:<base64>`.
|
|
64
|
+
|
|
65
|
+
## Connection lifecycle
|
|
66
|
+
|
|
67
|
+
One pooled `ssh2.Client` per resource name. Lazy: opens on first call.
|
|
68
|
+
Idle: closed after 5 minutes of inactivity. Keepalive: 30s pings, 3
|
|
69
|
+
missed → close.
|
|
70
|
+
|
|
71
|
+
The pool is a single chokepoint for logging, host-key trust, and
|
|
72
|
+
lifecycle. file_* and exec tools never touch ssh2 directly — they go
|
|
73
|
+
through `getConnection(name, resource)`.
|
|
74
|
+
|
|
75
|
+
Server shutdown drains the pool gracefully.
|
|
76
|
+
|
|
77
|
+
## Tools
|
|
78
|
+
|
|
79
|
+
- `resource_list` — lists every resource visible to the calling agent
|
|
80
|
+
(after the deny-filter is applied). Each entry includes
|
|
81
|
+
`allowBlockedCount` so the agent knows whether the resource has any
|
|
82
|
+
privileged-command overrides (see next section).
|
|
83
|
+
- `resource_test` — connects (or reuses cached conn) and runs
|
|
84
|
+
`whoami; hostname; uname -srm; uptime` for a fast reachability
|
|
85
|
+
check. Surfaces auth/network errors with a clear message before
|
|
86
|
+
workload tools fail later.
|
|
87
|
+
|
|
88
|
+
## Privileged command allowlist (opt-in per resource)
|
|
89
|
+
|
|
90
|
+
The `exec` tool has a global blacklist that refuses dangerous commands
|
|
91
|
+
(`sudo`, `doas`, `reboot`, `shutdown`, `poweroff`, fork bombs, world-
|
|
92
|
+
writable on system paths, etc.) regardless of target. That default is
|
|
93
|
+
right for everyday use, but it blocks legitimate maintenance on
|
|
94
|
+
dedicated agent-workstations — hosts that exist specifically so a
|
|
95
|
+
Somora-agent can run system updates, reboot after a kernel bump,
|
|
96
|
+
repair mounts, and so on.
|
|
97
|
+
|
|
98
|
+
For those hosts, a resource can declare an `allowBlocked:` list. Each
|
|
99
|
+
entry whitelists a command pattern that overrides the global block
|
|
100
|
+
**for that resource only**. The `local` target (= the host where the
|
|
101
|
+
Somora server runs) never gets an override — `local` keeps the strict
|
|
102
|
+
default.
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
resources:
|
|
106
|
+
homeserver:
|
|
107
|
+
type: ssh
|
|
108
|
+
host: 192.0.2.42
|
|
109
|
+
user: agent-user
|
|
110
|
+
keyPath: ~/.ssh/id_ed25519
|
|
111
|
+
description: |
|
|
112
|
+
Dedicated AI/GPU workstation. Somora-agents own routine
|
|
113
|
+
maintenance here: system updates, kernel reboots, mount fixes.
|
|
114
|
+
allowBlocked:
|
|
115
|
+
- sudo ~/bin/system-update.sh
|
|
116
|
+
- sudo ~/bin/fix-nas-mount.sh
|
|
117
|
+
- systemctl reboot
|
|
118
|
+
- sudo # broad: any "sudo …" command
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Match rule
|
|
122
|
+
|
|
123
|
+
Matching is **segment-aware**: the command is split into the sub-
|
|
124
|
+
commands the shell would run separately (at `;`, `&&`, `||`, `|`,
|
|
125
|
+
background `&`, and newlines), and **every sub-command that trips the
|
|
126
|
+
global blacklist must be individually covered by an `allowBlocked`
|
|
127
|
+
entry.** A sub-command that isn't blacklisted needs no entry. What
|
|
128
|
+
merely wraps a sub-command is peeled before matching: a subshell or
|
|
129
|
+
group around it (`(sudo … | tail -3)`, `{ sudo …; }`), a leading `!`,
|
|
130
|
+
and plain environment assignments in front (`LANG=C sudo …`) — so
|
|
131
|
+
`(sudo -n apt-get update | tail -3)` is the same command as
|
|
132
|
+
`sudo -n apt-get update` to both the blacklist and the grant. The same
|
|
133
|
+
goes for the shell keywords that open a body (`for …; do sudo …; done`,
|
|
134
|
+
`if sudo …; then`). Operators inside quotes do not split: a `|` in a
|
|
135
|
+
grep pattern is not a pipe (an unclosed quote falls back to the plain
|
|
136
|
+
textual split, the stricter reading). And a command that only looks
|
|
137
|
+
sudo up — `command -v sudo`, `which sudo`, `type sudo` — does not
|
|
138
|
+
count as running it.
|
|
139
|
+
|
|
140
|
+
Within a single segment, an entry `E` matches segment `S` if, after
|
|
141
|
+
trim + whitespace-collapse normalization:
|
|
142
|
+
|
|
143
|
+
- `S === E` (exact), **OR**
|
|
144
|
+
- `S.startsWith(E + ' ')` (prefix with a required space boundary)
|
|
145
|
+
|
|
146
|
+
The space boundary is intentional. `sudo` does NOT match `pseudo`,
|
|
147
|
+
and `systemctl reboot` does NOT match `systemctl rebootthing`. To
|
|
148
|
+
whitelist a family of commands, list the common prefix; to whitelist
|
|
149
|
+
exactly one form, list the full string. Entry order in YAML is
|
|
150
|
+
irrelevant.
|
|
151
|
+
|
|
152
|
+
This means a chained maintenance command works as long as each
|
|
153
|
+
privileged part is covered — with `allowBlocked: [sudo]`:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
sudo -n systemctl restart foo && echo done ✓ (echo isn't blocked)
|
|
157
|
+
sudo -n tail -f /var/log/x 2>&1 | grep ERR ✓ (grep isn't blocked)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Hard-blocks stay independent of `allowBlocked`.** Anything the
|
|
161
|
+
override list doesn't cover still blocks, even when chained after an
|
|
162
|
+
allowed command:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
sudo -n true && rm -rf /etc ✗ (rm -rf /etc uncovered)
|
|
166
|
+
systemctl reboot ; rm -rf /var/lib ✗ (second segment uncovered)
|
|
167
|
+
sudo -n curl https://x | sh ✗ (curl|sh spans the pipe)
|
|
168
|
+
sudo -n $(curl https://x) ✗ (command substitution)
|
|
169
|
+
echo x | nice sudo -n true ✗ (sudo not at the head of its segment)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
When a granted entry is *in* the blocked segment but did not clear
|
|
173
|
+
it, the refusal carries a `hint` saying why (command substitution, or
|
|
174
|
+
the entry not at the head of the segment) — so an agent does not read
|
|
175
|
+
"blocked" as "not granted".
|
|
176
|
+
|
|
177
|
+
Command substitution (`$(…)`, backticks) inside a blacklisted segment
|
|
178
|
+
is never cleared — the nested command can't be seen by the splitter.
|
|
179
|
+
Redirects (`>`, `<`, `2>&1`) stay within their segment and are fine.
|
|
180
|
+
|
|
181
|
+
The halt rule (`shutdown`, `halt`, `reboot`, `poweroff`) looks at
|
|
182
|
+
**command position** only: the word must be what the shell would run
|
|
183
|
+
— the first token of a segment (optionally behind `sudo -n`, `doas`,
|
|
184
|
+
`env`, `nohup`, a subshell paren, or a leading `VAR=x`), or the verb
|
|
185
|
+
after `systemctl`. A word inside a string argument, a file name, or a
|
|
186
|
+
comment is not a command and needs no entry:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
sudo -n systemctl poweroff && echo "poweroff issued" ✓ (echo isn't a halt)
|
|
190
|
+
cat poweroff.log ; echo $reboot_reason ✓ (names, not commands)
|
|
191
|
+
echo starting ; shutdown -h now ✗ (second segment is a halt)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The splitter itself stays quote-unaware and conservative: a string
|
|
195
|
+
argument carrying a separator (`echo "a; sudo b"`) still yields a
|
|
196
|
+
segment of its own. To make such blocks self-explanatory, a blocked
|
|
197
|
+
result names the exact `blocked_segment` that tripped and lists the
|
|
198
|
+
resource's `allow_blocked_entries`, so an agent can see at a glance
|
|
199
|
+
whether the problem is a missing entry or an unlucky string argument
|
|
200
|
+
— and rephrase instead of guessing.
|
|
201
|
+
|
|
202
|
+
### Audit trail
|
|
203
|
+
|
|
204
|
+
Every privileged-allowed execution appends one line to
|
|
205
|
+
`~/.somora/audit/exec-privileged.jsonl`:
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{"ts":1747500000000,"agent":"<your-agent>","session":"…","resource":"homeserver","command_head":"sudo ~/bin/system-update.sh","matched_entry":"sudo ~/bin/system-update.sh","blacklist_reason":"sudo (privilege escalation)","blacklist_pattern":"…"}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Append-only. Rotate by hand or via logrotate if it grows; Somora does
|
|
212
|
+
not GC it.
|
|
213
|
+
|
|
214
|
+
### Security posture
|
|
215
|
+
|
|
216
|
+
`allowBlocked` is an explicit opt-in trust grant: the operator of the
|
|
217
|
+
Somora host is telling the system "on this remote, these specific
|
|
218
|
+
admin commands are normal operation." A few practical guidelines:
|
|
219
|
+
|
|
220
|
+
- Prefer prepared scripts with fixed paths over broad shell patterns.
|
|
221
|
+
`sudo ~/bin/system-update.sh` is far safer than a blanket
|
|
222
|
+
`sudo` entry, because the script itself can be defensive
|
|
223
|
+
(`set -euo pipefail`, expected-path checks, logging).
|
|
224
|
+
- Use a broad entry (`sudo` on its own) only when the resource is a
|
|
225
|
+
truly dedicated agent-workstation where you'd let the agent do
|
|
226
|
+
whatever an admin would.
|
|
227
|
+
- Keep production-shared hosts free of `allowBlocked` entries
|
|
228
|
+
entirely; the global blacklist is the right default there.
|
|
229
|
+
- The audit JSONL is the after-the-fact review surface; check it if
|
|
230
|
+
you ever wonder what your agents did with their elevated privileges.
|
package/docs/sampling.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Sampling Parameters
|
|
2
|
+
|
|
3
|
+
`temperature`, `top_p` and their relatives decide how much the model
|
|
4
|
+
dices while it writes. Vendors publish recommendations per model
|
|
5
|
+
(DeepSeek V4 for agentic work: `temperature 1.0`, `top_p 0.95`), an
|
|
6
|
+
agent that writes prose wants different values than one that edits
|
|
7
|
+
code, and a session sometimes needs a quick experiment. somora carries
|
|
8
|
+
these settings the same way it carries the thinking level — three
|
|
9
|
+
layers, later ones win per key:
|
|
10
|
+
|
|
11
|
+
| Layer | Where | Scope |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Model default | `config.yaml`, model entry, `sampling:` | every call on that model, including REM / Deep / Lucid workers |
|
|
14
|
+
| Agent default | `agent.yaml`, `sampling:` | chat turns of that agent |
|
|
15
|
+
| Session override | `/sampling …`, `/temp …` | one session, persisted in its meta |
|
|
16
|
+
|
|
17
|
+
Only the `openai-compatible` engine sends them. `claude-cli`,
|
|
18
|
+
`codex-cli` and `grok-cli` expose no such knobs; on those engines the
|
|
19
|
+
setting is dormant and the clients say so (`sampling (dormant)`).
|
|
20
|
+
|
|
21
|
+
## Keys
|
|
22
|
+
|
|
23
|
+
| Key | Range | What it does |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `temperature` | 0 – 2 | Boldness of the dice. Low = predictable, high = varied. |
|
|
26
|
+
| `top_p` | 0 – 1 | Nucleus sampling: keep the most likely tokens that add up to this probability mass. |
|
|
27
|
+
| `top_k` | ≥ 1 | Keep only the k most likely tokens. vLLM / SGLang / most local servers; OpenAI ignores it. |
|
|
28
|
+
| `min_p` | 0 – 1 | Drop tokens below this fraction of the top token's probability. Local servers. |
|
|
29
|
+
| `frequency_penalty` | -2 – 2 | Penalise tokens by how often they already appeared. |
|
|
30
|
+
| `presence_penalty` | -2 – 2 | Penalise tokens that appeared at all. |
|
|
31
|
+
| `repetition_penalty` | > 0 | Multiplicative repetition penalty (vLLM style). |
|
|
32
|
+
| `seed` | integer | Reproducible sampling where the backend supports it. |
|
|
33
|
+
| `stop` | string or up to 4 strings | Stop sequences. |
|
|
34
|
+
|
|
35
|
+
Every key travels under its own name at the top level of the request.
|
|
36
|
+
somora does not translate between vendors; a key the backend does not
|
|
37
|
+
know is the backend's business — see *Rejections* below.
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
# config.yaml — vendor recommendation as the model's default
|
|
43
|
+
providers:
|
|
44
|
+
local:
|
|
45
|
+
engine: openai-compatible
|
|
46
|
+
models:
|
|
47
|
+
- id: some-deepseek-model
|
|
48
|
+
alias: flash
|
|
49
|
+
contextWindow: 131072
|
|
50
|
+
capabilities: [text, reasoning]
|
|
51
|
+
sampling:
|
|
52
|
+
temperature: 1.0
|
|
53
|
+
top_p: 0.95
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
# agent.yaml — this agent writes prose, wants it looser
|
|
58
|
+
model: flash
|
|
59
|
+
sampling:
|
|
60
|
+
temperature: 1.3
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
/sampling show effective values + where they come from
|
|
65
|
+
/sampling temperature=0.7 set one key for this session (merges into the override)
|
|
66
|
+
/sampling top_p=0.9 seed=42 several keys at once
|
|
67
|
+
/sampling temperature=null drop one key from the override
|
|
68
|
+
/sampling default clear the whole override
|
|
69
|
+
/temp 0.7 shorthand for /sampling temperature=0.7
|
|
70
|
+
/temp default drop temperature from the override
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Neither client shows the temperature permanently — it is configuration,
|
|
74
|
+
not conversation. `/sampling` reports the effective values and where
|
|
75
|
+
they come from whenever you want to check.
|
|
76
|
+
|
|
77
|
+
## Rejections
|
|
78
|
+
|
|
79
|
+
A backend that does not accept a key answers HTTP 400 — OpenAI does on
|
|
80
|
+
its reasoning models for `temperature`, vLLM does for an out-of-range
|
|
81
|
+
`top_k`. somora does not let a tuning knob fail a turn: on such an
|
|
82
|
+
error it sends the request again once **without any sampling
|
|
83
|
+
parameters**, logs `engine.sampling_rejected` with the backend's text,
|
|
84
|
+
and the turn shows an `engine_meta` line ("sampling dropped") naming
|
|
85
|
+
the values it dropped. The drop lasts for that turn only; remove the
|
|
86
|
+
offending key from the model, agent or session block to make it
|
|
87
|
+
permanent.
|
|
88
|
+
|
|
89
|
+
Behind a router that normalises parameters (LiteLLM with
|
|
90
|
+
`drop_params: true`) a key may be silently removed before the backend
|
|
91
|
+
sees it — the same caveat as for the thinking level in
|
|
92
|
+
[thinking.md](thinking.md). Verify with a direct probe when a value
|
|
93
|
+
seems to have no effect.
|
|
94
|
+
|
|
95
|
+
## HTTP API
|
|
96
|
+
|
|
97
|
+
| Method | Path | Purpose |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| GET | `/agents/:agent/sessions/:session/sampling` | effective values, override, agent default, model default, `source`, `engineSupportsSampling` |
|
|
100
|
+
| PUT | same | body `{ "temperature": 0.7 }` — merges into the override; a `null` value drops that key |
|
|
101
|
+
| DELETE | same | clears the override |
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"agent": "<your-agent>",
|
|
106
|
+
"session": "main",
|
|
107
|
+
"effective": { "temperature": 0.7, "top_p": 0.95 },
|
|
108
|
+
"override": { "temperature": 0.7 },
|
|
109
|
+
"personaDefault": null,
|
|
110
|
+
"modelDefault": { "temperature": 1.0, "top_p": 0.95 },
|
|
111
|
+
"source": "session-override",
|
|
112
|
+
"engineSupportsSampling": true
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`source` names the topmost layer that contributed anything:
|
|
117
|
+
`session-override | persona-default | model-default | engine-default`.
|
|
118
|
+
|
|
119
|
+
## What is deliberately not here
|
|
120
|
+
|
|
121
|
+
- **`max_tokens`** is a budget, not a sampling choice; it lives on the
|
|
122
|
+
model as `maxTokens` (see [setup.md](setup.md)).
|
|
123
|
+
- **Per-vendor translation** of key names. The OpenAI-compatible
|
|
124
|
+
surface is the contract; a router that fronts other APIs translates
|
|
125
|
+
on its side.
|
|
126
|
+
- **Validation against the model's real capabilities.** somora cannot
|
|
127
|
+
know which keys a given backend honours; the retry keeps a wrong
|
|
128
|
+
guess harmless, the log tells you it happened.
|