@graview/tools 0.1.0

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.
Files changed (111) hide show
  1. package/LICENSE +96 -0
  2. package/README.md +47 -0
  3. package/dist/agent/adapters.d.ts +43 -0
  4. package/dist/agent/adapters.d.ts.map +1 -0
  5. package/dist/agent/adapters.js +52 -0
  6. package/dist/agent/adapters.js.map +1 -0
  7. package/dist/agent/tools.d.ts +105 -0
  8. package/dist/agent/tools.d.ts.map +1 -0
  9. package/dist/agent/tools.js +311 -0
  10. package/dist/agent/tools.js.map +1 -0
  11. package/dist/cli.d.ts +37 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +306 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/conversation.d.ts +108 -0
  16. package/dist/conversation.d.ts.map +1 -0
  17. package/dist/conversation.js +698 -0
  18. package/dist/conversation.js.map +1 -0
  19. package/dist/decide.d.ts +43 -0
  20. package/dist/decide.d.ts.map +1 -0
  21. package/dist/decide.js +125 -0
  22. package/dist/decide.js.map +1 -0
  23. package/dist/derive.d.ts +84 -0
  24. package/dist/derive.d.ts.map +1 -0
  25. package/dist/derive.js +302 -0
  26. package/dist/derive.js.map +1 -0
  27. package/dist/edit.d.ts +70 -0
  28. package/dist/edit.d.ts.map +1 -0
  29. package/dist/edit.js +97 -0
  30. package/dist/edit.js.map +1 -0
  31. package/dist/figure.d.ts +53 -0
  32. package/dist/figure.d.ts.map +1 -0
  33. package/dist/figure.js +86 -0
  34. package/dist/figure.js.map +1 -0
  35. package/dist/index.d.ts +44 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +31 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/intelligence.d.ts +132 -0
  40. package/dist/intelligence.d.ts.map +1 -0
  41. package/dist/intelligence.js +463 -0
  42. package/dist/intelligence.js.map +1 -0
  43. package/dist/local.d.ts +192 -0
  44. package/dist/local.d.ts.map +1 -0
  45. package/dist/local.js +365 -0
  46. package/dist/local.js.map +1 -0
  47. package/dist/loop.d.ts +84 -0
  48. package/dist/loop.d.ts.map +1 -0
  49. package/dist/loop.js +173 -0
  50. package/dist/loop.js.map +1 -0
  51. package/dist/mcp-stdio.d.ts +38 -0
  52. package/dist/mcp-stdio.d.ts.map +1 -0
  53. package/dist/mcp-stdio.js +83 -0
  54. package/dist/mcp-stdio.js.map +1 -0
  55. package/dist/pins.d.ts +29 -0
  56. package/dist/pins.d.ts.map +1 -0
  57. package/dist/pins.js +60 -0
  58. package/dist/pins.js.map +1 -0
  59. package/dist/plan.d.ts +150 -0
  60. package/dist/plan.d.ts.map +1 -0
  61. package/dist/plan.js +303 -0
  62. package/dist/plan.js.map +1 -0
  63. package/dist/providers/insight.d.ts +14 -0
  64. package/dist/providers/insight.d.ts.map +1 -0
  65. package/dist/providers/insight.js +81 -0
  66. package/dist/providers/insight.js.map +1 -0
  67. package/dist/providers/invariant.d.ts +14 -0
  68. package/dist/providers/invariant.d.ts.map +1 -0
  69. package/dist/providers/invariant.js +123 -0
  70. package/dist/providers/invariant.js.map +1 -0
  71. package/dist/providers/jev.d.ts +115 -0
  72. package/dist/providers/jev.d.ts.map +1 -0
  73. package/dist/providers/jev.js +148 -0
  74. package/dist/providers/jev.js.map +1 -0
  75. package/dist/providers/lens.d.ts +24 -0
  76. package/dist/providers/lens.d.ts.map +1 -0
  77. package/dist/providers/lens.js +36 -0
  78. package/dist/providers/lens.js.map +1 -0
  79. package/dist/providers/llm.d.ts +25 -0
  80. package/dist/providers/llm.d.ts.map +1 -0
  81. package/dist/providers/llm.js +44 -0
  82. package/dist/providers/llm.js.map +1 -0
  83. package/dist/providers/schema.d.ts +12 -0
  84. package/dist/providers/schema.d.ts.map +1 -0
  85. package/dist/providers/schema.js +508 -0
  86. package/dist/providers/schema.js.map +1 -0
  87. package/dist/providers/structure.d.ts +14 -0
  88. package/dist/providers/structure.d.ts.map +1 -0
  89. package/dist/providers/structure.js +211 -0
  90. package/dist/providers/structure.js.map +1 -0
  91. package/dist/questions.d.ts +162 -0
  92. package/dist/questions.d.ts.map +1 -0
  93. package/dist/questions.js +316 -0
  94. package/dist/questions.js.map +1 -0
  95. package/dist/run.d.ts +202 -0
  96. package/dist/run.d.ts.map +1 -0
  97. package/dist/run.js +453 -0
  98. package/dist/run.js.map +1 -0
  99. package/dist/space.d.ts +50 -0
  100. package/dist/space.d.ts.map +1 -0
  101. package/dist/space.js +55 -0
  102. package/dist/space.js.map +1 -0
  103. package/dist/types.d.ts +122 -0
  104. package/dist/types.d.ts.map +1 -0
  105. package/dist/types.js +2 -0
  106. package/dist/types.js.map +1 -0
  107. package/dist/usage.d.ts +10 -0
  108. package/dist/usage.d.ts.map +1 -0
  109. package/dist/usage.js +59 -0
  110. package/dist/usage.js.map +1 -0
  111. package/package.json +61 -0
@@ -0,0 +1,508 @@
1
+ import { argShape, humaniseField, nodeRefArgs, nounOf, withArticle } from "@graview/core";
2
+ const BASE_SCORE = 40;
3
+ /**
4
+ * Which typed mutations are legal across the WHOLE selection.
5
+ *
6
+ * The declaration already says which kinds a mutation acts on and which
7
+ * argument the subject binds to, so "all three selected nodes are duties, and
8
+ * reassign acts on duties" is a fact the schema can answer — no per-selection
9
+ * code, and a new node kind gets its affordances the moment it is declared.
10
+ */
11
+ export function schemaProvider() {
12
+ return {
13
+ name: "schema",
14
+ derive({ store, selection, nodes, kindSelection, edgeSelection }) {
15
+ const affordances = [];
16
+ /*
17
+ * A selected LINE asks "what may be done to this relation". Mutations
18
+ * declare the edge kinds they make and break; endpoints prefill by
19
+ * matching each node-reference argument's accepted kinds against the
20
+ * edge's real ends — derived, never wired, and ambiguous matches stay
21
+ * open questions rather than guesses.
22
+ */
23
+ if (nodes.length === 0 && edgeSelection.length > 0) {
24
+ for (const edge of edgeSelection) {
25
+ const fromNode = store.graph.getNode(edge.from);
26
+ const toNode = store.graph.getNode(edge.to);
27
+ if (!fromNode || !toNode)
28
+ continue;
29
+ for (const mutation of store.allMutations()) {
30
+ const makes = (mutation.connects ?? []).includes(edge.kind);
31
+ const breaks = (mutation.severs ?? []).includes(edge.kind);
32
+ if (!makes && !breaks)
33
+ continue;
34
+ const args = {};
35
+ const open = [];
36
+ const refs = nodeRefArgs(mutation.input);
37
+ for (const ref of refs) {
38
+ const takesFrom = ref.kinds.includes("*") || ref.kinds.includes(fromNode.kind);
39
+ const takesTo = ref.kinds.includes("*") || ref.kinds.includes(toNode.kind);
40
+ const fromOnly = takesFrom && !refs.some((other) => other !== ref && (other.kinds.includes(fromNode.kind) || other.kinds.includes("*")));
41
+ // Prefill only the unambiguous end; two arguments accepting
42
+ // the same kind stay open with candidates.
43
+ if (takesFrom && !takesTo)
44
+ args[ref.name] = edge.from;
45
+ else if (takesTo && !takesFrom)
46
+ args[ref.name] = edge.to;
47
+ else if (takesFrom && takesTo && fromOnly)
48
+ args[ref.name] = edge.from;
49
+ else {
50
+ // Ambiguity on a LINE resolves to the line: the only honest
51
+ // candidates for "break this" are this line's own two ends —
52
+ // a graph-wide picker here could sever an unrelated pair.
53
+ open.push({
54
+ name: ref.name,
55
+ kinds: ref.kinds,
56
+ candidates: [edge.from, edge.to],
57
+ shape: argShape(mutation.input, ref.name),
58
+ });
59
+ }
60
+ }
61
+ for (const name of otherRequiredArgs(mutation.input, "")) {
62
+ if (name in args || open.some((parameter) => parameter.name === name))
63
+ continue;
64
+ open.push({ name, shape: argShape(mutation.input, name) });
65
+ }
66
+ const askable = open.every((parameter) => parameter.optional === true
67
+ ? true
68
+ : parameter.kinds !== undefined
69
+ ? (parameter.candidates?.length ?? 0) > 0
70
+ : (parameter.candidates?.length ?? 0) > 0 ||
71
+ (parameter.shape !== undefined && parameter.shape.type !== "unknown"));
72
+ if (!askable)
73
+ continue;
74
+ /*
75
+ * A LINE DOES NOT OFFER THE ACT THAT WOULD MAKE IT.
76
+ *
77
+ * Both ends come from the line, so a mutation that only makes
78
+ * this edge kind arrives with nothing left to ask and nothing
79
+ * left to change: the relation it would create is the one you
80
+ * selected. Pressed, it was a one-press button that appeared to
81
+ * do nothing — and did do something, writing a second identical
82
+ * op into the history, undoable, describing a change that never
83
+ * happened.
84
+ *
85
+ * A make with a question still open is a different act (connect
86
+ * this end to something else), and a mutation that also breaks
87
+ * the kind is a move. Both stay.
88
+ */
89
+ if (makes && !breaks && open.length === 0)
90
+ continue;
91
+ affordances.push({
92
+ id: `schema:edge:${mutation.name}:${edge.kind}:${edge.from}:${edge.to}`,
93
+ label: mutation.title ?? mutation.name,
94
+ provider: "schema",
95
+ mutation: mutation.name,
96
+ args,
97
+ open,
98
+ ...(mutation.destructive ? { destructive: true } : {}),
99
+ // A break offered on the line itself outranks a make; both sit
100
+ // between plain schema actions and repairs.
101
+ score: (breaks ? 62 : 58) - open.length,
102
+ why: `this line is "${store.schema.edge(edge.kind)?.description ?? edge.kind.replace(/[-_]+/g, " ")}"`,
103
+ nodeIds: [edge.from, edge.to],
104
+ });
105
+ }
106
+ }
107
+ return { affordances };
108
+ }
109
+ /*
110
+ * A selected KIND — a card, a district — asks a different question
111
+ * from a selected node: not "what can I do with this" but "how does
112
+ * the first one get here". Mutations declare what they create, so an
113
+ * empty kind card offers its own beginnings — which is the whole
114
+ * onboarding path of a blank graph, one derived affordance at a time.
115
+ */
116
+ if (nodes.length === 0 && kindSelection.length > 0) {
117
+ const wanted = new Set(kindSelection);
118
+ const observations = [];
119
+ for (const mutation of store.allMutations()) {
120
+ if (!(mutation.creates ?? []).some((kind) => wanted.has(kind)))
121
+ continue;
122
+ const open = [];
123
+ for (const ref of nodeRefArgs(mutation.input)) {
124
+ const candidates = ref.kinds.includes("*")
125
+ ? store.graph.allNodes().map((node) => node.id)
126
+ : ref.kinds.flatMap((kind) => store.graph.nodesOfKind(kind).map((node) => node.id));
127
+ open.push({
128
+ name: ref.name,
129
+ kinds: ref.kinds,
130
+ candidates,
131
+ shape: argShape(mutation.input, ref.name),
132
+ ...(ref.optional ? { optional: true } : {}),
133
+ });
134
+ }
135
+ for (const name of otherRequiredArgs(mutation.input, "")) {
136
+ if (open.some((parameter) => parameter.name === name))
137
+ continue;
138
+ open.push({ name, shape: argShape(mutation.input, name) });
139
+ }
140
+ const askable = open.every((parameter) => parameter.optional === true
141
+ ? true
142
+ : parameter.kinds !== undefined
143
+ ? // A node reference is only askable when real nodes exist to
144
+ // pick — "sow into which plot?" has no honest answer at zero
145
+ // plots, so the button waits for the first plot instead.
146
+ (parameter.candidates?.length ?? 0) > 0
147
+ : (parameter.candidates?.length ?? 0) > 0 ||
148
+ (parameter.shape !== undefined && parameter.shape.type !== "unknown"));
149
+ /*
150
+ * AN ACT WITHHELD FOR WANT OF A CANDIDATE IS NOT AN ACT THAT DOES
151
+ * NOT EXIST, and the difference is the whole onboarding of a blank
152
+ * graph.
153
+ *
154
+ * "creates: [kind] means an empty kind card offers its own
155
+ * beginnings" holds for the kinds at the ROOT of the dependency
156
+ * chain and stops there — because in any real domain almost every
157
+ * creating act connects to something, and an act that needs a zone
158
+ * cannot act when there are no zones. The derivation is right to
159
+ * withhold it; a form with an empty picker is worse than nothing.
160
+ *
161
+ * What was wrong is that it said nothing. A person meets eight
162
+ * districts, one of which offers a way in, and no explanation for
163
+ * the other seven. The unsatisfied argument already names the kind
164
+ * it wants, so the district can say it in the declaration's own
165
+ * words — and it is an observation rather than an action, because
166
+ * there is nothing to press yet.
167
+ */
168
+ if (!askable) {
169
+ const waiting = open.filter((parameter) => parameter.optional !== true &&
170
+ parameter.kinds !== undefined &&
171
+ !parameter.kinds.includes("*") &&
172
+ (parameter.candidates?.length ?? 0) === 0);
173
+ if (waiting.length > 0) {
174
+ const wants = [
175
+ ...new Set(waiting.flatMap((parameter) => parameter.kinds ?? [])),
176
+ ].map((kind) => withArticle(nounOf(store.schema.tryDefinition(kind), kind)));
177
+ observations.push({
178
+ id: `schema:waits:${mutation.name}`,
179
+ text: `"${mutation.title ?? mutation.name}" cannot begin until there is ${wants.length === 1
180
+ ? wants[0]
181
+ : `${wants.slice(0, -1).join(", ")} and ${wants[wants.length - 1]}`}.`,
182
+ nodeIds: [],
183
+ });
184
+ }
185
+ continue;
186
+ }
187
+ affordances.push({
188
+ id: `schema:add:${mutation.name}`,
189
+ label: mutation.title ?? mutation.name,
190
+ provider: "schema",
191
+ mutation: mutation.name,
192
+ args: {},
193
+ open,
194
+ score: BASE_SCORE - open.length,
195
+ why: `this makes ${(mutation.creates ?? [])
196
+ .filter((kind) => wanted.has(kind))
197
+ .map((kind) => withArticle(nounOf(store.schema.tryDefinition(kind), kind)))
198
+ .join(", ")}`,
199
+ nodeIds: [],
200
+ });
201
+ }
202
+ return { affordances, observations };
203
+ }
204
+ if (nodes.length === 0)
205
+ return {};
206
+ const kinds = new Set(nodes.map((node) => node.kind));
207
+ /*
208
+ * CANDIDATES KNOW THE SUBJECT. A mutation that declares the edge
209
+ * kinds it severs is answerable from the graph: "take someone off
210
+ * it" offered on a run should offer the people ON that run — all
211
+ * five people is a lie four-fifths of the time — and offered with
212
+ * nobody aboard it should not be offered at all. `connects` narrows
213
+ * the other way: no offering to add who is already on.
214
+ */
215
+ const across = (subjectId, edgeKinds, wantKinds) => {
216
+ const found = [];
217
+ for (const edge of store.graph.allEdges()) {
218
+ if (!edgeKinds.includes(edge.kind))
219
+ continue;
220
+ const other = edge.from === subjectId ? edge.to : edge.to === subjectId ? edge.from : null;
221
+ if (!other)
222
+ continue;
223
+ const node = store.graph.getNode(other);
224
+ if (!node)
225
+ continue;
226
+ if (!wantKinds.includes("*") && !wantKinds.includes(node.kind))
227
+ continue;
228
+ if (!found.includes(other))
229
+ found.push(other);
230
+ }
231
+ return found;
232
+ };
233
+ for (const mutation of store.allMutations()) {
234
+ const subject = mutation.subject;
235
+ if (!subject)
236
+ continue;
237
+ const accepted = subject.kinds === "*"
238
+ ? true
239
+ : [...kinds].every((kind) => subject.kinds.includes(kind));
240
+ if (!accepted)
241
+ continue;
242
+ const subjectId = nodes.length === 1 ? nodes[0].id : null;
243
+ const severs = mutation.severs ?? [];
244
+ const connects = mutation.connects ?? [];
245
+ /*
246
+ * A PURE severing act with nothing attached is not an offer —
247
+ * "Restore one occurrence" with nothing skipped was a button that
248
+ * could only fail. A mutation that BOTH makes and breaks is a
249
+ * move/handover: it is exactly what an unattached subject needs,
250
+ * so it is never gated on attachment.
251
+ */
252
+ if (subjectId &&
253
+ severs.length > 0 &&
254
+ connects.length === 0 &&
255
+ across(subjectId, severs, ["*"]).length === 0) {
256
+ continue;
257
+ }
258
+ const open = [];
259
+ for (const ref of nodeRefArgs(mutation.input)) {
260
+ if (ref.name === subject.arg)
261
+ continue;
262
+ let candidates = ref.kinds.includes("*")
263
+ ? store.graph.allNodes().map((node) => node.id)
264
+ : ref.kinds.flatMap((kind) => store.graph.nodesOfKind(kind).map((node) => node.id));
265
+ if (subjectId && connects.length > 0) {
266
+ /*
267
+ * Anything that CONNECTS offers only who is not already on —
268
+ * including a move (connects + severs), whose whole point is
269
+ * someone NEW. Reading severs first here offered "Reassign
270
+ * run" a list containing exactly the current assignee.
271
+ */
272
+ const already = new Set(across(subjectId, connects, ref.kinds));
273
+ candidates = candidates.filter((id) => !already.has(id));
274
+ }
275
+ else if (subjectId && severs.length > 0) {
276
+ // A pure severing act reaches only what is actually attached.
277
+ candidates = across(subjectId, severs, ref.kinds);
278
+ }
279
+ open.push({
280
+ name: ref.name,
281
+ kinds: ref.kinds,
282
+ // Offering real ids is what turns "reassign" into "reassign to
283
+ // whom" without anyone wiring up a picker per mutation.
284
+ candidates: candidates.filter((id) => !selection.includes(id)),
285
+ shape: argShape(mutation.input, ref.name),
286
+ ...(ref.optional ? { optional: true } : {}),
287
+ });
288
+ }
289
+ for (const name of otherRequiredArgs(mutation.input, subject.arg)) {
290
+ if (open.some((parameter) => parameter.name === name))
291
+ continue;
292
+ open.push({ name, shape: argShape(mutation.input, name) });
293
+ }
294
+ /*
295
+ * A ONE-PRESS ACT MUST BE ABLE TO ACT. An action with nothing
296
+ * required left to ask is offered as a single press — and pressed
297
+ * with only its subject, a derived edit whose every field is
298
+ * optional refused: "Nothing to change — give at least one of
299
+ * label a value", said on the button. Its inputs were inputs all
300
+ * along; being optional made them askable one at a time, not
301
+ * unnecessary. So an action that needs nothing more is rehearsed
302
+ * with what it has, and one that would refuse asks for its optional
303
+ * arguments instead, each of which may be skipped.
304
+ */
305
+ if (open.length === 0 && subjectId) {
306
+ const optionalArgs = otherOptionalArgs(mutation.input, subject.arg);
307
+ if (optionalArgs.length > 0 && !rehearses(store, mutation.name, { [subject.arg]: subjectId })) {
308
+ for (const name of optionalArgs) {
309
+ const ref = nodeRefArgs(mutation.input).find((candidate) => candidate.name === name);
310
+ open.push({
311
+ name,
312
+ optional: true,
313
+ ...(ref ? { kinds: ref.kinds } : {}),
314
+ shape: argShape(mutation.input, name),
315
+ });
316
+ }
317
+ }
318
+ }
319
+ /*
320
+ * Only actions the interface can actually ASK FOR.
321
+ *
322
+ * An open argument with no candidates and no scalar shape — a
323
+ * structured object, say — has no honest prompt: the strip offered a
324
+ * text box whose every answer failed validation, which read as a
325
+ * button that does nothing. The mutation still exists and an agent
326
+ * supplies structured arguments natively; it is just not a button.
327
+ * Invariant repairs are unaffected — a rule that names a repair has
328
+ * already decided it is offerable.
329
+ */
330
+ const askable = open.every((parameter) => parameter.optional === true
331
+ ? true
332
+ : parameter.kinds !== undefined
333
+ ? (parameter.candidates?.length ?? 0) > 0
334
+ : (parameter.candidates?.length ?? 0) > 0 ||
335
+ (parameter.shape !== undefined && parameter.shape.type !== "unknown"));
336
+ if (!askable)
337
+ continue;
338
+ const batch = nodes.map((node) => ({ [subject.arg]: node.id }));
339
+ /*
340
+ * AN ACT WITH NOTHING LEFT TO ASK MUST HAVE SOMETHING LEFT TO DO.
341
+ *
342
+ * One press, no arguments, and the mutation compiles to no
343
+ * primitives: "Close it" offered on something already closed. It was
344
+ * offered, pressed, and nothing happened — except a line in the
345
+ * activity rail claiming it had. Only asked where there is nothing
346
+ * left to ask, because an act still holding a question has not been
347
+ * decided yet, and only of the batch, so a selection of five where
348
+ * one is still open keeps the offer.
349
+ */
350
+ if (open.length === 0 && !batch.some((args) => store.wouldChange({ name: mutation.name, args }))) {
351
+ continue;
352
+ }
353
+ affordances.push({
354
+ id: `schema:${mutation.name}`,
355
+ label: nodes.length > 1
356
+ ? `${mutation.title ?? mutation.name} (${nodes.length})`
357
+ : (mutation.title ?? mutation.name),
358
+ provider: "schema",
359
+ mutation: mutation.name,
360
+ args: batch[0] ?? {},
361
+ open,
362
+ ...(mutation.destructive ? { destructive: true } : {}),
363
+ ...(severs.length > 0 || connects.length > 0 ? { ties: true } : {}),
364
+ ...(nodes.length > 1 ? { batch } : {}),
365
+ // A mutation needing nothing more is readier than one needing three
366
+ // more answers, so it should surface above it.
367
+ score: BASE_SCORE - open.length,
368
+ why: nodes.length > 1
369
+ ? `all ${nodes.length} selected nodes are ${[...kinds]
370
+ .map((kind) => (store.schema.tryDefinition(kind)?.plural ?? humaniseField(kind)).toLowerCase())
371
+ .join(" or ")}`
372
+ : `this is ${withArticle(nounOf(store.schema.tryDefinition(nodes[0].kind), nodes[0].kind))}`,
373
+ nodeIds: nodes.map((node) => node.id),
374
+ });
375
+ }
376
+ /*
377
+ * THE OTHER END OF THE TIE. "Take someone off it" declares a duty as
378
+ * its subject, but the person standing in a run's own view is the
379
+ * natural place to say "take THIS one off" — and the only offers there
380
+ * used to be rename and a destructive remove, which is how deleting a
381
+ * child from the household got clicked meaning "off this run". A
382
+ * mutation that declares what it severs or connects is offerable from
383
+ * either endpoint: the selected node fills its matching argument, and
384
+ * the subject's candidates come from the actual edges.
385
+ */
386
+ if (nodes.length === 1) {
387
+ const chosen = nodes[0];
388
+ for (const mutation of store.allMutations()) {
389
+ const subject = mutation.subject;
390
+ const severs = mutation.severs ?? [];
391
+ const connects = mutation.connects ?? [];
392
+ if (!subject || (severs.length === 0 && connects.length === 0))
393
+ continue;
394
+ // Already offered the ordinary way when the selection IS the subject.
395
+ const subjectAccepts = subject.kinds === "*" ? "*" : subject.kinds;
396
+ if (subjectAccepts === "*" || subjectAccepts.includes(chosen.kind)) {
397
+ continue;
398
+ }
399
+ const refs = nodeRefArgs(mutation.input);
400
+ const mine = refs.find((ref) => ref.name !== subject.arg &&
401
+ (ref.kinds.includes("*") || ref.kinds.includes(chosen.kind)));
402
+ if (!mine)
403
+ continue;
404
+ // Narrowed by the continue above: the subject names concrete kinds.
405
+ const subjectKinds = subjectAccepts;
406
+ const pool = subjectKinds.includes("*")
407
+ ? store.graph.allNodes().map((node) => node.id)
408
+ : subjectKinds.flatMap((kind) => store.graph.nodesOfKind(kind).map((node) => node.id));
409
+ // Same rule as the forward direction: a move offers the NEW
410
+ // (everything not already tied), a pure sever offers the tied.
411
+ const attached = new Set(across(chosen.id, connects.length > 0 ? connects : severs, subjectKinds));
412
+ const subjectCandidates = connects.length > 0
413
+ ? pool.filter((id) => !attached.has(id))
414
+ : pool.filter((id) => attached.has(id));
415
+ if (subjectCandidates.length === 0)
416
+ continue;
417
+ const open = [
418
+ {
419
+ name: subject.arg,
420
+ kinds: subjectKinds,
421
+ candidates: subjectCandidates,
422
+ shape: argShape(mutation.input, subject.arg),
423
+ },
424
+ ];
425
+ for (const ref of refs) {
426
+ if (ref.name === mine.name || ref.name === subject.arg)
427
+ continue;
428
+ const pool = ref.kinds.includes("*")
429
+ ? store.graph.allNodes().map((node) => node.id)
430
+ : ref.kinds.flatMap((kind) => store.graph.nodesOfKind(kind).map((node) => node.id));
431
+ open.push({
432
+ name: ref.name,
433
+ kinds: ref.kinds,
434
+ candidates: pool,
435
+ shape: argShape(mutation.input, ref.name),
436
+ ...(ref.optional ? { optional: true } : {}),
437
+ });
438
+ }
439
+ for (const name of otherRequiredArgs(mutation.input, mine.name)) {
440
+ if (name === subject.arg || open.some((parameter) => parameter.name === name))
441
+ continue;
442
+ open.push({ name, shape: argShape(mutation.input, name) });
443
+ }
444
+ const askable = open.every((parameter) => parameter.optional === true
445
+ ? true
446
+ : parameter.kinds !== undefined
447
+ ? (parameter.candidates?.length ?? 0) > 0
448
+ : (parameter.candidates?.length ?? 0) > 0 ||
449
+ (parameter.shape !== undefined && parameter.shape.type !== "unknown"));
450
+ if (!askable)
451
+ continue;
452
+ affordances.push({
453
+ id: `schema:tie:${mutation.name}:${chosen.id}`,
454
+ /*
455
+ * THE FAR END'S OWN WORDS. `title` is written from the subject's
456
+ * side — "Hand it to someone", offered on the person, read as
457
+ * handing the person to someone. `fromTheOtherEnd` is the act's
458
+ * reading from here; without it the near-end title is all there
459
+ * is, and `graview check` says so by name.
460
+ */
461
+ label: mutation.fromTheOtherEnd ?? mutation.title ?? mutation.name,
462
+ provider: "schema",
463
+ mutation: mutation.name,
464
+ args: { [mine.name]: chosen.id },
465
+ open,
466
+ ties: true,
467
+ ...(mutation.destructive ? { destructive: true } : {}),
468
+ score: BASE_SCORE - open.length + 2,
469
+ why: `${severs.length > 0 ? "this one is on" : "this one could join"} ${open[0].candidates.length === 1 ? "it" : "one of these"}`,
470
+ nodeIds: [chosen.id],
471
+ });
472
+ }
473
+ }
474
+ return { affordances };
475
+ },
476
+ };
477
+ }
478
+ /** Required input fields that are not node references and not the subject. */
479
+ /** The arguments the input would accept unanswered, the subject aside. */
480
+ function otherOptionalArgs(input, subjectArg) {
481
+ const shape = input
482
+ .shape;
483
+ if (!shape)
484
+ return [];
485
+ return Object.entries(shape)
486
+ .filter(([name, field]) => name !== subjectArg && field.safeParse(undefined).success)
487
+ .map(([name]) => name);
488
+ }
489
+ /** Whether the mutation, called with exactly these arguments, would go through. */
490
+ function rehearses(store, name, args) {
491
+ try {
492
+ store.preview({ name, args });
493
+ return true;
494
+ }
495
+ catch {
496
+ return false;
497
+ }
498
+ }
499
+ function otherRequiredArgs(input, subjectArg) {
500
+ const shape = input
501
+ .shape;
502
+ if (!shape)
503
+ return [];
504
+ return Object.entries(shape)
505
+ .filter(([name, field]) => name !== subjectArg && !field.safeParse(undefined).success)
506
+ .map(([name]) => name);
507
+ }
508
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc,EAAE,UAAkB;IAC3D,MAAM,KAAK,GAAI,KAAyF;SACrG,KAAK,CAAC;IACT,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SACzB,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;SACrF,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type AnySchema } from "@graview/core";
2
+ import type { AffordanceProvider } from "../types.js";
3
+ /**
4
+ * What is TRUE about this selection, and what that makes worth doing.
5
+ *
6
+ * Nothing here knows what a duty or a person is. It notices shared
7
+ * neighbours, agreement on a field, and the one node that breaks the
8
+ * agreement — then looks for a declared mutation that could resolve the
9
+ * difference. "Move the Wednesday run to Tuesday like the other three" comes
10
+ * out of this without anyone writing a rule about days, because the schema
11
+ * already said which mutation writes that field.
12
+ */
13
+ export declare function structureProvider<S extends AnySchema>(): AffordanceProvider<S>;
14
+ //# sourceMappingURL=structure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../src/providers/structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,KAAK,SAAS,EAAqB,MAAM,eAAe,CAAC;AACpH,OAAO,KAAK,EAAc,kBAAkB,EAAe,MAAM,aAAa,CAAC;AAO/E;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,SAAS,KAAK,kBAAkB,CAAC,CAAC,CAAC,CA+K9E"}