@ponythewhite/base-context 1.0.6 → 1.0.7

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.7] - 2026-09-18
4
+
5
+ - Fixed reopening saved sessions with native tool continuation history.
6
+ - Allowed subsequent native requests to retain the full public tool view when no token budget is configured, without changing configured budget checks.
7
+ - Kept startup, compaction reloads, and tree navigation read-only until a fresh native request is admitted.
8
+
3
9
  ## [1.0.6] - 2026-09-18
4
10
 
5
11
  - Fixed automatic and manual compaction failing after native tool continuations.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "base-context-runtime"
3
- version = "1.0.6"
3
+ version = "1.0.7"
4
4
  description = "Kernel-side runtime shim for Base Context recursion"
5
5
  license = "MIT"
6
6
  license-files = ["LICENSE", "NOTICE"]
@@ -367,7 +367,7 @@ wheels = [
367
367
 
368
368
  [[package]]
369
369
  name = "base-context-runtime"
370
- version = "1.0.6"
370
+ version = "1.0.7"
371
371
  source = { editable = "." }
372
372
  dependencies = [
373
373
  { name = "mcp" },
@@ -1,5 +1,5 @@
1
1
  {
2
- "sourceCommit": "b6c3017e4ba1cc65afd6bdc4cab6d8287e4a8afa",
2
+ "sourceCommit": "cd5d72b4d437f94ab5beb13c114c5bc70ac992ed",
3
3
  "sourceDirty": false,
4
4
  "buildHost": {
5
5
  "platform": "linux",
@@ -51,7 +51,7 @@ import {
51
51
  oauth_exports,
52
52
  runPrintMode,
53
53
  runRpcMode
54
- } from "./chunk-LIZVVGHR.js";
54
+ } from "./chunk-PFROC4EV.js";
55
55
  import {
56
56
  AgentSession,
57
57
  CURRENT_SESSION_VERSION,
@@ -143,7 +143,7 @@ import {
143
143
  withFileMutationQueue,
144
144
  wrapRegisteredTool,
145
145
  wrapRegisteredTools
146
- } from "./chunk-QKI6KEGP.js";
146
+ } from "./chunk-VCW3YDFF.js";
147
147
  import "./chunk-CFNASUYO.js";
148
148
  import "./chunk-LFPWHI42.js";
149
149
  import {
@@ -348,7 +348,7 @@ import {
348
348
  watchWithErrorHandler,
349
349
  workerRosterEntryFromSummary,
350
350
  wrapTextWithAnsi
351
- } from "./chunk-QKI6KEGP.js";
351
+ } from "./chunk-VCW3YDFF.js";
352
352
  import {
353
353
  array,
354
354
  boolean,
@@ -23289,7 +23289,7 @@ async function createAgentSession(options = {}) {
23289
23289
  time("resourceLoader.reload");
23290
23290
  }
23291
23291
  const { context: existingSession, hasExistingSession, hasThinkingEntry, hasServiceTierEntry } = await readSessionBootstrap(sessionManager, settingsManager.getCanonicalContextLimits(), {
23292
- allowPendingToolPublic: options.requestTokenBudget !== void 0,
23292
+ purpose: "read",
23293
23293
  initialContextMode: contextMode ?? settingsManager.getContextMode()
23294
23294
  });
23295
23295
  let model = options.model ?? void 0;
@@ -27772,9 +27772,10 @@ function readContextEpoch(details, maxBytes) {
27772
27772
  throw new Error("Invalid committed context epoch");
27773
27773
  return snapshotContextEpoch(value, maxBytes);
27774
27774
  }
27775
- function contextEpochRepresentation(request, assessment, maxBytes) {
27776
- if (!assessment?.profile || assessment.limitSource !== "explicit-profile" || !assessment.route || !assessment.model || request.body === void 0)
27775
+ function contextEpochRepresentation(request, assessment, maxBytes, unbudgetedPublic = false) {
27776
+ if (!assessment && !unbudgetedPublic || assessment && (!assessment.profile || assessment.limitSource !== "explicit-profile" || !assessment.route || !assessment.model) || request.body === void 0)
27777
27777
  throw new Error("Committed context epoch requires its explicit request profile");
27778
+ const identity = assessment ?? contextRequestContract(request, "message-groups");
27778
27779
  const body = JSON.parse(request.body);
27779
27780
  if (!body || typeof body !== "object" || Array.isArray(body))
27780
27781
  throw new Error("Context epoch request representation is unavailable");
@@ -27800,7 +27801,7 @@ function contextEpochRepresentation(request, assessment, maxBytes) {
27800
27801
  "prompt_cache_retention",
27801
27802
  "stream_options"
27802
27803
  ]);
27803
- if (request.api === "openai-completions" && request.provider === "deepseek" && request.url === "https://api.deepseek.com/chat/completions" && assessment.route === request.url && "model" in body && body.model === "deepseek-flash" && assessment.model === body.model) {
27804
+ if (request.api === "openai-completions" && request.provider === "deepseek" && request.url === "https://api.deepseek.com/chat/completions" && identity.route === request.url && "model" in body && body.model === "deepseek-flash" && identity.model === body.model) {
27804
27805
  fields.add("thinking");
27805
27806
  fields.add("reasoning_effort");
27806
27807
  }
@@ -27819,11 +27820,13 @@ function contextEpochRepresentation(request, assessment, maxBytes) {
27819
27820
  renderer: CONTEXT_EPOCH_RENDERER,
27820
27821
  api: request.api,
27821
27822
  provider: request.provider,
27822
- route: assessment.route,
27823
- model: assessment.model,
27824
- profile: assessment.profile,
27825
- contextTokens: assessment.contextTokens,
27826
- outputReserveTokens: assessment.outputReserveTokens,
27823
+ route: identity.route,
27824
+ model: identity.model,
27825
+ ...assessment ? {
27826
+ profile: assessment.profile,
27827
+ contextTokens: assessment.contextTokens,
27828
+ outputReserveTokens: assessment.outputReserveTokens
27829
+ } : { budget: "unbudgeted" },
27827
27830
  configuration,
27828
27831
  policy
27829
27832
  }, maxBytes);
@@ -32159,9 +32162,11 @@ async function prepareFixedRequestView(boundary, request, projection, assessment
32159
32162
  }
32160
32163
  async function selectRequestView(boundary, request, projection, budget, allowShrink) {
32161
32164
  projection = canonicalRequestProjection(boundary, projection);
32162
- const full = budget.measure(request);
32165
+ const full = budget?.measure(request);
32163
32166
  const inputKey = requestInputKey(request, projection);
32164
- if (full.limitSource !== "explicit-profile" || !inputKey)
32167
+ if (budget && full?.limitSource !== "explicit-profile" || !inputKey)
32168
+ return;
32169
+ if (!budget && !boundary.pendingPublicMessageGroups?.length)
32165
32170
  return;
32166
32171
  const payload = JSON.parse(request.body);
32167
32172
  const input = payload[inputKey];
@@ -32200,16 +32205,20 @@ async function selectRequestView(boundary, request, projection, budget, allowShr
32200
32205
  const publicSource = getCanonicalViewSelectionSource(publicView.messages);
32201
32206
  const publicUnits = bindMessageReplayUnits(publicView.messages, publicSource.units, boundary.limits, replayContract);
32202
32207
  const closed = closeViewSelection(publicUnits, publicUnits.map((unit) => unit.id), boundary.limits);
32203
- const assessment = budget.measure(encoded.request);
32204
- if (assessment.status === "over-budget")
32205
- throw new PublicContextBudgetError(boundary.source, assessment, full);
32206
- if (assessment.status !== "within-estimate")
32207
- throw new Error("Tool continuation public request exceeds its token budget");
32208
+ const assessment = budget?.measure(encoded.request);
32209
+ if (assessment && full) {
32210
+ if (assessment.status === "over-budget")
32211
+ throw new PublicContextBudgetError(boundary.source, assessment, full);
32212
+ if (assessment.status !== "within-estimate")
32213
+ throw new Error("Tool continuation public request exceeds its token budget");
32214
+ }
32208
32215
  await offer(closed.map((unit) => unit.id), encoded.request, encoded.projection, assessment, publicView.messages);
32209
32216
  return encoded.request.body;
32210
32217
  }
32211
32218
  if (projection.pendingPublicMessageGroups?.length)
32212
32219
  throw new Error("Adapter pending group has no original owned source plan");
32220
+ if (!budget || !full)
32221
+ return;
32213
32222
  const offerPublicWindow = async () => {
32214
32223
  if (!allowShrink || replayContract !== "message-groups" || !projection.publicWindow || !projection.encodePublicWindow)
32215
32224
  return;
@@ -33084,8 +33093,8 @@ var InferenceCoordinator = class _InferenceCoordinator {
33084
33093
  throw error;
33085
33094
  }
33086
33095
  } : void 0;
33087
- const canSelect = (budget || boundary?.fixedPrepare) && boundary && matchesRequestView(boundary, source, context);
33088
33096
  const requiredPublic = Boolean(boundary?.pendingPublicMessageGroups?.length);
33097
+ const canSelect = (budget || boundary?.fixedPrepare || requiredPublic) && boundary && matchesRequestView(boundary, source, context);
33089
33098
  if (requiredPublic && (!canSelect || boundary?.fixedPrepare))
33090
33099
  throw new Error("Tool continuation requires a selectable native public request boundary");
33091
33100
  let publicAccepted = false;
@@ -44742,7 +44751,7 @@ async function loadExtensionModule(extensionPath) {
44742
44751
  // (file-path aliases would load a second, divergent copy of each package).
44743
44752
  // Also disable tryNative so jiti handles ALL imports (not just the entry point)
44744
44753
  // Node/dev must also share the native AI registry and implementation identities.
44745
- ...isBunBinary || isBundledCli ? { virtualModules: (await import("./bundled-modules-MEACET4U.js")).VIRTUAL_MODULES, tryNative: false } : {
44754
+ ...isBunBinary || isBundledCli ? { virtualModules: (await import("./bundled-modules-PS66L3IT.js")).VIRTUAL_MODULES, tryNative: false } : {
44746
44755
  alias: getAliases(),
44747
44756
  virtualModules: {
44748
44757
  "@ponythewhite/base-context-ai": src_exports,
@@ -58097,7 +58106,16 @@ var AgentSession = class _AgentSession {
58097
58106
  try {
58098
58107
  const messages = await captured.readHistory(async (view) => {
58099
58108
  const sameSource = controls?.sessionId === view.source.sessionId && controls?.sessionFile === view.source.sessionFile;
58100
- const result = await this._contextCompiler.compile(view, limits, sameSource ? omitted : void 0, {}, resource, this._initialContextMode, contextEpochsEnabled);
58109
+ const result = await this._contextCompiler.compile(
58110
+ view,
58111
+ limits,
58112
+ sameSource ? omitted : void 0,
58113
+ {},
58114
+ resource,
58115
+ this._initialContextMode,
58116
+ // This MAIN owner binds public admission below, independently of optional token budgets.
58117
+ true
58118
+ );
58101
58119
  if (sameSource && this._contextOmissions === controls) {
58102
58120
  for (const id of omitted)
58103
58121
  if (!this._contextCompiler.hasActiveEntry(id))
@@ -58111,7 +58129,8 @@ var AgentSession = class _AgentSession {
58111
58129
  const epochContext = getCanonicalEpochContext(messages);
58112
58130
  if (epochContext)
58113
58131
  this._contextMode = epochContext.mode;
58114
- const nativeSkills = Boolean(contextEpochsEnabled || epochContext?.checkpoint);
58132
+ const unbudgetedPublic = !contextEpochsEnabled && Boolean(epochContext?.toolContinuations?.length);
58133
+ const nativeSkills = Boolean(contextEpochsEnabled || epochContext?.checkpoint || unbudgetedPublic);
58115
58134
  const skillPolicy = nativeSkills ? this._nativeRecoveryEnabled() ? "enabled" : "unavailable" : void 0;
58116
58135
  if (this._baseSystemPromptOptions.nativeSkillSelection !== skillPolicy) {
58117
58136
  const previousBase = this._baseSystemPrompt;
@@ -58120,12 +58139,12 @@ var AgentSession = class _AgentSession {
58120
58139
  }
58121
58140
  if (epochContext?.resourceRevision !== void 0 && getCanonicalViewUnits(messages)?.length !== messages.length)
58122
58141
  throw new Error("Current resource view requires tracked canonical context");
58123
- if (epochContext?.checkpoint && getCanonicalViewUnits(messages)?.length !== messages.length)
58142
+ if ((epochContext?.checkpoint || unbudgetedPublic) && getCanonicalViewUnits(messages)?.length !== messages.length)
58124
58143
  throw new Error("Committed context epoch cannot admit untracked transient messages");
58125
- if (epochContext && (contextEpochsEnabled || epochContext.checkpoint) && getCanonicalViewUnits(messages)?.length === messages.length) {
58144
+ if (epochContext && (contextEpochsEnabled || epochContext.checkpoint || unbudgetedPublic) && getCanonicalViewUnits(messages)?.length === messages.length) {
58126
58145
  let committed = epochContext.checkpoint;
58127
58146
  let committedEntry = epochContext.checkpointEntry;
58128
- const fixed = epochContext.mode === "off" || committed?.policyOnly === true && !contextEpochsEnabled;
58147
+ const fixed = epochContext.mode === "off" || committed?.policyOnly === true && !contextEpochsEnabled && !unbudgetedPublic;
58129
58148
  let requestContract = fixed ? retainedContextRequestContract(committed) : void 0;
58130
58149
  const nativeTail = messages.some((message2) => message2.role === "toolResult" || message2.role === "assistant" && message2.content.some((part) => part.type !== "text" || part.textSignature !== void 0));
58131
58150
  let accepted;
@@ -58145,7 +58164,7 @@ var AgentSession = class _AgentSession {
58145
58164
  if (epochContext.toolContinuations?.length && (!candidate.publicMessages || JSON.stringify(getCanonicalEpochContext(candidate.publicMessages)?.toolContinuations) !== JSON.stringify(epochContext.toolContinuations) || candidate.projection.pendingPublicMessageGroups?.length))
58146
58165
  throw new Error("Tool continuation requires its exact public candidate before epoch ACK");
58147
58166
  assertResourceCurrent(resource);
58148
- const representation = contextEpochRepresentation(candidate.request, candidate.assessment, limits.maxSourceBytes);
58167
+ const representation = contextEpochRepresentation(candidate.request, candidate.assessment, limits.maxSourceBytes, unbudgetedPublic);
58149
58168
  const replayContract = "replayContract" in candidate.projection && candidate.projection.replayContract === "message-groups" ? "message-groups" : "complete-context";
58150
58169
  const publicWindow = "publicWindow" in candidate.projection && candidate.projection.publicWindow === true;
58151
58170
  const selection = JSON.stringify([
@@ -58173,7 +58192,7 @@ var AgentSession = class _AgentSession {
58173
58192
  const prepared = prepareCanonicalEpoch(candidate.publicMessages ?? messages, candidate.selectedUnitIds, representation, limits.maxSourceBytes, replayContract, publicWindow);
58174
58193
  if (JSON.stringify(prepared.checkpoint.source) !== JSON.stringify(candidate.source))
58175
58194
  throw new Error("Context epoch candidate does not match its captured source");
58176
- const tokensBefore = candidate.originalAssessment.estimatedInputTokens;
58195
+ const tokensBefore = candidate.originalAssessment?.estimatedInputTokens ?? null;
58177
58196
  const result = {
58178
58197
  summary: "",
58179
58198
  firstKeptEntryId: prepared.checkpoint.literalTailId,
@@ -58213,7 +58232,7 @@ var AgentSession = class _AgentSession {
58213
58232
  return;
58214
58233
  if (acceptedBody === void 0 || request.body !== acceptedBody)
58215
58234
  throw new Error("Committed context epoch requires a compatible final provider projection");
58216
- if (contextEpochRepresentation(request, assessment, limits.maxSourceBytes) !== committed.representation)
58235
+ if (contextEpochRepresentation(request, assessment, limits.maxSourceBytes, unbudgetedPublic) !== committed.representation)
58217
58236
  throw new Error("Context epoch representation changed without a committed boundary");
58218
58237
  if (committed.resourceRevision !== epochContext.resourceRevision)
58219
58238
  throw new Error("Context epoch resource revision requires a committed boundary");
@@ -64567,7 +64586,7 @@ ${parsed.args}` : block;
64567
64586
  try {
64568
64587
  this._assertCompactionOwner(owner);
64569
64588
  const bootstrap = await readSessionBootstrap(owner.manager, this.settingsManager.getCanonicalContextLimits(), {
64570
- allowPendingToolPublic: this._contextEpochsEnabled,
64589
+ purpose: "read",
64571
64590
  initialContextMode: this._initialContextMode
64572
64591
  });
64573
64592
  this._assertCompactionOwner(owner);
@@ -68293,7 +68312,7 @@ ${command}` : command;
68293
68312
  if (label && !summaryText) {
68294
68313
  await this.sessionManager.appendLabelChange(targetId, label);
68295
68314
  }
68296
- const { context: sessionContext } = await readSessionBootstrap(this.sessionManager, this.settingsManager.getCanonicalContextLimits(), { allowPendingToolPublic: this._contextEpochsEnabled, initialContextMode: this._initialContextMode });
68315
+ const { context: sessionContext } = await readSessionBootstrap(this.sessionManager, this.settingsManager.getCanonicalContextLimits(), { purpose: "read", initialContextMode: this._initialContextMode });
68297
68316
  this.agent.state.messages = sessionContext.messages;
68298
68317
  this._contextOmissions = void 0;
68299
68318
  this._mergeUnpersistedOutcomes(this.agent.state.messages);
@@ -69020,7 +69039,7 @@ import { resolve as resolve15 } from "node:path";
69020
69039
  var BASE_CONTEXT_BUILD_ID_ENV = "BASE_CONTEXT_BUILD_ID";
69021
69040
  var BASE_CONTEXT_LAUNCHER_PATH_ENV = "BASE_CONTEXT_LAUNCHER_PATH";
69022
69041
  function bundledBuildId() {
69023
- return false ? void 0 : "v1.0.6";
69042
+ return false ? void 0 : "v1.0.7";
69024
69043
  }
69025
69044
  function getDaemonRuntimeIdentity(environment = process.env) {
69026
69045
  const entrypoint = process.argv[1];
@@ -5,7 +5,7 @@ import {
5
5
  isOwnedSessionWorkerProcess,
6
6
  maybeRunOwnedSessionWorkerFrontend,
7
7
  maybeStartDaemonEarly
8
- } from "./chunk-QKI6KEGP.js";
8
+ } from "./chunk-VCW3YDFF.js";
9
9
  import {
10
10
  APP_NAME
11
11
  } from "./chunk-UPVDERMD.js";
@@ -39,7 +39,7 @@ async function runCli() {
39
39
  }
40
40
  const [{ EnvHttpProxyAgent, setGlobalDispatcher }, { main }] = await Promise.all([
41
41
  import("undici"),
42
- import("./main-4GIKOHIT.js")
42
+ import("./main-XAIVH4Y7.js")
43
43
  ]);
44
44
  setGlobalDispatcher(new EnvHttpProxyAgent({ bodyTimeout: 0, headersTimeout: 0 }));
45
45
  try {
@@ -52,6 +52,6 @@ var supported = assertNodeVersion({
52
52
  exit: (code) => process.exit(code)
53
53
  });
54
54
  if (supported) {
55
- const { runCli } = await import("./cli-main-ANUJY7Y4.js");
55
+ const { runCli } = await import("./cli-main-MMHTK7EB.js");
56
56
  await runCli();
57
57
  }
@@ -17,8 +17,8 @@ import {
17
17
  shouldUseDaemonClientRuntime,
18
18
  shouldUseDaemonInteractive,
19
19
  shouldUseEphemeralSessionManagerForDaemonInteractive
20
- } from "./chunk-LIZVVGHR.js";
21
- import "./chunk-QKI6KEGP.js";
20
+ } from "./chunk-PFROC4EV.js";
21
+ import "./chunk-VCW3YDFF.js";
22
22
  import "./chunk-CFNASUYO.js";
23
23
  import "./chunk-LFPWHI42.js";
24
24
  import "./chunk-UPVDERMD.js";