@omercnet/paseo-omp 5.4.0-next.397.1 → 5.4.0-next.400.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 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
+ }
@@ -44,6 +44,7 @@ import { normalizeOmpModels } from "./omp-model-picker-state";
44
44
  import { OmpPluginManagerSection } from "./omp-plugin-manager";
45
45
  import { type OmpModelCatalogState, StructuredRoutingEditor } from "./omp-routing-editor";
46
46
  import { OmpRulesSection } from "./omp-rules-section";
47
+ import { OmpSkillsSection } from "./omp-skills-section";
47
48
  import { OmpStorePicker } from "./omp-store-picker";
48
49
  import { ompStoreKey } from "./omp-store-state";
49
50
  import {
@@ -1172,6 +1173,9 @@ function OmpConfigContent({
1172
1173
  {view === "rules" ? (
1173
1174
  <OmpRulesSection theme={theme} styles={styles} cwd={cwd} store={store} />
1174
1175
  ) : null}
1176
+ {view === "skills" ? (
1177
+ <OmpSkillsSection theme={theme} styles={styles} cwd={cwd} store={store} />
1178
+ ) : null}
1175
1179
  {view === "composer" && !cwd && onComposerPillSettingsChange ? (
1176
1180
  <ComposerPillSettingsSection theme={theme} onChange={onComposerPillSettingsChange} />
1177
1181
  ) : null}
@@ -5,6 +5,7 @@ export type OmpConfigSurfaceView =
5
5
  | "plugin"
6
6
  | "plugins"
7
7
  | "rules"
8
+ | "skills"
8
9
  | "composer"
9
10
  | "configuration"
10
11
  | "diagnostics"
@@ -17,6 +18,7 @@ const SURFACE_VIEWS: readonly { id: OmpConfigSurfaceView; label: string }[] = [
17
18
  { id: "plugin", label: "Plugin" },
18
19
  { id: "plugins", label: "OMP plugins" },
19
20
  { id: "rules", label: "Rules" },
21
+ { id: "skills", label: "Skills" },
20
22
  { id: "composer", label: "Composer" },
21
23
  { id: "configuration", label: "Configuration" },
22
24
  { id: "diagnostics", label: "Diagnostics" },
@@ -0,0 +1,195 @@
1
+ import { type PluginSurfaceProps, useRpc } from "@getpaseo/plugin/client";
2
+ import {
3
+ SettingsAction,
4
+ SettingsCard,
5
+ SettingsSection,
6
+ SettingsSwitch,
7
+ useToast,
8
+ } from "@getpaseo/plugin/client/ui";
9
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
10
+ import { useState } from "react";
11
+ import { Text, View } from "react-native";
12
+ import {
13
+ deleteOmpManagedSkill,
14
+ listOmpSkills,
15
+ type OmpSkill,
16
+ type OmpSkillOff,
17
+ SKILL_ENTRY_PREFIX,
18
+ setOmpSkillEnabled,
19
+ } from "../shared/omp-skills";
20
+ import type { OmpStore } from "../shared/omp-store";
21
+ import { ConfirmModal, describe } from "./omp-accounts-section";
22
+ import type { OmpConfigStyles } from "./omp-config-styles";
23
+ import { ompStoreKey } from "./omp-store-state";
24
+
25
+ type Theme = PluginSurfaceProps["theme"];
26
+
27
+ const SKILLS_KEY = ["paseo-omp", "skills"] as const;
28
+
29
+ const INFO =
30
+ "OMP hides turned-off skills from its own list, so they are read from skills.ignoredSkills and disabledExtensions. In a workspace, a change is saved to the project's .omp/config.yml with the whole list, because a project list replaces the user list. Changes apply to new sessions, or after an agent reload.";
31
+
32
+ interface SkillGroup {
33
+ title: string;
34
+ skills: OmpSkill[];
35
+ }
36
+
37
+ function groupSkills(skills: readonly OmpSkill[]): SkillGroup[] {
38
+ const groups: SkillGroup[] = [
39
+ { title: "Project", skills: skills.filter((s) => !s.managed && s.level === "project") },
40
+ { title: "User", skills: skills.filter((s) => !s.managed && s.level === "user") },
41
+ { title: "Learned by the agent", skills: skills.filter((s) => s.managed) },
42
+ { title: "Other", skills: skills.filter((s) => !s.managed && s.level === "other") },
43
+ ];
44
+ return groups.filter((group) => group.skills.length > 0);
45
+ }
46
+
47
+ function skillHint(skill: OmpSkill): string {
48
+ const origin = skill.managed ? "Learned by the agent" : skill.source;
49
+ return skill.description ? `${origin} · ${skill.description}` : origin;
50
+ }
51
+
52
+ function offLabel(off: OmpSkillOff): string {
53
+ return off.list === "disabledExtensions" ? off.entry.slice(SKILL_ENTRY_PREFIX.length) : off.entry;
54
+ }
55
+
56
+ function offHint(off: OmpSkillOff): string {
57
+ const pattern = offLabel(off).includes("*") ? "Pattern, may match several skills · " : "";
58
+ return `${pattern}Listed in ${off.list}`;
59
+ }
60
+
61
+ export function OmpSkillsSection({
62
+ theme,
63
+ styles,
64
+ cwd,
65
+ store,
66
+ }: {
67
+ theme: Theme;
68
+ styles: OmpConfigStyles;
69
+ cwd?: string;
70
+ store?: OmpStore;
71
+ }) {
72
+ const toast = useToast();
73
+ const queryClient = useQueryClient();
74
+ const load = useRpc(listOmpSkills);
75
+ const setEnabled = useRpc(setOmpSkillEnabled);
76
+ const remove = useRpc(deleteOmpManagedSkill);
77
+ const [pendingDelete, setPendingDelete] = useState<OmpSkill | null>(null);
78
+ const scope = cwd ? { cwd } : {};
79
+ const skills = useQuery({
80
+ queryKey: [...SKILLS_KEY, ompStoreKey(store), cwd ?? "global"],
81
+ queryFn: () => load({ store, ...scope }),
82
+ });
83
+ const toggle = useMutation({
84
+ mutationKey: [...SKILLS_KEY, "toggle"],
85
+ mutationFn: (change: { list: OmpSkillOff["list"]; entry: string; enabled: boolean }) =>
86
+ setEnabled({ store, ...scope, ...change }),
87
+ onSuccess: async (result) => {
88
+ if (result.status === "error") toast.error(result.message);
89
+ await queryClient.invalidateQueries({ queryKey: SKILLS_KEY });
90
+ },
91
+ onError: (error) => toast.error(describe(error)),
92
+ });
93
+ const del = useMutation({
94
+ mutationKey: [...SKILLS_KEY, "delete"],
95
+ mutationFn: (skill: OmpSkill) => remove({ store, path: skill.path }),
96
+ onSuccess: async (result) => {
97
+ if (result.status === "error") toast.error(result.message);
98
+ else toast.show("Skill deleted", { variant: "success" });
99
+ await queryClient.invalidateQueries({ queryKey: SKILLS_KEY });
100
+ },
101
+ onError: (error) => toast.error(describe(error)),
102
+ onSettled: () => setPendingDelete(null),
103
+ });
104
+
105
+ const list = skills.data;
106
+ const busy = toggle.isPending || del.isPending;
107
+ return (
108
+ <View style={{ gap: 12 }}>
109
+ <SettingsSection title="Skills" info={INFO}>
110
+ <Text style={styles.muted}>
111
+ Skills are listed by omp, in this {cwd ? "workspace" : "user"} scope.
112
+ </Text>
113
+ </SettingsSection>
114
+ {skills.isLoading ? <Text style={styles.muted}>Loading skills...</Text> : null}
115
+ {skills.error ? (
116
+ <Text accessibilityRole="alert" style={styles.error}>
117
+ Could not list OMP's skills.
118
+ </Text>
119
+ ) : null}
120
+ {list?.status === "error" ? (
121
+ <Text accessibilityRole="alert" style={styles.error}>
122
+ {list.message}
123
+ </Text>
124
+ ) : null}
125
+ {list?.status === "ready" ? (
126
+ <>
127
+ {list.skills.length === 0 ? <Text style={styles.muted}>No skills found</Text> : null}
128
+ {groupSkills(list.skills).map((group) => (
129
+ <SettingsSection key={group.title} title={group.title}>
130
+ <SettingsCard>
131
+ {group.skills.map((skill) => (
132
+ <View key={`${skill.source}/${skill.path}`}>
133
+ <SettingsSwitch
134
+ label={skill.name}
135
+ hint={skillHint(skill)}
136
+ value
137
+ disabled={busy}
138
+ onValueChange={() =>
139
+ toggle.mutate({
140
+ list: "skills.ignoredSkills",
141
+ entry: skill.name,
142
+ enabled: false,
143
+ })
144
+ }
145
+ />
146
+ {skill.managed ? (
147
+ <SettingsAction
148
+ label={`Delete ${skill.name}`}
149
+ hint="Deletes the skill folder the agent wrote, for the terminal too"
150
+ actionLabel="Delete"
151
+ disabled={busy}
152
+ onPress={() => setPendingDelete(skill)}
153
+ />
154
+ ) : null}
155
+ </View>
156
+ ))}
157
+ </SettingsCard>
158
+ </SettingsSection>
159
+ ))}
160
+ <SettingsSection title="Turned off">
161
+ <SettingsCard>
162
+ {list.off.length === 0 ? (
163
+ <Text style={styles.muted}>No skills turned off</Text>
164
+ ) : (
165
+ list.off.map((off) => (
166
+ <SettingsSwitch
167
+ key={`${off.list}/${off.entry}`}
168
+ label={offLabel(off)}
169
+ hint={offHint(off)}
170
+ value={false}
171
+ disabled={busy}
172
+ onValueChange={() => toggle.mutate({ ...off, enabled: true })}
173
+ />
174
+ ))
175
+ )}
176
+ </SettingsCard>
177
+ </SettingsSection>
178
+ </>
179
+ ) : null}
180
+ {pendingDelete ? (
181
+ <ConfirmModal
182
+ styles={styles}
183
+ theme={theme}
184
+ title={`Delete ${pendingDelete.name}?`}
185
+ body="This deletes the skill folder from OMP's managed skills, for the terminal too. It cannot be undone."
186
+ confirmLabel="Delete"
187
+ tone="danger"
188
+ busy={del.isPending}
189
+ onConfirm={() => del.mutate(pendingDelete)}
190
+ onCancel={() => setPendingDelete(null)}
191
+ />
192
+ ) : null}
193
+ </View>
194
+ );
195
+ }
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
@@ -17,6 +17,11 @@ import {
17
17
  } from "./server/omp-plugins";
18
18
  import { resolveListOmpRules } from "./server/omp-rules";
19
19
  import { resolveListOmpSettings, resolveUpdateOmpSettings } from "./server/omp-settings";
20
+ import {
21
+ resolveDeleteOmpManagedSkill,
22
+ resolveListOmpSkills,
23
+ resolveSetOmpSkillEnabled,
24
+ } from "./server/omp-skills";
20
25
  import { OmpOperationalFailureCollector } from "./server/operational-failure-diagnostics";
21
26
  import { withOmpStore } from "./server/paths";
22
27
  import { OmpProtocolViolationCollector } from "./server/protocol-violation-diagnostics";
@@ -71,6 +76,7 @@ import {
71
76
  } from "./shared/omp-plugins";
72
77
  import { listOmpRules } from "./shared/omp-rules";
73
78
  import { listOmpSettings, updateOmpSettings } from "./shared/omp-settings";
79
+ import { deleteOmpManagedSkill, listOmpSkills, setOmpSkillEnabled } from "./shared/omp-skills";
74
80
  import { listOmpStores, type OmpStore } from "./shared/omp-store";
75
81
  import { getOmpProviderHealth } from "./shared/provider-diagnostics";
76
82
  import { getOmpImage } from "./shared/provider-image";
@@ -189,6 +195,9 @@ export default function contribute(server: PluginServerContext) {
189
195
  server.handle(listOmpModels, scoped(resolveListOmpModels));
190
196
  server.handle(listOmpPlugins, scoped(resolveListOmpPlugins));
191
197
  server.handle(listOmpRules, scoped(resolveListOmpRules));
198
+ server.handle(listOmpSkills, scoped(resolveListOmpSkills));
199
+ server.handle(setOmpSkillEnabled, scoped(resolveSetOmpSkillEnabled));
200
+ server.handle(deleteOmpManagedSkill, scoped(resolveDeleteOmpManagedSkill));
192
201
  server.handle(inspectOmpPluginConfig, scoped(resolveInspectOmpPluginConfig));
193
202
  server.handle(mutateOmpPlugin, scoped(resolveMutateOmpPlugin));
194
203
  server.handle(mutateOmpPluginConfig, scoped(resolveMutateOmpPluginConfig));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omercnet/paseo-omp",
3
- "version": "5.4.0-next.397.1",
3
+ "version": "5.4.0-next.400.1",
4
4
  "type": "module",
5
5
  "description": "Paseo integration for OMP, including its direct provider and workspace tooling.",
6
6
  "license": "MIT",
@@ -106,8 +106,8 @@ function toWatchRule(rule: WatchRule, cwd: string | undefined): OmpRule {
106
106
  };
107
107
  }
108
108
 
109
- async function runJson(
110
- dependencies: OmpRulesDependencies,
109
+ export async function runJson(
110
+ dependencies: Pick<OmpRulesDependencies, "run">,
111
111
  executable: string,
112
112
  args: readonly string[],
113
113
  cwd: string,
@@ -125,8 +125,8 @@ async function runJson(
125
125
  }
126
126
  }
127
127
 
128
- async function readSetting<T>(
129
- dependencies: OmpRulesDependencies,
128
+ export async function readSetting<T>(
129
+ dependencies: Pick<OmpRulesDependencies, "run">,
130
130
  executable: string,
131
131
  path: string,
132
132
  schema: z.ZodType<{ value: T }>,
@@ -373,10 +373,15 @@ async function listRulesIn(
373
373
  };
374
374
  }
375
375
 
376
- async function listRules(
376
+ /**
377
+ * Runs `operation` where OMP finds only this scope: the workspace, or an empty directory so no
378
+ * project's files leak into the global (user-level) view.
379
+ */
380
+ export async function inOmpScope<T>(
377
381
  cwd: string | undefined,
378
- dependencies: OmpRulesDependencies,
379
- ): Promise<OmpRulesList> {
382
+ dependencies: Pick<OmpRulesDependencies, "makeScratchDir" | "removeDir">,
383
+ operation: (runIn: string) => Promise<T>,
384
+ ): Promise<T> {
380
385
  if (cwd !== undefined) {
381
386
  const isDirectory =
382
387
  isAbsolute(cwd) &&
@@ -386,13 +391,12 @@ async function listRules(
386
391
  () => false,
387
392
  ));
388
393
  if (!isDirectory) throw new OmpRulesError("The workspace path is invalid");
389
- return listRulesIn(cwd, cwd, dependencies);
394
+ return operation(cwd);
390
395
  }
391
- // An empty directory keeps every project's rules out of the global listing.
392
396
  const prefix = join(tmpdir(), "paseo-omp-rules-");
393
397
  const scratch = await dependencies.makeScratchDir(prefix);
394
398
  try {
395
- return await listRulesIn(scratch, undefined, dependencies);
399
+ return await operation(scratch);
396
400
  } finally {
397
401
  // Only ever delete the directory this call created directly under the system temp directory.
398
402
  const ours =
@@ -409,14 +413,16 @@ export async function listOmpRulesWithDependencies(
409
413
  dependencies: OmpRulesDependencies,
410
414
  ): Promise<OmpRulesList> {
411
415
  try {
412
- return await listRules(input.cwd, dependencies);
416
+ return await inOmpScope(input.cwd, dependencies, (runIn) =>
417
+ listRulesIn(runIn, input.cwd, dependencies),
418
+ );
413
419
  } catch (error) {
414
420
  if (error instanceof OmpRulesError) return { status: "error", message: error.message };
415
421
  throw error;
416
422
  }
417
423
  }
418
424
 
419
- const DEFAULT_DEPENDENCIES: OmpRulesDependencies = {
425
+ export const ompCommandDependencies: OmpRulesDependencies = {
420
426
  resolveExecutable: resolveOmpExecutable,
421
427
  run: (executable, args, cwd) =>
422
428
  runBounded(
@@ -434,5 +440,5 @@ const DEFAULT_DEPENDENCIES: OmpRulesDependencies = {
434
440
  };
435
441
 
436
442
  export function resolveListOmpRules(input: RpcInput<typeof listOmpRules>): Promise<OmpRulesList> {
437
- return listOmpRulesWithDependencies(input, DEFAULT_DEPENDENCIES);
443
+ return listOmpRulesWithDependencies(input, ompCommandDependencies);
438
444
  }
@@ -7,7 +7,7 @@ import { parseDocument, parse as parseYaml } from "yaml";
7
7
  import {
8
8
  isOmpStructuredSettingPath,
9
9
  type listOmpSettings,
10
- OMP_SETTING_FALLBACK_DESCRIPTIONS,
10
+ OMP_SETTING_DESCRIPTIONS,
11
11
  OMP_SETTINGS_CATALOG_VERSION,
12
12
  type OmpSetting,
13
13
  type OmpSettingType,
@@ -64,7 +64,7 @@ export interface OmpSettingsDependencies {
64
64
  validateProjectConfig(executable: string, path: string): Promise<BoundedRun>;
65
65
  }
66
66
 
67
- async function readProjectConfigText(path: string): Promise<string> {
67
+ export async function readProjectConfigText(path: string): Promise<string> {
68
68
  try {
69
69
  return await readFile(path, "utf8");
70
70
  } catch (error) {
@@ -83,12 +83,16 @@ function runSucceeded(result: BoundedRun): boolean {
83
83
  );
84
84
  }
85
85
 
86
- async function writeProjectChanges(
86
+ export type ProjectChange =
87
+ | { operation: "set"; path: string; value: unknown }
88
+ | { operation: "reset"; path: string };
89
+
90
+ export async function writeProjectChanges(
87
91
  cwd: string,
88
92
  expectedText: string,
89
- changes: RpcInput<typeof updateOmpSettings>["changes"],
93
+ changes: readonly ProjectChange[],
90
94
  executable: string,
91
- dependencies: OmpSettingsDependencies,
95
+ dependencies: Pick<OmpSettingsDependencies, "validateProjectConfig">,
92
96
  ): Promise<"applied" | "conflict"> {
93
97
  const path = join(cwd, ".omp", "config.yml");
94
98
  try {
@@ -193,9 +197,8 @@ export function parseOmpSettingsList(raw: unknown): ParsedOmpSettings {
193
197
  path,
194
198
  type: parsedType.data,
195
199
  description:
196
- typeof entry.description === "string" && entry.description
197
- ? entry.description
198
- : (OMP_SETTING_FALLBACK_DESCRIPTIONS[path] ?? ""),
200
+ OMP_SETTING_DESCRIPTIONS[path] ??
201
+ (typeof entry.description === "string" ? entry.description : ""),
199
202
  ...(redacted
200
203
  ? { redacted: true, ...(configured === undefined ? {} : { configured }) }
201
204
  : { value: entry.value }),
@@ -242,7 +245,7 @@ async function validateOmpProjectConfig(executable: string, path: string): Promi
242
245
  );
243
246
  }
244
247
 
245
- const DEFAULT_DEPENDENCIES: OmpSettingsDependencies = {
248
+ export const ompSettingsDependencies: OmpSettingsDependencies = {
246
249
  resolveExecutable: resolveOmpExecutable,
247
250
  runConfig: runOmpConfig,
248
251
  validateProjectConfig: validateOmpProjectConfig,
@@ -351,7 +354,7 @@ export async function listOmpSettingsWithDependencies(
351
354
  export async function resolveListOmpSettings(
352
355
  input: RpcInput<typeof listOmpSettings>,
353
356
  ): Promise<CatalogResult> {
354
- return listOmpSettingsWithDependencies(input, DEFAULT_DEPENDENCIES);
357
+ return listOmpSettingsWithDependencies(input, ompSettingsDependencies);
355
358
  }
356
359
 
357
360
  export async function updateOmpSettingsWithDependencies(
@@ -504,10 +507,15 @@ export async function updateOmpSettingsWithDependencies(
504
507
 
505
508
  const settingsMutationQueue = new SerialMutationQueue();
506
509
 
510
+ /** Settings and skill edits share this queue so they never write one config file at once. */
511
+ export function runSettingsMutation<T>(operation: () => Promise<T>): Promise<T> {
512
+ return settingsMutationQueue.run(operation);
513
+ }
514
+
507
515
  export function resolveUpdateOmpSettings(
508
516
  input: RpcInput<typeof updateOmpSettings>,
509
517
  ): Promise<OmpSettingsUpdateResult> {
510
- return settingsMutationQueue.run(() =>
511
- updateOmpSettingsWithDependencies(input, DEFAULT_DEPENDENCIES),
518
+ return runSettingsMutation(() =>
519
+ updateOmpSettingsWithDependencies(input, ompSettingsDependencies),
512
520
  );
513
521
  }
@@ -0,0 +1,259 @@
1
+ import { lstat, realpath } from "node:fs/promises";
2
+ import { basename, dirname, join, resolve } from "node:path";
3
+ import type { RpcInput } from "@getpaseo/plugin";
4
+ import { z } from "zod";
5
+ import type {
6
+ deleteOmpManagedSkill,
7
+ listOmpSkills,
8
+ OmpSkill,
9
+ OmpSkillList,
10
+ OmpSkillOff,
11
+ OmpSkillsList,
12
+ setOmpSkillEnabled,
13
+ } from "../shared/omp-skills";
14
+ import { SKILL_ENTRY_PREFIX } from "../shared/omp-skills";
15
+ import {
16
+ inOmpScope,
17
+ type OmpRulesDependencies,
18
+ ompCommandDependencies,
19
+ readSetting,
20
+ runJson,
21
+ } from "./omp-rules";
22
+ import {
23
+ type OmpSettingsDependencies,
24
+ ompSettingsDependencies,
25
+ readProjectConfigText,
26
+ runSettingsMutation,
27
+ writeProjectChanges,
28
+ } from "./omp-settings";
29
+ import { ompAgentDir } from "./paths";
30
+ import { OmpPublicError } from "./provider/security";
31
+
32
+ const MAX_SKILLS = 500;
33
+ const MAX_OFF_ENTRIES = 200;
34
+ const MAX_TEXT_CHARS = 2_000;
35
+ const MANAGED_SOURCE = "omp-managed";
36
+ const UNREADABLE_CONFIG = "The workspace OMP configuration could not be read";
37
+
38
+ export class OmpSkillsError extends OmpPublicError {}
39
+
40
+ export interface OmpSkillsDependencies extends OmpRulesDependencies {
41
+ validateProjectConfig: OmpSettingsDependencies["validateProjectConfig"];
42
+ }
43
+
44
+ /** One entry of `omp skill list --json`. */
45
+ const SkillEntrySchema = z.object({
46
+ name: z.string().min(1).max(256),
47
+ description: z
48
+ .string()
49
+ .nullish()
50
+ .transform((text) => (text ?? "").slice(0, MAX_TEXT_CHARS)),
51
+ baseDir: z.string().min(1).max(4_096),
52
+ source: z.string().min(1).max(128),
53
+ });
54
+ const SkillListSchema = z.object({ skills: z.array(z.unknown()) });
55
+ const ListSettingSchema = z.object({ value: z.array(z.string()) });
56
+
57
+ /** A source reads `<provider>:<level>`, such as `native:project` or `omp-managed:user`. */
58
+ function toSkill(entry: z.infer<typeof SkillEntrySchema>): OmpSkill {
59
+ const split = entry.source.lastIndexOf(":");
60
+ const provider = split < 0 ? entry.source : entry.source.slice(0, split);
61
+ const scope = split < 0 ? "" : entry.source.slice(split + 1);
62
+ return {
63
+ name: entry.name,
64
+ description: entry.description,
65
+ source: provider,
66
+ level: scope === "project" || scope === "user" ? scope : "other",
67
+ path: entry.baseDir,
68
+ managed: provider === MANAGED_SOURCE,
69
+ };
70
+ }
71
+
72
+ async function listSkills(
73
+ dependencies: OmpSkillsDependencies,
74
+ executable: string,
75
+ runIn: string,
76
+ ): Promise<OmpSkill[]> {
77
+ const raw = await runJson(dependencies, executable, ["skill", "list", "--json"], runIn);
78
+ const parsed = SkillListSchema.safeParse(raw);
79
+ if (!parsed.success) throw new OmpSkillsError("omp skill list gave output the plugin can't read");
80
+ return parsed.data.skills.slice(0, MAX_SKILLS).flatMap((entry) => {
81
+ const skill = SkillEntrySchema.safeParse(entry);
82
+ return skill.success ? [toSkill(skill.data)] : [];
83
+ });
84
+ }
85
+
86
+ function readList(
87
+ dependencies: OmpSkillsDependencies,
88
+ executable: string,
89
+ list: OmpSkillList,
90
+ runIn: string,
91
+ ): Promise<string[]> {
92
+ return readSetting(dependencies, executable, list, ListSettingSchema, runIn);
93
+ }
94
+
95
+ /** OMP trims each entry. Only `skill:` entries of `disabledExtensions` concern skills. */
96
+ function offEntries(ignored: readonly string[], extensions: readonly string[]): OmpSkillOff[] {
97
+ const entries: OmpSkillOff[] = [
98
+ ...ignored.map((entry) => ({ list: "skills.ignoredSkills" as const, entry: entry.trim() })),
99
+ ...extensions
100
+ .map((entry) => entry.trim())
101
+ .filter(
102
+ (entry) => entry.startsWith(SKILL_ENTRY_PREFIX) && entry.length > SKILL_ENTRY_PREFIX.length,
103
+ )
104
+ .map((entry) => ({ list: "disabledExtensions" as const, entry })),
105
+ ];
106
+ const seen = new Set<string>();
107
+ return entries
108
+ .filter(({ list, entry }) => {
109
+ const key = `${list}\0${entry}`;
110
+ if (entry === "" || seen.has(key)) return false;
111
+ seen.add(key);
112
+ return true;
113
+ })
114
+ .slice(0, MAX_OFF_ENTRIES)
115
+ .map(({ list, entry }) => ({ list, entry: entry.slice(0, MAX_TEXT_CHARS) }));
116
+ }
117
+
118
+ async function requireExecutable(dependencies: OmpSkillsDependencies): Promise<string> {
119
+ const executable = await dependencies.resolveExecutable();
120
+ if (!executable) throw new OmpSkillsError("The omp command was not found on this host");
121
+ return executable;
122
+ }
123
+
124
+ export async function listOmpSkillsWithDependencies(
125
+ input: RpcInput<typeof listOmpSkills>,
126
+ dependencies: OmpSkillsDependencies,
127
+ ): Promise<OmpSkillsList> {
128
+ try {
129
+ const executable = await requireExecutable(dependencies);
130
+ return await inOmpScope(input.cwd, dependencies, async (runIn) => {
131
+ const [skills, ignored, extensions] = await Promise.all([
132
+ listSkills(dependencies, executable, runIn),
133
+ readList(dependencies, executable, "skills.ignoredSkills", runIn),
134
+ readList(dependencies, executable, "disabledExtensions", runIn),
135
+ ]);
136
+ return { status: "ready" as const, skills, off: offEntries(ignored, extensions) };
137
+ });
138
+ } catch (error) {
139
+ if (error instanceof OmpPublicError) return { status: "error", message: error.message };
140
+ throw error;
141
+ }
142
+ }
143
+
144
+ /**
145
+ * A project list replaces the user list, so a workspace edit starts from the effective list and
146
+ * saves all of it to the project file. Starting from the project file alone would turn every
147
+ * skill the user turned off back on.
148
+ */
149
+ async function writeList(
150
+ input: RpcInput<typeof setOmpSkillEnabled>,
151
+ dependencies: OmpSkillsDependencies,
152
+ executable: string,
153
+ runIn: string,
154
+ ): Promise<void> {
155
+ const projectPath = input.cwd ? join(input.cwd, ".omp", "config.yml") : null;
156
+ const snapshot = projectPath
157
+ ? await readProjectConfigText(projectPath).catch(() => {
158
+ throw new OmpSkillsError(UNREADABLE_CONFIG);
159
+ })
160
+ : "";
161
+ const current = await readList(dependencies, executable, input.list, runIn);
162
+ const kept = current.filter((entry) => entry.trim() !== input.entry);
163
+ const next = input.enabled ? kept : [...kept, input.entry];
164
+ if (input.cwd) {
165
+ const outcome = await writeProjectChanges(
166
+ input.cwd,
167
+ snapshot,
168
+ [{ operation: "set", path: input.list, value: next }],
169
+ executable,
170
+ dependencies,
171
+ ).catch((error: unknown) => {
172
+ // The writer's messages are written for the user, as in the settings editor.
173
+ throw new OmpSkillsError(
174
+ error instanceof Error ? error.message : "Could not update workspace settings.",
175
+ );
176
+ });
177
+ if (outcome === "conflict") {
178
+ throw new OmpSkillsError("The workspace configuration changed. Try again");
179
+ }
180
+ return;
181
+ }
182
+ const run = await dependencies.run(
183
+ executable,
184
+ ["config", "set", input.list, "--json", "--", JSON.stringify(next)],
185
+ runIn,
186
+ );
187
+ if (run.outcome !== "exited" || run.exitCode !== 0) {
188
+ throw new OmpSkillsError("OMP rejected the change");
189
+ }
190
+ }
191
+
192
+ export async function setOmpSkillEnabledWithDependencies(
193
+ input: RpcInput<typeof setOmpSkillEnabled>,
194
+ dependencies: OmpSkillsDependencies,
195
+ ): Promise<{ status: "ok" } | { status: "error"; message: string }> {
196
+ try {
197
+ if (input.list === "disabledExtensions" && !input.entry.startsWith(SKILL_ENTRY_PREFIX)) {
198
+ throw new OmpSkillsError("That entry is not a skill");
199
+ }
200
+ const executable = await requireExecutable(dependencies);
201
+ await inOmpScope(input.cwd, dependencies, (runIn) =>
202
+ runSettingsMutation(() => writeList(input, dependencies, executable, runIn)),
203
+ );
204
+ return { status: "ok" };
205
+ } catch (error) {
206
+ if (error instanceof OmpPublicError) return { status: "error", message: error.message };
207
+ throw error;
208
+ }
209
+ }
210
+
211
+ /**
212
+ * Deletes one agent-learned skill folder. The path must be a managed skill OMP lists right now
213
+ * and a real directory directly inside `<agent dir>/managed-skills`, so a client can never name
214
+ * anything else.
215
+ */
216
+ export async function deleteOmpManagedSkillWithDependencies(
217
+ input: RpcInput<typeof deleteOmpManagedSkill>,
218
+ dependencies: OmpSkillsDependencies,
219
+ ): Promise<{ status: "ok" } | { status: "error"; message: string }> {
220
+ try {
221
+ const executable = await requireExecutable(dependencies);
222
+ const skills = await inOmpScope(undefined, dependencies, (runIn) =>
223
+ listSkills(dependencies, executable, runIn),
224
+ );
225
+ const skill = skills.find((candidate) => candidate.managed && candidate.path === input.path);
226
+ if (!skill) throw new OmpSkillsError("That is not a skill the agent learned");
227
+ const root = join(await realpath(ompAgentDir()), "managed-skills");
228
+ const folder = await lstat(skill.path).catch(() => null);
229
+ const inside =
230
+ folder?.isDirectory() === true &&
231
+ skill.path === resolve(skill.path) &&
232
+ basename(skill.path) !== "" &&
233
+ (await realpath(dirname(skill.path))) === root;
234
+ if (!inside)
235
+ throw new OmpSkillsError("That skill folder is not in OMP's managed skills folder");
236
+ await dependencies.removeDir(skill.path);
237
+ return { status: "ok" };
238
+ } catch (error) {
239
+ if (error instanceof OmpPublicError) return { status: "error", message: error.message };
240
+ throw error;
241
+ }
242
+ }
243
+
244
+ const DEFAULT_DEPENDENCIES: OmpSkillsDependencies = {
245
+ ...ompCommandDependencies,
246
+ validateProjectConfig: ompSettingsDependencies.validateProjectConfig,
247
+ };
248
+
249
+ export function resolveListOmpSkills(input: RpcInput<typeof listOmpSkills>) {
250
+ return listOmpSkillsWithDependencies(input, DEFAULT_DEPENDENCIES);
251
+ }
252
+
253
+ export function resolveSetOmpSkillEnabled(input: RpcInput<typeof setOmpSkillEnabled>) {
254
+ return setOmpSkillEnabledWithDependencies(input, DEFAULT_DEPENDENCIES);
255
+ }
256
+
257
+ export function resolveDeleteOmpManagedSkill(input: RpcInput<typeof deleteOmpManagedSkill>) {
258
+ return deleteOmpManagedSkillWithDependencies(input, DEFAULT_DEPENDENCIES);
259
+ }
@@ -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.397.1"; // x-release-please-version
2
+ export const PASEO_OMP_PACKAGE_VERSION = "5.4.0-next.400.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
+ }
@@ -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
- /** OMP ships these without a description; unset means no cap. */
331
- export const OMP_SETTING_FALLBACK_DESCRIPTIONS: Readonly<Record<string, string>> = {
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({
@@ -0,0 +1,80 @@
1
+ import { defineRpc } from "@getpaseo/plugin";
2
+ import { z } from "zod";
3
+ import { OmpWorkspaceCwdSchema } from "./hub";
4
+ import { OmpStoreSchema } from "./omp-store";
5
+
6
+ /** A `disabledExtensions` entry for a skill reads `skill:<name>`. */
7
+ export const SKILL_ENTRY_PREFIX = "skill:";
8
+
9
+ export const OmpSkillLevelSchema = z.enum(["project", "user", "other"]);
10
+ export type OmpSkillLevel = z.infer<typeof OmpSkillLevelSchema>;
11
+
12
+ export const OmpSkillSchema = z.object({
13
+ name: z.string(),
14
+ description: z.string(),
15
+ /** OMP's provider id, such as `native`, `claude`, or `omp-managed`. */
16
+ source: z.string(),
17
+ level: OmpSkillLevelSchema,
18
+ /** The skill's folder. */
19
+ path: z.string(),
20
+ /** Written by the agent through autolearn (`omp-managed`); only these can be deleted here. */
21
+ managed: z.boolean(),
22
+ });
23
+ export type OmpSkill = z.infer<typeof OmpSkillSchema>;
24
+
25
+ /** The two lists that turn a skill off. A `disabledExtensions` entry reads `skill:<name>`. */
26
+ export const OmpSkillListSchema = z.enum(["skills.ignoredSkills", "disabledExtensions"]);
27
+ export type OmpSkillList = z.infer<typeof OmpSkillListSchema>;
28
+
29
+ /** OMP drops turned-off skills from its listing, so only the list entry is known. */
30
+ export const OmpSkillOffSchema = z.object({
31
+ list: OmpSkillListSchema,
32
+ /** The entry as written: a name or a glob, with `skill:` in `disabledExtensions`. */
33
+ entry: z.string(),
34
+ });
35
+ export type OmpSkillOff = z.infer<typeof OmpSkillOffSchema>;
36
+
37
+ export const OmpSkillsListSchema = z.discriminatedUnion("status", [
38
+ z.object({
39
+ status: z.literal("ready"),
40
+ skills: z.array(OmpSkillSchema),
41
+ off: z.array(OmpSkillOffSchema),
42
+ }),
43
+ z.object({ status: z.literal("error"), message: z.string() }),
44
+ ]);
45
+ export type OmpSkillsList = z.infer<typeof OmpSkillsListSchema>;
46
+
47
+ const OmpSkillsResultSchema = z.discriminatedUnion("status", [
48
+ z.object({ status: z.literal("ok") }),
49
+ z.object({ status: z.literal("error"), message: z.string() }),
50
+ ]);
51
+
52
+ const ScopeSchema = { store: OmpStoreSchema.optional(), cwd: OmpWorkspaceCwdSchema.optional() };
53
+
54
+ export const listOmpSkills = defineRpc({
55
+ name: "paseo-omp.list-skills",
56
+ input: z.object(ScopeSchema).strict(),
57
+ output: OmpSkillsListSchema,
58
+ });
59
+
60
+ /** Off adds `entry` to `list`; on removes it. A workspace writes its own `.omp/config.yml`. */
61
+ export const setOmpSkillEnabled = defineRpc({
62
+ name: "paseo-omp.set-skill-enabled",
63
+ input: z
64
+ .object({
65
+ ...ScopeSchema,
66
+ list: OmpSkillListSchema,
67
+ entry: z.string().trim().min(1).max(256),
68
+ enabled: z.boolean(),
69
+ })
70
+ .strict(),
71
+ output: OmpSkillsResultSchema,
72
+ });
73
+
74
+ export const deleteOmpManagedSkill = defineRpc({
75
+ name: "paseo-omp.delete-managed-skill",
76
+ input: z
77
+ .object({ store: OmpStoreSchema.optional(), path: z.string().min(1).max(4_096) })
78
+ .strict(),
79
+ output: OmpSkillsResultSchema,
80
+ });