Repository navigation
feat(mcpx): script-side generate — daemon route, TS global, op declaration (#1925 slice) - #16941
Merged
Merged
Conversation
…ation (#1925 slice) Implements the settled contract in pkgs/mcpx/docs/script-generate.md (#14183) for TypeScript/JavaScript script calls: - POST /v1/generate (internal/daemon/routes_generate.go): strict options validation (unknown fields, empty prompt, bad timeout, malformed model id, non-object schema are all `rejected` values, never throws); resolves the daemon's model layer with NO sampling or plugin answerer installed (contract section 3 — explicit sampling/plugin selection is `unavailable`, profile/auto selection never installs them); per-call ask capped by profile budget then model.budget via the shared ModelTokenCap rule; earliest-of deadlines (run, call timeout, model.timeout); results are the discriminated union with the section 6 errorKind taxonomy, and provider failure text is fixed-shape so raw provider payloads and credentials never leak into a script-visible error. - Generated client: `generate()` global + GenerateOptions / GenerateResult types + ambient declaration (codegen/emit.go). Python and Roc clients do not advertise it (contract section 2). - The `generate` operation is declared in internal/api/ops.go, which regenerates plugin/core/ops.gen.ts (dogfood copy synced, all three mcpx.yml sync diffs clean) and docs/parity.md (98 ops, 77 CLI commands; the generated `mcpx generate` CLI and `mcpx_generate` MCP tool come from the table). - docs/script-generate.md status updated to implemented. Verification (authoring worktree on the laptop, rebased onto main be0aa65): go build ./... clean; go vet clean on touched packages; new daemon tests 7/7 pass (unavailable for none/sampling, 10 rejected shapes, provider answers with system-first messages and the budget cap observed at the endpoint, provider failure hides the raw payload, call timeout classifies as timeout, handler answers 200 + result JSON); full internal/daemon suite pass (170s); internal/api, internal/model, internal/refdoc, internal/settings, and the codegen TS/client/globals tests pass. Two failures in the wider tree are pre-existing on pristine main and unrelated: codegen TestRocModulePassesCompiler (Roc stdlib drift) and cli TestInlineDaemonPollIntervalChangesRetryCount — both reproduced on unmodified origin/main. Refs #1925 (one bounded slice: the track stays open for the Python and Roc bindings and any later sampling/plugin capability slice). Lane 1222-F (delta PRESS author lane, 2026-11-29).
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
This was referenced Nov 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1925 — one bounded slice: the script-side
generatesurface, per the settled contract inpkgs/mcpx/docs/script-generate.md(#14183, closed). The #1925 track stays open for the Python/Roc bindings and any later sampling/plugin capability slice.What lands
POST /v1/generate(internal/daemon/routes_generate.go): strict options validation — unknown fields, empty prompt, bad/nonpositive timeout, malformed model id, non-object schema are allrejectedvalues (contract §6: a model-side outcome is never a throw). Resolution goes through the existing model layer with no sampling or plugin answerer installed (§3): explicit sampling/plugin selection returnsunavailable, profile/auto selection never installs them as fallbacks. Per-call ask capped by profile budget thenmodel.budget(the sharedModelTokenCaprule); deadlines take the earliest of run deadline, calltimeout, andmodel.timeout. Provider-failure text is fixed-shape — raw provider payloads never reach a script-visible error (§6).generate()global +GenerateOptions/GenerateResult+ ambient declaration (internal/codegen/emit.go). Only a missing/non-object argument throws (TypeError), per §1/§6. Python and Roc clients do not advertisegenerate(§2).internal/api/ops.go, regeneratingplugin/core/ops.gen.ts(dogfood copy in.opencode/plugin/coresynced — all three mcpx.yml sync diffs clean) anddocs/parity.md(98 ops / 77 CLI commands;mcpx generateCLI +mcpx_generateMCP tool come from the table).docs/script-generate.mdstatus updated to implemented.Verification
Authoring worktree on the laptop, rebased onto main
be0aa65945a(named fallback: laptop-local test runs in the authoring worktree, the route PR #16927 used; sandbox fleet Actions exec dispatch is on the #16824 jam):go build ./...clean;go vetclean on touched packages; gofmt clean.providerand its raw body marker does not appear in the result error; a 50 ms call timeout against a 2 s endpoint classifiestimeout; the HTTP handler answers 200 with the result JSON.internal/daemonsuite pass (170 s);internal/api,internal/model,internal/refdoc,internal/settingspass; codegen TS/client/globals tests pass.origin/main, unrelated to this diff: codegenTestRocModulePassesCompiler(Roc stdlib drift) and cliTestInlineDaemonPollIntervalChangesRetryCount.Diff read against purpose: 9 files, +610/−12 — daemon handler + tests (new), one route line, one op entry, codegen global/declaration/client function, two generated files, two docs. No model-layer changes were needed: profiles, the routing guarantee, and typed exhaustion already landed; this slice wires the surface to them.
Lane 1222-F (delta PRESS author lane, 2026-11-29). Claim: #1925 comment 7260560797.
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-29T18:52:23Z", "session_id": null, "lane": null, "host": "amd", "worktree": "/home/user/git/code-wt-1222f-1925", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/user/git/code-wt-1222f-1925", "repo": "developing-today/code", "branch": "lane/1222f-1925-generate", "sha": "94fed5fd2d96a8cebee73e571092015cbb1a89fc" }, "auth_subject": "oc-code-05", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.