@open33/harness-attachment 0.0.0-stage → 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.
@@ -0,0 +1,135 @@
1
+ /** Durable attachment storage seam (`ctx.attachments`). @module @open33/harness-attachment */
2
+ import { Context, Service } from '@open33/cordis';
3
+ import { AttachmentError } from './error.ts';
4
+ import type { AdmittedPromptContentPart, AttachmentAdmissionPart, EncodedFileAttachment, FileAttachmentRef, ImageAttachmentLimits, ImageAttachmentRef, ImageRequestTarget, RequestImageAttachment, SaveFileAttachment, SaveFileStreamAttachment, SaveImageAttachment, StoredImageAttachment } from './types.ts';
5
+ export { AttachmentId, ImageVariantId } from './brand.ts';
6
+ export { AttachmentError, isAttachmentError, isImageAdmissionError } from './error.ts';
7
+ export type { AttachmentErrorCode, ImageAdmissionErrorCode } from './error.ts';
8
+ export { admitEncodedFile, admitEncodedImages } from './admission.ts';
9
+ export { longEdgeDimensions, requestImageDimensions } from './request-projection.ts';
10
+ export type { ProjectedDimensions } from './request-projection.ts';
11
+ export type { AttachmentId as AttachmentIdType, AdmittedPromptContentPart, AttachmentAdmissionPart, EncodedFileAttachment, EncodedImageAttachment, FileAttachmentRef, ImageAttachmentLimits, ImageAttachmentRef, ImageRequestTarget, ImageMediaType, PromptContentPart, RequestImageAttachment, SaveFileAttachment, SaveFileStreamAttachment, SaveImageAttachment, StoredImageAttachment, } from './types.ts';
12
+ declare module '@open33/cordis' {
13
+ interface Context {
14
+ attachments: AttachmentStore;
15
+ }
16
+ }
17
+ /** Immutable binary attachment service. Implementations validate bytes before publishing a reference. */
18
+ export declare abstract class AttachmentStore extends Service {
19
+ constructor(ctx: Context);
20
+ /** Deployment-resolved image policy used by authoritative and fast-path validation. */
21
+ abstract readonly imageLimits: ImageAttachmentLimits;
22
+ /**
23
+ * Validate one image without persisting it.
24
+ * Batch callers validate every member before saving any member.
25
+ * @param input - encoded bytes, declared media type, and optional display name.
26
+ * @returns completion after the encoded raster has been fully decoded.
27
+ */
28
+ abstract validateImage(input: SaveImageAttachment): Promise<void>;
29
+ /**
30
+ * Validate one ordered image batch before committing any member.
31
+ * Validation failures start no writes; storage failures return no partial
32
+ * references, although already published content-addressed objects may stay
33
+ * unreachable until a future retention policy collects them.
34
+ * @param inputs - encoded images in their owning message order.
35
+ * @returns durable references in the exact input order.
36
+ */
37
+ protected validateImageBatch(inputs: readonly SaveImageAttachment[]): void;
38
+ /**
39
+ * Validate and durably commit one ordered image batch.
40
+ * @param inputs - encoded images in owning-message order.
41
+ * @returns durable normalized attachment references in the same order after every member succeeds.
42
+ */
43
+ saveImages(inputs: readonly SaveImageAttachment[]): Promise<readonly ImageAttachmentRef[]>;
44
+ /**
45
+ * Admit one Host prompt and replace each encoded image with its durable reference.
46
+ * Text, durable file references, and already stored images pass through unchanged.
47
+ * Every image part counts toward `maxImagesPerMessage` and `maxMessageImageBytes`;
48
+ * a stored image counts the bytes of the upload that stored it. Refused content
49
+ * starts no writes. A prompt without encoded images performs no storage operation.
50
+ * @param content - prompt parts in message order after upload receipt resolution.
51
+ * @returns admitted prompt parts in the same order as `content`.
52
+ * @throws AttachmentError when the image batch is refused.
53
+ */
54
+ admitPromptContent(content: readonly AttachmentAdmissionPart[]): Promise<AdmittedPromptContentPart[]>;
55
+ /**
56
+ * Decode and durably commit one canonical base64 file upload.
57
+ * @param input - canonical base64 bytes and optional display name.
58
+ * @returns the durable content-addressed file reference.
59
+ * @throws AttachmentError when the encoding or storage operation is refused.
60
+ */
61
+ admitEncodedFile(input: EncodedFileAttachment): Promise<FileAttachmentRef>;
62
+ /**
63
+ * Identify a failure emitted by this attachment capability by its stable code.
64
+ * @param error - value caught from an attachment operation.
65
+ * @returns whether the value is an attachment failure.
66
+ */
67
+ isAttachmentError(error: unknown): error is AttachmentError;
68
+ /**
69
+ * Validate and durably commit one image before its owning session event is appended.
70
+ * The returned reference describes the persisted normalized image. When
71
+ * normalization reduces the raster, its `originalDimensions` records the
72
+ * orientation-applied input dimensions.
73
+ * @param input - encoded bytes, declared media type, and optional display name.
74
+ * @returns the durable content-addressed normalized image reference.
75
+ */
76
+ abstract saveImage(input: SaveImageAttachment): Promise<ImageAttachmentRef>;
77
+ /**
78
+ * Read one image and verify its ID, format, byte length, and dimensions against the supplied reference.
79
+ * @param ref - supplied image reference; name and originalDimensions are preserved without file verification.
80
+ * @param signal - optional cancellation for backend read and verification work.
81
+ * @returns the verified bytes and normalized attachment reference.
82
+ * @throws the signal reason when aborted, or a storage error when verification fails.
83
+ */
84
+ abstract readImage(ref: ImageAttachmentRef, signal?: AbortSignal): Promise<StoredImageAttachment>;
85
+ /**
86
+ * Locate the provider-owned normalized object in the harness host filesystem.
87
+ * @param ref - durable normalized attachment reference.
88
+ * @returns an absolute host path, or undefined when this backend is not host-file-backed.
89
+ * @throws an AttachmentError when the durable reference is invalid.
90
+ */
91
+ imageHostPath(ref: ImageAttachmentRef): string | undefined;
92
+ /**
93
+ * Durably commit one file byte-for-byte before its owning session event is
94
+ * appended. Files carry no admission limits: any byte content and length is
95
+ * accepted, and the stored object is the exact submitted bytes. Backends
96
+ * without verbatim file storage keep this default rejection.
97
+ * @param input - exact bytes and optional display name.
98
+ * @returns the durable content-addressed file reference.
99
+ */
100
+ saveFile(input: SaveFileAttachment): Promise<FileAttachmentRef>;
101
+ /**
102
+ * Durably commit one file byte-for-byte from bounded chunks. Providers must
103
+ * apply backpressure and must not collect the complete file in memory.
104
+ * Backends without streamed verbatim storage keep this default rejection.
105
+ * @param input - ordered exact bytes, optional cancellation, and display name.
106
+ * @returns the durable content-addressed file reference.
107
+ */
108
+ saveFileStream(input: SaveFileStreamAttachment): Promise<FileAttachmentRef>;
109
+ /**
110
+ * Read and verify one verbatim stored file as bounded chunks. Providers must
111
+ * not collect the complete file in memory. Backends without verbatim file
112
+ * reads keep this default rejection.
113
+ * @param ref - durable file reference from the session log.
114
+ * @param signal - optional cancellation for backend reads and verification work.
115
+ * @returns exact file bytes in order; integrity failures reject the iteration.
116
+ */
117
+ readFileStream(ref: FileAttachmentRef, signal?: AbortSignal): AsyncIterable<Uint8Array>;
118
+ /**
119
+ * Locate the verbatim stored file object in the harness host filesystem.
120
+ * @param ref - durable file reference.
121
+ * @returns an absolute host path, or undefined when this backend is not host-file-backed.
122
+ * @throws an AttachmentError when the durable reference is invalid.
123
+ */
124
+ fileHostPath(ref: FileAttachmentRef): string | undefined;
125
+ /**
126
+ * Generate or read one deterministic model-request version from the stored normalized image.
127
+ * @param ref - durable provider-independent normalized attachment reference.
128
+ * @param target - route-chosen dimensions and byte target; an unmet byte target yields the smallest ladder output.
129
+ * @param signal - optional cancellation.
130
+ * @returns request bytes and the cache/upload identity covering every transform input.
131
+ */
132
+ readImageRequest(ref: ImageAttachmentRef, target: ImageRequestTarget, signal?: AbortSignal): Promise<RequestImageAttachment>;
133
+ }
134
+ export default AttachmentStore;
135
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAG9F,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAA+C,MAAM,YAAY,CAAA;AACzF,OAAO,KAAK,EACV,yBAAyB,EACzB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAElB,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AACtF,YAAY,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAA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E,OAAO,GAAG,KAAK,IAAI,eAAe;IAI3D;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAE3E;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAEjG;;;;;OAKG;IACH,aAAa,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,GAAG,SAAS;IAK1D;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQ/D;;;;;;OAMG;IACH,cAAc,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQ3E;;;;;;;OAOG;IACI,cAAc,CACnB,GAAG,EAAE,iBAAiB,EACtB,MAAM,CAAC,EAAE,WAAW,GACnB,aAAa,CAAC,UAAU,CAAC;IAS5B;;;;;OAKG;IACH,YAAY,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS;IAKxD;;;;;;OAMG;IACH,gBAAgB,CACd,GAAG,EAAE,kBAAkB,EACvB,MAAM,EAAE,kBAAkB,EAC1B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC;CAUnC;AAED,eAAe,eAAe,CAAA"}
@@ -0,0 +1,181 @@
1
+ /** Durable attachment storage seam (`ctx.attachments`). @module @open33/harness-attachment */
2
+ import { Buffer } from 'node:buffer';
3
+ import { Service } from '@open33/cordis';
4
+ import { admitEncodedFile as admitFileInput, admitEncodedImages } from "./admission.js";
5
+ import { AttachmentError, isAttachmentError as matchesAttachmentError } from "./error.js";
6
+ export { AttachmentId, ImageVariantId } from "./brand.js";
7
+ export { AttachmentError, isAttachmentError, isImageAdmissionError } from "./error.js";
8
+ export { admitEncodedFile, admitEncodedImages } from "./admission.js";
9
+ export { longEdgeDimensions, requestImageDimensions } from "./request-projection.js";
10
+ /** Whether one admission part still carries encoded image bytes. */
11
+ function isEncodedImage(part) {
12
+ return part.type === 'image' && !('attachment' in part);
13
+ }
14
+ /** Whether one admission part references an image an earlier upload stored. */
15
+ function isStoredImage(part) {
16
+ return part.type === 'image' && 'attachment' in part;
17
+ }
18
+ /** Refuse one message whose images exceed the configured count or aggregate byte limit. */
19
+ function assertMessageImages(limits, count, bytes) {
20
+ if (count > limits.maxImagesPerMessage) {
21
+ throw new AttachmentError('Image batch exceeds the configured image-count limit.', 'TOO_MANY_IMAGES');
22
+ }
23
+ if (bytes > limits.maxMessageImageBytes) {
24
+ throw new AttachmentError('Image batch exceeds the configured aggregate image-byte limit.', 'IMAGES_TOO_LARGE');
25
+ }
26
+ }
27
+ /** Immutable binary attachment service. Implementations validate bytes before publishing a reference. */
28
+ export class AttachmentStore extends Service {
29
+ constructor(ctx) {
30
+ super(ctx, 'attachments');
31
+ }
32
+ /**
33
+ * Validate one ordered image batch before committing any member.
34
+ * Validation failures start no writes; storage failures return no partial
35
+ * references, although already published content-addressed objects may stay
36
+ * unreachable until a future retention policy collects them.
37
+ * @param inputs - encoded images in their owning message order.
38
+ * @returns durable references in the exact input order.
39
+ */
40
+ validateImageBatch(inputs) {
41
+ const limits = this.imageLimits;
42
+ assertMessageImages(limits, inputs.length, inputs.reduce((sum, input) => sum + input.data.byteLength, 0));
43
+ for (const input of inputs) {
44
+ if (!limits.mediaTypes.includes(input.mediaType)) {
45
+ throw new AttachmentError(`Image type ${input.mediaType} is not accepted by this deployment.`, 'UNSUPPORTED_IMAGE_TYPE');
46
+ }
47
+ }
48
+ }
49
+ /**
50
+ * Validate and durably commit one ordered image batch.
51
+ * @param inputs - encoded images in owning-message order.
52
+ * @returns durable normalized attachment references in the same order after every member succeeds.
53
+ */
54
+ async saveImages(inputs) {
55
+ this.validateImageBatch(inputs);
56
+ for (const input of inputs)
57
+ await this.validateImage(input);
58
+ const refs = [];
59
+ for (const input of inputs)
60
+ refs.push(await this.saveImage(input));
61
+ return refs;
62
+ }
63
+ /**
64
+ * Admit one Host prompt and replace each encoded image with its durable reference.
65
+ * Text, durable file references, and already stored images pass through unchanged.
66
+ * Every image part counts toward `maxImagesPerMessage` and `maxMessageImageBytes`;
67
+ * a stored image counts the bytes of the upload that stored it. Refused content
68
+ * starts no writes. A prompt without encoded images performs no storage operation.
69
+ * @param content - prompt parts in message order after upload receipt resolution.
70
+ * @returns admitted prompt parts in the same order as `content`.
71
+ * @throws AttachmentError when the image batch is refused.
72
+ */
73
+ async admitPromptContent(content) {
74
+ const encoded = content.filter(isEncodedImage);
75
+ const stored = content.filter(isStoredImage);
76
+ // Each upload passed the limits alone; the encoded batch below checks only itself.
77
+ if (stored.length > 0) {
78
+ assertMessageImages(this.imageLimits, encoded.length + stored.length, encoded.reduce((sum, part) => sum + Buffer.byteLength(part.data, 'base64'), 0)
79
+ + stored.reduce((sum, part) => sum + part.encodedBytes, 0));
80
+ }
81
+ const refs = encoded.length === 0 ? [] : await admitEncodedImages(this, encoded);
82
+ let next = 0;
83
+ return content.map((part) => {
84
+ if (part.type === 'text')
85
+ return { type: 'text', text: part.text };
86
+ if (part.type === 'file')
87
+ return { type: 'file', attachment: part.attachment };
88
+ if ('attachment' in part)
89
+ return { type: 'image', attachment: part.attachment };
90
+ return { type: 'image', attachment: refs[next++] };
91
+ });
92
+ }
93
+ /**
94
+ * Decode and durably commit one canonical base64 file upload.
95
+ * @param input - canonical base64 bytes and optional display name.
96
+ * @returns the durable content-addressed file reference.
97
+ * @throws AttachmentError when the encoding or storage operation is refused.
98
+ */
99
+ admitEncodedFile(input) {
100
+ return admitFileInput(this, input);
101
+ }
102
+ /**
103
+ * Identify a failure emitted by this attachment capability by its stable code.
104
+ * @param error - value caught from an attachment operation.
105
+ * @returns whether the value is an attachment failure.
106
+ */
107
+ isAttachmentError(error) {
108
+ return matchesAttachmentError(error);
109
+ }
110
+ /**
111
+ * Locate the provider-owned normalized object in the harness host filesystem.
112
+ * @param ref - durable normalized attachment reference.
113
+ * @returns an absolute host path, or undefined when this backend is not host-file-backed.
114
+ * @throws an AttachmentError when the durable reference is invalid.
115
+ */
116
+ imageHostPath(ref) {
117
+ void ref;
118
+ return undefined;
119
+ }
120
+ /**
121
+ * Durably commit one file byte-for-byte before its owning session event is
122
+ * appended. Files carry no admission limits: any byte content and length is
123
+ * accepted, and the stored object is the exact submitted bytes. Backends
124
+ * without verbatim file storage keep this default rejection.
125
+ * @param input - exact bytes and optional display name.
126
+ * @returns the durable content-addressed file reference.
127
+ */
128
+ saveFile(input) {
129
+ void input;
130
+ return Promise.reject(new AttachmentError('The mounted attachment provider cannot store verbatim files.', 'ATTACHMENT_FILES_UNSUPPORTED'));
131
+ }
132
+ /**
133
+ * Durably commit one file byte-for-byte from bounded chunks. Providers must
134
+ * apply backpressure and must not collect the complete file in memory.
135
+ * Backends without streamed verbatim storage keep this default rejection.
136
+ * @param input - ordered exact bytes, optional cancellation, and display name.
137
+ * @returns the durable content-addressed file reference.
138
+ */
139
+ saveFileStream(input) {
140
+ void input;
141
+ return Promise.reject(new AttachmentError('The mounted attachment provider cannot stream verbatim files.', 'ATTACHMENT_FILES_UNSUPPORTED'));
142
+ }
143
+ /**
144
+ * Read and verify one verbatim stored file as bounded chunks. Providers must
145
+ * not collect the complete file in memory. Backends without verbatim file
146
+ * reads keep this default rejection.
147
+ * @param ref - durable file reference from the session log.
148
+ * @param signal - optional cancellation for backend reads and verification work.
149
+ * @returns exact file bytes in order; integrity failures reject the iteration.
150
+ */
151
+ async *readFileStream(ref, signal) {
152
+ signal?.throwIfAborted();
153
+ void ref;
154
+ await Promise.reject(new AttachmentError('The mounted attachment provider cannot read verbatim files.', 'ATTACHMENT_FILES_UNSUPPORTED'));
155
+ }
156
+ /**
157
+ * Locate the verbatim stored file object in the harness host filesystem.
158
+ * @param ref - durable file reference.
159
+ * @returns an absolute host path, or undefined when this backend is not host-file-backed.
160
+ * @throws an AttachmentError when the durable reference is invalid.
161
+ */
162
+ fileHostPath(ref) {
163
+ void ref;
164
+ return undefined;
165
+ }
166
+ /**
167
+ * Generate or read one deterministic model-request version from the stored normalized image.
168
+ * @param ref - durable provider-independent normalized attachment reference.
169
+ * @param target - route-chosen dimensions and byte target; an unmet byte target yields the smallest ladder output.
170
+ * @param signal - optional cancellation.
171
+ * @returns request bytes and the cache/upload identity covering every transform input.
172
+ */
173
+ readImageRequest(ref, target, signal) {
174
+ signal?.throwIfAborted();
175
+ void ref;
176
+ void target;
177
+ return Promise.reject(new AttachmentError('The mounted attachment provider cannot derive model-request images.', 'ATTACHMENT_PROJECTION_UNSUPPORTED'));
178
+ }
179
+ }
180
+ export default AttachmentStore;
181
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAW,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EAAE,gBAAgB,IAAI,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACvF,OAAO,EAAE,eAAe,EAAE,iBAAiB,IAAI,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAiBzF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAEtF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AA2BpF,oEAAoE;AACpE,SAAS,cAAc,CAAC,IAA6B;IACnD,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,YAAY,IAAI,IAAI,C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nB,GAAsB,EACtB,MAAoB;QAEpB,MAAM,EAAE,cAAc,EAAE,CAAA;QACxB,KAAK,GAAG,CAAA;QACR,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,eAAe,CACtC,6DAA6D,EAC7D,8BAA8B,CAC/B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,GAAsB;QACjC,KAAK,GAAG,CAAA;QACR,OAAO,SAAS,CAAA;IAClB,CAAC;IAED;;;;;;OAMG;IACH,gBAAgB,CACd,GAAuB,EACvB,MAA0B,EAC1B,MAAoB;QAEpB,MAAM,EAAE,cAAc,EAAE,CAAA;QACxB,KAAK,GAAG,CAAA;QACR,KAAK,MAAM,CAAA;QACX,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,eAAe,CACvC,qEAAqE,EACrE,mCAAmC,CACpC,CAAC,CAAA;IACJ,CAAC;CAEF;AAED,eAAe,eAAe,CAAA"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Pure request-projection geometry shared by model routes and provider-side
3
+ * request pricing. @module @open33/harness-attachment/request-projection
4
+ */
5
+ /** Integer width and height of one projected image. */
6
+ export interface ProjectedDimensions {
7
+ width: number;
8
+ height: number;
9
+ }
10
+ /**
11
+ * Compute aspect-preserving integer dimensions within a hard total-pixel budget.
12
+ * @param width - positive source width.
13
+ * @param height - positive source height.
14
+ * @param maxPixels - positive width-times-height cap.
15
+ * @returns inward-rounded dimensions; small images are not enlarged.
16
+ */
17
+ export declare function requestImageDimensions(width: number, height: number, maxPixels: number): ProjectedDimensions;
18
+ /**
19
+ * Compute aspect-preserving integer dimensions with an exact long edge; the
20
+ * short edge rounds to the nearest pixel, as an encoder resize by the
21
+ * long edge alone.
22
+ * @param width - positive source width.
23
+ * @param height - positive source height.
24
+ * @param longEdge - positive target for the longer source edge.
25
+ * @returns the target dimensions; a long edge at or above the source returns the source unchanged.
26
+ */
27
+ export declare function longEdgeDimensions(width: number, height: number, longEdge: number): ProjectedDimensions;
28
+ //# sourceMappingURL=request-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-projection.d.ts","sourceRoot":"","sources":["../../src/request-projection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,uDAAuD;AACvD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,mBAAmB,CAmBrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,mBAAmB,CAKrB"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Pure request-projection geometry shared by model routes and provider-side
3
+ * request pricing. @module @open33/harness-attachment/request-projection
4
+ */
5
+ /**
6
+ * Compute aspect-preserving integer dimensions within a hard total-pixel budget.
7
+ * @param width - positive source width.
8
+ * @param height - positive source height.
9
+ * @param maxPixels - positive width-times-height cap.
10
+ * @returns inward-rounded dimensions; small images are not enlarged.
11
+ */
12
+ export function requestImageDimensions(width, height, maxPixels) {
13
+ const scale = Math.min(1, Math.sqrt(maxPixels / (width * height)));
14
+ if (scale === 1)
15
+ return { width, height };
16
+ if (width >= height) {
17
+ let projectedWidth = Math.max(1, Math.floor(width * scale));
18
+ let projectedHeight = Math.max(1, Math.round(projectedWidth * height / width));
19
+ while (projectedWidth * projectedHeight > maxPixels && projectedWidth > 1) {
20
+ projectedWidth -= 1;
21
+ projectedHeight = Math.max(1, Math.round(projectedWidth * height / width));
22
+ }
23
+ return { width: projectedWidth, height: projectedHeight };
24
+ }
25
+ let projectedHeight = Math.max(1, Math.floor(height * scale));
26
+ let projectedWidth = Math.max(1, Math.round(projectedHeight * width / height));
27
+ while (projectedWidth * projectedHeight > maxPixels && projectedHeight > 1) {
28
+ projectedHeight -= 1;
29
+ projectedWidth = Math.max(1, Math.round(projectedHeight * width / height));
30
+ }
31
+ return { width: projectedWidth, height: projectedHeight };
32
+ }
33
+ /**
34
+ * Compute aspect-preserving integer dimensions with an exact long edge; the
35
+ * short edge rounds to the nearest pixel, as an encoder resize by the
36
+ * long edge alone.
37
+ * @param width - positive source width.
38
+ * @param height - positive source height.
39
+ * @param longEdge - positive target for the longer source edge.
40
+ * @returns the target dimensions; a long edge at or above the source returns the source unchanged.
41
+ */
42
+ export function longEdgeDimensions(width, height, longEdge) {
43
+ if (longEdge >= Math.max(width, height))
44
+ return { width, height };
45
+ return width >= height
46
+ ? { width: longEdge, height: Math.max(1, Math.round(longEdge * height / width)) }
47
+ : { width: Math.max(1, Math.round(longEdge * width / height)), height: longEdge };
48
+ }
49
+ //# sourceMappingURL=request-projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-projection.js","sourceRoot":"","sources":["../../src/request-projection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAa,EACb,MAAc,EACd,SAAiB;IAEjB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;IAClE,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;IACzC,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QACpB,IAAI,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAA;QAC3D,IAAI,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC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C,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC,EAAE;QACjF,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;AACrF,CAAC"}
@@ -0,0 +1,164 @@
1
+ /** Durable attachment vocabulary. @module @open33/harness-attachment/types */
2
+ import type { AttachmentId, ImageVariantId } from './brand.ts';
3
+ export type { AttachmentId, ImageVariantId } from './brand.ts';
4
+ /** Raster image formats accepted by the version-one attachment path. */
5
+ export type ImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
6
+ /** Durable, serializable reference to one immutable normalized image. */
7
+ export interface ImageAttachmentRef {
8
+ /** Opaque storage identifier; never a filesystem path or bearer URL. */
9
+ attachmentId: AttachmentId;
10
+ /** Media type verified from the stored bytes. */
11
+ mediaType: ImageMediaType;
12
+ /** Exact encoded byte length. */
13
+ bytes: number;
14
+ /** Intrinsic encoded width in pixels. */
15
+ width: number;
16
+ /** Intrinsic encoded height in pixels. */
17
+ height: number;
18
+ /** Optional display name stripped of local path information. */
19
+ name?: string;
20
+ /**
21
+ * Input dimensions after applying EXIF orientation and before normalization
22
+ * scaling. Present only when normalization reduced the image.
23
+ */
24
+ originalDimensions?: {
25
+ width: number;
26
+ height: number;
27
+ };
28
+ }
29
+ /**
30
+ * Durable, serializable reference to one verbatim stored file. Files are
31
+ * stored byte-for-byte with no normalization; `attachmentId` is the sha256
32
+ * digest of exactly those bytes.
33
+ */
34
+ export interface FileAttachmentRef {
35
+ /** Opaque content-addressed storage identifier; never a filesystem path or bearer URL. */
36
+ attachmentId: AttachmentId;
37
+ /** Sanitized display filename, also the stored object's leaf name. */
38
+ name: string;
39
+ /** Exact byte length. */
40
+ bytes: number;
41
+ }
42
+ /** Base64-encoded file upload accompanying one wire request. */
43
+ export interface EncodedFileAttachment {
44
+ /** Canonical base64 encoding of the file bytes. */
45
+ data: string;
46
+ /** Optional display name; it is never interpreted as a path. */
47
+ name?: string;
48
+ }
49
+ /** Request to durably commit one file verbatim. */
50
+ export interface SaveFileAttachment {
51
+ data: Uint8Array;
52
+ /** Optional browser/provider display name; it is never interpreted as a path. */
53
+ name?: string;
54
+ }
55
+ /** Request to durably commit one file from bounded byte chunks. */
56
+ export interface SaveFileStreamAttachment {
57
+ /** Exact file bytes in order; providers must not retain the complete sequence in memory. */
58
+ data: AsyncIterable<Uint8Array>;
59
+ /** Optional cancellation for source reads and storage writes. */
60
+ signal?: AbortSignal;
61
+ /** Optional browser/provider display name; it is never interpreted as a path. */
62
+ name?: string;
63
+ }
64
+ /** Deployment-resolved limits used by upload admission and request buffering. */
65
+ export interface ImageAttachmentLimits {
66
+ maxImageBytes: number;
67
+ maxImagesPerMessage: number;
68
+ maxMessageImageBytes: number;
69
+ maxImagePixels: number;
70
+ /** Maximum intrinsic width and maximum intrinsic height in pixels for one image. */
71
+ maxImageDimension: number;
72
+ mediaTypes: readonly ImageMediaType[];
73
+ }
74
+ /** Base64-encoded image upload accompanying one wire request. */
75
+ export interface EncodedImageAttachment {
76
+ /** Declared media type, verified against the decoded bytes during admission. */
77
+ mediaType: ImageMediaType;
78
+ /** Canonical base64 encoding of the image bytes. */
79
+ data: string;
80
+ /** Optional display name; it is never interpreted as a path. */
81
+ name?: string;
82
+ }
83
+ /**
84
+ * Browser-submitted prompt content accepted by Host prompt endpoints; the
85
+ * accepting Host promotes image parts to durable references through
86
+ * `ctx.attachments.admitPromptContent()` before any message is created, so a wire caller can
87
+ * never cite an attachment it did not upload.
88
+ */
89
+ export type PromptContentPart = {
90
+ readonly type: 'text';
91
+ readonly text: string;
92
+ } | {
93
+ readonly type: 'image';
94
+ readonly mediaType: ImageMediaType;
95
+ readonly data: string;
96
+ readonly name?: string;
97
+ };
98
+ /**
99
+ * Host prompt content whose upload receipts are resolved. An image part
100
+ * carries encoded bytes awaiting admission, or references an image this
101
+ * service already stored for an upload the same Session staged, with
102
+ * `encodedBytes` holding the byte length of that upload.
103
+ */
104
+ export type AttachmentAdmissionPart = PromptContentPart | {
105
+ readonly type: 'file';
106
+ readonly attachment: FileAttachmentRef;
107
+ } | {
108
+ readonly type: 'image';
109
+ readonly attachment: ImageAttachmentRef;
110
+ readonly encodedBytes: number;
111
+ };
112
+ /** Host-admitted prompt content with every attachment represented by its durable reference. */
113
+ export type AdmittedPromptContentPart = {
114
+ readonly type: 'text';
115
+ readonly text: string;
116
+ } | {
117
+ readonly type: 'image';
118
+ readonly attachment: ImageAttachmentRef;
119
+ } | {
120
+ readonly type: 'file';
121
+ readonly attachment: FileAttachmentRef;
122
+ };
123
+ /** Request to validate and durably commit one image. */
124
+ export interface SaveImageAttachment {
125
+ data: Uint8Array;
126
+ /** Caller-declared media type, checked against fully decoded bytes. */
127
+ mediaType: ImageMediaType;
128
+ /** Optional browser/provider display name; it is never interpreted as a path. */
129
+ name?: string;
130
+ }
131
+ /** Stored image bytes returned after reference and digest verification. */
132
+ export interface StoredImageAttachment {
133
+ ref: ImageAttachmentRef;
134
+ data: Uint8Array;
135
+ }
136
+ /** Deterministic request-image target selected by one exact model route for one attachment. */
137
+ export interface ImageRequestTarget {
138
+ /** Target width in pixels; a target above the source keeps the source width. */
139
+ width: number;
140
+ /** Target height in pixels; a target above the source keeps the source height. */
141
+ height: number;
142
+ /** Encoded-byte target before base64 expansion or Files API upload; the smallest quality-ladder output is kept when no quality fits. */
143
+ maxBytes: number;
144
+ }
145
+ /** Cached request version derived from one provider-independent normalized attachment. */
146
+ export interface RequestImageAttachment {
147
+ /** Cache and upload-index key over the attachment id, policy, and fixed encoder parameters. */
148
+ variantId: ImageVariantId;
149
+ /** Durable normalized attachment from which this request version was derived. */
150
+ attachment: ImageAttachmentRef;
151
+ /** Encoded request bytes. */
152
+ data: Uint8Array;
153
+ mediaType: ImageMediaType;
154
+ bytes: number;
155
+ width: number;
156
+ height: number;
157
+ /** Provider-compatible sample depth proven after request encoding. */
158
+ depth: 'uchar';
159
+ /** Provider-compatible color space proven after request encoding. */
160
+ space: 'srgb';
161
+ /** Whether the encoded request version retains an alpha channel. */
162
+ hasAlpha: boolean;
163
+ }
164
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAE9E,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE9D,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE9D,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,YAAY,GAAG,YAAY,GAAG,WAAW,CAAA;AAEpF,yEAAyE;AACzE,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,YAAY,EAAE,YAAY,CAAA;IAC1B,iDAAiD;IACjD,SAAS,EAAE,cAAc,CAAA;IACzB,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAA;IACb,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAA;IACd,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,kBAAkB,CAAC,EAAE;QACnB,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,0FAA0F;IAC1F,YAAY,EAAE,YAAY,CAAA;IAC1B,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAA;IACZ,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;IACpC,mDAAmD;IACnD,IAAI,EAAE,MAA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AAE,UAAU,CAAA;IAChB,SAAS,EAAE,cAAc,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,KAAK,EAAE,OAAO,CAAA;IACd,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAA;IACb,oEAAoE;IACpE,QAAQ,EAAE,OAAO,CAAA;CAClB"}
@@ -0,0 +1,3 @@
1
+ /** Durable attachment vocabulary. @module @open33/harness-attachment/types */
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,8EAA8E"}
package/package.json CHANGED
@@ -1,6 +1,46 @@
1
1
  {
2
2
  "name": "@open33/harness-attachment",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "Durable immutable attachment storage seam for the open33 Harness",
4
+ "version": "0.1.0",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/open33ofc/open33.git",
11
+ "directory": "packages/attachment/attachment"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./types": {
22
+ "types": "./lib/types/types.d.ts",
23
+ "default": "./lib/types/types.js"
24
+ },
25
+ "./src/*": "./src/*",
26
+ "./package.json": "./package.json"
27
+ },
28
+ "files": [
29
+ "lib/index.js",
30
+ "lib/types/**/*.js",
31
+ "lib/types/**/*.d.ts",
32
+ "lib/types/**/*.d.ts.map",
33
+ "lib/**/*.js.map",
34
+ "src"
35
+ ],
36
+ "license": "MIT",
37
+ "peerDependencies": {
38
+ "@open33/harness-error": "0.1.0",
39
+ "@open33/cordis": "~4.1.0"
40
+ },
41
+ "devDependencies": {
42
+ "@open33/harness-brand": "0.1.0",
43
+ "@open33/harness-error": "0.1.0",
44
+ "@open33/cordis": "~4.1.0"
45
+ }
6
46
  }