summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
5 daysfix(system-prompt): reconstruct on cwd change via getWithMetaAdam Malczewski
The system-prompt service cached the resolved prompt on first turn and reused it on subsequent turns via get(). But the prompt is cwd-sensitive (file:AGENTS.md, prompt:cwd variables). When a conversation's cwd changed after the first turn, the cached prompt was stale — referenced files from the new cwd were not loaded. system-prompt: added getWithMeta(conversationId) returning { prompt, cwd } and stores resolved-cwd:<id> alongside resolved:<id> in construct(). session-orchestrator: subsequent turns now call getWithMeta, compare stored cwd vs effective cwd, and reconstruct if they differ. Compaction path (always constructs) and warm path (no system prompt) are unaffected. 1411 vitest pass; tsc + biome clean.
5 daysworkspace: conversation.open/statusChanged carry workspaceId (1405 vitest)Adam Malczewski
- @dispatch/transport-contract 0.18.0 -> 0.19.0: add workspaceId: string to ConversationOpenMessage and ConversationStatusChangedMessage - session-orchestrator: include persisted workspaceId in conversationOpened/ conversationStatusChanged payloads - transport-ws: forward workspaceId in WS broadcasts - transport-http: POST /conversations/:id/open resolves workspaceId before emit - FE handoff to 29ae: frontend-workspace-open-handoff.md
5 daysfeat(system-prompt): rich system:os with WSL detection + Linux distroAdam Malczewski
system:os now returns a descriptive string instead of the raw platform: - Linux: reads /etc/os-release for distro name (PRETTY_NAME or NAME+VERSION_ID) - WSL detection: checks /proc/sys/fs/binfmt_misc/WSLInterop or 'microsoft' in /proc/version — appends (WSL) to the distro string - Non-Linux: returns process.platform as-is (darwin, win32, etc.) Examples: 'Ubuntu 22.04 LTS', 'Ubuntu 22.04 LTS (WSL)', 'Debian 12', 'Linux (WSL)', 'darwin'. All file reads use injected fs adapters (testable). 7 new resolver tests. 1403 vitest pass. FE CR-9.
5 daysfeat(system-prompt): add prompt:workspace_id variableAdam Malczewski
Lets the AI know which workspace it's in — especially useful when summoning agents. Wired through the construct context in both the regular turn flow and the compaction flow.
6 daysdocs: system-prompt builder FE courier handoff + tasks.md updateAdam Malczewski
6 daysfeat(system-prompt): register extension in host-bin CORE_EXTENSIONSAdam Malczewski
Register @dispatch/system-prompt in CORE_EXTENSIONS (after skills, before cache-warming). Add dep + tsconfig ref. 1396 vitest pass, typecheck + biome clean.
6 daysfeat(system-prompt): wire into turn flow + compaction + API routesAdam Malczewski
session-orchestrator: - Wire systemPromptService as optional dep (lazy via host.getService) - Regular turn: construct on first turn (new conversation), get on subsequent turns, set on providerOpts.systemPrompt (cache-safe) - Compaction: construct (fresh resolve) + append COMPACTION_SYSTEM_PROMPT - 12 new tests (construct/get/service-unavailable/compaction) transport-http: - GET /system-prompt (returns template or DEFAULT_TEMPLATE) - PUT /system-prompt (validate + setTemplate, 503 when unavailable) - GET /system-prompt/variables (static catalog, always available) - 6 new tests system-prompt service: added getTemplate/setTemplate to interface + impl. 1396 vitest pass. typecheck + biome clean.
6 daysfeat(system-prompt): template-based system prompt builder extensionAdam Malczewski
New @dispatch/system-prompt extension (standard tier): - Pure parser: [type:name] variables, [if]/[else]/[endif] conditionals, negated [if !...], nested blocks, unmatched-tag pass-through. - Variable resolver (injected adapters): system:time/date/os/hostname, prompt:cwd/model/conversation_id, git:branch/status, file:<path> (dynamic). - Service handle: construct (resolve+persist) + get (cached, cache-safe). - Default template: persona + AGENTS.md if exists + cwd. - 52 tests (parser 29, resolver 12, catalog 3, service 8). transport-contract 0.17.0→0.18.0: SystemPromptTemplateResponse, SetSystemPromptTemplateRequest, SystemPromptVariable, SystemPromptVariablesResponse. Design: notes/system-prompt-design.md (caching constraint, compaction integration, wave plan). 1384 vitest pass.
6 daysfix(lsp): gate LSP endpoint on persisted cwd; accept workspaceId on PUT cwdAdam Malczewski
GET /conversations/:id/lsp was calling getEffectiveCwd directly, which falls through to serverDefaultCwd (process.cwd()) when no conversation cwd is set. Now gates on getCwd first: returns {cwd:null, servers:[]} when no cwd persisted; only resolves via getEffectiveCwd + calls lspService.status when a persisted cwd exists. PUT /conversations/:id/cwd now accepts optional workspaceId — validates with isValidWorkspaceSlug, then ensureWorkspace → setWorkspaceId → setCwd (assigns the workspace before persisting cwd, so getEffectiveCwd resolves relative cwds against the workspace defaultCwd, not the server default). transport-contract 0.16.0→0.17.0 (additive SetCwdRequest.workspaceId; LspStatusResponse.cwd comment updated). 1332 vitest pass.
6 daysdocs: mark workspaces live-verified + dist rebuilt for FEAdam Malczewski
6 daysdocs: update tasks.md — workspaces milestone DONEAdam Malczewski
6 daysfeat: workspaces — session-orchestrator + transport-http + transport-ws + ↵Adam Malczewski
cli (Wave 2+3) session-orchestrator: workspaceId on StartTurnInput/EnqueueInput; effective cwd resolution (getCwd → getEffectiveCwd); auto-create workspace on turn start; warm parity (same effective cwd). 93 tests (+8). transport-http: workspace routes (GET/PUT/DELETE /workspaces, title, default-cwd); workspaceId threading on POST /chat + queue; ?workspaceId= filter on GET /conversations; DELETE /conversations/:id/cwd (clears explicit cwd); GET /conversations/:id/lsp uses effective cwd; slug validation. 166 tests. transport-ws: workspaceId threading on chat.send + chat.queue. 32 tests. cli: --workspace/-w flag; ConversationMeta test fakes fixed. 123 tests. Full typecheck EXIT 0, biome clean. 1283 vitest + 199 transport bun pass (1 pre-existing tool-shell failure unrelated to workspaces).
6 daysfeat: workspaces contract + conversation-store implementation (Wave 0+1)Adam Malczewski
Wire 0.12.0: Workspace, WorkspaceEntry, ConversationMeta.workspaceId Transport-contract 0.16.0: workspaceId on ChatRequest/QueueRequest/ChatQueueMessage; workspace endpoint types (EnsureWorkspaceRequest, WorkspaceResponse, etc.) Kernel: re-export Workspace/WorkspaceEntry from contracts Conversation-store: workspace persistence + service methods (getWorkspace, ensureWorkspace, setWorkspaceTitle, setWorkspaceDefaultCwd, deleteWorkspace, listWorkspaces, getWorkspaceId, setWorkspaceId, getEffectiveCwd, isValidWorkspaceSlug); listConversations filter by workspaceId; forkHistory/replaceHistory preserve workspaceId. 111 tests pass. FE handoff: frontend-workspaces-handoff.md (courier doc) 18 typecheck errors in session-orchestrator/transport-http/cli test fakes (expected fan-out — fixed in Wave 2+3).
7 daysdocs: remove context window LIMIT from open items (DONE)Adam Malczewski
7 daysdocs: FE handoff for context window + percentage-based compactAdam Malczewski
7 daysfeat: context window from model endpoints + percentage-based auto-compactAdam Malczewski
ModelInfo (kernel contract): - Add contextWindow?: number field OpenAI-stream listModels: - Parse contextWindow from common field names (context_length, context_window, max_context_length, max_tokens) Transport-contract: - ModelsResponse: add optional modelInfo map (model name → { contextWindow? }) - Add ModelMetadata type - Rename CompactThresholdResponse → CompactPercentResponse - Rename SetCompactThresholdRequest → SetCompactPercentRequest Credential store: - Add getModelInfo(modelName) method — resolves full ModelInfo (including contextWindow) for a <credential>/<model> string Transport-http: - GET /models now includes modelInfo with contextWindow per model - Rename compact-threshold endpoints → compact-percent Session-orchestrator: - Auto-compact now uses contextSize (not overcounted usage.inputTokens) compared against contextWindow * (percent / 100) - Default percent: 85 (was flat 350000) - resolveModelInfo dep added to look up contextWindow - Passes modelName from the settled turn to the compaction service Conversation store: - Rename getCompactThreshold/setCompactThreshold → getCompactPercent/setCompactPercent - compactThresholdKey → compact-percent key
7 daysfeat: incremental seq assignment during generation (CR-6)Adam Malczewski
The backend now persists chunks at step boundaries during generation, not only at turn-seal. This enables the FE to syncTail mid-turn and pick up committed, seq'd chunks (eliminating the provisional state). Changes: - RunTurnInput: add onStepComplete callback (kernel contract) - runTurn: call onStepComplete after each step's messages are finalized - Orchestrator: persist userMsg at turn start + each step's messages via onStepComplete. Falls back to batch persist if callback isn't called (backward compatible with test fakes). The user message gets seq numbers before the first step generates. Each step's assistant + tool messages get seq numbers as they complete. The FE's existing syncTail (?sinceSeq=N) picks them up during generation. Also adds backend-to-fe-handoff.md with CR-6 response + full endpoint list.
7 daysfeat: stop generation mid-turn (POST /conversations/:id/stop)Adam Malczewski
Add stopTurn to the orchestrator: aborts the in-flight turn's AbortController without changing conversation status. The turn seals normally (finishReason: 'aborted'), partial messages are persisted, and the conversation transitions active → idle via the normal settle path. Distinct from closeConversation which marks the conversation closed. - POST /conversations/:id/stop endpoint - dispatch stop <id> CLI command - FE handoff: frontend-stop-generation-handoff.md
7 daysdocs: mark roadmap items 9 (tab persistence) + 10 (compacting) as DONEAdam Malczewski
Also adds bin/sync-env script for updating system env keys.
7 daysfix: compaction keeps original ID, forks old history to archive, chains via ↵Adam Malczewski
compactedFrom Reworked compaction to match the confirmed design: - The compacted conversation KEEPS its original ID (messaging between agents is unaffected — the ID never changes) - The old full history is forked to a new archive conversation (new UUID) - The archive inherits the source's compactedFrom, creating a chain: A → Y → X (walk compactedFrom backward) - A's history is replaced with [summary + recent N] - A.compactedFrom = archive ID forkHistory: inherit compactedFrom from source (not set to sourceId), so archives chain backward to previous archives. FE: no tab switching needed — the ID doesn't change. Just reload history.
7 daysdocs: update compaction handoff with compactedFrom linking + archive listingAdam Malczewski
8 daysfeat: non-destructive compaction — fork history to archive before replacingAdam Malczewski
Compaction now preserves the full pre-compaction history: 1. Forks the conversation to a new archive ID (complete copy: chunks, metadata, cwd, reasoning-effort). Archive gets status=closed, title='Archive: <original>', compactedFrom=<originalId>. 2. Replaces the original conversation's history with [system: summary] + recent N messages (same as before). 3. Sets compactedFrom=<archiveId> on the original conversation's metadata. The original history is never destroyed. The archive is accessible via GET /conversations/:id using the archive ID. Wire/contract changes: - ConversationMeta: add compactedFrom?: string - CompactionResult: add archiveId: string - ConversationCompactedMessage: add archiveId - CompactResponse: add archiveId Conversation store: - forkHistory(sourceId, targetId): copies all chunks + metadata to a new conversation ID - setCompactedFrom(conversationId, archiveId): marks the conversation
8 daysdocs: update compaction handoff with default 350k thresholdAdam Malczewski
8 daysfeat: default auto-compact threshold to 350k tokensAdam Malczewski
When no compact-threshold is explicitly set on a conversation, the default is 350000 tokens. Setting threshold to 0 explicitly disables auto-compact.
8 daysfeat: conversation compacting (manual + automatic)Adam Malczewski
Implement roadmap item 10: conversation compaction to reclaim context window without losing the thread. Wire (0.11.0): - Add CompactionResult type - Add ConversationCompactedMessage WS event Transport-contract (0.15.0): - Add CompactResponse, CompactThresholdResponse, SetCompactThresholdRequest - Add ConversationCompactedMessage to WsServerMessage union - Re-export CompactionResult Conversation-store: - replaceHistory: delete all chunks, reset seq, append new messages - getCompactThreshold / setCompactThreshold (per-conversation setting) - compactThresholdKey added to keys.ts Session-orchestrator: - CompactionService interface + compactionHandle - conversationCompacted hook descriptor - createCompactionService: load history, split old/recent, call provider to summarize, replaceHistory with [system: summary] + recent N - Auto-trigger: resolveCompaction lazy dep, fires after turn settles (checks threshold, non-blocking) - Hook declared in manifest contributes.hooks + services Transport-http: - POST /conversations/:id/compact (manual trigger) - GET /conversations/:id/compact-threshold (read setting) - PUT /conversations/:id/compact-threshold (set setting) Transport-ws: - Subscribe to conversationCompacted hook - Broadcast conversation.compacted WS message CLI: - dispatch compact <conversationId> command FE handoff: frontend-compaction-handoff.md
8 daysfeat: conversation lifecycle status (active/idle/closed) for tab persistenceAdam Malczewski
Implement roadmap item 9: tab persistence across devices. Wire (0.10.0): - Add ConversationStatus type (active | idle | closed) - Add status field to ConversationMeta Transport-contract (0.14.0): - Add conversation.statusChanged WS message to WsServerMessage union - Re-export ConversationStatus Conversation-store: - Track status in ConversationMetaRow (default: idle) - getConversationStatus / setConversationStatus methods - listConversations accepts { status: ConversationStatus[] } filter - Old meta rows without status default to idle on read Session-orchestrator: - conversationStatusChanged hook descriptor - Emit on transitions: idle→active (turn start), active→idle (turn settle), →closed (closeConversation) - Persist status to store as fire-and-forget side effect - Declare hook in manifest contributes.hooks Transport-ws: - Subscribe to conversationStatusChanged hook - Broadcast conversation.statusChanged WS message to all clients Transport-http: - GET /conversations?status=active,idle filter (parseStatusFilter pure helper) - POST /conversations/:id/close now sets status to closed CLI: - dispatch list defaults to active,idle (excludes closed) - --status <state> flag to filter by single status - --all flag to include closed FE handoff: frontend-conversation-lifecycle-handoff.md
8 daysdocs: CLI list defaults to active+idle, --all/--status flag for filteringAdam Malczewski
8 daysdocs: add tab persistence + conversation compacting to roadmapAdam Malczewski
Roadmap items 9 and 10: - Tab persistence: active/idle/closed conversation lifecycle status, restore tabs across devices on browser connect. - Compacting: automatic (token threshold setting) + manual (button click), summarize old history to reclaim context window.
8 daysfeat: remove CWD path containment from file toolsAdam Malczewski
read_file, write_file, and edit_file no longer restrict access to paths outside the working directory. The isPathWithinWorkdir prefix check and symlink hardening have been removed from all three tools. This allows agents to read and write files anywhere on the filesystem, not just within the per-turn cwd. The shell tool already had no such restriction.
8 daysfix(transport-http): stream /chat response instead of bufferingAdam Malczewski
The /chat endpoint was buffering the entire turn before returning the response, which meant X-Conversation-Id was not available until the turn finished. This prevented the CLI --open flag from firing until after the turn completed. Now the response is a ReadableStream that: - Returns X-Conversation-Id header immediately - Streams NDJSON events as they arrive from the orchestrator - Closes the stream when the turn completes (or errors) - Records throughput after stream close (non-blocking) This fixes: dispatch <model> --text '...' --open now opens the frontend tab immediately, not after the turn finishes.
8 daysfix(cli): fire --open signal before streaming starts, not afterAdam Malczewski
For both 'send' and 'chat' commands, the --open signal now fires immediately after the conversation ID is known (before stream consumption), so the frontend opens the tab right away instead of waiting for the turn to complete.
8 daysfeat(cli): add 'open' command to signal frontend without sending a messageAdam Malczewski
dispatch open <conversationId> broadcasts a conversation.open WS message to all connected frontend clients without sending any message. Useful after 'read' or 'send --queue' when you just want the frontend to open/focus a conversation's tab.
8 daysdocs: update cache-rate FE handoff for providers that don't report cacheAdam Malczewski
Distinguish 'provider doesn't report cache' (undefined → N/A) from 'provider reports 0 cache hits' (0 → genuine miss). Umans doesn't report cache tokens at all; showing 0% in that case is misleading.
8 daysfix(openai-stream): omit usage attrs from spans when provider doesn't reportAdam Malczewski
When a provider doesn't include a usage field in the SSE stream, the span attributes (usage.inputTokens, usage.outputTokens) are now absent instead of defaulting to 0. This makes it clear in the journal that the provider didn't report usage, rather than looking like 0 tokens were used.
8 daysfix(openai-stream): add stream_options.include_usage to all requestsAdam Malczewski
Without stream_options.include_usage, OpenAI-compatible providers omit the usage field from the SSE stream entirely. Umans returned 0 tokens for everything; OpenCode's proxy happened to include usage without it. Now both providers return proper prompt_tokens + completion_tokens. Note: Umans does not report cache_read_tokens or prompt_tokens_details.cached_tokens — cache hit rate will be 0% for Umans regardless. This is a provider limitation, not a parsing issue.
8 daysfeat(cli): add --open flag to model-name chat commandAdam Malczewski
dispatch <model> --text "..." --open now starts a new conversation AND signals the frontend to open the tab — no need for a separate 'dispatch send --open' step.
8 daysfix(install): write service file directly instead of sed (slashes broke it)Adam Malczewski
The sed substitution failed because the comment line contained '/' chars. Now writes the service file via heredoc with User=/Group= patched in. Also removes any previous masked service file first.
8 daysfeat(install): run dispatch service as user, not rootAdam Malczewski
systemd service: User= and Group= patched by bin/install from SUDO_USER. bin/setup-env: chowns data dirs to the real user. Since the service runs as the user, os.homedir() resolves correctly for skills discovery — no separate HOME env var needed.
8 daysfix(setup-env): set HOME so skills discovery works under systemdAdam Malczewski
The skills extension scans ~/.skills/ via os.homedir(). Under systemd as root, this resolves to /root — no skills there. setup-env now resolves the real user's home via SUDO_USER and writes HOME=<user home> to /etc/dispatch/env.
8 daysfix(transport-http): set Content-Type on static file responsesAdam Malczewski
Bun.file() returns an empty MIME type for .js files, causing the browser to reject module scripts with strict MIME checking. Added an explicit MIME type map for common static file extensions (.js, .css, .html, .svg, .woff2, etc.).
8 daysfeat: standalone build + systemd install (Arch Linux)Adam Malczewski
bin/build: compiles standalone binaries (dispatch-server + dispatch CLI) via bun build --compile, builds the frontend static bundle with VITE_HTTP_PORT=24991 + VITE_WS_PORT=24990, copies to dist/web/. bin/install: installs binaries to /usr/bin/, frontend to /usr/share/dispatch/web/, systemd service to /etc/systemd/system/, config to /etc/dispatch/env, data dirs to /var/lib/dispatch/ + /var/log/dispatch/. Enables + starts the dispatch systemd service. Supports --uninstall and --no-build flags. systemd/dispatch.service: Type=simple, reads /etc/dispatch/env, restarts on failure, logs to journald. systemd/dispatch.env: template config (ports 24991 HTTP + 24990 WS, DISPATCH_WEB_DIR, API key placeholder, data paths). transport-http: optional webDir static file serving — unmatched GET requests fall through to Bun.file() serving with SPA index.html fallback. Gated on DISPATCH_WEB_DIR env var (backward compatible).
8 daysfeat: standalone build + systemd install (Arch Linux)Adam Malczewski
bin/build: compiles standalone binaries (dispatch-server + dispatch CLI) via bun build --compile, builds the frontend static bundle with VITE_HTTP_PORT=24991 + VITE_WS_PORT=24990, copies to dist/web/. bin/install: installs binaries to /usr/bin/, frontend to /usr/share/dispatch/web/, systemd service to /etc/systemd/system/, config to /etc/dispatch/env, data dirs to /var/lib/dispatch/ + /var/log/dispatch/. Enables + starts the dispatch systemd service. Supports --uninstall and --no-build flags. systemd/dispatch.service: Type=simple, reads /etc/dispatch/env, restarts on failure, logs to journald. systemd/dispatch.env: template config (ports 24991 HTTP + 24990 WS, DISPATCH_WEB_DIR, API key, data paths). transport-http: optional webDir static file serving — unmatched GET requests fall through to Bun.file() serving with SPA index.html fallback. Gated on DISPATCH_WEB_DIR env var (backward compatible).
8 daysfeat(skills): recursive skill discovery — scan subdirectoriesAdam Malczewski
scanSkillsDir now recurses into subdirectories (e.g. ~/.skills/general/, ~/.skills/tech/), not just the top level. The load_skill execute path also searches recursively for the named .md file. Duplicate names are deduped (first found wins; top-level before nested). 42 tests pass.
8 daysdocs(tasks): CLI milestone done (roadmap items 2 + 4)Adam Malczewski
8 daysfeat(cli): list, read, send commands (Wave 3)Adam Malczewski
CLI gains three new sub-commands: - dispatch list [--server] — list conversations (short ID + title + activity) - dispatch read <id> [--server] — block until turn settles, print last AI message - dispatch send <id> --text [--queue] [--open] [--cwd] [--effort] [--server] - Default: blocking (consumes NDJSON stream, prints accumulated text + conv ID) - --queue: non-blocking (POST /conversations/:id/queue, exit immediately) - --open: signals frontend to open the conversation tab (POST /conversations/:id/open) Short-ID resolution: 4+ char prefix → GET /conversations?q= → resolve to full ID. 32+ char input is treated as a full UUID (no resolution). Errors on 0 or >1 matches. 48 new tests (108 total in cli). Pure arg parser + HTTP client functions, zero vi.mock.
8 daysfeat(transport): CLI endpoints + conversation.open broadcast (Wave 2)Adam Malczewski
transport-http: GET /conversations (list with ?q= prefix filter), GET /conversations/:id/last (blocks until turn settles, returns last AI text), POST /conversations/:id/open (emits conversationOpened hook), PUT /conversations/:id/title (set title). emit threaded from host.emit. extractLastAssistantText pure helper. 21 new tests (166 total). transport-ws: subscribes to conversationOpened hook, broadcasts ConversationOpenMessage to all connected WS clients. 2 new tests. session-orchestrator: conversationOpened hook descriptor (exported).
8 daysfeat(conversation-store): conversation metadata + list + title (Wave 1)Adam Malczewski
Implement listConversations(), getConversationMeta(), setConversationTitle() on the ConversationStore. Auto-track createdAt (first write), lastActivityAt (every append), and title (first user message, truncated 80 chars). A conv-index key tracks all conversation IDs. 21 new tests (81 total).
8 daysfeat(cli): Wave 0 — contracts for conversation list, last message, open tabAdam Malczewski
Additive contract changes for the CLI milestone (roadmap items 2 + 4): @dispatch/wire 0.8.0 → 0.9.0: - ConversationMeta { id, createdAt, lastActivityAt, title } @dispatch/transport-contract 0.12.0 → 0.13.0: - ConversationListResponse, LastMessageResponse, OpenConversationResponse - SetTitleRequest, TitleResponse - WS conversation.open broadcast (additive to WsServerMessage) ConversationStore interface: - listConversations(), getConversationMeta(), setConversationTitle() - Stub implementations in real store + 11 test fakes (Wave 1 fills in) Transport-http manifest: new routes declared (GET /conversations, GET /conversations/:id/last, POST /conversations/:id/open, PUT /conversations/:id/title)
8 daysrefactor(tool-youtube-transcript): always save full transcript, fix descriptionAdam Malczewski
- Always write the full transcript to /tmp/dispatch/youtube-transcribe/{video_id}.txt (not just on truncation) - Description no longer claims to return the full transcript; instead says it returns transcript text (truncated if very long) and the full version is always saved to the file path
8 daysfeat(tool-youtube-transcript): write full transcript to /tmp/dispatch on ↵Adam Malczewski
truncation When the formatted transcript exceeds the 50K char output cap, the tool now writes the full output to /tmp/dispatch/{video_id}.txt and returns the truncated output with a notice pointing to the file path. The writeFile dep is injectable so tests verify without touching the filesystem.