@theokit/sdk 4.19.2 → 4.19.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cron.cjs +20 -25
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +21 -26
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +20 -25
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +21 -26
- package/dist/eval.js.map +1 -1
- package/dist/filesystem/index.cjs +7 -2
- package/dist/filesystem/index.cjs.map +1 -1
- package/dist/filesystem/index.js +7 -2
- package/dist/filesystem/index.js.map +1 -1
- package/dist/index.cjs +20 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -25
- package/dist/index.js.map +1 -1
- package/dist/internal/persistence/index.cjs +1 -3
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +1 -3
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/security/index.cjs +7 -2
- package/dist/internal/security/index.cjs.map +1 -1
- package/dist/internal/security/index.js +8 -3
- package/dist/internal/security/index.js.map +1 -1
- package/dist/path-safety.cjs +7 -2
- package/dist/path-safety.cjs.map +1 -1
- package/dist/path-safety.js +8 -3
- package/dist/path-safety.js.map +1 -1
- package/dist/persistence.cjs +1 -3
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +1 -3
- package/dist/persistence.js.map +1 -1
- package/dist/provider-catalog.json +469 -144
- package/dist/skills.cjs +7 -2
- package/dist/skills.cjs.map +1 -1
- package/dist/skills.js +7 -2
- package/dist/skills.js.map +1 -1
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.js.map +1 -1
- package/package.json +13 -12
package/dist/eval.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z, toJSONSchema } from 'zod';
|
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
3
|
import { randomUUID, randomBytes, createHash } from 'crypto';
|
|
4
4
|
import { mkdir, readFile, open, rename, unlink, writeFile, statfs, readdir, stat, access } from 'fs/promises';
|
|
5
|
-
import { join, dirname, resolve,
|
|
5
|
+
import { join, dirname, resolve, relative, sep, isAbsolute } from 'path';
|
|
6
6
|
import { readFileSync, existsSync, mkdirSync, appendFileSync, realpathSync, lstatSync, readlinkSync, readdirSync, statSync, chmodSync, openSync, writeFileSync, fsyncSync, closeSync, renameSync, unlinkSync } from 'fs';
|
|
7
7
|
import { homedir } from 'os';
|
|
8
8
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
@@ -847,6 +847,11 @@ var init_atomic_write = __esm({
|
|
|
847
847
|
warnedNfsDirs = /* @__PURE__ */ new Set();
|
|
848
848
|
}
|
|
849
849
|
});
|
|
850
|
+
function isInside(target, base) {
|
|
851
|
+
if (target === base) return true;
|
|
852
|
+
const prefix = base.endsWith(sep) ? base : base + sep;
|
|
853
|
+
return target.startsWith(prefix);
|
|
854
|
+
}
|
|
850
855
|
function safePathJoin(base, ...parts) {
|
|
851
856
|
if (base === "") {
|
|
852
857
|
throw new Error("safePathJoin: base must be non-empty");
|
|
@@ -857,7 +862,7 @@ function safePathJoin(base, ...parts) {
|
|
|
857
862
|
}
|
|
858
863
|
const baseResolved = resolve(base);
|
|
859
864
|
const target = resolve(base, ...parts);
|
|
860
|
-
if (target
|
|
865
|
+
if (!isInside(target, baseResolved)) {
|
|
861
866
|
throw new PathTraversalError(parts.join("/"), target);
|
|
862
867
|
}
|
|
863
868
|
return target;
|
|
@@ -882,7 +887,7 @@ function assertNoSymlinkEscape(path, base) {
|
|
|
882
887
|
}
|
|
883
888
|
const resolved = realpathOfDeepestExisting(path);
|
|
884
889
|
if (resolved === void 0) return;
|
|
885
|
-
if (resolved
|
|
890
|
+
if (!isInside(resolved, baseResolved)) {
|
|
886
891
|
throw new PathTraversalError(`symlink ${path}`, resolved);
|
|
887
892
|
}
|
|
888
893
|
}
|
|
@@ -17160,9 +17165,7 @@ async function loadDriver(filePath) {
|
|
|
17160
17165
|
}
|
|
17161
17166
|
try {
|
|
17162
17167
|
const mod = await (driverLoaderOverrides?.nodeSqlite?.() ?? Promise.resolve(
|
|
17163
|
-
process.getBuiltinModule?.(
|
|
17164
|
-
"node:sqlite"
|
|
17165
|
-
) ?? (() => {
|
|
17168
|
+
process.getBuiltinModule?.("node:sqlite") ?? (() => {
|
|
17166
17169
|
throw new Error("node:sqlite built-in unavailable (Node < 22.3)");
|
|
17167
17170
|
})()
|
|
17168
17171
|
));
|
|
@@ -19696,8 +19699,8 @@ async function getRegisteredAgentOrThrow(agentId) {
|
|
|
19696
19699
|
// src/agent.ts
|
|
19697
19700
|
init_errors();
|
|
19698
19701
|
init_discovery();
|
|
19699
|
-
init_agent_factory_registry();
|
|
19700
19702
|
init_agent_session();
|
|
19703
|
+
init_agent_factory_registry();
|
|
19701
19704
|
var streamObjectImport;
|
|
19702
19705
|
var Agent = class _Agent {
|
|
19703
19706
|
constructor() {
|
|
@@ -19989,9 +19992,7 @@ var Agent = class _Agent {
|
|
|
19989
19992
|
reg = getRegisteredAgent(agentId);
|
|
19990
19993
|
}
|
|
19991
19994
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
19992
|
-
throw new UnknownAgentError(
|
|
19993
|
-
`No local agent "${agentId}" registered \u2014 compact targets local sessions.`
|
|
19994
|
-
);
|
|
19995
|
+
throw new UnknownAgentError(`No local agent "${agentId}" registered \u2014 compact targets local sessions.`);
|
|
19995
19996
|
}
|
|
19996
19997
|
const cwd = reg.cwd ?? process.cwd();
|
|
19997
19998
|
const optModel = reg.options.model;
|
|
@@ -20001,20 +20002,16 @@ var Agent = class _Agent {
|
|
|
20001
20002
|
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
|
|
20002
20003
|
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
20003
20004
|
const store = new FsSessionStore2({ baseDir, cwd });
|
|
20004
|
-
return enqueueSessionWrite(
|
|
20005
|
-
|
|
20006
|
-
agentId,
|
|
20007
|
-
|
|
20008
|
-
|
|
20009
|
-
|
|
20010
|
-
|
|
20011
|
-
|
|
20012
|
-
summarize: options.summarize ?? buildDefaultSummarizer2({
|
|
20013
|
-
agentModel: model,
|
|
20014
|
-
...reg.options.apiKey !== void 0 ? { apiKey: reg.options.apiKey } : {}
|
|
20015
|
-
})
|
|
20005
|
+
return enqueueSessionWrite(cwd, agentId, () => compactSessionTranscript2({
|
|
20006
|
+
store,
|
|
20007
|
+
loc: { cwd, agentId, model },
|
|
20008
|
+
sessionId: agentId,
|
|
20009
|
+
trigger: options.trigger ?? "manual",
|
|
20010
|
+
summarize: options.summarize ?? buildDefaultSummarizer2({
|
|
20011
|
+
agentModel: model,
|
|
20012
|
+
...reg.options.apiKey !== void 0 ? { apiKey: reg.options.apiKey } : {}
|
|
20016
20013
|
})
|
|
20017
|
-
);
|
|
20014
|
+
}));
|
|
20018
20015
|
}
|
|
20019
20016
|
/**
|
|
20020
20017
|
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
@@ -20031,9 +20028,7 @@ var Agent = class _Agent {
|
|
|
20031
20028
|
reg = getRegisteredAgent(agentId);
|
|
20032
20029
|
}
|
|
20033
20030
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
20034
|
-
throw new UnknownAgentError(
|
|
20035
|
-
`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
|
|
20036
|
-
);
|
|
20031
|
+
throw new UnknownAgentError(`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`);
|
|
20037
20032
|
}
|
|
20038
20033
|
const cwd = reg.cwd ?? process.cwd();
|
|
20039
20034
|
const optModel = reg.options.model;
|