@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.
Files changed (67) hide show
  1. package/LICENSE +211 -0
  2. package/dist/attachments.d.ts +26 -0
  3. package/dist/attachments.js +17 -0
  4. package/dist/client/buttons.d.ts +64 -0
  5. package/dist/client/buttons.js +2 -0
  6. package/dist/client/client-state.d.ts +15 -0
  7. package/dist/client/client-state.js +32 -0
  8. package/dist/client/contracts.d.ts +299 -0
  9. package/dist/client/contracts.js +2 -0
  10. package/dist/client/host.d.ts +19 -0
  11. package/dist/client/host.js +12 -0
  12. package/dist/client/index.d.ts +39 -0
  13. package/dist/client/index.js +4 -0
  14. package/dist/client/mateo-context.d.ts +9 -0
  15. package/dist/client/mateo-context.js +16 -0
  16. package/dist/client/menu.d.ts +45 -0
  17. package/dist/client/menu.js +2 -0
  18. package/dist/client/react-native.d.ts +53 -0
  19. package/dist/client/react-native.js +2 -0
  20. package/dist/client/rpc-context.d.ts +13 -0
  21. package/dist/client/rpc-context.js +18 -0
  22. package/dist/client/runtime-context-bridge.d.ts +5 -0
  23. package/dist/client/runtime-context-bridge.js +19 -0
  24. package/dist/client/settings-sections.d.ts +12 -0
  25. package/dist/client/settings-sections.js +2 -0
  26. package/dist/client/shallow.d.ts +2 -0
  27. package/dist/client/shallow.js +45 -0
  28. package/dist/client/sidebar-projects.d.ts +110 -0
  29. package/dist/client/sidebar-projects.js +2 -0
  30. package/dist/client/sidebar-workspaces.d.ts +17 -0
  31. package/dist/client/sidebar-workspaces.js +2 -0
  32. package/dist/client/storage.d.ts +12 -0
  33. package/dist/client/storage.js +2 -0
  34. package/dist/client/terminal-themes.d.ts +33 -0
  35. package/dist/client/terminal-themes.js +2 -0
  36. package/dist/client/ui.d.ts +161 -0
  37. package/dist/client/ui.js +2 -0
  38. package/dist/contracts.d.ts +90 -0
  39. package/dist/contracts.js +2 -0
  40. package/dist/index.d.ts +7 -0
  41. package/dist/index.js +5 -0
  42. package/dist/rpc.d.ts +17 -0
  43. package/dist/rpc.js +12 -0
  44. package/dist/server/acp-internal/connection.d.ts +4 -0
  45. package/dist/server/acp-internal/connection.js +1301 -0
  46. package/dist/server/acp.d.ts +112 -0
  47. package/dist/server/acp.js +22 -0
  48. package/dist/server/contracts.d.ts +81 -0
  49. package/dist/server/contracts.js +2 -0
  50. package/dist/server/index.d.ts +6 -0
  51. package/dist/server/index.js +2 -0
  52. package/dist/server/lifecycle.d.ts +99 -0
  53. package/dist/server/lifecycle.js +2 -0
  54. package/dist/server/models.d.ts +55 -0
  55. package/dist/server/models.js +2 -0
  56. package/dist/server/process-internal/windows-command.d.ts +15 -0
  57. package/dist/server/process-internal/windows-command.js +41 -0
  58. package/dist/server/process.d.ts +25 -0
  59. package/dist/server/process.js +71 -0
  60. package/dist/server/provider.d.ts +735 -0
  61. package/dist/server/provider.js +871 -0
  62. package/dist/server/usage.d.ts +149 -0
  63. package/dist/server/usage.js +134 -0
  64. package/dist/settings.d.ts +70 -0
  65. package/dist/settings.js +40 -0
  66. package/package.json +99 -4
  67. package/README.md +0 -3
@@ -0,0 +1,161 @@
1
+ import type { ComponentType, ReactNode, Ref } from "react";
2
+ import type { PluginMenuEntry } from "./menu.js";
3
+ export interface SettingsSectionProps {
4
+ title: string;
5
+ info?: ReactNode;
6
+ trailing?: ReactNode;
7
+ children: ReactNode;
8
+ testID?: string;
9
+ }
10
+ export interface SettingsRowProps {
11
+ label: string;
12
+ hint?: string;
13
+ error?: string | null;
14
+ children?: ReactNode;
15
+ testID?: string;
16
+ }
17
+ export interface SettingsSwitchProps extends SettingsRowProps {
18
+ value: boolean;
19
+ onValueChange(value: boolean): void;
20
+ disabled?: boolean;
21
+ }
22
+ export interface SettingsCheckboxProps extends SettingsRowProps {
23
+ value: boolean;
24
+ onValueChange(value: boolean): void;
25
+ disabled?: boolean;
26
+ }
27
+ export interface SettingsSelectProps<Value extends string = string> extends SettingsRowProps {
28
+ value: Value;
29
+ options: readonly {
30
+ label: string;
31
+ value: Value;
32
+ }[];
33
+ onValueChange(value: Value): void;
34
+ disabled?: boolean;
35
+ }
36
+ export interface SettingsInputHandle {
37
+ focus(): void;
38
+ blur(): void;
39
+ getText(): string;
40
+ replaceText(text: string): void;
41
+ }
42
+ export interface SettingsInputProps extends SettingsRowProps {
43
+ initialValue?: string;
44
+ onChangeText(text: string): void;
45
+ placeholder?: string;
46
+ disabled?: boolean;
47
+ secureTextEntry?: boolean;
48
+ ref?: Ref<SettingsInputHandle>;
49
+ }
50
+ export interface SettingsActionProps extends SettingsRowProps {
51
+ actionLabel: string;
52
+ onPress(): void;
53
+ disabled?: boolean;
54
+ }
55
+ export declare const SettingsGroup: ComponentType<SettingsSectionProps>;
56
+ export declare const SettingsSection: ComponentType<SettingsSectionProps>;
57
+ export declare const SettingsCard: ComponentType<{
58
+ children: ReactNode;
59
+ testID?: string;
60
+ }>;
61
+ export declare const SettingsRow: ComponentType<SettingsRowProps>;
62
+ export declare const SettingsSwitch: ComponentType<SettingsSwitchProps>;
63
+ export declare const SettingsCheckbox: ComponentType<SettingsCheckboxProps>;
64
+ export declare function SettingsSelect<Value extends string>(props: SettingsSelectProps<Value>): ReactNode;
65
+ export declare const SettingsInput: ComponentType<SettingsInputProps>;
66
+ export declare const SettingsAction: ComponentType<SettingsActionProps>;
67
+ export interface ExternalLinkProps {
68
+ href: string;
69
+ children: ReactNode;
70
+ accessibilityLabel?: string;
71
+ testID?: string;
72
+ onError?: (error: unknown) => void;
73
+ }
74
+ export declare const ExternalLink: ComponentType<ExternalLinkProps>;
75
+ export type SidebarIcon = string | ComponentType<{
76
+ size: number;
77
+ color: string;
78
+ }>;
79
+ export interface SidebarRowProps {
80
+ /**
81
+ * Tells rows of one item apart when the item renders several: "bot-2". Unique within the item.
82
+ * Omit it when the item renders one row.
83
+ */
84
+ id?: string;
85
+ /** A Lucide icon name or a component. */
86
+ icon?: SidebarIcon;
87
+ /** Defaults to the item's registered title. */
88
+ label?: string;
89
+ onPress(): void;
90
+ active?: boolean;
91
+ /** Right slot. Renders beside the row's pressable, so a button here presses on its own. */
92
+ trailing?: ReactNode;
93
+ }
94
+ /** A sidebar navigation row. Render it from a sidebar item's `Component`. */
95
+ export declare const SidebarRow: ComponentType<SidebarRowProps>;
96
+ /** A line between groups of rows. Render it from a sidebar item's `Component`. */
97
+ export declare const SidebarSeparator: ComponentType;
98
+ export interface TerminalViewProps {
99
+ serverId: string;
100
+ terminalId: string;
101
+ /** The terminal's working directory, as the daemon reported it. */
102
+ cwd: string;
103
+ /** Whether the terminal takes keyboard focus. Defaults to true. */
104
+ focused?: boolean;
105
+ }
106
+ /** The app's terminal for a running terminal on `serverId`, with the user's terminal theme. */
107
+ export declare const TerminalView: ComponentType<TerminalViewProps>;
108
+ export interface SidebarGroupHeaderMenu {
109
+ /** Sheet title on compact layouts. */
110
+ title: string;
111
+ accessibilityLabel: string;
112
+ entries: readonly PluginMenuEntry[];
113
+ }
114
+ export type SidebarGroupCreateWorkspace = {
115
+ kind: "disabled";
116
+ label: string;
117
+ reason: string;
118
+ } | {
119
+ kind: "direct";
120
+ label: string;
121
+ onPress(): void;
122
+ } | {
123
+ kind: "menu";
124
+ label: string;
125
+ menu: SidebarGroupHeaderMenu;
126
+ };
127
+ export interface SidebarGroupAddProject {
128
+ kind: "direct";
129
+ label: string;
130
+ onPress(): void;
131
+ }
132
+ export interface SidebarGroupHeaderProps {
133
+ label: string;
134
+ description?: string;
135
+ /** Opens Add Project and assigns its successful result to this group. Takes precedence over createWorkspace. */
136
+ addProject?: SidebarGroupAddProject;
137
+ /** Host-owned workspace action scoped to existing projects in this group. */
138
+ createWorkspace?: SidebarGroupCreateWorkspace;
139
+ collapsed: boolean;
140
+ /** Shows a green center whether expanded or collapsed, independently of running. */
141
+ hasAttention?: boolean;
142
+ /** Shows the blue running ring whether expanded or collapsed; attention keeps its green center. */
143
+ hasRunning?: boolean;
144
+ onToggle(): void;
145
+ /** A Lucide icon name or a component. Hovering swaps it for a chevron. */
146
+ icon?: SidebarIcon;
147
+ /** Shown instead of `icon` while expanded. */
148
+ expandedIcon?: SidebarIcon;
149
+ /** A kebab menu beside the label, always visible on touch layouts and on hover elsewhere. */
150
+ menu?: SidebarGroupHeaderMenu;
151
+ /** Test ID suffix: `sidebar-group-<id>` for the row, `sidebar-group-<id>-menu` for the kebab. */
152
+ id?: string;
153
+ }
154
+ /** The header of a project group. Render it from a sidebar project grouping's `Header`. */
155
+ export declare const SidebarGroupHeader: ComponentType<SidebarGroupHeaderProps>;
156
+ export interface MarkdownProps {
157
+ children: string;
158
+ }
159
+ /** Renders Markdown using Mateo’s theme, selection, and link behavior. */
160
+ export declare const Markdown: ComponentType<MarkdownProps>;
161
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ui.js.map
@@ -0,0 +1,90 @@
1
+ import type { JsonValue } from "@getmateo/protocol/agent-types";
2
+ import type { PluginRpcContract } from "./rpc.js";
3
+ export interface PluginTheme {
4
+ readonly colors: {
5
+ readonly surface0: string;
6
+ readonly surface1: string;
7
+ readonly surface2: string;
8
+ readonly border: string;
9
+ readonly foreground: string;
10
+ readonly foregroundMuted: string;
11
+ readonly accent: string;
12
+ readonly accentForeground: string;
13
+ readonly statusSuccess: string;
14
+ readonly statusWarning: string;
15
+ readonly statusDanger: string;
16
+ };
17
+ }
18
+ export interface PluginWorkspaceSnapshot {
19
+ readonly id: string;
20
+ readonly projectId: string;
21
+ readonly projectDisplayName: string;
22
+ readonly projectRootPath: string;
23
+ readonly directory: string;
24
+ readonly projectKind: "git" | "non_git" | "directory";
25
+ readonly kind: "directory" | "local_checkout" | "checkout" | "worktree";
26
+ readonly name: string;
27
+ readonly title: string | null;
28
+ readonly status: "needs_input" | "failed" | "running" | "attention" | "done";
29
+ readonly statusEnteredAt: string | null;
30
+ readonly archivingAt: string | null;
31
+ readonly diffStat: {
32
+ readonly additions: number;
33
+ readonly deletions: number;
34
+ } | null;
35
+ }
36
+ export interface PluginAgentSnapshot {
37
+ readonly id: string;
38
+ readonly workspaceId: string;
39
+ readonly provider: string;
40
+ readonly status: "initializing" | "idle" | "running" | "error" | "closed";
41
+ readonly createdAt: string;
42
+ readonly updatedAt: string;
43
+ readonly lastActivityAt: string;
44
+ readonly title: string | null;
45
+ readonly cwd: string;
46
+ readonly model: string | null;
47
+ readonly currentModeId: string | null;
48
+ readonly thinkingOptionId: string | null;
49
+ readonly requiresAttention: boolean;
50
+ readonly attentionReason: "finished" | "error" | "permission" | null;
51
+ readonly parentAgentId: string | null;
52
+ readonly labels: Readonly<Record<string, string>>;
53
+ }
54
+ export interface PluginThemeColors {
55
+ background: string;
56
+ foreground: string;
57
+ raised: string;
58
+ control: string;
59
+ border: string;
60
+ accent?: string;
61
+ mutedForeground: string;
62
+ ring: string;
63
+ }
64
+ export interface PluginThemeContribution {
65
+ id: string;
66
+ name: string;
67
+ appearance: "light" | "dark";
68
+ colors: PluginThemeColors;
69
+ }
70
+ export interface PluginAttachmentSourceContribution {
71
+ id: string;
72
+ title: string;
73
+ icon: string;
74
+ pickerTitle: string;
75
+ searchPlaceholder: string;
76
+ search: PluginRpcContract;
77
+ }
78
+ export type PluginTimelineData = JsonValue;
79
+ export interface PluginTimelineItem {
80
+ type: "plugin";
81
+ id?: string;
82
+ kind: string;
83
+ version: number;
84
+ data: PluginTimelineData;
85
+ }
86
+ export interface PluginTimelineTransformResult {
87
+ items: PluginTimelineItem[];
88
+ }
89
+ export type PluginCleanup = () => void | Promise<void>;
90
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1,7 @@
1
+ export type { PluginTheme, PluginWorkspaceSnapshot, PluginAgentSnapshot, PluginThemeColors, PluginThemeContribution, PluginAttachmentSourceContribution, PluginTimelineData, PluginTimelineItem, PluginTimelineTransformResult, PluginCleanup, } from "./contracts.js";
2
+ export { defineSettings, settingsRpc, type SettingsDefinition } from "./settings.js";
3
+ export { defineAttachmentSource, PluginAttachmentItemSchema, PluginAttachmentSearchPayloadSchema, type PluginAttachmentItem, type PluginAttachmentSearchPayload, } from "./attachments.js";
4
+ export { defineRpc, type PluginRpcContract, type RpcInput, type RpcOutput } from "./rpc.js";
5
+ export type { BrowserDownloadReceipt } from "@getmateo/protocol/browser-automation/rpc-schemas";
6
+ export { parseGitRemoteLocation } from "@getmateo/protocol/git-remote";
7
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { defineSettings, settingsRpc } from "./settings.js";
2
+ export { defineAttachmentSource, PluginAttachmentItemSchema, PluginAttachmentSearchPayloadSchema, } from "./attachments.js";
3
+ export { defineRpc } from "./rpc.js";
4
+ export { parseGitRemoteLocation } from "@getmateo/protocol/git-remote";
5
+ //# sourceMappingURL=index.js.map
package/dist/rpc.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
2
+ export interface PluginRpcContract<InputSchema extends ZodType = ZodType, OutputSchema extends ZodType = ZodType> {
3
+ name: string;
4
+ input: InputSchema;
5
+ output: OutputSchema;
6
+ }
7
+ export type RpcInput<Contract extends PluginRpcContract> = ZodOutput<Contract["input"]>;
8
+ export type RpcOutput<Contract extends PluginRpcContract> = ZodInput<Contract["output"]>;
9
+ interface RpcDefinition<InputSchema extends ZodType, OutputSchema extends ZodType> {
10
+ name: string;
11
+ input: InputSchema;
12
+ output: OutputSchema;
13
+ }
14
+ export declare function defineRpc<InputSchema extends ZodType, OutputSchema extends ZodType>(definition: RpcDefinition<InputSchema, OutputSchema>): PluginRpcContract<InputSchema, OutputSchema>;
15
+ export declare function callPluginRpc<InputSchema extends ZodType, OutputSchema extends ZodType>(contract: PluginRpcContract<InputSchema, OutputSchema>, invoke: (method: string, input: unknown) => Promise<unknown>, input: ZodInput<InputSchema>): Promise<ZodOutput<OutputSchema>>;
16
+ export {};
17
+ //# sourceMappingURL=rpc.d.ts.map
package/dist/rpc.js ADDED
@@ -0,0 +1,12 @@
1
+ const RPC_NAME = /^[a-z][a-z0-9._-]*$/;
2
+ export function defineRpc(definition) {
3
+ const name = definition.name.trim();
4
+ if (!RPC_NAME.test(name))
5
+ throw new Error(`Invalid plugin RPC method: ${definition.name}`);
6
+ return { ...definition, name };
7
+ }
8
+ export async function callPluginRpc(contract, invoke, input) {
9
+ const output = await invoke(contract.name, input);
10
+ return contract.output.parseAsync(output);
11
+ }
12
+ //# sourceMappingURL=rpc.js.map
@@ -0,0 +1,4 @@
1
+ import type { RunAcpProviderOptions } from "../acp.js";
2
+ import { type ProviderConnectRequest, type ProviderConnection } from "../provider.js";
3
+ export declare function createAcpProviderConnection(options: RunAcpProviderOptions, request: ProviderConnectRequest): Promise<ProviderConnection>;
4
+ //# sourceMappingURL=connection.d.ts.map