billion-context-pi 0.1.26 → 0.1.27
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/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/tool-guardrails.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2429,9 +2429,17 @@ ${argStr}` : argStr || textParts;
|
|
|
2429
2429
|
}
|
|
2430
2430
|
return [{ id, role: "assistant", contentType: "text", text: extractText(msg.content) }];
|
|
2431
2431
|
}
|
|
2432
|
-
const customText = extractText(msg.content);
|
|
2432
|
+
const customText = extractText(msg.content) || fallbackText(msg);
|
|
2433
2433
|
return customText.length > 0 ? [{ id, role: "user", contentType: "text", text: customText }] : [];
|
|
2434
2434
|
}
|
|
2435
|
+
function fallbackText(msg) {
|
|
2436
|
+
const parts = [];
|
|
2437
|
+
if (msg.command) parts.push(`$ ${msg.command}`);
|
|
2438
|
+
const out = extractText(msg.output);
|
|
2439
|
+
if (out) parts.push(out);
|
|
2440
|
+
if (msg.summary) parts.push(msg.summary);
|
|
2441
|
+
return parts.join("\n").trim();
|
|
2442
|
+
}
|
|
2435
2443
|
function stringifyArgs(args) {
|
|
2436
2444
|
if (!args) return "";
|
|
2437
2445
|
if (typeof args === "string") return args;
|
|
@@ -2621,6 +2629,12 @@ function mergeInitialState(parsed) {
|
|
|
2621
2629
|
}
|
|
2622
2630
|
|
|
2623
2631
|
// src/runtime.ts
|
|
2632
|
+
function readContextEntries(sm) {
|
|
2633
|
+
const source = sm;
|
|
2634
|
+
if (typeof source.buildContextEntries === "function") return source.buildContextEntries();
|
|
2635
|
+
if (typeof source.getBranch === "function") return source.getBranch();
|
|
2636
|
+
return [];
|
|
2637
|
+
}
|
|
2624
2638
|
function createRuntime(adapter) {
|
|
2625
2639
|
const core = createCore({ countTokens: defaultCountTokens });
|
|
2626
2640
|
const store = new SessionStateStore();
|
|
@@ -2652,7 +2666,7 @@ function createRuntime(adapter) {
|
|
|
2652
2666
|
async function stateFor(ctx) {
|
|
2653
2667
|
const sm = ctx.sessionManager;
|
|
2654
2668
|
const state = await store.load(sm.getSessionFile() ?? void 0, sm.getSessionId());
|
|
2655
|
-
const entries = sm
|
|
2669
|
+
const entries = readContextEntries(sm);
|
|
2656
2670
|
return { state, coreMessages: entriesToCoreMessages(entries), entries };
|
|
2657
2671
|
}
|
|
2658
2672
|
async function save(state, ctx) {
|
|
@@ -8232,7 +8246,7 @@ async function statusReport(runtime, ctx) {
|
|
|
8232
8246
|
const activeBlocksList = state.blocks.filter((b) => b.active);
|
|
8233
8247
|
const totalBlocksList = state.blocks;
|
|
8234
8248
|
const lines = [];
|
|
8235
|
-
const versionStr = "0.1.
|
|
8249
|
+
const versionStr = "0.1.27" ? `billion-context-pi@${"0.1.27"}` : "";
|
|
8236
8250
|
lines.push("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E");
|
|
8237
8251
|
lines.push("\u2502 ACP Context Analysis \u2502");
|
|
8238
8252
|
lines.push("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F");
|
|
@@ -8376,9 +8390,11 @@ When a background delegate finishes, an automated completion notification is inj
|
|
|
8376
8390
|
|
|
8377
8391
|
// src/tool-guardrails.ts
|
|
8378
8392
|
import {
|
|
8379
|
-
isBashToolResult,
|
|
8380
8393
|
isToolCallEventType
|
|
8381
8394
|
} from "@earendil-works/pi-coding-agent";
|
|
8395
|
+
function isBashToolResult(e) {
|
|
8396
|
+
return e.toolName === "bash";
|
|
8397
|
+
}
|
|
8382
8398
|
function resolveBashTimeout(input, defaultTimeout) {
|
|
8383
8399
|
if (input.timeout !== void 0) return void 0;
|
|
8384
8400
|
const d = defaultTimeout ?? DEFAULT_TOOL_BASH_TIMEOUT;
|
|
@@ -8590,7 +8606,7 @@ async function checkForUpdate(autoUpdate, notify) {
|
|
|
8590
8606
|
const data = await res.json();
|
|
8591
8607
|
const latest = data.version;
|
|
8592
8608
|
if (!latest) return;
|
|
8593
|
-
const current = runtimeVersion ?? "0.1.
|
|
8609
|
+
const current = runtimeVersion ?? "0.1.27";
|
|
8594
8610
|
debug.event("update-check", {
|
|
8595
8611
|
current,
|
|
8596
8612
|
latest,
|