@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
@@ -0,0 +1,435 @@
1
+ import { TextInput } from "@getpaseo/plugin/client/ui";
2
+ import { type ReactNode, useRef, useState } from "react";
3
+ import { Pressable, Text, View } from "react-native";
4
+ import {
5
+ type OmpBashRule,
6
+ OmpBashRuleSchema,
7
+ OmpRestrictedFoldersSchema,
8
+ type OmpSetting,
9
+ type OmpToolApproval,
10
+ } from "../shared/omp-settings";
11
+ import type { OmpConfigStyles } from "./omp-config-styles";
12
+ import {
13
+ canAddBashRule,
14
+ canAddToolRule,
15
+ moveRule,
16
+ policyWarnings,
17
+ readBashRuleDraft,
18
+ readBashRules,
19
+ readFolders,
20
+ readToolPolicies,
21
+ } from "./omp-tool-policy-state";
22
+
23
+ type PolicyDraft = { operation: "set"; value: unknown } | { operation: "reset" };
24
+
25
+ const APPROVALS: readonly { value: OmpToolApproval; label: string }[] = [
26
+ { value: "allow", label: "Allow" },
27
+ { value: "prompt", label: "Ask" },
28
+ { value: "deny", label: "Deny" },
29
+ ];
30
+
31
+ const CAVEATS = [
32
+ "Deny, Ask and restricted-folder rules also apply in Full Access.",
33
+ "A new Deny rule may not guard an agent that is already running until it is reloaded.",
34
+ "Bash rules do not cover commands run through eval, are not a sandbox, and only support * wildcards. The first matching rule wins.",
35
+ ];
36
+
37
+ interface ToolPolicyCardProps {
38
+ settings: readonly OmpSetting[];
39
+ visiblePaths: readonly string[];
40
+ drafts: Readonly<Record<string, PolicyDraft>>;
41
+ disabled: boolean;
42
+ workspaceScoped: boolean;
43
+ resetLabel: string;
44
+ styles: OmpConfigStyles;
45
+ onSet(path: string, value: unknown): void;
46
+ onReset(path: string): void;
47
+ }
48
+
49
+ const ACTION_GROUP = { flexDirection: "row", flexWrap: "wrap", gap: 8 } as const;
50
+
51
+ function Action({
52
+ label,
53
+ text,
54
+ disabled,
55
+ selected,
56
+ styles,
57
+ onPress,
58
+ }: {
59
+ label: string;
60
+ text: string;
61
+ disabled: boolean;
62
+ selected?: boolean;
63
+ styles: OmpConfigStyles;
64
+ onPress(): void;
65
+ }) {
66
+ return (
67
+ <Pressable
68
+ accessibilityRole="button"
69
+ accessibilityLabel={label}
70
+ accessibilityState={{ selected: selected === true }}
71
+ disabled={disabled}
72
+ onPress={onPress}
73
+ style={[styles.editorAction, selected ? styles.editorActionPrimary : null]}
74
+ >
75
+ <Text style={[styles.editorActionText, selected ? styles.editorActionTextPrimary : null]}>
76
+ {text}
77
+ </Text>
78
+ </Pressable>
79
+ );
80
+ }
81
+
82
+ function ApprovalChoice({
83
+ subject,
84
+ value,
85
+ disabled,
86
+ styles,
87
+ onChange,
88
+ }: {
89
+ subject: string;
90
+ value: OmpToolApproval;
91
+ disabled: boolean;
92
+ styles: OmpConfigStyles;
93
+ onChange(value: OmpToolApproval): void;
94
+ }) {
95
+ return (
96
+ <>
97
+ {APPROVALS.map((choice) => (
98
+ <Action
99
+ key={choice.value}
100
+ label={`${choice.label} ${subject}`}
101
+ text={choice.label}
102
+ disabled={disabled}
103
+ selected={value === choice.value}
104
+ styles={styles}
105
+ onPress={() => onChange(choice.value)}
106
+ />
107
+ ))}
108
+ </>
109
+ );
110
+ }
111
+
112
+ function PolicySection({
113
+ title,
114
+ description,
115
+ pending,
116
+ showReset,
117
+ resetLabel,
118
+ disabled,
119
+ styles,
120
+ onReset,
121
+ children,
122
+ }: {
123
+ title: string;
124
+ description: string;
125
+ pending: boolean;
126
+ showReset: boolean;
127
+ resetLabel: string;
128
+ disabled: boolean;
129
+ styles: OmpConfigStyles;
130
+ onReset(): void;
131
+ children: ReactNode;
132
+ }) {
133
+ return (
134
+ <View style={styles.setting}>
135
+ <Text style={styles.cardTitle}>{title}</Text>
136
+ <Text style={styles.settingDescription}>{description}</Text>
137
+ {pending ? (
138
+ <Text style={styles.muted}>{resetLabel} when changes are applied</Text>
139
+ ) : (
140
+ <View style={styles.recordList}>{children}</View>
141
+ )}
142
+ {showReset ? (
143
+ <Pressable accessibilityRole="button" disabled={disabled} onPress={onReset}>
144
+ <Text style={styles.resetAction}>{resetLabel}</Text>
145
+ </Pressable>
146
+ ) : null}
147
+ </View>
148
+ );
149
+ }
150
+
151
+ function AddRow({
152
+ label,
153
+ inputLabel,
154
+ placeholder,
155
+ valid,
156
+ disabled,
157
+ styles,
158
+ onAdd,
159
+ }: {
160
+ label: string;
161
+ inputLabel: string;
162
+ placeholder: string;
163
+ valid(text: string): boolean;
164
+ disabled: boolean;
165
+ styles: OmpConfigStyles;
166
+ onAdd(text: string): void;
167
+ }) {
168
+ const [text, setText] = useState("");
169
+ const trimmed = text.trim();
170
+ return (
171
+ <View style={styles.recordRow}>
172
+ <TextInput
173
+ accessibilityLabel={inputLabel}
174
+ editable={!disabled}
175
+ placeholder={placeholder}
176
+ value={text}
177
+ onChangeText={setText}
178
+ style={styles.scalarInput}
179
+ />
180
+ <Action
181
+ label={label}
182
+ text="Add"
183
+ disabled={disabled || !valid(trimmed)}
184
+ styles={styles}
185
+ onPress={() => {
186
+ onAdd(trimmed);
187
+ setText("");
188
+ }}
189
+ />
190
+ </View>
191
+ );
192
+ }
193
+
194
+ /** Rules have no identity of their own and their order is the data, so each row carries an id that follows it through moves and removals. */
195
+ function useRuleIds(length: number) {
196
+ const ids = useRef<number[]>([]);
197
+ const nextId = useRef(0);
198
+ while (ids.current.length < length) ids.current.push(nextId.current++);
199
+ ids.current.length = length;
200
+ return ids;
201
+ }
202
+
203
+ export function ToolPolicyCard({
204
+ settings,
205
+ visiblePaths,
206
+ drafts,
207
+ disabled,
208
+ workspaceScoped,
209
+ resetLabel,
210
+ styles,
211
+ onSet,
212
+ onReset,
213
+ }: ToolPolicyCardProps) {
214
+ const byPath = new Map(settings.map((setting) => [setting.path, setting]));
215
+ const current = (path: string): unknown => {
216
+ const draft = drafts[path];
217
+ return draft?.operation === "set" ? draft.value : byPath.get(path)?.value;
218
+ };
219
+ const resetting = (path: string) => drafts[path]?.operation === "reset";
220
+ const canReset = (path: string) =>
221
+ !workspaceScoped || byPath.get(path)?.workspaceOverride === true;
222
+ const inheritedPolicies = readToolPolicies(
223
+ workspaceScoped ? byPath.get("tools.approval")?.userValue : undefined,
224
+ );
225
+ const policies = readToolPolicies(current("tools.approval"));
226
+ const bashDraft = drafts["bash.patterns"];
227
+ const rules =
228
+ bashDraft?.operation === "set"
229
+ ? readBashRuleDraft(bashDraft.value)
230
+ : readBashRules(byPath.get("bash.patterns")?.value);
231
+ const folders = readFolders(current("tools.restrictedFolders"));
232
+ const ruleIds = useRuleIds(rules.length);
233
+ const warnings = policyWarnings({ policies, rules });
234
+ const setRule = (index: number, rule: OmpBashRule) =>
235
+ onSet(
236
+ "bash.patterns",
237
+ rules.map((existing, position) => (position === index ? rule : existing)),
238
+ );
239
+
240
+ return (
241
+ <View style={styles.card}>
242
+ <View style={styles.cardHeader}>
243
+ <Text style={styles.cardTitle}>Tool policy</Text>
244
+ </View>
245
+ {visiblePaths.includes("tools.approval") ? (
246
+ <PolicySection
247
+ title="Per-tool approval"
248
+ description="Allow runs a tool without asking, Ask requires confirmation and Deny blocks it. These rules win over the approval mode."
249
+ pending={resetting("tools.approval")}
250
+ showReset={canReset("tools.approval")}
251
+ resetLabel={resetLabel}
252
+ disabled={disabled}
253
+ styles={styles}
254
+ onReset={() => onReset("tools.approval")}
255
+ >
256
+ {Object.entries(policies).map(([tool, approval]) => (
257
+ <View key={tool} style={styles.recordRow}>
258
+ <Text selectable style={styles.recordKey}>
259
+ {tool}
260
+ </Text>
261
+ <View style={ACTION_GROUP}>
262
+ <ApprovalChoice
263
+ subject={tool}
264
+ value={approval}
265
+ disabled={disabled}
266
+ styles={styles}
267
+ onChange={(next) => onSet("tools.approval", { ...policies, [tool]: next })}
268
+ />
269
+ {inheritedPolicies[tool] === approval ? (
270
+ <Text style={styles.muted}>From user config</Text>
271
+ ) : (
272
+ <Action
273
+ label={`Remove ${tool}`}
274
+ text="Remove"
275
+ disabled={disabled}
276
+ styles={styles}
277
+ onPress={() =>
278
+ onSet(
279
+ "tools.approval",
280
+ Object.fromEntries(
281
+ Object.entries(policies).filter(([name]) => name !== tool),
282
+ ),
283
+ )
284
+ }
285
+ />
286
+ )}
287
+ </View>
288
+ </View>
289
+ ))}
290
+ <AddRow
291
+ label="Add tool rule"
292
+ inputLabel="Tool name"
293
+ placeholder="Tool, e.g. eval"
294
+ valid={(text) => canAddToolRule(policies, text)}
295
+ disabled={disabled}
296
+ styles={styles}
297
+ onAdd={(tool) => onSet("tools.approval", { ...policies, [tool]: "prompt" })}
298
+ />
299
+ </PolicySection>
300
+ ) : null}
301
+ {visiblePaths.includes("bash.patterns") ? (
302
+ <PolicySection
303
+ title="Bash command rules"
304
+ description="Matched top to bottom against each bash command; the first match decides. Use * as a wildcard, for example npm test* or git push --force*."
305
+ pending={resetting("bash.patterns")}
306
+ showReset={canReset("bash.patterns")}
307
+ resetLabel={resetLabel}
308
+ disabled={disabled}
309
+ styles={styles}
310
+ onReset={() => onReset("bash.patterns")}
311
+ >
312
+ {rules.map((rule, index) => (
313
+ <View key={ruleIds.current[index]} style={styles.recordRow}>
314
+ <Text style={styles.recordKey}>{index + 1}</Text>
315
+ <TextInput
316
+ accessibilityLabel={`Bash rule ${index + 1} pattern`}
317
+ editable={!disabled}
318
+ value={rule.match}
319
+ onChangeText={(match) => setRule(index, { ...rule, match })}
320
+ style={styles.scalarInput}
321
+ />
322
+ {OmpBashRuleSchema.safeParse(rule).success ? null : (
323
+ <Text style={styles.error}>Enter a pattern of 1 to 512 characters.</Text>
324
+ )}
325
+ <View style={ACTION_GROUP}>
326
+ <ApprovalChoice
327
+ subject={`for bash rule ${index + 1}`}
328
+ value={rule.approval}
329
+ disabled={disabled}
330
+ styles={styles}
331
+ onChange={(approval) => setRule(index, { ...rule, approval })}
332
+ />
333
+ <Action
334
+ label={`Move bash rule ${index + 1} up`}
335
+ text="Up"
336
+ disabled={disabled || index === 0}
337
+ styles={styles}
338
+ onPress={() => {
339
+ ruleIds.current = moveRule(ruleIds.current, index, -1);
340
+ onSet("bash.patterns", moveRule(rules, index, -1));
341
+ }}
342
+ />
343
+ <Action
344
+ label={`Move bash rule ${index + 1} down`}
345
+ text="Down"
346
+ disabled={disabled || index === rules.length - 1}
347
+ styles={styles}
348
+ onPress={() => {
349
+ ruleIds.current = moveRule(ruleIds.current, index, 1);
350
+ onSet("bash.patterns", moveRule(rules, index, 1));
351
+ }}
352
+ />
353
+ <Action
354
+ label={`Remove bash rule ${index + 1}`}
355
+ text="Remove"
356
+ disabled={disabled}
357
+ styles={styles}
358
+ onPress={() => {
359
+ ruleIds.current = ruleIds.current.filter((_, position) => position !== index);
360
+ onSet(
361
+ "bash.patterns",
362
+ rules.filter((_, position) => position !== index),
363
+ );
364
+ }}
365
+ />
366
+ </View>
367
+ </View>
368
+ ))}
369
+ <AddRow
370
+ label="Add bash rule"
371
+ inputLabel="Bash command pattern"
372
+ placeholder="Pattern, e.g. npm test*"
373
+ valid={(text) => canAddBashRule(rules, text)}
374
+ disabled={disabled}
375
+ styles={styles}
376
+ onAdd={(match) => onSet("bash.patterns", [...rules, { match, approval: "prompt" }])}
377
+ />
378
+ </PolicySection>
379
+ ) : null}
380
+ {visiblePaths.includes("tools.restrictedFolders") ? (
381
+ <PolicySection
382
+ title="Restricted folders"
383
+ description="Every read, write, edit, search or command in these folders, and everything under them, needs an explicit approval in every mode."
384
+ pending={resetting("tools.restrictedFolders")}
385
+ showReset={canReset("tools.restrictedFolders")}
386
+ resetLabel={resetLabel}
387
+ disabled={disabled}
388
+ styles={styles}
389
+ onReset={() => onReset("tools.restrictedFolders")}
390
+ >
391
+ {folders.map((folder, index) => (
392
+ <View key={folder} style={styles.recordRow}>
393
+ <Text selectable style={styles.recordValue}>
394
+ {folder}
395
+ </Text>
396
+ <Action
397
+ label={`Remove ${folder}`}
398
+ text="Remove"
399
+ disabled={disabled}
400
+ styles={styles}
401
+ onPress={() =>
402
+ onSet(
403
+ "tools.restrictedFolders",
404
+ folders.filter((_, position) => position !== index),
405
+ )
406
+ }
407
+ />
408
+ </View>
409
+ ))}
410
+ <AddRow
411
+ label="Add restricted folder"
412
+ inputLabel="Restricted folder path"
413
+ placeholder="Path, e.g. ~/secrets"
414
+ valid={(text) => OmpRestrictedFoldersSchema.safeParse([...folders, text]).success}
415
+ disabled={disabled}
416
+ styles={styles}
417
+ onAdd={(folder) => onSet("tools.restrictedFolders", [...folders, folder])}
418
+ />
419
+ </PolicySection>
420
+ ) : null}
421
+ <View style={styles.setting}>
422
+ {warnings.map((warning) => (
423
+ <Text key={warning} style={styles.error}>
424
+ {warning}
425
+ </Text>
426
+ ))}
427
+ {CAVEATS.map((caveat) => (
428
+ <Text key={caveat} style={styles.settingDescription}>
429
+ {caveat}
430
+ </Text>
431
+ ))}
432
+ </View>
433
+ </View>
434
+ );
435
+ }
@@ -0,0 +1,87 @@
1
+ import { type PluginSurfaceProps, useRpc } from "@getpaseo/plugin/client";
2
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
3
+ import { useState } from "react";
4
+ import { Text, View } from "react-native";
5
+ import { getOmpUpdateStatus, installOmpUpdate, type OmpUpdateStatus } from "../shared/omp-update";
6
+ import { ActionButton, ConfirmModal } from "./omp-accounts-section";
7
+ import type { OmpConfigStyles } from "./omp-config-styles";
8
+
9
+ export const UPDATE_QUERY_KEY = ["paseo-omp", "update-status"] as const;
10
+
11
+ export function summarizeUpdateStatus(status: OmpUpdateStatus): string {
12
+ if (status.state === "available") return `${status.version} available`;
13
+ if (status.state === "up-to-date") return "Up to date";
14
+ return "Could not check for updates";
15
+ }
16
+
17
+ /** The "Update available" line for the omp binary card, with a confirmed Update button. */
18
+ export function OmpUpdateRow({
19
+ styles,
20
+ theme,
21
+ onInstalled,
22
+ }: {
23
+ styles: OmpConfigStyles;
24
+ theme: PluginSurfaceProps["theme"];
25
+ onInstalled(): void;
26
+ }) {
27
+ const queryClient = useQueryClient();
28
+ const loadStatus = useRpc(getOmpUpdateStatus);
29
+ const install = useRpc(installOmpUpdate);
30
+ const status = useQuery({ queryKey: UPDATE_QUERY_KEY, queryFn: () => loadStatus({}) });
31
+ const [confirming, setConfirming] = useState(false);
32
+ const [message, setMessage] = useState<{ ok: boolean; text: string } | null>(null);
33
+ const update = useMutation({
34
+ mutationFn: () => install({}),
35
+ onSuccess: async (result) => {
36
+ await queryClient.cancelQueries({ queryKey: UPDATE_QUERY_KEY });
37
+ queryClient.setQueryData(UPDATE_QUERY_KEY, result.status);
38
+ setMessage({ ok: result.ok, text: result.message });
39
+ onInstalled();
40
+ },
41
+ onError: () => setMessage({ ok: false, text: "Could not update OMP. Try again." }),
42
+ onSettled: () => setConfirming(false),
43
+ });
44
+
45
+ if (status.isLoading) return <Text style={styles.muted}>Checking for an OMP update…</Text>;
46
+ const current = status.data ?? { state: "unknown" as const };
47
+ return (
48
+ <>
49
+ <View style={styles.row}>
50
+ <Text style={styles.rowLabel}>Update</Text>
51
+ <Text
52
+ style={[
53
+ styles.rowValue,
54
+ current.state === "available" ? { color: theme.colors.statusWarning } : null,
55
+ ]}
56
+ >
57
+ {summarizeUpdateStatus(current)}
58
+ </Text>
59
+ {current.state === "available" ? (
60
+ <ActionButton
61
+ styles={styles}
62
+ theme={theme}
63
+ label={update.isPending ? "Updating…" : "Update"}
64
+ disabled={update.isPending}
65
+ onPress={() => setConfirming(true)}
66
+ />
67
+ ) : null}
68
+ </View>
69
+ {message ? (
70
+ <Text style={message.ok ? styles.muted : styles.error}>{message.text}</Text>
71
+ ) : null}
72
+ {confirming ? (
73
+ <ConfirmModal
74
+ styles={styles}
75
+ theme={theme}
76
+ title="Update OMP"
77
+ body="Installs the newest OMP on this host. Agents that are running keep the old version until they restart."
78
+ confirmLabel="Update"
79
+ tone="primary"
80
+ busy={update.isPending}
81
+ onConfirm={() => update.mutate()}
82
+ onCancel={() => setConfirming(false)}
83
+ />
84
+ ) : null}
85
+ </>
86
+ );
87
+ }
@@ -1,3 +1,4 @@
1
+ import type { OmpPromptFiles } from "../shared/omp-prompt-files";
1
2
  import type {
2
3
  OmpLspDiagnostics,
3
4
  OmpMcpDiagnostics,
@@ -7,7 +8,7 @@ import type {
7
8
  OmpVersionStatus,
8
9
  PathState,
9
10
  } from "../shared/provider-diagnostics";
10
- import { isOmpProvider } from "./omp-store-state";
11
+ import { isOmpPluginProvider, isOmpProvider } from "./omp-store-state";
11
12
  import type { PaseoApi, PaseoProviderSnapshotResult } from "./paseo-types";
12
13
 
13
14
  export type ProviderHealthTone = "ok" | "warning" | "danger" | "muted";
@@ -259,3 +260,39 @@ export function selectKnownOmpProviders(
259
260
  : [],
260
261
  );
261
262
  }
263
+
264
+ /** True while any provider this plugin registers (`omp-plugin`, `omp-plugin-<profile>`) is enabled. */
265
+ export function hasEnabledPluginProvider(
266
+ entries: readonly PaseoProviderSnapshotResult["entries"][number][],
267
+ ): boolean {
268
+ return selectKnownOmpProviders(entries).some(
269
+ (provider) => provider.enabled && isOmpPluginProvider(provider.id),
270
+ );
271
+ }
272
+
273
+ export interface PromptFileNotice {
274
+ file: "APPEND_SYSTEM.md" | "SYSTEM.md";
275
+ text: string;
276
+ }
277
+
278
+ /**
279
+ * Paseo's built-in omp provider passes the host Append system prompt as `--append-system-prompt`
280
+ * on create and resume, which makes OMP skip a discovered APPEND_SYSTEM.md. With no host prompt
281
+ * there is no APPEND_SYSTEM.md notice; per-agent prompts are not visible to a plugin.
282
+ */
283
+ export function promptFileNotices(files: OmpPromptFiles): PromptFileNotice[] {
284
+ const notices: PromptFileNotice[] = [];
285
+ if (files.appendSystemFile && files.hostAppendPrompt) {
286
+ notices.push({
287
+ file: "APPEND_SYSTEM.md",
288
+ text: "Paseo's Append system prompt is set, so agents on the built-in omp provider and newly created agents on the omp-plugin provider ignore this file.",
289
+ });
290
+ }
291
+ if (files.systemFile) {
292
+ notices.push({
293
+ file: "SYSTEM.md",
294
+ text: "Active. It replaces OMP's default prompt, so OMP's default tool policy is off.",
295
+ });
296
+ }
297
+ return notices;
298
+ }
@@ -21,7 +21,7 @@ type OmpImageSource =
21
21
  /** A decoded screenshot can hold several MB, so drop it soon after nothing shows it. */
22
22
  const IMAGE_QUERY_GC_MS = 60_000;
23
23
 
24
- function useOmpImageSource(image: OmpImage, hostId: string): OmpImageSource {
24
+ export function useOmpImageSource(image: OmpImage, hostId: string): OmpImageSource {
25
25
  const fetchImage = useRpc(getOmpImage);
26
26
  const ref = "ref" in image ? image.ref : null;
27
27
  const query = useQuery({
@@ -0,0 +1,33 @@
1
+ import type { PluginTimelineItemProps } from "@getpaseo/plugin/client";
2
+ import { Icon } from "@getpaseo/plugin/client/ui";
3
+ import { Pressable, Text, View } from "react-native";
4
+ import type { OmpRuleNotice } from "../shared/rule-notices";
5
+
6
+ export function OmpRuleNoticeRow({
7
+ item,
8
+ theme,
9
+ openRule,
10
+ }: PluginTimelineItemProps<OmpRuleNotice> & { openRule(name: string): void }) {
11
+ const color = theme.colors.foregroundMuted;
12
+ return (
13
+ <View style={{ gap: 2, paddingVertical: 2 }}>
14
+ {item.data.rules.map((rule) => (
15
+ <View key={rule.name} style={{ flexDirection: "row", alignItems: "center", gap: 6 }}>
16
+ <Icon name="ShieldAlert" size={14} color={color} />
17
+ <Text style={{ color, fontSize: 13, flexShrink: 1 }} numberOfLines={2}>
18
+ {rule.matched === null
19
+ ? `OMP rule ${rule.name} fired`
20
+ : `OMP rule ${rule.name} fired on “${rule.matched}”`}
21
+ </Text>
22
+ <Pressable
23
+ accessibilityRole="link"
24
+ accessibilityLabel={`Open rule ${rule.name} in OMP settings`}
25
+ onPress={() => openRule(rule.name)}
26
+ >
27
+ <Text style={{ color: theme.colors.accent, fontSize: 13 }}>View rule</Text>
28
+ </Pressable>
29
+ </View>
30
+ ))}
31
+ </View>
32
+ );
33
+ }