@firstpick/pi-package-webui 0.9.2 → 0.9.3

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.
Files changed (77) hide show
  1. package/README.md +13 -7
  2. package/bin/pi-webui.mjs +256 -39
  3. package/index.ts +266 -1
  4. package/lib/git-workflow-preferences.mjs +8 -25
  5. package/lib/intercom-conversations.mjs +491 -0
  6. package/lib/intercom-transcript-filter.mjs +99 -0
  7. package/lib/resource-selection.mjs +140 -0
  8. package/package.json +2 -2
  9. package/public/app.js +1025 -115
  10. package/public/index.html +31 -6
  11. package/public/service-worker.js +2 -1
  12. package/public/stream-output-controller.mjs +15 -0
  13. package/public/styles.css +394 -0
  14. package/public/syntax-highlight.mjs +622 -0
  15. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  16. package/tests/browser/interaction-continuity.spec.mjs +34 -0
  17. package/tests/browser/intercom-conversation-viewer.spec.mjs +355 -0
  18. package/tests/browser/persistent-ui-layout.spec.mjs +61 -0
  19. package/tests/browser/resource-profiles.spec.mjs +200 -0
  20. package/tests/browser/subagent-observability.spec.mjs +29 -0
  21. package/tests/codex-fast-mode-static.test.mjs +7 -6
  22. package/tests/common-options-submenus-interaction-static.test.mjs +2 -0
  23. package/tests/common-options-submenus-markup-static.test.mjs +1 -0
  24. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  25. package/tests/composer-skill-tag-layout.test.mjs +32 -2
  26. package/tests/control-deck-component-updates-static.test.mjs +4 -0
  27. package/tests/controls-layout-static.test.mjs +3 -3
  28. package/tests/fast-mode-client-static.test.mjs +2 -2
  29. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  30. package/tests/feature-system-prompt-optional-feature-static.test.mjs +5 -5
  31. package/tests/file-viewer-image-static.test.mjs +69 -0
  32. package/tests/fixtures/fake-pi.mjs +105 -6
  33. package/tests/foreground-transcript-catch-up-static.test.mjs +1 -1
  34. package/tests/git-panel-file-preview-static.test.mjs +5 -5
  35. package/tests/git-panel-live-updates-static.test.mjs +3 -3
  36. package/tests/git-workflow-preferences.test.mjs +4 -4
  37. package/tests/http-endpoints-harness.test.mjs +124 -2
  38. package/tests/intercom-conversation-viewer-static.test.mjs +105 -0
  39. package/tests/intercom-conversations-http.test.mjs +252 -0
  40. package/tests/intercom-conversations.test.mjs +374 -0
  41. package/tests/intercom-main-transcript-suppression-static.test.mjs +52 -0
  42. package/tests/intercom-tag-layout-static.test.mjs +46 -0
  43. package/tests/intercom-transcript-filter.test.mjs +98 -0
  44. package/tests/main-output-loading-static.test.mjs +59 -0
  45. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  46. package/tests/mobile-compact-layout.test.mjs +2 -3
  47. package/tests/mobile-continuity-tablet-static.test.mjs +6 -6
  48. package/tests/mobile-foundation-static.test.mjs +3 -3
  49. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  50. package/tests/mobile-static.test.mjs +63 -39
  51. package/tests/native-parity.test.mjs +8 -7
  52. package/tests/open-issue-wizard-static.test.mjs +1 -1
  53. package/tests/optional-feature-migration-frontend.test.mjs +5 -5
  54. package/tests/optional-feature-resource-setup-static.test.mjs +29 -0
  55. package/tests/persistent-ui-layout-static.test.mjs +3 -3
  56. package/tests/questionnaire-dialog.test.mjs +3 -3
  57. package/tests/remote-auth-settings-harness.test.mjs +1 -1
  58. package/tests/resource-defaults-helper.test.mjs +60 -6
  59. package/tests/resource-selection.test.mjs +114 -0
  60. package/tests/resource-tui-extension.test.mjs +23 -0
  61. package/tests/session-sampling-ui-static.test.mjs +3 -3
  62. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  63. package/tests/stream-output-controller.test.mjs +8 -0
  64. package/tests/stream-output-isolation-static.test.mjs +2 -2
  65. package/tests/streaming-ui-coupling.test.mjs +5 -0
  66. package/tests/subagent-gate-visibility.test.mjs +1 -1
  67. package/tests/subagent-launch-slots.test.mjs +1 -1
  68. package/tests/subagent-observability-static.test.mjs +3 -3
  69. package/tests/subagent-reliability-integration.test.mjs +23 -1
  70. package/tests/subagent-workflow-section-static.test.mjs +67 -0
  71. package/tests/subagents-helper.test.mjs +204 -1
  72. package/tests/syntax-highlight.test.mjs +235 -0
  73. package/tests/syntax-highlighting-static.test.mjs +84 -0
  74. package/tests/theme-customizer-static.test.mjs +5 -5
  75. package/tests/thinking-format-parser.test.mjs +64 -0
  76. package/tests/webui-settings-locking.test.mjs +1 -1
  77. package/webui-rpc-helper.mjs +291 -69
package/index.ts CHANGED
@@ -3,7 +3,7 @@ import path from "node:path";
3
3
  import { homedir } from "node:os";
4
4
  import type { Readable } from "node:stream";
5
5
  import { fileURLToPath } from "node:url";
6
- import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
6
+ import { formatSkillsForPrompt, type ExtensionAPI, type ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
7
7
  import { delay, takeValue, tokenizeArgs } from "@firstpick/pi-utils";
8
8
  import { detachChildProcess as releaseStartedChild, isProcessRunning, terminateChildProcess as terminateFailedChild } from "@firstpick/pi-utils/process";
9
9
  import { fetchJsonWithTimeout as fetchJsonWithTimeoutBase } from "@firstpick/pi-utils/http";
@@ -12,9 +12,19 @@ import { createRestoreFile } from "./lib/update/supervisor.mjs";
12
12
  import {
13
13
  gitWorkflowPreferencesSummary,
14
14
  readGitWorkflowPreferences,
15
+ readWebuiSettings,
15
16
  supportedGitWorkflowThinkingLevels,
17
+ updateWebuiSettings,
16
18
  writeGitWorkflowPreferences,
17
19
  } from "./lib/git-workflow-preferences.mjs";
20
+ import {
21
+ branchResourceDirective,
22
+ exactModelProfile,
23
+ normalizeResourceNameList,
24
+ preserveUnavailableResourceNames,
25
+ resolveResourceSelection,
26
+ setExactModelProfile,
27
+ } from "./lib/resource-selection.mjs";
18
28
 
19
29
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
20
30
  const packageRoot = __dirname;
@@ -868,7 +878,262 @@ async function runGitWorkflowSetup(ctx: ExtensionCommandContext): Promise<void>
868
878
  }
869
879
  }
870
880
 
881
+ function lastResourceBranchConfig(ctx: ExtensionCommandContext, customType: string): any {
882
+ let found: any;
883
+ for (const entry of ctx.sessionManager.getBranch()) {
884
+ if ((entry as any)?.type === "custom" && (entry as any).customType === customType) found = (entry as any).data;
885
+ }
886
+ return found;
887
+ }
888
+
889
+ function registerTuiResourceController(pi: ExtensionAPI): void {
890
+ let runtimeToolBaseline: string[] | undefined;
891
+ let enabledTools = new Set<string>();
892
+ let enabledSkills: Set<string> | null = null;
893
+ let legacyDisabledSkills = new Set<string>();
894
+ let toolsPinned = false;
895
+ let skillsPinned = false;
896
+ let tuiActive = false;
897
+ let generation = 0;
898
+
899
+ const modelKey = (model: any): string => model?.provider && model?.id ? `${model.provider}\0${model.id}` : "";
900
+ const runtimeTools = (): string[] => runtimeToolBaseline ??= normalizeResourceNameList(pi.getActiveTools()) || [];
901
+ const toolNames = (): string[] => pi.getAllTools().map((tool: any) => tool.name);
902
+ const skills = (ctx: ExtensionCommandContext): any[] => {
903
+ const options = (ctx as any).getSystemPromptOptions?.();
904
+ return Array.isArray(options?.skills) ? options.skills : [];
905
+ };
906
+ const isSkillEnabled = (name: string): boolean => enabledSkills instanceof Set ? enabledSkills.has(name) : !legacyDisabledSkills.has(name);
907
+
908
+ function applyResolvedState(ctx: ExtensionCommandContext, defaults: any, model: any): void {
909
+ const toolDirective = branchResourceDirective(lastResourceBranchConfig(ctx, "webui-tools-config"), "tools");
910
+ toolsPinned = toolDirective.pinned;
911
+ const baseline = runtimeTools();
912
+ const resolvedTools = toolDirective.pinned
913
+ ? { names: toolDirective.names || [], source: "session" }
914
+ : resolveResourceSelection(defaults, "tools", model?.provider, model?.id, baseline);
915
+ enabledTools = new Set(resolvedTools.names || baseline);
916
+ const existingTools = new Set(toolNames());
917
+ pi.setActiveTools([...enabledTools].filter((name) => existingTools.has(name)));
918
+
919
+ const skillDirective = branchResourceDirective(lastResourceBranchConfig(ctx, "webui-skills-config"), "skills");
920
+ skillsPinned = skillDirective.pinned;
921
+ legacyDisabledSkills = new Set();
922
+ if (skillDirective.pinned && skillDirective.legacyDisabledNames !== null) {
923
+ enabledSkills = null;
924
+ legacyDisabledSkills = new Set(skillDirective.legacyDisabledNames);
925
+ } else {
926
+ const resolvedSkills = skillDirective.pinned
927
+ ? { names: skillDirective.names || [], source: "session" }
928
+ : resolveResourceSelection(defaults, "skills", model?.provider, model?.id, null);
929
+ enabledSkills = resolvedSkills.names === null ? null : new Set(resolvedSkills.names);
930
+ }
931
+ }
932
+
933
+ async function recompute(ctx: ExtensionCommandContext, requestedModel: any = ctx.model): Promise<boolean> {
934
+ if (ctx.mode !== "tui") return false;
935
+ const requestedKey = modelKey(requestedModel);
936
+ const currentGeneration = ++generation;
937
+ let defaults;
938
+ try {
939
+ defaults = (await readWebuiSettings()).resourceDefaults;
940
+ } catch (error) {
941
+ ctx.ui.notify(`Resource defaults could not be read: ${error instanceof Error ? error.message : String(error)}`, "error");
942
+ return false;
943
+ }
944
+ if (currentGeneration !== generation || modelKey(ctx.model) !== requestedKey) return false;
945
+ applyResolvedState(ctx, defaults, requestedModel);
946
+ return true;
947
+ }
948
+
949
+ async function chooseResources(ctx: ExtensionCommandContext, title: string, visibleNames: string[], initiallyEnabled: string[]): Promise<string[] | undefined> {
950
+ const enabled = new Set(initiallyEnabled.filter((name) => visibleNames.includes(name)));
951
+ while (true) {
952
+ const actions = [
953
+ "Save selection",
954
+ "Enable all",
955
+ "Enable none",
956
+ ...visibleNames.map((name) => `${enabled.has(name) ? "[x]" : "[ ]"} ${name}`),
957
+ ];
958
+ const selected = await ctx.ui.select(title, actions);
959
+ if (!selected) return undefined;
960
+ if (selected === "Save selection") return visibleNames.filter((name) => enabled.has(name));
961
+ if (selected === "Enable all") {
962
+ visibleNames.forEach((name) => enabled.add(name));
963
+ continue;
964
+ }
965
+ if (selected === "Enable none") {
966
+ enabled.clear();
967
+ continue;
968
+ }
969
+ const name = selected.slice(4);
970
+ if (enabled.has(name)) enabled.delete(name);
971
+ else enabled.add(name);
972
+ }
973
+ }
974
+
975
+ function availableModels(ctx: ExtensionCommandContext): any[] {
976
+ return ctx.modelRegistry.getAvailable()
977
+ .filter((model: any) => model?.provider && model?.id)
978
+ .sort((left: any, right: any) => `${left.provider}/${left.id}`.localeCompare(`${right.provider}/${right.id}`));
979
+ }
980
+
981
+ async function runSelector(resourceType: "tools" | "skills", ctx: ExtensionCommandContext): Promise<void> {
982
+ if (ctx.mode !== "tui") {
983
+ ctx.ui.notify(`/${resourceType} is available in interactive TUI mode only.`, "warning");
984
+ return;
985
+ }
986
+ const resourceLabel = resourceType === "tools" ? "Tools" : "Skills";
987
+ const scope = await ctx.ui.select(`${resourceLabel} setup`, ["Session only", "Global default", "Model default"]);
988
+ if (!scope) return;
989
+ const settings = await readWebuiSettings();
990
+ const visibleNames = resourceType === "tools" ? toolNames() : skills(ctx).map((skill: any) => skill.name);
991
+ const selectionKey = resourceType === "tools" ? "enabledTools" : "enabledSkills";
992
+ let previousNames: string[] | null = null;
993
+ let provider = "";
994
+ let modelId = "";
995
+
996
+ if (scope === "Session only") {
997
+ const action = await ctx.ui.select(`${resourceLabel} for this session`, ["Edit selection", "Use inherited defaults"]);
998
+ if (!action) return;
999
+ if (action === "Use inherited defaults") {
1000
+ pi.appendEntry(resourceType === "tools" ? "webui-tools-config" : "webui-skills-config", { version: 2, mode: "inherit" });
1001
+ await recompute(ctx);
1002
+ ctx.ui.notify(`${resourceLabel} now use inherited defaults.`, "info");
1003
+ return;
1004
+ }
1005
+ previousNames = resourceType === "tools"
1006
+ ? [...enabledTools]
1007
+ : enabledSkills instanceof Set ? [...enabledSkills] : visibleNames.filter((name) => !legacyDisabledSkills.has(name));
1008
+ } else if (scope === "Global default") {
1009
+ const action = await ctx.ui.select(`Global ${resourceLabel.toLowerCase()} default`, ["Edit selection", "Use Pi runtime default"]);
1010
+ if (!action) return;
1011
+ if (action === "Use Pi runtime default") {
1012
+ await updateWebuiSettings(() => ({ resourceDefaults: { [resourceType]: { [selectionKey]: null } } }));
1013
+ await recompute(ctx);
1014
+ ctx.ui.notify(`Global ${resourceLabel.toLowerCase()} default now inherits Pi runtime behavior.`, "info");
1015
+ return;
1016
+ }
1017
+ previousNames = settings.resourceDefaults?.[resourceType]?.[selectionKey];
1018
+ if (previousNames === null) previousNames = resolveResourceSelection(settings.resourceDefaults, resourceType, "", "", resourceType === "tools" ? runtimeTools() : null).names;
1019
+ } else {
1020
+ const models = availableModels(ctx);
1021
+ if (!models.length) {
1022
+ ctx.ui.notify("No authenticated Pi models are available.", "warning");
1023
+ return;
1024
+ }
1025
+ const labels = models.map((model: any) => `${model.provider}/${model.id}${model.name && model.name !== model.id ? ` — ${model.name}` : ""}`);
1026
+ const selectedLabel = await ctx.ui.select(`Exact model for ${resourceLabel.toLowerCase()}`, labels);
1027
+ if (!selectedLabel) return;
1028
+ const selectedIndex = labels.indexOf(selectedLabel);
1029
+ const model = models[selectedIndex];
1030
+ provider = model.provider;
1031
+ modelId = model.id;
1032
+ const action = await ctx.ui.select(`${resourceLabel} for ${provider}/${modelId}`, ["Edit selection", "Use inherited defaults"]);
1033
+ if (!action) return;
1034
+ const profile = exactModelProfile(settings.resourceDefaults, provider, modelId);
1035
+ previousNames = profile?.[resourceType]?.[selectionKey] ?? null;
1036
+ if (action === "Use inherited defaults") {
1037
+ await updateWebuiSettings((current: any) => ({
1038
+ resourceDefaults: {
1039
+ modelProfiles: setExactModelProfile(current.resourceDefaults, provider, modelId, resourceType, null),
1040
+ },
1041
+ }));
1042
+ await recompute(ctx);
1043
+ ctx.ui.notify(`${resourceLabel} for ${provider}/${modelId} now use inherited defaults.`, "info");
1044
+ return;
1045
+ }
1046
+ if (previousNames === null) {
1047
+ previousNames = resolveResourceSelection(settings.resourceDefaults, resourceType, provider, modelId, resourceType === "tools" ? runtimeTools() : null).names;
1048
+ }
1049
+ }
1050
+
1051
+ const selected = await chooseResources(ctx, `${resourceLabel}: toggle resources, then save`, visibleNames, previousNames || []);
1052
+ if (!selected) return;
1053
+ if (scope === "Session only") {
1054
+ const preserved = preserveUnavailableResourceNames(previousNames, visibleNames, selected);
1055
+ pi.appendEntry(resourceType === "tools" ? "webui-tools-config" : "webui-skills-config", {
1056
+ version: 2,
1057
+ mode: "explicit",
1058
+ [selectionKey]: preserved,
1059
+ });
1060
+ } else if (scope === "Global default") {
1061
+ await updateWebuiSettings((current: any) => ({
1062
+ resourceDefaults: {
1063
+ [resourceType]: {
1064
+ [selectionKey]: preserveUnavailableResourceNames(current.resourceDefaults?.[resourceType]?.[selectionKey], visibleNames, selected),
1065
+ },
1066
+ },
1067
+ }));
1068
+ } else {
1069
+ await updateWebuiSettings((current: any) => {
1070
+ const currentNames = exactModelProfile(current.resourceDefaults, provider, modelId)?.[resourceType]?.[selectionKey];
1071
+ const preserved = preserveUnavailableResourceNames(currentNames, visibleNames, selected);
1072
+ return {
1073
+ resourceDefaults: {
1074
+ modelProfiles: setExactModelProfile(current.resourceDefaults, provider, modelId, resourceType, preserved),
1075
+ },
1076
+ };
1077
+ });
1078
+ }
1079
+ await recompute(ctx);
1080
+ ctx.ui.notify(`${resourceLabel} ${scope.toLowerCase()} saved.`, "info");
1081
+ }
1082
+
1083
+ pi.registerCommand("tools", {
1084
+ description: "Choose session, global, or exact-model tools",
1085
+ handler: async (_args, ctx) => runSelector("tools", ctx),
1086
+ });
1087
+ pi.registerCommand("skills", {
1088
+ description: "Choose session, global, or exact-model skills",
1089
+ handler: async (_args, ctx) => runSelector("skills", ctx),
1090
+ });
1091
+ pi.on("session_start", async (_event, ctx) => {
1092
+ tuiActive = ctx.mode === "tui";
1093
+ if (tuiActive) {
1094
+ if (runtimeToolBaseline === undefined) enabledTools = new Set(runtimeTools());
1095
+ await recompute(ctx);
1096
+ }
1097
+ });
1098
+ pi.on("session_tree", async (_event, ctx) => {
1099
+ tuiActive = ctx.mode === "tui";
1100
+ if (tuiActive) await recompute(ctx);
1101
+ });
1102
+ pi.on("model_select", async (event, ctx) => {
1103
+ if (ctx.mode === "tui") await recompute(ctx, event.model);
1104
+ });
1105
+ pi.on("session_shutdown", () => {
1106
+ tuiActive = false;
1107
+ generation += 1;
1108
+ });
1109
+ pi.on("input", async (event, ctx) => {
1110
+ if (!tuiActive || ctx.mode !== "tui") return { action: "continue" };
1111
+ const match = String(event.text || "").trim().match(/^\/skill:([^\s]+)/i);
1112
+ if (!match || isSkillEnabled(match[1])) return { action: "continue" };
1113
+ ctx.ui.notify(`Skill /skill:${match[1]} is disabled by /skills.`, "warning");
1114
+ return { action: "handled" };
1115
+ });
1116
+ pi.on("before_agent_start", async (event) => {
1117
+ if (!tuiActive || (enabledSkills === null && legacyDisabledSkills.size === 0)) return undefined;
1118
+ const allSkills = Array.isArray(event.systemPromptOptions?.skills) ? event.systemPromptOptions.skills : [];
1119
+ const disabledNames = allSkills.filter((skill: any) => !isSkillEnabled(skill.name)).map((skill: any) => skill.name);
1120
+ const filtered = allSkills.filter((skill: any) => isSkillEnabled(skill.name) && skill.disableModelInvocation !== true);
1121
+ if (filtered.length === allSkills.length) return undefined;
1122
+ let nextPrompt = event.systemPrompt;
1123
+ const nextSection = formatSkillsForPrompt(filtered);
1124
+ if (nextPrompt.includes("<available_skills>")) {
1125
+ nextPrompt = nextPrompt.replace(/\n?The following skills provide[\s\S]*?<\/available_skills>\n?/m, nextSection ? `\n${nextSection}\n` : "\n");
1126
+ }
1127
+ for (const name of disabledNames) {
1128
+ const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1129
+ nextPrompt = nextPrompt.replace(new RegExp(`\\n? <skill>\\n <name>${escaped}<\\/name>[\\s\\S]*? <\\/skill>`, "g"), "");
1130
+ }
1131
+ return { systemPrompt: nextPrompt };
1132
+ });
1133
+ }
1134
+
871
1135
  export default function (pi: ExtensionAPI) {
1136
+ registerTuiResourceController(pi);
872
1137
  const subagentGate = registerSubagentGate(pi);
873
1138
  pi.on("session_shutdown", () => subagentGate.dispose());
874
1139
 
@@ -4,6 +4,7 @@ import path from "node:path";
4
4
  import { setTimeout as delay } from "node:timers/promises";
5
5
  import { normalizeSubagentLaunchSlots } from "./subagent-launch-slots.mjs";
6
6
  import { normalizeUiLayout } from "./ui-layout-settings.mjs";
7
+ import { normalizeResourceDefaults } from "./resource-selection.mjs";
7
8
  import { normalizeOutputMode, OUTPUT_MODE_NORMAL } from "./webui-output-mode.mjs";
8
9
 
9
10
  export const GIT_WORKFLOW_SETUP_VERSION = 1;
@@ -26,7 +27,7 @@ export function supportedGitWorkflowThinkingLevels(model) {
26
27
  });
27
28
  }
28
29
 
29
- const WEBUI_SETTINGS_VERSION = 7;
30
+ const WEBUI_SETTINGS_VERSION = 8;
30
31
  const WEBUI_SETTINGS_FILE_ENV = "PI_WEBUI_SETTINGS_FILE";
31
32
  const WEBUI_SETTINGS_LOCK_TIMEOUT_MS = 2_000;
32
33
  const WEBUI_SETTINGS_LOCK_RETRY_MS = 25;
@@ -127,29 +128,7 @@ export function legacyWebuiSettingsFile(env = process.env) {
127
128
  return path.join(configRoot, "pi-webui", "settings.json");
128
129
  }
129
130
 
130
- function normalizeNameList(value) {
131
- if (!Array.isArray(value)) return null;
132
- const names = [];
133
- const seen = new Set();
134
- for (const item of value) {
135
- const name = cleanBoundedString(item, 256);
136
- if (!name || seen.has(name)) continue;
137
- seen.add(name);
138
- names.push(name);
139
- }
140
- return names;
141
- }
142
-
143
- export function normalizeResourceDefaults(value) {
144
- return {
145
- tools: {
146
- enabledTools: normalizeNameList(value?.tools?.enabledTools),
147
- },
148
- skills: {
149
- enabledSkills: normalizeNameList(value?.skills?.enabledSkills),
150
- },
151
- };
152
- }
131
+ export { normalizeResourceDefaults } from "./resource-selection.mjs";
153
132
 
154
133
  export function normalizeInterfacePreferences(value) {
155
134
  const rawSidePanelWidth = value?.sidePanelWidth;
@@ -172,6 +151,10 @@ function normalizedSettingsVersion(value) {
172
151
 
173
152
  export function normalizeWebuiSettings(value) {
174
153
  const source = settingsObject(value);
154
+ const storedVersion = Number.isInteger(source.version) ? source.version : 0;
155
+ const resourceDefaultsSource = storedVersion >= 8
156
+ ? source.resourceDefaults
157
+ : { ...settingsObject(source.resourceDefaults), modelProfiles: [] };
175
158
  const interfacePreferences = normalizeInterfacePreferences(source.interfacePreferences);
176
159
  const legacyLayoutSource = source.uiLayout === undefined
177
160
  && interfacePreferences.sidePanelWidth !== null
@@ -184,7 +167,7 @@ export function normalizeWebuiSettings(value) {
184
167
  remoteAuthEnabled: source.remoteAuthEnabled === true,
185
168
  outputModeDefault: normalizeOutputMode(source.outputModeDefault, OUTPUT_MODE_NORMAL),
186
169
  gitWorkflow: normalizeGitWorkflowPreferences(source.gitWorkflow),
187
- resourceDefaults: normalizeResourceDefaults(source.resourceDefaults),
170
+ resourceDefaults: normalizeResourceDefaults(resourceDefaultsSource),
188
171
  interfacePreferences,
189
172
  uiLayout: normalizeUiLayout(legacyLayoutSource, { legacySidePanelWidth: interfacePreferences.sidePanelWidth }),
190
173
  subagentLaunchSlots: normalizeSubagentLaunchSlots(source.subagentLaunchSlots),