@miadi/connector 0.1.31 → 0.1.33
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/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/tools.js +46 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Call `get_capabilities` first. It names the signed-in person, their Miadi API ti
|
|
|
20
20
|
|
|
21
21
|
| kind | tools |
|
|
22
22
|
|---|---|
|
|
23
|
-
| reads | `get_capabilities` `get_context` `list_circles` `get_circle` `list_sessions` `get_session` `get_evidence` `read_episode_file` `get_evaluations` `get_narrative_beats` `review_lookup` `review_versions` `handoff_status` `list_records` `get_run_result` `mission_status` `provider_capabilities` `mission_model_preflight` `search` `fetch` `list_research_artifacts` `read_research_artifact` |
|
|
23
|
+
| reads | `get_capabilities` `get_context` `list_circles` `get_circle` `list_sessions` `search_sessions` `get_session` `get_evidence` `read_episode_file` `get_evaluations` `get_narrative_beats` `review_lookup` `review_versions` `handoff_status` `list_records` `get_run_result` `mission_status` `provider_capabilities` `mission_model_preflight` `search` `fetch` `list_research_artifacts` `read_research_artifact` |
|
|
24
24
|
| contributions | `append_observation` `open_inquiry` `link_records` `propose_narrative_beat` `record_evaluation` `register_source_intent` `record_handoff` `update_handoff` `prepare_calendar_event` `save_research` |
|
|
25
25
|
| requests (approved by a person) | `propose_work` `propose_session_completion` `request_authorized_run` `request_session_steer` `revoke_session_steering` `request_review_operation` `request_deep_diver` `link_review_to_episode` `request_inquiry_episode` |
|
|
26
26
|
| decisions in the conversation | `show_decisions` (cards), `decide_request` (called by the card only) |
|
|
@@ -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
|
|
package/dist/server.d.ts
CHANGED
|
@@ -55,4 +55,4 @@ export declare function createConnectorApp(config: ConnectorConfig, deps: Connec
|
|
|
55
55
|
provider: MiadiOAuthProvider;
|
|
56
56
|
ledger: Ledger<ConnectorRecord>;
|
|
57
57
|
};
|
|
58
|
-
export declare const INSTRUCTIONS = "Miadi is a relational software factory: agent sessions, Miadi reviews of screenwalks, Chronicle episodes, talking circles and the five accountable circles (Story, Stewardship, Engineering, Evaluation, Continuity) across three domains (Creative, Ceremonial, Engineering).\n\nStart with get_capabilities: it says who you are signed in as, which tools are live, and which return not_implemented.\n\nEvery tool is offered on every connection. A client that loads tools on demand shows only those its last tool search matched: a tool you do not see is not missing. Search for it by its exact name, get_capabilities first, before telling the person a tool is absent. The main reads are get_capabilities, get_context, search, fetch, list_records, list_sessions, get_session, review_lookup, read_episode_file and show_decisions.\n\nRules every tool keeps:\n- Every record names the person who made it, with a claim category: observed, hypothesis, desired_future, fiction or verified_implementation. Keep fiction and desired futures apart from what was observed.\n- Requests (runs, work proposals, review operations, Deep Diver, review-to-episode links, inquiry-to-episode weaves, session completion) are recorded as awaiting_approval. Nothing runs, publishes or closes until a person decides. After making a request, call show_decisions: it shows the request as a card in the conversation, where the person decides with their own click (or follows its approval page). Never claim a decision the card has not reported. The person may approve, approve with changes (their instructions are carried into what runs), send it back for revision with instructions (approval_state revision_requested; read the instructions with get_run_result and revise it in place with revise_pending_request), or decline.\n- A new or revised run or work proposal answers with draft_review: the aspects of the mission standard to revise, each with why, the question to settle and who can settle it. Read it before show_decisions. It carries no verdict, it advises and blocks nothing, and next_action says what to do. Answer what your conversation holds, ask the person the rest, then revise. preferences lists the person's standing preferences for you to apply. Fill delivery with the one exact place the result lands, and person_words with the person's own words, verbatim, for anything credited to them.\n- A mission is revised, never re-requested: to change a run or work proposal that still awaits a decision, call revise_pending_request with its id and the version you read (expected_version). It keeps one id, one approval page and one card; get_request_history shows every version. A new request_authorized_run or propose_work is for a new mission only. Requests made earlier as separate versions are joined with supersede_pending_requests, naming their exact ids, only when the person names or confirms them.\n- A research report (a Deep Research report) is delivered with save_research exactly as written, never summarised or shortened, with its sources; a long report goes in parts. Check the bytes and first and last lines the answer returns against what you sent.\n- An unknown id is answered as not found, never invented. A missing backing service is answered as unavailable.\n- Use the miadi-review:<uuid>, miadi-chronicle://<n>, owner/repo#n and session:<uuid> reference forms.";
|
|
58
|
+
export declare const INSTRUCTIONS = "Miadi is a relational software factory: agent sessions, Miadi reviews of screenwalks, Chronicle episodes, talking circles and the five accountable circles (Story, Stewardship, Engineering, Evaluation, Continuity) across three domains (Creative, Ceremonial, Engineering).\n\nStart with get_capabilities: it says who you are signed in as, which tools are live, and which return not_implemented.\n\nEvery tool is offered on every connection. A client that loads tools on demand shows only those its last tool search matched: a tool you do not see is not missing. Search for it by its exact name, get_capabilities first, before telling the person a tool is absent. The main reads are get_capabilities, get_context, search, fetch, list_records, list_sessions, search_sessions, get_session, review_lookup, read_episode_file and show_decisions.\n\nRules every tool keeps:\n- Every record names the person who made it, with a claim category: observed, hypothesis, desired_future, fiction or verified_implementation. Keep fiction and desired futures apart from what was observed.\n- Requests (runs, work proposals, review operations, Deep Diver, review-to-episode links, inquiry-to-episode weaves, session completion) are recorded as awaiting_approval. Nothing runs, publishes or closes until a person decides. After making a request, call show_decisions: it shows the request as a card in the conversation, where the person decides with their own click (or follows its approval page). Never claim a decision the card has not reported. The person may approve, approve with changes (their instructions are carried into what runs), send it back for revision with instructions (approval_state revision_requested; read the instructions with get_run_result and revise it in place with revise_pending_request), or decline.\n- A new or revised run or work proposal answers with draft_review: the aspects of the mission standard to revise, each with why, the question to settle and who can settle it. Read it before show_decisions. It carries no verdict, it advises and blocks nothing, and next_action says what to do. Answer what your conversation holds, ask the person the rest, then revise. preferences lists the person's standing preferences for you to apply. Fill delivery with the one exact place the result lands, and person_words with the person's own words, verbatim, for anything credited to them.\n- A mission is revised, never re-requested: to change a run or work proposal that still awaits a decision, call revise_pending_request with its id and the version you read (expected_version). It keeps one id, one approval page and one card; get_request_history shows every version. A new request_authorized_run or propose_work is for a new mission only. Requests made earlier as separate versions are joined with supersede_pending_requests, naming their exact ids, only when the person names or confirms them.\n- A research report (a Deep Research report) is delivered with save_research exactly as written, never summarised or shortened, with its sources; a long report goes in parts. Check the bytes and first and last lines the answer returns against what you sent.\n- An unknown id is answered as not found, never invented. A missing backing service is answered as unavailable.\n- Use the miadi-review:<uuid>, miadi-chronicle://<n>, owner/repo#n and session:<uuid> reference forms.";
|
package/dist/server.js
CHANGED
|
@@ -179,7 +179,7 @@ export const INSTRUCTIONS = `Miadi is a relational software factory: agent sessi
|
|
|
179
179
|
|
|
180
180
|
Start with get_capabilities: it says who you are signed in as, which tools are live, and which return not_implemented.
|
|
181
181
|
|
|
182
|
-
Every tool is offered on every connection. A client that loads tools on demand shows only those its last tool search matched: a tool you do not see is not missing. Search for it by its exact name, get_capabilities first, before telling the person a tool is absent. The main reads are get_capabilities, get_context, search, fetch, list_records, list_sessions, get_session, review_lookup, read_episode_file and show_decisions.
|
|
182
|
+
Every tool is offered on every connection. A client that loads tools on demand shows only those its last tool search matched: a tool you do not see is not missing. Search for it by its exact name, get_capabilities first, before telling the person a tool is absent. The main reads are get_capabilities, get_context, search, fetch, list_records, list_sessions, search_sessions, get_session, review_lookup, read_episode_file and show_decisions.
|
|
183
183
|
|
|
184
184
|
Rules every tool keeps:
|
|
185
185
|
- Every record names the person who made it, with a claim category: observed, hypothesis, desired_future, fiction or verified_implementation. Keep fiction and desired futures apart from what was observed.
|
package/dist/tools.js
CHANGED
|
@@ -559,9 +559,46 @@ export function registerTools(server, ctx) {
|
|
|
559
559
|
qs.set("limit", String(args.limit ?? 30));
|
|
560
560
|
return miadi.get(person.token, `/api/session?${qs}`);
|
|
561
561
|
}));
|
|
562
|
+
server.registerTool("search_sessions", {
|
|
563
|
+
title: "Search inside agent sessions",
|
|
564
|
+
description: "Which agent sessions said, wrote, ran or committed something: words in a person's prompts and the agent's replies, a command, a file written, a commit, a push, an issue (owner/repo#n) or a repository. Each session comes with its matching moments (kind, time, an excerpt), newest first, and bounds that name how many sessions the read left. Miadi searches the capture on its host (miadi-hooks-interpret search), so a seat with no file access gets the same answer. Needs Miadi's write tier: sessions are operator data.",
|
|
565
|
+
inputSchema: {
|
|
566
|
+
q: z.string().min(1).describe('Words a moment holds, all of them, any case. "a phrase" is one word; owner/repo#n also matches the issue\'s URL and #n in a commit of that repository.'),
|
|
567
|
+
since: z.string().optional().describe("A duration back from now (45m, 2h, 3d), a date or an ISO time."),
|
|
568
|
+
until: z.string().optional().describe("A duration back from now, a date or an ISO time."),
|
|
569
|
+
team: z.string().optional().describe("The binding line's team id, e.g. T8."),
|
|
570
|
+
session_ids: z.array(z.string()).max(50).optional().describe("Only these sessions: ids, session:<id>, or id prefixes of 8 characters or more."),
|
|
571
|
+
kinds: z
|
|
572
|
+
.array(z.enum(["prompt", "message", "reply", "command", "file", "commit", "push", "publication"]))
|
|
573
|
+
.optional()
|
|
574
|
+
.describe("Only these kinds of moment."),
|
|
575
|
+
limit: z.number().int().min(1).max(100).optional().describe("Sessions to return (default 10)."),
|
|
576
|
+
moments: z.number().int().min(1).max(50).optional().describe("Moments per session (default 5)."),
|
|
577
|
+
},
|
|
578
|
+
annotations: READ,
|
|
579
|
+
}, wrap(async (args, extra) => {
|
|
580
|
+
const { person } = who(extra);
|
|
581
|
+
requireTier(person, "write");
|
|
582
|
+
const qs = new URLSearchParams({ q: args.q });
|
|
583
|
+
if (args.since)
|
|
584
|
+
qs.set("since", args.since);
|
|
585
|
+
if (args.until)
|
|
586
|
+
qs.set("until", args.until);
|
|
587
|
+
if (args.team)
|
|
588
|
+
qs.set("team", args.team);
|
|
589
|
+
if (args.session_ids?.length)
|
|
590
|
+
qs.set("session", args.session_ids.map((s) => s.replace(/^session:/, "")).join(","));
|
|
591
|
+
if (args.kinds?.length)
|
|
592
|
+
qs.set("kind", args.kinds.join(","));
|
|
593
|
+
if (args.limit)
|
|
594
|
+
qs.set("limit", String(args.limit));
|
|
595
|
+
if (args.moments)
|
|
596
|
+
qs.set("moments", String(args.moments));
|
|
597
|
+
return miadi.get(person.token, `/api/session/search?${qs}`);
|
|
598
|
+
}));
|
|
562
599
|
server.registerTool("get_session", {
|
|
563
600
|
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).",
|
|
601
|
+
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
602
|
inputSchema: { session_id: z.string().min(8) },
|
|
566
603
|
annotations: READ,
|
|
567
604
|
}, wrap(async ({ session_id }, extra) => {
|
|
@@ -571,11 +608,16 @@ export function registerTools(server, ctx) {
|
|
|
571
608
|
const session = await miadi.get(person.token, `/api/session/${encodeURIComponent(id)}`);
|
|
572
609
|
// The missions the factory delivered to this session, by the runner's receipt (jgwill/Miadi#909).
|
|
573
610
|
const all = receipts();
|
|
574
|
-
const
|
|
611
|
+
const delivered = recordsForSession(all, id).map((record) => {
|
|
575
612
|
const rc = all.filter((x) => x.record === record && x.session_id === id).sort((a, b) => b.at.localeCompare(a.at))[0];
|
|
576
613
|
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
614
|
});
|
|
578
|
-
|
|
615
|
+
// Beside them, the miadi-run missions Miadi links to the session from their records and its inventory record (jgwill/Miadi#993).
|
|
616
|
+
const view = session?.session;
|
|
617
|
+
const runs = (Array.isArray(view?.missions) ? view.missions : [])
|
|
618
|
+
.filter((m) => typeof m?.id === "string")
|
|
619
|
+
.map((m) => ({ ...m, binding: "miadi_run" }));
|
|
620
|
+
return { ...session, missions: [...delivered, ...runs], connector_records: touching(`session:${id}`) };
|
|
579
621
|
}));
|
|
580
622
|
server.registerTool("get_evidence", {
|
|
581
623
|
title: "What an episode holds as evidence",
|
|
@@ -2664,6 +2706,7 @@ export const TOOL_STATUS = {
|
|
|
2664
2706
|
get_circle: "live",
|
|
2665
2707
|
list_sessions: "live, Miadi write tier",
|
|
2666
2708
|
get_session: "live, Miadi write tier",
|
|
2709
|
+
search_sessions: "live, Miadi write tier (searched on Miadi's host; the read stops at 20 s and names what it left)",
|
|
2667
2710
|
get_evidence: "live",
|
|
2668
2711
|
read_episode_file: "live (Miadi read tier: an episode's text files; chronicle_foundations_read alone: foundations/<topic>/*.md; up to 512 KiB, paged; read as you, nothing changed)",
|
|
2669
2712
|
get_evaluations: "live (tracing records and recorded assessments; no provider scores)",
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.33";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.1.
|
|
1
|
+
export const VERSION = "0.1.33";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miadi/connector",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
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",
|