@adventurelabs/scout-core 1.4.32 → 1.4.34

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.
@@ -16,7 +16,6 @@ export function convertManualBoundingBoxToTag(boundingBox, event_id) {
16
16
  observation_type: "manual",
17
17
  class: newClassName,
18
18
  event_id: event_id,
19
- location: null,
20
19
  };
21
20
  }
22
21
  export function convertTagToBoundingBox(tag, source) {
@@ -0,0 +1,12 @@
1
+ import { IWebResponseCompatible } from "../types/requests";
2
+ import type { IEmbeddingSearchResult } from "../types/db";
3
+ import { SupabaseClient } from "@supabase/supabase-js";
4
+ /**
5
+ * Semantic search over the embeddings table (embeddings_vertex_multimodal_001).
6
+ * Returns matching embedding row ids with event_id, artifact_id, and confidence.
7
+ * Use for general embedding search without coupling to events vs artifacts.
8
+ */
9
+ export declare function server_search_embeddings_vertex_multimodal_001(query_embedding: number[], match_threshold: number, match_count: number, options?: {
10
+ herd_id?: number | null;
11
+ client?: SupabaseClient;
12
+ }): Promise<IWebResponseCompatible<IEmbeddingSearchResult[]>>;
@@ -0,0 +1,22 @@
1
+ "use server";
2
+ import { newServerClient } from "../supabase/server";
3
+ import { IWebResponse } from "../types/requests";
4
+ /**
5
+ * Semantic search over the embeddings table (embeddings_vertex_multimodal_001).
6
+ * Returns matching embedding row ids with event_id, artifact_id, and confidence.
7
+ * Use for general embedding search without coupling to events vs artifacts.
8
+ */
9
+ export async function server_search_embeddings_vertex_multimodal_001(query_embedding, match_threshold, match_count, options) {
10
+ const supabase = options?.client ?? (await newServerClient());
11
+ const rpcName = "search_embeddings_vertex_multimodal_001";
12
+ const { data, error } = await supabase.rpc(rpcName, {
13
+ query_embedding: JSON.stringify(query_embedding),
14
+ match_threshold,
15
+ match_count,
16
+ ...(options?.herd_id != null && { herd_id_caller: options.herd_id }),
17
+ });
18
+ if (error) {
19
+ return IWebResponse.error(error.message).to_compatible();
20
+ }
21
+ return IWebResponse.success((data ?? [])).to_compatible();
22
+ }
@@ -403,9 +403,12 @@ export async function get_event_and_tags_by_event_id(event_id) {
403
403
  is_public: data[0].is_public,
404
404
  herd_id: deviceData.herd_id,
405
405
  tags: (data[0].tags || []).map((tag) => {
406
- const loc = tag.location;
407
- const lat = loc ? extractLatitude(loc) : null;
408
- const lon = loc ? extractLongitude(loc) : null;
406
+ const originLoc = tag.origin_location;
407
+ const subjectLoc = tag.subject_location;
408
+ const originLat = originLoc ? extractLatitude(originLoc) : null;
409
+ const originLon = originLoc ? extractLongitude(originLoc) : null;
410
+ const subjectLat = subjectLoc ? extractLatitude(subjectLoc) : null;
411
+ const subjectLon = subjectLoc ? extractLongitude(subjectLoc) : null;
409
412
  return {
410
413
  id: tag.id,
411
414
  inserted_at: tag.inserted_at,
@@ -430,10 +433,10 @@ export async function get_event_and_tags_by_event_id(event_id) {
430
433
  origin_height: tag.origin_height,
431
434
  subject_location: tag.subject_location ?? null,
432
435
  subject_height: tag.subject_height,
433
- origin_latitude: lat,
434
- origin_longitude: lon,
435
- subject_latitude: null,
436
- subject_longitude: null,
436
+ origin_latitude: originLat,
437
+ origin_longitude: originLon,
438
+ subject_latitude: subjectLat,
439
+ subject_longitude: subjectLon,
437
440
  };
438
441
  }),
439
442
  earthranger_url: data[0].earthranger_url,
@@ -426,10 +426,13 @@ export const useInfiniteFeedByHerd = (herdId, options) => {
426
426
  const prevHerdIdRef = useRef(undefined);
427
427
  const lastAddedCursorRef = useRef(undefined);
428
428
  const pagesLengthRef = useRef(0);
429
+ /** When true, pass null to the query so we don't request (newHerdId, oldCursor) before state commits. */
430
+ const forceNullCursorRef = useRef(false);
431
+ const cursorForQuery = forceNullCursorRef.current ? null : currentCursor;
429
432
  const currentQuery = useGetFeedInfiniteByHerdQuery({
430
433
  herdId,
431
434
  limit,
432
- cursor: currentCursor,
435
+ cursor: cursorForQuery,
433
436
  supabase: options.supabase,
434
437
  }, { skip: !enabled });
435
438
  const isLoading = currentQuery.isLoading;
@@ -442,6 +445,7 @@ export const useInfiniteFeedByHerd = (herdId, options) => {
442
445
  prevHerdIdRef.current !== herdId &&
443
446
  enabled &&
444
447
  herdId) {
448
+ forceNullCursorRef.current = true;
445
449
  setPages([]);
446
450
  setCurrentCursor(null);
447
451
  setCurrentResult(null);
@@ -457,19 +461,26 @@ export const useInfiniteFeedByHerd = (herdId, options) => {
457
461
  useEffect(() => {
458
462
  if (!currentQuery.data || currentQuery.isLoading)
459
463
  return;
460
- const cursor = currentCursor;
464
+ const cursor = cursorForQuery;
461
465
  const items = Array.isArray(currentQuery.data.items)
462
466
  ? currentQuery.data.items
463
467
  : [];
464
- const hasMore = currentQuery.data.hasMore ?? false;
465
468
  const nextCursor = currentQuery.data.nextCursor ?? null;
469
+ // Derive hasMore from items we received (like dummy), so we don't get stuck when API
470
+ // returns hasMore: false e.g. due to RPC/PostgREST returning fewer rows than limit.
471
+ const hasMore = (items.length >= limit || (items.length > 0 && items.length < limit)) &&
472
+ nextCursor != null;
473
+ // After herd switch we force null cursor; once we've merged that first page, allow normal cursor again
474
+ if (cursor === null) {
475
+ forceNullCursorRef.current = false;
476
+ }
466
477
  // Only update currentResult for successful response (match dummy)
467
478
  if (items.length === 0 && cursor === null) {
468
479
  // Leave currentResult unchanged on spurious empty first page
469
480
  }
470
481
  else {
471
482
  setCurrentResult({
472
- hasMore: hasMore && nextCursor != null,
483
+ hasMore,
473
484
  nextCursor,
474
485
  });
475
486
  }
@@ -501,7 +512,7 @@ export const useInfiniteFeedByHerd = (herdId, options) => {
501
512
  }, [
502
513
  currentQuery.data,
503
514
  currentQuery.isLoading,
504
- currentCursor,
515
+ cursorForQuery,
505
516
  pages.length,
506
517
  limit,
507
518
  ]);
@@ -513,6 +524,7 @@ export const useInfiniteFeedByHerd = (herdId, options) => {
513
524
  }
514
525
  }, [currentResult, isLoading]);
515
526
  const refetch = useCallback(() => {
527
+ forceNullCursorRef.current = true;
516
528
  setPages([]);
517
529
  setCurrentCursor(null);
518
530
  setCurrentResult(null);
@@ -559,10 +571,12 @@ export const useInfiniteFeedByDevice = (deviceId, options) => {
559
571
  const prevDeviceIdRef = useRef(undefined);
560
572
  const lastAddedCursorRef = useRef(undefined);
561
573
  const pagesLengthRef = useRef(0);
574
+ const forceNullCursorRef = useRef(false);
575
+ const cursorForQuery = forceNullCursorRef.current ? null : currentCursor;
562
576
  const currentQuery = useGetFeedInfiniteByDeviceQuery({
563
577
  deviceId,
564
578
  limit: options.limit || 20,
565
- cursor: currentCursor,
579
+ cursor: cursorForQuery,
566
580
  supabase: options.supabase,
567
581
  }, { skip: !options.enabled || !deviceId });
568
582
  useEffect(() => {
@@ -572,6 +586,7 @@ export const useInfiniteFeedByDevice = (deviceId, options) => {
572
586
  useEffect(() => {
573
587
  if (prevDeviceIdRef.current !== undefined &&
574
588
  prevDeviceIdRef.current !== deviceId) {
589
+ forceNullCursorRef.current = true;
575
590
  setPages([]);
576
591
  setCurrentCursor(null);
577
592
  lastAddedCursorRef.current = undefined;
@@ -586,35 +601,39 @@ export const useInfiniteFeedByDevice = (deviceId, options) => {
586
601
  useEffect(() => {
587
602
  if (!currentQuery.data || currentQuery.isLoading)
588
603
  return;
604
+ const cursor = cursorForQuery;
605
+ if (cursor === null) {
606
+ forceNullCursorRef.current = false;
607
+ }
589
608
  if (pagesLengthRef.current > 0 &&
590
- feedCursorEq(lastAddedCursorRef.current ?? null, currentCursor))
609
+ feedCursorEq(lastAddedCursorRef.current ?? null, cursor))
591
610
  return;
592
- const nextResult = {
593
- hasMore: currentQuery.data?.hasMore ?? false,
594
- nextCursor: currentQuery.data?.nextCursor ?? null,
595
- };
596
- setLastResult(nextResult);
611
+ const items = Array.isArray(currentQuery.data?.items)
612
+ ? currentQuery.data.items
613
+ : [];
614
+ const limitForPage = options.limit || 20;
615
+ const nextCursor = currentQuery.data?.nextCursor ?? null;
616
+ const hasMore = (items.length >= limitForPage ||
617
+ (items.length > 0 && items.length < limitForPage)) &&
618
+ nextCursor != null;
619
+ setLastResult({ hasMore, nextCursor });
597
620
  setPages((prev) => {
598
- const existingPage = prev.find((p) => feedCursorEq(p.cursor, currentCursor));
621
+ const existingPage = prev.find((p) => feedCursorEq(p.cursor, cursor));
599
622
  if (!existingPage) {
600
- const items = Array.isArray(currentQuery.data?.items)
601
- ? currentQuery.data.items
602
- : [];
603
- const limit = options.limit || 20;
604
- if (items.length >= limit) {
605
- lastAddedCursorRef.current = currentCursor;
623
+ if (items.length >= limitForPage) {
624
+ lastAddedCursorRef.current = cursor;
606
625
  }
607
626
  return [
608
627
  ...prev,
609
- { cursor: currentCursor, data: items },
628
+ { cursor, data: items },
610
629
  ];
611
630
  }
612
631
  return prev;
613
632
  });
614
- if (nextResult.hasMore && nextResult.nextCursor != null) {
615
- setCurrentCursor(nextResult.nextCursor);
633
+ if (hasMore && nextCursor != null) {
634
+ setCurrentCursor(nextCursor);
616
635
  }
617
- }, [currentQuery.data, currentQuery.isLoading, currentCursor, pages.length, options.limit]);
636
+ }, [currentQuery.data, currentQuery.isLoading, cursorForQuery, pages.length, options.limit]);
618
637
  const loadMore = useCallback(() => {
619
638
  if (lastResult?.hasMore &&
620
639
  lastResult.nextCursor != null &&
@@ -623,6 +642,7 @@ export const useInfiniteFeedByDevice = (deviceId, options) => {
623
642
  }
624
643
  }, [lastResult, currentQuery.isLoading]);
625
644
  const refetch = useCallback(() => {
645
+ forceNullCursorRef.current = true;
626
646
  setPages([]);
627
647
  setCurrentCursor(null);
628
648
  lastAddedCursorRef.current = undefined;
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from "./helpers/connectivity";
18
18
  export * from "./helpers/db";
19
19
  export * from "./helpers/devices";
20
20
  export * from "./helpers/email";
21
+ export * from "./helpers/embeddings";
21
22
  export * from "./helpers/events";
22
23
  export * from "./helpers/gps";
23
24
  export * from "./helpers/herds";
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ export * from "./helpers/connectivity";
21
21
  export * from "./helpers/db";
22
22
  export * from "./helpers/devices";
23
23
  export * from "./helpers/email";
24
+ export * from "./helpers/embeddings";
24
25
  export * from "./helpers/events";
25
26
  export * from "./helpers/gps";
26
27
  export * from "./helpers/herds";
@@ -51,8 +51,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
51
51
  Row: {
52
52
  created_at: string;
53
53
  device_id: number;
54
- embedding_qwen_vl_2b: string | null;
55
- embedding_vertex_mm_01: string | null;
56
54
  file_path: string;
57
55
  file_size_bytes: number | null;
58
56
  id: number;
@@ -66,8 +64,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
66
64
  Insert: {
67
65
  created_at?: string;
68
66
  device_id: number;
69
- embedding_qwen_vl_2b?: string | null;
70
- embedding_vertex_mm_01?: string | null;
71
67
  file_path: string;
72
68
  file_size_bytes?: number | null;
73
69
  id?: number;
@@ -81,8 +77,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
81
77
  Update: {
82
78
  created_at?: string;
83
79
  device_id?: number;
84
- embedding_qwen_vl_2b?: string | null;
85
- embedding_vertex_mm_01?: string | null;
86
80
  file_path?: string;
87
81
  file_size_bytes?: number | null;
88
82
  id?: number;
@@ -359,13 +353,86 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
359
353
  referencedColumns: ["id"];
360
354
  }];
361
355
  };
356
+ embeddings_vertex_multimodal_001: {
357
+ Row: {
358
+ artifact_id: number | null;
359
+ created_at: string;
360
+ embedding: string;
361
+ event_id: number | null;
362
+ id: number;
363
+ origin_heading: number | null;
364
+ origin_height: number | null;
365
+ origin_location: unknown;
366
+ origin_pitch: number | null;
367
+ origin_roll: number | null;
368
+ sensor_pitch: number | null;
369
+ sensor_roll: number | null;
370
+ sensor_yaw: number | null;
371
+ timestamp_observation: string | null;
372
+ };
373
+ Insert: {
374
+ artifact_id?: number | null;
375
+ created_at?: string;
376
+ embedding: string;
377
+ event_id?: number | null;
378
+ id?: number;
379
+ origin_heading?: number | null;
380
+ origin_height?: number | null;
381
+ origin_location?: unknown;
382
+ origin_pitch?: number | null;
383
+ origin_roll?: number | null;
384
+ sensor_pitch?: number | null;
385
+ sensor_roll?: number | null;
386
+ sensor_yaw?: number | null;
387
+ timestamp_observation?: string | null;
388
+ };
389
+ Update: {
390
+ artifact_id?: number | null;
391
+ created_at?: string;
392
+ embedding?: string;
393
+ event_id?: number | null;
394
+ id?: number;
395
+ origin_heading?: number | null;
396
+ origin_height?: number | null;
397
+ origin_location?: unknown;
398
+ origin_pitch?: number | null;
399
+ origin_roll?: number | null;
400
+ sensor_pitch?: number | null;
401
+ sensor_roll?: number | null;
402
+ sensor_yaw?: number | null;
403
+ timestamp_observation?: string | null;
404
+ };
405
+ Relationships: [{
406
+ foreignKeyName: "embeddings_vertex_multimodal_001_artifact_id_fkey";
407
+ columns: ["artifact_id"];
408
+ isOneToOne: false;
409
+ referencedRelation: "artifacts";
410
+ referencedColumns: ["id"];
411
+ }, {
412
+ foreignKeyName: "embeddings_vertex_multimodal_001_event_id_fkey";
413
+ columns: ["event_id"];
414
+ isOneToOne: false;
415
+ referencedRelation: "events";
416
+ referencedColumns: ["id"];
417
+ }, {
418
+ foreignKeyName: "embeddings_vertex_multimodal_001_event_id_fkey";
419
+ columns: ["event_id"];
420
+ isOneToOne: false;
421
+ referencedRelation: "events_with_tags";
422
+ referencedColumns: ["id"];
423
+ }, {
424
+ foreignKeyName: "embeddings_vertex_multimodal_001_event_id_fkey";
425
+ columns: ["event_id"];
426
+ isOneToOne: false;
427
+ referencedRelation: "events_with_tags_by_session";
428
+ referencedColumns: ["id"];
429
+ }];
430
+ };
362
431
  events: {
363
432
  Row: {
364
433
  altitude: number;
365
434
  device_id: number;
366
435
  earthranger_url: string | null;
367
- embedding_qwen_vl_2b: string | null;
368
- embedding_vertex_mm_01: string | null;
369
436
  file_path: string | null;
370
437
  heading: number;
371
438
  id: number;
@@ -382,8 +449,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
382
449
  altitude?: number;
383
450
  device_id: number;
384
451
  earthranger_url?: string | null;
385
- embedding_qwen_vl_2b?: string | null;
386
- embedding_vertex_mm_01?: string | null;
387
452
  file_path?: string | null;
388
453
  heading?: number;
389
454
  id?: number;
@@ -400,8 +465,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
400
465
  altitude?: number;
401
466
  device_id?: number;
402
467
  earthranger_url?: string | null;
403
- embedding_qwen_vl_2b?: string | null;
404
- embedding_vertex_mm_01?: string | null;
405
468
  file_path?: string | null;
406
469
  heading?: number;
407
470
  id?: number;
@@ -934,7 +997,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
934
997
  height: number;
935
998
  id: number;
936
999
  inserted_at: string;
937
- location: unknown;
938
1000
  observation_type: Database["public"]["Enums"]["tag_observation_type"];
939
1001
  origin_heading: number | null;
940
1002
  origin_height: number | null;
@@ -961,7 +1023,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
961
1023
  height?: number;
962
1024
  id?: number;
963
1025
  inserted_at?: string;
964
- location?: unknown;
965
1026
  observation_type: Database["public"]["Enums"]["tag_observation_type"];
966
1027
  origin_heading?: number | null;
967
1028
  origin_height?: number | null;
@@ -988,7 +1049,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
988
1049
  height?: number;
989
1050
  id?: number;
990
1051
  inserted_at?: string;
991
- location?: unknown;
992
1052
  observation_type?: Database["public"]["Enums"]["tag_observation_type"];
993
1053
  origin_heading?: number | null;
994
1054
  origin_height?: number | null;
@@ -1359,8 +1419,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
1359
1419
  Returns: {
1360
1420
  created_at: string;
1361
1421
  device_id: number;
1362
- embedding_qwen_vl_2b: string | null;
1363
- embedding_vertex_mm_01: string | null;
1364
1422
  file_path: string;
1365
1423
  file_size_bytes: number | null;
1366
1424
  id: number;
@@ -1386,8 +1444,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
1386
1444
  Returns: {
1387
1445
  created_at: string;
1388
1446
  device_id: number;
1389
- embedding_qwen_vl_2b: string | null;
1390
- embedding_vertex_mm_01: string | null;
1391
1447
  file_path: string;
1392
1448
  file_size_bytes: number | null;
1393
1449
  id: number;
@@ -1414,8 +1470,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
1414
1470
  Returns: {
1415
1471
  created_at: string;
1416
1472
  device_id: number;
1417
- embedding_qwen_vl_2b: string | null;
1418
- embedding_vertex_mm_01: string | null;
1419
1473
  file_path: string;
1420
1474
  file_size_bytes: number | null;
1421
1475
  id: number;
@@ -1442,8 +1496,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
1442
1496
  Returns: {
1443
1497
  created_at: string;
1444
1498
  device_id: number;
1445
- embedding_qwen_vl_2b: string | null;
1446
- embedding_vertex_mm_01: string | null;
1447
1499
  file_path: string;
1448
1500
  file_size_bytes: number | null;
1449
1501
  id: number;
@@ -1471,8 +1523,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
1471
1523
  Returns: {
1472
1524
  created_at: string;
1473
1525
  device_id: number;
1474
- embedding_qwen_vl_2b: string | null;
1475
- embedding_vertex_mm_01: string | null;
1476
1526
  file_path: string;
1477
1527
  file_size_bytes: number | null;
1478
1528
  id: number;
@@ -1500,8 +1550,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
1500
1550
  Returns: {
1501
1551
  created_at: string;
1502
1552
  device_id: number;
1503
- embedding_qwen_vl_2b: string | null;
1504
- embedding_vertex_mm_01: string | null;
1505
1553
  file_path: string;
1506
1554
  file_size_bytes: number | null;
1507
1555
  id: number;
@@ -1529,8 +1577,6 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
1529
1577
  Returns: {
1530
1578
  created_at: string;
1531
1579
  device_id: number;
1532
- embedding_qwen_vl_2b: string | null;
1533
- embedding_vertex_mm_01: string | null;
1534
1580
  file_path: string;
1535
1581
  file_size_bytes: number | null;
1536
1582
  id: number;
@@ -2006,6 +2052,21 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
2006
2052
  Args: never;
2007
2053
  Returns: undefined;
2008
2054
  };
2055
+ search_embeddings_vertex_multimodal_001: {
2056
+ Args: {
2057
+ herd_id_caller?: number;
2058
+ match_count: number;
2059
+ match_threshold: number;
2060
+ query_embedding: string;
2061
+ };
2062
+ Returns: Database["public"]["CompositeTypes"]["embedding_search_result"][];
2063
+ SetofOptions: {
2064
+ from: "*";
2065
+ to: "embedding_search_result";
2066
+ isOneToOne: false;
2067
+ isSetofReturn: true;
2068
+ };
2069
+ };
2009
2070
  set_herd_location: {
2010
2071
  Args: {
2011
2072
  p_herd_id: number;
@@ -2080,6 +2141,12 @@ export declare function useSupabase(): SupabaseClient<Database, "public", "publi
2080
2141
  id: number | null;
2081
2142
  confidence: number | null;
2082
2143
  };
2144
+ embedding_search_result: {
2145
+ id: number | null;
2146
+ event_id: number | null;
2147
+ artifact_id: number | null;
2148
+ confidence: number | null;
2149
+ };
2083
2150
  event_and_tags: {
2084
2151
  id: number | null;
2085
2152
  inserted_at: string | null;
@@ -90,6 +90,7 @@ export type IFeedItem = {
90
90
  };
91
91
  export type ISessionWithCoordinates = Database["public"]["CompositeTypes"]["session_with_coordinates"];
92
92
  export type IConnectivityWithCoordinates = Database["public"]["CompositeTypes"]["connectivity_with_coordinates"];
93
+ export type IEmbeddingSearchResult = Database["public"]["CompositeTypes"]["embedding_search_result"];
93
94
  export type IDeviceHeartbeatAnalysis = Database["public"]["CompositeTypes"]["device_heartbeat_analysis"];
94
95
  export type IHerdUptimeSummary = Database["public"]["Functions"]["get_herd_uptime_summary"]["Returns"][0];
95
96
  export interface IZoneWithActions extends IZone {
@@ -50,8 +50,6 @@ export type Database = {
50
50
  Row: {
51
51
  created_at: string;
52
52
  device_id: number;
53
- embedding_qwen_vl_2b: string | null;
54
- embedding_vertex_mm_01: string | null;
55
53
  file_path: string;
56
54
  file_size_bytes: number | null;
57
55
  id: number;
@@ -65,8 +63,6 @@ export type Database = {
65
63
  Insert: {
66
64
  created_at?: string;
67
65
  device_id: number;
68
- embedding_qwen_vl_2b?: string | null;
69
- embedding_vertex_mm_01?: string | null;
70
66
  file_path: string;
71
67
  file_size_bytes?: number | null;
72
68
  id?: number;
@@ -80,8 +76,6 @@ export type Database = {
80
76
  Update: {
81
77
  created_at?: string;
82
78
  device_id?: number;
83
- embedding_qwen_vl_2b?: string | null;
84
- embedding_vertex_mm_01?: string | null;
85
79
  file_path?: string;
86
80
  file_size_bytes?: number | null;
87
81
  id?: number;
@@ -374,13 +368,91 @@ export type Database = {
374
368
  }
375
369
  ];
376
370
  };
371
+ embeddings_vertex_multimodal_001: {
372
+ Row: {
373
+ artifact_id: number | null;
374
+ created_at: string;
375
+ embedding: string;
376
+ event_id: number | null;
377
+ id: number;
378
+ origin_heading: number | null;
379
+ origin_height: number | null;
380
+ origin_location: unknown;
381
+ origin_pitch: number | null;
382
+ origin_roll: number | null;
383
+ sensor_pitch: number | null;
384
+ sensor_roll: number | null;
385
+ sensor_yaw: number | null;
386
+ timestamp_observation: string | null;
387
+ };
388
+ Insert: {
389
+ artifact_id?: number | null;
390
+ created_at?: string;
391
+ embedding: string;
392
+ event_id?: number | null;
393
+ id?: number;
394
+ origin_heading?: number | null;
395
+ origin_height?: number | null;
396
+ origin_location?: unknown;
397
+ origin_pitch?: number | null;
398
+ origin_roll?: number | null;
399
+ sensor_pitch?: number | null;
400
+ sensor_roll?: number | null;
401
+ sensor_yaw?: number | null;
402
+ timestamp_observation?: string | null;
403
+ };
404
+ Update: {
405
+ artifact_id?: number | null;
406
+ created_at?: string;
407
+ embedding?: string;
408
+ event_id?: number | null;
409
+ id?: number;
410
+ origin_heading?: number | null;
411
+ origin_height?: number | null;
412
+ origin_location?: unknown;
413
+ origin_pitch?: number | null;
414
+ origin_roll?: number | null;
415
+ sensor_pitch?: number | null;
416
+ sensor_roll?: number | null;
417
+ sensor_yaw?: number | null;
418
+ timestamp_observation?: string | null;
419
+ };
420
+ Relationships: [
421
+ {
422
+ foreignKeyName: "embeddings_vertex_multimodal_001_artifact_id_fkey";
423
+ columns: ["artifact_id"];
424
+ isOneToOne: false;
425
+ referencedRelation: "artifacts";
426
+ referencedColumns: ["id"];
427
+ },
428
+ {
429
+ foreignKeyName: "embeddings_vertex_multimodal_001_event_id_fkey";
430
+ columns: ["event_id"];
431
+ isOneToOne: false;
432
+ referencedRelation: "events";
433
+ referencedColumns: ["id"];
434
+ },
435
+ {
436
+ foreignKeyName: "embeddings_vertex_multimodal_001_event_id_fkey";
437
+ columns: ["event_id"];
438
+ isOneToOne: false;
439
+ referencedRelation: "events_with_tags";
440
+ referencedColumns: ["id"];
441
+ },
442
+ {
443
+ foreignKeyName: "embeddings_vertex_multimodal_001_event_id_fkey";
444
+ columns: ["event_id"];
445
+ isOneToOne: false;
446
+ referencedRelation: "events_with_tags_by_session";
447
+ referencedColumns: ["id"];
448
+ }
449
+ ];
450
+ };
377
451
  events: {
378
452
  Row: {
379
453
  altitude: number;
380
454
  device_id: number;
381
455
  earthranger_url: string | null;
382
- embedding_qwen_vl_2b: string | null;
383
- embedding_vertex_mm_01: string | null;
384
456
  file_path: string | null;
385
457
  heading: number;
386
458
  id: number;
@@ -397,8 +469,6 @@ export type Database = {
397
469
  altitude?: number;
398
470
  device_id: number;
399
471
  earthranger_url?: string | null;
400
- embedding_qwen_vl_2b?: string | null;
401
- embedding_vertex_mm_01?: string | null;
402
472
  file_path?: string | null;
403
473
  heading?: number;
404
474
  id?: number;
@@ -415,8 +485,6 @@ export type Database = {
415
485
  altitude?: number;
416
486
  device_id?: number;
417
487
  earthranger_url?: string | null;
418
- embedding_qwen_vl_2b?: string | null;
419
- embedding_vertex_mm_01?: string | null;
420
488
  file_path?: string | null;
421
489
  heading?: number;
422
490
  id?: number;
@@ -981,7 +1049,6 @@ export type Database = {
981
1049
  height: number;
982
1050
  id: number;
983
1051
  inserted_at: string;
984
- location: unknown;
985
1052
  observation_type: Database["public"]["Enums"]["tag_observation_type"];
986
1053
  origin_heading: number | null;
987
1054
  origin_height: number | null;
@@ -1008,7 +1075,6 @@ export type Database = {
1008
1075
  height?: number;
1009
1076
  id?: number;
1010
1077
  inserted_at?: string;
1011
- location?: unknown;
1012
1078
  observation_type: Database["public"]["Enums"]["tag_observation_type"];
1013
1079
  origin_heading?: number | null;
1014
1080
  origin_height?: number | null;
@@ -1035,7 +1101,6 @@ export type Database = {
1035
1101
  height?: number;
1036
1102
  id?: number;
1037
1103
  inserted_at?: string;
1038
- location?: unknown;
1039
1104
  observation_type?: Database["public"]["Enums"]["tag_observation_type"];
1040
1105
  origin_heading?: number | null;
1041
1106
  origin_height?: number | null;
@@ -1426,8 +1491,6 @@ export type Database = {
1426
1491
  Returns: {
1427
1492
  created_at: string;
1428
1493
  device_id: number;
1429
- embedding_qwen_vl_2b: string | null;
1430
- embedding_vertex_mm_01: string | null;
1431
1494
  file_path: string;
1432
1495
  file_size_bytes: number | null;
1433
1496
  id: number;
@@ -1453,8 +1516,6 @@ export type Database = {
1453
1516
  Returns: {
1454
1517
  created_at: string;
1455
1518
  device_id: number;
1456
- embedding_qwen_vl_2b: string | null;
1457
- embedding_vertex_mm_01: string | null;
1458
1519
  file_path: string;
1459
1520
  file_size_bytes: number | null;
1460
1521
  id: number;
@@ -1481,8 +1542,6 @@ export type Database = {
1481
1542
  Returns: {
1482
1543
  created_at: string;
1483
1544
  device_id: number;
1484
- embedding_qwen_vl_2b: string | null;
1485
- embedding_vertex_mm_01: string | null;
1486
1545
  file_path: string;
1487
1546
  file_size_bytes: number | null;
1488
1547
  id: number;
@@ -1509,8 +1568,6 @@ export type Database = {
1509
1568
  Returns: {
1510
1569
  created_at: string;
1511
1570
  device_id: number;
1512
- embedding_qwen_vl_2b: string | null;
1513
- embedding_vertex_mm_01: string | null;
1514
1571
  file_path: string;
1515
1572
  file_size_bytes: number | null;
1516
1573
  id: number;
@@ -1538,8 +1595,6 @@ export type Database = {
1538
1595
  Returns: {
1539
1596
  created_at: string;
1540
1597
  device_id: number;
1541
- embedding_qwen_vl_2b: string | null;
1542
- embedding_vertex_mm_01: string | null;
1543
1598
  file_path: string;
1544
1599
  file_size_bytes: number | null;
1545
1600
  id: number;
@@ -1567,8 +1622,6 @@ export type Database = {
1567
1622
  Returns: {
1568
1623
  created_at: string;
1569
1624
  device_id: number;
1570
- embedding_qwen_vl_2b: string | null;
1571
- embedding_vertex_mm_01: string | null;
1572
1625
  file_path: string;
1573
1626
  file_size_bytes: number | null;
1574
1627
  id: number;
@@ -1596,8 +1649,6 @@ export type Database = {
1596
1649
  Returns: {
1597
1650
  created_at: string;
1598
1651
  device_id: number;
1599
- embedding_qwen_vl_2b: string | null;
1600
- embedding_vertex_mm_01: string | null;
1601
1652
  file_path: string;
1602
1653
  file_size_bytes: number | null;
1603
1654
  id: number;
@@ -2073,6 +2124,21 @@ export type Database = {
2073
2124
  Args: never;
2074
2125
  Returns: undefined;
2075
2126
  };
2127
+ search_embeddings_vertex_multimodal_001: {
2128
+ Args: {
2129
+ herd_id_caller?: number;
2130
+ match_count: number;
2131
+ match_threshold: number;
2132
+ query_embedding: string;
2133
+ };
2134
+ Returns: Database["public"]["CompositeTypes"]["embedding_search_result"][];
2135
+ SetofOptions: {
2136
+ from: "*";
2137
+ to: "embedding_search_result";
2138
+ isOneToOne: false;
2139
+ isSetofReturn: true;
2140
+ };
2141
+ };
2076
2142
  set_herd_location: {
2077
2143
  Args: {
2078
2144
  p_herd_id: number;
@@ -2147,6 +2213,12 @@ export type Database = {
2147
2213
  id: number | null;
2148
2214
  confidence: number | null;
2149
2215
  };
2216
+ embedding_search_result: {
2217
+ id: number | null;
2218
+ event_id: number | null;
2219
+ artifact_id: number | null;
2220
+ confidence: number | null;
2221
+ };
2150
2222
  event_and_tags: {
2151
2223
  id: number | null;
2152
2224
  inserted_at: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adventurelabs/scout-core",
3
- "version": "1.4.32",
3
+ "version": "1.4.34",
4
4
  "description": "Core utilities and helpers for Adventure Labs Scout applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",