@inkeep/agents-run-api 0.0.0-dev-20251203000036 → 0.0.0-dev-20251208172520

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defaultSDK, flushBatchProcessor } from './chunk-UC2EPLSW.js';
2
- import { getFormattedConversationHistory, createDefaultConversationHistoryConfig, saveA2AMessageResponse } from './chunk-4PN6SRDA.js';
3
- import { dbClient_default } from './chunk-NCTCH6YU.js';
2
+ import { getFormattedConversationHistory, createDefaultConversationHistoryConfig, saveA2AMessageResponse } from './chunk-KCJWSIDZ.js';
3
+ import { dbClient_default } from './chunk-EVOISBFH.js';
4
4
  import { env } from './chunk-KBZIYCPJ.js';
5
5
  import { getLogger } from './chunk-A2S7GSHL.js';
6
6
  import { SESSION_CLEANUP_INTERVAL_MS, AGENT_EXECUTION_MAX_CONSECUTIVE_ERRORS, SESSION_TOOL_RESULT_CACHE_TIMEOUT_MS, STREAM_MAX_LIFETIME_MS, STREAM_BUFFER_MAX_SIZE_BYTES, STREAM_TEXT_GAP_THRESHOLD_MS, ARTIFACT_GENERATION_MAX_RETRIES, ARTIFACT_SESSION_MAX_PENDING, STATUS_UPDATE_DEFAULT_INTERVAL_SECONDS, STATUS_UPDATE_DEFAULT_NUM_EVENTS, ARTIFACT_SESSION_MAX_PREVIOUS_SUMMARIES, AGENT_EXECUTION_MAX_GENERATION_STEPS, FUNCTION_TOOL_SANDBOX_VCPUS_DEFAULT, FUNCTION_TOOL_EXECUTION_TIMEOUT_MS_DEFAULT, LLM_GENERATION_MAX_ALLOWED_TIMEOUT_MS, ARTIFACT_GENERATION_BACKOFF_INITIAL_MS, ARTIFACT_GENERATION_BACKOFF_MAX_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, STREAM_PARSER_MAX_SNAPSHOT_SIZE, STREAM_PARSER_MAX_STREAMED_SIZE, STREAM_PARSER_MAX_COLLECTED_PARTS } from './chunk-THWNUGWP.js';
@@ -2659,13 +2659,30 @@ var AgentSession = class {
2659
2659
  /**
2660
2660
  * Clean up status update resources when session ends
2661
2661
  */
2662
- cleanup() {
2662
+ async cleanup() {
2663
2663
  this.isEnded = true;
2664
2664
  if (this.statusUpdateTimer) {
2665
2665
  clearInterval(this.statusUpdateTimer);
2666
2666
  this.statusUpdateTimer = void 0;
2667
2667
  }
2668
2668
  this.statusUpdateState = void 0;
2669
+ if (this.pendingArtifacts.size > 0) {
2670
+ const maxWaitTime = 1e4;
2671
+ const startTime = Date.now();
2672
+ while (this.pendingArtifacts.size > 0 && Date.now() - startTime < maxWaitTime) {
2673
+ await new Promise((resolve) => setTimeout(resolve, 100));
2674
+ }
2675
+ if (this.pendingArtifacts.size > 0) {
2676
+ logger7.warn(
2677
+ {
2678
+ sessionId: this.sessionId,
2679
+ pendingCount: this.pendingArtifacts.size,
2680
+ pendingIds: Array.from(this.pendingArtifacts)
2681
+ },
2682
+ "Cleanup proceeding with pending artifacts still processing"
2683
+ );
2684
+ }
2685
+ }
2669
2686
  this.pendingArtifacts.clear();
2670
2687
  this.artifactProcessingErrors.clear();
2671
2688
  this.artifactCache.clear();
@@ -3440,6 +3457,9 @@ Make it specific and relevant.`;
3440
3457
  result = object;
3441
3458
  }
3442
3459
  try {
3460
+ if (!this.artifactService) {
3461
+ throw new Error("ArtifactService is not initialized");
3462
+ }
3443
3463
  await this.artifactService.saveArtifact({
3444
3464
  artifactId: artifactData.artifactId,
3445
3465
  name: result.name,
@@ -3629,7 +3649,7 @@ var AgentSessionManager = class {
3629
3649
  /**
3630
3650
  * End a session and return the final event data
3631
3651
  */
3632
- endSession(sessionId) {
3652
+ async endSession(sessionId) {
3633
3653
  const session = this.sessions.get(sessionId);
3634
3654
  if (!session) {
3635
3655
  logger7.warn({ sessionId }, "Attempted to end non-existent session");
@@ -3638,7 +3658,7 @@ var AgentSessionManager = class {
3638
3658
  const events = session.getEvents();
3639
3659
  const summary = session.getSummary();
3640
3660
  logger7.info({ sessionId, summary }, "AgentSession ended");
3641
- session.cleanup();
3661
+ await session.cleanup();
3642
3662
  this.sessions.delete(sessionId);
3643
3663
  return events;
3644
3664
  }
@@ -6253,6 +6273,8 @@ THE details PROPERTY MUST CONTAIN JMESPATH SELECTORS THAT EXTRACT DATA FROM THE
6253
6273
  \u274C NEVER: [?text ~ contains(@, 'word')] (~ with @ operator)
6254
6274
  \u274C NEVER: contains(@, 'text') (@ operator usage)
6255
6275
  \u274C NEVER: [?field=="value"] (double quotes in filters)
6276
+ \u274C NEVER: [?field=='value'] (escaped quotes in filters)
6277
+ \u274C NEVER: [?field=='"'"'value'"'"'] (nightmare quote mixing)
6256
6278
  \u274C NEVER: result.items[?type=='doc'][?status=='active'] (chained filters)
6257
6279
 
6258
6280
  \u2705 CORRECT JMESPATH SYNTAX:
@@ -6264,6 +6286,11 @@ THE details PROPERTY MUST CONTAIN JMESPATH SELECTORS THAT EXTRACT DATA FROM THE
6264
6286
  \u2705 [?contains(text, 'Founder')] (contains haystack, needle format)
6265
6287
  \u2705 source.content[?contains(text, 'Founder')].text (correct filter usage)
6266
6288
 
6289
+ \u{1F6A8} MANDATORY QUOTE PATTERN - FOLLOW EXACTLY:
6290
+ - ALWAYS: base="path[?field=='value']" (double quotes outside, single inside)
6291
+ - This is the ONLY allowed pattern - any other pattern WILL FAIL
6292
+ - NEVER escape quotes, NEVER mix quote types, NEVER use complex quoting
6293
+
6267
6294
  \u{1F6A8} CRITICAL: EXAMINE TOOL RESULTS BEFORE CREATING SELECTORS! \u{1F6A8}
6268
6295
 
6269
6296
  STEP 1: INSPECT THE ACTUAL DATA FIRST
@@ -6302,7 +6329,7 @@ Only use artifact:ref when you need to cite the SAME artifact again for a differ
6302
6329
  Format: <artifact:ref id="artifact-id" tool="tool_call_id" />
6303
6330
 
6304
6331
  EXAMPLE TEXT RESPONSE:
6305
- "I found the authentication documentation. <artifact:create id='auth-doc-1' tool='call_xyz789' type='APIDoc' base='result.documents[?type=="auth"]' details='{"title":"metadata.title","endpoint":"api.endpoint","description":"content.description","parameters":"spec.parameters","examples":"examples.sample_code"}' /> The documentation explains OAuth 2.0 implementation in detail.
6332
+ "I found the authentication documentation. <artifact:create id='auth-doc-1' tool='call_xyz789' type='APIDoc' base="result.documents[?type=='auth']" details='{"title":"metadata.title","endpoint":"api.endpoint","description":"content.description","parameters":"spec.parameters","examples":"examples.sample_code"}' /> The documentation explains OAuth 2.0 implementation in detail.
6306
6333
 
6307
6334
  The process involves three main steps: registration, token exchange, and API calls. As mentioned in the authentication documentation <artifact:ref id='auth-doc-1' tool='call_xyz789' />, you'll need to register your application first."
6308
6335
 
@@ -7983,7 +8010,7 @@ var Agent = class {
7983
8010
  inputSchema: tool3.inputSchema || tool3.parameters || {},
7984
8011
  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."
7985
8012
  }));
7986
- const { getConversationScopedArtifacts } = await import('./conversations-UAU7DKRQ.js');
8013
+ const { getConversationScopedArtifacts } = await import('./conversations-XPSTWUMK.js');
7987
8014
  const historyConfig = this.config.conversationHistoryConfig ?? createDefaultConversationHistoryConfig();
7988
8015
  const referenceArtifacts = await getConversationScopedArtifacts({
7989
8016
  tenantId: this.config.tenantId,
@@ -10742,7 +10769,7 @@ var ExecutionHandler = class {
10742
10769
  }
10743
10770
  });
10744
10771
  }
10745
- agentSessionManager.endSession(requestId2);
10772
+ await agentSessionManager.endSession(requestId2);
10746
10773
  unregisterStreamHelper(requestId2);
10747
10774
  return { success: false, error: errorMessage2, iterations };
10748
10775
  }
@@ -10883,7 +10910,7 @@ var ExecutionHandler = class {
10883
10910
  await sseHelper.writeOperation(completionOp(currentAgentId, iterations));
10884
10911
  await sseHelper.complete();
10885
10912
  logger20.info({}, "Ending AgentSession and cleaning up");
10886
- agentSessionManager.endSession(requestId2);
10913
+ await agentSessionManager.endSession(requestId2);
10887
10914
  logger20.info({}, "Cleaning up streamHelper");
10888
10915
  unregisterStreamHelper(requestId2);
10889
10916
  let response;
@@ -10923,7 +10950,7 @@ var ExecutionHandler = class {
10923
10950
  }
10924
10951
  });
10925
10952
  }
10926
- agentSessionManager.endSession(requestId2);
10953
+ await agentSessionManager.endSession(requestId2);
10927
10954
  unregisterStreamHelper(requestId2);
10928
10955
  return { success: false, error: errorMessage2, iterations };
10929
10956
  }
@@ -10944,7 +10971,7 @@ var ExecutionHandler = class {
10944
10971
  }
10945
10972
  });
10946
10973
  }
10947
- agentSessionManager.endSession(requestId2);
10974
+ await agentSessionManager.endSession(requestId2);
10948
10975
  unregisterStreamHelper(requestId2);
10949
10976
  return { success: false, error: errorMessage, iterations };
10950
10977
  } catch (error) {
@@ -10966,7 +10993,7 @@ var ExecutionHandler = class {
10966
10993
  }
10967
10994
  });
10968
10995
  }
10969
- agentSessionManager.endSession(requestId2);
10996
+ await agentSessionManager.endSession(requestId2);
10970
10997
  unregisterStreamHelper(requestId2);
10971
10998
  return { success: false, error: errorMessage, iterations };
10972
10999
  }
@@ -1,4 +1,4 @@
1
- import { u, ur, C } from './chunk-SBJLXGYG.js';
1
+ import { u, ur, C } from './chunk-JCVMVG3J.js';
2
2
  import * as s from 'fs';
3
3
  import * as o from 'path';
4
4
 
@@ -1,6 +1,6 @@
1
- import { u, cr, R, T, h, x, U, pr } from './chunk-SBJLXGYG.js';
1
+ import { u, cr, R, T, h, x, U, pr } from './chunk-JCVMVG3J.js';
2
2
 
3
- // ../node_modules/.pnpm/@electric-sql+pglite@0.3.13/node_modules/@electric-sql/pglite/dist/fs/opfs-ahp.js
3
+ // ../node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/fs/opfs-ahp.js
4
4
  u();
5
5
  var $ = "state.txt";
6
6
  var G = "data";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-run-api",
3
- "version": "0.0.0-dev-20251203000036",
3
+ "version": "0.0.0-dev-20251208172520",
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",
@@ -53,7 +53,7 @@
53
53
  "pino": "^9.11.0",
54
54
  "traverse": "^0.6.11",
55
55
  "ts-pattern": "^5.7.1",
56
- "@inkeep/agents-core": "^0.0.0-dev-20251203000036"
56
+ "@inkeep/agents-core": "^0.0.0-dev-20251208172520"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@hono/zod-openapi": "^1.1.5",
@@ -1 +0,0 @@
1
- export { dbClient_default as default } from './chunk-NCTCH6YU.js';