@ai-matrx/associations 0.6.2 → 0.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog — @ai-matrx/associations
2
2
 
3
+ ## 0.7.1 — 2026-09-01 (reference-pickable universal search)
4
+
5
+ - Universal search and attach defaults now use `registry.listableTokens()`.
6
+ Display-only content types remain visible when already attached, but no
7
+ longer generate candidate RPC calls or picker chips.
8
+ - Explicit token lists remain supported for specialized host adapters.
9
+ - A regression proves the default RPC sweep exactly matches the registry's
10
+ reference-pickable, listable set. Full package suite: 190 tests.
11
+
12
+ ## 0.7.0 — 2026-08-31 (role-safe pin and detach)
13
+
14
+ - `useContainerLinks` now exposes `setPinned`, which updates the exact
15
+ role-qualified edge, preserves every sibling metadata field, and refreshes
16
+ both endpoint caches through the canonical `assoc_add` chokepoint.
17
+ - `AssociationCard` attached-item windows now expose pin/unpin and pass the
18
+ edge role through both pin and detach. Previously, a role-bearing row was
19
+ visible but its detach control targeted only the role-less edge and could
20
+ silently leave the displayed row attached.
21
+ - The default `AssociationList` adapter now derives pin state from edge
22
+ metadata and supplies the same role-safe pin operation. Failed pin writes
23
+ announce themselves through the notifier instead of disappearing.
24
+ - Hook and face regressions prove metadata preservation and exact-role routing
25
+ for both pin and detach. Full package suite: 189 tests.
26
+
3
27
  ## 0.6.2 — 2026-08-31 (vocabulary catch-up: commerce_certified_printer)
4
28
 
5
29
  Regenerated `src/entity-types.generated.ts` from live `platform.entity_types`:
package/README.md CHANGED
@@ -4,16 +4,16 @@ THE one way to relate two entities on the AI Matrx platform: association edges,
4
4
  categories, favorites/recents, and the generated entity-type vocabulary — shipped
5
5
  as one package a Matrx client or enterprise app installs.
6
6
 
7
- **v0.3 ships the types root, the headless `/core`, and the React binding
8
- `/react`** the service chokepoint, guards, the never-throw result funnel,
9
- the registry merge engine, the subscribable cache store, the seven hooks, and
10
- the association faces (cards, list, pickers, attached-items sheet, capture
11
- toolbar). Everything below about the schema is binding — it is the package's
12
- product.
7
+ The package ships the types root, the headless `/core`, the React binding
8
+ `/react`, and the package-owned lazy React entry `/react/lazy`: the service
9
+ chokepoint, guards, never-throw result funnel, registry merge engine,
10
+ subscribable cache store, hooks, and the association faces (cards, list,
11
+ pickers, attached-items sheet, capture toolbar). Everything below about the
12
+ schema is binding — it is the package's product.
13
13
 
14
14
  ```ts
15
15
  import {
16
- type EntityTypeToken, // 651-token union generated from platform.entity_types
16
+ type EntityTypeToken, // generated from platform.entity_types
17
17
  ENTITY_TYPE_METADATA, // per-token schema/table/label/titleColumn/contentRole
18
18
  isEntityTypeToken, // runtime guard, narrows to the union
19
19
  type AssociationEdge, // one assoc_for_entity row (both directions)
@@ -48,6 +48,12 @@ await store.favorites.setFavorite("note", noteId, true);
48
48
  await assertDemandedSchema(supabase, { selfTest: true });
49
49
  ```
50
50
 
51
+ `useContainerLinks({ containerType, containerId, orgId })` is the canonical
52
+ container-side React API. Its `attach`, `detach`, and `setPinned` operations all
53
+ target the exact role-qualified edge; `setPinned` preserves the edge's other
54
+ metadata fields. `AssociationCardGrid` and the default `AssociationList`
55
+ adapter expose those same operations without host wiring.
56
+
51
57
  ```tsx
52
58
  // /react — the banner'd React binding (peer: react >=18;
53
59
  // @ai-matrx/design-system is a real dependency — the faces' chrome
@@ -1483,6 +1483,11 @@ interface UseContainerLinksReturn {
1483
1483
  }) => Promise<AssociationWriteResult>;
1484
1484
  /** Detach a resource from this container. */
1485
1485
  detach: (token: EntityTypeToken, resourceId: string, role?: string) => Promise<AssociationWriteResult>;
1486
+ /**
1487
+ * Toggle the edge's agent-context pin while preserving every other metadata
1488
+ * field and the exact semantic role.
1489
+ */
1490
+ setPinned: (token: EntityTypeToken, resourceId: string, pinned: boolean, role?: string) => Promise<AssociationWriteResult>;
1486
1491
  }
1487
1492
  declare function useContainerLinks(args: UseContainerLinksArgs): UseContainerLinksReturn;
1488
1493
 
@@ -1604,7 +1609,12 @@ interface AttachedItemsSheetProps {
1604
1609
  links: ContainerLink[];
1605
1610
  /** Opens the attach picker. Omitted when the token cannot list candidates. */
1606
1611
  onAdd?: () => void;
1607
- onDetach: (resourceId: string) => Promise<{
1612
+ onDetach: (resourceId: string, role?: string | null) => Promise<{
1613
+ ok: boolean;
1614
+ error?: string;
1615
+ }>;
1616
+ /** Toggle metadata.pinned on this exact role-qualified edge. */
1617
+ onSetPinned?: (resourceId: string, pinned: boolean, role?: string | null) => Promise<{
1608
1618
  ok: boolean;
1609
1619
  error?: string;
1610
1620
  }>;
@@ -1675,7 +1685,7 @@ interface ContainerResourcesAdapter {
1675
1685
  * Optional pin capability (edge `metadata.pinned`) — pinned resources stay
1676
1686
  * inline in agent context at every tier. Rows show a pin toggle when set.
1677
1687
  */
1678
- setPinned?: (token: EntityTypeToken, resourceId: string, pinned: boolean) => Promise<{
1688
+ setPinned?: (token: EntityTypeToken, resourceId: string, pinned: boolean, role?: string) => Promise<{
1679
1689
  ok: boolean;
1680
1690
  error?: string;
1681
1691
  }>;
@@ -1483,6 +1483,11 @@ interface UseContainerLinksReturn {
1483
1483
  }) => Promise<AssociationWriteResult>;
1484
1484
  /** Detach a resource from this container. */
1485
1485
  detach: (token: EntityTypeToken, resourceId: string, role?: string) => Promise<AssociationWriteResult>;
1486
+ /**
1487
+ * Toggle the edge's agent-context pin while preserving every other metadata
1488
+ * field and the exact semantic role.
1489
+ */
1490
+ setPinned: (token: EntityTypeToken, resourceId: string, pinned: boolean, role?: string) => Promise<AssociationWriteResult>;
1486
1491
  }
1487
1492
  declare function useContainerLinks(args: UseContainerLinksArgs): UseContainerLinksReturn;
1488
1493
 
@@ -1604,7 +1609,12 @@ interface AttachedItemsSheetProps {
1604
1609
  links: ContainerLink[];
1605
1610
  /** Opens the attach picker. Omitted when the token cannot list candidates. */
1606
1611
  onAdd?: () => void;
1607
- onDetach: (resourceId: string) => Promise<{
1612
+ onDetach: (resourceId: string, role?: string | null) => Promise<{
1613
+ ok: boolean;
1614
+ error?: string;
1615
+ }>;
1616
+ /** Toggle metadata.pinned on this exact role-qualified edge. */
1617
+ onSetPinned?: (resourceId: string, pinned: boolean, role?: string | null) => Promise<{
1608
1618
  ok: boolean;
1609
1619
  error?: string;
1610
1620
  }>;
@@ -1675,7 +1685,7 @@ interface ContainerResourcesAdapter {
1675
1685
  * Optional pin capability (edge `metadata.pinned`) — pinned resources stay
1676
1686
  * inline in agent context at every tier. Rows show a pin toggle when set.
1677
1687
  */
1678
- setPinned?: (token: EntityTypeToken, resourceId: string, pinned: boolean) => Promise<{
1688
+ setPinned?: (token: EntityTypeToken, resourceId: string, pinned: boolean, role?: string) => Promise<{
1679
1689
  ok: boolean;
1680
1690
  error?: string;
1681
1691
  }>;
@@ -2427,7 +2427,7 @@ function createCandidatesService(deps) {
2427
2427
  }
2428
2428
  async function searchCandidatesAcrossTokens(args) {
2429
2429
  const { tokens, search, ownerId, perTokenLimit = 5, concurrency = 6 } = args;
2430
- const list = tokens ?? registry.curatedTokens();
2430
+ const list = tokens ?? registry.listableTokens();
2431
2431
  if (list.length === 0) return [];
2432
2432
  const out = [];
2433
2433
  let cursor = 0;