theokit 0.48.0 → 0.48.2

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.
@@ -8,8 +8,7 @@ export { ActionNode, ActionScanError, LoadedManifest, ManifestAction, ManifestAg
8
8
  export { L as LoadModule, S as ServerRouteNode, c as compilePattern, a as createProductionLoader, b as createViteLoader, m as matchRoute } from '../match-CfbEFRG4.js';
9
9
  import { T as TheoErrorEnvelope, a as TheoErrorCode, V as ValidationFieldsExt } from '../error-envelope-DG47lt8E.js';
10
10
  export { AcpToolConfig, AppResource, AppResourceInput, ChannelMessage, ChannelWebhookConfig, CodeModeApi, CodeModeConfig, CodeModePermission, CodeModePermissionDeniedError, McpResourceContents, McpResourceDescriptor, NodeAcpTransport, ProviderDescriptor, ResolvedProvider, Sandbox, StdioStreams, VendorAgentClient, VendorAgentToolConfig, WorkflowLike, WorkflowToolConfig, buildResourceDescriptors, createACPTool, createCodeMode, createVendorAgentTool, createWorkflowTool, defineAppResource, extractAppResources, handleChannelWebhook, handleMcpStdioLine, isChannelPath, listProviders, parseChannelPath, readAppResource, registerProvider, resetProviderRegistry, resolveProvider, serveMcpStdio, tryResolveProvider } from './agent/index.js';
11
- import { TrustPosture } from '@theokit/agents';
12
- export { InProcessApprovalRequest, InProcessApprovalRequiredError, InProcessAwaitApproval, StreamAgentTurnDeps, StreamAgentTurnInProcessInput, resolveEffectiveContextWindow as effectiveContextWindow, streamAgentTurnInProcess } from '@theokit/agents';
11
+ export { InProcessApprovalRequest, InProcessApprovalRequiredError, InProcessAwaitApproval, StreamAgentTurnDeps, StreamAgentTurnInProcessInput, streamAgentTurnInProcess } from '@theokit/agents';
13
12
  export { AuthRequiredError, BackupCode, BackupCodeOptions, OidcMetadata, PkceChallenge, SessionConfig, SessionManager, SessionManagerWeb, SessionMeta, ThrottleOptions, ThrottleState, TotpAlgorithm, TotpOptions, TotpUriOptions, VerifyTotpOptions, _resetKeyCacheForTests, assertProductionSecret, checkThrottle, clearOidcCache, createSessionManager, createSessionManagerWeb, decrypt, discoverOidcProvider, encrypt, generateBackupCodes, generateNonce, generateOAuthState, generatePkceChallenge, generateTotp, generateTotpSecret, pkceChallengeFromVerifier, recordAttempt, requireAuth, rotateIfNeeded, rotateIfNeededWeb, totpUri, verifyBackupCode, verifyOAuthState, verifyTotp } from './auth/index.js';
14
13
  export { InMemoryUsageStorage, ToolHookEvent, ToolUsageRecord, TrackAgentRunInput, TrackAgentRunOptions, TrackAgentToolsHooks, TrackAgentToolsOptions, UsageQuery, UsageRecord, UsageResult, UsageStorageAdapter, trackAgentRun, trackAgentTools } from './cost/index.js';
15
14
  export { InMemoryUsageStorage as NeutralUsageStorage } from '@theokit/agents/usage';
@@ -36,6 +35,7 @@ import { z } from 'zod';
36
35
  import { IncomingMessage } from 'node:http';
37
36
  import { W as WebOnRequestHook, b as WebPreHandlerHook, c as WebOnResponseHook, d as WebOnErrorHook } from '../plugin-types-D69-lJZ9.js';
38
37
  export { e as HookName, H as HookResult, O as OnErrorHook, f as OnRequestHook, g as OnResponseHook, P as PluginContext, h as PluginErrorContext, i as PreHandlerHook, R as RunHookOptions, a as TheoApp, T as TheoPlugin } from '../plugin-types-D69-lJZ9.js';
38
+ export { ComposeInstructionsOptions, ComposedInstructions, ConfigLayer, ContextPressure, ContextPressureThresholdError, ContextPressureThresholds, CustomCommand, CustomCommandsResult, DEFAULT_CONTEXT_PRESSURE_THRESHOLDS, InstructionBlock, InstructionSource, InstructionTree, InstructionTreeBudget, LayerOutOfOrderError, LayeredConfig, LayeredConfigInput, LayeredConfigResult, LoadCustomCommandsInput, LoadInstructionTreeInput, ParsedFrontmatter, PrecedenceReport, ProvenancePerKey, TrustRecord, TrustStore, TrustStorePermissionsError, composeInstructions, contextPressure, effectiveContextWindow, frontmatterValue, loadCustomCommands, loadInstructionTree, splitFrontmatter } from '@theokit/agents/config';
39
39
  export { a as ServiceDefinition, S as ServicesConfig, b as ServicesConfigInput, c as ServicesConfigOutput } from '../schema-BpH6ivDY.js';
40
40
  import '@theokit/presenter/wire';
41
41
  import 'vite';
@@ -970,497 +970,6 @@ declare const CTX_WRITERS: {
970
970
  readonly jobsQueue: "jobBackend";
971
971
  };
972
972
 
973
- /**
974
- * M73 — layered configuration, as a parameterised machine.
975
- *
976
- * ## The gap this closes
977
- *
978
- * The config module answered "load my framework's config file". It published no layering engine, did
979
- * not let the SDK's through, and said nothing about directory trust. The evidence that this was a
980
- * real gap and not a scope decision: a repository whose README forbids importing `@theokit/sdk`
981
- * directly broke its own rule **six times**, and all six reach for config/trust/wiring primitives. A
982
- * team that breaks its own rule rather than reimplement is the strongest signal that the door, not
983
- * the willingness, was what was missing.
984
- *
985
- * ## What is policy and what is machine
986
- *
987
- * The VOCABULARY — which keys exist, which capabilities they grant, TOML or TS — is legitimately
988
- * policy and stays with the product. The chain machine, the profile merge, the precedence report and
989
- * the floor are identical in every agent product.
990
- *
991
- * The milestone's named risk was generalising too early and freezing another product's vocabulary.
992
- * The mitigation is structural: **the layer chain is a parameter, never a constant.** No layer name
993
- * from any consumer appears in this file, and a test asserts it by resolving a chain of names this
994
- * repository has never heard of.
995
- *
996
- * ## Why it composes rather than implements
997
- *
998
- * `foldLayers` and `verifyLayerOrdering` are the SDK's, crossed by M67. Re-deriving the fold here
999
- * would give two answers to "which layer wins", and the two would diverge silently — the exact
1000
- * defect this whole initiative exists to remove. What this adds is what the SDK deliberately does
1001
- * not: provenance per key, and the measured-vs-declared precedence report.
1002
- */
1003
- /** One layer of configuration, with the values it contributes. */
1004
- interface ConfigLayer {
1005
- readonly layer: string;
1006
- /** Higher wins. Omit across the whole chain to mean "this array is already the order". */
1007
- readonly precedence?: number;
1008
- readonly values: Readonly<Record<string, unknown>>;
1009
- }
1010
- /**
1011
- * Where each resolved key came from.
1012
- *
1013
- * For an overwritten key this is the winning layer's name. For an ACCUMULATED key it is every
1014
- * contributing layer, comma-separated — a union has no single winner, and naming only the last one
1015
- * would be a lie about where the other members came from.
1016
- */
1017
- type ProvenancePerKey = Readonly<Record<string, string>>;
1018
- /**
1019
- * Declared order versus the order the values actually proved.
1020
- *
1021
- * The consumer wrote this check by hand (`measuredPrecedenceChain`) because the engine did not offer
1022
- * it. A layer that declares high precedence and never wins a key is a config nobody is reading —
1023
- * usually a path that does not exist. Silence there is how a broken override survives for months.
1024
- */
1025
- interface PrecedenceReport {
1026
- /** The chain as the caller wrote it. */
1027
- readonly declared: readonly string[];
1028
- /**
1029
- * The layers that actually contributed at least one key, in chain order.
1030
- *
1031
- * PARTICIPATION, not victory. The first draft measured which layers WON a key, and a base
1032
- * `defaults` layer whose every value is later overridden then reported as absent from the measured
1033
- * chain — flagging the most normal arrangement in layered config as a divergence. Being
1034
- * overridden is what a defaults layer is for.
1035
- */
1036
- readonly measured: readonly string[];
1037
- /**
1038
- * Layers declared in the chain that contributed NO key at all.
1039
- *
1040
- * Not the same as "was overridden": being superseded is the normal fate of a defaults layer and
1041
- * says nothing is wrong. Contributing nothing usually means a path that does not exist — a config
1042
- * file nobody is reading — and that is the silence this report exists to break.
1043
- */
1044
- readonly declaredButSilent: readonly string[];
1045
- readonly diverges: boolean;
1046
- }
1047
- interface LayeredConfigInput<TSchema extends z.ZodType> {
1048
- readonly layers: readonly ConfigLayer[];
1049
- /** Validated AFTER folding — see {@link LayeredConfig.resolve}. */
1050
- readonly schema: TSchema;
1051
- /**
1052
- * Keys whose values UNION across layers instead of being overwritten.
1053
- *
1054
- * Opt-in per key, deliberately: some keys are lists a layer adds to (tools, plugins, allowlists)
1055
- * and overwriting them discards what a lower layer contributed — but defaulting to union would
1056
- * silently merge something the caller meant to replace.
1057
- */
1058
- readonly accumulatingKeys?: readonly string[];
1059
- }
1060
- interface LayeredConfigResult<TValue> {
1061
- readonly value: TValue;
1062
- readonly provenancePerKey: ProvenancePerKey;
1063
- readonly precedenceReport: PrecedenceReport;
1064
- }
1065
- /**
1066
- * Raised when a chain is built out of order.
1067
- *
1068
- * Refusing beats sorting silently: a caller who wrote the chain in the wrong order holds a belief
1069
- * about precedence that is wrong, and sorting it for them leaves the belief intact until it produces
1070
- * a surprise somewhere else.
1071
- */
1072
- declare class LayerOutOfOrderError extends Error {
1073
- readonly name = "LayerOutOfOrderError";
1074
- }
1075
- /**
1076
- * The layering engine.
1077
- *
1078
- * A class with one static rather than a free function: it is the namespace the config surface hangs
1079
- * from (`LayeredConfig.resolve`), matching the `X.create()` shape the rest of this codebase uses, and
1080
- * it leaves room for the trust-store companion to join the same namespace without a second import.
1081
- */
1082
- declare const LayeredConfig: {
1083
- /**
1084
- * Fold the chain, validate the result, and report where everything came from.
1085
- *
1086
- * The schema is applied AFTER folding, never per layer. Validating each layer separately would
1087
- * force every file to be complete, which defeats layering: a project override that sets one key
1088
- * would have to restate the whole config.
1089
- *
1090
- * @throws {LayerOutOfOrderError} when a layer does not outrank the one before it.
1091
- */
1092
- resolve<TSchema extends z.ZodType>(input: LayeredConfigInput<TSchema>): LayeredConfigResult<z.infer<TSchema>>;
1093
- };
1094
-
1095
- /**
1096
- * M73 — the per-directory trust store: a trust decision that survives the process.
1097
- *
1098
- * ## Why persisting it matters
1099
- *
1100
- * M68 made `settingSources`' `project` root require a `TrustPosture` — evidence, not a claim. But a
1101
- * posture computed fresh on every run is a question asked over and over, and a question asked every
1102
- * run is a question users learn to answer without reading.
1103
- *
1104
- * Persisting turns the stamp into a DECISION: recorded once, auditable afterwards, and answerable by
1105
- * "who trusted this directory, when, and on what basis" rather than by re-deriving it.
1106
- *
1107
- * ## Why the file permission is checked on READ
1108
- *
1109
- * This file decides whether a directory may run shell hooks. A store any other user can write is a
1110
- * store any other user can use to grant themselves that. Checking at write time only would leave a
1111
- * file whose mode was loosened afterwards looking fine — so the check is where the value is
1112
- * consumed, and a loose mode is REFUSED rather than repaired: silently tightening it hides that
1113
- * something changed the mode, which is the fact worth knowing.
1114
- */
1115
- /** What was decided about one directory. */
1116
- interface TrustRecord {
1117
- /** Absolute path of the trusted directory. */
1118
- readonly path: string;
1119
- /** ISO-8601 stamp of the decision. Injected by the caller — see {@link TrustStore.trust}. */
1120
- readonly decidedAt: string;
1121
- /** Free-form provenance: who or what decided (a username, a CI job, `--trust` on the CLI). */
1122
- readonly decidedBy: string;
1123
- readonly trusted: boolean;
1124
- }
1125
- /** Raised when the store's file mode would let another user grant themselves trust. */
1126
- declare class TrustStorePermissionsError extends Error {
1127
- readonly file: string;
1128
- readonly mode: number;
1129
- readonly name = "TrustStorePermissionsError";
1130
- constructor(file: string, mode: number);
1131
- }
1132
- /**
1133
- * A per-directory trust store on disk.
1134
- *
1135
- * Composes the SDK's `atomicWriteJson` (no reader ever sees a half-written store) and `withFileLock`
1136
- * (two processes deciding at once do not interleave). Neither is reimplemented — both crossed the
1137
- * boundary in M67, and a second implementation of an atomic write is how two answers to "is this
1138
- * file complete" come to exist.
1139
- */
1140
- declare class TrustStore {
1141
- private readonly file;
1142
- constructor(file: string);
1143
- /**
1144
- * Read the store, refusing a file other users can write.
1145
- *
1146
- * A missing store is not an error — it is a machine that has trusted nothing yet, which is the
1147
- * correct starting state and the safe one.
1148
- */
1149
- read(): readonly TrustRecord[];
1150
- /**
1151
- * Record a decision about `path`, replacing any previous one for it.
1152
- *
1153
- * `decidedAt` and `decidedBy` are ARGUMENTS, not derived here (DIP): the clock and the identity
1154
- * belong to the caller, and baking `new Date()` in would make every assertion about the record
1155
- * depend on when the test ran.
1156
- *
1157
- * ASYNC because both `withFileLock` and `atomicWriteJson` are. Measured, not assumed: the first
1158
- * draft called them synchronously and `trust()` returned before the bytes landed, so an immediate
1159
- * `read()` saw an empty store. Same shape as the M71 pointer bug, and same cause — the SDK's
1160
- * `.d.ts` does not declare these, so nothing at compile time says they return a Promise
1161
- * (usetheodev/theokit-sdk#280).
1162
- */
1163
- trust(record: TrustRecord): Promise<void>;
1164
- /**
1165
- * The recorded posture for `path`, or an UNTRUSTED posture when nothing was recorded.
1166
- *
1167
- * Absence resolves to untrusted, never to "unknown, proceed". A store that answered "I do not
1168
- * know" would push the decision back to the caller, and the caller asking is what the store
1169
- * exists to answer.
1170
- */
1171
- postureFor<K extends string>(path: string, capabilities: readonly K[]): TrustPosture<K>;
1172
- private assertSafePermissions;
1173
- }
1174
-
1175
- /**
1176
- * M76 — load custom commands from `.theokit/commands/`.
1177
- *
1178
- * ## Why this gap was worse than a missing feature
1179
- *
1180
- * The framework OWNS the `.theokit/` convention and already loads `skills/`, `agents/` and
1181
- * `hooks.json` from it. `commands/` — the one directory every product-facing agent surface wants —
1182
- * had no loader at all. So a consumer wrote markdown-with-frontmatter scanning **against the
1183
- * framework's own directory**: reimplementing the reading of a convention the framework defines.
1184
- *
1185
- * A convention with a hole in it is worse than no convention. It teaches the reader that `.theokit/`
1186
- * is the framework's, then makes them write the loader themselves for one subdirectory, and their
1187
- * loader inevitably disagrees with ours about frontmatter, precedence and trust.
1188
- *
1189
- * ## Trust, and why project commands are gated
1190
- *
1191
- * A command is a prompt the user can invoke by name. A project-level one comes from the working
1192
- * directory — which, for an agent pointed at a repository the user just cloned, is
1193
- * attacker-controlled content. Same decision as M68: `projectTrusted` false means project commands
1194
- * do not load. User-level commands under `homeDir` need no gate — that is the operator's own
1195
- * machine.
1196
- *
1197
- * ## Warns, never decides
1198
- *
1199
- * On a name collision this loader REPORTS and moves on. Which command wins when a custom one shadows
1200
- * a builtin is the product's router to decide (M83) — it is the only layer that knows what its
1201
- * builtins are. A loader that silently dropped one would make that decision invisibly, on behalf of
1202
- * a product it cannot see.
1203
- */
1204
- /** One command loaded from disk. */
1205
- interface CustomCommand {
1206
- /** Invocation name, derived from the file name without its extension. */
1207
- readonly name: string;
1208
- /** One-line summary from `description:` in the frontmatter, when present. */
1209
- readonly description?: string;
1210
- /** The prompt body, frontmatter removed. */
1211
- readonly body: string;
1212
- /** Which layer it came from. `project` beats `user` — see {@link loadCustomCommands}. */
1213
- readonly source: 'project' | 'user';
1214
- /** Absolute path, for messages a human can act on. */
1215
- readonly path: string;
1216
- }
1217
- interface LoadCustomCommandsInput {
1218
- /** Project root. Its `.theokit/commands/` is read only when `projectTrusted`. */
1219
- readonly projectDir?: string;
1220
- /** Operator home. Its `.theokit/commands/` needs no trust gate. */
1221
- readonly homeDir?: string;
1222
- /**
1223
- * Whether the project directory is trusted (M68/M73).
1224
- *
1225
- * REQUIRED, like `approved` on the hook engine and for the same reason: an optional security gate
1226
- * is a gate somebody forgets, and forgetting this one loads prompts written by whoever wrote the
1227
- * repository.
1228
- */
1229
- readonly projectTrusted: boolean;
1230
- /** Names the product already uses, so a shadow can be reported rather than discovered later. */
1231
- readonly builtinNames?: readonly string[];
1232
- /** Where a shadow, a duplicate, or a malformed file is reported. */
1233
- readonly onWarn?: (message: string) => void;
1234
- }
1235
- interface CustomCommandsResult {
1236
- /** Loaded commands, project-level first. Names are unique — see the precedence note. */
1237
- readonly commands: readonly CustomCommand[];
1238
- /** Names that also exist as builtins. Reported, never resolved here. */
1239
- readonly shadowedBuiltins: readonly string[];
1240
- }
1241
- /**
1242
- * Load `.theokit/commands/*.md` from the project and the user, project winning.
1243
- *
1244
- * Precedence is project-over-user because the project is the more specific scope: a repository that
1245
- * ships a `review` command means *its* review, and having the operator's generic one silently take
1246
- * precedence would make the repository's own configuration the weaker statement.
1247
- */
1248
- declare function loadCustomCommands(input: LoadCustomCommandsInput): CustomCommandsResult;
1249
-
1250
- /**
1251
- * Split a markdown file into frontmatter lines and body.
1252
- *
1253
- * ## Why this is shared rather than duplicated
1254
- *
1255
- * Two loaders need it — the M74 instruction tree and the M76 command loader — and they need the SAME
1256
- * answer to the same question: where does the metadata stop and the content begin, and what happens
1257
- * when the fence never closes. That is one piece of knowledge (`G12`), not two similar-looking
1258
- * functions.
1259
- *
1260
- * What is NOT shared is which KEYS each loader reads. `paths:` matters to instructions and
1261
- * `description:` matters to commands, and folding those together would build a vocabulary neither
1262
- * one asked for.
1263
- */
1264
- interface ParsedFrontmatter {
1265
- /** Lines between the fences, excluding them. Empty when the file has no frontmatter. */
1266
- readonly frontmatter: readonly string[];
1267
- /** Everything after the closing fence — or the whole file when there is no frontmatter. */
1268
- readonly body: string;
1269
- }
1270
- /**
1271
- * Split `raw`, or return `undefined` when the frontmatter opens and never closes.
1272
- *
1273
- * `undefined` rather than a best guess: a file whose fence never closes is malformed in a way that
1274
- * makes its metadata unknowable, and guessing whether the rest is body or metadata feeds the caller
1275
- * either the wrong text or the wrong settings. Both callers treat that as "skip this file, warn,
1276
- * keep going" — failure is per file, never per tree.
1277
- */
1278
- declare function splitFrontmatter(raw: string): ParsedFrontmatter | undefined;
1279
- /**
1280
- * Read one scalar key from frontmatter lines.
1281
- *
1282
- * Deliberately not a YAML parser. Both callers read a handful of known keys, and pulling in a parser
1283
- * to do that would be a dependency for a feature nobody asked for (parsimony rungs 4 → 1). An
1284
- * unrecognised key is ignored rather than rejected — a product may put its own metadata there.
1285
- */
1286
- declare function frontmatterValue(frontmatter: readonly string[], key: string): string | undefined;
1287
-
1288
- /**
1289
- * M74 — load a tree of project instruction files, with explicit ceilings.
1290
- *
1291
- * ## Why `compileProjectContext` does not cover this
1292
- *
1293
- * It reads ONE fixed file through the SDK: no depth or file budget, no frontmatter, no cycle guard,
1294
- * no truncation policy, no warning channel. A product that wants project-scoped instructions writes
1295
- * roughly 720 lines of mechanism — all of it identical between products, none of it about their
1296
- * domain.
1297
- *
1298
- * ## The containment check is a security control
1299
- *
1300
- * A symlink inside a project directory can point anywhere. Following one lets a repository the user
1301
- * just cloned inject the contents of `~/.ssh/config`, or any other readable file, straight into the
1302
- * model's system prompt. That is prompt injection with the filesystem as the vector, and every
1303
- * consumer that writes this loader by hand reintroduces it.
1304
- *
1305
- * `assertNoSymlinkEscape` is the SDK's, crossed in M67. Composing it is what makes the check the
1306
- * same one everywhere instead of four subtly different `realpath` comparisons.
1307
- *
1308
- * ## Failure is per FILE, not per tree
1309
- *
1310
- * A malformed frontmatter skips that file and warns. Failing the whole load would let one bad file
1311
- * in a deep tree silently disable every instruction the user wrote — the loudest possible failure
1312
- * producing the quietest possible outcome.
1313
- */
1314
- /** One loaded instruction file. */
1315
- interface InstructionBlock {
1316
- /** Path relative to `cwd`, for messages a human can act on. */
1317
- readonly path: string;
1318
- /** File body with the frontmatter removed. */
1319
- readonly content: string;
1320
- /** `paths:` from the frontmatter — the scopes this block applies to. Empty means unscoped. */
1321
- readonly scopes: readonly string[];
1322
- }
1323
- interface InstructionTreeBudget {
1324
- /** How deep below each root to descend. */
1325
- readonly maxDepth: number;
1326
- /** How many files to load in total. */
1327
- readonly maxFiles: number;
1328
- /** Total characters across all blocks. */
1329
- readonly maxChars: number;
1330
- }
1331
- interface LoadInstructionTreeInput {
1332
- readonly cwd: string;
1333
- /** Directories to walk, relative to `cwd` or absolute. Order is the caller's. */
1334
- readonly roots: readonly string[];
1335
- readonly budget: InstructionTreeBudget;
1336
- /**
1337
- * Where a skipped file, a refused symlink or an exhausted budget is reported.
1338
- *
1339
- * A channel rather than a throw: none of these should stop a load, and none of them should be
1340
- * silent either. Silence here is how a user's instruction file stops being read without anybody
1341
- * noticing.
1342
- */
1343
- readonly onWarn?: (message: string) => void;
1344
- /** File names to load. Defaults to the conventional two. */
1345
- readonly fileNames?: readonly string[];
1346
- }
1347
- interface InstructionTree {
1348
- readonly blocks: readonly InstructionBlock[];
1349
- /** True when a ceiling stopped the walk — the caller is seeing a partial tree. */
1350
- readonly truncated: boolean;
1351
- readonly count: number;
1352
- }
1353
- /**
1354
- * Walk `roots` and load the instruction files found, stopping at the declared ceilings.
1355
- *
1356
- * Cycles are broken by INODE, not by path: a symlink loop produces infinitely many distinct paths
1357
- * for the same file, so a path-keyed `seen` set never terminates. The inode is what identifies the
1358
- * file the OS would actually read.
1359
- */
1360
- declare function loadInstructionTree(input: LoadInstructionTreeInput): InstructionTree;
1361
-
1362
- /**
1363
- * M74 — compose a base prompt with instruction sources under a character ceiling.
1364
- *
1365
- * ## Why the truncation LADDER is mechanism and the ORDER is policy
1366
- *
1367
- * When the composed text does not fit, something has to go — and which thing goes is a product
1368
- * decision. A coding agent drops repository conventions before user rules; a support agent may do
1369
- * the opposite. Baking that preference into the framework would be absorbing one product's taste as
1370
- * everyone's law, which is the milestone's named risk.
1371
- *
1372
- * So the caller passes `sources` ALREADY ORDERED, most important first, and this function walks that
1373
- * order backwards when it needs room. The framework supplies the cutting mechanism; the product
1374
- * supplies the preference. No source NAME appears in this file.
1375
- *
1376
- * ## Why it truncates rather than refusing
1377
- *
1378
- * A prompt that does not fit is a run that cannot start, and refusing outright would make a long
1379
- * instruction file a hard failure at the worst moment. Dropping the least important source and
1380
- * SAYING SO is the behaviour that keeps the agent usable while keeping the user informed — which is
1381
- * why `onWarn` is not optional in practice even though it is optional in the signature.
1382
- */
1383
- /** One named block of instructions the caller wants composed. */
1384
- interface InstructionSource {
1385
- /** The product's own label, used only in warnings. Never interpreted here. */
1386
- readonly name: string;
1387
- readonly content: string;
1388
- }
1389
- interface ComposeInstructionsOptions {
1390
- /** Ceiling for the whole composed string, base included. */
1391
- readonly maxChars: number;
1392
- /** Where a dropped or trimmed source is reported. Silence here loses the user's instructions. */
1393
- readonly onWarn?: (message: string) => void;
1394
- /** Separator between blocks. */
1395
- readonly separator?: string;
1396
- }
1397
- interface ComposedInstructions {
1398
- readonly text: string;
1399
- /** Names of sources that were dropped entirely, in the order they were dropped. */
1400
- readonly dropped: readonly string[];
1401
- /** Name of the source that was cut in half to fit, when one was. */
1402
- readonly trimmed?: string;
1403
- }
1404
- /**
1405
- * Compose `base` with `sources`, cutting from the END of the list until it fits.
1406
- *
1407
- * The base is never dropped: it is the agent's own identity, and an agent without it is a different
1408
- * agent. If the base alone exceeds the ceiling the result is the base, TRUNCATED, with a warning —
1409
- * returning an empty string would be a silent lobotomy, and throwing would make a long system prompt
1410
- * an unrecoverable configuration error.
1411
- */
1412
- declare function composeInstructions(base: string, sources: readonly InstructionSource[], options: ComposeInstructionsOptions): ComposedInstructions;
1413
-
1414
- /**
1415
- * M74 — context pressure: the fraction of the window a run has consumed.
1416
- *
1417
- * ## Why this had no counterpart
1418
- *
1419
- * The framework shipped the DENOMINATOR (`resolveEffectiveContextWindow`, crossed in M67) and the
1420
- * NUMERATOR (token usage, on every `done` event) and never put them together. So every product that
1421
- * wanted to warn a user before a run hit the wall computed the ratio itself, and each picked its own
1422
- * thresholds.
1423
- *
1424
- * The arithmetic is trivial; publishing it is not about saving a division. It is about there being
1425
- * ONE answer to "is this run in trouble", so a warning in the CLI and a badge in a dashboard agree.
1426
- */
1427
- /** How close a run is to its context limit. */
1428
- type ContextPressure = 'ok' | 'warn' | 'critical';
1429
- /**
1430
- * Fractions of the effective window at which each level begins.
1431
- *
1432
- * Defaults chosen to leave room to act: `warn` at 75% is early enough that compacting still helps,
1433
- * `critical` at 90% is where the next turn may not fit. Configurable because a product with long
1434
- * tool outputs legitimately wants an earlier warning than one with short chat turns.
1435
- */
1436
- interface ContextPressureThresholds {
1437
- readonly warn: number;
1438
- readonly critical: number;
1439
- }
1440
- declare const DEFAULT_CONTEXT_PRESSURE_THRESHOLDS: ContextPressureThresholds;
1441
- /** Raised when thresholds are ordered in a way that makes a level unreachable. */
1442
- declare class ContextPressureThresholdError extends Error {
1443
- readonly name = "ContextPressureThresholdError";
1444
- }
1445
- /**
1446
- * Classify a run's context pressure.
1447
- *
1448
- * @param usedTokens tokens the run has consumed
1449
- * @param effectiveWindow the window it is consuming from — typically
1450
- * `resolveEffectiveContextWindow(...)`, re-exported here so a caller reaches both through one import
1451
- * (see {@link effectiveContextWindow}).
1452
- *
1453
- * An `effectiveWindow` of zero or less returns `'ok'` rather than dividing: an unknown window is not
1454
- * evidence of pressure, and `Infinity`/`NaN` reaching a UI as a percentage is worse than saying
1455
- * nothing. Missing evidence is not evidence — the same rule the transcript collector applies to a
1456
- * missing mtime.
1457
- *
1458
- * @throws {ContextPressureThresholdError} when `warn` is not below `critical` — a caller who
1459
- * inverted them holds a belief about their own thresholds that is wrong, and silently sorting them
1460
- * would leave that belief intact.
1461
- */
1462
- declare function contextPressure(usedTokens: number, effectiveWindow: number, thresholds?: ContextPressureThresholds): ContextPressure;
1463
-
1464
973
  /**
1465
974
  * Types for `loadEnv()` — env auto-load utility (Phase 1 of
1466
975
  * docs/plans/framework-zero-config-polish-plan.md).
@@ -1502,4 +1011,4 @@ interface LoadEnvResult {
1502
1011
  declare function _resetEnvCache(): void;
1503
1012
  declare function loadEnv(options?: LoadEnvOptions): LoadEnvResult;
1504
1013
 
1505
- export { ActionError, type ActionErrorCode, ActionInputError, type ActionManifestEntry, type ActionResult, type BodyParserOptions, DEFAULT_MAX_AGE as CACHE_DEFAULT_MAX_AGE, DEFAULT_MAX_ENTRY_SIZE as CACHE_DEFAULT_MAX_ENTRY_SIZE, DEFAULT_SWR_MULTIPLIER as CACHE_DEFAULT_SWR_MULTIPLIER, CACHE_TAG_MAX_ITEMS, CACHE_TAG_MAX_LENGTH, CTX_WRITERS, type CacheControlInput, type CacheEngine, type CacheEngineOptions, type CacheEntry, type CacheStatus, type CacheStorageAdapter, type CacheStore, type CacheStoreAdmin, type ValidationResult as CacheValidationResult, type CachedFunction, type CachedRouteConfig, type CompiledRouteRule, type ComposeInstructionsOptions, type ComposedInstructions, type ConfigLayer, type ContextPressure, ContextPressureThresholdError, type ContextPressureThresholds, type ContextValue, type CustomCommand, type CustomCommandsResult, DEFAULT_CONTEXT_PRESSURE_THRESHOLDS, DEFAULT_EXCLUDED_QUERY_PARAMS, type DefineCachedFunctionOptions, FileTooLargeError, type GetOrComputeOptions, InMemoryCacheAdapter, type InMemoryCacheAdapterOptions, type InstructionBlock, type InstructionSource, type InstructionTree, type InstructionTreeBudget, type JobsAugmentedCtx, type KeyDerivationOptions, LayerOutOfOrderError, LayeredConfig, type LayeredConfigInput, type LayeredConfigResult, type LoadCustomCommandsInput, type LoadEnvOptions, type LoadEnvResult, type LoadInstructionTreeInput, type NormalizedCacheConfig, type OpenApiDocsOptions, type ParsedBody, type ParsedFrontmatter, type PrecedenceReport, type ProcedureInput, ProcedureInputError, ProcedureOutputError, type ProvenancePerKey, type QueueClientLike, type RawRouteInput, type RevalidateResult, type RouteCacheOptions, RouteConfig, type RouteInputChannel, type RouteInputSchemas, type RouteInputValidation, type RouteRule, type RouteRules, type SerializedActionResult, type SerializedResponse, THEO_T_PREFIX, type TrustRecord, TrustStore, TrustStorePermissionsError, type UniversalZodIssue, type UploadedFile, _resetCacheEngine, _resetEnvCache, callProcedure, compileRouteRules, composeInstructions, contextPressure, createCacheEngine, createOpenApiHandler, defineCachedFunction, defineCachedRoute, deriveKey as deriveCacheKey, deserializeResponse, executeWebRequest, extractUniversalIssues, frontmatterValue, getCacheControlHeader, getCacheEngine, initCacheEngine, isActionError, isInputError, loadCustomCommands, loadEnv, loadInstructionTree, parseRequestBody, resolveRouteRule, revalidatePath, revalidateTag, serializeResponse, splitFrontmatter, updateTag, validateExpire as validateCacheExpire, validateMaxAge as validateCacheMaxAge, validateTags as validateCacheTags, validateRouteInput };
1014
+ export { ActionError, type ActionErrorCode, ActionInputError, type ActionManifestEntry, type ActionResult, type BodyParserOptions, DEFAULT_MAX_AGE as CACHE_DEFAULT_MAX_AGE, DEFAULT_MAX_ENTRY_SIZE as CACHE_DEFAULT_MAX_ENTRY_SIZE, DEFAULT_SWR_MULTIPLIER as CACHE_DEFAULT_SWR_MULTIPLIER, CACHE_TAG_MAX_ITEMS, CACHE_TAG_MAX_LENGTH, CTX_WRITERS, type CacheControlInput, type CacheEngine, type CacheEngineOptions, type CacheEntry, type CacheStatus, type CacheStorageAdapter, type CacheStore, type CacheStoreAdmin, type ValidationResult as CacheValidationResult, type CachedFunction, type CachedRouteConfig, type CompiledRouteRule, type ContextValue, DEFAULT_EXCLUDED_QUERY_PARAMS, type DefineCachedFunctionOptions, FileTooLargeError, type GetOrComputeOptions, InMemoryCacheAdapter, type InMemoryCacheAdapterOptions, type JobsAugmentedCtx, type KeyDerivationOptions, type LoadEnvOptions, type LoadEnvResult, type NormalizedCacheConfig, type OpenApiDocsOptions, type ParsedBody, type ProcedureInput, ProcedureInputError, ProcedureOutputError, type QueueClientLike, type RawRouteInput, type RevalidateResult, type RouteCacheOptions, RouteConfig, type RouteInputChannel, type RouteInputSchemas, type RouteInputValidation, type RouteRule, type RouteRules, type SerializedActionResult, type SerializedResponse, THEO_T_PREFIX, type UniversalZodIssue, type UploadedFile, _resetCacheEngine, _resetEnvCache, callProcedure, compileRouteRules, createCacheEngine, createOpenApiHandler, defineCachedFunction, defineCachedRoute, deriveKey as deriveCacheKey, deserializeResponse, executeWebRequest, extractUniversalIssues, getCacheControlHeader, getCacheEngine, initCacheEngine, isActionError, isInputError, loadEnv, parseRequestBody, resolveRouteRule, revalidatePath, revalidateTag, serializeResponse, updateTag, validateExpire as validateCacheExpire, validateMaxAge as validateCacheMaxAge, validateTags as validateCacheTags, validateRouteInput };
@@ -796,8 +796,8 @@ function createCacheEngine(opts) {
796
796
  function claimAndRun(key, fn, options, skipWrite) {
797
797
  let resolveOuter;
798
798
  let rejectOuter;
799
- const outerPromise = new Promise((resolve3, reject) => {
800
- resolveOuter = resolve3;
799
+ const outerPromise = new Promise((resolve2, reject) => {
800
+ resolveOuter = resolve2;
801
801
  rejectOuter = reject;
802
802
  });
803
803
  void outerPromise.catch(() => {
@@ -1186,459 +1186,19 @@ var CTX_WRITERS = {
1186
1186
  jobsQueue: "jobBackend"
1187
1187
  };
1188
1188
 
1189
- // src/config/layered-config.ts
1190
- import { foldLayers, verifyLayerOrdering } from "@theokit/agents";
1191
- var LayerOutOfOrderError = class extends Error {
1192
- name = "LayerOutOfOrderError";
1193
- };
1194
- var LayeredConfig = {
1195
- /**
1196
- * Fold the chain, validate the result, and report where everything came from.
1197
- *
1198
- * The schema is applied AFTER folding, never per layer. Validating each layer separately would
1199
- * force every file to be complete, which defeats layering: a project override that sets one key
1200
- * would have to restate the whole config.
1201
- *
1202
- * @throws {LayerOutOfOrderError} when a layer does not outrank the one before it.
1203
- */
1204
- resolve(input) {
1205
- assertOrdering(input.layers);
1206
- const accumulating = input.accumulatingKeys ?? [];
1207
- const folded = foldLayers(input.layers, accumulating);
1208
- const value = input.schema.parse(folded);
1209
- return {
1210
- value,
1211
- provenancePerKey: buildProvenance(input.layers, accumulating),
1212
- precedenceReport: buildReport(input.layers)
1213
- };
1214
- }
1215
- };
1216
- function assertOrdering(layers) {
1217
- try {
1218
- verifyLayerOrdering(layers);
1219
- } catch (error) {
1220
- throw new LayerOutOfOrderError(error.message);
1221
- }
1222
- }
1223
- function contributorsOf(layers, key) {
1224
- return layers.filter((layer) => key in layer.values).map((layer) => layer.layer);
1225
- }
1226
- function buildProvenance(layers, accumulating) {
1227
- const keys = new Set(layers.flatMap((layer) => Object.keys(layer.values)));
1228
- const provenance = {};
1229
- for (const key of keys) {
1230
- const contributors = contributorsOf(layers, key);
1231
- const winner = contributors.at(-1);
1232
- if (winner === void 0) continue;
1233
- provenance[key] = accumulating.includes(key) ? contributors.join(", ") : winner;
1234
- }
1235
- return provenance;
1236
- }
1237
- function buildReport(layers) {
1238
- const declared = layers.map((layer) => layer.layer);
1239
- const contributed = new Set(
1240
- layers.filter((layer) => Object.keys(layer.values).length > 0).map((layer) => layer.layer)
1241
- );
1242
- const measured = declared.filter((name) => contributed.has(name));
1243
- const declaredButSilent = declared.filter((name) => !contributed.has(name));
1244
- return {
1245
- declared,
1246
- measured,
1247
- declaredButSilent,
1248
- diverges: declaredButSilent.length > 0
1249
- };
1250
- }
1251
-
1252
- // src/config/trust-store.ts
1253
- import { chmodSync, existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, statSync as statSync2 } from "fs";
1254
- import { dirname } from "path";
1255
- import { resolveTrustPosture } from "@theokit/agents";
1256
- import { atomicWriteJson, withFileLock } from "@theokit/agents/persistence";
1257
- var TrustStorePermissionsError = class extends Error {
1258
- constructor(file, mode) {
1259
- super(
1260
- `trust store ${file} is mode ${mode.toString(8)} \u2014 group or world writable. This file decides which directories may run shell hooks, so a writable store is a way to grant that to yourself. Refused rather than repaired: tightening it silently would hide that something changed the mode. Fix with \`chmod 600 ${file}\`.`
1261
- );
1262
- this.file = file;
1263
- this.mode = mode;
1264
- }
1265
- file;
1266
- mode;
1267
- name = "TrustStorePermissionsError";
1268
- };
1269
- var FORBIDDEN_WRITE_BITS = 18;
1270
- var TrustStore = class {
1271
- constructor(file) {
1272
- this.file = file;
1273
- }
1274
- file;
1275
- /**
1276
- * Read the store, refusing a file other users can write.
1277
- *
1278
- * A missing store is not an error — it is a machine that has trusted nothing yet, which is the
1279
- * correct starting state and the safe one.
1280
- */
1281
- read() {
1282
- if (!existsSync2(this.file)) return [];
1283
- this.assertSafePermissions();
1284
- const parsed = JSON.parse(readFileSync2(this.file, "utf8"));
1285
- return parsed.records;
1286
- }
1287
- /**
1288
- * Record a decision about `path`, replacing any previous one for it.
1289
- *
1290
- * `decidedAt` and `decidedBy` are ARGUMENTS, not derived here (DIP): the clock and the identity
1291
- * belong to the caller, and baking `new Date()` in would make every assertion about the record
1292
- * depend on when the test ran.
1293
- *
1294
- * ASYNC because both `withFileLock` and `atomicWriteJson` are. Measured, not assumed: the first
1295
- * draft called them synchronously and `trust()` returned before the bytes landed, so an immediate
1296
- * `read()` saw an empty store. Same shape as the M71 pointer bug, and same cause — the SDK's
1297
- * `.d.ts` does not declare these, so nothing at compile time says they return a Promise
1298
- * (usetheodev/theokit-sdk#280).
1299
- */
1300
- async trust(record) {
1301
- mkdirSync(dirname(this.file), { recursive: true });
1302
- await withFileLock(
1303
- this.file,
1304
- async () => {
1305
- const existing = existsSync2(this.file) ? this.read() : [];
1306
- const records = [...existing.filter((r) => r.path !== record.path), record];
1307
- await atomicWriteJson(this.file, {
1308
- version: 1,
1309
- records
1310
- });
1311
- chmodSync(this.file, 384);
1312
- }
1313
- );
1314
- }
1315
- /**
1316
- * The recorded posture for `path`, or an UNTRUSTED posture when nothing was recorded.
1317
- *
1318
- * Absence resolves to untrusted, never to "unknown, proceed". A store that answered "I do not
1319
- * know" would push the decision back to the caller, and the caller asking is what the store
1320
- * exists to answer.
1321
- */
1322
- postureFor(path, capabilities) {
1323
- const record = this.read().find((r) => r.path === path);
1324
- return resolveTrustPosture({
1325
- capabilities: [...capabilities],
1326
- isTrusted: () => record?.trusted === true
1327
- });
1328
- }
1329
- assertSafePermissions() {
1330
- const mode = statSync2(this.file).mode & 511;
1331
- if ((mode & FORBIDDEN_WRITE_BITS) !== 0) {
1332
- throw new TrustStorePermissionsError(this.file, mode);
1333
- }
1334
- }
1335
- };
1336
-
1337
- // src/config/custom-commands.ts
1338
- import { readFileSync as readFileSync3, readdirSync, statSync as statSync3 } from "fs";
1339
- import { basename, extname, join } from "path";
1340
-
1341
- // src/config/frontmatter.ts
1342
- var FENCE = "---";
1343
- function splitFrontmatter(raw) {
1344
- const lines = raw.split("\n");
1345
- if (lines[0]?.trim() !== FENCE) return { frontmatter: [], body: raw };
1346
- const closing = lines.indexOf(FENCE, 1);
1347
- if (closing === -1) return void 0;
1348
- return { frontmatter: lines.slice(1, closing), body: lines.slice(closing + 1).join("\n") };
1349
- }
1350
- function frontmatterValue(frontmatter, key) {
1351
- const prefix = `${key}:`;
1352
- for (const line of frontmatter) {
1353
- if (!line.startsWith(prefix)) continue;
1354
- const value = line.slice(prefix.length).trim();
1355
- const unquoted = /^(["'])(.*)\1$/.exec(value);
1356
- return unquoted?.[2] ?? value;
1357
- }
1358
- return void 0;
1359
- }
1360
-
1361
- // src/config/custom-commands.ts
1362
- var COMMANDS_DIR = join(".theokit", "commands");
1363
- var IGNORE_WARNING = () => void 0;
1364
- function loadCustomCommands(input) {
1365
- const warn = input.onWarn ?? IGNORE_WARNING;
1366
- const loaded = /* @__PURE__ */ new Map();
1367
- if (input.homeDir !== void 0) {
1368
- for (const command of readCommandsDir(join(input.homeDir, COMMANDS_DIR), "user", warn)) {
1369
- loaded.set(command.name, command);
1370
- }
1371
- }
1372
- if (input.projectDir !== void 0) {
1373
- if (!input.projectTrusted) {
1374
- const pending = readCommandsDir(
1375
- join(input.projectDir, COMMANDS_DIR),
1376
- "project",
1377
- IGNORE_WARNING
1378
- );
1379
- if (pending.length > 0) {
1380
- warn(
1381
- `${String(pending.length)} project command(s) found but the directory is not trusted \u2014 none were loaded. A command is a prompt that runs on your behalf.`
1382
- );
1383
- }
1384
- } else {
1385
- for (const command of readCommandsDir(
1386
- join(input.projectDir, COMMANDS_DIR),
1387
- "project",
1388
- warn
1389
- )) {
1390
- const shadowed = loaded.get(command.name);
1391
- if (shadowed !== void 0) {
1392
- warn(
1393
- `project command "${command.name}" overrides the user-level one at ${shadowed.path}.`
1394
- );
1395
- }
1396
- loaded.set(command.name, command);
1397
- }
1398
- }
1399
- }
1400
- const builtins = new Set(input.builtinNames ?? []);
1401
- const shadowedBuiltins = [...loaded.keys()].filter((name) => builtins.has(name));
1402
- for (const name of shadowedBuiltins) {
1403
- warn(
1404
- `custom command "${name}" has the same name as a builtin. This loader does not choose between them \u2014 the router decides, because only it knows what its builtins do.`
1405
- );
1406
- }
1407
- return {
1408
- // Project first in the returned order, matching the precedence a reader would expect.
1409
- commands: [...loaded.values()].sort(byProjectThenName),
1410
- shadowedBuiltins
1411
- };
1412
- }
1413
- function byProjectThenName(a, b) {
1414
- if (a.source !== b.source) return a.source === "project" ? -1 : 1;
1415
- return a.name.localeCompare(b.name);
1416
- }
1417
- function readCommandsDir(dir, source, warn) {
1418
- let entries;
1419
- try {
1420
- entries = readdirSync(dir);
1421
- } catch {
1422
- return [];
1423
- }
1424
- entries.sort((a, b) => a.localeCompare(b));
1425
- const commands = [];
1426
- for (const entry of entries) {
1427
- if (extname(entry) !== ".md") continue;
1428
- const path = join(dir, entry);
1429
- try {
1430
- if (!statSync3(path).isFile()) continue;
1431
- } catch {
1432
- continue;
1433
- }
1434
- const command = parseCommandFile(path, entry, source, warn);
1435
- if (command !== void 0) commands.push(command);
1436
- }
1437
- return commands;
1438
- }
1439
- function parseCommandFile(path, entry, source, warn) {
1440
- let raw;
1441
- try {
1442
- raw = readFileSync3(path, "utf8");
1443
- } catch {
1444
- return void 0;
1445
- }
1446
- const parsed = splitFrontmatter(raw);
1447
- if (parsed === void 0) {
1448
- warn(`command frontmatter never closes, file skipped: ${path}`);
1449
- return void 0;
1450
- }
1451
- const description = frontmatterValue(parsed.frontmatter, "description");
1452
- return {
1453
- name: basename(entry, ".md"),
1454
- ...description !== void 0 && { description },
1455
- body: parsed.body,
1456
- source,
1457
- path
1458
- };
1459
- }
1460
-
1461
- // src/config/instruction-tree.ts
1462
- import { readFileSync as readFileSync4, readdirSync as readdirSync2, statSync as statSync4 } from "fs";
1463
- import { join as join2, relative, resolve as resolve2 } from "path";
1464
- import { assertNoSymlinkEscape } from "@theokit/agents";
1465
- var DEFAULT_FILE_NAMES = ["THEO.md", "AGENTS.md"];
1466
- var IGNORE_WARNING2 = () => void 0;
1467
- function loadInstructionTree(input) {
1468
- const warn = input.onWarn ?? IGNORE_WARNING2;
1469
- const fileNames = input.fileNames ?? DEFAULT_FILE_NAMES;
1470
- const cwd = resolve2(input.cwd);
1471
- const blocks = [];
1472
- const seenInodes = /* @__PURE__ */ new Set();
1473
- let chars = 0;
1474
- const visit = (dir, depth) => {
1475
- if (depth > input.budget.maxDepth) return false;
1476
- let entries;
1477
- try {
1478
- entries = readdirSync2(dir);
1479
- } catch {
1480
- return false;
1481
- }
1482
- for (const { entry, path, stats } of filesBeforeDirectories(dir, entries)) {
1483
- const inode = `${String(stats.dev)}:${String(stats.ino)}`;
1484
- if (seenInodes.has(inode)) continue;
1485
- seenInodes.add(inode);
1486
- if (stats.isDirectory()) {
1487
- if (visit(path, depth + 1)) return true;
1488
- continue;
1489
- }
1490
- if (!fileNames.includes(entry)) continue;
1491
- try {
1492
- ;
1493
- assertNoSymlinkEscape(path, cwd);
1494
- } catch {
1495
- warn(`instruction file escapes the project root and was skipped: ${relative(cwd, path)}`);
1496
- continue;
1497
- }
1498
- if (blocks.length >= input.budget.maxFiles) {
1499
- warn(`instruction budget: stopped at ${String(input.budget.maxFiles)} files`);
1500
- return true;
1501
- }
1502
- const parsed = parseInstructionFile(path, cwd, warn);
1503
- if (parsed === void 0) continue;
1504
- if (chars + parsed.content.length > input.budget.maxChars) {
1505
- warn(`instruction budget: stopped at ${String(input.budget.maxChars)} characters`);
1506
- return true;
1507
- }
1508
- chars += parsed.content.length;
1509
- blocks.push(parsed);
1510
- }
1511
- return false;
1512
- };
1513
- let truncated = false;
1514
- for (const root of input.roots) {
1515
- truncated = visit(resolve2(cwd, root), 0);
1516
- if (truncated) break;
1517
- }
1518
- return { blocks, truncated, count: blocks.length };
1519
- }
1520
- function filesBeforeDirectories(dir, entries) {
1521
- const found = [];
1522
- for (const entry of [...entries].sort((a, b) => a.localeCompare(b))) {
1523
- const path = join2(dir, entry);
1524
- try {
1525
- found.push({ entry, path, stats: statSync4(path) });
1526
- } catch {
1527
- continue;
1528
- }
1529
- }
1530
- return [
1531
- ...found.filter((item) => !item.stats.isDirectory()),
1532
- ...found.filter((item) => item.stats.isDirectory())
1533
- ];
1534
- }
1535
- function parseInstructionFile(path, cwd, warn) {
1536
- let raw;
1537
- try {
1538
- raw = readFileSync4(path, "utf8");
1539
- } catch {
1540
- return void 0;
1541
- }
1542
- const rel = relative(cwd, path);
1543
- const parsed = splitFrontmatter(raw);
1544
- if (parsed === void 0) {
1545
- warn(`instruction frontmatter never closes, file skipped: ${rel}`);
1546
- return void 0;
1547
- }
1548
- return {
1549
- path: rel,
1550
- content: parsed.body,
1551
- scopes: parsePathsScope(parsed.frontmatter)
1552
- };
1553
- }
1554
- function parsePathsScope(frontmatter) {
1555
- const scopes = [];
1556
- let inPaths = false;
1557
- for (const line of frontmatter) {
1558
- if (/^paths\s*:/.test(line)) {
1559
- inPaths = true;
1560
- const inline = line.slice(line.indexOf(":") + 1).trim();
1561
- if (inline.startsWith("[")) {
1562
- return inline.slice(1, inline.lastIndexOf("]")).split(",").map((item2) => item2.trim().replaceAll(/^["']|["']$/g, "")).filter((item2) => item2.length > 0);
1563
- }
1564
- continue;
1565
- }
1566
- if (!inPaths) continue;
1567
- const item = /^ {0,32}- {0,32}(\S.*)$/.exec(line);
1568
- if (item?.[1] === void 0) break;
1569
- scopes.push(item[1].trim().replaceAll(/^["']|["']$/g, ""));
1570
- }
1571
- return scopes;
1572
- }
1573
-
1574
- // src/config/compose-instructions.ts
1575
- var DEFAULT_SEPARATOR = "\n\n";
1576
- var IGNORE_WARNING3 = () => void 0;
1577
- function composeInstructions(base, sources, options) {
1578
- const warn = options.onWarn ?? IGNORE_WARNING3;
1579
- const separator = options.separator ?? DEFAULT_SEPARATOR;
1580
- if (base.length >= options.maxChars) {
1581
- warn(
1582
- `instruction budget: the base prompt alone is ${String(base.length)} characters against a ceiling of ${String(options.maxChars)}. It was truncated and every source was dropped.`
1583
- );
1584
- return {
1585
- text: base.slice(0, options.maxChars),
1586
- dropped: sources.map((source) => source.name),
1587
- trimmed: "base"
1588
- };
1589
- }
1590
- const kept = [...sources];
1591
- const dropped = [];
1592
- let trimmed;
1593
- const lengthOf = (list) => [base, ...list.map((source) => source.content)].join(separator).length;
1594
- while (kept.length > 0 && lengthOf(kept) > options.maxChars) {
1595
- const last = kept.at(-1);
1596
- if (last === void 0) break;
1597
- const withoutLast = kept.slice(0, -1);
1598
- const room = options.maxChars - lengthOf(withoutLast) - separator.length;
1599
- if (room > 0 && trimmed === void 0) {
1600
- kept[kept.length - 1] = { ...last, content: last.content.slice(0, room) };
1601
- trimmed = last.name;
1602
- warn(
1603
- `instruction budget: "${last.name}" was trimmed to ${String(room)} characters to fit the ${String(options.maxChars)}-character ceiling.`
1604
- );
1605
- break;
1606
- }
1607
- kept.pop();
1608
- dropped.push(last.name);
1609
- warn(`instruction budget: "${last.name}" was dropped to fit the ceiling.`);
1610
- }
1611
- return {
1612
- text: [base, ...kept.map((source) => source.content)].join(separator),
1613
- dropped,
1614
- ...trimmed !== void 0 && { trimmed }
1615
- };
1616
- }
1617
-
1618
- // src/config/context-pressure.ts
1619
- import { resolveEffectiveContextWindow } from "@theokit/agents";
1620
- var DEFAULT_CONTEXT_PRESSURE_THRESHOLDS = {
1621
- warn: 0.75,
1622
- critical: 0.9
1623
- };
1624
- var ContextPressureThresholdError = class extends Error {
1625
- name = "ContextPressureThresholdError";
1626
- };
1627
- function contextPressure(usedTokens, effectiveWindow, thresholds = DEFAULT_CONTEXT_PRESSURE_THRESHOLDS) {
1628
- if (thresholds.warn >= thresholds.critical) {
1629
- throw new ContextPressureThresholdError(
1630
- `context pressure: \`warn\` (${String(thresholds.warn)}) must be below \`critical\` (${String(thresholds.critical)}), otherwise one of the two levels can never be reached.`
1631
- );
1632
- }
1633
- if (!Number.isFinite(effectiveWindow) || effectiveWindow <= 0) return "ok";
1634
- if (!Number.isFinite(usedTokens) || usedTokens <= 0) return "ok";
1635
- const ratio = usedTokens / effectiveWindow;
1636
- if (ratio >= thresholds.critical) return "critical";
1637
- if (ratio >= thresholds.warn) return "warn";
1638
- return "ok";
1639
- }
1640
-
1641
1189
  // src/server/index.ts
1190
+ import { LayeredConfig, LayerOutOfOrderError } from "@theokit/agents/config";
1191
+ import { TrustStore, TrustStorePermissionsError } from "@theokit/agents/config";
1192
+ import { loadCustomCommands } from "@theokit/agents/config";
1193
+ import { frontmatterValue, splitFrontmatter } from "@theokit/agents/config";
1194
+ import { loadInstructionTree } from "@theokit/agents/config";
1195
+ import { composeInstructions } from "@theokit/agents/config";
1196
+ import {
1197
+ DEFAULT_CONTEXT_PRESSURE_THRESHOLDS,
1198
+ ContextPressureThresholdError,
1199
+ contextPressure,
1200
+ effectiveContextWindow
1201
+ } from "@theokit/agents/config";
1642
1202
  if (typeof globalThis !== "undefined") {
1643
1203
  const WARN_KEY = "__theokit_server_umbrella_warn_emitted__";
1644
1204
  const g = globalThis;
@@ -1786,7 +1346,7 @@ export {
1786
1346
  deserializeResponse,
1787
1347
  discoverOidcProvider,
1788
1348
  dispatchWebhook,
1789
- resolveEffectiveContextWindow as effectiveContextWindow,
1349
+ effectiveContextWindow,
1790
1350
  encrypt,
1791
1351
  enforceCsrf,
1792
1352
  envelopeCodeToStatus,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/server/openapi/serve-docs.ts","../../src/cache/constants.ts","../../src/cache/validation.ts","../../src/cache/define-cached-function.ts","../../src/cache/cache-control-header.ts","../../src/cache/key-derivation.ts","../../src/cache/define-cached-route.ts","../../src/cache/cache-engine.ts","../../src/cache/in-memory-adapter.ts","../../src/cache/engine-singleton.ts","../../src/cache/revalidate.ts","../../src/cache/route-rules.ts","../../src/server/serialization.ts","../../src/server/http/in-process-caller.ts","../../src/server/http/ctx-reconciliation.ts","../../src/config/layered-config.ts","../../src/config/trust-store.ts","../../src/config/custom-commands.ts","../../src/config/frontmatter.ts","../../src/config/instruction-tree.ts","../../src/config/compose-instructions.ts","../../src/config/context-pressure.ts","../../src/server/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAS,YAAY,cAAc,gBAAgB;AACnD,SAAS,eAAe;AAexB,IAAM,iBAAiB,KAAK,OAAO;AACnC,IAAM,cAAc;AAMb,SAAS,qBAAqB,OAA2B,CAAC,GAAG;AAClE,QAAM,WAAW,KAAK,YAAY;AAClC,QAAM,WAAW,KAAK,mBAAmB;AACzC,QAAM,cAAc,KAAK,gBAAgB;AACzC,QAAM,QAAQ,KAAK,aAAa;AAChC,QAAM,MAAM,KAAK,UAAU;AAO3B,MAAI,iBAAiB,WAAW,GAAG;AACjC,UAAM,IAAI,MAAM,kEAAkE,WAAW,EAAE;AAAA,EACjG;AACA,QAAM,WAAW,QAAQ,WAAW;AAEpC,SAAO,CAAC,YAAsC;AAC5C,QAAI,QA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AAO,QAAQ,QAAQ,CAAC;AAAA,MAC/B;AACA;AAAA,IACF;AAEA,SAAK,IAAI;AACT,YAAQ,KAAK,KAAK,IAAI;AACtB,SAAK,wBAAwB,KAAK,IAAI,mCAAmC;AAAA,EAC3E;AAEA,SAAO;AAAA,IACL,MAAM,CAAC,MAAM,GAAG,KAAK,IAAI,CAAC,WAAW,OAAO,OAAO,CAAC,EAAE,KAAK,SAAS;AAAA,IACpE;AAAA,IACA,GAAI,YAAY,UAAa,EAAE,QAAQ;AAAA,EACzC;AACF;;;ACrHA,SAAS,qCAAqC;AA+BvC,IAAM,sCAAiE;AAAA,EAC5E,MAAM;AAAA,EACN,UAAU;AACZ;AAGO,IAAM,gCAAN,cAA4C,MAAM;AAAA,EACrC,OAAO;AAC3B;AAmBO,SAAS,gBACd,YACA,iBACA,aAAwC,qCACvB;AACjB,MAAI,WAAW,QAAQ,WAAW,UAAU;AAC1C,UAAM,IAAI;AAAA,MACR,+BAA+B,OAAO,WAAW,IAAI,CAAC,iCAChD,OAAO,WAAW,QAAQ,CAAC;AAAA,IACnC;AAAA,EACF;AACA,MAAI,CAAC,OAAO,SAAS,eAAe,KAAK,mBAAmB,EAAG,QAAO;AACtE,MAAI,CAAC,OAAO,SAAS,UAAU,KAAK,cAAc,EAAG,QAAO;AAE5D,QAAM,QAAQ,aAAa;AAC3B,MAAI,SAAS,WAAW,SAAU,QAAO;AACzC,MAAI,SAAS,WAAW,KAAM,QAAO;AACrC,SAAO;AACT;;;ACvCA,IAAI,OAAO,eAAe,aAAa;AACrC,QAAM,WAAW;AACjB,QAAM,IAAI;AACV,MAAI,EAAE,QAAQ,MAAM,MAAM;AACxB,MAAE,QAAQ,IAAI;AAEd,YAAQ;AAAA,MACN;AAAA,IAIF;AAAA,EACF;AACF;","names":["deriveKey","deriveKey","resolve","opts","warnOnce","existsSync","readFileSync","statSync","readFileSync","statSync","statSync","readFileSync","readFileSync","readdirSync","statSync","join","resolve","IGNORE_WARNING","resolve","readdirSync","join","statSync","readFileSync","item","IGNORE_WARNING"]}
1
+ {"version":3,"sources":["../../src/server/openapi/serve-docs.ts","../../src/cache/constants.ts","../../src/cache/validation.ts","../../src/cache/define-cached-function.ts","../../src/cache/cache-control-header.ts","../../src/cache/key-derivation.ts","../../src/cache/define-cached-route.ts","../../src/cache/cache-engine.ts","../../src/cache/in-memory-adapter.ts","../../src/cache/engine-singleton.ts","../../src/cache/revalidate.ts","../../src/cache/route-rules.ts","../../src/server/serialization.ts","../../src/server/http/in-process-caller.ts","../../src/server/http/ctx-reconciliation.ts","../../src/server/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAS,YAAY,cAAc,gBAAgB;AACnD,SAAS,eAAe;AAexB,IAAM,iBAAiB,KAAK,OAAO;AACnC,IAAM,cAAc;AAMb,SAAS,qBAAqB,OAA2B,CAAC,GAAG;AAClE,QAAM,WAAW,KAAK,YAAY;AAClC,QAAM,WAAW,KAAK,mBAAmB;AACzC,QAAM,cAAc,KAAK,gBAAgB;AACzC,QAAM,QAAQ,KAAK,aAAa;AAChC,QAAM,MAAM,KAAK,UAAU;AAO3B,MAAI,iBAAiB,WAAW,GAAG;AACjC,UAAM,IAAI,MAAM,kEAAkE,WAAW,EAAE;AAAA,EACjG;AACA,QAAM,WAAW,QAAQ,WAAW;AAEpC,SAAO,CAAC,YAAsC;AAC5C,QAAI,QAAQ,WAAW,MAAO,QAAO;AAErC,UAAM,MAAM,IAAI,I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AAS,iBAAiB;AAAA,IAC1B;AAAA,EACF,CAAC;AAID,QAAM,iBAAiB,OAAO;AAC9B,MAAI,mBAAmB,UAAa,EAAE,kBAAkB,WAAW;AACjE,UAAM,SAAS,eAAe,UAAU,MAAM;AAC9C,QAAI,CAAC,OAAO,QAAS,OAAM,IAAI,qBAAqB,OAAO,KAAK;AAChE,WAAO,OAAO;AAAA,EAChB;AACA,SAAO;AACT;;;AC1CO,IAAM,cAAc;AAAA;AAAA,EAEzB,gBAAgB;AAAA;AAAA,EAEhB,mBAAmB;AAAA;AAAA,EAEnB,WAAW;AACb;;;ACqGA,SAAS,eAAe,4BAA4B;AAQpD,SAAS,YAAY,kCAAkC;AASvD,SAAS,0BAA0B;AAMnC,SAAS,kBAAkB,wBAAwB;AAWnD,SAAS,2BAA2B;AAOpC,SAAS,2BAA2B;AAMpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAhLP,IAAI,OAAO,eAAe,aAAa;AACrC,QAAM,WAAW;AACjB,QAAM,IAAI;AACV,MAAI,EAAE,QAAQ,MAAM,MAAM;AACxB,MAAE,QAAQ,IAAI;AAEd,YAAQ;AAAA,MACN;AAAA,IAIF;AAAA,EACF;AACF;","names":["deriveKey","deriveKey","resolve","opts","warnOnce"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "theokit",
3
- "version": "0.48.0",
3
+ "version": "0.48.2",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "Apache-2.0",
@@ -123,12 +123,12 @@
123
123
  "tsx": "^4.22.4",
124
124
  "typescript": "^5.9.3",
125
125
  "vite": "^6.4.3",
126
- "@theokit/agents": "^8.0.0",
127
- "@theokit/http": "^1.0.0",
126
+ "@theokit/agents": "^9.4.0",
127
+ "@theokit/http": "^1.1.0",
128
128
  "@theokit/presenter": "^0.7.0"
129
129
  },
130
130
  "peerDependencies": {
131
- "@theokit/sdk": "^4.49.0",
131
+ "@theokit/sdk": "^4.52.1",
132
132
  "@theokit/studio": "^0.2.0",
133
133
  "@theokit/ui": "^1.1.0",
134
134
  "db0": "^0.3.0",
@@ -160,7 +160,7 @@
160
160
  }
161
161
  },
162
162
  "devDependencies": {
163
- "@theokit/sdk": "^4.49.0",
163
+ "@theokit/sdk": "^4.52.1",
164
164
  "@types/busboy": "^1.5.4",
165
165
  "@types/picomatch": "^4.0.3",
166
166
  "better-sqlite3": "^12.11.1",