@avantf/dsh-mem 0.7.0 → 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 +4 -0
- package/lib/client.js +548 -1195
- package/lib/dsh-build.json +1 -0
- 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 +50 -10
- package/lib/engine/mem/index.d.ts +6 -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/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 +61 -88
- 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 +10 -2
- 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 +471 -83
- 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 +145 -132
- package/lib/engine/mem-contract/types.d.ts +364 -288
- package/lib/index.js +12048 -11337
- 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/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 +1 -1
- 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 +14 -7
- package/lib/types/remote.d.ts.map +1 -1
- 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 +15 -14
- 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.
|
|
@@ -54,25 +90,44 @@ export declare function modelFacingToolResult(toolKey: string, action: unknown,
|
|
|
54
90
|
* here moves the contract, the CLI and the engine together.
|
|
55
91
|
*/
|
|
56
92
|
export declare const EXPORT_STATUSES: readonly ["active", "archived", "all"];
|
|
57
|
-
export type ExportStatus =
|
|
93
|
+
export type ExportStatus = StatusFilter;
|
|
58
94
|
export declare const REMEMBER_ACTIONS: readonly ["add", "update", "remove", "helpful", "unhelpful"];
|
|
59
95
|
export declare const RememberUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
60
96
|
action: z.ZodLiteral<"add">;
|
|
61
97
|
content: z.ZodString;
|
|
62
|
-
|
|
98
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
99
|
+
journal: "journal";
|
|
100
|
+
note: "note";
|
|
101
|
+
}>>;
|
|
102
|
+
title: z.ZodOptional<z.ZodString>;
|
|
63
103
|
ttl_days: z.ZodOptional<z.ZodNumber>;
|
|
64
104
|
source_ref: z.ZodOptional<z.ZodString>;
|
|
65
105
|
event_date: z.ZodOptional<z.ZodString>;
|
|
66
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>>>;
|
|
67
112
|
}, z.core.$strip>, z.ZodObject<{
|
|
68
113
|
action: z.ZodLiteral<"update">;
|
|
69
114
|
fact_id: z.ZodNumber;
|
|
70
115
|
content: z.ZodString;
|
|
71
|
-
|
|
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>>;
|
|
72
122
|
ttl_days: z.ZodOptional<z.ZodNumber>;
|
|
73
123
|
source_ref: z.ZodOptional<z.ZodString>;
|
|
74
124
|
event_date: z.ZodOptional<z.ZodString>;
|
|
75
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>>>;
|
|
76
131
|
}, z.core.$strip>, z.ZodObject<{
|
|
77
132
|
action: z.ZodLiteral<"remove">;
|
|
78
133
|
fact_id: z.ZodNumber;
|
|
@@ -84,6 +139,11 @@ export declare const RememberUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
84
139
|
action: z.ZodLiteral<"unhelpful">;
|
|
85
140
|
fact_id: z.ZodNumber;
|
|
86
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
|
+
*/
|
|
87
147
|
export type RememberRequest = z.infer<typeof RememberUnion>;
|
|
88
148
|
/**
|
|
89
149
|
* The writes the model may make. `helpful` / `unhelpful` are operator feedback: the model cannot
|
|
@@ -92,12 +152,23 @@ export type RememberRequest = z.infer<typeof RememberUnion>;
|
|
|
92
152
|
*/
|
|
93
153
|
export declare const MODEL_REMEMBER_ACTIONS: readonly ["add", "update", "remove"];
|
|
94
154
|
export declare const ModelRememberUnion: z.ZodDiscriminatedUnion<readonly z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[], string>;
|
|
95
|
-
|
|
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"];
|
|
96
163
|
export declare const RecallUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
97
164
|
action: z.ZodLiteral<"search">;
|
|
98
|
-
query: z.ZodString
|
|
99
|
-
|
|
165
|
+
query: z.ZodOptional<z.ZodString>;
|
|
166
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
167
|
+
journal: "journal";
|
|
168
|
+
note: "note";
|
|
169
|
+
}>>;
|
|
100
170
|
source: z.ZodOptional<z.ZodString>;
|
|
171
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
101
172
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
102
173
|
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
103
174
|
floors: z.ZodOptional<z.ZodEnum<{
|
|
@@ -105,58 +176,76 @@ export declare const RecallUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
105
176
|
loose: "loose";
|
|
106
177
|
}>>;
|
|
107
178
|
include_scores: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
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>>;
|
|
190
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
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>;
|
|
139
214
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
215
|
+
include_excerpt: z.ZodOptional<z.ZodBoolean>;
|
|
140
216
|
}, z.core.$strip>], "action">;
|
|
141
217
|
export type RecallRequest = z.infer<typeof RecallUnion>;
|
|
142
218
|
/**
|
|
143
|
-
* The retrieval actions the model may call
|
|
144
|
-
*
|
|
145
|
-
* `search`/`probe`/`ask`/`reason`, so the two graph shapes are not part of its tool.
|
|
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).
|
|
146
221
|
*/
|
|
147
|
-
export declare const MODEL_RECALL_ACTIONS: readonly ["search", "
|
|
222
|
+
export declare const MODEL_RECALL_ACTIONS: readonly ["search", "titles"];
|
|
148
223
|
export declare const ModelRecallUnion: z.ZodDiscriminatedUnion<readonly z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[], string>;
|
|
149
|
-
export declare const ADMIN_ACTIONS: readonly ["stats", "list", "detail", "archive", "restore", "pin", "unpin", "trust_diagnose", "vectors_diagnose", "vectors_fix", "contradict_check", "contradict_resolve", "maintenance", "export", "import", "merge", "restore_snapshot"];
|
|
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"];
|
|
150
225
|
export declare const AdminUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
151
226
|
action: z.ZodLiteral<"stats">;
|
|
152
227
|
}, z.core.$strip>, z.ZodObject<{
|
|
153
228
|
action: z.ZodLiteral<"list">;
|
|
154
|
-
|
|
229
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
230
|
+
journal: "journal";
|
|
231
|
+
note: "note";
|
|
232
|
+
}>>;
|
|
155
233
|
status: z.ZodOptional<z.ZodEnum<{
|
|
156
234
|
active: "active";
|
|
157
235
|
archived: "archived";
|
|
158
236
|
}>>;
|
|
159
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>>;
|
|
160
249
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
161
250
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
162
251
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -182,12 +271,15 @@ export declare const AdminUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
182
271
|
}, z.core.$strip>, z.ZodObject<{
|
|
183
272
|
action: z.ZodLiteral<"vectors_fix">;
|
|
184
273
|
dry_run: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
-
store: z.ZodOptional<z.ZodEnum<{
|
|
186
|
-
memory: "memory";
|
|
187
|
-
knowledge: "knowledge";
|
|
188
|
-
}>>;
|
|
189
274
|
}, z.core.$strip>, z.ZodObject<{
|
|
190
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>;
|
|
191
283
|
}, z.core.$strip>, z.ZodObject<{
|
|
192
284
|
action: z.ZodLiteral<"contradict_resolve">;
|
|
193
285
|
contradiction_id: z.ZodNumber;
|
|
@@ -227,69 +319,12 @@ export type AdminRequest = z.infer<typeof AdminUnion>;
|
|
|
227
319
|
* Everything else is OPERATOR machinery: diagnostics and repairs (the model cannot see trust values
|
|
228
320
|
* and must not rerun the embedding strategy), curation (pin/archive/contradiction verdicts), and
|
|
229
321
|
* duplicates of what is already model-facing (`detail` is a single-fact view of the same page;
|
|
230
|
-
* `
|
|
231
|
-
* now does automatically for a SQLite file). The full union stays for the runtime, the
|
|
232
|
-
* gateway (the settings page drives every action) and the CLI.
|
|
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.
|
|
233
325
|
*/
|
|
234
|
-
export declare const MODEL_ADMIN_ACTIONS: readonly ["list", "export", "import", "restore_snapshot"];
|
|
326
|
+
export declare const MODEL_ADMIN_ACTIONS: readonly ["list", "contradictions", "export", "import", "restore_snapshot"];
|
|
235
327
|
export declare const ModelAdminUnion: z.ZodDiscriminatedUnion<readonly z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[], string>;
|
|
236
|
-
/** The `source` a write gets when it omits one; a document's identity is `(domain, source, title)`. */
|
|
237
|
-
export declare const DEFAULT_KB_SOURCE = "default";
|
|
238
|
-
export declare const KbUnion: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
239
|
-
action: z.ZodLiteral<"ingest">;
|
|
240
|
-
text: z.ZodOptional<z.ZodString>;
|
|
241
|
-
source_uri: z.ZodOptional<z.ZodString>;
|
|
242
|
-
domain: z.ZodString;
|
|
243
|
-
source: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
244
|
-
title: z.ZodOptional<z.ZodString>;
|
|
245
|
-
overwrite: z.ZodOptional<z.ZodBoolean>;
|
|
246
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
247
|
-
action: z.ZodLiteral<"import">;
|
|
248
|
-
paths: z.ZodArray<z.ZodString>;
|
|
249
|
-
domain: z.ZodString;
|
|
250
|
-
source: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
251
|
-
overwrite: z.ZodOptional<z.ZodBoolean>;
|
|
252
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
253
|
-
action: z.ZodLiteral<"list">;
|
|
254
|
-
domain: z.ZodOptional<z.ZodString>;
|
|
255
|
-
source: z.ZodOptional<z.ZodString>;
|
|
256
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
257
|
-
offset: z.ZodOptional<z.ZodNumber>;
|
|
258
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
259
|
-
action: z.ZodLiteral<"detail">;
|
|
260
|
-
doc_id: z.ZodNumber;
|
|
261
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
262
|
-
action: z.ZodLiteral<"remove">;
|
|
263
|
-
doc_id: z.ZodNumber;
|
|
264
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
265
|
-
action: z.ZodLiteral<"reindex">;
|
|
266
|
-
domain: z.ZodOptional<z.ZodString>;
|
|
267
|
-
dry_run: z.ZodOptional<z.ZodBoolean>;
|
|
268
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
269
|
-
action: z.ZodLiteral<"sync">;
|
|
270
|
-
doc_id: z.ZodOptional<z.ZodNumber>;
|
|
271
|
-
adopt: z.ZodOptional<z.ZodBoolean>;
|
|
272
|
-
dry_run: z.ZodOptional<z.ZodBoolean>;
|
|
273
|
-
}, z.core.$strip>], "action">;
|
|
274
|
-
export type KbRequest = z.infer<typeof KbUnion>;
|
|
275
|
-
export declare const QueryUnion: z.ZodObject<{
|
|
276
|
-
query: z.ZodString;
|
|
277
|
-
kind: z.ZodOptional<z.ZodEnum<{
|
|
278
|
-
fact: "fact";
|
|
279
|
-
doc_chunk: "doc_chunk";
|
|
280
|
-
all: "all";
|
|
281
|
-
}>>;
|
|
282
|
-
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
283
|
-
domain: z.ZodOptional<z.ZodString>;
|
|
284
|
-
source: z.ZodOptional<z.ZodString>;
|
|
285
|
-
limit: z.ZodDefault<z.ZodNumber>;
|
|
286
|
-
floors: z.ZodOptional<z.ZodEnum<{
|
|
287
|
-
strict: "strict";
|
|
288
|
-
loose: "loose";
|
|
289
|
-
}>>;
|
|
290
|
-
include_scores: z.ZodOptional<z.ZodBoolean>;
|
|
291
|
-
}, z.core.$strip>;
|
|
292
|
-
export type QueryRequest = z.infer<typeof QueryUnion>;
|
|
293
328
|
/** Transport-agnostic tool spec: name / key / description / zod input. */
|
|
294
329
|
export interface ToolSpec {
|
|
295
330
|
key: string;
|
|
@@ -300,28 +335,6 @@ export interface ToolSpec {
|
|
|
300
335
|
export declare const REMEMBER_TOOL: ToolSpec;
|
|
301
336
|
export declare const RECALL_TOOL: ToolSpec;
|
|
302
337
|
export declare const ADMIN_TOOL: ToolSpec;
|
|
303
|
-
export declare const KB_TOOL: ToolSpec;
|
|
304
|
-
export declare const QUERY_TOOL: ToolSpec;
|
|
305
|
-
/** One new document, or a batch import — never an update (see the tool description). */
|
|
306
|
-
export declare const KB_ADD_TOOL: ToolSpec;
|
|
307
|
-
/**
|
|
308
|
-
* The parsed `kb_add` input, no `overwrite`: the add-only MODE is a property of the runtime face
|
|
309
|
-
* (`rt.kbAdd`), not a field the model can set. Spelled out (rather than `z.infer` of
|
|
310
|
-
* `KB_ADD_TOOL.input`, which is widened to `z.ZodType` by `ToolSpec`) so the runtime method and the
|
|
311
|
-
* plugin handler agree on the request. `source` is present because the contract defaults it.
|
|
312
|
-
*/
|
|
313
|
-
export interface KbAddRequest {
|
|
314
|
-
domain: string;
|
|
315
|
-
source: string;
|
|
316
|
-
title?: string;
|
|
317
|
-
text?: string;
|
|
318
|
-
source_uri?: string;
|
|
319
|
-
paths?: string[];
|
|
320
|
-
}
|
|
321
|
-
/** The corpus listing, with the managed path — the entry point for editing a document. */
|
|
322
|
-
export declare const KB_LIST_TOOL: ToolSpec;
|
|
323
|
-
export declare const KB_REMOVE_TOOL: ToolSpec;
|
|
324
|
-
export declare const KB_REINDEX_TOOL: ToolSpec;
|
|
325
338
|
export declare const TOOL_SPECS: ToolSpec[];
|
|
326
339
|
/**
|
|
327
340
|
* Compose the top-level (merged) description for a union field.
|