@theokit/sdk 4.42.0 → 4.43.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 +84 -0
- package/dist/{agent-WUVYXIFX.js → agent-GKX5FE5K.js} +5 -5
- package/dist/{agent-WUVYXIFX.js.map → agent-GKX5FE5K.js.map} +1 -1
- package/dist/{agent-HGDXQEQQ.cjs → agent-JA4ILE5O.cjs} +6 -6
- package/dist/{agent-HGDXQEQQ.cjs.map → agent-JA4ILE5O.cjs.map} +1 -1
- package/dist/{chunk-Q2PPSHBS.js → chunk-3NLOQEJR.js} +10 -10
- package/dist/chunk-3NLOQEJR.js.map +1 -0
- package/dist/{chunk-UJ7IQJAG.js → chunk-4NAKHID5.js} +8 -21
- package/dist/chunk-4NAKHID5.js.map +1 -0
- package/dist/{chunk-EYEZDADP.cjs → chunk-74VVGK7P.cjs} +5 -5
- package/dist/{chunk-EYEZDADP.cjs.map → chunk-74VVGK7P.cjs.map} +1 -1
- package/dist/{chunk-YPEPCZHF.cjs → chunk-L5YO6PWL.cjs} +7 -20
- package/dist/chunk-L5YO6PWL.cjs.map +1 -0
- package/dist/{chunk-MPD5EGJ6.js → chunk-MZQHVN7C.js} +3 -3
- package/dist/{chunk-MPD5EGJ6.js.map → chunk-MZQHVN7C.js.map} +1 -1
- package/dist/{chunk-YHQ3DG24.cjs → chunk-TSK4VVBW.cjs} +10 -10
- package/dist/chunk-TSK4VVBW.cjs.map +1 -0
- package/dist/{chunk-22EMHGBO.cjs → chunk-UU7MAO2D.cjs} +14 -13
- package/dist/chunk-UU7MAO2D.cjs.map +1 -0
- package/dist/{chunk-KO5V6L3E.js → chunk-XARLSCKA.js} +5 -5
- package/dist/chunk-XARLSCKA.js.map +1 -0
- package/dist/context/index.cjs +7 -7
- package/dist/context/index.js +3 -3
- 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/index.cjs +20 -20
- package/dist/index.js +6 -6
- package/dist/internal/runtime/context/path-containment.d.ts +24 -0
- package/dist/project.cjs +3 -3
- package/dist/project.js +1 -1
- package/dist/server/auth/index.d.cts +207 -11
- package/dist/server/auth/index.d.ts +207 -11
- package/dist/server/errors-envelope.d.cts +12 -6
- package/dist/server/errors-envelope.d.ts +12 -6
- package/package.json +1 -1
- package/dist/chunk-22EMHGBO.cjs.map +0 -1
- package/dist/chunk-KO5V6L3E.js.map +0 -1
- package/dist/chunk-Q2PPSHBS.js.map +0 -1
- package/dist/chunk-UJ7IQJAG.js.map +0 -1
- package/dist/chunk-YHQ3DG24.cjs.map +0 -1
- package/dist/chunk-YPEPCZHF.cjs.map +0 -1
package/dist/context/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkUU7MAO2D_cjs = require('../chunk-UU7MAO2D.cjs');
|
|
4
|
+
var chunkL5YO6PWL_cjs = require('../chunk-L5YO6PWL.cjs');
|
|
5
5
|
|
|
6
6
|
// src/context/index.ts
|
|
7
7
|
function resolveContextImports(content, basePath, options) {
|
|
@@ -11,24 +11,24 @@ function resolveContextImports(content, basePath, options) {
|
|
|
11
11
|
maxBytesPerFile: options.maxBytesPerFile,
|
|
12
12
|
projectRoot: options.projectRoot
|
|
13
13
|
};
|
|
14
|
-
return
|
|
14
|
+
return chunkUU7MAO2D_cjs.resolveImports(content, basePath, internalOptions);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, "parseRules", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkUU7MAO2D_cjs.parseRules; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "runDiscovery", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkUU7MAO2D_cjs.runDiscovery; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "shouldActivateRule", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkUU7MAO2D_cjs.shouldActivateRule; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "DEFAULT_DISCOVERY_SPECS", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkL5YO6PWL_cjs.DEFAULT_DISCOVERY_SPECS; }
|
|
32
32
|
});
|
|
33
33
|
exports.resolveContextImports = resolveContextImports;
|
|
34
34
|
//# sourceMappingURL=index.cjs.map
|
package/dist/context/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { resolveImports } from '../chunk-
|
|
2
|
-
export { parseRules, runDiscovery, shouldActivateRule } from '../chunk-
|
|
3
|
-
export { DEFAULT_DISCOVERY_SPECS } from '../chunk-
|
|
1
|
+
import { resolveImports } from '../chunk-3NLOQEJR.js';
|
|
2
|
+
export { parseRules, runDiscovery, shouldActivateRule } from '../chunk-3NLOQEJR.js';
|
|
3
|
+
export { DEFAULT_DISCOVERY_SPECS } from '../chunk-4NAKHID5.js';
|
|
4
4
|
|
|
5
5
|
// src/context/index.ts
|
|
6
6
|
function resolveContextImports(content, basePath, options) {
|
package/dist/cron.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunk74VVGK7P_cjs = require('./chunk-74VVGK7P.cjs');
|
|
4
|
+
require('./chunk-TSK4VVBW.cjs');
|
|
5
5
|
require('./chunk-FAUKVJCC.cjs');
|
|
6
6
|
require('./chunk-BV2MWEMV.cjs');
|
|
7
7
|
require('./chunk-KCQUYQ3V.cjs');
|
|
@@ -14,7 +14,7 @@ require('./chunk-FZ4YMZA3.cjs');
|
|
|
14
14
|
require('./chunk-GH52NOCL.cjs');
|
|
15
15
|
require('./chunk-HECR7KF5.cjs');
|
|
16
16
|
require('./chunk-BBZYXVLZ.cjs');
|
|
17
|
-
require('./chunk-
|
|
17
|
+
require('./chunk-UU7MAO2D.cjs');
|
|
18
18
|
require('./chunk-6X2HUT4A.cjs');
|
|
19
19
|
require('./chunk-7PESI6YD.cjs');
|
|
20
20
|
require('./chunk-S4Q5OMIK.cjs');
|
|
@@ -23,7 +23,7 @@ require('./chunk-MUUQ2WFJ.cjs');
|
|
|
23
23
|
require('./chunk-6JSIEDKL.cjs');
|
|
24
24
|
require('./chunk-B4YA6BRS.cjs');
|
|
25
25
|
require('./chunk-NINIJCHU.cjs');
|
|
26
|
-
require('./chunk-
|
|
26
|
+
require('./chunk-L5YO6PWL.cjs');
|
|
27
27
|
require('./chunk-VJ26EKGJ.cjs');
|
|
28
28
|
require('./chunk-OEFFPR2S.cjs');
|
|
29
29
|
require('./chunk-27DYRARU.cjs');
|
|
@@ -51,7 +51,7 @@ require('./chunk-ZHPET3LZ.cjs');
|
|
|
51
51
|
|
|
52
52
|
Object.defineProperty(exports, "Cron", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunk74VVGK7P_cjs.Cron; }
|
|
55
55
|
});
|
|
56
56
|
//# sourceMappingURL=cron.cjs.map
|
|
57
57
|
//# sourceMappingURL=cron.cjs.map
|
package/dist/cron.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Cron } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { Cron } from './chunk-MZQHVN7C.js';
|
|
2
|
+
import './chunk-XARLSCKA.js';
|
|
3
3
|
import './chunk-UJ7HK7BX.js';
|
|
4
4
|
import './chunk-2SFBB54R.js';
|
|
5
5
|
import './chunk-GNMPCZNN.js';
|
|
@@ -12,7 +12,7 @@ import './chunk-ZTEAJAE6.js';
|
|
|
12
12
|
import './chunk-RJBHWM6D.js';
|
|
13
13
|
import './chunk-J5RW43IR.js';
|
|
14
14
|
import './chunk-AM2CNBKE.js';
|
|
15
|
-
import './chunk-
|
|
15
|
+
import './chunk-3NLOQEJR.js';
|
|
16
16
|
import './chunk-ZS6SLELQ.js';
|
|
17
17
|
import './chunk-LLE7HPRI.js';
|
|
18
18
|
import './chunk-SNKY3C2L.js';
|
|
@@ -21,7 +21,7 @@ import './chunk-FD2UT76F.js';
|
|
|
21
21
|
import './chunk-U54XCYG3.js';
|
|
22
22
|
import './chunk-RP5HQVLD.js';
|
|
23
23
|
import './chunk-6X6ID4MO.js';
|
|
24
|
-
import './chunk-
|
|
24
|
+
import './chunk-4NAKHID5.js';
|
|
25
25
|
import './chunk-7AD3ZTZL.js';
|
|
26
26
|
import './chunk-AZ6FKDQR.js';
|
|
27
27
|
import './chunk-Q4DTGCSD.js';
|
package/dist/eval.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkR3CKCRK3_cjs = require('./chunk-R3CKCRK3.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkTSK4VVBW_cjs = require('./chunk-TSK4VVBW.cjs');
|
|
5
5
|
require('./chunk-FAUKVJCC.cjs');
|
|
6
6
|
require('./chunk-BV2MWEMV.cjs');
|
|
7
7
|
require('./chunk-KCQUYQ3V.cjs');
|
|
@@ -14,7 +14,7 @@ require('./chunk-FZ4YMZA3.cjs');
|
|
|
14
14
|
require('./chunk-GH52NOCL.cjs');
|
|
15
15
|
require('./chunk-HECR7KF5.cjs');
|
|
16
16
|
require('./chunk-BBZYXVLZ.cjs');
|
|
17
|
-
require('./chunk-
|
|
17
|
+
require('./chunk-UU7MAO2D.cjs');
|
|
18
18
|
require('./chunk-6X2HUT4A.cjs');
|
|
19
19
|
require('./chunk-7PESI6YD.cjs');
|
|
20
20
|
require('./chunk-S4Q5OMIK.cjs');
|
|
@@ -23,7 +23,7 @@ require('./chunk-MUUQ2WFJ.cjs');
|
|
|
23
23
|
require('./chunk-6JSIEDKL.cjs');
|
|
24
24
|
require('./chunk-B4YA6BRS.cjs');
|
|
25
25
|
var chunkNINIJCHU_cjs = require('./chunk-NINIJCHU.cjs');
|
|
26
|
-
require('./chunk-
|
|
26
|
+
require('./chunk-L5YO6PWL.cjs');
|
|
27
27
|
require('./chunk-VJ26EKGJ.cjs');
|
|
28
28
|
require('./chunk-OEFFPR2S.cjs');
|
|
29
29
|
require('./chunk-27DYRARU.cjs');
|
|
@@ -774,7 +774,7 @@ function makeDefaultEmbedder(opts) {
|
|
|
774
774
|
let runtime;
|
|
775
775
|
return (texts) => {
|
|
776
776
|
if (runtime === void 0) {
|
|
777
|
-
runtime =
|
|
777
|
+
runtime = chunkTSK4VVBW_cjs.openRouterMemoryEmbeddingProviderAdapter.create(embedderCreateOptions(opts));
|
|
778
778
|
}
|
|
779
779
|
return runtime.then((rt) => rt.embed(texts));
|
|
780
780
|
};
|
package/dist/eval.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shellEscapePosix, LocalSandbox } from './chunk-DEZ75ET5.js';
|
|
2
|
-
import { openRouterMemoryEmbeddingProviderAdapter } from './chunk-
|
|
2
|
+
import { openRouterMemoryEmbeddingProviderAdapter } from './chunk-XARLSCKA.js';
|
|
3
3
|
import './chunk-UJ7HK7BX.js';
|
|
4
4
|
import './chunk-2SFBB54R.js';
|
|
5
5
|
import './chunk-GNMPCZNN.js';
|
|
@@ -12,7 +12,7 @@ import './chunk-ZTEAJAE6.js';
|
|
|
12
12
|
import './chunk-RJBHWM6D.js';
|
|
13
13
|
import './chunk-J5RW43IR.js';
|
|
14
14
|
import './chunk-AM2CNBKE.js';
|
|
15
|
-
import './chunk-
|
|
15
|
+
import './chunk-3NLOQEJR.js';
|
|
16
16
|
import './chunk-ZS6SLELQ.js';
|
|
17
17
|
import './chunk-LLE7HPRI.js';
|
|
18
18
|
import './chunk-SNKY3C2L.js';
|
|
@@ -21,7 +21,7 @@ import './chunk-FD2UT76F.js';
|
|
|
21
21
|
import './chunk-U54XCYG3.js';
|
|
22
22
|
import './chunk-RP5HQVLD.js';
|
|
23
23
|
import { getAgentFacade } from './chunk-6X6ID4MO.js';
|
|
24
|
-
import './chunk-
|
|
24
|
+
import './chunk-4NAKHID5.js';
|
|
25
25
|
import './chunk-7AD3ZTZL.js';
|
|
26
26
|
import './chunk-AZ6FKDQR.js';
|
|
27
27
|
import './chunk-Q4DTGCSD.js';
|
package/dist/index.cjs
CHANGED
|
@@ -8,8 +8,8 @@ require('./chunk-WIGJGFH4.cjs');
|
|
|
8
8
|
var chunkJO76RWCA_cjs = require('./chunk-JO76RWCA.cjs');
|
|
9
9
|
require('./chunk-RBQYHEZD.cjs');
|
|
10
10
|
require('./chunk-PNVDQL5Y.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var chunk74VVGK7P_cjs = require('./chunk-74VVGK7P.cjs');
|
|
12
|
+
var chunkTSK4VVBW_cjs = require('./chunk-TSK4VVBW.cjs');
|
|
13
13
|
require('./chunk-FAUKVJCC.cjs');
|
|
14
14
|
require('./chunk-BV2MWEMV.cjs');
|
|
15
15
|
var chunkKCQUYQ3V_cjs = require('./chunk-KCQUYQ3V.cjs');
|
|
@@ -22,7 +22,7 @@ require('./chunk-FZ4YMZA3.cjs');
|
|
|
22
22
|
var chunkGH52NOCL_cjs = require('./chunk-GH52NOCL.cjs');
|
|
23
23
|
require('./chunk-HECR7KF5.cjs');
|
|
24
24
|
require('./chunk-BBZYXVLZ.cjs');
|
|
25
|
-
require('./chunk-
|
|
25
|
+
require('./chunk-UU7MAO2D.cjs');
|
|
26
26
|
require('./chunk-6X2HUT4A.cjs');
|
|
27
27
|
require('./chunk-7PESI6YD.cjs');
|
|
28
28
|
require('./chunk-S4Q5OMIK.cjs');
|
|
@@ -31,7 +31,7 @@ require('./chunk-MUUQ2WFJ.cjs');
|
|
|
31
31
|
require('./chunk-6JSIEDKL.cjs');
|
|
32
32
|
require('./chunk-B4YA6BRS.cjs');
|
|
33
33
|
require('./chunk-NINIJCHU.cjs');
|
|
34
|
-
require('./chunk-
|
|
34
|
+
require('./chunk-L5YO6PWL.cjs');
|
|
35
35
|
require('./chunk-VJ26EKGJ.cjs');
|
|
36
36
|
require('./chunk-OEFFPR2S.cjs');
|
|
37
37
|
require('./chunk-27DYRARU.cjs');
|
|
@@ -63,8 +63,8 @@ var fs = require('fs');
|
|
|
63
63
|
// src/agent-factory.ts
|
|
64
64
|
function createAgentFactory(common) {
|
|
65
65
|
return {
|
|
66
|
-
forSession: (agentId, overrides) =>
|
|
67
|
-
getOrCreate: (agentId, overrides) =>
|
|
66
|
+
forSession: (agentId, overrides) => chunkTSK4VVBW_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
|
|
67
|
+
getOrCreate: (agentId, overrides) => chunkTSK4VVBW_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
function mergeAgentOptions(common, overrides, agentId) {
|
|
@@ -1168,7 +1168,7 @@ var Memory = {
|
|
|
1168
1168
|
return await peer.IndexManager.open(openArgs);
|
|
1169
1169
|
}
|
|
1170
1170
|
const { IndexManager } = await import('./index-manager-YFFEPISE.cjs');
|
|
1171
|
-
openArgs.embedding = await resolveEmbedding(opts.embedding,
|
|
1171
|
+
openArgs.embedding = await resolveEmbedding(opts.embedding, chunkTSK4VVBW_cjs.MEMORY_EMBEDDING_ADAPTERS);
|
|
1172
1172
|
return await IndexManager.open(openArgs);
|
|
1173
1173
|
},
|
|
1174
1174
|
/**
|
|
@@ -1179,7 +1179,7 @@ var Memory = {
|
|
|
1179
1179
|
*/
|
|
1180
1180
|
async runDreamingSweep(opts) {
|
|
1181
1181
|
const peer = await tryLoadSdkMemoryPeer();
|
|
1182
|
-
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS :
|
|
1182
|
+
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkTSK4VVBW_cjs.MEMORY_EMBEDDING_ADAPTERS;
|
|
1183
1183
|
const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
|
|
1184
1184
|
const result = peer !== null ? (
|
|
1185
1185
|
// biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
|
|
@@ -1601,7 +1601,7 @@ function isBuiltAgent(m) {
|
|
|
1601
1601
|
return typeof m.send === "function";
|
|
1602
1602
|
}
|
|
1603
1603
|
async function materialize(def, index) {
|
|
1604
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1604
|
+
const { Agent: Agent2 } = await import('./agent-JA4ILE5O.cjs');
|
|
1605
1605
|
return Agent2.create({
|
|
1606
1606
|
// `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
|
|
1607
1607
|
// here means "declare nothing and let the default apply" — forwarding the literal would create
|
|
@@ -1743,7 +1743,7 @@ var FIXTURE_USER = {
|
|
|
1743
1743
|
};
|
|
1744
1744
|
var FIXTURE_MODELS = [
|
|
1745
1745
|
{
|
|
1746
|
-
id:
|
|
1746
|
+
id: chunkTSK4VVBW_cjs.DEFAULT_AGENTIC_MODEL_ID,
|
|
1747
1747
|
name: "Gemini 2.0 Flash",
|
|
1748
1748
|
displayName: "Gemini 2.0 Flash",
|
|
1749
1749
|
parameters: [
|
|
@@ -1946,7 +1946,7 @@ var Theokit = class {
|
|
|
1946
1946
|
envVars: p.envVars
|
|
1947
1947
|
}));
|
|
1948
1948
|
},
|
|
1949
|
-
embeddingAdapters: () => Object.entries(
|
|
1949
|
+
embeddingAdapters: () => Object.entries(chunkTSK4VVBW_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
|
|
1950
1950
|
id,
|
|
1951
1951
|
transport: adapter.transport,
|
|
1952
1952
|
defaultModel: adapter.defaultModel
|
|
@@ -1978,7 +1978,7 @@ function resolveLocalProviderBaseUrl(providerName, fallback) {
|
|
|
1978
1978
|
return fallback;
|
|
1979
1979
|
}
|
|
1980
1980
|
async function executeCatalogRequest(request) {
|
|
1981
|
-
const apiKey =
|
|
1981
|
+
const apiKey = chunkTSK4VVBW_cjs.resolveApiKey(request.apiKey);
|
|
1982
1982
|
if (apiKey === void 0) {
|
|
1983
1983
|
throw new chunkYULF6FPB_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
1984
1984
|
}
|
|
@@ -2104,35 +2104,35 @@ Object.defineProperty(exports, "GenerateObjectError", {
|
|
|
2104
2104
|
});
|
|
2105
2105
|
Object.defineProperty(exports, "Cron", {
|
|
2106
2106
|
enumerable: true,
|
|
2107
|
-
get: function () { return
|
|
2107
|
+
get: function () { return chunk74VVGK7P_cjs.Cron; }
|
|
2108
2108
|
});
|
|
2109
2109
|
Object.defineProperty(exports, "Agent", {
|
|
2110
2110
|
enumerable: true,
|
|
2111
|
-
get: function () { return
|
|
2111
|
+
get: function () { return chunkTSK4VVBW_cjs.Agent; }
|
|
2112
2112
|
});
|
|
2113
2113
|
Object.defineProperty(exports, "AgentBuilder", {
|
|
2114
2114
|
enumerable: true,
|
|
2115
|
-
get: function () { return
|
|
2115
|
+
get: function () { return chunkTSK4VVBW_cjs.AgentBuilder; }
|
|
2116
2116
|
});
|
|
2117
2117
|
Object.defineProperty(exports, "Tool", {
|
|
2118
2118
|
enumerable: true,
|
|
2119
|
-
get: function () { return
|
|
2119
|
+
get: function () { return chunkTSK4VVBW_cjs.Tool; }
|
|
2120
2120
|
});
|
|
2121
2121
|
Object.defineProperty(exports, "ToolError", {
|
|
2122
2122
|
enumerable: true,
|
|
2123
|
-
get: function () { return
|
|
2123
|
+
get: function () { return chunkTSK4VVBW_cjs.ToolError; }
|
|
2124
2124
|
});
|
|
2125
2125
|
Object.defineProperty(exports, "UsageAccumulator", {
|
|
2126
2126
|
enumerable: true,
|
|
2127
|
-
get: function () { return
|
|
2127
|
+
get: function () { return chunkTSK4VVBW_cjs.UsageAccumulator; }
|
|
2128
2128
|
});
|
|
2129
2129
|
Object.defineProperty(exports, "computeCost", {
|
|
2130
2130
|
enumerable: true,
|
|
2131
|
-
get: function () { return
|
|
2131
|
+
get: function () { return chunkTSK4VVBW_cjs.computeCost; }
|
|
2132
2132
|
});
|
|
2133
2133
|
Object.defineProperty(exports, "getPricingEntry", {
|
|
2134
2134
|
enumerable: true,
|
|
2135
|
-
get: function () { return
|
|
2135
|
+
get: function () { return chunkTSK4VVBW_cjs.getPricingEntry; }
|
|
2136
2136
|
});
|
|
2137
2137
|
Object.defineProperty(exports, "emitRunEvent", {
|
|
2138
2138
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import './chunk-O3IZ7JEL.js';
|
|
|
6
6
|
import { Workflow, agentStep } from './chunk-EON4YTR6.js';
|
|
7
7
|
import './chunk-HK4HRLWE.js';
|
|
8
8
|
import './chunk-CAH3G4IS.js';
|
|
9
|
-
export { Cron } from './chunk-
|
|
10
|
-
import { MEMORY_EMBEDDING_ADAPTERS, resolveApiKey, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-
|
|
11
|
-
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-
|
|
9
|
+
export { Cron } from './chunk-MZQHVN7C.js';
|
|
10
|
+
import { MEMORY_EMBEDDING_ADAPTERS, resolveApiKey, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-XARLSCKA.js';
|
|
11
|
+
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-XARLSCKA.js';
|
|
12
12
|
import './chunk-UJ7HK7BX.js';
|
|
13
13
|
import './chunk-2SFBB54R.js';
|
|
14
14
|
import { configure, submit, list, get, cancel, subscribe } from './chunk-GNMPCZNN.js';
|
|
@@ -22,7 +22,7 @@ import './chunk-ZTEAJAE6.js';
|
|
|
22
22
|
import { lanceStoragePath, LanceIndex, readFactsFromMarkdown, defaultIndexPath, openMemoryDb, memoryDir } from './chunk-RJBHWM6D.js';
|
|
23
23
|
import './chunk-J5RW43IR.js';
|
|
24
24
|
import './chunk-AM2CNBKE.js';
|
|
25
|
-
import './chunk-
|
|
25
|
+
import './chunk-3NLOQEJR.js';
|
|
26
26
|
import './chunk-ZS6SLELQ.js';
|
|
27
27
|
import './chunk-LLE7HPRI.js';
|
|
28
28
|
import './chunk-SNKY3C2L.js';
|
|
@@ -31,7 +31,7 @@ import './chunk-FD2UT76F.js';
|
|
|
31
31
|
import './chunk-U54XCYG3.js';
|
|
32
32
|
import './chunk-RP5HQVLD.js';
|
|
33
33
|
import './chunk-6X6ID4MO.js';
|
|
34
|
-
import './chunk-
|
|
34
|
+
import './chunk-4NAKHID5.js';
|
|
35
35
|
import './chunk-7AD3ZTZL.js';
|
|
36
36
|
import './chunk-AZ6FKDQR.js';
|
|
37
37
|
import './chunk-Q4DTGCSD.js';
|
|
@@ -1604,7 +1604,7 @@ function isBuiltAgent(m) {
|
|
|
1604
1604
|
return typeof m.send === "function";
|
|
1605
1605
|
}
|
|
1606
1606
|
async function materialize(def, index) {
|
|
1607
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1607
|
+
const { Agent: Agent2 } = await import('./agent-GKX5FE5K.js');
|
|
1608
1608
|
return Agent2.create({
|
|
1609
1609
|
// `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
|
|
1610
1610
|
// here means "declare nothing and let the default apply" — forwarding the literal would create
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one rule for "is this resolved path inside that root".
|
|
3
|
+
*
|
|
4
|
+
* Extracted because the package held it twice, at different strengths, for the same question. The
|
|
5
|
+
* correct version lived as a private function in `context-import-resolver.ts`, written for the
|
|
6
|
+
* 4.41.1 patch; the context manager had its own `absolute.startsWith(resolvePath(cwd))`, which
|
|
7
|
+
* admits two escapes:
|
|
8
|
+
*
|
|
9
|
+
* - **No separator boundary.** With `root = /home/user/proj`, the path `/home/user/proj-evil/x`
|
|
10
|
+
* starts with the root string and is NOT inside it. A sibling directory whose name merely
|
|
11
|
+
* extends the project's is enough; no `..` past the parent is needed.
|
|
12
|
+
* - **Lexical, not real.** A symlink whose name sits inside the root and whose target does not
|
|
13
|
+
* passes any comparison made before symlink resolution.
|
|
14
|
+
*
|
|
15
|
+
* The obvious escapes (`../../etc/passwd`, an absolute path) ARE refused by a prefix test, which is
|
|
16
|
+
* why the weaker version survived review: it looks like it works on the inputs a reader tries.
|
|
17
|
+
*
|
|
18
|
+
* Both readers of repository-supplied paths now share this module. That is DRY about the RULE
|
|
19
|
+
* rather than about line count — one piece of knowledge, one representation, so the two cannot
|
|
20
|
+
* drift apart again.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
package/dist/project.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkL5YO6PWL_cjs = require('./chunk-L5YO6PWL.cjs');
|
|
4
4
|
var chunkNETYW4V3_cjs = require('./chunk-NETYW4V3.cjs');
|
|
5
5
|
var chunkYULF6FPB_cjs = require('./chunk-YULF6FPB.cjs');
|
|
6
6
|
require('./chunk-ZHPET3LZ.cjs');
|
|
@@ -11,7 +11,7 @@ var DEFAULT_FILENAME = "THEO.md";
|
|
|
11
11
|
async function readProjectInstructions(cwd, options) {
|
|
12
12
|
const filename = options?.filename ?? DEFAULT_FILENAME;
|
|
13
13
|
const scope = options?.scope ?? "nearest";
|
|
14
|
-
const paths =
|
|
14
|
+
const paths = chunkL5YO6PWL_cjs.walkUpForFile(cwd, filename, options?.stopDir);
|
|
15
15
|
const files = [];
|
|
16
16
|
for (const path of paths) {
|
|
17
17
|
try {
|
|
@@ -30,7 +30,7 @@ function reduceContent(files, scope) {
|
|
|
30
30
|
}
|
|
31
31
|
async function writeProjectInstructions(cwd, content, options) {
|
|
32
32
|
const filename = options?.filename ?? DEFAULT_FILENAME;
|
|
33
|
-
if (!
|
|
33
|
+
if (!chunkL5YO6PWL_cjs.isSafePattern(filename)) {
|
|
34
34
|
throw new chunkYULF6FPB_cjs.ConfigurationError(
|
|
35
35
|
`writeProjectInstructions: unsafe filename ${JSON.stringify(filename)} (no path traversal, separators, or absolute paths)`,
|
|
36
36
|
{ code: "unsafe_filename" }
|
package/dist/project.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { walkUpForFile, isSafePattern } from './chunk-
|
|
1
|
+
import { walkUpForFile, isSafePattern } from './chunk-4NAKHID5.js';
|
|
2
2
|
import { replaceFileAtomic } from './chunk-VQFSEKU5.js';
|
|
3
3
|
import { ConfigurationError } from './chunk-MRKSSN36.js';
|
|
4
4
|
import './chunk-PBML2FHN.js';
|
|
@@ -1,15 +1,211 @@
|
|
|
1
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
* @theokit/sdk/server/auth —
|
|
4
|
+
* @theokit/sdk/server/auth — typed error classes
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
* Plan T1.2 + v1.1 EC-1 (AuthCancelledError for OAuth provider error response RFC 6749 §4.1.2.1).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Thrown at `defineAuth()` time when configuration is invalid
|
|
10
|
+
* (e.g., duplicate provider name, invalid email shape per EC-V1-12).
|
|
11
|
+
*/
|
|
12
|
+
declare class AuthConfigError extends Error {
|
|
13
|
+
readonly name = "AuthConfigError";
|
|
14
|
+
readonly code: string;
|
|
15
|
+
constructor(code: string, message: string);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Thrown at `startSignIn(providerName, ...)` or `finishSignIn(providerName, ...)`
|
|
19
|
+
* when the named provider is not registered in `providers[]`.
|
|
20
|
+
*/
|
|
21
|
+
declare class AuthProviderNotFoundError extends Error {
|
|
22
|
+
readonly name = "AuthProviderNotFoundError";
|
|
23
|
+
readonly providerName: string;
|
|
24
|
+
constructor(providerName: string);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Thrown during OAuth callback handling for state mismatches, expired
|
|
28
|
+
* transactions, missing query params, or provider 4xx/5xx errors.
|
|
29
|
+
*
|
|
30
|
+
* Typed `code` field lets consumers branch on cause:
|
|
31
|
+
* - 'oauth_transaction_expired' — cookie tx > 10min old (per ADR D5)
|
|
32
|
+
* - 'oauth_state_mismatch' — query state ≠ cookie state (CSRF defense per RFC 6749 §10.12)
|
|
33
|
+
* - 'oauth_provider_error' — non-access_denied error in callback URL
|
|
34
|
+
* - 'oauth_token_exchange_failed' — provider rejected code-for-tokens swap
|
|
35
|
+
* - 'oauth_userinfo_failed' — userinfo endpoint returned error
|
|
36
|
+
* - 'oauth_missing_code_or_state' — required query params absent
|
|
37
|
+
*/
|
|
38
|
+
declare class AuthCallbackError extends Error {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
readonly code: string;
|
|
41
|
+
constructor(code: string, message?: string);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Per v1.1 EC-1 MUST FIX — typed subclass of AuthCallbackError for the
|
|
45
|
+
* specific case where user declined consent at provider screen.
|
|
46
|
+
*
|
|
47
|
+
* OAuth 2.0 RFC 6749 §4.1.2.1: provider redirects with `?error=access_denied`.
|
|
48
|
+
* Apps can catch this distinctly from network/server errors to render
|
|
49
|
+
* "Login cancelled — try again" UX instead of opaque "callback failed".
|
|
50
|
+
*/
|
|
51
|
+
declare class AuthCancelledError extends AuthCallbackError {
|
|
52
|
+
readonly name: string;
|
|
53
|
+
readonly errorDescription?: string;
|
|
54
|
+
constructor(errorDescription?: string);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @theokit/sdk/server/auth — orchestrator types (Path C Hybrid per G11)
|
|
59
|
+
*
|
|
60
|
+
* Plan: g11-auth-architecture-implementation v1.4 (sha256 4d381020...)
|
|
61
|
+
* Blueprint: g11-auth-architecture-decision v1.1 (SHIPPABLE 97.9)
|
|
62
|
+
* AUTH-DELEGATION lock (theokit/CLAUDE.md:217-225) — these types are the
|
|
63
|
+
* orchestrator contract; concrete OAuth/email providers ship in opt-in
|
|
64
|
+
* @theokit/auth-* packages (adapters layer per ADR D11).
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* SessionManager contract (matches theokit/packages/theo/src/server/auth/session.ts:49).
|
|
69
|
+
* Imported as type-only — runtime depends via peerDep `theokit@>=0.2.4`.
|
|
70
|
+
*/
|
|
71
|
+
interface SessionManager<TSession> {
|
|
72
|
+
getSession(req: IncomingMessage): Promise<TSession | null>;
|
|
73
|
+
createSession(res: ServerResponse, data: TSession): Promise<void>;
|
|
74
|
+
destroySession(res: ServerResponse): void;
|
|
75
|
+
rotateSession(req: IncomingMessage, res: ServerResponse): Promise<TSession | null>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Per ADR D5 — OAuth transaction state stored in encrypted HttpOnly cookie
|
|
79
|
+
* (cookie-state pattern). Expires within 10 minutes per invariant.
|
|
80
|
+
*/
|
|
81
|
+
interface OAuthTransaction {
|
|
82
|
+
state: string;
|
|
83
|
+
pkceVerifier?: string;
|
|
84
|
+
returnTo?: string;
|
|
85
|
+
createdAt: number;
|
|
86
|
+
expiresAt: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Per ADR D9 — provider profile types are provider-specific (not unified).
|
|
90
|
+
* Each @theokit/auth-* package exports its own profile shape.
|
|
91
|
+
* Generic param TProfile lets consumers narrow via discriminated unions on providerName.
|
|
92
|
+
*/
|
|
93
|
+
interface AuthResult<TProfile, TName extends string = string> {
|
|
94
|
+
profile: TProfile;
|
|
95
|
+
providerName: TName;
|
|
96
|
+
rawTokens?: {
|
|
97
|
+
accessToken: string;
|
|
98
|
+
refreshToken?: string;
|
|
99
|
+
idToken?: string;
|
|
100
|
+
expiresAt?: number;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Provider contract — each @theokit/auth-* package implements this.
|
|
105
|
+
* Per blueprint Q5 + ADR D11 (adapters layer).
|
|
106
|
+
*/
|
|
107
|
+
interface AuthProvider<TProfile, TName extends string = string> {
|
|
108
|
+
name: TName;
|
|
109
|
+
createAuthorizationURL(tx: OAuthTransaction): URL | Promise<URL>;
|
|
110
|
+
handleCallback(req: IncomingMessage, tx: OAuthTransaction): Promise<AuthResult<TProfile, TName>>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* `defineAuth(opts)` configuration shape — Path C (Hybrid).
|
|
114
|
+
* `providers` optional: empty = Path A escape hatch (manual signIn only).
|
|
115
|
+
* `onSignIn` invoked after provider callback success; returns TSession to persist.
|
|
116
|
+
*/
|
|
117
|
+
interface DefineAuthOptions<TSession> {
|
|
118
|
+
session: SessionManager<TSession>;
|
|
119
|
+
providers?: AuthProvider<unknown, string>[];
|
|
120
|
+
onSignIn?: <TProfile>(args: {
|
|
121
|
+
profile: TProfile;
|
|
122
|
+
provider: string;
|
|
123
|
+
}) => Promise<TSession>;
|
|
124
|
+
onSignOut?: (session: TSession | null) => Promise<void> | void;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Returned by `defineAuth<TSession>(opts)` — 5-method orchestrator surface.
|
|
128
|
+
*
|
|
129
|
+
* - startSignIn: returns Response.redirect to provider authorization URL with state cookie
|
|
130
|
+
* - finishSignIn: handles provider callback; verifies state; calls onSignIn; rotates session ID
|
|
131
|
+
* (OWASP A07:2021 per EC-10); creates session cookie; clears transaction cookie
|
|
132
|
+
* - signIn: Path A escape hatch — skip OAuth flow; directly persist session from external profile
|
|
133
|
+
* - signOut: destroys session cookie + invokes onSignOut callback
|
|
134
|
+
* - getSession: read-only passthrough to session.getSession
|
|
135
|
+
*/
|
|
136
|
+
interface AuthOrchestrator<TSession> {
|
|
137
|
+
startSignIn(providerName: string, req: IncomingMessage, opts?: {
|
|
138
|
+
returnTo?: string;
|
|
139
|
+
}): Promise<Response>;
|
|
140
|
+
finishSignIn(providerName: string, req: IncomingMessage, res: ServerResponse): Promise<{
|
|
141
|
+
session: TSession;
|
|
142
|
+
returnTo?: string;
|
|
143
|
+
}>;
|
|
144
|
+
signIn<TProfile>(profile: TProfile, providerName: string, req: IncomingMessage, res: ServerResponse): Promise<TSession>;
|
|
145
|
+
signOut(res: ServerResponse): void | Promise<void>;
|
|
146
|
+
getSession(req: IncomingMessage): Promise<TSession | null>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @theokit/sdk/server/auth — encrypted OAuth transaction cookie store
|
|
151
|
+
*
|
|
152
|
+
* Per ADR D5 — cookie-state pattern (no Redis/db dependency in core).
|
|
153
|
+
*
|
|
154
|
+
* Stores OAuthTransaction (state + pkceVerifier + returnTo + expiry) in a
|
|
155
|
+
* single signed+encrypted HttpOnly cookie. Stateless, works in edge/serverless.
|
|
156
|
+
*
|
|
157
|
+
* Cookie name: `__Host-theo_oauth_tx` (T5.3 — RFC 6265bis prefix)
|
|
158
|
+
* Lifetime: 10 minutes (per D5 invariant)
|
|
159
|
+
* Encryption: AES-256-GCM via Node's webcrypto subtle API
|
|
160
|
+
*
|
|
161
|
+
* Note: this is a minimal in-package implementation. Production deployments
|
|
162
|
+
* may prefer using `theokit/server/auth/crypto`'s encrypt/decrypt helpers
|
|
163
|
+
* via the SessionManager's existing secret rotation chain. For T1.2 we keep
|
|
164
|
+
* it self-contained to avoid cross-package peer-dep complexity; T2+ may
|
|
165
|
+
* refactor to share SessionManager's encrypt path.
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* T5.1 — Typed error thrown when an OAuth tx-cookie secret has < 32
|
|
170
|
+
* bytes of entropy. Surfaces the actual byte length so operators can
|
|
171
|
+
* diagnose mis-configured env vars without leaking the secret itself.
|
|
172
|
+
*
|
|
173
|
+
* @public
|
|
174
|
+
*/
|
|
175
|
+
declare class AuthSecretTooShortError extends Error {
|
|
176
|
+
readonly name = "AuthSecretTooShortError";
|
|
177
|
+
constructor(actualBytes: number);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @theokit/sdk/server/auth — defineAuth orchestrator runtime (Path C Hybrid)
|
|
182
|
+
*
|
|
183
|
+
* Plan T1.2 implementation per blueprint Q5 § Path C signatures.
|
|
184
|
+
* Composes existing primitives + the v1.1 EC-1/EC-2/EC-10 fixes.
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
/** SE36 — `Auth.create` replaces `defineAuth` (ADR 0015). @public */
|
|
188
|
+
declare class Auth {
|
|
189
|
+
private constructor();
|
|
190
|
+
static create<TSession>(opts: DefineAuthOptions<TSession>): AuthOrchestrator<TSession>;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @theokit/sdk/server/auth — same-origin returnTo validator
|
|
195
|
+
*
|
|
196
|
+
* Per v1.1 EC-2 MUST FIX — OWASP A01:2021 open-redirect mitigation.
|
|
197
|
+
*
|
|
198
|
+
* Without this check, attacker craft `/login?returnTo=https://evil.com` would
|
|
199
|
+
* cause post-login redirect to attacker domain with authenticated session cookie.
|
|
7
200
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
201
|
+
* Rules:
|
|
202
|
+
* - undefined/empty returnTo → default '/'
|
|
203
|
+
* - protocol-relative `//evil.com` → default '/' (URL parser would resolve to baseUrl protocol)
|
|
204
|
+
* - absolute URL with origin ≠ baseUrl.origin → default '/' (cross-origin redirect)
|
|
205
|
+
* - absolute URL with origin === baseUrl.origin → keep (same-origin allowed)
|
|
206
|
+
* - relative path starting with '/' → keep (same-app navigation)
|
|
207
|
+
* - relative path not starting with '/' → default '/' (defensive)
|
|
10
208
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export { Auth
|
|
14
|
-
export type { AuthOrchestrator, AuthProvider, AuthResult, DefineAuthOptions, OAuthTransaction, SessionManager, } from "./types.js";
|
|
15
|
-
export { validateReturnTo } from "./validate-return-to.js";
|
|
209
|
+
declare function validateReturnTo(returnTo: string | undefined, baseUrl: URL): string;
|
|
210
|
+
|
|
211
|
+
export { Auth, AuthCallbackError, AuthCancelledError, AuthConfigError, type AuthOrchestrator, type AuthProvider, AuthProviderNotFoundError, type AuthResult, AuthSecretTooShortError, type DefineAuthOptions, type OAuthTransaction, type SessionManager, validateReturnTo };
|