@miadi/connector 0.1.30 → 0.1.31

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 CHANGED
@@ -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` carries `source: { title, description, boundaries }` from the `source_intent`: its own fields, or the `TITLE:`, `DESCRIPTION` and `Review boundaries:` lines of its intention. The review service uses them once `packages/review-service/prompts/261107-review-source-words.md` is applied in v0. Until then it ignores them, writes from the video alone, and the receipt says so (`source_words.title_taken: false`).
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 the URL, so generation does not read the video alone (jgwill/Miadi#963).
290
- const words = b.operation === "create" ? sourceWordsOf(current(deps.ledger.all()).find((x) => x.kind === "source_intent" && x.body.video_id === b.video_id)) : null;
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/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.1.30";
1
+ export declare const VERSION = "0.1.31";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.1.30";
1
+ export const VERSION = "0.1.31";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miadi/connector",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
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",