@av-pi-studio/workbench 0.0.123 → 0.0.124
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -4
- package/dist/chunks/{BinaryFallbackViewer-EznEIpRC.js → BinaryFallbackViewer-ua5VmtNP.js} +1 -1
- package/dist/chunks/{ChatPanel-DgJlK-yP.js → ChatPanel-9mV7jLOD.js} +3 -3
- package/dist/chunks/{CodeView-klpk8qD0.js → CodeView--Yo9YYpl.js} +2 -2
- package/dist/chunks/{FilePanel-Beg5Fs8X.js → FilePanel-CBNc1csX.js} +2 -2
- package/dist/chunks/HtmlViewer-BjvrS29T.js +539 -0
- package/dist/chunks/{ImageViewer-BLrsKWwI.js → ImageViewer-DQFVe58O.js} +1 -1
- package/dist/chunks/{MarkdownFileViewer-DxJJlrsv.js → MarkdownFileViewer-BEaGxGyd.js} +4 -4
- package/dist/chunks/{ModelProvidersPanel-C3TXoq1L.js → ModelProvidersPanel-CUdM6FMu.js} +2 -2
- package/dist/chunks/{MoleculeViewerPanel-BAWs5F2j.js → MoleculeViewerPanel-DhkadYBP.js} +3 -3
- package/dist/chunks/{PdfViewer-B_kiY-Tw.js → PdfViewer-PKAEVwco.js} +2 -2
- package/dist/chunks/{SaveFileButton-Bsz3wG4a.js → SaveFileButton-qwf_ewMX.js} +1 -1
- package/dist/chunks/SettingsDialog-ChDFOPih.js +454 -0
- package/dist/chunks/{SkillsPanel-BB5_yrcx.js → SkillsPanel-DP72YesV.js} +1 -1
- package/dist/chunks/{TerminalPanel-DgH4re05.js → TerminalPanel-BKnfLGNl.js} +1 -1
- package/dist/chunks/{TextViewer-BiwFYLLc.js → TextViewer-ZT99BjEP.js} +2 -2
- package/dist/chunks/{VideoViewer-BSGjTTQR.js → VideoViewer-C_gj8A0b.js} +1 -1
- package/dist/chunks/{ViewersPanel-BYHmKfOh.js → ViewersPanel-CTRov7NQ.js} +1 -1
- package/dist/chunks/external-link-BsgjS-QP.js +24 -0
- package/dist/chunks/{href-resolution-AtzN0oCd.js → href-resolution-AG-Co7Sm.js} +1 -1
- package/dist/chunks/index-CitLJdIo.js +7415 -0
- package/dist/chunks/{markdown-CypQ7TkY.js → markdown-CVWWeRbe.js} +97 -90
- package/dist/chunks/{use-file-download-zheHRdGQ.js → use-file-download-DbQCEsRG.js} +1 -1
- package/dist/chunks/{use-file-watch-CyVeSj2A.js → use-file-watch-CrgiCMCF.js} +1 -1
- package/dist/chunks/{use-provider-auth-list-jNjjSAD_.js → use-provider-auth-list-Bcdz9-zE.js} +1 -1
- package/dist/features/connection/ConnectionBar.d.ts +4 -0
- package/dist/features/connection/DaemonSwitcher.d.ts +16 -0
- package/dist/features/connection/daemon-switcher-presentation.d.ts +69 -0
- package/dist/features/connection/outdated-daemon.d.ts +17 -0
- package/dist/features/connection/use-outdated-daemon-notice.d.ts +26 -0
- package/dist/features/daemons/DaemonForm.d.ts +18 -0
- package/dist/features/daemons/DaemonsScreen.d.ts +17 -0
- package/dist/features/daemons/connect-current.d.ts +19 -0
- package/dist/features/daemons/daemon-form-actions.d.ts +27 -0
- package/dist/features/daemons/daemon-form.d.ts +103 -0
- package/dist/features/daemons/daemon-lifecycle.d.ts +58 -0
- package/dist/features/daemons/daemon-presentation.d.ts +46 -0
- package/dist/features/daemons/daemons-screen-actions.d.ts +37 -0
- package/dist/features/daemons/daemons-screen-view.d.ts +62 -0
- package/dist/features/daemons/daemons-store.d.ts +30 -0
- package/dist/features/daemons/use-daemon-lifecycle.d.ts +3 -0
- package/dist/features/daemons/use-daemons.d.ts +8 -0
- package/dist/features/files/preview-mounts.d.ts +25 -0
- package/dist/features/sessions/RenameSessionDialog.d.ts +8 -0
- package/dist/features/sessions/rename-title.d.ts +6 -0
- package/dist/features/sessions/session-actions.d.ts +6 -5
- package/dist/hooks/use-connection.d.ts +17 -5
- package/dist/host/browser-files.d.ts +2 -2
- package/dist/host/browser-host.d.ts +6 -1
- package/dist/host/types.d.ts +149 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/connection/connect-failure.d.ts +14 -0
- package/dist/lib/connection/connection-store.d.ts +7 -1
- package/dist/stores/session-rename-store.d.ts +13 -0
- package/dist/styles.css +1 -1
- package/dist/timeline/FileLink.d.ts +4 -2
- package/dist/timeline/external-href.d.ts +9 -0
- package/package.json +4 -4
- package/dist/chunks/HtmlViewer-KGQcSEm3.js +0 -490
- package/dist/chunks/SettingsDialog-AHnoT7nN.js +0 -471
- package/dist/chunks/index-QzeFcHmH.js +0 -6261
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The add/edit form of the Daemons screen as decisions: which fields a form shows, what is checked
|
|
3
|
+
* before the host is called, the entry or patch it sends, and which field a host refusal lands on
|
|
4
|
+
* (`swe/features/desktop-daemon-registry.md` § Public contract 4 "Edit form", § Adding, editing,
|
|
5
|
+
* removing).
|
|
6
|
+
*
|
|
7
|
+
* A stored secret is never an input here: `DaemonEntryView` has none, the edit form starts with an
|
|
8
|
+
* empty password and an empty "Replace link", and an untouched field is absent from the patch.
|
|
9
|
+
*
|
|
10
|
+
* Pure — no React, no host access — so it is unit-testable in the node env.
|
|
11
|
+
*/
|
|
12
|
+
import { type DaemonEntryView, type DaemonPatch, type NewDaemon } from "../../host/types.js";
|
|
13
|
+
import { type DaemonFailure } from "./daemon-presentation.js";
|
|
14
|
+
/** What a form is for: a new entry (of a kind the user picks) or an existing one. */
|
|
15
|
+
export type FormMode = {
|
|
16
|
+
type: "add";
|
|
17
|
+
} | {
|
|
18
|
+
type: "edit";
|
|
19
|
+
entry: DaemonEntryView;
|
|
20
|
+
};
|
|
21
|
+
export type FormKind = "direct" | "relay";
|
|
22
|
+
/** Where a message is drawn: next to a field, or at the form. */
|
|
23
|
+
export type FormField = "name" | "address" | "password" | "link" | "form";
|
|
24
|
+
export type FormErrors = Partial<Record<FormField, string>>;
|
|
25
|
+
export interface FormFields {
|
|
26
|
+
/** Add only; an edit keeps the entry's kind. */
|
|
27
|
+
kind: FormKind;
|
|
28
|
+
name: string;
|
|
29
|
+
address: string;
|
|
30
|
+
/** What is typed; never a stored value. */
|
|
31
|
+
password: string;
|
|
32
|
+
/** Edit: the user asked to remove the saved password. */
|
|
33
|
+
clearPassword: boolean;
|
|
34
|
+
/** Add relay: the link. Edit relay: the replacement, empty to keep the link. */
|
|
35
|
+
pairingLink: string;
|
|
36
|
+
}
|
|
37
|
+
export declare const NAME_BLANK = "Give this daemon a name.";
|
|
38
|
+
export declare const ADDRESS_BLANK = "Enter the daemon's address.";
|
|
39
|
+
export declare const ADDRESS_IS_LINK = "This is a pairing link. Add it as a relay daemon instead.";
|
|
40
|
+
export declare const LINK_BLANK = "Paste the pairing link.";
|
|
41
|
+
export declare const SAVE_FAILED = "This daemon could not be saved.";
|
|
42
|
+
export declare function initialAddFields(kind?: FormKind): FormFields;
|
|
43
|
+
/** Name and address as saved; password and link empty, whatever is stored. */
|
|
44
|
+
export declare function initialEditFields(entry: DaemonEntryView): FormFields;
|
|
45
|
+
export interface PasswordFieldView {
|
|
46
|
+
/** A password is saved (and not marked for removal). */
|
|
47
|
+
saved: boolean;
|
|
48
|
+
/** The "saved" marker text; `null` when nothing is saved. */
|
|
49
|
+
marker: string | null;
|
|
50
|
+
placeholder: string;
|
|
51
|
+
/** Offer "Clear". */
|
|
52
|
+
canClear: boolean;
|
|
53
|
+
/** Offer "Keep" (a clear is pending). */
|
|
54
|
+
canUndoClear: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface FormView {
|
|
57
|
+
title: string;
|
|
58
|
+
submitLabel: string;
|
|
59
|
+
/** Add only: the kind choice. */
|
|
60
|
+
showKind: boolean;
|
|
61
|
+
showAddress: boolean;
|
|
62
|
+
showPassword: boolean;
|
|
63
|
+
showLink: boolean;
|
|
64
|
+
linkLabel: string;
|
|
65
|
+
linkPlaceholder: string;
|
|
66
|
+
password: PasswordFieldView;
|
|
67
|
+
}
|
|
68
|
+
export declare const KIND_OPTIONS: {
|
|
69
|
+
value: FormKind;
|
|
70
|
+
label: string;
|
|
71
|
+
}[];
|
|
72
|
+
export declare function formView(mode: FormMode, fields: FormFields): FormView;
|
|
73
|
+
/** The address field's message, or `undefined` when the address can be saved. */
|
|
74
|
+
export declare function addressProblem(address: string): string | undefined;
|
|
75
|
+
/** The link field's message, or `undefined` when the text is a pairing link. */
|
|
76
|
+
export declare function linkProblem(link: string): string | undefined;
|
|
77
|
+
export type BuildResult<T> = {
|
|
78
|
+
ok: true;
|
|
79
|
+
value: T;
|
|
80
|
+
} | {
|
|
81
|
+
ok: false;
|
|
82
|
+
errors: FormErrors;
|
|
83
|
+
};
|
|
84
|
+
/** Check an add form and build what `HostDaemons.add` takes. */
|
|
85
|
+
export declare function buildNewDaemon(fields: FormFields): BuildResult<NewDaemon>;
|
|
86
|
+
/**
|
|
87
|
+
* Check an edit form and build the patch: only what changed. A field the entry's kind does not
|
|
88
|
+
* have is never sent. A password typed wins over a pending clear.
|
|
89
|
+
*/
|
|
90
|
+
export declare function buildPatch(entry: DaemonEntryView, fields: FormFields): BuildResult<DaemonPatch>;
|
|
91
|
+
/** Whether saving this edit gives a relay entry a new pairing link. */
|
|
92
|
+
export declare function linkReplaced(entry: DaemonEntryView, fields: FormFields): boolean;
|
|
93
|
+
export declare function isEmptyPatch(patch: DaemonPatch): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Whether a saved change to the entry calls for connecting again: it is the current entry and the
|
|
96
|
+
* change alters what is dialed (address, password or link). A rename does not.
|
|
97
|
+
*/
|
|
98
|
+
export declare function needsReconnect(entry: Pick<DaemonEntryView, "id">, currentId: string | null, patch: DaemonPatch): boolean;
|
|
99
|
+
/** Where a host refusal is drawn and what it says. */
|
|
100
|
+
export declare function refusalErrors(code: DaemonFailure): FormErrors;
|
|
101
|
+
/** The fields without the message of one field, once the user edits it. */
|
|
102
|
+
export declare function withoutError(errors: FormErrors, field: FormField): FormErrors;
|
|
103
|
+
//# sourceMappingURL=daemon-form.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the window reacts to what happens to the daemon it is connected to
|
|
3
|
+
* (`swe/features/desktop-daemon-registry.md` § Local daemon state, § Adding, editing, removing,
|
|
4
|
+
* § Error handling): the local daemon stopping, the current entry being removed, a relay link that
|
|
5
|
+
* no longer matches its daemon, a dropped connection to the local daemon, the native menu's
|
|
6
|
+
* "Manage daemons…".
|
|
7
|
+
*
|
|
8
|
+
* `lifecycleReactions` is the decision, pure over two looks at the facts. `watchDaemonLifecycle`
|
|
9
|
+
* reads the facts from the registry and the connection store, applies the decision through
|
|
10
|
+
* injected effects and returns the unsubscribe. A restart changes nothing here: the connection is
|
|
11
|
+
* kept and the SDK's reconnection covers the gap. The workbench never starts a daemon by itself;
|
|
12
|
+
* when one that was started (from the screen or the native menu) comes up while the window is
|
|
13
|
+
* connected to nothing, it connects.
|
|
14
|
+
*/
|
|
15
|
+
import { type ConnectionState, type RelayConnectReason } from "@av-pi-studio/client";
|
|
16
|
+
import { type DaemonEntryView, type HostDaemons, type LocalDaemonState } from "../../host/types.js";
|
|
17
|
+
/** What the decision looks at: the registry's current entry and the connection. */
|
|
18
|
+
export interface LifecycleFacts {
|
|
19
|
+
currentId: string | null;
|
|
20
|
+
currentKind: DaemonEntryView["kind"] | null;
|
|
21
|
+
local: LocalDaemonState["state"];
|
|
22
|
+
status: ConnectionState;
|
|
23
|
+
errorReason: RelayConnectReason | null;
|
|
24
|
+
}
|
|
25
|
+
export type LifecycleReaction =
|
|
26
|
+
/** Disconnect without retrying (what the Disconnect button does) and open the Daemons screen. */
|
|
27
|
+
{
|
|
28
|
+
kind: "leave";
|
|
29
|
+
} | {
|
|
30
|
+
kind: "markLinkInvalid";
|
|
31
|
+
id: string;
|
|
32
|
+
} | {
|
|
33
|
+
kind: "clearLinkInvalid";
|
|
34
|
+
id: string;
|
|
35
|
+
}
|
|
36
|
+
/** Ask the host to probe the local daemon again; once per drop. */
|
|
37
|
+
| {
|
|
38
|
+
kind: "refreshLocal";
|
|
39
|
+
}
|
|
40
|
+
/** The local daemon came up from a start and the window is connected to nothing: connect. */
|
|
41
|
+
| {
|
|
42
|
+
kind: "connect";
|
|
43
|
+
};
|
|
44
|
+
export declare function lifecycleReactions(prev: LifecycleFacts, next: LifecycleFacts): LifecycleReaction[];
|
|
45
|
+
export interface LifecycleEffects {
|
|
46
|
+
leave(): void;
|
|
47
|
+
markLinkInvalid(id: string): void;
|
|
48
|
+
clearLinkInvalid(id: string): void;
|
|
49
|
+
refreshLocal(): void;
|
|
50
|
+
connect(): void;
|
|
51
|
+
openScreen(): void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Apply `lifecycleReactions` to every change of the registry or the connection, and open the
|
|
55
|
+
* screen when the host asks for it. Returns the unsubscribe.
|
|
56
|
+
*/
|
|
57
|
+
export declare function watchDaemonLifecycle(daemons: HostDaemons, effects: LifecycleEffects): () => void;
|
|
58
|
+
//# sourceMappingURL=daemon-lifecycle.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words and the rules the daemon switcher and the Daemons screen share: what a local daemon
|
|
3
|
+
* state is called and which actions apply to it, and what each `DaemonError` code means to a user.
|
|
4
|
+
*
|
|
5
|
+
* Pure — no React, no store access — so it is unit-testable in the node env
|
|
6
|
+
* (`swe/features/desktop-daemon-registry.md` § Error handling & edge cases).
|
|
7
|
+
*/
|
|
8
|
+
import { type DaemonErrorCode, type LocalDaemonState } from "../../host/types.js";
|
|
9
|
+
/** What the user can ask of the local daemon. */
|
|
10
|
+
export type LocalActionKind = "start" | "stop" | "restart" | "retry";
|
|
11
|
+
export interface LocalAction {
|
|
12
|
+
kind: LocalActionKind;
|
|
13
|
+
label: string;
|
|
14
|
+
/** The `HostDaemons.local` member to call: Retry re-probes a missing or outdated CLI and starts a failed daemon again. */
|
|
15
|
+
call: "start" | "stop" | "restart" | "refresh";
|
|
16
|
+
}
|
|
17
|
+
/** `error`: something went wrong; `busy`: an action is running; `ok`: up; `neutral`: nothing to flag. */
|
|
18
|
+
export type LocalTone = "neutral" | "busy" | "ok" | "error";
|
|
19
|
+
export interface LocalStateView {
|
|
20
|
+
label: string;
|
|
21
|
+
tone: LocalTone;
|
|
22
|
+
/** In display order. Empty while the state is transient or nothing can be done. */
|
|
23
|
+
actions: LocalAction[];
|
|
24
|
+
}
|
|
25
|
+
export declare function localStateView(state: LocalDaemonState): LocalStateView;
|
|
26
|
+
/** A code the workbench could not map, e.g. a host that rejected with something else. */
|
|
27
|
+
export type DaemonFailure = DaemonErrorCode | "unexpected";
|
|
28
|
+
export interface DaemonErrorView {
|
|
29
|
+
/** One sentence for the banner or the form. */
|
|
30
|
+
message: string;
|
|
31
|
+
/** A second sentence explaining why or what to do, when the message alone is not enough. */
|
|
32
|
+
detail?: string;
|
|
33
|
+
/** A shell command the user can copy. */
|
|
34
|
+
command?: string;
|
|
35
|
+
/** `false`: a plain state, not drawn as an error (the local daemon is stopped by choice). */
|
|
36
|
+
isError: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare const INSTALL_CLI_COMMAND = "npm i -g @av-pi-studio/cli";
|
|
39
|
+
export declare const UPDATE_CLI_COMMAND = "npm i -g @av-pi-studio/cli@latest";
|
|
40
|
+
/** Every code the host can reject with, for tests and exhaustive UI (the table above is typed to cover them all). */
|
|
41
|
+
export declare const DAEMON_ERROR_CODES: DaemonErrorCode[];
|
|
42
|
+
export declare function daemonErrorView(code: DaemonFailure): DaemonErrorView;
|
|
43
|
+
export declare function isDaemonErrorCode(value: unknown): value is DaemonErrorCode;
|
|
44
|
+
/** The code a `HostDaemons` call rejected with, or `unexpected` for anything else. */
|
|
45
|
+
export declare function daemonFailureOf(error: unknown): DaemonFailure;
|
|
46
|
+
//# sourceMappingURL=daemon-presentation.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the Daemons screen's buttons do against the host: open an entry, run a local daemon action,
|
|
3
|
+
* remove an entry after a confirm, save a setting. Each call reports the failure code a banner can
|
|
4
|
+
* word (`DaemonFailure`) or `null`; none throws, so the component only sets state.
|
|
5
|
+
*
|
|
6
|
+
* Plain functions over `HostDaemons` / `HostDialogs` — unit-testable with the in-memory registry
|
|
7
|
+
* (`test/test-daemons.ts`) and `createTestHost`.
|
|
8
|
+
*/
|
|
9
|
+
import { type ConnectionState } from "@av-pi-studio/client";
|
|
10
|
+
import { type HostDaemons, type HostDialogs } from "../../host/types.js";
|
|
11
|
+
import { type DaemonFailure, type LocalAction } from "./daemon-presentation.js";
|
|
12
|
+
/** What a `HostDaemons` call that has no value to return came to. */
|
|
13
|
+
export type ActionOutcome = DaemonFailure | null;
|
|
14
|
+
/**
|
|
15
|
+
* Open an entry. The host reloads the page on success, so the promise never resolves then; a
|
|
16
|
+
* rejection (the entry vanished) is the only thing to report.
|
|
17
|
+
*/
|
|
18
|
+
export declare function openEntry(daemons: HostDaemons, id: string): Promise<ActionOutcome>;
|
|
19
|
+
/** Start, stop, restart or re-probe the local daemon. Acceptance only: the outcome is a state change. */
|
|
20
|
+
export declare function runLocalAction(daemons: HostDaemons, call: LocalAction["call"]): Promise<ActionOutcome>;
|
|
21
|
+
export declare const STOP_CONFIRM_MESSAGE = "Agents running on this daemon will stop.";
|
|
22
|
+
/** Stopping the daemon this window is connected to ends the connection, so it is asked first. */
|
|
23
|
+
export declare function stopNeedsConfirm(call: LocalAction["call"], onCurrentEntry: boolean, status: ConnectionState): boolean;
|
|
24
|
+
/** `runLocalAction`, after a confirm when `ask` is set. Answering no does nothing and reports nothing. */
|
|
25
|
+
export declare function runLocalActionAsking(daemons: HostDaemons, dialogs: HostDialogs, call: LocalAction["call"], ask: boolean): Promise<ActionOutcome>;
|
|
26
|
+
export declare function removeConfirmMessage(name: string): string;
|
|
27
|
+
/** Ask, then remove. Answering no removes nothing and reports nothing. */
|
|
28
|
+
export declare function removeEntry(daemons: HostDaemons, dialogs: HostDialogs, entry: {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
}): Promise<ActionOutcome>;
|
|
32
|
+
/** `null` on success; else the reason the host gave, to show under the field. */
|
|
33
|
+
export type SettingsOutcome = string | null;
|
|
34
|
+
export declare function saveAutoStart(daemons: HostDaemons, enabled: boolean): Promise<SettingsOutcome>;
|
|
35
|
+
/** The field's text, trimmed; empty means "find it" (`null`). */
|
|
36
|
+
export declare function saveCliPath(daemons: HostDaemons, input: string): Promise<SettingsOutcome>;
|
|
37
|
+
//# sourceMappingURL=daemons-screen-actions.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the Daemons screen draws, decided from the registry snapshot and the error the daemons
|
|
3
|
+
* store holds: one row per entry with the actions that apply to it, the local entry's state and
|
|
4
|
+
* its notice, the banner, and the two settings' field rules.
|
|
5
|
+
*
|
|
6
|
+
* Pure — no React, no host access — so it is unit-testable in the node env
|
|
7
|
+
* (`swe/features/desktop-daemon-registry.md` § Public contract 4, § Error handling & edge cases).
|
|
8
|
+
*/
|
|
9
|
+
import { type DaemonSettings } from "../../host/types.js";
|
|
10
|
+
import { type DaemonFailure, type LocalAction, type LocalTone } from "./daemon-presentation.js";
|
|
11
|
+
import { type DaemonsSnapshot } from "./use-daemons.js";
|
|
12
|
+
export type EntryAction = "open" | "replaceLink" | "edit" | "remove";
|
|
13
|
+
export declare const LINK_INVALID_LABEL = "Pairing link no longer valid";
|
|
14
|
+
/** A short explanation under the local entry's state, with a command the user can run. */
|
|
15
|
+
export interface LocalNotice {
|
|
16
|
+
text: string;
|
|
17
|
+
command?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface LocalRowView {
|
|
20
|
+
label: string;
|
|
21
|
+
tone: LocalTone;
|
|
22
|
+
actions: LocalAction[];
|
|
23
|
+
notice: LocalNotice | null;
|
|
24
|
+
}
|
|
25
|
+
export interface EntryRowView {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
/** "This machine", "Address" or "Relay". */
|
|
29
|
+
kindLabel: string;
|
|
30
|
+
/** A direct entry's address, as typed; `null` for the others. */
|
|
31
|
+
address: string | null;
|
|
32
|
+
current: boolean;
|
|
33
|
+
/** A relay entry whose pairing link stopped working (memory only); the row offers "Replace link". */
|
|
34
|
+
linkInvalid: boolean;
|
|
35
|
+
/** In display order. `open` is absent on the current entry, `remove` on the local one. */
|
|
36
|
+
actions: EntryAction[];
|
|
37
|
+
/** The local entry's state and actions; `null` for every other entry. */
|
|
38
|
+
local: LocalRowView | null;
|
|
39
|
+
}
|
|
40
|
+
export interface BannerView {
|
|
41
|
+
message: string;
|
|
42
|
+
detail?: string;
|
|
43
|
+
command?: string;
|
|
44
|
+
/** `info`: a plain state (the local daemon is stopped by choice), not drawn as an error. */
|
|
45
|
+
tone: "error" | "info";
|
|
46
|
+
}
|
|
47
|
+
export interface DaemonsScreenView {
|
|
48
|
+
rows: EntryRowView[];
|
|
49
|
+
banner: BannerView | null;
|
|
50
|
+
}
|
|
51
|
+
/** The banner for the error the store holds, with what the snapshot adds (the outdated CLI's version). */
|
|
52
|
+
export declare function bannerView(error: DaemonFailure | null, local: DaemonsSnapshot["local"]): BannerView | null;
|
|
53
|
+
export declare function buildDaemonsScreenView(snapshot: DaemonsSnapshot, error: DaemonFailure | null, invalidLinks?: ReadonlySet<string>): DaemonsScreenView;
|
|
54
|
+
/** The value `setSettings` gets for the CLI path field: trimmed, and `null` when empty ("find it"). */
|
|
55
|
+
export declare function cliPathFromField(input: string): string | null;
|
|
56
|
+
/** What the CLI path field shows for a saved setting. */
|
|
57
|
+
export declare function cliPathToField(settings: Pick<DaemonSettings, "cliPath">): string;
|
|
58
|
+
/** Saving is offered only when the field would change the setting. */
|
|
59
|
+
export declare function cliPathChanged(input: string, settings: Pick<DaemonSettings, "cliPath">): boolean;
|
|
60
|
+
/** The message under a settings field when the host refused the value. */
|
|
61
|
+
export declare function settingsFailureText(error: unknown): string;
|
|
62
|
+
//# sourceMappingURL=daemons-screen-view.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daemons UI store — in memory only. Whether the Daemons screen is open, the boot or action error
|
|
3
|
+
* it shows, the relay entries marked "pairing link no longer valid" (spec decision P6: never
|
|
4
|
+
* written to the registry file), and `connectCurrent`, the one action that boot, Retry and
|
|
5
|
+
* "Reconnect now" share. The registry itself is `host.daemons`; this holds no copy of it.
|
|
6
|
+
*/
|
|
7
|
+
import { type DaemonFailure } from "./daemon-presentation.js";
|
|
8
|
+
interface DaemonsStoreState {
|
|
9
|
+
/** The Daemons screen is open. */
|
|
10
|
+
open: boolean;
|
|
11
|
+
/** The boot or action error the screen shows; `null` when there is none. */
|
|
12
|
+
error: DaemonFailure | null;
|
|
13
|
+
/** Ids of relay entries whose pairing link stopped working. */
|
|
14
|
+
invalidLinks: ReadonlySet<string>;
|
|
15
|
+
openScreen(): void;
|
|
16
|
+
closeScreen(): void;
|
|
17
|
+
setError(error: DaemonFailure | null): void;
|
|
18
|
+
markLinkInvalid(id: string): void;
|
|
19
|
+
clearLinkInvalid(id: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Ask the registry what to dial for the current entry and connect to it. A rejection dials
|
|
22
|
+
* nothing, records its code in `error` and opens the screen (D18). No-op without `host.daemons`.
|
|
23
|
+
*/
|
|
24
|
+
connectCurrent(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export declare const useDaemonsStore: import("zustand").UseBoundStore<import("zustand").StoreApi<DaemonsStoreState>>;
|
|
27
|
+
/** Back to the initial state, for tests. */
|
|
28
|
+
export declare function resetDaemonsStoreForTests(): void;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=daemons-store.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type HostDaemons } from "../../host/types.js";
|
|
2
|
+
export type DaemonsSnapshot = ReturnType<HostDaemons["snapshot"]>;
|
|
3
|
+
/**
|
|
4
|
+
* The host registry's current snapshot, re-read whenever it notifies; `null` when the host has no
|
|
5
|
+
* registry (the browser), in which case nothing daemon-related is drawn.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useDaemons(): DaemonsSnapshot | null;
|
|
8
|
+
//# sourceMappingURL=use-daemons.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bookkeeping for documents a host `preview` of kind `origin` has mounted for the HTML viewer. Pure
|
|
3
|
+
* so the release rules are unit-tested: the current document is released exactly once when a newer
|
|
4
|
+
* one replaces it, a mount that resolves after it was superseded (or after `dispose`) is released
|
|
5
|
+
* at once, and `dispose` releases the current document.
|
|
6
|
+
*/
|
|
7
|
+
export interface MountedDocument {
|
|
8
|
+
url: string;
|
|
9
|
+
release(): void;
|
|
10
|
+
}
|
|
11
|
+
export interface PreviewMounts {
|
|
12
|
+
/** Start a mount attempt. Returns its token; any earlier attempt becomes stale. */
|
|
13
|
+
begin(): number;
|
|
14
|
+
/**
|
|
15
|
+
* Hand over the result of attempt `token`. Returns `true` when it is now current. A stale attempt
|
|
16
|
+
* is released immediately and returns `false`.
|
|
17
|
+
*/
|
|
18
|
+
settle(token: number, doc: MountedDocument): boolean;
|
|
19
|
+
/** Whether `token` is still the newest attempt (failures of stale attempts are ignored). */
|
|
20
|
+
isCurrent(token: number): boolean;
|
|
21
|
+
/** Release the current document and make every in-flight attempt stale. */
|
|
22
|
+
dispose(): void;
|
|
23
|
+
}
|
|
24
|
+
export declare function createPreviewMounts(): PreviewMounts;
|
|
25
|
+
//# sourceMappingURL=preview-mounts.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rename dialog — one global instance, opened for a session through `useSessionRenameStore`
|
|
3
|
+
* (the session menu's "Rename"). One text field pre-filled with the current title and selected;
|
|
4
|
+
* Enter or Rename confirms, Escape / Cancel / a click outside dismisses. `resolveRenameTitle`
|
|
5
|
+
* decides whether the answer changes anything. Closing returns focus to the session's row.
|
|
6
|
+
*/
|
|
7
|
+
export declare function RenameSessionDialog(): import("react").JSX.Element | null;
|
|
8
|
+
//# sourceMappingURL=RenameSessionDialog.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decision behind the rename dialog, kept pure: what title, if any, does this input produce.
|
|
3
|
+
*/
|
|
4
|
+
/** The trimmed title for a changed input; `null` for a blank, whitespace-only or unchanged one. */
|
|
5
|
+
export declare function resolveRenameTitle(input: string, current: string): string | null;
|
|
6
|
+
//# sourceMappingURL=rename-title.d.ts.map
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The sidebar context menus'
|
|
3
|
-
* against whatever host is installed.
|
|
4
|
-
* the user agreed
|
|
2
|
+
* The sidebar context menus' session actions, outside React so they run (and are tested)
|
|
3
|
+
* against whatever host is installed. The delete action asks through `getHost().dialogs` and only
|
|
4
|
+
* mutates after the user agreed; rename is answered by the workbench's own dialog
|
|
5
|
+
* (`RenameSessionDialog.tsx`), which hands the chosen title to `applySessionRename`.
|
|
5
6
|
*/
|
|
6
7
|
import type { PiStudioClient } from "@av-pi-studio/client";
|
|
7
8
|
import { type SessionEntry } from "../../stores/session-store.js";
|
|
8
9
|
type SessionRef = Pick<SessionEntry, "id" | "title" | "agentId">;
|
|
9
10
|
type AgentClient = Pick<PiStudioClient, "agent">;
|
|
10
|
-
/**
|
|
11
|
-
export declare function
|
|
11
|
+
/** Apply an already-resolved (trimmed, changed) title: store, tab label, and the daemon. */
|
|
12
|
+
export declare function applySessionRename(session: SessionRef, title: string, client: AgentClient | null): void;
|
|
12
13
|
/**
|
|
13
14
|
* Ask, then delete every conversation of a workspace (files on disk are untouched). Returns whether
|
|
14
15
|
* the user confirmed. A failed delete is reported and skipped; the rest continue.
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Boot hook:
|
|
3
|
-
* (
|
|
4
|
-
* the
|
|
5
|
-
*
|
|
2
|
+
* Boot hook: connects once on mount. With a host registry (`host.daemons`) the registry says what
|
|
3
|
+
* to dial (`resolveCurrent`, via `features/daemons/daemons-store.ts#connectCurrent`) and a refusal
|
|
4
|
+
* opens the Daemons screen. Without one it applies the host's launch intent — pre-fills the
|
|
5
|
+
* connection bar (host/password/cwd) and connects when the intent says so. In the browser the
|
|
6
|
+
* intent comes from the page URL (`host/browser-launch.ts`: `?host=&password=&cwd=&connect=1`,
|
|
7
|
+
* `?pair=`, a fragment carrying `offer=`); a native shell supplies its own.
|
|
6
8
|
*
|
|
7
9
|
* The URL is handed to `connect()` verbatim — it detects a pairing link itself via
|
|
8
10
|
* `parsePairingUrl` and branches to the relay transport when the link carries one. A pairing link
|
|
9
11
|
* is its own credential, so no password is sent with it.
|
|
10
12
|
*/
|
|
11
|
-
import { type ConnectIntent } from "../host/types.js";
|
|
13
|
+
import { type ConnectIntent, type WorkbenchHost } from "../host/types.js";
|
|
12
14
|
import { type ConnectOptions } from "../lib/connection/connection-store.js";
|
|
13
15
|
export interface ConnectIntentDeps {
|
|
14
16
|
setHost(host: string): void;
|
|
@@ -23,5 +25,15 @@ export interface ConnectIntentDeps {
|
|
|
23
25
|
}
|
|
24
26
|
/** Pre-fill from `intent`, then connect to the bar's fields if it asks to. `null` does nothing. */
|
|
25
27
|
export declare function applyConnectIntent(intent: ConnectIntent | null, deps: ConnectIntentDeps): void;
|
|
28
|
+
export interface ConnectBootDeps extends ConnectIntentDeps {
|
|
29
|
+
/** Connect to the registry's current entry (`useDaemonsStore.connectCurrent`). */
|
|
30
|
+
connectCurrent(): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The boot decision. A host with a registry says what to dial (`resolveCurrent`), and the intent's
|
|
34
|
+
* secret goes to the connection only — the connection bar's host and password fields are not
|
|
35
|
+
* touched. Without one, the launch intent fills the fields as before.
|
|
36
|
+
*/
|
|
37
|
+
export declare function bootConnection(host: Pick<WorkbenchHost, "launch" | "daemons">, deps: ConnectBootDeps): void;
|
|
26
38
|
export declare function useConnectionBoot(): void;
|
|
27
39
|
//# sourceMappingURL=use-connection.d.ts.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* object URL.
|
|
6
6
|
*/
|
|
7
7
|
import { type FileTransferClient } from "@av-pi-studio/client";
|
|
8
|
-
import { type HostFiles } from "./types.js";
|
|
9
|
-
export declare function createBrowserFiles(transfer: () => FileTransferClient): HostFiles;
|
|
8
|
+
import { type HostFiles, type SaveTarget } from "./types.js";
|
|
9
|
+
export declare function createBrowserFiles(transfer: () => FileTransferClient, saveTarget?: (suggestedName: string) => Promise<SaveTarget | null>): HostFiles;
|
|
10
10
|
//# sourceMappingURL=browser-files.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AppIdentity, type HostPdf, type WorkbenchHost } from "./types.js";
|
|
1
|
+
import { type AppIdentity, type HostPdf, type SaveTarget, type WorkbenchHost } from "./types.js";
|
|
2
2
|
export interface BrowserHostOptions {
|
|
3
3
|
/** Brand title and version for the connection bar. A real shell always passes it. */
|
|
4
4
|
app: AppIdentity;
|
|
@@ -8,6 +8,11 @@ export interface BrowserHostOptions {
|
|
|
8
8
|
* `build/pdf.worker.min.mjs`, and the app base plus `pdfjs/`). Omitted: no PDF preview.
|
|
9
9
|
*/
|
|
10
10
|
pdf: HostPdf;
|
|
11
|
+
/**
|
|
12
|
+
* Where "Download" saves a file. Asked with the file's name; resolves a target, or `null` when the
|
|
13
|
+
* user cancelled. Omitted: the browser's Blob and download anchor.
|
|
14
|
+
*/
|
|
15
|
+
saveTarget?: (suggestedName: string) => Promise<SaveTarget | null>;
|
|
11
16
|
}
|
|
12
17
|
/** The host `web-client` uses: today's browser behaviour behind the host contract. */
|
|
13
18
|
export declare function createBrowserHost(overrides?: Partial<BrowserHostOptions>): WorkbenchHost;
|