@ai-matrx/associations 0.13.8 → 0.13.10

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.
@@ -52,6 +52,7 @@ __export(react_exports, {
52
52
  getContentRoleMeta: () => getContentRoleMeta,
53
53
  lazyPickerOverride: () => lazyPickerOverride,
54
54
  lazyWindowShell: () => lazyWindowShell,
55
+ linkDirection: () => linkDirection,
55
56
  useAssociationCandidates: () => useAssociationCandidates,
56
57
  useAssociationEntitySelectAdapter: () => useAssociationEntitySelectAdapter,
57
58
  useAssociationPickerBridge: () => useAssociationPickerBridge,
@@ -727,6 +728,7 @@ var ENTITY_TYPE_TOKENS = [
727
728
  "media_selection_job",
728
729
  "media_source_library",
729
730
  "meet_call_invite",
731
+ "meet_chat_message",
730
732
  "meet_invitee",
731
733
  "meet_meeting",
732
734
  "meet_note",
@@ -846,6 +848,7 @@ var ENTITY_TYPE_TOKENS = [
846
848
  "rag_ingest_run",
847
849
  "rag_library_audit_log",
848
850
  "rate_limit_buckets",
851
+ "reachability_pending",
849
852
  "recompute_queue",
850
853
  "record",
851
854
  "record_alias",
@@ -965,6 +968,7 @@ var ENTITY_TYPE_TOKENS = [
965
968
  "seo_story_angle",
966
969
  "seo_topic",
967
970
  "seo_topical_map",
971
+ "seo_tracker_story",
968
972
  "seo_web_analytics_daily",
969
973
  "shareable_resource_registry",
970
974
  "shared_canvas_item",
@@ -1113,6 +1117,7 @@ var ENTITY_TYPE_TOKENS = [
1113
1117
  "web_link_edge",
1114
1118
  "web_listing_publisher",
1115
1119
  "web_location_listing",
1120
+ "web_news_item",
1116
1121
  "web_offering_template",
1117
1122
  "web_page",
1118
1123
  "web_page_content",
@@ -1169,6 +1174,428 @@ function isEntityTypeToken(value) {
1169
1174
  return typeof value === "string" && ENTITY_TYPE_TOKEN_SET.has(value);
1170
1175
  }
1171
1176
 
1177
+ // src/association-types.generated.ts
1178
+ var ASSOCIATION_PAIRS = /* @__PURE__ */ new Set([
1179
+ "agent>agent",
1180
+ "agent>context_item",
1181
+ "agent>organization",
1182
+ "agent>project",
1183
+ "agent>record",
1184
+ "agent>scope",
1185
+ "agent>scope_type",
1186
+ "agent>surface",
1187
+ "agent>task",
1188
+ "agent>web_page",
1189
+ "agent_shortcut>project",
1190
+ "agent_shortcut>task",
1191
+ "agent_shortcut>web_page",
1192
+ "agent_term_list>agent",
1193
+ "app>record",
1194
+ "app>scope",
1195
+ "app>web_page",
1196
+ "artifact>processed_document",
1197
+ "assessment>assessment",
1198
+ "assessment>fc_set",
1199
+ "assessment>file",
1200
+ "assessment>note",
1201
+ "assessment>record",
1202
+ "assessment>scope",
1203
+ "assessment>scope_type",
1204
+ "assessment>study_media",
1205
+ "calendar_event>conversation",
1206
+ "calendar_event>party",
1207
+ "code_file>agent",
1208
+ "code_file>code_repository",
1209
+ "code_file>data_store",
1210
+ "code_file>web_page",
1211
+ "contact_medium>web_page",
1212
+ "content_ir_kind_instance>content_ir_kind_instance",
1213
+ "content_ir_kind_instance>note",
1214
+ "content_ir_kind_instance>project",
1215
+ "content_ir_kind_instance>record",
1216
+ "content_ir_kind_instance>scope",
1217
+ "content_ir_kind_instance>scope_type",
1218
+ "content_ir_kind_instance>task",
1219
+ "content_ir_kind_instance>web_site",
1220
+ "conversation>agent",
1221
+ "conversation>custom_record",
1222
+ "conversation>document",
1223
+ "conversation>note",
1224
+ "conversation>party",
1225
+ "conversation>project",
1226
+ "conversation>record",
1227
+ "conversation>rulebook",
1228
+ "conversation>scope",
1229
+ "conversation>scope_type",
1230
+ "conversation>task",
1231
+ "conversation>thread",
1232
+ "conversation>war_room",
1233
+ "conversation>web_page",
1234
+ "credential_item>record",
1235
+ "credential_item>scope",
1236
+ "crm_deal>party",
1237
+ "crm_deal>task",
1238
+ "crm_interaction>crm_deal",
1239
+ "crm_interaction>party",
1240
+ "crm_interaction>project",
1241
+ "custom_record>custom_record",
1242
+ "custom_record>hr_candidate",
1243
+ "custom_record>hr_employee",
1244
+ "custom_record>hr_position_assignment",
1245
+ "custom_record>hr_requisition",
1246
+ "custom_record>hr_training_assignment",
1247
+ "data_store>agent",
1248
+ "data_store>project",
1249
+ "data_store>task",
1250
+ "data_store>war_room",
1251
+ "data_store>web_page",
1252
+ "dataset>agent",
1253
+ "dataset>web_page",
1254
+ "document>document",
1255
+ "document>note",
1256
+ "fc_card>document",
1257
+ "fc_card>fc_set",
1258
+ "fc_card>file",
1259
+ "fc_card>note",
1260
+ "fc_set>agent",
1261
+ "fc_set>assessment",
1262
+ "fc_set>conversation",
1263
+ "fc_set>fc_set",
1264
+ "fc_set>file",
1265
+ "fc_set>note",
1266
+ "fc_set>processed_document",
1267
+ "fc_set>record",
1268
+ "fc_set>rulebook",
1269
+ "fc_set>scope",
1270
+ "fc_set>scope_type",
1271
+ "fc_set>study_media",
1272
+ "file>agent",
1273
+ "file>agent_term_list",
1274
+ "file>conversation",
1275
+ "file>crm_deal",
1276
+ "file>data_store",
1277
+ "file>file",
1278
+ "file>hr_application",
1279
+ "file>hr_employee",
1280
+ "file>hr_employment",
1281
+ "file>hr_incident",
1282
+ "file>hr_leave_case",
1283
+ "file>party",
1284
+ "file>project",
1285
+ "file>record",
1286
+ "file>rulebook",
1287
+ "file>scope",
1288
+ "file>scope_type",
1289
+ "file>task",
1290
+ "file>thread",
1291
+ "file>war_room",
1292
+ "file>web_page",
1293
+ "file>web_screenshot",
1294
+ "folder>web_page",
1295
+ "google_document>crm_deal",
1296
+ "google_document>party",
1297
+ "google_document>project",
1298
+ "google_document>task",
1299
+ "hr_candidate>custom_record",
1300
+ "hr_candidate>party",
1301
+ "hr_course>hr_job_title",
1302
+ "hr_credential>hr_job_title",
1303
+ "hr_employee>custom_record",
1304
+ "hr_employee>record",
1305
+ "hr_employee>scope",
1306
+ "hr_employee>scope_type",
1307
+ "hr_position_assignment>custom_record",
1308
+ "hr_requisition>custom_record",
1309
+ "hr_training_assignment>custom_record",
1310
+ "integration_connection_resource>conversation",
1311
+ "library_doc>data_store",
1312
+ "media_source_library>youtube_video",
1313
+ "message>content_ir_kind_instance",
1314
+ "message>record",
1315
+ "message>task",
1316
+ "message_template>record",
1317
+ "message_template>scope",
1318
+ "message_template>web_page",
1319
+ "note>agent",
1320
+ "note>assessment",
1321
+ "note>calendar_event",
1322
+ "note>crm_deal",
1323
+ "note>data_store",
1324
+ "note>fc_set",
1325
+ "note>file",
1326
+ "note>hr_candidate",
1327
+ "note>hr_employee",
1328
+ "note>note",
1329
+ "note>party",
1330
+ "note>project",
1331
+ "note>record",
1332
+ "note>rulebook",
1333
+ "note>scope",
1334
+ "note>scope_type",
1335
+ "note>study_media",
1336
+ "note>task",
1337
+ "note>thread",
1338
+ "note>war_room",
1339
+ "note>web_page",
1340
+ "note>web_screenshot",
1341
+ "organization>seo_keyword",
1342
+ "page_extraction_job>file",
1343
+ "page_extraction_job>processed_document",
1344
+ "party>category",
1345
+ "party>data_store",
1346
+ "party>organization",
1347
+ "party>party",
1348
+ "party>project",
1349
+ "party>record",
1350
+ "party>research_source",
1351
+ "party>research_topic",
1352
+ "party>scope",
1353
+ "party>scope_type",
1354
+ "party>seo_link_gap_domain",
1355
+ "party>seo_referring_domain_profile",
1356
+ "party>seo_reputation_case",
1357
+ "party>seo_serp_opportunity",
1358
+ "party>seo_topic",
1359
+ "party>task",
1360
+ "party>transcript",
1361
+ "party>war_room",
1362
+ "party>web_brand",
1363
+ "party>web_page",
1364
+ "party>web_site",
1365
+ "pc_episode>processed_document",
1366
+ "pc_episode>rulebook",
1367
+ "pc_show>rulebook",
1368
+ "pc_studio_run>rulebook",
1369
+ "plan_entity>category",
1370
+ "plan_entity>plan_entity",
1371
+ "plan_entity>seo_topic",
1372
+ "plan_entity>web_site",
1373
+ "plan_node>agent_run",
1374
+ "plan_node>party",
1375
+ "plan_node>plan_entity",
1376
+ "plan_node>plan_node",
1377
+ "plan_node>seo_keyword",
1378
+ "plan_node>seo_map_topic",
1379
+ "plan_node>seo_topic",
1380
+ "plan_node>web_page",
1381
+ "plan_node>web_site",
1382
+ "processed_document>agent",
1383
+ "processed_document>code_repository",
1384
+ "processed_document>conversation",
1385
+ "processed_document>data_store",
1386
+ "processed_document>file",
1387
+ "processed_document>media_source_library",
1388
+ "processed_document>project",
1389
+ "processed_document>record",
1390
+ "processed_document>research_topic",
1391
+ "processed_document>scope",
1392
+ "processed_document>task",
1393
+ "processed_document>war_room",
1394
+ "processed_document>web_site",
1395
+ "project>record",
1396
+ "project>scope",
1397
+ "project>scope_type",
1398
+ "project>thread",
1399
+ "project>war_room",
1400
+ "purpose>agent",
1401
+ "purpose>mandate",
1402
+ "purpose>tool",
1403
+ "purpose>workflow",
1404
+ "quiz_session>agent",
1405
+ "quiz_session>processed_document",
1406
+ "quiz_session>web_page",
1407
+ "record>agent",
1408
+ "record>agent_shortcut",
1409
+ "record>agent_template",
1410
+ "record>ai_api",
1411
+ "record>ai_endpoint",
1412
+ "record>ai_model",
1413
+ "record>ai_provider",
1414
+ "record>ai_setting",
1415
+ "record>app",
1416
+ "record>assessment",
1417
+ "record>canvas_comment",
1418
+ "record>canvas_item",
1419
+ "record>canvas_score",
1420
+ "record>category",
1421
+ "record>code_file",
1422
+ "record>code_folder",
1423
+ "record>code_repository",
1424
+ "record>comparison_set",
1425
+ "record>contact_submission",
1426
+ "record>content_ir_kind",
1427
+ "record>content_ir_kind_instance",
1428
+ "record>context_item",
1429
+ "record>conversation",
1430
+ "record>crm_deal",
1431
+ "record>crm_outreach_list",
1432
+ "record>cx_agent_memory",
1433
+ "record>data_store",
1434
+ "record>dataset",
1435
+ "record>fc_set",
1436
+ "record>feature_doc",
1437
+ "record>flexible_data",
1438
+ "record>folder",
1439
+ "record>game_result",
1440
+ "record>heatmap_save",
1441
+ "record>hr_asset",
1442
+ "record>hr_candidate",
1443
+ "record>hr_careers_portal",
1444
+ "record>hr_checklist_template",
1445
+ "record>hr_course",
1446
+ "record>hr_crew",
1447
+ "record>hr_deduction_code",
1448
+ "record>hr_department",
1449
+ "record>hr_earning_code",
1450
+ "record>hr_employee",
1451
+ "record>hr_holiday_calendar",
1452
+ "record>hr_interview_kit",
1453
+ "record>hr_job_title",
1454
+ "record>hr_jurisdiction",
1455
+ "record>hr_jurisdiction_rule_class",
1456
+ "record>hr_leave_policy",
1457
+ "record>hr_location",
1458
+ "record>hr_pay_group",
1459
+ "record>hr_posting",
1460
+ "record>hr_record_class",
1461
+ "record>hr_requisition",
1462
+ "record>hr_schedule",
1463
+ "record>hr_schedule_template",
1464
+ "record>hr_survey",
1465
+ "record>league_membership",
1466
+ "record>learn_doc",
1467
+ "record>marketing_initiative",
1468
+ "record>message_template",
1469
+ "record>note",
1470
+ "record>note_folder",
1471
+ "record>organization",
1472
+ "record>page_extraction_job",
1473
+ "record>party",
1474
+ "record>pc_article",
1475
+ "record>pc_episode",
1476
+ "record>pc_show",
1477
+ "record>pc_studio_run",
1478
+ "record>processed_document",
1479
+ "record>project",
1480
+ "record>quiz_session",
1481
+ "record>record",
1482
+ "record>research_template",
1483
+ "record>research_topic",
1484
+ "record>rulebook",
1485
+ "record>sch_task",
1486
+ "record>scope_type",
1487
+ "record>seo_topic",
1488
+ "record>shared_canvas_item",
1489
+ "record>skill",
1490
+ "record>skill_render_definition",
1491
+ "record>structured_list",
1492
+ "record>studio_session",
1493
+ "record>study_goal",
1494
+ "record>study_media",
1495
+ "record>study_plan",
1496
+ "record>study_plan_block",
1497
+ "record>surface",
1498
+ "record>task",
1499
+ "record>thread",
1500
+ "record>tool",
1501
+ "record>tool_bundle",
1502
+ "record>transcript",
1503
+ "record>udt_document",
1504
+ "record>user_markdown_sample",
1505
+ "record>voice",
1506
+ "record>war_room",
1507
+ "record>wbx_pattern",
1508
+ "record>web_analysis_item",
1509
+ "record>web_brand",
1510
+ "record>web_provider",
1511
+ "record>web_site",
1512
+ "record>workbook",
1513
+ "record>workflow",
1514
+ "record>workflow_template",
1515
+ "record>workflow_trigger",
1516
+ "record>working_document",
1517
+ "research_source>research_keyword",
1518
+ "research_source>research_tag",
1519
+ "research_source>youtube_video",
1520
+ "research_tag>plan_node",
1521
+ "research_tag>web_page",
1522
+ "research_tag>web_site",
1523
+ "research_topic>plan_node",
1524
+ "research_topic>project",
1525
+ "research_topic>rulebook",
1526
+ "research_topic>web_page",
1527
+ "research_topic>web_site",
1528
+ "rulebook>masterwork_source",
1529
+ "sch_task>record",
1530
+ "sch_task>scope",
1531
+ "seo_keyword>project",
1532
+ "seo_keyword>web_page",
1533
+ "seo_map_topic>seo_map_facet_value",
1534
+ "seo_topical_map>web_brand",
1535
+ "shared_canvas_item>record",
1536
+ "shared_canvas_item>scope",
1537
+ "skill>web_page",
1538
+ "structured_list>web_page",
1539
+ "studio_session>agent",
1540
+ "studio_session>rulebook",
1541
+ "studio_session>thread",
1542
+ "studio_session>web_page",
1543
+ "study_media>assessment",
1544
+ "study_media>fc_set",
1545
+ "study_media>file",
1546
+ "study_media>note",
1547
+ "study_media>record",
1548
+ "study_media>scope",
1549
+ "study_media>scope_type",
1550
+ "study_media>study_media",
1551
+ "task>project",
1552
+ "task>record",
1553
+ "task>scope",
1554
+ "task>scope_type",
1555
+ "task>thread",
1556
+ "task>war_room",
1557
+ "thread>record",
1558
+ "thread>scope",
1559
+ "thread>scope_type",
1560
+ "thread>war_room",
1561
+ "tool>tool_bundle",
1562
+ "transcript>agent",
1563
+ "transcript>data_store",
1564
+ "transcript>record",
1565
+ "transcript>rulebook",
1566
+ "transcript>scope",
1567
+ "transcript>web_page",
1568
+ "udt_document>agent",
1569
+ "udt_document>rulebook",
1570
+ "udt_document>web_page",
1571
+ "war_room>record",
1572
+ "war_room>scope",
1573
+ "war_room>scope_type",
1574
+ "web_page>seo_map_facet_value",
1575
+ "web_page>seo_map_topic",
1576
+ "web_page>task",
1577
+ "web_screenshot>task",
1578
+ "web_site>agent_run",
1579
+ "web_site>seo_topical_map",
1580
+ "web_youtube_video>seo_map_topic",
1581
+ "workbook>agent",
1582
+ "workbook>web_page",
1583
+ "workflow>record",
1584
+ "workflow>scope",
1585
+ "workflow>web_page",
1586
+ "working_document>agent",
1587
+ "working_document>conversation",
1588
+ "working_document>project",
1589
+ "working_document>task",
1590
+ "working_document>war_room",
1591
+ "working_document>web_page",
1592
+ "youtube_video>transcript",
1593
+ "youtube_video>web_page"
1594
+ ]);
1595
+ function isRegisteredPair(sourceType, targetType) {
1596
+ return ASSOCIATION_PAIRS.has(`${sourceType}>${targetType}`);
1597
+ }
1598
+
1172
1599
  // src/core/titles.ts
1173
1600
  function entityTitleCacheKey(token, id) {
1174
1601
  return `${token}:${id}`;
@@ -1336,6 +1763,9 @@ function isAssociationTargetType(value) {
1336
1763
  }
1337
1764
 
1338
1765
  // src/react/hooks/useContainerLinks.ts
1766
+ function linkDirection(containerType, token) {
1767
+ return isRegisteredPair(containerType, token) && !isRegisteredPair(token, containerType) ? "from-container" : "into-container";
1768
+ }
1339
1769
  function metadataRecord(metadata) {
1340
1770
  if (metadata === null || typeof metadata !== "object" || Array.isArray(metadata)) {
1341
1771
  return metadata == null ? {} : null;
@@ -1413,7 +1843,7 @@ function useContainerLinks(args) {
1413
1843
  const conversationFileError = conversationResult?.key === conversationKey ? conversationResult.error : null;
1414
1844
  const conversationFileStatus = outgoing || containerType !== "conversation" ? "idle" : conversationResult?.key !== conversationKey ? "loading" : conversationResult.loading ? "loading" : conversationFileError ? "error" : "ready";
1415
1845
  const incomingGeneric = edges.filter(
1416
- (edge) => outgoing ? edge.direction === "outgoing" : edge.direction === "incoming" && !(containerType === "conversation" && edge.otherType === "file")
1846
+ (edge) => outgoing ? edge.direction === "outgoing" : !(containerType === "conversation" && edge.otherType === "file") && (linkDirection(containerType, edge.otherType) === "from-container" ? edge.direction === "outgoing" : edge.direction === "incoming")
1417
1847
  ).map((edge) => ({
1418
1848
  edgeId: edge.id,
1419
1849
  resourceId: edge.otherId,
@@ -1438,6 +1868,19 @@ function useContainerLinks(args) {
1438
1868
  targetId: resourceId
1439
1869
  };
1440
1870
  }
1871
+ if (linkDirection(containerType, token) === "from-container") {
1872
+ if (!isAssociationTargetType(token)) {
1873
+ return {
1874
+ error: `A ${token.replace(/_/g, " ")} is attached from this record, but it is not a type the store attaches to.`
1875
+ };
1876
+ }
1877
+ return {
1878
+ sourceType: containerType,
1879
+ sourceId: containerId,
1880
+ targetType: token,
1881
+ targetId: resourceId
1882
+ };
1883
+ }
1441
1884
  return {
1442
1885
  sourceType: token,
1443
1886
  sourceId: resourceId,
@@ -3453,7 +3896,7 @@ function AssociationCard({
3453
3896
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { className: "h-4 w-4" }) }),
3454
3897
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "min-w-0 flex-1", children: [
3455
3898
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "block truncate text-sm font-medium text-foreground", children: info.labelPlural }),
3456
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "block text-[11px] text-muted-foreground tabular-nums", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "inline-flex items-center gap-1", children: [
3899
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "block text-xs text-muted-foreground tabular-nums", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "inline-flex items-center gap-1", children: [
3457
3900
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SpinnerIcon, { className: "h-3 w-3 animate-spin" }),
3458
3901
  "Loading\u2026"
3459
3902
  ] }) : `${count} ${container.direction === "outgoing" ? "filed under" : "attached"}` })