@onesi/genesis 0.1.13 → 0.2.0

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 (69) hide show
  1. package/README.md +1 -1
  2. package/dist/auto.d.ts +1010 -0
  3. package/dist/auto.js +125 -0
  4. package/dist/beacons.d.ts +42 -0
  5. package/dist/beacons.js +71 -0
  6. package/dist/blinds-owner-enrollment.d.ts +109 -0
  7. package/dist/blinds-owner-enrollment.js +21 -2
  8. package/dist/client.d.ts +3 -19947
  9. package/dist/client.js +124 -17
  10. package/dist/errors.js +1 -1
  11. package/dist/flares.d.ts +32 -0
  12. package/dist/flares.js +5 -0
  13. package/dist/fleets.d.ts +32 -0
  14. package/dist/fleets.js +59 -6
  15. package/dist/flocks.d.ts +285 -1
  16. package/dist/flocks.js +59 -0
  17. package/dist/foundry.d.ts +424 -0
  18. package/dist/foundry.js +133 -0
  19. package/dist/garden.d.ts +754 -0
  20. package/dist/garden.js +76 -0
  21. package/dist/gateway.d.ts +365 -0
  22. package/dist/gateway.js +82 -0
  23. package/dist/gears.d.ts +121 -2
  24. package/dist/gears.js +24 -2
  25. package/dist/generated/operations.d.ts +3 -19948
  26. package/dist/generated/operations.js +54590 -13302
  27. package/dist/generated/schema.d.ts +69793 -17548
  28. package/dist/genesis.d.ts +7908 -1260
  29. package/dist/genesis.js +90 -25
  30. package/dist/genesis.openapi.json +109121 -29920
  31. package/dist/henry.d.ts +202 -1
  32. package/dist/henry.js +223 -0
  33. package/dist/hives-environment.d.ts +9 -0
  34. package/dist/hives-environment.js +22 -0
  35. package/dist/hives-node.js +3 -0
  36. package/dist/hives-operations.d.ts +114 -0
  37. package/dist/hives-operations.js +2 -0
  38. package/dist/hives-platform.d.ts +149 -0
  39. package/dist/hives-platform.js +183 -0
  40. package/dist/hives-sse.d.ts +24 -0
  41. package/dist/hives-sse.js +111 -0
  42. package/dist/iam-directory.d.ts +8 -0
  43. package/dist/iam-directory.js +23 -0
  44. package/dist/iam.d.ts +391 -0
  45. package/dist/iam.js +92 -0
  46. package/dist/idempotency.d.ts +3 -0
  47. package/dist/idempotency.js +22 -0
  48. package/dist/index.d.ts +18 -4
  49. package/dist/index.js +16 -4
  50. package/dist/instances.d.ts +177 -2
  51. package/dist/instances.js +37 -5
  52. package/dist/minds-agent.d.ts +28 -0
  53. package/dist/minds-agent.js +53 -10
  54. package/dist/minds-engine.d.ts +394 -0
  55. package/dist/minds-engine.js +555 -0
  56. package/dist/minds.d.ts +109 -1
  57. package/dist/minds.js +49 -14
  58. package/dist/orgs.d.ts +405 -0
  59. package/dist/orgs.js +63 -0
  60. package/dist/runner.d.ts +4 -0
  61. package/dist/runner.js +1 -0
  62. package/dist/scopes.d.ts +310 -0
  63. package/dist/scopes.js +40 -0
  64. package/dist/taps.d.ts +118 -0
  65. package/dist/taps.js +45 -0
  66. package/dist/traces.d.ts +574 -0
  67. package/dist/traces.js +97 -0
  68. package/dist/types.d.ts +12 -1
  69. package/package.json +1 -1
@@ -0,0 +1,574 @@
1
+ import type { GenesisClient } from './client.js';
2
+ import type { OperationInput as In } from './types.js';
3
+ /** Traces: research runs, sources, monitors, crawl, extract, verify and usage.
4
+ * Billable calls (runs.create, search, crawl, batchScrape, extract, scrape, map) need one stable
5
+ * idempotency key; reuse it to replay instead of running and metering twice. runs.create and search
6
+ * send the key as given (the service enforces its 8-256 character rule); the newer calls refuse a
7
+ * missing or malformed key before sending. */
8
+ export declare function tracesModule(client: GenesisClient): {
9
+ runs: {
10
+ create: (body: In<"traces_createRun">["body"], idempotencyKey: string) => Promise<{
11
+ [key: string]: unknown;
12
+ }>;
13
+ list: (q?: In<"traces_listRuns">) => Promise<{
14
+ [key: string]: unknown;
15
+ }>;
16
+ get: (id: string) => Promise<{
17
+ [key: string]: unknown;
18
+ }>;
19
+ evidence: (id: string) => Promise<{
20
+ [key: string]: unknown;
21
+ }>;
22
+ steps: (id: string) => Promise<{
23
+ steps?: {
24
+ [key: string]: unknown;
25
+ }[];
26
+ total?: number;
27
+ } & {
28
+ [key: string]: unknown;
29
+ }>;
30
+ /** Server-Sent Events, read to the end as text (the stream ends at `timeout`, default 30 s, max 300 s). */
31
+ stream: (id: string, q?: Omit<In<"traces_streamRun">, "id">) => Promise<unknown>;
32
+ cancel: (id: string) => Promise<{
33
+ status?: "cancelled";
34
+ } & {
35
+ [key: string]: unknown;
36
+ }>;
37
+ pause: (id: string) => Promise<{
38
+ status?: "paused";
39
+ } & {
40
+ [key: string]: unknown;
41
+ }>;
42
+ resume: (id: string) => Promise<{
43
+ status?: "running";
44
+ } & {
45
+ [key: string]: unknown;
46
+ }>;
47
+ retry: (id: string) => Promise<{
48
+ status?: string;
49
+ retry_count?: number;
50
+ } & {
51
+ [key: string]: unknown;
52
+ }>;
53
+ };
54
+ search: (body: In<"traces_search">["body"], idempotencyKey: string) => Promise<{
55
+ [key: string]: unknown;
56
+ }>;
57
+ sources: {
58
+ list: (q?: In<"traces_listSources">) => Promise<{
59
+ items: import("./index.js").components["schemas"]["Traces.Source"][];
60
+ total: number;
61
+ } & {
62
+ [key: string]: unknown;
63
+ }>;
64
+ get: (id: string) => Promise<{
65
+ id: string;
66
+ url: string;
67
+ source_type: "documentation" | "academic_paper" | "code_repository" | "encyclopedia" | "standard" | "web" | "dataset" | "news_feed" | "api_reference";
68
+ title?: string;
69
+ domain?: string;
70
+ discovered_at?: string;
71
+ last_fetched_at?: string;
72
+ last_checked_at?: string;
73
+ content_hash?: string;
74
+ status: "discovered" | "fetched" | "processing" | "processed" | "error" | "unavailable";
75
+ fetch_count?: number;
76
+ error_message?: string;
77
+ metadata?: {
78
+ [key: string]: unknown;
79
+ };
80
+ created_at?: string;
81
+ updated_at?: string;
82
+ platform_id?: string;
83
+ org_id?: string;
84
+ workspace_id?: string;
85
+ project_id?: string;
86
+ environment_id?: string;
87
+ } & {
88
+ [key: string]: unknown;
89
+ }>;
90
+ create: (body: In<"traces_createSource">["body"]) => Promise<{
91
+ id: string;
92
+ url: string;
93
+ source_type: "documentation" | "academic_paper" | "code_repository" | "encyclopedia" | "standard" | "web" | "dataset" | "news_feed" | "api_reference";
94
+ title?: string;
95
+ domain?: string;
96
+ discovered_at?: string;
97
+ last_fetched_at?: string;
98
+ last_checked_at?: string;
99
+ content_hash?: string;
100
+ status: "discovered" | "fetched" | "processing" | "processed" | "error" | "unavailable";
101
+ fetch_count?: number;
102
+ error_message?: string;
103
+ metadata?: {
104
+ [key: string]: unknown;
105
+ };
106
+ created_at?: string;
107
+ updated_at?: string;
108
+ platform_id?: string;
109
+ org_id?: string;
110
+ workspace_id?: string;
111
+ project_id?: string;
112
+ environment_id?: string;
113
+ } & {
114
+ [key: string]: unknown;
115
+ }>;
116
+ update: (id: string, body: In<"traces_updateSource">["body"]) => Promise<{
117
+ id: string;
118
+ url: string;
119
+ source_type: "documentation" | "academic_paper" | "code_repository" | "encyclopedia" | "standard" | "web" | "dataset" | "news_feed" | "api_reference";
120
+ title?: string;
121
+ domain?: string;
122
+ discovered_at?: string;
123
+ last_fetched_at?: string;
124
+ last_checked_at?: string;
125
+ content_hash?: string;
126
+ status: "discovered" | "fetched" | "processing" | "processed" | "error" | "unavailable";
127
+ fetch_count?: number;
128
+ error_message?: string;
129
+ metadata?: {
130
+ [key: string]: unknown;
131
+ };
132
+ created_at?: string;
133
+ updated_at?: string;
134
+ platform_id?: string;
135
+ org_id?: string;
136
+ workspace_id?: string;
137
+ project_id?: string;
138
+ environment_id?: string;
139
+ } & {
140
+ [key: string]: unknown;
141
+ }>;
142
+ delete: (id: string) => Promise<{
143
+ status: string;
144
+ } & {
145
+ [key: string]: unknown;
146
+ }>;
147
+ check: (id: string) => Promise<{
148
+ id?: string;
149
+ source_id?: string;
150
+ checked_at?: string;
151
+ content_changed?: boolean;
152
+ previous_hash?: string;
153
+ current_hash?: string;
154
+ response_code?: number;
155
+ check_method?: string;
156
+ next_check_at?: string;
157
+ } & {
158
+ [key: string]: unknown;
159
+ }>;
160
+ health: (id: string) => Promise<{
161
+ source_id: string;
162
+ status: string;
163
+ fetch_count?: number;
164
+ last_fetched_at?: string;
165
+ last_checked_at?: string;
166
+ content_hash?: string;
167
+ content_type?: string;
168
+ etag?: string;
169
+ last_modified?: string;
170
+ response_code?: number;
171
+ error_message?: string;
172
+ staleness_hours?: number;
173
+ } & {
174
+ [key: string]: unknown;
175
+ }>;
176
+ };
177
+ monitors: {
178
+ list: (q?: In<"traces_listMonitors">) => Promise<{
179
+ items: import("./index.js").components["schemas"]["Traces.Monitor"][];
180
+ total: number;
181
+ } & {
182
+ [key: string]: unknown;
183
+ }>;
184
+ get: (id: string) => Promise<{
185
+ id: string;
186
+ tenant_id?: string;
187
+ name: string;
188
+ description?: string;
189
+ source_id?: string;
190
+ query?: string;
191
+ condition?: {
192
+ [key: string]: unknown;
193
+ };
194
+ check_interval_seconds?: number;
195
+ status: "active" | "paused" | "triggered" | "error";
196
+ last_checked_at?: string;
197
+ last_triggered_at?: string;
198
+ webhook_url?: string;
199
+ created_at?: string;
200
+ updated_at?: string;
201
+ platform_id?: string;
202
+ org_id?: string;
203
+ workspace_id?: string;
204
+ project_id?: string;
205
+ environment_id?: string;
206
+ } & {
207
+ [key: string]: unknown;
208
+ }>;
209
+ create: (body: In<"traces_createMonitor">["body"]) => Promise<{
210
+ id: string;
211
+ tenant_id?: string;
212
+ name: string;
213
+ description?: string;
214
+ source_id?: string;
215
+ query?: string;
216
+ condition?: {
217
+ [key: string]: unknown;
218
+ };
219
+ check_interval_seconds?: number;
220
+ status: "active" | "paused" | "triggered" | "error";
221
+ last_checked_at?: string;
222
+ last_triggered_at?: string;
223
+ webhook_url?: string;
224
+ created_at?: string;
225
+ updated_at?: string;
226
+ platform_id?: string;
227
+ org_id?: string;
228
+ workspace_id?: string;
229
+ project_id?: string;
230
+ environment_id?: string;
231
+ } & {
232
+ [key: string]: unknown;
233
+ }>;
234
+ update: (id: string, body: In<"traces_updateMonitor">["body"]) => Promise<{
235
+ id: string;
236
+ tenant_id?: string;
237
+ name: string;
238
+ description?: string;
239
+ source_id?: string;
240
+ query?: string;
241
+ condition?: {
242
+ [key: string]: unknown;
243
+ };
244
+ check_interval_seconds?: number;
245
+ status: "active" | "paused" | "triggered" | "error";
246
+ last_checked_at?: string;
247
+ last_triggered_at?: string;
248
+ webhook_url?: string;
249
+ created_at?: string;
250
+ updated_at?: string;
251
+ platform_id?: string;
252
+ org_id?: string;
253
+ workspace_id?: string;
254
+ project_id?: string;
255
+ environment_id?: string;
256
+ } & {
257
+ [key: string]: unknown;
258
+ }>;
259
+ delete: (id: string) => Promise<{
260
+ status: string;
261
+ } & {
262
+ [key: string]: unknown;
263
+ }>;
264
+ check: (id: string) => Promise<{
265
+ status?: "checked" | "triggered" | "error";
266
+ monitor?: import("./index.js").components["schemas"]["Traces.Monitor"];
267
+ last_checked_at?: string;
268
+ triggered?: boolean;
269
+ alert?: import("./index.js").components["schemas"]["Traces.MonitorAlert"];
270
+ error?: string;
271
+ } & {
272
+ [key: string]: unknown;
273
+ }>;
274
+ alerts: (id: string, q?: Omit<In<"traces_listMonitorAlerts">, "id">) => Promise<{
275
+ items: import("./index.js").components["schemas"]["Traces.MonitorAlert"][];
276
+ total: number;
277
+ } & {
278
+ [key: string]: unknown;
279
+ }>;
280
+ acknowledgeAlert: (id: string, alertId: string) => Promise<{
281
+ id: string;
282
+ monitor_id: string;
283
+ run_id?: string;
284
+ alert_type?: string;
285
+ details?: {
286
+ [key: string]: unknown;
287
+ };
288
+ acknowledged?: boolean;
289
+ acknowledged_at?: string;
290
+ created_at?: string;
291
+ platform_id?: string;
292
+ org_id?: string;
293
+ workspace_id?: string;
294
+ project_id?: string;
295
+ environment_id?: string;
296
+ } & {
297
+ [key: string]: unknown;
298
+ }>;
299
+ };
300
+ crawl: {
301
+ create: (body: In<"traces_createCrawl">["body"], key: string) => Promise<{
302
+ [key: string]: unknown;
303
+ }>;
304
+ get: (id: string) => Promise<{
305
+ id: string;
306
+ status: "queued" | "running" | "paused" | "completed" | "failed" | "cancelled";
307
+ type?: string;
308
+ created_at?: string;
309
+ updated_at?: string;
310
+ run?: {
311
+ [key: string]: unknown;
312
+ };
313
+ links?: {
314
+ [key: string]: unknown;
315
+ };
316
+ url?: string;
317
+ } & {
318
+ [key: string]: unknown;
319
+ }>;
320
+ cancel: (id: string) => Promise<{
321
+ id: string;
322
+ status: "queued" | "running" | "paused" | "completed" | "failed" | "cancelled";
323
+ type?: string;
324
+ created_at?: string;
325
+ updated_at?: string;
326
+ run?: {
327
+ [key: string]: unknown;
328
+ };
329
+ links?: {
330
+ [key: string]: unknown;
331
+ };
332
+ url?: string;
333
+ } & {
334
+ [key: string]: unknown;
335
+ }>;
336
+ };
337
+ batchScrape: {
338
+ create: (body: In<"traces_createBatchScrape">["body"], key: string) => Promise<{
339
+ [key: string]: unknown;
340
+ }>;
341
+ get: (id: string) => Promise<{
342
+ id: string;
343
+ status: "queued" | "running" | "paused" | "completed" | "failed" | "cancelled";
344
+ type?: string;
345
+ created_at?: string;
346
+ updated_at?: string;
347
+ run?: {
348
+ [key: string]: unknown;
349
+ };
350
+ links?: {
351
+ [key: string]: unknown;
352
+ };
353
+ total?: number;
354
+ urls?: string[];
355
+ } & {
356
+ [key: string]: unknown;
357
+ }>;
358
+ cancel: (id: string) => Promise<{
359
+ id: string;
360
+ status: "queued" | "running" | "paused" | "completed" | "failed" | "cancelled";
361
+ type?: string;
362
+ created_at?: string;
363
+ updated_at?: string;
364
+ run?: {
365
+ [key: string]: unknown;
366
+ };
367
+ links?: {
368
+ [key: string]: unknown;
369
+ };
370
+ total?: number;
371
+ urls?: string[];
372
+ } & {
373
+ [key: string]: unknown;
374
+ }>;
375
+ };
376
+ extract: (body: In<"traces_extract">["body"], key: string) => Promise<{
377
+ [key: string]: unknown;
378
+ }>;
379
+ extractStructured: (body: In<"traces_extractStructured">["body"], key: string) => Promise<{
380
+ [key: string]: unknown;
381
+ }>;
382
+ scrape: (body: In<"traces_scrape">["body"], key: string) => Promise<{
383
+ [key: string]: unknown;
384
+ }>;
385
+ map: (body: In<"traces_map">["body"], key: string) => Promise<{
386
+ [key: string]: unknown;
387
+ }>;
388
+ evidence: {
389
+ list: (q?: In<"traces_listEvidence">) => Promise<{
390
+ items: {
391
+ [key: string]: unknown;
392
+ }[];
393
+ total: number;
394
+ } & {
395
+ [key: string]: unknown;
396
+ }>;
397
+ get: (id: string) => Promise<{
398
+ [key: string]: unknown;
399
+ }>;
400
+ };
401
+ /** Binary body; the generic client reads non-JSON as text, so fetch the bytes with your own HTTP client when you need them intact. */
402
+ artifacts: {
403
+ get: (id: string) => Promise<unknown>;
404
+ };
405
+ ingest: {
406
+ create: (body: In<"traces_ingestEvidence">["body"]) => Promise<{
407
+ [key: string]: unknown;
408
+ }>;
409
+ status: (id: string) => Promise<{
410
+ [key: string]: unknown;
411
+ }>;
412
+ evaluate: (body: In<"traces_evaluateIngestFallback">["body"]) => Promise<{
413
+ [key: string]: unknown;
414
+ }>;
415
+ };
416
+ verify: (body: In<"traces_verifyClaim">["body"]) => Promise<{
417
+ [key: string]: unknown;
418
+ }>;
419
+ /** Agent spans exported by platform services (Henry first). `list` returns recent traces, or with
420
+ * `trace_id` that trace's spans; `get` reads every span of one trace (32 lowercase hex). */
421
+ spans: {
422
+ list: (q?: In<"traces_listSpans">) => Promise<({
423
+ trace_id: string;
424
+ spans: import("./index.js").components["schemas"]["Traces.Span"][];
425
+ } & {
426
+ [key: string]: unknown;
427
+ }) | ({
428
+ traces: import("./index.js").components["schemas"]["Traces.TraceSummary"][];
429
+ next_page_token: string | null;
430
+ } & {
431
+ [key: string]: unknown;
432
+ })>;
433
+ get: (traceId: string) => Promise<({
434
+ trace_id: string;
435
+ spans: import("./index.js").components["schemas"]["Traces.Span"][];
436
+ } & {
437
+ [key: string]: unknown;
438
+ }) | ({
439
+ traces: import("./index.js").components["schemas"]["Traces.TraceSummary"][];
440
+ next_page_token: string | null;
441
+ } & {
442
+ [key: string]: unknown;
443
+ })>;
444
+ };
445
+ verdicts: {
446
+ list: (q?: In<"traces_listVerdicts">) => Promise<{
447
+ items: {
448
+ [key: string]: unknown;
449
+ }[];
450
+ total: number;
451
+ } & {
452
+ [key: string]: unknown;
453
+ }>;
454
+ get: (id: string) => Promise<{
455
+ [key: string]: unknown;
456
+ }>;
457
+ };
458
+ coding: {
459
+ resolve: (body: In<"traces_resolveLibrary">["body"]) => Promise<{
460
+ [key: string]: unknown;
461
+ }>;
462
+ docs: (body: In<"traces_getLibraryDocs">["body"]) => Promise<{
463
+ [key: string]: unknown;
464
+ }>;
465
+ };
466
+ usage: {
467
+ events: (q?: In<"traces_listUsageEvents">) => Promise<{
468
+ [key: string]: unknown;
469
+ }>;
470
+ summary: (q?: In<"traces_getUsageSummary">) => Promise<{
471
+ [key: string]: unknown;
472
+ }>;
473
+ };
474
+ health: () => Promise<{
475
+ [key: string]: unknown;
476
+ }>;
477
+ /** Native Traces API keys (not Genesis API keys). The secret is returned once, on create and rotate. */
478
+ apiKeys: {
479
+ list: (q?: In<"traces_listApiKeys">) => Promise<{
480
+ items: import("./index.js").components["schemas"]["Traces.ApiKey"][];
481
+ total: number;
482
+ } & {
483
+ [key: string]: unknown;
484
+ }>;
485
+ get: (id: string) => Promise<{
486
+ platform_id?: string;
487
+ org_id?: string;
488
+ workspace_id?: string;
489
+ project_id?: string;
490
+ environment_id?: string;
491
+ id: string;
492
+ name: string;
493
+ key_prefix?: string;
494
+ principal_id?: string;
495
+ principal_kind?: "human" | "agent" | "service";
496
+ entitlements?: ("traces:read" | "traces:write" | "traces:delete" | "traces:admin" | "traces:export")[];
497
+ last_used_at?: string;
498
+ expires_at?: string;
499
+ revoked_at?: string;
500
+ created_at?: string;
501
+ updated_at?: string;
502
+ secret?: string;
503
+ status?: string;
504
+ } & {
505
+ [key: string]: unknown;
506
+ }>;
507
+ create: (body: In<"traces_createApiKey">["body"]) => Promise<{
508
+ platform_id?: string;
509
+ org_id?: string;
510
+ workspace_id?: string;
511
+ project_id?: string;
512
+ environment_id?: string;
513
+ id: string;
514
+ name: string;
515
+ key_prefix?: string;
516
+ principal_id?: string;
517
+ principal_kind?: "human" | "agent" | "service";
518
+ entitlements?: ("traces:read" | "traces:write" | "traces:delete" | "traces:admin" | "traces:export")[];
519
+ last_used_at?: string;
520
+ expires_at?: string;
521
+ revoked_at?: string;
522
+ created_at?: string;
523
+ updated_at?: string;
524
+ secret?: string;
525
+ status?: string;
526
+ } & {
527
+ [key: string]: unknown;
528
+ }>;
529
+ rotate: (id: string) => Promise<{
530
+ platform_id?: string;
531
+ org_id?: string;
532
+ workspace_id?: string;
533
+ project_id?: string;
534
+ environment_id?: string;
535
+ id: string;
536
+ name: string;
537
+ key_prefix?: string;
538
+ principal_id?: string;
539
+ principal_kind?: "human" | "agent" | "service";
540
+ entitlements?: ("traces:read" | "traces:write" | "traces:delete" | "traces:admin" | "traces:export")[];
541
+ last_used_at?: string;
542
+ expires_at?: string;
543
+ revoked_at?: string;
544
+ created_at?: string;
545
+ updated_at?: string;
546
+ secret?: string;
547
+ status?: string;
548
+ } & {
549
+ [key: string]: unknown;
550
+ }>;
551
+ revoke: (id: string) => Promise<{
552
+ platform_id?: string;
553
+ org_id?: string;
554
+ workspace_id?: string;
555
+ project_id?: string;
556
+ environment_id?: string;
557
+ id: string;
558
+ name: string;
559
+ key_prefix?: string;
560
+ principal_id?: string;
561
+ principal_kind?: "human" | "agent" | "service";
562
+ entitlements?: ("traces:read" | "traces:write" | "traces:delete" | "traces:admin" | "traces:export")[];
563
+ last_used_at?: string;
564
+ expires_at?: string;
565
+ revoked_at?: string;
566
+ created_at?: string;
567
+ updated_at?: string;
568
+ secret?: string;
569
+ status?: string;
570
+ } & {
571
+ [key: string]: unknown;
572
+ }>;
573
+ };
574
+ };
package/dist/traces.js ADDED
@@ -0,0 +1,97 @@
1
+ import { idempotencyHeaders } from './idempotency.js';
2
+ /** Traces: research runs, sources, monitors, crawl, extract, verify and usage.
3
+ * Billable calls (runs.create, search, crawl, batchScrape, extract, scrape, map) need one stable
4
+ * idempotency key; reuse it to replay instead of running and metering twice. runs.create and search
5
+ * send the key as given (the service enforces its 8-256 character rule); the newer calls refuse a
6
+ * missing or malformed key before sending. */
7
+ export function tracesModule(client) {
8
+ const keyed = async (id, input, idempotencyKey) => client.request(id, input, { headers: idempotencyHeaders(id, idempotencyKey) });
9
+ return {
10
+ runs: {
11
+ create: (body, idempotencyKey) => client.request('traces_createRun', { body }, { headers: { 'idempotency-key': idempotencyKey } }),
12
+ list: (q = {}) => client.request('traces_listRuns', q),
13
+ get: (id) => client.request('traces_getRun', { id }),
14
+ evidence: (id) => client.request('traces_getRunEvidence', { id }),
15
+ steps: (id) => client.request('traces_getRunSteps', { id }),
16
+ /** Server-Sent Events, read to the end as text (the stream ends at `timeout`, default 30 s, max 300 s). */
17
+ stream: (id, q = {}) => client.request('traces_streamRun', { id, ...q }),
18
+ cancel: (id) => client.request('traces_cancelRun', { id }),
19
+ pause: (id) => client.request('traces_pauseRun', { id }),
20
+ resume: (id) => client.request('traces_resumeRun', { id }),
21
+ retry: (id) => client.request('traces_retryRun', { id }),
22
+ },
23
+ search: (body, idempotencyKey) => client.request('traces_search', { body }, { headers: { 'idempotency-key': idempotencyKey } }),
24
+ sources: {
25
+ list: (q = {}) => client.request('traces_listSources', q),
26
+ get: (id) => client.request('traces_getSource', { id }),
27
+ create: (body) => client.request('traces_createSource', { body }),
28
+ update: (id, body) => client.request('traces_updateSource', { id, body }),
29
+ delete: (id) => client.request('traces_deleteSource', { id }),
30
+ check: (id) => client.request('traces_checkSource', { id }),
31
+ health: (id) => client.request('traces_getSourceHealth', { id }),
32
+ },
33
+ monitors: {
34
+ list: (q = {}) => client.request('traces_listMonitors', q),
35
+ get: (id) => client.request('traces_getMonitor', { id }),
36
+ create: (body) => client.request('traces_createMonitor', { body }),
37
+ update: (id, body) => client.request('traces_updateMonitor', { id, body }),
38
+ delete: (id) => client.request('traces_deleteMonitor', { id }),
39
+ check: (id) => client.request('traces_checkMonitor', { id }),
40
+ alerts: (id, q = {}) => client.request('traces_listMonitorAlerts', { id, ...q }),
41
+ acknowledgeAlert: (id, alertId) => client.request('traces_acknowledgeMonitorAlert', { id, alert_id: alertId }),
42
+ },
43
+ crawl: {
44
+ create: (body, key) => keyed('traces_createCrawl', { body }, key),
45
+ get: (id) => client.request('traces_getCrawl', { id }),
46
+ cancel: (id) => client.request('traces_cancelCrawl', { id }),
47
+ },
48
+ batchScrape: {
49
+ create: (body, key) => keyed('traces_createBatchScrape', { body }, key),
50
+ get: (id) => client.request('traces_getBatchScrape', { id }),
51
+ cancel: (id) => client.request('traces_cancelBatchScrape', { id }),
52
+ },
53
+ extract: (body, key) => keyed('traces_extract', { body }, key),
54
+ extractStructured: (body, key) => keyed('traces_extractStructured', { body }, key),
55
+ scrape: (body, key) => keyed('traces_scrape', { body }, key),
56
+ map: (body, key) => keyed('traces_map', { body }, key),
57
+ evidence: {
58
+ list: (q = {}) => client.request('traces_listEvidence', q),
59
+ get: (id) => client.request('traces_getEvidence', { id }),
60
+ },
61
+ /** Binary body; the generic client reads non-JSON as text, so fetch the bytes with your own HTTP client when you need them intact. */
62
+ artifacts: { get: (id) => client.request('traces_getArtifact', { id }) },
63
+ ingest: {
64
+ create: (body) => client.request('traces_ingestEvidence', { body }),
65
+ status: (id) => client.request('traces_getIngestStatus', { id }),
66
+ evaluate: (body) => client.request('traces_evaluateIngestFallback', { body }),
67
+ },
68
+ verify: (body) => client.request('traces_verifyClaim', { body }),
69
+ /** Agent spans exported by platform services (Henry first). `list` returns recent traces, or with
70
+ * `trace_id` that trace's spans; `get` reads every span of one trace (32 lowercase hex). */
71
+ spans: {
72
+ list: (q = {}) => client.request('traces_listSpans', q),
73
+ get: (traceId) => client.request('traces_listSpans', { trace_id: traceId }),
74
+ },
75
+ verdicts: {
76
+ list: (q = {}) => client.request('traces_listVerdicts', q),
77
+ get: (id) => client.request('traces_getVerdict', { id }),
78
+ },
79
+ coding: {
80
+ resolve: (body) => client.request('traces_resolveLibrary', { body }),
81
+ docs: (body) => client.request('traces_getLibraryDocs', { body }),
82
+ },
83
+ usage: {
84
+ events: (q = {}) => client.request('traces_listUsageEvents', q),
85
+ summary: (q = {}) => client.request('traces_getUsageSummary', q),
86
+ },
87
+ health: () => client.request('traces_getHealth'),
88
+ /** Native Traces API keys (not Genesis API keys). The secret is returned once, on create and rotate. */
89
+ apiKeys: {
90
+ list: (q = {}) => client.request('traces_listApiKeys', q),
91
+ get: (id) => client.request('traces_getApiKey', { id }),
92
+ create: (body) => client.request('traces_createApiKey', { body }),
93
+ rotate: (id) => client.request('traces_rotateApiKey', { id }),
94
+ revoke: (id) => client.request('traces_revokeApiKey', { id }),
95
+ },
96
+ };
97
+ }