isorite 0.1.0 → 0.2.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.
- package/dist/core.js +125 -2
- package/dist/embed-worker.js +9 -2
- package/dist/main.js +2377 -394
- package/package.json +2 -1
- package/plugin/server.ts +9 -8
- package/plugin/tour.ts +5 -8
- package/web/_app/immutable/assets/0.s5xqevrq.css +1 -0
- package/web/_app/immutable/assets/4.PVZR2_N5.css +1 -0
- package/web/_app/immutable/assets/5.DCxNIgyW.css +1 -0
- package/web/_app/immutable/assets/9.CFA9_nYZ.css +1 -0
- package/web/_app/immutable/assets/FolderField._A4_sc1Z.css +1 -0
- package/web/_app/immutable/assets/NoteEditor.ChlpmyHO.css +1 -0
- package/web/_app/immutable/assets/NoteList.F579Zvj_.css +1 -0
- package/web/_app/immutable/assets/{Timeline.UMF1LjSO.css → Timeline.KTc3LKuK.css} +1 -1
- package/web/_app/immutable/assets/Tutorial.DOfsM49T.css +1 -0
- package/web/_app/immutable/chunks/B0NIb88Q.js +1 -0
- package/web/_app/immutable/chunks/B7ZjnqOt.js +20 -0
- package/web/_app/immutable/chunks/{B-si2ell.js → BEVz4Dgg.js} +1 -1
- package/web/_app/immutable/chunks/BEk5idXo.js +1 -0
- package/web/_app/immutable/chunks/B_nIecMW.js +667 -0
- package/web/_app/immutable/chunks/C8UdwlAg.js +3 -0
- package/web/_app/immutable/chunks/CRzLMJPS.js +1 -0
- package/web/_app/immutable/chunks/CcQ3P3p1.js +13 -0
- package/web/_app/immutable/chunks/CcRs965g.js +1 -0
- package/web/_app/immutable/chunks/Cw2GjAJR.js +1 -0
- package/web/_app/immutable/chunks/DjBHskLm.js +1 -0
- package/web/_app/immutable/chunks/Dm229u8R.js +1 -0
- package/web/_app/immutable/chunks/UM_L7-f7.js +1 -0
- package/web/_app/immutable/chunks/b-AOhhy1.js +1 -0
- package/web/_app/immutable/chunks/k55859zq.js +1 -0
- package/web/_app/immutable/entry/app.B3QXxjjH.js +2 -0
- package/web/_app/immutable/entry/start.BauJm-6k.js +1 -0
- package/web/_app/immutable/nodes/0.DP4c84Wn.js +14 -0
- package/web/_app/immutable/nodes/1.BcwcVDJZ.js +1 -0
- package/web/_app/immutable/nodes/2.DgGnQZ7P.js +1 -0
- package/web/_app/immutable/nodes/3.BudzO7We.js +1 -0
- package/web/_app/immutable/nodes/4.DmswyrSt.js +2 -0
- package/web/_app/immutable/nodes/5.DjXsfjL5.js +5 -0
- package/web/_app/immutable/nodes/6.uBh-sdQx.js +1 -0
- package/web/_app/immutable/nodes/7.BYBNXM1A.js +1 -0
- package/web/_app/immutable/nodes/8.Tbz9Rh77.js +1 -0
- package/web/_app/immutable/nodes/9.NF5w8YC2.js +486 -0
- package/web/_app/immutable/workers/worker-rKDNrEKQ.js +1 -0
- package/web/_app/version.json +1 -1
- package/web/icon-180.png +0 -0
- package/web/icon-192.png +0 -0
- package/web/icon-512.png +0 -0
- package/web/icon-maskable-512.png +0 -0
- package/web/index.html +35 -12
- package/web/manifest.webmanifest +14 -0
- package/web/_app/immutable/assets/0.CbWSsYpm.css +0 -1
- package/web/_app/immutable/assets/3.Bgs8n1LK.css +0 -1
- package/web/_app/immutable/assets/4.CCFEPTFN.css +0 -1
- package/web/_app/immutable/assets/5.BCvLF9Xz.css +0 -1
- package/web/_app/immutable/assets/6.kPo5mcJx.css +0 -1
- package/web/_app/immutable/assets/NoteEditor.Bp-YDqYj.css +0 -1
- package/web/_app/immutable/chunks/BD1Dpm2e.js +0 -3
- package/web/_app/immutable/chunks/C0fpmehI.js +0 -1
- package/web/_app/immutable/chunks/CWYACT2V.js +0 -1
- package/web/_app/immutable/chunks/CdQZ-ArP.js +0 -1
- package/web/_app/immutable/chunks/DN3dk6rD.js +0 -147
- package/web/_app/immutable/chunks/DtAOoM-T.js +0 -1
- package/web/_app/immutable/chunks/DykrN7z5.js +0 -535
- package/web/_app/immutable/chunks/cmGruEKS.js +0 -1
- package/web/_app/immutable/chunks/gRYnlonl.js +0 -1
- package/web/_app/immutable/entry/app.DgJiXIYs.js +0 -2
- package/web/_app/immutable/entry/start.l9vV7NaJ.js +0 -1
- package/web/_app/immutable/nodes/0.DWPeBju2.js +0 -1
- package/web/_app/immutable/nodes/1.CJVDS8FT.js +0 -1
- package/web/_app/immutable/nodes/2.o8ItfT-a.js +0 -1
- package/web/_app/immutable/nodes/3.uhHyOPGK.js +0 -13
- package/web/_app/immutable/nodes/4.BYKkAZTp.js +0 -2
- package/web/_app/immutable/nodes/5.BzEQO7Xv.js +0 -4
- package/web/_app/immutable/nodes/6.GxiAUa6J.js +0 -1
- package/web/_app/immutable/nodes/7.d2Ere8Jb.js +0 -1
- package/web/_app/immutable/nodes/8.CvPHZL8j.js +0 -1
- package/web/_app/immutable/workers/worker-d9GxGKde.js +0 -1
package/dist/core.js
CHANGED
|
@@ -1467,6 +1467,111 @@ function authors(entries) {
|
|
|
1467
1467
|
}
|
|
1468
1468
|
return owners;
|
|
1469
1469
|
}
|
|
1470
|
+
/** A line's words, spaces and marks, in order: what is compared to tell who wrote what within a line. */
|
|
1471
|
+
const tokens = (line) => line.match(/\s+|[\p{L}\p{N}_]+|[^\s\p{L}\p{N}_]/gu) ?? [];
|
|
1472
|
+
/** Who wrote each word of the note as the journal last has it, line by line, as runs. Where a change replaced
|
|
1473
|
+
* lines, the old and the new are compared word by word, so a word kept keeps its writer and only the words put in
|
|
1474
|
+
* are the changer's. Text kept from a proposal is its proposer's, as in `authors`. Null when the chain is broken. */
|
|
1475
|
+
function wordAuthors(entries) {
|
|
1476
|
+
const proposers = /* @__PURE__ */ new Map();
|
|
1477
|
+
let lines = null, text = null;
|
|
1478
|
+
const line = (l, who) => {
|
|
1479
|
+
const t = tokens(l);
|
|
1480
|
+
return {
|
|
1481
|
+
t,
|
|
1482
|
+
w: t.map(() => who)
|
|
1483
|
+
};
|
|
1484
|
+
};
|
|
1485
|
+
for (const e of entries) {
|
|
1486
|
+
if (e.kind === "proposal") proposers.set(e.id, e.who);
|
|
1487
|
+
if (!isChange(e)) continue;
|
|
1488
|
+
const who = e.why === "keep" && e.proposal ? proposers.get(e.proposal) ?? e.who : e.who;
|
|
1489
|
+
if (lines === null || text === null) {
|
|
1490
|
+
if (e.text === void 0) return null;
|
|
1491
|
+
text = e.text.split("\n");
|
|
1492
|
+
lines = text.map((l) => line(l, who));
|
|
1493
|
+
continue;
|
|
1494
|
+
}
|
|
1495
|
+
if (hashText(text.join("\n")) !== e.before) return null;
|
|
1496
|
+
const next = [];
|
|
1497
|
+
let at = 0;
|
|
1498
|
+
for (const h of e.hunks) {
|
|
1499
|
+
next.push(...lines.slice(at, h.at));
|
|
1500
|
+
const old = lines.slice(h.at, h.at + h.del.length);
|
|
1501
|
+
const a = [], aw = [];
|
|
1502
|
+
old.forEach((l, k) => {
|
|
1503
|
+
if (k) {
|
|
1504
|
+
a.push("\n");
|
|
1505
|
+
aw.push("");
|
|
1506
|
+
}
|
|
1507
|
+
a.push(...l.t);
|
|
1508
|
+
aw.push(...l.w);
|
|
1509
|
+
});
|
|
1510
|
+
const b = [];
|
|
1511
|
+
h.ins.forEach((l, k) => {
|
|
1512
|
+
if (k) b.push("\n");
|
|
1513
|
+
b.push(...tokens(l));
|
|
1514
|
+
});
|
|
1515
|
+
const bw = b.map(() => who);
|
|
1516
|
+
const kept = [];
|
|
1517
|
+
let i = 0, j = 0;
|
|
1518
|
+
for (const d of diffLines(a, b)) {
|
|
1519
|
+
while (i < d.at) {
|
|
1520
|
+
kept.push([j, i]);
|
|
1521
|
+
i++;
|
|
1522
|
+
j++;
|
|
1523
|
+
}
|
|
1524
|
+
i += d.del.length;
|
|
1525
|
+
j += d.ins.length;
|
|
1526
|
+
}
|
|
1527
|
+
while (i < a.length && j < b.length) {
|
|
1528
|
+
kept.push([j, i]);
|
|
1529
|
+
i++;
|
|
1530
|
+
j++;
|
|
1531
|
+
}
|
|
1532
|
+
const words = (ts) => ts.filter((t) => /[\p{L}\p{N}]/u.test(t)).length;
|
|
1533
|
+
if (kept.filter(([jj]) => /[\p{L}\p{N}]/u.test(b[jj])).length * 2 >= words(b)) for (const [jj, ii] of kept) bw[jj] = aw[ii];
|
|
1534
|
+
let cur = {
|
|
1535
|
+
t: [],
|
|
1536
|
+
w: []
|
|
1537
|
+
};
|
|
1538
|
+
const made = [];
|
|
1539
|
+
b.forEach((tok, k) => {
|
|
1540
|
+
if (tok === "\n") {
|
|
1541
|
+
made.push(cur);
|
|
1542
|
+
cur = {
|
|
1543
|
+
t: [],
|
|
1544
|
+
w: []
|
|
1545
|
+
};
|
|
1546
|
+
} else {
|
|
1547
|
+
cur.t.push(tok);
|
|
1548
|
+
cur.w.push(bw[k]);
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
if (h.ins.length) made.push(cur);
|
|
1552
|
+
next.push(...made);
|
|
1553
|
+
at = h.at + h.del.length;
|
|
1554
|
+
}
|
|
1555
|
+
next.push(...lines.slice(at));
|
|
1556
|
+
lines = next;
|
|
1557
|
+
text = applyHunks(text, e.hunks);
|
|
1558
|
+
}
|
|
1559
|
+
return (lines ?? []).map((l) => {
|
|
1560
|
+
const runs = [];
|
|
1561
|
+
let pos = 0;
|
|
1562
|
+
l.t.forEach((tok, k) => {
|
|
1563
|
+
const who = l.w[k], last = runs.at(-1);
|
|
1564
|
+
if (last && last.who === who && last.to === pos) last.to += tok.length;
|
|
1565
|
+
else runs.push({
|
|
1566
|
+
from: pos,
|
|
1567
|
+
to: pos + tok.length,
|
|
1568
|
+
who
|
|
1569
|
+
});
|
|
1570
|
+
pos += tok.length;
|
|
1571
|
+
});
|
|
1572
|
+
return runs;
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1470
1575
|
/** The note as it was after an entry. */
|
|
1471
1576
|
const textAt = (entries, id) => replay(entries, id)?.text ?? null;
|
|
1472
1577
|
/** The entry for a change of the note's file to `after`, or null when nothing changed. The difference is taken
|
|
@@ -1678,7 +1783,8 @@ function moments(entries) {
|
|
|
1678
1783
|
const what = e.why === "start" ? e.who === "external" ? "found" : "wrote" : e.why === "edit" ? "edited" : e.why === "restore" ? "restored" : e.why === "keep" ? "kept" : e.why === "move" ? "moved" : "changed elsewhere";
|
|
1679
1784
|
out.push({
|
|
1680
1785
|
...base,
|
|
1681
|
-
what
|
|
1786
|
+
what,
|
|
1787
|
+
...e.asked ? { asked: e.asked } : {}
|
|
1682
1788
|
});
|
|
1683
1789
|
}
|
|
1684
1790
|
}
|
|
@@ -1867,6 +1973,18 @@ function mapModel(base, study = null) {
|
|
|
1867
1973
|
edges
|
|
1868
1974
|
};
|
|
1869
1975
|
}
|
|
1976
|
+
/** The map without the study base: its folders and notes, and the edges to them, left out. The Atlas draws study
|
|
1977
|
+
* folders only in its Understand lens (M10). */
|
|
1978
|
+
function withoutStudy(model) {
|
|
1979
|
+
const strip = (d) => ({
|
|
1980
|
+
...d,
|
|
1981
|
+
children: d.children.filter((c) => !c.study).map((c) => c.kind === "dir" ? strip(c) : c)
|
|
1982
|
+
});
|
|
1983
|
+
return {
|
|
1984
|
+
root: strip(model.root),
|
|
1985
|
+
edges: model.edges.filter(([a, b]) => !a.startsWith("@") && !b.startsWith("@"))
|
|
1986
|
+
};
|
|
1987
|
+
}
|
|
1870
1988
|
/** What lights when a note is chosen on the Atlas (refs, as the map model names notes). Where the base rates its
|
|
1871
1989
|
* links, only "requires" is followed back; where it rates none, every drawn link is. A study note requires what it tests. */
|
|
1872
1990
|
function reach(model, note) {
|
|
@@ -2047,6 +2165,11 @@ function understanding(events, now = Date.now()) {
|
|
|
2047
2165
|
s.last = when;
|
|
2048
2166
|
s.evidence.push(e.id);
|
|
2049
2167
|
}
|
|
2168
|
+
} else if (e.event === "understood" && typeof e.note === "string") {
|
|
2169
|
+
const s = at(e.note), by = e.by;
|
|
2170
|
+
s.level = clamp(s.level + (typeof by === "number" && Number.isFinite(by) ? Math.max(-1, Math.min(1, by)) : 0));
|
|
2171
|
+
s.last = when;
|
|
2172
|
+
s.evidence.push(e.id);
|
|
2050
2173
|
} else if (e.event === "moved" && typeof e.from === "string" && typeof e.to === "string") {
|
|
2051
2174
|
const s = state.get(e.from);
|
|
2052
2175
|
if (s) {
|
|
@@ -2310,4 +2433,4 @@ function ago(at, now = Date.now()) {
|
|
|
2310
2433
|
/** A moment is named by its last entry: the one the note is shown at. */
|
|
2311
2434
|
const momentKey = (m) => m.ids.at(-1);
|
|
2312
2435
|
//#endregion
|
|
2313
|
-
export { Bundle, CONFIG_FILE, Concept, DEVICE_RE, DiffError, Directory, ExerciseError, FrontmatterError, GITATTRIBUTES, ID_RE, INTERVALS, KINDS, LEVELS, LearnerError, MAX_EVENT_BYTES, MAX_WHY, OKF_VERSION, RATINGS, SESSION_GAP_MS, SNAPSHOT_EVERY, STRENGTH, STUDY_DIR, STUDY_FORMAT, STUDY_PREFIX, SearchIndex, StudyError, WORKING, agentName, ago, anchorOf, applyHunks, authors, blocks, change, citeKind, cleanEvent, cmp, cmpTuple, contentHash, describe, diffLines, dumpFrontmatter, dumpStudyConfig, editFrontmatter, exercise, exerciseText, findAnchor, findPassage, floatRepr, frontmatterText, hashText, headings, impliedLinks, insertAt, isStudyId, iso, journalLine, journalPath, legacyId, linkRefs, locate, lowest, mapModel, markingReply, mergeRecords, momentKey, moments, newId, noteIds, pagerank, parseStudyConfig, parseYaml, passageOf, pending, placeMarks, pyRepr, rating, reach, readJournal, readRecord, reconcile, recordPath, replay, round3, section, sessionMoments, sha256, slugify, snippet, spliceText, splitFrontmatter, splitSource, sprout, stamp, stepOf, strengthEdges, strip, stronglyConnected, studyId, studyList, testsOf, text, textAt, toTime, tokenize, touched, understanding, withNext, written };
|
|
2436
|
+
export { Bundle, CONFIG_FILE, Concept, DEVICE_RE, DiffError, Directory, ExerciseError, FrontmatterError, GITATTRIBUTES, ID_RE, INTERVALS, KINDS, LEVELS, LearnerError, MAX_EVENT_BYTES, MAX_WHY, OKF_VERSION, RATINGS, SESSION_GAP_MS, SNAPSHOT_EVERY, STRENGTH, STUDY_DIR, STUDY_FORMAT, STUDY_PREFIX, SearchIndex, StudyError, WORKING, agentName, ago, anchorOf, applyHunks, authors, blocks, change, citeKind, cleanEvent, cmp, cmpTuple, contentHash, describe, diffLines, dumpFrontmatter, dumpStudyConfig, editFrontmatter, exercise, exerciseText, findAnchor, findPassage, floatRepr, frontmatterText, hashText, headings, impliedLinks, insertAt, isStudyId, iso, journalLine, journalPath, legacyId, linkRefs, locate, lowest, mapModel, markingReply, mergeRecords, momentKey, moments, newId, noteIds, pagerank, parseStudyConfig, parseYaml, passageOf, pending, placeMarks, pyRepr, rating, reach, readJournal, readRecord, reconcile, recordPath, replay, round3, section, sessionMoments, sha256, slugify, snippet, spliceText, splitFrontmatter, splitSource, sprout, stamp, stepOf, strengthEdges, strip, stronglyConnected, studyId, studyList, testsOf, text, textAt, toTime, tokenize, touched, understanding, withNext, withoutStudy, wordAuthors, written };
|
package/dist/embed-worker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { parentPort, workerData } from "node:worker_threads";
|
|
@@ -3220,7 +3220,14 @@ const WASM = "ort-wasm-simd-threaded.wasm";
|
|
|
3220
3220
|
const beside = join(dirname(fileURLToPath(import.meta.url)), WASM);
|
|
3221
3221
|
ort.env.wasm.wasmBinary = readFileSync(existsSync(beside) ? beside : join(dirname(createRequire(import.meta.url).resolve("onnxruntime-web")), WASM));
|
|
3222
3222
|
const tok = new Tokenizer(JSON.parse(readFileSync(join(dir, "tokenizer.json"), "utf8")), JSON.parse(readFileSync(join(dir, "tokenizer_config.json"), "utf8")));
|
|
3223
|
-
const
|
|
3223
|
+
const externalData = readdirSync(dir).filter((f) => f.endsWith(".onnx_data")).map((path) => ({
|
|
3224
|
+
path,
|
|
3225
|
+
data: readFileSync(join(dir, path))
|
|
3226
|
+
}));
|
|
3227
|
+
const session = await ort.InferenceSession.create(readFileSync(join(dir, "model.onnx")), {
|
|
3228
|
+
executionProviders: ["wasm"],
|
|
3229
|
+
externalData
|
|
3230
|
+
});
|
|
3224
3231
|
const typed = session.inputNames.includes("token_type_ids");
|
|
3225
3232
|
async function embed(text) {
|
|
3226
3233
|
let ids = tok.encode(text).ids;
|