@miadi/connector 0.1.26 → 0.1.28
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 +18 -9
- package/STEERING.md +87 -0
- package/dist/approve.d.ts +29 -3
- package/dist/approve.js +352 -18
- package/dist/bin.js +5 -0
- package/dist/captions.d.ts +7 -0
- package/dist/captions.js +2 -2
- package/dist/decisions.d.ts +4 -1
- package/dist/decisions.js +10 -1
- package/dist/mission-status.d.ts +5 -0
- package/dist/mission-status.js +7 -1
- package/dist/provider-policy.d.ts +9 -1
- package/dist/provider-policy.js +14 -4
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +12 -1
- package/dist/records.d.ts +1 -1
- package/dist/records.js +1 -0
- package/dist/request-state.d.ts +1 -1
- package/dist/request-state.js +3 -1
- package/dist/runtime-steer.d.ts +23 -9
- package/dist/runtime-steer.js +272 -35
- package/dist/server.d.ts +3 -1
- package/dist/server.js +18 -2
- package/dist/steer.d.ts +8 -1
- package/dist/steer.js +60 -32
- package/dist/steering-adapters.d.ts +78 -0
- package/dist/steering-adapters.js +214 -0
- package/dist/tools.d.ts +7 -16
- package/dist/tools.js +122 -20
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -2
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 (
|
|
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` |
|
|
85
|
-
| `acknowledged` | the agent's own next text names `steer <id> received` |
|
|
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 |
|
|
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,9 +91,9 @@ 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
|
|
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
|
|
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
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.
|
|
99
99
|
|
|
@@ -126,7 +126,16 @@ The drafter gets two rounds: a report and a revision, twice. The third report's
|
|
|
126
126
|
|
|
127
127
|
In a client that renders MCP Apps (ChatGPT among them), `show_decisions` draws one card per request awaiting a decision: what is asked, by whom, and what approving does. The person decides on the card with their own click: Approve, Approve with my changes, Send back for revision, or Decline. The card then shows the receipt.
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
**An empty card in ChatGPT.** ChatGPT keeps the tool metadata it read when the connection was made or refreshed, and draws an empty box for a template it cannot read. Keep these true:
|
|
130
|
+
|
|
131
|
+
- A card change that breaks the template gets a new URI, and every earlier URI stays readable (`DECISIONS_CARD_EARLIER_URIS`, pinned by a test).
|
|
132
|
+
- After a change to a card or a tool, reconnect the connector in ChatGPT or select **Refresh** at chatgpt.com/plugins, then start a new conversation. Other clients do the same in their own settings.
|
|
133
|
+
- `journalctl --user -u miadi-connector | grep -E 'card_template_read|"show_decisions"'` says what a host asked for. A `show_decisions` line with no template read means the host drew from what it holds.
|
|
134
|
+
- While a card is empty, the request's `approval_url` decides the same request.
|
|
135
|
+
|
|
136
|
+
Earned 2026-11-06: 0.1.22 moved the card to `decisions-v2.html` and stopped serving v1, and the card stayed empty in the iOS app. After the person reconnected the connector, ChatGPT read v2 and a card approval went through.
|
|
137
|
+
|
|
138
|
+
**The approval page has two steps.** The first signs in and approves nothing. The second reads "Not approved yet: decide here" and holds the buttons. `page_post` in the journal records what each signed-in post carried, with `decision: null` for a sign-in.
|
|
130
139
|
|
|
131
140
|
A decision is recorded once. An approved run that calls another service (a review operation, Deep Diver, an episode door, a steer) is written to the ledger as approved and running before the call, so a restart can never offer the request for a second approval; a run the connector was recording when it stopped reads as failed and may be run again. A decision whose run takes longer than `MIADI_CONNECTOR_DECISION_WAIT_MS` is answered as recorded and running, and the card reads `get_run_result` every 3 seconds until the outcome is in. The same decision sent again (a host retrying a call, a second click, the page form sent twice) answers with the first one's receipt, marked `replayed`, and runs nothing. A different decision is refused as `decision_conflict`, with where the request stands. When the host gives up on a call, the card reads where the request stands before it offers the buttons again.
|
|
132
141
|
|
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 the host's order. A default that is not installed 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,7 +17,7 @@ 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
|
|
20
|
+
import { type RuntimeDeps } from "./runtime-steer.js";
|
|
21
21
|
import { type TmuxLike } from "./steer.js";
|
|
22
22
|
import { type FetchCaptions } from "./captions.js";
|
|
23
23
|
import { type ProviderAuthorization } from "./provider-policy.js";
|
|
@@ -32,6 +32,12 @@ export interface ApprovalDeps {
|
|
|
32
32
|
fetchImpl?: typeof fetch;
|
|
33
33
|
/** The factory directory holding queue/ (default /srv/miadi/factory). */
|
|
34
34
|
factoryDir?: string;
|
|
35
|
+
/** Whether a session of this provider could be corrected once it works: said before a person approves (jgwill/Miadi#942). */
|
|
36
|
+
steeringOf?: (provider: string) => {
|
|
37
|
+
steerable: boolean;
|
|
38
|
+
basis: string;
|
|
39
|
+
reason?: string;
|
|
40
|
+
};
|
|
35
41
|
tmuxSessions?: () => string[];
|
|
36
42
|
/** The steering surface (jgwill/Miadi#893); tests inject a fake, production uses tmux. */
|
|
37
43
|
tmux?: TmuxLike;
|
|
@@ -39,8 +45,12 @@ export interface ApprovalDeps {
|
|
|
39
45
|
steerSettleMs?: number;
|
|
40
46
|
/** Where sessions and their steering inboxes live (jgwill/Miadi#930). Absent, no runtime route is known. */
|
|
41
47
|
steeringRuntime?: RuntimeDeps;
|
|
48
|
+
/** Asks the factory runner for a pass now. Its timer is the net (jgwill/Miadi#942). */
|
|
49
|
+
wakeRunner?: () => void;
|
|
42
50
|
/** Reads a video's captions for an approved create; without it a create stores no transcript (tests, other embedders). */
|
|
43
51
|
captions?: FetchCaptions;
|
|
52
|
+
/** The link a named person decides a consent request on; set where the decision secret is held. */
|
|
53
|
+
consentLink?: (recordId: string) => string;
|
|
44
54
|
/** Where decision events go (default: one JSON line on stdout, the service journal); tests collect them. */
|
|
45
55
|
log?: (event: Record<string, unknown>) => void;
|
|
46
56
|
}
|
|
@@ -79,6 +89,7 @@ export declare function episodeReferences(record: ConnectorRecord): string[];
|
|
|
79
89
|
/** Whether the owner of this video's source registered it as withheld. */
|
|
80
90
|
export declare function sourceWithheld(records: ConnectorRecord[], videoId: unknown): boolean;
|
|
81
91
|
export declare function executeApproved(record: ConnectorRecord, approver: MiadiPerson, deps: ApprovalDeps, instructions?: string): Promise<Record<string, unknown>>;
|
|
92
|
+
export declare function page(title: string, body: string): string;
|
|
82
93
|
/**
|
|
83
94
|
* Record a person's decision on a request and, when approved, run it once as
|
|
84
95
|
* them. The approval page and the in-chat approval card both decide here; the
|
|
@@ -168,8 +179,23 @@ export declare function rerun(r: ConnectorRecord, person: MiadiPerson, deps: App
|
|
|
168
179
|
}>;
|
|
169
180
|
export declare function isApprovable(r: ConnectorRecord | undefined): r is ConnectorRecord;
|
|
170
181
|
/** What approving a request does, in one sentence, for the card a person decides on. */
|
|
171
|
-
export declare function consequenceOf(r: ConnectorRecord, authorization?: ProviderAuthorization, records?: ConnectorRecord[]
|
|
182
|
+
export declare function consequenceOf(r: ConnectorRecord, authorization?: ProviderAuthorization, records?: ConnectorRecord[], steering?: {
|
|
183
|
+
steerable: boolean;
|
|
184
|
+
basis: string;
|
|
185
|
+
reason?: string;
|
|
186
|
+
}): string;
|
|
172
187
|
export declare function registerApprovalRoutes(app: Express, deps: ApprovalDeps): void;
|
|
188
|
+
/**
|
|
189
|
+
* The page a person named in a consent request decides on. Their link is the door: a person who never
|
|
190
|
+
* signed in to Miadi can answer, and it can release only what the source's owner could already release.
|
|
191
|
+
* The ledger says the answer came through the link, which is what is known (jgwill/Miadi#925).
|
|
192
|
+
*/
|
|
193
|
+
export declare function registerConsentRoutes(app: Express, deps: ApprovalDeps, keyOk: (recordId: string, key: string) => boolean): void;
|
|
194
|
+
/** The email that carries a consent link: short, one question, the same words the page asks. */
|
|
195
|
+
export declare function consentMail(r: ConnectorRecord, link: string): {
|
|
196
|
+
subject: string;
|
|
197
|
+
text: string;
|
|
198
|
+
};
|
|
173
199
|
/** The request, and the decision form for a write-tier person (their token carried in the form they just signed into). */
|
|
174
200
|
/**
|
|
175
201
|
* Where a request stands, as every surface of the connector reads it (request-state.ts):
|
|
@@ -180,6 +206,6 @@ export declare function requestProjection(record: ConnectorRecord, opts?: {
|
|
|
180
206
|
factoryDir?: string;
|
|
181
207
|
}): RequestProjection | null;
|
|
182
208
|
/** The person's own provider policy page: read and change it, signed in with their person token (jgwill/Miadi#926). */
|
|
183
|
-
export declare function registerProviderPolicyRoutes(app: Express, deps: Pick<ApprovalDeps, "ledger" | "identify" | "log">): void;
|
|
209
|
+
export declare function registerProviderPolicyRoutes(app: Express, deps: Pick<ApprovalDeps, "ledger" | "identify" | "log" | "factoryDir">): void;
|
|
184
210
|
/** How a request is named to a person. */
|
|
185
211
|
export declare const KIND_LABELS: Record<string, string>;
|