@omercnet/paseo-omp 5.4.0 → 5.5.0-next.427.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OVERVIEW.md +7 -1
- package/README.md +2 -1
- package/client/ast-edit.tsx +53 -0
- package/client/composer-pill-settings.tsx +0 -5
- package/client/config-sidebar.tsx +15 -0
- package/client/generated-image.tsx +79 -0
- package/client/lsp-diagnostics.tsx +69 -0
- package/client/omp-config-surface.tsx +438 -108
- package/client/omp-config-views.ts +32 -5
- package/client/omp-extensions-section.tsx +145 -0
- package/client/omp-local-models-section.tsx +215 -0
- package/client/omp-plugin-manager.tsx +198 -3
- package/client/omp-routing-editor.tsx +123 -2
- package/client/omp-rule-test.tsx +140 -0
- package/client/omp-rules-section.tsx +353 -0
- package/client/omp-security-section.tsx +99 -0
- package/client/omp-security-state.ts +14 -0
- package/client/omp-skills-section.tsx +195 -0
- package/client/omp-tool-config-section.tsx +204 -0
- package/client/omp-tool-policy-state.ts +101 -0
- package/client/omp-tool-policy.tsx +435 -0
- package/client/omp-update-row.tsx +87 -0
- package/client/provider-diagnostics-state.ts +38 -1
- package/client/provider-image.tsx +1 -1
- package/client/rule-notice.tsx +33 -0
- package/client/sidebar-compat.ts +0 -109
- package/client/web.ts +34 -0
- package/index.client.tsx +79 -46
- package/index.server.ts +77 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
- package/server/generated-images.ts +57 -0
- package/server/omp-agents.ts +170 -0
- package/server/omp-extensions.ts +235 -0
- package/server/omp-list-setting.ts +98 -0
- package/server/omp-local-models.ts +202 -0
- package/server/omp-models-file.ts +178 -0
- package/server/omp-plugins.ts +182 -0
- package/server/omp-prompt-files.ts +41 -0
- package/server/omp-rule-firings.ts +211 -0
- package/server/omp-rule-switch.ts +38 -0
- package/server/omp-rule-test.ts +82 -0
- package/server/omp-rules.ts +452 -0
- package/server/omp-security.ts +169 -0
- package/server/omp-settings.ts +92 -16
- package/server/omp-skills.ts +179 -0
- package/server/omp-tool-config.ts +144 -0
- package/server/omp-update.ts +203 -0
- package/server/package-version.ts +1 -1
- package/server/provider/connection.ts +1 -1
- package/server/provider/image-cache.ts +1 -1
- package/server/provider/omp-rpc-environment.ts +1 -1
- package/server/provider/session-descriptors.ts +3 -0
- package/server/provider-diagnostics.ts +26 -4
- package/server/regular-file.ts +30 -0
- package/server/rule-notices.ts +112 -0
- package/server/turn-rows.ts +59 -0
- package/server/turn-screenshots.ts +140 -0
- package/shared/ast-edit.ts +124 -0
- package/shared/composer-pill-settings.ts +0 -2
- package/shared/generated-image.ts +68 -0
- package/shared/lsp-diagnostics.ts +141 -0
- package/shared/omp-agents.ts +26 -0
- package/shared/omp-extensions.ts +45 -0
- package/shared/omp-local-models.ts +44 -0
- package/shared/omp-models-file.ts +30 -0
- package/shared/omp-plugins.ts +90 -0
- package/shared/omp-prompt-files.ts +24 -0
- package/shared/omp-rules.ts +134 -0
- package/shared/omp-security.ts +50 -0
- package/shared/omp-settings.ts +211 -2
- package/shared/omp-skills.ts +80 -0
- package/shared/omp-tool-config.ts +283 -0
- package/shared/omp-update.ts +27 -0
- package/shared/provider-image.ts +10 -3
- package/shared/rule-notices.ts +20 -0
- package/client/hub-sidebar.tsx +0 -99
- package/client/sessions-popover.tsx +0 -78
- package/server/sessions.ts +0 -58
- package/shared/sessions.ts +0 -24
package/client/sidebar-compat.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { HubProcess } from "../shared/hub";
|
|
2
1
|
import { isOmpProfileName, type OmpStore } from "../shared/omp-store";
|
|
3
|
-
import { hubProcessTone } from "./hub-status";
|
|
4
2
|
|
|
5
3
|
/** The config screen keeps the id of the retired 0.10 sidebar item so saved links work. */
|
|
6
4
|
export const CONFIG_SCREEN_ID = "config";
|
|
7
|
-
export const HUB_SIDEBAR_ITEM_ID = "hub";
|
|
8
5
|
|
|
9
6
|
type ScreenParams = Readonly<Record<string, string>>;
|
|
10
7
|
|
|
@@ -22,109 +19,3 @@ export function configScreenTitle(params: ScreenParams): string {
|
|
|
22
19
|
const store = configStoreFromParams(params);
|
|
23
20
|
return store?.profile ? `OMP · ${store.profile}` : "OMP";
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
export interface HubWorkspaceProcesses {
|
|
27
|
-
cwd: string;
|
|
28
|
-
processes: readonly HubProcess[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface HubSidebarSummary {
|
|
32
|
-
running: number;
|
|
33
|
-
failed: number;
|
|
34
|
-
total: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function summarizeHubWorkspaces(
|
|
38
|
-
workspaces: readonly HubWorkspaceProcesses[],
|
|
39
|
-
): HubSidebarSummary {
|
|
40
|
-
const summary: HubSidebarSummary = { running: 0, failed: 0, total: 0 };
|
|
41
|
-
for (const { processes } of workspaces) {
|
|
42
|
-
for (const process of processes) {
|
|
43
|
-
summary.total += 1;
|
|
44
|
-
const tone = hubProcessTone(process);
|
|
45
|
-
if (tone === "success") summary.running += 1;
|
|
46
|
-
else if (tone === "danger") summary.failed += 1;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return summary;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** Distinct, non-empty workspace directories in first-seen order, bounded for polling cost. */
|
|
53
|
-
export function workspaceDirectories(
|
|
54
|
-
workspaces: ReadonlyArray<{ workspaceDirectory?: string; projectRootPath: string }>,
|
|
55
|
-
limit = 50,
|
|
56
|
-
): { directories: string[]; truncated: boolean } {
|
|
57
|
-
const directories = new Set<string>();
|
|
58
|
-
for (const workspace of workspaces) {
|
|
59
|
-
const directory = workspace.workspaceDirectory || workspace.projectRootPath;
|
|
60
|
-
if (!directory || directories.has(directory)) continue;
|
|
61
|
-
if (directories.size >= limit) return { directories: [...directories], truncated: true };
|
|
62
|
-
directories.add(directory);
|
|
63
|
-
}
|
|
64
|
-
return { directories: [...directories], truncated: false };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface HubSnapshot {
|
|
68
|
-
workspaces: HubWorkspaceProcesses[];
|
|
69
|
-
/** More workspaces exist than were polled; counts are a lower bound. */
|
|
70
|
-
truncated: boolean;
|
|
71
|
-
/** Workspaces whose hub state could not be read this poll. */
|
|
72
|
-
unreadable: number;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* One poll of hub state. A failing workspace never hides the others; the poll fails only when
|
|
77
|
-
* the workspace list itself fails or every workspace is unreadable.
|
|
78
|
-
*/
|
|
79
|
-
export async function loadHubSnapshot(
|
|
80
|
-
listWorkspaces: () => Promise<{
|
|
81
|
-
entries: ReadonlyArray<{ workspaceDirectory?: string; projectRootPath: string }>;
|
|
82
|
-
pageInfo?: { hasMore?: boolean };
|
|
83
|
-
}>,
|
|
84
|
-
listProcesses: (cwd: string) => Promise<readonly HubProcess[]>,
|
|
85
|
-
): Promise<HubSnapshot> {
|
|
86
|
-
const page = await listWorkspaces();
|
|
87
|
-
const { directories, truncated } = workspaceDirectories(page.entries);
|
|
88
|
-
const results = await Promise.allSettled(
|
|
89
|
-
directories.map(async (cwd) => ({ cwd, processes: await listProcesses(cwd) })),
|
|
90
|
-
);
|
|
91
|
-
const workspaces: HubWorkspaceProcesses[] = [];
|
|
92
|
-
for (const result of results) if (result.status === "fulfilled") workspaces.push(result.value);
|
|
93
|
-
if (directories.length > 0 && workspaces.length === 0) {
|
|
94
|
-
throw new Error("OMP hub state is unreadable");
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
workspaces,
|
|
98
|
-
truncated: truncated || page.pageInfo?.hasMore === true,
|
|
99
|
-
unreadable: directories.length - workspaces.length,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export interface HubTrailing {
|
|
104
|
-
running?: string;
|
|
105
|
-
failed?: string;
|
|
106
|
-
/** Some or all hub state could not be read. */
|
|
107
|
-
unreadable: boolean;
|
|
108
|
-
accessibilityLabel: string;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** What the Hub row's trailing slot shows; null when there is nothing to report. */
|
|
112
|
-
export function hubTrailing(
|
|
113
|
-
snapshot: HubSnapshot | undefined,
|
|
114
|
-
loadFailed: boolean,
|
|
115
|
-
): HubTrailing | null {
|
|
116
|
-
const summary = summarizeHubWorkspaces(snapshot?.workspaces ?? []);
|
|
117
|
-
const atLeast = snapshot?.truncated ? "+" : "";
|
|
118
|
-
const unreadable = loadFailed || (snapshot?.unreadable ?? 0) > 0;
|
|
119
|
-
if (summary.total === 0 && !unreadable) return null;
|
|
120
|
-
const running = summary.total > 0 ? `${summary.running}${atLeast} running` : undefined;
|
|
121
|
-
const failed = summary.failed > 0 ? `${summary.failed}${atLeast} failed` : undefined;
|
|
122
|
-
return {
|
|
123
|
-
...(running ? { running } : {}),
|
|
124
|
-
...(failed ? { failed } : {}),
|
|
125
|
-
unreadable,
|
|
126
|
-
accessibilityLabel: [running, failed, unreadable ? "some hub state unreadable" : undefined]
|
|
127
|
-
.filter(Boolean)
|
|
128
|
-
.join(", "),
|
|
129
|
-
};
|
|
130
|
-
}
|
package/client/web.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Platform } from "react-native";
|
|
2
|
+
|
|
3
|
+
declare const document: {
|
|
4
|
+
createElement(tag: "a"): { href: string; download: string; click(): void };
|
|
5
|
+
};
|
|
6
|
+
declare function atob(data: string): string;
|
|
7
|
+
declare class Blob {
|
|
8
|
+
constructor(parts: Uint8Array[], options: { type: string });
|
|
9
|
+
}
|
|
10
|
+
declare const URL: { createObjectURL(blob: Blob): string; revokeObjectURL(url: string): void };
|
|
11
|
+
|
|
12
|
+
/** Saving a file needs the browser; the desktop app and the web client both run it. */
|
|
13
|
+
export const canDownloadFiles = Platform.OS === "web";
|
|
14
|
+
|
|
15
|
+
const BASE64_DATA_URI = /^data:([^;,]+);base64,(.*)$/su;
|
|
16
|
+
const REVOKE_DELAY_MS = 60_000;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Saves a `data:` URI. Browsers refuse to download a data URL past about 2 MiB, so the bytes go
|
|
20
|
+
* through a Blob and an object URL instead.
|
|
21
|
+
*/
|
|
22
|
+
export function downloadDataUri(uri: string, fileName: string): void {
|
|
23
|
+
if (!canDownloadFiles) return;
|
|
24
|
+
const match = BASE64_DATA_URI.exec(uri);
|
|
25
|
+
const bytes = match ? Uint8Array.from(atob(match[2] ?? ""), (char) => char.charCodeAt(0)) : null;
|
|
26
|
+
const objectUrl =
|
|
27
|
+
match && bytes ? URL.createObjectURL(new Blob([bytes], { type: match[1] ?? "" })) : null;
|
|
28
|
+
const link = document.createElement("a");
|
|
29
|
+
link.href = objectUrl ?? uri;
|
|
30
|
+
link.download = fileName;
|
|
31
|
+
link.click();
|
|
32
|
+
// Safari and Firefox can start the download after the click returns, so revoke late.
|
|
33
|
+
if (objectUrl) setTimeout(() => URL.revokeObjectURL(objectUrl), REVOKE_DELAY_MS);
|
|
34
|
+
}
|
package/index.client.tsx
CHANGED
|
@@ -4,10 +4,13 @@ import type {
|
|
|
4
4
|
PluginClientContext,
|
|
5
5
|
PluginSurfaceProps,
|
|
6
6
|
} from "@getpaseo/plugin/client";
|
|
7
|
+
import { OmpAstEditCard } from "./client/ast-edit";
|
|
8
|
+
import { ConfigSidebarItem } from "./client/config-sidebar";
|
|
9
|
+
import { OmpGeneratedImagesRow } from "./client/generated-image";
|
|
7
10
|
import { OMP_ICON } from "./client/hub-icon";
|
|
8
11
|
import { HubPopover } from "./client/hub-popover";
|
|
9
|
-
import { ConfigSidebarItem, createHubSidebar } from "./client/hub-sidebar";
|
|
10
12
|
import { summarizeHubProcesses } from "./client/hub-status";
|
|
13
|
+
import { OmpLspDiagnosticsCard } from "./client/lsp-diagnostics";
|
|
11
14
|
import { OmpMcpAuthorizationCard } from "./client/mcp-authorization";
|
|
12
15
|
import { McpPopover } from "./client/mcp-popover";
|
|
13
16
|
import { OmpMemoryPanel } from "./client/memory-panel";
|
|
@@ -29,26 +32,36 @@ import {
|
|
|
29
32
|
quotaSeverityForProvider,
|
|
30
33
|
quotaSummaryForProvider,
|
|
31
34
|
} from "./client/quota-state";
|
|
32
|
-
import {
|
|
35
|
+
import { OmpRuleNoticeRow } from "./client/rule-notice";
|
|
33
36
|
import {
|
|
34
37
|
CONFIG_SCREEN_ID,
|
|
35
38
|
configParamsFromStore,
|
|
36
39
|
configScreenTitle,
|
|
37
40
|
configStoreFromParams,
|
|
38
|
-
HUB_SIDEBAR_ITEM_ID,
|
|
39
|
-
loadHubSnapshot,
|
|
40
41
|
} from "./client/sidebar-compat";
|
|
41
42
|
import { OmpSubagentStrip } from "./client/subagents-strip";
|
|
43
|
+
import { OMP_AST_EDIT_KIND, ompAstEditSchema, transformOmpAstEditItem } from "./shared/ast-edit";
|
|
42
44
|
import {
|
|
43
45
|
type ComposerPillSettings,
|
|
44
46
|
composerPillSettings,
|
|
45
47
|
composerPillSettingsSchema,
|
|
46
48
|
} from "./shared/composer-pill-settings";
|
|
49
|
+
import {
|
|
50
|
+
OMP_GENERATED_IMAGE_KIND,
|
|
51
|
+
ompGeneratedImagesSchema,
|
|
52
|
+
transformOmpGeneratedImageItem,
|
|
53
|
+
} from "./shared/generated-image";
|
|
47
54
|
import { listHubProcesses } from "./shared/hub";
|
|
55
|
+
import {
|
|
56
|
+
OMP_LSP_DIAGNOSTICS_KIND,
|
|
57
|
+
ompLspDiagnosticsSchema,
|
|
58
|
+
transformOmpLspToolItem,
|
|
59
|
+
} from "./shared/lsp-diagnostics";
|
|
48
60
|
import { OMP_MCP_AUTH_TIMELINE_KIND, ompMcpAuthorizationTimelineSchema } from "./shared/mcp";
|
|
49
61
|
import { type OmpStore, storeForProvider } from "./shared/omp-store";
|
|
50
62
|
import { ompImageTimelineSchema, transformOmpImageToolItem } from "./shared/provider-image";
|
|
51
63
|
import { listOmpQuotas } from "./shared/quota";
|
|
64
|
+
import { OMP_RULE_NOTICE_KIND, ompRuleNoticeSchema } from "./shared/rule-notices";
|
|
52
65
|
import { OMP_SUBAGENT_STRIP_KIND, ompSubagentStripSchema } from "./shared/subagents";
|
|
53
66
|
|
|
54
67
|
const PAGE_LIMIT = 200;
|
|
@@ -70,7 +83,6 @@ type PillEntry = {
|
|
|
70
83
|
quotaSeverity: QuotaSeverity;
|
|
71
84
|
hub?: PluginButtonRegistration;
|
|
72
85
|
memory?: PluginButtonRegistration;
|
|
73
|
-
sessions?: PluginButtonRegistration;
|
|
74
86
|
quota?: PluginButtonRegistration;
|
|
75
87
|
mcp?: PluginButtonRegistration;
|
|
76
88
|
};
|
|
@@ -83,7 +95,6 @@ function samePillSettings(
|
|
|
83
95
|
left?.mcp === right.mcp &&
|
|
84
96
|
left.hub === right.hub &&
|
|
85
97
|
left.memory === right.memory &&
|
|
86
|
-
left.sessions === right.sessions &&
|
|
87
98
|
left.quota === right.quota
|
|
88
99
|
);
|
|
89
100
|
}
|
|
@@ -91,7 +102,6 @@ function samePillSettings(
|
|
|
91
102
|
function removePills(entry: PillEntry): void {
|
|
92
103
|
entry.hub?.remove();
|
|
93
104
|
entry.memory?.remove();
|
|
94
|
-
entry.sessions?.remove();
|
|
95
105
|
entry.quota?.remove();
|
|
96
106
|
entry.mcp?.remove();
|
|
97
107
|
}
|
|
@@ -112,15 +122,9 @@ async function loadAgents(paseo: PaseoApi): Promise<AgentEntry[]> {
|
|
|
112
122
|
return entries;
|
|
113
123
|
}
|
|
114
124
|
|
|
115
|
-
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
*/
|
|
119
|
-
export function registerConfigAndHub(
|
|
120
|
-
client: Pick<
|
|
121
|
-
PluginClientContext,
|
|
122
|
-
"addScreen" | "addSidebarHeaderItem" | "openScreen" | "rpc" | "paseo"
|
|
123
|
-
>,
|
|
125
|
+
/** A param-addressable `config` screen (same id as the old sidebar item, so saved links resolve to it) and a header row that opens it. */
|
|
126
|
+
export function registerConfig(
|
|
127
|
+
client: Pick<PluginClientContext, "addScreen" | "addSidebarHeaderItem" | "openScreen">,
|
|
124
128
|
onComposerPillSettingsChange: (settings: ComposerPillSettings) => void,
|
|
125
129
|
): () => void {
|
|
126
130
|
function ConfigScreen(props: PluginSurfaceProps & { params: Record<string, string> }) {
|
|
@@ -128,6 +132,7 @@ export function registerConfigAndHub(
|
|
|
128
132
|
return (
|
|
129
133
|
<OmpConfigSurface
|
|
130
134
|
{...props}
|
|
135
|
+
focusRule={props.params.rule}
|
|
131
136
|
onComposerPillSettingsChange={onComposerPillSettingsChange}
|
|
132
137
|
store={current}
|
|
133
138
|
onStoreChange={(store) => {
|
|
@@ -138,13 +143,6 @@ export function registerConfigAndHub(
|
|
|
138
143
|
/>
|
|
139
144
|
);
|
|
140
145
|
}
|
|
141
|
-
const { HubSidebarItem } = createHubSidebar(() =>
|
|
142
|
-
loadHubSnapshot(
|
|
143
|
-
() =>
|
|
144
|
-
client.paseo.workspaces.list({ filter: { includeBackground: true }, page: { limit: 200 } }),
|
|
145
|
-
async (cwd) => (await client.rpc(listHubProcesses, { cwd })).processes,
|
|
146
|
-
),
|
|
147
|
-
);
|
|
148
146
|
const removers = [
|
|
149
147
|
client.addScreen({ id: CONFIG_SCREEN_ID, title: configScreenTitle, Component: ConfigScreen }),
|
|
150
148
|
client.addSidebarHeaderItem({
|
|
@@ -152,11 +150,6 @@ export function registerConfigAndHub(
|
|
|
152
150
|
title: "OMP",
|
|
153
151
|
Component: ConfigSidebarItem,
|
|
154
152
|
}),
|
|
155
|
-
client.addSidebarHeaderItem({
|
|
156
|
-
id: HUB_SIDEBAR_ITEM_ID,
|
|
157
|
-
title: "OMP Hub",
|
|
158
|
-
Component: HubSidebarItem,
|
|
159
|
-
}),
|
|
160
153
|
];
|
|
161
154
|
return () => {
|
|
162
155
|
for (const remove of removers.reverse()) remove();
|
|
@@ -216,7 +209,7 @@ export default function contribute(client: PluginClientContext) {
|
|
|
216
209
|
openPanel("workspace", { location: "workspace" });
|
|
217
210
|
},
|
|
218
211
|
});
|
|
219
|
-
const removeConfigEntry =
|
|
212
|
+
const removeConfigEntry = registerConfig(client, applyComposerPillSettings);
|
|
220
213
|
const removeOpenConfig = client.addCommandCenterItem({
|
|
221
214
|
id: "open-config",
|
|
222
215
|
title: "Open OMP",
|
|
@@ -245,6 +238,30 @@ export default function contribute(client: PluginClientContext) {
|
|
|
245
238
|
schema: ompSubagentStripSchema,
|
|
246
239
|
Component: OmpSubagentStrip,
|
|
247
240
|
});
|
|
241
|
+
const removeRuleNoticeRenderer = client.addTimelineRenderer({
|
|
242
|
+
kind: OMP_RULE_NOTICE_KIND,
|
|
243
|
+
version: 1,
|
|
244
|
+
schema: ompRuleNoticeSchema,
|
|
245
|
+
Component: (props) => (
|
|
246
|
+
<OmpRuleNoticeRow
|
|
247
|
+
{...props}
|
|
248
|
+
openRule={(rule) => client.openScreen({ screenId: CONFIG_SCREEN_ID, params: { rule } })}
|
|
249
|
+
/>
|
|
250
|
+
),
|
|
251
|
+
});
|
|
252
|
+
const removeLspDiagnosticsRenderer = client.addTimelineRenderer({
|
|
253
|
+
kind: OMP_LSP_DIAGNOSTICS_KIND,
|
|
254
|
+
version: 1,
|
|
255
|
+
schema: ompLspDiagnosticsSchema,
|
|
256
|
+
Component: OmpLspDiagnosticsCard,
|
|
257
|
+
});
|
|
258
|
+
const removeLspTransformer = client.addTimelineTransformer({
|
|
259
|
+
id: "omp-lsp-diagnostics",
|
|
260
|
+
query: { itemType: "tool_call" },
|
|
261
|
+
transform({ item }) {
|
|
262
|
+
return transformOmpLspToolItem(item);
|
|
263
|
+
},
|
|
264
|
+
});
|
|
248
265
|
const removeImageTransformer = client.addTimelineTransformer({
|
|
249
266
|
id: "omp-images",
|
|
250
267
|
query: { itemType: "tool_call" },
|
|
@@ -252,6 +269,32 @@ export default function contribute(client: PluginClientContext) {
|
|
|
252
269
|
return transformOmpImageToolItem(item);
|
|
253
270
|
},
|
|
254
271
|
});
|
|
272
|
+
const removeGeneratedImageRenderer = client.addTimelineRenderer({
|
|
273
|
+
kind: OMP_GENERATED_IMAGE_KIND,
|
|
274
|
+
version: 1,
|
|
275
|
+
schema: ompGeneratedImagesSchema,
|
|
276
|
+
Component: OmpGeneratedImagesRow,
|
|
277
|
+
});
|
|
278
|
+
const removeGeneratedImageTransformer = client.addTimelineTransformer({
|
|
279
|
+
id: "omp-generated-images",
|
|
280
|
+
query: { itemType: "tool_call" },
|
|
281
|
+
transform({ item }) {
|
|
282
|
+
return transformOmpGeneratedImageItem(item);
|
|
283
|
+
},
|
|
284
|
+
});
|
|
285
|
+
const removeAstEditRenderer = client.addTimelineRenderer({
|
|
286
|
+
kind: OMP_AST_EDIT_KIND,
|
|
287
|
+
version: 1,
|
|
288
|
+
schema: ompAstEditSchema,
|
|
289
|
+
Component: OmpAstEditCard,
|
|
290
|
+
});
|
|
291
|
+
const removeAstEditTransformer = client.addTimelineTransformer({
|
|
292
|
+
id: "omp-ast-edit",
|
|
293
|
+
query: { itemType: "tool_call" },
|
|
294
|
+
transform({ item }) {
|
|
295
|
+
return transformOmpAstEditItem(item);
|
|
296
|
+
},
|
|
297
|
+
});
|
|
255
298
|
const loadStoreQuotas = createStoreQuotaLoader(
|
|
256
299
|
(input) => client.rpc(listOmpQuotas, input),
|
|
257
300
|
QUOTA_POLL_MS,
|
|
@@ -313,23 +356,6 @@ export default function contribute(client: PluginClientContext) {
|
|
|
313
356
|
entry.memory = undefined;
|
|
314
357
|
}
|
|
315
358
|
|
|
316
|
-
if (settings.sessions) {
|
|
317
|
-
entry.sessions ??= client.addComposerPill({
|
|
318
|
-
id: "sessions",
|
|
319
|
-
workspaceId: entry.workspaceId,
|
|
320
|
-
agentId: agent.id,
|
|
321
|
-
button: {
|
|
322
|
-
title: "OMP session history",
|
|
323
|
-
icon: "History",
|
|
324
|
-
label: "Sessions",
|
|
325
|
-
behavior: { kind: "popover", Content: SessionsPopover },
|
|
326
|
-
},
|
|
327
|
-
});
|
|
328
|
-
} else {
|
|
329
|
-
entry.sessions?.remove();
|
|
330
|
-
entry.sessions = undefined;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
359
|
if (settings.quota) {
|
|
334
360
|
entry.quota ??= client.addComposerPill({
|
|
335
361
|
id: "quota",
|
|
@@ -553,7 +579,14 @@ export default function contribute(client: PluginClientContext) {
|
|
|
553
579
|
removeImageRenderer();
|
|
554
580
|
removeMcpAuthorizationRenderer();
|
|
555
581
|
removeSubagentStripRenderer();
|
|
582
|
+
removeRuleNoticeRenderer();
|
|
583
|
+
removeLspDiagnosticsRenderer();
|
|
584
|
+
removeLspTransformer();
|
|
556
585
|
removeImageTransformer();
|
|
586
|
+
removeGeneratedImageRenderer();
|
|
587
|
+
removeGeneratedImageTransformer();
|
|
588
|
+
removeAstEditRenderer();
|
|
589
|
+
removeAstEditTransformer();
|
|
557
590
|
removeOpenConfig();
|
|
558
591
|
removeConfigEntry();
|
|
559
592
|
removeOpenWorkspace();
|
package/index.server.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PluginServerContext } from "@getpaseo/plugin/server";
|
|
2
|
+
import { resolveGeneratedImages } from "./server/generated-images";
|
|
2
3
|
import { resolveListHubProcesses, resolveTailHubLog } from "./server/hub";
|
|
3
4
|
import {
|
|
4
5
|
OmpBrowserAuthorizationRegistry,
|
|
@@ -6,16 +7,36 @@ import {
|
|
|
6
7
|
} from "./server/mcp-browser";
|
|
7
8
|
import { resolveListOmpMemory } from "./server/memory";
|
|
8
9
|
import { OmpAccounts } from "./server/omp-accounts";
|
|
10
|
+
import { resolveListOmpAgents } from "./server/omp-agents";
|
|
9
11
|
import { resolveListOmpConfig } from "./server/omp-config";
|
|
12
|
+
import { resolveListOmpExtensions, resolveSetOmpExtensionEnabled } from "./server/omp-extensions";
|
|
13
|
+
import { resolveDownloadOmpLocalModel, resolveListOmpLocalModels } from "./server/omp-local-models";
|
|
10
14
|
import { OmpMcps } from "./server/omp-mcps";
|
|
11
15
|
import { resolveListOmpModels } from "./server/omp-models";
|
|
16
|
+
import { resolveGetOmpModelsFileStatus, resolveRefreshOmpModels } from "./server/omp-models-file";
|
|
12
17
|
import {
|
|
18
|
+
resolveBrowseOmpMarketplace,
|
|
13
19
|
resolveInspectOmpPluginConfig,
|
|
20
|
+
resolveListOmpMarketplaces,
|
|
14
21
|
resolveListOmpPlugins,
|
|
22
|
+
resolveMutateOmpMarketplace,
|
|
15
23
|
resolveMutateOmpPlugin,
|
|
16
24
|
resolveMutateOmpPluginConfig,
|
|
17
25
|
} from "./server/omp-plugins";
|
|
26
|
+
import { readHostAppendPrompt, readOmpPromptFiles } from "./server/omp-prompt-files";
|
|
27
|
+
import { resolveListOmpRuleFirings } from "./server/omp-rule-firings";
|
|
28
|
+
import { resolveSetOmpRuleEnabled } from "./server/omp-rule-switch";
|
|
29
|
+
import { resolveTestOmpRules } from "./server/omp-rule-test";
|
|
30
|
+
import { resolveListOmpRules } from "./server/omp-rules";
|
|
31
|
+
import { resolveListOmpSecurity } from "./server/omp-security";
|
|
18
32
|
import { resolveListOmpSettings, resolveUpdateOmpSettings } from "./server/omp-settings";
|
|
33
|
+
import {
|
|
34
|
+
resolveDeleteOmpManagedSkill,
|
|
35
|
+
resolveListOmpSkills,
|
|
36
|
+
resolveSetOmpSkillEnabled,
|
|
37
|
+
} from "./server/omp-skills";
|
|
38
|
+
import { resolveReadOmpToolConfig, resolveWriteOmpToolConfig } from "./server/omp-tool-config";
|
|
39
|
+
import { resolveGetOmpUpdateStatus, resolveInstallOmpUpdate } from "./server/omp-update";
|
|
19
40
|
import { OmpOperationalFailureCollector } from "./server/operational-failure-diagnostics";
|
|
20
41
|
import { withOmpStore } from "./server/paths";
|
|
21
42
|
import { OmpProtocolViolationCollector } from "./server/protocol-violation-diagnostics";
|
|
@@ -31,14 +52,17 @@ import { OmpPublicError } from "./server/provider/security";
|
|
|
31
52
|
import { OmpSessionLimit } from "./server/provider/session-limit";
|
|
32
53
|
import { resolveGetOmpProviderHealth } from "./server/provider-diagnostics";
|
|
33
54
|
import { resolveListOmpQuotas } from "./server/quota";
|
|
34
|
-
import {
|
|
55
|
+
import { ompRuleNoticeRow } from "./server/rule-notices";
|
|
35
56
|
import {
|
|
36
57
|
OmpSubagentControlRegistry,
|
|
37
58
|
resolveCancelOmpSubagent,
|
|
38
59
|
resolveSteerOmpSubagent,
|
|
39
60
|
} from "./server/subagents";
|
|
40
61
|
import { resolveGetOmpSupportReport } from "./server/support-diagnostics";
|
|
62
|
+
import { registerOmpTurnRows } from "./server/turn-rows";
|
|
63
|
+
import { ompScreenshotRow } from "./server/turn-screenshots";
|
|
41
64
|
import { composerPillSettings } from "./shared/composer-pill-settings";
|
|
65
|
+
import { resolveOmpGeneratedImages } from "./shared/generated-image";
|
|
42
66
|
import { listHubProcesses, tailHubLog } from "./shared/hub";
|
|
43
67
|
import { openOmpMcpAuthorizationInPaseoBrowser } from "./shared/mcp";
|
|
44
68
|
import { listOmpMemory } from "./shared/memory";
|
|
@@ -52,7 +76,10 @@ import {
|
|
|
52
76
|
startOmpAccountLogin,
|
|
53
77
|
submitOmpAccountLoginCode,
|
|
54
78
|
} from "./shared/omp-accounts";
|
|
79
|
+
import { listOmpAgents } from "./shared/omp-agents";
|
|
55
80
|
import { listOmpConfig } from "./shared/omp-config";
|
|
81
|
+
import { listOmpExtensions, setOmpExtensionEnabled } from "./shared/omp-extensions";
|
|
82
|
+
import { downloadOmpLocalModel, listOmpLocalModels } from "./shared/omp-local-models";
|
|
56
83
|
import {
|
|
57
84
|
addOmpMcp,
|
|
58
85
|
cancelOmpMcpAuth,
|
|
@@ -62,19 +89,33 @@ import {
|
|
|
62
89
|
submitOmpMcpAuthCode,
|
|
63
90
|
} from "./shared/omp-mcps";
|
|
64
91
|
import { listOmpModels } from "./shared/omp-models";
|
|
92
|
+
import { getOmpModelsFileStatus, refreshOmpModels } from "./shared/omp-models-file";
|
|
65
93
|
import {
|
|
94
|
+
browseOmpMarketplace,
|
|
66
95
|
inspectOmpPluginConfig,
|
|
96
|
+
listOmpMarketplaces,
|
|
67
97
|
listOmpPlugins,
|
|
98
|
+
mutateOmpMarketplace,
|
|
68
99
|
mutateOmpPlugin,
|
|
69
100
|
mutateOmpPluginConfig,
|
|
70
101
|
} from "./shared/omp-plugins";
|
|
102
|
+
import { getOmpPromptFiles } from "./shared/omp-prompt-files";
|
|
103
|
+
import {
|
|
104
|
+
listOmpRuleFirings,
|
|
105
|
+
listOmpRules,
|
|
106
|
+
setOmpRuleEnabled,
|
|
107
|
+
testOmpRules,
|
|
108
|
+
} from "./shared/omp-rules";
|
|
109
|
+
import { listOmpSecurity } from "./shared/omp-security";
|
|
71
110
|
import { listOmpSettings, updateOmpSettings } from "./shared/omp-settings";
|
|
111
|
+
import { deleteOmpManagedSkill, listOmpSkills, setOmpSkillEnabled } from "./shared/omp-skills";
|
|
72
112
|
import { listOmpStores, type OmpStore } from "./shared/omp-store";
|
|
113
|
+
import { readOmpToolConfig, writeOmpToolConfig } from "./shared/omp-tool-config";
|
|
114
|
+
import { getOmpUpdateStatus, installOmpUpdate } from "./shared/omp-update";
|
|
73
115
|
import { getOmpProviderHealth } from "./shared/provider-diagnostics";
|
|
74
116
|
import { getOmpImage } from "./shared/provider-image";
|
|
75
117
|
import { providerLaunchSettings } from "./shared/provider-launch-settings";
|
|
76
118
|
import { listOmpQuotas } from "./shared/quota";
|
|
77
|
-
import { listOmpSessions } from "./shared/sessions";
|
|
78
119
|
import { cancelOmpSubagent, steerOmpSubagent } from "./shared/subagents";
|
|
79
120
|
import { getOmpSupportReport } from "./shared/support-diagnostics";
|
|
80
121
|
|
|
@@ -184,17 +225,48 @@ export default function contribute(server: PluginServerContext) {
|
|
|
184
225
|
scoped(({ authId }) => mcps.cancelAuth(authId)),
|
|
185
226
|
);
|
|
186
227
|
server.handle(listOmpMemory, scoped(resolveListOmpMemory));
|
|
187
|
-
server.handle(listOmpSessions, scoped(resolveListOmpSessions));
|
|
188
228
|
server.handle(listOmpConfig, scoped(resolveListOmpConfig));
|
|
189
229
|
server.handle(listOmpModels, scoped(resolveListOmpModels));
|
|
230
|
+
server.handle(listOmpAgents, scoped(resolveListOmpAgents));
|
|
190
231
|
server.handle(listOmpPlugins, scoped(resolveListOmpPlugins));
|
|
232
|
+
server.handle(listOmpMarketplaces, scoped(resolveListOmpMarketplaces));
|
|
233
|
+
server.handle(browseOmpMarketplace, scoped(resolveBrowseOmpMarketplace));
|
|
234
|
+
server.handle(mutateOmpMarketplace, scoped(resolveMutateOmpMarketplace));
|
|
235
|
+
server.handle(listOmpRules, scoped(resolveListOmpRules));
|
|
236
|
+
server.handle(setOmpRuleEnabled, scoped(resolveSetOmpRuleEnabled));
|
|
237
|
+
server.handle(testOmpRules, scoped(resolveTestOmpRules));
|
|
238
|
+
server.handle(listOmpRuleFirings, scoped(resolveListOmpRuleFirings));
|
|
239
|
+
server.handle(listOmpExtensions, scoped(resolveListOmpExtensions));
|
|
240
|
+
server.handle(setOmpExtensionEnabled, scoped(resolveSetOmpExtensionEnabled));
|
|
241
|
+
server.handle(listOmpSecurity, scoped(resolveListOmpSecurity));
|
|
242
|
+
server.handle(listOmpSkills, scoped(resolveListOmpSkills));
|
|
243
|
+
server.handle(setOmpSkillEnabled, scoped(resolveSetOmpSkillEnabled));
|
|
244
|
+
server.handle(deleteOmpManagedSkill, scoped(resolveDeleteOmpManagedSkill));
|
|
191
245
|
server.handle(inspectOmpPluginConfig, scoped(resolveInspectOmpPluginConfig));
|
|
192
246
|
server.handle(mutateOmpPlugin, scoped(resolveMutateOmpPlugin));
|
|
193
247
|
server.handle(mutateOmpPluginConfig, scoped(resolveMutateOmpPluginConfig));
|
|
194
248
|
server.handle(listOmpSettings, scoped(resolveListOmpSettings));
|
|
195
249
|
server.handle(updateOmpSettings, scoped(resolveUpdateOmpSettings));
|
|
250
|
+
server.handle(readOmpToolConfig, scoped(resolveReadOmpToolConfig));
|
|
251
|
+
server.handle(writeOmpToolConfig, scoped(resolveWriteOmpToolConfig));
|
|
252
|
+
server.handle(listOmpLocalModels, scoped(resolveListOmpLocalModels));
|
|
253
|
+
server.handle(downloadOmpLocalModel, scoped(resolveDownloadOmpLocalModel));
|
|
196
254
|
server.handle(getOmpProviderHealth, scoped(resolveGetOmpProviderHealth));
|
|
255
|
+
// Not `scoped`: the handler also needs the host context to read Paseo's Append system prompt.
|
|
256
|
+
server.handle(getOmpPromptFiles, ({ store, cwd }, { paseo }) =>
|
|
257
|
+
withOmpStore(store, async () => readOmpPromptFiles(cwd, await readHostAppendPrompt(paseo))),
|
|
258
|
+
);
|
|
259
|
+
server.handle(getOmpModelsFileStatus, scoped(resolveGetOmpModelsFileStatus));
|
|
260
|
+
server.handle(
|
|
261
|
+
refreshOmpModels,
|
|
262
|
+
scoped(async (input) => resolveRefreshOmpModels(input, await resolveHostInheritEnv())),
|
|
263
|
+
);
|
|
264
|
+
server.handle(getOmpUpdateStatus, resolveGetOmpUpdateStatus);
|
|
265
|
+
server.handle(installOmpUpdate, resolveInstallOmpUpdate);
|
|
197
266
|
server.handle(getOmpImage, (input) => resolveGetOmpImage(input, ompImageCache()));
|
|
267
|
+
server.handle(resolveOmpGeneratedImages, (input) =>
|
|
268
|
+
resolveGeneratedImages(input, ompImageCache()),
|
|
269
|
+
);
|
|
198
270
|
server.handle(
|
|
199
271
|
getOmpSupportReport,
|
|
200
272
|
scoped((input) => resolveGetOmpSupportReport(input, protocolViolations, operationalFailures)),
|
|
@@ -208,6 +280,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
208
280
|
server.handle(steerOmpSubagent, (input) =>
|
|
209
281
|
resolveSteerOmpSubagent(input, subagentControlRegistry),
|
|
210
282
|
);
|
|
283
|
+
const removeTurnRows = registerOmpTurnRows(server, [ompRuleNoticeRow, ompScreenshotRow]);
|
|
211
284
|
const removeSessionOpenHook = server.before("agent.session_open", ({ request }) => {
|
|
212
285
|
if (request.provider !== "omp-plugin" && !request.provider.startsWith("omp-plugin-")) return;
|
|
213
286
|
return withOmpSessionOpenEnv(request);
|
|
@@ -228,6 +301,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
228
301
|
mcps.stop();
|
|
229
302
|
removeSessionLimitListener();
|
|
230
303
|
subagentControlRegistry.clear();
|
|
304
|
+
removeTurnRows();
|
|
231
305
|
removeSessionOpenHook();
|
|
232
306
|
};
|
|
233
307
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omercnet/paseo-omp",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@omercnet/paseo-omp",
|
|
9
|
-
"version": "5.
|
|
9
|
+
"version": "5.5.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@getpaseo/protocol": "0.15.0",
|
|
12
12
|
"@modelcontextprotocol/sdk": "1.32.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omercnet/paseo-omp",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0-next.427.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Paseo integration for OMP, including its direct provider and workspace tooling.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,16 +64,16 @@
|
|
|
64
64
|
"@getpaseo/client": "0.15.0",
|
|
65
65
|
"@getpaseo/plugin": "0.15.0",
|
|
66
66
|
"@getpaseo/server": "0.15.0",
|
|
67
|
-
"@oh-my-pi/pi-agent-core": "18.
|
|
68
|
-
"@oh-my-pi/pi-coding-agent": "18.
|
|
67
|
+
"@oh-my-pi/pi-agent-core": "18.16.0",
|
|
68
|
+
"@oh-my-pi/pi-coding-agent": "18.16.0",
|
|
69
69
|
"@tanstack/react-query": "^5.102.3",
|
|
70
70
|
"@types/node": "^24.10.1",
|
|
71
71
|
"@types/react": "^19.2.18",
|
|
72
72
|
"@vitest/coverage-v8": "^5.0.0",
|
|
73
73
|
"esbuild": "0.28.2",
|
|
74
|
+
"pino": "10.4.0",
|
|
74
75
|
"react": "19.1.0",
|
|
75
76
|
"react-native": "0.81.5",
|
|
76
|
-
"pino": "10.4.0",
|
|
77
77
|
"tsx": "^4.20.6",
|
|
78
78
|
"typescript": "^7.0.2",
|
|
79
79
|
"vitest": "^5.0.0",
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { basename, dirname, extname, isAbsolute, join } from "node:path";
|
|
4
|
+
import type { RpcInput, RpcOutput } from "@getpaseo/plugin";
|
|
5
|
+
import type { resolveOmpGeneratedImages } from "../shared/generated-image";
|
|
6
|
+
import { isValidImagePayload, type OmpImageMimeType } from "./provider/image";
|
|
7
|
+
import { MAX_CACHED_IMAGE_BYTES, type OmpImageCache } from "./provider/image-cache";
|
|
8
|
+
import { readRegularFile } from "./regular-file";
|
|
9
|
+
|
|
10
|
+
/** The name OMP's `generate_image` gives its output files, written to the OS temp directory. */
|
|
11
|
+
const GENERATED_FILE_NAME = /^omp-image-[A-Za-z0-9_-]+\.(?:gif|jpe?g|png|webp)$/u;
|
|
12
|
+
const MIME_BY_EXTENSION: Readonly<Record<string, OmpImageMimeType>> = {
|
|
13
|
+
".gif": "image/gif",
|
|
14
|
+
".jpg": "image/jpeg",
|
|
15
|
+
".jpeg": "image/jpeg",
|
|
16
|
+
".png": "image/png",
|
|
17
|
+
".webp": "image/webp",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Only `omp-image-*` files directly in the temp directory are read; any other path is refused. */
|
|
21
|
+
function readGeneratedImage(
|
|
22
|
+
path: string,
|
|
23
|
+
): { bytes: Buffer; mimeType: OmpImageMimeType } | undefined {
|
|
24
|
+
const name = basename(path);
|
|
25
|
+
const mimeType = MIME_BY_EXTENSION[extname(name).toLowerCase()];
|
|
26
|
+
if (!isAbsolute(path) || !GENERATED_FILE_NAME.test(name) || !mimeType) return undefined;
|
|
27
|
+
let directory: string;
|
|
28
|
+
try {
|
|
29
|
+
directory = realpathSync(dirname(path));
|
|
30
|
+
if (directory !== realpathSync(tmpdir())) return undefined;
|
|
31
|
+
} catch {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const bytes = readRegularFile(join(directory, name), MAX_CACHED_IMAGE_BYTES);
|
|
35
|
+
// Only the magic bytes are checked, so encode only the header (12 bytes are 16 characters).
|
|
36
|
+
if (!bytes || !isValidImagePayload(bytes.subarray(0, 12).toString("base64"), mimeType, 16)) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return { bytes, mimeType };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function resolveGeneratedImages(
|
|
43
|
+
input: RpcInput<typeof resolveOmpGeneratedImages>,
|
|
44
|
+
cache: OmpImageCache,
|
|
45
|
+
): RpcOutput<typeof resolveOmpGeneratedImages> {
|
|
46
|
+
return {
|
|
47
|
+
images: input.paths.map((path) => {
|
|
48
|
+
const image = readGeneratedImage(path);
|
|
49
|
+
if (!image) return { status: "missing" as const };
|
|
50
|
+
return {
|
|
51
|
+
status: "available" as const,
|
|
52
|
+
ref: cache.store(image.bytes, image.mimeType),
|
|
53
|
+
mimeType: image.mimeType,
|
|
54
|
+
};
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
}
|