From 7c895b1c40a84ff7629a21dda5901365d3d6ca3c Mon Sep 17 00:00:00 2001 From: James Chapman Date: Thu, 26 Nov 2026 19:38:33 +0000 Subject: [PATCH 1/8] docs: match the guides to the code at 0.69.0 PRs #69 to #76 merged in parallel, so statements one change made were left stale by another. Correct them against the code: - Model tools: name the directory and web_fetch tools, the allow state, read and list approvals under prompt, the command tool's recorded-profile condition and profile_not_recorded answer, the 32 KiB write-tool argument limit, recoverable refused calls, and the ten-tool cap. - Providers: replace "no cloud adapter" and "only LM Studio reads a stored key" with hosted connections and ChatGPT sign-in, still unverified with a real key. - Desktop: 66 commands, 32 settings commands, the 2,048-model list limit, the CI build that has run, the per-session endpoint, and the right-hand panel's tabs. - Journals: list all 37 control-journal actions with their revision effect. - CLI: describe the three-state permission flags, defaults, web-host and actions commands, and current dependencies. - Plan: mark F1, S2, and 0.43.0 as merged and record PRs #69 to #76. - AGENTS.md: dev/ branch prefix, ADR-0068 link number, ADR-0104 summary. - Fix a broken checkpoint-folder anchor (ADR-0070). Documentation only; no code or version changed. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 7 +- CHANGELOG.md | 36 ++++++++ IMPLEMENTATION_PLAN.md | 118 +++++++++++++++----------- README.md | 126 +++++++++++++++++----------- crates/omgcode-desktop/ui/README.md | 27 ++++-- docs/README.md | 37 ++++---- docs/agent-instructions.md | 47 ++++++----- docs/context-management.md | 5 ++ docs/desktop-interface.md | 54 +++++++----- docs/development-tools.md | 13 ++- docs/development.md | 89 +++++++++++++------- docs/execution.md | 15 ++-- docs/file-access.md | 21 +++-- docs/platform-support.md | 6 +- docs/provider-authentication.md | 6 +- docs/security-coding-rules.md | 40 ++++++--- docs/session-storage.md | 24 ++++-- docs/testing-standards.md | 7 +- docs/workspace-permissions.md | 32 +++++-- 19 files changed, 463 insertions(+), 247 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index dc58dbf6..f6132b42 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -39,7 +39,7 @@ and a per-part estimate of the next turn's context A reply is labelled with the model from its turn's request manifest and can be copied as Markdown, as plain text, or as a PNG repainted on a canvas, through the clipboard only, with icon buttons named in their tooltips -([ADR-0069](docs/adr/0068-name-replies-by-model-and-copy-them-as-markdown-text-or-image.md)). +([ADR-0068](docs/adr/0068-name-replies-by-model-and-copy-them-as-markdown-text-or-image.md)). Chat offers the session's model read and list tools; when the workspace also enables `read` and `write`, six file-write tools (exact edit, multi-edit, create, rename, delete, and directory creation); and, when it also enables `execute`, `read`, and @@ -225,6 +225,9 @@ The `settings` window imports, enables, and removes skills and removes toolchain profiles, package-network profiles, and, on Windows, container grants, after native confirmations; none can be edited ([ADR-0088](docs/adr/0088-change-execution-settings-in-the-settings-window.md)). +A read-write container grant uses the workspace's recorded folder and opens +no folder dialog; core still checks that folder's identity +([ADR-0104](docs/adr/0104-grant-the-workspace-folder-read-write-without-a-folder-dialog.md)). It also proposes toolchain profiles for the installed Rust, C and C++, Java, Python, Perl, Go, Node.js, .NET, and Ruby toolchains from a core service that reads install folders, the operator's `PATH`, and installer-written files, @@ -297,7 +300,7 @@ the user's explicit authorization. - Inspect the current branch and local changes before editing. Preserve existing work and avoid unrelated changes. - Work on a feature or bug branch, never directly on `main`. Use the - `codex/` prefix for agent-created branches. Update a clean `main` from + `dev/` prefix for agent-created branches. Update a clean `main` from `origin` before creating a new branch from it. Preserve an in-progress feature branch rather than switching away from its work. - Main is protected by an active PR-only rule with no bypass actors. Publish diff --git a/CHANGELOG.md b/CHANGELOG.md index c0cc3db2..d625f401 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -365,6 +365,42 @@ Changes are recorded here before a release version is assigned. ### Fixed +- The guides now match the code at version 0.69.0. PRs #69 to #76 merged + in parallel, so statements one change made were left stale by another. + Documentation only; no code or version changed. + - Model tools: guides that said no model network tool exists, that every + write or command needs an approval, or that only read, list, edit, and + command tools exist now name the directory tool (ADR-0079), `web_fetch` + (ADR-0098), the `allow` state (ADR-0063), read and list approvals under + `prompt`, the recorded-profile condition and `profile_not_recorded` + answer of the command tool (ADR-0100), the 32 KiB argument limit of the + edit and multi-edit tools, and recoverable refused calls (ADR-0099). + Chat advertises at most ten tool names, not eight. + - Providers: statements that no cloud adapter or login exists and that + only the local LM Studio adapter reads a stored credential now cover + hosted connections (ADR-0092) and ChatGPT sign-in (ADR-0093). The + desktop guide gives the 120-second plan-route timeout and the 2,048-model, + 4 MiB model-list limits. + - Desktop: the guide counts 66 commands and 32 `settings` commands, lists + the create-directory review field and the six three-state preferences, + and no longer says the CI desktop build has not run. The frontend README + lists the Git, Processes, Web, and Context tabs, the footer's + provider, model, and effort choice, and the per-session endpoint, and the + root and documentation READMEs describe the `settings` window as + changing settings rather than read-only. + - CLI: the development guide describes the three-state `workspace + permissions` flags, their defaults and legacy `true`, the `web-host-*` + commands, `actions list`, and the current dependencies; the README lists + `models`, `approvals`, `actions`, `skills`, and `chat --reasoning-effort`. + - Journals: the control-journal action table lists all 37 actions, and + the session and context guides record `web_fetch`, `context.compacted`, + and the reasoning effort's place in the context estimate (ADR-0102). + - `IMPLEMENTATION_PLAN.md` marks Phases F1 and S2 and version 0.43.0 as + merged and records PRs #69 to #76. `AGENTS.md` names the `dev/` branch + prefix used since PR #72, links ADR-0068 under its own number, and + summarizes ADR-0104. A link to the checkpoint-folder section now uses + its ADR-0070 anchor. + - The CLI test `a_filtered_listing_is_truncated_when_newer_calls_fill_the_search_window` no longer fails now and then on Linux with `action journal: Busy`. It dropped the seeded action journal's writer and opened it again, and a diff --git a/IMPLEMENTATION_PLAN.md b/IMPLEMENTATION_PLAN.md index 256a55f2..ba4c063a 100644 --- a/IMPLEMENTATION_PLAN.md +++ b/IMPLEMENTATION_PLAN.md @@ -1,6 +1,7 @@ # OMGCode implementation plan -Last verified: 2026-11-18. +Last verified: 2026-11-26 (status lines checked against the code at version +0.69.0; the verification history below is unchanged). This guide is part of `main` after PR #9. Read it before selecting the next increment. Checkpoint preparation does not mean native replacement exists. @@ -123,21 +124,32 @@ This is a resume guide, not a replacement for the owning contracts in `packages fetch` (ADR-0056). - **Phase C19**, version **0.38.0**, the rename and delete model file tools (ADR-0055). -- **Phase F1**, version **0.39.0**, on branch `codex/runtime-skills`, not - merged: skill import into private storage, a registry with application and +- **Phase F1**, version **0.39.0**, from branch `codex/runtime-skills`, merged + to `main` (the trusted `skills` commands exist in the CLI): skill import into private storage, a registry with application and workspace enablement, and explicit `chat --skill` loading (ADR-0057). - **Phase S1**, version **0.40.0**: the isolated desktop `settings` window with a read-only configuration view, saved chat preferences, and per-turn skill selection in `main` (ADR-0059). -- **Phase S2**, version **0.41.0**, on branch `codex/desktop-settings-s2`, - not merged: the `settings` window changes the development root, workspace +- **Phase S2**, version **0.41.0**, from branch `codex/desktop-settings-s2`, + merged to `main`: the `settings` window changes the development root, workspace registrations, all six workspace preferences, and package cache roots through native dialogs, and creates the settings store on first use (ADR-0060). -- Version **0.43.0**, on branch `codex/permission-modes`, not merged: each +- Version **0.43.0**, from branch `codex/permission-modes`, merged to `main`: each preference is deny, prompt, or allow, with per-tool write limits; desktop turns wait for approvals and complete the approved call; every model tool call is recorded in the model action journal (ADR-0063). +- Merged on 2026-11-25 and 2026-11-26 (PRs #69 to #76, workspace version + **0.69.0**): ChatGPT plan tool turns (ADR-0097); a model `web_fetch` tool + behind a host allowlist (ADR-0098); recoverable rejected tool calls and + 32 KiB write-tool argument limits (ADR-0099); the command tool listing + recorded toolchain profiles (ADR-0100); movable section dividers + (ADR-0101); a per-session reasoning effort (ADR-0102); toolchain profile + discovery (ADR-0103) and a workspace folder read-write grant without a + folder dialog (ADR-0104); and the approvals window shown when a turn starts + waiting (ADR-0105). Earlier merges after PR #40, including hosted providers + (ADR-0092) and ChatGPT sign-in (ADR-0093), are not itemized here. The ADR + [register](docs/adr/index.md) lists them. Implemented today: @@ -155,10 +167,13 @@ Implemented today: - Conservative context accounting, manual `session compact`, and pre-turn auto-compaction for the local LM Studio route. Summaries are labelled untrusted evidence and follow the live tool-result replay rule (ADR-0041). -- Core turn/tool runtime for read/list, the approval-gated exact edit, - multi-edit, create, rename, and delete, and the approval-gated command through a caller-supplied model interface. It has strict tool-call parsing, round/call/byte/prompt limits, +- Core turn/tool runtime for read/list, the exact edit, + multi-edit, create, rename, delete, and directory-creation tools, the command + tool, and the gated `web_fetch` tool through a caller-supplied model + interface. Writes and commands are approval-gated unless set to `allow` + (ADR-0063). It has strict tool-call parsing, round/call/byte/prompt limits, cooperative cancellation, source-labelled messages, and fresh per-operation - policy bindings. Chat dispatches it through the LM Studio adapter for a + policy bindings. Chat dispatches it through the selected provider adapter for a workspace that enables `model_tools`. - Read-only `file diff`: trusted CLI preview of a broker-read file against complete proposed UTF-8 content. Exact digests, bounded one-hunk diff, no @@ -167,8 +182,8 @@ Implemented today: `chat --stream` and the desktop shell stream the reply as provisional text (ADR-0049). It is text-only unless the session's workspace enables `model_tools`; then it offers the read - and list tools, the approval-gated edit, multi-edit, create, rename, and - delete tools when `read` and `write` also allow it, and the approval-gated + and list tools, the edit, multi-edit, create, rename, delete, and + directory-creation tools when `read` and `write` also allow it, and the command tool when `execute`, `read`, and `write` also allow it. See @@ -234,20 +249,24 @@ Implemented today: - Provider profiles record connection shapes without credentials or adapters (ADR-0038). Trusted approval records bind a future model-tool call to a session, workspace, operation, request digest, and settings revision, expire, - and are consumed once (ADR-0039). Provider profiles enable no connection; the - command, edit, multi-edit, create, rename, and delete tools are the only model - tools that consume an approval record. + and are consumed once (ADR-0039). The command, file-write, and `web_fetch` + tools consume an approval record under a `prompt` preference, and so do the + read and list tools under a `prompt` read preference (ADR-0063). Under + `allow`, `web_fetch` still needs one for a host that is not on the + workspace's allowlist (ADR-0098). - Provider credentials in protected OS storage (ADR-0042): DPAPI files with verified private DACLs on Windows and Secret Service items in the default collection on Linux, with no plaintext fallback. Trusted `workspace provider-credential-set` reads an API key from standard input and binds a new opaque identifier to an `api_key` profile in the control journal; `provider-credential-remove` and `provider-profile-remove` unbind - and then delete the native item. Only the local LM Studio adapter reads a + and then delete the native item. The local LM Studio adapter first read a stored credential, through a selected `lm_studio` profile (ADR-0047). An `lm_studio` profile can record one endpoint, fixed for its life, and a - selected profile supplies both the endpoint and the token (ADR-0048). No - cloud adapter exists. + selected profile supplies both the endpoint and the token (ADR-0048). The + same client later gained hosted OpenAI-compatible profiles (ADR-0092), none + tested with a real key, and a ChatGPT sign-in whose tokens are kept in + protected storage (ADR-0093). No native provider API exists. - The `workspace_run_command` model tool (ADR-0040) is offered only with live `model_tools`, `execute`, `read`, and `write`. Its first call records a pending approval and starts nothing; an approved exact call consumes the @@ -300,21 +319,23 @@ Not implemented: cancellation of any request against a live provider. A read, list, or edit tool call in progress cannot be interrupted, and a CLI interrupt has not been delivered on Windows. -- A run network destination allowlist, most of the skills manager (see - Phase F), memories, mid-turn and +- A run network destination allowlist, skill scripts and automatic skill + selection (see Phase F), memories, mid-turn and provider-native compaction, and caches. Nothing calls the unconfined process runner. -- Desktop development panels (terminal tabs, task logs, and diffs), a settings - interface, a recovery interface, signed packages and installers, and a +- Desktop development panels (a working terminal, task logs, and diffs), a + recovery interface, signed packages and installers, and a Linux run of the desktop shell's windows. The prototype shell, session tree, - search, chat, and approvals window are on `main`. The only packaging is the + search, chat, approvals window, and `settings` window are on `main`. The only packaging is the unsigned rolling testing archives (ADR-0052). -- Cloud provider adapters and subscription/API-key login. Only the local LM - Studio adapter reads a stored credential, and only at the loopback endpoint - recorded with its profile. No endpoint rule exists for a non-loopback - provider, HTTPS, or certificates. -- Subscription token storage, token refresh, account lifecycle, and a - memory-only session credential. +- Release-qualified cloud provider connections, a native provider API, and + Claude subscription sign-in. Hosted OpenAI-compatible profiles with a stored + API key (ADR-0092) and a ChatGPT sign-in (ADR-0093) exist as prototypes; + hosted chat, stream, and tool-call shapes were not verified with a real key, + and ChatGPT plan use beyond one sign-in, model list, text turn, and two + read and list tool turns is unverified. +- Account lifecycle beyond ChatGPT sign-in and sign-out, and a memory-only + session credential. ## Resume steps @@ -331,12 +352,12 @@ Not implemented: ``` 2. Verify that the preceding phase's PR is merged. Every phase listed in the - current baseline is merged as of PR #40, except Phase F1. Preserve a feature branch while its + current baseline is merged to `main`. Preserve a feature branch while its PR is under review. Do not merge a PR without the user's authorization. 3. Re-read the owning contracts for the selected phase. Do not infer authority from this plan, prompts, journals, or model output. -4. Create a `codex/` branch from a clean, updated `main`. +4. Create a `dev/` branch from a clean, updated `main`. 5. Run the verification baseline before changing code. 6. Carry one bounded phase through implementation, tests, docs, changelog, and an ADR when the decision is lasting. Open a PR; do not merge it yourself. @@ -1071,10 +1092,9 @@ on Windows, and trusted CLI commands as the first caller. See Next decisions, not yet scheduled: -- cloud provider adapters, subscription/API-key login, token refresh, and - endpoint rules for non-loopback providers, HTTPS, and certificates (one - adapter, the local LM Studio route, now reads a stored credential, only at - its profile's loopback endpoint); +- qualifying the prototype hosted and ChatGPT connections against live + providers (ADR-0092, ADR-0093), a native provider API, and Claude + subscription sign-in; - model Git and MCP tools, and model network tools other than the gated `web_fetch` (ADR-0098); - development-server networking. @@ -1194,9 +1214,9 @@ login or entitlement route. non-streamed turn and a pre-turn compaction with no command change. Checked against local fixtures; the CLI interrupt was delivered on Linux only. -Still open in Phase D: cloud provider adapters, subscription and API-key -login, token refresh, account lifecycle, a memory-only session credential, -endpoint rules for non-loopback providers, HTTPS, and certificates, +Still open in Phase D: live qualification of the hosted (ADR-0092) and ChatGPT +(ADR-0093) prototypes, a native provider API, Claude subscription sign-in, a +memory-only session credential, qualification of the stream rules and of cancellation against a live LM Studio server, an interrupt delivered to the CLI on Windows, interrupting a read, list, or edit tool call in progress, and a longer deadline for long @@ -1264,23 +1284,26 @@ merged to `main` in PR #33 with Phases D2 to D6. development root, registrations, the six workspace preferences, and package cache roots. Rust opens native folder dialogs and confirmations through `rfd`, with no Tauri plugin. `settings_overview` creates an empty - settings store when none exists: 28 commands. Phases S3 to S5 (key entry, - the active connection, execution setup, and skills) are not implemented. + settings store when none exists: 28 commands. Later phases added key entry, + the active connection, execution setup, and skills to the `settings` window + (ADR-0082, ADR-0088), and the shell now has 66 commands (31 in `main`, 3 in + `approvals`, and 32 in `settings`). Still open for the desktop: - opening the shell's windows on Linux. It builds and its tests pass there, including the Unix-only inspection and index branches, but its webview, IPC, capability enforcement, and navigation guard have not run on Linux; -- development panels (terminal tabs, task logs, and diffs), and changing - connections, credentials, execution setup, and skills from the `settings` - window (ADR-0059 phases S3 to S5); +- development panels (a working terminal, task logs, and diffs); the + `settings` window changes connections, execution setup, and skills, but + credentials other than API keys and ChatGPT sign-in still change only through + the trusted CLI; - push for approvals and the session tree, which still poll or refresh on request, and a run of the event channel on Linux, where no window has been opened; - a recovery interface for an incomplete tail or a damaged journal, plus `session.archive_requested` stop-and-archive and storage-use display; -- Git, MCP, and memory interfaces, and skill management; +- Git, MCP, and memory interfaces; - a native confirmation dialog for approvals, which would remove the webview from the final decision; - signing and installers (Phase G); the unsigned testing archives of @@ -1300,7 +1323,7 @@ Version 0.26.0 implements the first compaction increment: conservative accounting, a visible meter, manual `session compact`, and pre-turn auto-compaction for the local LM Studio route. -- **F1 (version 0.39.0, branch `codex/runtime-skills`, not merged):** the first +- **F1 (version 0.39.0, branch `codex/runtime-skills`, merged):** the first skills increment (ADR-0057). The user chose import, the registry, and explicit chat loading; a maintained YAML parser (`saphyr-parser`, events only) with OMGCode validation; and copying every package file while never @@ -1336,8 +1359,9 @@ auto-compaction for the local LM Studio route. Mid-turn compaction after tool results, persisted settings, provider-native compaction, caches, MCP, and memories remain open. For skills, Git sources, versioned updates, session overrides, agent selection, resource loading, -script execution, desktop controls, and showing a request's skills in the -desktop transcript remain open. +script execution, and showing a request's skills in the desktop transcript +remain open. The desktop `settings` window imports, enables, and removes +skills (ADR-0082). ### Phase G: Git, platform qualification, packaging, and release @@ -1405,8 +1429,6 @@ release readiness remain open. commit, and time its workload outside OMGCode. - `.serena/` is untracked and unrelated. Do not commit or delete it without deciding what it is. -- The turn runtime is library/test infrastructure until a provider adapter and - an explicit tool-dispatch decision exist. - The edit preview is a snapshot, not a lock or an apply token. A later replacement must recheck content identity. - Native containment, Windows ACL hardening, directory power-loss durability, diff --git a/README.md b/README.md index 9a448073..e9ce4cb3 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,14 @@ OMGCode aims to connect language models to controlled development tools. The current code is an early Rust core and command-line prototype. A bounded native workspace file broker is available through trusted CLI commands. A core -turn/tool runtime and schema-v2 session format let chat offer the local LM Studio -model read, list, approval-gated edit, multi-edit, create, rename, delete, and -command tools, only for a workspace that enables `model_tools` and each tool's -own preferences. Git workflows remain planned. A prototype desktop shell (Tauri, with a strict TypeScript -frontend) browses and searches sessions, runs chat, and decides model-tool -approvals in a separate window; it has no installer and has run only on Windows. +turn/tool runtime and schema-v3 session format let chat offer the selected +model read, list, edit, multi-edit, create, rename, delete, directory-creation, +command, and `web_fetch` tools, only for a workspace that enables `model_tools` +and each tool's own preferences. Writes and commands need an approval unless the +operator sets them to `allow`. Git workflows remain planned. A prototype desktop shell (Tauri, with a strict TypeScript +frontend) browses and searches sessions, runs chat, changes trusted settings in +a separate window, and decides model-tool approvals in another; it has no +installer and has run only on Windows. The trusted CLI `run` command starts one program for a workspace whose `execute` preference is enabled. It uses an operator-declared toolchain profile, records each run in a run journal, and confines the process tree with @@ -23,20 +25,24 @@ directory grants. > workspace permission preferences, perform bounded workspace reads/listings, > create new files/directories through the trusted CLI, preview bounded diffs > against trusted proposed content, and send a chat request to -> an explicitly selected local LM Studio or Ollama model. `omgcode chat --stream` streams +> an explicitly selected model connection: a local LM Studio or Ollama server, a +> hosted provider with a stored API key, or a ChatGPT sign-in. `omgcode chat --stream` streams > that model's reply to standard error as provisional text. -> When a workspace enables the `model_tools` preference, chat lets the local +> When a workspace enables the `model_tools` preference, chat lets the > model read and list files inside that workspace through a bounded runtime. -> When `execute`, `read`, and `write` are also enabled, it offers a confined -> command tool that records a pending approval and runs only after the operator -> approves that exact call. When `read` and `write` are enabled, it offers an +> When `execute`, `read`, and `write` are also enabled and a toolchain profile +> is recorded for the platform, it offers a confined command tool. When `read` +> and `write` are enabled, it offers an > edit tool that replaces one exact text occurrence in an existing file, a > multi-edit tool that replaces up to 16 exact occurrences in one existing > file, a create tool that makes one new file, a rename tool that moves one file -> to a name that does not exist, and a delete tool that removes one file after -> a checkpoint of its bytes. Each records a pending approval and acts only after -> the operator approves that exact call and acknowledges that other writers are -> stopped; edits and deletions are applied through a checkpoint, and creation +> to a name that does not exist, a delete tool that removes one file after +> a checkpoint of its bytes, and a directory tool that creates one directory +> whose parent exists. A write or command whose preference is `prompt` records +> a pending approval and acts only after the operator approves that exact call +> (a write also needs the acknowledgement that other writers are +> stopped); one whose preference is `allow` runs without one. Edits and +> deletions are applied through a checkpoint, and creation, directory creation, > and renaming are not checkpointed. A `web_fetch` tool, off by default, reads > one public HTTPS page per call behind its own preference and a per-workspace > host allowlist. It has no other model network tool and no Git or MCP tools. @@ -59,15 +65,16 @@ directory grants. > declared origins into a private per-workspace cache. A selected cache root > is exposed read-only on Linux and Windows; Windows needs a read-execute > container grant, and Linux falls back to application storage when no root is -> selected. Provider profiles record connection shapes and enable no cloud -> adapter or login. Trusted single-use approval records authorize one exact +> selected. Provider profiles record connection shapes; hosted +> connections are prototypes that were not tested with a real key. Trusted +> single-use approval records authorize one exact > model-tool call; the trusted CLI or the desktop approvals window can decide > them. API keys can be stored in protected OS storage (DPAPI on Windows, the -> Secret Service on Linux) and bound to a profile. Only the local adapter -> reads one, through an operator-selected `lm_studio` profile -> (`--provider-profile`) that also supplies the endpoint; an `ollama_local` -> profile records an endpoint without a credential. The desktop `settings` -> window chooses between them from a dropdown. Runs have memory, +> Secret Service on Linux) and bound to a profile. The chat client reads one +> through an operator-selected profile (`--provider-profile`) that also +> supplies the endpoint; an `ollama_local` profile records an endpoint without +> a credential. The desktop `settings` window chooses the connection from a +> dropdown. Runs have memory, > process-count, CPU-time, and sampled disk-growth limits; the disk limit is > not a filesystem quota. See [command execution](docs/execution.md#tree-limits). @@ -110,13 +117,20 @@ frontend in `crates/omgcode-desktop/ui`. The CLI provides: - `session`: create, inspect, archive, restore, compact older active context, and explicitly interrupt an abandoned turn in a JSONL journal. - `chat`: send one user turn to an already-running LM Studio or Ollama server - at a literal loopback HTTP endpoint. It does not discover, start, or download models, and it + at a literal loopback HTTP endpoint, or through a selected hosted or ChatGPT + provider profile. It does not start or download models, and it rejects model tool requests unless the session's workspace enables `model_tools`. Then it offers read/list tools; when `read` and `write` are - also enabled, the approval-gated edit, multi-edit, create, rename, and delete - tools; and when `execute`, `read`, and - `write` are all enabled, the approval-gated command tool. Each is rechecked - against live settings before every call. + also enabled, the edit, multi-edit, create, rename, delete, and + directory-creation tools; and when `execute`, `read`, and + `write` are all enabled, the command tool. Writes and commands need an + approval unless set to `allow`. Each is rechecked against live settings + before every call. `--reasoning-effort` sets a reasoning effort for the session. +- `models`: list the models the selected server reports. +- `approvals` and `actions`: decide trusted per-call approvals, and list the + model action journal. +- `skills`: import, enable, inspect, and remove skills; `chat --skill` loads + one into a turn. Prompt assembly sends the compiled base in the system role. Optional user preferences and conversation history remain user or assistant messages. The @@ -129,12 +143,13 @@ The core also implements a session-owned turn/tool runtime and JSONL schema version 3. Schema version 3 adds readable, bounded context compaction; the original journal messages are retained, and the summary is labelled untrusted user-level evidence. That runtime accepts a caller-supplied model interface, validates -strict read/list/edit/command tool calls, creates a fresh workspace binding +strict tool calls, creates a fresh workspace binding before every file operation, and records tool intents, results, and -source-labelled messages. The edit and command tools additionally require a -consumed approval; an edit also needs the operator's writers-stopped -acknowledgement and writes only through checkpointed apply. `chat` runs it -with the local LM Studio adapter for a workspace that enables `model_tools`. +source-labelled messages. A write or command tool whose preference is `prompt` +additionally requires a consumed approval; a write also needs the operator's +writers-stopped acknowledgement, and an edit writes only through checkpointed +apply. `chat` runs it with the selected provider adapter for a workspace that +enables `model_tools`. It has no Git or MCP tool; its only network tool is the gated `web_fetch`. New sessions use schema version 3; version 1 and 2 journals remain readable and writable with their original subsets. @@ -145,9 +160,10 @@ chat that runs the same turn as `omgcode chat`, and an approvals window that shows an exact reviewed request before it lets the operator decide. The webview gets no authority: the Rust side authorizes every command, and no command accepts a host path. The webview is still not a trusted computing base. It has -no installer, development panels, or recovery interface, and it has not -been run on Linux. A separate `settings` window shows the trusted -configuration read-only; settings still change through the trusted CLI. Chat streams the local model's +no installer, working terminal, diff view, or recovery interface, and it has not +been run on Linux. A separate `settings` window shows and changes the trusted +configuration through native dialogs and confirmations; packages are fetched and +trusted runs start only through the CLI. Chat streams the local model's reply into the window by default (`--stream off` at launch disables it). The text is provisional, and the journal records only the validated reply. The shell pushes chat events to the main window through one caller-scoped channel @@ -182,17 +198,20 @@ checkpointed removal; and the rename tool uses a no-replace rename without a checkpoint. None detects a concurrent writer, and none is power-loss qualified. A deleted file is restored with trusted `file restore --removed`, which does not restore its mode or access list. -Model-dispatched process execution, Git, MCP, and memories remain planned. See the +Git, MCP, and memories remain planned. See the [workspace settings contract](docs/workspace-permissions.md), the [workspace file-access guide](docs/file-access.md), and the [development guide](docs/development.md) for limits and command details. The CLI stores provider API keys in operating-system protected storage through trusted `workspace provider-credential-set` and `provider-credential-remove` -commands (ADR-0042). Only the local LM Studio adapter reads one: with +commands (ADR-0042). The chat client reads one for a selected `lm_studio` or +hosted profile (ADR-0092), and a ChatGPT sign-in keeps its own tokens +(ADR-0093). With `--provider-profile `, `chat` and `session compact` (and the desktop shell, at launch) take the server token from the stored credential of that -`lm_studio` profile and do not read `OMGCODE_LM_TOKEN` (ADR-0047). A +profile and do not read +`OMGCODE_LM_TOKEN` (ADR-0047). A credential that cannot be read stops the turn. An `lm_studio` profile can record one loopback endpoint with `provider-profile-add --endpoint`, and a selected profile supplies both its endpoint and its token, so the stored token @@ -231,8 +250,8 @@ sends only the supplied message and saved chat history, not workspace files; earlier tool results are replaced by a withheld notice. If `model_tools` is enabled for `.`, the model can call the read and list tools. With `read` and `write` also enabled, which is the default, it can request an exact file edit; -with `execute` enabled as well it can request the command tool. Each edit or -command needs an operator approval. The file +with `execute` enabled as well it can request the command tool. Each write or +command needs an operator approval unless its preference is `allow`. The file contents it reads are sent to the local model. For Ollama, record a profile once and name it on each turn. Set the server's context length in Ollama (for example `OLLAMA_CONTEXT_LENGTH`), because this @@ -266,9 +285,10 @@ data upstream; check the server's configuration before sending sensitive text. host development data. Sessions will normally have read and write access to their active workspace within that root. Other host folders will be denied by default. -- **Sandboxed tools:** Extend the current bounded trusted-CLI file broker with - model-authorized file tools, terminals, and background tasks governed by the - same permission policy and enforced with operating-system controls. +- **Sandboxed tools:** Extend the current bounded trusted-CLI file broker and + approval-gated model file and command tools with terminals and background + tasks governed by the same permission policy and enforced with + operating-system controls. - **Git workflows:** Status, diffs, staging, commits, branches, worktrees, fetch, pull, and push, with controlled remote access and credential handling. - **Development panels:** Terminal tabs, background task status and logs, and @@ -294,7 +314,8 @@ data upstream; check the server's configuration before sending sensitive text. with scoped storage, invalidation, usage reporting, and clear controls. - **Skills settings:** Add, remove, enable, and disable versioned skill packages. Skills use the same permission policy and controlled tools as other work. - Trusted CLI commands do this today; the settings page is not implemented. + Trusted CLI commands and the desktop `settings` window import, enable, + disable, and remove skills today ([ADR-0082](docs/adr/0082-manage-skills-in-the-settings-window.md)). - **Project and global memories:** Save reusable facts or preferences with an explicit This project or Global choice. Review, edit, delete, or disable entries and control their use in each session. See [memories](docs/memories.md). @@ -343,7 +364,7 @@ explicit rather than being assumed to work identically across providers. - **Credential handling:** Operating-system credential storage, accessed through narrow services in the Rust core. -The desktop prototype uses a limited command interface to the Rust core: 19 +The desktop prototype uses a limited command interface to the Rust core: 66 commands, no host paths, and per-window permissions checked in Rust. Provider keys will stay out of frontend state, repository files, and task environments. @@ -353,7 +374,9 @@ OMGCode must work with projects in multiple languages. It will support user-selected installed tools and managed toolchain environments through a generic sandboxed runner. Tool profiles will include the required executable, runtime, library, and SDK resources, plus scoped writable build outputs, caches, -and temporary space. Version 0.16.0 profiles are declared by the operator. In +and temporary space. Profiles are declared by the operator, who can also select +proposals that the desktop `settings` window generates from installed +toolchains ([ADR-0103](docs/adr/0103-generate-toolchain-profiles-from-installed-toolchains.md)). In acceptance tests, Rust, Python, Node, C/C++, and Go workflows ran confined on Windows and Linux; Java has not run yet. @@ -407,8 +430,8 @@ cannot grant permissions. See [context management](docs/context-management.md) a 3. Prove Windows/Linux isolation, representative toolchains, and process cleanup. 4. Extend the Rust core and build the desktop interface, session tree, and remaining persistence and recovery workflows. The first desktop prototype - (session tree, search, chat, and approvals) is implemented; recovery, - settings, development panels, and packaging remain. Streaming of the local + (session tree, search, chat, approvals, and a settings window) is implemented; + recovery, development panels, and packaging remain. Streaming of the local model's reply is implemented for that adapter only (ADR-0049). 5. Expand provider adapters and add core-authorized tool workflows. 6. Add visible instructions, token accounting, compaction, safe caching, skills, @@ -423,9 +446,10 @@ cannot grant permissions. See [context management](docs/context-management.md) a Start with the [documentation index](docs/README.md). Contributors and coding agents must follow the [coding rules](docs/coding-rules.md) before code or test work. The [bundled skill source catalog](skills/README.md) contains source -packages. Version 0.39.0 can import a skill folder, enable it per application -or workspace, and load it into one chat turn with `chat --skill`; there is no -settings page, script execution, or automatic selection. See [skills](docs/skills.md). +packages. A skill folder can be imported, enabled per application or +workspace, and loaded into one chat turn with `chat --skill` or the desktop +`main` window; the `settings` window imports, enables, and removes skills. +There is no script execution or automatic selection. See [skills](docs/skills.md). ## Contributing diff --git a/crates/omgcode-desktop/ui/README.md b/crates/omgcode-desktop/ui/README.md index 8d5d10ff..c83628db 100644 --- a/crates/omgcode-desktop/ui/README.md +++ b/crates/omgcode-desktop/ui/README.md @@ -42,8 +42,10 @@ npm run tauri -- dev -- -- --data-dir ## Windows - `index.html` is the main window: session tree, search, transcript, composer, and a tabbed - right-hand panel (a Terminal tab that holds no terminal, and a names-only Files tab, ADR-0083). - Both side panels resize and collapse through the column separators in `src/main/layout.ts` + right-hand panel: a Terminal tab that holds no terminal, a names-only Files tab (ADR-0083), + and Git, Processes, Web, and Context tabs that read the open session only while visible + (ADR-0085 to ADR-0087, ADR-0098). The panel's footer holds the session's provider, model, and + reasoning effort choice (ADR-0089, ADR-0102). Both side panels resize and collapse through the column separators in `src/main/layout.ts` (ADR-0072). Every other section divider in the three windows moves through `src/ui/splitter.ts`. `src/ui/size_property.ts` is the only code that writes a style, for both (ADR-0101). @@ -52,19 +54,24 @@ npm run tauri -- dev -- -- --data-dir `approval_detail`. It renders no transcript text. - `settings.html` is the settings window: the trusted configuration, and controls that change the development root, workspaces, their preferences, and package cache roots (ADR-0059, - ADR-0060). Rust opens every folder dialog and confirmation; the window sends only identifiers + ADR-0060). Its **Model**, **Workspaces**, and **Advanced** sections also hold the model + connections, chat budgets and custom instructions, each workspace's web fetch hosts, toolchain + and package-network profiles with toolchain discovery, Windows container grants, and skills + (ADR-0064, ADR-0080, ADR-0082, ADR-0088, ADR-0098, ADR-0103). Rust opens every folder dialog and + confirmation; the window sends only identifiers and the revision. Only this entry imports `src/ipc/settings_client.ts`, so no other bundle contains a settings-window command. It renders no transcript text, tool output, or skill text, and it imports no main, approvals, or chat code. ## Theme and shared components -`src/styles/tokens.css` holds the one dark theme every window imports (ADR-0065). Keep each +`src/styles/tokens.css` holds the one dark theme every window imports (ADR-0065), in the OMG +Software palette (ADR-0095). Keep each colour token a six-digit hex value on its own line: `tests/tokens.test.ts` reads them and checks their contrast. Window stylesheets use the tokens and add no colours of their own. -`src/ui/` holds DOM-only components shared by the windows: `segmented.ts`, `tabs.ts`, -`popover.ts`, `splitter.ts`, and `size_property.ts`. They import no IPC code, so any bundle may -use them. +`src/ui/` holds DOM-only components shared by the windows: `icons.ts`, `segmented.ts`, +`tabs.ts`, `popover.ts`, `splitter.ts`, and `size_property.ts`. They import no IPC code, so any +bundle may use them. ## Rules @@ -90,8 +97,10 @@ use them. - All IPC goes through `src/ipc/client.ts`, the only file that imports `@tauri-apps/api`. Core error messages are shown as text. Client-side limits are usability only; the core validates everything. -- The model endpoint is fixed when the desktop process starts. The composer shows the value - from `chat_defaults` as read-only text and sends back exactly that value. +- The provider, endpoint, and model belong to the open session (ADR-0071). The composer shows + the session's endpoint from the shared connection as read-only text, falling back to the + launch default from `chat_defaults` until the connection arrives, and sends back exactly that + value. Rust re-checks the session's recorded endpoint on every turn. - The main window subscribes once with `chat_subscribe`, a Tauri channel. It reads `chat_status` once when a `finished` event arrives and keeps a five-second reconcile check while a turn runs, in case an event is lost. If subscribing fails, it polls `chat_status` diff --git a/docs/README.md b/docs/README.md index 47bc0eb1..e7540641 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,20 +5,22 @@ bounded native workspace file broker, and a prototype Tauri desktop shell with a session tree, search, chat, and an isolated approvals window. The shell is without an installer and has run only on Windows. The broker is available only through trusted operator commands and, when a workspace enables `model_tools`, to the -local model's read, list, approval-gated edit, multi-edit, create, rename, -delete, and command tools. The edit and multi-edit tools change one existing +selected model's read, list, edit, multi-edit, create, rename, delete, +directory-creation, and command tools. A write or command needs an approval +unless the operator sets its preference to `allow`. The edit and multi-edit +tools change one existing file only through checkpointed apply after an approved, writers-stopped decision; the create tool makes one new file through the exclusive create, without a checkpoint; the rename tool moves one file to a name that does not -exist, without a checkpoint; and the delete tool removes one file after a -checkpoint of its bytes. A `web_fetch` tool, behind its own preference and a +exist, without a checkpoint; the delete tool removes one file after a +checkpoint of its bytes; and the directory tool creates one directory whose +parent exists, without a checkpoint. A `web_fetch` tool, behind its own preference and a host allowlist, reads one public HTTPS page per call as untrusted web content. Other model network tools, and Git and MCP tools, are not implemented. The trusted CLI `run` command runs one program under Linux Landlock or Windows AppContainer confinement with an operator-declared toolchain profile. A model -tool starts a process only through the approval-gated command tool and the -trusted runner. The guides distinguish implemented behaviour from the +tool starts a process only through the command tool and the trusted runner. The guides distinguish implemented behaviour from the remaining product contracts. ## Start here @@ -98,9 +100,10 @@ Repository review and analysis are configured in the repository-checks guide. The Rust workflow adds formatting, strict Clippy, unit/integration tests, and separate documentation tests on Windows and Linux. The development guide owns the current commands and limits. The desktop frontend (`crates/omgcode-desktop/ui`) -has its own Frontend workflow with strict type checks, Biome, and Vitest; that -workflow and the Rust workflow's frontend build step have not run on GitHub -yet. The trusted `run` +has its own Frontend workflow with strict type checks, Biome, and Vitest. That +workflow and the Rust workflow, with its frontend build step, have run on +GitHub; the [repository-checks guide](repository-checks.md#rust-and-frontend-workflows) +records the runs. The trusted `run` command uses native confinement that was tested on one Windows build and one Linux kernel only. Every trusted run has memory, process-count, CPU-time, and sampled net disk-growth limits; the disk limit is not a filesystem quota. @@ -110,16 +113,18 @@ uses them, and network access remains all-or-nothing. The trusted cache. A selected root is exposed read-only on Linux and Windows; Windows needs a read-execute grant, and Linux falls back to application storage. Provider profiles record connection shapes without credentials, and an -`lm_studio` profile can record a loopback endpoint. Only the local LM Studio -adapter reads a stored credential, through an operator-selected profile that -supplies both the endpoint and the token (ADR-0047, ADR-0048); no cloud adapter -or login exists. That adapter can stream a reply (ADR-0049): the text is -provisional, and the journals record only the validated reply. Approval records authorize one exact +`lm_studio` profile can record a loopback endpoint. The chat client reads a +stored credential through an operator-selected profile that supplies both the +endpoint and the token (ADR-0047, ADR-0048). Hosted OpenAI-compatible +connections (ADR-0092) were not tested with a real key, and a ChatGPT sign-in +(ADR-0093) was observed with one real account; no native provider API or +Claude subscription login exists. The client can stream a reply (ADR-0049): +the text is provisional, and the journals record only the validated reply. Approval records authorize one exact model-tool call, and the read, list, file-write, command, and web fetch tools are their only consumers; the read and list tools need one only under a `prompt` read preference (ADR-0063). Chat dispatches the read/list tools and, -with the required live permissions, the approval-gated edit, multi-edit, -create, rename, delete, and command tools, and the `web_fetch` tool behind +with the required live permissions, the edit, multi-edit, create, rename, +delete, directory-creation, and command tools, and the `web_fetch` tool behind the live `web_fetch` preference, which needs an approval unless that preference is `allow` and the host is on the workspace's allowlist (ADR-0098), only for a workspace that enables `model_tools`. The edit and diff --git a/docs/agent-instructions.md b/docs/agent-instructions.md index 87877c88..a569c9a6 100644 --- a/docs/agent-instructions.md +++ b/docs/agent-instructions.md @@ -17,9 +17,10 @@ No prompt can guarantee that a model will ignore malicious instructions. The compiled base is prompt version 0.1.4. The Rust core embeds [`prompts/system.md`](../prompts/system.md), computes the SHA-256 digest from those compiled bytes, and exposes the text, version, and digest through the -`prompt` CLI command. Each current LM Studio chat request begins with those -exact compiled bytes as a system-role message. The adapter rejects a different -first message or another system-role message. +`prompt` CLI command. Each current chat request begins with those exact +compiled bytes as a system-role message. The adapter rejects a different first +message or another system-role message. The ChatGPT plan route, which refuses +`system` items, sends the same bytes as `instructions`. The `chat --instructions` option adds one labelled user-level preference message. The desktop shell builds the same message from the global custom @@ -31,8 +32,9 @@ roles assigned by the core. Text inside these messages cannot create another role or a tool call. The CLI stores the current request and assistant response in the session journal. It records the compiled prompt, version and digest, custom instruction text, model, base URL, and configured context/output budgets -in the request manifest. It does not record custom-instruction scope revisions, -skill/tool/memory selections, or an account profile. +in the request manifest. Selected skills (identity and digest only) and a +chosen reasoning effort are also recorded. It does not record +custom-instruction scope revisions, memory selections, or an account profile. The core turn/tool runtime records the exact tool schema version and tool names in a schema-version-2 request manifest. Its read/list results are appended as @@ -41,12 +43,15 @@ Completions sends each as `user` text. Within a turn, the ChatGPT plan route sends each as a `function_call_output` item after the model's own validated call, with the same labelled text ([ADR-0097](adr/0097-send-a-tool-result-as-its-call-and-output-on-the-plan-route.md)). Edit, -multi-edit, create, rename, delete, and command results follow the same rule -and remain untrusted. Chat runs this runtime when the workspace enables -`model_tools`; the edit, multi-edit, create, rename, and delete tools also need -`read` and `write`, the command tool also needs `execute`, `read`, and `write`, -and each runs only after a trusted approval. `web_fetch` needs only its own -`web_fetch` preference, and its result is labelled as untrusted web content +multi-edit, create, rename, delete, directory-creation, and command results +follow the same rule and remain untrusted. Chat runs this runtime when the +workspace enables `model_tools`; the edit, multi-edit, create, rename, delete, +and directory-creation tools also need `read` and `write`, the command tool +also needs `execute`, `read`, and `write` and a recorded toolchain profile +([ADR-0100](adr/0100-list-the-recorded-toolchain-profiles-in-the-command-tool.md)), +and each runs only after a trusted approval unless its preference is `allow`. +`web_fetch` needs `model_tools` and its own `web_fetch` preference, not `read`, +`write`, or `execute`, and its result is labelled as untrusted web content from the fetched host rather than workspace data ([ADR-0098](adr/0098-add-a-model-web-fetch-tool-behind-a-host-allowlist.md)). Otherwise chat sends no tool definitions and rejects any provider tool call. @@ -57,12 +62,13 @@ adapter applies a caller-supplied context budget using a byte-based estimate and fixed overhead. This is not an exact tokenizer or model-capacity check. The desktop shell's saved global and workspace instructions are the only saved instruction scopes; they have no revision history, and the CLI has no -preference store. The prototype has no session preference store, preview -UI, exact token-count display, memories, model -Git or MCP tools, or provider-specific subscription routes. -Its only model tools are read, list, the approval-gated exact edit, -multi-edit, create, rename, and delete tools, the approval-gated command -tool, and `web_fetch`, which reads one public HTTPS page per call behind its +preference store. The prototype has no session instruction store, preview +UI, exact token-count display (the desktop **Context** tab shows an estimate), +memories, model Git or MCP tools, or subscription route other than the ChatGPT +plan route (ADR-0093). +Its only model tools are read, list, the exact edit, +multi-edit, create, rename, delete, and directory-creation tools, the command +tool (each approval-gated unless its preference is `allow`), and `web_fetch`, which reads one public HTTPS page per call behind its own preference and a host allowlist (ADR-0098). The current `--instructions` value is per invocation, not a saved preference with scope or revision history. @@ -253,8 +259,11 @@ The current prototype records the compiled prompt text/version/digest, one per-invocation custom instruction string, the selected model and base URL, and caller-supplied context/output budgets. Schema version 2 runtime turns also record the tool schema version and exact tool names, plus separate tool intent -and result events. The prototype has no saved preference revision system or -records for skills, memories, tool-round counts, or account profiles. +and result events. Selected skills (identity and SHA-256 only) and a chosen +reasoning effort are also recorded +([ADR-0102](adr/0102-choose-a-reasoning-effort-per-session.md)). The prototype +has no saved preference revision system or records for memories, tool-round +counts, or account profiles. Edits apply to the next request. Clearly label a request already in flight. If an edit requires immediate effect, cancel and observe completion before restarting; diff --git a/docs/context-management.md b/docs/context-management.md index 52897d7f..f11c74b9 100644 --- a/docs/context-management.md +++ b/docs/context-management.md @@ -73,6 +73,11 @@ tool definitions, compaction summary, retained history, and fixed framing) from the same arithmetic as the pre-turn trigger, without a model request or a journal write. The view is the right-hand panel's **Context** tab ([ADR-0087](adr/0087-show-a-per-part-context-estimate-for-the-open-session.md)). +When the session records a reasoning effort, the fixed framing part and the +pre-turn estimate also count the bytes of the effort field the request will +send +([ADR-0102](adr/0102-choose-a-reasoning-effort-per-session.md)). Compaction +summary requests send no effort. ## Settings and accounting diff --git a/docs/desktop-interface.md b/docs/desktop-interface.md index 62053718..b58ebfdf 100644 --- a/docs/desktop-interface.md +++ b/docs/desktop-interface.md @@ -153,8 +153,9 @@ Not implemented: window manages skills (ADR-0082). Skill updates, Git sources, and the per-skill description and body view are not implemented. - A recovery interface for damaged journals or an incomplete tail. -- A provider API other than OpenAI-compatible Chat Completions, such as - Anthropic's native Messages API, and subscription sign-in. Stored API keys +- A provider API other than OpenAI-compatible Chat Completions and the + ChatGPT plan's Responses route (ADR-0093), such as Anthropic's native + Messages API, and any subscription sign-in other than ChatGPT. Stored API keys are used only for an LM Studio server's token and a hosted connection's key. The `main` window shows nothing about the credential source beyond the endpoint text and the hosted label. A model the server does not list, such @@ -167,8 +168,10 @@ the whole workspace, including this crate, compiled against WebKitGTK and passed formatting, Clippy, and every test on the same day. The Linux binary was started only far enough to check its launch arguments: no window has been opened on Linux, so the webview, IPC, capability enforcement, and navigation -guard are unverified there. The CI workflow changes have not run yet. See -[platform support](platform-support.md). +guard are unverified there. The CI workflows now build and test this crate on +Ubuntu and Windows Server 2025; that compiles and tests it but opens no +window ([repository checks](repository-checks.md#rust-and-frontend-workflows)). +See [platform support](platform-support.md). ## Architecture @@ -785,7 +788,8 @@ calls used, and calls requested. Calls from that batch are skipped. **Tool-enabled turn timeout (seconds)**, beside it, defaults to 120 and accepts whole numbers from 1 to 3600. The runtime checks the deadline between operations and excludes approval waits. -Each model request still has a 30-second timeout of its own. +Each model request still has a 30-second timeout of its own (120 seconds on +the ChatGPT plan route, ADR-0093). The settings window gets the maximum output reserve (4,294,967,295, the largest 32-bit count the request holds), tool-call, and timeout values from the overview's `chat` block, and refuses a value outside them before sending. @@ -1570,7 +1574,7 @@ The five change commands call the same `ControlStore` functions as the CLI's `clear-package-cache`. They use the same expected-revision check, validation, and audit events. Each takes only identifiers, the revision the window last read, and for `settings_set_permissions` the complete preference set: -`model_tools`, the five three-state preferences, and `write_tools`. None +`model_tools`, the six three-state preferences, and `write_tools`. None takes a path. Each returns the new overview. - **Folders come from a native dialog.** Rust opens the operating system's @@ -1812,12 +1816,15 @@ revision check and validation (ADR-0064, ADR-0071). ## Approvals A model tool call needs a trusted single-use approval when its effective -state is Prompt: the file-write tools (edit, multi-edit, create, rename, and -delete) and the command tool under the default `write` and `execute` state, -and, since 0.43.0, the read and list tools when `read` is Prompt +state is Prompt: the file-write tools (edit, multi-edit, create, rename, +delete, and create directory) and the command tool under the default `write` +and `execute` state, and, since 0.43.0, the read and list tools when `read` is +Prompt ([agent instructions](agent-instructions.md#approval-records), [deny, prompt, or allow](workspace-permissions.md#deny-prompt-or-allow-adr-0063)). -A call whose state is Allow needs none. The CLI +Since 0.64.0 (ADR-0098) the `web_fetch` tool needs one under Prompt, and under +Allow for a host that is not on the workspace's allowlist. A call whose state +is Allow needs none otherwise. The CLI commands `approvals list`, `show`, `approve`, and `deny` still work and remain the surface for headless use. The approvals window is a second surface for the same records. It adds no authority. Core still enforces single decisions, @@ -1924,6 +1931,7 @@ Reviewed fields: an edit distance of at most 2,000; past either bound it shows the two blocks and "Too large to compare line by line.". A create shows its content as added lines, or one block past 2,000 lines. +- **Create directory:** Directory (ADR-0079). - **Rename:** From, To, Size, and SHA-256 of the source. The review is stale once the source changed or the destination exists. - **Delete:** File, Size, and SHA-256. The review is stale once the file @@ -2029,8 +2037,8 @@ What the design does: - **Two enforcement layers.** Every command is declared to the Tauri build, so each needs an explicit permission in a capability file. The `main` file does - not grant the three approval commands or any of the twenty-four settings-window - commands. The `settings` file grants only those twenty-four. Every handler also calls the Rust + not grant the three approval commands or any of the thirty-two settings-window + commands. The `settings` file grants only those thirty-two. Every handler also calls the Rust window policy as its first statement. A capability file edited by mistake does not expose a decision to `main`. - **No `core:` permissions.** Neither window is granted any Tauri core @@ -2145,7 +2153,7 @@ What the design does: `src/ipc/chat_events.ts`, which only the main bundle imports, and a bundle test checks that no approvals asset contains it. - **The configuration view and changes only in `settings`.** The settings - window loads its own bundle. The twenty-four settings-window command names appear + window loads its own bundle. The thirty-two settings-window command names appear only in `src/ipc/settings_client.ts`. Bundle tests check that no main or approvals asset contains any of them, and that no settings asset contains `approval_decide`, `approval_detail`, or `chat_subscribe`. @@ -2223,7 +2231,7 @@ What it does not do: | Item | Value | | --- | --- | -| Commands | 56 | +| Commands | 66 | | Git status changed paths | 1,000, and a 10-second deadline | | Sessions per listing | 5,000 | | Search terms and length | 16 terms, 256 characters | @@ -2241,7 +2249,7 @@ What it does not do: | Message and instructions prefilter | 64 KiB each | | Skills selected per turn | 4 | | Saved model name | 256 bytes, no control characters | -| Listed models | 512 ids of at most 256 bytes, a 1 MiB body, a 10-second deadline | +| Listed models | 2,048 ids of at most 256 bytes, a 4 MiB body, a 10-second deadline | | Saved instructions | 64 KiB | | Chat preferences file | 512 KiB | | Review token lifetime | 120 seconds, single use | @@ -2422,9 +2430,12 @@ ACLs the private store refuses, see the notes in ## Known limits -- Only `lm_studio` profiles can record an endpoint, and the only rule is for - a literal loopback address over plain HTTP. No rule exists for a - non-loopback provider, HTTPS, or certificates, and no cloud adapter exists. +- A local profile (`lm_studio` or `ollama_local`) records only a literal + loopback address over plain HTTP. A hosted profile uses its kind's one fixed + HTTPS endpoint, or, for `openai_compatible`, a typed HTTPS address, and + needs a stored API key; an `openai` profile with `subscription` uses a + ChatGPT sign-in instead (ADR-0093). No hosted provider's chat, stream, or + tool-call shapes were verified with a real key. A profile recorded before 0.31.0 has no endpoint and cannot be selected until it is removed and added again with `--endpoint`. Any process running as the same user can read the stored credential. The Phase D2 and D3 @@ -2442,7 +2453,8 @@ ACLs the private store refuses, see the notes in - Not exercised: a live call that reaches the Rust `authorize` check. The real shell's windows were not driven again for 0.34.0; the service tests cover cancelling a non-streamed turn. -- The CI workflow changes for the shell have not run. +- The CI workflows build and test the shell on Ubuntu and Windows Server + 2025 but open no window there. - Phase S1 (0.40.0): the `settings` window, saved preferences, and skill selection were checked by unit, service, and bundle tests and in the Vite development server against the mock backend. The real shell's windows were @@ -2496,8 +2508,8 @@ ACLs the private store refuses, see the notes in unless the server sends them. Cancellation interrupts every model and compaction request but not a read, list, or edit tool call in progress, and the cancel path was checked against local fixtures only, with no live - server. The thirty-second request deadline - covers the whole response, so a long generation fails as before. While a turn runs, the transcript is not + server. The thirty-second request deadline (120 seconds on the ChatGPT plan + route) covers the whole response, so a long generation fails as before. While a turn runs, the transcript is not reloaded, so the message just sent is not shown above the live entry until the turn settles. - Opening a very large first index can take seconds, because each journal diff --git a/docs/development-tools.md b/docs/development-tools.md index 28d6a8ff..2413f525 100644 --- a/docs/development-tools.md +++ b/docs/development-tools.md @@ -24,10 +24,15 @@ Version 0.17.0 limits each run's memory, live processes, and CPU time; raise the [tree limits](execution.md#tree-limits) for large builds. On Linux the process limit counts threads, so a parallel compiler needs a higher limit than its process count. Version 0.19.0 adds a sampled limit on net disk growth -for the writable roots; it is not a filesystem quota. No -model tool runs project tools. A model command tool can request one only -through the trusted `run` path and a consumed approval. Tool support must be -qualified on the actual +for the writable roots; it is not a filesystem quota. The only model tool that +runs project tools is the command tool. It starts one only through the trusted +runner, under a recorded profile and with a consumed approval, or without one +where the operator set the workspace `execute` preference to `allow`. It is +offered only when a profile is recorded for the running platform, and it lists +those profile names; a call naming another profile is answered with +`profile_not_recorded` before any approval is requested +([ADR-0100](adr/0100-list-the-recorded-toolchain-profiles-in-the-command-tool.md)). +Tool support must be qualified on the actual platform; the [execution guide](execution.md#known-limits) lists the toolchains and versions that passed acceptance. diff --git a/docs/development.md b/docs/development.md index 5beb2f0d..4e81bfb8 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,6 +1,6 @@ # Build and run the core prototype -OMGCode 0.34.0 is a developer CLI prototype with workspace permission +OMGCode 0.69.0 is a developer CLI prototype with workspace permission settings and bounded native file operations through trusted operator commands. It can send a text conversation to an explicitly selected local LM Studio model and save that conversation. It can read/list files, exclusively create new @@ -26,7 +26,10 @@ delete workspace files, and the CLI cannot use Git or connect to MCP servers. When a workspace enables `model_tools`, chat lets the local model read and list files in that workspace, request an approval-gated exact edit, multi-edit, file creation, rename, or checkpointed deletion with read/write, and request an -approval-gated command with execute/read/write. A separate `web_fetch` +approval-gated command with execute/read/write once a toolchain profile is +recorded for the running platform +([ADR-0100](adr/0100-list-the-recorded-toolchain-profiles-in-the-command-tool.md)). +A separate `web_fetch` preference lets it fetch one public HTTPS page per call, with an approval for each fetch under `prompt` and for each host off the workspace allowlist under `allow` (ADR-0098). Other model network tools, and Git and MCP tools, @@ -141,7 +144,7 @@ omgcode --data-dir /private/omgcode-data file forget-checkpoint-store \ ``` The folder is left in place. Move, delete, or empty it before the next -write. See the [workspace checkpoint folder](file-access.md#workspace-checkpoint-folder-adr-0069). +write. See the [workspace checkpoint folder](file-access.md#workspace-checkpoint-folder-adr-0070). ## Build @@ -249,16 +252,27 @@ omgcode --data-dir C:\omgcode-data workspace unregister WORKSPACE_ID --revision require existing state. `unregister` removes a registration and its settings, deletes its saved desktop instructions, and touches no file in the folder; a container grant refuses it until it is revoked -([ADR-0081](adr/0081-unregister-a-workspace.md)). Flags take explicit `true` or `false` values. Read/write -default to enabled; execute, task-network, host-services, and model-tools -default to disabled. All decisions still report `execution_allowed: false`; -only the trusted `run` command starts a process, and the model command tool -reaches it only after consuming an approval. Settings commands do not dispatch +([ADR-0081](adr/0081-unregister-a-workspace.md)). The `--read`, `--write`, +`--execute`, `--task-network`, `--host-services`, and `--web-fetch` flags take +`deny`, `prompt`, or `allow`; `true` and `false` still work for the first five +(`true` means `prompt`, except for `--read`, where it means `allow`). The six +per-tool flags (`--edit-tool`, `--multi-edit-tool`, `--create-tool`, +`--rename-tool`, `--delete-tool`, `--create-directory-tool`) take only those +three words and can only narrow `--write`. `--model-tools` takes `true` or +`false`. New workspaces allow `read`, prompt for `write`, and deny `execute`, +`task-network`, `host-services`, `web-fetch`, and `model-tools`. All decisions +still report `execution_allowed: false`; only the trusted `run` command starts +a process, and the model command tool reaches it after a consumed approval +under `prompt`, or without one under `allow`. Settings commands do not dispatch tools. `--model-tools true` lets chat offer the model read/list tools, with -read/write the approval-gated edit, multi-edit, and create tools, and with -execute/read/write the -approval-gated command tool; see -[model tools](workspace-permissions.md#model-readlist-and-command-tools). +read/write the approval-gated edit, multi-edit, create, rename, delete, and +create-directory tools, with execute/read/write the command tool when a +toolchain profile is recorded for the platform, and with `--web-fetch` other +than `deny` the `web_fetch` tool. `web-host-add`, `web-host-remove`, and +`web-host-list` manage the workspace's allowlist of at most 32 host patterns, +which lets `--web-fetch allow` skip the approval for those hosts +([ADR-0098](adr/0098-add-a-model-web-fetch-tool-behind-a-host-allowlist.md)). +See [model tools](workspace-permissions.md#model-readlist-and-command-tools). See the [workspace contract](workspace-permissions.md) for limits and failures. `container-grant` and `container-revoke` work on Windows only. They change ACLs for the workspace's AppContainer and record each change; see @@ -614,7 +628,7 @@ trusted application-data directory, and the workspace ID. The runtime: `workspace_list_directory`, `workspace_edit_file`, `workspace_multi_edit_file`, `workspace_create_file`, `workspace_rename_file`, `workspace_delete_file`, - `workspace_create_directory`, and `workspace_run_command`; + `workspace_create_directory`, `workspace_run_command`, and `web_fetch`; - answers a call that has the supported shape and a usable, unique call identifier but names an unknown tool, carries arguments over the tool's limit, malformed or unknown-field arguments, or an absolute or parent path, @@ -644,10 +658,14 @@ trusted application-data directory, and the workspace ID. The runtime: - offers `workspace_edit_file`, `workspace_multi_edit_file`, `workspace_create_file`, `workspace_rename_file`, `workspace_delete_file`, and `workspace_create_directory` only under live `model_tools`, `read`, and - `write`, and `workspace_run_command` only when `execute` is also enabled; + `write`, and `workspace_run_command` only when `execute` is also enabled and + at least one toolchain profile is recorded for the running platform, with + those profile names listed in its `profile` parameter (ADR-0100); every edit, multi-edit, creation, rename, deletion, or command first needs a trusted single-use approval while its preference is `prompt`, and runs without one under `allow`; +- offers `web_fetch` under live `model_tools` and a `web_fetch` preference + other than `deny`, whatever `read`, `write`, and `execute` say (ADR-0098); - reports the final reply's provider `finish_reason`. The runtime has no Git or MCP tool, and its only network tool is `web_fetch`, @@ -658,7 +676,10 @@ through the exclusive create, the rename through the no-replace rename, the deletion through the checkpointed removal, and the creation of one directory whose parent exists. Its only process execution is the command through the trusted runner. Each needs an approval under `prompt` and runs without one -under `allow`. +under `allow`. Every call, executed or refused, is recorded in the model action +journal. `omgcode actions list` shows the newest records, with `--limit` +(1 to 1000, default 100), `--session`, and `--after-web-content` to select +calls made after the session's first fetched web content. `LocalToolModel` adapts the LM Studio client to its model interface. The adapter sends the tool definitions in the OpenAI-compatible `tools` field, parses the response with the strict duplicate-key-rejecting parser, and returns each call @@ -702,7 +723,11 @@ the approval-gated `workspace_edit_file`, `workspace_multi_edit_file`, `workspace_create_file`, `workspace_rename_file`, `workspace_delete_file`, and `workspace_create_directory`. When `execute`, `read`, and `write` -also allow it, it offers the approval-gated `workspace_run_command`. Set +also allow it and a toolchain profile is recorded for the running platform, it +offers the approval-gated `workspace_run_command`, whose `profile` parameter +lists those profiles; a call naming another profile gets `profile_not_recorded` +before any approval is requested (ADR-0100). When the workspace's `web_fetch` +preference is `prompt` or `allow`, it offers `web_fetch` (ADR-0098). Set `--max-tool-calls <1–256>` to override the default of 128 for this turn. A batch that would exceed the cap is refused before any of its calls run. The `tool_limit` error reports the configured cap, calls used, and calls requested. Start a new @@ -801,9 +826,11 @@ keys exists (see [provider credentials](#provider-credentials)). With `--provider-profile ` the adapter reads the token from a stored credential, and the endpoint from the same profile, and never reads the variable; the provider clients still -hold an unzeroed header copy. No cloud adapter and no account/settings -interface exists. Use the no-token profile only for -an explicitly selected service configured for it. +hold an unzeroed header copy. Hosted providers are reached only through +recorded profiles (ADR-0092), and ChatGPT sign-in is the only account login +(ADR-0093); no hosted provider's request shapes were verified with a real key. +Use the no-token profile only for an explicitly selected service configured for +it. ### Model edit workflow @@ -997,8 +1024,9 @@ further ordinary events require a new session. No history is removed to make roo The context guard estimates input from UTF-8 bytes plus fixed message overhead, then reserves the configured output tokens and headroom. This is a conservative heuristic, not a tokenizer or a guarantee for every chat template. The operator -must supply a validated loaded-model capacity. Compaction and automatic history -selection are not implemented: requests over a limit fail before inference. +must supply a validated loaded-model capacity. Without `--auto-compact` or +`session compact`, no history is dropped or selected: a request over a limit +fails before inference. Provider-reported usage and finish reason appear in the reply JSON. Durable usage events and large-output artifacts remain planned. Streamed chunks are not stored. @@ -1007,11 +1035,11 @@ not stored. | Crate | Responsibility | | --- | --- | -| omgcode-core | Compiled prompt, bounded model adapter, session/control/file-operation/run journals, lock-free journal inspection and discovery, the derived SQLite session index, approval review, workspace policy and toolchain profiles, broker orchestration, trusted runs, bounded turn/tool lifecycle, and non-destructive edit previews | +| omgcode-core | Compiled prompt, bounded model adapter, session/control/file-operation/run journals, lock-free journal inspection and discovery, the derived SQLite session index, approval review, workspace policy and toolchain profiles, discovery of installed toolchains for profile proposals (`toolchain_discovery`, ADR-0103), broker orchestration, trusted runs, bounded turn/tool lifecycle, and non-destructive edit previews | | omgcode-cli | Trusted operator input as a thin adapter over `omgcode-app`, bounded file and preview commands, trusted `run`, approvals, JSON output | -| omgcode-app | Front-end-neutral chat turn with optional read/list and approval-gated edit and command tools, session creation, compaction, the data-root resolver, token redaction, and `DesktopService`. It grants no authority | +| omgcode-app | Front-end-neutral chat turn with the model read/list, write, command, and `web_fetch` tools under their preferences, session creation, compaction, the data-root resolver, token redaction, and `DesktopService`. It grants no authority | | omgcode-desktop | The Tauri shell: windows, per-window capability files, the Rust window policy, command handlers, and the navigation guard. The TypeScript frontend is in `ui/` | -| omgcode-platform | Native journal validation, directory identity, opening an `https` sign-in address in the default browser (ADR-0094), handle-relative workspace file operations, Windows AppContainer grants, interrupt-to-cancel handling, and a process-tree runner with Linux Landlock/seccomp and Windows AppContainer confinement | +| omgcode-platform | Native journal validation, directory identity, opening an `https` sign-in address in the default browser (ADR-0094), handle-relative workspace file operations, Windows AppContainer grants, interrupt-to-cancel handling, a Windows foreground-window ownership check for the approvals window (ADR-0105), and a process-tree runner with Linux Landlock/seccomp and Windows AppContainer confinement | Core, CLI, application, and desktop crates forbid unsafe code through the workspace lint. Their dependencies, such as Tauri and SQLite, use it. The platform crate denies unsafe code except @@ -1062,10 +1090,15 @@ Direct dependencies have specific purposes: | time | UTC date layout and RFC 3339 formatting/parsing | | sha2 | Standard SHA-256 prompt digest; no custom cryptography | | thiserror | Typed component errors; derive macro runs during compilation | -| reqwest | Blocking HTTP client; default features disabled, no TLS backend or hosted execution used in this loopback-only increment | +| reqwest | HTTP client; default features disabled, with `json` and `native-tls` (the platform TLS stack). Used for loopback local models, hosted provider endpoints, ChatGPT sign-in, `packages fetch`, and `web_fetch` | +| tokio | `rt`, `time`, `net`, `fs`, and `io-util` only; the async runtime behind the HTTP client and its connection sockets | +| rsa, base64, getrandom, bytes | ChatGPT sign-in (ADR-0093): RS256 ID-token verification with a public key, base64url decoding, random state, nonce, and PKCE values, and a zeroed buffer for outgoing token forms. Default features disabled | +| saphyr-parser | Event-level YAML parser for skill frontmatter (ADR-0057); builds no value tree | +| zbus (Linux only) | Pinned to `=5.19.0`, the version `secret-service` uses, for raw Secret Service calls that refuse prompts (ADR-0042) | +| rfd (`omgcode-desktop`) | 0.17.2 with `gtk3` and default features disabled; native folder and confirmation dialogs that Rust opens for the `settings` window (ADR-0060). Adds no IPC command | | clap | CLI parsing and help; derive macro runs during compilation | | directories | Platform application-data location selection | -| windows-sys | Maintained Windows API bindings behind narrow reviewed wrappers for Win32/WDK Foundation and Storage/FileSystem, Security, DPAPI (`Win32_Security_Cryptography`), I/O handles, processes and jobs, and console control events | +| windows-sys | Maintained Windows API bindings behind narrow reviewed wrappers for Win32/WDK Foundation and Storage/FileSystem, Security, DPAPI (`Win32_Security_Cryptography`), I/O handles, processes and jobs, and console control events; the full feature list is in `crates/omgcode-platform/Cargo.toml` and includes window-message calls for the foreground-ownership check (ADR-0105) | | zeroize | Zeroes owned secret buffers on drop; `alloc` only, no derive macro | | secret-service (Linux only) | Freedesktop Secret Service client over pure-Rust zbus, with the tokio runtime and Rust AES/DH session crypto (`rt-tokio-crypto-rust`); its blocking API runs an internal tokio runtime | | rusqlite | 0.43.0 with `default-features = false` and `bundled`; SQLite 3.54.1 with FTS5 for the derived session index. MIT. Compiles SQLite's C amalgamation through `cc` at build time, so a C compiler is required. Uses `unsafe` internally; core uses only its safe API. Adds `libsqlite3-sys`, `fallible-iterator`, and `fallible-streaming-iterator` | @@ -1120,7 +1153,7 @@ cargo test -p omgcode-cli --test toolchain_acceptance --locked -- --ignored Do not infer whole-user/process containment, Git safety, same-user credential isolation, release filesystem support, or full coding-agent support from these tests. The broker supports bounded file operations through trusted CLI input and the core -turn runtime, which chat drives for read/list and an approval-gated command when -a workspace enables `model_tools`. Live provider tool-call compatibility and +turn runtime, which chat drives for the model's read/list, write, command, and +`web_fetch` tools when a workspace enables `model_tools`. Live provider tool-call compatibility and process containment remain separate boundaries. diff --git a/docs/execution.md b/docs/execution.md index 171e3808..752a10df 100644 --- a/docs/execution.md +++ b/docs/execution.md @@ -27,8 +27,10 @@ program through `run_confined` under a recorded [toolchain profile](#toolchain-profiles), behind the workspace `execute` preference, and records it in the [run journal](#run-journal). It is a trusted operator command. A model command tool can request one, but only a -trusted approval record lets it call the same runner; no model tool starts a -process without that record, and nothing calls the unconfined `run`. Settings +trusted approval record, or, since 0.43.0, the operator's `allow` state for +`execute`, `read`, and `write` (ADR-0063), lets it call the same runner; no +other model tool starts a process, and nothing calls the unconfined `run`. +Settings diagnostics keep `execution_allowed: false`, because a diagnostic never authorizes a run. Do not describe either confinement as qualified beyond the tested kernel and Windows build. @@ -775,7 +777,9 @@ The runtime checks the exact digest, session, workspace, operation, and settings revision, consumes the approval once, drops the settings lock, and calls the trusted `run` path. A denial returns `approval_denied` and is not re-requested. An expired or consumed record causes a new pending request. A -run that fails after consumption uses the approval. +run that fails after consumption uses the approval. In the desktop shell the +turn instead waits for the decision, and an approved call runs in the same +turn (ADR-0063). Output is untrusted and bounded. The session journal records the tool intent and result; the run journal records the run. No replay executes a recorded @@ -1246,8 +1250,9 @@ These remain true after C6: configuring a toolchain to use the directory is operator work. - **Model command limits.** The model command tool accepts no model-selected limits, network, or host services. It uses a 20-second deadline and 4 KiB - per output stream. The operator flow spans two turns, and the operator - decides in the CLI or in the desktop approvals window. A denied exact request stays denied for the current settings + per output stream. On the CLI the operator flow spans two turns; in the + desktop shell the turn waits. The operator decides in the CLI or in the + desktop approvals window. A denied exact request stays denied for the current settings revision; a failed run consumes the approval. A CLI acceptance test runs one approved command through the real chat process and the trusted runner on both hosts; it needs a delegated cgroup on Linux and a workspace container diff --git a/docs/file-access.md b/docs/file-access.md index cda087fe..c225a663 100644 --- a/docs/file-access.md +++ b/docs/file-access.md @@ -27,8 +27,11 @@ the [replacement contract](#replacement-contract). Trusted restore writes a retained checkpoint's original bytes back through that same apply path, and trusted checkpoint deletion removes one resolved private entry; see [Phase A4](#implemented-restore-and-checkpoint-deletion-phase-a4). A create -operation still refuses every existing entry. Workspace file deletion, -restore-as-create, recursive directory creation, and action replay are +operation still refuses every existing entry. Workspace file deletion exists +only as the checkpointed model delete tool +([ADR-0055](adr/0055-add-checkpointed-delete-and-no-replace-rename-model-tools.md)), +whose retained original the trusted `file restore --removed` writes back. +Restore-as-create, recursive directory creation, and action replay are unavailable. A content check followed by rename cannot guarantee no lost updates against independent writers. See [ADR-0013](adr/0013-enforce-file-access-with-native-handles-and-exclusive-creation.md). @@ -504,7 +507,8 @@ fresh binding, and reads the current file through the audited broker read, bounded to 1 MiB. Missing, repeated (counting overlaps), or unchanged `old_text` returns a recoverable `edit_no_match`, `edit_ambiguous`, or `edit_unchanged` result; a non-UTF-8 file returns `non_utf8`, and a result over -1 MiB returns `edit_too_large`. The handler then computes the proposed bytes +1 MiB returns `edit_too_large`. The call's argument JSON is at most 32 KiB +(ADR-0099). The handler then computes the proposed bytes and an approval digest under the domain tag `omgcode-file-edit-v1`. The digest covers length-prefixed fields for the session, the workspace, the normalized path, and the size and SHA-256 of both the current and the proposed bytes. @@ -545,7 +549,8 @@ so a record for one tool, including `workspace_edit_file`, can never be consumed by another. `workspace_multi_edit_file` takes a path and one to 16 `old_text`/`new_text` -pairs. It reads the live file through the audited broker (at most 1 MiB, UTF-8) +pairs, bounded by the same 32 KiB argument limit. It reads the live file +through the audited broker (at most 1 MiB, UTF-8) and matches every `old_text` against that original content: each must occur exactly once (`edit_no_match`, `edit_ambiguous`, naming the 1-based edit index), and the matched ranges must not overlap (`edit_overlap`). It applies the @@ -582,10 +587,10 @@ becomes stale once its path exists. Both tools are advertised and dispatched only under the same live `model_tools`, `read`, and `write` preferences as `workspace_edit_file`, with -the same per-call recheck and `edit_disabled` denial, in the order read, list, -edit, multi-edit, create, rename, delete, command (eight names, the existing -cap). Both use `file_write` approvals with the 900-second lifetime and the -writers-stopped acknowledgement, and the same lookup filters. Each has its own +the same per-call recheck and `edit_disabled` denial. Chat advertises at most +ten tool names: read, list, the six file-write tools, `web_fetch`, and the +command tool. Both use `file_write` approvals with the 900-second lifetime and +the writers-stopped acknowledgement, and the same lookup filters. Each has its own digest domain tag (`omgcode-file-rename-v1`, `omgcode-file-delete-v1`), so a record for one tool, including the three earlier file-write tools, can never be consumed by another. Both read the live source through the audited broker diff --git a/docs/platform-support.md b/docs/platform-support.md index 3e8e7964..4fd89e50 100644 --- a/docs/platform-support.md +++ b/docs/platform-support.md @@ -17,12 +17,12 @@ containment. | Rust edition and minimum version | Edition 2024; workspace `rust-version` is 1.99.1 | | Pinned development toolchain | Rust 1.99.1 in `rust-toolchain.toml`, with rustfmt and Clippy | | Webview and frontend prerequisites | Windows needs the WebView2 runtime. Linux needs the WebKitGTK 4.1 development packages to build ([Desktop shell](#desktop-shell)). The frontend build needs Node 24. No other version is qualified | -| Desktop shell | Prototype `omgcode-desktop`. Built, tested, and driven end to end on Windows 11 build 26300 with WebView2 on 2026-11-16. On WSL 6.6 (Ubuntu 24.04) it compiled against WebKitGTK and its tests passed, but no window has been opened on Linux. The CI change that compiles it there has not run. No installer; CI publishes testing archives | +| Desktop shell | Prototype `omgcode-desktop`. Built, tested, and driven end to end on Windows 11 build 26300 with WebView2 on 2026-11-16. On WSL 6.6 (Ubuntu 24.04) it compiled against WebKitGTK and its tests passed, but no window has been opened on Linux. CI builds and tests it on Ubuntu and Windows Server 2025 ([repository checks](repository-checks.md#rust-and-frontend-workflows)). No installer; CI publishes testing archives | | Session index | `rusqlite` with bundled SQLite 3.54.1, so a C compiler is required on every build host. Tested on Windows 11 build 26300 and WSL 6.6 only; the Linux run covered the Unix-only inspection branch and the link-refusal tests | | User-project toolchains | Required; native installed/managed profile matrix not yet qualified | | Workspace directory identity | Configuration-only metadata check; required native ID and creation time must be available | | Workspace file broker | Bounded read/list/exclusive-create/single-directory creation through trusted CLI commands; release filesystem support is not qualified | -| Model file tools | Read and list, plus approval-gated exact-edit, multi-edit, create, rename, and delete tools (with `read` and `write`) and an approval-gated command tool (with `execute`, `read`, and `write`), through chat for a workspace that enables `model_tools`. Each needs an approval with the writers-stopped acknowledgement. Edits, multi-edits, and deletions go through the checkpointed apply or removal on Linux ext4, btrfs, XFS, tmpfs, or ZFS or on Windows NTFS or ReFS (ADR-0069); a creation uses the broker's exclusive create and a rename the no-replace rename (Linux `renameat2` with `RENAME_NOREPLACE`, Windows POSIX-semantics rename without replace), neither with a checkpoint. A Linux removal is by name and a swap is detected afterwards; a Windows removal is by the verified handle. The Linux rename and removal paths are not qualified on a Linux host. General file tools are disabled and `workspace_file_tools` remains false | +| Model file tools | Read and list, plus exact-edit, multi-edit, create, rename, delete, and create-directory tools (with `read` and `write`) and a command tool (with `execute`, `read`, and `write`, when a toolchain profile is recorded for the platform), through chat for a workspace that enables `model_tools`. Each write or command call needs an approval where its preference is `prompt` (the default for `write`) and runs without one under `allow`; approving a write needs the writers-stopped acknowledgement. A separate `web_fetch` tool sends one HTTPS `GET` from the process, with an approval unless its preference is `allow` and the host is allowlisted (ADR-0098). Edits, multi-edits, and deletions go through the checkpointed apply or removal on Linux ext4, btrfs, XFS, tmpfs, or ZFS or on Windows NTFS or ReFS (ADR-0069); a creation uses the broker's exclusive create and a rename the no-replace rename (Linux `renameat2` with `RENAME_NOREPLACE`, Windows POSIX-semantics rename without replace), neither with a checkpoint. A Linux removal is by name and a swap is detected afterwards; a Windows removal is by the verified handle. The Linux rename and removal paths are not qualified on a Linux host. General file tools are disabled and `workspace_file_tools` remains false | | Process-tree runner | Called only by the trusted CLI `run`, through `run_confined`. Windows uses a Job Object assigned at creation and a per-workspace AppContainer. Linux uses a process group, seccomp, `close_range` (kernel 5.11 or later, x86_64 or aarch64), and Landlock ABI 3 or later. Tested on Windows 11 build 26300 and WSL 6.6 only ([execution](execution.md)) | | Tree limits | Every trusted run. Windows uses job memory and active-process limits and job CPU accounting. Linux needs a delegated cgroup v2 with `memory` and `pids` (Linux 5.14 or later for `cgroup.kill`), normally from a `systemd-run --user` scope, so it needs a user service manager. Disk growth is sampled by the supervisor on both platforms; it is not a filesystem quota. Tested on Windows 11 build 26300 and WSL 6.6 only ([tree limits](execution.md#tree-limits)) | | Package networking | Profiles are recorded on both platforms; no run accepts one, `--network` remains all-or-nothing, and no unprivileged destination filter exists on either platform. The trusted `packages fetch` command uses system TLS trust and a per-workspace cache root, and sends only a credential the operator bound to the matched origin (ADR-0056). The root is exposed read-only on Linux and Windows; Windows needs a read-execute container grant and traversable ancestors, and Linux falls back to application storage when no root is selected (ADR-0034, ADR-0035, ADR-0037) ([fetch](execution.md#trusted-package-fetch)) | @@ -40,7 +40,7 @@ prototype. See the [desktop interface guide](desktop-interface.md). | Platform | Prerequisites | Evidence | | --- | --- | --- | | Windows | WebView2 runtime, MSVC build tools, Node 24 | Built and driven end to end on Windows 11 build 26300 with WebView2 on 2026-11-16 | -| Linux | `libwebkit2gtk-4.1-dev`, `build-essential`, `curl`, `wget`, `file`, `libxdo-dev`, `libssl-dev`, `libayatana-appindicator3-dev`, `librsvg2-dev`, and Node 24 | Compiled and passed the crate's tests on WSL 6.6 (Ubuntu 24.04) on 2026-11-16, with the frontend bundle built on Windows because that host has Node 18. The binary was started only to check its launch arguments; no window has been opened on Linux. The Rust workflow installs these packages on Ubuntu 24.04, but that workflow change has not run | +| Linux | `libwebkit2gtk-4.1-dev`, `build-essential`, `curl`, `wget`, `file`, `libxdo-dev`, `libssl-dev`, `libayatana-appindicator3-dev`, `librsvg2-dev`, and Node 24 | Compiled and passed the crate's tests on WSL 6.6 (Ubuntu 24.04) on 2026-11-16, with the frontend bundle built on Windows because that host has Node 18. The binary was started only to check its launch arguments; no window has been opened on Linux. The Rust workflow installs these packages on Ubuntu and has run there ([repository checks](repository-checks.md#rust-and-frontend-workflows)) | Chat tools that start a process need a delegated cgroup v2 on Linux, as for `omgcode run` ([execution](execution.md#tree-limits)). The package list is the diff --git a/docs/provider-authentication.md b/docs/provider-authentication.md index 0b5ec13f..67d2cbf7 100644 --- a/docs/provider-authentication.md +++ b/docs/provider-authentication.md @@ -935,8 +935,10 @@ verifier values in the trusted authentication service. Store durable credentials in protected OS storage. Do not silently fall back to plaintext when that store is unavailable; offer an explicit memory-only session if appropriate. Version 0.27.0 implements that protected store for API keys (ADR-0042); since 0.30.0 -only the local LM Studio adapter reads it (ADR-0047), and since 0.31.0 only -at the endpoint recorded with its profile (ADR-0048). The prototype's +the local LM Studio adapter reads it (ADR-0047), and since 0.31.0 only at the +endpoint recorded with its profile (ADR-0048). Ollama Cloud (ADR-0071) and +every hosted kind (ADR-0092) read it the same way, and a ChatGPT sign-in keeps +its own token record (ADR-0093). The prototype's `OMGCODE_LM_TOKEN` process-environment input does not meet this credential-service requirement and must not be treated as its replacement. diff --git a/docs/security-coding-rules.md b/docs/security-coding-rules.md index feea39c4..f8b3c966 100644 --- a/docs/security-coding-rules.md +++ b/docs/security-coding-rules.md @@ -3,9 +3,11 @@ These rules define requirements for each implemented boundary. The CLI prototype has bounded prompt/provider/journal checks. It has trusted workspace settings and a bounded native file broker for manual commands. The core has a bounded -turn/tool runtime for read and list. Chat runs it with the local LM Studio -adapter only for a workspace whose `model_tools` preference is enabled; -otherwise chat rejects model-requested tools. A prototype desktop shell +turn/tool runtime for read and list, the write and command tools (approval-gated +unless the operator sets `allow`), and `web_fetch`. Chat runs it with the selected provider adapter only +for a workspace whose `model_tools` preference is enabled (`web_fetch` has its +own preference); otherwise chat rejects model-requested tools. A prototype +desktop shell (see the [desktop interface guide](desktop-interface.md)) renders session content in a webview, decides approvals in a separate window, and shows a read-only configuration view in a third; the rules below apply to it. Native confinement exists only for the trusted `run` command @@ -54,7 +56,8 @@ authorization. See endpoint; Rust records it only after a native confirmation that names the provider and endpoint, and a launch argument fixes it instead. The `settings` window may supply a loopback endpoint for a new local profile without a credential, - and core validates it. Refuse a `main` request whose endpoint differs from + or an HTTPS endpoint for an `openai_compatible` profile with a write-only + API key (ADR-0092), and core validates it. Refuse a `main` request whose endpoint differs from the one resolved for the turn (ADR-0064). - Show the trusted configuration view only in the `settings` window, which renders no transcript text, tool output, or skill description or body, and @@ -183,18 +186,20 @@ authorization. See The v0.3.0 native file broker currently exposes bounded read, list, exclusive-create, and single-directory creation through trusted CLI commands. -The v0.4.0 core turn runtime exposes only read and list to its caller-supplied -model interface. It validates strict tool schemas and limits, opens the control +The v0.4.0 core turn runtime exposed only read and list to its caller-supplied +model interface; later versions add the tools named below. It validates strict tool schemas and limits, opens the control store for each call, obtains a fresh binding, releases the settings lock before the next model request, and records tool intents and results as untrusted evidence. Its checks do not isolate hostile same-user processes or provide process containment. Since 0.12.0, chat drives this runtime when the session's workspace enables `model_tools`. Since 0.28.0 the model writes only through -approval-gated tools: the exact edit (ADR-0043), since 0.36.0 the multi-edit -and create tools (ADR-0054), and since 0.38.0 the rename and delete tools -(ADR-0055). General file tools remain disabled; capability output keeps -`workspace_file_tools` false. For model tools: +tools that need a trusted approval unless the operator set the preference to +`allow` (ADR-0063): the exact edit (ADR-0043), since 0.36.0 the multi-edit +and create tools (ADR-0054), since 0.38.0 the rename and delete tools +(ADR-0055), and the directory tool (ADR-0079). `web_fetch` (ADR-0098) is a +network tool under its own preference. General file tools remain disabled; +capability output keeps `workspace_file_tools` false. For model tools: - Check the live `model_tools` preference before each call, then let the broker check the operation preference. A journal only selects a registration; never @@ -359,8 +364,11 @@ crate. and uses only the broker's single-directory create after consuming it: no recursive creation, no replacement, and no retry. See ADR-0079. - The `workspace_run_command` model tool may be advertised only under live - `model_tools`, `execute`, `read`, and `write`. Its first call records a - pending approval and starts nothing; only a later exact call may consume an + `model_tools`, `execute`, `read`, and `write` and a recorded toolchain + profile for the platform; a call that names another profile is refused + before any approval (ADR-0100). Under `prompt` its first call records a + pending approval and starts nothing; only a later exact call (in the desktop + shell, the same call after the turn waits for the decision) may consume an approved record and call the trusted runner. The model cannot approve, select limits, select network or host services, or reuse an approval. It cannot ask the tool to compose or re-parse a shell command line; it may @@ -392,6 +400,9 @@ crate. Validate names, arguments, limits, session scope, and provider call identity. A provider adapter must parse provider JSON strictly; the core runtime then revalidates names, argument shape, paths, and bounds before any broker call. + A call with a usable identifier that fails this check is answered with a + recoverable result and recorded as refused; it dispatches nothing + ([ADR-0099](adr/0099-recover-from-rejected-tool-calls-and-raise-write-tool-argument-limits.md)). - Deduplicate calls within the correct request/session scope. After an ambiguous result, reconcile the operation instead of automatically executing it again. - Parse malformed, oversized, interrupted, and unsupported provider responses as @@ -469,6 +480,11 @@ crate. - Apply containment to build scripts, package hooks, test programs, code generators, language servers, and all descendants. Tool registration is not permission to run commands outside confinement. +- Toolchain profile discovery only proposes profiles. It runs no program, + reads no repository configuration such as `rust-toolchain.toml`, and grants + nothing; the operator selects proposals and confirms a native dialog before + core records them + ([ADR-0103](adr/0103-generate-toolchain-profiles-from-installed-toolchains.md)). - Separate toolchain installation/updates and package networking from ordinary execution. Do not make a host installation writable to an untrusted task. diff --git a/docs/session-storage.md b/docs/session-storage.md index 650d92df..6c9fa763 100644 --- a/docs/session-storage.md +++ b/docs/session-storage.md @@ -175,8 +175,8 @@ not rewritten. See [workspace settings](workspace-permissions.md). ### Core turn/tool lifecycle The `omgcode-core` `turn` module runs one bounded model/tool turn through a -caller-supplied model interface. `chat` runs it with the local LM Studio -adapter when the session's workspace enables `model_tools`; otherwise chat +caller-supplied model interface. `chat` runs it with the session's model +connection when the session's workspace enables `model_tools`; otherwise chat advertises no tools and rejects tool calls. A caller must provide an open schema-version-2-or-later journal, the current control-store writer, and the workspace ID from trusted settings. The journal's recorded workspace ID is only a coherence check. @@ -186,8 +186,10 @@ plus approval-gated tools offered only under their live settings: `workspace_edit_file` (ADR-0043), `workspace_multi_edit_file` and `workspace_create_file` (ADR-0054), `workspace_rename_file` and `workspace_delete_file` (ADR-0055), `workspace_create_directory` (ADR-0079), -and `workspace_run_command` (ADR-0040). It parses strict OpenAI-style function -calls. A call with a usable, unique identifier whose tool is unknown, whose +`workspace_run_command` (ADR-0040), and `web_fetch` (ADR-0098), which a +separate `web_fetch` preference offers; under `allow` only a host on the +workspace's allowlist runs without an approval. It parses strict OpenAI-style +function calls. A call with a usable, unique identifier whose tool is unknown, whose arguments are too large or malformed, or whose path is absolute or has a parent segment is answered with a recoverable result and the turn continues (ADR-0099). A response element with no supported shape or identifier, and a @@ -228,10 +230,12 @@ Every tool result is recorded first as `tool.requested`, then `tool.completed`, then a `message.recorded` entry with role `tool` and source `core_tool`. The tool text starts with a source label and remains user-level, untrusted content when the next request is assembled. Model-requested text -cannot become a system message. Read and list run directly. An edit, a -multi-edit, a create, a rename, a delete, or a command runs only after a -matching single-use record that the operator approved; there are no general -file write tools, and Git, MCP, and network access remain unavailable. The separate +cannot become a system message. A call whose preference state is `allow` runs +without an approval; under `prompt` a read, a list, an edit, a multi-edit, a +create, a rename, a delete, a directory, a command, or a web fetch runs only +after a matching single-use record that the operator approved (ADR-0063); +there are no general file write tools, and Git and MCP access remain unavailable. The one network +tool is `web_fetch` (ADR-0098, above). The separate [file-operation journal](file-access.md) remains the broker's operation ledger. The runtime does not redact by itself. The caller must redact user text and @@ -288,7 +292,9 @@ The request manifest does not include usage, `finish_reason`, or tool-round counts. The CLI returns provider usage and finish reason in its JSON output, but does not append them to the journal. Schema version 2 records the exact tool schema version and tool names advertised by the core turn runtime. The prototype -has no streaming, artifact, index, compaction, migration, or memory events. +has no streaming, artifact, migration, or memory events. Its only compaction +event is `context.compacted`, and the derived index (below) is not a journal +event. Streamed model text (ADR-0049) is provisional and is never written to the journal: the recorded reply is the validated whole reply, redacted as a whole, and the journal does not say whether a reply was streamed. A turn cancelled diff --git a/docs/testing-standards.md b/docs/testing-standards.md index 84688c62..94ce962c 100644 --- a/docs/testing-standards.md +++ b/docs/testing-standards.md @@ -210,7 +210,7 @@ As the relevant components are implemented, include: | Model web fetch | URL refusal before any approval (scheme, port, user info, IP literal, local name, length); every resolved address checked and the connection pinned to it; same-host redirects re-checked and capped, cross-host redirects reported and not followed; status, content-type, encoding, body-size, deadline, and cancellation handling; HTML hiding and character stripping; the `prompt` and `allow` gates with and without an allowlisted host, approval staleness after a host or preference change, and digest reproduction in review; no settings lock held during the request; result labels and byte bounds; the `network` journal target and `after_web_content` before and after a session's first fetched content, across turns and never in another session. Client tests use a loopback server under a test-only policy and never fetch a real site ([ADR-0098](adr/0098-add-a-model-web-fetch-tool-behind-a-host-allowlist.md)) | | Package network | Profile storage and the trusted fetch: recording, replay, revision, origin normalization, duplicate and invalid-origin refusal, removal, task-network gating, undeclared-origin and path refusal before a request, redirect refusal, size limits, cache-name validation, existing-cache refusal, remaining-time send and body reads under a trickled response, atomic no-replace publication under a concurrent collision, private cache content, and start/finish audit without the URL text. Cache roots cover per-workspace set/clear/replay, overlap refusals, grant revocation when a root changes or clears, stale foreign-grant refusal, refusal of a root another workspace can already read, the configured fetch location, Linux read/write/parent denial, Windows access with a scoped grant, and Windows refusal without one or without a selected root. No run accepts a profile. Registry credentials cover: bind, rotate, unbind, profile-removal unbinding, and replay with no secret in the journal; refusal of an unknown profile or origin, a stale revision, a credential identifier bound twice (including across a provider binding), and tampered replay records; earlier journals without the new fields; secret validation (control characters, whitespace, `basic` without a user and colon, oversize) before any native write; the shared store, uncertain-write, and refusal-before-write ordering; and, against a loopback fixture with the real native store, the exact bearer and basic `Authorization` header in the raw request head, no header for an unbound origin or a narrower nested origin, no request at all when the bound secret cannot be read, a redirect from a credentialed origin leaving its target untouched, the start record carrying `credential_id` only when used, and no secret in errors, audit, reports, CLI output, or any data-root file. No run test is added: a run never receives the credential, so the run suites' curated-environment test covers it ([ADR-0056](adr/0056-send-registry-credentials-to-one-declared-origin.md)). A future run-side mechanism must add allowed-origin success, undeclared-origin refusal, redirect and credential refusal, offline fallback, and platform refusal ([ADR-0034](adr/0034-gate-package-networking-behind-enforceable-destination-control.md), [ADR-0035](adr/0035-fetch-packages-through-a-trusted-allowlisted-cache.md), [ADR-0037](adr/0037-use-a-per-workspace-cache-root-and-a-scoped-windows-grant.md)) | | Providers | Partial/malformed streams, duplicate calls, interruption, retries | -| Provider profiles | Kind/authentication pairing, duplicate and invalid names, case-insensitive lookup, revisioned add/remove, replay, no credential or endpoint storage, and capability reporting. No cloud adapter or login is exercised | +| Provider profiles | Kind/authentication pairing, duplicate and invalid names, case-insensitive lookup, revisioned add/remove, replay, no credential or endpoint storage, and capability reporting. Hosted adapters and the ChatGPT sign-in run against local mocks; no hosted API key was used, and one real ChatGPT sign-in is recorded in [ADR-0096](adr/0096-accept-a-plan-route-stream-without-a-content-type.md) | | Provider credentials | Identifier format refused before I/O; empty, oversized, and line-ending input; `Debug` redaction; native round trip, create-only refusal, not-found, and delete on both hosts; on Windows, edited, truncated, and identifier-swapped blobs as corrupt and broadened or unprotected DACLs refused; on Linux, exact item attributes and label and duplicate items as corrupt; revisioned bind/unbind and replay; refusal for subscription and `none` profiles before any native store; rotation deleting the old item; a binding refused before any journal write deleting the new item; a binding whose journal sync failed keeping and naming the new item, with the binding on disk naming a present item; store-failure cleanup classification, cleanup of a left item, and an identifier kept when cleanup fails; on Windows, an injected directory-sync failure after a complete write removing the file, and with a failed removal as well, both failures reported and the file kept loadable and deletable; the secret read before the control store opens; on Linux, a pending placeholder loading as corrupt, a mock service's create and delete prompts refused without `Prompt` being called, and a create reply carrying both an item and a prompt refused with its placeholder deleted; profile removal naming its credential; and no secret in stdout, stderr, the control journal, or any file under the data root. A locked Linux collection is not exercised, because unlocking it again needs a prompt ([ADR-0042](adr/0042-store-provider-credentials-in-protected-os-storage.md)) | | Approvals | Request validation, pending/list/show, approve/deny, single-use consume, expiry, binding mismatch, settings-revision invalidation, replay, unknown IDs, and limits; a `file_write` approval refused without `--writers-stopped`, the flag refused for other operations, the acknowledgement reported and replayed, an earlier journal's unacknowledged `file_write` record replayed but refused at consumption, and a misplaced acknowledgement refused at replay. No operation executes | | Authentication | Callback binding, consent, subscription entitlement, refresh, revocation, account/billing isolation | @@ -229,7 +229,7 @@ As the relevant components are implemented, include: | Model command tool | Strict profile/program/argument/cwd parsing, tool advertised only with live model-tools/execute/read/write and a profile recorded for the platform, the recorded profiles listed in order, an unrecorded profile refused with `profile_not_recorded` before any approval and recorded as refused, a profile declared on the other platform neither offered nor accepted, and a refusal with no recorded profile not asking for a name (ADR-0100), first call records a pending approval and starts nothing, denial, approval consumption, exact digest and binding, settings-revision invalidation, run hand-off failure, output bounds, no replay, and a durable `model_tools` revocation count that stops a model-origin run even after re-enable. An end-to-end CLI case drives the real chat process, a mock provider, an operator approval, and the trusted runner to a successful confined command on both hosts | | Model edit tool | Strict path/`old_text`/`new_text` parsing with unknown-field, empty-`old_text`, duplicate-key, absolute, and parent-path refusal; the tool advertised and dispatched only with live model-tools/read/write and denied before any file access otherwise; first call records a pending `file_write` approval and writes nothing; a summary with sizes and short digests but no file text or control characters; denial; approval consumption and one checkpointed apply; a further identical call after success needing a new approval; a same-size changed file and a same-size different replacement each needing a new approval; recoverable no-match, ambiguous (including overlaps), unchanged, non-UTF-8, oversized, too-large, and pending-checkpoint results; `session inspect` listing the exact request; schema-0.2.0 replay. A CLI case drives the real chat process, a mock provider, and operator approval to an applied edit and a recorded checkpoint ([ADR-0043](adr/0043-gate-the-model-file-edit-tool-with-approvals-and-checkpointed-apply.md)) | | Model multi-edit and create tools | Strict parsing of `edits` (zero and 17 entries, empty `old_text`, unknown or duplicate keys at both levels, wrong types) and of `content`; both tools advertised and dispatched only with live model-tools/read/write, in the documented order, and denied before any file access otherwise; first call records a pending `file_write` approval and writes nothing; summaries with sizes and short digests but no text; denial; approval consumption and one checkpointed apply for a multi-edit (edits listed out of offset order, touching matches) and one exclusive create with no checkpoint; a changed file or different request needing a new approval; an `workspace_edit_file` approval never consumed by an equivalent multi-edit and the reverse, and a create approval never authorizing an edit; recoverable no-match and ambiguous (naming the edit index), overlap, unchanged, non-UTF-8, too-large, `file_exists`, and missing-parent results that record no approval; an output-too-large refusal that keeps the approval; schema-0.2.0 and 0.3.0 replay; desktop review fields, the shared eight-candidate bound across the three tools, stale review after a change or once a created path exists, and hostile text escaped. CLI cases drive the real chat process, a mock provider, and operator approval for each tool ([ADR-0054](adr/0054-add-multi-edit-and-create-model-file-tools.md)) | -| Model rename and delete tools | Strict parsing of `from`/`to` and `path` (missing, extra, wrong-type, absolute, parent, and empty values); both tools advertised and dispatched only with live model-tools/read/write, in the documented order with the eight-name cap fully used, and denied before any file access otherwise; first call records a pending `file_write` approval and writes nothing; summaries with sizes and short digests but no text; denial; approval consumption and one no-replace rename with no checkpoint or one checkpointed removal; a changed source, a different destination, or another tool's approval needing a new approval; recoverable `not_found`, `file_exists`, missing-parent, `edit_too_large`, and same-name results that record no approval; non-UTF-8 files accepted; an output-too-large refusal that keeps the approval; schema-0.4.0 replay. Platform cases refuse existing destinations, directories, links and junctions, and hard links, refuse a swapped or changed source, delete only the verified file, report a swapped name as uncertain on Linux, and inject faults before and after each native call. Ledger cases cover the `remove` kind: replay, every refusal (proposed bytes, a stage record, a carried stage identity), inventory without a stage, compaction, deletion of the entry, restore of the exact bytes including non-UTF-8, and refusal of an existing target. Review cases cover exact fields, stale destination or source, and hostile path text. CLI cases drive the real chat process, a mock provider, operator approval, and `file restore --removed` ([ADR-0055](adr/0055-add-checkpointed-delete-and-no-replace-rename-model-tools.md)) | +| Model rename and delete tools | Strict parsing of `from`/`to` and `path` (missing, extra, wrong-type, absolute, parent, and empty values); both tools advertised and dispatched only with live model-tools/read/write, in the documented order within the tool-definition cap (ten since ADR-0098), and denied before any file access otherwise; first call records a pending `file_write` approval and writes nothing; summaries with sizes and short digests but no text; denial; approval consumption and one no-replace rename with no checkpoint or one checkpointed removal; a changed source, a different destination, or another tool's approval needing a new approval; recoverable `not_found`, `file_exists`, missing-parent, `edit_too_large`, and same-name results that record no approval; non-UTF-8 files accepted; an output-too-large refusal that keeps the approval; schema-0.4.0 replay. Platform cases refuse existing destinations, directories, links and junctions, and hard links, refuse a swapped or changed source, delete only the verified file, report a swapped name as uncertain on Linux, and inject faults before and after each native call. Ledger cases cover the `remove` kind: replay, every refusal (proposed bytes, a stage record, a carried stage identity), inventory without a stage, compaction, deletion of the entry, restore of the exact bytes including non-UTF-8, and refusal of an existing target. Review cases cover exact fields, stale destination or source, and hostile path text. CLI cases drive the real chat process, a mock provider, operator approval, and `file restore --removed` ([ADR-0055](adr/0055-add-checkpointed-delete-and-no-replace-rename-model-tools.md)) | | MCP | Version/transport compatibility, authorization, untrusted content, local confinement, OAuth/redirects, cancellation | | LM Studio | Model discovery, token/no-token profiles, streamed tools, context limits, unavailable models, no hosted-tool bypass | | Instructions | Compiled base/UI/request match, runtime replacement denial, role-injection attempts, preference/task precedence, revisions, safe rendering | @@ -275,7 +275,8 @@ cancellation tests are not timed, and the `omgcode-core` adapter tests keep their own bounds. In the listed tests, work before the cancel, such as synced journal appends, is not timed: a slow Windows runner once spent 5.9 seconds there. The adapter requires the -compiled base prompt and accepts only a literal loopback HTTP endpoint. The +compiled base prompt and accepts a literal loopback HTTP endpoint or a hosted +HTTPS endpoint that core validates (ADR-0092). The adapter is not a permission boundary: the CLI selects tool mode from the live `model_tools` preference, and the runtime rechecks that preference before each call. An end-to-end acceptance case starts the real chat CLI under a delegated diff --git a/docs/workspace-permissions.md b/docs/workspace-permissions.md index 3785aac6..381790b6 100644 --- a/docs/workspace-permissions.md +++ b/docs/workspace-permissions.md @@ -64,7 +64,8 @@ checked before the overlap check. Stale data-directory identity fails closed. These metadata checks detect ordinary replacement and configuration mistakes. They do not prevent path-swap races, hostile mount changes, file ID reuse with forged metadata, or a malicious process running as the same user. File access -will need a reviewed object-relative broker. No such broker exists yet. +goes through the bounded native broker described in the +[file access contract](file-access.md); its limits are stated there. ## Revisions and bindings @@ -101,10 +102,10 @@ state since it last read them, so turning the preference back on before it reads does not keep the run going (ADR-0061). The `permissions` command reports success only after the runs it affects have stopped; see [settings changes during a run](execution.md#settings-changes-during-a-run). Per-target grants remain -required. Single-use approvals now exist for the model edit, multi-edit, create, -rename, delete, and command tools: +required. Single-use approvals now exist for the model read, list, edit, +multi-edit, create, rename, delete, directory, command, and `web_fetch` tools: the trusted CLI and the desktop approvals window decide them. The desktop -`settings` window changes the development root, registrations, the six +`settings` window changes the development root, registrations, the workspace preferences, and package cache roots through the same store calls, and creates an empty store on first use (ADR-0059 phase S2, ADR-0060). @@ -125,19 +126,36 @@ zero-based sequence, UTC timestamp, global revision, and tagged `action`: | `created` | Initial store identity, sequence and revision zero | | `root_set` | Selected directory identity; increment revision | | `workspace_registered` | New ID, directory identity, default preferences; increment revision | +| `workspace_unregistered` | Remove one registration and the settings that name it; nothing on disk changes (ADR-0081); increment revision | | `permissions_changed` | Existing ID and complete preference set; increment revision | +| `web_fetch_host_added` | Add one host pattern to a workspace's `web_fetch` allowlist (ADR-0098); increment revision | +| `web_fetch_host_removed` | Remove one host pattern from that allowlist; increment revision | | `policy_checked` | Explicit diagnostic binding/request check and decision; preserve revision | +| `container_grant_requested` | Windows container grant intent; increment revision | +| `container_grant_applied` | Grant applied to the access list; preserve revision | +| `container_revoke_requested` | Revocation intent for a grant; preserve revision | +| `container_grant_revoked` | Grant removed from the access list; preserve revision | | `profile_added` | New toolchain profile; increment revision | | `profile_removed` | Remove a toolchain profile; increment revision | | `package_profile_added` | New package-network profile; increment revision | -| `package_profile_removed` | Remove a package-network profile; increment revision | +| `package_profile_removed` | Remove a package-network profile and any credential bindings it ends; increment revision | +| `package_credential_bound` | Bind a stored credential to a package-network profile; increment revision | +| `package_credential_removed` | End that binding; increment revision | | `package_fetch_started` | Trusted package-fetch intent; preserve revision | | `package_fetch_finished` | Trusted package-fetch outcome; preserve revision | | `package_cache_root_set` | Select one workspace's package cache root; increment revision | | `package_cache_root_cleared` | Clear one workspace's package cache root; increment revision | +| `workspace_store_bound` | Create or adopt a workspace's `.OMGCode` checkpoint folder (ADR-0070); preserve revision | +| `workspace_store_forgotten` | Abandon that folder, which is left in place; preserve revision | | `provider_profile_added` | New provider profile; increment revision | -| `provider_profile_removed` | Remove a provider profile, and clear the active connection if it was that profile; increment revision | +| `provider_profile_removed` | Remove a provider profile and any credential binding it ends, and clear the active connection if it was that profile; increment revision | | `active_provider_selected` | Choose a local provider profile, or none for the default, as the desktop's active connection; increment revision | +| `provider_credential_bound` | Bind a stored API key to a provider profile; increment revision | +| `provider_credential_removed` | End a provider credential binding, including a ChatGPT sign-out; increment revision | +| `provider_subscription_bound` | Record a completed ChatGPT sign-in (ADR-0093); increment revision | +| `skill_added` | Import a skill into the private registry, disabled (ADR-0057); increment revision | +| `skill_removed` | Remove a skill; increment revision | +| `skill_enablement_set` | Enable or disable a skill for the application or one workspace; increment revision | | `approval_requested` | Trusted approval request; preserve revision | | `approval_decided` | Approval granted or denied; preserve revision | | `approval_consumed` | Approval used once; preserve revision | @@ -632,7 +650,7 @@ Before each turn, `chat` reads current settings and offers the tools only when: - a control store exists; - the session's recorded workspace UUID matches a registered workspace; - that workspace's `model_tools` preference is enabled; -- the session journal uses schema version 2. +- the session journal uses schema version 2 or later. Otherwise chat stays text only and reports `model_tools.mode` as `disabled` with a `reason`: `platform_unsupported`, `settings_absent`, From 47035d7eea2812ae91cc6539ec67ee633ef80922 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Thu, 26 Nov 2026 19:43:14 +0000 Subject: [PATCH 2/8] fix(cli): describe hosted and ChatGPT connections in the help text `chat`, `models`, and `session compact` said they reach only a local LM Studio or Ollama model, though a provider profile now selects a hosted or ChatGPT connection. Each `--provider-profile` now says an `openai` subscription profile needs `provider-signin` first, and `--model-tools` drops "local model". `--endpoint` keeps its loopback wording, because a hosted address there is refused as `cloud_needs_profile`. Two omgcode-app doc comments drop "local" the same way. Also correct the changelog's control-journal action count to 36. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 11 +++++++++-- crates/omgcode-app/src/chat.rs | 2 +- crates/omgcode-app/src/context.rs | 2 +- crates/omgcode-cli/src/control_cli.rs | 2 +- crates/omgcode-cli/src/main.rs | 22 ++++++++++++++-------- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d625f401..4415d7d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -367,7 +367,14 @@ Changes are recorded here before a release version is assigned. - The guides now match the code at version 0.69.0. PRs #69 to #76 merged in parallel, so statements one change made were left stale by another. - Documentation only; no code or version changed. + No behaviour or version changed; the only code changes are help text and + comments. + - CLI help: `chat`, `models`, and `session compact` no longer say they + reach only a local LM Studio or Ollama model, each `--provider-profile` + says an `openai` subscription profile needs `provider-signin` first, and + `--model-tools` no longer says "local model". Two `omgcode-app` doc + comments drop "local" the same way. `--endpoint` stays loopback-only + help, because a hosted address there is refused as `cloud_needs_profile`. - Model tools: guides that said no model network tool exists, that every write or command needs an approval, or that only read, list, edit, and command tools exist now name the directory tool (ADR-0079), `web_fetch` @@ -392,7 +399,7 @@ Changes are recorded here before a release version is assigned. permissions` flags, their defaults and legacy `true`, the `web-host-*` commands, `actions list`, and the current dependencies; the README lists `models`, `approvals`, `actions`, `skills`, and `chat --reasoning-effort`. - - Journals: the control-journal action table lists all 37 actions, and + - Journals: the control-journal action table lists all 36 actions, and the session and context guides record `web_fetch`, `context.compacted`, and the reasoning effort's place in the context estimate (ADR-0102). - `IMPLEMENTATION_PLAN.md` marks Phases F1 and S2 and version 0.43.0 as diff --git a/crates/omgcode-app/src/chat.rs b/crates/omgcode-app/src/chat.rs index 0ee63972..a0165461 100644 --- a/crates/omgcode-app/src/chat.rs +++ b/crates/omgcode-app/src/chat.rs @@ -1,4 +1,4 @@ -//! One chat turn against the selected local model, without any front end. +//! One chat turn against the selected model connection, without any front end. //! //! This module performs no printing, no environment reads, no argument //! parsing, and never exits the process. Whether the turn offers workspace diff --git a/crates/omgcode-app/src/context.rs b/crates/omgcode-app/src/context.rs index 0e9f0973..91f79edd 100644 --- a/crates/omgcode-app/src/context.rs +++ b/crates/omgcode-app/src/context.rs @@ -30,7 +30,7 @@ pub fn summary_output_tokens(context_tokens: u64) -> u32 { u32::try_from((context_tokens / 4).clamp(1, MAX_SUMMARY_OUTPUT_TOKENS)).unwrap_or(1) } -/// Compact the active context with the selected local model. +/// Compact the active context with the selected model connection. /// /// `summary_budget` sizes the summarizer chunks; its `max_output_tokens` must /// be the summary client's output reserve. Live `model_tools` and `read` diff --git a/crates/omgcode-cli/src/control_cli.rs b/crates/omgcode-cli/src/control_cli.rs index 41839189..17a367c9 100644 --- a/crates/omgcode-cli/src/control_cli.rs +++ b/crates/omgcode-cli/src/control_cli.rs @@ -377,7 +377,7 @@ pub(crate) struct PermissionsArgs { /// `deny`, `prompt`, or `allow`. No model tool uses it. #[arg(long = "task-network", value_parser = parse_access)] task_network: Option, - /// Let chat offer the local model workspace tools at all. + /// Let chat offer the model workspace tools at all. #[arg(long = "model-tools")] model_tools: Option, /// Let a trusted `run` select host-service Unix-socket access when it diff --git a/crates/omgcode-cli/src/main.rs b/crates/omgcode-cli/src/main.rs index f4238729..1d411aa9 100644 --- a/crates/omgcode-cli/src/main.rs +++ b/crates/omgcode-cli/src/main.rs @@ -67,10 +67,11 @@ enum Command { #[command(subcommand)] action: file_cli::FileCommand, }, - /// Send one turn to an explicitly selected local LM Studio or Ollama model. + /// Send one turn to an explicitly selected model: a local LM Studio or + /// Ollama server, or a recorded hosted or ChatGPT provider profile. Chat(ChatArgs), - /// List the models the local LM Studio or Ollama server reports, so one - /// can be passed to `chat --model` (ADR-0066). Reads no session. + /// List the models the selected connection's server reports, so one can + /// be passed to `chat --model` (ADR-0066). Reads no session. Models(ModelsArgs), /// Run one program in a workspace under native confinement, using a /// recorded toolchain profile. Needs the workspace `execute` preference. @@ -128,7 +129,7 @@ enum SessionCommand { #[command(flatten)] locator: JournalArgs, }, - /// Summarize older messages with the selected local model. + /// Summarize older messages with the selected model connection. Compact { #[command(flatten)] locator: JournalArgs, @@ -148,8 +149,9 @@ enum SessionCommand { summary_tokens: u32, /// Use this recorded provider profile's endpoint, and its stored /// credential, if any, instead of OMGCODE_LM_TOKEN. A hosted profile - /// needs a stored credential (`provider-credential-set NAME`) before a - /// request can use it. + /// needs a stored credential (`provider-credential-set NAME`), and an + /// `openai` subscription profile a ChatGPT sign-in + /// (`provider-signin NAME`), before a request can use it. #[arg(long, value_parser = non_empty_name)] provider_profile: Option, }, @@ -215,7 +217,9 @@ struct ChatArgs { /// Use this recorded provider profile's endpoint, and its stored /// credential, if any, instead of OMGCODE_LM_TOKEN. The variable is then /// not read. A hosted profile needs a stored credential - /// (`provider-credential-set NAME`) before a request can use it. + /// (`provider-credential-set NAME`), and an `openai` subscription profile + /// a ChatGPT sign-in (`provider-signin NAME`), before a request can use + /// it. #[arg(long, value_parser = non_empty_name)] provider_profile: Option, /// Stream the model's text to standard error as it arrives. The text is @@ -245,7 +249,9 @@ struct ModelsArgs { /// Use this recorded provider profile's endpoint, and its stored /// credential, if any, instead of OMGCODE_LM_TOKEN, exactly as `chat` /// does. A hosted profile needs a stored credential - /// (`provider-credential-set NAME`) before a request can use it. + /// (`provider-credential-set NAME`), and an `openai` subscription profile + /// a ChatGPT sign-in (`provider-signin NAME`), before a request can use + /// it. #[arg(long, value_parser = non_empty_name)] provider_profile: Option, } From 1ea9169b36b3066a3ac4ce1e5931950ee12f17c0 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Thu, 26 Nov 2026 19:51:11 +0000 Subject: [PATCH 3/8] docs: qualify approvals under allow and correct endpoint and deletion rules Address CodeRabbit review of PR #77: - README, docs/README, and the development guide say a model write or command needs an approval under `prompt` and none under `allow`, instead of calling every one approval-gated; the development guide also drops "local" from the model that chat lets read and list. - The settings guide's `--endpoint` paragraph and the security rule on provider profiles say which endpoint each kind records: loopback for local kinds, the one documented endpoint for named hosted kinds, and a validated https base URL for openai_compatible. - The file-access guide limits deletion through the delete tool to the broker; a program started by `run` or the model command tool can still delete workspace files without a checkpoint. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 7 ++++++- README.md | 3 ++- docs/README.md | 14 ++++++------- docs/development.md | 38 ++++++++++++++++++++--------------- docs/file-access.md | 8 +++++--- docs/security-coding-rules.md | 11 +++++----- docs/workspace-permissions.md | 14 ++++++++----- 7 files changed, 57 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4415d7d0..62b6a5e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -387,7 +387,12 @@ Changes are recorded here before a release version is assigned. only the local LM Studio adapter reads a stored credential now cover hosted connections (ADR-0092) and ChatGPT sign-in (ADR-0093). The desktop guide gives the 120-second plan-route timeout and the 2,048-model, - 4 MiB model-list limits. + 4 MiB model-list limits. The settings guide and the security rules say + which endpoint each kind's profile records, instead of loopback only or + none. + - The file-access guide limits "deletion only through the delete tool" to + the broker: a program started by `run` or the model command tool can + still delete workspace files without a checkpoint. - Desktop: the guide counts 66 commands and 32 `settings` commands, lists the create-directory review field and the six three-state preferences, and no longer says the CI desktop build has not run. The frontend README diff --git a/README.md b/README.md index e9ce4cb3..83d24b0f 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,8 @@ removes one resolved checkpoint's files and keeps its ledger history until trusted `file compact-checkpoints --discard-history`, or an apply, restore, or deletion that would not fit, compacts the ledger. Neither command is power-loss qualified. The model edit and multi-edit tools use the same -checkpointed apply after an approved, writers-stopped decision; the create tool +checkpointed apply, under `prompt` after an approved, writers-stopped decision +and under `allow` without one; the create tool uses the exclusive create without a checkpoint; the delete tool uses a checkpointed removal; and the rename tool uses a no-replace rename without a checkpoint. None detects a concurrent writer, and none is power-loss diff --git a/docs/README.md b/docs/README.md index e7540641..53f4465b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,8 +9,8 @@ selected model's read, list, edit, multi-edit, create, rename, delete, directory-creation, and command tools. A write or command needs an approval unless the operator sets its preference to `allow`. The edit and multi-edit tools change one existing -file only through checkpointed apply after an approved, writers-stopped -decision; the create tool makes one new file through the exclusive create, +file only through checkpointed apply, after an approved, writers-stopped +decision under `prompt`; the create tool makes one new file through the exclusive create, without a checkpoint; the rename tool moves one file to a name that does not exist, without a checkpoint; the delete tool removes one file after a checkpoint of its bytes; and the directory tool creates one directory whose @@ -128,11 +128,11 @@ delete, directory-creation, and command tools, and the `web_fetch` tool behind the live `web_fetch` preference, which needs an approval unless that preference is `allow` and the host is on the workspace's allowlist (ADR-0098), only for a workspace that enables `model_tools`. The edit and -multi-edit tools write -only through checkpointed apply after an approved, writers-stopped decision, the -create tool only through the exclusive create, the rename tool only through the -no-replace rename, and the delete tool only through a checkpointed removal, each -after the same decision, and none detects concurrent writers. +multi-edit tools write only through checkpointed apply, the create tool only +through the exclusive create, the rename tool only through the no-replace +rename, and the delete tool only through a checkpointed removal. Each acts +after an approved, writers-stopped decision under `prompt` and without one +under `allow`, and none detects concurrent writers. A read-only CLI preview compares a workspace file with trusted proposed content without writing to the workspace or creating a checkpoint. Dependency security audits, native containment qualification, and release checks diff --git a/docs/development.md b/docs/development.md index 4e81bfb8..ec4c044f 100644 --- a/docs/development.md +++ b/docs/development.md @@ -7,11 +7,13 @@ and save that conversation. It can read/list files, exclusively create new files/directories, and preview a bounded diff against trusted proposed content in a registered workspace. When a workspace enables `model_tools`, chat runs the core's bounded turn/tool runtime so the model can read and list files in -that workspace; with `read` and `write` enabled it can request an -approval-gated exact edit or multi-edit of an existing file, the creation of a -new file, the rename of a file, or the deletion of a file after a checkpoint, and -with `execute`, `read`, and -`write` enabled it can request an approval-gated command. Trusted CLI apply can +that workspace; with `read` and `write` enabled it can request an exact edit +or multi-edit of an existing file, the creation of a new file, the rename of a +file, or the deletion of a file after a checkpoint, and with `execute`, `read`, +and `write` enabled it can request a command. Each write or command needs an +approval under `prompt` and none under `allow` +([ADR-0063](adr/0063-deny-prompt-or-allow-each-preference-wait-for-approvals-in-the-turn-and-journal-model-actions.md)). +Trusted CLI apply can replace an existing file on Linux ext4, btrfs, XFS, tmpfs, or ZFS or on Windows NTFS or ReFS ([ADR-0069](adr/0069-allow-refs-btrfs-xfs-tmpfs-and-zfs-for-trusted-apply.md)). Trusted restore puts a retained checkpoint's original bytes back through apply, and trusted checkpoint @@ -23,12 +25,13 @@ run in a run journal. Every run is limited in memory, live processes, and CPU time. A program started by `run` can create, change, and delete workspace files without a checkpoint. The CLI's `file` commands cannot delete workspace files, and the CLI cannot use Git or connect to MCP servers. -When a workspace enables `model_tools`, chat lets the local model read and list -files in that workspace, request an approval-gated exact edit, multi-edit, file -creation, rename, or checkpointed deletion with read/write, and request an -approval-gated command with execute/read/write once a toolchain profile is -recorded for the running platform +When a workspace enables `model_tools`, chat lets the model read and list +files in that workspace, request an exact edit, multi-edit, file creation, +rename, or checkpointed deletion with read/write, and request a command with +execute/read/write once a toolchain profile is recorded for the running +platform ([ADR-0100](adr/0100-list-the-recorded-toolchain-profiles-in-the-command-tool.md)). +Each write or command needs an approval under `prompt` and none under `allow`. A separate `web_fetch` preference lets it fetch one public HTTPS page per call, with an approval for each fetch under `prompt` and for each host off the workspace allowlist @@ -263,9 +266,10 @@ three words and can only narrow `--write`. `--model-tools` takes `true` or `task-network`, `host-services`, `web-fetch`, and `model-tools`. All decisions still report `execution_allowed: false`; only the trusted `run` command starts a process, and the model command tool reaches it after a consumed approval -under `prompt`, or without one under `allow`. Settings commands do not dispatch +under `prompt`, or without one under `allow`; the model write tools follow the +same rule. Settings commands do not dispatch tools. `--model-tools true` lets chat offer the model read/list tools, with -read/write the approval-gated edit, multi-edit, create, rename, delete, and +read/write the edit, multi-edit, create, rename, delete, and create-directory tools, with execute/read/write the command tool when a toolchain profile is recorded for the platform, and with `--web-fetch` other than `deny` the `web_fetch` tool. `web-host-add`, `web-host-remove`, and @@ -719,15 +723,17 @@ remains text. When the workspace enables `model_tools`, chat offers `workspace_read_file` and `workspace_list_directory`. When `read` and `write` also allow it, it offers -the approval-gated `workspace_edit_file`, `workspace_multi_edit_file`, +`workspace_edit_file`, `workspace_multi_edit_file`, `workspace_create_file`, `workspace_rename_file`, `workspace_delete_file`, and `workspace_create_directory`. When `execute`, `read`, and `write` also allow it and a toolchain profile is recorded for the running platform, it -offers the approval-gated `workspace_run_command`, whose `profile` parameter +offers `workspace_run_command`, whose `profile` parameter lists those profiles; a call naming another profile gets `profile_not_recorded` -before any approval is requested (ADR-0100). When the workspace's `web_fetch` -preference is `prompt` or `allow`, it offers `web_fetch` (ADR-0098). Set +before any approval is requested (ADR-0100). The write tools and the command +tool need an approval under `prompt` and none under `allow`. When the +workspace's `web_fetch` preference is `prompt` or `allow`, it offers +`web_fetch` (ADR-0098). Set `--max-tool-calls <1–256>` to override the default of 128 for this turn. A batch that would exceed the cap is refused before any of its calls run. The `tool_limit` error reports the configured cap, calls used, and calls requested. Start a new diff --git a/docs/file-access.md b/docs/file-access.md index c225a663..97002ec6 100644 --- a/docs/file-access.md +++ b/docs/file-access.md @@ -27,10 +27,12 @@ the [replacement contract](#replacement-contract). Trusted restore writes a retained checkpoint's original bytes back through that same apply path, and trusted checkpoint deletion removes one resolved private entry; see [Phase A4](#implemented-restore-and-checkpoint-deletion-phase-a4). A create -operation still refuses every existing entry. Workspace file deletion exists -only as the checkpointed model delete tool +operation still refuses every existing entry. Through the broker, workspace +file deletion exists only as the checkpointed model delete tool ([ADR-0055](adr/0055-add-checkpointed-delete-and-no-replace-rename-model-tools.md)), -whose retained original the trusted `file restore --removed` writes back. +whose retained original the trusted `file restore --removed` writes back. A +program started by the trusted `run` command or the model command tool can +still create, change, or delete workspace files without a checkpoint. Restore-as-create, recursive directory creation, and action replay are unavailable. A content check followed by rename cannot guarantee no lost updates against independent writers. See diff --git a/docs/security-coding-rules.md b/docs/security-coding-rules.md index f8b3c966..4e3b6617 100644 --- a/docs/security-coding-rules.md +++ b/docs/security-coding-rules.md @@ -300,11 +300,12 @@ crate. ([ADR-0098](adr/0098-add-a-model-web-fetch-tool-behind-a-host-allowlist.md)). Label fetched text as untrusted web content from its host, never as workspace data or instructions. -- Provider profiles record only a name, kind, and authentication mode. Never - store a token, password, certificate, endpoint, or account in them. Keep - subscription and API-key usage separate, and do not implement an adapter or - login without the reviewed credential service and the provider's supported - route. A profile is configuration, not authentication. See ADR-0038. +- Provider profiles record only a name, kind, authentication mode, and an + optional endpoint that core validates on record and on replay (ADR-0048, + ADR-0092). Never store a token, password, certificate, or account in them. + Keep subscription and API-key usage separate, and do not implement an + adapter or login without the reviewed credential service and the provider's + supported route. A profile is configuration, not authentication. See ADR-0038. - Store provider credentials only through `omgcode_platform::credentials` (ADR-0042): DPAPI files with verified private DACLs on Windows and Secret Service items on Linux, never a plaintext fallback. Read secrets only from a diff --git a/docs/workspace-permissions.md b/docs/workspace-permissions.md index 381790b6..393bd8de 100644 --- a/docs/workspace-permissions.md +++ b/docs/workspace-permissions.md @@ -313,11 +313,15 @@ and `provider_profile_removed`; `workspace status` lists them under authentication matrix. A control journal written by 0.24.0 cannot be read by 0.23.0. -Since 0.31.0, `provider-profile-add` accepts `--endpoint ` for an -`lm_studio` profile, and since 0.44.0 for an `ollama_local` profile, and -refuses it for every other kind. The endpoint is -validated when recorded and again on replay, and it cannot be changed without -removing the profile. `provider_profile_added` carries an `endpoint` field +`provider-profile-add` accepts `--endpoint `. An `lm_studio` profile +(since 0.31.0) and an `ollama_local` profile (since 0.44.0) take a loopback +address. Each named hosted kind accepts only its provider's one documented +endpoint: `ollama_cloud` since 0.50.0 (ADR-0071) and the others since 0.59.0 +(ADR-0092). An `api_key` profile of a named hosted kind that omits +`--endpoint` records that endpoint. An `openai_compatible` profile needs an +`https://` base URL that core validates and refuses rather than rewrites. The +endpoint is validated when recorded and again on replay, and it cannot be +changed without removing the profile. `provider_profile_added` carries an `endpoint` field only when one is recorded, so a journal without one is unchanged; a control journal that records an endpoint cannot be read by 0.30.0. The [provider authentication guide](provider-authentication.md#endpoint-binding-0310) From 73c3915677a15853f5ee0a9724f98a6b152c17f3 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Thu, 26 Nov 2026 19:52:31 +0000 Subject: [PATCH 4/8] fix: name the full workspace commands in --provider-profile help The chat, models, and session compact help told a hosted profile to run `provider-credential-set NAME` and a subscription profile to run `provider-signin NAME`. Both are `omgcode workspace` subcommands with a required `--revision`, so clap rejects the short forms. The help now names the full commands and says the credential is for a hosted `api_key` profile. The `provider-credential-set` help no longer says only the local adapter reads its credential; hosted `api_key` profiles read it too. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 5 ++++- crates/omgcode-cli/src/control_cli.rs | 4 ++-- crates/omgcode-cli/src/main.rs | 25 +++++++++++++------------ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62b6a5e6..732255ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -371,7 +371,10 @@ Changes are recorded here before a release version is assigned. comments. - CLI help: `chat`, `models`, and `session compact` no longer say they reach only a local LM Studio or Ollama model, each `--provider-profile` - says an `openai` subscription profile needs `provider-signin` first, and + names the full `omgcode workspace provider-credential-set NAME --revision + N` command and says an `openai` subscription profile needs `omgcode + workspace provider-signin NAME --revision N` first, `provider-credential-set` + says hosted `api_key` profiles read its credential too, and `--model-tools` no longer says "local model". Two `omgcode-app` doc comments drop "local" the same way. `--endpoint` stays loopback-only help, because a hosted address there is refused as `cloud_needs_profile`. diff --git a/crates/omgcode-cli/src/control_cli.rs b/crates/omgcode-cli/src/control_cli.rs index 17a367c9..7916b2ee 100644 --- a/crates/omgcode-cli/src/control_cli.rs +++ b/crates/omgcode-cli/src/control_cli.rs @@ -183,8 +183,8 @@ pub(crate) enum WorkspaceCommand { /// /// The secret is read from standard input only, up to 16 KiB; one /// trailing newline is removed. A previously bound credential is deleted - /// after the new binding is recorded. The local adapter reads it for a - /// selected lm_studio profile. + /// after the new binding is recorded. The chat client reads it for a + /// selected lm_studio or hosted `api_key` profile. ProviderCredentialSet { name: String, #[arg(long)] diff --git a/crates/omgcode-cli/src/main.rs b/crates/omgcode-cli/src/main.rs index 1d411aa9..c04ebe8a 100644 --- a/crates/omgcode-cli/src/main.rs +++ b/crates/omgcode-cli/src/main.rs @@ -148,10 +148,11 @@ enum SessionCommand { #[arg(long, default_value_t = 2048)] summary_tokens: u32, /// Use this recorded provider profile's endpoint, and its stored - /// credential, if any, instead of OMGCODE_LM_TOKEN. A hosted profile - /// needs a stored credential (`provider-credential-set NAME`), and an - /// `openai` subscription profile a ChatGPT sign-in - /// (`provider-signin NAME`), before a request can use it. + /// credential, if any, instead of OMGCODE_LM_TOKEN. A hosted + /// `api_key` profile needs a stored credential (`omgcode workspace + /// provider-credential-set NAME --revision N`), and an `openai` + /// subscription profile a ChatGPT sign-in (`omgcode workspace + /// provider-signin NAME --revision N`), before a request can use it. #[arg(long, value_parser = non_empty_name)] provider_profile: Option, }, @@ -216,10 +217,10 @@ struct ChatArgs { auto_compact: bool, /// Use this recorded provider profile's endpoint, and its stored /// credential, if any, instead of OMGCODE_LM_TOKEN. The variable is then - /// not read. A hosted profile needs a stored credential - /// (`provider-credential-set NAME`), and an `openai` subscription profile - /// a ChatGPT sign-in (`provider-signin NAME`), before a request can use - /// it. + /// not read. A hosted `api_key` profile needs a stored credential + /// (`omgcode workspace provider-credential-set NAME --revision N`), and an + /// `openai` subscription profile a ChatGPT sign-in (`omgcode workspace + /// provider-signin NAME --revision N`), before a request can use it. #[arg(long, value_parser = non_empty_name)] provider_profile: Option, /// Stream the model's text to standard error as it arrives. The text is @@ -248,10 +249,10 @@ struct ModelsArgs { endpoint: String, /// Use this recorded provider profile's endpoint, and its stored /// credential, if any, instead of OMGCODE_LM_TOKEN, exactly as `chat` - /// does. A hosted profile needs a stored credential - /// (`provider-credential-set NAME`), and an `openai` subscription profile - /// a ChatGPT sign-in (`provider-signin NAME`), before a request can use - /// it. + /// does. A hosted `api_key` profile needs a stored credential + /// (`omgcode workspace provider-credential-set NAME --revision N`), and an + /// `openai` subscription profile a ChatGPT sign-in (`omgcode workspace + /// provider-signin NAME --revision N`), before a request can use it. #[arg(long, value_parser = non_empty_name)] provider_profile: Option, } From bf27606bb296c4cda158bdb89543184985b36f0d Mon Sep 17 00:00:00 2001 From: James Chapman Date: Thu, 26 Nov 2026 19:57:35 +0000 Subject: [PATCH 5/8] docs: name the directory tool in the development guide's tool summaries The two model-tool summaries near the top of the development guide, and the `workspace_file_tools` capability note, listed the edit, multi-edit, create, rename, and delete tools but not directory creation (ADR-0079), which the same `read` and `write` preferences offer. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 3 ++- docs/development.md | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 732255ae..00b129fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -385,7 +385,8 @@ Changes are recorded here before a release version is assigned. `prompt`, the recorded-profile condition and `profile_not_recorded` answer of the command tool (ADR-0100), the 32 KiB argument limit of the edit and multi-edit tools, and recoverable refused calls (ADR-0099). - Chat advertises at most ten tool names, not eight. + Chat advertises at most ten tool names, not eight. The development + guide's tool summaries name the directory tool. - Providers: statements that no cloud adapter or login exists and that only the local LM Studio adapter reads a stored credential now cover hosted connections (ADR-0092) and ChatGPT sign-in (ADR-0093). The diff --git a/docs/development.md b/docs/development.md index ec4c044f..b1750e31 100644 --- a/docs/development.md +++ b/docs/development.md @@ -9,8 +9,9 @@ in a registered workspace. When a workspace enables `model_tools`, chat runs the core's bounded turn/tool runtime so the model can read and list files in that workspace; with `read` and `write` enabled it can request an exact edit or multi-edit of an existing file, the creation of a new file, the rename of a -file, or the deletion of a file after a checkpoint, and with `execute`, `read`, -and `write` enabled it can request a command. Each write or command needs an +file, the deletion of a file after a checkpoint, or the creation of one +directory whose parent exists, and with `execute`, `read`, and `write` enabled +it can request a command. Each write or command needs an approval under `prompt` and none under `allow` ([ADR-0063](adr/0063-deny-prompt-or-allow-each-preference-wait-for-approvals-in-the-turn-and-journal-model-actions.md)). Trusted CLI apply can @@ -27,7 +28,9 @@ delete workspace files without a checkpoint. The CLI's `file` commands cannot delete workspace files, and the CLI cannot use Git or connect to MCP servers. When a workspace enables `model_tools`, chat lets the model read and list files in that workspace, request an exact edit, multi-edit, file creation, -rename, or checkpointed deletion with read/write, and request a command with +rename, checkpointed deletion, or directory creation +([ADR-0079](adr/0079-add-a-model-tool-that-creates-one-directory.md)) with +read/write, and request a command with execute/read/write once a toolchain profile is recorded for the running platform ([ADR-0100](adr/0100-list-the-recorded-toolchain-profiles-in-the-command-tool.md)). @@ -577,8 +580,8 @@ follow the same rule for `file restore` and `file delete-checkpoint`. `read_list_when_workspace_model_tools_enabled_edit_multi_edit_create_rename_delete_and_command_require_approval` there. `model_write_tools` and `model_command_tool` are `approval_required`. None of them reports whether any workspace enables the preference. -`workspace_file_tools`, which covers general model file tools beyond the -approval-gated edit, multi-edit, create, rename, and delete tools, remains +`workspace_file_tools`, which covers general model file tools beyond the edit, +multi-edit, create, rename, delete, and directory-creation tools, remains `false`. ```text From 288fc8b0d5cbd2aafeea25844f91925a2a43691c Mon Sep 17 00:00:00 2001 From: James Chapman Date: Thu, 26 Nov 2026 20:02:35 +0000 Subject: [PATCH 6/8] docs: state the command tool's recorded-profile condition in every summary The development guide's opening summary and its capability-flags paragraph said the command tool is offered when `execute`, `read`, and `write` are enabled, but it is offered only once a toolchain profile is recorded for the running platform (ADR-0100). The capability-flags paragraph also listed only the edit, multi-edit, and create tools; it now names all six file-write tools. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 3 ++- docs/development.md | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00b129fb..9d5e8e24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -386,7 +386,8 @@ Changes are recorded here before a release version is assigned. answer of the command tool (ADR-0100), the 32 KiB argument limit of the edit and multi-edit tools, and recoverable refused calls (ADR-0099). Chat advertises at most ten tool names, not eight. The development - guide's tool summaries name the directory tool. + guide's tool summaries name the directory tool and say the command tool + needs a toolchain profile recorded for the running platform. - Providers: statements that no cloud adapter or login exists and that only the local LM Studio adapter reads a stored credential now cover hosted connections (ADR-0092) and ChatGPT sign-in (ADR-0093). The diff --git a/docs/development.md b/docs/development.md index b1750e31..d3343d02 100644 --- a/docs/development.md +++ b/docs/development.md @@ -11,7 +11,8 @@ that workspace; with `read` and `write` enabled it can request an exact edit or multi-edit of an existing file, the creation of a new file, the rename of a file, the deletion of a file after a checkpoint, or the creation of one directory whose parent exists, and with `execute`, `read`, and `write` enabled -it can request a command. Each write or command needs an +it can request a command once a toolchain profile is recorded for the running +platform. Each write or command needs an approval under `prompt` and none under `allow` ([ADR-0063](adr/0063-deny-prompt-or-allow-each-preference-wait-for-approvals-in-the-turn-and-journal-model-actions.md)). Trusted CLI apply can @@ -560,9 +561,10 @@ native mount. Execute remains disabled. The `audit`, `acknowledge`, `forget-checkpoint-store` also requires the workspace to be registered. They do not require a configured root, workspace registration, or session selection. Chat advertises the read/list tools when the session's workspace -enables `model_tools`, the edit, multi-edit, and create tools when `read` and -`write` are also enabled, -and the command tool when `execute`, `read`, and `write` are also enabled; see +enables `model_tools`, the edit, multi-edit, create, rename, delete, and +directory-creation tools when `read` and `write` are also enabled, and the +command tool when `execute`, `read`, and `write` are also enabled and a +toolchain profile is recorded for the running platform; see [model tools](workspace-permissions.md#model-readlist-and-command-tools). Capability JSON separates implementation from availability. On Linux and From 5dd13f7d05726651c2d3abfcf9bdd0a0d884adfa Mon Sep 17 00:00:00 2001 From: James Chapman Date: Thu, 26 Nov 2026 20:07:30 +0000 Subject: [PATCH 7/8] docs: name web_fetch in the development guide's tool summaries The opening summary and the capability-flags paragraph listed the read, list, file-write, and command tools but not `web_fetch`, which chat offers when the workspace's `web_fetch` preference is `prompt` or `allow` (ADR-0098). Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 5 +++-- docs/development.md | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d5e8e24..cfeb1bbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -386,8 +386,9 @@ Changes are recorded here before a release version is assigned. answer of the command tool (ADR-0100), the 32 KiB argument limit of the edit and multi-edit tools, and recoverable refused calls (ADR-0099). Chat advertises at most ten tool names, not eight. The development - guide's tool summaries name the directory tool and say the command tool - needs a toolchain profile recorded for the running platform. + guide's tool summaries name the directory tool and `web_fetch` and say + the command tool needs a toolchain profile recorded for the running + platform. - Providers: statements that no cloud adapter or login exists and that only the local LM Studio adapter reads a stored credential now cover hosted connections (ADR-0092) and ChatGPT sign-in (ADR-0093). The diff --git a/docs/development.md b/docs/development.md index d3343d02..03a0d648 100644 --- a/docs/development.md +++ b/docs/development.md @@ -12,9 +12,11 @@ or multi-edit of an existing file, the creation of a new file, the rename of a file, the deletion of a file after a checkpoint, or the creation of one directory whose parent exists, and with `execute`, `read`, and `write` enabled it can request a command once a toolchain profile is recorded for the running -platform. Each write or command needs an -approval under `prompt` and none under `allow` +platform. Each write or command needs an approval under `prompt` and none +under `allow` ([ADR-0063](adr/0063-deny-prompt-or-allow-each-preference-wait-for-approvals-in-the-turn-and-journal-model-actions.md)). +With a `web_fetch` preference of `prompt` or `allow`, it can also fetch one +public HTTPS page per call (ADR-0098). Trusted CLI apply can replace an existing file on Linux ext4, btrfs, XFS, tmpfs, or ZFS or on Windows NTFS or ReFS ([ADR-0069](adr/0069-allow-refs-btrfs-xfs-tmpfs-and-zfs-for-trusted-apply.md)). Trusted restore puts a @@ -564,7 +566,8 @@ selection. Chat advertises the read/list tools when the session's workspace enables `model_tools`, the edit, multi-edit, create, rename, delete, and directory-creation tools when `read` and `write` are also enabled, and the command tool when `execute`, `read`, and `write` are also enabled and a -toolchain profile is recorded for the running platform; see +toolchain profile is recorded for the running platform, and `web_fetch` when +the `web_fetch` preference is `prompt` or `allow`; see [model tools](workspace-permissions.md#model-readlist-and-command-tools). Capability JSON separates implementation from availability. On Linux and From bd0f6f2c632bca2e8222137e85ee8f4a659d8801 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Thu, 26 Nov 2026 20:12:30 +0000 Subject: [PATCH 8/8] docs: say web_fetch also needs model_tools in the development guide `PermissionSet::model_web_fetch` is `Deny` unless `model_tools` is enabled, but the capability summary and the opening summary gave only the `web_fetch` preference as its condition. Both now name `model_tools` too. Co-Authored-By: Claude Opus 5.5 --- docs/development.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/development.md b/docs/development.md index 03a0d648..c09e6ba0 100644 --- a/docs/development.md +++ b/docs/development.md @@ -15,8 +15,8 @@ it can request a command once a toolchain profile is recorded for the running platform. Each write or command needs an approval under `prompt` and none under `allow` ([ADR-0063](adr/0063-deny-prompt-or-allow-each-preference-wait-for-approvals-in-the-turn-and-journal-model-actions.md)). -With a `web_fetch` preference of `prompt` or `allow`, it can also fetch one -public HTTPS page per call (ADR-0098). +With `model_tools` enabled and a `web_fetch` preference of `prompt` or +`allow`, it can also fetch one public HTTPS page per call (ADR-0098). Trusted CLI apply can replace an existing file on Linux ext4, btrfs, XFS, tmpfs, or ZFS or on Windows NTFS or ReFS ([ADR-0069](adr/0069-allow-refs-btrfs-xfs-tmpfs-and-zfs-for-trusted-apply.md)). Trusted restore puts a @@ -564,10 +564,11 @@ native mount. Execute remains disabled. The `audit`, `acknowledge`, They do not require a configured root, workspace registration, or session selection. Chat advertises the read/list tools when the session's workspace enables `model_tools`, the edit, multi-edit, create, rename, delete, and -directory-creation tools when `read` and `write` are also enabled, and the -command tool when `execute`, `read`, and `write` are also enabled and a -toolchain profile is recorded for the running platform, and `web_fetch` when -the `web_fetch` preference is `prompt` or `allow`; see +directory-creation tools when `read` and `write` are also enabled, the command +tool when `execute`, `read`, and `write` are also enabled and a toolchain +profile is recorded for the running platform, and `web_fetch` when the +`web_fetch` preference is also `prompt` or `allow`. Without `model_tools`, none +of them is advertised; see [model tools](workspace-permissions.md#model-readlist-and-command-tools). Capability JSON separates implementation from availability. On Linux and