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,913 @@
|
|
|
1
|
+
// Slash-command dispatcher. Returns a list of "actions" the App applies:
|
|
2
|
+
// - notice: append a system Turn (info/warn/error)
|
|
3
|
+
// - switchTo: change agent/session, restart stream
|
|
4
|
+
// - exit: leave the program
|
|
5
|
+
// - clearStats: drop session-scoped stats (e.g. after /reset)
|
|
6
|
+
// - setShow: flip a TUI display toggle (memory / tools)
|
|
7
|
+
// The dispatcher is intentionally pure-ish: it makes HTTP calls but doesn't
|
|
8
|
+
// touch React state. The App turns the actions into setState calls.
|
|
9
|
+
|
|
10
|
+
import type { Api } from './api.ts';
|
|
11
|
+
import {
|
|
12
|
+
SAMPLING_USAGE,
|
|
13
|
+
TEMP_USAGE,
|
|
14
|
+
formatSamplingParams,
|
|
15
|
+
parseSamplingArgs,
|
|
16
|
+
parseSamplingValue,
|
|
17
|
+
} from './sampling.ts';
|
|
18
|
+
import type { SamplingPatch, SessionSamplingInfo } from './types.ts';
|
|
19
|
+
import { formatWorkList, queueEntryAt, workLabel } from './work-queue.ts';
|
|
20
|
+
|
|
21
|
+
export type ShowTarget = 'memory' | 'tools';
|
|
22
|
+
export type VerboseTarget = 'tools' | 'memory' | 'system' | 'thinking';
|
|
23
|
+
|
|
24
|
+
export type CommandAction =
|
|
25
|
+
| { kind: 'notice'; text: string; tone: 'info' | 'warn' | 'error' }
|
|
26
|
+
| { kind: 'switchTo'; agent: string; session: string }
|
|
27
|
+
| { kind: 'exit' }
|
|
28
|
+
| { kind: 'clearStats' }
|
|
29
|
+
| { kind: 'setShow'; target: ShowTarget; value: boolean }
|
|
30
|
+
| { kind: 'setVerbose'; target: VerboseTarget; value: boolean }
|
|
31
|
+
// Project focus changed locally — App can refresh its project state
|
|
32
|
+
// immediately without waiting for the SSE round-trip (which also
|
|
33
|
+
// arrives, but feels snappier this way).
|
|
34
|
+
| { kind: 'projectFocusRefresh' }
|
|
35
|
+
// A human entry was taken back out of the queue — put its text into
|
|
36
|
+
// the input so the user can rewrite and resend it.
|
|
37
|
+
| { kind: 'restoreInput'; text: string; turnId: string }
|
|
38
|
+
// The work queue changed locally (/queue rm) — refetch the counters.
|
|
39
|
+
| { kind: 'workRefresh' };
|
|
40
|
+
|
|
41
|
+
export interface CommandMeta {
|
|
42
|
+
name: string; // the bare slash command (used for prefix-match)
|
|
43
|
+
usage: string; // user-facing display in the autocomplete popup
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Surfaced via the slash-autocomplete popup. Order = display order.
|
|
47
|
+
export const COMMANDS: readonly CommandMeta[] = [
|
|
48
|
+
{ name: '/help', usage: '/help' },
|
|
49
|
+
{ name: '/agents', usage: '/agents' },
|
|
50
|
+
{ name: '/agent', usage: '/agent <name> [session]' },
|
|
51
|
+
{ name: '/sessions', usage: '/sessions' },
|
|
52
|
+
{ name: '/session', usage: '/session <slug-or-id>' },
|
|
53
|
+
{ name: '/new', usage: '/new <slug>' },
|
|
54
|
+
{ name: '/main', usage: '/main' },
|
|
55
|
+
{ name: '/reset', usage: '/reset [YES]' },
|
|
56
|
+
{ name: '/models', usage: '/models' },
|
|
57
|
+
{ name: '/model', usage: '/model [<alias>|default]' },
|
|
58
|
+
{ name: '/show', usage: '/show [memory|tools] [on|off]' },
|
|
59
|
+
{ name: '/verbose', usage: '/verbose [tools|memory|system|thinking] [on|off]' },
|
|
60
|
+
{ name: '/thinking', usage: '/thinking [off|low|medium|high|default]' },
|
|
61
|
+
{ name: '/reload', usage: '/reload' },
|
|
62
|
+
{ name: '/restart', usage: '/restart [YES]' },
|
|
63
|
+
{ name: '/sampling', usage: '/sampling [key=value …|default]' },
|
|
64
|
+
{ name: '/temp', usage: '/temp <0–2>|default' },
|
|
65
|
+
{ name: '/export', usage: '/export [json|markdown] [path]' },
|
|
66
|
+
{ name: '/queue', usage: '/queue [rm <n>]' },
|
|
67
|
+
{ name: '/projekt', usage: '/projekt [<slug>|unlink]' },
|
|
68
|
+
{ name: '/project', usage: '/project [<slug>|unlink]' },
|
|
69
|
+
{ name: '/projects', usage: '/projects' },
|
|
70
|
+
{ name: '/quit', usage: '/quit' },
|
|
71
|
+
{ name: '/exit', usage: '/exit' },
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
// Returns commands whose name starts with the given prefix (typically the
|
|
75
|
+
// raw input value while the user is still typing the command name —
|
|
76
|
+
// caller should bail out if there's already a space in the input,
|
|
77
|
+
// meaning the user is typing args, not the command name).
|
|
78
|
+
//
|
|
79
|
+
// `featureFlags` filters commands tied to optional features so users
|
|
80
|
+
// without the feature don't see commands they can't actually run.
|
|
81
|
+
export interface FeatureFlags {
|
|
82
|
+
projects: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const PROJECT_COMMANDS = new Set(['/projekt', '/project', '/projects']);
|
|
86
|
+
|
|
87
|
+
export function matchCommands(prefix: string, flags?: FeatureFlags): CommandMeta[] {
|
|
88
|
+
return COMMANDS.filter((c) => {
|
|
89
|
+
if (!c.name.startsWith(prefix)) return false;
|
|
90
|
+
if (!flags?.projects && PROJECT_COMMANDS.has(c.name)) return false;
|
|
91
|
+
return true;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const HELP_TEXT_PROJECTS = ` /projekt — show currently-pinned project (alias: /project)
|
|
96
|
+
/projekt <slug> — pin a project to this session
|
|
97
|
+
/projekt unlink — clear the pinned project for this session
|
|
98
|
+
/projects — list available projects (with entity, archived hidden)
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
const HELP_TEXT_BASE = `Available commands:
|
|
102
|
+
/help — show this help
|
|
103
|
+
/agents — list agents
|
|
104
|
+
/agent <name> [session] — switch agent (defaults to main session)
|
|
105
|
+
/sessions — list sessions of current agent
|
|
106
|
+
/session <slug-or-id> — switch to another session of current agent
|
|
107
|
+
/new <slug> — create new session and switch to it
|
|
108
|
+
/main — back to main session of current agent
|
|
109
|
+
/reset — preview reset of current session
|
|
110
|
+
/reset YES — archive current session, start fresh
|
|
111
|
+
/models — list all configured models with aliases
|
|
112
|
+
/model — show current effective model for this session
|
|
113
|
+
/model <alias-or-ref> — override model for this session
|
|
114
|
+
/model default — clear override, fall back to persona model
|
|
115
|
+
/show — show current display toggles
|
|
116
|
+
/show memory on|off — show/hide [memory · …] inject lines (display only)
|
|
117
|
+
/show tools on|off — show/hide [tool call · …] / [tool result · …] lines
|
|
118
|
+
/verbose — show current verbose toggles
|
|
119
|
+
/verbose tools on|off — full tool input/output payloads under each call/result
|
|
120
|
+
/verbose memory on|off — full memory inject text under each [memory · …] line
|
|
121
|
+
/verbose system on — print persona system prompt as a one-shot block
|
|
122
|
+
/verbose system off — clear the verbose-system flag (no effect on past blocks)
|
|
123
|
+
/verbose thinking on|off — show the model's thinking text above each reply (gray, capped at 40 lines)
|
|
124
|
+
/thinking — show effective thinking depth + source
|
|
125
|
+
/thinking <level> — set thinking depth for this session: off|low|medium|high
|
|
126
|
+
/thinking default — clear session override, fall back to persona/engine default
|
|
127
|
+
/reload — re-read ~/.somora/config.yaml without a restart (reports what changed)
|
|
128
|
+
/restart YES — restart the somora service via systemd (drops every open session stream)
|
|
129
|
+
/sampling — show effective sampling params + source
|
|
130
|
+
/sampling key=value … — set sampling params for this session (temperature, top_p, top_k,
|
|
131
|
+
min_p, frequency_penalty, presence_penalty, repetition_penalty,
|
|
132
|
+
seed, stop); value "-" removes a key; openai-compatible engine only
|
|
133
|
+
/sampling default — clear the session sampling override
|
|
134
|
+
/temp <0–2> — shorthand for /sampling temperature=<n>
|
|
135
|
+
/temp default — remove only the temperature override
|
|
136
|
+
/export — export current session as markdown to ./<agent>-<session>.md
|
|
137
|
+
/export json [path] — export as raw JSONL (default path ./<agent>-<session>.jsonl)
|
|
138
|
+
/export markdown [path] — export as Markdown transcript
|
|
139
|
+
/queue — what this session runs, what waits behind it, what is arriving
|
|
140
|
+
/queue rm <n> — remove the n-th entry: a waiting one before it starts (a human entry's
|
|
141
|
+
text returns to the input); a running one under "From here" is stopped
|
|
142
|
+
/quit, /exit — leave somora`;
|
|
143
|
+
|
|
144
|
+
function helpText(featureFlags: FeatureFlags | undefined): string {
|
|
145
|
+
if (!featureFlags?.projects) return HELP_TEXT_BASE;
|
|
146
|
+
// Splice the project block ABOVE the /quit footer so it stays
|
|
147
|
+
// visually grouped with the other session-scoped commands.
|
|
148
|
+
return HELP_TEXT_BASE.replace(
|
|
149
|
+
' /quit, /exit — leave somora',
|
|
150
|
+
`${HELP_TEXT_PROJECTS} /quit, /exit — leave somora`,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface CommandContext {
|
|
155
|
+
api: Api;
|
|
156
|
+
agent: string;
|
|
157
|
+
session: string;
|
|
158
|
+
showMemory: boolean;
|
|
159
|
+
showTools: boolean;
|
|
160
|
+
verboseTools: boolean;
|
|
161
|
+
verboseMemory: boolean;
|
|
162
|
+
verboseSystem: boolean;
|
|
163
|
+
verboseThinking: boolean;
|
|
164
|
+
/** Live feature flags fetched once at App mount. Optional features
|
|
165
|
+
* filter their commands out of /help and matchCommands when off; the
|
|
166
|
+
* handlers below still reject defensively if reached anyway. */
|
|
167
|
+
featureFlags?: FeatureFlags;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// PUT a sampling merge-patch, then re-read so the notice shows the
|
|
171
|
+
// MERGED effective params (the server merges into the existing
|
|
172
|
+
// override) and can flag a dormant engine. Shared by /sampling and /temp.
|
|
173
|
+
async function applySamplingPatch(
|
|
174
|
+
ctx: CommandContext,
|
|
175
|
+
patch: SamplingPatch,
|
|
176
|
+
): Promise<CommandAction[]> {
|
|
177
|
+
try {
|
|
178
|
+
await ctx.api.setSessionSampling(ctx.agent, ctx.session, patch);
|
|
179
|
+
const info: SessionSamplingInfo | null = await ctx.api.fetchSessionSampling(ctx.agent, ctx.session);
|
|
180
|
+
const dormant = !!info && !info.engineSupportsSampling;
|
|
181
|
+
const dormantPart = dormant
|
|
182
|
+
? ' (dormant — only the openai-compatible engine applies sampling params)'
|
|
183
|
+
: '';
|
|
184
|
+
return [
|
|
185
|
+
{
|
|
186
|
+
kind: 'notice',
|
|
187
|
+
text: `sampling → ${formatSamplingParams(info ? info.effective : patch)}${dormantPart}`,
|
|
188
|
+
tone: dormant ? 'warn' : 'info',
|
|
189
|
+
},
|
|
190
|
+
];
|
|
191
|
+
} catch (err) {
|
|
192
|
+
return [{ kind: 'notice', text: (err as Error).message, tone: 'error' }];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export async function runCommand(
|
|
197
|
+
line: string,
|
|
198
|
+
ctx: CommandContext,
|
|
199
|
+
): Promise<CommandAction[]> {
|
|
200
|
+
const [cmd, ...args] = line.split(/\s+/);
|
|
201
|
+
const out: CommandAction[] = [];
|
|
202
|
+
|
|
203
|
+
switch (cmd) {
|
|
204
|
+
case '/help':
|
|
205
|
+
out.push({ kind: 'notice', text: helpText(ctx.featureFlags), tone: 'info' });
|
|
206
|
+
return out;
|
|
207
|
+
|
|
208
|
+
case '/quit':
|
|
209
|
+
case '/exit':
|
|
210
|
+
out.push({ kind: 'exit' });
|
|
211
|
+
return out;
|
|
212
|
+
|
|
213
|
+
case '/agents': {
|
|
214
|
+
const agents = await ctx.api.fetchAgents();
|
|
215
|
+
const lines = ['Agents:'];
|
|
216
|
+
for (const a of agents) {
|
|
217
|
+
const marker = a.name === ctx.agent ? '*' : ' ';
|
|
218
|
+
const icon = a.icon ? `${a.icon} ` : '';
|
|
219
|
+
const desc = a.description ? ` — ${a.description}` : '';
|
|
220
|
+
lines.push(` ${marker} ${icon}${a.name}${desc}`);
|
|
221
|
+
}
|
|
222
|
+
out.push({ kind: 'notice', text: lines.join('\n'), tone: 'info' });
|
|
223
|
+
return out;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
case '/agent': {
|
|
227
|
+
const name = args[0];
|
|
228
|
+
if (!name) {
|
|
229
|
+
out.push({ kind: 'notice', text: 'usage: /agent <name> [session]', tone: 'warn' });
|
|
230
|
+
return out;
|
|
231
|
+
}
|
|
232
|
+
const agents = await ctx.api.fetchAgents();
|
|
233
|
+
if (!agents.find((a) => a.name === name)) {
|
|
234
|
+
out.push({
|
|
235
|
+
kind: 'notice',
|
|
236
|
+
text: `agent '${name}' not found. /agents to list.`,
|
|
237
|
+
tone: 'warn',
|
|
238
|
+
});
|
|
239
|
+
return out;
|
|
240
|
+
}
|
|
241
|
+
const sessionRef = args[1] ?? 'main';
|
|
242
|
+
if (sessionRef !== 'main') {
|
|
243
|
+
const sessions = await ctx.api.fetchSessions(name);
|
|
244
|
+
if (!sessions.find((s) => s.id === sessionRef || s.slug === sessionRef)) {
|
|
245
|
+
out.push({
|
|
246
|
+
kind: 'notice',
|
|
247
|
+
text: `session '${sessionRef}' not found for agent '${name}'. /sessions to list, or /new <slug>.`,
|
|
248
|
+
tone: 'warn',
|
|
249
|
+
});
|
|
250
|
+
return out;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
out.push({ kind: 'switchTo', agent: name, session: sessionRef });
|
|
254
|
+
return out;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
case '/sessions': {
|
|
258
|
+
const sessions = await ctx.api.fetchSessions(ctx.agent);
|
|
259
|
+
const lines = [`Sessions for ${ctx.agent}:`];
|
|
260
|
+
for (const s of sessions) {
|
|
261
|
+
const marker = s.id === ctx.session || s.slug === ctx.session ? '*' : ' ';
|
|
262
|
+
// Unread = unreadAt strictly greater than seenAt (or seenAt
|
|
263
|
+
// missing). Server-broadcast via /activity/stream keeps both
|
|
264
|
+
// in sync across clients.
|
|
265
|
+
const isUnread =
|
|
266
|
+
typeof s.unreadAt === 'string' &&
|
|
267
|
+
(typeof s.seenAt !== 'string' || s.unreadAt > s.seenAt);
|
|
268
|
+
const unreadGlyph = isUnread ? '📬' : ' ';
|
|
269
|
+
const stamp = s.lastActivity ? s.lastActivity.slice(0, 16).replace('T', ' ') : 'empty';
|
|
270
|
+
const project = s.projectSlug ? ` 📁 ${s.projectSlug}` : '';
|
|
271
|
+
lines.push(
|
|
272
|
+
` ${marker} ${unreadGlyph} ${s.slug.padEnd(24)} ${String(s.messageCount).padStart(3)} msgs ${stamp}${project}`,
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
out.push({ kind: 'notice', text: lines.join('\n'), tone: 'info' });
|
|
276
|
+
return out;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
case '/session': {
|
|
280
|
+
const ref = args[0];
|
|
281
|
+
if (!ref) {
|
|
282
|
+
out.push({ kind: 'notice', text: 'usage: /session <slug-or-id>', tone: 'warn' });
|
|
283
|
+
return out;
|
|
284
|
+
}
|
|
285
|
+
if (ref !== 'main') {
|
|
286
|
+
const sessions = await ctx.api.fetchSessions(ctx.agent);
|
|
287
|
+
if (!sessions.find((s) => s.id === ref || s.slug === ref)) {
|
|
288
|
+
out.push({
|
|
289
|
+
kind: 'notice',
|
|
290
|
+
text: `session '${ref}' not found. /sessions to list, or /new <slug>.`,
|
|
291
|
+
tone: 'warn',
|
|
292
|
+
});
|
|
293
|
+
return out;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
out.push({ kind: 'switchTo', agent: ctx.agent, session: ref });
|
|
297
|
+
return out;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
case '/new': {
|
|
301
|
+
const slug = args[0];
|
|
302
|
+
if (!slug) {
|
|
303
|
+
out.push({ kind: 'notice', text: 'usage: /new <slug>', tone: 'warn' });
|
|
304
|
+
return out;
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
const id = await ctx.api.createSession(ctx.agent, slug);
|
|
308
|
+
out.push({ kind: 'switchTo', agent: ctx.agent, session: id });
|
|
309
|
+
} catch (err) {
|
|
310
|
+
out.push({ kind: 'notice', text: (err as Error).message, tone: 'error' });
|
|
311
|
+
}
|
|
312
|
+
return out;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
case '/main':
|
|
316
|
+
out.push({ kind: 'switchTo', agent: ctx.agent, session: 'main' });
|
|
317
|
+
return out;
|
|
318
|
+
|
|
319
|
+
case '/reset': {
|
|
320
|
+
if (args[0] !== 'YES') {
|
|
321
|
+
const altHint =
|
|
322
|
+
ctx.session !== 'main'
|
|
323
|
+
? `\n Alternative for non-main sessions: /new <new-slug>` +
|
|
324
|
+
`\n leaves this session intact and starts a fresh one.`
|
|
325
|
+
: '';
|
|
326
|
+
const text =
|
|
327
|
+
`[/reset] would archive the CURRENT session (${ctx.agent}:${ctx.session}) and start fresh.` +
|
|
328
|
+
`\n Existing JSONL + meta are preserved as a timestamped archive` +
|
|
329
|
+
`\n you can resume any time with /session <id>.` +
|
|
330
|
+
altHint +
|
|
331
|
+
`\n To commit: /reset YES`;
|
|
332
|
+
out.push({ kind: 'notice', text, tone: 'info' });
|
|
333
|
+
return out;
|
|
334
|
+
}
|
|
335
|
+
try {
|
|
336
|
+
const result = await ctx.api.resetSession(ctx.agent, ctx.session);
|
|
337
|
+
if (result.archivedId) {
|
|
338
|
+
const dreamLine = result.dreamSpawned
|
|
339
|
+
? `\n dream-extraction running in background — ask later via dream_list.`
|
|
340
|
+
: '';
|
|
341
|
+
out.push({
|
|
342
|
+
kind: 'notice',
|
|
343
|
+
text:
|
|
344
|
+
`[reset done] archived as: ${result.archivedId}` +
|
|
345
|
+
`\n current session is now empty + clean.${dreamLine}`,
|
|
346
|
+
tone: 'info',
|
|
347
|
+
});
|
|
348
|
+
} else {
|
|
349
|
+
out.push({
|
|
350
|
+
kind: 'notice',
|
|
351
|
+
text: `[reset noop] ${result.reason ?? 'nothing to archive'}`,
|
|
352
|
+
tone: 'warn',
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
out.push({ kind: 'clearStats' });
|
|
356
|
+
} catch (err) {
|
|
357
|
+
out.push({ kind: 'notice', text: (err as Error).message, tone: 'error' });
|
|
358
|
+
}
|
|
359
|
+
return out;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
case '/models': {
|
|
363
|
+
const models = await ctx.api.fetchModels();
|
|
364
|
+
const aliasW = Math.max(5, ...models.map((m) => (m.alias ?? '-').length));
|
|
365
|
+
const refW = Math.max(20, ...models.map((m) => `${m.provider}/${m.id}`.length));
|
|
366
|
+
const lines = [
|
|
367
|
+
'Models:',
|
|
368
|
+
` ${'alias'.padEnd(aliasW)} ${'provider/id'.padEnd(refW)} engine ctx caps`,
|
|
369
|
+
];
|
|
370
|
+
for (const m of models) {
|
|
371
|
+
const alias = (m.alias ?? '-').padEnd(aliasW);
|
|
372
|
+
const ref = `${m.provider}/${m.id}`.padEnd(refW);
|
|
373
|
+
const engine = m.engine.padEnd(22);
|
|
374
|
+
const ctx2 = `${(m.contextWindow / 1000).toFixed(0)}k`.padStart(6);
|
|
375
|
+
const caps = m.capabilities.join(',');
|
|
376
|
+
lines.push(` ${alias} ${ref} ${engine} ${ctx2} ${caps}`);
|
|
377
|
+
}
|
|
378
|
+
out.push({ kind: 'notice', text: lines.join('\n'), tone: 'info' });
|
|
379
|
+
return out;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
case '/model': {
|
|
383
|
+
const ref = args[0];
|
|
384
|
+
if (!ref) {
|
|
385
|
+
const info = await ctx.api.fetchSessionModel(ctx.agent, ctx.session);
|
|
386
|
+
if (!info) {
|
|
387
|
+
out.push({ kind: 'notice', text: 'could not fetch session model', tone: 'error' });
|
|
388
|
+
} else {
|
|
389
|
+
const aliasPart = info.alias ? ` (alias: ${info.alias})` : '';
|
|
390
|
+
const sourcePart =
|
|
391
|
+
info.source === 'session-override'
|
|
392
|
+
? ` — session-override (persona default: ${info.personaDefault ?? '(none)'})`
|
|
393
|
+
: ' — persona default';
|
|
394
|
+
out.push({
|
|
395
|
+
kind: 'notice',
|
|
396
|
+
text: `Effective: ${info.provider}/${info.modelId}${aliasPart}\n engine: ${info.engine}, context: ${info.contextWindow}${sourcePart}`,
|
|
397
|
+
tone: 'info',
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
return out;
|
|
401
|
+
}
|
|
402
|
+
if (ref === 'default' || ref === '-') {
|
|
403
|
+
try {
|
|
404
|
+
await ctx.api.clearSessionModel(ctx.agent, ctx.session);
|
|
405
|
+
out.push({ kind: 'notice', text: 'model override cleared, back to persona default', tone: 'info' });
|
|
406
|
+
} catch (err) {
|
|
407
|
+
out.push({ kind: 'notice', text: (err as Error).message, tone: 'error' });
|
|
408
|
+
}
|
|
409
|
+
return out;
|
|
410
|
+
}
|
|
411
|
+
try {
|
|
412
|
+
await ctx.api.setSessionModel(ctx.agent, ctx.session, ref);
|
|
413
|
+
out.push({
|
|
414
|
+
kind: 'notice',
|
|
415
|
+
text: `model set to: ${ref} (for session ${ctx.session})`,
|
|
416
|
+
tone: 'info',
|
|
417
|
+
});
|
|
418
|
+
} catch (err) {
|
|
419
|
+
out.push({ kind: 'notice', text: (err as Error).message, tone: 'error' });
|
|
420
|
+
}
|
|
421
|
+
return out;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
case '/thinking': {
|
|
425
|
+
const arg = args[0];
|
|
426
|
+
if (!arg) {
|
|
427
|
+
const info = await ctx.api.fetchSessionThinking(ctx.agent, ctx.session);
|
|
428
|
+
if (!info) {
|
|
429
|
+
out.push({ kind: 'notice', text: 'could not fetch thinking state', tone: 'error' });
|
|
430
|
+
return out;
|
|
431
|
+
}
|
|
432
|
+
const eff = info.effective ?? '(engine default)';
|
|
433
|
+
const sourcePart =
|
|
434
|
+
info.source === 'session-override'
|
|
435
|
+
? ` — session-override (persona default: ${info.personaDefault ?? '(none)'})`
|
|
436
|
+
: info.source === 'persona-default'
|
|
437
|
+
? ' — persona default'
|
|
438
|
+
: ' — no setting, engine default';
|
|
439
|
+
const dormantPart = info.effective && !info.modelSupportsReasoning
|
|
440
|
+
? `\n warning: active model has no 'reasoning' capability — setting is dormant`
|
|
441
|
+
: '';
|
|
442
|
+
out.push({
|
|
443
|
+
kind: 'notice',
|
|
444
|
+
text: `Thinking: ${eff}${sourcePart}${dormantPart}`,
|
|
445
|
+
tone: info.effective && !info.modelSupportsReasoning ? 'warn' : 'info',
|
|
446
|
+
});
|
|
447
|
+
return out;
|
|
448
|
+
}
|
|
449
|
+
if (arg === 'default' || arg === '-') {
|
|
450
|
+
try {
|
|
451
|
+
await ctx.api.clearSessionThinking(ctx.agent, ctx.session);
|
|
452
|
+
out.push({
|
|
453
|
+
kind: 'notice',
|
|
454
|
+
text: 'thinking override cleared, back to persona/engine default',
|
|
455
|
+
tone: 'info',
|
|
456
|
+
});
|
|
457
|
+
} catch (err) {
|
|
458
|
+
out.push({ kind: 'notice', text: (err as Error).message, tone: 'error' });
|
|
459
|
+
}
|
|
460
|
+
return out;
|
|
461
|
+
}
|
|
462
|
+
if (arg !== 'off' && arg !== 'low' && arg !== 'medium' && arg !== 'high') {
|
|
463
|
+
out.push({
|
|
464
|
+
kind: 'notice',
|
|
465
|
+
text: `usage: /thinking off|low|medium|high|default`,
|
|
466
|
+
tone: 'warn',
|
|
467
|
+
});
|
|
468
|
+
return out;
|
|
469
|
+
}
|
|
470
|
+
try {
|
|
471
|
+
await ctx.api.setSessionThinking(ctx.agent, ctx.session, arg);
|
|
472
|
+
// Probe support so we can be honest in the response notice.
|
|
473
|
+
const info = await ctx.api.fetchSessionThinking(ctx.agent, ctx.session);
|
|
474
|
+
const dormantPart =
|
|
475
|
+
info && !info.modelSupportsReasoning
|
|
476
|
+
? ` (active model has no 'reasoning' capability — dormant until you switch model)`
|
|
477
|
+
: '';
|
|
478
|
+
out.push({
|
|
479
|
+
kind: 'notice',
|
|
480
|
+
text: `thinking set to: ${arg}${dormantPart}`,
|
|
481
|
+
tone: info && !info.modelSupportsReasoning ? 'warn' : 'info',
|
|
482
|
+
});
|
|
483
|
+
} catch (err) {
|
|
484
|
+
out.push({ kind: 'notice', text: (err as Error).message, tone: 'error' });
|
|
485
|
+
}
|
|
486
|
+
return out;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
case '/reload': {
|
|
490
|
+
const r = await ctx.api.reloadConfig();
|
|
491
|
+
if (!r.ok) {
|
|
492
|
+
out.push({ kind: 'notice', text: `config not reloaded — ${r.error}`, tone: 'error' });
|
|
493
|
+
return out;
|
|
494
|
+
}
|
|
495
|
+
const changed = r.changed ?? [];
|
|
496
|
+
const restart = r.restartRequired ?? [];
|
|
497
|
+
const what = changed.length === 0 ? 'no changes' : `changed: ${changed.join(', ')}`;
|
|
498
|
+
const tail = restart.length > 0 ? `\n restart needed for: ${restart.join(', ')} (/restart YES)` : '';
|
|
499
|
+
out.push({ kind: 'notice', text: `config reloaded — ${what}${tail}`, tone: restart.length > 0 ? 'warn' : 'info' });
|
|
500
|
+
return out;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
case '/restart': {
|
|
504
|
+
if (args[0] !== 'YES') {
|
|
505
|
+
out.push({ kind: 'notice', text: 'restarts the somora service and drops every open stream — type /restart YES to confirm', tone: 'warn' });
|
|
506
|
+
return out;
|
|
507
|
+
}
|
|
508
|
+
const r = await ctx.api.restartServer();
|
|
509
|
+
if (!r.ok) {
|
|
510
|
+
out.push({ kind: 'notice', text: `restart refused — ${r.error}`, tone: 'error' });
|
|
511
|
+
return out;
|
|
512
|
+
}
|
|
513
|
+
out.push({ kind: 'notice', text: `restarting somora via systemd — back in ~${r.expectedDowntimeSeconds ?? 8}s, this client will reconnect`, tone: 'warn' });
|
|
514
|
+
return out;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
case '/sampling': {
|
|
518
|
+
const arg = args[0];
|
|
519
|
+
if (!arg) {
|
|
520
|
+
const info = await ctx.api.fetchSessionSampling(ctx.agent, ctx.session);
|
|
521
|
+
if (!info) {
|
|
522
|
+
out.push({ kind: 'notice', text: 'could not fetch sampling state', tone: 'error' });
|
|
523
|
+
return out;
|
|
524
|
+
}
|
|
525
|
+
const eff = formatSamplingParams(info.effective);
|
|
526
|
+
const sourcePart =
|
|
527
|
+
info.source === 'session-override'
|
|
528
|
+
? ` — session-override (persona default: ${formatSamplingParams(info.personaDefault)})`
|
|
529
|
+
: info.source === 'persona-default'
|
|
530
|
+
? ' — persona default'
|
|
531
|
+
: info.source === 'model-default'
|
|
532
|
+
? ' — model default'
|
|
533
|
+
: ' — no setting, engine default';
|
|
534
|
+
const dormant = info.effective !== null && !info.engineSupportsSampling;
|
|
535
|
+
const dormantPart = dormant
|
|
536
|
+
? `\n warning: only the openai-compatible engine applies sampling params — setting is dormant`
|
|
537
|
+
: '';
|
|
538
|
+
out.push({
|
|
539
|
+
kind: 'notice',
|
|
540
|
+
text: `Sampling: ${eff}${sourcePart}${dormantPart}`,
|
|
541
|
+
tone: dormant ? 'warn' : 'info',
|
|
542
|
+
});
|
|
543
|
+
return out;
|
|
544
|
+
}
|
|
545
|
+
if (arg === 'default' || arg === '-') {
|
|
546
|
+
try {
|
|
547
|
+
await ctx.api.clearSessionSampling(ctx.agent, ctx.session);
|
|
548
|
+
out.push({ kind: 'notice', text: 'sampling override cleared', tone: 'info' });
|
|
549
|
+
} catch (err) {
|
|
550
|
+
out.push({ kind: 'notice', text: (err as Error).message, tone: 'error' });
|
|
551
|
+
}
|
|
552
|
+
return out;
|
|
553
|
+
}
|
|
554
|
+
const parsed = parseSamplingArgs(args);
|
|
555
|
+
if (!parsed.ok) {
|
|
556
|
+
out.push({ kind: 'notice', text: `${parsed.error}\n${SAMPLING_USAGE}`, tone: 'warn' });
|
|
557
|
+
return out;
|
|
558
|
+
}
|
|
559
|
+
out.push(...(await applySamplingPatch(ctx, parsed.params)));
|
|
560
|
+
return out;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
case '/temp': {
|
|
564
|
+
const arg = args[0];
|
|
565
|
+
if (!arg) {
|
|
566
|
+
out.push({ kind: 'notice', text: TEMP_USAGE, tone: 'warn' });
|
|
567
|
+
return out;
|
|
568
|
+
}
|
|
569
|
+
if (arg === 'default' || arg === '-') {
|
|
570
|
+
out.push(...(await applySamplingPatch(ctx, { temperature: null })));
|
|
571
|
+
return out;
|
|
572
|
+
}
|
|
573
|
+
const v = parseSamplingValue('temperature', arg);
|
|
574
|
+
if (!v.ok) {
|
|
575
|
+
out.push({ kind: 'notice', text: `${v.error}\n${TEMP_USAGE}`, tone: 'warn' });
|
|
576
|
+
return out;
|
|
577
|
+
}
|
|
578
|
+
out.push(...(await applySamplingPatch(ctx, { temperature: v.value as number })));
|
|
579
|
+
return out;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
case '/verbose': {
|
|
583
|
+
const target = args[0];
|
|
584
|
+
const value = args[1];
|
|
585
|
+
if (!target) {
|
|
586
|
+
out.push({
|
|
587
|
+
kind: 'notice',
|
|
588
|
+
text:
|
|
589
|
+
`Verbose toggles (TUI render only — server already streams full payloads):\n` +
|
|
590
|
+
` tools: ${ctx.verboseTools ? 'on' : 'off'} — full input/output under each call\n` +
|
|
591
|
+
` memory: ${ctx.verboseMemory ? 'on' : 'off'} — full inject text under [memory · …]\n` +
|
|
592
|
+
` system: ${ctx.verboseSystem ? 'on' : 'off'} — last /verbose system on flag\n` +
|
|
593
|
+
` thinking: ${ctx.verboseThinking ? 'on' : 'off'} — model thinking text above each reply (engines that surface it)\n` +
|
|
594
|
+
`Toggle: /verbose <tools|memory|system|thinking> on|off`,
|
|
595
|
+
tone: 'info',
|
|
596
|
+
});
|
|
597
|
+
return out;
|
|
598
|
+
}
|
|
599
|
+
if (
|
|
600
|
+
target !== 'tools' &&
|
|
601
|
+
target !== 'memory' &&
|
|
602
|
+
target !== 'system' &&
|
|
603
|
+
target !== 'thinking'
|
|
604
|
+
) {
|
|
605
|
+
out.push({
|
|
606
|
+
kind: 'notice',
|
|
607
|
+
text: 'usage: /verbose [tools|memory|system|thinking] [on|off]',
|
|
608
|
+
tone: 'warn',
|
|
609
|
+
});
|
|
610
|
+
return out;
|
|
611
|
+
}
|
|
612
|
+
if (value !== 'on' && value !== 'off') {
|
|
613
|
+
out.push({
|
|
614
|
+
kind: 'notice',
|
|
615
|
+
text: `usage: /verbose ${target} on|off`,
|
|
616
|
+
tone: 'warn',
|
|
617
|
+
});
|
|
618
|
+
return out;
|
|
619
|
+
}
|
|
620
|
+
const flag = value === 'on';
|
|
621
|
+
out.push({ kind: 'setVerbose', target, value: flag });
|
|
622
|
+
// For `system`, switching on triggers a one-shot fetch + display
|
|
623
|
+
// of the persona system prompt. Future system blocks are not
|
|
624
|
+
// streamed automatically (system prompt is static per agent).
|
|
625
|
+
if (target === 'system' && flag) {
|
|
626
|
+
try {
|
|
627
|
+
const sp = await ctx.api.fetchSystemPrompt(ctx.agent);
|
|
628
|
+
if (sp) {
|
|
629
|
+
out.push({
|
|
630
|
+
kind: 'notice',
|
|
631
|
+
text: `[system prompt for ${ctx.agent}]\n${sp}`,
|
|
632
|
+
tone: 'info',
|
|
633
|
+
});
|
|
634
|
+
} else {
|
|
635
|
+
out.push({
|
|
636
|
+
kind: 'notice',
|
|
637
|
+
text: `could not fetch system prompt for ${ctx.agent}`,
|
|
638
|
+
tone: 'warn',
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
} catch (err) {
|
|
642
|
+
out.push({ kind: 'notice', text: (err as Error).message, tone: 'error' });
|
|
643
|
+
}
|
|
644
|
+
} else {
|
|
645
|
+
out.push({
|
|
646
|
+
kind: 'notice',
|
|
647
|
+
text: `verbose ${target} ${flag ? 'on' : 'off'}`,
|
|
648
|
+
tone: 'info',
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
return out;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
case '/projekt':
|
|
655
|
+
case '/project': {
|
|
656
|
+
if (!ctx.featureFlags?.projects) {
|
|
657
|
+
out.push({
|
|
658
|
+
kind: 'notice',
|
|
659
|
+
text: 'projects feature is disabled in config.yaml (set projects.enabled: true to use)',
|
|
660
|
+
tone: 'warn',
|
|
661
|
+
});
|
|
662
|
+
return out;
|
|
663
|
+
}
|
|
664
|
+
const arg = args[0];
|
|
665
|
+
// No arg → show status.
|
|
666
|
+
if (!arg) {
|
|
667
|
+
const info = await ctx.api.fetchSessionProject(ctx.agent, ctx.session);
|
|
668
|
+
if (!info.slug) {
|
|
669
|
+
out.push({
|
|
670
|
+
kind: 'notice',
|
|
671
|
+
text: 'no project linked to this session. /projects to list, /projekt <slug> to pin.',
|
|
672
|
+
tone: 'info',
|
|
673
|
+
});
|
|
674
|
+
return out;
|
|
675
|
+
}
|
|
676
|
+
if (!info.project) {
|
|
677
|
+
out.push({
|
|
678
|
+
kind: 'notice',
|
|
679
|
+
text: `pinned slug '${info.slug}' but project file is missing on disk`,
|
|
680
|
+
tone: 'warn',
|
|
681
|
+
});
|
|
682
|
+
return out;
|
|
683
|
+
}
|
|
684
|
+
const p = info.project;
|
|
685
|
+
const tagLine = p.tags.length > 0 ? `\n tags: ${p.tags.join(', ')}` : '';
|
|
686
|
+
const descLine = p.description ? `\n desc: ${p.description}` : '';
|
|
687
|
+
const pathsLine =
|
|
688
|
+
p.paths.length > 0
|
|
689
|
+
? `\n paths:\n${p.paths
|
|
690
|
+
.map((path) => ` - ${path.ref}${path.label ? ` (${path.label})` : ''}`)
|
|
691
|
+
.join('\n')}`
|
|
692
|
+
: '\n paths: (none)';
|
|
693
|
+
out.push({
|
|
694
|
+
kind: 'notice',
|
|
695
|
+
text: `Project: ${p.name} (${p.slug})\n entity: ${p.entity}${descLine}${tagLine}${pathsLine}`,
|
|
696
|
+
tone: 'info',
|
|
697
|
+
});
|
|
698
|
+
return out;
|
|
699
|
+
}
|
|
700
|
+
// unlink / off / clear / "-" → drop the pin
|
|
701
|
+
if (arg === 'unlink' || arg === 'off' || arg === 'clear' || arg === '-') {
|
|
702
|
+
try {
|
|
703
|
+
await ctx.api.clearSessionProject(ctx.agent, ctx.session);
|
|
704
|
+
out.push({ kind: 'notice', text: 'project unlinked for this session', tone: 'info' });
|
|
705
|
+
out.push({ kind: 'projectFocusRefresh' });
|
|
706
|
+
} catch (err) {
|
|
707
|
+
out.push({ kind: 'notice', text: (err as Error).message, tone: 'error' });
|
|
708
|
+
}
|
|
709
|
+
return out;
|
|
710
|
+
}
|
|
711
|
+
// arg = slug → pin
|
|
712
|
+
try {
|
|
713
|
+
await ctx.api.setSessionProject(ctx.agent, ctx.session, arg);
|
|
714
|
+
out.push({
|
|
715
|
+
kind: 'notice',
|
|
716
|
+
text: `project pinned: ${arg} (active from the next turn onward)`,
|
|
717
|
+
tone: 'info',
|
|
718
|
+
});
|
|
719
|
+
out.push({ kind: 'projectFocusRefresh' });
|
|
720
|
+
} catch (err) {
|
|
721
|
+
out.push({ kind: 'notice', text: (err as Error).message, tone: 'error' });
|
|
722
|
+
}
|
|
723
|
+
return out;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
case '/projects': {
|
|
727
|
+
if (!ctx.featureFlags?.projects) {
|
|
728
|
+
out.push({
|
|
729
|
+
kind: 'notice',
|
|
730
|
+
text: 'projects feature is disabled in config.yaml (set projects.enabled: true to use)',
|
|
731
|
+
tone: 'warn',
|
|
732
|
+
});
|
|
733
|
+
return out;
|
|
734
|
+
}
|
|
735
|
+
const projects = await ctx.api.fetchProjects();
|
|
736
|
+
if (projects.length === 0) {
|
|
737
|
+
out.push({
|
|
738
|
+
kind: 'notice',
|
|
739
|
+
text: 'no projects configured (or projects.enabled is false in config.yaml)',
|
|
740
|
+
tone: 'info',
|
|
741
|
+
});
|
|
742
|
+
return out;
|
|
743
|
+
}
|
|
744
|
+
const slugW = Math.max(4, ...projects.map((p) => p.slug.length));
|
|
745
|
+
const nameW = Math.max(4, ...projects.map((p) => p.name.length));
|
|
746
|
+
const entityW = Math.max(6, ...projects.map((p) => p.entity.length));
|
|
747
|
+
const lines = [
|
|
748
|
+
`Projects (${projects.length}):`,
|
|
749
|
+
` ${'slug'.padEnd(slugW)} ${'name'.padEnd(nameW)} ${'entity'.padEnd(entityW)} paths tags`,
|
|
750
|
+
];
|
|
751
|
+
for (const p of projects) {
|
|
752
|
+
const slug = p.slug.padEnd(slugW);
|
|
753
|
+
const name = p.name.padEnd(nameW);
|
|
754
|
+
const entity = p.entity.padEnd(entityW);
|
|
755
|
+
const paths = String(p.paths.length).padStart(5);
|
|
756
|
+
const tags = p.tags.join(', ');
|
|
757
|
+
lines.push(` ${slug} ${name} ${entity} ${paths} ${tags}`);
|
|
758
|
+
}
|
|
759
|
+
out.push({ kind: 'notice', text: lines.join('\n'), tone: 'info' });
|
|
760
|
+
return out;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
case '/export': {
|
|
764
|
+
// /export [json|markdown] [path] — write the current session
|
|
765
|
+
// to a local file. Defaults: markdown, ./<agent>-<session>.<ext>.
|
|
766
|
+
// Server does the rendering — we just save bytes. Useful for
|
|
767
|
+
// backups, sharing transcripts, post-processing in Obsidian.
|
|
768
|
+
const format = (args[0] ?? 'markdown').toLowerCase();
|
|
769
|
+
if (format !== 'json' && format !== 'markdown') {
|
|
770
|
+
out.push({
|
|
771
|
+
kind: 'notice',
|
|
772
|
+
text: 'usage: /export [json|markdown] [path]',
|
|
773
|
+
tone: 'warn',
|
|
774
|
+
});
|
|
775
|
+
return out;
|
|
776
|
+
}
|
|
777
|
+
const ext = format === 'json' ? 'jsonl' : 'md';
|
|
778
|
+
const defaultPath = `./${ctx.agent}-${ctx.session}.${ext}`;
|
|
779
|
+
const targetPath = args[1] ?? defaultPath;
|
|
780
|
+
try {
|
|
781
|
+
const body = await ctx.api.exportSession(ctx.agent, ctx.session, format);
|
|
782
|
+
const fs = await import('node:fs/promises');
|
|
783
|
+
const path = await import('node:path');
|
|
784
|
+
const abs = path.resolve(targetPath);
|
|
785
|
+
await fs.writeFile(abs, body, 'utf8');
|
|
786
|
+
out.push({
|
|
787
|
+
kind: 'notice',
|
|
788
|
+
text: `exported ${ctx.agent}/${ctx.session} → ${abs} (${body.length} bytes, ${format})`,
|
|
789
|
+
tone: 'info',
|
|
790
|
+
});
|
|
791
|
+
} catch (err) {
|
|
792
|
+
out.push({ kind: 'notice', text: (err as Error).message, tone: 'error' });
|
|
793
|
+
}
|
|
794
|
+
return out;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
case '/queue': {
|
|
798
|
+
const sub = args[0];
|
|
799
|
+
if (!sub) {
|
|
800
|
+
const work = await ctx.api.fetchWork(ctx.agent, ctx.session);
|
|
801
|
+
out.push({ kind: 'notice', text: formatWorkList(work), tone: 'info' });
|
|
802
|
+
return out;
|
|
803
|
+
}
|
|
804
|
+
if (sub !== 'rm') {
|
|
805
|
+
out.push({ kind: 'notice', text: 'usage: /queue [rm <n>]', tone: 'warn' });
|
|
806
|
+
return out;
|
|
807
|
+
}
|
|
808
|
+
const n = Number(args[1]);
|
|
809
|
+
if (!Number.isInteger(n) || n < 1) {
|
|
810
|
+
out.push({ kind: 'notice', text: 'usage: /queue rm <n> — n is the number from /queue', tone: 'warn' });
|
|
811
|
+
return out;
|
|
812
|
+
}
|
|
813
|
+
const work = await ctx.api.fetchWork(ctx.agent, ctx.session);
|
|
814
|
+
if (!work) {
|
|
815
|
+
out.push({ kind: 'notice', text: 'queue: the server did not answer (older server without /work?)', tone: 'error' });
|
|
816
|
+
return out;
|
|
817
|
+
}
|
|
818
|
+
const found = queueEntryAt(work, n);
|
|
819
|
+
if (!found) {
|
|
820
|
+
const total = work.queued.length + work.children.length;
|
|
821
|
+
out.push({
|
|
822
|
+
kind: 'notice',
|
|
823
|
+
text: total === 0 ? 'queue: nothing is waiting or running from here' : `queue: no entry #${n} (${work.queued.length} waiting, ${work.children.length} from here)`,
|
|
824
|
+
tone: 'warn',
|
|
825
|
+
});
|
|
826
|
+
return out;
|
|
827
|
+
}
|
|
828
|
+
const entry = found.item;
|
|
829
|
+
if (!entry.id) {
|
|
830
|
+
out.push({ kind: 'notice', text: `queue: entry #${n} has no id the server can remove`, tone: 'error' });
|
|
831
|
+
return out;
|
|
832
|
+
}
|
|
833
|
+
const what = `#${n} ${workLabel(entry)}`;
|
|
834
|
+
// A running entry under "From here": stop it — the sub-agent's task
|
|
835
|
+
// with everything it started, or the turn an agent_ask runs as.
|
|
836
|
+
if (found.where === 'children' && entry.state === 'running') {
|
|
837
|
+
if (entry.kind === 'subagent') {
|
|
838
|
+
const c = await ctx.api.cancelSpawn(entry.id);
|
|
839
|
+
out.push(c.ok ? { kind: 'notice', text: `queue: stopped ${what} and what it started`, tone: 'info' } : { kind: 'notice', text: `queue: could not stop ${what} — ${c.error}`, tone: 'error' });
|
|
840
|
+
} else if (entry.target) {
|
|
841
|
+
await ctx.api.abortTurn(entry.target.agent, entry.target.session);
|
|
842
|
+
out.push({ kind: 'notice', text: `queue: stopped ${what} on ${entry.target.agent}:${entry.target.session}`, tone: 'info' });
|
|
843
|
+
} else {
|
|
844
|
+
out.push({ kind: 'notice', text: `queue: ${what} has no target session to stop`, tone: 'error' });
|
|
845
|
+
}
|
|
846
|
+
out.push({ kind: 'workRefresh' });
|
|
847
|
+
return out;
|
|
848
|
+
}
|
|
849
|
+
const r = await ctx.api.dequeue(entry.id);
|
|
850
|
+
switch (r.status) {
|
|
851
|
+
case 'removed':
|
|
852
|
+
out.push({ kind: 'notice', text: `queue: removed ${what}${r.text !== undefined ? ' — text is back in the input' : ''}`, tone: 'info' });
|
|
853
|
+
if (r.text !== undefined) out.push({ kind: 'restoreInput', text: r.text, turnId: entry.id });
|
|
854
|
+
break;
|
|
855
|
+
case 'already_started':
|
|
856
|
+
out.push({ kind: 'notice', text: `queue: ${what} already started — Esc aborts a running turn`, tone: 'warn' });
|
|
857
|
+
break;
|
|
858
|
+
case 'unknown':
|
|
859
|
+
out.push({ kind: 'notice', text: `queue: ${what} is no longer waiting (started or finished meanwhile)`, tone: 'warn' });
|
|
860
|
+
break;
|
|
861
|
+
default:
|
|
862
|
+
out.push({ kind: 'notice', text: `queue: could not remove ${what} — ${r.error}`, tone: 'error' });
|
|
863
|
+
}
|
|
864
|
+
out.push({ kind: 'workRefresh' });
|
|
865
|
+
return out;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
case '/show': {
|
|
869
|
+
const target = args[0];
|
|
870
|
+
const value = args[1];
|
|
871
|
+
if (!target) {
|
|
872
|
+
out.push({
|
|
873
|
+
kind: 'notice',
|
|
874
|
+
text:
|
|
875
|
+
`Display toggles (TUI render only — server still injects/runs everything):\n` +
|
|
876
|
+
` memory: ${ctx.showMemory ? 'on' : 'off'}\n` +
|
|
877
|
+
` tools: ${ctx.showTools ? 'on' : 'off'}\n` +
|
|
878
|
+
`Toggle: /show memory on|off /show tools on|off`,
|
|
879
|
+
tone: 'info',
|
|
880
|
+
});
|
|
881
|
+
return out;
|
|
882
|
+
}
|
|
883
|
+
if (target !== 'memory' && target !== 'tools') {
|
|
884
|
+
out.push({
|
|
885
|
+
kind: 'notice',
|
|
886
|
+
text: `usage: /show [memory|tools] [on|off]`,
|
|
887
|
+
tone: 'warn',
|
|
888
|
+
});
|
|
889
|
+
return out;
|
|
890
|
+
}
|
|
891
|
+
if (value !== 'on' && value !== 'off') {
|
|
892
|
+
out.push({
|
|
893
|
+
kind: 'notice',
|
|
894
|
+
text: `usage: /show ${target} on|off`,
|
|
895
|
+
tone: 'warn',
|
|
896
|
+
});
|
|
897
|
+
return out;
|
|
898
|
+
}
|
|
899
|
+
const flag = value === 'on';
|
|
900
|
+
out.push({ kind: 'setShow', target, value: flag });
|
|
901
|
+
out.push({
|
|
902
|
+
kind: 'notice',
|
|
903
|
+
text: `${target} display ${flag ? 'on' : 'off'}`,
|
|
904
|
+
tone: 'info',
|
|
905
|
+
});
|
|
906
|
+
return out;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
default:
|
|
910
|
+
out.push({ kind: 'notice', text: `unknown command: ${cmd}. Try /help`, tone: 'warn' });
|
|
911
|
+
return out;
|
|
912
|
+
}
|
|
913
|
+
}
|