DSH HUB
首页插件商店插件包社区排行榜资源发布指南
插件源码
返回插件目录

xiang-deng /

xiang-deng/moumantai

仅 Topic 仓库

Self-hosted runtime for personal apps that combine reliable code with LLM agents and adapt across every screen.

★ 10 Stars3 Forks0 IssuesN/A 社区评分0 已确认安装
查看 GitHub
README来源: main@d7cc656c

Moumantai logo

Moumantai

License: MIT Ask DeepWiki

Moumantai (冇問題 / no problem) is an open-source, self-hosted runtime for personal apps that can be owned, adapted, and used across the devices around you.

Describe an app once: its data, capabilities, and interfaces. The host holds the state and application logic, then projects the appropriate face onto the browser, phone, watch, or embedded display in front of you. Code defines the reliable behavior; an LLM-powered agent adds language, interpretation, and judgment within those boundaries.

The result is an app, not a prompt: durable software that can be reused, inspected, shared, and remixed.

You drive; the agent helps.

Quick start · Configuration · Architecture · Plugin apps · Model providers · Clients · Upgrading from v1 · Develop

Moumantai day-to-day demo: Spend Tracker, Todo, live ESPN Sports, and Home agent synced across Desktop PWA, Android Phone, Wear OS Watch, and ESP32-S3 CrowPanel
One self-hosted runtime, native UI everywhere — direct taps, external APIs, chat, and voice synced across Desktop, Phone, Watch, and ESP32-S3 (ready for smart glasses & ambient displays).

Key features

  • Yours, end to end — self-host the runtime and own the app's source, data, behavior, appearance, and deployment.
  • Schema. Tools. Faces. — a deliberately familiar CRUD core: the schema owns state, tools mutate, and faces read. Direct UI and agent calls meet at the same tool boundary.
  • Code for the known, an agent for the fuzzy — taps and forms stay deterministic; an LLM-powered agent brings language, flexibility, and judgment when useful.
  • Bring your own agent and model — the agent supplies orchestration and tool use; the model supplies inference. Choose the combination that fits the task, provider, and budget.
  • Polyphenic apps, native surfaces — one app wears many faces, specialized for each device and context. Thin clients map the same typed protocol to the toolkit that fits — from browsers and phones to watches and embedded panels — while the host carries the heavy compute.
  • Apps, not prompts — code and interfaces are reused rather than regenerated on every request, saving tokens and making smaller or less expensive models practical. The result can be inspected, shared, forked, and personalized.

Moumantai is early and evolving; expect rough edges and changing APIs. Trying it, reporting what breaks, and contributing improvements are all welcome.

Quick start

Moumantai runs as a set of plugins on the DeepSeek Harness (DSH). The host is a DSH profile; moumantai is the CLI that creates it, runs it, and administers it.

Already using DSH (Desktop or Web Companion — Recommended)

Moumantai layers cleanly onto DSH Desktop or DSH Web (dsh-base + dsh-web-app) as an additive companion bundle (@moumantai/dsh-plugin + @moumantai/dsh-companion):

npx moumantai init --companion                 # attaches to DSH `web` profile (or pass --profile desktop)
dsh web                                        # or restart DSH Desktop

Inside DSH Desktop / Web you get:

  • Mini-Apps Hub (left sidebar panel): run live Material 3 mini-app faces directly on desktop (via @moumantai/sdui-web), create or revise mini-apps with + Create Mini-App and Edit with Agent, chat with each app's isolated agent, open 1-click pairing windows, approve pending Phone / Watch / PWA / ESP32 devices, manage capabilities & secrets, and install from registries.
  • Right Sidebar Live Simulator: dock an interactive Phone (EXPANDED) + Round Watch (COMPACT) preview next to any DSH coding conversation while creating or editing a mini-app.
  • Bundled Authoring Skill & Tools: every DSH coding session gets the build-moumantai-app skill plus moumantai_list_apps, moumantai_link_app, moumantai_inspect_face, and moumantai_approve_app.
  • Zero Session Conflict, Shared Config: Moumantai boots its mini-app session store ($DSH_HOME/moumantai/sessions), agent loop, and per-app presets inside a dedicated child Cordis Context (mmt-agent-realm, with its own private event bus) and isolates its LAN device WebSocket and loopback admin API in dedicated webServer groups — while sharing your DSH LLM providers, credentials, default model, attachments, and optional local SenseVoice STT (dsh-experimental-voice-input-bundle).

Moumantai DSH Companion demo: describe a mini-app in DeepSeek Harness, use it in Mini-Apps Hub, and hot-reload docked Phone and Watch previews live
Build, use, and revise mini-apps live inside DeepSeek Harness — docked Phone & Watch previews hot-reload without losing your SQLite data.

Standalone Headless Profile (24/7 Server / Pi / LAN)

For an always-on headless daemon without DSH Web/Desktop, run Moumantai in its own profile composing @moumantai/dsh-kernel + @moumantai/dsh-plugin:

npx moumantai init --install   # profile "moumantai": manifest, presets, and `dsh plugin add` of both bundles
npx moumantai start

Nothing needs configuring twice. Everything you set up for DSH lives in $DSH_HOME, so standalone Moumantai picks up your .credentials.yaml, .env, and $DSH_HOME/cordis.patch.yml automatically.

Fresh install

1. Clone with the plugin-apps submodule and install the toolchain.

git clone --recurse-submodules https://github.com/xiang-deng/moumantai.git
cd moumantai
# Already cloned without --recurse-submodules? Run: git submodule update --init

Install mise (winget install jdx.mise · brew install mise · curl https://mise.run | sh), activate it in your shell (mise activate pwsh|bash|zsh), open a fresh shell, then:

mise install && uv sync   # Node 24.22, pnpm, Python 3.12, JDK 17, task, buf, uv
npm install               # links the TS workspaces (packages, pwa, protocol)
npm run build             # emits lib/ for every host package

2. Create the profile and a model credential.

npx moumantai init          # profile "moumantai" under $DSH_HOME (default ~/.dsh)
npx moumantai auth anthropic   # or set OPENCODE_API_KEY — see Model providers

init ends by printing which model routes have a credential and which model will actually run, and says so plainly when that model has none.

3. Start the host.

npx moumantai start

One host process per $DSH_HOME: the session log and the app databases are single-owner, and start enforces it — a second moumantai start against the same home exits 2 with the running host's pid. The device socket listens on 127.0.0.1:3000 by default (MOUMANTAI_HOST / MOUMANTAI_PORT, concrete IP literal — DSH forbids wildcard 0.0.0.0); the admin API is a separate listener bound to 127.0.0.1 on an OS-assigned port with a per-process bearer token, which is why admin commands need a running host.

4. Pair a client. Pairing is on by default — an unknown device is only recorded while an enrollment window is open, so an unattended host cannot collect junk rows from whatever is scanning the LAN.

npx moumantai device pair              # 5-minute window (--minutes N, or the mmt-devices setting)
npx moumantai device approve <code>    # the 4-character code on the device's own screen
npx moumantai device list

In another terminal, start the PWA and open http://localhost:5174:

task pwa:dev

5. Install an app and try it.

npx moumantai app install apps/spend-tracker
npx moumantai app list

Then in chat: add 5 dollars for coffee. The app's add_expense tool runs and the Summary face re-renders. Swipe up/down to switch faces within an app, left/right to switch apps.

[!NOTE] The device socket speaks the Moumantai wire protocol, not HTTP — opening http://localhost:3000 in a browser shows nothing. The PWA (or a native client) is the consumer. The same listener does answer two plain HTTP routes, GET/HEAD only (anything else is a 405 with Allow: GET, HEAD): /healthz, and /assets/<appId>/<file> for images an app cached.

Keeping the host running

moumantai start is a foreground process, exactly like the dsh --profile it spawns: it prints its readiness line, serves until it is stopped, and forwards SIGINT / SIGTERM to the host, exiting with the host's own code — 0 for SIGTERM after a graceful drain, 130 for Ctrl-C. There is no daemon mode and no moumantai stop; run it under the supervisor your OS already has and let that own restarts and logs.

  • Linux — a user systemd unit (~/.config/systemd/user/moumantai.service) with ExecStart=… moumantai start, Restart=on-failure, and loginctl enable-linger $USER so it survives logout. systemctl --user stop sends the SIGTERM the host already handles.
  • macOS — a launchd agent in ~/Library/LaunchAgents/ with RunAtLoad and KeepAlive; launchctl kickstart -k gui/$UID/… restarts it.
  • Windows — a Task Scheduler task triggered "at log on" running moumantai start, or a service wrapper (NSSM, WinSW) when it has to be up before anyone logs in.
  • Container — moumantai start as the entrypoint with $DSH_HOME on a volume; the container runtime's stop signal is the same SIGTERM.

Whatever runs it needs $DSH_HOME set the same way your shell has it, and the model credential reachable ($DSH_HOME/.credentials.yaml or the environment). For a device outside the LAN, put the socket behind Tailscale rather than opening the port — see Clients.

CLI reference

npx moumantai with no arguments prints the current surface. In short:

Command What
init [--companion] [--profile <p>] [--install] create a standalone Moumantai profile or attach the companion (--companion) to DSH web/desktop
start / dev run the host (dev also watches linked app checkouts)
auth <provider> [--method oauth|api-key] run a provider's login flow
app list | show <id> | install <src> | link <path> | update [<id>] manage installed apps (update with no id updates every app)
app approve <id> / app uninstall <id> [--purge] grant a staged app's capabilities / remove one — the app's data is kept unless --purge
app setup <id> type the secrets an app declares, one masked prompt each (App secrets)
app configure <id> [--set k=v]… [--set-json <obj>] edit an app's own settings against its author's schema (Per-app settings)
app search <query> [--from <r>] / app install <id> [--from <r>] / app list --from <r> find, install and browse apps in the configured registries
registry add <name> <url|path> [--ref <ref>] | list | remove <name> the configured app catalogs (App registries)
app cache-clear <id> [--yes] / db prune --older-than-days <N> [--yes] reclaim disk; both preview, then ask (Maintenance)
app migrate-gen <path> regenerate an app's Drizzle migrations
device list [--all] | pair | approve | revoke | forget | rename pairing and the device allowlist
device prune --older-than-days <N> | --unpaired | --all [--yes] drop device rows; asks before deleting
config show / config edit [--local] every namespace with the layer each value came from / open cordis.patch.yml in your editor (--local: no host needed)
workspace path [--local] · healthz inspect the running host (--local resolves the home without asking it)
import-v1 <v1-home> [--dry-run] [--force] bring v1 app data forward (--force re-imports over what v2 already has)

Everything but init, start, dev, auth, import-v1, app migrate-gen, workspace path --local and config edit --local goes through the loopback admin API, so it needs a running host.

Global flags: --profile <name> picks the profile for init / start / dev / auth / config edit --local; on an admin-backed command it is validate-only — there is only ever one host per $DSH_HOME, so the command refuses unless the name matches the running host's profile. --json prints machine output on success and on failure, where it is a single { "error": { "code", "message" } } line on stderr. Exit codes: 0 ok, 1 error, 2 host not running or bad usage.

Where your data lives

Everything is under the harness home, $DSH_HOME (default ~/.dsh):

$DSH_HOME/
├── profiles/<p>/            # the composed host: manifest, bundles, cordis.patch.yml (`moumantai config edit`)
│   ├── moumantai/apps.cordis.yml    # one row per installed app (Moumantai-owned)
│   └── .moumantai/builds/           # content-hashed app artifacts
├── moumantai/
│   ├── apps/<id>/db.sqlite  # each app's own database
│   ├── apps/<id>/assets/    # its upstream asset cache
│   ├── sessions/            # isolated mini-app chat transcripts (JSONL, separate from DSH coding sessions)
│   └── admin.json           # the running host's admin URL + token
├── storages/                # app settings, context, KV, devices, catalog
├── .credentials.yaml        # provider and app credentials (`moumantai auth`, `moumantai app setup`)
└── .env                     # optional: API keys the launcher reads before boot

npx moumantai workspace path prints the resolved home. Credentials stay on the host and are never sent to clients or plugin apps; prompts and relevant app context go to whichever model provider you configure.

[!IMPORTANT] Tap arguments are recorded. A UI action runs as the agent's own slash command with recordInput: true, so the values you type into a form or modal are written to the isolated mini-app session log in $DSH_HOME/moumantai/sessions/ alongside the chat transcript. That is deliberate — it is the audit record of what was asked for, and it is what lets the agent see an action you took by hand. Treat the session log as being as sensitive as the app data itself.

Maintenance

Nothing on the host expires an app's asset cache or a database backup on its own:

npx moumantai app cache-clear <id>            # empties moumantai/apps/<id>/assets
npx moumantai db prune --older-than-days 30   # old command receipts and db.<epochMs>.bak files

The asset cache is keyed by URL and never evicts, so an image that changed behind its URL keeps serving stale until this runs; clearing it under a running app is safe and the next request refetches. A db.<epochMs>.bak is the copy taken just before an app update — deleting one ends that rollback, which is why nothing else ever removes it. Both verbs print what would go and ask before deleting; --yes answers in advance, and --json on its own is a preview ("confirmed": false) that deletes nothing.

Configuration

Four kinds of configuration, four homes — whoever edits a value decides where it lives.

Kind Examples Home Edited with
Composition which rows compose the host, the bind address, the admin realm the profile's package.json + cordis.patch.yml moumantai init, then the profile's own patch layer
Operator knobs pairing, allowed origins, rate limits, the enrollment window, registries .volatile() row configs projected by dsh-settings in cordis.patch.yml moumantai config show / config edit
Secrets model credentials, an app's API keys $DSH_HOME/.credentials.yaml (0600), or the environment moumantai auth <provider>, moumantai app setup <id>
Per-app settings units, default view, thresholds Moumantai's app-settings store, against the app author's schema moumantai app configure <id>, a tool, or the agent

Operator knobs

Each knob resolves through three layers: the schema's default, the composition base (the config: block of the row that owns the knob), and the profile override (user) in $DSH_HOME/profiles/<p>/cordis.patch.yml, which wins. moumantai config show prints every namespace — Moumantai's first, then the harness's — with each key's value and the layer it came from; --json adds the raw descriptors.

$ npx moumantai config show
…
[mmt-device-server]  applies: live
  pairingRequired            true                      default
  allowedOrigins             []                        default
  rateLimit                  {"turnsPer30s":5,…}       default

moumantai config edit asks the host for the active profile's cordis.patch.yml and opens it in $VISUAL, then $EDITOR, falling back to notepad on Windows. With no terminal it prints the path instead of launching anything — moumantai config edit --json | jq -r .path is how a script finds the file — and --local resolves <profileDir>/cordis.patch.yml without a running host. The CLI never rewrites the YAML itself: your editor is the write path, @deepseek-ai/dsh-hmr watches the file, and a saved volatile edit is in force on the next handshake or tool call with no restart.

Row id (ns) Keys
mmt-device-server pairingRequired (default true), allowedOrigins, handshakeTimeoutMs, maxUnauthenticatedSockets, maxHelloBytes, maxPreAuthFrames, maxPreAuthBytes, and the five rateLimit budgets
mmt-devices defaultWindowMinutes (default 5) — how long device pair leaves the enrollment window open without --minutes
mmt-registry registries — the catalogs app search and app install <id> resolve against
# $DSH_HOME/profiles/moumantai/cordis.patch.yml
- id: mmt-device-server
  config:
    pairingRequired: false
    allowedOrigins: ['https://laptop.tailnet.ts.net']
- id: mmt-devices
  config:
    defaultWindowMinutes: 15

cordis.patch.yml holds knobs and registry locations only — never a secret value. Credentials live in .credentials.yaml; the profile patch at most names the environment variable one is read from.

App secrets and readiness

An app declares secret names (defineApp({ secrets })), and each resolves through the credential reference MOUMANTAI_<APP>_<NAME>. Readiness is recomputed on every read, so app list shows needs-setup in the STATE column — and app show names the exact references — until every one has a value:

npx moumantai app show weather      # lists what is missing, by reference name
npx moumantai app setup weather     # one prompt per missing secret, echo off

A value is typed at the prompt and never passed on the command line: it leaves the CLI once, in the body of a loopback POST to the host's own admin listener, and lands in $DSH_HOME/.credentials.yaml. Without a terminal app setup refuses and names both alternatives — export MOUMANTAI_<APP>_<NAME>, or add the line to that file yourself. Stored credentials in .credentials.yaml take precedence over ambient environment variables, and the host re-reads both, so neither needs a restart.

Per-app settings

moumantai app configure <id> edits the settings section an app's author declared (defineApp({ settings }), a Zod schema). On a terminal with no flags it prompts field by field, showing the current value and keeping it on Enter; off a terminal it prints the section and exits. --set key=value (repeatable, dotted keys reach nested objects) sets one field, --set-json '<object>' replaces the whole section, and every write is revalidated against the author's own schema — a rejection names the offending fields. A running app picks the new value up on its next tool call.

Settings reach tools and refresh workers; a face resolver has no settings handle, because a face reads data rather than configuration. settingsVersion in the manifest is metadata a client can compare — nothing migrates on it yet.

App registries

A registry is a registry.json at the root of a git repository or a local directory, listing apps by id. app install <id> resolves the id against the configured catalogs and hands pnpm a git specifier; nothing is cached, so a catalog is re-read every time it is used (which is why there is no registry update).

npx moumantai registry list
npx moumantai registry add local ./my-catalog     # or a GitHub URL / github:owner/repo, with --ref
npx moumantai app search tracker
npx moumantai app install spend-tracker           # --from <name|url|path> pins one catalog
npx moumantai app list --from local               # browse a catalog without installing

The example-apps repository ships configured out of the box. GitHub repositories and local directories are the two supported forms; any other host is refused as UNSUPPORTED_REGISTRY_URL. An id carried by more than one catalog is an error naming the candidates (--from disambiguates), and an entry whose sdk range excludes this host is refused before pnpm runs. A token no catalog carries falls through to pnpm as a package name — but a catalog that could not be read stops the install rather than falling through, so a network blip cannot turn app install notes into an npm package of the same name. The list itself lives on the mmt-registry row's volatile config, so registry add and an editor open on cordis.patch.yml are two doors onto one list.

[!IMPORTANT] Installing from a registry is the same trust decision as app install <git-url>: it is third-party code that runs in-process (see Plugin apps and SECURITY.md). Capability approval still gates what it may ask for.

Architecture

Moumantai is a host-authoritative application runtime, composed as three planes plus a shell.

Component Responsibility Boundary
Mini-app plane (packages/runtime) App rows, data planes, faces, refresh, capabilities, install, Home Never imports the agent plane; talks to it only through typed Cordis events
Agent plane (packages/dsh) Chat projection, per-app agents, delegation, tool adapter, synthesized tools, UI actions May read mini-app services; owns everything model-facing
Shell (packages/device-server) The device WebSocket, bootstrap and fan-out, pairing, the isolated admin realm Owns transport, not app data or model credentials
DSH Companion (packages/dsh-companion) DSH Desktop/Web Mini-Apps Hub, Phone/Watch simulator, authoring tools & bundled skill Additive layer over dsh-base + dsh-web-app + dsh-plugin
Web SDUI (packages/sdui-web) Canonical Material 3 Expressive web renderer & dynamic tonal palette runtime Shared by clients/pwa and packages/dsh-companion; zero host imports
SDK (packages/app-sdk) defineApp / defineTool / defineFace / defineRefreshTask, UI factories Imports nothing from any plane
Shared protocol (shared/protocol) Wire messages, the UI component vocabulary, generated TS/Kotlin/C bindings The stable contract between host and clients

The design follows a few strict boundaries:

  • Tools mutate; faces read; parameters steer presentation.
  • The host is authoritative; clients render and report intent.
  • Agents request actions; the host validates and executes them.
  • Device specialization happens on the host, outside plugin business logic.
  • Apps do not depend on a particular client, agent harness, or model.

Each package carries a spec.md with its public surface — start with packages/runtime/spec.md, packages/dsh/spec.md, packages/app-sdk/spec.md, and shared/protocol/spec.md.

Plugin apps

An app is a small TypeScript package: a Drizzle schema, defineTool tools, defineFace faces, and a package.json#moumantai manifest declaring its id, icon, capabilities, and SDK range. Example apps ship in the apps/ submodule.

npx moumantai app install <path|git-url>   # installs into the profile, builds, migrates, registers
npx moumantai app install <id>             # or by catalogued id — see App registries
npx moumantai app link <path>              # same, but keeps your checkout as the source
npx moumantai app approve <id>             # grant the capabilities it asked for
npx moumantai app migrate-gen <path>       # regenerate its drizzle/ migrations after a schema edit

app install and app update print the host's authoring warnings for the app on stderr — a face with only one size variant, and the like — while still reporting success on stdout, so --json output stays parseable.

An app that requests a capability it has not been granted installs as staged: its rows exist, its agent gets nothing extra, and nothing runs until you approve it. An app that declares a secret installs but reads needs-setup until app setup gives each declared reference a value.

Write or modify the TypeScript yourself, or drive it with a coding agent — inside DSH Desktop / Web click + Create Mini-App or Edit with Agent (which automatically uses the bundled build-moumantai-app skill, moumantai_link_app, and moumantai_inspect_face alongside the docked Phone/Watch live simulator), or from the CLI follow CLAUDE.md and validate with task apps:typecheck. For the component vocabulary, see the authoring reference.

Run npx moumantai dev instead of start (or set MOUMANTAI_DEV=1 with dsh web) to rebuild a linked app whenever its source changes and hot-swap it into the running host.

Model providers

The kernel routes model calls through pi-ai. The composition lives in packages/dsh-kernel/cordis.patch.yml, which is the source of truth for which routes exist.

Route Default model Credential
opencode-go (default, via pi-ai) deepseek-v4.1-flash OPENCODE_API_KEY
anthropic (via pi-ai) your choice npx moumantai auth anthropic — the provider's OAuth flow, so a Claude Pro/Max subscription works
deepseek (direct, the llm-deepseek row) your choice DEEPSEEK_API_KEY

The first two ride the llm-pi-ai row and are named by their pi-ai provider id; the third is DSH's direct DeepSeek row, which the credential report labels deepseek after the environment variable it reads.

API keys come from the environment. The dsh launcher also reads two .env layers before it boots, without overriding anything already exported: $DSH_HOME/.env (all profiles) and <cwd>/.env (the checkout you started from). $DSH_HOME/.env is the usual home for a key you want every profile to have.

auth owns no OAuth client of its own: it runs the provider's flow through the harness authorization seam, and the provider commits the record to $DSH_HOME/.credentials.yaml. It boots a kernel-only tree — no socket, no apps, no agent — so it is safe to run beside a live host. npx moumantai auth --list shows the registered flows, and npx moumantai init re-prints which routes are satisfied.

[!NOTE] The opencode-go route sends an x-opencode-session header, generated fresh for each host process by the kernel bundle. OpenCode Go routes by conversation and answers 400 MissingSessionID without it, and the pinned pi-ai does not send one of its own, so removing that header stops every turn on the default route. If you override the llm-pi-ai row in your own layer, restate it — a patch entry replaces the whole config. A message-less 400 from this route usually means the subscription is out of budget rather than misconfigured; the harness cannot tell those apart and reports it as a context-window error.

To change the default route, add a patch entry to your profile's own layer, $DSH_HOME/profiles/<p>/cordis.patch.yml (applied after every bundle):

- id: agent-default-model
  config:
    provider: anthropic
    model: claude-sonnet-4-5

A patch entry replaces the whole config of the row it names, so restate every key that row needs.

A model saved in DSH (an agent-default-model patch entry in your profile's cordis.patch.yml, or a legacy $DSH_HOME/settings.yaml before first boot) wins over the kernel default; npx moumantai init prints which model is in effect.

Clients

Clients are independent implementations of the shared protocol; each maps the same component vocabulary to the toolkit that fits its platform. All of them pair the same way.

Client Role Stack Run
PWA Universal browser and installable client; the quickest way to start React + Vite task pwa:dev (or task pwa:serve for the installable build)
Wear OS Glanceable interaction on a watch Kotlin + Wear Compose task wear-os:install
Embedded panel Ambient, always-on display ESP-IDF + LVGL (C) task esp32:build && task esp32:flash
Android phone Native phone client Kotlin + Compose M3 task android:install

Per-client setup: PWA · Android · Wear OS · ESP32. Native clients need per-machine paths — copy .mise.local.toml.example to .mise.local.toml and fill in ANDROID_HOME / IDF_PATH / PORT.

Because every app speaks the same typed protobuf wire and splits its faces by semantic size class (EXPANDED / COMPACT) plus voice-first Home chat, adding new form factors — smart glasses (HUD), e-ink desk displays, or ambient voice/car clients — requires only a thin client renderer, with zero changes to existing apps. On ESP32-S3, enabling CONFIG_MMT_DEBUG_SCREENSHOT=y exposes a local LVGL framebuffer capture endpoint (task esp32:screenshot IP=<board-ip>).

For a phone on another network, serve the PWA and the device socket over Tailscale:

task pwa:serve:tailscale TAILSCALE_HOST=<host>.<tailnet>.ts.net
tailscale serve --bg --https=443 http://localhost:4173
tailscale serve --bg --https=8443 http://localhost:3000

A plain http://<host>:<port> URL may be reachable but is not an installable secure context.

Upgrading from v1

v1 kept everything under ~/.moumantai/. import-v1 brings the app data forward into the harness home:

npx moumantai app install <each app you had>   # first: the row, preset and migrations must exist
npx moumantai import-v1 ~/.moumantai --dry-run # see the plan
npx moumantai import-v1 ~/.moumantai

Run it against a stopped host — it refuses otherwise, because the app databases and the storage domains are single-owner. It only imports apps present in both homes, is idempotent (an app whose v2 database already exists is left alone unless you pass --force), and copies:

v1 v2
apps/<id>/db.sqlite $DSH_HOME/moumantai/apps/<id>/db.sqlite
apps/<id>/config.json the settings storage domain, keyed by app id
apps/<id>/context.json the context storage domain
apps/<id>/assets/ $DSH_HOME/moumantai/apps/<id>/assets/

Three deliberate omissions:

  • Chat history is not imported. v1's platform.db holds conversations bound to SDK sessions that no longer exist; v2's transcript lives in the harness session store with a different shape. This is a clean break.
  • Secrets are not imported. v1 wrote them to a per-app .env; v2 resolves them through the credential store. The importer reports the file it found so you can move them deliberately.
  • cwd/ is not imported. It was a synthetic working directory for a coding agent v2 does not run this way.

[!WARNING] spend-tracker specifically: its 0001 migration drops the dead categories table and rebuilds expenses to make category nullable. On an imported v1 database that is destructive — anything you kept in categories is gone. Copy db.sqlite aside before installing spend-tracker if that table held something you want.

The authoring API also moved:

  • the app's identity lives in package.json#moumantai — there is no manifest.ts and no AppManifest;
  • imports are @moumantai/app and @moumantai/app/ui, not moumantai / moumantai/ui;
  • AppSpec.migrationsFolder is gone — migrations are read from the package's own drizzle/;
  • tool inputs are Zod schemas, and execute takes (ctx, args) rather than one { params, db } bag;
  • invokeTool(…, { escalationPrompt }) is now { askAgent };
  • v1's config is now settings;
  • there is no progress component — it is progressRing or progressBar;
  • every face size variant is its own entry in faces. A v2 artifact is one bundle, so nothing is discovered on disk — v1's .expanded.ts sibling no longer auto-loads. A size class with no variant falls back to the default entry, so a compact-only face still renders on a phone; it just renders the glance layout there.

apps/ shows all of it converted.

Host configuration moved too. v1's MOUMANTAI_PAIRING_REQUIRED no longer exists: pairing, the allowed origins, the pre-auth caps and the rate-limit budgets are .volatile() fields on the mmt-device-server row, resolved from the schema default through the row's config: block to your profile's cordis.patch.yml — see Operator knobs. MOUMANTAI_PORT stays, because the bind address is composition rather than a knob.

Develop

Every workspace exposes its commands through Task; task --list-all is the current inventory.

Run and verify

Command What it does
task host:build tsc -b — emit lib/ for every host package and the protocol
task host:typecheck type-check the test sources against the built declarations
task host:test build, then the vitest suite over packages/**/tests
task host:boundaries package-boundary guard (no DSH in the mini-app plane, no agent plane in runtime)
task host:graph bundle guard: required kernel/plugin rows present, dsh-base never layered
task host:composition boot the moumantai-test profile and assert every mmt-* loader row is ACTIVE (bar the two dev rows, which are declared disabled)
task host:pack-check tarball gate: no src/, tests or tsconfigs in a published package, no stale lib/
task host:wscat decode a running host's ServerMessage frames as JSON (protobuf wire debugging)
task e2e Playwright through a real host: install, pair, open, tap, chat (mock LLM), restart
task pwa:test PWA unit tests (task pwa:typecheck for types)
task apps:typecheck the example apps against the current SDK
task test-form-semantics / task test-layout-resolution cross-client form and layout conformance
task format / task format:check format every language / verify it without writing a file (the CI gate)

One GitHub workflow runs: format, which runs task format:check with the Android SDK asserted present so the Kotlin leg cannot silently skip itself into permanent green. Everything else is a local task gate — run the host gates (host:build, host:typecheck, host:test, host:boundaries, host:graph, host:composition), pwa:test, e2e, the protocol checklist in shared/protocol/CLAUDE.md, and host:install-check before pushing. They are not on GitHub because they need the private apps/ submodule (the real-app composition test and the E2E lane install from it), which the workflow token cannot clone.

Regenerate shared outputs

Source changed Regenerate Check for drift
Protocol .proto files task protocol:gen task protocol:gen-check
Design-system catalog task design-system:gen task design-system:gen-check
shared/tokens/*.yaml task tokens task lint:tokens
branding/icon.source.png task icons Review generated client assets
Client Taskfiles task registry task registry-check

Start with CLAUDE.md — codebase rules and workflow. Subsystem rules live in <dir>/CLAUDE.md files, auto-loaded by Claude when working in that subtree.

Repository layout

moumantai/
├── packages/
│   ├── app-sdk/        # @moumantai/app — the authoring SDK
│   ├── app-tools/      # esbuild artifact build, spec validation, migrate-gen
│   ├── runtime/        # mini-app plane: rows, data planes, faces, refresh, install
│   ├── dsh/            # agent plane: chat, agents, tools, UI actions, delegation
│   ├── device-server/  # shell: device socket, pairing, admin realm
│   ├── dsh-kernel/     # the standalone Cordis host-infrastructure kernel bundle
│   ├── dsh-plugin/     # composable Moumantai runtime bundle (child-Context agent realm + listeners)
│   ├── dsh-companion/  # DSH Desktop/Web companion bundle (Mini-Apps Hub, simulator, skill & tools)
│   ├── sdui-web/       # canonical Material 3 SDUI web renderer shared by PWA & DSH Companion
│   ├── cli/            # the `moumantai` command
│   ├── test-support/   # in-process boot of the moumantai-test profile (private)
│   ├── dsh-test-llm/   # scripted mock LLM adapter for tests (private)
│   ├── drafts/         # coding-agent draft worktrees (dev-only row)
│   └── voice/          # STT/TTS relay; mounted by the mmt-voice row in device-server/
├── clients/            # pwa/ · android/ · wear-os/ · esp32/
├── shared/
│   ├── protocol/       # wire protocol SSOT (.proto + generated TS/Kotlin/C)
│   └── tokens/         # design tokens (codegen targets each client)
├── apps/               # example plugin apps (submodule of moumantai-apps)
├── scripts/            # codegen + verification helpers
└── docs/               # architecture / design docs

packages/*, clients/pwa/, and shared/protocol/ are npm workspaces; the native clients each use their own build tool.

Troubleshooting

Common setup issues and fixes
Symptom Fix
task / uv / node not found after install You missed mise activate — add the printed line to your shell rc and open a fresh shell.
A command exits 2 with "the host is not running" Admin commands go through the loopback admin API. Start the host (npx moumantai start) in another terminal.
PWA will not connect / "pairing required" npx moumantai device pair, then device approve <code>. Turning pairing off (pairingRequired: false under moumantai-device-server in settings.yaml) admits every hello, so it is a localhost convenience, not a fix.
A browser page cannot open the device socket (403 on the upgrade) The socket refuses browser Origins it does not recognise. By default that means the same host the client already reached, or loopback on any port; add yours to allowedOrigins under moumantai-device-server (npx moumantai config edit) for anything else. Native clients send no Origin and are unaffected.
An app installs but never starts, or app list says needs-setup It declares a secret with no value. npx moumantai app show <id> names the references; npx moumantai app setup <id> fills them in.
app install <id> installed the wrong thing, or reports AMBIGUOUS_APP_ID The id is in more than one configured catalog, or in none (a token no catalog carries is passed to pnpm as a package name). npx moumantai registry list, then re-run with --from <name>.
moumantai start exits 2 with "already running" One host per $DSH_HOME. Stop the other one, or point this one at a different DSH_HOME.
moumantai app … exits 2 with a profile mismatch --profile on an admin command must name the profile the running host booted — there is only ever one. Drop the flag, or restart the host on that profile.
moumantai start fails on credentials npx moumantai init re-prints which model routes are satisfied; npx moumantai auth <provider> fixes it.
Port 3000 or 5174 already in use MOUMANTAI_PORT=<port> npx moumantai start, then VITE_WS_URL=ws://localhost:<port> task pwa:dev.
app migrate-gen says it could not load the schema The app's own dependencies are not installed. Run npm install (or pnpm install) in the app package and re-run.
app install fails with ERR_PNPM_IGNORED_BUILDS, or on better-sqlite3 pnpm refused a dependency's build script. npx moumantai init --profile <p> writes Moumantai's own answers back into the profile's pnpm-workspace.yaml; a package the error names that Moumantai does not know is yours to approve there, under allowBuilds (true to run its script, false to skip it).
An installed app never appears It is probably staged — npx moumantai app list shows what it asked for; app approve <id> promotes it.
Plugin apps missing entirely The submodule is empty — git submodule update --init.

Documentation

I want to… Start here
Configure a running host Configuration — knobs, secrets, per-app settings, registries
Follow the codebase workflow CLAUDE.md
Build a plugin app build-moumantai-app · examples
Understand a host package its spec.md — runtime · dsh · device-server · app-sdk · cli
Change the wire protocol shared/protocol/spec.md · shared/protocol/CLAUDE.md
Author or render UI components authoring reference · renderer reference
Set up a client PWA · Android · Wear OS · ESP32 · registry

Contributing

Contributions are welcome — including via coding agents. Start with CLAUDE.md, use the issue and PR templates under .github/, and follow the Code of Conduct.

Security

Found a vulnerability? Please report it privately — see SECURITY.md.

License

MIT

—/ 5

暂无评分

需要先验证清单

Commit d7cc656cd5be

社区评论

还没有评论,来写第一条。

DSH HUB

社区维护的 DSH 插件索引。不是 GitHub 或 DeepSeek AI 的官方产品。

社区资源API关于