@pulseai/sdk 0.1.3 → 0.1.5

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.ts CHANGED
@@ -16,7 +16,7 @@ declare const TESTNET_ADDRESSES: PulseAddresses;
16
16
  /** Full Pulse contract addresses on MegaETH Mainnet. */
17
17
  declare const MAINNET_ADDRESSES: PulseAddresses;
18
18
  /** Platform buyer agent ID on MegaETH Mainnet (owned by BuyerRelay). */
19
- declare const PLATFORM_BUYER_AGENT_ID = 8154n;
19
+ declare const PLATFORM_BUYER_AGENT_ID = 8155n;
20
20
  /** Default indexer URLs by network. */
21
21
  declare const DEFAULT_INDEXER_URLS: {
22
22
  readonly testnet: "https://pulse-indexer.up.railway.app";
@@ -95,6 +95,7 @@ type JobOffering = {
95
95
  serviceType: ServiceType;
96
96
  priceUSDm: bigint;
97
97
  slaMinutes: number;
98
+ name: string;
98
99
  description: string;
99
100
  requirementsSchemaURI: string;
100
101
  active: boolean;
@@ -138,6 +139,7 @@ type ListOfferingParams = {
138
139
  serviceType: ServiceType;
139
140
  priceUSDm: bigint;
140
141
  slaMinutes: number;
142
+ name: string;
141
143
  description: string;
142
144
  requirementsSchemaURI?: string;
143
145
  };
@@ -147,7 +149,9 @@ declare function listOffering(client: PulseClient, params: ListOfferingParams):
147
149
  txHash: Hash;
148
150
  }>;
149
151
  /** Update mutable fields of an offering. */
150
- declare function updateOffering(client: PulseClient, offeringId: bigint, priceUSDm: bigint, slaMinutes: number, description: string): Promise<Hash>;
152
+ declare function updateOffering(client: PulseClient, offeringId: bigint, priceUSDm: bigint, slaMinutes: number, name: string, description: string): Promise<Hash>;
153
+ /** Update the requirements schema URI of an offering. */
154
+ declare function updateOfferingSchema(client: PulseClient, offeringId: bigint, requirementsSchemaURI: string): Promise<Hash>;
151
155
  /** Deactivate an offering. */
152
156
  declare function deactivateOffering(client: PulseClient, offeringId: bigint): Promise<Hash>;
153
157
  /** Activate a previously deactivated offering. */
@@ -163,8 +167,8 @@ type CreateJobParams = {
163
167
  warrenTermsHash: Hex;
164
168
  };
165
169
  /**
166
- * Create a job: approve USDm + call createJob.
167
- * Reads the offering price automatically.
170
+ * Create a job: approve USDm (if needed) + call createJob.
171
+ * Reads the offering price automatically and skips approve if allowance is sufficient.
168
172
  */
169
173
  declare function createJob(client: PulseClient, params: CreateJobParams): Promise<{
170
174
  jobId: bigint;
@@ -223,15 +227,15 @@ declare function deployJobTerms(client: PulseClient, agentId: bigint, params: Jo
223
227
  hash: Hex;
224
228
  txHash: Hash;
225
229
  }>;
226
- /** Deploy deliverable to WARREN + submit on-chain + register with indexer. */
227
- declare function deployDeliverable(client: PulseClient, agentId: bigint, jobId: bigint, params: DeliverableParams, indexerUrl?: string): Promise<{
228
- masterAddress: Address;
229
- pageAddress: Address;
230
+ /** Submit deliverable hash on-chain and store content in indexer.
231
+ * Previously deployed to SSTORE2 (WARREN) but removed to save provider gas costs.
232
+ * Integrity is guaranteed by on-chain deliverableHash in JobEngine. */
233
+ declare function deployDeliverable(client: PulseClient, jobId: bigint, params: DeliverableParams, indexerUrl?: string): Promise<{
230
234
  hash: Hex;
231
235
  txHash: Hash;
232
236
  }>;
233
- /** Read deliverable from WARREN via indexer lookup. */
234
- declare function readDeliverable(client: PulseClient, jobId: bigint, indexerUrl: string): Promise<DeliverableData>;
237
+ /** Read deliverable from indexer and verify content hash. */
238
+ declare function readDeliverable(jobId: bigint, indexerUrl: string): Promise<DeliverableData>;
235
239
  /** Deploy requirements to WARREN + register with indexer (link_type='requirements'). */
236
240
  declare function deployRequirements(client: PulseClient, agentId: bigint, jobId: bigint, params: RequirementsParams, indexerUrl?: string): Promise<{
237
241
  masterAddress: Address;
@@ -403,6 +407,24 @@ declare class SiteModifierHandler implements OfferingHandler {
403
407
  private fetchHtmlWithTimeout;
404
408
  }
405
409
 
410
+ type PromptHandlerConfig = {
411
+ systemPrompt: string;
412
+ aiProvider: 'anthropic' | 'google' | 'openai';
413
+ aiModel?: string;
414
+ maxTokens?: number;
415
+ getApiKey: (provider: string) => Promise<string | null>;
416
+ };
417
+ declare class PromptHandler implements OfferingHandler {
418
+ readonly offeringId: number;
419
+ readonly autoAccept = true;
420
+ readonly schema: OfferingSchema;
421
+ private readonly config;
422
+ constructor(offeringId: number, config: PromptHandlerConfig);
423
+ validateRequirements(context: JobContext): Promise<ValidationResult>;
424
+ executeJob(context: JobContext): Promise<ExecuteJobResult>;
425
+ private parseRequirements;
426
+ }
427
+
406
428
  /**
407
429
  * EIP-712 type definition matching MemoLib.sol MEMO_TYPEHASH:
408
430
  * "Memo(uint256 jobId,address signer,bytes32 contentHash,uint64 timestamp,uint256 nonce)"
@@ -456,18 +478,12 @@ declare function parseUsdm(value: string): bigint;
456
478
  declare function formatUsdm(amount: bigint): string;
457
479
 
458
480
  declare const megaethTestnet: {
459
- blockExplorers?: {
460
- [key: string]: {
461
- name: string;
462
- url: string;
463
- apiUrl?: string | undefined;
464
- };
465
- default: {
466
- name: string;
467
- url: string;
468
- apiUrl?: string | undefined;
481
+ blockExplorers: {
482
+ readonly default: {
483
+ readonly name: "Blockscout";
484
+ readonly url: "https://megaeth-testnet-v2.blockscout.com";
469
485
  };
470
- } | undefined | undefined;
486
+ };
471
487
  blockTime?: number | undefined | undefined;
472
488
  contracts?: {
473
489
  [x: string]: viem.ChainContract | {
@@ -509,18 +525,12 @@ declare const megaethTestnet: {
509
525
  verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
510
526
  };
511
527
  declare const megaethMainnet: {
512
- blockExplorers?: {
513
- [key: string]: {
514
- name: string;
515
- url: string;
516
- apiUrl?: string | undefined;
517
- };
518
- default: {
519
- name: string;
520
- url: string;
521
- apiUrl?: string | undefined;
528
+ blockExplorers: {
529
+ readonly default: {
530
+ readonly name: "Blockscout";
531
+ readonly url: "https://megaeth.blockscout.com";
522
532
  };
523
- } | undefined | undefined;
533
+ };
524
534
  blockTime?: number | undefined | undefined;
525
535
  contracts?: {
526
536
  [x: string]: viem.ChainContract | {
@@ -673,6 +683,12 @@ declare class IndexerClient {
673
683
  registerWarrenLink(jobId: number, linkType: string, masterAddress: string, contentHash: string): Promise<void>;
674
684
  getWarrenLinks(jobId: number): Promise<IndexerWarrenLinks>;
675
685
  postDeliverable(jobId: number, content: string, contentHash: string, storageType?: string): Promise<void>;
686
+ updateOfferingMetadata(offeringId: number, params: {
687
+ openclawExample?: string;
688
+ usageUrl?: string;
689
+ usageInstructions?: string;
690
+ signature: string;
691
+ }): Promise<void>;
676
692
  getDeliverable(jobId: number): Promise<{
677
693
  content: string;
678
694
  storageType: string;
@@ -1010,6 +1026,10 @@ declare const serviceMarketplaceAbi: readonly [{
1010
1026
  readonly name: "slaMinutes";
1011
1027
  readonly type: "uint32";
1012
1028
  readonly internalType: "uint32";
1029
+ }, {
1030
+ readonly name: "name";
1031
+ readonly type: "string";
1032
+ readonly internalType: "string";
1013
1033
  }, {
1014
1034
  readonly name: "description";
1015
1035
  readonly type: "string";
@@ -1064,6 +1084,10 @@ declare const serviceMarketplaceAbi: readonly [{
1064
1084
  readonly name: "slaMinutes";
1065
1085
  readonly type: "uint32";
1066
1086
  readonly internalType: "uint32";
1087
+ }, {
1088
+ readonly name: "name";
1089
+ readonly type: "string";
1090
+ readonly internalType: "string";
1067
1091
  }, {
1068
1092
  readonly name: "description";
1069
1093
  readonly type: "string";
@@ -1104,6 +1128,10 @@ declare const serviceMarketplaceAbi: readonly [{
1104
1128
  readonly name: "slaMinutes";
1105
1129
  readonly type: "uint32";
1106
1130
  readonly internalType: "uint32";
1131
+ }, {
1132
+ readonly name: "name";
1133
+ readonly type: "string";
1134
+ readonly internalType: "string";
1107
1135
  }, {
1108
1136
  readonly name: "description";
1109
1137
  readonly type: "string";
@@ -1111,6 +1139,20 @@ declare const serviceMarketplaceAbi: readonly [{
1111
1139
  }];
1112
1140
  readonly outputs: readonly [];
1113
1141
  readonly stateMutability: "nonpayable";
1142
+ }, {
1143
+ readonly type: "function";
1144
+ readonly name: "updateOfferingSchema";
1145
+ readonly inputs: readonly [{
1146
+ readonly name: "offeringId";
1147
+ readonly type: "uint256";
1148
+ readonly internalType: "uint256";
1149
+ }, {
1150
+ readonly name: "requirementsSchemaURI";
1151
+ readonly type: "string";
1152
+ readonly internalType: "string";
1153
+ }];
1154
+ readonly outputs: readonly [];
1155
+ readonly stateMutability: "nonpayable";
1114
1156
  }, {
1115
1157
  readonly type: "event";
1116
1158
  readonly name: "OfferingActivated";
@@ -1156,6 +1198,21 @@ declare const serviceMarketplaceAbi: readonly [{
1156
1198
  readonly internalType: "uint256";
1157
1199
  }];
1158
1200
  readonly anonymous: false;
1201
+ }, {
1202
+ readonly type: "event";
1203
+ readonly name: "OfferingSchemaUpdated";
1204
+ readonly inputs: readonly [{
1205
+ readonly name: "offeringId";
1206
+ readonly type: "uint256";
1207
+ readonly indexed: true;
1208
+ readonly internalType: "uint256";
1209
+ }, {
1210
+ readonly name: "requirementsSchemaURI";
1211
+ readonly type: "string";
1212
+ readonly indexed: false;
1213
+ readonly internalType: "string";
1214
+ }];
1215
+ readonly anonymous: false;
1159
1216
  }, {
1160
1217
  readonly type: "event";
1161
1218
  readonly name: "OfferingUpdated";
@@ -1565,6 +1622,16 @@ declare const jobEngineAbi: readonly [{
1565
1622
  readonly internalType: "contract IServiceMarketplace";
1566
1623
  }];
1567
1624
  readonly stateMutability: "view";
1625
+ }, {
1626
+ readonly type: "function";
1627
+ readonly name: "setServiceMarketplace";
1628
+ readonly inputs: readonly [{
1629
+ readonly name: "newMarketplace";
1630
+ readonly type: "address";
1631
+ readonly internalType: "address";
1632
+ }];
1633
+ readonly outputs: readonly [];
1634
+ readonly stateMutability: "nonpayable";
1568
1635
  }, {
1569
1636
  readonly type: "function";
1570
1637
  readonly name: "settle";
@@ -1783,6 +1850,21 @@ declare const jobEngineAbi: readonly [{
1783
1850
  readonly internalType: "address";
1784
1851
  }];
1785
1852
  readonly anonymous: false;
1853
+ }, {
1854
+ readonly type: "event";
1855
+ readonly name: "ServiceMarketplaceUpdated";
1856
+ readonly inputs: readonly [{
1857
+ readonly name: "oldMarketplace";
1858
+ readonly type: "address";
1859
+ readonly indexed: true;
1860
+ readonly internalType: "address";
1861
+ }, {
1862
+ readonly name: "newMarketplace";
1863
+ readonly type: "address";
1864
+ readonly indexed: true;
1865
+ readonly internalType: "address";
1866
+ }];
1867
+ readonly anonymous: false;
1786
1868
  }, {
1787
1869
  readonly type: "event";
1788
1870
  readonly name: "Upgraded";
@@ -3674,4 +3756,4 @@ declare const masterAbi: readonly [{
3674
3756
  readonly anonymous: false;
3675
3757
  }];
3676
3758
 
3677
- export { ACCEPT_TIMEOUT, type AICallOptions, type AICallResult, type AIMessage, type AIProvider, type AIUsage, type AgentCardParams, BPS_DENOMINATOR, type BuyerCallbacks, BuyerRuntime, type BuyerRuntimeOptions, type CreateJobParams, type CreatePresetPulseClientOptions, type CreatePulseClientOptions, DEFAULT_INDEXER_URLS, DEFAULT_SCHEMAS, type DeliverableData, type DeliverableParams, EVALUATION_TIMEOUT, type ExecuteJobResult, FEE_BPS, HandlerProviderRuntime, type HandlerProviderRuntimeOptions, type IndexerAgent, IndexerClient, IndexerClientError, type IndexerClientOptions, type IndexerJob, type IndexerJobsFilter, type IndexerOffering, type IndexerOfferingsFilter, type IndexerWarrenLink, type IndexerWarrenLinks, type Job, type JobContext, type JobOffering, JobStatus, type JobTermsParams, type JsonSchema, type ListOfferingParams, MAINNET_ADDRESSES, MEMO_TYPES, type OfferingHandler, type OfferingSchema, PLATFORM_BUYER_AGENT_ID, PULSE_DOMAIN, type PresetPulseClient, type ProviderCallbacks, ProviderRuntime, type ProviderRuntimeOptions, type PulseAddresses, type PulseAgentData, type PulseClient, RISK_POOL_BPS, type RequirementsData, type RequirementsParams, ServiceType, type SignMemoParams, type SiteModifierConfig, SiteModifierHandler, TESTNET_ADDRESSES, TREASURY_BPS, USDM_MAINNET, type ValidationResult, acceptJob, activateOffering, buyerRelayAbi, callAI, cancelJob, createAgentCard, createDeliverable, createJob, createJobTerms, createMainnetClient, createPulseClient, createRequirements, createTestnetClient, deactivateOffering, deployAgentCard, deployDeliverable, deployJobTerms, deployRequirements, deployWarrenMaster, deployWarrenPage, erc20Abi, erc8004IdentityAbi, erc8004ReputationAbi, evaluate, feeDistributorAbi, formatUsdm, getAgent, getJob, getJobCount, getOffering, getOfferingCount, initAgent, jobEngineAbi, listOffering, mainnetERC8004, masterAbi, megaethMainnet, megaethTestnet, pageAbi, parseUsdm, pulseExtensionAbi, readDeliverable, readRequirements, readWarrenMaster, readWarrenPage, registerAgent, rejectJob, resolveDispute, serviceMarketplaceAbi, setOperator, setWarrenContract, settle, signMemo, submitDeliverable, testnetERC8004, updateOffering, validateAgainstSchema, verifyContentHash };
3759
+ export { ACCEPT_TIMEOUT, type AICallOptions, type AICallResult, type AIMessage, type AIProvider, type AIUsage, type AgentCardParams, BPS_DENOMINATOR, type BuyerCallbacks, BuyerRuntime, type BuyerRuntimeOptions, type CreateJobParams, type CreatePresetPulseClientOptions, type CreatePulseClientOptions, DEFAULT_INDEXER_URLS, DEFAULT_SCHEMAS, type DeliverableData, type DeliverableParams, EVALUATION_TIMEOUT, type ExecuteJobResult, FEE_BPS, HandlerProviderRuntime, type HandlerProviderRuntimeOptions, type IndexerAgent, IndexerClient, IndexerClientError, type IndexerClientOptions, type IndexerJob, type IndexerJobsFilter, type IndexerOffering, type IndexerOfferingsFilter, type IndexerWarrenLink, type IndexerWarrenLinks, type Job, type JobContext, type JobOffering, JobStatus, type JobTermsParams, type JsonSchema, type ListOfferingParams, MAINNET_ADDRESSES, MEMO_TYPES, type OfferingHandler, type OfferingSchema, PLATFORM_BUYER_AGENT_ID, PULSE_DOMAIN, type PresetPulseClient, PromptHandler, type PromptHandlerConfig, type ProviderCallbacks, ProviderRuntime, type ProviderRuntimeOptions, type PulseAddresses, type PulseAgentData, type PulseClient, RISK_POOL_BPS, type RequirementsData, type RequirementsParams, ServiceType, type SignMemoParams, type SiteModifierConfig, SiteModifierHandler, TESTNET_ADDRESSES, TREASURY_BPS, USDM_MAINNET, type ValidationResult, acceptJob, activateOffering, buyerRelayAbi, callAI, cancelJob, createAgentCard, createDeliverable, createJob, createJobTerms, createMainnetClient, createPulseClient, createRequirements, createTestnetClient, deactivateOffering, deployAgentCard, deployDeliverable, deployJobTerms, deployRequirements, deployWarrenMaster, deployWarrenPage, erc20Abi, erc8004IdentityAbi, erc8004ReputationAbi, evaluate, feeDistributorAbi, formatUsdm, getAgent, getJob, getJobCount, getOffering, getOfferingCount, initAgent, jobEngineAbi, listOffering, mainnetERC8004, masterAbi, megaethMainnet, megaethTestnet, pageAbi, parseUsdm, pulseExtensionAbi, readDeliverable, readRequirements, readWarrenMaster, readWarrenPage, registerAgent, rejectJob, resolveDispute, serviceMarketplaceAbi, setOperator, setWarrenContract, settle, signMemo, submitDeliverable, testnetERC8004, updateOffering, updateOfferingSchema, validateAgainstSchema, verifyContentHash };