@ai-matrx/data 0.22.16 → 0.22.17

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.
package/dist/types.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * the @ai-matrx packages read, copied verbatim — the ONE copy (architecture P5).
6
6
  * A host typed with the full platform `Database` passes its client unchanged.
7
7
  *
8
- * Schemas (18): admin, agent, ai, canvas, chat, content, deprecated, dictionary, education, files, iam, mandate, platform, public, scheduler, tool, ui, users
8
+ * Schemas (19): admin, agent, ai, canvas, chat, content, deprecated, dictionary, education, files, iam, mandate, platform, public, scheduler, skill, tool, ui, users
9
9
  */
10
10
  type Json = unknown;
11
11
  type Database = {
@@ -30250,6 +30250,35 @@ type Database = {
30250
30250
  };
30251
30251
  Returns: boolean;
30252
30252
  };
30253
+ _agent_spend_facts: {
30254
+ Args: {
30255
+ p_conversation_id?: string;
30256
+ p_org_id: string;
30257
+ p_since: string;
30258
+ };
30259
+ Returns: {
30260
+ agent_id: string;
30261
+ automated: boolean;
30262
+ calls: number;
30263
+ conversation_id: string;
30264
+ cost: number;
30265
+ created_at: string;
30266
+ execution_id: string;
30267
+ feature: string;
30268
+ iterations: number;
30269
+ mandate_key: string;
30270
+ model: string;
30271
+ organization_id: string;
30272
+ origin: string;
30273
+ person_id: string;
30274
+ request_id: string;
30275
+ run_key: string;
30276
+ saved: boolean;
30277
+ tokens_cached: number;
30278
+ tokens_in: number;
30279
+ tokens_out: number;
30280
+ }[];
30281
+ };
30253
30282
  _carried_back_value: {
30254
30283
  Args: {
30255
30284
  p_older_type: string;
@@ -31087,6 +31116,12 @@ type Database = {
31087
31116
  };
31088
31117
  Returns: number;
31089
31118
  };
31119
+ _spend_access: {
31120
+ Args: {
31121
+ p_org_id: string;
31122
+ };
31123
+ Returns: undefined;
31124
+ };
31090
31125
  _store_pick_list_document: {
31091
31126
  Args: {
31092
31127
  p_list_id: string;
@@ -31391,6 +31426,65 @@ type Database = {
31391
31426
  };
31392
31427
  Returns: Json;
31393
31428
  };
31429
+ agent_spend_health: {
31430
+ Args: {
31431
+ p_days?: number;
31432
+ p_org_id?: string;
31433
+ };
31434
+ Returns: {
31435
+ agent_id: string;
31436
+ agent_name: string;
31437
+ agent_type: string;
31438
+ automated_runs: number;
31439
+ avg_input_per_call: number;
31440
+ avg_output_per_call: number;
31441
+ avg_run_cost: number;
31442
+ avg_turns: number;
31443
+ calls: number;
31444
+ cost: number;
31445
+ last_run_at: string;
31446
+ mandate_key: string;
31447
+ mandate_label: string;
31448
+ max_run_cost: number;
31449
+ max_turns: number;
31450
+ models: string[];
31451
+ organizations: Json;
31452
+ payers: Json;
31453
+ premium_models: string[];
31454
+ runs: number;
31455
+ unsaved_cost: number;
31456
+ unsaved_runs: number;
31457
+ }[];
31458
+ };
31459
+ agent_spend_runs: {
31460
+ Args: {
31461
+ p_agent_id?: string;
31462
+ p_days?: number;
31463
+ p_mandate_key?: string;
31464
+ p_org_id?: string;
31465
+ };
31466
+ Returns: {
31467
+ agent_id: string;
31468
+ automated: boolean;
31469
+ calls: number;
31470
+ conversation_id: string;
31471
+ cost: number;
31472
+ mandate_key: string;
31473
+ models: string[];
31474
+ organization_id: string;
31475
+ organization_name: string;
31476
+ origin: string;
31477
+ person_email: string;
31478
+ person_id: string;
31479
+ request_id: string;
31480
+ run_key: string;
31481
+ saved: boolean;
31482
+ started_at: string;
31483
+ tokens_in: number;
31484
+ tokens_out: number;
31485
+ turns: number;
31486
+ }[];
31487
+ };
31394
31488
  ai_latency_filter_options: {
31395
31489
  Args: {
31396
31490
  p_from: string;
@@ -31868,6 +31962,27 @@ type Database = {
31868
31962
  };
31869
31963
  Returns: Json;
31870
31964
  };
31965
+ conversation_spend: {
31966
+ Args: {
31967
+ p_conversation_id: string;
31968
+ };
31969
+ Returns: {
31970
+ agent_id: string;
31971
+ automated: boolean;
31972
+ calls: number;
31973
+ cost: number;
31974
+ created_at: string;
31975
+ execution_id: string;
31976
+ iterations: number;
31977
+ mandate_key: string;
31978
+ model: string;
31979
+ request_id: string;
31980
+ saved: boolean;
31981
+ tokens_cached: number;
31982
+ tokens_in: number;
31983
+ tokens_out: number;
31984
+ }[];
31985
+ };
31871
31986
  count_items: {
31872
31987
  Args: {
31873
31988
  p_captured_by?: string[];
@@ -49415,6 +49530,311 @@ type Database = {
49415
49530
  [_ in never]: never;
49416
49531
  };
49417
49532
  };
49533
+ skill: {
49534
+ Tables: {
49535
+ definition: {
49536
+ Row: {
49537
+ allowed_tools: Json | null;
49538
+ body: string | null;
49539
+ category_id: string | null;
49540
+ config: Json | null;
49541
+ created_at: string;
49542
+ created_by: string | null;
49543
+ custom_fields: Json;
49544
+ deleted_at: string | null;
49545
+ description: string;
49546
+ disable_auto_invocation: boolean;
49547
+ icon_name: string | null;
49548
+ id: string;
49549
+ is_active: boolean;
49550
+ is_system: boolean;
49551
+ label: string;
49552
+ metadata: Json;
49553
+ model_preference: string | null;
49554
+ organization_id: string;
49555
+ parent_skill_id: string | null;
49556
+ platform_targets: Json | null;
49557
+ project_id: string | null;
49558
+ published_to_web: boolean;
49559
+ published_to_web_at: string | null;
49560
+ published_to_web_by: string | null;
49561
+ semver: string | null;
49562
+ shown_to: Database["platform"]["Enums"]["shown_to"] | null;
49563
+ skill_id: string;
49564
+ skill_type: Database["public"]["Enums"]["skl_skill_type"];
49565
+ sort_order: number;
49566
+ task_id: string | null;
49567
+ trigger_patterns: Json | null;
49568
+ updated_at: string;
49569
+ updated_by: string | null;
49570
+ version: number;
49571
+ visibility: Database["platform"]["Enums"]["visibility"];
49572
+ };
49573
+ Insert: {
49574
+ allowed_tools?: Json | null;
49575
+ body?: string | null;
49576
+ category_id?: string | null;
49577
+ config?: Json | null;
49578
+ created_at?: string;
49579
+ created_by?: string | null;
49580
+ custom_fields?: Json;
49581
+ deleted_at?: string | null;
49582
+ description: string;
49583
+ disable_auto_invocation?: boolean;
49584
+ icon_name?: string | null;
49585
+ id?: string;
49586
+ is_active?: boolean;
49587
+ is_system?: boolean;
49588
+ label: string;
49589
+ metadata?: Json;
49590
+ model_preference?: string | null;
49591
+ organization_id: string;
49592
+ parent_skill_id?: string | null;
49593
+ platform_targets?: Json | null;
49594
+ project_id?: string | null;
49595
+ published_to_web?: boolean;
49596
+ published_to_web_at?: string | null;
49597
+ published_to_web_by?: string | null;
49598
+ semver?: string | null;
49599
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
49600
+ skill_id: string;
49601
+ skill_type?: Database["public"]["Enums"]["skl_skill_type"];
49602
+ sort_order?: number;
49603
+ task_id?: string | null;
49604
+ trigger_patterns?: Json | null;
49605
+ updated_at?: string;
49606
+ updated_by?: string | null;
49607
+ version?: number;
49608
+ visibility?: Database["platform"]["Enums"]["visibility"];
49609
+ };
49610
+ Update: {
49611
+ allowed_tools?: Json | null;
49612
+ body?: string | null;
49613
+ category_id?: string | null;
49614
+ config?: Json | null;
49615
+ created_at?: string;
49616
+ created_by?: string | null;
49617
+ custom_fields?: Json;
49618
+ deleted_at?: string | null;
49619
+ description?: string;
49620
+ disable_auto_invocation?: boolean;
49621
+ icon_name?: string | null;
49622
+ id?: string;
49623
+ is_active?: boolean;
49624
+ is_system?: boolean;
49625
+ label?: string;
49626
+ metadata?: Json;
49627
+ model_preference?: string | null;
49628
+ organization_id?: string;
49629
+ parent_skill_id?: string | null;
49630
+ platform_targets?: Json | null;
49631
+ project_id?: string | null;
49632
+ published_to_web?: boolean;
49633
+ published_to_web_at?: string | null;
49634
+ published_to_web_by?: string | null;
49635
+ semver?: string | null;
49636
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
49637
+ skill_id?: string;
49638
+ skill_type?: Database["public"]["Enums"]["skl_skill_type"];
49639
+ sort_order?: number;
49640
+ task_id?: string | null;
49641
+ trigger_patterns?: Json | null;
49642
+ updated_at?: string;
49643
+ updated_by?: string | null;
49644
+ version?: number;
49645
+ visibility?: Database["platform"]["Enums"]["visibility"];
49646
+ };
49647
+ Relationships: [
49648
+ {
49649
+ foreignKeyName: "skl_definitions_parent_skill_id_fkey";
49650
+ columns: ["parent_skill_id"];
49651
+ isOneToOne: false;
49652
+ referencedRelation: "definition";
49653
+ referencedColumns: ["id"];
49654
+ }
49655
+ ];
49656
+ };
49657
+ render_definition: {
49658
+ Row: {
49659
+ block_id: string;
49660
+ block_type: string;
49661
+ category_id: string | null;
49662
+ created_at: string;
49663
+ created_by: string | null;
49664
+ custom_fields: Json;
49665
+ deleted_at: string | null;
49666
+ description: string | null;
49667
+ icon_name: string;
49668
+ id: string;
49669
+ is_active: boolean;
49670
+ label: string;
49671
+ metadata: Json;
49672
+ organization_id: string;
49673
+ project_id: string | null;
49674
+ published_to_web: boolean;
49675
+ published_to_web_at: string | null;
49676
+ published_to_web_by: string | null;
49677
+ shown_to: Database["platform"]["Enums"]["shown_to"] | null;
49678
+ skill_id: string | null;
49679
+ sort_order: number;
49680
+ task_id: string | null;
49681
+ template: string;
49682
+ updated_at: string;
49683
+ updated_by: string | null;
49684
+ version: number;
49685
+ visibility: Database["platform"]["Enums"]["visibility"];
49686
+ };
49687
+ Insert: {
49688
+ block_id: string;
49689
+ block_type?: string;
49690
+ category_id?: string | null;
49691
+ created_at?: string;
49692
+ created_by?: string | null;
49693
+ custom_fields?: Json;
49694
+ deleted_at?: string | null;
49695
+ description?: string | null;
49696
+ icon_name: string;
49697
+ id?: string;
49698
+ is_active?: boolean;
49699
+ label: string;
49700
+ metadata?: Json;
49701
+ organization_id: string;
49702
+ project_id?: string | null;
49703
+ published_to_web?: boolean;
49704
+ published_to_web_at?: string | null;
49705
+ published_to_web_by?: string | null;
49706
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
49707
+ skill_id?: string | null;
49708
+ sort_order?: number;
49709
+ task_id?: string | null;
49710
+ template: string;
49711
+ updated_at?: string;
49712
+ updated_by?: string | null;
49713
+ version?: number;
49714
+ visibility?: Database["platform"]["Enums"]["visibility"];
49715
+ };
49716
+ Update: {
49717
+ block_id?: string;
49718
+ block_type?: string;
49719
+ category_id?: string | null;
49720
+ created_at?: string;
49721
+ created_by?: string | null;
49722
+ custom_fields?: Json;
49723
+ deleted_at?: string | null;
49724
+ description?: string | null;
49725
+ icon_name?: string;
49726
+ id?: string;
49727
+ is_active?: boolean;
49728
+ label?: string;
49729
+ metadata?: Json;
49730
+ organization_id?: string;
49731
+ project_id?: string | null;
49732
+ published_to_web?: boolean;
49733
+ published_to_web_at?: string | null;
49734
+ published_to_web_by?: string | null;
49735
+ shown_to?: Database["platform"]["Enums"]["shown_to"] | null;
49736
+ skill_id?: string | null;
49737
+ sort_order?: number;
49738
+ task_id?: string | null;
49739
+ template?: string;
49740
+ updated_at?: string;
49741
+ updated_by?: string | null;
49742
+ version?: number;
49743
+ visibility?: Database["platform"]["Enums"]["visibility"];
49744
+ };
49745
+ Relationships: [
49746
+ {
49747
+ foreignKeyName: "skl_render_definitions_skill_id_fkey";
49748
+ columns: ["skill_id"];
49749
+ isOneToOne: false;
49750
+ referencedRelation: "definition";
49751
+ referencedColumns: ["id"];
49752
+ }
49753
+ ];
49754
+ };
49755
+ skill_detail: {
49756
+ Row: {
49757
+ allowed_tools: Json | null;
49758
+ created_at: string;
49759
+ created_by: string | null;
49760
+ custom_fields: Json;
49761
+ deleted_at: string | null;
49762
+ disable_auto_invocation: boolean;
49763
+ document_id: string;
49764
+ id: string;
49765
+ is_active: boolean;
49766
+ is_system: boolean;
49767
+ metadata: Json;
49768
+ model_preference: string | null;
49769
+ organization_id: string;
49770
+ platform_targets: Json | null;
49771
+ semver: string | null;
49772
+ skill_type: Database["public"]["Enums"]["skl_skill_type"];
49773
+ trigger_patterns: Json | null;
49774
+ updated_at: string;
49775
+ updated_by: string | null;
49776
+ version: number;
49777
+ };
49778
+ Insert: {
49779
+ allowed_tools?: Json | null;
49780
+ created_at?: string;
49781
+ created_by?: string | null;
49782
+ custom_fields?: Json;
49783
+ deleted_at?: string | null;
49784
+ disable_auto_invocation?: boolean;
49785
+ document_id: string;
49786
+ id?: string;
49787
+ is_active?: boolean;
49788
+ is_system?: boolean;
49789
+ metadata?: Json;
49790
+ model_preference?: string | null;
49791
+ organization_id: string;
49792
+ platform_targets?: Json | null;
49793
+ semver?: string | null;
49794
+ skill_type?: Database["public"]["Enums"]["skl_skill_type"];
49795
+ trigger_patterns?: Json | null;
49796
+ updated_at?: string;
49797
+ updated_by?: string | null;
49798
+ version?: number;
49799
+ };
49800
+ Update: {
49801
+ allowed_tools?: Json | null;
49802
+ created_at?: string;
49803
+ created_by?: string | null;
49804
+ custom_fields?: Json;
49805
+ deleted_at?: string | null;
49806
+ disable_auto_invocation?: boolean;
49807
+ document_id?: string;
49808
+ id?: string;
49809
+ is_active?: boolean;
49810
+ is_system?: boolean;
49811
+ metadata?: Json;
49812
+ model_preference?: string | null;
49813
+ organization_id?: string;
49814
+ platform_targets?: Json | null;
49815
+ semver?: string | null;
49816
+ skill_type?: Database["public"]["Enums"]["skl_skill_type"];
49817
+ trigger_patterns?: Json | null;
49818
+ updated_at?: string;
49819
+ updated_by?: string | null;
49820
+ version?: number;
49821
+ };
49822
+ Relationships: [];
49823
+ };
49824
+ };
49825
+ Views: {
49826
+ [_ in never]: never;
49827
+ };
49828
+ Functions: {
49829
+ [_ in never]: never;
49830
+ };
49831
+ Enums: {
49832
+ [_ in never]: never;
49833
+ };
49834
+ CompositeTypes: {
49835
+ [_ in never]: never;
49836
+ };
49837
+ };
49418
49838
  tool: {
49419
49839
  Tables: {
49420
49840
  binding: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/data",
3
- "version": "0.22.16",
3
+ "version": "0.22.17",
4
4
  "description": "The opinionated AI Matrx data layer: the /db tier's hard-won Supabase primitives — optimistic concurrency, complete-list reads, JSONB merge, session-retry, the domain-wide auth cookie, realtime channel hygiene — the /net resilience trio, and the /files lane: the Matrx file-communication client (durable-ref resolution, the mx_files_session bootstrap, authenticated blob fetch, uploads, the public-link door).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -208,5 +208,5 @@
208
208
  "test:watch": "vitest",
209
209
  "verify:tarball": "node ./scripts/verify-tarball.mjs"
210
210
  },
211
- "gitHead": "f90b972dd90c83d17d2db07d90ca3323a1f9378d"
211
+ "gitHead": "425e47eba7aeb2977899442435c1d669db809c6c"
212
212
  }