@inkeep/agents-run-api 0.0.0-dev-20251009010805 → 0.0.0-dev-20251009070204

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
@@ -823,7 +823,9 @@ var apiKeyAuth = () => factory.createMiddleware(async (c, next) => {
823
823
  const projectId = c.req.header("x-inkeep-project-id");
824
824
  const graphId = c.req.header("x-inkeep-graph-id");
825
825
  const agentId = c.req.header("x-inkeep-agent-id");
826
- const baseUrl = new URL(c.req.url).origin;
826
+ const proto = c.req.header("x-forwarded-proto") ?? "http";
827
+ const host = c.req.header("x-forwarded-host") ?? c.req.header("host");
828
+ const baseUrl = `${proto}://${host}`;
827
829
  if (process.env.ENVIRONMENT === "development" || process.env.ENVIRONMENT === "test") {
828
830
  let executionContext;
829
831
  if (authHeader?.startsWith("Bearer ")) {
@@ -7952,7 +7954,7 @@ var Agent = class {
7952
7954
  /**
7953
7955
  * Get resolved context using ContextResolver - will return cached data or fetch fresh data as needed
7954
7956
  */
7955
- async getResolvedContext(conversationId, requestContext) {
7957
+ async getResolvedContext(conversationId, headers) {
7956
7958
  try {
7957
7959
  if (!this.config.contextConfigId) {
7958
7960
  logger19.debug({ graphId: this.config.graphId }, "No context config found for graph");
@@ -7976,7 +7978,7 @@ var Agent = class {
7976
7978
  const result = await this.contextResolver.resolve(contextConfig, {
7977
7979
  triggerEvent: "invocation",
7978
7980
  conversationId,
7979
- requestContext: requestContext || {},
7981
+ headers: headers || {},
7980
7982
  tenantId: this.config.tenantId
7981
7983
  });
7982
7984
  const contextWithBuiltins = {
@@ -10681,8 +10683,8 @@ var chatCompletionsRoute = zodOpenapi.createRoute({
10681
10683
  conversationId: z6.z.string().optional().describe("Conversation ID for multi-turn chat"),
10682
10684
  tools: z6.z.array(z6.z.string()).optional().describe("Available tools"),
10683
10685
  runConfig: z6.z.record(z6.z.string(), z6.z.unknown()).optional().describe("Run configuration"),
10684
- requestContext: z6.z.record(z6.z.string(), z6.z.unknown()).optional().describe(
10685
- "Context data for template processing (validated against context config schema)"
10686
+ headers: z6.z.record(z6.z.string(), z6.z.unknown()).optional().describe(
10687
+ "Headers data for template processing (validated against context config schema)"
10686
10688
  )
10687
10689
  })
10688
10690
  }
@@ -10840,14 +10842,14 @@ app2.openapi(chatCompletionsRoute, async (c) => {
10840
10842
  message: "Agent not found"
10841
10843
  });
10842
10844
  }
10843
- const validatedContext = c.get("validatedContext") || body.requestContext || {};
10845
+ const validatedContext = c.get("validatedContext") || body.headers || {};
10844
10846
  const credentialStores = c.get("credentialStores");
10845
10847
  await agentsCore.handleContextResolution({
10846
10848
  tenantId,
10847
10849
  projectId,
10848
10850
  graphId,
10849
10851
  conversationId,
10850
- requestContext: validatedContext,
10852
+ headers: validatedContext,
10851
10853
  dbClient: dbClient_default,
10852
10854
  credentialStores
10853
10855
  });
@@ -10860,7 +10862,7 @@ app2.openapi(chatCompletionsRoute, async (c) => {
10860
10862
  defaultAgentId,
10861
10863
  activeAgentId: activeAgent?.activeAgentId || "none",
10862
10864
  hasContextConfig: !!agentGraph.contextConfigId,
10863
- hasRequestContext: !!body.requestContext,
10865
+ hasHeaders: !!body.headers,
10864
10866
  hasValidatedContext: !!validatedContext,
10865
10867
  validatedContextKeys: Object.keys(validatedContext)
10866
10868
  },
@@ -11007,7 +11009,7 @@ var chatDataStreamRoute = zodOpenapi.createRoute({
11007
11009
  ),
11008
11010
  id: zodOpenapi.z.string().optional(),
11009
11011
  conversationId: zodOpenapi.z.string().optional(),
11010
- requestContext: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional().describe("Context data for template processing")
11012
+ headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional().describe("Headers data for template processing")
11011
11013
  })
11012
11014
  }
11013
11015
  }
@@ -11080,14 +11082,14 @@ app3.openapi(chatDataStreamRoute, async (c) => {
11080
11082
  message: "Agent not found"
11081
11083
  });
11082
11084
  }
11083
- const validatedContext = c.get("validatedContext") || body.requestContext || {};
11085
+ const validatedContext = c.get("validatedContext") || body.headers || {};
11084
11086
  const credentialStores = c.get("credentialStores");
11085
11087
  await agentsCore.handleContextResolution({
11086
11088
  tenantId,
11087
11089
  projectId,
11088
11090
  graphId,
11089
11091
  conversationId,
11090
- requestContext: validatedContext,
11092
+ headers: validatedContext,
11091
11093
  dbClient: dbClient_default,
11092
11094
  credentialStores
11093
11095
  });
@@ -11365,7 +11367,7 @@ var executeAgentQuery = async (executionContext, conversationId, query, defaultA
11365
11367
  ]
11366
11368
  };
11367
11369
  };
11368
- var getServer = async (requestContext, executionContext, conversationId, credentialStores) => {
11370
+ var getServer = async (headers, executionContext, conversationId, credentialStores) => {
11369
11371
  const { tenantId, projectId, graphId } = executionContext;
11370
11372
  setupTracing(conversationId, tenantId, graphId);
11371
11373
  const agentGraph = await agentsCore.getAgentGraphWithDefaultAgent(dbClient_default)({
@@ -11421,7 +11423,7 @@ var getServer = async (requestContext, executionContext, conversationId, credent
11421
11423
  projectId,
11422
11424
  graphId,
11423
11425
  conversationId,
11424
- requestContext,
11426
+ headers,
11425
11427
  dbClient: dbClient_default,
11426
11428
  credentialStores
11427
11429
  });
@@ -11432,7 +11434,7 @@ var getServer = async (requestContext, executionContext, conversationId, credent
11432
11434
  graphId,
11433
11435
  conversationId,
11434
11436
  hasContextConfig: !!agentGraph.contextConfigId,
11435
- hasRequestContext: !!requestContext,
11437
+ hasHeaders: !!headers,
11436
11438
  hasValidatedContext: !!resolvedContext
11437
11439
  },
11438
11440
  "parameters"
package/dist/index.js CHANGED
@@ -57,7 +57,9 @@ var apiKeyAuth = () => createMiddleware(async (c, next) => {
57
57
  const projectId = c.req.header("x-inkeep-project-id");
58
58
  const graphId = c.req.header("x-inkeep-graph-id");
59
59
  const agentId = c.req.header("x-inkeep-agent-id");
60
- const baseUrl = new URL(c.req.url).origin;
60
+ const proto = c.req.header("x-forwarded-proto") ?? "http";
61
+ const host = c.req.header("x-forwarded-host") ?? c.req.header("host");
62
+ const baseUrl = `${proto}://${host}`;
61
63
  if (process.env.ENVIRONMENT === "development" || process.env.ENVIRONMENT === "test") {
62
64
  let executionContext;
63
65
  if (authHeader?.startsWith("Bearer ")) {
@@ -7130,7 +7132,7 @@ var Agent = class {
7130
7132
  /**
7131
7133
  * Get resolved context using ContextResolver - will return cached data or fetch fresh data as needed
7132
7134
  */
7133
- async getResolvedContext(conversationId, requestContext) {
7135
+ async getResolvedContext(conversationId, headers) {
7134
7136
  try {
7135
7137
  if (!this.config.contextConfigId) {
7136
7138
  logger17.debug({ graphId: this.config.graphId }, "No context config found for graph");
@@ -7154,7 +7156,7 @@ var Agent = class {
7154
7156
  const result = await this.contextResolver.resolve(contextConfig, {
7155
7157
  triggerEvent: "invocation",
7156
7158
  conversationId,
7157
- requestContext: requestContext || {},
7159
+ headers: headers || {},
7158
7160
  tenantId: this.config.tenantId
7159
7161
  });
7160
7162
  const contextWithBuiltins = {
@@ -9844,8 +9846,8 @@ var chatCompletionsRoute = createRoute({
9844
9846
  conversationId: z.string().optional().describe("Conversation ID for multi-turn chat"),
9845
9847
  tools: z.array(z.string()).optional().describe("Available tools"),
9846
9848
  runConfig: z.record(z.string(), z.unknown()).optional().describe("Run configuration"),
9847
- requestContext: z.record(z.string(), z.unknown()).optional().describe(
9848
- "Context data for template processing (validated against context config schema)"
9849
+ headers: z.record(z.string(), z.unknown()).optional().describe(
9850
+ "Headers data for template processing (validated against context config schema)"
9849
9851
  )
9850
9852
  })
9851
9853
  }
@@ -10003,14 +10005,14 @@ app2.openapi(chatCompletionsRoute, async (c) => {
10003
10005
  message: "Agent not found"
10004
10006
  });
10005
10007
  }
10006
- const validatedContext = c.get("validatedContext") || body.requestContext || {};
10008
+ const validatedContext = c.get("validatedContext") || body.headers || {};
10007
10009
  const credentialStores = c.get("credentialStores");
10008
10010
  await handleContextResolution({
10009
10011
  tenantId,
10010
10012
  projectId,
10011
10013
  graphId,
10012
10014
  conversationId,
10013
- requestContext: validatedContext,
10015
+ headers: validatedContext,
10014
10016
  dbClient: dbClient_default,
10015
10017
  credentialStores
10016
10018
  });
@@ -10023,7 +10025,7 @@ app2.openapi(chatCompletionsRoute, async (c) => {
10023
10025
  defaultAgentId,
10024
10026
  activeAgentId: activeAgent?.activeAgentId || "none",
10025
10027
  hasContextConfig: !!agentGraph.contextConfigId,
10026
- hasRequestContext: !!body.requestContext,
10028
+ hasHeaders: !!body.headers,
10027
10029
  hasValidatedContext: !!validatedContext,
10028
10030
  validatedContextKeys: Object.keys(validatedContext)
10029
10031
  },
@@ -10166,7 +10168,7 @@ var chatDataStreamRoute = createRoute({
10166
10168
  ),
10167
10169
  id: z$1.string().optional(),
10168
10170
  conversationId: z$1.string().optional(),
10169
- requestContext: z$1.record(z$1.string(), z$1.unknown()).optional().describe("Context data for template processing")
10171
+ headers: z$1.record(z$1.string(), z$1.unknown()).optional().describe("Headers data for template processing")
10170
10172
  })
10171
10173
  }
10172
10174
  }
@@ -10239,14 +10241,14 @@ app3.openapi(chatDataStreamRoute, async (c) => {
10239
10241
  message: "Agent not found"
10240
10242
  });
10241
10243
  }
10242
- const validatedContext = c.get("validatedContext") || body.requestContext || {};
10244
+ const validatedContext = c.get("validatedContext") || body.headers || {};
10243
10245
  const credentialStores = c.get("credentialStores");
10244
10246
  await handleContextResolution({
10245
10247
  tenantId,
10246
10248
  projectId,
10247
10249
  graphId,
10248
10250
  conversationId,
10249
- requestContext: validatedContext,
10251
+ headers: validatedContext,
10250
10252
  dbClient: dbClient_default,
10251
10253
  credentialStores
10252
10254
  });
@@ -10520,7 +10522,7 @@ var executeAgentQuery = async (executionContext, conversationId, query, defaultA
10520
10522
  ]
10521
10523
  };
10522
10524
  };
10523
- var getServer = async (requestContext, executionContext, conversationId, credentialStores) => {
10525
+ var getServer = async (headers, executionContext, conversationId, credentialStores) => {
10524
10526
  const { tenantId, projectId, graphId } = executionContext;
10525
10527
  setupTracing(conversationId, tenantId, graphId);
10526
10528
  const agentGraph = await getAgentGraphWithDefaultAgent(dbClient_default)({
@@ -10576,7 +10578,7 @@ var getServer = async (requestContext, executionContext, conversationId, credent
10576
10578
  projectId,
10577
10579
  graphId,
10578
10580
  conversationId,
10579
- requestContext,
10581
+ headers,
10580
10582
  dbClient: dbClient_default,
10581
10583
  credentialStores
10582
10584
  });
@@ -10587,7 +10589,7 @@ var getServer = async (requestContext, executionContext, conversationId, credent
10587
10589
  graphId,
10588
10590
  conversationId,
10589
10591
  hasContextConfig: !!agentGraph.contextConfigId,
10590
- hasRequestContext: !!requestContext,
10592
+ hasHeaders: !!headers,
10591
10593
  hasValidatedContext: !!resolvedContext
10592
10594
  },
10593
10595
  "parameters"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-run-api",
3
- "version": "0.0.0-dev-20251009010805",
3
+ "version": "0.0.0-dev-20251009070204",
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",
@@ -51,7 +51,7 @@
51
51
  "traverse": "^0.6.11",
52
52
  "ts-pattern": "^5.7.1",
53
53
  "zod": "^4.1.11",
54
- "@inkeep/agents-core": "^0.0.0-dev-20251009010805"
54
+ "@inkeep/agents-core": "^0.0.0-dev-20251009070204"
55
55
  },
56
56
  "optionalDependencies": {
57
57
  "keytar": "^7.9.0"