@cognipeer/agent-sdk 0.5.0 → 0.5.1
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 +192 -389
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -20
- package/dist/index.d.ts +1 -20
- package/dist/index.mjs +193 -388
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2080,235 +2080,134 @@ function createAgentCoreNode(opts) {
|
|
|
2080
2080
|
|
|
2081
2081
|
// src/smart/runtimeConfig.ts
|
|
2082
2082
|
var DEFAULT_CRITICAL_TOOLS = ["response", "manage_todo_list", "get_tool_response"];
|
|
2083
|
+
var BASE_DEFAULTS = {
|
|
2084
|
+
limits: { maxToolCalls: 8, maxParallelTools: 2, maxContextTokens: 24e3 },
|
|
2085
|
+
summarization: {
|
|
2086
|
+
enable: true,
|
|
2087
|
+
maxTokens: 24e3,
|
|
2088
|
+
summaryTriggerTokens: 17e3,
|
|
2089
|
+
summaryPromptMaxTokens: 7e3,
|
|
2090
|
+
summaryCompressionRatioTarget: 0.35,
|
|
2091
|
+
summaryMode: "incremental",
|
|
2092
|
+
promptTemplate: "",
|
|
2093
|
+
toolFreeCall: true,
|
|
2094
|
+
integrityCheck: true
|
|
2095
|
+
},
|
|
2096
|
+
context: {
|
|
2097
|
+
policy: "hybrid",
|
|
2098
|
+
lastTurnsToKeep: 8,
|
|
2099
|
+
toolResponsePolicy: "summarize_archive",
|
|
2100
|
+
archiveLargeToolResponses: true,
|
|
2101
|
+
retrieveArchivedToolResponseOnDemand: true,
|
|
2102
|
+
budget: {
|
|
2103
|
+
systemReserveTokens: 1200,
|
|
2104
|
+
goalsReserveTokens: 1200,
|
|
2105
|
+
recentTurnsReserveTokens: 5200,
|
|
2106
|
+
toolResponseReserveTokens: 2800
|
|
2107
|
+
}
|
|
2108
|
+
},
|
|
2109
|
+
planning: {
|
|
2110
|
+
mode: "off",
|
|
2111
|
+
replanPolicy: "on_failure",
|
|
2112
|
+
everyNSteps: 0
|
|
2113
|
+
},
|
|
2114
|
+
memory: {
|
|
2115
|
+
provider: "inMemory",
|
|
2116
|
+
scope: "session",
|
|
2117
|
+
writePolicy: "auto_important",
|
|
2118
|
+
readPolicy: "hybrid"
|
|
2119
|
+
},
|
|
2120
|
+
delegation: {
|
|
2121
|
+
mode: "role_based",
|
|
2122
|
+
maxDelegationDepth: 2,
|
|
2123
|
+
maxChildCalls: 4,
|
|
2124
|
+
maxParallelChild: 2,
|
|
2125
|
+
childContextPolicy: "scoped",
|
|
2126
|
+
requireJsonOutputContract: true
|
|
2127
|
+
},
|
|
2128
|
+
toolResponses: {
|
|
2129
|
+
maxToolResponseChars: 3600,
|
|
2130
|
+
maxToolResponseTokens: 1200,
|
|
2131
|
+
defaultPolicy: "keep_structured",
|
|
2132
|
+
largeResponsePolicy: "summarize_archive",
|
|
2133
|
+
toolResponseRetentionByTool: {},
|
|
2134
|
+
criticalTools: [...DEFAULT_CRITICAL_TOOLS],
|
|
2135
|
+
schemaValidation: "strict",
|
|
2136
|
+
retryOnSchemaError: true,
|
|
2137
|
+
fallbackPolicy: "keep_structured"
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
function buildProfile(overrides) {
|
|
2141
|
+
return {
|
|
2142
|
+
limits: { ...BASE_DEFAULTS.limits, ...overrides.limits },
|
|
2143
|
+
summarization: { ...BASE_DEFAULTS.summarization, ...overrides.summarization },
|
|
2144
|
+
context: {
|
|
2145
|
+
...BASE_DEFAULTS.context,
|
|
2146
|
+
...overrides.context,
|
|
2147
|
+
budget: { ...BASE_DEFAULTS.context.budget, ...overrides.context?.budget }
|
|
2148
|
+
},
|
|
2149
|
+
planning: { ...BASE_DEFAULTS.planning, ...overrides.planning },
|
|
2150
|
+
memory: { ...BASE_DEFAULTS.memory, ...overrides.memory },
|
|
2151
|
+
delegation: { ...BASE_DEFAULTS.delegation, ...overrides.delegation },
|
|
2152
|
+
toolResponses: {
|
|
2153
|
+
...BASE_DEFAULTS.toolResponses,
|
|
2154
|
+
...overrides.toolResponses,
|
|
2155
|
+
criticalTools: overrides.toolResponses?.criticalTools ?? [...DEFAULT_CRITICAL_TOOLS],
|
|
2156
|
+
toolResponseRetentionByTool: overrides.toolResponses?.toolResponseRetentionByTool ?? {}
|
|
2157
|
+
}
|
|
2158
|
+
};
|
|
2159
|
+
}
|
|
2083
2160
|
var DEFAULT_PROFILE_CONFIGS = {
|
|
2084
|
-
fast: {
|
|
2161
|
+
fast: buildProfile({
|
|
2085
2162
|
limits: { maxToolCalls: 4, maxParallelTools: 1, maxContextTokens: 12e3 },
|
|
2086
2163
|
summarization: {
|
|
2087
|
-
enable: true,
|
|
2088
2164
|
maxTokens: 12e3,
|
|
2089
2165
|
summaryTriggerTokens: 9e3,
|
|
2090
2166
|
summaryPromptMaxTokens: 5e3,
|
|
2091
|
-
summaryCompressionRatioTarget: 0.4
|
|
2092
|
-
summaryMode: "incremental",
|
|
2093
|
-
promptTemplate: "",
|
|
2094
|
-
toolFreeCall: true,
|
|
2095
|
-
integrityCheck: true
|
|
2167
|
+
summaryCompressionRatioTarget: 0.4
|
|
2096
2168
|
},
|
|
2097
2169
|
context: {
|
|
2098
|
-
policy: "hybrid",
|
|
2099
2170
|
lastTurnsToKeep: 6,
|
|
2100
2171
|
toolResponsePolicy: "keep_structured",
|
|
2101
|
-
|
|
2102
|
-
retrieveArchivedToolResponseOnDemand: true,
|
|
2103
|
-
budget: {
|
|
2104
|
-
systemReserveTokens: 1e3,
|
|
2105
|
-
goalsReserveTokens: 900,
|
|
2106
|
-
recentTurnsReserveTokens: 3200,
|
|
2107
|
-
toolResponseReserveTokens: 1800
|
|
2108
|
-
}
|
|
2109
|
-
},
|
|
2110
|
-
planning: {
|
|
2111
|
-
mode: "off",
|
|
2112
|
-
replanPolicy: "on_failure",
|
|
2113
|
-
everyNSteps: 0
|
|
2114
|
-
},
|
|
2115
|
-
memory: {
|
|
2116
|
-
provider: "inMemory",
|
|
2117
|
-
scope: "session",
|
|
2118
|
-
writePolicy: "auto_important",
|
|
2119
|
-
readPolicy: "recent_only"
|
|
2120
|
-
},
|
|
2121
|
-
delegation: {
|
|
2122
|
-
mode: "off",
|
|
2123
|
-
maxDelegationDepth: 1,
|
|
2124
|
-
maxChildCalls: 2,
|
|
2125
|
-
maxParallelChild: 1,
|
|
2126
|
-
childContextPolicy: "minimal",
|
|
2127
|
-
requireJsonOutputContract: true
|
|
2128
|
-
},
|
|
2129
|
-
toolResponses: {
|
|
2130
|
-
maxToolResponseChars: 2400,
|
|
2131
|
-
maxToolResponseTokens: 800,
|
|
2132
|
-
defaultPolicy: "keep_structured",
|
|
2133
|
-
largeResponsePolicy: "summarize_archive",
|
|
2134
|
-
toolResponseRetentionByTool: {},
|
|
2135
|
-
criticalTools: [...DEFAULT_CRITICAL_TOOLS],
|
|
2136
|
-
schemaValidation: "strict",
|
|
2137
|
-
retryOnSchemaError: true,
|
|
2138
|
-
fallbackPolicy: "keep_structured"
|
|
2139
|
-
}
|
|
2140
|
-
},
|
|
2141
|
-
balanced: {
|
|
2142
|
-
limits: { maxToolCalls: 8, maxParallelTools: 2, maxContextTokens: 24e3 },
|
|
2143
|
-
summarization: {
|
|
2144
|
-
enable: true,
|
|
2145
|
-
maxTokens: 24e3,
|
|
2146
|
-
summaryTriggerTokens: 17e3,
|
|
2147
|
-
summaryPromptMaxTokens: 7e3,
|
|
2148
|
-
summaryCompressionRatioTarget: 0.35,
|
|
2149
|
-
summaryMode: "incremental",
|
|
2150
|
-
promptTemplate: "",
|
|
2151
|
-
toolFreeCall: true,
|
|
2152
|
-
integrityCheck: true
|
|
2153
|
-
},
|
|
2154
|
-
context: {
|
|
2155
|
-
policy: "hybrid",
|
|
2156
|
-
lastTurnsToKeep: 8,
|
|
2157
|
-
toolResponsePolicy: "summarize_archive",
|
|
2158
|
-
archiveLargeToolResponses: true,
|
|
2159
|
-
retrieveArchivedToolResponseOnDemand: true,
|
|
2160
|
-
budget: {
|
|
2161
|
-
systemReserveTokens: 1200,
|
|
2162
|
-
goalsReserveTokens: 1200,
|
|
2163
|
-
recentTurnsReserveTokens: 5200,
|
|
2164
|
-
toolResponseReserveTokens: 2800
|
|
2165
|
-
}
|
|
2166
|
-
},
|
|
2167
|
-
planning: {
|
|
2168
|
-
mode: "off",
|
|
2169
|
-
replanPolicy: "on_failure",
|
|
2170
|
-
everyNSteps: 0
|
|
2171
|
-
},
|
|
2172
|
-
memory: {
|
|
2173
|
-
provider: "inMemory",
|
|
2174
|
-
scope: "session",
|
|
2175
|
-
writePolicy: "auto_important",
|
|
2176
|
-
readPolicy: "hybrid"
|
|
2177
|
-
},
|
|
2178
|
-
delegation: {
|
|
2179
|
-
mode: "role_based",
|
|
2180
|
-
maxDelegationDepth: 2,
|
|
2181
|
-
maxChildCalls: 4,
|
|
2182
|
-
maxParallelChild: 2,
|
|
2183
|
-
childContextPolicy: "scoped",
|
|
2184
|
-
requireJsonOutputContract: true
|
|
2172
|
+
budget: { systemReserveTokens: 1e3, goalsReserveTokens: 900, recentTurnsReserveTokens: 3200, toolResponseReserveTokens: 1800 }
|
|
2185
2173
|
},
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
criticalTools: [...DEFAULT_CRITICAL_TOOLS],
|
|
2193
|
-
schemaValidation: "strict",
|
|
2194
|
-
retryOnSchemaError: true,
|
|
2195
|
-
fallbackPolicy: "keep_structured"
|
|
2196
|
-
}
|
|
2197
|
-
},
|
|
2198
|
-
deep: {
|
|
2174
|
+
memory: { readPolicy: "recent_only" },
|
|
2175
|
+
delegation: { mode: "off", maxDelegationDepth: 1, maxChildCalls: 2, maxParallelChild: 1, childContextPolicy: "minimal" },
|
|
2176
|
+
toolResponses: { maxToolResponseChars: 2400, maxToolResponseTokens: 800 }
|
|
2177
|
+
}),
|
|
2178
|
+
balanced: buildProfile({}),
|
|
2179
|
+
deep: buildProfile({
|
|
2199
2180
|
limits: { maxToolCalls: 14, maxParallelTools: 3, maxContextTokens: 42e3 },
|
|
2200
2181
|
summarization: {
|
|
2201
|
-
enable: true,
|
|
2202
2182
|
maxTokens: 42e3,
|
|
2203
2183
|
summaryTriggerTokens: 3e4,
|
|
2204
2184
|
summaryPromptMaxTokens: 9e3,
|
|
2205
|
-
summaryCompressionRatioTarget: 0.3
|
|
2206
|
-
summaryMode: "incremental",
|
|
2207
|
-
promptTemplate: "",
|
|
2208
|
-
toolFreeCall: true,
|
|
2209
|
-
integrityCheck: true
|
|
2185
|
+
summaryCompressionRatioTarget: 0.3
|
|
2210
2186
|
},
|
|
2211
2187
|
context: {
|
|
2212
|
-
policy: "hybrid",
|
|
2213
2188
|
lastTurnsToKeep: 12,
|
|
2214
|
-
|
|
2215
|
-
archiveLargeToolResponses: true,
|
|
2216
|
-
retrieveArchivedToolResponseOnDemand: true,
|
|
2217
|
-
budget: {
|
|
2218
|
-
systemReserveTokens: 1400,
|
|
2219
|
-
goalsReserveTokens: 1600,
|
|
2220
|
-
recentTurnsReserveTokens: 7e3,
|
|
2221
|
-
toolResponseReserveTokens: 3600
|
|
2222
|
-
}
|
|
2223
|
-
},
|
|
2224
|
-
planning: {
|
|
2225
|
-
mode: "off",
|
|
2226
|
-
replanPolicy: "on_failure",
|
|
2227
|
-
everyNSteps: 0
|
|
2228
|
-
},
|
|
2229
|
-
memory: {
|
|
2230
|
-
provider: "inMemory",
|
|
2231
|
-
scope: "workspace",
|
|
2232
|
-
writePolicy: "auto_important",
|
|
2233
|
-
readPolicy: "hybrid"
|
|
2189
|
+
budget: { systemReserveTokens: 1400, goalsReserveTokens: 1600, recentTurnsReserveTokens: 7e3, toolResponseReserveTokens: 3600 }
|
|
2234
2190
|
},
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
childContextPolicy: "scoped",
|
|
2241
|
-
requireJsonOutputContract: true
|
|
2242
|
-
},
|
|
2243
|
-
toolResponses: {
|
|
2244
|
-
maxToolResponseChars: 5400,
|
|
2245
|
-
maxToolResponseTokens: 1800,
|
|
2246
|
-
defaultPolicy: "keep_structured",
|
|
2247
|
-
largeResponsePolicy: "summarize_archive",
|
|
2248
|
-
toolResponseRetentionByTool: {},
|
|
2249
|
-
criticalTools: [...DEFAULT_CRITICAL_TOOLS],
|
|
2250
|
-
schemaValidation: "strict",
|
|
2251
|
-
retryOnSchemaError: true,
|
|
2252
|
-
fallbackPolicy: "keep_structured"
|
|
2253
|
-
}
|
|
2254
|
-
},
|
|
2255
|
-
research: {
|
|
2191
|
+
memory: { scope: "workspace" },
|
|
2192
|
+
delegation: { maxDelegationDepth: 3, maxChildCalls: 6 },
|
|
2193
|
+
toolResponses: { maxToolResponseChars: 5400, maxToolResponseTokens: 1800 }
|
|
2194
|
+
}),
|
|
2195
|
+
research: buildProfile({
|
|
2256
2196
|
limits: { maxToolCalls: 20, maxParallelTools: 4, maxContextTokens: 56e3 },
|
|
2257
2197
|
summarization: {
|
|
2258
|
-
enable: true,
|
|
2259
2198
|
maxTokens: 56e3,
|
|
2260
2199
|
summaryTriggerTokens: 42e3,
|
|
2261
2200
|
summaryPromptMaxTokens: 1e4,
|
|
2262
|
-
summaryCompressionRatioTarget: 0.28
|
|
2263
|
-
summaryMode: "incremental",
|
|
2264
|
-
promptTemplate: "",
|
|
2265
|
-
toolFreeCall: true,
|
|
2266
|
-
integrityCheck: true
|
|
2201
|
+
summaryCompressionRatioTarget: 0.28
|
|
2267
2202
|
},
|
|
2268
2203
|
context: {
|
|
2269
|
-
policy: "hybrid",
|
|
2270
2204
|
lastTurnsToKeep: 20,
|
|
2271
|
-
|
|
2272
|
-
archiveLargeToolResponses: true,
|
|
2273
|
-
retrieveArchivedToolResponseOnDemand: true,
|
|
2274
|
-
budget: {
|
|
2275
|
-
systemReserveTokens: 1600,
|
|
2276
|
-
goalsReserveTokens: 1800,
|
|
2277
|
-
recentTurnsReserveTokens: 9e3,
|
|
2278
|
-
toolResponseReserveTokens: 4800
|
|
2279
|
-
}
|
|
2205
|
+
budget: { systemReserveTokens: 1600, goalsReserveTokens: 1800, recentTurnsReserveTokens: 9e3, toolResponseReserveTokens: 4800 }
|
|
2280
2206
|
},
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
},
|
|
2286
|
-
memory: {
|
|
2287
|
-
provider: "inMemory",
|
|
2288
|
-
scope: "workspace",
|
|
2289
|
-
writePolicy: "auto_important",
|
|
2290
|
-
readPolicy: "hybrid"
|
|
2291
|
-
},
|
|
2292
|
-
delegation: {
|
|
2293
|
-
mode: "automatic",
|
|
2294
|
-
maxDelegationDepth: 4,
|
|
2295
|
-
maxChildCalls: 8,
|
|
2296
|
-
maxParallelChild: 3,
|
|
2297
|
-
childContextPolicy: "full",
|
|
2298
|
-
requireJsonOutputContract: true
|
|
2299
|
-
},
|
|
2300
|
-
toolResponses: {
|
|
2301
|
-
maxToolResponseChars: 7200,
|
|
2302
|
-
maxToolResponseTokens: 2200,
|
|
2303
|
-
defaultPolicy: "keep_structured",
|
|
2304
|
-
largeResponsePolicy: "summarize_archive",
|
|
2305
|
-
toolResponseRetentionByTool: {},
|
|
2306
|
-
criticalTools: [...DEFAULT_CRITICAL_TOOLS],
|
|
2307
|
-
schemaValidation: "strict",
|
|
2308
|
-
retryOnSchemaError: true,
|
|
2309
|
-
fallbackPolicy: "keep_structured"
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2207
|
+
memory: { scope: "workspace" },
|
|
2208
|
+
delegation: { mode: "automatic", maxDelegationDepth: 4, maxChildCalls: 8, maxParallelChild: 3, childContextPolicy: "full" },
|
|
2209
|
+
toolResponses: { maxToolResponseChars: 7200, maxToolResponseTokens: 2200 }
|
|
2210
|
+
})
|
|
2312
2211
|
};
|
|
2313
2212
|
function mergeLimits(base, override) {
|
|
2314
2213
|
return {
|
|
@@ -2451,16 +2350,52 @@ function countMessagesTokens(messages) {
|
|
|
2451
2350
|
return countApproxTokens(allText) + messages.length * 4;
|
|
2452
2351
|
}
|
|
2453
2352
|
|
|
2454
|
-
// src/
|
|
2455
|
-
function
|
|
2353
|
+
// src/utils/content.ts
|
|
2354
|
+
function contentToString(content) {
|
|
2355
|
+
try {
|
|
2356
|
+
if (content == null) return "";
|
|
2357
|
+
if (typeof content === "string") return content;
|
|
2358
|
+
if (Array.isArray(content)) {
|
|
2359
|
+
return content.map((p) => {
|
|
2360
|
+
if (!p || typeof p !== "object") return String(p);
|
|
2361
|
+
if (p.type === "text") return String(p.text ?? "");
|
|
2362
|
+
if (p.type === "image_url") {
|
|
2363
|
+
const img = p.image_url;
|
|
2364
|
+
const url = typeof img === "string" ? img : img?.url;
|
|
2365
|
+
const detail = typeof img === "string" ? void 0 : img?.detail;
|
|
2366
|
+
return `[image:${url || "unknown"}${detail ? ` detail=${detail}` : ""}]`;
|
|
2367
|
+
}
|
|
2368
|
+
return JSON.stringify(p);
|
|
2369
|
+
}).join("\n");
|
|
2370
|
+
}
|
|
2371
|
+
return JSON.stringify(content);
|
|
2372
|
+
} catch {
|
|
2373
|
+
return String(content);
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
function mergeContentsToString(contents) {
|
|
2377
|
+
return contents.map((c) => contentToString(c)).join("\n");
|
|
2378
|
+
}
|
|
2379
|
+
function safeStringify(value, pretty = false) {
|
|
2380
|
+
if (value == null) return "";
|
|
2456
2381
|
if (typeof value === "string") return value;
|
|
2457
2382
|
try {
|
|
2458
|
-
|
|
2459
|
-
return typeof serialized === "string" ? serialized : String(value);
|
|
2383
|
+
return JSON.stringify(value, null, pretty ? 2 : void 0) ?? String(value);
|
|
2460
2384
|
} catch {
|
|
2461
2385
|
return String(value);
|
|
2462
2386
|
}
|
|
2463
2387
|
}
|
|
2388
|
+
function extractMessageText2(message) {
|
|
2389
|
+
if (!message) return "";
|
|
2390
|
+
const content = message.content;
|
|
2391
|
+
if (typeof content === "string") return content;
|
|
2392
|
+
if (Array.isArray(content)) {
|
|
2393
|
+
return content.map((part) => typeof part === "string" ? part : part?.text ?? part?.content ?? "").join("");
|
|
2394
|
+
}
|
|
2395
|
+
return "";
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
// src/smart/toolResponses.ts
|
|
2464
2399
|
function summarizeObject(value) {
|
|
2465
2400
|
if (value == null) return "null";
|
|
2466
2401
|
if (typeof value === "string") {
|
|
@@ -3224,6 +3159,21 @@ function resolveToolApprovalState(state, resolution) {
|
|
|
3224
3159
|
};
|
|
3225
3160
|
}
|
|
3226
3161
|
|
|
3162
|
+
// src/utils/syntheticMessages.ts
|
|
3163
|
+
function isSyntheticSummaryMessage(message) {
|
|
3164
|
+
if (!message) return false;
|
|
3165
|
+
if (message.role === "tool" && message.name === "summarize_context") {
|
|
3166
|
+
return true;
|
|
3167
|
+
}
|
|
3168
|
+
if (message.role === "assistant" && Array.isArray(message.tool_calls)) {
|
|
3169
|
+
return message.tool_calls.some((toolCall) => {
|
|
3170
|
+
const toolName = toolCall?.function?.name || toolCall?.name;
|
|
3171
|
+
return toolName === "summarize_context";
|
|
3172
|
+
});
|
|
3173
|
+
}
|
|
3174
|
+
return false;
|
|
3175
|
+
}
|
|
3176
|
+
|
|
3227
3177
|
// src/structuredOutput/manager.ts
|
|
3228
3178
|
var StructuredOutputManager = class {
|
|
3229
3179
|
constructor(schema, strategy, config) {
|
|
@@ -3372,26 +3322,6 @@ var StructuredOutputManager = class {
|
|
|
3372
3322
|
};
|
|
3373
3323
|
|
|
3374
3324
|
// src/agent.ts
|
|
3375
|
-
function isSyntheticSummaryMessage(message) {
|
|
3376
|
-
if (!message) return false;
|
|
3377
|
-
if (message.role === "tool" && message.name === "summarize_context") {
|
|
3378
|
-
return true;
|
|
3379
|
-
}
|
|
3380
|
-
if (message.role === "assistant" && Array.isArray(message.tool_calls)) {
|
|
3381
|
-
return message.tool_calls.some((toolCall) => {
|
|
3382
|
-
const toolName = toolCall?.function?.name || toolCall?.name;
|
|
3383
|
-
return toolName === "summarize_context";
|
|
3384
|
-
});
|
|
3385
|
-
}
|
|
3386
|
-
return false;
|
|
3387
|
-
}
|
|
3388
|
-
function getMessageText(message) {
|
|
3389
|
-
if (typeof message?.content === "string") return message.content;
|
|
3390
|
-
if (Array.isArray(message?.content)) {
|
|
3391
|
-
return message.content.map((chunk) => typeof chunk === "string" ? chunk : chunk?.text ?? chunk?.content ?? "").join("");
|
|
3392
|
-
}
|
|
3393
|
-
return "";
|
|
3394
|
-
}
|
|
3395
3325
|
function getLastAssistantMessage(messages) {
|
|
3396
3326
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
3397
3327
|
if (messages[index]?.role === "assistant") {
|
|
@@ -3809,7 +3739,7 @@ function createAgent(opts) {
|
|
|
3809
3739
|
status: "success"
|
|
3810
3740
|
});
|
|
3811
3741
|
const finalAssistantMsg = getLastAssistantMessage(res.messages);
|
|
3812
|
-
const content =
|
|
3742
|
+
const content = extractMessageText2(finalAssistantMsg);
|
|
3813
3743
|
let parsed = void 0;
|
|
3814
3744
|
let outputError = void 0;
|
|
3815
3745
|
if (soManager) {
|
|
@@ -4009,13 +3939,6 @@ function createAgentNode(opts) {
|
|
|
4009
3939
|
}
|
|
4010
3940
|
|
|
4011
3941
|
// src/smart/contextPolicy.ts
|
|
4012
|
-
function messageText(message) {
|
|
4013
|
-
if (typeof message.content === "string") return message.content;
|
|
4014
|
-
if (Array.isArray(message.content)) {
|
|
4015
|
-
return message.content.map((part) => typeof part === "string" ? part : part?.text ?? part?.content ?? JSON.stringify(part)).join(" ");
|
|
4016
|
-
}
|
|
4017
|
-
return "";
|
|
4018
|
-
}
|
|
4019
3942
|
function collectRecentTurns(messages, lastTurnsToKeep) {
|
|
4020
3943
|
if (lastTurnsToKeep <= 0) return [];
|
|
4021
3944
|
const systemPrefix = messages.filter((message, index) => index === 0 && message.role === "system");
|
|
@@ -4056,10 +3979,6 @@ function renderStructuredSummary(summary) {
|
|
|
4056
3979
|
lines.push("Open questions:");
|
|
4057
3980
|
lines.push(...summary.open_questions.map((question) => `- ${question}`));
|
|
4058
3981
|
}
|
|
4059
|
-
if (summary.discarded_obsolete.length > 0) {
|
|
4060
|
-
lines.push("Discarded obsolete:");
|
|
4061
|
-
lines.push(...summary.discarded_obsolete.map((item) => `- ${item}`));
|
|
4062
|
-
}
|
|
4063
3982
|
return lines.join("\n");
|
|
4064
3983
|
}
|
|
4065
3984
|
function renderMemoryBlock(facts) {
|
|
@@ -4072,7 +3991,7 @@ function renderMemoryBlock(facts) {
|
|
|
4072
3991
|
function clampToBudget(messages, maxContextTokens) {
|
|
4073
3992
|
let working = [...messages];
|
|
4074
3993
|
while (working.length > 2) {
|
|
4075
|
-
const tokenCount = countApproxTokens(working.map(
|
|
3994
|
+
const tokenCount = countApproxTokens(working.map(extractMessageText2).join("\n"));
|
|
4076
3995
|
if (tokenCount <= maxContextTokens) return working;
|
|
4077
3996
|
const firstNonSystem = working.findIndex((message, index) => !(index === 0 && message.role === "system"));
|
|
4078
3997
|
if (firstNonSystem < 0) break;
|
|
@@ -4146,18 +4065,6 @@ function buildModelMessages(state, config) {
|
|
|
4146
4065
|
// src/nodes/contextSummarize.ts
|
|
4147
4066
|
var systemMessage = (content) => ({ role: "system", content });
|
|
4148
4067
|
var humanMessage = (content) => ({ role: "user", content });
|
|
4149
|
-
function isSyntheticSummaryToolMessage(message) {
|
|
4150
|
-
return message.role === "tool" && message.name === "summarize_context";
|
|
4151
|
-
}
|
|
4152
|
-
function isSyntheticSummaryAssistantMessage(message) {
|
|
4153
|
-
if (message.role !== "assistant" || !Array.isArray(message.tool_calls)) {
|
|
4154
|
-
return false;
|
|
4155
|
-
}
|
|
4156
|
-
return message.tool_calls.some((toolCall) => {
|
|
4157
|
-
const toolName = toolCall?.function?.name || toolCall?.name;
|
|
4158
|
-
return toolName === "summarize_context";
|
|
4159
|
-
});
|
|
4160
|
-
}
|
|
4161
4068
|
function validateMessageSequence(messages) {
|
|
4162
4069
|
const validated = [];
|
|
4163
4070
|
const pendingToolCallIds = /* @__PURE__ */ new Set();
|
|
@@ -4382,7 +4289,7 @@ function createContextSummarizeNode(opts) {
|
|
|
4382
4289
|
(m) => {
|
|
4383
4290
|
if (m.role !== "tool") return false;
|
|
4384
4291
|
if (isSummarizedToolPlaceholder(m.content)) return false;
|
|
4385
|
-
if (
|
|
4292
|
+
if (isSyntheticSummaryMessage(m)) return false;
|
|
4386
4293
|
const histEntry = findToolHistoryEntry(state, m.tool_call_id, m.name);
|
|
4387
4294
|
if (histEntry?.retentionPolicy === "keep_full") return false;
|
|
4388
4295
|
if (!histEntry?.retentionPolicy) {
|
|
@@ -4395,15 +4302,14 @@ function createContextSummarizeNode(opts) {
|
|
|
4395
4302
|
if (compressableMessages.length === 0) {
|
|
4396
4303
|
return {};
|
|
4397
4304
|
}
|
|
4398
|
-
const
|
|
4399
|
-
const tokenCountBefore = countApproxTokens(allTextBefore);
|
|
4305
|
+
const tokenCountBefore = countMessagesTokens(messages);
|
|
4400
4306
|
const summaryPromptMaxTokens = config.summaryPromptMaxTokens;
|
|
4401
4307
|
const availableTokensForConversation = summaryPromptMaxTokens - 500;
|
|
4402
4308
|
const messageTexts = [];
|
|
4403
4309
|
let accumulatedTokens = 0;
|
|
4404
4310
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
4405
4311
|
const m = messages[i];
|
|
4406
|
-
if (
|
|
4312
|
+
if (isSyntheticSummaryMessage(m) || isSyntheticSummaryMessage(m)) {
|
|
4407
4313
|
continue;
|
|
4408
4314
|
}
|
|
4409
4315
|
let content = "";
|
|
@@ -4424,13 +4330,13 @@ function createContextSummarizeNode(opts) {
|
|
|
4424
4330
|
}
|
|
4425
4331
|
let prefix = `${m.role.toUpperCase()}`;
|
|
4426
4332
|
if (m.name) prefix += ` (${m.name})`;
|
|
4427
|
-
const
|
|
4428
|
-
const messageTokens = countApproxTokens(
|
|
4333
|
+
const messageText = `${prefix}: ${content}`;
|
|
4334
|
+
const messageTokens = countApproxTokens(messageText);
|
|
4429
4335
|
if (accumulatedTokens + messageTokens > availableTokensForConversation) {
|
|
4430
4336
|
messageTexts.unshift("[Earlier conversation history omitted for brevity]");
|
|
4431
4337
|
break;
|
|
4432
4338
|
}
|
|
4433
|
-
messageTexts.unshift(
|
|
4339
|
+
messageTexts.unshift(messageText);
|
|
4434
4340
|
accumulatedTokens += messageTokens;
|
|
4435
4341
|
}
|
|
4436
4342
|
const conversationText = messageTexts.join("\n\n");
|
|
@@ -4572,7 +4478,7 @@ ${canonicalFacts.length > 0 ? canonicalFacts.map((fact) => `- ${fact.key}: ${fac
|
|
|
4572
4478
|
const toolResponsesConfig = resolved.toolResponses;
|
|
4573
4479
|
const newMessages = messages.map((m) => {
|
|
4574
4480
|
if (m.role === "tool") {
|
|
4575
|
-
if (
|
|
4481
|
+
if (isSyntheticSummaryMessage(m)) {
|
|
4576
4482
|
return m;
|
|
4577
4483
|
}
|
|
4578
4484
|
const toolCallId = m.tool_call_id;
|
|
@@ -4630,8 +4536,7 @@ ${canonicalFacts.length > 0 ? canonicalFacts.map((fact) => `- ${fact.key}: ${fac
|
|
|
4630
4536
|
const summaries = Array.isArray(state.summaries) ? [...state.summaries, summaryText] : [summaryText];
|
|
4631
4537
|
const summaryRecords = Array.isArray(state.summaryRecords) ? [...state.summaryRecords, { ...structuredSummary || normalizeStructuredSummary(void 0, summaryText), integrity, createdAt: (/* @__PURE__ */ new Date()).toISOString() }] : [{ ...structuredSummary || normalizeStructuredSummary(void 0, summaryText), integrity, createdAt: (/* @__PURE__ */ new Date()).toISOString() }];
|
|
4632
4538
|
const finalMessages = [...validatedMessages, assistantSummaryCall, toolSummaryResponse];
|
|
4633
|
-
const
|
|
4634
|
-
const tokenCountAfter = countApproxTokens(allTextAfter);
|
|
4539
|
+
const tokenCountAfter = countMessagesTokens(finalMessages);
|
|
4635
4540
|
const summarizationEvent = {
|
|
4636
4541
|
type: "summarization",
|
|
4637
4542
|
summary: summaryText,
|
|
@@ -4682,25 +4587,6 @@ ${canonicalFacts.length > 0 ? canonicalFacts.map((fact) => `- ${fact.key}: ${fac
|
|
|
4682
4587
|
};
|
|
4683
4588
|
};
|
|
4684
4589
|
}
|
|
4685
|
-
|
|
4686
|
-
// src/utils/tokenManager.ts
|
|
4687
|
-
async function applyTokenLimits({
|
|
4688
|
-
state,
|
|
4689
|
-
limits
|
|
4690
|
-
}) {
|
|
4691
|
-
const messages = state.messages || [];
|
|
4692
|
-
const budget = limits.contextTokenLimit;
|
|
4693
|
-
let total = messages.reduce((acc, m) => acc + countApproxTokens(String(m.content || "")), 0);
|
|
4694
|
-
if (total <= budget) return state;
|
|
4695
|
-
const newMessages = [...messages];
|
|
4696
|
-
while (total > budget && newMessages.length > 1) {
|
|
4697
|
-
const idx = newMessages.findIndex((m) => m.role !== "system");
|
|
4698
|
-
if (idx === -1) break;
|
|
4699
|
-
const removed = newMessages.splice(idx, 1)[0];
|
|
4700
|
-
total -= countApproxTokens(String(removed.content || ""));
|
|
4701
|
-
}
|
|
4702
|
-
return { ...state, messages: newMessages };
|
|
4703
|
-
}
|
|
4704
4590
|
var todoStatusSchema = z.enum(["not-started", "in-progress", "completed", "blocked"]);
|
|
4705
4591
|
var todoWriteItemSchema = z.object({
|
|
4706
4592
|
id: z.number().int().min(1).describe("Sequential id starting from 1"),
|
|
@@ -4959,19 +4845,6 @@ function createContextTools(stateRef, opts) {
|
|
|
4959
4845
|
}
|
|
4960
4846
|
|
|
4961
4847
|
// src/graph/decisions.ts
|
|
4962
|
-
function isSyntheticSummaryMessage2(message) {
|
|
4963
|
-
if (!message) return false;
|
|
4964
|
-
if (message.role === "tool" && message.name === "summarize_context") {
|
|
4965
|
-
return true;
|
|
4966
|
-
}
|
|
4967
|
-
if (message.role === "assistant" && Array.isArray(message.tool_calls)) {
|
|
4968
|
-
return message.tool_calls.some((toolCall) => {
|
|
4969
|
-
const toolName = toolCall?.function?.name || toolCall?.name;
|
|
4970
|
-
return toolName === "summarize_context";
|
|
4971
|
-
});
|
|
4972
|
-
}
|
|
4973
|
-
return false;
|
|
4974
|
-
}
|
|
4975
4848
|
function needsSummarization(state, opts, summarizationEnabled) {
|
|
4976
4849
|
if (!summarizationEnabled) {
|
|
4977
4850
|
return false;
|
|
@@ -4985,30 +4858,9 @@ function needsSummarization(state, opts, summarizationEnabled) {
|
|
|
4985
4858
|
}
|
|
4986
4859
|
const maxTok = resolved.summarization.summaryTriggerTokens;
|
|
4987
4860
|
try {
|
|
4988
|
-
const
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
return m.content.map((c) => typeof c === "string" ? c : c?.text ?? c?.content ?? JSON.stringify(c)).join("");
|
|
4992
|
-
}
|
|
4993
|
-
if (m.content && typeof m.content === "object") {
|
|
4994
|
-
return JSON.stringify(m.content);
|
|
4995
|
-
}
|
|
4996
|
-
return "";
|
|
4997
|
-
}).join("\n");
|
|
4998
|
-
const tokenCount = countApproxTokens(allText);
|
|
4999
|
-
const needsSum = tokenCount > maxTok;
|
|
5000
|
-
if (process.env.DEBUG_SUMMARIZATION) {
|
|
5001
|
-
const msgCount = (state.messages || []).length;
|
|
5002
|
-
const toolMsgs = (state.messages || []).filter((m) => m.role === "tool");
|
|
5003
|
-
const toolDetails = toolMsgs.map((m, i) => {
|
|
5004
|
-
const contentStr = typeof m.content === "string" ? m.content : JSON.stringify(m.content);
|
|
5005
|
-
return `[${i}] id:${m.tool_call_id?.slice(-8) || "none"} len:${contentStr.length} preview:"${contentStr.slice(0, 30)}..."`;
|
|
5006
|
-
});
|
|
5007
|
-
console.log(`[Summarization] Messages: ${msgCount}, Tool messages: ${toolMsgs.length}`);
|
|
5008
|
-
toolDetails.forEach((d) => console.log(` ${d}`));
|
|
5009
|
-
console.log(`[Summarization] Token count: ${tokenCount}, Max: ${maxTok}, Needs summarization: ${needsSum}`);
|
|
5010
|
-
}
|
|
5011
|
-
return needsSum;
|
|
4861
|
+
const filtered = (state.messages || []).filter((message) => !isSyntheticSummaryMessage(message));
|
|
4862
|
+
const tokenCount = countMessagesTokens(filtered);
|
|
4863
|
+
return tokenCount > maxTok;
|
|
5012
4864
|
} catch {
|
|
5013
4865
|
return false;
|
|
5014
4866
|
}
|
|
@@ -5137,13 +4989,6 @@ async function writeSummaryFactsToMemory(store, config, summary, sourceTurn) {
|
|
|
5137
4989
|
}
|
|
5138
4990
|
return store.get(config.memory.scope, { limit: config.context.lastTurnsToKeep + summary.stable_facts.length });
|
|
5139
4991
|
}
|
|
5140
|
-
function renderMemoryFacts(facts) {
|
|
5141
|
-
if (facts.length === 0) return "";
|
|
5142
|
-
return [
|
|
5143
|
-
"Memory facts:",
|
|
5144
|
-
...facts.map((fact) => `- ${fact.key}: ${fact.value} (confidence ${fact.confidence.toFixed(2)})`)
|
|
5145
|
-
].join("\n");
|
|
5146
|
-
}
|
|
5147
4992
|
|
|
5148
4993
|
// src/smart/index.ts
|
|
5149
4994
|
function createSmartAgent(opts) {
|
|
@@ -5183,8 +5028,7 @@ function createSmartAgent(opts) {
|
|
|
5183
5028
|
].join("\n");
|
|
5184
5029
|
function latestUserPrompt(messages) {
|
|
5185
5030
|
const latest = [...messages].reverse().find((message) => message.role === "user");
|
|
5186
|
-
|
|
5187
|
-
return typeof latest.content === "string" ? latest.content : Array.isArray(latest.content) ? latest.content.map((part) => typeof part === "string" ? part : part?.text ?? part?.content ?? "").join(" ") : "";
|
|
5031
|
+
return latest ? extractMessageText2(latest) : "";
|
|
5188
5032
|
}
|
|
5189
5033
|
async function syncMemory(state) {
|
|
5190
5034
|
const query = latestUserPrompt(state.messages || []);
|
|
@@ -5224,6 +5068,18 @@ function createSmartAgent(opts) {
|
|
|
5224
5068
|
);
|
|
5225
5069
|
return { role: "system", content: sys };
|
|
5226
5070
|
}
|
|
5071
|
+
async function trySummarize(currentState, currentRawMessages) {
|
|
5072
|
+
if (!summarizer) return { state: currentState, rawMessages: currentRawMessages, compressed: false };
|
|
5073
|
+
const delta = await summarizer(currentState);
|
|
5074
|
+
if (!delta || Object.keys(delta).length === 0) {
|
|
5075
|
+
const ctx2 = { ...currentState.ctx || {}, __summarizationExhausted: true };
|
|
5076
|
+
return { state: { ...currentState, ctx: ctx2 }, rawMessages: currentRawMessages, compressed: false };
|
|
5077
|
+
}
|
|
5078
|
+
const ctx = { ...currentState.ctx || {} };
|
|
5079
|
+
delete ctx.__summarizationExhausted;
|
|
5080
|
+
const updated = await persistLatestSummary(syncPlanState({ ...currentState, ...delta, ctx }));
|
|
5081
|
+
return { state: updated, rawMessages: [...updated.messages || currentRawMessages], compressed: true };
|
|
5082
|
+
}
|
|
5227
5083
|
const instance = {
|
|
5228
5084
|
invoke: async (input, config) => {
|
|
5229
5085
|
stateRef.toolHistory = input.toolHistory;
|
|
@@ -5242,17 +5098,10 @@ function createSmartAgent(opts) {
|
|
|
5242
5098
|
state = { ...state, messages: rawMessages };
|
|
5243
5099
|
const next = summarizationEnabled ? decideBefore(state) : "agent";
|
|
5244
5100
|
if (next === "contextSummarize" && summarizer) {
|
|
5245
|
-
const
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
} else {
|
|
5250
|
-
const ctx = { ...state.ctx || {} };
|
|
5251
|
-
delete ctx.__summarizationExhausted;
|
|
5252
|
-
state = await persistLatestSummary(syncPlanState({ ...state, ...delta, ctx }));
|
|
5253
|
-
rawMessages = [...state.messages || rawMessages];
|
|
5254
|
-
continue;
|
|
5255
|
-
}
|
|
5101
|
+
const result = await trySummarize(state, rawMessages);
|
|
5102
|
+
state = result.state;
|
|
5103
|
+
rawMessages = result.rawMessages;
|
|
5104
|
+
if (result.compressed) continue;
|
|
5256
5105
|
}
|
|
5257
5106
|
const modelMessages = buildModelMessages(state, resolved);
|
|
5258
5107
|
const res = await base.invoke({ ...state, messages: modelMessages }, config);
|
|
@@ -5280,35 +5129,20 @@ function createSmartAgent(opts) {
|
|
|
5280
5129
|
const ctx = { ...state.ctx || {} };
|
|
5281
5130
|
delete ctx.__needsSummarization;
|
|
5282
5131
|
state = { ...state, ctx };
|
|
5283
|
-
const
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
state = await persistLatestSummary(syncPlanState({ ...state, ...delta, ctx: successCtx }));
|
|
5288
|
-
rawMessages = [...state.messages || rawMessages];
|
|
5289
|
-
continue;
|
|
5290
|
-
} else {
|
|
5291
|
-
const exhaustedCtx = { ...state.ctx || {}, __summarizationExhausted: true };
|
|
5292
|
-
state = { ...state, ctx: exhaustedCtx };
|
|
5293
|
-
continue;
|
|
5294
|
-
}
|
|
5132
|
+
const result = await trySummarize(state, rawMessages);
|
|
5133
|
+
state = result.state;
|
|
5134
|
+
rawMessages = result.rawMessages;
|
|
5135
|
+
continue;
|
|
5295
5136
|
}
|
|
5296
5137
|
if (state.ctx?.__finalizedDueToStructuredOutput) break;
|
|
5297
5138
|
if (opts.outputSchema && lastResult?.output != null) break;
|
|
5298
5139
|
if (summarizationEnabled) {
|
|
5299
5140
|
const after = decideAfter(state);
|
|
5300
5141
|
if (after === "contextSummarize" && summarizer) {
|
|
5301
|
-
const
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
state = await persistLatestSummary(syncPlanState({ ...state, ...delta, ctx: successCtx }));
|
|
5306
|
-
rawMessages = [...state.messages || rawMessages];
|
|
5307
|
-
continue;
|
|
5308
|
-
} else {
|
|
5309
|
-
const exhaustedCtx = { ...state.ctx || {}, __summarizationExhausted: true };
|
|
5310
|
-
state = { ...state, ctx: exhaustedCtx };
|
|
5311
|
-
}
|
|
5142
|
+
const result = await trySummarize(state, rawMessages);
|
|
5143
|
+
state = result.state;
|
|
5144
|
+
rawMessages = result.rawMessages;
|
|
5145
|
+
if (result.compressed) continue;
|
|
5312
5146
|
}
|
|
5313
5147
|
}
|
|
5314
5148
|
break;
|
|
@@ -5472,35 +5306,6 @@ async function runSmartAgentEvalHarness(params) {
|
|
|
5472
5306
|
}
|
|
5473
5307
|
return results;
|
|
5474
5308
|
}
|
|
5475
|
-
|
|
5476
|
-
// src/utils/content.ts
|
|
5477
|
-
function contentToString(content) {
|
|
5478
|
-
try {
|
|
5479
|
-
if (content == null) return "";
|
|
5480
|
-
if (typeof content === "string") return content;
|
|
5481
|
-
if (Array.isArray(content)) {
|
|
5482
|
-
return content.map((p) => {
|
|
5483
|
-
if (!p || typeof p !== "object") return String(p);
|
|
5484
|
-
if (p.type === "text") return String(p.text ?? "");
|
|
5485
|
-
if (p.type === "image_url") {
|
|
5486
|
-
const img = p.image_url;
|
|
5487
|
-
const url = typeof img === "string" ? img : img?.url;
|
|
5488
|
-
const detail = typeof img === "string" ? void 0 : img?.detail;
|
|
5489
|
-
return `[image:${url || "unknown"}${detail ? ` detail=${detail}` : ""}]`;
|
|
5490
|
-
}
|
|
5491
|
-
return JSON.stringify(p);
|
|
5492
|
-
}).join("\n");
|
|
5493
|
-
}
|
|
5494
|
-
return JSON.stringify(content);
|
|
5495
|
-
} catch {
|
|
5496
|
-
return String(content);
|
|
5497
|
-
}
|
|
5498
|
-
}
|
|
5499
|
-
function mergeContentsToString(contents) {
|
|
5500
|
-
return contents.map((c) => contentToString(c)).join("\n");
|
|
5501
|
-
}
|
|
5502
|
-
|
|
5503
|
-
// src/guardrails/checks.ts
|
|
5504
5309
|
var Ajv = AjvModule?.default ?? AjvModule;
|
|
5505
5310
|
var defaultAjv = new Ajv({ allErrors: true });
|
|
5506
5311
|
defaultAjv.opts.strict = false;
|
|
@@ -7484,6 +7289,6 @@ function createProvider(config) {
|
|
|
7484
7289
|
}
|
|
7485
7290
|
}
|
|
7486
7291
|
|
|
7487
|
-
export { AnthropicProvider, AzureProvider, BaseProvider, BedrockProvider, DEFAULT_PROFILE_CONFIGS, GuardrailPhase, InMemoryMemoryStore, NativeJsonSchemaStrategy, OpenAICompatibleProvider, OpenAIProvider, ProviderError, StructuredOutputManager, ToolBasedStrategy, VertexProvider, agentVerdictRule,
|
|
7292
|
+
export { AnthropicProvider, AzureProvider, BaseProvider, BedrockProvider, DEFAULT_PROFILE_CONFIGS, GuardrailPhase, InMemoryMemoryStore, NativeJsonSchemaStrategy, OpenAICompatibleProvider, OpenAIProvider, ProviderError, StructuredOutputManager, ToolBasedStrategy, VertexProvider, agentVerdictRule, buildSystemPrompt, captureSnapshot, codePresenceRule, cognipeerSink, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createCodeGuardrail, createContextSummarizeNode, createContextTools, createGuardrail, createJsonGuardrail, createProvider, createRegexGuardrail, createResolverNode, createSmartAgent, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, emptyUsage, evaluateGuardrails, fileSink, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, httpSink, isSmartModel, jsonSchemaRule, normalizeSmartAgentOptions, otlpSink, readMemoryFacts, regexRule, resolveMemoryStore, resolveStrategy, resolveToolApprovalState, restoreSnapshot, runSmartAgentEvalHarness, startStreamingSession, traceSessionToOtlp, withTools, writeSummaryFactsToMemory };
|
|
7488
7293
|
//# sourceMappingURL=index.mjs.map
|
|
7489
7294
|
//# sourceMappingURL=index.mjs.map
|