@avantf/dsh-mem 0.6.4 → 0.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 +19 -10
- package/lib/client.js +1665 -3466
- package/lib/dsh-build.json +6 -5
- package/lib/engine/graph-recall/in-memory.d.ts +93 -0
- package/lib/engine/graph-recall/index.d.ts +22 -0
- package/lib/engine/graph-recall/traverse.d.ts +119 -0
- package/lib/engine/graph-recall/types.d.ts +188 -0
- package/lib/engine/mem/config/config_files.d.ts +1 -1
- package/lib/engine/mem/config/loader.d.ts +2 -3
- package/lib/engine/mem/config/paths.d.ts +2 -13
- package/lib/engine/mem/db/dao/contradictions.d.ts +4 -22
- package/lib/engine/mem/db/dao/entities.d.ts +80 -7
- package/lib/engine/mem/db/dao/fact_sources.d.ts +3 -13
- package/lib/engine/mem/db/dao/facts.d.ts +311 -56
- package/lib/engine/mem/db/dao/triples.d.ts +1 -26
- package/lib/engine/mem/db/graph.d.ts +249 -0
- package/lib/engine/mem/db/journal_notes.d.ts +35 -0
- package/lib/engine/mem/db/migrations.d.ts +9 -0
- package/lib/engine/mem/db/port.d.ts +22 -3
- package/lib/engine/mem/db/schema.d.ts +119 -0
- package/lib/engine/mem/db/tokenizer.d.ts +9 -0
- package/lib/engine/mem/dbdrivers/fake/driver.d.ts +75 -0
- package/lib/engine/mem/dbdrivers/fake/index.d.ts +7 -0
- package/lib/engine/mem/dbdrivers/fake/surface.d.ts +34 -0
- package/lib/engine/mem/dbdrivers/fake/transport.d.ts +61 -0
- package/lib/engine/mem/dbdrivers/sqlite/connection.d.ts +14 -0
- package/lib/engine/mem/dbdrivers/sqlite/contradictions.d.ts +35 -0
- package/lib/engine/mem/dbdrivers/sqlite/dao/index.d.ts +16 -0
- package/lib/engine/mem/dbdrivers/sqlite/driver.d.ts +54 -0
- package/lib/engine/mem/dbdrivers/sqlite/facts.d.ts +117 -0
- package/lib/engine/mem/dbdrivers/sqlite/index.d.ts +6 -0
- package/lib/engine/mem/dbdrivers/sqlite/migrations.d.ts +15 -0
- package/lib/engine/mem/dbdrivers/sqlite/relations.d.ts +62 -0
- package/lib/engine/mem/dbdrivers/sqlite/search.d.ts +56 -0
- package/lib/engine/mem/dbdrivers/sqlite/sources.d.ts +37 -0
- package/lib/engine/mem/defaults.d.ts +3 -4
- package/lib/engine/mem/dispatch.d.ts +7 -32
- package/lib/engine/mem/entities/extract.d.ts +44 -47
- package/lib/engine/mem/eval/derived_runner.d.ts +6 -1
- package/lib/engine/mem/eval/relation_gold.d.ts +251 -0
- package/lib/engine/mem/eval/write_metrics.d.ts +1 -1
- package/lib/engine/mem/facts_io.d.ts +328 -0
- package/lib/engine/mem/index.d.ts +10 -2
- package/lib/engine/mem/interfaces/capabilities.d.ts +30 -0
- package/lib/engine/mem/interfaces/common.d.ts +11 -0
- package/lib/engine/mem/interfaces/errors.d.ts +65 -0
- package/lib/engine/mem/interfaces/index.d.ts +18 -0
- package/lib/engine/mem/interfaces/migrations.d.ts +21 -0
- package/lib/engine/mem/interfaces/repositories.d.ts +471 -0
- package/lib/engine/mem/interfaces/search_index.d.ts +113 -0
- package/lib/engine/mem/interfaces/storage_backend.d.ts +84 -0
- package/lib/engine/mem/interfaces/storage_driver.d.ts +43 -0
- package/lib/engine/mem/interfaces/version.d.ts +34 -0
- package/lib/engine/mem/lifecycle/contradiction.d.ts +2 -2
- package/lib/engine/mem/maintenance_paths.d.ts +41 -0
- package/lib/engine/mem/modelBootstrap.d.ts +1 -1
- package/lib/engine/mem/relations/confidence.d.ts +39 -0
- package/lib/engine/mem/relations/extract.d.ts +128 -0
- package/lib/engine/mem/relations/index.d.ts +32 -0
- package/lib/engine/mem/relations/name-quality.d.ts +78 -0
- package/lib/engine/mem/relations/normalize.d.ts +275 -0
- package/lib/engine/mem/relations/patterns.d.ts +67 -0
- package/lib/engine/mem/relations/statement.d.ts +88 -0
- package/lib/engine/mem/relations/types.d.ts +79 -0
- package/lib/engine/mem/runtime.d.ts +117 -90
- package/lib/engine/mem/storage/create.d.ts +42 -0
- package/lib/engine/mem/storage/errors.d.ts +65 -0
- package/lib/engine/mem/storage/index.d.ts +15 -0
- package/lib/engine/mem/storage/ports.d.ts +472 -0
- package/lib/engine/mem/storage/registry.d.ts +37 -0
- package/lib/engine/mem/storage/sqlite.d.ts +28 -0
- package/lib/engine/mem/store/common.d.ts +1 -1
- package/lib/engine/mem/store/entity_leg.d.ts +59 -2
- package/lib/engine/mem/store/entity_sweep.d.ts +4 -3
- package/lib/engine/mem/store/explicit_relations.d.ts +52 -0
- package/lib/engine/mem/store/facts_restore.d.ts +124 -0
- package/lib/engine/mem/store/floors.d.ts +4 -1
- package/lib/engine/mem/store/graph_reader.d.ts +146 -0
- package/lib/engine/mem/store/hybrid.d.ts +50 -13
- package/lib/engine/mem/store/kinds.d.ts +47 -0
- package/lib/engine/mem/store/legs.d.ts +24 -29
- package/lib/engine/mem/store/lexical.d.ts +36 -45
- package/lib/engine/mem/store/memory.d.ts +486 -82
- package/lib/engine/mem/store/recall_policy.d.ts +49 -0
- package/lib/engine/mem/store/relation_backfill.d.ts +210 -0
- package/lib/engine/mem/store/relation_planner.d.ts +191 -0
- package/lib/engine/mem/store/secret_guard.d.ts +0 -1
- package/lib/engine/mem/store/self_query.d.ts +4 -2
- package/lib/engine/mem/store/time_filter.d.ts +121 -0
- package/lib/engine/mem/store/titles.d.ts +52 -0
- package/lib/engine/mem/store/vector_repair.d.ts +44 -54
- package/lib/engine/mem-contract/config.d.ts +44 -38
- package/lib/engine/mem-contract/text.d.ts +1 -1
- package/lib/engine/mem-contract/tools.d.ts +184 -117
- package/lib/engine/mem-contract/types.d.ts +364 -288
- package/lib/index.js +13898 -11500
- package/lib/interface-version.json +1 -1
- package/lib/types/client/index.d.ts +2 -2
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/paging.d.ts +3 -12
- package/lib/types/client/paging.d.ts.map +1 -1
- package/lib/types/client/summarize.d.ts.map +1 -1
- package/lib/types/command.d.ts +61 -0
- package/lib/types/command.d.ts.map +1 -0
- package/lib/types/envinit-bootstrap.d.ts +1 -1
- package/lib/types/envinit.d.ts +2 -6
- package/lib/types/envinit.d.ts.map +1 -1
- package/lib/types/hints.d.ts +28 -24
- package/lib/types/hints.d.ts.map +1 -1
- package/lib/types/index.d.ts +21 -40
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/inject.d.ts +3 -2
- package/lib/types/inject.d.ts.map +1 -1
- package/lib/types/interface_gate.d.ts +9 -9
- package/lib/types/prompt.d.ts +17 -41
- package/lib/types/prompt.d.ts.map +1 -1
- package/lib/types/provision.d.ts +3 -0
- package/lib/types/provision.d.ts.map +1 -1
- package/lib/types/remote.d.ts +23 -9
- package/lib/types/remote.d.ts.map +1 -1
- package/lib/types/render.d.ts +3 -3
- package/lib/types/tool_schema.d.ts +4 -0
- package/lib/types/tool_schema.d.ts.map +1 -1
- package/lib/types/vectorMigration.d.ts +5 -7
- package/lib/types/vectorMigration.d.ts.map +1 -1
- package/package.json +16 -15
- package/lib/engine/mem/config/domains.d.ts +0 -20
- package/lib/engine/mem/db/dao/chunks.d.ts +0 -231
- package/lib/engine/mem/db/dao/documents.d.ts +0 -51
- package/lib/engine/mem/db/hash.d.ts +0 -2
- package/lib/engine/mem/db/knowledge.d.ts +0 -17
- package/lib/engine/mem/eval/index.d.ts +0 -4
- package/lib/engine/mem/git.d.ts +0 -73
- package/lib/engine/mem/router.d.ts +0 -51
- package/lib/engine/mem/store/doc_files.d.ts +0 -125
- package/lib/engine/mem/store/document_text.d.ts +0 -47
- package/lib/engine/mem/store/ingest_guard.d.ts +0 -25
- package/lib/engine/mem/store/knowledge.d.ts +0 -598
- package/lib/engine/mem/store/source_picker.d.ts +0 -43
- package/lib/engine/mem-retrieval/adapters/local_reranker.d.ts +0 -52
- package/lib/engine/mem-retrieval/adapters/none_reranker.d.ts +0 -10
- package/lib/engine/mem-retrieval/rerank.d.ts +0 -13
- package/lib/types/client/domains.d.ts +0 -53
- package/lib/types/client/domains.d.ts.map +0 -1
- package/lib/types/client/ingest.d.ts +0 -24
- package/lib/types/client/ingest.d.ts.map +0 -1
- package/lib/types/open.d.ts +0 -77
- package/lib/types/open.d.ts.map +0 -1
- package/lib/types/reconcile.d.ts +0 -64
- package/lib/types/reconcile.d.ts.map +0 -1
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type StatusFilter } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* One structured relation a WRITE may declare (STRUCTURED_RELATIONS §2).
|
|
5
|
+
*
|
|
6
|
+
* It is the caller STATING a relation, not the extractor guessing one, which is why
|
|
7
|
+
* `kind: "note"` is the only layer that accepts it: a journal entry is an episode, and a relation
|
|
8
|
+
* that is worth remembering is a fact about the world (promote it: write a note, `source_ref` it
|
|
9
|
+
* back to the journal). Every slot is a NAME — the engine runs it through the same entity/predicate
|
|
10
|
+
* normalization and the same name-shape gate the extractor's edges pass.
|
|
11
|
+
*/
|
|
12
|
+
export declare const RelationInputSchema: z.ZodObject<{
|
|
13
|
+
subject: z.ZodString;
|
|
14
|
+
predicate: z.ZodString;
|
|
15
|
+
object: z.ZodString;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
/** One structured relation, as a write carries it. */
|
|
18
|
+
export type RelationInput = z.infer<typeof RelationInputSchema>;
|
|
19
|
+
/**
|
|
20
|
+
* How many relations ONE write may declare.
|
|
21
|
+
*
|
|
22
|
+
* A single fact states a handful of relations; a caller passing dozens has stopped describing a
|
|
23
|
+
* fact and started importing a graph. The cap keeps one call's work bounded (and the tool argument
|
|
24
|
+
* readable) without pretending to be a per-fact model of the corpus.
|
|
25
|
+
*/
|
|
26
|
+
export declare const MAX_RELATIONS_PER_WRITE = 20;
|
|
2
27
|
export declare const CONTRADICTION_RESOLUTIONS: readonly ["true_positive", "false_positive"];
|
|
3
|
-
|
|
28
|
+
/** The `time` object of `mem_recall`'s two time-aware actions. */
|
|
29
|
+
export declare const TimeFilterSchema: z.ZodObject<{
|
|
30
|
+
field: z.ZodEnum<{
|
|
31
|
+
created: "created";
|
|
32
|
+
updated: "updated";
|
|
33
|
+
event: "event";
|
|
34
|
+
}>;
|
|
35
|
+
on: z.ZodOptional<z.ZodString>;
|
|
36
|
+
from: z.ZodOptional<z.ZodString>;
|
|
37
|
+
to: z.ZodOptional<z.ZodString>;
|
|
38
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strict>;
|
|
4
40
|
/**
|
|
5
41
|
* The longest retrieval query the contract accepts, in characters.
|
|
6
42
|
*
|
|
@@ -35,7 +71,7 @@ export declare const MAX_REPORTED_CONFLICTS = 20;
|
|
|
35
71
|
*/
|
|
36
72
|
export declare const RETENTION_VOCABULARY: readonly ["衰减", "消退", "遗忘", "强化", "活跃使用日", "信任度", "永久记忆", "长期有效的信息"];
|
|
37
73
|
/**
|
|
38
|
-
*
|
|
74
|
+
* The admin actions that return a FACT VIEW. Their payload goes through
|
|
39
75
|
* {@link modelFacingToolResult}, which drops the retention diagnostics; the other admin
|
|
40
76
|
* actions (`trust_diagnose`, `vectors_diagnose`, …) are diagnostics the caller asked for and
|
|
41
77
|
* pass through untouched.
|
|
@@ -48,24 +84,50 @@ export declare const FACT_VIEW_ADMIN_ACTIONS: readonly ["list", "detail"];
|
|
|
48
84
|
* explicitly with `mem_admin`'s diagnostic actions.
|
|
49
85
|
*/
|
|
50
86
|
export declare function modelFacingToolResult(toolKey: string, action: unknown, value: unknown): unknown;
|
|
87
|
+
/**
|
|
88
|
+
* The statuses an export may narrow to. Declared here (next to the tool schema that exposes it) so
|
|
89
|
+
* the core export path, the CLI flag validation and the admin action read ONE set: a value added
|
|
90
|
+
* here moves the contract, the CLI and the engine together.
|
|
91
|
+
*/
|
|
92
|
+
export declare const EXPORT_STATUSES: readonly ["active", "archived", "all"];
|
|
93
|
+
export type ExportStatus = StatusFilter;
|
|
51
94
|
export declare const REMEMBER_ACTIONS: readonly ["add", "update", "remove", "helpful", "unhelpful"];
|
|
52
95
|
export declare const RememberUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
96
|
action: z.ZodLiteral<"add">;
|
|
54
97
|
content: z.ZodString;
|
|
55
|
-
|
|
98
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
99
|
+
journal: "journal";
|
|
100
|
+
note: "note";
|
|
101
|
+
}>>;
|
|
102
|
+
title: z.ZodOptional<z.ZodString>;
|
|
56
103
|
ttl_days: z.ZodOptional<z.ZodNumber>;
|
|
57
104
|
source_ref: z.ZodOptional<z.ZodString>;
|
|
58
105
|
event_date: z.ZodOptional<z.ZodString>;
|
|
59
106
|
valid_until: z.ZodOptional<z.ZodString>;
|
|
107
|
+
relations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
108
|
+
subject: z.ZodString;
|
|
109
|
+
predicate: z.ZodString;
|
|
110
|
+
object: z.ZodString;
|
|
111
|
+
}, z.core.$strict>>>;
|
|
60
112
|
}, z.core.$strip>, z.ZodObject<{
|
|
61
113
|
action: z.ZodLiteral<"update">;
|
|
62
114
|
fact_id: z.ZodNumber;
|
|
63
115
|
content: z.ZodString;
|
|
64
|
-
|
|
116
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
117
|
+
journal: "journal";
|
|
118
|
+
note: "note";
|
|
119
|
+
}>>;
|
|
120
|
+
title: z.ZodOptional<z.ZodString>;
|
|
121
|
+
retitle: z.ZodOptional<z.ZodLiteral<true>>;
|
|
65
122
|
ttl_days: z.ZodOptional<z.ZodNumber>;
|
|
66
123
|
source_ref: z.ZodOptional<z.ZodString>;
|
|
67
124
|
event_date: z.ZodOptional<z.ZodString>;
|
|
68
125
|
valid_until: z.ZodOptional<z.ZodString>;
|
|
126
|
+
relations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
127
|
+
subject: z.ZodString;
|
|
128
|
+
predicate: z.ZodString;
|
|
129
|
+
object: z.ZodString;
|
|
130
|
+
}, z.core.$strict>>>;
|
|
69
131
|
}, z.core.$strip>, z.ZodObject<{
|
|
70
132
|
action: z.ZodLiteral<"remove">;
|
|
71
133
|
fact_id: z.ZodNumber;
|
|
@@ -77,13 +139,36 @@ export declare const RememberUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
77
139
|
action: z.ZodLiteral<"unhelpful">;
|
|
78
140
|
fact_id: z.ZodNumber;
|
|
79
141
|
}, z.core.$strip>], "action">;
|
|
142
|
+
/**
|
|
143
|
+
* The runtime/CLI-visible write request. The base zod union keeps `kind` optional so the CLI's
|
|
144
|
+
* `add` without `--kind` (new row -> note) and `edit` without it (inherit the replaced row) keep
|
|
145
|
+
* working; the MODEL-facing `ModelRememberUnion` below re-declares it as required (N7).
|
|
146
|
+
*/
|
|
80
147
|
export type RememberRequest = z.infer<typeof RememberUnion>;
|
|
81
|
-
|
|
148
|
+
/**
|
|
149
|
+
* The writes the model may make. `helpful` / `unhelpful` are operator feedback: the model cannot
|
|
150
|
+
* observe the retention clocks they move, and a model that could would be able to "refresh" a fact by
|
|
151
|
+
* voting on it — the exact behaviour the retention policy exists to prevent.
|
|
152
|
+
*/
|
|
153
|
+
export declare const MODEL_REMEMBER_ACTIONS: readonly ["add", "update", "remove"];
|
|
154
|
+
export declare const ModelRememberUnion: z.ZodDiscriminatedUnion<readonly z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[], string>;
|
|
155
|
+
/**
|
|
156
|
+
* The public recall surface: TWO actions (docs/RECALL_INTERFACE.md).
|
|
157
|
+
*
|
|
158
|
+
* The engine decides whether a query is answered by the literal (exact) pass or by the fuzzy
|
|
159
|
+
* retrieval; the caller never chooses, never passes a relevance threshold, and never sees the
|
|
160
|
+
* pagination knobs of the fuzzy pass. `search` is content, `titles` is title — nothing else.
|
|
161
|
+
*/
|
|
162
|
+
export declare const RECALL_ACTIONS: readonly ["search", "titles"];
|
|
82
163
|
export declare const RecallUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
83
164
|
action: z.ZodLiteral<"search">;
|
|
84
|
-
query: z.ZodString
|
|
85
|
-
|
|
165
|
+
query: z.ZodOptional<z.ZodString>;
|
|
166
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
167
|
+
journal: "journal";
|
|
168
|
+
note: "note";
|
|
169
|
+
}>>;
|
|
86
170
|
source: z.ZodOptional<z.ZodString>;
|
|
171
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
87
172
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
88
173
|
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
89
174
|
floors: z.ZodOptional<z.ZodEnum<{
|
|
@@ -91,51 +176,76 @@ export declare const RecallUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
91
176
|
loose: "loose";
|
|
92
177
|
}>>;
|
|
93
178
|
include_scores: z.ZodOptional<z.ZodBoolean>;
|
|
179
|
+
time: z.ZodOptional<z.ZodObject<{
|
|
180
|
+
field: z.ZodEnum<{
|
|
181
|
+
created: "created";
|
|
182
|
+
updated: "updated";
|
|
183
|
+
event: "event";
|
|
184
|
+
}>;
|
|
185
|
+
on: z.ZodOptional<z.ZodString>;
|
|
186
|
+
from: z.ZodOptional<z.ZodString>;
|
|
187
|
+
to: z.ZodOptional<z.ZodString>;
|
|
188
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
189
|
+
}, z.core.$strict>>;
|
|
94
190
|
}, z.core.$strip>, z.ZodObject<{
|
|
95
|
-
action: z.ZodLiteral<"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
action: z.ZodLiteral<"related">;
|
|
119
|
-
entity: z.ZodString;
|
|
120
|
-
category: z.ZodOptional<z.ZodString>;
|
|
121
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
122
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
-
action: z.ZodLiteral<"contradict">;
|
|
124
|
-
category: z.ZodOptional<z.ZodString>;
|
|
191
|
+
action: z.ZodLiteral<"titles">;
|
|
192
|
+
query: z.ZodString;
|
|
193
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
194
|
+
journal: "journal";
|
|
195
|
+
note: "note";
|
|
196
|
+
}>>;
|
|
197
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
198
|
+
active: "active";
|
|
199
|
+
archived: "archived";
|
|
200
|
+
all: "all";
|
|
201
|
+
}>>;
|
|
202
|
+
time: z.ZodOptional<z.ZodObject<{
|
|
203
|
+
field: z.ZodEnum<{
|
|
204
|
+
created: "created";
|
|
205
|
+
updated: "updated";
|
|
206
|
+
event: "event";
|
|
207
|
+
}>;
|
|
208
|
+
on: z.ZodOptional<z.ZodString>;
|
|
209
|
+
from: z.ZodOptional<z.ZodString>;
|
|
210
|
+
to: z.ZodOptional<z.ZodString>;
|
|
211
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
212
|
+
}, z.core.$strict>>;
|
|
213
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
125
214
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
215
|
+
include_excerpt: z.ZodOptional<z.ZodBoolean>;
|
|
126
216
|
}, z.core.$strip>], "action">;
|
|
127
217
|
export type RecallRequest = z.infer<typeof RecallUnion>;
|
|
128
|
-
|
|
218
|
+
/**
|
|
219
|
+
* The retrieval actions the model may call: content and title, nothing else. Exact-vs-fuzzy,
|
|
220
|
+
* thresholds, topK and paging are the ENGINE's rules (docs/RECALL_INTERFACE.md §1).
|
|
221
|
+
*/
|
|
222
|
+
export declare const MODEL_RECALL_ACTIONS: readonly ["search", "titles"];
|
|
223
|
+
export declare const ModelRecallUnion: z.ZodDiscriminatedUnion<readonly z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[], string>;
|
|
224
|
+
export declare const ADMIN_ACTIONS: readonly ["stats", "list", "detail", "archive", "restore", "pin", "unpin", "trust_diagnose", "vectors_diagnose", "vectors_fix", "contradict_check", "contradict_resolve", "contradictions", "maintenance", "export", "import", "merge", "restore_snapshot"];
|
|
129
225
|
export declare const AdminUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
130
226
|
action: z.ZodLiteral<"stats">;
|
|
131
227
|
}, z.core.$strip>, z.ZodObject<{
|
|
132
228
|
action: z.ZodLiteral<"list">;
|
|
133
|
-
|
|
229
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
230
|
+
journal: "journal";
|
|
231
|
+
note: "note";
|
|
232
|
+
}>>;
|
|
134
233
|
status: z.ZodOptional<z.ZodEnum<{
|
|
135
234
|
active: "active";
|
|
136
235
|
archived: "archived";
|
|
137
236
|
}>>;
|
|
138
237
|
source: z.ZodOptional<z.ZodString>;
|
|
238
|
+
time: z.ZodOptional<z.ZodObject<{
|
|
239
|
+
field: z.ZodEnum<{
|
|
240
|
+
created: "created";
|
|
241
|
+
updated: "updated";
|
|
242
|
+
event: "event";
|
|
243
|
+
}>;
|
|
244
|
+
on: z.ZodOptional<z.ZodString>;
|
|
245
|
+
from: z.ZodOptional<z.ZodString>;
|
|
246
|
+
to: z.ZodOptional<z.ZodString>;
|
|
247
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
248
|
+
}, z.core.$strict>>;
|
|
139
249
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
140
250
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
141
251
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -161,12 +271,15 @@ export declare const AdminUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
161
271
|
}, z.core.$strip>, z.ZodObject<{
|
|
162
272
|
action: z.ZodLiteral<"vectors_fix">;
|
|
163
273
|
dry_run: z.ZodOptional<z.ZodBoolean>;
|
|
164
|
-
store: z.ZodOptional<z.ZodEnum<{
|
|
165
|
-
memory: "memory";
|
|
166
|
-
knowledge: "knowledge";
|
|
167
|
-
}>>;
|
|
168
274
|
}, z.core.$strip>, z.ZodObject<{
|
|
169
275
|
action: z.ZodLiteral<"contradict_check">;
|
|
276
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
277
|
+
action: z.ZodLiteral<"contradictions">;
|
|
278
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
279
|
+
journal: "journal";
|
|
280
|
+
note: "note";
|
|
281
|
+
}>>;
|
|
282
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
170
283
|
}, z.core.$strip>, z.ZodObject<{
|
|
171
284
|
action: z.ZodLiteral<"contradict_resolve">;
|
|
172
285
|
contradiction_id: z.ZodNumber;
|
|
@@ -177,65 +290,41 @@ export declare const AdminUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
177
290
|
loser_fact_id: z.ZodOptional<z.ZodNumber>;
|
|
178
291
|
}, z.core.$strip>, z.ZodObject<{
|
|
179
292
|
action: z.ZodLiteral<"maintenance">;
|
|
180
|
-
}, z.core.$strip>], "action">;
|
|
181
|
-
export type AdminRequest = z.infer<typeof AdminUnion>;
|
|
182
|
-
/** The `source` a write gets when it omits one; a document's identity is `(domain, source, title)`. */
|
|
183
|
-
export declare const DEFAULT_KB_SOURCE = "default";
|
|
184
|
-
export declare const KbUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
185
|
-
action: z.ZodLiteral<"ingest">;
|
|
186
|
-
text: z.ZodOptional<z.ZodString>;
|
|
187
|
-
source_uri: z.ZodOptional<z.ZodString>;
|
|
188
|
-
domain: z.ZodString;
|
|
189
|
-
source: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
190
|
-
title: z.ZodOptional<z.ZodString>;
|
|
191
|
-
overwrite: z.ZodOptional<z.ZodBoolean>;
|
|
192
293
|
}, z.core.$strip>, z.ZodObject<{
|
|
193
|
-
action: z.ZodLiteral<"
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
domain: z.ZodOptional<z.ZodString>;
|
|
201
|
-
source: z.ZodOptional<z.ZodString>;
|
|
202
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
203
|
-
offset: z.ZodOptional<z.ZodNumber>;
|
|
204
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
205
|
-
action: z.ZodLiteral<"detail">;
|
|
206
|
-
doc_id: z.ZodNumber;
|
|
294
|
+
action: z.ZodLiteral<"export">;
|
|
295
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
296
|
+
active: "active";
|
|
297
|
+
archived: "archived";
|
|
298
|
+
all: "all";
|
|
299
|
+
}>>;
|
|
300
|
+
file: z.ZodOptional<z.ZodString>;
|
|
207
301
|
}, z.core.$strip>, z.ZodObject<{
|
|
208
|
-
action: z.ZodLiteral<"
|
|
209
|
-
|
|
302
|
+
action: z.ZodLiteral<"import">;
|
|
303
|
+
file: z.ZodString;
|
|
304
|
+
dry_run: z.ZodOptional<z.ZodBoolean>;
|
|
210
305
|
}, z.core.$strip>, z.ZodObject<{
|
|
211
|
-
action: z.ZodLiteral<"
|
|
212
|
-
|
|
306
|
+
action: z.ZodLiteral<"merge">;
|
|
307
|
+
file: z.ZodString;
|
|
213
308
|
dry_run: z.ZodOptional<z.ZodBoolean>;
|
|
214
309
|
}, z.core.$strip>, z.ZodObject<{
|
|
215
|
-
action: z.ZodLiteral<"
|
|
216
|
-
|
|
217
|
-
|
|
310
|
+
action: z.ZodLiteral<"restore_snapshot">;
|
|
311
|
+
file: z.ZodString;
|
|
312
|
+
confirm: z.ZodLiteral<true>;
|
|
218
313
|
dry_run: z.ZodOptional<z.ZodBoolean>;
|
|
219
314
|
}, z.core.$strip>], "action">;
|
|
220
|
-
export type
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
strict: "strict";
|
|
234
|
-
loose: "loose";
|
|
235
|
-
}>>;
|
|
236
|
-
include_scores: z.ZodOptional<z.ZodBoolean>;
|
|
237
|
-
}, z.core.$strip>;
|
|
238
|
-
export type QueryRequest = z.infer<typeof QueryUnion>;
|
|
315
|
+
export type AdminRequest = z.infer<typeof AdminUnion>;
|
|
316
|
+
/**
|
|
317
|
+
* The admin actions the model may call: a fact page plus the backup/restore family.
|
|
318
|
+
*
|
|
319
|
+
* Everything else is OPERATOR machinery: diagnostics and repairs (the model cannot see trust values
|
|
320
|
+
* and must not rerun the embedding strategy), curation (pin/archive/contradiction verdicts), and
|
|
321
|
+
* duplicates of what is already model-facing (`detail` is a single-fact view of the same page;
|
|
322
|
+
* `contradictions` is the operator's list of open pairs, plus its verdict action; `merge` is what
|
|
323
|
+
* `import` now does automatically for a SQLite file). The full union stays for the runtime, the
|
|
324
|
+
* Remote gateway (the settings page drives every action) and the CLI.
|
|
325
|
+
*/
|
|
326
|
+
export declare const MODEL_ADMIN_ACTIONS: readonly ["list", "contradictions", "export", "import", "restore_snapshot"];
|
|
327
|
+
export declare const ModelAdminUnion: z.ZodDiscriminatedUnion<readonly z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[], string>;
|
|
239
328
|
/** Transport-agnostic tool spec: name / key / description / zod input. */
|
|
240
329
|
export interface ToolSpec {
|
|
241
330
|
key: string;
|
|
@@ -246,28 +335,6 @@ export interface ToolSpec {
|
|
|
246
335
|
export declare const REMEMBER_TOOL: ToolSpec;
|
|
247
336
|
export declare const RECALL_TOOL: ToolSpec;
|
|
248
337
|
export declare const ADMIN_TOOL: ToolSpec;
|
|
249
|
-
export declare const KB_TOOL: ToolSpec;
|
|
250
|
-
export declare const QUERY_TOOL: ToolSpec;
|
|
251
|
-
/** One new document, or a batch import — never an update (see the tool description). */
|
|
252
|
-
export declare const KB_ADD_TOOL: ToolSpec;
|
|
253
|
-
/**
|
|
254
|
-
* The parsed `kb_add` input, no `overwrite`: the add-only MODE is a property of the runtime face
|
|
255
|
-
* (`rt.kbAdd`), not a field the model can set. Spelled out (rather than `z.infer` of
|
|
256
|
-
* `KB_ADD_TOOL.input`, which is widened to `z.ZodType` by `ToolSpec`) so the runtime method and the
|
|
257
|
-
* plugin handler agree on the request. `source` is present because the contract defaults it.
|
|
258
|
-
*/
|
|
259
|
-
export interface KbAddRequest {
|
|
260
|
-
domain: string;
|
|
261
|
-
source: string;
|
|
262
|
-
title?: string;
|
|
263
|
-
text?: string;
|
|
264
|
-
source_uri?: string;
|
|
265
|
-
paths?: string[];
|
|
266
|
-
}
|
|
267
|
-
/** The corpus listing, with the managed path — the entry point for editing a document. */
|
|
268
|
-
export declare const KB_LIST_TOOL: ToolSpec;
|
|
269
|
-
export declare const KB_REMOVE_TOOL: ToolSpec;
|
|
270
|
-
export declare const KB_REINDEX_TOOL: ToolSpec;
|
|
271
338
|
export declare const TOOL_SPECS: ToolSpec[];
|
|
272
339
|
/**
|
|
273
340
|
* Compose the top-level (merged) description for a union field.
|