@topolo/sdk 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -31,9 +31,174 @@ interface AgentIdentity {
31
31
  agentName?: string;
32
32
  }
33
33
 
34
+ interface TopoloClientOptions {
35
+ credential: TopoloCredential;
36
+ agent: AgentIdentity;
37
+ /** Per-service URL overrides. Useful for staging/dev. */
38
+ serviceUrls?: Record<string, string>;
39
+ /** Per-service TopoloAuth service id overrides from the owning app/deployment. */
40
+ serviceIds?: Record<string, string>;
41
+ /**
42
+ * When true, mutating helpers (POST/PUT/PATCH/DELETE) require callers to pass
43
+ * `{ confirm: true }`. Defaults to true. Set false only for trusted surfaces.
44
+ */
45
+ requireConfirmForWrites?: boolean;
46
+ /** HTTP request timeout (ms). Default 30s. */
47
+ timeoutMs?: number;
48
+ /** Injected fetch, for testing. Defaults to global fetch. */
49
+ fetch?: typeof fetch;
50
+ /**
51
+ * Observability hook. Fires once per request lifecycle (`request` at start,
52
+ * then exactly one of `response` or `error`). Safe to leave unset — off by
53
+ * default. Intended for CLI/MCP hosts to surface request-level diagnostics
54
+ * and for consumers building their own logging/tracing.
55
+ */
56
+ debug?: (event: TopoloDebugEvent) => void;
57
+ }
58
+ type TopoloDebugEvent = {
59
+ phase: 'request';
60
+ method: string;
61
+ service: string;
62
+ path: string;
63
+ url: string;
64
+ requestId: string;
65
+ } | {
66
+ phase: 'response';
67
+ method: string;
68
+ service: string;
69
+ path: string;
70
+ url: string;
71
+ requestId: string;
72
+ status: number;
73
+ durationMs: number;
74
+ } | {
75
+ phase: 'error';
76
+ method: string;
77
+ service: string;
78
+ path: string;
79
+ url: string;
80
+ requestId: string;
81
+ durationMs: number;
82
+ error: string;
83
+ status?: number;
84
+ };
85
+ interface RequestOptions {
86
+ service: string;
87
+ path: string;
88
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
89
+ query?: Record<string, string | number | boolean | undefined>;
90
+ body?: unknown;
91
+ /** Explicit write-acknowledgement for mutating calls. */
92
+ confirm?: boolean;
93
+ /** Extra headers appended after auth/audit headers. */
94
+ headers?: Record<string, string>;
95
+ signal?: AbortSignal;
96
+ }
97
+ /**
98
+ * A single entry from the live platform service catalog. Returned by
99
+ * {@link TopoloClient.listServices}. Shape mirrors the public-safe projection
100
+ * from TopoloAuth `GET /api/services/catalog`.
101
+ */
102
+ interface TopoloServiceCatalogEntry {
103
+ serviceId: string;
104
+ slug: string | null;
105
+ name: string | null;
106
+ description: string | null;
107
+ baseUrl: string | null;
108
+ status: string | null;
109
+ surfaceKind: string | null;
110
+ launchable: boolean;
111
+ }
112
+ declare class TopoloClient {
113
+ private readonly credential;
114
+ private readonly agent;
115
+ private readonly serviceUrls?;
116
+ private readonly serviceIds?;
117
+ private readonly requireConfirmForWrites;
118
+ private readonly timeoutMs;
119
+ private readonly fetchImpl;
120
+ private readonly debug?;
121
+ private serviceCatalogCache;
122
+ /**
123
+ * Process-wide cache for slug → service-id lookups. Keyed by
124
+ * `${authBaseUrl}|${slug}` so multiple `TopoloClient` instances pointing at
125
+ * the same Auth share, but staging vs prod don't poison each other.
126
+ * Cleared via `TopoloClient.clearServiceIdCache()` if a test needs it.
127
+ */
128
+ private static readonly serviceIdCache;
129
+ /**
130
+ * Drop the slug→service-id cache. Test-only — production callers should
131
+ * let the 5-minute TTL expire naturally.
132
+ */
133
+ static clearServiceIdCache(): void;
134
+ constructor(options: TopoloClientOptions);
135
+ private emit;
136
+ /**
137
+ * Low-level JSON request. Prefer the typed module helpers (identity, crm, ...)
138
+ * for anything a caller would reach for; this stays exported for escape-hatch
139
+ * use and for the generic `topolo api` / MCP passthrough tool.
140
+ */
141
+ request<T = unknown>(opts: RequestOptions): Promise<T>;
142
+ private resolveRequestService;
143
+ private resolveLiveCallableService;
144
+ /**
145
+ * Resolve a service-slug → opaque service-id via caller config or TopoloAuth.
146
+ *
147
+ * Cache: 5 minutes per process per `(slug, auth_base_url)`. Negative
148
+ * results (404) are cached for 60s so a typo doesn't hot-loop the
149
+ * resolver. Returns null when the slug isn't registered — callers decide
150
+ * whether to throw.
151
+ *
152
+ * No credential is sent: the endpoint is public (slugs aren't secret).
153
+ * This keeps the resolver usable during early bootstrap before a caller
154
+ * has acquired an access token.
155
+ */
156
+ getServiceIdBySlug(slug: string): Promise<string | null>;
157
+ /**
158
+ * List the platform service catalog from the live registry
159
+ * (`GET /api/services/catalog` on TopoloAuth). Credential-aware: the
160
+ * caller's credential is attached, so an authenticated caller in an
161
+ * entitled org also receives the `developer_only` services its role
162
+ * permits; an unauthenticated/agent caller receives `active` only.
163
+ *
164
+ * Resilient: on any network/HTTP failure this falls back to the
165
+ * build-time generated `APPLICATIONS` snapshot so offline/degraded
166
+ * callers still get a usable (if static) catalog. The live result is
167
+ * authoritative; the snapshot is a floor, not a cap.
168
+ */
169
+ listServices(): Promise<TopoloServiceCatalogEntry[]>;
170
+ private generatedCatalogFallback;
171
+ /**
172
+ * Introspect the current credential. Returns the caller's resolved identity,
173
+ * organization, and permission set. Used by CLI `whoami` and by MCP to gate
174
+ * advertised tools by scope.
175
+ *
176
+ * Both JWT access tokens and platform API keys are resolved via the unified
177
+ * `GET /api/auth/me` endpoint on TopoloAuth, which does not require service
178
+ * credentials. The caller's possession of the credential secret is proof.
179
+ */
180
+ introspect(): Promise<CredentialIntrospection>;
181
+ }
182
+ interface CredentialIntrospection {
183
+ kind: 'api_key' | 'access_token';
184
+ user: {
185
+ id: string;
186
+ email: string;
187
+ name: string | null;
188
+ role: string;
189
+ permissions: string[];
190
+ };
191
+ organization: {
192
+ id: string;
193
+ slug: string;
194
+ name: string;
195
+ } | null;
196
+ }
197
+
34
198
  declare const SERVICES: {
35
199
  readonly agent: "https://agent-api.topolo.app";
36
200
  readonly auth: "https://auth.topolo.app";
201
+ readonly backup: "https://backup.topolo.app";
37
202
  readonly books: "https://books.topolo.app";
38
203
  readonly bugfix: "https://bugfix.topolo.app";
39
204
  readonly bytes: "https://bytes-api.topolo.app";
@@ -44,7 +209,6 @@ declare const SERVICES: {
44
209
  readonly compose: "https://compose.topolo.app";
45
210
  readonly consent: "https://consent.topolo.app";
46
211
  readonly crm: "https://crm-api.topolo.app";
47
- readonly customer_success: "https://success.topolo.app";
48
212
  readonly developers: "https://developers.topolo.app";
49
213
  readonly director: "https://director.topolo.app";
50
214
  readonly feed: "https://feed-api.topolo.app";
@@ -58,9 +222,10 @@ declare const SERVICES: {
58
222
  readonly localize: "https://localize.topolo.app";
59
223
  readonly mail: "https://mail.topolo.app";
60
224
  readonly mdm: "https://mdm-api.topolo.app";
61
- readonly messaging: "https://messages.topolo.app";
225
+ readonly messages: "https://messages.topolo.app";
62
226
  readonly nexus: "https://nexus-api.topolo.app";
63
227
  readonly notify: "https://notify.topolo.app";
228
+ readonly observability_watch: "https://observability-watch.topolo.app";
64
229
  readonly one: "https://one.topolo.app";
65
230
  readonly p2p: "https://p2p.topolo.app";
66
231
  readonly pay: "https://pay.topolo.app";
@@ -74,6 +239,7 @@ declare const SERVICES: {
74
239
  readonly socialize: "https://socialize-api.topolo.app";
75
240
  readonly spaces: "https://spaces.topolo.app";
76
241
  readonly status: "https://status.topolo.app";
242
+ readonly success: "https://success.topolo.app";
77
243
  readonly support: "https://support.topolo.app";
78
244
  readonly survey: "https://survey.topolo.app";
79
245
  readonly voice: "https://voice.topolo.app";
@@ -91,11 +257,18 @@ declare const APPLICATIONS: {
91
257
  readonly services: readonly [];
92
258
  readonly deployTargets: readonly [{
93
259
  readonly name: "topolo-admin";
94
- readonly kind: "pages";
95
- readonly apiUrl: null;
260
+ readonly kind: "worker";
261
+ readonly apiUrl: "https://admin.topolo.app";
96
262
  readonly domains: readonly ["admin.topolo.app"];
97
263
  readonly routes: readonly [];
98
264
  readonly serviceId: null;
265
+ }, {
266
+ readonly name: "topolo-admin-api";
267
+ readonly kind: "worker";
268
+ readonly apiUrl: null;
269
+ readonly domains: readonly [];
270
+ readonly routes: readonly [];
271
+ readonly serviceId: null;
99
272
  }];
100
273
  };
101
274
  readonly agent: {
@@ -108,12 +281,12 @@ declare const APPLICATIONS: {
108
281
  readonly deployTargets: readonly [{
109
282
  readonly name: "topolo-agent";
110
283
  readonly kind: "worker";
111
- readonly apiUrl: null;
284
+ readonly apiUrl: "https://agent.topolo.app";
112
285
  readonly domains: readonly ["agent.topolo.app"];
113
286
  readonly routes: readonly [];
114
287
  readonly serviceId: null;
115
288
  }, {
116
- readonly name: "topolo-agent-worker";
289
+ readonly name: "topolo-agent-api";
117
290
  readonly kind: "worker";
118
291
  readonly apiUrl: "https://agent-api.topolo.app";
119
292
  readonly domains: readonly ["agent-api.topolo.app"];
@@ -142,15 +315,15 @@ declare const APPLICATIONS: {
142
315
  readonly appDir: "TopoloBackup";
143
316
  readonly name: "topolo-backup";
144
317
  readonly packageName: "topolo-backup";
145
- readonly productionUrl: null;
146
- readonly services: readonly [];
318
+ readonly productionUrl: "https://backup.topolo.app";
319
+ readonly services: readonly ["backup"];
147
320
  readonly deployTargets: readonly [{
148
321
  readonly name: "topolo-backup";
149
322
  readonly kind: "worker";
150
- readonly apiUrl: null;
151
- readonly domains: readonly [];
323
+ readonly apiUrl: "https://backup.topolo.app";
324
+ readonly domains: readonly ["backup.topolo.app"];
152
325
  readonly routes: readonly [];
153
- readonly serviceId: null;
326
+ readonly serviceId: "backup";
154
327
  }];
155
328
  };
156
329
  readonly books: {
@@ -165,8 +338,15 @@ declare const APPLICATIONS: {
165
338
  readonly kind: "worker";
166
339
  readonly apiUrl: "https://books.topolo.app";
167
340
  readonly domains: readonly ["books.topolo.app"];
168
- readonly routes: readonly ["books.topolo.app"];
341
+ readonly routes: readonly [];
169
342
  readonly serviceId: "books";
343
+ }, {
344
+ readonly name: "topolo-books-api";
345
+ readonly kind: "worker";
346
+ readonly apiUrl: null;
347
+ readonly domains: readonly [];
348
+ readonly routes: readonly [];
349
+ readonly serviceId: null;
170
350
  }];
171
351
  };
172
352
  readonly bugfix: {
@@ -181,7 +361,7 @@ declare const APPLICATIONS: {
181
361
  readonly kind: "worker";
182
362
  readonly apiUrl: "https://bugfix.topolo.app";
183
363
  readonly domains: readonly ["bugfix.topolo.app"];
184
- readonly routes: readonly ["bugfix.topolo.app"];
364
+ readonly routes: readonly [];
185
365
  readonly serviceId: "bugfix";
186
366
  }];
187
367
  };
@@ -194,8 +374,8 @@ declare const APPLICATIONS: {
194
374
  readonly services: readonly ["bytes"];
195
375
  readonly deployTargets: readonly [{
196
376
  readonly name: "topolo-bytes";
197
- readonly kind: "pages";
198
- readonly apiUrl: null;
377
+ readonly kind: "worker";
378
+ readonly apiUrl: "https://bytes.topolo.app";
199
379
  readonly domains: readonly ["bytes.topolo.app"];
200
380
  readonly routes: readonly [];
201
381
  readonly serviceId: null;
@@ -220,8 +400,15 @@ declare const APPLICATIONS: {
220
400
  readonly kind: "worker";
221
401
  readonly apiUrl: "https://calendar.topolo.app";
222
402
  readonly domains: readonly ["calendar.topolo.app"];
223
- readonly routes: readonly ["calendar.topolo.app"];
403
+ readonly routes: readonly [];
224
404
  readonly serviceId: "calendar";
405
+ }, {
406
+ readonly name: "topolo-calendar-api";
407
+ readonly kind: "worker";
408
+ readonly apiUrl: null;
409
+ readonly domains: readonly [];
410
+ readonly routes: readonly [];
411
+ readonly serviceId: null;
225
412
  }];
226
413
  };
227
414
  readonly capacity: {
@@ -252,19 +439,17 @@ declare const APPLICATIONS: {
252
439
  readonly kind: "worker";
253
440
  readonly apiUrl: "https://chat.topolo.app";
254
441
  readonly domains: readonly ["chat.topolo.app"];
255
- readonly routes: readonly ["chat.topolo.app"];
442
+ readonly routes: readonly [];
256
443
  readonly serviceId: "chat";
444
+ }, {
445
+ readonly name: "topolo-chat-api";
446
+ readonly kind: "worker";
447
+ readonly apiUrl: null;
448
+ readonly domains: readonly [];
449
+ readonly routes: readonly [];
450
+ readonly serviceId: null;
257
451
  }];
258
452
  };
259
- readonly cloudcontrol: {
260
- readonly id: "cloudcontrol";
261
- readonly appDir: "TopoloCloudControl";
262
- readonly name: "cloudcontrol";
263
- readonly packageName: "topolo-cloudcontrol";
264
- readonly productionUrl: null;
265
- readonly services: readonly [];
266
- readonly deployTargets: readonly [];
267
- };
268
453
  readonly commerce: {
269
454
  readonly id: "commerce";
270
455
  readonly appDir: "TopoloCommerce";
@@ -281,22 +466,22 @@ declare const APPLICATIONS: {
281
466
  readonly serviceId: "commerce";
282
467
  }, {
283
468
  readonly name: "topolo-commerce-guest-web";
284
- readonly kind: "pages";
285
- readonly apiUrl: null;
469
+ readonly kind: "worker";
470
+ readonly apiUrl: "https://guest.topolo.app";
286
471
  readonly domains: readonly ["guest.topolo.app"];
287
472
  readonly routes: readonly [];
288
473
  readonly serviceId: null;
289
474
  }, {
290
475
  readonly name: "topolo-commerce-ops-web";
291
- readonly kind: "pages";
292
- readonly apiUrl: null;
476
+ readonly kind: "worker";
477
+ readonly apiUrl: "https://commerce.topolo.app";
293
478
  readonly domains: readonly ["commerce.topolo.app"];
294
479
  readonly routes: readonly [];
295
480
  readonly serviceId: null;
296
481
  }, {
297
482
  readonly name: "topolo-commerce-station-web";
298
- readonly kind: "pages";
299
- readonly apiUrl: null;
483
+ readonly kind: "worker";
484
+ readonly apiUrl: "https://station-commerce.topolo.app";
300
485
  readonly domains: readonly ["station-commerce.topolo.app"];
301
486
  readonly routes: readonly [];
302
487
  readonly serviceId: null;
@@ -314,8 +499,15 @@ declare const APPLICATIONS: {
314
499
  readonly kind: "worker";
315
500
  readonly apiUrl: "https://compose.topolo.app";
316
501
  readonly domains: readonly ["compose.topolo.app"];
317
- readonly routes: readonly ["compose.topolo.app"];
502
+ readonly routes: readonly [];
318
503
  readonly serviceId: "compose";
504
+ }, {
505
+ readonly name: "topolo-compose-api";
506
+ readonly kind: "worker";
507
+ readonly apiUrl: null;
508
+ readonly domains: readonly [];
509
+ readonly routes: readonly [];
510
+ readonly serviceId: null;
319
511
  }];
320
512
  };
321
513
  readonly consent: {
@@ -330,8 +522,15 @@ declare const APPLICATIONS: {
330
522
  readonly kind: "worker";
331
523
  readonly apiUrl: "https://consent.topolo.app";
332
524
  readonly domains: readonly ["consent.topolo.app"];
333
- readonly routes: readonly ["consent.topolo.app"];
525
+ readonly routes: readonly [];
334
526
  readonly serviceId: "consent";
527
+ }, {
528
+ readonly name: "topolo-consent-api";
529
+ readonly kind: "worker";
530
+ readonly apiUrl: null;
531
+ readonly domains: readonly [];
532
+ readonly routes: readonly [];
533
+ readonly serviceId: null;
335
534
  }];
336
535
  };
337
536
  readonly crm: {
@@ -351,28 +550,12 @@ declare const APPLICATIONS: {
351
550
  }, {
352
551
  readonly name: "topolo-crm-app";
353
552
  readonly kind: "worker";
354
- readonly apiUrl: null;
553
+ readonly apiUrl: "https://crm.topolo.app";
355
554
  readonly domains: readonly ["crm.topolo.app"];
356
555
  readonly routes: readonly [];
357
556
  readonly serviceId: null;
358
557
  }];
359
558
  };
360
- readonly customer_success: {
361
- readonly id: "customer_success";
362
- readonly appDir: "TopoloSuccess";
363
- readonly name: "topolo-success";
364
- readonly packageName: "topolo-success";
365
- readonly productionUrl: "https://success.topolo.app";
366
- readonly services: readonly ["customer_success"];
367
- readonly deployTargets: readonly [{
368
- readonly name: "topolo-success";
369
- readonly kind: "worker";
370
- readonly apiUrl: "https://success.topolo.app";
371
- readonly domains: readonly ["success.topolo.app"];
372
- readonly routes: readonly ["success.topolo.app"];
373
- readonly serviceId: "customer_success";
374
- }];
375
- };
376
559
  readonly developers: {
377
560
  readonly id: "developers";
378
561
  readonly appDir: "TopoloDevelopers";
@@ -394,6 +577,13 @@ declare const APPLICATIONS: {
394
577
  readonly domains: readonly ["developers.topolo.app"];
395
578
  readonly routes: readonly [];
396
579
  readonly serviceId: "developers";
580
+ }, {
581
+ readonly name: "topolo-developers-api";
582
+ readonly kind: "worker";
583
+ readonly apiUrl: null;
584
+ readonly domains: readonly [];
585
+ readonly routes: readonly [];
586
+ readonly serviceId: null;
397
587
  }];
398
588
  };
399
589
  readonly director: {
@@ -408,8 +598,15 @@ declare const APPLICATIONS: {
408
598
  readonly kind: "worker";
409
599
  readonly apiUrl: "https://director.topolo.app";
410
600
  readonly domains: readonly ["director.topolo.app"];
411
- readonly routes: readonly ["director.topolo.app"];
601
+ readonly routes: readonly [];
412
602
  readonly serviceId: "director";
603
+ }, {
604
+ readonly name: "topolo-director-api";
605
+ readonly kind: "worker";
606
+ readonly apiUrl: null;
607
+ readonly domains: readonly [];
608
+ readonly routes: readonly [];
609
+ readonly serviceId: null;
413
610
  }];
414
611
  };
415
612
  readonly docs: {
@@ -421,11 +618,18 @@ declare const APPLICATIONS: {
421
618
  readonly services: readonly [];
422
619
  readonly deployTargets: readonly [{
423
620
  readonly name: "topolo-docs";
424
- readonly kind: "pages";
425
- readonly apiUrl: null;
621
+ readonly kind: "worker";
622
+ readonly apiUrl: "https://docs.topolo.app";
426
623
  readonly domains: readonly ["docs.topolo.app"];
427
624
  readonly routes: readonly [];
428
625
  readonly serviceId: null;
626
+ }, {
627
+ readonly name: "topolo-docs-api";
628
+ readonly kind: "worker";
629
+ readonly apiUrl: null;
630
+ readonly domains: readonly [];
631
+ readonly routes: readonly [];
632
+ readonly serviceId: null;
429
633
  }];
430
634
  };
431
635
  readonly feed: {
@@ -433,22 +637,29 @@ declare const APPLICATIONS: {
433
637
  readonly appDir: "TopoloFeed";
434
638
  readonly name: "TopoloFeed";
435
639
  readonly packageName: "topolo-feed";
436
- readonly productionUrl: "https://feed-api.topolo.app";
640
+ readonly productionUrl: "https://feed.topolo.app";
437
641
  readonly services: readonly ["feed"];
438
642
  readonly deployTargets: readonly [{
439
643
  readonly name: "topolo-feed-analytics-api";
440
644
  readonly kind: "worker";
441
645
  readonly apiUrl: "https://feed-analytics-api.topolo.app";
442
646
  readonly domains: readonly ["feed-analytics-api.topolo.app"];
443
- readonly routes: readonly ["feed-analytics-api.topolo.app"];
647
+ readonly routes: readonly [];
444
648
  readonly serviceId: null;
445
649
  }, {
446
650
  readonly name: "topolo-feed-api";
447
651
  readonly kind: "worker";
448
652
  readonly apiUrl: "https://feed-api.topolo.app";
449
653
  readonly domains: readonly ["feed-api.topolo.app"];
450
- readonly routes: readonly ["feed-api.topolo.app"];
654
+ readonly routes: readonly [];
451
655
  readonly serviceId: "feed";
656
+ }, {
657
+ readonly name: "topolo-feed-web";
658
+ readonly kind: "worker";
659
+ readonly apiUrl: "https://feed.topolo.app";
660
+ readonly domains: readonly ["feed.topolo.app"];
661
+ readonly routes: readonly [];
662
+ readonly serviceId: null;
452
663
  }];
453
664
  };
454
665
  readonly flow: {
@@ -463,21 +674,28 @@ declare const APPLICATIONS: {
463
674
  readonly kind: "worker";
464
675
  readonly apiUrl: "https://flow.topolo.app";
465
676
  readonly domains: readonly ["flow.topolo.app"];
466
- readonly routes: readonly ["flow.topolo.app"];
677
+ readonly routes: readonly [];
467
678
  readonly serviceId: "flow";
679
+ }, {
680
+ readonly name: "topolo-flow-api";
681
+ readonly kind: "worker";
682
+ readonly apiUrl: null;
683
+ readonly domains: readonly [];
684
+ readonly routes: readonly [];
685
+ readonly serviceId: null;
468
686
  }];
469
687
  };
470
688
  readonly forecast: {
471
689
  readonly id: "forecast";
472
690
  readonly appDir: "TopoloForecast";
473
- readonly name: "forecast-cloud";
691
+ readonly name: "topolo-forecast";
474
692
  readonly packageName: "topolo-forecast";
475
693
  readonly productionUrl: "https://forecast.topolo.app";
476
694
  readonly services: readonly ["forecast"];
477
695
  readonly deployTargets: readonly [{
478
696
  readonly name: "topolo-forecast";
479
697
  readonly kind: "worker";
480
- readonly apiUrl: null;
698
+ readonly apiUrl: "https://forecast.topolo.app";
481
699
  readonly domains: readonly ["forecast.topolo.app"];
482
700
  readonly routes: readonly [];
483
701
  readonly serviceId: null;
@@ -502,8 +720,15 @@ declare const APPLICATIONS: {
502
720
  readonly kind: "worker";
503
721
  readonly apiUrl: "https://forms.topolo.app";
504
722
  readonly domains: readonly ["forms.topolo.app"];
505
- readonly routes: readonly ["forms.topolo.app"];
723
+ readonly routes: readonly [];
506
724
  readonly serviceId: "forms";
725
+ }, {
726
+ readonly name: "topolo-forms-api";
727
+ readonly kind: "worker";
728
+ readonly apiUrl: null;
729
+ readonly domains: readonly [];
730
+ readonly routes: readonly [];
731
+ readonly serviceId: null;
507
732
  }];
508
733
  };
509
734
  readonly home: {
@@ -518,8 +743,15 @@ declare const APPLICATIONS: {
518
743
  readonly kind: "worker";
519
744
  readonly apiUrl: "https://home.topolo.app";
520
745
  readonly domains: readonly ["home.topolo.app"];
521
- readonly routes: readonly ["home.topolo.app"];
746
+ readonly routes: readonly [];
522
747
  readonly serviceId: "home";
748
+ }, {
749
+ readonly name: "topolo-home-api";
750
+ readonly kind: "worker";
751
+ readonly apiUrl: null;
752
+ readonly domains: readonly [];
753
+ readonly routes: readonly [];
754
+ readonly serviceId: null;
523
755
  }];
524
756
  };
525
757
  readonly insights: {
@@ -534,8 +766,15 @@ declare const APPLICATIONS: {
534
766
  readonly kind: "worker";
535
767
  readonly apiUrl: "https://insights.topolo.app";
536
768
  readonly domains: readonly ["insights.topolo.app"];
537
- readonly routes: readonly ["insights.topolo.app"];
769
+ readonly routes: readonly [];
538
770
  readonly serviceId: "insights";
771
+ }, {
772
+ readonly name: "topolo-insights-api";
773
+ readonly kind: "worker";
774
+ readonly apiUrl: null;
775
+ readonly domains: readonly [];
776
+ readonly routes: readonly [];
777
+ readonly serviceId: null;
539
778
  }];
540
779
  };
541
780
  readonly inventory: {
@@ -550,8 +789,15 @@ declare const APPLICATIONS: {
550
789
  readonly kind: "worker";
551
790
  readonly apiUrl: "https://inventory.topolo.app";
552
791
  readonly domains: readonly ["inventory.topolo.app"];
553
- readonly routes: readonly ["inventory.topolo.app"];
792
+ readonly routes: readonly [];
554
793
  readonly serviceId: "inventory";
794
+ }, {
795
+ readonly name: "topolo-inventory-api";
796
+ readonly kind: "worker";
797
+ readonly apiUrl: null;
798
+ readonly domains: readonly [];
799
+ readonly routes: readonly [];
800
+ readonly serviceId: null;
555
801
  }];
556
802
  };
557
803
  readonly learn: {
@@ -564,7 +810,7 @@ declare const APPLICATIONS: {
564
810
  readonly deployTargets: readonly [{
565
811
  readonly name: "topolo-learn";
566
812
  readonly kind: "worker";
567
- readonly apiUrl: null;
813
+ readonly apiUrl: "https://learn.topolo.app";
568
814
  readonly domains: readonly ["learn.topolo.app"];
569
815
  readonly routes: readonly [];
570
816
  readonly serviceId: null;
@@ -605,8 +851,15 @@ declare const APPLICATIONS: {
605
851
  readonly kind: "worker";
606
852
  readonly apiUrl: "https://mail.topolo.app";
607
853
  readonly domains: readonly ["mail.topolo.app"];
608
- readonly routes: readonly ["mail.topolo.app"];
854
+ readonly routes: readonly [];
609
855
  readonly serviceId: "mail";
856
+ }, {
857
+ readonly name: "topolo-mail-api";
858
+ readonly kind: "worker";
859
+ readonly apiUrl: null;
860
+ readonly domains: readonly [];
861
+ readonly routes: readonly [];
862
+ readonly serviceId: null;
610
863
  }];
611
864
  };
612
865
  readonly mdm: {
@@ -621,33 +874,40 @@ declare const APPLICATIONS: {
621
874
  readonly kind: "worker";
622
875
  readonly apiUrl: "https://mdm-api.topolo.app";
623
876
  readonly domains: readonly ["mdm-api.topolo.app"];
624
- readonly routes: readonly ["mdm-api.topolo.app"];
877
+ readonly routes: readonly [];
625
878
  readonly serviceId: "mdm";
626
879
  }, {
627
880
  readonly name: "topolo-mdm-console";
628
881
  readonly kind: "worker";
629
- readonly apiUrl: null;
882
+ readonly apiUrl: "https://mdm.topolo.app";
630
883
  readonly domains: readonly ["mdm.topolo.app"];
631
- readonly routes: readonly ["mdm.topolo.app"];
884
+ readonly routes: readonly [];
632
885
  readonly serviceId: null;
633
886
  }];
634
887
  };
635
- readonly messaging: {
636
- readonly id: "messaging";
637
- readonly appDir: "TopoloMessaging";
638
- readonly name: "topolo-messaging";
639
- readonly packageName: "topolo-messaging";
888
+ readonly messages: {
889
+ readonly id: "messages";
890
+ readonly appDir: "TopoloMessages";
891
+ readonly name: "topolo-messages";
892
+ readonly packageName: "topolo-messages";
640
893
  readonly productionUrl: "https://messages.topolo.app";
641
- readonly services: readonly ["messaging"];
894
+ readonly services: readonly ["messages"];
642
895
  readonly deployTargets: readonly [{
643
- readonly name: "topolo-messaging";
896
+ readonly name: "topolo-messages";
644
897
  readonly kind: "worker";
645
898
  readonly apiUrl: "https://messages.topolo.app";
646
899
  readonly domains: readonly ["messages.topolo.app"];
647
900
  readonly routes: readonly [];
648
- readonly serviceId: "messaging";
901
+ readonly serviceId: "messages";
649
902
  }, {
650
- readonly name: "topolo-messaging-dispatch";
903
+ readonly name: "topolo-messages-api";
904
+ readonly kind: "worker";
905
+ readonly apiUrl: null;
906
+ readonly domains: readonly [];
907
+ readonly routes: readonly [];
908
+ readonly serviceId: null;
909
+ }, {
910
+ readonly name: "topolo-messages-dispatch";
651
911
  readonly kind: "worker";
652
912
  readonly apiUrl: null;
653
913
  readonly domains: readonly [];
@@ -699,9 +959,16 @@ declare const APPLICATIONS: {
699
959
  readonly appDir: "TopoloObservabilityWatch";
700
960
  readonly name: "topolo-observability-watch";
701
961
  readonly packageName: "topolo-observability-watch";
702
- readonly productionUrl: null;
703
- readonly services: readonly [];
704
- readonly deployTargets: readonly [];
962
+ readonly productionUrl: "https://observability-watch.topolo.app";
963
+ readonly services: readonly ["observability_watch"];
964
+ readonly deployTargets: readonly [{
965
+ readonly name: "topolo-observability-watch";
966
+ readonly kind: "worker";
967
+ readonly apiUrl: "https://observability-watch.topolo.app";
968
+ readonly domains: readonly ["observability-watch.topolo.app"];
969
+ readonly routes: readonly [];
970
+ readonly serviceId: "observability_watch";
971
+ }];
705
972
  };
706
973
  readonly one: {
707
974
  readonly id: "one";
@@ -712,25 +979,25 @@ declare const APPLICATIONS: {
712
979
  readonly services: readonly ["one"];
713
980
  readonly deployTargets: readonly [{
714
981
  readonly name: "topolo-one";
715
- readonly kind: "pages";
716
- readonly apiUrl: null;
717
- readonly domains: readonly ["one.topolo.app"];
718
- readonly routes: readonly [];
719
- readonly serviceId: null;
720
- }, {
721
- readonly name: "topolo-one-website";
722
982
  readonly kind: "worker";
723
983
  readonly apiUrl: null;
724
- readonly domains: readonly ["topolo.io", "www.topolo.io"];
984
+ readonly domains: readonly [];
725
985
  readonly routes: readonly [];
726
986
  readonly serviceId: null;
727
987
  }, {
728
- readonly name: "topolo-one-worker";
988
+ readonly name: "topolo-one-api";
729
989
  readonly kind: "worker";
730
990
  readonly apiUrl: "https://one.topolo.app";
731
- readonly domains: readonly ["one.topolo.app", "topolo.app", "www.topolo.app"];
732
- readonly routes: readonly ["one.topolo.app/*", "topolo.app", "www.topolo.app/*"];
991
+ readonly domains: readonly ["one.topolo.app"];
992
+ readonly routes: readonly ["one.topolo.app/*", "www.topolo.app/*"];
733
993
  readonly serviceId: "one";
994
+ }, {
995
+ readonly name: "topolo-one-website";
996
+ readonly kind: "worker";
997
+ readonly apiUrl: "https://topolo.io";
998
+ readonly domains: readonly ["topolo.io"];
999
+ readonly routes: readonly ["topolo.io", "www.topolo.io"];
1000
+ readonly serviceId: null;
734
1001
  }];
735
1002
  };
736
1003
  readonly p2p: {
@@ -745,8 +1012,15 @@ declare const APPLICATIONS: {
745
1012
  readonly kind: "worker";
746
1013
  readonly apiUrl: "https://p2p.topolo.app";
747
1014
  readonly domains: readonly ["p2p.topolo.app"];
748
- readonly routes: readonly ["p2p.topolo.app"];
1015
+ readonly routes: readonly [];
749
1016
  readonly serviceId: "p2p";
1017
+ }, {
1018
+ readonly name: "topolo-p2p-api";
1019
+ readonly kind: "worker";
1020
+ readonly apiUrl: null;
1021
+ readonly domains: readonly [];
1022
+ readonly routes: readonly [];
1023
+ readonly serviceId: null;
750
1024
  }];
751
1025
  };
752
1026
  readonly pay: {
@@ -763,6 +1037,13 @@ declare const APPLICATIONS: {
763
1037
  readonly domains: readonly ["pay.topolo.app"];
764
1038
  readonly routes: readonly [];
765
1039
  readonly serviceId: "pay";
1040
+ }, {
1041
+ readonly name: "topolo-pay-api";
1042
+ readonly kind: "worker";
1043
+ readonly apiUrl: null;
1044
+ readonly domains: readonly [];
1045
+ readonly routes: readonly [];
1046
+ readonly serviceId: null;
766
1047
  }];
767
1048
  };
768
1049
  readonly people: {
@@ -777,8 +1058,15 @@ declare const APPLICATIONS: {
777
1058
  readonly kind: "worker";
778
1059
  readonly apiUrl: "https://people.topolo.app";
779
1060
  readonly domains: readonly ["people.topolo.app"];
780
- readonly routes: readonly ["people.topolo.app"];
1061
+ readonly routes: readonly [];
781
1062
  readonly serviceId: "people";
1063
+ }, {
1064
+ readonly name: "topolo-people-api";
1065
+ readonly kind: "worker";
1066
+ readonly apiUrl: null;
1067
+ readonly domains: readonly [];
1068
+ readonly routes: readonly [];
1069
+ readonly serviceId: null;
782
1070
  }];
783
1071
  };
784
1072
  readonly pulse: {
@@ -793,8 +1081,15 @@ declare const APPLICATIONS: {
793
1081
  readonly kind: "worker";
794
1082
  readonly apiUrl: "https://pulse.topolo.app";
795
1083
  readonly domains: readonly ["pulse.topolo.app"];
796
- readonly routes: readonly ["pulse.topolo.app"];
1084
+ readonly routes: readonly [];
797
1085
  readonly serviceId: "pulse";
1086
+ }, {
1087
+ readonly name: "topolo-pulse-api";
1088
+ readonly kind: "worker";
1089
+ readonly apiUrl: null;
1090
+ readonly domains: readonly [];
1091
+ readonly routes: readonly [];
1092
+ readonly serviceId: null;
798
1093
  }];
799
1094
  };
800
1095
  readonly quro: {
@@ -809,7 +1104,7 @@ declare const APPLICATIONS: {
809
1104
  readonly kind: "worker";
810
1105
  readonly apiUrl: "https://api.ol0.me";
811
1106
  readonly domains: readonly ["api.ol0.me"];
812
- readonly routes: readonly [];
1107
+ readonly routes: readonly ["api.ol0.me/*"];
813
1108
  readonly serviceId: "quro.api";
814
1109
  }, {
815
1110
  readonly name: "quro-redirect-system";
@@ -821,7 +1116,7 @@ declare const APPLICATIONS: {
821
1116
  }, {
822
1117
  readonly name: "quro-ui";
823
1118
  readonly kind: "worker";
824
- readonly apiUrl: null;
1119
+ readonly apiUrl: "https://quro.topolo.app";
825
1120
  readonly domains: readonly ["quro.topolo.app"];
826
1121
  readonly routes: readonly [];
827
1122
  readonly serviceId: null;
@@ -837,7 +1132,7 @@ declare const APPLICATIONS: {
837
1132
  readonly deployTargets: readonly [{
838
1133
  readonly name: "topolo-roadmapper";
839
1134
  readonly kind: "worker";
840
- readonly apiUrl: null;
1135
+ readonly apiUrl: "https://roadmapper.topolo.app";
841
1136
  readonly domains: readonly ["roadmapper.topolo.app"];
842
1137
  readonly routes: readonly [];
843
1138
  readonly serviceId: null;
@@ -862,8 +1157,15 @@ declare const APPLICATIONS: {
862
1157
  readonly kind: "worker";
863
1158
  readonly apiUrl: "https://sign.topolo.app";
864
1159
  readonly domains: readonly ["sign.topolo.app"];
865
- readonly routes: readonly ["sign.topolo.app"];
1160
+ readonly routes: readonly [];
866
1161
  readonly serviceId: "sign";
1162
+ }, {
1163
+ readonly name: "topolo-sign-api";
1164
+ readonly kind: "worker";
1165
+ readonly apiUrl: null;
1166
+ readonly domains: readonly [];
1167
+ readonly routes: readonly [];
1168
+ readonly serviceId: null;
867
1169
  }];
868
1170
  };
869
1171
  readonly social_studio: {
@@ -876,7 +1178,7 @@ declare const APPLICATIONS: {
876
1178
  readonly deployTargets: readonly [{
877
1179
  readonly name: "topolo-social-studio";
878
1180
  readonly kind: "worker";
879
- readonly apiUrl: null;
1181
+ readonly apiUrl: "https://studio.topolo.app";
880
1182
  readonly domains: readonly ["studio.topolo.app"];
881
1183
  readonly routes: readonly [];
882
1184
  readonly serviceId: null;
@@ -905,8 +1207,8 @@ declare const APPLICATIONS: {
905
1207
  readonly services: readonly ["socialize"];
906
1208
  readonly deployTargets: readonly [{
907
1209
  readonly name: "topolo-socialize";
908
- readonly kind: "pages";
909
- readonly apiUrl: null;
1210
+ readonly kind: "worker";
1211
+ readonly apiUrl: "https://socialize.topolo.app";
910
1212
  readonly domains: readonly ["socialize.topolo.app"];
911
1213
  readonly routes: readonly [];
912
1214
  readonly serviceId: null;
@@ -938,8 +1240,15 @@ declare const APPLICATIONS: {
938
1240
  readonly kind: "worker";
939
1241
  readonly apiUrl: "https://spaces.topolo.app";
940
1242
  readonly domains: readonly ["spaces.topolo.app"];
941
- readonly routes: readonly ["spaces.topolo.app"];
1243
+ readonly routes: readonly [];
942
1244
  readonly serviceId: "spaces";
1245
+ }, {
1246
+ readonly name: "topolo-spaces-api";
1247
+ readonly kind: "worker";
1248
+ readonly apiUrl: null;
1249
+ readonly domains: readonly [];
1250
+ readonly routes: readonly [];
1251
+ readonly serviceId: null;
943
1252
  }];
944
1253
  };
945
1254
  readonly status: {
@@ -954,10 +1263,33 @@ declare const APPLICATIONS: {
954
1263
  readonly kind: "worker";
955
1264
  readonly apiUrl: "https://status.topolo.app";
956
1265
  readonly domains: readonly ["status.topolo.app"];
957
- readonly routes: readonly ["status.topolo.app"];
1266
+ readonly routes: readonly [];
958
1267
  readonly serviceId: "status";
959
1268
  }];
960
1269
  };
1270
+ readonly success: {
1271
+ readonly id: "success";
1272
+ readonly appDir: "TopoloSuccess";
1273
+ readonly name: "topolo-success";
1274
+ readonly packageName: "topolo-success";
1275
+ readonly productionUrl: "https://success.topolo.app";
1276
+ readonly services: readonly ["success"];
1277
+ readonly deployTargets: readonly [{
1278
+ readonly name: "topolo-success";
1279
+ readonly kind: "worker";
1280
+ readonly apiUrl: "https://success.topolo.app";
1281
+ readonly domains: readonly ["success.topolo.app"];
1282
+ readonly routes: readonly ["success.topolo.app"];
1283
+ readonly serviceId: "success";
1284
+ }, {
1285
+ readonly name: "topolo-success-api";
1286
+ readonly kind: "worker";
1287
+ readonly apiUrl: null;
1288
+ readonly domains: readonly [];
1289
+ readonly routes: readonly [];
1290
+ readonly serviceId: null;
1291
+ }];
1292
+ };
961
1293
  readonly support: {
962
1294
  readonly id: "support";
963
1295
  readonly appDir: "TopoloSupport";
@@ -972,6 +1304,13 @@ declare const APPLICATIONS: {
972
1304
  readonly domains: readonly ["support.topolo.app"];
973
1305
  readonly routes: readonly ["support.topolo.app/*"];
974
1306
  readonly serviceId: "support";
1307
+ }, {
1308
+ readonly name: "topolo-support-api";
1309
+ readonly kind: "worker";
1310
+ readonly apiUrl: null;
1311
+ readonly domains: readonly [];
1312
+ readonly routes: readonly [];
1313
+ readonly serviceId: null;
975
1314
  }];
976
1315
  };
977
1316
  readonly survey: {
@@ -986,8 +1325,15 @@ declare const APPLICATIONS: {
986
1325
  readonly kind: "worker";
987
1326
  readonly apiUrl: "https://survey.topolo.app";
988
1327
  readonly domains: readonly ["survey.topolo.app"];
989
- readonly routes: readonly ["survey.topolo.app"];
1328
+ readonly routes: readonly [];
990
1329
  readonly serviceId: "survey";
1330
+ }, {
1331
+ readonly name: "topolo-survey-api";
1332
+ readonly kind: "worker";
1333
+ readonly apiUrl: null;
1334
+ readonly domains: readonly [];
1335
+ readonly routes: readonly [];
1336
+ readonly serviceId: null;
991
1337
  }];
992
1338
  };
993
1339
  readonly voice: {
@@ -1002,8 +1348,15 @@ declare const APPLICATIONS: {
1002
1348
  readonly kind: "worker";
1003
1349
  readonly apiUrl: "https://voice.topolo.app";
1004
1350
  readonly domains: readonly ["voice.topolo.app"];
1005
- readonly routes: readonly ["voice.topolo.app"];
1351
+ readonly routes: readonly [];
1006
1352
  readonly serviceId: "voice";
1353
+ }, {
1354
+ readonly name: "topolo-voice-api";
1355
+ readonly kind: "worker";
1356
+ readonly apiUrl: null;
1357
+ readonly domains: readonly [];
1358
+ readonly routes: readonly [];
1359
+ readonly serviceId: null;
1007
1360
  }];
1008
1361
  };
1009
1362
  readonly web: {
@@ -1025,12 +1378,12 @@ declare const APPLICATIONS: {
1025
1378
  readonly kind: "worker";
1026
1379
  readonly apiUrl: "https://sites.topolo.app";
1027
1380
  readonly domains: readonly ["sites.topolo.app"];
1028
- readonly routes: readonly [];
1381
+ readonly routes: readonly ["*.sites.topolo.app/*", "sites.topolo.app"];
1029
1382
  readonly serviceId: null;
1030
1383
  }, {
1031
1384
  readonly name: "topolo-web-studio";
1032
1385
  readonly kind: "worker";
1033
- readonly apiUrl: null;
1386
+ readonly apiUrl: "https://web.topolo.app";
1034
1387
  readonly domains: readonly ["web.topolo.app"];
1035
1388
  readonly routes: readonly [];
1036
1389
  readonly serviceId: null;
@@ -1122,8 +1475,8 @@ declare const APPLICATION_REQUIREMENTS: readonly [{
1122
1475
  readonly title: "Register protected APIs as platform services";
1123
1476
  readonly summary: "Callable app APIs need a stable service ID, service slug, permissions, role bundles, and API-key scopes before agents or users rely on them.";
1124
1477
  readonly appliesTo: readonly ["api"];
1125
- readonly evidence: readonly ["Auth service catalog contains the service ID and slug", "Permissions, role bundles, and API-key scopes exist for the service", "SDK, CLI, and MCP service discovery include the callable production API"];
1126
- readonly implementation: readonly ["Add production Worker api_url metadata before adding an SDK service ID", "Expose stable service IDs through DEFAULT_SERVICE_URLS", "Keep typed SDK/CLI/MCP surfaces in sync when an API contract stabilizes"];
1478
+ readonly evidence: readonly ["Auth service catalog contains the service ID and slug", "Permissions, role bundles, and API-key scopes exist for the service", "SDK, CLI, and MCP service discovery include the callable production API", "CloudControl production HTTP targets classify agent reachability with sdk_service_id or agent_callable:false"];
1479
+ readonly implementation: readonly ["Add production Worker api_url metadata and sdk_service_id for every agent-callable API target", "Mark browser, documentation, and runtime-only Worker targets with agent_callable:false", "Expose stable service IDs through generated DEFAULT_SERVICE_URLS and live catalog discovery", "Keep typed SDK/CLI/MCP surfaces in sync when an API contract stabilizes"];
1127
1480
  }, {
1128
1481
  readonly id: "organization-scoped-data";
1129
1482
  readonly title: "Keep application data organization-scoped";
@@ -1191,167 +1544,6 @@ declare function auditAllApplicationRequirements(applicationIds?: readonly Appli
1191
1544
  declare const DEFAULT_SERVICE_URLS: Record<ServiceId, string>;
1192
1545
  declare function resolveServiceUrl(service: ServiceId, overrides?: Partial<Record<ServiceId, string>>): string;
1193
1546
 
1194
- interface TopoloClientOptions {
1195
- credential: TopoloCredential;
1196
- agent: AgentIdentity;
1197
- /** Per-service URL overrides. Useful for staging/dev. */
1198
- serviceUrls?: Partial<Record<ServiceId, string>>;
1199
- /** Per-service TopoloAuth service id overrides from the owning app/deployment. */
1200
- serviceIds?: Partial<Record<ServiceId, string>>;
1201
- /**
1202
- * When true, mutating helpers (POST/PUT/PATCH/DELETE) require callers to pass
1203
- * `{ confirm: true }`. Defaults to true. Set false only for trusted surfaces.
1204
- */
1205
- requireConfirmForWrites?: boolean;
1206
- /** HTTP request timeout (ms). Default 30s. */
1207
- timeoutMs?: number;
1208
- /** Injected fetch, for testing. Defaults to global fetch. */
1209
- fetch?: typeof fetch;
1210
- /**
1211
- * Observability hook. Fires once per request lifecycle (`request` at start,
1212
- * then exactly one of `response` or `error`). Safe to leave unset — off by
1213
- * default. Intended for CLI/MCP hosts to surface request-level diagnostics
1214
- * and for consumers building their own logging/tracing.
1215
- */
1216
- debug?: (event: TopoloDebugEvent) => void;
1217
- }
1218
- type TopoloDebugEvent = {
1219
- phase: 'request';
1220
- method: string;
1221
- service: ServiceId;
1222
- path: string;
1223
- url: string;
1224
- requestId: string;
1225
- } | {
1226
- phase: 'response';
1227
- method: string;
1228
- service: ServiceId;
1229
- path: string;
1230
- url: string;
1231
- requestId: string;
1232
- status: number;
1233
- durationMs: number;
1234
- } | {
1235
- phase: 'error';
1236
- method: string;
1237
- service: ServiceId;
1238
- path: string;
1239
- url: string;
1240
- requestId: string;
1241
- durationMs: number;
1242
- error: string;
1243
- status?: number;
1244
- };
1245
- interface RequestOptions {
1246
- service: ServiceId;
1247
- path: string;
1248
- method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
1249
- query?: Record<string, string | number | boolean | undefined>;
1250
- body?: unknown;
1251
- /** Explicit write-acknowledgement for mutating calls. */
1252
- confirm?: boolean;
1253
- /** Extra headers appended after auth/audit headers. */
1254
- headers?: Record<string, string>;
1255
- signal?: AbortSignal;
1256
- }
1257
- /**
1258
- * A single entry from the live platform service catalog. Returned by
1259
- * {@link TopoloClient.listServices}. Shape mirrors the public-safe projection
1260
- * from TopoloAuth `GET /api/services/catalog`.
1261
- */
1262
- interface TopoloServiceCatalogEntry {
1263
- serviceId: string;
1264
- slug: string | null;
1265
- name: string | null;
1266
- description: string | null;
1267
- baseUrl: string | null;
1268
- status: string | null;
1269
- surfaceKind: string | null;
1270
- launchable: boolean;
1271
- }
1272
- declare class TopoloClient {
1273
- private readonly credential;
1274
- private readonly agent;
1275
- private readonly serviceUrls?;
1276
- private readonly serviceIds?;
1277
- private readonly requireConfirmForWrites;
1278
- private readonly timeoutMs;
1279
- private readonly fetchImpl;
1280
- private readonly debug?;
1281
- /**
1282
- * Process-wide cache for slug → service-id lookups. Keyed by
1283
- * `${authBaseUrl}|${slug}` so multiple `TopoloClient` instances pointing at
1284
- * the same Auth share, but staging vs prod don't poison each other.
1285
- * Cleared via `TopoloClient.clearServiceIdCache()` if a test needs it.
1286
- */
1287
- private static readonly serviceIdCache;
1288
- /**
1289
- * Drop the slug→service-id cache. Test-only — production callers should
1290
- * let the 5-minute TTL expire naturally.
1291
- */
1292
- static clearServiceIdCache(): void;
1293
- constructor(options: TopoloClientOptions);
1294
- private emit;
1295
- /**
1296
- * Low-level JSON request. Prefer the typed module helpers (identity, crm, ...)
1297
- * for anything a caller would reach for; this stays exported for escape-hatch
1298
- * use and for the generic `topolo api` / MCP passthrough tool.
1299
- */
1300
- request<T = unknown>(opts: RequestOptions): Promise<T>;
1301
- /**
1302
- * Resolve a service-slug → opaque service-id via caller config or TopoloAuth.
1303
- *
1304
- * Cache: 5 minutes per process per `(slug, auth_base_url)`. Negative
1305
- * results (404) are cached for 60s so a typo doesn't hot-loop the
1306
- * resolver. Returns null when the slug isn't registered — callers decide
1307
- * whether to throw.
1308
- *
1309
- * No credential is sent: the endpoint is public (slugs aren't secret).
1310
- * This keeps the resolver usable during early bootstrap before a caller
1311
- * has acquired an access token.
1312
- */
1313
- getServiceIdBySlug(slug: string): Promise<string | null>;
1314
- /**
1315
- * List the platform service catalog from the live registry
1316
- * (`GET /api/services/catalog` on TopoloAuth). Credential-aware: the
1317
- * caller's credential is attached, so an authenticated caller in an
1318
- * entitled org also receives the `developer_only` services its role
1319
- * permits; an unauthenticated/agent caller receives `active` only.
1320
- *
1321
- * Resilient: on any network/HTTP failure this falls back to the
1322
- * build-time generated `APPLICATIONS` snapshot so offline/degraded
1323
- * callers still get a usable (if static) catalog. The live result is
1324
- * authoritative; the snapshot is a floor, not a cap.
1325
- */
1326
- listServices(): Promise<TopoloServiceCatalogEntry[]>;
1327
- private generatedCatalogFallback;
1328
- /**
1329
- * Introspect the current credential. Returns the caller's resolved identity,
1330
- * organization, and permission set. Used by CLI `whoami` and by MCP to gate
1331
- * advertised tools by scope.
1332
- *
1333
- * Both JWT access tokens and platform API keys are resolved via the unified
1334
- * `GET /api/auth/me` endpoint on TopoloAuth, which does not require service
1335
- * credentials. The caller's possession of the credential secret is proof.
1336
- */
1337
- introspect(): Promise<CredentialIntrospection>;
1338
- }
1339
- interface CredentialIntrospection {
1340
- kind: 'api_key' | 'access_token';
1341
- user: {
1342
- id: string;
1343
- email: string;
1344
- name: string | null;
1345
- role: string;
1346
- permissions: string[];
1347
- };
1348
- organization: {
1349
- id: string;
1350
- slug: string;
1351
- name: string;
1352
- } | null;
1353
- }
1354
-
1355
1547
  declare class TopoloSdkError extends Error {
1356
1548
  readonly code: string;
1357
1549
  constructor(code: string, message: string);