@omercnet/paseo-omp 5.4.0-next.398.1 → 5.4.0-next.401.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OVERVIEW.md +1 -0
- package/client/lsp-diagnostics.tsx +69 -0
- package/client/omp-plugin-manager.tsx +198 -3
- package/index.client.tsx +21 -0
- package/index.server.ts +9 -0
- package/package.json +1 -1
- package/server/omp-plugins.ts +182 -0
- package/server/omp-settings.ts +3 -4
- package/server/package-version.ts +1 -1
- package/shared/lsp-diagnostics.ts +141 -0
- package/shared/omp-plugins.ts +90 -0
- package/shared/omp-settings.ts +4 -2
package/OVERVIEW.md
CHANGED
|
@@ -16,6 +16,7 @@ OMP adds an agent provider for the OMP coding agent, plus an OMP sidebar and wor
|
|
|
16
16
|
- An **MCP** composer control runs OMP's MCP management in the current session, with authorization prompts shown in the chat.
|
|
17
17
|
- While OMP subagents run, a row under each `task` card in the conversation lets you steer one with a message or stop it after confirmation. It needs OMP 18.4.9 or newer.
|
|
18
18
|
- When an OMP rule fires during a turn of an agent on Paseo's bundled `omp` provider, a notice under that turn names the rule and the text it matched. The plugin reads this, best effort, from the end of the agent's OMP session file, which that provider does not report.
|
|
19
|
+
- When an agent on Paseo's bundled `omp` provider calls OMP's `lsp` tool for diagnostics, the call shows as a card grouped by file with an icon per severity. Output the plugin does not recognize keeps the original row.
|
|
19
20
|
- OMP agents can call Paseo's orchestration tools with the optional `serverId` argument and `list_hosts` to delegate work to other connected Paseo hosts.
|
|
20
21
|
|
|
21
22
|
## Reads and sends
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { PluginTimelineItemProps } from "@getpaseo/plugin/client";
|
|
2
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
3
|
+
import { Text, View } from "react-native";
|
|
4
|
+
import type { OmpLspDiagnostics, OmpLspSeverity } from "../shared/lsp-diagnostics";
|
|
5
|
+
|
|
6
|
+
type Theme = PluginTimelineItemProps<OmpLspDiagnostics>["theme"];
|
|
7
|
+
|
|
8
|
+
const SEVERITY_ICON = {
|
|
9
|
+
error: "CircleX",
|
|
10
|
+
warning: "TriangleAlert",
|
|
11
|
+
info: "Info",
|
|
12
|
+
hint: "Lightbulb",
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
function severityColor(theme: Theme, severity: OmpLspSeverity): string {
|
|
16
|
+
if (severity === "error") return theme.colors.statusDanger;
|
|
17
|
+
if (severity === "warning") return theme.colors.statusWarning;
|
|
18
|
+
return theme.colors.foregroundMuted;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function countLabel(data: OmpLspDiagnostics): string {
|
|
22
|
+
const total = data.files.reduce((sum, file) => sum + file.diagnostics.length, 0);
|
|
23
|
+
const issues = total === 1 ? "1 issue" : `${total} issues`;
|
|
24
|
+
const files = data.files.length === 1 ? "1 file" : `${data.files.length} files`;
|
|
25
|
+
return `LSP diagnostics: ${issues} in ${files}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function OmpLspDiagnosticsCard({ item, theme }: PluginTimelineItemProps<OmpLspDiagnostics>) {
|
|
29
|
+
const { foreground, foregroundMuted, border, surface1 } = theme.colors;
|
|
30
|
+
return (
|
|
31
|
+
<View
|
|
32
|
+
style={{
|
|
33
|
+
gap: 8,
|
|
34
|
+
padding: 10,
|
|
35
|
+
borderRadius: 8,
|
|
36
|
+
borderWidth: 1,
|
|
37
|
+
borderColor: border,
|
|
38
|
+
backgroundColor: surface1,
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
<Text style={{ color: foregroundMuted, fontSize: 13 }}>{countLabel(item.data)}</Text>
|
|
42
|
+
{item.data.files.map((file) => (
|
|
43
|
+
<View key={file.path} style={{ gap: 4 }}>
|
|
44
|
+
<Text style={{ color: foreground, fontSize: 13, fontWeight: "500" }} selectable>
|
|
45
|
+
{file.path}
|
|
46
|
+
</Text>
|
|
47
|
+
{file.diagnostics.map((diagnostic, index) => (
|
|
48
|
+
<View
|
|
49
|
+
key={`${index}:${diagnostic.line}:${diagnostic.column}`}
|
|
50
|
+
style={{ flexDirection: "row", alignItems: "flex-start", gap: 6 }}
|
|
51
|
+
>
|
|
52
|
+
<Icon
|
|
53
|
+
name={SEVERITY_ICON[diagnostic.severity]}
|
|
54
|
+
size={14}
|
|
55
|
+
color={severityColor(theme, diagnostic.severity)}
|
|
56
|
+
/>
|
|
57
|
+
<Text style={{ color: foregroundMuted, fontSize: 13 }}>
|
|
58
|
+
{`${diagnostic.line}:${diagnostic.column}`}
|
|
59
|
+
</Text>
|
|
60
|
+
<Text style={{ color: foreground, fontSize: 13, flexShrink: 1 }} selectable>
|
|
61
|
+
{diagnostic.message}
|
|
62
|
+
</Text>
|
|
63
|
+
</View>
|
|
64
|
+
))}
|
|
65
|
+
</View>
|
|
66
|
+
))}
|
|
67
|
+
</View>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
import { type PluginSurfaceProps, useRpc } from "@getpaseo/plugin/client";
|
|
2
2
|
import { TextInput } from "@getpaseo/plugin/client/ui";
|
|
3
|
-
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { skipToken, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
4
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
import type { TextStyle, ViewStyle } from "react-native";
|
|
6
6
|
import { Pressable, Switch, Text, View } from "react-native";
|
|
7
7
|
import {
|
|
8
|
+
browseOmpMarketplace,
|
|
8
9
|
inspectOmpPluginConfig,
|
|
10
|
+
listOmpMarketplaces,
|
|
9
11
|
listOmpPlugins,
|
|
12
|
+
mutateOmpMarketplace,
|
|
10
13
|
mutateOmpPlugin,
|
|
11
14
|
mutateOmpPluginConfig,
|
|
12
15
|
type OmpInstalledPlugin,
|
|
16
|
+
type OmpMarketplaceMutation,
|
|
13
17
|
type OmpPluginConfigMutation,
|
|
14
18
|
OmpPluginConfigMutationSchema,
|
|
15
19
|
type OmpPluginConfigSetting,
|
|
16
20
|
type OmpPluginConfigState,
|
|
17
21
|
OmpPluginInstallSourceSchema,
|
|
18
22
|
type OmpPluginMutation,
|
|
23
|
+
redactSourceCredentials,
|
|
19
24
|
} from "../shared/omp-plugins";
|
|
20
25
|
|
|
21
26
|
import type { OmpStore } from "../shared/omp-store";
|
|
22
27
|
import { ompStoreKey } from "./omp-store-state";
|
|
23
28
|
|
|
24
29
|
const PLUGINS_QUERY_KEY = ["paseo-omp", "plugins"] as const;
|
|
30
|
+
const MARKETPLACES_QUERY_KEY = ["paseo-omp", "marketplaces"] as const;
|
|
31
|
+
const CATALOG_ROW_LIMIT = 50;
|
|
25
32
|
|
|
26
33
|
type ConfirmationOrigin =
|
|
27
34
|
| { surface: "install" }
|
|
35
|
+
| { surface: "catalog" }
|
|
28
36
|
| { surface: "plugin"; key: string }
|
|
29
37
|
| { surface: "config"; key: string };
|
|
30
38
|
|
|
@@ -42,6 +50,13 @@ type PendingConfirmation =
|
|
|
42
50
|
origin: ConfirmationOrigin;
|
|
43
51
|
title: string;
|
|
44
52
|
warning: string;
|
|
53
|
+
}
|
|
54
|
+
| {
|
|
55
|
+
kind: "marketplace";
|
|
56
|
+
input: OmpMarketplaceMutation;
|
|
57
|
+
origin: ConfirmationOrigin;
|
|
58
|
+
title: string;
|
|
59
|
+
warning: string;
|
|
45
60
|
};
|
|
46
61
|
|
|
47
62
|
type PluginManagerStyles = {
|
|
@@ -264,7 +279,7 @@ function ConfirmationPanel({
|
|
|
264
279
|
label={busy ? "Applying…" : confirmLabel}
|
|
265
280
|
disabled={busy}
|
|
266
281
|
primary
|
|
267
|
-
danger={action === "uninstall" || action === "delete"}
|
|
282
|
+
danger={action === "uninstall" || action === "delete" || action === "remove"}
|
|
268
283
|
styles={styles}
|
|
269
284
|
onPress={onConfirm}
|
|
270
285
|
/>
|
|
@@ -688,6 +703,43 @@ export function OmpPluginManagerSection({
|
|
|
688
703
|
const [inspected, setInspected] = useState<OmpPluginConfigState | null>(null);
|
|
689
704
|
const [configEditGenerations, setConfigEditGenerations] = useState<Record<string, number>>({});
|
|
690
705
|
const inspectionGeneration = useRef(0);
|
|
706
|
+
const loadMarketplaces = useRpc(listOmpMarketplaces);
|
|
707
|
+
const browseMarketplace = useRpc(browseOmpMarketplace);
|
|
708
|
+
const mutateMarketplace = useRpc(mutateOmpMarketplace);
|
|
709
|
+
const [catalogSource, setCatalogSource] = useState("");
|
|
710
|
+
const [browsing, setBrowsing] = useState<string | null>(null);
|
|
711
|
+
const marketplaces = useQuery({
|
|
712
|
+
queryKey: [...MARKETPLACES_QUERY_KEY, ompStoreKey(store)],
|
|
713
|
+
queryFn: () => loadMarketplaces({ store }),
|
|
714
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
715
|
+
});
|
|
716
|
+
const catalog = useQuery({
|
|
717
|
+
queryKey: [...MARKETPLACES_QUERY_KEY, "catalog", ompStoreKey(store), browsing],
|
|
718
|
+
queryFn:
|
|
719
|
+
browsing === null ? skipToken : () => browseMarketplace({ store, marketplace: browsing }),
|
|
720
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
721
|
+
});
|
|
722
|
+
const marketplaceMutation = useMutation({
|
|
723
|
+
mutationKey: ["paseo-omp", "marketplace", ompStoreKey(store)],
|
|
724
|
+
mutationFn: (input: OmpMarketplaceMutation) => mutateMarketplace({ ...input, store }),
|
|
725
|
+
onSuccess: (result, input) => {
|
|
726
|
+
queryClient.setQueryData([...MARKETPLACES_QUERY_KEY, ompStoreKey(store)], result.state);
|
|
727
|
+
void queryClient.invalidateQueries({
|
|
728
|
+
queryKey: [...MARKETPLACES_QUERY_KEY, "catalog", ompStoreKey(store)],
|
|
729
|
+
refetchType: "none",
|
|
730
|
+
});
|
|
731
|
+
setNotice({ tone: result.ok ? "success" : "error", text: result.message });
|
|
732
|
+
if (result.ok && input.action === "add") setCatalogSource("");
|
|
733
|
+
if (result.ok && input.action === "remove" && input.marketplace === browsing) {
|
|
734
|
+
setBrowsing(null);
|
|
735
|
+
}
|
|
736
|
+
setConfirmation(null);
|
|
737
|
+
},
|
|
738
|
+
onError: () => {
|
|
739
|
+
setNotice({ tone: "error", text: "The marketplace operation could not be completed." });
|
|
740
|
+
setConfirmation(null);
|
|
741
|
+
},
|
|
742
|
+
});
|
|
691
743
|
const plugins = useQuery({
|
|
692
744
|
queryKey: [...PLUGINS_QUERY_KEY, ompStoreKey(store), cwd ?? "global"],
|
|
693
745
|
queryFn: () => loadPlugins(context),
|
|
@@ -744,7 +796,7 @@ export function OmpPluginManagerSection({
|
|
|
744
796
|
setConfirmation(null);
|
|
745
797
|
},
|
|
746
798
|
});
|
|
747
|
-
const busy = mutation.isPending || configMutation.isPending;
|
|
799
|
+
const busy = mutation.isPending || configMutation.isPending || marketplaceMutation.isPending;
|
|
748
800
|
useEffect(() => {
|
|
749
801
|
if (!confirmation) return;
|
|
750
802
|
const { origin } = confirmation;
|
|
@@ -816,9 +868,39 @@ export function OmpPluginManagerSection({
|
|
|
816
868
|
setConfirmation(null);
|
|
817
869
|
configInspection.mutate({ plugin, generation });
|
|
818
870
|
};
|
|
871
|
+
const requestCatalogAdd = () => {
|
|
872
|
+
const parsed = OmpPluginInstallSourceSchema.safeParse(catalogSource);
|
|
873
|
+
if (!parsed.success) {
|
|
874
|
+
setNotice({
|
|
875
|
+
tone: "error",
|
|
876
|
+
text: "Enter one valid Git source, URL, or local path without options or control characters.",
|
|
877
|
+
});
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
setNotice(null);
|
|
881
|
+
setConfirmation({
|
|
882
|
+
kind: "marketplace",
|
|
883
|
+
input: { action: "add", source: parsed.data, store },
|
|
884
|
+
origin: { surface: "catalog" },
|
|
885
|
+
title: `Add marketplace ${redactSourceCredentials(parsed.data)}?`,
|
|
886
|
+
warning:
|
|
887
|
+
"Plugins from a marketplace are trusted code. Adding it fetches the catalog on the daemon host, and any plugin you install from it can run code with that host's access.",
|
|
888
|
+
});
|
|
889
|
+
};
|
|
890
|
+
const requestCatalogRemove = (name: string) => {
|
|
891
|
+
setNotice(null);
|
|
892
|
+
setConfirmation({
|
|
893
|
+
kind: "marketplace",
|
|
894
|
+
input: { action: "remove", marketplace: name, store },
|
|
895
|
+
origin: { surface: "catalog" },
|
|
896
|
+
title: `Remove marketplace ${name}?`,
|
|
897
|
+
warning: "Removes the catalog and its cached copy. Installed plugins are not uninstalled.",
|
|
898
|
+
});
|
|
899
|
+
};
|
|
819
900
|
const applyConfirmation = () => {
|
|
820
901
|
if (!confirmation) return;
|
|
821
902
|
if (confirmation.kind === "plugin") mutation.mutate(confirmation.input);
|
|
903
|
+
else if (confirmation.kind === "marketplace") marketplaceMutation.mutate(confirmation.input);
|
|
822
904
|
else configMutation.mutate(confirmation.input);
|
|
823
905
|
};
|
|
824
906
|
|
|
@@ -835,6 +917,7 @@ export function OmpPluginManagerSection({
|
|
|
835
917
|
styles={styles}
|
|
836
918
|
onPress={() => {
|
|
837
919
|
void plugins.refetch();
|
|
920
|
+
void queryClient.invalidateQueries({ queryKey: MARKETPLACES_QUERY_KEY });
|
|
838
921
|
}}
|
|
839
922
|
/>
|
|
840
923
|
</View>
|
|
@@ -877,6 +960,118 @@ export function OmpPluginManagerSection({
|
|
|
877
960
|
)}
|
|
878
961
|
</View>
|
|
879
962
|
|
|
963
|
+
<View style={styles.card}>
|
|
964
|
+
<Text style={styles.cardTitle}>Marketplaces</Text>
|
|
965
|
+
<Text style={styles.muted}>
|
|
966
|
+
Catalogs of installable OMP plugins. Browse one to fill the install box above.
|
|
967
|
+
</Text>
|
|
968
|
+
{marketplaces.isLoading ? <Text style={styles.muted}>Loading marketplaces…</Text> : null}
|
|
969
|
+
{marketplaces.error || marketplaces.data?.error ? (
|
|
970
|
+
<Text accessibilityRole="alert" style={styles.error}>
|
|
971
|
+
{marketplaces.data?.error ?? "Could not load OMP marketplaces."}
|
|
972
|
+
</Text>
|
|
973
|
+
) : null}
|
|
974
|
+
{marketplaces.data?.available && marketplaces.data.marketplaces.length === 0 ? (
|
|
975
|
+
<Text style={styles.muted}>No marketplaces configured.</Text>
|
|
976
|
+
) : null}
|
|
977
|
+
{marketplaces.data?.marketplaces.map((marketplace) => (
|
|
978
|
+
<View key={marketplace.name} style={styles.setting}>
|
|
979
|
+
<View style={styles.cardHeader}>
|
|
980
|
+
<View style={{ flexShrink: 1 }}>
|
|
981
|
+
<Text style={styles.settingName}>{marketplace.name}</Text>
|
|
982
|
+
<Text selectable style={styles.settingDescription}>
|
|
983
|
+
{marketplace.source}
|
|
984
|
+
</Text>
|
|
985
|
+
</View>
|
|
986
|
+
<View style={styles.actions}>
|
|
987
|
+
<ActionButton
|
|
988
|
+
label={browsing === marketplace.name ? "Hide" : "Browse"}
|
|
989
|
+
disabled={busy || confirmation !== null}
|
|
990
|
+
styles={styles}
|
|
991
|
+
onPress={() =>
|
|
992
|
+
setBrowsing(browsing === marketplace.name ? null : marketplace.name)
|
|
993
|
+
}
|
|
994
|
+
/>
|
|
995
|
+
<ActionButton
|
|
996
|
+
label="Remove"
|
|
997
|
+
disabled={busy || confirmation !== null}
|
|
998
|
+
danger
|
|
999
|
+
styles={styles}
|
|
1000
|
+
onPress={() => requestCatalogRemove(marketplace.name)}
|
|
1001
|
+
/>
|
|
1002
|
+
</View>
|
|
1003
|
+
</View>
|
|
1004
|
+
{browsing === marketplace.name ? (
|
|
1005
|
+
<View style={styles.settings}>
|
|
1006
|
+
{catalog.isFetching ? <Text style={styles.muted}>Loading catalog…</Text> : null}
|
|
1007
|
+
{catalog.error || catalog.data?.error ? (
|
|
1008
|
+
<Text accessibilityRole="alert" style={styles.error}>
|
|
1009
|
+
{catalog.data?.error ?? "Could not load this catalog."}
|
|
1010
|
+
</Text>
|
|
1011
|
+
) : null}
|
|
1012
|
+
{catalog.data?.available && catalog.data.plugins.length === 0 ? (
|
|
1013
|
+
<Text style={styles.muted}>This catalog lists no plugins.</Text>
|
|
1014
|
+
) : null}
|
|
1015
|
+
{catalog.data?.plugins.slice(0, CATALOG_ROW_LIMIT).map((plugin) => (
|
|
1016
|
+
<View key={plugin.id} style={styles.cardHeader}>
|
|
1017
|
+
<View style={{ flexShrink: 1 }}>
|
|
1018
|
+
<Text style={styles.settingName}>
|
|
1019
|
+
{plugin.id}
|
|
1020
|
+
{plugin.version ? ` · ${plugin.version}` : ""}
|
|
1021
|
+
</Text>
|
|
1022
|
+
{plugin.description ? (
|
|
1023
|
+
<Text style={styles.settingDescription}>{plugin.description}</Text>
|
|
1024
|
+
) : null}
|
|
1025
|
+
</View>
|
|
1026
|
+
<ActionButton
|
|
1027
|
+
label="Use"
|
|
1028
|
+
disabled={busy || confirmation !== null}
|
|
1029
|
+
styles={styles}
|
|
1030
|
+
onPress={() => setSource(plugin.id)}
|
|
1031
|
+
/>
|
|
1032
|
+
</View>
|
|
1033
|
+
))}
|
|
1034
|
+
{catalog.data && catalog.data.plugins.length > CATALOG_ROW_LIMIT ? (
|
|
1035
|
+
<Text style={styles.muted}>
|
|
1036
|
+
Showing {CATALOG_ROW_LIMIT} of {catalog.data.plugins.length} plugins.
|
|
1037
|
+
</Text>
|
|
1038
|
+
) : null}
|
|
1039
|
+
</View>
|
|
1040
|
+
) : null}
|
|
1041
|
+
</View>
|
|
1042
|
+
))}
|
|
1043
|
+
<TextInput
|
|
1044
|
+
accessibilityLabel="OMP marketplace source"
|
|
1045
|
+
editable={!busy && confirmation === null}
|
|
1046
|
+
value={catalogSource}
|
|
1047
|
+
onChangeText={setCatalogSource}
|
|
1048
|
+
placeholder="owner/repo, Git URL, or local path"
|
|
1049
|
+
placeholderTextColor={theme.colors.foregroundMuted}
|
|
1050
|
+
autoCapitalize="none"
|
|
1051
|
+
autoCorrect={false}
|
|
1052
|
+
style={styles.input}
|
|
1053
|
+
/>
|
|
1054
|
+
{confirmation?.origin.surface === "catalog" ? (
|
|
1055
|
+
<ConfirmationPanel
|
|
1056
|
+
confirmation={confirmation}
|
|
1057
|
+
busy={busy}
|
|
1058
|
+
styles={styles}
|
|
1059
|
+
onCancel={() => setConfirmation(null)}
|
|
1060
|
+
onConfirm={applyConfirmation}
|
|
1061
|
+
/>
|
|
1062
|
+
) : (
|
|
1063
|
+
<View style={styles.actions}>
|
|
1064
|
+
<ActionButton
|
|
1065
|
+
label="Review add"
|
|
1066
|
+
disabled={busy || confirmation !== null || catalogSource.length === 0}
|
|
1067
|
+
primary
|
|
1068
|
+
styles={styles}
|
|
1069
|
+
onPress={requestCatalogAdd}
|
|
1070
|
+
/>
|
|
1071
|
+
</View>
|
|
1072
|
+
)}
|
|
1073
|
+
</View>
|
|
1074
|
+
|
|
880
1075
|
{notice ? (
|
|
881
1076
|
<Text
|
|
882
1077
|
accessibilityRole="alert"
|
package/index.client.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import { ConfigSidebarItem } from "./client/config-sidebar";
|
|
|
8
8
|
import { OMP_ICON } from "./client/hub-icon";
|
|
9
9
|
import { HubPopover } from "./client/hub-popover";
|
|
10
10
|
import { summarizeHubProcesses } from "./client/hub-status";
|
|
11
|
+
import { OmpLspDiagnosticsCard } from "./client/lsp-diagnostics";
|
|
11
12
|
import { OmpMcpAuthorizationCard } from "./client/mcp-authorization";
|
|
12
13
|
import { McpPopover } from "./client/mcp-popover";
|
|
13
14
|
import { OmpMemoryPanel } from "./client/memory-panel";
|
|
@@ -43,6 +44,11 @@ import {
|
|
|
43
44
|
composerPillSettingsSchema,
|
|
44
45
|
} from "./shared/composer-pill-settings";
|
|
45
46
|
import { listHubProcesses } from "./shared/hub";
|
|
47
|
+
import {
|
|
48
|
+
OMP_LSP_DIAGNOSTICS_KIND,
|
|
49
|
+
ompLspDiagnosticsSchema,
|
|
50
|
+
transformOmpLspToolItem,
|
|
51
|
+
} from "./shared/lsp-diagnostics";
|
|
46
52
|
import { OMP_MCP_AUTH_TIMELINE_KIND, ompMcpAuthorizationTimelineSchema } from "./shared/mcp";
|
|
47
53
|
import { type OmpStore, storeForProvider } from "./shared/omp-store";
|
|
48
54
|
import { ompImageTimelineSchema, transformOmpImageToolItem } from "./shared/provider-image";
|
|
@@ -229,6 +235,19 @@ export default function contribute(client: PluginClientContext) {
|
|
|
229
235
|
schema: ompRuleNoticeSchema,
|
|
230
236
|
Component: OmpRuleNoticeRow,
|
|
231
237
|
});
|
|
238
|
+
const removeLspDiagnosticsRenderer = client.addTimelineRenderer({
|
|
239
|
+
kind: OMP_LSP_DIAGNOSTICS_KIND,
|
|
240
|
+
version: 1,
|
|
241
|
+
schema: ompLspDiagnosticsSchema,
|
|
242
|
+
Component: OmpLspDiagnosticsCard,
|
|
243
|
+
});
|
|
244
|
+
const removeLspTransformer = client.addTimelineTransformer({
|
|
245
|
+
id: "omp-lsp-diagnostics",
|
|
246
|
+
query: { itemType: "tool_call" },
|
|
247
|
+
transform({ item }) {
|
|
248
|
+
return transformOmpLspToolItem(item);
|
|
249
|
+
},
|
|
250
|
+
});
|
|
232
251
|
const removeImageTransformer = client.addTimelineTransformer({
|
|
233
252
|
id: "omp-images",
|
|
234
253
|
query: { itemType: "tool_call" },
|
|
@@ -521,6 +540,8 @@ export default function contribute(client: PluginClientContext) {
|
|
|
521
540
|
removeMcpAuthorizationRenderer();
|
|
522
541
|
removeSubagentStripRenderer();
|
|
523
542
|
removeRuleNoticeRenderer();
|
|
543
|
+
removeLspDiagnosticsRenderer();
|
|
544
|
+
removeLspTransformer();
|
|
524
545
|
removeImageTransformer();
|
|
525
546
|
removeOpenConfig();
|
|
526
547
|
removeConfigEntry();
|
package/index.server.ts
CHANGED
|
@@ -10,8 +10,11 @@ import { resolveListOmpConfig } from "./server/omp-config";
|
|
|
10
10
|
import { OmpMcps } from "./server/omp-mcps";
|
|
11
11
|
import { resolveListOmpModels } from "./server/omp-models";
|
|
12
12
|
import {
|
|
13
|
+
resolveBrowseOmpMarketplace,
|
|
13
14
|
resolveInspectOmpPluginConfig,
|
|
15
|
+
resolveListOmpMarketplaces,
|
|
14
16
|
resolveListOmpPlugins,
|
|
17
|
+
resolveMutateOmpMarketplace,
|
|
15
18
|
resolveMutateOmpPlugin,
|
|
16
19
|
resolveMutateOmpPluginConfig,
|
|
17
20
|
} from "./server/omp-plugins";
|
|
@@ -69,8 +72,11 @@ import {
|
|
|
69
72
|
} from "./shared/omp-mcps";
|
|
70
73
|
import { listOmpModels } from "./shared/omp-models";
|
|
71
74
|
import {
|
|
75
|
+
browseOmpMarketplace,
|
|
72
76
|
inspectOmpPluginConfig,
|
|
77
|
+
listOmpMarketplaces,
|
|
73
78
|
listOmpPlugins,
|
|
79
|
+
mutateOmpMarketplace,
|
|
74
80
|
mutateOmpPlugin,
|
|
75
81
|
mutateOmpPluginConfig,
|
|
76
82
|
} from "./shared/omp-plugins";
|
|
@@ -194,6 +200,9 @@ export default function contribute(server: PluginServerContext) {
|
|
|
194
200
|
server.handle(listOmpConfig, scoped(resolveListOmpConfig));
|
|
195
201
|
server.handle(listOmpModels, scoped(resolveListOmpModels));
|
|
196
202
|
server.handle(listOmpPlugins, scoped(resolveListOmpPlugins));
|
|
203
|
+
server.handle(listOmpMarketplaces, scoped(resolveListOmpMarketplaces));
|
|
204
|
+
server.handle(browseOmpMarketplace, scoped(resolveBrowseOmpMarketplace));
|
|
205
|
+
server.handle(mutateOmpMarketplace, scoped(resolveMutateOmpMarketplace));
|
|
197
206
|
server.handle(listOmpRules, scoped(resolveListOmpRules));
|
|
198
207
|
server.handle(listOmpSkills, scoped(resolveListOmpSkills));
|
|
199
208
|
server.handle(setOmpSkillEnabled, scoped(resolveSetOmpSkillEnabled));
|
package/package.json
CHANGED
package/server/omp-plugins.ts
CHANGED
|
@@ -3,20 +3,28 @@ import { delimiter, isAbsolute, join } from "node:path";
|
|
|
3
3
|
import type { RpcInput } from "@getpaseo/plugin";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import {
|
|
6
|
+
type browseOmpMarketplace,
|
|
6
7
|
type inspectOmpPluginConfig,
|
|
8
|
+
type listOmpMarketplaces,
|
|
7
9
|
type listOmpPlugins,
|
|
10
|
+
type mutateOmpMarketplace,
|
|
8
11
|
type mutateOmpPlugin,
|
|
9
12
|
type mutateOmpPluginConfig,
|
|
13
|
+
OMP_CATALOG_PLUGIN_LIMIT,
|
|
10
14
|
OMP_PLUGIN_LIMIT,
|
|
15
|
+
type OmpCatalogState,
|
|
11
16
|
type OmpInstalledPlugin,
|
|
12
17
|
OmpInstalledPluginSchema,
|
|
18
|
+
OmpMarketplaceNameSchema,
|
|
13
19
|
OmpMarketplacePluginIdSchema,
|
|
20
|
+
type OmpMarketplaceState,
|
|
14
21
|
type OmpPluginConfigMutation,
|
|
15
22
|
type OmpPluginConfigSetting,
|
|
16
23
|
type OmpPluginConfigState,
|
|
17
24
|
type OmpPluginMutation,
|
|
18
25
|
OmpPluginNameSchema,
|
|
19
26
|
type OmpPluginState,
|
|
27
|
+
redactSourceCredentials,
|
|
20
28
|
} from "../shared/omp-plugins";
|
|
21
29
|
import { SerialMutationQueue } from "./mutation-queue";
|
|
22
30
|
import { currentOmpEnvironment } from "./paths";
|
|
@@ -674,3 +682,177 @@ export function resolveMutateOmpPlugin(
|
|
|
674
682
|
mutateOmpPluginWithDependencies(input, DEFAULT_DEPENDENCIES),
|
|
675
683
|
);
|
|
676
684
|
}
|
|
685
|
+
|
|
686
|
+
// OMP prints marketplace listings as text only (`--json` is ignored), so parse the stable
|
|
687
|
+
// "name source" and "name[@version]" / indented description shapes and reject anything else.
|
|
688
|
+
|
|
689
|
+
export function parseOmpMarketplaceList(stdout: string): OmpMarketplaceState["marketplaces"] {
|
|
690
|
+
const lines = stdout.split(/\r?\n/u);
|
|
691
|
+
if (!lines.some((line) => line.startsWith("Configured Marketplaces:"))) {
|
|
692
|
+
if (lines.some((line) => line.startsWith("No marketplaces configured"))) return [];
|
|
693
|
+
throw new Error("OMP returned an invalid marketplace list");
|
|
694
|
+
}
|
|
695
|
+
const marketplaces: OmpMarketplaceState["marketplaces"] = [];
|
|
696
|
+
for (const line of lines) {
|
|
697
|
+
const match = /^ {2}(\S+) {2}(\S.*)$/u.exec(line);
|
|
698
|
+
if (!match?.[1] || !match[2]) continue;
|
|
699
|
+
const name = OmpMarketplaceNameSchema.safeParse(match[1]);
|
|
700
|
+
const source = boundedText(redactSourceCredentials(match[2].trim()), 4_096);
|
|
701
|
+
if (name.success && source) marketplaces.push({ name: name.data, source });
|
|
702
|
+
if (marketplaces.length === OMP_PLUGIN_LIMIT) break;
|
|
703
|
+
}
|
|
704
|
+
return marketplaces;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
export function parseOmpCatalog(stdout: string, marketplace: string): OmpCatalogState["plugins"] {
|
|
708
|
+
const lines = stdout.split(/\r?\n/u);
|
|
709
|
+
if (!lines.some((line) => line.startsWith("Available Plugins"))) {
|
|
710
|
+
if (lines.some((line) => line.startsWith("No plugins found"))) return [];
|
|
711
|
+
throw new Error("OMP returned an invalid plugin catalog");
|
|
712
|
+
}
|
|
713
|
+
const plugins: OmpCatalogState["plugins"] = [];
|
|
714
|
+
let current: OmpCatalogState["plugins"][number] | null = null;
|
|
715
|
+
for (const line of lines) {
|
|
716
|
+
const entry = /^ {2}(\S+)$/u.exec(line);
|
|
717
|
+
if (entry?.[1]) {
|
|
718
|
+
const [name, version] = entry[1].split("@");
|
|
719
|
+
const id = `${name}@${marketplace}`;
|
|
720
|
+
// OMP allows mixed-case names and caps the assembled id at 128 characters.
|
|
721
|
+
const valid = OmpMarketplaceNameSchema.safeParse(name).success && id.length <= 128;
|
|
722
|
+
current = valid ? { id, version: boundedText(version, 128), description: null } : null;
|
|
723
|
+
if (!current) continue;
|
|
724
|
+
plugins.push(current);
|
|
725
|
+
if (plugins.length === OMP_CATALOG_PLUGIN_LIMIT) break;
|
|
726
|
+
continue;
|
|
727
|
+
}
|
|
728
|
+
const description = /^ {4}(\S.*)$/u.exec(line);
|
|
729
|
+
if (description?.[1] && current && current.description === null) {
|
|
730
|
+
current.description = boundedText(description[1].trim(), DESCRIPTION_LIMIT);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
return plugins;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
async function loadMarketplaces(
|
|
737
|
+
executable: string,
|
|
738
|
+
dependencies: OmpPluginDependencies,
|
|
739
|
+
): Promise<OmpMarketplaceState> {
|
|
740
|
+
const result = await dependencies.runPlugin(
|
|
741
|
+
executable,
|
|
742
|
+
["plugin", "marketplace", "list"],
|
|
743
|
+
LIST_OUTPUT_LIMIT,
|
|
744
|
+
READ_TIMEOUT_MS,
|
|
745
|
+
);
|
|
746
|
+
if (!runSucceeded(result)) {
|
|
747
|
+
return { available: false, marketplaces: [], error: readFailure(result) };
|
|
748
|
+
}
|
|
749
|
+
try {
|
|
750
|
+
return { available: true, marketplaces: parseOmpMarketplaceList(result.stdout) };
|
|
751
|
+
} catch {
|
|
752
|
+
return {
|
|
753
|
+
available: false,
|
|
754
|
+
marketplaces: [],
|
|
755
|
+
error: "OMP returned an invalid marketplace list.",
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
export async function listOmpMarketplacesWithDependencies(
|
|
761
|
+
dependencies: OmpPluginDependencies,
|
|
762
|
+
): Promise<OmpMarketplaceState> {
|
|
763
|
+
const executable = await dependencies.resolveExecutable();
|
|
764
|
+
if (!executable) {
|
|
765
|
+
return {
|
|
766
|
+
available: false,
|
|
767
|
+
marketplaces: [],
|
|
768
|
+
error: "The OMP executable could not be resolved.",
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
return loadMarketplaces(executable, dependencies);
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
export function resolveListOmpMarketplaces(
|
|
775
|
+
_input: RpcInput<typeof listOmpMarketplaces>,
|
|
776
|
+
): Promise<OmpMarketplaceState> {
|
|
777
|
+
return listOmpMarketplacesWithDependencies(DEFAULT_DEPENDENCIES);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
export async function browseOmpMarketplaceWithDependencies(
|
|
781
|
+
input: RpcInput<typeof browseOmpMarketplace>,
|
|
782
|
+
dependencies: OmpPluginDependencies,
|
|
783
|
+
): Promise<OmpCatalogState> {
|
|
784
|
+
const unavailable = (error: string): OmpCatalogState => ({
|
|
785
|
+
available: false,
|
|
786
|
+
marketplace: input.marketplace,
|
|
787
|
+
plugins: [],
|
|
788
|
+
error,
|
|
789
|
+
});
|
|
790
|
+
const executable = await dependencies.resolveExecutable();
|
|
791
|
+
if (!executable) return unavailable("The OMP executable could not be resolved.");
|
|
792
|
+
const result = await dependencies.runPlugin(
|
|
793
|
+
executable,
|
|
794
|
+
["plugin", "discover", input.marketplace],
|
|
795
|
+
LIST_OUTPUT_LIMIT,
|
|
796
|
+
READ_TIMEOUT_MS,
|
|
797
|
+
);
|
|
798
|
+
if (!runSucceeded(result)) return unavailable(readFailure(result));
|
|
799
|
+
try {
|
|
800
|
+
return {
|
|
801
|
+
available: true,
|
|
802
|
+
marketplace: input.marketplace,
|
|
803
|
+
plugins: parseOmpCatalog(result.stdout, input.marketplace),
|
|
804
|
+
};
|
|
805
|
+
} catch {
|
|
806
|
+
return unavailable("OMP returned an invalid plugin catalog.");
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
export function resolveBrowseOmpMarketplace(
|
|
811
|
+
input: RpcInput<typeof browseOmpMarketplace>,
|
|
812
|
+
): Promise<OmpCatalogState> {
|
|
813
|
+
return browseOmpMarketplaceWithDependencies(input, DEFAULT_DEPENDENCIES);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
export function buildOmpMarketplaceMutationArgs(
|
|
817
|
+
input: RpcInput<typeof mutateOmpMarketplace>,
|
|
818
|
+
): string[] {
|
|
819
|
+
return [
|
|
820
|
+
"plugin",
|
|
821
|
+
"marketplace",
|
|
822
|
+
input.action,
|
|
823
|
+
input.action === "add" ? input.source : input.marketplace,
|
|
824
|
+
];
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
export async function mutateOmpMarketplaceWithDependencies(
|
|
828
|
+
input: RpcInput<typeof mutateOmpMarketplace>,
|
|
829
|
+
dependencies: OmpPluginDependencies,
|
|
830
|
+
): Promise<{ ok: boolean; message: string; state: OmpMarketplaceState }> {
|
|
831
|
+
const executable = await dependencies.resolveExecutable();
|
|
832
|
+
if (!executable) {
|
|
833
|
+
const message = "The OMP executable could not be resolved.";
|
|
834
|
+
return { ok: false, message, state: { available: false, marketplaces: [], error: message } };
|
|
835
|
+
}
|
|
836
|
+
const mutation = await dependencies.runPlugin(
|
|
837
|
+
executable,
|
|
838
|
+
buildOmpMarketplaceMutationArgs(input),
|
|
839
|
+
MUTATION_OUTPUT_LIMIT,
|
|
840
|
+
MUTATION_TIMEOUT_MS,
|
|
841
|
+
);
|
|
842
|
+
const ok = runSucceeded(mutation);
|
|
843
|
+
const state = await loadMarketplaces(executable, dependencies);
|
|
844
|
+
if (!ok) return { ok, message: mutationFailure(mutation), state };
|
|
845
|
+
return {
|
|
846
|
+
ok,
|
|
847
|
+
message: input.action === "add" ? "Marketplace added." : "Marketplace removed.",
|
|
848
|
+
state,
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
export function resolveMutateOmpMarketplace(
|
|
853
|
+
input: RpcInput<typeof mutateOmpMarketplace>,
|
|
854
|
+
): Promise<{ ok: boolean; message: string; state: OmpMarketplaceState }> {
|
|
855
|
+
return pluginMutationQueue.run(() =>
|
|
856
|
+
mutateOmpMarketplaceWithDependencies(input, DEFAULT_DEPENDENCIES),
|
|
857
|
+
);
|
|
858
|
+
}
|
package/server/omp-settings.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { parseDocument, parse as parseYaml } from "yaml";
|
|
|
7
7
|
import {
|
|
8
8
|
isOmpStructuredSettingPath,
|
|
9
9
|
type listOmpSettings,
|
|
10
|
-
|
|
10
|
+
OMP_SETTING_DESCRIPTIONS,
|
|
11
11
|
OMP_SETTINGS_CATALOG_VERSION,
|
|
12
12
|
type OmpSetting,
|
|
13
13
|
type OmpSettingType,
|
|
@@ -197,9 +197,8 @@ export function parseOmpSettingsList(raw: unknown): ParsedOmpSettings {
|
|
|
197
197
|
path,
|
|
198
198
|
type: parsedType.data,
|
|
199
199
|
description:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
: (OMP_SETTING_FALLBACK_DESCRIPTIONS[path] ?? ""),
|
|
200
|
+
OMP_SETTING_DESCRIPTIONS[path] ??
|
|
201
|
+
(typeof entry.description === "string" ? entry.description : ""),
|
|
203
202
|
...(redacted
|
|
204
203
|
? { redacted: true, ...(configured === undefined ? {} : { configured }) }
|
|
205
204
|
: { value: entry.value }),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Release Please keeps this bundle-safe constant aligned with package.json. */
|
|
2
|
-
export const PASEO_OMP_PACKAGE_VERSION = "5.4.0-next.
|
|
2
|
+
export const PASEO_OMP_PACKAGE_VERSION = "5.4.0-next.401.1"; // x-release-please-version
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const OMP_LSP_DIAGNOSTICS_KIND = "omp-lsp-diagnostics";
|
|
4
|
+
|
|
5
|
+
const severitySchema = z.enum(["error", "warning", "info", "hint"]);
|
|
6
|
+
export type OmpLspSeverity = z.infer<typeof severitySchema>;
|
|
7
|
+
|
|
8
|
+
export const ompLspDiagnosticsSchema = z.object({
|
|
9
|
+
files: z
|
|
10
|
+
.array(
|
|
11
|
+
z.object({
|
|
12
|
+
path: z.string().min(1),
|
|
13
|
+
diagnostics: z
|
|
14
|
+
.array(
|
|
15
|
+
z.object({
|
|
16
|
+
line: z.number().int().positive(),
|
|
17
|
+
column: z.number().int().positive(),
|
|
18
|
+
severity: severitySchema,
|
|
19
|
+
message: z.string(),
|
|
20
|
+
}),
|
|
21
|
+
)
|
|
22
|
+
.min(1),
|
|
23
|
+
}),
|
|
24
|
+
)
|
|
25
|
+
.min(1),
|
|
26
|
+
});
|
|
27
|
+
export type OmpLspDiagnostics = z.infer<typeof ompLspDiagnosticsSchema>;
|
|
28
|
+
|
|
29
|
+
const COUNTS =
|
|
30
|
+
"\\d+ (?:error|warning|info|hint)\\(s\\)(?:, \\d+ (?:error|warning|info|hint)\\(s\\))*";
|
|
31
|
+
const HEADING = /^(#+) (.+)$/u;
|
|
32
|
+
const DIAGNOSTIC = /^\s+(\d+):(\d+) \[(error|warning|info|hint)\] (.+)$/u;
|
|
33
|
+
/** `3 error(s):` opens a single-target result. */
|
|
34
|
+
const TOTAL = new RegExp(`^${COUNTS}:$`, "u");
|
|
35
|
+
/** A glob result opens each file with `<icon> <path>: 1 error(s)` or `<icon> <path>: no issues`. */
|
|
36
|
+
const FILE_SUMMARY = new RegExp(`^\\S+ .+: (?:${COUNTS}|no issues)$`, "u");
|
|
37
|
+
/** OMP's own warnings (`<icon> a.ts: some servers failed (...)`, `[Showing lines ...]`) are not diagnostics. */
|
|
38
|
+
const NOTE =
|
|
39
|
+
/^(?:\S+ .+: (?:no diagnostics report yet|some servers failed|all language servers failed|No language server found)|\[.*\])/u;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Parses the text of an OMP `lsp` diagnostics result: a headed tree (`# dir/`, `## file`) whose
|
|
43
|
+
* files list `line:col [severity] message` rows. Returns `undefined` unless every file group is
|
|
44
|
+
* recognized, so unknown output keeps its original row.
|
|
45
|
+
*/
|
|
46
|
+
export function parseOmpLspDiagnostics(text: string): OmpLspDiagnostics | undefined {
|
|
47
|
+
const files = new Map<string, OmpLspDiagnostics["files"][number]["diagnostics"]>();
|
|
48
|
+
const directories: string[] = [];
|
|
49
|
+
let current: OmpLspDiagnostics["files"][number]["diagnostics"] | undefined;
|
|
50
|
+
let summarized = false;
|
|
51
|
+
let afterBlank = false;
|
|
52
|
+
for (const line of text.split("\n")) {
|
|
53
|
+
if (line.trim() === "") {
|
|
54
|
+
afterBlank = true;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const wasAfterBlank = afterBlank;
|
|
58
|
+
afterBlank = false;
|
|
59
|
+
if (TOTAL.test(line) || FILE_SUMMARY.test(line)) {
|
|
60
|
+
summarized = true;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (NOTE.test(line)) return undefined;
|
|
64
|
+
const heading = HEADING.exec(line);
|
|
65
|
+
if (heading) {
|
|
66
|
+
const depth = (heading[1] ?? "").length - 1;
|
|
67
|
+
const name = heading[2] ?? "";
|
|
68
|
+
directories.length = depth;
|
|
69
|
+
if (name.endsWith("/")) {
|
|
70
|
+
directories[depth] = name;
|
|
71
|
+
current = undefined;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const path = directories.join("") + name;
|
|
75
|
+
current = files.get(path) ?? [];
|
|
76
|
+
files.set(path, current);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const diagnostic = DIAGNOSTIC.exec(line);
|
|
80
|
+
if (diagnostic && current) {
|
|
81
|
+
current.push({
|
|
82
|
+
line: Number(diagnostic[1]),
|
|
83
|
+
column: Number(diagnostic[2]),
|
|
84
|
+
severity: severitySchema.parse(diagnostic[3]),
|
|
85
|
+
message: diagnostic[4] ?? "",
|
|
86
|
+
});
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const last = current?.at(-1);
|
|
90
|
+
if (!last || wasAfterBlank) return undefined;
|
|
91
|
+
last.message += `\n${line.trim()}`;
|
|
92
|
+
}
|
|
93
|
+
if (!summarized) return undefined;
|
|
94
|
+
const parsed = ompLspDiagnosticsSchema.safeParse({
|
|
95
|
+
files: [...files].map(([path, diagnostics]) => ({ path, diagnostics })),
|
|
96
|
+
});
|
|
97
|
+
return parsed.success ? parsed.data : undefined;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const textBlockSchema = z.object({ type: z.string(), text: z.string().optional() }).loose();
|
|
101
|
+
const lspToolRowSchema = z.object({
|
|
102
|
+
name: z.literal("lsp"),
|
|
103
|
+
callId: z.string(),
|
|
104
|
+
status: z.literal("completed"),
|
|
105
|
+
detail: z.union([
|
|
106
|
+
z.object({ type: z.literal("plain_text"), text: z.string() }),
|
|
107
|
+
z.object({
|
|
108
|
+
type: z.literal("unknown"),
|
|
109
|
+
output: z.object({ content: z.array(textBlockSchema) }).loose(),
|
|
110
|
+
}),
|
|
111
|
+
]),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Replaces a completed built-in `lsp` tool row with a diagnostics card. The built-in provider keeps
|
|
116
|
+
* only the result text (and raw JSON for an unmapped tool), so anything unparsable stays as is.
|
|
117
|
+
*/
|
|
118
|
+
export function transformOmpLspToolItem(item: unknown) {
|
|
119
|
+
const row = lspToolRowSchema.safeParse(item);
|
|
120
|
+
if (!row.success) return undefined;
|
|
121
|
+
const { detail } = row.data;
|
|
122
|
+
const text =
|
|
123
|
+
detail.type === "plain_text"
|
|
124
|
+
? detail.text
|
|
125
|
+
: detail.output.content
|
|
126
|
+
.flatMap((block) => (block.text === undefined ? [] : [block.text]))
|
|
127
|
+
.join("\n");
|
|
128
|
+
const data = parseOmpLspDiagnostics(text);
|
|
129
|
+
if (!data) return undefined;
|
|
130
|
+
return {
|
|
131
|
+
items: [
|
|
132
|
+
{
|
|
133
|
+
type: "plugin" as const,
|
|
134
|
+
kind: OMP_LSP_DIAGNOSTICS_KIND,
|
|
135
|
+
id: row.data.callId,
|
|
136
|
+
version: 1,
|
|
137
|
+
data,
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
}
|
package/shared/omp-plugins.ts
CHANGED
|
@@ -262,3 +262,93 @@ export const mutateOmpPlugin = defineRpc({
|
|
|
262
262
|
})
|
|
263
263
|
.strict(),
|
|
264
264
|
});
|
|
265
|
+
|
|
266
|
+
// OMP's own marketplace and catalog plugin name rule (marketplace/types.ts).
|
|
267
|
+
const OMP_MARKETPLACE_NAME = /^[a-zA-Z0-9](?:[a-zA-Z0-9.-]{0,62}[a-zA-Z0-9])?$/u;
|
|
268
|
+
export const OMP_CATALOG_PLUGIN_LIMIT = 1_000;
|
|
269
|
+
|
|
270
|
+
export const OmpMarketplaceNameSchema = z
|
|
271
|
+
.string()
|
|
272
|
+
.regex(OMP_MARKETPLACE_NAME, "Expected an OMP marketplace name");
|
|
273
|
+
|
|
274
|
+
export const OmpMarketplaceSchema = z
|
|
275
|
+
.object({ name: OmpMarketplaceNameSchema, source: z.string().min(1).max(4_096) })
|
|
276
|
+
.strict();
|
|
277
|
+
export type OmpMarketplace = z.infer<typeof OmpMarketplaceSchema>;
|
|
278
|
+
|
|
279
|
+
/** Drops `user:token@` from a URL source so credentials are never displayed. */
|
|
280
|
+
export function redactSourceCredentials(source: string): string {
|
|
281
|
+
return source.replace(/^([a-z][a-z0-9+.-]*:\/\/)[^/?#\s]*@/iu, "$1");
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export const OmpMarketplaceStateSchema = z
|
|
285
|
+
.object({
|
|
286
|
+
available: z.boolean(),
|
|
287
|
+
marketplaces: z.array(OmpMarketplaceSchema).max(OMP_PLUGIN_LIMIT),
|
|
288
|
+
error: z.string().max(256).optional(),
|
|
289
|
+
})
|
|
290
|
+
.strict();
|
|
291
|
+
export type OmpMarketplaceState = z.infer<typeof OmpMarketplaceStateSchema>;
|
|
292
|
+
|
|
293
|
+
export const listOmpMarketplaces = defineRpc({
|
|
294
|
+
name: "paseo-omp.list-marketplaces",
|
|
295
|
+
input: z.object({ store: OmpStoreSchema.optional() }).strict(),
|
|
296
|
+
output: OmpMarketplaceStateSchema,
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
export const OmpCatalogPluginSchema = z
|
|
300
|
+
.object({
|
|
301
|
+
id: z.string().min(3).max(128),
|
|
302
|
+
version: z.string().min(1).max(128).nullable(),
|
|
303
|
+
description: z.string().max(1_024).nullable(),
|
|
304
|
+
})
|
|
305
|
+
.strict();
|
|
306
|
+
export type OmpCatalogPlugin = z.infer<typeof OmpCatalogPluginSchema>;
|
|
307
|
+
|
|
308
|
+
export const OmpCatalogStateSchema = z
|
|
309
|
+
.object({
|
|
310
|
+
available: z.boolean(),
|
|
311
|
+
marketplace: OmpMarketplaceNameSchema,
|
|
312
|
+
plugins: z.array(OmpCatalogPluginSchema).max(OMP_CATALOG_PLUGIN_LIMIT),
|
|
313
|
+
error: z.string().max(256).optional(),
|
|
314
|
+
})
|
|
315
|
+
.strict();
|
|
316
|
+
export type OmpCatalogState = z.infer<typeof OmpCatalogStateSchema>;
|
|
317
|
+
|
|
318
|
+
export const browseOmpMarketplace = defineRpc({
|
|
319
|
+
name: "paseo-omp.browse-marketplace",
|
|
320
|
+
input: z
|
|
321
|
+
.object({ store: OmpStoreSchema.optional(), marketplace: OmpMarketplaceNameSchema })
|
|
322
|
+
.strict(),
|
|
323
|
+
output: OmpCatalogStateSchema,
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
export const OmpMarketplaceMutationSchema = z.discriminatedUnion("action", [
|
|
327
|
+
z
|
|
328
|
+
.object({
|
|
329
|
+
action: z.literal("add"),
|
|
330
|
+
source: OmpPluginInstallSourceSchema,
|
|
331
|
+
store: OmpStoreSchema.optional(),
|
|
332
|
+
})
|
|
333
|
+
.strict(),
|
|
334
|
+
z
|
|
335
|
+
.object({
|
|
336
|
+
action: z.literal("remove"),
|
|
337
|
+
marketplace: OmpMarketplaceNameSchema,
|
|
338
|
+
store: OmpStoreSchema.optional(),
|
|
339
|
+
})
|
|
340
|
+
.strict(),
|
|
341
|
+
]);
|
|
342
|
+
export type OmpMarketplaceMutation = z.infer<typeof OmpMarketplaceMutationSchema>;
|
|
343
|
+
|
|
344
|
+
export const mutateOmpMarketplace = defineRpc({
|
|
345
|
+
name: "paseo-omp.mutate-marketplace",
|
|
346
|
+
input: OmpMarketplaceMutationSchema,
|
|
347
|
+
output: z
|
|
348
|
+
.object({
|
|
349
|
+
ok: z.boolean(),
|
|
350
|
+
message: z.string().min(1).max(256),
|
|
351
|
+
state: OmpMarketplaceStateSchema,
|
|
352
|
+
})
|
|
353
|
+
.strict(),
|
|
354
|
+
});
|
package/shared/omp-settings.ts
CHANGED
|
@@ -327,12 +327,14 @@ export function formatOmpSettingLabel(path: string): string {
|
|
|
327
327
|
return words ? `${words[0]?.toUpperCase() ?? ""}${words.slice(1)}` : path;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
/**
|
|
331
|
-
export const
|
|
330
|
+
/** Plain wording that replaces OMP's own description (or its absence) for these settings. */
|
|
331
|
+
export const OMP_SETTING_DESCRIPTIONS: Readonly<Record<string, string>> = {
|
|
332
332
|
"session.warnCost":
|
|
333
333
|
"Warn once when a session's spend reaches this many US dollars. Leave unset for no warning. Applies to every session, including subagents, and takes effect on the next request.",
|
|
334
334
|
"session.maxCost":
|
|
335
335
|
"Stop a session from sending new model requests once its spend reaches this many US dollars. Leave unset for no limit. Requests already in flight can finish past the limit; raise or reset the value to continue.",
|
|
336
|
+
"secrets.enabled":
|
|
337
|
+
"Hides keys, tokens and passwords from the model provider. Values are swapped for placeholders before text is sent and restored when the model uses them in a tool call. OMP detects environment variables named like KEY, TOKEN, SECRET or PASSWORD, passwords of 8 or more characters in connection URLs held in environment variables, and common token formats. Custom rules live in secrets.yml in the OMP agent folder or a project's .omp folder; edit that file by hand, Paseo never shows it. Best effort, not a guarantee: system prompts, static tool definitions and images are not covered. Applies to new sessions.",
|
|
336
338
|
};
|
|
337
339
|
|
|
338
340
|
export const listOmpSettings = defineRpc({
|