@chaoschain/sdk 0.2.3 → 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.
@@ -1,4 +1,4 @@
1
- import { o as ComputeProvider } from '../../types-CEFAgoAM.cjs';
1
+ import { o as ComputeProvider } from '../../types-BBVtx_jV.cjs';
2
2
  import 'ethers';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { o as ComputeProvider } from '../../types-CEFAgoAM.js';
1
+ import { o as ComputeProvider } from '../../types-BBVtx_jV.js';
2
2
  import 'ethers';
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
- export { I as IPFSLocalStorage } from '../../IPFSLocal-DqzD3Y7I.cjs';
2
- import { n as StorageProvider, U as UploadOptions, i as UploadResult } from '../../types-CEFAgoAM.cjs';
1
+ export { I as IPFSLocalStorage } from '../../IPFSLocal-zRj6kG8e.cjs';
2
+ import { n as StorageProvider, U as UploadOptions, i as UploadResult } from '../../types-BBVtx_jV.cjs';
3
3
  import 'ethers';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- export { I as IPFSLocalStorage } from '../../IPFSLocal-BCIADaOU.js';
2
- import { n as StorageProvider, U as UploadOptions, i as UploadResult } from '../../types-CEFAgoAM.js';
1
+ export { I as IPFSLocalStorage } from '../../IPFSLocal-B4hnMEfS.js';
2
+ import { n as StorageProvider, U as UploadOptions, i as UploadResult } from '../../types-BBVtx_jV.js';
3
3
  import 'ethers';
4
4
 
5
5
  /**
@@ -39,11 +39,24 @@ interface WorkVerificationResult {
39
39
  signals?: AgencySignals;
40
40
  }
41
41
  /**
42
- * Verifier assessment — optional overrides for each dimension.
42
+ * Verifier assessment for production scoring.
43
+ * Compliance and efficiency are REQUIRED — verifier agents must provide them.
43
44
  * Values can be in 0..1 (normalized) or 0..100 (integer); the SDK
44
45
  * auto-detects and normalizes internally.
45
46
  */
46
47
  type VerifierAssessment = {
48
+ complianceScore: number;
49
+ efficiencyScore: number;
50
+ initiativeScore?: number;
51
+ collaborationScore?: number;
52
+ reasoningScore?: number;
53
+ rationale?: string;
54
+ };
55
+ /**
56
+ * Relaxed assessment for demo/test use only.
57
+ * All fields optional — missing compliance/efficiency fall back to signals or 0.
58
+ */
59
+ type DemoAssessment = {
47
60
  initiativeScore?: number;
48
61
  collaborationScore?: number;
49
62
  reasoningScore?: number;
@@ -76,6 +89,8 @@ type AgencySignals = {
76
89
  requiredArtifactsPresent?: string[];
77
90
  missingArtifacts?: string[];
78
91
  durationMs?: number;
92
+ fragmentationPenalty?: number;
93
+ overcomplexityPenalty?: number;
79
94
  };
80
95
  };
81
96
  type ScoreRange = {
@@ -177,26 +192,37 @@ declare function extractAgencySignals(evidence: EvidencePackage[], context?: Sig
177
192
  */
178
193
  declare function computeDepth(evidence: EvidencePackage[]): number;
179
194
  /**
180
- * Composes a final on-chain score vector from deterministic signals and
181
- * optional verifier assessment.
195
+ * Production score vector composition for verifier agents.
196
+ *
197
+ * Compliance and efficiency are REQUIRED — verifier agents must explicitly
198
+ * provide these based on their judgment + deterministic signals. Throws if
199
+ * either is missing.
182
200
  *
183
- * For each dimension:
184
- * - If the verifier provides an override → use it (normalized)
185
- * - Otherwise → use the deterministic signal
186
- * - If the signal is also undefined → 0
201
+ * Initiative, collaboration, and reasoning default to deterministic signals
202
+ * unless the verifier provides overrides.
187
203
  *
188
204
  * Input values can be in 0..1 or 0..100; the SDK auto-detects.
189
205
  * Output is always integer tuple [0..100] × 5 ready for contract submission.
190
206
  */
191
- declare function composeScoreVector(signals: AgencySignals, assessment?: VerifierAssessment): [number, number, number, number, number];
207
+ declare function composeScoreVector(signals: AgencySignals, assessment: VerifierAssessment): [number, number, number, number, number];
192
208
  /**
193
- * Convenience wrapper: extract signals + compose score vector in one call.
209
+ * Demo/test score vector composition all fields optional.
210
+ *
211
+ * Falls back to deterministic signals (or 0) for any missing dimension.
212
+ * Use this for demo scripts and testing only — production verifier agents
213
+ * must use composeScoreVector() which enforces compliance/efficiency.
214
+ */
215
+ declare function composeScoreVectorWithDefaults(signals: AgencySignals, assessment?: DemoAssessment): [number, number, number, number, number];
216
+ /**
217
+ * @deprecated
218
+ * Demo helper for quick scoring without verifier judgment.
219
+ * Verifier agents should use verifyWorkEvidence() + composeScoreVector().
194
220
  *
221
+ * Convenience wrapper: extract signals + compose score vector in one call.
195
222
  * Returns [Initiative, Collaboration, Reasoning, Compliance, Efficiency]
196
223
  * as integers 0..100 for on-chain submission.
197
- *
198
- * Compliance and efficiency come from signals when available, or from the
199
- * verifier-provided `options`. No hardcoded placeholders.
224
+ * Uses composeScoreVectorWithDefaults internally — compliance and efficiency
225
+ * fall back to signals or 0 when not provided.
200
226
  */
201
227
  declare function derivePoAScores(evidence: EvidencePackage[], options?: {
202
228
  compliance?: number;
@@ -694,11 +720,17 @@ interface GatewayClientConfig {
694
720
  }
695
721
  interface PendingWorkItem {
696
722
  work_id: string;
723
+ data_hash: string;
697
724
  agent_id: number;
725
+ worker_address: string;
726
+ studio_address: string;
698
727
  epoch: number | null;
699
728
  submitted_at: string;
700
729
  evidence_anchor: string | null;
701
730
  derivation_root: string | null;
731
+ studio_policy_version: string;
732
+ work_mandate_id: string;
733
+ task_type: string;
702
734
  }
703
735
  interface PendingWorkResponse {
704
736
  version: string;
@@ -753,4 +785,4 @@ interface DKGNodeData {
753
785
  canonicalHash?: string;
754
786
  }
755
787
 
756
- export { AgentRole as A, extractAgencySignals as B, type ContractAddresses as C, type DKGNodeData as D, composeScoreVector as E, type FeedbackParams as F, type GatewayClientConfig as G, rangeFit as H, type IntegrityProof as I, type EvidencePackage as J, type WorkEvidenceVerificationResult as K, type WorkVerificationResult as L, type AgencySignals as M, NetworkConfig as N, type VerifierAssessment as O, type PendingWorkResponse as P, type ScoreRange as Q, type EngineeringStudioPolicy as R, ScoreSubmissionMode as S, type TEEAttestation as T, type UploadOptions as U, type ValidationRequestParams as V, type WalletConfig as W, type X402PaymentParams as X, type WorkMandate as Y, type SignalExtractionContext as Z, type NetworkInfo as a, type GatewayHealthResponse as b, type WorkflowStatus as c, type WorkEvidenceResponse as d, type ChaosChainSDKConfig as e, type AgentMetadata as f, type AgentRegistration as g, PaymentMethod as h, type UploadResult as i, type WorkflowError as j, type FeedbackRecord as k, type ValidationRequest as l, type X402Payment as m, type StorageProvider as n, type ComputeProvider as o, type TransactionResult as p, ValidationStatus as q, WorkflowType as r, WorkflowState as s, type WorkflowProgress as t, type PendingWorkItem as u, type XMTPMessageData as v, computeDepth as w, derivePoAScores as x, validateEvidenceGraph as y, verifyWorkEvidence as z };
788
+ export { type SignalExtractionContext as $, AgentRole as A, extractAgencySignals as B, type ContractAddresses as C, type DKGNodeData as D, composeScoreVector as E, type FeedbackParams as F, type GatewayClientConfig as G, composeScoreVectorWithDefaults as H, type IntegrityProof as I, rangeFit as J, type EvidencePackage as K, type WorkEvidenceVerificationResult as L, type WorkVerificationResult as M, NetworkConfig as N, type AgencySignals as O, type PendingWorkResponse as P, type VerifierAssessment as Q, type DemoAssessment as R, ScoreSubmissionMode as S, type TEEAttestation as T, type UploadOptions as U, type ValidationRequestParams as V, type WalletConfig as W, type X402PaymentParams as X, type ScoreRange as Y, type EngineeringStudioPolicy as Z, type WorkMandate as _, type NetworkInfo as a, type GatewayHealthResponse as b, type WorkflowStatus as c, type WorkEvidenceResponse as d, type ChaosChainSDKConfig as e, type AgentMetadata as f, type AgentRegistration as g, PaymentMethod as h, type UploadResult as i, type WorkflowError as j, type FeedbackRecord as k, type ValidationRequest as l, type X402Payment as m, type StorageProvider as n, type ComputeProvider as o, type TransactionResult as p, ValidationStatus as q, WorkflowType as r, WorkflowState as s, type WorkflowProgress as t, type PendingWorkItem as u, type XMTPMessageData as v, computeDepth as w, derivePoAScores as x, validateEvidenceGraph as y, verifyWorkEvidence as z };
@@ -39,11 +39,24 @@ interface WorkVerificationResult {
39
39
  signals?: AgencySignals;
40
40
  }
41
41
  /**
42
- * Verifier assessment — optional overrides for each dimension.
42
+ * Verifier assessment for production scoring.
43
+ * Compliance and efficiency are REQUIRED — verifier agents must provide them.
43
44
  * Values can be in 0..1 (normalized) or 0..100 (integer); the SDK
44
45
  * auto-detects and normalizes internally.
45
46
  */
46
47
  type VerifierAssessment = {
48
+ complianceScore: number;
49
+ efficiencyScore: number;
50
+ initiativeScore?: number;
51
+ collaborationScore?: number;
52
+ reasoningScore?: number;
53
+ rationale?: string;
54
+ };
55
+ /**
56
+ * Relaxed assessment for demo/test use only.
57
+ * All fields optional — missing compliance/efficiency fall back to signals or 0.
58
+ */
59
+ type DemoAssessment = {
47
60
  initiativeScore?: number;
48
61
  collaborationScore?: number;
49
62
  reasoningScore?: number;
@@ -76,6 +89,8 @@ type AgencySignals = {
76
89
  requiredArtifactsPresent?: string[];
77
90
  missingArtifacts?: string[];
78
91
  durationMs?: number;
92
+ fragmentationPenalty?: number;
93
+ overcomplexityPenalty?: number;
79
94
  };
80
95
  };
81
96
  type ScoreRange = {
@@ -177,26 +192,37 @@ declare function extractAgencySignals(evidence: EvidencePackage[], context?: Sig
177
192
  */
178
193
  declare function computeDepth(evidence: EvidencePackage[]): number;
179
194
  /**
180
- * Composes a final on-chain score vector from deterministic signals and
181
- * optional verifier assessment.
195
+ * Production score vector composition for verifier agents.
196
+ *
197
+ * Compliance and efficiency are REQUIRED — verifier agents must explicitly
198
+ * provide these based on their judgment + deterministic signals. Throws if
199
+ * either is missing.
182
200
  *
183
- * For each dimension:
184
- * - If the verifier provides an override → use it (normalized)
185
- * - Otherwise → use the deterministic signal
186
- * - If the signal is also undefined → 0
201
+ * Initiative, collaboration, and reasoning default to deterministic signals
202
+ * unless the verifier provides overrides.
187
203
  *
188
204
  * Input values can be in 0..1 or 0..100; the SDK auto-detects.
189
205
  * Output is always integer tuple [0..100] × 5 ready for contract submission.
190
206
  */
191
- declare function composeScoreVector(signals: AgencySignals, assessment?: VerifierAssessment): [number, number, number, number, number];
207
+ declare function composeScoreVector(signals: AgencySignals, assessment: VerifierAssessment): [number, number, number, number, number];
192
208
  /**
193
- * Convenience wrapper: extract signals + compose score vector in one call.
209
+ * Demo/test score vector composition all fields optional.
210
+ *
211
+ * Falls back to deterministic signals (or 0) for any missing dimension.
212
+ * Use this for demo scripts and testing only — production verifier agents
213
+ * must use composeScoreVector() which enforces compliance/efficiency.
214
+ */
215
+ declare function composeScoreVectorWithDefaults(signals: AgencySignals, assessment?: DemoAssessment): [number, number, number, number, number];
216
+ /**
217
+ * @deprecated
218
+ * Demo helper for quick scoring without verifier judgment.
219
+ * Verifier agents should use verifyWorkEvidence() + composeScoreVector().
194
220
  *
221
+ * Convenience wrapper: extract signals + compose score vector in one call.
195
222
  * Returns [Initiative, Collaboration, Reasoning, Compliance, Efficiency]
196
223
  * as integers 0..100 for on-chain submission.
197
- *
198
- * Compliance and efficiency come from signals when available, or from the
199
- * verifier-provided `options`. No hardcoded placeholders.
224
+ * Uses composeScoreVectorWithDefaults internally — compliance and efficiency
225
+ * fall back to signals or 0 when not provided.
200
226
  */
201
227
  declare function derivePoAScores(evidence: EvidencePackage[], options?: {
202
228
  compliance?: number;
@@ -694,11 +720,17 @@ interface GatewayClientConfig {
694
720
  }
695
721
  interface PendingWorkItem {
696
722
  work_id: string;
723
+ data_hash: string;
697
724
  agent_id: number;
725
+ worker_address: string;
726
+ studio_address: string;
698
727
  epoch: number | null;
699
728
  submitted_at: string;
700
729
  evidence_anchor: string | null;
701
730
  derivation_root: string | null;
731
+ studio_policy_version: string;
732
+ work_mandate_id: string;
733
+ task_type: string;
702
734
  }
703
735
  interface PendingWorkResponse {
704
736
  version: string;
@@ -753,4 +785,4 @@ interface DKGNodeData {
753
785
  canonicalHash?: string;
754
786
  }
755
787
 
756
- export { AgentRole as A, extractAgencySignals as B, type ContractAddresses as C, type DKGNodeData as D, composeScoreVector as E, type FeedbackParams as F, type GatewayClientConfig as G, rangeFit as H, type IntegrityProof as I, type EvidencePackage as J, type WorkEvidenceVerificationResult as K, type WorkVerificationResult as L, type AgencySignals as M, NetworkConfig as N, type VerifierAssessment as O, type PendingWorkResponse as P, type ScoreRange as Q, type EngineeringStudioPolicy as R, ScoreSubmissionMode as S, type TEEAttestation as T, type UploadOptions as U, type ValidationRequestParams as V, type WalletConfig as W, type X402PaymentParams as X, type WorkMandate as Y, type SignalExtractionContext as Z, type NetworkInfo as a, type GatewayHealthResponse as b, type WorkflowStatus as c, type WorkEvidenceResponse as d, type ChaosChainSDKConfig as e, type AgentMetadata as f, type AgentRegistration as g, PaymentMethod as h, type UploadResult as i, type WorkflowError as j, type FeedbackRecord as k, type ValidationRequest as l, type X402Payment as m, type StorageProvider as n, type ComputeProvider as o, type TransactionResult as p, ValidationStatus as q, WorkflowType as r, WorkflowState as s, type WorkflowProgress as t, type PendingWorkItem as u, type XMTPMessageData as v, computeDepth as w, derivePoAScores as x, validateEvidenceGraph as y, verifyWorkEvidence as z };
788
+ export { type SignalExtractionContext as $, AgentRole as A, extractAgencySignals as B, type ContractAddresses as C, type DKGNodeData as D, composeScoreVector as E, type FeedbackParams as F, type GatewayClientConfig as G, composeScoreVectorWithDefaults as H, type IntegrityProof as I, rangeFit as J, type EvidencePackage as K, type WorkEvidenceVerificationResult as L, type WorkVerificationResult as M, NetworkConfig as N, type AgencySignals as O, type PendingWorkResponse as P, type VerifierAssessment as Q, type DemoAssessment as R, ScoreSubmissionMode as S, type TEEAttestation as T, type UploadOptions as U, type ValidationRequestParams as V, type WalletConfig as W, type X402PaymentParams as X, type ScoreRange as Y, type EngineeringStudioPolicy as Z, type WorkMandate as _, type NetworkInfo as a, type GatewayHealthResponse as b, type WorkflowStatus as c, type WorkEvidenceResponse as d, type ChaosChainSDKConfig as e, type AgentMetadata as f, type AgentRegistration as g, PaymentMethod as h, type UploadResult as i, type WorkflowError as j, type FeedbackRecord as k, type ValidationRequest as l, type X402Payment as m, type StorageProvider as n, type ComputeProvider as o, type TransactionResult as p, ValidationStatus as q, WorkflowType as r, WorkflowState as s, type WorkflowProgress as t, type PendingWorkItem as u, type XMTPMessageData as v, computeDepth as w, derivePoAScores as x, validateEvidenceGraph as y, verifyWorkEvidence as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaoschain/sdk",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "TypeScript SDK for building verifiable AI agents on ChaosChain",
6
6
  "main": "./dist/index.cjs",