@theokit/sdk 4.54.0 → 4.55.0
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/CHANGELOG.md +96 -0
- package/dist/{agent-CIUgz7cN.d.cts → agent-D3Xr_-6Z.d.cts} +61 -6
- package/dist/{agent-DSec-E0c.d.ts → agent-DIu6FooJ.d.ts} +61 -6
- package/dist/{agent-VGD5WL4N.js → agent-HDEVVUBS.js} +7 -7
- package/dist/{agent-VGD5WL4N.js.map → agent-HDEVVUBS.js.map} +1 -1
- package/dist/{agent-NOEGF4GI.cjs → agent-R2HOJFZJ.cjs} +8 -8
- package/dist/{agent-NOEGF4GI.cjs.map → agent-R2HOJFZJ.cjs.map} +1 -1
- package/dist/{chunk-SSQZA3DZ.js → chunk-2BDH744Z.js} +3 -3
- package/dist/{chunk-SSQZA3DZ.js.map → chunk-2BDH744Z.js.map} +1 -1
- package/dist/chunk-6HTXPPHK.cjs +18 -0
- package/dist/{chunk-3KGLRRFC.cjs.map → chunk-6HTXPPHK.cjs.map} +1 -1
- package/dist/{chunk-UFAO4T7Z.cjs → chunk-F5WMX4EA.cjs} +114 -73
- package/dist/chunk-F5WMX4EA.cjs.map +1 -0
- package/dist/{chunk-UNDROG5N.cjs → chunk-HLPSLDGL.cjs} +94 -26
- package/dist/chunk-HLPSLDGL.cjs.map +1 -0
- package/dist/{chunk-TPTZA6NI.js → chunk-I5BE5M5L.js} +68 -27
- package/dist/chunk-I5BE5M5L.js.map +1 -0
- package/dist/{chunk-TTHBHAJI.cjs → chunk-ITSSOVOB.cjs} +4 -4
- package/dist/{chunk-TTHBHAJI.cjs.map → chunk-ITSSOVOB.cjs.map} +1 -1
- package/dist/{chunk-AGSBJD2L.js → chunk-IVNNSANC.js} +3 -3
- package/dist/{chunk-AGSBJD2L.js.map → chunk-IVNNSANC.js.map} +1 -1
- package/dist/{chunk-VDEWG5TV.js → chunk-MVAPK2BX.js} +77 -9
- package/dist/chunk-MVAPK2BX.js.map +1 -0
- package/dist/{chunk-RM7Y65IG.cjs → chunk-NIRE5CNO.cjs} +10 -3
- package/dist/{chunk-FXEUP75G.js.map → chunk-NIRE5CNO.cjs.map} +1 -1
- package/dist/{chunk-DUIF54UP.js → chunk-OHBIUXKM.js} +3 -3
- package/dist/{chunk-DUIF54UP.js.map → chunk-OHBIUXKM.js.map} +1 -1
- package/dist/{chunk-FXEUP75G.js → chunk-Q4CMI2LP.js} +9 -2
- package/dist/chunk-Q4CMI2LP.js.map +1 -0
- package/dist/{chunk-5BJV5UPY.cjs → chunk-V2UUGUY4.cjs} +3 -3
- package/dist/{chunk-5BJV5UPY.cjs.map → chunk-V2UUGUY4.cjs.map} +1 -1
- package/dist/{compact-session-K5LXTBPJ.js → compact-session-FUJDVF7B.js} +4 -4
- package/dist/{compact-session-K5LXTBPJ.js.map → compact-session-FUJDVF7B.js.map} +1 -1
- package/dist/{compact-session-YCT6JMBX.cjs → compact-session-LEWF554G.cjs} +12 -12
- package/dist/{compact-session-YCT6JMBX.cjs.map → compact-session-LEWF554G.cjs.map} +1 -1
- package/dist/{cron-DxxeQ-sK.d.cts → cron-BcWmzWzT.d.cts} +1 -1
- package/dist/{cron-CRwy2JBF.d.ts → cron-De6hzWCF.d.ts} +1 -1
- package/dist/cron.cjs +7 -7
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +6 -6
- package/dist/eval.cjs +6 -6
- package/dist/eval.js +5 -5
- package/dist/index.cjs +36 -36
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -8
- package/dist/{inject-session-DDR6X6PC.js → inject-session-BJMJH5BX.js} +3 -3
- package/dist/{inject-session-DDR6X6PC.js.map → inject-session-BJMJH5BX.js.map} +1 -1
- package/dist/{inject-session-XLO3KTBM.cjs → inject-session-WQGGMCQY.cjs} +4 -4
- package/dist/{inject-session-XLO3KTBM.cjs.map → inject-session-WQGGMCQY.cjs.map} +1 -1
- package/dist/internal/llm/prompt-cache-key.d.ts +1 -0
- package/dist/internal/llm/responses.d.ts +67 -1
- package/dist/internal/llm/types.d.ts +15 -0
- package/dist/internal/local-agent/real-local-run-tools.d.ts +17 -6
- package/dist/models.cjs +9 -9
- package/dist/models.js +1 -1
- package/dist/providers.cjs +4 -4
- package/dist/providers.js +2 -2
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/types/agent.d.ts +47 -5
- package/dist/types/provider-profile.d.ts +13 -0
- package/docs/error-codes.md +19 -19
- package/docs/harness-capability-map.md +2 -1
- package/package.json +1 -1
- package/dist/chunk-3KGLRRFC.cjs +0 -18
- package/dist/chunk-RM7Y65IG.cjs.map +0 -1
- package/dist/chunk-TPTZA6NI.js.map +0 -1
- package/dist/chunk-UFAO4T7Z.cjs.map +0 -1
- package/dist/chunk-UNDROG5N.cjs.map +0 -1
- package/dist/chunk-VDEWG5TV.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -8,9 +8,9 @@ require('./chunk-QDED6YO6.cjs');
|
|
|
8
8
|
var chunkGNT35C5U_cjs = require('./chunk-GNT35C5U.cjs');
|
|
9
9
|
require('./chunk-XWL6O3SW.cjs');
|
|
10
10
|
require('./chunk-VTYY7XL5.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
require('./chunk-
|
|
11
|
+
var chunkITSSOVOB_cjs = require('./chunk-ITSSOVOB.cjs');
|
|
12
|
+
var chunkF5WMX4EA_cjs = require('./chunk-F5WMX4EA.cjs');
|
|
13
|
+
require('./chunk-V2UUGUY4.cjs');
|
|
14
14
|
var chunk5UOVYM3P_cjs = require('./chunk-5UOVYM3P.cjs');
|
|
15
15
|
require('./chunk-53CBTBWO.cjs');
|
|
16
16
|
require('./chunk-BV2MWEMV.cjs');
|
|
@@ -19,7 +19,7 @@ require('./chunk-BUUUWQMB.cjs');
|
|
|
19
19
|
require('./chunk-EI2Q7SJ5.cjs');
|
|
20
20
|
require('./chunk-GHX4P3V2.cjs');
|
|
21
21
|
require('./chunk-YPJ5NH5N.cjs');
|
|
22
|
-
var
|
|
22
|
+
var chunkHLPSLDGL_cjs = require('./chunk-HLPSLDGL.cjs');
|
|
23
23
|
require('./chunk-F3YZMOAU.cjs');
|
|
24
24
|
require('./chunk-4OTIXDMU.cjs');
|
|
25
25
|
require('./chunk-DQKERTND.cjs');
|
|
@@ -51,8 +51,8 @@ require('./chunk-HJBMA5MB.cjs');
|
|
|
51
51
|
require('./chunk-IWBGCBR6.cjs');
|
|
52
52
|
require('./chunk-XSX2UU6Y.cjs');
|
|
53
53
|
var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
|
|
54
|
-
require('./chunk-
|
|
55
|
-
var
|
|
54
|
+
require('./chunk-6HTXPPHK.cjs');
|
|
55
|
+
var chunkNIRE5CNO_cjs = require('./chunk-NIRE5CNO.cjs');
|
|
56
56
|
require('./chunk-5USCYPPI.cjs');
|
|
57
57
|
require('./chunk-BVZW2B5V.cjs');
|
|
58
58
|
require('./chunk-52NKC5HT.cjs');
|
|
@@ -68,8 +68,8 @@ var fs = require('fs');
|
|
|
68
68
|
// src/agent-factory.ts
|
|
69
69
|
function createAgentFactory(common) {
|
|
70
70
|
return {
|
|
71
|
-
forSession: (agentId, overrides) =>
|
|
72
|
-
getOrCreate: (agentId, overrides) =>
|
|
71
|
+
forSession: (agentId, overrides) => chunkF5WMX4EA_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
|
|
72
|
+
getOrCreate: (agentId, overrides) => chunkF5WMX4EA_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
function mergeAgentOptions(common, overrides, agentId) {
|
|
@@ -643,8 +643,8 @@ var Provider = class _Provider {
|
|
|
643
643
|
* `.plugins(Provider.builtins())` once, then pick a `provider/model` id. @public
|
|
644
644
|
*/
|
|
645
645
|
static builtins() {
|
|
646
|
-
|
|
647
|
-
return
|
|
646
|
+
chunkNIRE5CNO_cjs.registerBuiltins();
|
|
647
|
+
return chunkNIRE5CNO_cjs.listProviders().map((profile) => defineProvider(profile));
|
|
648
648
|
}
|
|
649
649
|
/**
|
|
650
650
|
* The builtin serving `modelId`, or `undefined` when none does.
|
|
@@ -1265,7 +1265,7 @@ var Memory = {
|
|
|
1265
1265
|
return await peer.IndexManager.open(openArgs);
|
|
1266
1266
|
}
|
|
1267
1267
|
const { IndexManager } = await import('./index-manager-NG5YENWO.cjs');
|
|
1268
|
-
openArgs.embedding = await resolveEmbedding(opts.embedding,
|
|
1268
|
+
openArgs.embedding = await resolveEmbedding(opts.embedding, chunkF5WMX4EA_cjs.MEMORY_EMBEDDING_ADAPTERS);
|
|
1269
1269
|
return await IndexManager.open(openArgs);
|
|
1270
1270
|
},
|
|
1271
1271
|
/**
|
|
@@ -1276,7 +1276,7 @@ var Memory = {
|
|
|
1276
1276
|
*/
|
|
1277
1277
|
async runDreamingSweep(opts) {
|
|
1278
1278
|
const peer = await tryLoadSdkMemoryPeer();
|
|
1279
|
-
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS :
|
|
1279
|
+
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkF5WMX4EA_cjs.MEMORY_EMBEDDING_ADAPTERS;
|
|
1280
1280
|
const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
|
|
1281
1281
|
const result = peer !== null ? (
|
|
1282
1282
|
// biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
|
|
@@ -1840,7 +1840,7 @@ function isBuiltAgent(m) {
|
|
|
1840
1840
|
return typeof m.send === "function";
|
|
1841
1841
|
}
|
|
1842
1842
|
async function materialize(def, index) {
|
|
1843
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1843
|
+
const { Agent: Agent2 } = await import('./agent-R2HOJFZJ.cjs');
|
|
1844
1844
|
return Agent2.create({
|
|
1845
1845
|
// `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
|
|
1846
1846
|
// here means "declare nothing and let the default apply" — forwarding the literal would create
|
|
@@ -1982,7 +1982,7 @@ var FIXTURE_USER = {
|
|
|
1982
1982
|
};
|
|
1983
1983
|
var FIXTURE_MODELS = [
|
|
1984
1984
|
{
|
|
1985
|
-
id:
|
|
1985
|
+
id: chunkF5WMX4EA_cjs.DEFAULT_AGENTIC_MODEL_ID,
|
|
1986
1986
|
name: "Gemini 2.0 Flash",
|
|
1987
1987
|
displayName: "Gemini 2.0 Flash",
|
|
1988
1988
|
parameters: [
|
|
@@ -2058,7 +2058,7 @@ async function listLocalModelsViaOpenAiCompat(baseUrl) {
|
|
|
2058
2058
|
try {
|
|
2059
2059
|
response = await fetch(url, { method: "GET" });
|
|
2060
2060
|
} catch (fetchErr) {
|
|
2061
|
-
const mapped =
|
|
2061
|
+
const mapped = chunkHLPSLDGL_cjs.mapOllamaTransportError({
|
|
2062
2062
|
providerId: "ollama",
|
|
2063
2063
|
cause: fetchErr,
|
|
2064
2064
|
endpoint: "/v1/models"
|
|
@@ -2070,8 +2070,8 @@ async function listLocalModelsViaOpenAiCompat(baseUrl) {
|
|
|
2070
2070
|
);
|
|
2071
2071
|
}
|
|
2072
2072
|
if (!response.ok) {
|
|
2073
|
-
const body = await
|
|
2074
|
-
const mapped =
|
|
2073
|
+
const body = await chunkHLPSLDGL_cjs.readErrorResponseBody(response);
|
|
2074
|
+
const mapped = chunkHLPSLDGL_cjs.mapOllamaHttpError({
|
|
2075
2075
|
providerId: "ollama",
|
|
2076
2076
|
status: response.status,
|
|
2077
2077
|
body,
|
|
@@ -2134,9 +2134,9 @@ var Theokit = class {
|
|
|
2134
2134
|
});
|
|
2135
2135
|
},
|
|
2136
2136
|
capabilities: (providerOrModelId) => {
|
|
2137
|
-
|
|
2137
|
+
chunkNIRE5CNO_cjs.registerBuiltins();
|
|
2138
2138
|
const providerId = providerOrModelId.includes("/") ? providerOrModelId.split("/")[0] ?? providerOrModelId : providerOrModelId;
|
|
2139
|
-
return
|
|
2139
|
+
return chunkNIRE5CNO_cjs.getCatalogCapabilities(providerId);
|
|
2140
2140
|
}
|
|
2141
2141
|
};
|
|
2142
2142
|
/**
|
|
@@ -2175,8 +2175,8 @@ var Theokit = class {
|
|
|
2175
2175
|
*/
|
|
2176
2176
|
static inspect = {
|
|
2177
2177
|
builtinProviders: () => {
|
|
2178
|
-
|
|
2179
|
-
return
|
|
2178
|
+
chunkNIRE5CNO_cjs.registerBuiltins();
|
|
2179
|
+
return chunkNIRE5CNO_cjs.listProviders().map((p) => ({
|
|
2180
2180
|
name: p.name,
|
|
2181
2181
|
apiMode: p.apiMode,
|
|
2182
2182
|
authType: p.authType,
|
|
@@ -2185,7 +2185,7 @@ var Theokit = class {
|
|
|
2185
2185
|
envVars: p.envVars
|
|
2186
2186
|
}));
|
|
2187
2187
|
},
|
|
2188
|
-
embeddingAdapters: () => Object.entries(
|
|
2188
|
+
embeddingAdapters: () => Object.entries(chunkF5WMX4EA_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
|
|
2189
2189
|
id,
|
|
2190
2190
|
transport: adapter.transport,
|
|
2191
2191
|
defaultModel: adapter.defaultModel
|
|
@@ -2202,9 +2202,9 @@ var Theokit = class {
|
|
|
2202
2202
|
// and may be promoted onto Theokit once the agent.ts cycle is broken.
|
|
2203
2203
|
};
|
|
2204
2204
|
async function maybeListLocalModels(providerName) {
|
|
2205
|
-
|
|
2206
|
-
await
|
|
2207
|
-
const profile =
|
|
2205
|
+
chunkNIRE5CNO_cjs.registerBuiltins();
|
|
2206
|
+
await chunkHLPSLDGL_cjs.discoverProviderPlugins();
|
|
2207
|
+
const profile = chunkNIRE5CNO_cjs.getProviderProfile(providerName);
|
|
2208
2208
|
if (profile === void 0) return void 0;
|
|
2209
2209
|
if (profile.authType !== "none") return void 0;
|
|
2210
2210
|
const baseUrl = resolveLocalProviderBaseUrl(profile.name, profile.baseUrl);
|
|
@@ -2221,13 +2221,13 @@ async function executeCatalogRequest(request) {
|
|
|
2221
2221
|
if (apiKey === void 0) {
|
|
2222
2222
|
throw new chunkK3FW2XZD_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
2223
2223
|
}
|
|
2224
|
-
if (
|
|
2224
|
+
if (chunkHLPSLDGL_cjs.shouldUseFixtureMode(apiKey)) {
|
|
2225
2225
|
return request.fixture;
|
|
2226
2226
|
}
|
|
2227
|
-
if (!
|
|
2227
|
+
if (!chunkHLPSLDGL_cjs.isFixtureApiKey(apiKey) && process.env.THEOKIT_API_BASE_URL === void 0) {
|
|
2228
2228
|
throw new chunkK3FW2XZD_cjs.AuthenticationError("Invalid API key", { code: "authentication_error" });
|
|
2229
2229
|
}
|
|
2230
|
-
return
|
|
2230
|
+
return chunkHLPSLDGL_cjs.httpRequest(request.path, { apiKey });
|
|
2231
2231
|
}
|
|
2232
2232
|
|
|
2233
2233
|
// src/tool-blast-radius.ts
|
|
@@ -2404,35 +2404,35 @@ Object.defineProperty(exports, "fn", {
|
|
|
2404
2404
|
});
|
|
2405
2405
|
Object.defineProperty(exports, "Cron", {
|
|
2406
2406
|
enumerable: true,
|
|
2407
|
-
get: function () { return
|
|
2407
|
+
get: function () { return chunkITSSOVOB_cjs.Cron; }
|
|
2408
2408
|
});
|
|
2409
2409
|
Object.defineProperty(exports, "Agent", {
|
|
2410
2410
|
enumerable: true,
|
|
2411
|
-
get: function () { return
|
|
2411
|
+
get: function () { return chunkF5WMX4EA_cjs.Agent; }
|
|
2412
2412
|
});
|
|
2413
2413
|
Object.defineProperty(exports, "AgentBuilder", {
|
|
2414
2414
|
enumerable: true,
|
|
2415
|
-
get: function () { return
|
|
2415
|
+
get: function () { return chunkF5WMX4EA_cjs.AgentBuilder; }
|
|
2416
2416
|
});
|
|
2417
2417
|
Object.defineProperty(exports, "Tool", {
|
|
2418
2418
|
enumerable: true,
|
|
2419
|
-
get: function () { return
|
|
2419
|
+
get: function () { return chunkF5WMX4EA_cjs.Tool; }
|
|
2420
2420
|
});
|
|
2421
2421
|
Object.defineProperty(exports, "ToolError", {
|
|
2422
2422
|
enumerable: true,
|
|
2423
|
-
get: function () { return
|
|
2423
|
+
get: function () { return chunkF5WMX4EA_cjs.ToolError; }
|
|
2424
2424
|
});
|
|
2425
2425
|
Object.defineProperty(exports, "UsageAccumulator", {
|
|
2426
2426
|
enumerable: true,
|
|
2427
|
-
get: function () { return
|
|
2427
|
+
get: function () { return chunkF5WMX4EA_cjs.UsageAccumulator; }
|
|
2428
2428
|
});
|
|
2429
2429
|
Object.defineProperty(exports, "computeCost", {
|
|
2430
2430
|
enumerable: true,
|
|
2431
|
-
get: function () { return
|
|
2431
|
+
get: function () { return chunkF5WMX4EA_cjs.computeCost; }
|
|
2432
2432
|
});
|
|
2433
2433
|
Object.defineProperty(exports, "getPricingEntry", {
|
|
2434
2434
|
enumerable: true,
|
|
2435
|
-
get: function () { return
|
|
2435
|
+
get: function () { return chunkF5WMX4EA_cjs.getPricingEntry; }
|
|
2436
2436
|
});
|
|
2437
2437
|
Object.defineProperty(exports, "emitRunEvent", {
|
|
2438
2438
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-BgJH9PHi.cjs';
|
|
2
2
|
export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-BgJH9PHi.cjs';
|
|
3
|
-
import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-
|
|
4
|
-
export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as
|
|
3
|
+
import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-D3Xr_-6Z.cjs';
|
|
4
|
+
export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CreateSkillSpec, H as HookName, x as MemoryProviderFactory, y as MemoryProviderHandle, z as MemoryProviderInitOptions, D as PluginContext, E as PostAssistantReplyContext, F as PostToolCallContext, J as PreToolCallContext, K as PreUserSendContext, N as PreUserSendResult, O as ProviderTransform, Q as ProviderTransformContext, R as RecordSessionSummaryArgs, T as SessionLifecycleContext, U as SessionRecord, V as SessionStore, W as SettingSource, X as Skill, Y as SkillsResolver, Z as SkillsResolverContext, _ as SystemPromptContext, $ as SystemPromptMemoryFact, a0 as TelemetrySettings, a1 as ToolCallSummary, a2 as ToolResultTransformContext, a3 as TransformContext } from './agent-D3Xr_-6Z.cjs';
|
|
5
5
|
import { k as CostBreakdown, aw as TokenUsage, R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, T as ToolResultContentBlock, b as Run, P as Processor, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-BYSHf58D.cjs';
|
|
6
6
|
export { A as AgentConversationTurn, f as AssistantMessage, g as CompletionCheck, h as CompletionCheckResult, i as ConversationStep, j as ConversationTurn, k as CostBreakdown, l as CostSource, m as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, n as GenerateRunResult, I as ImageBlock, o as InputProcessorContext, p as InteractionUpdate, q as McpAuthConfig, r as McpHttpServerConfig, s as McpOAuthConfig, t as McpStdioServerConfig, u as MessageOrigin, v as ModelParameterValue, O as OutputProcessorContext, w as PartialToolCallUpdate, x as PermissionAction, y as PermissionEngineOptions, z as PermissionRule, B as ProcessorControls, E as ProcessorTripwire, F as ProcessorViolation, H as RunCompactBoundaryEvent, J as RunCompletionCheckEvent, K as RunErrorDetail, L as RunEvent, N as RunGitInfo, Q as RunOperation, U as RunPermissionDeniedEvent, V as RunRateLimitEvent, W as RunStatus, X as RunTaskCompletedEvent, Y as RunTaskStartedEvent, Z as RunTaskUpdatedEvent, _ as RunTimelineEvent, $ as RunToCompletionOptions, a0 as RunToCompletionResult, a1 as RunToolProgressEvent, a2 as RunTripwireEvent, a3 as SDKAssistantMessage, a4 as SDKImage, a5 as SDKImageDimension, a6 as SDKObjectDelta, a7 as SDKRequestMessage, a8 as SDKStatusMessage, a9 as SDKSystemMessage, aa as SDKTaskMessage, ab as SDKThinkingMessage, ac as SDKToolUseMessage, ad as SDKUserMessage, ae as SDKUserMessageEvent, af as SendOptions, ag as ShellCommand, ah as ShellConversationTurn, ai as ShellOutput, aj as ShellOutputDeltaUpdate, ak as StepCompletedUpdate, al as StepStartedUpdate, am as StreamToCompletionResult, an as SummaryCompletedUpdate, ao as SummaryStartedUpdate, ap as SummaryUpdate, aq as TextBlock, ar as TextDeltaUpdate, as as ThinkingCompletedUpdate, at as ThinkingDeltaUpdate, au as ThinkingMessage, av as TokenDeltaUpdate, aw as TokenUsage, ax as ToolCall, ay as ToolCallCompletedUpdate, az as ToolCallStartedUpdate, aA as ToolContextMessage, aB as ToolResult, aC as ToolResultGuardOptions, aD as ToolUseBlock, aE as TurnEndedUpdate, aF as UserMessage, aG as UserMessageAppendedUpdate, aH as applyMode, aI as emitRunEvent } from './run-BYSHf58D.cjs';
|
|
7
7
|
import * as zod from 'zod';
|
|
8
8
|
import { ZodType, z } from 'zod';
|
|
9
9
|
import { P as ProviderRoutingSettings, S as SDKAgent, C as ContextSettings, a as PluginsSettings, J as JudgeResult, G as GoalOptions, b as GoalEvent, c as GoalResult, M as MemoryId, d as SDKProvider } from './sdk-agent-DEoKhA8a.cjs';
|
|
10
10
|
export { A as AgentMemory, e as ContextBudget, f as ContextManagerKind, g as ContextSnapshot, h as ContextSource, i as ContextSourceStatus, I as InvalidateCacheOptions, j as MemoryAdapter, k as MemoryAdapterCapabilities, l as MemoryContext, m as MemoryFact, n as MemoryRevision, o as MemoryToolSchema, p as MemoryTurnMessage, q as PersonalityPreset, r as ProviderCapability, s as ProviderRoute, R as ResolvedProviderRoute, t as RunUntilIterator, u as SDKAgentPlugins, v as SDKAgentSkillDetail, w as SDKAgentSkills, x as SDKArtifact, y as SDKContextManager, z as SDKPluginMetadata, B as SDKProvidersManager, D as SystemPromptSkillRef, V as Verdict } from './sdk-agent-DEoKhA8a.cjs';
|
|
11
|
-
export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-
|
|
11
|
+
export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-BcWmzWzT.cjs';
|
|
12
12
|
import { StepResult } from './workflow.cjs';
|
|
13
13
|
export { Workflow, agentStep, fn } from './workflow.cjs';
|
|
14
14
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-C5fJUqLk.js';
|
|
2
2
|
export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-C5fJUqLk.js';
|
|
3
|
-
import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-
|
|
4
|
-
export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as
|
|
3
|
+
import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-DIu6FooJ.js';
|
|
4
|
+
export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CreateSkillSpec, H as HookName, x as MemoryProviderFactory, y as MemoryProviderHandle, z as MemoryProviderInitOptions, D as PluginContext, E as PostAssistantReplyContext, F as PostToolCallContext, J as PreToolCallContext, K as PreUserSendContext, N as PreUserSendResult, O as ProviderTransform, Q as ProviderTransformContext, R as RecordSessionSummaryArgs, T as SessionLifecycleContext, U as SessionRecord, V as SessionStore, W as SettingSource, X as Skill, Y as SkillsResolver, Z as SkillsResolverContext, _ as SystemPromptContext, $ as SystemPromptMemoryFact, a0 as TelemetrySettings, a1 as ToolCallSummary, a2 as ToolResultTransformContext, a3 as TransformContext } from './agent-DIu6FooJ.js';
|
|
5
5
|
import { k as CostBreakdown, aw as TokenUsage, R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, T as ToolResultContentBlock, b as Run, P as Processor, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-BYSHf58D.js';
|
|
6
6
|
export { A as AgentConversationTurn, f as AssistantMessage, g as CompletionCheck, h as CompletionCheckResult, i as ConversationStep, j as ConversationTurn, k as CostBreakdown, l as CostSource, m as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, n as GenerateRunResult, I as ImageBlock, o as InputProcessorContext, p as InteractionUpdate, q as McpAuthConfig, r as McpHttpServerConfig, s as McpOAuthConfig, t as McpStdioServerConfig, u as MessageOrigin, v as ModelParameterValue, O as OutputProcessorContext, w as PartialToolCallUpdate, x as PermissionAction, y as PermissionEngineOptions, z as PermissionRule, B as ProcessorControls, E as ProcessorTripwire, F as ProcessorViolation, H as RunCompactBoundaryEvent, J as RunCompletionCheckEvent, K as RunErrorDetail, L as RunEvent, N as RunGitInfo, Q as RunOperation, U as RunPermissionDeniedEvent, V as RunRateLimitEvent, W as RunStatus, X as RunTaskCompletedEvent, Y as RunTaskStartedEvent, Z as RunTaskUpdatedEvent, _ as RunTimelineEvent, $ as RunToCompletionOptions, a0 as RunToCompletionResult, a1 as RunToolProgressEvent, a2 as RunTripwireEvent, a3 as SDKAssistantMessage, a4 as SDKImage, a5 as SDKImageDimension, a6 as SDKObjectDelta, a7 as SDKRequestMessage, a8 as SDKStatusMessage, a9 as SDKSystemMessage, aa as SDKTaskMessage, ab as SDKThinkingMessage, ac as SDKToolUseMessage, ad as SDKUserMessage, ae as SDKUserMessageEvent, af as SendOptions, ag as ShellCommand, ah as ShellConversationTurn, ai as ShellOutput, aj as ShellOutputDeltaUpdate, ak as StepCompletedUpdate, al as StepStartedUpdate, am as StreamToCompletionResult, an as SummaryCompletedUpdate, ao as SummaryStartedUpdate, ap as SummaryUpdate, aq as TextBlock, ar as TextDeltaUpdate, as as ThinkingCompletedUpdate, at as ThinkingDeltaUpdate, au as ThinkingMessage, av as TokenDeltaUpdate, aw as TokenUsage, ax as ToolCall, ay as ToolCallCompletedUpdate, az as ToolCallStartedUpdate, aA as ToolContextMessage, aB as ToolResult, aC as ToolResultGuardOptions, aD as ToolUseBlock, aE as TurnEndedUpdate, aF as UserMessage, aG as UserMessageAppendedUpdate, aH as applyMode, aI as emitRunEvent } from './run-BYSHf58D.js';
|
|
7
7
|
import * as zod from 'zod';
|
|
8
8
|
import { ZodType, z } from 'zod';
|
|
9
9
|
import { P as ProviderRoutingSettings, S as SDKAgent, C as ContextSettings, a as PluginsSettings, J as JudgeResult, G as GoalOptions, b as GoalEvent, c as GoalResult, M as MemoryId, d as SDKProvider } from './sdk-agent-D8qJVkuV.js';
|
|
10
10
|
export { A as AgentMemory, e as ContextBudget, f as ContextManagerKind, g as ContextSnapshot, h as ContextSource, i as ContextSourceStatus, I as InvalidateCacheOptions, j as MemoryAdapter, k as MemoryAdapterCapabilities, l as MemoryContext, m as MemoryFact, n as MemoryRevision, o as MemoryToolSchema, p as MemoryTurnMessage, q as PersonalityPreset, r as ProviderCapability, s as ProviderRoute, R as ResolvedProviderRoute, t as RunUntilIterator, u as SDKAgentPlugins, v as SDKAgentSkillDetail, w as SDKAgentSkills, x as SDKArtifact, y as SDKContextManager, z as SDKPluginMetadata, B as SDKProvidersManager, D as SystemPromptSkillRef, V as Verdict } from './sdk-agent-D8qJVkuV.js';
|
|
11
|
-
export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-
|
|
11
|
+
export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-De6hzWCF.js';
|
|
12
12
|
import { StepResult } from './workflow.js';
|
|
13
13
|
export { Workflow, agentStep, fn } from './workflow.js';
|
|
14
14
|
|
package/dist/index.js
CHANGED
|
@@ -7,10 +7,10 @@ import { Workflow, agentStep } from './chunk-XV4IZNV4.js';
|
|
|
7
7
|
export { Workflow, agentStep, fn } from './chunk-XV4IZNV4.js';
|
|
8
8
|
import './chunk-AQLGBKNT.js';
|
|
9
9
|
import './chunk-HY66GLM6.js';
|
|
10
|
-
export { Cron } from './chunk-
|
|
11
|
-
import { MEMORY_EMBEDDING_ADAPTERS, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-
|
|
12
|
-
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-
|
|
13
|
-
import './chunk-
|
|
10
|
+
export { Cron } from './chunk-IVNNSANC.js';
|
|
11
|
+
import { MEMORY_EMBEDDING_ADAPTERS, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-I5BE5M5L.js';
|
|
12
|
+
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-I5BE5M5L.js';
|
|
13
|
+
import './chunk-OHBIUXKM.js';
|
|
14
14
|
import { lanceStoragePath, LanceIndex, readFactsFromMarkdown, defaultIndexPath, openMemoryDb, memoryDir } from './chunk-DAPSQZT4.js';
|
|
15
15
|
import './chunk-YMA4S2WO.js';
|
|
16
16
|
import './chunk-2SFBB54R.js';
|
|
@@ -20,7 +20,7 @@ import './chunk-K2BQQ445.js';
|
|
|
20
20
|
import './chunk-XN7NOENA.js';
|
|
21
21
|
import './chunk-H73MEMQB.js';
|
|
22
22
|
import './chunk-GJ6RK75E.js';
|
|
23
|
-
import { discoverProviderPlugins, shouldUseFixtureMode, isFixtureApiKey, httpRequest, mapOllamaTransportError, readErrorResponseBody, mapOllamaHttpError } from './chunk-
|
|
23
|
+
import { discoverProviderPlugins, shouldUseFixtureMode, isFixtureApiKey, httpRequest, mapOllamaTransportError, readErrorResponseBody, mapOllamaHttpError } from './chunk-MVAPK2BX.js';
|
|
24
24
|
import './chunk-3E77SX4H.js';
|
|
25
25
|
import './chunk-WTMU7J4U.js';
|
|
26
26
|
import './chunk-5JLFFPCH.js';
|
|
@@ -53,8 +53,8 @@ import './chunk-2QKTVKH3.js';
|
|
|
53
53
|
import './chunk-AG5JPQIY.js';
|
|
54
54
|
import './chunk-F7AQV62G.js';
|
|
55
55
|
import { parseModelId } from './chunk-R7WIIPUR.js';
|
|
56
|
-
import './chunk-
|
|
57
|
-
import { registerBuiltins, listProviders, getCatalogCapabilities, getProviderProfile } from './chunk-
|
|
56
|
+
import './chunk-2BDH744Z.js';
|
|
57
|
+
import { registerBuiltins, listProviders, getCatalogCapabilities, getProviderProfile } from './chunk-Q4CMI2LP.js';
|
|
58
58
|
import './chunk-44MBDIHG.js';
|
|
59
59
|
import './chunk-UQGQFBRL.js';
|
|
60
60
|
import './chunk-3OR54XG4.js';
|
|
@@ -1844,7 +1844,7 @@ function isBuiltAgent(m) {
|
|
|
1844
1844
|
return typeof m.send === "function";
|
|
1845
1845
|
}
|
|
1846
1846
|
async function materialize(def, index) {
|
|
1847
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1847
|
+
const { Agent: Agent2 } = await import('./agent-HDEVVUBS.js');
|
|
1848
1848
|
return Agent2.create({
|
|
1849
1849
|
// `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
|
|
1850
1850
|
// here means "declare nothing and let the default apply" — forwarding the literal would create
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { enqueueSessionWrite } from './chunk-
|
|
1
|
+
import { enqueueSessionWrite } from './chunk-OHBIUXKM.js';
|
|
2
2
|
import { invalidateSessionCache } from './chunk-WTMU7J4U.js';
|
|
3
3
|
import './chunk-BMAZLQQ4.js';
|
|
4
4
|
import { SessionTranscript } from './chunk-DZBSJX6J.js';
|
|
@@ -23,5 +23,5 @@ async function injectSessionTurn(opts) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export { injectSessionTurn };
|
|
26
|
-
//# sourceMappingURL=inject-session-
|
|
27
|
-
//# sourceMappingURL=inject-session-
|
|
26
|
+
//# sourceMappingURL=inject-session-BJMJH5BX.js.map
|
|
27
|
+
//# sourceMappingURL=inject-session-BJMJH5BX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-
|
|
1
|
+
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-BJMJH5BX.js","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkV2UUGUY4_cjs = require('./chunk-V2UUGUY4.cjs');
|
|
4
4
|
var chunk4OTIXDMU_cjs = require('./chunk-4OTIXDMU.cjs');
|
|
5
5
|
require('./chunk-CTCGWIUD.cjs');
|
|
6
6
|
var chunkJHPGF3FP_cjs = require('./chunk-JHPGF3FP.cjs');
|
|
@@ -10,7 +10,7 @@ require('./chunk-NUKRL3I6.cjs');
|
|
|
10
10
|
|
|
11
11
|
// src/internal/session/inject-session.ts
|
|
12
12
|
async function injectSessionTurn(opts) {
|
|
13
|
-
await
|
|
13
|
+
await chunkV2UUGUY4_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
14
14
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
15
15
|
const transcript = chunkJHPGF3FP_cjs.SessionTranscript.fromRecords(prior, {
|
|
16
16
|
cwd: opts.loc.cwd,
|
|
@@ -25,5 +25,5 @@ async function injectSessionTurn(opts) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
exports.injectSessionTurn = injectSessionTurn;
|
|
28
|
-
//# sourceMappingURL=inject-session-
|
|
29
|
-
//# sourceMappingURL=inject-session-
|
|
28
|
+
//# sourceMappingURL=inject-session-WQGGMCQY.cjs.map
|
|
29
|
+
//# sourceMappingURL=inject-session-WQGGMCQY.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-
|
|
1
|
+
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-WQGGMCQY.cjs","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,14 +8,80 @@ export interface ResponsesApiClientOptions {
|
|
|
8
8
|
/** Injected fetch (refresh-aware / dynamic headers). Defaults to global `fetch`. */
|
|
9
9
|
fetch?: typeof fetch;
|
|
10
10
|
providerName?: string;
|
|
11
|
+
/**
|
|
12
|
+
* usetheokit/theokit-sdk#383 — carry the model's ENCRYPTED reasoning across the rounds of a turn.
|
|
13
|
+
* Forwarded from `ProviderProfile.encryptedReasoning`; default off. See
|
|
14
|
+
* {@link ResponsesBodyOptions.encryptedReasoning} for what it puts on the wire and why it is
|
|
15
|
+
* opt-in rather than universal.
|
|
16
|
+
*/
|
|
17
|
+
encryptedReasoning?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* usetheokit/theokit-sdk#383 — one reasoning item the model produced, as it must be replayed.
|
|
21
|
+
*
|
|
22
|
+
* `encrypted_content` is opaque ciphertext only the provider can read; the SDK never inspects it,
|
|
23
|
+
* never logs it, and never persists it. It exists to be handed straight back.
|
|
24
|
+
*/
|
|
25
|
+
interface ResponsesReasoningItem {
|
|
26
|
+
id: string;
|
|
27
|
+
encrypted_content: string;
|
|
28
|
+
}
|
|
29
|
+
/** Options that shape the request body beyond what an `LlmRequest` carries. */
|
|
30
|
+
export interface ResponsesBodyOptions {
|
|
31
|
+
/**
|
|
32
|
+
* usetheokit/theokit-sdk#383 — when `true`, add `include: ["reasoning.encrypted_content"]` and
|
|
33
|
+
* `reasoning.context: "all_turns"`, and replay the reasoning items captured from earlier rounds.
|
|
34
|
+
*
|
|
35
|
+
* **What it buys.** With `store: false` the provider keeps nothing between requests, so a model
|
|
36
|
+
* that reasoned its way to a tool call in round 1 starts round 2 with no memory of that reasoning
|
|
37
|
+
* and derives it again — paid for again, every round. `include` asks the provider to return the
|
|
38
|
+
* reasoning as ciphertext; replaying that ciphertext on the next request hands the chain of
|
|
39
|
+
* thought back. Codex does exactly this against the same endpoint (issue #383 captured the
|
|
40
|
+
* request), which is the evidence that the backend accepts both fields.
|
|
41
|
+
*
|
|
42
|
+
* **Why opt-in and not on for every `responses_api` provider.** `include` is a documented
|
|
43
|
+
* Responses-API field, but `reasoning.context` is not part of the public Responses API surface —
|
|
44
|
+
* it was observed on the ChatGPT Codex backend. A provider that validates its input strictly
|
|
45
|
+
* answers an unknown key with `400`, which turns a cost optimisation into a total outage for that
|
|
46
|
+
* provider. Scoping it to profiles that DECLARE support keeps every other provider's request
|
|
47
|
+
* byte-identical to what it was, and makes enabling it a statement someone made about a specific
|
|
48
|
+
* backend rather than a hope about all of them.
|
|
49
|
+
*/
|
|
50
|
+
encryptedReasoning?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* usetheokit/theokit-sdk#383 — reasoning items captured from earlier rounds, keyed by the
|
|
53
|
+
* `call_id` of the tool call each batch preceded.
|
|
54
|
+
*
|
|
55
|
+
* Keying on `call_id` is what keeps the replay ORDERED and self-correcting. The provider requires
|
|
56
|
+
* a reasoning item to sit immediately before the output it produced, and the conversation history
|
|
57
|
+
* the loop replays is the authority on which tool calls survived and in what order — so emitting
|
|
58
|
+
* each batch just before its own `function_call` reproduces the original sequence without the
|
|
59
|
+
* transport having to track conversation positions. A batch whose tool call is no longer in
|
|
60
|
+
* history is simply never emitted.
|
|
61
|
+
*/
|
|
62
|
+
reasoningByCallId?: ReadonlyMap<string, readonly ResponsesReasoningItem[]>;
|
|
11
63
|
}
|
|
12
64
|
/** Build the Responses-API request body from an `LlmRequest`. */
|
|
13
|
-
export declare function buildResponsesBody(request: LlmRequest): Record<string, unknown>;
|
|
65
|
+
export declare function buildResponsesBody(request: LlmRequest, options?: ResponsesBodyOptions): Record<string, unknown>;
|
|
14
66
|
export declare class ResponsesApiClient implements LlmClient {
|
|
15
67
|
private readonly options;
|
|
16
68
|
readonly name: string;
|
|
17
69
|
private readonly baseUrl;
|
|
18
70
|
private readonly fetchImpl;
|
|
71
|
+
/**
|
|
72
|
+
* usetheokit/theokit-sdk#383 — reasoning ciphertext captured from earlier rounds, keyed by the
|
|
73
|
+
* `call_id` it preceded. Held on the CLIENT rather than threaded through `LlmRequest` because a
|
|
74
|
+
* round's reasoning is provider-shaped ciphertext with a provider-shaped ordering rule; the agent
|
|
75
|
+
* loop has no use for it and the same client instance serves every round of a turn. Insertion
|
|
76
|
+
* order is the eviction order (see {@link MAX_REMEMBERED_REASONING_CALLS}).
|
|
77
|
+
*/
|
|
78
|
+
private readonly reasoningByCallId;
|
|
19
79
|
constructor(options: ResponsesApiClientOptions);
|
|
80
|
+
/**
|
|
81
|
+
* usetheokit/theokit-sdk#383 — bind a batch of reasoning ciphertext to the tool call it produced,
|
|
82
|
+
* evicting the oldest binding once the cap is reached.
|
|
83
|
+
*/
|
|
84
|
+
private rememberReasoning;
|
|
20
85
|
stream(request: LlmRequest, signal: AbortSignal): AsyncGenerator<LlmEvent, LlmFinish, void>;
|
|
21
86
|
}
|
|
87
|
+
export {};
|
|
@@ -149,6 +149,21 @@ export interface LlmRequest {
|
|
|
149
149
|
* is still forced to produce a closing summary.
|
|
150
150
|
*/
|
|
151
151
|
toolChoice?: "auto" | "none" | "required";
|
|
152
|
+
/**
|
|
153
|
+
* usetheokit/theokit-sdk#383 — an opaque key identifying the conversation whose prompt prefix the
|
|
154
|
+
* provider may reuse across requests. Maps to the Responses-API `prompt_cache_key`.
|
|
155
|
+
*
|
|
156
|
+
* Set by the agent loop from the run's session identity and derived through
|
|
157
|
+
* `derivePromptCacheKey`, so it is STABLE across every round of a turn and every turn of a
|
|
158
|
+
* session, and DISTINCT between unrelated sessions. Both halves matter: a key that changes per
|
|
159
|
+
* round caches nothing, and a key shared across sessions asks the provider to match one
|
|
160
|
+
* conversation's prefix against another's.
|
|
161
|
+
*
|
|
162
|
+
* Absent ⇒ the field is omitted from the wire body (the pre-#383 request, byte for byte). It is
|
|
163
|
+
* a request-shaping hint only: no provider behaviour depends on its presence except the billing
|
|
164
|
+
* of the cached prefix.
|
|
165
|
+
*/
|
|
166
|
+
promptCacheKey?: string;
|
|
152
167
|
}
|
|
153
168
|
/**
|
|
154
169
|
* What a provider stream reports WHILE it is running. Tool calls are deliberately absent.
|
|
@@ -10,18 +10,29 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
|
-
import type { AgentDefinition, AgentOptions, CustomTool, ModelSelection } from "../../types/agent.js";
|
|
13
|
+
import type { AgentDefinition, AgentOptions, BuiltinToolName, CustomTool, ModelSelection } from "../../types/agent.js";
|
|
14
14
|
import type { CustomToolSpec } from "../agent-loop/loop-types.js";
|
|
15
15
|
/**
|
|
16
|
-
* Resolve the
|
|
16
|
+
* Resolve the tool-catalog slice of `AgentLoopInputs` for this run: which custom tools the loop
|
|
17
|
+
* declares, and which SDK builtins it must NOT.
|
|
17
18
|
*
|
|
18
|
-
* Precedence (matches the mcpServers semantics — "fully replaces, not merged"):
|
|
19
|
+
* Precedence for the custom half (matches the mcpServers semantics — "fully replaces, not merged"):
|
|
19
20
|
* - `sendOptions.tools === undefined` → fall back to `agentOptions.tools`
|
|
20
21
|
* - `sendOptions.tools = []` → explicitly clear (no custom tools)
|
|
21
22
|
* - `sendOptions.tools = [t1, ...]` → use exactly these for this run
|
|
23
|
+
*
|
|
24
|
+
* usetheokit/theokit-sdk#381 added the builtin half, and it is why this is no longer named for
|
|
25
|
+
* custom tools alone. It rides here rather than at the call site because the withhold list is
|
|
26
|
+
* part of the same answer — what this run declares to the model — and because a run that
|
|
27
|
+
* withholds nothing must produce the same `AgentLoopInputs` it produced before the option existed,
|
|
28
|
+
* which is easiest to guarantee where the rest of the catalog is already assembled.
|
|
29
|
+
*
|
|
30
|
+
* Note the two halves are independent: an agent with no custom tools at all can still withhold a
|
|
31
|
+
* builtin, so the "no tools" early return carries the withhold list out with it.
|
|
22
32
|
*/
|
|
23
|
-
export declare function
|
|
33
|
+
export declare function buildRunToolCatalogInput(agentOptions: AgentOptions, sendOptions: {
|
|
24
34
|
tools?: CustomTool[];
|
|
25
35
|
} | undefined, pluginManager: import("../plugins/manager.js").PluginManager | undefined, personalityToolWhitelist: ReadonlyArray<string> | undefined, agentId: string, personalityName: string | undefined, subagents: Record<string, AgentDefinition> | undefined, effectiveModel: ModelSelection | undefined): {
|
|
26
|
-
customTools
|
|
27
|
-
|
|
36
|
+
customTools?: ReadonlyArray<CustomToolSpec>;
|
|
37
|
+
withheldBuiltinTools?: ReadonlyArray<BuiltinToolName>;
|
|
38
|
+
};
|
package/dist/models.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkHY57ULY2_cjs = require('./chunk-HY57ULY2.cjs');
|
|
4
4
|
var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkNIRE5CNO_cjs = require('./chunk-NIRE5CNO.cjs');
|
|
6
6
|
require('./chunk-5USCYPPI.cjs');
|
|
7
7
|
require('./chunk-BVZW2B5V.cjs');
|
|
8
8
|
require('./chunk-52NKC5HT.cjs');
|
|
@@ -36,11 +36,11 @@ function capsFromCatalog(m) {
|
|
|
36
36
|
}
|
|
37
37
|
function resolveModelCapabilities(modelId) {
|
|
38
38
|
const bare = stripVariantSuffix(stripRoutingPrefix(modelId));
|
|
39
|
-
const fromIndex =
|
|
39
|
+
const fromIndex = chunkNIRE5CNO_cjs.getCatalogModelInfo(bare);
|
|
40
40
|
if (fromIndex !== void 0) return capsFromCatalog(fromIndex);
|
|
41
41
|
const withVendor = inferVendorPrefix(bare);
|
|
42
42
|
if (withVendor !== bare) {
|
|
43
|
-
const vendored =
|
|
43
|
+
const vendored = chunkNIRE5CNO_cjs.getCatalogModelInfo(withVendor);
|
|
44
44
|
if (vendored !== void 0) return capsFromCatalog(vendored);
|
|
45
45
|
}
|
|
46
46
|
return CONSERVATIVE_DEFAULTS;
|
|
@@ -132,7 +132,7 @@ function catalogTargets() {
|
|
|
132
132
|
if (_catalogTargets !== void 0) return _catalogTargets;
|
|
133
133
|
_catalogTargets = /* @__PURE__ */ new Map();
|
|
134
134
|
try {
|
|
135
|
-
for (const entry of Object.values(
|
|
135
|
+
for (const entry of Object.values(chunkNIRE5CNO_cjs.loadProviderCatalog())) {
|
|
136
136
|
const keys = [entry.id, ...entry.aliases ?? []];
|
|
137
137
|
for (const k of keys) {
|
|
138
138
|
if (!_catalogTargets.has(k)) _catalogTargets.set(k, { keys });
|
|
@@ -146,7 +146,7 @@ function resolvePatchKeys(externalId) {
|
|
|
146
146
|
const mapped = MODELS_DEV_ID_MAP[externalId] ?? externalId;
|
|
147
147
|
const fromCatalog = catalogTargets().get(mapped);
|
|
148
148
|
if (fromCatalog !== void 0) return fromCatalog.keys;
|
|
149
|
-
const profile =
|
|
149
|
+
const profile = chunkNIRE5CNO_cjs.getProviderProfile(mapped);
|
|
150
150
|
if (profile !== void 0) return [profile.name, ...profile.aliases ?? []];
|
|
151
151
|
return void 0;
|
|
152
152
|
}
|
|
@@ -163,9 +163,9 @@ function patchIndexFromApiJson(raw) {
|
|
|
163
163
|
continue;
|
|
164
164
|
}
|
|
165
165
|
for (const [modelId, rawModel] of Object.entries(models)) {
|
|
166
|
-
const parsed =
|
|
166
|
+
const parsed = chunkNIRE5CNO_cjs.catalogModelSchema.safeParse(rawModel);
|
|
167
167
|
if (!parsed.success) continue;
|
|
168
|
-
for (const key of keys)
|
|
168
|
+
for (const key of keys) chunkNIRE5CNO_cjs.patchModelInfo(`${key}/${modelId}`, parsed.data);
|
|
169
169
|
patched++;
|
|
170
170
|
}
|
|
171
171
|
}
|
|
@@ -206,7 +206,7 @@ function loadCacheIntoIndex(url = DEFAULT_URL) {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
async function refreshModelCatalog(opts = {}) {
|
|
209
|
-
|
|
209
|
+
chunkNIRE5CNO_cjs.registerBuiltins();
|
|
210
210
|
const kill = process.env.THEOKIT_DISABLE_MODELS_FETCH;
|
|
211
211
|
if (kill !== void 0 && kill !== "" && kill !== "0" && kill.toLowerCase() !== "false") {
|
|
212
212
|
return { source: "skipped", models: 0 };
|
|
@@ -269,7 +269,7 @@ async function refreshModelCatalog(opts = {}) {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
function getModelInfo(modelId) {
|
|
272
|
-
return
|
|
272
|
+
return chunkNIRE5CNO_cjs.getCatalogModelInfo(modelId);
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
Object.defineProperty(exports, "parseModelId", {
|
package/dist/models.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Retry } from './chunk-NLTVXLGT.js';
|
|
2
2
|
import { parseModelId } from './chunk-R7WIIPUR.js';
|
|
3
3
|
export { parseModelId } from './chunk-R7WIIPUR.js';
|
|
4
|
-
import { getCatalogModelInfo, registerBuiltins, catalogModelSchema, patchModelInfo, getProviderProfile, loadProviderCatalog } from './chunk-
|
|
4
|
+
import { getCatalogModelInfo, registerBuiltins, catalogModelSchema, patchModelInfo, getProviderProfile, loadProviderCatalog } from './chunk-Q4CMI2LP.js';
|
|
5
5
|
import './chunk-44MBDIHG.js';
|
|
6
6
|
import './chunk-UQGQFBRL.js';
|
|
7
7
|
import './chunk-3OR54XG4.js';
|