@theokit/sdk 4.59.0 → 4.61.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 (89) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/{agent-VHRX7XGW.cjs → agent-M53C3PAA.cjs} +10 -9
  3. package/dist/{agent-VHRX7XGW.cjs.map → agent-M53C3PAA.cjs.map} +1 -1
  4. package/dist/{agent-ST27RIJE.js → agent-P42GA6RM.js} +9 -8
  5. package/dist/{agent-ST27RIJE.js.map → agent-P42GA6RM.js.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-D5NWEOCO.js → chunk-532CSLYU.js} +3 -3
  11. package/dist/{chunk-D5NWEOCO.js.map → chunk-532CSLYU.js.map} +1 -1
  12. package/dist/{chunk-7GUIET73.cjs → chunk-5IT6DUOO.cjs} +4 -4
  13. package/dist/{chunk-7GUIET73.cjs.map → chunk-5IT6DUOO.cjs.map} +1 -1
  14. package/dist/{chunk-554J7UQH.cjs → chunk-6OBIWHDR.cjs} +14 -201
  15. package/dist/chunk-6OBIWHDR.cjs.map +1 -0
  16. package/dist/{chunk-GNT35C5U.cjs → chunk-6SBW4QR2.cjs} +2 -2
  17. package/dist/{chunk-GNT35C5U.cjs.map → chunk-6SBW4QR2.cjs.map} +1 -1
  18. package/dist/{chunk-XV4IZNV4.js → chunk-FUL2I7G5.js} +2 -2
  19. package/dist/{chunk-XV4IZNV4.js.map → chunk-FUL2I7G5.js.map} +1 -1
  20. package/dist/{chunk-7LOIUIQZ.js → chunk-GQZKDGZM.js} +168 -13
  21. package/dist/chunk-GQZKDGZM.js.map +1 -0
  22. package/dist/{chunk-43GFJ5SD.cjs → chunk-P5LCASTC.cjs} +19 -4
  23. package/dist/chunk-P5LCASTC.cjs.map +1 -0
  24. package/dist/{chunk-ZA255A62.js → chunk-QEKI3YKI.js} +7 -186
  25. package/dist/chunk-QEKI3YKI.js.map +1 -0
  26. package/dist/{chunk-SMUAG2DY.cjs → chunk-R7YIVL3K.cjs} +218 -63
  27. package/dist/chunk-R7YIVL3K.cjs.map +1 -0
  28. package/dist/chunk-WCLDJSMY.js +456 -0
  29. package/dist/chunk-WCLDJSMY.js.map +1 -0
  30. package/dist/{chunk-WG7R5W6R.js → chunk-YEXA3PGR.js} +3 -3
  31. package/dist/{chunk-WG7R5W6R.js.map → chunk-YEXA3PGR.js.map} +1 -1
  32. package/dist/{chunk-IACR5LEM.js → chunk-YXGAW7BB.js} +17 -2
  33. package/dist/chunk-YXGAW7BB.js.map +1 -0
  34. package/dist/{compact-session-YHFQIXV5.cjs → compact-session-GJXJD73F.cjs} +11 -11
  35. package/dist/{compact-session-YHFQIXV5.cjs.map → compact-session-GJXJD73F.cjs.map} +1 -1
  36. package/dist/{compact-session-QGDNP45U.js → compact-session-TSMQOIHO.js} +3 -3
  37. package/dist/{compact-session-QGDNP45U.js.map → compact-session-TSMQOIHO.js.map} +1 -1
  38. package/dist/cron.cjs +9 -8
  39. package/dist/cron.js +8 -7
  40. package/dist/eval.cjs +8 -7
  41. package/dist/eval.cjs.map +1 -1
  42. package/dist/eval.js +7 -6
  43. package/dist/eval.js.map +1 -1
  44. package/dist/{index-manager-A64I7KYV.js → index-manager-AHAYJ33H.js} +4 -3
  45. package/dist/{index-manager-A64I7KYV.js.map → index-manager-AHAYJ33H.js.map} +1 -1
  46. package/dist/{index-manager-A3XPHAWF.cjs → index-manager-RHPFVFSC.cjs} +5 -4
  47. package/dist/{index-manager-A3XPHAWF.cjs.map → index-manager-RHPFVFSC.cjs.map} +1 -1
  48. package/dist/index.cjs +77 -43
  49. package/dist/index.cjs.map +1 -1
  50. package/dist/index.js +46 -12
  51. package/dist/index.js.map +1 -1
  52. package/dist/{inject-session-MLCJMYDG.cjs → inject-session-PPSO2IDD.cjs} +4 -4
  53. package/dist/{inject-session-MLCJMYDG.cjs.map → inject-session-PPSO2IDD.cjs.map} +1 -1
  54. package/dist/{inject-session-RBQZ45UM.js → inject-session-ZCQUB3IT.js} +3 -3
  55. package/dist/{inject-session-RBQZ45UM.js.map → inject-session-ZCQUB3IT.js.map} +1 -1
  56. package/dist/internal/memory/dreaming/phases.d.ts +21 -1
  57. package/dist/internal/memory/storage/chunk-markdown.d.cts +2 -0
  58. package/dist/internal/memory/storage/index.cjs +54 -0
  59. package/dist/internal/memory/storage/index.cjs.map +1 -0
  60. package/dist/internal/memory/storage/index.d.cts +18 -0
  61. package/dist/internal/memory/storage/index.d.ts +18 -0
  62. package/dist/internal/memory/storage/index.js +13 -0
  63. package/dist/internal/memory/storage/index.js.map +1 -0
  64. package/dist/internal/memory/storage/markdown-store.d.cts +77 -0
  65. package/dist/internal/memory/storage/markdown-store.d.ts +25 -1
  66. package/dist/internal/memory/storage/memory-file.d.cts +90 -0
  67. package/dist/internal/memory/storage/memory-file.d.ts +41 -5
  68. package/dist/internal/memory/storage/reader.d.cts +8 -0
  69. package/dist/internal/memory/storage/session-loader.d.cts +1 -0
  70. package/dist/internal/memory/storage/session-summary-writer.d.cts +2 -0
  71. package/dist/internal/memory/storage/threat-scan.d.cts +62 -0
  72. package/dist/internal/memory/storage/threat-scan.d.ts +62 -0
  73. package/dist/internal/memory/storage/transcript-store.d.cts +1 -0
  74. package/dist/internal/memory/storage/wiki-loader.d.cts +2 -0
  75. package/dist/internal/memory/types.d.ts +28 -0
  76. package/dist/internal/runtime/memory/select-facts.d.ts +63 -0
  77. package/dist/internal/runtime/system-prompt/sources/memory-provider.d.ts +6 -1
  78. package/dist/workflow.cjs +9 -9
  79. package/dist/workflow.js +1 -1
  80. package/docs/error-codes.md +3 -2
  81. package/docs/harness-capability-map.md +23 -7
  82. package/docs/memory-decisions.md +207 -0
  83. package/package.json +11 -1
  84. package/dist/chunk-43GFJ5SD.cjs.map +0 -1
  85. package/dist/chunk-554J7UQH.cjs.map +0 -1
  86. package/dist/chunk-7LOIUIQZ.js.map +0 -1
  87. package/dist/chunk-IACR5LEM.js.map +0 -1
  88. package/dist/chunk-SMUAG2DY.cjs.map +0 -1
  89. package/dist/chunk-ZA255A62.js.map +0 -1
package/dist/index.js CHANGED
@@ -3,24 +3,25 @@ export { GOAL_CONTINUATION_MARKER } from './chunk-PY2RQOA7.js';
3
3
  export { JudgeCredentialError } from './chunk-T73NA43R.js';
4
4
  export { GenerateObjectError } from './chunk-QRSUA2CV.js';
5
5
  import './chunk-AEOZTXVW.js';
6
- import { Workflow, agentStep } from './chunk-XV4IZNV4.js';
7
- export { Workflow, agentStep, fn } from './chunk-XV4IZNV4.js';
6
+ import { Workflow, agentStep } from './chunk-FUL2I7G5.js';
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-D5NWEOCO.js';
11
- import { MEMORY_EMBEDDING_ADAPTERS, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-7LOIUIQZ.js';
12
- export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-7LOIUIQZ.js';
13
- import './chunk-WG7R5W6R.js';
14
- import { lanceStoragePath, LanceIndex, readFactsFromMarkdown, defaultIndexPath, openMemoryDb, memoryDir } from './chunk-ZA255A62.js';
15
- import './chunk-MZ2FGBLZ.js';
16
- import './chunk-2SFBB54R.js';
10
+ export { Cron } from './chunk-532CSLYU.js';
11
+ import { MEMORY_EMBEDDING_ADAPTERS, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-GQZKDGZM.js';
12
+ export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-GQZKDGZM.js';
17
13
  import { configure, submit, list, get, cancel, subscribe } from './chunk-SUKXXLWD.js';
18
14
  export { emitRunEvent } from './chunk-SUKXXLWD.js';
15
+ import './chunk-YEXA3PGR.js';
19
16
  import './chunk-K2BQQ445.js';
17
+ import { lanceStoragePath, LanceIndex, defaultIndexPath, openMemoryDb } from './chunk-QEKI3YKI.js';
18
+ import './chunk-MZ2FGBLZ.js';
19
+ import './chunk-2SFBB54R.js';
20
20
  import './chunk-XN7NOENA.js';
21
21
  import './chunk-H73MEMQB.js';
22
+ import { readFactsFromMarkdown, memoryDir } from './chunk-WCLDJSMY.js';
22
23
  import './chunk-YJDH3CKG.js';
23
- 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';
24
25
  import './chunk-3E77SX4H.js';
25
26
  import './chunk-WTMU7J4U.js';
26
27
  import './chunk-5JLFFPCH.js';
@@ -1067,7 +1068,40 @@ function entryHash(entry) {
1067
1068
  // src/internal/memory/dreaming/phases.ts
1068
1069
  var DEFAULT_DEDUP_THRESHOLD = 0.95;
1069
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
+ }
1070
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) {
1071
1105
  if (facts.length <= 1) return { kept: [...facts], duplicatesRemoved: 0 };
1072
1106
  const vectors = await embedding.embed(facts.map((f) => f.text));
1073
1107
  const keptIdx = [];
@@ -1270,7 +1304,7 @@ var Memory = {
1270
1304
  openArgs.embedding = await resolveEmbedding(opts.embedding, peer.MEMORY_EMBEDDING_ADAPTERS);
1271
1305
  return await peer.IndexManager.open(openArgs);
1272
1306
  }
1273
- const { IndexManager } = await import('./index-manager-A64I7KYV.js');
1307
+ const { IndexManager } = await import('./index-manager-AHAYJ33H.js');
1274
1308
  openArgs.embedding = await resolveEmbedding(opts.embedding, MEMORY_EMBEDDING_ADAPTERS);
1275
1309
  return await IndexManager.open(openArgs);
1276
1310
  },
@@ -1844,7 +1878,7 @@ function isBuiltAgent(m) {
1844
1878
  return typeof m.send === "function";
1845
1879
  }
1846
1880
  async function materialize(def, index) {
1847
- const { Agent: Agent2 } = await import('./agent-ST27RIJE.js');
1881
+ const { Agent: Agent2 } = await import('./agent-P42GA6RM.js');
1848
1882
  return Agent2.create({
1849
1883
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
1850
1884
  // here means "declare nothing and let the default apply" — forwarding the literal would create