oasis_test 0.1.47 → 0.1.49
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 +104 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -322,7 +322,7 @@ function fold(model, op) {
|
|
|
322
322
|
case "escalate": {
|
|
323
323
|
const p2 = op.payload;
|
|
324
324
|
const list = model.escalations.get(op.artifactId) ?? [];
|
|
325
|
-
list.push({ part: p2.part ?? null, reason: p2.reason, by: op.actor, at: op.timestamp, resolved: false });
|
|
325
|
+
list.push({ part: p2.part ?? null, reason: p2.reason, by: op.actor, ...op.hand !== void 0 ? { hand: op.hand } : {}, at: op.timestamp, resolved: false });
|
|
326
326
|
model.escalations.set(op.artifactId, list);
|
|
327
327
|
break;
|
|
328
328
|
}
|
|
@@ -565,7 +565,7 @@ function findGap(model, gapId) {
|
|
|
565
565
|
return null;
|
|
566
566
|
}
|
|
567
567
|
function unresolvedEscalationsOf(model, id) {
|
|
568
|
-
return (model.escalations.get(id) ?? []).filter((e) => !e.resolved).map((e) => ({ part: e.part, reason: e.reason, by: e.by, at: e.at }));
|
|
568
|
+
return (model.escalations.get(id) ?? []).filter((e) => !e.resolved).map((e) => ({ part: e.part, reason: e.reason, by: e.by, ...e.hand !== void 0 ? { hand: e.hand } : {}, at: e.at }));
|
|
569
569
|
}
|
|
570
570
|
function listPendingReviews(model, workspace) {
|
|
571
571
|
const all = [...model.pendingReviews.values()];
|
|
@@ -23082,7 +23082,8 @@ function resolveDiscussContext(model, input) {
|
|
|
23082
23082
|
if (!a) throw new Error(`\u8282\u70B9\u4E0D\u5B58\u5728\uFF1A${input.artifactId}`);
|
|
23083
23083
|
workspace = a.workspace;
|
|
23084
23084
|
const escs = unresolvedEscalationsOf(model, input.artifactId);
|
|
23085
|
-
|
|
23085
|
+
const lastEsc = escs.at(-1);
|
|
23086
|
+
initiator = lastEsc?.by.startsWith("actor:agent:") ? lastEsc.by : lastEsc?.hand;
|
|
23086
23087
|
seed = escs.length ? `\u53D1\u8D77\u4EBA\u5C31\u4F60\u4E0A\u62A5\u7684\u95EE\u9898\u6765\u627E\u4F60\u4E86\uFF1A${escs.at(-1).reason}\u3002\u8BF7\u8BCA\u65AD\u6839\u56E0\u3001\u7ED9 1\u20132 \u4E2A\u65B9\u6848\u3001\u95EE ta \u91C7\u7528\u54EA\u4E2A\u3002` : `\u53D1\u8D77\u4EBA\u60F3\u548C\u4F60\u8BA8\u8BBA\u300C${input.artifactId}\u300D\u5F53\u524D\u7684\u5361\u70B9\u3002\u8BF7\u8BFB\u56FE\u8BCA\u65AD\u3001\u7ED9\u65B9\u6848\u518D\u95EE ta\u3002`;
|
|
23087
23088
|
} else {
|
|
23088
23089
|
throw new Error("discuss \u9700\u8981 artifactId \u6216 draftId");
|
|
@@ -37513,6 +37514,9 @@ var init_claude_code = __esm({
|
|
|
37513
37514
|
const telemetryCbs = [];
|
|
37514
37515
|
let eventSeq = 0;
|
|
37515
37516
|
let lastResult;
|
|
37517
|
+
const stderrTail = [];
|
|
37518
|
+
const STDERR_MAX_LINES = 40;
|
|
37519
|
+
const STDERR_MAX_BYTES = 4e3;
|
|
37516
37520
|
const usageAcc = newClaudeUsageAcc();
|
|
37517
37521
|
let sessionModel;
|
|
37518
37522
|
const outputCbs = [];
|
|
@@ -37552,7 +37556,19 @@ var init_claude_code = __esm({
|
|
|
37552
37556
|
for (const cb of outputCbs) cb(text);
|
|
37553
37557
|
});
|
|
37554
37558
|
}
|
|
37555
|
-
child.stderr
|
|
37559
|
+
const stderrRl = readline.createInterface({ input: child.stderr });
|
|
37560
|
+
stderrRl.on("line", (line) => {
|
|
37561
|
+
try {
|
|
37562
|
+
out.write(line + "\n");
|
|
37563
|
+
} catch {
|
|
37564
|
+
}
|
|
37565
|
+
stderrTail.push(line);
|
|
37566
|
+
while (stderrTail.length > STDERR_MAX_LINES) stderrTail.shift();
|
|
37567
|
+
let total = stderrTail.reduce((n, l) => n + l.length + 1, 0);
|
|
37568
|
+
while (total > STDERR_MAX_BYTES && stderrTail.length > 1) {
|
|
37569
|
+
total -= stderrTail.shift().length + 1;
|
|
37570
|
+
}
|
|
37571
|
+
});
|
|
37556
37572
|
const callbacks = [];
|
|
37557
37573
|
let exited;
|
|
37558
37574
|
let killedByUs = false;
|
|
@@ -37563,14 +37579,15 @@ var init_claude_code = __esm({
|
|
|
37563
37579
|
child.on("error", (err) => {
|
|
37564
37580
|
if (exited) return;
|
|
37565
37581
|
clearTimeout(timer);
|
|
37582
|
+
const spawnErr = err instanceof Error ? err.message : String(err);
|
|
37566
37583
|
try {
|
|
37567
37584
|
out.write(`
|
|
37568
|
-
[adapter] spawn \u5931\u8D25\uFF1A${
|
|
37585
|
+
[adapter] spawn \u5931\u8D25\uFF1A${spawnErr}
|
|
37569
37586
|
`);
|
|
37570
37587
|
out.end();
|
|
37571
37588
|
} catch {
|
|
37572
37589
|
}
|
|
37573
|
-
exited = { code: null, reason: "error", transcriptRef };
|
|
37590
|
+
exited = { code: null, reason: "error", transcriptRef, errorMessage: spawnErr };
|
|
37574
37591
|
for (const cb of callbacks.splice(0)) cb(exited);
|
|
37575
37592
|
});
|
|
37576
37593
|
child.on("exit", (code) => {
|
|
@@ -37595,7 +37612,24 @@ var init_claude_code = __esm({
|
|
|
37595
37612
|
}
|
|
37596
37613
|
}
|
|
37597
37614
|
const usage = buildClaudeUsage(usageAcc);
|
|
37598
|
-
|
|
37615
|
+
const isError = !killedByUs && (typeof code === "number" && code !== 0 || reason === "error" || reason === "output-limit" || reason === "rate-limit");
|
|
37616
|
+
const errorParts = [];
|
|
37617
|
+
if (lastResult?.is_error === true) {
|
|
37618
|
+
const subtype = typeof lastResult.subtype === "string" ? lastResult.subtype : "";
|
|
37619
|
+
const body = typeof lastResult.result === "string" ? lastResult.result : "";
|
|
37620
|
+
const composed = [subtype && `[${subtype}]`, body].filter(Boolean).join(" ").trim();
|
|
37621
|
+
if (composed) errorParts.push(composed);
|
|
37622
|
+
}
|
|
37623
|
+
if (stderrTail.length) errorParts.push(stderrTail.join("\n").trim());
|
|
37624
|
+
const errorMessage = isError ? errorParts.filter(Boolean).join("\n---\n").slice(-4e3).trim() || void 0 : void 0;
|
|
37625
|
+
exited = {
|
|
37626
|
+
code: killedByUs ? null : code,
|
|
37627
|
+
...reason ? { reason } : {},
|
|
37628
|
+
transcriptRef,
|
|
37629
|
+
...usage ? { usage } : {},
|
|
37630
|
+
...sessionModel ? { model: sessionModel } : {},
|
|
37631
|
+
...errorMessage ? { errorMessage } : {}
|
|
37632
|
+
};
|
|
37599
37633
|
for (const cb of callbacks.splice(0)) cb(exited);
|
|
37600
37634
|
});
|
|
37601
37635
|
return {
|
|
@@ -38721,10 +38755,26 @@ var init_codex = __esm({
|
|
|
38721
38755
|
if (stdoutErrorLines.length > 10) stdoutErrorLines.shift();
|
|
38722
38756
|
}
|
|
38723
38757
|
};
|
|
38758
|
+
const streamErrorMessages = [];
|
|
38759
|
+
const pushStreamErrorLine = (line) => {
|
|
38760
|
+
let obj;
|
|
38761
|
+
try {
|
|
38762
|
+
obj = JSON.parse(line);
|
|
38763
|
+
} catch {
|
|
38764
|
+
return;
|
|
38765
|
+
}
|
|
38766
|
+
if (obj?.type === "error" && typeof obj.message === "string") {
|
|
38767
|
+
streamErrorMessages.push(obj.message);
|
|
38768
|
+
} else if (obj?.type === "turn.failed" && typeof obj.error?.message === "string") {
|
|
38769
|
+
streamErrorMessages.push(obj.error.message);
|
|
38770
|
+
}
|
|
38771
|
+
if (streamErrorMessages.length > 5) streamErrorMessages.shift();
|
|
38772
|
+
};
|
|
38724
38773
|
const rl = readline2.createInterface({ input: child.stdout });
|
|
38725
38774
|
rl.on("line", (line) => {
|
|
38726
38775
|
out.write(line + "\n");
|
|
38727
38776
|
pushStdoutErrorLine(line);
|
|
38777
|
+
pushStreamErrorLine(line);
|
|
38728
38778
|
emitNormalized(normalizeCodexStreamLine(line, normalizeState));
|
|
38729
38779
|
});
|
|
38730
38780
|
const errRl = readline2.createInterface({ input: child.stderr });
|
|
@@ -38772,11 +38822,13 @@ var init_codex = __esm({
|
|
|
38772
38822
|
const telemetry = scanCodexTelemetry(dir, startedAtMs);
|
|
38773
38823
|
const model = telemetry.model ?? job.model ?? this.opts.model;
|
|
38774
38824
|
const runtimeSessionId = telemetry.sessionId ?? (job.resumeRuntimeSession ? job.runtimeSessionId : void 0);
|
|
38775
|
-
const
|
|
38776
|
-
const
|
|
38825
|
+
const sawStreamError = streamErrorMessages.length > 0;
|
|
38826
|
+
const isError = !killedByUs && (typeof code === "number" && code !== 0 || sawStreamError);
|
|
38827
|
+
const errorMessage = isError ? [...streamErrorMessages, ...stdoutErrorLines, ...stderrTail].join("\n").trim().slice(-4e3) || void 0 : void 0;
|
|
38828
|
+
const reason = killedByUs ? "timeout" : sawStreamError ? "error" : code === 0 ? "clean" : "error";
|
|
38777
38829
|
finish({
|
|
38778
38830
|
code: killedByUs ? null : code,
|
|
38779
|
-
reason
|
|
38831
|
+
reason,
|
|
38780
38832
|
transcriptRef,
|
|
38781
38833
|
...telemetry.usage ? { usage: telemetry.usage } : {},
|
|
38782
38834
|
...model ? { model } : {},
|
|
@@ -39962,7 +40014,18 @@ function runStreamJson(job, cfg) {
|
|
|
39962
40014
|
const { finish, exited } = makeFinish(id, cfg, transcriptRefPtr, transcriptOut, dir, exitCbs);
|
|
39963
40015
|
let killedByUs = false;
|
|
39964
40016
|
let seq = 0;
|
|
39965
|
-
|
|
40017
|
+
const stderrTail = [];
|
|
40018
|
+
const stderrRl = readline4.createInterface({ input: child.stderr });
|
|
40019
|
+
stderrRl.on("line", (line) => {
|
|
40020
|
+
try {
|
|
40021
|
+
transcriptOut.write(line + "\n");
|
|
40022
|
+
} catch {
|
|
40023
|
+
}
|
|
40024
|
+
stderrTail.push(line);
|
|
40025
|
+
while (stderrTail.length > 40) stderrTail.shift();
|
|
40026
|
+
let total = stderrTail.reduce((n, l) => n + l.length + 1, 0);
|
|
40027
|
+
while (total > 4e3 && stderrTail.length > 1) total -= stderrTail.shift().length + 1;
|
|
40028
|
+
});
|
|
39966
40029
|
const state = cfg.createState();
|
|
39967
40030
|
const rl = readline4.createInterface({ input: child.stdout });
|
|
39968
40031
|
rl.on("line", (line) => {
|
|
@@ -39983,7 +40046,14 @@ function runStreamJson(job, cfg) {
|
|
|
39983
40046
|
});
|
|
39984
40047
|
child.on("exit", (code) => {
|
|
39985
40048
|
clearTimeout(timer);
|
|
39986
|
-
|
|
40049
|
+
const isError = !killedByUs && typeof code === "number" && code !== 0;
|
|
40050
|
+
const errorMessage = isError ? stderrTail.join("\n").trim().slice(-4e3) || void 0 : void 0;
|
|
40051
|
+
finish({
|
|
40052
|
+
code: killedByUs ? null : code,
|
|
40053
|
+
reason: killedByUs ? "timeout" : code === 0 ? "clean" : "error",
|
|
40054
|
+
transcriptRef: transcriptRefPtr.value,
|
|
40055
|
+
...errorMessage ? { errorMessage } : {}
|
|
40056
|
+
});
|
|
39987
40057
|
});
|
|
39988
40058
|
const current = exited();
|
|
39989
40059
|
return Promise.resolve({
|
|
@@ -40023,7 +40093,18 @@ function runOneShotText(job, cfg) {
|
|
|
40023
40093
|
const text = chunk.toString("utf8");
|
|
40024
40094
|
for (const cb of outputCbs) cb(text);
|
|
40025
40095
|
});
|
|
40026
|
-
|
|
40096
|
+
const stderrTail = [];
|
|
40097
|
+
const stderrRl = readline4.createInterface({ input: child.stderr });
|
|
40098
|
+
stderrRl.on("line", (line) => {
|
|
40099
|
+
try {
|
|
40100
|
+
transcriptOut.write(line + "\n");
|
|
40101
|
+
} catch {
|
|
40102
|
+
}
|
|
40103
|
+
stderrTail.push(line);
|
|
40104
|
+
while (stderrTail.length > 40) stderrTail.shift();
|
|
40105
|
+
let total = stderrTail.reduce((n, l) => n + l.length + 1, 0);
|
|
40106
|
+
while (total > 4e3 && stderrTail.length > 1) total -= stderrTail.shift().length + 1;
|
|
40107
|
+
});
|
|
40027
40108
|
const timer = setTimeout(() => {
|
|
40028
40109
|
killedByUs = true;
|
|
40029
40110
|
child.kill("SIGKILL");
|
|
@@ -40034,7 +40115,14 @@ function runOneShotText(job, cfg) {
|
|
|
40034
40115
|
});
|
|
40035
40116
|
child.on("exit", (code) => {
|
|
40036
40117
|
clearTimeout(timer);
|
|
40037
|
-
|
|
40118
|
+
const isError = !killedByUs && typeof code === "number" && code !== 0;
|
|
40119
|
+
const errorMessage = isError ? stderrTail.join("\n").trim().slice(-4e3) || void 0 : void 0;
|
|
40120
|
+
finish({
|
|
40121
|
+
code: killedByUs ? null : code,
|
|
40122
|
+
reason: killedByUs ? "timeout" : code === 0 ? "clean" : "error",
|
|
40123
|
+
transcriptRef: transcriptRefPtr.value,
|
|
40124
|
+
...errorMessage ? { errorMessage } : {}
|
|
40125
|
+
});
|
|
40038
40126
|
});
|
|
40039
40127
|
const current = exited();
|
|
40040
40128
|
return Promise.resolve({
|
|
@@ -40790,7 +40878,7 @@ Write-Host " Remove : Unregister-ScheduledTask -TaskName 'OasisNode' -Confirm:$
|
|
|
40790
40878
|
}
|
|
40791
40879
|
function buildNpxCmd(p2) {
|
|
40792
40880
|
const namePart = p2.nodeName ? ` --name ${p2.nodeName}` : "";
|
|
40793
|
-
return `
|
|
40881
|
+
return `npx -y oasis_test@latest start --server-ws ${p2.gatewayUrl}${namePart} --enroll-token ${p2.token}`;
|
|
40794
40882
|
}
|
|
40795
40883
|
var init_connect_script = __esm({
|
|
40796
40884
|
"../server/src/domains/nodes/connect-script.ts"() {
|
|
@@ -58701,7 +58789,7 @@ ${res.warning}`);
|
|
|
58701
58789
|
}
|
|
58702
58790
|
|
|
58703
58791
|
// src/index.ts
|
|
58704
|
-
var PKG_VERSION = true ? "0.1.
|
|
58792
|
+
var PKG_VERSION = true ? "0.1.49" : "dev";
|
|
58705
58793
|
var OASIS_DIR = path19.join(os11.homedir(), ".oasis");
|
|
58706
58794
|
var CONFIG_FILE = path19.join(OASIS_DIR, "node-config.json");
|
|
58707
58795
|
var PID_FILE = path19.join(OASIS_DIR, "node.pid");
|