@chaoschain/sdk 0.3.2 → 0.3.3
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 +7 -0
- package/README.md +1 -1
- package/dist/index.cjs +40 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +40 -14
- package/dist/index.js.map +1 -1
- package/dist/session/index.cjs +38 -12
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +34 -10
- package/dist/session/index.d.ts +34 -10
- package/dist/session/index.js +38 -12
- package/dist/session/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2323,7 +2323,7 @@ declare class StudioManager {
|
|
|
2323
2323
|
* @packageDocumentation
|
|
2324
2324
|
*/
|
|
2325
2325
|
|
|
2326
|
-
declare const SDK_VERSION = "0.3.
|
|
2326
|
+
declare const SDK_VERSION = "0.3.3";
|
|
2327
2327
|
declare const ERC8004_VERSION = "1.0";
|
|
2328
2328
|
declare const X402_VERSION = "1.0";
|
|
2329
2329
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2323,7 +2323,7 @@ declare class StudioManager {
|
|
|
2323
2323
|
* @packageDocumentation
|
|
2324
2324
|
*/
|
|
2325
2325
|
|
|
2326
|
-
declare const SDK_VERSION = "0.3.
|
|
2326
|
+
declare const SDK_VERSION = "0.3.3";
|
|
2327
2327
|
declare const ERC8004_VERSION = "1.0";
|
|
2328
2328
|
declare const X402_VERSION = "1.0";
|
|
2329
2329
|
|
package/dist/index.js
CHANGED
|
@@ -15375,10 +15375,16 @@ var STEP_TYPE_MAP = {
|
|
|
15375
15375
|
var Session = class {
|
|
15376
15376
|
/** Session ID returned by the gateway. */
|
|
15377
15377
|
sessionId;
|
|
15378
|
-
|
|
15379
|
-
|
|
15378
|
+
/** Epoch number returned by the gateway. */
|
|
15379
|
+
epoch;
|
|
15380
|
+
/** Studio contract address for this session. */
|
|
15380
15381
|
studioAddress;
|
|
15382
|
+
/** Default agent wallet address for this session. */
|
|
15381
15383
|
agentAddress;
|
|
15384
|
+
/** URL to view this session's Evidence DAG in the browser. */
|
|
15385
|
+
viewerUrl;
|
|
15386
|
+
gatewayUrl;
|
|
15387
|
+
apiKey;
|
|
15382
15388
|
studioPolicyVersion;
|
|
15383
15389
|
workMandateId;
|
|
15384
15390
|
taskType;
|
|
@@ -15386,6 +15392,8 @@ var Session = class {
|
|
|
15386
15392
|
/** @internal — use {@link SessionClient.start} to create instances. */
|
|
15387
15393
|
constructor(opts) {
|
|
15388
15394
|
this.sessionId = opts.sessionId;
|
|
15395
|
+
this.epoch = opts.epoch;
|
|
15396
|
+
this.viewerUrl = `${opts.gatewayUrl}/v1/sessions/${opts.sessionId}/viewer`;
|
|
15389
15397
|
this.gatewayUrl = opts.gatewayUrl;
|
|
15390
15398
|
this.apiKey = opts.apiKey;
|
|
15391
15399
|
this.lastEventId = opts.lastEventId ?? null;
|
|
@@ -15401,7 +15409,12 @@ var Session = class {
|
|
|
15401
15409
|
* Automatically generates `event_id`, `timestamp`, and chains `parent_event_ids`
|
|
15402
15410
|
* from the previous event so the gateway can build a causal DAG.
|
|
15403
15411
|
*
|
|
15404
|
-
* @param opts -
|
|
15412
|
+
* @param opts.summary - Human-readable description of what happened (required).
|
|
15413
|
+
* @param opts.event_type - Canonical event type (default: `"artifact_created"`).
|
|
15414
|
+
* @param opts.metadata - Arbitrary key-value metadata attached to the event.
|
|
15415
|
+
* @param opts.agent - Override the session-level agent for this event.
|
|
15416
|
+
* Pass `{ agent_address, role? }` to emit the event from a different agent.
|
|
15417
|
+
* Valid roles: `"worker"`, `"verifier"`, `"collaborator"`. Defaults to `"worker"`.
|
|
15405
15418
|
* @throws Error if the gateway returns a non-2xx status.
|
|
15406
15419
|
*/
|
|
15407
15420
|
async log(opts) {
|
|
@@ -15444,8 +15457,9 @@ var Session = class {
|
|
|
15444
15457
|
*
|
|
15445
15458
|
* Unknown step types fall back to `artifact_created`.
|
|
15446
15459
|
*
|
|
15447
|
-
* @param stepType - Friendly step name.
|
|
15460
|
+
* @param stepType - Friendly step name (`"planning"`, `"implementing"`, `"testing"`, `"debugging"`, `"completing"`).
|
|
15448
15461
|
* @param summary - What happened in this step.
|
|
15462
|
+
* @param agent - Optional agent override for this event. Same as `log({ agent })`.
|
|
15449
15463
|
*/
|
|
15450
15464
|
async step(stepType, summary, agent) {
|
|
15451
15465
|
const eventType = STEP_TYPE_MAP[stepType] ?? "artifact_created";
|
|
@@ -15455,11 +15469,13 @@ var Session = class {
|
|
|
15455
15469
|
* Complete the session.
|
|
15456
15470
|
*
|
|
15457
15471
|
* Triggers the on-chain WorkSubmission workflow (if the gateway is configured for it)
|
|
15458
|
-
* and returns
|
|
15472
|
+
* and returns the session result.
|
|
15459
15473
|
*
|
|
15460
|
-
* @param opts -
|
|
15461
|
-
* @
|
|
15462
|
-
*
|
|
15474
|
+
* @param opts.status - `"completed"` or `"failed"` (default: `"completed"`).
|
|
15475
|
+
* @param opts.summary - Human-readable summary of the session outcome.
|
|
15476
|
+
* @returns `{ workflow_id, data_hash, epoch }` — `workflow_id` and `data_hash`
|
|
15477
|
+
* may be `null` if the gateway workflow engine is not configured.
|
|
15478
|
+
* `epoch` is the epoch this session belongs to.
|
|
15463
15479
|
* @throws Error if the gateway returns a non-2xx status.
|
|
15464
15480
|
*/
|
|
15465
15481
|
async complete(opts) {
|
|
@@ -15469,7 +15485,8 @@ var Session = class {
|
|
|
15469
15485
|
const data = await this.post(`/v1/sessions/${this.sessionId}/complete`, body);
|
|
15470
15486
|
return {
|
|
15471
15487
|
workflow_id: data.data?.workflow_id ?? null,
|
|
15472
|
-
data_hash: data.data?.data_hash ?? null
|
|
15488
|
+
data_hash: data.data?.data_hash ?? null,
|
|
15489
|
+
epoch: data.data.epoch
|
|
15473
15490
|
};
|
|
15474
15491
|
}
|
|
15475
15492
|
// ---------------------------------------------------------------------------
|
|
@@ -15506,8 +15523,16 @@ var SessionClient = class {
|
|
|
15506
15523
|
* and complete the session. The gateway persists all events and constructs the
|
|
15507
15524
|
* Evidence DAG automatically.
|
|
15508
15525
|
*
|
|
15509
|
-
*
|
|
15510
|
-
*
|
|
15526
|
+
* The returned session exposes `session.sessionId`, `session.epoch`,
|
|
15527
|
+
* `session.studioAddress`, and `session.agentAddress`.
|
|
15528
|
+
*
|
|
15529
|
+
* @param opts.studio_address - Studio contract address (required).
|
|
15530
|
+
* @param opts.agent_address - Worker agent wallet address (required).
|
|
15531
|
+
* @param opts.task_type - Task classification: `"feature"`, `"bugfix"`, `"refactor"`, etc. (default: `"general"`).
|
|
15532
|
+
* @param opts.work_mandate_id - Work mandate identifier (default: `"generic-task"`).
|
|
15533
|
+
* @param opts.studio_policy_version - Studio policy version (default: `"engineering-studio-default-v1"`).
|
|
15534
|
+
* @param opts.session_id - Client-provided session ID. Server generates one if omitted.
|
|
15535
|
+
* @returns A live {@link Session} bound to the newly created session ID and epoch.
|
|
15511
15536
|
* @throws Error if the gateway returns a non-2xx status.
|
|
15512
15537
|
*/
|
|
15513
15538
|
async start(opts) {
|
|
@@ -15544,7 +15569,8 @@ var SessionClient = class {
|
|
|
15544
15569
|
agentAddress: opts.agent_address,
|
|
15545
15570
|
studioPolicyVersion: opts.studio_policy_version ?? "engineering-studio-default-v1",
|
|
15546
15571
|
workMandateId: opts.work_mandate_id ?? "generic-task",
|
|
15547
|
-
taskType: opts.task_type ?? "general"
|
|
15572
|
+
taskType: opts.task_type ?? "general",
|
|
15573
|
+
epoch: data.data.epoch
|
|
15548
15574
|
});
|
|
15549
15575
|
}
|
|
15550
15576
|
};
|
|
@@ -16157,7 +16183,7 @@ var ChaosChainSDK = class _ChaosChainSDK {
|
|
|
16157
16183
|
* Get SDK version
|
|
16158
16184
|
*/
|
|
16159
16185
|
getVersion() {
|
|
16160
|
-
return "0.3.
|
|
16186
|
+
return "0.3.3";
|
|
16161
16187
|
}
|
|
16162
16188
|
/**
|
|
16163
16189
|
* Get SDK capabilities summary
|
|
@@ -16955,7 +16981,7 @@ function verifyWorkEvidence(evidence, context) {
|
|
|
16955
16981
|
}
|
|
16956
16982
|
|
|
16957
16983
|
// src/index.ts
|
|
16958
|
-
var SDK_VERSION = "0.3.
|
|
16984
|
+
var SDK_VERSION = "0.3.3";
|
|
16959
16985
|
var ERC8004_VERSION = "1.0";
|
|
16960
16986
|
var X402_VERSION = "1.0";
|
|
16961
16987
|
var src_default = ChaosChainSDK;
|