@miadi/connector 0.1.27 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -60,13 +60,13 @@ A mission is found by the issue it implements (jgwill/Miadi#913). `request_autho
60
60
 
61
61
  **The agent's result (jgwill/Miadi#921).** An agent returns its work with `propose_session_completion` naming the mission in `mission`, from its bound session, with its evidence refs and, optionally, a structured `result`: `summary`, `outputs` (`ref`, `label`, `git_sha`), `tests` (`command`, `passed`, `failed`, `skipped`) and `blockers`. `mission_status` and `get_run_result` read it back by the mission id as `result`: the standing submission (the newest `verified` one: it names the mission, ends a bound session and was submitted with Miadi's write tier or the factory's writer token, which the connector records on the ending as `submitted_with_tier`; anything else naming the mission is `unverified_association` with an `association_code`, a mere citation `cited_only` and never a result), its summary, tests and blockers as the agent's claim, and each output typed and checked when read. A commit or file on GitHub is read through GitHub (`GITHUB_TOKEN` when the host has one): `verified` with its sha, `changed_since_submission` when its declared `git_sha` no longer matches or the file changed on its branch after the submission, `unverified` with the reason when GitHub cannot be read, never `not_found`. A connector record id the ledger does not hold is `not_found`. Bound sessions are taken from the factory's receipts for every reader, so the verdict is the same at every tier; below the write tier the session ids are left out. The completion decision stays the person's, and only a verified submission sets it: `stage_truth.completion` is `pending_approval`, `accepted`, `declined` or `revision_requested` (`none` for an unverified one, whose stage is `result_submitted_unverified`; an approved exit submitted below the write tier closes nothing), `pending_human_gates` lists what waits on a person with its approval page, and `mission_stage` names the furthest stage with evidence (`result_submitted_awaiting_completion_approval`, `completion_accepted`, `merged`, `released`, `closed`…). A duplicate submission (same session, ending and mission, still pending) is handed back with `replayed: true`, and `not_recorded` names what the second call carried that was not kept.
62
62
 
63
- `request_session_steer` sends one person's correction to a running agent, within the steering grant an approved run carries (`steering: { max_attempts, expires_at, pane }` on `request_authorized_run`). Busy is the normal case (jgwill/Miadi#930).
63
+ `request_session_steer` sends one person's correction to a running agent, within the steering grant an approved run carries (`steering: { max_attempts, expires_at, pane }` on `request_authorized_run`). Busy is the normal case (jgwill/Miadi#930). [`STEERING.md`](STEERING.md) is the contract every provider's adapter keeps (`miadi.steering/1`, jgwill/Miadi#942), with what was shown on real sessions of Claude Code, Pi, Copilot and Codex and each one's limits. `get_capabilities.steering` and `provider_capabilities` serve the same matrix, with what this host would load into a new session.
64
64
 
65
65
  | who | owns | never does |
66
66
  |---|---|---|
67
67
  | The person, through ChatGPT or any client | one correction, in scope | watch tools, wait for idle, send it again |
68
68
  | The connector | who may send it, the grant, mission → session → runtime, idempotency, handing it to that session's inbox, reporting what happened | decide when the model reads it, type into a working agent's pane, call a forward a delivery |
69
- | The runtime (Claude Code hooks: `miadi-session-observability` 0.1.34, `hooks/steering_inbox.mjs`) | the inbox, its order, the checks again at consumption, when its model reads it | deliver anything to a subagent or to another session |
69
+ | The runtime (each provider's adapter, in jgwill/miadi-orchestration-kit) | the inbox, its order, the checks again at consumption, when its model reads it | deliver anything to a subagent or to another session |
70
70
  | The model | reading it and changing what it does next | |
71
71
 
72
72
  The route comes from what each part signed: the factory's receipt names the session, Claude Code's own registry says it runs and in which pane, and the adapter's `adapter.json` says this session loaded its hooks. A wrong session is `stale_binding`, a wrong pane `wrong_pane`. A provider with no adapter, or a Claude session started before the adapter (hooks load at session start), answers `unsupported` with the reason and uses no attempt. No Claude Code behaviour is assumed of Codex, Copilot or Pi, and `get_capabilities.steering.contract` names the adapters that exist.
@@ -75,15 +75,15 @@ The inbox is `$MIADI_STEERING_DIR` (default `<factory>/steering`), `<session_id>
75
75
 
76
76
  Why hooks: Claude Code 2.1.318 has a native mid-turn queue, and `claude --help` offers no outside door to it. Typing reaches it through the keyboard, which is the terminal heuristic this replaces. The cross-session socket (`messagingSocketPath`) belongs to Claude sessions speaking to each other: its protocol is not published, and a connector speaking it would pose as a session. `PostToolUse.additionalContext` and `Stop` are its documented interface, so that is the adapter. Pi, Codex and Copilot have their own in-turn mechanisms, and none has an adapter here yet.
77
77
 
78
- `delivery` in the answer, in `get_run_result` on the steer's id, and in `mission_status.steering.steers` (write tier) says where it stands, each state with its source and time:
78
+ `delivery` in the answer, in `get_run_result` on the steer's id (`steers` on its run), and in `mission_status.steering.steers` (write tier) says where it stands, each state with its source and time. The steer's approval page shows the same states and times, without tool inputs:
79
79
 
80
80
  | state | means | source |
81
81
  |---|---|---|
82
82
  | `authorized` | the grant or a person's decision covered it | connector |
83
83
  | `forwarded_to_runtime`, `queued_at_runtime` | it is in the session's inbox; the model has not necessarily read it | connector, runtime inbox |
84
- | `delivered_to_agent_context` | Claude Code recorded it entering the context | the transcript's attachment record |
85
- | `acknowledged` | the agent's own next text names `steer <id> received` | the transcript |
86
- | `behavior_adjusted` | a later tool input holds what the steer named in `expect_next_action`; without that, `behavior: not_judged` and the next actions are shown for a person to judge | the transcript |
84
+ | `delivered_to_agent_context` | the agent recorded it among what it gave its model | its own record (Claude Code's transcript attachment, Pi's session file, Copilot's `events.jsonl`, Codex's rollout) |
85
+ | `acknowledged` | the agent's own next text names `steer <id> received` | its own record |
86
+ | `behavior_adjusted` | a later tool input holds what the steer named in `expect_next_action`; without that, `behavior: not_judged` and the next actions are shown for a person to judge | its own record |
87
87
  | `unsupported`, `expired`, `blocked` | it never reached the model, with the reason | connector or runtime hook |
88
88
  | `unknown` | claimed with no transcript record: ambiguous, and it is not sent again | |
89
89
 
@@ -91,14 +91,20 @@ The record itself moves with its evidence: `completed` once the model has it, `b
91
91
 
92
92
  `revoke_session_steering` stops a run's steering or one steer. What is still pending moves out at once, a marker stops anything later, and the answer says exactly what was revoked and what the agent had already consumed. The same idempotency key gets the first answer back, and the same words under a new key answer `duplicate`. Only a typed or forwarded steer uses one of the grant's attempts.
93
93
 
94
- An idle seat has no continuation coming, so it is the one case still typed: into the mission's bound pane, never whichever pane is active, with an exact tmux address (`=name:w.p`). It peeks first and re-peeks after. Text already at the prompt, or a prompt box that cannot be read, goes to the inbox when the seat has one and otherwise is `composing` or `blocked`, with nothing typed. A pane echo is not delivery: only a user record in the transcript moves it to `delivered_to_agent_context`. Every attempt leaves a durable artifact with the instruction's sha256, its grant and its target. The connector's service reaches the tmux server of the user it runs as; `get_capabilities.steering` says whether that answers now, and while it does not, `request_session_steer` records nothing and uses no attempt. A steer the grant does not cover waits for one explicit scoped human decision on its `approval_url`, which runs exactly that instruction once.
94
+ An idle seat takes the same inbox, and the connector types into no session that has an adapter (jgwill/Miadi#942). Pi's and Copilot's adapters start a turn themselves. A Codex seat gets `codex queue` from the factory runner. A Claude Code seat gets one line from the factory runner, which holds none of the correction's words and waits for anyone's words at the prompt; the connector asks for that at once with `miadi-factory-runner wake` (`MIADI_FACTORY_RUNNER_BIN`), and the runner's timer is the net. The one case still typed by the connector is a Claude Code session from before its adapter, idle with an empty prompt: into the mission's bound pane, never whichever pane is active, with an exact tmux address (`=name:w.p`). It peeks first, presses Enter again while the words still sit at the prompt, and re-peeks after. Text already at the prompt, or a prompt box it cannot read, stops it. Any other provider without an adapter answers `unsupported`, and nothing is typed.
95
95
 
96
- Rollback: run the connector version before this one (`git checkout` of its `dist`, then `systemctl --user restart miadi-connector`). A working agent's steer then answers `busy` again and nothing else changes. To stop the runtime half, remove the plugin's `steering_inbox.sh` entries from `hooks/hooks.json`; a new session then has no `adapter.json` and answers `unsupported`. Envelopes already queued stay on disk, unread.
96
+ Rollback: run the connector version before this one (`git checkout` of its `dist`, then `systemctl --user restart miadi-connector`). A steer to a Pi, Copilot or Codex session then answers `unsupported` again and nothing else changes. To stop an adapter, follow [`STEERING.md`](STEERING.md#rollback); a new session then has no `adapter.json` and answers `unsupported`. Envelopes already queued stay on disk, unread.
97
97
 
98
- `request_authorized_run` may name a `provider` (`codex`, `pi`, `copilot`, `claude`). The connector verifies it is installed on the host before recording anything; an unknown or unavailable provider answers `provider_unavailable` and the mission stays unstarted. With no provider named, the first installed provider in the preference order that may be picked by default (Pi, then Copilot) is resolved and named in the brief; Codex and Claude Code are never chosen silently, each runs only when named. `provider_capabilities` (write tier) reports what the host has installed, the sign-in evidence, the preference order, and the read-only Jev check: `unconfigured` without `JEV_AI_API_KEY` or `TYPESAFE_API_KEY` in the connector's environment, else the models Jev lists for the key (no charge). A provider name inside a task's text selects nothing.
98
+ `request_authorized_run` may name a `provider` (`codex`, `pi`, `copilot`, `claude`). The connector verifies it is installed on the host before recording anything; an unknown or unavailable provider answers `provider_unavailable` and the mission stays unstarted. With no provider named, a person's own default applies, then one the operator set for them, then Claude Code, and the result is named in the brief. A default that is missing or shows no sign-in leaves the mission unstarted, and no other provider stands in for it. Pi, Copilot and Codex otherwise run only when named. `provider_capabilities` (write tier) reports what the host has installed, the sign-in evidence, the preference order, and the read-only Jev check: `unconfigured` without `JEV_AI_API_KEY` or `TYPESAFE_API_KEY` in the connector's environment, else the models Jev lists for the key (no charge). A provider name inside a task's text selects nothing.
99
99
 
100
100
  **Codex runs only on its requester's own choice (jgwill/Miadi#926).** The provider field is the caller's: the connector cannot read the chat, so `provider: "codex"` chooses nothing for the person. A run that names Codex is recorded, and its answer says it `needs_person_choice`. The approval page then shows no Approve button. Only the requester, signed in there with their own Miadi person token, can tick and send "Choose codex for this mission". That `provider_choice` record is bound to the request id, its version and its content hash, must be under 24 hours old when the request is approved, and covers that one mission. A revision makes it stale. A generic Approve, on the page or on a card, is refused as `provider_choice_required`, and so is a choice by any other person or by a service token. The requester can instead set their own policy at `/providers` so their requests may name Codex without a per-mission choice; that policy is theirs only and revisable. The check runs at request, revision, approval, and where the brief is written (approval and every rerun). The brief carries `provider_authorization` and `provider_choice` (or `provider_policy`), and the factory runner refuses to launch Codex for a connector brief without them. `request_authorized_run`, `revise_pending_request`, `mission_status`, `show_decisions` and `mission_model_preflight` show `provider_authorization`; after approval it is also in the request's `completion_receipt`, which `get_run_result` returns. A Codex launch without it is named on the mission and fails the preflight closed as `provider_not_authorized`. A brief the runner refuses goes to `queue/refused/` with its reason, and the request shows it. Other providers keep their regular policy, and nothing falls back to Codex. What this does not cover: anyone who can write `/srv/miadi/factory/queue` or the connector's state directory can forge a brief or a record (the folder's permissions are the boundary); a configured launcher that runs Codex behind a wrapper whose name does not say codex is trusted as configured; a brief to an existing session reaches only an idle Claude Code agent today, so it is not checked; and an agent that starts `codex` itself from inside its session is outside the connector's reach.
101
101
 
102
+ **Which Claude Code model a run launches on.** `request_authorized_run` and `propose_work` may name a `model`, and that model is used. It must be on the host's permitted list, and a model named with any other provider is refused, so a model never moves a mission to a provider nobody chose. With none named, Jev chooses among the permitted models once, when the run is approved. It is sent the task type and criticality (`task_type`, `criticality`; default `implementation`, `normal`) and the candidates, never task text, a mission id or a repository name, and its choice authorizes nothing. If Jev has no key, is down, abstains, answers below the 0.8 floor or breaks the answer contract, the launch uses the configured Claude Code model, and the receipt's `fallback_reasons` says why. Jev knows these models only through the fit notes in `claude-models.ts`, which are the Factory's reading of Anthropic's descriptions and not a measurement: `implementation` fits Sonnet, `file_relevance` and normal `review` fit Opus, `architecture_refactor` and anything `security_critical` fit Fable. Its confidence is uncalibrated. A request that fills no `task_type` counts as `implementation`, so it goes to Sonnet even where Claude Code's own setting says Opus.
103
+
104
+ A session already running keeps its model: Jev is not asked, and a named model fails the run rather than being ignored. A request recorded before this behaviour launches as it was approved. If Claude Code is missing or shows no sign-in when a run is approved, the run fails with no brief and can be run again. The brief carries `model` and `model_source`, and the factory runner passes `--model`; publish the runner first, because a runner older than 0.1.5 ignores it. `mission_status` shows the choice, its source, the flag, the model the session's own transcript says answered, read when asked, and whether they match. A mismatch or an old runner is a note, and nothing is re-run. A config directory is sign-in evidence only: only the transcript shows a launch worked.
105
+
106
+ `factory.json` narrows the list and sets the fallback: `"claudeModels": ["opus", "sonnet"]`, `"claudeDefaultModel": "opus"`. Without them every model in `claude-models.ts` is permitted, and the fallback is the `model` in Claude Code's own settings. A list that leaves that setting out wins over it, and the fallback is then the first listed. A name goes on that list after a real answer shows it: `claude -p "Reply with OK." --model <name> --output-format json` names the model that answered under `modelUsage`, and an unknown name exits 1.
107
+
102
108
  `mission_model_preflight` (write tier) answers, for one mission, which provider and model fit its task type and criticality, and how that is known: contract `miadi.mission_model_preflight` v1, candidates with their configured default model, sign-in evidence (config directory only), quota `unknown`, policy eligibility, a review floor, and a recommendation or an abstention with reasons. Its `decider.source` is `static_fallback`, `jev` or `synthetic_fixture`. Jev is asked only with `consult_jev: true` and a key on the host; it is sent task type, criticality and candidates, never task text, mission id or repository, and its answer is advisory: uncalibrated, below 0.8 or outside the contract, the preflight abstains. A reported `launch` on another provider than the approved one answers `provider_mismatch` before anything is asked. It authorizes nothing. `bench/model-preflight-bench.mjs` compares the 0.1.12 baseline, the static preflight and Jev on synthetic scenarios; `bench/results/` keeps the runs.
103
109
 
104
110
  ### The mission standard
package/STEERING.md ADDED
@@ -0,0 +1,87 @@
1
+ # The steering contract: `miadi.steering/1`
2
+
3
+ A person controlling a mission sends one correction. It reaches that mission's running agent at the earliest continuation that agent supports, and what the model received and did is read from the agent's own record. jgwill/Miadi#942 holds the evidence. #930 holds the correction this was built from: the runtime owns delivery to the model.
4
+
5
+ ## Who owns what
6
+
7
+ | layer | owns | never does |
8
+ |---|---|---|
9
+ | Person, or the assistant they speak through | one correction, naming the mission | watch tools, wait for idle, retry |
10
+ | Connector (`runtime-steer.ts`, `steering-adapters.ts`) | admission, identity, grant, mission → session → provider, one durable envelope, reading delivery back | watch tools, type into an adapted session, choose the moment |
11
+ | Factory runner (`factory-runner/src/steering.js`, `adapters.js`) | the session's lifecycle: which session took a brief, and one prompt for an idle seat that cannot start a turn itself | read a correction's words |
12
+ | Adapter (jgwill/miadi-orchestration-kit) | the inbox, its order, every check again at consumption, the door into its agent | decide who may steer |
13
+ | The agent's own runtime | when its model reads it | |
14
+
15
+ ## The states
16
+
17
+ `authorized → forwarded_to_runtime → queued_at_runtime → delivered_to_agent_context → acknowledged → behavior_adjusted`, or `unsupported`, `expired`, `blocked`, `unknown`.
18
+
19
+ | state | who says so | what it proves |
20
+ |---|---|---|
21
+ | `queued_at_runtime` | the connector's write, the inbox file | the correction is durable. It proves nothing about the model |
22
+ | `delivered_to_agent_context` | the agent's own record | the agent wrote it among what it gave its model |
23
+ | `acknowledged` | the agent's own record | the model's later text names the steer back |
24
+ | `behavior_adjusted` | the agent's own record | one of the next five tool inputs after delivery holds the words the steer named in `expect_next_action`. Words are evidence, not intent: a `grep` for them reads the same, so the page shows the action for a person to read |
25
+ | `unknown` | the connector | a claim with no record. It is not sent again |
26
+
27
+ A pane echo, a spinner, an inbox file and a hook's stdout prove none of the middle three. Without `expect_next_action`, whether the next actions follow the correction is a person's judgment, and the state stays at `acknowledged` with `behavior: not_judged`.
28
+
29
+ `acknowledged` can be skipped. A Claude Code transcript does not always hold text written just before a tool call, as on the production baseline in jgwill/Miadi#942, where the model's "received" never reached the file and `behavior_adjusted` still did. Its absence shows nothing either way.
30
+
31
+ ## The inbox
32
+
33
+ `<factory>/steering/<session_id>/`, owned by one Unix account, mode 0700.
34
+
35
+ | path | written by | meaning |
36
+ |---|---|---|
37
+ | `adapter.json` | adapter, at session start | this session loaded its adapter: `protocol`, `contract`, `provider`, `adapter`, `adapter_version`, `session_id`, `transcript_path`, `pid`, `pane`, `tmux_socket`, `guarantee` |
38
+ | `pending/<order>-<steer>.json` | connector, by one rename after fsync | the envelope: `protocol`, `steer`, `grant`, `session_id`, `provider`, `instruction`, `instruction_sha256`, `from`, `queued_at`, `expires_at`, `decided`, `transcript_path`, `transcript_offset` |
39
+ | `claimed/` | adapter, by one rename | taken for delivery, exactly once, never replayed |
40
+ | `expired/`, `withdrawn/`, `rejected/` | adapter or connector | never shown to the model, each with its receipt |
41
+ | `revoked/<id>` | connector | checked at consumption |
42
+ | `receipts.jsonl` | adapter, runner, connector | what each did, with source and time |
43
+ | `seat.json` | a hook adapter with no registry to read | `idle` or `busy`, for the runner |
44
+
45
+ What this keeps:
46
+
47
+ - **One address.** The runner's receipt names the session and pane. A provider with no registry is found by its pane on this tmux server, because a pane number is unique only within its server, among living adapters of that provider. None is `unsupported`, two is `wrong_pane`, a dead pid is `stale_binding`, another provider, another server or a moved pane is `wrong_pane`.
48
+ - **Nothing lost, nothing twice.** A steer's id keeps it single across a retry or a connector restart. A dropped client changes nothing. A session that dies keeps its pending envelopes until it resumes or they expire. A door that refuses the hand-off (Pi during compaction, a rejected Copilot send) returns the envelope to the inbox, and it is tried again. A claim whose fate is unknown is never replayed.
49
+ - **Whose mission.** A grant covers the person who asked for the run, the person who approved it and the host's service token. Anyone else with the write tier gets `awaiting_approval`, and a person decides that one steer.
50
+ - **Authority.** The grant and its budget are checked at admission. Expiry, revocation, session, protocol and hash are checked again at consumption. The text names who sent it, says it carries no new permissions, and cannot close its own delimiter.
51
+ - **Nothing interrupted.** No Ctrl+C, no raw keys into a working pane, no second agent.
52
+
53
+ ## Providers
54
+
55
+ `steering-adapters.ts` holds this table as data, and `get_capabilities.steering` and `provider_capabilities` serve it. A CLI version no real session has passed on reads as `untested_cli_version`.
56
+
57
+ | provider | door while working | door when idle | model reads it as | evidence read | tested on |
58
+ |---|---|---|---|---|---|
59
+ | Claude Code | `PostToolUse`, `PostToolUseFailure` additionalContext, then `Stop` block | `asyncRewake` watcher for 30 s, then the runner's prompt and `UserPromptSubmit` | hook context | transcript attachment | 2.1.319 |
60
+ | Pi | its steering queue, `pi.sendUserMessage(text, { deliverAs: "steer" })` | the same call starts a run | user message | session JSONL | 1.4.0 |
61
+ | GitHub Copilot CLI | `session.send({ mode: "immediate" })`, held until tools in flight finish | the same call starts a turn | user message | `events.jsonl` | 1.0.107 |
62
+ | Codex CLI | `PostToolUse` additionalContext, then `Stop` block | `codex queue --thread` from the runner, then `UserPromptSubmit` | developer message | rollout JSONL | 0.166.0 |
63
+ | Gemini, others | none | none | | | answers `unsupported` |
64
+
65
+ ### Limits seen on real sessions
66
+
67
+ - **Every provider:** a running tool finishes first, so a long tool delays the correction by its own length. Adapters load at session start, so a session started before its adapter answers `unsupported` and is never typed into.
68
+ - **Pi:** a person's abort returns queued words to their editor. The adapter then records `left_provider_queue`, delivery reads `unknown`, and nothing sends them again.
69
+ - **Copilot:** extensions load only when `enabledFeatureFlags.EXTENSIONS` is on, which its installer sets. The `--experimental` flag also turns them on, and writes `experimental: true` into `~/.copilot/settings.json` for every later session, so nothing here passes it. A shell command starting just as a correction arrives moves to the background and keeps running, so its line of work may finish after the corrected action. Copilot updates itself, so a newer version reads as untested until a real session passes on it.
70
+ - **Codex:** the correction arrives as developer-role context, because that is what its hook door writes. The text still names the person and claims no new permission. `turn/steer` on Codex's app-server would carry it as a user message, and is not built or tested here. Codex runs no untrusted hook, and its TUI stops at "Hooks need review" at start while any hook on the account is new or modified, which a brief typed into it would answer. `codex/miadi-steering/install.mjs` trusts its own hooks exactly, and `--also-trust-kit-plugin` covers the kit's plugin.
71
+ - **Claude Code:** a session from before its adapter, idle with an empty prompt, is the one case still typed by the connector. Its next state is `unknown` until the transcript shows the prompt. On 2.1.319 an Enter sent straight after the text left it at the prompt, so Enter is pressed again, at most three times.
72
+
73
+ ## A new provider
74
+
75
+ 1. Find its real door: a native queue, a lifecycle callback or a thread message. A tmux paste is not one.
76
+ 2. Copy `steering_inbox.mjs` with `scripts/sync-steering-inbox.sh`, and write the adapter around it.
77
+ 3. Add it to `ADAPTERS` and `LINE_READERS`, with fixtures in the shape a real session wrote.
78
+ 4. Pass the kit's `tests/steering/conformance.test.mjs`, then `tests/steering/live-probe.mjs` for `busy`, `no_next_tool`, `idle`, `two`, `no_adapter` and `restart`.
79
+ 5. Only then add its version to `tested_on`.
80
+
81
+ ## Which provider a request runs on
82
+
83
+ A named provider is used, or the request is left unstarted. With none named, a person's own default from `/providers` applies, then one the operator set for them in `factory.json` (`person_default_provider`), then Claude Code. A default that is not installed or shows no sign-in leaves the mission unstarted and is never replaced. Codex is never a default (#926). The answer to `request_authorized_run`, the decision card and `mission_status` say whether a session of that provider could be corrected before anyone depends on it.
84
+
85
+ ## Rollback
86
+
87
+ Run the connector version before this one, and restart `miadi-connector`. A steer to a non-Claude session then answers `unsupported` again and nothing else changes. To stop an adapter: `pi/miadi-session-observability/package.json` without `steering-inbox.ts`, `copilot/miadi-steering/install.sh --remove`, `node codex/miadi-steering/install.mjs --remove`. A new session then answers `unsupported`. Envelopes already queued stay on disk, unread.
package/dist/approve.d.ts CHANGED
@@ -17,8 +17,9 @@ import { type MiadiPerson } from "./people.js";
17
17
  import { type ConnectorRecord } from "./records.js";
18
18
  import { type RequestProjection } from "./request-state.js";
19
19
  import type { DraftReviewService } from "./draft-review.js";
20
- import type { RuntimeDeps } from "./runtime-steer.js";
20
+ import { type RuntimeDeps } from "./runtime-steer.js";
21
21
  import { type TmuxLike } from "./steer.js";
22
+ import { type ModelRoutingDeps } from "./claude-models.js";
22
23
  import { type FetchCaptions } from "./captions.js";
23
24
  import { type ProviderAuthorization } from "./provider-policy.js";
24
25
  export { factoryDir, runBriefFile, readQueueState } from "./queue-state.js";
@@ -32,6 +33,12 @@ export interface ApprovalDeps {
32
33
  fetchImpl?: typeof fetch;
33
34
  /** The factory directory holding queue/ (default /srv/miadi/factory). */
34
35
  factoryDir?: string;
36
+ /** Whether a session of this provider could be corrected once it works: said before a person approves (jgwill/Miadi#942). */
37
+ steeringOf?: (provider: string) => {
38
+ steerable: boolean;
39
+ basis: string;
40
+ reason?: string;
41
+ };
35
42
  tmuxSessions?: () => string[];
36
43
  /** The steering surface (jgwill/Miadi#893); tests inject a fake, production uses tmux. */
37
44
  tmux?: TmuxLike;
@@ -39,6 +46,10 @@ export interface ApprovalDeps {
39
46
  steerSettleMs?: number;
40
47
  /** Where sessions and their steering inboxes live (jgwill/Miadi#930). Absent, no runtime route is known. */
41
48
  steeringRuntime?: RuntimeDeps;
49
+ /** Asks the factory runner for a pass now. Its timer is the net (jgwill/Miadi#942). */
50
+ wakeRunner?: () => void;
51
+ /** How a run's Claude Code model is chosen when its brief is written (jgwill/Miadi#943). */
52
+ modelRouting?: ModelRoutingDeps;
42
53
  /** Reads a video's captions for an approved create; without it a create stores no transcript (tests, other embedders). */
43
54
  captions?: FetchCaptions;
44
55
  /** The link a named person decides a consent request on; set where the decision secret is held. */
@@ -81,6 +92,7 @@ export declare function episodeReferences(record: ConnectorRecord): string[];
81
92
  /** Whether the owner of this video's source registered it as withheld. */
82
93
  export declare function sourceWithheld(records: ConnectorRecord[], videoId: unknown): boolean;
83
94
  export declare function executeApproved(record: ConnectorRecord, approver: MiadiPerson, deps: ApprovalDeps, instructions?: string): Promise<Record<string, unknown>>;
95
+ export declare function page(title: string, body: string): string;
84
96
  /**
85
97
  * Record a person's decision on a request and, when approved, run it once as
86
98
  * them. The approval page and the in-chat approval card both decide here; the
@@ -170,7 +182,11 @@ export declare function rerun(r: ConnectorRecord, person: MiadiPerson, deps: App
170
182
  }>;
171
183
  export declare function isApprovable(r: ConnectorRecord | undefined): r is ConnectorRecord;
172
184
  /** What approving a request does, in one sentence, for the card a person decides on. */
173
- export declare function consequenceOf(r: ConnectorRecord, authorization?: ProviderAuthorization, records?: ConnectorRecord[]): string;
185
+ export declare function consequenceOf(r: ConnectorRecord, authorization?: ProviderAuthorization, records?: ConnectorRecord[], steering?: {
186
+ steerable: boolean;
187
+ basis: string;
188
+ reason?: string;
189
+ }): string;
174
190
  export declare function registerApprovalRoutes(app: Express, deps: ApprovalDeps): void;
175
191
  /**
176
192
  * The page a person named in a consent request decides on. Their link is the door: a person who never
@@ -193,6 +209,6 @@ export declare function requestProjection(record: ConnectorRecord, opts?: {
193
209
  factoryDir?: string;
194
210
  }): RequestProjection | null;
195
211
  /** The person's own provider policy page: read and change it, signed in with their person token (jgwill/Miadi#926). */
196
- export declare function registerProviderPolicyRoutes(app: Express, deps: Pick<ApprovalDeps, "ledger" | "identify" | "log">): void;
212
+ export declare function registerProviderPolicyRoutes(app: Express, deps: Pick<ApprovalDeps, "ledger" | "identify" | "log" | "factoryDir">): void;
197
213
  /** How a request is named to a person. */
198
214
  export declare const KIND_LABELS: Record<string, string>;