@theokit/sdk 4.50.0 → 4.51.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 +11 -0
- package/dist/{agent-JA4ILE5O.cjs → agent-B2WU3JP6.cjs} +10 -9
- package/dist/{agent-JA4ILE5O.cjs.map → agent-B2WU3JP6.cjs.map} +1 -1
- package/dist/{agent-GKX5FE5K.js → agent-DI2QQHSJ.js} +9 -8
- package/dist/{agent-GKX5FE5K.js.map → agent-DI2QQHSJ.js.map} +1 -1
- package/dist/{chunk-3NLOQEJR.js → chunk-34XOCZJO.js} +5 -16
- package/dist/chunk-34XOCZJO.js.map +1 -0
- package/dist/{chunk-64TJCXY5.cjs → chunk-3G6ZDZ6L.cjs} +5 -5
- package/dist/{chunk-64TJCXY5.cjs.map → chunk-3G6ZDZ6L.cjs.map} +1 -1
- package/dist/{chunk-JO76RWCA.cjs → chunk-72HEBGWN.cjs} +4 -4
- package/dist/{chunk-JO76RWCA.cjs.map → chunk-72HEBGWN.cjs.map} +1 -1
- package/dist/{chunk-XARLSCKA.js → chunk-ACHVCIDQ.js} +11 -11
- package/dist/chunk-ACHVCIDQ.js.map +1 -0
- package/dist/{chunk-RJBHWM6D.js → chunk-E54KDYOE.js} +3 -3
- package/dist/{chunk-RJBHWM6D.js.map → chunk-E54KDYOE.js.map} +1 -1
- package/dist/{chunk-2S6B5B2A.js → chunk-E7WDXT4X.js} +3 -3
- package/dist/{chunk-2S6B5B2A.js.map → chunk-E7WDXT4X.js.map} +1 -1
- package/dist/{chunk-TSK4VVBW.cjs → chunk-F7OBYH2X.cjs} +52 -52
- package/dist/chunk-F7OBYH2X.cjs.map +1 -0
- package/dist/{chunk-6FSQ3CHQ.js → chunk-JGYYNDAZ.js} +5 -6
- package/dist/chunk-JGYYNDAZ.js.map +1 -0
- package/dist/{chunk-UU7MAO2D.cjs → chunk-OKLYRPKL.cjs} +4 -16
- package/dist/chunk-OKLYRPKL.cjs.map +1 -0
- package/dist/{chunk-EON4YTR6.js → chunk-R2A3WIJY.js} +3 -3
- package/dist/{chunk-EON4YTR6.js.map → chunk-R2A3WIJY.js.map} +1 -1
- package/dist/chunk-RIAM53CP.js +22 -0
- package/dist/chunk-RIAM53CP.js.map +1 -0
- package/dist/{chunk-GH52NOCL.cjs → chunk-RWMNTFHZ.cjs} +9 -9
- package/dist/{chunk-GH52NOCL.cjs.map → chunk-RWMNTFHZ.cjs.map} +1 -1
- package/dist/{chunk-MZQHVN7C.js → chunk-SEZJGV7C.js} +3 -3
- package/dist/{chunk-MZQHVN7C.js.map → chunk-SEZJGV7C.js.map} +1 -1
- package/dist/{chunk-FAUKVJCC.cjs → chunk-UQHIEUDY.cjs} +3 -3
- package/dist/{chunk-FAUKVJCC.cjs.map → chunk-UQHIEUDY.cjs.map} +1 -1
- package/dist/{chunk-UJ7HK7BX.js → chunk-VK7SIDYI.js} +3 -3
- package/dist/{chunk-UJ7HK7BX.js.map → chunk-VK7SIDYI.js.map} +1 -1
- package/dist/chunk-VKJ7V7EB.cjs +25 -0
- package/dist/chunk-VKJ7V7EB.cjs.map +1 -0
- package/dist/{chunk-74VVGK7P.cjs → chunk-WUUSAMFC.cjs} +5 -5
- package/dist/{chunk-74VVGK7P.cjs.map → chunk-WUUSAMFC.cjs.map} +1 -1
- package/dist/{chunk-XA3TSBAH.cjs → chunk-XABN5HY6.cjs} +4 -5
- package/dist/chunk-XABN5HY6.cjs.map +1 -0
- package/dist/{compact-session-UUCBTBCZ.cjs → compact-session-FKYCJRAK.cjs} +4 -3
- package/dist/{compact-session-UUCBTBCZ.cjs.map → compact-session-FKYCJRAK.cjs.map} +1 -1
- package/dist/{compact-session-GF2CBKXB.js → compact-session-LF4YOT5S.js} +4 -3
- package/dist/{compact-session-GF2CBKXB.js.map → compact-session-LF4YOT5S.js.map} +1 -1
- package/dist/context/index.cjs +6 -5
- package/dist/context/index.cjs.map +1 -1
- package/dist/context/index.js +3 -2
- package/dist/context/index.js.map +1 -1
- package/dist/cron.cjs +9 -8
- package/dist/cron.js +8 -7
- package/dist/eval.cjs +8 -7
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +7 -6
- package/dist/eval.js.map +1 -1
- package/dist/filesystem/index.cjs +6 -5
- package/dist/filesystem/index.cjs.map +1 -1
- package/dist/filesystem/index.js +2 -1
- package/dist/filesystem/index.js.map +1 -1
- package/dist/{index-manager-YFFEPISE.cjs → index-manager-34ELCOAP.cjs} +6 -5
- package/dist/{index-manager-YFFEPISE.cjs.map → index-manager-34ELCOAP.cjs.map} +1 -1
- package/dist/index-manager-OMJVYS2U.js +12 -0
- package/dist/{index-manager-X5IPG2JL.js.map → index-manager-OMJVYS2U.js.map} +1 -1
- package/dist/index.cjs +127 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +239 -1
- package/dist/index.d.ts +239 -1
- package/dist/index.js +98 -13
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-I3HK3AHB.cjs → inject-session-J7Y6XACY.cjs} +4 -4
- package/dist/{inject-session-I3HK3AHB.cjs.map → inject-session-J7Y6XACY.cjs.map} +1 -1
- package/dist/{inject-session-NR64GB3T.js → inject-session-MWRJENH4.js} +3 -3
- package/dist/{inject-session-NR64GB3T.js.map → inject-session-MWRJENH4.js.map} +1 -1
- package/dist/internal/memory/adapters/index.cjs +2 -1
- package/dist/internal/memory/adapters/index.js +2 -1
- package/dist/internal/security/index.cjs +9 -8
- package/dist/internal/security/index.js +2 -1
- package/dist/path-safety.cjs +9 -8
- package/dist/path-safety.js +2 -1
- package/dist/skills.cjs +5 -4
- package/dist/skills.js +3 -2
- package/dist/workflow.cjs +11 -10
- package/dist/workflow.js +3 -2
- package/package.json +1 -1
- package/dist/chunk-3NLOQEJR.js.map +0 -1
- package/dist/chunk-6FSQ3CHQ.js.map +0 -1
- package/dist/chunk-TSK4VVBW.cjs.map +0 -1
- package/dist/chunk-UU7MAO2D.cjs.map +0 -1
- package/dist/chunk-XA3TSBAH.cjs.map +0 -1
- package/dist/chunk-XARLSCKA.js.map +0 -1
- package/dist/index-manager-X5IPG2JL.js +0 -11
package/dist/index.js
CHANGED
|
@@ -3,13 +3,13 @@ export { JudgeCredentialError } from './chunk-PAV4ZPSW.js';
|
|
|
3
3
|
export { StreamObjectError } from './chunk-3KY7MHR4.js';
|
|
4
4
|
export { GenerateObjectError } from './chunk-35NFZ7QB.js';
|
|
5
5
|
import './chunk-O3IZ7JEL.js';
|
|
6
|
-
import { Workflow, agentStep } from './chunk-
|
|
6
|
+
import { Workflow, agentStep } from './chunk-R2A3WIJY.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-
|
|
12
|
-
import './chunk-
|
|
9
|
+
export { Cron } from './chunk-SEZJGV7C.js';
|
|
10
|
+
import { MEMORY_EMBEDDING_ADAPTERS, resolveApiKey, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-ACHVCIDQ.js';
|
|
11
|
+
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-ACHVCIDQ.js';
|
|
12
|
+
import './chunk-VK7SIDYI.js';
|
|
13
13
|
import './chunk-2SFBB54R.js';
|
|
14
14
|
import { configure, submit, list, get, cancel, subscribe } from './chunk-GNMPCZNN.js';
|
|
15
15
|
export { emitRunEvent } from './chunk-GNMPCZNN.js';
|
|
@@ -19,10 +19,10 @@ import { discoverProviderPlugins, shouldUseFixtureMode, isFixtureApiKey, httpReq
|
|
|
19
19
|
import './chunk-4QEC4CCS.js';
|
|
20
20
|
import './chunk-F4RUADRC.js';
|
|
21
21
|
import './chunk-ZTEAJAE6.js';
|
|
22
|
-
import { lanceStoragePath, LanceIndex, readFactsFromMarkdown, defaultIndexPath, openMemoryDb, memoryDir } from './chunk-
|
|
22
|
+
import { lanceStoragePath, LanceIndex, readFactsFromMarkdown, defaultIndexPath, openMemoryDb, memoryDir } from './chunk-E54KDYOE.js';
|
|
23
23
|
import './chunk-J5RW43IR.js';
|
|
24
24
|
import './chunk-AM2CNBKE.js';
|
|
25
|
-
import './chunk-
|
|
25
|
+
import './chunk-34XOCZJO.js';
|
|
26
26
|
import './chunk-ZS6SLELQ.js';
|
|
27
27
|
import './chunk-LLE7HPRI.js';
|
|
28
28
|
import './chunk-SNKY3C2L.js';
|
|
@@ -50,15 +50,16 @@ import { parseModelId } from './chunk-X2FR4OIT.js';
|
|
|
50
50
|
import { registerBuiltins, listProviders, getCatalogCapabilities, getProviderProfile } from './chunk-Z6N6SDNR.js';
|
|
51
51
|
import './chunk-L4JFQCG4.js';
|
|
52
52
|
import './chunk-5NBUH3NO.js';
|
|
53
|
-
import './chunk-
|
|
54
|
-
import './chunk-
|
|
53
|
+
import './chunk-E7WDXT4X.js';
|
|
54
|
+
import './chunk-JGYYNDAZ.js';
|
|
55
|
+
import './chunk-RIAM53CP.js';
|
|
55
56
|
import './chunk-OLLOUAUJ.js';
|
|
56
57
|
import { BudgetExceededError, TheokitAgentError, MemoryAdapterError, AuthenticationError, ConfigurationError } from './chunk-MRKSSN36.js';
|
|
57
58
|
export { AgentDisposedError, AgentRunError, AuthenticationError, BudgetExceededError, ConfigurationError, IntegrationNotConnectedError, InvalidTaskIdError, MemoryAdapterError, NetworkError, RateLimitError, TaskNotFoundError, TheokitAgentError, UnknownAgentError, UnsupportedBudgetOperationError, UnsupportedRunOperationError, UnsupportedTaskOperationError, isTransientError } from './chunk-MRKSSN36.js';
|
|
58
59
|
import { diag, redactSecrets, addPattern } from './chunk-PBML2FHN.js';
|
|
59
60
|
export { setDiagnosticsSink } from './chunk-PBML2FHN.js';
|
|
61
|
+
import { createHash, randomUUID } from 'crypto';
|
|
60
62
|
import { z } from 'zod';
|
|
61
|
-
import { randomUUID, createHash } from 'crypto';
|
|
62
63
|
import { mkdir, readFile } from 'fs/promises';
|
|
63
64
|
import { join } from 'path';
|
|
64
65
|
import { existsSync, rmSync, mkdirSync, renameSync } from 'fs';
|
|
@@ -106,6 +107,39 @@ var AgentFactory = class {
|
|
|
106
107
|
}
|
|
107
108
|
};
|
|
108
109
|
|
|
110
|
+
// src/approval-policy.ts
|
|
111
|
+
var BY_MODE = {
|
|
112
|
+
ask: { outcome: "ask", reason: "mode-ask" },
|
|
113
|
+
"never-ask": { outcome: "allow", reason: "mode-never-ask" },
|
|
114
|
+
"refuse-all": { outcome: "deny", reason: "mode-refuse-all" }
|
|
115
|
+
};
|
|
116
|
+
function decideApproval(input) {
|
|
117
|
+
const { tool } = input;
|
|
118
|
+
if ((input.denied ?? []).includes(tool)) {
|
|
119
|
+
return { outcome: "deny", reason: "explicitly-denied", tool };
|
|
120
|
+
}
|
|
121
|
+
if ((input.allowed ?? []).includes(tool)) {
|
|
122
|
+
return { outcome: "allow", reason: "explicitly-allowed", tool };
|
|
123
|
+
}
|
|
124
|
+
const fromMode = BY_MODE[input.mode];
|
|
125
|
+
return { outcome: fromMode.outcome, reason: fromMode.reason, tool };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// src/blast-radius.ts
|
|
129
|
+
function evaluateBlastRadius(input) {
|
|
130
|
+
const { scope, reversible } = input.action;
|
|
131
|
+
if (scope.length === 0) {
|
|
132
|
+
return { outcome: "refuse", reason: "scope-undeclared", scope };
|
|
133
|
+
}
|
|
134
|
+
if (!input.granted.includes(scope)) {
|
|
135
|
+
return { outcome: "refuse", reason: "scope-not-granted", scope };
|
|
136
|
+
}
|
|
137
|
+
if (!reversible && !(input.irreversibleAllowed ?? []).includes(scope)) {
|
|
138
|
+
return { outcome: "require-approval", reason: "irreversible", scope };
|
|
139
|
+
}
|
|
140
|
+
return { outcome: "allow", reason: "within-granted-scope", scope };
|
|
141
|
+
}
|
|
142
|
+
|
|
109
143
|
// src/internal/budget/calendar-window.ts
|
|
110
144
|
function startOfDayUtc(now = /* @__PURE__ */ new Date()) {
|
|
111
145
|
return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
|
|
@@ -571,6 +605,18 @@ var Skill = class {
|
|
|
571
605
|
return createSkill(spec);
|
|
572
606
|
}
|
|
573
607
|
};
|
|
608
|
+
function describeCredential(input) {
|
|
609
|
+
const secret = (input.value ?? "").trim();
|
|
610
|
+
if (secret.length === 0) {
|
|
611
|
+
return { provider: input.provider, present: false, source: input.source };
|
|
612
|
+
}
|
|
613
|
+
return {
|
|
614
|
+
provider: input.provider,
|
|
615
|
+
present: true,
|
|
616
|
+
source: input.source,
|
|
617
|
+
fingerprint: createHash("sha256").update(secret).digest("hex").slice(0, 8)
|
|
618
|
+
};
|
|
619
|
+
}
|
|
574
620
|
|
|
575
621
|
// src/define-provider.ts
|
|
576
622
|
function defineProvider(profile, opts) {
|
|
@@ -1217,7 +1263,7 @@ var Memory = {
|
|
|
1217
1263
|
openArgs.embedding = await resolveEmbedding(opts.embedding, peer.MEMORY_EMBEDDING_ADAPTERS);
|
|
1218
1264
|
return await peer.IndexManager.open(openArgs);
|
|
1219
1265
|
}
|
|
1220
|
-
const { IndexManager } = await import('./index-manager-
|
|
1266
|
+
const { IndexManager } = await import('./index-manager-OMJVYS2U.js');
|
|
1221
1267
|
openArgs.embedding = await resolveEmbedding(opts.embedding, MEMORY_EMBEDDING_ADAPTERS);
|
|
1222
1268
|
return await IndexManager.open(openArgs);
|
|
1223
1269
|
},
|
|
@@ -1758,6 +1804,28 @@ function applySecurityFloor(input) {
|
|
|
1758
1804
|
return input.layers[input.override] ?? tightenOnly(input, baseline(input));
|
|
1759
1805
|
}
|
|
1760
1806
|
|
|
1807
|
+
// src/session-guard.ts
|
|
1808
|
+
var LiveSessionError = class extends TheokitAgentError {
|
|
1809
|
+
name = "LiveSessionError";
|
|
1810
|
+
sessionId;
|
|
1811
|
+
reason;
|
|
1812
|
+
constructor(sessionId, reason) {
|
|
1813
|
+
super(
|
|
1814
|
+
reason === "session-is-live" ? `refusing to destroy session ${sessionId}: it is live \u2014 another process is probably still appending to it. Switch to another session first.` : `refusing to destroy session ${sessionId}: the set of live sessions could not be determined, so this cannot be shown to be safe. Resolve that before deleting.`
|
|
1815
|
+
);
|
|
1816
|
+
this.sessionId = sessionId;
|
|
1817
|
+
this.reason = reason;
|
|
1818
|
+
}
|
|
1819
|
+
};
|
|
1820
|
+
function guardSessionDestruction(sessionId, live) {
|
|
1821
|
+
if (live === void 0) {
|
|
1822
|
+
throw new LiveSessionError(sessionId, "liveness-undetermined");
|
|
1823
|
+
}
|
|
1824
|
+
if (live.includes(sessionId)) {
|
|
1825
|
+
throw new LiveSessionError(sessionId, "session-is-live");
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1761
1829
|
// src/session-scope.ts
|
|
1762
1830
|
function scopedConversationId(scope, id) {
|
|
1763
1831
|
return `${scope}__${id}`;
|
|
@@ -1771,7 +1839,7 @@ function isBuiltAgent(m) {
|
|
|
1771
1839
|
return typeof m.send === "function";
|
|
1772
1840
|
}
|
|
1773
1841
|
async function materialize(def, index) {
|
|
1774
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1842
|
+
const { Agent: Agent2 } = await import('./agent-DI2QQHSJ.js');
|
|
1775
1843
|
return Agent2.create({
|
|
1776
1844
|
// `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
|
|
1777
1845
|
// here means "declare nothing and let the default apply" — forwarding the literal would create
|
|
@@ -2161,6 +2229,23 @@ async function executeCatalogRequest(request) {
|
|
|
2161
2229
|
return httpRequest(request.path, { apiKey });
|
|
2162
2230
|
}
|
|
2163
2231
|
|
|
2232
|
+
// src/tool-blast-radius.ts
|
|
2233
|
+
var DECLARED = /* @__PURE__ */ Symbol.for("@theokit/sdk.blastRadius");
|
|
2234
|
+
function withBlastRadius(tool, action) {
|
|
2235
|
+
return Object.defineProperty(tool, DECLARED, {
|
|
2236
|
+
value: action,
|
|
2237
|
+
// `enumerable: false` is defensive and NOT load-bearing — checked, not assumed. Flipping it to
|
|
2238
|
+
// true leaves every case green, because the symbol key already excludes this from `Object.keys`
|
|
2239
|
+
// and `JSON.stringify`. It stays because a future string-keyed variant would need it, and the
|
|
2240
|
+
// next reader should not have to discover that the flag has no test behind it.
|
|
2241
|
+
enumerable: false,
|
|
2242
|
+
configurable: true
|
|
2243
|
+
});
|
|
2244
|
+
}
|
|
2245
|
+
function describeAction(tool) {
|
|
2246
|
+
return tool[DECLARED];
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2164
2249
|
// src/trajectory-helpers.ts
|
|
2165
2250
|
function toShareGptTrajectory(result, options) {
|
|
2166
2251
|
if (!result.ok) return null;
|
|
@@ -2288,6 +2373,6 @@ function recordWiring(input) {
|
|
|
2288
2373
|
return record;
|
|
2289
2374
|
}
|
|
2290
2375
|
|
|
2291
|
-
export { AgentFactory, Budget, EventBus, JobQueue, LayerOrderError, Memory, NoopMemoryProvider, PermissionEngine, PermissionPlugin, Plugin, Provider, RetentionPolicyError, SOVEREIGN_ENV_KEYS, Security, Skill, SkillReadTool, Squad, Task, Theokit, TokenLimiter, UngatedCapabilityError, UnicodeNormalizer, applyMode, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, createCounterBudgetTracker, estimateTokens, extractRawId, foldLayers, inferApiMode, loadProjectEnv, migrateSqliteToLance2 as migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, planReaping, preflightCheck, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, verifyLayerOrdering };
|
|
2376
|
+
export { AgentFactory, Budget, EventBus, JobQueue, LayerOrderError, LiveSessionError, Memory, NoopMemoryProvider, PermissionEngine, PermissionPlugin, Plugin, Provider, RetentionPolicyError, SOVEREIGN_ENV_KEYS, Security, Skill, SkillReadTool, Squad, Task, Theokit, TokenLimiter, UngatedCapabilityError, UnicodeNormalizer, applyMode, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, createCounterBudgetTracker, decideApproval, describeAction, describeCredential, estimateTokens, evaluateBlastRadius, extractRawId, foldLayers, guardSessionDestruction, inferApiMode, loadProjectEnv, migrateSqliteToLance2 as migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, planReaping, preflightCheck, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, toShareGptTrajectory, verifyLayerOrdering, withBlastRadius };
|
|
2292
2377
|
//# sourceMappingURL=index.js.map
|
|
2293
2378
|
//# sourceMappingURL=index.js.map
|