@topolo/sdk 0.9.10 → 0.10.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.ts CHANGED
@@ -427,8 +427,9 @@ declare class TopoloClient {
427
427
  }): Promise<T>;
428
428
  private executeResolvedAction;
429
429
  /**
430
- * Bundled generated registry for tooling that audits platform packaging, not
431
- * for deciding what the current credential may use.
430
+ * @deprecated Static fallback snapshot only. Use `searchServices()` (the
431
+ * live credential-scoped registry) for anything that decides behavior; this
432
+ * exists for offline packaging audits when the registry is unreachable.
432
433
  */
433
434
  listBundledServices(): TopoloServiceCatalogEntry[];
434
435
  /**
@@ -469,6 +470,289 @@ interface CredentialIntrospection {
469
470
  } | null;
470
471
  }
471
472
 
473
+ /**
474
+ * Live application directory — resolve, enumerate, and identify platform
475
+ * applications from the credential-scoped live registry.
476
+ *
477
+ * The platform scales to millions of constantly-changing applications, so no
478
+ * compiled application map may gate behavior. The live registry
479
+ * (`searchServices` / `getService` on the Catalog service) is the source of
480
+ * truth. The bundled static snapshot (`applications-fallback.ts`) is consulted
481
+ * ONLY when the registry is unreachable (network failure, no credential), and
482
+ * as metadata enrichment for apps the registry already confirmed — it must
483
+ * never cause a registry-known application to be rejected.
484
+ */
485
+
486
+ interface ApplicationDeployTarget {
487
+ name: string;
488
+ kind: string;
489
+ apiUrl: string | null;
490
+ domains: readonly string[];
491
+ routes: readonly string[];
492
+ appId: string | null;
493
+ }
494
+ interface ApplicationCatalogEntry {
495
+ id: string;
496
+ appDir: string;
497
+ name: string;
498
+ packageName: string | null;
499
+ productionUrl: string | null;
500
+ services: readonly string[];
501
+ deployTargets: readonly ApplicationDeployTarget[];
502
+ }
503
+ /**
504
+ * Application ids are open-ended — they come from the live registry, not a
505
+ * compiled union. Kept as a named alias for source compatibility.
506
+ */
507
+ type ApplicationId = string;
508
+ /**
509
+ * Derive the human-friendly application id from a live catalog entry: the
510
+ * canonical slug with the vendor prefix stripped (`topolo-notify` → `notify`).
511
+ * Falls back through name and appId (`app_topolo_notify` → `notify`). Never
512
+ * consults a static map, so newly registered applications get a friendly id
513
+ * without a client rebuild.
514
+ */
515
+ declare function friendlyAppId(entry: {
516
+ appId: string;
517
+ slug?: string | null;
518
+ name?: string | null;
519
+ }): string;
520
+ /** Synthesize a catalog entry for an application known only to the live registry. */
521
+ declare function applicationEntryFromCatalog(live: TopoloServiceCatalogEntry): ApplicationCatalogEntry;
522
+ type ApplicationDirectorySource = 'live' | 'static_fallback';
523
+ interface ApplicationDirectoryApplication {
524
+ id: string;
525
+ application: ApplicationCatalogEntry;
526
+ source: 'live' | 'static';
527
+ live: TopoloServiceCatalogEntry | null;
528
+ }
529
+ interface ApplicationDirectory {
530
+ source: ApplicationDirectorySource;
531
+ applications: ApplicationDirectoryApplication[];
532
+ }
533
+ /** The subset of TopoloClient the directory helpers need (test-injectable). */
534
+ interface ApplicationDirectoryClient {
535
+ searchServices(options?: {
536
+ query?: string;
537
+ cursor?: string;
538
+ limit?: number;
539
+ }): Promise<{
540
+ services: TopoloServiceCatalogEntry[];
541
+ page: {
542
+ nextCursor: string | null;
543
+ };
544
+ }>;
545
+ getService(application: string): Promise<TopoloServiceCatalogEntry>;
546
+ }
547
+ /** Static snapshot as a directory — the registry-unreachable fallback. */
548
+ declare function staticApplicationDirectory(): ApplicationDirectory;
549
+ /**
550
+ * Enumerate every application the current credential can see in the live
551
+ * registry (walking the continuation cursor to exhaustion). Falls back to the
552
+ * bundled static snapshot only when the registry cannot be reached — pass
553
+ * `null` as the client to request the fallback explicitly (e.g. no credential
554
+ * configured).
555
+ */
556
+ declare function listApplicationDirectory(client: ApplicationDirectoryClient | null): Promise<ApplicationDirectory>;
557
+ declare function formatDirectoryApplicationIds(directory: ApplicationDirectory): string;
558
+ /**
559
+ * Resolve one application by id, slug, or name against the live registry.
560
+ * Registry-known apps always resolve — the static snapshot can only enrich
561
+ * them, never reject them. When the registry is reachable and does not know
562
+ * the application, the error lists the live ids. When the registry is
563
+ * unreachable (or `client` is null), the static snapshot answers instead.
564
+ */
565
+ declare function resolveApplicationDirectoryEntry(client: ApplicationDirectoryClient | null, application: string): Promise<ApplicationDirectoryApplication>;
566
+
567
+ declare const APPLICATION_REQUIREMENTS_VERSION = "2026-08-11.1";
568
+ type ApplicationRequirementScope = 'all' | 'browser' | 'api' | 'tooling' | 'agent_surface';
569
+ interface ApplicationRequirement {
570
+ id: string;
571
+ title: string;
572
+ summary: string;
573
+ appliesTo: readonly ApplicationRequirementScope[];
574
+ evidence: readonly string[];
575
+ implementation: readonly string[];
576
+ }
577
+ type ApplicationRequirementStatus = 'met' | 'partial' | 'missing' | 'needs_review';
578
+ interface ApplicationRequirementFinding {
579
+ requirementId: string;
580
+ title: string;
581
+ status: ApplicationRequirementStatus;
582
+ reason: string;
583
+ evidence: readonly string[];
584
+ nextActions: readonly string[];
585
+ }
586
+ interface ApplicationRequirementScore {
587
+ met: number;
588
+ partial: number;
589
+ missing: number;
590
+ needsReview: number;
591
+ total: number;
592
+ percent: number;
593
+ }
594
+ interface ApplicationRequirementAudit {
595
+ version: string;
596
+ application: ApplicationCatalogEntry;
597
+ scopes: ApplicationRequirementScope[];
598
+ score: ApplicationRequirementScore;
599
+ findings: ApplicationRequirementFinding[];
600
+ }
601
+ interface ApplicationRequirementMigrationItem {
602
+ applicationId: ApplicationId;
603
+ applicationName: string;
604
+ requirementId: string;
605
+ title: string;
606
+ status: Exclude<ApplicationRequirementStatus, 'met'>;
607
+ reason: string;
608
+ nextActions: readonly string[];
609
+ }
610
+ interface ApplicationRequirementsAuditReport {
611
+ version: string;
612
+ applications: ApplicationRequirementAudit[];
613
+ migrationQueue: ApplicationRequirementMigrationItem[];
614
+ }
615
+ declare const APPLICATION_REQUIREMENTS: readonly [{
616
+ readonly id: "platform-metadata";
617
+ readonly title: "Register the application in platform metadata";
618
+ readonly summary: "Every app must have a stable application ID, CloudControl metadata for deployed surfaces, and package metadata where code is shipped.";
619
+ readonly appliesTo: readonly ["all"];
620
+ readonly evidence: readonly ["topolo.cloudcontrol.json exists for every deployed app surface", "package.json names the package or app when the repo ships code", "The live platform registry exposes the app through topolo apps and MCP discovery"];
621
+ readonly implementation: readonly ["Register the app in the live platform registry (Auth service catalog) before exposing it to agents", "Keep production URLs, Worker names, Pages projects, routes, domains, and bindings current in CloudControl metadata", "Do not leave a new Topolo* app directory without an explicit application ID"];
622
+ }, {
623
+ readonly id: "canonical-docs";
624
+ readonly title: "Update canonical docs with the code change";
625
+ readonly summary: "TopoloDocs is the source of truth for application behavior, ownership, deployment shape, auth boundaries, and operations.";
626
+ readonly appliesTo: readonly ["all"];
627
+ readonly evidence: readonly ["Matching system registry entry exists in TopoloDocs", "Internal handbook coverage exists for the system", "npm run validate passes in TopoloDocs when docs are touched"];
628
+ readonly implementation: readonly ["Read the matching TopoloDocs system entry before coding", "Update docs in the same change when behavior, API, auth, data ownership, deployment, or operations change", "Update last_verified dates on touched canonical pages"];
629
+ }, {
630
+ readonly id: "shared-auth-boundary";
631
+ readonly title: "Use the shared Topolo auth boundary";
632
+ readonly summary: "Applications must derive identity, organization, scopes, and app entitlement from TopoloAuth rather than inventing parallel auth state.";
633
+ readonly appliesTo: readonly ["browser", "api", "tooling", "agent_surface"];
634
+ readonly evidence: readonly ["@topolo/auth-client or @topolo-io/worker-runtime is used where applicable", "No public command, tool, or SDK method accepts orgId", "App slug and Auth app registration are documented for protected APIs"];
635
+ readonly implementation: readonly ["Use shared auth/runtime packages instead of copying token parsing, gateway, or browser storage flows", "Derive organization from the credential on every request", "Route OAuth, refresh, logout, and SSO paths according to the shared Auth contract"];
636
+ }, {
637
+ readonly id: "shared-shell-and-launcher";
638
+ readonly title: "Use the shared shell, launcher, and account menu";
639
+ readonly summary: "Browser applications should feel like one platform and should not create isolated navigation or account surfaces.";
640
+ readonly appliesTo: readonly ["browser"];
641
+ readonly evidence: readonly ["@topolo-io/app-shell is used for the platform shell where the app has authenticated UI", "@topolo-io/app-launcher keeps the shared launcher/app switcher reachable from authenticated app chrome", "Account menu and sign-out behavior use TopoloAppShell or the ui-kit TopoloAccountMenu primitive", "Repeated app body surfaces use shared TopoloAppLayout primitives instead of local stat cards, empty states, or status badges", "Local preview supports deterministic visual QA fixtures for overview, list, detail, settings, and empty/loading states", "Authenticated app body content stays inside the viewport on mobile and desktop widths"];
642
+ readonly implementation: readonly ["Use @topolo-io/app-shell TopoloAppShell for authenticated app layouts", "Use the @topolo-io/ui-kit TopoloAccountMenu primitive when a partial-shell surface still needs account chrome", "Pass app-specific account actions as additive menu items instead of forking dropdowns", "Use shared design tokens and platform UI primitives before creating local equivalents", "Use TopoloAppMetricCard, TopoloAppEmptyState, TopoloAppStatusBadge, TopoloAppGrid, and TopoloAppSection for repeated app body patterns", "Keep visual QA fixtures available through visualQa=1 or __devpreview=1 so screenshot checks do not depend on live API state", "Keep mobile and desktop shell behavior aligned with the platform UI kit", "Constrain the app workspace-view layout wrappers with min-width: 0, width: auto, and viewport-aware max-width so shell padding cannot create page-level horizontal overflow"];
643
+ }, {
644
+ readonly id: "app-registration-and-scopes";
645
+ readonly title: "Register protected APIs as platform apps";
646
+ readonly summary: "Callable app APIs need a stable app ID, app slug, permissions, role bundles, and API-key scopes before agents or users rely on them.";
647
+ readonly appliesTo: readonly ["api"];
648
+ readonly evidence: readonly ["Auth app catalog contains the app ID and slug", "Permissions, role bundles, and API-key scopes exist for the app", "SDK, CLI, and MCP app discovery include the callable production API", "CloudControl production HTTP targets classify agent reachability with sdk_app_id or agent_callable:false"];
649
+ readonly implementation: readonly ["Add production Worker api_url metadata and sdk_app_id for every agent-callable API target", "Mark browser, documentation, and runtime-only Worker targets with agent_callable:false", "Expose stable app IDs through live catalog discovery", "Keep typed SDK/CLI/MCP surfaces in sync when an API contract stabilizes"];
650
+ }, {
651
+ readonly id: "organization-scoped-data";
652
+ readonly title: "Keep application data organization-scoped";
653
+ readonly summary: "Protected data access must be scoped by the authenticated organization at the backend boundary, not by client-provided hints.";
654
+ readonly appliesTo: readonly ["api"];
655
+ readonly evidence: readonly ["Backend request handlers derive org membership from credential validation", "Queries and Durable Object keys include the authenticated organization boundary where data is tenant-owned", "MCP and CLI inputs do not include orgId overrides"];
656
+ readonly implementation: readonly ["Reject or ignore organization hints supplied by clients", "Bind SQL, KV, R2, queue, and Durable Object access to the authenticated organization", "Document service-local exceptions explicitly in the system security assurance record"];
657
+ }, {
658
+ readonly id: "cloudflare-deployment-contract";
659
+ readonly title: "Keep Cloudflare deployment metadata complete";
660
+ readonly summary: "Workers, Pages, bindings, routes, env vars, queues, cron triggers, and deployment commands must be discoverable through CloudControl metadata.";
661
+ readonly appliesTo: readonly ["browser", "api"];
662
+ readonly evidence: readonly ["topolo.cloudcontrol.json lists production deploy targets and URLs", "Wrangler/Pages configuration matches CloudControl metadata", "Secrets and environment variables are not committed"];
663
+ readonly implementation: readonly ["Update CloudControl metadata whenever deployment topology changes", "Prefer Cloudflare-native runtime surfaces for new Topolo app infrastructure", "Keep Worker bindings and Pages domains explicit enough for agents to inspect before deploying"];
664
+ }, {
665
+ readonly id: "agent-and-operator-surfaces";
666
+ readonly title: "Expose agent-safe operations through SDK, CLI, and MCP";
667
+ readonly summary: "Agent-accessible functionality should be discoverable, scope-gated, and write-confirmed instead of hidden behind ad hoc HTTP calls.";
668
+ readonly appliesTo: readonly ["api", "tooling", "agent_surface"];
669
+ readonly evidence: readonly ["Read operations have typed SDK/CLI/MCP surfaces once their contract stabilizes", "Mutating generic calls require --confirm or confirm:true", "MCP tools never accept orgId and advertise only appropriate scope-gated tools"];
670
+ readonly implementation: readonly ["Add SDK types first, then CLI commands and MCP tools for durable workflows", "Use generic API passthrough only as a temporary escape hatch", "Keep command output JSON-stable for agents and human-readable with --no-json"];
671
+ }, {
672
+ readonly id: "native-dashboard-widget";
673
+ readonly title: "Expose a native dashboard widget contract";
674
+ readonly summary: "Launchable first-party applications must populate TopoloOne live workspace through an app-owned /api/widget endpoint using the SDK widget response contract.";
675
+ readonly appliesTo: readonly ["api"];
676
+ readonly evidence: readonly ["The app-owned API exposes GET /api/widget", "The endpoint returns TopoloWidgetApiResponse from @topolo/sdk", "Every returned widget includes snapshot.summary with app-owned operational prose", "The endpoint derives organization/user context from the app auth boundary"];
677
+ readonly implementation: readonly ["Import createTopoloWidgetResponse from @topolo/sdk in the app backend", "Return native app metrics or action widgets instead of generic launch-card fallbacks", "Populate snapshot.summary in the producing app for every widget instead of synthesizing summaries in TopoloOne", "Add a route-level test that validates the response with validateTopoloWidgetResponse"];
678
+ }, {
679
+ readonly id: "observability-and-audit";
680
+ readonly title: "Emit platform audit and debugging signals";
681
+ readonly summary: "Requests, agent actions, and operational workflows need traceable IDs, client labels, and useful failure evidence.";
682
+ readonly appliesTo: readonly ["api", "tooling", "agent_surface"];
683
+ readonly evidence: readonly ["Requests carry X-Topolo-Client and X-Topolo-Request-Id where the SDK is involved", "Agent-originated calls can include X-Topolo-Agent", "Failure modes are documented with request IDs or deployment/log lookup paths"];
684
+ readonly implementation: readonly ["Use TopoloClient for platform API calls rather than raw fetch where practical", "Keep logs free of secrets and tokens", "Document live smoke commands and request-id correlation in canonical docs"];
685
+ }, {
686
+ readonly id: "verification-gates";
687
+ readonly title: "Ship with build, test, docs, and smoke verification";
688
+ readonly summary: "A Topolo app change is not complete until the relevant code checks and docs checks have been run or explicitly reported as blocked.";
689
+ readonly appliesTo: readonly ["all"];
690
+ readonly evidence: readonly ["Relevant package build/typecheck/test commands pass", "TopoloDocs validation passes when docs are touched", "Live or local smoke evidence is captured for user-visible or API behavior"];
691
+ readonly implementation: readonly ["Prefer existing package scripts before adding new tooling", "Run app-specific checks and shared docs validation for behavior changes", "Report any skipped verification with the blocker and residual risk"];
692
+ }];
693
+ declare function applicationRequirementScopes(application: ApplicationCatalogEntry): ApplicationRequirementScope[];
694
+ declare function requirementsForApplication(applicationOrId: ApplicationCatalogEntry | ApplicationId): ApplicationRequirement[];
695
+ declare function auditApplicationRequirements(applicationOrId: ApplicationCatalogEntry | ApplicationId): ApplicationRequirementAudit;
696
+ /**
697
+ * Build the full audit report for a set of already-resolved catalog entries.
698
+ * Live callers resolve entries through the application directory and pass them
699
+ * here; the id-based wrapper below serves only the static-fallback path.
700
+ */
701
+ declare function auditApplicationEntries(applications: readonly ApplicationCatalogEntry[]): ApplicationRequirementsAuditReport;
702
+ declare function auditAllApplicationRequirements(applicationIds?: readonly ApplicationId[]): ApplicationRequirementsAuditReport;
703
+
704
+ declare function compactActionCatalogEntry(action: TopoloActionCatalogEntry): {
705
+ actionId: string;
706
+ title: string;
707
+ description: string;
708
+ method: "PUT" | "POST" | "GET" | "PATCH" | "DELETE";
709
+ readOnly: boolean;
710
+ requiresConfirmation: boolean;
711
+ agentAccess: "auto" | "confirm" | "off";
712
+ requiredPermission: string;
713
+ requiredInput: string[];
714
+ resourceType: string | null;
715
+ exampleInput: Record<string, unknown> | null;
716
+ docsUrl: string | null;
717
+ };
718
+ declare function compactActionValidation(actionId: string, validation: TopoloActionValidationResult): {
719
+ actionId: string;
720
+ valid: boolean;
721
+ errors: TopoloActionValidationIssue[];
722
+ };
723
+ declare function compactActionPlan(plan: TopoloActionPlan): {
724
+ actionId: string;
725
+ valid: boolean;
726
+ errors: TopoloActionValidationIssue[];
727
+ executable: boolean;
728
+ confirmationRequired: boolean;
729
+ confirmationProvided: boolean;
730
+ request: {
731
+ method: TopoloActionCatalogEntry["method"];
732
+ service: string;
733
+ apiBaseUrl: string | null;
734
+ path: string;
735
+ query?: Record<string, string | number | boolean>;
736
+ body?: unknown;
737
+ resource?: {
738
+ resourceType: string;
739
+ resourceId: string;
740
+ };
741
+ } | null;
742
+ verification: string[];
743
+ rollbackActionId: string | null;
744
+ nextActionIds: string[];
745
+ };
746
+ declare function compactApplicationAudit(report: ApplicationRequirementsAuditReport): {
747
+ version: string;
748
+ applications: {
749
+ applicationId: string;
750
+ applicationName: string;
751
+ score: ApplicationRequirementScore;
752
+ }[];
753
+ migrationQueueCount: number;
754
+ };
755
+
472
756
  declare const ACTION_CATALOG_DIGEST_ALGORITHM: "sha256-v1";
473
757
  interface TopoloActionDigestInput {
474
758
  actionId?: string;
@@ -524,58 +808,20 @@ declare function actionContractCompleteness(
524
808
  action: ActionContractSource,
525
809
  ): Record<string, boolean>;
526
810
 
811
+ /**
812
+ * Bootstrap seed URLs — the ONLY static service endpoints in the SDK.
813
+ *
814
+ * `auth` and `developers` must be reachable before the live registry can be
815
+ * consulted at all: developers serves the service catalog itself, so resolving
816
+ * it through the catalog would recurse, and auth issues the credentials the
817
+ * catalog is scoped by. Every other application resolves from the live
818
+ * credential-scoped registry (see application-directory.ts and
819
+ * TopoloClient.resolveRequestService). Never add entries here — a new app
820
+ * belongs in the live registry, not in compiled client code.
821
+ */
527
822
  declare const APP_API_URLS: {
528
- readonly agent: "https://agent.topolo.app";
529
823
  readonly auth: "https://auth.topolo.app";
530
- readonly backup: "https://backup.topolo.app";
531
- readonly blog: "https://blog.topolo.app";
532
- readonly books: "https://books.topolo.app";
533
- readonly brand: "https://brand.topolo.app";
534
- readonly bugfix: "https://bugfix.topolo.app";
535
- readonly bytes: "https://bytes.topolo.app";
536
- readonly calendar: "https://calendar.topolo.app";
537
- readonly campaigns: "https://campaigns.topolo.app";
538
- readonly capacity: "https://capacity.topolo.app";
539
- readonly chat: "https://chat.topolo.app";
540
- readonly commerce: "https://commerce.topolo.app";
541
- readonly compose: "https://compose.topolo.app";
542
- readonly consent: "https://consent.topolo.app";
543
- readonly crm: "https://crm.topolo.app";
544
- readonly design: "https://design.topolo.app";
545
824
  readonly developers: "https://developers.topolo.app";
546
- readonly director: "https://director.topolo.app";
547
- readonly feed: "https://feed.topolo.app";
548
- readonly flow: "https://flow.topolo.app";
549
- readonly forecast: "https://forecast.topolo.app";
550
- readonly forms: "https://forms.topolo.app";
551
- readonly home: "https://home.topolo.app";
552
- readonly insights: "https://insights.topolo.app";
553
- readonly inventory: "https://inventory.topolo.app";
554
- readonly learn: "https://learn.topolo.app";
555
- readonly localize: "https://localize.topolo.app";
556
- readonly mail: "https://mail.topolo.app";
557
- readonly mdm: "https://mdm.topolo.app";
558
- readonly messages: "https://messages.topolo.app";
559
- readonly nexus: "https://nexus.topolo.app";
560
- readonly notify: "https://notify.topolo.app";
561
- readonly observability_watch: "https://observability-watch.topolo.app";
562
- readonly one: "https://www.topolo.app";
563
- readonly p2p: "https://p2p.topolo.app";
564
- readonly pay: "https://pay.topolo.app";
565
- readonly people: "https://people.topolo.app";
566
- readonly "quro.api": "https://api.ol0.me";
567
- readonly "quro.redirect": "https://ol0.me";
568
- readonly roadmapper: "https://roadmapper.topolo.app";
569
- readonly sign: "https://sign.topolo.app";
570
- readonly social_studio: "https://studio.topolo.app";
571
- readonly socialize: "https://socialize.topolo.app";
572
- readonly spaces: "https://spaces.topolo.app";
573
- readonly status: "https://status.topolo.app";
574
- readonly success: "https://success.topolo.app";
575
- readonly support: "https://support.topolo.app";
576
- readonly survey: "https://survey.topolo.app";
577
- readonly voice: "https://voice.topolo.app";
578
- readonly web: "https://web.topolo.app";
579
825
  };
580
826
  type AppApiId = keyof typeof APP_API_URLS;
581
827
 
@@ -1791,157 +2037,26 @@ declare const APPLICATIONS: {
1791
2037
  }];
1792
2038
  };
1793
2039
  };
1794
- type ApplicationId = keyof typeof APPLICATIONS;
1795
- type ApplicationCatalogEntry = (typeof APPLICATIONS)[ApplicationId];
1796
- type ApplicationDeployTarget = ApplicationCatalogEntry['deployTargets'][number];
1797
-
1798
- declare const APPLICATION_REQUIREMENTS_VERSION = "2026-06-07.1";
1799
- type ApplicationRequirementScope = 'all' | 'browser' | 'api' | 'tooling' | 'agent_surface';
1800
- interface ApplicationRequirement {
1801
- id: string;
1802
- title: string;
1803
- summary: string;
1804
- appliesTo: readonly ApplicationRequirementScope[];
1805
- evidence: readonly string[];
1806
- implementation: readonly string[];
1807
- }
1808
- type ApplicationRequirementStatus = 'met' | 'partial' | 'missing' | 'needs_review';
1809
- interface ApplicationRequirementFinding {
1810
- requirementId: string;
1811
- title: string;
1812
- status: ApplicationRequirementStatus;
1813
- reason: string;
1814
- evidence: readonly string[];
1815
- nextActions: readonly string[];
1816
- }
1817
- interface ApplicationRequirementScore {
1818
- met: number;
1819
- partial: number;
1820
- missing: number;
1821
- needsReview: number;
1822
- total: number;
1823
- percent: number;
1824
- }
1825
- interface ApplicationRequirementAudit {
1826
- version: string;
1827
- application: ApplicationCatalogEntry;
1828
- scopes: ApplicationRequirementScope[];
1829
- score: ApplicationRequirementScore;
1830
- findings: ApplicationRequirementFinding[];
1831
- }
1832
- interface ApplicationRequirementMigrationItem {
1833
- applicationId: ApplicationId;
1834
- applicationName: string;
1835
- requirementId: string;
1836
- title: string;
1837
- status: Exclude<ApplicationRequirementStatus, 'met'>;
1838
- reason: string;
1839
- nextActions: readonly string[];
1840
- }
1841
- interface ApplicationRequirementsAuditReport {
1842
- version: string;
1843
- applications: ApplicationRequirementAudit[];
1844
- migrationQueue: ApplicationRequirementMigrationItem[];
1845
- }
1846
- declare const APPLICATION_REQUIREMENTS: readonly [{
1847
- readonly id: "platform-metadata";
1848
- readonly title: "Register the application in platform metadata";
1849
- readonly summary: "Every app must have a stable application ID, CloudControl metadata for deployed surfaces, and package metadata where code is shipped.";
1850
- readonly appliesTo: readonly ["all"];
1851
- readonly evidence: readonly ["topolo.cloudcontrol.json exists for every deployed app surface", "package.json names the package or app when the repo ships code", "The SDK application catalog exposes the app through topolo apps and MCP discovery"];
1852
- readonly implementation: readonly ["Add the app to the SDK application catalog generator before exposing it to agents", "Keep production URLs, Worker names, Pages projects, routes, domains, and bindings current in CloudControl metadata", "Do not leave a new Topolo* app directory without an explicit application ID"];
1853
- }, {
1854
- readonly id: "canonical-docs";
1855
- readonly title: "Update canonical docs with the code change";
1856
- readonly summary: "TopoloDocs is the source of truth for application behavior, ownership, deployment shape, auth boundaries, and operations.";
1857
- readonly appliesTo: readonly ["all"];
1858
- readonly evidence: readonly ["Matching system registry entry exists in TopoloDocs", "Internal handbook coverage exists for the system", "npm run validate passes in TopoloDocs when docs are touched"];
1859
- readonly implementation: readonly ["Read the matching TopoloDocs system entry before coding", "Update docs in the same change when behavior, API, auth, data ownership, deployment, or operations change", "Update last_verified dates on touched canonical pages"];
1860
- }, {
1861
- readonly id: "shared-auth-boundary";
1862
- readonly title: "Use the shared Topolo auth boundary";
1863
- readonly summary: "Applications must derive identity, organization, scopes, and app entitlement from TopoloAuth rather than inventing parallel auth state.";
1864
- readonly appliesTo: readonly ["browser", "api", "tooling", "agent_surface"];
1865
- readonly evidence: readonly ["@topolo/auth-client or @topolo-io/worker-runtime is used where applicable", "No public command, tool, or SDK method accepts orgId", "App slug and Auth app registration are documented for protected APIs"];
1866
- readonly implementation: readonly ["Use shared auth/runtime packages instead of copying token parsing, gateway, or browser storage flows", "Derive organization from the credential on every request", "Route OAuth, refresh, logout, and SSO paths according to the shared Auth contract"];
1867
- }, {
1868
- readonly id: "shared-shell-and-launcher";
1869
- readonly title: "Use the shared shell, launcher, and account menu";
1870
- readonly summary: "Browser applications should feel like one platform and should not create isolated navigation or account surfaces.";
1871
- readonly appliesTo: readonly ["browser"];
1872
- readonly evidence: readonly ["@topolo-io/app-shell is used for the platform shell where the app has authenticated UI", "@topolo-io/app-launcher keeps the shared launcher/app switcher reachable from authenticated app chrome", "Account menu and sign-out behavior use TopoloAppShell or the ui-kit TopoloAccountMenu primitive", "Repeated app body surfaces use shared TopoloAppLayout primitives instead of local stat cards, empty states, or status badges", "Local preview supports deterministic visual QA fixtures for overview, list, detail, settings, and empty/loading states", "Authenticated app body content stays inside the viewport on mobile and desktop widths"];
1873
- readonly implementation: readonly ["Use @topolo-io/app-shell TopoloAppShell for authenticated app layouts", "Use the @topolo-io/ui-kit TopoloAccountMenu primitive when a partial-shell surface still needs account chrome", "Pass app-specific account actions as additive menu items instead of forking dropdowns", "Use shared design tokens and platform UI primitives before creating local equivalents", "Use TopoloAppMetricCard, TopoloAppEmptyState, TopoloAppStatusBadge, TopoloAppGrid, and TopoloAppSection for repeated app body patterns", "Keep visual QA fixtures available through visualQa=1 or __devpreview=1 so screenshot checks do not depend on live API state", "Keep mobile and desktop shell behavior aligned with the platform UI kit", "Constrain the app workspace-view layout wrappers with min-width: 0, width: auto, and viewport-aware max-width so shell padding cannot create page-level horizontal overflow"];
1874
- }, {
1875
- readonly id: "app-registration-and-scopes";
1876
- readonly title: "Register protected APIs as platform apps";
1877
- readonly summary: "Callable app APIs need a stable app ID, app slug, permissions, role bundles, and API-key scopes before agents or users rely on them.";
1878
- readonly appliesTo: readonly ["api"];
1879
- readonly evidence: readonly ["Auth app catalog contains the app ID and slug", "Permissions, role bundles, and API-key scopes exist for the app", "SDK, CLI, and MCP app discovery include the callable production API", "CloudControl production HTTP targets classify agent reachability with sdk_app_id or agent_callable:false"];
1880
- readonly implementation: readonly ["Add production Worker api_url metadata and sdk_app_id for every agent-callable API target", "Mark browser, documentation, and runtime-only Worker targets with agent_callable:false", "Expose stable app IDs through generated DEFAULT_APP_URLS and live catalog discovery", "Keep typed SDK/CLI/MCP surfaces in sync when an API contract stabilizes"];
1881
- }, {
1882
- readonly id: "organization-scoped-data";
1883
- readonly title: "Keep application data organization-scoped";
1884
- readonly summary: "Protected data access must be scoped by the authenticated organization at the backend boundary, not by client-provided hints.";
1885
- readonly appliesTo: readonly ["api"];
1886
- readonly evidence: readonly ["Backend request handlers derive org membership from credential validation", "Queries and Durable Object keys include the authenticated organization boundary where data is tenant-owned", "MCP and CLI inputs do not include orgId overrides"];
1887
- readonly implementation: readonly ["Reject or ignore organization hints supplied by clients", "Bind SQL, KV, R2, queue, and Durable Object access to the authenticated organization", "Document service-local exceptions explicitly in the system security assurance record"];
1888
- }, {
1889
- readonly id: "cloudflare-deployment-contract";
1890
- readonly title: "Keep Cloudflare deployment metadata complete";
1891
- readonly summary: "Workers, Pages, bindings, routes, env vars, queues, cron triggers, and deployment commands must be discoverable through CloudControl metadata.";
1892
- readonly appliesTo: readonly ["browser", "api"];
1893
- readonly evidence: readonly ["topolo.cloudcontrol.json lists production deploy targets and URLs", "Wrangler/Pages configuration matches CloudControl metadata", "Secrets and environment variables are not committed"];
1894
- readonly implementation: readonly ["Update CloudControl metadata whenever deployment topology changes", "Prefer Cloudflare-native runtime surfaces for new Topolo app infrastructure", "Keep Worker bindings and Pages domains explicit enough for agents to inspect before deploying"];
1895
- }, {
1896
- readonly id: "agent-and-operator-surfaces";
1897
- readonly title: "Expose agent-safe operations through SDK, CLI, and MCP";
1898
- readonly summary: "Agent-accessible functionality should be discoverable, scope-gated, and write-confirmed instead of hidden behind ad hoc HTTP calls.";
1899
- readonly appliesTo: readonly ["api", "tooling", "agent_surface"];
1900
- readonly evidence: readonly ["Read operations have typed SDK/CLI/MCP surfaces once their contract stabilizes", "Mutating generic calls require --confirm or confirm:true", "MCP tools never accept orgId and advertise only appropriate scope-gated tools"];
1901
- readonly implementation: readonly ["Add SDK types first, then CLI commands and MCP tools for durable workflows", "Use generic API passthrough only as a temporary escape hatch", "Keep command output JSON-stable for agents and human-readable with --no-json"];
1902
- }, {
1903
- readonly id: "native-dashboard-widget";
1904
- readonly title: "Expose a native dashboard widget contract";
1905
- readonly summary: "Launchable first-party applications must populate TopoloOne live workspace through an app-owned /api/widget endpoint using the SDK widget response contract.";
1906
- readonly appliesTo: readonly ["api"];
1907
- readonly evidence: readonly ["The app-owned API exposes GET /api/widget", "The endpoint returns TopoloWidgetApiResponse from @topolo/sdk", "Every returned widget includes snapshot.summary with app-owned operational prose", "The endpoint derives organization/user context from the app auth boundary"];
1908
- readonly implementation: readonly ["Import createTopoloWidgetResponse from @topolo/sdk in the app backend", "Return native app metrics or action widgets instead of generic launch-card fallbacks", "Populate snapshot.summary in the producing app for every widget instead of synthesizing summaries in TopoloOne", "Add a route-level test that validates the response with validateTopoloWidgetResponse"];
1909
- }, {
1910
- readonly id: "observability-and-audit";
1911
- readonly title: "Emit platform audit and debugging signals";
1912
- readonly summary: "Requests, agent actions, and operational workflows need traceable IDs, client labels, and useful failure evidence.";
1913
- readonly appliesTo: readonly ["api", "tooling", "agent_surface"];
1914
- readonly evidence: readonly ["Requests carry X-Topolo-Client and X-Topolo-Request-Id where the SDK is involved", "Agent-originated calls can include X-Topolo-Agent", "Failure modes are documented with request IDs or deployment/log lookup paths"];
1915
- readonly implementation: readonly ["Use TopoloClient for platform API calls rather than raw fetch where practical", "Keep logs free of secrets and tokens", "Document live smoke commands and request-id correlation in canonical docs"];
1916
- }, {
1917
- readonly id: "verification-gates";
1918
- readonly title: "Ship with build, test, docs, and smoke verification";
1919
- readonly summary: "A Topolo app change is not complete until the relevant code checks and docs checks have been run or explicitly reported as blocked.";
1920
- readonly appliesTo: readonly ["all"];
1921
- readonly evidence: readonly ["Relevant package build/typecheck/test commands pass", "TopoloDocs validation passes when docs are touched", "Live or local smoke evidence is captured for user-visible or API behavior"];
1922
- readonly implementation: readonly ["Prefer existing package scripts before adding new tooling", "Run app-specific checks and shared docs validation for behavior changes", "Report any skipped verification with the blocker and residual risk"];
1923
- }];
1924
- declare function applicationRequirementScopes(application: ApplicationCatalogEntry): ApplicationRequirementScope[];
1925
- declare function requirementsForApplication(applicationOrId: ApplicationCatalogEntry | ApplicationId): ApplicationRequirement[];
1926
- declare function auditApplicationRequirements(applicationOrId: ApplicationCatalogEntry | ApplicationId): ApplicationRequirementAudit;
1927
- declare function auditAllApplicationRequirements(applicationIds?: readonly ApplicationId[]): ApplicationRequirementsAuditReport;
1928
2040
 
1929
2041
  /**
1930
- * App API registry — base URLs for callable Topolo platform APIs.
2042
+ * Service URL resolution.
1931
2043
  *
1932
- * Source of truth lives in each app's `topolo.cloudcontrol.json`. The
1933
- * `APP_API_URLS` map is regenerated from those files via
1934
- * `scripts/generate-services.mjs`; edit the JSON, not the generated file.
2044
+ * The live credential-scoped registry is the source of truth for every
2045
+ * callable application (see application-directory.ts and
2046
+ * `TopoloClient.searchServices`). The only static URLs the SDK ships are the
2047
+ * bootstrap seeds in `bootstrap-services.ts` (`auth` + `developers`) — the two
2048
+ * endpoints that must be reachable before the registry can be consulted.
1935
2049
  *
1936
- * Any entry can be overridden per-call via `TopoloClient` options, or globally
1937
- * via env vars like `TOPOLO_APP_URL_MAIL` or `TOPOLO_APP_URL_WEB_API`
1938
- * (dots in app API keys become underscores in env vars).
2050
+ * Any URL can be overridden per-call via `TopoloClient` options, or globally
2051
+ * via env vars like `TOPOLO_APP_URL_AUTH` (dots in service keys become
2052
+ * underscores in env vars).
1939
2053
  *
1940
2054
  * IMPORTANT: The SDK NEVER accepts `orgId` as a parameter. Every request is
1941
2055
  * scoped to the organization embedded in the auth credential (JWT claim or
1942
2056
  * API-key binding). This is the load-bearing cross-org isolation guarantee.
1943
2057
  */
1944
2058
 
2059
+ /** Bootstrap seed URLs (auth + developers). Kept under the legacy name. */
1945
2060
  declare const DEFAULT_APP_URLS: Record<AppApiId, string>;
1946
2061
  interface ServiceCatalogUrlEntry {
1947
2062
  appId?: string | null;
@@ -1956,7 +2071,7 @@ declare function resolveCatalogServiceUrl(entry: ServiceCatalogUrlEntry, options
1956
2071
  serviceKey?: string;
1957
2072
  overrides?: Record<string, string> | Partial<Record<AppApiId, string>>;
1958
2073
  }): string | null;
1959
- declare function resolveServiceUrl(service: AppApiId, overrides?: Partial<Record<AppApiId, string>>): string;
2074
+ declare function resolveServiceUrl(service: AppApiId, overrides?: Partial<Record<AppApiId, string>> | Record<string, string>): string;
1960
2075
 
1961
2076
  declare class TopoloSdkError extends Error {
1962
2077
  readonly code: string;
@@ -2546,4 +2661,4 @@ declare function createTopolo(options: TopoloClientOptions): {
2546
2661
  };
2547
2662
  type Topolo = ReturnType<typeof createTopolo>;
2548
2663
 
2549
- export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_APP_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup, type PublishCapabilityInput, type RequestOptions, type ServiceCatalogUrlEntry, TOPOLO_WIDGET_ENDPOINT, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloQuickActionsWidget, type TopoloRecentActivityWidget, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetActionItem, type TopoloWidgetActivityItem, type TopoloWidgetApiResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetDraft, type TopoloWidgetMetric, type TopoloWidgetNotificationItem, type TopoloWidgetResponseOptions, type TopoloWidgetSnapshotMetadata, type TopoloWidgetSnapshotMetric, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationRequirementScopes, auditAllApplicationRequirements, auditApplicationRequirements, createTopolo, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, requirementsForApplication, resolveCatalogServiceUrl, resolveServiceUrl, validateTopoloActionInput, validateTopoloWidgetResponse };
2664
+ export { ACTION_CATALOG_DIGEST_ALGORITHM, APPLICATIONS, APPLICATION_REQUIREMENTS, APPLICATION_REQUIREMENTS_VERSION, type ActionContractManifest, type ActionContractSource, type AgentIdentity, type AppApiId, type ApplicationCatalogEntry, type ApplicationDeployTarget, type ApplicationDirectory, type ApplicationDirectoryApplication, type ApplicationDirectoryClient, type ApplicationDirectorySource, type ApplicationId, type ApplicationRequirement, type ApplicationRequirementAudit, type ApplicationRequirementFinding, type ApplicationRequirementMigrationItem, type ApplicationRequirementScope, type ApplicationRequirementScore, type ApplicationRequirementStatus, type ApplicationRequirementsAuditReport, type CredentialIntrospection, type CrmContactSummary, CrmModule, DEFAULT_APP_URLS, type DeviceAuthorizationResponse, IdentityModule, type ListContactsOptions, type ListContactsResult, type OAuthHelperOptions, type P2PActionDetail, type P2PActionRequestInput, type P2PActionRequestResult, type P2PActionRow, type P2PActionRun, type P2PCapability, type P2PConnection, type P2PHold, type P2PLedgerEntry, P2PModule, type P2PPolicy, type P2PPricingModel, type P2PSettlementBatch, type P2PSettlementGroup, type PublishCapabilityInput, type RequestOptions, type ServiceCatalogUrlEntry, TOPOLO_WIDGET_ENDPOINT, TOPOLO_WIDGET_REFRESH_INTERVAL_MS, type TokenResponse, type Topolo, type TopoloActionAgentContract, type TopoloActionCatalogEntry, type TopoloActionCatalogSummary, type TopoloActionDigestInput, type TopoloActionPlan, type TopoloActionUploadOptions, type TopoloActionValidationIssue, type TopoloActionValidationResult, type TopoloApiKeyResourceMetadata, TopoloAuthError, type TopoloBindableResource, type TopoloBindableResourceCatalog, type TopoloChartWidget, TopoloClient, type TopoloClientOptions, TopoloConfirmationRequiredError, type TopoloCredential, type TopoloDebugEvent, TopoloHttpError, type TopoloInlineBase64UploadContract, type TopoloNotificationsWidget, TopoloOAuth, TopoloPermissionError, type TopoloQuickActionsWidget, type TopoloRecentActivityWidget, TopoloSdkError, type TopoloServiceCatalogEntry, type TopoloStatsWidget, type TopoloWidget, type TopoloWidgetActionItem, type TopoloWidgetActivityItem, type TopoloWidgetApiResponse, type TopoloWidgetBase, type TopoloWidgetConfig, type TopoloWidgetDraft, type TopoloWidgetMetric, type TopoloWidgetNotificationItem, type TopoloWidgetResponseOptions, type TopoloWidgetSnapshotMetadata, type TopoloWidgetSnapshotMetric, type TopoloWidgetType, type TopoloWidgetValidationResult, type TopoloWorkspace, type TopoloWorkspaceListResult, type TopoloWorkspaceMutationResult, type TopoloWorkspacePolicy, WorkspacesModule, actionContractCompleteness, applicationEntryFromCatalog, applicationRequirementScopes, auditAllApplicationRequirements, auditApplicationEntries, auditApplicationRequirements, compactActionCatalogEntry, compactActionPlan, compactActionValidation, compactApplicationAudit, createTopolo, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, requirementsForApplication, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, staticApplicationDirectory, validateTopoloActionInput, validateTopoloWidgetResponse };