@getmateo/plugin 0.0.0-stage → 0.18.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/LICENSE +211 -0
- package/dist/attachments.d.ts +26 -0
- package/dist/attachments.js +17 -0
- package/dist/client/buttons.d.ts +64 -0
- package/dist/client/buttons.js +2 -0
- package/dist/client/client-state.d.ts +15 -0
- package/dist/client/client-state.js +32 -0
- package/dist/client/contracts.d.ts +299 -0
- package/dist/client/contracts.js +2 -0
- package/dist/client/host.d.ts +19 -0
- package/dist/client/host.js +12 -0
- package/dist/client/index.d.ts +39 -0
- package/dist/client/index.js +4 -0
- package/dist/client/mateo-context.d.ts +9 -0
- package/dist/client/mateo-context.js +16 -0
- package/dist/client/menu.d.ts +45 -0
- package/dist/client/menu.js +2 -0
- package/dist/client/react-native.d.ts +53 -0
- package/dist/client/react-native.js +2 -0
- package/dist/client/rpc-context.d.ts +13 -0
- package/dist/client/rpc-context.js +18 -0
- package/dist/client/runtime-context-bridge.d.ts +5 -0
- package/dist/client/runtime-context-bridge.js +19 -0
- package/dist/client/settings-sections.d.ts +12 -0
- package/dist/client/settings-sections.js +2 -0
- package/dist/client/shallow.d.ts +2 -0
- package/dist/client/shallow.js +45 -0
- package/dist/client/sidebar-projects.d.ts +110 -0
- package/dist/client/sidebar-projects.js +2 -0
- package/dist/client/sidebar-workspaces.d.ts +17 -0
- package/dist/client/sidebar-workspaces.js +2 -0
- package/dist/client/storage.d.ts +12 -0
- package/dist/client/storage.js +2 -0
- package/dist/client/terminal-themes.d.ts +33 -0
- package/dist/client/terminal-themes.js +2 -0
- package/dist/client/ui.d.ts +161 -0
- package/dist/client/ui.js +2 -0
- package/dist/contracts.d.ts +90 -0
- package/dist/contracts.js +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +5 -0
- package/dist/rpc.d.ts +17 -0
- package/dist/rpc.js +12 -0
- package/dist/server/acp-internal/connection.d.ts +4 -0
- package/dist/server/acp-internal/connection.js +1301 -0
- package/dist/server/acp.d.ts +112 -0
- package/dist/server/acp.js +22 -0
- package/dist/server/contracts.d.ts +81 -0
- package/dist/server/contracts.js +2 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +2 -0
- package/dist/server/lifecycle.d.ts +99 -0
- package/dist/server/lifecycle.js +2 -0
- package/dist/server/models.d.ts +55 -0
- package/dist/server/models.js +2 -0
- package/dist/server/process-internal/windows-command.d.ts +15 -0
- package/dist/server/process-internal/windows-command.js +41 -0
- package/dist/server/process.d.ts +25 -0
- package/dist/server/process.js +71 -0
- package/dist/server/provider.d.ts +735 -0
- package/dist/server/provider.js +871 -0
- package/dist/server/usage.d.ts +149 -0
- package/dist/server/usage.js +134 -0
- package/dist/settings.d.ts +70 -0
- package/dist/settings.js +40 -0
- package/package.json +99 -4
- package/README.md +0 -3
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { PluginClientStateProvider, type PluginClientStateSource } from "./client-state.js";
|
|
2
|
+
export { usePluginRuntimeContextBridge, type PluginRuntimeContextBridge, } from "./runtime-context-bridge.js";
|
|
3
|
+
import type { PluginAttachmentSourceContribution } from "../contracts.js";
|
|
4
|
+
import { PluginRpcProvider } from "./rpc-context.js";
|
|
5
|
+
import { MateoApiProvider } from "./mateo-context.js";
|
|
6
|
+
import { callPluginRpc } from "../rpc.js";
|
|
7
|
+
export declare function searchPluginAttachments(source: PluginAttachmentSourceContribution, invoke: (method: string, input: unknown) => Promise<unknown>, query: string): Promise<{
|
|
8
|
+
items: {
|
|
9
|
+
id: string;
|
|
10
|
+
identifier: string;
|
|
11
|
+
title: string;
|
|
12
|
+
url: string;
|
|
13
|
+
text: string;
|
|
14
|
+
resourceType: string;
|
|
15
|
+
subtitle?: string | undefined;
|
|
16
|
+
}[];
|
|
17
|
+
}>;
|
|
18
|
+
export { callPluginRpc, MateoApiProvider, PluginRpcProvider };
|
|
19
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PluginAttachmentSearchPayloadSchema } from "../attachments.js";
|
|
2
|
+
export { PluginClientStateProvider } from "./client-state.js";
|
|
3
|
+
export { usePluginRuntimeContextBridge, } from "./runtime-context-bridge.js";
|
|
4
|
+
import { PluginRpcProvider } from "./rpc-context.js";
|
|
5
|
+
import { MateoApiProvider } from "./mateo-context.js";
|
|
6
|
+
import { callPluginRpc } from "../rpc.js";
|
|
7
|
+
export async function searchPluginAttachments(source, invoke, query) {
|
|
8
|
+
const output = await callPluginRpc(source.search, invoke, { query });
|
|
9
|
+
return PluginAttachmentSearchPayloadSchema.parseAsync(output);
|
|
10
|
+
}
|
|
11
|
+
export { callPluginRpc, MateoApiProvider, PluginRpcProvider };
|
|
12
|
+
//# sourceMappingURL=host.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type { PluginHostProps, PluginSurfaceProps, PluginScreenProps, PluginPopoverProps, PluginScreenParams, PluginOpenScreenInput, PluginScreenLocation, PluginSidebarItemProps, PluginSidebarItemContribution, PluginFloatingPanelProps, PluginFloatingPanelContribution, PluginIconProps, PluginPanelLocation, PluginPanelOpenLocation, PluginOpenPanelOptions, PluginWorkspacePanelProps, PluginAgentPanelProps, PluginClientOpenPanelOptions, PluginClientContext, PluginClientContribution, PluginWorkspacePanelContribution, PluginSettingsScreenContribution, PluginSurfaceContribution, PluginScreenContribution, PluginScreenTitle, PluginSidebarContribution, PluginTimelineTransformerContribution, PluginTimelineItemProps, PluginTimelineRendererContribution, PluginCommandCapabilities, PluginGlobalCommandContext, PluginWorkspaceCommandContext, PluginAgentCommandContext, PluginCommandCenterItemContribution, PluginClientSlashCommandContribution, SettingsState, } from "./contracts.js";
|
|
2
|
+
export type { PluginMenuEntry, PluginMenuItem, PluginMenuPrompt, PluginMenuSeparator, PluginMenuSubmenu, } from "./menu.js";
|
|
3
|
+
export type { PluginSidebarProject, PluginSidebarProjectGroup, PluginSidebarProjectGroupHeaderProps, PluginSidebarProjectGroupingActions, PluginSidebarProjectGroupingActionsInput, PluginSidebarProjectGroupingContribution, PluginSidebarProjectGroupingContentProps, PluginSidebarProjectMove, PluginSidebarProjectHostRef, PluginSidebarProjectMenuContribution, PluginSidebarProjectMenuInput, } from "./sidebar-projects.js";
|
|
4
|
+
export type { PluginSidebarWorkspaceAccessoryContribution, PluginSidebarWorkspaceAccessoryProps, } from "./sidebar-workspaces.js";
|
|
5
|
+
export type { PluginSettingsSectionContribution, PluginSettingsSectionPage, } from "./settings-sections.js";
|
|
6
|
+
export type { BrowserDownloadRule } from "@getmateo/protocol/browser-download-rules";
|
|
7
|
+
export type { PluginClientStorage } from "./storage.js";
|
|
8
|
+
export type { PluginTerminalThemeColors, PluginTerminalThemeContribution, } from "./terminal-themes.js";
|
|
9
|
+
export type { PluginButton, PluginButtonBehavior, PluginButtonContentProps, PluginButtonContext, PluginButtonIcon, PluginButtonIconProps, PluginButtonMenuEntry, PluginButtonRegistration, PluginComposerPillContribution, PluginHeaderButtonContribution, } from "./buttons.js";
|
|
10
|
+
export { useMateo } from "./mateo-context.js";
|
|
11
|
+
export { useAgent, useWorkspace } from "./client-state.js";
|
|
12
|
+
export { useRpc } from "./rpc-context.js";
|
|
13
|
+
import type { SettingsDefinition } from "../settings.js";
|
|
14
|
+
import type { PluginCommandCapabilities, SettingsState } from "./contracts.js";
|
|
15
|
+
import type { ZodType } from "zod";
|
|
16
|
+
export declare function useSettings<Schema extends ZodType>(definition: SettingsDefinition<Schema>): SettingsState<Schema>;
|
|
17
|
+
/** Configured app host, including hosts that are currently disconnected. */
|
|
18
|
+
export interface PluginHostSummary {
|
|
19
|
+
readonly serverId: string;
|
|
20
|
+
readonly label: string;
|
|
21
|
+
readonly status: "idle" | "connecting" | "online" | "offline" | "error";
|
|
22
|
+
}
|
|
23
|
+
/** Live configured hosts. Supplied by the app's client bundle loader. */
|
|
24
|
+
export declare function useHosts(): readonly PluginHostSummary[];
|
|
25
|
+
/** Borrow an online host's API under this installation's lifetime. */
|
|
26
|
+
export declare function getMateoClient(serverId: string): import("@getmateo/client").MateoApi;
|
|
27
|
+
/** Known hosts with this bundle's runtime plugin ID installed. */
|
|
28
|
+
export declare function usePluginHosts(): readonly PluginHostSummary[];
|
|
29
|
+
export interface PluginHostClient {
|
|
30
|
+
mateo: import("@getmateo/client").MateoApi;
|
|
31
|
+
rpc: PluginCommandCapabilities["rpc"];
|
|
32
|
+
}
|
|
33
|
+
/** Borrow the same runtime plugin's current online installation. Reacquire for each operation. */
|
|
34
|
+
export declare function getPluginClient(serverId: string): PluginHostClient;
|
|
35
|
+
/** The app's display language as a BCP 47 tag, such as "en" or "zh-CN". */
|
|
36
|
+
export declare function useLocale(): string;
|
|
37
|
+
/** Open an absolute HTTP(S) URL using the client platform’s external opener. */
|
|
38
|
+
export declare function openExternalUrl(url: string): Promise<void>;
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MateoApi } from "@getmateo/client";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
export declare function useMateoContextValue(): MateoApi | null;
|
|
4
|
+
export declare function MateoApiProvider({ children, mateo }: {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
mateo: MateoApi;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
export declare function useMateo(): MateoApi;
|
|
9
|
+
//# sourceMappingURL=mateo-context.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
const MateoApiContext = createContext(null);
|
|
4
|
+
export function useMateoContextValue() {
|
|
5
|
+
return useContext(MateoApiContext);
|
|
6
|
+
}
|
|
7
|
+
export function MateoApiProvider({ children, mateo }) {
|
|
8
|
+
return _jsx(MateoApiContext.Provider, { value: mateo, children: children });
|
|
9
|
+
}
|
|
10
|
+
export function useMateo() {
|
|
11
|
+
const mateo = useMateoContextValue();
|
|
12
|
+
if (!mateo)
|
|
13
|
+
throw new Error("useMateo must run inside a contributed plugin surface");
|
|
14
|
+
return mateo;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=mateo-context.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A menu row Mateo draws for a plugin. Mateo owns presentation (popover on wide layouts, sheet on
|
|
3
|
+
* compact ones), focus, and closing; the plugin owns the callbacks.
|
|
4
|
+
*/
|
|
5
|
+
export type PluginMenuEntry = PluginMenuSeparator | PluginMenuItem | PluginMenuSubmenu | PluginMenuPrompt;
|
|
6
|
+
export interface PluginMenuSeparator {
|
|
7
|
+
kind: "separator";
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
interface PluginMenuRowBase {
|
|
11
|
+
/** Unique among its siblings. */
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
/** Lucide icon name. */
|
|
15
|
+
icon?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
testID?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Runs `onSelect` and closes the menu. */
|
|
20
|
+
export interface PluginMenuItem extends PluginMenuRowBase {
|
|
21
|
+
kind: "item";
|
|
22
|
+
/** Draws a check: this row is the chosen value. */
|
|
23
|
+
selected?: boolean;
|
|
24
|
+
onSelect(): void;
|
|
25
|
+
}
|
|
26
|
+
/** Opens a page of further entries. `value` shows the current choice beside the title. */
|
|
27
|
+
export interface PluginMenuSubmenu extends PluginMenuRowBase {
|
|
28
|
+
kind: "submenu";
|
|
29
|
+
value?: string;
|
|
30
|
+
entries: readonly PluginMenuEntry[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Opens a page with one text field and a submit row. Submitting trims the text, ignores blank
|
|
34
|
+
* input, calls `onSubmit`, and closes the menu.
|
|
35
|
+
*/
|
|
36
|
+
export interface PluginMenuPrompt extends PluginMenuRowBase {
|
|
37
|
+
kind: "prompt";
|
|
38
|
+
submitLabel: string;
|
|
39
|
+
/** Also the field's accessibility label. */
|
|
40
|
+
placeholder: string;
|
|
41
|
+
initialValue?: string;
|
|
42
|
+
onSubmit(value: string): void;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ComponentType, FunctionComponent, ReactNode, ForwardRefExoticComponent, RefAttributes, ReactElement, Ref } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle, ScrollView as NativeScrollView, ScrollViewProps, FlatList as NativeFlatList, FlatListProps, TextInput as NativeTextInput, TextInputProps } from "react-native";
|
|
3
|
+
import type { PluginIconProps } from "./contracts.js";
|
|
4
|
+
export interface ModalProps {
|
|
5
|
+
title: string;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
open: boolean;
|
|
8
|
+
onOpenChange(open: boolean): void;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface ModalContentProps {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/** Paint the full body below the header. */
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
/** Overrides the default 24px padding and 16px gap. Safe-area clearance stays host-owned. */
|
|
16
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
17
|
+
/** Default true. Set false for a bounded body with your own ScrollView or FlatList. */
|
|
18
|
+
scrollable?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ModalComponent extends FunctionComponent<ModalProps> {
|
|
21
|
+
Content: ComponentType<ModalContentProps>;
|
|
22
|
+
}
|
|
23
|
+
export type ToastVariant = "default" | "info" | "success" | "warning" | "error";
|
|
24
|
+
export interface ToastOptions {
|
|
25
|
+
variant?: ToastVariant;
|
|
26
|
+
durationMs?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface ToastApi {
|
|
29
|
+
show(message: string, options?: ToastOptions): void;
|
|
30
|
+
error(message: string): void;
|
|
31
|
+
}
|
|
32
|
+
export interface TooltipProps {
|
|
33
|
+
/** Plain text shown on hover. Desktop web only; touch layouts render just the children. */
|
|
34
|
+
content: string;
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
export declare const Icon: ComponentType<PluginIconProps>;
|
|
38
|
+
/** Wraps non-interactive content; presses still reach the row or button around it. */
|
|
39
|
+
export declare const Tooltip: ComponentType<TooltipProps>;
|
|
40
|
+
export declare const Modal: ModalComponent;
|
|
41
|
+
export declare function useToast(): ToastApi;
|
|
42
|
+
export declare function useRevealedText(text: string, phase: "streaming" | "complete"): string;
|
|
43
|
+
export type { PluginIconProps } from "./contracts.js";
|
|
44
|
+
/** React Native scrolling with the host's sheet gestures when rendered inside a sheet. */
|
|
45
|
+
export declare const ScrollView: ForwardRefExoticComponent<ScrollViewProps & RefAttributes<NativeScrollView>>;
|
|
46
|
+
export declare function FlatList<Item>(props: FlatListProps<Item> & {
|
|
47
|
+
ref?: Ref<NativeFlatList<Item>>;
|
|
48
|
+
}): ReactElement;
|
|
49
|
+
/** Copies text to this client's clipboard. Rejects when copying is unavailable or denied. */
|
|
50
|
+
export declare function copyText(text: string): Promise<void>;
|
|
51
|
+
/** Native input focus integrated with modal keyboard positioning. */
|
|
52
|
+
export declare const TextInput: ForwardRefExoticComponent<TextInputProps & RefAttributes<NativeTextInput>>;
|
|
53
|
+
//# sourceMappingURL=react-native.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
|
|
3
|
+
import { type PluginRpcContract } from "../rpc.js";
|
|
4
|
+
export interface PluginRpcContextValue {
|
|
5
|
+
invoke(method: string, input: unknown): Promise<unknown>;
|
|
6
|
+
}
|
|
7
|
+
export declare function usePluginRpcContextValue(): PluginRpcContextValue | null;
|
|
8
|
+
export declare function PluginRpcProvider({ children, invoke, }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
invoke(method: string, input: unknown): Promise<unknown>;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
export declare function useRpc<InputSchema extends ZodType, OutputSchema extends ZodType>(contract: PluginRpcContract<InputSchema, OutputSchema>): (input: ZodInput<InputSchema>) => Promise<ZodOutput<OutputSchema>>;
|
|
13
|
+
//# sourceMappingURL=rpc-context.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo } from "react";
|
|
3
|
+
import { callPluginRpc } from "../rpc.js";
|
|
4
|
+
const PluginRpcContext = createContext(null);
|
|
5
|
+
export function usePluginRpcContextValue() {
|
|
6
|
+
return useContext(PluginRpcContext);
|
|
7
|
+
}
|
|
8
|
+
export function PluginRpcProvider({ children, invoke, }) {
|
|
9
|
+
const value = useMemo(() => ({ invoke }), [invoke]);
|
|
10
|
+
return _jsx(PluginRpcContext.Provider, { value: value, children: children });
|
|
11
|
+
}
|
|
12
|
+
export function useRpc(contract) {
|
|
13
|
+
const context = usePluginRpcContextValue();
|
|
14
|
+
if (!context)
|
|
15
|
+
throw new Error("useRpc must run inside a contributed plugin surface");
|
|
16
|
+
return useCallback((input) => callPluginRpc(contract, context.invoke, input), [context, contract]);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=rpc-context.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type PluginRuntimeContextBridge = (children: ReactNode) => ReactNode;
|
|
3
|
+
/** Rebuilds plugin runtime contexts inside React Native portal hosts. */
|
|
4
|
+
export declare function usePluginRuntimeContextBridge(): PluginRuntimeContextBridge;
|
|
5
|
+
//# sourceMappingURL=runtime-context-bridge.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { PluginClientStateProvider, usePluginClientStateSource } from "./client-state.js";
|
|
4
|
+
import { MateoApiProvider, useMateoContextValue } from "./mateo-context.js";
|
|
5
|
+
import { PluginRpcProvider, usePluginRpcContextValue } from "./rpc-context.js";
|
|
6
|
+
/** Rebuilds plugin runtime contexts inside React Native portal hosts. */
|
|
7
|
+
export function usePluginRuntimeContextBridge() {
|
|
8
|
+
const mateo = useMateoContextValue();
|
|
9
|
+
const rpc = usePluginRpcContextValue();
|
|
10
|
+
const state = usePluginClientStateSource();
|
|
11
|
+
if (!mateo || !rpc) {
|
|
12
|
+
throw new Error("Plugin UI must run inside a contributed plugin surface");
|
|
13
|
+
}
|
|
14
|
+
return useCallback((children) => {
|
|
15
|
+
const content = state ? (_jsx(PluginClientStateProvider, { source: state, children: children })) : (children);
|
|
16
|
+
return (_jsx(MateoApiProvider, { mateo: mateo, children: _jsx(PluginRpcProvider, { invoke: rpc.invoke, children: content }) }));
|
|
17
|
+
}, [mateo, rpc, state]);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=runtime-context-bridge.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { PluginHostProps } from "./contracts.js";
|
|
3
|
+
/** Settings pages that take plugin sections. Mateo addition. */
|
|
4
|
+
export type PluginSettingsSectionPage = "plugins";
|
|
5
|
+
export interface PluginSettingsSectionContribution {
|
|
6
|
+
id: string;
|
|
7
|
+
/** The page the section renders on, below the host's own sections, for this host only. */
|
|
8
|
+
page: PluginSettingsSectionPage;
|
|
9
|
+
/** Renders whole sections: use `SettingsSection` and `SettingsCard` from `/client/ui`. */
|
|
10
|
+
Component: ComponentType<PluginHostProps>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=settings-sections.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
function isIterable(value) {
|
|
2
|
+
return Symbol.iterator in value;
|
|
3
|
+
}
|
|
4
|
+
function hasEntries(value) {
|
|
5
|
+
return "entries" in value;
|
|
6
|
+
}
|
|
7
|
+
function compareEntries(left, right) {
|
|
8
|
+
const leftEntries = left instanceof Map ? left : new Map(left.entries());
|
|
9
|
+
const rightEntries = right instanceof Map ? right : new Map(right.entries());
|
|
10
|
+
if (leftEntries.size !== rightEntries.size)
|
|
11
|
+
return false;
|
|
12
|
+
for (const [key, value] of leftEntries) {
|
|
13
|
+
if (!rightEntries.has(key) || !Object.is(value, rightEntries.get(key)))
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
function compareIterables(left, right) {
|
|
19
|
+
const leftIterator = left[Symbol.iterator]();
|
|
20
|
+
const rightIterator = right[Symbol.iterator]();
|
|
21
|
+
let leftValue = leftIterator.next();
|
|
22
|
+
let rightValue = rightIterator.next();
|
|
23
|
+
while (!leftValue.done && !rightValue.done) {
|
|
24
|
+
if (!Object.is(leftValue.value, rightValue.value))
|
|
25
|
+
return false;
|
|
26
|
+
leftValue = leftIterator.next();
|
|
27
|
+
rightValue = rightIterator.next();
|
|
28
|
+
}
|
|
29
|
+
return Boolean(leftValue.done && rightValue.done);
|
|
30
|
+
}
|
|
31
|
+
export function shallowEqual(left, right) {
|
|
32
|
+
if (Object.is(left, right))
|
|
33
|
+
return true;
|
|
34
|
+
if (!left || !right || typeof left !== "object" || typeof right !== "object")
|
|
35
|
+
return false;
|
|
36
|
+
if (Object.getPrototypeOf(left) !== Object.getPrototypeOf(right))
|
|
37
|
+
return false;
|
|
38
|
+
if (isIterable(left) && isIterable(right)) {
|
|
39
|
+
if (hasEntries(left) && hasEntries(right))
|
|
40
|
+
return compareEntries(left, right);
|
|
41
|
+
return compareIterables(left, right);
|
|
42
|
+
}
|
|
43
|
+
return compareEntries({ entries: () => Object.entries(left) }, { entries: () => Object.entries(right) });
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=shallow.js.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { PluginHostProps } from "./contracts.js";
|
|
3
|
+
import type { PluginMenuEntry } from "./menu.js";
|
|
4
|
+
import type { SidebarGroupAddProject, SidebarGroupCreateWorkspace } from "./ui.js";
|
|
5
|
+
/** A host-local project merged into a sidebar project row. */
|
|
6
|
+
export interface PluginSidebarProjectHostRef {
|
|
7
|
+
serverId: string;
|
|
8
|
+
projectId: string;
|
|
9
|
+
}
|
|
10
|
+
/** A project row in the sidebar, possibly merged from several hosts. */
|
|
11
|
+
export interface PluginSidebarProject {
|
|
12
|
+
/**
|
|
13
|
+
* The row's identity across hosts. It follows the project's grouping key, so it can change, for
|
|
14
|
+
* example when the git remote changes; `hosts` refs survive that but not the host going away.
|
|
15
|
+
*/
|
|
16
|
+
key: string;
|
|
17
|
+
name: string;
|
|
18
|
+
hosts: readonly PluginSidebarProjectHostRef[];
|
|
19
|
+
}
|
|
20
|
+
export interface PluginSidebarProjectGroup {
|
|
21
|
+
/** Unique within the grouping. */
|
|
22
|
+
id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
/** `PluginSidebarProject.key`s in this group. A key in no group stays at the root. */
|
|
25
|
+
projectKeys: readonly string[];
|
|
26
|
+
/** A collapsed group renders only its header. */
|
|
27
|
+
collapsed: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface PluginSidebarProjectGroupHeaderProps extends PluginHostProps {
|
|
30
|
+
group: PluginSidebarProjectGroup;
|
|
31
|
+
/** Position among the groups, from 0. */
|
|
32
|
+
index: number;
|
|
33
|
+
/** Number of groups. */
|
|
34
|
+
count: number;
|
|
35
|
+
/** Pass to `SidebarGroupHeader` to add a project to this group. Available when onMoveProject is provided. */
|
|
36
|
+
addProject?: SidebarGroupAddProject;
|
|
37
|
+
/** Pass to `SidebarGroupHeader` to offer workspace creation within this group. */
|
|
38
|
+
createWorkspace?: SidebarGroupCreateWorkspace;
|
|
39
|
+
/** A visible, unpinned workspace needs attention, whether expanded or collapsed. */
|
|
40
|
+
hasAttention?: boolean;
|
|
41
|
+
/** A visible, unpinned workspace has running agents, whether expanded or collapsed. Independent of attention. */
|
|
42
|
+
hasRunning?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/** A project the user dragged into a group, or out of every group. */
|
|
45
|
+
export interface PluginSidebarProjectMove {
|
|
46
|
+
project: PluginSidebarProject;
|
|
47
|
+
/** The group it was dropped in; null when dropped outside every group. */
|
|
48
|
+
toGroupId: string | null;
|
|
49
|
+
/** Its position among the target group's projects after the drop, from 0. */
|
|
50
|
+
index: number;
|
|
51
|
+
}
|
|
52
|
+
/** A menu beside the sidebar's section header, such as a "New folder" action. */
|
|
53
|
+
export interface PluginSidebarProjectGroupingActions {
|
|
54
|
+
/** Trigger tooltip and accessibility label. */
|
|
55
|
+
label: string;
|
|
56
|
+
/** Lucide icon name for the trigger. */
|
|
57
|
+
icon?: string;
|
|
58
|
+
entries: readonly PluginMenuEntry[];
|
|
59
|
+
}
|
|
60
|
+
export interface PluginSidebarProjectGroupingActionsInput {
|
|
61
|
+
/** The app's display language, such as "en" or "zh-CN". */
|
|
62
|
+
locale: string;
|
|
63
|
+
/** Whether Mateo mounts the grouping's companion content beside its actions. */
|
|
64
|
+
supportsContent?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface PluginSidebarProjectGroupingContentProps extends PluginHostProps {
|
|
67
|
+
/**
|
|
68
|
+
* Applies a one-time project order. Only the listed projects' slots change; unlisted projects
|
|
69
|
+
* keep their positions, and missing slots are appended. Later manual drags replace this order.
|
|
70
|
+
* Undefined on app versions without project ordering support.
|
|
71
|
+
*/
|
|
72
|
+
reorderProjects?(projectKeys: readonly string[]): void;
|
|
73
|
+
}
|
|
74
|
+
export interface PluginSidebarProjectGroupingContribution {
|
|
75
|
+
id: string;
|
|
76
|
+
/**
|
|
77
|
+
* Groups the sidebar's projects, in render order. Must be synchronous and free of side effects:
|
|
78
|
+
* Mateo calls it while rendering, again whenever `subscribe` notifies or the projects change.
|
|
79
|
+
*/
|
|
80
|
+
group(projects: readonly PluginSidebarProject[]): readonly PluginSidebarProjectGroup[];
|
|
81
|
+
/** Called after the project list changes, with every project before sidebar filters. */
|
|
82
|
+
onProjectsChange?(projects: readonly PluginSidebarProject[]): void;
|
|
83
|
+
/** Notifies Mateo that `group` would return something new. Returns an unsubscribe function. */
|
|
84
|
+
subscribe?(onChange: () => void): () => void;
|
|
85
|
+
/** Renders each group's header row. Use `SidebarGroupHeader` from `@getmateo/plugin/client/ui`. */
|
|
86
|
+
Header: ComponentType<PluginSidebarProjectGroupHeaderProps>;
|
|
87
|
+
/** Companion content mounted beside the grouping actions, such as a modal. */
|
|
88
|
+
Content?: ComponentType<PluginSidebarProjectGroupingContentProps>;
|
|
89
|
+
/**
|
|
90
|
+
* Lets the user drag a project across groups; without it a drag only reorders within a group.
|
|
91
|
+
* Mateo keeps the project order itself; the plugin records the new group membership.
|
|
92
|
+
* Return a promise when persistence is asynchronous. Add Project awaits it before completing.
|
|
93
|
+
*/
|
|
94
|
+
onMoveProject?(move: PluginSidebarProjectMove): void | Promise<void>;
|
|
95
|
+
/** A menu Mateo renders beside the sidebar's section header. Synchronous, like `group`. */
|
|
96
|
+
actions?(input: PluginSidebarProjectGroupingActionsInput): PluginSidebarProjectGroupingActions | null;
|
|
97
|
+
}
|
|
98
|
+
export interface PluginSidebarProjectMenuInput {
|
|
99
|
+
project: PluginSidebarProject;
|
|
100
|
+
/** The app's display language, such as "en" or "zh-CN". */
|
|
101
|
+
locale: string;
|
|
102
|
+
}
|
|
103
|
+
export interface PluginSidebarProjectMenuContribution {
|
|
104
|
+
id: string;
|
|
105
|
+
/** Rows added to the project's menu. Synchronous; Mateo calls it while rendering. */
|
|
106
|
+
entries(input: PluginSidebarProjectMenuInput): readonly PluginMenuEntry[];
|
|
107
|
+
/** Notifies Mateo that `entries` would return something new. Returns an unsubscribe function. */
|
|
108
|
+
subscribe?(onChange: () => void): () => void;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=sidebar-projects.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { PluginAgentSnapshot, PluginWorkspaceSnapshot } from "../contracts.js";
|
|
3
|
+
import type { PluginHostProps } from "./contracts.js";
|
|
4
|
+
export interface PluginSidebarWorkspaceAccessoryProps extends PluginHostProps {
|
|
5
|
+
workspace: PluginWorkspaceSnapshot;
|
|
6
|
+
/** The workspace's agents, archived ones excluded, in no particular order. */
|
|
7
|
+
agents: readonly PluginAgentSnapshot[];
|
|
8
|
+
}
|
|
9
|
+
export interface PluginSidebarWorkspaceAccessoryContribution {
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* Renders beside a workspace row's title, left of its trailing slot. Keep it to one line of
|
|
13
|
+
* small text or an icon, and render nothing when there is nothing to say.
|
|
14
|
+
*/
|
|
15
|
+
Component: ComponentType<PluginSidebarWorkspaceAccessoryProps>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=sidebar-workspaces.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device-local string storage. Keys are scoped to the plugin ID, so the plugin's installations on
|
|
3
|
+
* every host share them, and nothing reaches a daemon.
|
|
4
|
+
*/
|
|
5
|
+
export interface PluginClientStorage {
|
|
6
|
+
getItem(key: string): Promise<string | null>;
|
|
7
|
+
setItem(key: string, value: string): Promise<void>;
|
|
8
|
+
removeItem(key: string): Promise<void>;
|
|
9
|
+
/** Runs after any installation of this plugin on this device writes `key`. */
|
|
10
|
+
subscribe(key: string, listener: (value: string | null) => void): () => void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Hex colors in xterm's theme vocabulary. */
|
|
2
|
+
export interface PluginTerminalThemeColors {
|
|
3
|
+
background: string;
|
|
4
|
+
foreground: string;
|
|
5
|
+
cursor?: string;
|
|
6
|
+
cursorAccent?: string;
|
|
7
|
+
selectionBackground?: string;
|
|
8
|
+
selectionForeground?: string;
|
|
9
|
+
black: string;
|
|
10
|
+
red: string;
|
|
11
|
+
green: string;
|
|
12
|
+
yellow: string;
|
|
13
|
+
blue: string;
|
|
14
|
+
magenta: string;
|
|
15
|
+
cyan: string;
|
|
16
|
+
white: string;
|
|
17
|
+
brightBlack: string;
|
|
18
|
+
brightRed: string;
|
|
19
|
+
brightGreen: string;
|
|
20
|
+
brightYellow: string;
|
|
21
|
+
brightBlue: string;
|
|
22
|
+
brightMagenta: string;
|
|
23
|
+
brightCyan: string;
|
|
24
|
+
brightWhite: string;
|
|
25
|
+
}
|
|
26
|
+
export interface PluginTerminalThemeContribution {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
colors: PluginTerminalThemeColors;
|
|
30
|
+
/** Use this scheme for the appearance until the user picks one. */
|
|
31
|
+
defaultFor?: "light" | "dark";
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=terminal-themes.d.ts.map
|