@acrylblends/blends-frame 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +105 -2
- package/cordis.patch.yml +3 -0
- package/lib/app-generation.d.ts +38 -0
- package/lib/app-generation.js +102 -0
- package/lib/app-generation.js.map +1 -0
- package/lib/app-plugins.d.ts +118 -0
- package/lib/app-reload.d.ts +74 -0
- package/lib/app-snapshot.d.ts +40 -0
- package/lib/app-urls.d.ts +17 -0
- package/lib/applied-live.d.ts +43 -0
- package/lib/auto-save.d.ts +63 -0
- package/lib/branch-chats.d.ts +37 -0
- package/lib/client.js +18899 -0
- package/lib/client.js.map +1 -0
- package/lib/contract.d.ts +293 -0
- package/lib/git-sync.d.ts +52 -0
- package/lib/index.d.ts +169 -0
- package/lib/index.js +3064 -0
- package/lib/index.js.map +1 -0
- package/lib/outward-guard.d.ts +45 -0
- package/lib/real-chats.d.ts +42 -0
- package/lib/selection-context.d.ts +118 -0
- package/lib/tool-call-guard.d.ts +104 -0
- package/lib/types/client/BlendsFrame.d.ts +46 -0
- package/lib/types/client/FileView.d.ts +8 -0
- package/lib/types/client/FilesView.d.ts +17 -0
- package/lib/types/client/GitView.d.ts +18 -0
- package/lib/types/client/LeftPanel.d.ts +71 -0
- package/lib/types/client/PluginsSection.d.ts +7 -0
- package/lib/types/client/RemoteSync.d.ts +17 -0
- package/lib/types/client/RightPanel.d.ts +45 -0
- package/lib/types/client/SelectionChip.d.ts +59 -0
- package/lib/types/client/SettingsLauncher.d.ts +9 -0
- package/lib/types/client/ShortcutsRow.d.ts +15 -0
- package/lib/types/client/TerminalView.d.ts +7 -0
- package/lib/types/client/TurnSaveFooter.d.ts +18 -0
- package/lib/types/client/app-reload.d.ts +28 -0
- package/lib/types/client/branch-chats.d.ts +71 -0
- package/lib/types/client/branches.d.ts +23 -0
- package/lib/types/client/canvas/AppCanvas.d.ts +25 -0
- package/lib/types/client/canvas/app-canvas.d.ts +59 -0
- package/lib/types/client/canvas/picker.d.ts +27 -0
- package/lib/types/client/chat-draft.d.ts +15 -0
- package/lib/types/client/chat-saves.d.ts +28 -0
- package/lib/types/client/chats.d.ts +182 -0
- package/lib/types/client/feedback.d.ts +21 -0
- package/lib/types/client/frame-state.d.ts +34 -0
- package/lib/types/client/frame-view.d.ts +35 -0
- package/lib/types/client/fuzzy.d.ts +23 -0
- package/lib/types/client/git-sync.d.ts +39 -0
- package/lib/types/client/highlight.d.ts +15 -0
- package/lib/types/client/index.d.ts +23 -0
- package/lib/types/client/panel-resize.d.ts +29 -0
- package/lib/types/client/plugins-navigator.d.ts +51 -0
- package/lib/types/client/selection.d.ts +56 -0
- package/lib/types/client/sidebar-opens.d.ts +36 -0
- package/lib/types/client/snapshot.d.ts +11 -0
- package/lib/types/client/styles.d.ts +3 -0
- package/lib/types/client/switch-request.d.ts +18 -0
- package/lib/types/client/tab-sizing.d.ts +31 -0
- package/lib/types/client/tabs.d.ts +139 -0
- package/lib/types/client/tools.d.ts +15 -0
- package/lib/types/client/versions.d.ts +34 -0
- package/lib/types/client/view-state.d.ts +42 -0
- package/lib/types/contract.d.ts +293 -0
- package/package.json +124 -4
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The frame's auto-save: when the chat's agent finishes a turn that changed the app's files, the Host makes a save point (a version) by itself and
|
|
3
|
+
* remembers which turn it belongs to, so the chat can say "edited src/routes.ts, src/board.ts · saved as v7" under that answer
|
|
4
|
+
* (docs/design/blends-frame-mockup.html, scenario 2).
|
|
5
|
+
*
|
|
6
|
+
* The turn-end signal is DSH's own: its `workspace-changes` plugin diffs the working tree around every turn (the person's earlier unsaved edits never
|
|
7
|
+
* enter a turn's list) and appends a `workspace/changes` session event only when files changed, so a turn that changed nothing makes no version here.
|
|
8
|
+
* The Host hears that event on `session/event`, reads the turn's file list from `ctx.workspaceChanges.summary`, and saves through `acryl-versions`.
|
|
9
|
+
*/
|
|
10
|
+
import type { TurnSaveView } from './contract.ts';
|
|
11
|
+
/** The person's request, shortened into a version's name: its first sentence or clause, one line, cut at a word. */
|
|
12
|
+
export declare function requestSubject(request: string | undefined, limit?: number): string;
|
|
13
|
+
/** The text of a user message's blocks, in order; blocks that are not text (images) add nothing. */
|
|
14
|
+
export declare function messageText(data: unknown): string;
|
|
15
|
+
/** What a chat's turn saved, kept in a file so the line under an answer is still there after a restart. */
|
|
16
|
+
export declare class SaveStore {
|
|
17
|
+
private readonly file;
|
|
18
|
+
private readonly report;
|
|
19
|
+
private loaded;
|
|
20
|
+
private writing;
|
|
21
|
+
constructor(file: string, report?: (cause: unknown) => void);
|
|
22
|
+
forSession(session: string): Promise<readonly TurnSaveView[]>;
|
|
23
|
+
/** Remember a turn's save; a turn saved twice (its changes settled after the first record) keeps every file and the newer version. */
|
|
24
|
+
put(session: string, save: TurnSaveView): Promise<void>;
|
|
25
|
+
private read;
|
|
26
|
+
private trim;
|
|
27
|
+
/** One write at a time, each to a new file renamed into place, so a crash leaves the old list or the new one. */
|
|
28
|
+
private write;
|
|
29
|
+
}
|
|
30
|
+
/** A session event, as `session/event` carries it. */
|
|
31
|
+
export interface SessionEventLike {
|
|
32
|
+
readonly type: string;
|
|
33
|
+
readonly seq: number;
|
|
34
|
+
readonly data: unknown;
|
|
35
|
+
}
|
|
36
|
+
export interface AutoSaveDeps {
|
|
37
|
+
/** The files a `workspace/changes` event of a session announced (`ctx.workspaceChanges.summary`); undefined when the Host no longer has it. */
|
|
38
|
+
summary(session: string, seq: number): {
|
|
39
|
+
readonly files: readonly {
|
|
40
|
+
readonly display: string;
|
|
41
|
+
}[];
|
|
42
|
+
} | undefined;
|
|
43
|
+
/** Save the app's files as a version called `message`; undefined when there was nothing to save. */
|
|
44
|
+
save(message: string): Promise<{
|
|
45
|
+
readonly hash: string;
|
|
46
|
+
readonly version: number;
|
|
47
|
+
readonly subject: string;
|
|
48
|
+
} | undefined>;
|
|
49
|
+
readonly store: SaveStore;
|
|
50
|
+
readonly report: (cause: unknown) => void;
|
|
51
|
+
}
|
|
52
|
+
/** Listens to the chat's session events and saves a version after each turn that changed files. */
|
|
53
|
+
export declare class AutoSave {
|
|
54
|
+
private readonly deps;
|
|
55
|
+
private readonly turns;
|
|
56
|
+
/** Saves run one after another: two chats finishing together must not commit over each other. */
|
|
57
|
+
private tail;
|
|
58
|
+
constructor(deps: AutoSaveDeps);
|
|
59
|
+
observe(session: string, event: SessionEventLike): void;
|
|
60
|
+
/** Resolves when every save queued so far has finished. */
|
|
61
|
+
settled(): Promise<void>;
|
|
62
|
+
private saveTurn;
|
|
63
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which branch each chat was opened on, and which chats are open, kept in the app's ACRYL home (`<home>/frame/branch-chats.json`), keyed by the
|
|
3
|
+
* app's folder. The frame reads it to list each branch's own chats; without it every chat would look like the checked-out branch's. A chat is open
|
|
4
|
+
* while it has a tab or is on screen (docs/design/blends-frame-mockup.html: the left panel lists only what is open); the rest are closed and wait in
|
|
5
|
+
* the chat's History. The set of open chats is absent until the frame first decides it (an app with many chats opens with only the latest per
|
|
6
|
+
* branch open). Writes are serialized and atomic, so a frame and its page never read half a file.
|
|
7
|
+
*/
|
|
8
|
+
/** The file in the app's ACRYL home (from the `appInstance` service: this package never looks up a home itself). */
|
|
9
|
+
export declare function branchChatsFile(appHome: string): string;
|
|
10
|
+
/** A chat id to its branch, by the app folder the frame serves. */
|
|
11
|
+
type Roots = Record<string, Record<string, string>>;
|
|
12
|
+
/** The chats that are open, by the app folder; an app folder without an entry has not decided yet. */
|
|
13
|
+
type OpenSets = Record<string, string[]>;
|
|
14
|
+
interface Contents {
|
|
15
|
+
readonly roots: Roots;
|
|
16
|
+
readonly open: OpenSets;
|
|
17
|
+
}
|
|
18
|
+
/** What the frame reads for an app folder. */
|
|
19
|
+
export interface BranchChatsRecord {
|
|
20
|
+
readonly chats: Record<string, string>;
|
|
21
|
+
/** The open chats; null until they were first decided. */
|
|
22
|
+
readonly open: string[] | null;
|
|
23
|
+
}
|
|
24
|
+
/** The file's words, keeping only what is a map of chat id to a branch name and the lists of open chat ids; anything else reads as nothing recorded. */
|
|
25
|
+
export declare function parseBranchChatsFile(text: string): Contents;
|
|
26
|
+
export interface BranchChatsStore {
|
|
27
|
+
/** What is recorded for an app folder; empty when nothing was or the file is unreadable. @throws when the file cannot be read for another reason. */
|
|
28
|
+
read(root: string): Promise<BranchChatsRecord>;
|
|
29
|
+
/** Record a chat's branch; an existing record is kept (a chat stays where it was opened). */
|
|
30
|
+
assign(root: string, id: string, branch: string): Promise<void>;
|
|
31
|
+
/** Open or close one chat. Before the open chats were first decided, this decides them: the one chat, or none. */
|
|
32
|
+
setOpen(root: string, id: string, open: boolean): Promise<void>;
|
|
33
|
+
/** Decide which chats are open, once: a set that already exists is kept (another page decided first). @returns whether this call decided it. */
|
|
34
|
+
initOpen(root: string, ids: readonly string[]): Promise<boolean>;
|
|
35
|
+
}
|
|
36
|
+
export declare function createBranchChatsStore(path: string): BranchChatsStore;
|
|
37
|
+
export {};
|