@ponythewhite/base-context 1.0.13 → 1.0.15

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 (83) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/base-context-runtime/pyproject.toml +1 -1
  3. package/dist/base-context-runtime/uv.lock +1 -1
  4. package/dist/build-info.json +1 -1
  5. package/dist/bundle/amazon-bedrock.js +3 -3
  6. package/dist/bundle/{anthropic-BJVPUMPB.js → anthropic-AXUXEET7.js} +1 -1
  7. package/dist/bundle/{azure-openai-responses-ERRMAXK6.js → azure-openai-responses-J3NTJKEO.js} +2 -2
  8. package/dist/bundle/{bundled-modules-URKVA3UB.js → bundled-modules-O67MEO74.js} +5 -5
  9. package/dist/bundle/{chunk-FOGKLC7V.js → chunk-72LSQYUV.js} +1 -1
  10. package/dist/bundle/{chunk-TXVF6Q5H.js → chunk-DGO66I3L.js} +87 -51
  11. package/dist/bundle/{chunk-MUFZODP5.js → chunk-EGFIZABJ.js} +1 -1
  12. package/dist/bundle/{chunk-AEMRBMI2.js → chunk-IEM74GZ5.js} +9 -9
  13. package/dist/bundle/{chunk-25VYRAC6.js → chunk-JKKXN6JE.js} +72 -0
  14. package/dist/bundle/{chunk-TKOBEJ5E.js → chunk-RQFC34FM.js} +151 -51
  15. package/dist/bundle/{chunk-Q6UAHLII.js → chunk-V6LOBH6X.js} +2 -2
  16. package/dist/bundle/{cli-main-ZTJM5EEH.js → cli-main-2RER6PBE.js} +4 -4
  17. package/dist/bundle/cli.js +1 -1
  18. package/dist/bundle/{google-4GA4YMUX.js → google-QLKV2ZLC.js} +2 -2
  19. package/dist/bundle/{google-vertex-7AMALD7D.js → google-vertex-UGLUZV6B.js} +2 -2
  20. package/dist/bundle/{main-53I74INO.js → main-YERLD3T4.js} +5 -5
  21. package/dist/bundle/{mistral-74BXMNRM.js → mistral-2ITSLHYF.js} +1 -1
  22. package/dist/bundle/{openai-codex-responses-COXNC4IH.js → openai-codex-responses-FRREQXS3.js} +5 -4
  23. package/dist/bundle/{openai-completions-BCSA5Q6S.js → openai-completions-HF6UPPLW.js} +1 -1
  24. package/dist/bundle/{openai-responses-ONCIZSJS.js → openai-responses-LRTMBDFW.js} +2 -2
  25. package/dist/core/agent-session.d.ts.map +1 -1
  26. package/dist/core/agent-session.js +42 -25
  27. package/dist/core/agent-session.js.map +1 -1
  28. package/dist/core/autonomous.d.ts +2 -0
  29. package/dist/core/autonomous.d.ts.map +1 -1
  30. package/dist/core/autonomous.js +4 -0
  31. package/dist/core/autonomous.js.map +1 -1
  32. package/dist/core/canonical-context.d.ts.map +1 -1
  33. package/dist/core/canonical-context.js +7 -0
  34. package/dist/core/canonical-context.js.map +1 -1
  35. package/dist/core/compaction/compaction.d.ts +1 -1
  36. package/dist/core/compaction/compaction.d.ts.map +1 -1
  37. package/dist/core/compaction/compaction.js +11 -9
  38. package/dist/core/compaction/compaction.js.map +1 -1
  39. package/dist/core/inference-coordinator.d.ts.map +1 -1
  40. package/dist/core/inference-coordinator.js +13 -2
  41. package/dist/core/inference-coordinator.js.map +1 -1
  42. package/dist/core/kernel/repl-manager.d.ts.map +1 -1
  43. package/dist/core/kernel/repl-manager.js +5 -0
  44. package/dist/core/kernel/repl-manager.js.map +1 -1
  45. package/dist/core/public-context.d.ts.map +1 -1
  46. package/dist/core/public-context.js +2 -0
  47. package/dist/core/public-context.js.map +1 -1
  48. package/dist/core/session-manager.d.ts +8 -0
  49. package/dist/core/session-manager.d.ts.map +1 -1
  50. package/dist/core/session-manager.js +57 -0
  51. package/dist/core/session-manager.js.map +1 -1
  52. package/dist/core/view-units.d.ts.map +1 -1
  53. package/dist/core/view-units.js +3 -0
  54. package/dist/core/view-units.js.map +1 -1
  55. package/dist/main.d.ts.map +1 -1
  56. package/dist/main.js +1 -1
  57. package/dist/main.js.map +1 -1
  58. package/dist/modes/daemon/daemon-mode.d.ts.map +1 -1
  59. package/dist/modes/daemon/daemon-mode.js +21 -20
  60. package/dist/modes/daemon/daemon-mode.js.map +1 -1
  61. package/dist/modes/daemon/daemon-supervisor.d.ts.map +1 -1
  62. package/dist/modes/daemon/daemon-supervisor.js +11 -5
  63. package/dist/modes/daemon/daemon-supervisor.js.map +1 -1
  64. package/dist/modes/daemon/daemon-worker-client.d.ts +1 -0
  65. package/dist/modes/daemon/daemon-worker-client.d.ts.map +1 -1
  66. package/dist/modes/daemon/daemon-worker-client.js +8 -0
  67. package/dist/modes/daemon/daemon-worker-client.js.map +1 -1
  68. package/dist/modes/daemon/daemon-worker-protocol.d.ts +3 -0
  69. package/dist/modes/daemon/daemon-worker-protocol.d.ts.map +1 -1
  70. package/dist/modes/daemon/daemon-worker-protocol.js +2 -0
  71. package/dist/modes/daemon/daemon-worker-protocol.js.map +1 -1
  72. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  73. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  74. package/dist/modes/interactive/interactive-mode.js +29 -4
  75. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  76. package/dist/modes/print-mode.d.ts.map +1 -1
  77. package/dist/modes/print-mode.js +24 -21
  78. package/dist/modes/print-mode.js.map +1 -1
  79. package/docs/json.md +14 -1
  80. package/docs/long-running-agents.md +23 -2
  81. package/docs/providers.md +17 -0
  82. package/docs/upstream-1.0.15.md +83 -0
  83. package/package.json +4 -4
@@ -2012,6 +2012,10 @@ export class SessionManager {
2012
2012
  isCurrent: () => isCurrent(currentRevision),
2013
2013
  readHistory: (read) => sink.readHistory((history) => read(history.branchContext)),
2014
2014
  [readCopiedEpochSource]: (read) => sink.readHistory(read),
2015
+ readCompactionEntries: (entryIds) => {
2016
+ const ids = [...new Set(entryIds)];
2017
+ return sink.readHistory((history) => this._readCompactionEntriesAt(history, ids, capturedLimits));
2018
+ },
2015
2019
  readBranch: async () => {
2016
2020
  if (indexed)
2017
2021
  return sink.readHistory(async (history) => (await this._readBranchesAt(history, [history.source.leafId], capturedLimits)).branches[0]);
@@ -2893,6 +2897,59 @@ export class SessionManager {
2893
2897
  return entries;
2894
2898
  });
2895
2899
  }
2900
+ async _readCompactionEntriesAt(history, entryIds, limits) {
2901
+ const { maxEntries, maxSourceBytes } = limits;
2902
+ if (!Number.isSafeInteger(maxEntries) ||
2903
+ maxEntries <= 0 ||
2904
+ !Number.isSafeInteger(maxSourceBytes) ||
2905
+ maxSourceBytes <= 0)
2906
+ throw new Error("Invalid compaction source limits");
2907
+ if (entryIds.length > maxEntries)
2908
+ throw new Error("Compaction entry budget exceeded");
2909
+ const selected = new Set(entryIds);
2910
+ const references = [];
2911
+ for (const id of entryIds) {
2912
+ const reference = await history.branchContext.get(id);
2913
+ if (!reference)
2914
+ throw new Error("Compaction entry is outside its captured branch");
2915
+ references.push(reference);
2916
+ }
2917
+ references.sort((a, b) => a.sequence - b.sequence);
2918
+ // Pinned older views cannot cross an omitted message to become a chronological cut.
2919
+ // Walk metadata only: excluded lifetime payloads must not consume the hydration budget.
2920
+ const suffixAnchors = new Set();
2921
+ const visited = new Set();
2922
+ let current = history.source.leafId;
2923
+ let leafKind;
2924
+ while (current !== null) {
2925
+ if (visited.has(current))
2926
+ throw new Error("Compaction parent path is unresolved");
2927
+ visited.add(current);
2928
+ const reference = await history.branchContext.get(current);
2929
+ if (!reference)
2930
+ throw new Error("Compaction parent path is unresolved");
2931
+ leafKind ??= reference.kind;
2932
+ if (["message", "custom_message", "branch_summary"].includes(reference.kind)) {
2933
+ if (!selected.has(reference.id))
2934
+ break;
2935
+ suffixAnchors.add(reference.id);
2936
+ }
2937
+ current = reference.parentId;
2938
+ }
2939
+ const entries = [];
2940
+ let sourceBytes = 0;
2941
+ for (const reference of references) {
2942
+ const remaining = maxSourceBytes - sourceBytes;
2943
+ sourceBytes += reference.locator.length;
2944
+ if (sourceBytes > maxSourceBytes)
2945
+ throw new Error("Compaction source byte budget exceeded");
2946
+ const value = await history.hydrateEntry(reference.id, remaining);
2947
+ if (!value)
2948
+ throw new Error("Compaction entry source is unavailable");
2949
+ entries.push(withEntryRetention(value.entry, value.source.retention, value.source.qualification));
2950
+ }
2951
+ return { entries, suffixAnchors, leafKind };
2952
+ }
2896
2953
  async _readBranchesAt(history, leafIds, limits) {
2897
2954
  const { maxEntries, maxSourceBytes } = limits;
2898
2955
  if (!Number.isSafeInteger(maxEntries) ||