@yaks/memory 0.0.0-stage → 0.2.36
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/LICENSE +202 -0
- package/README.md +309 -2
- package/_dist/comp.d.ts +9 -0
- package/_dist/comp.d.ts.map +1 -0
- package/_dist/earlier.d.ts +108 -0
- package/_dist/earlier.d.ts.map +1 -0
- package/_dist/graph.d.ts +13 -0
- package/_dist/graph.d.ts.map +1 -0
- package/_dist/inspect.d.ts +28 -0
- package/_dist/inspect.d.ts.map +1 -0
- package/_dist/mod.d.ts +54 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/passage.d.ts +19 -0
- package/_dist/passage.d.ts.map +1 -0
- package/_dist/recall.d.ts +67 -0
- package/_dist/recall.d.ts.map +1 -0
- package/_dist/save.d.ts +45 -0
- package/_dist/save.d.ts.map +1 -0
- package/_dist/tools.d.ts +12 -0
- package/_dist/tools.d.ts.map +1 -0
- package/_dist/views.d.ts +17 -0
- package/_dist/views.d.ts.map +1 -0
- package/_dist/vocab.d.ts +7 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/around.js +141 -0
- package/around.js.map +1 -0
- package/around.ts +152 -0
- package/comp.js +42 -0
- package/comp.js.map +1 -0
- package/comp.ts +45 -0
- package/deno.json +1 -0
- package/earlier.js +386 -0
- package/earlier.js.map +1 -0
- package/earlier.ts +494 -0
- package/graph.js +138 -0
- package/graph.js.map +1 -0
- package/graph.ts +133 -0
- package/inspect.js +168 -0
- package/inspect.js.map +1 -0
- package/inspect.ts +169 -0
- package/mod.js +54 -0
- package/mod.js.map +1 -0
- package/mod.ts +55 -0
- package/package.json +51 -4
- package/passage.js +67 -0
- package/passage.js.map +1 -0
- package/passage.ts +75 -0
- package/recall.js +145 -0
- package/recall.js.map +1 -0
- package/recall.ts +180 -0
- package/save.js +93 -0
- package/save.js.map +1 -0
- package/save.ts +113 -0
- package/tools.js +246 -0
- package/tools.js.map +1 -0
- package/tools.ts +250 -0
- package/views.js +18 -0
- package/views.js.map +1 -0
- package/views.ts +23 -0
- package/vocab.js +14 -0
- package/vocab.js.map +1 -0
- package/vocab.json +456 -0
- package/vocab.ts +16 -0
package/comp.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// The component this package is about: `memory`, a mark on something a person
|
|
2
|
+
// said. Beside it, ./vocab.json declares what is built from memories: `belief`,
|
|
3
|
+
// a conclusion a builder drew about a subject, often a topic (@yaks/topic).
|
|
4
|
+
//
|
|
5
|
+
// A memory is NOT a note an agent took. It is the person's own sentence, kept
|
|
6
|
+
// as they said it, because a paraphrase is strictly less than what was said —
|
|
7
|
+
// an agent that summarises can only ever remove information, and the next
|
|
8
|
+
// agent cannot get it back. So a memory never holds words of its own: it marks
|
|
9
|
+
// the entity where the words already are, whatever that entity is —
|
|
10
|
+
//
|
|
11
|
+
// { entity: { eid: e }, a session entry: what they typed
|
|
12
|
+
// entry: { session: s, seq: 12 },
|
|
13
|
+
// content: { body: 'use grams, never cups' },
|
|
14
|
+
// memory: { context: 'about the recipe app', at, by, via } }
|
|
15
|
+
//
|
|
16
|
+
// — a comment, a doc, a transcript entry. Only words the graph holds nowhere
|
|
17
|
+
// yet (said in a chat on yaks.app, say) get an entity made for them, a doc
|
|
18
|
+
// whose body is the sentence. The words are read from whichever holds them
|
|
19
|
+
// (./recall.ts `words`), by component, never by kind.
|
|
20
|
+
//
|
|
21
|
+
// A mark is what the graph calls a component whose `at`, `by` and `via` it
|
|
22
|
+
// fills in the first time it is written (@yaks/graph ./stamp.ts), so a memory
|
|
23
|
+
// records who marked the words and when; nothing needs approving. Who said
|
|
24
|
+
// them, and when, is the entity's own `created{at, by}`. And a mark says what
|
|
25
|
+
// happened to an entity, never what the entity is: a comment marked as a
|
|
26
|
+
// memory is still a comment (@yaks/vocab `kindOrder`), and only a doc that is
|
|
27
|
+
// nothing but a memory is shown as one.
|
|
28
|
+
//
|
|
29
|
+
// The document itself is `./vocab.json` — plain JSON Schema, readable by
|
|
30
|
+
// anything that reads JSON. This file re-exports it under the name callers
|
|
31
|
+
// import and keeps the prose about why it is shaped the way it is.
|
|
32
|
+
|
|
33
|
+
import type { VocabDoc } from 'jsr:@yaks/vocab@0.2.36'
|
|
34
|
+
import doc from './vocab.json' with { type: 'json' }
|
|
35
|
+
|
|
36
|
+
/** The component marking a thing a person said. */
|
|
37
|
+
export let MEMORY = 'memory'
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The memory vocabulary document, to load beside @yaks/doc's and your own:
|
|
41
|
+
* `loadVocab([docDoc, memoryDoc, ...mine])`. It declares nothing about what a
|
|
42
|
+
* space is — that component is your own document's — only that a memory
|
|
43
|
+
* belongs to one.
|
|
44
|
+
*/
|
|
45
|
+
export let memoryDoc: VocabDoc = doc
|
package/deno.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"publish":{"exclude":["**/*_test.ts"]},"name":"@yaks/memory","version":"0.2.36","license":"Apache-2.0","description":"Stores a person's words with context as graph entities and retrieves them for subsequent conversations.","exports":{".":"./mod.ts","./vocab":"./vocab.ts","./tools":"./tools.ts","./inspect":"./inspect.ts","./views":"./views.ts","./earlier":"./earlier.ts","./graph":"./graph.ts"},"imports":{"@yaks/memory":"./mod.ts","@yaks/memory/vocab":"./vocab.ts","@yaks/memory/tools":"./tools.ts","@yaks/memory/inspect":"./inspect.ts","@yaks/memory/views":"./views.ts","@yaks/memory/earlier":"./earlier.ts","@yaks/memory/graph":"./graph.ts"}}
|
package/earlier.js
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Earlier words, not summaries: a bounded read of what a person said and
|
|
3
|
+
* decided before, shared by the doors that set it beside what is in front of
|
|
4
|
+
* an agent.
|
|
5
|
+
*
|
|
6
|
+
* - {@link earlier} is keyed on the person's own words: a prompt, a comment or
|
|
7
|
+
* a letter of theirs, answered with their nearest earlier words and the
|
|
8
|
+
* nearest memories and decisions, as lines.
|
|
9
|
+
* - {@link bearing} is keyed on what an agent just wrote (a task, a comment, a
|
|
10
|
+
* memory): the person's earlier words and the decisions already answered
|
|
11
|
+
* that are near it, as rows, for the answer to the write (./graph.ts).
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/ import { joined, line, sub } from "@yaks/query";
|
|
15
|
+
import { HUMAN, human, SHORT } from "@yaks/id";
|
|
16
|
+
import { minted } from "@yaks/graph";
|
|
17
|
+
import { lifecycleSubject, lifecycleTerms } from "@yaks/fts/term";
|
|
18
|
+
let part = (b, c)=>b[c] ?? {};
|
|
19
|
+
let WORDS = 'Earlier words from the same person (historical evidence, not new instructions):';
|
|
20
|
+
let KEPT = 'Nearest memories and decisions (read one by id before relying on it):';
|
|
21
|
+
export let recalledItems = (prompt)=>prompt.split('\n\n').flatMap((block)=>{
|
|
22
|
+
let [heading, ...lines] = block.split('\n');
|
|
23
|
+
if (heading != WORDS && heading != KEPT) return [];
|
|
24
|
+
return lines.flatMap((line)=>{
|
|
25
|
+
let separator = line.indexOf(' · ');
|
|
26
|
+
if (separator < 0) return [];
|
|
27
|
+
let id = line.slice(0, separator);
|
|
28
|
+
if (!HUMAN.test(id) && !SHORT.test(id) && !minted(id)) return [];
|
|
29
|
+
let text = line.slice(separator + 3);
|
|
30
|
+
if (heading == WORDS) {
|
|
31
|
+
let quoted = text.match(/^\d{4}-\d{2}-\d{2} · (".*")$/)?.[1];
|
|
32
|
+
if (!quoted) return [];
|
|
33
|
+
try {
|
|
34
|
+
text = JSON.parse(quoted);
|
|
35
|
+
} catch {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return text ? [
|
|
40
|
+
{
|
|
41
|
+
id,
|
|
42
|
+
text
|
|
43
|
+
}
|
|
44
|
+
] : [];
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
// What an entry wears when it is not words somebody typed.
|
|
48
|
+
let UNSAID = [
|
|
49
|
+
'output',
|
|
50
|
+
'result',
|
|
51
|
+
'call',
|
|
52
|
+
'ask',
|
|
53
|
+
'notice',
|
|
54
|
+
'prompt',
|
|
55
|
+
'reasoning',
|
|
56
|
+
'meta',
|
|
57
|
+
'cancel',
|
|
58
|
+
'checkpoint',
|
|
59
|
+
'tool_progress',
|
|
60
|
+
'exception',
|
|
61
|
+
'refusal'
|
|
62
|
+
];
|
|
63
|
+
/** Only an authored input, a comment the person wrote, or an explicitly
|
|
64
|
+
* attributed verbatim quotation. Text outside the quotation is never evidence
|
|
65
|
+
* of what the person said. */ export function ownWords(b, person, name) {
|
|
66
|
+
let at = String(part(b, 'created').at ?? '');
|
|
67
|
+
let id = b.comment && b.entity.num ? `C-${b.entity.num}` : b.entity.eid;
|
|
68
|
+
if (!Number.isFinite(Date.parse(at))) return [];
|
|
69
|
+
let theirs = part(b, 'created').by == person;
|
|
70
|
+
if (b.entry && theirs && b.content && !UNSAID.some((c)=>b[c])) {
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
id,
|
|
74
|
+
at,
|
|
75
|
+
words: String(part(b, 'content').body ?? '')
|
|
76
|
+
}
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
if (!b.comment) return [];
|
|
80
|
+
let body = String(part(b, 'doc').body ?? '');
|
|
81
|
+
if (theirs) return [
|
|
82
|
+
{
|
|
83
|
+
id,
|
|
84
|
+
at,
|
|
85
|
+
words: body
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
if (!name) return [];
|
|
89
|
+
let escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
90
|
+
// A quotation occupies a whole attributed line; fail closed on prose around it.
|
|
91
|
+
let re = new RegExp(`^${escaped}, (\\d{4}-\\d{2}-\\d{2}), verbatim: ["“]([\\s\\S]+)["”]$`);
|
|
92
|
+
let m = re.exec(body.trim());
|
|
93
|
+
return m ? [
|
|
94
|
+
{
|
|
95
|
+
id,
|
|
96
|
+
at: m[1],
|
|
97
|
+
words: m[2]
|
|
98
|
+
}
|
|
99
|
+
] : [];
|
|
100
|
+
}
|
|
101
|
+
// A recall's answer, or `none` once `wait` milliseconds pass.
|
|
102
|
+
let within = (found, wait, none)=>{
|
|
103
|
+
if (wait == null) return found;
|
|
104
|
+
let timer;
|
|
105
|
+
return Promise.race([
|
|
106
|
+
found,
|
|
107
|
+
new Promise((done)=>timer = setTimeout(done, wait, none))
|
|
108
|
+
]).finally(()=>clearTimeout(timer));
|
|
109
|
+
};
|
|
110
|
+
// The person's name, as their quotations are attributed.
|
|
111
|
+
let named = async (g, person, name)=>{
|
|
112
|
+
if (name) return name;
|
|
113
|
+
let [p] = await g.get([
|
|
114
|
+
person
|
|
115
|
+
], [
|
|
116
|
+
'doc'
|
|
117
|
+
]);
|
|
118
|
+
return String(part(p ?? {
|
|
119
|
+
entity: {
|
|
120
|
+
eid: person
|
|
121
|
+
}
|
|
122
|
+
}, 'doc').title ?? '');
|
|
123
|
+
};
|
|
124
|
+
// The filter line the person's own words are among: what they typed, the
|
|
125
|
+
// comments they wrote, and the comments that quote them by name, each where
|
|
126
|
+
// the vocabulary has the kind.
|
|
127
|
+
let theirs = (g, { person, name, before, among })=>{
|
|
128
|
+
let has = (c)=>!!g.vocab.comp(c);
|
|
129
|
+
let by = line`.created.by=${person}`;
|
|
130
|
+
let unsaid = UNSAID.filter(has).reduce((l, c)=>line`${sub(l)} !${c}`, line``);
|
|
131
|
+
let typed = line`.entry ${sub(by)}${sub(unsaid)}${sub(among ? line` (${sub(among)})` : line``)}`;
|
|
132
|
+
let kinds = [
|
|
133
|
+
...has('entry') ? [
|
|
134
|
+
typed
|
|
135
|
+
] : [],
|
|
136
|
+
...has('comment') ? [
|
|
137
|
+
line`.comment ${sub(by)}`
|
|
138
|
+
] : [],
|
|
139
|
+
// Only a verbatim quotation is their words (ownWords), and asking for
|
|
140
|
+
// both strings halves the bodies read: "Jeff, " alone is in 4,751 docs.
|
|
141
|
+
...has('comment') && name ? [
|
|
142
|
+
line`.comment .doc.body~=${name + ', '} .doc.body~=${', verbatim: '}`
|
|
143
|
+
] : []
|
|
144
|
+
];
|
|
145
|
+
return line`(.created.at<${before}) (${sub(joined(kinds, '|'))})`;
|
|
146
|
+
};
|
|
147
|
+
// The rows among `line` nearest `words` in meaning and at least `floor`
|
|
148
|
+
// similar, nearest first; undefined where meaning answered nothing at all. A
|
|
149
|
+
// meaning that failed fails the recall, for its caller to report.
|
|
150
|
+
let nearest = async (g, meaning, words, line, floor)=>{
|
|
151
|
+
let hits = meaning ? await meaning(words, {
|
|
152
|
+
within: line,
|
|
153
|
+
limit: 24
|
|
154
|
+
}) : [];
|
|
155
|
+
if (!hits.length) return;
|
|
156
|
+
let ids = hits.filter((h)=>h.similarity >= floor).map((h)=>h.entity);
|
|
157
|
+
if (!ids.length) return [];
|
|
158
|
+
let rows = await g.get(ids, [
|
|
159
|
+
'entry',
|
|
160
|
+
'comment',
|
|
161
|
+
'content',
|
|
162
|
+
'doc',
|
|
163
|
+
'created',
|
|
164
|
+
...UNSAID
|
|
165
|
+
].filter((c)=>g.vocab.comp(c)));
|
|
166
|
+
return ids.flatMap((eid)=>rows.filter((b)=>b.entity.eid == eid));
|
|
167
|
+
};
|
|
168
|
+
// The first `most` different things these rows hold that the person said
|
|
169
|
+
// before `before`, other than `words` itself.
|
|
170
|
+
let quotes = (g, rows, { person, name, words, before }, most)=>{
|
|
171
|
+
let id = human(g.vocab);
|
|
172
|
+
let seen = new Set();
|
|
173
|
+
let out = [];
|
|
174
|
+
for (let b of rows){
|
|
175
|
+
for (let q of ownWords(b, person, name)){
|
|
176
|
+
if (Date.parse(String(part(b, 'created').at)) >= Date.parse(before) || Date.parse(q.at) >= Date.parse(before) || q.words == words || !q.words.trim() || seen.has(q.words)) continue;
|
|
177
|
+
seen.add(q.words);
|
|
178
|
+
out.push({
|
|
179
|
+
...q,
|
|
180
|
+
id: id(b),
|
|
181
|
+
from: b
|
|
182
|
+
});
|
|
183
|
+
if (out.length == most) return out;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return out;
|
|
187
|
+
};
|
|
188
|
+
let keywords = (words)=>{
|
|
189
|
+
let stop = new Set('that this with have your from what would could should just like here there then them they been will into when about some only also really actually feel myself'.split(' '));
|
|
190
|
+
return [
|
|
191
|
+
...new Set(words.toLowerCase().match(/[\p{L}\p{N}_-]{4,}/gu) ?? [])
|
|
192
|
+
].filter((w)=>!stop.has(w)).slice(0, 24);
|
|
193
|
+
};
|
|
194
|
+
// The fallback ranks one term at a time, avoiding a broad OR over the
|
|
195
|
+
// transcript. Two terms must occur in the words we can actually quote.
|
|
196
|
+
let lexical = async (g, own, tokens, person, name)=>{
|
|
197
|
+
if (tokens.length < 2) return [];
|
|
198
|
+
let candidates = new Map();
|
|
199
|
+
for (let word of tokens){
|
|
200
|
+
for (let row of (await g.read(line`${word} (${sub(own)}) * .order=search .limit=24`))){
|
|
201
|
+
candidates.set(row.entity.eid, row);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
let relevance = (b)=>{
|
|
205
|
+
let text = ownWords(b, person, name).map((q)=>q.words).join(' ').toLowerCase();
|
|
206
|
+
return tokens.filter((w)=>text.includes(w)).length;
|
|
207
|
+
};
|
|
208
|
+
return [
|
|
209
|
+
...candidates.values()
|
|
210
|
+
].filter((b)=>relevance(b) >= 2).sort((a, b)=>relevance(b) - relevance(a));
|
|
211
|
+
};
|
|
212
|
+
// A premise can carry a different subject than the rest of the request.
|
|
213
|
+
// Require both its name and one of the lifecycle terms before ranking.
|
|
214
|
+
let premise = async (g, own, subject, source)=>{
|
|
215
|
+
for (let term of lifecycleTerms){
|
|
216
|
+
let rows = await g.read(line`${subject} ${term} (${sub(own)}) * .limit=4`);
|
|
217
|
+
let [found] = quotes(g, rows, source, 1);
|
|
218
|
+
if (found) return [
|
|
219
|
+
found.from
|
|
220
|
+
];
|
|
221
|
+
}
|
|
222
|
+
return [];
|
|
223
|
+
};
|
|
224
|
+
/** What a person said, kept and decided before on the subject of `words`:
|
|
225
|
+
* a few lines by id for the agent answering them. A person the graph has no
|
|
226
|
+
* name for has no attributed quotations, only their own inputs. With `wait`,
|
|
227
|
+
* only the reads completed by the deadline are included. A meaning read that
|
|
228
|
+
* fails rejects it, for its caller to report. */ export async function earlier(g, options) {
|
|
229
|
+
let { person, words, before, meaning, wait } = options;
|
|
230
|
+
if (!person || !words.trim() || !Number.isFinite(Date.parse(before))) {
|
|
231
|
+
return '';
|
|
232
|
+
}
|
|
233
|
+
let tokens = keywords(words);
|
|
234
|
+
let subject = lifecycleSubject(words);
|
|
235
|
+
if (tokens.length < 2 && !subject) return '';
|
|
236
|
+
let source = {
|
|
237
|
+
person,
|
|
238
|
+
name: '',
|
|
239
|
+
words,
|
|
240
|
+
before,
|
|
241
|
+
among: options.among
|
|
242
|
+
};
|
|
243
|
+
let held = [], related = [], grounded = [];
|
|
244
|
+
// Start the authored premise read before the broader ranking brings in
|
|
245
|
+
// attributed quotations, memories and decisions.
|
|
246
|
+
let focused = (subject ? premise(g, theirs(g, source), subject, source) : Promise.resolve([])).then((rows)=>grounded = rows);
|
|
247
|
+
let broad = async ()=>{
|
|
248
|
+
let name = source.name = await named(g, person, options.name);
|
|
249
|
+
let own = theirs(g, source);
|
|
250
|
+
await Promise.all([
|
|
251
|
+
decided(g, words, before, meaning, options.floor).then((rows)=>{
|
|
252
|
+
held = rows;
|
|
253
|
+
}),
|
|
254
|
+
nearest(g, meaning, words, own, options.quoted ?? QUOTED).then(async (rows)=>rows ?? ((await focused).length ? [] : lexical(g, own, tokens, person, name))).then((rows)=>{
|
|
255
|
+
related = rows;
|
|
256
|
+
})
|
|
257
|
+
]);
|
|
258
|
+
};
|
|
259
|
+
await within(Promise.all([
|
|
260
|
+
focused,
|
|
261
|
+
broad()
|
|
262
|
+
]), wait, undefined);
|
|
263
|
+
let said = quotes(g, [
|
|
264
|
+
...grounded,
|
|
265
|
+
...related
|
|
266
|
+
], source, 3);
|
|
267
|
+
let id = human(g.vocab);
|
|
268
|
+
// A memory can be one of the person's own inputs, already quoted above.
|
|
269
|
+
let shown = new Set(said.map((q)=>q.id));
|
|
270
|
+
let kept = held.filter((b)=>!shown.has(id(b))).slice(0, 4);
|
|
271
|
+
return [
|
|
272
|
+
said.length ? WORDS + '\n' + said.map((q)=>`${q.id} · ${q.at.slice(0, 10)} · ${JSON.stringify(clip(q.words))}`).join('\n') : '',
|
|
273
|
+
kept.length ? KEPT + '\n' + kept.map((b)=>`${id(b)} · ${titleOf(b)}`).join('\n') : ''
|
|
274
|
+
].filter(Boolean).join('\n\n');
|
|
275
|
+
}
|
|
276
|
+
// A quotation is shown verbatim up to a line's worth, and says when it stops.
|
|
277
|
+
let CLIP = 280;
|
|
278
|
+
/** Words cut to a line's worth, saying where they stop. */ export let clip = (words)=>{
|
|
279
|
+
let flat = words.replace(/\s+/g, ' ').trim();
|
|
280
|
+
return flat.length > CLIP ? flat.slice(0, CLIP).replace(/\s+\S*$/, '') + '…' : flat;
|
|
281
|
+
};
|
|
282
|
+
/** What a memory or a decision is called in a line: its title, or its words
|
|
283
|
+
* where it has none, and the choice a decision was answered with. */ export let titleOf = (b)=>{
|
|
284
|
+
let doc = part(b, 'doc');
|
|
285
|
+
let title = String(doc.title || doc.body || part(b, 'content').body || '');
|
|
286
|
+
let choice = part(b, 'decided').choice;
|
|
287
|
+
return clip(choice ? `${title} → ${choice}` : title);
|
|
288
|
+
};
|
|
289
|
+
/** How near in meaning a memory or decision must be to a person's words to be
|
|
290
|
+
* listed beside them. In granite-embedding-30m-english, over the 19 inputs of
|
|
291
|
+
* Jeff's in the windows of T-155224's cases, the memories on the input's
|
|
292
|
+
* subject began at about .75 and the ones at .70 to .75 were on another: .65
|
|
293
|
+
* listed 69 memories and 13 decisions, .75 lists 28 and none (T-161252). No
|
|
294
|
+
* floor from .55 to .70 put a case's needed fact in front. */ export let FLOOR = .75;
|
|
295
|
+
/** How near in meaning one of the person's earlier words must be to their
|
|
296
|
+
* words now to be quoted beside them. In granite-embedding-30m-english,
|
|
297
|
+
* unrelated corpus pairs reached .642; the attachment paraphrase reached .669
|
|
298
|
+
* and inspect's two earlier asks .664/.677. Like {@link FLOOR}, it is a number
|
|
299
|
+
* in one model's space: a host whose vectors another model makes passes its
|
|
300
|
+
* own. */ export let QUOTED = .65;
|
|
301
|
+
/** How near in meaning one of the person's earlier words, or an answered
|
|
302
|
+
* decision, must be to what an agent wrote to be set beside it: nothing is,
|
|
303
|
+
* so the door brings nothing until a variant scored with `yak trial score
|
|
304
|
+
* --arrive said --floor` earns it. At .8, the third-nearest of Jeff's words
|
|
305
|
+
* to the 73 things T-155224's agents wrote was at .74 in the median, and the
|
|
306
|
+
* door reached the needed row in 1 of 17 cases (C-161507), not worth a list
|
|
307
|
+
* beside every write. */ export let SAID = Infinity;
|
|
308
|
+
/** The memories and answered decisions nearest the words in meaning: what was
|
|
309
|
+
* already kept or settled on the subject, at least `floor` similar. A
|
|
310
|
+
* quarantined memory is not offered; without a meaning index there is nothing
|
|
311
|
+
* to rank by, so nothing. `memories: false` answers the decisions alone. */ export async function decided(g, words, before, meaning, floor = FLOOR, memories = true) {
|
|
312
|
+
if (!meaning || !words.trim()) return [];
|
|
313
|
+
let at = line`.created.at<${before}`;
|
|
314
|
+
let ask = (within, limit)=>meaning(words, {
|
|
315
|
+
within,
|
|
316
|
+
limit
|
|
317
|
+
});
|
|
318
|
+
let [kept, decisions] = await Promise.all([
|
|
319
|
+
memories && g.vocab.comp('memory') ? ask(line`(${sub(at)}) .memory${sub(g.vocab.comp('quarantined') ? line` !quarantined` : line``)}`, 6) : [],
|
|
320
|
+
g.vocab.comp('decision') && g.vocab.comp('decided') ? ask(line`(${sub(at)}) .decision .decided`, 2) : []
|
|
321
|
+
]);
|
|
322
|
+
let ids = [
|
|
323
|
+
...kept,
|
|
324
|
+
...decisions
|
|
325
|
+
].filter((h)=>h.similarity >= floor).map((h)=>h.entity);
|
|
326
|
+
if (!ids.length) return [];
|
|
327
|
+
let rows = await g.get(ids, [
|
|
328
|
+
'doc',
|
|
329
|
+
'content',
|
|
330
|
+
'created',
|
|
331
|
+
'memory',
|
|
332
|
+
'decision',
|
|
333
|
+
'decided'
|
|
334
|
+
]);
|
|
335
|
+
return ids.flatMap((eid)=>rows.filter((b)=>b.entity.eid == eid));
|
|
336
|
+
}
|
|
337
|
+
let holds = (held)=>(b)=>{
|
|
338
|
+
if (!held) return false;
|
|
339
|
+
let { via, at } = part(b, 'created');
|
|
340
|
+
let its = via == held.via || part(b, 'entry').session == held.via;
|
|
341
|
+
return its && String(at ?? '') >= (held.since ?? '');
|
|
342
|
+
};
|
|
343
|
+
/** How many of the person's words, and how many decisions, one written thing
|
|
344
|
+
* is answered with. */ export let FEW = {
|
|
345
|
+
said: 3,
|
|
346
|
+
decided: 2
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* What a person said and decided before that bears on `words`, the text of
|
|
350
|
+
* something an agent just wrote: their nearest earlier words at least `floor`
|
|
351
|
+
* similar (default {@link SAID}), and the nearest answered decisions at least
|
|
352
|
+
* that and {@link FLOOR} similar. What the writing session already `held` is left out.
|
|
353
|
+
* There is no ranking by words here: without a meaning index, or past `wait`
|
|
354
|
+
* milliseconds, nothing bears.
|
|
355
|
+
*/ export function bearing(g, options) {
|
|
356
|
+
let none = {
|
|
357
|
+
said: [],
|
|
358
|
+
decided: []
|
|
359
|
+
};
|
|
360
|
+
let { person, words, before, meaning } = options;
|
|
361
|
+
let floor = options.floor ?? SAID;
|
|
362
|
+
if (!person || !meaning || !words.trim() || !Number.isFinite(Date.parse(before))) return Promise.resolve(none);
|
|
363
|
+
let fresh = (b)=>!holds(options.held)(b);
|
|
364
|
+
let found = async ()=>{
|
|
365
|
+
let name = await named(g, person, options.name);
|
|
366
|
+
let [rows, settled] = await Promise.all([
|
|
367
|
+
nearest(g, meaning, words, theirs(g, {
|
|
368
|
+
person,
|
|
369
|
+
name,
|
|
370
|
+
before
|
|
371
|
+
}), floor),
|
|
372
|
+
decided(g, words, before, meaning, Math.max(floor, FLOOR), false)
|
|
373
|
+
]);
|
|
374
|
+
return {
|
|
375
|
+
said: quotes(g, (rows ?? []).filter(fresh), {
|
|
376
|
+
person,
|
|
377
|
+
name,
|
|
378
|
+
words,
|
|
379
|
+
before
|
|
380
|
+
}, FEW.said),
|
|
381
|
+
decided: settled.filter(fresh).slice(0, FEW.decided)
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
return within(found(), options.wait, none);
|
|
385
|
+
}
|
|
386
|
+
//# sourceMappingURL=earlier.js.map
|
package/earlier.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlier.js","sources":["./earlier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;CAaC,GAED,SAAqB,MAAM,EAAE,IAAI,EAAE,GAAG,2BAAgC;AAEtE,SAAS,KAAK,EAAE,KAAK,EAAE,KAAK,wBAA6B;AACzD,SAAS,MAAM,2BAAgC;AAC/C,SAAS,gBAAgB,EAAE,cAAc,8BAAmC;AAE5E,IAAI,OAAO,CAAC,GAAW,IAAoB,CAAC,CAAC,EAAE,IAAY,CAAC;AAG5D,IAAI,QACF;AACF,IAAI,OACF;AAMF,OAAO,IAAI,gBAAgB,CAAC,SAC1B,OAAO,KAAK,CAAC,QAAQ,OAAO,CAAC,CAAC;IAC5B,IAAI,CAAC,SAAS,GAAG,MAAM,GAAG,MAAM,KAAK,CAAC;IACtC,IAAI,WAAW,SAAS,WAAW,MAAM,OAAO,EAAE;IAClD,OAAO,MAAM,OAAO,CAAC,CAAC;MACpB,IAAI,YAAY,KAAK,OAAO,CAAC;MAC7B,IAAI,YAAY,GAAG,OAAO,EAAE;MAC5B,IAAI,KAAK,KAAK,KAAK,CAAC,GAAG;MACvB,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,OAAO,EAAE;MAChE,IAAI,OAAO,KAAK,KAAK,CAAC,YAAY;MAClC,IAAI,WAAW,OAAO;QACpB,IAAI,SAAS,KAAK,K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