@theokit/sdk 4.34.2 → 4.36.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 +14 -0
- package/dist/{agent-F77TRYGM.js → agent-H6HL5ITH.js} +5 -5
- package/dist/{agent-F77TRYGM.js.map → agent-H6HL5ITH.js.map} +1 -1
- package/dist/{agent-IJUQN6RK.cjs → agent-P77NPBF4.cjs} +6 -6
- package/dist/{agent-IJUQN6RK.cjs.map → agent-P77NPBF4.cjs.map} +1 -1
- package/dist/{chunk-P7SIIQIS.cjs → chunk-3XJ7CS2C.cjs} +7 -7
- package/dist/{chunk-P7SIIQIS.cjs.map → chunk-3XJ7CS2C.cjs.map} +1 -1
- package/dist/{chunk-RMRBHTA3.cjs → chunk-AIDNODHJ.cjs} +4 -4
- package/dist/{chunk-RMRBHTA3.cjs.map → chunk-AIDNODHJ.cjs.map} +1 -1
- package/dist/{chunk-QWP3ZQ75.js → chunk-BOTK6ZUP.js} +13 -4
- package/dist/chunk-BOTK6ZUP.js.map +1 -0
- package/dist/{chunk-JZSBSUFT.js → chunk-EKFA76N4.js} +4 -4
- package/dist/{chunk-JZSBSUFT.js.map → chunk-EKFA76N4.js.map} +1 -1
- package/dist/{chunk-MNLBNL7T.js → chunk-LEJXBUBD.js} +3 -3
- package/dist/{chunk-MNLBNL7T.js.map → chunk-LEJXBUBD.js.map} +1 -1
- package/dist/{chunk-4NU7GXH2.js → chunk-OKXUMCGM.js} +3 -3
- package/dist/{chunk-4NU7GXH2.js.map → chunk-OKXUMCGM.js.map} +1 -1
- package/dist/{chunk-BOTI6ZOX.cjs → chunk-Y66627E4.cjs} +5 -5
- package/dist/{chunk-BOTI6ZOX.cjs.map → chunk-Y66627E4.cjs.map} +1 -1
- package/dist/{chunk-AFOLLMVQ.cjs → chunk-YRXTIESB.cjs} +12 -2
- package/dist/chunk-YRXTIESB.cjs.map +1 -0
- package/dist/cron.cjs +5 -5
- package/dist/cron.js +4 -4
- package/dist/eval.cjs +4 -4
- package/dist/eval.js +3 -3
- package/dist/fs-session-store-4ALCDU3K.js +10 -0
- package/dist/{fs-session-store-Q3E5S7MC.js.map → fs-session-store-4ALCDU3K.js.map} +1 -1
- package/dist/{fs-session-store-2G4O63PO.cjs → fs-session-store-IQYE35HX.cjs} +5 -5
- package/dist/{fs-session-store-2G4O63PO.cjs.map → fs-session-store-IQYE35HX.cjs.map} +1 -1
- package/dist/index.cjs +23 -23
- package/dist/index.js +6 -6
- package/dist/persistence.cjs +7 -3
- package/dist/persistence.d.cts +1 -1
- package/dist/persistence.d.ts +1 -1
- package/dist/persistence.js +1 -1
- package/dist/subagents-loader.cjs +20 -5
- package/dist/subagents-loader.cjs.map +1 -1
- package/dist/subagents-loader.d.cts +18 -3
- package/dist/subagents-loader.d.ts +18 -3
- package/dist/subagents-loader.js +20 -5
- package/dist/subagents-loader.js.map +1 -1
- package/package.json +12 -13
- package/dist/chunk-AFOLLMVQ.cjs.map +0 -1
- package/dist/chunk-QWP3ZQ75.js.map +0 -1
- package/dist/fs-session-store-Q3E5S7MC.js +0 -10
package/dist/cron.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { Cron } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { Cron } from './chunk-LEJXBUBD.js';
|
|
2
|
+
import './chunk-EKFA76N4.js';
|
|
3
3
|
import './chunk-2SFBB54R.js';
|
|
4
4
|
import './chunk-HRA3CPGG.js';
|
|
5
5
|
import './chunk-7BTE3RXJ.js';
|
|
6
6
|
import './chunk-K2BQQ445.js';
|
|
7
|
-
import './chunk-
|
|
7
|
+
import './chunk-OKXUMCGM.js';
|
|
8
8
|
import './chunk-IX2LKBCD.js';
|
|
9
9
|
import './chunk-6CLRANZA.js';
|
|
10
10
|
import './chunk-EEZ7CFMM.js';
|
|
@@ -20,7 +20,7 @@ import './chunk-UJ7IQJAG.js';
|
|
|
20
20
|
import './chunk-7AD3ZTZL.js';
|
|
21
21
|
import './chunk-V4XRLPEF.js';
|
|
22
22
|
import './chunk-5PZMMF4H.js';
|
|
23
|
-
import './chunk-
|
|
23
|
+
import './chunk-BOTK6ZUP.js';
|
|
24
24
|
import './chunk-UAYYNWYJ.js';
|
|
25
25
|
import './chunk-77FOZCOT.js';
|
|
26
26
|
import './chunk-2XLKLVVR.js';
|
package/dist/eval.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkS7OEXQMI_cjs = require('./chunk-S7OEXQMI.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunk3XJ7CS2C_cjs = require('./chunk-3XJ7CS2C.cjs');
|
|
5
5
|
require('./chunk-BV2MWEMV.cjs');
|
|
6
6
|
require('./chunk-MZ5ZRORA.cjs');
|
|
7
7
|
require('./chunk-G4WI3VW2.cjs');
|
|
8
8
|
var chunkBUUUWQMB_cjs = require('./chunk-BUUUWQMB.cjs');
|
|
9
|
-
require('./chunk-
|
|
9
|
+
require('./chunk-AIDNODHJ.cjs');
|
|
10
10
|
require('./chunk-WEHUJ7ZS.cjs');
|
|
11
11
|
require('./chunk-LUSXDZPV.cjs');
|
|
12
12
|
require('./chunk-IT3PWBW4.cjs');
|
|
@@ -22,7 +22,7 @@ require('./chunk-YPEPCZHF.cjs');
|
|
|
22
22
|
require('./chunk-VJ26EKGJ.cjs');
|
|
23
23
|
require('./chunk-GIW4L6HY.cjs');
|
|
24
24
|
require('./chunk-7S7KKUO6.cjs');
|
|
25
|
-
require('./chunk-
|
|
25
|
+
require('./chunk-YRXTIESB.cjs');
|
|
26
26
|
var chunkCJVMDRQB_cjs = require('./chunk-CJVMDRQB.cjs');
|
|
27
27
|
require('./chunk-JD74LN7R.cjs');
|
|
28
28
|
require('./chunk-YLQQX5W2.cjs');
|
|
@@ -768,7 +768,7 @@ function makeDefaultEmbedder(opts) {
|
|
|
768
768
|
let runtime;
|
|
769
769
|
return (texts) => {
|
|
770
770
|
if (runtime === void 0) {
|
|
771
|
-
runtime =
|
|
771
|
+
runtime = chunk3XJ7CS2C_cjs.openRouterMemoryEmbeddingProviderAdapter.create(embedderCreateOptions(opts));
|
|
772
772
|
}
|
|
773
773
|
return runtime.then((rt) => rt.embed(texts));
|
|
774
774
|
};
|
package/dist/eval.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { shellEscapePosix, LocalSandbox } from './chunk-SKWVAQAY.js';
|
|
2
|
-
import { openRouterMemoryEmbeddingProviderAdapter } from './chunk-
|
|
2
|
+
import { openRouterMemoryEmbeddingProviderAdapter } from './chunk-EKFA76N4.js';
|
|
3
3
|
import './chunk-2SFBB54R.js';
|
|
4
4
|
import './chunk-HRA3CPGG.js';
|
|
5
5
|
import './chunk-7BTE3RXJ.js';
|
|
6
6
|
import { getTracer } from './chunk-K2BQQ445.js';
|
|
7
|
-
import './chunk-
|
|
7
|
+
import './chunk-OKXUMCGM.js';
|
|
8
8
|
import './chunk-IX2LKBCD.js';
|
|
9
9
|
import './chunk-6CLRANZA.js';
|
|
10
10
|
import './chunk-EEZ7CFMM.js';
|
|
@@ -20,7 +20,7 @@ import './chunk-UJ7IQJAG.js';
|
|
|
20
20
|
import './chunk-7AD3ZTZL.js';
|
|
21
21
|
import './chunk-V4XRLPEF.js';
|
|
22
22
|
import './chunk-5PZMMF4H.js';
|
|
23
|
-
import './chunk-
|
|
23
|
+
import './chunk-BOTK6ZUP.js';
|
|
24
24
|
import { readJsonlIds, appendJsonl } from './chunk-UAYYNWYJ.js';
|
|
25
25
|
export { JsonlParseError, loadJsonl } from './chunk-UAYYNWYJ.js';
|
|
26
26
|
import './chunk-77FOZCOT.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { FsSessionStore } from './chunk-OKXUMCGM.js';
|
|
2
|
+
import './chunk-BOTK6ZUP.js';
|
|
3
|
+
import './chunk-UAYYNWYJ.js';
|
|
4
|
+
import './chunk-2XLKLVVR.js';
|
|
5
|
+
import './chunk-Q56IYTBZ.js';
|
|
6
|
+
import './chunk-S2BBRVQX.js';
|
|
7
|
+
import './chunk-WLKFWQSJ.js';
|
|
8
|
+
import './chunk-JTFYYKDT.js';
|
|
9
|
+
//# sourceMappingURL=fs-session-store-4ALCDU3K.js.map
|
|
10
|
+
//# sourceMappingURL=fs-session-store-4ALCDU3K.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"fs-session-store-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"fs-session-store-4ALCDU3K.js"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkAIDNODHJ_cjs = require('./chunk-AIDNODHJ.cjs');
|
|
4
|
+
require('./chunk-YRXTIESB.cjs');
|
|
5
5
|
require('./chunk-CJVMDRQB.cjs');
|
|
6
6
|
require('./chunk-YLQQX5W2.cjs');
|
|
7
7
|
require('./chunk-2DYI7MIF.cjs');
|
|
@@ -13,7 +13,7 @@ require('./chunk-BEURCLDV.cjs');
|
|
|
13
13
|
|
|
14
14
|
Object.defineProperty(exports, "FsSessionStore", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkAIDNODHJ_cjs.FsSessionStore; }
|
|
17
17
|
});
|
|
18
|
-
//# sourceMappingURL=fs-session-store-
|
|
19
|
-
//# sourceMappingURL=fs-session-store-
|
|
18
|
+
//# sourceMappingURL=fs-session-store-IQYE35HX.cjs.map
|
|
19
|
+
//# sourceMappingURL=fs-session-store-IQYE35HX.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"fs-session-store-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"fs-session-store-IQYE35HX.cjs"}
|
package/dist/index.cjs
CHANGED
|
@@ -8,13 +8,13 @@ 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 chunkY66627E4_cjs = require('./chunk-Y66627E4.cjs');
|
|
12
|
+
var chunk3XJ7CS2C_cjs = require('./chunk-3XJ7CS2C.cjs');
|
|
13
13
|
require('./chunk-BV2MWEMV.cjs');
|
|
14
14
|
var chunkMZ5ZRORA_cjs = require('./chunk-MZ5ZRORA.cjs');
|
|
15
15
|
require('./chunk-G4WI3VW2.cjs');
|
|
16
16
|
require('./chunk-BUUUWQMB.cjs');
|
|
17
|
-
require('./chunk-
|
|
17
|
+
require('./chunk-AIDNODHJ.cjs');
|
|
18
18
|
var chunkWEHUJ7ZS_cjs = require('./chunk-WEHUJ7ZS.cjs');
|
|
19
19
|
require('./chunk-LUSXDZPV.cjs');
|
|
20
20
|
require('./chunk-IT3PWBW4.cjs');
|
|
@@ -30,7 +30,7 @@ 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-YRXTIESB.cjs');
|
|
34
34
|
require('./chunk-CJVMDRQB.cjs');
|
|
35
35
|
require('./chunk-JD74LN7R.cjs');
|
|
36
36
|
var chunkYLQQX5W2_cjs = require('./chunk-YLQQX5W2.cjs');
|
|
@@ -58,8 +58,8 @@ var fs = require('fs');
|
|
|
58
58
|
// src/agent-factory.ts
|
|
59
59
|
function createAgentFactory(common) {
|
|
60
60
|
return {
|
|
61
|
-
forSession: (agentId, overrides) =>
|
|
62
|
-
getOrCreate: (agentId, overrides) =>
|
|
61
|
+
forSession: (agentId, overrides) => chunk3XJ7CS2C_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
|
|
62
|
+
getOrCreate: (agentId, overrides) => chunk3XJ7CS2C_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
function mergeAgentOptions(common, overrides, agentId) {
|
|
@@ -1165,7 +1165,7 @@ var Memory = {
|
|
|
1165
1165
|
return await peer.IndexManager.open(openArgs);
|
|
1166
1166
|
}
|
|
1167
1167
|
const { IndexManager } = await import('./index-manager-H7HUMW52.cjs');
|
|
1168
|
-
openArgs.embedding = await resolveEmbedding(opts.embedding,
|
|
1168
|
+
openArgs.embedding = await resolveEmbedding(opts.embedding, chunk3XJ7CS2C_cjs.MEMORY_EMBEDDING_ADAPTERS);
|
|
1169
1169
|
return await IndexManager.open(openArgs);
|
|
1170
1170
|
},
|
|
1171
1171
|
/**
|
|
@@ -1176,7 +1176,7 @@ var Memory = {
|
|
|
1176
1176
|
*/
|
|
1177
1177
|
async runDreamingSweep(opts) {
|
|
1178
1178
|
const peer = await tryLoadSdkMemoryPeer();
|
|
1179
|
-
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS :
|
|
1179
|
+
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunk3XJ7CS2C_cjs.MEMORY_EMBEDDING_ADAPTERS;
|
|
1180
1180
|
const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
|
|
1181
1181
|
const result = peer !== null ? (
|
|
1182
1182
|
// biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
|
|
@@ -1598,7 +1598,7 @@ function ehAgenteConstruido(m) {
|
|
|
1598
1598
|
return typeof m.send === "function";
|
|
1599
1599
|
}
|
|
1600
1600
|
async function materializar(def, indice) {
|
|
1601
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1601
|
+
const { Agent: Agent2 } = await import('./agent-P77NPBF4.cjs');
|
|
1602
1602
|
return Agent2.create({
|
|
1603
1603
|
// `AgentDefinition.model` admite o sentinel `'inherit'`, que não é um id de modelo. Herdar
|
|
1604
1604
|
// aqui significa "não declare nada e deixe o default valer" — passar o literal adiante criaria
|
|
@@ -1740,7 +1740,7 @@ var FIXTURE_USER = {
|
|
|
1740
1740
|
};
|
|
1741
1741
|
var FIXTURE_MODELS = [
|
|
1742
1742
|
{
|
|
1743
|
-
id:
|
|
1743
|
+
id: chunk3XJ7CS2C_cjs.DEFAULT_AGENTIC_MODEL_ID,
|
|
1744
1744
|
name: "Gemini 2.0 Flash",
|
|
1745
1745
|
displayName: "Gemini 2.0 Flash",
|
|
1746
1746
|
parameters: [
|
|
@@ -1948,7 +1948,7 @@ var Theokit = class {
|
|
|
1948
1948
|
envVars: p.envVars
|
|
1949
1949
|
}));
|
|
1950
1950
|
},
|
|
1951
|
-
embeddingAdapters: () => Object.entries(
|
|
1951
|
+
embeddingAdapters: () => Object.entries(chunk3XJ7CS2C_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
|
|
1952
1952
|
id,
|
|
1953
1953
|
transport: adapter.transport,
|
|
1954
1954
|
defaultModel: adapter.defaultModel
|
|
@@ -1980,17 +1980,17 @@ function resolveLocalProviderBaseUrl(providerName, fallback) {
|
|
|
1980
1980
|
return fallback;
|
|
1981
1981
|
}
|
|
1982
1982
|
async function executeCatalogRequest(request) {
|
|
1983
|
-
const apiKey =
|
|
1983
|
+
const apiKey = chunk3XJ7CS2C_cjs.resolveApiKey(request.apiKey);
|
|
1984
1984
|
if (apiKey === void 0) {
|
|
1985
1985
|
throw new chunkA44COQJJ_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
1986
1986
|
}
|
|
1987
|
-
if (
|
|
1987
|
+
if (chunk3XJ7CS2C_cjs.shouldUseFixtureMode(apiKey)) {
|
|
1988
1988
|
return request.fixture;
|
|
1989
1989
|
}
|
|
1990
|
-
if (!
|
|
1990
|
+
if (!chunk3XJ7CS2C_cjs.isFixtureApiKey(apiKey) && process.env.THEOKIT_API_BASE_URL === void 0) {
|
|
1991
1991
|
throw new chunkA44COQJJ_cjs.AuthenticationError("Invalid API key", { code: "authentication_error" });
|
|
1992
1992
|
}
|
|
1993
|
-
return
|
|
1993
|
+
return chunk3XJ7CS2C_cjs.httpRequest(request.path, { apiKey });
|
|
1994
1994
|
}
|
|
1995
1995
|
|
|
1996
1996
|
// src/trajectory-helpers.ts
|
|
@@ -2106,35 +2106,35 @@ Object.defineProperty(exports, "GenerateObjectError", {
|
|
|
2106
2106
|
});
|
|
2107
2107
|
Object.defineProperty(exports, "Cron", {
|
|
2108
2108
|
enumerable: true,
|
|
2109
|
-
get: function () { return
|
|
2109
|
+
get: function () { return chunkY66627E4_cjs.Cron; }
|
|
2110
2110
|
});
|
|
2111
2111
|
Object.defineProperty(exports, "Agent", {
|
|
2112
2112
|
enumerable: true,
|
|
2113
|
-
get: function () { return
|
|
2113
|
+
get: function () { return chunk3XJ7CS2C_cjs.Agent; }
|
|
2114
2114
|
});
|
|
2115
2115
|
Object.defineProperty(exports, "AgentBuilder", {
|
|
2116
2116
|
enumerable: true,
|
|
2117
|
-
get: function () { return
|
|
2117
|
+
get: function () { return chunk3XJ7CS2C_cjs.AgentBuilder; }
|
|
2118
2118
|
});
|
|
2119
2119
|
Object.defineProperty(exports, "Tool", {
|
|
2120
2120
|
enumerable: true,
|
|
2121
|
-
get: function () { return
|
|
2121
|
+
get: function () { return chunk3XJ7CS2C_cjs.Tool; }
|
|
2122
2122
|
});
|
|
2123
2123
|
Object.defineProperty(exports, "ToolError", {
|
|
2124
2124
|
enumerable: true,
|
|
2125
|
-
get: function () { return
|
|
2125
|
+
get: function () { return chunk3XJ7CS2C_cjs.ToolError; }
|
|
2126
2126
|
});
|
|
2127
2127
|
Object.defineProperty(exports, "UsageAccumulator", {
|
|
2128
2128
|
enumerable: true,
|
|
2129
|
-
get: function () { return
|
|
2129
|
+
get: function () { return chunk3XJ7CS2C_cjs.UsageAccumulator; }
|
|
2130
2130
|
});
|
|
2131
2131
|
Object.defineProperty(exports, "computeCost", {
|
|
2132
2132
|
enumerable: true,
|
|
2133
|
-
get: function () { return
|
|
2133
|
+
get: function () { return chunk3XJ7CS2C_cjs.computeCost; }
|
|
2134
2134
|
});
|
|
2135
2135
|
Object.defineProperty(exports, "getPricingEntry", {
|
|
2136
2136
|
enumerable: true,
|
|
2137
|
-
get: function () { return
|
|
2137
|
+
get: function () { return chunk3XJ7CS2C_cjs.getPricingEntry; }
|
|
2138
2138
|
});
|
|
2139
2139
|
Object.defineProperty(exports, "emitRunEvent", {
|
|
2140
2140
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -6,15 +6,15 @@ 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-LEJXBUBD.js';
|
|
10
|
+
import { MEMORY_EMBEDDING_ADAPTERS, resolveApiKey, shouldUseFixtureMode, isFixtureApiKey, httpRequest, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-EKFA76N4.js';
|
|
11
|
+
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-EKFA76N4.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
15
|
import './chunk-7BTE3RXJ.js';
|
|
16
16
|
import './chunk-K2BQQ445.js';
|
|
17
|
-
import './chunk-
|
|
17
|
+
import './chunk-OKXUMCGM.js';
|
|
18
18
|
import { discoverProviderPlugins, mapOllamaTransportError, mapOllamaHttpError } from './chunk-IX2LKBCD.js';
|
|
19
19
|
import './chunk-6CLRANZA.js';
|
|
20
20
|
import './chunk-EEZ7CFMM.js';
|
|
@@ -30,7 +30,7 @@ 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-BOTK6ZUP.js';
|
|
34
34
|
import './chunk-UAYYNWYJ.js';
|
|
35
35
|
import './chunk-77FOZCOT.js';
|
|
36
36
|
import { withCwdMutex } from './chunk-2XLKLVVR.js';
|
|
@@ -1600,7 +1600,7 @@ function ehAgenteConstruido(m) {
|
|
|
1600
1600
|
return typeof m.send === "function";
|
|
1601
1601
|
}
|
|
1602
1602
|
async function materializar(def, indice) {
|
|
1603
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1603
|
+
const { Agent: Agent2 } = await import('./agent-H6HL5ITH.js');
|
|
1604
1604
|
return Agent2.create({
|
|
1605
1605
|
// `AgentDefinition.model` admite o sentinel `'inherit'`, que não é um id de modelo. Herdar
|
|
1606
1606
|
// aqui significa "não declare nada e deixe o default valer" — passar o literal adiante criaria
|
package/dist/persistence.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkPNVDQL5Y_cjs = require('./chunk-PNVDQL5Y.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkYRXTIESB_cjs = require('./chunk-YRXTIESB.cjs');
|
|
5
5
|
var chunkCJVMDRQB_cjs = require('./chunk-CJVMDRQB.cjs');
|
|
6
6
|
var chunkJD74LN7R_cjs = require('./chunk-JD74LN7R.cjs');
|
|
7
7
|
var chunkYLQQX5W2_cjs = require('./chunk-YLQQX5W2.cjs');
|
|
@@ -83,11 +83,15 @@ Object.defineProperty(exports, "PersistenceSchema", {
|
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "SessionBusyError", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkYRXTIESB_cjs.SessionBusyError; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "acquireSessionWriter", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunkYRXTIESB_cjs.acquireSessionWriter; }
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "sessaoTemEscritor", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () { return chunkYRXTIESB_cjs.sessaoTemEscritor; }
|
|
91
95
|
});
|
|
92
96
|
Object.defineProperty(exports, "JsonlParseError", {
|
|
93
97
|
enumerable: true,
|
package/dist/persistence.d.cts
CHANGED
|
@@ -22,7 +22,7 @@ export { sanitizeFts5Query } from "./internal/persistence/fts5-sanitize.js";
|
|
|
22
22
|
export { appendJsonl, JsonlParseError, loadJsonl, readJsonlIds, } from "./internal/persistence/jsonl.js";
|
|
23
23
|
export { PersistenceSchema } from "./internal/persistence/persistence-schema.js";
|
|
24
24
|
export { encodeProjectDir, transcriptPath, transcriptRoot, } from "./internal/persistence/session-transcript.js";
|
|
25
|
-
export { acquireSessionWriter, SessionBusyError, type SessionWriterLease, } from "./internal/persistence/session-writer.js";
|
|
25
|
+
export { acquireSessionWriter, SessionBusyError, type SessionWriterLease, sessaoTemEscritor, } from "./internal/persistence/session-writer.js";
|
|
26
26
|
export type { OpenSqliteResilientOptions, ResilientSqliteDb, } from "./internal/persistence/sqlite-open.js";
|
|
27
27
|
export { isCorruptionError, openSqliteResilient } from "./internal/persistence/sqlite-open.js";
|
|
28
28
|
export type { WalApplyResult } from "./internal/persistence/sqlite-wal.js";
|
package/dist/persistence.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export { sanitizeFts5Query } from "./internal/persistence/fts5-sanitize.js";
|
|
|
22
22
|
export { appendJsonl, JsonlParseError, loadJsonl, readJsonlIds, } from "./internal/persistence/jsonl.js";
|
|
23
23
|
export { PersistenceSchema } from "./internal/persistence/persistence-schema.js";
|
|
24
24
|
export { encodeProjectDir, transcriptPath, transcriptRoot, } from "./internal/persistence/session-transcript.js";
|
|
25
|
-
export { acquireSessionWriter, SessionBusyError, type SessionWriterLease, } from "./internal/persistence/session-writer.js";
|
|
25
|
+
export { acquireSessionWriter, SessionBusyError, type SessionWriterLease, sessaoTemEscritor, } from "./internal/persistence/session-writer.js";
|
|
26
26
|
export type { OpenSqliteResilientOptions, ResilientSqliteDb, } from "./internal/persistence/sqlite-open.js";
|
|
27
27
|
export { isCorruptionError, openSqliteResilient } from "./internal/persistence/sqlite-open.js";
|
|
28
28
|
export type { WalApplyResult } from "./internal/persistence/sqlite-wal.js";
|
package/dist/persistence.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { PersistenceSchema } from './chunk-CAH3G4IS.js';
|
|
2
|
-
export { SessionBusyError, acquireSessionWriter } from './chunk-
|
|
2
|
+
export { SessionBusyError, acquireSessionWriter, sessaoTemEscritor } from './chunk-BOTK6ZUP.js';
|
|
3
3
|
export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds, withFileLock } from './chunk-UAYYNWYJ.js';
|
|
4
4
|
export { applyWalWithFallback, isCorruptionError, openSqliteResilient, sanitizeFts5Query } from './chunk-77FOZCOT.js';
|
|
5
5
|
export { withCwdMutex } from './chunk-2XLKLVVR.js';
|
|
@@ -2,15 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkRZQ6E5YZ_cjs = require('./chunk-RZQ6E5YZ.cjs');
|
|
4
4
|
require('./chunk-LALRCFSN.cjs');
|
|
5
|
-
require('./chunk-A44COQJJ.cjs');
|
|
5
|
+
var chunkA44COQJJ_cjs = require('./chunk-A44COQJJ.cjs');
|
|
6
6
|
require('./chunk-BEURCLDV.cjs');
|
|
7
7
|
|
|
8
8
|
// src/subagents-loader.ts
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
var FONTES_ACEITAS = ["project"];
|
|
10
|
+
function resolverFontes(options) {
|
|
11
|
+
const declaradas = options?.settingSources;
|
|
12
|
+
if (declaradas === void 0) return FONTES_ACEITAS;
|
|
13
|
+
for (const fonte of declaradas) {
|
|
14
|
+
if (!FONTES_ACEITAS.includes(fonte)) {
|
|
15
|
+
throw new chunkA44COQJJ_cjs.ConfigurationError(
|
|
16
|
+
`Unknown subagent setting source "${String(fonte)}" (accepted: ${FONTES_ACEITAS.join(", ")})`,
|
|
17
|
+
{ code: "subagent_unknown_setting_source" }
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return declaradas;
|
|
11
22
|
}
|
|
12
|
-
async function
|
|
13
|
-
|
|
23
|
+
async function discoverSubagents(cwd, options) {
|
|
24
|
+
const fontes = resolverFontes(options);
|
|
25
|
+
return chunkRZQ6E5YZ_cjs.loadSubagents(cwd, fontes.includes("project"), void 0);
|
|
26
|
+
}
|
|
27
|
+
async function loadSubagentDefinition(name, cwd, options) {
|
|
28
|
+
return (await discoverSubagents(cwd, options))[name];
|
|
14
29
|
}
|
|
15
30
|
|
|
16
31
|
exports.discoverSubagents = discoverSubagents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/subagents-loader.ts"],"names":["loadSubagents"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/subagents-loader.ts"],"names":["ConfigurationError","loadSubagents"],"mappings":";;;;;;;;AAuCA,IAAM,cAAA,GAA4C,CAAC,SAAS,CAAA;AAgB5D,SAAS,eAAe,OAAA,EAA0E;AAChG,EAAA,MAAM,aAAa,OAAA,EAAS,cAAA;AAC5B,EAAA,IAAI,UAAA,KAAe,QAAW,OAAO,cAAA;AACrC,EAAA,KAAA,MAAW,SAAS,UAAA,EAAY;AAC9B,IAAA,IAAI,CAAC,cAAA,CAAe,QAAA,CAAS,KAAK,CAAA,EAAG;AACnC,MAAA,MAAM,IAAIA,oCAAA;AAAA,QACR,CAAA,iCAAA,EAAoC,OAAO,KAAK,CAAC,gBAAgB,cAAA,CAAe,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA,CAAA;AAAA,QAC1F,EAAE,MAAM,iCAAA;AAAkC,OAC5C;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,UAAA;AACT;AAOA,eAAsB,iBAAA,CACpB,KACA,OAAA,EAC0C;AAC1C,EAAA,MAAM,MAAA,GAAS,eAAe,OAAO,CAAA;AACrC,EAAA,OAAOC,gCAAc,GAAA,EAAK,MAAA,CAAO,QAAA,CAAS,SAAS,GAAG,MAAS,CAAA;AACjE;AAQA,eAAsB,sBAAA,CACpB,IAAA,EACA,GAAA,EACA,OAAA,EACsC;AACtC,EAAA,OAAA,CAAQ,MAAM,iBAAA,CAAkB,GAAA,EAAK,OAAO,GAAG,IAAI,CAAA;AACrD","file":"subagents-loader.cjs","sourcesContent":["/**\n * M81 — `.theokit/agents` discovery, exposed so a consumer can read the on-disk subagent\n * definitions with one import instead of hand-rolling a second parser.\n *\n * ## Why this file exists\n *\n * `src/skills.ts` already exposed `discoverSkills` for the sibling domain. Subagents had the same\n * loader — `internal/runtime/skills/subagents-loader.ts` — with no public door. A consumer behind\n * the layer boundary (the agent-builder never imports `@theokit/sdk*` directly) could not reach it,\n * so re-implementing was the only legal option. It re-implemented, and then wrote a test whose only\n * job was to watch the two parsers for drift. That test is the cleanest possible evidence that the\n * duplication should not exist.\n *\n * ## What crosses is the PARSED config\n *\n * The return is `AgentDefinition` — already interpreted — never the `.md` text or the frontmatter\n * shape. Exporting the file format would freeze an internal detail as public API; exporting the\n * parsed value leaves the format free to change.\n */\n\nimport { ConfigurationError } from \"./errors.js\";\nimport { loadSubagents } from \"./internal/runtime/skills/subagents-loader.js\";\nimport type { AgentDefinition } from \"./types/agent.js\";\n\n/**\n * The parsed subagent definition this module hands back.\n *\n * Re-exported here — beside the loader that produces it — so a consumer can NAME the value it\n * receives without reaching into `types/agent`, which no subpath publishes. A layer above may then\n * alias it (`AgentDefinition as SubagentDefinition`) to sidestep a name it has already spent.\n */\nexport type { AgentDefinition } from \"./types/agent.js\";\n\n/**\n * Where subagent definitions may be read from. A closed union rather than a boolean: a third\n * source can join it without breaking the signature, and the call site reads as what it means.\n */\nexport type SubagentSource = \"project\";\n\nconst FONTES_ACEITAS: readonly SubagentSource[] = [\"project\"];\n\n/** Options for {@link discoverSubagents} / {@link loadSubagentDefinition}. */\nexport interface DiscoverSubagentsOptions {\n /**\n * Which sources to read. Defaults to `[\"project\"]` — `<cwd>/.theokit/agents/*.md`.\n *\n * An empty list reads NOTHING: the directory is never opened, so a caller that has not yet\n * established trust in `cwd` can decline the read rather than filter its result.\n */\n readonly settingSources?: readonly SubagentSource[];\n}\n\n// Validated at the boundary (error-handling.md § 2): the union is erased at runtime, so a JS\n// caller — or a value crossing a serialization hop — can still carry a source nobody honors.\n// Dropping it silently would read as \"no subagents found\", which is the same shape as success.\nfunction resolverFontes(options: DiscoverSubagentsOptions | undefined): readonly SubagentSource[] {\n const declaradas = options?.settingSources;\n if (declaradas === undefined) return FONTES_ACEITAS;\n for (const fonte of declaradas) {\n if (!FONTES_ACEITAS.includes(fonte)) {\n throw new ConfigurationError(\n `Unknown subagent setting source \"${String(fonte)}\" (accepted: ${FONTES_ACEITAS.join(\", \")})`,\n { code: \"subagent_unknown_setting_source\" },\n );\n }\n }\n return declaradas;\n}\n\n/**\n * Discover the subagents defined under `<cwd>/.theokit/agents/*.md`.\n *\n * An absent directory yields `{}` — a project without subagents is the common case, not an error.\n */\nexport async function discoverSubagents(\n cwd: string,\n options?: DiscoverSubagentsOptions,\n): Promise<Record<string, AgentDefinition>> {\n const fontes = resolverFontes(options);\n return loadSubagents(cwd, fontes.includes(\"project\"), undefined);\n}\n\n/**\n * Load ONE subagent definition by name, or `undefined` when it is not defined on disk.\n *\n * A thin selector over {@link discoverSubagents} rather than a second reader: one parser is the\n * whole point of this module.\n */\nexport async function loadSubagentDefinition(\n name: string,\n cwd: string,\n options?: DiscoverSubagentsOptions,\n): Promise<AgentDefinition | undefined> {\n return (await discoverSubagents(cwd, options))[name];\n}\n"]}
|
|
@@ -22,18 +22,33 @@ import 'zod';
|
|
|
22
22
|
* parsed value leaves the format free to change.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Where subagent definitions may be read from. A closed union rather than a boolean: a third
|
|
27
|
+
* source can join it without breaking the signature, and the call site reads as what it means.
|
|
28
|
+
*/
|
|
29
|
+
type SubagentSource = "project";
|
|
30
|
+
/** Options for {@link discoverSubagents} / {@link loadSubagentDefinition}. */
|
|
31
|
+
interface DiscoverSubagentsOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Which sources to read. Defaults to `["project"]` — `<cwd>/.theokit/agents/*.md`.
|
|
34
|
+
*
|
|
35
|
+
* An empty list reads NOTHING: the directory is never opened, so a caller that has not yet
|
|
36
|
+
* established trust in `cwd` can decline the read rather than filter its result.
|
|
37
|
+
*/
|
|
38
|
+
readonly settingSources?: readonly SubagentSource[];
|
|
39
|
+
}
|
|
25
40
|
/**
|
|
26
41
|
* Discover the subagents defined under `<cwd>/.theokit/agents/*.md`.
|
|
27
42
|
*
|
|
28
43
|
* An absent directory yields `{}` — a project without subagents is the common case, not an error.
|
|
29
44
|
*/
|
|
30
|
-
declare function discoverSubagents(cwd: string): Promise<Record<string, AgentDefinition>>;
|
|
45
|
+
declare function discoverSubagents(cwd: string, options?: DiscoverSubagentsOptions): Promise<Record<string, AgentDefinition>>;
|
|
31
46
|
/**
|
|
32
47
|
* Load ONE subagent definition by name, or `undefined` when it is not defined on disk.
|
|
33
48
|
*
|
|
34
49
|
* A thin selector over {@link discoverSubagents} rather than a second reader: one parser is the
|
|
35
50
|
* whole point of this module.
|
|
36
51
|
*/
|
|
37
|
-
declare function loadSubagentDefinition(name: string, cwd: string): Promise<AgentDefinition | undefined>;
|
|
52
|
+
declare function loadSubagentDefinition(name: string, cwd: string, options?: DiscoverSubagentsOptions): Promise<AgentDefinition | undefined>;
|
|
38
53
|
|
|
39
|
-
export { discoverSubagents, loadSubagentDefinition };
|
|
54
|
+
export { AgentDefinition, type DiscoverSubagentsOptions, type SubagentSource, discoverSubagents, loadSubagentDefinition };
|
|
@@ -22,18 +22,33 @@ import 'zod';
|
|
|
22
22
|
* parsed value leaves the format free to change.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Where subagent definitions may be read from. A closed union rather than a boolean: a third
|
|
27
|
+
* source can join it without breaking the signature, and the call site reads as what it means.
|
|
28
|
+
*/
|
|
29
|
+
type SubagentSource = "project";
|
|
30
|
+
/** Options for {@link discoverSubagents} / {@link loadSubagentDefinition}. */
|
|
31
|
+
interface DiscoverSubagentsOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Which sources to read. Defaults to `["project"]` — `<cwd>/.theokit/agents/*.md`.
|
|
34
|
+
*
|
|
35
|
+
* An empty list reads NOTHING: the directory is never opened, so a caller that has not yet
|
|
36
|
+
* established trust in `cwd` can decline the read rather than filter its result.
|
|
37
|
+
*/
|
|
38
|
+
readonly settingSources?: readonly SubagentSource[];
|
|
39
|
+
}
|
|
25
40
|
/**
|
|
26
41
|
* Discover the subagents defined under `<cwd>/.theokit/agents/*.md`.
|
|
27
42
|
*
|
|
28
43
|
* An absent directory yields `{}` — a project without subagents is the common case, not an error.
|
|
29
44
|
*/
|
|
30
|
-
declare function discoverSubagents(cwd: string): Promise<Record<string, AgentDefinition>>;
|
|
45
|
+
declare function discoverSubagents(cwd: string, options?: DiscoverSubagentsOptions): Promise<Record<string, AgentDefinition>>;
|
|
31
46
|
/**
|
|
32
47
|
* Load ONE subagent definition by name, or `undefined` when it is not defined on disk.
|
|
33
48
|
*
|
|
34
49
|
* A thin selector over {@link discoverSubagents} rather than a second reader: one parser is the
|
|
35
50
|
* whole point of this module.
|
|
36
51
|
*/
|
|
37
|
-
declare function loadSubagentDefinition(name: string, cwd: string): Promise<AgentDefinition | undefined>;
|
|
52
|
+
declare function loadSubagentDefinition(name: string, cwd: string, options?: DiscoverSubagentsOptions): Promise<AgentDefinition | undefined>;
|
|
38
53
|
|
|
39
|
-
export { discoverSubagents, loadSubagentDefinition };
|
|
54
|
+
export { AgentDefinition, type DiscoverSubagentsOptions, type SubagentSource, discoverSubagents, loadSubagentDefinition };
|
package/dist/subagents-loader.js
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { loadSubagents } from './chunk-BNIFFFH3.js';
|
|
2
2
|
import './chunk-FKCC2MED.js';
|
|
3
|
-
import './chunk-WLKFWQSJ.js';
|
|
3
|
+
import { ConfigurationError } from './chunk-WLKFWQSJ.js';
|
|
4
4
|
import './chunk-JTFYYKDT.js';
|
|
5
5
|
|
|
6
6
|
// src/subagents-loader.ts
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var FONTES_ACEITAS = ["project"];
|
|
8
|
+
function resolverFontes(options) {
|
|
9
|
+
const declaradas = options?.settingSources;
|
|
10
|
+
if (declaradas === void 0) return FONTES_ACEITAS;
|
|
11
|
+
for (const fonte of declaradas) {
|
|
12
|
+
if (!FONTES_ACEITAS.includes(fonte)) {
|
|
13
|
+
throw new ConfigurationError(
|
|
14
|
+
`Unknown subagent setting source "${String(fonte)}" (accepted: ${FONTES_ACEITAS.join(", ")})`,
|
|
15
|
+
{ code: "subagent_unknown_setting_source" }
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return declaradas;
|
|
9
20
|
}
|
|
10
|
-
async function
|
|
11
|
-
|
|
21
|
+
async function discoverSubagents(cwd, options) {
|
|
22
|
+
const fontes = resolverFontes(options);
|
|
23
|
+
return loadSubagents(cwd, fontes.includes("project"), void 0);
|
|
24
|
+
}
|
|
25
|
+
async function loadSubagentDefinition(name, cwd, options) {
|
|
26
|
+
return (await discoverSubagents(cwd, options))[name];
|
|
12
27
|
}
|
|
13
28
|
|
|
14
29
|
export { discoverSubagents, loadSubagentDefinition };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/subagents-loader.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/subagents-loader.ts"],"names":[],"mappings":";;;;;;AAuCA,IAAM,cAAA,GAA4C,CAAC,SAAS,CAAA;AAgB5D,SAAS,eAAe,OAAA,EAA0E;AAChG,EAAA,MAAM,aAAa,OAAA,EAAS,cAAA;AAC5B,EAAA,IAAI,UAAA,KAAe,QAAW,OAAO,cAAA;AACrC,EAAA,KAAA,MAAW,SAAS,UAAA,EAAY;AAC9B,IAAA,IAAI,CAAC,cAAA,CAAe,QAAA,CAAS,KAAK,CAAA,EAAG;AACnC,MAAA,MAAM,IAAI,kBAAA;AAAA,QACR,CAAA,iCAAA,EAAoC,OAAO,KAAK,CAAC,gBAAgB,cAAA,CAAe,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA,CAAA;AAAA,QAC1F,EAAE,MAAM,iCAAA;AAAkC,OAC5C;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,UAAA;AACT;AAOA,eAAsB,iBAAA,CACpB,KACA,OAAA,EAC0C;AAC1C,EAAA,MAAM,MAAA,GAAS,eAAe,OAAO,CAAA;AACrC,EAAA,OAAO,cAAc,GAAA,EAAK,MAAA,CAAO,QAAA,CAAS,SAAS,GAAG,MAAS,CAAA;AACjE;AAQA,eAAsB,sBAAA,CACpB,IAAA,EACA,GAAA,EACA,OAAA,EACsC;AACtC,EAAA,OAAA,CAAQ,MAAM,iBAAA,CAAkB,GAAA,EAAK,OAAO,GAAG,IAAI,CAAA;AACrD","file":"subagents-loader.js","sourcesContent":["/**\n * M81 — `.theokit/agents` discovery, exposed so a consumer can read the on-disk subagent\n * definitions with one import instead of hand-rolling a second parser.\n *\n * ## Why this file exists\n *\n * `src/skills.ts` already exposed `discoverSkills` for the sibling domain. Subagents had the same\n * loader — `internal/runtime/skills/subagents-loader.ts` — with no public door. A consumer behind\n * the layer boundary (the agent-builder never imports `@theokit/sdk*` directly) could not reach it,\n * so re-implementing was the only legal option. It re-implemented, and then wrote a test whose only\n * job was to watch the two parsers for drift. That test is the cleanest possible evidence that the\n * duplication should not exist.\n *\n * ## What crosses is the PARSED config\n *\n * The return is `AgentDefinition` — already interpreted — never the `.md` text or the frontmatter\n * shape. Exporting the file format would freeze an internal detail as public API; exporting the\n * parsed value leaves the format free to change.\n */\n\nimport { ConfigurationError } from \"./errors.js\";\nimport { loadSubagents } from \"./internal/runtime/skills/subagents-loader.js\";\nimport type { AgentDefinition } from \"./types/agent.js\";\n\n/**\n * The parsed subagent definition this module hands back.\n *\n * Re-exported here — beside the loader that produces it — so a consumer can NAME the value it\n * receives without reaching into `types/agent`, which no subpath publishes. A layer above may then\n * alias it (`AgentDefinition as SubagentDefinition`) to sidestep a name it has already spent.\n */\nexport type { AgentDefinition } from \"./types/agent.js\";\n\n/**\n * Where subagent definitions may be read from. A closed union rather than a boolean: a third\n * source can join it without breaking the signature, and the call site reads as what it means.\n */\nexport type SubagentSource = \"project\";\n\nconst FONTES_ACEITAS: readonly SubagentSource[] = [\"project\"];\n\n/** Options for {@link discoverSubagents} / {@link loadSubagentDefinition}. */\nexport interface DiscoverSubagentsOptions {\n /**\n * Which sources to read. Defaults to `[\"project\"]` — `<cwd>/.theokit/agents/*.md`.\n *\n * An empty list reads NOTHING: the directory is never opened, so a caller that has not yet\n * established trust in `cwd` can decline the read rather than filter its result.\n */\n readonly settingSources?: readonly SubagentSource[];\n}\n\n// Validated at the boundary (error-handling.md § 2): the union is erased at runtime, so a JS\n// caller — or a value crossing a serialization hop — can still carry a source nobody honors.\n// Dropping it silently would read as \"no subagents found\", which is the same shape as success.\nfunction resolverFontes(options: DiscoverSubagentsOptions | undefined): readonly SubagentSource[] {\n const declaradas = options?.settingSources;\n if (declaradas === undefined) return FONTES_ACEITAS;\n for (const fonte of declaradas) {\n if (!FONTES_ACEITAS.includes(fonte)) {\n throw new ConfigurationError(\n `Unknown subagent setting source \"${String(fonte)}\" (accepted: ${FONTES_ACEITAS.join(\", \")})`,\n { code: \"subagent_unknown_setting_source\" },\n );\n }\n }\n return declaradas;\n}\n\n/**\n * Discover the subagents defined under `<cwd>/.theokit/agents/*.md`.\n *\n * An absent directory yields `{}` — a project without subagents is the common case, not an error.\n */\nexport async function discoverSubagents(\n cwd: string,\n options?: DiscoverSubagentsOptions,\n): Promise<Record<string, AgentDefinition>> {\n const fontes = resolverFontes(options);\n return loadSubagents(cwd, fontes.includes(\"project\"), undefined);\n}\n\n/**\n * Load ONE subagent definition by name, or `undefined` when it is not defined on disk.\n *\n * A thin selector over {@link discoverSubagents} rather than a second reader: one parser is the\n * whole point of this module.\n */\nexport async function loadSubagentDefinition(\n name: string,\n cwd: string,\n options?: DiscoverSubagentsOptions,\n): Promise<AgentDefinition | undefined> {\n return (await discoverSubagents(cwd, options))[name];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theokit/sdk",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.36.0",
|
|
4
4
|
"description": "TypeScript SDK for the Theo agent harness — same surface, local or cloud.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/usetheodev/theokit-sdk#readme",
|
|
@@ -329,17 +329,6 @@
|
|
|
329
329
|
"**/agent.js",
|
|
330
330
|
"**/agent.cjs"
|
|
331
331
|
],
|
|
332
|
-
"scripts": {
|
|
333
|
-
"build": "tsup && cp src/internal/providers/provider-catalog.json dist/provider-catalog.json && node scripts/copy-docs.mjs",
|
|
334
|
-
"test": "vitest run --no-file-parallelism",
|
|
335
|
-
"test:watch": "vitest",
|
|
336
|
-
"eval": "vitest run --no-file-parallelism tests/eval/suites",
|
|
337
|
-
"test:contract": "vitest run --no-file-parallelism tests/theokit-consumer-contract.test.ts",
|
|
338
|
-
"prepublishOnly": "pnpm build && pnpm test:contract",
|
|
339
|
-
"typecheck": "tsc --noEmit",
|
|
340
|
-
"clean": "rm -rf dist",
|
|
341
|
-
"docs:json": "typedoc --options typedoc.json"
|
|
342
|
-
},
|
|
343
332
|
"peerDependencies": {
|
|
344
333
|
"@lancedb/lancedb": "^0.30.0",
|
|
345
334
|
"@types/ws": ">=8.0.0",
|
|
@@ -407,5 +396,15 @@
|
|
|
407
396
|
"typedoc": "^0.28.19",
|
|
408
397
|
"ws": "^8.18.0",
|
|
409
398
|
"zod": "^4.0.0"
|
|
399
|
+
},
|
|
400
|
+
"scripts": {
|
|
401
|
+
"build": "tsup && cp src/internal/providers/provider-catalog.json dist/provider-catalog.json && node scripts/copy-docs.mjs",
|
|
402
|
+
"test": "vitest run --no-file-parallelism",
|
|
403
|
+
"test:watch": "vitest",
|
|
404
|
+
"eval": "vitest run --no-file-parallelism tests/eval/suites",
|
|
405
|
+
"test:contract": "vitest run --no-file-parallelism tests/theokit-consumer-contract.test.ts",
|
|
406
|
+
"typecheck": "tsc --noEmit",
|
|
407
|
+
"clean": "rm -rf dist",
|
|
408
|
+
"docs:json": "typedoc --options typedoc.json"
|
|
410
409
|
}
|
|
411
|
-
}
|
|
410
|
+
}
|