@graview/tools 0.1.28 → 0.1.30
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/dist/agent/reads.d.ts.map +1 -1
- package/dist/agent/reads.js +12 -5
- package/dist/agent/reads.js.map +1 -1
- package/dist/agent/tools.d.ts +13 -1
- package/dist/agent/tools.d.ts.map +1 -1
- package/dist/agent/tools.js +240 -14
- package/dist/agent/tools.js.map +1 -1
- package/dist/agent/untrusted.d.ts +7 -1
- package/dist/agent/untrusted.d.ts.map +1 -1
- package/dist/agent/untrusted.js +12 -2
- package/dist/agent/untrusted.js.map +1 -1
- package/dist/ai.d.ts +10 -0
- package/dist/ai.d.ts.map +1 -1
- package/dist/ai.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +18 -2
- package/dist/cli.js.map +1 -1
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +9 -10
- package/dist/conversation.js.map +1 -1
- package/dist/derive.d.ts.map +1 -1
- package/dist/derive.js +7 -0
- package/dist/derive.js.map +1 -1
- package/dist/draft.d.ts +9 -0
- package/dist/draft.d.ts.map +1 -1
- package/dist/draft.js +19 -2
- package/dist/draft.js.map +1 -1
- package/dist/edit.d.ts.map +1 -1
- package/dist/edit.js +7 -1
- package/dist/edit.js.map +1 -1
- package/dist/go.d.ts.map +1 -1
- package/dist/go.js +12 -9
- package/dist/go.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts.map +1 -1
- package/dist/intelligence.js +2 -1
- package/dist/intelligence.js.map +1 -1
- package/dist/keep.d.ts.map +1 -1
- package/dist/keep.js +2 -1
- package/dist/keep.js.map +1 -1
- package/dist/mcp-http.d.ts +2 -0
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +1 -0
- package/dist/mcp-http.js.map +1 -1
- package/dist/plan.d.ts.map +1 -1
- package/dist/plan.js +2 -1
- package/dist/plan.js.map +1 -1
- package/dist/providers/insight.d.ts.map +1 -1
- package/dist/providers/insight.js +2 -1
- package/dist/providers/insight.js.map +1 -1
- package/dist/providers/invariant.d.ts.map +1 -1
- package/dist/providers/invariant.js +2 -1
- package/dist/providers/invariant.js.map +1 -1
- package/dist/providers/schema.d.ts.map +1 -1
- package/dist/providers/schema.js +49 -4
- package/dist/providers/schema.js.map +1 -1
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +2 -1
- package/dist/questions.js.map +1 -1
- package/dist/seat-model.d.ts.map +1 -1
- package/dist/seat-model.js +5 -3
- package/dist/seat-model.js.map +1 -1
- package/dist/several.d.ts +93 -0
- package/dist/several.d.ts.map +1 -0
- package/dist/several.js +248 -0
- package/dist/several.js.map +1 -0
- package/dist/types.d.ts +14 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reads.d.ts","sourceRoot":"","sources":["../../src/agent/reads.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"reads.d.ts","sourceRoot":"","sources":["../../src/agent/reads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAGjI,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,gBAAgB,CAAC;AA2GhE;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAWpE;AAED,6HAA6H;AAC7H,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAI7E;AAED,sGAAsG;AACtG,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAe3K;AAED,6HAA6H;AAC7H,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAkCtM;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAOxJ"}
|
package/dist/agent/reads.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { labelOf } from "@graview/core";
|
|
1
|
+
import { archivedFrom, isArchived, labelOf } from "@graview/core";
|
|
2
2
|
import { computedValues } from "@graview/core/blocks";
|
|
3
3
|
import { READ_CHARS, READ_LINKS, READ_PAGE, READ_PROBLEMS, READ_TEXT } from "./bounds.js";
|
|
4
4
|
/*
|
|
@@ -120,19 +120,24 @@ export function withinReadChars(tool, data) {
|
|
|
120
120
|
}
|
|
121
121
|
/** `search_graph`: the hits without every match's id — what a picture lights, not what a model reads — and how many more. */
|
|
122
122
|
export function searchRead(found, marked) {
|
|
123
|
-
const { matched: _matched, ...answer } = marked;
|
|
123
|
+
const { matched: _matched, later: _later, ...answer } = marked;
|
|
124
124
|
const shown = found.hits.filter((hit) => hit.about === "node").length;
|
|
125
125
|
return found.total > shown ? { ...answer, more: `and ${found.total - shown} more records match: narrow the words, or add kind:<kind>.` } : answer;
|
|
126
126
|
}
|
|
127
127
|
/** `get_graph`: a page of records, the edges out of them, the total and how to read the next page. */
|
|
128
128
|
export function graphRead(seen, by, args) {
|
|
129
|
-
|
|
129
|
+
// The live records, unless asked for the archived ones (FR-173): `archived: true` or `"all"`.
|
|
130
|
+
const archived = archivedFrom(args["archived"]);
|
|
131
|
+
const snapshot = { nodes: seen.graph.allNodes({ archived }), edges: seen.graph.allEdges({ archived: "all" }) };
|
|
130
132
|
const offset = offsetOf(args["offset"]);
|
|
131
133
|
const total = snapshot.nodes.length;
|
|
132
134
|
const { page, answer } = fittedPage(snapshot.nodes, offset, READ_PAGE, (nodes) => {
|
|
133
135
|
const on = new Set(nodes.map((node) => node.id));
|
|
136
|
+
const reached = new Set(nodes.map((node) => node.id));
|
|
134
137
|
const more = moreSaid(total, offset, nodes.length, "get_graph", "nodes");
|
|
135
|
-
|
|
138
|
+
// A link out of a record on the page, to one the read reaches.
|
|
139
|
+
const reaches = (id) => reached.has(id) || (archived === "all" ? seen.graph.has(id) : seen.graph.has(id) && isArchived(seen.graph.getNode(id)) === archived);
|
|
140
|
+
return { ...markGraph({ nodes: nodes.map(clipped), edges: snapshot.edges.filter((edge) => on.has(edge.from) && reaches(edge.to)) }, by), total, ...(more ? { more } : {}) };
|
|
136
141
|
});
|
|
137
142
|
return { data: answer, reads: page.map((node) => node.id) };
|
|
138
143
|
}
|
|
@@ -146,7 +151,7 @@ export function nodeRead(seen, by, id, args) {
|
|
|
146
151
|
const inbound = inAll.slice(offset, offset + READ_LINKS);
|
|
147
152
|
const link = (kind, other) => {
|
|
148
153
|
const at = seen.graph.getNode(other);
|
|
149
|
-
return { kind, id: other, label: at ? labelOf(seen.schema.tryDefinition(at.kind), at) : other };
|
|
154
|
+
return { kind, id: other, label: at ? labelOf(seen.schema.tryDefinition(at.kind), at) : other, ...(isArchived(at) ? { archived: true } : {}) };
|
|
150
155
|
};
|
|
151
156
|
// Worked out over what this seat sees, never the store's whole graph (FR-83, FR-55).
|
|
152
157
|
const worked = computedValues(seen.schema, seen.graph, node);
|
|
@@ -159,6 +164,8 @@ export function nodeRead(seen, by, id, args) {
|
|
|
159
164
|
return {
|
|
160
165
|
data: {
|
|
161
166
|
node: markNode(clipped(node), by),
|
|
167
|
+
// Set aside, not gone (FR-173): unarchive-<kind> brings it back.
|
|
168
|
+
...(isArchived(node) ? { archived: true } : {}),
|
|
162
169
|
...(Object.keys(worked.values).length > 0 ? { computed: markComputed(id, worked.values, by) } : {}),
|
|
163
170
|
...(Object.keys(worked.refused).length > 0 ? { uncomputed: worked.refused } : {}),
|
|
164
171
|
out: markLinks(out.map((edge) => link(edge.kind, edge.to)), by),
|
package/dist/agent/reads.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reads.js","sourceRoot":"","sources":["../../src/agent/reads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG1F;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,MAAuD,EAAE,EAAc,EAAiB,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AAE/K,mEAAmE;AACnE,SAAS,QAAQ,CAAyC,IAAO,EAAE,EAAc;IAC/E,IAAI,GAAwC,CAAC;IAC7C,KAAK,MAAM,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usalReason, type Store } from "@graview/core";
|
|
1
|
+
import { type LinkedRecords, type AnySchema, type GraphDiff, type GraviewApp, type NodeOfSchema, type Place, type Principal, type RefCandidate, type RefusalReason, type Store } from "@graview/core";
|
|
2
|
+
import { type SearchRanker } from "@graview/core/search";
|
|
2
3
|
import { type JsonSchema } from "@graview/core/json-schema";
|
|
3
4
|
import { applyAffordance, type DeriveOptions } from "../derive.js";
|
|
4
5
|
/**
|
|
@@ -96,6 +97,12 @@ export interface ToolRuntimeOptions<S extends AnySchema> {
|
|
|
96
97
|
* whoever built the runtime beside a view registry can.
|
|
97
98
|
*/
|
|
98
99
|
readonly places?: readonly Place[] | (() => readonly Place[]);
|
|
100
|
+
/**
|
|
101
|
+
* THE HOST'S RANKER (`HostAi.near`): asked by `search_graph` when the
|
|
102
|
+
* exact hits are few, with only the records this seat sees, its near hits
|
|
103
|
+
* answered after the exact ones as `near: true`.
|
|
104
|
+
*/
|
|
105
|
+
readonly near?: SearchRanker | undefined;
|
|
99
106
|
/**
|
|
100
107
|
* The app whose places `describe_place` describes: its home, its lenses,
|
|
101
108
|
* its views and its arrangement (FR-89). Without it a seat can still be
|
|
@@ -116,6 +123,11 @@ export interface ToolRuntimeOptions<S extends AnySchema> {
|
|
|
116
123
|
* keeps which provider proposed it while the reader is shown none.
|
|
117
124
|
*/
|
|
118
125
|
readonly via?: string | (() => string | undefined);
|
|
126
|
+
/**
|
|
127
|
+
* THE HOST'S WAY TO READ ANOTHER APP'S RECORDS (FR-171): what `find_linked`
|
|
128
|
+
* answers through, as this seat. Unsaid, it says this host reads no other app.
|
|
129
|
+
*/
|
|
130
|
+
readonly linked?: LinkedRecords;
|
|
119
131
|
}
|
|
120
132
|
/** The `add-lens` edit `keep_lens` hands the host. */
|
|
121
133
|
export interface KeptLensEdit {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/agent/tools.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
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IAAI,CAAC;CACxD;AAED,mGAAmG;AACnG,eAAO,MAAM,OAAO,8DAA8D,CAAC;AAiGnF,8GAA8G;AAC9G,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAShD;AAED,iCAAiC;AACjC,wBAAgB,WAAW,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,CAE1E;AAqBD,MAAM,WAAW,sBAAsB;IACrC,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,6FAA6F;IAC7F,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,+HAA+H;IAC/H,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,SAAS,EACjD,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC,EACvE,SAAS,GAAE,SAA6B,EACxC,OAAO,GAAE,sBAA2B,GACnC;IAAE,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAgB5E;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,SAAS,EACnD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,OAAO,GAAE,kBAAkB,CAAC,CAAC,CAAM,GAClC,WAAW,CAAC,CAAC,CAAC,CA4XhB;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/agent/tools.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { actTitle,
|
|
2
|
-
import {
|
|
1
|
+
import { actTitle, deriveMutations, derivedVia, nodeRefArgs, permits, permittedMutations, refusalOf, resolveModules, archivedFrom, linkedRefsOf, linkedRelations, linkedValue, nameOfAuthor, sha256Hex, } from "@graview/core";
|
|
2
|
+
import { answerSeenBy } from "@graview/core/seat";
|
|
3
|
+
import { acceptSuggestion, declineSuggestion, suggestions } from "@graview/core/tidying";
|
|
4
|
+
import { search } from "@graview/core/search";
|
|
5
|
+
import { argumentsNeverShown, mutationToolSchema } from "@graview/core/json-schema";
|
|
3
6
|
import { authorship, markHits } from "./untrusted.js";
|
|
4
7
|
import { READ_HITS } from "./bounds.js";
|
|
5
8
|
import { deriveAffordances, applyAffordance, } from "../derive.js";
|
|
@@ -49,20 +52,74 @@ const reads = lazily(() => import("./reads.js"));
|
|
|
49
52
|
* specifier, as above.
|
|
50
53
|
*/
|
|
51
54
|
const drafter = lazily(() => import("../draft.js"));
|
|
55
|
+
/* One act on several records, fetched when a seat first does one. A literal specifier, as above. */
|
|
56
|
+
const several = lazily(() => import("../several.js"));
|
|
57
|
+
/** Whether an app has a relation to another app's kind. */
|
|
58
|
+
const linksAnotherApp = (schema) => schema.definitions.some((definition) => linkedRelations(definition).size > 0);
|
|
59
|
+
/** A far record as a tool answers it: the value to link it by, then what it is there. */
|
|
60
|
+
const linkedAnswer = (record) => ({
|
|
61
|
+
value: linkedValue(record),
|
|
62
|
+
label: record.label,
|
|
63
|
+
...(record.describe ? { describe: record.describe } : {}),
|
|
64
|
+
...(record.card ? { card: record.card } : {}),
|
|
65
|
+
fields: record.fields,
|
|
66
|
+
...(record.app ? { app: record.app } : {}),
|
|
67
|
+
});
|
|
68
|
+
/** `find_linked`: another app's records, found or read through the host, as this seat (FR-171). */
|
|
69
|
+
async function findLinked(seen, principal, args, host) {
|
|
70
|
+
const asked = String(args["relation"] ?? "");
|
|
71
|
+
const [kindAsked, nameAsked] = asked.includes(".") ? asked.split(".", 2) : [undefined, asked];
|
|
72
|
+
const every = seen.schema.definitions.flatMap((definition) => [...linkedRelations(definition)].map(([name, relation]) => ({ kind: definition.kind, name, relation })));
|
|
73
|
+
const found = every.filter((one) => one.name === nameAsked && (kindAsked === undefined || one.kind === kindAsked));
|
|
74
|
+
if (found.length !== 1) {
|
|
75
|
+
const known = every.map((one) => `${one.kind}.${one.name}`).join(", ") || "none";
|
|
76
|
+
return { ok: false, error: `${found.length === 0 ? `No relation to another app is called "${asked}"` : `"${asked}" names a relation of several kinds`}. The relations to other apps are: ${known}.` };
|
|
77
|
+
}
|
|
78
|
+
const { kind, name, relation } = found[0];
|
|
79
|
+
if (!host)
|
|
80
|
+
return { ok: false, error: `This seat cannot read ${relation.address}: its host reads no other app's records. Nothing was changed.` };
|
|
81
|
+
const viewer = { kind: principal.kind, ...(principal.id === undefined ? {} : { id: principal.id }), ...(principal.roles ? { roles: principal.roles } : {}) };
|
|
82
|
+
const of = typeof args["of"] === "string" ? args["of"] : undefined;
|
|
83
|
+
if (of !== undefined) {
|
|
84
|
+
const node = seen.graph.getNode(of);
|
|
85
|
+
if (!node || node.kind !== kind)
|
|
86
|
+
return { ok: false, error: `No ${kind} "${of}".` };
|
|
87
|
+
const refs = linkedRefsOf(node[name], relation);
|
|
88
|
+
const answers = await Promise.all(refs.map((ref) => Promise.resolve().then(() => host.resolve(ref, viewer)).catch(() => null)));
|
|
89
|
+
return {
|
|
90
|
+
ok: true,
|
|
91
|
+
data: { relation: `${kind}.${name}`, app: relation.address, records: answers.map((answer, at) => (answer === null ? { value: linkedValue(refs[at]), missing: true } : "denied" in answer ? { denied: true, said: "linked record (no access)" } : linkedAnswer(answer))) },
|
|
92
|
+
reads: [of],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const limit = typeof args["limit"] === "number" && args["limit"] > 0 ? Math.min(args["limit"], READ_HITS) : READ_HITS;
|
|
96
|
+
const answer = await Promise.resolve()
|
|
97
|
+
.then(() => host.find({ address: relation.address, kinds: relation.kinds, query: String(args["query"] ?? ""), limit }, viewer))
|
|
98
|
+
.catch(() => []);
|
|
99
|
+
if (!Array.isArray(answer))
|
|
100
|
+
return { ok: true, data: { relation: `${kind}.${name}`, app: relation.address, denied: true, said: "linked record (no access)" } };
|
|
101
|
+
return { ok: true, data: { relation: `${kind}.${name}`, app: relation.address, records: answer.map(linkedAnswer), link: `edit-${kind} with ${name} set to a record's value` } };
|
|
102
|
+
}
|
|
52
103
|
const read = (title) => ({ title, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false });
|
|
104
|
+
/** Which records a read reaches (FR-173): the live ones unless it asks. */
|
|
105
|
+
const ARCHIVED_ARG = {
|
|
106
|
+
description: "Which records: false (the default) the live ones, true only the archived ones, \"all\" both. An archived record is set aside, not gone: unarchive-<kind> brings it back.",
|
|
107
|
+
anyOf: [{ type: "boolean" }, { type: "string", enum: ["all"] }],
|
|
108
|
+
};
|
|
53
109
|
/** Where a page of a read starts (FR-167). */
|
|
54
110
|
const OFFSET = { type: "number", description: "Where the page starts; 0 when unsaid." };
|
|
55
111
|
const READ_TOOLS = [
|
|
56
112
|
{
|
|
57
113
|
name: "search_graph",
|
|
58
114
|
title: "Find by name",
|
|
59
|
-
description: "Find things by name: records whose name or readable fields carry the words, and the kinds, places and rules the words name — each with why it matched. Reach for this before get_graph when you know what something is called. Words match the start of words, case and accents aside; key:value tokens narrow as a list's filter does (done:false, is:any for past records, kind:<kind>). Pass subject (a node id) to get the acts you may run on it as hits too.",
|
|
115
|
+
description: "Find things by name: records whose name or readable fields carry the words, and the kinds, places and rules the words name — each with why it matched. Reach for this before get_graph when you know what something is called. Words match the start of words, case and accents aside; key:value tokens narrow as a list's filter does (done:false, is:any for past records, kind:<kind>). Pass subject (a node id) to get the acts you may run on it as hits too. When few records match exactly, records with a near word follow — a typo, another form of the word, a meaning — each with near: true and why.matched, the record's own word that answered.",
|
|
60
116
|
inputSchema: {
|
|
61
117
|
type: "object",
|
|
62
118
|
properties: {
|
|
63
119
|
query: { type: "string", description: "Words, with optional key:value conditions." },
|
|
64
120
|
limit: { type: "number", description: "Most hits to return; at most 20." },
|
|
65
121
|
subject: { type: "string", description: "A node id whose acts to include." },
|
|
122
|
+
archived: ARCHIVED_ARG,
|
|
66
123
|
},
|
|
67
124
|
required: ["query"],
|
|
68
125
|
additionalProperties: false,
|
|
@@ -76,7 +133,7 @@ const READ_TOOLS = [
|
|
|
76
133
|
description: "Read the graph, 25 nodes a page: their fields, the edges out of them, and how many more. Start here when you need the shape of the domain rather than one thing in it.",
|
|
77
134
|
inputSchema: {
|
|
78
135
|
type: "object",
|
|
79
|
-
properties: { offset: OFFSET },
|
|
136
|
+
properties: { offset: OFFSET, archived: ARCHIVED_ARG },
|
|
80
137
|
additionalProperties: false,
|
|
81
138
|
},
|
|
82
139
|
mutating: false,
|
|
@@ -184,7 +241,58 @@ const READ_TOOLS = [
|
|
|
184
241
|
mutating: true,
|
|
185
242
|
annotations: { title: "Undo a batch", readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
|
|
186
243
|
},
|
|
244
|
+
/*
|
|
245
|
+
* WHAT WAITS FOR A PERSON (`suggest`, `@graview/core/tidying`): a change the app's own actor
|
|
246
|
+
* was not sure enough of to make. Listed as this seat may see them, and
|
|
247
|
+
* accepted or declined as the person would from the Suggested tray.
|
|
248
|
+
*/
|
|
249
|
+
{
|
|
250
|
+
name: "list_suggestions",
|
|
251
|
+
title: "List what is suggested",
|
|
252
|
+
description: "List the suggestions waiting for a person: changes the app's own actor proposed and did not make, each with its id, what it would do, who suggested it, what it was based on and how sure (0 to 1). Nothing changes until one is accepted (accept_suggestion) or declined (decline_suggestion); a declined one is never suggested again.",
|
|
253
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
254
|
+
mutating: false,
|
|
255
|
+
annotations: read("List what is suggested"),
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: "accept_suggestion",
|
|
259
|
+
title: "Accept a suggestion",
|
|
260
|
+
description: "Make a waiting suggestion's change, as this seat, carrying what it was based on. Returns the batch (undo_batch takes it back).",
|
|
261
|
+
inputSchema: { type: "object", properties: { suggestion: { type: "string", description: "The suggestion's id, from list_suggestions." } }, required: ["suggestion"], additionalProperties: false },
|
|
262
|
+
mutating: true,
|
|
263
|
+
annotations: { title: "Accept a suggestion", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
name: "decline_suggestion",
|
|
267
|
+
title: "Decline a suggestion",
|
|
268
|
+
description: "Decline a waiting suggestion: nothing changes, the decline is kept in the log, and the same change is never suggested or made by the app's own actor again.",
|
|
269
|
+
inputSchema: { type: "object", properties: { suggestion: { type: "string", description: "The suggestion's id, from list_suggestions." } }, required: ["suggestion"], additionalProperties: false },
|
|
270
|
+
mutating: true,
|
|
271
|
+
annotations: { title: "Decline a suggestion", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
272
|
+
},
|
|
187
273
|
];
|
|
274
|
+
/*
|
|
275
|
+
* ONE ACT ON SEVERAL RECORDS (`@graview/tools/several`): what a person does
|
|
276
|
+
* with a selection on a list, the seat does with this — the same judging,
|
|
277
|
+
* the same one batch, the same refusals named per record.
|
|
278
|
+
*/
|
|
279
|
+
const ACT_ON_SEVERAL = {
|
|
280
|
+
name: "act_on_several",
|
|
281
|
+
title: "Do one act to several records",
|
|
282
|
+
description: "Run one act on several records at once, as one change with one undo. act is the act (its tool name or its declared name), records the records it runs on (ids or names; each goes in the act's subject), args what every call shares (\"Set stage to Declined\" is args { stage: \"declined\" }). Each record is judged on its own: one this seat may not change is named with why, and the rest still apply. Returns the batch (undo_batch takes it all back), the records changed, those already so, and those refused.",
|
|
283
|
+
inputSchema: {
|
|
284
|
+
type: "object",
|
|
285
|
+
properties: {
|
|
286
|
+
act: { type: "string", description: "The act to run on each record." },
|
|
287
|
+
records: { type: "array", items: { type: "string" }, minItems: 1, maxItems: 200, description: "Ids or names of the records." },
|
|
288
|
+
args: { type: "object", description: "Arguments every call shares, besides the record." },
|
|
289
|
+
},
|
|
290
|
+
required: ["act", "records"],
|
|
291
|
+
additionalProperties: false,
|
|
292
|
+
},
|
|
293
|
+
mutating: true,
|
|
294
|
+
annotations: { title: "Do one act to several records", readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
|
|
295
|
+
};
|
|
188
296
|
const LENS_SPEC = {
|
|
189
297
|
type: "object",
|
|
190
298
|
description: "A lens, as draft_view returns one.",
|
|
@@ -223,6 +331,29 @@ const KEEP_LENS = {
|
|
|
223
331
|
mutating: true,
|
|
224
332
|
annotations: { title: "Keep a view as a lens", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
225
333
|
};
|
|
334
|
+
/**
|
|
335
|
+
* `find_linked`: a read of ANOTHER APP'S records (FR-171), through the host,
|
|
336
|
+
* as this seat. Listed only for an app with a relation to another app's
|
|
337
|
+
* kind; linking one is the record's own edit, which takes `<kind>:<id>`.
|
|
338
|
+
*/
|
|
339
|
+
const FIND_LINKED = {
|
|
340
|
+
name: "find_linked",
|
|
341
|
+
title: "Find a record in another app",
|
|
342
|
+
description: 'A relation may go to a kind in another app (describe_app lists them under "Linked from other apps"). With relation and words, list the records there this seat may link — each with the value to link it by ("house:h1"), its name and its describe line. With of (a record id here), read the records that record links, as this seat may see them there. Linking one is the record\'s edit (edit-<kind>) with the relation set to the value. Another app this seat may not open answers denied, and nothing of it. Writes nothing; never changes the other app.',
|
|
343
|
+
inputSchema: {
|
|
344
|
+
type: "object",
|
|
345
|
+
properties: {
|
|
346
|
+
relation: { type: "string", description: "The relation, by name (forHouse) or as <kind>.<relation> (scenario.forHouse)." },
|
|
347
|
+
query: { type: "string", description: "Words to find by, in the other app's names; empty for the first few." },
|
|
348
|
+
of: { type: "string", description: "A record here whose linked records to read, instead of finding." },
|
|
349
|
+
limit: { type: "number", description: "Most records to return; at most 20." },
|
|
350
|
+
},
|
|
351
|
+
required: ["relation"],
|
|
352
|
+
additionalProperties: false,
|
|
353
|
+
},
|
|
354
|
+
mutating: false,
|
|
355
|
+
annotations: read("Find a record in another app"),
|
|
356
|
+
};
|
|
226
357
|
/** The drafting tools a seat lists: none, draft_view, or draft_view and keep_lens. */
|
|
227
358
|
function draftTools(drafts, readOnly) {
|
|
228
359
|
if (drafts === undefined)
|
|
@@ -231,7 +362,7 @@ function draftTools(drafts, readOnly) {
|
|
|
231
362
|
}
|
|
232
363
|
/** Said on every act whose arguments name records: a name is resolved as well as an id (FR-33). */
|
|
233
364
|
export const BY_NAME = "An argument that names a record takes its id or its name.";
|
|
234
|
-
const READ_NAMES = [...READ_TOOLS.map((tool) => tool.name), DRAFT_VIEW.name, KEEP_LENS.name];
|
|
365
|
+
const READ_NAMES = [...READ_TOOLS.map((tool) => tool.name), ACT_ON_SEVERAL.name, DRAFT_VIEW.name, KEEP_LENS.name, FIND_LINKED.name];
|
|
235
366
|
const MAX_NAME = 64;
|
|
236
367
|
/**
|
|
237
368
|
* A NAME EVERY CLIENT'S TOOL LAYER TAKES.
|
|
@@ -290,8 +421,20 @@ function toolNames(acts) {
|
|
|
290
421
|
}
|
|
291
422
|
return names;
|
|
292
423
|
}
|
|
293
|
-
/**
|
|
294
|
-
function
|
|
424
|
+
/** A tool's schema without the arguments a seat is not offered: their properties, and the requirement of any. */
|
|
425
|
+
function without(schema, kept) {
|
|
426
|
+
if (kept.size === 0)
|
|
427
|
+
return schema;
|
|
428
|
+
const properties = Object.fromEntries(Object.entries((schema["properties"] ?? {})).filter(([name]) => !kept.has(name)));
|
|
429
|
+
const required = (schema["required"] ?? []).filter((name) => !kept.has(name));
|
|
430
|
+
return { ...schema, properties, ...(schema["required"] ? { required } : {}) };
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* One act as the tool a model is offered: its schema, its title and what
|
|
434
|
+
* it does — without an argument that writes a field the seat's sight never
|
|
435
|
+
* shows it, so the tool does not name one (Roadmap f-field-sight).
|
|
436
|
+
*/
|
|
437
|
+
function actTool(mutation, name, kept) {
|
|
295
438
|
const tool = mutationToolSchema(mutation);
|
|
296
439
|
const title = actTitle(mutation);
|
|
297
440
|
const description = tool.nodeRefs.length > 0 ? `${tool.description}${/[.!?]$/.test(tool.description) ? "" : "."} ${BY_NAME}` : tool.description;
|
|
@@ -299,7 +442,7 @@ function actTool(mutation, name) {
|
|
|
299
442
|
name,
|
|
300
443
|
title,
|
|
301
444
|
description,
|
|
302
|
-
inputSchema: tool.inputSchema,
|
|
445
|
+
inputSchema: without(tool.inputSchema, kept),
|
|
303
446
|
mutating: true,
|
|
304
447
|
annotations: {
|
|
305
448
|
title,
|
|
@@ -329,12 +472,16 @@ export function surfaceHash(definitions) {
|
|
|
329
472
|
return `sha256:${sha256Hex(canonical(definitions))}`;
|
|
330
473
|
}
|
|
331
474
|
/** The surface, from every act there is and the ones this seat may run. */
|
|
332
|
-
function surfaceOf(acts, permitted, readOnly, drafts
|
|
475
|
+
function surfaceOf(acts, permitted, readOnly, drafts,
|
|
476
|
+
/** The arguments of an act this seat is not offered (`argumentsNeverShown`). */
|
|
477
|
+
kept,
|
|
478
|
+
/** Whether the app links another app's records (FR-171): `find_linked` is listed. */
|
|
479
|
+
links = false) {
|
|
333
480
|
const names = toolNames(acts.map((act) => act.name));
|
|
334
|
-
const drawing = draftTools(drafts, readOnly);
|
|
481
|
+
const drawing = [...draftTools(drafts, readOnly), ...(links ? [FIND_LINKED] : [])];
|
|
335
482
|
const definitions = readOnly
|
|
336
483
|
? [...READ_TOOLS.filter((tool) => !tool.mutating), ...drawing]
|
|
337
|
-
: [...READ_TOOLS, ...drawing, ...acts.filter((act) => permitted.has(act.name)).map((act) => actTool(act, names.get(act.name)))];
|
|
484
|
+
: [...READ_TOOLS, ACT_ON_SEVERAL, ...drawing, ...acts.filter((act) => permitted.has(act.name)).map((act) => actTool(act, names.get(act.name), kept(act)))];
|
|
338
485
|
return { definitions, names };
|
|
339
486
|
}
|
|
340
487
|
/**
|
|
@@ -359,7 +506,7 @@ export function toolDefinitions(app, principal = { kind: "agent" }, options = {}
|
|
|
359
506
|
.filter((act) => act.derived !== undefined && permits(app.policy, principal, act.name, act.derived.kind, derivedVia(app.schema, every, act)).ok)
|
|
360
507
|
.map((act) => act.name),
|
|
361
508
|
]);
|
|
362
|
-
const { definitions } = surfaceOf(acts, permitted, options.readOnly === true, options.drafts);
|
|
509
|
+
const { definitions } = surfaceOf(acts, permitted, options.readOnly === true, options.drafts, (act) => argumentsNeverShown(app.schema, app.policy, principal, act), linksAnotherApp(app.schema));
|
|
363
510
|
return { definitions, hash: surfaceHash(definitions) };
|
|
364
511
|
}
|
|
365
512
|
/**
|
|
@@ -383,7 +530,7 @@ export function createToolRuntime(store, options = {}) {
|
|
|
383
530
|
*/
|
|
384
531
|
const acts = store.allMutations();
|
|
385
532
|
const permitted = new Set(store.permittedMutations(principal).map((mutation) => mutation.name));
|
|
386
|
-
const { definitions, names } = surfaceOf(acts, permitted, options.readOnly === true, options.drafts ? (options.drafts.keep ? "keep" : "draw") : undefined);
|
|
533
|
+
const { definitions, names } = surfaceOf(acts, permitted, options.readOnly === true, options.drafts ? (options.drafts.keep ? "keep" : "draw") : undefined, (act) => argumentsNeverShown(store.schema, store.policy, principal, act), linksAnotherApp(store.schema));
|
|
387
534
|
const hash = surfaceHash(definitions);
|
|
388
535
|
/** A tool's name, or an act's declared one, as the act it runs. */
|
|
389
536
|
const actNamed = (name) => {
|
|
@@ -481,12 +628,17 @@ export function createToolRuntime(store, options = {}) {
|
|
|
481
628
|
case "search_graph": {
|
|
482
629
|
const places = typeof options.places === "function" ? options.places() : options.places;
|
|
483
630
|
const subject = typeof args["subject"] === "string" ? args["subject"] : undefined;
|
|
484
|
-
const
|
|
631
|
+
const asked = search(seen, String(args["query"] ?? ""), {
|
|
485
632
|
principal,
|
|
633
|
+
rank: options.near,
|
|
634
|
+
// An agent's find reaches the live records unless it asks (FR-173).
|
|
635
|
+
archived: archivedFrom(args["archived"]),
|
|
486
636
|
limit: typeof args["limit"] === "number" && args["limit"] > 0 ? Math.min(args["limit"], READ_HITS) : READ_HITS,
|
|
487
637
|
...(places ? { places } : {}),
|
|
488
638
|
...(subject ? { subject, from: [subject] } : {}),
|
|
489
639
|
});
|
|
640
|
+
// The host's ranker's near hits, when it was asked: an agent waits for them, as the strip shows them when they come.
|
|
641
|
+
const found = asked.later ? await asked.later : asked;
|
|
490
642
|
return {
|
|
491
643
|
ok: true,
|
|
492
644
|
data: (await reads()).searchRead(found, markHits(found, authorship(seen, principal))),
|
|
@@ -544,6 +696,8 @@ export function createToolRuntime(store, options = {}) {
|
|
|
544
696
|
walk(said.description.parts);
|
|
545
697
|
return { ok: true, data: said.description, reads: [...reads] };
|
|
546
698
|
}
|
|
699
|
+
case "find_linked":
|
|
700
|
+
return findLinked(seen, principal, args, options.linked);
|
|
547
701
|
case "draft_view":
|
|
548
702
|
case "keep_lens": {
|
|
549
703
|
// Drawn and judged as this seat sees the app, by the engine fetched for it (FR-55).
|
|
@@ -584,6 +738,78 @@ export function createToolRuntime(store, options = {}) {
|
|
|
584
738
|
const spoken = spokenProblems(preview);
|
|
585
739
|
return { ok: true, data: named.resolved.length > 0 ? { ...spoken, resolved: named.resolved } : spoken };
|
|
586
740
|
}
|
|
741
|
+
case "act_on_several": {
|
|
742
|
+
const asked = String(args["act"] ?? "");
|
|
743
|
+
const act = actNamed(asked) ?? asked;
|
|
744
|
+
const mutation = acts.find((one) => one.name === act);
|
|
745
|
+
if (!mutation || !permitted.has(act)) {
|
|
746
|
+
const verdict = mutation ? store.permits({ name: act, args: {} }, principal) : undefined;
|
|
747
|
+
if (verdict && !verdict.ok)
|
|
748
|
+
return { ok: false, error: verdict.refusal.message, reason: "forbidden" };
|
|
749
|
+
return { ok: false, error: `There is no act "${asked}" this seat may run. Nothing was changed.`, reason: "invalid" };
|
|
750
|
+
}
|
|
751
|
+
const subject = mutation.subject;
|
|
752
|
+
if (!subject)
|
|
753
|
+
return { ok: false, error: `"${actTitle(mutation)}" does not act on a record, so it cannot be run on several. Nothing was changed.`, reason: "invalid" };
|
|
754
|
+
const given = Array.isArray(args["records"]) ? args["records"].filter((one) => typeof one === "string" && one.trim() !== "") : [];
|
|
755
|
+
if (given.length === 0)
|
|
756
|
+
return { ok: false, error: "Name at least one record. Nothing was changed.", reason: "invalid" };
|
|
757
|
+
// Each record by its id or its name (FR-33), among those this seat may see; a name that is not one record refuses the whole call.
|
|
758
|
+
const ids = [];
|
|
759
|
+
const resolved = [];
|
|
760
|
+
for (const value of given.slice(0, 200)) {
|
|
761
|
+
const found = store.resolveRef({ name: subject.arg, kinds: subject.kinds }, value, principal);
|
|
762
|
+
if (!found.ok)
|
|
763
|
+
return { ok: false, error: `${found.message} Nothing was changed.`, argument: "records", candidates: found.candidates };
|
|
764
|
+
ids.push(found.id);
|
|
765
|
+
if (found.by !== "id")
|
|
766
|
+
resolved.push({ argument: "records", given: value, id: found.id, label: found.label });
|
|
767
|
+
}
|
|
768
|
+
const shared = resolve(act, { ...(args["args"] ?? {}) });
|
|
769
|
+
if ("ok" in shared)
|
|
770
|
+
return shared;
|
|
771
|
+
const outcome = (await several()).actOnSeveral(store, { mutation: act, subject: subject.arg, args: shared.args }, ids, {
|
|
772
|
+
author: principal,
|
|
773
|
+
...viaNow(options.via),
|
|
774
|
+
});
|
|
775
|
+
const seenResult = outcome.result ? answerSeenBy(store, principal, outcome.result) : undefined;
|
|
776
|
+
return {
|
|
777
|
+
ok: true,
|
|
778
|
+
data: {
|
|
779
|
+
...(outcome.batch ? { batch: outcome.batch, intent: outcome.intent } : {}),
|
|
780
|
+
applied: outcome.applied,
|
|
781
|
+
unchanged: outcome.unchanged,
|
|
782
|
+
refused: outcome.refused.map((one) => ({ record: one.id, label: one.label, error: one.message, reason: one.reason })),
|
|
783
|
+
...(outcome.allOrNothing ? { keptNone: true } : {}),
|
|
784
|
+
...(seenResult ? { introduces: seenResult.introduces.map(withoutLine), resolves: seenResult.resolves.map(withoutLine) } : {}),
|
|
785
|
+
...(resolved.length > 0 || shared.resolved.length > 0 ? { resolved: [...resolved, ...shared.resolved] } : {}),
|
|
786
|
+
},
|
|
787
|
+
...(seenResult ? { diff: seenResult.diff } : {}),
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
case "list_suggestions": {
|
|
791
|
+
// As this seat may see them; what the actor based each on is its words, handed over as data (FR-10).
|
|
792
|
+
const waiting = suggestions(store, principal).map((one) => {
|
|
793
|
+
const by = nameOfAuthor(one.author, { graph: seen.graph, schema: store.schema });
|
|
794
|
+
return {
|
|
795
|
+
id: one.id,
|
|
796
|
+
intent: one.intent,
|
|
797
|
+
by,
|
|
798
|
+
at: one.at,
|
|
799
|
+
about: one.about,
|
|
800
|
+
...(one.lineage ? { basis: { untrusted: true, authoredBy: by, text: one.lineage.basis }, ...(one.lineage.confidence !== undefined ? { confidence: one.lineage.confidence } : {}) } : {}),
|
|
801
|
+
};
|
|
802
|
+
});
|
|
803
|
+
return { ok: true, data: { suggestions: waiting }, reads: [...new Set(waiting.flatMap((one) => one.about))] };
|
|
804
|
+
}
|
|
805
|
+
case "accept_suggestion":
|
|
806
|
+
case "decline_suggestion": {
|
|
807
|
+
const id = String(args["suggestion"] ?? "");
|
|
808
|
+
const as = { author: principal, ...viaNow(options.via) };
|
|
809
|
+
const done = definition.name === "accept_suggestion" ? acceptSuggestion(store, id, as) : declineSuggestion(store, id, as);
|
|
810
|
+
const result = answerSeenBy(store, principal, done);
|
|
811
|
+
return { ok: true, data: { batch: result.batch, intent: result.intent, introduces: result.introduces.map(withoutLine), resolves: result.resolves.map(withoutLine) }, diff: result.diff };
|
|
812
|
+
}
|
|
587
813
|
case "undo_batch": {
|
|
588
814
|
const batch = String(args["batch"]);
|
|
589
815
|
const include = args["include"] ?? [];
|