fix(chat): recall the current session's prompts by default; tidy the six merged PRs

Input history (#3035) shipped with "All projects" as the default scope and
only recorded prompts sent after the upgrade, so ArrowUp showed other
sessions' prompts and, once switched to "Current session", nothing at all.
Default to the current session and merge the visible transcript's prompts
with the persisted bucket. Existing sessions recall as they did before
#3035, while new prompts keep their attachments and stay recallable after
a revert hides them from the transcript.

Cleanup across #1855, #2297, #3072, #3178, #3035 and #3135: drop the
duplicate poll guards in the file content poller, the zod schema the
VS Code package cannot depend on, a copied file-URL helper and stray
whitespace; move the Enter-to-send strings into the settings namespace;
document OPENCHAMBER_CHATS_DIR, resolve the chats root once on the server
and warm it alongside the other bootstrap calls.
This commit is contained in:
Bohdan Triapitsyn
2026-09-05 20:16:14 +03:00
parent 3df97908fe
commit f46fb718c5
73 changed files with 513 additions and 242 deletions
-1
View File
@@ -66,7 +66,6 @@ The webview build emits each worker as one self-contained file. VS Code webviews
- `bridge-settings-runtime.ts`
- Settings read/write and OpenCode skills discovery via API for bridge consumers.
- `settings-changes.ts` validates Enter preferences independently before writes; invalid values are omitted without dropping unrelated changes.
- `bridge-system-runtime.ts`
- System/editor/provider/quota/notification/update-check message handlers.
@@ -5,7 +5,6 @@ import * as path from 'path';
import * as vscode from 'vscode';
import { BUILT_IN_SKILL_LOCATION, type DiscoveredSkill, type SkillScope, type SkillSource } from './opencodeConfig';
import type { BridgeContext } from './bridge';
import { enterSettingsSchema } from './settings-changes';
const SETTINGS_KEY = 'openchamber.settings';
const OPENCHAMBER_SHARED_SETTINGS_PATH = path.join(os.homedir(), '.config', 'openchamber', 'settings.json');
@@ -293,14 +292,6 @@ export const readSettings = (ctx?: BridgeContext): Record<string, unknown> => {
export const persistSettings = async (changes: Record<string, unknown>, ctx?: BridgeContext): Promise<Record<string, unknown>> => {
const current = readSettings(ctx);
const restChanges = stripDerived({ ...(changes || {}) });
const enterSettings = enterSettingsSchema.parse(restChanges);
for (const key of ['enterToSend', 'enterToSendConfigured'] as const) {
if (enterSettings[key] === undefined) {
delete restChanges[key];
} else {
restChanges[key] = enterSettings[key];
}
}
const keysToClear = new Set<string>();
@@ -1,19 +0,0 @@
import { describe, expect, test } from 'bun:test';
import { enterSettingsSchema } from './settings-changes';
describe('VS Code Enter settings validation', () => {
test('preserves both explicit choices', () => {
expect(enterSettingsSchema.parse({ enterToSend: true, enterToSendConfigured: false }))
.toEqual({ enterToSend: true, enterToSendConfigured: false });
expect(enterSettingsSchema.parse({ enterToSend: false, enterToSendConfigured: true }))
.toEqual({ enterToSend: false, enterToSendConfigured: true });
});
test('omits invalid fields independently', () => {
expect(enterSettingsSchema.parse({ enterToSend: 'true', enterToSendConfigured: true }))
.toEqual({ enterToSend: undefined, enterToSendConfigured: true });
expect(enterSettingsSchema.parse({ enterToSend: false, enterToSendConfigured: 1 }))
.toEqual({ enterToSend: false, enterToSendConfigured: undefined });
expect(enterSettingsSchema.parse({})).toEqual({});
});
});
-8
View File
@@ -1,8 +0,0 @@
import { z } from 'zod';
// Invalid fields are omitted independently so one malformed preference cannot
// discard the other preference or any unrelated settings in the same write.
export const enterSettingsSchema = z.object({
enterToSend: z.boolean().optional().catch(undefined),
enterToSendConfigured: z.boolean().optional().catch(undefined),
});