@timurproko/a1 0.2.7-dev.820 → 0.2.7-dev.834
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 +7 -1
- package/bin/automatic-update.js +7 -0
- package/bin/ui.js +1 -0
- package/dist/app/session-shell/session-shell-root.d.ts +8 -1
- package/dist/app/session-shell/session-shell.js +68 -18
- package/dist/app/session-shell/shell-host.js +6 -3
- package/dist/app/session-shell/transcript-document.js +1 -1
- package/dist/composition/owned-ui.d.ts +3 -11
- package/dist/composition/owned-ui.js +93 -42
- package/dist/composition/resident-tab-bridge.d.ts +10 -1
- package/dist/composition/resident-tab-bridge.js +21 -0
- package/dist/composition/settings-route-host.d.ts +12 -2
- package/dist/composition/settings-route-host.js +27 -9
- package/dist/composition/settings-search-input.d.ts +9 -0
- package/dist/composition/settings-search-input.js +58 -0
- package/dist/contracts/owned-ui/session-backend.d.ts +2 -0
- package/dist/contracts/owned-ui/session-workflows.d.ts +7 -3
- package/dist/contracts/presentation/index.d.ts +11 -0
- package/dist/contracts/presentation/index.js +12 -0
- package/dist/features/launch/development-launch.js +6 -0
- package/dist/features/launch/profile-paths.js +4 -0
- package/dist/features/owned-ui/plus-menu-dialog.d.ts +22 -0
- package/dist/features/owned-ui/plus-menu-dialog.js +76 -0
- package/dist/features/owned-ui/reference-screen-app.d.ts +2 -0
- package/dist/features/owned-ui/reference-screen-app.js +12 -2
- package/dist/features/owned-ui/settings-app.d.ts +10 -3
- package/dist/features/owned-ui/settings-app.js +98 -45
- package/dist/features/owned-ui/settings-search-input.d.ts +29 -0
- package/dist/features/owned-ui/settings-search-input.js +1 -0
- package/dist/features/prompt-history/index.d.ts +1 -1
- package/dist/features/prompt-history/paths.d.ts +2 -1
- package/dist/features/prompt-history/paths.js +10 -2
- package/dist/features/prompt-history/service.d.ts +5 -0
- package/dist/features/prompt-history/service.js +1 -1
- package/dist/features/resident-tab/shortcut-declarations.d.ts +1 -1
- package/dist/features/resident-tab/shortcut-declarations.js +2 -0
- package/dist/foundation/launch-context/index.d.ts +2 -0
- package/dist/foundation/launch-context/index.js +1 -0
- package/dist/foundation/release/automatic-update.d.ts +37 -0
- package/dist/foundation/release/automatic-update.js +265 -0
- package/dist/foundation/release/bootstrap.d.ts +1 -9
- package/dist/foundation/release/bootstrap.js +7 -3
- package/dist/foundation/release/index.d.ts +1 -1
- package/dist/foundation/release/index.js +1 -1
- package/dist/foundation/release/latest-release.d.ts +3 -2
- package/dist/foundation/release/latest-release.js +1 -1
- package/dist/foundation/release/update-execution-lease.d.ts +36 -0
- package/dist/foundation/release/update-execution-lease.js +145 -0
- package/dist/foundation/release/update.d.ts +8 -6
- package/dist/foundation/release/update.js +232 -167
- package/dist/foundation/resident-tabs/bridge-client.d.ts +8 -2
- package/dist/foundation/resident-tabs/bridge-client.js +13 -6
- package/dist/foundation/resident-tabs/progress-observation-schema.d.ts +34 -0
- package/dist/foundation/resident-tabs/progress-observation-schema.js +1 -0
- package/dist/foundation/resident-tabs/progress-observation.d.ts +3 -6
- package/dist/foundation/resident-tabs/progress-observation.js +42 -12
- package/dist/foundation/resident-tabs/routes.d.ts +5 -0
- package/dist/foundation/resident-tabs/routes.js +5 -0
- package/dist/integrations/pi/components/editor-interaction.d.ts +2 -0
- package/dist/integrations/pi/components/modal-frame.d.ts +17 -1
- package/dist/integrations/pi/components/modal-frame.js +48 -9
- package/dist/integrations/pi/components/models-dialog.js +4 -52
- package/dist/integrations/pi/components/owned-editor-ux.d.ts +3 -0
- package/dist/integrations/pi/components/owned-editor-ux.js +75 -4
- package/dist/integrations/pi/components/shell-editor-autocomplete.js +57 -37
- package/dist/integrations/pi/components/shell-footer-status.js +19 -3
- package/dist/integrations/pi/components/shell-presenters-transcript.js +4 -1
- package/dist/integrations/pi/components/shell-selectors-dialogs.js +4 -1
- package/dist/integrations/pi/components/shell-shared-facade.d.ts +9 -2
- package/dist/integrations/pi/components/skills-dialog.js +2 -2
- package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +7 -5
- package/dist/integrations/pi/components/upstream/components/owned-editor.js +15 -8
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +3 -3
- package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +2 -2
- package/dist/integrations/pi/components/upstream/components/session-footer.js +26 -23
- package/dist/integrations/pi/components/upstream/components/session-selector.js +7 -6
- package/dist/integrations/pi/components/upstream/components/thinking-selector.d.ts +7 -6
- package/dist/integrations/pi/components/upstream/components/thinking-selector.js +9 -8
- package/dist/integrations/pi/components/upstream/components/tool-execution.js +6 -4
- package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +8 -8
- package/dist/integrations/pi/components/upstream/components/tree-selector.js +10 -10
- package/dist/integrations/pi/components/upstream/history/editor-core.js +2 -0
- package/dist/integrations/pi/engine/adapter.js +7 -2
- package/dist/integrations/pi/engine/ports.d.ts +1 -1
- package/dist/integrations/pi/engine/ports.js +4 -0
- package/dist/integrations/pi/engine/workflow-runner.js +9 -2
- package/dist/native/darwin-arm64/manifest.json +1 -1
- package/dist/native/darwin-arm64/terminal-host.manifest.json +3 -3
- package/dist/native/darwin-arm64/terminal-host.node +0 -0
- package/dist/native/darwin-x64/manifest.json +1 -1
- package/dist/native/darwin-x64/terminal-host.manifest.json +3 -3
- package/dist/native/darwin-x64/terminal-host.node +0 -0
- package/dist/native/linux-x64/manifest.json +1 -1
- package/dist/native/linux-x64/terminal-host.manifest.json +3 -3
- package/dist/native/linux-x64/terminal-host.node +0 -0
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/native/win32-x64/process-guardian.node +0 -0
- package/dist/native/win32-x64/terminal-host.manifest.json +3 -3
- package/dist/native/win32-x64/terminal-host.node +0 -0
- package/dist/product-identity.d.ts +1 -1
- package/dist/product-identity.js +1 -1
- package/dist/product-identity.json +1 -0
- package/dist/ui/apps/host.d.ts +2 -0
- package/dist/ui/apps/host.js +7 -1
- package/dist/ui/components/dialog-panel.js +35 -30
- package/dist/ui/components/line-input.d.ts +3 -0
- package/dist/ui/components/line-input.js +3 -1
- package/dist/ui/components/prompt-input.d.ts +3 -2
- package/dist/ui/components/prompt-input.js +6 -4
- package/dist/ui/components/spans.js +2 -2
- package/dist/ui/components/surface.js +4 -2
- package/dist/ui/components/text.d.ts +3 -6
- package/dist/ui/components/text.js +6 -8
- package/dist/ui/settings/declarations.d.ts +54 -8
- package/dist/ui/settings/declarations.js +36 -7
- package/dist/ui/settings/manager.js +7 -3
- package/dist/ui/settings/migrations.js +15 -0
- package/dist/ui/settings/sections.d.ts +4 -0
- package/dist/ui/settings/sections.js +9 -3
- package/docs/architecture/resident-tabs.md +36 -8
- package/docs/architecture/tool-image-presentation.md +2 -1
- package/docs/features/prompt-history.md +41 -20
- package/docs/validation.md +25 -5
- package/package.json +1 -1
|
@@ -11,13 +11,14 @@ export function createOwnedRouteHost(settings, references, options = {}) {
|
|
|
11
11
|
if (!routes.has(route))
|
|
12
12
|
return null;
|
|
13
13
|
if (route === SETTINGS_ROUTE) {
|
|
14
|
-
return deferredSurface(SETTINGS_APP_ID, "settings", () => loadSettingsSurface(settings, options
|
|
14
|
+
return deferredSurface(SETTINGS_APP_ID, "settings", () => loadSettingsSurface(settings, options));
|
|
15
15
|
}
|
|
16
16
|
const changelog = route === CHANGELOG_ROUTE;
|
|
17
17
|
const session = route === "session";
|
|
18
18
|
const title = session ? "Session Info" : changelog ? input ? "What's New" : "Changelog" : HOTKEYS_TITLE;
|
|
19
19
|
const document = session ? references.session() : changelog ? references.changelog(input) : references.hotkeys();
|
|
20
|
-
|
|
20
|
+
const pinned = options.tabRoute === route;
|
|
21
|
+
return deferredSurface(route, title, () => loadReferenceSurface(settings, route, title, document, pinned));
|
|
21
22
|
},
|
|
22
23
|
};
|
|
23
24
|
}
|
|
@@ -61,12 +62,27 @@ function deferredSurface(id, label, load) {
|
|
|
61
62
|
onExitRequested: listener => { onExit = listener; },
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
|
-
async function loadSettingsSurface(settings,
|
|
65
|
-
const { SettingsApp } = await
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
async function loadSettingsSurface(settings, options) {
|
|
66
|
+
const [{ SettingsApp }, { createSettingsSearchInputFactory }] = await Promise.all([
|
|
67
|
+
import("../features/owned-ui/settings-app.js"),
|
|
68
|
+
import("./settings-search-input.js"),
|
|
69
|
+
]);
|
|
70
|
+
const pinned = options.tabRoute === SETTINGS_ROUTE;
|
|
71
|
+
const searchInputFactory = createSettingsSearchInputFactory({
|
|
72
|
+
...(options.keybindings === undefined ? {} : { keybindings: options.keybindings }),
|
|
73
|
+
...(options.agentDir === undefined ? {} : { agentDir: options.agentDir }),
|
|
74
|
+
...(options.cwd === undefined ? {} : { cwd: options.cwd }),
|
|
75
|
+
});
|
|
76
|
+
// Invariant: a pinned Settings tab closes as a tab; neither Esc nor one unclaimed Ctrl+C dismisses its screen.
|
|
77
|
+
return hostApp(SETTINGS_APP_ID, SETTINGS_ROUTE, () => new SettingsApp(settings, {
|
|
78
|
+
pinned,
|
|
79
|
+
searchInputFactory,
|
|
80
|
+
configurePlusMenu: options.configurePlusMenu ?? null,
|
|
81
|
+
...(options.copyText === undefined ? {} : { copyText: options.copyText }),
|
|
82
|
+
}), !pinned, true);
|
|
68
83
|
}
|
|
69
|
-
async function loadReferenceSurface(settings,
|
|
84
|
+
async function loadReferenceSurface(settings, route, title, document, pinned) {
|
|
85
|
+
const id = route;
|
|
70
86
|
// Rationale: the app module and the document load together, so a document that fails
|
|
71
87
|
// to render is reported by the placeholder rather than by a screen that never fills.
|
|
72
88
|
const [{ ReferenceScreenApp }, content] = await Promise.all([import("../features/owned-ui/reference-screen-app.js"), document]);
|
|
@@ -79,9 +95,10 @@ async function loadReferenceSurface(settings, id, route, title, document) {
|
|
|
79
95
|
scrollbarStyle: settings.value("scrollbarStyle"),
|
|
80
96
|
scrollbarSpeed: settings.value("scrollbarSpeed"),
|
|
81
97
|
}),
|
|
82
|
-
|
|
98
|
+
pinned,
|
|
99
|
+
}), !pinned);
|
|
83
100
|
}
|
|
84
|
-
async function hostApp(id, route, create, closeOnInterrupt = true) {
|
|
101
|
+
async function hostApp(id, route, create, closeOnInterrupt = true, appInputBeforeInterrupt = false) {
|
|
85
102
|
const [{ UiAppHost }, { UiAppRegistry }] = await Promise.all([
|
|
86
103
|
import("../ui/apps/host.js"),
|
|
87
104
|
import("../ui/apps/registry.js"),
|
|
@@ -96,6 +113,7 @@ async function hostApp(id, route, create, closeOnInterrupt = true) {
|
|
|
96
113
|
const host = new UiAppHost({
|
|
97
114
|
registry,
|
|
98
115
|
closeOnInterrupt,
|
|
116
|
+
appInputBeforeInterrupt,
|
|
99
117
|
theme: pinnedTheme(),
|
|
100
118
|
surface: {
|
|
101
119
|
size: () => size,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SettingsSearchInputFactory } from "../features/owned-ui/settings-search-input.js";
|
|
2
|
+
import { type PiKeybindingsHost } from "../integrations/pi/components/shell-shared-facade.js";
|
|
3
|
+
export interface SettingsSearchInputFactoryOptions {
|
|
4
|
+
readonly keybindings?: PiKeybindingsHost;
|
|
5
|
+
readonly agentDir?: string;
|
|
6
|
+
readonly cwd?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Builds Settings search from the same configurable owned editor used by the agent prompt. */
|
|
9
|
+
export declare function createSettingsSearchInputFactory(options?: SettingsSearchInputFactoryOptions): SettingsSearchInputFactory;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { editorInsertedText } from "../integrations/pi/components/owned-editor-ux.js";
|
|
2
|
+
import { createPiShellEditor } from "../integrations/pi/components/shell-editor-autocomplete.js";
|
|
3
|
+
import { piShellTruncateToWidth, piShellVisibleWidth, } from "../integrations/pi/components/shell-shared-facade.js";
|
|
4
|
+
import { backgroundSgrSpan } from "../ui/components/spans.js";
|
|
5
|
+
import { caretCell } from "../ui/components/line-input.js";
|
|
6
|
+
import { PromptInput } from "../ui/components/prompt-input.js";
|
|
7
|
+
/** Builds Settings search from the same configurable owned editor used by the agent prompt. */
|
|
8
|
+
export function createSettingsSearchInputFactory(options = {}) {
|
|
9
|
+
return {
|
|
10
|
+
isTextInput: data => {
|
|
11
|
+
const text = editorInsertedText(data);
|
|
12
|
+
return text !== undefined && /[^\p{Cc}]/u.test(text);
|
|
13
|
+
},
|
|
14
|
+
create: surface => createSettingsSearchInput(surface, options),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function createSettingsSearchInput(surface, options) {
|
|
18
|
+
let columns = 80;
|
|
19
|
+
const editor = createPiShellEditor({
|
|
20
|
+
keybindingProfile: "a1",
|
|
21
|
+
inputCapabilities: {
|
|
22
|
+
singleLine: true,
|
|
23
|
+
paste: false,
|
|
24
|
+
autocomplete: false,
|
|
25
|
+
placeholder: "Search settings",
|
|
26
|
+
},
|
|
27
|
+
...(options.keybindings === undefined ? {} : { keybindings: options.keybindings }),
|
|
28
|
+
...(options.agentDir === undefined ? {} : { agentDir: options.agentDir }),
|
|
29
|
+
cwd: options.cwd ?? process.cwd(),
|
|
30
|
+
getColumns: () => columns,
|
|
31
|
+
getRows: surface.getRows,
|
|
32
|
+
requestRender: surface.requestRender,
|
|
33
|
+
onSubmit: () => { },
|
|
34
|
+
onCopyText: text => surface.copyText(text),
|
|
35
|
+
paintEditorSelection: (line, from, to, atomic) => backgroundSgrSpan(line, from, to, atomic ? "\u001b[7m" : "\u001b[27m\u001b[48;2;38;79;120m", atomic ? "\u001b[27m" : "\u001b[49m", piShellVisibleWidth),
|
|
36
|
+
promptPresentation: {
|
|
37
|
+
input: new PromptInput({ fg: (token, text) => surface.theme.fg(token, text) }, {
|
|
38
|
+
measure: piShellVisibleWidth,
|
|
39
|
+
truncate: piShellTruncateToWidth,
|
|
40
|
+
}),
|
|
41
|
+
styleSuggestion: text => surface.theme.fg("dim", text),
|
|
42
|
+
styleSuggestionCaret: caretCell,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
editor.setFocused?.(true);
|
|
46
|
+
return {
|
|
47
|
+
render(width) {
|
|
48
|
+
columns = width;
|
|
49
|
+
return editor.render(width);
|
|
50
|
+
},
|
|
51
|
+
handleInput: (data) => editor.handleInput?.(data),
|
|
52
|
+
handlePointer: (event) => editor.handlePointer(event),
|
|
53
|
+
getText: () => editor.getText(),
|
|
54
|
+
hasSelection: () => editor.hasSelection(),
|
|
55
|
+
ownsPointer: () => editor.ownsPointer(),
|
|
56
|
+
setFocused: (focused) => editor.setFocused?.(focused),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -37,6 +37,8 @@ export interface OwnedUiSessionIdentityPort {
|
|
|
37
37
|
readonly sessionBindingGeneration: number;
|
|
38
38
|
readonly disposed: boolean;
|
|
39
39
|
currentSessionFile(): string | null;
|
|
40
|
+
/** The durable conversation identity; unlike sessionId it survives agent process restart. */
|
|
41
|
+
currentHistorySessionId(): string | null;
|
|
40
42
|
currentSessionResumeMetadata(): OwnedUiSessionResumeMetadata | null;
|
|
41
43
|
}
|
|
42
44
|
/** The session lifecycle, its view, its event stream, and command admission. */
|
|
@@ -337,9 +337,13 @@ export interface OwnedUiVisualExtensionSupport {
|
|
|
337
337
|
readonly renderCallbacks: typeof OWNED_UI_EXTENSION_RENDER_CALLBACKS;
|
|
338
338
|
readonly diagnostic: string;
|
|
339
339
|
}
|
|
340
|
-
/** A newer release found by the startup check. */
|
|
341
|
-
export
|
|
340
|
+
/** A newer release found by the startup check, or one installed for the next restart. */
|
|
341
|
+
export type OwnedUiReleaseUpdate = {
|
|
342
|
+
readonly status?: "available";
|
|
342
343
|
readonly version: string;
|
|
343
344
|
readonly command: string;
|
|
344
345
|
readonly changelogUrl: string | null;
|
|
345
|
-
}
|
|
346
|
+
} | {
|
|
347
|
+
readonly status: "installed";
|
|
348
|
+
readonly version: string;
|
|
349
|
+
};
|
|
@@ -14,6 +14,17 @@ export declare const DIALOG_BACK_SHORTCUT_HINT: Readonly<{
|
|
|
14
14
|
key: string;
|
|
15
15
|
action: string;
|
|
16
16
|
}>;
|
|
17
|
+
/** Global inset inherited by every semantic row inside an A1-owned dialog frame. */
|
|
18
|
+
export declare const DIALOG_CONTENT_PADDING_X = 1;
|
|
19
|
+
export interface DialogFrameGeometry {
|
|
20
|
+
readonly frameWidth: number;
|
|
21
|
+
readonly contentPaddingX: number;
|
|
22
|
+
readonly contentWidth: number;
|
|
23
|
+
}
|
|
24
|
+
/** Shared full-width-rule/content-width geometry for string and component dialog renderers. */
|
|
25
|
+
export declare function dialogFrameGeometry(width: number): DialogFrameGeometry;
|
|
26
|
+
/** Injects a semantic row into the frame's global content inset. */
|
|
27
|
+
export declare function insetDialogContent(row: string, geometry: DialogFrameGeometry): string;
|
|
17
28
|
export interface ShortcutHintRoles {
|
|
18
29
|
key(label: string): string;
|
|
19
30
|
action(name: string): string;
|
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
export const DIALOG_CLOSE_SHORTCUT_HINT = Object.freeze({ key: "esc", action: "close" });
|
|
3
3
|
/** Canonical return guidance for a nested step within a dialog surface. */
|
|
4
4
|
export const DIALOG_BACK_SHORTCUT_HINT = Object.freeze({ key: "esc", action: "back" });
|
|
5
|
+
/** Global inset inherited by every semantic row inside an A1-owned dialog frame. */
|
|
6
|
+
export const DIALOG_CONTENT_PADDING_X = 1;
|
|
7
|
+
/** Shared full-width-rule/content-width geometry for string and component dialog renderers. */
|
|
8
|
+
export function dialogFrameGeometry(width) {
|
|
9
|
+
const frameWidth = Math.max(0, width);
|
|
10
|
+
const contentPaddingX = Math.min(DIALOG_CONTENT_PADDING_X, frameWidth);
|
|
11
|
+
return { frameWidth, contentPaddingX, contentWidth: frameWidth - contentPaddingX };
|
|
12
|
+
}
|
|
13
|
+
/** Injects a semantic row into the frame's global content inset. */
|
|
14
|
+
export function insetDialogContent(row, geometry) {
|
|
15
|
+
return `${" ".repeat(geometry.contentPaddingX)}${row}`;
|
|
16
|
+
}
|
|
5
17
|
const SHORTCUT_KEY_NAMES = Object.freeze({
|
|
6
18
|
alt: "Alt", backspace: "Backspace", cmd: "Cmd", ctrl: "Ctrl", delete: "Delete", down: "Down", end: "End",
|
|
7
19
|
enter: "Enter", esc: "Esc", escape: "Escape", home: "Home", insert: "Insert", left: "Left", meta: "Meta",
|
|
@@ -19,6 +19,11 @@ export function resolveDevelopmentLaunchEnvironment(canonicalPackageRoot, releas
|
|
|
19
19
|
? join(developmentRoot, "config")
|
|
20
20
|
: join(checkoutRoot, "config");
|
|
21
21
|
const dataDir = resolve(source[PRODUCT_IDENTITY.environment.dataDir] ?? join(developmentRoot, "data"));
|
|
22
|
+
// Rationale: solo processes keep isolated control state but must see the same history
|
|
23
|
+
// after selecting Shared; use a checkout-wide root across rebuilds unless overridden.
|
|
24
|
+
const historyDataDir = resolve(source[PRODUCT_IDENTITY.environment.developmentHistoryDataDir]
|
|
25
|
+
?? source[PRODUCT_IDENTITY.environment.dataDir]
|
|
26
|
+
?? (selectedDevelopmentRoot ? dataDir : join(checkoutRoot, "data")));
|
|
22
27
|
return {
|
|
23
28
|
checkoutId,
|
|
24
29
|
releaseId,
|
|
@@ -27,6 +32,7 @@ export function resolveDevelopmentLaunchEnvironment(canonicalPackageRoot, releas
|
|
|
27
32
|
environment: {
|
|
28
33
|
...source,
|
|
29
34
|
[PRODUCT_IDENTITY.environment.developmentInstanceId]: instanceId,
|
|
35
|
+
[PRODUCT_IDENTITY.environment.developmentHistoryDataDir]: historyDataDir,
|
|
30
36
|
[PRODUCT_IDENTITY.environment.configDir]: resolve(source[PRODUCT_IDENTITY.environment.configDir] ?? persistentConfigDir),
|
|
31
37
|
[PRODUCT_IDENTITY.environment.dataDir]: dataDir,
|
|
32
38
|
[PRODUCT_IDENTITY.environment.runtimeDir]: resolve(source[PRODUCT_IDENTITY.environment.runtimeDir] ?? join(developmentRoot, "runtime")),
|
|
@@ -18,6 +18,10 @@ export function resolveLaunchProfilePaths(options = {}) {
|
|
|
18
18
|
export function resolvePromptHistoryDataDir(options = {}) {
|
|
19
19
|
const environment = options.environment ?? process.env;
|
|
20
20
|
const platform = options.platform ?? process.platform;
|
|
21
|
+
const developmentHistoryDataDir = environment[PRODUCT_IDENTITY.environment.developmentHistoryDataDir];
|
|
22
|
+
if (developmentHistoryDataDir !== undefined) {
|
|
23
|
+
return resolveProductPaths({ ...environment, [PRODUCT_IDENTITY.environment.dataDir]: developmentHistoryDataDir }, platform).dataDir;
|
|
24
|
+
}
|
|
21
25
|
if (environment[PRODUCT_IDENTITY.environment.dataDir] !== undefined) {
|
|
22
26
|
return resolveProductPaths(environment, platform).dataDir;
|
|
23
27
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { UiTheme } from "../../ui/components/index.js";
|
|
2
|
+
/** The A1 setting holding the tab kinds the strip's `+` offers. */
|
|
3
|
+
export declare const PLUS_MENU_SETTING_ID = "tabBarPlusMenu";
|
|
4
|
+
/** One tab kind the plus menu can offer. */
|
|
5
|
+
export interface PlusMenuKind {
|
|
6
|
+
readonly key: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The plus-menu dialog: every tab kind with `●` when `+` offers it and `○` when not, filtered by typed
|
|
11
|
+
* text. It owns only its filter and the row in hand; the enabled record and its saving stay with the
|
|
12
|
+
* Settings screen that opened it.
|
|
13
|
+
*/
|
|
14
|
+
export declare class PlusMenuDialog {
|
|
15
|
+
#private;
|
|
16
|
+
constructor(kinds: readonly PlusMenuKind[]);
|
|
17
|
+
/** The kinds the filter keeps, in kind order. */
|
|
18
|
+
shown(): readonly PlusMenuKind[];
|
|
19
|
+
/** Handles one key by its resolved name; `toggle` flips a kind. Returns whether the dialog closed. */
|
|
20
|
+
handle(name: string, data: string, toggle: (key: string) => void): "close" | "handled";
|
|
21
|
+
lines(enabled: Readonly<Record<string, boolean | string>>, width: number, theme: UiTheme): readonly string[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { LineInput, displayWidth, handleLineInputKey, renderInputRow, truncateToWidth, } from "../../ui/components/index.js";
|
|
2
|
+
/** The A1 setting holding the tab kinds the strip's `+` offers. */
|
|
3
|
+
export const PLUS_MENU_SETTING_ID = "tabBarPlusMenu";
|
|
4
|
+
const TITLE = "Plus Menu";
|
|
5
|
+
const DESCRIPTION = "Choose what the + button in the tab bar can add.";
|
|
6
|
+
const HINT = "Type search · ↑↓ navigate · Space toggle · Esc close";
|
|
7
|
+
/**
|
|
8
|
+
* The plus-menu dialog: every tab kind with `●` when `+` offers it and `○` when not, filtered by typed
|
|
9
|
+
* text. It owns only its filter and the row in hand; the enabled record and its saving stay with the
|
|
10
|
+
* Settings screen that opened it.
|
|
11
|
+
*/
|
|
12
|
+
export class PlusMenuDialog {
|
|
13
|
+
#kinds;
|
|
14
|
+
#filter = new LineInput("");
|
|
15
|
+
#index = 0;
|
|
16
|
+
constructor(kinds) {
|
|
17
|
+
this.#kinds = kinds;
|
|
18
|
+
}
|
|
19
|
+
/** The kinds the filter keeps, in kind order. */
|
|
20
|
+
shown() {
|
|
21
|
+
const needle = this.#filter.value.trim().toLowerCase();
|
|
22
|
+
return this.#kinds.filter(kind => needle.length === 0 || kind.label.toLowerCase().includes(needle));
|
|
23
|
+
}
|
|
24
|
+
/** Handles one key by its resolved name; `toggle` flips a kind. Returns whether the dialog closed. */
|
|
25
|
+
handle(name, data, toggle) {
|
|
26
|
+
const shown = this.shown();
|
|
27
|
+
if (name === "escape")
|
|
28
|
+
return "close";
|
|
29
|
+
if (name === "up" || name === "down") {
|
|
30
|
+
this.#index = Math.min(Math.max(0, shown.length - 1), Math.max(0, this.#index + (name === "down" ? 1 : -1)));
|
|
31
|
+
return "handled";
|
|
32
|
+
}
|
|
33
|
+
if (name === "space") {
|
|
34
|
+
const kind = shown[this.#index];
|
|
35
|
+
if (kind !== undefined)
|
|
36
|
+
toggle(kind.key);
|
|
37
|
+
return "handled";
|
|
38
|
+
}
|
|
39
|
+
handleLineInputKey(this.#filter, data);
|
|
40
|
+
this.#index = 0;
|
|
41
|
+
return "handled";
|
|
42
|
+
}
|
|
43
|
+
lines(enabled, width, theme) {
|
|
44
|
+
const rule = theme.fg("border", "─".repeat(Math.max(0, width)));
|
|
45
|
+
const inset = width > 0 ? " " : "";
|
|
46
|
+
const contentWidth = Math.max(0, width - inset.length);
|
|
47
|
+
const row = (painted, raw) => {
|
|
48
|
+
const clipped = truncateToWidth(painted, contentWidth);
|
|
49
|
+
return `${inset}${clipped}${" ".repeat(Math.max(0, contentWidth - displayWidth(raw)))}`;
|
|
50
|
+
};
|
|
51
|
+
const shown = this.shown();
|
|
52
|
+
const index = Math.min(this.#index, Math.max(0, shown.length - 1));
|
|
53
|
+
const rows = shown.length === 0
|
|
54
|
+
? [row(theme.fg("dim", "No tabs match"), "No tabs match")]
|
|
55
|
+
: shown.map((kind, position) => {
|
|
56
|
+
const selected = position === index;
|
|
57
|
+
const cursor = selected ? "→ " : " ";
|
|
58
|
+
const marker = enabled[kind.key] === true ? "●" : "○";
|
|
59
|
+
const raw = `${cursor}${marker} ${kind.label}`;
|
|
60
|
+
const content = `${selected ? theme.fg("accent", cursor) : cursor}${theme.fg("text", marker)} ${theme.fg("text", kind.label)}`;
|
|
61
|
+
return row(selected ? theme.highlight(content) : content, raw);
|
|
62
|
+
});
|
|
63
|
+
return [
|
|
64
|
+
rule,
|
|
65
|
+
row(theme.bold(theme.fg("accent", TITLE)), TITLE),
|
|
66
|
+
row(theme.fg("dim", DESCRIPTION), DESCRIPTION),
|
|
67
|
+
"",
|
|
68
|
+
...renderInputRow(this.#filter, width, { ruled: false, promptGlyph: "> ", theme }).lines,
|
|
69
|
+
"",
|
|
70
|
+
...rows,
|
|
71
|
+
"",
|
|
72
|
+
row(theme.fg("dim", HINT), HINT),
|
|
73
|
+
rule,
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -24,6 +24,8 @@ export interface ReferenceScreenOptions {
|
|
|
24
24
|
readonly document: ReferenceDocumentProvider;
|
|
25
25
|
/** The reader's scroll settings, read on every frame so a live change is honored. */
|
|
26
26
|
readonly scrollSettings: () => OwnedUiViewportSettings;
|
|
27
|
+
/** The screen is a resident tab, such as the Changelog tab: it offers no screen-level close. */
|
|
28
|
+
readonly pinned?: boolean;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Presents one read-only document full screen between two accent rules: the bold
|
|
@@ -48,6 +48,7 @@ export class ReferenceScreenApp {
|
|
|
48
48
|
#title;
|
|
49
49
|
#document;
|
|
50
50
|
#scrollSettings;
|
|
51
|
+
#pinned;
|
|
51
52
|
#scroll = 0;
|
|
52
53
|
#interruptArmed = false;
|
|
53
54
|
#failure = null;
|
|
@@ -67,6 +68,7 @@ export class ReferenceScreenApp {
|
|
|
67
68
|
this.#title = options.title;
|
|
68
69
|
this.#document = options.document;
|
|
69
70
|
this.#scrollSettings = options.scrollSettings;
|
|
71
|
+
this.#pinned = options.pinned === true;
|
|
70
72
|
}
|
|
71
73
|
onActivate(host) {
|
|
72
74
|
const ready = this.#document.ready;
|
|
@@ -139,7 +141,7 @@ export class ReferenceScreenApp {
|
|
|
139
141
|
const withRail = withScrollbarRail(body.slice(0, bodyHeight), geometry, contentWidth, theme, { presentation });
|
|
140
142
|
const hint = this.#interruptArmed
|
|
141
143
|
? theme.fg("dim", " press ctrl+c again to exit a1")
|
|
142
|
-
: renderShortcutHintsWithClose(
|
|
144
|
+
: renderShortcutHintsWithClose(this.#hintEntries(), theme, rect.width, 1);
|
|
143
145
|
// Compatibility: the v2 reference screen frames its document between two border-coloured rules.
|
|
144
146
|
const rule = theme.fg("border", "─".repeat(rect.width));
|
|
145
147
|
// Invariant: dialog chrome shares the title's one-cell inset; document content keeps its own layout.
|
|
@@ -153,7 +155,8 @@ export class ReferenceScreenApp {
|
|
|
153
155
|
return { consumed: false };
|
|
154
156
|
switch (action) {
|
|
155
157
|
case "close":
|
|
156
|
-
|
|
158
|
+
if (!this.#pinned)
|
|
159
|
+
host.close();
|
|
157
160
|
return { consumed: true };
|
|
158
161
|
case "up":
|
|
159
162
|
this.#scrollBy(-1);
|
|
@@ -216,6 +219,13 @@ export class ReferenceScreenApp {
|
|
|
216
219
|
}
|
|
217
220
|
return { owned: true, changed: true };
|
|
218
221
|
}
|
|
222
|
+
// Invariant: a pinned screen is its tab and `Esc` does not close it, so it shows no close hint.
|
|
223
|
+
#hintEntries() {
|
|
224
|
+
const entries = REFERENCE_SCREEN_SHORTCUTS.hintEntries(SCOPE);
|
|
225
|
+
if (!this.#pinned)
|
|
226
|
+
return entries;
|
|
227
|
+
return entries.filter(entry => entry.key !== DIALOG_CLOSE_SHORTCUT_HINT.key || entry.action !== DIALOG_CLOSE_SHORTCUT_HINT.action);
|
|
228
|
+
}
|
|
219
229
|
// Invariant: the title is the first document row, as in v2, so it scrolls with the document.
|
|
220
230
|
#content(width, theme) {
|
|
221
231
|
// Compatibility: one leading space, so the title lines up with the padded Markdown rows as in v2.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { AppHostServices, UiApp } from "../../ui/apps/index.js";
|
|
2
2
|
import { ShortcutRegistry, type PaneInputResult, type PaneMouseEvent, type PaneRect } from "../../ui/components/index.js";
|
|
3
3
|
import type { OwnedSettingsManager } from "../../ui/settings/index.js";
|
|
4
|
+
import type { SettingsSearchInputFactory } from "./settings-search-input.js";
|
|
4
5
|
export { SETTINGS_APP_ID, SETTINGS_ROUTE } from "./settings-route.js";
|
|
5
|
-
type Action = "move-up" | "move-down" | "block-up" | "block-down" | "first" | "last" | "page-up" | "page-down" | "previous-value" | "next-value" | "activate" | "
|
|
6
|
+
type Action = "move-up" | "move-down" | "block-up" | "block-down" | "first" | "last" | "page-up" | "page-down" | "previous-value" | "next-value" | "activate" | "edit-filter" | "close" | "undo" | "part-previous" | "part-next" | "part-change";
|
|
6
7
|
export declare const SETTINGS_SHORTCUTS: ShortcutRegistry<Action>;
|
|
7
8
|
/**
|
|
8
9
|
* The settings screen. Rows, sticky headers, scrolling, and the keymap come from
|
|
@@ -12,9 +13,15 @@ export declare const SETTINGS_SHORTCUTS: ShortcutRegistry<Action>;
|
|
|
12
13
|
export declare class SettingsApp implements UiApp {
|
|
13
14
|
#private;
|
|
14
15
|
readonly id = "settings";
|
|
15
|
-
/**
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* `pinned` presents the screen as a resident Settings tab, which offers no screen-level close;
|
|
18
|
+
* `configurePlusMenu` opens the tab bar's Plus Menu dialog in place of this screen's own.
|
|
19
|
+
*/
|
|
20
|
+
constructor(session: OwnedSettingsManager, options: {
|
|
17
21
|
readonly pinned?: boolean;
|
|
22
|
+
readonly searchInputFactory: SettingsSearchInputFactory;
|
|
23
|
+
readonly copyText?: (text: string) => void;
|
|
24
|
+
readonly configurePlusMenu?: (() => boolean) | null;
|
|
18
25
|
});
|
|
19
26
|
onActivate(host: AppHostServices): void;
|
|
20
27
|
onClose(_host: AppHostServices): void;
|