@gmickel/gno 2.7.1 → 2.8.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/README.md +3 -2
- package/assets/skill/SKILL.md +8 -1
- package/assets/skill/cli-reference.md +8 -1
- package/assets/skill/examples.md +2 -1
- package/assets/skill/mcp-reference.md +3 -1
- package/assets/spa-production.json.gz +0 -0
- package/browser-extension/artifacts/{gno-browser-clipper-v2.7.1.zip → gno-browser-clipper-v2.8.0.zip} +0 -0
- package/browser-extension/artifacts/gno-browser-clipper-v2.8.0.zip.sha256 +1 -0
- package/browser-extension/dist/manifest.json +1 -1
- package/package.json +1 -1
- package/spec/cli.md +48 -6
- package/spec/db/schema.sql +0 -1
- package/spec/mcp.md +18 -3
- package/spec/output-schemas/audit-report.schema.json +18 -4
- package/spec/output-schemas/backlinks.schema.json +4 -0
- package/spec/output-schemas/collection-list.schema.json +13 -0
- package/spec/output-schemas/graph.schema.json +2 -0
- package/spec/output-schemas/links-list.schema.json +4 -0
- package/spec/output-schemas/status.schema.json +15 -0
- package/src/cli/commands/audit.ts +23 -4
- package/src/cli/commands/collection/list.ts +39 -5
- package/src/cli/commands/embed.ts +3 -3
- package/src/cli/commands/links.ts +34 -131
- package/src/cli/commands/shared.ts +7 -0
- package/src/cli/commands/status.ts +5 -0
- package/src/cli/program.ts +12 -2
- package/src/config/loader.ts +43 -0
- package/src/config/types.ts +8 -0
- package/src/core/audit-contract.ts +16 -4
- package/src/core/audit-freshness.ts +11 -1
- package/src/core/audit-links.ts +145 -25
- package/src/core/audit-provenance.ts +11 -4
- package/src/core/audit-workspace.ts +19 -4
- package/src/core/audit.ts +67 -15
- package/src/core/context-compiler.ts +3 -0
- package/src/core/context-evidence.ts +11 -0
- package/src/core/graph-edge-confidence.ts +23 -1
- package/src/core/host-paths.ts +1 -0
- package/src/core/knowledge-impact.ts +28 -0
- package/src/core/link-workspace.ts +324 -0
- package/src/core/retrieval-replay-candidate.ts +6 -0
- package/src/core/retrieval-trace-request.ts +3 -0
- package/src/index.ts +14 -1
- package/src/ingestion/graph-reconciliation.ts +77 -15
- package/src/ingestion/source-availability/darwin-path.ts +9 -3
- package/src/ingestion/sync.ts +22 -1
- package/src/ingestion/types.ts +14 -0
- package/src/llm/inference-scope.ts +4 -3
- package/src/mcp/http-egress.ts +42 -3
- package/src/mcp/tools/audit.ts +11 -2
- package/src/mcp/tools/changes.ts +1 -0
- package/src/mcp/tools/links.ts +3 -0
- package/src/mcp/tools/sessions.ts +33 -4
- package/src/mcp/tools/status.ts +3 -0
- package/src/pipeline/expansion.ts +19 -31
- package/src/pipeline/graph-retrieval.ts +22 -2
- package/src/pipeline/hybrid.ts +1 -1
- package/src/pipeline/types.ts +6 -3
- package/src/serve/findings-pass.ts +1 -1
- package/src/serve/public/pages/GraphView.tsx +2 -0
- package/src/serve/routes/changes.ts +6 -1
- package/src/serve/routes/links.ts +13 -0
- package/src/serve/routes/sessions.ts +41 -53
- package/src/sessions/config-refresh.ts +111 -0
- package/src/store/migrations/033-drop-documents-active-index.ts +30 -0
- package/src/store/migrations/034-collection-link-workspace.ts +47 -0
- package/src/store/migrations/index.ts +4 -0
- package/src/store/sqlite/adapter.ts +390 -231
- package/src/store/sqlite/eligibility.ts +8 -2
- package/src/store/sqlite/graph-link-resolver.ts +252 -5
- package/src/store/sqlite/graph-neighbors.ts +147 -40
- package/src/store/sqlite/graph-reference-state.ts +13 -2
- package/src/store/sqlite/workspace-link-resolver.ts +654 -0
- package/src/store/types.ts +49 -3
- package/src/store/vector/stats.ts +1 -1
- package/browser-extension/artifacts/gno-browser-clipper-v2.7.1.zip.sha256 +0 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keep a running server's session-archive config current with its config
|
|
3
|
+
* file. `gno sessions source add/remove` and automation changes rewrite the
|
|
4
|
+
* file from another process; the REST routes and the MCP session tools both
|
|
5
|
+
* re-read it here, binding checked, and adopt it only when it changed.
|
|
6
|
+
*
|
|
7
|
+
* @module src/sessions/config-refresh
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { Config } from "../config/types";
|
|
11
|
+
import type { SqliteAdapter } from "../store/sqlite/adapter";
|
|
12
|
+
|
|
13
|
+
import { getIndexDbPath } from "../app/constants";
|
|
14
|
+
import { loadConfig } from "../config";
|
|
15
|
+
import { collectionEgressPolicyEpoch } from "../core/collection-egress-policy-service";
|
|
16
|
+
import { assertSessionBinding } from "./binding";
|
|
17
|
+
import { SessionsError } from "./types";
|
|
18
|
+
|
|
19
|
+
/** The config/index pair a server instance was opened on. */
|
|
20
|
+
export interface SessionsInstance {
|
|
21
|
+
configPath: string;
|
|
22
|
+
indexName: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** A running server's served config and the hooks that follow a swap. */
|
|
26
|
+
export interface ServedSessionsConfig extends SessionsInstance {
|
|
27
|
+
store: SqliteAdapter;
|
|
28
|
+
config: Config;
|
|
29
|
+
/** Swap the served config in memory (and anything derived from it). */
|
|
30
|
+
setConfig: (config: Config) => void;
|
|
31
|
+
invalidateEgressPolicy?: () => Promise<unknown>;
|
|
32
|
+
markContentMutation?: () => void;
|
|
33
|
+
markIndexMutation?: () => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Refuse an archive config opened against a different index (and vice versa). */
|
|
37
|
+
export async function assertInstanceBinding(
|
|
38
|
+
instance: SessionsInstance,
|
|
39
|
+
config: Config
|
|
40
|
+
): Promise<void> {
|
|
41
|
+
if (!config.sessions) return;
|
|
42
|
+
await assertSessionBinding({
|
|
43
|
+
config,
|
|
44
|
+
configPath: instance.configPath,
|
|
45
|
+
indexName: instance.indexName,
|
|
46
|
+
dbPath: getIndexDbPath(instance.indexName),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Read this instance's config file, binding checked: unreadable is an error,
|
|
52
|
+
* never served stale, and a config rebound to another index is refused
|
|
53
|
+
* before it can touch this one.
|
|
54
|
+
*/
|
|
55
|
+
export async function readInstanceConfig(
|
|
56
|
+
instance: SessionsInstance
|
|
57
|
+
): Promise<Config> {
|
|
58
|
+
const loaded = await loadConfig(instance.configPath);
|
|
59
|
+
if (!loaded.ok) {
|
|
60
|
+
throw new SessionsError(
|
|
61
|
+
"SESSIONS_RUNTIME_FAILURE",
|
|
62
|
+
"The server could not read its config file; fix the file (gno doctor shows the error) and reload."
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
await assertInstanceBinding(instance, loaded.value);
|
|
66
|
+
return loaded.value;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Adopt a config already persisted to the file: project collections and
|
|
71
|
+
* contexts into the open store, swap the served config, then refresh the
|
|
72
|
+
* egress policy (only when it changed) and mutation generations.
|
|
73
|
+
*/
|
|
74
|
+
export async function adoptServedConfig(
|
|
75
|
+
served: ServedSessionsConfig,
|
|
76
|
+
config: Config
|
|
77
|
+
): Promise<void> {
|
|
78
|
+
const collections = await served.store.syncCollections(config.collections);
|
|
79
|
+
if (!collections.ok) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
`Config saved but collection sync failed: ${collections.error.message}`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
const contexts = await served.store.syncContexts(config.contexts ?? []);
|
|
85
|
+
if (!contexts.ok) {
|
|
86
|
+
throw new Error(
|
|
87
|
+
`Config saved but context sync failed: ${contexts.error.message}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
const policyChanged =
|
|
91
|
+
collectionEgressPolicyEpoch(config) !==
|
|
92
|
+
collectionEgressPolicyEpoch(served.config);
|
|
93
|
+
served.setConfig(config);
|
|
94
|
+
if (policyChanged) await served.invalidateEgressPolicy?.();
|
|
95
|
+
served.markContentMutation?.();
|
|
96
|
+
served.markIndexMutation?.();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Adopt the config file when it changed underneath the running server.
|
|
101
|
+
* Returns the config to serve; throws a `SessionsError` when the file is
|
|
102
|
+
* unreadable or bound to another index, leaving the served config as it was.
|
|
103
|
+
*/
|
|
104
|
+
export async function refreshServedConfig(
|
|
105
|
+
served: ServedSessionsConfig
|
|
106
|
+
): Promise<Config> {
|
|
107
|
+
const config = await readInstanceConfig(served);
|
|
108
|
+
if (Bun.deepEquals(config, served.config)) return served.config;
|
|
109
|
+
await adoptServedConfig(served, config);
|
|
110
|
+
return config;
|
|
111
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration: drop the low-selectivity documents(active) index.
|
|
3
|
+
*
|
|
4
|
+
* GNO keeps no planner statistics, so SQLite treated `idx_documents_active`
|
|
5
|
+
* (matching nearly every row) as a peer of selective indexes and chose it
|
|
6
|
+
* for `<column> = ? AND active = 1` lookups, turning point lookups and
|
|
7
|
+
* per-chunk EXISTS probes into whole-table walks. No query filters on
|
|
8
|
+
* inactive documents, so the index serves no lookup.
|
|
9
|
+
*
|
|
10
|
+
* @module src/store/migrations/033-drop-documents-active-index
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { Database } from "bun:sqlite";
|
|
14
|
+
|
|
15
|
+
import type { Migration } from "./runner";
|
|
16
|
+
|
|
17
|
+
export const migration: Migration = {
|
|
18
|
+
version: 33,
|
|
19
|
+
name: "drop_documents_active_index",
|
|
20
|
+
|
|
21
|
+
up(db: Database): void {
|
|
22
|
+
db.exec("DROP INDEX IF EXISTS idx_documents_active");
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
down(db: Database): void {
|
|
26
|
+
db.exec(
|
|
27
|
+
"CREATE INDEX IF NOT EXISTS idx_documents_active ON documents(active)"
|
|
28
|
+
);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store each collection's effective link workspace (derived from the
|
|
3
|
+
* filesystem at config sync) so query-time link resolution, status output
|
|
4
|
+
* and graph projection fingerprints read one consistent membership.
|
|
5
|
+
*/
|
|
6
|
+
import type { Migration } from "./runner";
|
|
7
|
+
|
|
8
|
+
const COLUMNS: Array<[string, string]> = [
|
|
9
|
+
["real_path", "TEXT"],
|
|
10
|
+
["workspace_root", "TEXT"],
|
|
11
|
+
[
|
|
12
|
+
"workspace_source",
|
|
13
|
+
"TEXT NOT NULL DEFAULT 'none' CHECK (workspace_source IN ('none', 'detected', 'configured', 'disabled', 'unavailable'))",
|
|
14
|
+
],
|
|
15
|
+
["workspace_nested", "TEXT"],
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const existingColumns = (db: Parameters<Migration["up"]>[0]): Set<string> =>
|
|
19
|
+
new Set(
|
|
20
|
+
db
|
|
21
|
+
.query<{ name: string }, []>("PRAGMA table_info(collections)")
|
|
22
|
+
.all()
|
|
23
|
+
.map((row) => row.name)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const migration: Migration = {
|
|
27
|
+
version: 34,
|
|
28
|
+
name: "collection_link_workspace",
|
|
29
|
+
|
|
30
|
+
up(db): void {
|
|
31
|
+
const columns = existingColumns(db);
|
|
32
|
+
for (const [name, definition] of COLUMNS) {
|
|
33
|
+
if (!columns.has(name)) {
|
|
34
|
+
db.exec(`ALTER TABLE collections ADD COLUMN ${name} ${definition}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
down(db): void {
|
|
40
|
+
const columns = existingColumns(db);
|
|
41
|
+
for (const [name] of [...COLUMNS].reverse()) {
|
|
42
|
+
if (columns.has(name)) {
|
|
43
|
+
db.exec(`ALTER TABLE collections DROP COLUMN ${name}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -46,6 +46,8 @@ import { migration as m029 } from "./029-graph-reference-state";
|
|
|
46
46
|
import { migration as m030 } from "./030-typed-metadata";
|
|
47
47
|
import { migration as m031 } from "./031-runtime-independent-vectors";
|
|
48
48
|
import { migration as m032 } from "./032-vector-runtime-callers";
|
|
49
|
+
import { migration as m033 } from "./033-drop-documents-active-index";
|
|
50
|
+
import { migration as m034 } from "./034-collection-link-workspace";
|
|
49
51
|
|
|
50
52
|
/** All migrations in order */
|
|
51
53
|
export const migrations = [
|
|
@@ -81,4 +83,6 @@ export const migrations = [
|
|
|
81
83
|
m030,
|
|
82
84
|
m031,
|
|
83
85
|
m032,
|
|
86
|
+
m033,
|
|
87
|
+
m034,
|
|
84
88
|
];
|