@acryldev/blends-frame 0.0.0-stage → 0.1.6

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 (92) 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 +101 -0
  6. package/lib/app-generation.js.map +1 -0
  7. package/lib/app-plugins.d.ts +145 -0
  8. package/lib/app-reload.d.ts +74 -0
  9. package/lib/app-snapshot.d.ts +40 -0
  10. package/lib/app-urls.d.ts +17 -0
  11. package/lib/applied-live.d.ts +43 -0
  12. package/lib/auto-save.d.ts +63 -0
  13. package/lib/branch-chats.d.ts +37 -0
  14. package/lib/client.js +50401 -0
  15. package/lib/client.js.map +1 -0
  16. package/lib/contract.d.ts +414 -0
  17. package/lib/git-sync.d.ts +52 -0
  18. package/lib/github-connect.d.ts +44 -0
  19. package/lib/graph-contract.d.ts +85 -0
  20. package/lib/graph-inspect.d.ts +16 -0
  21. package/lib/index.d.ts +186 -0
  22. package/lib/index.js +4060 -0
  23. package/lib/index.js.map +1 -0
  24. package/lib/outward-guard.d.ts +45 -0
  25. package/lib/plain.d.ts +26 -0
  26. package/lib/plugin-graph.d.ts +38 -0
  27. package/lib/real-chats.d.ts +42 -0
  28. package/lib/registry.d.ts +73 -0
  29. package/lib/selection-context.d.ts +118 -0
  30. package/lib/tool-call-guard.d.ts +104 -0
  31. package/lib/types/client/AppSection.d.ts +10 -0
  32. package/lib/types/client/BlendsFrame.d.ts +52 -0
  33. package/lib/types/client/FileView.d.ts +8 -0
  34. package/lib/types/client/FilesView.d.ts +17 -0
  35. package/lib/types/client/GitView.d.ts +18 -0
  36. package/lib/types/client/GraphView.d.ts +22 -0
  37. package/lib/types/client/LeftPanel.d.ts +71 -0
  38. package/lib/types/client/NameYourApp.d.ts +10 -0
  39. package/lib/types/client/PluginsSection.d.ts +17 -0
  40. package/lib/types/client/RegistryView.d.ts +11 -0
  41. package/lib/types/client/RemoteSync.d.ts +17 -0
  42. package/lib/types/client/RightPanel.d.ts +45 -0
  43. package/lib/types/client/SelectionChip.d.ts +59 -0
  44. package/lib/types/client/SettingsExpand.d.ts +6 -0
  45. package/lib/types/client/SettingsLauncher.d.ts +9 -0
  46. package/lib/types/client/ShareChooser.d.ts +21 -0
  47. package/lib/types/client/ShortcutsRow.d.ts +15 -0
  48. package/lib/types/client/TerminalView.d.ts +7 -0
  49. package/lib/types/client/TurnSaveFooter.d.ts +18 -0
  50. package/lib/types/client/app-reload.d.ts +28 -0
  51. package/lib/types/client/branch-chats.d.ts +71 -0
  52. package/lib/types/client/branches.d.ts +23 -0
  53. package/lib/types/client/canvas/AppCanvas.d.ts +25 -0
  54. package/lib/types/client/canvas/app-canvas.d.ts +59 -0
  55. package/lib/types/client/canvas/picker.d.ts +27 -0
  56. package/lib/types/client/chat-draft.d.ts +15 -0
  57. package/lib/types/client/chat-saves.d.ts +28 -0
  58. package/lib/types/client/chats.d.ts +182 -0
  59. package/lib/types/client/desktop-app.d.ts +65 -0
  60. package/lib/types/client/feedback.d.ts +21 -0
  61. package/lib/types/client/frame-state.d.ts +34 -0
  62. package/lib/types/client/frame-view.d.ts +35 -0
  63. package/lib/types/client/fuzzy.d.ts +23 -0
  64. package/lib/types/client/git-sync.d.ts +39 -0
  65. package/lib/types/client/graph-api.d.ts +11 -0
  66. package/lib/types/client/graph-canvas.d.ts +63 -0
  67. package/lib/types/client/graph-link.d.ts +21 -0
  68. package/lib/types/client/graph-model.d.ts +23 -0
  69. package/lib/types/client/graph-styles.d.ts +3 -0
  70. package/lib/types/client/highlight.d.ts +15 -0
  71. package/lib/types/client/index.d.ts +23 -0
  72. package/lib/types/client/panel-resize.d.ts +29 -0
  73. package/lib/types/client/plain-failure.d.ts +10 -0
  74. package/lib/types/client/plugins-navigator.d.ts +81 -0
  75. package/lib/types/client/registry-api.d.ts +21 -0
  76. package/lib/types/client/registry-list.d.ts +18 -0
  77. package/lib/types/client/selection.d.ts +56 -0
  78. package/lib/types/client/settings-fullscreen.d.ts +13 -0
  79. package/lib/types/client/sidebar-opens.d.ts +36 -0
  80. package/lib/types/client/snapshot.d.ts +11 -0
  81. package/lib/types/client/styles.d.ts +3 -0
  82. package/lib/types/client/switch-request.d.ts +18 -0
  83. package/lib/types/client/tab-sizing.d.ts +31 -0
  84. package/lib/types/client/tabs.d.ts +139 -0
  85. package/lib/types/client/theme-switch.d.ts +27 -0
  86. package/lib/types/client/tools.d.ts +15 -0
  87. package/lib/types/client/versions.d.ts +34 -0
  88. package/lib/types/client/view-state.d.ts +42 -0
  89. package/lib/types/contract.d.ts +414 -0
  90. package/lib/types/graph-contract.d.ts +85 -0
  91. package/lib/types/graph-inspect.d.ts +16 -0
  92. package/package.json +126 -4
@@ -0,0 +1,182 @@
1
+ /**
2
+ * The chats as the frame lists them: DSH's sessions, newest first, the one DSH's main view retains marked current. Opening one asks DSH's own
3
+ * navigation (`uiWorkspace`) when it is composed, so DSH stays the one owner of which session is shown (the reason is in acryl-workspace's
4
+ * `sessions/main-session.ts`); without it, the frame holds the main-view reference itself.
5
+ *
6
+ * Which branch a chat belongs to, and which chats are open, is the branch-chats record (`./branch-chats.ts`), the one source of truth. The rule this
7
+ * store keeps: the chat on screen always belongs to the checked-out branch (docs/design/blends-frame-mockup.html, scenarios 2 and 5). Whatever
8
+ * moves the folder to another branch - the left panel, the New button, the Git tab, a terminal - the chat on screen then becomes that branch's own
9
+ * (`decideChat`). A chat is open while it has a tab or is on screen: the left panel lists only those, and the rest are closed, found in History.
10
+ */
11
+ import type { ISessions, SessionListState } from '@acryldev/ui/frame';
12
+ import { type RealChatView } from '../contract.ts';
13
+ import type { BranchChatsStore } from './branch-chats.ts';
14
+ import type { ChatRow, ChatsPort } from './LeftPanel.tsx';
15
+ import { type FrameTabs } from './tabs.ts';
16
+ type SessionId = Parameters<ISessions['retain']>[0];
17
+ /** The options DSH's session creation takes (the workspace it belongs to is one of them). */
18
+ type SessionCreateOptions = NonNullable<Parameters<ISessions['create']>[0]>;
19
+ type WorkspaceId = NonNullable<SessionCreateOptions['workspaceId']>;
20
+ export interface MainViewNavigation {
21
+ openSession(target: SessionId): void;
22
+ }
23
+ /** The share of DSH's `workspaces` service used here: register a folder as a workspace, so a chat made in it is bound to it. */
24
+ export interface WorkspaceRegistration {
25
+ create(input: {
26
+ readonly path: string;
27
+ }): Promise<{
28
+ readonly workspaceId: WorkspaceId;
29
+ }>;
30
+ }
31
+ /** A chat's name: its own title once it has one, else "New chat" (DSH's display title falls back to the project folder's name, which names no chat). */
32
+ /** What a chat with no title of its own is called. */
33
+ export declare const NEW_CHAT = "New chat";
34
+ export declare function chatTitle(row: {
35
+ readonly title?: string | null;
36
+ }): string;
37
+ export declare function chatRows(list: SessionListState): ChatRow[];
38
+ /**
39
+ * The rows the left panel lists: a chat with no turn is not a chat, except the one open right now (it is where the next message goes). A chat that is
40
+ * running is real by definition. `real` is the Host's list of chats with a turn; until it has been read, only the open chat shows.
41
+ */
42
+ export declare function visibleChats(rows: readonly ChatRow[], real: ReadonlyMap<string, string>, running?: ReadonlySet<string>): ChatRow[];
43
+ /** What the store does to make the chat on screen the checked-out branch's. */
44
+ export type ChatDecision = {
45
+ readonly action: 'none';
46
+ }
47
+ /** Show this chat of the branch. */
48
+ | {
49
+ readonly action: 'open';
50
+ readonly id: string;
51
+ }
52
+ /** Record this chat (the one on screen) as the branch's: it was made elsewhere and no branch is recorded for it yet. */
53
+ | {
54
+ readonly action: 'adopt';
55
+ readonly id: string;
56
+ }
57
+ /** The branch has no chat to show: make one. */
58
+ | {
59
+ readonly action: 'create';
60
+ };
61
+ export interface ChatsView {
62
+ /** DSH's sessions, newest first. */
63
+ readonly rows: readonly ChatRow[];
64
+ /** The chats with a turn (the Host's list). */
65
+ readonly real: ReadonlyMap<string, string>;
66
+ readonly running: ReadonlySet<string>;
67
+ /** Chat id to branch: the branch-chats map. */
68
+ readonly assignments: Readonly<Record<string, string>>;
69
+ readonly branch: string;
70
+ /** The chat a tab of the strip asks for on this branch, shown instead of the branch's newest. */
71
+ readonly preferred?: string | undefined;
72
+ /** The chats that are open; a closed chat is never the branch's to show. Undefined: no chat is closed. */
73
+ readonly open?: ReadonlySet<string> | undefined;
74
+ }
75
+ /**
76
+ * The chat the checked-out branch shows: the tab's chat when it is the branch's, else its newest open chat with a turn, else one of its open chats
77
+ * still blank. Undefined when the branch has none open (its closed chats stay in History).
78
+ */
79
+ export declare function branchChat(view: ChatsView, exclude?: ReadonlySet<string>): ChatRow | undefined;
80
+ /**
81
+ * The chats that are open when nobody decided yet (an app that already has many chats, or one from before chats could be closed): the latest chat with
82
+ * a turn of each branch, the chat on screen, and the chats that already have a tab. Everything else is closed, found in History.
83
+ */
84
+ export declare function initialOpenChats(view: Pick<ChatsView, 'rows' | 'real' | 'running' | 'assignments'>, tabbed?: ReadonlySet<string>): string[];
85
+ /**
86
+ * The chat on screen against the checked-out branch. One that belongs to the branch stays (unless a tab of the strip asks for another of the
87
+ * branch's). One recorded for another branch gives way to this branch's own chat, or a new one. One no branch is recorded for is the branch's
88
+ * own when it has a turn (it was made before anything was recorded) or when the branch has no chat yet; otherwise it is a stray blank session DSH
89
+ * made on load, and the branch's own chat is shown instead, so a load never piles up another empty chat. Nothing on screen yet: the branch's own
90
+ * chat if it has one, else DSH's choice.
91
+ */
92
+ export declare function decideChat(view: ChatsView): ChatDecision;
93
+ export interface RealChatsApi {
94
+ read(): Promise<readonly RealChatView[]>;
95
+ }
96
+ export declare function createRealChatsApi(fetcher?: (input: string, init?: RequestInit) => Promise<Response>): RealChatsApi;
97
+ export interface ChatsDeps {
98
+ readonly navigation: () => MainViewNavigation | undefined;
99
+ readonly workspaceFor?: () => WorkspaceRegistration | undefined;
100
+ readonly realChats?: RealChatsApi;
101
+ /** The map of chat to branch: the one source of truth, read here and written once per chat. */
102
+ readonly branchChats?: BranchChatsStore;
103
+ /** The checked-out branch; undefined outside a repository (no branch to keep a chat for). */
104
+ readonly branch?: () => string | undefined;
105
+ /** The app's folder, where a chat made by the frame works. */
106
+ readonly appRoot?: () => string | undefined;
107
+ /** The chat the strip's active tab asks for on the checked-out branch, if it is a tab of one. */
108
+ readonly preferred?: () => string | undefined;
109
+ /** The right panel's strip: a chat opened from a list gets a tab of its own, unless it is the one the base tab shows. */
110
+ readonly tabs?: FrameTabs;
111
+ }
112
+ export declare class ChatsStore implements ChatsPort {
113
+ private readonly deps;
114
+ private rows;
115
+ private sessions;
116
+ private held;
117
+ private readonly listeners;
118
+ private all;
119
+ private real;
120
+ private realLoaded;
121
+ private running;
122
+ private reading;
123
+ private scheduled;
124
+ private again;
125
+ private creating;
126
+ /** The chat `open` last asked DSH for, until DSH shows it (see `reconcile`). */
127
+ private pending;
128
+ constructor(deps: ChatsDeps);
129
+ getSnapshot(): readonly ChatRow[];
130
+ subscribe(listener: () => void): () => void;
131
+ /** Follow `sessions` until the returned disposer runs (the service's fiber ends). */
132
+ watch(sessions: ISessions): () => void;
133
+ open(id: string): void;
134
+ /**
135
+ * Make the chat on screen the checked-out branch's (`decideChat`). Called whenever anything it depends on changes: the branch, the sessions, the
136
+ * chats with a turn, the branch-chats map, the strip's tab. It acts only once the map and the Host's chat list have been read: before that a
137
+ * chat that looks unrecorded may only be one the frame has not heard about, and recording it would put it on the wrong branch.
138
+ */
139
+ reconcile(): void;
140
+ private decide;
141
+ /**
142
+ * Every open chat of the checked-out branch has a tab of its own, except the one the base tab shows (the newest of those without): the open set is
143
+ * remembered by the Host, the strip by the page, so a page that has not seen a chat open gets its tab here.
144
+ */
145
+ private tabOpenChats;
146
+ /** The chats that have a tab of their own. */
147
+ private tabbed;
148
+ /**
149
+ * A new chat on the checked-out branch, shown at once: a DSH session made on the Host and recorded for the branch before anything else can see
150
+ * it. Undefined without the sessions service or outside a branch. A second call while one runs gets the same chat.
151
+ */
152
+ create(): Promise<string | undefined>;
153
+ private make;
154
+ /**
155
+ * "+ then Chat": a chat of its own on the checked-out branch. The chat on screen is reused when it has no turn yet (it is already a new chat), so
156
+ * the strip never fills with empty ones; @returns its id and whether it was made now. Undefined when no chat could be made.
157
+ */
158
+ startChat(): Promise<{
159
+ readonly id: string;
160
+ readonly made: boolean;
161
+ } | undefined>;
162
+ /**
163
+ * The base tab's chat: the checked-out branch's newest open chat that has no tab of its own, shown; a new chat when the branch has none open.
164
+ */
165
+ openPrimary(exclude: ReadonlySet<string>): void;
166
+ private openSet;
167
+ /**
168
+ * Open a chat of the checked-out branch from a list (History): a closed chat is open from now on, as a tab of its own; either way it is shown.
169
+ */
170
+ show(id: string): void;
171
+ /**
172
+ * Close a chat (its tab's x): it leaves the open chats and waits in History. When it is the chat on screen the view moves off it first: to `prefer`
173
+ * (the chat of the tab the strip shows now), else the base tab's chat (the branch's newest open chat that has no tab of its own, among all but
174
+ * `tabbed`), else a new chat.
175
+ */
176
+ closeChat(id: string, tabbed: ReadonlySet<string>, prefer?: string): void;
177
+ /** Ask the Host which chats have a turn; a read that comes in while one runs asks once more afterwards, and a failed read keeps what was known. */
178
+ private refreshReal;
179
+ private publishVisible;
180
+ private publish;
181
+ }
182
+ export {};
@@ -0,0 +1,65 @@
1
+ /**
2
+ * The app as a desktop product keeps it (specs/049-framework-architecture/app-storage.md in ACRYL): its name, its folder, export, import and start over.
3
+ * A product's window gets `window.acrylBlendsApp` from its preload (acrylblends `plugins/desktop/preload.cjs`, answered by `plugins/desktop/app-page.ts`);
4
+ * a browser tab and an app run with `npm run dev` have none, and the frame then shows no App page. The operation names and shapes are that module's:
5
+ * keep them in step.
6
+ */
7
+ /** What the App pages show. `named` is false until the person names the app: the first start asks. */
8
+ export interface DesktopAppState {
9
+ readonly id: string;
10
+ readonly name: string;
11
+ readonly named: boolean;
12
+ /** The other apps on this computer; two may share a name, so each says when it was made (an ISO date). */
13
+ readonly others: readonly {
14
+ readonly id: string;
15
+ readonly name: string;
16
+ readonly created: string;
17
+ }[];
18
+ readonly fileManager: 'Finder' | 'Explorer' | 'Files';
19
+ readonly git: boolean;
20
+ }
21
+ export interface DesktopAppSize {
22
+ readonly bytes: number;
23
+ readonly files: number;
24
+ }
25
+ type Result = {
26
+ readonly ok: true;
27
+ readonly value?: unknown;
28
+ } | {
29
+ readonly ok: false;
30
+ readonly message: string;
31
+ };
32
+ interface Bridge {
33
+ call(op: string, arg?: unknown): Promise<Result>;
34
+ }
35
+ /** The product's app, read through the bridge: a store of its state (the bar's name and the first start's question follow it) and its operations. */
36
+ export declare class DesktopApp {
37
+ private readonly bridge;
38
+ private state;
39
+ private readonly listeners;
40
+ constructor(bridge: Bridge);
41
+ private ask;
42
+ private set;
43
+ getSnapshot: () => DesktopAppState | undefined;
44
+ subscribe: (listener: () => void) => (() => void);
45
+ refresh(): Promise<DesktopAppState>;
46
+ rename(name: string): Promise<DesktopAppState>;
47
+ size(): Promise<DesktopAppSize>;
48
+ reveal(): Promise<void>;
49
+ /** The save dialog, then the file; `undefined` when the person cancelled. */
50
+ export(data: boolean): Promise<string | undefined>;
51
+ /** The open dialog, then the new app opens in this window (the page reloads); resolves only when the person cancelled. */
52
+ import(): Promise<void>;
53
+ /** The app moves to the product's trash folder and a fresh one opens in this window (the page reloads). */
54
+ startOver(): Promise<void>;
55
+ open(id: string): Promise<void>;
56
+ gitLicence(): Promise<void>;
57
+ gitSource(): Promise<void>;
58
+ }
59
+ /** The product's app when this page is a product's window, else undefined. */
60
+ export declare function desktopApp(scope?: {
61
+ readonly acrylBlendsApp?: unknown;
62
+ }): DesktopApp | undefined;
63
+ /** A size as a person reads it: `3.3 MB`, `840 KB`. */
64
+ export declare function formatSize(bytes: number): string;
65
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Feedback from users in the left panel (docs/design/blends-frame-mockup.html, scenario 9): the notes people sent from the app (its `feedback`
3
+ * plugin), read from the frame's Host, and the task a note becomes when the builder hands it to an agent.
4
+ */
5
+ import { type FeedbackNoteView, type FeedbackView } from '../contract.ts';
6
+ type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
7
+ export interface FeedbackApi {
8
+ read(): Promise<FeedbackView>;
9
+ markSeen(ids: readonly string[]): Promise<void>;
10
+ /** The frame-served screenshot of one note (same origin, so the panel and the hand-off can read it). */
11
+ shotUrl(id: string): string;
12
+ }
13
+ export declare function createFeedbackApi(fetcher?: FetchLike): FeedbackApi;
14
+ /** The page a note came from, as a heading: "Home page" for the app's root, else its last path part. */
15
+ export declare function feedbackPlace(note: Pick<FeedbackNoteView, 'page'>, mount?: string): string;
16
+ /**
17
+ * The task an agent gets for a note. The note is what a person typed into the app, so it goes in quoted, as data: the builder reads the task in
18
+ * the composer and sends it, nothing runs on its own.
19
+ */
20
+ export declare function feedbackTask(note: FeedbackNoteView): string;
21
+ export {};
@@ -0,0 +1,34 @@
1
+ /**
2
+ * What the frame shows around the app, from the Host's state route. The frame reads it again while the page is visible, so a version an agent saves
3
+ * or a file it changes shows without a reload; a failed re-read keeps what is shown, and an unchanged answer tells no one.
4
+ */
5
+ import { type FrameState } from '../contract.ts';
6
+ export type FrameStateView = {
7
+ readonly status: 'loading';
8
+ } | {
9
+ readonly status: 'ready';
10
+ readonly state: FrameState;
11
+ } | {
12
+ readonly status: 'error';
13
+ readonly message: string;
14
+ };
15
+ type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
16
+ export declare class FrameStateStore {
17
+ private readonly fetchImpl;
18
+ private view;
19
+ private readonly listeners;
20
+ private generation;
21
+ constructor(fetchImpl?: FetchLike);
22
+ getSnapshot(): FrameStateView;
23
+ subscribe(listener: () => void): () => void;
24
+ /** Read the state again; an older answer arriving after a newer request is dropped. */
25
+ refresh(): Promise<void>;
26
+ /**
27
+ * Read the state now and return it: a decision that would act on the unsaved count (switch a branch, go back to a version) reads it here instead
28
+ * of trusting what the last poll showed. Undefined when this read failed, even though the page keeps showing the last good state.
29
+ */
30
+ current(): Promise<FrameState | undefined>;
31
+ /** One read of the Host's state, published to the page unless a newer read started meanwhile; returns what this read got. */
32
+ private read;
33
+ }
34
+ export {};
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The frame's view of the app page, as the app's own client plugins see it (docs/design/blends-frame-mockup.html): Build is the builder's screen, so the
3
+ * app's build-time controls stay out of the canvas; Preview is what production shows, so the app's production controls render there. The frame owns the
4
+ * mode; the page's plugins read it from this handle, and a mode change reaches them without a reload.
5
+ *
6
+ * The app page is same-origin under `/app`, so the frame publishes the handle on its own window and the page reads it through `window.parent`. The page
7
+ * listens for {@link FRAME_MODE_EVENT} on its own window; `mode` is live, so the event is only the notification. A page opened directly has no such
8
+ * parent and keeps its own behavior (plugins/agent-panel/client/main.ts and plugins/feedback/client.js read the same names).
9
+ */
10
+ export declare const FRAME_VIEW_KEY: symbol;
11
+ export declare const FRAME_MODE_EVENT = "acryl:frame-mode";
12
+ /** Build hides the app's own build-time controls; Preview shows what production shows. */
13
+ export type AppFrameMode = 'build' | 'preview';
14
+ /** What the app's page reads from `window.parent[FRAME_VIEW_KEY]`. */
15
+ export interface AppFrameView {
16
+ readonly mode: AppFrameMode;
17
+ }
18
+ /** The frame's side of the canvas: the live window of the app page it embeds. */
19
+ export interface FrameHost {
20
+ contentWindow(): Window | undefined;
21
+ }
22
+ /** The part of the frame's view state the handle publishes. */
23
+ export interface FrameViewSource {
24
+ getSnapshot(): {
25
+ readonly mode: AppFrameMode;
26
+ };
27
+ subscribe(listener: () => void): () => void;
28
+ }
29
+ /**
30
+ * Publish the frame's view and tell the app page whenever the mode changes.
31
+ * @param host - the canvas, whose content window is the app page.
32
+ * @param view - the frame's view state; its `mode` is the published value.
33
+ * @returns a disposer that removes the handle and the subscription.
34
+ */
35
+ export declare function installFrameView(host: FrameHost, view: FrameViewSource): () => void;
@@ -0,0 +1,23 @@
1
+ /** Fuzzy file search for the Files tab (⌘P): the query's letters in order anywhere in the path, ranked like an editor's quick open. */
2
+ export interface FuzzyMatch {
3
+ readonly path: string;
4
+ /** Indexes into `path` of the letters the query matched, ascending. */
5
+ readonly hits: readonly number[];
6
+ readonly score: number;
7
+ }
8
+ /**
9
+ * Match `query` against one path, case-insensitively, letters in order. Each matched letter scores; one right after the previous match, at the
10
+ * start of a word, or in the file's own name scores more, a long gap or a long stretch from the first letter to the last scores less, and a
11
+ * shorter path wins a tie. @returns undefined when the letters are not all there.
12
+ */
13
+ export declare function fuzzyMatch(query: string, path: string): FuzzyMatch | undefined;
14
+ /** The best `limit` matches of `query` over `paths`, best first. */
15
+ export declare function fuzzySearch(query: string, paths: readonly string[], limit?: number): FuzzyMatch[];
16
+ /** A match split for display: the label is the path below its top folder, which is shown apart as the meta. */
17
+ export declare function displayMatch(match: FuzzyMatch): {
18
+ readonly folder: string;
19
+ readonly parts: readonly {
20
+ readonly text: string;
21
+ readonly hit: boolean;
22
+ }[];
23
+ };
@@ -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,11 @@
1
+ /** The browser's side of the Host's plugin graph routes. */
2
+ import { type GraphEventsAnswer, type GraphView } from '../graph-contract.ts';
3
+ type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
4
+ export interface GraphApi {
5
+ /** The Host's graph now, and the number of its newest fiber event. */
6
+ read(): Promise<GraphView>;
7
+ /** The fiber events after `after`: answered when there are some, or empty after the Host waited a while. Rejects when `signal` aborts. */
8
+ events(after: number, signal?: AbortSignal): Promise<GraphEventsAnswer>;
9
+ }
10
+ export declare function createGraphApi(fetcher?: FetchLike): GraphApi;
11
+ export {};
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The plugin graph's drawing: a snapshot as Cytoscape elements, and a canvas that takes a new set of them without starting over (so a fiber changing
3
+ * phase changes one colour, and the picture a person was looking at stays put). Ported from cordis-plugin-graph (MIT, commit e9bf6b5,
4
+ * `src/client/cytoscape-graph.ts`): the elements, the colours by phase and the cose layout are its; the incremental update, the pulses and the theme
5
+ * palette are new.
6
+ */
7
+ import { type ElementDefinition } from 'cytoscape';
8
+ import type { EdgeKind, GraphSnapshot, NodePhase } from '../graph-contract.ts';
9
+ export declare const PHASE_COLOR: Record<NodePhase, string>;
10
+ export declare const EDGE_COLOR: Record<EdgeKind, string>;
11
+ /** Which edge kinds to include. */
12
+ export type EdgeFilter = Record<EdgeKind, boolean>;
13
+ /** What a fiber change looks like on the node: it came up, it went away, it failed, or it moved to some other phase. */
14
+ export type PulseKind = 'up' | 'down' | 'error' | 'change';
15
+ /** The colours the frame's theme gives the picture (the labels and the outline of a node). */
16
+ export interface Palette {
17
+ readonly label: string;
18
+ readonly outline: string;
19
+ }
20
+ export declare const DARK_PALETTE: Palette;
21
+ export declare const LIGHT_PALETTE: Palette;
22
+ /** The node id for a fiber of a plane: the two planes never collide. */
23
+ export declare const nodeId: (prefix: string, uid: number) => string;
24
+ /** One snapshot as elements. `prefix` namespaces the ids so the two planes can share one picture. An unresolved `inject` (a self loop) is left out. */
25
+ export declare function toElements(snapshot: GraphSnapshot, filter: EdgeFilter, prefix?: string): ElementDefinition[];
26
+ /** A picture of the plugins that takes new elements without drawing everything again. `container` is null only in tests (Cytoscape then draws nothing). */
27
+ export declare class GraphCanvas {
28
+ private readonly onSelect;
29
+ private readonly cy;
30
+ private laidOut;
31
+ private readonly timers;
32
+ private onWheel;
33
+ private plainZoom;
34
+ private wheelTarget;
35
+ constructor(container: HTMLElement | null, palette: Palette, onSelect?: (id: string | undefined) => void);
36
+ /** The ids now in the picture (nodes and edges). */
37
+ ids(): string[];
38
+ /** Make the picture these elements. Existing ones keep their place and take the new data; the layout runs again only when a node came or went. Returns whether it did. */
39
+ update(elements: readonly ElementDefinition[]): boolean;
40
+ /** The theme changed: the labels and outlines take its colours. */
41
+ setPalette(palette: Palette): void;
42
+ fit(): void;
43
+ /** The zoom buttons: one step in or out around the middle of the picture (not past the limits), 1.4 times each way. */
44
+ zoomBy(factor: number): void;
45
+ zoomLevel(): number;
46
+ /** The box changed size (the view went full screen, or came back): Cytoscape measures it again. Zoom, position and selection stay as they are. */
47
+ resize(): void;
48
+ /** Whether a plain scroll zooms. Off where the picture sits in a pane that scrolls (there Ctrl or Cmd is needed); on when it fills the window. */
49
+ setPlainZoom(on: boolean): void;
50
+ /** Flash one node (a fiber just changed). A node that is not in the picture is left alone. */
51
+ pulse(id: string, kind: PulseKind): void;
52
+ /** Whether a node has a pulse showing (for tests and for the first frame after an update). */
53
+ pulsing(id: string): boolean;
54
+ /** Show only a node and what it touches (or everything again with undefined); the node is selected. */
55
+ focus(id: string | undefined): void;
56
+ /** Fade what does not match a name or module (nothing for an empty query); `focus` is cleared. */
57
+ search(query: string): void;
58
+ /** Where a node sits in the container, so a list can scroll the picture to it. */
59
+ centre(id: string): void;
60
+ destroy(): void;
61
+ }
62
+ /** The colours of the frame's theme, read from the element the picture is in. */
63
+ export declare function readPalette(element: Element): Palette;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The graph view's link to the app: read the graph, then wait for each change, and when the app stops answering say so and start over by itself.
3
+ *
4
+ * Starting over means reading the graph again, not asking for "changes after the number I had": an app that was stopped and started again counts its
5
+ * changes from the beginning, so the old number would make the view wait for changes that never come.
6
+ */
7
+ import type { GraphEvent, GraphSnapshot } from '../graph-contract.ts';
8
+ import type { GraphApi } from './graph-api.ts';
9
+ export type Live = 'connecting' | 'live' | 'lost';
10
+ /** The sentence shown while the link is down (one place, so the view and the tests say the same). */
11
+ export declare const LOST_TEXT = "Lost the connection to the app, trying again...";
12
+ export declare const RETRY_MS = 3000;
13
+ export interface LinkEvents {
14
+ onLive(live: Live): void;
15
+ onSnapshot(snapshot: GraphSnapshot): void;
16
+ onEvents(events: readonly GraphEvent[]): void;
17
+ }
18
+ /** Wait `ms`, or less when `signal` aborts. */
19
+ export declare function pause(ms: number, signal: AbortSignal): Promise<void>;
20
+ /** Runs until `signal` aborts. `wait` is injectable for tests. */
21
+ export declare function runLink(api: GraphApi, events: LinkEvents, signal: AbortSignal, wait?: (ms: number, signal: AbortSignal) => Promise<void>): Promise<void>;
@@ -0,0 +1,23 @@
1
+ /** What the graph view works out from a snapshot and the fiber events, apart from drawing: how a change pulses, how it reads in the strip, and who a plugin needs and who needs it. */
2
+ import type { GraphEvent, GraphNode, GraphSnapshot, NodePhase } from '../graph-contract.ts';
3
+ import type { PulseKind } from './graph-canvas.ts';
4
+ /** How a fiber change shows on its node: up when it became active (or was created), error when it failed, down when it went away, else a plain change. */
5
+ export declare function pulseOf(event: Pick<GraphEvent, 'kind' | 'to'>): PulseKind;
6
+ /** One line of the strip: `cart: loading to active`, `cart: created`, `cart: removed`. */
7
+ export declare function eventLine(event: Pick<GraphEvent, 'name' | 'kind' | 'from' | 'to'>): string;
8
+ export interface Relation {
9
+ readonly service: string;
10
+ readonly node: GraphNode;
11
+ }
12
+ export interface Relations {
13
+ /** The plugins this one needs, by the service that joins them. */
14
+ readonly requires: readonly Relation[];
15
+ /** The services this one needs that no active plugin provides now. */
16
+ readonly missing: readonly string[];
17
+ /** The plugins that need something this one provides. */
18
+ readonly usedBy: readonly Relation[];
19
+ }
20
+ /** Who a plugin needs and who needs it, read from the relations of one snapshot. */
21
+ export declare function relationsOf(snapshot: GraphSnapshot, uid: number): Relations;
22
+ /** How many nodes are in each phase. */
23
+ export declare function phaseCounts(snapshots: readonly (GraphSnapshot | undefined)[]): Map<NodePhase, number>;
@@ -0,0 +1,3 @@
1
+ /** The graph view's styles, in the frame's own tokens (`--bf-*`, set on `.acrylBlendsPlugins` for both themes). A style element of its own, so the view adds nothing to the frame's sheet. */
2
+ /** Add the styles once; returns the removal. */
3
+ export declare function installGraphStyles(): () => void;
@@ -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' | 'app';
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,10 @@
1
+ /**
2
+ * A request the Host refused, in the words it chose for the person: `message` is the plain sentence, `details` what the tool said (shown behind a
3
+ * "Details" toggle for developers). A Host that answered without a sentence gets a plain one here, never a status line.
4
+ */
5
+ export declare class PlainFailure extends Error {
6
+ readonly details: string | undefined;
7
+ constructor(message: string, details?: string);
8
+ }
9
+ /** The failure a refused response carries. */
10
+ export declare function failureOf(response: Response): Promise<PlainFailure>;