@miadi/connector 0.1.36 → 0.1.38
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 -1
- package/dist/approve.d.ts +1 -1
- package/dist/approve.js +58 -12
- package/dist/capabilities-html.d.ts +12 -0
- package/dist/capabilities-html.js +109 -0
- package/dist/capabilities.d.ts +262 -0
- package/dist/capabilities.js +429 -0
- package/dist/local-transcription.js +3 -3
- package/dist/mission-result.d.ts +15 -0
- package/dist/mission-result.js +18 -21
- package/dist/record-shares.d.ts +48 -0
- package/dist/record-shares.js +60 -0
- package/dist/research-shelf.d.ts +53 -14
- package/dist/research-shelf.js +83 -16
- package/dist/server.d.ts +4 -2
- package/dist/server.js +2 -1
- package/dist/tools.d.ts +2 -0
- package/dist/tools.js +101 -13
- package/dist/transcript-job.d.ts +7 -1
- package/dist/transcript-job.js +44 -9
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +12 -3
package/dist/research-shelf.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ArtefactWeave } from "@miadi/inquiry-weave";
|
|
1
|
+
import { type ArtefactShare, type ArtefactWeave } from "@miadi/inquiry-weave";
|
|
2
2
|
import { type ReportDigest } from "./research-digest.js";
|
|
3
3
|
/** A saved report may be 1 MB of characters; several times that is not a document anyone reads through a tool. */
|
|
4
4
|
export declare const MAX_SHELF_FILE_BYTES: number;
|
|
@@ -6,11 +6,38 @@ export declare class ShelfRefusal extends Error {
|
|
|
6
6
|
readonly code: "invalid_ref" | "not_found" | "forbidden";
|
|
7
7
|
constructor(code: "invalid_ref" | "not_found" | "forbidden", message: string);
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
export
|
|
9
|
+
/** A reader: their id, their API tier, and the talking circles they sit in now, when known. */
|
|
10
|
+
export interface ShelfReader {
|
|
11
11
|
id: string;
|
|
12
12
|
api_tier: string | null;
|
|
13
|
-
|
|
13
|
+
circles?: Iterable<string>;
|
|
14
|
+
}
|
|
15
|
+
/** The circles a reader sits in, read only when a folder is shared with a circle. Each door reads them its own way. */
|
|
16
|
+
export type CircleLoader = () => Promise<Iterable<string>>;
|
|
17
|
+
/** One way a share reaches the reader: through a circle they sit in, or to them directly. */
|
|
18
|
+
export interface ShareRoute {
|
|
19
|
+
via: "circle" | "person";
|
|
20
|
+
/** The circle's node id, for a circle route. */
|
|
21
|
+
circle?: string;
|
|
22
|
+
/** The circle's name as it was shared, for a circle route. */
|
|
23
|
+
circle_name?: string;
|
|
24
|
+
by: {
|
|
25
|
+
person_id: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
};
|
|
28
|
+
at: string;
|
|
29
|
+
}
|
|
30
|
+
/** How a reader is admitted: as the owner, through shares (`routes`), or as Miadi's write tier. */
|
|
31
|
+
export interface ShelfAccess {
|
|
32
|
+
as: "owner" | "shared" | "write_tier";
|
|
33
|
+
routes: ShareRoute[];
|
|
34
|
+
}
|
|
35
|
+
/** Whether a folder is shared with a circle, so its reader's circles are worth reading. */
|
|
36
|
+
export declare function sharedWithACircle(weave: ArtefactWeave | undefined): boolean;
|
|
37
|
+
/** How a reader is admitted to a folder, or null. Direct shares come before circle shares. `weave` is undefined for a folder no one saved through a door. */
|
|
38
|
+
export declare function shelfAccess(weave: ArtefactWeave | undefined, reader: ShelfReader): ShelfAccess | null;
|
|
39
|
+
/** Who may read a folder. */
|
|
40
|
+
export declare function canReadShelf(weave: ArtefactWeave | undefined, person: ShelfReader): boolean;
|
|
14
41
|
export interface ShelfReadOptions {
|
|
15
42
|
file?: string;
|
|
16
43
|
offset?: number;
|
|
@@ -18,10 +45,9 @@ export interface ShelfReadOptions {
|
|
|
18
45
|
maxBytes?: number;
|
|
19
46
|
}
|
|
20
47
|
/** The folder's manifest, and one file's page when a file is named or the folder holds its report. */
|
|
21
|
-
export declare function readShelfArtefact(root: string, name: string, person: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, opts?: ShelfReadOptions): Promise<{
|
|
48
|
+
export declare function readShelfArtefact(root: string, name: string, person: ShelfReader, opts?: ShelfReadOptions & {
|
|
49
|
+
circles?: CircleLoader;
|
|
50
|
+
}): Promise<{
|
|
25
51
|
note: string;
|
|
26
52
|
files_truncated?: string | undefined;
|
|
27
53
|
episodes: string[];
|
|
@@ -49,6 +75,8 @@ export declare function readShelfArtefact(root: string, name: string, person: {
|
|
|
49
75
|
issue_url?: string | undefined;
|
|
50
76
|
circle?: string | undefined;
|
|
51
77
|
visibility: "circle" | "published" | "private" | "proposed";
|
|
78
|
+
shares?: ArtefactShare[] | undefined;
|
|
79
|
+
access: ShelfAccess;
|
|
52
80
|
owner?: {
|
|
53
81
|
person_id: string;
|
|
54
82
|
name: string | undefined;
|
|
@@ -107,6 +135,8 @@ export declare function readShelfArtefact(root: string, name: string, person: {
|
|
|
107
135
|
issue_url?: string | undefined;
|
|
108
136
|
circle?: string | undefined;
|
|
109
137
|
visibility: "circle" | "published" | "private" | "proposed";
|
|
138
|
+
shares?: ArtefactShare[] | undefined;
|
|
139
|
+
access: ShelfAccess;
|
|
110
140
|
owner?: {
|
|
111
141
|
person_id: string;
|
|
112
142
|
name: string | undefined;
|
|
@@ -143,7 +173,13 @@ export interface ShelfListing extends ReportDigest {
|
|
|
143
173
|
via?: string;
|
|
144
174
|
refs: string[];
|
|
145
175
|
};
|
|
176
|
+
/** How the reader it was listed for is admitted, when listed for a reader. */
|
|
177
|
+
access?: ShelfAccess;
|
|
178
|
+
/** The shares that admit someone now, for its owner and the write tier. */
|
|
179
|
+
shares?: ArtefactShare[];
|
|
146
180
|
}
|
|
181
|
+
/** A listing as one reader may see it: how they are admitted and, for the owner or the write tier, whom it is shared with. */
|
|
182
|
+
export declare function listingFor(listing: ShelfListing, weave: ArtefactWeave | undefined, access: ShelfAccess): ShelfListing;
|
|
147
183
|
/** One folder's listing. A folder that cannot be read is listed by its name. */
|
|
148
184
|
export declare function shelfListing(root: string, name: string, weave: ArtefactWeave | undefined): ShelfListing;
|
|
149
185
|
export type ShelfSort = "newest" | "oldest" | "longest" | "title";
|
|
@@ -152,18 +188,16 @@ export declare function sortListings(items: ShelfListing[], sort?: ShelfSort): S
|
|
|
152
188
|
* The shelf as this person may read it. `mine` is what they own. `all` is every folder, the write
|
|
153
189
|
* tier's alone, because a folder another person owns or no one owns is theirs to read and no one else's.
|
|
154
190
|
*/
|
|
155
|
-
export declare function listShelfArtefacts(root: string, person: {
|
|
156
|
-
|
|
157
|
-
api_tier: string | null;
|
|
158
|
-
}, opts?: {
|
|
159
|
-
scope?: "mine" | "all";
|
|
191
|
+
export declare function listShelfArtefacts(root: string, person: ShelfReader, opts?: {
|
|
192
|
+
scope?: "mine" | "shared" | "all";
|
|
160
193
|
query?: string;
|
|
161
194
|
kind?: ShelfListing["kind"];
|
|
162
195
|
sort?: ShelfSort;
|
|
163
196
|
limit?: number;
|
|
164
197
|
offset?: number;
|
|
198
|
+
circles?: CircleLoader;
|
|
165
199
|
}): Promise<{
|
|
166
|
-
scope: "mine" | "all";
|
|
200
|
+
scope: "shared" | "mine" | "all";
|
|
167
201
|
total: number;
|
|
168
202
|
offset: number;
|
|
169
203
|
limit: number;
|
|
@@ -171,3 +205,8 @@ export declare function listShelfArtefacts(root: string, person: {
|
|
|
171
205
|
next_offset: number | null;
|
|
172
206
|
read_with: string;
|
|
173
207
|
}>;
|
|
208
|
+
/**
|
|
209
|
+
* What is shared with this reader: every folder another person shared with them or with a circle
|
|
210
|
+
* they sit in, each with the routes it reaches them by. Their own folders are not listed here.
|
|
211
|
+
*/
|
|
212
|
+
export declare function sharedWithReader(root: string, reader: ShelfReader, circles?: CircleLoader): Promise<ShelfListing[]>;
|
package/dist/research-shelf.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* Reading what is on the inquiry shelf (jgwill/Miadi#879). save_research and the agents who work
|
|
3
3
|
* on the shelf write here, and this reads it back from a later conversation without another mission.
|
|
4
4
|
*
|
|
5
|
-
* Who may read: the folder's owner,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Who may read: the folder's owner, a person the owner shared it with, a member of a talking circle
|
|
6
|
+
* the owner shared it with (for as long as they sit in it), or Miadi's write tier. A folder with no
|
|
7
|
+
* owner recorded is the write tier's alone. The legacy `visibility: circle` names one of the five
|
|
8
|
+
* accountable circles and admits no one; shares do (jgwill/Miadi#1005). Each answer says by which
|
|
9
|
+
* route the reader was admitted.
|
|
9
10
|
*
|
|
10
11
|
* What can be read: the text files the episode doors read, by their path in the folder. Hidden
|
|
11
12
|
* paths, links, and anything outside the folder are never served. Each answer says whether the
|
|
@@ -16,7 +17,7 @@ import { createHash } from "node:crypto";
|
|
|
16
17
|
import { existsSync, lstatSync, readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
17
18
|
import { join, relative, sep } from "node:path";
|
|
18
19
|
import { promisify } from "node:util";
|
|
19
|
-
import { artefactVisibility, readArtefactWeave } from "@miadi/inquiry-weave";
|
|
20
|
+
import { activeShares, artefactVisibility, readArtefactWeave } from "@miadi/inquiry-weave";
|
|
20
21
|
import { FileRefusal, checkRelativePath, extensionOf, pageOf, TEXT_TYPES } from "./episode-files.js";
|
|
21
22
|
import { digestReport, folderTitle } from "./research-digest.js";
|
|
22
23
|
const run = promisify(execFile);
|
|
@@ -32,13 +33,51 @@ export class ShelfRefusal extends Error {
|
|
|
32
33
|
this.code = code;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
const routeOf = (s) => ({
|
|
37
|
+
via: s.circle ? "circle" : "person",
|
|
38
|
+
...(s.circle ? { circle: s.circle, ...(s.name ? { circle_name: s.name } : {}) } : {}),
|
|
39
|
+
by: { person_id: s.by.person_id, ...(s.by.name ? { name: s.by.name } : {}) },
|
|
40
|
+
at: s.at,
|
|
41
|
+
});
|
|
42
|
+
/** Whether a folder is shared with a circle, so its reader's circles are worth reading. */
|
|
43
|
+
export function sharedWithACircle(weave) {
|
|
44
|
+
return activeShares(weave).some((s) => s.circle);
|
|
45
|
+
}
|
|
46
|
+
/** How a reader is admitted to a folder, or null. Direct shares come before circle shares. `weave` is undefined for a folder no one saved through a door. */
|
|
47
|
+
export function shelfAccess(weave, reader) {
|
|
48
|
+
if (weave?.owner?.person_id === reader.id)
|
|
49
|
+
return { as: "owner", routes: [] };
|
|
50
|
+
const circles = new Set(reader.circles ?? []);
|
|
51
|
+
const shares = activeShares(weave);
|
|
52
|
+
const routes = [...shares.filter((s) => s.person_id === reader.id), ...shares.filter((s) => s.circle && circles.has(s.circle))].map(routeOf);
|
|
53
|
+
if (routes.length)
|
|
54
|
+
return { as: "shared", routes };
|
|
55
|
+
if (reader.api_tier === "write")
|
|
56
|
+
return { as: "write_tier", routes: [] };
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
/** Who may read a folder. */
|
|
36
60
|
export function canReadShelf(weave, person) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
61
|
+
return shelfAccess(weave, person) !== null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The reader with their circles read, when a folder needs them and the door can read them. The write
|
|
65
|
+
* tier reads every folder, so for it the circles only name the route: when they cannot be read it is
|
|
66
|
+
* still admitted, as the write tier, unless `strict` (listing what is shared with them, where the
|
|
67
|
+
* circles are the whole answer).
|
|
68
|
+
*/
|
|
69
|
+
async function withCircles(reader, weave, load, strict = false) {
|
|
70
|
+
if (reader.circles || !load || !sharedWithACircle(weave) || weave?.owner?.person_id === reader.id)
|
|
71
|
+
return reader;
|
|
72
|
+
if (reader.api_tier === "write" && !strict) {
|
|
73
|
+
try {
|
|
74
|
+
return { ...reader, circles: await load() };
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return { ...reader, circles: [] };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return { ...reader, circles: await load() };
|
|
42
81
|
}
|
|
43
82
|
function folderOf(root, name) {
|
|
44
83
|
if (!/^[\w.-]+$/.test(name) || name.startsWith("."))
|
|
@@ -136,13 +175,17 @@ function defaultFile(files, saved) {
|
|
|
136
175
|
export async function readShelfArtefact(root, name, person, opts = {}) {
|
|
137
176
|
const dir = folderOf(root, name);
|
|
138
177
|
const weave = await readArtefactWeave(dir).catch(() => undefined);
|
|
139
|
-
|
|
140
|
-
|
|
178
|
+
const access = shelfAccess(weave, await withCircles(person, weave, opts.circles));
|
|
179
|
+
if (!access) {
|
|
180
|
+
throw new ShelfRefusal("forbidden", weave ? "That folder belongs to another person and is not shared with you or a circle you sit in." : "No owner is recorded for that folder, so only a person with Miadi's write tier can read it.");
|
|
141
181
|
}
|
|
142
182
|
const { files, truncated } = listFiles(dir);
|
|
143
183
|
const manifest = {
|
|
144
184
|
artefact: name,
|
|
145
185
|
...(weave?.owner ? { owner: { person_id: weave.owner.person_id, name: weave.owner.name } } : {}),
|
|
186
|
+
access,
|
|
187
|
+
// Whom it is shared with is its owner's to see, and the write tier's; a reader sees their own routes in access.
|
|
188
|
+
...(access.as !== "shared" && weave?.shares?.length ? { shares: weave.shares } : {}),
|
|
146
189
|
visibility: artefactVisibility(weave),
|
|
147
190
|
...(weave?.circle ? { circle: weave.circle } : {}),
|
|
148
191
|
...(weave?.issue ? { issue: weave.issue, issue_url: weave.issue_url } : {}),
|
|
@@ -178,6 +221,11 @@ export async function readShelfArtefact(root, name, person, opts = {}) {
|
|
|
178
221
|
}
|
|
179
222
|
const MAIN_DOCUMENTS = ["report.md", "README.md", "readme.md"];
|
|
180
223
|
const AGENT_NOTES = /^(AGENTS|CLAUDE)\.md$/i;
|
|
224
|
+
/** A listing as one reader may see it: how they are admitted and, for the owner or the write tier, whom it is shared with. */
|
|
225
|
+
export function listingFor(listing, weave, access) {
|
|
226
|
+
const shares = access.as === "shared" ? [] : activeShares(weave);
|
|
227
|
+
return { ...listing, access, ...(shares.length ? { shares } : {}) };
|
|
228
|
+
}
|
|
181
229
|
/** One folder's listing. A folder that cannot be read is listed by its name. */
|
|
182
230
|
export function shelfListing(root, name, weave) {
|
|
183
231
|
const dir = join(root, name);
|
|
@@ -266,18 +314,24 @@ export function sortListings(items, sort = "newest") {
|
|
|
266
314
|
export async function listShelfArtefacts(root, person, opts = {}) {
|
|
267
315
|
const scope = opts.scope ?? "mine";
|
|
268
316
|
if (scope === "all" && person.api_tier !== "write")
|
|
269
|
-
throw new ShelfRefusal("forbidden", "Listing the whole shelf needs Miadi's write tier. scope mine lists what you own.");
|
|
317
|
+
throw new ShelfRefusal("forbidden", "Listing the whole shelf needs Miadi's write tier. scope mine lists what you own, scope shared what is shared with you.");
|
|
270
318
|
const limit = Math.min(Math.max(opts.limit ?? 50, 1), 200);
|
|
271
319
|
const offset = Math.max(opts.offset ?? 0, 0);
|
|
272
320
|
const q = opts.query?.trim().toLowerCase();
|
|
273
321
|
const items = [];
|
|
322
|
+
let reader = person;
|
|
274
323
|
for (const entry of existsSync(root) ? readdirSync(root, { withFileTypes: true }) : []) {
|
|
275
324
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
276
325
|
continue;
|
|
277
326
|
const weave = await readArtefactWeave(join(root, entry.name)).catch(() => undefined);
|
|
278
|
-
if (scope === "mine"
|
|
327
|
+
if (scope === "mine" && weave?.owner?.person_id !== person.id)
|
|
279
328
|
continue;
|
|
280
|
-
|
|
329
|
+
// The reader's circles are read once, at the first folder shared with a circle.
|
|
330
|
+
reader = await withCircles(reader, weave, opts.circles, scope === "shared");
|
|
331
|
+
const access = shelfAccess(weave, reader);
|
|
332
|
+
if (!access || (scope === "shared" && access.as !== "shared"))
|
|
333
|
+
continue;
|
|
334
|
+
const item = listingFor(shelfListing(root, entry.name, weave), weave, access);
|
|
281
335
|
if (opts.kind && item.kind !== opts.kind)
|
|
282
336
|
continue;
|
|
283
337
|
if (q && ![item.title, item.excerpt, item.artefact, ...item.headings].some((t) => t?.toLowerCase().includes(q)))
|
|
@@ -295,3 +349,16 @@ export async function listShelfArtefacts(root, person, opts = {}) {
|
|
|
295
349
|
read_with: "read_research_artifact takes an item's artefact, and its main file opens first",
|
|
296
350
|
};
|
|
297
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* What is shared with this reader: every folder another person shared with them or with a circle
|
|
354
|
+
* they sit in, each with the routes it reaches them by. Their own folders are not listed here.
|
|
355
|
+
*/
|
|
356
|
+
export async function sharedWithReader(root, reader, circles) {
|
|
357
|
+
const items = [];
|
|
358
|
+
for (let offset = 0; offset !== null;) {
|
|
359
|
+
const page = await listShelfArtefacts(root, reader, { scope: "shared", limit: 200, offset, ...(circles ? { circles } : {}) });
|
|
360
|
+
items.push(...page.items);
|
|
361
|
+
offset = page.next_offset;
|
|
362
|
+
}
|
|
363
|
+
return items;
|
|
364
|
+
}
|
package/dist/server.d.ts
CHANGED
|
@@ -43,9 +43,11 @@ export interface ConnectorDeps {
|
|
|
43
43
|
steeringRuntime?: RuntimeDeps;
|
|
44
44
|
/** Asks the factory runner for a pass now. Its timer is the net (jgwill/Miadi#942). */
|
|
45
45
|
wakeRunner?: () => void;
|
|
46
|
+
/** Where a repository's clone lives on this host, for reading a completion's commits (jgwill/Miadi#993). Default: MIADI_CONNECTOR_CLONES, then the service's own checkout for jgwill/Miadi; tests pass their own. */
|
|
47
|
+
clones?: (repository: string) => string | undefined;
|
|
46
48
|
/** Reads a video's captions for an approved create; the service passes youtubeCaptions, tests their own. */
|
|
47
49
|
captions?: FetchCaptions;
|
|
48
|
-
/** A transcription made on this host, tried
|
|
50
|
+
/** A transcription made on this host from the video's audio, tried when the video has no captions (jgwill/Miadi#995). */
|
|
49
51
|
localTranscription?: FetchCaptions;
|
|
50
52
|
/** The event folder: the review.created facts this connector takes, and the ledger it announces outcomes in (jgwill/Miadi#995). */
|
|
51
53
|
eventsDir?: string;
|
|
@@ -59,4 +61,4 @@ export declare function createConnectorApp(config: ConnectorConfig, deps: Connec
|
|
|
59
61
|
provider: MiadiOAuthProvider;
|
|
60
62
|
ledger: Ledger<ConnectorRecord>;
|
|
61
63
|
};
|
|
62
|
-
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- A review's transcript is acquired by ensure_review_transcript, for a review made anywhere. It needs no decision and no pasted text, takes the video's own captions, never overwrites and calls no model. review_lookup and review_versions carry the transcript's state (unknown, absent, acquiring, stored, held or failed). review_transcript_status follows a job, and every answer carries plain links that work when no card is shown.\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.";
|
|
64
|
+
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- A review's transcript is acquired by ensure_review_transcript, for a review made anywhere. It needs no decision and no pasted text, takes the video's own captions, or transcribes its audio on the Miadi host when the video has none, never overwrites and calls no model service. review_lookup and review_versions carry the transcript's state (unknown, absent, acquiring, stored, held or failed). review_transcript_status follows a job, and every answer carries plain links that work when no card is shown.\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
|
@@ -151,6 +151,7 @@ export function createConnectorApp(config, deps) {
|
|
|
151
151
|
steerSettleMs: deps.steerSettleMs,
|
|
152
152
|
...(deps.steeringRuntime ? { steeringRuntime: deps.steeringRuntime } : {}),
|
|
153
153
|
...(deps.wakeRunner ? { wakeRunner: deps.wakeRunner } : {}),
|
|
154
|
+
...(deps.clones ? { clones: deps.clones } : {}),
|
|
154
155
|
};
|
|
155
156
|
const server = new McpServer({ name: "miadi", version: VERSION }, { instructions: INSTRUCTIONS });
|
|
156
157
|
registerTools(server, ctx);
|
|
@@ -191,6 +192,6 @@ Rules every tool keeps:
|
|
|
191
192
|
- 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.
|
|
192
193
|
- 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.
|
|
193
194
|
- 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.
|
|
194
|
-
- A review's transcript is acquired by ensure_review_transcript, for a review made anywhere. It needs no decision and no pasted text, takes the video's own captions, never overwrites and calls no model. review_lookup and review_versions carry the transcript's state (unknown, absent, acquiring, stored, held or failed). review_transcript_status follows a job, and every answer carries plain links that work when no card is shown.
|
|
195
|
+
- A review's transcript is acquired by ensure_review_transcript, for a review made anywhere. It needs no decision and no pasted text, takes the video's own captions, or transcribes its audio on the Miadi host when the video has none, never overwrites and calls no model service. review_lookup and review_versions carry the transcript's state (unknown, absent, acquiring, stored, held or failed). review_transcript_status follows a job, and every answer carries plain links that work when no card is shown.
|
|
195
196
|
- An unknown id is answered as not found, never invented. A missing backing service is answered as unavailable.
|
|
196
197
|
- Use the miadi-review:<uuid>, miadi-chronicle://<n>, owner/repo#n and session:<uuid> reference forms.`;
|
package/dist/tools.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export interface ToolContext {
|
|
|
44
44
|
draftReview?: DraftReviewService;
|
|
45
45
|
/** Re-peek delay after a steer is typed (default 4000ms; tests pass 0). */
|
|
46
46
|
steerSettleMs?: number;
|
|
47
|
+
/** Where a repository's clone lives on this host, for reading the commits of a completion (jgwill/Miadi#993). Default: MIADI_CONNECTOR_CLONES, then the service's own checkout for jgwill/Miadi. */
|
|
48
|
+
clones?: (repository: string) => string | undefined;
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
51
|
* Why GitHub did not answer a reference (jgwill/Miadi#913 B). A 404 without a
|