@arp-protocol/cli 0.0.3 → 0.0.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.
@@ -1,4 +1,48 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ AGENT_EDGE_LIMIT,
4
+ AGENT_IDENTITIES_QUERY,
5
+ ALL_HIERARCHY_QUERY,
6
+ ATTACHED_DOCUMENTS_QUERY,
7
+ ATTESTED_TOOL_USAGE_QUERY,
8
+ BY_URL_QUERY,
9
+ CAPABILITIES_QUERY,
10
+ COHORT_ORDER_BY,
11
+ COHORT_QUERY,
12
+ DEFAULT_MAX_BODY_BYTES,
13
+ DEFAULT_TIMEOUT_MS,
14
+ ENDPOINT_SUBJECTS_QUERY,
15
+ FIND_AGENTS_QUERY,
16
+ HttpError,
17
+ IDENTITY_CLAIMS_QUERY,
18
+ IDENTITY_SAMPLE_LIMIT,
19
+ OUR_HIERARCHY_QUERY,
20
+ PULSE_ATOMS_QUERY,
21
+ PULSE_DOMAIN_EDGES_QUERY,
22
+ PULSE_EDGE_TOOLS_QUERY,
23
+ PULSE_EDGE_WRITERS_QUERY,
24
+ PULSE_QUALIFIERS_QUERY,
25
+ PULSE_USES_QUERY,
26
+ REGISTERED_TOOLS_QUERY,
27
+ RESOLVE_AGENT_QUERY,
28
+ SPONSORED_WALLETS_QUERY,
29
+ TAGGED_QUERY,
30
+ TOOL_LISTING_QUERY,
31
+ TOOL_LISTING_SPONSORED_QUERY,
32
+ TOOL_USAGE_QUERY,
33
+ TRUST_SURFACE_QUERY,
34
+ createGraphqlTransport,
35
+ defaultFetch,
36
+ isRecord,
37
+ isTimeoutError,
38
+ readArray,
39
+ readBigInt,
40
+ readBodyText,
41
+ readCount,
42
+ readNumber,
43
+ readRecord,
44
+ readString
45
+ } from "./cli-zehr6kdx.js";
2
46
  import {
3
47
  AtomicReadyWalletRejectedUpgradeError,
4
48
  AtomicityNotSupportedError,
@@ -7701,6 +7745,10 @@ async function recoverTypedDataAddress2(parameters) {
7701
7745
  signature
7702
7746
  });
7703
7747
  }
7748
+ // ../../node_modules/.bun/viem@2.52.0+e016764623ac6761/node_modules/viem/_esm/utils/signature/verifyMessage.js
7749
+ async function verifyMessage3({ address, message, signature }) {
7750
+ return isAddressEqual(getAddress(address), await recoverMessageAddress2({ message, signature }));
7751
+ }
7704
7752
  // ../../node_modules/.bun/viem@2.52.0+e016764623ac6761/node_modules/viem/_esm/errors/unit.js
7705
7753
  class InvalidDecimalNumberError extends BaseError {
7706
7754
  constructor({ value }) {
@@ -7770,6 +7818,56 @@ function isTransactionAbsent(error) {
7770
7818
  return error.walk((cause) => cause instanceof TransactionNotFoundError || cause instanceof TransactionReceiptNotFoundError) !== null;
7771
7819
  }
7772
7820
 
7821
+ // ../../packages/protocol/dist/endpoint-redaction.js
7822
+ var REDACTED_SEGMENT = ":id";
7823
+
7824
+ class EndpointNotRedactableError extends Error {
7825
+ input;
7826
+ constructor(input, why) {
7827
+ super(`${JSON.stringify(input)} cannot be written as an endpoint: ${why}`);
7828
+ this.name = "EndpointNotRedactableError";
7829
+ this.input = input;
7830
+ }
7831
+ }
7832
+ var PARTS = /^([A-Za-z][A-Za-z0-9+.-]*:\/\/)([^/?#]*)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/;
7833
+ var PERSONAL = [
7834
+ (s) => s.includes("@"),
7835
+ (s) => /0x[0-9a-f]{40}/i.test(s),
7836
+ (s) => /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i.test(s),
7837
+ (s) => /\d{6}/.test(s),
7838
+ (s) => (s.match(/[0-9a-f]{16,}/gi) ?? []).some((run) => /\d/.test(run)),
7839
+ (s) => /^[\d\s+().-]+$/.test(s) && (s.match(/\d/g) ?? []).length >= 7,
7840
+ (s) => /\s/.test(s),
7841
+ (s) => s.length > 20 && /^[A-Za-z0-9+/=_-]+$/.test(s) && /[A-Z]/.test(s) && /[a-z]/.test(s) && /\d/.test(s)
7842
+ ];
7843
+ function looksPersonal(segment) {
7844
+ if (segment === REDACTED_SEGMENT)
7845
+ return false;
7846
+ let decoded = segment;
7847
+ try {
7848
+ decoded = decodeURIComponent(segment);
7849
+ } catch {}
7850
+ return [segment, decoded].some((form) => PERSONAL.some((test) => test(form)));
7851
+ }
7852
+ var reduce = (segment) => segment !== "" && looksPersonal(segment) ? REDACTED_SEGMENT : segment;
7853
+ function redactEndpointUrl(url) {
7854
+ const match = PARTS.exec(url);
7855
+ if (match === null)
7856
+ throw new EndpointNotRedactableError(url, "not a URL with a scheme and a host");
7857
+ const scheme = match[1];
7858
+ const authority = match[2];
7859
+ if (!/^https?:\/\/$/i.test(scheme))
7860
+ throw new EndpointNotRedactableError(url, `scheme ${scheme} is not http or https`);
7861
+ if (authority.includes("@"))
7862
+ throw new EndpointNotRedactableError(url, "it carries credentials (user:pass@)");
7863
+ if (authority === "" || authority.startsWith(":"))
7864
+ throw new EndpointNotRedactableError(url, "no host");
7865
+ const path = match[3].split("/").map(reduce).join("/");
7866
+ const names = (match[4] ?? "").split("&").filter((part) => part.indexOf("=") > 0).map((part) => reduce(part.slice(0, part.indexOf("="))));
7867
+ const query = names.length === 0 ? "" : `?${names.map((name) => `${name}=`).join("&")}`;
7868
+ return `${scheme}${authority}${path}${query}`;
7869
+ }
7870
+
7773
7871
  // ../../packages/protocol/dist/declare/label.js
7774
7872
  function normaliseCategoryLabel(raw) {
7775
7873
  return raw.normalize("NFKC").normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().trim().replace(/\s+/g, " ");
@@ -8282,897 +8380,239 @@ async function prepareMarketExit(params) {
8282
8380
  ]
8283
8381
  };
8284
8382
  }
8285
- // ../../packages/graphql/dist/http.js
8286
- var DEFAULT_TIMEOUT_MS = 1e4;
8287
- var DEFAULT_MAX_BODY_BYTES = 8 * 1024 * 1024;
8288
-
8289
- class HttpError extends Error {
8290
- kind;
8291
- timeoutMs;
8292
- constructor(kind, message, timeoutMs, cause) {
8293
- super(message, cause === undefined ? undefined : { cause });
8294
- this.name = "HttpError";
8295
- this.kind = kind;
8296
- this.timeoutMs = timeoutMs;
8297
- }
8383
+ // ../../packages/protocol/dist/declare/thing-cid.js
8384
+ function thingDocument(thing) {
8385
+ return JSON.stringify({
8386
+ "@context": "https://schema.org",
8387
+ "@type": "Thing",
8388
+ description: thing.description,
8389
+ image: thing.image,
8390
+ name: thing.name,
8391
+ url: thing.url
8392
+ });
8298
8393
  }
8299
- function isTimeoutError(error) {
8300
- let cursor = error;
8301
- for (let depth = 0;depth < 8 && cursor !== null && cursor !== undefined; depth += 1) {
8302
- if (cursor instanceof HttpError)
8303
- return cursor.kind === "timeout";
8304
- cursor = cursor instanceof Error ? cursor.cause : null;
8394
+ function base32(bytes) {
8395
+ const alphabet = "abcdefghijklmnopqrstuvwxyz234567";
8396
+ let bits = 0;
8397
+ let value = 0;
8398
+ let out = "";
8399
+ for (const byte of bytes) {
8400
+ value = value << 8 | byte;
8401
+ bits += 8;
8402
+ while (bits >= 5) {
8403
+ out += alphabet[value >>> bits - 5 & 31];
8404
+ bits -= 5;
8405
+ }
8305
8406
  }
8306
- return false;
8407
+ if (bits > 0)
8408
+ out += alphabet[value << 5 - bits & 31];
8409
+ return out;
8307
8410
  }
8308
- async function readBodyText(response, options = {}) {
8309
- const maxBytes = options.maxBytes ?? DEFAULT_MAX_BODY_BYTES;
8310
- const timeoutMs = options.timeoutMs ?? 0;
8311
- const body = response.body;
8312
- if (body === null)
8313
- return "";
8314
- const reader = body.getReader();
8315
- const signal = options.signal;
8316
- let onAbort = null;
8317
- const aborted = signal === undefined ? null : new Promise((_, reject) => {
8318
- const fire = () => reject(new HttpError("timeout", `timed out after ${timeoutMs}ms reading the body`, timeoutMs));
8319
- onAbort = fire;
8320
- if (signal.aborted)
8321
- fire();
8322
- else
8323
- signal.addEventListener("abort", fire, { once: true });
8324
- });
8325
- aborted?.catch(() => {
8326
- return;
8327
- });
8328
- const decoder = new TextDecoder;
8329
- let total = 0;
8330
- let text = "";
8331
- try {
8332
- for (;; ) {
8333
- const chunk = await (aborted === null ? reader.read() : Promise.race([reader.read(), aborted]));
8334
- if (chunk.done)
8335
- break;
8336
- total += chunk.value.byteLength;
8337
- if (total > maxBytes) {
8338
- throw new HttpError("too-large", `body exceeds ${maxBytes} bytes`, timeoutMs);
8339
- }
8340
- text += decoder.decode(chunk.value, { stream: true });
8341
- }
8342
- return text + decoder.decode();
8343
- } catch (error) {
8344
- reader.cancel().catch(() => {
8345
- return;
8346
- });
8347
- if (error instanceof HttpError)
8348
- throw error;
8349
- throw new HttpError("network", error instanceof Error ? error.message : String(error), timeoutMs, error);
8350
- } finally {
8351
- if (signal !== undefined && onAbort !== null)
8352
- signal.removeEventListener("abort", onAbort);
8411
+ function thingUriOfDigest(digest) {
8412
+ const cid = new Uint8Array(4 + digest.length);
8413
+ cid.set([1, 85, 18, 32]);
8414
+ cid.set(digest, 4);
8415
+ return `ipfs://b${base32(cid)}`;
8416
+ }
8417
+
8418
+ // ../../packages/protocol/dist/declare/agent-atom.js
8419
+ function canonicalAgentThing(chainId, tokenId, registration) {
8420
+ const normalize = (value) => {
8421
+ if (typeof value !== "string")
8422
+ return null;
8423
+ const trimmed = value.trim();
8424
+ return trimmed.length > 0 ? trimmed : null;
8425
+ };
8426
+ const agentKey = `${chainId}:${tokenId}`;
8427
+ return {
8428
+ name: normalize(registration?.name) ?? `Agent ${agentKey}`,
8429
+ description: normalize(registration?.description) ?? `ERC-8004 agent ${agentKey}`,
8430
+ image: normalize(registration?.image) ?? "",
8431
+ url: normalize(registration?.webEndpoint) ?? `https://8004scan.io/agents/${chainId}/${tokenId}`
8432
+ };
8433
+ }
8434
+ function thingUri(thing) {
8435
+ return thingUriOfDigest(toBytes(sha256(toBytes(thingDocument(thing)))));
8436
+ }
8437
+
8438
+ // ../../packages/protocol/dist/declare/tool-thing.js
8439
+ class InvalidToolUrlError extends Error {
8440
+ input;
8441
+ constructor(input, why) {
8442
+ super(`${JSON.stringify(input)} is not a usable tool URL: ${why}`);
8443
+ this.name = "InvalidToolUrlError";
8444
+ this.input = input;
8353
8445
  }
8354
8446
  }
8355
- async function fetchTextWithTimeout(fetchImpl, url, init, options) {
8356
- const { timeoutMs } = options;
8357
- const controller = new AbortController;
8358
- const timer = setTimeout(() => controller.abort(), timeoutMs);
8447
+ var TOOL_THING_DESCRIPTION = "A tool identified by its URL, so every declaration of its use lands on one atom.";
8448
+ function normaliseToolUrl(input) {
8449
+ const trimmed = input.trim();
8450
+ if (trimmed.length === 0)
8451
+ throw new InvalidToolUrlError(input, "empty");
8452
+ const withScheme = /^[a-z][a-z0-9+.-]*:/i.test(trimmed) ? trimmed : `https://${trimmed}`;
8453
+ let url;
8359
8454
  try {
8360
- let response;
8361
- try {
8362
- response = await fetchImpl(url, { ...init, signal: controller.signal });
8363
- } catch (error) {
8364
- if (controller.signal.aborted) {
8365
- throw new HttpError("timeout", `timed out after ${timeoutMs}ms: ${url}`, timeoutMs);
8366
- }
8367
- throw new HttpError("network", error instanceof Error ? error.message : String(error), timeoutMs, error);
8368
- }
8369
- const text = await readBodyText(response, {
8370
- signal: controller.signal,
8371
- timeoutMs,
8372
- ...options.maxBytes === undefined ? {} : { maxBytes: options.maxBytes }
8373
- });
8374
- return { response, text };
8375
- } finally {
8376
- clearTimeout(timer);
8455
+ url = new URL(withScheme);
8456
+ } catch {
8457
+ throw new InvalidToolUrlError(input, "not parseable as a URL");
8377
8458
  }
8378
- }
8379
- function defaultFetch() {
8380
- if (typeof globalThis.fetch !== "function") {
8381
- throw new TypeError("no global fetch available — pass one via createErc8004Client({fetch})");
8459
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
8460
+ throw new InvalidToolUrlError(input, `scheme ${url.protocol} is not http or https`);
8382
8461
  }
8383
- return (input, init) => globalThis.fetch(input, init);
8462
+ if (url.hostname.length === 0)
8463
+ throw new InvalidToolUrlError(input, "no host");
8464
+ const host = url.hostname.replace(/\.+$/, "").replace(/^(?:www\.)+/, "");
8465
+ const path = url.pathname.replace(/(?:\.git|\/)+$/, "");
8466
+ const params = [...new URLSearchParams(url.search).entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
8467
+ const query = params.length === 0 ? "" : `?${new URLSearchParams(params).toString()}`;
8468
+ const port = url.port === "" || url.port === "80" || url.port === "443" ? "" : `:${url.port}`;
8469
+ return `https://${host}${port}${path}${query}`;
8470
+ }
8471
+ function toolThing(url) {
8472
+ const normalised = normaliseToolUrl(url);
8473
+ return {
8474
+ name: normalised.slice("https://".length),
8475
+ description: TOOL_THING_DESCRIPTION,
8476
+ image: "",
8477
+ url: normalised
8478
+ };
8384
8479
  }
8385
- // ../../packages/graphql/dist/json.js
8386
- function isRecord(value) {
8387
- return typeof value === "object" && value !== null && !Array.isArray(value);
8480
+ function toolAtomUri(url) {
8481
+ return thingUri(toolThing(url));
8388
8482
  }
8389
- function readRecord(source, key) {
8390
- if (!isRecord(source))
8391
- return null;
8392
- const child = source[key];
8393
- return isRecord(child) ? child : null;
8483
+ function toolThingDocument(url) {
8484
+ return thingDocument(toolThing(url));
8394
8485
  }
8395
- function readString(source, key) {
8396
- if (!isRecord(source))
8397
- return null;
8398
- const value = source[key];
8399
- return typeof value === "string" ? value : null;
8486
+ function isToolUrl(uri) {
8487
+ try {
8488
+ normaliseToolUrl(uri);
8489
+ return true;
8490
+ } catch {
8491
+ return false;
8492
+ }
8400
8493
  }
8401
- function readNumber(source, key) {
8402
- if (!isRecord(source))
8403
- return null;
8404
- const value = source[key];
8405
- return typeof value === "number" && Number.isFinite(value) ? value : null;
8494
+
8495
+ // ../../packages/protocol/dist/tool-url-values.js
8496
+ var GITHUB = /^https?:\/\/(?:www\.)?github\.com(?:[/?#]|$)/i;
8497
+ function publishableToolUrl(url) {
8498
+ if (GITHUB.test(url)) {
8499
+ let parsed;
8500
+ try {
8501
+ parsed = new URL(url);
8502
+ } catch {
8503
+ return { ok: false, why: "it is not a URL", listable: null };
8504
+ }
8505
+ const names = [...parsed.searchParams.keys()];
8506
+ const others = [...new Set(names.filter((name) => name !== "skill"))];
8507
+ if (others.length === 0 && names.length <= 1 && parsed.hash === "")
8508
+ return { ok: true };
8509
+ const skill = parsed.searchParams.get("skill");
8510
+ const listable = normaliseToolUrl(`${parsed.origin}${parsed.pathname}${skill === null ? "" : `?skill=${encodeURIComponent(skill)}`}`);
8511
+ const why = others.length > 0 ? `its query carries ${others.join(", ")}` : "its query repeats skill";
8512
+ return { ok: false, why, listable };
8513
+ }
8514
+ let redacted;
8515
+ try {
8516
+ redacted = redactEndpointUrl(url);
8517
+ } catch (error) {
8518
+ if (error instanceof EndpointNotRedactableError)
8519
+ return { ok: false, why: error.message, listable: null };
8520
+ throw error;
8521
+ }
8522
+ if (redacted === url)
8523
+ return { ok: true };
8524
+ const valued = new Set((url.split("#")[0] ?? "").split("?").slice(1).join("?").split("&").filter((part) => part.indexOf("=") > 0 && part.slice(part.indexOf("=") + 1) !== "").map((part) => part.slice(0, part.indexOf("="))));
8525
+ const parts = [];
8526
+ if (valued.size > 0)
8527
+ parts.push(`a value for ${[...valued].join(", ")}`);
8528
+ const pathOf = (u) => u.split(/[?#]/)[0];
8529
+ if (pathOf(redacted) !== pathOf(url))
8530
+ parts.push("a path segment or name that looks personal");
8531
+ if (url.includes("#"))
8532
+ parts.push("a fragment");
8533
+ return { ok: false, why: `it carries ${parts.length === 0 ? "a value" : parts.join(" and ")}`, listable: redacted };
8406
8534
  }
8407
- function readArray(source, key) {
8408
- if (!isRecord(source))
8409
- return [];
8410
- const value = source[key];
8411
- return Array.isArray(value) ? value : [];
8535
+
8536
+ class ToolUrlCarriesValuesError extends Error {
8537
+ listable;
8538
+ constructor(why, listable) {
8539
+ super(`This tool URL cannot be listed: ${why}. A tool's URL is written publicly and for good, so remove it` + (listable === null ? "." : ` and list ${listable}.`));
8540
+ this.name = "ToolUrlCarriesValuesError";
8541
+ this.listable = listable;
8542
+ }
8412
8543
  }
8413
- function readBigInt(source, key) {
8414
- if (!isRecord(source))
8415
- return null;
8416
- const value = source[key];
8417
- if (typeof value === "bigint")
8418
- return value;
8419
- if (typeof value === "number")
8420
- return Number.isInteger(value) ? BigInt(value) : null;
8421
- if (typeof value !== "string" || !/^-?\d+$/.test(value))
8422
- return null;
8423
- return BigInt(value);
8544
+ function assertPublishableToolUrl(url) {
8545
+ const verdict = publishableToolUrl(url);
8546
+ if (!verdict.ok)
8547
+ throw new ToolUrlCarriesValuesError(verdict.why, verdict.listable);
8424
8548
  }
8425
- function readCount(source, key) {
8426
- if (!isRecord(source))
8427
- return null;
8428
- const value = source[key];
8429
- const parsed = typeof value === "number" ? value : typeof value === "string" && /^\d+$/.test(value) ? Number(value) : null;
8430
- return parsed !== null && Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : null;
8431
- }
8432
- // ../../packages/graphql/dist/client.js
8433
- class GraphqlError extends Error {
8434
- url;
8435
- httpStatus;
8436
- constructor(message, url, httpStatus, cause) {
8437
- super(message, cause === undefined ? undefined : { cause });
8438
- this.name = "GraphqlError";
8439
- this.url = url;
8440
- this.httpStatus = httpStatus;
8441
- }
8442
- }
8443
- function createGraphqlTransport(config) {
8444
- const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
8549
+
8550
+ // ../../packages/protocol/dist/declare/tool-atom.js
8551
+ function intuitionToolAtomLookup(config) {
8552
+ const transport = config.transport ?? createGraphqlTransport({
8553
+ url: config.graphqlUrl,
8554
+ fetch: config.fetch ?? defaultFetch(),
8555
+ ...config.timeoutMs === undefined ? {} : { timeoutMs: config.timeoutMs }
8556
+ });
8445
8557
  return {
8446
- async request(query, variables, options) {
8447
- let response;
8448
- let text;
8449
- try {
8450
- ({ response, text } = await fetchTextWithTimeout(config.fetch, config.url, {
8451
- method: "POST",
8452
- headers: {
8453
- "content-type": "application/json",
8454
- accept: "application/json"
8455
- },
8456
- body: JSON.stringify({ query, variables })
8457
- }, {
8458
- timeoutMs: options?.timeoutMs ?? timeoutMs,
8459
- ...config.maxBodyBytes === undefined ? {} : { maxBytes: config.maxBodyBytes }
8460
- }));
8461
- } catch (error) {
8462
- const message = error instanceof HttpError ? error.message : String(error);
8463
- throw new GraphqlError(message, config.url, null, error);
8464
- }
8465
- if (!response.ok) {
8466
- throw new GraphqlError(`HTTP ${response.status} ${response.statusText}`, config.url, response.status);
8467
- }
8468
- let body = null;
8469
- try {
8470
- body = JSON.parse(text);
8471
- } catch {
8472
- body = null;
8473
- }
8474
- if (!isRecord(body)) {
8475
- throw new GraphqlError("response body is not a JSON object", config.url, 200);
8476
- }
8477
- const errors = readArray(body, "errors");
8478
- if (errors.length > 0) {
8479
- const messages = errors.map((entry) => readString(entry, "message") ?? "unknown error").join("; ");
8480
- throw new GraphqlError(messages, config.url, 200);
8481
- }
8482
- const data = body["data"];
8483
- if (!isRecord(data)) {
8484
- throw new GraphqlError("response carries no data object", config.url, 200);
8558
+ async findByUrl(url) {
8559
+ const data = await transport.request(BY_URL_QUERY, { url });
8560
+ const rows = Array.isArray(data["atoms"]) ? data["atoms"] : [];
8561
+ const candidates = [];
8562
+ for (const row of rows) {
8563
+ if (!isRecord(row))
8564
+ continue;
8565
+ const termId = readString(row, "term_id");
8566
+ if (termId === null)
8567
+ continue;
8568
+ candidates.push({
8569
+ termId,
8570
+ label: readString(row, "label"),
8571
+ uri: readString(row, "data")
8572
+ });
8485
8573
  }
8486
- return data;
8487
- }
8488
- };
8489
- }
8490
- // ../../packages/graphql/dist/queries/agent.js
8491
- var THING = `value { thing { name description image url } }`;
8492
- var MARKET_SIDE = `
8493
- total_market_cap
8494
- total_assets
8495
- vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) {
8496
- market_cap
8497
- total_assets
8498
- total_shares
8499
- current_share_price
8500
- position_count
8501
- }`;
8502
- var RESOLVE_AGENT_QUERY = `
8503
- query ResolveAgentByCaip($sameAsPredicateId: String!, $caipId: String!) {
8504
- triples(
8505
- where: {
8506
- predicate_id: {_eq: $sameAsPredicateId}
8507
- object: {value: {thing: {name: {_eq: $caipId}}}}
8574
+ return candidates;
8508
8575
  }
8509
- limit: 2
8510
- ) {
8511
- subject { term_id label data ${THING} }
8576
+ };
8577
+ }
8578
+ function derivesItsOwnAtom(uri) {
8579
+ return /^(ipfs|ar):\/\//i.test(uri.trim());
8580
+ }
8581
+
8582
+ // ../../packages/protocol/dist/declare/plan.js
8583
+ class EmptyPlanError extends Error {
8584
+ constructor(what) {
8585
+ super(`nothing to plan: ${what}`);
8586
+ this.name = "EmptyPlanError";
8512
8587
  }
8513
- }`;
8514
- var AGENT_EDGE_LIMIT = 250;
8515
- var TRUST_SURFACE_QUERY = `
8516
- query AgentTrustSurface($subjectId: String!, $predicateIds: [String!], $curveId: numeric!, $limit: Int!) {
8517
- triples(
8518
- where: {subject_id: {_eq: $subjectId}, predicate_id: {_in: $predicateIds}}
8519
- order_by: {term: {total_market_cap: desc}}
8520
- limit: $limit
8521
- ) {
8522
- term_id
8523
- predicate { term_id label }
8524
- object { term_id label data ${THING} }
8525
- term {${MARKET_SIDE}
8526
- }
8527
- counter_term {${MARKET_SIDE}
8528
- }
8588
+ }
8589
+
8590
+ class NonPositiveAmountError extends Error {
8591
+ tripleId;
8592
+ constructor(tripleId, amount) {
8593
+ super(`a deposit of ${amount} on ${tripleId} would put nothing behind the claim; ` + `an edge with no stake carries no weight at all (docs/14)`);
8594
+ this.name = "NonPositiveAmountError";
8595
+ this.tripleId = tripleId;
8529
8596
  }
8530
- }`;
8531
- var CAPABILITIES_QUERY = `
8532
- query AgentCapabilities($subjectId: String!, $predicateIds: [String!], $limit: Int!) {
8533
- triples(
8534
- where: {subject_id: {_eq: $subjectId}, predicate_id: {_in: $predicateIds}}
8535
- order_by: {term_id: asc}
8536
- limit: $limit
8537
- ) {
8538
- term_id
8539
- predicate { term_id label }
8540
- object { term_id label ${THING} }
8597
+ }
8598
+
8599
+ class AmbiguousToolAtomError extends Error {
8600
+ uri;
8601
+ candidates;
8602
+ constructor(uri, candidates) {
8603
+ super(`${candidates.length} atoms already claim ${uri} — ` + candidates.map((c) => `${c.termId} (${c.label ?? "no label"})`).join(", ") + `. Refusing to choose: a \`uses\` edge on the wrong one is permanent. ` + `Pass the \`ipfs://\` URI of the atom you mean.`);
8604
+ this.name = "AmbiguousToolAtomError";
8605
+ this.uri = uri;
8606
+ this.candidates = candidates;
8541
8607
  }
8542
- }`;
8543
- var IDENTITY_SAMPLE_LIMIT = 4;
8544
- var CAPABILITY_SAMPLE_LIMIT = 8;
8545
- var COHORT_QUERY = `
8546
- query AgentCohort($where: triples_bool_exp!, $sameAsPredicateId: String!, $capabilityPredicateIds: [String!], $orderBy: [triples_order_by!]!, $limit: Int!, $offset: Int!) {
8547
- total: triples_aggregate(
8548
- where: $where
8549
- ) {
8550
- aggregate { count }
8551
- }
8552
- triples(
8553
- where: $where
8554
- order_by: $orderBy
8555
- limit: $limit
8556
- offset: $offset
8557
- ) {
8558
- subject {
8559
- term_id
8560
- label
8561
- ${THING}
8562
- as_subject_triples_aggregate { aggregate { count } }
8563
- term {
8564
- total_market_cap
8565
- vaults_aggregate { aggregate { count sum { position_count } } }
8566
- }
8567
- identityCount: as_subject_triples_aggregate(
8568
- where: {predicate_id: {_eq: $sameAsPredicateId}}
8569
- ) {
8570
- aggregate { count }
8571
- }
8572
- identity: as_subject_triples(
8573
- where: {predicate_id: {_eq: $sameAsPredicateId}}
8574
- limit: ${IDENTITY_SAMPLE_LIMIT}
8575
- ) {
8576
- object { label ${THING} }
8577
- }
8578
- capabilities: as_subject_triples(
8579
- where: {predicate_id: {_in: $capabilityPredicateIds}}
8580
- limit: ${CAPABILITY_SAMPLE_LIMIT}
8581
- ) {
8582
- predicate_id
8583
- object { term_id label }
8584
- }
8585
- }
8586
- }
8587
- }`;
8588
- var COHORT_ORDER_BY = {
8589
- "evidence-quantity": [
8590
- { subject: { as_subject_triples_aggregate: { count: "desc" } } },
8591
- { subject_id: "asc" }
8592
- ],
8593
- "economic-conviction": [{ subject: { term: { total_market_cap: "desc" } } }, { subject_id: "asc" }]
8594
- };
8595
- // ../../packages/graphql/dist/queries/atom-standing.js
8596
- var VAULT_SIDE = `
8597
- total_market_cap
8598
- total_assets
8599
- vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) {
8600
- market_cap
8601
- total_assets
8602
- total_shares
8603
- current_share_price
8604
- position_count
8605
- }`;
8606
- var ATOM_STANDING_QUERY = `
8607
- query AtomStanding($atomId: String!, $curveId: numeric!, $limit: Int!, $attestor: [String!]!) {
8608
- atom: atoms(where: {term_id: {_eq: $atomId}}, limit: 1) {
8609
- term_id
8610
- label
8611
- data
8612
- type
8613
- value { thing { url } }
8614
- term { ${VAULT_SIDE} }
8615
- }
8616
- triples(
8617
- where: {object_id: {_eq: $atomId}}
8618
- order_by: {term: {total_assets: desc}}
8619
- limit: $limit
8620
- ) {
8621
- term_id
8622
- predicate { term_id label }
8623
- subject { term_id label type }
8624
- term { ${VAULT_SIDE} }
8625
- counter_term { ${VAULT_SIDE} }
8626
- }
8627
- claims: triples(
8628
- where: {subject_id: {_eq: $atomId}}
8629
- order_by: {term: {total_assets: desc}}
8630
- limit: $limit
8631
- ) {
8632
- term_id
8633
- predicate { term_id label }
8634
- object { term_id label type }
8635
- term {
8636
- ${VAULT_SIDE}
8637
- vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) {
8638
- positions(where: {account_id: {_in: $attestor}, shares: {_gt: "0"}}, limit: 1) { shares }
8639
- }
8640
- }
8641
- }
8642
- }`;
8643
- var LISTED_CAPABILITIES_FOR_QUERY = `query ListedCapabilitiesFor($subject: String!, $predicates: [String!]) {
8644
- atoms(where: {term_id: {_eq: $subject}}, limit: 1) {
8645
- capabilities: as_subject_triples(
8646
- where: {predicate_id: {_in: $predicates}}
8647
- limit: ${CAPABILITY_SAMPLE_LIMIT}
8648
- ) { object { term_id } }
8649
- }
8650
- }`;
8651
- // ../../packages/graphql/dist/queries/discover.js
8652
- var FIND_AGENTS_QUERY = `
8653
- query FindAgents($domain: String!, $predicates: [String!], $sameAs: String!, $curveId: numeric!, $limit: Int!) {
8654
- triples(
8655
- where: {
8656
- predicate_id: {_in: $predicates}
8657
- object: {label: {_ilike: $domain}}
8658
- subject: {as_subject_triples: {predicate_id: {_eq: $sameAs}}}
8659
- }
8660
- limit: $limit
8661
- ) {
8662
- predicate_id
8663
- object { label }
8664
- subject {
8665
- term_id
8666
- label
8667
- term { vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) { position_count total_assets } }
8668
- }
8669
- }
8670
- }`;
8671
- // ../../packages/graphql/dist/queries/domains.js
8672
- var OUR_HIERARCHY_QUERY = `query($pid: String!, $who: [String!]!, $curveId: numeric!, $limit: Int!, $offset: Int!) {
8673
- positions(
8674
- where: {
8675
- account_id: {_in: $who}
8676
- curve_id: {_eq: $curveId}
8677
- shares: {_gt: "0"}
8678
- term: {triple: {predicate_id: {_eq: $pid}}}
8679
- }
8680
- limit: $limit
8681
- offset: $offset
8682
- order_by: {id: asc}
8683
- ) {
8684
- shares
8685
- term {
8686
- triple {
8687
- term_id
8688
- subject { term_id data label }
8689
- object { term_id data label }
8690
- }
8691
- }
8692
- }
8693
- }`;
8694
- var ALL_HIERARCHY_QUERY = `query($pid: String!, $limit: Int!, $offset: Int!) {
8695
- triples(where: {predicate_id: {_eq: $pid}}, limit: $limit, offset: $offset, order_by: {term_id: asc}) {
8696
- term_id
8697
- subject { term_id data label }
8698
- object { term_id data label }
8699
- term { vaults { curve_id position_count total_shares } }
8700
- }
8701
- }`;
8702
- var TAGGED_QUERY = `query($pid: String!, $domains: [String!], $limit: Int!, $offset: Int!, $who: [String!]!) {
8703
- triples(
8704
- where: {predicate_id: {_eq: $pid}, object: {data: {_in: $domains}}}
8705
- limit: $limit
8706
- offset: $offset
8707
- order_by: {term_id: asc}
8708
- ) {
8709
- term_id
8710
- subject { term_id label value { thing { url name } } }
8711
- object { data }
8712
- term {
8713
- vaults {
8714
- curve_id
8715
- position_count
8716
- total_shares
8717
- positions(where: {account_id: {_in: $who}, shares: {_gt: "0"}}) { shares }
8718
- }
8719
- }
8720
- }
8721
- }`;
8722
- // ../../packages/graphql/dist/queries/registered-tools.js
8723
- var REGISTERED_TOOLS_QUERY = `
8724
- query RegisteredTools($description: String!, $uses: String!, $sameAs: String!, $curveId: numeric!, $limit: Int!, $offset: Int!) {
8725
- atoms(
8726
- where: {value: {thing: {description: {_eq: $description}}}}
8727
- limit: $limit
8728
- offset: $offset
8729
- order_by: {term_id: asc}
8730
- ) {
8731
- term_id
8732
- label
8733
- data
8734
- value { thing { url } }
8735
- term {
8736
- vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) { position_count total_assets }
8737
- }
8738
- as_object_triples_aggregate(
8739
- where: {
8740
- predicate_id: {_eq: $uses}
8741
- subject: {as_subject_triples: {predicate_id: {_eq: $sameAs}}}
8742
- }
8743
- ) { aggregate { count } }
8744
- }
8745
- }`;
8746
- // ../../packages/graphql/dist/queries/tool-atom.js
8747
- var BY_URL_QUERY = `
8748
- query ToolAtomByUrl($url: String!) {
8749
- atoms(where: {value: {thing: {url: {_eq: $url}}}}, limit: 10) {
8750
- term_id
8751
- label
8752
- type
8753
- data
8754
- }
8755
- }`;
8756
- // ../../packages/graphql/dist/queries/tool-listing.js
8757
- function toolListingQuery(sponsored) {
8758
- const variables = sponsored ? "$uses: String!, $sameAs: String!, $curveId: numeric!, $limit: Int!, $sponsor: String!" : "$uses: String!, $sameAs: String!, $curveId: numeric!, $limit: Int!";
8759
- const sponsoredCount = sponsored ? `
8760
- sponsored: deposits_aggregate(where: {sender_id: {_ilike: $sponsor}, receiver_id: {_nilike: $sponsor}}) { aggregate { count } }` : "";
8761
- return `
8762
- query ToolListing(${variables}) {
8763
- triples(
8764
- where: {
8765
- predicate_id: {_eq: $uses}
8766
- subject: {as_subject_triples: {predicate_id: {_eq: $sameAs}}}
8767
- }
8768
- limit: $limit
8769
- ) {
8770
- term_id
8771
- subject_id
8772
- object {
8773
- term_id
8774
- label
8775
- data
8776
- type
8777
- value { thing { url } }
8778
- }
8779
- term {
8780
- total_assets
8781
- vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) { position_count total_assets }
8782
- deposits: deposits_aggregate { aggregate { count } }${sponsoredCount}
8783
- }
8784
- counter_term {
8785
- total_assets
8786
- vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) { position_count total_assets }
8787
- }
8788
- }
8789
- }`;
8790
- }
8791
- var TOOL_LISTING_QUERY = toolListingQuery(false);
8792
- var TOOL_LISTING_SPONSORED_QUERY = toolListingQuery(true);
8793
- var SPONSORED_WALLETS_QUERY = `
8794
- query SponsoredWallets($uses: String!, $sponsor: String!, $limit: Int!) {
8795
- deposits(
8796
- where: {sender_id: {_eq: $sponsor}, receiver_id: {_neq: $sponsor}, term: {triple: {predicate_id: {_eq: $uses}}}}
8797
- distinct_on: [term_id, receiver_id]
8798
- limit: $limit
8799
- ) { term_id receiver_id }
8800
- }`;
8801
- // ../../packages/graphql/dist/queries/pulse-usage.js
8802
- var PULSE_USES_QUERY = `query PulseUses($tools: [String!]!, $uses: String!, $limit: Int!) {
8803
- triples(where: {object_id: {_in: $tools}, predicate_id: {_eq: $uses}}, limit: $limit) {
8804
- term_id
8805
- object_id
8806
- creator_id
8807
- created_at
8808
- subject {
8809
- term_id
8810
- label
8811
- }
8812
- positions(where: {shares: {_gt: "0"}}) {
8813
- account_id
8814
- }
8815
- }
8816
- }`;
8817
- var PULSE_QUALIFIERS_QUERY = `query PulseQualifiers($edges: [String!]!, $predicates: [String!]!, $writers: [String!]!, $limit: Int!) {
8818
- triples(where: {subject_id: {_in: $edges}, predicate_id: {_in: $predicates}}, limit: $limit) {
8819
- term_id
8820
- subject_id
8821
- predicate_id
8822
- creator_id
8823
- created_at
8824
- object {
8825
- label
8826
- }
8827
- positions(where: {shares: {_gt: "0"}, account_id: {_in: $writers}}) {
8828
- account_id
8829
- }
8830
- }
8831
- }`;
8832
- var PULSE_ATOMS_QUERY = `query PulseAtoms($uris: [String!]!, $limit: Int!) {
8833
- atoms(where: {data: {_in: $uris}}, limit: $limit) {
8834
- term_id
8835
- data
8836
- }
8837
- }`;
8838
- var PULSE_DOMAIN_EDGES_QUERY = `query PulseDomainEdges($domains: [String!]!, $predicate: String!, $limit: Int!) {
8839
- triples(where: {predicate_id: {_eq: $predicate}, object: {label: {_in: $domains}}}, order_by: {created_at: desc}, limit: $limit) {
8840
- subject_id
8841
- }
8842
- }`;
8843
- var PULSE_EDGE_TOOLS_QUERY = `query PulseEdgeTools($edges: [String!]!, $uses: String!, $limit: Int!) {
8844
- triples(where: {term_id: {_in: $edges}, predicate_id: {_eq: $uses}}, limit: $limit) {
8845
- object {
8846
- term_id
8847
- label
8848
- data
8849
- }
8850
- }
8851
- }`;
8852
- var AGENT_IDENTITIES_QUERY = `query AgentIdentities($atoms: [String!]!, $sameAs: String!, $limit: Int!) {
8853
- triples(where: {subject_id: {_in: $atoms}, predicate_id: {_eq: $sameAs}}, limit: $limit) {
8854
- subject_id
8855
- subject {
8856
- data
8857
- }
8858
- object {
8859
- label
8860
- value {
8861
- thing {
8862
- name
8863
- }
8864
- }
8865
- }
8866
- }
8867
- }`;
8868
- var ATTACHED_DOCUMENTS_QUERY = `query AttachedDocuments($term: String!, $inContextOf: String!, $creators: [String!]!, $limit: Int!) {
8869
- others: triples_aggregate(where: {predicate_id: {_eq: $inContextOf}, object_id: {_eq: $term}, creator_id: {_nin: $creators}}) {
8870
- aggregate {
8871
- count
8872
- }
8873
- }
8874
- triples(where: {predicate_id: {_eq: $inContextOf}, object_id: {_eq: $term}, creator_id: {_in: $creators}}, order_by: {created_at: asc}, limit: $limit) {
8875
- creator_id
8876
- subject {
8877
- data
8878
- value {
8879
- json_object {
8880
- data
8881
- }
8882
- }
8883
- }
8884
- }
8885
- }`;
8886
- var IDENTITY_CLAIMS_QUERY = `query IdentityClaims($caip19: String!, $sameAs: String!, $limit: Int!) {
8887
- triples(where: {predicate_id: {_eq: $sameAs}, object: {label: {_eq: $caip19}}}, limit: $limit) {
8888
- creator_id
8889
- subject {
8890
- term_id
8891
- data
8892
- }
8893
- }
8894
- }`;
8895
- var PULSE_EDGE_WRITERS_QUERY = `query PulseEdgeWriters($edges: [String!]!, $limit: Int!) {
8896
- triples(where: {term_id: {_in: $edges}}, limit: $limit) {
8897
- term_id
8898
- creator_id
8899
- }
8900
- }`;
8901
- var ENDPOINT_SUBJECTS_QUERY = `query EndpointSubjects($hasEndpoint: String!, $limit: Int!) {
8902
- triples(where: {predicate_id: {_eq: $hasEndpoint}}, order_by: {created_at: desc}, limit: $limit) {
8903
- subject_id
8904
- subject {
8905
- label
8906
- }
8907
- }
8908
- }`;
8909
- // ../../packages/graphql/dist/queries/tool-usage.js
8910
- var VAULT_SIDE2 = `
8911
- total_market_cap
8912
- total_assets
8913
- vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) {
8914
- market_cap
8915
- total_assets
8916
- total_shares
8917
- current_share_price
8918
- position_count
8919
- }`;
8920
- var TOOL_USAGE_QUERY = `
8921
- query ToolUsage($toolId: String!, $uses: String!, $curveId: numeric!) {
8922
- tool: atoms(where: {term_id: {_eq: $toolId}}, limit: 1) {
8923
- term_id
8924
- label
8925
- data
8926
- }
8927
- triples(where: {predicate_id: {_eq: $uses}, object_id: {_eq: $toolId}}, limit: 200) {
8928
- term_id
8929
- subject {
8930
- term_id
8931
- label
8932
- type
8933
- }
8934
- term { ${VAULT_SIDE2} }
8935
- counter_term { ${VAULT_SIDE2} }
8936
- }
8937
- }`;
8938
- var ATTESTED_TOOL_USAGE_QUERY = `
8939
- query AttestedToolUsage($toolId: String!, $uses: String!, $curveId: numeric!, $attestor: String!) {
8940
- tool: atoms(where: {term_id: {_eq: $toolId}}, limit: 1) {
8941
- term_id
8942
- label
8943
- data
8944
- }
8945
- triples(where: {
8946
- predicate_id: {_eq: $uses},
8947
- object_id: {_eq: $toolId},
8948
- term: {positions: {account_id: {_eq: $attestor}}}
8949
- }, limit: 200) {
8950
- term_id
8951
- subject {
8952
- term_id
8953
- label
8954
- type
8955
- }
8956
- term { ${VAULT_SIDE2} }
8957
- counter_term { ${VAULT_SIDE2} }
8958
- }
8959
- }`;
8960
- // ../../packages/graphql/dist/queries/x402-feed.js
8961
- var LEVEL = `term_id
8962
- subject_id
8963
- predicate_id
8964
- creator_id
8965
- created_at
8966
- subject {
8967
- term_id
8968
- label
8969
- }
8970
- object {
8971
- term_id
8972
- label
8973
- data
8974
- value {
8975
- thing {
8976
- url
8977
- }
8978
- }
8979
- }
8980
- positions(where: {shares: {_gt: "0"}}) {
8981
- account_id
8982
- }`;
8983
- var X402_PAYMENT_LEVELS_QUERY = `query X402PaymentLevels($paidWith: String!, $limit: Int!, $offset: Int!) {
8984
- triples(where: {predicate_id: {_eq: $paidWith}}, order_by: {term_id: asc}, limit: $limit, offset: $offset) {
8985
- ${LEVEL}
8986
- }
8987
- }`;
8988
- var X402_LEVELS_BY_ID_QUERY = `query X402LevelsById($ids: [String!]!, $limit: Int!) {
8989
- triples(where: {term_id: {_in: $ids}}, limit: $limit) {
8990
- ${LEVEL}
8991
- }
8992
- }`;
8993
- var X402_REASONS_QUERY = `query X402Reasons($ids: [String!]!, $because: String!, $limit: Int!) {
8994
- triples(where: {subject_id: {_in: $ids}, predicate_id: {_eq: $because}}, order_by: {term_id: asc}, limit: $limit) {
8995
- ${LEVEL}
8996
- }
8997
- }`;
8998
- // ../../packages/protocol/dist/declare/tool-atom.js
8999
- function intuitionToolAtomLookup(config) {
9000
- const transport = config.transport ?? createGraphqlTransport({
9001
- url: config.graphqlUrl,
9002
- fetch: config.fetch ?? defaultFetch(),
9003
- ...config.timeoutMs === undefined ? {} : { timeoutMs: config.timeoutMs }
9004
- });
9005
- return {
9006
- async findByUrl(url) {
9007
- const data = await transport.request(BY_URL_QUERY, { url });
9008
- const rows = Array.isArray(data["atoms"]) ? data["atoms"] : [];
9009
- const candidates = [];
9010
- for (const row of rows) {
9011
- if (!isRecord(row))
9012
- continue;
9013
- const termId = readString(row, "term_id");
9014
- if (termId === null)
9015
- continue;
9016
- candidates.push({
9017
- termId,
9018
- label: readString(row, "label"),
9019
- uri: readString(row, "data")
9020
- });
9021
- }
9022
- return candidates;
9023
- }
9024
- };
9025
- }
9026
- function derivesItsOwnAtom(uri) {
9027
- return /^(ipfs|ar):\/\//i.test(uri.trim());
9028
- }
9029
-
9030
- // ../../packages/protocol/dist/declare/thing-cid.js
9031
- function thingDocument(thing) {
9032
- return JSON.stringify({
9033
- "@context": "https://schema.org",
9034
- "@type": "Thing",
9035
- description: thing.description,
9036
- image: thing.image,
9037
- name: thing.name,
9038
- url: thing.url
9039
- });
9040
- }
9041
- function base32(bytes) {
9042
- const alphabet = "abcdefghijklmnopqrstuvwxyz234567";
9043
- let bits = 0;
9044
- let value = 0;
9045
- let out = "";
9046
- for (const byte of bytes) {
9047
- value = value << 8 | byte;
9048
- bits += 8;
9049
- while (bits >= 5) {
9050
- out += alphabet[value >>> bits - 5 & 31];
9051
- bits -= 5;
9052
- }
9053
- }
9054
- if (bits > 0)
9055
- out += alphabet[value << 5 - bits & 31];
9056
- return out;
9057
- }
9058
- function thingUriOfDigest(digest) {
9059
- const cid = new Uint8Array(4 + digest.length);
9060
- cid.set([1, 85, 18, 32]);
9061
- cid.set(digest, 4);
9062
- return `ipfs://b${base32(cid)}`;
9063
- }
9064
-
9065
- // ../../packages/protocol/dist/declare/agent-atom.js
9066
- function canonicalAgentThing(chainId, tokenId, registration) {
9067
- const normalize = (value) => {
9068
- if (typeof value !== "string")
9069
- return null;
9070
- const trimmed = value.trim();
9071
- return trimmed.length > 0 ? trimmed : null;
9072
- };
9073
- const agentKey = `${chainId}:${tokenId}`;
9074
- return {
9075
- name: normalize(registration?.name) ?? `Agent ${agentKey}`,
9076
- description: normalize(registration?.description) ?? `ERC-8004 agent ${agentKey}`,
9077
- image: normalize(registration?.image) ?? "",
9078
- url: normalize(registration?.webEndpoint) ?? `https://8004scan.io/agents/${chainId}/${tokenId}`
9079
- };
9080
- }
9081
- function thingUri(thing) {
9082
- return thingUriOfDigest(toBytes(sha256(toBytes(thingDocument(thing)))));
9083
- }
9084
-
9085
- // ../../packages/protocol/dist/declare/tool-thing.js
9086
- class InvalidToolUrlError extends Error {
9087
- input;
9088
- constructor(input, why) {
9089
- super(`${JSON.stringify(input)} is not a usable tool URL: ${why}`);
9090
- this.name = "InvalidToolUrlError";
9091
- this.input = input;
9092
- }
9093
- }
9094
- var TOOL_THING_DESCRIPTION = "A tool identified by its URL, so every declaration of its use lands on one atom.";
9095
- function normaliseToolUrl(input) {
9096
- const trimmed = input.trim();
9097
- if (trimmed.length === 0)
9098
- throw new InvalidToolUrlError(input, "empty");
9099
- const withScheme = /^[a-z][a-z0-9+.-]*:/i.test(trimmed) ? trimmed : `https://${trimmed}`;
9100
- let url;
9101
- try {
9102
- url = new URL(withScheme);
9103
- } catch {
9104
- throw new InvalidToolUrlError(input, "not parseable as a URL");
9105
- }
9106
- if (url.protocol !== "http:" && url.protocol !== "https:") {
9107
- throw new InvalidToolUrlError(input, `scheme ${url.protocol} is not http or https`);
9108
- }
9109
- if (url.hostname.length === 0)
9110
- throw new InvalidToolUrlError(input, "no host");
9111
- const host = url.hostname.replace(/\.+$/, "").replace(/^(?:www\.)+/, "");
9112
- const path = url.pathname.replace(/(?:\.git|\/)+$/, "");
9113
- const params = [...new URLSearchParams(url.search).entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
9114
- const query = params.length === 0 ? "" : `?${new URLSearchParams(params).toString()}`;
9115
- const port = url.port === "" || url.port === "80" || url.port === "443" ? "" : `:${url.port}`;
9116
- return `https://${host}${port}${path}${query}`;
9117
- }
9118
- function toolThing(url) {
9119
- const normalised = normaliseToolUrl(url);
9120
- return {
9121
- name: normalised.slice("https://".length),
9122
- description: TOOL_THING_DESCRIPTION,
9123
- image: "",
9124
- url: normalised
9125
- };
9126
- }
9127
- function toolAtomUri(url) {
9128
- return thingUri(toolThing(url));
9129
- }
9130
- function toolThingDocument(url) {
9131
- return thingDocument(toolThing(url));
9132
- }
9133
- function isToolUrl(uri) {
9134
- try {
9135
- normaliseToolUrl(uri);
9136
- return true;
9137
- } catch {
9138
- return false;
9139
- }
9140
- }
9141
-
9142
- // ../../packages/protocol/dist/declare/plan.js
9143
- class EmptyPlanError extends Error {
9144
- constructor(what) {
9145
- super(`nothing to plan: ${what}`);
9146
- this.name = "EmptyPlanError";
9147
- }
9148
- }
9149
-
9150
- class NonPositiveAmountError extends Error {
9151
- tripleId;
9152
- constructor(tripleId, amount) {
9153
- super(`a deposit of ${amount} on ${tripleId} would put nothing behind the claim; ` + `an edge with no stake carries no weight at all (docs/14)`);
9154
- this.name = "NonPositiveAmountError";
9155
- this.tripleId = tripleId;
9156
- }
9157
- }
9158
-
9159
- class AmbiguousToolAtomError extends Error {
9160
- uri;
9161
- candidates;
9162
- constructor(uri, candidates) {
9163
- super(`${candidates.length} atoms already claim ${uri} — ` + candidates.map((c) => `${c.termId} (${c.label ?? "no label"})`).join(", ") + `. Refusing to choose: a \`uses\` edge on the wrong one is permanent. ` + `Pass the \`ipfs://\` URI of the atom you mean.`);
9164
- this.name = "AmbiguousToolAtomError";
9165
- this.uri = uri;
9166
- this.candidates = candidates;
9167
- }
9168
- }
9169
-
9170
- class BelowMinDepositError extends Error {
9171
- tripleId;
9172
- constructor(tripleId, amount, minDeposit) {
9173
- super(`a deposit of ${amount} wei on ${tripleId} is below the protocol's minimum of ` + `${minDeposit} wei on this chain. The floor is chain state and differs 10× between ` + `mainnet and testnet, so an amount that works on one may not on the other.`);
9174
- this.name = "BelowMinDepositError";
9175
- this.tripleId = tripleId;
8608
+ }
8609
+
8610
+ class BelowMinDepositError extends Error {
8611
+ tripleId;
8612
+ constructor(tripleId, amount, minDeposit) {
8613
+ super(`a deposit of ${amount} wei on ${tripleId} is below the protocol's minimum of ` + `${minDeposit} wei on this chain. The floor is chain state and differs 10× between ` + `mainnet and testnet, so an amount that works on one may not on the other.`);
8614
+ this.name = "BelowMinDepositError";
8615
+ this.tripleId = tripleId;
9176
8616
  }
9177
8617
  }
9178
8618
 
@@ -9211,6 +8651,7 @@ async function resolveToolAtom(uri, reads, lookup) {
9211
8651
  });
9212
8652
  }
9213
8653
  const normalised = normaliseToolUrl(uri);
8654
+ assertPublishableToolUrl(normalised);
9214
8655
  if (lookup !== undefined) {
9215
8656
  const candidates = await findExistingToolAtoms(lookup, uri, normalised);
9216
8657
  if (candidates.length > 1)
@@ -9834,50 +9275,6 @@ async function resolveIdentityAtomStrict(params) {
9834
9275
  throw error;
9835
9276
  }
9836
9277
  }
9837
- // ../../packages/protocol/dist/arp/x402-networks.js
9838
- var X402_DEFAULT_NETWORKS = new Map([
9839
- [
9840
- "eip155:8453",
9841
- { assets: [getAddress("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913")], rpcUrl: "https://mainnet.base.org" }
9842
- ]
9843
- ]);
9844
-
9845
- // ../../packages/protocol/dist/arp/chains.js
9846
- var intuitionTestnet = defineChain2({
9847
- id: 13579,
9848
- name: "Intuition Testnet",
9849
- nativeCurrency: { decimals: 18, name: "Test Trust", symbol: "tTRUST" },
9850
- rpcUrls: {
9851
- default: { http: ["https://testnet.rpc.intuition.systems/http"] }
9852
- },
9853
- blockExplorers: {
9854
- default: {
9855
- name: "Intuition Testnet Explorer",
9856
- url: "https://testnet.explorer.intuition.systems"
9857
- }
9858
- },
9859
- testnet: true
9860
- });
9861
- var intuitionMainnet = defineChain2({
9862
- id: 1155,
9863
- name: "Intuition",
9864
- nativeCurrency: { decimals: 18, name: "Intuition", symbol: "TRUST" },
9865
- rpcUrls: {
9866
- default: { http: ["https://rpc.intuition.systems/http"] }
9867
- },
9868
- blockExplorers: {
9869
- default: {
9870
- name: "Intuition Explorer",
9871
- url: "https://explorer.intuition.systems"
9872
- }
9873
- }
9874
- });
9875
- // ../../packages/protocol/dist/arp/attestors.js
9876
- var ARP_DOMAIN_ATTESTORS = [
9877
- "0x906f3A52ec089f8D4E9127F91C6bE5Ae0d18f91f",
9878
- "0xE596096F4176b682E300d73963e7B04B383C1AA1",
9879
- "0x77939A4c276f3E549276CEB3A09CDa1fF58b7ec9"
9880
- ];
9881
9278
  // ../../packages/protocol/dist/x402-payment.js
9882
9279
  var PAID_WITH_LABEL = "paid with";
9883
9280
  var TRANSFER_TOPIC = keccak256(stringToBytes("Transfer(address,address,uint256)"));
@@ -9965,6 +9362,56 @@ function x402Reading(networks, env) {
9965
9362
  };
9966
9363
  }
9967
9364
 
9365
+ // ../../packages/protocol/dist/arp/x402-networks.js
9366
+ var X402_DEFAULT_NETWORKS = new Map([
9367
+ [
9368
+ "eip155:8453",
9369
+ { assets: [getAddress("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913")], rpcUrl: "https://mainnet.base.org" }
9370
+ ]
9371
+ ]);
9372
+ var X402_TEST_NETWORKS = new Map([
9373
+ [
9374
+ "eip155:84532",
9375
+ { assets: [getAddress("0x036CbD53842c5426634e7929541eC2318f3dCF7e")], rpcUrl: "https://sepolia.base.org" }
9376
+ ]
9377
+ ]);
9378
+
9379
+ // ../../packages/protocol/dist/arp/chains.js
9380
+ var intuitionTestnet = defineChain2({
9381
+ id: 13579,
9382
+ name: "Intuition Testnet",
9383
+ nativeCurrency: { decimals: 18, name: "Test Trust", symbol: "tTRUST" },
9384
+ rpcUrls: {
9385
+ default: { http: ["https://testnet.rpc.intuition.systems/http"] }
9386
+ },
9387
+ blockExplorers: {
9388
+ default: {
9389
+ name: "Intuition Testnet Explorer",
9390
+ url: "https://testnet.explorer.intuition.systems"
9391
+ }
9392
+ },
9393
+ testnet: true
9394
+ });
9395
+ var intuitionMainnet = defineChain2({
9396
+ id: 1155,
9397
+ name: "Intuition",
9398
+ nativeCurrency: { decimals: 18, name: "Intuition", symbol: "TRUST" },
9399
+ rpcUrls: {
9400
+ default: { http: ["https://rpc.intuition.systems/http"] }
9401
+ },
9402
+ blockExplorers: {
9403
+ default: {
9404
+ name: "Intuition Explorer",
9405
+ url: "https://explorer.intuition.systems"
9406
+ }
9407
+ }
9408
+ });
9409
+ // ../../packages/protocol/dist/arp/attestors.js
9410
+ var ARP_DOMAIN_ATTESTORS = [
9411
+ "0x906f3A52ec089f8D4E9127F91C6bE5Ae0d18f91f",
9412
+ "0xE596096F4176b682E300d73963e7B04B383C1AA1",
9413
+ "0x77939A4c276f3E549276CEB3A09CDa1fF58b7ec9"
9414
+ ];
9968
9415
  // ../../packages/protocol/dist/tool-listing.js
9969
9416
  var INTUITION_MAX_PAGE = 250;
9970
9417
  var DEFAULT_EDGE_LIMIT = INTUITION_MAX_PAGE;
@@ -10410,6 +9857,30 @@ function domainInText(text, words) {
10410
9857
  return alias === undefined ? null : words.aliases[alias];
10411
9858
  }
10412
9859
 
9860
+ // ../../packages/protocol/dist/sharing-state.js
9861
+ var SHARING_HOWS = ["init", "command", "desktop", "asked-once", "asked-always", "asked-no"];
9862
+ function sharingChoiceOf(text) {
9863
+ if (text === null)
9864
+ return null;
9865
+ try {
9866
+ const parsed = JSON.parse(text);
9867
+ if (typeof parsed !== "object" || parsed === null)
9868
+ return { on: false, at: null, how: null };
9869
+ const { failures, at, how } = parsed;
9870
+ return {
9871
+ on: failures === true,
9872
+ at: typeof at === "string" ? at : null,
9873
+ how: typeof how === "string" && SHARING_HOWS.includes(how) ? how : null
9874
+ };
9875
+ } catch {
9876
+ return { on: false, at: null, how: null };
9877
+ }
9878
+ }
9879
+ function sharingFileText(on, how, at) {
9880
+ return `${JSON.stringify({ failures: on, at: at.toISOString(), how })}
9881
+ `;
9882
+ }
9883
+
10413
9884
  // ../../packages/protocol/dist/declare/line-need.js
10414
9885
  var NEEDS_LABEL2 = "needs";
10415
9886
  var WITH_LABEL2 = "with";
@@ -12654,9 +12125,45 @@ var COMMON = new Set(("awk bash break bun case cat cd chmod command continue cp
12654
12125
  var INSTALL = /\b(?:npm\s+(?:i|install)\s+(?:-g|--global)|pnpm\s+add\s+-g|yarn\s+global\s+add|brew\s+install|pipx\s+install|pip3?\s+install|cargo\s+install)\s+([@a-z0-9][@\w./-]*)/i;
12655
12126
  var PROBE = /\b(?:command\s+-v|which)\s+([a-z][\w-]*)/i;
12656
12127
  var COMMAND = /^[a-z][a-z0-9_-]*$/;
12128
+ function shellSegments(line) {
12129
+ const segments = [];
12130
+ let current = "";
12131
+ let quote = null;
12132
+ for (let index2 = 0;index2 < line.length; index2 += 1) {
12133
+ const char = line[index2] ?? "";
12134
+ if (char === "\\" && quote !== "'") {
12135
+ current += char + (line[index2 + 1] ?? "");
12136
+ index2 += 1;
12137
+ continue;
12138
+ }
12139
+ if (quote !== null) {
12140
+ if (char === quote)
12141
+ quote = null;
12142
+ current += char;
12143
+ continue;
12144
+ }
12145
+ if (char === '"' || char === "'") {
12146
+ quote = char;
12147
+ current += char;
12148
+ continue;
12149
+ }
12150
+ if (char === "#" && (index2 === 0 || /\s/.test(line[index2 - 1] ?? "")))
12151
+ break;
12152
+ if (char === "|" || char === ";" || char === "&" && line[index2 + 1] === "&") {
12153
+ segments.push(current);
12154
+ current = "";
12155
+ if (line[index2 + 1] === char)
12156
+ index2 += 1;
12157
+ continue;
12158
+ }
12159
+ current += char;
12160
+ }
12161
+ segments.push(current);
12162
+ return segments;
12163
+ }
12657
12164
  function commandsIn(shell, explicitOnly) {
12658
12165
  const found = [];
12659
- for (const segment of shell.split(/&&|\|\||[|;]/)) {
12166
+ for (const segment of shellSegments(shell)) {
12660
12167
  const line = segment.trim().replace(/^\$\s+/, "");
12661
12168
  if (line === "" || line.startsWith("#"))
12662
12169
  continue;
@@ -12691,7 +12198,7 @@ function shellLinesRun(lines) {
12691
12198
  run.push(line);
12692
12199
  continued = line.trimEnd().endsWith("\\");
12693
12200
  heredocEnd = /<<-?\s*['"]?([A-Za-z_]+)/.exec(line)?.[1] ?? null;
12694
- for (const char of line) {
12201
+ for (const char of quote === null ? shellSegments(line).join(";") : line) {
12695
12202
  if (quote === null && (char === '"' || char === "'"))
12696
12203
  quote = char;
12697
12204
  else if (char === quote)
@@ -12744,6 +12251,223 @@ function readRequires(markdown) {
12744
12251
  return { cli, runs, login: null, description };
12745
12252
  }
12746
12253
 
12254
+ // ../../packages/protocol/dist/skill-needs.js
12255
+ var MARKDOWN = /\.(md|mdx|markdown)$/i;
12256
+ var SCRIPT = /\.(sh|bash|zsh|py|js|mjs|cjs|ts|rb|pl|ps1|php|lua)$/i;
12257
+ var COMMENT_LINE = /^\s*(?:#|\/\/|\*|--|;|rem\s)/i;
12258
+ function isTestFile(path) {
12259
+ return /(^|\/)(tests?|__tests__|spec|fixtures?)\/|\.(test|spec)\.[a-z]+$|(^|\/)test_[^/]+\.py$|_test\.(py|go|rb)$/i.test(path);
12260
+ }
12261
+ function isSecretName(name) {
12262
+ return /(^|_)(API_?KEY|KEY|TOKEN|SECRET|PASSWORD|PASSWD|PASS|CREDENTIALS|CREDS)$/.test(name);
12263
+ }
12264
+ var SET_IN_SKILL_MD = /(?:^|\s|`)(?:export\s+|set\s+|\$env:)?([A-Z][A-Z0-9_]{2,})=/g;
12265
+ function lineAt(text, index2) {
12266
+ let line = 1;
12267
+ for (let at = text.indexOf(`
12268
+ `);at !== -1 && at < index2; at = text.indexOf(`
12269
+ `, at + 1))
12270
+ line += 1;
12271
+ return line;
12272
+ }
12273
+ function keysIn(files, settings) {
12274
+ const skillMd = files.find((file) => file.path === "SKILL.md");
12275
+ const toSet = new Set;
12276
+ if (skillMd !== undefined)
12277
+ for (const match of skillMd.text.matchAll(SET_IN_SKILL_MD))
12278
+ toSet.add(match[1] ?? "");
12279
+ const wanted = new Set(settings.filter((name) => isSecretName(name) || toSet.has(name)));
12280
+ const ordered = [
12281
+ ...skillMd === undefined ? [] : [skillMd],
12282
+ ...files.filter((file) => file.path !== "SKILL.md" && !isTestFile(file.path))
12283
+ ];
12284
+ const found = new Map;
12285
+ for (const file of ordered) {
12286
+ for (const [index2, line] of file.text.split(`
12287
+ `).entries()) {
12288
+ for (const match of line.matchAll(/\b[A-Z][A-Z0-9_]{2,}\b/g)) {
12289
+ const name = match[0];
12290
+ if (!wanted.has(name) || found.has(name))
12291
+ continue;
12292
+ found.set(name, { name, why: isSecretName(name) ? "secret" : "set in SKILL.md", file: file.path, line: index2 + 1 });
12293
+ }
12294
+ }
12295
+ }
12296
+ return [...found.values()].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
12297
+ }
12298
+ var EVERYWHERE = new Set("sh bash zsh dash env cat ls echo printf mkdir rm cp mv ln grep sed awk tr cut head tail sort uniq wc find xargs test true false base64 date sleep chmod touch tee kill ps uname which open xdg-open cmd powershell pwsh taskkill taskkill.exe where where.exe".split(" "));
12299
+ var ALIASES = {
12300
+ soffice: "LibreOffice",
12301
+ libreoffice: "LibreOffice",
12302
+ "google-chrome": "Chrome",
12303
+ chromium: "Chrome",
12304
+ "chromium-browser": "Chrome",
12305
+ magick: "ImageMagick",
12306
+ convert: "ImageMagick",
12307
+ pdftoppm: "poppler",
12308
+ pdftotext: "poppler",
12309
+ python: "python3",
12310
+ docker: "Docker"
12311
+ };
12312
+ var SPAWNS = [
12313
+ /\b(?:execFileSync|execFile|spawnSync|spawn|execaSync|execa)\(\s*["'`]([a-z][\w.+-]*)["'`]/g,
12314
+ /\b(?:execSync|exec)\(\s*["'`]([a-z][\w.+-]*)[\s"'`]/g,
12315
+ /\bBun\.spawn(?:Sync)?\(\s*\[\s*["'`]([a-z][\w.+-]*)["'`]/g,
12316
+ /\bnew\s+Deno\.Command\(\s*["'`]([a-z][\w.+-]*)["'`]/g,
12317
+ /\bsubprocess\.(?:run|call|check_call|check_output|Popen)\(\s*\[\s*["']([a-z][\w.+-]*)["']/g,
12318
+ /\bsubprocess\.(?:run|call|check_call|check_output|Popen)\(\s*["']([a-z][\w.+-]*)[\s"']/g,
12319
+ /\bos\.(?:system|popen)\(\s*["']([a-z][\w.+-]*)[\s"']/g
12320
+ ];
12321
+ var DRIVES = {
12322
+ puppeteer: "Chrome",
12323
+ "puppeteer-core": "Chrome",
12324
+ "chrome-launcher": "Chrome",
12325
+ "chrome-remote-interface": "Chrome",
12326
+ pyppeteer: "Chrome",
12327
+ playwright: "a Playwright browser",
12328
+ "playwright-core": "a Playwright browser",
12329
+ "@playwright/test": "a Playwright browser",
12330
+ "selenium-webdriver": "a browser and its driver",
12331
+ selenium: "a browser and its driver",
12332
+ "fluent-ffmpeg": "ffmpeg",
12333
+ "ffmpeg-python": "ffmpeg",
12334
+ ffmpeg: "ffmpeg",
12335
+ pydub: "ffmpeg",
12336
+ moviepy: "ffmpeg",
12337
+ "openai-whisper": "ffmpeg",
12338
+ whisper: "ffmpeg",
12339
+ pytesseract: "tesseract",
12340
+ "node-tesseract-ocr": "tesseract",
12341
+ pdf2image: "poppler",
12342
+ "pdf-poppler": "poppler",
12343
+ wand: "ImageMagick",
12344
+ gm: "ImageMagick",
12345
+ pypandoc: "pandoc",
12346
+ "node-pandoc": "pandoc",
12347
+ docker: "Docker",
12348
+ dockerode: "Docker"
12349
+ };
12350
+ var IMPORTS = [
12351
+ /\bfrom\s+["']([@\w./-]+)["']/g,
12352
+ /\bimport\s*\(\s*["']([@\w./-]+)["']\s*\)/g,
12353
+ /\bimport\s+["']([@\w./-]+)["']/g,
12354
+ /\brequire\(\s*["']([@\w./-]+)["']\s*\)/g,
12355
+ /^\s*(?:from\s+([\w.]+)\s+import|import\s+([\w.]+))/gm
12356
+ ];
12357
+ function packageRoot(specifier) {
12358
+ if (specifier.startsWith("@"))
12359
+ return specifier.split("/").slice(0, 2).join("/");
12360
+ return specifier.split("/")[0]?.split(".")[0] ?? specifier;
12361
+ }
12362
+ var NAMED_PROGRAMS = [
12363
+ { name: "ffmpeg", pattern: /\bffmpeg\b/i },
12364
+ { name: "ffprobe", pattern: /\bffprobe\b/i },
12365
+ { name: "Chrome", pattern: /\b(?:Google Chrome|Chrome|Chromium|chrome-headless-shell|google-chrome|chromium-browser)\b/ },
12366
+ { name: "Docker", pattern: /\b[Dd]ocker\b/ },
12367
+ { name: "git", pattern: /\bgit\b(?!\s*(?:hub|lab))/ },
12368
+ { name: "jq", pattern: /\bjq\b/ },
12369
+ { name: "pandoc", pattern: /\bpandoc\b/i },
12370
+ { name: "ImageMagick", pattern: /\b(?:ImageMagick|imagemagick|magick)\b/ },
12371
+ { name: "yt-dlp", pattern: /\byt-dlp\b/ },
12372
+ { name: "tesseract", pattern: /\btesseract\b/i },
12373
+ { name: "poppler", pattern: /\b(?:poppler|pdftoppm|pdftotext)\b/i },
12374
+ { name: "LibreOffice", pattern: /\b(?:LibreOffice|libreoffice|soffice)\b/ },
12375
+ { name: "sox", pattern: /\bsox\b/ },
12376
+ { name: "exiftool", pattern: /\bexiftool\b/i },
12377
+ { name: "ollama", pattern: /\b[Oo]llama\b/ },
12378
+ { name: "gh", pattern: /\bgh\s+(?:CLI|cli)\b|\bGitHub CLI\b/ },
12379
+ { name: "python3", pattern: /\b[Pp]ython\s?3?\b(?![-.\w])/ },
12380
+ { name: "node", pattern: /\b(?:Node\.js|node)\b(?![-.\w])/ },
12381
+ { name: "Java", pattern: /\b(?:Java|JDK|JRE)\b/ }
12382
+ ];
12383
+ var NEEDED = /\b(?:requires?|required|requirements?|needs?|needed|prerequisites?|depends on|must (?:be )?install(?:ed)?|must have|install(?:ed)? first|has to be installed|be installed)\b/i;
12384
+ var NEEDED_GLOBAL = new RegExp(NEEDED.source, "gi");
12385
+ var NOT_NEEDED = /\b(?:no|not|never|without|doesn't|don't|isn't|aren't|zero)\b[^.;]{0,30}\b(?:requires?|required|needs?|needed|install)/i;
12386
+ var NOT_AFTER = /\b(?:requires?|needs?)\s+(?:no|nothing|neither)\b/i;
12387
+ function saysWhatItNeeds(path, isScript) {
12388
+ if (isScript)
12389
+ return true;
12390
+ if (!MARKDOWN.test(path))
12391
+ return false;
12392
+ const base2 = path.slice(path.lastIndexOf("/") + 1).toLowerCase();
12393
+ return base2 === "skill.md" || /^(readme|requirements?|prerequisites?|setup|install(ation)?|dependencies|getting-started)\b/.test(base2);
12394
+ }
12395
+ var COMMENT_OR_STRING = /^\s*(?:#|\/\/|\*|\/\*|"""|''')|["'`][^"'`]*\b(?:requires?|needs?|install)/i;
12396
+ function namedAfterVerb(line, program) {
12397
+ for (const verb of line.matchAll(NEEDED_GLOBAL)) {
12398
+ const at = verb.index;
12399
+ const after = line.slice(at + verb[0].length).slice(0, 40).split(/[.;:!?](?:\s|$)/)[0] ?? "";
12400
+ const before = line.slice(Math.max(0, at - 30), at).split(/[.;:!?](?:\s|$)/).at(-1) ?? "";
12401
+ if (program.test(after) || program.test(before))
12402
+ return true;
12403
+ }
12404
+ return false;
12405
+ }
12406
+ function programsNeededIn(files) {
12407
+ const out = new Map;
12408
+ const add = (program) => {
12409
+ if (!out.has(program.name))
12410
+ out.set(program.name, program);
12411
+ };
12412
+ for (const file of files) {
12413
+ if (isTestFile(file.path))
12414
+ continue;
12415
+ const lines = file.text.split(`
12416
+ `);
12417
+ const isScript = SCRIPT.test(file.path) || lines[0]?.startsWith("#!") === true;
12418
+ if (isScript && !/\.(sh|bash|zsh)$/i.test(file.path)) {
12419
+ for (const pattern of SPAWNS) {
12420
+ for (const match of file.text.matchAll(pattern)) {
12421
+ const name = match[1] ?? "";
12422
+ const line = lineAt(file.text, match.index);
12423
+ if (name === "" || EVERYWHERE.has(name) || COMMENT_LINE.test(lines[line - 1] ?? ""))
12424
+ continue;
12425
+ add({ name: ALIASES[name] ?? name, from: "spawned", file: file.path, line });
12426
+ }
12427
+ }
12428
+ for (const pattern of IMPORTS) {
12429
+ for (const match of file.text.matchAll(pattern)) {
12430
+ const root2 = packageRoot(match[1] ?? match[2] ?? "");
12431
+ const driven = DRIVES[root2];
12432
+ const line = lineAt(file.text, match.index);
12433
+ if (driven === undefined || COMMENT_LINE.test(lines[line - 1] ?? ""))
12434
+ continue;
12435
+ add({ name: driven, from: "package", file: file.path, line, via: root2 });
12436
+ }
12437
+ }
12438
+ }
12439
+ if (/(^|\/)package\.json$/.test(file.path)) {
12440
+ for (const [index2, line] of lines.entries()) {
12441
+ const name = /^\s*"(@?[\w./-]+)"\s*:\s*"/.exec(line)?.[1];
12442
+ const driven = name === undefined ? undefined : DRIVES[name];
12443
+ if (driven !== undefined)
12444
+ add({ name: driven, from: "package", file: file.path, line: index2 + 1, via: name ?? "" });
12445
+ }
12446
+ }
12447
+ if (/(^|\/)requirements[\w.-]*\.txt$/i.test(file.path)) {
12448
+ for (const [index2, line] of lines.entries()) {
12449
+ const name = /^\s*([A-Za-z0-9][\w.-]*)/.exec(line.replace(/#.*/, ""))?.[1]?.toLowerCase();
12450
+ const driven = name === undefined ? undefined : DRIVES[name];
12451
+ if (driven !== undefined)
12452
+ add({ name: driven, from: "package", file: file.path, line: index2 + 1, via: name ?? "" });
12453
+ }
12454
+ }
12455
+ if (saysWhatItNeeds(file.path, isScript)) {
12456
+ for (const [index2, line] of lines.entries()) {
12457
+ if (NOT_NEEDED.test(line) || NOT_AFTER.test(line))
12458
+ continue;
12459
+ if (isScript && !COMMENT_OR_STRING.test(line))
12460
+ continue;
12461
+ for (const { name, pattern } of NAMED_PROGRAMS) {
12462
+ if (namedAfterVerb(line, pattern))
12463
+ add({ name, from: "named as needed", file: file.path, line: index2 + 1 });
12464
+ }
12465
+ }
12466
+ }
12467
+ }
12468
+ return [...out.values()];
12469
+ }
12470
+
12747
12471
  // ../../packages/protocol/dist/skill-contents.js
12748
12472
  var CONTENTS_LIMITS = {
12749
12473
  files: 200,
@@ -12751,8 +12475,8 @@ var CONTENTS_LIMITS = {
12751
12475
  items: 40,
12752
12476
  lineChars: 160
12753
12477
  };
12754
- var SCRIPT = /\.(sh|bash|zsh|py|js|mjs|cjs|ts|rb|pl|ps1|php|lua)$/i;
12755
- var MARKDOWN = /\.(md|mdx|markdown)$/i;
12478
+ var SCRIPT2 = /\.(sh|bash|zsh|py|js|mjs|cjs|ts|rb|pl|ps1|php|lua)$/i;
12479
+ var MARKDOWN2 = /\.(md|mdx|markdown)$/i;
12756
12480
  var FENCE = /^\s*(?:```|~~~)/;
12757
12481
  function contentsFileOf(path, bytes) {
12758
12482
  if (bytes.subarray(0, 8192).includes(0))
@@ -12777,10 +12501,10 @@ function interpreterOf(firstLine) {
12777
12501
  }
12778
12502
  var SCRIPT_PROBE = /(?:^|[;&|(!{]|\bif|\bthen|\$\()\s*(?:!\s*)?(?:command\s+-v|which|type\s+-p|hash)\s+([a-z][\w.+-]*)/g;
12779
12503
  var SYSTEM_INSTALL = /\b(?:brew|apt-get|apt|dnf|yum|apk|pacman|choco|winget|scoop|port)\s+(?:install|add|-S)\s+(?:-\S+\s+)*([a-z][\w.+-]*)/g;
12780
- var COMMENT_LINE = /^\s*(?:#|\/\/|\*|--|;|rem\s)/i;
12504
+ var COMMENT_LINE2 = /^\s*(?:#|\/\/|\*|--|;|rem\s)/i;
12781
12505
  var PYTHON_PROBE = /\bshutil\.which\(\s*["']([a-z][\w.+-]*)["']/g;
12782
12506
  function programsInScriptLine(line, shell) {
12783
- if (COMMENT_LINE.test(line))
12507
+ if (COMMENT_LINE2.test(line))
12784
12508
  return [];
12785
12509
  const matches = shell ? [...line.matchAll(SCRIPT_PROBE), ...line.matchAll(SYSTEM_INSTALL)] : [...line.matchAll(PYTHON_PROBE)];
12786
12510
  return matches.map((match) => match[1] ?? "").filter((name) => name !== "");
@@ -12844,7 +12568,7 @@ function settingsIn(path, text, code) {
12844
12568
  for (const match of text.matchAll(pattern))
12845
12569
  found.add((match[1] ?? "").toUpperCase());
12846
12570
  }
12847
- if (MARKDOWN.test(path)) {
12571
+ if (MARKDOWN2.test(path)) {
12848
12572
  for (const match of text.matchAll(EXPORT_IN_PROSE))
12849
12573
  found.add(match[1] ?? "");
12850
12574
  for (const match of text.matchAll(KEY_NAMED))
@@ -12860,7 +12584,7 @@ function codeOf(path, text, isScript) {
12860
12584
  `);
12861
12585
  if (isScript)
12862
12586
  return lines;
12863
- if (!MARKDOWN.test(path))
12587
+ if (!MARKDOWN2.test(path))
12864
12588
  return [];
12865
12589
  const out = [];
12866
12590
  let fenced = false;
@@ -13033,7 +12757,7 @@ function readSkillContents(input) {
13033
12757
  if (files.length >= CONTENTS_LIMITS.files)
13034
12758
  skipped.push({ path: file.path, why: "over the file limit" });
13035
12759
  else if (file.text === null)
13036
- skipped.push({ path: file.path, why: file.notFetched === true ? "not fetched" : "binary" });
12760
+ skipped.push({ path: file.path, why: file.tooLarge === true ? "too large" : file.notFetched === true ? "not fetched" : "binary" });
13037
12761
  else if (file.text.length > CONTENTS_LIMITS.fileChars)
13038
12762
  skipped.push({ path: file.path, why: "too large" });
13039
12763
  else
@@ -13044,7 +12768,7 @@ function readSkillContents(input) {
13044
12768
  const programs = new Map;
13045
12769
  const add = (name, from14) => {
13046
12770
  if (!programs.has(name))
13047
- programs.set(name, from14);
12771
+ programs.set(name, { name, from: from14 });
13048
12772
  };
13049
12773
  const requires = readRequires(skillMd);
13050
12774
  for (const name of requires.cli)
@@ -13056,11 +12780,11 @@ function readSkillContents(input) {
13056
12780
  const domains = new Set;
13057
12781
  const fetchAndRun = [];
13058
12782
  const hidden = [];
13059
- const scripts = skipped.filter((file) => file.why === "not fetched" && SCRIPT.test(file.path)).map((file) => ({ path: file.path, namedInSkillMd: namesFile(skillMd, file.path) }));
12783
+ const scripts = skipped.filter((file) => file.why === "not fetched" && SCRIPT2.test(file.path)).map((file) => ({ path: file.path, namedInSkillMd: namesFile(skillMd, file.path) }));
13060
12784
  for (const file of files) {
13061
12785
  const lines = file.text.split(`
13062
12786
  `);
13063
- const isScript = SCRIPT.test(file.path) || lines[0]?.startsWith("#!") === true;
12787
+ const isScript = SCRIPT2.test(file.path) || lines[0]?.startsWith("#!") === true;
13064
12788
  const code = codeOf(file.path, file.text, isScript);
13065
12789
  const shell = isShell(file.path, file.text);
13066
12790
  for (const line of code) {
@@ -13093,18 +12817,22 @@ function readSkillContents(input) {
13093
12817
  if (run !== undefined)
13094
12818
  fetchAndRun.push({ kind: run.kind, file: file.path, line: index2 + 1, text: cap(line) });
13095
12819
  }
13096
- if (MARKDOWN.test(file.path))
12820
+ if (MARKDOWN2.test(file.path))
13097
12821
  hidden.push(...hiddenInMarkdown(file.path, file.text));
13098
12822
  }
13099
12823
  const packageNames = new Set([...packages.values()].map((pkg) => pkg.name));
13100
- for (const [name, from14] of programs)
13101
- if (from14 !== "declared" && packageNames.has(name))
12824
+ for (const [name, program] of programs)
12825
+ if (program.from !== "declared" && packageNames.has(name))
13102
12826
  programs.delete(name);
12827
+ for (const needed of programsNeededIn(files))
12828
+ if (!programs.has(needed.name))
12829
+ programs.set(needed.name, needed);
13103
12830
  const cut = [];
13104
12831
  return {
13105
- programs: bounded("programs", [...programs.entries()].map(([name, from14]) => ({ name, from: from14 })).sort((a, b) => compare(a.name, b.name)), cut),
12832
+ programs: bounded("programs", [...programs.values()].sort((a, b) => compare(a.name, b.name)), cut),
13106
12833
  packages: bounded("packages", [...packages.values()].sort((a, b) => compare(`${a.manager} ${a.name}`, `${b.manager} ${b.name}`)), cut),
13107
12834
  settings: bounded("settings", [...settings].sort(compare), cut),
12835
+ keys: bounded("keys", keysIn(files, [...settings]), cut),
13108
12836
  scripts: bounded("scripts", scripts.sort((a, b) => compare(a.path, b.path)), cut),
13109
12837
  fetchAndRun: bounded("fetchAndRun", fetchAndRun, cut),
13110
12838
  domains: bounded("domains", [...domains].sort(compare), cut),
@@ -13117,24 +12845,12 @@ function readSkillContents(input) {
13117
12845
  cut
13118
12846
  };
13119
12847
  }
13120
- function contentsLines(contents, perList = 6) {
13121
- const list = (items, cut) => items.length === 0 ? "none found" : `${items.slice(0, perList).join(", ")}${items.length > perList || cut ? `, and ${Math.max(0, items.length - perList)}${cut ? "+" : ""} more` : ""}`;
13122
- const at = (rows, name) => list(rows.map((row) => `${row.kind} at ${row.file}:${row.line} "${row.text}"`), contents.cut.includes(name));
13123
- return [
13124
- `Programs: ${list(contents.programs.map((p) => `${p.name} (${p.from})`), contents.cut.includes("programs"))}`,
13125
- ...contents.packages.length === 0 ? [] : [`Packages: ${list(contents.packages.map((p) => `${p.manager} ${p.name}`), contents.cut.includes("packages"))}`],
13126
- `Keys and settings it reads: ${list(contents.settings, contents.cut.includes("settings"))}`,
13127
- `Scripts: ${list(contents.scripts.map((s) => s.namedInSkillMd ? `${s.path} (named in SKILL.md)` : s.path), contents.cut.includes("scripts"))}`,
13128
- `Fetches and runs code: ${at(contents.fetchAndRun, "fetchAndRun")}`,
13129
- `Domains named: ${list(contents.domains, contents.cut.includes("domains"))}`,
13130
- `Hidden or encoded text: ${at(contents.hidden, "hidden")}`,
13131
- ...contents.read.skipped.length === 0 ? [] : [`Not read: ${list(contents.read.skipped.map((s) => `${s.path} (${s.why})`), false)}`]
13132
- ];
13133
- }
13134
12848
 
13135
12849
  // ../../packages/protocol/dist/pulse.js
13136
12850
  var MAX_SKILL_FILES_READ = 200;
13137
12851
  var MAX_SCRIPTS_READ = 5;
12852
+ var MAX_DIRECTORY_FILES_READ = 80;
12853
+ var NOT_TEXT = /\.(png|jpe?g|gif|webp|ico|bmp|tiff?|avif|svgz|pdf|zip|gz|tgz|bz2|xz|7z|rar|jar|woff2?|ttf|otf|eot|mp[34]|m4a|wav|ogg|flac|aac|mov|webm|avi|mkv|pptx|docx|xlsx|psd|ai|sketch|fig|db|sqlite|bin|exe|dll|so|dylib|wasm|pyc|class|hdr|exr|glb|ktx2?)$/i;
13138
12854
  var GITHUB_READ_TIMEOUT_MS = 1e4;
13139
12855
  var INSTALLER_ORDER = [
13140
12856
  "",
@@ -13254,7 +12970,7 @@ var PAID_WORD = /\b(pricing|paid|subscription|credits?|billing|free tier|per min
13254
12970
  var HOST = /https?:\/\/([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g;
13255
12971
  var NOT_A_SERVICE = /(^|\.)(github\.com|githubusercontent\.com|example\.(com|org|net))$/;
13256
12972
  var LOOKS_LIKE_A_FILE = /\.(jpe?g|png|gif|webp|mp[34]|wav|mov|webm|pdf|md|json|txt)$/;
13257
- var SCRIPT2 = /\.(sh|bash|py|js|mjs|cjs|ts|rb|pl)$/i;
12973
+ var SCRIPT3 = /\.(sh|bash|py|js|mjs|cjs|ts|rb|pl)$/i;
13258
12974
  var RUNS_FILE = /\b(?:node|bun|deno|tsx|python3?|bash|sh)\s+((?:~|\.{1,2})?\/?[\w.@-]+(?:\/[\w.@-]+)*\.(?:mjs|cjs|js|ts|py|sh))\b/g;
13259
12975
  var PLACEHOLDER = /(^|\/)(path|your|my|foo|example|script|file|input|output)(\/|\.|$)/i;
13260
12976
  function filesItRuns(markdown, repositoryFiles) {
@@ -13284,7 +13000,7 @@ function readSkillFacts(markdown, filesInDirectory, repositoryFiles = filesInDir
13284
13000
  return {
13285
13001
  files: filesInDirectory.length,
13286
13002
  bytes: filesInDirectory.reduce((total, file) => total + file.size, 0),
13287
- scripts: filesInDirectory.filter((file) => SCRIPT2.test(file.path)).length,
13003
+ scripts: filesInDirectory.filter((file) => SCRIPT3.test(file.path)).length,
13288
13004
  keys: [...new Set(markdown.match(KEY_NAME3) ?? [])],
13289
13005
  paidWords: [...new Set((markdown.match(PAID_WORD) ?? []).map((word) => word.toLowerCase()))],
13290
13006
  hosts: [...new Set(hosts)],
@@ -13298,6 +13014,14 @@ function parentOf(path) {
13298
13014
  const at = path.lastIndexOf("/");
13299
13015
  return at === -1 ? "" : path.slice(0, at);
13300
13016
  }
13017
+ var MAX_NAME_READS = 12;
13018
+ var NAME_BATCH = 6;
13019
+ var wordsOf = (text) => text.toLowerCase().split(/[^a-z0-9]+/).filter((word) => word.length > 1);
13020
+ function byNearness(files, wanted) {
13021
+ const words = new Set(wordsOf(wanted));
13022
+ const shared = (file) => wordsOf(parentOf(file.path)).filter((word) => words.has(word)).length;
13023
+ return files.map((file) => ({ file, shared: shared(file) })).sort((a, b) => b.shared - a.shared || (a.file.path < b.file.path ? -1 : a.file.path > b.file.path ? 1 : 0));
13024
+ }
13301
13025
  async function locate(source, repo, skill, listing) {
13302
13026
  const wanted = normaliseName2(skill);
13303
13027
  const candidates = listing.files.filter((file) => skillFilesIn([file]).length === 1);
@@ -13309,12 +13033,18 @@ async function locate(source, repo, skill, listing) {
13309
13033
  if (others.length > MAX_SKILL_FILES_READ) {
13310
13034
  return { status: "incomplete", reason: "too_many_skill_files" };
13311
13035
  }
13312
- for (let at = 0;at < others.length && named.length === 0; at += 20) {
13313
- named = await read(others.slice(at, at + 20));
13036
+ const nearest = byNearness(others, wanted).slice(0, MAX_NAME_READS);
13037
+ const sharing = nearest.filter((entry) => entry.shared > 0).length;
13038
+ let readTo = 0;
13039
+ while (readTo < nearest.length && named.length === 0) {
13040
+ const size7 = readTo < sharing ? sharing - readTo : NAME_BATCH;
13041
+ named = await read(nearest.slice(readTo, readTo + size7).map((entry) => entry.file));
13042
+ readTo += size7;
13314
13043
  }
13315
13044
  if (named.length > 0) {
13316
- const last = others.findIndex((file) => file === named.at(-1)?.file);
13317
- named = [...named, ...await read(others.slice(last + 1))];
13045
+ named = [...named, ...await read(nearest.slice(readTo, sharing).map((entry) => entry.file))];
13046
+ } else if (nearest.length < others.length) {
13047
+ return { status: "incomplete", reason: "too_many_skill_files" };
13318
13048
  }
13319
13049
  }
13320
13050
  if (named.length === 0) {
@@ -13354,7 +13084,24 @@ async function readFileOnly(result, source) {
13354
13084
  }
13355
13085
  return null;
13356
13086
  }
13357
- async function readPulse(result, source) {
13087
+ var SCRIPT_READ_CAP = { files: MAX_SCRIPTS_READ, bytesEach: 256 * 1024, bytes: 512 * 1024 };
13088
+ var NOT_CODE_DIRECTORY = /(^|\/)(examples?|assets?|fonts?|images?|media|samples?|fixtures?)\//i;
13089
+ function withinReadCap(paths, listed) {
13090
+ const sizeOf = new Map(listed.map((file) => [file.path, file.size]));
13091
+ const kept = [];
13092
+ let bytes = 0;
13093
+ for (const path of paths) {
13094
+ const size7 = sizeOf.get(path) ?? 0;
13095
+ if (kept.length >= SCRIPT_READ_CAP.files || NOT_CODE_DIRECTORY.test(path))
13096
+ continue;
13097
+ if (size7 > SCRIPT_READ_CAP.bytesEach || bytes + size7 > SCRIPT_READ_CAP.bytes)
13098
+ continue;
13099
+ kept.push(path);
13100
+ bytes += size7;
13101
+ }
13102
+ return kept;
13103
+ }
13104
+ async function readPulse(result, source, depth) {
13358
13105
  if (!/^(?!\.{1,2}\/)[\w.-]+\/(?!\.{1,2}$)[\w.-]+$/.test(result.source))
13359
13106
  return { ...result, status: "not_github" };
13360
13107
  const listing = await source.listing(result.source);
@@ -13372,15 +13119,20 @@ async function readPulse(result, source) {
13372
13119
  const directory = parentOf(located.file.path);
13373
13120
  const prefix = directory === "" ? "" : `${directory}/`;
13374
13121
  const inDirectory = listing.files.filter((file) => file.path.startsWith(prefix));
13375
- const scripts = filesItRuns(located.markdown, listing.files).slice(0, MAX_SCRIPTS_READ);
13122
+ const scripts = withinReadCap(filesItRuns(located.markdown, listing.files), listing.files);
13376
13123
  const scriptTexts = await Promise.all(scripts.map(async (file) => ({ file, text: await source.file(result.source, file) })));
13377
13124
  const keysInScriptsItRuns = scriptTexts.map(({ file, text }) => ({ file, keys: [...new Set(text?.match(KEY_NAME3) ?? [])] })).filter((entry) => entry.keys.length > 0);
13378
13125
  const relative = (path) => path.startsWith(prefix) ? path.slice(prefix.length) : path;
13379
13126
  const fetched = new Set(scriptTexts.filter((entry) => entry.text !== null).map((entry) => entry.file));
13127
+ const others = depth === undefined ? [] : await readDirectory(source, result.source, inDirectory, new Set([located.file.path, ...fetched]), depth.directory.by);
13128
+ for (const file of others)
13129
+ if (file.text !== null)
13130
+ fetched.add(file.path);
13380
13131
  const contains = readSkillContents([
13381
13132
  { path: "SKILL.md", text: located.markdown },
13382
13133
  ...scriptTexts.flatMap(({ file, text }) => text === null ? [] : [{ path: relative(file), text }]),
13383
- ...inDirectory.filter((file) => SCRIPT2.test(file.path) && !fetched.has(file.path)).map((file) => ({ path: relative(file.path), text: null, notFetched: true }))
13134
+ ...others.flatMap(({ path, text }) => text === null ? [] : [{ path: relative(path), text }]),
13135
+ ...inDirectory.filter((file) => !fetched.has(file.path) && file.path !== located.file.path && (depth !== undefined || SCRIPT3.test(file.path))).map((file) => NOT_TEXT.test(file.path) ? { path: relative(file.path), text: null } : file.size > CONTENTS_LIMITS.fileChars ? { path: relative(file.path), text: null, notFetched: true, tooLarge: true } : { path: relative(file.path), text: null, notFetched: true })
13384
13136
  ]);
13385
13137
  return {
13386
13138
  ...result,
@@ -13397,6 +13149,22 @@ async function readPulse(result, source) {
13397
13149
  contains
13398
13150
  };
13399
13151
  }
13152
+ async function readDirectory(source, repo, inDirectory, done, by) {
13153
+ let late = false;
13154
+ by.then(() => {
13155
+ late = true;
13156
+ });
13157
+ const plan = inDirectory.filter((file) => !done.has(file.path) && !NOT_TEXT.test(file.path) && file.size <= CONTENTS_LIMITS.fileChars).slice(0, MAX_DIRECTORY_FILES_READ);
13158
+ const out = [];
13159
+ for (let at = 0;at < plan.length && !late; at += 8) {
13160
+ const batch = Promise.all(plan.slice(at, at + 8).map(async (file) => ({ path: file.path, text: await source.file(repo, file.path).catch(() => null) })));
13161
+ const settled = await Promise.race([batch, by.then(() => null)]);
13162
+ if (settled === null)
13163
+ break;
13164
+ out.push(...settled);
13165
+ }
13166
+ return out;
13167
+ }
13400
13168
  function groupByContent(pulses) {
13401
13169
  const groups = new Map;
13402
13170
  for (const pulse of pulses) {
@@ -13420,6 +13188,7 @@ function githubPulseSource(options = {}) {
13420
13188
  };
13421
13189
  const listings = new Map;
13422
13190
  const repositories = new Map;
13191
+ const fileReads = new Map;
13423
13192
  const quota = { apiRequests: 0, limited: false, resetsAt: null };
13424
13193
  const noteLimit = (response) => {
13425
13194
  const hit = response.status === 429 || response.status === 403 && (response.headers.get("x-ratelimit-remaining") === "0" || response.headers.has("retry-after"));
@@ -13492,23 +13261,24 @@ function githubPulseSource(options = {}) {
13492
13261
  return {
13493
13262
  listing: (repo) => once2(listings, repo, readListing),
13494
13263
  repository: (repo) => once2(repositories, repo, readRepository),
13495
- file: async (repo, path) => {
13496
- const encoded = path.split("/").map(encodeURIComponent).join("/");
13497
- const response = await get(`https://raw.githubusercontent.com/${repo}/HEAD/${encoded}`, { signal: bounded2() });
13498
- return response.ok ? response.text() : null;
13264
+ file: (repo, path) => {
13265
+ const key = `${repo}
13266
+ ${path}`;
13267
+ const kept = options.files?.get(key);
13268
+ if (kept !== undefined)
13269
+ return Promise.resolve(kept);
13270
+ return once2(fileReads, key, async () => {
13271
+ const encoded = path.split("/").map(encodeURIComponent).join("/");
13272
+ const response = await get(`https://raw.githubusercontent.com/${repo}/HEAD/${encoded}`, { signal: bounded2() });
13273
+ const text = response.ok ? await response.text() : null;
13274
+ if (response.ok || response.status === 404)
13275
+ options.files?.set(key, text);
13276
+ return text;
13277
+ });
13499
13278
  },
13500
13279
  quota: () => ({ ...quota })
13501
13280
  };
13502
13281
  }
13503
- // ../../packages/protocol/dist/share-offer.js
13504
- var SHARE_OFFER = {
13505
- question: "Share this machine's skill failures as public lines?",
13506
- sends: `When a skill fails here, one public line on Intuition testnet: the skill's public address, its category when known, "failed" and a closed reason (missing-key, missing-program, missing-file).`,
13507
- signer: "Each line is signed by this machine's own ARP address, created on the first send: it is public and the same on every line, so this machine's lines can be told apart from others' and linked together.",
13508
- never: "Never your prompts, your files, your paths, your code or your keys.",
13509
- service: "Sending goes through ARP's sponsoring service, which is not online yet: until it is, nothing is sent and `arp share send` says so.",
13510
- later: "Off by default. Change it any time with `arp share on` or `arp share off`."
13511
- };
13512
13282
  // ../../packages/protocol/dist/pulse-score.js
13513
13283
  var SCORE_VERSION = "pulse-score-3";
13514
13284
  var PRIOR_TOP = 0.8;
@@ -14749,6 +14519,171 @@ function renderSkillPrompt(review, installPath, maxLines = 3) {
14749
14519
  confirmHelp: "Nothing is written unless you tick this and press Accept."
14750
14520
  };
14751
14521
  }
14522
+ // ../../packages/protocol/dist/before-install.js
14523
+ var PAID_SERVICES = [
14524
+ { name: "Anthropic", hosts: ["api.anthropic.com"], keyPrefixes: ["ANTHROPIC_"] },
14525
+ { name: "AssemblyAI", hosts: ["api.assemblyai.com"], keyPrefixes: ["ASSEMBLYAI_"] },
14526
+ { name: "Azure OpenAI", hosts: ["openai.azure.com"], keyPrefixes: ["AZURE_OPENAI_"] },
14527
+ { name: "Brave Search", hosts: ["api.search.brave.com"], keyPrefixes: ["BRAVE_"] },
14528
+ { name: "Browserbase", hosts: ["api.browserbase.com"], keyPrefixes: ["BROWSERBASE_"] },
14529
+ { name: "Cohere", hosts: ["api.cohere.ai", "api.cohere.com"], keyPrefixes: ["COHERE_", "CO_API_"] },
14530
+ { name: "Deepgram", hosts: ["api.deepgram.com"], keyPrefixes: ["DEEPGRAM_"] },
14531
+ { name: "DeepSeek", hosts: ["api.deepseek.com"], keyPrefixes: ["DEEPSEEK_"] },
14532
+ { name: "ElevenLabs", hosts: ["api.elevenlabs.io"], keyPrefixes: ["ELEVENLABS_", "ELEVEN_"] },
14533
+ { name: "Exa", hosts: ["api.exa.ai"], keyPrefixes: ["EXA_"] },
14534
+ { name: "fal", hosts: ["fal.run", "queue.fal.run"], keyPrefixes: ["FAL_"] },
14535
+ { name: "Firecrawl", hosts: ["api.firecrawl.dev"], keyPrefixes: ["FIRECRAWL_"] },
14536
+ { name: "Fireworks AI", hosts: ["api.fireworks.ai"], keyPrefixes: ["FIREWORKS_"] },
14537
+ { name: "Google Gemini", hosts: ["generativelanguage.googleapis.com"], keyPrefixes: ["GEMINI_"] },
14538
+ { name: "Google Vertex AI", hosts: ["aiplatform.googleapis.com"], keyPrefixes: ["VERTEX_"] },
14539
+ { name: "Groq", hosts: ["api.groq.com"], keyPrefixes: ["GROQ_"] },
14540
+ { name: "HeyGen", hosts: ["api.heygen.com"], keyPrefixes: ["HEYGEN_"] },
14541
+ { name: "Mistral", hosts: ["api.mistral.ai"], keyPrefixes: ["MISTRAL_"] },
14542
+ { name: "OpenAI", hosts: ["api.openai.com"], keyPrefixes: ["OPENAI_"] },
14543
+ { name: "OpenRouter", hosts: ["openrouter.ai"], keyPrefixes: ["OPENROUTER_"] },
14544
+ { name: "Perplexity", hosts: ["api.perplexity.ai"], keyPrefixes: ["PERPLEXITY_", "PPLX_"] },
14545
+ { name: "Replicate", hosts: ["api.replicate.com"], keyPrefixes: ["REPLICATE_"] },
14546
+ { name: "Resend", hosts: ["api.resend.com"], keyPrefixes: ["RESEND_"] },
14547
+ { name: "Runway", hosts: ["api.dev.runwayml.com", "api.runwayml.com"], keyPrefixes: ["RUNWAY_", "RUNWAYML_"] },
14548
+ { name: "SerpApi", hosts: ["serpapi.com"], keyPrefixes: ["SERPAPI_", "SERP_API_"] },
14549
+ { name: "Stability AI", hosts: ["api.stability.ai"], keyPrefixes: ["STABILITY_"] },
14550
+ { name: "Tavily", hosts: ["api.tavily.com"], keyPrefixes: ["TAVILY_"] },
14551
+ { name: "Together AI", hosts: ["api.together.xyz", "api.together.ai"], keyPrefixes: ["TOGETHER_"] },
14552
+ { name: "Twilio", hosts: ["api.twilio.com"], keyPrefixes: ["TWILIO_"] },
14553
+ { name: "xAI", hosts: ["api.x.ai"], keyPrefixes: ["XAI_"] }
14554
+ ];
14555
+ var STATIC_HOSTS = [
14556
+ "fonts.googleapis.com",
14557
+ "gstatic.com",
14558
+ "cdn.jsdelivr.net",
14559
+ "unpkg.com",
14560
+ "cdnjs.cloudflare.com",
14561
+ "esm.sh",
14562
+ "cdn.skypack.dev",
14563
+ "ga.jspm.io",
14564
+ "githubusercontent.com",
14565
+ "cdn.tailwindcss.com",
14566
+ "code.jquery.com",
14567
+ "use.typekit.net",
14568
+ "fonts.bunny.net",
14569
+ "rsms.me",
14570
+ "cartocdn.com",
14571
+ "tile.openstreetmap.org",
14572
+ "server.arcgisonline.com",
14573
+ "images.unsplash.com"
14574
+ ];
14575
+ var STATIC_SHAPE = /^(?:cdn|static|fonts?|tiles?|assets|img|images|media)\d*[.-]|(?:^|[.-])cdn(?:[.-]|$)|\.cdn\./;
14576
+ var API_SHAPE = /^api\d*[.-]|[.-]api\.|^.*\.googleapis\.com$/;
14577
+ function under(host, base2) {
14578
+ return host === base2 || host.endsWith(`.${base2}`);
14579
+ }
14580
+ var ASSET = /\.(woff2?|ttf|otf|eot|png|jpe?g|gif|webp|svgz?|ico|bmp|tiff?|avif|heic|hdr|exr|mp[34]|m4a|wav|ogg|flac|aac|mov|webm|avi|mkv|psd|ai|sketch|fig|glb|gltf|fbx|blend|ktx2?|basis|pdf|zip|gz|tgz)$|(^|\/)\.(gitkeep|keep|DS_Store)$/i;
14581
+ function beforeInstall(input) {
14582
+ const services = new Map;
14583
+ const service = (name) => {
14584
+ const found2 = services.get(name) ?? { name, hosts: [], keys: [] };
14585
+ services.set(name, found2);
14586
+ return found2;
14587
+ };
14588
+ const apiHosts = [];
14589
+ const staticHosts = [];
14590
+ const otherHosts = [];
14591
+ for (const host of input.domains) {
14592
+ const known = PAID_SERVICES.find((entry) => entry.hosts.some((base2) => under(host, base2)));
14593
+ if (known !== undefined) {
14594
+ service(known.name).hosts.push(host);
14595
+ apiHosts.push(host);
14596
+ } else if (STATIC_HOSTS.some((base2) => under(host, base2)) || STATIC_SHAPE.test(host))
14597
+ staticHosts.push(host);
14598
+ else if (API_SHAPE.test(host))
14599
+ apiHosts.push(host);
14600
+ else
14601
+ otherHosts.push(host);
14602
+ }
14603
+ for (const key of input.keys) {
14604
+ if (key.why !== "secret")
14605
+ continue;
14606
+ const known = PAID_SERVICES.find((entry) => entry.keyPrefixes.some((prefix) => key.name.startsWith(prefix)));
14607
+ if (known !== undefined)
14608
+ service(known.name).keys.push(key.name);
14609
+ }
14610
+ const asked = new Set(input.keys.map((key) => key.name));
14611
+ return {
14612
+ fetchAndRun: [...input.fetchAndRun],
14613
+ keys: [...input.keys],
14614
+ otherSettings: input.settings.filter((name) => !asked.has(name)).length,
14615
+ services: [...services.values()].sort((a, b) => a.name < b.name ? -1 : 1),
14616
+ programs: [...input.programs],
14617
+ scripts: [...input.scripts],
14618
+ apiHosts,
14619
+ staticHosts,
14620
+ otherHosts,
14621
+ hidden: [...input.hidden],
14622
+ notRead: input.skipped.filter((file) => file.why !== "binary" && !ASSET.test(file.path)),
14623
+ cut: [...input.cut]
14624
+ };
14625
+ }
14626
+ var plural = (count, one, many = `${one}s`) => `${count} ${count === 1 ? one : many}`;
14627
+ function programNames(programs, shown = 4) {
14628
+ const names = programs.map((program) => program.name);
14629
+ return names.length <= shown ? names.join(", ") : `${names.slice(0, shown).join(", ")} +${names.length - shown}`;
14630
+ }
14631
+ function beforeInstallSummary(view) {
14632
+ const secrets = view.keys.filter((key) => key.why === "secret").length;
14633
+ const toSet = view.keys.length - secrets;
14634
+ const asks = secrets + toSet === 0 ? "no keys" : [secrets === 0 ? null : plural(secrets, "key"), toSet === 0 ? null : plural(toSet, "setting")].filter((part) => part !== null).join(", ");
14635
+ return [
14636
+ ...view.fetchAndRun.length === 0 ? [] : ["fetches and runs code"],
14637
+ asks,
14638
+ view.services.length === 0 ? "no paid services" : plural(view.services.length, "paid service"),
14639
+ view.programs.length === 0 ? "nothing to install named" : `needs ${programNames(view.programs)}`,
14640
+ view.scripts.length === 0 ? "no scripts" : plural(view.scripts.length, "script"),
14641
+ ...view.hidden.length === 0 ? [] : [plural(view.hidden.length, "hidden text", "hidden texts")],
14642
+ ...view.notRead.length === 0 ? [] : [`${plural(view.notRead.length, "file")} not read`]
14643
+ ].join(" · ");
14644
+ }
14645
+ function programSourceText(program) {
14646
+ const at = program.file === undefined ? "" : `${program.file}${program.line === undefined ? "" : `:${program.line}`}`;
14647
+ switch (program.from) {
14648
+ case "declared":
14649
+ return "declared in SKILL.md";
14650
+ case "runs":
14651
+ return "run in SKILL.md";
14652
+ case "interpreter":
14653
+ return "script interpreter";
14654
+ case "script":
14655
+ return "a script checks for it or installs it";
14656
+ case "spawned":
14657
+ return `run by ${at}`;
14658
+ case "package":
14659
+ return `via ${program.via ?? "a package"}, ${at}`;
14660
+ case "named as needed":
14661
+ return `said to be needed, ${at}`;
14662
+ }
14663
+ }
14664
+ function contentsLines(contents, perList = 6) {
14665
+ const view = beforeInstall({ ...contents, skipped: contents.read.skipped });
14666
+ const list = (items, cut2) => `${items.slice(0, perList).join(", ")}${items.length > perList || cut2 ? `, and ${Math.max(0, items.length - perList)}${cut2 ? "+" : ""} more` : ""}`;
14667
+ const cut = (name) => view.cut.includes(name);
14668
+ const at = (rows, name) => list(rows.map((row) => `${row.kind} at ${row.file}:${row.line} "${row.text}"`), cut(name));
14669
+ const others = view.otherSettings === 0 ? "" : `; ${plural(view.otherSettings, "other setting")} it reads`;
14670
+ const hostParts = [
14671
+ view.apiHosts.length === 0 ? "no API host" : list(view.apiHosts, false),
14672
+ ...view.staticHosts.length === 0 ? [] : [`fonts, CDNs and map tiles: ${view.staticHosts.length}`],
14673
+ ...view.otherHosts.length === 0 ? [] : [`other sites named: ${view.otherHosts.length}`]
14674
+ ];
14675
+ return [
14676
+ `Before you install: ${beforeInstallSummary(view)}`,
14677
+ ...view.fetchAndRun.length === 0 ? [] : [`Fetches and runs code: ${at(view.fetchAndRun, "fetchAndRun")}`],
14678
+ `Asks for: ${view.keys.length === 0 ? `no keys${others}` : `${list(view.keys.map((key) => `${key.name} (${key.why === "secret" ? "" : "set in SKILL.md, "}${key.file}:${key.line})`), cut("keys"))}${others}`}`,
14679
+ `Paid services: ${view.services.length === 0 ? "none named" : list(view.services.map((entry) => `${entry.name} (${[...entry.hosts, ...entry.keys].join(", ")})`), false)}`,
14680
+ `Needs installed: ${view.programs.length === 0 ? "none named" : list(view.programs.map((program) => `${program.name} (${programSourceText(program)})`), cut("programs"))}`,
14681
+ `Runs on your machine: ${view.scripts.length === 0 ? "no scripts" : `${plural(view.scripts.length, "script")}: ${list(view.scripts.map((script) => script.namedInSkillMd ? `${script.path} (named in SKILL.md)` : script.path), cut("scripts"))}`}${view.fetchAndRun.length === 0 ? "; fetches and runs no code" : ""}`,
14682
+ `Sends data to (hosts its files name, not shown to be contacted): ${hostParts.join("; ")}`,
14683
+ ...view.hidden.length === 0 ? [] : [`Hidden or encoded text: ${at(view.hidden, "hidden")}`],
14684
+ ...view.notRead.length === 0 ? [] : [`Not read: ${list(view.notRead.map((file) => `${file.path} (${file.why})`), false)}`]
14685
+ ];
14686
+ }
14752
14687
  // ../../packages/protocol/dist/outside-signals.js
14753
14688
  var TRUST_INDEX_LOOKUP = "https://x402-doctor.fizzl.eu/api/trust?url=";
14754
14689
  var FAILURE_WORDS = ["error", "fail", "failed", "broken", "crash"];
@@ -14796,7 +14731,7 @@ function outsideIndex(file) {
14796
14731
  }
14797
14732
  };
14798
14733
  }
14799
- var plural = (count, one, many) => `${count} ${count === 1 ? one : many}`;
14734
+ var plural2 = (count, one, many) => `${count} ${count === 1 ? one : many}`;
14800
14735
  function repoFacts(file, label, skill) {
14801
14736
  const index2 = outsideIndex(file);
14802
14737
  const repoLabel = repoLabelOf(label);
@@ -14818,7 +14753,7 @@ function repoFacts(file, label, skill) {
14818
14753
  const { total, open } = signals.issues;
14819
14754
  const named = skill === undefined ? null : index2.skill(label);
14820
14755
  facts.push({
14821
- says: `${plural(total, "issue title names", "issue titles name")} a failure (${open} open)` + (named === null ? "" : `; ${named.named} among the newest read name this skill`),
14756
+ says: `${plural2(total, "issue title names", "issue titles name")} a failure (${open} open)` + (named === null ? "" : `; ${named.named} among the newest read name this skill`),
14822
14757
  per: "GitHub search",
14823
14758
  on: issuesRead,
14824
14759
  check: failureIssueSearchUrl(repo)
@@ -14837,7 +14772,7 @@ function endpointFacts(file, url) {
14837
14772
  if (found2.entry !== null) {
14838
14773
  const { verdict, daysChecked, daysPayable, reasons } = found2.entry;
14839
14774
  facts.push({
14840
- says: `${verdict}, payable on ${daysPayable} of ${plural(daysChecked, "day", "days")} checked` + (reasons.length === 0 ? "" : ` (${reasons.join(", ")})`),
14775
+ says: `${verdict}, payable on ${daysPayable} of ${plural2(daysChecked, "day", "days")} checked` + (reasons.length === 0 ? "" : ` (${reasons.join(", ")})`),
14841
14776
  per: credit,
14842
14777
  on,
14843
14778
  check,
@@ -14846,7 +14781,7 @@ function endpointFacts(file, url) {
14846
14781
  } else if (found2.host !== null) {
14847
14782
  const { endpoints, go, caution, noGo, error } = found2.host;
14848
14783
  facts.push({
14849
- says: `this address is not listed; its host has ${plural(endpoints, "listed endpoint", "listed endpoints")}: ${go} go, ${caution} caution, ${noGo} no_go${error === 0 ? "" : `, ${error} unreachable`}`,
14784
+ says: `this address is not listed; its host has ${plural2(endpoints, "listed endpoint", "listed endpoints")}: ${go} go, ${caution} caution, ${noGo} no_go${error === 0 ? "" : `, ${error} unreachable`}`,
14850
14785
  per: credit,
14851
14786
  on,
14852
14787
  check,
@@ -14870,16 +14805,21 @@ var BINDINGS_QUERY = `query EndpointBindings($subject: String!, $hasEndpoint: St
14870
14805
  object { term_id data label }
14871
14806
  }
14872
14807
  }`;
14873
- var CONTEXTS_QUERY = `query EndpointProofs($triple: String!, $inContextOf: String!, $limit: Int!) {
14874
- triples(
14875
- where: {predicate_id: {_eq: $inContextOf}, object_id: {_eq: $triple}}
14808
+ function contextsQuery(claims) {
14809
+ const variables = Array.from({ length: claims }, (_, at) => `$t${at}: String!`).join(", ");
14810
+ const fields = Array.from({ length: claims }, (_, at) => ` c${at}: triples(
14811
+ where: {predicate_id: {_eq: $inContextOf}, object_id: {_eq: $t${at}}}
14876
14812
  order_by: {created_at: asc}
14877
14813
  limit: $limit
14878
14814
  ) {
14879
14815
  object_id
14880
14816
  subject { term_id data value { json_object { data } } }
14881
- }
14817
+ }`).join(`
14818
+ `);
14819
+ return `query EndpointProofs($inContextOf: String!, $limit: Int!, ${variables}) {
14820
+ ${fields}
14882
14821
  }`;
14822
+ }
14883
14823
  var DEFAULT_MAX_PROOFS_PER_CLAIM = 5;
14884
14824
  var RANK = { bound: 0, transferred: 1, unknown: 2, unproven: 3 };
14885
14825
  function gatewayFetch(fetchLike, timeoutMs) {
@@ -14927,12 +14867,13 @@ async function getAgentEndpoints(subject, config) {
14927
14867
  if (claims.length === 0)
14928
14868
  return [];
14929
14869
  const maxProofs = config.maxProofsPerClaim ?? DEFAULT_MAX_PROOFS_PER_CLAIM;
14930
- return Promise.all(claims.map(async (claim) => {
14931
- const contexts = await transport.request(CONTEXTS_QUERY, {
14932
- triple: claim.tripleId,
14933
- inContextOf: config.predicates.inContextOf,
14934
- limit: maxProofs
14935
- });
14870
+ const allContexts = await transport.request(contextsQuery(claims.length), {
14871
+ inContextOf: config.predicates.inContextOf,
14872
+ limit: maxProofs,
14873
+ ...Object.fromEntries(claims.map((claim, at) => [`t${at}`, claim.tripleId]))
14874
+ });
14875
+ return Promise.all(claims.map(async (claim, at) => {
14876
+ const contexts = { triples: allContexts[`c${at}`] };
14936
14877
  const uris = [];
14937
14878
  for (const row of Array.isArray(contexts["triples"]) ? contexts["triples"] : []) {
14938
14879
  if (!isRecord(row))
@@ -15123,16 +15064,21 @@ var LINE_REQUEST_TYPES = {
15123
15064
  { name: "payment", type: "string" },
15124
15065
  { name: "endpoint", type: "string" },
15125
15066
  { name: "need", type: "string" },
15067
+ { name: "payTo", type: "string" },
15068
+ { name: "asset", type: "string" },
15069
+ { name: "price", type: "string" },
15070
+ { name: "termsAt", type: "uint256" },
15126
15071
  { name: "nonce", type: "bytes32" },
15127
15072
  { name: "expiresAt", type: "uint256" }
15128
15073
  ]
15129
15074
  };
15075
+ var LINE_REQUEST_VERSION = "5";
15130
15076
  function lineRequestTypedData(request, chainId) {
15131
15077
  return {
15132
- domain: { name: "ARP Line Request", version: "4", chainId },
15078
+ domain: { name: "ARP Line Request", version: LINE_REQUEST_VERSION, chainId },
15133
15079
  types: LINE_REQUEST_TYPES,
15134
15080
  primaryType: "LineRequest",
15135
- message: { ...request, expiresAt: BigInt(request.expiresAt) }
15081
+ message: { ...request, termsAt: BigInt(request.termsAt), expiresAt: BigInt(request.expiresAt) }
15136
15082
  };
15137
15083
  }
15138
15084
  async function signLineRequest(request, chainId, signer) {
@@ -15271,4 +15217,4 @@ var RUNG_NAMES = {
15271
15217
  };
15272
15218
  var API_NAMES = new Set(["api", "rest", "openai", "jsonrpc", "grpc"]);
15273
15219
  var ANSWERED = new Set(["live", "serves-declared-protocol", "declared-protocol-not-served"]);
15274
- export { decodeEventLog, createPublicClient, createWalletClient, http, parseEther2 as parseEther, resolveRef, toCaip19, parseCaip19, isTransactionAbsent, HAS_TAG, IS_A_SUB_DOMAIN_OF, USES, intuitionSource, createErc8004Client, IPFS_GATEWAYS, privateProbeTarget, guardedFetchText, probeEndpoint, resolveAgent, listAgents, readDeclaredEndpoints, partitionByCheckability, getToolUsage, multiVaultDeclareAbi, multiVaultReads, prepareMarketPosition, prepareMarketExit, intuitionToolAtomLookup, toolAtomUri, prepareDeclareUsed, prepareStakeOnUsed, resolveDeclarationSubject, normaliseCategoryLabel, isCategoryIn, intuitionTestnet, ARP_DOMAIN_ATTESTORS, X402_DEFAULT_NETWORKS, chainIdOfNetwork, paymentAtomLabel, isExactEndpointUrl, transfersIn, x402NetworksFrom, x402Reading, listTools, listRegisteredTools, verdictOf, readReachabilityState2 as readReachabilityState, planReachability2 as planReachability, readDomainTree, toolsInDomain, findAgents, parseSessionLog, resolveInvocations, skillRefFromUrl, resolveContentPath, readRequires, contentsFileOf, readSkillContents, contentsLines, parseSkillsFind, fuseSearches, readPulse, groupByContent, githubPulseSource, resolveDomain, domainInText, SHARE_OFFER, NEEDS_LABEL2 as NEEDS_LABEL, WITH_LABEL2 as WITH_LABEL, needKindOfReason2 as needKindOfReason, publishableNeed2 as publishableNeed, needShapeProblem2 as needShapeProblem, HAS_OUTCOME_LABEL2 as HAS_OUTCOME_LABEL, USAGE_REASONS2 as USAGE_REASONS, BECAUSE_LABEL2 as BECAUSE_LABEL, isUsageOutcome2 as isUsageOutcome, isUsageReason2 as isUsageReason, prepareUsageContext2 as prepareUsageContext, budgetRefusal2 as budgetRefusal, parseLocalFailures, yourFailures, parseLocalOutcomes, isSharingOn, installedFromSkillLock, installedFromReceipts, sharedLineKey, decideShare, SCORE_VERSION, WALLETS_TO_MOVE, signalOf, entersList, unconfirmedNote, scoreSkill, findToolAtoms, findDeclaredTools, readThingUrl, workedInDomain, readEdgeWriters, getPulseUsage, HIRE_RECEIPT_VERSION, hireDigest, signHireReceipt, atomIsCanonicalFor, resolveAgentAtom, walletControlsSubject, findAgentsInDomains, findAgentsWithEndpoints, wordsMatchingOffer, readLineReceipts, receiptHolds, contentRequestTypedData, recoverContentRequester, verifyContentReceipt, corroborationOf, receiptMatchesContent, serveContent, contentIndexOf, bundleMatchesReceipt, serveSkillBundle, reviewSkill, renderSkillPrompt, repoFacts, endpointFacts, parseAgentRegistry, normaliseEndpoint, validateHandshakeRequest, asEndpointBinding, endpointBindingDocument, getAgentEndpoints, encodeApproveDeposit, sponsorProofDigest, signSponsorRequest, signMintGasRequest, signListToolRequest, signLineRequest, CATEGORY_REQUEST_TYPES, categoryRequestTypedData, signCategoryRequest, verifyCategoryRequest, searchSkillsIndex, RUNG_NAMES };
15220
+ export { decodeEventLog, createPublicClient, createWalletClient, http, verifyMessage3 as verifyMessage, parseEther2 as parseEther, resolveRef, toCaip19, parseCaip19, isTransactionAbsent, HAS_TAG, IS_A_SUB_DOMAIN_OF, USES, intuitionSource, createErc8004Client, IPFS_GATEWAYS, privateProbeTarget, guardedFetchText, probeEndpoint, resolveAgent, listAgents, readDeclaredEndpoints, partitionByCheckability, getToolUsage, multiVaultDeclareAbi, multiVaultReads, prepareMarketPosition, prepareMarketExit, toolAtomUri, redactEndpointUrl, intuitionToolAtomLookup, prepareDeclareUsed, prepareStakeOnUsed, resolveDeclarationSubject, normaliseCategoryLabel, isCategoryIn, intuitionTestnet, ARP_DOMAIN_ATTESTORS, chainIdOfNetwork, paymentAtomLabel, isExactEndpointUrl, transfersIn, x402NetworksFrom, x402Reading, X402_DEFAULT_NETWORKS, listTools, listRegisteredTools, verdictOf, readReachabilityState2 as readReachabilityState, planReachability2 as planReachability, readDomainTree, toolsInDomain, findAgents, parseSessionLog, resolveInvocations, skillRefFromUrl, resolveContentPath, readRequires, contentsFileOf, readSkillContents, parseSkillsFind, fuseSearches, readPulse, groupByContent, githubPulseSource, resolveDomain, domainInText, sharingChoiceOf, sharingFileText, NEEDS_LABEL2 as NEEDS_LABEL, WITH_LABEL2 as WITH_LABEL, needKindOfReason2 as needKindOfReason, publishableNeed2 as publishableNeed, needShapeProblem2 as needShapeProblem, HAS_OUTCOME_LABEL2 as HAS_OUTCOME_LABEL, USAGE_REASONS2 as USAGE_REASONS, BECAUSE_LABEL2 as BECAUSE_LABEL, isUsageOutcome2 as isUsageOutcome, isUsageReason2 as isUsageReason, prepareUsageContext2 as prepareUsageContext, budgetRefusal2 as budgetRefusal, parseLocalFailures, yourFailures, parseLocalOutcomes, isSharingOn, installedFromSkillLock, installedFromReceipts, sharedLineKey, decideShare, SCORE_VERSION, WALLETS_TO_MOVE, signalOf, entersList, unconfirmedNote, scoreSkill, findToolAtoms, findDeclaredTools, readThingUrl, workedInDomain, readEdgeWriters, getPulseUsage, HIRE_RECEIPT_VERSION, hireDigest, signHireReceipt, atomIsCanonicalFor, resolveAgentAtom, walletControlsSubject, findAgentsInDomains, findAgentsWithEndpoints, wordsMatchingOffer, readLineReceipts, receiptHolds, contentRequestTypedData, recoverContentRequester, verifyContentReceipt, corroborationOf, receiptMatchesContent, serveContent, contentIndexOf, bundleMatchesReceipt, serveSkillBundle, reviewSkill, renderSkillPrompt, contentsLines, repoFacts, endpointFacts, parseAgentRegistry, normaliseEndpoint, validateHandshakeRequest, asEndpointBinding, endpointBindingDocument, getAgentEndpoints, encodeApproveDeposit, sponsorProofDigest, signSponsorRequest, signMintGasRequest, signListToolRequest, signLineRequest, CATEGORY_REQUEST_TYPES, categoryRequestTypedData, signCategoryRequest, verifyCategoryRequest, searchSkillsIndex, RUNG_NAMES };