fix(plugins): publish the plugin SDK under the @getpaseo scope
The daemon imports the plugin SDK at runtime, but the workspace was named @paseo/plugin and marked private, so it was never published. 0.5.0-beta.1 shipped @getpaseo/server depending on a package that does not exist and `npm install @getpaseo/cli@beta` failed with a 404 for every user. Two things hid it. sync-workspace-versions only rewrites deps matching @getpaseo/*, so the "*" range on @paseo/plugin survived untouched into the published tarball. And `npm pack --dry-run`, which is all release:check and CI run, lists files without ever resolving the dependency graph. Renaming to @getpaseo/plugin rather than publishing the old name: @paseo is not our scope on npm, so that name could never have been published at all. The rename also brings the package under the version-sync filter, which is what pins it correctly from here on. Plugins scaffolded against the old name still import @paseo/plugin. Both spellings resolve through plugin-sdk-specifiers.ts, tagged COMPAT with a removal date, so existing plugins keep loading. This does not repair 0.5.0-beta.1 — a published tarball's dependencies cannot be changed. The package publishes with the next release.
This commit is contained in:
@@ -31,7 +31,7 @@ function isSettledWorkspaceUrl(url: URL): boolean {
|
||||
function pluginSource(): string {
|
||||
return `import React, { useRef } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import { useAgent, useWorkspace } from "@paseo/plugin";
|
||||
import { useAgent, useWorkspace } from "@getpaseo/plugin";
|
||||
|
||||
function WorkspacePanel({ workspaceId, host, layout }) {
|
||||
const workspace = useWorkspace(workspaceId, (value) => ({ id: value.id }));
|
||||
|
||||
@@ -49,12 +49,12 @@
|
||||
"@getpaseo/client": "*",
|
||||
"@getpaseo/expo-two-way-audio": "*",
|
||||
"@getpaseo/highlight": "*",
|
||||
"@getpaseo/plugin": "*",
|
||||
"@getpaseo/protocol": "*",
|
||||
"@gorhom/bottom-sheet": "^5.2.14",
|
||||
"@gorhom/portal": "^1.0.14",
|
||||
"@marijn/find-cluster-break": "^1.0.2",
|
||||
"@mattermost/react-native-paste-input": "2.0.1",
|
||||
"@paseo/plugin": "*",
|
||||
"@react-native-async-storage/async-storage": "2.2.0",
|
||||
"@react-native-masked-view/masked-view": "^0.3.2",
|
||||
"@react-native/normalize-colors": "^0.81.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import type { AgentAttachment } from "@getpaseo/protocol/messages";
|
||||
import { PluginAttachmentItemSchema, type PluginAttachmentItem } from "@paseo/plugin";
|
||||
import { PluginAttachmentItemSchema, type PluginAttachmentItem } from "@getpaseo/plugin";
|
||||
import type { UserComposerAttachment } from "@/attachments/types";
|
||||
|
||||
export const PluginResourceComposerAttachmentSchema = z.object({
|
||||
|
||||
@@ -2,8 +2,8 @@ import { useCallback, useMemo, useState, type ReactElement, type RefObject } fro
|
||||
import { View } from "react-native";
|
||||
import { withUnistyles } from "react-native-unistyles";
|
||||
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
|
||||
import type { PluginAttachmentItem, PluginAttachmentSourceContribution } from "@paseo/plugin";
|
||||
import { searchPluginAttachments } from "@paseo/plugin/host";
|
||||
import type { PluginAttachmentItem, PluginAttachmentSourceContribution } from "@getpaseo/plugin";
|
||||
import { searchPluginAttachments } from "@getpaseo/plugin/host";
|
||||
import type { LucideIcon } from "lucide-react-native";
|
||||
import type { UserComposerAttachment } from "@/attachments/types";
|
||||
import type { AttachmentMenuItem } from "@/composer/input/input";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PluginAgentSnapshot, PluginWorkspaceSnapshot } from "@paseo/plugin";
|
||||
import type { PluginAgentSnapshot, PluginWorkspaceSnapshot } from "@getpaseo/plugin";
|
||||
import type { Agent, WorkspaceDescriptor } from "@/stores/session-store";
|
||||
|
||||
const workspaceSnapshots = new WeakMap<WorkspaceDescriptor, PluginWorkspaceSnapshot>();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PluginClientStateSource } from "@paseo/plugin/host";
|
||||
import type { PluginClientStateSource } from "@getpaseo/plugin/host";
|
||||
import { useSessionStore } from "@/stores/session-store";
|
||||
import { selectWorkspace } from "@/stores/session-store-hooks/selectors";
|
||||
import { normalizeWorkspaceOpaqueId } from "@/utils/workspace-identity";
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
type PluginAgentSnapshot,
|
||||
type PluginCommandCenterItemContribution,
|
||||
type PluginWorkspaceSnapshot,
|
||||
} from "@paseo/plugin";
|
||||
} from "@getpaseo/plugin";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { z } from "zod";
|
||||
import type { InstalledPlugin } from "../types";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { callPluginRpc } from "@paseo/plugin/host";
|
||||
import type { PluginCommandCapabilities } from "@paseo/plugin";
|
||||
import type { PluginClientStateSource } from "@paseo/plugin/host";
|
||||
import { callPluginRpc } from "@getpaseo/plugin/host";
|
||||
import type { PluginCommandCapabilities } from "@getpaseo/plugin";
|
||||
import type { PluginClientStateSource } from "@getpaseo/plugin/host";
|
||||
import type { CommandCenterContribution } from "@/command-center/contributions";
|
||||
import { getCommandCenterIcon } from "@/command-center/icon";
|
||||
import { resolvePluginIcon } from "../icons";
|
||||
|
||||
@@ -162,11 +162,11 @@ describe("evaluatePluginClientBundle", () => {
|
||||
).toThrow("must return a cleanup function");
|
||||
});
|
||||
|
||||
it("resolves @paseo/plugin/server for shared RPC contracts", () => {
|
||||
it("resolves @getpaseo/plugin/server for shared RPC contracts", () => {
|
||||
const plugin = evaluatePluginClientBundle(
|
||||
"example",
|
||||
`(function(require) {
|
||||
const { defineRpc, defineAttachmentSource } = require("@paseo/plugin/server");
|
||||
const { defineRpc, defineAttachmentSource } = require("@getpaseo/plugin/server");
|
||||
const search = defineRpc({ name: "issues.search", input: {}, output: {} });
|
||||
const module = { exports: {} };
|
||||
module.exports.default = function(plugin) {
|
||||
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
useAgent,
|
||||
useWorkspace,
|
||||
useRpc,
|
||||
} from "@paseo/plugin";
|
||||
import { createPluginContext, type PluginRegistrationCollector } from "@paseo/plugin/host";
|
||||
} from "@getpaseo/plugin";
|
||||
import { createPluginContext, type PluginRegistrationCollector } from "@getpaseo/plugin/host";
|
||||
import type { EvaluatedPlugin } from "./types";
|
||||
import type { ComponentType } from "react";
|
||||
import { resolvePluginIcon } from "./icons";
|
||||
@@ -149,7 +149,7 @@ export function evaluatePluginClientBundle(id: string, bundle: string): Evaluate
|
||||
if (name === "react") return React;
|
||||
if (name === "react/jsx-runtime") return ReactJsxRuntime;
|
||||
if (name === "react-native") return ReactNative;
|
||||
if (name === "@paseo/plugin") {
|
||||
if (name === "@getpaseo/plugin") {
|
||||
return {
|
||||
defineAttachmentSource,
|
||||
defineRpc,
|
||||
@@ -159,7 +159,7 @@ export function evaluatePluginClientBundle(id: string, bundle: string): Evaluate
|
||||
useRpc,
|
||||
};
|
||||
}
|
||||
if (name === "@paseo/plugin/server") {
|
||||
if (name === "@getpaseo/plugin/server") {
|
||||
return { defineAttachmentSource, defineRpc };
|
||||
}
|
||||
if (name === "@tanstack/react-query") return ReactQuery;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { QueryClientProvider } from "@tanstack/react-query";
|
||||
import { PaseoApiProvider, PluginRpcProvider } from "@paseo/plugin/host";
|
||||
import { PaseoApiProvider, PluginRpcProvider } from "@getpaseo/plugin/host";
|
||||
import type { ReactNode } from "react";
|
||||
import type { InstalledPlugin } from "./types";
|
||||
import type { PluginSurfaceRuntime } from "./surface-runtime";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
|
||||
import type { PaseoApi } from "@getpaseo/client";
|
||||
import { PaseoApiProvider } from "@paseo/plugin/host";
|
||||
import { usePaseo } from "@paseo/plugin";
|
||||
import { PaseoApiProvider } from "@getpaseo/plugin/host";
|
||||
import { usePaseo } from "@getpaseo/plugin";
|
||||
import React from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { router, useLocalSearchParams } from "expo-router";
|
||||
import type { PluginSurfaceProps, PluginTheme } from "@paseo/plugin";
|
||||
import type { PluginSurfaceProps, PluginTheme } from "@getpaseo/plugin";
|
||||
import { ChevronDown, X } from "lucide-react-native";
|
||||
import { useCallback, useMemo, useRef, useState, type ComponentType } from "react";
|
||||
import { Platform, Pressable, Text, View } from "react-native";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PluginTheme } from "@paseo/plugin";
|
||||
import type { PluginTheme } from "@getpaseo/plugin";
|
||||
import type { Theme } from "@/styles/theme";
|
||||
|
||||
export function toPluginTheme(theme: Theme): PluginTheme {
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
PluginSidebarContribution,
|
||||
PluginSurfaceContribution,
|
||||
PluginWorkspacePanelContribution,
|
||||
} from "@paseo/plugin";
|
||||
} from "@getpaseo/plugin";
|
||||
|
||||
export interface EvaluatedPlugin {
|
||||
id: string;
|
||||
|
||||
@@ -3,8 +3,8 @@ import type {
|
||||
PluginHostProps,
|
||||
PluginTheme,
|
||||
PluginWorkspacePanelProps,
|
||||
} from "@paseo/plugin";
|
||||
import { PluginClientStateProvider } from "@paseo/plugin/host";
|
||||
} from "@getpaseo/plugin";
|
||||
import { PluginClientStateProvider } from "@getpaseo/plugin/host";
|
||||
import { CircleAlert } from "lucide-react-native";
|
||||
import { useMemo } from "react";
|
||||
import { Platform, Text, View } from "react-native";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PluginWorkspacePanelContribution } from "@paseo/plugin";
|
||||
import type { PluginWorkspacePanelContribution } from "@getpaseo/plugin";
|
||||
import type { InstalledPlugin } from "../types";
|
||||
import type { PluginWorkspaceTabTarget } from "@/workspace-tabs/model";
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ describe("plugin scaffold", () => {
|
||||
await Promise.all([
|
||||
writeFile(
|
||||
path.join(directory, "inspect.shared.ts"),
|
||||
`import { defineRpc } from "@paseo/plugin/server";
|
||||
`import { defineRpc } from "@getpaseo/plugin/server";
|
||||
import { z } from "zod";
|
||||
|
||||
export const inspect = defineRpc({
|
||||
@@ -62,7 +62,7 @@ export const inspect = defineRpc({
|
||||
),
|
||||
writeFile(
|
||||
path.join(directory, "inspect.server.ts"),
|
||||
`import type { PluginHandlerContext } from "@paseo/plugin/server";
|
||||
`import type { PluginHandlerContext } from "@getpaseo/plugin/server";
|
||||
import type { output as ZodOutput } from "zod";
|
||||
import { inspect } from "./inspect.shared";
|
||||
|
||||
@@ -83,7 +83,7 @@ import {
|
||||
useAgent,
|
||||
usePaseo,
|
||||
useWorkspace,
|
||||
} from "@paseo/plugin";
|
||||
} from "@getpaseo/plugin";
|
||||
|
||||
export function Surface() {
|
||||
const paseo = usePaseo();
|
||||
@@ -111,7 +111,7 @@ export function AgentPanel({ workspaceId, agentId }: PluginAgentPanelProps) {
|
||||
),
|
||||
writeFile(
|
||||
path.join(directory, "index.ts"),
|
||||
`import type { PluginContext } from "@paseo/plugin";
|
||||
`import type { PluginContext } from "@getpaseo/plugin";
|
||||
import { AgentPanel, Surface } from "./main.client";
|
||||
import { inspectConfig } from "./inspect.server";
|
||||
import { inspect } from "./inspect.shared";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { mkdir, readdir, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { PluginIdSchema } from "@getpaseo/protocol/messages";
|
||||
|
||||
const SDK_DECLARATIONS = `declare module "@paseo/plugin/server" {
|
||||
const SDK_DECLARATIONS = `declare module "@getpaseo/plugin/server" {
|
||||
import type { PaseoApi } from "@getpaseo/client";
|
||||
import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
|
||||
|
||||
@@ -56,7 +56,7 @@ const SDK_DECLARATIONS = `declare module "@paseo/plugin/server" {
|
||||
export const PluginAttachmentSearchPayloadSchema: import("zod").ZodType<PluginAttachmentSearchPayload>;
|
||||
}
|
||||
|
||||
declare module "@paseo/plugin" {
|
||||
declare module "@getpaseo/plugin" {
|
||||
import type { ComponentType } from "react";
|
||||
import type { PaseoApi } from "@getpaseo/client";
|
||||
import type { ZodType, input as ZodInput, output as ZodOutput } from "zod";
|
||||
@@ -64,7 +64,7 @@ declare module "@paseo/plugin" {
|
||||
PluginAttachmentSourceContribution,
|
||||
PluginHandlerContext,
|
||||
PluginRpcContract,
|
||||
} from "@paseo/plugin/server";
|
||||
} from "@getpaseo/plugin/server";
|
||||
|
||||
export {
|
||||
PluginAttachmentItemSchema,
|
||||
@@ -76,7 +76,7 @@ declare module "@paseo/plugin" {
|
||||
type PluginAttachmentSourceContribution,
|
||||
type PluginHandlerContext,
|
||||
type PluginRpcContract,
|
||||
} from "@paseo/plugin/server";
|
||||
} from "@getpaseo/plugin/server";
|
||||
|
||||
export interface PluginTheme {
|
||||
readonly colors: {
|
||||
@@ -242,7 +242,7 @@ const TSCONFIG = {
|
||||
include: ["**/*.ts", "**/*.tsx"],
|
||||
};
|
||||
|
||||
const ENTRY = `import type { PluginContext } from "@paseo/plugin";
|
||||
const ENTRY = `import type { PluginContext } from "@getpaseo/plugin";
|
||||
import { MainSurface } from "./main.client";
|
||||
|
||||
export default function contribute(plugin: PluginContext) {
|
||||
@@ -251,7 +251,7 @@ export default function contribute(plugin: PluginContext) {
|
||||
}
|
||||
`;
|
||||
|
||||
const CLIENT_SURFACE = `import type { PluginSurfaceProps } from "@paseo/plugin";
|
||||
const CLIENT_SURFACE = `import type { PluginSurfaceProps } from "@getpaseo/plugin";
|
||||
import React, { useMemo } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@paseo/plugin",
|
||||
"name": "@getpaseo/plugin",
|
||||
"version": "0.5.0-beta.1",
|
||||
"private": true,
|
||||
"description": "Paseo plugin SDK package",
|
||||
"files": [
|
||||
"dist",
|
||||
"!dist/**/*.map"
|
||||
@@ -24,6 +24,9 @@
|
||||
"default": "./dist/host.js"
|
||||
}
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "node ../../scripts/clean-package-dist.mjs",
|
||||
"build": "tsc -p tsconfig.json --incremental false",
|
||||
@@ -36,7 +39,7 @@
|
||||
"use-sync-external-store": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@getpaseo/client": "*",
|
||||
"@getpaseo/client": "0.5.0-beta.1",
|
||||
"@types/node": "^20.9.0",
|
||||
"@types/react": "~19.2.0",
|
||||
"react": "19.1.0",
|
||||
@@ -45,7 +48,7 @@
|
||||
"zod": "^4.4.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@getpaseo/client": "*",
|
||||
"@getpaseo/client": "0.5.0-beta.1",
|
||||
"react": "19.1.0",
|
||||
"zod": "^4.4.3"
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ function collectBareSpecifiers(entry: string): string[] {
|
||||
return bare;
|
||||
}
|
||||
|
||||
describe("@paseo/plugin/server", () => {
|
||||
describe("@getpaseo/plugin/server", () => {
|
||||
it("does not load react or the client hook graph", () => {
|
||||
const specifiers = collectBareSpecifiers(path.join(srcDir, "server.ts"));
|
||||
expect(specifiers.filter((specifier) => forbiddenSpecifiers.has(specifier))).toEqual([]);
|
||||
|
||||
@@ -74,12 +74,12 @@
|
||||
"@babel/parser": "^7.29.8",
|
||||
"@getpaseo/client": "0.5.0-beta.1",
|
||||
"@getpaseo/highlight": "0.5.0-beta.1",
|
||||
"@getpaseo/plugin": "0.5.0-beta.1",
|
||||
"@getpaseo/protocol": "0.5.0-beta.1",
|
||||
"@getpaseo/relay": "0.5.0-beta.1",
|
||||
"@isaacs/ttlcache": "^2.1.4",
|
||||
"@modelcontextprotocol/sdk": "^1.20.1",
|
||||
"@opencode-ai/sdk": "1.14.46",
|
||||
"@paseo/plugin": "*",
|
||||
"@xterm/headless": "^6.0.0",
|
||||
"ai": "5.0.78",
|
||||
"ajv": "^8.20.0",
|
||||
|
||||
@@ -73,14 +73,18 @@ afterEach(async () => {
|
||||
});
|
||||
|
||||
describe("plugin author module externals", () => {
|
||||
it("leaves @paseo/plugin/server external in both bundles", async () => {
|
||||
const directory = await mkdtemp(path.join(tmpdir(), "paseo-plugin-compiler-"));
|
||||
temporaryDirectories.push(directory);
|
||||
const entryPath = path.join(directory, "index.ts");
|
||||
await writeFile(
|
||||
entryPath,
|
||||
`import type { PluginContext } from "@paseo/plugin";
|
||||
import { defineRpc } from "@paseo/plugin/server";
|
||||
// COMPAT(plugin-sdk-scope): plugins written against the unpublished @paseo/plugin name must
|
||||
// keep compiling. Drop that case with the specifiers in plugin-sdk-specifiers.ts.
|
||||
it.each(["@getpaseo/plugin", "@paseo/plugin"])(
|
||||
"leaves %s/server external in both bundles",
|
||||
async (sdk) => {
|
||||
const directory = await mkdtemp(path.join(tmpdir(), "paseo-plugin-compiler-"));
|
||||
temporaryDirectories.push(directory);
|
||||
const entryPath = path.join(directory, "index.ts");
|
||||
await writeFile(
|
||||
entryPath,
|
||||
`import type { PluginContext } from "${sdk}";
|
||||
import { defineRpc } from "${sdk}/server";
|
||||
import { z } from "zod";
|
||||
|
||||
const ping = defineRpc({
|
||||
@@ -94,12 +98,13 @@ export default function contribute(plugin: PluginContext) {
|
||||
return () => undefined;
|
||||
}
|
||||
`,
|
||||
);
|
||||
);
|
||||
|
||||
const { clientBundle, serverBundle } = await compilePlugin(entryPath);
|
||||
expect(clientBundle).toContain("@paseo/plugin/server");
|
||||
expect(serverBundle).toContain("@paseo/plugin/server");
|
||||
expect(clientBundle).not.toContain("Invalid plugin RPC method");
|
||||
expect(serverBundle).not.toContain("Invalid plugin RPC method");
|
||||
});
|
||||
const { clientBundle, serverBundle } = await compilePlugin(entryPath);
|
||||
expect(clientBundle).toContain(`${sdk}/server`);
|
||||
expect(serverBundle).toContain(`${sdk}/server`);
|
||||
expect(clientBundle).not.toContain("Invalid plugin RPC method");
|
||||
expect(serverBundle).not.toContain("Invalid plugin RPC method");
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import { createRequire } from "node:module";
|
||||
import path from "node:path";
|
||||
import { parse } from "@babel/parser";
|
||||
import type { Plugin } from "esbuild";
|
||||
import { PLUGIN_SDK_SPECIFIERS } from "./plugin-sdk-specifiers.js";
|
||||
|
||||
const nodeRequire = createRequire(import.meta.url);
|
||||
const ESBUILD_BINARY_PATH = "ESBUILD_BINARY_PATH";
|
||||
@@ -307,15 +308,14 @@ async function compileTarget(entryPath: string, target: PluginBuildTarget): Prom
|
||||
external:
|
||||
target === "client"
|
||||
? [
|
||||
"@paseo/plugin",
|
||||
"@paseo/plugin/server",
|
||||
...PLUGIN_SDK_SPECIFIERS,
|
||||
"@tanstack/react-query",
|
||||
"react",
|
||||
"react/jsx-runtime",
|
||||
"react-native",
|
||||
"zod",
|
||||
]
|
||||
: ["@paseo/plugin", "@paseo/plugin/server", "zod"],
|
||||
: [...PLUGIN_SDK_SPECIFIERS, "zod"],
|
||||
plugins: [createRuntimeBoundaryPlugin(target), createUnusedPlatformModulePlugin(target)],
|
||||
logLevel: "silent",
|
||||
treeShaking: true,
|
||||
|
||||
@@ -21,7 +21,7 @@ test("plugin handlers create workspaces and agents through their Paseo API", asy
|
||||
);
|
||||
await writeFile(
|
||||
path.join(pluginDirectory, "index.tsx"),
|
||||
`import { defineRpc, type PluginContext } from "@paseo/plugin";
|
||||
`import { defineRpc, type PluginContext } from "@getpaseo/plugin";
|
||||
import { z } from "zod";
|
||||
|
||||
const create = defineRpc({
|
||||
|
||||
@@ -5,10 +5,11 @@ import {
|
||||
defineRpc,
|
||||
type PluginHandlerContext,
|
||||
type PluginRpcContract,
|
||||
} from "@paseo/plugin/server";
|
||||
} from "@getpaseo/plugin/server";
|
||||
import { createPaseoApi, type PaseoApi } from "@getpaseo/client";
|
||||
import { DaemonClient } from "@getpaseo/client/internal/daemon-client";
|
||||
import { createPluginDaemonTransportFactory } from "./daemon-transport.js";
|
||||
import { isPluginSdkSpecifier } from "./plugin-sdk-specifiers.js";
|
||||
|
||||
type RpcHandler = (input: unknown, context: PluginHandlerContext) => unknown | Promise<unknown>;
|
||||
|
||||
@@ -64,7 +65,7 @@ function register(contract: PluginRpcContract, handler: RpcHandler): void {
|
||||
const pluginAuthorRuntime = { defineAttachmentSource, defineRpc };
|
||||
|
||||
function runtimeRequire(name: string): unknown {
|
||||
if (name === "@paseo/plugin" || name === "@paseo/plugin/server") return pluginAuthorRuntime;
|
||||
if (isPluginSdkSpecifier(name)) return pluginAuthorRuntime;
|
||||
return nodeRequire(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Specifiers a plugin author can import to reach the SDK. The daemon never resolves these
|
||||
// from disk: the compiler marks them external and the plugin subprocess hands back its own
|
||||
// runtime, so a plugin typechecks against generated declarations without installing anything.
|
||||
//
|
||||
// COMPAT(plugin-sdk-scope): @paseo/plugin was the SDK name through 0.5.0-beta.1 and was never
|
||||
// published — that scope is not ours. Plugins scaffolded against that name still import it, so
|
||||
// both spellings resolve. Remove the @paseo/* entries after 2026-11-19.
|
||||
export const PLUGIN_SDK_SPECIFIERS = [
|
||||
"@getpaseo/plugin",
|
||||
"@getpaseo/plugin/server",
|
||||
"@paseo/plugin",
|
||||
"@paseo/plugin/server",
|
||||
] as const;
|
||||
|
||||
export function isPluginSdkSpecifier(name: string): boolean {
|
||||
return (PLUGIN_SDK_SPECIFIERS as readonly string[]).includes(name);
|
||||
}
|
||||
@@ -501,7 +501,7 @@ export default function contribute(plugin: unknown) {
|
||||
import { platform } from "node:os";
|
||||
import { Text } from "react-native";
|
||||
import { z } from "zod";
|
||||
import { defineAttachmentSource, defineRpc } from "@paseo/plugin";
|
||||
import { defineAttachmentSource, defineRpc } from "@getpaseo/plugin";
|
||||
|
||||
const greetRpc = defineRpc({
|
||||
name: "greet",
|
||||
@@ -560,6 +560,34 @@ export default function contribute(plugin: any) {
|
||||
await runtime.stopAll();
|
||||
});
|
||||
|
||||
// COMPAT(plugin-sdk-scope): plugins scaffolded through 0.5.0-beta.1 import the unpublished
|
||||
// @paseo/plugin name. Drop with the specifiers in plugin-sdk-specifiers.ts.
|
||||
it("loads a plugin that imports the pre-rename @paseo/plugin specifier", async () => {
|
||||
const directory = await createPlugin(
|
||||
"legacy-sdk",
|
||||
`import { z } from "zod";
|
||||
import { defineRpc } from "@paseo/plugin/server";
|
||||
|
||||
const pingRpc = defineRpc({
|
||||
name: "ping",
|
||||
input: z.object({}),
|
||||
output: z.object({ ok: z.boolean() }),
|
||||
});
|
||||
|
||||
export default function contribute(plugin: any) {
|
||||
plugin.handle(pingRpc, async () => ({ ok: true }));
|
||||
return () => undefined;
|
||||
}`,
|
||||
);
|
||||
const runtime = createTestRuntime();
|
||||
|
||||
await runtime.startPlugin("legacy-sdk", directory);
|
||||
|
||||
await expect(runtime.invoke("legacy-sdk", "ping", {})).resolves.toMatchObject({ ok: true });
|
||||
|
||||
await runtime.stopAll();
|
||||
});
|
||||
|
||||
it("keeps client and server modules in their target runtime", async () => {
|
||||
const directory = await mkdtemp(path.join(tmpdir(), "paseo-plugin-"));
|
||||
temporaryDirectories.push(directory);
|
||||
@@ -571,7 +599,7 @@ export default function contribute(plugin: any) {
|
||||
),
|
||||
writeFile(
|
||||
path.join(directory, "index.ts"),
|
||||
`import type { PluginContext } from "@paseo/plugin";
|
||||
`import type { PluginContext } from "@getpaseo/plugin";
|
||||
import { Surface } from "./surface.client";
|
||||
import { inspectRpc } from "./inspect.shared";
|
||||
import { inspectHost } from "./inspect.server";
|
||||
@@ -597,7 +625,7 @@ export function Surface() {
|
||||
),
|
||||
writeFile(
|
||||
path.join(directory, "inspect.shared.ts"),
|
||||
`import { defineRpc } from "@paseo/plugin/server";
|
||||
`import { defineRpc } from "@getpaseo/plugin/server";
|
||||
import { z } from "zod";
|
||||
|
||||
export const inspectRpc = defineRpc({
|
||||
@@ -643,7 +671,7 @@ export function inspectHost(_input: z.input<typeof inspectRpc.input>) {
|
||||
),
|
||||
writeFile(
|
||||
path.join(directory, "index.ts"),
|
||||
`import type { PluginContext } from "@paseo/plugin";
|
||||
`import type { PluginContext } from "@getpaseo/plugin";
|
||||
import { Surface } from "./surface.client";
|
||||
|
||||
export default function contribute(plugin: PluginContext) {
|
||||
@@ -683,7 +711,7 @@ export function Surface() { return readSecret(); }`,
|
||||
),
|
||||
writeFile(
|
||||
path.join(directory, "index.ts"),
|
||||
`import type { PluginContext } from "@paseo/plugin";
|
||||
`import type { PluginContext } from "@getpaseo/plugin";
|
||||
import { inspect } from "./inspect.server";
|
||||
import { inspectRpc } from "./inspect.shared";
|
||||
|
||||
@@ -695,7 +723,7 @@ export default function contribute(plugin: PluginContext) {
|
||||
),
|
||||
writeFile(
|
||||
path.join(directory, "inspect.shared.ts"),
|
||||
`import { defineRpc } from "@paseo/plugin";
|
||||
`import { defineRpc } from "@getpaseo/plugin";
|
||||
import { z } from "zod";
|
||||
export const inspectRpc = defineRpc({
|
||||
name: "inspect",
|
||||
@@ -728,7 +756,7 @@ export function inspect() { void Surface; return {}; }`,
|
||||
const directory = await createPlugin(
|
||||
"invalid-output",
|
||||
`import { z } from "zod";
|
||||
import { defineRpc } from "@paseo/plugin";
|
||||
import { defineRpc } from "@getpaseo/plugin";
|
||||
const brokenRpc = defineRpc({
|
||||
name: "broken",
|
||||
input: z.object({}),
|
||||
|
||||
Reference in New Issue
Block a user