@noosphere/agent-core 0.2.0-alpha.1 → 0.2.0-alpha.2

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/dist/index.d.ts CHANGED
@@ -6,6 +6,8 @@ import { RegistryManager } from '@noosphere/registry';
6
6
  export { RegistryConfig, ContainerMetadata as RegistryContainerMetadata, RegistryManager, VerifierMetadata as RegistryVerifierMetadata } from '@noosphere/registry';
7
7
  import { PayloadData } from '@noosphere/contracts';
8
8
  export { InputType, PayloadData } from '@noosphere/contracts';
9
+ import { IpfsConfig, S3Config, IpfsStorage, S3Storage } from '@noosphere/payload';
10
+ export { DataUriStorage, HttpStorage, IPayloadStorage, IpfsConfig, IpfsStorage, IpfsConfig as IpfsStorageConfig, PayloadType, S3Config, S3Storage, S3Config as S3StorageConfig, UploadResult, computeContentHash, createDataUriPayload, detectPayloadType, verifyContentHash } from '@noosphere/payload';
9
11
 
10
12
  interface Commitment {
11
13
  requestId: string;
@@ -465,6 +467,13 @@ interface RetryableEvent {
465
467
  interval: number;
466
468
  containerId: string;
467
469
  retryCount: number;
470
+ feeAmount: string;
471
+ feeToken: string;
472
+ walletAddress: string;
473
+ verifier: string;
474
+ coordinator: string;
475
+ redundancy: number;
476
+ useDeliveryInbox: boolean;
468
477
  }
469
478
  interface ContainerExecutionConfig {
470
479
  timeout?: number;
@@ -701,294 +710,14 @@ declare class ConfigLoader {
701
710
  static getContainerConfig(config: NoosphereAgentConfig, containerId: string): NoosphereAgentConfig['containers'][0] | undefined;
702
711
  }
703
712
 
704
- /**
705
- * Payload Storage Interface
706
- *
707
- * Defines the contract for storage providers that can upload/download payload data.
708
- * Implementations: IpfsStorage, ArweaveStorage, HttpStorage, etc.
709
- */
710
- /**
711
- * Storage provider configuration
712
- */
713
- interface StorageConfig {
714
- /** API endpoint URL */
715
- apiUrl?: string;
716
- /** Gateway URL for fetching content */
717
- gateway?: string;
718
- /** API key for authentication */
719
- apiKey?: string;
720
- /** API secret for authentication */
721
- apiSecret?: string;
722
- /** Request timeout in milliseconds */
723
- timeout?: number;
724
- }
725
- /**
726
- * Upload result containing the URI and metadata
727
- */
728
- interface UploadResult {
729
- /** Full URI (e.g., "ipfs://Qm...", "ar://...") */
730
- uri: string;
731
- /** Content identifier (CID for IPFS, txId for Arweave) */
732
- contentId: string;
733
- /** Size of uploaded content in bytes */
734
- size: number;
735
- }
736
- /**
737
- * Storage provider interface
738
- */
739
- interface IPayloadStorage {
740
- /**
741
- * Upload content to storage
742
- * @param content - Content to upload (string or Buffer)
743
- * @returns Upload result with URI
744
- */
745
- upload(content: string | Buffer): Promise<UploadResult>;
746
- /**
747
- * Download content from storage
748
- * @param uri - Full URI (e.g., "ipfs://Qm...")
749
- * @returns Downloaded content as string
750
- */
751
- download(uri: string): Promise<string>;
752
- /**
753
- * Check if the storage provider is configured and available
754
- * @returns true if storage is ready to use
755
- */
756
- isConfigured(): boolean;
757
- /**
758
- * Get the URI scheme this storage provider handles
759
- * @returns Scheme string (e.g., "ipfs", "ar", "https")
760
- */
761
- getScheme(): string;
762
- }
763
-
764
- /**
765
- * IPFS Storage Provider
766
- *
767
- * Supports both local IPFS nodes and Pinata API for pinning.
768
- *
769
- * @example
770
- * ```typescript
771
- * // Local IPFS node
772
- * const storage = new IpfsStorage({
773
- * apiUrl: 'http://localhost:5001',
774
- * gateway: 'http://localhost:8080/ipfs/'
775
- * });
776
- *
777
- * // Pinata
778
- * const storage = new IpfsStorage({
779
- * apiUrl: 'https://api.pinata.cloud',
780
- * apiKey: 'your-api-key',
781
- * apiSecret: 'your-api-secret',
782
- * gateway: 'https://gateway.pinata.cloud/ipfs/'
783
- * });
784
- *
785
- * const result = await storage.upload('Hello, IPFS!');
786
- * console.log(result.uri); // "ipfs://Qm..."
787
- * ```
788
- */
789
-
790
- /**
791
- * IPFS-specific configuration
792
- */
793
- interface IpfsStorageConfig extends StorageConfig {
794
- /** IPFS API URL (default: http://localhost:5001) */
795
- apiUrl?: string;
796
- /** IPFS Gateway URL (default: http://localhost:8080/ipfs/) */
797
- gateway?: string;
798
- /** Pinata API key (required for Pinata) */
799
- apiKey?: string;
800
- /** Pinata API secret (required for Pinata) */
801
- apiSecret?: string;
802
- }
803
- declare class IpfsStorage implements IPayloadStorage {
804
- private apiUrl;
805
- private gateway;
806
- private apiKey?;
807
- private apiSecret?;
808
- private timeout;
809
- private isLocalNode;
810
- constructor(config?: IpfsStorageConfig);
811
- getScheme(): string;
812
- isConfigured(): boolean;
813
- upload(content: string | Buffer): Promise<UploadResult>;
814
- private uploadToLocalNode;
815
- private uploadToPinata;
816
- download(uri: string): Promise<string>;
817
- /**
818
- * Extract CID from IPFS URI
819
- */
820
- private extractCid;
821
- /**
822
- * Get the gateway URL for a given CID
823
- */
824
- getGatewayUrl(cidOrUri: string): string;
825
- }
826
-
827
- /**
828
- * Data URI Storage Provider
829
- *
830
- * Handles inline data using data: URI scheme (RFC 2397).
831
- * Used for small payloads that can be embedded directly.
832
- *
833
- * @example
834
- * ```typescript
835
- * const storage = new DataUriStorage();
836
- * const result = await storage.upload('{"action":"ping"}');
837
- * console.log(result.uri);
838
- * // "data:application/json;base64,eyJhY3Rpb24iOiJwaW5nIn0="
839
- * ```
840
- */
841
-
842
- interface DataUriStorageConfig {
843
- /** MIME type for the data (default: application/json) */
844
- mimeType?: string;
845
- }
846
- declare class DataUriStorage implements IPayloadStorage {
847
- private mimeType;
848
- constructor(config?: DataUriStorageConfig);
849
- getScheme(): string;
850
- isConfigured(): boolean;
851
- upload(content: string | Buffer): Promise<UploadResult>;
852
- download(uri: string): Promise<string>;
853
- }
854
-
855
- /**
856
- * HTTP/HTTPS Storage Provider
857
- *
858
- * Handles fetching content from HTTP/HTTPS URLs.
859
- * Upload is not supported - use a dedicated storage service instead.
860
- *
861
- * @example
862
- * ```typescript
863
- * const storage = new HttpStorage();
864
- * const content = await storage.download('https://api.example.com/data/123');
865
- * ```
866
- */
867
-
868
- interface HttpStorageConfig {
869
- /** Request timeout in milliseconds (default: 30000) */
870
- timeout?: number;
871
- /** Default headers to include in requests */
872
- headers?: Record<string, string>;
873
- }
874
- declare class HttpStorage implements IPayloadStorage {
875
- private timeout;
876
- private headers;
877
- constructor(config?: HttpStorageConfig);
878
- getScheme(): string;
879
- isConfigured(): boolean;
880
- upload(_content: string | Buffer): Promise<UploadResult>;
881
- download(uri: string): Promise<string>;
882
- }
883
-
884
- /**
885
- * S3-Compatible Storage Provider
886
- *
887
- * Supports AWS S3, Cloudflare R2, MinIO, and other S3-compatible storage services.
888
- * Uses the AWS SDK v3 for S3 operations.
889
- *
890
- * @example
891
- * ```typescript
892
- * // Cloudflare R2
893
- * const storage = new S3Storage({
894
- * endpoint: 'https://xxx.r2.cloudflarestorage.com',
895
- * bucket: 'my-bucket',
896
- * region: 'auto',
897
- * accessKeyId: 'your-access-key',
898
- * secretAccessKey: 'your-secret-key',
899
- * publicUrlBase: 'https://pub-xxx.r2.dev'
900
- * });
901
- *
902
- * // AWS S3
903
- * const storage = new S3Storage({
904
- * bucket: 'my-bucket',
905
- * region: 'us-east-1',
906
- * accessKeyId: 'your-access-key',
907
- * secretAccessKey: 'your-secret-key',
908
- * publicUrlBase: 'https://my-bucket.s3.us-east-1.amazonaws.com'
909
- * });
910
- *
911
- * // MinIO (local)
912
- * const storage = new S3Storage({
913
- * endpoint: 'http://localhost:9000',
914
- * bucket: 'my-bucket',
915
- * region: 'us-east-1',
916
- * accessKeyId: 'minioadmin',
917
- * secretAccessKey: 'minioadmin',
918
- * publicUrlBase: 'http://localhost:9000/my-bucket',
919
- * forcePathStyle: true
920
- * });
921
- *
922
- * const result = await storage.upload('Hello, S3!');
923
- * console.log(result.uri); // "https://pub-xxx.r2.dev/abc123.json"
924
- * ```
925
- */
926
-
927
- /**
928
- * S3-compatible storage configuration
929
- */
930
- interface S3StorageConfig {
931
- /** S3-compatible endpoint URL (required for R2/MinIO, optional for AWS S3) */
932
- endpoint?: string;
933
- /** Bucket name */
934
- bucket: string;
935
- /** AWS region (default: 'auto' for R2, 'us-east-1' for others) */
936
- region?: string;
937
- /** Access key ID */
938
- accessKeyId: string;
939
- /** Secret access key */
940
- secretAccessKey: string;
941
- /**
942
- * Public URL base for generating accessible URLs
943
- * e.g., "https://pub-xxx.r2.dev" or "https://cdn.example.com"
944
- */
945
- publicUrlBase: string;
946
- /**
947
- * Key prefix for organizing files
948
- * e.g., "noosphere/outputs/"
949
- */
950
- keyPrefix?: string;
951
- /**
952
- * Use path-style URLs (required for MinIO)
953
- * Default: false (uses virtual-hosted style)
954
- */
955
- forcePathStyle?: boolean;
956
- /** Request timeout in milliseconds (default: 30000) */
957
- timeout?: number;
958
- /** Content type for uploaded files (default: 'application/json') */
959
- contentType?: string;
960
- }
961
- declare class S3Storage implements IPayloadStorage {
962
- private config;
963
- private client;
964
- private PutObjectCommandClass;
965
- private initialized;
966
- private initError;
967
- constructor(config: S3StorageConfig);
968
- /**
969
- * Lazily initialize the S3 client
970
- * This allows the class to be instantiated even if @aws-sdk/client-s3 is not installed
971
- */
972
- private initClient;
973
- getScheme(): string;
974
- isConfigured(): boolean;
975
- /**
976
- * Generate a unique key for the content based on its hash
977
- */
978
- private generateKey;
979
- upload(content: string | Buffer): Promise<UploadResult>;
980
- download(uri: string): Promise<string>;
981
- /**
982
- * Get the public URL for a given key
983
- */
984
- getPublicUrl(key: string): string;
985
- }
986
-
987
713
  /**
988
714
  * PayloadResolver - Unified Payload Resolution
989
715
  *
716
+ * This module wraps @noosphere/payload for backward compatibility.
717
+ * New code should use @noosphere/payload directly.
718
+ *
990
719
  * Resolves PayloadData to actual content by:
991
- * 1. Detecting URI scheme (data:, ipfs://, https://, ar://)
720
+ * 1. Detecting URI scheme (data:, ipfs://, https://, http://)
992
721
  * 2. Fetching content from appropriate storage
993
722
  * 3. Verifying content hash for integrity
994
723
  *
@@ -1018,20 +747,16 @@ declare enum PayloadScheme {
1018
747
  DATA = "data",
1019
748
  IPFS = "ipfs",
1020
749
  HTTPS = "https",
1021
- HTTP = "http",
1022
- ARWEAVE = "ar",
1023
- CHAIN = "chain"
750
+ HTTP = "http"
1024
751
  }
1025
752
  /**
1026
753
  * PayloadResolver configuration
1027
754
  */
1028
755
  interface PayloadResolverConfig {
1029
756
  /** IPFS storage configuration */
1030
- ipfs?: IpfsStorageConfig;
757
+ ipfs?: IpfsConfig;
1031
758
  /** S3-compatible storage configuration (R2, S3, MinIO) */
1032
- s3?: S3StorageConfig;
1033
- /** Arweave gateway URL */
1034
- arweaveGateway?: string;
759
+ s3?: S3Config;
1035
760
  /** Size threshold for auto-upload (bytes, default: 1024) */
1036
761
  uploadThreshold?: number;
1037
762
  /** Default storage for large payloads ('ipfs' | 's3' | 'data') */
@@ -1053,14 +778,24 @@ interface ResolvedPayload {
1053
778
  verified: boolean;
1054
779
  }
1055
780
  declare class PayloadResolver {
781
+ private baseResolver;
1056
782
  private ipfsStorage;
1057
783
  private s3Storage;
1058
784
  private dataUriStorage;
1059
785
  private httpStorage;
1060
786
  private uploadThreshold;
1061
787
  private defaultStorage;
1062
- private arweaveGateway;
1063
788
  constructor(config?: PayloadResolverConfig);
789
+ /**
790
+ * Convert agent-core PayloadData to @noosphere/payload PayloadData
791
+ * Note: URI is decoded from hex if needed
792
+ */
793
+ private toBasePayload;
794
+ /**
795
+ * Convert @noosphere/payload PayloadData to agent-core PayloadData
796
+ * Note: URI is hex-encoded for on-chain compatibility
797
+ */
798
+ private fromBasePayload;
1064
799
  /**
1065
800
  * Detect URI scheme from PayloadData
1066
801
  */
@@ -1073,10 +808,6 @@ declare class PayloadResolver {
1073
808
  * @returns Resolved content and metadata
1074
809
  */
1075
810
  resolve(payload: PayloadData, verifyHash?: boolean): Promise<ResolvedPayload>;
1076
- /**
1077
- * Resolve Arweave URI
1078
- */
1079
- private resolveArweave;
1080
811
  /**
1081
812
  * Encode content as PayloadData
1082
813
  *
@@ -1128,4 +859,4 @@ declare class PayloadResolver {
1128
859
  deserialize(serialized: string): PayloadData;
1129
860
  }
1130
861
 
1131
- export { type AgentConfig, type CheckpointData$1 as CheckpointData, type Commitment, type CommitmentSuccessCallbackEvent, type CommitmentSuccessEvent, CommitmentUtils, type ComputeDeliveredEvent, type ComputeSubscription, ConfigLoader, type ContainerConfig, type ContainerExecutionConfig, ContainerManager, type ContainerMetadata, DataUriStorage, type DataUriStorageConfig, EventMonitor, FulfillResult, HttpStorage, type HttpStorageConfig, type IPayloadStorage, IpfsStorage, type IpfsStorageConfig, NoosphereAgent, type NoosphereAgentConfig, PayloadResolver, type PayloadResolverConfig, PayloadScheme, PayloadUtils, type Payment, type ProofVerificationRequest, RequestIdUtils, type RequestStartedCallbackEvent, type RequestStartedEvent, type ResolvedPayload, type RetryableEvent, S3Storage, type S3StorageConfig, SchedulerService, type StorageConfig, type UploadResult, type VerifierMetadata };
862
+ export { type AgentConfig, type CheckpointData$1 as CheckpointData, type Commitment, type CommitmentSuccessCallbackEvent, type CommitmentSuccessEvent, CommitmentUtils, type ComputeDeliveredEvent, type ComputeSubscription, ConfigLoader, type ContainerConfig, type ContainerExecutionConfig, ContainerManager, type ContainerMetadata, EventMonitor, FulfillResult, NoosphereAgent, type NoosphereAgentConfig, PayloadResolver, type PayloadResolverConfig, PayloadScheme, PayloadUtils, type Payment, type ProofVerificationRequest, RequestIdUtils, type RequestStartedCallbackEvent, type RequestStartedEvent, type ResolvedPayload, type RetryableEvent, SchedulerService, type VerifierMetadata };