@ponythewhite/base-context 1.0.5 → 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.
Files changed (42) hide show
  1. package/CHANGELOG.md +12 -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/{bundled-modules-UVCJPNFC.js → bundled-modules-PS66L3IT.js} +2 -2
  6. package/dist/bundle/{chunk-WFJRFQGG.js → chunk-PFROC4EV.js} +4 -3
  7. package/dist/bundle/{chunk-6FZM46AU.js → chunk-VCW3YDFF.js} +90 -47
  8. package/dist/bundle/{cli-main-OYVMMJUO.js → cli-main-MMHTK7EB.js} +2 -2
  9. package/dist/bundle/cli.js +1 -1
  10. package/dist/bundle/{main-AVMYOTHF.js → main-XAIVH4Y7.js} +2 -2
  11. package/dist/cli/product-doctor.d.ts.map +1 -1
  12. package/dist/cli/product-doctor.js +2 -2
  13. package/dist/cli/product-doctor.js.map +1 -1
  14. package/dist/core/agent-session.d.ts.map +1 -1
  15. package/dist/core/agent-session.js +23 -12
  16. package/dist/core/agent-session.js.map +1 -1
  17. package/dist/core/canonical-context.d.ts +3 -1
  18. package/dist/core/canonical-context.d.ts.map +1 -1
  19. package/dist/core/canonical-context.js +46 -16
  20. package/dist/core/canonical-context.js.map +1 -1
  21. package/dist/core/context-epoch-copy.d.ts.map +1 -1
  22. package/dist/core/context-epoch-copy.js +1 -1
  23. package/dist/core/context-epoch-copy.js.map +1 -1
  24. package/dist/core/context-epoch.d.ts +13 -3
  25. package/dist/core/context-epoch.d.ts.map +1 -1
  26. package/dist/core/context-epoch.js +47 -24
  27. package/dist/core/context-epoch.js.map +1 -1
  28. package/dist/core/inference-coordinator.d.ts.map +1 -1
  29. package/dist/core/inference-coordinator.js +3 -1
  30. package/dist/core/inference-coordinator.js.map +1 -1
  31. package/dist/core/request-view-selection.d.ts +3 -3
  32. package/dist/core/request-view-selection.d.ts.map +1 -1
  33. package/dist/core/request-view-selection.js +14 -7
  34. package/dist/core/request-view-selection.js.map +1 -1
  35. package/dist/core/sdk.d.ts.map +1 -1
  36. package/dist/core/sdk.js +1 -1
  37. package/dist/core/sdk.js.map +1 -1
  38. package/dist/core/session-bootstrap.d.ts +1 -0
  39. package/dist/core/session-bootstrap.d.ts.map +1 -1
  40. package/dist/core/session-bootstrap.js +1 -1
  41. package/dist/core/session-bootstrap.js.map +1 -1
  42. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
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
+
9
+ ## [1.0.6] - 2026-09-18
10
+
11
+ - Fixed automatic and manual compaction failing after native tool continuations.
12
+ - Kept pending-tool context reads available without granting provider-request permission.
13
+ - Preserved public tool facts and exact source references through summaries and subsequent requests.
14
+
3
15
  ## [1.0.5] - 2026-09-18
4
16
 
5
17
  - Displayed the built-in theme as Synerise without changing saved theme IDs, and branded the tmux startup notice as base-context.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "base-context-runtime"
3
- version = "1.0.5"
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.5"
370
+ version = "1.0.7"
371
371
  source = { editable = "." }
372
372
  dependencies = [
373
373
  { name = "mcp" },
@@ -1,5 +1,5 @@
1
1
  {
2
- "sourceCommit": "79e825d437ae8d67768558cf2a51976cd4434616",
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-WFJRFQGG.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-6FZM46AU.js";
146
+ } from "./chunk-VCW3YDFF.js";
147
147
  import "./chunk-CFNASUYO.js";
148
148
  import "./chunk-LFPWHI42.js";
149
149
  import {
@@ -18,6 +18,7 @@ import {
18
18
  CONTEXT_POLICY_EPOCH_RENDERER,
19
19
  CONTEXT_SKILL_EPOCH_RENDERER,
20
20
  CONTEXT_TOOL_EPOCH_RENDERER,
21
+ CONTEXT_TOOL_SUMMARY_RENDERER,
21
22
  CURRENT_SESSION_VERSION,
22
23
  CURSOR_MARKER,
23
24
  CombinedAutocompleteProvider,
@@ -347,7 +348,7 @@ import {
347
348
  watchWithErrorHandler,
348
349
  workerRosterEntryFromSummary,
349
350
  wrapTextWithAnsi
350
- } from "./chunk-6FZM46AU.js";
351
+ } from "./chunk-VCW3YDFF.js";
351
352
  import {
352
353
  array,
353
354
  boolean,
@@ -17577,7 +17578,7 @@ function getProductDiagnostics() {
17577
17578
  daemon: DAEMON_PROTOCOL_INFO,
17578
17579
  daemonSchema: DAEMON_SCHEMA_ID,
17579
17580
  session: CURRENT_SESSION_VERSION,
17580
- nativeContext: `${CONTEXT_EPOCH_RENDERER} (request), ${CONTEXT_POLICY_EPOCH_RENDERER} (policy), ${CONTEXT_TOOL_EPOCH_RENDERER} (tool continuation), ${CONTEXT_SKILL_EPOCH_RENDERER} (selected skills)`
17581
+ nativeContext: `${CONTEXT_EPOCH_RENDERER} (request), ${CONTEXT_POLICY_EPOCH_RENDERER} (policy), ${CONTEXT_TOOL_EPOCH_RENDERER} (tool continuation), ${CONTEXT_SKILL_EPOCH_RENDERER} (selected skills), ${CONTEXT_TOOL_SUMMARY_RENDERER} (tool summary)`
17581
17582
  },
17582
17583
  paths: {
17583
17584
  ...paths,
@@ -23288,7 +23289,7 @@ async function createAgentSession(options = {}) {
23288
23289
  time("resourceLoader.reload");
23289
23290
  }
23290
23291
  const { context: existingSession, hasExistingSession, hasThinkingEntry, hasServiceTierEntry } = await readSessionBootstrap(sessionManager, settingsManager.getCanonicalContextLimits(), {
23291
- allowPendingToolPublic: options.requestTokenBudget !== void 0,
23292
+ purpose: "read",
23292
23293
  initialContextMode: contextMode ?? settingsManager.getContextMode()
23293
23294
  });
23294
23295
  let model = options.model ?? void 0;
@@ -27719,8 +27719,9 @@ var CONTEXT_EPOCH_RENDERER = "native-canonical-epoch/4";
27719
27719
  var CONTEXT_POLICY_EPOCH_RENDERER = "native-canonical-epoch/5";
27720
27720
  var CONTEXT_TOOL_EPOCH_RENDERER = "native-canonical-epoch/6";
27721
27721
  var CONTEXT_SKILL_EPOCH_RENDERER = "native-canonical-epoch/7";
27722
+ var CONTEXT_TOOL_SUMMARY_RENDERER = "native-canonical-epoch/8";
27722
27723
  function contextEpochMode(checkpoint, initial = "on") {
27723
- return checkpoint ? checkpoint.version === 5 ? checkpoint.mode : "on" : initial;
27724
+ return checkpoint ? checkpoint.version === 5 || checkpoint.version === 8 ? checkpoint.mode : "on" : initial;
27724
27725
  }
27725
27726
  function isRequestContract(value) {
27726
27727
  if (!value || typeof value !== "object")
@@ -27767,13 +27768,14 @@ function readContextEpoch(details, maxBytes) {
27767
27768
  if (!details || typeof details !== "object" || !(CONTEXT_EPOCH_DETAIL in details))
27768
27769
  return;
27769
27770
  const value = details[CONTEXT_EPOCH_DETAIL];
27770
- if (!value || typeof value !== "object" || !("version" in value) || !("renderer" in value) || !(value.version === 1 && value.renderer === "native-canonical-epoch/1" || value.version === 2 && value.renderer === "native-canonical-epoch/2" || value.version === 3 && value.renderer === "native-canonical-epoch/3" || value.version === 4 && value.renderer === "native-canonical-epoch/4" || value.version === 5 && value.renderer === CONTEXT_POLICY_EPOCH_RENDERER || value.version === 6 && value.renderer === CONTEXT_TOOL_EPOCH_RENDERER || [4, 5, 6].includes(value.version) && value.renderer === CONTEXT_SKILL_EPOCH_RENDERER) || (value.renderer === CONTEXT_SKILL_EPOCH_RENDERER ? !("selectedSkills" in value) || !Array.isArray(value.selectedSkills) || value.selectedSkills.length === 0 || value.selectedSkills.some((item) => !item || typeof item.name !== "string" || !item.view || !["custom_message", "custom"].includes(item.view.ref?.kind) || typeof item.view.sourceRevision !== "string") || new Set(value.selectedSkills.map((item) => item.name)).size !== value.selectedSkills.length : "selectedSkills" in value) || !("source" in value) || !value.source || !("views" in value) || !Array.isArray(value.views) || !("literalTailId" in value) || typeof value.literalTailId !== "string" || !("representation" in value) || (value.version === 5 ? !("mode" in value) || value.mode !== "on" && value.mode !== "off" : "mode" in value) || value.version === 5 && (value.representation !== null || !("policyOnly" in value) || value.policyOnly !== true) || "policyOnly" in value && (value.version !== 5 || value.policyOnly !== true || value.representation !== null || "includeSummary" in value) || "pendingRequestContract" in value && (value.version !== 5 || !("mode" in value) || value.mode !== "off" || value.pendingRequestContract !== true || "requestContract" in value) || "requestContract" in value && (value.version !== 5 || !isRequestContract(value.requestContract)) || !(typeof value.representation === "string" || value.version === 5 && value.representation === null && "policyOnly" in value && value.policyOnly === true || (value.version === 2 || value.version === 3 || value.version === 4) && value.representation === null && "includeSummary" in value && value.includeSummary === true) || "includeSummary" in value && (value.version !== 2 && value.version !== 3 && value.version !== 4 || value.includeSummary !== true || value.representation !== null) || "replayContract" in value && value.replayContract !== "complete-context" && value.replayContract !== "message-groups" || "resourceRevision" in value && (typeof value.resourceRevision !== "string" || Buffer.byteLength(value.resourceRevision, "utf8") > MAX_RESOURCE_REVISION_BYTES) || "publicWindow" in value && (value.version !== 3 && value.version !== 4 && value.version !== 5 && value.version !== 6 || value.publicWindow !== true) || "toolContinuations" in value && value.version !== 6 || value.version === 6 && (!("toolContinuations" in value) || !Array.isArray(value.toolContinuations) || !value.toolContinuations.length || !("publicWindow" in value) || value.publicWindow !== true || !("replayContract" in value) || value.replayContract !== "message-groups") || "continuation" in value && (value.version !== 3 && value.version !== 4 && value.version !== 5 && value.version !== 6 || !value.continuation || typeof value.continuation !== "object" || !("kind" in value.continuation) || value.continuation.kind !== "harness-summary" && (value.version !== 4 && value.version !== 5 && value.version !== 6 || value.continuation.kind !== "portable-checkpoint") || !("publicTailThrough" in value.continuation) || !value.continuation.publicTailThrough))
27771
+ if (!value || typeof value !== "object" || !("version" in value) || !("renderer" in value) || !(value.version === 1 && value.renderer === "native-canonical-epoch/1" || value.version === 2 && value.renderer === "native-canonical-epoch/2" || value.version === 3 && value.renderer === "native-canonical-epoch/3" || value.version === 4 && value.renderer === "native-canonical-epoch/4" || value.version === 5 && value.renderer === CONTEXT_POLICY_EPOCH_RENDERER || value.version === 6 && value.renderer === CONTEXT_TOOL_EPOCH_RENDERER || value.version === 8 && value.renderer === CONTEXT_TOOL_SUMMARY_RENDERER || [4, 5, 6].includes(value.version) && value.renderer === CONTEXT_SKILL_EPOCH_RENDERER) || (value.renderer === CONTEXT_SKILL_EPOCH_RENDERER || value.version === 8 && "selectedSkills" in value ? !("selectedSkills" in value) || !Array.isArray(value.selectedSkills) || value.selectedSkills.length === 0 || value.selectedSkills.some((item) => !item || typeof item.name !== "string" || !item.view || !["custom_message", "custom"].includes(item.view.ref?.kind) || typeof item.view.sourceRevision !== "string") || new Set(value.selectedSkills.map((item) => item.name)).size !== value.selectedSkills.length : "selectedSkills" in value) || !("source" in value) || !value.source || !("views" in value) || !Array.isArray(value.views) || !("literalTailId" in value) || typeof value.literalTailId !== "string" || !("representation" in value) || (value.version === 5 || value.version === 8 ? !("mode" in value) || value.mode !== "on" && value.mode !== "off" : "mode" in value) || value.version === 8 && (value.representation !== null || !("includeSummary" in value) || value.includeSummary !== true) || value.version === 5 && (value.representation !== null || !("policyOnly" in value) || value.policyOnly !== true) || "policyOnly" in value && (value.version !== 5 || value.policyOnly !== true || value.representation !== null || "includeSummary" in value) || "pendingRequestContract" in value && (value.version !== 5 || !("mode" in value) || value.mode !== "off" || value.pendingRequestContract !== true || "requestContract" in value) || "requestContract" in value && (value.version !== 5 || !isRequestContract(value.requestContract)) || !(typeof value.representation === "string" || value.version === 5 && value.representation === null && "policyOnly" in value && value.policyOnly === true || (value.version === 2 || value.version === 3 || value.version === 4 || value.version === 8) && value.representation === null && "includeSummary" in value && value.includeSummary === true) || "includeSummary" in value && (value.version !== 2 && value.version !== 3 && value.version !== 4 && value.version !== 8 || value.includeSummary !== true || value.representation !== null) || "replayContract" in value && value.replayContract !== "complete-context" && value.replayContract !== "message-groups" || "resourceRevision" in value && (typeof value.resourceRevision !== "string" || Buffer.byteLength(value.resourceRevision, "utf8") > MAX_RESOURCE_REVISION_BYTES) || "publicWindow" in value && (value.version !== 3 && value.version !== 4 && value.version !== 5 && value.version !== 6 && value.version !== 8 || value.publicWindow !== true) || "toolContinuations" in value && value.version !== 6 && value.version !== 8 || (value.version === 6 || value.version === 8) && (!("toolContinuations" in value) || !Array.isArray(value.toolContinuations) || !value.toolContinuations.length || !("replayContract" in value) || value.version === 6 && (!("publicWindow" in value) || value.publicWindow !== true || value.replayContract !== "message-groups")) || "continuation" in value && (value.version !== 3 && value.version !== 4 && value.version !== 5 && value.version !== 6 && value.version !== 8 || !value.continuation || typeof value.continuation !== "object" || !("kind" in value.continuation) || value.continuation.kind !== "harness-summary" && (value.version !== 4 && value.version !== 5 && value.version !== 6 || value.continuation.kind !== "portable-checkpoint") || !("publicTailThrough" in value.continuation) || !value.continuation.publicTailThrough))
27771
27772
  throw new Error("Invalid committed context epoch");
27772
27773
  return snapshotContextEpoch(value, maxBytes);
27773
27774
  }
27774
- function contextEpochRepresentation(request, assessment, maxBytes) {
27775
- 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)
27776
27777
  throw new Error("Committed context epoch requires its explicit request profile");
27778
+ const identity = assessment ?? contextRequestContract(request, "message-groups");
27777
27779
  const body = JSON.parse(request.body);
27778
27780
  if (!body || typeof body !== "object" || Array.isArray(body))
27779
27781
  throw new Error("Context epoch request representation is unavailable");
@@ -27799,7 +27801,7 @@ function contextEpochRepresentation(request, assessment, maxBytes) {
27799
27801
  "prompt_cache_retention",
27800
27802
  "stream_options"
27801
27803
  ]);
27802
- 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) {
27803
27805
  fields.add("thinking");
27804
27806
  fields.add("reasoning_effort");
27805
27807
  }
@@ -27818,11 +27820,13 @@ function contextEpochRepresentation(request, assessment, maxBytes) {
27818
27820
  renderer: CONTEXT_EPOCH_RENDERER,
27819
27821
  api: request.api,
27820
27822
  provider: request.provider,
27821
- route: assessment.route,
27822
- model: assessment.model,
27823
- profile: assessment.profile,
27824
- contextTokens: assessment.contextTokens,
27825
- 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" },
27826
27830
  configuration,
27827
27831
  policy
27828
27832
  }, maxBytes);
@@ -31155,6 +31159,11 @@ function captureCanonicalRequestMessages(messages) {
31155
31159
  return captured;
31156
31160
  }
31157
31161
  function prepareToolContinuationWindow(messages) {
31162
+ if (compiledEpochContexts.get(messages)?.readOnly)
31163
+ throw new Error("Read-only context cannot authorize a provider epoch");
31164
+ return renderToolContinuationWindow(messages);
31165
+ }
31166
+ function renderToolContinuationWindow(messages) {
31158
31167
  const captured = captureCanonicalRequestMessages(messages);
31159
31168
  const views = compiledViewUnits.get(captured);
31160
31169
  const epoch = compiledEpochContexts.get(captured);
@@ -31186,7 +31195,8 @@ function prepareToolContinuationWindow(messages) {
31186
31195
  }
31187
31196
  }
31188
31197
  stringifyBoundedJson(captured, maxBytes);
31189
- const publicUnits = views.units.map((unit, index) => ({
31198
+ const units = epoch.readOnly ? bindMessageReplayUnits(captured, views.selection.units, views.selection.limits, "message-groups", groups) : views.units;
31199
+ const publicUnits = units.map((unit, index) => ({
31190
31200
  ...unit,
31191
31201
  sourceRevision: renderedGroups.has(index) ? JSON.stringify([unit.sourceRevision, PUBLIC_TOOL_CONTINUATION_RENDERER, renderedGroups.get(index)]) : unit.sourceRevision,
31192
31202
  unavailableDependencies: unit.unavailableDependencies?.filter((id) => !markers.has(id))
@@ -31306,6 +31316,8 @@ function prepareCanonicalEpoch(messages, selectedUnitIds, representation, maxByt
31306
31316
  const units = getCanonicalViewUnits(messages);
31307
31317
  if (!context || !units || units.length !== messages.length || context.references.length !== messages.length)
31308
31318
  throw new Error("Context epoch requires its captured compiler output");
31319
+ if (context.readOnly)
31320
+ throw new Error("Read-only context cannot authorize a provider epoch");
31309
31321
  if (compiledViewUnits.get(messages)?.selection.pendingPublicMessageGroups?.length)
31310
31322
  throw new Error("Tool continuation requires its accepted public representation");
31311
31323
  if (context.toolContinuations?.length && (!publicWindow || replayContract !== "message-groups"))
@@ -31361,8 +31373,8 @@ function canonicalRecoveryBoundary(messages) {
31361
31373
  const units = getCanonicalViewUnits(messages);
31362
31374
  if (!context || !units)
31363
31375
  throw new Error("Recovery compaction requires captured canonical views");
31364
- if (context.toolContinuations?.length)
31365
- throw new Error("Tool continuation cannot enter an older recovery summary recipe");
31376
+ if (context.toolContinuations?.length && !context.readOnly)
31377
+ throw new Error("Tool continuation summary requires its captured public read view");
31366
31378
  const recoveries = units.flatMap((unit, index) => unit.kind === "recovery" ? [context.references[index]] : []);
31367
31379
  if (!recoveries.length)
31368
31380
  return;
@@ -31375,7 +31387,7 @@ function prepareRecoveryCompaction(messages, firstKeptEntryId, maxBytes) {
31375
31387
  const boundary = canonicalRecoveryBoundary(messages);
31376
31388
  const context = compiledEpochContexts.get(messages);
31377
31389
  const publicWindow = context?.checkpoint?.publicWindow === true && context.checkpoint.replayContract === "message-groups";
31378
- if (!boundary && !publicWindow && !context?.selectedSkills?.length)
31390
+ if (!boundary && !publicWindow && !context?.selectedSkills?.length && !context?.toolContinuations?.length)
31379
31391
  return;
31380
31392
  if (!context)
31381
31393
  throw new Error("Recovery compaction requires captured canonical views");
@@ -31386,7 +31398,8 @@ function prepareRecoveryCompaction(messages, firstKeptEntryId, maxBytes) {
31386
31398
  throw new Error("Recovery compaction must retain its unmeasured literal tail");
31387
31399
  const units = bindMessageReplayUnits(messages, selection.units, selection.limits, "message-groups");
31388
31400
  closeViewSelection(units, units.map((unit) => unit.id), selection.limits);
31389
- const roots = units.filter((unit) => unit.kind === "recovery").map((unit) => unit.id);
31401
+ const toolGroups = new Set(context.toolContinuations?.map((group) => group.assistantEntryId));
31402
+ const roots = units.filter((unit, index) => unit.kind === "recovery" || toolGroups.has(context.references[index]?.ref.entryId ?? "")).map((unit) => unit.id);
31390
31403
  const closed = new Set(closeViewSelection(units, roots, selection.limits).map((unit) => unit.id));
31391
31404
  let renderedBytes = 0;
31392
31405
  const views = context.references.flatMap((reference, index) => {
@@ -31406,15 +31419,17 @@ function prepareRecoveryCompaction(messages, firstKeptEntryId, maxBytes) {
31406
31419
  }
31407
31420
  ] : [];
31408
31421
  });
31409
- if (!views.length && !publicWindow && !context.selectedSkills?.length)
31422
+ if (!views.length && !publicWindow && !context.selectedSkills?.length && !toolGroups.size)
31410
31423
  return;
31411
31424
  return snapshotContextEpoch({
31412
- version: 4,
31413
- renderer: context.selectedSkills?.length ? CONTEXT_SKILL_EPOCH_RENDERER : CONTEXT_EPOCH_RENDERER,
31425
+ ...toolGroups.size ? { version: 8, mode: context.mode } : { version: 4 },
31426
+ renderer: toolGroups.size ? CONTEXT_TOOL_SUMMARY_RENDERER : context.selectedSkills?.length ? CONTEXT_SKILL_EPOCH_RENDERER : CONTEXT_EPOCH_RENDERER,
31427
+ ...toolGroups.size ? { toolContinuations: context.toolContinuations } : {},
31414
31428
  ...context.selectedSkills?.length ? { selectedSkills: context.selectedSkills } : {},
31415
31429
  source: context.source,
31416
31430
  representation: null,
31417
31431
  includeSummary: true,
31432
+ ...toolGroups.size && publicWindow ? { publicWindow: true } : {},
31418
31433
  replayContract: boundary || publicWindow ? "message-groups" : context.checkpoint?.replayContract ?? "complete-context",
31419
31434
  ...publicWindow ? {
31420
31435
  continuation: {
@@ -31438,7 +31453,7 @@ var CanonicalContextCompiler = class {
31438
31453
  hasActiveEntry(entryId) {
31439
31454
  return this.entries.has(entryId);
31440
31455
  }
31441
- async compile(view, limits, omittedAssistantIds = /* @__PURE__ */ new Set(), frameOptions = {}, resourceCapture, initialContextMode = "on", allowPendingToolPublic = false) {
31456
+ async compile(view, limits, omittedAssistantIds = /* @__PURE__ */ new Set(), frameOptions = {}, resourceCapture, initialContextMode = "on", allowPendingToolPublic = false, purpose = "request") {
31442
31457
  const frameLimits = taskFrameLimits(frameOptions);
31443
31458
  const previousSource = this.source;
31444
31459
  const previousFrame = this.taskFrame;
@@ -31545,6 +31560,10 @@ var CanonicalContextCompiler = class {
31545
31560
  if (!actual || actual.kind !== skill.view.ref.kind || !["custom_message", "custom"].includes(actual.kind) || actual.qualification !== "native-recovery" || actual.revision !== skill.view.ref.revision || actual.sequence !== skill.view.ref.sequence || JSON.stringify(actual.locator) !== JSON.stringify(skill.view.ref.locator) || skill.view.sourceRevision !== JSON.stringify([actual.revision]))
31546
31561
  throw new Error("Selected skill epoch source is unavailable");
31547
31562
  }
31563
+ const toolSourceIds = new Set(checkpoint?.toolContinuations?.flatMap((group) => [
31564
+ group.assistantEntryId,
31565
+ ...group.calls.flatMap((call) => call.result ? [call.result.id] : [])
31566
+ ]));
31548
31567
  const publicTail = checkpoint?.continuation?.publicTailThrough;
31549
31568
  if (publicTail) {
31550
31569
  if (!view.atSnapshot)
@@ -31690,7 +31709,7 @@ var CanonicalContextCompiler = class {
31690
31709
  appendSentAgentMessageToToolResult(message2, message2.toolCallId, sent.message);
31691
31710
  }
31692
31711
  }
31693
- const publicHistory = pinned?.rendering === PUBLIC_CONTEXT_RENDERER || !pinned && publicTail !== void 0 && ref.sequence <= publicTail.sourceSequence;
31712
+ const publicHistory = !toolSourceIds.has(ref.entryId) && (pinned?.rendering === PUBLIC_CONTEXT_RENDERER || !pinned && publicTail !== void 0 && ref.sequence <= publicTail.sourceSequence);
31694
31713
  const rendered = publicHistory ? renderPublicHistory(message2, ref.entryId, maxSourceBytes) : message2;
31695
31714
  if (publicHistory) {
31696
31715
  publicBytes += Buffer.byteLength(JSON.stringify(rendered), "utf8");
@@ -31730,7 +31749,7 @@ var CanonicalContextCompiler = class {
31730
31749
  const prefixViews = /* @__PURE__ */ new Map();
31731
31750
  const seen = /* @__PURE__ */ new Set();
31732
31751
  for (const pinned of checkpoint.views) {
31733
- if (pinned.rendering !== void 0 && ((pinned.rendering === PUBLIC_TOOL_CONTINUATION_RENDERER ? checkpoint.version !== 6 : pinned.rendering !== PUBLIC_CONTEXT_RENDERER || checkpoint.version !== 3 && checkpoint.version !== 4 && checkpoint.version !== 5 && checkpoint.version !== 6) || pinned.ref.kind === "compaction"))
31752
+ if (pinned.rendering !== void 0 && ((pinned.rendering === PUBLIC_TOOL_CONTINUATION_RENDERER ? checkpoint.version !== 6 && checkpoint.version !== 8 : pinned.rendering !== PUBLIC_CONTEXT_RENDERER || checkpoint.version !== 3 && checkpoint.version !== 4 && checkpoint.version !== 5 && checkpoint.version !== 6 && checkpoint.version !== 8) || pinned.ref.kind === "compaction"))
31734
31753
  throw new Error("Unsupported context epoch view rendering");
31735
31754
  if (seen.has(pinned.ref.entryId) || refs.some((ref) => ref.entryId === pinned.ref.entryId))
31736
31755
  throw new Error("Context epoch view overlaps its literal tail");
@@ -31893,7 +31912,7 @@ ${JSON.stringify(selections.map((skill) => ({
31893
31912
  });
31894
31913
  if (frozenGroups.length !== candidates.filter((candidate) => candidate.prior).length)
31895
31914
  throw new Error("Committed tool continuation lost its original group");
31896
- if (candidates.length && (!allowPendingToolPublic || mode === "off"))
31915
+ if (purpose === "request" && candidates.length && (!allowPendingToolPublic || mode === "off"))
31897
31916
  throw new Error("Tool continuation requires an enabled native public request boundary");
31898
31917
  const readToolEvidence = async (metadata) => {
31899
31918
  const cached = next.get(metadata.id);
@@ -32029,6 +32048,7 @@ ${JSON.stringify(selections.map((skill) => ({
32029
32048
  }
32030
32049
  });
32031
32050
  compiledEpochContexts.set(closedMessages, {
32051
+ ...purpose === "read" ? { readOnly: true } : {},
32032
32052
  mode,
32033
32053
  source: { ...view.source },
32034
32054
  checkpoint,
@@ -32045,7 +32065,7 @@ ${JSON.stringify(selections.map((skill) => ({
32045
32065
  this.source = view.source;
32046
32066
  this.sourceBytes = sourceBytes;
32047
32067
  this.messageCount = messageCount;
32048
- return closedMessages;
32068
+ return purpose === "read" && pendingPublicMessageGroups.length ? renderToolContinuationWindow(closedMessages).messages : closedMessages;
32049
32069
  }
32050
32070
  };
32051
32071
 
@@ -32142,9 +32162,11 @@ async function prepareFixedRequestView(boundary, request, projection, assessment
32142
32162
  }
32143
32163
  async function selectRequestView(boundary, request, projection, budget, allowShrink) {
32144
32164
  projection = canonicalRequestProjection(boundary, projection);
32145
- const full = budget.measure(request);
32165
+ const full = budget?.measure(request);
32146
32166
  const inputKey = requestInputKey(request, projection);
32147
- if (full.limitSource !== "explicit-profile" || !inputKey)
32167
+ if (budget && full?.limitSource !== "explicit-profile" || !inputKey)
32168
+ return;
32169
+ if (!budget && !boundary.pendingPublicMessageGroups?.length)
32148
32170
  return;
32149
32171
  const payload = JSON.parse(request.body);
32150
32172
  const input = payload[inputKey];
@@ -32183,16 +32205,20 @@ async function selectRequestView(boundary, request, projection, budget, allowShr
32183
32205
  const publicSource = getCanonicalViewSelectionSource(publicView.messages);
32184
32206
  const publicUnits = bindMessageReplayUnits(publicView.messages, publicSource.units, boundary.limits, replayContract);
32185
32207
  const closed = closeViewSelection(publicUnits, publicUnits.map((unit) => unit.id), boundary.limits);
32186
- const assessment = budget.measure(encoded.request);
32187
- if (assessment.status === "over-budget")
32188
- throw new PublicContextBudgetError(boundary.source, assessment, full);
32189
- if (assessment.status !== "within-estimate")
32190
- 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
+ }
32191
32215
  await offer(closed.map((unit) => unit.id), encoded.request, encoded.projection, assessment, publicView.messages);
32192
32216
  return encoded.request.body;
32193
32217
  }
32194
32218
  if (projection.pendingPublicMessageGroups?.length)
32195
32219
  throw new Error("Adapter pending group has no original owned source plan");
32220
+ if (!budget || !full)
32221
+ return;
32196
32222
  const offerPublicWindow = async () => {
32197
32223
  if (!allowShrink || replayContract !== "message-groups" || !projection.publicWindow || !projection.encodePublicWindow)
32198
32224
  return;
@@ -33067,8 +33093,8 @@ var InferenceCoordinator = class _InferenceCoordinator {
33067
33093
  throw error;
33068
33094
  }
33069
33095
  } : void 0;
33070
- const canSelect = (budget || boundary?.fixedPrepare) && boundary && matchesRequestView(boundary, source, context);
33071
33096
  const requiredPublic = Boolean(boundary?.pendingPublicMessageGroups?.length);
33097
+ const canSelect = (budget || boundary?.fixedPrepare || requiredPublic) && boundary && matchesRequestView(boundary, source, context);
33072
33098
  if (requiredPublic && (!canSelect || boundary?.fixedPrepare))
33073
33099
  throw new Error("Tool continuation requires a selectable native public request boundary");
33074
33100
  let publicAccepted = false;
@@ -34150,7 +34176,7 @@ async function rebuildCopiedContextEpoch(history, copied, limits) {
34150
34176
  if (origin?.qualification !== "native-context-epoch" || hydrated.source.qualification !== "native-context-epoch")
34151
34177
  throw new Error("Copied context epoch has no qualified source");
34152
34178
  const checkpoint = readContextEpoch(entry.details, limits.maxSourceBytes);
34153
- if (checkpoint?.version === 6)
34179
+ if (checkpoint?.version === 6 || checkpoint?.version === 8)
34154
34180
  throw new Error("Tool continuation recipes require their original native execution source");
34155
34181
  if (!checkpoint || checkpoint.literalTailId !== entry.firstKeptEntryId || !view.atSnapshot)
34156
34182
  throw new Error("Copied context epoch boundary is unavailable");
@@ -38968,7 +38994,7 @@ async function readSessionBootstrap(sessionManager, limits, options = {}) {
38968
38994
  restoreBootstrapSetting(context, hydrated.entry);
38969
38995
  }
38970
38996
  if (includeMessages)
38971
- context.messages = await new CanonicalContextCompiler().compile(view.branchContext, limits, void 0, {}, void 0, options.initialContextMode ?? "on", options.allowPendingToolPublic);
38997
+ context.messages = await new CanonicalContextCompiler().compile(view.branchContext, limits, void 0, {}, void 0, options.initialContextMode ?? "on", options.allowPendingToolPublic, options.purpose);
38972
38998
  return {
38973
38999
  context,
38974
39000
  hasExistingSession: bootstrap.hasContextMessages,
@@ -44725,7 +44751,7 @@ async function loadExtensionModule(extensionPath) {
44725
44751
  // (file-path aliases would load a second, divergent copy of each package).
44726
44752
  // Also disable tryNative so jiti handles ALL imports (not just the entry point)
44727
44753
  // Node/dev must also share the native AI registry and implementation identities.
44728
- ...isBunBinary || isBundledCli ? { virtualModules: (await import("./bundled-modules-UVCJPNFC.js")).VIRTUAL_MODULES, tryNative: false } : {
44754
+ ...isBunBinary || isBundledCli ? { virtualModules: (await import("./bundled-modules-PS66L3IT.js")).VIRTUAL_MODULES, tryNative: false } : {
44729
44755
  alias: getAliases(),
44730
44756
  virtualModules: {
44731
44757
  "@ponythewhite/base-context-ai": src_exports,
@@ -58080,7 +58106,16 @@ var AgentSession = class _AgentSession {
58080
58106
  try {
58081
58107
  const messages = await captured.readHistory(async (view) => {
58082
58108
  const sameSource = controls?.sessionId === view.source.sessionId && controls?.sessionFile === view.source.sessionFile;
58083
- 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
+ );
58084
58119
  if (sameSource && this._contextOmissions === controls) {
58085
58120
  for (const id of omitted)
58086
58121
  if (!this._contextCompiler.hasActiveEntry(id))
@@ -58094,7 +58129,8 @@ var AgentSession = class _AgentSession {
58094
58129
  const epochContext = getCanonicalEpochContext(messages);
58095
58130
  if (epochContext)
58096
58131
  this._contextMode = epochContext.mode;
58097
- const nativeSkills = Boolean(contextEpochsEnabled || epochContext?.checkpoint);
58132
+ const unbudgetedPublic = !contextEpochsEnabled && Boolean(epochContext?.toolContinuations?.length);
58133
+ const nativeSkills = Boolean(contextEpochsEnabled || epochContext?.checkpoint || unbudgetedPublic);
58098
58134
  const skillPolicy = nativeSkills ? this._nativeRecoveryEnabled() ? "enabled" : "unavailable" : void 0;
58099
58135
  if (this._baseSystemPromptOptions.nativeSkillSelection !== skillPolicy) {
58100
58136
  const previousBase = this._baseSystemPrompt;
@@ -58103,12 +58139,12 @@ var AgentSession = class _AgentSession {
58103
58139
  }
58104
58140
  if (epochContext?.resourceRevision !== void 0 && getCanonicalViewUnits(messages)?.length !== messages.length)
58105
58141
  throw new Error("Current resource view requires tracked canonical context");
58106
- if (epochContext?.checkpoint && getCanonicalViewUnits(messages)?.length !== messages.length)
58142
+ if ((epochContext?.checkpoint || unbudgetedPublic) && getCanonicalViewUnits(messages)?.length !== messages.length)
58107
58143
  throw new Error("Committed context epoch cannot admit untracked transient messages");
58108
- if (epochContext && (contextEpochsEnabled || epochContext.checkpoint) && getCanonicalViewUnits(messages)?.length === messages.length) {
58144
+ if (epochContext && (contextEpochsEnabled || epochContext.checkpoint || unbudgetedPublic) && getCanonicalViewUnits(messages)?.length === messages.length) {
58109
58145
  let committed = epochContext.checkpoint;
58110
58146
  let committedEntry = epochContext.checkpointEntry;
58111
- const fixed = epochContext.mode === "off" || committed?.policyOnly === true && !contextEpochsEnabled;
58147
+ const fixed = epochContext.mode === "off" || committed?.policyOnly === true && !contextEpochsEnabled && !unbudgetedPublic;
58112
58148
  let requestContract = fixed ? retainedContextRequestContract(committed) : void 0;
58113
58149
  const nativeTail = messages.some((message2) => message2.role === "toolResult" || message2.role === "assistant" && message2.content.some((part) => part.type !== "text" || part.textSignature !== void 0));
58114
58150
  let accepted;
@@ -58128,7 +58164,7 @@ var AgentSession = class _AgentSession {
58128
58164
  if (epochContext.toolContinuations?.length && (!candidate.publicMessages || JSON.stringify(getCanonicalEpochContext(candidate.publicMessages)?.toolContinuations) !== JSON.stringify(epochContext.toolContinuations) || candidate.projection.pendingPublicMessageGroups?.length))
58129
58165
  throw new Error("Tool continuation requires its exact public candidate before epoch ACK");
58130
58166
  assertResourceCurrent(resource);
58131
- const representation = contextEpochRepresentation(candidate.request, candidate.assessment, limits.maxSourceBytes);
58167
+ const representation = contextEpochRepresentation(candidate.request, candidate.assessment, limits.maxSourceBytes, unbudgetedPublic);
58132
58168
  const replayContract = "replayContract" in candidate.projection && candidate.projection.replayContract === "message-groups" ? "message-groups" : "complete-context";
58133
58169
  const publicWindow = "publicWindow" in candidate.projection && candidate.projection.publicWindow === true;
58134
58170
  const selection = JSON.stringify([
@@ -58156,7 +58192,7 @@ var AgentSession = class _AgentSession {
58156
58192
  const prepared = prepareCanonicalEpoch(candidate.publicMessages ?? messages, candidate.selectedUnitIds, representation, limits.maxSourceBytes, replayContract, publicWindow);
58157
58193
  if (JSON.stringify(prepared.checkpoint.source) !== JSON.stringify(candidate.source))
58158
58194
  throw new Error("Context epoch candidate does not match its captured source");
58159
- const tokensBefore = candidate.originalAssessment.estimatedInputTokens;
58195
+ const tokensBefore = candidate.originalAssessment?.estimatedInputTokens ?? null;
58160
58196
  const result = {
58161
58197
  summary: "",
58162
58198
  firstKeptEntryId: prepared.checkpoint.literalTailId,
@@ -58196,7 +58232,7 @@ var AgentSession = class _AgentSession {
58196
58232
  return;
58197
58233
  if (acceptedBody === void 0 || request.body !== acceptedBody)
58198
58234
  throw new Error("Committed context epoch requires a compatible final provider projection");
58199
- if (contextEpochRepresentation(request, assessment, limits.maxSourceBytes) !== committed.representation)
58235
+ if (contextEpochRepresentation(request, assessment, limits.maxSourceBytes, unbudgetedPublic) !== committed.representation)
58200
58236
  throw new Error("Context epoch representation changed without a committed boundary");
58201
58237
  if (committed.resourceRevision !== epochContext.resourceRevision)
58202
58238
  throw new Error("Context epoch resource revision requires a committed boundary");
@@ -61530,7 +61566,10 @@ var AgentSession = class _AgentSession {
61530
61566
  }
61531
61567
  const limits = this.settingsManager.getCanonicalContextLimits();
61532
61568
  const outcomes = structuredClone(this._unpersistedOutcomes);
61533
- const { context } = await readSessionBootstrap(this.sessionManager, limits);
61569
+ const { context } = await readSessionBootstrap(this.sessionManager, limits, {
61570
+ initialContextMode: this._initialContextMode,
61571
+ purpose: "read"
61572
+ });
61534
61573
  this._mergeUnpersistedOutcomes(context.messages, outcomes);
61535
61574
  if (context.messages.length > limits.maxMessages)
61536
61575
  throw new Error("Canonical context message budget exceeded");
@@ -64402,7 +64441,7 @@ ${parsed.args}` : block;
64402
64441
  maxSourceBytes: limits.maxSourceBytes
64403
64442
  };
64404
64443
  return requests.readHistory(async (view) => {
64405
- const messages = await new CanonicalContextCompiler().compile(view, limits, void 0, {}, resource);
64444
+ const messages = await new CanonicalContextCompiler().compile(view, limits, void 0, {}, resource, this._initialContextMode, false, "read");
64406
64445
  this._assertCompactionOwner(owner);
64407
64446
  const context = getCanonicalEpochContext(messages);
64408
64447
  if (context.checkpoint?.includeSummary && pathEntries.at(-1)?.type === "compaction")
@@ -64546,7 +64585,10 @@ ${parsed.args}` : block;
64546
64585
  }
64547
64586
  try {
64548
64587
  this._assertCompactionOwner(owner);
64549
- const bootstrap = await readSessionBootstrap(owner.manager, this.settingsManager.getCanonicalContextLimits());
64588
+ const bootstrap = await readSessionBootstrap(owner.manager, this.settingsManager.getCanonicalContextLimits(), {
64589
+ purpose: "read",
64590
+ initialContextMode: this._initialContextMode
64591
+ });
64550
64592
  this._assertCompactionOwner(owner);
64551
64593
  owner.agent.state.messages = bootstrap.context.messages;
64552
64594
  this._contextOmissions = void 0;
@@ -68270,7 +68312,7 @@ ${command}` : command;
68270
68312
  if (label && !summaryText) {
68271
68313
  await this.sessionManager.appendLabelChange(targetId, label);
68272
68314
  }
68273
- 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 });
68274
68316
  this.agent.state.messages = sessionContext.messages;
68275
68317
  this._contextOmissions = void 0;
68276
68318
  this._mergeUnpersistedOutcomes(this.agent.state.messages);
@@ -68997,7 +69039,7 @@ import { resolve as resolve15 } from "node:path";
68997
69039
  var BASE_CONTEXT_BUILD_ID_ENV = "BASE_CONTEXT_BUILD_ID";
68998
69040
  var BASE_CONTEXT_LAUNCHER_PATH_ENV = "BASE_CONTEXT_LAUNCHER_PATH";
68999
69041
  function bundledBuildId() {
69000
- return false ? void 0 : "v1.0.5";
69042
+ return false ? void 0 : "v1.0.7";
69001
69043
  }
69002
69044
  function getDaemonRuntimeIdentity(environment = process.env) {
69003
69045
  const entrypoint = process.argv[1];
@@ -69638,6 +69680,7 @@ export {
69638
69680
  CONTEXT_POLICY_EPOCH_RENDERER,
69639
69681
  CONTEXT_TOOL_EPOCH_RENDERER,
69640
69682
  CONTEXT_SKILL_EPOCH_RENDERER,
69683
+ CONTEXT_TOOL_SUMMARY_RENDERER,
69641
69684
  parseFrontmatter,
69642
69685
  stripFrontmatter,
69643
69686
  SessionJournalOwner,
@@ -5,7 +5,7 @@ import {
5
5
  isOwnedSessionWorkerProcess,
6
6
  maybeRunOwnedSessionWorkerFrontend,
7
7
  maybeStartDaemonEarly
8
- } from "./chunk-6FZM46AU.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-AVMYOTHF.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-OYVMMJUO.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-WFJRFQGG.js";
21
- import "./chunk-6FZM46AU.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";
@@ -1 +1 @@
1
- {"version":3,"file":"product-doctor.d.ts","sourceRoot":"","sources":["../../src/cli/product-doctor.ts"],"names":[],"mappings":"AA0BA,iFAAiF;AACjF,wBAAgB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDpC;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAc3E","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { getOAuthProviders } from \"@ponythewhite/base-context-ai/oauth\";\nimport {\n\tgetBinDir,\n\tgetBundledSkillsDir,\n\tgetCustomThemesDir,\n\tgetLogsDir,\n\tgetPackageDir,\n\tgetPackageJsonPath,\n\tVERSION,\n} from \"../config.js\";\nimport {\n\tCONTEXT_EPOCH_RENDERER,\n\tCONTEXT_POLICY_EPOCH_RENDERER,\n\tCONTEXT_SKILL_EPOCH_RENDERER,\n\tCONTEXT_TOOL_EPOCH_RENDERER,\n} from \"../core/context-epoch.js\";\nimport { getKernelVenvDir, runtimeCandidateDirs } from \"../core/kernel/bootstrap.js\";\nimport { getProviderAuthContract } from \"../core/provider-contracts.js\";\nimport { CURRENT_SESSION_VERSION } from \"../core/session-manager.js\";\nimport { DAEMON_PROTOCOL_INFO, DAEMON_SCHEMA_ID } from \"../modes/daemon/daemon-protocol.js\";\nimport { defaultDaemonSocketDir, defaultDaemonSocketPath } from \"../modes/daemon/daemon-socket.js\";\nimport { PRODUCT, PRODUCT_ENV } from \"../product-identity.js\";\nimport { readAbsolutePathEnv, resolveRuntimePaths } from \"../runtime-paths.js\";\n\n/** Local metadata only: never load credential contents or export diagnostics. */\nexport function getProductDiagnostics() {\n\tconst paths = resolveRuntimePaths();\n\tconst packageDir = getPackageDir();\n\tconst metadata = JSON.parse(readFileSync(getPackageJsonPath(), \"utf8\")) as {\n\t\tbaseContext?: { upstreamVersion?: string; upstreamCommit?: string };\n\t};\n\tconst buildPath = [join(packageDir, \"dist\", \"build-info.json\"), join(packageDir, \"build-info.json\")].find(\n\t\texistsSync,\n\t);\n\tconst build = buildPath\n\t\t? (JSON.parse(readFileSync(buildPath, \"utf8\")) as { sourceCommit?: string; sourceDirty?: boolean })\n\t\t: {};\n\treturn {\n\t\tproduct: { name: PRODUCT.name, package: PRODUCT.packageName, version: VERSION },\n\t\tsource: {\n\t\t\trepository: PRODUCT.repository,\n\t\t\tcommit: build.sourceCommit ?? null,\n\t\t\tdirty: build.sourceDirty ?? null,\n\t\t\tupstreamVersion: metadata.baseContext?.upstreamVersion ?? null,\n\t\t\tupstreamCommit: metadata.baseContext?.upstreamCommit ?? null,\n\t\t},\n\t\tschemas: {\n\t\t\tdaemon: DAEMON_PROTOCOL_INFO,\n\t\t\tdaemonSchema: DAEMON_SCHEMA_ID,\n\t\t\tsession: CURRENT_SESSION_VERSION,\n\t\t\tnativeContext: `${CONTEXT_EPOCH_RENDERER} (request), ${CONTEXT_POLICY_EPOCH_RENDERER} (policy), ${CONTEXT_TOOL_EPOCH_RENDERER} (tool continuation), ${CONTEXT_SKILL_EPOCH_RENDERER} (selected skills)`,\n\t\t},\n\t\tpaths: {\n\t\t\t...paths,\n\t\t\tpackage: packageDir,\n\t\t\truntime: getKernelVenvDir(),\n\t\t\tkernelPythonOverride: readAbsolutePathEnv(PRODUCT_ENV.kernelPython) ?? null,\n\t\t\truntimeSource:\n\t\t\t\truntimeCandidateDirs().find((candidate) => existsSync(join(candidate, \"pyproject.toml\"))) ?? null,\n\t\t\tlogs: getLogsDir(),\n\t\t\tbinaries: getBinDir(),\n\t\t\tbundledSkills: getBundledSkillsDir(),\n\t\t\tcustomThemes: getCustomThemesDir(),\n\t\t\tsettings: join(paths.home, \"settings.json\"),\n\t\t\tprojectSettings: join(paths.project, \"settings.json\"),\n\t\t\tdaemonSockets: defaultDaemonSocketDir(),\n\t\t\tdefaultDaemonSocket: defaultDaemonSocketPath(),\n\t\t},\n\t\tproviderContracts: [\n\t\t\t...getOAuthProviders().map((provider) => getProviderAuthContract(provider.id)),\n\t\t\tgetProviderAuthContract(\"prime-intellect\"),\n\t\t],\n\t};\n}\n\nexport type ProductDiagnostics = ReturnType<typeof getProductDiagnostics>;\n\nexport function formatProductDiagnostics(report: ProductDiagnostics): string {\n\tconst lines = [\n\t\t`${report.product.name} ${report.product.version} (${report.product.package})`,\n\t\t`Source build: ${report.source.commit ?? \"unknown (no build metadata)\"}; dirty: ${report.source.dirty ?? \"unknown\"}`,\n\t\t`Upstream: ${report.source.upstreamVersion ?? \"unknown\"} (${report.source.upstreamCommit ?? \"unknown\"})`,\n\t\t`Schemas: daemon ${report.schemas.daemon.version}, session ${report.schemas.session}; native context: ${report.schemas.nativeContext}`,\n\t\t\"Resolved paths:\",\n\t\t...Object.entries(report.paths).map(([name, value]) => ` ${name}: ${value ?? \"not set\"}`),\n\t\t\"Provider OAuth contracts:\",\n\t\t...report.providerContracts.map(\n\t\t\t(contract) => ` ${contract.providerId}: ${contract.oauth}. ${contract.guidance}`,\n\t\t),\n\t];\n\treturn lines.join(\"\\n\");\n}\n"]}
1
+ {"version":3,"file":"product-doctor.d.ts","sourceRoot":"","sources":["../../src/cli/product-doctor.ts"],"names":[],"mappings":"AA2BA,iFAAiF;AACjF,wBAAgB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDpC;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAc3E","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { getOAuthProviders } from \"@ponythewhite/base-context-ai/oauth\";\nimport {\n\tgetBinDir,\n\tgetBundledSkillsDir,\n\tgetCustomThemesDir,\n\tgetLogsDir,\n\tgetPackageDir,\n\tgetPackageJsonPath,\n\tVERSION,\n} from \"../config.js\";\nimport {\n\tCONTEXT_EPOCH_RENDERER,\n\tCONTEXT_POLICY_EPOCH_RENDERER,\n\tCONTEXT_SKILL_EPOCH_RENDERER,\n\tCONTEXT_TOOL_EPOCH_RENDERER,\n\tCONTEXT_TOOL_SUMMARY_RENDERER,\n} from \"../core/context-epoch.js\";\nimport { getKernelVenvDir, runtimeCandidateDirs } from \"../core/kernel/bootstrap.js\";\nimport { getProviderAuthContract } from \"../core/provider-contracts.js\";\nimport { CURRENT_SESSION_VERSION } from \"../core/session-manager.js\";\nimport { DAEMON_PROTOCOL_INFO, DAEMON_SCHEMA_ID } from \"../modes/daemon/daemon-protocol.js\";\nimport { defaultDaemonSocketDir, defaultDaemonSocketPath } from \"../modes/daemon/daemon-socket.js\";\nimport { PRODUCT, PRODUCT_ENV } from \"../product-identity.js\";\nimport { readAbsolutePathEnv, resolveRuntimePaths } from \"../runtime-paths.js\";\n\n/** Local metadata only: never load credential contents or export diagnostics. */\nexport function getProductDiagnostics() {\n\tconst paths = resolveRuntimePaths();\n\tconst packageDir = getPackageDir();\n\tconst metadata = JSON.parse(readFileSync(getPackageJsonPath(), \"utf8\")) as {\n\t\tbaseContext?: { upstreamVersion?: string; upstreamCommit?: string };\n\t};\n\tconst buildPath = [join(packageDir, \"dist\", \"build-info.json\"), join(packageDir, \"build-info.json\")].find(\n\t\texistsSync,\n\t);\n\tconst build = buildPath\n\t\t? (JSON.parse(readFileSync(buildPath, \"utf8\")) as { sourceCommit?: string; sourceDirty?: boolean })\n\t\t: {};\n\treturn {\n\t\tproduct: { name: PRODUCT.name, package: PRODUCT.packageName, version: VERSION },\n\t\tsource: {\n\t\t\trepository: PRODUCT.repository,\n\t\t\tcommit: build.sourceCommit ?? null,\n\t\t\tdirty: build.sourceDirty ?? null,\n\t\t\tupstreamVersion: metadata.baseContext?.upstreamVersion ?? null,\n\t\t\tupstreamCommit: metadata.baseContext?.upstreamCommit ?? null,\n\t\t},\n\t\tschemas: {\n\t\t\tdaemon: DAEMON_PROTOCOL_INFO,\n\t\t\tdaemonSchema: DAEMON_SCHEMA_ID,\n\t\t\tsession: CURRENT_SESSION_VERSION,\n\t\t\tnativeContext: `${CONTEXT_EPOCH_RENDERER} (request), ${CONTEXT_POLICY_EPOCH_RENDERER} (policy), ${CONTEXT_TOOL_EPOCH_RENDERER} (tool continuation), ${CONTEXT_SKILL_EPOCH_RENDERER} (selected skills), ${CONTEXT_TOOL_SUMMARY_RENDERER} (tool summary)`,\n\t\t},\n\t\tpaths: {\n\t\t\t...paths,\n\t\t\tpackage: packageDir,\n\t\t\truntime: getKernelVenvDir(),\n\t\t\tkernelPythonOverride: readAbsolutePathEnv(PRODUCT_ENV.kernelPython) ?? null,\n\t\t\truntimeSource:\n\t\t\t\truntimeCandidateDirs().find((candidate) => existsSync(join(candidate, \"pyproject.toml\"))) ?? null,\n\t\t\tlogs: getLogsDir(),\n\t\t\tbinaries: getBinDir(),\n\t\t\tbundledSkills: getBundledSkillsDir(),\n\t\t\tcustomThemes: getCustomThemesDir(),\n\t\t\tsettings: join(paths.home, \"settings.json\"),\n\t\t\tprojectSettings: join(paths.project, \"settings.json\"),\n\t\t\tdaemonSockets: defaultDaemonSocketDir(),\n\t\t\tdefaultDaemonSocket: defaultDaemonSocketPath(),\n\t\t},\n\t\tproviderContracts: [\n\t\t\t...getOAuthProviders().map((provider) => getProviderAuthContract(provider.id)),\n\t\t\tgetProviderAuthContract(\"prime-intellect\"),\n\t\t],\n\t};\n}\n\nexport type ProductDiagnostics = ReturnType<typeof getProductDiagnostics>;\n\nexport function formatProductDiagnostics(report: ProductDiagnostics): string {\n\tconst lines = [\n\t\t`${report.product.name} ${report.product.version} (${report.product.package})`,\n\t\t`Source build: ${report.source.commit ?? \"unknown (no build metadata)\"}; dirty: ${report.source.dirty ?? \"unknown\"}`,\n\t\t`Upstream: ${report.source.upstreamVersion ?? \"unknown\"} (${report.source.upstreamCommit ?? \"unknown\"})`,\n\t\t`Schemas: daemon ${report.schemas.daemon.version}, session ${report.schemas.session}; native context: ${report.schemas.nativeContext}`,\n\t\t\"Resolved paths:\",\n\t\t...Object.entries(report.paths).map(([name, value]) => ` ${name}: ${value ?? \"not set\"}`),\n\t\t\"Provider OAuth contracts:\",\n\t\t...report.providerContracts.map(\n\t\t\t(contract) => ` ${contract.providerId}: ${contract.oauth}. ${contract.guidance}`,\n\t\t),\n\t];\n\treturn lines.join(\"\\n\");\n}\n"]}
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { getOAuthProviders } from "@ponythewhite/base-context-ai/oauth";
4
4
  import { getBinDir, getBundledSkillsDir, getCustomThemesDir, getLogsDir, getPackageDir, getPackageJsonPath, VERSION, } from "../config.js";
5
- import { CONTEXT_EPOCH_RENDERER, CONTEXT_POLICY_EPOCH_RENDERER, CONTEXT_SKILL_EPOCH_RENDERER, CONTEXT_TOOL_EPOCH_RENDERER, } from "../core/context-epoch.js";
5
+ import { CONTEXT_EPOCH_RENDERER, CONTEXT_POLICY_EPOCH_RENDERER, CONTEXT_SKILL_EPOCH_RENDERER, CONTEXT_TOOL_EPOCH_RENDERER, CONTEXT_TOOL_SUMMARY_RENDERER, } from "../core/context-epoch.js";
6
6
  import { getKernelVenvDir, runtimeCandidateDirs } from "../core/kernel/bootstrap.js";
7
7
  import { getProviderAuthContract } from "../core/provider-contracts.js";
8
8
  import { CURRENT_SESSION_VERSION } from "../core/session-manager.js";
@@ -32,7 +32,7 @@ export function getProductDiagnostics() {
32
32
  daemon: DAEMON_PROTOCOL_INFO,
33
33
  daemonSchema: DAEMON_SCHEMA_ID,
34
34
  session: CURRENT_SESSION_VERSION,
35
- nativeContext: `${CONTEXT_EPOCH_RENDERER} (request), ${CONTEXT_POLICY_EPOCH_RENDERER} (policy), ${CONTEXT_TOOL_EPOCH_RENDERER} (tool continuation), ${CONTEXT_SKILL_EPOCH_RENDERER} (selected skills)`,
35
+ nativeContext: `${CONTEXT_EPOCH_RENDERER} (request), ${CONTEXT_POLICY_EPOCH_RENDERER} (policy), ${CONTEXT_TOOL_EPOCH_RENDERER} (tool continuation), ${CONTEXT_SKILL_EPOCH_RENDERER} (selected skills), ${CONTEXT_TOOL_SUMMARY_RENDERER} (tool summary)`,
36
36
  },
37
37
  paths: {
38
38
  ...paths,