@vertesia/common 1.5.0-dev.20260714.072725Z → 1.5.0-dev.20260717.131047Z

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.
@@ -851,6 +851,99 @@ export interface DashboardQueryParameters {
851
851
  defaults: Record<string, string>;
852
852
  }
853
853
 
854
+ /**
855
+ * Elasticsearch DSL supported by dashboard data sources.
856
+ * Queries execute through Vertesia Store, so project/security filtering remains server-side.
857
+ */
858
+ export interface DashboardElasticsearchDsl {
859
+ query?: Record<string, unknown>;
860
+ aggs?: Record<string, unknown>;
861
+ size?: number;
862
+ from?: number;
863
+ sort?: Array<Record<string, unknown>>;
864
+ }
865
+
866
+ /**
867
+ * How an Elasticsearch DSL result should be converted into Vega rows.
868
+ */
869
+ export type DashboardElasticsearchResultMapping =
870
+ | {
871
+ type: 'hits';
872
+ }
873
+ | {
874
+ type: 'aggregation_buckets';
875
+ /** Dot path under `aggregations` that contains a `buckets` array. */
876
+ path: string;
877
+ /** Output field name for bucket key. Defaults to `key`. */
878
+ keyField?: string;
879
+ /** Output field name for doc count. Defaults to `doc_count`. */
880
+ countField?: string;
881
+ };
882
+
883
+ /**
884
+ * Dashboard data source backed by a Data Platform SQL query.
885
+ */
886
+ export interface DashboardSqlDataSource {
887
+ kind: 'data_sql';
888
+ /** SQL query that returns all rows for the dashboard. */
889
+ query: string;
890
+ /** Maximum rows to return from the query. */
891
+ queryLimit?: number;
892
+ /** Default values for SQL {{param}} placeholders. */
893
+ queryParameters?: Record<string, string>;
894
+ }
895
+
896
+ /**
897
+ * Dashboard data source backed by Vertesia Store Elasticsearch DSL.
898
+ */
899
+ export interface DashboardStoreElasticsearchDataSource {
900
+ kind: 'store_es_dsl';
901
+ /** Elasticsearch DSL query executed through the secured Store query API. */
902
+ dsl: DashboardElasticsearchDsl;
903
+ /** Result mapping. Defaults to `hits`. */
904
+ result?: DashboardElasticsearchResultMapping;
905
+ }
906
+
907
+ /**
908
+ * Data source for a Vega dashboard.
909
+ */
910
+ export type DashboardDataSource = DashboardSqlDataSource | DashboardStoreElasticsearchDataSource;
911
+
912
+ /**
913
+ * Dashboard definition contributed by an app package.
914
+ *
915
+ * App dashboard IDs are local to the app. The platform exposes them as
916
+ * `app:<app_name>:<id>` when listing or retrieving dashboards.
917
+ */
918
+ export interface AppDashboardDefinition {
919
+ /** Local app dashboard ID. */
920
+ id: string;
921
+ /** Machine-friendly dashboard name. Defaults to `id`. */
922
+ name?: string;
923
+ /** Display title. Defaults to `name` or `id`. */
924
+ title?: string;
925
+ /** User-facing description. */
926
+ description?: string;
927
+ /** Tags for discovery and filtering. */
928
+ tags?: string[];
929
+ /** Data source used to populate Vega `data.values`. */
930
+ dataSource?: DashboardDataSource;
931
+ /** SQL query shortcut for app dashboards backed by data stores. */
932
+ query?: string;
933
+ /** Maximum SQL rows to return. */
934
+ queryLimit?: number;
935
+ /** Default values for SQL {{param}} placeholders. */
936
+ queryParameters?: Record<string, string>;
937
+ /** Complete Vega-Lite specification for the dashboard. */
938
+ spec?: Record<string, unknown>;
939
+ /** Legacy named SQL queries. */
940
+ queries?: DashboardQuery[];
941
+ /** Legacy panel definitions. */
942
+ panels?: DashboardPanel[];
943
+ /** Legacy dashboard layout. */
944
+ layout?: DashboardLayout;
945
+ }
946
+
854
947
  /**
855
948
  * Summary view of a dashboard (for listings).
856
949
  */
@@ -867,15 +960,22 @@ export interface DashboardItem extends BaseObject {
867
960
  last_rendered_at?: string;
868
961
  /** Tags for organization */
869
962
  tags: string[];
963
+ /** Source of the dashboard definition. Defaults to stored dashboards. */
964
+ source?: 'stored' | 'app';
965
+ /** App name when `source` is `app`. */
966
+ app_name?: string;
967
+ /** App dashboards are read-only until cloned into a stored dashboard. */
968
+ readonly?: boolean;
870
969
  }
871
970
 
872
971
  /**
873
972
  * Full dashboard with SQL query and Vega-Lite specification.
874
973
  *
875
974
  * **New architecture (v2):**
876
- * - Single `query` field with SQL (use JOINs/CTEs for complex data needs)
975
+ * - `dataSource` field with either SQL or Store Elasticsearch DSL
877
976
  * - Single `spec` field with complete Vega-Lite spec (vconcat/hconcat for multiple panels)
878
977
  * - Cross-panel interactivity via Vega selections
978
+ * - Legacy top-level `query` fields are treated as a SQL data source
879
979
  *
880
980
  * **Legacy architecture (v1, deprecated):**
881
981
  * - Multiple `queries` with named data sources
@@ -885,18 +985,26 @@ export interface DashboardItem extends BaseObject {
885
985
  */
886
986
  export interface Dashboard extends DashboardItem {
887
987
  // ============= New architecture (v2) =============
988
+ /**
989
+ * Data source used to populate Vega `data.values`.
990
+ * When omitted, top-level `query` is treated as a SQL data source for backwards compatibility.
991
+ */
992
+ dataSource?: DashboardDataSource;
888
993
  /**
889
994
  * SQL query that returns all data for the dashboard.
890
995
  * Use JOINs, CTEs, or UNION ALL to combine data from multiple tables.
891
996
  * Can include {{param_name}} placeholders for dynamic values.
997
+ * @deprecated Use `dataSource: { kind: 'data_sql', query }` instead.
892
998
  */
893
999
  query?: string;
894
1000
  /**
895
1001
  * Maximum rows to return from the query (default: 10000).
1002
+ * @deprecated Use `dataSource.queryLimit` instead.
896
1003
  */
897
1004
  queryLimit?: number;
898
1005
  /**
899
1006
  * Default values for SQL parameters.
1007
+ * @deprecated Use `dataSource.queryParameters` instead.
900
1008
  */
901
1009
  queryParameters?: Record<string, string>;
902
1010
  /**
@@ -930,15 +1038,17 @@ export interface Dashboard extends DashboardItem {
930
1038
 
931
1039
  /**
932
1040
  * Payload for creating a new dashboard.
933
- * Requires query (SQL) and spec (Vega-Lite).
1041
+ * Requires a data source and spec (Vega-Lite).
934
1042
  */
935
1043
  export interface CreateDashboardPayload {
936
1044
  /** Dashboard name (unique within store) */
937
1045
  name: string;
938
1046
  /** Dashboard summary */
939
1047
  summary?: string;
940
- /** SQL query that returns all data for the dashboard */
941
- query: string;
1048
+ /** Data source used to populate Vega `data.values`. */
1049
+ dataSource?: DashboardDataSource;
1050
+ /** SQL query that returns all data for the dashboard. Deprecated shortcut for a SQL data source. */
1051
+ query?: string;
942
1052
  /** Maximum rows to return from the query (default: 10000) */
943
1053
  queryLimit?: number;
944
1054
  /** Default values for SQL {{param}} placeholders */
@@ -955,7 +1065,9 @@ export interface UpdateDashboardPayload {
955
1065
  name?: string;
956
1066
  /** Dashboard summary */
957
1067
  summary?: string;
958
- /** SQL query that returns all data for the dashboard */
1068
+ /** Data source used to populate Vega `data.values`. */
1069
+ dataSource?: DashboardDataSource;
1070
+ /** SQL query that returns all data for the dashboard. Deprecated shortcut for a SQL data source. */
959
1071
  query?: string;
960
1072
  /** Maximum rows to return from the query (default: 10000) */
961
1073
  queryLimit?: number;
@@ -972,6 +1084,8 @@ export interface UpdateDashboardPayload {
972
1084
  */
973
1085
  export interface PreviewDashboardPayload {
974
1086
  // ============= New architecture (v2) =============
1087
+ /** Data source used to populate Vega `data.values`. */
1088
+ dataSource?: DashboardDataSource;
975
1089
  /** SQL query that returns all data for the dashboard */
976
1090
  query?: string;
977
1091
  /** Maximum rows to return from the query (default: 10000) */
@@ -1035,6 +1149,16 @@ export interface DashboardVersion {
1035
1149
  version_number: number;
1036
1150
  /** Commit message describing the change */
1037
1151
  message: string;
1152
+ /** Snapshot of v2 data source at this version */
1153
+ dataSource?: DashboardDataSource;
1154
+ /** Snapshot of v2 SQL query at this version */
1155
+ query?: string;
1156
+ /** Snapshot of v2 query limit at this version */
1157
+ queryLimit?: number;
1158
+ /** Snapshot of v2 query parameters at this version */
1159
+ queryParameters?: Record<string, string>;
1160
+ /** Snapshot of v2 Vega-Lite spec at this version */
1161
+ spec?: Record<string, unknown>;
1038
1162
  /** Snapshot of queries at this version */
1039
1163
  queries: DashboardQuery[];
1040
1164
  /** Snapshot of panels at this version */
@@ -26,7 +26,7 @@ import type {
26
26
  } from './prompt.js';
27
27
  import type { ExecutionRunDocRef } from './runs.js';
28
28
  import type { AgentToolApprovalMode } from './store/agent-approval.js';
29
- import type { ConversationState } from './store/conversation-state.js';
29
+ import type { ConversationState, TextArtifactReference } from './store/conversation-state.js';
30
30
  import type { AccountRef } from './user.js';
31
31
  import type { LlmCallType } from './workflow-analytics.js';
32
32
 
@@ -895,6 +895,8 @@ export interface ResultStorageOptions {
895
895
  // - Otherwise → text/markdown or text/plain
896
896
  }
897
897
 
898
+ export type AsyncCompletionMode = 'conversation_state' | 'text';
899
+
898
900
  /**
899
901
  * Streaming-specific options (only needed when stream=true)
900
902
  */
@@ -950,6 +952,13 @@ export interface AsyncCompletionOptions {
950
952
  * after inference completes (before completing the Temporal activity).
951
953
  */
952
954
  result_storage?: ResultStorageOptions;
955
+ /**
956
+ * Controls the value used to complete the Temporal activity.
957
+ * Defaults to `conversation_state` for agent resume/continuation calls.
958
+ * Use `text` for one-shot helper calls, such as checkpoint summaries,
959
+ * that need the model's text result instead of merged conversation state.
960
+ */
961
+ completion_mode?: AsyncCompletionMode;
953
962
  }
954
963
 
955
964
  interface ResumeConversationPayload {
@@ -966,6 +975,12 @@ interface ResumeConversationPayload {
966
975
 
967
976
  export interface ToolResultContent {
968
977
  content: string;
978
+ /**
979
+ * Reference to text content stored outside Temporal/API payloads. Servers that
980
+ * execute the next model turn should resolve this before constructing the
981
+ * provider prompt.
982
+ */
983
+ content_ref?: TextArtifactReference;
969
984
  is_error: boolean;
970
985
  files?: string[];
971
986
  /**
@@ -2,7 +2,6 @@ export type {
2
2
  JSONSchema,
3
3
  JSONSchemaArray,
4
4
  JSONSchemaObject,
5
- JSONSchemaProperties,
6
5
  JSONSchemaType,
7
6
  JSONSchemaTypeName,
8
7
  } from '@llumiverse/common';
@@ -489,6 +489,59 @@ export interface ListEventDeliveriesResponse {
489
489
  deliveries: EventDeliverySummary[];
490
490
  }
491
491
 
492
+ export interface StreamEventDeliveriesQuery {
493
+ limit?: number;
494
+ event_id?: string;
495
+ resource_id?: string;
496
+ resource_type?: string[];
497
+ event_category?: EventCategory[];
498
+ action?: string[];
499
+ outbox_status?: EventOutboxStatus[];
500
+ since_event_id?: string;
501
+ since_created_at?: string;
502
+ include_event?: boolean;
503
+ poll_interval_ms?: number;
504
+ }
505
+
506
+ export interface EventDeliveryStreamItem {
507
+ cursor: string;
508
+ delivery: EventDeliverySummary;
509
+ event?: PlatformEvent;
510
+ }
511
+
512
+ export interface EventDeliveryStreamSnapshot {
513
+ type: 'snapshot';
514
+ emitted_at: string;
515
+ cursor?: string;
516
+ deliveries: EventDeliveryStreamItem[];
517
+ }
518
+
519
+ export interface EventDeliveryStreamUpdate {
520
+ type: 'event';
521
+ emitted_at: string;
522
+ cursor: string;
523
+ item: EventDeliveryStreamItem;
524
+ }
525
+
526
+ export interface EventDeliveryStreamHeartbeat {
527
+ type: 'heartbeat';
528
+ emitted_at: string;
529
+ cursor?: string;
530
+ }
531
+
532
+ export interface EventDeliveryStreamError {
533
+ type: 'error';
534
+ emitted_at: string;
535
+ cursor?: string;
536
+ error: string;
537
+ }
538
+
539
+ export type EventDeliveryStreamEnvelope =
540
+ | EventDeliveryStreamSnapshot
541
+ | EventDeliveryStreamUpdate
542
+ | EventDeliveryStreamHeartbeat
543
+ | EventDeliveryStreamError;
544
+
492
545
  export type EventSubscriptionSortField = 'name' | 'scope' | 'target_type' | 'enabled' | 'updated_at';
493
546
 
494
547
  export interface ListEventSubscriptionsQuery {
@@ -0,0 +1,32 @@
1
+ import { describe, expect, test } from 'vitest';
2
+ import { SystemRoles } from './project.js';
3
+ import { AbacScopes } from './roles/types.js';
4
+
5
+ describe('shared role vocabulary', () => {
6
+ test('exports all system roles', () => {
7
+ expect(Object.values(SystemRoles).sort()).toEqual(
8
+ [
9
+ 'admin',
10
+ 'app_member',
11
+ 'application',
12
+ 'auditor',
13
+ 'automation',
14
+ 'billing',
15
+ 'consumer',
16
+ 'content_processor',
17
+ 'content_superadmin',
18
+ 'developer',
19
+ 'executor',
20
+ 'manager',
21
+ 'member',
22
+ 'owner',
23
+ 'reader',
24
+ 'support',
25
+ ].sort(),
26
+ );
27
+ });
28
+
29
+ test('exports ABAC scopes used by role wire types', () => {
30
+ expect(AbacScopes).toEqual(['document', 'collection', 'task']);
31
+ });
32
+ });
@@ -453,6 +453,8 @@ export interface UpdateAgentRunStatusPayload {
453
453
  title?: string;
454
454
  topic?: string;
455
455
  lessons_learned?: string[];
456
+ /** Shallow-merged into the run's existing properties. */
457
+ properties?: Record<string, unknown>;
456
458
  /** ES-only: conversation content text (not stored in MongoDB) */
457
459
  content?: string;
458
460
  /**
@@ -14,6 +14,34 @@ export interface ToolReference {
14
14
  stored_at: string;
15
15
  }
16
16
 
17
+ /** Reference to text content externalized to agent artifact storage. */
18
+ export interface TextArtifactReference {
19
+ storage_id: string;
20
+ artifact_path: string;
21
+ display_ref: string;
22
+ sha256: string;
23
+ size_bytes: number;
24
+ content_type: string;
25
+ }
26
+
27
+ /**
28
+ * Sidecar metadata for generated tool input fields that were stored outside
29
+ * model-visible tool_input. Keyed by tool_use.id on ConversationState.
30
+ */
31
+ export interface ExternalizedToolInputRef {
32
+ tool_name: string;
33
+ input_path: ['content'];
34
+ ref: TextArtifactReference;
35
+ }
36
+
37
+ export interface ExternalizedToolInputRefs {
38
+ [toolUseId: string]: ExternalizedToolInputRef[];
39
+ }
40
+
41
+ export function toolInputRefsArtifactPath(storageId: string): string {
42
+ return `agents/${storageId}/tool-input-refs.json`;
43
+ }
44
+
17
45
  /**
18
46
  * Conversation state passed between workflow activities.
19
47
  * Contains all context needed to continue a multi-turn agent conversation.
@@ -51,6 +79,15 @@ export interface ConversationState {
51
79
  /** Compact, redacted latest user intent for reviewer-style system interactions. */
52
80
  latest_user_message?: string;
53
81
 
82
+ /**
83
+ * Transport sidecar for large generated tool input fields.
84
+ *
85
+ * These refs are intentionally kept out of tool_use.tool_input so they are
86
+ * not shown to the model. Tool execution hydrates them from artifact storage
87
+ * immediately before activity validation.
88
+ */
89
+ tool_input_refs?: ExternalizedToolInputRefs;
90
+
54
91
  /**
55
92
  * The output of the this conversation step
56
93
  */
@@ -204,6 +241,16 @@ export interface ConversationState {
204
241
  * to consolidate all artifacts under the parent agent run.
205
242
  */
206
243
  launch_id?: string;
244
+
245
+ /**
246
+ * The app version this run is pinned to (candidate testing), derived from the `@version` on the
247
+ * started interaction ref / the `x-vertesia-app-version` header at start. Persisted on the state
248
+ * so it survives resume, and applied to the activity client (`withAppVersion`) so every app-owned
249
+ * ref the run resolves — interactions, types, processes, tools — targets this version instead of
250
+ * the current/promoted one. Undefined → current/promoted. Resolution-time only; never a stored
251
+ * capability-ref version.
252
+ */
253
+ app_version?: string;
207
254
  }
208
255
 
209
256
  /**