@pulseai/sdk 0.1.1 → 0.1.2

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.js CHANGED
@@ -41,8 +41,10 @@ var MAINNET_ADDRESSES = {
41
41
  feeDistributor: "0x51EdD8E4C4B423b952821fc9e2a7dad15a858B56",
42
42
  identityRegistry: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
43
43
  reputationRegistry: "0x8004BAa17C55a88189AE136b182e5fdA19dE9b63",
44
- usdm: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7"
44
+ usdm: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
45
+ buyerRelay: "0x633054593db34c5aAe36F784faeAe51b9604e037"
45
46
  };
47
+ var PLATFORM_BUYER_AGENT_ID = 8154n;
46
48
  var DEFAULT_INDEXER_URLS = {
47
49
  testnet: "https://pulse-indexer.up.railway.app",
48
50
  mainnet: "https://pulse-indexer.up.railway.app"
@@ -2664,10 +2666,17 @@ async function deployJobTerms(client, agentId, params) {
2664
2666
  const { masterAddress } = await deployWarrenMaster(client, agentId, pageAddress, contentBytes.length, 0);
2665
2667
  return { masterAddress, pageAddress, hash, txHash };
2666
2668
  }
2669
+ function stripCodeFence(content) {
2670
+ let result = content.trim();
2671
+ result = result.replace(/^```\w*\n?/, "");
2672
+ result = result.replace(/\n?```\s*$/, "");
2673
+ return result;
2674
+ }
2667
2675
  async function deployDeliverable(client, agentId, jobId, params, indexerUrl) {
2668
2676
  const { json, hash } = createDeliverable(params);
2669
- const contentBytes = new TextEncoder().encode(json);
2670
- const { pageAddress, txHash } = await deployWarrenPage(client, json);
2677
+ const warrenContent = params.type === "inline" && params.content ? stripCodeFence(params.content) : json;
2678
+ const contentBytes = new TextEncoder().encode(warrenContent);
2679
+ const { pageAddress, txHash } = await deployWarrenPage(client, warrenContent);
2671
2680
  const { masterAddress } = await deployWarrenMaster(client, agentId, pageAddress, contentBytes.length, 1);
2672
2681
  await write(client, {
2673
2682
  address: client.addresses.jobEngine,
@@ -2886,7 +2895,8 @@ async function callOpenAI(params) {
2886
2895
  if (!content) {
2887
2896
  throw new Error("OpenAI returned an empty response");
2888
2897
  }
2889
- return { content, raw: payload };
2898
+ const truncated = payload?.choices?.[0]?.finish_reason === "length";
2899
+ return { content, truncated, raw: payload };
2890
2900
  }
2891
2901
  async function callAnthropic(params) {
2892
2902
  const systemPrompt = params.messages.filter((message) => message.role === "system").map((message) => message.content).join("\n\n").trim();
@@ -2919,7 +2929,8 @@ async function callAnthropic(params) {
2919
2929
  if (!content) {
2920
2930
  throw new Error("Anthropic returned an empty response");
2921
2931
  }
2922
- return { content, raw: payload };
2932
+ const truncated = payload?.stop_reason === "max_tokens";
2933
+ return { content, truncated, raw: payload };
2923
2934
  }
2924
2935
  async function callGoogle(params) {
2925
2936
  const systemPrompt = params.messages.filter((message) => message.role === "system").map((message) => message.content).join("\n\n").trim();
@@ -2953,7 +2964,8 @@ async function callGoogle(params) {
2953
2964
  if (!content) {
2954
2965
  throw new Error("Google returned an empty response");
2955
2966
  }
2956
- return { content, raw: payload };
2967
+ const truncated = payload?.candidates?.[0]?.finishReason === "MAX_TOKENS";
2968
+ return { content, truncated, raw: payload };
2957
2969
  }
2958
2970
  async function callAI(params) {
2959
2971
  if (params.provider === "openai") {
@@ -2971,12 +2983,15 @@ async function callAI(params) {
2971
2983
  // src/handler/site-modifier.ts
2972
2984
  var FETCH_TIMEOUT_MS = 3e4;
2973
2985
  var MAX_HTML_BYTES = 500 * 1024;
2974
- var DEFAULT_MAX_TOKENS = 4096;
2986
+ var DEFAULT_MAX_TOKENS = 16384;
2987
+ var AI_MAX_RETRIES = 3;
2988
+ var RETRY_DELAY_MS = 2e3;
2989
+ var GOOGLE_FALLBACK_MODEL = "gemini-2.5-pro";
2975
2990
  var SUPPORTED_PROVIDERS = ["anthropic", "google", "openai"];
2976
2991
  var DEFAULT_MODELS = {
2977
2992
  openai: "gpt-4o-mini",
2978
2993
  anthropic: "claude-3-5-sonnet-latest",
2979
- google: "gemini-1.5-pro"
2994
+ google: "gemini-3.1-pro-preview"
2980
2995
  };
2981
2996
  var DEFAULT_SYSTEM_PROMPT = [
2982
2997
  "You are an expert frontend engineer modifying an existing HTML document.",
@@ -3029,6 +3044,10 @@ function isHtmlContentType(contentType) {
3029
3044
  const lower = contentType.toLowerCase();
3030
3045
  return lower.includes("text/html") || lower.includes("application/xhtml+xml");
3031
3046
  }
3047
+ function isJsonContentType(contentType) {
3048
+ const lower = contentType.toLowerCase();
3049
+ return lower.includes("application/json") || lower.includes("text/json");
3050
+ }
3032
3051
  function extractHtmlFromText(text) {
3033
3052
  const htmlFence = text.match(/```html\s*([\s\S]*?)```/i);
3034
3053
  if (htmlFence?.[1]) {
@@ -3042,12 +3061,49 @@ function extractHtmlFromText(text) {
3042
3061
  return fencedContent;
3043
3062
  }
3044
3063
  }
3064
+ const openFence = text.match(/```html?\s*\n?([\s\S]+)/i);
3065
+ if (openFence?.[1]) {
3066
+ const content = openFence[1].trim();
3067
+ if (/<html[\s>]|<!doctype html/i.test(content)) {
3068
+ return content;
3069
+ }
3070
+ }
3045
3071
  const trimmed = text.trim();
3046
3072
  if (/<html[\s>]|<!doctype html/i.test(trimmed)) {
3047
3073
  return trimmed;
3048
3074
  }
3049
3075
  return null;
3050
3076
  }
3077
+ function extractHtmlFromJson(jsonText) {
3078
+ try {
3079
+ const parsed = JSON.parse(jsonText);
3080
+ if (typeof parsed === "string") {
3081
+ if (/<html[\s>]|<!doctype html/i.test(parsed)) return parsed;
3082
+ return null;
3083
+ }
3084
+ if (typeof parsed !== "object" || parsed === null) return null;
3085
+ const obj = parsed;
3086
+ const nested = obj.data && typeof obj.data === "object" ? obj.data : null;
3087
+ const candidates = [
3088
+ obj.html,
3089
+ obj.content,
3090
+ obj.body,
3091
+ nested?.content,
3092
+ nested?.html,
3093
+ nested?.body
3094
+ ];
3095
+ for (const candidate of candidates) {
3096
+ if (typeof candidate === "string" && candidate.trim().length > 0) {
3097
+ if (/<html[\s>]|<!doctype html|<head[\s>]|<body[\s>]|<div[\s>]/i.test(candidate)) {
3098
+ return candidate.trim();
3099
+ }
3100
+ }
3101
+ }
3102
+ return null;
3103
+ } catch {
3104
+ return null;
3105
+ }
3106
+ }
3051
3107
  function getByteLength(content) {
3052
3108
  return new TextEncoder().encode(content).byteLength;
3053
3109
  }
@@ -3102,17 +3158,71 @@ var SiteModifierHandler = class {
3102
3158
  originalHtml,
3103
3159
  "```"
3104
3160
  ].join("\n");
3105
- const aiResponse = await callAI({
3106
- provider,
3107
- model,
3108
- maxTokens,
3109
- apiKey,
3110
- signal: context.abortSignal,
3111
- messages: [
3112
- { role: "system", content: systemPrompt },
3113
- { role: "user", content: userPrompt }
3114
- ]
3115
- });
3161
+ let aiResponse = null;
3162
+ let lastError = null;
3163
+ const aiMessages = [
3164
+ { role: "system", content: systemPrompt },
3165
+ { role: "user", content: userPrompt }
3166
+ ];
3167
+ for (let attempt = 1; attempt <= AI_MAX_RETRIES; attempt++) {
3168
+ try {
3169
+ aiResponse = await callAI({
3170
+ provider,
3171
+ model,
3172
+ maxTokens,
3173
+ apiKey,
3174
+ signal: context.abortSignal,
3175
+ messages: aiMessages
3176
+ });
3177
+ if (aiResponse.truncated) {
3178
+ throw new Error(
3179
+ "AI output was truncated (hit token limit). The generated HTML is incomplete."
3180
+ );
3181
+ }
3182
+ break;
3183
+ } catch (err) {
3184
+ lastError = err instanceof Error ? err : new Error(String(err));
3185
+ console.error(
3186
+ `[site-modifier] ${model} failed (attempt ${attempt}/${AI_MAX_RETRIES}): ${lastError.message}`
3187
+ );
3188
+ if (provider === "google" && model !== GOOGLE_FALLBACK_MODEL) {
3189
+ try {
3190
+ console.log(
3191
+ `[site-modifier] falling back to ${GOOGLE_FALLBACK_MODEL} (attempt ${attempt}/${AI_MAX_RETRIES})`
3192
+ );
3193
+ aiResponse = await callAI({
3194
+ provider,
3195
+ model: GOOGLE_FALLBACK_MODEL,
3196
+ maxTokens,
3197
+ apiKey,
3198
+ signal: context.abortSignal,
3199
+ messages: aiMessages
3200
+ });
3201
+ if (aiResponse.truncated) {
3202
+ throw new Error(
3203
+ "AI output was truncated (hit token limit). The generated HTML is incomplete."
3204
+ );
3205
+ }
3206
+ break;
3207
+ } catch (fallbackErr) {
3208
+ lastError = fallbackErr instanceof Error ? fallbackErr : new Error(String(fallbackErr));
3209
+ console.error(
3210
+ `[site-modifier] ${GOOGLE_FALLBACK_MODEL} also failed (attempt ${attempt}/${AI_MAX_RETRIES}): ${lastError.message}`
3211
+ );
3212
+ }
3213
+ }
3214
+ }
3215
+ if (attempt < AI_MAX_RETRIES) {
3216
+ const delay = RETRY_DELAY_MS * attempt;
3217
+ console.log(`[site-modifier] retrying in ${delay}ms...`);
3218
+ await new Promise((r) => setTimeout(r, delay));
3219
+ }
3220
+ }
3221
+ if (!aiResponse) {
3222
+ throw new Error(
3223
+ `AI generation failed after ${AI_MAX_RETRIES} attempts. Please try again later. Last error: ${lastError?.message ?? "unknown"}`
3224
+ );
3225
+ }
3116
3226
  const modifiedHtml = extractHtmlFromText(aiResponse.content);
3117
3227
  if (!modifiedHtml) {
3118
3228
  throw new Error("AI response did not contain valid HTML output");
@@ -3164,7 +3274,9 @@ var SiteModifierHandler = class {
3164
3274
  async fetchHtmlWithTimeout(siteUrl, parentSignal) {
3165
3275
  const controller = new AbortController();
3166
3276
  const timeoutId = setTimeout(() => {
3167
- controller.abort(new Error(`Site fetch timed out after ${FETCH_TIMEOUT_MS}ms`));
3277
+ controller.abort(
3278
+ new Error(`Site fetch timed out after ${FETCH_TIMEOUT_MS}ms for ${siteUrl}`)
3279
+ );
3168
3280
  }, FETCH_TIMEOUT_MS);
3169
3281
  const parentAbort = () => controller.abort(parentSignal?.reason);
3170
3282
  if (parentSignal) {
@@ -3185,10 +3297,12 @@ var SiteModifierHandler = class {
3185
3297
  `Failed to fetch site HTML: ${response.status} ${response.statusText}`
3186
3298
  );
3187
3299
  }
3188
- const contentType = response.headers.get("content-type");
3189
- if (contentType && !isHtmlContentType(contentType)) {
3300
+ const contentType = response.headers.get("content-type") ?? "";
3301
+ const isHtml = !contentType || isHtmlContentType(contentType);
3302
+ const isJson = isJsonContentType(contentType);
3303
+ if (!isHtml && !isJson) {
3190
3304
  throw new Error(
3191
- `Fetched content is not HTML (content-type: ${contentType})`
3305
+ `Fetched content is not HTML or JSON (content-type: ${contentType}, url: ${siteUrl})`
3192
3306
  );
3193
3307
  }
3194
3308
  const contentLengthHeader = response.headers.get("content-length");
@@ -3206,9 +3320,18 @@ var SiteModifierHandler = class {
3206
3320
  `HTML too large (${htmlBuffer.byteLength} bytes). Limit is ${MAX_HTML_BYTES} bytes`
3207
3321
  );
3208
3322
  }
3209
- const html = new TextDecoder().decode(htmlBuffer).trim();
3323
+ let html = new TextDecoder().decode(htmlBuffer).trim();
3210
3324
  if (!html) {
3211
- throw new Error("Fetched HTML is empty");
3325
+ throw new Error("Fetched content is empty");
3326
+ }
3327
+ if (isJson) {
3328
+ const extracted = extractHtmlFromJson(html);
3329
+ if (!extracted) {
3330
+ throw new Error(
3331
+ `JSON response from ${siteUrl} does not contain extractable HTML content`
3332
+ );
3333
+ }
3334
+ html = extracted;
3212
3335
  }
3213
3336
  return html;
3214
3337
  } catch (error) {
@@ -3216,7 +3339,7 @@ var SiteModifierHandler = class {
3216
3339
  if (parentSignal?.aborted) {
3217
3340
  throw new Error("Site fetch aborted");
3218
3341
  }
3219
- throw new Error(`Site fetch timed out after ${FETCH_TIMEOUT_MS}ms`);
3342
+ throw new Error(`Site fetch timed out after ${FETCH_TIMEOUT_MS}ms for ${siteUrl}`);
3220
3343
  }
3221
3344
  throw error;
3222
3345
  } finally {
@@ -3783,6 +3906,7 @@ var HandlerProviderRuntime = class {
3783
3906
  try {
3784
3907
  await this.checkNewJobs();
3785
3908
  await this.checkInProgressJobs();
3909
+ await this.checkEvaluatedJobs();
3786
3910
  } catch (e) {
3787
3911
  this.onError?.(e instanceof Error ? e : new Error(String(e)));
3788
3912
  }
@@ -3930,6 +4054,23 @@ var HandlerProviderRuntime = class {
3930
4054
  }
3931
4055
  }
3932
4056
  }
4057
+ async checkEvaluatedJobs() {
4058
+ const evaluatedJobs = await this.indexer.getJobs({
4059
+ status: 4,
4060
+ agentId: Number(this.agentId)
4061
+ });
4062
+ for (const job of evaluatedJobs) {
4063
+ const settleKey = `settle:${job.jobId}`;
4064
+ if (!this.canProcess(settleKey)) continue;
4065
+ try {
4066
+ await settle(this.client, BigInt(job.jobId));
4067
+ console.log(`[handler-provider] auto-settled job ${job.jobId}`);
4068
+ this.markProcessed(settleKey);
4069
+ } catch (e) {
4070
+ this.markFailed(settleKey, e);
4071
+ }
4072
+ }
4073
+ }
3933
4074
  canProcess(key) {
3934
4075
  if (this.processedJobs.has(key)) return false;
3935
4076
  return (this.failedJobs.get(key) ?? 0) < this.maxRetries;
@@ -4802,6 +4943,528 @@ var erc8004ReputationAbi = [
4802
4943
  "anonymous": false
4803
4944
  }
4804
4945
  ];
4946
+
4947
+ // src/abis/BuyerRelay.ts
4948
+ var buyerRelayAbi = [
4949
+ {
4950
+ "type": "constructor",
4951
+ "inputs": [
4952
+ {
4953
+ "name": "owner_",
4954
+ "type": "address",
4955
+ "internalType": "address"
4956
+ },
4957
+ {
4958
+ "name": "identityRegistry_",
4959
+ "type": "address",
4960
+ "internalType": "address"
4961
+ },
4962
+ {
4963
+ "name": "pulseExtension_",
4964
+ "type": "address",
4965
+ "internalType": "address"
4966
+ },
4967
+ {
4968
+ "name": "jobEngine_",
4969
+ "type": "address",
4970
+ "internalType": "address"
4971
+ },
4972
+ {
4973
+ "name": "serviceMarketplace_",
4974
+ "type": "address",
4975
+ "internalType": "address"
4976
+ },
4977
+ {
4978
+ "name": "usdm_",
4979
+ "type": "address",
4980
+ "internalType": "address"
4981
+ }
4982
+ ],
4983
+ "stateMutability": "nonpayable"
4984
+ },
4985
+ {
4986
+ "type": "function",
4987
+ "name": "buyerAgentId",
4988
+ "inputs": [],
4989
+ "outputs": [
4990
+ {
4991
+ "name": "",
4992
+ "type": "uint256",
4993
+ "internalType": "uint256"
4994
+ }
4995
+ ],
4996
+ "stateMutability": "view"
4997
+ },
4998
+ {
4999
+ "type": "function",
5000
+ "name": "cancelFor",
5001
+ "inputs": [
5002
+ {
5003
+ "name": "jobId",
5004
+ "type": "uint256",
5005
+ "internalType": "uint256"
5006
+ }
5007
+ ],
5008
+ "outputs": [],
5009
+ "stateMutability": "nonpayable"
5010
+ },
5011
+ {
5012
+ "type": "function",
5013
+ "name": "claimRefund",
5014
+ "inputs": [
5015
+ {
5016
+ "name": "jobId",
5017
+ "type": "uint256",
5018
+ "internalType": "uint256"
5019
+ }
5020
+ ],
5021
+ "outputs": [],
5022
+ "stateMutability": "nonpayable"
5023
+ },
5024
+ {
5025
+ "type": "function",
5026
+ "name": "createJobFor",
5027
+ "inputs": [
5028
+ {
5029
+ "name": "offeringId",
5030
+ "type": "uint256",
5031
+ "internalType": "uint256"
5032
+ },
5033
+ {
5034
+ "name": "termsHash",
5035
+ "type": "bytes32",
5036
+ "internalType": "bytes32"
5037
+ },
5038
+ {
5039
+ "name": "maxPrice",
5040
+ "type": "uint256",
5041
+ "internalType": "uint256"
5042
+ }
5043
+ ],
5044
+ "outputs": [
5045
+ {
5046
+ "name": "jobId",
5047
+ "type": "uint256",
5048
+ "internalType": "uint256"
5049
+ }
5050
+ ],
5051
+ "stateMutability": "nonpayable"
5052
+ },
5053
+ {
5054
+ "type": "function",
5055
+ "name": "evaluateFor",
5056
+ "inputs": [
5057
+ {
5058
+ "name": "jobId",
5059
+ "type": "uint256",
5060
+ "internalType": "uint256"
5061
+ },
5062
+ {
5063
+ "name": "approved",
5064
+ "type": "bool",
5065
+ "internalType": "bool"
5066
+ },
5067
+ {
5068
+ "name": "feedback",
5069
+ "type": "string",
5070
+ "internalType": "string"
5071
+ }
5072
+ ],
5073
+ "outputs": [],
5074
+ "stateMutability": "nonpayable"
5075
+ },
5076
+ {
5077
+ "type": "function",
5078
+ "name": "identityRegistry",
5079
+ "inputs": [],
5080
+ "outputs": [
5081
+ {
5082
+ "name": "",
5083
+ "type": "address",
5084
+ "internalType": "contract IERC8004Identity"
5085
+ }
5086
+ ],
5087
+ "stateMutability": "view"
5088
+ },
5089
+ {
5090
+ "type": "function",
5091
+ "name": "jobDeposit",
5092
+ "inputs": [
5093
+ {
5094
+ "name": "",
5095
+ "type": "uint256",
5096
+ "internalType": "uint256"
5097
+ }
5098
+ ],
5099
+ "outputs": [
5100
+ {
5101
+ "name": "",
5102
+ "type": "uint256",
5103
+ "internalType": "uint256"
5104
+ }
5105
+ ],
5106
+ "stateMutability": "view"
5107
+ },
5108
+ {
5109
+ "type": "function",
5110
+ "name": "jobEngine",
5111
+ "inputs": [],
5112
+ "outputs": [
5113
+ {
5114
+ "name": "",
5115
+ "type": "address",
5116
+ "internalType": "contract IJobEngine"
5117
+ }
5118
+ ],
5119
+ "stateMutability": "view"
5120
+ },
5121
+ {
5122
+ "type": "function",
5123
+ "name": "jobPayer",
5124
+ "inputs": [
5125
+ {
5126
+ "name": "",
5127
+ "type": "uint256",
5128
+ "internalType": "uint256"
5129
+ }
5130
+ ],
5131
+ "outputs": [
5132
+ {
5133
+ "name": "",
5134
+ "type": "address",
5135
+ "internalType": "address"
5136
+ }
5137
+ ],
5138
+ "stateMutability": "view"
5139
+ },
5140
+ {
5141
+ "type": "function",
5142
+ "name": "jobRefundState",
5143
+ "inputs": [
5144
+ {
5145
+ "name": "",
5146
+ "type": "uint256",
5147
+ "internalType": "uint256"
5148
+ }
5149
+ ],
5150
+ "outputs": [
5151
+ {
5152
+ "name": "",
5153
+ "type": "uint8",
5154
+ "internalType": "enum IBuyerRelay.RefundState"
5155
+ }
5156
+ ],
5157
+ "stateMutability": "view"
5158
+ },
5159
+ {
5160
+ "type": "function",
5161
+ "name": "onERC721Received",
5162
+ "inputs": [
5163
+ {
5164
+ "name": "",
5165
+ "type": "address",
5166
+ "internalType": "address"
5167
+ },
5168
+ {
5169
+ "name": "",
5170
+ "type": "address",
5171
+ "internalType": "address"
5172
+ },
5173
+ {
5174
+ "name": "",
5175
+ "type": "uint256",
5176
+ "internalType": "uint256"
5177
+ },
5178
+ {
5179
+ "name": "",
5180
+ "type": "bytes",
5181
+ "internalType": "bytes"
5182
+ }
5183
+ ],
5184
+ "outputs": [
5185
+ {
5186
+ "name": "",
5187
+ "type": "bytes4",
5188
+ "internalType": "bytes4"
5189
+ }
5190
+ ],
5191
+ "stateMutability": "pure"
5192
+ },
5193
+ {
5194
+ "type": "function",
5195
+ "name": "owner",
5196
+ "inputs": [],
5197
+ "outputs": [
5198
+ {
5199
+ "name": "",
5200
+ "type": "address",
5201
+ "internalType": "address"
5202
+ }
5203
+ ],
5204
+ "stateMutability": "view"
5205
+ },
5206
+ {
5207
+ "type": "function",
5208
+ "name": "pulseExtension",
5209
+ "inputs": [],
5210
+ "outputs": [
5211
+ {
5212
+ "name": "",
5213
+ "type": "address",
5214
+ "internalType": "contract IPulseExtension"
5215
+ }
5216
+ ],
5217
+ "stateMutability": "view"
5218
+ },
5219
+ {
5220
+ "type": "function",
5221
+ "name": "renounceOwnership",
5222
+ "inputs": [],
5223
+ "outputs": [],
5224
+ "stateMutability": "nonpayable"
5225
+ },
5226
+ {
5227
+ "type": "function",
5228
+ "name": "serviceMarketplace",
5229
+ "inputs": [],
5230
+ "outputs": [
5231
+ {
5232
+ "name": "",
5233
+ "type": "address",
5234
+ "internalType": "contract IServiceMarketplace"
5235
+ }
5236
+ ],
5237
+ "stateMutability": "view"
5238
+ },
5239
+ {
5240
+ "type": "function",
5241
+ "name": "setup",
5242
+ "inputs": [
5243
+ {
5244
+ "name": "agentURI",
5245
+ "type": "string",
5246
+ "internalType": "string"
5247
+ }
5248
+ ],
5249
+ "outputs": [],
5250
+ "stateMutability": "nonpayable"
5251
+ },
5252
+ {
5253
+ "type": "function",
5254
+ "name": "transferOwnership",
5255
+ "inputs": [
5256
+ {
5257
+ "name": "newOwner",
5258
+ "type": "address",
5259
+ "internalType": "address"
5260
+ }
5261
+ ],
5262
+ "outputs": [],
5263
+ "stateMutability": "nonpayable"
5264
+ },
5265
+ {
5266
+ "type": "function",
5267
+ "name": "usdm",
5268
+ "inputs": [],
5269
+ "outputs": [
5270
+ {
5271
+ "name": "",
5272
+ "type": "address",
5273
+ "internalType": "address"
5274
+ }
5275
+ ],
5276
+ "stateMutability": "view"
5277
+ },
5278
+ {
5279
+ "type": "event",
5280
+ "name": "EvaluatedFor",
5281
+ "inputs": [
5282
+ {
5283
+ "name": "jobId",
5284
+ "type": "uint256",
5285
+ "indexed": true,
5286
+ "internalType": "uint256"
5287
+ },
5288
+ {
5289
+ "name": "payer",
5290
+ "type": "address",
5291
+ "indexed": true,
5292
+ "internalType": "address"
5293
+ },
5294
+ {
5295
+ "name": "approved",
5296
+ "type": "bool",
5297
+ "indexed": false,
5298
+ "internalType": "bool"
5299
+ }
5300
+ ],
5301
+ "anonymous": false
5302
+ },
5303
+ {
5304
+ "type": "event",
5305
+ "name": "JobCreatedFor",
5306
+ "inputs": [
5307
+ {
5308
+ "name": "jobId",
5309
+ "type": "uint256",
5310
+ "indexed": true,
5311
+ "internalType": "uint256"
5312
+ },
5313
+ {
5314
+ "name": "payer",
5315
+ "type": "address",
5316
+ "indexed": true,
5317
+ "internalType": "address"
5318
+ },
5319
+ {
5320
+ "name": "price",
5321
+ "type": "uint256",
5322
+ "indexed": false,
5323
+ "internalType": "uint256"
5324
+ }
5325
+ ],
5326
+ "anonymous": false
5327
+ },
5328
+ {
5329
+ "type": "event",
5330
+ "name": "OwnershipTransferred",
5331
+ "inputs": [
5332
+ {
5333
+ "name": "previousOwner",
5334
+ "type": "address",
5335
+ "indexed": true,
5336
+ "internalType": "address"
5337
+ },
5338
+ {
5339
+ "name": "newOwner",
5340
+ "type": "address",
5341
+ "indexed": true,
5342
+ "internalType": "address"
5343
+ }
5344
+ ],
5345
+ "anonymous": false
5346
+ },
5347
+ {
5348
+ "type": "event",
5349
+ "name": "RefundClaimed",
5350
+ "inputs": [
5351
+ {
5352
+ "name": "jobId",
5353
+ "type": "uint256",
5354
+ "indexed": true,
5355
+ "internalType": "uint256"
5356
+ },
5357
+ {
5358
+ "name": "payer",
5359
+ "type": "address",
5360
+ "indexed": true,
5361
+ "internalType": "address"
5362
+ },
5363
+ {
5364
+ "name": "amount",
5365
+ "type": "uint256",
5366
+ "indexed": false,
5367
+ "internalType": "uint256"
5368
+ }
5369
+ ],
5370
+ "anonymous": false
5371
+ },
5372
+ {
5373
+ "type": "error",
5374
+ "name": "AgentAlreadyInitialized",
5375
+ "inputs": []
5376
+ },
5377
+ {
5378
+ "type": "error",
5379
+ "name": "AgentNotActive",
5380
+ "inputs": []
5381
+ },
5382
+ {
5383
+ "type": "error",
5384
+ "name": "InsufficientPayment",
5385
+ "inputs": [
5386
+ {
5387
+ "name": "required",
5388
+ "type": "uint256",
5389
+ "internalType": "uint256"
5390
+ },
5391
+ {
5392
+ "name": "provided",
5393
+ "type": "uint256",
5394
+ "internalType": "uint256"
5395
+ }
5396
+ ]
5397
+ },
5398
+ {
5399
+ "type": "error",
5400
+ "name": "InvalidJobStatus",
5401
+ "inputs": [
5402
+ {
5403
+ "name": "current",
5404
+ "type": "uint8",
5405
+ "internalType": "enum DataTypes.JobStatus"
5406
+ },
5407
+ {
5408
+ "name": "expected",
5409
+ "type": "uint8",
5410
+ "internalType": "enum DataTypes.JobStatus"
5411
+ }
5412
+ ]
5413
+ },
5414
+ {
5415
+ "type": "error",
5416
+ "name": "InvalidRefundState",
5417
+ "inputs": [
5418
+ {
5419
+ "name": "current",
5420
+ "type": "uint8",
5421
+ "internalType": "enum IBuyerRelay.RefundState"
5422
+ },
5423
+ {
5424
+ "name": "expected",
5425
+ "type": "uint8",
5426
+ "internalType": "enum IBuyerRelay.RefundState"
5427
+ }
5428
+ ]
5429
+ },
5430
+ {
5431
+ "type": "error",
5432
+ "name": "OnlyBuyer",
5433
+ "inputs": []
5434
+ },
5435
+ {
5436
+ "type": "error",
5437
+ "name": "OwnableInvalidOwner",
5438
+ "inputs": [
5439
+ {
5440
+ "name": "owner",
5441
+ "type": "address",
5442
+ "internalType": "address"
5443
+ }
5444
+ ]
5445
+ },
5446
+ {
5447
+ "type": "error",
5448
+ "name": "OwnableUnauthorizedAccount",
5449
+ "inputs": [
5450
+ {
5451
+ "name": "account",
5452
+ "type": "address",
5453
+ "internalType": "address"
5454
+ }
5455
+ ]
5456
+ },
5457
+ {
5458
+ "type": "error",
5459
+ "name": "Reentrancy",
5460
+ "inputs": []
5461
+ },
5462
+ {
5463
+ "type": "error",
5464
+ "name": "ZeroAddress",
5465
+ "inputs": []
5466
+ }
5467
+ ];
4805
5468
  export {
4806
5469
  ACCEPT_TIMEOUT,
4807
5470
  BPS_DENOMINATOR,
@@ -4815,6 +5478,7 @@ export {
4815
5478
  JobStatus,
4816
5479
  MAINNET_ADDRESSES,
4817
5480
  MEMO_TYPES,
5481
+ PLATFORM_BUYER_AGENT_ID,
4818
5482
  PULSE_DOMAIN,
4819
5483
  ProviderRuntime,
4820
5484
  RISK_POOL_BPS,
@@ -4825,6 +5489,7 @@ export {
4825
5489
  USDM_MAINNET,
4826
5490
  acceptJob,
4827
5491
  activateOffering,
5492
+ buyerRelayAbi,
4828
5493
  callAI,
4829
5494
  cancelJob,
4830
5495
  createAgentCard,