@threadbase-sh/streamer 1.70.2 → 1.70.4
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/cli.cjs +25 -20
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +24 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -19
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/services/questions/detectQuestionFromScreen.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2665,6 +2665,15 @@ var OPTION_RE2 = /^\s*(?:❯)?\s*(\d+)\.\s+(.+?)\s*$/;
|
|
|
2665
2665
|
var QUESTION_RE = /\?\s*$/;
|
|
2666
2666
|
var BOX_ONLY_RE2 = /^[\s│─┌┐└┘├┤┬┴┼╭╮╰╯╱╲=_-]+$/;
|
|
2667
2667
|
var PERMISSION_LABEL_RE = /^(Yes|No)\b/i;
|
|
2668
|
+
var KNOWN_STATE_MARKER_RE = /^(?:\[(?:[ xX*]|✓|✔)\]|[☐☑☒])\s*/;
|
|
2669
|
+
var UNKNOWN_STATE_MARKER_RE = /^(?:\[[^\]]{0,3}\]|\([^)]{0,3}\))\s*/;
|
|
2670
|
+
function stripStateMarker(label) {
|
|
2671
|
+
if (KNOWN_STATE_MARKER_RE.test(label)) {
|
|
2672
|
+
return { label: label.replace(KNOWN_STATE_MARKER_RE, ""), marked: true };
|
|
2673
|
+
}
|
|
2674
|
+
if (UNKNOWN_STATE_MARKER_RE.test(label)) return { label, marked: true };
|
|
2675
|
+
return { label, marked: false };
|
|
2676
|
+
}
|
|
2668
2677
|
function stripBoxGutter(line) {
|
|
2669
2678
|
return line.replace(/^\s*[│|]\s?/, "").replace(/\s*[│|]\s*$/, "");
|
|
2670
2679
|
}
|
|
@@ -2679,6 +2688,7 @@ function detectQuestionFromScreen(lines) {
|
|
|
2679
2688
|
if (footerIdx === -1) return null;
|
|
2680
2689
|
const options = [];
|
|
2681
2690
|
let firstOptionIdx = -1;
|
|
2691
|
+
let sawStateMarker = false;
|
|
2682
2692
|
for (let i = footerIdx - 1; i >= 0; i--) {
|
|
2683
2693
|
const line = lines[i];
|
|
2684
2694
|
const inner = stripBoxGutter(line);
|
|
@@ -2692,8 +2702,10 @@ function detectQuestionFromScreen(lines) {
|
|
|
2692
2702
|
if (options.length > 0 && QUESTION_RE.test(trimmed) && !OPTION_RE2.test(inner)) break;
|
|
2693
2703
|
const m = OPTION_RE2.exec(inner);
|
|
2694
2704
|
if (m) {
|
|
2695
|
-
const
|
|
2696
|
-
if (PERMISSION_LABEL_RE.test(
|
|
2705
|
+
const rendered = m[2].trim();
|
|
2706
|
+
if (PERMISSION_LABEL_RE.test(rendered)) return null;
|
|
2707
|
+
const { label, marked } = stripStateMarker(rendered);
|
|
2708
|
+
if (marked) sawStateMarker = true;
|
|
2697
2709
|
options.unshift({ label, description: "" });
|
|
2698
2710
|
firstOptionIdx = i;
|
|
2699
2711
|
}
|
|
@@ -2712,7 +2724,7 @@ function detectQuestionFromScreen(lines) {
|
|
|
2712
2724
|
}
|
|
2713
2725
|
if (!question) return null;
|
|
2714
2726
|
return {
|
|
2715
|
-
questions: [{ question, header: "", multiSelect:
|
|
2727
|
+
questions: [{ question, header: "", multiSelect: sawStateMarker, options }]
|
|
2716
2728
|
};
|
|
2717
2729
|
}
|
|
2718
2730
|
function isQuestionMenuOnScreen(lines) {
|
|
@@ -18515,23 +18527,16 @@ var StreamerServer = class {
|
|
|
18515
18527
|
* it.
|
|
18516
18528
|
*/
|
|
18517
18529
|
async resolveConversationTarget(sessionId) {
|
|
18518
|
-
|
|
18519
|
-
|
|
18520
|
-
|
|
18521
|
-
|
|
18522
|
-
|
|
18523
|
-
|
|
18524
|
-
|
|
18525
|
-
if (boundId != null && boundId !== sessionId) {
|
|
18526
|
-
historyId = boundId;
|
|
18527
|
-
registryProvider = row?.provider;
|
|
18528
|
-
jsonlPath = this.conversationHandlers.findJsonlPath(boundId);
|
|
18529
|
-
conv = await this.conversationHandlers.findConversationByUuid(boundId);
|
|
18530
|
-
}
|
|
18531
|
-
}
|
|
18530
|
+
const row = this.managedSessionsRepo?.get(sessionId) ?? null;
|
|
18531
|
+
const liveSession = this.sessionStore.getManaged(sessionId);
|
|
18532
|
+
const resumeId = (row ? resumeIdForRow(row) : null) ?? (liveSession?.provider === CODEX_CLI_PROVIDER ? liveSession.boundConversationId ?? null : null);
|
|
18533
|
+
const historyId = resumeId ?? sessionId;
|
|
18534
|
+
const managedProvider = row?.provider ?? liveSession?.provider;
|
|
18535
|
+
const jsonlPath = this.conversationHandlers.findJsonlPath(historyId);
|
|
18536
|
+
const conv = await this.conversationHandlers.findConversationByUuid(historyId);
|
|
18532
18537
|
const cachedConvMeta = this.cache?.getMetaById(historyId);
|
|
18533
18538
|
const cachedPath = cachedConvMeta?.filePath ? toNativeFilePath(cachedConvMeta.filePath) : null;
|
|
18534
|
-
const cachedCodexPath = (
|
|
18539
|
+
const cachedCodexPath = (managedProvider === CODEX_CLI_PROVIDER || cachedConvMeta?.provider === CODEX_CLI_PROVIDER) && cachedPath != null && existsSync16(cachedPath) ? cachedPath : null;
|
|
18535
18540
|
const jsonlCwd = jsonlPath ? await this.conversationHandlers.readCwdFromJsonl(jsonlPath) : null;
|
|
18536
18541
|
const projectPath = jsonlCwd ?? conv?.projectPath ?? (cachedCodexPath ? cachedConvMeta?.projectPath : null);
|
|
18537
18542
|
if (!projectPath) {
|
|
@@ -18541,7 +18546,7 @@ var StreamerServer = class {
|
|
|
18541
18546
|
return { ok: false, reason: "no_project_path" };
|
|
18542
18547
|
}
|
|
18543
18548
|
const provider = coerceProviderForRunner(
|
|
18544
|
-
conv?.provider ?? cachedConvMeta?.provider ??
|
|
18549
|
+
conv?.provider ?? cachedConvMeta?.provider ?? managedProvider
|
|
18545
18550
|
);
|
|
18546
18551
|
return {
|
|
18547
18552
|
ok: true,
|