@eum-agent/plugin 1.1.0 → 1.2.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.
@@ -1,144 +0,0 @@
1
- import { bi as ImageMediaType, rs as FileRef } from "./index-q05Kl0E4.js";
2
- //#region src/storage/files.d.ts
3
- /** Persistence contracts; physical storage is supplied by an extension. */
4
- /** The variant a model receives, when it is not the original. */
5
- interface FileVariantRow {
6
- readonly fileId: string;
7
- readonly mediaType: string;
8
- readonly size: number;
9
- readonly width?: number;
10
- readonly height?: number;
11
- }
12
- interface FileObjectRow {
13
- readonly fileId: string;
14
- readonly mediaType: string;
15
- readonly size: number;
16
- readonly width?: number;
17
- readonly height?: number;
18
- readonly model?: FileVariantRow;
19
- readonly createdAt: number;
20
- }
21
- interface FileAddress {
22
- readonly workspaceId: string;
23
- readonly fileId: string;
24
- }
25
- interface FileRows {
26
- /** Commits a synchronous file batch or restores its object and use rows on failure. */
27
- transaction(work: () => void): void;
28
- /** Inserts a file; an existing row for the same id is left as it was. */
29
- insert(workspaceId: string, row: FileObjectRow): void;
30
- get(workspaceId: string, fileId: string): FileObjectRow | undefined;
31
- /** Records that `sessionId` referenced the file; once per session. */
32
- recordUse(workspaceId: string, fileId: string, sessionId: string, at: number): void;
33
- /** Whether this exact workspace/file/session reference was recorded. */
34
- hasUse(workspaceId: string, fileId: string, sessionId: string): boolean;
35
- /** Files created before `before` that no session ever referenced, ordered
36
- * by workspace then id. */
37
- unusedBefore(before: number): FileAddress[];
38
- remove(workspaceId: string, fileId: string): void;
39
- /** Every id one workspace's rows keep on disk: originals and variants. */
40
- kept(workspaceId: string): ReadonlySet<string>;
41
- }
42
- //#endregion
43
- //#region node_modules/.cache/dts/plugin/src/platform-files.d.ts
44
- interface ImageInfo {
45
- readonly mediaType: ImageMediaType;
46
- readonly width: number;
47
- readonly height: number;
48
- }
49
- interface ImageVariant extends ImageInfo {
50
- readonly bytes: Buffer;
51
- }
52
- type ImageProblem = 'unsupported-type' | 'undecodable' | 'too-many-pixels';
53
- /** Decoded image properties needed by generation tools when preserving transparency. */
54
- interface DetailedImageInfo extends ImageInfo {
55
- /** Whether the source format stores an alpha channel. */
56
- readonly hasAlpha: boolean;
57
- /** Whether any decoded pixel is less than fully opaque. */
58
- readonly hasTransparentPixels: boolean;
59
- }
60
- type FileRefusalKind = 'too-large' | ImageProblem;
61
- /** Host-owned roots, persistence and clock used by the workspace file writer. */
62
- interface FileStoreOptions {
63
- /** The trusted work root containing workspace directories. */
64
- /** Optional extension-owned variant policy, read for each write. */
65
- readonly prepareVariant?: (bytes: Buffer, info: ImageInfo) => Promise<ImageVariant | undefined>;
66
- readonly workRoot: string;
67
- /** Caller-owned file catalog; generated writes use its synchronous transaction. */
68
- readonly rows: FileRows;
69
- /** UTC millisecond clock; defaults to Date.now. */
70
- readonly now?: () => number;
71
- /** Runs all generated-file rows and uses in one synchronous transaction. */
72
- readonly transaction?: (work: () => void) => void;
73
- }
74
- /** A validated, unpublished file; only the store that staged it can commit it. */
75
- interface StagedFile {
76
- /** The original byte count, used to bound a result before commit. */
77
- readonly size: number;
78
- }
79
- /** An incoming generated asset, with its claimed type checked against its bytes. */
80
- interface GeneratedFile {
81
- /** Declared MIME, which must agree with the validated bytes. */
82
- readonly mediaType: string;
83
- /** Display name of 1–200 UTF-16 code units; defaults to generated.<extension>. */
84
- readonly name?: string;
85
- /** A single-consumption source; the store closes the iterator on failure. */
86
- readonly body: AsyncIterable<Uint8Array>;
87
- }
88
- /** Limits and cancellation applied while consuming a generated asset. */
89
- interface StageOptions {
90
- /** Required asset family, checked against the MIME and validated content. */
91
- readonly outputKind: 'image' | 'audio' | 'video';
92
- /** Cancellation interrupts consumption and prevents publishing the stage. */
93
- readonly signal?: AbortSignal;
94
- /** An additional byte ceiling, such as a batch's remaining budget. */
95
- readonly maxBytes?: number;
96
- }
97
- /** Identity is checked after obtaining the workspace lock and before any writes. */
98
- interface CommitOptions {
99
- /** Cancellation observed before the synchronous commit prevents any references. */
100
- readonly signal?: AbortSignal;
101
- /** Throws if the captured owner/session/connection identity is no longer current. */
102
- readonly assertCurrent?: () => void;
103
- }
104
- /** Content-addressed workspace originals, image variants and unpublished generated batches. */
105
- interface FileStore {
106
- /** Chooses a stored media file name when the producer supplied none. */
107
- defaultName(mediaType: string): string;
108
- /**
109
- * Streams and validates a generated asset under its image/audio/video byte ceiling.
110
- * The returned stage is private until committed; failure deletes its temporary files.
111
- */
112
- stageStream(workspaceId: string, file: GeneratedFile, options: StageOptions): Promise<StagedFile>;
113
- /**
114
- * Publishes 1–8 same-workspace stages totaling at most 256 MiB in input order.
115
- * The workspace lock covers identity checks, placement and one row/use transaction.
116
- * Commit consumes all stages on either success or failure and preserves shared files.
117
- * Cancellation before the synchronous section wins; cancellation after commit does not undo it.
118
- */
119
- commitBatch(workspaceId: string, sessionId: string, files: readonly StagedFile[], options?: CommitOptions): Promise<readonly FileRef[]>;
120
- /** Deletes unpublished staged files; committed files are left untouched. */
121
- discard(files: readonly StagedFile[]): void;
122
- /** Stores an upload as it arrives; refuses past 20 MiB before it ends. */
123
- put(workspaceId: string, source: AsyncIterable<Uint8Array>): Promise<FileObjectRow>;
124
- /** Stores bytes already in memory, such as a tool's. */
125
- putBytes(workspaceId: string, bytes: Uint8Array): Promise<FileObjectRow>;
126
- /** A stored original's row, or nothing when the workspace holds no such file. */
127
- get(workspaceId: string, fileId: string): FileObjectRow | undefined;
128
- /** A reference to a stored original under `name`. */
129
- refOf(workspaceId: string, fileId: string, name: string): FileRef | undefined;
130
- /**
131
- * The bytes of `id`, checked against it: an original by its row, or a
132
- * variant when its `mediaType` is given. Nothing when the workspace holds
133
- * no such file or its bytes no longer match.
134
- */
135
- read(workspaceId: string, id: string, mediaType?: string): Promise<Buffer | undefined>;
136
- /** Where `id` is on disk, whether or not it is still there. */
137
- locationOf(workspaceId: string, id: string, mediaType?: string): string | undefined;
138
- /** Records that `sessionId` referenced a file; before its message is written. */
139
- recordUse(workspaceId: string, fileId: string, sessionId: string): void;
140
- /** Collects old unused uploads; startup also removes recent unindexed crash leftovers. */
141
- sweep(startup?: boolean): Promise<void>;
142
- }
143
- //#endregion
144
- export { FileStoreOptions as a, ImageProblem as c, StagedFile as d, FileStore as i, ImageVariant as l, DetailedImageInfo as n, GeneratedFile as o, FileRefusalKind as r, ImageInfo as s, CommitOptions as t, StageOptions as u };