@ai-matrx/associations 0.11.0 → 0.11.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.
@@ -1314,8 +1314,12 @@ var ASSOCIATION_TARGET_TYPES = [
1314
1314
  // a CRM outreach list (a worked send/dial queue) — parties and resources attach into it
1315
1315
  "crm_deal",
1316
1316
  // a CRM deal (crm.deal) — people on it (role 'deal_contact'), tasks/files attach onto it
1317
- "rulebook"
1317
+ "rulebook",
1318
1318
  // a Masterwork Rulebook — its Scout interviews attach here (conversation→rulebook, role 'interview')
1319
+ "research_topic",
1320
+ // a research topic — Sources are filed under it (processed_document→research_topic, the landing door's edge)
1321
+ "media_source_library"
1322
+ // a media-catalog Library — Sources are catalogued into it (processed_document→media_source_library)
1319
1323
  ];
1320
1324
  function isAssociationTargetType(value) {
1321
1325
  return typeof value === "string" && ASSOCIATION_TARGET_TYPES.includes(value);
@@ -1504,6 +1508,7 @@ function useContainerLinks(args) {
1504
1508
  error,
1505
1509
  reload,
1506
1510
  totalCount: incoming.length,
1511
+ presentTokens: [...new Set(incoming.map((link) => link.token))],
1507
1512
  countFor,
1508
1513
  attachedIdsFor,
1509
1514
  linksFor,
@@ -3383,30 +3388,52 @@ function AssociationCardGrid({
3383
3388
  const primary = usePrimaryEntity();
3384
3389
  const excluded = new Set(excludeTokens ?? []);
3385
3390
  const filing = primary?.direction === "outgoing";
3386
- const list = (tokens ?? store.registry.curatedTokens()).filter(
3391
+ const links = useContainerLinks(containerLinksArgs(primary));
3392
+ const base2 = tokens ?? store.registry.curatedTokens();
3393
+ const withPresent = filing ? [
3394
+ ...base2,
3395
+ ...links.presentTokens.filter(
3396
+ (t) => isEntityTypeToken(t) && !base2.includes(t)
3397
+ )
3398
+ ] : base2;
3399
+ const list = withPresent.filter(
3387
3400
  (token) => !excluded.has(token) && (!filing || isAssociationTargetType(token))
3388
3401
  );
3389
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: (0, import_design_system7.cn)("space-y-5", className), children: CONTENT_ROLES.map((role) => {
3390
- const inRole = list.filter(
3391
- (token) => store.registry.getEntityInfo(token).contentRole === role.id
3392
- );
3393
- if (inRole.length === 0) return null;
3394
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { children: [
3395
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
3396
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
3397
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3398
- "span",
3399
- {
3400
- className: (0, import_design_system7.cn)("h-2.5 w-2.5 rounded-full", role.accentBar)
3401
- }
3402
- ),
3403
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: role.title })
3402
+ const roleIds = new Set(CONTENT_ROLES.map((r) => r.id));
3403
+ const roleless = filing ? list.filter((token) => {
3404
+ const role = store.registry.getEntityInfo(token).contentRole;
3405
+ return !role || !roleIds.has(role);
3406
+ }) : [];
3407
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: (0, import_design_system7.cn)("space-y-5", className), children: [
3408
+ CONTENT_ROLES.map((role) => {
3409
+ const inRole = list.filter(
3410
+ (token) => store.registry.getEntityInfo(token).contentRole === role.id
3411
+ );
3412
+ if (inRole.length === 0) return null;
3413
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { children: [
3414
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
3415
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
3416
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3417
+ "span",
3418
+ {
3419
+ className: (0, import_design_system7.cn)("h-2.5 w-2.5 rounded-full", role.accentBar)
3420
+ }
3421
+ ),
3422
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: role.title })
3423
+ ] }),
3424
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "hidden text-xs text-muted-foreground sm:block", children: role.tagline })
3404
3425
  ] }),
3405
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "hidden text-xs text-muted-foreground sm:block", children: role.tagline })
3426
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: inRole.map((token) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AssociationCard, { token }, token)) })
3427
+ ] }, role.id);
3428
+ }),
3429
+ roleless.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { children: [
3430
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
3431
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "text-sm font-semibold text-foreground", children: "Filed under" }),
3432
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "hidden text-xs text-muted-foreground sm:block", children: "Libraries, topics and other places this is kept." })
3406
3433
  ] }),
3407
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: inRole.map((token) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AssociationCard, { token }, token)) })
3408
- ] }, role.id);
3409
- }) });
3434
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: roleless.map((token) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AssociationCard, { token }, token)) })
3435
+ ] })
3436
+ ] });
3410
3437
  }
3411
3438
 
3412
3439
  // src/react/components/AssociationList.tsx