@chaoschain/sdk 0.3.0 → 0.3.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/CHANGELOG.md +33 -0
- package/README.md +102 -12
- package/dist/{IPFSLocal-B4hnMEfS.d.ts → IPFSLocal-B_Sgmd_Q.d.ts} +1 -1
- package/dist/{IPFSLocal-zRj6kG8e.d.cts → IPFSLocal-DjFddwHD.d.cts} +1 -1
- package/dist/gateway/index.cjs +591 -0
- package/dist/gateway/index.cjs.map +1 -0
- package/dist/gateway/index.d.cts +3 -0
- package/dist/gateway/index.d.ts +3 -0
- package/dist/gateway/index.js +581 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/index-CL0fidQs.d.ts +223 -0
- package/dist/index-iUO5l1VD.d.cts +223 -0
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -382
- package/dist/index.d.ts +9 -382
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/providers/compute/index.d.cts +1 -1
- package/dist/providers/compute/index.d.ts +1 -1
- package/dist/providers/storage/index.d.cts +2 -2
- package/dist/providers/storage/index.d.ts +2 -2
- package/dist/session/index.cjs +196 -0
- package/dist/session/index.cjs.map +1 -0
- package/dist/session/index.d.cts +169 -0
- package/dist/session/index.d.ts +169 -0
- package/dist/session/index.js +189 -0
- package/dist/session/index.js.map +1 -0
- package/dist/{types-BBVtx_jV.d.cts → types-C0Ay90UI.d.cts} +1 -1
- package/dist/{types-BBVtx_jV.d.ts → types-C0Ay90UI.d.ts} +1 -1
- package/package.json +11 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { N as NetworkConfig, I as IntegrityProof, W as WalletConfig,
|
|
2
|
-
export {
|
|
1
|
+
import { N as NetworkConfig, I as IntegrityProof, W as WalletConfig, b as NetworkInfo, c as ContractAddresses, A as AgentRole, d as ChaosChainSDKConfig, e as AgentMetadata, f as AgentRegistration, F as FeedbackParams, P as PaymentMethod, U as UploadOptions, a as UploadResult, g as WorkflowStatus, h as ScoreSubmissionMode } from './types-C0Ay90UI.js';
|
|
2
|
+
export { M as AgencySignals, C as ComputeProvider, D as DKGNodeData, Q as DemoAssessment, Y as EngineeringStudioPolicy, J as EvidencePackage, i as FeedbackRecord, G as GatewayClientConfig, r as PendingWorkItem, s as PendingWorkResponse, R as ScoreRange, _ as SignalExtractionContext, S as StorageProvider, T as TEEAttestation, l as TransactionResult, j as ValidationRequest, V as ValidationRequestParams, m as ValidationStatus, O as VerifierAssessment, t as WorkEvidenceResponse, K as WorkEvidenceVerificationResult, Z as WorkMandate, L as WorkVerificationResult, q as WorkflowError, p as WorkflowProgress, o as WorkflowState, n as WorkflowType, k as X402Payment, X as X402PaymentParams, u as XMTPMessageData, B as composeScoreVector, E as composeScoreVectorWithDefaults, v as computeDepth, w as derivePoAScores, z as extractAgencySignals, H as rangeFit, x as validateEvidenceGraph, y as verifyWorkEvidence } from './types-C0Ay90UI.js';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
|
-
|
|
4
|
+
import { G as GatewayClient } from './index-CL0fidQs.js';
|
|
5
|
+
export { A as AgentRegistrationError, C as ChaosChainSDKError, b as ConfigurationError, a as ContractError, d as GatewayConnectionError, c as GatewayError, e as GatewayTimeoutError, I as IntegrityVerificationError, P as PaymentError, V as SDKValidationError, S as StorageError, W as WorkflowFailedError } from './index-CL0fidQs.js';
|
|
6
|
+
import { SessionClient } from './session/index.js';
|
|
7
|
+
export { Session, SessionAgentOverride, SessionAgentRole, SessionClientConfig, SessionCompleteResult, SessionLogOptions, SessionStartOptions } from './session/index.js';
|
|
8
|
+
export { I as IPFSLocalStorage } from './IPFSLocal-B_Sgmd_Q.js';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* X402 Payment Manager for ChaosChain SDK
|
|
@@ -715,152 +719,6 @@ declare function getNetworkInfo(network: NetworkConfig | string): NetworkInfo;
|
|
|
715
719
|
*/
|
|
716
720
|
declare function getContractAddresses(network: NetworkConfig | string): ContractAddresses;
|
|
717
721
|
|
|
718
|
-
declare class GatewayClient {
|
|
719
|
-
private gatewayUrl;
|
|
720
|
-
private timeout;
|
|
721
|
-
private maxPollTime;
|
|
722
|
-
private pollInterval;
|
|
723
|
-
private defaultHeaders?;
|
|
724
|
-
private auth?;
|
|
725
|
-
private retryConfig?;
|
|
726
|
-
constructor(config: GatewayClientConfig);
|
|
727
|
-
private _resolveTimeout;
|
|
728
|
-
private _resolveAuthMode;
|
|
729
|
-
private _buildHeaders;
|
|
730
|
-
private _classifyStatusCode;
|
|
731
|
-
private _normalizeError;
|
|
732
|
-
private _getRetryDelayMs;
|
|
733
|
-
private _sleep;
|
|
734
|
-
/**
|
|
735
|
-
* Make HTTP request to Gateway.
|
|
736
|
-
* Handles errors and transforms them to Gateway exceptions.
|
|
737
|
-
*/
|
|
738
|
-
private _request;
|
|
739
|
-
/**
|
|
740
|
-
* Parse workflow status from API response.
|
|
741
|
-
*/
|
|
742
|
-
private _parseWorkflowStatus;
|
|
743
|
-
healthCheck(): Promise<GatewayHealthResponse>;
|
|
744
|
-
isHealthy(): Promise<boolean>;
|
|
745
|
-
/**
|
|
746
|
-
* Create a work submission workflow.
|
|
747
|
-
* POST /workflows/work-submission
|
|
748
|
-
*
|
|
749
|
-
* SDK prepares inputs; Gateway handles:
|
|
750
|
-
* - Evidence upload to Arweave
|
|
751
|
-
* - Transaction submission
|
|
752
|
-
* - Confirmation waiting
|
|
753
|
-
*
|
|
754
|
-
* @param studioAddress - Ethereum address of the studio
|
|
755
|
-
* @param epoch - Epoch number
|
|
756
|
-
* @param agentAddress - Ethereum address of the submitting agent
|
|
757
|
-
* @param dataHash - Bytes32 hash of the work (as hex string)
|
|
758
|
-
* @param threadRoot - Bytes32 DKG thread root (as hex string)
|
|
759
|
-
* @param evidenceRoot - Bytes32 evidence Merkle root (as hex string)
|
|
760
|
-
* @param evidenceContent - Raw evidence bytes (will be base64 encoded)
|
|
761
|
-
* @param signerAddress - Ethereum address of the signer (must be registered in Gateway)
|
|
762
|
-
* @returns WorkflowStatus - Initial status of the created workflow
|
|
763
|
-
*/
|
|
764
|
-
submitWork(studioAddress: string, epoch: number, agentAddress: string, dataHash: string, threadRoot: string, evidenceRoot: string, evidenceContent: Buffer | string, signerAddress: string): Promise<WorkflowStatus>;
|
|
765
|
-
/**
|
|
766
|
-
* Create a score submission workflow.
|
|
767
|
-
* POST /workflows/score-submission
|
|
768
|
-
*
|
|
769
|
-
* Supports two modes:
|
|
770
|
-
* - DIRECT (default): Simple direct scoring, requires workerAddress
|
|
771
|
-
* - COMMIT_REVEAL: Commit-reveal pattern, requires salt
|
|
772
|
-
*
|
|
773
|
-
* @param studioAddress - Ethereum address of the studio
|
|
774
|
-
* @param epoch - Epoch number
|
|
775
|
-
* @param validatorAddress - Ethereum address of the validator
|
|
776
|
-
* @param dataHash - Bytes32 hash of the work being scored (as hex string)
|
|
777
|
-
* @param scores - Array of dimension scores (0-10000 basis points)
|
|
778
|
-
* @param signerAddress - Ethereum address of the signer
|
|
779
|
-
* @param options - Additional options (workerAddress, salt, mode)
|
|
780
|
-
*/
|
|
781
|
-
submitScore(studioAddress: string, epoch: number, validatorAddress: string, dataHash: string, scores: number[], signerAddress: string, options?: {
|
|
782
|
-
workerAddress?: string;
|
|
783
|
-
salt?: string;
|
|
784
|
-
mode?: ScoreSubmissionMode;
|
|
785
|
-
}): Promise<WorkflowStatus>;
|
|
786
|
-
/**
|
|
787
|
-
* Create a close epoch workflow.
|
|
788
|
-
* POST /workflows/close-epoch
|
|
789
|
-
*
|
|
790
|
-
* This is economically final — cannot be undone.
|
|
791
|
-
*
|
|
792
|
-
* @param studioAddress - Ethereum address of the studio
|
|
793
|
-
* @param epoch - Epoch number to close
|
|
794
|
-
* @param signerAddress - Ethereum address of the signer
|
|
795
|
-
*/
|
|
796
|
-
closeEpoch(studioAddress: string, epoch: number, signerAddress: string): Promise<WorkflowStatus>;
|
|
797
|
-
/**
|
|
798
|
-
* Get workflow status by ID.
|
|
799
|
-
* GET /workflows/{id}
|
|
800
|
-
*/
|
|
801
|
-
getWorkflow(workflowId: string): Promise<WorkflowStatus>;
|
|
802
|
-
/**
|
|
803
|
-
* List workflows with optional filters.
|
|
804
|
-
* GET /workflows?studio=&state=&type=
|
|
805
|
-
*/
|
|
806
|
-
listWorkflows(options?: {
|
|
807
|
-
studio?: string;
|
|
808
|
-
state?: string;
|
|
809
|
-
workflowType?: string;
|
|
810
|
-
}): Promise<WorkflowStatus[]>;
|
|
811
|
-
/**
|
|
812
|
-
* Poll workflow until it reaches a terminal state.
|
|
813
|
-
*
|
|
814
|
-
* @param workflowId - UUID of the workflow
|
|
815
|
-
* @param options - Polling options
|
|
816
|
-
* @throws WorkflowFailedError - If workflow reaches FAILED state
|
|
817
|
-
* @throws GatewayTimeoutError - If maxWait exceeded
|
|
818
|
-
*/
|
|
819
|
-
waitForCompletion(workflowId: string, options?: {
|
|
820
|
-
maxWait?: number;
|
|
821
|
-
pollInterval?: number;
|
|
822
|
-
onProgress?: (status: WorkflowStatus) => void;
|
|
823
|
-
}): Promise<WorkflowStatus>;
|
|
824
|
-
/**
|
|
825
|
-
* Submit work and wait for completion.
|
|
826
|
-
*/
|
|
827
|
-
submitWorkAndWait(studioAddress: string, epoch: number, agentAddress: string, dataHash: string, threadRoot: string, evidenceRoot: string, evidenceContent: Buffer | string, signerAddress: string, options?: {
|
|
828
|
-
onProgress?: (status: WorkflowStatus) => void;
|
|
829
|
-
}): Promise<WorkflowStatus>;
|
|
830
|
-
/**
|
|
831
|
-
* Submit score and wait for completion.
|
|
832
|
-
*/
|
|
833
|
-
submitScoreAndWait(studioAddress: string, epoch: number, validatorAddress: string, dataHash: string, scores: number[], signerAddress: string, options?: {
|
|
834
|
-
workerAddress?: string;
|
|
835
|
-
workAddress?: string;
|
|
836
|
-
salt?: string;
|
|
837
|
-
mode?: ScoreSubmissionMode;
|
|
838
|
-
onProgress?: (status: WorkflowStatus) => void;
|
|
839
|
-
}): Promise<WorkflowStatus>;
|
|
840
|
-
/**
|
|
841
|
-
* Close epoch and wait for completion.
|
|
842
|
-
*/
|
|
843
|
-
closeEpochAndWait(studioAddress: string, epoch: number, signerAddress: string, options?: {
|
|
844
|
-
onProgress?: (status: WorkflowStatus) => void;
|
|
845
|
-
}): Promise<WorkflowStatus>;
|
|
846
|
-
/**
|
|
847
|
-
* Fetch pending (unfinalized) work for a studio from the gateway.
|
|
848
|
-
*
|
|
849
|
-
* @param studioAddress - 0x-prefixed studio contract address
|
|
850
|
-
* @param options - Optional limit/offset for pagination
|
|
851
|
-
* @returns Typed pending work response
|
|
852
|
-
*/
|
|
853
|
-
getPendingWork(studioAddress: string, options?: {
|
|
854
|
-
limit?: number;
|
|
855
|
-
offset?: number;
|
|
856
|
-
}): Promise<PendingWorkResponse>;
|
|
857
|
-
/**
|
|
858
|
-
* Fetch full evidence graph for a work submission.
|
|
859
|
-
* Endpoint: GET /v1/work/{hash}/evidence
|
|
860
|
-
*/
|
|
861
|
-
getWorkEvidence(workHash: string): Promise<WorkEvidenceResponse>;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
722
|
interface StudioClientConfig {
|
|
865
723
|
provider: ethers.Provider;
|
|
866
724
|
signer: ethers.Signer;
|
|
@@ -1032,163 +890,6 @@ declare class StudioClient {
|
|
|
1032
890
|
generateSalt(): string;
|
|
1033
891
|
}
|
|
1034
892
|
|
|
1035
|
-
/**
|
|
1036
|
-
* Session — high-level wrapper for ChaosChain Engineering Studio sessions.
|
|
1037
|
-
*
|
|
1038
|
-
* Agents use this class to log work events without constructing raw event schemas,
|
|
1039
|
-
* managing parent IDs, or thinking about DAGs. The gateway handles all of that.
|
|
1040
|
-
*
|
|
1041
|
-
* @example
|
|
1042
|
-
* ```ts
|
|
1043
|
-
* const session = await client.start({ studio_address: '0x...', agent_address: '0x...' });
|
|
1044
|
-
* await session.log({ summary: 'Planning cache layer implementation' });
|
|
1045
|
-
* await session.step('implementing', 'Added CacheService class');
|
|
1046
|
-
* await session.step('testing', 'All 47 tests pass');
|
|
1047
|
-
* const { workflow_id, data_hash } = await session.complete();
|
|
1048
|
-
* ```
|
|
1049
|
-
*/
|
|
1050
|
-
/** Options for {@link Session.log}. */
|
|
1051
|
-
interface SessionLogOptions {
|
|
1052
|
-
/** Human-readable description of what happened. */
|
|
1053
|
-
summary: string;
|
|
1054
|
-
/** Canonical event type. Defaults to `"artifact_created"`. */
|
|
1055
|
-
event_type?: string;
|
|
1056
|
-
/** Arbitrary metadata attached to the event. */
|
|
1057
|
-
metadata?: Record<string, unknown>;
|
|
1058
|
-
}
|
|
1059
|
-
/** Result returned by {@link Session.complete}. */
|
|
1060
|
-
interface SessionCompleteResult {
|
|
1061
|
-
workflow_id: string | null;
|
|
1062
|
-
data_hash: string | null;
|
|
1063
|
-
}
|
|
1064
|
-
declare class Session {
|
|
1065
|
-
/** Session ID returned by the gateway. */
|
|
1066
|
-
readonly sessionId: string;
|
|
1067
|
-
private readonly gatewayUrl;
|
|
1068
|
-
private readonly apiKey;
|
|
1069
|
-
private readonly studioAddress;
|
|
1070
|
-
private readonly agentAddress;
|
|
1071
|
-
private readonly studioPolicyVersion;
|
|
1072
|
-
private readonly workMandateId;
|
|
1073
|
-
private readonly taskType;
|
|
1074
|
-
private lastEventId;
|
|
1075
|
-
/** @internal — use {@link SessionClient.start} to create instances. */
|
|
1076
|
-
constructor(opts: {
|
|
1077
|
-
sessionId: string;
|
|
1078
|
-
gatewayUrl: string;
|
|
1079
|
-
apiKey?: string;
|
|
1080
|
-
lastEventId?: string | null;
|
|
1081
|
-
studioAddress: string;
|
|
1082
|
-
agentAddress: string;
|
|
1083
|
-
studioPolicyVersion: string;
|
|
1084
|
-
workMandateId: string;
|
|
1085
|
-
taskType: string;
|
|
1086
|
-
});
|
|
1087
|
-
/**
|
|
1088
|
-
* Log a session event.
|
|
1089
|
-
*
|
|
1090
|
-
* Automatically generates `event_id`, `timestamp`, and chains `parent_event_ids`
|
|
1091
|
-
* from the previous event so the gateway can build a causal DAG.
|
|
1092
|
-
*
|
|
1093
|
-
* @param opts - Event details. Only `summary` is required.
|
|
1094
|
-
* @throws Error if the gateway returns a non-2xx status.
|
|
1095
|
-
*/
|
|
1096
|
-
log(opts: SessionLogOptions): Promise<void>;
|
|
1097
|
-
/**
|
|
1098
|
-
* Convenience wrapper around {@link log} that maps human-friendly step names
|
|
1099
|
-
* to canonical event types.
|
|
1100
|
-
*
|
|
1101
|
-
* Mappings:
|
|
1102
|
-
* - `"planning"` → `plan_created`
|
|
1103
|
-
* - `"testing"` → `test_run`
|
|
1104
|
-
* - `"debugging"` → `debug_step`
|
|
1105
|
-
* - `"implementing"` → `file_written`
|
|
1106
|
-
* - `"completing"` → `submission_created`
|
|
1107
|
-
*
|
|
1108
|
-
* Unknown step types fall back to `artifact_created`.
|
|
1109
|
-
*
|
|
1110
|
-
* @param stepType - Friendly step name.
|
|
1111
|
-
* @param summary - What happened in this step.
|
|
1112
|
-
*/
|
|
1113
|
-
step(stepType: string, summary: string): Promise<void>;
|
|
1114
|
-
/**
|
|
1115
|
-
* Complete the session.
|
|
1116
|
-
*
|
|
1117
|
-
* Triggers the on-chain WorkSubmission workflow (if the gateway is configured for it)
|
|
1118
|
-
* and returns `workflow_id` + `data_hash` for downstream verification/scoring.
|
|
1119
|
-
*
|
|
1120
|
-
* @param opts - Optional status (`"completed"` | `"failed"`) and summary.
|
|
1121
|
-
* @returns `{ workflow_id, data_hash }` — both may be `null` if the gateway
|
|
1122
|
-
* workflow engine is not configured.
|
|
1123
|
-
* @throws Error if the gateway returns a non-2xx status.
|
|
1124
|
-
*/
|
|
1125
|
-
complete(opts?: {
|
|
1126
|
-
status?: 'completed' | 'failed';
|
|
1127
|
-
summary?: string;
|
|
1128
|
-
}): Promise<SessionCompleteResult>;
|
|
1129
|
-
private post;
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
/**
|
|
1133
|
-
* SessionClient — factory for creating ChaosChain Engineering Studio sessions.
|
|
1134
|
-
*
|
|
1135
|
-
* @example
|
|
1136
|
-
* ```ts
|
|
1137
|
-
* import { SessionClient } from '@chaoschain/sdk';
|
|
1138
|
-
*
|
|
1139
|
-
* const client = new SessionClient({ gatewayUrl: 'https://gateway.chaoscha.in', apiKey: 'cc_...' });
|
|
1140
|
-
* const session = await client.start({
|
|
1141
|
-
* studio_address: '0xFA0795fD5D7F58eCAa7Eae35Ad9cB8AED9424Dd0',
|
|
1142
|
-
* agent_address: '0x9B4Cef62a0ce1671ccFEFA6a6D8cBFa165c49831',
|
|
1143
|
-
* task_type: 'feature',
|
|
1144
|
-
* });
|
|
1145
|
-
*
|
|
1146
|
-
* await session.log({ summary: 'Started implementing cache layer' });
|
|
1147
|
-
* await session.step('testing', 'All tests pass');
|
|
1148
|
-
* const result = await session.complete();
|
|
1149
|
-
* ```
|
|
1150
|
-
*/
|
|
1151
|
-
|
|
1152
|
-
/** Configuration for {@link SessionClient}. */
|
|
1153
|
-
interface SessionClientConfig {
|
|
1154
|
-
/** Gateway base URL (default: `"https://gateway.chaoscha.in"`). */
|
|
1155
|
-
gatewayUrl?: string;
|
|
1156
|
-
/** API key sent as `X-API-Key` header. */
|
|
1157
|
-
apiKey?: string;
|
|
1158
|
-
}
|
|
1159
|
-
/** Options for {@link SessionClient.start}. */
|
|
1160
|
-
interface SessionStartOptions {
|
|
1161
|
-
/** Studio contract address (required). */
|
|
1162
|
-
studio_address: string;
|
|
1163
|
-
/** Worker agent wallet address (required). */
|
|
1164
|
-
agent_address: string;
|
|
1165
|
-
/** Work mandate ID (default: `"generic-task"`). */
|
|
1166
|
-
work_mandate_id?: string;
|
|
1167
|
-
/** Task classification (default: `"general"`). */
|
|
1168
|
-
task_type?: string;
|
|
1169
|
-
/** Studio policy version (default: `"engineering-studio-default-v1"`). */
|
|
1170
|
-
studio_policy_version?: string;
|
|
1171
|
-
/** Client-provided session ID. Server generates one if omitted. */
|
|
1172
|
-
session_id?: string;
|
|
1173
|
-
}
|
|
1174
|
-
declare class SessionClient {
|
|
1175
|
-
private readonly gatewayUrl;
|
|
1176
|
-
private readonly apiKey;
|
|
1177
|
-
constructor(config?: SessionClientConfig);
|
|
1178
|
-
/**
|
|
1179
|
-
* Create a new coding session on the gateway.
|
|
1180
|
-
*
|
|
1181
|
-
* Returns a {@link Session} instance that can be used to log events, run steps,
|
|
1182
|
-
* and complete the session. The gateway persists all events and constructs the
|
|
1183
|
-
* Evidence DAG automatically.
|
|
1184
|
-
*
|
|
1185
|
-
* @param opts - Session creation parameters.
|
|
1186
|
-
* @returns A live {@link Session} bound to the newly created session ID.
|
|
1187
|
-
* @throws Error if the gateway returns a non-2xx status.
|
|
1188
|
-
*/
|
|
1189
|
-
start(opts: SessionStartOptions): Promise<Session>;
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
893
|
/**
|
|
1193
894
|
* Main ChaosChain SDK Class - Complete TypeScript implementation
|
|
1194
895
|
*
|
|
@@ -1946,80 +1647,6 @@ declare class AutoStorageManager implements StorageBackend {
|
|
|
1946
1647
|
getAvailableBackends(): string[];
|
|
1947
1648
|
}
|
|
1948
1649
|
|
|
1949
|
-
/**
|
|
1950
|
-
* Exception classes for the ChaosChain SDK.
|
|
1951
|
-
*
|
|
1952
|
-
* This module defines all custom exceptions used throughout the SDK
|
|
1953
|
-
* to provide clear error handling and debugging information.
|
|
1954
|
-
*/
|
|
1955
|
-
declare class ChaosChainSDKError extends Error {
|
|
1956
|
-
details: Record<string, any>;
|
|
1957
|
-
constructor(message: string, details?: Record<string, any>);
|
|
1958
|
-
toString(): string;
|
|
1959
|
-
}
|
|
1960
|
-
declare class AgentRegistrationError extends ChaosChainSDKError {
|
|
1961
|
-
constructor(message: string, details?: Record<string, any>);
|
|
1962
|
-
}
|
|
1963
|
-
declare class PaymentError extends ChaosChainSDKError {
|
|
1964
|
-
constructor(message: string, details?: Record<string, any>);
|
|
1965
|
-
}
|
|
1966
|
-
declare class StorageError extends ChaosChainSDKError {
|
|
1967
|
-
constructor(message: string, details?: Record<string, any>);
|
|
1968
|
-
}
|
|
1969
|
-
declare class IntegrityVerificationError extends ChaosChainSDKError {
|
|
1970
|
-
constructor(message: string, details?: Record<string, any>);
|
|
1971
|
-
}
|
|
1972
|
-
declare class ContractError extends ChaosChainSDKError {
|
|
1973
|
-
constructor(message: string, details?: Record<string, any>);
|
|
1974
|
-
}
|
|
1975
|
-
declare class ValidationError extends ChaosChainSDKError {
|
|
1976
|
-
constructor(message: string, details?: Record<string, any>);
|
|
1977
|
-
}
|
|
1978
|
-
declare class ConfigurationError extends ChaosChainSDKError {
|
|
1979
|
-
constructor(message: string, details?: Record<string, any>);
|
|
1980
|
-
}
|
|
1981
|
-
/**
|
|
1982
|
-
* Options passed when constructing a GatewayError (statusCode, response, category, retryable).
|
|
1983
|
-
*/
|
|
1984
|
-
interface GatewayErrorDetails {
|
|
1985
|
-
statusCode?: number;
|
|
1986
|
-
response?: Record<string, any>;
|
|
1987
|
-
category?: 'transient' | 'permanent' | 'auth' | 'unknown';
|
|
1988
|
-
retryable?: boolean;
|
|
1989
|
-
}
|
|
1990
|
-
/**
|
|
1991
|
-
* Base error from Gateway API.
|
|
1992
|
-
*/
|
|
1993
|
-
declare class GatewayError extends ChaosChainSDKError {
|
|
1994
|
-
readonly statusCode?: number;
|
|
1995
|
-
readonly response?: Record<string, any>;
|
|
1996
|
-
readonly category?: 'transient' | 'permanent' | 'auth' | 'unknown';
|
|
1997
|
-
readonly retryable?: boolean;
|
|
1998
|
-
constructor(message: string, details?: GatewayErrorDetails);
|
|
1999
|
-
}
|
|
2000
|
-
/**
|
|
2001
|
-
* Failed to connect to Gateway.
|
|
2002
|
-
*/
|
|
2003
|
-
declare class GatewayConnectionError extends GatewayError {
|
|
2004
|
-
constructor(message: string);
|
|
2005
|
-
}
|
|
2006
|
-
/**
|
|
2007
|
-
* Gateway request or polling timed out.
|
|
2008
|
-
*/
|
|
2009
|
-
declare class GatewayTimeoutError extends GatewayError {
|
|
2010
|
-
readonly workflowId: string;
|
|
2011
|
-
readonly lastStatus?: WorkflowStatus;
|
|
2012
|
-
constructor(workflowId: string, message: string, lastStatus?: WorkflowStatus);
|
|
2013
|
-
}
|
|
2014
|
-
/**
|
|
2015
|
-
* Workflow reached FAILED state.
|
|
2016
|
-
*/
|
|
2017
|
-
declare class WorkflowFailedError extends GatewayError {
|
|
2018
|
-
readonly workflowId: string;
|
|
2019
|
-
readonly workflowError: WorkflowError;
|
|
2020
|
-
constructor(workflowId: string, error: WorkflowError);
|
|
2021
|
-
}
|
|
2022
|
-
|
|
2023
1650
|
/**
|
|
2024
1651
|
* ERC-8004 v1.0 Contract ABIs and Addresses
|
|
2025
1652
|
*
|
|
@@ -2696,7 +2323,7 @@ declare class StudioManager {
|
|
|
2696
2323
|
* @packageDocumentation
|
|
2697
2324
|
*/
|
|
2698
2325
|
|
|
2699
|
-
declare const SDK_VERSION = "0.3.
|
|
2326
|
+
declare const SDK_VERSION = "0.3.2";
|
|
2700
2327
|
declare const ERC8004_VERSION = "1.0";
|
|
2701
2328
|
declare const X402_VERSION = "1.0";
|
|
2702
2329
|
|
|
@@ -2733,4 +2360,4 @@ declare function initChaosChainSDK(config: {
|
|
|
2733
2360
|
enableStorage?: boolean;
|
|
2734
2361
|
}): ChaosChainSDK;
|
|
2735
2362
|
|
|
2736
|
-
export { A2AX402Extension, AgentMetadata, AgentRegistration,
|
|
2363
|
+
export { A2AX402Extension, AgentMetadata, AgentRegistration, AgentRole, AutoStorageManager, CHAOS_CORE_ABI, ChaosAgent, ChaosChainSDK, ChaosChainSDKConfig, ContractAddresses, ERC8004_VERSION, FeedbackParams, GatewayClient, GoogleAP2Integration, IDENTITY_REGISTRY_ABI, PinataStorage as IPFSPinataStorage, IntegrityProof, IrysStorage, IrysStorage as IrysStorageProvider, LocalIPFSStorage, MandateManager, NetworkConfig, type PaymentHeader, PaymentManager, PaymentMethod, PinataStorage, REPUTATION_REGISTRY_ABI, REWARDS_DISTRIBUTOR_ABI, SDK_VERSION, STUDIO_FACTORY_ABI, STUDIO_PROXY_ABI, SessionClient, type SettleRequest, type SettleResponse, type StorageBackend, type StorageResult, StudioClient, type StudioClientConfig, StudioManager, type StudioManagerConfig, type Task, type TransferAuthorizationParams, UploadOptions, UploadResult, VALIDATION_REGISTRY_ABI, WalletConfig, WalletManager, type WorkerBid, WorkflowStatus, type X402FacilitatorConfig, X402PaymentManager, type X402PaymentProof, type X402PaymentRequest$1 as X402PaymentRequest, type X402PaymentRequirements, X402Server, X402_VERSION, ZeroGStorage, ChaosChainSDK as default, getContractAddresses, getNetworkInfo, initChaosChainSDK };
|
package/dist/index.js
CHANGED
|
@@ -15414,7 +15414,10 @@ var Session = class {
|
|
|
15414
15414
|
causality: {
|
|
15415
15415
|
parent_event_ids: this.lastEventId ? [this.lastEventId] : []
|
|
15416
15416
|
},
|
|
15417
|
-
agent: {
|
|
15417
|
+
agent: {
|
|
15418
|
+
agent_address: opts.agent?.agent_address ?? this.agentAddress,
|
|
15419
|
+
role: opts.agent?.role ?? "worker"
|
|
15420
|
+
},
|
|
15418
15421
|
studio: {
|
|
15419
15422
|
studio_address: this.studioAddress,
|
|
15420
15423
|
studio_policy_version: this.studioPolicyVersion
|
|
@@ -15444,9 +15447,9 @@ var Session = class {
|
|
|
15444
15447
|
* @param stepType - Friendly step name.
|
|
15445
15448
|
* @param summary - What happened in this step.
|
|
15446
15449
|
*/
|
|
15447
|
-
async step(stepType, summary) {
|
|
15450
|
+
async step(stepType, summary, agent) {
|
|
15448
15451
|
const eventType = STEP_TYPE_MAP[stepType] ?? "artifact_created";
|
|
15449
|
-
await this.log({ event_type: eventType, summary });
|
|
15452
|
+
await this.log({ event_type: eventType, summary, agent });
|
|
15450
15453
|
}
|
|
15451
15454
|
/**
|
|
15452
15455
|
* Complete the session.
|
|
@@ -16154,7 +16157,7 @@ var ChaosChainSDK = class _ChaosChainSDK {
|
|
|
16154
16157
|
* Get SDK version
|
|
16155
16158
|
*/
|
|
16156
16159
|
getVersion() {
|
|
16157
|
-
return "0.3.
|
|
16160
|
+
return "0.3.2";
|
|
16158
16161
|
}
|
|
16159
16162
|
/**
|
|
16160
16163
|
* Get SDK capabilities summary
|
|
@@ -16952,7 +16955,7 @@ function verifyWorkEvidence(evidence, context) {
|
|
|
16952
16955
|
}
|
|
16953
16956
|
|
|
16954
16957
|
// src/index.ts
|
|
16955
|
-
var SDK_VERSION = "0.3.
|
|
16958
|
+
var SDK_VERSION = "0.3.2";
|
|
16956
16959
|
var ERC8004_VERSION = "1.0";
|
|
16957
16960
|
var X402_VERSION = "1.0";
|
|
16958
16961
|
var src_default = ChaosChainSDK;
|