@objectstack/service-ai 7.2.0 → 7.3.0

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/index.d.ts CHANGED
@@ -861,10 +861,22 @@ declare const createObjectTool: {
861
861
  requiresConfirmation: boolean;
862
862
  active: boolean;
863
863
  builtIn: boolean;
864
- category?: "action" | "flow" | "vector_search" | "data" | "utility" | "analytics" | "integration" | undefined;
864
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
865
+ _lockReason?: string | undefined;
866
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
867
+ _provenance?: "package" | "env-forced" | "org" | undefined;
868
+ _packageId?: string | undefined;
869
+ _packageVersion?: string | undefined;
870
+ _lockDocsUrl?: string | undefined;
871
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
865
872
  outputSchema?: Record<string, unknown> | undefined;
866
873
  objectName?: string | undefined;
867
874
  permissions?: string[] | undefined;
875
+ protection?: {
876
+ lock: "none" | "full" | "no-overlay" | "no-delete";
877
+ reason: string;
878
+ docsUrl?: string | undefined;
879
+ } | undefined;
868
880
  };
869
881
 
870
882
  /**
@@ -882,10 +894,22 @@ declare const addFieldTool: {
882
894
  requiresConfirmation: boolean;
883
895
  active: boolean;
884
896
  builtIn: boolean;
885
- category?: "action" | "flow" | "vector_search" | "data" | "utility" | "analytics" | "integration" | undefined;
897
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
898
+ _lockReason?: string | undefined;
899
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
900
+ _provenance?: "package" | "env-forced" | "org" | undefined;
901
+ _packageId?: string | undefined;
902
+ _packageVersion?: string | undefined;
903
+ _lockDocsUrl?: string | undefined;
904
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
886
905
  outputSchema?: Record<string, unknown> | undefined;
887
906
  objectName?: string | undefined;
888
907
  permissions?: string[] | undefined;
908
+ protection?: {
909
+ lock: "none" | "full" | "no-overlay" | "no-delete";
910
+ reason: string;
911
+ docsUrl?: string | undefined;
912
+ } | undefined;
889
913
  };
890
914
 
891
915
  /**
@@ -902,10 +926,22 @@ declare const modifyFieldTool: {
902
926
  requiresConfirmation: boolean;
903
927
  active: boolean;
904
928
  builtIn: boolean;
905
- category?: "action" | "flow" | "vector_search" | "data" | "utility" | "analytics" | "integration" | undefined;
929
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
930
+ _lockReason?: string | undefined;
931
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
932
+ _provenance?: "package" | "env-forced" | "org" | undefined;
933
+ _packageId?: string | undefined;
934
+ _packageVersion?: string | undefined;
935
+ _lockDocsUrl?: string | undefined;
936
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
906
937
  outputSchema?: Record<string, unknown> | undefined;
907
938
  objectName?: string | undefined;
908
939
  permissions?: string[] | undefined;
940
+ protection?: {
941
+ lock: "none" | "full" | "no-overlay" | "no-delete";
942
+ reason: string;
943
+ docsUrl?: string | undefined;
944
+ } | undefined;
909
945
  };
910
946
 
911
947
  /**
@@ -922,10 +958,22 @@ declare const deleteFieldTool: {
922
958
  requiresConfirmation: boolean;
923
959
  active: boolean;
924
960
  builtIn: boolean;
925
- category?: "action" | "flow" | "vector_search" | "data" | "utility" | "analytics" | "integration" | undefined;
961
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
962
+ _lockReason?: string | undefined;
963
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
964
+ _provenance?: "package" | "env-forced" | "org" | undefined;
965
+ _packageId?: string | undefined;
966
+ _packageVersion?: string | undefined;
967
+ _lockDocsUrl?: string | undefined;
968
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
926
969
  outputSchema?: Record<string, unknown> | undefined;
927
970
  objectName?: string | undefined;
928
971
  permissions?: string[] | undefined;
972
+ protection?: {
973
+ lock: "none" | "full" | "no-overlay" | "no-delete";
974
+ reason: string;
975
+ docsUrl?: string | undefined;
976
+ } | undefined;
929
977
  };
930
978
 
931
979
  /**
@@ -943,10 +991,22 @@ declare const listObjectsTool: {
943
991
  requiresConfirmation: boolean;
944
992
  active: boolean;
945
993
  builtIn: boolean;
946
- category?: "action" | "flow" | "vector_search" | "data" | "utility" | "analytics" | "integration" | undefined;
994
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
995
+ _lockReason?: string | undefined;
996
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
997
+ _provenance?: "package" | "env-forced" | "org" | undefined;
998
+ _packageId?: string | undefined;
999
+ _packageVersion?: string | undefined;
1000
+ _lockDocsUrl?: string | undefined;
1001
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
947
1002
  outputSchema?: Record<string, unknown> | undefined;
948
1003
  objectName?: string | undefined;
949
1004
  permissions?: string[] | undefined;
1005
+ protection?: {
1006
+ lock: "none" | "full" | "no-overlay" | "no-delete";
1007
+ reason: string;
1008
+ docsUrl?: string | undefined;
1009
+ } | undefined;
950
1010
  };
951
1011
 
952
1012
  /**
@@ -964,10 +1024,22 @@ declare const describeObjectTool: {
964
1024
  requiresConfirmation: boolean;
965
1025
  active: boolean;
966
1026
  builtIn: boolean;
967
- category?: "action" | "flow" | "vector_search" | "data" | "utility" | "analytics" | "integration" | undefined;
1027
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
1028
+ _lockReason?: string | undefined;
1029
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
1030
+ _provenance?: "package" | "env-forced" | "org" | undefined;
1031
+ _packageId?: string | undefined;
1032
+ _packageVersion?: string | undefined;
1033
+ _lockDocsUrl?: string | undefined;
1034
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
968
1035
  outputSchema?: Record<string, unknown> | undefined;
969
1036
  objectName?: string | undefined;
970
1037
  permissions?: string[] | undefined;
1038
+ protection?: {
1039
+ lock: "none" | "full" | "no-overlay" | "no-delete";
1040
+ reason: string;
1041
+ docsUrl?: string | undefined;
1042
+ } | undefined;
971
1043
  };
972
1044
 
973
1045
  /** All built-in metadata management tool definitions (Tool metadata). */
@@ -1068,10 +1140,22 @@ declare const listPackagesTool: {
1068
1140
  requiresConfirmation: boolean;
1069
1141
  active: boolean;
1070
1142
  builtIn: boolean;
1071
- category?: "action" | "flow" | "vector_search" | "data" | "utility" | "analytics" | "integration" | undefined;
1143
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
1144
+ _lockReason?: string | undefined;
1145
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
1146
+ _provenance?: "package" | "env-forced" | "org" | undefined;
1147
+ _packageId?: string | undefined;
1148
+ _packageVersion?: string | undefined;
1149
+ _lockDocsUrl?: string | undefined;
1150
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
1072
1151
  outputSchema?: Record<string, unknown> | undefined;
1073
1152
  objectName?: string | undefined;
1074
1153
  permissions?: string[] | undefined;
1154
+ protection?: {
1155
+ lock: "none" | "full" | "no-overlay" | "no-delete";
1156
+ reason: string;
1157
+ docsUrl?: string | undefined;
1158
+ } | undefined;
1075
1159
  };
1076
1160
 
1077
1161
  /**
@@ -1087,10 +1171,22 @@ declare const getPackageTool: {
1087
1171
  requiresConfirmation: boolean;
1088
1172
  active: boolean;
1089
1173
  builtIn: boolean;
1090
- category?: "action" | "flow" | "vector_search" | "data" | "utility" | "analytics" | "integration" | undefined;
1174
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
1175
+ _lockReason?: string | undefined;
1176
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
1177
+ _provenance?: "package" | "env-forced" | "org" | undefined;
1178
+ _packageId?: string | undefined;
1179
+ _packageVersion?: string | undefined;
1180
+ _lockDocsUrl?: string | undefined;
1181
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
1091
1182
  outputSchema?: Record<string, unknown> | undefined;
1092
1183
  objectName?: string | undefined;
1093
1184
  permissions?: string[] | undefined;
1185
+ protection?: {
1186
+ lock: "none" | "full" | "no-overlay" | "no-delete";
1187
+ reason: string;
1188
+ docsUrl?: string | undefined;
1189
+ } | undefined;
1094
1190
  };
1095
1191
 
1096
1192
  /**
@@ -1107,10 +1203,22 @@ declare const createPackageTool: {
1107
1203
  requiresConfirmation: boolean;
1108
1204
  active: boolean;
1109
1205
  builtIn: boolean;
1110
- category?: "action" | "flow" | "vector_search" | "data" | "utility" | "analytics" | "integration" | undefined;
1206
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
1207
+ _lockReason?: string | undefined;
1208
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
1209
+ _provenance?: "package" | "env-forced" | "org" | undefined;
1210
+ _packageId?: string | undefined;
1211
+ _packageVersion?: string | undefined;
1212
+ _lockDocsUrl?: string | undefined;
1213
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
1111
1214
  outputSchema?: Record<string, unknown> | undefined;
1112
1215
  objectName?: string | undefined;
1113
1216
  permissions?: string[] | undefined;
1217
+ protection?: {
1218
+ lock: "none" | "full" | "no-overlay" | "no-delete";
1219
+ reason: string;
1220
+ docsUrl?: string | undefined;
1221
+ } | undefined;
1114
1222
  };
1115
1223
 
1116
1224
  /**
@@ -1126,10 +1234,22 @@ declare const getActivePackageTool: {
1126
1234
  requiresConfirmation: boolean;
1127
1235
  active: boolean;
1128
1236
  builtIn: boolean;
1129
- category?: "action" | "flow" | "vector_search" | "data" | "utility" | "analytics" | "integration" | undefined;
1237
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
1238
+ _lockReason?: string | undefined;
1239
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
1240
+ _provenance?: "package" | "env-forced" | "org" | undefined;
1241
+ _packageId?: string | undefined;
1242
+ _packageVersion?: string | undefined;
1243
+ _lockDocsUrl?: string | undefined;
1244
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
1130
1245
  outputSchema?: Record<string, unknown> | undefined;
1131
1246
  objectName?: string | undefined;
1132
1247
  permissions?: string[] | undefined;
1248
+ protection?: {
1249
+ lock: "none" | "full" | "no-overlay" | "no-delete";
1250
+ reason: string;
1251
+ docsUrl?: string | undefined;
1252
+ } | undefined;
1133
1253
  };
1134
1254
 
1135
1255
  /**
@@ -1146,10 +1266,22 @@ declare const setActivePackageTool: {
1146
1266
  requiresConfirmation: boolean;
1147
1267
  active: boolean;
1148
1268
  builtIn: boolean;
1149
- category?: "action" | "flow" | "vector_search" | "data" | "utility" | "analytics" | "integration" | undefined;
1269
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
1270
+ _lockReason?: string | undefined;
1271
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
1272
+ _provenance?: "package" | "env-forced" | "org" | undefined;
1273
+ _packageId?: string | undefined;
1274
+ _packageVersion?: string | undefined;
1275
+ _lockDocsUrl?: string | undefined;
1276
+ category?: "action" | "flow" | "vector_search" | "data" | "utility" | "integration" | "analytics" | undefined;
1150
1277
  outputSchema?: Record<string, unknown> | undefined;
1151
1278
  objectName?: string | undefined;
1152
1279
  permissions?: string[] | undefined;
1280
+ protection?: {
1281
+ lock: "none" | "full" | "no-overlay" | "no-delete";
1282
+ reason: string;
1283
+ docsUrl?: string | undefined;
1284
+ } | undefined;
1153
1285
  };
1154
1286
 
1155
1287
  /** All built-in package management tool definitions (Tool metadata). */
@@ -1605,38 +1737,18 @@ declare class AgentRuntime {
1605
1737
  * chat endpoint when the client doesn't specify an `agentName`.
1606
1738
  *
1607
1739
  * Resolution order:
1608
- * 1. The `defaultAgent` of the app named by `context.appName`.
1609
- * 2. The first active agent in the registry (deterministic fallback).
1610
- * 3. `undefined` if no agents are registered.
1740
+ * 1. The `defaultAgent` of the app named by `context.appName`
1741
+ * (e.g. Studio `metadata_assistant`).
1742
+ * 2. The platform data-query agent (`data_chat`) the implicit
1743
+ * copilot bound to every app that doesn't pin its own. This is
1744
+ * what end users get by default, so they never have to choose.
1745
+ * 3. The first active agent in the registry (last-resort fallback,
1746
+ * e.g. in stripped-down deployments without the data agent).
1747
+ * 4. `undefined` if no agents are registered.
1611
1748
  */
1612
1749
  resolveDefaultAgent(context?: AgentChatContext): Promise<Agent | undefined>;
1613
1750
  }
1614
1751
 
1615
- /**
1616
- * Built-in `data_chat` agent — a thin **persona** record.
1617
- *
1618
- * Following the platform's metadata-driven philosophy, this agent no
1619
- * longer hardcodes the tools it can call. The capability bundle lives
1620
- * on the `data_explorer` *skill* (see `../skills/data-explorer-skill.ts`).
1621
- * The agent record is now just:
1622
- * - identity (name / label / role)
1623
- * - persona (system prompt)
1624
- * - model + safety config
1625
- * - skills attached → `skills: ['data_explorer']`
1626
- *
1627
- * To grant data-exploration powers to a different agent, just add
1628
- * `data_explorer` to its `skills[]`. To revoke globally, set the
1629
- * skill's `active: false` in metadata.
1630
- *
1631
- * @example
1632
- * ```
1633
- * POST /api/v1/ai/agents/data_chat/chat
1634
- * {
1635
- * "messages": [{ "role": "user", "content": "Show me all active accounts" }],
1636
- * "context": { "objectName": "account" }
1637
- * }
1638
- * ```
1639
- */
1640
1752
  declare const DATA_CHAT_AGENT: Agent;
1641
1753
 
1642
1754
  /**
@@ -1964,6 +2076,7 @@ declare const AiConversationObject: Omit<{
1964
2076
  _provenance?: "package" | "env-forced" | "org" | undefined;
1965
2077
  _packageId?: string | undefined;
1966
2078
  _packageVersion?: string | undefined;
2079
+ _lockDocsUrl?: string | undefined;
1967
2080
  label?: string | undefined;
1968
2081
  pluralLabel?: string | undefined;
1969
2082
  description?: string | undefined;
@@ -2353,7 +2466,7 @@ declare const AiConversationObject: Omit<{
2353
2466
  apiMethods?: ("restore" | "export" | "import" | "delete" | "purge" | "upsert" | "search" | "create" | "list" | "get" | "update" | "history" | "bulk" | "aggregate")[] | undefined;
2354
2467
  } | undefined;
2355
2468
  recordTypes?: string[] | undefined;
2356
- sharingModel?: "private" | "full" | "read" | "read_write" | undefined;
2469
+ sharingModel?: "full" | "private" | "read" | "read_write" | undefined;
2357
2470
  publicSharing?: {
2358
2471
  enabled: boolean;
2359
2472
  allowedAudiences?: ("email" | "public" | "link_only" | "signed_in")[] | undefined;
@@ -2456,6 +2569,11 @@ declare const AiConversationObject: Omit<{
2456
2569
  role?: string | undefined;
2457
2570
  } | undefined;
2458
2571
  }[] | undefined;
2572
+ protection?: {
2573
+ lock: "none" | "full" | "no-overlay" | "no-delete";
2574
+ reason: string;
2575
+ docsUrl?: string | undefined;
2576
+ } | undefined;
2459
2577
  }, "fields"> & Pick<{
2460
2578
  readonly name: "ai_conversations";
2461
2579
  readonly label: "AI Conversation";
@@ -3925,6 +4043,7 @@ declare const AiMessageObject: Omit<{
3925
4043
  _provenance?: "package" | "env-forced" | "org" | undefined;
3926
4044
  _packageId?: string | undefined;
3927
4045
  _packageVersion?: string | undefined;
4046
+ _lockDocsUrl?: string | undefined;
3928
4047
  label?: string | undefined;
3929
4048
  pluralLabel?: string | undefined;
3930
4049
  description?: string | undefined;
@@ -4314,7 +4433,7 @@ declare const AiMessageObject: Omit<{
4314
4433
  apiMethods?: ("restore" | "export" | "import" | "delete" | "purge" | "upsert" | "search" | "create" | "list" | "get" | "update" | "history" | "bulk" | "aggregate")[] | undefined;
4315
4434
  } | undefined;
4316
4435
  recordTypes?: string[] | undefined;
4317
- sharingModel?: "private" | "full" | "read" | "read_write" | undefined;
4436
+ sharingModel?: "full" | "private" | "read" | "read_write" | undefined;
4318
4437
  publicSharing?: {
4319
4438
  enabled: boolean;
4320
4439
  allowedAudiences?: ("email" | "public" | "link_only" | "signed_in")[] | undefined;
@@ -4417,6 +4536,11 @@ declare const AiMessageObject: Omit<{
4417
4536
  role?: string | undefined;
4418
4537
  } | undefined;
4419
4538
  }[] | undefined;
4539
+ protection?: {
4540
+ lock: "none" | "full" | "no-overlay" | "no-delete";
4541
+ reason: string;
4542
+ docsUrl?: string | undefined;
4543
+ } | undefined;
4420
4544
  }, "fields"> & Pick<{
4421
4545
  readonly name: "ai_messages";
4422
4546
  readonly label: "AI Message";
@@ -6758,6 +6882,7 @@ declare const AiTraceObject: Omit<{
6758
6882
  _provenance?: "package" | "env-forced" | "org" | undefined;
6759
6883
  _packageId?: string | undefined;
6760
6884
  _packageVersion?: string | undefined;
6885
+ _lockDocsUrl?: string | undefined;
6761
6886
  label?: string | undefined;
6762
6887
  pluralLabel?: string | undefined;
6763
6888
  description?: string | undefined;
@@ -7147,7 +7272,7 @@ declare const AiTraceObject: Omit<{
7147
7272
  apiMethods?: ("restore" | "export" | "import" | "delete" | "purge" | "upsert" | "search" | "create" | "list" | "get" | "update" | "history" | "bulk" | "aggregate")[] | undefined;
7148
7273
  } | undefined;
7149
7274
  recordTypes?: string[] | undefined;
7150
- sharingModel?: "private" | "full" | "read" | "read_write" | undefined;
7275
+ sharingModel?: "full" | "private" | "read" | "read_write" | undefined;
7151
7276
  publicSharing?: {
7152
7277
  enabled: boolean;
7153
7278
  allowedAudiences?: ("email" | "public" | "link_only" | "signed_in")[] | undefined;
@@ -7250,6 +7375,11 @@ declare const AiTraceObject: Omit<{
7250
7375
  role?: string | undefined;
7251
7376
  } | undefined;
7252
7377
  }[] | undefined;
7378
+ protection?: {
7379
+ lock: "none" | "full" | "no-overlay" | "no-delete";
7380
+ reason: string;
7381
+ docsUrl?: string | undefined;
7382
+ } | undefined;
7253
7383
  }, "fields"> & Pick<{
7254
7384
  readonly name: "ai_traces";
7255
7385
  readonly label: "AI Trace";
@@ -10447,6 +10577,13 @@ declare const AiTraceObject: Omit<{
10447
10577
  * automatically in Studio when AIService is loaded.
10448
10578
  */
10449
10579
  declare const AiTraceView: {
10580
+ _lock?: "none" | "full" | "no-overlay" | "no-delete" | undefined;
10581
+ _lockReason?: string | undefined;
10582
+ _lockSource?: "artifact" | "package" | "env-forced" | undefined;
10583
+ _provenance?: "package" | "env-forced" | "org" | undefined;
10584
+ _packageId?: string | undefined;
10585
+ _packageVersion?: string | undefined;
10586
+ _lockDocsUrl?: string | undefined;
10450
10587
  list?: {
10451
10588
  type: "map" | "kanban" | "calendar" | "gantt" | "gallery" | "timeline" | "chart" | "grid";
10452
10589
  columns: string[] | {
@@ -11147,6 +11284,11 @@ declare const AiTraceView: {
11147
11284
  role?: string | undefined;
11148
11285
  } | undefined;
11149
11286
  }> | undefined;
11287
+ protection?: {
11288
+ lock: "none" | "full" | "no-overlay" | "no-delete";
11289
+ reason: string;
11290
+ docsUrl?: string | undefined;
11291
+ } | undefined;
11150
11292
  };
11151
11293
 
11152
11294
  /**
package/dist/index.js CHANGED
@@ -189,6 +189,7 @@ var init_data_tools = __esm({
189
189
  DEFAULT_QUERY_LIMIT = 20;
190
190
  QUERY_RECORDS_TOOL = {
191
191
  name: "query_records",
192
+ label: "Query Records",
192
193
  description: "Query records from a data object with optional filters, field selection, sorting, and pagination. Returns an array of matching records.",
193
194
  parameters: {
194
195
  type: "object",
@@ -234,6 +235,7 @@ var init_data_tools = __esm({
234
235
  };
235
236
  GET_RECORD_TOOL = {
236
237
  name: "get_record",
238
+ label: "Get Record",
237
239
  description: "Get a single record by its ID from a data object.",
238
240
  parameters: {
239
241
  type: "object",
@@ -258,6 +260,7 @@ var init_data_tools = __esm({
258
260
  };
259
261
  AGGREGATE_DATA_TOOL = {
260
262
  name: "aggregate_data",
263
+ label: "Aggregate Data",
261
264
  description: "Perform aggregation/statistical operations on a data object. Supports count, sum, avg, min, max with optional groupBy and where filters.",
262
265
  parameters: {
263
266
  type: "object",
@@ -2305,6 +2308,7 @@ function cryptoRandomId() {
2305
2308
  }
2306
2309
 
2307
2310
  // src/plugin.ts
2311
+ import { readEnvWithDeprecation } from "@objectstack/types";
2308
2312
  import { EMBEDDER_SERVICE } from "@objectstack/spec/contracts";
2309
2313
 
2310
2314
  // src/stream/vercel-stream-encoder.ts
@@ -5194,6 +5198,7 @@ var QueryPlanSchema = z2.object({
5194
5198
  });
5195
5199
  var QUERY_DATA_TOOL = {
5196
5200
  name: "query_data",
5201
+ label: "Query Data (Natural Language)",
5197
5202
  description: "Answer a natural-language question about the user's data. Internally retrieves the relevant object schema, generates an ObjectQL query, executes it, and returns the matching records. Prefer this tool over `query_records` / `aggregate_data` when the user's intent is expressed in plain language.",
5198
5203
  parameters: {
5199
5204
  type: "object",
@@ -5713,6 +5718,82 @@ async function registerActionsAsTools(registry, context) {
5713
5718
 
5714
5719
  // src/agent-runtime.ts
5715
5720
  import { AgentSchema } from "@objectstack/spec/ai";
5721
+
5722
+ // src/agents/data-chat-agent.ts
5723
+ var DEFAULT_DATA_AGENT_NAME = "data_chat";
5724
+ var DATA_CHAT_AGENT = {
5725
+ name: DEFAULT_DATA_AGENT_NAME,
5726
+ label: "Data Assistant",
5727
+ role: "Business Data Analyst",
5728
+ instructions: `You are a helpful data assistant that helps users explore and understand their business data through natural language.
5729
+
5730
+ Always answer in the same language the user is using. Detailed tool-usage guidance is supplied by the skills attached to this agent.`,
5731
+ model: {
5732
+ provider: "openai",
5733
+ model: "gpt-4",
5734
+ temperature: 0.3,
5735
+ maxTokens: 4096
5736
+ },
5737
+ // Capability bundle lives on the skill; the agent only references it.
5738
+ // `data_explorer` = read side, `actions_executor` = write side.
5739
+ skills: ["data_explorer", "actions_executor"],
5740
+ active: true,
5741
+ visibility: "global",
5742
+ guardrails: {
5743
+ maxTokensPerInvocation: 8192,
5744
+ maxExecutionTimeSec: 30,
5745
+ blockedTopics: ["delete_records", "drop_table", "alter_schema"]
5746
+ },
5747
+ planning: {
5748
+ strategy: "react",
5749
+ maxIterations: 5,
5750
+ allowReplan: false
5751
+ },
5752
+ memory: {
5753
+ shortTerm: {
5754
+ maxMessages: 20,
5755
+ maxTokens: 4096
5756
+ }
5757
+ }
5758
+ };
5759
+
5760
+ // src/agents/metadata-assistant-agent.ts
5761
+ var METADATA_ASSISTANT_AGENT = {
5762
+ name: "metadata_assistant",
5763
+ label: "Metadata Assistant",
5764
+ role: "Schema Architect",
5765
+ instructions: `You are an expert metadata architect that helps users design and manage their data models through natural language.
5766
+
5767
+ Always answer in the same language the user is using. If the user's request is ambiguous, ask clarifying questions before proceeding. Detailed tool-usage guidance is supplied by the skills attached to this agent.`,
5768
+ model: {
5769
+ provider: "openai",
5770
+ model: "gpt-4",
5771
+ temperature: 0.2,
5772
+ maxTokens: 4096
5773
+ },
5774
+ // Capability bundle lives on the skill; the agent only references it.
5775
+ skills: ["metadata_authoring"],
5776
+ active: true,
5777
+ visibility: "global",
5778
+ guardrails: {
5779
+ maxTokensPerInvocation: 8192,
5780
+ maxExecutionTimeSec: 60,
5781
+ blockedTopics: ["drop_database", "raw_sql", "system_tables"]
5782
+ },
5783
+ planning: {
5784
+ strategy: "react",
5785
+ maxIterations: 10,
5786
+ allowReplan: true
5787
+ },
5788
+ memory: {
5789
+ shortTerm: {
5790
+ maxMessages: 30,
5791
+ maxTokens: 8192
5792
+ }
5793
+ }
5794
+ };
5795
+
5796
+ // src/agent-runtime.ts
5716
5797
  var AgentRuntime = class {
5717
5798
  constructor(metadataService, skillRegistry) {
5718
5799
  this.metadataService = metadataService;
@@ -5863,9 +5944,14 @@ var AgentRuntime = class {
5863
5944
  * chat endpoint when the client doesn't specify an `agentName`.
5864
5945
  *
5865
5946
  * Resolution order:
5866
- * 1. The `defaultAgent` of the app named by `context.appName`.
5867
- * 2. The first active agent in the registry (deterministic fallback).
5868
- * 3. `undefined` if no agents are registered.
5947
+ * 1. The `defaultAgent` of the app named by `context.appName`
5948
+ * (e.g. Studio `metadata_assistant`).
5949
+ * 2. The platform data-query agent (`data_chat`) the implicit
5950
+ * copilot bound to every app that doesn't pin its own. This is
5951
+ * what end users get by default, so they never have to choose.
5952
+ * 3. The first active agent in the registry (last-resort fallback,
5953
+ * e.g. in stripped-down deployments without the data agent).
5954
+ * 4. `undefined` if no agents are registered.
5869
5955
  */
5870
5956
  async resolveDefaultAgent(context) {
5871
5957
  if (context?.appName) {
@@ -5876,6 +5962,8 @@ var AgentRuntime = class {
5876
5962
  if (agent && agent.active !== false) return agent;
5877
5963
  }
5878
5964
  }
5965
+ const dataAgent = await this.loadAgent(DEFAULT_DATA_AGENT_NAME);
5966
+ if (dataAgent && dataAgent.active !== false) return dataAgent;
5879
5967
  const summaries = await this.listAgents();
5880
5968
  if (summaries.length === 0) return void 0;
5881
5969
  return this.loadAgent(summaries[0].name);
@@ -6071,79 +6159,6 @@ var SkillRegistry = class {
6071
6159
  }
6072
6160
  };
6073
6161
 
6074
- // src/agents/data-chat-agent.ts
6075
- var DATA_CHAT_AGENT = {
6076
- name: "data_chat",
6077
- label: "Data Assistant",
6078
- role: "Business Data Analyst",
6079
- instructions: `You are a helpful data assistant that helps users explore and understand their business data through natural language.
6080
-
6081
- Always answer in the same language the user is using. Detailed tool-usage guidance is supplied by the skills attached to this agent.`,
6082
- model: {
6083
- provider: "openai",
6084
- model: "gpt-4",
6085
- temperature: 0.3,
6086
- maxTokens: 4096
6087
- },
6088
- // Capability bundle lives on the skill; the agent only references it.
6089
- // `data_explorer` = read side, `actions_executor` = write side.
6090
- skills: ["data_explorer", "actions_executor"],
6091
- active: true,
6092
- visibility: "global",
6093
- guardrails: {
6094
- maxTokensPerInvocation: 8192,
6095
- maxExecutionTimeSec: 30,
6096
- blockedTopics: ["delete_records", "drop_table", "alter_schema"]
6097
- },
6098
- planning: {
6099
- strategy: "react",
6100
- maxIterations: 5,
6101
- allowReplan: false
6102
- },
6103
- memory: {
6104
- shortTerm: {
6105
- maxMessages: 20,
6106
- maxTokens: 4096
6107
- }
6108
- }
6109
- };
6110
-
6111
- // src/agents/metadata-assistant-agent.ts
6112
- var METADATA_ASSISTANT_AGENT = {
6113
- name: "metadata_assistant",
6114
- label: "Metadata Assistant",
6115
- role: "Schema Architect",
6116
- instructions: `You are an expert metadata architect that helps users design and manage their data models through natural language.
6117
-
6118
- Always answer in the same language the user is using. If the user's request is ambiguous, ask clarifying questions before proceeding. Detailed tool-usage guidance is supplied by the skills attached to this agent.`,
6119
- model: {
6120
- provider: "openai",
6121
- model: "gpt-4",
6122
- temperature: 0.2,
6123
- maxTokens: 4096
6124
- },
6125
- // Capability bundle lives on the skill; the agent only references it.
6126
- skills: ["metadata_authoring"],
6127
- active: true,
6128
- visibility: "global",
6129
- guardrails: {
6130
- maxTokensPerInvocation: 8192,
6131
- maxExecutionTimeSec: 60,
6132
- blockedTopics: ["drop_database", "raw_sql", "system_tables"]
6133
- },
6134
- planning: {
6135
- strategy: "react",
6136
- maxIterations: 10,
6137
- allowReplan: true
6138
- },
6139
- memory: {
6140
- shortTerm: {
6141
- maxMessages: 30,
6142
- maxTokens: 8192
6143
- }
6144
- }
6145
- };
6146
-
6147
6162
  // src/skills/data-explorer-skill.ts
6148
6163
  var DATA_EXPLORER_SKILL = {
6149
6164
  name: "data_explorer",
@@ -6710,7 +6725,7 @@ var _AIServicePlugin = class _AIServicePlugin {
6710
6725
  );
6711
6726
  const provider = mod[factory] ?? mod.default;
6712
6727
  if (typeof provider === "function") {
6713
- const modelId = process.env.AI_MODEL ?? defaultModel;
6728
+ const modelId = readEnvWithDeprecation("OS_AI_MODEL", "AI_MODEL") ?? defaultModel;
6714
6729
  const useChatApi = factory === "openai" && typeof provider.chat === "function";
6715
6730
  const model = useChatApi ? provider.chat(modelId) : provider(modelId);
6716
6731
  const adapter = new VercelLLMAdapter({ model });
@@ -6803,7 +6818,7 @@ var _AIServicePlugin = class _AIServicePlugin {
6803
6818
  name: "AI Service",
6804
6819
  version: "1.0.0",
6805
6820
  type: "plugin",
6806
- scope: "project",
6821
+ scope: "system",
6807
6822
  namespace: "ai",
6808
6823
  objects: [AiConversationObject, AiMessageObject, AiTraceObject, AiPendingActionObject, AiEvalCaseObject, AiEvalRunObject],
6809
6824
  views: [AiTraceView, AiMessageView, AiPendingActionView, AiEvalCaseView, AiEvalRunView]
@@ -6906,7 +6921,8 @@ var _AIServicePlugin = class _AIServicePlugin {
6906
6921
  }
6907
6922
  if (!toolExists) {
6908
6923
  try {
6909
- await withTimeout(metadataService.register("tool", toolDef.name, toolDef));
6924
+ const label = toolDef.label ?? toToolLabel(toolDef.name);
6925
+ await withTimeout(metadataService.register("tool", toolDef.name, { ...toolDef, label }));
6910
6926
  } catch (err) {
6911
6927
  ctx.logger.warn(
6912
6928
  "[AI] Failed to persist tool metadata (non-fatal)",
@@ -7324,6 +7340,9 @@ _AIServicePlugin.OPENAI_COMPATIBLE_PRESETS = {
7324
7340
  openrouter: { baseURL: "https://openrouter.ai/api/v1", defaultModel: "openai/gpt-4o-mini" }
7325
7341
  };
7326
7342
  var AIServicePlugin = _AIServicePlugin;
7343
+ function toToolLabel(name) {
7344
+ return name.split("_").filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
7345
+ }
7327
7346
  function extractOverrides(payload) {
7328
7347
  if (!payload || typeof payload !== "object") return {};
7329
7348
  const p = payload;