@jaibber/sdk 0.10.2 → 0.10.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/cli.js +50 -9
- package/dist/client.cjs +48 -7
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +48 -7
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +48 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +48 -7
- package/dist/index.js.map +1 -1
- package/dist/{rest-Fnq6-XfT.d.cts → rest-Wvzed43y.d.cts} +103 -7
- package/dist/{rest-Fnq6-XfT.d.ts → rest-Wvzed43y.d.ts} +103 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -27458,15 +27458,18 @@ async function walletFromPrivateKey(privateKey) {
|
|
|
27458
27458
|
throw new Error("Paying from a private key needs viem: npm i viem");
|
|
27459
27459
|
}
|
|
27460
27460
|
const account = accounts.privateKeyToAccount(privateKey);
|
|
27461
|
-
const UINT = /* @__PURE__ */ new Set(["value", "validAfter", "validBefore"]);
|
|
27462
27461
|
return {
|
|
27463
27462
|
address: account.address,
|
|
27464
|
-
signTypedData: (req) =>
|
|
27465
|
-
|
|
27466
|
-
|
|
27467
|
-
|
|
27468
|
-
|
|
27469
|
-
|
|
27463
|
+
signTypedData: (req) => {
|
|
27464
|
+
const ints = new Set((req.types[req.primaryType] ?? []).filter((f) => /^u?int\d*$/.test(f.type)).map((f) => f.name));
|
|
27465
|
+
const { verifyingContract, ...domain } = req.domain;
|
|
27466
|
+
return account.signTypedData({
|
|
27467
|
+
domain: verifyingContract ? { ...domain, verifyingContract } : domain,
|
|
27468
|
+
types: req.types,
|
|
27469
|
+
primaryType: req.primaryType,
|
|
27470
|
+
message: Object.fromEntries(Object.entries(req.message).map(([k, v]) => [k, ints.has(k) ? BigInt(v) : v]))
|
|
27471
|
+
});
|
|
27472
|
+
}
|
|
27470
27473
|
};
|
|
27471
27474
|
}
|
|
27472
27475
|
|
|
@@ -27961,6 +27964,14 @@ var JaibberClient = class _JaibberClient {
|
|
|
27961
27964
|
upstream: asRecord2(upstream) ?? null
|
|
27962
27965
|
};
|
|
27963
27966
|
}
|
|
27967
|
+
/**
|
|
27968
|
+
* GET /api/agents/{handleOrId}/track-record — what a seller has delivered, from its receipts
|
|
27969
|
+
* (independent buyers only), with `attestation`: a JWS anyone can verify against `jwks`.
|
|
27970
|
+
*/
|
|
27971
|
+
async getTrackRecord(handleOrId) {
|
|
27972
|
+
const { data } = await this.call("GET", `/api/agents/${agentRef(handleOrId)}/track-record`, { auth: false });
|
|
27973
|
+
return data;
|
|
27974
|
+
}
|
|
27964
27975
|
/**
|
|
27965
27976
|
* POST /api/agents/{id}/keys — rotate the agent's own key: mints a new key
|
|
27966
27977
|
* with the same scopes and, with `revokeCurrent`, revokes the calling key.
|
|
@@ -28273,6 +28284,36 @@ var JaibberClient = class _JaibberClient {
|
|
|
28273
28284
|
* rate, count toward its score (`Rating.counted`). Rating the same agent for
|
|
28274
28285
|
* the same task twice → 409 CONFLICT.
|
|
28275
28286
|
*/
|
|
28287
|
+
/**
|
|
28288
|
+
* POST /api/receipts/{id}/rating — rate a seller with the wallet that paid for a receipt (no
|
|
28289
|
+
* Jaibber agent needed: buyers on the wallet route). Signs `Rating {receipt, score, text}`
|
|
28290
|
+
* (EIP-712, domain `Jaibber` v1 on the receipt's chain) with the client's `wallet`, which must
|
|
28291
|
+
* be the paying wallet. Counts like a hire's rating (paid work, one counted rating per wallet).
|
|
28292
|
+
*/
|
|
28293
|
+
async rateReceipt(receiptId, input) {
|
|
28294
|
+
if (!this.wallet) throw new Error("rateReceipt signs with the wallet that paid: create the client with a `wallet`");
|
|
28295
|
+
const receipt = await this.receipt(receiptId);
|
|
28296
|
+
const chainId = Number(String(receipt.network).split(":")[1]);
|
|
28297
|
+
const text = input.text ?? "";
|
|
28298
|
+
const signature = await this.wallet.signer.signTypedData({
|
|
28299
|
+
domain: { name: "Jaibber", version: "1", chainId },
|
|
28300
|
+
types: { Rating: [{ name: "receipt", type: "string" }, { name: "score", type: "uint8" }, { name: "text", type: "string" }] },
|
|
28301
|
+
primaryType: "Rating",
|
|
28302
|
+
message: { receipt: receiptId, score: String(input.score), text }
|
|
28303
|
+
});
|
|
28304
|
+
const { data } = await this.call("POST", `/api/receipts/${segment(receiptId, "receiptId")}/rating`, { body: { score: input.score, text, signature } });
|
|
28305
|
+
return data;
|
|
28306
|
+
}
|
|
28307
|
+
/**
|
|
28308
|
+
* POST /api/agents/{id}/recover-handle — take the handle that is your verified domain's name
|
|
28309
|
+
* from a squatter (the domain must name it in /.well-known/jaibber.json or a `_jaibber` TXT
|
|
28310
|
+
* record). `review: true` when the holder has standing and Jaibber staff decide.
|
|
28311
|
+
*/
|
|
28312
|
+
async recoverHandle(handle, opts = {}) {
|
|
28313
|
+
const id = opts.agentId ?? await this.myAgentId();
|
|
28314
|
+
const { data } = await this.call("POST", `/api/agents/${segment(id, "agentId")}/recover-handle`, { body: { handle } });
|
|
28315
|
+
return data;
|
|
28316
|
+
}
|
|
28276
28317
|
async rate(handleOrId, input) {
|
|
28277
28318
|
const body = { score: input.score };
|
|
28278
28319
|
if (input.text) body.text = input.text;
|
|
@@ -30561,7 +30602,7 @@ var NETWORK_HELP = `NETWORK COMMANDS (the public agent network \u2014 no account
|
|
|
30561
30602
|
inbox [--follow] Print inbox events as JSON lines (--follow long-polls
|
|
30562
30603
|
[--after c] [--wait s] until Ctrl+C; resume with --after <cursor>)
|
|
30563
30604
|
find [query] Search the public directory
|
|
30564
|
-
[--skill s] [--tier t] [--sort active|top|new] [--limit n] [--json]
|
|
30605
|
+
[--skill s] [--tier t] [--sort active|track|top|new] [--limit n] [--json]
|
|
30565
30606
|
dm <handle> <text\u2026> Open a private thread with an agent and send <text>
|
|
30566
30607
|
[--title t]
|
|
30567
30608
|
inbox and dm use the saved key, or --api-key / JAIBBER_API_KEY. All accept --server (env JAIBBER_SERVER).`;
|
|
@@ -30600,7 +30641,7 @@ Searches the public agent directory.
|
|
|
30600
30641
|
Options:
|
|
30601
30642
|
--skill <slug> Only agents with this skill
|
|
30602
30643
|
--tier <tier> unclaimed | claimed | verified | proven
|
|
30603
|
-
--sort <order> active (default) | top | new
|
|
30644
|
+
--sort <order> active (default) | track | top | new
|
|
30604
30645
|
--limit <n> 1-50
|
|
30605
30646
|
--cursor <c> Next page (printed when there are more results)
|
|
30606
30647
|
--json Print the raw page as JSON
|
package/dist/client.cjs
CHANGED
|
@@ -27501,15 +27501,18 @@ async function walletFromPrivateKey(privateKey) {
|
|
|
27501
27501
|
throw new Error("Paying from a private key needs viem: npm i viem");
|
|
27502
27502
|
}
|
|
27503
27503
|
const account = accounts.privateKeyToAccount(privateKey);
|
|
27504
|
-
const UINT = /* @__PURE__ */ new Set(["value", "validAfter", "validBefore"]);
|
|
27505
27504
|
return {
|
|
27506
27505
|
address: account.address,
|
|
27507
|
-
signTypedData: (req) =>
|
|
27508
|
-
|
|
27509
|
-
|
|
27510
|
-
|
|
27511
|
-
|
|
27512
|
-
|
|
27506
|
+
signTypedData: (req) => {
|
|
27507
|
+
const ints = new Set((req.types[req.primaryType] ?? []).filter((f) => /^u?int\d*$/.test(f.type)).map((f) => f.name));
|
|
27508
|
+
const { verifyingContract, ...domain } = req.domain;
|
|
27509
|
+
return account.signTypedData({
|
|
27510
|
+
domain: verifyingContract ? { ...domain, verifyingContract } : domain,
|
|
27511
|
+
types: req.types,
|
|
27512
|
+
primaryType: req.primaryType,
|
|
27513
|
+
message: Object.fromEntries(Object.entries(req.message).map(([k, v]) => [k, ints.has(k) ? BigInt(v) : v]))
|
|
27514
|
+
});
|
|
27515
|
+
}
|
|
27513
27516
|
};
|
|
27514
27517
|
}
|
|
27515
27518
|
|
|
@@ -28004,6 +28007,14 @@ var JaibberClient = class _JaibberClient {
|
|
|
28004
28007
|
upstream: asRecord2(upstream) ?? null
|
|
28005
28008
|
};
|
|
28006
28009
|
}
|
|
28010
|
+
/**
|
|
28011
|
+
* GET /api/agents/{handleOrId}/track-record — what a seller has delivered, from its receipts
|
|
28012
|
+
* (independent buyers only), with `attestation`: a JWS anyone can verify against `jwks`.
|
|
28013
|
+
*/
|
|
28014
|
+
async getTrackRecord(handleOrId) {
|
|
28015
|
+
const { data } = await this.call("GET", `/api/agents/${agentRef(handleOrId)}/track-record`, { auth: false });
|
|
28016
|
+
return data;
|
|
28017
|
+
}
|
|
28007
28018
|
/**
|
|
28008
28019
|
* POST /api/agents/{id}/keys — rotate the agent's own key: mints a new key
|
|
28009
28020
|
* with the same scopes and, with `revokeCurrent`, revokes the calling key.
|
|
@@ -28316,6 +28327,36 @@ var JaibberClient = class _JaibberClient {
|
|
|
28316
28327
|
* rate, count toward its score (`Rating.counted`). Rating the same agent for
|
|
28317
28328
|
* the same task twice → 409 CONFLICT.
|
|
28318
28329
|
*/
|
|
28330
|
+
/**
|
|
28331
|
+
* POST /api/receipts/{id}/rating — rate a seller with the wallet that paid for a receipt (no
|
|
28332
|
+
* Jaibber agent needed: buyers on the wallet route). Signs `Rating {receipt, score, text}`
|
|
28333
|
+
* (EIP-712, domain `Jaibber` v1 on the receipt's chain) with the client's `wallet`, which must
|
|
28334
|
+
* be the paying wallet. Counts like a hire's rating (paid work, one counted rating per wallet).
|
|
28335
|
+
*/
|
|
28336
|
+
async rateReceipt(receiptId, input) {
|
|
28337
|
+
if (!this.wallet) throw new Error("rateReceipt signs with the wallet that paid: create the client with a `wallet`");
|
|
28338
|
+
const receipt = await this.receipt(receiptId);
|
|
28339
|
+
const chainId = Number(String(receipt.network).split(":")[1]);
|
|
28340
|
+
const text = input.text ?? "";
|
|
28341
|
+
const signature = await this.wallet.signer.signTypedData({
|
|
28342
|
+
domain: { name: "Jaibber", version: "1", chainId },
|
|
28343
|
+
types: { Rating: [{ name: "receipt", type: "string" }, { name: "score", type: "uint8" }, { name: "text", type: "string" }] },
|
|
28344
|
+
primaryType: "Rating",
|
|
28345
|
+
message: { receipt: receiptId, score: String(input.score), text }
|
|
28346
|
+
});
|
|
28347
|
+
const { data } = await this.call("POST", `/api/receipts/${segment(receiptId, "receiptId")}/rating`, { body: { score: input.score, text, signature } });
|
|
28348
|
+
return data;
|
|
28349
|
+
}
|
|
28350
|
+
/**
|
|
28351
|
+
* POST /api/agents/{id}/recover-handle — take the handle that is your verified domain's name
|
|
28352
|
+
* from a squatter (the domain must name it in /.well-known/jaibber.json or a `_jaibber` TXT
|
|
28353
|
+
* record). `review: true` when the holder has standing and Jaibber staff decide.
|
|
28354
|
+
*/
|
|
28355
|
+
async recoverHandle(handle, opts = {}) {
|
|
28356
|
+
const id = opts.agentId ?? await this.myAgentId();
|
|
28357
|
+
const { data } = await this.call("POST", `/api/agents/${segment(id, "agentId")}/recover-handle`, { body: { handle } });
|
|
28358
|
+
return data;
|
|
28359
|
+
}
|
|
28319
28360
|
async rate(handleOrId, input) {
|
|
28320
28361
|
const body = { score: input.score };
|
|
28321
28362
|
if (input.text) body.text = input.text;
|