@miadi/connector 0.1.30 → 0.1.32
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 +2 -2
- package/dist/approve.js +15 -3
- package/dist/tools.js +8 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Requests made before this, one new request per revision, are joined with `supers
|
|
|
56
56
|
|
|
57
57
|
A mission is found by the issue it implements (jgwill/Miadi#913). `request_authorized_run` and `propose_work` take `primary_issue`; older requests are read by their first issue ref, as an inference. An issue held as primary by several requests answers `ambiguous_mission` with the candidates, an issue only cited answers `related_only`, and only a record id or a declared primary that no older request holds by inference (`contested`) authorizes a steer, release or closure (`identity.authorizes_actions`). A release receipt names artifact, target, production check and check time; record it as `completion_receipt.release` on a handoff that cites the mission. `released` is `verified` only when the connector confirms it itself (the target is `miadi-connector` and the running version is the one released); any other complete receipt within seven days is `receipt_recorded`, with who recorded it and whether that was the approver. Old checks are `stale`; a version string, a future date or an incomplete receipt is `claimed_unverified`. `closed` needs an approved `propose_session_completion` ending (`exit` or `complete_then_exit`) that names the mission in its `mission` field and ends one of the mission's sessions; a completed request is `request_completed`. A GitHub reference the connector cannot read is `unverified`, with the reason (`no_github_token`, `not_visible_to_token`…), never `not_found`.
|
|
58
58
|
|
|
59
|
-
**The factory binding (jgwill/Miadi#909).** The factory runner records every brief it hands to a seat in `delivered.jsonl`: the record, the tmux session, the pane id and the Claude Code session id that took the line. `mission_status` reads that receipt (write tier) and checks it against Miadi's session registry: `binding` is `verified` when both agree on session, tmux session and pane, `receipt_only` when the registry cannot confirm it, `unverified_association` when the registry places the session elsewhere or the pane is gone. Busy or idle comes from the registry when the binding is verified, else from a read-only peek of the bound pane, and is never read as completion. `mission_status` with `session:<uuid>` finds the one mission the factory delivered to that session (`factory_bound`); two are `ambiguous_mission`. `provider` names the provider requested, resolved and actually run, and `match: false` when they differ; nothing is re-run because of it. `get_session` lists the missions the factory delivered to the session.
|
|
59
|
+
**The factory binding (jgwill/Miadi#909).** The factory runner records every brief it hands to a seat in `delivered.jsonl`: the record, the tmux session, the pane id and the Claude Code session id that took the line. `mission_status` reads that receipt (write tier) and checks it against Miadi's session registry: `binding` is `verified` when both agree on session, tmux session and pane, `receipt_only` when the registry cannot confirm it, `unverified_association` when the registry places the session elsewhere or the pane is gone. Busy or idle comes from the registry when the binding is verified, else from a read-only peek of the bound pane, and is never read as completion. `mission_status` with `session:<uuid>` finds the one mission the factory delivered to that session (`factory_bound`); two are `ambiguous_mission`. `provider` names the provider requested, resolved and actually run, and `match: false` when they differ; nothing is re-run because of it. `get_session` lists the missions the factory delivered to the session (`binding: "factory_receipt"`), then the miadi-run missions Miadi links to it from their records and its inventory record (`binding: "miadi_run"`, jgwill/Miadi#993).
|
|
60
60
|
|
|
61
61
|
**The agent's result (jgwill/Miadi#921).** An agent returns its work with `propose_session_completion` naming the mission in `mission`, from its bound session, with its evidence refs and, optionally, a structured `result`: `summary`, `outputs` (`ref`, `label`, `git_sha`), `tests` (`command`, `passed`, `failed`, `skipped`) and `blockers`. `mission_status` and `get_run_result` read it back by the mission id as `result`: the standing submission (the newest `verified` one: it names the mission, ends a bound session and was submitted with Miadi's write tier or the factory's writer token, which the connector records on the ending as `submitted_with_tier`; anything else naming the mission is `unverified_association` with an `association_code`, a mere citation `cited_only` and never a result), its summary, tests and blockers as the agent's claim, and each output typed and checked when read. A commit or file on GitHub is read through GitHub (`GITHUB_TOKEN` when the host has one): `verified` with its sha, `changed_since_submission` when its declared `git_sha` no longer matches or the file changed on its branch after the submission, `unverified` with the reason when GitHub cannot be read, never `not_found`. A connector record id the ledger does not hold is `not_found`. Bound sessions are taken from the factory's receipts for every reader, so the verdict is the same at every tier; below the write tier the session ids are left out. The completion decision stays the person's, and only a verified submission sets it: `stage_truth.completion` is `pending_approval`, `accepted`, `declined` or `revision_requested` (`none` for an unverified one, whose stage is `result_submitted_unverified`; an approved exit submitted below the write tier closes nothing), `pending_human_gates` lists what waits on a person with its approval page, and `mission_stage` names the furthest stage with evidence (`result_submitted_awaiting_completion_approval`, `completion_accepted`, `merged`, `released`, `closed`…). A duplicate submission (same session, ending and mission, still pending) is handed back with `replayed: true`, and `not_recorded` names what the second call carried that was not kept.
|
|
62
62
|
|
|
@@ -147,7 +147,7 @@ A decision is recorded once. An approved run that calls another service (a revie
|
|
|
147
147
|
|
|
148
148
|
**A person mentioned and a person on the record (jgwill/Miadi#962).** A person mentioned, by name or as a kind of user, holds nothing back: a spoken name is never a reason to withhold a source or to ask anyone. A person on the record, meaning filmed or with their own voice, words or screens shown, has a release agreed at the start of the production. Nothing but the owner's `withheld` registration holds a source back, and no code counts names. `request_participant_consent` is the door for a person on the record who has no release yet.
|
|
149
149
|
|
|
150
|
-
**An approved create sends the person's words (jgwill/Miadi#963).** `POST /api/reviews`
|
|
150
|
+
**An approved create or new version sends the person's words (jgwill/Miadi#963).** `POST /api/reviews` and `POST /api/reviews/:id/versions` carry `source: { title, description, boundaries }` from the `source_intent`: its own fields, or the `TITLE:`, `DESCRIPTION` and `Review boundaries:` lines of its intention. The service keeps none of it, so each generation sends it again, and a new version finds its source through the review's video. The receipt's `source_words.title_taken` reads from the answer whether the service used them. A video already reviewed answers with the existing review, so a `create` on it uses nothing.
|
|
151
151
|
|
|
152
152
|
**A created review gets its transcript (jgwill/Miadi#925).** An approved `create` calls the review service, then reads the video's original-language YouTube captions with a local `uvx yt-dlp` and stores them on the review as `[mm:ss] text`, so an agent reads them through `fetch` and the factory's kind briefs find them with `miadi_review.py transcript`. No model is called for the transcript. The service answers an empty `POST /api/reviews/:id/transcript` by asking Gemini, so an empty one is never sent. `completion_receipt.transcript` says where it stands, and the card and the approval page say the same:
|
|
153
153
|
|
package/dist/approve.js
CHANGED
|
@@ -234,6 +234,16 @@ async function reviewLeftBy(deps, response, videoId) {
|
|
|
234
234
|
return null;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
+
/** The video of a review a request names only by its id. Unknown when the service cannot say: the request then runs without the source's words. */
|
|
238
|
+
async function videoOfReview(deps, reviewId) {
|
|
239
|
+
try {
|
|
240
|
+
const review = await new ReviewClient(deps.config.reviewUrl, deps.config.reviewToken, deps.fetchImpl ?? fetch).get(reviewId);
|
|
241
|
+
return typeof review?.video_id === "string" ? review.video_id : null;
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
237
247
|
export async function executeApproved(record, approver, deps, instructions) {
|
|
238
248
|
const f = deps.fetchImpl ?? fetch;
|
|
239
249
|
const b = record.body;
|
|
@@ -286,14 +296,16 @@ export async function executeApproved(record, approver, deps, instructions) {
|
|
|
286
296
|
return queueBrief();
|
|
287
297
|
case "review_operation_request": {
|
|
288
298
|
const url = b.video_id ? `https://youtu.be/${b.video_id}` : undefined;
|
|
289
|
-
// The person's title, description and boundaries go with
|
|
290
|
-
|
|
299
|
+
// The person's title, description and boundaries go with every generation, so it does not read the video alone. The
|
|
300
|
+
// service keeps none of them, so a new version sends them again (jgwill/Miadi#963).
|
|
301
|
+
const video = b.operation === "create" ? b.video_id : b.operation === "new_version" ? (b.video_id ?? (await videoOfReview(deps, b.review_id))) : null;
|
|
302
|
+
const words = video ? sourceWordsOf(current(deps.ledger.all()).find((x) => x.kind === "source_intent" && x.body.video_id === video)) : null;
|
|
291
303
|
const r = b.operation === "create"
|
|
292
304
|
? await reviewCall("POST", "/api/reviews", { url, ...(words ? { source: words } : {}) })
|
|
293
305
|
: b.operation === "import_markdown"
|
|
294
306
|
? await reviewCall("POST", "/api/reviews/import", { url, markdown: b.markdown })
|
|
295
307
|
: b.operation === "new_version"
|
|
296
|
-
? await reviewCall("POST", `/api/reviews/${b.review_id}/versions`, b.transcript ? { transcript: b.transcript } : {})
|
|
308
|
+
? await reviewCall("POST", `/api/reviews/${b.review_id}/versions`, { ...(b.transcript ? { transcript: b.transcript } : {}), ...(words ? { source: words } : {}) })
|
|
297
309
|
: await reviewCall("POST", `/api/reviews/${b.review_id}/transcript`, { transcript: b.transcript });
|
|
298
310
|
const answeredTitle = r.response?.title;
|
|
299
311
|
const result = {
|
package/dist/tools.js
CHANGED
|
@@ -561,7 +561,7 @@ export function registerTools(server, ctx) {
|
|
|
561
561
|
}));
|
|
562
562
|
server.registerTool("get_session", {
|
|
563
563
|
title: "One agent session",
|
|
564
|
-
description: "One session by id: what it was asked to do, what its record says it completed, what it holds, its ending (proposed or decided), the live pane state, and the connector records that cite it (handoffs, completion proposals).",
|
|
564
|
+
description: "One session by id: what it was asked to do, what its record says it completed, what it holds, its ending (proposed or decided), the live pane state, its commits and related episodes, its missions (each labelled by binding: factory_receipt for a brief the factory runner delivered, miadi_run for a miadi-run mission given to it or signed by it), and the connector records that cite it (handoffs, completion proposals).",
|
|
565
565
|
inputSchema: { session_id: z.string().min(8) },
|
|
566
566
|
annotations: READ,
|
|
567
567
|
}, wrap(async ({ session_id }, extra) => {
|
|
@@ -571,11 +571,16 @@ export function registerTools(server, ctx) {
|
|
|
571
571
|
const session = await miadi.get(person.token, `/api/session/${encodeURIComponent(id)}`);
|
|
572
572
|
// The missions the factory delivered to this session, by the runner's receipt (jgwill/Miadi#909).
|
|
573
573
|
const all = receipts();
|
|
574
|
-
const
|
|
574
|
+
const delivered = recordsForSession(all, id).map((record) => {
|
|
575
575
|
const rc = all.filter((x) => x.record === record && x.session_id === id).sort((a, b) => b.at.localeCompare(a.at))[0];
|
|
576
576
|
return { record, binding: "factory_receipt", delivered_at: rc?.at, tmux_session: rc?.tmux_session, pane_id: rc?.pane_id, read: `mission_status with ${record}` };
|
|
577
577
|
});
|
|
578
|
-
|
|
578
|
+
// Beside them, the miadi-run missions Miadi links to the session from their records and its inventory record (jgwill/Miadi#993).
|
|
579
|
+
const view = session?.session;
|
|
580
|
+
const runs = (Array.isArray(view?.missions) ? view.missions : [])
|
|
581
|
+
.filter((m) => typeof m?.id === "string")
|
|
582
|
+
.map((m) => ({ ...m, binding: "miadi_run" }));
|
|
583
|
+
return { ...session, missions: [...delivered, ...runs], connector_records: touching(`session:${id}`) };
|
|
579
584
|
}));
|
|
580
585
|
server.registerTool("get_evidence", {
|
|
581
586
|
title: "What an episode holds as evidence",
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.32";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.1.
|
|
1
|
+
export const VERSION = "0.1.32";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miadi/connector",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"description": "The Miadi connector: one remote MCP service through which a person signed in with their Miadi person token, from ChatGPT or any MCP client, reads sessions, reviews, episodes and circles and records observations, inquiries, handoffs and proposals with their name on each record.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Miadi",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"STEERING.md"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@miadi/inquiry-weave": "0.18.
|
|
46
|
+
"@miadi/inquiry-weave": "0.18.13",
|
|
47
47
|
"@miadi/node-service-kit": "0.1.2",
|
|
48
48
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
49
49
|
"express": "^5.2.1",
|