@tenphi/akno-protocol 0.1.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/LICENSE +83 -0
- package/README.md +26 -0
- package/dist/common.d.ts +1553 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +309 -0
- package/dist/common.js.map +1 -0
- package/dist/errors.d.ts +24 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +69 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/ops/answer.d.ts +207 -0
- package/dist/ops/answer.d.ts.map +1 -0
- package/dist/ops/answer.js +90 -0
- package/dist/ops/answer.js.map +1 -0
- package/dist/ops/context.d.ts +845 -0
- package/dist/ops/context.d.ts.map +1 -0
- package/dist/ops/context.js +82 -0
- package/dist/ops/context.js.map +1 -0
- package/dist/ops/folder.d.ts +85 -0
- package/dist/ops/folder.d.ts.map +1 -0
- package/dist/ops/folder.js +56 -0
- package/dist/ops/folder.js.map +1 -0
- package/dist/ops/graph.d.ts +352 -0
- package/dist/ops/graph.d.ts.map +1 -0
- package/dist/ops/graph.js +63 -0
- package/dist/ops/graph.js.map +1 -0
- package/dist/ops/list.d.ts +136 -0
- package/dist/ops/list.d.ts.map +1 -0
- package/dist/ops/list.js +57 -0
- package/dist/ops/list.js.map +1 -0
- package/dist/ops/mutate.d.ts +432 -0
- package/dist/ops/mutate.d.ts.map +1 -0
- package/dist/ops/mutate.js +234 -0
- package/dist/ops/mutate.js.map +1 -0
- package/dist/ops/read.d.ts +242 -0
- package/dist/ops/read.d.ts.map +1 -0
- package/dist/ops/read.js +65 -0
- package/dist/ops/read.js.map +1 -0
- package/dist/ops/recall.d.ts +531 -0
- package/dist/ops/recall.d.ts.map +1 -0
- package/dist/ops/recall.js +59 -0
- package/dist/ops/recall.js.map +1 -0
- package/dist/ops/timeline.d.ts +264 -0
- package/dist/ops/timeline.d.ts.map +1 -0
- package/dist/ops/timeline.js +68 -0
- package/dist/ops/timeline.js.map +1 -0
- package/dist/ops/write.d.ts +182 -0
- package/dist/ops/write.d.ts.map +1 -0
- package/dist/ops/write.js +114 -0
- package/dist/ops/write.js.map +1 -0
- package/dist/registry.d.ts +2657 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +191 -0
- package/dist/registry.js.map +1 -0
- package/dist/version.d.ts +14 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +14 -0
- package/dist/version.js.map +1 -0
- package/dist/wire.d.ts +112 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +102 -0
- package/dist/wire.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ResultEnvelope } from "../common.js";
|
|
3
|
+
import { ApprovalRequest, FolderRequired, WriteTarget } from "./write.js";
|
|
4
|
+
/**
|
|
5
|
+
* Hand over a transcript or notes; Akno runs the retain mission with its
|
|
6
|
+
* own model and produces the writes itself. The answer for a host that does not
|
|
7
|
+
* want to build a curator. An agent that wants control uses `write`.
|
|
8
|
+
*/
|
|
9
|
+
export const RememberInput = z.object({
|
|
10
|
+
text: z.string().min(1),
|
|
11
|
+
/** Free-form provenance note, e.g. `telegram:2026-08-06`. */
|
|
12
|
+
source: z.string().optional(),
|
|
13
|
+
/**
|
|
14
|
+
* What to pay attention to in *this* text — attribution for a forwarded message, a channel whose
|
|
15
|
+
* content is mostly logistics, a subject the caller knows matters.
|
|
16
|
+
*
|
|
17
|
+
* **Emphasis, never replacement.** It is appended to the standing retain rules rather than
|
|
18
|
+
* substituted for them, which is the same guarantee the config missions give: every rule that keeps
|
|
19
|
+
* this from keeping the wrong things lives in the fixed part, and a caller-supplied prompt that
|
|
20
|
+
* replaced it would lose all of them at once. A caller that wants full control uses `write`.
|
|
21
|
+
*
|
|
22
|
+
* Falls back to `maintenance.retain.mission` when omitted, so an install-wide policy still applies.
|
|
23
|
+
*/
|
|
24
|
+
mission: z.string().max(2000).optional(),
|
|
25
|
+
/** Report the candidate writes without touching disk. */
|
|
26
|
+
dry_run: z.boolean().optional(),
|
|
27
|
+
});
|
|
28
|
+
export const RememberOutput = ResultEnvelope.extend({
|
|
29
|
+
outcome: z.enum(['ok', 'requires_approval', 'requires_folder', 'no_writable_destination', 'noop']),
|
|
30
|
+
change_id: z.string().optional(),
|
|
31
|
+
wrote: z.array(WriteTarget).optional(),
|
|
32
|
+
facts: z.object({ retired: z.number().int(), added: z.number().int() }).optional(),
|
|
33
|
+
/** Candidates that cleared the retain mission but had nowhere to go and no name to give one. */
|
|
34
|
+
approvals: z.array(ApprovalRequest).optional(),
|
|
35
|
+
/**
|
|
36
|
+
* Folders a claim wanted and that nothing has described yet. **Not an approval** — declare
|
|
37
|
+
* each with `folder` and call `remember` again; no user is waiting on this.
|
|
38
|
+
*/
|
|
39
|
+
requires_folder: z.array(FolderRequired).optional(),
|
|
40
|
+
/** Present only when a configured fallback was needed by at least one retained claim. */
|
|
41
|
+
fallback: z
|
|
42
|
+
.object({
|
|
43
|
+
slug: z.string(),
|
|
44
|
+
status: z.enum(['used', 'unavailable']),
|
|
45
|
+
reason: z
|
|
46
|
+
.enum(['reserved_path', 'existing_page_not_admitted', 'unindexed_page_exists', 'folder_not_admitted'])
|
|
47
|
+
.optional(),
|
|
48
|
+
})
|
|
49
|
+
.optional(),
|
|
50
|
+
/** What the retain mission decided was worth keeping, and what it dropped. */
|
|
51
|
+
considered: z
|
|
52
|
+
.array(z.object({
|
|
53
|
+
claim: z.string(),
|
|
54
|
+
kept: z.boolean(),
|
|
55
|
+
slug: z.string().nullable(),
|
|
56
|
+
score: z.number(),
|
|
57
|
+
/** The authorization class selected before conflict checking and placement. */
|
|
58
|
+
destination: z
|
|
59
|
+
.enum([
|
|
60
|
+
'existing_admitted_page',
|
|
61
|
+
'new_managed_page',
|
|
62
|
+
'configured_fallback',
|
|
63
|
+
'no_writable_destination',
|
|
64
|
+
])
|
|
65
|
+
.optional(),
|
|
66
|
+
/** True only when this candidate's write actually reached disk. */
|
|
67
|
+
written: z.boolean(),
|
|
68
|
+
}))
|
|
69
|
+
.optional(),
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* All three forms operate on Markdown. Retracting a fact removes the
|
|
73
|
+
* sentence that produced it — expiring a row while the sentence stays in the
|
|
74
|
+
* file means the assistant "forgets" and reads it again tomorrow.
|
|
75
|
+
*/
|
|
76
|
+
export const ForgetInput = z
|
|
77
|
+
.object({
|
|
78
|
+
fact: z.string().optional(),
|
|
79
|
+
slug: z.string().optional(),
|
|
80
|
+
document: z.string().optional(),
|
|
81
|
+
})
|
|
82
|
+
.refine((v) => [v.fact, v.slug, v.document].filter(Boolean).length === 1, {
|
|
83
|
+
message: 'forget takes exactly one of: fact, slug, document',
|
|
84
|
+
});
|
|
85
|
+
export const ForgetOutput = ResultEnvelope.extend({
|
|
86
|
+
change_id: z.string().optional(),
|
|
87
|
+
removed_from: z.string().optional(),
|
|
88
|
+
/** The exact bytes removed, so the caller can show the user what went. */
|
|
89
|
+
removed: z.string().optional(),
|
|
90
|
+
trashed: z.string().optional(),
|
|
91
|
+
});
|
|
92
|
+
export const UndoInput = z.object({ change_id: z.string().min(1) });
|
|
93
|
+
export const UndoOutput = ResultEnvelope.extend({
|
|
94
|
+
reversed: z.string().optional(),
|
|
95
|
+
/** Files whose previous content was put back. */
|
|
96
|
+
restored: z.array(z.string()).optional(),
|
|
97
|
+
/**
|
|
98
|
+
* Files the change had created, and which reversing it therefore deleted.
|
|
99
|
+
*
|
|
100
|
+
* Separate from `restored` because they are opposite events. Reporting the removal of a
|
|
101
|
+
* page as "restored" tells the caller a file is there when it is not — and after an
|
|
102
|
+
* `undo` that is precisely the thing they are about to act on.
|
|
103
|
+
*/
|
|
104
|
+
removed: z.array(z.string()).optional(),
|
|
105
|
+
});
|
|
106
|
+
/** Relocate a page with its documents, rewriting embeds and reporting inbound links. */
|
|
107
|
+
export const MoveInput = z.object({
|
|
108
|
+
from: z.string().min(1),
|
|
109
|
+
to: z.string().min(1),
|
|
110
|
+
});
|
|
111
|
+
export const MoveOutput = ResultEnvelope.extend({
|
|
112
|
+
outcome: z.enum(['ok', 'requires_folder']),
|
|
113
|
+
change_id: z.string().optional(),
|
|
114
|
+
moved: z.array(z.string()).optional(),
|
|
115
|
+
/** Links that now point nowhere. Reported, never silently rewritten. */
|
|
116
|
+
broken_inbound: z.array(z.string()).optional(),
|
|
117
|
+
requires_folder: FolderRequired.optional(),
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* Pull documents into memory: extract, OCR, name, summarize, and route.
|
|
121
|
+
* Extraction happens on arrival, always — no caller ever runs an extraction tool.
|
|
122
|
+
*/
|
|
123
|
+
export const IngestInput = z
|
|
124
|
+
.object({
|
|
125
|
+
/** A file, or a folder to walk one level deep. */
|
|
126
|
+
path: z.string().optional(),
|
|
127
|
+
/** An http or https URL. Fetched, then treated as a file. */
|
|
128
|
+
url: z.string().url().optional(),
|
|
129
|
+
/** Destination folder. Omit to let routing decide. */
|
|
130
|
+
folder: z.string().optional(),
|
|
131
|
+
/**
|
|
132
|
+
* Move the file instead of copying it. The inbox is the only place Akno
|
|
133
|
+
* moves files, and it sets this by rule — a file dropped straight into
|
|
134
|
+
* `documents/` was put there on purpose.
|
|
135
|
+
*/
|
|
136
|
+
route: z.boolean().optional(),
|
|
137
|
+
label: z.string().optional(),
|
|
138
|
+
/** Cap for a folder walk, so a wrong path cannot start a thousand model calls. */
|
|
139
|
+
limit: z.number().int().positive().max(500).optional(),
|
|
140
|
+
})
|
|
141
|
+
.refine((v) => Boolean(v.path || v.url), { message: 'ingest requires a path or a url' });
|
|
142
|
+
export const IngestOutput = ResultEnvelope.extend({
|
|
143
|
+
outcome: z.enum(['ok', 'requires_approval', 'requires_folder', 'duplicate', 'skipped']),
|
|
144
|
+
change_id: z.string().optional(),
|
|
145
|
+
document: z.string().optional(),
|
|
146
|
+
slug: z.string().optional(),
|
|
147
|
+
rel_path: z.string().optional(),
|
|
148
|
+
summary: z.string().optional(),
|
|
149
|
+
page_count: z.number().int().nonnegative().optional(),
|
|
150
|
+
ocr: z.boolean().optional(),
|
|
151
|
+
/**
|
|
152
|
+
* Where the text actually came from. `ocr` alone cannot say: a vision model's
|
|
153
|
+
* *description* of a photo is not a transcription of it, and reporting the two the
|
|
154
|
+
* same way is a false claim about provenance, which cite-or-stay-quiet exists to
|
|
155
|
+
* prevent.
|
|
156
|
+
*/
|
|
157
|
+
text_from: z.enum(['text-layer', 'ocr', 'plain', 'textutil', 'vision', 'none']).optional(),
|
|
158
|
+
/** Set when a rename fired: the original name added nothing the content did
|
|
159
|
+
* not already say. A good name is left alone. */
|
|
160
|
+
renamed_from: z.string().optional(),
|
|
161
|
+
related: z.array(z.string()).optional(),
|
|
162
|
+
/** A document that routed nowhere: a real question for the user about where it goes. */
|
|
163
|
+
approval: ApprovalRequest.optional(),
|
|
164
|
+
/** The destination folder has not been declared: a question for the *agent*, not the user. */
|
|
165
|
+
requires_folder: FolderRequired.optional(),
|
|
166
|
+
/**
|
|
167
|
+
* One entry per file when a folder was ingested. The outer `outcome` is `ok` if
|
|
168
|
+
* anything landed — a folder where three files filed themselves and two need a
|
|
169
|
+
* decision is not a failure, and collapsing it to one verdict would lose the two.
|
|
170
|
+
*/
|
|
171
|
+
batch: z
|
|
172
|
+
.array(z.object({
|
|
173
|
+
source: z.string(),
|
|
174
|
+
outcome: z.enum(['ok', 'requires_approval', 'requires_folder', 'duplicate', 'skipped', 'error']),
|
|
175
|
+
slug: z.string().optional(),
|
|
176
|
+
note: z.string().optional(),
|
|
177
|
+
}))
|
|
178
|
+
.optional(),
|
|
179
|
+
});
|
|
180
|
+
/** Organize one already-indexed orphan document without making retrieval depend on filing. */
|
|
181
|
+
export const AdoptInput = z.object({
|
|
182
|
+
/** Stable document id returned by recall or read. All parts in the same document group follow it. */
|
|
183
|
+
documentId: z.string().min(1),
|
|
184
|
+
});
|
|
185
|
+
export const AdoptOutput = ResultEnvelope.extend({
|
|
186
|
+
outcome: z.enum([
|
|
187
|
+
'planned',
|
|
188
|
+
'requires_review',
|
|
189
|
+
'created',
|
|
190
|
+
'verification_pending',
|
|
191
|
+
'noop',
|
|
192
|
+
'blocked',
|
|
193
|
+
'rejected',
|
|
194
|
+
'disabled',
|
|
195
|
+
]),
|
|
196
|
+
document_id: z.string(),
|
|
197
|
+
/** Every part filed by this operation; a multi-part document is always adopted as one unit. */
|
|
198
|
+
document_ids: z.array(z.string()).optional(),
|
|
199
|
+
slug: z.string().optional(),
|
|
200
|
+
rel_path: z.string().optional(),
|
|
201
|
+
change_id: z.string().optional(),
|
|
202
|
+
reason: z.string().optional(),
|
|
203
|
+
/** Compact reference only; exact private operations remain behind the maintenance-plan interface. */
|
|
204
|
+
plan: z
|
|
205
|
+
.object({
|
|
206
|
+
id: z.string(),
|
|
207
|
+
mode: z.enum(['audit', 'review', 'auto']),
|
|
208
|
+
status: z.enum([
|
|
209
|
+
'ready',
|
|
210
|
+
'awaiting_review',
|
|
211
|
+
'deciding',
|
|
212
|
+
'approved',
|
|
213
|
+
'applying',
|
|
214
|
+
'completed',
|
|
215
|
+
'partially_completed',
|
|
216
|
+
'failed',
|
|
217
|
+
'superseded',
|
|
218
|
+
]),
|
|
219
|
+
item_id: z.string(),
|
|
220
|
+
item_status: z.enum([
|
|
221
|
+
'proposed',
|
|
222
|
+
'approved',
|
|
223
|
+
'rejected',
|
|
224
|
+
'blocked',
|
|
225
|
+
'stale',
|
|
226
|
+
'applying',
|
|
227
|
+
'applied',
|
|
228
|
+
'verification_pending',
|
|
229
|
+
'verification_failed',
|
|
230
|
+
]),
|
|
231
|
+
})
|
|
232
|
+
.optional(),
|
|
233
|
+
});
|
|
234
|
+
//# sourceMappingURL=mutate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutate.js","sourceRoot":"","sources":["../../src/ops/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AAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACzC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC;YACb,OAAO;YACP,iBAAiB;YACjB,UAAU;YACV,UAAU;YACV,UAAU;YACV,WAAW;YACX,qBAAqB;YACrB,QAAQ;YACR,YAAY;SACb,CAAC;QACF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC;YAClB,UAAU;YACV,UAAU;YACV,UAAU;YACV,SAAS;YACT,OAAO;YACP,UAAU;YACV,SAAS;YACT,sBAAsB;YACtB,qBAAqB;SACtB,CAAC;KACH,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** One exact thing: a page by slug or id, or a document by id, path or filename. */
|
|
3
|
+
export declare const ReadInput: z.ZodObject<{
|
|
4
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
5
|
+
id: z.ZodOptional<z.ZodString>;
|
|
6
|
+
document: z.ZodOptional<z.ZodString>;
|
|
7
|
+
from_line: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
to_line: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type ReadInput = z.infer<typeof ReadInput>;
|
|
11
|
+
export declare const PageBody: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
slug: z.ZodString;
|
|
14
|
+
title: z.ZodString;
|
|
15
|
+
type: z.ZodNullable<z.ZodString>;
|
|
16
|
+
tags: z.ZodArray<z.ZodString>;
|
|
17
|
+
role: z.ZodEnum<{
|
|
18
|
+
knowledge: "knowledge";
|
|
19
|
+
source: "source";
|
|
20
|
+
inference: "inference";
|
|
21
|
+
ignored: "ignored";
|
|
22
|
+
}>;
|
|
23
|
+
management: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
remember: z.ZodOptional<z.ZodEnum<{
|
|
25
|
+
deny: "deny";
|
|
26
|
+
integrate: "integrate";
|
|
27
|
+
}>>;
|
|
28
|
+
dream: z.ZodOptional<z.ZodEnum<{
|
|
29
|
+
none: "none";
|
|
30
|
+
hygiene: "hygiene";
|
|
31
|
+
synthesize: "synthesize";
|
|
32
|
+
}>>;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
about: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
|
+
frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
37
|
+
summary: z.ZodNullable<z.ZodString>;
|
|
38
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
40
|
+
n: z.ZodNumber;
|
|
41
|
+
text: z.ZodString;
|
|
42
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
fact: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
source_fence_line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
46
|
+
links: z.ZodArray<z.ZodString>;
|
|
47
|
+
backlinks: z.ZodArray<z.ZodString>;
|
|
48
|
+
broken_links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
|
+
superseded: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
50
|
+
claim: z.ZodString;
|
|
51
|
+
valid_to: z.ZodString;
|
|
52
|
+
}, z.core.$strip>>>;
|
|
53
|
+
documents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
rel_path: z.ZodOptional<z.ZodString>;
|
|
56
|
+
mime: z.ZodOptional<z.ZodString>;
|
|
57
|
+
label: z.ZodOptional<z.ZodString>;
|
|
58
|
+
pages: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
parts: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
matched_page: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
62
|
+
quote: z.ZodOptional<z.ZodString>;
|
|
63
|
+
availability: z.ZodOptional<z.ZodObject<{
|
|
64
|
+
status: z.ZodEnum<{
|
|
65
|
+
degraded: "degraded";
|
|
66
|
+
unavailable: "unavailable";
|
|
67
|
+
available: "available";
|
|
68
|
+
}>;
|
|
69
|
+
available_from: z.ZodArray<z.ZodEnum<{
|
|
70
|
+
original: "original";
|
|
71
|
+
indexed_text: "indexed_text";
|
|
72
|
+
rendition: "rendition";
|
|
73
|
+
}>>;
|
|
74
|
+
missing_originals: z.ZodArray<z.ZodString>;
|
|
75
|
+
available_renditions: z.ZodArray<z.ZodString>;
|
|
76
|
+
missing_since: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
}, z.core.$strip>>>;
|
|
79
|
+
updated: z.ZodOptional<z.ZodString>;
|
|
80
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
export type PageBody = z.infer<typeof PageBody>;
|
|
83
|
+
export declare const DocumentBody: z.ZodObject<{
|
|
84
|
+
id: z.ZodString;
|
|
85
|
+
page: z.ZodNullable<z.ZodString>;
|
|
86
|
+
rel_path: z.ZodString;
|
|
87
|
+
mime: z.ZodNullable<z.ZodString>;
|
|
88
|
+
sha256: z.ZodString;
|
|
89
|
+
label: z.ZodNullable<z.ZodString>;
|
|
90
|
+
page_count: z.ZodNullable<z.ZodNumber>;
|
|
91
|
+
ocr: z.ZodBoolean;
|
|
92
|
+
text: z.ZodNullable<z.ZodString>;
|
|
93
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
availability: z.ZodOptional<z.ZodObject<{
|
|
95
|
+
status: z.ZodEnum<{
|
|
96
|
+
degraded: "degraded";
|
|
97
|
+
unavailable: "unavailable";
|
|
98
|
+
available: "available";
|
|
99
|
+
}>;
|
|
100
|
+
available_from: z.ZodArray<z.ZodEnum<{
|
|
101
|
+
original: "original";
|
|
102
|
+
indexed_text: "indexed_text";
|
|
103
|
+
rendition: "rendition";
|
|
104
|
+
}>>;
|
|
105
|
+
missing_originals: z.ZodArray<z.ZodString>;
|
|
106
|
+
available_renditions: z.ZodArray<z.ZodString>;
|
|
107
|
+
missing_since: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
export type DocumentBody = z.infer<typeof DocumentBody>;
|
|
111
|
+
export declare const ReadOutput: z.ZodObject<{
|
|
112
|
+
status: z.ZodEnum<{
|
|
113
|
+
ok: "ok";
|
|
114
|
+
empty: "empty";
|
|
115
|
+
degraded: "degraded";
|
|
116
|
+
unavailable: "unavailable";
|
|
117
|
+
}>;
|
|
118
|
+
degraded: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
119
|
+
no_embedding_model: "no_embedding_model";
|
|
120
|
+
no_reranker: "no_reranker";
|
|
121
|
+
no_derive_model: "no_derive_model";
|
|
122
|
+
no_expansion_model: "no_expansion_model";
|
|
123
|
+
embedding_failed: "embedding_failed";
|
|
124
|
+
rerank_failed: "rerank_failed";
|
|
125
|
+
derive_failed: "derive_failed";
|
|
126
|
+
expansion_failed: "expansion_failed";
|
|
127
|
+
no_vector_index: "no_vector_index";
|
|
128
|
+
partial_index: "partial_index";
|
|
129
|
+
no_document_text: "no_document_text";
|
|
130
|
+
document_source_missing: "document_source_missing";
|
|
131
|
+
no_graph_index: "no_graph_index";
|
|
132
|
+
no_entity_index: "no_entity_index";
|
|
133
|
+
entity_resolution_failed: "entity_resolution_failed";
|
|
134
|
+
partial_graph_index: "partial_graph_index";
|
|
135
|
+
graph_traversal_limited: "graph_traversal_limited";
|
|
136
|
+
no_answer_model: "no_answer_model";
|
|
137
|
+
answer_failed: "answer_failed";
|
|
138
|
+
answer_verification_failed: "answer_verification_failed";
|
|
139
|
+
answer_truncated: "answer_truncated";
|
|
140
|
+
}>>>;
|
|
141
|
+
note: z.ZodOptional<z.ZodString>;
|
|
142
|
+
page: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
id: z.ZodString;
|
|
144
|
+
slug: z.ZodString;
|
|
145
|
+
title: z.ZodString;
|
|
146
|
+
type: z.ZodNullable<z.ZodString>;
|
|
147
|
+
tags: z.ZodArray<z.ZodString>;
|
|
148
|
+
role: z.ZodEnum<{
|
|
149
|
+
knowledge: "knowledge";
|
|
150
|
+
source: "source";
|
|
151
|
+
inference: "inference";
|
|
152
|
+
ignored: "ignored";
|
|
153
|
+
}>;
|
|
154
|
+
management: z.ZodOptional<z.ZodObject<{
|
|
155
|
+
remember: z.ZodOptional<z.ZodEnum<{
|
|
156
|
+
deny: "deny";
|
|
157
|
+
integrate: "integrate";
|
|
158
|
+
}>>;
|
|
159
|
+
dream: z.ZodOptional<z.ZodEnum<{
|
|
160
|
+
none: "none";
|
|
161
|
+
hygiene: "hygiene";
|
|
162
|
+
synthesize: "synthesize";
|
|
163
|
+
}>>;
|
|
164
|
+
}, z.core.$strip>>;
|
|
165
|
+
about: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
166
|
+
aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
167
|
+
frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
168
|
+
summary: z.ZodNullable<z.ZodString>;
|
|
169
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
170
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
171
|
+
n: z.ZodNumber;
|
|
172
|
+
text: z.ZodString;
|
|
173
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
174
|
+
fact: z.ZodOptional<z.ZodString>;
|
|
175
|
+
}, z.core.$strip>>;
|
|
176
|
+
source_fence_line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
177
|
+
links: z.ZodArray<z.ZodString>;
|
|
178
|
+
backlinks: z.ZodArray<z.ZodString>;
|
|
179
|
+
broken_links: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
180
|
+
superseded: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
181
|
+
claim: z.ZodString;
|
|
182
|
+
valid_to: z.ZodString;
|
|
183
|
+
}, z.core.$strip>>>;
|
|
184
|
+
documents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
185
|
+
id: z.ZodString;
|
|
186
|
+
rel_path: z.ZodOptional<z.ZodString>;
|
|
187
|
+
mime: z.ZodOptional<z.ZodString>;
|
|
188
|
+
label: z.ZodOptional<z.ZodString>;
|
|
189
|
+
pages: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
parts: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
matched_page: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
193
|
+
quote: z.ZodOptional<z.ZodString>;
|
|
194
|
+
availability: z.ZodOptional<z.ZodObject<{
|
|
195
|
+
status: z.ZodEnum<{
|
|
196
|
+
degraded: "degraded";
|
|
197
|
+
unavailable: "unavailable";
|
|
198
|
+
available: "available";
|
|
199
|
+
}>;
|
|
200
|
+
available_from: z.ZodArray<z.ZodEnum<{
|
|
201
|
+
original: "original";
|
|
202
|
+
indexed_text: "indexed_text";
|
|
203
|
+
rendition: "rendition";
|
|
204
|
+
}>>;
|
|
205
|
+
missing_originals: z.ZodArray<z.ZodString>;
|
|
206
|
+
available_renditions: z.ZodArray<z.ZodString>;
|
|
207
|
+
missing_since: z.ZodOptional<z.ZodString>;
|
|
208
|
+
}, z.core.$strip>>;
|
|
209
|
+
}, z.core.$strip>>>;
|
|
210
|
+
updated: z.ZodOptional<z.ZodString>;
|
|
211
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
212
|
+
}, z.core.$strip>>;
|
|
213
|
+
document: z.ZodOptional<z.ZodObject<{
|
|
214
|
+
id: z.ZodString;
|
|
215
|
+
page: z.ZodNullable<z.ZodString>;
|
|
216
|
+
rel_path: z.ZodString;
|
|
217
|
+
mime: z.ZodNullable<z.ZodString>;
|
|
218
|
+
sha256: z.ZodString;
|
|
219
|
+
label: z.ZodNullable<z.ZodString>;
|
|
220
|
+
page_count: z.ZodNullable<z.ZodNumber>;
|
|
221
|
+
ocr: z.ZodBoolean;
|
|
222
|
+
text: z.ZodNullable<z.ZodString>;
|
|
223
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
224
|
+
availability: z.ZodOptional<z.ZodObject<{
|
|
225
|
+
status: z.ZodEnum<{
|
|
226
|
+
degraded: "degraded";
|
|
227
|
+
unavailable: "unavailable";
|
|
228
|
+
available: "available";
|
|
229
|
+
}>;
|
|
230
|
+
available_from: z.ZodArray<z.ZodEnum<{
|
|
231
|
+
original: "original";
|
|
232
|
+
indexed_text: "indexed_text";
|
|
233
|
+
rendition: "rendition";
|
|
234
|
+
}>>;
|
|
235
|
+
missing_originals: z.ZodArray<z.ZodString>;
|
|
236
|
+
available_renditions: z.ZodArray<z.ZodString>;
|
|
237
|
+
missing_since: z.ZodOptional<z.ZodString>;
|
|
238
|
+
}, z.core.$strip>>;
|
|
239
|
+
}, z.core.$strip>>;
|
|
240
|
+
}, z.core.$strip>;
|
|
241
|
+
export type ReadOutput = z.infer<typeof ReadOutput>;
|
|
242
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/ops/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,oFAAoF;AACpF,eAAO,MAAM,SAAS;;;;;;iBAelB,CAAC;AACL,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BnB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;iBAavB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
package/dist/ops/read.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DocumentAvailability, DocumentRef, Line, PageManagement, PageRole, ResultEnvelope, SupersededClaim, } from "../common.js";
|
|
3
|
+
/** One exact thing: a page by slug or id, or a document by id, path or filename. */
|
|
4
|
+
export const ReadInput = z
|
|
5
|
+
.object({
|
|
6
|
+
slug: z.string().optional(),
|
|
7
|
+
id: z.string().optional(),
|
|
8
|
+
/**
|
|
9
|
+
* A document id, its path in the knowledge base, or its bare filename — the three handles a
|
|
10
|
+
* page read hands you, all of which now work. A filename resolves only when it is unique.
|
|
11
|
+
*/
|
|
12
|
+
document: z.string().optional(),
|
|
13
|
+
/** Lines to return around a matched region. Whole body when absent. */
|
|
14
|
+
from_line: z.number().int().positive().optional(),
|
|
15
|
+
to_line: z.number().int().positive().optional(),
|
|
16
|
+
})
|
|
17
|
+
.refine((v) => Boolean(v.slug || v.id || v.document), {
|
|
18
|
+
message: 'read requires one of: slug, id, document',
|
|
19
|
+
});
|
|
20
|
+
export const PageBody = z.object({
|
|
21
|
+
id: z.string(),
|
|
22
|
+
slug: z.string(),
|
|
23
|
+
title: z.string(),
|
|
24
|
+
type: z.string().nullable(),
|
|
25
|
+
tags: z.array(z.string()),
|
|
26
|
+
role: PageRole,
|
|
27
|
+
management: PageManagement.optional(),
|
|
28
|
+
about: z.array(z.string()).optional(),
|
|
29
|
+
aliases: z.array(z.string()).optional(),
|
|
30
|
+
/** Every frontmatter key Akno found, preserved as read. Your own fields are
|
|
31
|
+
* passed through untouched. */
|
|
32
|
+
frontmatter: z.record(z.string(), z.unknown()),
|
|
33
|
+
summary: z.string().nullable(),
|
|
34
|
+
keywords: z.array(z.string()).optional(),
|
|
35
|
+
/** Numbered so a citation survives being quoted out of context. */
|
|
36
|
+
lines: z.array(Line),
|
|
37
|
+
/** Line at which `<!-- source -->` switches a knowledge page to source material. */
|
|
38
|
+
source_fence_line: z.number().int().positive().nullable().optional(),
|
|
39
|
+
links: z.array(z.string()),
|
|
40
|
+
backlinks: z.array(z.string()),
|
|
41
|
+
broken_links: z.array(z.string()).optional(),
|
|
42
|
+
superseded: z.array(SupersededClaim).optional(),
|
|
43
|
+
documents: z.array(DocumentRef).optional(),
|
|
44
|
+
updated: z.string().optional(),
|
|
45
|
+
bytes: z.number().int().nonnegative().optional(),
|
|
46
|
+
});
|
|
47
|
+
export const DocumentBody = z.object({
|
|
48
|
+
id: z.string(),
|
|
49
|
+
page: z.string().nullable(),
|
|
50
|
+
rel_path: z.string(),
|
|
51
|
+
mime: z.string().nullable(),
|
|
52
|
+
sha256: z.string(),
|
|
53
|
+
label: z.string().nullable(),
|
|
54
|
+
page_count: z.number().int().nonnegative().nullable(),
|
|
55
|
+
ocr: z.boolean(),
|
|
56
|
+
/** Extracted text. Present because extraction happens on arrival, always. */
|
|
57
|
+
text: z.string().nullable(),
|
|
58
|
+
bytes: z.number().int().nonnegative().optional(),
|
|
59
|
+
availability: DocumentAvailability.optional(),
|
|
60
|
+
});
|
|
61
|
+
export const ReadOutput = ResultEnvelope.extend({
|
|
62
|
+
page: PageBody.optional(),
|
|
63
|
+
document: DocumentBody.optional(),
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/ops/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,IAAI,EACJ,cAAc,EACd,QAAQ,EACR,cAAc,EACd,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,oFAAoF;AACpF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC;KACvB,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB;;;OAGG;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,uEAAuE;IACvE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACjD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAChD,CAAC;KACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE;IACpD,OAAO,EAAE,0CAA0C;CACpD,CAAC,CAAC;AAGL,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,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