@wirecat/cli-core 0.688.0 → 0.689.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/CHANGELOG.md +40 -0
- package/dist/cli/documents/index.d.ts +1 -0
- package/dist/cli/documents/index.js +1 -0
- package/dist/cli/documents/library.d.ts +107 -0
- package/dist/cli/documents/library.js +514 -0
- package/dist/cli/documents/testing/source-contract.d.ts +11 -6
- package/dist/cli/documents/testing/source-contract.js +54 -23
- package/dist/cli/documents/testing/source.d.ts +11 -3
- package/dist/cli/documents/testing/source.js +15 -10
- package/dist/documents/index.d.ts +3 -1
- package/dist/documents/index.js +2 -0
- package/dist/documents/model.d.ts +20 -6
- package/dist/documents/model.js +2 -1
- package/dist/errors/reasons.d.ts +1 -1
- package/dist/errors/reasons.js +11 -0
- package/dist/resolve.d.ts +1 -1
- package/dist/resolve.js +1 -1
- package/dist/search/account-list.d.ts +2 -0
- package/dist/search/account-list.js +32 -4
- package/dist/services/documents/file-text.d.ts +13 -0
- package/dist/services/documents/file-text.js +33 -0
- package/dist/services/documents/plan.d.ts +3 -2
- package/dist/services/documents/plan.js +50 -16
- package/dist/services/documents/ports.d.ts +2 -2
- package/dist/services/documents/sync.js +2 -2
- package/dist/services/message-resolution.d.ts +1 -1
- package/dist/services/message-resolution.js +1 -1
- package/dist/store/sqlite/manifest.js +2 -0
- package/dist/store/sqlite/migrations.generated.js +20 -0
- package/dist/store/sqlite/schema.d.ts +169 -0
- package/dist/store/sqlite/schema.js +18 -0
- package/dist/store/sqlite/vectors.d.ts +26 -1
- package/dist/store/sqlite/vectors.js +72 -15
- package/dist/store/vectors.js +6 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,46 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
|
|
|
5
5
|
minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
|
|
6
6
|
shape of this file.
|
|
7
7
|
|
|
8
|
+
## 0.689.0 — 17.11.2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **A document source without a change feed** (Yandex Disk, WebDAV, S3): `FeedlessDocumentSource`, a
|
|
13
|
+
`DocumentSource` without `startToken` and `changes`, which `syncDocuments` also takes. Every sync then walks the
|
|
14
|
+
selected folders in full, saves only the files that changed since the last pass, and removes the ones a finished
|
|
15
|
+
pass no longer found; an interrupted pass keeps what is held and goes on from its saved walk, and a chosen folder
|
|
16
|
+
that is gone is skipped as unavailable. `feedOf(source)` tells the two apart. `documentSourceContract` checks it
|
|
17
|
+
with the fixture's `change` and new `remove`, and `fakeDocumentSource` takes `feed: false`. See
|
|
18
|
+
[Documents](docs/dev/DOCUMENTS.md#a-source-without-a-change-feed).
|
|
19
|
+
- **A source that addresses files by path** gets the file the sync last listed: `metadata(id, known)`,
|
|
20
|
+
`children(id, folder)`, `childrenPage(id, cursor, folder)`, `content(id, maxChars, file)` and `bytes(id, file)`.
|
|
21
|
+
The arguments are optional, so an existing source is unchanged.
|
|
22
|
+
- **`documentLibraryCommands` mounts the whole shared documents set over a CLI's source** (`@wirecat/cli-core/documents/cli`):
|
|
23
|
+
`folders`, `sync`, `status`, `documents`, `search`, `catalog` and the knowledge groups, with the profile's files under
|
|
24
|
+
the CLI's state folder (`documentProfile`: chosen folders, sync state, walk, snapshots and the profile lock), the
|
|
25
|
+
shared store, and `claimDocumentAccount`, which keeps one provider account to one profile. The CLI gives its
|
|
26
|
+
source, how it files a document (`ingestion`), its words, a `documents list` row and an optional `folders browse`.
|
|
27
|
+
It is what notion-cli's `src/library.ts` and `src/commands/library.ts` did, so a new documents CLI writes only its
|
|
28
|
+
source. `folders add` keeps each chosen folder's metadata, which a path-addressed source reads before the first sync.
|
|
29
|
+
- **`fileText(bytes, file, command)` and `readableFile(file)`** (`@wirecat/cli-core/documents`): the text of a
|
|
30
|
+
downloaded PDF, docx, xlsx, CSV, TSV, text or Markdown file through cli-core's readers, or a `validation_error` that
|
|
31
|
+
says why there is none. drive-cli's `readFile` and `supported`, for every file source.
|
|
32
|
+
|
|
33
|
+
### Changed — may break callers
|
|
34
|
+
|
|
35
|
+
- **Store version 69: `search conversations` reads each chat's readiness instead of counting it on every search.**
|
|
36
|
+
The counts it reports (messages new, edited or deleted since the build; chunks with current, stale and missing
|
|
37
|
+
vectors) are saved per chat and model in `conversation_readiness` the first time they are counted. Triggers drop a
|
|
38
|
+
chat's row when its messages, revisions or build change, and a model's rows when its vectors
|
|
39
|
+
change, so the next read counts again. Forward-only; `minCompatible` stays 56.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- `--source documents` names every documents account (Google Drive, Notion) beside the imports that hold documents.
|
|
44
|
+
Drive and Notion accounts are stored and searched as notes folders, so the word missed them before.
|
|
45
|
+
- A search whose `--source` is one word that names no account in the store fails with the words that do name
|
|
46
|
+
something. Beside other entries, or in a group, the word stays a skipped entry the answer reports, as before.
|
|
47
|
+
|
|
8
48
|
## 0.688.0 — 17.11.2026
|
|
9
49
|
|
|
10
50
|
### Added
|
|
@@ -34,3 +34,4 @@ export interface DocumentCommands<S> {
|
|
|
34
34
|
* when given, `mirrors`, in that order. Answers the `documents` group, for the CLI's live subcommands.
|
|
35
35
|
*/
|
|
36
36
|
export declare const addDocumentCommands: <S>(program: Command, options: DocumentCommands<S>) => Command;
|
|
37
|
+
export { claimDocumentAccount, type DocumentLibraryOptions, type DocumentLibraryTools, type DocumentSourceRun, type DocumentWarning, documentLibraryCommands, documentProfile, } from "./library.js";
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type ErrorCode } from "@wirecat/cli-base";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { Deadline } from "../../background/budget.js";
|
|
4
|
+
import { type documentIngestion, type FeedlessDocumentSource, type SourceContent, type SourceFile, type SourceStatePort } from "../../documents.js";
|
|
5
|
+
import type { ProviderEntry } from "../../domain/providers.js";
|
|
6
|
+
import type { AppIdentity } from "../../ports/app.js";
|
|
7
|
+
import type { EventSink } from "../../runs/events.js";
|
|
8
|
+
import type { MessageStore } from "../../store/index.js";
|
|
9
|
+
import { baseContext } from "../context.js";
|
|
10
|
+
import { type Body } from "../envelope.js";
|
|
11
|
+
import { ProfileTokenStore } from "../profile-token.js";
|
|
12
|
+
import type { DocumentKnowledgePort } from "./knowledge.js";
|
|
13
|
+
import type { DocumentWords } from "./words.js";
|
|
14
|
+
type Resolve = Parameters<typeof baseContext>[1];
|
|
15
|
+
type Ingestion<M extends SourceFile> = ReturnType<typeof documentIngestion<M>>;
|
|
16
|
+
/** Something a source met on its way and went on past: one per file, gathered into the answer's issues. */
|
|
17
|
+
export interface DocumentWarning {
|
|
18
|
+
id?: string;
|
|
19
|
+
code: ErrorCode;
|
|
20
|
+
reason: string;
|
|
21
|
+
message: string;
|
|
22
|
+
}
|
|
23
|
+
/** What a run gives the CLI's source beside the request log. */
|
|
24
|
+
export interface DocumentSourceRun {
|
|
25
|
+
deadline?: Deadline;
|
|
26
|
+
warn(warning: DocumentWarning): void;
|
|
27
|
+
}
|
|
28
|
+
export interface DocumentLibraryOptions<M extends SourceFile> {
|
|
29
|
+
app: AppIdentity;
|
|
30
|
+
/** The CLI's settings, as `baseContext` reads them: `configuration.resolveSettings`. */
|
|
31
|
+
resolveSettings: Resolve;
|
|
32
|
+
provider: ProviderEntry;
|
|
33
|
+
words: DocumentWords;
|
|
34
|
+
/** The service's name in messages: "Yandex Disk". */
|
|
35
|
+
service: string;
|
|
36
|
+
/** The provider's adapter for one run, built inside cli-core's run so its requests are recorded. */
|
|
37
|
+
source(command: Command, events: EventSink, run: DocumentSourceRun): FeedlessDocumentSource<M>;
|
|
38
|
+
/** How the CLI files a document in the shared store: its catalog entry and front matter. */
|
|
39
|
+
ingestion(store: MessageStore): Ingestion<M>;
|
|
40
|
+
/** A file or folder id from what the user typed: an id, a link, a path. */
|
|
41
|
+
idOf(input: string): string;
|
|
42
|
+
/** The folder `folders add` names, read live; refuse one the account cannot use. Defaults to `metadata(idOf(input))`. */
|
|
43
|
+
folder?(source: FeedlessDocumentSource<M>, input: string): Promise<M>;
|
|
44
|
+
isFolder(file: M): boolean;
|
|
45
|
+
isDocument?(file: M): boolean;
|
|
46
|
+
/** Why a file is kept by name only (an unsupported type, too large); undefined reads it. */
|
|
47
|
+
skipReason?(file: M): string | undefined;
|
|
48
|
+
/** One row of `documents list`. */
|
|
49
|
+
row(file: M, reference: string): object;
|
|
50
|
+
/** The longest text the store keeps of one document. */
|
|
51
|
+
textLimit: number;
|
|
52
|
+
/** The entries one sync walks before it stops and saves. */
|
|
53
|
+
maxEntries: number;
|
|
54
|
+
/** What `sync` says it covers. */
|
|
55
|
+
coverage: string;
|
|
56
|
+
/** The accounts a document names, for `identities list`; none when the provider shows none. */
|
|
57
|
+
people?: DocumentKnowledgePort["people"];
|
|
58
|
+
/** The CLI's own `folders browse`. */
|
|
59
|
+
browse?(folders: Command, tools: DocumentLibraryTools<M>): void;
|
|
60
|
+
}
|
|
61
|
+
/** What the CLI's own commands beside the shared ones may use, for the running command. */
|
|
62
|
+
export interface DocumentLibraryTools<M extends SourceFile> {
|
|
63
|
+
env(): NodeJS.ProcessEnv;
|
|
64
|
+
profile(): string;
|
|
65
|
+
output(body: Body): void;
|
|
66
|
+
roots(): string[];
|
|
67
|
+
/** Runs `body` with the provider's source inside cli-core's run. */
|
|
68
|
+
withSource<T>(body: (source: FeedlessDocumentSource<M>) => Promise<T>): Promise<T>;
|
|
69
|
+
}
|
|
70
|
+
interface Folders<M extends SourceFile> {
|
|
71
|
+
roots: string[];
|
|
72
|
+
/** Each chosen folder as `folders add` read it: a source that addresses by path finds it before the first sync. */
|
|
73
|
+
files?: Record<string, M>;
|
|
74
|
+
/** When the choice last changed: a sync before it copied another scope. */
|
|
75
|
+
changed_at?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* One profile's document files under the CLI's state folder: the chosen folders, the sync's checkpoint, its walk and
|
|
79
|
+
* one snapshot per document, each a private file.
|
|
80
|
+
*/
|
|
81
|
+
export declare const documentProfile: <M extends SourceFile>(app: AppIdentity, env: NodeJS.ProcessEnv, profile: string) => {
|
|
82
|
+
dir: string;
|
|
83
|
+
folders: () => Folders<M>;
|
|
84
|
+
saveFolders: (roots: string[], files: Record<string, M>) => void;
|
|
85
|
+
state: (principal: string) => SourceStatePort<M>;
|
|
86
|
+
synced: () => boolean;
|
|
87
|
+
walkUnderWay: () => boolean;
|
|
88
|
+
snapshot: (id: string) => SourceContent<M> | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* The lock a sync and every write to the local copy take, so a tag added during a sync is not lost. A second
|
|
91
|
+
* holder is refused at once: waiting would hold an agent's tool call for the length of a sync.
|
|
92
|
+
*/
|
|
93
|
+
locked: <T>(fn: (assertHeld: () => void) => Promise<T>) => Promise<T>;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Takes a provider account for a profile before its copy is written. One account is one collection in the shared
|
|
97
|
+
* store, so two profiles on it would each remove the other's documents; and a profile's copy stays with the account
|
|
98
|
+
* it was synced from.
|
|
99
|
+
*/
|
|
100
|
+
export declare const claimDocumentAccount: (app: AppIdentity, env: NodeJS.ProcessEnv, profile: string, account: string, tokens: Pick<ProfileTokenStore, "read">) => void;
|
|
101
|
+
/**
|
|
102
|
+
* cli-core's shared `folders`, `sync`, `status`, `documents`, `search`, `catalog` and knowledge groups over a CLI's
|
|
103
|
+
* document source, its files under the CLI's state folder and the shared store. The CLI gives the source, how it
|
|
104
|
+
* files a document and its words. Returned as commands to add to the program.
|
|
105
|
+
*/
|
|
106
|
+
export declare const documentLibraryCommands: <M extends SourceFile>(options: DocumentLibraryOptions<M>) => Command[];
|
|
107
|
+
export {};
|