@ponythewhite/base-context 1.0.14 → 1.0.16
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 +18 -0
- package/dist/base-context-runtime/pyproject.toml +1 -1
- package/dist/base-context-runtime/src/rlm/bash.py +19 -0
- package/dist/base-context-runtime/src/rlm/job_watch.py +156 -0
- package/dist/base-context-runtime/src/rlm/repl.md +28 -6
- package/dist/base-context-runtime/src/rlm/repl.py +6 -1
- package/dist/base-context-runtime/test/test_bash.py +4 -4
- package/dist/base-context-runtime/test/test_job_watch.py +67 -0
- package/dist/base-context-runtime/uv.lock +1 -1
- package/dist/build-info.json +1 -1
- package/dist/bundle/{bundled-modules-UODO7ZR7.js → bundled-modules-2DMTK7VK.js} +2 -2
- package/dist/bundle/{chunk-SX7CAXWU.js → chunk-MSH6QRP5.js} +1730 -867
- package/dist/bundle/{chunk-NLRWERWA.js → chunk-T2OK7SRV.js} +53 -21
- package/dist/bundle/{cli-main-6GXXIMQQ.js → cli-main-WL2L5IEQ.js} +2 -2
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/{main-HF64B4HM.js → main-XPIEIEQJ.js} +2 -2
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +191 -33
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +11 -9
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/history-index-worker.d.ts.map +1 -1
- package/dist/core/history-index-worker.js +22 -1
- package/dist/core/history-index-worker.js.map +1 -1
- package/dist/core/history-index.d.ts +2 -0
- package/dist/core/history-index.d.ts.map +1 -1
- package/dist/core/history-index.js.map +1 -1
- package/dist/core/inference-coordinator.d.ts.map +1 -1
- package/dist/core/inference-coordinator.js +13 -2
- package/dist/core/inference-coordinator.js.map +1 -1
- package/dist/core/job-watch.d.ts +120 -0
- package/dist/core/job-watch.d.ts.map +1 -0
- package/dist/core/job-watch.js +648 -0
- package/dist/core/job-watch.js.map +1 -0
- package/dist/core/kernel/repl-manager.d.ts +5 -1
- package/dist/core/kernel/repl-manager.d.ts.map +1 -1
- package/dist/core/kernel/repl-manager.js +57 -0
- package/dist/core/kernel/repl-manager.js.map +1 -1
- package/dist/core/kernel/shared.d.ts +12 -0
- package/dist/core/kernel/shared.d.ts.map +1 -1
- package/dist/core/kernel/shared.js.map +1 -1
- package/dist/core/prompts/rlm.d.ts.map +1 -1
- package/dist/core/prompts/rlm.js +49 -39
- package/dist/core/prompts/rlm.js.map +1 -1
- package/dist/core/session-manager.d.ts +10 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +66 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/tools/prime-context.d.ts.map +1 -1
- package/dist/core/tools/prime-context.js +1 -1
- package/dist/core/tools/prime-context.js.map +1 -1
- package/dist/modes/daemon/daemon-mode.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-mode.js +17 -17
- package/dist/modes/daemon/daemon-mode.js.map +1 -1
- package/dist/modes/daemon/daemon-worker-client.d.ts +1 -0
- package/dist/modes/daemon/daemon-worker-client.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-worker-client.js +8 -0
- package/dist/modes/daemon/daemon-worker-client.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +2 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +31 -5
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/skills/agent-message/SKILL.md +8 -2
- package/dist/skills/bounded-inspect/SKILL.md +78 -0
- package/dist/skills/bounded-inspect/pyproject.toml +16 -0
- package/dist/skills/bounded-inspect/src/bounded_inspect/__init__.py +313 -0
- package/dist/skills/bounded-inspect/src/bounded_inspect/__main__.py +3 -0
- package/dist/skills/job-watch/SKILL.md +43 -0
- package/dist/skills/job-watch/pyproject.toml +13 -0
- package/dist/skills/job-watch/src/job_watch/__init__.py +61 -0
- package/dist/skills/rlm-heartbeat/SKILL.md +10 -6
- package/dist/utils/file-lines.d.ts.map +1 -1
- package/dist/utils/file-lines.js +6 -2
- package/dist/utils/file-lines.js.map +1 -1
- package/docs/rlm-runtime.md +4 -1
- package/docs/skills.md +18 -26
- package/docs/upstream-1.0.15.md +83 -0
- package/package.json +4 -4
- package/skills/agent-message/SKILL.md +8 -2
- package/skills/bounded-inspect/SKILL.md +78 -0
- package/skills/bounded-inspect/pyproject.toml +16 -0
- package/skills/bounded-inspect/src/bounded_inspect/__init__.py +313 -0
- package/skills/bounded-inspect/src/bounded_inspect/__main__.py +3 -0
- package/skills/job-watch/SKILL.md +43 -0
- package/skills/job-watch/pyproject.toml +13 -0
- package/skills/job-watch/src/job_watch/__init__.py +61 -0
- package/skills/rlm-heartbeat/SKILL.md +10 -6
|
@@ -39,7 +39,8 @@ const COMPACTION_BOOKKEEPING_ENTRY_TYPES = new Set([
|
|
|
39
39
|
]);
|
|
40
40
|
function isCompactionBookkeeping(entry) {
|
|
41
41
|
return (COMPACTION_BOOKKEEPING_ENTRY_TYPES.has(entry.type) ||
|
|
42
|
-
(entry.type === "custom_message" && entry.customType === COMPACTION_OUTCOME_CUSTOM_TYPE)
|
|
42
|
+
(entry.type === "custom_message" && entry.customType === COMPACTION_OUTCOME_CUSTOM_TYPE) ||
|
|
43
|
+
(entry.type === "custom" && entry.customType === "job_watch_state"));
|
|
43
44
|
}
|
|
44
45
|
// Entry types that can represent user intent (vs. daemon bookkeeping like
|
|
45
46
|
// session_state/agent_status/git_state/child_usage_attributed). Used by
|
|
@@ -1932,6 +1933,13 @@ export class SessionManager {
|
|
|
1932
1933
|
this.sessionFile === sessionFile &&
|
|
1933
1934
|
state.branchSelectionRevision === selectionRevision;
|
|
1934
1935
|
}
|
|
1936
|
+
/** Capture content ownership, ignoring bookkeeping and allowing the caller's known ACKed content appends. */
|
|
1937
|
+
captureCompactionContentOwner() {
|
|
1938
|
+
const sourceIsCurrent = this.captureCompactionSourceOwner();
|
|
1939
|
+
const state = this.writeState;
|
|
1940
|
+
const revision = state.compactionRevision;
|
|
1941
|
+
return (ownAppends = 0) => sourceIsCurrent() && state.compactionRevision === revision + ownAppends;
|
|
1942
|
+
}
|
|
1935
1943
|
bindCompactionSink(limits = DEFAULT_MANAGER_HISTORY_LIMITS) {
|
|
1936
1944
|
const state = this.writeState;
|
|
1937
1945
|
const owner = state.owner;
|
|
@@ -2012,6 +2020,10 @@ export class SessionManager {
|
|
|
2012
2020
|
isCurrent: () => isCurrent(currentRevision),
|
|
2013
2021
|
readHistory: (read) => sink.readHistory((history) => read(history.branchContext)),
|
|
2014
2022
|
[readCopiedEpochSource]: (read) => sink.readHistory(read),
|
|
2023
|
+
readCompactionEntries: (entryIds) => {
|
|
2024
|
+
const ids = [...new Set(entryIds)];
|
|
2025
|
+
return sink.readHistory((history) => this._readCompactionEntriesAt(history, ids, capturedLimits));
|
|
2026
|
+
},
|
|
2015
2027
|
readBranch: async () => {
|
|
2016
2028
|
if (indexed)
|
|
2017
2029
|
return sink.readHistory(async (history) => (await this._readBranchesAt(history, [history.source.leafId], capturedLimits)).branches[0]);
|
|
@@ -2893,6 +2905,59 @@ export class SessionManager {
|
|
|
2893
2905
|
return entries;
|
|
2894
2906
|
});
|
|
2895
2907
|
}
|
|
2908
|
+
async _readCompactionEntriesAt(history, entryIds, limits) {
|
|
2909
|
+
const { maxEntries, maxSourceBytes } = limits;
|
|
2910
|
+
if (!Number.isSafeInteger(maxEntries) ||
|
|
2911
|
+
maxEntries <= 0 ||
|
|
2912
|
+
!Number.isSafeInteger(maxSourceBytes) ||
|
|
2913
|
+
maxSourceBytes <= 0)
|
|
2914
|
+
throw new Error("Invalid compaction source limits");
|
|
2915
|
+
if (entryIds.length > maxEntries)
|
|
2916
|
+
throw new Error("Compaction entry budget exceeded");
|
|
2917
|
+
const selected = new Set(entryIds);
|
|
2918
|
+
const references = [];
|
|
2919
|
+
for (const id of entryIds) {
|
|
2920
|
+
const reference = await history.branchContext.get(id);
|
|
2921
|
+
if (!reference)
|
|
2922
|
+
throw new Error("Compaction entry is outside its captured branch");
|
|
2923
|
+
references.push(reference);
|
|
2924
|
+
}
|
|
2925
|
+
references.sort((a, b) => a.sequence - b.sequence);
|
|
2926
|
+
// Pinned older views cannot cross an omitted message to become a chronological cut.
|
|
2927
|
+
// Walk metadata only: excluded lifetime payloads must not consume the hydration budget.
|
|
2928
|
+
const suffixAnchors = new Set();
|
|
2929
|
+
const visited = new Set();
|
|
2930
|
+
let current = history.source.leafId;
|
|
2931
|
+
let leafKind;
|
|
2932
|
+
while (current !== null) {
|
|
2933
|
+
if (visited.has(current))
|
|
2934
|
+
throw new Error("Compaction parent path is unresolved");
|
|
2935
|
+
visited.add(current);
|
|
2936
|
+
const reference = await history.branchContext.get(current);
|
|
2937
|
+
if (!reference)
|
|
2938
|
+
throw new Error("Compaction parent path is unresolved");
|
|
2939
|
+
leafKind ??= reference.kind;
|
|
2940
|
+
if (["message", "custom_message", "branch_summary"].includes(reference.kind)) {
|
|
2941
|
+
if (!selected.has(reference.id))
|
|
2942
|
+
break;
|
|
2943
|
+
suffixAnchors.add(reference.id);
|
|
2944
|
+
}
|
|
2945
|
+
current = reference.parentId;
|
|
2946
|
+
}
|
|
2947
|
+
const entries = [];
|
|
2948
|
+
let sourceBytes = 0;
|
|
2949
|
+
for (const reference of references) {
|
|
2950
|
+
const remaining = maxSourceBytes - sourceBytes;
|
|
2951
|
+
sourceBytes += reference.locator.length;
|
|
2952
|
+
if (sourceBytes > maxSourceBytes)
|
|
2953
|
+
throw new Error("Compaction source byte budget exceeded");
|
|
2954
|
+
const value = await history.hydrateEntry(reference.id, remaining);
|
|
2955
|
+
if (!value)
|
|
2956
|
+
throw new Error("Compaction entry source is unavailable");
|
|
2957
|
+
entries.push(withEntryRetention(value.entry, value.source.retention, value.source.qualification));
|
|
2958
|
+
}
|
|
2959
|
+
return { entries, suffixAnchors, leafKind };
|
|
2960
|
+
}
|
|
2896
2961
|
async _readBranchesAt(history, leafIds, limits) {
|
|
2897
2962
|
const { maxEntries, maxSourceBytes } = limits;
|
|
2898
2963
|
if (!Number.isSafeInteger(maxEntries) ||
|