@theokit/sdk 4.41.1 → 4.42.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 +29 -0
- package/dist/{agent-JDJEBJHU.cjs → agent-HGDXQEQQ.cjs} +8 -7
- package/dist/{agent-JDJEBJHU.cjs.map → agent-HGDXQEQQ.cjs.map} +1 -1
- package/dist/{agent-LVKAYADR.js → agent-WUVYXIFX.js} +7 -6
- package/dist/{agent-LVKAYADR.js.map → agent-WUVYXIFX.js.map} +1 -1
- package/dist/chunk-22EMHGBO.cjs +351 -0
- package/dist/chunk-22EMHGBO.cjs.map +1 -0
- package/dist/{chunk-GTLH2NI2.cjs → chunk-EYEZDADP.cjs} +5 -5
- package/dist/{chunk-GTLH2NI2.cjs.map → chunk-EYEZDADP.cjs.map} +1 -1
- package/dist/{chunk-ZO2L5U6F.cjs → chunk-FAUKVJCC.cjs} +3 -3
- package/dist/{chunk-ZO2L5U6F.cjs.map → chunk-FAUKVJCC.cjs.map} +1 -1
- package/dist/{chunk-DHLVOLUX.js → chunk-KO5V6L3E.js} +10 -340
- package/dist/chunk-KO5V6L3E.js.map +1 -0
- package/dist/{chunk-AUMSEL33.js → chunk-MPD5EGJ6.js} +3 -3
- package/dist/{chunk-AUMSEL33.js.map → chunk-MPD5EGJ6.js.map} +1 -1
- package/dist/chunk-Q2PPSHBS.js +344 -0
- package/dist/chunk-Q2PPSHBS.js.map +1 -0
- package/dist/{chunk-FMIKUGF2.cjs → chunk-QFFNMJAS.cjs} +5 -5
- package/dist/{chunk-FMIKUGF2.cjs.map → chunk-QFFNMJAS.cjs.map} +1 -1
- package/dist/{chunk-UTYCG4RB.js → chunk-TDDRPFO3.js} +3 -3
- package/dist/{chunk-UTYCG4RB.js.map → chunk-TDDRPFO3.js.map} +1 -1
- package/dist/{chunk-IMX5YODO.js → chunk-UJ7HK7BX.js} +3 -3
- package/dist/{chunk-IMX5YODO.js.map → chunk-UJ7HK7BX.js.map} +1 -1
- package/dist/{chunk-RPL3POFZ.cjs → chunk-YHQ3DG24.cjs} +48 -378
- package/dist/chunk-YHQ3DG24.cjs.map +1 -0
- package/dist/{compact-session-65XCKO6H.js → compact-session-GF2CBKXB.js} +4 -4
- package/dist/{compact-session-65XCKO6H.js.map → compact-session-GF2CBKXB.js.map} +1 -1
- package/dist/{compact-session-OU6SRPVJ.cjs → compact-session-UUCBTBCZ.cjs} +12 -12
- package/dist/{compact-session-OU6SRPVJ.cjs.map → compact-session-UUCBTBCZ.cjs.map} +1 -1
- package/dist/context/index.cjs +35 -0
- package/dist/context/index.cjs.map +1 -0
- package/dist/context/index.d.cts +78 -0
- package/dist/context/index.d.ts +78 -0
- package/dist/context/index.js +18 -0
- package/dist/context/index.js.map +1 -0
- package/dist/cron.cjs +7 -6
- package/dist/cron.js +6 -5
- package/dist/eval.cjs +6 -5
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +5 -4
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +34 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-DDC36KKP.cjs → inject-session-I3HK3AHB.cjs} +4 -4
- package/dist/{inject-session-DDC36KKP.cjs.map → inject-session-I3HK3AHB.cjs.map} +1 -1
- package/dist/{inject-session-UBM4KVSV.js → inject-session-NR64GB3T.js} +3 -3
- package/dist/{inject-session-UBM4KVSV.js.map → inject-session-NR64GB3T.js.map} +1 -1
- package/dist/server/auth/index.d.cts +11 -207
- package/dist/server/auth/index.d.ts +11 -207
- package/dist/server/errors-envelope.d.cts +6 -12
- package/dist/server/errors-envelope.d.ts +6 -12
- package/package.json +11 -1
- package/dist/chunk-DHLVOLUX.js.map +0 -1
- package/dist/chunk-RPL3POFZ.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { COMPACT_SUMMARY_MARKER, COMPACT_USER_MESSAGE_MAX_TOKENS, autoCompactIfNeeded, buildDefaultSummarizer, compactSessionTranscript, isCompactSummary, resolveSummarizerRoute, shouldAutoCompact } from './chunk-
|
|
2
|
-
import './chunk-F4RUADRC.js';
|
|
1
|
+
export { COMPACT_SUMMARY_MARKER, COMPACT_USER_MESSAGE_MAX_TOKENS, autoCompactIfNeeded, buildDefaultSummarizer, compactSessionTranscript, isCompactSummary, resolveSummarizerRoute, shouldAutoCompact } from './chunk-TDDRPFO3.js';
|
|
3
2
|
import './chunk-4QEC4CCS.js';
|
|
3
|
+
import './chunk-F4RUADRC.js';
|
|
4
4
|
import './chunk-SNKY3C2L.js';
|
|
5
5
|
import './chunk-FD2UT76F.js';
|
|
6
6
|
import './chunk-U54XCYG3.js';
|
|
@@ -14,5 +14,5 @@ import './chunk-5NBUH3NO.js';
|
|
|
14
14
|
import './chunk-6FSQ3CHQ.js';
|
|
15
15
|
import './chunk-MRKSSN36.js';
|
|
16
16
|
import './chunk-PBML2FHN.js';
|
|
17
|
-
//# sourceMappingURL=compact-session-
|
|
18
|
-
//# sourceMappingURL=compact-session-
|
|
17
|
+
//# sourceMappingURL=compact-session-GF2CBKXB.js.map
|
|
18
|
+
//# sourceMappingURL=compact-session-GF2CBKXB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"compact-session-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"compact-session-GF2CBKXB.js"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-HLNLYLNN.cjs');
|
|
3
|
+
var chunkQFFNMJAS_cjs = require('./chunk-QFFNMJAS.cjs');
|
|
5
4
|
require('./chunk-4JBHSLQO.cjs');
|
|
5
|
+
require('./chunk-HLNLYLNN.cjs');
|
|
6
6
|
require('./chunk-S4Q5OMIK.cjs');
|
|
7
7
|
require('./chunk-MUUQ2WFJ.cjs');
|
|
8
8
|
require('./chunk-6JSIEDKL.cjs');
|
|
@@ -21,35 +21,35 @@ require('./chunk-ZHPET3LZ.cjs');
|
|
|
21
21
|
|
|
22
22
|
Object.defineProperty(exports, "COMPACT_SUMMARY_MARKER", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkQFFNMJAS_cjs.COMPACT_SUMMARY_MARKER; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "COMPACT_USER_MESSAGE_MAX_TOKENS", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkQFFNMJAS_cjs.COMPACT_USER_MESSAGE_MAX_TOKENS; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "autoCompactIfNeeded", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkQFFNMJAS_cjs.autoCompactIfNeeded; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "buildDefaultSummarizer", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkQFFNMJAS_cjs.buildDefaultSummarizer; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "compactSessionTranscript", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkQFFNMJAS_cjs.compactSessionTranscript; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "isCompactSummary", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkQFFNMJAS_cjs.isCompactSummary; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "resolveSummarizerRoute", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkQFFNMJAS_cjs.resolveSummarizerRoute; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "shouldAutoCompact", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkQFFNMJAS_cjs.shouldAutoCompact; }
|
|
53
53
|
});
|
|
54
|
-
//# sourceMappingURL=compact-session-
|
|
55
|
-
//# sourceMappingURL=compact-session-
|
|
54
|
+
//# sourceMappingURL=compact-session-UUCBTBCZ.cjs.map
|
|
55
|
+
//# sourceMappingURL=compact-session-UUCBTBCZ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"compact-session-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"compact-session-UUCBTBCZ.cjs"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk22EMHGBO_cjs = require('../chunk-22EMHGBO.cjs');
|
|
4
|
+
var chunkYPEPCZHF_cjs = require('../chunk-YPEPCZHF.cjs');
|
|
5
|
+
|
|
6
|
+
// src/context/index.ts
|
|
7
|
+
function resolveContextImports(content, basePath, options) {
|
|
8
|
+
const internalOptions = {
|
|
9
|
+
visited: options.visited ?? /* @__PURE__ */ new Set(),
|
|
10
|
+
depth: options.depth ?? 0,
|
|
11
|
+
maxBytesPerFile: options.maxBytesPerFile,
|
|
12
|
+
projectRoot: options.projectRoot
|
|
13
|
+
};
|
|
14
|
+
return chunk22EMHGBO_cjs.resolveImports(content, basePath, internalOptions);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Object.defineProperty(exports, "parseRules", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunk22EMHGBO_cjs.parseRules; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "runDiscovery", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunk22EMHGBO_cjs.runDiscovery; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "shouldActivateRule", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunk22EMHGBO_cjs.shouldActivateRule; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "DEFAULT_DISCOVERY_SPECS", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkYPEPCZHF_cjs.DEFAULT_DISCOVERY_SPECS; }
|
|
32
|
+
});
|
|
33
|
+
exports.resolveContextImports = resolveContextImports;
|
|
34
|
+
//# sourceMappingURL=index.cjs.map
|
|
35
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/context/index.ts"],"names":["resolveImports"],"mappings":";;;;;;AA+FO,SAAS,qBAAA,CACd,OAAA,EACA,QAAA,EACA,OAAA,EACiB;AACjB,EAAA,MAAM,eAAA,GAAyC;AAAA,IAC7C,OAAA,EAAS,OAAA,CAAQ,OAAA,oBAAW,IAAI,GAAA,EAAY;AAAA,IAC5C,KAAA,EAAO,QAAQ,KAAA,IAAS,CAAA;AAAA,IACxB,iBAAiB,OAAA,CAAQ,eAAA;AAAA,IACzB,aAAa,OAAA,CAAQ;AAAA,GACvB;AACA,EAAA,OAAOA,gCAAA,CAAuB,OAAA,EAAS,QAAA,EAAU,eAAe,CAAA;AAClE","file":"index.cjs","sourcesContent":["/**\n * `@theokit/sdk/context` — context assembly, as a SANCTIONED PUBLIC surface.\n *\n * Everything re-exported here is under semver. That is the whole difference from the\n * `internal/*` subpaths (`internal/persistence`, `internal/security`, `internal/memory-adapters`),\n * which the package documents as \"internal API — semver-exempt\" and is retiring:\n * `internal/persistence` is `@deprecated` in favour of the sanctioned `@theokit/sdk/persistence`,\n * and `internal/plugins` + `internal/observability` were deleted as dead public surface in July.\n *\n * **The list is explicit and there is no `export *`.** The tree behind it holds 13 files, including\n * YAML shims and parser internals a consumer never needs. Publishing the directory would commit\n * this package to every file in it; widening this list is a deliberate act.\n *\n * @public\n */\n\nimport {\n type ResolveImportsOptions,\n resolveImports as resolveImportsInternal,\n} from \"../internal/runtime/context/context-import-resolver.js\";\n\nexport type {\n DiscoveryParser,\n DiscoveryScope,\n DiscoverySpec,\n} from \"../internal/runtime/context/context-discovery.js\";\n/**\n * The seven conventions {@link runDiscovery} looks for when `specs` is omitted — `AGENTS.md`,\n * `GEMINI.md`, `CLAUDE.md`, `.cursor/rules/*.mdc`, `.theokit/rules/*.md`, `.theokit/context/*.md`\n * and `.theokit/THEO.md`.\n *\n * Exported because `specs` REPLACES this list rather than extending it. Without the constant, a\n * consumer registering one convention of its own silently loses every built-in one, and the loss is\n * invisible — discovery simply returns fewer sources. Spread it to extend:\n *\n * ```ts\n * await runDiscovery({ cwd, maxBytesPerFile, specs: [...DEFAULT_DISCOVERY_SPECS, mySpec] });\n * ```\n *\n * @public\n */\nexport { DEFAULT_DISCOVERY_SPECS } from \"../internal/runtime/context/context-discovery.js\";\nexport {\n type DiscoveryRunnerOptions,\n runDiscovery,\n} from \"../internal/runtime/context/context-discovery-runner.js\";\nexport {\n parseRules,\n shouldActivateRule,\n} from \"../internal/runtime/context/context-rules-frontmatter.js\";\n\n/**\n * Options for {@link resolveContextImports}.\n *\n * `projectRoot` is REQUIRED here and OPTIONAL on the internal `resolveImports`, and the asymmetry\n * is the point rather than an oversight.\n *\n * Internally the field has to be optional: it was added in 4.41.1 to close a defect where a\n * repository-supplied `CLAUDE.md` could name `@~/.ssh/id_rsa` and have that file inlined into the\n * agent's system prompt, and making it required would have broken every caller that predates it.\n *\n * As a PUBLIC contract the same optionality inverts into a trap. The obvious call omits the field,\n * compiles, and silently restores the un-contained behaviour — so the easiest way to use the API\n * would be the unsafe one, published under semver and therefore unfixable without a breaking\n * change. Requiring it makes the safe call the only call.\n *\n * @public\n */\nexport interface ResolveContextImportsOptions {\n /**\n * The directory an `@import` may not escape, compared after symlink resolution.\n *\n * A document carrying imports is repository-controlled — untrusted input whenever the repository\n * came from somewhere else — so the boundary is not optional.\n */\n readonly projectRoot: string;\n /** Per-import file cap, forwarded to the loader. */\n readonly maxBytesPerFile: number;\n /** Absolute paths already resolved, for cycle detection. Defaults to an empty set. */\n readonly visited?: Set<string>;\n /** Current recursion depth. Defaults to 0; the resolver caps at 5 hops. */\n readonly depth?: number;\n}\n\n/**\n * Expand `@path` import directives in `content`, confined to `options.projectRoot`.\n *\n * A line that is exactly `@some/path` is replaced with that file's content, recursively, with cycle\n * detection and a 5-hop cap. A target resolving outside the root — by `..`, by an absolute path, by\n * `~/`, or through a symlink — is replaced with a refusal placeholder rather than its bytes, and the\n * placeholder echoes the path as the author wrote it rather than as resolved, so a refusal does not\n * leak the layout of the machine back into the same untrusted document.\n *\n * @public\n */\nexport function resolveContextImports(\n content: string,\n basePath: string,\n options: ResolveContextImportsOptions,\n): Promise<string> {\n const internalOptions: ResolveImportsOptions = {\n visited: options.visited ?? new Set<string>(),\n depth: options.depth ?? 0,\n maxBytesPerFile: options.maxBytesPerFile,\n projectRoot: options.projectRoot,\n };\n return resolveImportsInternal(content, basePath, internalOptions);\n}\n"]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@theokit/sdk/context` — context assembly, as a SANCTIONED PUBLIC surface.
|
|
3
|
+
*
|
|
4
|
+
* Everything re-exported here is under semver. That is the whole difference from the
|
|
5
|
+
* `internal/*` subpaths (`internal/persistence`, `internal/security`, `internal/memory-adapters`),
|
|
6
|
+
* which the package documents as "internal API — semver-exempt" and is retiring:
|
|
7
|
+
* `internal/persistence` is `@deprecated` in favour of the sanctioned `@theokit/sdk/persistence`,
|
|
8
|
+
* and `internal/plugins` + `internal/observability` were deleted as dead public surface in July.
|
|
9
|
+
*
|
|
10
|
+
* **The list is explicit and there is no `export *`.** The tree behind it holds 13 files, including
|
|
11
|
+
* YAML shims and parser internals a consumer never needs. Publishing the directory would commit
|
|
12
|
+
* this package to every file in it; widening this list is a deliberate act.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export type { DiscoveryParser, DiscoveryScope, DiscoverySpec, } from "../internal/runtime/context/context-discovery.js";
|
|
17
|
+
/**
|
|
18
|
+
* The seven conventions {@link runDiscovery} looks for when `specs` is omitted — `AGENTS.md`,
|
|
19
|
+
* `GEMINI.md`, `CLAUDE.md`, `.cursor/rules/*.mdc`, `.theokit/rules/*.md`, `.theokit/context/*.md`
|
|
20
|
+
* and `.theokit/THEO.md`.
|
|
21
|
+
*
|
|
22
|
+
* Exported because `specs` REPLACES this list rather than extending it. Without the constant, a
|
|
23
|
+
* consumer registering one convention of its own silently loses every built-in one, and the loss is
|
|
24
|
+
* invisible — discovery simply returns fewer sources. Spread it to extend:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* await runDiscovery({ cwd, maxBytesPerFile, specs: [...DEFAULT_DISCOVERY_SPECS, mySpec] });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export { DEFAULT_DISCOVERY_SPECS } from "../internal/runtime/context/context-discovery.js";
|
|
33
|
+
export { type DiscoveryRunnerOptions, runDiscovery, } from "../internal/runtime/context/context-discovery-runner.js";
|
|
34
|
+
export { parseRules, shouldActivateRule, } from "../internal/runtime/context/context-rules-frontmatter.js";
|
|
35
|
+
/**
|
|
36
|
+
* Options for {@link resolveContextImports}.
|
|
37
|
+
*
|
|
38
|
+
* `projectRoot` is REQUIRED here and OPTIONAL on the internal `resolveImports`, and the asymmetry
|
|
39
|
+
* is the point rather than an oversight.
|
|
40
|
+
*
|
|
41
|
+
* Internally the field has to be optional: it was added in 4.41.1 to close a defect where a
|
|
42
|
+
* repository-supplied `CLAUDE.md` could name `@~/.ssh/id_rsa` and have that file inlined into the
|
|
43
|
+
* agent's system prompt, and making it required would have broken every caller that predates it.
|
|
44
|
+
*
|
|
45
|
+
* As a PUBLIC contract the same optionality inverts into a trap. The obvious call omits the field,
|
|
46
|
+
* compiles, and silently restores the un-contained behaviour — so the easiest way to use the API
|
|
47
|
+
* would be the unsafe one, published under semver and therefore unfixable without a breaking
|
|
48
|
+
* change. Requiring it makes the safe call the only call.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export interface ResolveContextImportsOptions {
|
|
53
|
+
/**
|
|
54
|
+
* The directory an `@import` may not escape, compared after symlink resolution.
|
|
55
|
+
*
|
|
56
|
+
* A document carrying imports is repository-controlled — untrusted input whenever the repository
|
|
57
|
+
* came from somewhere else — so the boundary is not optional.
|
|
58
|
+
*/
|
|
59
|
+
readonly projectRoot: string;
|
|
60
|
+
/** Per-import file cap, forwarded to the loader. */
|
|
61
|
+
readonly maxBytesPerFile: number;
|
|
62
|
+
/** Absolute paths already resolved, for cycle detection. Defaults to an empty set. */
|
|
63
|
+
readonly visited?: Set<string>;
|
|
64
|
+
/** Current recursion depth. Defaults to 0; the resolver caps at 5 hops. */
|
|
65
|
+
readonly depth?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Expand `@path` import directives in `content`, confined to `options.projectRoot`.
|
|
69
|
+
*
|
|
70
|
+
* A line that is exactly `@some/path` is replaced with that file's content, recursively, with cycle
|
|
71
|
+
* detection and a 5-hop cap. A target resolving outside the root — by `..`, by an absolute path, by
|
|
72
|
+
* `~/`, or through a symlink — is replaced with a refusal placeholder rather than its bytes, and the
|
|
73
|
+
* placeholder echoes the path as the author wrote it rather than as resolved, so a refusal does not
|
|
74
|
+
* leak the layout of the machine back into the same untrusted document.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export declare function resolveContextImports(content: string, basePath: string, options: ResolveContextImportsOptions): Promise<string>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@theokit/sdk/context` — context assembly, as a SANCTIONED PUBLIC surface.
|
|
3
|
+
*
|
|
4
|
+
* Everything re-exported here is under semver. That is the whole difference from the
|
|
5
|
+
* `internal/*` subpaths (`internal/persistence`, `internal/security`, `internal/memory-adapters`),
|
|
6
|
+
* which the package documents as "internal API — semver-exempt" and is retiring:
|
|
7
|
+
* `internal/persistence` is `@deprecated` in favour of the sanctioned `@theokit/sdk/persistence`,
|
|
8
|
+
* and `internal/plugins` + `internal/observability` were deleted as dead public surface in July.
|
|
9
|
+
*
|
|
10
|
+
* **The list is explicit and there is no `export *`.** The tree behind it holds 13 files, including
|
|
11
|
+
* YAML shims and parser internals a consumer never needs. Publishing the directory would commit
|
|
12
|
+
* this package to every file in it; widening this list is a deliberate act.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export type { DiscoveryParser, DiscoveryScope, DiscoverySpec, } from "../internal/runtime/context/context-discovery.js";
|
|
17
|
+
/**
|
|
18
|
+
* The seven conventions {@link runDiscovery} looks for when `specs` is omitted — `AGENTS.md`,
|
|
19
|
+
* `GEMINI.md`, `CLAUDE.md`, `.cursor/rules/*.mdc`, `.theokit/rules/*.md`, `.theokit/context/*.md`
|
|
20
|
+
* and `.theokit/THEO.md`.
|
|
21
|
+
*
|
|
22
|
+
* Exported because `specs` REPLACES this list rather than extending it. Without the constant, a
|
|
23
|
+
* consumer registering one convention of its own silently loses every built-in one, and the loss is
|
|
24
|
+
* invisible — discovery simply returns fewer sources. Spread it to extend:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* await runDiscovery({ cwd, maxBytesPerFile, specs: [...DEFAULT_DISCOVERY_SPECS, mySpec] });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export { DEFAULT_DISCOVERY_SPECS } from "../internal/runtime/context/context-discovery.js";
|
|
33
|
+
export { type DiscoveryRunnerOptions, runDiscovery, } from "../internal/runtime/context/context-discovery-runner.js";
|
|
34
|
+
export { parseRules, shouldActivateRule, } from "../internal/runtime/context/context-rules-frontmatter.js";
|
|
35
|
+
/**
|
|
36
|
+
* Options for {@link resolveContextImports}.
|
|
37
|
+
*
|
|
38
|
+
* `projectRoot` is REQUIRED here and OPTIONAL on the internal `resolveImports`, and the asymmetry
|
|
39
|
+
* is the point rather than an oversight.
|
|
40
|
+
*
|
|
41
|
+
* Internally the field has to be optional: it was added in 4.41.1 to close a defect where a
|
|
42
|
+
* repository-supplied `CLAUDE.md` could name `@~/.ssh/id_rsa` and have that file inlined into the
|
|
43
|
+
* agent's system prompt, and making it required would have broken every caller that predates it.
|
|
44
|
+
*
|
|
45
|
+
* As a PUBLIC contract the same optionality inverts into a trap. The obvious call omits the field,
|
|
46
|
+
* compiles, and silently restores the un-contained behaviour — so the easiest way to use the API
|
|
47
|
+
* would be the unsafe one, published under semver and therefore unfixable without a breaking
|
|
48
|
+
* change. Requiring it makes the safe call the only call.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export interface ResolveContextImportsOptions {
|
|
53
|
+
/**
|
|
54
|
+
* The directory an `@import` may not escape, compared after symlink resolution.
|
|
55
|
+
*
|
|
56
|
+
* A document carrying imports is repository-controlled — untrusted input whenever the repository
|
|
57
|
+
* came from somewhere else — so the boundary is not optional.
|
|
58
|
+
*/
|
|
59
|
+
readonly projectRoot: string;
|
|
60
|
+
/** Per-import file cap, forwarded to the loader. */
|
|
61
|
+
readonly maxBytesPerFile: number;
|
|
62
|
+
/** Absolute paths already resolved, for cycle detection. Defaults to an empty set. */
|
|
63
|
+
readonly visited?: Set<string>;
|
|
64
|
+
/** Current recursion depth. Defaults to 0; the resolver caps at 5 hops. */
|
|
65
|
+
readonly depth?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Expand `@path` import directives in `content`, confined to `options.projectRoot`.
|
|
69
|
+
*
|
|
70
|
+
* A line that is exactly `@some/path` is replaced with that file's content, recursively, with cycle
|
|
71
|
+
* detection and a 5-hop cap. A target resolving outside the root — by `..`, by an absolute path, by
|
|
72
|
+
* `~/`, or through a symlink — is replaced with a refusal placeholder rather than its bytes, and the
|
|
73
|
+
* placeholder echoes the path as the author wrote it rather than as resolved, so a refusal does not
|
|
74
|
+
* leak the layout of the machine back into the same untrusted document.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export declare function resolveContextImports(content: string, basePath: string, options: ResolveContextImportsOptions): Promise<string>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolveImports } from '../chunk-Q2PPSHBS.js';
|
|
2
|
+
export { parseRules, runDiscovery, shouldActivateRule } from '../chunk-Q2PPSHBS.js';
|
|
3
|
+
export { DEFAULT_DISCOVERY_SPECS } from '../chunk-UJ7IQJAG.js';
|
|
4
|
+
|
|
5
|
+
// src/context/index.ts
|
|
6
|
+
function resolveContextImports(content, basePath, options) {
|
|
7
|
+
const internalOptions = {
|
|
8
|
+
visited: options.visited ?? /* @__PURE__ */ new Set(),
|
|
9
|
+
depth: options.depth ?? 0,
|
|
10
|
+
maxBytesPerFile: options.maxBytesPerFile,
|
|
11
|
+
projectRoot: options.projectRoot
|
|
12
|
+
};
|
|
13
|
+
return resolveImports(content, basePath, internalOptions);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { resolveContextImports };
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/context/index.ts"],"names":[],"mappings":";;;;;AA+FO,SAAS,qBAAA,CACd,OAAA,EACA,QAAA,EACA,OAAA,EACiB;AACjB,EAAA,MAAM,eAAA,GAAyC;AAAA,IAC7C,OAAA,EAAS,OAAA,CAAQ,OAAA,oBAAW,IAAI,GAAA,EAAY;AAAA,IAC5C,KAAA,EAAO,QAAQ,KAAA,IAAS,CAAA;AAAA,IACxB,iBAAiB,OAAA,CAAQ,eAAA;AAAA,IACzB,aAAa,OAAA,CAAQ;AAAA,GACvB;AACA,EAAA,OAAO,cAAA,CAAuB,OAAA,EAAS,QAAA,EAAU,eAAe,CAAA;AAClE","file":"index.js","sourcesContent":["/**\n * `@theokit/sdk/context` — context assembly, as a SANCTIONED PUBLIC surface.\n *\n * Everything re-exported here is under semver. That is the whole difference from the\n * `internal/*` subpaths (`internal/persistence`, `internal/security`, `internal/memory-adapters`),\n * which the package documents as \"internal API — semver-exempt\" and is retiring:\n * `internal/persistence` is `@deprecated` in favour of the sanctioned `@theokit/sdk/persistence`,\n * and `internal/plugins` + `internal/observability` were deleted as dead public surface in July.\n *\n * **The list is explicit and there is no `export *`.** The tree behind it holds 13 files, including\n * YAML shims and parser internals a consumer never needs. Publishing the directory would commit\n * this package to every file in it; widening this list is a deliberate act.\n *\n * @public\n */\n\nimport {\n type ResolveImportsOptions,\n resolveImports as resolveImportsInternal,\n} from \"../internal/runtime/context/context-import-resolver.js\";\n\nexport type {\n DiscoveryParser,\n DiscoveryScope,\n DiscoverySpec,\n} from \"../internal/runtime/context/context-discovery.js\";\n/**\n * The seven conventions {@link runDiscovery} looks for when `specs` is omitted — `AGENTS.md`,\n * `GEMINI.md`, `CLAUDE.md`, `.cursor/rules/*.mdc`, `.theokit/rules/*.md`, `.theokit/context/*.md`\n * and `.theokit/THEO.md`.\n *\n * Exported because `specs` REPLACES this list rather than extending it. Without the constant, a\n * consumer registering one convention of its own silently loses every built-in one, and the loss is\n * invisible — discovery simply returns fewer sources. Spread it to extend:\n *\n * ```ts\n * await runDiscovery({ cwd, maxBytesPerFile, specs: [...DEFAULT_DISCOVERY_SPECS, mySpec] });\n * ```\n *\n * @public\n */\nexport { DEFAULT_DISCOVERY_SPECS } from \"../internal/runtime/context/context-discovery.js\";\nexport {\n type DiscoveryRunnerOptions,\n runDiscovery,\n} from \"../internal/runtime/context/context-discovery-runner.js\";\nexport {\n parseRules,\n shouldActivateRule,\n} from \"../internal/runtime/context/context-rules-frontmatter.js\";\n\n/**\n * Options for {@link resolveContextImports}.\n *\n * `projectRoot` is REQUIRED here and OPTIONAL on the internal `resolveImports`, and the asymmetry\n * is the point rather than an oversight.\n *\n * Internally the field has to be optional: it was added in 4.41.1 to close a defect where a\n * repository-supplied `CLAUDE.md` could name `@~/.ssh/id_rsa` and have that file inlined into the\n * agent's system prompt, and making it required would have broken every caller that predates it.\n *\n * As a PUBLIC contract the same optionality inverts into a trap. The obvious call omits the field,\n * compiles, and silently restores the un-contained behaviour — so the easiest way to use the API\n * would be the unsafe one, published under semver and therefore unfixable without a breaking\n * change. Requiring it makes the safe call the only call.\n *\n * @public\n */\nexport interface ResolveContextImportsOptions {\n /**\n * The directory an `@import` may not escape, compared after symlink resolution.\n *\n * A document carrying imports is repository-controlled — untrusted input whenever the repository\n * came from somewhere else — so the boundary is not optional.\n */\n readonly projectRoot: string;\n /** Per-import file cap, forwarded to the loader. */\n readonly maxBytesPerFile: number;\n /** Absolute paths already resolved, for cycle detection. Defaults to an empty set. */\n readonly visited?: Set<string>;\n /** Current recursion depth. Defaults to 0; the resolver caps at 5 hops. */\n readonly depth?: number;\n}\n\n/**\n * Expand `@path` import directives in `content`, confined to `options.projectRoot`.\n *\n * A line that is exactly `@some/path` is replaced with that file's content, recursively, with cycle\n * detection and a 5-hop cap. A target resolving outside the root — by `..`, by an absolute path, by\n * `~/`, or through a symlink — is replaced with a refusal placeholder rather than its bytes, and the\n * placeholder echoes the path as the author wrote it rather than as resolved, so a refusal does not\n * leak the layout of the machine back into the same untrusted document.\n *\n * @public\n */\nexport function resolveContextImports(\n content: string,\n basePath: string,\n options: ResolveContextImportsOptions,\n): Promise<string> {\n const internalOptions: ResolveImportsOptions = {\n visited: options.visited ?? new Set<string>(),\n depth: options.depth ?? 0,\n maxBytesPerFile: options.maxBytesPerFile,\n projectRoot: options.projectRoot,\n };\n return resolveImportsInternal(content, basePath, internalOptions);\n}\n"]}
|
package/dist/cron.cjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkEYEZDADP_cjs = require('./chunk-EYEZDADP.cjs');
|
|
4
|
+
require('./chunk-YHQ3DG24.cjs');
|
|
5
|
+
require('./chunk-FAUKVJCC.cjs');
|
|
5
6
|
require('./chunk-BV2MWEMV.cjs');
|
|
6
7
|
require('./chunk-KCQUYQ3V.cjs');
|
|
7
8
|
require('./chunk-BUUUWQMB.cjs');
|
|
8
|
-
require('./chunk-ZO2L5U6F.cjs');
|
|
9
9
|
require('./chunk-NRA36JKG.cjs');
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-HLNLYLNN.cjs');
|
|
10
|
+
require('./chunk-QFFNMJAS.cjs');
|
|
12
11
|
require('./chunk-4JBHSLQO.cjs');
|
|
12
|
+
require('./chunk-HLNLYLNN.cjs');
|
|
13
13
|
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-22EMHGBO.cjs');
|
|
17
18
|
require('./chunk-6X2HUT4A.cjs');
|
|
18
19
|
require('./chunk-7PESI6YD.cjs');
|
|
19
20
|
require('./chunk-S4Q5OMIK.cjs');
|
|
@@ -50,7 +51,7 @@ require('./chunk-ZHPET3LZ.cjs');
|
|
|
50
51
|
|
|
51
52
|
Object.defineProperty(exports, "Cron", {
|
|
52
53
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunkEYEZDADP_cjs.Cron; }
|
|
54
55
|
});
|
|
55
56
|
//# sourceMappingURL=cron.cjs.map
|
|
56
57
|
//# sourceMappingURL=cron.cjs.map
|
package/dist/cron.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
export { Cron } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { Cron } from './chunk-MPD5EGJ6.js';
|
|
2
|
+
import './chunk-KO5V6L3E.js';
|
|
3
|
+
import './chunk-UJ7HK7BX.js';
|
|
3
4
|
import './chunk-2SFBB54R.js';
|
|
4
5
|
import './chunk-GNMPCZNN.js';
|
|
5
6
|
import './chunk-K2BQQ445.js';
|
|
6
|
-
import './chunk-IMX5YODO.js';
|
|
7
7
|
import './chunk-PYM5OUL4.js';
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-F4RUADRC.js';
|
|
8
|
+
import './chunk-TDDRPFO3.js';
|
|
10
9
|
import './chunk-4QEC4CCS.js';
|
|
10
|
+
import './chunk-F4RUADRC.js';
|
|
11
11
|
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-Q2PPSHBS.js';
|
|
15
16
|
import './chunk-ZS6SLELQ.js';
|
|
16
17
|
import './chunk-LLE7HPRI.js';
|
|
17
18
|
import './chunk-SNKY3C2L.js';
|
package/dist/eval.cjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkR3CKCRK3_cjs = require('./chunk-R3CKCRK3.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkYHQ3DG24_cjs = require('./chunk-YHQ3DG24.cjs');
|
|
5
|
+
require('./chunk-FAUKVJCC.cjs');
|
|
5
6
|
require('./chunk-BV2MWEMV.cjs');
|
|
6
7
|
require('./chunk-KCQUYQ3V.cjs');
|
|
7
8
|
var chunkBUUUWQMB_cjs = require('./chunk-BUUUWQMB.cjs');
|
|
8
|
-
require('./chunk-ZO2L5U6F.cjs');
|
|
9
9
|
require('./chunk-NRA36JKG.cjs');
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-HLNLYLNN.cjs');
|
|
10
|
+
require('./chunk-QFFNMJAS.cjs');
|
|
12
11
|
require('./chunk-4JBHSLQO.cjs');
|
|
12
|
+
require('./chunk-HLNLYLNN.cjs');
|
|
13
13
|
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-22EMHGBO.cjs');
|
|
17
18
|
require('./chunk-6X2HUT4A.cjs');
|
|
18
19
|
require('./chunk-7PESI6YD.cjs');
|
|
19
20
|
require('./chunk-S4Q5OMIK.cjs');
|
|
@@ -773,7 +774,7 @@ function makeDefaultEmbedder(opts) {
|
|
|
773
774
|
let runtime;
|
|
774
775
|
return (texts) => {
|
|
775
776
|
if (runtime === void 0) {
|
|
776
|
-
runtime =
|
|
777
|
+
runtime = chunkYHQ3DG24_cjs.openRouterMemoryEmbeddingProviderAdapter.create(embedderCreateOptions(opts));
|
|
777
778
|
}
|
|
778
779
|
return runtime.then((rt) => rt.embed(texts));
|
|
779
780
|
};
|