@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/CHANGELOG.md +35 -0
- package/README.md +94 -1
- package/dist/{IPFSLocal-BqyHRp_l.d.ts → IPFSLocal-B4hnMEfS.d.ts} +1 -1
- package/dist/{IPFSLocal-azjjaiGR.d.cts → IPFSLocal-zRj6kG8e.d.cts} +1 -1
- package/dist/index.cjs +195 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +167 -6
- package/dist/index.d.ts +167 -6
- package/dist/index.js +195 -18
- 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/{types-DZze-Z8B.d.cts → types-BBVtx_jV.d.cts} +10 -2
- package/dist/{types-DZze-Z8B.d.ts → types-BBVtx_jV.d.ts} +10 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,41 @@ All notable changes to the ChaosChain TypeScript SDK will be documented in this
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.0] - 2026-03-20
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Session SDK** (`src/session/`): `SessionClient` and `Session` classes for Engineering Studio session ingestion
|
|
13
|
+
- `session.start()` — Create a new coding session
|
|
14
|
+
- `session.log()` — Log events with automatic parent chaining
|
|
15
|
+
- `session.step()` — Convenience wrapper mapping friendly names to canonical event types
|
|
16
|
+
- `session.complete()` — Complete session and get `workflow_id` + `data_hash`
|
|
17
|
+
- Automatic `parent_event_id` chaining across sequential `log()` calls
|
|
18
|
+
- `step()` helper maps friendly names (`planning`, `implementing`, `testing`, `debugging`, `completing`) to canonical event types
|
|
19
|
+
- E2E smoke test script at `scripts/test-session-e2e.ts` for validating against live gateway
|
|
20
|
+
- Session SDK accessible via `sdk.session` when gateway is configured
|
|
21
|
+
- **Verifier Agent Support**: Complete PoA (Proof-of-Agency) scoring utilities for verifier agents
|
|
22
|
+
- `verifyWorkEvidence()` — Validate evidence DAG and extract deterministic signals
|
|
23
|
+
- `extractAgencySignals()` — Extract initiative, collaboration, reasoning signals from evidence
|
|
24
|
+
- `composeScoreVector()` — Compose final score vector with verifier judgment (compliance/efficiency required)
|
|
25
|
+
- `composeScoreVectorWithDefaults()` — Compose scores with fallback defaults
|
|
26
|
+
- `GatewayClient.getPendingWork()` — Discover pending work for a studio
|
|
27
|
+
- `GatewayClient.getWorkEvidence()` — Fetch full evidence graph for work submission
|
|
28
|
+
- Types: `AgencySignals`, `VerifierAssessment`, `WorkVerificationResult`, `EngineeringStudioPolicy`, `WorkMandate`
|
|
29
|
+
- **Verifier Integration Guide** documentation with complete step-by-step workflow
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- **Gateway is now always configured by default**: SDK automatically creates a `GatewayClient` pointing to `https://gateway.chaoscha.in` when no `gatewayConfig` or `gatewayUrl` is provided. This is a **breaking change** for code that expected `sdk.gateway` to be `null` when not explicitly configured.
|
|
34
|
+
- Gateway client initialization log now shows the resolved base URL
|
|
35
|
+
- Updated README with comprehensive verifier agent integration examples and 3-layer PoA scoring architecture
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- `randomUUID()` now uses `node:crypto` import for Node.js compatibility
|
|
40
|
+
- **Treasury address correction**: Fixed incorrect treasury address for `base-sepolia` network in `X402PaymentManager` (changed from `0x8004AA63c570c570eBF15376c0dB199918BFe9Fb` to `0x20E7B2A2c8969725b88Dd3EF3a11Bc3353C83F70`)
|
|
41
|
+
- TypeScript unused parameter warning in `computeComplianceSignal()` (renamed `observed` to `_observed`)
|
|
42
|
+
|
|
8
43
|
## [0.2.0] - Unreleased
|
|
9
44
|
|
|
10
45
|
### Added
|
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ The ChaosChain TypeScript SDK enables developers to build autonomous AI agents w
|
|
|
11
11
|
- **ERC-8004 v1.0** ✅ **100% compliant** - on-chain identity, validation and reputation
|
|
12
12
|
- **ChaosChain Studios** - Multi-agent collaboration with reputation and rewards
|
|
13
13
|
- **Gateway Integration** - Workflow orchestration, crash recovery, and XMTP messaging
|
|
14
|
+
- **Engineering Studio Sessions** - Capture agent work sessions with automatic Evidence DAG construction
|
|
14
15
|
- **x402 payments** using Coinbase's HTTP 402 protocol
|
|
15
16
|
- **Pluggable storage** - IPFS, Pinata, Irys, 0G Storage
|
|
16
17
|
- **Type-safe** - Full TypeScript support with exported types
|
|
@@ -51,6 +52,58 @@ Storage backends are optional and intended for development/testing. In productio
|
|
|
51
52
|
- **Missing RPC URL** → set `rpcUrl` explicitly (recommended for production).
|
|
52
53
|
- **Using Gateway without config** → pass `gatewayConfig` or `gatewayUrl` to the constructor.
|
|
53
54
|
|
|
55
|
+
## Engineering Studio — Session SDK
|
|
56
|
+
|
|
57
|
+
The Session SDK enables AI agents to capture their work sessions without manually constructing event schemas or DAGs. Sessions automatically build a verifiable Evidence DAG that produces trust profiles for reputation and scoring.
|
|
58
|
+
|
|
59
|
+
**Quick Start:**
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { SessionClient } from '@chaoschain/sdk';
|
|
63
|
+
|
|
64
|
+
const client = new SessionClient({
|
|
65
|
+
gatewayUrl: 'https://gateway.chaoscha.in',
|
|
66
|
+
apiKey: process.env.CHAOSCHAIN_API_KEY,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// 1. Start a session
|
|
70
|
+
const session = await client.start({
|
|
71
|
+
studio_address: '0xFA0795fD5D7F58eCAa7Eae35Ad9cB8AED9424Dd0',
|
|
72
|
+
agent_address: '0x9B4Cef62a0ce1671ccFEFA6a6D8cBFa165c49831',
|
|
73
|
+
task_type: 'feature',
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// 2. Log events (automatic parent chaining)
|
|
77
|
+
await session.log({ summary: 'Planning cache layer implementation' });
|
|
78
|
+
|
|
79
|
+
// 3. Use step() for common workflows
|
|
80
|
+
await session.step('implementing', 'Added CacheService class');
|
|
81
|
+
await session.step('testing', 'All 47 tests pass');
|
|
82
|
+
|
|
83
|
+
// 4. Complete and get workflow_id + data_hash
|
|
84
|
+
const { workflow_id, data_hash } = await session.complete();
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**step() Mappings:**
|
|
88
|
+
|
|
89
|
+
| Friendly Name | Canonical Event Type |
|
|
90
|
+
|--------------|---------------------|
|
|
91
|
+
| `planning` | `plan_created` |
|
|
92
|
+
| `implementing`| `file_written` |
|
|
93
|
+
| `testing` | `test_run` |
|
|
94
|
+
| `debugging` | `debug_step` |
|
|
95
|
+
| `completing` | `submission_created`|
|
|
96
|
+
|
|
97
|
+
**View Your Session:**
|
|
98
|
+
|
|
99
|
+
After completing a session, view it in the browser:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
https://gateway.chaoscha.in/v1/sessions/{session_id}/viewer
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Note:** The Session SDK only requires `gatewayUrl` and `apiKey` — no private key or blockchain signer needed for session-only usage. Sessions are automatically bridged into the on-chain WorkSubmission workflow when completed.
|
|
106
|
+
|
|
54
107
|
## Canonical Examples
|
|
55
108
|
|
|
56
109
|
### 0) Verifier agent (pending work → evidence → scores)
|
|
@@ -100,7 +153,20 @@ for (const work of pending.data.work) {
|
|
|
100
153
|
|
|
101
154
|
**Full verifier flow** (registration, polling loop, reputation): see the [Verifier Integration Guide](https://github.com/ChaosChain/chaoschain/blob/main/docs/VERIFIER_INTEGRATION_GUIDE.md) (or `docs/VERIFIER_INTEGRATION_GUIDE.md` in the ChaosChain repo). Gateway base URL: `https://gateway.chaoscha.in`. Evidence endpoint requires an API key.
|
|
102
155
|
|
|
103
|
-
|
|
156
|
+
#### Recommended verifier flow
|
|
157
|
+
|
|
158
|
+
Use `verifyWorkEvidence()` to validate the DAG and extract signals, then `composeScoreVector()` with your compliance and efficiency assessments:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
const result = verifyWorkEvidence(evidence, { studioPolicy, workMandate });
|
|
162
|
+
|
|
163
|
+
const scores = composeScoreVector(result.signals, {
|
|
164
|
+
complianceScore: 0.87,
|
|
165
|
+
efficiencyScore: 0.81,
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 1) Minimal "Happy Path" (Gateway-first)
|
|
104
170
|
|
|
105
171
|
```typescript
|
|
106
172
|
import { ChaosChainSDK, NetworkConfig, AgentRole } from '@chaoschain/sdk';
|
|
@@ -1132,6 +1198,33 @@ npm test -- WalletManager.test.ts
|
|
|
1132
1198
|
npm run test:coverage
|
|
1133
1199
|
```
|
|
1134
1200
|
|
|
1201
|
+
## E2E Testing
|
|
1202
|
+
|
|
1203
|
+
The SDK includes an end-to-end smoke test that validates the Session SDK against the live gateway:
|
|
1204
|
+
|
|
1205
|
+
```bash
|
|
1206
|
+
CHAOSCHAIN_API_KEY=cc_... \
|
|
1207
|
+
STUDIO_ADDRESS=0x... \
|
|
1208
|
+
AGENT_ADDRESS=0x... \
|
|
1209
|
+
npx tsx scripts/test-session-e2e.ts
|
|
1210
|
+
```
|
|
1211
|
+
|
|
1212
|
+
**Required Environment Variables:**
|
|
1213
|
+
|
|
1214
|
+
- `CHAOSCHAIN_API_KEY` — Your API key (e.g., `cc_agent_...` or `cc_worker_...`)
|
|
1215
|
+
- `STUDIO_ADDRESS` — Studio contract address (e.g., `0xFA0795fD5D7F58eCAa7Eae35Ad9cB8AED9424Dd0`)
|
|
1216
|
+
- `AGENT_ADDRESS` — Worker agent wallet address
|
|
1217
|
+
|
|
1218
|
+
**What the Test Does:**
|
|
1219
|
+
|
|
1220
|
+
1. Creates a `SessionClient` and starts a new session
|
|
1221
|
+
2. Logs 4 sequential events with automatic parent chaining
|
|
1222
|
+
3. Completes the session and verifies `workflow_id` + `data_hash` are returned
|
|
1223
|
+
4. Validates the context endpoint returns correct evidence summary
|
|
1224
|
+
5. Verifies the session viewer is accessible
|
|
1225
|
+
|
|
1226
|
+
**PASS means:** All SDK methods work correctly, the gateway accepts and processes sessions, and the Evidence DAG is constructed properly. The test exits with code 0 on success, 1 on failure.
|
|
1227
|
+
|
|
1135
1228
|
## FAQ
|
|
1136
1229
|
|
|
1137
1230
|
**Q: Do I need to deploy contracts?**
|
package/dist/index.cjs
CHANGED
|
@@ -15393,6 +15393,186 @@ var StudioClient = class {
|
|
|
15393
15393
|
return ethers.ethers.hexlify(ethers.ethers.randomBytes(32));
|
|
15394
15394
|
}
|
|
15395
15395
|
};
|
|
15396
|
+
var STEP_TYPE_MAP = {
|
|
15397
|
+
planning: "plan_created",
|
|
15398
|
+
testing: "test_run",
|
|
15399
|
+
debugging: "debug_step",
|
|
15400
|
+
implementing: "file_written",
|
|
15401
|
+
completing: "submission_created"
|
|
15402
|
+
};
|
|
15403
|
+
var Session = class {
|
|
15404
|
+
/** Session ID returned by the gateway. */
|
|
15405
|
+
sessionId;
|
|
15406
|
+
gatewayUrl;
|
|
15407
|
+
apiKey;
|
|
15408
|
+
studioAddress;
|
|
15409
|
+
agentAddress;
|
|
15410
|
+
studioPolicyVersion;
|
|
15411
|
+
workMandateId;
|
|
15412
|
+
taskType;
|
|
15413
|
+
lastEventId;
|
|
15414
|
+
/** @internal — use {@link SessionClient.start} to create instances. */
|
|
15415
|
+
constructor(opts) {
|
|
15416
|
+
this.sessionId = opts.sessionId;
|
|
15417
|
+
this.gatewayUrl = opts.gatewayUrl;
|
|
15418
|
+
this.apiKey = opts.apiKey;
|
|
15419
|
+
this.lastEventId = opts.lastEventId ?? null;
|
|
15420
|
+
this.studioAddress = opts.studioAddress;
|
|
15421
|
+
this.agentAddress = opts.agentAddress;
|
|
15422
|
+
this.studioPolicyVersion = opts.studioPolicyVersion;
|
|
15423
|
+
this.workMandateId = opts.workMandateId;
|
|
15424
|
+
this.taskType = opts.taskType;
|
|
15425
|
+
}
|
|
15426
|
+
/**
|
|
15427
|
+
* Log a session event.
|
|
15428
|
+
*
|
|
15429
|
+
* Automatically generates `event_id`, `timestamp`, and chains `parent_event_ids`
|
|
15430
|
+
* from the previous event so the gateway can build a causal DAG.
|
|
15431
|
+
*
|
|
15432
|
+
* @param opts - Event details. Only `summary` is required.
|
|
15433
|
+
* @throws Error if the gateway returns a non-2xx status.
|
|
15434
|
+
*/
|
|
15435
|
+
async log(opts) {
|
|
15436
|
+
const eventId = crypto2.randomUUID();
|
|
15437
|
+
const event = {
|
|
15438
|
+
event_id: eventId,
|
|
15439
|
+
event_type: opts.event_type ?? "artifact_created",
|
|
15440
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
15441
|
+
summary: opts.summary,
|
|
15442
|
+
causality: {
|
|
15443
|
+
parent_event_ids: this.lastEventId ? [this.lastEventId] : []
|
|
15444
|
+
},
|
|
15445
|
+
agent: { agent_address: this.agentAddress, role: "worker" },
|
|
15446
|
+
studio: {
|
|
15447
|
+
studio_address: this.studioAddress,
|
|
15448
|
+
studio_policy_version: this.studioPolicyVersion
|
|
15449
|
+
},
|
|
15450
|
+
task: {
|
|
15451
|
+
work_mandate_id: this.workMandateId,
|
|
15452
|
+
task_type: this.taskType
|
|
15453
|
+
},
|
|
15454
|
+
...opts.metadata ? { metadata: opts.metadata } : {}
|
|
15455
|
+
};
|
|
15456
|
+
await this.post(`/v1/sessions/${this.sessionId}/events`, [event]);
|
|
15457
|
+
this.lastEventId = eventId;
|
|
15458
|
+
}
|
|
15459
|
+
/**
|
|
15460
|
+
* Convenience wrapper around {@link log} that maps human-friendly step names
|
|
15461
|
+
* to canonical event types.
|
|
15462
|
+
*
|
|
15463
|
+
* Mappings:
|
|
15464
|
+
* - `"planning"` → `plan_created`
|
|
15465
|
+
* - `"testing"` → `test_run`
|
|
15466
|
+
* - `"debugging"` → `debug_step`
|
|
15467
|
+
* - `"implementing"` → `file_written`
|
|
15468
|
+
* - `"completing"` → `submission_created`
|
|
15469
|
+
*
|
|
15470
|
+
* Unknown step types fall back to `artifact_created`.
|
|
15471
|
+
*
|
|
15472
|
+
* @param stepType - Friendly step name.
|
|
15473
|
+
* @param summary - What happened in this step.
|
|
15474
|
+
*/
|
|
15475
|
+
async step(stepType, summary) {
|
|
15476
|
+
const eventType = STEP_TYPE_MAP[stepType] ?? "artifact_created";
|
|
15477
|
+
await this.log({ event_type: eventType, summary });
|
|
15478
|
+
}
|
|
15479
|
+
/**
|
|
15480
|
+
* Complete the session.
|
|
15481
|
+
*
|
|
15482
|
+
* Triggers the on-chain WorkSubmission workflow (if the gateway is configured for it)
|
|
15483
|
+
* and returns `workflow_id` + `data_hash` for downstream verification/scoring.
|
|
15484
|
+
*
|
|
15485
|
+
* @param opts - Optional status (`"completed"` | `"failed"`) and summary.
|
|
15486
|
+
* @returns `{ workflow_id, data_hash }` — both may be `null` if the gateway
|
|
15487
|
+
* workflow engine is not configured.
|
|
15488
|
+
* @throws Error if the gateway returns a non-2xx status.
|
|
15489
|
+
*/
|
|
15490
|
+
async complete(opts) {
|
|
15491
|
+
const body = {};
|
|
15492
|
+
if (opts?.status) body.status = opts.status;
|
|
15493
|
+
if (opts?.summary) body.summary = opts.summary;
|
|
15494
|
+
const data = await this.post(`/v1/sessions/${this.sessionId}/complete`, body);
|
|
15495
|
+
return {
|
|
15496
|
+
workflow_id: data.data?.workflow_id ?? null,
|
|
15497
|
+
data_hash: data.data?.data_hash ?? null
|
|
15498
|
+
};
|
|
15499
|
+
}
|
|
15500
|
+
// ---------------------------------------------------------------------------
|
|
15501
|
+
// Internal HTTP helper
|
|
15502
|
+
// ---------------------------------------------------------------------------
|
|
15503
|
+
async post(path4, body) {
|
|
15504
|
+
const url = `${this.gatewayUrl}${path4}`;
|
|
15505
|
+
const headers = { "Content-Type": "application/json" };
|
|
15506
|
+
if (this.apiKey) headers["X-API-Key"] = this.apiKey;
|
|
15507
|
+
try {
|
|
15508
|
+
const res = await axios2__default.default({ method: "POST", url, data: body, headers, timeout: 3e4 });
|
|
15509
|
+
return res.data;
|
|
15510
|
+
} catch (err) {
|
|
15511
|
+
const axiosErr = err;
|
|
15512
|
+
const status = axiosErr.response?.status ?? 0;
|
|
15513
|
+
const detail = JSON.stringify(axiosErr.response?.data ?? axiosErr.message);
|
|
15514
|
+
throw new Error(`Session request failed: POST ${path4} \u2192 ${status} ${detail}`);
|
|
15515
|
+
}
|
|
15516
|
+
}
|
|
15517
|
+
};
|
|
15518
|
+
|
|
15519
|
+
// src/session/SessionClient.ts
|
|
15520
|
+
var SessionClient = class {
|
|
15521
|
+
gatewayUrl;
|
|
15522
|
+
apiKey;
|
|
15523
|
+
constructor(config = {}) {
|
|
15524
|
+
this.gatewayUrl = (config.gatewayUrl ?? "https://gateway.chaoscha.in").replace(/\/$/, "");
|
|
15525
|
+
this.apiKey = config.apiKey;
|
|
15526
|
+
}
|
|
15527
|
+
/**
|
|
15528
|
+
* Create a new coding session on the gateway.
|
|
15529
|
+
*
|
|
15530
|
+
* Returns a {@link Session} instance that can be used to log events, run steps,
|
|
15531
|
+
* and complete the session. The gateway persists all events and constructs the
|
|
15532
|
+
* Evidence DAG automatically.
|
|
15533
|
+
*
|
|
15534
|
+
* @param opts - Session creation parameters.
|
|
15535
|
+
* @returns A live {@link Session} bound to the newly created session ID.
|
|
15536
|
+
* @throws Error if the gateway returns a non-2xx status.
|
|
15537
|
+
*/
|
|
15538
|
+
async start(opts) {
|
|
15539
|
+
const body = {
|
|
15540
|
+
studio_address: opts.studio_address,
|
|
15541
|
+
agent_address: opts.agent_address
|
|
15542
|
+
};
|
|
15543
|
+
if (opts.work_mandate_id) body.work_mandate_id = opts.work_mandate_id;
|
|
15544
|
+
if (opts.task_type) body.task_type = opts.task_type;
|
|
15545
|
+
if (opts.studio_policy_version) body.studio_policy_version = opts.studio_policy_version;
|
|
15546
|
+
if (opts.session_id) body.session_id = opts.session_id;
|
|
15547
|
+
const url = `${this.gatewayUrl}/v1/sessions`;
|
|
15548
|
+
const headers = { "Content-Type": "application/json" };
|
|
15549
|
+
if (this.apiKey) headers["X-API-Key"] = this.apiKey;
|
|
15550
|
+
let data;
|
|
15551
|
+
try {
|
|
15552
|
+
const res = await axios2__default.default({ method: "POST", url, data: body, headers, timeout: 3e4 });
|
|
15553
|
+
data = res.data;
|
|
15554
|
+
} catch (err) {
|
|
15555
|
+
const axiosErr = err;
|
|
15556
|
+
const status = axiosErr.response?.status ?? 0;
|
|
15557
|
+
const detail = JSON.stringify(axiosErr.response?.data ?? axiosErr.message);
|
|
15558
|
+
throw new Error(`Failed to create session: POST /v1/sessions \u2192 ${status} ${detail}`);
|
|
15559
|
+
}
|
|
15560
|
+
const sessionId = data.data?.session_id;
|
|
15561
|
+
if (!sessionId) {
|
|
15562
|
+
throw new Error("Gateway response missing session_id");
|
|
15563
|
+
}
|
|
15564
|
+
return new Session({
|
|
15565
|
+
sessionId,
|
|
15566
|
+
gatewayUrl: this.gatewayUrl,
|
|
15567
|
+
apiKey: this.apiKey,
|
|
15568
|
+
studioAddress: opts.studio_address,
|
|
15569
|
+
agentAddress: opts.agent_address,
|
|
15570
|
+
studioPolicyVersion: opts.studio_policy_version ?? "engineering-studio-default-v1",
|
|
15571
|
+
workMandateId: opts.work_mandate_id ?? "generic-task",
|
|
15572
|
+
taskType: opts.task_type ?? "general"
|
|
15573
|
+
});
|
|
15574
|
+
}
|
|
15575
|
+
};
|
|
15396
15576
|
|
|
15397
15577
|
// src/ChaosChainSDK.ts
|
|
15398
15578
|
var ChaosChainSDK = class _ChaosChainSDK {
|
|
@@ -15410,8 +15590,10 @@ var ChaosChainSDK = class _ChaosChainSDK {
|
|
|
15410
15590
|
a2aX402Extension;
|
|
15411
15591
|
processIntegrity;
|
|
15412
15592
|
mandateManager;
|
|
15413
|
-
// Gateway client for workflow submission (
|
|
15414
|
-
gateway
|
|
15593
|
+
// Gateway client for workflow submission (always initialized)
|
|
15594
|
+
gateway;
|
|
15595
|
+
/** Session client for Engineering Studio session management. */
|
|
15596
|
+
session;
|
|
15415
15597
|
// Studio client for direct on-chain operations
|
|
15416
15598
|
studio;
|
|
15417
15599
|
// Configuration
|
|
@@ -15576,7 +15758,10 @@ var ChaosChainSDK = class _ChaosChainSDK {
|
|
|
15576
15758
|
const gatewayConfig = config.gatewayConfig ?? (config.gatewayUrl ? { gatewayUrl: config.gatewayUrl } : {});
|
|
15577
15759
|
this.gateway = new GatewayClient(gatewayConfig);
|
|
15578
15760
|
const gatewayBaseUrl = gatewayConfig.baseUrl ?? gatewayConfig.gatewayUrl ?? "https://gateway.chaoscha.in";
|
|
15579
|
-
|
|
15761
|
+
this.session = new SessionClient({
|
|
15762
|
+
gatewayUrl: gatewayBaseUrl,
|
|
15763
|
+
apiKey: gatewayConfig.auth?.apiKey
|
|
15764
|
+
});
|
|
15580
15765
|
this.studio = new StudioClient({
|
|
15581
15766
|
provider: this.provider,
|
|
15582
15767
|
signer: this.walletManager.getWallet(),
|
|
@@ -15589,16 +15774,6 @@ var ChaosChainSDK = class _ChaosChainSDK {
|
|
|
15589
15774
|
);
|
|
15590
15775
|
_ChaosChainSDK.warnedStudioClientProduction = true;
|
|
15591
15776
|
}
|
|
15592
|
-
console.log(`\u{1F680} ChaosChain SDK initialized for ${this.agentName}`);
|
|
15593
|
-
console.log(` Network: ${this.network}`);
|
|
15594
|
-
console.log(` Wallet: ${this.walletManager.getAddress()}`);
|
|
15595
|
-
console.log(` Features:`);
|
|
15596
|
-
console.log(` - ERC-8004: \u2705`);
|
|
15597
|
-
console.log(` - x402 Payments: ${this.x402PaymentManager ? "\u2705" : "\u274C"}`);
|
|
15598
|
-
console.log(` - Multi-Payment: ${this.paymentManager ? "\u2705" : "\u274C"}`);
|
|
15599
|
-
console.log(` - Google AP2: ${this.googleAP2 ? "\u2705" : "\u274C"}`);
|
|
15600
|
-
console.log(` - Process Integrity: ${this.processIntegrity ? "\u2705" : "\u274C"}`);
|
|
15601
|
-
console.log(` - Storage: \u2705`);
|
|
15602
15777
|
}
|
|
15603
15778
|
// ============================================================================
|
|
15604
15779
|
// ERC-8004 Identity Methods
|
|
@@ -16007,7 +16182,7 @@ var ChaosChainSDK = class _ChaosChainSDK {
|
|
|
16007
16182
|
* Get SDK version
|
|
16008
16183
|
*/
|
|
16009
16184
|
getVersion() {
|
|
16010
|
-
return "0.
|
|
16185
|
+
return "0.3.0";
|
|
16011
16186
|
}
|
|
16012
16187
|
/**
|
|
16013
16188
|
* Get SDK capabilities summary
|
|
@@ -16037,9 +16212,11 @@ var ChaosChainSDK = class _ChaosChainSDK {
|
|
|
16037
16212
|
}
|
|
16038
16213
|
/**
|
|
16039
16214
|
* Check if Gateway is configured.
|
|
16215
|
+
* Always returns true in v0.3.0+. Gateway is always initialized pointing to
|
|
16216
|
+
* https://gateway.chaoscha.in unless overridden via gatewayConfig.
|
|
16040
16217
|
*/
|
|
16041
16218
|
isGatewayEnabled() {
|
|
16042
|
-
return
|
|
16219
|
+
return true;
|
|
16043
16220
|
}
|
|
16044
16221
|
/**
|
|
16045
16222
|
* Get Gateway client instance.
|
|
@@ -16803,7 +16980,7 @@ function verifyWorkEvidence(evidence, context) {
|
|
|
16803
16980
|
}
|
|
16804
16981
|
|
|
16805
16982
|
// src/index.ts
|
|
16806
|
-
var SDK_VERSION = "0.
|
|
16983
|
+
var SDK_VERSION = "0.3.0";
|
|
16807
16984
|
var ERC8004_VERSION = "1.0";
|
|
16808
16985
|
var X402_VERSION = "1.0";
|
|
16809
16986
|
var src_default = ChaosChainSDK;
|
|
@@ -16864,6 +17041,8 @@ exports.SDKValidationError = ValidationError;
|
|
|
16864
17041
|
exports.SDK_VERSION = SDK_VERSION;
|
|
16865
17042
|
exports.STUDIO_FACTORY_ABI = STUDIO_FACTORY_ABI;
|
|
16866
17043
|
exports.STUDIO_PROXY_ABI = STUDIO_PROXY_ABI;
|
|
17044
|
+
exports.Session = Session;
|
|
17045
|
+
exports.SessionClient = SessionClient;
|
|
16867
17046
|
exports.StorageError = StorageError;
|
|
16868
17047
|
exports.StudioClient = StudioClient;
|
|
16869
17048
|
exports.StudioManager = StudioManager;
|