@topolo/sdk 0.10.0 → 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.cts CHANGED
@@ -470,6 +470,289 @@ interface CredentialIntrospection {
470
470
  } | null;
471
471
  }
472
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
+
473
756
  declare const ACTION_CATALOG_DIGEST_ALGORITHM: "sha256-v1";
474
757
  interface TopoloActionDigestInput {
475
758
  actionId?: string;
@@ -1755,237 +2038,6 @@ declare const APPLICATIONS: {
1755
2038
  };
1756
2039
  };
1757
2040
 
1758
- /**
1759
- * Live application directory — resolve, enumerate, and identify platform
1760
- * applications from the credential-scoped live registry.
1761
- *
1762
- * The platform scales to millions of constantly-changing applications, so no
1763
- * compiled application map may gate behavior. The live registry
1764
- * (`searchServices` / `getService` on the Catalog service) is the source of
1765
- * truth. The bundled static snapshot (`applications-fallback.ts`) is consulted
1766
- * ONLY when the registry is unreachable (network failure, no credential), and
1767
- * as metadata enrichment for apps the registry already confirmed — it must
1768
- * never cause a registry-known application to be rejected.
1769
- */
1770
-
1771
- interface ApplicationDeployTarget {
1772
- name: string;
1773
- kind: string;
1774
- apiUrl: string | null;
1775
- domains: readonly string[];
1776
- routes: readonly string[];
1777
- appId: string | null;
1778
- }
1779
- interface ApplicationCatalogEntry {
1780
- id: string;
1781
- appDir: string;
1782
- name: string;
1783
- packageName: string | null;
1784
- productionUrl: string | null;
1785
- services: readonly string[];
1786
- deployTargets: readonly ApplicationDeployTarget[];
1787
- }
1788
- /**
1789
- * Application ids are open-ended — they come from the live registry, not a
1790
- * compiled union. Kept as a named alias for source compatibility.
1791
- */
1792
- type ApplicationId = string;
1793
- /**
1794
- * Derive the human-friendly application id from a live catalog entry: the
1795
- * canonical slug with the vendor prefix stripped (`topolo-notify` → `notify`).
1796
- * Falls back through name and appId (`app_topolo_notify` → `notify`). Never
1797
- * consults a static map, so newly registered applications get a friendly id
1798
- * without a client rebuild.
1799
- */
1800
- declare function friendlyAppId(entry: {
1801
- appId: string;
1802
- slug?: string | null;
1803
- name?: string | null;
1804
- }): string;
1805
- /** Synthesize a catalog entry for an application known only to the live registry. */
1806
- declare function applicationEntryFromCatalog(live: TopoloServiceCatalogEntry): ApplicationCatalogEntry;
1807
- type ApplicationDirectorySource = 'live' | 'static_fallback';
1808
- interface ApplicationDirectoryApplication {
1809
- id: string;
1810
- application: ApplicationCatalogEntry;
1811
- source: 'live' | 'static';
1812
- live: TopoloServiceCatalogEntry | null;
1813
- }
1814
- interface ApplicationDirectory {
1815
- source: ApplicationDirectorySource;
1816
- applications: ApplicationDirectoryApplication[];
1817
- }
1818
- /** The subset of TopoloClient the directory helpers need (test-injectable). */
1819
- interface ApplicationDirectoryClient {
1820
- searchServices(options?: {
1821
- query?: string;
1822
- cursor?: string;
1823
- limit?: number;
1824
- }): Promise<{
1825
- services: TopoloServiceCatalogEntry[];
1826
- page: {
1827
- nextCursor: string | null;
1828
- };
1829
- }>;
1830
- getService(application: string): Promise<TopoloServiceCatalogEntry>;
1831
- }
1832
- /** Static snapshot as a directory — the registry-unreachable fallback. */
1833
- declare function staticApplicationDirectory(): ApplicationDirectory;
1834
- /**
1835
- * Enumerate every application the current credential can see in the live
1836
- * registry (walking the continuation cursor to exhaustion). Falls back to the
1837
- * bundled static snapshot only when the registry cannot be reached — pass
1838
- * `null` as the client to request the fallback explicitly (e.g. no credential
1839
- * configured).
1840
- */
1841
- declare function listApplicationDirectory(client: ApplicationDirectoryClient | null): Promise<ApplicationDirectory>;
1842
- declare function formatDirectoryApplicationIds(directory: ApplicationDirectory): string;
1843
- /**
1844
- * Resolve one application by id, slug, or name against the live registry.
1845
- * Registry-known apps always resolve — the static snapshot can only enrich
1846
- * them, never reject them. When the registry is reachable and does not know
1847
- * the application, the error lists the live ids. When the registry is
1848
- * unreachable (or `client` is null), the static snapshot answers instead.
1849
- */
1850
- declare function resolveApplicationDirectoryEntry(client: ApplicationDirectoryClient | null, application: string): Promise<ApplicationDirectoryApplication>;
1851
-
1852
- declare const APPLICATION_REQUIREMENTS_VERSION = "2026-08-11.1";
1853
- type ApplicationRequirementScope = 'all' | 'browser' | 'api' | 'tooling' | 'agent_surface';
1854
- interface ApplicationRequirement {
1855
- id: string;
1856
- title: string;
1857
- summary: string;
1858
- appliesTo: readonly ApplicationRequirementScope[];
1859
- evidence: readonly string[];
1860
- implementation: readonly string[];
1861
- }
1862
- type ApplicationRequirementStatus = 'met' | 'partial' | 'missing' | 'needs_review';
1863
- interface ApplicationRequirementFinding {
1864
- requirementId: string;
1865
- title: string;
1866
- status: ApplicationRequirementStatus;
1867
- reason: string;
1868
- evidence: readonly string[];
1869
- nextActions: readonly string[];
1870
- }
1871
- interface ApplicationRequirementScore {
1872
- met: number;
1873
- partial: number;
1874
- missing: number;
1875
- needsReview: number;
1876
- total: number;
1877
- percent: number;
1878
- }
1879
- interface ApplicationRequirementAudit {
1880
- version: string;
1881
- application: ApplicationCatalogEntry;
1882
- scopes: ApplicationRequirementScope[];
1883
- score: ApplicationRequirementScore;
1884
- findings: ApplicationRequirementFinding[];
1885
- }
1886
- interface ApplicationRequirementMigrationItem {
1887
- applicationId: ApplicationId;
1888
- applicationName: string;
1889
- requirementId: string;
1890
- title: string;
1891
- status: Exclude<ApplicationRequirementStatus, 'met'>;
1892
- reason: string;
1893
- nextActions: readonly string[];
1894
- }
1895
- interface ApplicationRequirementsAuditReport {
1896
- version: string;
1897
- applications: ApplicationRequirementAudit[];
1898
- migrationQueue: ApplicationRequirementMigrationItem[];
1899
- }
1900
- declare const APPLICATION_REQUIREMENTS: readonly [{
1901
- readonly id: "platform-metadata";
1902
- readonly title: "Register the application in platform metadata";
1903
- readonly summary: "Every app must have a stable application ID, CloudControl metadata for deployed surfaces, and package metadata where code is shipped.";
1904
- readonly appliesTo: readonly ["all"];
1905
- 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"];
1906
- 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"];
1907
- }, {
1908
- readonly id: "canonical-docs";
1909
- readonly title: "Update canonical docs with the code change";
1910
- readonly summary: "TopoloDocs is the source of truth for application behavior, ownership, deployment shape, auth boundaries, and operations.";
1911
- readonly appliesTo: readonly ["all"];
1912
- 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"];
1913
- 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"];
1914
- }, {
1915
- readonly id: "shared-auth-boundary";
1916
- readonly title: "Use the shared Topolo auth boundary";
1917
- readonly summary: "Applications must derive identity, organization, scopes, and app entitlement from TopoloAuth rather than inventing parallel auth state.";
1918
- readonly appliesTo: readonly ["browser", "api", "tooling", "agent_surface"];
1919
- 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"];
1920
- 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"];
1921
- }, {
1922
- readonly id: "shared-shell-and-launcher";
1923
- readonly title: "Use the shared shell, launcher, and account menu";
1924
- readonly summary: "Browser applications should feel like one platform and should not create isolated navigation or account surfaces.";
1925
- readonly appliesTo: readonly ["browser"];
1926
- 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"];
1927
- 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"];
1928
- }, {
1929
- readonly id: "app-registration-and-scopes";
1930
- readonly title: "Register protected APIs as platform apps";
1931
- 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.";
1932
- readonly appliesTo: readonly ["api"];
1933
- 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"];
1934
- 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"];
1935
- }, {
1936
- readonly id: "organization-scoped-data";
1937
- readonly title: "Keep application data organization-scoped";
1938
- readonly summary: "Protected data access must be scoped by the authenticated organization at the backend boundary, not by client-provided hints.";
1939
- readonly appliesTo: readonly ["api"];
1940
- 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"];
1941
- 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"];
1942
- }, {
1943
- readonly id: "cloudflare-deployment-contract";
1944
- readonly title: "Keep Cloudflare deployment metadata complete";
1945
- readonly summary: "Workers, Pages, bindings, routes, env vars, queues, cron triggers, and deployment commands must be discoverable through CloudControl metadata.";
1946
- readonly appliesTo: readonly ["browser", "api"];
1947
- 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"];
1948
- 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"];
1949
- }, {
1950
- readonly id: "agent-and-operator-surfaces";
1951
- readonly title: "Expose agent-safe operations through SDK, CLI, and MCP";
1952
- readonly summary: "Agent-accessible functionality should be discoverable, scope-gated, and write-confirmed instead of hidden behind ad hoc HTTP calls.";
1953
- readonly appliesTo: readonly ["api", "tooling", "agent_surface"];
1954
- 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"];
1955
- 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"];
1956
- }, {
1957
- readonly id: "native-dashboard-widget";
1958
- readonly title: "Expose a native dashboard widget contract";
1959
- readonly summary: "Launchable first-party applications must populate TopoloOne live workspace through an app-owned /api/widget endpoint using the SDK widget response contract.";
1960
- readonly appliesTo: readonly ["api"];
1961
- 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"];
1962
- 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"];
1963
- }, {
1964
- readonly id: "observability-and-audit";
1965
- readonly title: "Emit platform audit and debugging signals";
1966
- readonly summary: "Requests, agent actions, and operational workflows need traceable IDs, client labels, and useful failure evidence.";
1967
- readonly appliesTo: readonly ["api", "tooling", "agent_surface"];
1968
- 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"];
1969
- 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"];
1970
- }, {
1971
- readonly id: "verification-gates";
1972
- readonly title: "Ship with build, test, docs, and smoke verification";
1973
- 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.";
1974
- readonly appliesTo: readonly ["all"];
1975
- 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"];
1976
- 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"];
1977
- }];
1978
- declare function applicationRequirementScopes(application: ApplicationCatalogEntry): ApplicationRequirementScope[];
1979
- declare function requirementsForApplication(applicationOrId: ApplicationCatalogEntry | ApplicationId): ApplicationRequirement[];
1980
- declare function auditApplicationRequirements(applicationOrId: ApplicationCatalogEntry | ApplicationId): ApplicationRequirementAudit;
1981
- /**
1982
- * Build the full audit report for a set of already-resolved catalog entries.
1983
- * Live callers resolve entries through the application directory and pass them
1984
- * here; the id-based wrapper below serves only the static-fallback path.
1985
- */
1986
- declare function auditApplicationEntries(applications: readonly ApplicationCatalogEntry[]): ApplicationRequirementsAuditReport;
1987
- declare function auditAllApplicationRequirements(applicationIds?: readonly ApplicationId[]): ApplicationRequirementsAuditReport;
1988
-
1989
2041
  /**
1990
2042
  * Service URL resolution.
1991
2043
  *
@@ -2609,4 +2661,4 @@ declare function createTopolo(options: TopoloClientOptions): {
2609
2661
  };
2610
2662
  type Topolo = ReturnType<typeof createTopolo>;
2611
2663
 
2612
- 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, createTopolo, createTopoloWidgetError, createTopoloWidgetResponse, defineTopoloChartWidget, defineTopoloNotificationsWidget, defineTopoloQuickActionsWidget, defineTopoloRecentActivityWidget, defineTopoloStatsWidget, digestTopoloActionCatalog, enrichActionContract, formatDirectoryApplicationIds, friendlyAppId, listApplicationDirectory, parseTopoloActionUploadContract, prepareTopoloActionBase64UploadInput, prepareTopoloActionUploadInput, requirementsForApplication, resolveApplicationDirectoryEntry, resolveCatalogServiceUrl, resolveServiceUrl, staticApplicationDirectory, 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 };