@objectstack/service-ai 7.2.1 → 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.cjs CHANGED
@@ -5792,6 +5792,82 @@ async function registerActionsAsTools(registry, context) {
5792
5792
 
5793
5793
  // src/agent-runtime.ts
5794
5794
  var import_ai7 = require("@objectstack/spec/ai");
5795
+
5796
+ // src/agents/data-chat-agent.ts
5797
+ var DEFAULT_DATA_AGENT_NAME = "data_chat";
5798
+ var DATA_CHAT_AGENT = {
5799
+ name: DEFAULT_DATA_AGENT_NAME,
5800
+ label: "Data Assistant",
5801
+ role: "Business Data Analyst",
5802
+ instructions: `You are a helpful data assistant that helps users explore and understand their business data through natural language.
5803
+
5804
+ Always answer in the same language the user is using. Detailed tool-usage guidance is supplied by the skills attached to this agent.`,
5805
+ model: {
5806
+ provider: "openai",
5807
+ model: "gpt-4",
5808
+ temperature: 0.3,
5809
+ maxTokens: 4096
5810
+ },
5811
+ // Capability bundle lives on the skill; the agent only references it.
5812
+ // `data_explorer` = read side, `actions_executor` = write side.
5813
+ skills: ["data_explorer", "actions_executor"],
5814
+ active: true,
5815
+ visibility: "global",
5816
+ guardrails: {
5817
+ maxTokensPerInvocation: 8192,
5818
+ maxExecutionTimeSec: 30,
5819
+ blockedTopics: ["delete_records", "drop_table", "alter_schema"]
5820
+ },
5821
+ planning: {
5822
+ strategy: "react",
5823
+ maxIterations: 5,
5824
+ allowReplan: false
5825
+ },
5826
+ memory: {
5827
+ shortTerm: {
5828
+ maxMessages: 20,
5829
+ maxTokens: 4096
5830
+ }
5831
+ }
5832
+ };
5833
+
5834
+ // src/agents/metadata-assistant-agent.ts
5835
+ var METADATA_ASSISTANT_AGENT = {
5836
+ name: "metadata_assistant",
5837
+ label: "Metadata Assistant",
5838
+ role: "Schema Architect",
5839
+ instructions: `You are an expert metadata architect that helps users design and manage their data models through natural language.
5840
+
5841
+ 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.`,
5842
+ model: {
5843
+ provider: "openai",
5844
+ model: "gpt-4",
5845
+ temperature: 0.2,
5846
+ maxTokens: 4096
5847
+ },
5848
+ // Capability bundle lives on the skill; the agent only references it.
5849
+ skills: ["metadata_authoring"],
5850
+ active: true,
5851
+ visibility: "global",
5852
+ guardrails: {
5853
+ maxTokensPerInvocation: 8192,
5854
+ maxExecutionTimeSec: 60,
5855
+ blockedTopics: ["drop_database", "raw_sql", "system_tables"]
5856
+ },
5857
+ planning: {
5858
+ strategy: "react",
5859
+ maxIterations: 10,
5860
+ allowReplan: true
5861
+ },
5862
+ memory: {
5863
+ shortTerm: {
5864
+ maxMessages: 30,
5865
+ maxTokens: 8192
5866
+ }
5867
+ }
5868
+ };
5869
+
5870
+ // src/agent-runtime.ts
5795
5871
  var AgentRuntime = class {
5796
5872
  constructor(metadataService, skillRegistry) {
5797
5873
  this.metadataService = metadataService;
@@ -5942,9 +6018,14 @@ var AgentRuntime = class {
5942
6018
  * chat endpoint when the client doesn't specify an `agentName`.
5943
6019
  *
5944
6020
  * Resolution order:
5945
- * 1. The `defaultAgent` of the app named by `context.appName`.
5946
- * 2. The first active agent in the registry (deterministic fallback).
5947
- * 3. `undefined` if no agents are registered.
6021
+ * 1. The `defaultAgent` of the app named by `context.appName`
6022
+ * (e.g. Studio `metadata_assistant`).
6023
+ * 2. The platform data-query agent (`data_chat`) the implicit
6024
+ * copilot bound to every app that doesn't pin its own. This is
6025
+ * what end users get by default, so they never have to choose.
6026
+ * 3. The first active agent in the registry (last-resort fallback,
6027
+ * e.g. in stripped-down deployments without the data agent).
6028
+ * 4. `undefined` if no agents are registered.
5948
6029
  */
5949
6030
  async resolveDefaultAgent(context) {
5950
6031
  if (context?.appName) {
@@ -5955,6 +6036,8 @@ var AgentRuntime = class {
5955
6036
  if (agent && agent.active !== false) return agent;
5956
6037
  }
5957
6038
  }
6039
+ const dataAgent = await this.loadAgent(DEFAULT_DATA_AGENT_NAME);
6040
+ if (dataAgent && dataAgent.active !== false) return dataAgent;
5958
6041
  const summaries = await this.listAgents();
5959
6042
  if (summaries.length === 0) return void 0;
5960
6043
  return this.loadAgent(summaries[0].name);
@@ -6150,79 +6233,6 @@ var SkillRegistry = class {
6150
6233
  }
6151
6234
  };
6152
6235
 
6153
- // src/agents/data-chat-agent.ts
6154
- var DATA_CHAT_AGENT = {
6155
- name: "data_chat",
6156
- label: "Data Assistant",
6157
- role: "Business Data Analyst",
6158
- instructions: `You are a helpful data assistant that helps users explore and understand their business data through natural language.
6159
-
6160
- Always answer in the same language the user is using. Detailed tool-usage guidance is supplied by the skills attached to this agent.`,
6161
- model: {
6162
- provider: "openai",
6163
- model: "gpt-4",
6164
- temperature: 0.3,
6165
- maxTokens: 4096
6166
- },
6167
- // Capability bundle lives on the skill; the agent only references it.
6168
- // `data_explorer` = read side, `actions_executor` = write side.
6169
- skills: ["data_explorer", "actions_executor"],
6170
- active: true,
6171
- visibility: "global",
6172
- guardrails: {
6173
- maxTokensPerInvocation: 8192,
6174
- maxExecutionTimeSec: 30,
6175
- blockedTopics: ["delete_records", "drop_table", "alter_schema"]
6176
- },
6177
- planning: {
6178
- strategy: "react",
6179
- maxIterations: 5,
6180
- allowReplan: false
6181
- },
6182
- memory: {
6183
- shortTerm: {
6184
- maxMessages: 20,
6185
- maxTokens: 4096
6186
- }
6187
- }
6188
- };
6189
-
6190
- // src/agents/metadata-assistant-agent.ts
6191
- var METADATA_ASSISTANT_AGENT = {
6192
- name: "metadata_assistant",
6193
- label: "Metadata Assistant",
6194
- role: "Schema Architect",
6195
- instructions: `You are an expert metadata architect that helps users design and manage their data models through natural language.
6196
-
6197
- 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.`,
6198
- model: {
6199
- provider: "openai",
6200
- model: "gpt-4",
6201
- temperature: 0.2,
6202
- maxTokens: 4096
6203
- },
6204
- // Capability bundle lives on the skill; the agent only references it.
6205
- skills: ["metadata_authoring"],
6206
- active: true,
6207
- visibility: "global",
6208
- guardrails: {
6209
- maxTokensPerInvocation: 8192,
6210
- maxExecutionTimeSec: 60,
6211
- blockedTopics: ["drop_database", "raw_sql", "system_tables"]
6212
- },
6213
- planning: {
6214
- strategy: "react",
6215
- maxIterations: 10,
6216
- allowReplan: true
6217
- },
6218
- memory: {
6219
- shortTerm: {
6220
- maxMessages: 30,
6221
- maxTokens: 8192
6222
- }
6223
- }
6224
- };
6225
-
6226
6236
  // src/skills/data-explorer-skill.ts
6227
6237
  var DATA_EXPLORER_SKILL = {
6228
6238
  name: "data_explorer",