@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.
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ComponentType } from 'react';
3
- import { j as AssociationsNotifier, W as WindowShellPort, k as CapturePort, P as PickerOverrideMap, E as EntityDoorsPort, l as AuthorDisplayPort, m as AssociationsStore, n as CategoryMutationResult, o as CategoryDimension, p as PlatformCategory, q as CategoriesEntry, r as EntityTypeToken, s as UniversalCandidate, t as CandidateRecord, u as PlatformComment, v as CommentsEntry, w as CommentMutationResult, e as AssociationPickerProps, x as EntityDoorProps, y as EntityRefProps, z as ContentRole } from '../CommentThread-ZWiJVDpI.cjs';
4
- export { B as AssociationCaptureToolbar, A as AssociationCaptureToolbarProps, D as AssociationCard, F as AssociationCardGrid, b as AssociationCardGridProps, a as AssociationCardProps, G as AssociationEntitySelect, H as AssociationEntitySelectAdapter, I as AssociationEntitySelectItem, c as AssociationEntitySelectProps, J as AssociationList, d as AssociationListProps, K as AssociationWindow, f as AssociationWindowProps, L as AssociationWriteResult, M as AttachedItemsSheet, g as AttachedItemsSheetProps, N as CaptureAttach, O as CaptureAttachResult, Q as CaptureToolbarAction, R as CategorySelect, C as CategorySelectProps, S as CategoryTagPicker, h as CategoryTagPickerProps, T as CommentComposer, V as CommentComposerProps, X as CommentThread, i as CommentThreadProps, Y as ContainerLink, Z as ContainerResourceRow, _ as ContainerResourcesAdapter, $ as DefaultEntityIcon, a0 as PrimaryContainerEntity, a1 as PrimaryEntity, a2 as PrimaryEntityProvider, a3 as PrimaryFiledEntity, a4 as TagPickerIcon, a5 as UniversalAssociationPicker, U as UniversalAssociationPickerProps, a6 as UseAssociationEntitySelectAdapterArgs, a7 as UseAssociationsArgs, a8 as UseAssociationsReturn, a9 as UseContainerLinksArgs, aa as UseContainerLinksReturn, ab as attachedKey, ac as buildCommentTree, ad as containerLinksArgs, ae as useAssociationEntitySelectAdapter, af as useAssociations, ag as useContainerLinks, ah as useContainerLinksAdapter, ai as useEntityRelationships, aj as usePrimaryEntity } from '../CommentThread-ZWiJVDpI.cjs';
3
+ import { j as AssociationsNotifier, W as WindowShellPort, k as CapturePort, P as PickerOverrideMap, E as EntityDoorsPort, l as AuthorDisplayPort, m as AssociationsStore, n as CategoryMutationResult, o as CategoryDimension, p as PlatformCategory, q as CategoriesEntry, r as EntityTypeToken, s as UniversalCandidate, t as CandidateRecord, u as PlatformComment, v as CommentsEntry, w as CommentMutationResult, e as AssociationPickerProps, x as EntityDoorProps, y as EntityRefProps, z as ContentRole } from '../CommentThread-ar5rzifm.cjs';
4
+ export { B as AssociationCaptureToolbar, A as AssociationCaptureToolbarProps, D as AssociationCard, F as AssociationCardGrid, b as AssociationCardGridProps, a as AssociationCardProps, G as AssociationEntitySelect, H as AssociationEntitySelectAdapter, I as AssociationEntitySelectItem, c as AssociationEntitySelectProps, J as AssociationList, d as AssociationListProps, K as AssociationWindow, f as AssociationWindowProps, L as AssociationWriteResult, M as AttachedItemsSheet, g as AttachedItemsSheetProps, N as CaptureAttach, O as CaptureAttachResult, Q as CaptureToolbarAction, R as CategorySelect, C as CategorySelectProps, S as CategoryTagPicker, h as CategoryTagPickerProps, T as CommentComposer, V as CommentComposerProps, X as CommentThread, i as CommentThreadProps, Y as ContainerLink, Z as ContainerResourceRow, _ as ContainerResourcesAdapter, $ as DefaultEntityIcon, a0 as PrimaryContainerEntity, a1 as PrimaryEntity, a2 as PrimaryEntityProvider, a3 as PrimaryFiledEntity, a4 as TagPickerIcon, a5 as UniversalAssociationPicker, U as UniversalAssociationPickerProps, a6 as UseAssociationEntitySelectAdapterArgs, a7 as UseAssociationsArgs, a8 as UseAssociationsReturn, a9 as UseContainerLinksArgs, aa as UseContainerLinksReturn, ab as attachedKey, ac as buildCommentTree, ad as containerLinksArgs, ae as useAssociationEntitySelectAdapter, af as useAssociations, ag as useContainerLinks, ah as useContainerLinksAdapter, ai as useEntityRelationships, aj as usePrimaryEntity } from '../CommentThread-ar5rzifm.cjs';
5
5
 
6
6
  interface AssociationsUiPorts {
7
7
  notifier?: AssociationsNotifier;
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ComponentType } from 'react';
3
- import { j as AssociationsNotifier, W as WindowShellPort, k as CapturePort, P as PickerOverrideMap, E as EntityDoorsPort, l as AuthorDisplayPort, m as AssociationsStore, n as CategoryMutationResult, o as CategoryDimension, p as PlatformCategory, q as CategoriesEntry, r as EntityTypeToken, s as UniversalCandidate, t as CandidateRecord, u as PlatformComment, v as CommentsEntry, w as CommentMutationResult, e as AssociationPickerProps, x as EntityDoorProps, y as EntityRefProps, z as ContentRole } from '../CommentThread-ZWiJVDpI.js';
4
- export { B as AssociationCaptureToolbar, A as AssociationCaptureToolbarProps, D as AssociationCard, F as AssociationCardGrid, b as AssociationCardGridProps, a as AssociationCardProps, G as AssociationEntitySelect, H as AssociationEntitySelectAdapter, I as AssociationEntitySelectItem, c as AssociationEntitySelectProps, J as AssociationList, d as AssociationListProps, K as AssociationWindow, f as AssociationWindowProps, L as AssociationWriteResult, M as AttachedItemsSheet, g as AttachedItemsSheetProps, N as CaptureAttach, O as CaptureAttachResult, Q as CaptureToolbarAction, R as CategorySelect, C as CategorySelectProps, S as CategoryTagPicker, h as CategoryTagPickerProps, T as CommentComposer, V as CommentComposerProps, X as CommentThread, i as CommentThreadProps, Y as ContainerLink, Z as ContainerResourceRow, _ as ContainerResourcesAdapter, $ as DefaultEntityIcon, a0 as PrimaryContainerEntity, a1 as PrimaryEntity, a2 as PrimaryEntityProvider, a3 as PrimaryFiledEntity, a4 as TagPickerIcon, a5 as UniversalAssociationPicker, U as UniversalAssociationPickerProps, a6 as UseAssociationEntitySelectAdapterArgs, a7 as UseAssociationsArgs, a8 as UseAssociationsReturn, a9 as UseContainerLinksArgs, aa as UseContainerLinksReturn, ab as attachedKey, ac as buildCommentTree, ad as containerLinksArgs, ae as useAssociationEntitySelectAdapter, af as useAssociations, ag as useContainerLinks, ah as useContainerLinksAdapter, ai as useEntityRelationships, aj as usePrimaryEntity } from '../CommentThread-ZWiJVDpI.js';
3
+ import { j as AssociationsNotifier, W as WindowShellPort, k as CapturePort, P as PickerOverrideMap, E as EntityDoorsPort, l as AuthorDisplayPort, m as AssociationsStore, n as CategoryMutationResult, o as CategoryDimension, p as PlatformCategory, q as CategoriesEntry, r as EntityTypeToken, s as UniversalCandidate, t as CandidateRecord, u as PlatformComment, v as CommentsEntry, w as CommentMutationResult, e as AssociationPickerProps, x as EntityDoorProps, y as EntityRefProps, z as ContentRole } from '../CommentThread-ar5rzifm.js';
4
+ export { B as AssociationCaptureToolbar, A as AssociationCaptureToolbarProps, D as AssociationCard, F as AssociationCardGrid, b as AssociationCardGridProps, a as AssociationCardProps, G as AssociationEntitySelect, H as AssociationEntitySelectAdapter, I as AssociationEntitySelectItem, c as AssociationEntitySelectProps, J as AssociationList, d as AssociationListProps, K as AssociationWindow, f as AssociationWindowProps, L as AssociationWriteResult, M as AttachedItemsSheet, g as AttachedItemsSheetProps, N as CaptureAttach, O as CaptureAttachResult, Q as CaptureToolbarAction, R as CategorySelect, C as CategorySelectProps, S as CategoryTagPicker, h as CategoryTagPickerProps, T as CommentComposer, V as CommentComposerProps, X as CommentThread, i as CommentThreadProps, Y as ContainerLink, Z as ContainerResourceRow, _ as ContainerResourcesAdapter, $ as DefaultEntityIcon, a0 as PrimaryContainerEntity, a1 as PrimaryEntity, a2 as PrimaryEntityProvider, a3 as PrimaryFiledEntity, a4 as TagPickerIcon, a5 as UniversalAssociationPicker, U as UniversalAssociationPickerProps, a6 as UseAssociationEntitySelectAdapterArgs, a7 as UseAssociationsArgs, a8 as UseAssociationsReturn, a9 as UseContainerLinksArgs, aa as UseContainerLinksReturn, ab as attachedKey, ac as buildCommentTree, ad as containerLinksArgs, ae as useAssociationEntitySelectAdapter, af as useAssociations, ag as useContainerLinks, ah as useContainerLinksAdapter, ai as useEntityRelationships, aj as usePrimaryEntity } from '../CommentThread-ar5rzifm.js';
5
5
 
6
6
  interface AssociationsUiPorts {
7
7
  notifier?: AssociationsNotifier;
@@ -1252,8 +1252,12 @@ var ASSOCIATION_TARGET_TYPES = [
1252
1252
  // a CRM outreach list (a worked send/dial queue) — parties and resources attach into it
1253
1253
  "crm_deal",
1254
1254
  // a CRM deal (crm.deal) — people on it (role 'deal_contact'), tasks/files attach onto it
1255
- "rulebook"
1255
+ "rulebook",
1256
1256
  // a Masterwork Rulebook — its Scout interviews attach here (conversation→rulebook, role 'interview')
1257
+ "research_topic",
1258
+ // a research topic — Sources are filed under it (processed_document→research_topic, the landing door's edge)
1259
+ "media_source_library"
1260
+ // a media-catalog Library — Sources are catalogued into it (processed_document→media_source_library)
1257
1261
  ];
1258
1262
  function isAssociationTargetType(value) {
1259
1263
  return typeof value === "string" && ASSOCIATION_TARGET_TYPES.includes(value);
@@ -1442,6 +1446,7 @@ function useContainerLinks(args) {
1442
1446
  error,
1443
1447
  reload,
1444
1448
  totalCount: incoming.length,
1449
+ presentTokens: [...new Set(incoming.map((link) => link.token))],
1445
1450
  countFor,
1446
1451
  attachedIdsFor,
1447
1452
  linksFor,
@@ -3327,30 +3332,52 @@ function AssociationCardGrid({
3327
3332
  const primary = usePrimaryEntity();
3328
3333
  const excluded = new Set(excludeTokens ?? []);
3329
3334
  const filing = primary?.direction === "outgoing";
3330
- const list = (tokens ?? store.registry.curatedTokens()).filter(
3335
+ const links = useContainerLinks(containerLinksArgs(primary));
3336
+ const base2 = tokens ?? store.registry.curatedTokens();
3337
+ const withPresent = filing ? [
3338
+ ...base2,
3339
+ ...links.presentTokens.filter(
3340
+ (t) => isEntityTypeToken(t) && !base2.includes(t)
3341
+ )
3342
+ ] : base2;
3343
+ const list = withPresent.filter(
3331
3344
  (token) => !excluded.has(token) && (!filing || isAssociationTargetType(token))
3332
3345
  );
3333
- return /* @__PURE__ */ jsx11("div", { className: cn7("space-y-5", className), children: CONTENT_ROLES.map((role) => {
3334
- const inRole = list.filter(
3335
- (token) => store.registry.getEntityInfo(token).contentRole === role.id
3336
- );
3337
- if (inRole.length === 0) return null;
3338
- return /* @__PURE__ */ jsxs9("section", { children: [
3339
- /* @__PURE__ */ jsxs9("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
3340
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
3341
- /* @__PURE__ */ jsx11(
3342
- "span",
3343
- {
3344
- className: cn7("h-2.5 w-2.5 rounded-full", role.accentBar)
3345
- }
3346
- ),
3347
- /* @__PURE__ */ jsx11("h3", { className: "text-sm font-semibold text-foreground", children: role.title })
3346
+ const roleIds = new Set(CONTENT_ROLES.map((r) => r.id));
3347
+ const roleless = filing ? list.filter((token) => {
3348
+ const role = store.registry.getEntityInfo(token).contentRole;
3349
+ return !role || !roleIds.has(role);
3350
+ }) : [];
3351
+ return /* @__PURE__ */ jsxs9("div", { className: cn7("space-y-5", className), children: [
3352
+ CONTENT_ROLES.map((role) => {
3353
+ const inRole = list.filter(
3354
+ (token) => store.registry.getEntityInfo(token).contentRole === role.id
3355
+ );
3356
+ if (inRole.length === 0) return null;
3357
+ return /* @__PURE__ */ jsxs9("section", { children: [
3358
+ /* @__PURE__ */ jsxs9("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
3359
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
3360
+ /* @__PURE__ */ jsx11(
3361
+ "span",
3362
+ {
3363
+ className: cn7("h-2.5 w-2.5 rounded-full", role.accentBar)
3364
+ }
3365
+ ),
3366
+ /* @__PURE__ */ jsx11("h3", { className: "text-sm font-semibold text-foreground", children: role.title })
3367
+ ] }),
3368
+ /* @__PURE__ */ jsx11("p", { className: "hidden text-xs text-muted-foreground sm:block", children: role.tagline })
3348
3369
  ] }),
3349
- /* @__PURE__ */ jsx11("p", { className: "hidden text-xs text-muted-foreground sm:block", children: role.tagline })
3370
+ /* @__PURE__ */ jsx11("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: inRole.map((token) => /* @__PURE__ */ jsx11(AssociationCard, { token }, token)) })
3371
+ ] }, role.id);
3372
+ }),
3373
+ roleless.length > 0 && /* @__PURE__ */ jsxs9("section", { children: [
3374
+ /* @__PURE__ */ jsxs9("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
3375
+ /* @__PURE__ */ jsx11("h3", { className: "text-sm font-semibold text-foreground", children: "Filed under" }),
3376
+ /* @__PURE__ */ jsx11("p", { className: "hidden text-xs text-muted-foreground sm:block", children: "Libraries, topics and other places this is kept." })
3350
3377
  ] }),
3351
- /* @__PURE__ */ jsx11("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: inRole.map((token) => /* @__PURE__ */ jsx11(AssociationCard, { token }, token)) })
3352
- ] }, role.id);
3353
- }) });
3378
+ /* @__PURE__ */ jsx11("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: roleless.map((token) => /* @__PURE__ */ jsx11(AssociationCard, { token }, token)) })
3379
+ ] })
3380
+ ] });
3354
3381
  }
3355
3382
 
3356
3383
  // src/react/components/AssociationList.tsx