@hollis-labs/surface-page 0.1.0 → 0.3.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.
- package/dist/gallery.js +1045 -331
- package/dist/index.js +1210 -504
- package/dist/registry-items.json +1 -0
- package/dist/types/agent/AgentPanel.d.ts +2 -2
- package/dist/types/agent/api.d.ts +4 -0
- package/dist/types/agent/session.d.ts +34 -0
- package/dist/types/desk/AttentionBadge.d.ts +4 -0
- package/dist/types/desk/ContextInspector.d.ts +2 -0
- package/dist/types/desk/GhostCursor.d.ts +1 -0
- package/dist/types/desk/ThemePicker.d.ts +3 -0
- package/dist/types/desk/attention.d.ts +17 -0
- package/dist/types/desk/commands.d.ts +5 -1
- package/dist/types/desk/composing.d.ts +10 -0
- package/dist/types/desk/store.d.ts +16 -0
- package/dist/types/gallery/Gallery.d.ts +15 -0
- package/dist/types/gallery/Specimen.d.ts +13 -3
- package/dist/types/gallery/approval.d.ts +1 -0
- package/dist/types/gallery/composer.d.ts +1 -0
- package/dist/types/gallery/theme.d.ts +19 -0
- package/package.json +5 -4
package/dist/registry-items.json
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
* here as an "agent.context" event whenever the window in front changes. The page sends no
|
|
13
13
|
* context and no tools of its own.
|
|
14
14
|
*/
|
|
15
|
-
import { type ChatStore } from "@hollis-labs/surface-chat";
|
|
16
15
|
import { type Desk } from "../sdk";
|
|
16
|
+
import { type AgentSession } from "./session";
|
|
17
17
|
/** The one conversation of the page: a run goes on while the panel is closed. */
|
|
18
|
-
export declare function agentSession():
|
|
18
|
+
export declare function agentSession(): AgentSession;
|
|
19
19
|
export interface AgentPanelProps {
|
|
20
20
|
/** The desk, for opening what the agent names. Optional. */
|
|
21
21
|
desk?: Desk;
|
|
@@ -47,6 +47,10 @@ export interface Setup {
|
|
|
47
47
|
config_path: string;
|
|
48
48
|
/** Why the agent cannot answer, in a sentence, when it cannot. */
|
|
49
49
|
reason?: string;
|
|
50
|
+
/** "conversation" when the agent is on the conversation wire; absent on the run-at-a-time one. */
|
|
51
|
+
wire?: string;
|
|
52
|
+
/** The agent's name on the conversation wire. */
|
|
53
|
+
agent?: string;
|
|
50
54
|
}
|
|
51
55
|
export declare const agentApi: {
|
|
52
56
|
context: () => Promise<Assembly>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page's one conversation with the agent, whichever wire the server speaks. The server
|
|
3
|
+
* says which in /api/agent/setup: the conversation wire (a durable conversation the page
|
|
4
|
+
* attaches to, shared with other tabs) or the run-at-a-time one. Both stores offer the same
|
|
5
|
+
* surface, so the panel draws either; this wrapper exists because the answer arrives after
|
|
6
|
+
* the page has started, and callers want the session at once.
|
|
7
|
+
*
|
|
8
|
+
* Two address-bar switches, for looking at the conversation wire's other modes:
|
|
9
|
+
* `?chat=viewer` attaches this page as a viewer (it watches and can take over), and
|
|
10
|
+
* `?chat=committed` takes each part whole instead of as it is written.
|
|
11
|
+
*/
|
|
12
|
+
import { type ChatState, type Decision, type RunEnd } from "@hollis-labs/surface-chat";
|
|
13
|
+
export interface AgentSession {
|
|
14
|
+
get(): ChatState;
|
|
15
|
+
subscribe(fn: () => void): () => void;
|
|
16
|
+
start(): Promise<void>;
|
|
17
|
+
send(text: string, how?: {
|
|
18
|
+
auto?: string;
|
|
19
|
+
}): Promise<boolean>;
|
|
20
|
+
stop(): void;
|
|
21
|
+
answer(decision: Decision): Promise<void>;
|
|
22
|
+
newThread(): Promise<void>;
|
|
23
|
+
turnElsewhere(run: string): void;
|
|
24
|
+
onRunEnd(fn: (run: string, how: RunEnd) => void): () => void;
|
|
25
|
+
/** True on the conversation wire. False until the server has said. */
|
|
26
|
+
durable(): boolean;
|
|
27
|
+
/** This page's attachment on the conversation wire, to compare with the holder of the input. */
|
|
28
|
+
attachment(): string;
|
|
29
|
+
/** "viewer" when this page only watches. */
|
|
30
|
+
role(): "controller" | "viewer";
|
|
31
|
+
/** Take the input from whoever holds it. */
|
|
32
|
+
takeover(): Promise<boolean>;
|
|
33
|
+
}
|
|
34
|
+
export declare function createAgentSession(): AgentSession;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function GhostCursor(): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface AttendItem {
|
|
2
|
+
subject: string;
|
|
3
|
+
state: "needs_you" | "failed" | "unseen";
|
|
4
|
+
title?: string;
|
|
5
|
+
reason?: string;
|
|
6
|
+
window?: string;
|
|
7
|
+
card?: string;
|
|
8
|
+
by?: string;
|
|
9
|
+
since: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Attention {
|
|
12
|
+
items: AttendItem[];
|
|
13
|
+
counts: Record<string, number>;
|
|
14
|
+
}
|
|
15
|
+
export declare function useAttention(): Attention;
|
|
16
|
+
/** The first thing that waits: what needs an answer first, then failures, then unseen windows. */
|
|
17
|
+
export declare const firstItem: (a: Attention) => AttendItem;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AttendItem } from "./attention";
|
|
2
|
+
import { type CommandDef } from "./store";
|
|
2
3
|
export interface UI {
|
|
3
4
|
togglePalette(open?: boolean): void;
|
|
4
5
|
toggleAgent(open?: boolean): void;
|
|
5
6
|
toggleMenu(): void;
|
|
6
7
|
}
|
|
7
8
|
export declare const clientCommands: CommandDef[];
|
|
9
|
+
/** Brings an item in front: its window, or the Cards window for a card (the agent's own cards sit
|
|
10
|
+
* in its panel). */
|
|
11
|
+
export declare function jumpTo(item: AttendItem | undefined, ui: UI): Promise<boolean>;
|
|
8
12
|
/** Runs a page command. Returns undefined when the id is not one of the page's. */
|
|
9
13
|
export declare function runClient(id: string, ui: UI, args?: Record<string, unknown>): Promise<unknown> | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unsent input (desk rule 7): the page tells the server when the owner has typed something not yet
|
|
3
|
+
* sent, in a window or in the agent panel, so a delegate's change to that window is held instead of
|
|
4
|
+
* replacing it, and an agent's open does not take the focus from the panel. Any text field holding
|
|
5
|
+
* text counts. The report is sent only when it changes, and cleared when the field empties or the
|
|
6
|
+
* window goes.
|
|
7
|
+
*/
|
|
8
|
+
import { type RefObject } from "react";
|
|
9
|
+
/** Reports whether the element's fields hold unsent text: for window id, or the panel when id is "". */
|
|
10
|
+
export declare function useComposing(ref: RefObject<HTMLElement | null>, id: string): void;
|
|
@@ -9,7 +9,23 @@ export interface DeskWin {
|
|
|
9
9
|
args: Record<string, unknown>;
|
|
10
10
|
state?: Record<string, unknown>;
|
|
11
11
|
dirty?: boolean;
|
|
12
|
+
/** Who opened it (owner, agent, reflex, outside), why, and whether the owner has made it theirs. */
|
|
13
|
+
opened_by?: string;
|
|
14
|
+
reason?: string;
|
|
15
|
+
retention?: string;
|
|
16
|
+
kept?: boolean;
|
|
17
|
+
/** The owner has unsent input in it (the page reports it). */
|
|
18
|
+
composing?: boolean;
|
|
19
|
+
/** A delegate's change to what it shows, waiting until the owner is done (rule 7). */
|
|
20
|
+
held?: {
|
|
21
|
+
args: Record<string, unknown>;
|
|
22
|
+
title?: string;
|
|
23
|
+
by: string;
|
|
24
|
+
at: string;
|
|
25
|
+
};
|
|
12
26
|
}
|
|
27
|
+
/** A window a delegate opened that the owner has not made theirs (docs/desk-rules.md, rule 4). */
|
|
28
|
+
export declare const notYetKept: (w: DeskWin) => boolean;
|
|
13
29
|
export interface DeskState {
|
|
14
30
|
wins: DeskWin[];
|
|
15
31
|
focus: string;
|
|
@@ -11,9 +11,14 @@ import { Controls } from "./controls";
|
|
|
11
11
|
import { Display } from "./display";
|
|
12
12
|
import { Genui } from "./genui";
|
|
13
13
|
import { Overlays } from "./overlays";
|
|
14
|
+
import { Theme } from "./theme";
|
|
14
15
|
import { Windows } from "./windows";
|
|
15
16
|
/** The sections, in order. Their ids name the screenshots. */
|
|
16
17
|
export declare const SECTIONS: readonly [{
|
|
18
|
+
readonly id: "theme";
|
|
19
|
+
readonly title: "Theme";
|
|
20
|
+
readonly draw: typeof Theme;
|
|
21
|
+
}, {
|
|
17
22
|
readonly id: "controls";
|
|
18
23
|
readonly title: "Controls";
|
|
19
24
|
readonly draw: typeof Controls;
|
|
@@ -47,3 +52,13 @@ export declare const SECTIONS: readonly [{
|
|
|
47
52
|
readonly draw: typeof Windows;
|
|
48
53
|
}];
|
|
49
54
|
export declare function Gallery({ win }: ViewProps): import("react").JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* The gallery's tabs, outside any window: the standalone page (standalone.tsx) draws this,
|
|
57
|
+
* opening on `first` and telling `onSection` which section is shown.
|
|
58
|
+
*/
|
|
59
|
+
export declare function GalleryTabs({ first, onSection, draft, }: {
|
|
60
|
+
first?: string;
|
|
61
|
+
onSection?: (id: string) => void;
|
|
62
|
+
/** Show the Draft tab first, for this design job (`true`: any job's marked draft). */
|
|
63
|
+
draft?: string | true;
|
|
64
|
+
}): import("react").JSX.Element;
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
/** The gallery's two layout pieces: a section with a title, and one labelled specimen. */
|
|
2
|
-
import type
|
|
3
|
-
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Which sections draw. In the Draft tab only the sections marked as a design job's draft
|
|
5
|
+
* draw: those whose `draft` is the job given (or any marked one when no job is given).
|
|
6
|
+
*/
|
|
7
|
+
export declare const DraftFilter: import("react").Context<{
|
|
8
|
+
only: boolean;
|
|
9
|
+
job?: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function Section({ title, about, draft, children, }: {
|
|
4
12
|
title: string;
|
|
5
13
|
about?: string;
|
|
14
|
+
/** The design job this section is the draft of (its id, e.g. "d_d065599e"): it shows in the Draft tab. */
|
|
15
|
+
draft?: string;
|
|
6
16
|
children: ReactNode;
|
|
7
|
-
}): import("react").JSX.Element;
|
|
17
|
+
}): import("react").JSX.Element | null;
|
|
8
18
|
export declare function Specimen({ label, wide, children }: {
|
|
9
19
|
label: string;
|
|
10
20
|
wide?: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Approval(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ComposerSpecimens(): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Theme: the palette in use, the tokens derived from it, how it reads, every shipped palette side by
|
|
2
|
+
* side, the two type styles, and reading a theme file. Design job d_97410e09, round 1. */
|
|
3
|
+
import { type Palette, type TypeStyle } from "@hollis-labs/surface-theme";
|
|
4
|
+
import { type ReactNode } from "react";
|
|
5
|
+
/** The gallery's palette and type style, chosen in its header. */
|
|
6
|
+
export declare const ThemeChoice: import("react").Context<{
|
|
7
|
+
palette: Palette;
|
|
8
|
+
type: TypeStyle;
|
|
9
|
+
setPalette: (p: Palette) => void;
|
|
10
|
+
setType: (t: TypeStyle) => void;
|
|
11
|
+
}>;
|
|
12
|
+
/** Draws its children in a palette (and type style) of their own. */
|
|
13
|
+
export declare function InPalette({ palette, type, children, className, }: {
|
|
14
|
+
palette: Palette;
|
|
15
|
+
type?: TypeStyle;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
export declare function Theme(): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hollis-labs/surface-page",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "The core of a Surface app's page: the desktop (bar, windows, palette), the agent panel, cards, generated surfaces, ADE's overlays, and the sdk a module's views import. It draws with the app's installed Surface registry components.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -51,9 +51,10 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@hollis-labs/ade-core": "0.1.0",
|
|
54
|
-
"@hollis-labs/surface-cards": "0.
|
|
55
|
-
"@hollis-labs/surface-chat": "0.
|
|
56
|
-
"@hollis-labs/surface-genui": "0.
|
|
54
|
+
"@hollis-labs/surface-cards": "0.3.0",
|
|
55
|
+
"@hollis-labs/surface-chat": "0.3.0",
|
|
56
|
+
"@hollis-labs/surface-genui": "0.3.0",
|
|
57
|
+
"@hollis-labs/surface-theme": "0.3.0"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"lucide-react": ">=1",
|