@arp-protocol/cli 0.0.1 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/LICENSE +26 -0
  3. package/README.md +22 -8
  4. package/dist/chunks/backfill-5zmh0t43.js +1050 -0
  5. package/dist/chunks/{ccip-qmytgn8e.js → ccip-zxtpc4fx.js} +4 -4
  6. package/dist/chunks/check-k4qnc9ee.js +2011 -0
  7. package/dist/chunks/cli-00qp1sj2.js +116 -0
  8. package/dist/chunks/{cli-c8568g4c.js → cli-0gsbnq5w.js} +72 -72
  9. package/dist/chunks/{cli-zpft011j.js → cli-64fx73kx.js} +3 -3
  10. package/dist/chunks/cli-7c393v47.js +173 -0
  11. package/dist/chunks/{cli-0z6f3603.js → cli-8m56jsfx.js} +239 -183
  12. package/dist/chunks/{cli-v446mw5v.js → cli-fbwpcfvp.js} +34 -34
  13. package/dist/chunks/cli-kda5hz4w.js +23 -0
  14. package/dist/chunks/{cli-0hqxver6.js → cli-mhzh9z8k.js} +33 -33
  15. package/dist/chunks/{cli-tyey74p3.js → cli-n4qagybd.js} +6 -2
  16. package/dist/chunks/{cli-74hv4etk.js → cli-wer26exb.js} +4939 -4105
  17. package/dist/chunks/cli-zehr6kdx.js +719 -0
  18. package/dist/chunks/{commands-dnk10vze.js → commands-t5a0w785.js} +88 -17
  19. package/dist/chunks/{env-s4585w6j.js → env-n5ac8d1z.js} +1 -0
  20. package/dist/chunks/{index-3a3ssef1.js → index-jrs2shcc.js} +3 -3
  21. package/dist/chunks/line-kvm1ew55.js +215 -0
  22. package/dist/chunks/{node-init-4v2m2vj0.js → node-init-amedveja.js} +7 -6
  23. package/dist/chunks/{node-0ydee9hy.js → node-x35ncwhq.js} +7 -6
  24. package/dist/chunks/server-ek7fet5m.js +6924 -0
  25. package/dist/chunks/{share-g8v5qe6r.js → share-ax2k8805.js} +10 -5
  26. package/dist/cli.js +71 -19
  27. package/dist/hook.js +4178 -270
  28. package/package.json +10 -3
  29. package/dist/chunks/backfill-j4hxt1w1.js +0 -262
  30. package/dist/chunks/line-zy1tc2np.js +0 -45
  31. package/dist/chunks/server-jmyjttvv.js +0 -3170
@@ -0,0 +1,719 @@
1
+ #!/usr/bin/env node
2
+
3
+ // ../../packages/graphql/dist/http.js
4
+ var DEFAULT_TIMEOUT_MS = 1e4;
5
+ var DEFAULT_MAX_BODY_BYTES = 8 * 1024 * 1024;
6
+
7
+ class HttpError extends Error {
8
+ kind;
9
+ timeoutMs;
10
+ constructor(kind, message, timeoutMs, cause) {
11
+ super(message, cause === undefined ? undefined : { cause });
12
+ this.name = "HttpError";
13
+ this.kind = kind;
14
+ this.timeoutMs = timeoutMs;
15
+ }
16
+ }
17
+ function isTimeoutError(error) {
18
+ let cursor = error;
19
+ for (let depth = 0;depth < 8 && cursor !== null && cursor !== undefined; depth += 1) {
20
+ if (cursor instanceof HttpError)
21
+ return cursor.kind === "timeout";
22
+ cursor = cursor instanceof Error ? cursor.cause : null;
23
+ }
24
+ return false;
25
+ }
26
+ async function readBodyText(response, options = {}) {
27
+ const maxBytes = options.maxBytes ?? DEFAULT_MAX_BODY_BYTES;
28
+ const timeoutMs = options.timeoutMs ?? 0;
29
+ const body = response.body;
30
+ if (body === null)
31
+ return "";
32
+ const reader = body.getReader();
33
+ const signal = options.signal;
34
+ let onAbort = null;
35
+ const aborted = signal === undefined ? null : new Promise((_, reject) => {
36
+ const fire = () => reject(new HttpError("timeout", `timed out after ${timeoutMs}ms reading the body`, timeoutMs));
37
+ onAbort = fire;
38
+ if (signal.aborted)
39
+ fire();
40
+ else
41
+ signal.addEventListener("abort", fire, { once: true });
42
+ });
43
+ aborted?.catch(() => {
44
+ return;
45
+ });
46
+ const decoder = new TextDecoder;
47
+ let total = 0;
48
+ let text = "";
49
+ try {
50
+ for (;; ) {
51
+ const chunk = await (aborted === null ? reader.read() : Promise.race([reader.read(), aborted]));
52
+ if (chunk.done)
53
+ break;
54
+ total += chunk.value.byteLength;
55
+ if (total > maxBytes) {
56
+ throw new HttpError("too-large", `body exceeds ${maxBytes} bytes`, timeoutMs);
57
+ }
58
+ text += decoder.decode(chunk.value, { stream: true });
59
+ }
60
+ return text + decoder.decode();
61
+ } catch (error) {
62
+ reader.cancel().catch(() => {
63
+ return;
64
+ });
65
+ if (error instanceof HttpError)
66
+ throw error;
67
+ throw new HttpError("network", error instanceof Error ? error.message : String(error), timeoutMs, error);
68
+ } finally {
69
+ if (signal !== undefined && onAbort !== null)
70
+ signal.removeEventListener("abort", onAbort);
71
+ }
72
+ }
73
+ async function fetchTextWithTimeout(fetchImpl, url, init, options) {
74
+ const { timeoutMs } = options;
75
+ const controller = new AbortController;
76
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
77
+ try {
78
+ let response;
79
+ try {
80
+ response = await fetchImpl(url, { ...init, signal: controller.signal });
81
+ } catch (error) {
82
+ if (controller.signal.aborted) {
83
+ throw new HttpError("timeout", `timed out after ${timeoutMs}ms: ${url}`, timeoutMs);
84
+ }
85
+ throw new HttpError("network", error instanceof Error ? error.message : String(error), timeoutMs, error);
86
+ }
87
+ const text = await readBodyText(response, {
88
+ signal: controller.signal,
89
+ timeoutMs,
90
+ ...options.maxBytes === undefined ? {} : { maxBytes: options.maxBytes }
91
+ });
92
+ return { response, text };
93
+ } finally {
94
+ clearTimeout(timer);
95
+ }
96
+ }
97
+ function defaultFetch() {
98
+ if (typeof globalThis.fetch !== "function") {
99
+ throw new TypeError("no global fetch available — pass one via createErc8004Client({fetch})");
100
+ }
101
+ return (input, init) => globalThis.fetch(input, init);
102
+ }
103
+
104
+ // ../../packages/graphql/dist/json.js
105
+ function isRecord(value) {
106
+ return typeof value === "object" && value !== null && !Array.isArray(value);
107
+ }
108
+ function readRecord(source, key) {
109
+ if (!isRecord(source))
110
+ return null;
111
+ const child = source[key];
112
+ return isRecord(child) ? child : null;
113
+ }
114
+ function readString(source, key) {
115
+ if (!isRecord(source))
116
+ return null;
117
+ const value = source[key];
118
+ return typeof value === "string" ? value : null;
119
+ }
120
+ function readNumber(source, key) {
121
+ if (!isRecord(source))
122
+ return null;
123
+ const value = source[key];
124
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
125
+ }
126
+ function readArray(source, key) {
127
+ if (!isRecord(source))
128
+ return [];
129
+ const value = source[key];
130
+ return Array.isArray(value) ? value : [];
131
+ }
132
+ function readBigInt(source, key) {
133
+ if (!isRecord(source))
134
+ return null;
135
+ const value = source[key];
136
+ if (typeof value === "bigint")
137
+ return value;
138
+ if (typeof value === "number")
139
+ return Number.isInteger(value) ? BigInt(value) : null;
140
+ if (typeof value !== "string" || !/^-?\d+$/.test(value))
141
+ return null;
142
+ return BigInt(value);
143
+ }
144
+ function readCount(source, key) {
145
+ if (!isRecord(source))
146
+ return null;
147
+ const value = source[key];
148
+ const parsed = typeof value === "number" ? value : typeof value === "string" && /^\d+$/.test(value) ? Number(value) : null;
149
+ return parsed !== null && Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : null;
150
+ }
151
+
152
+ // ../../packages/graphql/dist/client.js
153
+ class GraphqlError extends Error {
154
+ url;
155
+ httpStatus;
156
+ constructor(message, url, httpStatus, cause) {
157
+ super(message, cause === undefined ? undefined : { cause });
158
+ this.name = "GraphqlError";
159
+ this.url = url;
160
+ this.httpStatus = httpStatus;
161
+ }
162
+ }
163
+ function createGraphqlTransport(config) {
164
+ const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
165
+ return {
166
+ async request(query, variables, options) {
167
+ let response;
168
+ let text;
169
+ try {
170
+ ({ response, text } = await fetchTextWithTimeout(config.fetch, config.url, {
171
+ method: "POST",
172
+ headers: {
173
+ "content-type": "application/json",
174
+ accept: "application/json"
175
+ },
176
+ body: JSON.stringify({ query, variables })
177
+ }, {
178
+ timeoutMs: options?.timeoutMs ?? timeoutMs,
179
+ ...config.maxBodyBytes === undefined ? {} : { maxBytes: config.maxBodyBytes }
180
+ }));
181
+ } catch (error) {
182
+ const message = error instanceof HttpError ? error.message : String(error);
183
+ throw new GraphqlError(message, config.url, null, error);
184
+ }
185
+ if (!response.ok) {
186
+ throw new GraphqlError(`HTTP ${response.status} ${response.statusText}`, config.url, response.status);
187
+ }
188
+ let body = null;
189
+ try {
190
+ body = JSON.parse(text);
191
+ } catch {
192
+ body = null;
193
+ }
194
+ if (!isRecord(body)) {
195
+ throw new GraphqlError("response body is not a JSON object", config.url, 200);
196
+ }
197
+ const errors = readArray(body, "errors");
198
+ if (errors.length > 0) {
199
+ const messages = errors.map((entry) => readString(entry, "message") ?? "unknown error").join("; ");
200
+ throw new GraphqlError(messages, config.url, 200);
201
+ }
202
+ const data = body["data"];
203
+ if (!isRecord(data)) {
204
+ throw new GraphqlError("response carries no data object", config.url, 200);
205
+ }
206
+ return data;
207
+ }
208
+ };
209
+ }
210
+
211
+ // ../../packages/graphql/dist/queries/domains.js
212
+ var OUR_HIERARCHY_QUERY = `query($pid: String!, $who: [String!]!, $curveId: numeric!, $limit: Int!, $offset: Int!) {
213
+ positions(
214
+ where: {
215
+ account_id: {_in: $who}
216
+ curve_id: {_eq: $curveId}
217
+ shares: {_gt: "0"}
218
+ term: {triple: {predicate_id: {_eq: $pid}}}
219
+ }
220
+ limit: $limit
221
+ offset: $offset
222
+ order_by: {id: asc}
223
+ ) {
224
+ shares
225
+ term {
226
+ triple {
227
+ term_id
228
+ subject { term_id data label }
229
+ object { term_id data label }
230
+ }
231
+ }
232
+ }
233
+ }`;
234
+ var ALL_HIERARCHY_QUERY = `query($pid: String!, $limit: Int!, $offset: Int!) {
235
+ triples(where: {predicate_id: {_eq: $pid}}, limit: $limit, offset: $offset, order_by: {term_id: asc}) {
236
+ term_id
237
+ subject { term_id data label }
238
+ object { term_id data label }
239
+ term { vaults { curve_id position_count total_shares } }
240
+ }
241
+ }`;
242
+ var TAGGED_QUERY = `query($pid: String!, $domains: [String!], $limit: Int!, $offset: Int!, $who: [String!]!) {
243
+ triples(
244
+ where: {predicate_id: {_eq: $pid}, object: {data: {_in: $domains}}}
245
+ limit: $limit
246
+ offset: $offset
247
+ order_by: {term_id: asc}
248
+ ) {
249
+ term_id
250
+ subject { term_id label value { thing { url name } } }
251
+ object { data }
252
+ term {
253
+ vaults {
254
+ curve_id
255
+ position_count
256
+ total_shares
257
+ positions(where: {account_id: {_in: $who}, shares: {_gt: "0"}}) { shares }
258
+ }
259
+ }
260
+ }
261
+ }`;
262
+ // ../../packages/graphql/dist/queries/agent.js
263
+ var THING = `value { thing { name description image url } }`;
264
+ var MARKET_SIDE = `
265
+ total_market_cap
266
+ total_assets
267
+ vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) {
268
+ market_cap
269
+ total_assets
270
+ total_shares
271
+ current_share_price
272
+ position_count
273
+ }`;
274
+ var RESOLVE_AGENT_QUERY = `
275
+ query ResolveAgentByCaip($sameAsPredicateId: String!, $caipId: String!) {
276
+ triples(
277
+ where: {
278
+ predicate_id: {_eq: $sameAsPredicateId}
279
+ object: {value: {thing: {name: {_eq: $caipId}}}}
280
+ }
281
+ limit: 2
282
+ ) {
283
+ subject { term_id label data ${THING} }
284
+ }
285
+ }`;
286
+ var AGENT_EDGE_LIMIT = 250;
287
+ var TRUST_SURFACE_QUERY = `
288
+ query AgentTrustSurface($subjectId: String!, $predicateIds: [String!], $curveId: numeric!, $limit: Int!) {
289
+ triples(
290
+ where: {subject_id: {_eq: $subjectId}, predicate_id: {_in: $predicateIds}}
291
+ order_by: {term: {total_market_cap: desc}}
292
+ limit: $limit
293
+ ) {
294
+ term_id
295
+ predicate { term_id label }
296
+ object { term_id label data ${THING} }
297
+ term {${MARKET_SIDE}
298
+ }
299
+ counter_term {${MARKET_SIDE}
300
+ }
301
+ }
302
+ }`;
303
+ var CAPABILITIES_QUERY = `
304
+ query AgentCapabilities($subjectId: String!, $predicateIds: [String!], $limit: Int!) {
305
+ triples(
306
+ where: {subject_id: {_eq: $subjectId}, predicate_id: {_in: $predicateIds}}
307
+ order_by: {term_id: asc}
308
+ limit: $limit
309
+ ) {
310
+ term_id
311
+ predicate { term_id label }
312
+ object { term_id label ${THING} }
313
+ }
314
+ }`;
315
+ var IDENTITY_SAMPLE_LIMIT = 4;
316
+ var CAPABILITY_SAMPLE_LIMIT = 8;
317
+ var COHORT_QUERY = `
318
+ query AgentCohort($where: triples_bool_exp!, $sameAsPredicateId: String!, $capabilityPredicateIds: [String!], $orderBy: [triples_order_by!]!, $limit: Int!, $offset: Int!) {
319
+ total: triples_aggregate(
320
+ where: $where
321
+ ) {
322
+ aggregate { count }
323
+ }
324
+ triples(
325
+ where: $where
326
+ order_by: $orderBy
327
+ limit: $limit
328
+ offset: $offset
329
+ ) {
330
+ subject {
331
+ term_id
332
+ label
333
+ ${THING}
334
+ as_subject_triples_aggregate { aggregate { count } }
335
+ term {
336
+ total_market_cap
337
+ vaults_aggregate { aggregate { count sum { position_count } } }
338
+ }
339
+ identityCount: as_subject_triples_aggregate(
340
+ where: {predicate_id: {_eq: $sameAsPredicateId}}
341
+ ) {
342
+ aggregate { count }
343
+ }
344
+ identity: as_subject_triples(
345
+ where: {predicate_id: {_eq: $sameAsPredicateId}}
346
+ limit: ${IDENTITY_SAMPLE_LIMIT}
347
+ ) {
348
+ object { label ${THING} }
349
+ }
350
+ capabilities: as_subject_triples(
351
+ where: {predicate_id: {_in: $capabilityPredicateIds}}
352
+ limit: ${CAPABILITY_SAMPLE_LIMIT}
353
+ ) {
354
+ predicate_id
355
+ object { term_id label }
356
+ }
357
+ }
358
+ }
359
+ }`;
360
+ var COHORT_ORDER_BY = {
361
+ "evidence-quantity": [
362
+ { subject: { as_subject_triples_aggregate: { count: "desc" } } },
363
+ { subject_id: "asc" }
364
+ ],
365
+ "economic-conviction": [{ subject: { term: { total_market_cap: "desc" } } }, { subject_id: "asc" }]
366
+ };
367
+ // ../../packages/graphql/dist/queries/atom-standing.js
368
+ var VAULT_SIDE = `
369
+ total_market_cap
370
+ total_assets
371
+ vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) {
372
+ market_cap
373
+ total_assets
374
+ total_shares
375
+ current_share_price
376
+ position_count
377
+ }`;
378
+ var ATOM_STANDING_QUERY = `
379
+ query AtomStanding($atomId: String!, $curveId: numeric!, $limit: Int!, $attestor: [String!]!) {
380
+ atom: atoms(where: {term_id: {_eq: $atomId}}, limit: 1) {
381
+ term_id
382
+ label
383
+ data
384
+ type
385
+ value { thing { url } }
386
+ term { ${VAULT_SIDE} }
387
+ }
388
+ triples(
389
+ where: {object_id: {_eq: $atomId}}
390
+ order_by: {term: {total_assets: desc}}
391
+ limit: $limit
392
+ ) {
393
+ term_id
394
+ predicate { term_id label }
395
+ subject { term_id label type }
396
+ term { ${VAULT_SIDE} }
397
+ counter_term { ${VAULT_SIDE} }
398
+ }
399
+ claims: triples(
400
+ where: {subject_id: {_eq: $atomId}}
401
+ order_by: {term: {total_assets: desc}}
402
+ limit: $limit
403
+ ) {
404
+ term_id
405
+ predicate { term_id label }
406
+ object { term_id label type }
407
+ term {
408
+ ${VAULT_SIDE}
409
+ vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) {
410
+ positions(where: {account_id: {_in: $attestor}, shares: {_gt: "0"}}, limit: 1) { shares }
411
+ }
412
+ }
413
+ }
414
+ }`;
415
+ var LISTED_CAPABILITIES_FOR_QUERY = `query ListedCapabilitiesFor($subject: String!, $predicates: [String!]) {
416
+ atoms(where: {term_id: {_eq: $subject}}, limit: 1) {
417
+ capabilities: as_subject_triples(
418
+ where: {predicate_id: {_in: $predicates}}
419
+ limit: ${CAPABILITY_SAMPLE_LIMIT}
420
+ ) { object { term_id } }
421
+ }
422
+ }`;
423
+ // ../../packages/graphql/dist/queries/discover.js
424
+ var FIND_AGENTS_QUERY = `
425
+ query FindAgents($domain: String!, $predicates: [String!], $sameAs: String!, $curveId: numeric!, $limit: Int!) {
426
+ triples(
427
+ where: {
428
+ predicate_id: {_in: $predicates}
429
+ object: {label: {_ilike: $domain}}
430
+ subject: {as_subject_triples: {predicate_id: {_eq: $sameAs}}}
431
+ }
432
+ limit: $limit
433
+ ) {
434
+ predicate_id
435
+ object { label }
436
+ subject {
437
+ term_id
438
+ label
439
+ term { vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) { position_count total_assets } }
440
+ }
441
+ }
442
+ }`;
443
+ // ../../packages/graphql/dist/queries/registered-tools.js
444
+ var REGISTERED_TOOLS_QUERY = `
445
+ query RegisteredTools($description: String!, $uses: String!, $sameAs: String!, $curveId: numeric!, $limit: Int!, $offset: Int!) {
446
+ atoms(
447
+ where: {value: {thing: {description: {_eq: $description}}}}
448
+ limit: $limit
449
+ offset: $offset
450
+ order_by: {term_id: asc}
451
+ ) {
452
+ term_id
453
+ label
454
+ data
455
+ value { thing { url } }
456
+ term {
457
+ vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) { position_count total_assets }
458
+ }
459
+ as_object_triples_aggregate(
460
+ where: {
461
+ predicate_id: {_eq: $uses}
462
+ subject: {as_subject_triples: {predicate_id: {_eq: $sameAs}}}
463
+ }
464
+ ) { aggregate { count } }
465
+ }
466
+ }`;
467
+ // ../../packages/graphql/dist/queries/tool-atom.js
468
+ var BY_URL_QUERY = `
469
+ query ToolAtomByUrl($url: String!) {
470
+ atoms(where: {value: {thing: {url: {_eq: $url}}}}, limit: 10) {
471
+ term_id
472
+ label
473
+ type
474
+ data
475
+ }
476
+ }`;
477
+ // ../../packages/graphql/dist/queries/tool-listing.js
478
+ function toolListingQuery(sponsored) {
479
+ const variables = sponsored ? "$uses: String!, $sameAs: String!, $curveId: numeric!, $limit: Int!, $sponsor: String!" : "$uses: String!, $sameAs: String!, $curveId: numeric!, $limit: Int!";
480
+ const sponsoredCount = sponsored ? `
481
+ sponsored: deposits_aggregate(where: {sender_id: {_ilike: $sponsor}, receiver_id: {_nilike: $sponsor}}) { aggregate { count } }` : "";
482
+ return `
483
+ query ToolListing(${variables}) {
484
+ triples(
485
+ where: {
486
+ predicate_id: {_eq: $uses}
487
+ subject: {as_subject_triples: {predicate_id: {_eq: $sameAs}}}
488
+ }
489
+ limit: $limit
490
+ ) {
491
+ term_id
492
+ subject_id
493
+ object {
494
+ term_id
495
+ label
496
+ data
497
+ type
498
+ value { thing { url } }
499
+ }
500
+ term {
501
+ total_assets
502
+ vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) { position_count total_assets }
503
+ deposits: deposits_aggregate { aggregate { count } }${sponsoredCount}
504
+ }
505
+ counter_term {
506
+ total_assets
507
+ vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) { position_count total_assets }
508
+ }
509
+ }
510
+ }`;
511
+ }
512
+ var TOOL_LISTING_QUERY = toolListingQuery(false);
513
+ var TOOL_LISTING_SPONSORED_QUERY = toolListingQuery(true);
514
+ var SPONSORED_WALLETS_QUERY = `
515
+ query SponsoredWallets($uses: String!, $sponsor: String!, $limit: Int!) {
516
+ deposits(
517
+ where: {sender_id: {_eq: $sponsor}, receiver_id: {_neq: $sponsor}, term: {triple: {predicate_id: {_eq: $uses}}}}
518
+ distinct_on: [term_id, receiver_id]
519
+ limit: $limit
520
+ ) { term_id receiver_id }
521
+ }`;
522
+ // ../../packages/graphql/dist/queries/pulse-usage.js
523
+ var PULSE_USES_QUERY = `query PulseUses($tools: [String!]!, $uses: String!, $limit: Int!) {
524
+ triples(where: {object_id: {_in: $tools}, predicate_id: {_eq: $uses}}, limit: $limit) {
525
+ term_id
526
+ object_id
527
+ creator_id
528
+ created_at
529
+ subject {
530
+ term_id
531
+ label
532
+ }
533
+ positions(where: {shares: {_gt: "0"}}) {
534
+ account_id
535
+ }
536
+ }
537
+ }`;
538
+ var PULSE_QUALIFIERS_QUERY = `query PulseQualifiers($edges: [String!]!, $predicates: [String!]!, $writers: [String!]!, $limit: Int!) {
539
+ triples(where: {subject_id: {_in: $edges}, predicate_id: {_in: $predicates}}, limit: $limit) {
540
+ term_id
541
+ subject_id
542
+ predicate_id
543
+ creator_id
544
+ created_at
545
+ object {
546
+ label
547
+ }
548
+ positions(where: {shares: {_gt: "0"}, account_id: {_in: $writers}}) {
549
+ account_id
550
+ }
551
+ }
552
+ }`;
553
+ var PULSE_ATOMS_QUERY = `query PulseAtoms($uris: [String!]!, $limit: Int!) {
554
+ atoms(where: {data: {_in: $uris}}, limit: $limit) {
555
+ term_id
556
+ data
557
+ }
558
+ }`;
559
+ var PULSE_DOMAIN_EDGES_QUERY = `query PulseDomainEdges($domains: [String!]!, $predicate: String!, $limit: Int!) {
560
+ triples(where: {predicate_id: {_eq: $predicate}, object: {label: {_in: $domains}}}, order_by: {created_at: desc}, limit: $limit) {
561
+ subject_id
562
+ }
563
+ }`;
564
+ var PULSE_EDGE_TOOLS_QUERY = `query PulseEdgeTools($edges: [String!]!, $uses: String!, $limit: Int!) {
565
+ triples(where: {term_id: {_in: $edges}, predicate_id: {_eq: $uses}}, limit: $limit) {
566
+ object {
567
+ term_id
568
+ label
569
+ data
570
+ }
571
+ }
572
+ }`;
573
+ var AGENT_IDENTITIES_QUERY = `query AgentIdentities($atoms: [String!]!, $sameAs: String!, $limit: Int!) {
574
+ triples(where: {subject_id: {_in: $atoms}, predicate_id: {_eq: $sameAs}}, limit: $limit) {
575
+ subject_id
576
+ subject {
577
+ data
578
+ }
579
+ object {
580
+ label
581
+ value {
582
+ thing {
583
+ name
584
+ }
585
+ }
586
+ }
587
+ }
588
+ }`;
589
+ var ATTACHED_DOCUMENTS_QUERY = `query AttachedDocuments($term: String!, $inContextOf: String!, $creators: [String!]!, $limit: Int!) {
590
+ others: triples_aggregate(where: {predicate_id: {_eq: $inContextOf}, object_id: {_eq: $term}, creator_id: {_nin: $creators}}) {
591
+ aggregate {
592
+ count
593
+ }
594
+ }
595
+ triples(where: {predicate_id: {_eq: $inContextOf}, object_id: {_eq: $term}, creator_id: {_in: $creators}}, order_by: {created_at: asc}, limit: $limit) {
596
+ creator_id
597
+ subject {
598
+ data
599
+ value {
600
+ json_object {
601
+ data
602
+ }
603
+ }
604
+ }
605
+ }
606
+ }`;
607
+ var IDENTITY_CLAIMS_QUERY = `query IdentityClaims($caip19: String!, $sameAs: String!, $limit: Int!) {
608
+ triples(where: {predicate_id: {_eq: $sameAs}, object: {label: {_eq: $caip19}}}, limit: $limit) {
609
+ creator_id
610
+ subject {
611
+ term_id
612
+ data
613
+ }
614
+ }
615
+ }`;
616
+ var PULSE_EDGE_WRITERS_QUERY = `query PulseEdgeWriters($edges: [String!]!, $limit: Int!) {
617
+ triples(where: {term_id: {_in: $edges}}, limit: $limit) {
618
+ term_id
619
+ creator_id
620
+ }
621
+ }`;
622
+ var ENDPOINT_SUBJECTS_QUERY = `query EndpointSubjects($hasEndpoint: String!, $limit: Int!) {
623
+ triples(where: {predicate_id: {_eq: $hasEndpoint}}, order_by: {created_at: desc}, limit: $limit) {
624
+ subject_id
625
+ subject {
626
+ label
627
+ }
628
+ }
629
+ }`;
630
+ // ../../packages/graphql/dist/queries/tool-usage.js
631
+ var VAULT_SIDE2 = `
632
+ total_market_cap
633
+ total_assets
634
+ vaults(where: {curve_id: {_eq: $curveId}}, limit: 1) {
635
+ market_cap
636
+ total_assets
637
+ total_shares
638
+ current_share_price
639
+ position_count
640
+ }`;
641
+ var TOOL_USAGE_QUERY = `
642
+ query ToolUsage($toolId: String!, $uses: String!, $curveId: numeric!) {
643
+ tool: atoms(where: {term_id: {_eq: $toolId}}, limit: 1) {
644
+ term_id
645
+ label
646
+ data
647
+ }
648
+ triples(where: {predicate_id: {_eq: $uses}, object_id: {_eq: $toolId}}, limit: 200) {
649
+ term_id
650
+ subject {
651
+ term_id
652
+ label
653
+ type
654
+ }
655
+ term { ${VAULT_SIDE2} }
656
+ counter_term { ${VAULT_SIDE2} }
657
+ }
658
+ }`;
659
+ var ATTESTED_TOOL_USAGE_QUERY = `
660
+ query AttestedToolUsage($toolId: String!, $uses: String!, $curveId: numeric!, $attestor: String!) {
661
+ tool: atoms(where: {term_id: {_eq: $toolId}}, limit: 1) {
662
+ term_id
663
+ label
664
+ data
665
+ }
666
+ triples(where: {
667
+ predicate_id: {_eq: $uses},
668
+ object_id: {_eq: $toolId},
669
+ term: {positions: {account_id: {_eq: $attestor}}}
670
+ }, limit: 200) {
671
+ term_id
672
+ subject {
673
+ term_id
674
+ label
675
+ type
676
+ }
677
+ term { ${VAULT_SIDE2} }
678
+ counter_term { ${VAULT_SIDE2} }
679
+ }
680
+ }`;
681
+ // ../../packages/graphql/dist/queries/x402-feed.js
682
+ var LEVEL = `term_id
683
+ subject_id
684
+ predicate_id
685
+ creator_id
686
+ created_at
687
+ subject {
688
+ term_id
689
+ label
690
+ }
691
+ object {
692
+ term_id
693
+ label
694
+ data
695
+ value {
696
+ thing {
697
+ url
698
+ }
699
+ }
700
+ }
701
+ positions(where: {shares: {_gt: "0"}}) {
702
+ account_id
703
+ }`;
704
+ var X402_PAYMENT_LEVELS_QUERY = `query X402PaymentLevels($paidWith: String!, $limit: Int!, $offset: Int!) {
705
+ triples(where: {predicate_id: {_eq: $paidWith}}, order_by: {term_id: asc}, limit: $limit, offset: $offset) {
706
+ ${LEVEL}
707
+ }
708
+ }`;
709
+ var X402_LEVELS_BY_ID_QUERY = `query X402LevelsById($ids: [String!]!, $limit: Int!) {
710
+ triples(where: {term_id: {_in: $ids}}, limit: $limit) {
711
+ ${LEVEL}
712
+ }
713
+ }`;
714
+ var X402_REASONS_QUERY = `query X402Reasons($ids: [String!]!, $because: String!, $limit: Int!) {
715
+ triples(where: {subject_id: {_in: $ids}, predicate_id: {_eq: $because}}, order_by: {term_id: asc}, limit: $limit) {
716
+ ${LEVEL}
717
+ }
718
+ }`;
719
+ export { DEFAULT_TIMEOUT_MS, DEFAULT_MAX_BODY_BYTES, HttpError, isTimeoutError, readBodyText, defaultFetch, isRecord, readRecord, readString, readNumber, readArray, readBigInt, readCount, createGraphqlTransport, RESOLVE_AGENT_QUERY, AGENT_EDGE_LIMIT, TRUST_SURFACE_QUERY, CAPABILITIES_QUERY, IDENTITY_SAMPLE_LIMIT, COHORT_QUERY, COHORT_ORDER_BY, FIND_AGENTS_QUERY, OUR_HIERARCHY_QUERY, ALL_HIERARCHY_QUERY, TAGGED_QUERY, REGISTERED_TOOLS_QUERY, BY_URL_QUERY, TOOL_LISTING_QUERY, TOOL_LISTING_SPONSORED_QUERY, SPONSORED_WALLETS_QUERY, PULSE_USES_QUERY, PULSE_QUALIFIERS_QUERY, PULSE_ATOMS_QUERY, PULSE_DOMAIN_EDGES_QUERY, PULSE_EDGE_TOOLS_QUERY, AGENT_IDENTITIES_QUERY, ATTACHED_DOCUMENTS_QUERY, IDENTITY_CLAIMS_QUERY, PULSE_EDGE_WRITERS_QUERY, ENDPOINT_SUBJECTS_QUERY, TOOL_USAGE_QUERY, ATTESTED_TOOL_USAGE_QUERY };