graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Advertise supported worker effort and refresh SDK types
Rach Pradhanafea4869f0d3
diff --git a/examples/edge-worker/src/remote.ts b/examples/edge-worker/src/remote.tsindex 6b3dcd41..c8ee80cd 100644--- a/examples/edge-worker/src/remote.ts+++ b/examples/edge-worker/src/remote.ts@@ -118,8 +118,8 @@ export interface AnswerOptions {callId?: string;}-/** Reasoning effort levels accepted by setEffort (protocol set_effort). */-export type EffortLevel = "low" | "medium" | "high" | "xhigh" | "max" | "ultra";+/** Reasoning effort levels for setEffort; `none` requires a supported model route. */+export type EffortLevel = "none" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra";/** Structured result of one turn: the final assistant text plus the usage* the harness reported on the terminal `turn` event. */diff --git a/scripts/eval/tier1-manifest.json b/scripts/eval/tier1-manifest.jsonindex c99e4d47..20da3b1f 100644--- a/scripts/eval/tier1-manifest.json+++ b/scripts/eval/tier1-manifest.json@@ -15,7 +15,7 @@"src/repl.zig","TUI/root.zig"],- "test_count_baseline": 2750,+ "test_count_baseline": 2776,"test_count_slack": 25,"required_invariants": [{diff --git a/sdk/generate.py b/sdk/generate.pyindex b55fac16..00057cf9 100644--- a/sdk/generate.py+++ b/sdk/generate.py@@ -143,8 +143,8 @@ export interface AnswerOptions {{callId?: string;}}-/** Reasoning effort levels accepted by setEffort (protocol set_effort). */-export type EffortLevel = "low" | "medium" | "high" | "xhigh" | "max" | "ultra";+/** Reasoning effort levels for setEffort; `none` requires a supported model route. */+export type EffortLevel = "none" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra";/** Structured result of one turn: the final assistant text plus the usage* the harness reported on the terminal `turn` event. */@@ -837,8 +837,8 @@ export interface AnswerOptions {{callId?: string;}}-/** Reasoning effort levels accepted by setEffort (protocol set_effort). */-export type EffortLevel = "low" | "medium" | "high" | "xhigh" | "max" | "ultra";+/** Reasoning effort levels for setEffort; `none` requires a supported model route. */+export type EffortLevel = "none" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra";/** Structured result of one turn: the final assistant text plus the usage* the harness reported on the terminal `turn` event. */diff --git a/sdk/ts/harness.ts b/sdk/ts/harness.tsindex f3e7d47f..86f2ac23 100644--- a/sdk/ts/harness.ts+++ b/sdk/ts/harness.ts@@ -106,8 +106,8 @@ export interface AnswerOptions {callId?: string;}-/** Reasoning effort levels accepted by setEffort (protocol set_effort). */-export type EffortLevel = "low" | "medium" | "high" | "xhigh" | "max" | "ultra";+/** Reasoning effort levels for setEffort; `none` requires a supported model route. */+export type EffortLevel = "none" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra";/** Structured result of one turn: the final assistant text plus the usage* the harness reported on the terminal `turn` event. */diff --git a/sdk/ts/remote.ts b/sdk/ts/remote.tsindex 6b3dcd41..c8ee80cd 100644--- a/sdk/ts/remote.ts+++ b/sdk/ts/remote.ts@@ -118,8 +118,8 @@ export interface AnswerOptions {callId?: string;}-/** Reasoning effort levels accepted by setEffort (protocol set_effort). */-export type EffortLevel = "low" | "medium" | "high" | "xhigh" | "max" | "ultra";+/** Reasoning effort levels for setEffort; `none` requires a supported model route. */+export type EffortLevel = "none" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra";/** Structured result of one turn: the final assistant text plus the usage* the harness reported on the terminal `turn` event. */diff --git a/src/mimo_effort_tests.zig b/src/mimo_effort_tests.zigindex 8df70f49..8264ab11 100644--- a/src/mimo_effort_tests.zig+++ b/src/mimo_effort_tests.zig@@ -3,6 +3,19 @@ const provider = @import("provider.zig");const schema = @import("schema.zig");const fixtures = @import("agent_request_body_responses.zig");+test "worker tool schema exposes supported Off and describes route rejection" {+ const raw = @import("schema_agents.zig").subagent_spec.schema;+ const parsed = try std.json.parseFromSlice(std.json.Value, std.testing.allocator, raw, .{});+ defer parsed.deinit();+ const effort = parsed.value.object.get("properties").?.object.get("effort").?.object;+ var offered = false;+ for (effort.get("enum").?.array.items) |value| {+ if (std.mem.eql(u8, value.string, "none")) offered = true;+ }+ try std.testing.expect(offered);+ try std.testing.expect(std.mem.indexOf(u8, effort.get("description").?.string, "rejected before child inference elsewhere") != null);+}+test "MiMo Chat uses the documented binary thinking switch on direct and gateway routes" {var state = std.heap.ArenaAllocator.init(std.testing.allocator);defer state.deinit();diff --git a/src/schema_agents.zig b/src/schema_agents.zigindex 99d9e268..4d4e5db5 100644--- a/src/schema_agents.zig+++ b/src/schema_agents.zig@@ -5,7 +5,7 @@ pub const subagent_spec = ToolSpec{.name = "subagent",.desc = "Delegate a self-contained sidecar task; children have file, shell, codedb and skill tools, no parent context, and cannot spawn children. Brief once with context, prompt, established_facts, scope and deliverable. Keep critical-path work local; use disjoint write sets for parallel tasks. Do not set model without a user request or task-specific reason. agent selects a persona; system_prompt overrides it. Set retained=true to preserve conversation and workspace for follow-up and return a durable task_id; omitted/false leaves the worker ephemeral. Interactive calls run in background; headless calls return the report unless run_in_background=true. agent_message queues feedback without starting a turn; subagent_resume continues a completed worker with its history. agent_output fetches background results; wait_ms>0 waits in headless mode. Do not poll.",.schema =- \\{"type": "object", "properties": {"description": {"type": "string", "description": "Short label for logs, 3-5 words"}, "prompt": {"type": "string", "description": "Numbered steps and search hints; the complete task. Optional context/established_facts/scope/deliverable render as headed sections around this"}, "context": {"type": "string", "description": "Optional: repo and hard constraints the child must not re-derive"}, "established_facts": {"type": "string", "description": "Optional: observed facts, paths, and line numbers the child must treat as given"}, "scope": {"type": "string", "description": "Optional: what not to touch or broaden into"}, "deliverable": {"type": "string", "description": "Optional: required report shape; default is files changed, verified, skipped, open questions"}, "agent": {"type": "string", "description": "Optional: a named agent type (reviewer, researcher, implementer, skeptic, or a .harness/agents/ name) whose persona the child runs with"}, "system_prompt": {"type": "string", "description": "Optional: replace the child's system prompt with a custom one (overrides agent)"}, "model": {"type": "string", "description": "Optional: run THIS child on an exact model name available on the current provider (e.g. \"gpt-5.6-luna\"). Highest precedence — beats the persona's own pin and the session default. Ignored (spawn still runs on the session default, with a trace note) if the name is unknown, ambiguous, or not served by this provider — except that a logged-in flat-rate subscription serving the exact name honors it (sub-first routing; the login is the standing consent). For a portable 'cheapest seat' ask, tier is still the better lever."}, "tier": {"type": "string", "enum": ["frontier", "mid", "small"], "description": "Optional: run THIS child on a rung of the current provider's model ladder instead of an exact name — frontier (planner/judge class), mid (reviewers, implementers, researchers), small (mechanical transform/extract/label). Prefer this over model: it stays correct when the root model changes. If the provider has no ladder or no model at that rung, sub-first routing seats the child on a logged-in flat-rate subscription's rung when one exists (no login → the pin is ignored); model wins if both are given."}, "effort": {"type": "string", "enum": ["low", "medium", "high", "xhigh", "max"], "description": "Optional: reasoning effort for THIS child — beats the persona's effort: frontmatter; unpinned children run at medium. An axis independent of model/tier: an effort-only override keeps the persona's model pin. An off-vocabulary value is ignored with a trace note."}, "isolation": {"type": "string", "enum": ["shared_cwd", "worktree"], "description": "Optional: independent / fan-out children default to \"worktree\" (own branch + checkout; clean unchanged trees are removed unless retained=true; dirty or uniquely committed trees are kept + reported). Use \"shared_cwd\" only for same-branch collaboration (review + fix, a pipeline). isolation_fallback:true is the only way a failed git worktree add may share the caller tree."}, "isolation_fallback": {"type": "boolean", "description": "Optional: if isolation:\"worktree\" fails to set up (not a git repo, git error), run in the shared working tree instead of failing the spawn. Default false (fails the spawn on setup failure)."}, "retained": {"type": "boolean", "description": "Optional: persist conversation and workspace for subagent_resume (default false)."}, "run_in_background": {"type": "boolean", "description": "Optional: start this subagent asynchronously and return its agent id immediately instead of waiting for it to finish (headless default false; interactive REPL always backgrounds direct subagents). Do not poll; headless agent_output(wait_ms>0) blocks until it finishes. A spawn at the live concurrency cap is refused; do not spawn a child to clean up a finished worktree."}}, "required": ["description", "prompt"]}+ \\{"type": "object", "properties": {"description": {"type": "string", "description": "Short label for logs, 3-5 words"}, "prompt": {"type": "string", "description": "Numbered steps and search hints; the complete task. Optional context/established_facts/scope/deliverable render as headed sections around this"}, "context": {"type": "string", "description": "Optional: repo and hard constraints the child must not re-derive"}, "established_facts": {"type": "string", "description": "Optional: observed facts, paths, and line numbers the child must treat as given"}, "scope": {"type": "string", "description": "Optional: what not to touch or broaden into"}, "deliverable": {"type": "string", "description": "Optional: required report shape; default is files changed, verified, skipped, open questions"}, "agent": {"type": "string", "description": "Optional: a named agent type (reviewer, researcher, implementer, skeptic, or a .harness/agents/ name) whose persona the child runs with"}, "system_prompt": {"type": "string", "description": "Optional: replace the child's system prompt with a custom one (overrides agent)"}, "model": {"type": "string", "description": "Optional: run THIS child on an exact model name available on the current provider (e.g. \"gpt-5.6-luna\"). Highest precedence — beats the persona's own pin and the session default. Ignored (spawn still runs on the session default, with a trace note) if the name is unknown, ambiguous, or not served by this provider — except that a logged-in flat-rate subscription serving the exact name honors it (sub-first routing; the login is the standing consent). For a portable 'cheapest seat' ask, tier is still the better lever."}, "tier": {"type": "string", "enum": ["frontier", "mid", "small"], "description": "Optional: run THIS child on a rung of the current provider's model ladder instead of an exact name — frontier (planner/judge class), mid (reviewers, implementers, researchers), small (mechanical transform/extract/label). Prefer this over model: it stays correct when the root model changes. If the provider has no ladder or no model at that rung, sub-first routing seats the child on a logged-in flat-rate subscription's rung when one exists (no login → the pin is ignored); model wins if both are given."}, "effort": {"type": "string", "enum": ["low", "medium", "high", "xhigh", "max", "none"], "description": "Optional: reasoning effort for THIS child — beats the persona's effort: frontmatter; unpinned children run at medium. An axis independent of model/tier: an effort-only override keeps the persona's model pin. none disables thinking only on supported binary-thinking routes and is rejected before child inference elsewhere. An off-vocabulary value is ignored with a trace note."}, "isolation": {"type": "string", "enum": ["shared_cwd", "worktree"], "description": "Optional: independent / fan-out children default to \"worktree\" (own branch + checkout; clean unchanged trees are removed unless retained=true; dirty or uniquely committed trees are kept + reported). Use \"shared_cwd\" only for same-branch collaboration (review + fix, a pipeline). isolation_fallback:true is the only way a failed git worktree add may share the caller tree."}, "isolation_fallback": {"type": "boolean", "description": "Optional: if isolation:\"worktree\" fails to set up (not a git repo, git error), run in the shared working tree instead of failing the spawn. Default false (fails the spawn on setup failure)."}, "retained": {"type": "boolean", "description": "Optional: persist conversation and workspace for subagent_resume (default false)."}, "run_in_background": {"type": "boolean", "description": "Optional: start this subagent asynchronously and return its agent id immediately instead of waiting for it to finish (headless default false; interactive REPL always backgrounds direct subagents). Do not poll; headless agent_output(wait_ms>0) blocks until it finishes. A spawn at the live concurrency cap is refused; do not spawn a child to clean up a finished worktree."}}, "required": ["description", "prompt"]},};diff --git a/src/subagent_pin.zig b/src/subagent_pin.zigindex f3308229..27bab4ee 100644--- a/src/subagent_pin.zig+++ b/src/subagent_pin.zig@@ -12,15 +12,14 @@//! 2. One `subagent` call may pin `model` / `tier` for that spawn only.//!//! The same two grains can pin reasoning EFFORT — frontmatter `effort: max`-//! or an `effort` param on the call (low|medium|high|xhigh|max — the /effort+//! or an `effort` param on the call (low|medium|high|xhigh|max|none — the /effort//! vocabulary minus `ultra`, which is the ultracode prompt switch, not a//! depth a worker should inherit). Effort is an INDEPENDENT AXIS from//! model/tier: each falls through spawn → persona → session default on its//! own, so an effort-only override keeps the persona's model pin (and vice-//! versa). Unlike a model pin it needs no catalog resolution — a model that-//! rejects reasoning_effort already degrades per request (effort_rejected in-//! agent_request.zig) — so an effort pin is either applied as stated or-//! reported off-vocabulary, never provider-dependent.+//! versa). An explicit `none` is only supported by known binary-thinking+//! routes; an unsupported worker pin is refused before inference. Other+//! valid efforts retain the existing per-request rejection fallback.//!//! PRECEDENCE (what the tool schema advertises, implemented by `requested`//! and `resolve` below):@@ -146,7 +145,7 @@ pub const EffortOutcome = enum {return switch (self) {.none => "",.pinned => "effort pin applied",- .unknown_effort => "effort pin ignored: expected low, medium, high, xhigh or max — kept the session default",+ .unknown_effort => "effort pin ignored: expected low, medium, high, xhigh, max or supported none — kept the session default",.unsupported_effort => "Off is unsupported by this model; choose a supported effort",};}