send-to-paseo 1.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.
@@ -0,0 +1,23 @@
1
+ import type { PluginClientContext } from "@getpaseo/plugin/client";
2
+ import { SendToPaseoSettings } from "./client/settings";
3
+
4
+ export default function contribute(client: PluginClientContext) {
5
+ client.addSurface("settings", SendToPaseoSettings);
6
+ client.addSidebarItem({
7
+ id: "send-to-paseo",
8
+ title: "Send to Paseo",
9
+ icon: "Send",
10
+ surface: "settings",
11
+ });
12
+ client.addCommandCenterItem({
13
+ id: "send-to-paseo-settings",
14
+ title: "Send to Paseo: bridge settings",
15
+ icon: "Send",
16
+ keywords: ["graphite", "bridge", "token", "pull request", "extension"],
17
+ context: "global",
18
+ onSelect({ openSurface }) {
19
+ openSurface("settings");
20
+ },
21
+ });
22
+ return () => {};
23
+ }
@@ -0,0 +1,157 @@
1
+ import type { PluginServerContext } from "@getpaseo/plugin/server";
2
+ import {
3
+ addAdditionalMachine,
4
+ clearRecentSends,
5
+ enablePrivateAccess,
6
+ getConnectionCode,
7
+ getStatus,
8
+ removeAdditionalMachine,
9
+ regenerateToken,
10
+ revealToken,
11
+ testAdditionalMachine,
12
+ updateAdditionalMachine,
13
+ updateConfig,
14
+ } from "./shared/contracts";
15
+ import { getBridgeStatus, restartBridge, runBridge } from "./server/bridge";
16
+ import { dependencySnapshot } from "./server/deps";
17
+ import {
18
+ listAgentProfiles,
19
+ listEffectiveProviders,
20
+ listModes,
21
+ resolveSelectedProfile,
22
+ } from "./server/resolve";
23
+ import { settings } from "./server/settings";
24
+ import {
25
+ addMachineFromCode,
26
+ enableMachinePrivateAccess,
27
+ getMachineConnectionCode,
28
+ publicMachine,
29
+ testMachine,
30
+ } from "./server/peers";
31
+ import { requireServerTarget } from "./server/target";
32
+
33
+ export default function contribute(server: PluginServerContext) {
34
+ server.handle(getStatus, async ({ serverId }, { paseo }) => {
35
+ await requireServerTarget(serverId);
36
+ const current = await settings.read();
37
+ const profile = await resolveSelectedProfile(paseo);
38
+ const [status, providerResult, catalog, profileResult, deps] = await Promise.all([
39
+ getBridgeStatus(),
40
+ listEffectiveProviders(paseo, profile),
41
+ listModes(paseo),
42
+ listAgentProfiles(paseo),
43
+ // Cached; a warm snapshot costs nothing, a cold one costs two --version
44
+ // calls and one `gh auth status`, each individually timed out.
45
+ dependencySnapshot(),
46
+ ]);
47
+ return {
48
+ status,
49
+ providers: providerResult.providers,
50
+ providersError: providerResult.error ?? catalog.error,
51
+ modes: catalog.modes,
52
+ profiles: profileResult.profiles,
53
+ profilesError: profileResult.error,
54
+ recentSends: current.recentSends,
55
+ dependencies: deps.dependencies,
56
+ additionalMachines: current.additionalMachines.map(publicMachine),
57
+ };
58
+ });
59
+
60
+ server.handle(revealToken, async ({ serverId }) => {
61
+ await requireServerTarget(serverId);
62
+ return { token: (await settings.read()).token };
63
+ });
64
+
65
+ server.handle(regenerateToken, async ({ serverId }) => {
66
+ await requireServerTarget(serverId);
67
+ return { token: (await settings.regenerateToken()).token };
68
+ });
69
+
70
+ server.handle(
71
+ updateConfig,
72
+ async ({
73
+ serverId,
74
+ port,
75
+ defaultProvider,
76
+ defaultProfileId,
77
+ defaultModeId,
78
+ agentDispatch,
79
+ externalBridgeUrl,
80
+ }) => {
81
+ await requireServerTarget(serverId);
82
+ const before = await settings.read();
83
+ const patch: {
84
+ port?: number;
85
+ defaultProvider?: string | null;
86
+ defaultProfileId?: string | null;
87
+ defaultModeId?: string | null;
88
+ agentDispatch?: "new" | "main";
89
+ externalBridgeUrl?: string | null;
90
+ } = {};
91
+ if (port !== undefined) patch.port = port;
92
+ if (defaultProvider !== undefined) patch.defaultProvider = defaultProvider;
93
+ if (defaultProfileId !== undefined) patch.defaultProfileId = defaultProfileId;
94
+ if (defaultModeId !== undefined) patch.defaultModeId = defaultModeId;
95
+ if (agentDispatch !== undefined) patch.agentDispatch = agentDispatch;
96
+ if (externalBridgeUrl !== undefined) patch.externalBridgeUrl = externalBridgeUrl;
97
+ await settings.update(patch);
98
+ // Only rebinding the listener needs a restart; a provider or mode change
99
+ // does not.
100
+ if (port !== undefined && port !== before.port) {
101
+ const status = await restartBridge();
102
+ return { status, error: status.error };
103
+ }
104
+ const status = await getBridgeStatus();
105
+ return { status, error: status.error };
106
+ },
107
+ );
108
+
109
+ server.handle(clearRecentSends, async ({ serverId }) => {
110
+ await requireServerTarget(serverId);
111
+ return { removed: await settings.clearRecentSends() };
112
+ });
113
+
114
+ server.handle(addAdditionalMachine, async ({ serverId, connectionCode }) => {
115
+ await requireServerTarget(serverId);
116
+ return { machine: await addMachineFromCode(connectionCode) };
117
+ });
118
+
119
+ server.handle(updateAdditionalMachine, async ({ serverId, id, label, enabled }) => {
120
+ await requireServerTarget(serverId);
121
+ const current = await settings.read();
122
+ const before = current.additionalMachines.find((machine) => machine.id === id);
123
+ if (before === undefined) throw new Error("That additional Paseo machine no longer exists.");
124
+ await settings.updateAdditionalMachine(id, {
125
+ ...(label === undefined ? {} : { label }),
126
+ ...(enabled === undefined ? {} : { enabled }),
127
+ });
128
+ const after = (await settings.read()).additionalMachines.find((machine) => machine.id === id);
129
+ if (after === undefined) throw new Error("That additional Paseo machine no longer exists.");
130
+ return { machine: publicMachine(after) };
131
+ });
132
+
133
+ server.handle(removeAdditionalMachine, async ({ serverId, id }) => {
134
+ await requireServerTarget(serverId);
135
+ return { removed: await settings.removeAdditionalMachine(id) };
136
+ });
137
+
138
+ server.handle(testAdditionalMachine, async ({ serverId, id }) => {
139
+ await requireServerTarget(serverId);
140
+ const machine = (await settings.read()).additionalMachines.find((item) => item.id === id);
141
+ if (machine === undefined) {
142
+ return { ok: false, machineName: null, detail: "That additional Paseo machine no longer exists." };
143
+ }
144
+ return testMachine(machine);
145
+ });
146
+
147
+ server.handle(getConnectionCode, async ({ serverId }) => {
148
+ await requireServerTarget(serverId);
149
+ return getMachineConnectionCode();
150
+ });
151
+ server.handle(enablePrivateAccess, async ({ serverId }) => {
152
+ await requireServerTarget(serverId);
153
+ return enableMachinePrivateAccess();
154
+ });
155
+
156
+ return runBridge();
157
+ }
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "send-to-paseo",
3
+ "type": "module",
4
+ "version": "1.3.0",
5
+ "license": "MIT",
6
+ "description": "Local HTTP bridge that dispatches PR work to the right Paseo workspace and agent.",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/tomgrin10/send-to-paseo.git",
10
+ "directory": "plugin"
11
+ },
12
+ "homepage": "https://github.com/tomgrin10/send-to-paseo#readme",
13
+ "bugs": "https://github.com/tomgrin10/send-to-paseo/issues",
14
+ "author": "Tom Gringauz",
15
+ "keywords": [
16
+ "paseo",
17
+ "paseo-plugin",
18
+ "github",
19
+ "graphite",
20
+ "pull-request"
21
+ ],
22
+ "files": [
23
+ "paseo-plugin.json",
24
+ "index.client.tsx",
25
+ "index.server.ts",
26
+ "client/**/*.ts",
27
+ "client/**/*.tsx",
28
+ "server/**/*.ts",
29
+ "shared/**/*.ts"
30
+ ],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "scripts": {
35
+ "typecheck": "tsc --noEmit",
36
+ "test": "node check-deps.mjs && node --test client/hosts.test.mjs server/main-agent.test.mjs",
37
+ "verify": "npm run typecheck && npm test"
38
+ },
39
+ "devDependencies": {
40
+ "@getpaseo/client": "0.9.0",
41
+ "@getpaseo/plugin": "0.9.0",
42
+ "@getpaseo/protocol": "0.9.0",
43
+ "@tanstack/react-query": "^5.90.11",
44
+ "@types/node": "^22.10.2",
45
+ "@types/react": "~19.2.0",
46
+ "react": "19.1.0",
47
+ "react-native": "0.81.5",
48
+ "typescript": "^5.9.3",
49
+ "zod": "^4.4.3"
50
+ }
51
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "id": "send-to-paseo",
3
+ "requirements": {
4
+ "paseo": ">=0.9.0"
5
+ }
6
+ }