@theokit/sdk 4.60.0 → 4.62.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/dist/{agent-6ABK2DPG.js → agent-NVBFTY5H.js} +7 -7
  3. package/dist/{agent-6ABK2DPG.js.map → agent-NVBFTY5H.js.map} +1 -1
  4. package/dist/{agent-26RMDG4U.cjs → agent-VYPUO4UB.cjs} +8 -8
  5. package/dist/{agent-26RMDG4U.cjs.map → agent-VYPUO4UB.cjs.map} +1 -1
  6. package/dist/{chunk-KKK3FZ4A.cjs → chunk-2DG7KW4L.cjs} +3 -3
  7. package/dist/{chunk-KKK3FZ4A.cjs.map → chunk-2DG7KW4L.cjs.map} +1 -1
  8. package/dist/chunk-2UCFUSPW.cjs +468 -0
  9. package/dist/chunk-2UCFUSPW.cjs.map +1 -0
  10. package/dist/{chunk-Y2KJ7MYO.cjs → chunk-6OBIWHDR.cjs} +14 -14
  11. package/dist/{chunk-Y2KJ7MYO.cjs.map → chunk-6OBIWHDR.cjs.map} +1 -1
  12. package/dist/{chunk-23GPJGRR.cjs → chunk-AH6WD7JR.cjs} +250 -63
  13. package/dist/chunk-AH6WD7JR.cjs.map +1 -0
  14. package/dist/{chunk-3HDTP4ZO.cjs → chunk-CWHTMNNK.cjs} +4 -4
  15. package/dist/{chunk-3HDTP4ZO.cjs.map → chunk-CWHTMNNK.cjs.map} +1 -1
  16. package/dist/{chunk-E5MWNLRX.js → chunk-IBYRA5PM.js} +3 -3
  17. package/dist/{chunk-E5MWNLRX.js.map → chunk-IBYRA5PM.js.map} +1 -1
  18. package/dist/{chunk-43GFJ5SD.cjs → chunk-P5LCASTC.cjs} +19 -4
  19. package/dist/chunk-P5LCASTC.cjs.map +1 -0
  20. package/dist/{chunk-7OXXYBHD.js → chunk-QEKI3YKI.js} +3 -3
  21. package/dist/{chunk-7OXXYBHD.js.map → chunk-QEKI3YKI.js.map} +1 -1
  22. package/dist/{chunk-76XTUTKY.js → chunk-SKOCYA55.js} +200 -13
  23. package/dist/chunk-SKOCYA55.js.map +1 -0
  24. package/dist/chunk-WCLDJSMY.js +456 -0
  25. package/dist/chunk-WCLDJSMY.js.map +1 -0
  26. package/dist/{chunk-WG7R5W6R.js → chunk-YEXA3PGR.js} +3 -3
  27. package/dist/{chunk-WG7R5W6R.js.map → chunk-YEXA3PGR.js.map} +1 -1
  28. package/dist/{chunk-IACR5LEM.js → chunk-YXGAW7BB.js} +17 -2
  29. package/dist/chunk-YXGAW7BB.js.map +1 -0
  30. package/dist/{compact-session-YHFQIXV5.cjs → compact-session-GJXJD73F.cjs} +11 -11
  31. package/dist/{compact-session-YHFQIXV5.cjs.map → compact-session-GJXJD73F.cjs.map} +1 -1
  32. package/dist/{compact-session-QGDNP45U.js → compact-session-TSMQOIHO.js} +3 -3
  33. package/dist/{compact-session-QGDNP45U.js.map → compact-session-TSMQOIHO.js.map} +1 -1
  34. package/dist/cron.cjs +7 -7
  35. package/dist/cron.js +6 -6
  36. package/dist/eval.cjs +6 -6
  37. package/dist/eval.js +5 -5
  38. package/dist/{index-manager-KP2JAXKN.js → index-manager-AHAYJ33H.js} +4 -4
  39. package/dist/{index-manager-KP2JAXKN.js.map → index-manager-AHAYJ33H.js.map} +1 -1
  40. package/dist/{index-manager-YUORPS4G.cjs → index-manager-RHPFVFSC.cjs} +5 -5
  41. package/dist/{index-manager-YUORPS4G.cjs.map → index-manager-RHPFVFSC.cjs.map} +1 -1
  42. package/dist/index.cjs +69 -36
  43. package/dist/index.cjs.map +1 -1
  44. package/dist/index.js +42 -9
  45. package/dist/index.js.map +1 -1
  46. package/dist/{inject-session-MLCJMYDG.cjs → inject-session-PPSO2IDD.cjs} +4 -4
  47. package/dist/{inject-session-MLCJMYDG.cjs.map → inject-session-PPSO2IDD.cjs.map} +1 -1
  48. package/dist/{inject-session-RBQZ45UM.js → inject-session-ZCQUB3IT.js} +3 -3
  49. package/dist/{inject-session-RBQZ45UM.js.map → inject-session-ZCQUB3IT.js.map} +1 -1
  50. package/dist/internal/memory/dreaming/phases.d.ts +21 -1
  51. package/dist/internal/memory/storage/index.cjs +10 -10
  52. package/dist/internal/memory/storage/index.js +1 -1
  53. package/dist/internal/memory/storage/memory-file.d.cts +41 -5
  54. package/dist/internal/memory/storage/memory-file.d.ts +41 -5
  55. package/dist/internal/memory/storage/threat-scan.d.cts +62 -0
  56. package/dist/internal/memory/storage/threat-scan.d.ts +62 -0
  57. package/dist/internal/memory/types.d.ts +28 -0
  58. package/dist/internal/runtime/memory/select-facts.d.ts +63 -0
  59. package/dist/internal/runtime/system-prompt/sources/memory-provider.d.ts +6 -1
  60. package/docs/error-codes.md +3 -2
  61. package/docs/harness-capability-map.md +9 -7
  62. package/docs/memory-decisions.md +207 -0
  63. package/package.json +1 -1
  64. package/dist/chunk-23GPJGRR.cjs.map +0 -1
  65. package/dist/chunk-43GFJ5SD.cjs.map +0 -1
  66. package/dist/chunk-76XTUTKY.js.map +0 -1
  67. package/dist/chunk-IACR5LEM.js.map +0 -1
  68. package/dist/chunk-JVERBPRD.js +0 -191
  69. package/dist/chunk-JVERBPRD.js.map +0 -1
  70. package/dist/chunk-NY25NBZB.cjs +0 -203
  71. package/dist/chunk-NY25NBZB.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -7,21 +7,21 @@ import { Workflow, agentStep } from './chunk-FUL2I7G5.js';
7
7
  export { Workflow, agentStep, fn } from './chunk-FUL2I7G5.js';
8
8
  import './chunk-AQLGBKNT.js';
9
9
  import './chunk-HY66GLM6.js';
10
- export { Cron } from './chunk-E5MWNLRX.js';
11
- import { MEMORY_EMBEDDING_ADAPTERS, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-76XTUTKY.js';
12
- export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-76XTUTKY.js';
10
+ export { Cron } from './chunk-IBYRA5PM.js';
11
+ import { MEMORY_EMBEDDING_ADAPTERS, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-SKOCYA55.js';
12
+ export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-SKOCYA55.js';
13
13
  import { configure, submit, list, get, cancel, subscribe } from './chunk-SUKXXLWD.js';
14
14
  export { emitRunEvent } from './chunk-SUKXXLWD.js';
15
- import './chunk-WG7R5W6R.js';
15
+ import './chunk-YEXA3PGR.js';
16
16
  import './chunk-K2BQQ445.js';
17
- import { lanceStoragePath, LanceIndex, defaultIndexPath, openMemoryDb } from './chunk-7OXXYBHD.js';
17
+ import { lanceStoragePath, LanceIndex, defaultIndexPath, openMemoryDb } from './chunk-QEKI3YKI.js';
18
18
  import './chunk-MZ2FGBLZ.js';
19
19
  import './chunk-2SFBB54R.js';
20
20
  import './chunk-XN7NOENA.js';
21
21
  import './chunk-H73MEMQB.js';
22
- import { readFactsFromMarkdown, memoryDir } from './chunk-JVERBPRD.js';
22
+ import { readFactsFromMarkdown, memoryDir } from './chunk-WCLDJSMY.js';
23
23
  import './chunk-YJDH3CKG.js';
24
- import { discoverProviderPlugins, shouldUseFixtureMode, isFixtureApiKey, httpRequest, mapOllamaTransportError, readErrorResponseBody, mapOllamaHttpError } from './chunk-IACR5LEM.js';
24
+ import { discoverProviderPlugins, shouldUseFixtureMode, isFixtureApiKey, httpRequest, mapOllamaTransportError, readErrorResponseBody, mapOllamaHttpError } from './chunk-YXGAW7BB.js';
25
25
  import './chunk-3E77SX4H.js';
26
26
  import './chunk-WTMU7J4U.js';
27
27
  import './chunk-5JLFFPCH.js';
@@ -1068,7 +1068,40 @@ function entryHash(entry) {
1068
1068
  // src/internal/memory/dreaming/phases.ts
1069
1069
  var DEFAULT_DEDUP_THRESHOLD = 0.95;
1070
1070
  var DEFAULT_CLUSTER_THRESHOLD = 0.75;
1071
+ var CONSOLIDATABLE_KINDS = /* @__PURE__ */ new Set(["project", "session"]);
1072
+ var ATOMIC_KINDS = /* @__PURE__ */ new Set(["user", "feedback", "reference"]);
1073
+ function dedupPolicy(fact) {
1074
+ if (fact.kind === void 0) return "exact";
1075
+ if (ATOMIC_KINDS.has(fact.kind)) return "never";
1076
+ return CONSOLIDATABLE_KINDS.has(fact.kind) ? "similar" : "never";
1077
+ }
1078
+ function normalizeForExactMatch(text) {
1079
+ return text.trim().toLowerCase().replace(/\s+/g, " ").replace(/[.!?]+$/, "");
1080
+ }
1071
1081
  async function lightPhase(facts, embedding, threshold = DEFAULT_DEDUP_THRESHOLD) {
1082
+ if (facts.length <= 1) return { kept: [...facts], duplicatesRemoved: 0 };
1083
+ const never = facts.filter((f) => dedupPolicy(f) === "never");
1084
+ const exact = facts.filter((f) => dedupPolicy(f) === "exact");
1085
+ const similar = facts.filter((f) => dedupPolicy(f) === "similar");
1086
+ const seen = /* @__PURE__ */ new Set();
1087
+ const exactKept = [];
1088
+ let removed = 0;
1089
+ for (const f of exact) {
1090
+ const key = normalizeForExactMatch(f.text);
1091
+ if (seen.has(key)) {
1092
+ removed += 1;
1093
+ continue;
1094
+ }
1095
+ seen.add(key);
1096
+ exactKept.push(f);
1097
+ }
1098
+ const sim = similar.length > 1 ? await dedupCandidates(similar, embedding, threshold) : { kept: [...similar], duplicatesRemoved: 0 };
1099
+ return {
1100
+ kept: [...never, ...exactKept, ...sim.kept],
1101
+ duplicatesRemoved: removed + sim.duplicatesRemoved
1102
+ };
1103
+ }
1104
+ async function dedupCandidates(facts, embedding, threshold) {
1072
1105
  if (facts.length <= 1) return { kept: [...facts], duplicatesRemoved: 0 };
1073
1106
  const vectors = await embedding.embed(facts.map((f) => f.text));
1074
1107
  const keptIdx = [];
@@ -1271,7 +1304,7 @@ var Memory = {
1271
1304
  openArgs.embedding = await resolveEmbedding(opts.embedding, peer.MEMORY_EMBEDDING_ADAPTERS);
1272
1305
  return await peer.IndexManager.open(openArgs);
1273
1306
  }
1274
- const { IndexManager } = await import('./index-manager-KP2JAXKN.js');
1307
+ const { IndexManager } = await import('./index-manager-AHAYJ33H.js');
1275
1308
  openArgs.embedding = await resolveEmbedding(opts.embedding, MEMORY_EMBEDDING_ADAPTERS);
1276
1309
  return await IndexManager.open(openArgs);
1277
1310
  },
@@ -1845,7 +1878,7 @@ function isBuiltAgent(m) {
1845
1878
  return typeof m.send === "function";
1846
1879
  }
1847
1880
  async function materialize(def, index) {
1848
- const { Agent: Agent2 } = await import('./agent-6ABK2DPG.js');
1881
+ const { Agent: Agent2 } = await import('./agent-NVBFTY5H.js');
1849
1882
  return Agent2.create({
1850
1883
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
1851
1884
  // here means "declare nothing and let the default apply" — forwarding the literal would create