@pulseai/sdk 0.1.3 → 0.1.4
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 +109 -33
- package/dist/index.js +306 -57
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 =
|
|
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
|
-
/**
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
|
234
|
-
declare function readDeliverable(
|
|
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
|
-
|
|
461
|
-
name:
|
|
462
|
-
url:
|
|
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
|
-
}
|
|
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
|
-
|
|
514
|
-
name:
|
|
515
|
-
url:
|
|
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
|
-
}
|
|
533
|
+
};
|
|
524
534
|
blockTime?: number | undefined | undefined;
|
|
525
535
|
contracts?: {
|
|
526
536
|
[x: string]: viem.ChainContract | {
|
|
@@ -1010,6 +1020,10 @@ declare const serviceMarketplaceAbi: readonly [{
|
|
|
1010
1020
|
readonly name: "slaMinutes";
|
|
1011
1021
|
readonly type: "uint32";
|
|
1012
1022
|
readonly internalType: "uint32";
|
|
1023
|
+
}, {
|
|
1024
|
+
readonly name: "name";
|
|
1025
|
+
readonly type: "string";
|
|
1026
|
+
readonly internalType: "string";
|
|
1013
1027
|
}, {
|
|
1014
1028
|
readonly name: "description";
|
|
1015
1029
|
readonly type: "string";
|
|
@@ -1064,6 +1078,10 @@ declare const serviceMarketplaceAbi: readonly [{
|
|
|
1064
1078
|
readonly name: "slaMinutes";
|
|
1065
1079
|
readonly type: "uint32";
|
|
1066
1080
|
readonly internalType: "uint32";
|
|
1081
|
+
}, {
|
|
1082
|
+
readonly name: "name";
|
|
1083
|
+
readonly type: "string";
|
|
1084
|
+
readonly internalType: "string";
|
|
1067
1085
|
}, {
|
|
1068
1086
|
readonly name: "description";
|
|
1069
1087
|
readonly type: "string";
|
|
@@ -1104,6 +1122,10 @@ declare const serviceMarketplaceAbi: readonly [{
|
|
|
1104
1122
|
readonly name: "slaMinutes";
|
|
1105
1123
|
readonly type: "uint32";
|
|
1106
1124
|
readonly internalType: "uint32";
|
|
1125
|
+
}, {
|
|
1126
|
+
readonly name: "name";
|
|
1127
|
+
readonly type: "string";
|
|
1128
|
+
readonly internalType: "string";
|
|
1107
1129
|
}, {
|
|
1108
1130
|
readonly name: "description";
|
|
1109
1131
|
readonly type: "string";
|
|
@@ -1111,6 +1133,20 @@ declare const serviceMarketplaceAbi: readonly [{
|
|
|
1111
1133
|
}];
|
|
1112
1134
|
readonly outputs: readonly [];
|
|
1113
1135
|
readonly stateMutability: "nonpayable";
|
|
1136
|
+
}, {
|
|
1137
|
+
readonly type: "function";
|
|
1138
|
+
readonly name: "updateOfferingSchema";
|
|
1139
|
+
readonly inputs: readonly [{
|
|
1140
|
+
readonly name: "offeringId";
|
|
1141
|
+
readonly type: "uint256";
|
|
1142
|
+
readonly internalType: "uint256";
|
|
1143
|
+
}, {
|
|
1144
|
+
readonly name: "requirementsSchemaURI";
|
|
1145
|
+
readonly type: "string";
|
|
1146
|
+
readonly internalType: "string";
|
|
1147
|
+
}];
|
|
1148
|
+
readonly outputs: readonly [];
|
|
1149
|
+
readonly stateMutability: "nonpayable";
|
|
1114
1150
|
}, {
|
|
1115
1151
|
readonly type: "event";
|
|
1116
1152
|
readonly name: "OfferingActivated";
|
|
@@ -1156,6 +1192,21 @@ declare const serviceMarketplaceAbi: readonly [{
|
|
|
1156
1192
|
readonly internalType: "uint256";
|
|
1157
1193
|
}];
|
|
1158
1194
|
readonly anonymous: false;
|
|
1195
|
+
}, {
|
|
1196
|
+
readonly type: "event";
|
|
1197
|
+
readonly name: "OfferingSchemaUpdated";
|
|
1198
|
+
readonly inputs: readonly [{
|
|
1199
|
+
readonly name: "offeringId";
|
|
1200
|
+
readonly type: "uint256";
|
|
1201
|
+
readonly indexed: true;
|
|
1202
|
+
readonly internalType: "uint256";
|
|
1203
|
+
}, {
|
|
1204
|
+
readonly name: "requirementsSchemaURI";
|
|
1205
|
+
readonly type: "string";
|
|
1206
|
+
readonly indexed: false;
|
|
1207
|
+
readonly internalType: "string";
|
|
1208
|
+
}];
|
|
1209
|
+
readonly anonymous: false;
|
|
1159
1210
|
}, {
|
|
1160
1211
|
readonly type: "event";
|
|
1161
1212
|
readonly name: "OfferingUpdated";
|
|
@@ -1565,6 +1616,16 @@ declare const jobEngineAbi: readonly [{
|
|
|
1565
1616
|
readonly internalType: "contract IServiceMarketplace";
|
|
1566
1617
|
}];
|
|
1567
1618
|
readonly stateMutability: "view";
|
|
1619
|
+
}, {
|
|
1620
|
+
readonly type: "function";
|
|
1621
|
+
readonly name: "setServiceMarketplace";
|
|
1622
|
+
readonly inputs: readonly [{
|
|
1623
|
+
readonly name: "newMarketplace";
|
|
1624
|
+
readonly type: "address";
|
|
1625
|
+
readonly internalType: "address";
|
|
1626
|
+
}];
|
|
1627
|
+
readonly outputs: readonly [];
|
|
1628
|
+
readonly stateMutability: "nonpayable";
|
|
1568
1629
|
}, {
|
|
1569
1630
|
readonly type: "function";
|
|
1570
1631
|
readonly name: "settle";
|
|
@@ -1783,6 +1844,21 @@ declare const jobEngineAbi: readonly [{
|
|
|
1783
1844
|
readonly internalType: "address";
|
|
1784
1845
|
}];
|
|
1785
1846
|
readonly anonymous: false;
|
|
1847
|
+
}, {
|
|
1848
|
+
readonly type: "event";
|
|
1849
|
+
readonly name: "ServiceMarketplaceUpdated";
|
|
1850
|
+
readonly inputs: readonly [{
|
|
1851
|
+
readonly name: "oldMarketplace";
|
|
1852
|
+
readonly type: "address";
|
|
1853
|
+
readonly indexed: true;
|
|
1854
|
+
readonly internalType: "address";
|
|
1855
|
+
}, {
|
|
1856
|
+
readonly name: "newMarketplace";
|
|
1857
|
+
readonly type: "address";
|
|
1858
|
+
readonly indexed: true;
|
|
1859
|
+
readonly internalType: "address";
|
|
1860
|
+
}];
|
|
1861
|
+
readonly anonymous: false;
|
|
1786
1862
|
}, {
|
|
1787
1863
|
readonly type: "event";
|
|
1788
1864
|
readonly name: "Upgraded";
|
|
@@ -3674,4 +3750,4 @@ declare const masterAbi: readonly [{
|
|
|
3674
3750
|
readonly anonymous: false;
|
|
3675
3751
|
}];
|
|
3676
3752
|
|
|
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 };
|
|
3753
|
+
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 };
|