@cleocode/core 2026.6.7 → 2026.6.8
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/db/index.d.ts +5 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +5 -1
- package/dist/db/index.js.map +1 -1
- package/dist/docs/build-provenance-graph.d.ts +12 -0
- package/dist/docs/build-provenance-graph.d.ts.map +1 -1
- package/dist/docs/build-provenance-graph.js +52 -0
- package/dist/docs/build-provenance-graph.js.map +1 -1
- package/dist/docs/docs-read-model.d.ts +40 -0
- package/dist/docs/docs-read-model.d.ts.map +1 -1
- package/dist/docs/docs-read-model.js +29 -0
- package/dist/docs/docs-read-model.js.map +1 -1
- package/dist/docs/export-document.js +897 -730
- package/dist/docs/export-document.js.map +3 -3
- package/dist/docs/index.d.ts +4 -0
- package/dist/docs/index.d.ts.map +1 -1
- package/dist/docs/index.js +2 -0
- package/dist/docs/index.js.map +1 -1
- package/dist/docs/read-doc.d.ts +60 -0
- package/dist/docs/read-doc.d.ts.map +1 -0
- package/dist/docs/read-doc.js +188 -0
- package/dist/docs/read-doc.js.map +1 -0
- package/dist/docs/wikilinks.d.ts +119 -0
- package/dist/docs/wikilinks.d.ts.map +1 -0
- package/dist/docs/wikilinks.js +217 -0
- package/dist/docs/wikilinks.js.map +1 -0
- package/dist/llm/plugin-facade.js +941 -776
- package/dist/llm/plugin-facade.js.map +3 -3
- package/dist/store/dual-scope-db.d.ts +83 -0
- package/dist/store/dual-scope-db.d.ts.map +1 -1
- package/dist/store/dual-scope-db.js +135 -6
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/exodus/abort-events.d.ts +116 -0
- package/dist/store/exodus/abort-events.d.ts.map +1 -0
- package/dist/store/exodus/abort-events.js +130 -0
- package/dist/store/exodus/abort-events.js.map +1 -0
- package/dist/store/exodus/index.d.ts +1 -0
- package/dist/store/exodus/index.d.ts.map +1 -1
- package/dist/store/exodus/index.js +1 -0
- package/dist/store/exodus/index.js.map +1 -1
- package/dist/store/repair-malformed-dbs.d.ts +87 -0
- package/dist/store/repair-malformed-dbs.d.ts.map +1 -0
- package/dist/store/repair-malformed-dbs.js +188 -0
- package/dist/store/repair-malformed-dbs.js.map +1 -0
- package/dist/store/schema/attachments.d.ts +133 -0
- package/dist/store/schema/attachments.d.ts.map +1 -1
- package/dist/store/schema/attachments.js +63 -0
- package/dist/store/schema/attachments.js.map +1 -1
- package/migrations/drizzle-tasks/20260605000001_t11826-docs-wikilinks/migration.sql +110 -0
- package/package.json +12 -12
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
-- T11826 — `docs_wikilinks`: a DERIVED, slug-addressed edge table for the docs
|
|
2
|
+
-- provenance graph (ratified Docs-SSoT model, saga T11778).
|
|
3
|
+
--
|
|
4
|
+
-- Background:
|
|
5
|
+
-- `cleo.db` is the SOLE doc authority. `docs_wikilinks` is NOT an
|
|
6
|
+
-- authoritative input surface — it is a minimal edge table DERIVED from the
|
|
7
|
+
-- three provenance columns already on `attachments`:
|
|
8
|
+
-- - `supersedes` → newer→older edges (+ reverse `superseded-by`)
|
|
9
|
+
-- - `related_tasks` → doc→T#### edges (JSON array, exploded via json_each)
|
|
10
|
+
-- - `topics` → doc↔doc co-membership edges (shared topic slug)
|
|
11
|
+
-- It makes the bidirectional backlink graph queryable in O(edges) for the
|
|
12
|
+
-- Obsidian plugin (T11827) without recomputing the BFS. The derivation is
|
|
13
|
+
-- rebuilt idempotently by `rebuildDocsWikilinks` (docs/wikilinks.ts); this
|
|
14
|
+
-- migration creates the table and seeds the initial backfill.
|
|
15
|
+
--
|
|
16
|
+
-- Edges are slug-primary (vault links are slug-addressed and survive
|
|
17
|
+
-- attachment-id churn across doc versions). `to_is_task = 1` marks a
|
|
18
|
+
-- `related-task` edge whose `to_slug` is a `T####` id rather than a doc slug.
|
|
19
|
+
-- No markdown body `[[link]]` parsing is performed (AC4) — edges derive purely
|
|
20
|
+
-- from structured provenance columns.
|
|
21
|
+
--
|
|
22
|
+
-- Changes (idempotent — safe to re-run):
|
|
23
|
+
-- 1. CREATE TABLE docs_wikilinks(from_slug, to_slug, relation, to_is_task,
|
|
24
|
+
-- derived_at) with a composite PK + supporting indices.
|
|
25
|
+
-- 2. Backfill `supersedes` + `superseded-by` doc→doc edges by joining
|
|
26
|
+
-- `attachments` to itself on the supersedes/superseded_by FK and resolving
|
|
27
|
+
-- both endpoints to their slugs.
|
|
28
|
+
-- 3. Backfill `related-task` doc→T#### edges by exploding `related_tasks`
|
|
29
|
+
-- JSON arrays via json_each.
|
|
30
|
+
-- 4. Backfill `topic` doc↔doc edges: any two distinct slugged docs that share
|
|
31
|
+
-- a topic slug (json_each over `topics`) get a symmetric pair of edges.
|
|
32
|
+
-- INSERT OR IGNORE coalesces re-runs against the composite primary key.
|
|
33
|
+
--
|
|
34
|
+
-- DEPENDS ON: 20260524000000_t10158-docs-provenance-columns (adds supersedes /
|
|
35
|
+
-- superseded_by / topics / related_tasks to `attachments`)
|
|
36
|
+
-- SAFE FOR: SQLite 3.35+ (CREATE TABLE IF NOT EXISTS + INSERT OR IGNORE)
|
|
37
|
+
--
|
|
38
|
+
-- @task T11826
|
|
39
|
+
-- @epic T11781 (E3-OBSIDIAN-INTEGRATION)
|
|
40
|
+
-- @saga T11778 (SG-DOCS-SSOT-VAULT)
|
|
41
|
+
|
|
42
|
+
CREATE TABLE IF NOT EXISTS `docs_wikilinks` (
|
|
43
|
+
`from_slug` text NOT NULL,
|
|
44
|
+
`to_slug` text NOT NULL,
|
|
45
|
+
`relation` text NOT NULL,
|
|
46
|
+
`to_is_task` integer NOT NULL DEFAULT 0,
|
|
47
|
+
`derived_at` text NOT NULL DEFAULT (datetime('now')),
|
|
48
|
+
CONSTRAINT `docs_wikilinks_pk` PRIMARY KEY(`from_slug`, `to_slug`, `relation`)
|
|
49
|
+
);
|
|
50
|
+
--> statement-breakpoint
|
|
51
|
+
|
|
52
|
+
CREATE INDEX IF NOT EXISTS `idx_docs_wikilinks_from` ON `docs_wikilinks` (`from_slug`);
|
|
53
|
+
--> statement-breakpoint
|
|
54
|
+
CREATE INDEX IF NOT EXISTS `idx_docs_wikilinks_to` ON `docs_wikilinks` (`to_slug`);
|
|
55
|
+
--> statement-breakpoint
|
|
56
|
+
CREATE INDEX IF NOT EXISTS `idx_docs_wikilinks_relation` ON `docs_wikilinks` (`relation`);
|
|
57
|
+
--> statement-breakpoint
|
|
58
|
+
|
|
59
|
+
-- (2) supersedes: newer (a) → older (a.supersedes) doc→doc edge.
|
|
60
|
+
INSERT OR IGNORE INTO `docs_wikilinks` (`from_slug`, `to_slug`, `relation`, `to_is_task`)
|
|
61
|
+
SELECT a.`slug`, b.`slug`, 'supersedes', 0
|
|
62
|
+
FROM `attachments` AS a
|
|
63
|
+
JOIN `attachments` AS b ON b.`id` = a.`supersedes`
|
|
64
|
+
WHERE a.`slug` IS NOT NULL
|
|
65
|
+
AND b.`slug` IS NOT NULL
|
|
66
|
+
AND a.`supersedes` IS NOT NULL;
|
|
67
|
+
--> statement-breakpoint
|
|
68
|
+
|
|
69
|
+
-- (2b) superseded-by: older (a) → newer (a.superseded_by) doc→doc reverse edge.
|
|
70
|
+
INSERT OR IGNORE INTO `docs_wikilinks` (`from_slug`, `to_slug`, `relation`, `to_is_task`)
|
|
71
|
+
SELECT a.`slug`, b.`slug`, 'superseded-by', 0
|
|
72
|
+
FROM `attachments` AS a
|
|
73
|
+
JOIN `attachments` AS b ON b.`id` = a.`superseded_by`
|
|
74
|
+
WHERE a.`slug` IS NOT NULL
|
|
75
|
+
AND b.`slug` IS NOT NULL
|
|
76
|
+
AND a.`superseded_by` IS NOT NULL;
|
|
77
|
+
--> statement-breakpoint
|
|
78
|
+
|
|
79
|
+
-- (3) related-task: doc → T#### edge from the related_tasks JSON array.
|
|
80
|
+
INSERT OR IGNORE INTO `docs_wikilinks` (`from_slug`, `to_slug`, `relation`, `to_is_task`)
|
|
81
|
+
SELECT a.`slug`, je.`value`, 'related-task', 1
|
|
82
|
+
FROM `attachments` AS a,
|
|
83
|
+
json_each(a.`related_tasks`) AS je
|
|
84
|
+
WHERE a.`slug` IS NOT NULL
|
|
85
|
+
AND a.`related_tasks` IS NOT NULL
|
|
86
|
+
AND json_valid(a.`related_tasks`)
|
|
87
|
+
AND json_type(a.`related_tasks`) = 'array'
|
|
88
|
+
AND je.`value` IS NOT NULL;
|
|
89
|
+
--> statement-breakpoint
|
|
90
|
+
|
|
91
|
+
-- (4) topic: symmetric doc↔doc edge for any two distinct slugged docs sharing a
|
|
92
|
+
-- topic slug. The self-join over json_each(topics) produces both directions
|
|
93
|
+
-- because (a,b) and (b,a) are both yielded when a.slug <> b.slug.
|
|
94
|
+
INSERT OR IGNORE INTO `docs_wikilinks` (`from_slug`, `to_slug`, `relation`, `to_is_task`)
|
|
95
|
+
SELECT a.`slug`, b.`slug`, 'topic', 0
|
|
96
|
+
FROM `attachments` AS a,
|
|
97
|
+
json_each(a.`topics`) AS ta,
|
|
98
|
+
`attachments` AS b,
|
|
99
|
+
json_each(b.`topics`) AS tb
|
|
100
|
+
WHERE a.`slug` IS NOT NULL
|
|
101
|
+
AND b.`slug` IS NOT NULL
|
|
102
|
+
AND a.`slug` <> b.`slug`
|
|
103
|
+
AND a.`topics` IS NOT NULL
|
|
104
|
+
AND b.`topics` IS NOT NULL
|
|
105
|
+
AND json_valid(a.`topics`)
|
|
106
|
+
AND json_valid(b.`topics`)
|
|
107
|
+
AND json_type(a.`topics`) = 'array'
|
|
108
|
+
AND json_type(b.`topics`) = 'array'
|
|
109
|
+
AND ta.`value` = tb.`value`
|
|
110
|
+
AND ta.`value` IS NOT NULL;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/core",
|
|
3
|
-
"version": "2026.6.
|
|
3
|
+
"version": "2026.6.8",
|
|
4
4
|
"description": "CLEO core business logic kernel — tasks, sessions, memory, orchestration, lifecycle, with bundled SQLite store",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -429,16 +429,16 @@
|
|
|
429
429
|
"write-file-atomic": "^7.0.1",
|
|
430
430
|
"yaml": "^2.8.3",
|
|
431
431
|
"zod": "^4.3.6",
|
|
432
|
-
"@cleocode/adapters": "2026.6.
|
|
433
|
-
"@cleocode/
|
|
434
|
-
"@cleocode/
|
|
435
|
-
"@cleocode/
|
|
436
|
-
"@cleocode/
|
|
437
|
-
"@cleocode/lafs": "2026.6.
|
|
438
|
-
"@cleocode/
|
|
439
|
-
"@cleocode/
|
|
440
|
-
"@cleocode/
|
|
441
|
-
"@cleocode/
|
|
432
|
+
"@cleocode/adapters": "2026.6.8",
|
|
433
|
+
"@cleocode/agents": "2026.6.8",
|
|
434
|
+
"@cleocode/caamp": "2026.6.8",
|
|
435
|
+
"@cleocode/git-shim": "2026.6.8",
|
|
436
|
+
"@cleocode/contracts": "2026.6.8",
|
|
437
|
+
"@cleocode/lafs": "2026.6.8",
|
|
438
|
+
"@cleocode/paths": "2026.6.8",
|
|
439
|
+
"@cleocode/nexus": "2026.6.8",
|
|
440
|
+
"@cleocode/worktree": "2026.6.8",
|
|
441
|
+
"@cleocode/skills": "2026.6.8"
|
|
442
442
|
},
|
|
443
443
|
"engines": {
|
|
444
444
|
"node": ">=24.16.0"
|
|
@@ -472,7 +472,7 @@
|
|
|
472
472
|
},
|
|
473
473
|
"optionalDependencies": {
|
|
474
474
|
"llmtxt": "^2026.5.15",
|
|
475
|
-
"@cleocode/studio": "^2026.6.
|
|
475
|
+
"@cleocode/studio": "^2026.6.8"
|
|
476
476
|
},
|
|
477
477
|
"scripts": {
|
|
478
478
|
"build": "tsc",
|