@theokit/sdk 4.30.0 → 4.31.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/CHANGELOG.md +57 -0
- package/dist/{agent-Ekv8y7_c.d.ts → agent-BJbGi8-R.d.ts} +1 -1
- package/dist/{agent-LD76RI74.cjs → agent-BKNJIOEY.cjs} +9 -9
- package/dist/{agent-LD76RI74.cjs.map → agent-BKNJIOEY.cjs.map} +1 -1
- package/dist/{agent-Bzg2_uGr.d.cts → agent-CbZPGFfM.d.cts} +1 -1
- package/dist/{agent-7YUGJJTU.js → agent-HW7OY2W3.js} +8 -8
- package/dist/{agent-7YUGJJTU.js.map → agent-HW7OY2W3.js.map} +1 -1
- package/dist/agent.d.ts +15 -2
- package/dist/{chunk-ISZ3MBUD.js → chunk-CCRWSZ2F.js} +57 -20
- package/dist/chunk-CCRWSZ2F.js.map +1 -0
- package/dist/chunk-CJVMDRQB.cjs +169 -0
- package/dist/chunk-CJVMDRQB.cjs.map +1 -0
- package/dist/{chunk-YU6KON2I.cjs → chunk-E2YEDATX.cjs} +6 -6
- package/dist/{chunk-YU6KON2I.cjs.map → chunk-E2YEDATX.cjs.map} +1 -1
- package/dist/{chunk-NG6B2PMA.cjs → chunk-GQBXBHZ2.cjs} +5 -5
- package/dist/{chunk-NG6B2PMA.cjs.map → chunk-GQBXBHZ2.cjs.map} +1 -1
- package/dist/{chunk-2HRYBRD7.cjs → chunk-IOOSAZZH.cjs} +8 -9
- package/dist/chunk-IOOSAZZH.cjs.map +1 -0
- package/dist/{chunk-2MF3IE2D.cjs → chunk-NZCFLEHO.cjs} +136 -25
- package/dist/chunk-NZCFLEHO.cjs.map +1 -0
- package/dist/{chunk-U6QGZHPN.js → chunk-RPKTXBPK.js} +5 -6
- package/dist/chunk-RPKTXBPK.js.map +1 -0
- package/dist/{chunk-GWMQ5CS3.cjs → chunk-S6F3FKFR.cjs} +87 -50
- package/dist/chunk-S6F3FKFR.cjs.map +1 -0
- package/dist/{chunk-SQLZ7ONU.js → chunk-SJLOIZ4Z.js} +4 -4
- package/dist/{chunk-SQLZ7ONU.js.map → chunk-SJLOIZ4Z.js.map} +1 -1
- package/dist/{chunk-4SXHEZIV.cjs → chunk-U2FO3MRG.cjs} +9 -3
- package/dist/chunk-U2FO3MRG.cjs.map +1 -0
- package/dist/chunk-UAYYNWYJ.js +163 -0
- package/dist/chunk-UAYYNWYJ.js.map +1 -0
- package/dist/{chunk-ZZWTY3RX.js → chunk-VGUOUAM2.js} +9 -4
- package/dist/chunk-VGUOUAM2.js.map +1 -0
- package/dist/{chunk-5YCAR23S.js → chunk-WYPHQ7NM.js} +3 -3
- package/dist/{chunk-5YCAR23S.js.map → chunk-WYPHQ7NM.js.map} +1 -1
- package/dist/{chunk-NRSH7RJY.js → chunk-XDNGF5BY.js} +133 -22
- package/dist/chunk-XDNGF5BY.js.map +1 -0
- package/dist/{compact-session-OO7NVWPB.cjs → compact-session-42BK7RE3.cjs} +12 -12
- package/dist/{compact-session-OO7NVWPB.cjs.map → compact-session-42BK7RE3.cjs.map} +1 -1
- package/dist/{compact-session-OO2GD76G.js → compact-session-QMBOCFVQ.js} +4 -4
- package/dist/{compact-session-OO2GD76G.js.map → compact-session-QMBOCFVQ.js.map} +1 -1
- package/dist/{cron-D0Z29gI-.d.ts → cron-BU9qD5B6.d.ts} +2 -2
- package/dist/{cron-CjzvXGT2.d.cts → cron-BwojPwEs.d.cts} +2 -2
- package/dist/cron.cjs +8 -8
- package/dist/cron.d.cts +3 -3
- package/dist/cron.d.ts +3 -3
- package/dist/cron.js +7 -7
- package/dist/{errors-DHZtSNnj.d.ts → errors-Cua4WC9H.d.ts} +1 -1
- package/dist/{errors-BdL-buYn.d.cts → errors-DyVbXdR4.d.cts} +1 -1
- package/dist/errors.d.cts +2 -2
- package/dist/errors.d.ts +2 -2
- package/dist/eval.cjs +11 -12
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +7 -8
- package/dist/eval.js.map +1 -1
- package/dist/fs-session-store-IIP7ZBYE.cjs +17 -0
- package/dist/{fs-session-store-KAUQYSGI.cjs.map → fs-session-store-IIP7ZBYE.cjs.map} +1 -1
- package/dist/fs-session-store-T7YPW5A4.js +8 -0
- package/dist/{fs-session-store-ZKB5NN37.js.map → fs-session-store-T7YPW5A4.js.map} +1 -1
- package/dist/index.cjs +29 -29
- package/dist/index.d.cts +23 -10
- package/dist/index.d.ts +23 -10
- package/dist/index.js +9 -9
- package/dist/{inject-session-6MJUSGZP.cjs → inject-session-6ZMCA2NE.cjs} +6 -6
- package/dist/{inject-session-6MJUSGZP.cjs.map → inject-session-6ZMCA2NE.cjs.map} +1 -1
- package/dist/{inject-session-KOFHS5K3.js → inject-session-YA3GQE4G.js} +4 -4
- package/dist/{inject-session-KOFHS5K3.js.map → inject-session-YA3GQE4G.js.map} +1 -1
- package/dist/internal/llm/abort-error.d.ts +1 -0
- package/dist/internal/llm/retrying-client.d.ts +53 -0
- package/dist/internal/llm/transport-error.d.ts +9 -0
- package/dist/internal/persistence/index.cjs +18 -19
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +1 -2
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/persistence/session-transcript.d.cts +13 -1
- package/dist/internal/persistence/session-transcript.d.ts +13 -1
- package/dist/internal/runtime/lifecycle/post-run-lifecycle.d.ts +1 -1
- package/dist/persistence.cjs +17 -14
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.d.cts +1 -1
- package/dist/persistence.d.ts +1 -1
- package/dist/persistence.js +2 -3
- package/dist/persistence.js.map +1 -1
- package/dist/{run-OJbGyweZ.d.cts → run-CwEJtLPE.d.cts} +8 -0
- package/dist/{run-OJbGyweZ.d.ts → run-CwEJtLPE.d.ts} +8 -0
- package/dist/server/errors-envelope.d.cts +3 -3
- package/dist/server/errors-envelope.d.ts +3 -3
- package/dist/{session-transcript-T7LGJUGW.js → session-transcript-5VZUWEJ5.js} +3 -3
- package/dist/{session-transcript-T7LGJUGW.js.map → session-transcript-5VZUWEJ5.js.map} +1 -1
- package/dist/session-transcript-T4SB66I7.cjs +50 -0
- package/dist/{session-transcript-LPNZR3YS.cjs.map → session-transcript-T4SB66I7.cjs.map} +1 -1
- package/dist/subagents-loader.d.cts +2 -2
- package/dist/subagents-loader.d.ts +2 -2
- package/dist/types/agent-prims.d.ts +8 -0
- package/package.json +1 -1
- package/dist/chunk-2HRYBRD7.cjs.map +0 -1
- package/dist/chunk-2MF3IE2D.cjs.map +0 -1
- package/dist/chunk-4SXHEZIV.cjs.map +0 -1
- package/dist/chunk-C7PICHRF.cjs +0 -68
- package/dist/chunk-C7PICHRF.cjs.map +0 -1
- package/dist/chunk-GWMQ5CS3.cjs.map +0 -1
- package/dist/chunk-HK7ZHSAX.cjs +0 -85
- package/dist/chunk-HK7ZHSAX.cjs.map +0 -1
- package/dist/chunk-HZQEDNF6.js +0 -66
- package/dist/chunk-HZQEDNF6.js.map +0 -1
- package/dist/chunk-ISZ3MBUD.js.map +0 -1
- package/dist/chunk-NRSH7RJY.js.map +0 -1
- package/dist/chunk-R6ZP6KNB.js +0 -80
- package/dist/chunk-R6ZP6KNB.js.map +0 -1
- package/dist/chunk-U6QGZHPN.js.map +0 -1
- package/dist/chunk-ZZWTY3RX.js.map +0 -1
- package/dist/fs-session-store-KAUQYSGI.cjs +0 -17
- package/dist/fs-session-store-ZKB5NN37.js +0 -8
- package/dist/session-transcript-LPNZR3YS.cjs +0 -46
package/dist/index.cjs
CHANGED
|
@@ -8,14 +8,14 @@ require('./chunk-EPYZOCOL.cjs');
|
|
|
8
8
|
var chunkZ2OC3UIW_cjs = require('./chunk-Z2OC3UIW.cjs');
|
|
9
9
|
require('./chunk-BWT67BI4.cjs');
|
|
10
10
|
require('./chunk-PNVDQL5Y.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var chunkGQBXBHZ2_cjs = require('./chunk-GQBXBHZ2.cjs');
|
|
12
|
+
var chunkS6F3FKFR_cjs = require('./chunk-S6F3FKFR.cjs');
|
|
13
13
|
require('./chunk-BV2MWEMV.cjs');
|
|
14
14
|
var chunkMZ5ZRORA_cjs = require('./chunk-MZ5ZRORA.cjs');
|
|
15
|
-
require('./chunk-
|
|
15
|
+
require('./chunk-E2YEDATX.cjs');
|
|
16
16
|
require('./chunk-BUUUWQMB.cjs');
|
|
17
|
-
require('./chunk-
|
|
18
|
-
var
|
|
17
|
+
require('./chunk-IOOSAZZH.cjs');
|
|
18
|
+
var chunkNZCFLEHO_cjs = require('./chunk-NZCFLEHO.cjs');
|
|
19
19
|
require('./chunk-LUSXDZPV.cjs');
|
|
20
20
|
require('./chunk-IT3PWBW4.cjs');
|
|
21
21
|
var chunkJLMXKTBX_cjs = require('./chunk-JLMXKTBX.cjs');
|
|
@@ -30,10 +30,10 @@ require('./chunk-YPEPCZHF.cjs');
|
|
|
30
30
|
require('./chunk-VJ26EKGJ.cjs');
|
|
31
31
|
require('./chunk-GIW4L6HY.cjs');
|
|
32
32
|
require('./chunk-7S7KKUO6.cjs');
|
|
33
|
-
require('./chunk-
|
|
33
|
+
require('./chunk-CJVMDRQB.cjs');
|
|
34
34
|
require('./chunk-JD74LN7R.cjs');
|
|
35
35
|
var chunkYLQQX5W2_cjs = require('./chunk-YLQQX5W2.cjs');
|
|
36
|
-
require('./chunk-
|
|
36
|
+
require('./chunk-U2FO3MRG.cjs');
|
|
37
37
|
require('./chunk-ANIZEWTU.cjs');
|
|
38
38
|
var chunkWJVHMTKB_cjs = require('./chunk-WJVHMTKB.cjs');
|
|
39
39
|
var chunkTIZ4TS5V_cjs = require('./chunk-TIZ4TS5V.cjs');
|
|
@@ -57,8 +57,8 @@ var fs = require('fs');
|
|
|
57
57
|
// src/agent-factory.ts
|
|
58
58
|
function createAgentFactory(common) {
|
|
59
59
|
return {
|
|
60
|
-
forSession: (agentId, overrides) =>
|
|
61
|
-
getOrCreate: (agentId, overrides) =>
|
|
60
|
+
forSession: (agentId, overrides) => chunkS6F3FKFR_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
|
|
61
|
+
getOrCreate: (agentId, overrides) => chunkS6F3FKFR_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
function mergeAgentOptions(common, overrides, agentId) {
|
|
@@ -1145,7 +1145,7 @@ var Memory = {
|
|
|
1145
1145
|
return await peer.IndexManager.open(openArgs);
|
|
1146
1146
|
}
|
|
1147
1147
|
const { IndexManager } = await import('./index-manager-H7HUMW52.cjs');
|
|
1148
|
-
openArgs.embedding = await resolveEmbedding(opts.embedding,
|
|
1148
|
+
openArgs.embedding = await resolveEmbedding(opts.embedding, chunkS6F3FKFR_cjs.MEMORY_EMBEDDING_ADAPTERS);
|
|
1149
1149
|
return await IndexManager.open(openArgs);
|
|
1150
1150
|
},
|
|
1151
1151
|
/**
|
|
@@ -1156,7 +1156,7 @@ var Memory = {
|
|
|
1156
1156
|
*/
|
|
1157
1157
|
async runDreamingSweep(opts) {
|
|
1158
1158
|
const peer = await tryLoadSdkMemoryPeer();
|
|
1159
|
-
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS :
|
|
1159
|
+
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkS6F3FKFR_cjs.MEMORY_EMBEDDING_ADAPTERS;
|
|
1160
1160
|
const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
|
|
1161
1161
|
const result = peer !== null ? (
|
|
1162
1162
|
// biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
|
|
@@ -1578,7 +1578,7 @@ function ehAgenteConstruido(m) {
|
|
|
1578
1578
|
return typeof m.send === "function";
|
|
1579
1579
|
}
|
|
1580
1580
|
async function materializar(def, indice) {
|
|
1581
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1581
|
+
const { Agent: Agent2 } = await import('./agent-BKNJIOEY.cjs');
|
|
1582
1582
|
return Agent2.create({
|
|
1583
1583
|
// `AgentDefinition.model` admite o sentinel `'inherit'`, que não é um id de modelo. Herdar
|
|
1584
1584
|
// aqui significa "não declare nada e deixe o default valer" — passar o literal adiante criaria
|
|
@@ -1720,7 +1720,7 @@ var FIXTURE_USER = {
|
|
|
1720
1720
|
};
|
|
1721
1721
|
var FIXTURE_MODELS = [
|
|
1722
1722
|
{
|
|
1723
|
-
id:
|
|
1723
|
+
id: chunkS6F3FKFR_cjs.DEFAULT_AGENTIC_MODEL_ID,
|
|
1724
1724
|
name: "Gemini 2.0 Flash",
|
|
1725
1725
|
displayName: "Gemini 2.0 Flash",
|
|
1726
1726
|
parameters: [
|
|
@@ -1796,7 +1796,7 @@ async function listLocalModelsViaOpenAiCompat(baseUrl) {
|
|
|
1796
1796
|
try {
|
|
1797
1797
|
response = await fetch(url, { method: "GET" });
|
|
1798
1798
|
} catch (fetchErr) {
|
|
1799
|
-
const mapped =
|
|
1799
|
+
const mapped = chunkNZCFLEHO_cjs.mapOllamaTransportError({
|
|
1800
1800
|
providerId: "ollama",
|
|
1801
1801
|
cause: fetchErr,
|
|
1802
1802
|
endpoint: "/v1/models"
|
|
@@ -1814,7 +1814,7 @@ async function listLocalModelsViaOpenAiCompat(baseUrl) {
|
|
|
1814
1814
|
body = JSON.parse(text);
|
|
1815
1815
|
} catch {
|
|
1816
1816
|
}
|
|
1817
|
-
const mapped =
|
|
1817
|
+
const mapped = chunkNZCFLEHO_cjs.mapOllamaHttpError({
|
|
1818
1818
|
providerId: "ollama",
|
|
1819
1819
|
status: response.status,
|
|
1820
1820
|
body,
|
|
@@ -1928,7 +1928,7 @@ var Theokit = class {
|
|
|
1928
1928
|
envVars: p.envVars
|
|
1929
1929
|
}));
|
|
1930
1930
|
},
|
|
1931
|
-
embeddingAdapters: () => Object.entries(
|
|
1931
|
+
embeddingAdapters: () => Object.entries(chunkS6F3FKFR_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
|
|
1932
1932
|
id,
|
|
1933
1933
|
transport: adapter.transport,
|
|
1934
1934
|
defaultModel: adapter.defaultModel
|
|
@@ -1946,7 +1946,7 @@ var Theokit = class {
|
|
|
1946
1946
|
};
|
|
1947
1947
|
async function maybeListLocalModels(providerName) {
|
|
1948
1948
|
chunkD42XHI4O_cjs.registerBuiltins();
|
|
1949
|
-
await
|
|
1949
|
+
await chunkNZCFLEHO_cjs.discoverProviderPlugins();
|
|
1950
1950
|
const profile = chunkD42XHI4O_cjs.getProviderProfile(providerName);
|
|
1951
1951
|
if (profile === void 0) return void 0;
|
|
1952
1952
|
if (profile.authType !== "none") return void 0;
|
|
@@ -1960,17 +1960,17 @@ function resolveLocalProviderBaseUrl(providerName, fallback) {
|
|
|
1960
1960
|
return fallback;
|
|
1961
1961
|
}
|
|
1962
1962
|
async function executeCatalogRequest(request) {
|
|
1963
|
-
const apiKey =
|
|
1963
|
+
const apiKey = chunkS6F3FKFR_cjs.resolveApiKey(request.apiKey);
|
|
1964
1964
|
if (apiKey === void 0) {
|
|
1965
1965
|
throw new chunkA44COQJJ_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
1966
1966
|
}
|
|
1967
|
-
if (
|
|
1967
|
+
if (chunkS6F3FKFR_cjs.shouldUseFixtureMode(apiKey)) {
|
|
1968
1968
|
return request.fixture;
|
|
1969
1969
|
}
|
|
1970
|
-
if (!
|
|
1970
|
+
if (!chunkS6F3FKFR_cjs.isFixtureApiKey(apiKey) && process.env.THEOKIT_API_BASE_URL === void 0) {
|
|
1971
1971
|
throw new chunkA44COQJJ_cjs.AuthenticationError("Invalid API key", { code: "authentication_error" });
|
|
1972
1972
|
}
|
|
1973
|
-
return
|
|
1973
|
+
return chunkS6F3FKFR_cjs.httpRequest(request.path, { apiKey });
|
|
1974
1974
|
}
|
|
1975
1975
|
|
|
1976
1976
|
// src/trajectory-helpers.ts
|
|
@@ -2086,35 +2086,35 @@ Object.defineProperty(exports, "GenerateObjectError", {
|
|
|
2086
2086
|
});
|
|
2087
2087
|
Object.defineProperty(exports, "Cron", {
|
|
2088
2088
|
enumerable: true,
|
|
2089
|
-
get: function () { return
|
|
2089
|
+
get: function () { return chunkGQBXBHZ2_cjs.Cron; }
|
|
2090
2090
|
});
|
|
2091
2091
|
Object.defineProperty(exports, "Agent", {
|
|
2092
2092
|
enumerable: true,
|
|
2093
|
-
get: function () { return
|
|
2093
|
+
get: function () { return chunkS6F3FKFR_cjs.Agent; }
|
|
2094
2094
|
});
|
|
2095
2095
|
Object.defineProperty(exports, "AgentBuilder", {
|
|
2096
2096
|
enumerable: true,
|
|
2097
|
-
get: function () { return
|
|
2097
|
+
get: function () { return chunkS6F3FKFR_cjs.AgentBuilder; }
|
|
2098
2098
|
});
|
|
2099
2099
|
Object.defineProperty(exports, "Tool", {
|
|
2100
2100
|
enumerable: true,
|
|
2101
|
-
get: function () { return
|
|
2101
|
+
get: function () { return chunkS6F3FKFR_cjs.Tool; }
|
|
2102
2102
|
});
|
|
2103
2103
|
Object.defineProperty(exports, "ToolError", {
|
|
2104
2104
|
enumerable: true,
|
|
2105
|
-
get: function () { return
|
|
2105
|
+
get: function () { return chunkS6F3FKFR_cjs.ToolError; }
|
|
2106
2106
|
});
|
|
2107
2107
|
Object.defineProperty(exports, "UsageAccumulator", {
|
|
2108
2108
|
enumerable: true,
|
|
2109
|
-
get: function () { return
|
|
2109
|
+
get: function () { return chunkS6F3FKFR_cjs.UsageAccumulator; }
|
|
2110
2110
|
});
|
|
2111
2111
|
Object.defineProperty(exports, "computeCost", {
|
|
2112
2112
|
enumerable: true,
|
|
2113
|
-
get: function () { return
|
|
2113
|
+
get: function () { return chunkS6F3FKFR_cjs.computeCost; }
|
|
2114
2114
|
});
|
|
2115
2115
|
Object.defineProperty(exports, "getPricingEntry", {
|
|
2116
2116
|
enumerable: true,
|
|
2117
|
-
get: function () { return
|
|
2117
|
+
get: function () { return chunkS6F3FKFR_cjs.getPricingEntry; }
|
|
2118
2118
|
});
|
|
2119
2119
|
Object.defineProperty(exports, "emitRunEvent", {
|
|
2120
2120
|
enumerable: true,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-
|
|
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-
|
|
3
|
-
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as Plugin$1, m as ProviderProfile, I as InlineSkill, J as JudgeResult, n as GoalOptions, o as GoalEvent, p as GoalResult, B as BudgetTracker, q as MemoryProvider, r as MemoryId, s as PreToolCallDecision, t as SDKProvider } from './agent-
|
|
4
|
-
export { u as ActiveMemoryPassArgs, v as ActiveMemoryPassResult, w as AgentMemory, x as BudgetCheck, y as BudgetTotal, z as BudgetUsageEvent, D as CloudEnv, E as CloudRepo, F as ContextBudget, H as ContextManagerKind, K as ContextSnapshot, N as ContextSource, O as ContextSourceStatus, Q as CreateSkillSpec, R as HookName, T as InvalidateCacheOptions, U as MemoryAdapter, V as MemoryAdapterCapabilities, W as MemoryContext, X as MemoryFact, Y as MemoryProviderHandle, Z as MemoryProviderInitOptions, _ as MemoryRevision, $ as MemoryToolSchema, a0 as MemoryTurnMessage, a1 as PersonalityPreset, a2 as PluginContext, a3 as PostAssistantReplyContext, a4 as PostToolCallContext, a5 as PreToolCallContext, a6 as PreUserSendContext, a7 as PreUserSendResult, a8 as ProviderCapability, a9 as ProviderRoute, aa as ProviderTransform, ab as ProviderTransformContext, ac as RecordSessionSummaryArgs, ad as ResolvedProviderRoute, ae as RunUntilIterator, af as SDKAgentPlugins, ag as SDKAgentSkillDetail, ah as SDKAgentSkills, ai as SDKArtifact, aj as SDKContextManager, ak as SDKPluginMetadata, al as SDKProvidersManager, am as SessionLifecycleContext, an as SessionRecord, ao as SessionStore, ap as SettingSource, aq as Skill, ar as SkillsResolver, as as SkillsResolverContext, at as SystemPromptContext, au as SystemPromptMemoryFact, av as SystemPromptSkillRef, aw as TelemetrySettings, ax as ToolCallSummary, ay as ToolResultTransformContext, az as TransformContext, aA as Verdict } from './agent-
|
|
5
|
-
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-
|
|
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 RunToCompletionOptions, $ as RunToCompletionResult, a0 as RunToolProgressEvent, a1 as RunTripwireEvent, a2 as SDKAssistantMessage, a3 as SDKImage, a4 as SDKImageDimension, a5 as SDKObjectDelta, a6 as SDKRequestMessage, a7 as SDKStatusMessage, a8 as SDKSystemMessage, a9 as SDKTaskMessage, aa as SDKThinkingMessage, ab as SDKToolUseMessage, ac as SDKUserMessage, ad as SDKUserMessageEvent, ae as SendOptions, af as ShellCommand, ag as ShellConversationTurn, ah as ShellOutput, ai as ShellOutputDeltaUpdate, aj as StepCompletedUpdate, ak as StepStartedUpdate, al as StreamToCompletionResult, am as SummaryCompletedUpdate, an as SummaryStartedUpdate, ao as SummaryUpdate, ap as TextBlock, aq as TextDeltaUpdate, ar as ThinkingCompletedUpdate, as as ThinkingDeltaUpdate, at as ThinkingMessage, au as TokenDeltaUpdate, av as TokenUsage, aw as ToolCall, ax as ToolCallCompletedUpdate, ay as ToolCallStartedUpdate, az as ToolContextMessage, aA as ToolResult, aB as ToolResultGuardOptions, aC as ToolUseBlock, aD as TurnEndedUpdate, aE as UserMessage, aF as UserMessageAppendedUpdate, aG as applyMode, aH as emitRunEvent } from './run-
|
|
1
|
+
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-DyVbXdR4.cjs';
|
|
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-DyVbXdR4.cjs';
|
|
3
|
+
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as Plugin$1, m as ProviderProfile, I as InlineSkill, J as JudgeResult, n as GoalOptions, o as GoalEvent, p as GoalResult, B as BudgetTracker, q as MemoryProvider, r as MemoryId, s as PreToolCallDecision, t as SDKProvider } from './agent-CbZPGFfM.cjs';
|
|
4
|
+
export { u as ActiveMemoryPassArgs, v as ActiveMemoryPassResult, w as AgentMemory, x as BudgetCheck, y as BudgetTotal, z as BudgetUsageEvent, D as CloudEnv, E as CloudRepo, F as ContextBudget, H as ContextManagerKind, K as ContextSnapshot, N as ContextSource, O as ContextSourceStatus, Q as CreateSkillSpec, R as HookName, T as InvalidateCacheOptions, U as MemoryAdapter, V as MemoryAdapterCapabilities, W as MemoryContext, X as MemoryFact, Y as MemoryProviderHandle, Z as MemoryProviderInitOptions, _ as MemoryRevision, $ as MemoryToolSchema, a0 as MemoryTurnMessage, a1 as PersonalityPreset, a2 as PluginContext, a3 as PostAssistantReplyContext, a4 as PostToolCallContext, a5 as PreToolCallContext, a6 as PreUserSendContext, a7 as PreUserSendResult, a8 as ProviderCapability, a9 as ProviderRoute, aa as ProviderTransform, ab as ProviderTransformContext, ac as RecordSessionSummaryArgs, ad as ResolvedProviderRoute, ae as RunUntilIterator, af as SDKAgentPlugins, ag as SDKAgentSkillDetail, ah as SDKAgentSkills, ai as SDKArtifact, aj as SDKContextManager, ak as SDKPluginMetadata, al as SDKProvidersManager, am as SessionLifecycleContext, an as SessionRecord, ao as SessionStore, ap as SettingSource, aq as Skill, ar as SkillsResolver, as as SkillsResolverContext, at as SystemPromptContext, au as SystemPromptMemoryFact, av as SystemPromptSkillRef, aw as TelemetrySettings, ax as ToolCallSummary, ay as ToolResultTransformContext, az as TransformContext, aA as Verdict } from './agent-CbZPGFfM.cjs';
|
|
5
|
+
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-CwEJtLPE.cjs';
|
|
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 RunToCompletionOptions, $ as RunToCompletionResult, a0 as RunToolProgressEvent, a1 as RunTripwireEvent, a2 as SDKAssistantMessage, a3 as SDKImage, a4 as SDKImageDimension, a5 as SDKObjectDelta, a6 as SDKRequestMessage, a7 as SDKStatusMessage, a8 as SDKSystemMessage, a9 as SDKTaskMessage, aa as SDKThinkingMessage, ab as SDKToolUseMessage, ac as SDKUserMessage, ad as SDKUserMessageEvent, ae as SendOptions, af as ShellCommand, ag as ShellConversationTurn, ah as ShellOutput, ai as ShellOutputDeltaUpdate, aj as StepCompletedUpdate, ak as StepStartedUpdate, al as StreamToCompletionResult, am as SummaryCompletedUpdate, an as SummaryStartedUpdate, ao as SummaryUpdate, ap as TextBlock, aq as TextDeltaUpdate, ar as ThinkingCompletedUpdate, as as ThinkingDeltaUpdate, at as ThinkingMessage, au as TokenDeltaUpdate, av as TokenUsage, aw as ToolCall, ax as ToolCallCompletedUpdate, ay as ToolCallStartedUpdate, az as ToolContextMessage, aA as ToolResult, aB as ToolResultGuardOptions, aC as ToolUseBlock, aD as TurnEndedUpdate, aE as UserMessage, aF as UserMessageAppendedUpdate, aG as applyMode, aH as emitRunEvent } from './run-CwEJtLPE.cjs';
|
|
7
7
|
import * as zod from 'zod';
|
|
8
8
|
import { ZodType, z } from 'zod';
|
|
9
|
-
import { S as StepResult } from './cron-
|
|
10
|
-
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-
|
|
9
|
+
import { S as StepResult } from './cron-BwojPwEs.cjs';
|
|
10
|
+
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-BwojPwEs.cjs';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Public compaction / context-management helpers (M2-1, extended V3-3).
|
|
@@ -590,8 +590,21 @@ declare class Agent {
|
|
|
590
590
|
* Caveats:
|
|
591
591
|
* - The function-level `agentId` always wins over `options.agentId`.
|
|
592
592
|
* - Options differ between calls? Last-call-wins for this handle (matches `Agent.resume`).
|
|
593
|
-
* -
|
|
594
|
-
*
|
|
593
|
+
* - A DISPOSED agent is replaced automatically. `dispose()` evicts the id from the
|
|
594
|
+
* live cache (`liveAgentRegistry.forget`), so the next `getOrCreate(id)` builds a
|
|
595
|
+
* fresh handle — no `Agent.delete(agentId)` needed.
|
|
596
|
+
*
|
|
597
|
+
* This bullet used to say the opposite ("Disposed agents are NOT auto-deleted...
|
|
598
|
+
* call `Agent.delete(agentId)` first"). It was measured false in M91:
|
|
599
|
+
* `tests/m91-getorcreate-apos-dispose.test.ts` builds an agent, disposes it, and
|
|
600
|
+
* gets a different instance back. The claim was about the PERSISTENT registry and
|
|
601
|
+
* read as being about the live cache — and consumers built around the wrong half.
|
|
602
|
+
* The agent-builder's M85 interrupt rotates the session id to work around a
|
|
603
|
+
* constraint that does not exist.
|
|
604
|
+
*
|
|
605
|
+
* - `close()` marks the handle disposed WITHOUT evicting the cache entry. It is
|
|
606
|
+
* internal and unused today; if it becomes reachable, this bullet stops being true
|
|
607
|
+
* for that path.
|
|
595
608
|
*
|
|
596
609
|
* @public
|
|
597
610
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-
|
|
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-
|
|
3
|
-
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as Plugin$1, m as ProviderProfile, I as InlineSkill, J as JudgeResult, n as GoalOptions, o as GoalEvent, p as GoalResult, B as BudgetTracker, q as MemoryProvider, r as MemoryId, s as PreToolCallDecision, t as SDKProvider } from './agent-
|
|
4
|
-
export { u as ActiveMemoryPassArgs, v as ActiveMemoryPassResult, w as AgentMemory, x as BudgetCheck, y as BudgetTotal, z as BudgetUsageEvent, D as CloudEnv, E as CloudRepo, F as ContextBudget, H as ContextManagerKind, K as ContextSnapshot, N as ContextSource, O as ContextSourceStatus, Q as CreateSkillSpec, R as HookName, T as InvalidateCacheOptions, U as MemoryAdapter, V as MemoryAdapterCapabilities, W as MemoryContext, X as MemoryFact, Y as MemoryProviderHandle, Z as MemoryProviderInitOptions, _ as MemoryRevision, $ as MemoryToolSchema, a0 as MemoryTurnMessage, a1 as PersonalityPreset, a2 as PluginContext, a3 as PostAssistantReplyContext, a4 as PostToolCallContext, a5 as PreToolCallContext, a6 as PreUserSendContext, a7 as PreUserSendResult, a8 as ProviderCapability, a9 as ProviderRoute, aa as ProviderTransform, ab as ProviderTransformContext, ac as RecordSessionSummaryArgs, ad as ResolvedProviderRoute, ae as RunUntilIterator, af as SDKAgentPlugins, ag as SDKAgentSkillDetail, ah as SDKAgentSkills, ai as SDKArtifact, aj as SDKContextManager, ak as SDKPluginMetadata, al as SDKProvidersManager, am as SessionLifecycleContext, an as SessionRecord, ao as SessionStore, ap as SettingSource, aq as Skill, ar as SkillsResolver, as as SkillsResolverContext, at as SystemPromptContext, au as SystemPromptMemoryFact, av as SystemPromptSkillRef, aw as TelemetrySettings, ax as ToolCallSummary, ay as ToolResultTransformContext, az as TransformContext, aA as Verdict } from './agent-
|
|
5
|
-
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-
|
|
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 RunToCompletionOptions, $ as RunToCompletionResult, a0 as RunToolProgressEvent, a1 as RunTripwireEvent, a2 as SDKAssistantMessage, a3 as SDKImage, a4 as SDKImageDimension, a5 as SDKObjectDelta, a6 as SDKRequestMessage, a7 as SDKStatusMessage, a8 as SDKSystemMessage, a9 as SDKTaskMessage, aa as SDKThinkingMessage, ab as SDKToolUseMessage, ac as SDKUserMessage, ad as SDKUserMessageEvent, ae as SendOptions, af as ShellCommand, ag as ShellConversationTurn, ah as ShellOutput, ai as ShellOutputDeltaUpdate, aj as StepCompletedUpdate, ak as StepStartedUpdate, al as StreamToCompletionResult, am as SummaryCompletedUpdate, an as SummaryStartedUpdate, ao as SummaryUpdate, ap as TextBlock, aq as TextDeltaUpdate, ar as ThinkingCompletedUpdate, as as ThinkingDeltaUpdate, at as ThinkingMessage, au as TokenDeltaUpdate, av as TokenUsage, aw as ToolCall, ax as ToolCallCompletedUpdate, ay as ToolCallStartedUpdate, az as ToolContextMessage, aA as ToolResult, aB as ToolResultGuardOptions, aC as ToolUseBlock, aD as TurnEndedUpdate, aE as UserMessage, aF as UserMessageAppendedUpdate, aG as applyMode, aH as emitRunEvent } from './run-
|
|
1
|
+
import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-Cua4WC9H.js';
|
|
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-Cua4WC9H.js';
|
|
3
|
+
import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as Plugin$1, m as ProviderProfile, I as InlineSkill, J as JudgeResult, n as GoalOptions, o as GoalEvent, p as GoalResult, B as BudgetTracker, q as MemoryProvider, r as MemoryId, s as PreToolCallDecision, t as SDKProvider } from './agent-BJbGi8-R.js';
|
|
4
|
+
export { u as ActiveMemoryPassArgs, v as ActiveMemoryPassResult, w as AgentMemory, x as BudgetCheck, y as BudgetTotal, z as BudgetUsageEvent, D as CloudEnv, E as CloudRepo, F as ContextBudget, H as ContextManagerKind, K as ContextSnapshot, N as ContextSource, O as ContextSourceStatus, Q as CreateSkillSpec, R as HookName, T as InvalidateCacheOptions, U as MemoryAdapter, V as MemoryAdapterCapabilities, W as MemoryContext, X as MemoryFact, Y as MemoryProviderHandle, Z as MemoryProviderInitOptions, _ as MemoryRevision, $ as MemoryToolSchema, a0 as MemoryTurnMessage, a1 as PersonalityPreset, a2 as PluginContext, a3 as PostAssistantReplyContext, a4 as PostToolCallContext, a5 as PreToolCallContext, a6 as PreUserSendContext, a7 as PreUserSendResult, a8 as ProviderCapability, a9 as ProviderRoute, aa as ProviderTransform, ab as ProviderTransformContext, ac as RecordSessionSummaryArgs, ad as ResolvedProviderRoute, ae as RunUntilIterator, af as SDKAgentPlugins, ag as SDKAgentSkillDetail, ah as SDKAgentSkills, ai as SDKArtifact, aj as SDKContextManager, ak as SDKPluginMetadata, al as SDKProvidersManager, am as SessionLifecycleContext, an as SessionRecord, ao as SessionStore, ap as SettingSource, aq as Skill, ar as SkillsResolver, as as SkillsResolverContext, at as SystemPromptContext, au as SystemPromptMemoryFact, av as SystemPromptSkillRef, aw as TelemetrySettings, ax as ToolCallSummary, ay as ToolResultTransformContext, az as TransformContext, aA as Verdict } from './agent-BJbGi8-R.js';
|
|
5
|
+
import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, b as Run, P as Processor, T as ToolResultContentBlock, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-CwEJtLPE.js';
|
|
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 RunToCompletionOptions, $ as RunToCompletionResult, a0 as RunToolProgressEvent, a1 as RunTripwireEvent, a2 as SDKAssistantMessage, a3 as SDKImage, a4 as SDKImageDimension, a5 as SDKObjectDelta, a6 as SDKRequestMessage, a7 as SDKStatusMessage, a8 as SDKSystemMessage, a9 as SDKTaskMessage, aa as SDKThinkingMessage, ab as SDKToolUseMessage, ac as SDKUserMessage, ad as SDKUserMessageEvent, ae as SendOptions, af as ShellCommand, ag as ShellConversationTurn, ah as ShellOutput, ai as ShellOutputDeltaUpdate, aj as StepCompletedUpdate, ak as StepStartedUpdate, al as StreamToCompletionResult, am as SummaryCompletedUpdate, an as SummaryStartedUpdate, ao as SummaryUpdate, ap as TextBlock, aq as TextDeltaUpdate, ar as ThinkingCompletedUpdate, as as ThinkingDeltaUpdate, at as ThinkingMessage, au as TokenDeltaUpdate, av as TokenUsage, aw as ToolCall, ax as ToolCallCompletedUpdate, ay as ToolCallStartedUpdate, az as ToolContextMessage, aA as ToolResult, aB as ToolResultGuardOptions, aC as ToolUseBlock, aD as TurnEndedUpdate, aE as UserMessage, aF as UserMessageAppendedUpdate, aG as applyMode, aH as emitRunEvent } from './run-CwEJtLPE.js';
|
|
7
7
|
import * as zod from 'zod';
|
|
8
8
|
import { ZodType, z } from 'zod';
|
|
9
|
-
import { S as StepResult } from './cron-
|
|
10
|
-
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-
|
|
9
|
+
import { S as StepResult } from './cron-BU9qD5B6.js';
|
|
10
|
+
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-BU9qD5B6.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Public compaction / context-management helpers (M2-1, extended V3-3).
|
|
@@ -590,8 +590,21 @@ declare class Agent {
|
|
|
590
590
|
* Caveats:
|
|
591
591
|
* - The function-level `agentId` always wins over `options.agentId`.
|
|
592
592
|
* - Options differ between calls? Last-call-wins for this handle (matches `Agent.resume`).
|
|
593
|
-
* -
|
|
594
|
-
*
|
|
593
|
+
* - A DISPOSED agent is replaced automatically. `dispose()` evicts the id from the
|
|
594
|
+
* live cache (`liveAgentRegistry.forget`), so the next `getOrCreate(id)` builds a
|
|
595
|
+
* fresh handle — no `Agent.delete(agentId)` needed.
|
|
596
|
+
*
|
|
597
|
+
* This bullet used to say the opposite ("Disposed agents are NOT auto-deleted...
|
|
598
|
+
* call `Agent.delete(agentId)` first"). It was measured false in M91:
|
|
599
|
+
* `tests/m91-getorcreate-apos-dispose.test.ts` builds an agent, disposes it, and
|
|
600
|
+
* gets a different instance back. The claim was about the PERSISTENT registry and
|
|
601
|
+
* read as being about the live cache — and consumers built around the wrong half.
|
|
602
|
+
* The agent-builder's M85 interrupt rotates the session id to work around a
|
|
603
|
+
* constraint that does not exist.
|
|
604
|
+
*
|
|
605
|
+
* - `close()` marks the handle disposed WITHOUT evicting the cache entry. It is
|
|
606
|
+
* internal and unused today; if it becomes reachable, this bullet stops being true
|
|
607
|
+
* for that path.
|
|
595
608
|
*
|
|
596
609
|
* @public
|
|
597
610
|
*/
|
package/dist/index.js
CHANGED
|
@@ -6,16 +6,16 @@ import './chunk-GJAGKFTR.js';
|
|
|
6
6
|
import { Workflow, agentStep } from './chunk-BFWPZMG7.js';
|
|
7
7
|
import './chunk-UVNG67DG.js';
|
|
8
8
|
import './chunk-CAH3G4IS.js';
|
|
9
|
-
export { Cron } from './chunk-
|
|
10
|
-
import { MEMORY_EMBEDDING_ADAPTERS, resolveApiKey, shouldUseFixtureMode, isFixtureApiKey, httpRequest, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-
|
|
11
|
-
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-
|
|
9
|
+
export { Cron } from './chunk-WYPHQ7NM.js';
|
|
10
|
+
import { MEMORY_EMBEDDING_ADAPTERS, resolveApiKey, shouldUseFixtureMode, isFixtureApiKey, httpRequest, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-CCRWSZ2F.js';
|
|
11
|
+
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-CCRWSZ2F.js';
|
|
12
12
|
import './chunk-2SFBB54R.js';
|
|
13
13
|
import { configure, submit, list, get, cancel, subscribe } from './chunk-HRA3CPGG.js';
|
|
14
14
|
export { emitRunEvent } from './chunk-HRA3CPGG.js';
|
|
15
|
-
import './chunk-
|
|
15
|
+
import './chunk-SJLOIZ4Z.js';
|
|
16
16
|
import './chunk-K2BQQ445.js';
|
|
17
|
-
import './chunk-
|
|
18
|
-
import { discoverProviderPlugins, mapOllamaTransportError, mapOllamaHttpError } from './chunk-
|
|
17
|
+
import './chunk-RPKTXBPK.js';
|
|
18
|
+
import { discoverProviderPlugins, mapOllamaTransportError, mapOllamaHttpError } from './chunk-XDNGF5BY.js';
|
|
19
19
|
import './chunk-6CLRANZA.js';
|
|
20
20
|
import './chunk-EEZ7CFMM.js';
|
|
21
21
|
import { lanceStoragePath, LanceIndex, readFactsFromMarkdown, defaultIndexPath, openMemoryDb, memoryDir } from './chunk-XAUBQMQU.js';
|
|
@@ -30,11 +30,11 @@ import './chunk-UJ7IQJAG.js';
|
|
|
30
30
|
import './chunk-7AD3ZTZL.js';
|
|
31
31
|
import './chunk-V4XRLPEF.js';
|
|
32
32
|
import './chunk-5PZMMF4H.js';
|
|
33
|
-
import './chunk-
|
|
33
|
+
import './chunk-UAYYNWYJ.js';
|
|
34
34
|
import './chunk-77FOZCOT.js';
|
|
35
35
|
import { withCwdMutex } from './chunk-2XLKLVVR.js';
|
|
36
36
|
export { withCwdMutex } from './chunk-2XLKLVVR.js';
|
|
37
|
-
import './chunk-
|
|
37
|
+
import './chunk-VGUOUAM2.js';
|
|
38
38
|
import './chunk-BXV2QUIC.js';
|
|
39
39
|
import { toJsonSchema } from './chunk-4VPXM6UU.js';
|
|
40
40
|
import { replaceFileAtomic } from './chunk-S2BBRVQX.js';
|
|
@@ -1580,7 +1580,7 @@ function ehAgenteConstruido(m) {
|
|
|
1580
1580
|
return typeof m.send === "function";
|
|
1581
1581
|
}
|
|
1582
1582
|
async function materializar(def, indice) {
|
|
1583
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1583
|
+
const { Agent: Agent2 } = await import('./agent-HW7OY2W3.js');
|
|
1584
1584
|
return Agent2.create({
|
|
1585
1585
|
// `AgentDefinition.model` admite o sentinel `'inherit'`, que não é um id de modelo. Herdar
|
|
1586
1586
|
// aqui significa "não declare nada e deixe o default valer" — passar o literal adiante criaria
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkE2YEDATX_cjs = require('./chunk-E2YEDATX.cjs');
|
|
4
4
|
var chunkIT3PWBW4_cjs = require('./chunk-IT3PWBW4.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkU2FO3MRG_cjs = require('./chunk-U2FO3MRG.cjs');
|
|
6
6
|
require('./chunk-TIZ4TS5V.cjs');
|
|
7
7
|
require('./chunk-BEURCLDV.cjs');
|
|
8
8
|
|
|
9
9
|
// src/internal/session/inject-session.ts
|
|
10
10
|
async function injectSessionTurn(opts) {
|
|
11
|
-
await
|
|
11
|
+
await chunkE2YEDATX_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
12
12
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
13
|
-
const transcript =
|
|
13
|
+
const transcript = chunkU2FO3MRG_cjs.SessionTranscript.fromRecords(prior, {
|
|
14
14
|
cwd: opts.loc.cwd,
|
|
15
15
|
sessionId: opts.sessionId,
|
|
16
16
|
model: opts.loc.model ?? "unknown"
|
|
@@ -23,5 +23,5 @@ async function injectSessionTurn(opts) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
exports.injectSessionTurn = injectSessionTurn;
|
|
26
|
-
//# sourceMappingURL=inject-session-
|
|
27
|
-
//# sourceMappingURL=inject-session-
|
|
26
|
+
//# sourceMappingURL=inject-session-6ZMCA2NE.cjs.map
|
|
27
|
+
//# sourceMappingURL=inject-session-6ZMCA2NE.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-6ZMCA2NE.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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { enqueueSessionWrite } from './chunk-
|
|
1
|
+
import { enqueueSessionWrite } from './chunk-SJLOIZ4Z.js';
|
|
2
2
|
import { invalidateSessionCache } from './chunk-EEZ7CFMM.js';
|
|
3
|
-
import { SessionTranscript } from './chunk-
|
|
3
|
+
import { SessionTranscript } from './chunk-VGUOUAM2.js';
|
|
4
4
|
import './chunk-S2BBRVQX.js';
|
|
5
5
|
import './chunk-JTFYYKDT.js';
|
|
6
6
|
|
|
@@ -21,5 +21,5 @@ async function injectSessionTurn(opts) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export { injectSessionTurn };
|
|
24
|
-
//# sourceMappingURL=inject-session-
|
|
25
|
-
//# sourceMappingURL=inject-session-
|
|
24
|
+
//# sourceMappingURL=inject-session-YA3GQE4G.js.map
|
|
25
|
+
//# sourceMappingURL=inject-session-YA3GQE4G.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-YA3GQE4G.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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { LlmClient, LlmEvent, LlmFinish, LlmRequest } from "./types.js";
|
|
2
|
+
/** Teto de tentativas. Fixo em 3 — o DoD do M93 nomeia o número. */
|
|
3
|
+
export declare const MAX_TENTATIVAS = 3;
|
|
4
|
+
/**
|
|
5
|
+
* O erro é transitório, isto é: reexecutar pode mudar o resultado?
|
|
6
|
+
*
|
|
7
|
+
* ## Delega para `isTransientError`, e diz o que subtrai
|
|
8
|
+
*
|
|
9
|
+
* O SDK **já** publica `isTransientError` — documentado como "a single source of truth rather than
|
|
10
|
+
* a re-derivation", e com o aviso explícito de que "It never inspects `err.message`". A primeira
|
|
11
|
+
* versão desta função ignorou as duas coisas: derivou de novo, por regex sobre a mensagem
|
|
12
|
+
* (`/\b4\d\d\b/`). A revisão adversarial mediu o custo — `connect ECONNREFUSED 127.0.0.1:443`
|
|
13
|
+
* era classificado como NÃO transitório, porque a **porta** casa a regex. Os erros de rede para os
|
|
14
|
+
* quais o retry existe eram exatamente os excluídos.
|
|
15
|
+
*
|
|
16
|
+
* Reinventar aqui foi violação da rung 4 da parcimônia com a peça pronta à mão. O que sobra desta
|
|
17
|
+
* função são **três subtrações** do veredito do dono, cada uma com razão:
|
|
18
|
+
*
|
|
19
|
+
* | Subtração | Por quê |
|
|
20
|
+
* |---|---|
|
|
21
|
+
* | `CredentialPoolExhaustedError` | o pool já gastou o próprio orçamento de tentativas e rotação; o `nextRetryAt` está em dezenas de segundos. Reexecutar multiplicaria a espera por `MAX_TENTATIVAS` sem chance de sucesso. |
|
|
22
|
+
* | `code === "circuit_open"` | o breaker existe **para** falhar rápido; envolvê-lo num retry desfaz de fora a decisão que ele acabou de tomar. |
|
|
23
|
+
* | `RateLimitError` com 402 | cota de faturamento não se resolve em milissegundos — é por isso que o `classifyAndDecide` do pool rotaciona em vez de esperar. |
|
|
24
|
+
*
|
|
25
|
+
* As duas primeiras vieram da medição da revisão: com elas transitórias, o pool inteiro era
|
|
26
|
+
* reexecutado 3×, e uma espera de 30 s virava ~90 s.
|
|
27
|
+
*/
|
|
28
|
+
export declare function ehTransitorio(err: unknown): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* ## Por que NÃO há circuit breaker aqui
|
|
31
|
+
*
|
|
32
|
+
* O `CircuitBreaker` do pacote é **chaveado por credencial** (`recordSuccess(key)` /
|
|
33
|
+
* `recordTimeout(key)`): existe para o pool marcar uma chave como insalubre e **pular** para outra. Com
|
|
34
|
+
* uma chave só não há para onde pular, então um breaker aqui registraria estado que ninguém consulta.
|
|
35
|
+
*
|
|
36
|
+
* Rung 1 da parcimônia — "isto precisa existir?". Não: seria cerimônia com nome de resiliência. O que
|
|
37
|
+
* protege o caminho de chave única é o teto de tentativas e o backoff, e os dois estão abaixo.
|
|
38
|
+
*/
|
|
39
|
+
export declare class RetryingLlmClient implements LlmClient {
|
|
40
|
+
#private;
|
|
41
|
+
constructor(inner: LlmClient, opts?: {
|
|
42
|
+
rng?: () => number;
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* O cliente decorado. Público pela mesma convenção de `FaultInjectingLlmClient.inner`: os testes
|
|
46
|
+
* de fiação do router afirmam `instanceof PoolAwareLlmClient` e precisam enxergar através dos
|
|
47
|
+
* decorators. Sem isto, adicionar um decorator quebra testes cuja intenção continua válida — que
|
|
48
|
+
* foi exatamente o que o M93 fez com 4 testes pré-existentes.
|
|
49
|
+
*/
|
|
50
|
+
get inner(): LlmClient;
|
|
51
|
+
get name(): string;
|
|
52
|
+
stream(request: LlmRequest, signal: AbortSignal): AsyncGenerator<LlmEvent, LlmFinish, void>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Envolve uma falha de socket num {@link NetworkError}, preservando a causa.
|
|
3
|
+
*
|
|
4
|
+
* Devolve o erro original — sem envolver — quando ele é um abort ou já é um erro do SDK.
|
|
5
|
+
*/
|
|
6
|
+
export declare function wrapTransportError(err: unknown, ctx: {
|
|
7
|
+
providerId: string;
|
|
8
|
+
endpoint: string;
|
|
9
|
+
}): unknown;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkHK7ZHSAX_cjs = require('../../chunk-HK7ZHSAX.cjs');
|
|
4
3
|
var chunkPNVDQL5Y_cjs = require('../../chunk-PNVDQL5Y.cjs');
|
|
5
4
|
var chunkOIYQBUW4_cjs = require('../../chunk-OIYQBUW4.cjs');
|
|
6
|
-
var
|
|
5
|
+
var chunkCJVMDRQB_cjs = require('../../chunk-CJVMDRQB.cjs');
|
|
7
6
|
var chunkJD74LN7R_cjs = require('../../chunk-JD74LN7R.cjs');
|
|
8
7
|
var chunkYLQQX5W2_cjs = require('../../chunk-YLQQX5W2.cjs');
|
|
9
8
|
var chunkTIZ4TS5V_cjs = require('../../chunk-TIZ4TS5V.cjs');
|
|
@@ -36,22 +35,6 @@ function casUpdate(db, sql, params, expectedChanges = 1) {
|
|
|
36
35
|
return result.changes === expectedChanges;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
Object.defineProperty(exports, "JsonlParseError", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function () { return chunkHK7ZHSAX_cjs.JsonlParseError; }
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(exports, "appendJsonl", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () { return chunkHK7ZHSAX_cjs.appendJsonl; }
|
|
46
|
-
});
|
|
47
|
-
Object.defineProperty(exports, "loadJsonl", {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
get: function () { return chunkHK7ZHSAX_cjs.loadJsonl; }
|
|
50
|
-
});
|
|
51
|
-
Object.defineProperty(exports, "readJsonlIds", {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
get: function () { return chunkHK7ZHSAX_cjs.readJsonlIds; }
|
|
54
|
-
});
|
|
55
38
|
Object.defineProperty(exports, "PersistenceSchema", {
|
|
56
39
|
enumerable: true,
|
|
57
40
|
get: function () { return chunkPNVDQL5Y_cjs.PersistenceSchema; }
|
|
@@ -80,9 +63,25 @@ Object.defineProperty(exports, "writeVersionedJson", {
|
|
|
80
63
|
enumerable: true,
|
|
81
64
|
get: function () { return chunkOIYQBUW4_cjs.writeVersionedJson; }
|
|
82
65
|
});
|
|
66
|
+
Object.defineProperty(exports, "JsonlParseError", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () { return chunkCJVMDRQB_cjs.JsonlParseError; }
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(exports, "appendJsonl", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () { return chunkCJVMDRQB_cjs.appendJsonl; }
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, "loadJsonl", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function () { return chunkCJVMDRQB_cjs.loadJsonl; }
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "readJsonlIds", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () { return chunkCJVMDRQB_cjs.readJsonlIds; }
|
|
81
|
+
});
|
|
83
82
|
Object.defineProperty(exports, "withFileLock", {
|
|
84
83
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunkCJVMDRQB_cjs.withFileLock; }
|
|
86
85
|
});
|
|
87
86
|
Object.defineProperty(exports, "applyWalWithFallback", {
|
|
88
87
|
enumerable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/internal/persistence/exclusive-create.ts","../../../src/internal/persistence/sqlite-cas.ts"],"names":["open"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/internal/persistence/exclusive-create.ts","../../../src/internal/persistence/sqlite-cas.ts"],"names":["open"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,eAAA,CACpB,IAAA,EACA,IAAA,EACA,OAAA,EACkB;AAClB,EAAA,MAAM,IAAA,GAAO,SAAS,IAAA,IAAQ,GAAA;AAC9B,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,MAAMA,aAAA,CAAK,IAAA,EAAM,MAAM,IAAI,CAAA;AAC1C,IAAA,IAAI;AACF,MAAA,MAAM,MAAA,CAAO,UAAU,IAAI,CAAA;AAC3B,MAAA,OAAO,IAAA;AAAA,IACT,CAAA,SAAE;AACA,MAAA,MAAM,OAAO,KAAA,EAAM;AAAA,IACrB;AAAA,EACF,SAAS,GAAA,EAAK;AACZ,IAAA,IAAK,GAAA,CAA8B,SAAS,QAAA,EAAU;AACpD,MAAA,OAAO,KAAA;AAAA,IACT;AACA,IAAA,MAAM,GAAA;AAAA,EACR;AACF;;;ACjBO,SAAS,SAAA,CACd,EAAA,EACA,GAAA,EACA,MAAA,EACA,kBAA0B,CAAA,EACjB;AACT,EAAA,MAAM,IAAA,GAAO,EAAA,CAAG,OAAA,CAAQ,GAAG,CAAA;AAC3B,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,GAAA,CAAI,GAAI,MAAoB,CAAA;AAChD,EAAA,OAAO,OAAO,OAAA,KAAY,eAAA;AAC5B","file":"index.cjs","sourcesContent":["/**\n * O_EXCL exclusive file creation (ADR D82).\n *\n * `createExclusive(path, data, { mode })` creates a file in a single\n * syscall (`open(path, \"wx\", mode)`). Returns `true` if created, `false`\n * if it already existed (EEXIST swallowed — caller decides). All other\n * errors propagate.\n *\n * Default mode is 0o600 (owner-only) — EC-2 fix from edge-case review:\n * token files, lockfiles, and PID files MUST NOT default to world-\n * readable 0o644 under typical umask 022. Callers writing non-sensitive\n * files can pass `mode: 0o644` explicitly.\n *\n * NFS sem honor de O_EXCL é documentado (D61 — mesma postura do\n * `withFileLock`); SDK target é ext4/APFS/NTFS.\n *\n * @internal\n */\n\nimport { open } from \"node:fs/promises\";\n\nexport interface CreateExclusiveOptions {\n /** Unix mode for the new file (default 0o600 — owner-only). */\n mode?: number;\n}\n\n/**\n * Atomically create `path` with `data`. Returns true iff this call\n * created the file (race-free under POSIX-compliant filesystems).\n *\n * @internal\n */\nexport async function createExclusive(\n path: string,\n data: string | Uint8Array,\n options?: CreateExclusiveOptions,\n): Promise<boolean> {\n const mode = options?.mode ?? 0o600;\n try {\n const handle = await open(path, \"wx\", mode);\n try {\n await handle.writeFile(data);\n return true;\n } finally {\n await handle.close();\n }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"EEXIST\") {\n return false;\n }\n throw err;\n }\n}\n","/**\n * SQLite optimistic compare-and-swap (ADR D83).\n *\n * `casUpdate(db, sql, params, expectedChanges)` executes a prepared\n * UPDATE and returns true if `result.changes === expectedChanges`.\n * Caller provides the full SQL (including `WHERE version = ?` predicate);\n * helper does NOT generate SQL — DRY at the level of \"wrap the\n * convention\", not \"build queries\".\n *\n * Use case canonical (Hermes `kanban_db.py:1922-1934`):\n *\n * const won = casUpdate(\n * db,\n * \"UPDATE registry SET status = ?, version = version + 1 WHERE id = ? AND version = ?\",\n * [\"running\", \"agent-foo\", 3],\n * );\n * if (!won) { ... re-read and retry ... }\n *\n * Helper does NOT retry — caller responsible for backoff (avoids hidden\n * loops). Helper does NOT cache prepared statements — `better-sqlite3`\n * caches internally; SDK use is one-shot per mutation, not hot loops.\n *\n * @internal\n */\n\nimport type Database from \"better-sqlite3\";\n\ntype DatabaseInstance = InstanceType<typeof Database>;\n\n/**\n * Execute a CAS UPDATE. Returns true iff the actual changes count matches\n * `expectedChanges`. SQL errors (invalid syntax, closed db) propagate.\n *\n * @internal\n */\nexport function casUpdate(\n db: DatabaseInstance,\n sql: string,\n params: ReadonlyArray<unknown>,\n expectedChanges: number = 1,\n): boolean {\n const stmt = db.prepare(sql);\n const result = stmt.run(...(params as unknown[]));\n return result.changes === expectedChanges;\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds } from '../../chunk-R6ZP6KNB.js';
|
|
2
1
|
export { PersistenceSchema } from '../../chunk-CAH3G4IS.js';
|
|
3
2
|
export { displayTheokitHome, getProfilesRoot, getTheokitHome, migrateSchema, readVersionedJson, writeVersionedJson } from '../../chunk-DGRZNMTU.js';
|
|
4
|
-
export { withFileLock } from '../../chunk-
|
|
3
|
+
export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds, withFileLock } from '../../chunk-UAYYNWYJ.js';
|
|
5
4
|
export { applyWalWithFallback, containsCjk, isCorruptionError, openSqliteResilient, sanitizeFts5Query } from '../../chunk-77FOZCOT.js';
|
|
6
5
|
export { withCwdMutex } from '../../chunk-2XLKLVVR.js';
|
|
7
6
|
export { atomicWriteJson, atomicWriteText, replaceFileAtomic } from '../../chunk-S2BBRVQX.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/internal/persistence/exclusive-create.ts","../../../src/internal/persistence/sqlite-cas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/internal/persistence/exclusive-create.ts","../../../src/internal/persistence/sqlite-cas.ts"],"names":[],"mappings":";;;;;;;;;;AAgCA,eAAsB,eAAA,CACpB,IAAA,EACA,IAAA,EACA,OAAA,EACkB;AAClB,EAAA,MAAM,IAAA,GAAO,SAAS,IAAA,IAAQ,GAAA;AAC9B,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,CAAK,IAAA,EAAM,MAAM,IAAI,CAAA;AAC1C,IAAA,IAAI;AACF,MAAA,MAAM,MAAA,CAAO,UAAU,IAAI,CAAA;AAC3B,MAAA,OAAO,IAAA;AAAA,IACT,CAAA,SAAE;AACA,MAAA,MAAM,OAAO,KAAA,EAAM;AAAA,IACrB;AAAA,EACF,SAAS,GAAA,EAAK;AACZ,IAAA,IAAK,GAAA,CAA8B,SAAS,QAAA,EAAU;AACpD,MAAA,OAAO,KAAA;AAAA,IACT;AACA,IAAA,MAAM,GAAA;AAAA,EACR;AACF;;;ACjBO,SAAS,SAAA,CACd,EAAA,EACA,GAAA,EACA,MAAA,EACA,kBAA0B,CAAA,EACjB;AACT,EAAA,MAAM,IAAA,GAAO,EAAA,CAAG,OAAA,CAAQ,GAAG,CAAA;AAC3B,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,GAAA,CAAI,GAAI,MAAoB,CAAA;AAChD,EAAA,OAAO,OAAO,OAAA,KAAY,eAAA;AAC5B","file":"index.js","sourcesContent":["/**\n * O_EXCL exclusive file creation (ADR D82).\n *\n * `createExclusive(path, data, { mode })` creates a file in a single\n * syscall (`open(path, \"wx\", mode)`). Returns `true` if created, `false`\n * if it already existed (EEXIST swallowed — caller decides). All other\n * errors propagate.\n *\n * Default mode is 0o600 (owner-only) — EC-2 fix from edge-case review:\n * token files, lockfiles, and PID files MUST NOT default to world-\n * readable 0o644 under typical umask 022. Callers writing non-sensitive\n * files can pass `mode: 0o644` explicitly.\n *\n * NFS sem honor de O_EXCL é documentado (D61 — mesma postura do\n * `withFileLock`); SDK target é ext4/APFS/NTFS.\n *\n * @internal\n */\n\nimport { open } from \"node:fs/promises\";\n\nexport interface CreateExclusiveOptions {\n /** Unix mode for the new file (default 0o600 — owner-only). */\n mode?: number;\n}\n\n/**\n * Atomically create `path` with `data`. Returns true iff this call\n * created the file (race-free under POSIX-compliant filesystems).\n *\n * @internal\n */\nexport async function createExclusive(\n path: string,\n data: string | Uint8Array,\n options?: CreateExclusiveOptions,\n): Promise<boolean> {\n const mode = options?.mode ?? 0o600;\n try {\n const handle = await open(path, \"wx\", mode);\n try {\n await handle.writeFile(data);\n return true;\n } finally {\n await handle.close();\n }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"EEXIST\") {\n return false;\n }\n throw err;\n }\n}\n","/**\n * SQLite optimistic compare-and-swap (ADR D83).\n *\n * `casUpdate(db, sql, params, expectedChanges)` executes a prepared\n * UPDATE and returns true if `result.changes === expectedChanges`.\n * Caller provides the full SQL (including `WHERE version = ?` predicate);\n * helper does NOT generate SQL — DRY at the level of \"wrap the\n * convention\", not \"build queries\".\n *\n * Use case canonical (Hermes `kanban_db.py:1922-1934`):\n *\n * const won = casUpdate(\n * db,\n * \"UPDATE registry SET status = ?, version = version + 1 WHERE id = ? AND version = ?\",\n * [\"running\", \"agent-foo\", 3],\n * );\n * if (!won) { ... re-read and retry ... }\n *\n * Helper does NOT retry — caller responsible for backoff (avoids hidden\n * loops). Helper does NOT cache prepared statements — `better-sqlite3`\n * caches internally; SDK use is one-shot per mutation, not hot loops.\n *\n * @internal\n */\n\nimport type Database from \"better-sqlite3\";\n\ntype DatabaseInstance = InstanceType<typeof Database>;\n\n/**\n * Execute a CAS UPDATE. Returns true iff the actual changes count matches\n * `expectedChanges`. SQL errors (invalid syntax, closed db) propagate.\n *\n * @internal\n */\nexport function casUpdate(\n db: DatabaseInstance,\n sql: string,\n params: ReadonlyArray<unknown>,\n expectedChanges: number = 1,\n): boolean {\n const stmt = db.prepare(sql);\n const result = stmt.run(...(params as unknown[]));\n return result.changes === expectedChanges;\n}\n"]}
|