Files
paseo/plugins/muse-provider/server/sessions.ts
T
Mohamed Boudraandmillerben95 8332f4d1ff feat(muse): add Muse Code as a built-in provider plugin (#5719)
* test(muse): record real host protocol fixtures

* feat(muse): add built-in MSP provider

Co-authored-by: millerben95 <millerben95@users.noreply.github.com>

* fix(muse): expose provider settings in the app

The daemon registered host settings without a client contribution, leaving sandbox, network, and workspace trust unreachable. Share the definition with a settings screen and expose it through Command Center even when installed plugins are disabled.

* docs(muse): publish setup and provider support

* test: correct runtime fixtures and restart readiness

* fix(muse): hide reminder housekeeping from the timeline

* fix(muse): use the official Muse Code mark

Source: https://muse.ai/images/favicon/app-squiggle.svg

Preserve the official silhouette path verbatim. Remove its gradient definition and use currentColor, scaling the original 100-unit coordinates into the 24-unit viewBox. Black silhouette renders match pixel-for-pixel.

* fix(muse): adapt to current plugin APIs

Use the screen API introduced with sidebar plugin items. Usage reports now come from source account discovery; remove the retired agent usage-reference request and headline marker, and exercise discovery through the existing provider fixtures.

---------

Co-authored-by: millerben95 <millerben95@users.noreply.github.com>
2026-09-30 14:56:41 +01:00

58 lines
1.8 KiB
TypeScript

import type { z } from "zod";
import type {
ProviderInput,
ProviderLaunch,
ProviderSessionSummary,
} from "@getpaseo/plugin/server/provider";
import { MspConnection } from "./connection.js";
import { sessionListSchema } from "./wire.js";
export class Sessions {
private readonly hosts = new Set<MspConnection>();
async list(
launch: ProviderLaunch,
input: Extract<ProviderInput, { type: "sessions" }>,
): Promise<ProviderSessionSummary[]> {
const host = new MspConnection({ launch });
this.hosts.add(host);
try {
await host.initialize();
const summaries: ProviderSessionSummary[] = [];
let cursor: string | null = null;
do {
const page: z.infer<typeof sessionListSchema> = await host.request(
"session/list",
{ workspaceRoot: input.cwd, limit: Math.min(input.limit ?? 50, 200), cursor },
sessionListSchema,
);
for (const session of page.sessions) {
if (session.workspaceRoot === null) continue;
if (
input.query &&
!(session.title ?? "").toLowerCase().includes(input.query.toLowerCase())
)
continue;
summaries.push({
cwd: session.workspaceRoot,
title: session.title,
updatedAt: session.updatedAt,
persistence: {
version: 1,
data: { sessionId: session.sessionId, model: session.modelId },
},
});
if (input.limit && summaries.length >= input.limit) return summaries;
}
cursor = page.nextCursor;
} while (cursor !== null);
return summaries;
} finally {
await host.close();
this.hosts.delete(host);
}
}
async close(): Promise<void> {
await Promise.all([...this.hosts].map((host) => host.close()));
}
}