@omercnet/paseo-omp 5.4.0 → 5.5.0-next.429.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.
Files changed (80) hide show
  1. package/OVERVIEW.md +7 -1
  2. package/README.md +2 -1
  3. package/client/ast-edit.tsx +53 -0
  4. package/client/composer-pill-settings.tsx +0 -5
  5. package/client/config-sidebar.tsx +15 -0
  6. package/client/generated-image.tsx +79 -0
  7. package/client/lsp-diagnostics.tsx +69 -0
  8. package/client/omp-config-surface.tsx +438 -108
  9. package/client/omp-config-views.ts +32 -5
  10. package/client/omp-extensions-section.tsx +145 -0
  11. package/client/omp-local-models-section.tsx +215 -0
  12. package/client/omp-plugin-manager.tsx +198 -3
  13. package/client/omp-routing-editor.tsx +123 -2
  14. package/client/omp-rule-test.tsx +140 -0
  15. package/client/omp-rules-section.tsx +353 -0
  16. package/client/omp-security-section.tsx +99 -0
  17. package/client/omp-security-state.ts +14 -0
  18. package/client/omp-skills-section.tsx +195 -0
  19. package/client/omp-tool-config-section.tsx +204 -0
  20. package/client/omp-tool-policy-state.ts +101 -0
  21. package/client/omp-tool-policy.tsx +435 -0
  22. package/client/omp-update-row.tsx +87 -0
  23. package/client/provider-diagnostics-state.ts +38 -1
  24. package/client/provider-image.tsx +1 -1
  25. package/client/rule-notice.tsx +33 -0
  26. package/client/sidebar-compat.ts +0 -109
  27. package/client/web.ts +34 -0
  28. package/index.client.tsx +79 -46
  29. package/index.server.ts +77 -3
  30. package/npm-shrinkwrap.json +2 -2
  31. package/package.json +4 -4
  32. package/server/generated-images.ts +57 -0
  33. package/server/omp-agents.ts +170 -0
  34. package/server/omp-extensions.ts +235 -0
  35. package/server/omp-list-setting.ts +98 -0
  36. package/server/omp-local-models.ts +202 -0
  37. package/server/omp-models-file.ts +178 -0
  38. package/server/omp-plugins.ts +182 -0
  39. package/server/omp-prompt-files.ts +41 -0
  40. package/server/omp-rule-firings.ts +211 -0
  41. package/server/omp-rule-switch.ts +38 -0
  42. package/server/omp-rule-test.ts +82 -0
  43. package/server/omp-rules.ts +452 -0
  44. package/server/omp-security.ts +169 -0
  45. package/server/omp-settings.ts +92 -16
  46. package/server/omp-skills.ts +179 -0
  47. package/server/omp-tool-config.ts +144 -0
  48. package/server/omp-update.ts +203 -0
  49. package/server/package-version.ts +1 -1
  50. package/server/provider/connection.ts +1 -1
  51. package/server/provider/image-cache.ts +1 -1
  52. package/server/provider/omp-rpc-environment.ts +1 -1
  53. package/server/provider/session-descriptors.ts +3 -0
  54. package/server/provider-diagnostics.ts +26 -4
  55. package/server/regular-file.ts +30 -0
  56. package/server/rule-notices.ts +112 -0
  57. package/server/turn-rows.ts +59 -0
  58. package/server/turn-screenshots.ts +140 -0
  59. package/shared/ast-edit.ts +124 -0
  60. package/shared/composer-pill-settings.ts +0 -2
  61. package/shared/generated-image.ts +68 -0
  62. package/shared/lsp-diagnostics.ts +141 -0
  63. package/shared/omp-agents.ts +26 -0
  64. package/shared/omp-extensions.ts +45 -0
  65. package/shared/omp-local-models.ts +44 -0
  66. package/shared/omp-models-file.ts +30 -0
  67. package/shared/omp-plugins.ts +90 -0
  68. package/shared/omp-prompt-files.ts +24 -0
  69. package/shared/omp-rules.ts +134 -0
  70. package/shared/omp-security.ts +50 -0
  71. package/shared/omp-settings.ts +211 -2
  72. package/shared/omp-skills.ts +80 -0
  73. package/shared/omp-tool-config.ts +283 -0
  74. package/shared/omp-update.ts +27 -0
  75. package/shared/provider-image.ts +10 -3
  76. package/shared/rule-notices.ts +20 -0
  77. package/client/hub-sidebar.tsx +0 -99
  78. package/client/sessions-popover.tsx +0 -78
  79. package/server/sessions.ts +0 -58
  80. package/shared/sessions.ts +0 -24
@@ -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
+ });
@@ -0,0 +1,24 @@
1
+ import { defineRpc } from "@getpaseo/plugin";
2
+ import { z } from "zod";
3
+ import { OmpWorkspaceCwdSchema } from "./hub";
4
+ import { OmpStoreSchema } from "./omp-store";
5
+
6
+ /** Facts only: never the text of a prompt file or of Paseo's Append system prompt. */
7
+ export const OmpPromptFilesSchema = z.object({
8
+ /** An APPEND_SYSTEM.md exists in the agent directory (or the workspace's `.omp/`). */
9
+ appendSystemFile: z.boolean(),
10
+ /** A SYSTEM.md exists there: it replaces OMP's default instruction template. */
11
+ systemFile: z.boolean(),
12
+ /** Whether Paseo has an Append system prompt set. */
13
+ hostAppendPrompt: z.boolean(),
14
+ });
15
+ export type OmpPromptFiles = z.infer<typeof OmpPromptFilesSchema>;
16
+
17
+ export const getOmpPromptFiles = defineRpc({
18
+ name: "paseo-omp.get-prompt-files",
19
+ input: z.object({
20
+ store: OmpStoreSchema.optional(),
21
+ cwd: OmpWorkspaceCwdSchema.optional(),
22
+ }),
23
+ output: OmpPromptFilesSchema,
24
+ });
@@ -0,0 +1,134 @@
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 watch rule fires on what the agent writes; always-apply and rulebook rules sit in the prompt. */
7
+ export const OmpRuleKindSchema = z.enum(["watch", "always", "rulebook"]);
8
+ export type OmpRuleKind = z.infer<typeof OmpRuleKindSchema>;
9
+
10
+ /** `imported` is a rule OMP reads from another tool's files (Cursor, Windsurf, Cline, ...). */
11
+ export const OmpRuleSourceSchema = z.enum(["project", "user", "builtin", "imported"]);
12
+
13
+ export const OmpRuleSchema = z.object({
14
+ name: z.string(),
15
+ kind: OmpRuleKindSchema,
16
+ source: OmpRuleSourceSchema,
17
+ /** OMP's provider id, such as `native`, `builtin-defaults`, or `cursor`. */
18
+ provider: z.string(),
19
+ description: z.string().nullable(),
20
+ condition: z.array(z.string()),
21
+ astCondition: z.array(z.string()),
22
+ question: z.string().nullable(),
23
+ scope: z.array(z.string()),
24
+ globs: z.array(z.string()),
25
+ agents: z.array(z.string()),
26
+ path: z.string(),
27
+ });
28
+ export type OmpRule = z.infer<typeof OmpRuleSchema>;
29
+
30
+ export const OmpRulesListSchema = z.discriminatedUnion("status", [
31
+ z.object({
32
+ status: z.literal("ready"),
33
+ rules: z.array(OmpRuleSchema),
34
+ /** `ttsr.disabledRules`: OMP hides these, so only their names are known. */
35
+ disabled: z.array(z.string()),
36
+ /** `ttsr.builtinRules`: false hides every built-in rule. */
37
+ builtinRules: z.boolean(),
38
+ }),
39
+ z.object({ status: z.literal("error"), message: z.string() }),
40
+ ]);
41
+ export type OmpRulesList = z.infer<typeof OmpRulesListSchema>;
42
+
43
+ export const listOmpRules = defineRpc({
44
+ name: "paseo-omp.list-rules",
45
+ input: z
46
+ .object({ store: OmpStoreSchema.optional(), cwd: OmpWorkspaceCwdSchema.optional() })
47
+ .strict(),
48
+ output: OmpRulesListSchema,
49
+ });
50
+
51
+ /** Off adds `name` to `ttsr.disabledRules`; on removes it. A workspace writes its own `.omp/config.yml`. */
52
+ export const setOmpRuleEnabled = defineRpc({
53
+ name: "paseo-omp.set-rule-enabled",
54
+ input: z
55
+ .object({
56
+ store: OmpStoreSchema.optional(),
57
+ cwd: OmpWorkspaceCwdSchema.optional(),
58
+ name: z.string().trim().min(1).max(256),
59
+ enabled: z.boolean(),
60
+ })
61
+ .strict(),
62
+ output: z.discriminatedUnion("status", [
63
+ z.object({ status: z.literal("ok") }),
64
+ z.object({ status: z.literal("error"), message: z.string() }),
65
+ ]),
66
+ });
67
+
68
+ export const MAX_RULE_TEST_CHARS = 20_000;
69
+
70
+ export const OmpRuleTestSourceSchema = z.enum(["text", "thinking", "tool"]);
71
+ export type OmpRuleTestSource = z.infer<typeof OmpRuleTestSourceSchema>;
72
+
73
+ export const OmpRuleTestHitSchema = z.object({
74
+ name: z.string(),
75
+ provider: z.string(),
76
+ path: z.string(),
77
+ /** The rule's own patterns that matched the snippet. */
78
+ regex: z.array(z.string()),
79
+ ast: z.array(z.string()),
80
+ });
81
+ export type OmpRuleTestHit = z.infer<typeof OmpRuleTestHitSchema>;
82
+
83
+ /** Runs `omp ttsr test`: which rules would fire on a snippet, in this workspace or the user scope. */
84
+ export const testOmpRules = defineRpc({
85
+ name: "paseo-omp.test-rules",
86
+ input: z
87
+ .object({
88
+ store: OmpStoreSchema.optional(),
89
+ cwd: OmpWorkspaceCwdSchema.optional(),
90
+ snippet: z.string().min(1).max(MAX_RULE_TEST_CHARS),
91
+ /** The file the snippet pretends to come from, for scope and glob matching. */
92
+ path: z
93
+ .string()
94
+ .trim()
95
+ .min(1)
96
+ .max(1_024)
97
+ .refine((path) => !path.includes("\0"), "The path cannot hold a null character")
98
+ .optional(),
99
+ source: OmpRuleTestSourceSchema.optional(),
100
+ })
101
+ .strict(),
102
+ output: z.discriminatedUnion("status", [
103
+ z.object({
104
+ status: z.literal("ready"),
105
+ /** How many rules OMP checked. */
106
+ evaluated: z.number().int().nonnegative(),
107
+ triggered: z.array(OmpRuleTestHitSchema),
108
+ }),
109
+ z.object({ status: z.literal("error"), message: z.string() }),
110
+ ]),
111
+ });
112
+
113
+ export const OmpRuleFiringSchema = z.object({
114
+ name: z.string(),
115
+ count: z.number().int().positive(),
116
+ /** ISO time of the most recent firing. */
117
+ lastFiredAt: z.string().nullable(),
118
+ });
119
+ export type OmpRuleFiring = z.infer<typeof OmpRuleFiringSchema>;
120
+
121
+ /** How often each rule fired, counted from OMP's session files for this workspace or every session. */
122
+ export const listOmpRuleFirings = defineRpc({
123
+ name: "paseo-omp.rule-firings",
124
+ input: z
125
+ .object({ store: OmpStoreSchema.optional(), cwd: OmpWorkspaceCwdSchema.optional() })
126
+ .strict(),
127
+ output: z.object({
128
+ firings: z.array(OmpRuleFiringSchema),
129
+ /** Sessions the counts cover. */
130
+ sessions: z.number().int().nonnegative(),
131
+ /** True when a size or time bound left some sessions or session text uncounted. */
132
+ partial: z.boolean(),
133
+ }),
134
+ });
@@ -0,0 +1,50 @@
1
+ import { defineRpc } from "@getpaseo/plugin";
2
+ import { z } from "zod";
3
+ import { OmpWorkspaceCwdSchema } from "./hub";
4
+ import { OmpStoreSchema } from "./omp-store";
5
+
6
+ export const OMP_SECURITY_SEVERITIES = [
7
+ "critical",
8
+ "high",
9
+ "medium",
10
+ "low",
11
+ "informational",
12
+ ] as const;
13
+ export const OmpSecuritySeveritySchema = z.enum(OMP_SECURITY_SEVERITIES);
14
+ export type OmpSecuritySeverity = z.infer<typeof OmpSecuritySeveritySchema>;
15
+
16
+ export const OmpSecurityScanSchema = z.object({
17
+ id: z.string(),
18
+ /** OMP's scan status: planned, running, completed, partial, cancelled or failed. */
19
+ phase: z.string(),
20
+ findingCount: z.number().int().nonnegative(),
21
+ /** Findings per severity. Counts only; finding titles and locations are never sent. */
22
+ severities: z.record(OmpSecuritySeveritySchema, z.number().int().nonnegative()),
23
+ /** False when OMP's finding listing was cut short, so the counts add up to less than `findingCount`. */
24
+ severitiesComplete: z.boolean(),
25
+ producer: z.string(),
26
+ createdAt: z.string(),
27
+ });
28
+ export type OmpSecurityScan = z.infer<typeof OmpSecurityScanSchema>;
29
+
30
+ export const OmpSecurityListSchema = z.discriminatedUnion("status", [
31
+ z.object({
32
+ status: z.literal("ready"),
33
+ scans: z.array(OmpSecurityScanSchema),
34
+ /** More scans are stored than are listed. */
35
+ truncated: z.boolean(),
36
+ /** Lines of OMP's scan list the plugin could not read or that repeated an id. */
37
+ skipped: z.number().int().nonnegative(),
38
+ }),
39
+ /** `security.enabled` is false, so OMP refuses to read its security resources. */
40
+ z.object({ status: z.literal("off") }),
41
+ z.object({ status: z.literal("error"), message: z.string() }),
42
+ ]);
43
+ export type OmpSecurityList = z.infer<typeof OmpSecurityListSchema>;
44
+
45
+ /** Scans are keyed by project, so a workspace is required. */
46
+ export const listOmpSecurity = defineRpc({
47
+ name: "paseo-omp.list-security",
48
+ input: z.object({ store: OmpStoreSchema.optional(), cwd: OmpWorkspaceCwdSchema }).strict(),
49
+ output: OmpSecurityListSchema,
50
+ });
@@ -1,4 +1,4 @@
1
- import { defineRpc } from "@getpaseo/plugin";
1
+ import { defineRpc, type RpcOutput } from "@getpaseo/plugin";
2
2
  import { z } from "zod";
3
3
  import { OmpWorkspaceCwdSchema } from "./hub";
4
4
  import { OmpStoreSchema } from "./omp-store";
@@ -21,6 +21,7 @@ const MAX_ROUTING_ENTRIES = 64;
21
21
  const MAX_FALLBACK_CHAIN_LENGTH = 16;
22
22
  const MAX_AGENT_MODEL_CHOICES = 8;
23
23
  const MAX_MODEL_SELECTOR_LENGTH = 513;
24
+ const MAX_BASH_RULES = 128;
24
25
 
25
26
  function containsControlCharacter(value: string): boolean {
26
27
  for (const character of value) {
@@ -67,7 +68,7 @@ export function isValidOmpModelSelector(value: string): boolean {
67
68
  return OmpModelSelectorSchema.safeParse(value).success;
68
69
  }
69
70
 
70
- const OmpAgentNameSchema = z
71
+ export const OmpAgentNameSchema = z
71
72
  .string()
72
73
  .min(1)
73
74
  .max(128)
@@ -138,6 +139,49 @@ export const OmpAgentAdvisorSchema = z
138
139
  "Too many agent advisor overrides.",
139
140
  );
140
141
 
142
+ export const OmpDisabledAgentsSchema = z
143
+ .array(OmpAgentNameSchema)
144
+ .max(MAX_ROUTING_ENTRIES)
145
+ .refine((value) => new Set(value).size === value.length, "Disabled agents must be unique.");
146
+
147
+ export const OmpToolApprovalSchema = z.enum(["allow", "prompt", "deny"]);
148
+ export type OmpToolApproval = z.infer<typeof OmpToolApprovalSchema>;
149
+
150
+ export const OmpToolPoliciesSchema = z
151
+ .record(
152
+ z.string().regex(/^[A-Za-z0-9_.:-]{1,128}$/u, "Tool names use letters, digits and _ . : -."),
153
+ OmpToolApprovalSchema,
154
+ )
155
+ .refine((value) => Object.keys(value).length <= MAX_ROUTING_ENTRIES, "Too many tool policies.");
156
+
157
+ export const OmpBashRuleSchema = z
158
+ .object({
159
+ match: z
160
+ .string()
161
+ .min(1)
162
+ .max(512)
163
+ .refine((value) => !containsControlCharacter(value), "Rules cannot hold control characters."),
164
+ approval: OmpToolApprovalSchema,
165
+ })
166
+ .strict();
167
+ export type OmpBashRule = z.infer<typeof OmpBashRuleSchema>;
168
+
169
+ export const OmpBashRulesSchema = z.array(OmpBashRuleSchema).max(MAX_BASH_RULES);
170
+
171
+ export const OmpRestrictedFoldersSchema = z
172
+ .array(
173
+ z
174
+ .string()
175
+ .min(1)
176
+ .max(1024)
177
+ .refine(
178
+ (value) => !containsControlCharacter(value),
179
+ "Folders cannot hold control characters.",
180
+ ),
181
+ )
182
+ .max(MAX_ROUTING_ENTRIES)
183
+ .refine((value) => new Set(value).size === value.length, "Restricted folders must be unique.");
184
+
141
185
  export const OMP_STRUCTURED_SETTING_PATHS = [
142
186
  "modelRoles",
143
187
  "retry.fallbackChains",
@@ -146,6 +190,10 @@ export const OMP_STRUCTURED_SETTING_PATHS = [
146
190
  "task.agentServiceTierOverrides",
147
191
  "task.agentPrewalk",
148
192
  "task.agentAdvisor",
193
+ "task.disabledAgents",
194
+ "tools.approval",
195
+ "bash.patterns",
196
+ "tools.restrictedFolders",
149
197
  ] as const;
150
198
  export type OmpStructuredSettingPath = (typeof OMP_STRUCTURED_SETTING_PATHS)[number];
151
199
 
@@ -165,6 +213,14 @@ export function parseOmpStructuredSettingValue(path: string, value: unknown): un
165
213
  return OmpAgentPrewalkSchema.safeParse(value).data;
166
214
  case "task.agentAdvisor":
167
215
  return OmpAgentAdvisorSchema.safeParse(value).data;
216
+ case "task.disabledAgents":
217
+ return OmpDisabledAgentsSchema.safeParse(value).data;
218
+ case "tools.approval":
219
+ return OmpToolPoliciesSchema.safeParse(value).data;
220
+ case "bash.patterns":
221
+ return OmpBashRulesSchema.safeParse(value).data;
222
+ case "tools.restrictedFolders":
223
+ return OmpRestrictedFoldersSchema.safeParse(value).data;
168
224
  default:
169
225
  return undefined;
170
226
  }
@@ -174,6 +230,18 @@ export function isOmpStructuredSettingPath(path: string): path is OmpStructuredS
174
230
  return (OMP_STRUCTURED_SETTING_PATHS as readonly string[]).includes(path);
175
231
  }
176
232
 
233
+ const ARRAY_STRUCTURED_SETTING_PATHS: readonly string[] = [
234
+ "cycleOrder",
235
+ "task.disabledAgents",
236
+ "bash.patterns",
237
+ "tools.restrictedFolders",
238
+ ];
239
+
240
+ /** The OMP value type each structured path must have to be editable. */
241
+ export function structuredSettingType(path: OmpStructuredSettingPath): "array" | "record" {
242
+ return ARRAY_STRUCTURED_SETTING_PATHS.includes(path) ? "array" : "record";
243
+ }
244
+
177
245
  export const OmpSettingSchema = z
178
246
  .object({
179
247
  path: z.string(),
@@ -183,6 +251,8 @@ export const OmpSettingSchema = z
183
251
  redacted: z.boolean().optional(),
184
252
  configured: z.boolean().optional(),
185
253
  workspaceOverride: z.boolean().optional(),
254
+ /** Workspace scope only: the user-level value of a setting whose project value merges with it. */
255
+ userValue: z.unknown().optional(),
186
256
  })
187
257
  .strict();
188
258
  export type OmpSetting = z.infer<typeof OmpSettingSchema>;
@@ -190,6 +260,7 @@ export type OmpSetting = z.infer<typeof OmpSettingSchema>;
190
260
  export const OMP_SETTING_CATEGORIES = [
191
261
  "appearance",
192
262
  "model",
263
+ "budget",
193
264
  "interaction",
194
265
  "context",
195
266
  "memory",
@@ -244,6 +315,7 @@ const CATEGORY_PREFIXES: Readonly<Record<OmpSettingCategory, readonly string[]>>
244
315
  "prewalk.",
245
316
  "tier.",
246
317
  ],
318
+ budget: ["session.warnCost", "session.maxCost"],
247
319
  interaction: [
248
320
  "autoResume",
249
321
  "power.",
@@ -307,7 +379,88 @@ const CATEGORY_PREFIXES: Readonly<Record<OmpSettingCategory, readonly string[]>>
307
379
  general: [],
308
380
  };
309
381
 
382
+ /** The optional-tool on/off switches, in the order they list when all are the same state. */
383
+ const OMP_TOOL_SWITCHES: readonly { path: string; label: string; description: string }[] = [
384
+ {
385
+ path: "github.enabled",
386
+ label: "GitHub",
387
+ description:
388
+ "Repositories, issues, pull requests and Actions from the agent. Needs the gh command on the PATH.",
389
+ },
390
+ {
391
+ path: "security.enabled",
392
+ label: "Security scan",
393
+ description: "Security scan planning and execution, plus the read-only security:// resources.",
394
+ },
395
+ {
396
+ path: "generate_image.enabled",
397
+ label: "Image generation",
398
+ description: "Text-to-image generation and editing.",
399
+ },
400
+ {
401
+ path: "speechgen.enabled",
402
+ label: "Speech synthesis",
403
+ description: "Turns text into speech files, on-device or with xAI Grok Voice.",
404
+ },
405
+ {
406
+ path: "computer.enabled",
407
+ label: "Desktop control",
408
+ description:
409
+ "Lets the agent script this machine's desktop: screenshots, input and accessibility.",
410
+ },
411
+ {
412
+ path: "lsp.enabled",
413
+ label: "Language servers",
414
+ description: "Code intelligence: definitions, references, diagnostics and rename.",
415
+ },
416
+ {
417
+ path: "debug.enabled",
418
+ label: "Debugger",
419
+ description: "Debugging through DAP adapters.",
420
+ },
421
+ {
422
+ path: "ida.enabled",
423
+ label: "IDA Pro",
424
+ description:
425
+ "Opens executables in IDA Pro and adds the ida tool. Does nothing without an IDA install.",
426
+ },
427
+ {
428
+ path: "checkpoint.enabled",
429
+ label: "Checkpoints",
430
+ description: "Checkpoint and rewind tools for saving and restoring context.",
431
+ },
432
+ {
433
+ path: "task.isolation.enabled",
434
+ label: "Task isolation",
435
+ description: "Lets a task run apart from the shared checkout when it asks to.",
436
+ },
437
+ {
438
+ path: "magicKeywords.enabled",
439
+ label: "Magic keywords",
440
+ description:
441
+ "Hidden notices when a message holds a standalone ultrathink, orchestrate, workflowz or jevify keyword.",
442
+ },
443
+ ];
444
+
445
+ const TOOL_SWITCH_LABELS = new Map(OMP_TOOL_SWITCHES.map(({ path, label }) => [path, label]));
446
+ const SETTING_LABELS = new Map([
447
+ ...TOOL_SWITCH_LABELS,
448
+ ["tools.approvalMode", "Approval mode (not used by Paseo)"],
449
+ ]);
450
+
451
+ const OMP_TOOL_POLICY_PATHS: readonly string[] = [
452
+ "tools.approval",
453
+ "bash.patterns",
454
+ "tools.restrictedFolders",
455
+ ];
456
+
457
+ /** Settings the Tool policy card edits in place of the generic list. */
458
+ export function isOmpToolPolicyPath(path: string): boolean {
459
+ return OMP_TOOL_POLICY_PATHS.includes(path);
460
+ }
461
+
310
462
  export function categorizeOmpSetting(path: string): OmpSettingCategory {
463
+ if (TOOL_SWITCH_LABELS.has(path) || isOmpToolPolicyPath(path)) return "tools";
311
464
  for (const category of OMP_SETTING_CATEGORIES) {
312
465
  if (CATEGORY_PREFIXES[category].some((prefix) => path === prefix || path.startsWith(prefix))) {
313
466
  return category;
@@ -317,6 +470,8 @@ export function categorizeOmpSetting(path: string): OmpSettingCategory {
317
470
  }
318
471
 
319
472
  export function formatOmpSettingLabel(path: string): string {
473
+ const settingLabel = SETTING_LABELS.get(path);
474
+ if (settingLabel) return settingLabel;
320
475
  const leaf = path.split(".").at(-1) ?? path;
321
476
  const words = leaf
322
477
  .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
@@ -325,6 +480,29 @@ export function formatOmpSettingLabel(path: string): string {
325
480
  return words ? `${words[0]?.toUpperCase() ?? ""}${words.slice(1)}` : path;
326
481
  }
327
482
 
483
+ /** Tools category order: enabled switches, then disabled switches, then every other tool setting. */
484
+ export function orderOmpToolSettings(settings: readonly OmpSetting[]): OmpSetting[] {
485
+ const byPath = new Map(settings.map((setting) => [setting.path, setting]));
486
+ const switches = OMP_TOOL_SWITCHES.flatMap(({ path }) => byPath.get(path) ?? []);
487
+ const enabled = switches.filter((setting) => setting.value === true);
488
+ const disabled = switches.filter((setting) => setting.value !== true);
489
+ const rest = settings.filter((setting) => !TOOL_SWITCH_LABELS.has(setting.path));
490
+ return [...enabled, ...disabled, ...rest];
491
+ }
492
+
493
+ /** Plain wording that replaces OMP's own description (or its absence) for these settings. */
494
+ export const OMP_SETTING_DESCRIPTIONS: Readonly<Record<string, string>> = {
495
+ ...Object.fromEntries(OMP_TOOL_SWITCHES.map(({ path, description }) => [path, description])),
496
+ "tools.approvalMode":
497
+ "Has no effect on Paseo agents: Paseo launches OMP with its own approval mode (Full Access, Write Approval or Always Ask), and that flag overrides this setting. It only applies to OMP run outside Paseo.",
498
+ "session.warnCost":
499
+ "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.",
500
+ "session.maxCost":
501
+ "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.",
502
+ "secrets.enabled":
503
+ "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.",
504
+ };
505
+
328
506
  export const listOmpSettings = defineRpc({
329
507
  name: "paseo-omp.list-settings",
330
508
  input: z
@@ -399,6 +577,34 @@ const OmpStructuredSettingChangeSchema = z.discriminatedUnion("path", [
399
577
  value: OmpAgentAdvisorSchema,
400
578
  })
401
579
  .strict(),
580
+ z
581
+ .object({
582
+ operation: z.literal("set"),
583
+ path: z.literal("task.disabledAgents"),
584
+ value: OmpDisabledAgentsSchema,
585
+ })
586
+ .strict(),
587
+ z
588
+ .object({
589
+ operation: z.literal("set"),
590
+ path: z.literal("tools.approval"),
591
+ value: OmpToolPoliciesSchema,
592
+ })
593
+ .strict(),
594
+ z
595
+ .object({
596
+ operation: z.literal("set"),
597
+ path: z.literal("bash.patterns"),
598
+ value: OmpBashRulesSchema,
599
+ })
600
+ .strict(),
601
+ z
602
+ .object({
603
+ operation: z.literal("set"),
604
+ path: z.literal("tools.restrictedFolders"),
605
+ value: OmpRestrictedFoldersSchema,
606
+ })
607
+ .strict(),
402
608
  ]);
403
609
 
404
610
  const OmpSettingChangeSchema = z.union([
@@ -436,3 +642,6 @@ export const updateOmpSettings = defineRpc({
436
642
  }),
437
643
  }),
438
644
  });
645
+
646
+ /** The settings catalog an update returns, which a cache can take in place of a refetch. */
647
+ export type OmpSettingsCatalog = RpcOutput<typeof updateOmpSettings>["catalog"];
@@ -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
+ });