oasis_test 0.1.71 → 0.1.72
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 +29 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -137173,7 +137173,6 @@ var init_live_chat = __esm({
|
|
|
137173
137173
|
if (!turn || turn.status !== "running") return { accepted: false, reason: "no-live-turn" };
|
|
137174
137174
|
const fn = turn.handle.appendInput;
|
|
137175
137175
|
if (typeof fn !== "function") return { accepted: false, reason: "unsupported" };
|
|
137176
|
-
if (turn.handle.canAppendInput === false) return { accepted: false, reason: "session-closing" };
|
|
137177
137176
|
let res;
|
|
137178
137177
|
try {
|
|
137179
137178
|
res = await fn.call(turn.handle, { text: text2 });
|
|
@@ -152347,6 +152346,11 @@ function buildClaudeUsage(acc) {
|
|
|
152347
152346
|
costUsdMicros: acc.costUsd != null ? Math.round(acc.costUsd * 1e6) : null
|
|
152348
152347
|
};
|
|
152349
152348
|
}
|
|
152349
|
+
function claudeAppendGraceMs(opts) {
|
|
152350
|
+
const raw = opts.appendGraceMs ?? Number(process.env["OASIS_CLAUDE_APPEND_GRACE_MS"] ?? NaN);
|
|
152351
|
+
const n = Number.isFinite(raw) ? Number(raw) : 8e3;
|
|
152352
|
+
return n > 0 ? n : 0;
|
|
152353
|
+
}
|
|
152350
152354
|
function claudeAppendEnabled(opts) {
|
|
152351
152355
|
if (opts.streamJson !== true) return false;
|
|
152352
152356
|
if (opts.enableAppendInput === false) return false;
|
|
@@ -152449,6 +152453,7 @@ var init_claude_code = __esm({
|
|
|
152449
152453
|
const prompt = materializeBundle(dir, job.bundle);
|
|
152450
152454
|
const promptViaStdin = Buffer.byteLength(prompt, "utf8") > 1e5;
|
|
152451
152455
|
const appendMode = claudeAppendEnabled(this.opts);
|
|
152456
|
+
const appendGraceMs = claudeAppendGraceMs(this.opts);
|
|
152452
152457
|
const promptOnStdin = appendMode || promptViaStdin;
|
|
152453
152458
|
const runtimeSessionArgs = job.runtimeSessionId ? job.resumeRuntimeSession ? ["--resume", job.runtimeSessionId] : ["--session-id", job.runtimeSessionId] : [];
|
|
152454
152459
|
const oneShotSafety = this.opts.oneShotSafety !== false;
|
|
@@ -152494,18 +152499,27 @@ var init_claude_code = __esm({
|
|
|
152494
152499
|
let writes = 0;
|
|
152495
152500
|
let results = 0;
|
|
152496
152501
|
let inputClosing = false;
|
|
152502
|
+
let pendingClose = null;
|
|
152503
|
+
const cancelPendingClose = () => {
|
|
152504
|
+
if (pendingClose) {
|
|
152505
|
+
clearTimeout(pendingClose);
|
|
152506
|
+
pendingClose = null;
|
|
152507
|
+
}
|
|
152508
|
+
};
|
|
152497
152509
|
const writeUserMessage = (text2) => {
|
|
152498
152510
|
try {
|
|
152499
152511
|
child.stdin.write(
|
|
152500
152512
|
JSON.stringify({ type: "user", message: { role: "user", content: [{ type: "text", text: text2 }] } }) + "\n"
|
|
152501
152513
|
);
|
|
152502
152514
|
writes++;
|
|
152515
|
+
cancelPendingClose();
|
|
152503
152516
|
return true;
|
|
152504
152517
|
} catch {
|
|
152505
152518
|
return false;
|
|
152506
152519
|
}
|
|
152507
152520
|
};
|
|
152508
152521
|
const closeInput = () => {
|
|
152522
|
+
cancelPendingClose();
|
|
152509
152523
|
if (inputClosing) return;
|
|
152510
152524
|
inputClosing = true;
|
|
152511
152525
|
try {
|
|
@@ -152514,7 +152528,17 @@ var init_claude_code = __esm({
|
|
|
152514
152528
|
}
|
|
152515
152529
|
};
|
|
152516
152530
|
const maybeCloseInputOnResult = () => {
|
|
152517
|
-
if (appendMode
|
|
152531
|
+
if (!appendMode || inputClosing || results < writes) return;
|
|
152532
|
+
if (appendGraceMs <= 0) {
|
|
152533
|
+
closeInput();
|
|
152534
|
+
return;
|
|
152535
|
+
}
|
|
152536
|
+
cancelPendingClose();
|
|
152537
|
+
pendingClose = setTimeout(() => {
|
|
152538
|
+
pendingClose = null;
|
|
152539
|
+
closeInput();
|
|
152540
|
+
}, appendGraceMs);
|
|
152541
|
+
pendingClose.unref?.();
|
|
152518
152542
|
};
|
|
152519
152543
|
let interruptSeq = 0;
|
|
152520
152544
|
const writeInterrupt = () => {
|
|
@@ -152664,11 +152688,13 @@ var init_claude_code = __esm({
|
|
|
152664
152688
|
...sessionModel ? { model: sessionModel } : {},
|
|
152665
152689
|
...errorMessage ? { errorMessage } : {}
|
|
152666
152690
|
};
|
|
152691
|
+
cancelPendingClose();
|
|
152667
152692
|
for (const cb of callbacks.splice(0)) cb(exited);
|
|
152668
152693
|
});
|
|
152669
152694
|
return {
|
|
152670
152695
|
id,
|
|
152671
152696
|
async kill() {
|
|
152697
|
+
cancelPendingClose();
|
|
152672
152698
|
inputClosing = true;
|
|
152673
152699
|
killReason ??= "cancelled";
|
|
152674
152700
|
child.kill("SIGKILL");
|
|
@@ -189652,7 +189678,7 @@ ${res.warning}`);
|
|
|
189652
189678
|
init_src6();
|
|
189653
189679
|
|
|
189654
189680
|
// src/index.ts
|
|
189655
|
-
var PKG_VERSION = true ? "0.1.
|
|
189681
|
+
var PKG_VERSION = true ? "0.1.72" : "dev";
|
|
189656
189682
|
var OASIS_DIR = path27.join(os9.homedir(), ".oasis");
|
|
189657
189683
|
var CONFIG_FILE = path27.join(OASIS_DIR, "node-config.json");
|
|
189658
189684
|
var PID_FILE = path27.join(OASIS_DIR, "node.pid");
|