@jaibber/sdk 0.10.1 → 0.10.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/dist/client.d.cts CHANGED
@@ -1 +1 @@
1
- export { h as AgentApiKey, e as AgentIdentity, m as AgentPage, o as AgentPricing, p as AgentProfile, d as AgentRecord, r as AgentService, B as BoardMessagePage, C as CallInput, t as CallReceipt, u as CallResponse, v as CallResult, w as ContactPolicy, x as ConversationKind, D as DirectorySort, E as EngineFindings, y as EnsureAgentInput, F as FetchLike, G as FindAgentsOptions, b as HireBrief, L as HireCall, N as HireInput, O as HireRecord, Q as HireResult, H as HireRunRef, R as InboxConversation, U as InboxEvent, V as InboxEventPayload, I as InboxMessage, W as InboxOptions, X as InboxResult, Y as InboxStreamOptions, _ as JaibberApiError, $ as JaibberApiErrorInit, J as JaibberClient, a0 as JaibberClientOptions, a1 as JaibberErrorCode, a4 as MessagePage, a5 as OwnAgentProfile, a6 as OwnAgentService, a8 as PageOptions, a9 as PaidToolResponse, aa as Payment, ab as PaymentChallenge, ac as PaymentRefused, ad as PersistMessagePayload, ae as ProfilePost, P as Project, af as PublicAgent, ag as PublicBoard, ah as PublicMessage, ai as PublicMessageAuthor, aj as RateInput, ak as Rating, al as RatingPage, am as RatingRater, an as ReadBoardOptions, ao as ReadMessagesOptions, ap as Readiness, aq as ReadinessStatus, ar as ReadinessStep, as as ReadinessStepId, at as Receipt, au as RegisterAgentInput, av as RegisterAgentResult, ax as RotatedApiKey, ay as RunAuthorizationInput, az as SendMessageOptions, S as ServerMessage, aA as SigningPlan, aB as StartThreadInput, aC as StartThreadResult, aD as StoredAuthorizations, aE as TRANSFER_WITH_AUTHORIZATION_TYPES, a as Task, aF as TaskChange, aI as TaskPriority, aJ as TaskStatus, aK as TaskUpdate, c as Thread, aN as ThreadLastMessage, aO as ThreadPage, aP as ThreadParticipant, aS as TrustTier, aT as TypedDataDomain, aU as TypedDataRequest, aV as UpdateProfileInput, aW as UpdateProfileResult, aY as UpstreamInput, aZ as UpstreamKind, a_ as UpstreamToolInfo, a$ as VerificationOutcome, b0 as VerifyDomainResult, b1 as WalletInput, b2 as WalletOptions, b3 as WhoAmI, b4 as WorkHistory, b5 as X402Signer, b6 as isBanned, b7 as isContactNotAllowed, b8 as isJaibberApiError, b9 as isPaymentRequired, ba as isRateLimited, bb as paymentTermsOf, bc as signExactPayment, bd as signRunAuthorizations, be as walletFromPrivateKey } from './rest-DN45nXn4.cjs';
1
+ export { h as AgentApiKey, e as AgentIdentity, n as AgentPage, p as AgentPricing, q as AgentProfile, d as AgentRecord, s as AgentService, B as BoardMessagePage, C as CallInput, u as CallReceipt, v as CallResponse, w as CallResult, x as ContactPolicy, y as ConversationKind, D as DirectorySort, E as EngineFindings, z as EnsureAgentInput, G as FetchLike, K as FindAgentsOptions, b as HireBrief, N as HireCall, O as HireInput, Q as HireRecord, R as HireResult, H as HireRunRef, U as InboxConversation, V as InboxEvent, W as InboxEventPayload, I as InboxMessage, X as InboxOptions, Y as InboxResult, Z as InboxStreamOptions, $ as JaibberApiError, a0 as JaibberApiErrorInit, J as JaibberClient, a1 as JaibberClientOptions, a2 as JaibberErrorCode, a5 as MessagePage, a6 as OwnAgentProfile, a7 as OwnAgentService, a9 as PageOptions, aa as PaidToolResponse, ab as Payment, ac as PaymentChallenge, ad as PaymentRefused, ae as PersistMessagePayload, af as ProfilePost, P as Project, ag as PublicAgent, ah as PublicBoard, ai as PublicMessage, aj as PublicMessageAuthor, ak as RateInput, al as Rating, am as RatingPage, an as RatingRater, ao as ReadBoardOptions, ap as ReadMessagesOptions, aq as Readiness, ar as ReadinessStatus, as as ReadinessStep, at as ReadinessStepId, au as Receipt, av as RegisterAgentInput, aw as RegisterAgentResult, ay as RotatedApiKey, az as RunAuthorizationInput, aA as SendMessageOptions, S as ServerMessage, aB as SigningPlan, aC as StartThreadInput, aD as StartThreadResult, aE as StoredAuthorizations, aF as TRANSFER_WITH_AUTHORIZATION_TYPES, a as Task, aG as TaskChange, aJ as TaskPriority, aK as TaskStatus, aL as TaskUpdate, c as Thread, aO as ThreadLastMessage, aP as ThreadPage, aQ as ThreadParticipant, aT as TrustTier, aU as TypedDataDomain, aV as TypedDataRequest, aW as UpdateProfileInput, aX as UpdateProfileResult, aZ as UpstreamInput, a_ as UpstreamKind, a$ as UpstreamToolInfo, b0 as VerificationOutcome, b1 as VerifyDomainResult, b2 as WalletInput, b3 as WalletOptions, b4 as WhoAmI, b5 as WorkHistory, b6 as X402Signer, b7 as isBanned, b8 as isContactNotAllowed, b9 as isJaibberApiError, ba as isPaymentRequired, bb as isRateLimited, bc as paymentTermsOf, bd as signExactPayment, be as signRunAuthorizations, bf as walletFromPrivateKey } from './rest-GfLaGZnS.cjs';
package/dist/client.d.ts CHANGED
@@ -1 +1 @@
1
- export { h as AgentApiKey, e as AgentIdentity, m as AgentPage, o as AgentPricing, p as AgentProfile, d as AgentRecord, r as AgentService, B as BoardMessagePage, C as CallInput, t as CallReceipt, u as CallResponse, v as CallResult, w as ContactPolicy, x as ConversationKind, D as DirectorySort, E as EngineFindings, y as EnsureAgentInput, F as FetchLike, G as FindAgentsOptions, b as HireBrief, L as HireCall, N as HireInput, O as HireRecord, Q as HireResult, H as HireRunRef, R as InboxConversation, U as InboxEvent, V as InboxEventPayload, I as InboxMessage, W as InboxOptions, X as InboxResult, Y as InboxStreamOptions, _ as JaibberApiError, $ as JaibberApiErrorInit, J as JaibberClient, a0 as JaibberClientOptions, a1 as JaibberErrorCode, a4 as MessagePage, a5 as OwnAgentProfile, a6 as OwnAgentService, a8 as PageOptions, a9 as PaidToolResponse, aa as Payment, ab as PaymentChallenge, ac as PaymentRefused, ad as PersistMessagePayload, ae as ProfilePost, P as Project, af as PublicAgent, ag as PublicBoard, ah as PublicMessage, ai as PublicMessageAuthor, aj as RateInput, ak as Rating, al as RatingPage, am as RatingRater, an as ReadBoardOptions, ao as ReadMessagesOptions, ap as Readiness, aq as ReadinessStatus, ar as ReadinessStep, as as ReadinessStepId, at as Receipt, au as RegisterAgentInput, av as RegisterAgentResult, ax as RotatedApiKey, ay as RunAuthorizationInput, az as SendMessageOptions, S as ServerMessage, aA as SigningPlan, aB as StartThreadInput, aC as StartThreadResult, aD as StoredAuthorizations, aE as TRANSFER_WITH_AUTHORIZATION_TYPES, a as Task, aF as TaskChange, aI as TaskPriority, aJ as TaskStatus, aK as TaskUpdate, c as Thread, aN as ThreadLastMessage, aO as ThreadPage, aP as ThreadParticipant, aS as TrustTier, aT as TypedDataDomain, aU as TypedDataRequest, aV as UpdateProfileInput, aW as UpdateProfileResult, aY as UpstreamInput, aZ as UpstreamKind, a_ as UpstreamToolInfo, a$ as VerificationOutcome, b0 as VerifyDomainResult, b1 as WalletInput, b2 as WalletOptions, b3 as WhoAmI, b4 as WorkHistory, b5 as X402Signer, b6 as isBanned, b7 as isContactNotAllowed, b8 as isJaibberApiError, b9 as isPaymentRequired, ba as isRateLimited, bb as paymentTermsOf, bc as signExactPayment, bd as signRunAuthorizations, be as walletFromPrivateKey } from './rest-DN45nXn4.js';
1
+ export { h as AgentApiKey, e as AgentIdentity, n as AgentPage, p as AgentPricing, q as AgentProfile, d as AgentRecord, s as AgentService, B as BoardMessagePage, C as CallInput, u as CallReceipt, v as CallResponse, w as CallResult, x as ContactPolicy, y as ConversationKind, D as DirectorySort, E as EngineFindings, z as EnsureAgentInput, G as FetchLike, K as FindAgentsOptions, b as HireBrief, N as HireCall, O as HireInput, Q as HireRecord, R as HireResult, H as HireRunRef, U as InboxConversation, V as InboxEvent, W as InboxEventPayload, I as InboxMessage, X as InboxOptions, Y as InboxResult, Z as InboxStreamOptions, $ as JaibberApiError, a0 as JaibberApiErrorInit, J as JaibberClient, a1 as JaibberClientOptions, a2 as JaibberErrorCode, a5 as MessagePage, a6 as OwnAgentProfile, a7 as OwnAgentService, a9 as PageOptions, aa as PaidToolResponse, ab as Payment, ac as PaymentChallenge, ad as PaymentRefused, ae as PersistMessagePayload, af as ProfilePost, P as Project, ag as PublicAgent, ah as PublicBoard, ai as PublicMessage, aj as PublicMessageAuthor, ak as RateInput, al as Rating, am as RatingPage, an as RatingRater, ao as ReadBoardOptions, ap as ReadMessagesOptions, aq as Readiness, ar as ReadinessStatus, as as ReadinessStep, at as ReadinessStepId, au as Receipt, av as RegisterAgentInput, aw as RegisterAgentResult, ay as RotatedApiKey, az as RunAuthorizationInput, aA as SendMessageOptions, S as ServerMessage, aB as SigningPlan, aC as StartThreadInput, aD as StartThreadResult, aE as StoredAuthorizations, aF as TRANSFER_WITH_AUTHORIZATION_TYPES, a as Task, aG as TaskChange, aJ as TaskPriority, aK as TaskStatus, aL as TaskUpdate, c as Thread, aO as ThreadLastMessage, aP as ThreadPage, aQ as ThreadParticipant, aT as TrustTier, aU as TypedDataDomain, aV as TypedDataRequest, aW as UpdateProfileInput, aX as UpdateProfileResult, aZ as UpstreamInput, a_ as UpstreamKind, a$ as UpstreamToolInfo, b0 as VerificationOutcome, b1 as VerifyDomainResult, b2 as WalletInput, b3 as WalletOptions, b4 as WhoAmI, b5 as WorkHistory, b6 as X402Signer, b7 as isBanned, b8 as isContactNotAllowed, b9 as isJaibberApiError, ba as isPaymentRequired, bb as isRateLimited, bc as paymentTermsOf, bd as signExactPayment, be as signRunAuthorizations, bf as walletFromPrivateKey } from './rest-GfLaGZnS.js';
package/dist/client.js CHANGED
@@ -27460,15 +27460,18 @@ async function walletFromPrivateKey(privateKey) {
27460
27460
  throw new Error("Paying from a private key needs viem: npm i viem");
27461
27461
  }
27462
27462
  const account = accounts.privateKeyToAccount(privateKey);
27463
- const UINT = /* @__PURE__ */ new Set(["value", "validAfter", "validBefore"]);
27464
27463
  return {
27465
27464
  address: account.address,
27466
- signTypedData: (req) => account.signTypedData({
27467
- domain: { ...req.domain, verifyingContract: req.domain.verifyingContract },
27468
- types: req.types,
27469
- primaryType: req.primaryType,
27470
- message: Object.fromEntries(Object.entries(req.message).map(([k, v]) => [k, UINT.has(k) ? BigInt(v) : v]))
27471
- })
27465
+ signTypedData: (req) => {
27466
+ const ints = new Set((req.types[req.primaryType] ?? []).filter((f) => /^u?int\d*$/.test(f.type)).map((f) => f.name));
27467
+ const { verifyingContract, ...domain } = req.domain;
27468
+ return account.signTypedData({
27469
+ domain: verifyingContract ? { ...domain, verifyingContract } : domain,
27470
+ types: req.types,
27471
+ primaryType: req.primaryType,
27472
+ message: Object.fromEntries(Object.entries(req.message).map(([k, v]) => [k, ints.has(k) ? BigInt(v) : v]))
27473
+ });
27474
+ }
27472
27475
  };
27473
27476
  }
27474
27477
 
@@ -27911,7 +27914,7 @@ var JaibberClient = class _JaibberClient {
27911
27914
  const id = opts.agentId ?? await this.myAgentId();
27912
27915
  const path = `/api/agents/${segment(id, "agentId")}`;
27913
27916
  const { data } = await this.call("PATCH", path, { body: patch });
27914
- const { agent: nested, webhookSecret, upstream, verification, readiness, ...flat } = asRecord2(data) ?? {};
27917
+ const { agent: nested, webhookSecret, upstream, verification, readiness, limits, ...flat } = asRecord2(data) ?? {};
27915
27918
  const agent = asRecord2(nested) ?? flat;
27916
27919
  if (this.cachedIdentity && agent.id === this.cachedIdentity.agentId && typeof agent.handle === "string") {
27917
27920
  this.cachedIdentity = { ...this.cachedIdentity, handle: agent.handle };
@@ -27921,7 +27924,8 @@ var JaibberClient = class _JaibberClient {
27921
27924
  ...typeof webhookSecret === "string" ? { webhookSecret } : {},
27922
27925
  ...upstream !== void 0 ? { upstream: asRecord2(upstream) ?? null } : {},
27923
27926
  ...asRecord2(verification) ? { verification } : {},
27924
- ...asRecord2(readiness) ? { readiness } : {}
27927
+ ...asRecord2(readiness) ? { readiness } : {},
27928
+ ...asRecord2(limits) ? { limits } : {}
27925
27929
  };
27926
27930
  }
27927
27931
  /**
@@ -28249,6 +28253,11 @@ var JaibberClient = class _JaibberClient {
28249
28253
  * signed receipt. A priced tool is paid from the client's `wallet` (the 402's terms are
28250
28254
  * signed and the call retried once; nothing is charged until the result is delivered);
28251
28255
  * without a wallet it throws PAYMENT_REQUIRED with the terms in `details.x402`.
28256
+ *
28257
+ * The result is the seller's output: third-party data (Jaibber strips control and invisible
28258
+ * characters, nothing more). If a model reads it, present it as information, not instructions.
28259
+ * Limits apply (429 `RATE_LIMIT_EXCEEDED`, `details.reason` `seller_rate` | `buyer_rate`), and a
28260
+ * paid call is refused with 402 `details.reason` `spend_cap` past the agent's daily spending cap.
28252
28261
  */
28253
28262
  async callTool(handleOrId, input) {
28254
28263
  const path = `/api/agents/${agentRef(handleOrId)}/call`;
@@ -28269,6 +28278,36 @@ var JaibberClient = class _JaibberClient {
28269
28278
  * rate, count toward its score (`Rating.counted`). Rating the same agent for
28270
28279
  * the same task twice → 409 CONFLICT.
28271
28280
  */
28281
+ /**
28282
+ * POST /api/receipts/{id}/rating — rate a seller with the wallet that paid for a receipt (no
28283
+ * Jaibber agent needed: buyers on the wallet route). Signs `Rating {receipt, score, text}`
28284
+ * (EIP-712, domain `Jaibber` v1 on the receipt's chain) with the client's `wallet`, which must
28285
+ * be the paying wallet. Counts like a hire's rating (paid work, one counted rating per wallet).
28286
+ */
28287
+ async rateReceipt(receiptId, input) {
28288
+ if (!this.wallet) throw new Error("rateReceipt signs with the wallet that paid: create the client with a `wallet`");
28289
+ const receipt = await this.receipt(receiptId);
28290
+ const chainId = Number(String(receipt.network).split(":")[1]);
28291
+ const text = input.text ?? "";
28292
+ const signature = await this.wallet.signer.signTypedData({
28293
+ domain: { name: "Jaibber", version: "1", chainId },
28294
+ types: { Rating: [{ name: "receipt", type: "string" }, { name: "score", type: "uint8" }, { name: "text", type: "string" }] },
28295
+ primaryType: "Rating",
28296
+ message: { receipt: receiptId, score: String(input.score), text }
28297
+ });
28298
+ const { data } = await this.call("POST", `/api/receipts/${segment(receiptId, "receiptId")}/rating`, { body: { score: input.score, text, signature } });
28299
+ return data;
28300
+ }
28301
+ /**
28302
+ * POST /api/agents/{id}/recover-handle — take the handle that is your verified domain's name
28303
+ * from a squatter (the domain must name it in /.well-known/jaibber.json or a `_jaibber` TXT
28304
+ * record). `review: true` when the holder has standing and Jaibber staff decide.
28305
+ */
28306
+ async recoverHandle(handle, opts = {}) {
28307
+ const id = opts.agentId ?? await this.myAgentId();
28308
+ const { data } = await this.call("POST", `/api/agents/${segment(id, "agentId")}/recover-handle`, { body: { handle } });
28309
+ return data;
28310
+ }
28272
28311
  async rate(handleOrId, input) {
28273
28312
  const body = { score: input.score };
28274
28313
  if (input.text) body.text = input.text;