@meetreeve/ui 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -599,9 +599,48 @@ declare function ContextSwitcher({ items, activeRefId, onSelect, footer, placeho
599
599
  * is the whole backend round-trip (list/connect/disconnect), injected as
600
600
  * `client` (Matt's decision, 2026-07-25): Reeve passes one built on its own
601
601
  * fetch client; a tenant clone passes ~10 lines of its own.
602
+ *
603
+ * Ownership & sharing (DEV-5654 / CD-5): a personal/org kind toggle at
604
+ * connect time, owner attribution on connected tiles, a shared-with-me
605
+ * section, and a manage-sharing panel over the CD-2 grants API. Everything
606
+ * is data-driven from the CD-4 ownership axes the entry carries; the
607
+ * package has no auth deps and must never hardcode a role check. The
608
+ * sharing surface only renders when the injected client provides the
609
+ * optional grant methods, so a pre-CD-5 client keeps working unchanged.
602
610
  */
603
611
  type ConnectableTransport = "composio" | "native";
604
612
  type ConnectableCapability = "read" | "write" | "readwrite";
613
+ type ConnectionKind = "personal" | "org";
614
+ type ConnectorGranteeType = "user" | "role";
615
+ /** An RBAC role a grant can target, injected via the entry data (CD-2). */
616
+ interface ConnectorRoleOption {
617
+ id: string;
618
+ name: string;
619
+ }
620
+ /**
621
+ * Whether this entry may be connected org-wide, and with which role options
622
+ * the sharing UI can grant. Always supplied by the server through the entry
623
+ * data (CD-4) — never inferred client-side from who the viewer is.
624
+ */
625
+ interface OrgConnectPolicy {
626
+ permitted: boolean;
627
+ /** Human-readable reason shown on the disabled org option. */
628
+ reason?: string | null;
629
+ /** Role options offered by manage-sharing's "role" grantee type. */
630
+ role_options?: ConnectorRoleOption[];
631
+ }
632
+ /** One live grant on a connection, as the CD-2 grants API reports it. */
633
+ interface ConnectorGrant {
634
+ id: string;
635
+ grantee_type: ConnectorGranteeType;
636
+ grantee_id: string;
637
+ /** Display name when the server resolves one; falls back to grantee_id. */
638
+ grantee_name?: string | null;
639
+ }
640
+ interface ConnectorGrantInput {
641
+ granteeType: ConnectorGranteeType;
642
+ granteeId: string;
643
+ }
605
644
  interface ConnectableEntry {
606
645
  slug: string;
607
646
  name: string;
@@ -614,19 +653,53 @@ interface ConnectableEntry {
614
653
  status: "connected" | "not_connected";
615
654
  connected_account_id: string | null;
616
655
  since: string | null;
656
+ /**
657
+ * Ownership axes (DEV-5654 / CD-5, from the CD-4 list endpoint). All
658
+ * optional so a pre-CD-4 payload keeps rendering exactly as before:
659
+ * absent fields mean no owner attribution, no shared-with-me grouping,
660
+ * and no manage-sharing affordance.
661
+ */
662
+ kind?: ConnectionKind | null;
663
+ owner?: {
664
+ id: string;
665
+ name: string;
666
+ } | null;
667
+ /** Set when the viewer sees this connection through a grant. */
668
+ shared_by?: {
669
+ id: string;
670
+ name: string;
671
+ } | null;
672
+ /** true = the viewer owns this connection (enables manage-sharing). */
673
+ owned_by_viewer?: boolean;
617
674
  };
618
675
  /** true = tenant has a live connection but the entry left the allowlist. */
619
676
  deprecated: boolean;
677
+ /** Org-connect permission + role options for this entry (CD-4). */
678
+ org_connect?: OrgConnectPolicy | null;
620
679
  }
621
680
  interface ConnectorPickerClient {
622
681
  listConnectable(opts: {
623
682
  purpose?: string;
624
683
  }): Promise<ConnectableEntry[]>;
625
- /** composio -> open the returned connect_url; native may resolve with none. */
626
- connect(entry: ConnectableEntry): Promise<{
684
+ /**
685
+ * composio -> open the returned connect_url; native may resolve with none.
686
+ * `opts.kind` is additive (DEV-5654): a pre-CD-5 client declaring only
687
+ * `connect(entry)` still satisfies this signature and simply ignores it.
688
+ */
689
+ connect(entry: ConnectableEntry, opts?: {
690
+ kind: ConnectionKind;
691
+ }): Promise<{
627
692
  connect_url?: string;
628
693
  }>;
629
694
  disconnect(entry: ConnectableEntry): Promise<void>;
695
+ /**
696
+ * Sharing over the CD-2 grants API (DEV-5654) — all three optional. The
697
+ * manage-sharing UI renders only when every one of them is provided;
698
+ * otherwise the picker behaves exactly as it did before CD-5.
699
+ */
700
+ listGrants?(entry: ConnectableEntry): Promise<ConnectorGrant[]>;
701
+ grant?(entry: ConnectableEntry, input: ConnectorGrantInput): Promise<void>;
702
+ revokeGrant?(entry: ConnectableEntry, grantId: string): Promise<void>;
630
703
  }
631
704
  /**
632
705
  * Structurally identical to the app's own `DnaLens` (src/lib/dna-lens.ts) —
@@ -651,4 +724,4 @@ interface ConnectorPickerProps {
651
724
  }
652
725
  declare function ConnectorPicker({ client, purpose, lens, layout, onConnected, }: ConnectorPickerProps): react.JSX.Element | null;
653
726
 
654
- export { type AppRungItem, AppSidebar, type AppSidebarBrand, type AppSidebarModuleDef, type AppSidebarProps, type AppSidebarTopItem, type Brand, BrandGlyph, type BrandGlyphProps, type ConnectableCapability, type ConnectableEntry, type ConnectableTransport, ConnectorPicker, type ConnectorPickerClient, type ConnectorPickerLens, type ConnectorPickerProps, type ContextOrgGroup, ContextSwitcher, type ContextSwitcherItem, type ContextSwitcherProps, type FallbackModuleDef, Flyout, type FlyoutChild, type FlyoutProps, GLYPH_CANVAS_FILL, type GroupRungItem, type HeaderNavItem, LOCKUP_GAP, LOCKUP_ROW, MARK_CAP_RATIO, MARK_WEIGHT, REEVE_ACCENT, ResponsiveHeader, type ResponsiveHeaderProps, type RungItem, type SidebarLadder, type SidebarLadderParsed, type SidebarRung, type UseLadderRungOptions, WORDMARK_WEIGHT, deriveFallbackLadder, faviconUrl, groupByOrg, reconcileLadder, resolveLadder, useLadderRung, useResponsivePlaceholder, zSidebarLadder };
727
+ export { type AppRungItem, AppSidebar, type AppSidebarBrand, type AppSidebarModuleDef, type AppSidebarProps, type AppSidebarTopItem, type Brand, BrandGlyph, type BrandGlyphProps, type ConnectableCapability, type ConnectableEntry, type ConnectableTransport, type ConnectionKind, type ConnectorGrant, type ConnectorGrantInput, type ConnectorGranteeType, ConnectorPicker, type ConnectorPickerClient, type ConnectorPickerLens, type ConnectorPickerProps, type ConnectorRoleOption, type ContextOrgGroup, ContextSwitcher, type ContextSwitcherItem, type ContextSwitcherProps, type FallbackModuleDef, Flyout, type FlyoutChild, type FlyoutProps, GLYPH_CANVAS_FILL, type GroupRungItem, type HeaderNavItem, LOCKUP_GAP, LOCKUP_ROW, MARK_CAP_RATIO, MARK_WEIGHT, type OrgConnectPolicy, REEVE_ACCENT, ResponsiveHeader, type ResponsiveHeaderProps, type RungItem, type SidebarLadder, type SidebarLadderParsed, type SidebarRung, type UseLadderRungOptions, WORDMARK_WEIGHT, deriveFallbackLadder, faviconUrl, groupByOrg, reconcileLadder, resolveLadder, useLadderRung, useResponsivePlaceholder, zSidebarLadder };
package/dist/index.d.ts CHANGED
@@ -599,9 +599,48 @@ declare function ContextSwitcher({ items, activeRefId, onSelect, footer, placeho
599
599
  * is the whole backend round-trip (list/connect/disconnect), injected as
600
600
  * `client` (Matt's decision, 2026-07-25): Reeve passes one built on its own
601
601
  * fetch client; a tenant clone passes ~10 lines of its own.
602
+ *
603
+ * Ownership & sharing (DEV-5654 / CD-5): a personal/org kind toggle at
604
+ * connect time, owner attribution on connected tiles, a shared-with-me
605
+ * section, and a manage-sharing panel over the CD-2 grants API. Everything
606
+ * is data-driven from the CD-4 ownership axes the entry carries; the
607
+ * package has no auth deps and must never hardcode a role check. The
608
+ * sharing surface only renders when the injected client provides the
609
+ * optional grant methods, so a pre-CD-5 client keeps working unchanged.
602
610
  */
603
611
  type ConnectableTransport = "composio" | "native";
604
612
  type ConnectableCapability = "read" | "write" | "readwrite";
613
+ type ConnectionKind = "personal" | "org";
614
+ type ConnectorGranteeType = "user" | "role";
615
+ /** An RBAC role a grant can target, injected via the entry data (CD-2). */
616
+ interface ConnectorRoleOption {
617
+ id: string;
618
+ name: string;
619
+ }
620
+ /**
621
+ * Whether this entry may be connected org-wide, and with which role options
622
+ * the sharing UI can grant. Always supplied by the server through the entry
623
+ * data (CD-4) — never inferred client-side from who the viewer is.
624
+ */
625
+ interface OrgConnectPolicy {
626
+ permitted: boolean;
627
+ /** Human-readable reason shown on the disabled org option. */
628
+ reason?: string | null;
629
+ /** Role options offered by manage-sharing's "role" grantee type. */
630
+ role_options?: ConnectorRoleOption[];
631
+ }
632
+ /** One live grant on a connection, as the CD-2 grants API reports it. */
633
+ interface ConnectorGrant {
634
+ id: string;
635
+ grantee_type: ConnectorGranteeType;
636
+ grantee_id: string;
637
+ /** Display name when the server resolves one; falls back to grantee_id. */
638
+ grantee_name?: string | null;
639
+ }
640
+ interface ConnectorGrantInput {
641
+ granteeType: ConnectorGranteeType;
642
+ granteeId: string;
643
+ }
605
644
  interface ConnectableEntry {
606
645
  slug: string;
607
646
  name: string;
@@ -614,19 +653,53 @@ interface ConnectableEntry {
614
653
  status: "connected" | "not_connected";
615
654
  connected_account_id: string | null;
616
655
  since: string | null;
656
+ /**
657
+ * Ownership axes (DEV-5654 / CD-5, from the CD-4 list endpoint). All
658
+ * optional so a pre-CD-4 payload keeps rendering exactly as before:
659
+ * absent fields mean no owner attribution, no shared-with-me grouping,
660
+ * and no manage-sharing affordance.
661
+ */
662
+ kind?: ConnectionKind | null;
663
+ owner?: {
664
+ id: string;
665
+ name: string;
666
+ } | null;
667
+ /** Set when the viewer sees this connection through a grant. */
668
+ shared_by?: {
669
+ id: string;
670
+ name: string;
671
+ } | null;
672
+ /** true = the viewer owns this connection (enables manage-sharing). */
673
+ owned_by_viewer?: boolean;
617
674
  };
618
675
  /** true = tenant has a live connection but the entry left the allowlist. */
619
676
  deprecated: boolean;
677
+ /** Org-connect permission + role options for this entry (CD-4). */
678
+ org_connect?: OrgConnectPolicy | null;
620
679
  }
621
680
  interface ConnectorPickerClient {
622
681
  listConnectable(opts: {
623
682
  purpose?: string;
624
683
  }): Promise<ConnectableEntry[]>;
625
- /** composio -> open the returned connect_url; native may resolve with none. */
626
- connect(entry: ConnectableEntry): Promise<{
684
+ /**
685
+ * composio -> open the returned connect_url; native may resolve with none.
686
+ * `opts.kind` is additive (DEV-5654): a pre-CD-5 client declaring only
687
+ * `connect(entry)` still satisfies this signature and simply ignores it.
688
+ */
689
+ connect(entry: ConnectableEntry, opts?: {
690
+ kind: ConnectionKind;
691
+ }): Promise<{
627
692
  connect_url?: string;
628
693
  }>;
629
694
  disconnect(entry: ConnectableEntry): Promise<void>;
695
+ /**
696
+ * Sharing over the CD-2 grants API (DEV-5654) — all three optional. The
697
+ * manage-sharing UI renders only when every one of them is provided;
698
+ * otherwise the picker behaves exactly as it did before CD-5.
699
+ */
700
+ listGrants?(entry: ConnectableEntry): Promise<ConnectorGrant[]>;
701
+ grant?(entry: ConnectableEntry, input: ConnectorGrantInput): Promise<void>;
702
+ revokeGrant?(entry: ConnectableEntry, grantId: string): Promise<void>;
630
703
  }
631
704
  /**
632
705
  * Structurally identical to the app's own `DnaLens` (src/lib/dna-lens.ts) —
@@ -651,4 +724,4 @@ interface ConnectorPickerProps {
651
724
  }
652
725
  declare function ConnectorPicker({ client, purpose, lens, layout, onConnected, }: ConnectorPickerProps): react.JSX.Element | null;
653
726
 
654
- export { type AppRungItem, AppSidebar, type AppSidebarBrand, type AppSidebarModuleDef, type AppSidebarProps, type AppSidebarTopItem, type Brand, BrandGlyph, type BrandGlyphProps, type ConnectableCapability, type ConnectableEntry, type ConnectableTransport, ConnectorPicker, type ConnectorPickerClient, type ConnectorPickerLens, type ConnectorPickerProps, type ContextOrgGroup, ContextSwitcher, type ContextSwitcherItem, type ContextSwitcherProps, type FallbackModuleDef, Flyout, type FlyoutChild, type FlyoutProps, GLYPH_CANVAS_FILL, type GroupRungItem, type HeaderNavItem, LOCKUP_GAP, LOCKUP_ROW, MARK_CAP_RATIO, MARK_WEIGHT, REEVE_ACCENT, ResponsiveHeader, type ResponsiveHeaderProps, type RungItem, type SidebarLadder, type SidebarLadderParsed, type SidebarRung, type UseLadderRungOptions, WORDMARK_WEIGHT, deriveFallbackLadder, faviconUrl, groupByOrg, reconcileLadder, resolveLadder, useLadderRung, useResponsivePlaceholder, zSidebarLadder };
727
+ export { type AppRungItem, AppSidebar, type AppSidebarBrand, type AppSidebarModuleDef, type AppSidebarProps, type AppSidebarTopItem, type Brand, BrandGlyph, type BrandGlyphProps, type ConnectableCapability, type ConnectableEntry, type ConnectableTransport, type ConnectionKind, type ConnectorGrant, type ConnectorGrantInput, type ConnectorGranteeType, ConnectorPicker, type ConnectorPickerClient, type ConnectorPickerLens, type ConnectorPickerProps, type ConnectorRoleOption, type ContextOrgGroup, ContextSwitcher, type ContextSwitcherItem, type ContextSwitcherProps, type FallbackModuleDef, Flyout, type FlyoutChild, type FlyoutProps, GLYPH_CANVAS_FILL, type GroupRungItem, type HeaderNavItem, LOCKUP_GAP, LOCKUP_ROW, MARK_CAP_RATIO, MARK_WEIGHT, type OrgConnectPolicy, REEVE_ACCENT, ResponsiveHeader, type ResponsiveHeaderProps, type RungItem, type SidebarLadder, type SidebarLadderParsed, type SidebarRung, type UseLadderRungOptions, WORDMARK_WEIGHT, deriveFallbackLadder, faviconUrl, groupByOrg, reconcileLadder, resolveLadder, useLadderRung, useResponsivePlaceholder, zSidebarLadder };