@ponythewhite/base-context 1.0.5 → 1.0.6
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 +6 -0
- package/dist/base-context-runtime/pyproject.toml +1 -1
- package/dist/base-context-runtime/uv.lock +1 -1
- package/dist/build-info.json +1 -1
- package/dist/bundle/{bundled-modules-UVCJPNFC.js → bundled-modules-MEACET4U.js} +2 -2
- package/dist/bundle/{chunk-WFJRFQGG.js → chunk-LIZVVGHR.js} +3 -2
- package/dist/bundle/{chunk-6FZM46AU.js → chunk-QKI6KEGP.js} +46 -22
- package/dist/bundle/{cli-main-OYVMMJUO.js → cli-main-ANUJY7Y4.js} +2 -2
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/{main-AVMYOTHF.js → main-4GIKOHIT.js} +2 -2
- package/dist/cli/product-doctor.d.ts.map +1 -1
- package/dist/cli/product-doctor.js +2 -2
- package/dist/cli/product-doctor.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +9 -3
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/canonical-context.d.ts +3 -1
- package/dist/core/canonical-context.d.ts.map +1 -1
- package/dist/core/canonical-context.js +46 -16
- package/dist/core/canonical-context.js.map +1 -1
- package/dist/core/context-epoch-copy.d.ts.map +1 -1
- package/dist/core/context-epoch-copy.js +1 -1
- package/dist/core/context-epoch-copy.js.map +1 -1
- package/dist/core/context-epoch.d.ts +12 -2
- package/dist/core/context-epoch.d.ts.map +1 -1
- package/dist/core/context-epoch.js +28 -12
- package/dist/core/context-epoch.js.map +1 -1
- package/dist/core/session-bootstrap.d.ts +1 -0
- package/dist/core/session-bootstrap.d.ts.map +1 -1
- package/dist/core/session-bootstrap.js +1 -1
- package/dist/core/session-bootstrap.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.6] - 2026-09-18
|
|
4
|
+
|
|
5
|
+
- Fixed automatic and manual compaction failing after native tool continuations.
|
|
6
|
+
- Kept pending-tool context reads available without granting provider-request permission.
|
|
7
|
+
- Preserved public tool facts and exact source references through summaries and subsequent requests.
|
|
8
|
+
|
|
3
9
|
## [1.0.5] - 2026-09-18
|
|
4
10
|
|
|
5
11
|
- Displayed the built-in theme as Synerise without changing saved theme IDs, and branded the tmux startup notice as base-context.
|
package/dist/build-info.json
CHANGED
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
oauth_exports,
|
|
52
52
|
runPrintMode,
|
|
53
53
|
runRpcMode
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-LIZVVGHR.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-
|
|
146
|
+
} from "./chunk-QKI6KEGP.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-
|
|
351
|
+
} from "./chunk-QKI6KEGP.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,
|
|
@@ -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,7 +27768,7 @@ 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 || !("
|
|
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
|
}
|
|
@@ -31155,6 +31156,11 @@ function captureCanonicalRequestMessages(messages) {
|
|
|
31155
31156
|
return captured;
|
|
31156
31157
|
}
|
|
31157
31158
|
function prepareToolContinuationWindow(messages) {
|
|
31159
|
+
if (compiledEpochContexts.get(messages)?.readOnly)
|
|
31160
|
+
throw new Error("Read-only context cannot authorize a provider epoch");
|
|
31161
|
+
return renderToolContinuationWindow(messages);
|
|
31162
|
+
}
|
|
31163
|
+
function renderToolContinuationWindow(messages) {
|
|
31158
31164
|
const captured = captureCanonicalRequestMessages(messages);
|
|
31159
31165
|
const views = compiledViewUnits.get(captured);
|
|
31160
31166
|
const epoch = compiledEpochContexts.get(captured);
|
|
@@ -31186,7 +31192,8 @@ function prepareToolContinuationWindow(messages) {
|
|
|
31186
31192
|
}
|
|
31187
31193
|
}
|
|
31188
31194
|
stringifyBoundedJson(captured, maxBytes);
|
|
31189
|
-
const
|
|
31195
|
+
const units = epoch.readOnly ? bindMessageReplayUnits(captured, views.selection.units, views.selection.limits, "message-groups", groups) : views.units;
|
|
31196
|
+
const publicUnits = units.map((unit, index) => ({
|
|
31190
31197
|
...unit,
|
|
31191
31198
|
sourceRevision: renderedGroups.has(index) ? JSON.stringify([unit.sourceRevision, PUBLIC_TOOL_CONTINUATION_RENDERER, renderedGroups.get(index)]) : unit.sourceRevision,
|
|
31192
31199
|
unavailableDependencies: unit.unavailableDependencies?.filter((id) => !markers.has(id))
|
|
@@ -31306,6 +31313,8 @@ function prepareCanonicalEpoch(messages, selectedUnitIds, representation, maxByt
|
|
|
31306
31313
|
const units = getCanonicalViewUnits(messages);
|
|
31307
31314
|
if (!context || !units || units.length !== messages.length || context.references.length !== messages.length)
|
|
31308
31315
|
throw new Error("Context epoch requires its captured compiler output");
|
|
31316
|
+
if (context.readOnly)
|
|
31317
|
+
throw new Error("Read-only context cannot authorize a provider epoch");
|
|
31309
31318
|
if (compiledViewUnits.get(messages)?.selection.pendingPublicMessageGroups?.length)
|
|
31310
31319
|
throw new Error("Tool continuation requires its accepted public representation");
|
|
31311
31320
|
if (context.toolContinuations?.length && (!publicWindow || replayContract !== "message-groups"))
|
|
@@ -31361,8 +31370,8 @@ function canonicalRecoveryBoundary(messages) {
|
|
|
31361
31370
|
const units = getCanonicalViewUnits(messages);
|
|
31362
31371
|
if (!context || !units)
|
|
31363
31372
|
throw new Error("Recovery compaction requires captured canonical views");
|
|
31364
|
-
if (context.toolContinuations?.length)
|
|
31365
|
-
throw new Error("Tool continuation
|
|
31373
|
+
if (context.toolContinuations?.length && !context.readOnly)
|
|
31374
|
+
throw new Error("Tool continuation summary requires its captured public read view");
|
|
31366
31375
|
const recoveries = units.flatMap((unit, index) => unit.kind === "recovery" ? [context.references[index]] : []);
|
|
31367
31376
|
if (!recoveries.length)
|
|
31368
31377
|
return;
|
|
@@ -31375,7 +31384,7 @@ function prepareRecoveryCompaction(messages, firstKeptEntryId, maxBytes) {
|
|
|
31375
31384
|
const boundary = canonicalRecoveryBoundary(messages);
|
|
31376
31385
|
const context = compiledEpochContexts.get(messages);
|
|
31377
31386
|
const publicWindow = context?.checkpoint?.publicWindow === true && context.checkpoint.replayContract === "message-groups";
|
|
31378
|
-
if (!boundary && !publicWindow && !context?.selectedSkills?.length)
|
|
31387
|
+
if (!boundary && !publicWindow && !context?.selectedSkills?.length && !context?.toolContinuations?.length)
|
|
31379
31388
|
return;
|
|
31380
31389
|
if (!context)
|
|
31381
31390
|
throw new Error("Recovery compaction requires captured canonical views");
|
|
@@ -31386,7 +31395,8 @@ function prepareRecoveryCompaction(messages, firstKeptEntryId, maxBytes) {
|
|
|
31386
31395
|
throw new Error("Recovery compaction must retain its unmeasured literal tail");
|
|
31387
31396
|
const units = bindMessageReplayUnits(messages, selection.units, selection.limits, "message-groups");
|
|
31388
31397
|
closeViewSelection(units, units.map((unit) => unit.id), selection.limits);
|
|
31389
|
-
const
|
|
31398
|
+
const toolGroups = new Set(context.toolContinuations?.map((group) => group.assistantEntryId));
|
|
31399
|
+
const roots = units.filter((unit, index) => unit.kind === "recovery" || toolGroups.has(context.references[index]?.ref.entryId ?? "")).map((unit) => unit.id);
|
|
31390
31400
|
const closed = new Set(closeViewSelection(units, roots, selection.limits).map((unit) => unit.id));
|
|
31391
31401
|
let renderedBytes = 0;
|
|
31392
31402
|
const views = context.references.flatMap((reference, index) => {
|
|
@@ -31406,15 +31416,17 @@ function prepareRecoveryCompaction(messages, firstKeptEntryId, maxBytes) {
|
|
|
31406
31416
|
}
|
|
31407
31417
|
] : [];
|
|
31408
31418
|
});
|
|
31409
|
-
if (!views.length && !publicWindow && !context.selectedSkills?.length)
|
|
31419
|
+
if (!views.length && !publicWindow && !context.selectedSkills?.length && !toolGroups.size)
|
|
31410
31420
|
return;
|
|
31411
31421
|
return snapshotContextEpoch({
|
|
31412
|
-
version: 4,
|
|
31413
|
-
renderer: context.selectedSkills?.length ? CONTEXT_SKILL_EPOCH_RENDERER : CONTEXT_EPOCH_RENDERER,
|
|
31422
|
+
...toolGroups.size ? { version: 8, mode: context.mode } : { version: 4 },
|
|
31423
|
+
renderer: toolGroups.size ? CONTEXT_TOOL_SUMMARY_RENDERER : context.selectedSkills?.length ? CONTEXT_SKILL_EPOCH_RENDERER : CONTEXT_EPOCH_RENDERER,
|
|
31424
|
+
...toolGroups.size ? { toolContinuations: context.toolContinuations } : {},
|
|
31414
31425
|
...context.selectedSkills?.length ? { selectedSkills: context.selectedSkills } : {},
|
|
31415
31426
|
source: context.source,
|
|
31416
31427
|
representation: null,
|
|
31417
31428
|
includeSummary: true,
|
|
31429
|
+
...toolGroups.size && publicWindow ? { publicWindow: true } : {},
|
|
31418
31430
|
replayContract: boundary || publicWindow ? "message-groups" : context.checkpoint?.replayContract ?? "complete-context",
|
|
31419
31431
|
...publicWindow ? {
|
|
31420
31432
|
continuation: {
|
|
@@ -31438,7 +31450,7 @@ var CanonicalContextCompiler = class {
|
|
|
31438
31450
|
hasActiveEntry(entryId) {
|
|
31439
31451
|
return this.entries.has(entryId);
|
|
31440
31452
|
}
|
|
31441
|
-
async compile(view, limits, omittedAssistantIds = /* @__PURE__ */ new Set(), frameOptions = {}, resourceCapture, initialContextMode = "on", allowPendingToolPublic = false) {
|
|
31453
|
+
async compile(view, limits, omittedAssistantIds = /* @__PURE__ */ new Set(), frameOptions = {}, resourceCapture, initialContextMode = "on", allowPendingToolPublic = false, purpose = "request") {
|
|
31442
31454
|
const frameLimits = taskFrameLimits(frameOptions);
|
|
31443
31455
|
const previousSource = this.source;
|
|
31444
31456
|
const previousFrame = this.taskFrame;
|
|
@@ -31545,6 +31557,10 @@ var CanonicalContextCompiler = class {
|
|
|
31545
31557
|
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
31558
|
throw new Error("Selected skill epoch source is unavailable");
|
|
31547
31559
|
}
|
|
31560
|
+
const toolSourceIds = new Set(checkpoint?.toolContinuations?.flatMap((group) => [
|
|
31561
|
+
group.assistantEntryId,
|
|
31562
|
+
...group.calls.flatMap((call) => call.result ? [call.result.id] : [])
|
|
31563
|
+
]));
|
|
31548
31564
|
const publicTail = checkpoint?.continuation?.publicTailThrough;
|
|
31549
31565
|
if (publicTail) {
|
|
31550
31566
|
if (!view.atSnapshot)
|
|
@@ -31690,7 +31706,7 @@ var CanonicalContextCompiler = class {
|
|
|
31690
31706
|
appendSentAgentMessageToToolResult(message2, message2.toolCallId, sent.message);
|
|
31691
31707
|
}
|
|
31692
31708
|
}
|
|
31693
|
-
const publicHistory = pinned?.rendering === PUBLIC_CONTEXT_RENDERER || !pinned && publicTail !== void 0 && ref.sequence <= publicTail.sourceSequence;
|
|
31709
|
+
const publicHistory = !toolSourceIds.has(ref.entryId) && (pinned?.rendering === PUBLIC_CONTEXT_RENDERER || !pinned && publicTail !== void 0 && ref.sequence <= publicTail.sourceSequence);
|
|
31694
31710
|
const rendered = publicHistory ? renderPublicHistory(message2, ref.entryId, maxSourceBytes) : message2;
|
|
31695
31711
|
if (publicHistory) {
|
|
31696
31712
|
publicBytes += Buffer.byteLength(JSON.stringify(rendered), "utf8");
|
|
@@ -31730,7 +31746,7 @@ var CanonicalContextCompiler = class {
|
|
|
31730
31746
|
const prefixViews = /* @__PURE__ */ new Map();
|
|
31731
31747
|
const seen = /* @__PURE__ */ new Set();
|
|
31732
31748
|
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"))
|
|
31749
|
+
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
31750
|
throw new Error("Unsupported context epoch view rendering");
|
|
31735
31751
|
if (seen.has(pinned.ref.entryId) || refs.some((ref) => ref.entryId === pinned.ref.entryId))
|
|
31736
31752
|
throw new Error("Context epoch view overlaps its literal tail");
|
|
@@ -31893,7 +31909,7 @@ ${JSON.stringify(selections.map((skill) => ({
|
|
|
31893
31909
|
});
|
|
31894
31910
|
if (frozenGroups.length !== candidates.filter((candidate) => candidate.prior).length)
|
|
31895
31911
|
throw new Error("Committed tool continuation lost its original group");
|
|
31896
|
-
if (candidates.length && (!allowPendingToolPublic || mode === "off"))
|
|
31912
|
+
if (purpose === "request" && candidates.length && (!allowPendingToolPublic || mode === "off"))
|
|
31897
31913
|
throw new Error("Tool continuation requires an enabled native public request boundary");
|
|
31898
31914
|
const readToolEvidence = async (metadata) => {
|
|
31899
31915
|
const cached = next.get(metadata.id);
|
|
@@ -32029,6 +32045,7 @@ ${JSON.stringify(selections.map((skill) => ({
|
|
|
32029
32045
|
}
|
|
32030
32046
|
});
|
|
32031
32047
|
compiledEpochContexts.set(closedMessages, {
|
|
32048
|
+
...purpose === "read" ? { readOnly: true } : {},
|
|
32032
32049
|
mode,
|
|
32033
32050
|
source: { ...view.source },
|
|
32034
32051
|
checkpoint,
|
|
@@ -32045,7 +32062,7 @@ ${JSON.stringify(selections.map((skill) => ({
|
|
|
32045
32062
|
this.source = view.source;
|
|
32046
32063
|
this.sourceBytes = sourceBytes;
|
|
32047
32064
|
this.messageCount = messageCount;
|
|
32048
|
-
return closedMessages;
|
|
32065
|
+
return purpose === "read" && pendingPublicMessageGroups.length ? renderToolContinuationWindow(closedMessages).messages : closedMessages;
|
|
32049
32066
|
}
|
|
32050
32067
|
};
|
|
32051
32068
|
|
|
@@ -34150,7 +34167,7 @@ async function rebuildCopiedContextEpoch(history, copied, limits) {
|
|
|
34150
34167
|
if (origin?.qualification !== "native-context-epoch" || hydrated.source.qualification !== "native-context-epoch")
|
|
34151
34168
|
throw new Error("Copied context epoch has no qualified source");
|
|
34152
34169
|
const checkpoint = readContextEpoch(entry.details, limits.maxSourceBytes);
|
|
34153
|
-
if (checkpoint?.version === 6)
|
|
34170
|
+
if (checkpoint?.version === 6 || checkpoint?.version === 8)
|
|
34154
34171
|
throw new Error("Tool continuation recipes require their original native execution source");
|
|
34155
34172
|
if (!checkpoint || checkpoint.literalTailId !== entry.firstKeptEntryId || !view.atSnapshot)
|
|
34156
34173
|
throw new Error("Copied context epoch boundary is unavailable");
|
|
@@ -38968,7 +38985,7 @@ async function readSessionBootstrap(sessionManager, limits, options = {}) {
|
|
|
38968
38985
|
restoreBootstrapSetting(context, hydrated.entry);
|
|
38969
38986
|
}
|
|
38970
38987
|
if (includeMessages)
|
|
38971
|
-
context.messages = await new CanonicalContextCompiler().compile(view.branchContext, limits, void 0, {}, void 0, options.initialContextMode ?? "on", options.allowPendingToolPublic);
|
|
38988
|
+
context.messages = await new CanonicalContextCompiler().compile(view.branchContext, limits, void 0, {}, void 0, options.initialContextMode ?? "on", options.allowPendingToolPublic, options.purpose);
|
|
38972
38989
|
return {
|
|
38973
38990
|
context,
|
|
38974
38991
|
hasExistingSession: bootstrap.hasContextMessages,
|
|
@@ -44725,7 +44742,7 @@ async function loadExtensionModule(extensionPath) {
|
|
|
44725
44742
|
// (file-path aliases would load a second, divergent copy of each package).
|
|
44726
44743
|
// Also disable tryNative so jiti handles ALL imports (not just the entry point)
|
|
44727
44744
|
// Node/dev must also share the native AI registry and implementation identities.
|
|
44728
|
-
...isBunBinary || isBundledCli ? { virtualModules: (await import("./bundled-modules-
|
|
44745
|
+
...isBunBinary || isBundledCli ? { virtualModules: (await import("./bundled-modules-MEACET4U.js")).VIRTUAL_MODULES, tryNative: false } : {
|
|
44729
44746
|
alias: getAliases(),
|
|
44730
44747
|
virtualModules: {
|
|
44731
44748
|
"@ponythewhite/base-context-ai": src_exports,
|
|
@@ -61530,7 +61547,10 @@ var AgentSession = class _AgentSession {
|
|
|
61530
61547
|
}
|
|
61531
61548
|
const limits = this.settingsManager.getCanonicalContextLimits();
|
|
61532
61549
|
const outcomes = structuredClone(this._unpersistedOutcomes);
|
|
61533
|
-
const { context } = await readSessionBootstrap(this.sessionManager, limits
|
|
61550
|
+
const { context } = await readSessionBootstrap(this.sessionManager, limits, {
|
|
61551
|
+
initialContextMode: this._initialContextMode,
|
|
61552
|
+
purpose: "read"
|
|
61553
|
+
});
|
|
61534
61554
|
this._mergeUnpersistedOutcomes(context.messages, outcomes);
|
|
61535
61555
|
if (context.messages.length > limits.maxMessages)
|
|
61536
61556
|
throw new Error("Canonical context message budget exceeded");
|
|
@@ -64402,7 +64422,7 @@ ${parsed.args}` : block;
|
|
|
64402
64422
|
maxSourceBytes: limits.maxSourceBytes
|
|
64403
64423
|
};
|
|
64404
64424
|
return requests.readHistory(async (view) => {
|
|
64405
|
-
const messages = await new CanonicalContextCompiler().compile(view, limits, void 0, {}, resource);
|
|
64425
|
+
const messages = await new CanonicalContextCompiler().compile(view, limits, void 0, {}, resource, this._initialContextMode, false, "read");
|
|
64406
64426
|
this._assertCompactionOwner(owner);
|
|
64407
64427
|
const context = getCanonicalEpochContext(messages);
|
|
64408
64428
|
if (context.checkpoint?.includeSummary && pathEntries.at(-1)?.type === "compaction")
|
|
@@ -64546,7 +64566,10 @@ ${parsed.args}` : block;
|
|
|
64546
64566
|
}
|
|
64547
64567
|
try {
|
|
64548
64568
|
this._assertCompactionOwner(owner);
|
|
64549
|
-
const bootstrap = await readSessionBootstrap(owner.manager, this.settingsManager.getCanonicalContextLimits()
|
|
64569
|
+
const bootstrap = await readSessionBootstrap(owner.manager, this.settingsManager.getCanonicalContextLimits(), {
|
|
64570
|
+
allowPendingToolPublic: this._contextEpochsEnabled,
|
|
64571
|
+
initialContextMode: this._initialContextMode
|
|
64572
|
+
});
|
|
64550
64573
|
this._assertCompactionOwner(owner);
|
|
64551
64574
|
owner.agent.state.messages = bootstrap.context.messages;
|
|
64552
64575
|
this._contextOmissions = void 0;
|
|
@@ -68997,7 +69020,7 @@ import { resolve as resolve15 } from "node:path";
|
|
|
68997
69020
|
var BASE_CONTEXT_BUILD_ID_ENV = "BASE_CONTEXT_BUILD_ID";
|
|
68998
69021
|
var BASE_CONTEXT_LAUNCHER_PATH_ENV = "BASE_CONTEXT_LAUNCHER_PATH";
|
|
68999
69022
|
function bundledBuildId() {
|
|
69000
|
-
return false ? void 0 : "v1.0.
|
|
69023
|
+
return false ? void 0 : "v1.0.6";
|
|
69001
69024
|
}
|
|
69002
69025
|
function getDaemonRuntimeIdentity(environment = process.env) {
|
|
69003
69026
|
const entrypoint = process.argv[1];
|
|
@@ -69638,6 +69661,7 @@ export {
|
|
|
69638
69661
|
CONTEXT_POLICY_EPOCH_RENDERER,
|
|
69639
69662
|
CONTEXT_TOOL_EPOCH_RENDERER,
|
|
69640
69663
|
CONTEXT_SKILL_EPOCH_RENDERER,
|
|
69664
|
+
CONTEXT_TOOL_SUMMARY_RENDERER,
|
|
69641
69665
|
parseFrontmatter,
|
|
69642
69666
|
stripFrontmatter,
|
|
69643
69667
|
SessionJournalOwner,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isOwnedSessionWorkerProcess,
|
|
6
6
|
maybeRunOwnedSessionWorkerFrontend,
|
|
7
7
|
maybeStartDaemonEarly
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QKI6KEGP.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-
|
|
42
|
+
import("./main-4GIKOHIT.js")
|
|
43
43
|
]);
|
|
44
44
|
setGlobalDispatcher(new EnvHttpProxyAgent({ bodyTimeout: 0, headersTimeout: 0 }));
|
|
45
45
|
try {
|
package/dist/bundle/cli.js
CHANGED
|
@@ -17,8 +17,8 @@ import {
|
|
|
17
17
|
shouldUseDaemonClientRuntime,
|
|
18
18
|
shouldUseDaemonInteractive,
|
|
19
19
|
shouldUseEphemeralSessionManagerForDaemonInteractive
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-LIZVVGHR.js";
|
|
21
|
+
import "./chunk-QKI6KEGP.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":"
|
|
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,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-doctor.js","sourceRoot":"","sources":["../../src/cli/product-doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EACN,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,OAAO,GACP,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,sBAAsB,EACtB,6B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AAK,KAAK,IAAI,SAAS,EAAE,CAAC;QAC1F,2BAA2B;QAC3B,GAAG,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAC9B,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,QAAQ,CAAC,UAAU,KAAK,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,QAAQ,EAAE,CACjF;KACD,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAAA,CACxB","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"]}
|