@theokit/sdk 4.41.1 → 4.42.1

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/{agent-JDJEBJHU.cjs → agent-DRUORJTU.cjs} +8 -7
  3. package/dist/{agent-JDJEBJHU.cjs.map → agent-DRUORJTU.cjs.map} +1 -1
  4. package/dist/{agent-LVKAYADR.js → agent-MVYGMWPM.js} +7 -6
  5. package/dist/{agent-LVKAYADR.js.map → agent-MVYGMWPM.js.map} +1 -1
  6. package/dist/{chunk-RPL3POFZ.cjs → chunk-4OQXDCMN.cjs} +50 -380
  7. package/dist/chunk-4OQXDCMN.cjs.map +1 -0
  8. package/dist/{chunk-ZO2L5U6F.cjs → chunk-FAUKVJCC.cjs} +3 -3
  9. package/dist/{chunk-ZO2L5U6F.cjs.map → chunk-FAUKVJCC.cjs.map} +1 -1
  10. package/dist/chunk-GAXYZXYY.cjs +352 -0
  11. package/dist/chunk-GAXYZXYY.cjs.map +1 -0
  12. package/dist/{chunk-GTLH2NI2.cjs → chunk-HLGEXZZP.cjs} +5 -5
  13. package/dist/{chunk-GTLH2NI2.cjs.map → chunk-HLGEXZZP.cjs.map} +1 -1
  14. package/dist/{chunk-AUMSEL33.js → chunk-O67XODD5.js} +3 -3
  15. package/dist/{chunk-AUMSEL33.js.map → chunk-O67XODD5.js.map} +1 -1
  16. package/dist/{chunk-FMIKUGF2.cjs → chunk-QFFNMJAS.cjs} +5 -5
  17. package/dist/{chunk-FMIKUGF2.cjs.map → chunk-QFFNMJAS.cjs.map} +1 -1
  18. package/dist/{chunk-UTYCG4RB.js → chunk-TDDRPFO3.js} +3 -3
  19. package/dist/{chunk-UTYCG4RB.js.map → chunk-TDDRPFO3.js.map} +1 -1
  20. package/dist/{chunk-IMX5YODO.js → chunk-UJ7HK7BX.js} +3 -3
  21. package/dist/{chunk-IMX5YODO.js.map → chunk-UJ7HK7BX.js.map} +1 -1
  22. package/dist/{chunk-DHLVOLUX.js → chunk-V5V5A6B7.js} +12 -342
  23. package/dist/chunk-V5V5A6B7.js.map +1 -0
  24. package/dist/chunk-ZZAAQOAZ.js +344 -0
  25. package/dist/chunk-ZZAAQOAZ.js.map +1 -0
  26. package/dist/{compact-session-65XCKO6H.js → compact-session-GF2CBKXB.js} +4 -4
  27. package/dist/{compact-session-65XCKO6H.js.map → compact-session-GF2CBKXB.js.map} +1 -1
  28. package/dist/{compact-session-OU6SRPVJ.cjs → compact-session-UUCBTBCZ.cjs} +12 -12
  29. package/dist/{compact-session-OU6SRPVJ.cjs.map → compact-session-UUCBTBCZ.cjs.map} +1 -1
  30. package/dist/context/index.cjs +35 -0
  31. package/dist/context/index.cjs.map +1 -0
  32. package/dist/context/index.d.cts +78 -0
  33. package/dist/context/index.d.ts +78 -0
  34. package/dist/context/index.js +18 -0
  35. package/dist/context/index.js.map +1 -0
  36. package/dist/cron.cjs +7 -6
  37. package/dist/cron.js +6 -5
  38. package/dist/eval.cjs +6 -5
  39. package/dist/eval.cjs.map +1 -1
  40. package/dist/eval.js +5 -4
  41. package/dist/eval.js.map +1 -1
  42. package/dist/index.cjs +34 -33
  43. package/dist/index.cjs.map +1 -1
  44. package/dist/index.js +9 -8
  45. package/dist/index.js.map +1 -1
  46. package/dist/{inject-session-DDC36KKP.cjs → inject-session-I3HK3AHB.cjs} +4 -4
  47. package/dist/{inject-session-DDC36KKP.cjs.map → inject-session-I3HK3AHB.cjs.map} +1 -1
  48. package/dist/{inject-session-UBM4KVSV.js → inject-session-NR64GB3T.js} +3 -3
  49. package/dist/{inject-session-UBM4KVSV.js.map → inject-session-NR64GB3T.js.map} +1 -1
  50. package/dist/internal/runtime/context/path-containment.d.ts +24 -0
  51. package/package.json +23 -12
  52. package/dist/chunk-DHLVOLUX.js.map +0 -1
  53. package/dist/chunk-RPL3POFZ.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,65 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.42.1
4
+
5
+ ### Patch Changes
6
+
7
+ - dc18357: **Security.** Fix a containment check that admitted a sibling directory and any symlink.
8
+
9
+ `.theokit/context/*.md` frontmatter carries a `path:`, so the value is repository-controlled —
10
+ untrusted whenever the repository came from somewhere else. `loadSources` guarded it with
11
+ `absolute.startsWith(resolvePath(cwd))`, which fails twice:
12
+
13
+ - **No separator boundary.** With `cwd = /home/user/proj`, the value `../proj-evil/secret.md`
14
+ resolves to `/home/user/proj-evil/secret.md`, which starts with `/home/user/proj`. A sibling
15
+ directory whose name merely extends the project's is admitted; no traversal past the parent is
16
+ needed.
17
+ - **Lexical, not real.** A symlink whose name sits inside the root and whose target does not passes
18
+ any comparison made before symlink resolution.
19
+
20
+ Measured against the pre-fix code: the file outside the root was READ and its content reached the
21
+ context snapshot. The obvious escapes (`../../etc/passwd`, an absolute path) were refused, and
22
+ refusing them is what made the check look correct in review.
23
+
24
+ The correct rule already existed in the package as a private function in the import resolver, written
25
+ for the 4.41.1 patch. It now lives in `path-containment.ts` and both readers of repository-supplied
26
+ paths share it — one rule, one representation, so the two cannot drift apart again.
27
+
28
+ **A second, independent defect fixed alongside it.** `refresh()` carried every legacy source into the
29
+ aggregator without filtering, and then stamped `"included"` on everything the budget kept — so the
30
+ containment verdict was computed and discarded three statements later, and `snapshot()` reported an
31
+ excluded source as included. Nothing leaked through that path (the content was empty), but a consumer
32
+ auditing "what is in my context" got the wrong answer.
33
+
34
+ ## 4.42.0
35
+
36
+ ### Minor Changes
37
+
38
+ - 09d5dbc: Add `@theokit/sdk/context` — a sanctioned public barrel for context assembly.
39
+
40
+ Discovery, rule activation and `@path` import resolution were implemented inside
41
+ `internal/runtime/context/` and reachable by nobody: 31 subpaths were declared, none covered the
42
+ tree, and every deep import answered `ERR_PACKAGE_PATH_NOT_EXPORTED`. A consumer that wanted the
43
+ capability had to re-derive it — measured at ~430 LoC in one downstream product.
44
+
45
+ The barrel is a curated list, never `export *`: `runDiscovery`, `parseRules`, `shouldActivateRule`,
46
+ `resolveContextImports`, plus the `DiscoverySpec` / `DiscoveryScope` / `DiscoveryParser` types. The
47
+ tree behind it holds 13 files including YAML shims and parser internals a consumer never needs, and
48
+ publishing the directory would commit this package to every file in it.
49
+
50
+ Deliberately NOT under `internal/*`. Those subpaths are documented "internal API — semver-exempt",
51
+ `internal/persistence` is `@deprecated` in favour of a sanctioned barrel, and two siblings were
52
+ deleted as dead public surface. What is exported here is under semver.
53
+
54
+ **`resolveContextImports` is a wrapper, not a re-export, and the difference is a security boundary.**
55
+ The internal `resolveImports` takes `projectRoot` as an OPTIONAL field — correct for the callers that
56
+ predate 4.41.1, and a trap as a public contract: the obvious call omits it and silently restores the
57
+ un-contained behaviour that 4.41.1 patched, published under semver and therefore unfixable without a
58
+ breaking change. On the public surface the root is REQUIRED, asserted by a `@ts-expect-error` test.
59
+
60
+ `applyAggregateCap` is deliberately excluded: its `priority` field means "position among the SDK's
61
+ own seven specs", which is not a contract a consumer registering its own source can use.
62
+
3
63
  ## 4.41.1
4
64
 
5
65
  ### Patch Changes
@@ -1,18 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var chunkRPL3POFZ_cjs = require('./chunk-RPL3POFZ.cjs');
3
+ var chunk4OQXDCMN_cjs = require('./chunk-4OQXDCMN.cjs');
4
+ require('./chunk-FAUKVJCC.cjs');
4
5
  require('./chunk-BV2MWEMV.cjs');
5
6
  require('./chunk-KCQUYQ3V.cjs');
6
7
  require('./chunk-BUUUWQMB.cjs');
7
- require('./chunk-ZO2L5U6F.cjs');
8
8
  require('./chunk-NRA36JKG.cjs');
9
- require('./chunk-FMIKUGF2.cjs');
10
- require('./chunk-HLNLYLNN.cjs');
9
+ require('./chunk-QFFNMJAS.cjs');
11
10
  require('./chunk-4JBHSLQO.cjs');
11
+ require('./chunk-HLNLYLNN.cjs');
12
12
  require('./chunk-FZ4YMZA3.cjs');
13
13
  require('./chunk-GH52NOCL.cjs');
14
14
  require('./chunk-HECR7KF5.cjs');
15
15
  require('./chunk-BBZYXVLZ.cjs');
16
+ require('./chunk-GAXYZXYY.cjs');
16
17
  require('./chunk-6X2HUT4A.cjs');
17
18
  require('./chunk-7PESI6YD.cjs');
18
19
  require('./chunk-S4Q5OMIK.cjs');
@@ -49,7 +50,7 @@ require('./chunk-ZHPET3LZ.cjs');
49
50
 
50
51
  Object.defineProperty(exports, "Agent", {
51
52
  enumerable: true,
52
- get: function () { return chunkRPL3POFZ_cjs.Agent; }
53
+ get: function () { return chunk4OQXDCMN_cjs.Agent; }
53
54
  });
54
- //# sourceMappingURL=agent-JDJEBJHU.cjs.map
55
- //# sourceMappingURL=agent-JDJEBJHU.cjs.map
55
+ //# sourceMappingURL=agent-DRUORJTU.cjs.map
56
+ //# sourceMappingURL=agent-DRUORJTU.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-JDJEBJHU.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-DRUORJTU.cjs"}
@@ -1,16 +1,17 @@
1
- export { Agent } from './chunk-DHLVOLUX.js';
1
+ export { Agent } from './chunk-V5V5A6B7.js';
2
+ import './chunk-UJ7HK7BX.js';
2
3
  import './chunk-2SFBB54R.js';
3
4
  import './chunk-GNMPCZNN.js';
4
5
  import './chunk-K2BQQ445.js';
5
- import './chunk-IMX5YODO.js';
6
6
  import './chunk-PYM5OUL4.js';
7
- import './chunk-UTYCG4RB.js';
8
- import './chunk-F4RUADRC.js';
7
+ import './chunk-TDDRPFO3.js';
9
8
  import './chunk-4QEC4CCS.js';
9
+ import './chunk-F4RUADRC.js';
10
10
  import './chunk-ZTEAJAE6.js';
11
11
  import './chunk-RJBHWM6D.js';
12
12
  import './chunk-J5RW43IR.js';
13
13
  import './chunk-AM2CNBKE.js';
14
+ import './chunk-ZZAAQOAZ.js';
14
15
  import './chunk-ZS6SLELQ.js';
15
16
  import './chunk-LLE7HPRI.js';
16
17
  import './chunk-SNKY3C2L.js';
@@ -42,5 +43,5 @@ import './chunk-6FSQ3CHQ.js';
42
43
  import './chunk-OLLOUAUJ.js';
43
44
  import './chunk-MRKSSN36.js';
44
45
  import './chunk-PBML2FHN.js';
45
- //# sourceMappingURL=agent-LVKAYADR.js.map
46
- //# sourceMappingURL=agent-LVKAYADR.js.map
46
+ //# sourceMappingURL=agent-MVYGMWPM.js.map
47
+ //# sourceMappingURL=agent-MVYGMWPM.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-LVKAYADR.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-MVYGMWPM.js"}