@miadi/connector 0.1.28 → 0.1.30
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 +11 -1
- package/STEERING.md +1 -1
- package/dist/approve.d.ts +3 -0
- package/dist/approve.js +46 -12
- package/dist/claude-models.d.ts +95 -0
- package/dist/claude-models.js +227 -0
- package/dist/factory-receipt.d.ts +8 -0
- package/dist/factory-receipt.js +1 -0
- package/dist/mission-status.d.ts +19 -0
- package/dist/mission-status.js +34 -1
- package/dist/model-preflight.d.ts +2 -2
- package/dist/model-preflight.js +2 -2
- package/dist/provider-policy.d.ts +1 -1
- package/dist/provider-policy.js +1 -1
- package/dist/providers.d.ts +6 -6
- package/dist/providers.js +26 -20
- package/dist/request-state.js +2 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -0
- package/dist/source-words.d.ts +13 -0
- package/dist/source-words.js +21 -0
- package/dist/tools.js +84 -14
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/mission-status.js
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { steerAttempts, steeringGrantOf, steeringRevoked, checkGrant } from "./steer.js";
|
|
2
|
+
import { modelMatches } from "./claude-models.js";
|
|
2
3
|
import { missionResult, redactResult, submittedWithWriteTier } from "./mission-result.js";
|
|
4
|
+
function missionModel(record, receipt, answeredOf) {
|
|
5
|
+
const routing = (record.completion_receipt ?? {}).model_routing;
|
|
6
|
+
const ran = receipt?.model;
|
|
7
|
+
if (!routing && !ran)
|
|
8
|
+
return undefined;
|
|
9
|
+
const chosen = routing?.model ?? ran?.requested ?? null;
|
|
10
|
+
const source = routing?.source ?? ran?.source ?? null;
|
|
11
|
+
// A session that was already running answers on its own model, from long before this mission.
|
|
12
|
+
const observed = source !== "existing_session" && receipt?.session_id && answeredOf ? answeredOf(receipt.session_id) : undefined;
|
|
13
|
+
return {
|
|
14
|
+
chosen,
|
|
15
|
+
source,
|
|
16
|
+
...(routing?.fallback_reasons ? { fallback_reasons: routing.fallback_reasons } : {}),
|
|
17
|
+
...(routing?.decider ? { confidence: routing.decider.confidence ?? null } : {}),
|
|
18
|
+
...(receipt ? { flag: ran?.flag ?? null } : {}),
|
|
19
|
+
...(observed !== undefined ? { observed } : {}),
|
|
20
|
+
match: chosen && observed ? modelMatches(chosen, observed) : "unknown",
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** How long a delivered session may name no model before a reader is told. */
|
|
24
|
+
const NO_ANSWER_NOTE_MS = 5 * 60 * 1000;
|
|
3
25
|
const ISSUE_REF = /^([\w.-]+)\/([\w.-]+)#(\d+)$/;
|
|
4
26
|
const SESSION_REF = /^session:([0-9a-f-]{36})$/;
|
|
5
27
|
const MISSION_KINDS = new Set(["run_request", "work_proposal"]);
|
|
@@ -109,7 +131,7 @@ function nextAction(record, standing, queue, result) {
|
|
|
109
131
|
return queue?.state === "delivered"
|
|
110
132
|
? "The brief is with its session. Follow it, or steer it with request_session_steer inside the approved grant."
|
|
111
133
|
: queue?.state === "refused"
|
|
112
|
-
? "The factory runner refused to launch
|
|
134
|
+
? "The factory runner refused to launch it, and the queue says why; nothing runs. The requester decides on a new request."
|
|
113
135
|
: "Wait for the factory intake to deliver the brief.";
|
|
114
136
|
case "failed":
|
|
115
137
|
return standing.rerun.available ? "A write-tier person may run it again with the same approval." : "Read the failure and decide.";
|
|
@@ -324,6 +346,16 @@ export async function missionStatus(ref, records, deps) {
|
|
|
324
346
|
}
|
|
325
347
|
}
|
|
326
348
|
}
|
|
349
|
+
const model = deps.factoryReceiptsOf ? missionModel(record, receipts[0], deps.modelAnsweredOf) : undefined;
|
|
350
|
+
if (model?.match === false) {
|
|
351
|
+
notes.push(`The launch asked for ${model.chosen}; the session's transcript says ${model.observed} answered. Nothing was re-run because of it.`);
|
|
352
|
+
}
|
|
353
|
+
if (model && receipts[0] && model.chosen && model.source !== "existing_session" && !model.flag) {
|
|
354
|
+
notes.push(`${model.chosen} was chosen, but the runner's receipt shows no --model: a factory runner older than 0.1.5 ignores it, so read observed for what ran.`);
|
|
355
|
+
}
|
|
356
|
+
if (model?.observed === null && receipts[0] && Date.now() - Date.parse(receipts[0].at) > NO_ANSWER_NOTE_MS) {
|
|
357
|
+
notes.push("Five minutes after delivery, the session's transcript names no model that answered. It may be slow, or its model may have been refused at launch: read the pane.");
|
|
358
|
+
}
|
|
327
359
|
const addSession = (session, association) => {
|
|
328
360
|
if (seen.has(session))
|
|
329
361
|
return;
|
|
@@ -478,6 +510,7 @@ export async function missionStatus(ref, records, deps) {
|
|
|
478
510
|
...(deps.steeringSupportOf && (provider?.actual ?? provider?.resolved) ? { support: deps.steeringSupportOf(String(provider.actual ?? provider.resolved)) } : {}),
|
|
479
511
|
},
|
|
480
512
|
...(provider ? { provider } : {}),
|
|
513
|
+
...(model ? { model } : {}),
|
|
481
514
|
stage_truth: stageTruth,
|
|
482
515
|
mission_stage: missionStage(standing ?? null, stageTruth),
|
|
483
516
|
pending_human_gates: pendingGates(record, records, result, deps.approvalUrl),
|
|
@@ -17,8 +17,8 @@ export interface ModelCandidate {
|
|
|
17
17
|
provider: ProviderId;
|
|
18
18
|
/** A concrete model id when the host shows one, else null. */
|
|
19
19
|
model_id: string | null;
|
|
20
|
-
/** configured_default: the provider's own config names it; it is not proof of what a launch will use. */
|
|
21
|
-
model_id_source: "configured_default" | "fixture" | "unknown";
|
|
20
|
+
/** configured_default: the provider's own config names it; it is not proof of what a launch will use. permitted: on this host's list of Claude Code models (claude-models.ts). */
|
|
21
|
+
model_id_source: "configured_default" | "permitted" | "fixture" | "unknown";
|
|
22
22
|
/** What is known of the model's strength, with its source; absent on a live host, where nothing is measured yet. */
|
|
23
23
|
capability_note?: string;
|
|
24
24
|
installed: boolean;
|
package/dist/model-preflight.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* how do we know?" — never an authorization.
|
|
5
5
|
*
|
|
6
6
|
* - Policy is deterministic and decided here, not by Jev: the approved provider
|
|
7
|
-
* is kept (no switching without a person), Claude Code
|
|
7
|
+
* is kept (no switching without a person), only Claude Code runs unnamed, an
|
|
8
8
|
* uninstalled or sign-in-less provider is ineligible, and a reported launch on
|
|
9
9
|
* another provider fails closed as provider_mismatch before anything is asked.
|
|
10
10
|
* - Codex is eligible only with its requester's own choice for the mission or
|
|
@@ -269,7 +269,7 @@ export async function modelPreflight(input) {
|
|
|
269
269
|
source: "static_fallback",
|
|
270
270
|
router,
|
|
271
271
|
calibration: "not_applicable",
|
|
272
|
-
derivation: approved_provider ? `deterministic policy: the ${input.provider_basis ?? "approved"} provider and its configured default model` : "deterministic policy:
|
|
272
|
+
derivation: approved_provider ? `deterministic policy: the ${input.provider_basis ?? "approved"} provider and its configured default model` : "deterministic policy: Claude Code when no provider is named; the others only by name",
|
|
273
273
|
...(detail ? { detail } : {}),
|
|
274
274
|
},
|
|
275
275
|
recommendation: {
|
|
@@ -41,7 +41,7 @@ export interface ProviderPolicy {
|
|
|
41
41
|
source: "default" | "person";
|
|
42
42
|
record?: string;
|
|
43
43
|
set_at?: string;
|
|
44
|
-
/** The provider a request of theirs runs on when it names none (jgwill/Miadi#942). Absent: the
|
|
44
|
+
/** The provider a request of theirs runs on when it names none (jgwill/Miadi#942). Absent: Claude Code, the Factory's default (jgwill/Miadi#943). */
|
|
45
45
|
default_provider?: string;
|
|
46
46
|
/** Who said so: the person on /providers, or the operator's factory.json for this person. */
|
|
47
47
|
default_provider_source?: "person" | "host_config";
|
package/dist/provider-policy.js
CHANGED
|
@@ -62,7 +62,7 @@ export function authorizeProvider(record, records, opts = {}) {
|
|
|
62
62
|
state: "not_required",
|
|
63
63
|
authorized: true,
|
|
64
64
|
explanation: provider
|
|
65
|
-
? `${provider} needs no per-mission choice; it was ${requested ? "named in the request" : "
|
|
65
|
+
? `${provider} needs no per-mission choice; it was ${requested ? "named in the request" : "the default provider"} and verified installed.`
|
|
66
66
|
: "No provider is named: the factory runner's configured default launches, and the runner never starts Codex for a connector brief without the brief's own authorization.",
|
|
67
67
|
};
|
|
68
68
|
}
|
package/dist/providers.d.ts
CHANGED
|
@@ -9,9 +9,9 @@ export interface ProviderSpec {
|
|
|
9
9
|
auth_evidence: string[];
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* that mission or their own policy (provider-policy.ts, jgwill/Miadi#926).
|
|
12
|
+
* Claude Code is what a run request that names no provider launches (jgwill/Miadi#943). Every
|
|
13
|
+
* other provider runs only when a request names it. Codex also needs the requester's own choice
|
|
14
|
+
* for that mission or their own policy (provider-policy.ts, jgwill/Miadi#926).
|
|
15
15
|
*/
|
|
16
16
|
export declare const PROVIDERS: ProviderSpec[];
|
|
17
17
|
export interface ProviderAvailability {
|
|
@@ -41,9 +41,9 @@ export type ProviderResolution = {
|
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
43
|
* Resolve the provider a run will ask the intake for. A requested provider must
|
|
44
|
-
* be known and installed
|
|
45
|
-
*
|
|
46
|
-
*
|
|
44
|
+
* be known and installed. With no request it is Claude Code, and a host where Claude
|
|
45
|
+
* Code is missing or shows no sign-in leaves the mission unstarted: no other provider
|
|
46
|
+
* stands in for it. Whether a named Codex may run is provider-policy.ts's answer.
|
|
47
47
|
*/
|
|
48
48
|
export declare function resolveProvider(requested: string | undefined, found: ProviderAvailability[], personDefault?: string): ProviderResolution;
|
|
49
49
|
/**
|
package/dist/providers.js
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The connector never assumes a provider works because a task text names one:
|
|
5
5
|
* it reports what is installed on this host, what sign-in evidence exists (the
|
|
6
|
-
* presence of the provider's own config directory — never its contents
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* mission is left unstarted.
|
|
6
|
+
* presence of the provider's own config directory — never its contents, and never
|
|
7
|
+
* proof of a live sign-in), and applies one default. A request that names no provider
|
|
8
|
+
* runs on Claude Code (jgwill/Miadi#943) and on nothing else: without it the mission
|
|
9
|
+
* is left unstarted. Pi, Copilot and Codex run only when named, and Codex also needs
|
|
10
|
+
* the requester's own choice for that mission (provider-policy.ts, jgwill/Miadi#926).
|
|
12
11
|
*
|
|
13
12
|
* No bearer token is read, logged or returned here. Version probes run the
|
|
14
13
|
* provider's own `--version` with a short timeout.
|
|
@@ -18,15 +17,15 @@ import { existsSync } from "node:fs";
|
|
|
18
17
|
import { homedir } from "node:os";
|
|
19
18
|
import { join } from "node:path";
|
|
20
19
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* that mission or their own policy (provider-policy.ts, jgwill/Miadi#926).
|
|
20
|
+
* Claude Code is what a run request that names no provider launches (jgwill/Miadi#943). Every
|
|
21
|
+
* other provider runs only when a request names it. Codex also needs the requester's own choice
|
|
22
|
+
* for that mission or their own policy (provider-policy.ts, jgwill/Miadi#926).
|
|
24
23
|
*/
|
|
25
24
|
export const PROVIDERS = [
|
|
25
|
+
{ id: "claude", cli: "claude", name: "Claude Code", selectable_by_default: true, auth_evidence: [".claude"] },
|
|
26
26
|
{ id: "codex", cli: "codex", name: "Codex CLI", selectable_by_default: false, auth_evidence: [".codex"] },
|
|
27
|
-
{ id: "pi", cli: "pi", name: "Pi coding agent", selectable_by_default:
|
|
28
|
-
{ id: "copilot", cli: "copilot", name: "GitHub Copilot CLI", selectable_by_default:
|
|
29
|
-
{ id: "claude", cli: "claude", name: "Claude Code", selectable_by_default: false, auth_evidence: [".claude"] },
|
|
27
|
+
{ id: "pi", cli: "pi", name: "Pi coding agent", selectable_by_default: false, auth_evidence: [".pi", ".config/pi"] },
|
|
28
|
+
{ id: "copilot", cli: "copilot", name: "GitHub Copilot CLI", selectable_by_default: false, auth_evidence: [".copilot"] },
|
|
30
29
|
];
|
|
31
30
|
const defaultWhich = (cli) => {
|
|
32
31
|
try {
|
|
@@ -64,20 +63,20 @@ export function discoverProviders(probe = {}, specs = PROVIDERS) {
|
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
65
|
* Resolve the provider a run will ask the intake for. A requested provider must
|
|
67
|
-
* be known and installed
|
|
68
|
-
*
|
|
69
|
-
*
|
|
66
|
+
* be known and installed. With no request it is Claude Code, and a host where Claude
|
|
67
|
+
* Code is missing or shows no sign-in leaves the mission unstarted: no other provider
|
|
68
|
+
* stands in for it. Whether a named Codex may run is provider-policy.ts's answer.
|
|
70
69
|
*/
|
|
71
70
|
export function resolveProvider(requested, found, personDefault) {
|
|
72
71
|
const installed = found.filter((p) => p.installed);
|
|
73
72
|
// A person's own default stands in for naming it, and never silently becomes another provider (jgwill/Miadi#942).
|
|
74
73
|
if (!requested && personDefault) {
|
|
75
74
|
const avail = found.find((p) => p.id === personDefault);
|
|
76
|
-
if (avail?.installed)
|
|
75
|
+
if (avail?.installed && avail.auth_evidence === "found")
|
|
77
76
|
return { state: "ok", provider: avail, explicit: false };
|
|
78
77
|
return {
|
|
79
78
|
state: "provider_unavailable",
|
|
80
|
-
message: `Your default provider, ${personDefault}, is not installed on the connector host. The mission is left unstarted; name an available provider.`,
|
|
79
|
+
message: `Your default provider, ${personDefault}, ${avail?.installed ? "shows no sign-in" : "is not installed"} on the connector host. The mission is left unstarted; name an available provider.`,
|
|
81
80
|
available: installed,
|
|
82
81
|
};
|
|
83
82
|
}
|
|
@@ -101,12 +100,19 @@ export function resolveProvider(requested, found, personDefault) {
|
|
|
101
100
|
return { state: "ok", provider: avail, explicit: true };
|
|
102
101
|
}
|
|
103
102
|
const first = PROVIDERS.map((s) => found.find((p) => p.id === s.id)).find((p) => p.installed && p.selectable_by_default);
|
|
104
|
-
if (first)
|
|
103
|
+
if (first?.auth_evidence === "found")
|
|
105
104
|
return { state: "ok", provider: first, explicit: false };
|
|
105
|
+
if (first) {
|
|
106
|
+
return {
|
|
107
|
+
state: "provider_unavailable",
|
|
108
|
+
message: `${first.name}, the default provider, shows no sign-in on the connector host. The mission is left unstarted; sign it in or name another provider.`,
|
|
109
|
+
available: installed,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
106
112
|
if (installed.length) {
|
|
107
113
|
return {
|
|
108
114
|
state: "provider_needs_explicit_selection",
|
|
109
|
-
message: `
|
|
115
|
+
message: `Claude Code, the default provider, is not installed on the connector host, and the others run only by name (${installed.map((p) => p.id).join(", ")}). Name one in the request; none is chosen silently.`,
|
|
110
116
|
available: installed,
|
|
111
117
|
};
|
|
112
118
|
}
|
|
@@ -140,7 +146,7 @@ export async function routerPreflight(env = process.env, fetchImpl = fetch) {
|
|
|
140
146
|
if (!jev) {
|
|
141
147
|
return {
|
|
142
148
|
state: "unconfigured",
|
|
143
|
-
note: `No ${JEV_KEY_NAMES.join(" or ")} in the connector's environment:
|
|
149
|
+
note: `No ${JEV_KEY_NAMES.join(" or ")} in the connector's environment: a launch uses the configured Claude Code model and says so in its receipt.`,
|
|
144
150
|
};
|
|
145
151
|
}
|
|
146
152
|
const where = { service: jev.service, key_name: jev.key_name, url: jev.base };
|
package/dist/request-state.js
CHANGED
|
@@ -208,6 +208,8 @@ function projectCore(record, ctx = {}) {
|
|
|
208
208
|
if (receiptUrl)
|
|
209
209
|
lines.push(`Review: ${receiptUrl}`);
|
|
210
210
|
lines.push(...transcriptLines(receipt.transcript));
|
|
211
|
+
if (receipt.source_words?.title_taken === false)
|
|
212
|
+
lines.push("The source's title and description were sent, and the review service does not use them yet, so this review was written from the video alone.");
|
|
211
213
|
lines.push(...outstanding);
|
|
212
214
|
return finish({
|
|
213
215
|
...base,
|
package/dist/server.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface ConnectorDeps {
|
|
|
33
33
|
/** A provider's configured default model and a Jev decider (jgwill/Miadi#913); tests inject fakes. */
|
|
34
34
|
modelOf?: (provider: ProviderId) => string | null;
|
|
35
35
|
jevAdapter?: JevAdapter;
|
|
36
|
-
/** The environment the draft review
|
|
36
|
+
/** The environment the draft review and the model routing read their keys from (default process.env); tests pass their own (jgwill/Miadi#939, #943). */
|
|
37
37
|
draftReviewEnv?: NodeJS.ProcessEnv;
|
|
38
38
|
/** Where the mission standard comes from (default the prompt store, then the built-in copy); tests pass their own. */
|
|
39
39
|
standardSource?: StandardSource;
|
package/dist/server.js
CHANGED
|
@@ -95,6 +95,7 @@ export function createConnectorApp(config, deps) {
|
|
|
95
95
|
...(deps.wakeRunner ? { wakeRunner: deps.wakeRunner } : {}),
|
|
96
96
|
...(deps.captions ? { captions: deps.captions } : {}),
|
|
97
97
|
log: deps.log,
|
|
98
|
+
modelRouting: { adapter: deps.jevAdapter, env: deps.draftReviewEnv, fetchImpl: deps.fetchImpl, providersProbe: deps.providersProbe, modelOf: deps.modelOf },
|
|
98
99
|
};
|
|
99
100
|
// A run the connector was recording when it last stopped is failed now, so a person may run it again (#924).
|
|
100
101
|
reconcileInterrupted(approvalDeps);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the person who recorded a video wrote about it: its title, its description and the boundaries of its review.
|
|
3
|
+
* An approved create sends these to generation as evidence (jgwill/Miadi#963). They come from the source's own fields,
|
|
4
|
+
* or from the form a source is registered in today: `TITLE:`, `DESCRIPTION` and `Review boundaries:` lines in its intention.
|
|
5
|
+
*/
|
|
6
|
+
import type { ConnectorRecord } from "./records.js";
|
|
7
|
+
export interface SourceWords {
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
boundaries?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Null when the source holds none of the three, so a plain source is sent as a bare URL, as before. */
|
|
13
|
+
export declare function sourceWordsOf(source: ConnectorRecord | undefined): SourceWords | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const LIMITS = { title: 200, description: 8000, boundaries: 3000 };
|
|
2
|
+
const clean = (value, limit) => {
|
|
3
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
4
|
+
return text ? text.slice(0, limit) : undefined;
|
|
5
|
+
};
|
|
6
|
+
/** Null when the source holds none of the three, so a plain source is sent as a bare URL, as before. */
|
|
7
|
+
export function sourceWordsOf(source) {
|
|
8
|
+
if (!source)
|
|
9
|
+
return null;
|
|
10
|
+
const body = source.body;
|
|
11
|
+
const text = source.intention ?? "";
|
|
12
|
+
const boundariesAt = text.search(/^(?:review )?boundaries:/im);
|
|
13
|
+
const beforeBoundaries = boundariesAt >= 0 ? text.slice(0, boundariesAt) : text;
|
|
14
|
+
const words = {
|
|
15
|
+
title: clean(body.title, LIMITS.title) ?? clean(/^TITLE:\s*(.+)$/m.exec(text)?.[1], LIMITS.title),
|
|
16
|
+
description: clean(body.description, LIMITS.description) ?? clean(/^DESCRIPTION:?[ \t]*\n([\s\S]*)$/m.exec(beforeBoundaries)?.[1], LIMITS.description),
|
|
17
|
+
boundaries: clean(body.boundaries, LIMITS.boundaries) ?? (boundariesAt >= 0 ? clean(text.slice(boundariesAt).replace(/^(?:review )?boundaries:/i, ""), LIMITS.boundaries) : undefined),
|
|
18
|
+
};
|
|
19
|
+
const kept = Object.fromEntries(Object.entries(words).filter(([, v]) => v !== undefined));
|
|
20
|
+
return Object.keys(kept).length ? kept : null;
|
|
21
|
+
}
|
package/dist/tools.js
CHANGED
|
@@ -20,12 +20,13 @@ import { AlreadyDecided, DECISIONS, DecisionConflict, KIND_LABELS, ProviderChoic
|
|
|
20
20
|
import { RevisionRefused, requestHistory, revisionRecord, supersedeRecords, versionOf } from "./revisions.js";
|
|
21
21
|
import { coverage } from "./captions.js";
|
|
22
22
|
import { DECISIONS_CARD_EARLIER_URIS, DECISIONS_CARD_HTML, DECISIONS_CARD_URI, DECISION_TOKENS_META } from "./decisions.js";
|
|
23
|
+
import { CLAUDE_MODELS, CLAUDE_MODELS_VERIFIED, claudeModelCandidates, claudeModelConfig, firstModelInTranscript, JEV_WITHIN_CLAUDE, MODEL_NAME, modelPlan } from "./claude-models.js";
|
|
23
24
|
import { discoverProviders, jevConfigOf, resolveProvider, routerPreflight, PROVIDERS } from "./providers.js";
|
|
24
25
|
import { authorizesActions, missionStatus, primaryIssueOf, resolveMissionSubject } from "./mission-status.js";
|
|
25
26
|
import { authorizationReceipt, authorizeProvider, CHOICE_PROVIDERS, isPersonId, needsPersonChoice, providerPolicyOf } from "./provider-policy.js";
|
|
26
27
|
import { candidatesFor, CRITICALITIES, jevAdapter, modelPreflight, PREFLIGHT_CONTRACT, PREFLIGHT_VERSION, TASK_TYPES, } from "./model-preflight.js";
|
|
27
28
|
import { ShelfRefusal, listShelfArtefacts, readShelfArtefact } from "./research-shelf.js";
|
|
28
|
-
import { DELIVERY_STATES, readSteerDelivery, revokeInInbox, settlementOf } from "./runtime-steer.js";
|
|
29
|
+
import { DELIVERY_STATES, readSteerDelivery, revokeInInbox, settlementOf, transcriptPathOf } from "./runtime-steer.js";
|
|
29
30
|
import { ADAPTERS, readFactoryConfig, runSteering, STEERING_CONTRACT_ID, steeringSupport } from "./steering-adapters.js";
|
|
30
31
|
import { checkGrant, isBusy, steerAttempts, steeringGrantOf, steeringRevoked, steerSession } from "./steer.js";
|
|
31
32
|
import { factoryLedgerPath, readFactoryReceipts, receiptsForRecord, recordsForSession } from "./factory-receipt.js";
|
|
@@ -197,6 +198,16 @@ function episodeRef(input) {
|
|
|
197
198
|
// miadi-chronicle://316, miadi-chronicle:316, chronicle:<folder>, a folder, or a number
|
|
198
199
|
return encodeURIComponent(input.replace(/^miadi-chronicle:(\/\/)?/, "").replace(/^chronicle:/, "").trim());
|
|
199
200
|
}
|
|
201
|
+
/** How a mission's Claude Code model is named or chosen, on both kinds that launch one (jgwill/Miadi#943). */
|
|
202
|
+
const launchModelFields = {
|
|
203
|
+
model: z
|
|
204
|
+
.string()
|
|
205
|
+
.regex(MODEL_NAME)
|
|
206
|
+
.optional()
|
|
207
|
+
.describe("The Claude Code model to launch on. Name it only when the person asked for that model; leave it out and Jev chooses among the permitted Claude Code models when it is approved. A model on a mission that runs on any other provider is refused."),
|
|
208
|
+
task_type: z.enum(TASK_TYPES).optional().describe("The kind of task, which with criticality is all Jev learns of it when it chooses the model. Default implementation, which goes to Sonnet."),
|
|
209
|
+
criticality: z.enum(CRITICALITIES).optional().describe("Default normal."),
|
|
210
|
+
};
|
|
200
211
|
export function registerTools(server, ctx) {
|
|
201
212
|
const { config, miadi, reviews, ledger } = ctx;
|
|
202
213
|
// One server is made per request, so the person a tool call runs for is this request's viewer.
|
|
@@ -236,7 +247,7 @@ export function registerTools(server, ctx) {
|
|
|
236
247
|
body[k] = `${body[k].length} chars`;
|
|
237
248
|
const receipt = r.completion_receipt ? { ...r.completion_receipt } : undefined;
|
|
238
249
|
if (receipt)
|
|
239
|
-
for (const k of ["to", "file", "session_id", "target", "artifact"])
|
|
250
|
+
for (const k of ["to", "file", "session_id", "target", "artifact", "model_routing"])
|
|
240
251
|
delete receipt[k];
|
|
241
252
|
// A steer's message names its target pane.
|
|
242
253
|
if (receipt && r.kind === "session_steer_request")
|
|
@@ -351,6 +362,10 @@ export function registerTools(server, ctx) {
|
|
|
351
362
|
const touching = (ref) => records().filter((r) => r.refs.includes(ref) || r.evidence_refs.includes(ref) || r.id === ref);
|
|
352
363
|
/** The factory runner's delivery receipts, read fresh: operator data, for the write tier only. */
|
|
353
364
|
const receipts = () => readFactoryReceipts(factoryLedgerPath(ctx.factoryDir ?? defaultFactoryDir()));
|
|
365
|
+
/** The Claude Code models this host permits, and the one it falls back to (jgwill/Miadi#943). */
|
|
366
|
+
const modelConfig = () => claudeModelConfig(ctx.factoryDir ?? defaultFactoryDir(), ctx.modelOf);
|
|
367
|
+
/** The body mark of a request whose model Jev chooses, when it runs on Claude Code. */
|
|
368
|
+
const routedOn = (provider) => (provider === "claude" ? { model_routing: JEV_WITHIN_CLAUDE } : {});
|
|
354
369
|
const factoryConfig = () => readFactoryConfig(ctx.factoryDir ?? defaultFactoryDir());
|
|
355
370
|
/** A person's policy with what the operator's factory.json says for them. */
|
|
356
371
|
const policyOf = (personId) => providerPolicyOf(ledger.all(), personId, factoryConfig()?.person_default_provider);
|
|
@@ -933,6 +948,12 @@ export function registerTools(server, ctx) {
|
|
|
933
948
|
}
|
|
934
949
|
: undefined,
|
|
935
950
|
factoryReceiptsOf: writeTier ? (id) => receiptsForRecord(receipts(), id) : undefined,
|
|
951
|
+
modelAnsweredOf: writeTier && ctx.steeringRuntime
|
|
952
|
+
? (sessionId) => {
|
|
953
|
+
const path = transcriptPathOf(ctx.steeringRuntime, sessionId);
|
|
954
|
+
return path ? firstModelInTranscript(path) : null;
|
|
955
|
+
}
|
|
956
|
+
: undefined,
|
|
936
957
|
recordsBoundTo: writeTier ? (sessionId) => recordsForSession(receipts(), sessionId) : undefined,
|
|
937
958
|
// What a result and a closure are checked against does not depend on who reads (#922 R5); only what is shown does.
|
|
938
959
|
boundSessionIdsOf: (id) => receiptsForRecord(receipts(), id).flatMap((x) => (x.session_id ? [x.session_id] : [])),
|
|
@@ -963,7 +984,7 @@ export function registerTools(server, ctx) {
|
|
|
963
984
|
}));
|
|
964
985
|
server.registerTool("provider_capabilities", {
|
|
965
986
|
title: "Which agent providers this host can launch",
|
|
966
|
-
description: "The provider reality of the connector host (jgwill/Miadi#893): which agent CLIs are installed, their versions, whether sign-in evidence exists, the
|
|
987
|
+
description: "The provider reality of the connector host (jgwill/Miadi#893): which agent CLIs are installed, their versions, whether sign-in evidence exists, the default (Claude Code, on the model Jev chooses among claude_models; every other provider only when a request names it), the rule that a named Codex runs only on the requester's own choice for that mission or their own policy (jgwill/Miadi#926), your own provider policy, and the read-only Jev routing preflight. No token is read or shown. Needs Miadi's write tier: this is host truth.",
|
|
967
988
|
inputSchema: {},
|
|
968
989
|
annotations: READ,
|
|
969
990
|
}, wrap(async (_args, extra) => {
|
|
@@ -977,12 +998,13 @@ export function registerTools(server, ctx) {
|
|
|
977
998
|
policy_page: `${config.publicUrl}/providers`,
|
|
978
999
|
providers: discoverProviders(ctx.providersProbe).map((p) => ({ ...p, steering: steeringOf(p.id, p.version) })),
|
|
979
1000
|
router: await routerPreflight(process.env, ctx.approval?.fetchImpl ?? fetch),
|
|
1001
|
+
claude_models: { ...modelConfig(), verified: CLAUDE_MODELS_VERIFIED, catalog: CLAUDE_MODELS, note: "A run naming no model has Jev choose among permitted when it is approved; on any Jev failure it launches on configured and its receipt says why. It never moves to another provider. Sign-in evidence is a config directory, not a live sign-in; verified is the one run that showed these names answer." },
|
|
980
1002
|
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.",
|
|
981
1003
|
};
|
|
982
1004
|
}));
|
|
983
1005
|
server.registerTool("mission_model_preflight", {
|
|
984
1006
|
title: "Which provider and model fits a mission, and how that is known",
|
|
985
|
-
description: "A typed, versioned, read-only preflight for one mission (jgwill/Miadi#913): the candidate providers with their concrete model when the host shows one, sign-in evidence (config directory only), quota unknown, policy eligibility (the approved provider is kept; Claude Code
|
|
1007
|
+
description: "A typed, versioned, read-only preflight for one mission (jgwill/Miadi#913): the candidate providers with their concrete model when the host shows one (one candidate per permitted Claude Code model), sign-in evidence (config directory only), quota unknown, policy eligibility (the approved provider is kept; only Claude Code runs unnamed), a review floor, and a recommendation or an abstention with its reasons. It says where the choice came from: static_fallback, jev or a synthetic fixture. Jev is asked only with consult_jev and a Jev key in the connector's environment; that call is charged, and it carries no task text, mission id or repository name. A reported launch on another provider than the approved one fails closed as provider_mismatch. It authorizes nothing. Needs Miadi's write tier.",
|
|
986
1008
|
inputSchema: {
|
|
987
1009
|
ref: z.string().min(1).describe("The mission: run_request:<id> or work_proposal:<id> (an issue or session ref resolves only through its primary relation)."),
|
|
988
1010
|
task_type: z.enum(TASK_TYPES),
|
|
@@ -1017,7 +1039,11 @@ export function registerTools(server, ctx) {
|
|
|
1017
1039
|
const provider = (typeof body.resolved_provider === "string" ? body.resolved_provider : typeof body.provider === "string" ? body.provider : null);
|
|
1018
1040
|
const basis = record.approval_state === "approved" ? "approved" : "requested";
|
|
1019
1041
|
const authorization = providerAuthorizationOf(record);
|
|
1020
|
-
const
|
|
1042
|
+
const onHost = discoverProviders(ctx.providersProbe);
|
|
1043
|
+
const listed = candidatesFor(onHost, provider, ctx.modelOf, basis, authorization);
|
|
1044
|
+
const claudeRow = listed.find((c) => c.provider === "claude");
|
|
1045
|
+
// The same options a launch offers Jev, so a consult here is a dry run of it (jgwill/Miadi#943).
|
|
1046
|
+
const candidates = claudeRow?.installed ? [...claudeModelCandidates(onHost, modelConfig(), claudeRow), ...listed.filter((c) => c.provider !== "claude")] : listed;
|
|
1021
1047
|
const jevConfig = jevConfigOf(process.env);
|
|
1022
1048
|
const jev = a.consult_jev ? (ctx.jevAdapter ?? (jevConfig ? jevAdapter(jevConfig, ctx.approval?.fetchImpl ?? fetch) : undefined)) : undefined;
|
|
1023
1049
|
const configured = Boolean(jevConfig);
|
|
@@ -1234,12 +1260,15 @@ export function registerTools(server, ctx) {
|
|
|
1234
1260
|
}));
|
|
1235
1261
|
server.registerTool("register_source_intent", {
|
|
1236
1262
|
title: "Register a pending source",
|
|
1237
|
-
description: "Register a screenwalk or video as a pending source with its intention and readiness, without generating any review. One per video and purpose: registering again returns the first.",
|
|
1263
|
+
description: "Register a screenwalk or video as a pending source with its intention and readiness, without generating any review. One per video and purpose: registering again returns the first. Its title, description and boundaries go to generation when a review is approved. Withhold only when a person is on the record without a release: filmed, or their own voice, words or screens shown. A person mentioned, by name or as a kind of user, holds nothing back, so a spoken name is never a reason to withhold.",
|
|
1238
1264
|
inputSchema: {
|
|
1239
1265
|
video: z.string().min(1).describe("YouTube URL or video id."),
|
|
1240
1266
|
intention: z.string().min(1).max(4000),
|
|
1241
|
-
readiness: z.enum(["uploading", "released_for_review", "withheld"]),
|
|
1267
|
+
readiness: z.enum(["uploading", "released_for_review", "withheld"]).describe("withheld only for a person on the record without a release, never because a name is mentioned."),
|
|
1242
1268
|
purpose: z.string().max(120).default("screenwalk_review"),
|
|
1269
|
+
title: z.string().max(200).optional().describe("What a viewer reads: the review takes this title."),
|
|
1270
|
+
description: z.string().max(8000).optional().describe("What the person wrote under the video, including what has not happened."),
|
|
1271
|
+
boundaries: z.string().max(3000).optional().describe("What the review may not conclude from the video."),
|
|
1243
1272
|
refs,
|
|
1244
1273
|
},
|
|
1245
1274
|
annotations: WRITE,
|
|
@@ -1272,7 +1301,7 @@ export function registerTools(server, ctx) {
|
|
|
1272
1301
|
intention: a.intention,
|
|
1273
1302
|
idempotency_key: `${video}:${a.purpose}`,
|
|
1274
1303
|
state: a.readiness === "released_for_review" ? "ready" : a.readiness === "withheld" ? "blocked" : "pending",
|
|
1275
|
-
body: { video_id: video, supplied: a.video, readiness: a.readiness, purpose: a.purpose },
|
|
1304
|
+
body: { video_id: video, supplied: a.video, readiness: a.readiness, purpose: a.purpose, ...(a.title ? { title: a.title } : {}), ...(a.description ? { description: a.description } : {}), ...(a.boundaries ? { boundaries: a.boundaries } : {}) },
|
|
1276
1305
|
});
|
|
1277
1306
|
}));
|
|
1278
1307
|
server.registerTool("record_handoff", {
|
|
@@ -1355,12 +1384,20 @@ export function registerTools(server, ctx) {
|
|
|
1355
1384
|
repo: z.string().max(120).optional(),
|
|
1356
1385
|
delivery: deliveryField,
|
|
1357
1386
|
person_words: personWordsField,
|
|
1387
|
+
...launchModelFields,
|
|
1358
1388
|
...base,
|
|
1359
1389
|
},
|
|
1360
1390
|
annotations: WRITE,
|
|
1361
1391
|
}, wrap(async (a, extra) => {
|
|
1362
1392
|
const { person, auth } = who(extra);
|
|
1363
1393
|
requireContribute(auth);
|
|
1394
|
+
// A proposal starts as a run does: on its requester's default, else Claude Code, and nothing stands in (jgwill/Miadi#943).
|
|
1395
|
+
const resolution = resolveProvider(undefined, discoverProviders(ctx.providersProbe), policyOf(person.id).default_provider);
|
|
1396
|
+
if (resolution.state !== "ok")
|
|
1397
|
+
return { state: resolution.state, message: resolution.message, available: resolution.available, note: "Nothing was recorded; the proposal is unstarted." };
|
|
1398
|
+
const plan = modelPlan(resolution.provider.id, a.model, modelConfig().permitted);
|
|
1399
|
+
if ("refusal" in plan)
|
|
1400
|
+
throw new ToolRefusal(plan.refusal.code, plan.refusal.message, { permitted: plan.refusal.permitted });
|
|
1364
1401
|
const r = append("work_proposal", person, auth, {
|
|
1365
1402
|
circle: a.circle,
|
|
1366
1403
|
refs: withPrimary(a.refs, a.primary_issue),
|
|
@@ -1373,6 +1410,10 @@ export function registerTools(server, ctx) {
|
|
|
1373
1410
|
title: a.title,
|
|
1374
1411
|
desired_outcome: a.desired_outcome,
|
|
1375
1412
|
repo: a.repo,
|
|
1413
|
+
resolved_provider: resolution.provider.id,
|
|
1414
|
+
...plan.fields,
|
|
1415
|
+
...(a.task_type ? { task_type: a.task_type } : {}),
|
|
1416
|
+
...(a.criticality ? { criticality: a.criticality } : {}),
|
|
1376
1417
|
...(a.primary_issue ? { primary_issue: a.primary_issue } : {}),
|
|
1377
1418
|
...(a.delivery ? { delivery: a.delivery } : {}),
|
|
1378
1419
|
...(a.person_words ? { person_words: a.person_words } : {}),
|
|
@@ -1521,7 +1562,7 @@ export function registerTools(server, ctx) {
|
|
|
1521
1562
|
const r = append("run_request", person, auth, {
|
|
1522
1563
|
circle: "engineering", refs: [source.id, `https://youtu.be/${video}`], intention: a.intention,
|
|
1523
1564
|
idempotency_key: id, approval_state: "awaiting_approval", state: "pending",
|
|
1524
|
-
body: { task: readingTask(scope), reading: scope, ...(a.companion ? { reading_companion: a.companion } : {}), session: `reading-${id.slice(8)}`, workflow_id: id, resolved_provider: resolution.provider.id },
|
|
1565
|
+
body: { task: readingTask(scope), reading: scope, ...(a.companion ? { reading_companion: a.companion } : {}), session: `reading-${id.slice(8)}`, workflow_id: id, resolved_provider: resolution.provider.id, ...routedOn(resolution.provider.id) },
|
|
1525
1566
|
});
|
|
1526
1567
|
return { ...r, workflow_id: id, approval_url: approvalUrl(r.id), gates: ["editorial_public_import", "deep_diver", "chronicle", "cultural_reuse"] };
|
|
1527
1568
|
}));
|
|
@@ -1538,7 +1579,10 @@ export function registerTools(server, ctx) {
|
|
|
1538
1579
|
const candidate = candidates[0]?.body.reading?.artifact;
|
|
1539
1580
|
if (!candidate || candidates[0].actor.person_id !== person.id || candidate.sha256 !== a.sha256 || candidate.expected_version !== a.expected_version || candidate.expected_sha256 !== a.expected_sha256)
|
|
1540
1581
|
throw new ToolRefusal("candidate_mismatch", "Read this person's staged candidate and request its exact hash and base.");
|
|
1541
|
-
const
|
|
1582
|
+
const resolution = resolveProvider(undefined, discoverProviders(ctx.providersProbe), policyOf(person.id).default_provider);
|
|
1583
|
+
if (resolution.state !== "ok")
|
|
1584
|
+
return { state: resolution.state, note: "No runtime provider was verified; nothing was queued." };
|
|
1585
|
+
const r = append("run_request", person, auth, { circle: "story", refs: [a.workflow_id], intention: a.intention, idempotency_key: `${a.workflow_id}:import:${a.sha256}`, state: "pending", approval_state: "awaiting_approval", body: { resolved_provider: resolution.provider.id, ...routedOn(resolution.provider.id), task: "Run node packages/connector/scripts/reading.mjs import <this-run-request-id>. Only import the exact typed reading_import candidate after the service proves atomic CAS and durable idempotency; read it back exactly. Stop on any mismatch. No Deep Diver or Chronicle.", reading_import: { workflow_id: a.workflow_id, sha256: a.sha256, expected_version: a.expected_version, expected_sha256: a.expected_sha256, public_release: true }, reading_preview: { markdown: candidate.markdown, diffs: candidate.diffs, manifest: candidate.manifest } } });
|
|
1542
1586
|
return { ...r, approval_url: approvalUrl(r.id), candidate: { sha256: candidate.sha256, bytes: candidate.bytes, diff: candidate.diffs, manifest: candidate.manifest } };
|
|
1543
1587
|
}));
|
|
1544
1588
|
server.registerTool("request_authorized_run", {
|
|
@@ -1556,7 +1600,8 @@ export function registerTools(server, ctx) {
|
|
|
1556
1600
|
provider: z
|
|
1557
1601
|
.enum(["codex", "pi", "copilot", "claude"])
|
|
1558
1602
|
.optional()
|
|
1559
|
-
.describe("The provider the run should launch with, verified installed on the connector host.
|
|
1603
|
+
.describe("The provider the run should launch with, verified installed on the connector host. Leave it out for Claude Code, the default. Name another only when the person asked for that provider for this mission. Codex runs only when the person also chooses Codex for this mission on the approval page (or their own policy allows it): naming it here does not choose it for them (jgwill/Miadi#926). Unknown or unavailable leaves the mission unstarted, and nothing falls back to another provider."),
|
|
1604
|
+
...launchModelFields,
|
|
1560
1605
|
steering: z
|
|
1561
1606
|
.object({
|
|
1562
1607
|
max_attempts: z.number().int().min(1).max(20).describe("How many authorized follow-up steers this approval covers."),
|
|
@@ -1579,6 +1624,9 @@ export function registerTools(server, ctx) {
|
|
|
1579
1624
|
if (resolution.state !== "ok") {
|
|
1580
1625
|
return { state: resolution.state, message: resolution.message, available: resolution.available, note: "Nothing was recorded or queued; the mission is unstarted." };
|
|
1581
1626
|
}
|
|
1627
|
+
const plan = modelPlan(resolution.provider.id, a.model, modelConfig().permitted);
|
|
1628
|
+
if ("refusal" in plan)
|
|
1629
|
+
throw new ToolRefusal(plan.refusal.code, plan.refusal.message, { permitted: plan.refusal.permitted });
|
|
1582
1630
|
const r = append("run_request", person, auth, {
|
|
1583
1631
|
circle: a.circle,
|
|
1584
1632
|
refs: withPrimary(a.refs, a.primary_issue),
|
|
@@ -1593,6 +1641,9 @@ export function registerTools(server, ctx) {
|
|
|
1593
1641
|
cwd: a.cwd,
|
|
1594
1642
|
provider: a.provider,
|
|
1595
1643
|
resolved_provider: resolution.provider.id,
|
|
1644
|
+
...plan.fields,
|
|
1645
|
+
...(a.task_type ? { task_type: a.task_type } : {}),
|
|
1646
|
+
...(a.criticality ? { criticality: a.criticality } : {}),
|
|
1596
1647
|
...(a.primary_issue ? { primary_issue: a.primary_issue } : {}),
|
|
1597
1648
|
...(a.delivery ? { delivery: a.delivery } : {}),
|
|
1598
1649
|
...(a.person_words ? { person_words: a.person_words } : {}),
|
|
@@ -1613,6 +1664,7 @@ export function registerTools(server, ctx) {
|
|
|
1613
1664
|
// Known before anyone depends on it: whether a person can steer this run once it works (jgwill/Miadi#942).
|
|
1614
1665
|
steering: steeringOf(resolution.provider.id, resolution.provider.version),
|
|
1615
1666
|
},
|
|
1667
|
+
...(resolution.provider.id === "claude" ? { model: { requested: a.model ?? null, chosen_by: a.model ? "request" : "jev_when_approved", permitted: modelConfig().permitted } } : {}),
|
|
1616
1668
|
approval_url: approvalUrl(r.id),
|
|
1617
1669
|
...(authorization.authorized
|
|
1618
1670
|
? {}
|
|
@@ -1656,6 +1708,9 @@ export function registerTools(server, ctx) {
|
|
|
1656
1708
|
session: z.string().regex(/^[A-Za-z0-9._-]{3,80}$/).optional(),
|
|
1657
1709
|
cwd: z.string().max(300).optional(),
|
|
1658
1710
|
provider: z.enum(["codex", "pi", "copilot", "claude"]).optional().describe("Verified installed on the connector host again, as request_authorized_run does."),
|
|
1711
|
+
model: z.string().regex(MODEL_NAME).nullable().optional().describe("The Claude Code model, as request_authorized_run takes it. null removes a model named earlier, so Jev chooses."),
|
|
1712
|
+
task_type: z.enum(TASK_TYPES).optional(),
|
|
1713
|
+
criticality: z.enum(CRITICALITIES).optional(),
|
|
1659
1714
|
steering: z
|
|
1660
1715
|
.object({ max_attempts: z.number().int().min(1).max(20), expires_at: z.string().optional(), pane: z.string().regex(/^\d+\.\d+$/).optional() })
|
|
1661
1716
|
.optional(),
|
|
@@ -1695,10 +1750,25 @@ export function registerTools(server, ctx) {
|
|
|
1695
1750
|
}
|
|
1696
1751
|
}
|
|
1697
1752
|
else if (live?.kind === "work_proposal") {
|
|
1753
|
+
if (c.provider !== undefined)
|
|
1754
|
+
throw new ToolRefusal("invalid_request", "A work proposal names no provider: it runs on its requester's default, else Claude Code. To run on another provider, make a run request. Nothing was recorded.");
|
|
1698
1755
|
for (const k of ["title", "desired_outcome", "repo"])
|
|
1699
1756
|
if (c[k] !== undefined)
|
|
1700
1757
|
body[k] = c[k];
|
|
1701
1758
|
}
|
|
1759
|
+
if (live?.kind === "run_request" || live?.kind === "work_proposal") {
|
|
1760
|
+
for (const k of ["task_type", "criticality"])
|
|
1761
|
+
if (c[k] !== undefined)
|
|
1762
|
+
body[k] = c[k];
|
|
1763
|
+
if (c.model !== undefined || c.provider !== undefined) {
|
|
1764
|
+
const plan = modelPlan((body.resolved_provider ?? body.provider ?? null), c.model === undefined ? body.model : c.model, modelConfig().permitted);
|
|
1765
|
+
if ("refusal" in plan)
|
|
1766
|
+
throw new ToolRefusal(plan.refusal.code, plan.refusal.message, { permitted: plan.refusal.permitted, ...(live ? revisionOut(live) : {}) });
|
|
1767
|
+
delete body.model;
|
|
1768
|
+
delete body.model_routing;
|
|
1769
|
+
Object.assign(body, plan.fields);
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1702
1772
|
if (c.primary_issue !== undefined)
|
|
1703
1773
|
body.primary_issue = c.primary_issue;
|
|
1704
1774
|
for (const k of ["delivery", "person_words"])
|
|
@@ -2042,7 +2112,7 @@ export function registerTools(server, ctx) {
|
|
|
2042
2112
|
}));
|
|
2043
2113
|
server.registerTool("request_participant_consent", {
|
|
2044
2114
|
title: "Ask a person in a video whether its words may be published",
|
|
2045
|
-
description: "
|
|
2115
|
+
description: "For a person on the record in a withheld video: filmed, or their own voice, words or screens shown. A person only mentioned, by name or as a kind of user, needs no question, so never ask because a name is spoken. A person's release from the start of a production will replace this door (jgwill/Miadi#962). 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
2116
|
inputSchema: {
|
|
2047
2117
|
video: z.string().min(1).describe("YouTube URL or video id of a source you registered."),
|
|
2048
2118
|
person_name: z.string().min(1).max(80).describe("The name they know themselves by; the page greets them with it."),
|
|
@@ -2086,7 +2156,7 @@ export function registerTools(server, ctx) {
|
|
|
2086
2156
|
decider_name: a.person_name,
|
|
2087
2157
|
...(a.person_id ? { decider_person_id: a.person_id } : {}),
|
|
2088
2158
|
...(a.asked_by ? { asked_by: a.asked_by } : {}),
|
|
2089
|
-
question: a.question ?? `${a.asked_by ?? person.name} recorded this video, and you
|
|
2159
|
+
question: a.question ?? `${a.asked_by ?? person.name} recorded this video, and you appear in it. May its words be published beside its review?`,
|
|
2090
2160
|
...(review?.review_id ? { review_id: review.review_id, review_url: review.url } : {}),
|
|
2091
2161
|
transcript: answer.text,
|
|
2092
2162
|
transcript_words: answer.words,
|
|
@@ -2626,7 +2696,7 @@ export const TOOL_STATUS = {
|
|
|
2626
2696
|
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)",
|
|
2627
2697
|
revoke_session_steering: "live, contribute, write tier (stops a run's steering, or one steer not yet consumed)",
|
|
2628
2698
|
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)",
|
|
2699
|
+
request_participant_consent: "live, contribute (one question to a person on the record in a withheld video, never for a name only mentioned, answered on a link only they decide on; sends nothing)",
|
|
2630
2700
|
request_screenwalk_reading: "live, contribute, needs_approval (host provider adapter required; stops at editorial decision)",
|
|
2631
2701
|
request_reading_import: "live, contribute, needs_approval (exact public import; atomic service contract required)",
|
|
2632
2702
|
request_deep_diver: "live, contribute, needs_approval",
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.30";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.1.
|
|
1
|
+
export const VERSION = "0.1.30";
|