Public libraries and model operations
Evidence. The published reference reports 14 documented Go symbols and identifies one real consumer of pkg/client: its test exercises the daemon operation task_get. The chapter reports no production caller within the repository at its census. The plugin’s production path is separate. Its Bun-first plugin/core/daemon.ts discovers the endpoint and reuses the connection, and plugin/core/ops.gen.ts generates method bindings from the operation table. The parity table, for example, maps chat_completions to ops.chatCompletions(). This is evidence of the published design and test, not proof of today’s deployed clients. Public Go client · Coverage · HTTP API · Parity
First release boundary. Keep the existing Go module’s pre-1.0 promise. A caller constructs client.New with a transport, calls Call, CallRaw, or Invoke[T], handles argument errors, unknown operations and HTTP failures, and can inspect Operations/Operation. The compiled client and the running daemon can come from different commits. “Generated from the same table” ensures consistency at build time; a newer client can still ask an older daemon for an absent operation. Contract fixtures should cover current/current, older/current and current/older. Distinguish local argument validation, unavailable server operations, and remote refusal in each result. The documented lookup methods return api.Op from an internal package. Compile a separate module that lists, filters and passes operation records to another function. If that caller needs the type name, expose a public alias or descriptor while preserving existing methods. Go client · Go module compatibility
| Surface | Suggested public contract | Acceptance evidence |
|---|---|---|
| Daemon client | Retain /v1 operation names, declared parameter placement, injection of HTTP transport and named errors. Check server discovery or handle unknown operations when versions diverge. | Derive a tiny external caller from the real pkg/client/client_test.go task lookup with an ID containing a space and slash. Check decoded result, encoded path and distinct refusal. Publish the source permalink and verification ref. |
| Offline Go embedding | Publish narrow read-only facades only when a concrete consumer is checked. Catalog ranking accepts an immutable inventory and query. Settings resolution accepts explicit layers and an environment lookup supplied by the host, and returns provenance. Policy evaluation takes verified caller context and policy revision; its output is a decision, not a portable authorization token. | Same fixtures through the daemon and an in-process host produce equivalent ranked matches, resolved public values and decision reasons. Fixture detects unsolicited network, daemon startup or environment lookup outside the supplied inputs. The component committing an action reauthorizes it. |
| Fleet and ID | Start with a wire call through the existing enforcing gateway. If an actual offline Rust deployment needs it, compare a shared test corpus, a process boundary and a C/Wasm binding for that specific operation. Avoid maintaining two writable policy engines. | Record actual source-symbol callers in each project before claiming integration. Demonstrate cancellation, denied write and mixed-version behavior. |
| Plugin core and adapters | Keep discovery/ranking, daemon transport and generated operations shared. Each adapter owns host session propagation, consent UI and cancellation. Inject transport where Bun’s Unix fetch is unavailable. | Fake host adapter tests verify session identity is preserved; one actual host invocation demonstrates transport and cancellation. The published v2 chapter identifies discover, DaemonClient, rank, summarise, readInfoFiles, and stateDir in the core. Existing implementation map |
| C ABI/Wasm | Separate ABI major from module and daemon version. Use opaque handles, explicit buffer ownership, tagged errors, bounded inputs, explicit cancellation and documented concurrency. Bind only operations a host needs. For a component build, a WIT world declares imports/exports. Keep wasip1 and WIT component support as distinct targets. | Cross-language vectors for success, short output buffer, unknown major, cancellation, released handle and concurrent shutdown. Verify the guest has only its declared capabilities. Route pure operations through identical fixtures as Go. WIT |
| mcpx upstream of mcpx | Assign each gateway a stable local identity. Intersect the verified incoming delegation with local grants at each hop. Maintain a bounded traversal context and reject repeat identities. A forwarded claim needs authenticated provenance. | A→A and A→B→A stop before the repeated call. Parallel A→B and A→C remain independent. A caller cannot manufacture a more privileged origin by supplying traversal metadata. |
Model resolution, prompt, proxy, repair, hooks and administration
Existing behavior. The book already documents the Generate method of the Provider interface in internal/model, named model.providers, ordered model.profiles, explicit credential variable names, model.budget, model.timeout, and per-attempt timeout. The configured provider defaults to none. The configuration chapter adds an important qualification: explicit model/provider requests and the legacy scripting provider’s environment or installed-CLI discovery can select generation when the request permits it. The old repair.provider and repair.model settings mentioned in a fleet file are reported as unregistered. The behavioral oracle for “no model” must count every attempted outbound call and CLI spawn. Reading model.provider alone cannot prove it. Configuration · Consumer
One resolution path. For every model-consuming operation, resolve the ordered candidates from the existing provider/profile configuration and explicit request. Intersect with caller sensitivity ceiling, eligible plan endpoints, total deadline and remaining quota. Require explicit eligibility for the selected route, including plugins, compatible remote endpoints and legacy CLI providers. Resolve credential references only after eligibility and keep values in process. Expose configured profile ID, selected provider/model, configuration revision, selection reason and measured or unknown usage. A 402 terminates model work for that request. A subsequent candidate is eligible after an unstarted or known-safe failure only within the same authorization, quota and deadline. Once a streamed response is partially delivered, retain partial status and stop. Mark usage unresolved if a provider never delivered the final usage frame. OpenAI streaming reference
| Entry | Contract and retained implementation | Named oracle |
|---|---|---|
| Prompt and sampling | Keep mcpx prompt → POST /v1/intent. The distinct POST /v1/prompt renders an upstream MCP prompt. Resolve recipes first. Return a proposal by default; preserve explicit run clamped by autonomy.max and the caller’s authority. MCP sampling remains a compatibility adapter for peers that advertise it, with the initiating identity’s budget and consent. The July 2026 revision deprecates sampling with a minimum twelve-month transition. | Deterministic recipe with eligible paid-looking mock endpoints produces zero model requests. When run is clamped to propose, the expected file or other side effect is absent, and requested/clampedBy records the change. Refusal or 402 preserves a deterministic response with the reason. Consumer · MCP sampling |
| Proxy | mcpx proxy, mcpx_chat_completions, and the plugin op target the declared POST /v1/chat/completions operation. Publish a matrix for request body fields, tool-call chunks, streaming, cancellation, upstream status, and unsupported features. Preserve direction and role of each message. Route model eligibility through the same resolver and refusal rules. | A fixture splits tool arguments across chunks, returns a midstream failure, cancels before final usage and emits a 402. Inspect frames and upstream call counters. No cross-provider replay once output escaped. Mark exact supported shapes against the checked binary. Parity |
| Admin by intent | Complete the machine-readable operation inventory first. Filter the operations and allowed arguments by verified identity. A sentence selects a declared operation and produces a preview with normalized arguments, effect, required authority and any consent. The same validator, dispatcher and audit handle CLI and approved intent. Revalidate the preview’s target and policy revision before committing. Ambiguity yields choices. | Compare CLI and intent execution using a single fixture with a side-effect counter. Unrecognized operation, revoked grant, stale operation revision or missing required argument yields zero changes. Both successful entry points record the same canonical operation ID. Book describes x-mcpx-admin as a classification; verify enforcement in the pinned binary before allowing admin execution. HTTP API |
| Repair | Retain the accepted autonomy ladder off/advise/ask/propose/apply/run. Proceed from diagnostics and deterministic near misses to explanation, consent, proposed artifact, retry or reinterpretation only under the recorded ceiling. Bound all repair attempts by the original deadline and quota. An ambiguous completion of a write requires a target-supported idempotency key or a reconciliation check before replay. | Deterministic typo returns a nonexecuted proposal under propose ceiling. Unknown write completion makes exactly one upstream invocation. Every candidate is checked against the original identity and namespace. ADR 0002 |
| Exec hooks | Preserve ADR 0001’s five script phases and observe. Structured success/error hooks complete before the single result/error frame; suffix follows it. The published exec chapter describes advisory model-backed hooks. The November 23 source also implements a proposal at success/error, with disallowed control keys dropped and reported; the book needs a correction. Apply sensitivity and budget before expanding and sending @source, @calls, @error and other placeholders to a provider. A hook that cannot obtain advice emits an unavailable outcome and preserves the original execution result. | Successful and failing scripts each produce one final outcome and ordered suffix/end. A denied advice request makes zero provider calls, and a failed post-hook never reruns the tool. An injected placeholder containing restricted fixture text is absent from the provider capture and telemetry. Exec contract · ADR 0001 |
Order for implementation. Check current source, newest comments and ownership on #1877, #1861, #1891, #1925, #1927, #1929, #1931 and #1940. Pin an operation-table, public-symbol and provider-path inventory first. Add the external-client test and offline mock-provider denial tests before shipping new bindings or widening hook effects. Measure actual caller needs before promoting an internal package. Keep the existing plugin settings holds out of every patch. These are proposed acceptance cases. No test, deployment or code ownership is implied by this chapter.
Second pass against pinned source
The following observations use the November 23 archive at 4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a. They measure reading the implementation, not a live daemon. Repository snapshot
- Go client provenance. Scanning all 1,051 regular files ending in
.goin the pinned monorepo archive found zero occurrences of the full import pathgithub.com/developing-today/code/pkgs/mcpx/pkg/client. The same-package test actually callstask_getwitht 1/2against anhttptest.Server; use that as the external-caller fixture. The production OpenCode client is TypeScript. Test - A 402 currently advances a model profile. The HTTP adapter formats any non-2xx as a plain error containing the upstream body. The profile router appends every unsuccessful attempt and advances. Its per-profile token budget caps each attempt’s requested tokens separately; it is not a meter of plan eligibility or the profile’s cumulative spending. The existing positive-control test makes a 503 advance to the second fake provider. The raw chat proxy separately forwards upstream HTTP status and body and has one upstream for its request. HTTP adapter · Profile router · Positive control
- Feedback has two working consumers. The dashboard reads interactions and posts score/notes. Its stats tabs request the daemon’s stats route. The semantic ranker uses separate execution and retrieval multipliers on the combined keyword/vector score. There is a concrete join defect for ratings: the call path stores
server:tool, proxy-injected tool names usenamespace__function, and rank lookup usesnamespace.function. The store uses substring matching over serialized tool names. Even with the same spelling, similarly named tools can borrow one another’s scores. A proposed correction is to store source-native, exact tool identities separately from display names, settle aliases when the call/catalog mapping is still available, and match exact identity. Read old rows using their known source format only when their lookup is unambiguous. Keep unresolved historical records visible without using them to weight a tool. Test a custom namespace, one tool whose name prefixes another, and an unrelated caller-supplied proxy function. One trace’s feedback must affect only its identified tool. Call producer · Proxy · Lookup · SQL · Dashboard - Minimize what feedback retains independently of ranking. Given a state directory, registry initialization attempts to open
feedback.db. The synchronous tool handler records serialized arguments and successful results for non-dry-run calls. The proxy stores the user query and up to 1 MiB of the upstream reply. The source branches contain no recording-consent check. A bounded copy still contains content. Keep trace ID, stable tool identity, scores and duration for local ranking and stats. Offer optional content capture only with explicit scope, short retention, and the authorized reader’s access; a secret-bearing scope suppresses content before the store, logs and dashboard receive it. Treat historical rows according to access policy on read. Deleting or migrating existing user data is a separate operation. For the oracle, send distinct synthetic markers through call and proxy, verify absence in all retained fields under metadata-only mode, and verify the rating still moves the intended tool’s score. Initialization · Tool history · Proxy history - Hook docs and skill parity. The v2 plugin has an actual
{id, setup}entry point. The OpenCode 2 skill points to the v1 session plugin path, including its config fragment. The four named per-harness skill directories exist. The published plugin chapter lists four different generic skills. The e2e script example test enumerates only the generic basics directory. Compare adapter-specific installation snippets against each actual export, keep host-specific bootstrapping explicit, and have one shared fixture check discovery, type lookup and a permitted invocation from each advertised route. Preserve the existing v2 options and holds. Also amend the exec chapter’s “only advise” statement using the accepted propose restriction and existing tests. No new feature code is needed for that correction. v2 entry · v2 skill · Examples · Hook validation · Completed #11141
Acceptance contract for #13544. At the pinned revision, a plan-only request that encounters a payment wall can reach the next model account. Introduce a typed payment-required error containing the provider name. Return it before reading the upstream billing body. In the shared profile resolver, use errors.As on generation errors before appending the failure and continuing. Keep deterministic intent fallback and other caller behavior. The change stops fallback within this generation; it does not guarantee plan eligibility for the first provider or suppress separate generations begun by another hook. The mock regression exercises two loopback providers with no credentials. Its oracle is one request to the first, zero to the second, recoverable typed failure, and no upstream billing body in user diagnostics. Preserve the existing 503 fallback test.
The focused model-router change is tracked in #13544 and PR #13548. An independent API acceptance decision remains: the intent handler currently converts a generation refusal into a no-model response. Preserving the terminal billing decision and reporting its reason to callers are separate contracts.