@artenx/dshb 0.1.16 → 0.1.17

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,6 +1,5 @@
1
1
  import { SessionInstructionSnapshot, SessionInstructionSnapshotStore, WorkspaceInstructionStore } from "./workspace-instructions.js";
2
2
  import { Context, Service } from "@deepseek-ai/cordis";
3
- import { FileAttachmentRef, ImageAttachmentRef, ImageRequestTarget } from "@deepseek-ai/dsh-attachment";
4
3
  //#region ../../node_modules/@deepseek-ai/dsh-brand/lib/types/index.d.ts
5
4
  /**
6
5
  * Duplicate-install-safe nominal primitive helpers.
@@ -559,6 +558,313 @@ declare abstract class TypertRemoteService<out T = never> extends Service<T> {
559
558
  protected constructor(ctx: Context, serviceKey: string, options?: TypertGatewayBindingOptions);
560
559
  }
561
560
  //#endregion
561
+ //#region ../../node_modules/@deepseek-ai/dsh-attachment/lib/types/error.d.ts
562
+ declare const ATTACHMENT_ERROR_CODES: readonly ["TOO_MANY_IMAGES", "IMAGES_TOO_LARGE", "UNSUPPORTED_IMAGE_TYPE", "INVALID_IMAGE_BASE64", "INVALID_IMAGE", "IMAGE_TYPE_MISMATCH", "IMAGE_TOO_LARGE", "IMAGE_TOO_MANY_PIXELS", "IMAGE_DIMENSION_TOO_LARGE", "INVALID_FILE_BASE64", "INVALID_ATTACHMENT_REF", "ATTACHMENT_CORRUPT", "ATTACHMENT_WRITE_FAILED", "ATTACHMENT_NOT_FOUND", "ATTACHMENT_READ_FAILED", "ATTACHMENT_PROJECTION_UNSUPPORTED", "ATTACHMENT_FILES_UNSUPPORTED"];
563
+ /** Stable attachment failure codes used for protocol error routing. */
564
+ type AttachmentErrorCode = typeof ATTACHMENT_ERROR_CODES[number];
565
+ /**
566
+ * Stable failures suitable for host RPC error mapping.
567
+ *
568
+ * Deliberately re-implements the `HarnessError` shape instead of extending it:
569
+ * the base lives in `@deepseek-ai/dsh-llm`, which itself depends on this
570
+ * package (`ImageBlock` references `ImageAttachmentRef`), so sharing the base
571
+ * would create a dependency cycle. Consumers route on `code`, never on the
572
+ * prototype chain, so the shapes stay interchangeable at the wire boundary.
573
+ */
574
+ declare class AttachmentError extends Error {
575
+ /** Stable machine-routing failure code. */
576
+ readonly code: AttachmentErrorCode;
577
+ /**
578
+ * @param message - human-readable failure description without raw bytes or host paths.
579
+ * @param code - stable machine-routing code.
580
+ * @param options - optional chained cause.
581
+ */
582
+ constructor(message: string, code: AttachmentErrorCode, options?: ErrorOptions);
583
+ }
584
+ //#endregion
585
+ //#region ../../node_modules/@deepseek-ai/dsh-attachment/lib/types/brand.d.ts
586
+ /** Opaque content-addressed identifier for one immutable attachment object. */
587
+ type AttachmentId = Branded<'AttachmentId'>;
588
+ /**
589
+ * Brand a validated storage identifier.
590
+ * @param value - backend-produced opaque identifier.
591
+ * @returns the branded identifier.
592
+ */
593
+ declare function AttachmentId(value: string): AttachmentId;
594
+ /** Opaque deterministic identity for one request-image transformation. */
595
+ type ImageVariantId = Branded<'ImageVariantId'>;
596
+ /**
597
+ * Brand a validated request-image transformation identifier.
598
+ * @param value - attachment-provider-produced opaque identifier.
599
+ * @returns the branded identifier.
600
+ */
601
+ declare function ImageVariantId(value: string): ImageVariantId;
602
+ //#endregion
603
+ //#region ../../node_modules/@deepseek-ai/dsh-attachment/lib/types/types.d.ts
604
+ /** Raster image formats accepted by the version-one attachment path. */
605
+ type ImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
606
+ /** Durable, serializable reference to one immutable normalized image. */
607
+ interface ImageAttachmentRef {
608
+ /** Opaque storage identifier; never a filesystem path or bearer URL. */
609
+ attachmentId: AttachmentId;
610
+ /** Media type verified from the stored bytes. */
611
+ mediaType: ImageMediaType;
612
+ /** Exact encoded byte length. */
613
+ bytes: number;
614
+ /** Intrinsic encoded width in pixels. */
615
+ width: number;
616
+ /** Intrinsic encoded height in pixels. */
617
+ height: number;
618
+ /** Optional display name stripped of local path information. */
619
+ name?: string;
620
+ /**
621
+ * Input dimensions after applying EXIF orientation and before normalization
622
+ * scaling. Present only when normalization reduced the image.
623
+ */
624
+ originalDimensions?: {
625
+ width: number;
626
+ height: number;
627
+ };
628
+ }
629
+ /**
630
+ * Durable, serializable reference to one verbatim stored file. Files are
631
+ * stored byte-for-byte with no normalization; `attachmentId` is the sha256
632
+ * digest of exactly those bytes.
633
+ */
634
+ interface FileAttachmentRef {
635
+ /** Opaque content-addressed storage identifier; never a filesystem path or bearer URL. */
636
+ attachmentId: AttachmentId;
637
+ /** Sanitized display filename, also the stored object's leaf name. */
638
+ name: string;
639
+ /** Exact byte length. */
640
+ bytes: number;
641
+ }
642
+ /** Base64-encoded file upload accompanying one wire request. */
643
+ interface EncodedFileAttachment {
644
+ /** Canonical base64 encoding of the file bytes. */
645
+ data: string;
646
+ /** Optional display name; it is never interpreted as a path. */
647
+ name?: string;
648
+ }
649
+ /** Request to durably commit one file verbatim. */
650
+ interface SaveFileAttachment {
651
+ data: Uint8Array;
652
+ /** Optional browser/provider display name; it is never interpreted as a path. */
653
+ name?: string;
654
+ }
655
+ /** Request to durably commit one file from bounded byte chunks. */
656
+ interface SaveFileStreamAttachment {
657
+ /** Exact file bytes in order; providers must not retain the complete sequence in memory. */
658
+ data: AsyncIterable<Uint8Array>;
659
+ /** Optional cancellation for source reads and storage writes. */
660
+ signal?: AbortSignal;
661
+ /** Optional browser/provider display name; it is never interpreted as a path. */
662
+ name?: string;
663
+ }
664
+ /** Deployment-resolved limits used by upload admission and request buffering. */
665
+ interface ImageAttachmentLimits {
666
+ maxImageBytes: number;
667
+ maxImagesPerMessage: number;
668
+ maxMessageImageBytes: number;
669
+ maxImagePixels: number;
670
+ /** Maximum intrinsic width and maximum intrinsic height in pixels for one image. */
671
+ maxImageDimension: number;
672
+ mediaTypes: readonly ImageMediaType[];
673
+ }
674
+ /**
675
+ * Browser-submitted prompt content accepted by Host prompt endpoints; the
676
+ * accepting Host promotes image parts to durable references through
677
+ * `ctx.attachments.admitPromptContent()` before any message is created, so a wire caller can
678
+ * never cite an attachment it did not upload.
679
+ */
680
+ type PromptContentPart = {
681
+ readonly type: 'text';
682
+ readonly text: string;
683
+ } | {
684
+ readonly type: 'image';
685
+ readonly mediaType: ImageMediaType;
686
+ readonly data: string;
687
+ readonly name?: string;
688
+ };
689
+ /** Host prompt content whose file receipts are resolved and whose image bytes await admission. */
690
+ type AttachmentAdmissionPart = PromptContentPart | {
691
+ readonly type: 'file';
692
+ readonly attachment: FileAttachmentRef;
693
+ };
694
+ /** Host-admitted prompt content with every attachment represented by its durable reference. */
695
+ type AdmittedPromptContentPart = {
696
+ readonly type: 'text';
697
+ readonly text: string;
698
+ } | {
699
+ readonly type: 'image';
700
+ readonly attachment: ImageAttachmentRef;
701
+ } | {
702
+ readonly type: 'file';
703
+ readonly attachment: FileAttachmentRef;
704
+ };
705
+ /** Request to validate and durably commit one image. */
706
+ interface SaveImageAttachment {
707
+ data: Uint8Array;
708
+ /** Caller-declared media type, checked against fully decoded bytes. */
709
+ mediaType: ImageMediaType;
710
+ /** Optional browser/provider display name; it is never interpreted as a path. */
711
+ name?: string;
712
+ }
713
+ /** Stored image bytes returned after reference and digest verification. */
714
+ interface StoredImageAttachment {
715
+ ref: ImageAttachmentRef;
716
+ data: Uint8Array;
717
+ }
718
+ /** Deterministic request-image target selected by one exact model route for one attachment. */
719
+ interface ImageRequestTarget {
720
+ /** Target width in pixels; a target above the source keeps the source width. */
721
+ width: number;
722
+ /** Target height in pixels; a target above the source keeps the source height. */
723
+ height: number;
724
+ /** Encoded-byte target before base64 expansion or Files API upload; the smallest quality-ladder output is kept when no quality fits. */
725
+ maxBytes: number;
726
+ }
727
+ /** Cached request version derived from one provider-independent normalized attachment. */
728
+ interface RequestImageAttachment {
729
+ /** Cache and upload-index key over the attachment id, policy, and fixed encoder parameters. */
730
+ variantId: ImageVariantId;
731
+ /** Durable normalized attachment from which this request version was derived. */
732
+ attachment: ImageAttachmentRef;
733
+ /** Encoded request bytes. */
734
+ data: Uint8Array;
735
+ mediaType: ImageMediaType;
736
+ bytes: number;
737
+ width: number;
738
+ height: number;
739
+ /** Provider-compatible sample depth proven after request encoding. */
740
+ depth: 'uchar';
741
+ /** Provider-compatible color space proven after request encoding. */
742
+ space: 'srgb';
743
+ /** Whether the encoded request version retains an alpha channel. */
744
+ hasAlpha: boolean;
745
+ }
746
+ //#endregion
747
+ //#region ../../node_modules/@deepseek-ai/dsh-attachment/lib/types/index.d.ts
748
+ declare module '@deepseek-ai/cordis' {
749
+ interface Context {
750
+ attachments: AttachmentStore;
751
+ }
752
+ }
753
+ /** Immutable binary attachment service. Implementations validate bytes before publishing a reference. */
754
+ declare abstract class AttachmentStore extends Service {
755
+ constructor(ctx: Context);
756
+ /** Deployment-resolved image policy used by authoritative and fast-path validation. */
757
+ abstract readonly imageLimits: ImageAttachmentLimits;
758
+ /**
759
+ * Validate one image without persisting it.
760
+ * Batch callers validate every member before saving any member.
761
+ * @param input - encoded bytes, declared media type, and optional display name.
762
+ * @returns completion after the encoded raster has been fully decoded.
763
+ */
764
+ abstract validateImage(input: SaveImageAttachment): Promise<void>;
765
+ /**
766
+ * Validate one ordered image batch before committing any member.
767
+ * Validation failures start no writes; storage failures return no partial
768
+ * references, although already published content-addressed objects may stay
769
+ * unreachable until a future retention policy collects them.
770
+ * @param inputs - encoded images in their owning message order.
771
+ * @returns durable references in the exact input order.
772
+ */
773
+ protected validateImageBatch(inputs: readonly SaveImageAttachment[]): void;
774
+ /**
775
+ * Validate and durably commit one ordered image batch.
776
+ * @param inputs - encoded images in owning-message order.
777
+ * @returns durable normalized attachment references in the same order after every member succeeds.
778
+ */
779
+ saveImages(inputs: readonly SaveImageAttachment[]): Promise<readonly ImageAttachmentRef[]>;
780
+ /**
781
+ * Admit one Host prompt and replace each uploaded image with its durable reference.
782
+ * Text and durable file references pass through unchanged. A prompt without image parts performs no storage operation.
783
+ * @param content - prompt parts in message order after file receipt resolution.
784
+ * @returns admitted prompt parts in the same order as `content`.
785
+ * @throws AttachmentError when the image batch is refused.
786
+ */
787
+ admitPromptContent(content: readonly AttachmentAdmissionPart[]): Promise<AdmittedPromptContentPart[]>;
788
+ /**
789
+ * Decode and durably commit one canonical base64 file upload.
790
+ * @param input - canonical base64 bytes and optional display name.
791
+ * @returns the durable content-addressed file reference.
792
+ * @throws AttachmentError when the encoding or storage operation is refused.
793
+ */
794
+ admitEncodedFile(input: EncodedFileAttachment): Promise<FileAttachmentRef>;
795
+ /**
796
+ * Identify a failure emitted by this attachment capability by its stable code.
797
+ * @param error - value caught from an attachment operation.
798
+ * @returns whether the value is an attachment failure.
799
+ */
800
+ isAttachmentError(error: unknown): error is AttachmentError;
801
+ /**
802
+ * Validate and durably commit one image before its owning session event is appended.
803
+ * The returned reference describes the persisted normalized image. When
804
+ * normalization reduces the raster, its `originalDimensions` records the
805
+ * orientation-applied input dimensions.
806
+ * @param input - encoded bytes, declared media type, and optional display name.
807
+ * @returns the durable content-addressed normalized image reference.
808
+ */
809
+ abstract saveImage(input: SaveImageAttachment): Promise<ImageAttachmentRef>;
810
+ /**
811
+ * Read one image and verify that bytes still match the recorded reference.
812
+ * @param ref - durable reference from the session log.
813
+ * @param signal - optional cancellation for backend read and verification work.
814
+ * @returns the verified bytes and normalized attachment reference.
815
+ * @throws the signal reason when aborted, or a storage error when verification fails.
816
+ */
817
+ abstract readImage(ref: ImageAttachmentRef, signal?: AbortSignal): Promise<StoredImageAttachment>;
818
+ /**
819
+ * Locate the provider-owned normalized object in the harness host filesystem.
820
+ * @param ref - durable normalized attachment reference.
821
+ * @returns an absolute host path, or undefined when this backend is not host-file-backed.
822
+ * @throws an AttachmentError when the durable reference is invalid.
823
+ */
824
+ imageHostPath(ref: ImageAttachmentRef): string | undefined;
825
+ /**
826
+ * Durably commit one file byte-for-byte before its owning session event is
827
+ * appended. Files carry no admission limits: any byte content and length is
828
+ * accepted, and the stored object is the exact submitted bytes. Backends
829
+ * without verbatim file storage keep this default rejection.
830
+ * @param input - exact bytes and optional display name.
831
+ * @returns the durable content-addressed file reference.
832
+ */
833
+ saveFile(input: SaveFileAttachment): Promise<FileAttachmentRef>;
834
+ /**
835
+ * Durably commit one file byte-for-byte from bounded chunks. Providers must
836
+ * apply backpressure and must not collect the complete file in memory.
837
+ * Backends without streamed verbatim storage keep this default rejection.
838
+ * @param input - ordered exact bytes, optional cancellation, and display name.
839
+ * @returns the durable content-addressed file reference.
840
+ */
841
+ saveFileStream(input: SaveFileStreamAttachment): Promise<FileAttachmentRef>;
842
+ /**
843
+ * Read and verify one verbatim stored file as bounded chunks. Providers must
844
+ * not collect the complete file in memory. Backends without verbatim file
845
+ * reads keep this default rejection.
846
+ * @param ref - durable reference from the session log.
847
+ * @param signal - optional cancellation for backend reads and verification work.
848
+ * @returns exact file bytes in order; integrity failures reject the iteration.
849
+ */
850
+ readFileStream(ref: FileAttachmentRef, signal?: AbortSignal): AsyncIterable<Uint8Array>;
851
+ /**
852
+ * Locate the verbatim stored file object in the harness host filesystem.
853
+ * @param ref - durable file reference.
854
+ * @returns an absolute host path, or undefined when this backend is not host-file-backed.
855
+ * @throws an AttachmentError when the durable reference is invalid.
856
+ */
857
+ fileHostPath(ref: FileAttachmentRef): string | undefined;
858
+ /**
859
+ * Generate or read one deterministic model-request version from the stored normalized image.
860
+ * @param ref - durable provider-independent normalized attachment reference.
861
+ * @param target - route-chosen dimensions and byte target; an unmet byte target yields the smallest ladder output.
862
+ * @param signal - optional cancellation.
863
+ * @returns request bytes and the cache/upload identity covering every transform input.
864
+ */
865
+ readImageRequest(ref: ImageAttachmentRef, target: ImageRequestTarget, signal?: AbortSignal): Promise<RequestImageAttachment>;
866
+ }
867
+ //#endregion
562
868
  //#region ../../node_modules/@deepseek-ai/dsh-llm/lib/types/brand.d.ts
563
869
  /** Stable identity carried by one message across inbox, log, and model-request boundaries. */
564
870
  type MessageId = Branded<'MessageId'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artenx/dshb",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Routes DSH filesystem, shell, subprocess, and PTY operations to local, SSH, and Docker execution nodes, with a node registry, an authentication gate, a mobile-aware management UI, and per-workspace custom project instructions.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -81,10 +81,7 @@
81
81
  ]
82
82
  },
83
83
  "compatibility": {
84
- "dshReleases": {
85
- "0.1.7-rc.1": "compatible",
86
- "0.2.1-rc.2": "compatible"
87
- },
84
+ "dshReleases": ">=0.1.7-rc.1 <0.2.1-rc.2",
88
85
  "nodeVersions": ">=22.13"
89
86
  }
90
87
  },
@@ -94,22 +91,22 @@
94
91
  },
95
92
  "peerDependencies": {
96
93
  "@deepseek-ai/cordis": "^4.0.2",
97
- "@deepseek-ai/dsh-client-ui-settings": "=0.1.7-rc.1 || =0.2.1-rc.2",
98
- "@deepseek-ai/dsh-client-ui-slots": "=0.1.7-rc.1 || =0.2.1-rc.2",
99
- "@deepseek-ai/dsh-client-ui-conversation": "=0.1.7-rc.1 || =0.2.1-rc.2",
100
- "@deepseek-ai/dsh-client-ui-layout": "=0.1.7-rc.1 || =0.2.1-rc.2",
101
- "@deepseek-ai/dsh-client-ui-workspace": "=0.1.7-rc.1 || =0.2.1-rc.2",
102
- "@deepseek-ai/dsh-cmdline": "=0.1.7-rc.1 || =0.2.1-rc.2",
103
- "@deepseek-ai/dsh-credentials": "=0.1.7-rc.1 || =0.2.1-rc.2",
104
- "@deepseek-ai/dsh-fs": "=0.1.7-rc.1 || =0.2.1-rc.2",
105
- "@deepseek-ai/dsh-fs-sandbox": "=0.1.7-rc.1 || =0.2.1-rc.2",
106
- "@deepseek-ai/dsh-host-directory-picker": "=0.1.7-rc.1 || =0.2.1-rc.2",
107
- "@deepseek-ai/dsh-host-webserver": "=0.1.7-rc.1 || =0.2.1-rc.2",
108
- "@deepseek-ai/dsh-sandbox": "=0.1.7-rc.1 || =0.2.1-rc.2",
109
- "@deepseek-ai/dsh-shell": "=0.1.7-rc.1 || =0.2.1-rc.2",
110
- "@deepseek-ai/dsh-bash-sandbox": "=0.1.7-rc.1 || =0.2.1-rc.2",
111
- "@deepseek-ai/dsh-subprocess": "=0.1.7-rc.1 || =0.2.1-rc.2",
112
- "@deepseek-ai/dsh-subprocess-local": "=0.1.7-rc.1 || =0.2.1-rc.2",
94
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.7-rc.1 <0.2.1-rc.2",
95
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.1 <0.2.1-rc.2",
96
+ "@deepseek-ai/dsh-client-ui-conversation": ">=0.1.7-rc.1 <0.2.1-rc.2",
97
+ "@deepseek-ai/dsh-client-ui-layout": ">=0.1.7-rc.1 <0.2.1-rc.2",
98
+ "@deepseek-ai/dsh-client-ui-workspace": ">=0.1.7-rc.1 <0.2.1-rc.2",
99
+ "@deepseek-ai/dsh-cmdline": ">=0.1.7-rc.1 <0.2.1-rc.2",
100
+ "@deepseek-ai/dsh-credentials": ">=0.1.7-rc.1 <0.2.1-rc.2",
101
+ "@deepseek-ai/dsh-fs": ">=0.1.7-rc.1 <0.2.1-rc.2",
102
+ "@deepseek-ai/dsh-fs-sandbox": ">=0.1.7-rc.1 <0.2.1-rc.2",
103
+ "@deepseek-ai/dsh-host-directory-picker": ">=0.1.7-rc.1 <0.2.1-rc.2",
104
+ "@deepseek-ai/dsh-host-webserver": ">=0.1.7-rc.1 <0.2.1-rc.2",
105
+ "@deepseek-ai/dsh-sandbox": ">=0.1.7-rc.1 <0.2.1-rc.2",
106
+ "@deepseek-ai/dsh-shell": ">=0.1.7-rc.1 <0.2.1-rc.2",
107
+ "@deepseek-ai/dsh-bash-sandbox": ">=0.1.7-rc.1 <0.2.1-rc.2",
108
+ "@deepseek-ai/dsh-subprocess": ">=0.1.7-rc.1 <0.2.1-rc.2",
109
+ "@deepseek-ai/dsh-subprocess-local": ">=0.1.7-rc.1 <0.2.1-rc.2",
113
110
  "react": "^19.0.0"
114
111
  },
115
112
  "devDependencies": {
@@ -138,7 +135,7 @@
138
135
  },
139
136
  "engines": {
140
137
  "node": ">=22.13",
141
- "dsh": "=0.1.7-rc.1 || =0.2.1-rc.2"
138
+ "dsh": ">=0.1.7-rc.1 <0.2.1-rc.2"
142
139
  },
143
140
  "sideEffects": false,
144
141
  "keywords": [