@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/dist/tools.js CHANGED
@@ -18,13 +18,15 @@ import { CIRCLES, CIRCLE_IDS, CLAIM_CATEGORIES, DOMAINS, HANDOFF_STATES, current
18
18
  import { VERSION } from "./version.js";
19
19
  import { AlreadyDecided, DECISIONS, DecisionConflict, KIND_LABELS, ProviderChoiceRequired, STILL_RUNNING, StaleVersion, approvalStateOf, consequenceOf, decide, decisionWaitOf, isApprovable, isBeingDecided, logDecision, readQueueState, requestProjection, settleWithin, } from "./approve.js";
20
20
  import { RevisionRefused, requestHistory, revisionRecord, supersedeRecords, versionOf } from "./revisions.js";
21
+ import { coverage } from "./captions.js";
21
22
  import { DECISIONS_CARD_EARLIER_URIS, DECISIONS_CARD_HTML, DECISIONS_CARD_URI, DECISION_TOKENS_META } from "./decisions.js";
22
23
  import { discoverProviders, jevConfigOf, resolveProvider, routerPreflight, PROVIDERS } from "./providers.js";
23
24
  import { authorizesActions, missionStatus, primaryIssueOf, resolveMissionSubject } from "./mission-status.js";
24
25
  import { authorizationReceipt, authorizeProvider, CHOICE_PROVIDERS, isPersonId, needsPersonChoice, providerPolicyOf } from "./provider-policy.js";
25
26
  import { candidatesFor, CRITICALITIES, jevAdapter, modelPreflight, PREFLIGHT_CONTRACT, PREFLIGHT_VERSION, TASK_TYPES, } from "./model-preflight.js";
26
27
  import { ShelfRefusal, listShelfArtefacts, readShelfArtefact } from "./research-shelf.js";
27
- import { CLAUDE_ADAPTER, DELIVERY_STATES, readSteerDelivery, revokeInInbox, settlementOf } from "./runtime-steer.js";
28
+ import { DELIVERY_STATES, readSteerDelivery, revokeInInbox, settlementOf } from "./runtime-steer.js";
29
+ import { ADAPTERS, readFactoryConfig, runSteering, STEERING_CONTRACT_ID, steeringSupport } from "./steering-adapters.js";
28
30
  import { checkGrant, isBusy, steerAttempts, steeringGrantOf, steeringRevoked, steerSession } from "./steer.js";
29
31
  import { factoryLedgerPath, readFactoryReceipts, receiptsForRecord, recordsForSession } from "./factory-receipt.js";
30
32
  import { missionResult, redactResult } from "./mission-result.js";
@@ -174,18 +176,15 @@ export function githubGetter(fetchImpl = fetch, token = process.env.GITHUB_TOKEN
174
176
  /** A steer being sent now, by its record: a retry arriving during it waits for this answer and sends nothing (jgwill/Miadi#930). */
175
177
  const steersInFlight = new Map();
176
178
  export const STEERING_CONTRACT = {
179
+ contract: STEERING_CONTRACT_ID,
177
180
  busy_is_normal: true,
178
181
  connector: "Admits the steer, resolves mission → session → runtime, hands it to that session's inbox and reports what the runtime accepted. It does not watch tools or wait for idle.",
179
- runtime: "The agent's own lifecycle presents it to its model at the next supported continuation in the same turn.",
182
+ runtime: "The agent's own lifecycle presents it to its model at the next supported continuation. Each provider's adapter says which one, and what it was shown to do on a real session.",
180
183
  delivery_states: DELIVERY_STATES,
181
184
  provider_adapters: {
182
- claude: { route: "claude_hook_inbox", continuation: "PostToolUse, PostToolUseFailure, then Stop if no tool follows", needs: `${CLAUDE_ADAPTER}, loaded when the session started` },
183
- codex: { route: "unsupported" },
184
- copilot: { route: "unsupported" },
185
- pi: { route: "unsupported" },
185
+ ...Object.fromEntries(Object.values(ADAPTERS).map((a) => [a.provider, { route: a.route, level: "same_turn", continuation: a.continuation, idle: a.idle, needs: a.needs, tested_on: a.tested_on, limits: a.limits }])),
186
186
  gemini: { route: "unsupported" },
187
187
  },
188
- idle_seat: "An idle seat has no continuation coming, so its steer is typed into its bound pane once the prompt reads empty.",
189
188
  };
190
189
  export function steeringTransport(tmux) {
191
190
  if (!tmux)
@@ -352,6 +351,16 @@ export function registerTools(server, ctx) {
352
351
  const touching = (ref) => records().filter((r) => r.refs.includes(ref) || r.evidence_refs.includes(ref) || r.id === ref);
353
352
  /** The factory runner's delivery receipts, read fresh: operator data, for the write tier only. */
354
353
  const receipts = () => readFactoryReceipts(factoryLedgerPath(ctx.factoryDir ?? defaultFactoryDir()));
354
+ const factoryConfig = () => readFactoryConfig(ctx.factoryDir ?? defaultFactoryDir());
355
+ /** A person's policy with what the operator's factory.json says for them. */
356
+ const policyOf = (personId) => providerPolicyOf(ledger.all(), personId, factoryConfig()?.person_default_provider);
357
+ /** What a new session of this provider on this host can promise, before anyone depends on it. */
358
+ const steeringOf = (providerId, cliVersion) => steeringSupport(providerId, cliVersion, { factory: factoryConfig(), ...ctx.steeringProbe });
359
+ const steeringOfCard = runSteering(() => discoverProviders(ctx.providersProbe), () => ({ factory: factoryConfig(), ...ctx.steeringProbe }));
360
+ const runProvider = (r) => {
361
+ const b = r.body;
362
+ return r.kind === "run_request" && typeof (b.resolved_provider ?? b.provider) === "string" ? String(b.resolved_provider ?? b.provider) : undefined;
363
+ };
355
364
  const github = githubGetter(ctx.approval?.fetchImpl ?? fetch);
356
365
  // ── reads ──────────────────────────────────────────────────────────────
357
366
  server.registerTool("get_capabilities", {
@@ -391,7 +400,13 @@ export function registerTools(server, ctx) {
391
400
  tools: TOOL_STATUS,
392
401
  mission_standard: ctx.draftReview ? await standardStatus(ctx.draftReview) : { state: "unavailable" },
393
402
  // Registered is not operational: whether a steer can reach a pane on this host now (jgwill/Miadi#909).
394
- steering: { ...steeringTransport(ctx.tmux), runtime_route: ctx.steeringRuntime ? "configured" : "not_configured", contract: STEERING_CONTRACT },
403
+ steering: {
404
+ ...steeringTransport(ctx.tmux),
405
+ runtime_route: ctx.steeringRuntime ? "configured" : "not_configured",
406
+ contract: STEERING_CONTRACT,
407
+ // Host truth, as provider_capabilities is: what this host would load into a new session.
408
+ ...(person.api_tier !== "write" ? {} : { on_this_host: Object.fromEntries(Object.values(ADAPTERS).map((a) => { const s = steeringOf(a.provider); return [a.provider, { steerable: s.steerable, adapter: s.adapter?.version ?? null, ...(s.reason ? { reason: s.reason } : {}) }]; })) }),
409
+ },
395
410
  foundation_read: {
396
411
  permission: FOUNDATIONS_PERMISSION,
397
412
  held: foundations,
@@ -845,6 +860,17 @@ export function registerTools(server, ctx) {
845
860
  queue: r.kind === "run_request" || r.kind === "work_proposal" ? readQueueState(r, ctx.factoryDir) : undefined,
846
861
  // Where a steer stands, joined to its id: operator detail, as mission_status has it (jgwill/Miadi#930).
847
862
  ...(r.kind === "session_steer_request" && ctx.steeringRuntime && person.api_tier === "write" ? { delivery: readSteerDelivery(ctx.steeringRuntime, all().find((x) => x.id === r.id) ?? r) ?? undefined } : {}),
863
+ // A run's corrections, each with where it stands; mission_status has the same with every receipt (jgwill/Miadi#942).
864
+ ...((r.kind === "run_request" || r.kind === "work_proposal") && ctx.steeringRuntime && person.api_tier === "write"
865
+ ? {
866
+ steers: all()
867
+ .filter((x) => x.kind === "session_steer_request" && x.refs.includes(r.id))
868
+ .flatMap((x) => {
869
+ const delivery = readSteerDelivery(ctx.steeringRuntime, x);
870
+ return delivery ? [{ id: x.id, at: x.created_at, by: x.actor.name, state: delivery.state, ...(delivery.continuation ? { continuation: delivery.continuation } : {}), ...(delivery.behavior ? { behavior: delivery.behavior } : {}), note: delivery.note }] : [];
871
+ }),
872
+ }
873
+ : {}),
848
874
  // Where the request stands, in the words every surface uses (jgwill/Miadi#889).
849
875
  projection: requestProjection(r, { reviewBase: ctx.approval?.config.reviewUrl, factoryDir: ctx.factoryDir }),
850
876
  ...(r.kind === "run_request" || r.kind === "work_proposal" ? { draft_review: reviewShownTo(ctx.draftReview?.stored(r), r, person) } : {}),
@@ -873,6 +899,7 @@ export function registerTools(server, ctx) {
873
899
  queueOf: (r) => (r.kind === "run_request" || r.kind === "work_proposal" ? readQueueState(r, ctx.factoryDir) : undefined),
874
900
  ...(writeTier && ctx.steeringRuntime
875
901
  ? {
902
+ steeringSupportOf: (providerId) => steeringOf(providerId, discoverProviders(ctx.providersProbe).find((p) => p.id === providerId)?.version),
876
903
  steerDeliveryOf: (r) => {
877
904
  const stored = all().find((x) => x.id === r.id) ?? r;
878
905
  return readSteerDelivery(ctx.steeringRuntime, stored);
@@ -946,9 +973,9 @@ export function registerTools(server, ctx) {
946
973
  preference_order: PROVIDERS.map((p) => p.id),
947
974
  explicit_only: PROVIDERS.filter((p) => !p.selectable_by_default).map((p) => p.id),
948
975
  needs_person_choice: [...CHOICE_PROVIDERS],
949
- your_policy: providerPolicyOf(ledger.all(), person.id),
976
+ your_policy: policyOf(person.id),
950
977
  policy_page: `${config.publicUrl}/providers`,
951
- providers: discoverProviders(ctx.providersProbe),
978
+ providers: discoverProviders(ctx.providersProbe).map((p) => ({ ...p, steering: steeringOf(p.id, p.version) })),
952
979
  router: await routerPreflight(process.env, ctx.approval?.fetchImpl ?? fetch),
953
980
  note: "A provider name in a task's text selects nothing; request_authorized_run's provider field is verified against this list, and an unavailable provider leaves the mission unstarted. A request may name Codex, but it runs only when its requester chooses Codex for that mission on the approval page, or their own policy on the providers page says so; a generic approval, the assistant's provider field, the host's order or Jev never choose it.",
954
981
  };
@@ -1222,6 +1249,12 @@ export function registerTools(server, ctx) {
1222
1249
  const video = videoIdOf(a.video);
1223
1250
  if (!video)
1224
1251
  throw new ToolRefusal("invalid_ref", "Give a YouTube URL or an 11-character video id.");
1252
+ if (a.readiness === "released_for_review") {
1253
+ // A person named in this video decides its release, so a request to them is not stepped around (jgwill/Miadi#925).
1254
+ const asked = all().find(r => r.kind === "participant_consent_request" && r.body.video_id === video && (r.approval_state === "awaiting_approval" || r.approval_state === "declined"));
1255
+ if (asked)
1256
+ throw new ToolRefusal("consent_required", `${String(asked.body.decider_name)} decides this release (${asked.id}): ${asked.approval_state === "declined" ? "they said not yet" : "they have not answered"}.`);
1257
+ }
1225
1258
  const prior = all().find(r => r.kind === "source_intent" && r.actor.person_id === person.id && r.idempotency_key === `${video}:${a.purpose}`);
1226
1259
  if (prior && prior.body.readiness !== a.readiness) {
1227
1260
  // Release/withdrawal is an explicit source-owner contribution, not processing authority.
@@ -1482,7 +1515,7 @@ export function registerTools(server, ctx) {
1482
1515
  const existing = all().find(r => r.kind === "run_request" && r.actor.person_id === person.id && r.body.workflow_id === id);
1483
1516
  if (existing)
1484
1517
  return { ...redact(existing), workflow_id: id, approval_url: approvalUrl(existing.id), replayed: true, note: "This video's bounded request already exists; read or resume it. The new scope was not substituted." };
1485
- const resolution = resolveProvider(undefined, discoverProviders(ctx.providersProbe));
1518
+ const resolution = resolveProvider(undefined, discoverProviders(ctx.providersProbe), policyOf(person.id).default_provider);
1486
1519
  if (resolution.state !== "ok")
1487
1520
  return { state: resolution.state, note: "No runtime provider was verified; nothing was queued." };
1488
1521
  const r = append("run_request", person, auth, {
@@ -1539,7 +1572,8 @@ export function registerTools(server, ctx) {
1539
1572
  const { person, auth } = who(extra);
1540
1573
  requireContribute(auth);
1541
1574
  const found = discoverProviders(ctx.providersProbe);
1542
- const resolution = resolveProvider(a.provider, found);
1575
+ const policy = policyOf(person.id);
1576
+ const resolution = resolveProvider(a.provider, found, policy.default_provider);
1543
1577
  if (resolution.state === "provider_unknown")
1544
1578
  throw new ToolRefusal("invalid_request", resolution.message, { available: resolution.available });
1545
1579
  if (resolution.state !== "ok") {
@@ -1573,8 +1607,11 @@ export function registerTools(server, ctx) {
1573
1607
  requested: a.provider ?? null,
1574
1608
  resolved: resolution.provider.id,
1575
1609
  explicit: resolution.explicit,
1610
+ ...(!a.provider && policy.default_provider ? { default_source: policy.default_provider_source } : {}),
1576
1611
  version: resolution.provider.version,
1577
1612
  authorization: authorizationOut(authorization),
1613
+ // Known before anyone depends on it: whether a person can steer this run once it works (jgwill/Miadi#942).
1614
+ steering: steeringOf(resolution.provider.id, resolution.provider.version),
1578
1615
  },
1579
1616
  approval_url: approvalUrl(r.id),
1580
1617
  ...(authorization.authorized
@@ -1654,7 +1691,7 @@ export function registerTools(server, ctx) {
1654
1691
  return { state: resolution.state, message: resolution.message, available: resolution.available, note: "Nothing was recorded; the request stays at its version." };
1655
1692
  body.provider = c.provider;
1656
1693
  body.resolved_provider = resolution.provider.id;
1657
- provider = { requested: c.provider, resolved: resolution.provider.id, explicit: resolution.explicit, version: resolution.provider.version };
1694
+ provider = { requested: c.provider, resolved: resolution.provider.id, explicit: resolution.explicit, version: resolution.provider.version, steering: steeringOf(resolution.provider.id, resolution.provider.version) };
1658
1695
  }
1659
1696
  }
1660
1697
  else if (live?.kind === "work_proposal") {
@@ -1816,7 +1853,11 @@ export function registerTools(server, ctx) {
1816
1853
  }
1817
1854
  }
1818
1855
  const revoked = steeringRevoked(all(), grantRecord.id);
1819
- const covered = checkGrant(grant, priorAttempts, new Date(), revoked) === "ok";
1856
+ // A grant covers the person who asked for the run and the one who approved it, and the host's own service token.
1857
+ // Anyone else with the write tier asks: a person decides that one steer (jgwill/Miadi#942).
1858
+ const approver = (grantRecord.completion_receipt ?? {}).decided_by?.person_id;
1859
+ const theirs = person.id === grantRecord.actor.person_id || person.id === approver || !isPersonId(person.id);
1860
+ const covered = theirs && checkGrant(grant, priorAttempts, new Date(), revoked) === "ok";
1820
1861
  // The pane the factory delivered this mission to: the steer goes there and nowhere else (jgwill/Miadi#909).
1821
1862
  const bound = receiptsForRecord(receipts(), grantRecord.id)[0];
1822
1863
  const binding = bound
@@ -1845,8 +1886,8 @@ export function registerTools(server, ctx) {
1845
1886
  ...r,
1846
1887
  approval_url: approvalUrl(r.id),
1847
1888
  state: "awaiting_approval",
1848
- reason: !grant ? "no_grant" : checkGrant(grant, priorAttempts, new Date(), revoked),
1849
- message: "The approved run's steering grant does not cover this steer; a person's decision is requested, once, for exactly this instruction.",
1889
+ reason: !grant ? "no_grant" : !theirs ? "another_persons_mission" : checkGrant(grant, priorAttempts, new Date(), revoked),
1890
+ message: !theirs ? "This mission belongs to someone else, so its steering grant does not cover you; a person's decision is requested, once, for exactly this instruction." : "The approved run's steering grant does not cover this steer; a person's decision is requested, once, for exactly this instruction.",
1850
1891
  };
1851
1892
  }
1852
1893
  const r = append("session_steer_request", person, auth, { ...fields, approval_state: "not_required" });
@@ -1854,7 +1895,7 @@ export function registerTools(server, ctx) {
1854
1895
  let finishSend = () => { };
1855
1896
  steersInFlight.set(r.id, new Promise((resolve) => (finishSend = resolve)));
1856
1897
  try {
1857
- const result = await steerSession({ tmux: ctx.tmux, stateDir: config.stateDir, ...(ctx.steeringRuntime ? { runtime: ctx.steeringRuntime } : {}), ...(ctx.steerSettleMs !== undefined ? { settleMs: ctx.steerSettleMs } : {}) }, { record: r, grantRecord, priorAttempts, ...(binding ? { binding } : {}), ...(sameWords ? { sameInstructionSent: sameWords.id } : {}) });
1898
+ const result = await steerSession({ tmux: ctx.tmux, stateDir: config.stateDir, ...(ctx.steeringRuntime ? { runtime: ctx.steeringRuntime } : {}), ...(ctx.steerSettleMs !== undefined ? { settleMs: ctx.steerSettleMs } : {}), ...(ctx.wakeRunner ? { wakeRunner: ctx.wakeRunner } : {}) }, { record: r, grantRecord, priorAttempts, ...(binding ? { binding } : {}), ...(sameWords ? { sameInstructionSent: sameWords.id } : {}) });
1858
1899
  // A typed or forwarded steer is never "failed": failed is re-runnable, and that would send it twice (#922 R8).
1859
1900
  const delivered = result.typed || result.forwarded === true;
1860
1901
  ledger.append({
@@ -1877,6 +1918,7 @@ export function registerTools(server, ctx) {
1877
1918
  typed: result.typed,
1878
1919
  ...(result.forwarded ? { forwarded: true } : {}),
1879
1920
  ...(result.route ? { route: result.route } : {}),
1921
+ ...(result.runtime_session_id ? { runtime_session_id: result.runtime_session_id } : {}),
1880
1922
  ...(result.transcript_offset !== undefined ? { transcript_offset: result.transcript_offset } : {}),
1881
1923
  message: result.message,
1882
1924
  ...(result.target ? { target: result.target } : {}),
@@ -1947,7 +1989,9 @@ export function registerTools(server, ctx) {
1947
1989
  });
1948
1990
  }
1949
1991
  }
1950
- const sessions = [...new Set(receiptsForRecord(receipts(), grantRecord.id).map((x) => x.session_id).filter((x) => Boolean(x)))];
1992
+ // A session the runner could name only by its pane is known from the steers that reached it.
1993
+ const reached = all().filter((x) => x.kind === "session_steer_request" && x.refs.includes(grantRecord.id)).map((x) => x.completion_receipt?.runtime_session_id);
1994
+ const sessions = [...new Set([...receiptsForRecord(receipts(), grantRecord.id).map((x) => x.session_id), ...reached].filter((x) => typeof x === "string" && x.length > 0))];
1951
1995
  const inboxes = ctx.steeringRuntime
1952
1996
  ? sessions.map((session_id) => ({ session_id, ...revokeInInbox(ctx.steeringRuntime, session_id, { grant: grantRecord.id, ...(a.steer ? { steer: a.steer } : {}) }, a.reason) }))
1953
1997
  : [];
@@ -1996,6 +2040,61 @@ export function registerTools(server, ctx) {
1996
2040
  });
1997
2041
  return { ...r, body: { ...r.body, markdown: a.markdown ? `${a.markdown.length} chars` : undefined, transcript: a.transcript ? `${a.transcript.length} chars` : undefined }, approval_url: approvalUrl(r.id) };
1998
2042
  }));
2043
+ server.registerTool("request_participant_consent", {
2044
+ title: "Ask a person in a video whether its words may be published",
2045
+ description: "A source withheld because another person is in the video waits for that person. This records one question to them, with the video's YouTube captions for them to read, and answers with a link only they decide on, no Miadi sign-in needed. Their yes releases the source and stores the words on the review; their not yet keeps them private, and the source's owner cannot release it around them. It sends nothing: pass consent_url to whoever speaks with that person, or an admin reads the email on approval_url and presses Send.",
2046
+ inputSchema: {
2047
+ video: z.string().min(1).describe("YouTube URL or video id of a source you registered."),
2048
+ person_name: z.string().min(1).max(80).describe("The name they know themselves by; the page greets them with it."),
2049
+ person_id: z.string().max(120).optional().describe("Their Miadi person id, when they have one."),
2050
+ question: z.string().min(10).max(600).optional().describe("One plain question, in words they follow. It says who recorded the video and what publishing means."),
2051
+ asked_by: z.string().min(1).max(80).optional().describe("The name this person knows the asker by, when it differs from your Miadi name."),
2052
+ refs,
2053
+ ...base,
2054
+ },
2055
+ annotations: WRITE,
2056
+ }, wrap(async (a, extra) => {
2057
+ const { person, auth } = who(extra);
2058
+ requireContribute(auth);
2059
+ const video = videoIdOf(a.video);
2060
+ if (!video)
2061
+ throw new ToolRefusal("invalid_ref", "Give a YouTube URL or an 11-character video id.");
2062
+ const source = all().find(r => r.kind === "source_intent" && r.body.video_id === video && r.actor.person_id === person.id);
2063
+ if (!source)
2064
+ throw new ToolRefusal("not_found", "Register this video with register_source_intent first, as withheld.");
2065
+ if (source.body.readiness === "released_for_review")
2066
+ throw new ToolRefusal("already_released", "This source is already released, so there is nothing to ask.");
2067
+ if (!ctx.approval?.captions || !ctx.approval.consentLink)
2068
+ throw new ToolRefusal("unavailable", "Consent requests are not configured on this connector.");
2069
+ // The words are read here so the person decides on exact text, and that text is what a yes publishes.
2070
+ const answer = await ctx.approval.captions(video);
2071
+ if (answer.state !== "found")
2072
+ throw new ToolRefusal("unavailable", `There are no words to show yet. ${answer.message ?? "YouTube has no captions for this video yet."}`);
2073
+ const found = reviews.canSearch ? await lookupByVideo(video) : [];
2074
+ const review = Array.isArray(found) ? found[0] : undefined;
2075
+ const r = append("participant_consent_request", person, auth, {
2076
+ circle: "continuity",
2077
+ refs: [...a.refs, source.id, `https://youtu.be/${video}`, ...(review?.review_id ? [`miadi-review:${review.review_id}`] : [])],
2078
+ intention: a.intention,
2079
+ role: a.role,
2080
+ idempotency_key: a.idempotency_key ?? `consent:${video}:${a.person_name}`,
2081
+ approval_state: "awaiting_approval",
2082
+ body: {
2083
+ title: `Ask ${a.person_name} whether the words of ${video} may be published`,
2084
+ video_id: video,
2085
+ source_intent: source.id,
2086
+ decider_name: a.person_name,
2087
+ ...(a.person_id ? { decider_person_id: a.person_id } : {}),
2088
+ ...(a.asked_by ? { asked_by: a.asked_by } : {}),
2089
+ question: a.question ?? `${a.asked_by ?? person.name} recorded this video, and you are in it. May its words be published beside its review?`,
2090
+ ...(review?.review_id ? { review_id: review.review_id, review_url: review.url } : {}),
2091
+ transcript: answer.text,
2092
+ transcript_words: answer.words,
2093
+ transcript_covers: coverage(answer),
2094
+ },
2095
+ });
2096
+ return { ...r, body: { ...r.body, transcript: `${answer.text.length} chars` }, consent_url: ctx.approval.consentLink(r.id), approval_url: approvalUrl(r.id), next_action: "Nothing has been sent. Pass consent_url to whoever speaks with this person, or send the email from approval_url." };
2097
+ }));
1999
2098
  server.registerTool("request_deep_diver", {
2000
2099
  title: "Request Deep Diver for a review version",
2001
2100
  description: "Ask that one accepted review version be marked ready for Deep Diver. It waits for a person's approval; then the review service records it and its signed webhook queues /deepdive for the Deep Diver owner.",
@@ -2301,7 +2400,7 @@ export function registerTools(server, ctx) {
2301
2400
  created_at: r.created_at,
2302
2401
  circle: r.circle,
2303
2402
  intention: r.intention,
2304
- consequence: consequenceOf(r, providerAuthorizationOf(r), records()),
2403
+ consequence: consequenceOf(r, providerAuthorizationOf(r), records(), runProvider(r) ? steeringOfCard(runProvider(r)) : undefined),
2305
2404
  detail: detailOf(r),
2306
2405
  ...(r.kind === "run_request" || r.kind === "work_proposal"
2307
2406
  ? {
@@ -2316,7 +2415,7 @@ export function registerTools(server, ctx) {
2316
2415
  }));
2317
2416
  const actionable = decisions.filter((d) => d.projection?.stage === "awaiting_decision");
2318
2417
  // Each token is bound to the version its card shows: a card left open while the request is revised cannot approve it (#919).
2319
- const tokens = canDecide ? Object.fromEntries(actionable.map((r) => [r.id, ctx.decisionTokens.issue(r.id, person.id, auth.clientId, undefined, r.version)])) : {};
2418
+ const tokens = canDecide ? Object.fromEntries(actionable.filter((r) => r.kind !== "participant_consent_request").map((r) => [r.id, ctx.decisionTokens.issue(r.id, person.id, auth.clientId, undefined, r.version)])) : {};
2320
2419
  const structured = {
2321
2420
  decisions,
2322
2421
  count: decisions.length,
@@ -2359,6 +2458,8 @@ export function registerTools(server, ctx) {
2359
2458
  const r = all().find((x) => x.id === a.record_id);
2360
2459
  if (!isApprovable(r))
2361
2460
  throw new ToolRefusal("not_found", "No request with that id.");
2461
+ if (r.kind === "participant_consent_request")
2462
+ throw new ToolRefusal("forbidden", `Only ${String(r.body.decider_name)} decides this, on the link made for them.`);
2362
2463
  // A stale card or a second client gets where the request stands, not a bare refusal (jgwill/Miadi#889).
2363
2464
  const projectionNow = () => requestProjection(all().find((x) => x.id === r.id) ?? r, { reviewBase: ctx.approval?.config.reviewUrl, factoryDir: ctx.factoryDir });
2364
2465
  const check = ctx.decisionTokens.verify(a.decision_token, r.id, person.id, auth.clientId, undefined, versionOf(r));
@@ -2525,6 +2626,7 @@ export const TOOL_STATUS = {
2525
2626
  request_session_steer: "live, contribute, write tier (one correction to a working agent, forwarded to its runtime; runs inside an approved run's steering grant, else one scoped human decision; get_capabilities.steering says whether the transport works now and which providers have an adapter)",
2526
2627
  revoke_session_steering: "live, contribute, write tier (stops a run's steering, or one steer not yet consumed)",
2527
2628
  request_review_operation: "live, contribute, needs_approval (create also stores the video's YouTube captions as the review's transcript, no model call)",
2629
+ request_participant_consent: "live, contribute (one question to a person in a withheld video, answered on a link only they decide on; sends nothing)",
2528
2630
  request_screenwalk_reading: "live, contribute, needs_approval (host provider adapter required; stops at editorial decision)",
2529
2631
  request_reading_import: "live, contribute, needs_approval (exact public import; atomic service contract required)",
2530
2632
  request_deep_diver: "live, contribute, needs_approval",
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.1.26";
1
+ export declare const VERSION = "0.1.28";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.1.26";
1
+ export const VERSION = "0.1.28";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miadi/connector",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "The Miadi connector: one remote MCP service through which a person signed in with their Miadi person token, from ChatGPT or any MCP client, reads sessions, reviews, episodes and circles and records observations, inquiries, handoffs and proposals with their name on each record.",
5
5
  "license": "MIT",
6
6
  "author": "Miadi",
@@ -24,6 +24,10 @@
24
24
  "types": "./dist/runtime-steer.d.ts",
25
25
  "import": "./dist/runtime-steer.js"
26
26
  },
27
+ "./steering-adapters": {
28
+ "types": "./dist/steering-adapters.d.ts",
29
+ "import": "./dist/steering-adapters.js"
30
+ },
27
31
  "./research-shelf": {
28
32
  "types": "./dist/research-shelf.d.ts",
29
33
  "import": "./dist/research-shelf.js"
@@ -35,7 +39,8 @@
35
39
  },
36
40
  "files": [
37
41
  "dist",
38
- "README.md"
42
+ "README.md",
43
+ "STEERING.md"
39
44
  ],
40
45
  "dependencies": {
41
46
  "@miadi/inquiry-weave": "0.18.10",