@acrylblends/blends-frame 0.0.0-stage → 0.1.0

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 (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -2
  3. package/cordis.patch.yml +3 -0
  4. package/lib/app-generation.d.ts +38 -0
  5. package/lib/app-generation.js +102 -0
  6. package/lib/app-generation.js.map +1 -0
  7. package/lib/app-plugins.d.ts +118 -0
  8. package/lib/app-reload.d.ts +73 -0
  9. package/lib/app-snapshot.d.ts +40 -0
  10. package/lib/app-urls.d.ts +17 -0
  11. package/lib/auto-save.d.ts +63 -0
  12. package/lib/branch-chats.d.ts +37 -0
  13. package/lib/client.js +18899 -0
  14. package/lib/client.js.map +1 -0
  15. package/lib/contract.d.ts +293 -0
  16. package/lib/git-sync.d.ts +52 -0
  17. package/lib/index.d.ts +169 -0
  18. package/lib/index.js +2923 -0
  19. package/lib/index.js.map +1 -0
  20. package/lib/outward-guard.d.ts +45 -0
  21. package/lib/real-chats.d.ts +42 -0
  22. package/lib/selection-context.d.ts +118 -0
  23. package/lib/tool-call-guard.d.ts +104 -0
  24. package/lib/types/client/BlendsFrame.d.ts +46 -0
  25. package/lib/types/client/FileView.d.ts +8 -0
  26. package/lib/types/client/FilesView.d.ts +17 -0
  27. package/lib/types/client/GitView.d.ts +18 -0
  28. package/lib/types/client/LeftPanel.d.ts +71 -0
  29. package/lib/types/client/PluginsSection.d.ts +7 -0
  30. package/lib/types/client/RemoteSync.d.ts +17 -0
  31. package/lib/types/client/RightPanel.d.ts +45 -0
  32. package/lib/types/client/SelectionChip.d.ts +59 -0
  33. package/lib/types/client/SettingsLauncher.d.ts +9 -0
  34. package/lib/types/client/ShortcutsRow.d.ts +15 -0
  35. package/lib/types/client/TerminalView.d.ts +7 -0
  36. package/lib/types/client/TurnSaveFooter.d.ts +18 -0
  37. package/lib/types/client/app-reload.d.ts +28 -0
  38. package/lib/types/client/branch-chats.d.ts +71 -0
  39. package/lib/types/client/branches.d.ts +23 -0
  40. package/lib/types/client/canvas/AppCanvas.d.ts +25 -0
  41. package/lib/types/client/canvas/app-canvas.d.ts +59 -0
  42. package/lib/types/client/canvas/picker.d.ts +27 -0
  43. package/lib/types/client/chat-draft.d.ts +15 -0
  44. package/lib/types/client/chat-saves.d.ts +28 -0
  45. package/lib/types/client/chats.d.ts +182 -0
  46. package/lib/types/client/feedback.d.ts +21 -0
  47. package/lib/types/client/frame-state.d.ts +34 -0
  48. package/lib/types/client/frame-view.d.ts +35 -0
  49. package/lib/types/client/fuzzy.d.ts +23 -0
  50. package/lib/types/client/git-sync.d.ts +39 -0
  51. package/lib/types/client/highlight.d.ts +15 -0
  52. package/lib/types/client/index.d.ts +23 -0
  53. package/lib/types/client/panel-resize.d.ts +29 -0
  54. package/lib/types/client/plugins-navigator.d.ts +51 -0
  55. package/lib/types/client/selection.d.ts +56 -0
  56. package/lib/types/client/sidebar-opens.d.ts +36 -0
  57. package/lib/types/client/snapshot.d.ts +11 -0
  58. package/lib/types/client/styles.d.ts +3 -0
  59. package/lib/types/client/switch-request.d.ts +18 -0
  60. package/lib/types/client/tab-sizing.d.ts +31 -0
  61. package/lib/types/client/tabs.d.ts +139 -0
  62. package/lib/types/client/tools.d.ts +15 -0
  63. package/lib/types/client/versions.d.ts +34 -0
  64. package/lib/types/client/view-state.d.ts +42 -0
  65. package/lib/types/contract.d.ts +293 -0
  66. package/package.json +122 -4
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The Git tab's push and pull: the calls to the frame's Host (which runs git), and how the branch's remote state reads in one line.
3
+ */
4
+ import { type GitRemoteState, type GitSyncResult, type PushPlan } from '../contract.ts';
5
+ export interface GitSyncPort {
6
+ /** The checked-out branch against its remote; `fetch` asks the remote first. @throws the Host's one line. */
7
+ remote(fetch: boolean): Promise<GitRemoteState>;
8
+ /** What a push would send and where, after asking the remote; nothing is sent. @throws the line saying why there is nothing to push. */
9
+ planPush(): Promise<PushPlan>;
10
+ /** Sends only the confirmed plan. @throws git's one line (a refused login, the network) or the reason nothing was sent. */
11
+ push(confirmed: PushPlan): Promise<GitSyncResult>;
12
+ /** Fast-forward only. @throws git's one line, or the sentence saying the branch moved on both sides and nothing changed. */
13
+ pull(): Promise<GitSyncResult>;
14
+ }
15
+ type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
16
+ export declare function createGitSyncApi(fetcher?: FetchLike): GitSyncPort;
17
+ /** The question a push asks before anything is sent: how many versions, where they land and the remote's address. */
18
+ export declare function pushQuestion(plan: PushPlan): string;
19
+ /** The remote state as the Git tab writes it: "origin/main · ahead 2 · behind 1", "up to date with origin/main", "no remote", ... */
20
+ export declare function remoteLabel(state: GitRemoteState): string;
21
+ /**
22
+ * Which buttons do something: Push when there is something to send (or the branch is not on the remote yet), Pull when the remote is ahead.
23
+ * When the remote could not be asked the counts may be old, so both stay on and a click says what git says.
24
+ */
25
+ export declare function syncActions(state: GitRemoteState): {
26
+ readonly push: boolean;
27
+ readonly pull: boolean;
28
+ };
29
+ /**
30
+ * The versions header's compact remote control: `↑2` sends the versions only here, `↓1` brings the remote's in, `✓` says the branch and its
31
+ * remote agree; nothing at all without a remote (or off a branch). A first push shows a bare `↑`. Each chip's tooltip is the remote state's line.
32
+ */
33
+ export interface RemoteChips {
34
+ readonly push?: string;
35
+ readonly pull?: string;
36
+ readonly synced: boolean;
37
+ }
38
+ export declare function remoteChips(state: GitRemoteState): RemoteChips | undefined;
39
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Syntax colours for the file tab: a small tokenizer for the languages an app is written in (TypeScript and JavaScript, JSON, CSS, HTML, YAML,
3
+ * shell, Markdown). It colours, it does not parse; a token it does not know stays plain text.
4
+ */
5
+ export type TokenKind = 'kw' | 'fn' | 'st' | 'ty' | 'pu' | 'va' | 'cm' | 'nu' | 'plain';
6
+ export interface Token {
7
+ readonly kind: TokenKind;
8
+ readonly text: string;
9
+ }
10
+ type Language = 'code' | 'hash' | 'markup' | 'plain';
11
+ /** Which tokenizer a file gets, by its extension. */
12
+ export declare function languageOf(path: string): Language;
13
+ /** One line's tokens. Lines are coloured one at a time, so a block comment over several lines is coloured only on its first. */
14
+ export declare function highlightLine(line: string, language: Language): Token[];
15
+ export {};
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Cordis Client plugin: the Blends frame owns the page's `root` slot and draws the workbench around the app (docs/design/blends-frame-mockup.html).
3
+ * It composes no IDE workbench: the ACRYL IDE keeps its own root owner (`acryl-workspace` through `acryl-app-shell`), and a Blueprint mounts one
4
+ * of the two, never both, since `root` is a single slot.
5
+ */
6
+ import '@deepseek-ai/dsh-client-ui-renderer/client';
7
+ import type { Context as ClientContext } from '@deepseek-ai/cordis';
8
+ import { AppCanvasState } from './canvas/app-canvas.ts';
9
+ declare module '@deepseek-ai/cordis' {
10
+ interface Context {
11
+ /** The centre canvas: `ctx.appCanvas.address()`, `.navigate(path)`, `.reload()`, `.pageWindow()`. */
12
+ appCanvas: AppCanvasState;
13
+ }
14
+ }
15
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
16
+ interface LocaleNamespaceMap {
17
+ 'acryl.blendsFrame': 'plugins';
18
+ }
19
+ }
20
+ /** The Loader row that composes the app's own plugins (`frame/app-plugins.mjs`): loading it again applies a switch in `blend.yaml`. */
21
+ export declare const name = "acryl-blends-frame-client";
22
+ export declare const inject: string[];
23
+ export declare function apply(ctx: ClientContext): void;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The panels' resize rule, from the owner's T009: a panel is dragged by its inner edge; the centre (the app) keeps at least 360px, a panel stays
3
+ * between 180px and 60% of the window, and a double-click puts the default width back. The rule is a pure function so the drag and the render agree:
4
+ * the frame stores a width, and what is on screen is that width clamped to what the window allows now (a window that shrank must not squeeze the app).
5
+ */
6
+ export type PanelSide = 'left' | 'right';
7
+ export interface PanelWidths {
8
+ readonly left: number;
9
+ readonly right: number;
10
+ }
11
+ /** The mockup's widths: what a double-click restores, and what a panel has the first time. */
12
+ export declare const DEFAULT_PANEL_WIDTHS: PanelWidths;
13
+ export declare const PANEL_MIN_WIDTH = 180;
14
+ export declare const CENTRE_MIN_WIDTH = 360;
15
+ export declare const PANEL_MAX_SHARE = 0.6;
16
+ /**
17
+ * `want` clamped to the panel's range. `otherWidth` is the other panel as it is on screen (0 when it is closed): the centre always keeps
18
+ * {@link CENTRE_MIN_WIDTH} while the window is wide enough for both minimums, and a panel never takes more than {@link PANEL_MAX_SHARE} of the window.
19
+ * A window too narrow for the minimums leaves the panels at {@link PANEL_MIN_WIDTH}, the way the mockup does.
20
+ */
21
+ export declare function clampPanelWidth(want: number, windowWidth: number, otherWidth: number): number;
22
+ /**
23
+ * What the frame shows for the stored widths: a closed panel is 0 and keeps its stored width for when it opens again; the left panel is settled
24
+ * first, the right one then against what the left really takes, so the two clamps together never add up past the window.
25
+ */
26
+ export declare function resolvePanelWidths(stored: PanelWidths, open: {
27
+ readonly left: boolean;
28
+ readonly right: boolean;
29
+ }, windowWidth: number): PanelWidths;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Settings → Plugins (docs/design/blends-frame-mockup.html): everything the app is made of, in one list, all read from the frame's Host: the
3
+ * app's plugins (`blend.yaml` rows and what was written into `plugins/`) and the frame's own Loader rows. A switch writes where the plugin is
4
+ * chosen; the Host then starts the app's plugins again, and the canvas loads the app page again.
5
+ */
6
+ import { type AppPluginKind, type AppPluginsView, type AppPluginView, type FramePluginView, type SharedPluginView, type SharePlan } from '../contract.ts';
7
+ /** Sharing a local plugin: first what it would do, then, on the person's yes, exactly that. */
8
+ export interface PluginShare {
9
+ plan(): Promise<SharePlan>;
10
+ publish(confirmed: SharePlan): Promise<SharedPluginView>;
11
+ }
12
+ /** The question a share asks before anything is sent: the repository, whether it is created, the version and who can see it. */
13
+ export declare function shareQuestion(plan: SharePlan): string;
14
+ /** Which filter chip a plugin falls under. */
15
+ export type PluginGroup = 'made' | 'registry' | 'frame';
16
+ export interface NavigatorPlugin {
17
+ /** Unique across groups: `app:<name>` or `frame:<entryId>`. */
18
+ readonly key: string;
19
+ readonly name: string;
20
+ readonly group: PluginGroup;
21
+ /** The badge: who made it ("Claude · today"), "registry", "frame". */
22
+ readonly by: string;
23
+ readonly description: string;
24
+ readonly on: boolean;
25
+ /** Shown after the description: "active", "off", "not saved yet", "failed". */
26
+ readonly state: string;
27
+ /** Where a local plugin was shared: its repository and released version. */
28
+ readonly shared?: SharedPluginView;
29
+ /** Publish this local plugin so another app can install it, after the person confirms its plan. Absent when the row cannot be shared here. */
30
+ readonly share?: PluginShare;
31
+ /** Absent when the plugin cannot be switched here (the frame's protected rows). */
32
+ readonly toggle?: (on: boolean) => Promise<void>;
33
+ }
34
+ /** "today", "yesterday", "Mon", or "12 Oct" for an older day. */
35
+ export declare function madeWhen(at: string, now?: Date): string;
36
+ export declare function appPluginRow(plugin: AppPluginView, toggle: (on: boolean) => Promise<void>, share?: PluginShare, now?: Date): NavigatorPlugin;
37
+ /** One of the frame's own plugins: shown with its state, switched only by changing the frame. */
38
+ export declare function framePluginRow(plugin: FramePluginView): NavigatorPlugin;
39
+ /** The plugins a search and a chip leave. */
40
+ export declare function filterPlugins(plugins: readonly NavigatorPlugin[], query: string, group: PluginGroup | 'all'): NavigatorPlugin[];
41
+ type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
42
+ export interface AppPluginsApi {
43
+ read(): Promise<AppPluginsView>;
44
+ switch(kind: AppPluginKind, name: string, on: boolean): Promise<void>;
45
+ /** What sharing one local plugin would do; nothing is sent. */
46
+ planShare(name: string): Promise<SharePlan>;
47
+ /** Share one local plugin as the person confirmed it; answers where it went. */
48
+ share(name: string, confirmed: SharePlan): Promise<SharedPluginView>;
49
+ }
50
+ export declare function createAppPluginsApi(fetcher?: FetchLike): AppPluginsApi;
51
+ export {};
@@ -0,0 +1,56 @@
1
+ /**
2
+ * An element the person picked in the app canvas, and the context the next chat message carries for it
3
+ * (docs/design/blends-frame-mockup.html, scenario 2, "Building with the chat"). The frame owns the picker and the chip above the
4
+ * composer; the send gesture hands the pick to the frame's Host, which gives it to the agent as context for that message, so the person's own
5
+ * bubble keeps exactly their words.
6
+ */
7
+ /** One element picked in the app's page. `page` is the app path the canvas shows, with its query. */
8
+ export interface SelectedElement {
9
+ readonly label: string;
10
+ readonly selector: string;
11
+ readonly page: string;
12
+ }
13
+ /** What the frame knows about the selected element; the chip and the send hook read it. */
14
+ export declare class SelectionStore {
15
+ private snapshot;
16
+ private readonly listeners;
17
+ getSnapshot(): {
18
+ readonly selection: SelectedElement | undefined;
19
+ };
20
+ subscribe(listener: () => void): () => void;
21
+ select(element: SelectedElement): void;
22
+ clear(): void;
23
+ private publish;
24
+ }
25
+ /**
26
+ * A short name for an element: what it says it is, else its heading, else the first words it shows (a card's title, not its title run into the
27
+ * line under it), else its tag (plugins/feedback/client.js).
28
+ */
29
+ export declare function elementLabel(element: Element): string;
30
+ /** A CSS selector that finds the element again: up from it to the nearest id, each step its tag and place among its siblings. */
31
+ export declare function elementSelector(element: Element): string;
32
+ /** The element under a click, described as the chat will carry it; `page` is the app page's path and query. */
33
+ export declare function selectedElement(element: Element, page: string): SelectedElement;
34
+ /** Whether a draft carries a chat message the pick belongs to: it has words and is not a slash command (those are not chat messages). */
35
+ export declare function carriesSelection(draft: string): boolean;
36
+ /** What the frame's Host reads for one pick: the chat it belongs to and the element itself. */
37
+ export interface SelectionPost {
38
+ readonly session: string;
39
+ readonly label: string;
40
+ readonly page: string;
41
+ readonly selector: string;
42
+ }
43
+ /** The body one send gesture posts for its pick. */
44
+ export declare function selectionPost(session: string, element: SelectedElement): SelectionPost;
45
+ type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
46
+ /**
47
+ * Hand the pick to the frame's Host at the person's send gesture, before the composer sends: the Host attaches it to the step that reads this
48
+ * message and never writes it into the message (./selection-context.ts on the Host side). Nothing awaits the answer, so every send gesture keeps
49
+ * working and a hand-off that fails costs only the context, never the person's message.
50
+ * @param fetcher - the page's fetch.
51
+ * @param session - the chat being sent to.
52
+ * @param element - the picked element.
53
+ * @returns whether the Host took it; the frame does not wait for this to send.
54
+ */
55
+ export declare function handOffSelection(fetcher: FetchLike, session: string, element: SelectedElement): Promise<boolean>;
56
+ export {};
@@ -0,0 +1,36 @@
1
+ /**
2
+ * DSH's right sidebar (`dsh-client-ui-sidebar-right`) is drawn in the right panel's Panel tab. When something opens a page in it (a Plan card's button,
3
+ * a file of a turn's changes, a file an answer names) the person has to see it, so the Panel tab comes forward. The layout only says whether the sidebar
4
+ * is shown, which does not change when it already is; what changes on every open is the opened tab's navigation record, whose `revision` DSH increments
5
+ * on each navigation to it (`SidebarRightTabNavigation`), including a page that was already open.
6
+ */
7
+ /** The part of DSH's `SidebarRightController` an open is read from. */
8
+ export interface SidebarRightOpens {
9
+ /** Every open tab of every session, published on each change. */
10
+ readonly openTabs: {
11
+ getSnapshot(): readonly {
12
+ readonly sessionId: string;
13
+ readonly tabId: string;
14
+ }[];
15
+ subscribe(listener: () => void): () => void;
16
+ };
17
+ readonly tabDomain: {
18
+ /** @throws while the tab has no navigation record yet (it is being opened, or its session is not on screen). */
19
+ occurrence(sessionId: string, tab: {
20
+ readonly id: string;
21
+ }): {
22
+ readonly navigation: {
23
+ getSnapshot(): {
24
+ readonly revision: number;
25
+ };
26
+ subscribe(listener: () => void): () => void;
27
+ };
28
+ };
29
+ };
30
+ }
31
+ /**
32
+ * Call `opened` on every open in the sidebar after this call. The tabs already there, and those a session brings back from its saved layout (revision 0),
33
+ * are not opens.
34
+ * @returns the disposer.
35
+ */
36
+ export declare function watchSidebarOpens(sidebar: SidebarRightOpens, opened: () => void): () => void;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The capture a Save point starts with: the app's snapshot verb `capture` on the frame's Host, so every version is a captured snapshot.
3
+ */
4
+ import { type SnapshotCapture } from '../contract.ts';
5
+ export interface SnapshotPort {
6
+ /** Undefined when the app was made before the snapshot verbs. @throws the Host's one line (a `blend.yaml` that does not parse). */
7
+ capture(): Promise<SnapshotCapture | undefined>;
8
+ }
9
+ type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
10
+ export declare function createSnapshotApi(fetcher?: FetchLike): SnapshotPort;
11
+ export {};
@@ -0,0 +1,3 @@
1
+ /** The frame's look, taken from the owner's mockup (docs/design/blends-frame-mockup.html): a dark workbench around the app's own light page. */
2
+ /** @returns disposer, for one owning `ctx.effect`. */
3
+ export declare function installFrameStyles(): () => void;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * A chat that lives on another branch, asked for from somewhere other than the left panel (the chat's History): the left panel owns the switch, with its
3
+ * save point and its guard, so the History hands the request to it instead of switching by itself.
4
+ */
5
+ export interface SwitchRequest {
6
+ readonly branch: string;
7
+ /** The chat to open once the folder has moved. */
8
+ readonly chat: string;
9
+ }
10
+ export declare class SwitchRequests {
11
+ private pending;
12
+ private readonly listeners;
13
+ getSnapshot(): SwitchRequest | undefined;
14
+ subscribe(listener: () => void): () => void;
15
+ request(request: SwitchRequest): void;
16
+ /** The left panel took the request. */
17
+ clear(): void;
18
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The right panel's tab strip sizing (412px wide beside the canvas): every open chat has a tab, so several chats and tools have to share that width instead
3
+ * of running past its edge and clipping their labels. Each tab takes an equal share of the strip between a minimum and a maximum; a label that does not fit
4
+ * ellipsizes inside its tab, the model or agent kind ("DeepSeek", "PTY") is dropped when the share is too narrow for it, and when even the minimums do not
5
+ * fit the strip scrolls with the tabs at the minimum. The rule is pure so the one-tab case and the crowded ones are checked without a browser.
6
+ */
7
+ export interface TabSizingOptions {
8
+ /** The least a tab may take; below this the strip scrolls. */
9
+ readonly min?: number;
10
+ /** The most one tab takes, however wide the panel. */
11
+ readonly max?: number;
12
+ /** The gap between tabs. */
13
+ readonly gap?: number;
14
+ /** The + button at the strip's right edge, which keeps its width. */
15
+ readonly plus?: number;
16
+ /** The narrowest tab that still has room for its kind beside the label. */
17
+ readonly kindMin?: number;
18
+ }
19
+ /** One tab's size and the strip's behavior at a given width. */
20
+ export interface TabSizing {
21
+ /** The most one tab may take. */
22
+ readonly width: number;
23
+ /** Whether the strip has to scroll: the minimums do not fit. */
24
+ readonly scroll: boolean;
25
+ /** Whether a tab shows its kind ("DeepSeek", "PTY") beside the label. */
26
+ readonly kind: boolean;
27
+ }
28
+ /** The frame's sizes: five tabs fit the 412px panel at the minimum without scrolling. */
29
+ export declare const TAB_SIZING: Required<TabSizingOptions>;
30
+ /** The tab strip's sizing for `count` tabs in a strip `stripWidth` px wide. */
31
+ export declare function tabSizing(stripWidth: number, count: number, options?: TabSizingOptions): TabSizing;
@@ -0,0 +1,139 @@
1
+ /**
2
+ * The right panel's tabs (docs/design/blends-frame-mockup.html): the chat, PTY agents (Claude Code, Codex, Pi as they are, in a terminal), a
3
+ * terminal, Files, a file opened from it, and Git. One store for the right panel's strip and the left panel's open items; remembered per page.
4
+ * A terminal tab names the Host's PTY session, which outlives the page, so a reload shows the same terminal again. Every tab but the chat belongs
5
+ * to the branch it was opened on: the strip shows the checked-out branch's tabs, and the others stay (a terminal keeps running) out of the list.
6
+ */
7
+ import type { ViewStorage } from './view-state.ts';
8
+ /** The PTY agents the + menu offers, in its order: their workspace agent ids and labels. */
9
+ export declare const PTY_AGENTS: readonly [{
10
+ readonly agent: "claude";
11
+ readonly label: "Claude Code";
12
+ readonly tab: "Claude";
13
+ }, {
14
+ readonly agent: "codex";
15
+ readonly label: "Codex";
16
+ readonly tab: "Codex";
17
+ }, {
18
+ readonly agent: "pi";
19
+ readonly label: "Pi";
20
+ readonly tab: "Pi";
21
+ }];
22
+ export type PtyAgent = (typeof PTY_AGENTS)[number]['agent'];
23
+ export type FrameTab =
24
+ /** `chat` is the base tab, always there: the branch's chat. A chat made with "+ then Chat" has a tab of its own, named `chat:<session>`. */
25
+ {
26
+ readonly kind: 'chat';
27
+ readonly id: string;
28
+ readonly session?: string;
29
+ readonly branch?: string;
30
+ } | {
31
+ readonly kind: 'pty';
32
+ readonly id: string;
33
+ readonly agent: PtyAgent;
34
+ readonly terminalId: string;
35
+ readonly branch?: string;
36
+ } | {
37
+ readonly kind: 'terminal';
38
+ readonly id: string;
39
+ readonly terminalId: string;
40
+ readonly branch?: string;
41
+ } | {
42
+ readonly kind: 'files';
43
+ readonly id: 'files';
44
+ readonly branch?: string;
45
+ } | {
46
+ readonly kind: 'file';
47
+ readonly id: string;
48
+ readonly path: string;
49
+ readonly branch?: string;
50
+ } | {
51
+ readonly kind: 'git';
52
+ readonly id: 'git';
53
+ readonly branch?: string;
54
+ }
55
+ /**
56
+ * DSH's right sidebar (`ui-sidebar-right`): the Plan, the changed-files review and the files an answer links to, as DSH draws them. It shows the chat on
57
+ * screen, whatever the branch, so it is on every branch like the base chat tab.
58
+ */
59
+ | {
60
+ readonly kind: 'details';
61
+ readonly id: 'details';
62
+ readonly branch?: string;
63
+ };
64
+ export interface FrameTabsSnapshot {
65
+ readonly tabs: readonly FrameTab[];
66
+ readonly active: string;
67
+ /**
68
+ * The base chat tab's x was pressed: its chat was closed like any chat tab's, and the strip keeps the tab away until a chat is opened again.
69
+ * Absent means open, the first-run state.
70
+ */
71
+ readonly baseClosed?: boolean;
72
+ /**
73
+ * What each terminal says it runs (its title, as a shell sets it: `npm test`), by terminal id. Remembered, so a terminal row still says what ran in it
74
+ * after the page reloads or the Host restarts and the shell that set the title is gone.
75
+ */
76
+ readonly titles?: Readonly<Record<string, string>>;
77
+ }
78
+ /** The first run: the chat alone. */
79
+ export declare const FIRST_RUN_TABS: FrameTabsSnapshot;
80
+ export declare const chatTab: (session: string) => FrameTab;
81
+ export declare const ptyTab: (agent: PtyAgent, terminalId: string) => FrameTab;
82
+ export declare const terminalTab: (terminalId: string) => FrameTab;
83
+ export declare const fileTab: (path: string) => FrameTab;
84
+ export declare const FILES_TAB: FrameTab;
85
+ export declare const GIT_TAB: FrameTab;
86
+ export declare const DETAILS_TAB: FrameTab;
87
+ /**
88
+ * What each file tab calls itself: the file's name, or as much of its folder as it takes to tell it from the other file tabs open beside it. Two
89
+ * `index.ts` in different folders read `team-board/index.ts` and `src/index.ts`; a name no other tab shares keeps its file name alone.
90
+ */
91
+ export declare function fileTabLabels(paths: readonly string[]): ReadonlyMap<string, string>;
92
+ /**
93
+ * The tabs the strip shows on a branch: the base chat (unless its x closed it), and what was opened on that branch. No branch (outside a repository):
94
+ * every tab.
95
+ */
96
+ export declare function tabsForBranch(snapshot: FrameTabsSnapshot, branch: string | undefined): readonly FrameTab[];
97
+ /** A remembered strip, or the first run's when it is missing or malformed. The chat is always there, first. */
98
+ export declare function parseStoredTabs(raw: string | null): FrameTabsSnapshot;
99
+ /** The tab a terminal session shows in, if one does. */
100
+ export declare function tabOfTerminal(snapshot: FrameTabsSnapshot, terminalId: string): FrameTab | undefined;
101
+ export declare class FrameTabs {
102
+ private readonly storage?;
103
+ private snapshot;
104
+ private readonly listeners;
105
+ /** The checked-out branch the strip is showing; new tabs are opened on it. */
106
+ private branch;
107
+ /** Whether the remembered tabs already went through the branch migration (see `setBranch`). */
108
+ private branched;
109
+ constructor(storage?: ViewStorage | undefined);
110
+ getSnapshot(): FrameTabsSnapshot;
111
+ subscribe(listener: () => void): () => void;
112
+ /**
113
+ * The checked-out branch. The first time it is known, the tabs remembered before branches had their own lists (every tab carried no branch) are
114
+ * put on that branch, which is where they were opened as far as anyone can tell; later calls only change where new tabs go.
115
+ */
116
+ setBranch(branch: string | undefined): void;
117
+ /** Show a tab, adding it at the end of the strip when it is not open yet; a tab opened now belongs to the checked-out branch. */
118
+ open(tab: FrameTab): void;
119
+ /** Add tabs that are not in the strip yet, at the end, without showing them; a tab added now belongs to the checked-out branch. */
120
+ add(...added: readonly FrameTab[]): void;
121
+ activate(id: string): void;
122
+ /** The id of the tab that shows a chat: its own when it has one, else the base chat tab. */
123
+ chatTabId(session: string): string;
124
+ /**
125
+ * Close a tab; the one before it is shown when it was. The base chat tab closes like any other (its chat is closed by the panel, and the tab
126
+ * returns when a chat is opened again). @returns the closed tab.
127
+ */
128
+ close(id: string): FrameTab | undefined;
129
+ /** Close the chat tabs of chats that are not open (a chat closed on another page, or before this strip was remembered). @returns whether any closed. */
130
+ closeChatsNotIn(open: ReadonlySet<string>): boolean;
131
+ /** A terminal's program set its title; remembered with the strip, so the row still says what ran there after a reload or a Host restart. */
132
+ setTitle(terminalId: string, title: string): void;
133
+ private set;
134
+ }
135
+ /**
136
+ * What a terminal row says it runs: the command a shell put in its title (`npm test`); an idle prompt's `user@host:/path/app` title says only
137
+ * the folder (`app`).
138
+ */
139
+ export declare function terminalMeta(title: string | undefined): string;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The right panel's tools, from the workspace's reusable client layers (`acryl-workspace/ui`): the live terminal sessions and the PTY, files and
3
+ * git routes its Host half serves (run by this frame's Host, see `../index.ts`). Built once per client activation; the effect that builds it
4
+ * releases the sessions.
5
+ */
6
+ import { TerminalRegistry, type WorkspaceFilesApi, type WorkspaceGitApi, type WorkspacePtyApi } from '@acrylblends/workspace/ui';
7
+ export interface FrameTools {
8
+ readonly terminals: TerminalRegistry;
9
+ readonly pty: WorkspacePtyApi;
10
+ readonly files: WorkspaceFilesApi;
11
+ readonly git: WorkspaceGitApi;
12
+ }
13
+ export declare function createFrameTools(): FrameTools;
14
+ /** xterm's own stylesheet, once per page. @returns disposer, for one owning `ctx.effect`. */
15
+ export declare function installXtermStyles(): () => void;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The versions the left panel lists, through `acryl-versions`: the calls it makes, how a version is numbered, how its time reads, and which
3
+ * versions are shared (also on another branch or the remote, which the frame's Host answers).
4
+ */
5
+ import type { VersionsEntry, VersionsLogView } from '@acrylblends/versions';
6
+ export interface VersionsPort {
7
+ log(path: string): Promise<VersionsLogView>;
8
+ save(path: string, message: string): Promise<unknown>;
9
+ /** Put the app back to a version as a new version on top (history is never rewritten), then show it: the frame state read again, the app page reloaded. */
10
+ restore(path: string, hash: string, message: string): Promise<unknown>;
11
+ /** The versions that are also on another local branch or a remote-tracking branch. */
12
+ shared(hashes: readonly string[]): Promise<readonly string[]>;
13
+ }
14
+ type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
15
+ export interface SharedVersionsApi {
16
+ /** @throws when the Host does not answer the shared check. */
17
+ shared(hashes: readonly string[]): Promise<readonly string[]>;
18
+ }
19
+ export declare function createSharedVersionsApi(fetcher?: FetchLike): SharedVersionsApi;
20
+ /** "v7" for the newest of seven versions: the number counts from the first. */
21
+ export declare function versionNumber(entries: readonly VersionsEntry[], index: number): number;
22
+ /** "saved" when nothing changed since the last version, else how many files did; nothing outside a repository. */
23
+ export declare function savedLabel(unsaved: number | undefined): string | undefined;
24
+ /** The versions list's short time: "now", "2 min", "2 h", the weekday within a week ("Sun"), then days ("9 d"). */
25
+ export declare function shortTime(at: string, now?: number): string;
26
+ /** A chat's "last active" in the same short form as a version's time; empty when DSH did not say. */
27
+ export declare function chatTime(updatedAt: number | undefined, now?: number): string;
28
+ /** The new version's name when the app goes back to one: "Back to v2 · Due dates". */
29
+ export declare function backToMessage(number: number, subject: string): string;
30
+ /** The save point made first when files are unsaved. */
31
+ export declare function saveBeforeBackMessage(number: number): string;
32
+ /** What the confirmation says; with unsaved files (or an uncounted tree) it says a save point comes first. */
33
+ export declare function backText(number: number, subject: string, unsaved: number | undefined): string;
34
+ export {};
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The frame's own view: which panels are open, their widths and which mode it is in. Both panels open on the first run; after that the person's choice
3
+ * is remembered in the page's storage. The frame's page is the app's own origin (its own port), so the widths are the app's own: another app has its
4
+ * own storage, and a restart keeps them. A storage that throws (a private window, blocked site data) only costs the memory.
5
+ */
6
+ import { type PanelSide } from './panel-resize.ts';
7
+ export type FrameMode = 'build' | 'preview';
8
+ export interface FrameView {
9
+ readonly left: boolean;
10
+ readonly right: boolean;
11
+ readonly mode: FrameMode;
12
+ /** The width the person last gave each panel; a collapsed panel keeps its own and returns at it. */
13
+ readonly leftWidth: number;
14
+ readonly rightWidth: number;
15
+ }
16
+ export declare const FIRST_RUN_VIEW: FrameView;
17
+ /** A stored view, or the first-run view for anything absent or malformed. A stored view from before the resize keeps its panels and gets the defaults. */
18
+ export declare function parseStoredView(raw: string | null): FrameView;
19
+ export interface ViewStorage {
20
+ getItem(key: string): string | null;
21
+ setItem(key: string, value: string): void;
22
+ }
23
+ export declare class FrameViewState {
24
+ private readonly storage;
25
+ private view;
26
+ private readonly listeners;
27
+ constructor(storage: ViewStorage | undefined);
28
+ getSnapshot(): FrameView;
29
+ subscribe(listener: () => void): () => void;
30
+ toggleLeft(): void;
31
+ toggleRight(): void;
32
+ /** Show the left panel (something in it was asked for); Preview is left for Build, where the panel is. */
33
+ showLeft(): void;
34
+ /** Show the right panel (something was opened in it); Preview is left for Build, where the panel is. */
35
+ showRight(): void;
36
+ setMode(mode: FrameMode): void;
37
+ /** The width a drag settled on; a collapsed panel keeps it for the next time it opens. A click that settled on the same width writes nothing. */
38
+ setWidth(side: PanelSide, width: number): void;
39
+ /** Double-click on the panel's inner edge: the default width comes back. */
40
+ resetWidth(side: PanelSide): void;
41
+ private publish;
42
+ }