@inkeep/agents-core 0.0.0-dev-20250930193726 → 0.0.0-dev-20250930194428
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 +56 -64
- package/dist/index.js +56 -64
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9046,7 +9046,42 @@ var ContextResolver = class {
|
|
|
9046
9046
|
* Resolve a single context variable
|
|
9047
9047
|
*/
|
|
9048
9048
|
async resolveSingleFetchDefinition(contextConfig2, definition, templateKey, options, requestHash, result) {
|
|
9049
|
-
|
|
9049
|
+
const cachedEntry = await this.cache.get({
|
|
9050
|
+
conversationId: options.conversationId,
|
|
9051
|
+
contextConfigId: contextConfig2.id,
|
|
9052
|
+
contextVariableKey: templateKey,
|
|
9053
|
+
requestHash
|
|
9054
|
+
});
|
|
9055
|
+
if (cachedEntry) {
|
|
9056
|
+
result.resolvedContext[templateKey] = cachedEntry.value;
|
|
9057
|
+
result.cacheHits.push(definition.id);
|
|
9058
|
+
logger7.debug(
|
|
9059
|
+
{
|
|
9060
|
+
definitionId: definition.id,
|
|
9061
|
+
templateKey,
|
|
9062
|
+
conversationId: options.conversationId
|
|
9063
|
+
},
|
|
9064
|
+
"Cache hit for context variable"
|
|
9065
|
+
);
|
|
9066
|
+
return;
|
|
9067
|
+
}
|
|
9068
|
+
result.cacheMisses.push(definition.id);
|
|
9069
|
+
logger7.debug(
|
|
9070
|
+
{
|
|
9071
|
+
definitionId: definition.id,
|
|
9072
|
+
templateKey,
|
|
9073
|
+
conversationId: options.conversationId
|
|
9074
|
+
},
|
|
9075
|
+
"Cache miss for context variable, fetching data"
|
|
9076
|
+
);
|
|
9077
|
+
const definitionWithConversationId = {
|
|
9078
|
+
...definition,
|
|
9079
|
+
fetchConfig: {
|
|
9080
|
+
...definition.fetchConfig,
|
|
9081
|
+
conversationId: options.conversationId
|
|
9082
|
+
}
|
|
9083
|
+
};
|
|
9084
|
+
const fetchedData = await tracer.startActiveSpan(
|
|
9050
9085
|
"context-resolver.resolve_single_fetch_definition",
|
|
9051
9086
|
{
|
|
9052
9087
|
attributes: {
|
|
@@ -9059,78 +9094,17 @@ var ContextResolver = class {
|
|
|
9059
9094
|
},
|
|
9060
9095
|
async (parentSpan) => {
|
|
9061
9096
|
try {
|
|
9062
|
-
const
|
|
9063
|
-
conversationId: options.conversationId,
|
|
9064
|
-
contextConfigId: contextConfig2.id,
|
|
9065
|
-
contextVariableKey: templateKey,
|
|
9066
|
-
requestHash
|
|
9067
|
-
});
|
|
9068
|
-
if (cachedEntry) {
|
|
9069
|
-
result.resolvedContext[templateKey] = cachedEntry.value;
|
|
9070
|
-
result.cacheHits.push(definition.id);
|
|
9071
|
-
parentSpan.setStatus({ code: api.SpanStatusCode.OK });
|
|
9072
|
-
parentSpan.addEvent("context.cache_hit", {
|
|
9073
|
-
definition_id: definition.id,
|
|
9074
|
-
template_key: templateKey
|
|
9075
|
-
});
|
|
9076
|
-
logger7.debug(
|
|
9077
|
-
{
|
|
9078
|
-
definitionId: definition.id,
|
|
9079
|
-
templateKey,
|
|
9080
|
-
conversationId: options.conversationId
|
|
9081
|
-
},
|
|
9082
|
-
"Cache hit for context variable"
|
|
9083
|
-
);
|
|
9084
|
-
return;
|
|
9085
|
-
}
|
|
9086
|
-
result.cacheMisses.push(definition.id);
|
|
9087
|
-
parentSpan.addEvent("context.cache_miss", {
|
|
9088
|
-
definition_id: definition.id,
|
|
9089
|
-
template_key: templateKey
|
|
9090
|
-
});
|
|
9091
|
-
logger7.debug(
|
|
9092
|
-
{
|
|
9093
|
-
definitionId: definition.id,
|
|
9094
|
-
templateKey,
|
|
9095
|
-
conversationId: options.conversationId
|
|
9096
|
-
},
|
|
9097
|
-
"Cache miss for context variable, fetching data"
|
|
9098
|
-
);
|
|
9099
|
-
const definitionWithConversationId = {
|
|
9100
|
-
...definition,
|
|
9101
|
-
fetchConfig: {
|
|
9102
|
-
...definition.fetchConfig,
|
|
9103
|
-
conversationId: options.conversationId
|
|
9104
|
-
}
|
|
9105
|
-
};
|
|
9106
|
-
const fetchedData = await this.fetcher.fetch(
|
|
9097
|
+
const data = await this.fetcher.fetch(
|
|
9107
9098
|
definitionWithConversationId,
|
|
9108
9099
|
result.resolvedContext
|
|
9109
9100
|
);
|
|
9110
|
-
result.resolvedContext[templateKey] = fetchedData;
|
|
9111
|
-
result.fetchedDefinitions.push(definition.id);
|
|
9112
|
-
await this.cache.set({
|
|
9113
|
-
contextConfigId: contextConfig2.id,
|
|
9114
|
-
contextVariableKey: templateKey,
|
|
9115
|
-
conversationId: options.conversationId,
|
|
9116
|
-
value: fetchedData,
|
|
9117
|
-
requestHash,
|
|
9118
|
-
tenantId: this.tenantId
|
|
9119
|
-
});
|
|
9120
9101
|
parentSpan.setStatus({ code: api.SpanStatusCode.OK });
|
|
9121
9102
|
parentSpan.addEvent("context.fetch_success", {
|
|
9122
9103
|
definition_id: definition.id,
|
|
9123
9104
|
template_key: templateKey,
|
|
9124
9105
|
source: definition.fetchConfig.url
|
|
9125
9106
|
});
|
|
9126
|
-
|
|
9127
|
-
{
|
|
9128
|
-
definitionId: definition.id,
|
|
9129
|
-
templateKey,
|
|
9130
|
-
conversationId: options.conversationId
|
|
9131
|
-
},
|
|
9132
|
-
"Context variable resolved and cached"
|
|
9133
|
-
);
|
|
9107
|
+
return data;
|
|
9134
9108
|
} catch (error) {
|
|
9135
9109
|
setSpanWithError(parentSpan, error);
|
|
9136
9110
|
throw error;
|
|
@@ -9139,6 +9113,24 @@ var ContextResolver = class {
|
|
|
9139
9113
|
}
|
|
9140
9114
|
}
|
|
9141
9115
|
);
|
|
9116
|
+
result.resolvedContext[templateKey] = fetchedData;
|
|
9117
|
+
result.fetchedDefinitions.push(definition.id);
|
|
9118
|
+
await this.cache.set({
|
|
9119
|
+
contextConfigId: contextConfig2.id,
|
|
9120
|
+
contextVariableKey: templateKey,
|
|
9121
|
+
conversationId: options.conversationId,
|
|
9122
|
+
value: fetchedData,
|
|
9123
|
+
requestHash,
|
|
9124
|
+
tenantId: this.tenantId
|
|
9125
|
+
});
|
|
9126
|
+
logger7.debug(
|
|
9127
|
+
{
|
|
9128
|
+
definitionId: definition.id,
|
|
9129
|
+
templateKey,
|
|
9130
|
+
conversationId: options.conversationId
|
|
9131
|
+
},
|
|
9132
|
+
"Context variable resolved and cached"
|
|
9133
|
+
);
|
|
9142
9134
|
}
|
|
9143
9135
|
/**
|
|
9144
9136
|
* Resolve the request context for a given conversation
|
package/dist/index.js
CHANGED
|
@@ -7307,7 +7307,42 @@ var ContextResolver = class {
|
|
|
7307
7307
|
* Resolve a single context variable
|
|
7308
7308
|
*/
|
|
7309
7309
|
async resolveSingleFetchDefinition(contextConfig2, definition, templateKey, options, requestHash, result) {
|
|
7310
|
-
|
|
7310
|
+
const cachedEntry = await this.cache.get({
|
|
7311
|
+
conversationId: options.conversationId,
|
|
7312
|
+
contextConfigId: contextConfig2.id,
|
|
7313
|
+
contextVariableKey: templateKey,
|
|
7314
|
+
requestHash
|
|
7315
|
+
});
|
|
7316
|
+
if (cachedEntry) {
|
|
7317
|
+
result.resolvedContext[templateKey] = cachedEntry.value;
|
|
7318
|
+
result.cacheHits.push(definition.id);
|
|
7319
|
+
logger7.debug(
|
|
7320
|
+
{
|
|
7321
|
+
definitionId: definition.id,
|
|
7322
|
+
templateKey,
|
|
7323
|
+
conversationId: options.conversationId
|
|
7324
|
+
},
|
|
7325
|
+
"Cache hit for context variable"
|
|
7326
|
+
);
|
|
7327
|
+
return;
|
|
7328
|
+
}
|
|
7329
|
+
result.cacheMisses.push(definition.id);
|
|
7330
|
+
logger7.debug(
|
|
7331
|
+
{
|
|
7332
|
+
definitionId: definition.id,
|
|
7333
|
+
templateKey,
|
|
7334
|
+
conversationId: options.conversationId
|
|
7335
|
+
},
|
|
7336
|
+
"Cache miss for context variable, fetching data"
|
|
7337
|
+
);
|
|
7338
|
+
const definitionWithConversationId = {
|
|
7339
|
+
...definition,
|
|
7340
|
+
fetchConfig: {
|
|
7341
|
+
...definition.fetchConfig,
|
|
7342
|
+
conversationId: options.conversationId
|
|
7343
|
+
}
|
|
7344
|
+
};
|
|
7345
|
+
const fetchedData = await tracer.startActiveSpan(
|
|
7311
7346
|
"context-resolver.resolve_single_fetch_definition",
|
|
7312
7347
|
{
|
|
7313
7348
|
attributes: {
|
|
@@ -7320,78 +7355,17 @@ var ContextResolver = class {
|
|
|
7320
7355
|
},
|
|
7321
7356
|
async (parentSpan) => {
|
|
7322
7357
|
try {
|
|
7323
|
-
const
|
|
7324
|
-
conversationId: options.conversationId,
|
|
7325
|
-
contextConfigId: contextConfig2.id,
|
|
7326
|
-
contextVariableKey: templateKey,
|
|
7327
|
-
requestHash
|
|
7328
|
-
});
|
|
7329
|
-
if (cachedEntry) {
|
|
7330
|
-
result.resolvedContext[templateKey] = cachedEntry.value;
|
|
7331
|
-
result.cacheHits.push(definition.id);
|
|
7332
|
-
parentSpan.setStatus({ code: SpanStatusCode.OK });
|
|
7333
|
-
parentSpan.addEvent("context.cache_hit", {
|
|
7334
|
-
definition_id: definition.id,
|
|
7335
|
-
template_key: templateKey
|
|
7336
|
-
});
|
|
7337
|
-
logger7.debug(
|
|
7338
|
-
{
|
|
7339
|
-
definitionId: definition.id,
|
|
7340
|
-
templateKey,
|
|
7341
|
-
conversationId: options.conversationId
|
|
7342
|
-
},
|
|
7343
|
-
"Cache hit for context variable"
|
|
7344
|
-
);
|
|
7345
|
-
return;
|
|
7346
|
-
}
|
|
7347
|
-
result.cacheMisses.push(definition.id);
|
|
7348
|
-
parentSpan.addEvent("context.cache_miss", {
|
|
7349
|
-
definition_id: definition.id,
|
|
7350
|
-
template_key: templateKey
|
|
7351
|
-
});
|
|
7352
|
-
logger7.debug(
|
|
7353
|
-
{
|
|
7354
|
-
definitionId: definition.id,
|
|
7355
|
-
templateKey,
|
|
7356
|
-
conversationId: options.conversationId
|
|
7357
|
-
},
|
|
7358
|
-
"Cache miss for context variable, fetching data"
|
|
7359
|
-
);
|
|
7360
|
-
const definitionWithConversationId = {
|
|
7361
|
-
...definition,
|
|
7362
|
-
fetchConfig: {
|
|
7363
|
-
...definition.fetchConfig,
|
|
7364
|
-
conversationId: options.conversationId
|
|
7365
|
-
}
|
|
7366
|
-
};
|
|
7367
|
-
const fetchedData = await this.fetcher.fetch(
|
|
7358
|
+
const data = await this.fetcher.fetch(
|
|
7368
7359
|
definitionWithConversationId,
|
|
7369
7360
|
result.resolvedContext
|
|
7370
7361
|
);
|
|
7371
|
-
result.resolvedContext[templateKey] = fetchedData;
|
|
7372
|
-
result.fetchedDefinitions.push(definition.id);
|
|
7373
|
-
await this.cache.set({
|
|
7374
|
-
contextConfigId: contextConfig2.id,
|
|
7375
|
-
contextVariableKey: templateKey,
|
|
7376
|
-
conversationId: options.conversationId,
|
|
7377
|
-
value: fetchedData,
|
|
7378
|
-
requestHash,
|
|
7379
|
-
tenantId: this.tenantId
|
|
7380
|
-
});
|
|
7381
7362
|
parentSpan.setStatus({ code: SpanStatusCode.OK });
|
|
7382
7363
|
parentSpan.addEvent("context.fetch_success", {
|
|
7383
7364
|
definition_id: definition.id,
|
|
7384
7365
|
template_key: templateKey,
|
|
7385
7366
|
source: definition.fetchConfig.url
|
|
7386
7367
|
});
|
|
7387
|
-
|
|
7388
|
-
{
|
|
7389
|
-
definitionId: definition.id,
|
|
7390
|
-
templateKey,
|
|
7391
|
-
conversationId: options.conversationId
|
|
7392
|
-
},
|
|
7393
|
-
"Context variable resolved and cached"
|
|
7394
|
-
);
|
|
7368
|
+
return data;
|
|
7395
7369
|
} catch (error) {
|
|
7396
7370
|
setSpanWithError(parentSpan, error);
|
|
7397
7371
|
throw error;
|
|
@@ -7400,6 +7374,24 @@ var ContextResolver = class {
|
|
|
7400
7374
|
}
|
|
7401
7375
|
}
|
|
7402
7376
|
);
|
|
7377
|
+
result.resolvedContext[templateKey] = fetchedData;
|
|
7378
|
+
result.fetchedDefinitions.push(definition.id);
|
|
7379
|
+
await this.cache.set({
|
|
7380
|
+
contextConfigId: contextConfig2.id,
|
|
7381
|
+
contextVariableKey: templateKey,
|
|
7382
|
+
conversationId: options.conversationId,
|
|
7383
|
+
value: fetchedData,
|
|
7384
|
+
requestHash,
|
|
7385
|
+
tenantId: this.tenantId
|
|
7386
|
+
});
|
|
7387
|
+
logger7.debug(
|
|
7388
|
+
{
|
|
7389
|
+
definitionId: definition.id,
|
|
7390
|
+
templateKey,
|
|
7391
|
+
conversationId: options.conversationId
|
|
7392
|
+
},
|
|
7393
|
+
"Context variable resolved and cached"
|
|
7394
|
+
);
|
|
7403
7395
|
}
|
|
7404
7396
|
/**
|
|
7405
7397
|
* Resolve the request context for a given conversation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-core",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250930194428",
|
|
4
4
|
"description": "Agents Core contains the database schema, types, and validation schemas for Inkeep Agent Framework, along with core components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|