Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (claude,codex): add dispatch-wiring tests; document Kimi argv/output tradeoffs + follow-ups
[._.]/ Adam Eivyb7448e5296d3
diff --git a/PLAN.md b/PLAN.mdindex 100ab035c0..da4a66f8f5 100644--- a/PLAN.md+++ b/PLAN.md@@ -247,3 +247,12 @@ Root cause: the theme rule at `client/src/index.css` (`html[data-port-theme] :is- [ ] **`MediaLightbox` — portal its `fixed inset-0 z-50 bg-black/90` overlay** (`client/src/components/media/MediaLightbox.jsx` ~line 229). Trappable when opened from inside a themed gallery card.- [ ] **`ProcessesTab` fullscreen log modal** (`client/src/components/apps/tabs/ProcessesTab.jsx` ~line 288). `fixed inset-0`, not portaled; rendered inside the app-detail tab tree — trappable if that content sits in a `.bg-port-card`.- [ ] **Lower priority:** `IconPicker.jsx` (~line 35) transparent click-away catcher (only the catcher shrinks to the card; popover itself is `absolute`), and `Review.jsx` (~line 431) briefing-fullscreen `<section>` toggle (element is itself `.bg-port-card`; depends on ancestors). Confirmed already-safe (no action): `CmdKSearch.jsx` (portaled), `Layout.jsx` mobile backdrop (shell-root sibling), `Ambient.jsx` / `Shell.jsx` (page-root fullscreen). Deferred from the FolderPicker mobile fix to keep that PR scoped to the picker the bug report named; each of these wants its own nesting check + portal-vs-z-elevation decision.++### Kimi Code provider — verify against a live `kimi` binary (issue-2815 follow-ups)++The `kimi-cli`/`kimi-tui` providers shipped without a live `kimi` binary in the dev environment, so the external-CLI contract is based on the issue's grounded docs, not empirical verification. Once a live `kimi` is installed, confirm and reconcile (raised in the issue-2815 codex review, deferred because they can't be validated blind and each risks regressing the happy path if guessed wrong):++- [ ] **Prompt delivery + argv length ceiling.** `server/lib/kimi.js#prepareKimiPrompt` delivers the prompt as the `--prompt <value>` argv (`useStdin:false`), matching the antigravity analog (`agy --print` takes the prompt as a VALUE, not stdin). A large CoS operating-contract prompt on argv can exceed Windows' ~32K command-line limit (and eventually POSIX `ARG_MAX`). If the live `kimi --print` reads the prompt from stdin — or from a `--prompt-file <path>` that can point at `/dev/stdin` like grok's `GROK_STDIN_PROMPT_PATH` — switch delivery to stdin to lift the cap. NOT done blind: guessing stdin against an agy-like `kimi` would silently deliver an empty prompt (worse than the ceiling).+- [ ] **Structured-output contamination.** If plain `kimi --print` interleaves intermediate tool/assistant activity with the final message, a pipeline stage parsing stdout as JSON could choke on the chatter. If the live `kimi` exposes a "final message only" flag, add it to `ensureKimiHeadlessArgs` in `server/lib/kimi.js`. NOT added blind: an unrecognized flag would make every headless run fail at startup.+- [ ] **Confirm the TUI auto-approve + print flags.** Verify `--yolo` (TUI auto-approve), `--print`/`--afk` (headless), and `--prompt`/`-p` (prompt value) are the real flag names, and that `--print` implies `--afk`. Adjust `ensureKimiTuiArgs`/`ensureKimiHeadlessArgs` if the CLI differs.+- [ ] **Kimi usage/quota family (out of scope of issue-2815).** Once the `kimi` usage command is confirmed, add a `FAMILIES` entry in `server/services/providerUsage.js` so the provider surfaces a quota card (currently maps to no family, like ollama-backed wrappers).diff --git a/server/lib/kimi.js b/server/lib/kimi.jsindex 4325a0c979..b5ee5afa23 100644--- a/server/lib/kimi.js+++ b/server/lib/kimi.js@@ -27,6 +27,23 @@* NOTE: `kimi` was not installed in the dev environment where this shipped, so the* argv-value prompt path (`--prompt <value>`, like `agy --print <value>`) was* chosen as the documented default and should be confirmed against a live binary.+ * Two follow-ups to reconcile once a live `kimi` is available (raised in review,+ * deferred because they can't be validated blind and both risk regressing the+ * happy path if guessed wrong):+ * 1. Argv length limits. A large CoS operating-contract prompt on the argv can+ * exceed Windows' ~32K command-line limit (and eventually POSIX ARG_MAX). If+ * the live `kimi --print` accepts the prompt from stdin (or from a+ * `--prompt-file <path>` that can point at `/dev/stdin`, as grok does), switch+ * this delivery to stdin to lift the cap. It is NOT switched now because the+ * antigravity analog (`agy --print`) takes the prompt as an argv VALUE and+ * does NOT read stdin at all — guessing stdin against an agy-like `kimi` would+ * silently deliver an empty prompt, a worse failure than the length ceiling.+ * 2. Structured-output contamination. If plain `--print` interleaves intermediate+ * tool/assistant activity with the final message, a pipeline stage that parses+ * stdout as JSON could choke on the chatter. If the live `kimi` exposes a+ * "final message only" flag, add it to `ensureKimiHeadlessArgs`. It is NOT+ * added now because passing a flag the binary doesn't recognize would make+ * every headless run fail at startup.*/import { commandBasename, hasModelFlag } from './providerModels.js';diff --git a/server/lib/tuiHandshake.test.js b/server/lib/tuiHandshake.test.jsindex d155fba7fa..8df66a10d1 100644--- a/server/lib/tuiHandshake.test.js+++ b/server/lib/tuiHandshake.test.js@@ -454,6 +454,8 @@ describe('tuiHandshake.inferTuiCommand', () => {['google-gemini-2', 'gemini'],['claude', 'claude'],['anthropic-claude-code', 'claude'],+ ['kimi-tui', 'kimi'],+ ['moonshot-kimi-2', 'kimi'],])('inferTuiCommand(%p) → %p', (id, expected) => {expect(inferTuiCommand(id)).toBe(expected);});@@ -525,6 +527,14 @@ describe('tuiHandshake.applyCommandDefaults', () => {const pinned = ['--permission-mode', 'auto'];expect(applyCommandDefaults('grok', pinned)).toEqual(['--permission-mode', 'auto']);});++ it('adds the Kimi TUI --yolo auto-approve and is idempotent when an approval posture is already pinned', () => {+ expect(applyCommandDefaults('kimi', [])).toEqual(['--yolo']);+ // Seeded default already carries --yolo — no duplicate.+ expect(applyCommandDefaults('kimi', ['--yolo'])).toEqual(['--yolo']);+ // A user-pinned posture (-y / --afk) is respected.+ expect(applyCommandDefaults('kimi', ['--afk'])).toEqual(['--afk']);+ });});describe('tuiHandshake.buildTuiInvocation', () => {@@ -566,6 +576,21 @@ describe('tuiHandshake.buildTuiInvocation', () => {expect(out.args).toEqual(['--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=false']);});+ it('builds the Kimi TUI with --yolo and no --model for the configured-default sentinel', () => {+ const provider = { id: 'kimi-tui', command: 'kimi', args: ['--yolo'] };+ const out = buildTuiInvocation(provider, 'kimi-configured-default');+ expect(out.command).toBe('kimi');+ // --yolo is already seeded; sentinel resolves to null so no --model is appended.+ expect(out.args).toEqual(['--yolo']);+ expect(out.args).not.toContain('--model');+ });++ it('appends --model for a concrete kimi model id', () => {+ const provider = { id: 'kimi-tui', command: 'kimi', args: ['--yolo'] };+ const out = buildTuiInvocation(provider, 'kimi-k2');+ expect(out.args).toEqual(['--yolo', '--model', 'kimi-k2']);+ });+it('appends --model when caller passes a model and provider.args has no model flag', () => {const provider = { id: 'claude', args: ['-p', '-'] };const out = buildTuiInvocation(provider, 'claude-opus-4-7');diff --git a/server/services/agentCliSpawning.test.js b/server/services/agentCliSpawning.test.jsindex 890aa7cd15..f78f548683 100644--- a/server/services/agentCliSpawning.test.js+++ b/server/services/agentCliSpawning.test.js@@ -256,6 +256,23 @@ describe('buildCliSpawnConfig', () => {expect(config.args).not.toContain('--append-system-prompt-file');});+ it('runs `kimi` headless with --print, no --model for the configured-default sentinel', () => {+ const config = buildCliSpawnConfig({ id: 'kimi-cli', command: 'kimi', args: ['--print'] }, 'kimi-configured-default');+ expect(config.command).toBe('kimi');+ expect(config.stdinMode).toBe('prompt');+ expect(config.args).toEqual(['--print']);+ expect(config.args).not.toContain('--model');+ // Kimi is non-Claude, so no claude-only flags leak in.+ expect(config.args).not.toContain('--dangerously-skip-permissions');+ expect(config.args).not.toContain('--append-system-prompt-file');+ });++ it('injects --model for a concrete kimi model id', () => {+ const config = buildCliSpawnConfig({ id: 'kimi-cli', command: 'kimi', args: ['--print'] }, 'kimi-k2');+ expect(config.command).toBe('kimi');+ expect(config.args).toEqual(['--print', '--model', 'kimi-k2']);+ });+it('adds lean-mode flags and the system-prompt file for an Ollama-backed claude CLI', () => {const config = buildCliSpawnConfig({ id: 'claude-ollama', command: 'claude', ollamaBacked: true },