@wirecat/cli-core 0.703.0 → 0.704.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 +49 -0
- package/dist/background/daily-archive-timer.d.ts +1 -1
- package/dist/documents/file-mirror-model.d.ts +88 -0
- package/dist/documents/file-mirror-model.js +1 -0
- package/dist/documents/index.d.ts +5 -2
- package/dist/documents/index.js +2 -0
- package/dist/documents/push-model.d.ts +3 -0
- package/dist/embeddings/onnx-runtime.d.ts +1 -1
- package/dist/embeddings/onnx-runtime.js +42 -61
- package/dist/errors/reasons.js +8 -0
- package/dist/ports/wirecat-tools.js +7 -0
- package/dist/sends/upload.js +0 -1
- package/dist/services/documents/mirror-watch.d.ts +12 -4
- package/dist/services/documents/mirror-watch.js +2 -0
- package/dist/services/documents/mirrors.d.ts +55 -35
- package/dist/services/documents/mirrors.js +63 -66
- package/dist/services/documents/push.d.ts +56 -4
- package/dist/services/documents/push.js +131 -24
- package/dist/services/files/mirror.d.ts +145 -0
- package/dist/services/files/mirror.js +603 -0
- package/dist/services/files/versions.d.ts +50 -0
- package/dist/services/files/versions.js +142 -0
- package/dist/services/metadata.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,55 @@ 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.704.0 — 19.11.2026
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`syncFileMirror` and the `FileTarget` port in `@wirecat/cli-core/documents`: two-way sync of plain files.** A CLI
|
|
13
|
+
for a file store (Yandex Disk next) keeps a local folder and a remote folder the same, whole files at a time,
|
|
14
|
+
binary and large files included, streamed both ways. A change on one side is copied, the same content on both is
|
|
15
|
+
adopted, different changes are a conflict that `keep` (`local`, `remote`, `both`) settles; deletions go to the
|
|
16
|
+
remote's trash and to `<mirror>/.wirecat-trash/`, and a run that would delete more than 2 files and also more than
|
|
17
|
+
50 or a quarter of the mirror stops first. Symbolic links are never followed, and a file system without hard links
|
|
18
|
+
(exFAT, FAT, FUSE, SMB) works through exclusive copies. Every write is conditional on the last listing, so a crash at any step is settled by the next
|
|
19
|
+
run. `syncFileMirrors`, `fileSyncState`, `fileMirrorStatus` and `fileRemoteChanges` (the watch lists only when the
|
|
20
|
+
remote's revision moved) complete it ([DOCUMENTS.md](docs/dev/DOCUMENTS.md#sync-plain-files-with-a-provider)).
|
|
21
|
+
- **A file mirror deletes only what it can prove was deleted.** The last sync saw the file, the side's listing is
|
|
22
|
+
complete, and the side's root is the same folder (the remote root's id; the local folder's device and inode, and
|
|
23
|
+
not empty while the state has files, as an unmounted drive is). Anything else is reported as `unknown` and the run
|
|
24
|
+
is partial, with a root problem reported as an error even at a first sync. Files under a symbolic link are
|
|
25
|
+
`unknown` too, as is a file moved remotely to a path the mirror refuses. When the owner confirms a replaced root
|
|
26
|
+
is the right folder, `repin: true` records it again and runs a first sync that deletes nothing and settles no
|
|
27
|
+
conflict; a mirror whose root was not replaced ignores it. A download cut off midway stays a conflict until its
|
|
28
|
+
partial file is moved away.
|
|
29
|
+
- **`fileVersions`: a local version store for mirrors.** Before a sync overwrites or deletes a local file, its content
|
|
30
|
+
is kept by sha256 under the profile's state folder, with an append-only log of every change both ways; versions stay
|
|
31
|
+
30 days, and a deleted file's last version stays for good; a version kept just before a crash stays 30 days too.
|
|
32
|
+
`restoreFileVersion` puts one back under the sync lock.
|
|
33
|
+
- **`watchMirrors` takes `localChanges` instead of `kindOf` and `stateOf`**, for an engine with its own state. A
|
|
34
|
+
document mirror passes `kindOf` and `stateOf` as before.
|
|
35
|
+
- **`scanLocal` reports each file's `size` and `mtimeMs`, and the symbolic links it skipped in `links`,** and takes an optional lookup that reuses a known hash when
|
|
36
|
+
both match, so a sync does not read unchanged files again. `conflictReport` adds `local_size` and `<remote>_size`
|
|
37
|
+
when a conflict has them. A mirror guard's `action` can also be `delete` and `move`.
|
|
38
|
+
|
|
39
|
+
### Changed — may break callers
|
|
40
|
+
|
|
41
|
+
- **`PushConflict.url` is optional, and `MirrorWatchOptions` is a type, not an interface.** A file conflict has no
|
|
42
|
+
URL, so `conflictReport` leaves `url` out when there is none; a document conflict still has one. Code that reads
|
|
43
|
+
`conflict.url` as a string, or extends `MirrorWatchOptions` with `interface … extends`, needs a small change. drive
|
|
44
|
+
needs none.
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
- **`models download` takes the native ONNX Runtime from WireCat's own npm packages.** Microsoft's GitHub repository,
|
|
49
|
+
and every release download in it, answers 404 since 17.11.2026, so the download failed on Linux and macOS and the
|
|
50
|
+
models ran through WebAssembly. The library now comes from `@wirecat/onnxruntime-<platform>` on npm (linux-x64,
|
|
51
|
+
linux-arm64, darwin-arm64, win32-x64, win32-arm64), 10–13 MB each, with the same sha256 check of the library. No
|
|
52
|
+
download depends on Microsoft's hosting any more. `bin/publish-onnxruntime` builds the packages once from
|
|
53
|
+
Microsoft's NuGet package `Microsoft.ML.OnnxRuntime` 1.30.0, and on Windows from `onnxruntime-node`'s npm tarball as
|
|
54
|
+
before. The Linux and Windows libraries are byte for byte the ones used so far. The macOS one is NuGet's build of
|
|
55
|
+
the same version, with a new sha256. Windows downloads 11 MB instead of the 113 MB `onnxruntime-node` tarball.
|
|
56
|
+
|
|
8
57
|
## 0.703.0 — 18.11.2026
|
|
9
58
|
|
|
10
59
|
### Added
|
|
@@ -24,12 +24,12 @@ export interface DailyArchiveTimerInput {
|
|
|
24
24
|
}
|
|
25
25
|
export declare const dailyArchiveTimer: (input: DailyArchiveTimerInput) => DailyArchiveTimer;
|
|
26
26
|
export declare const manageDailyArchiveTimer: (plan: DailyArchiveTimer, action: "install" | "start" | "stop" | "status" | "uninstall", system: Pick<ServerSystem, "platform" | "run">, env: NodeJS.ProcessEnv, signal?: AbortSignal) => Promise<{
|
|
27
|
-
action?: undefined;
|
|
28
27
|
name: string;
|
|
29
28
|
installed: boolean;
|
|
30
29
|
active: boolean;
|
|
31
30
|
servicePath: string;
|
|
32
31
|
timerPath: string;
|
|
32
|
+
action?: undefined;
|
|
33
33
|
} | {
|
|
34
34
|
active?: undefined;
|
|
35
35
|
name: string;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/** A file in the remote folder, as one listing returns it. */
|
|
2
|
+
export interface RemoteFile {
|
|
3
|
+
/** Relative to the listed folder, with `/` separators. */
|
|
4
|
+
path: string;
|
|
5
|
+
/** Stays the same across a move or an overwrite, so a remote rename is found by it. */
|
|
6
|
+
id: string;
|
|
7
|
+
size: number;
|
|
8
|
+
/** The plain sha256 of the content. A file without one (still being processed) is left for the next run. */
|
|
9
|
+
sha256?: string;
|
|
10
|
+
md5?: string;
|
|
11
|
+
modifiedAt: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* What a remote write expects to find at the path, from the last listing: nothing, or the file with these hashes.
|
|
15
|
+
* A target that cannot check the condition atomically checks it just before the write.
|
|
16
|
+
*/
|
|
17
|
+
export type Expect = {
|
|
18
|
+
absent: true;
|
|
19
|
+
} | {
|
|
20
|
+
sha256: string;
|
|
21
|
+
md5?: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A remote folder of plain files. Writes take the remote path (`root` joined with the relative path) and refuse with
|
|
25
|
+
* a `conflict` CliError when the file is not what `expect` says.
|
|
26
|
+
*/
|
|
27
|
+
export interface FileTarget {
|
|
28
|
+
identity(): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Every file under `root`, with the root folder's own id; undefined when the folder does not exist. `complete` is
|
|
31
|
+
* false when any page was skipped or a cap was hit: a file missing from such a listing is not taken as deleted.
|
|
32
|
+
*/
|
|
33
|
+
list(root: string, signal?: AbortSignal): Promise<{
|
|
34
|
+
rootId: string;
|
|
35
|
+
files: RemoteFile[];
|
|
36
|
+
complete: boolean;
|
|
37
|
+
} | undefined>;
|
|
38
|
+
/** Streams the file into `into`, a new local file. */
|
|
39
|
+
download(path: string, into: string, signal?: AbortSignal): Promise<void>;
|
|
40
|
+
/** Streams the local file `from` to `path` and returns the file as the remote now has it. */
|
|
41
|
+
upload(path: string, from: string, expect: Expect, signal?: AbortSignal): Promise<RemoteFile>;
|
|
42
|
+
/** Moves the file to the remote's trash, where the owner can restore it. */
|
|
43
|
+
trash(path: string, expect: Exclude<Expect, {
|
|
44
|
+
absent: true;
|
|
45
|
+
}>, signal?: AbortSignal): Promise<void>;
|
|
46
|
+
/** Creates the folder and its parents; a folder that exists is fine. */
|
|
47
|
+
ensureFolder(path: string, signal?: AbortSignal): Promise<void>;
|
|
48
|
+
/** A value that moves with every change on the remote, when the provider has one: a watch reads it before listing. */
|
|
49
|
+
revision?(signal?: AbortSignal): Promise<string>;
|
|
50
|
+
}
|
|
51
|
+
/** The last sync of one path: the base of the three-way comparison. */
|
|
52
|
+
export interface FileEntry {
|
|
53
|
+
id: string;
|
|
54
|
+
size: number;
|
|
55
|
+
sha256: string;
|
|
56
|
+
md5?: string;
|
|
57
|
+
remoteModified: string;
|
|
58
|
+
localMtimeMs: number;
|
|
59
|
+
localSize: number;
|
|
60
|
+
syncedAt: string;
|
|
61
|
+
}
|
|
62
|
+
export interface FileMirrorState {
|
|
63
|
+
version: 1;
|
|
64
|
+
principal: string;
|
|
65
|
+
root: string;
|
|
66
|
+
target: string;
|
|
67
|
+
/** Set at the first sync; a later listing with another id means the remote folder was moved or replaced. */
|
|
68
|
+
rootId?: string;
|
|
69
|
+
/** The local folder's device and inode at the first sync: another folder at the same path is not this mirror. */
|
|
70
|
+
localRoot?: {
|
|
71
|
+
dev: number;
|
|
72
|
+
ino: number;
|
|
73
|
+
};
|
|
74
|
+
entries: Record<string, FileEntry>;
|
|
75
|
+
/**
|
|
76
|
+
* Saved before each write. After a crash the next listing settles the write (same content on both sides is
|
|
77
|
+
* adopted); this only names the temporary file to remove and the operation to look up.
|
|
78
|
+
*/
|
|
79
|
+
pending: Record<string, {
|
|
80
|
+
op: FileStepKind;
|
|
81
|
+
operationId: string;
|
|
82
|
+
}>;
|
|
83
|
+
}
|
|
84
|
+
export interface FileMirrorStatePort {
|
|
85
|
+
read(): FileMirrorState;
|
|
86
|
+
save(state: FileMirrorState): void;
|
|
87
|
+
}
|
|
88
|
+
export type FileStepKind = "upload" | "download" | "adopt" | "trash-remote" | "trash-local" | "rename-local" | "keep-both" | "forget" | "conflict" | "unknown";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,14 +4,17 @@ export { fileText, readableFile } from "../services/documents/file-text.js";
|
|
|
4
4
|
export { documentIngestion, type IngestionOptions } from "../services/documents/ingestion.js";
|
|
5
5
|
export { type DocumentKnowledge, documentKnowledge } from "../services/documents/knowledge.js";
|
|
6
6
|
export { blocksMarkdown, inlineMarkdown, spliceMarkdown } from "../services/documents/markdown-splice.js";
|
|
7
|
-
export { type MirrorTrigger, type MirrorWatchEvent, type MirrorWatchOptions, watchMirrors, } from "../services/documents/mirror-watch.js";
|
|
7
|
+
export { type MirrorLocalCheck, type MirrorTrigger, type MirrorWatchEvent, type MirrorWatchOptions, watchMirrors, } from "../services/documents/mirror-watch.js";
|
|
8
8
|
export { conflictReport, fileMirrorState, type Mirror, type MirrorSyncOptions, mirrorId, mirrorStatus, syncMirrors, } from "../services/documents/mirrors.js";
|
|
9
9
|
export type { SyncOptions } from "../services/documents/ports.js";
|
|
10
10
|
export { extractDocumentMemories, type ImportedSource, type ProposalOptions } from "../services/documents/proposals.js";
|
|
11
|
-
export { type PushConflict, type PushOptions, type PushResult, planPush, pushDocuments, scanLocal, } from "../services/documents/push.js";
|
|
11
|
+
export { type MirrorAction, type PushConflict, type PushOptions, type PushResult, planPush, pushDocuments, scanLocal, } from "../services/documents/push.js";
|
|
12
12
|
export { type SyncResult, syncDocuments } from "../services/documents/sync.js";
|
|
13
|
+
export { type FileMirrorOptions, type FileMirrorResult, type FileMirrorSyncOptions, type FileStep, fileMirrorStatus, fileRemoteChanges, fileSyncState, syncFileMirror, syncFileMirrors, } from "../services/files/mirror.js";
|
|
14
|
+
export { type FileVersion, type FileVersions, fileVersions, restoreFileVersion, type VersionDirection, type VersionEvent, } from "../services/files/versions.js";
|
|
13
15
|
export { type Block, blockKey, blockShape, type Inline, type ListKind, normalizeInlines } from "./blocks.js";
|
|
14
16
|
export { catalogFiles } from "./catalog.js";
|
|
17
|
+
export type { Expect, FileEntry, FileMirrorState, FileMirrorStatePort, FileStepKind, FileTarget, RemoteFile, } from "./file-mirror-model.js";
|
|
15
18
|
export { htmlToMarkdown, markdownToHtml } from "./html-markdown.js";
|
|
16
19
|
export { markdownBlocks, type PlacedBlock, placedMarkdownBlocks } from "./markdown-blocks.js";
|
|
17
20
|
export type { DocumentSource, FeedlessDocumentSource, IndexedSource, PictureWriter, SourceChange, SourceContent, SourceFile, SourceIndex, SourceSkip, SourceState, SourceStatePort, SourceWalk, SourceWork, TabText, } from "./model.js";
|
package/dist/documents/index.js
CHANGED
|
@@ -9,6 +9,8 @@ export { conflictReport, fileMirrorState, mirrorId, mirrorStatus, syncMirrors, }
|
|
|
9
9
|
export { extractDocumentMemories } from "../services/documents/proposals.js";
|
|
10
10
|
export { planPush, pushDocuments, scanLocal, } from "../services/documents/push.js";
|
|
11
11
|
export { syncDocuments } from "../services/documents/sync.js";
|
|
12
|
+
export { fileMirrorStatus, fileRemoteChanges, fileSyncState, syncFileMirror, syncFileMirrors, } from "../services/files/mirror.js";
|
|
13
|
+
export { fileVersions, restoreFileVersion, } from "../services/files/versions.js";
|
|
12
14
|
export { blockKey, blockShape, normalizeInlines } from "./blocks.js";
|
|
13
15
|
export { catalogFiles } from "./catalog.js";
|
|
14
16
|
export { htmlToMarkdown, markdownToHtml } from "./html-markdown.js";
|
|
@@ -4,6 +4,9 @@ export interface LocalDocument {
|
|
|
4
4
|
absolute: string;
|
|
5
5
|
hash: string;
|
|
6
6
|
kind: string;
|
|
7
|
+
/** Set by `scanLocal`, so the next scan can skip hashing a file whose size and mtime did not change. */
|
|
8
|
+
size?: number;
|
|
9
|
+
mtimeMs?: number;
|
|
7
10
|
}
|
|
8
11
|
export interface Pushed<S> {
|
|
9
12
|
id: string;
|
|
@@ -19,7 +19,7 @@ export declare const nativeRuntimeFor: ({ platform, arch, musl, }?: {
|
|
|
19
19
|
}) => NativeRuntime | undefined;
|
|
20
20
|
export declare const runtimeFolder: (runtime: NativeRuntime, env?: NodeJS.ProcessEnv) => string;
|
|
21
21
|
/**
|
|
22
|
-
* The library this system's binding links to, out of
|
|
22
|
+
* The library this system's binding links to, out of WireCat's npm package of it, checked against its own sha256
|
|
23
23
|
* and placed beside a copy of the binding, which loads it from its own folder. Only from `models download`: a search
|
|
24
24
|
* never downloads. `undefined` when this system runs models through WebAssembly only.
|
|
25
25
|
*/
|
|
@@ -5,69 +5,50 @@ import { CliError } from "@wirecat/cli-base";
|
|
|
5
5
|
import { gunzipSync } from "fflate";
|
|
6
6
|
import { installFiles, megabytes, sharedModelsDirectory } from "../speech/install.js";
|
|
7
7
|
export const ONNX_RUNTIME_VERSION = "1.30.0";
|
|
8
|
-
const
|
|
9
|
-
name,
|
|
10
|
-
url: `https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_RUNTIME_VERSION}/${name}`,
|
|
11
|
-
sha256,
|
|
12
|
-
bytes,
|
|
13
|
-
});
|
|
8
|
+
const REGISTRY = "https://registry.npmjs.org";
|
|
14
9
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
10
|
+
* WireCat's own package of this system's library, on npm: Microsoft's GitHub releases went away on 17.11.2026, so no
|
|
11
|
+
* download depends on Microsoft's hosting. `bin/publish-onnxruntime` builds them from Microsoft's NuGet package, and
|
|
12
|
+
* on Windows from onnxruntime-node's npm tarball: its binding imports the DirectML build of onnxruntime.dll by
|
|
13
|
+
* ordinal, which Microsoft's CPU build lacks; DirectML.dll is loaded only when used, so the DLL alone runs on CPU.
|
|
17
14
|
*/
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
const wirecat = (target, sha256, bytes, library) => ({
|
|
16
|
+
archive: {
|
|
17
|
+
name: `onnxruntime-${target}-${ONNX_RUNTIME_VERSION}.tgz`,
|
|
18
|
+
url: `${REGISTRY}/@wirecat/onnxruntime-${target}/-/onnxruntime-${target}-${ONNX_RUNTIME_VERSION}.tgz`,
|
|
19
|
+
sha256,
|
|
20
|
+
bytes,
|
|
21
|
+
},
|
|
22
|
+
member: `package/${library.name}`,
|
|
23
|
+
library,
|
|
24
|
+
});
|
|
24
25
|
/** The systems the native-runtime workflow runs natively; elsewhere, and on musl, the models run through WebAssembly. */
|
|
25
26
|
const NATIVE = {
|
|
26
|
-
"linux-x64": {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
"win32-x64": {
|
|
54
|
-
archive: npmTarball,
|
|
55
|
-
member: "package/bin/napi-v6/win32/x64/onnxruntime.dll",
|
|
56
|
-
library: {
|
|
57
|
-
name: "onnxruntime.dll",
|
|
58
|
-
sha256: "508c362f5673483dd3a086379c392795b2e42d10d5e6f3f90ebd7ac21c97af67",
|
|
59
|
-
bytes: 28_754_232,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
"win32-arm64": {
|
|
63
|
-
archive: npmTarball,
|
|
64
|
-
member: "package/bin/napi-v6/win32/arm64/onnxruntime.dll",
|
|
65
|
-
library: {
|
|
66
|
-
name: "onnxruntime.dll",
|
|
67
|
-
sha256: "6c3a2abf5c6aca11c48a0d338a91af309f2266f25ce2e4084e6a87bbcb0fbfd0",
|
|
68
|
-
bytes: 29_815_136,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
27
|
+
"linux-x64": wirecat("linux-x64", "9c12e88ae495ae04e28802e52c2524a7a9c31aa715a67eeb636c85efcb08e5d9", 11_305_384, {
|
|
28
|
+
name: "libonnxruntime.so.1",
|
|
29
|
+
sha256: "245a6f8c38127551057a1cd1ffd59f0a186a227ade4f3492dea2494eb565542e",
|
|
30
|
+
bytes: 28_985_152,
|
|
31
|
+
}),
|
|
32
|
+
"linux-arm64": wirecat("linux-arm64", "4ec23a63f0e7f49edb63590f4bc8b0e8526bff5b3a2b19d768112f37dc50d09c", 10_386_392, {
|
|
33
|
+
name: "libonnxruntime.so.1",
|
|
34
|
+
sha256: "64e903a43a041240fd6bcffe0ac6d4fea47ef87bf24b9d097801bd00a9612a4b",
|
|
35
|
+
bytes: 25_135_496,
|
|
36
|
+
}),
|
|
37
|
+
"darwin-arm64": wirecat("darwin-arm64", "0e543a584a048b301ff96b81af4b001288e048577ce0f0b4a5a9c2df97979615", 12_921_423, {
|
|
38
|
+
name: "libonnxruntime.1.dylib",
|
|
39
|
+
sha256: "bffaa6ef856dba2c26f09c7c0e7018fd1562625f3485292c7ad28b83748c6879",
|
|
40
|
+
bytes: 43_879_424,
|
|
41
|
+
}),
|
|
42
|
+
"win32-x64": wirecat("win32-x64", "55924c8e4c3f975d131e943712c5fac6e5423fb2b0c356c96230f2ad18dc2792", 10_652_326, {
|
|
43
|
+
name: "onnxruntime.dll",
|
|
44
|
+
sha256: "508c362f5673483dd3a086379c392795b2e42d10d5e6f3f90ebd7ac21c97af67",
|
|
45
|
+
bytes: 28_754_232,
|
|
46
|
+
}),
|
|
47
|
+
"win32-arm64": wirecat("win32-arm64", "77e43743e580d6641e49b7cdeed57fd11f21a8cf27a186dd33a3db817b3ff7f2", 10_778_591, {
|
|
48
|
+
name: "onnxruntime.dll",
|
|
49
|
+
sha256: "6c3a2abf5c6aca11c48a0d338a91af309f2266f25ce2e4084e6a87bbcb0fbfd0",
|
|
50
|
+
bytes: 29_815_136,
|
|
51
|
+
}),
|
|
71
52
|
};
|
|
72
53
|
const onMusl = () => {
|
|
73
54
|
try {
|
|
@@ -94,7 +75,7 @@ const sizeOf = (path) => {
|
|
|
94
75
|
};
|
|
95
76
|
const isInstalled = (runtime, folder) => sizeOf(join(folder, runtime.library.name)) === runtime.library.bytes && sizeOf(join(folder, BINDING)) !== undefined;
|
|
96
77
|
/**
|
|
97
|
-
* The library this system's binding links to, out of
|
|
78
|
+
* The library this system's binding links to, out of WireCat's npm package of it, checked against its own sha256
|
|
98
79
|
* and placed beside a copy of the binding, which loads it from its own folder. Only from `models download`: a search
|
|
99
80
|
* never downloads. `undefined` when this system runs models through WebAssembly only.
|
|
100
81
|
*/
|
|
@@ -107,7 +88,7 @@ export const installNativeRuntime = async ({ env = process.env, progress = () =>
|
|
|
107
88
|
const folder = runtimeFolder(runtime, env);
|
|
108
89
|
if (isInstalled(runtime, folder))
|
|
109
90
|
return folder;
|
|
110
|
-
progress(`ONNX Runtime ${ONNX_RUNTIME_VERSION} for ${runtime.target}: ${megabytes(runtime.archive.bytes)} from
|
|
91
|
+
progress(`ONNX Runtime ${ONNX_RUNTIME_VERSION} for ${runtime.target}: ${megabytes(runtime.archive.bytes)} from npm`);
|
|
111
92
|
const parent = sharedModelsDirectory("runtime", env);
|
|
112
93
|
mkdirSync(parent, { recursive: true, mode: 0o700 });
|
|
113
94
|
const staging = mkdtempSync(join(parent, ".onnxruntime-"));
|
package/dist/errors/reasons.js
CHANGED
|
@@ -220,6 +220,14 @@ const OTHERS = [
|
|
|
220
220
|
["mirror.none", "not_found", "the profile has no mirrors; add one with mirrors add"],
|
|
221
221
|
["mirror.not-found", "not_found", "no such mirror in this profile; see mirrors list"],
|
|
222
222
|
validation("mirror.not-folder", "the path to mirror is not a folder"),
|
|
223
|
+
validation("mirror.symlink", "the file is under a symbolic link, which the sync does not follow"),
|
|
224
|
+
[
|
|
225
|
+
"mirror.too-many-deletions",
|
|
226
|
+
"confirmation_required",
|
|
227
|
+
"the sync would delete more files than the guard allows; check them with --dry-run and allow them explicitly",
|
|
228
|
+
],
|
|
229
|
+
["upload.mismatch", "conflict", "the uploaded file reads back with other content; the local file changed meanwhile"],
|
|
230
|
+
["download.mismatch", "invalid_response", "the downloaded file has other content than the listing said"],
|
|
223
231
|
["catalog.unavailable", "configuration_error", "the store has no shared catalog for this account"],
|
|
224
232
|
["catalog.not-found", "not_found", "the file or folder is not in the local catalog; run catalog import or sync"],
|
|
225
233
|
validation("catalog.depth-invalid", "tree depth must be between 0 and 50"),
|
|
@@ -64,6 +64,13 @@ export const WIRECAT_TOOLS = [
|
|
|
64
64
|
package: "@wirecat/bitrix24-cli",
|
|
65
65
|
does: "Bitrix24 CRM: deals, leads and pipelines, searchable with your other WireCat data",
|
|
66
66
|
},
|
|
67
|
+
{
|
|
68
|
+
command: "amo",
|
|
69
|
+
appName: "amo-cli",
|
|
70
|
+
envPrefix: "AMO",
|
|
71
|
+
package: "@wirecat/amo-cli",
|
|
72
|
+
does: "amoCRM and Kommo: deals, contacts and companies, searchable with your other WireCat data",
|
|
73
|
+
},
|
|
67
74
|
{
|
|
68
75
|
command: "pbx",
|
|
69
76
|
appName: "asterisk-cli",
|
package/dist/sends/upload.js
CHANGED
|
@@ -115,7 +115,6 @@ const CREDENTIAL_RUNS = [
|
|
|
115
115
|
*/
|
|
116
116
|
const WIRECAT_APPS = [
|
|
117
117
|
...WIRECAT_TOOLS.map(({ appName, envPrefix }) => ({ appName, prefix: envPrefix })),
|
|
118
|
-
{ appName: "amo-cli", prefix: "AMO" },
|
|
119
118
|
{ appName: "beeline-cli", prefix: "BEELINE" },
|
|
120
119
|
{ appName: "zm", prefix: "ZM" },
|
|
121
120
|
{ appName: "cli-messaging", prefix: "MESSAGING" },
|
|
@@ -12,11 +12,19 @@ export type MirrorWatchEvent<T> = {
|
|
|
12
12
|
mirrors: string[];
|
|
13
13
|
error: CliError;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/**
|
|
16
|
+
* How a watch tells which mirrors' local files differ from their state: a document push's kinds and state, or the
|
|
17
|
+
* engine's own check.
|
|
18
|
+
*/
|
|
19
|
+
export type MirrorLocalCheck<S> = {
|
|
18
20
|
kindOf(path: string): string | undefined;
|
|
19
21
|
stateOf(mirror: Mirror): PushStatePort<S>;
|
|
22
|
+
} | {
|
|
23
|
+
localChanges(mirrors: Mirror[]): Promise<string[]>;
|
|
24
|
+
};
|
|
25
|
+
export type MirrorWatchOptions<S> = MirrorLocalCheck<S> & {
|
|
26
|
+
mirrors: Mirror[];
|
|
27
|
+
signal: AbortSignal;
|
|
20
28
|
/** Ids of the mirrors whose remote files changed since the last call, or `all` when the provider cannot tell. */
|
|
21
29
|
remoteChanges?(signal: AbortSignal): Promise<string[] | "all">;
|
|
22
30
|
pollMs?: number;
|
|
@@ -28,7 +36,7 @@ export interface MirrorWatchOptions<S> {
|
|
|
28
36
|
watchFolder?(root: string, changed: () => void): () => void;
|
|
29
37
|
sleep?(milliseconds: number, signal: AbortSignal): Promise<void>;
|
|
30
38
|
now?(): number;
|
|
31
|
-
}
|
|
39
|
+
};
|
|
32
40
|
/**
|
|
33
41
|
* Keeps mirrors in sync until `signal` aborts: a cycle at start, then one for each mirror whose files were saved
|
|
34
42
|
* (after `quietMs` without another save), whose remote files changed, or whose files differ from the state at the
|
|
@@ -52,6 +52,8 @@ export async function* watchMirrors(sync, options) {
|
|
|
52
52
|
const differs = async (ids) => {
|
|
53
53
|
const chosen = [...ids].flatMap((id) => byId.get(id) ?? []);
|
|
54
54
|
try {
|
|
55
|
+
if ("localChanges" in options)
|
|
56
|
+
return await options.localChanges(chosen);
|
|
55
57
|
const items = await mirrorStatus(chosen, options.kindOf, options.stateOf);
|
|
56
58
|
return items.filter((item) => item.create.length || item.update.length).map((item) => item.id);
|
|
57
59
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import type { DocumentTarget, Keep, PushStatePort } from "../../documents/push-model.js";
|
|
2
3
|
import { type PushConflict, type PushOptions } from "./push.js";
|
|
3
4
|
/** A local folder mirrored into a remote folder, as the app's profile config keeps it. */
|
|
@@ -8,9 +9,14 @@ export interface Mirror {
|
|
|
8
9
|
}
|
|
9
10
|
export declare const mirrorId: (root: string, folder: string) => string;
|
|
10
11
|
/**
|
|
11
|
-
* A
|
|
12
|
-
* refused rather than reset, since a reset would
|
|
12
|
+
* A state file read against `schema`, saved 0600 in a 0700 folder. A missing file is `initial`, a first sync; an
|
|
13
|
+
* unreadable or invalid one is refused rather than reset, since a reset would treat every file as new.
|
|
13
14
|
*/
|
|
15
|
+
export declare const jsonState: <T>(path: string, schema: v.GenericSchema, initial: () => T) => {
|
|
16
|
+
read: () => T;
|
|
17
|
+
save: (state: T) => void;
|
|
18
|
+
};
|
|
19
|
+
/** A mirror's push state in `<dir>/<id>.json`. */
|
|
14
20
|
export declare const fileMirrorState: <S>(dir: string, mirror: Mirror, principal: string, kinds: [string, ...string[]]) => PushStatePort<S>;
|
|
15
21
|
/** What the next sync of each mirror would create or send, from local files and the state alone. */
|
|
16
22
|
export declare const mirrorStatus: <S>(mirrors: Mirror[], kindOf: (path: string) => string | undefined, stateOf: (mirror: Mirror) => PushStatePort<S>) => Promise<{
|
|
@@ -27,7 +33,7 @@ export declare const mirrorStatus: <S>(mirrors: Mirror[], kindOf: (path: string)
|
|
|
27
33
|
/** A conflict as the user reads it, with the remote side named the way the app names it (`google`). */
|
|
28
34
|
export declare const conflictReport: (conflict: PushConflict, remote: string) => {
|
|
29
35
|
path: string;
|
|
30
|
-
url
|
|
36
|
+
url?: string | undefined;
|
|
31
37
|
reason: string;
|
|
32
38
|
parts?: {
|
|
33
39
|
[x: string]: string;
|
|
@@ -35,52 +41,64 @@ export declare const conflictReport: (conflict: PushConflict, remote: string) =>
|
|
|
35
41
|
local: string;
|
|
36
42
|
}[] | undefined;
|
|
37
43
|
local_changed_at?: string | undefined;
|
|
44
|
+
local_size?: number | undefined;
|
|
38
45
|
};
|
|
46
|
+
interface MirrorLock {
|
|
47
|
+
assertHeld(): void;
|
|
48
|
+
release(): Promise<void> | void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Runs `sync` for each mirror under one lock. A mirror with conflicts, missing remote files or errors does not stop
|
|
52
|
+
* the others; it gets one `mirror.partial` issue, so the caller can answer `complete: false` and fail after printing.
|
|
53
|
+
*/
|
|
54
|
+
export declare const eachMirror: <R extends {
|
|
55
|
+
conflicts: PushConflict[];
|
|
56
|
+
errors: unknown[];
|
|
57
|
+
missing?: unknown[];
|
|
58
|
+
unknown?: unknown[];
|
|
59
|
+
}>(mirrors: Mirror[], lock: () => Promise<MirrorLock>, remote: string, sync: (mirror: Mirror, assertHeld: () => void) => Promise<R>) => Promise<{
|
|
60
|
+
items: (Omit<{
|
|
61
|
+
id: string;
|
|
62
|
+
path: string;
|
|
63
|
+
} & R, "conflicts"> & {
|
|
64
|
+
conflicts: {
|
|
65
|
+
path: string;
|
|
66
|
+
url?: string | undefined;
|
|
67
|
+
reason: string;
|
|
68
|
+
parts?: {
|
|
69
|
+
[x: string]: string;
|
|
70
|
+
last_sync: string;
|
|
71
|
+
local: string;
|
|
72
|
+
}[] | undefined;
|
|
73
|
+
local_changed_at?: string | undefined;
|
|
74
|
+
local_size?: number | undefined;
|
|
75
|
+
}[];
|
|
76
|
+
})[];
|
|
77
|
+
issues: {
|
|
78
|
+
code: "provider_error";
|
|
79
|
+
reason: string;
|
|
80
|
+
source: string;
|
|
81
|
+
}[];
|
|
82
|
+
}>;
|
|
39
83
|
export interface MirrorSyncOptions<S> extends Pick<PushOptions<S>, "principal" | "recreate" | "guard" | "operationId" | "errorOf" | "signal"> {
|
|
40
84
|
mirrors: Mirror[];
|
|
41
85
|
target: DocumentTarget<S>;
|
|
42
86
|
stateOf(mirror: Mirror): PushStatePort<S>;
|
|
43
87
|
keep?: Keep;
|
|
44
88
|
/** Taken once for all the mirrors, so a second sync or a watcher's next cycle waits its turn. */
|
|
45
|
-
lock(): Promise<
|
|
46
|
-
assertHeld(): void;
|
|
47
|
-
release(): Promise<void> | void;
|
|
48
|
-
}>;
|
|
89
|
+
lock(): Promise<MirrorLock>;
|
|
49
90
|
/** How the app names the remote side in conflict reports. */
|
|
50
91
|
remote: string;
|
|
51
92
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Syncs each mirror both ways. A mirror with conflicts, missing remote files or errors does not stop the others;
|
|
54
|
-
* it gets one `mirror.partial` issue, so the caller can answer `complete: false` and fail after printing.
|
|
55
|
-
*/
|
|
93
|
+
/** Syncs each mirror both ways, as `eachMirror` runs them. */
|
|
56
94
|
export declare const syncMirrors: <S>(options: MirrorSyncOptions<S>) => Promise<{
|
|
57
|
-
items: {
|
|
58
|
-
created: string[];
|
|
59
|
-
updated: string[];
|
|
60
|
-
pulled: string[];
|
|
61
|
-
unchanged: number;
|
|
62
|
-
missing: string[];
|
|
63
|
-
orphans: {
|
|
64
|
-
path: string;
|
|
65
|
-
url: string;
|
|
66
|
-
}[];
|
|
67
|
-
errors: {
|
|
68
|
-
path: string;
|
|
69
|
-
code: string;
|
|
70
|
-
message: string;
|
|
71
|
-
}[];
|
|
72
|
-
unsupported: number;
|
|
73
|
-
plan?: {
|
|
74
|
-
create: string[];
|
|
75
|
-
update: string[];
|
|
76
|
-
orphans: string[];
|
|
77
|
-
};
|
|
78
|
-
stopped?: true;
|
|
95
|
+
items: (Omit<{
|
|
79
96
|
id: string;
|
|
80
97
|
path: string;
|
|
98
|
+
} & import("./push.js").PushResult, "conflicts"> & {
|
|
81
99
|
conflicts: {
|
|
82
100
|
path: string;
|
|
83
|
-
url
|
|
101
|
+
url?: string | undefined;
|
|
84
102
|
reason: string;
|
|
85
103
|
parts?: {
|
|
86
104
|
[x: string]: string;
|
|
@@ -88,11 +106,13 @@ export declare const syncMirrors: <S>(options: MirrorSyncOptions<S>) => Promise<
|
|
|
88
106
|
local: string;
|
|
89
107
|
}[] | undefined;
|
|
90
108
|
local_changed_at?: string | undefined;
|
|
109
|
+
local_size?: number | undefined;
|
|
91
110
|
}[];
|
|
92
|
-
}[];
|
|
111
|
+
})[];
|
|
93
112
|
issues: {
|
|
94
113
|
code: "provider_error";
|
|
95
114
|
reason: string;
|
|
96
115
|
source: string;
|
|
97
116
|
}[];
|
|
98
117
|
}>;
|
|
118
|
+
export {};
|