@inkeep/agents-run-api 0.0.0-dev-20251111181029 → 0.0.0-dev-20251111230615

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/README.md CHANGED
@@ -44,7 +44,7 @@ pnpm db:migrate
44
44
  ```env
45
45
  ENVIRONMENT=development|production|test
46
46
  PORT=3003
47
- DB_FILE_NAME=path/to/sqlite.db
47
+ DATABASE_URL=postgresql://dbuser:secretpassword@database.server.com:3211/mydb
48
48
  ANTHROPIC_API_KEY=required
49
49
  OPENAI_API_KEY=optional
50
50
  LOG_LEVEL=debug|info|warn|error
@@ -73,7 +73,7 @@ pnpm test src/__tests__/a2a/ # Run A2A-specific tests
73
73
 
74
74
  The API uses environment-based configuration with defaults for local development. Key configuration areas:
75
75
 
76
- - **Database**: SQLite connection via `DB_FILE_NAME`
76
+ - **Database**: PostgreSQL connection via `DATABASE_URL`
77
77
  - **AI Models**: Anthropic and OpenAI API keys
78
78
  - **Observability**: OpenTelemetry tracing support
79
79
  - **CORS**: Configurable for web clients
@@ -167,7 +167,7 @@ var _NativeSandboxExecutor = class _NativeSandboxExecutor {
167
167
  poolKey,
168
168
  useCount: sandbox.useCount,
169
169
  sandboxDir: sandbox.sandboxDir,
170
- lastUsed: new Date(sandbox.lastUsed).toISOString()
170
+ lastUsed: new Date(sandbox.lastUsed)
171
171
  },
172
172
  "Reusing cached sandbox"
173
173
  );
@@ -1,4 +1,4 @@
1
- import { dbClient_default } from './chunk-TRNLEUK2.js';
1
+ import { dbClient_default } from './chunk-BYF2SHLS.js';
2
2
  import { CONVERSATION_HISTORY_DEFAULT_LIMIT } from './chunk-IVALDC72.js';
3
3
  import { CONVERSATION_HISTORY_MAX_OUTPUT_TOKENS_DEFAULT, createMessage, generateId, getConversationHistory } from '@inkeep/agents-core';
4
4
 
@@ -191,7 +191,7 @@ async function getConversationScopedArtifacts(params) {
191
191
  return [];
192
192
  }
193
193
  const { getLedgerArtifacts } = await import('@inkeep/agents-core');
194
- const dbClient = (await import('./dbClient-PLEBWGM4.js')).default;
194
+ const dbClient = (await import('./dbClient-XRZSZEYI.js')).default;
195
195
  const visibleTaskIds = visibleMessages.map((msg) => msg.taskId).filter((taskId) => Boolean(taskId));
196
196
  const referenceArtifacts = [];
197
197
  for (const taskId of visibleTaskIds) {
@@ -0,0 +1,13 @@
1
+ import { env } from './chunk-N2FZD53W.js';
2
+ import { createDatabaseClient } from '@inkeep/agents-core';
3
+
4
+ var getDbConfig = () => {
5
+ if (env.ENVIRONMENT === "test") {
6
+ return {};
7
+ }
8
+ return { connectionString: env.DATABASE_URL };
9
+ };
10
+ var dbClient = createDatabaseClient(getDbConfig());
11
+ var dbClient_default = dbClient;
12
+
13
+ export { dbClient_default };
@@ -6,9 +6,7 @@ loadEnvironmentFiles();
6
6
  var envSchema = z.object({
7
7
  NODE_ENV: z.enum(["development", "production", "test"]).optional(),
8
8
  ENVIRONMENT: z.enum(["development", "production", "pentest", "test"]).optional().default("development"),
9
- DB_FILE_NAME: z.string().optional(),
10
- TURSO_DATABASE_URL: z.string().optional(),
11
- TURSO_AUTH_TOKEN: z.string().optional(),
9
+ DATABASE_URL: z.string().optional(),
12
10
  AGENTS_RUN_API_URL: z.string().optional().default("http://localhost:3003"),
13
11
  LOG_LEVEL: z.enum(["trace", "debug", "info", "warn", "error"]).optional().default("debug"),
14
12
  NANGO_SERVER_URL: z.string().optional().default("https://api.nango.dev"),
@@ -1,4 +1,4 @@
1
- import { env } from './chunk-Z4TYO3W3.js';
1
+ import { env } from './chunk-N2FZD53W.js';
2
2
  import { getLogger } from './chunk-A2S7GSHL.js';
3
3
  import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
4
4
  import { BaggageSpanProcessor, ALLOW_ALL_BAGGAGE_KEYS } from '@opentelemetry/baggage-span-processor';
@@ -1 +1 @@
1
- export { createDefaultConversationHistoryConfig, getConversationScopedArtifacts, getFormattedConversationHistory, getFullConversationContext, getScopedHistory, getUserFacingHistory, saveA2AMessageResponse } from './chunk-6XLBN4GB.js';
1
+ export { createDefaultConversationHistoryConfig, getConversationScopedArtifacts, getFormattedConversationHistory, getFullConversationContext, getScopedHistory, getUserFacingHistory, saveA2AMessageResponse } from './chunk-54Z7AOV4.js';
@@ -0,0 +1 @@
1
+ export { dbClient_default as default } from './chunk-BYF2SHLS.js';
package/dist/index.cjs CHANGED
@@ -70,9 +70,7 @@ var init_env = __esm({
70
70
  envSchema = z7.z.object({
71
71
  NODE_ENV: z7.z.enum(["development", "production", "test"]).optional(),
72
72
  ENVIRONMENT: z7.z.enum(["development", "production", "pentest", "test"]).optional().default("development"),
73
- DB_FILE_NAME: z7.z.string().optional(),
74
- TURSO_DATABASE_URL: z7.z.string().optional(),
75
- TURSO_AUTH_TOKEN: z7.z.string().optional(),
73
+ DATABASE_URL: z7.z.string().optional(),
76
74
  AGENTS_RUN_API_URL: z7.z.string().optional().default("http://localhost:3003"),
77
75
  LOG_LEVEL: z7.z.enum(["trace", "debug", "info", "warn", "error"]).optional().default("debug"),
78
76
  NANGO_SERVER_URL: z7.z.string().optional().default("https://api.nango.dev"),
@@ -125,22 +123,9 @@ var init_dbClient = __esm({
125
123
  init_env();
126
124
  getDbConfig = () => {
127
125
  if (env.ENVIRONMENT === "test") {
128
- return { url: ":memory:" };
126
+ return {};
129
127
  }
130
- if (env.TURSO_DATABASE_URL && env.TURSO_AUTH_TOKEN) {
131
- return {
132
- url: env.TURSO_DATABASE_URL,
133
- authToken: env.TURSO_AUTH_TOKEN
134
- };
135
- }
136
- if (!env.DB_FILE_NAME) {
137
- throw new Error(
138
- "Database configuration error: DB_FILE_NAME must be set if Turso is not configured."
139
- );
140
- }
141
- return {
142
- url: env.DB_FILE_NAME
143
- };
128
+ return { connectionString: env.DATABASE_URL };
144
129
  };
145
130
  dbClient = agentsCore.createDatabaseClient(getDbConfig());
146
131
  dbClient_default = dbClient;
@@ -768,7 +753,7 @@ var init_NativeSandboxExecutor = __esm({
768
753
  poolKey,
769
754
  useCount: sandbox.useCount,
770
755
  sandboxDir: sandbox.sandboxDir,
771
- lastUsed: new Date(sandbox.lastUsed).toISOString()
756
+ lastUsed: new Date(sandbox.lastUsed)
772
757
  },
773
758
  "Reusing cached sandbox"
774
759
  );
@@ -12074,7 +12059,7 @@ var ExecutionHandler = class {
12074
12059
  "Task created with metadata"
12075
12060
  );
12076
12061
  } catch (error) {
12077
- if (error?.message?.includes("UNIQUE constraint failed") || error?.message?.includes("PRIMARY KEY constraint failed") || error?.code === "SQLITE_CONSTRAINT_PRIMARYKEY") {
12062
+ if (error?.cause?.code === "23505") {
12078
12063
  logger24.info(
12079
12064
  { taskId, error: error.message },
12080
12065
  "Task already exists, fetching existing task"
@@ -12097,7 +12082,7 @@ var ExecutionHandler = class {
12097
12082
  }
12098
12083
  logger24.debug(
12099
12084
  {
12100
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12085
+ timestamp: /* @__PURE__ */ new Date(),
12101
12086
  executionType: "create_initial_task",
12102
12087
  conversationId,
12103
12088
  agentId,
@@ -12310,7 +12295,7 @@ var ExecutionHandler = class {
12310
12295
  status: "completed",
12311
12296
  metadata: {
12312
12297
  ...task.metadata,
12313
- completed_at: (/* @__PURE__ */ new Date()).toISOString(),
12298
+ completed_at: /* @__PURE__ */ new Date(),
12314
12299
  response: {
12315
12300
  text: textContent,
12316
12301
  parts: responseParts,
@@ -12362,7 +12347,7 @@ var ExecutionHandler = class {
12362
12347
  status: "failed",
12363
12348
  metadata: {
12364
12349
  ...task.metadata,
12365
- failed_at: (/* @__PURE__ */ new Date()).toISOString(),
12350
+ failed_at: /* @__PURE__ */ new Date(),
12366
12351
  error: errorMessage2
12367
12352
  }
12368
12353
  }
@@ -12383,7 +12368,7 @@ var ExecutionHandler = class {
12383
12368
  status: "failed",
12384
12369
  metadata: {
12385
12370
  ...task.metadata,
12386
- failed_at: (/* @__PURE__ */ new Date()).toISOString(),
12371
+ failed_at: /* @__PURE__ */ new Date(),
12387
12372
  error: errorMessage
12388
12373
  }
12389
12374
  }
@@ -12405,7 +12390,7 @@ var ExecutionHandler = class {
12405
12390
  status: "failed",
12406
12391
  metadata: {
12407
12392
  ...task.metadata,
12408
- failed_at: (/* @__PURE__ */ new Date()).toISOString(),
12393
+ failed_at: /* @__PURE__ */ new Date(),
12409
12394
  error: errorMessage
12410
12395
  }
12411
12396
  }
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { flushBatchProcessor } from './chunk-DWEFKQTA.js';
2
- import { getFormattedConversationHistory, createDefaultConversationHistoryConfig, saveA2AMessageResponse } from './chunk-6XLBN4GB.js';
3
- import { dbClient_default } from './chunk-TRNLEUK2.js';
4
- import { env } from './chunk-Z4TYO3W3.js';
1
+ import { flushBatchProcessor } from './chunk-YBBSNUL3.js';
2
+ import { getFormattedConversationHistory, createDefaultConversationHistoryConfig, saveA2AMessageResponse } from './chunk-54Z7AOV4.js';
3
+ import { dbClient_default } from './chunk-BYF2SHLS.js';
4
+ import { env } from './chunk-N2FZD53W.js';
5
5
  import { getLogger } from './chunk-A2S7GSHL.js';
6
6
  import { STREAM_PARSER_MAX_SNAPSHOT_SIZE, STREAM_PARSER_MAX_STREAMED_SIZE, STREAM_PARSER_MAX_COLLECTED_PARTS, STREAM_BUFFER_MAX_SIZE_BYTES, SESSION_CLEANUP_INTERVAL_MS, STREAM_MAX_LIFETIME_MS, STREAM_TEXT_GAP_THRESHOLD_MS, AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS, SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS, ARTIFACT_GENERATION_MAX_RETRIES, ARTIFACT_SESSION_MAX_PENDING, STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS, STATUS_UPDATE_DEFAULT_NUM_EVENTS, ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES, ARTIFACT_GENERATION_BACKOFF_INITIAL_MS, ARTIFACT_GENERATION_BACKOFF_MAX_MS, AGENT_EXECUTION_MAX_GENERATION_STEPS, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_STREAMING, LLM_GENERATION_FIRST_CALL_TIMEOUT_MS_NON_STREAMING, LLM_GENERATION_SUBSEQUENT_CALL_TIMEOUT_MS, DELEGATION_TOOL_BACKOFF_MAX_ELAPSED_TIME_MS, DELEGATION_TOOL_BACKOFF_EXPONENT, DELEGATION_TOOL_BACKOFF_MAX_INTERVAL_MS, DELEGATION_TOOL_BACKOFF_INITIAL_INTERVAL_MS } from './chunk-IVALDC72.js';
7
7
  import { __publicField } from './chunk-PKBMQBKP.js';
@@ -7488,7 +7488,7 @@ var Agent = class {
7488
7488
  if (functionToolsData.length === 0) {
7489
7489
  return functionTools;
7490
7490
  }
7491
- const { SandboxExecutorFactory } = await import('./SandboxExecutorFactory-UTX25H4J.js');
7491
+ const { SandboxExecutorFactory } = await import('./SandboxExecutorFactory-D3OSN652.js');
7492
7492
  const sandboxExecutor = SandboxExecutorFactory.getInstance();
7493
7493
  for (const functionToolDef of functionToolsData) {
7494
7494
  const functionId = functionToolDef.functionId;
@@ -7782,7 +7782,7 @@ var Agent = class {
7782
7782
  inputSchema: tool3.inputSchema || tool3.parameters || {},
7783
7783
  usageGuidelines: name.startsWith("transfer_to_") || name.startsWith("delegate_to_") ? `Use this tool to ${name.startsWith("transfer_to_") ? "transfer" : "delegate"} to another agent when appropriate.` : "Use this tool when appropriate for the task at hand."
7784
7784
  }));
7785
- const { getConversationScopedArtifacts } = await import('./conversations-4VSL6EHK.js');
7785
+ const { getConversationScopedArtifacts } = await import('./conversations-ZZI6XV2G.js');
7786
7786
  const historyConfig = this.config.conversationHistoryConfig ?? createDefaultConversationHistoryConfig();
7787
7787
  const referenceArtifacts = await getConversationScopedArtifacts({
7788
7788
  tenantId: this.config.tenantId,
@@ -10364,7 +10364,7 @@ var ExecutionHandler = class {
10364
10364
  "Task created with metadata"
10365
10365
  );
10366
10366
  } catch (error) {
10367
- if (error?.message?.includes("UNIQUE constraint failed") || error?.message?.includes("PRIMARY KEY constraint failed") || error?.code === "SQLITE_CONSTRAINT_PRIMARYKEY") {
10367
+ if (error?.cause?.code === "23505") {
10368
10368
  logger20.info(
10369
10369
  { taskId, error: error.message },
10370
10370
  "Task already exists, fetching existing task"
@@ -10387,7 +10387,7 @@ var ExecutionHandler = class {
10387
10387
  }
10388
10388
  logger20.debug(
10389
10389
  {
10390
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10390
+ timestamp: /* @__PURE__ */ new Date(),
10391
10391
  executionType: "create_initial_task",
10392
10392
  conversationId,
10393
10393
  agentId,
@@ -10600,7 +10600,7 @@ var ExecutionHandler = class {
10600
10600
  status: "completed",
10601
10601
  metadata: {
10602
10602
  ...task.metadata,
10603
- completed_at: (/* @__PURE__ */ new Date()).toISOString(),
10603
+ completed_at: /* @__PURE__ */ new Date(),
10604
10604
  response: {
10605
10605
  text: textContent,
10606
10606
  parts: responseParts,
@@ -10652,7 +10652,7 @@ var ExecutionHandler = class {
10652
10652
  status: "failed",
10653
10653
  metadata: {
10654
10654
  ...task.metadata,
10655
- failed_at: (/* @__PURE__ */ new Date()).toISOString(),
10655
+ failed_at: /* @__PURE__ */ new Date(),
10656
10656
  error: errorMessage2
10657
10657
  }
10658
10658
  }
@@ -10673,7 +10673,7 @@ var ExecutionHandler = class {
10673
10673
  status: "failed",
10674
10674
  metadata: {
10675
10675
  ...task.metadata,
10676
- failed_at: (/* @__PURE__ */ new Date()).toISOString(),
10676
+ failed_at: /* @__PURE__ */ new Date(),
10677
10677
  error: errorMessage
10678
10678
  }
10679
10679
  }
@@ -10695,7 +10695,7 @@ var ExecutionHandler = class {
10695
10695
  status: "failed",
10696
10696
  metadata: {
10697
10697
  ...task.metadata,
10698
- failed_at: (/* @__PURE__ */ new Date()).toISOString(),
10698
+ failed_at: /* @__PURE__ */ new Date(),
10699
10699
  error: errorMessage
10700
10700
  }
10701
10701
  }
@@ -17,9 +17,7 @@ agentsCore.loadEnvironmentFiles();
17
17
  var envSchema = zod.z.object({
18
18
  NODE_ENV: zod.z.enum(["development", "production", "test"]).optional(),
19
19
  ENVIRONMENT: zod.z.enum(["development", "production", "pentest", "test"]).optional().default("development"),
20
- DB_FILE_NAME: zod.z.string().optional(),
21
- TURSO_DATABASE_URL: zod.z.string().optional(),
22
- TURSO_AUTH_TOKEN: zod.z.string().optional(),
20
+ DATABASE_URL: zod.z.string().optional(),
23
21
  AGENTS_RUN_API_URL: zod.z.string().optional().default("http://localhost:3003"),
24
22
  LOG_LEVEL: zod.z.enum(["trace", "debug", "info", "warn", "error"]).optional().default("debug"),
25
23
  NANGO_SERVER_URL: zod.z.string().optional().default("https://api.nango.dev"),
@@ -1 +1 @@
1
- export { defaultBatchProcessor, defaultContextManager, defaultInstrumentations, defaultResource, defaultSDK, defaultSpanProcessors, defaultTextMapPropagator, flushBatchProcessor } from './chunk-DWEFKQTA.js';
1
+ export { defaultBatchProcessor, defaultContextManager, defaultInstrumentations, defaultResource, defaultSDK, defaultSpanProcessors, defaultTextMapPropagator, flushBatchProcessor } from './chunk-YBBSNUL3.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-run-api",
3
- "version": "0.0.0-dev-20251111181029",
3
+ "version": "0.0.0-dev-20251111230615",
4
4
  "description": "Agents Run API for Inkeep Agent Framework - handles chat, agent execution, and streaming",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -45,7 +45,7 @@
45
45
  "drizzle-orm": "^0.44.4",
46
46
  "exit-hook": "^4.0.0",
47
47
  "fetch-to-node": "^2.1.0",
48
- "hono": "^4.10.3",
48
+ "hono": "^4.10.4",
49
49
  "jmespath": "^0.16.0",
50
50
  "json-schema-to-zod": "^2.6.1",
51
51
  "nanoid": "^5.1.5",
@@ -53,7 +53,7 @@
53
53
  "traverse": "^0.6.11",
54
54
  "ts-pattern": "^5.7.1",
55
55
  "zod": "4.1.5",
56
- "@inkeep/agents-core": "^0.0.0-dev-20251111181029"
56
+ "@inkeep/agents-core": "^0.0.0-dev-20251111230615"
57
57
  },
58
58
  "optionalDependencies": {
59
59
  "keytar": "^7.9.0"
@@ -72,7 +72,8 @@
72
72
  "typescript": "^5.3.3",
73
73
  "vite": "^7.1.11",
74
74
  "vite-tsconfig-paths": "^5.1.4",
75
- "vitest": "^3.2.4"
75
+ "vitest": "^3.2.4",
76
+ "@electric-sql/pglite": "^0.3.13"
76
77
  },
77
78
  "engines": {
78
79
  "node": ">=22.0.0"
@@ -1,26 +0,0 @@
1
- import { env } from './chunk-Z4TYO3W3.js';
2
- import { createDatabaseClient } from '@inkeep/agents-core';
3
-
4
- var getDbConfig = () => {
5
- if (env.ENVIRONMENT === "test") {
6
- return { url: ":memory:" };
7
- }
8
- if (env.TURSO_DATABASE_URL && env.TURSO_AUTH_TOKEN) {
9
- return {
10
- url: env.TURSO_DATABASE_URL,
11
- authToken: env.TURSO_AUTH_TOKEN
12
- };
13
- }
14
- if (!env.DB_FILE_NAME) {
15
- throw new Error(
16
- "Database configuration error: DB_FILE_NAME must be set if Turso is not configured."
17
- );
18
- }
19
- return {
20
- url: env.DB_FILE_NAME
21
- };
22
- };
23
- var dbClient = createDatabaseClient(getDbConfig());
24
- var dbClient_default = dbClient;
25
-
26
- export { dbClient_default };
@@ -1 +0,0 @@
1
- export { dbClient_default as default } from './chunk-TRNLEUK2.js';