@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
|
@@ -78,6 +78,37 @@ export class ReplKernelManager {
|
|
|
78
78
|
childOrphanOwner;
|
|
79
79
|
readyDeferred;
|
|
80
80
|
pythonVersion;
|
|
81
|
+
jobWatchCapability = false;
|
|
82
|
+
jobWatchRequests = new Map();
|
|
83
|
+
jobWatchProbe(request) {
|
|
84
|
+
if (!this.jobWatchCapability || !this.isRunning)
|
|
85
|
+
return Promise.reject(new Error("Kernel job_watch_probe_v1 is unavailable; no probe was launched"));
|
|
86
|
+
const id = uuid();
|
|
87
|
+
return new Promise((resolve, reject) => {
|
|
88
|
+
const timer = setTimeout(() => {
|
|
89
|
+
this.jobWatchRequests.delete(id);
|
|
90
|
+
void this.writeLine({ type: "job_watch_probe", id, cancel: true }).catch(() => { });
|
|
91
|
+
reject(new Error("Job watch probe transport timed out"));
|
|
92
|
+
}, request.timeoutMs + 5000);
|
|
93
|
+
timer.unref();
|
|
94
|
+
this.jobWatchRequests.set(id, { watchId: request.watchId, resolve, reject, timer });
|
|
95
|
+
void this.writeLine({ type: "job_watch_probe", id, ...request }).catch((error) => {
|
|
96
|
+
clearTimeout(timer);
|
|
97
|
+
this.jobWatchRequests.delete(id);
|
|
98
|
+
reject(error);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
cancelJobWatchProbe(watchId) {
|
|
103
|
+
for (const [id, pending] of this.jobWatchRequests) {
|
|
104
|
+
if (pending.watchId !== watchId)
|
|
105
|
+
continue;
|
|
106
|
+
clearTimeout(pending.timer);
|
|
107
|
+
this.jobWatchRequests.delete(id);
|
|
108
|
+
void this.writeLine({ type: "job_watch_probe", id, cancel: true }).catch(() => { });
|
|
109
|
+
pending.reject(new Error("Job watch probe cancelled"));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
81
112
|
kernelStderr = "";
|
|
82
113
|
/** Serializes execute() calls — the runtime runs one request at a time. */
|
|
83
114
|
executionQueue = Promise.resolve();
|
|
@@ -404,6 +435,11 @@ export class ReplKernelManager {
|
|
|
404
435
|
return;
|
|
405
436
|
this.appendKernelDiagnostic(`kernel stdout error: ${errorMessage(error)}`);
|
|
406
437
|
});
|
|
438
|
+
child.stderr?.on("error", (error) => {
|
|
439
|
+
if (this.child !== child)
|
|
440
|
+
return;
|
|
441
|
+
this.appendKernelDiagnostic(`kernel stderr error: ${errorMessage(error)}`);
|
|
442
|
+
});
|
|
407
443
|
child.once("exit", () => {
|
|
408
444
|
// One turn for the poll phase to deliver the bytes the kernel wrote
|
|
409
445
|
// before dying (the pipe buffer bounds them), then destroy: EOF may
|
|
@@ -721,6 +757,8 @@ export class ReplKernelManager {
|
|
|
721
757
|
handleEvent(event) {
|
|
722
758
|
const type = event.event;
|
|
723
759
|
if (type === "ready") {
|
|
760
|
+
this.jobWatchCapability =
|
|
761
|
+
Array.isArray(event.capabilities) && event.capabilities.includes("job_watch_probe_v1");
|
|
724
762
|
this.pythonVersion = typeof event.python === "string" ? event.python : undefined;
|
|
725
763
|
this.readyDeferred?.resolve(typeof event.protocol === "number" ? event.protocol : -1);
|
|
726
764
|
return;
|
|
@@ -1213,6 +1251,19 @@ export class ReplKernelManager {
|
|
|
1213
1251
|
if (typeof data.type !== "string" || data.type.length === 0) {
|
|
1214
1252
|
throw new Error("host request payload must have a string type");
|
|
1215
1253
|
}
|
|
1254
|
+
if (data.type === "job_watch.probe_result") {
|
|
1255
|
+
const id = typeof data.request_id === "string" ? data.request_id : "";
|
|
1256
|
+
const pending = this.jobWatchRequests.get(id);
|
|
1257
|
+
if (pending) {
|
|
1258
|
+
clearTimeout(pending.timer);
|
|
1259
|
+
this.jobWatchRequests.delete(id);
|
|
1260
|
+
if (isRecord(data.result))
|
|
1261
|
+
pending.resolve(data.result);
|
|
1262
|
+
else
|
|
1263
|
+
pending.reject(new Error("Malformed job watch probe result"));
|
|
1264
|
+
}
|
|
1265
|
+
return {};
|
|
1266
|
+
}
|
|
1216
1267
|
const handler = this.options.hostHandlers?.[data.type];
|
|
1217
1268
|
if (!handler) {
|
|
1218
1269
|
throw new Error(`host request type "${data.type}" is not available in this session`);
|
|
@@ -1273,6 +1324,12 @@ export class ReplKernelManager {
|
|
|
1273
1324
|
await this.writeLine({ type: "interrupt", id: requestId });
|
|
1274
1325
|
}
|
|
1275
1326
|
cleanupResources(killSignal = "SIGTERM") {
|
|
1327
|
+
this.jobWatchCapability = false;
|
|
1328
|
+
for (const pending of this.jobWatchRequests.values()) {
|
|
1329
|
+
clearTimeout(pending.timer);
|
|
1330
|
+
pending.reject(new Error("Kernel lost; job state is unknown"));
|
|
1331
|
+
}
|
|
1332
|
+
this.jobWatchRequests.clear();
|
|
1276
1333
|
const failures = [];
|
|
1277
1334
|
this.startGeneration++; // any teardown invalidates in-flight starts
|
|
1278
1335
|
this.clearSnapshotTimer();
|