@miadi/connector 0.1.43 → 0.1.45
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 +56 -3
- package/dist/client-tools.d.ts +119 -0
- package/dist/client-tools.js +196 -0
- package/dist/screenwalks.d.ts +243 -0
- package/dist/screenwalks.js +455 -0
- package/dist/server.d.ts +3 -2
- package/dist/server.js +26 -4
- package/dist/store.d.ts +1 -0
- package/dist/store.js +4 -0
- package/dist/tools.d.ts +10 -1
- package/dist/tools.js +429 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/dist/tools.js
CHANGED
|
@@ -44,6 +44,8 @@ import { readingScope, canonicalVideo, suppliedDialogue } from "./reading/contra
|
|
|
44
44
|
import { workflowId } from "./reading/workflow.js";
|
|
45
45
|
import { readingTask } from "./reading/adapters.js";
|
|
46
46
|
import { recordsSeenBy, redactRecord } from "./record-view.js";
|
|
47
|
+
import { MAX_REGISTRATION_BYTES, MIN_REGISTRATION_BYTES, REGISTRY_REVIEW_KIND, REVIEW_SOURCE_RELATION, ScreenwalkRefusal, inventoryOf, listRegistrations, looksLikeScreenwalk, namesOf, namesScreenwalk, pageText, partIndex, readBrief, readMoments, readRegistration, readinessOf, registryOrigins, relateRegistration, reviewRecordsOf, reviewRelationsOf, screenwalkRefOf, screenwalksOfReview, selectRegistration, videoOf, } from "./screenwalks.js";
|
|
48
|
+
import { annotateTools, clientToolsBlock } from "./client-tools.js";
|
|
47
49
|
import { artefactVisibility, readArtefactWeave, saveResearchArtefact } from "@miadi/inquiry-weave";
|
|
48
50
|
import { ResearchUploads, UploadRefusal } from "./uploads.js";
|
|
49
51
|
import { DEFAULT_PAGE_BYTES, FOUNDATIONS_PERMISSION, FileRefusal, MAX_TEXT_BYTES, MIN_PAGE_BYTES, TEXT_TYPES, checkRelativePath, episodeNumberOf, extensionOf, fileRef, holdsFoundationRead, isFoundationDoc, pageOf, parseFileRef, } from "./episode-files.js";
|
|
@@ -103,6 +105,8 @@ function wrap(fn) {
|
|
|
103
105
|
catch (error) {
|
|
104
106
|
if (error instanceof ToolRefusal)
|
|
105
107
|
return fail({ error: error.code, message: error.message, ...(error.detail ? { detail: error.detail } : {}) });
|
|
108
|
+
if (error instanceof ScreenwalkRefusal)
|
|
109
|
+
return fail({ error: error.code, message: error.message, ...(error.detail ? { detail: error.detail } : {}) });
|
|
106
110
|
if (error instanceof UploadRefusal)
|
|
107
111
|
return fail({ error: "invalid_upload", message: error.message });
|
|
108
112
|
if (error instanceof FileRefusal)
|
|
@@ -122,7 +126,7 @@ function wrap(fn) {
|
|
|
122
126
|
}
|
|
123
127
|
const READ = { readOnlyHint: true, destructiveHint: false, openWorldHint: false };
|
|
124
128
|
const WRITE = { readOnlyHint: false, destructiveHint: false, openWorldHint: false };
|
|
125
|
-
const refs = z.array(z.string()).max(50).default([]).describe("References: miadi-review:<uuid>, miadi-chronicle://<n>, owner/repo#n, session:<uuid>, a record id, or a URL.");
|
|
129
|
+
const refs = z.array(z.string()).max(50).default([]).describe("References: miadi-review:<uuid>, miadi-chronicle://<n>, miadi-screenwalk:<id>, owner/repo#n, session:<uuid>, a record id, or a URL.");
|
|
126
130
|
const circle = z.enum(CIRCLE_IDS);
|
|
127
131
|
const claim = z.enum(CLAIM_CATEGORIES).describe("observed, hypothesis, desired_future, fiction or verified_implementation.");
|
|
128
132
|
const primaryIssue = z
|
|
@@ -242,8 +246,16 @@ const launchModelFields = {
|
|
|
242
246
|
.optional()
|
|
243
247
|
.describe("The weakest Claude Code model this mission may run on (opus, sonnet, haiku or fable), when the person's words set a floor such as \"needs a high-reasoning model\" or \"at least opus\". Jev then chooses only among permitted models at or above it, and reads no words. When no permitted model meets it, approving is refused and the approval page says so before the click."),
|
|
244
248
|
};
|
|
249
|
+
/** Registers every tool, and returns the names it registered: what a tools/list of this server answers. */
|
|
245
250
|
export function registerTools(server, ctx) {
|
|
246
251
|
const { config, miadi, reviews, ledger } = ctx;
|
|
252
|
+
// The names as they are registered, for the record of what each client last fetched (client-tools.ts).
|
|
253
|
+
const offered = [];
|
|
254
|
+
const registerTool = server.registerTool.bind(server);
|
|
255
|
+
server.registerTool = ((name, ...rest) => {
|
|
256
|
+
offered.push(name);
|
|
257
|
+
return registerTool(name, ...rest);
|
|
258
|
+
});
|
|
247
259
|
// One server is made per request, so the person a tool call runs for is this request's viewer.
|
|
248
260
|
let viewer;
|
|
249
261
|
/**
|
|
@@ -396,7 +408,7 @@ export function registerTools(server, ctx) {
|
|
|
396
408
|
// ── reads ──────────────────────────────────────────────────────────────
|
|
397
409
|
server.registerTool("get_capabilities", {
|
|
398
410
|
title: "What this connector can do for you",
|
|
399
|
-
description: "Start here with the Miadi connector. The capability handshake: who you are signed in as (who am I), your Miadi tier and scopes, the full list of Miadi tools with each one's status (live, needs_approval, write_tier), the services reached and the five circles. Call this first.",
|
|
411
|
+
description: "Start here with the Miadi connector. The capability handshake: who you are signed in as (who am I), your Miadi tier and scopes, the full list of Miadi tools with each one's status (live, needs_approval, write_tier), the services reached and the five circles. When the tool list your client holds is older than this server, client_tools says so: the version of that list, the tools it lacks, and how a person makes the client fetch it again. Call this first.",
|
|
400
412
|
inputSchema: {},
|
|
401
413
|
annotations: READ,
|
|
402
414
|
}, wrap(async (_args, extra) => {
|
|
@@ -409,9 +421,16 @@ export function registerTools(server, ctx) {
|
|
|
409
421
|
}, (e) => (e instanceof MiadiError && e.status === 0 ? "unavailable" : "reachable"));
|
|
410
422
|
// Miadi's answer now, not the sign-in's last one (cached up to five minutes).
|
|
411
423
|
const foundations = holdsFoundationRead(fresh ?? person.permissions);
|
|
424
|
+
// The tool list this client last fetched, against the one this version offers (jgwill/Miadi#1180).
|
|
425
|
+
const oauthClient = ctx.oauthState.read().clients[auth.clientId];
|
|
426
|
+
const clientTools = ctx.clientTools
|
|
427
|
+
? clientToolsBlock({ key: ctx.clientTools.key, entry: ctx.clientTools.lists.read(ctx.clientTools.key), version: VERSION, offered, client: { name: oauthClient?.client_name, redirect_uris: oauthClient?.redirect_uris } })
|
|
428
|
+
: null;
|
|
412
429
|
return {
|
|
413
430
|
service: "@miadi/connector",
|
|
414
431
|
version: VERSION,
|
|
432
|
+
// Said first when it applies: what follows names what the server offers, and this client's list is older.
|
|
433
|
+
...(clientTools ? { client_tools: clientTools } : {}),
|
|
415
434
|
contract: "jgwill/Miadi#815 Connector v2, jgwill/Miadi#816 Review Bridge",
|
|
416
435
|
reading_workflow: {
|
|
417
436
|
contract: "transcript-first-v1",
|
|
@@ -440,7 +459,7 @@ export function registerTools(server, ctx) {
|
|
|
440
459
|
review_service: { url: config.reviewUrl, search: reviews.canSearch ? "enabled" : "disabled: no token on the connector host" },
|
|
441
460
|
ledger: "connector ledger (append-only, /srv/miadi/connector)",
|
|
442
461
|
},
|
|
443
|
-
tools: TOOL_STATUS,
|
|
462
|
+
tools: annotateTools(TOOL_STATUS, clientTools),
|
|
444
463
|
mission_standard: ctx.draftReview ? await standardStatus(ctx.draftReview) : { state: "unavailable" },
|
|
445
464
|
// Registered is not operational: whether a steer can reach a pane on this host now (jgwill/Miadi#909).
|
|
446
465
|
steering: {
|
|
@@ -450,6 +469,19 @@ export function registerTools(server, ctx) {
|
|
|
450
469
|
// Host truth, as provider_capabilities is: what this host would load into a new session.
|
|
451
470
|
...(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 } : {}) }]; })) }),
|
|
452
471
|
},
|
|
472
|
+
// The Screenwalk Registry, read as the person through Miadi's registry door (jgwill/Miadi#1180).
|
|
473
|
+
screenwalk_registry: {
|
|
474
|
+
read: "get_screenwalk",
|
|
475
|
+
list: "list_screenwalks",
|
|
476
|
+
review_step: "request_screenwalk_review",
|
|
477
|
+
registry: `${config.miadiPublicUrl}/screenwalks`,
|
|
478
|
+
accepts: ["<registry id>", "miadi-screenwalk:<id>", `${config.miadiPublicUrl}/screenwalks/<id>`],
|
|
479
|
+
authority: "your own Miadi sign-in: the registry's rights decide what you read (review or steward screenwalk registrations, or a facilitator's seat), and stewarding decides whether a relation is written on a registration",
|
|
480
|
+
review_match: "the registration's YouTube video id, searched in the Miadi Review Service",
|
|
481
|
+
review_search: reviews.canSearch ? "enabled" : "disabled: no review service token on the connector host",
|
|
482
|
+
relation: `a link (${REVIEW_SOURCE_RELATION}) in the connector's records from the registration to the review, and a ${REGISTRY_REVIEW_KIND} relation on the registration to the review`,
|
|
483
|
+
not_done_here: "No review is created without a person's approval. No inventory is copied into a review. A registration is not a transcript.",
|
|
484
|
+
},
|
|
453
485
|
foundation_read: {
|
|
454
486
|
permission: FOUNDATIONS_PERMISSION,
|
|
455
487
|
held: foundations,
|
|
@@ -471,7 +503,7 @@ export function registerTools(server, ctx) {
|
|
|
471
503
|
}));
|
|
472
504
|
server.registerTool("get_context", {
|
|
473
505
|
title: "Resolve a reference",
|
|
474
|
-
description: "Resolve one reference to what it points at: miadi-review:<uuid> (with the episodes that hold it), miadi-chronicle://<n> or chronicle:<folder>, miadi-ceremony:, miadi-circle:, miadi-foundation:, miadi-tracing:, session:<uuid>, owner/repo#n (GitHub issue), a YouTube URL or video id, or a connector record id. Also lists connector records that cite it.",
|
|
506
|
+
description: "Resolve one reference to what it points at: miadi-review:<uuid> (with the episodes that hold it), miadi-screenwalk:<id> or a screenwalk's page URL (its registration's identity, video and standing), miadi-chronicle://<n> or chronicle:<folder>, miadi-ceremony:, miadi-circle:, miadi-foundation:, miadi-tracing:, session:<uuid>, owner/repo#n (GitHub issue), a YouTube URL or video id, or a connector record id. Also lists connector records that cite it.",
|
|
475
507
|
inputSchema: { ref: z.string().min(1) },
|
|
476
508
|
annotations: READ,
|
|
477
509
|
}, wrap(async ({ ref }, extra) => {
|
|
@@ -509,6 +541,10 @@ export function registerTools(server, ctx) {
|
|
|
509
541
|
cited_by: cited,
|
|
510
542
|
};
|
|
511
543
|
}
|
|
544
|
+
if (looksLikeScreenwalk(r, walkOrigins)) {
|
|
545
|
+
const w = await walkRead(person, r);
|
|
546
|
+
return { ref: r, kind: "screenwalk", ...walkHead(person, w), cited_by: records().filter((x) => namesScreenwalk(x, w.named.id)), next: "get_screenwalk reads the whole registration, its brief or its moments." };
|
|
547
|
+
}
|
|
512
548
|
const video = videoIdOf(r);
|
|
513
549
|
if (video && !reviewIdOf(r)) {
|
|
514
550
|
return { ref: r, kind: "video", video_id: video, reviews: await lookupByVideo(video), cited_by: cited };
|
|
@@ -569,6 +605,137 @@ export function registerTools(server, ctx) {
|
|
|
569
605
|
const found = (await reviews.search(videoId, 10)).filter((x) => x.video_id === videoId);
|
|
570
606
|
return found.map((x) => reviews.summary(x));
|
|
571
607
|
}
|
|
608
|
+
// ── the screenwalk registry, read as the person (jgwill/Miadi#1180) ─────
|
|
609
|
+
const walkOrigins = registryOrigins(config);
|
|
610
|
+
/** Where a registration is read by a person, on this factory's public address. */
|
|
611
|
+
const walkLinks = (id) => {
|
|
612
|
+
const record = `${config.miadiPublicUrl}/api/screenwalks/registrations/${encodeURIComponent(id)}`;
|
|
613
|
+
return { page_url: `${config.miadiPublicUrl}/screenwalks/${encodeURIComponent(id)}`, record_url: record, brief_url: `${record}?format=brief`, moments_url: `${record}?format=moments` };
|
|
614
|
+
};
|
|
615
|
+
/** A registration read as the person. The registry's refusal becomes this tool's, in the registry's terms. */
|
|
616
|
+
async function walkRead(person, input) {
|
|
617
|
+
const named = screenwalkRefOf(input, walkOrigins);
|
|
618
|
+
const read = await readRegistration(miadi, person.token, named.id);
|
|
619
|
+
if (read.state !== "found")
|
|
620
|
+
throw new ToolRefusal(read.state, read.message, { screenwalk: named.reference });
|
|
621
|
+
return { named, registration: read.registration, summary: read.summary, read_at: new Date().toISOString() };
|
|
622
|
+
}
|
|
623
|
+
/** What every answer about one registration carries: its identity, its video, where it stands, and where and as whom it was read. */
|
|
624
|
+
const walkHead = (person, w) => ({
|
|
625
|
+
state: "found",
|
|
626
|
+
screenwalk: { id: w.named.id, reference: w.named.reference, ...walkLinks(w.named.id) },
|
|
627
|
+
resolved_from: w.named.form,
|
|
628
|
+
schema: w.registration.schema ?? null,
|
|
629
|
+
revision: w.registration.revision,
|
|
630
|
+
registered: w.registration.registered ?? null,
|
|
631
|
+
...(w.registration.test === true ? { test: true } : {}),
|
|
632
|
+
video: videoOf(w.registration),
|
|
633
|
+
names: namesOf(w.registration, w.summary),
|
|
634
|
+
readiness: readinessOf(w.registration, w.summary),
|
|
635
|
+
inventory: inventoryOf(w.registration),
|
|
636
|
+
source: {
|
|
637
|
+
registry: `${config.miadiPublicUrl}/screenwalks`,
|
|
638
|
+
door: `GET /api/screenwalks/registrations/${w.named.id}`,
|
|
639
|
+
read_as: { person_id: person.id, name: person.name },
|
|
640
|
+
read_at: w.read_at,
|
|
641
|
+
revision: w.registration.revision,
|
|
642
|
+
},
|
|
643
|
+
});
|
|
644
|
+
/**
|
|
645
|
+
* The reviews the Miadi Review Service holds of one video, matched by its YouTube video id: the key the registry and
|
|
646
|
+
* the Review Service share. A search that cannot run is an answer of its own, never read as "no review".
|
|
647
|
+
*/
|
|
648
|
+
async function reviewsOfVideo(videoId) {
|
|
649
|
+
if (!reviews.canSearch)
|
|
650
|
+
return { state: "lookup_unavailable", reviews: [], message: "The connector host has no review service token, so the Miadi Review Service cannot be searched by video." };
|
|
651
|
+
try {
|
|
652
|
+
const found = (await reviews.search(videoId, 10)).filter((x) => x.video_id === videoId).map((x) => reviews.summary(x));
|
|
653
|
+
return { state: found.length === 0 ? "no_review" : found.length === 1 ? "found" : "ambiguous", reviews: found };
|
|
654
|
+
}
|
|
655
|
+
catch (error) {
|
|
656
|
+
return { state: "lookup_unavailable", reviews: [], message: `The Miadi Review Service could not be searched: ${error instanceof Error ? error.message : String(error)}.` };
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
const WALK_REVIEW_NEXT = {
|
|
660
|
+
related: "The registration and the review of its video are related in both directions. review_lookup reads the review.",
|
|
661
|
+
found: "A review of this video exists. request_screenwalk_review records the relation between the two and creates nothing.",
|
|
662
|
+
no_review: "No review of this video exists. request_screenwalk_review prepares one create request with this registration as its source, for a person to approve.",
|
|
663
|
+
ambiguous: "Several reviews of this video exist. Nothing is related or created until a person names the one.",
|
|
664
|
+
lookup_unavailable: "Whether a review exists is unknown. Ask for no new review until the lookup works.",
|
|
665
|
+
};
|
|
666
|
+
/** Read-only: whether a review of the registration's video exists, and what relates the two on each side. */
|
|
667
|
+
async function walkReview(w) {
|
|
668
|
+
const video = videoOf(w.registration);
|
|
669
|
+
const onRegistration = reviewRelationsOf(w.registration);
|
|
670
|
+
const inRecords = reviewRecordsOf(records(), w.named.id);
|
|
671
|
+
const base = { matched_by: "youtube_video_id", video_id: video.video_id, service: config.reviewUrl };
|
|
672
|
+
if (!video.video_id) {
|
|
673
|
+
return { ...base, state: "no_video_id", message: "The registration's video URL names no YouTube video id, so no review can be matched to it.", reviews: [], relation: { on_registration: onRegistration, in_connector_records: inRecords } };
|
|
674
|
+
}
|
|
675
|
+
const found = await reviewsOfVideo(video.video_id);
|
|
676
|
+
const one = found.state === "found" ? found.reviews[0] : null;
|
|
677
|
+
const recorded = one ? { from_registration: onRegistration.some((x) => x.review_id === one.review_id), from_review: inRecords.some((x) => x.review_id === one.review_id) } : null;
|
|
678
|
+
return {
|
|
679
|
+
...base,
|
|
680
|
+
state: found.state,
|
|
681
|
+
...(found.message ? { message: found.message } : {}),
|
|
682
|
+
reviews: found.reviews,
|
|
683
|
+
relation: { on_registration: onRegistration, in_connector_records: inRecords, ...(recorded ? { recorded } : {}) },
|
|
684
|
+
next: WALK_REVIEW_NEXT[recorded?.from_registration && recorded.from_review ? "related" : found.state],
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Record that a review is the review of a registered screenwalk's video, on both sides, once: a link in the
|
|
689
|
+
* connector's records (the name those records already give a source and its review), which a review's page and
|
|
690
|
+
* review_lookup read, and a relation on the registration itself, which its page and its brief read. The second is
|
|
691
|
+
* written as the person and needs the right to steward registrations; without it the first still stands.
|
|
692
|
+
*/
|
|
693
|
+
async function relateWalkReview(person, auth, w, review, source, a) {
|
|
694
|
+
const to = `miadi-review:${review.review_id}`;
|
|
695
|
+
const prior = all().find((r) => r.kind === "link" && r.body.relation === REVIEW_SOURCE_RELATION && namesScreenwalk(r, w.named.id) && reviewIdOf(String(r.body.to ?? "")) === review.review_id);
|
|
696
|
+
const link = prior ??
|
|
697
|
+
append("link", person, auth, {
|
|
698
|
+
circle: "continuity",
|
|
699
|
+
refs: [w.named.reference, to],
|
|
700
|
+
intention: a.intention ?? "Relate a registered screenwalk to the Miadi Review of its video.",
|
|
701
|
+
...(a.role ? { role: a.role } : {}),
|
|
702
|
+
idempotency_key: `screenwalk-review:${w.named.id}:${review.review_id}`,
|
|
703
|
+
body: {
|
|
704
|
+
from: w.named.reference,
|
|
705
|
+
to,
|
|
706
|
+
relation: REVIEW_SOURCE_RELATION,
|
|
707
|
+
note: `The Miadi Review Service holds this one review of the video the screenwalk registers (YouTube video id ${String(source.video_id)}). The registration was read at revision ${String(source.revision)}.`,
|
|
708
|
+
source,
|
|
709
|
+
},
|
|
710
|
+
});
|
|
711
|
+
const held = reviewRelationsOf(w.registration).find((x) => x.review_id === review.review_id);
|
|
712
|
+
// The registry writes its addresses with "//" (miadi-chronicle://257); the review's address follows it there.
|
|
713
|
+
const relation = { id: `review-${review.review_id}`, kind: REGISTRY_REVIEW_KIND, target: `miadi-review://${review.review_id}` };
|
|
714
|
+
const words = {
|
|
715
|
+
...relation,
|
|
716
|
+
label: "Miadi Review of this walk's video",
|
|
717
|
+
note: `${review.url}. Matched by the YouTube video id ${String(source.video_id)}. Recorded through the Miadi connector; the connector's record is ${link.id}.`,
|
|
718
|
+
};
|
|
719
|
+
let written = held ? { state: "held" } : await relateRegistration(miadi, person.token, w.named.id, w.registration.revision, words);
|
|
720
|
+
if (written.state === "not_recorded" && written.reason === "conflict") {
|
|
721
|
+
// The registration moved between the read and the write: read it once more and write against what it is now.
|
|
722
|
+
const again = await readRegistration(miadi, person.token, w.named.id);
|
|
723
|
+
if (again.state === "found") {
|
|
724
|
+
written = reviewRelationsOf(again.registration).some((x) => x.review_id === review.review_id)
|
|
725
|
+
? { state: "held" }
|
|
726
|
+
: await relateRegistration(miadi, person.token, w.named.id, again.registration.revision, words);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
return {
|
|
730
|
+
from_review: { state: prior ? "held" : "recorded", where: "the connector's records", record: link.id, from: w.named.reference, to, relation: REVIEW_SOURCE_RELATION, read_by: ["review_lookup", "get_screenwalk", `${config.miadiPublicUrl}/reviews/${review.review_id}`] },
|
|
731
|
+
from_registration: {
|
|
732
|
+
where: "the registration",
|
|
733
|
+
...(held ? { relation: held.id, kind: held.kind, target: held.target } : relation),
|
|
734
|
+
...written,
|
|
735
|
+
read_by: ["get_screenwalk", walkLinks(w.named.id).page_url],
|
|
736
|
+
},
|
|
737
|
+
};
|
|
738
|
+
}
|
|
572
739
|
server.registerTool("list_circles", {
|
|
573
740
|
title: "The five circles, and the talking circles you belong to",
|
|
574
741
|
description: "The five accountable circles (Story, Stewardship, Engineering, Evaluation, Continuity) with what each is accountable for and how many handoffs each holds open, and the Miadi talking circles your person token reaches.",
|
|
@@ -984,7 +1151,7 @@ export function registerTools(server, ctx) {
|
|
|
984
1151
|
}));
|
|
985
1152
|
server.registerTool("review_lookup", {
|
|
986
1153
|
title: "Find a Miadi review",
|
|
987
|
-
description: "Find the review of a video before anything is created: by review id, review URL, YouTube URL or video id, or keywords. Returns review id, latest version, video, Deep Diver readiness
|
|
1154
|
+
description: "Find the review of a video before anything is created: by review id, review URL, YouTube URL or video id, or keywords. Returns review id, latest version, video, Deep Diver readiness, the episodes that hold it and the registered screenwalks related to it. Never creates a review.",
|
|
988
1155
|
inputSchema: { query: z.string().min(1) },
|
|
989
1156
|
annotations: READ,
|
|
990
1157
|
}, wrap(async ({ query }, extra) => {
|
|
@@ -995,13 +1162,13 @@ export function registerTools(server, ctx) {
|
|
|
995
1162
|
if (!r)
|
|
996
1163
|
return { query, state: "not_found", review_id: id };
|
|
997
1164
|
const holders = await miadi.get(person.token, `/api/chronicle/resolve?uri=${encodeURIComponent(`miadi-review:${id}`)}`).then((b) => b?.holders ?? b?.resolution?.holders ?? null, () => null);
|
|
998
|
-
return { query, state: "found", review: reviews.summary(r), transcript: await transcriptBrief(id, r.video_id), holders, cited_by: touching(`miadi-review:${id}`) };
|
|
1165
|
+
return { query, state: "found", review: reviews.summary(r), transcript: await transcriptBrief(id, r.video_id), holders, screenwalks: screenwalksOfReview(records(), id), cited_by: touching(`miadi-review:${id}`) };
|
|
999
1166
|
}
|
|
1000
1167
|
const video = videoIdOf(query);
|
|
1001
1168
|
if (video) {
|
|
1002
1169
|
const found = await lookupByVideo(video);
|
|
1003
1170
|
const intents = records().filter((r) => r.kind === "source_intent" && r.body.video_id === video);
|
|
1004
|
-
const withTranscript = Array.isArray(found) ? await Promise.all(found.slice(0, 5).map(async (x) => ({ ...x, transcript: await transcriptBrief(x.review_id, video) }))) : found;
|
|
1171
|
+
const withTranscript = Array.isArray(found) ? await Promise.all(found.slice(0, 5).map(async (x) => ({ ...x, transcript: await transcriptBrief(x.review_id, video), screenwalks: screenwalksOfReview(records(), x.review_id) }))) : found;
|
|
1005
1172
|
return { query, video_id: video, state: Array.isArray(found) && found.length ? "found" : "no_review", reviews: withTranscript, source_intents: intents };
|
|
1006
1173
|
}
|
|
1007
1174
|
if (!reviews.canSearch)
|
|
@@ -1079,6 +1246,167 @@ export function registerTools(server, ctx) {
|
|
|
1079
1246
|
},
|
|
1080
1247
|
};
|
|
1081
1248
|
}));
|
|
1249
|
+
server.registerTool("get_screenwalk", {
|
|
1250
|
+
title: "Read a registered screenwalk",
|
|
1251
|
+
description: "Read one screenwalk's registration from the Screenwalk Registry, as you: its registry id and page, the canonical YouTube URL and video id, the safe title, title and description with where they stand, its revision and who registered it, and the inventory already prepared for it (question sets and their states, segments, sources, questions, purpose lists and their items, relations including correlates, names as heard, coverage, and what a person checked), in the registry's own schema. Give the registry id (2612021410), miadi-screenwalk:<id>, or the screenwalk's page URL on this factory. format: record (the default; parts keeps only the top-level parts you name, purpose keeps one purpose list), brief (the registry's Markdown brief; purpose gives the brief of one list) or moments (one row per timeframe). A registration larger than max_bytes comes in pages with its size and sha256, never cut silently. With record it also says whether the Miadi Review Service holds a review of this video, matched by the YouTube video id, and what relates the two. Read-only: it never changes the registration and never creates a review. The inventory is the registry's record of what was asked about the video, not a review and not a transcript.",
|
|
1252
|
+
inputSchema: {
|
|
1253
|
+
ref: z.string().min(1).max(500).describe("The registry id, miadi-screenwalk:<id>, or the screenwalk's page URL on this factory's registry."),
|
|
1254
|
+
format: z.enum(["record", "brief", "moments"]).default("record"),
|
|
1255
|
+
purpose: z.string().max(80).optional().describe("A purpose list's id (follow-ups, circle-topics, …). With brief: the brief of that list. With record: that list only among the purposes."),
|
|
1256
|
+
parts: z.array(z.string().min(1).max(40)).max(30).optional().describe("With record: only these top-level parts of the registration (video, rounds, decisions, knowledge, purposes, relations, names, topics, notices, coverage, stages, …)."),
|
|
1257
|
+
offset: z.number().int().min(0).optional().describe("With a paged answer: the next.offset it returned."),
|
|
1258
|
+
revision: z.string().max(64).optional().describe("With offset: the next.revision it returned, so pages of two revisions are never joined."),
|
|
1259
|
+
max_bytes: z.number().int().min(MIN_REGISTRATION_BYTES).max(MAX_REGISTRATION_BYTES).optional().describe("The most bytes of registration, brief or moments one answer carries. Default 100000."),
|
|
1260
|
+
},
|
|
1261
|
+
annotations: READ,
|
|
1262
|
+
}, wrap(async (a, extra) => {
|
|
1263
|
+
const { person } = who(extra);
|
|
1264
|
+
const format = a.format ?? "record";
|
|
1265
|
+
if (format !== "record" && a.parts?.length)
|
|
1266
|
+
throw new ToolRefusal("invalid_request", "parts selects parts of the record; the brief and the moment index are the registry's own projections and come whole.");
|
|
1267
|
+
if (format === "moments" && a.purpose)
|
|
1268
|
+
throw new ToolRefusal("invalid_request", "purpose selects a list in the brief or in the record; the moment index has no purpose filter.");
|
|
1269
|
+
const w = await walkRead(person, a.ref);
|
|
1270
|
+
const head = walkHead(person, w);
|
|
1271
|
+
const lists = (Array.isArray(w.registration.purposes) ? w.registration.purposes : []).map((l) => String(l?.id));
|
|
1272
|
+
if (a.purpose && !lists.includes(a.purpose))
|
|
1273
|
+
throw new ToolRefusal("purpose_not_found", `No purpose list "${a.purpose}" in this registration.`, { purposes: lists });
|
|
1274
|
+
const paging = { ...(a.offset !== undefined ? { offset: a.offset } : {}), ...(a.revision ? { revision: a.revision } : {}), ...(a.max_bytes ? { maxBytes: a.max_bytes } : {}) };
|
|
1275
|
+
if (format === "brief") {
|
|
1276
|
+
const brief = await readBrief(miadi, person.token, w.named.id, a.purpose);
|
|
1277
|
+
if (brief.state !== "found")
|
|
1278
|
+
throw new ToolRefusal(brief.state, brief.message, { screenwalk: w.named.reference });
|
|
1279
|
+
const page = pageText(brief.markdown, paging);
|
|
1280
|
+
return { ...head, format, ...(a.purpose ? { purpose: a.purpose } : {}), brief: { bytes: page.bytes, sha256: page.sha256, complete: page.complete, page: page.page, markdown: page.text } };
|
|
1281
|
+
}
|
|
1282
|
+
if (format === "moments") {
|
|
1283
|
+
const m = await readMoments(miadi, person.token, w.named.id);
|
|
1284
|
+
if (m.state !== "found")
|
|
1285
|
+
throw new ToolRefusal(m.state, m.message, { screenwalk: w.named.reference });
|
|
1286
|
+
const page = pageText(JSON.stringify(m.moments), paging);
|
|
1287
|
+
return {
|
|
1288
|
+
...head,
|
|
1289
|
+
format,
|
|
1290
|
+
moments_revision: m.revision,
|
|
1291
|
+
...(m.revision !== null && m.revision !== w.registration.revision ? { note: "The registration changed between the two reads: the moment index is of the revision it names." } : {}),
|
|
1292
|
+
rows: m.moments.length,
|
|
1293
|
+
...(page.complete ? { moments: m.moments } : { moments: null, paged: { encoding: "json", bytes: page.bytes, sha256: page.sha256, page: page.page, text: page.text } }),
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
const selected = selectRegistration(w.registration, { ...(a.parts?.length ? { parts: a.parts } : {}), ...(a.purpose ? { purpose: a.purpose } : {}) });
|
|
1297
|
+
const page = pageText(JSON.stringify(selected.value), paging);
|
|
1298
|
+
return {
|
|
1299
|
+
...head,
|
|
1300
|
+
format,
|
|
1301
|
+
parts: {
|
|
1302
|
+
returned: selected.returned,
|
|
1303
|
+
left_out: selected.left_out,
|
|
1304
|
+
...("purposes_left_out" in selected ? { purpose: selected.purpose, purposes_left_out: selected.purposes_left_out } : {}),
|
|
1305
|
+
index: partIndex(w.registration),
|
|
1306
|
+
},
|
|
1307
|
+
...(page.complete
|
|
1308
|
+
? { registration: selected.value }
|
|
1309
|
+
: {
|
|
1310
|
+
registration: null,
|
|
1311
|
+
paged: {
|
|
1312
|
+
encoding: "json",
|
|
1313
|
+
bytes: page.bytes,
|
|
1314
|
+
sha256: page.sha256,
|
|
1315
|
+
page: page.page,
|
|
1316
|
+
text: page.text,
|
|
1317
|
+
note: "This selection is larger than one answer carries. Its JSON text comes in pages: join them in order and check the sha256, or ask for fewer parts.",
|
|
1318
|
+
},
|
|
1319
|
+
}),
|
|
1320
|
+
// A following page of one read does not search the Review Service again.
|
|
1321
|
+
...(a.offset ? {} : { review: await walkReview(w) }),
|
|
1322
|
+
};
|
|
1323
|
+
}));
|
|
1324
|
+
server.registerTool("list_screenwalks", {
|
|
1325
|
+
title: "List registered screenwalks",
|
|
1326
|
+
description: "The screenwalk registrations you may see in the Screenwalk Registry, newest registration first, as the registry's own list returns them: registry id, page, video URL and id, title, where the names stand, revision, who registered it and when, coverage and counts. Filter by the day they were registered (registered_on, a UTC day) or a window (registered_from, registered_to), by status, coverage, a name heard in them, or a video (YouTube URL or id). with_review adds, for at most 10 rows, whether the Miadi Review Service holds a review of each video. Read-only. A registration listed here says nothing about whether another agent's validation of it has finished.",
|
|
1327
|
+
inputSchema: {
|
|
1328
|
+
registered_on: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional().describe("A UTC day, YYYY-MM-DD: the registrations registered that day."),
|
|
1329
|
+
registered_from: z.string().max(40).optional().describe("An ISO date or instant: registered at or after it."),
|
|
1330
|
+
registered_to: z.string().max(40).optional().describe("An ISO date or instant: registered before it."),
|
|
1331
|
+
status: z.enum(["proposed", "needs_review", "approved", "approved_with_changes", "rejected"]).optional(),
|
|
1332
|
+
coverage: z.enum(["thin", "partial", "complete"]).optional(),
|
|
1333
|
+
name: z.string().max(100).optional().describe("Words of a name heard, likely or settled in the registration."),
|
|
1334
|
+
video: z.string().max(200).optional().describe("A YouTube URL or video id: the registrations of that video."),
|
|
1335
|
+
with_review: z.boolean().optional().describe("Add each row's review state from the Miadi Review Service (at most 10 rows a call)."),
|
|
1336
|
+
limit: z.number().int().min(1).max(100).default(25),
|
|
1337
|
+
offset: z.number().int().min(0).default(0),
|
|
1338
|
+
},
|
|
1339
|
+
annotations: READ,
|
|
1340
|
+
}, wrap(async (a, extra) => {
|
|
1341
|
+
const { person } = who(extra);
|
|
1342
|
+
const instant = (value, what) => {
|
|
1343
|
+
if (!value)
|
|
1344
|
+
return null;
|
|
1345
|
+
const t = Date.parse(value);
|
|
1346
|
+
if (!Number.isFinite(t))
|
|
1347
|
+
throw new ToolRefusal("invalid_request", `${what} is an ISO date or instant (2026-12-02 or 2026-12-02T15:00:00Z).`);
|
|
1348
|
+
return t;
|
|
1349
|
+
};
|
|
1350
|
+
const day = instant(a.registered_on ? `${a.registered_on}T00:00:00.000Z` : undefined, "registered_on");
|
|
1351
|
+
const from = day ?? instant(a.registered_from, "registered_from");
|
|
1352
|
+
const to = day !== null ? day + 86_400_000 : instant(a.registered_to, "registered_to");
|
|
1353
|
+
const video = a.video ? videoOf({ video: { url: a.video.trim().length === 11 ? `https://youtu.be/${a.video.trim()}` : a.video } }).video_id : null;
|
|
1354
|
+
if (a.video && !video)
|
|
1355
|
+
throw new ToolRefusal("invalid_ref", "video is a YouTube URL or an 11-character video id.");
|
|
1356
|
+
const listed = await listRegistrations(miadi, person.token, { ...(a.status ? { status: a.status } : {}), ...(a.name ? { name: a.name } : {}), ...(a.coverage ? { coverage: a.coverage } : {}) });
|
|
1357
|
+
if (listed.state !== "found")
|
|
1358
|
+
throw new ToolRefusal(listed.state, listed.message);
|
|
1359
|
+
const read_at = new Date().toISOString();
|
|
1360
|
+
const kept = listed.registrations.filter((s) => {
|
|
1361
|
+
const at = Date.parse(String(s?.registered?.at ?? ""));
|
|
1362
|
+
if (from !== null && !(at >= from))
|
|
1363
|
+
return false;
|
|
1364
|
+
if (to !== null && !(at < to))
|
|
1365
|
+
return false;
|
|
1366
|
+
return !video || videoOf({ video: s?.video }).video_id === video;
|
|
1367
|
+
});
|
|
1368
|
+
const limit = Math.min(a.limit ?? 25, a.with_review ? 10 : 100);
|
|
1369
|
+
const offset = a.offset ?? 0;
|
|
1370
|
+
const page = kept.slice(offset, offset + limit);
|
|
1371
|
+
const rows = await Promise.all(page.map(async (s) => {
|
|
1372
|
+
const v = videoOf({ video: s?.video });
|
|
1373
|
+
const row = {
|
|
1374
|
+
screenwalk: s?.screenwalk ?? null,
|
|
1375
|
+
reference: s?.reference ?? null,
|
|
1376
|
+
page_url: walkLinks(String(s?.screenwalk ?? "")).page_url,
|
|
1377
|
+
registered: { at: s?.registered?.at ?? null, by: s?.registered?.by?.name ?? null },
|
|
1378
|
+
video: { url: v.url, video_id: v.video_id, duration: v.duration },
|
|
1379
|
+
title: s?.current?.title ?? v.uploaded_title,
|
|
1380
|
+
safe_title: s?.current?.safe_title ?? null,
|
|
1381
|
+
status: s?.status ?? null,
|
|
1382
|
+
approved: s?.approved === true,
|
|
1383
|
+
revision: s?.revision ?? null,
|
|
1384
|
+
coverage: s?.coverage ?? null,
|
|
1385
|
+
transcript: s?.transcript ?? null,
|
|
1386
|
+
counts: s?.counts ?? null,
|
|
1387
|
+
purpose_items: s?.detail?.checked?.purpose_items?.total ?? null,
|
|
1388
|
+
...(s?.test ? { test: true } : {}),
|
|
1389
|
+
};
|
|
1390
|
+
if (!a.with_review)
|
|
1391
|
+
return row;
|
|
1392
|
+
if (!v.video_id)
|
|
1393
|
+
return { ...row, review: { state: "no_video_id", reviews: [] } };
|
|
1394
|
+
const found = await reviewsOfVideo(v.video_id);
|
|
1395
|
+
return { ...row, review: { state: found.state, ...(found.message ? { message: found.message } : {}), reviews: found.reviews.map((x) => ({ review_id: x.review_id, ref: x.ref, url: x.url, title: x.title, latest_version: x.latest_version })) } };
|
|
1396
|
+
}));
|
|
1397
|
+
return {
|
|
1398
|
+
registry: `${config.miadiPublicUrl}/screenwalks`,
|
|
1399
|
+
filters: { ...(a.registered_on ? { registered_on: a.registered_on } : {}), ...(a.registered_from ? { registered_from: a.registered_from } : {}), ...(a.registered_to ? { registered_to: a.registered_to } : {}), ...(a.status ? { status: a.status } : {}), ...(a.coverage ? { coverage: a.coverage } : {}), ...(a.name ? { name: a.name } : {}), ...(video ? { video_id: video } : {}) },
|
|
1400
|
+
total: kept.length,
|
|
1401
|
+
offset,
|
|
1402
|
+
returned: rows.length,
|
|
1403
|
+
next_offset: offset + rows.length < kept.length ? offset + rows.length : null,
|
|
1404
|
+
...(a.with_review && (a.limit ?? 25) > 10 ? { note: "with_review reads at most 10 rows a call; follow next_offset for the rest." } : {}),
|
|
1405
|
+
...(a.with_review ? { review_match: "each video's YouTube id, searched in the Miadi Review Service" } : {}),
|
|
1406
|
+
registrations: rows,
|
|
1407
|
+
source: { door: "GET /api/screenwalks/registrations", read_as: { person_id: person.id, name: person.name }, read_at },
|
|
1408
|
+
};
|
|
1409
|
+
}));
|
|
1082
1410
|
server.registerTool("handoff_status", {
|
|
1083
1411
|
title: "Handoffs between circles",
|
|
1084
1412
|
description: "Handoffs and their state (pending, blocked, ready, in_progress, completed, withdrawn), responsible circle, next action, receipts and human gates. Filter by a reference, a circle or a state.",
|
|
@@ -2534,6 +2862,96 @@ export function registerTools(server, ctx) {
|
|
|
2534
2862
|
});
|
|
2535
2863
|
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) };
|
|
2536
2864
|
}));
|
|
2865
|
+
server.registerTool("request_screenwalk_review", {
|
|
2866
|
+
title: "Relate a registered screenwalk to its review, or ask for one",
|
|
2867
|
+
description: "One step from a registered screenwalk to its Miadi Review, safe to repeat. It reads the registration as you, takes its canonical YouTube video id and looks that video up in the Miadi Review Service. When one review exists it creates nothing: it records the relation between the registration and that review, in the connector's records and on the registration (the second when you may steward registrations), and returns the review. When none exists it prepares one create request for the canonical video, carrying the registry reference and the revision read; it waits for a person's approval like every review operation, and asking again returns the same request. When several reviews exist, or the Review Service cannot be searched, it writes nothing and says so. It never copies the registration's inventory into a review, never treats its answers as a transcript, and starts no Deep Diver and no episode link.",
|
|
2868
|
+
inputSchema: {
|
|
2869
|
+
screenwalk: z.string().min(1).max(500).describe("The registry id, miadi-screenwalk:<id>, or the screenwalk's page URL on this factory's registry."),
|
|
2870
|
+
refs,
|
|
2871
|
+
...base,
|
|
2872
|
+
},
|
|
2873
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
2874
|
+
}, wrap(async (a, extra) => {
|
|
2875
|
+
const { person, auth } = who(extra);
|
|
2876
|
+
requireContribute(auth);
|
|
2877
|
+
const w = await walkRead(person, a.screenwalk);
|
|
2878
|
+
if (w.registration.test === true)
|
|
2879
|
+
throw new ToolRefusal("test_record", "This registration is a test record: no review is related to it or asked for it.");
|
|
2880
|
+
const video = videoOf(w.registration);
|
|
2881
|
+
if (!video.video_id)
|
|
2882
|
+
throw new ToolRefusal("no_video_id", "The registration's video URL names no YouTube video id, so no review can be matched or asked for.", { screenwalk: w.named.reference });
|
|
2883
|
+
const links = walkLinks(w.named.id);
|
|
2884
|
+
const source = {
|
|
2885
|
+
kind: "screenwalk_registration",
|
|
2886
|
+
reference: w.named.reference,
|
|
2887
|
+
revision: w.registration.revision,
|
|
2888
|
+
page_url: links.page_url,
|
|
2889
|
+
video_id: video.video_id,
|
|
2890
|
+
video_url: video.canonical_url,
|
|
2891
|
+
matched_by: "youtube_video_id",
|
|
2892
|
+
read_at: w.read_at,
|
|
2893
|
+
};
|
|
2894
|
+
const found = await reviewsOfVideo(video.video_id);
|
|
2895
|
+
const head = {
|
|
2896
|
+
screenwalk: { id: w.named.id, reference: w.named.reference, page_url: links.page_url, revision: w.registration.revision },
|
|
2897
|
+
video: { video_id: video.video_id, canonical_url: video.canonical_url },
|
|
2898
|
+
lookup: { service: config.reviewUrl, matched_by: "youtube_video_id", state: found.state },
|
|
2899
|
+
review_created: false,
|
|
2900
|
+
};
|
|
2901
|
+
if (found.state === "lookup_unavailable") {
|
|
2902
|
+
return { ...head, state: "lookup_unavailable", message: `${found.message} Nothing was recorded and no request was made: a create request is prepared only after the lookup has answered.` };
|
|
2903
|
+
}
|
|
2904
|
+
if (found.state === "ambiguous") {
|
|
2905
|
+
return { ...head, state: "ambiguous", message: "Several reviews of this video exist in the Miadi Review Service. Nothing was related and no request was made: a person names the review this registration belongs with.", reviews: found.reviews };
|
|
2906
|
+
}
|
|
2907
|
+
if (found.state === "found") {
|
|
2908
|
+
const review = found.reviews[0];
|
|
2909
|
+
const relation = await relateWalkReview(person, auth, w, review, source, a);
|
|
2910
|
+
const both = relation.from_registration.state === "recorded" || relation.from_registration.state === "held";
|
|
2911
|
+
return {
|
|
2912
|
+
...head,
|
|
2913
|
+
state: "review_exists",
|
|
2914
|
+
message: both
|
|
2915
|
+
? "A review of this video exists. No review was created. The registration and the review are related in both directions."
|
|
2916
|
+
: "A review of this video exists. No review was created. The relation is in the connector's records; it is not on the registration yet.",
|
|
2917
|
+
review,
|
|
2918
|
+
relation,
|
|
2919
|
+
};
|
|
2920
|
+
}
|
|
2921
|
+
// No review: one create request for this video stands at a time, whoever asked for it.
|
|
2922
|
+
const standing = all().find((r) => r.kind === "review_operation_request" &&
|
|
2923
|
+
r.body.operation === "create" &&
|
|
2924
|
+
r.body.video_id === video.video_id &&
|
|
2925
|
+
(r.approval_state === "awaiting_approval" || (r.approval_state === "approved" && r.state !== "completed" && r.completion_receipt?.outcome !== "failed")));
|
|
2926
|
+
if (standing) {
|
|
2927
|
+
return {
|
|
2928
|
+
...head,
|
|
2929
|
+
state: standing.approval_state === "approved" ? "create_running" : "create_waiting",
|
|
2930
|
+
message: standing.approval_state === "approved"
|
|
2931
|
+
? "A create request for this video was approved and has not finished. No second request was made."
|
|
2932
|
+
: "A create request for this video already waits for a person's approval. No second request was made.",
|
|
2933
|
+
request: redact(standing),
|
|
2934
|
+
names_this_registration: namesScreenwalk(standing, w.named.id),
|
|
2935
|
+
approval_url: approvalUrl(standing.id),
|
|
2936
|
+
};
|
|
2937
|
+
}
|
|
2938
|
+
const r = append("review_operation_request", person, auth, {
|
|
2939
|
+
circle: "continuity",
|
|
2940
|
+
refs: [...new Set([w.named.reference, ...a.refs, `https://youtu.be/${video.video_id}`])],
|
|
2941
|
+
intention: a.intention,
|
|
2942
|
+
role: a.role,
|
|
2943
|
+
idempotency_key: a.idempotency_key ?? `screenwalk:${w.named.id}:review:create`,
|
|
2944
|
+
approval_state: "awaiting_approval",
|
|
2945
|
+
body: { operation: "create", review_id: null, video_id: video.video_id, source },
|
|
2946
|
+
});
|
|
2947
|
+
return {
|
|
2948
|
+
...head,
|
|
2949
|
+
state: "create_prepared",
|
|
2950
|
+
message: "No review of this video exists. One create request waits for a person's approval; nothing runs until then. Once the review exists, asking again records the relation.",
|
|
2951
|
+
request: r,
|
|
2952
|
+
approval_url: approvalUrl(r.id),
|
|
2953
|
+
};
|
|
2954
|
+
}));
|
|
2537
2955
|
server.registerTool("request_participant_consent", {
|
|
2538
2956
|
title: "Ask a person in a video whether its words may be published",
|
|
2539
2957
|
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.",
|
|
@@ -3063,6 +3481,7 @@ export function registerTools(server, ctx) {
|
|
|
3063
3481
|
return fail({ error: "failed", message: error instanceof Error ? error.message : String(error) });
|
|
3064
3482
|
}
|
|
3065
3483
|
});
|
|
3484
|
+
return { tools: offered };
|
|
3066
3485
|
}
|
|
3067
3486
|
function asState(e) {
|
|
3068
3487
|
if (e instanceof MiadiError)
|
|
@@ -3124,6 +3543,8 @@ export const TOOL_STATUS = {
|
|
|
3124
3543
|
get_narrative_beats: "live (NCP project beats and candidate beats)",
|
|
3125
3544
|
review_lookup: "live (video search needs the review token on the connector host)",
|
|
3126
3545
|
review_versions: "live (carries the transcript's state)",
|
|
3546
|
+
get_screenwalk: "live (the Screenwalk Registry read as you: one registration by registry id, miadi-screenwalk:<id> or its page URL, in the registry's schema, or its brief or its moments; paged when large; says whether a review of its video exists)",
|
|
3547
|
+
list_screenwalks: "live (the registrations you may see, by the day they were registered, status, coverage, a name or a video)",
|
|
3127
3548
|
review_transcript_status: "live (read-only: unknown, absent, acquiring, stored, held or failed, with stages, digest, readback, retry schedule, remedy and plain links)",
|
|
3128
3549
|
ensure_review_transcript: "live, contribute (acquires and stores an existing review's transcript under the authority that covers processing it: write tier or the source's registrant; no decision, no model call, never overwrites)",
|
|
3129
3550
|
handoff_status: "live",
|
|
@@ -3154,6 +3575,7 @@ export const TOOL_STATUS = {
|
|
|
3154
3575
|
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)",
|
|
3155
3576
|
revoke_session_steering: "live, contribute, write tier (stops a run's steering, or one steer not yet consumed)",
|
|
3156
3577
|
request_review_operation: "live, contribute, needs_approval (create also stores the video's YouTube captions as the review's transcript, no model call)",
|
|
3578
|
+
request_screenwalk_review: "live, contribute, needs_approval for a create (relates a registered screenwalk to the existing review of its video, or prepares one create request a person approves; never a second review of one video)",
|
|
3157
3579
|
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)",
|
|
3158
3580
|
request_screenwalk_reading: "live, contribute, needs_approval (host provider adapter required; stops at editorial decision)",
|
|
3159
3581
|
request_reading_import: "live, contribute, needs_approval (exact public import; atomic service contract required)",
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.45";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.1.
|
|
1
|
+
export const VERSION = "0.1.45";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miadi/connector",
|
|
3
|
-
"version": "0.1.
|
|
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.",
|
|
3
|
+
"version": "0.1.45",
|
|
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, registered screenwalks, episodes and circles and records observations, inquiries, handoffs and proposals with their name on each record.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Miadi",
|
|
7
7
|
"type": "module",
|