@omercnet/paseo-omp 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +25 -13
  3. package/SUPPORT.md +6 -2
  4. package/TESTING.md +21 -18
  5. package/client/composer-pill-settings.tsx +157 -0
  6. package/client/external-url.ts +15 -0
  7. package/client/mcp-authorization.tsx +169 -0
  8. package/client/mcp-popover.tsx +155 -0
  9. package/client/memory-panel.tsx +8 -3
  10. package/client/memory-popover.tsx +8 -4
  11. package/client/omp-config-surface.tsx +189 -29
  12. package/client/omp-plugin-manager.tsx +302 -131
  13. package/client/omp-store-picker.tsx +89 -0
  14. package/client/omp-store-state.ts +45 -0
  15. package/client/paseo-types.ts +9 -0
  16. package/client/provider-diagnostics-state.ts +18 -7
  17. package/client/quota-popover.tsx +8 -3
  18. package/client/quota-state.ts +16 -7
  19. package/client/sessions-popover.tsx +8 -3
  20. package/docs/alpha-release-checklist.md +6 -8
  21. package/docs/configuration.md +8 -4
  22. package/docs/core-provider-issue-audit.md +3 -2
  23. package/docs/images/mcp-authorization-compact.png +0 -0
  24. package/docs/images/mcp-controls-wide.png +0 -0
  25. package/docs/images/plugin-manager.png +0 -0
  26. package/docs/images/workspace-settings.png +0 -0
  27. package/docs/installation.md +35 -19
  28. package/index.client.tsx +339 -123
  29. package/index.server.ts +44 -14
  30. package/package.json +7 -8
  31. package/paseo-plugin.json +2 -2
  32. package/scripts/prepare-dependencies.mjs +24 -0
  33. package/server/mcp-browser.ts +95 -0
  34. package/server/memory.ts +2 -2
  35. package/server/omp-config.ts +16 -7
  36. package/server/omp-plugins.ts +70 -21
  37. package/server/omp-settings.ts +232 -24
  38. package/server/paths.ts +128 -11
  39. package/server/provider/catalog.ts +3 -4
  40. package/server/provider/connection.ts +213 -9
  41. package/server/provider/host-tools.ts +71 -0
  42. package/server/provider/omp-rpc.ts +82 -15
  43. package/server/provider/profile-providers.ts +249 -0
  44. package/server/provider/registration.ts +11 -0
  45. package/server/provider/session-descriptors.ts +306 -1
  46. package/server/provider/session.ts +704 -249
  47. package/server/provider/subsessions.ts +4 -1
  48. package/server/provider/timeline-projector.ts +70 -33
  49. package/server/provider-diagnostics.ts +122 -36
  50. package/server/quota.ts +3 -2
  51. package/server/sessions.ts +2 -2
  52. package/shared/composer-pill-settings.ts +28 -0
  53. package/shared/external-url.ts +21 -0
  54. package/shared/hub.ts +3 -3
  55. package/shared/mcp.ts +47 -0
  56. package/shared/memory.ts +2 -1
  57. package/shared/omp-config.ts +5 -1
  58. package/shared/omp-plugins.ts +74 -33
  59. package/shared/omp-settings.ts +8 -1
  60. package/shared/omp-store.ts +58 -0
  61. package/shared/provider-diagnostics.ts +12 -3
  62. package/shared/quota.ts +2 -1
  63. package/shared/sessions.ts +2 -1
package/shared/hub.ts CHANGED
@@ -23,7 +23,7 @@ export const HubProcessSchema = z.object({
23
23
  exitCode: z.number().nullable(),
24
24
  });
25
25
  export type HubProcess = z.infer<typeof HubProcessSchema>;
26
- const CwdSchema = z.string().min(1).max(4_096);
26
+ export const OmpWorkspaceCwdSchema = z.string().min(1).max(4_096);
27
27
  const ProcessNameSchema = z
28
28
  .string()
29
29
  .min(1)
@@ -32,12 +32,12 @@ const ProcessNameSchema = z
32
32
 
33
33
  export const listHubProcesses = defineRpc({
34
34
  name: "paseo-omp.list-processes",
35
- input: z.object({ cwd: CwdSchema }),
35
+ input: z.object({ cwd: OmpWorkspaceCwdSchema }),
36
36
  output: z.object({ processes: z.array(HubProcessSchema) }),
37
37
  });
38
38
 
39
39
  export const tailHubLog = defineRpc({
40
40
  name: "paseo-omp.tail-log",
41
- input: z.object({ cwd: CwdSchema, name: ProcessNameSchema }),
41
+ input: z.object({ cwd: OmpWorkspaceCwdSchema, name: ProcessNameSchema }),
42
42
  output: z.object({ content: z.string(), truncated: z.boolean() }),
43
43
  });
package/shared/mcp.ts ADDED
@@ -0,0 +1,47 @@
1
+ import { defineRpc } from "@getpaseo/plugin";
2
+ import { z } from "zod";
3
+
4
+ export const OMP_MCP_AUTH_TIMELINE_KIND = "omp-mcp-authorization";
5
+ const OmpMcpAuthorizationUrlSchema = z
6
+ .string()
7
+ .max(16_384)
8
+ .refine((value) => {
9
+ try {
10
+ const url = new URL(value);
11
+ return (
12
+ (url.protocol === "http:" || url.protocol === "https:") && !url.username && !url.password
13
+ );
14
+ } catch {
15
+ return false;
16
+ }
17
+ }, "Authorization URL must be an HTTP URL without embedded credentials");
18
+
19
+ export const ompMcpAuthorizationTimelineSchema = z.object({
20
+ url: OmpMcpAuthorizationUrlSchema,
21
+ instructions: z
22
+ .string()
23
+ .max(64 * 1024)
24
+ .optional(),
25
+ loopbackCallback: z.boolean(),
26
+ browserAuthorizationToken: z.string().uuid().optional(),
27
+ });
28
+
29
+ export type OmpMcpAuthorizationTimeline = z.infer<typeof ompMcpAuthorizationTimelineSchema>;
30
+ export const openOmpMcpAuthorizationInPaseoBrowser = defineRpc({
31
+ name: "paseo-omp.open-mcp-authorization-in-browser",
32
+ input: z.object({ authorizationToken: z.string().uuid() }),
33
+ output: z.object({ opened: z.literal(true) }),
34
+ });
35
+
36
+ const OMP_MCP_SERVER_NAME = /^[a-zA-Z0-9_.:-]{1,100}$/u;
37
+
38
+ export type OmpMcpServerAction = "test" | "reauth" | "enable" | "disable";
39
+
40
+ export function buildOmpMcpServerCommand(
41
+ action: OmpMcpServerAction,
42
+ serverName: string,
43
+ ): string | undefined {
44
+ const name = serverName.trim();
45
+ if (!OMP_MCP_SERVER_NAME.test(name)) return;
46
+ return `/mcp ${action} ${name}`;
47
+ }
package/shared/memory.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { defineRpc } from "@getpaseo/plugin";
2
2
  import { z } from "zod";
3
+ import { OmpStoreSchema } from "./omp-store";
3
4
 
4
5
  const CwdSchema = z.string().min(1).max(4_096);
5
6
 
@@ -15,7 +16,7 @@ export type OmpMemoryFact = z.infer<typeof OmpMemoryFactSchema>;
15
16
 
16
17
  export const listOmpMemory = defineRpc({
17
18
  name: "paseo-omp.list-memory",
18
- input: z.object({ cwd: CwdSchema }),
19
+ input: z.object({ store: OmpStoreSchema.optional(), cwd: CwdSchema }),
19
20
  output: z.object({
20
21
  bank: z.string().nullable(),
21
22
  facts: z.array(OmpMemoryFactSchema),
@@ -1,5 +1,7 @@
1
1
  import { defineRpc } from "@getpaseo/plugin";
2
2
  import { z } from "zod";
3
+ import { OmpWorkspaceCwdSchema } from "./hub";
4
+ import { OmpStoreSchema } from "./omp-store";
3
5
 
4
6
  // Mirrors the safe, non-secret subset of omp's on-disk ~/.omp/agent/config.yml. That file is an
5
7
  // internal, unversioned config format owned by the omp harness (source: omp's
@@ -72,7 +74,9 @@ export type OmpConfig = z.infer<typeof OmpConfigSchema>;
72
74
 
73
75
  export const listOmpConfig = defineRpc({
74
76
  name: "paseo-omp.list-config",
75
- input: z.object({}),
77
+ input: z
78
+ .object({ store: OmpStoreSchema.optional(), cwd: OmpWorkspaceCwdSchema.optional() })
79
+ .strict(),
76
80
  output: z.object({
77
81
  path: z.string(),
78
82
  available: z.boolean(),
@@ -1,5 +1,7 @@
1
1
  import { defineRpc } from "@getpaseo/plugin";
2
2
  import { z } from "zod";
3
+ import { OmpWorkspaceCwdSchema } from "./hub";
4
+ import { OmpStoreSchema } from "./omp-store";
3
5
 
4
6
  export const OMP_PLUGIN_LIMIT = 256;
5
7
  export const OMP_PLUGIN_ARGUMENT_LIMIT = 512;
@@ -72,6 +74,7 @@ export const OmpInstalledPluginSchema = z
72
74
  availableFeatures: z.array(z.string().min(1).max(128)).max(128),
73
75
  configurable: z.boolean(),
74
76
  ambiguous: z.boolean(),
77
+ configAmbiguous: z.boolean(),
75
78
  usesDefaultFeatures: z.boolean(),
76
79
  })
77
80
  .strict();
@@ -89,7 +92,9 @@ export type OmpPluginState = z.infer<typeof OmpPluginStateSchema>;
89
92
 
90
93
  export const listOmpPlugins = defineRpc({
91
94
  name: "paseo-omp.list-plugins",
92
- input: z.object({}).strict(),
95
+ input: z
96
+ .object({ store: OmpStoreSchema.optional(), cwd: OmpWorkspaceCwdSchema.optional() })
97
+ .strict(),
93
98
  output: OmpPluginStateSchema,
94
99
  });
95
100
 
@@ -121,7 +126,13 @@ export type OmpPluginConfigState = z.infer<typeof OmpPluginConfigStateSchema>;
121
126
 
122
127
  export const inspectOmpPluginConfig = defineRpc({
123
128
  name: "paseo-omp.inspect-plugin-config",
124
- input: z.object({ plugin: OmpPluginNameSchema }).strict(),
129
+ input: z
130
+ .object({
131
+ store: OmpStoreSchema.optional(),
132
+ plugin: OmpPluginNameSchema,
133
+ cwd: OmpWorkspaceCwdSchema.optional(),
134
+ })
135
+ .strict(),
125
136
  output: OmpPluginConfigStateSchema,
126
137
  });
127
138
 
@@ -151,6 +162,8 @@ export const OmpPluginConfigMutationSchema = z.discriminatedUnion("action", [
151
162
  plugin: OmpPluginNameSchema,
152
163
  key: OmpPluginConfigKeySchema,
153
164
  value: z.union([OmpPluginConfigStringValueSchema, z.number().finite(), z.boolean()]),
165
+ store: OmpStoreSchema.optional(),
166
+ cwd: OmpWorkspaceCwdSchema.optional(),
154
167
  })
155
168
  .strict(),
156
169
  z
@@ -158,6 +171,8 @@ export const OmpPluginConfigMutationSchema = z.discriminatedUnion("action", [
158
171
  action: z.literal("delete"),
159
172
  plugin: OmpPluginNameSchema,
160
173
  key: OmpPluginConfigKeySchema,
174
+ store: OmpStoreSchema.optional(),
175
+ cwd: OmpWorkspaceCwdSchema.optional(),
161
176
  })
162
177
  .strict(),
163
178
  ]);
@@ -176,38 +191,64 @@ export const mutateOmpPluginConfig = defineRpc({
176
191
  });
177
192
 
178
193
  const ScopedMutationShape = {
179
- scope: z.literal("user").optional(),
194
+ scope: OmpPluginScopeSchema.optional(),
195
+ store: OmpStoreSchema.optional(),
196
+ cwd: OmpWorkspaceCwdSchema.optional(),
180
197
  };
181
-
182
- export const OmpPluginMutationSchema = z.discriminatedUnion("action", [
183
- z
184
- .object({
185
- action: z.literal("install"),
186
- source: OmpPluginInstallSourceSchema,
187
- ...ScopedMutationShape,
188
- })
189
- .strict(),
190
- z
191
- .object({ action: z.literal("enable"), plugin: OmpPluginTargetSchema, ...ScopedMutationShape })
192
- .strict(),
193
- z
194
- .object({ action: z.literal("disable"), plugin: OmpPluginTargetSchema, ...ScopedMutationShape })
195
- .strict(),
196
- z
197
- .object({
198
- action: z.literal("uninstall"),
199
- plugin: OmpPluginTargetSchema,
200
- ...ScopedMutationShape,
201
- })
202
- .strict(),
203
- z
204
- .object({
205
- action: z.literal("upgrade"),
206
- plugin: OmpMarketplacePluginIdSchema,
207
- ...ScopedMutationShape,
208
- })
209
- .strict(),
210
- ]);
198
+ export const OmpPluginMutationSchema = z
199
+ .discriminatedUnion("action", [
200
+ z
201
+ .object({
202
+ action: z.literal("install"),
203
+ source: OmpPluginInstallSourceSchema,
204
+ ...ScopedMutationShape,
205
+ })
206
+ .strict(),
207
+ z
208
+ .object({
209
+ action: z.literal("enable"),
210
+ plugin: OmpPluginTargetSchema,
211
+ ...ScopedMutationShape,
212
+ })
213
+ .strict(),
214
+ z
215
+ .object({
216
+ action: z.literal("disable"),
217
+ plugin: OmpPluginTargetSchema,
218
+ ...ScopedMutationShape,
219
+ })
220
+ .strict(),
221
+ z
222
+ .object({
223
+ action: z.literal("uninstall"),
224
+ plugin: OmpPluginTargetSchema,
225
+ ...ScopedMutationShape,
226
+ })
227
+ .strict(),
228
+ z
229
+ .object({
230
+ action: z.literal("upgrade"),
231
+ plugin: OmpMarketplacePluginIdSchema,
232
+ ...ScopedMutationShape,
233
+ })
234
+ .strict(),
235
+ ])
236
+ .superRefine((input, context) => {
237
+ if (input.scope === "project" && input.cwd === undefined) {
238
+ context.addIssue({
239
+ code: "custom",
240
+ message: "Project-scoped plugin actions require a workspace",
241
+ path: ["cwd"],
242
+ });
243
+ }
244
+ if (input.action === "install" && input.scope === "project") {
245
+ context.addIssue({
246
+ code: "custom",
247
+ message: "Project-scoped installation is not supported through this API",
248
+ path: ["scope"],
249
+ });
250
+ }
251
+ });
211
252
  export type OmpPluginMutation = z.infer<typeof OmpPluginMutationSchema>;
212
253
 
213
254
  export const mutateOmpPlugin = defineRpc({
@@ -1,5 +1,7 @@
1
1
  import { defineRpc } from "@getpaseo/plugin";
2
2
  import { z } from "zod";
3
+ import { OmpWorkspaceCwdSchema } from "./hub";
4
+ import { OmpStoreSchema } from "./omp-store";
3
5
 
4
6
  export const OMP_SETTINGS_CATALOG_VERSION = 1;
5
7
 
@@ -23,6 +25,7 @@ export const OmpSettingSchema = z
23
25
  value: z.unknown().optional(),
24
26
  redacted: z.boolean().optional(),
25
27
  configured: z.boolean().optional(),
28
+ workspaceOverride: z.boolean().optional(),
26
29
  })
27
30
  .strict();
28
31
  export type OmpSetting = z.infer<typeof OmpSettingSchema>;
@@ -167,7 +170,9 @@ export function formatOmpSettingLabel(path: string): string {
167
170
 
168
171
  export const listOmpSettings = defineRpc({
169
172
  name: "paseo-omp.list-settings",
170
- input: z.object({}),
173
+ input: z
174
+ .object({ store: OmpStoreSchema.optional(), cwd: OmpWorkspaceCwdSchema.optional() })
175
+ .strict(),
171
176
  output: z.object({
172
177
  catalogVersion: z.literal(OMP_SETTINGS_CATALOG_VERSION),
173
178
  revision: z.string().optional(),
@@ -187,6 +192,8 @@ const OmpSettingChangeSchema = z.discriminatedUnion("operation", [
187
192
  export const updateOmpSettings = defineRpc({
188
193
  name: "paseo-omp.update-settings",
189
194
  input: z.object({
195
+ store: OmpStoreSchema.optional(),
196
+ cwd: OmpWorkspaceCwdSchema.optional(),
190
197
  revision: z.string(),
191
198
  changes: z.array(OmpSettingChangeSchema).min(1).max(100),
192
199
  }),
@@ -0,0 +1,58 @@
1
+ import { defineRpc } from "@getpaseo/plugin";
2
+ import { z } from "zod";
3
+
4
+ const OMP_PROFILE_NAME = /^[a-z0-9][a-z0-9._-]{0,63}$/u;
5
+ const WINDOWS_RESERVED_PROFILE = /^(?:CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])(?:\..*)?$/iu;
6
+
7
+ export function isOmpProfileName(value: string): boolean {
8
+ return (
9
+ value !== "default" &&
10
+ !value.endsWith(".") &&
11
+ OMP_PROFILE_NAME.test(value) &&
12
+ !WINDOWS_RESERVED_PROFILE.test(value)
13
+ );
14
+ }
15
+
16
+ export const OmpProfileNameSchema = z.string().trim().refine(isOmpProfileName, {
17
+ message: "Invalid named OMP profile",
18
+ });
19
+ export const OmpStoreSchema = z
20
+ .object({
21
+ profile: OmpProfileNameSchema.optional(),
22
+ agentDir: z
23
+ .string()
24
+ .min(1)
25
+ .max(4096)
26
+ .refine((value) => !value.includes("\0"))
27
+ // Browser validation accepts absolute paths from any supported server OS;
28
+ // withOmpStore additionally applies node:path.isAbsolute on the server.
29
+ .refine(
30
+ (value) => /^(?:\/|[A-Za-z]:[\\/]|\\)/u.test(value),
31
+ "OMP agent directory must be absolute",
32
+ )
33
+ .optional(),
34
+ })
35
+ .strict()
36
+ .refine(
37
+ (value) => !(value.profile && value.agentDir),
38
+ "Choose a profile or agent directory, not both",
39
+ );
40
+ export type OmpStore = z.infer<typeof OmpStoreSchema>;
41
+ export const listOmpStores = defineRpc({
42
+ name: "paseo-omp.list-stores",
43
+ input: z.object({}).strict(),
44
+ output: z.object({ profiles: z.array(OmpProfileNameSchema).max(128) }),
45
+ });
46
+
47
+ export function storeForProvider(provider: string | undefined): OmpStore | undefined {
48
+ if (!provider?.startsWith("omp-plugin-")) return;
49
+ const profile = provider.slice("omp-plugin-".length);
50
+ return isOmpProfileName(profile) ? { profile } : undefined;
51
+ }
52
+ export function storeLabel(store?: OmpStore): string {
53
+ return store?.profile
54
+ ? `Profile: ${store.profile}`
55
+ : store?.agentDir
56
+ ? "Custom agent directory"
57
+ : "Daemon default store";
58
+ }
@@ -1,5 +1,7 @@
1
1
  import { defineRpc } from "@getpaseo/plugin";
2
2
  import { z } from "zod";
3
+ import { OmpWorkspaceCwdSchema } from "./hub";
4
+ import { OmpStoreSchema } from "./omp-store";
3
5
 
4
6
  // Health/compatibility facts about the omp CLI itself, surfaced on the global OMP page. This is
5
7
  // an explicit allowlist, not a passthrough: filesystem locations are sanitized display labels
@@ -48,9 +50,12 @@ export const OmpProcessDiagnosticsSchema = z.object({
48
50
  /** "partial" means a project daemon directory or candidate metadata file could not be
49
51
  * inspected; the count reflects only entries whose metadata was confirmed. */
50
52
  status: z.enum(["ok", "partial", "unavailable", "unknown"]),
51
- /** Count of daemon-supervised process entries tracked under the hub run root; null
52
- * unless "ok" or "partial". */
53
+ /** Metadata file count under the hub run root, never a count of verified live processes. */
53
54
  trackedCount: z.number().int().nonnegative().nullable(),
55
+ /** Counts by recorded state only; optional for compatibility with older plugin hosts. */
56
+ activeCount: z.number().int().nonnegative().nullable().optional(),
57
+ historicalCount: z.number().int().nonnegative().nullable().optional(),
58
+ unknownCount: z.number().int().nonnegative().nullable().optional(),
54
59
  });
55
60
  export type OmpProcessDiagnostics = z.infer<typeof OmpProcessDiagnosticsSchema>;
56
61
 
@@ -112,6 +117,10 @@ export type OmpProviderHealth = z.infer<typeof OmpProviderHealthSchema>;
112
117
 
113
118
  export const getOmpProviderHealth = defineRpc({
114
119
  name: "paseo-omp.get-provider-health",
115
- input: z.object({ force: z.boolean().optional() }),
120
+ input: z.object({
121
+ store: OmpStoreSchema.optional(),
122
+ force: z.boolean().optional(),
123
+ cwd: OmpWorkspaceCwdSchema.optional(),
124
+ }),
116
125
  output: OmpProviderHealthSchema,
117
126
  });
package/shared/quota.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { defineRpc } from "@getpaseo/plugin";
2
2
  import { z } from "zod";
3
+ import { OmpStoreSchema } from "./omp-store";
3
4
 
4
5
  // omp's usage_history stores recorded_at/resets_at as epoch milliseconds (confirmed against
5
6
  // live rows: 13-digit values), not seconds. Any "time remaining" math must diff against
@@ -17,6 +18,6 @@ export type OmpQuota = z.infer<typeof OmpQuotaSchema>;
17
18
 
18
19
  export const listOmpQuotas = defineRpc({
19
20
  name: "paseo-omp.list-quotas",
20
- input: z.object({}),
21
+ input: z.object({ store: OmpStoreSchema.optional() }),
21
22
  output: z.object({ quotas: z.array(OmpQuotaSchema) }),
22
23
  });
@@ -1,5 +1,6 @@
1
1
  import { defineRpc } from "@getpaseo/plugin";
2
2
  import { z } from "zod";
3
+ import { OmpStoreSchema } from "./omp-store";
3
4
 
4
5
  const CwdSchema = z.string().min(1).max(4_096);
5
6
 
@@ -18,6 +19,6 @@ export type OmpSessionEntry = z.infer<typeof OmpSessionEntrySchema>;
18
19
 
19
20
  export const listOmpSessions = defineRpc({
20
21
  name: "paseo-omp.list-sessions",
21
- input: z.object({ cwd: CwdSchema }),
22
+ input: z.object({ store: OmpStoreSchema.optional(), cwd: CwdSchema }),
22
23
  output: z.object({ sessions: z.array(OmpSessionEntrySchema) }),
23
24
  });