@firstpick/pi-package-webui 0.9.2 → 0.9.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/README.md +14 -8
- package/bin/pi-webui.mjs +256 -39
- package/index.ts +266 -1
- package/lib/git-workflow-preferences.mjs +8 -25
- package/lib/intercom-conversations.mjs +491 -0
- package/lib/intercom-transcript-filter.mjs +99 -0
- package/lib/resource-selection.mjs +140 -0
- package/package.json +2 -2
- package/public/app.js +1061 -119
- package/public/index.html +31 -6
- package/public/service-worker.js +2 -1
- package/public/stream-output-controller.mjs +15 -0
- package/public/styles.css +426 -1
- package/public/syntax-highlight.mjs +622 -0
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/interaction-continuity.spec.mjs +34 -0
- package/tests/browser/intercom-conversation-viewer.spec.mjs +357 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +61 -0
- package/tests/browser/resource-profiles.spec.mjs +200 -0
- package/tests/browser/subagent-observability.spec.mjs +29 -0
- package/tests/codex-fast-mode-static.test.mjs +7 -6
- package/tests/common-options-submenus-interaction-static.test.mjs +2 -0
- package/tests/common-options-submenus-markup-static.test.mjs +1 -0
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/composer-skill-tag-layout.test.mjs +32 -2
- package/tests/control-deck-component-updates-static.test.mjs +4 -0
- package/tests/controls-layout-static.test.mjs +3 -3
- package/tests/fast-mode-client-static.test.mjs +2 -2
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/feature-system-prompt-optional-feature-static.test.mjs +5 -5
- package/tests/file-viewer-image-static.test.mjs +69 -0
- package/tests/fixtures/fake-pi.mjs +105 -6
- package/tests/foreground-transcript-catch-up-static.test.mjs +1 -1
- package/tests/git-panel-file-preview-static.test.mjs +5 -5
- package/tests/git-panel-live-updates-static.test.mjs +3 -3
- package/tests/git-workflow-preferences.test.mjs +4 -4
- package/tests/http-endpoints-harness.test.mjs +124 -2
- package/tests/intercom-conversation-viewer-static.test.mjs +106 -0
- package/tests/intercom-conversations-http.test.mjs +252 -0
- package/tests/intercom-conversations.test.mjs +374 -0
- package/tests/intercom-main-transcript-suppression-static.test.mjs +52 -0
- package/tests/intercom-tag-layout-static.test.mjs +46 -0
- package/tests/intercom-transcript-filter.test.mjs +98 -0
- package/tests/main-output-loading-static.test.mjs +59 -0
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-compact-layout.test.mjs +2 -3
- package/tests/mobile-continuity-tablet-static.test.mjs +6 -6
- package/tests/mobile-foundation-static.test.mjs +3 -3
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/mobile-static.test.mjs +66 -42
- package/tests/native-parity.test.mjs +8 -7
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/optional-feature-migration-frontend.test.mjs +5 -5
- package/tests/optional-feature-resource-setup-static.test.mjs +29 -0
- package/tests/persistent-ui-layout-static.test.mjs +3 -3
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/remote-auth-settings-harness.test.mjs +1 -1
- package/tests/resource-defaults-helper.test.mjs +60 -6
- package/tests/resource-selection.test.mjs +114 -0
- package/tests/resource-tui-extension.test.mjs +23 -0
- package/tests/session-sampling-ui-static.test.mjs +3 -3
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/stream-output-controller.test.mjs +8 -0
- package/tests/stream-output-isolation-static.test.mjs +2 -2
- package/tests/streaming-ui-coupling.test.mjs +5 -0
- package/tests/subagent-gate-visibility.test.mjs +1 -1
- package/tests/subagent-launch-slots.test.mjs +1 -1
- package/tests/subagent-observability-static.test.mjs +5 -3
- package/tests/subagent-reliability-integration.test.mjs +23 -1
- package/tests/subagent-workflow-section-static.test.mjs +67 -0
- package/tests/subagents-helper.test.mjs +313 -1
- package/tests/syntax-highlight.test.mjs +235 -0
- package/tests/syntax-highlighting-static.test.mjs +84 -0
- package/tests/terminal-cwd-grouping-static.test.mjs +22 -0
- package/tests/theme-customizer-static.test.mjs +5 -5
- package/tests/thinking-format-parser.test.mjs +64 -0
- package/tests/webui-settings-locking.test.mjs +1 -1
- package/webui-rpc-helper.mjs +417 -74
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { SUPPORTED_SYNTAX_LANGUAGES, SYNTAX_LANGUAGE_ALIASES } from "../public/syntax-highlight.mjs";
|
|
6
|
+
import { THEME_TOKEN_GROUPS } from "../public/theme-contract.mjs";
|
|
7
|
+
|
|
8
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
9
|
+
const [app, css, html, serviceWorker, pkg, readme, technical, development] = await Promise.all([
|
|
10
|
+
readFile(join(root, "public", "app.js"), "utf8"),
|
|
11
|
+
readFile(join(root, "public", "styles.css"), "utf8"),
|
|
12
|
+
readFile(join(root, "public", "index.html"), "utf8"),
|
|
13
|
+
readFile(join(root, "public", "service-worker.js"), "utf8"),
|
|
14
|
+
readFile(join(root, "package.json"), "utf8"),
|
|
15
|
+
readFile(join(root, "README.md"), "utf8"),
|
|
16
|
+
readFile(join(root, "TECHNICAL.md"), "utf8"),
|
|
17
|
+
readFile(join(root, "DEVELOPMENT.md"), "utf8"),
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
function appFunctionSource(name) {
|
|
21
|
+
const start = app.indexOf(`function ${name}(`);
|
|
22
|
+
assert.notEqual(start, -1, `app.js should define ${name}`);
|
|
23
|
+
const end = app.indexOf("\n}\n", start);
|
|
24
|
+
assert.notEqual(end, -1, `${name} should be a complete declaration`);
|
|
25
|
+
return app.slice(start, end + 3);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const SYNTAX_TOKEN_NAMES = THEME_TOKEN_GROUPS.find((group) => group.id === "syntax")?.tokens.map(({ name }) => name) || [];
|
|
29
|
+
assert.equal(SYNTAX_TOKEN_NAMES.length, 9, "the shared theme contract should still expose exactly nine syntax tokens");
|
|
30
|
+
|
|
31
|
+
// --- Renderer wiring: the pure tokenizer owns fenced code text ---
|
|
32
|
+
assert.match(app, /import \{ tokenizeCode \} from "\.\/syntax-highlight\.mjs";/, "the app should import the shared pure tokenizer");
|
|
33
|
+
|
|
34
|
+
const renderTokens = appFunctionSource("appendMarkdownCodeTokens");
|
|
35
|
+
assert.match(renderTokens, /const tokens = tokenizeCode\(source, normalizedMarkdownLanguage\(language\)\)/, "fenced code should tokenize through the normalized Markdown language alias");
|
|
36
|
+
assert.match(renderTokens, /if \(!tokens\.length\) \{\s*codeNode\.textContent = source;\s*return;\s*\}/, "an empty token list should fall back to the exact source text");
|
|
37
|
+
assert.match(renderTokens, /if \(type === "plain"\) codeNode\.append\(document\.createTextNode\(text\)\)/, "plain tokens should render as bare text nodes");
|
|
38
|
+
assert.match(renderTokens, /else codeNode\.append\(make\("span", `syntax-token syntax-\$\{type\}`, text\)\)/, "styled tokens should render as spans whose text is assigned through make()/textContent");
|
|
39
|
+
|
|
40
|
+
const codeBlock = appFunctionSource("appendMarkdownCodeBlock");
|
|
41
|
+
assert.match(codeBlock, /if \(closed && isMermaidLanguage\(language\)\) \{\s*appendMarkdownMermaidBlock\(parent, code\)/, "Mermaid blocks must keep their existing dedicated rendering path");
|
|
42
|
+
assert.match(codeBlock, /appendMarkdownCodeTokens\(codeNode, String\(code \|\| ""\)\.replace\(\/\\n\+\$\/g, ""\), language\)/, "fenced code blocks should render through the tokenizing helper");
|
|
43
|
+
assert.doesNotMatch(codeBlock, /codeNode\.textContent = /, "the fenced-code path should no longer assign source text directly");
|
|
44
|
+
assert.match(codeBlock, /attachMarkdownCodeCopyButton\(wrapper\);/, "copy controls should remain attached to highlighted code blocks");
|
|
45
|
+
|
|
46
|
+
// --- DOM safety: source must never reach an HTML sink ---
|
|
47
|
+
for (const source of [renderTokens, codeBlock]) {
|
|
48
|
+
assert.doesNotMatch(source, /innerHTML|insertAdjacentHTML|outerHTML|document\.write/, "highlighted code must never be injected through an HTML parsing sink");
|
|
49
|
+
}
|
|
50
|
+
assert.doesNotMatch(app, /replaceHtml\([^)]*codeNode/, "code nodes must not be populated through the transcript HTML helper");
|
|
51
|
+
|
|
52
|
+
// --- Theme wiring: every contract syntax token drives one CSS variable ---
|
|
53
|
+
for (const token of SYNTAX_TOKEN_NAMES) {
|
|
54
|
+
const variable = `--syntax-${token.replace(/^syntax/, "").replace(/^[A-Z]/, (character) => character.toLowerCase())}`;
|
|
55
|
+
assert.match(app, new RegExp(`"${variable}": themeColor\\(theme, "${token}",`), `applyTheme should map the ${token} theme token to ${variable}`);
|
|
56
|
+
assert.match(css, new RegExp(`\\.markdown-code \\.${variable.slice(2)} \\{[^}]*var\\(${variable}, var\\(--ctp-[a-z]+\\)\\)`), `styles should color ${variable.slice(2)} from the theme variable with a Catppuccin fallback`);
|
|
57
|
+
}
|
|
58
|
+
assert.match(css, /\.markdown-code \.syntax-token \{\s*color: inherit;/, "the base token class should stay visually neutral");
|
|
59
|
+
assert.match(css, /\.markdown-code \.syntax-comment \{[^}]*font-style: italic;/, "comments should remain distinguishable without relying on color alone");
|
|
60
|
+
|
|
61
|
+
// --- Offline/PWA startup closure and coherent revisions ---
|
|
62
|
+
assert.match(serviceWorker, /"\/syntax-highlight\.mjs",/, "the eagerly imported tokenizer must be part of the offline app shell");
|
|
63
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v112"/, "adding a startup module should advance the PWA cache identity");
|
|
64
|
+
assert.match(html, /styles\.css\?v=126/, "new token styles should advance the stylesheet revision");
|
|
65
|
+
assert.match(html, /data-app-src="\/app\.js\?v=148"/, "new renderer wiring should advance the app module revision");
|
|
66
|
+
assert.match(pkg, /node --check public\/syntax-highlight\.mjs/, "the package check should syntax-check the startup-critical tokenizer");
|
|
67
|
+
|
|
68
|
+
const appShell = serviceWorker.slice(serviceWorker.indexOf("const APP_SHELL"), serviceWorker.indexOf("];", serviceWorker.indexOf("const APP_SHELL")));
|
|
69
|
+
for (const [, specifier] of app.matchAll(/^import [^"]*"\.\/([a-z0-9-]+\.mjs)";$/gm)) {
|
|
70
|
+
assert.ok(appShell.includes(`"/${specifier}"`), `eagerly imported ${specifier} must stay inside the offline app shell`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// --- Documented language coverage stays truthful ---
|
|
74
|
+
for (const alias of ["python", "js", "ts", "bash", "powershell", "cmd", "json", "ini", "toml", "yaml"]) {
|
|
75
|
+
assert.ok(Object.hasOwn(SYNTAX_LANGUAGE_ALIASES, alias), `the requested ${alias} alias should be supported by the tokenizer`);
|
|
76
|
+
}
|
|
77
|
+
assert.ok(SUPPORTED_SYNTAX_LANGUAGES.includes("diff"), "diff blocks should use the approved low-cost profile");
|
|
78
|
+
|
|
79
|
+
assert.match(readme, /[Ss]yntax highlighting/, "the README should make syntax highlighting visible as a user-facing feature");
|
|
80
|
+
assert.match(technical, /## Code block syntax highlighting[\s\S]*50,000[\s\S]*2,000/, "the technical reference should document the supported languages and the highlighting limits as a top-level feature");
|
|
81
|
+
assert.match(technical, /Syntax Highlighting/, "the technical reference should explain that theme syntax colors drive highlighting");
|
|
82
|
+
assert.match(development, /syntax-highlight\.mjs/, "the development guide should document the tokenizer module for contributors");
|
|
83
|
+
|
|
84
|
+
console.log("syntax-highlighting-static: all assertions passed");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
|
|
4
|
+
const app = readFileSync(new URL("../public/app.js", import.meta.url), "utf8");
|
|
5
|
+
const styles = readFileSync(new URL("../public/styles.css", import.meta.url), "utf8");
|
|
6
|
+
const predicateSource = app.match(/function shouldRenderTerminalTabGroup\(group, groupCount\) \{([\s\S]*?)\n\}/)?.[1];
|
|
7
|
+
assert.ok(predicateSource, "terminal CWD grouping predicate should be present");
|
|
8
|
+
|
|
9
|
+
const shouldRenderTerminalTabGroup = new Function("group", "groupCount", predicateSource);
|
|
10
|
+
assert.equal(shouldRenderTerminalTabGroup({ custom: false, cwd: "/repo/one", tabs: [{}] }, 2), false, "a one-tab CWD should remain a normal tab instead of duplicating itself in a group dropdown");
|
|
11
|
+
assert.equal(shouldRenderTerminalTabGroup({ custom: false, cwd: "/repo/one", tabs: [{}, {}] }, 2), true, "a multi-tab CWD should retain its group dropdown");
|
|
12
|
+
assert.equal(shouldRenderTerminalTabGroup({ custom: false, cwd: "", tabs: [{}, {}] }, 2), false, "tabs without a CWD should remain ungrouped");
|
|
13
|
+
assert.equal(shouldRenderTerminalTabGroup({ custom: true, cwd: "", tabs: [{}] }, 2), false, "a one-tab custom group should remain ungrouped");
|
|
14
|
+
assert.equal(shouldRenderTerminalTabGroup({ custom: true, cwd: "", tabs: [{}, {}] }, 1), true, "multi-tab custom groups should retain their existing behavior");
|
|
15
|
+
|
|
16
|
+
assert.match(app, /function createTerminalTabCwdAddMenu\(tab\)[\s\S]*make\("div", "terminal-tab-cwd-add-menu"\)[\s\S]*make\("button", "terminal-tab-group-add terminal-tab-cwd-add", "\+ Tab"\)[\s\S]*createTerminalTab\(tab\.cwd \|\| currentDirectoryForNewTab\(\)/, "a singleton CWD should receive a below-tab + Tab menu using its directory");
|
|
17
|
+
assert.match(app, /const showCwdAdd = groups\.length > 1 && group\.tabs\.length === 1 && Boolean\(group\.cwd\);[\s\S]*renderTerminalTab\(tab, \{ showCwdAdd \}\)/, "the direct + Tab action should appear only for singleton CWDs when multiple CWD groups are open");
|
|
18
|
+
assert.match(app, /function renderTerminalTab\(tab, \{ showCwdAdd = false \} = \{\}\)[\s\S]*terminal-tab-cwd-add-host[\s\S]*if \(showCwdAdd\) wrapper\.append\(createTerminalTabCwdAddMenu\(tab\)\)/, "singleton CWDs should stay on the regular tab rendering path with a separate add-only menu");
|
|
19
|
+
assert.match(styles, /\.terminal-tab-cwd-add-menu \{[\s\S]*position:\s*absolute;[\s\S]*inset:\s*100% 0 auto 0;[\s\S]*display:\s*none;/, "the singleton + Tab menu should sit hidden directly below its tab");
|
|
20
|
+
assert.match(styles, /\.terminal-tab-cwd-add-host:hover \.terminal-tab-cwd-add-menu,\n\.terminal-tab-cwd-add-host:focus-within \.terminal-tab-cwd-add-menu \{\n\s+display:\s*flex;/, "hover or keyboard focus should reveal the singleton + Tab menu");
|
|
21
|
+
|
|
22
|
+
console.log("terminal-cwd-grouping-static.test.mjs passed");
|
|
@@ -5,13 +5,13 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
import { REQUIRED_THEME_TOKENS, THEME_TOKEN_GROUPS } from "../public/theme-contract.mjs";
|
|
6
6
|
|
|
7
7
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
-
const [app, html, css, serviceWorker, pkg,
|
|
8
|
+
const [app, html, css, serviceWorker, pkg, technical] = await Promise.all([
|
|
9
9
|
readFile(join(root, "public", "app.js"), "utf8"),
|
|
10
10
|
readFile(join(root, "public", "index.html"), "utf8"),
|
|
11
11
|
readFile(join(root, "public", "styles.css"), "utf8"),
|
|
12
12
|
readFile(join(root, "public", "service-worker.js"), "utf8"),
|
|
13
13
|
readFile(join(root, "package.json"), "utf8"),
|
|
14
|
-
readFile(join(root, "
|
|
14
|
+
readFile(join(root, "TECHNICAL.md"), "utf8"),
|
|
15
15
|
]);
|
|
16
16
|
|
|
17
17
|
assert.equal(THEME_TOKEN_GROUPS.length, 7, "customizer contract should expose seven labelled groups");
|
|
@@ -34,7 +34,7 @@ assert.match(html, /role="alert" hidden>[\s\S]*Replace this exact target\?/, "ov
|
|
|
34
34
|
|
|
35
35
|
assert.match(app, /from "\.\/theme-contract\.mjs"/, "frontend should consume the shared browser-safe theme contract");
|
|
36
36
|
assert.match(serviceWorker, /"\/theme-contract\.mjs"/, "the PWA app shell should cache the startup-critical theme contract");
|
|
37
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
37
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v112"/, "adding the theme contract to the startup graph should advance the PWA cache identity");
|
|
38
38
|
assert.match(pkg, /node --check public\/theme-contract\.mjs/, "the package check should syntax-check the startup-critical theme contract");
|
|
39
39
|
assert.match(app, /function themeDraftFromCatalog\(theme, name = theme\?\.name\)[\s\S]*colors: cloneThemeDraft\(theme\?\.colors \|\| \{\}\)/, "catalog metadata should be projected into a schema-only editable draft");
|
|
40
40
|
assert.match(app, /for \(const \{ name, label \} of group\.tokens\)/, "visual controls should render from the exact shared token inventory");
|
|
@@ -76,7 +76,7 @@ assert.match(css, /\.extension-dialog\.theme-customizer-dialog \{[\s\S]*inset: 0
|
|
|
76
76
|
assert.match(css, /\.theme-token-swatch \{[^}]*width: 44px[^}]*height: 44px/, "visual color targets should remain at least 44px");
|
|
77
77
|
assert.match(css, /env\(safe-area-inset-bottom\)/, "dialog actions should honor mobile safe-area insets");
|
|
78
78
|
|
|
79
|
-
assert.match(
|
|
80
|
-
assert.match(
|
|
79
|
+
assert.match(technical, /### Custom themes[\s\S]*exact 51 required theme tokens[\s\S]*last valid preview[\s\S]*This project[\s\S]*Global themes/, "technical reference should document controls, validation, and both scopes");
|
|
80
|
+
assert.match(technical, /does not select the theme or mutate Pi\/browser settings[\s\S]*run `\/reload` or restart Pi/, "technical reference should document non-persistence and truthful TUI activation");
|
|
81
81
|
|
|
82
82
|
console.log("theme-customizer-static: all assertions passed");
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import vm from "node:vm";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
const app = await readFile(join(root, "public", "app.js"), "utf8");
|
|
9
|
+
const helperStart = app.indexOf("function escapeRegExp(");
|
|
10
|
+
const helperEnd = app.indexOf("\nfunction appendThinkingFormatDisplayMessages(", helperStart);
|
|
11
|
+
assert.ok(helperStart >= 0 && helperEnd > helperStart, "thinking-format helpers should remain independently testable");
|
|
12
|
+
|
|
13
|
+
const context = {
|
|
14
|
+
THINKING_FORMAT_OPEN_TAG_REGEX: /^<think\b[^>]*>/i,
|
|
15
|
+
THINKING_FORMAT_CLOSE_TAG_REGEX: /<\/think\s*>/i,
|
|
16
|
+
CHANNEL_THINKING_FORMAT_OPEN_TAG_REGEX: /^<\|([a-z][\w-]*)>/i,
|
|
17
|
+
};
|
|
18
|
+
vm.runInNewContext(
|
|
19
|
+
`${app.slice(helperStart, helperEnd)}\nthis.splitThinkingFormatText = splitThinkingFormatText;`,
|
|
20
|
+
context,
|
|
21
|
+
{ filename: "thinking-format-helpers.js" },
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
function parse(text, options) {
|
|
25
|
+
return JSON.parse(JSON.stringify(context.splitThinkingFormatText(text, options)));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
assert.deepEqual(parse("<think>reasoning</think>\nfinal answer"), {
|
|
29
|
+
hasThinkingFormat: true,
|
|
30
|
+
thinkingText: "reasoning",
|
|
31
|
+
finalText: "final answer",
|
|
32
|
+
complete: true,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const nestedLiteral = "The user mentioned `<think>example</think>` inside the reasoning; keep the rest here.";
|
|
36
|
+
assert.deepEqual(parse(`<think>${nestedLiteral}</think>\nfinal answer`), {
|
|
37
|
+
hasThinkingFormat: true,
|
|
38
|
+
thinkingText: nestedLiteral,
|
|
39
|
+
finalText: "final answer",
|
|
40
|
+
complete: true,
|
|
41
|
+
}, "a balanced literal tag pair must not close the outer thinking block");
|
|
42
|
+
|
|
43
|
+
assert.deepEqual(parse(`<think>${nestedLiteral}`, { streaming: true }), {
|
|
44
|
+
hasThinkingFormat: true,
|
|
45
|
+
thinkingText: nestedLiteral,
|
|
46
|
+
finalText: "",
|
|
47
|
+
complete: false,
|
|
48
|
+
}, "streaming must not expose text after an inner literal close as final output");
|
|
49
|
+
|
|
50
|
+
assert.deepEqual(parse("<think>first</think><think>second</think>\nanswer"), {
|
|
51
|
+
hasThinkingFormat: true,
|
|
52
|
+
thinkingText: "first\n\nsecond",
|
|
53
|
+
finalText: "answer",
|
|
54
|
+
complete: true,
|
|
55
|
+
}, "consecutive outer thinking blocks should remain supported");
|
|
56
|
+
|
|
57
|
+
assert.deepEqual(parse("<|analysis>channel reasoning<analysis|>\nanswer"), {
|
|
58
|
+
hasThinkingFormat: true,
|
|
59
|
+
thinkingText: "channel reasoning",
|
|
60
|
+
finalText: "answer",
|
|
61
|
+
complete: true,
|
|
62
|
+
}, "channel-style thinking delimiters should remain unchanged");
|
|
63
|
+
|
|
64
|
+
console.log("thinking-format-parser.test.mjs passed");
|
|
@@ -36,7 +36,7 @@ try {
|
|
|
36
36
|
assert.equal(await migrateLegacyWebuiSettings(migratedFile, legacyFile), true);
|
|
37
37
|
assert.equal(await migrateLegacyWebuiSettings(migratedFile, legacyFile), false, "an existing new target must always win");
|
|
38
38
|
const migrated = JSON.parse(await readFile(migratedFile, "utf8"));
|
|
39
|
-
assert.equal(migrated.version,
|
|
39
|
+
assert.equal(migrated.version, 8);
|
|
40
40
|
assert.equal(migrated.remoteAuthEnabled, true);
|
|
41
41
|
assert.deepEqual(migrated.retained, { value: 7 }, "migration must preserve unrelated top-level settings");
|
|
42
42
|
assert.equal((await readFile(legacyFile, "utf8")).includes('"retained"'), true, "migration must leave the legacy file untouched");
|