@omercnet/paseo-omp 5.4.0-next.402.1 → 5.4.0-next.404.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.
@@ -11,6 +11,7 @@ import type { ReactNode } from "react";
11
11
  import { useCallback, useMemo, useState } from "react";
12
12
  import { Pressable, ScrollView, Switch, Text, View } from "react-native";
13
13
  import type { ComposerPillSettings } from "../shared/composer-pill-settings";
14
+ import { listOmpAgents } from "../shared/omp-agents";
14
15
  import { listOmpConfig, type OmpConfig } from "../shared/omp-config";
15
16
  import { listOmpModels } from "../shared/omp-models";
16
17
  import {
@@ -21,7 +22,9 @@ import {
21
22
  OMP_SETTING_CATEGORIES,
22
23
  type OmpSetting,
23
24
  type OmpSettingCategory,
25
+ orderOmpToolSettings,
24
26
  parseOmpStructuredSettingValue,
27
+ structuredSettingType,
25
28
  updateOmpSettings,
26
29
  } from "../shared/omp-settings";
27
30
  import { type OmpStore, storeLabel } from "../shared/omp-store";
@@ -43,7 +46,11 @@ import {
43
46
  import { OmpMcpsSection } from "./omp-mcps-section";
44
47
  import { normalizeOmpModels } from "./omp-model-picker-state";
45
48
  import { OmpPluginManagerSection } from "./omp-plugin-manager";
46
- import { type OmpModelCatalogState, StructuredRoutingEditor } from "./omp-routing-editor";
49
+ import {
50
+ type OmpAgentCatalogState,
51
+ type OmpModelCatalogState,
52
+ StructuredRoutingEditor,
53
+ } from "./omp-routing-editor";
47
54
  import { OmpRulesSection } from "./omp-rules-section";
48
55
  import { OmpSkillsSection } from "./omp-skills-section";
49
56
  import { OmpStorePicker } from "./omp-store-picker";
@@ -814,6 +821,7 @@ function ConfigurationCategory({
814
821
  theme,
815
822
  modelCatalog,
816
823
  modelRoles,
824
+ agentCatalog,
817
825
  disabled,
818
826
  workspaceScoped,
819
827
  onDraft,
@@ -824,6 +832,7 @@ function ConfigurationCategory({
824
832
  theme: PluginSurfaceProps["theme"];
825
833
  modelCatalog: OmpModelCatalogState;
826
834
  modelRoles: Readonly<Record<string, unknown>>;
835
+ agentCatalog: OmpAgentCatalogState;
827
836
  settings: readonly OmpSetting[];
828
837
  drafts: Readonly<Record<string, SettingDraft>>;
829
838
  disabled: boolean;
@@ -855,7 +864,7 @@ function ConfigurationCategory({
855
864
  const structuredEditable =
856
865
  !setting.redacted &&
857
866
  isOmpStructuredSettingPath(setting.path) &&
858
- setting.type === (setting.path === "cycleOrder" ? "array" : "record");
867
+ setting.type === structuredSettingType(setting.path);
859
868
  const settingDocumentation = documentationForSettingPath(setting.path);
860
869
  const draft = drafts[setting.path];
861
870
  return (
@@ -904,6 +913,7 @@ function ConfigurationCategory({
904
913
  theme={theme}
905
914
  modelCatalog={modelCatalog}
906
915
  modelRoles={modelRoles}
916
+ agentCatalog={agentCatalog}
907
917
  onSet={(value) => onDraft(setting.path, { operation: "set", value })}
908
918
  onReset={() => onDraft(setting.path, { operation: "reset" })}
909
919
  />
@@ -972,6 +982,7 @@ function OmpConfigContent({
972
982
  const loadSettings = useRpc(listOmpSettings);
973
983
  const updateSettings = useRpc(updateOmpSettings);
974
984
  const loadModels = useRpc(listOmpModels);
985
+ const loadAgents = useRpc(listOmpAgents);
975
986
  const queryClient = useQueryClient();
976
987
  const context = { store, ...(cwd ? { cwd } : {}) };
977
988
  const pendingMutations = useIsMutating({ mutationKey: ["paseo-omp"] });
@@ -991,6 +1002,18 @@ function OmpConfigContent({
991
1002
  queryFn: () => loadModels(context),
992
1003
  staleTime: 30_000,
993
1004
  });
1005
+ const agentsQuery = useQuery({
1006
+ queryKey: ["paseo-omp", "agents", ompStoreKey(store), cwd ?? "global"],
1007
+ queryFn: () => loadAgents(context),
1008
+ staleTime: 5 * 60_000,
1009
+ });
1010
+ const agentCatalog: OmpAgentCatalogState = {
1011
+ agents: agentsQuery.data?.agents ?? [],
1012
+ loading: agentsQuery.isLoading,
1013
+ ...(agentsQuery.error || agentsQuery.data?.error
1014
+ ? { error: "Could not list every OMP agent. Typed names remain available." }
1015
+ : {}),
1016
+ };
994
1017
  const [view, setView] = useState<SurfaceView>("overview");
995
1018
  const [activeCategory, setActiveCategory] = useState<OmpSettingCategory>("appearance");
996
1019
  const [search, setSearch] = useState("");
@@ -1005,7 +1028,7 @@ function OmpConfigContent({
1005
1028
  : fallbackSettingsFromConfig(configQuery.data?.config);
1006
1029
  const matching = sourceSettings.filter((setting) => {
1007
1030
  if (!normalizedSearch) return true;
1008
- return `${setting.path}\n${setting.description}`
1031
+ return `${setting.path}\n${formatOmpSettingLabel(setting.path)}\n${setting.description}`
1009
1032
  .toLocaleLowerCase()
1010
1033
  .includes(normalizedSearch);
1011
1034
  });
@@ -1016,6 +1039,8 @@ function OmpConfigContent({
1016
1039
  if (group) group.push(setting);
1017
1040
  else byCategory.set(category, [setting]);
1018
1041
  }
1042
+ const tools = byCategory.get("tools");
1043
+ if (tools) byCategory.set("tools", orderOmpToolSettings(tools));
1019
1044
  return { sourceSettings, matching, byCategory };
1020
1045
  }, [configQuery.data?.config, normalizedSearch, settingsQuery.data]);
1021
1046
  const modelCatalog: OmpModelCatalogState = {
@@ -1224,19 +1249,26 @@ function OmpConfigContent({
1224
1249
  accessibilityLabel="Refresh OMP configuration"
1225
1250
  style={styles.refresh}
1226
1251
  disabled={
1227
- configQuery.isFetching || settingsQuery.isFetching || modelsQuery.isFetching
1252
+ configQuery.isFetching ||
1253
+ settingsQuery.isFetching ||
1254
+ modelsQuery.isFetching ||
1255
+ agentsQuery.isFetching
1228
1256
  }
1229
1257
  onPress={() => {
1230
1258
  void Promise.all([
1231
1259
  configQuery.refetch(),
1232
1260
  settingsQuery.refetch(),
1233
1261
  modelsQuery.refetch(),
1262
+ agentsQuery.refetch(),
1234
1263
  ]);
1235
1264
  }}
1236
1265
  >
1237
1266
  <Icon name="RefreshCw" size={14} color={theme.colors.foreground} />
1238
1267
  <Text style={styles.refreshLabel}>
1239
- {configQuery.isFetching || settingsQuery.isFetching || modelsQuery.isFetching
1268
+ {configQuery.isFetching ||
1269
+ settingsQuery.isFetching ||
1270
+ modelsQuery.isFetching ||
1271
+ agentsQuery.isFetching
1240
1272
  ? "Refreshing…"
1241
1273
  : "Refresh"}
1242
1274
  </Text>
@@ -1377,6 +1409,7 @@ function OmpConfigContent({
1377
1409
  theme={theme}
1378
1410
  modelCatalog={modelCatalog}
1379
1411
  modelRoles={modelRoles}
1412
+ agentCatalog={agentCatalog}
1380
1413
  styles={styles}
1381
1414
  settings={catalog.byCategory.get(selectedCategory.id) ?? []}
1382
1415
  drafts={drafts}
@@ -1,7 +1,8 @@
1
1
  import type { PluginSurfaceProps } from "@getpaseo/plugin/client";
2
2
  import { TextInput } from "@getpaseo/plugin/client/ui";
3
3
  import { useState } from "react";
4
- import { Pressable, Text, View } from "react-native";
4
+ import { Pressable, Switch, Text, View } from "react-native";
5
+ import type { OmpAgent } from "../shared/omp-agents";
5
6
  import {
6
7
  formatOmpSettingLabel,
7
8
  isOmpStructuredSettingPath,
@@ -24,6 +25,12 @@ export type OmpModelCatalogState = {
24
25
  error?: string;
25
26
  };
26
27
 
28
+ export type OmpAgentCatalogState = {
29
+ agents: readonly OmpAgent[];
30
+ loading: boolean;
31
+ error?: string;
32
+ };
33
+
27
34
  type StructuredRoutingEditorProps = {
28
35
  setting: OmpSetting;
29
36
  value: unknown;
@@ -35,6 +42,7 @@ type StructuredRoutingEditorProps = {
35
42
  theme: PluginSurfaceProps["theme"];
36
43
  modelCatalog: OmpModelCatalogState;
37
44
  modelRoles: Readonly<Record<string, unknown>>;
45
+ agentCatalog: OmpAgentCatalogState;
38
46
  onSet(value: unknown): void;
39
47
  onReset(): void;
40
48
  };
@@ -128,6 +136,99 @@ function OrderedRoleEditor({
128
136
  );
129
137
  }
130
138
 
139
+ function AgentPicker({
140
+ agents,
141
+ taken,
142
+ disabled,
143
+ styles,
144
+ onSelect,
145
+ }: {
146
+ agents: readonly OmpAgent[];
147
+ taken: readonly string[];
148
+ disabled: boolean;
149
+ styles: OmpConfigStyles;
150
+ onSelect(name: string): void;
151
+ }) {
152
+ const [open, setOpen] = useState(false);
153
+ const choices = agents.filter((agent) => !taken.includes(agent.name));
154
+ if (choices.length === 0) return null;
155
+ return (
156
+ <View style={styles.recordList}>
157
+ <RowButton
158
+ label={open ? "Close agents" : "Choose agent"}
159
+ disabled={disabled}
160
+ styles={styles}
161
+ onPress={() => setOpen((current) => !current)}
162
+ />
163
+ {open
164
+ ? choices.map((agent) => (
165
+ <RowButton
166
+ key={agent.name}
167
+ label={`${agent.name} (${agent.source})`}
168
+ disabled={disabled}
169
+ styles={styles}
170
+ onPress={() => {
171
+ onSelect(agent.name);
172
+ setOpen(false);
173
+ }}
174
+ />
175
+ ))
176
+ : null}
177
+ </View>
178
+ );
179
+ }
180
+
181
+ /** Turning off the default agent fails every task call that names no agent. */
182
+ const DEFAULT_AGENT = "task";
183
+
184
+ function DisabledAgentsEditor({
185
+ value,
186
+ agentCatalog,
187
+ disabled,
188
+ styles,
189
+ onSet,
190
+ }: Pick<StructuredRoutingEditorProps, "value" | "agentCatalog" | "disabled" | "styles" | "onSet">) {
191
+ const switchedOff = asStringArray(value);
192
+ const listed = agentCatalog.agents.map((agent) => agent.name);
193
+ const names = [...listed, ...switchedOff.filter((name) => !listed.includes(name))];
194
+ return (
195
+ <View style={styles.recordList}>
196
+ {agentCatalog.error ? (
197
+ <Text accessibilityRole="alert" style={styles.error}>
198
+ {agentCatalog.error}
199
+ </Text>
200
+ ) : null}
201
+ {names.length === 0 ? (
202
+ <Text style={styles.muted}>
203
+ {agentCatalog.loading ? "Loading agents…" : "No agents found."}
204
+ </Text>
205
+ ) : null}
206
+ {names.map((name) => {
207
+ const off = switchedOff.includes(name);
208
+ const locked = name === DEFAULT_AGENT && !off;
209
+ return (
210
+ <View key={name} style={styles.recordRow}>
211
+ <Text style={styles.recordKey}>{name}</Text>
212
+ <Switch
213
+ accessibilityLabel={`Agent ${name} is ${off ? "off" : "on"}`}
214
+ value={!off}
215
+ disabled={disabled || locked}
216
+ onValueChange={(on) =>
217
+ onSet(on ? switchedOff.filter((item) => item !== name) : [...switchedOff, name])
218
+ }
219
+ />
220
+ {locked ? (
221
+ <Text style={styles.muted}>
222
+ The default agent stays on: without it every task call that names no agent fails.
223
+ </Text>
224
+ ) : null}
225
+ </View>
226
+ );
227
+ })}
228
+ </View>
229
+ );
230
+ }
231
+
131
232
  function RecordRoutingEditor({
132
233
  setting,
133
234
  value,
@@ -136,10 +237,19 @@ function RecordRoutingEditor({
136
237
  theme,
137
238
  modelCatalog,
138
239
  modelRoles,
240
+ agentCatalog,
139
241
  onSet,
140
242
  }: Pick<
141
243
  StructuredRoutingEditorProps,
142
- "setting" | "value" | "disabled" | "styles" | "onSet" | "theme" | "modelCatalog" | "modelRoles"
244
+ | "setting"
245
+ | "value"
246
+ | "disabled"
247
+ | "styles"
248
+ | "onSet"
249
+ | "theme"
250
+ | "modelCatalog"
251
+ | "modelRoles"
252
+ | "agentCatalog"
143
253
  >) {
144
254
  const record = asRecord(value);
145
255
  const [keyErrors, setKeyErrors] = useState<Record<string, string>>({});
@@ -199,6 +309,15 @@ function RecordRoutingEditor({
199
309
  {keyErrors[key]}
200
310
  </Text>
201
311
  ) : null}
312
+ {setting.path.startsWith("task.") ? (
313
+ <AgentPicker
314
+ agents={agentCatalog.agents}
315
+ taken={Object.keys(record)}
316
+ disabled={disabled}
317
+ styles={styles}
318
+ onSelect={(name) => onSet(replaceRecordKey(record, key, name))}
319
+ />
320
+ ) : null}
202
321
  <TextInput
203
322
  accessibilityLabel={`${formatOmpSettingLabel(setting.path)} ${valueLabel} ${index + 1}`}
204
323
  editable={!disabled}
@@ -287,6 +406,8 @@ export function StructuredRoutingEditor(props: StructuredRoutingEditorProps) {
287
406
  <Text style={props.styles.muted}>{props.resetLabel} when changes are applied</Text>
288
407
  ) : props.setting.path === "cycleOrder" ? (
289
408
  <OrderedRoleEditor {...props} />
409
+ ) : props.setting.path === "task.disabledAgents" ? (
410
+ <DisabledAgentsEditor {...props} />
290
411
  ) : (
291
412
  <RecordRoutingEditor {...props} />
292
413
  )}
package/index.server.ts CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  } from "./server/mcp-browser";
7
7
  import { resolveListOmpMemory } from "./server/memory";
8
8
  import { OmpAccounts } from "./server/omp-accounts";
9
+ import { resolveListOmpAgents } from "./server/omp-agents";
9
10
  import { resolveListOmpConfig } from "./server/omp-config";
10
11
  import { OmpMcps } from "./server/omp-mcps";
11
12
  import { resolveListOmpModels } from "./server/omp-models";
@@ -62,6 +63,7 @@ import {
62
63
  startOmpAccountLogin,
63
64
  submitOmpAccountLoginCode,
64
65
  } from "./shared/omp-accounts";
66
+ import { listOmpAgents } from "./shared/omp-agents";
65
67
  import { listOmpConfig } from "./shared/omp-config";
66
68
  import {
67
69
  addOmpMcp,
@@ -201,6 +203,7 @@ export default function contribute(server: PluginServerContext) {
201
203
  server.handle(listOmpMemory, scoped(resolveListOmpMemory));
202
204
  server.handle(listOmpConfig, scoped(resolveListOmpConfig));
203
205
  server.handle(listOmpModels, scoped(resolveListOmpModels));
206
+ server.handle(listOmpAgents, scoped(resolveListOmpAgents));
204
207
  server.handle(listOmpPlugins, scoped(resolveListOmpPlugins));
205
208
  server.handle(listOmpMarketplaces, scoped(resolveListOmpMarketplaces));
206
209
  server.handle(browseOmpMarketplace, scoped(resolveBrowseOmpMarketplace));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omercnet/paseo-omp",
3
- "version": "5.4.0-next.402.1",
3
+ "version": "5.4.0-next.404.1",
4
4
  "type": "module",
5
5
  "description": "Paseo integration for OMP, including its direct provider and workspace tooling.",
6
6
  "license": "MIT",
@@ -0,0 +1,170 @@
1
+ import { mkdtemp, readdir, readFile, rm, stat } from "node:fs/promises";
2
+ import { tmpdir } from "node:os";
3
+ import { isAbsolute, join, relative } from "node:path";
4
+ import type { RpcInput } from "@getpaseo/plugin";
5
+ import { parse as parseYaml } from "yaml";
6
+ import { z } from "zod";
7
+ import { type listOmpAgents, OMP_AGENT_LIMIT, type OmpAgent } from "../shared/omp-agents";
8
+ import { OmpAgentNameSchema } from "../shared/omp-settings";
9
+ import { resolveOmpExecutable } from "./omp-settings";
10
+ import { currentOmpEnvironment, ompAgentDir } from "./paths";
11
+ import { buildStatefulCommandEnv, defaultSpawn, runBounded } from "./provider-diagnostics";
12
+
13
+ const UNPACK_TIMEOUT_MS = 15_000;
14
+ const KILL_GRACE_MS = 1_000;
15
+ const UNPACK_OUTPUT_LIMIT = 64 * 1024;
16
+ const AGENT_FILE_LIMIT = 256 * 1024;
17
+ const FRONTMATTER = /^\uFEFF?---\r?\n([\s\S]*?)\r?\n---/u;
18
+ const BUNDLED_FAILURE = "Bundled agents could not be listed.";
19
+
20
+ /** Everything OMP would use to relocate its config, data, state, cache or agent directory. */
21
+ const OMP_LOCATION_ENV = [
22
+ "OMP_AGENT_DIR",
23
+ "OMP_PROFILE",
24
+ "OMP_SESSION_DIR",
25
+ "PASEO_OMP_AGENT_DIR",
26
+ "PI_CODING_AGENT_DIR",
27
+ "PI_CODING_AGENT_SESSION_DIR",
28
+ "PI_CONFIG_DIR",
29
+ "PI_PROFILE",
30
+ "XDG_CACHE_HOME",
31
+ "XDG_CONFIG_HOME",
32
+ "XDG_DATA_HOME",
33
+ "XDG_STATE_HOME",
34
+ ] as const;
35
+
36
+ const UnpackResultSchema = z.object({ written: z.array(z.string()) });
37
+
38
+ export interface OmpAgentDependencies {
39
+ /** Names of the agents OMP ships with. Rejects when OMP cannot list them. */
40
+ bundledNames(): Promise<string[]>;
41
+ userAgentsDir(): string;
42
+ }
43
+
44
+ /** Names OMP reserves for itself and never registers from an agent file. */
45
+ const RESERVED_AGENT_NAMES: readonly string[] = ["main", "sub"];
46
+
47
+ /** The name OMP registers for an agent file: its frontmatter `name`, which needs a `description`. */
48
+ async function agentNameFromFile(path: string): Promise<string | null> {
49
+ const metadata = await stat(path);
50
+ if (!metadata.isFile() || metadata.size > AGENT_FILE_LIMIT) return null;
51
+ const frontmatter = FRONTMATTER.exec(await readFile(path, "utf8"));
52
+ if (!frontmatter?.[1]) return null;
53
+ let fields: unknown;
54
+ try {
55
+ fields = parseYaml(frontmatter[1]);
56
+ } catch {
57
+ return null;
58
+ }
59
+ if (fields === null || typeof fields !== "object") return null;
60
+ const { name, description } = fields as Record<string, unknown>;
61
+ if (typeof description !== "string" || description.length === 0) return null;
62
+ if (typeof name !== "string" || RESERVED_AGENT_NAMES.includes(name.trim().toLowerCase())) {
63
+ return null;
64
+ }
65
+ // OMP keeps the name as written; one with surrounding whitespace cannot be routed, so skip it.
66
+ const parsed = OmpAgentNameSchema.safeParse(name);
67
+ return parsed.success ? parsed.data : null;
68
+ }
69
+
70
+ async function agentNamesFrom(paths: readonly string[]): Promise<string[]> {
71
+ const names: string[] = [];
72
+ for (const path of paths.slice(0, OMP_AGENT_LIMIT)) {
73
+ if (!path.endsWith(".md")) continue;
74
+ const name = await agentNameFromFile(path).catch(() => null);
75
+ if (name) names.push(name);
76
+ }
77
+ return names;
78
+ }
79
+
80
+ async function agentNamesIn(directory: string): Promise<string[]> {
81
+ try {
82
+ const entries = await readdir(directory, { withFileTypes: true });
83
+ return agentNamesFrom(
84
+ entries.filter((entry) => entry.isFile()).map((entry) => join(directory, entry.name)),
85
+ );
86
+ } catch (error) {
87
+ if ((error as NodeJS.ErrnoException).code === "ENOENT") return [];
88
+ throw error;
89
+ }
90
+ }
91
+
92
+ /** A scratch-only OMP environment: nothing inherited can point OMP at a real directory. */
93
+ export function scratchOmpEnvironment(base: NodeJS.ProcessEnv, scratch: string): NodeJS.ProcessEnv {
94
+ const environment = { ...base };
95
+ for (const key of OMP_LOCATION_ENV) delete environment[key];
96
+ return {
97
+ ...environment,
98
+ HOME: scratch,
99
+ USERPROFILE: scratch,
100
+ PI_CODING_AGENT_DIR: join(scratch, "agent"),
101
+ };
102
+ }
103
+
104
+ /**
105
+ * OMP has no agent list command, but `agents unpack` writes the bundled set to a folder. The
106
+ * folder and the whole OMP home are throwaway, so an OMP that ignores `--dir` still writes
107
+ * nothing into a real agent directory.
108
+ */
109
+ async function unpackBundledNames(): Promise<string[]> {
110
+ const executable = await resolveOmpExecutable();
111
+ if (!executable) throw new Error("The OMP executable could not be resolved.");
112
+ const scratch = await mkdtemp(join(tmpdir(), "paseo-omp-agents-"));
113
+ try {
114
+ const result = await runBounded(
115
+ defaultSpawn,
116
+ executable,
117
+ ["agents", "unpack", "--dir", join(scratch, "out"), "--json"],
118
+ scratchOmpEnvironment(buildStatefulCommandEnv(currentOmpEnvironment()), scratch),
119
+ UNPACK_TIMEOUT_MS,
120
+ KILL_GRACE_MS,
121
+ UNPACK_OUTPUT_LIMIT,
122
+ scratch,
123
+ );
124
+ if (result.outcome !== "exited" || result.exitCode !== 0 || result.truncated) {
125
+ throw new Error("OMP could not unpack its bundled agents.");
126
+ }
127
+ const { written } = UnpackResultSchema.parse(JSON.parse(result.stdout));
128
+ const inside = written.filter((path) => {
129
+ const within = relative(scratch, path);
130
+ return isAbsolute(path) && !within.startsWith("..") && !isAbsolute(within);
131
+ });
132
+ return await agentNamesFrom(inside);
133
+ } finally {
134
+ await rm(scratch, { recursive: true, force: true });
135
+ }
136
+ }
137
+
138
+ const DEFAULT_DEPENDENCIES: OmpAgentDependencies = {
139
+ bundledNames: unpackBundledNames,
140
+ userAgentsDir: () => join(ompAgentDir(), "agents"),
141
+ };
142
+
143
+ export async function listOmpAgentsWithDependencies(
144
+ input: RpcInput<typeof listOmpAgents>,
145
+ dependencies: OmpAgentDependencies,
146
+ ): Promise<{ agents: OmpAgent[]; error?: string }> {
147
+ // The most specific source wins when a name exists in several places.
148
+ const bySource = new Map<string, OmpAgent["source"]>();
149
+ let error: string | undefined;
150
+ try {
151
+ for (const name of await dependencies.bundledNames()) bySource.set(name, "bundled");
152
+ } catch {
153
+ error = BUNDLED_FAILURE;
154
+ }
155
+ for (const name of await agentNamesIn(dependencies.userAgentsDir())) bySource.set(name, "user");
156
+ if (input.cwd && isAbsolute(input.cwd)) {
157
+ for (const name of await agentNamesIn(join(input.cwd, ".omp", "agents"))) {
158
+ bySource.set(name, "project");
159
+ }
160
+ }
161
+ const agents = [...bySource]
162
+ .map(([name, source]) => ({ name, source }))
163
+ .sort((left, right) => left.name.localeCompare(right.name))
164
+ .slice(0, OMP_AGENT_LIMIT);
165
+ return error ? { agents, error } : { agents };
166
+ }
167
+
168
+ export function resolveListOmpAgents(input: RpcInput<typeof listOmpAgents>) {
169
+ return listOmpAgentsWithDependencies(input, DEFAULT_DEPENDENCIES);
170
+ }
@@ -13,6 +13,7 @@ import {
13
13
  type OmpSettingType,
14
14
  OmpSettingTypeSchema,
15
15
  parseOmpStructuredSettingValue,
16
+ structuredSettingType,
16
17
  type updateOmpSettings,
17
18
  } from "../shared/omp-settings";
18
19
  import { SerialMutationQueue } from "./mutation-queue";
@@ -315,8 +316,7 @@ async function loadCatalog(
315
316
 
316
317
  function serializeSettingValue(setting: OmpSetting, value: unknown): string | null {
317
318
  if (isOmpStructuredSettingPath(setting.path)) {
318
- const expectedType = setting.path === "cycleOrder" ? "array" : "record";
319
- if (setting.type !== expectedType) return null;
319
+ if (setting.type !== structuredSettingType(setting.path)) return null;
320
320
  const parsed = parseOmpStructuredSettingValue(setting.path, value);
321
321
  return parsed === undefined ? null : JSON.stringify(parsed);
322
322
  }
@@ -332,7 +332,7 @@ function isEditableSetting(setting: OmpSetting): boolean {
332
332
  if (setting.redacted) return false;
333
333
  if (["boolean", "number", "string", "enum"].includes(setting.type)) return true;
334
334
  if (!isOmpStructuredSettingPath(setting.path)) return false;
335
- return setting.type === (setting.path === "cycleOrder" ? "array" : "record");
335
+ return setting.type === structuredSettingType(setting.path);
336
336
  }
337
337
 
338
338
  export async function listOmpSettingsWithDependencies(
@@ -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.402.1"; // x-release-please-version
2
+ export const PASEO_OMP_PACKAGE_VERSION = "5.4.0-next.404.1"; // x-release-please-version
@@ -0,0 +1,26 @@
1
+ import { defineRpc } from "@getpaseo/plugin";
2
+ import { z } from "zod";
3
+ import { OmpWorkspaceCwdSchema } from "./hub";
4
+ import { OmpAgentNameSchema } from "./omp-settings";
5
+ import { OmpStoreSchema } from "./omp-store";
6
+
7
+ export const OMP_AGENT_LIMIT = 256;
8
+
9
+ export const OmpAgentSchema = z
10
+ .object({ name: OmpAgentNameSchema, source: z.enum(["bundled", "user", "project"]) })
11
+ .strict();
12
+ export type OmpAgent = z.infer<typeof OmpAgentSchema>;
13
+
14
+ export const listOmpAgents = defineRpc({
15
+ name: "paseo-omp.list-agents",
16
+ input: z
17
+ .object({ store: OmpStoreSchema.optional(), cwd: OmpWorkspaceCwdSchema.optional() })
18
+ .strict(),
19
+ output: z
20
+ .object({
21
+ agents: z.array(OmpAgentSchema).max(OMP_AGENT_LIMIT),
22
+ /** Set when the bundled agents could not be listed; user and project agents still appear. */
23
+ error: z.string().max(256).optional(),
24
+ })
25
+ .strict(),
26
+ });
@@ -67,7 +67,7 @@ export function isValidOmpModelSelector(value: string): boolean {
67
67
  return OmpModelSelectorSchema.safeParse(value).success;
68
68
  }
69
69
 
70
- const OmpAgentNameSchema = z
70
+ export const OmpAgentNameSchema = z
71
71
  .string()
72
72
  .min(1)
73
73
  .max(128)
@@ -138,6 +138,11 @@ export const OmpAgentAdvisorSchema = z
138
138
  "Too many agent advisor overrides.",
139
139
  );
140
140
 
141
+ export const OmpDisabledAgentsSchema = z
142
+ .array(OmpAgentNameSchema)
143
+ .max(MAX_ROUTING_ENTRIES)
144
+ .refine((value) => new Set(value).size === value.length, "Disabled agents must be unique.");
145
+
141
146
  export const OMP_STRUCTURED_SETTING_PATHS = [
142
147
  "modelRoles",
143
148
  "retry.fallbackChains",
@@ -146,6 +151,7 @@ export const OMP_STRUCTURED_SETTING_PATHS = [
146
151
  "task.agentServiceTierOverrides",
147
152
  "task.agentPrewalk",
148
153
  "task.agentAdvisor",
154
+ "task.disabledAgents",
149
155
  ] as const;
150
156
  export type OmpStructuredSettingPath = (typeof OMP_STRUCTURED_SETTING_PATHS)[number];
151
157
 
@@ -165,6 +171,8 @@ export function parseOmpStructuredSettingValue(path: string, value: unknown): un
165
171
  return OmpAgentPrewalkSchema.safeParse(value).data;
166
172
  case "task.agentAdvisor":
167
173
  return OmpAgentAdvisorSchema.safeParse(value).data;
174
+ case "task.disabledAgents":
175
+ return OmpDisabledAgentsSchema.safeParse(value).data;
168
176
  default:
169
177
  return undefined;
170
178
  }
@@ -174,6 +182,11 @@ export function isOmpStructuredSettingPath(path: string): path is OmpStructuredS
174
182
  return (OMP_STRUCTURED_SETTING_PATHS as readonly string[]).includes(path);
175
183
  }
176
184
 
185
+ /** The OMP value type each structured path must have to be editable. */
186
+ export function structuredSettingType(path: OmpStructuredSettingPath): "array" | "record" {
187
+ return path === "cycleOrder" || path === "task.disabledAgents" ? "array" : "record";
188
+ }
189
+
177
190
  export const OmpSettingSchema = z
178
191
  .object({
179
192
  path: z.string(),
@@ -309,7 +322,73 @@ const CATEGORY_PREFIXES: Readonly<Record<OmpSettingCategory, readonly string[]>>
309
322
  general: [],
310
323
  };
311
324
 
325
+ /** The optional-tool on/off switches, in the order they list when all are the same state. */
326
+ const OMP_TOOL_SWITCHES: readonly { path: string; label: string; description: string }[] = [
327
+ {
328
+ path: "github.enabled",
329
+ label: "GitHub",
330
+ description:
331
+ "Repositories, issues, pull requests and Actions from the agent. Needs the gh command on the PATH.",
332
+ },
333
+ {
334
+ path: "security.enabled",
335
+ label: "Security scan",
336
+ description: "Security scan planning and execution, plus the read-only security:// resources.",
337
+ },
338
+ {
339
+ path: "generate_image.enabled",
340
+ label: "Image generation",
341
+ description: "Text-to-image generation and editing.",
342
+ },
343
+ {
344
+ path: "speechgen.enabled",
345
+ label: "Speech synthesis",
346
+ description: "Turns text into speech files, on-device or with xAI Grok Voice.",
347
+ },
348
+ {
349
+ path: "computer.enabled",
350
+ label: "Desktop control",
351
+ description:
352
+ "Lets the agent script this machine's desktop: screenshots, input and accessibility.",
353
+ },
354
+ {
355
+ path: "lsp.enabled",
356
+ label: "Language servers",
357
+ description: "Code intelligence: definitions, references, diagnostics and rename.",
358
+ },
359
+ {
360
+ path: "debug.enabled",
361
+ label: "Debugger",
362
+ description: "Debugging through DAP adapters.",
363
+ },
364
+ {
365
+ path: "ida.enabled",
366
+ label: "IDA Pro",
367
+ description:
368
+ "Opens executables in IDA Pro and adds the ida tool. Does nothing without an IDA install.",
369
+ },
370
+ {
371
+ path: "checkpoint.enabled",
372
+ label: "Checkpoints",
373
+ description: "Checkpoint and rewind tools for saving and restoring context.",
374
+ },
375
+ {
376
+ path: "task.isolation.enabled",
377
+ label: "Task isolation",
378
+ description: "Lets a task run apart from the shared checkout when it asks to.",
379
+ },
380
+ {
381
+ path: "magicKeywords.enabled",
382
+ label: "Magic keywords",
383
+ description:
384
+ "Hidden notices when a message holds a standalone ultrathink, orchestrate, workflowz or jevify keyword.",
385
+ },
386
+ ];
387
+
388
+ const TOOL_SWITCH_LABELS = new Map(OMP_TOOL_SWITCHES.map(({ path, label }) => [path, label]));
389
+
312
390
  export function categorizeOmpSetting(path: string): OmpSettingCategory {
391
+ if (TOOL_SWITCH_LABELS.has(path)) return "tools";
313
392
  for (const category of OMP_SETTING_CATEGORIES) {
314
393
  if (CATEGORY_PREFIXES[category].some((prefix) => path === prefix || path.startsWith(prefix))) {
315
394
  return category;
@@ -319,6 +398,8 @@ export function categorizeOmpSetting(path: string): OmpSettingCategory {
319
398
  }
320
399
 
321
400
  export function formatOmpSettingLabel(path: string): string {
401
+ const switchLabel = TOOL_SWITCH_LABELS.get(path);
402
+ if (switchLabel) return switchLabel;
322
403
  const leaf = path.split(".").at(-1) ?? path;
323
404
  const words = leaf
324
405
  .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
@@ -327,8 +408,19 @@ export function formatOmpSettingLabel(path: string): string {
327
408
  return words ? `${words[0]?.toUpperCase() ?? ""}${words.slice(1)}` : path;
328
409
  }
329
410
 
411
+ /** Tools category order: enabled switches, then disabled switches, then every other tool setting. */
412
+ export function orderOmpToolSettings(settings: readonly OmpSetting[]): OmpSetting[] {
413
+ const byPath = new Map(settings.map((setting) => [setting.path, setting]));
414
+ const switches = OMP_TOOL_SWITCHES.flatMap(({ path }) => byPath.get(path) ?? []);
415
+ const enabled = switches.filter((setting) => setting.value === true);
416
+ const disabled = switches.filter((setting) => setting.value !== true);
417
+ const rest = settings.filter((setting) => !TOOL_SWITCH_LABELS.has(setting.path));
418
+ return [...enabled, ...disabled, ...rest];
419
+ }
420
+
330
421
  /** Plain wording that replaces OMP's own description (or its absence) for these settings. */
331
422
  export const OMP_SETTING_DESCRIPTIONS: Readonly<Record<string, string>> = {
423
+ ...Object.fromEntries(OMP_TOOL_SWITCHES.map(({ path, description }) => [path, description])),
332
424
  "session.warnCost":
333
425
  "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
426
  "session.maxCost":
@@ -411,6 +503,13 @@ const OmpStructuredSettingChangeSchema = z.discriminatedUnion("path", [
411
503
  value: OmpAgentAdvisorSchema,
412
504
  })
413
505
  .strict(),
506
+ z
507
+ .object({
508
+ operation: z.literal("set"),
509
+ path: z.literal("task.disabledAgents"),
510
+ value: OmpDisabledAgentsSchema,
511
+ })
512
+ .strict(),
414
513
  ]);
415
514
 
416
515
  const OmpSettingChangeSchema = z.union([