@graview/tools 0.1.47 → 0.1.49

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 (104) hide show
  1. package/README.md +31 -0
  2. package/dist/agent/tools.d.ts +5 -2
  3. package/dist/agent/tools.d.ts.map +1 -1
  4. package/dist/agent/tools.js +63 -16
  5. package/dist/agent/tools.js.map +1 -1
  6. package/dist/ai.d.ts +1 -1
  7. package/dist/ai.d.ts.map +1 -1
  8. package/dist/cli.d.ts +3 -0
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/cli.js +87 -1
  11. package/dist/cli.js.map +1 -1
  12. package/dist/conversation.js +2 -2
  13. package/dist/conversation.js.map +1 -1
  14. package/dist/decide.d.ts +1 -1
  15. package/dist/decide.d.ts.map +1 -1
  16. package/dist/decide.js +2 -2
  17. package/dist/decide.js.map +1 -1
  18. package/dist/derive.d.ts.map +1 -1
  19. package/dist/derive.js +8 -1
  20. package/dist/derive.js.map +1 -1
  21. package/dist/dev-ai.d.ts +2 -1
  22. package/dist/dev-ai.d.ts.map +1 -1
  23. package/dist/dev-ai.js +8 -6
  24. package/dist/dev-ai.js.map +1 -1
  25. package/dist/draft.d.ts +3 -1
  26. package/dist/draft.d.ts.map +1 -1
  27. package/dist/draft.js +9 -8
  28. package/dist/draft.js.map +1 -1
  29. package/dist/fast.d.ts +44 -0
  30. package/dist/fast.d.ts.map +1 -0
  31. package/dist/fast.js +2 -0
  32. package/dist/fast.js.map +1 -0
  33. package/dist/figure.js +1 -1
  34. package/dist/figure.js.map +1 -1
  35. package/dist/index.d.ts +3 -2
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/inline-ai.d.ts.map +1 -1
  39. package/dist/inline-ai.js +1 -1
  40. package/dist/inline-ai.js.map +1 -1
  41. package/dist/intelligence.d.ts +32 -2
  42. package/dist/intelligence.d.ts.map +1 -1
  43. package/dist/intelligence.js +3 -3
  44. package/dist/intelligence.js.map +1 -1
  45. package/dist/keep.d.ts.map +1 -1
  46. package/dist/keep.js +8 -3
  47. package/dist/keep.js.map +1 -1
  48. package/dist/local.d.ts +1 -1
  49. package/dist/local.d.ts.map +1 -1
  50. package/dist/local.js +23 -18
  51. package/dist/local.js.map +1 -1
  52. package/dist/loop.d.ts +1 -1
  53. package/dist/loop.d.ts.map +1 -1
  54. package/dist/loop.js.map +1 -1
  55. package/dist/providers/jev.d.ts +1 -36
  56. package/dist/providers/jev.d.ts.map +1 -1
  57. package/dist/providers/jev.js.map +1 -1
  58. package/dist/questions.js +2 -2
  59. package/dist/questions.js.map +1 -1
  60. package/dist/run.d.ts +1 -1
  61. package/dist/run.d.ts.map +1 -1
  62. package/dist/seat-model.js +3 -3
  63. package/dist/seat-model.js.map +1 -1
  64. package/dist/suggest.d.ts +8 -8
  65. package/dist/suggest.d.ts.map +1 -1
  66. package/dist/suggest.js +2 -2
  67. package/dist/suggest.js.map +1 -1
  68. package/dist/tidy/asking.d.ts +51 -0
  69. package/dist/tidy/asking.d.ts.map +1 -0
  70. package/dist/tidy/asking.js +86 -0
  71. package/dist/tidy/asking.js.map +1 -0
  72. package/dist/tidy/away.d.ts +24 -0
  73. package/dist/tidy/away.d.ts.map +1 -0
  74. package/dist/tidy/away.js +24 -0
  75. package/dist/tidy/away.js.map +1 -0
  76. package/dist/tidy/blocking.d.ts +82 -0
  77. package/dist/tidy/blocking.d.ts.map +1 -0
  78. package/dist/tidy/blocking.js +260 -0
  79. package/dist/tidy/blocking.js.map +1 -0
  80. package/dist/tidy/dream.d.ts +117 -0
  81. package/dist/tidy/dream.d.ts.map +1 -0
  82. package/dist/tidy/dream.js +178 -0
  83. package/dist/tidy/dream.js.map +1 -0
  84. package/dist/tidy/judges.d.ts +109 -0
  85. package/dist/tidy/judges.d.ts.map +1 -0
  86. package/dist/tidy/judges.js +282 -0
  87. package/dist/tidy/judges.js.map +1 -0
  88. package/dist/tidy/judging.d.ts +51 -0
  89. package/dist/tidy/judging.d.ts.map +1 -0
  90. package/dist/tidy/judging.js +243 -0
  91. package/dist/tidy/judging.js.map +1 -0
  92. package/dist/tidy/policy.d.ts +18 -0
  93. package/dist/tidy/policy.d.ts.map +1 -0
  94. package/dist/tidy/policy.js +29 -0
  95. package/dist/tidy/policy.js.map +1 -0
  96. package/dist/tidy/system-one.d.ts +40 -0
  97. package/dist/tidy/system-one.d.ts.map +1 -0
  98. package/dist/tidy/system-one.js +49 -0
  99. package/dist/tidy/system-one.js.map +1 -0
  100. package/dist/tidy.d.ts +8 -0
  101. package/dist/tidy.d.ts.map +1 -0
  102. package/dist/tidy.js +23 -0
  103. package/dist/tidy.js.map +1 -0
  104. package/package.json +7 -3
@@ -0,0 +1,282 @@
1
+ import { isArchived, isCurrent, isLeftAlone, labelOf, nameKey, nodeRefArgs, nounOf } from "@graview/core";
2
+ import { districtState } from "@graview/core/city";
3
+ import { fold } from "@graview/core/search";
4
+ import { tidyingOf } from "@graview/core/tidying";
5
+ const DAY = 24 * 60 * 60 * 1000;
6
+ /** Whether the actor may propose anything about this record: not left alone, not changed lately, its kind tidied. */
7
+ export function mayTouch(context, node) {
8
+ if (isLeftAlone(context.store, node.id) || isArchived(node))
9
+ return false;
10
+ if (tidyingOf(context.store.schema, node.kind) === "never")
11
+ return false;
12
+ const last = context.touched.get(node.id);
13
+ return last === undefined || context.now - last >= context.quietFor;
14
+ }
15
+ /** A kind's acts as the store holds them, by name. */
16
+ export const actNamed = (store, name) => store.allMutations().find((act) => act.name === name);
17
+ export const named = (schema, node) => labelOf(schema.tryDefinition(node.kind), node);
18
+ export const noun = (schema, kind) => nounOf(schema.tryDefinition(kind), kind);
19
+ export const fieldsOf = (schema, kind) => Object.keys((schema.tryDefinition(kind)?.fields.shape ?? {}));
20
+ /** Fields whose value names one thing and only that thing: two records that share one are the same. */
21
+ export const KEY_FIELD = /^(e-?mail|email-?address|code|sku|reference|ref|external-?id|key)$/i;
22
+ /** The one of several that stays: the one with the most links and history, else the first made. */
23
+ export function keeperOf(store, nodes, touched) {
24
+ const weight = (node) => store.graph.out(node.id).length + store.graph.in(node.id).length;
25
+ return [...nodes].sort((a, b) => weight(b) - weight(a) || (touched.get(a.id) ?? 0) - (touched.get(b.id) ?? 0))[0];
26
+ }
27
+ /**
28
+ * DUPLICATES → MERGE. Records of one kind that share a name — case,
29
+ * accents and spacing aside, as an import matches a row to its record
30
+ * (`nameKey`) — or a key a record has only one of (an email, a code). The
31
+ * one with the most links stays; each other is merged into it
32
+ * (`merge-<kind>`). An exact name is surer than one that matches only with
33
+ * its punctuation aside; a shared key is surest.
34
+ */
35
+ export const duplicates = {
36
+ name: "duplicates",
37
+ severity: "merge",
38
+ judge(context) {
39
+ const { store } = context;
40
+ const schema = store.schema;
41
+ const out = [];
42
+ for (const definition of schema.definitions) {
43
+ const kind = definition.kind;
44
+ if (definition.archives === false || !actNamed(store, `merge-${kind}`))
45
+ continue;
46
+ const records = store.graph.nodesOfKind(kind);
47
+ const keys = fieldsOf(schema, kind).filter((field) => KEY_FIELD.test(field));
48
+ const merged = new Set();
49
+ const groups = [];
50
+ const group = (key, basis, confidence) => {
51
+ const by = new Map();
52
+ for (const node of records) {
53
+ if (merged.has(node.id))
54
+ continue;
55
+ const value = key(node);
56
+ if (value)
57
+ by.set(value, [...(by.get(value) ?? []), node]);
58
+ }
59
+ for (const [value, nodes] of by)
60
+ if (nodes.length > 1) {
61
+ groups.push({ nodes, basis: (keeper) => basis(keeper, value), confidence });
62
+ for (const node of nodes)
63
+ merged.add(node.id);
64
+ }
65
+ };
66
+ for (const field of keys) {
67
+ group((node) => (typeof node[field] === "string" && node[field].trim() ? nameKey(node[field]) : undefined), (_keeper, value) => `Both have the ${field} ${value}`, 0.95);
68
+ }
69
+ group((node) => nameKey(named(schema, node)) || undefined, (keeper) => `Same name as “${named(schema, keeper)}” (another ${noun(schema, kind)})`, 0.9);
70
+ group((node) => fold(named(schema, node)).replace(/ /g, "") || undefined, (keeper) => `Nearly the same name as “${named(schema, keeper)}”, punctuation and spacing aside`, 0.75);
71
+ for (const { nodes, basis, confidence } of groups) {
72
+ const keeper = keeperOf(store, nodes, context.touched);
73
+ if (!mayTouch(context, keeper))
74
+ continue;
75
+ for (const node of nodes) {
76
+ if (node.id === keeper.id || !mayTouch(context, node))
77
+ continue;
78
+ out.push({ judge: "duplicates", calls: [{ name: `merge-${kind}`, args: { id: node.id, into: keeper.id } }], basis: basis(keeper), confidence, about: [node.id, keeper.id] });
79
+ }
80
+ }
81
+ }
82
+ return out;
83
+ },
84
+ };
85
+ /** The act that links a kind's records along a relation, and the argument the far record goes in: the derived connect, else a declared act that `connects` it. */
86
+ export function connectOf(store, kind, relation, targets) {
87
+ for (const act of store.allMutations()) {
88
+ if (!(act.connects ?? []).includes(relation) || act.subject?.arg === undefined || !act.subject.kinds?.includes(kind))
89
+ continue;
90
+ const refs = nodeRefArgs(act.input).filter((ref) => ref.name !== act.subject.arg);
91
+ // One other record it takes, of the kinds the relation reaches: anything more is the act's own business.
92
+ const far = refs.filter((ref) => ref.kinds.includes("*") || targets.some((target) => ref.kinds.includes(target)));
93
+ if (act.subject.arg === "id" && far.length === 1 && refs.length === 1)
94
+ return { name: act.name, to: far[0].name };
95
+ }
96
+ return undefined;
97
+ }
98
+ /** Whether `inside` holds `words` as whole words, folded. */
99
+ const holdsWords = (inside, words) => ` ${inside} `.includes(` ${words} `);
100
+ /**
101
+ * LINKS FROM SHARED VALUES. A record whose text names another record —
102
+ * a field that says exactly what the other is called, or names it among
103
+ * other words — is linked to it through a relation the declaration already
104
+ * has whose far end is that record's kind; a relation is never invented.
105
+ * A cardinality-one relation that already holds a link is left as it is;
106
+ * a name two records of the far kind share says nothing. An exact name is
107
+ * surer than one named in passing.
108
+ */
109
+ export const links = {
110
+ name: "links",
111
+ severity: "link",
112
+ judge(context) {
113
+ const { store } = context;
114
+ const schema = store.schema;
115
+ const out = [];
116
+ for (const definition of schema.definitions) {
117
+ const kind = definition.kind;
118
+ if (tidyingOf(schema, kind) === "no-links")
119
+ continue;
120
+ const hidden = new Set(definition.display?.hide ?? []);
121
+ for (const [relation, edge] of Object.entries(definition.edges ?? {})) {
122
+ if (edge.acts === "none" || tidyingOf(schema, kind, relation) === "never")
123
+ continue;
124
+ const targets = edge.to === "*" ? schema.definitions.map((one) => one.kind) : edge.to;
125
+ const act = connectOf(store, kind, relation, targets);
126
+ if (!act)
127
+ continue;
128
+ // The far records by their folded name; a name two of them share names neither.
129
+ const byName = new Map();
130
+ for (const target of targets) {
131
+ if (tidyingOf(schema, target) === "never" || tidyingOf(schema, target) === "no-links")
132
+ continue;
133
+ for (const node of store.graph.nodesOfKind(target)) {
134
+ const name = fold(named(schema, node));
135
+ if (name.replace(/ /g, "").length < 3)
136
+ continue;
137
+ byName.set(name, byName.has(name) ? null : node);
138
+ }
139
+ }
140
+ for (const node of store.graph.nodesOfKind(kind)) {
141
+ if (!mayTouch(context, node))
142
+ continue;
143
+ const linked = new Set(store.graph.out(node.id, relation).map((one) => one.id));
144
+ if (edge.cardinality === "one" && linked.size > 0)
145
+ continue;
146
+ const own = fold(named(schema, node));
147
+ const found = new Map();
148
+ for (const field of fieldsOf(schema, kind)) {
149
+ const value = node[field];
150
+ if (hidden.has(field) || typeof value !== "string" || !value.trim())
151
+ continue;
152
+ const said = fold(value);
153
+ for (const [name, far] of byName) {
154
+ if (!far || far.id === node.id || linked.has(far.id) || name === own)
155
+ continue;
156
+ const exact = said === name;
157
+ if (!exact && !holdsWords(said, name))
158
+ continue;
159
+ const was = found.get(far.id);
160
+ if (!was || (exact && !was.exact))
161
+ found.set(far.id, { far, field, exact });
162
+ }
163
+ }
164
+ const ranked = [...found.values()].sort((a, b) => Number(b.exact) - Number(a.exact));
165
+ // One link to hold, and two equally named: nothing to say.
166
+ const picked = edge.cardinality === "one" ? (ranked.length === 1 || (ranked[0]?.exact && !ranked[1]?.exact) ? ranked.slice(0, 1) : []) : ranked;
167
+ for (const { far, field, exact } of picked) {
168
+ if (!mayTouch(context, far))
169
+ continue;
170
+ const farNoun = noun(schema, far.kind);
171
+ out.push({
172
+ judge: "links",
173
+ calls: [{ name: act.name, args: { id: node.id, [act.to]: far.id } }],
174
+ basis: exact ? `Its ${field} is “${named(schema, far)}”, the name of ${/^[aeiou]/i.test(farNoun) ? "an" : "a"} ${farNoun}` : `Its ${field} names “${named(schema, far)}”`,
175
+ confidence: exact ? 0.85 : 0.5,
176
+ about: [node.id, far.id],
177
+ });
178
+ }
179
+ }
180
+ }
181
+ }
182
+ return out;
183
+ },
184
+ };
185
+ /**
186
+ * HOW THE APP SAYS A RECORD IS FINISHED, from its declaration: its
187
+ * lifecycle (a value that retires it, or a date it expires after), else
188
+ * its main choice field read as the map reads it (`districtState`: a
189
+ * value like done, shipped, closed), else a yes/no field called done,
190
+ * completed or closed. Undefined when the kind says no such thing.
191
+ */
192
+ export function finishedOf(schema, kind, today) {
193
+ const definition = schema.tryDefinition(kind);
194
+ if (!definition)
195
+ return undefined;
196
+ const lifecycle = definition.lifecycle;
197
+ if (lifecycle) {
198
+ return (node) => (isCurrent(definition, node, today) ? undefined : lifecycle.retired === "date" ? `its ${lifecycle.field} has passed` : `its ${lifecycle.field} is “${String(node[lifecycle.field])}”`);
199
+ }
200
+ const state = districtState(schema, kind);
201
+ if (state && state.tiers.includes("done")) {
202
+ const done = new Set(state.values.filter((_, at) => state.tiers[at] === "done"));
203
+ return (node) => (done.has(node[state.field]) ? `its ${state.field} is “${String(node[state.field])}”` : undefined);
204
+ }
205
+ const flag = fieldsOf(schema, kind).find((field) => /^(done|completed|closed|finished)$/i.test(field));
206
+ return flag ? (node) => (node[flag] === true ? `it is marked ${flag}` : undefined) : undefined;
207
+ }
208
+ /** When a record last moved: the log's last change to it, else the date its declaration reads it by (a lifecycle date, an end or due role). */
209
+ export function lastMoved(schema, node, touched) {
210
+ const logged = touched.get(node.id);
211
+ if (logged !== undefined)
212
+ return logged;
213
+ const definition = schema.tryDefinition(node.kind);
214
+ const roles = definition?.fieldRoles ?? {};
215
+ for (const field of [definition?.lifecycle?.retired === "date" ? definition.lifecycle.field : undefined, roles["end"], roles["due"], roles["at"], roles["start"]]) {
216
+ const value = field ? node[field] : undefined;
217
+ const at = typeof value === "string" ? Date.parse(value) : Number.NaN;
218
+ if (!Number.isNaN(at))
219
+ return at;
220
+ }
221
+ return undefined;
222
+ }
223
+ /**
224
+ * DONE AND OLD → SET ASIDE. A record its kind says is finished, unchanged
225
+ * for longer than the run's `olderThanDays`, is a candidate to archive
226
+ * (`archive-<kind>`): out of lists and counts, its links and history kept,
227
+ * "Bring it back" one act away. Only kinds that archive; a record whose age
228
+ * nothing says is left.
229
+ */
230
+ export const archive = {
231
+ name: "archive",
232
+ severity: "archive",
233
+ judge(context) {
234
+ const { store } = context;
235
+ const schema = store.schema;
236
+ const today = new Date(context.now).toISOString().slice(0, 10);
237
+ const out = [];
238
+ for (const definition of schema.definitions) {
239
+ const kind = definition.kind;
240
+ if (definition.archives === false || !actNamed(store, `archive-${kind}`))
241
+ continue;
242
+ const finished = finishedOf(schema, kind, today);
243
+ if (!finished)
244
+ continue;
245
+ for (const node of store.graph.nodesOfKind(kind)) {
246
+ if (!mayTouch(context, node))
247
+ continue;
248
+ const why = finished(node);
249
+ const moved = why ? lastMoved(schema, node, context.touched) : undefined;
250
+ if (!why || moved === undefined)
251
+ continue;
252
+ const days = Math.floor((context.now - moved) / DAY);
253
+ if (days < context.olderThanDays)
254
+ continue;
255
+ out.push({
256
+ judge: "archive",
257
+ calls: [{ name: `archive-${kind}`, args: { id: node.id } }],
258
+ basis: `Finished — ${why} — and unchanged for ${days} days`,
259
+ // Older is surer, never certain: a person may still be reading it.
260
+ confidence: Math.min(0.8, 0.6 + days / 365),
261
+ about: [node.id],
262
+ });
263
+ }
264
+ }
265
+ return out;
266
+ },
267
+ };
268
+ /**
269
+ * AN EMPTY CHOICE, FILLED IN (`edit-<kind>`). Which of a field's options a
270
+ * record is takes reading it, so the graph alone proposes nothing: only a
271
+ * model, when lent, judges it (`./judging.ts`).
272
+ */
273
+ export const categorize = { name: "categorize", severity: "categorize", judge: () => [] };
274
+ /**
275
+ * AN EMPTY ONE-LINK RELATION, FILLED IN. Without a model the floor is the
276
+ * `links` judge's — a far record the record's own text names; a model, when
277
+ * lent, chooses among the likeliest records of the far kind, or none.
278
+ */
279
+ export const missingLinks = { name: "missing-links", severity: "link", judge: () => [] };
280
+ /** The judges a run uses unless told otherwise. */
281
+ export const JUDGES = [duplicates, links, archive, categorize, missingLinks];
282
+ //# sourceMappingURL=judges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judges.js","sourceRoot":"","sources":["../../src/tidy/judges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAiD,MAAM,eAAe,CAAC;AACzJ,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAqDlD,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhC,qHAAqH;AACrH,MAAM,UAAU,QAAQ,CAAC,OAAqB,EAAE,IAAU;IACxD,IAAI,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,IAAa,CAAC;QAAE,OAAO,KAAK,CAAC;IACnF,IAAI,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IACzE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1C,OAAO,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,GAAG,IAAI,IAAI,OAAO,C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AAEhG,mDAAmD;AACnD,MAAM,CAAC,MAAM,MAAM,GAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { type AnySchema, type Store } from "@graview/core";
2
+ import { type Question } from "../questions.js";
3
+ import type { Blocks, PairBlock, RecordBlock } from "./blocking.js";
4
+ import { type Candidate } from "./judges.js";
5
+ import type { Severity } from "./policy.js";
6
+ import { type SystemOneAnswer } from "./system-one.js";
7
+ /** The questions' version: a change to their words changes every cache key, so nothing is read back from the old ones. */
8
+ export declare const QUESTION_SET = "dream-questions/1";
9
+ /** "None of these": the option that keeps a Choice from being made to pick. */
10
+ export declare const NONE_OF_THESE = "none of these";
11
+ /** "None fits": the option that keeps an empty choice empty. */
12
+ export declare const NONE_FITS = "none fits";
13
+ /** A judgment the model made: a change it would make (with how sure), or one it let go. */
14
+ export interface Judgment extends Candidate {
15
+ readonly severity: Severity;
16
+ /** The answering model. */
17
+ readonly model: string;
18
+ /** Two options nearly as likely: never made unasked. */
19
+ readonly split?: boolean;
20
+ /** The model chose none, or was not sure enough to say anything. */
21
+ readonly none?: boolean;
22
+ }
23
+ /** One request: the state, its questions, what it covers, and how its answers read back. */
24
+ export interface Ask {
25
+ /** The families and records it judges, so the floor does not judge them again: "duplicates:a|b", "links:x". */
26
+ readonly covers: readonly string[];
27
+ readonly state: Readonly<Record<string, unknown>>;
28
+ readonly questions: Readonly<Record<string, Question>>;
29
+ read(answers: Readonly<Record<string, SystemOneAnswer>>, model: string): readonly Judgment[];
30
+ }
31
+ /**
32
+ * TWO RECORDS THAT MAY BE ONE. A Score — different, related but distinct,
33
+ * the same thing — and a Noul for the name and each key field both fill,
34
+ * in one request. The Score is the judgment; a key the model says differs
35
+ * (two emails, two codes) keeps the merge to a person's word.
36
+ */
37
+ export declare function pairAsk(store: Store<AnySchema>, pair: PairBlock): Ask;
38
+ /**
39
+ * ONE RECORD, EVERYTHING ABOUT IT. Whether it is finished or no longer
40
+ * relevant (a Noul, with its state, how long unchanged and how its kind
41
+ * says it is finished); for each empty choice, which option fits, or none
42
+ * (a Choice); for each relation, which of the likeliest far records it
43
+ * means, or none of these (a Choice — select, never generate; the
44
+ * relation is always one the app declares).
45
+ */
46
+ export declare function recordAsk(store: Store<AnySchema>, block: RecordBlock): Ask;
47
+ /** Every request a run would make, pairs first. */
48
+ export declare const asksOf: (store: Store<AnySchema>, blocks: Blocks) => Ask[];
49
+ /** The key a floor candidate is covered by, so a judgment the model made is not made again by the judges' rules. */
50
+ export declare function coverOf(candidate: Candidate): string;
51
+ //# sourceMappingURL=judging.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judging.d.ts","sourceRoot":"","sources":["../../src/tidy/judging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgD,KAAK,SAAS,EAAqB,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAE5H,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAwC,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAc7F,0HAA0H;AAC1H,eAAO,MAAM,YAAY,sBAAsB,CAAC;AAEhD,+EAA+E;AAC/E,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,gEAAgE;AAChE,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC,2FAA2F;AAC3F,MAAM,WAAW,QAAS,SAAQ,SAAS;IACzC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,2BAA2B;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,oEAAoE;IACpE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,4FAA4F;AAC5F,MAAM,WAAW,GAAG;IAClB,+GAA+G;IAC/G,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACvD,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,QAAQ,EAAE,CAAC;CAC9F;AA+CD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,GAAG,GAAG,CAiDrE;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,WAAW,GAAG,GAAG,CAkH1E;AAED,mDAAmD;AACnD,eAAO,MAAM,MAAM,GAAI,OAAO,KAAK,CAAC,SAAS,CAAC,EAAE,QAAQ,MAAM,KAAG,GAAG,EAAwH,CAAC;AAE7L,oHAAoH;AACpH,wBAAgB,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAIpD"}
@@ -0,0 +1,243 @@
1
+ import { humanizeField, nounOf, pluralOf, withArticle } from "@graview/core";
2
+ import { districtState } from "@graview/core/city";
3
+ import { nodeState } from "../questions.js";
4
+ import { named, noun } from "./judges.js";
5
+ import { choiceOf, modelWord, noulOf, scoreOf } from "./system-one.js";
6
+ /** The questions' version: a change to their words changes every cache key, so nothing is read back from the old ones. */
7
+ export const QUESTION_SET = "dream-questions/1";
8
+ /** "None of these": the option that keeps a Choice from being made to pick. */
9
+ export const NONE_OF_THESE = "none of these";
10
+ /** "None fits": the option that keeps an empty choice empty. */
11
+ export const NONE_FITS = "none fits";
12
+ const quote = (text) => `“${text}”`;
13
+ const two = (value) => value.toFixed(2);
14
+ /** A record as the model reads it: its kind, its name, its fields as the actor may see them, what it is joined to. No id. */
15
+ function recordState(store, node) {
16
+ const { id: _id, "what the kind is": _kind, ...state } = (nodeState(store, node.id) ?? { kind: node.kind, label: named(store.schema, node) });
17
+ return state;
18
+ }
19
+ /** What a kind is, in the declaration's words. */
20
+ function kindState(schema, kind) {
21
+ const definition = schema.tryDefinition(kind);
22
+ const state = districtState(schema, kind);
23
+ const done = state ? state.values.filter((_, at) => state.tiers[at] === "done") : [];
24
+ const lifecycle = definition?.lifecycle;
25
+ const finishedWhen = lifecycle
26
+ ? lifecycle.retired === "date"
27
+ ? `once its ${humanizeField(lifecycle.field).toLowerCase()} has passed`
28
+ : `when its ${humanizeField(lifecycle.field).toLowerCase()} retires it`
29
+ : done.length > 0
30
+ ? `when its ${humanizeField(state.field).toLowerCase()} is ${done.map(quote).join(" or ")}`
31
+ : undefined;
32
+ return {
33
+ name: nounOf(definition, kind),
34
+ ...(definition?.description ? { "what it is": definition.description } : {}),
35
+ ...(finishedWhen ? { "finished when": finishedWhen } : {}),
36
+ };
37
+ }
38
+ /** How long unchanged, in words that stay the same from one night to the next. */
39
+ const ageOf = (days) => (days >= 365 ? "over a year" : days >= 180 ? "over six months" : days >= 90 ? "over three months" : days >= 30 ? "over a month" : `${days} days`);
40
+ /** The key a question takes from a field or relation name: letters, digits and underscores. */
41
+ const keyOf = (prefix, name) => `${prefix}_${name.replace(/[^A-Za-z0-9_]+/g, "_")}`;
42
+ /** Option names a model reads — each far record's name — made unique. */
43
+ function optionNames(names) {
44
+ const seen = new Map();
45
+ return names.map((name) => {
46
+ const count = (seen.get(name) ?? 0) + 1;
47
+ seen.set(name, count);
48
+ return count === 1 && name !== NONE_OF_THESE ? name : `${name} (${count})`;
49
+ });
50
+ }
51
+ /**
52
+ * TWO RECORDS THAT MAY BE ONE. A Score — different, related but distinct,
53
+ * the same thing — and a Noul for the name and each key field both fill,
54
+ * in one request. The Score is the judgment; a key the model says differs
55
+ * (two emails, two codes) keeps the merge to a person's word.
56
+ */
57
+ export function pairAsk(store, pair) {
58
+ const schema = store.schema;
59
+ const one = noun(schema, pair.kind);
60
+ const many = pluralOf(schema, pair.kind);
61
+ const first = named(schema, pair.other);
62
+ const second = named(schema, pair.keeper);
63
+ const questions = {
64
+ same_thing: {
65
+ type: "score",
66
+ instructions: `Are “first” and “second” the same ${one}, entered twice? Judge from what each record says.`,
67
+ criteria: [`Different ${many}: alike only in passing.`, `Related but distinct: connected ${many}, still two of them.`, `The same ${one}, entered twice.`],
68
+ },
69
+ same_name: {
70
+ type: "noul",
71
+ instructions: `Do “first” and “second” have the same name, written two ways?`,
72
+ criteria: { true: "One name, written two ways.", false: "Two different names." },
73
+ },
74
+ };
75
+ for (const field of pair.keys) {
76
+ questions[keyOf("same", field)] = {
77
+ type: "noul",
78
+ instructions: `Do “first” and “second” have the same ${humanizeField(field).toLowerCase()}, perhaps written two ways?`,
79
+ criteria: { true: `One ${humanizeField(field).toLowerCase()}.`, false: `Two different ${humanizeField(field).toLowerCase()} values.` },
80
+ };
81
+ }
82
+ return {
83
+ covers: [`duplicates:${[pair.other.id, pair.keeper.id].sort().join("|")}`],
84
+ state: { kind: kindState(schema, pair.kind), first: recordState(store, pair.other), second: recordState(store, pair.keeper) },
85
+ questions,
86
+ read(answers, model) {
87
+ const same = scoreOf(answers["same_thing"], 3);
88
+ if (same === undefined)
89
+ return [];
90
+ const keys = pair.keys.map((field) => ({ field, p: noulOf(answers[keyOf("same", field)]) })).filter((one) => one.p !== undefined);
91
+ const name = noulOf(answers["same_name"]);
92
+ const nouls = [...keys.map((one) => one.p), ...(name === undefined ? [] : [name])];
93
+ let confidence = nouls.length > 0 ? (2 * same + nouls.reduce((sum, p) => sum + p, 0) / nouls.length) / 3 : same;
94
+ // A key the model says differs: never merged unasked.
95
+ const differs = keys.find((one) => one.p < 0.2);
96
+ if (differs)
97
+ confidence = Math.min(confidence, 0.5);
98
+ confidence = Math.round(confidence * 100) / 100;
99
+ const agreed = keys.filter((one) => one.p >= 0.8).map((one) => `the same ${humanizeField(one.field).toLowerCase()}`);
100
+ const basis = [
101
+ `${modelWord(model)}: ${two(confidence)} that ${quote(first)} and ${quote(second)} are the same ${one}`,
102
+ agreed.length > 0 ? ` (${agreed.join(", ")})` : "",
103
+ differs ? `, though their ${humanizeField(differs.field).toLowerCase()} differs` : "",
104
+ ].join("");
105
+ return [{ judge: "duplicates", severity: "merge", model, calls: [{ name: `merge-${pair.kind}`, args: { id: pair.other.id, into: pair.keeper.id } }], basis, confidence, about: [pair.other.id, pair.keeper.id] }];
106
+ },
107
+ };
108
+ }
109
+ /**
110
+ * ONE RECORD, EVERYTHING ABOUT IT. Whether it is finished or no longer
111
+ * relevant (a Noul, with its state, how long unchanged and how its kind
112
+ * says it is finished); for each empty choice, which option fits, or none
113
+ * (a Choice); for each relation, which of the likeliest far records it
114
+ * means, or none of these (a Choice — select, never generate; the
115
+ * relation is always one the app declares).
116
+ */
117
+ export function recordAsk(store, block) {
118
+ const schema = store.schema;
119
+ const node = block.node;
120
+ const one = noun(schema, node.kind);
121
+ const name = named(schema, node);
122
+ const questions = {};
123
+ const state = { kind: kindState(schema, node.kind), record: recordState(store, node) };
124
+ const covers = [];
125
+ const readers = [];
126
+ if (block.archive) {
127
+ covers.push(`archive:${node.id}`);
128
+ // Said coarsely, so tomorrow's run asks the same question and its answer is kept.
129
+ const age = ageOf(block.archive.days);
130
+ state["unchanged for"] = age;
131
+ questions["finished"] = {
132
+ type: "noul",
133
+ instructions: `Is this ${one} finished, or no longer relevant, so it can be set aside (archived, kept but out of the lists)? It has been unchanged for ${age}.`,
134
+ criteria: { true: "Finished or no longer relevant: setting it aside loses nothing anyone is using.", false: "Still open, still in use, or likely to be needed soon." },
135
+ };
136
+ const days = block.archive.days;
137
+ const why = block.archive.why;
138
+ readers.push((answers, model) => {
139
+ const p = noulOf(answers["finished"]);
140
+ if (p === undefined)
141
+ return undefined;
142
+ return {
143
+ judge: "archive",
144
+ severity: "archive",
145
+ model,
146
+ calls: [{ name: `archive-${node.kind}`, args: { id: node.id } }],
147
+ basis: `${modelWord(model)}: ${two(p)} that ${quote(name)} is finished or no longer relevant (${why ? `${why}, ` : ""}unchanged for ${days} days)`,
148
+ confidence: p,
149
+ about: [node.id],
150
+ };
151
+ });
152
+ }
153
+ for (const fill of block.fills) {
154
+ covers.push(`categorize:${node.id}:${fill.field}`);
155
+ const key = keyOf("fill", fill.field);
156
+ const words = humanizeField(fill.field).toLowerCase();
157
+ const criteria = {};
158
+ for (const option of fill.options)
159
+ criteria[option] = null;
160
+ criteria[NONE_FITS] = `No ${words} plainly fits; leave it empty.`;
161
+ questions[key] = {
162
+ type: "choice",
163
+ instructions: `Which ${words} is this ${one}?${fill.description ? ` ${fill.description}` : ""} Choose “${NONE_FITS}” unless the record plainly says.`,
164
+ criteria,
165
+ };
166
+ readers.push((answers, model) => {
167
+ const chosen = choiceOf(answers[key]);
168
+ if (!chosen)
169
+ return undefined;
170
+ const none = chosen.choice === NONE_FITS || !fill.options.includes(chosen.choice);
171
+ return {
172
+ judge: "categorize",
173
+ severity: "categorize",
174
+ model,
175
+ calls: none ? [] : [{ name: fill.writes.mutation, args: { [fill.writes.subjectArg]: node.id, [fill.writes.arg]: chosen.choice } }],
176
+ basis: none ? `${modelWord(model)}: no ${words} plainly fits ${quote(name)} (${two(chosen.confidence)})` : `${modelWord(model)}: ${two(chosen.confidence)} that the ${words} of ${quote(name)} is ${quote(chosen.choice)}`,
177
+ confidence: chosen.confidence,
178
+ about: [node.id],
179
+ split: chosen.margin < 0.15,
180
+ ...(none ? { none: true } : {}),
181
+ };
182
+ });
183
+ }
184
+ const candidates = {};
185
+ for (const link of block.links) {
186
+ const judge = link.missing ? "missing-links" : "links";
187
+ covers.push(`links:${node.id}`);
188
+ const key = keyOf("link", link.relation);
189
+ const words = humanizeField(link.relation).toLowerCase();
190
+ const options = optionNames(link.targets.map((target) => named(schema, target.node)));
191
+ const byOption = new Map(options.map((option, at) => [option, link.targets[at]]));
192
+ const criteria = {};
193
+ link.targets.forEach((target, at) => {
194
+ criteria[options[at]] = `${withArticle(noun(schema, target.node.kind))}: ${named(schema, target.node)}`;
195
+ });
196
+ criteria[NONE_OF_THESE] = "None of these is meant; leave it as it is.";
197
+ candidates[key] = Object.fromEntries(link.targets.map((target, at) => [options[at], recordState(store, target.node)]));
198
+ questions[key] = {
199
+ type: "choice",
200
+ instructions: `This ${one}'s “${words}”${link.description ? ` (${link.description})` : ""}: which of the candidates does the record mean? Choose one only if the record plainly means it; otherwise “${NONE_OF_THESE}”.`,
201
+ criteria,
202
+ };
203
+ readers.push((answers, model) => {
204
+ const chosen = choiceOf(answers[key]);
205
+ if (!chosen)
206
+ return undefined;
207
+ const target = byOption.get(chosen.choice);
208
+ const calls = target ? [{ name: link.act.name, args: { id: node.id, [link.act.to]: target.node.id } }] : [];
209
+ return {
210
+ judge,
211
+ severity: "link",
212
+ model,
213
+ calls,
214
+ basis: target
215
+ ? `${modelWord(model)}: ${two(chosen.confidence)} that the ${words} of ${quote(name)} is ${quote(named(schema, target.node))} (${target.evidence})`
216
+ : `${modelWord(model)}: none of the candidates is the ${words} of ${quote(name)} (${two(chosen.confidence)})`,
217
+ confidence: chosen.confidence,
218
+ about: target ? [node.id, target.node.id] : [node.id],
219
+ split: chosen.margin < 0.15,
220
+ ...(target ? {} : { none: true }),
221
+ };
222
+ });
223
+ }
224
+ if (Object.keys(candidates).length > 0)
225
+ state["candidates"] = candidates;
226
+ return {
227
+ covers,
228
+ state,
229
+ questions,
230
+ read: (answers, model) => readers.flatMap((reader) => reader(answers, model) ?? []),
231
+ };
232
+ }
233
+ /** Every request a run would make, pairs first. */
234
+ export const asksOf = (store, blocks) => [...blocks.pairs.map((pair) => pairAsk(store, pair)), ...blocks.records.map((record) => recordAsk(store, record))];
235
+ /** The key a floor candidate is covered by, so a judgment the model made is not made again by the judges' rules. */
236
+ export function coverOf(candidate) {
237
+ if (candidate.judge === "duplicates")
238
+ return `duplicates:${[...candidate.about].sort().join("|")}`;
239
+ if (candidate.judge === "links" || candidate.judge === "missing-links")
240
+ return `links:${candidate.about[0]}`;
241
+ return `${candidate.judge}:${candidate.about[0]}`;
242
+ }
243
+ //# sourceMappingURL=judging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judging.js","sourceRoot":"","sources":["../../src/tidy/judging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAiD,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAkB,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAwB,MAAM,iBAAiB,CAAC;AAc7F,0HAA0H;AAC1H,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAC;AAEhD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAC7C,gEAAgE;AAChE,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AAsBrC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC;AAC5C,MAAM,GAAG,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhD,6HAA6H;AAC7H,SAAS,WAAW,CAAC,KAAuB,EAAE,IAAU;IACtD,MAAM,EAAE,EAAE,EAAE,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