@chaoschain/sdk 0.2.4 → 0.3.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.
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { N as NetworkConfig, I as IntegrityProof, W as WalletConfig, a as NetworkInfo, C as ContractAddresses, G as GatewayClientConfig, b as GatewayHealthResponse, c as WorkflowStatus, S as ScoreSubmissionMode, P as PendingWorkResponse, d as WorkEvidenceResponse, A as AgentRole, e as ChaosChainSDKConfig, f as AgentMetadata, g as AgentRegistration, F as FeedbackParams, h as PaymentMethod, U as UploadOptions, i as UploadResult, j as WorkflowError } from './types-DZze-Z8B.cjs';
2
- export { O as AgencySignals, o as ComputeProvider, D as DKGNodeData, R as DemoAssessment, Z as EngineeringStudioPolicy, K as EvidencePackage, k as FeedbackRecord, u as PendingWorkItem, Y as ScoreRange, $ as SignalExtractionContext, n as StorageProvider, T as TEEAttestation, p as TransactionResult, l as ValidationRequest, V as ValidationRequestParams, q as ValidationStatus, Q as VerifierAssessment, L as WorkEvidenceVerificationResult, _ as WorkMandate, M as WorkVerificationResult, t as WorkflowProgress, s as WorkflowState, r as WorkflowType, m as X402Payment, X as X402PaymentParams, v as XMTPMessageData, E as composeScoreVector, H as composeScoreVectorWithDefaults, w as computeDepth, x as derivePoAScores, B as extractAgencySignals, J as rangeFit, y as validateEvidenceGraph, z as verifyWorkEvidence } from './types-DZze-Z8B.cjs';
1
+ import { N as NetworkConfig, I as IntegrityProof, W as WalletConfig, a as NetworkInfo, C as ContractAddresses, G as GatewayClientConfig, b as GatewayHealthResponse, c as WorkflowStatus, S as ScoreSubmissionMode, P as PendingWorkResponse, d as WorkEvidenceResponse, A as AgentRole, e as ChaosChainSDKConfig, f as AgentMetadata, g as AgentRegistration, F as FeedbackParams, h as PaymentMethod, U as UploadOptions, i as UploadResult, j as WorkflowError } from './types-BBVtx_jV.cjs';
2
+ export { O as AgencySignals, o as ComputeProvider, D as DKGNodeData, R as DemoAssessment, Z as EngineeringStudioPolicy, K as EvidencePackage, k as FeedbackRecord, u as PendingWorkItem, Y as ScoreRange, $ as SignalExtractionContext, n as StorageProvider, T as TEEAttestation, p as TransactionResult, l as ValidationRequest, V as ValidationRequestParams, q as ValidationStatus, Q as VerifierAssessment, L as WorkEvidenceVerificationResult, _ as WorkMandate, M as WorkVerificationResult, t as WorkflowProgress, s as WorkflowState, r as WorkflowType, m as X402Payment, X as X402PaymentParams, v as XMTPMessageData, E as composeScoreVector, H as composeScoreVectorWithDefaults, w as computeDepth, x as derivePoAScores, B as extractAgencySignals, J as rangeFit, y as validateEvidenceGraph, z as verifyWorkEvidence } from './types-BBVtx_jV.cjs';
3
3
  import { ethers } from 'ethers';
4
- export { I as IPFSLocalStorage } from './IPFSLocal-azjjaiGR.cjs';
4
+ export { I as IPFSLocalStorage } from './IPFSLocal-zRj6kG8e.cjs';
5
5
 
6
6
  /**
7
7
  * X402 Payment Manager for ChaosChain SDK
@@ -1032,6 +1032,163 @@ declare class StudioClient {
1032
1032
  generateSalt(): string;
1033
1033
  }
1034
1034
 
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
+
1035
1192
  /**
1036
1193
  * Main ChaosChain SDK Class - Complete TypeScript implementation
1037
1194
  *
@@ -1059,7 +1216,9 @@ declare class ChaosChainSDK {
1059
1216
  a2aX402Extension?: A2AX402Extension;
1060
1217
  processIntegrity?: ProcessIntegrity;
1061
1218
  mandateManager?: MandateManager;
1062
- gateway: GatewayClient | null;
1219
+ gateway: GatewayClient;
1220
+ /** Session client for Engineering Studio session management. */
1221
+ session: SessionClient;
1063
1222
  studio: StudioClient;
1064
1223
  readonly agentName: string;
1065
1224
  readonly agentDomain: string;
@@ -1273,6 +1432,8 @@ declare class ChaosChainSDK {
1273
1432
  getCapabilities(): Record<string, any>;
1274
1433
  /**
1275
1434
  * Check if Gateway is configured.
1435
+ * Always returns true in v0.3.0+. Gateway is always initialized pointing to
1436
+ * https://gateway.chaoscha.in unless overridden via gatewayConfig.
1276
1437
  */
1277
1438
  isGatewayEnabled(): boolean;
1278
1439
  /**
@@ -2535,7 +2696,7 @@ declare class StudioManager {
2535
2696
  * @packageDocumentation
2536
2697
  */
2537
2698
 
2538
- declare const SDK_VERSION = "0.2.4";
2699
+ declare const SDK_VERSION = "0.3.0";
2539
2700
  declare const ERC8004_VERSION = "1.0";
2540
2701
  declare const X402_VERSION = "1.0";
2541
2702
 
@@ -2572,4 +2733,4 @@ declare function initChaosChainSDK(config: {
2572
2733
  enableStorage?: boolean;
2573
2734
  }): ChaosChainSDK;
2574
2735
 
2575
- export { A2AX402Extension, AgentMetadata, AgentRegistration, AgentRegistrationError, AgentRole, AutoStorageManager, CHAOS_CORE_ABI, ChaosAgent, ChaosChainSDK, ChaosChainSDKConfig, ChaosChainSDKError, ConfigurationError, ContractAddresses, ContractError, ERC8004_VERSION, FeedbackParams, GatewayClient, GatewayClientConfig, GatewayConnectionError, GatewayError, GatewayTimeoutError, GoogleAP2Integration, IDENTITY_REGISTRY_ABI, PinataStorage as IPFSPinataStorage, IntegrityProof, IntegrityVerificationError, IrysStorage, IrysStorage as IrysStorageProvider, LocalIPFSStorage, MandateManager, NetworkConfig, PaymentError, type PaymentHeader, PaymentManager, PaymentMethod, PendingWorkResponse, PinataStorage, REPUTATION_REGISTRY_ABI, REWARDS_DISTRIBUTOR_ABI, ValidationError as SDKValidationError, SDK_VERSION, STUDIO_FACTORY_ABI, STUDIO_PROXY_ABI, type SettleRequest, type SettleResponse, type StorageBackend, StorageError, type StorageResult, StudioClient, type StudioClientConfig, StudioManager, type StudioManagerConfig, type Task, type TransferAuthorizationParams, UploadOptions, UploadResult, VALIDATION_REGISTRY_ABI, WalletConfig, WalletManager, WorkEvidenceResponse, type WorkerBid, WorkflowError, WorkflowFailedError, WorkflowStatus, type X402FacilitatorConfig, X402PaymentManager, type X402PaymentProof, type X402PaymentRequest$1 as X402PaymentRequest, type X402PaymentRequirements, X402Server, X402_VERSION, ZeroGStorage, ChaosChainSDK as default, getContractAddresses, getNetworkInfo, initChaosChainSDK };
2736
+ export { A2AX402Extension, AgentMetadata, AgentRegistration, AgentRegistrationError, AgentRole, AutoStorageManager, CHAOS_CORE_ABI, ChaosAgent, ChaosChainSDK, ChaosChainSDKConfig, ChaosChainSDKError, ConfigurationError, ContractAddresses, ContractError, ERC8004_VERSION, FeedbackParams, GatewayClient, GatewayClientConfig, GatewayConnectionError, GatewayError, GatewayTimeoutError, GoogleAP2Integration, IDENTITY_REGISTRY_ABI, PinataStorage as IPFSPinataStorage, IntegrityProof, IntegrityVerificationError, IrysStorage, IrysStorage as IrysStorageProvider, LocalIPFSStorage, MandateManager, NetworkConfig, PaymentError, type PaymentHeader, PaymentManager, PaymentMethod, PendingWorkResponse, PinataStorage, REPUTATION_REGISTRY_ABI, REWARDS_DISTRIBUTOR_ABI, ValidationError as SDKValidationError, SDK_VERSION, STUDIO_FACTORY_ABI, STUDIO_PROXY_ABI, Session, SessionClient, type SessionClientConfig, type SessionCompleteResult, type SessionLogOptions, type SessionStartOptions, type SettleRequest, type SettleResponse, type StorageBackend, StorageError, type StorageResult, StudioClient, type StudioClientConfig, StudioManager, type StudioManagerConfig, type Task, type TransferAuthorizationParams, UploadOptions, UploadResult, VALIDATION_REGISTRY_ABI, WalletConfig, WalletManager, WorkEvidenceResponse, type WorkerBid, WorkflowError, WorkflowFailedError, 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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { N as NetworkConfig, I as IntegrityProof, W as WalletConfig, a as NetworkInfo, C as ContractAddresses, G as GatewayClientConfig, b as GatewayHealthResponse, c as WorkflowStatus, S as ScoreSubmissionMode, P as PendingWorkResponse, d as WorkEvidenceResponse, A as AgentRole, e as ChaosChainSDKConfig, f as AgentMetadata, g as AgentRegistration, F as FeedbackParams, h as PaymentMethod, U as UploadOptions, i as UploadResult, j as WorkflowError } from './types-DZze-Z8B.js';
2
- export { O as AgencySignals, o as ComputeProvider, D as DKGNodeData, R as DemoAssessment, Z as EngineeringStudioPolicy, K as EvidencePackage, k as FeedbackRecord, u as PendingWorkItem, Y as ScoreRange, $ as SignalExtractionContext, n as StorageProvider, T as TEEAttestation, p as TransactionResult, l as ValidationRequest, V as ValidationRequestParams, q as ValidationStatus, Q as VerifierAssessment, L as WorkEvidenceVerificationResult, _ as WorkMandate, M as WorkVerificationResult, t as WorkflowProgress, s as WorkflowState, r as WorkflowType, m as X402Payment, X as X402PaymentParams, v as XMTPMessageData, E as composeScoreVector, H as composeScoreVectorWithDefaults, w as computeDepth, x as derivePoAScores, B as extractAgencySignals, J as rangeFit, y as validateEvidenceGraph, z as verifyWorkEvidence } from './types-DZze-Z8B.js';
1
+ import { N as NetworkConfig, I as IntegrityProof, W as WalletConfig, a as NetworkInfo, C as ContractAddresses, G as GatewayClientConfig, b as GatewayHealthResponse, c as WorkflowStatus, S as ScoreSubmissionMode, P as PendingWorkResponse, d as WorkEvidenceResponse, A as AgentRole, e as ChaosChainSDKConfig, f as AgentMetadata, g as AgentRegistration, F as FeedbackParams, h as PaymentMethod, U as UploadOptions, i as UploadResult, j as WorkflowError } from './types-BBVtx_jV.js';
2
+ export { O as AgencySignals, o as ComputeProvider, D as DKGNodeData, R as DemoAssessment, Z as EngineeringStudioPolicy, K as EvidencePackage, k as FeedbackRecord, u as PendingWorkItem, Y as ScoreRange, $ as SignalExtractionContext, n as StorageProvider, T as TEEAttestation, p as TransactionResult, l as ValidationRequest, V as ValidationRequestParams, q as ValidationStatus, Q as VerifierAssessment, L as WorkEvidenceVerificationResult, _ as WorkMandate, M as WorkVerificationResult, t as WorkflowProgress, s as WorkflowState, r as WorkflowType, m as X402Payment, X as X402PaymentParams, v as XMTPMessageData, E as composeScoreVector, H as composeScoreVectorWithDefaults, w as computeDepth, x as derivePoAScores, B as extractAgencySignals, J as rangeFit, y as validateEvidenceGraph, z as verifyWorkEvidence } from './types-BBVtx_jV.js';
3
3
  import { ethers } from 'ethers';
4
- export { I as IPFSLocalStorage } from './IPFSLocal-BqyHRp_l.js';
4
+ export { I as IPFSLocalStorage } from './IPFSLocal-B4hnMEfS.js';
5
5
 
6
6
  /**
7
7
  * X402 Payment Manager for ChaosChain SDK
@@ -1032,6 +1032,163 @@ declare class StudioClient {
1032
1032
  generateSalt(): string;
1033
1033
  }
1034
1034
 
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
+
1035
1192
  /**
1036
1193
  * Main ChaosChain SDK Class - Complete TypeScript implementation
1037
1194
  *
@@ -1059,7 +1216,9 @@ declare class ChaosChainSDK {
1059
1216
  a2aX402Extension?: A2AX402Extension;
1060
1217
  processIntegrity?: ProcessIntegrity;
1061
1218
  mandateManager?: MandateManager;
1062
- gateway: GatewayClient | null;
1219
+ gateway: GatewayClient;
1220
+ /** Session client for Engineering Studio session management. */
1221
+ session: SessionClient;
1063
1222
  studio: StudioClient;
1064
1223
  readonly agentName: string;
1065
1224
  readonly agentDomain: string;
@@ -1273,6 +1432,8 @@ declare class ChaosChainSDK {
1273
1432
  getCapabilities(): Record<string, any>;
1274
1433
  /**
1275
1434
  * Check if Gateway is configured.
1435
+ * Always returns true in v0.3.0+. Gateway is always initialized pointing to
1436
+ * https://gateway.chaoscha.in unless overridden via gatewayConfig.
1276
1437
  */
1277
1438
  isGatewayEnabled(): boolean;
1278
1439
  /**
@@ -2535,7 +2696,7 @@ declare class StudioManager {
2535
2696
  * @packageDocumentation
2536
2697
  */
2537
2698
 
2538
- declare const SDK_VERSION = "0.2.4";
2699
+ declare const SDK_VERSION = "0.3.0";
2539
2700
  declare const ERC8004_VERSION = "1.0";
2540
2701
  declare const X402_VERSION = "1.0";
2541
2702
 
@@ -2572,4 +2733,4 @@ declare function initChaosChainSDK(config: {
2572
2733
  enableStorage?: boolean;
2573
2734
  }): ChaosChainSDK;
2574
2735
 
2575
- export { A2AX402Extension, AgentMetadata, AgentRegistration, AgentRegistrationError, AgentRole, AutoStorageManager, CHAOS_CORE_ABI, ChaosAgent, ChaosChainSDK, ChaosChainSDKConfig, ChaosChainSDKError, ConfigurationError, ContractAddresses, ContractError, ERC8004_VERSION, FeedbackParams, GatewayClient, GatewayClientConfig, GatewayConnectionError, GatewayError, GatewayTimeoutError, GoogleAP2Integration, IDENTITY_REGISTRY_ABI, PinataStorage as IPFSPinataStorage, IntegrityProof, IntegrityVerificationError, IrysStorage, IrysStorage as IrysStorageProvider, LocalIPFSStorage, MandateManager, NetworkConfig, PaymentError, type PaymentHeader, PaymentManager, PaymentMethod, PendingWorkResponse, PinataStorage, REPUTATION_REGISTRY_ABI, REWARDS_DISTRIBUTOR_ABI, ValidationError as SDKValidationError, SDK_VERSION, STUDIO_FACTORY_ABI, STUDIO_PROXY_ABI, type SettleRequest, type SettleResponse, type StorageBackend, StorageError, type StorageResult, StudioClient, type StudioClientConfig, StudioManager, type StudioManagerConfig, type Task, type TransferAuthorizationParams, UploadOptions, UploadResult, VALIDATION_REGISTRY_ABI, WalletConfig, WalletManager, WorkEvidenceResponse, type WorkerBid, WorkflowError, WorkflowFailedError, WorkflowStatus, type X402FacilitatorConfig, X402PaymentManager, type X402PaymentProof, type X402PaymentRequest$1 as X402PaymentRequest, type X402PaymentRequirements, X402Server, X402_VERSION, ZeroGStorage, ChaosChainSDK as default, getContractAddresses, getNetworkInfo, initChaosChainSDK };
2736
+ export { A2AX402Extension, AgentMetadata, AgentRegistration, AgentRegistrationError, AgentRole, AutoStorageManager, CHAOS_CORE_ABI, ChaosAgent, ChaosChainSDK, ChaosChainSDKConfig, ChaosChainSDKError, ConfigurationError, ContractAddresses, ContractError, ERC8004_VERSION, FeedbackParams, GatewayClient, GatewayClientConfig, GatewayConnectionError, GatewayError, GatewayTimeoutError, GoogleAP2Integration, IDENTITY_REGISTRY_ABI, PinataStorage as IPFSPinataStorage, IntegrityProof, IntegrityVerificationError, IrysStorage, IrysStorage as IrysStorageProvider, LocalIPFSStorage, MandateManager, NetworkConfig, PaymentError, type PaymentHeader, PaymentManager, PaymentMethod, PendingWorkResponse, PinataStorage, REPUTATION_REGISTRY_ABI, REWARDS_DISTRIBUTOR_ABI, ValidationError as SDKValidationError, SDK_VERSION, STUDIO_FACTORY_ABI, STUDIO_PROXY_ABI, Session, SessionClient, type SessionClientConfig, type SessionCompleteResult, type SessionLogOptions, type SessionStartOptions, type SettleRequest, type SettleResponse, type StorageBackend, StorageError, type StorageResult, StudioClient, type StudioClientConfig, StudioManager, type StudioManagerConfig, type Task, type TransferAuthorizationParams, UploadOptions, UploadResult, VALIDATION_REGISTRY_ABI, WalletConfig, WalletManager, WorkEvidenceResponse, type WorkerBid, WorkflowError, WorkflowFailedError, WorkflowStatus, type X402FacilitatorConfig, X402PaymentManager, type X402PaymentProof, type X402PaymentRequest$1 as X402PaymentRequest, type X402PaymentRequirements, X402Server, X402_VERSION, ZeroGStorage, ChaosChainSDK as default, getContractAddresses, getNetworkInfo, initChaosChainSDK };