send-to-paseo 2.2.0 → 2.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.
- package/README.md +26 -25
- package/assets/LICENSE.lucide +43 -0
- package/assets/icon.png +0 -0
- package/assets/icon.svg +1 -0
- package/client/chat.tsx +157 -0
- package/client/display.tsx +10 -11
- package/client/overview.tsx +147 -0
- package/client/settings.tsx +91 -131
- package/client/sidebar.tsx +33 -0
- package/client/theme.ts +45 -0
- package/docs/media/send-to-paseo-card-dark.png +0 -0
- package/docs/media/send-to-paseo-card-light.png +0 -0
- package/docs/media/send-to-paseo-hero-dark.png +0 -0
- package/docs/media/send-to-paseo-mobile.png +0 -0
- package/docs/media/send-to-paseo-overview-dark.png +0 -0
- package/docs/media/send-to-paseo-overview-light.png +0 -0
- package/docs/media/send-to-paseo-setup-dark.png +0 -0
- package/index.client.tsx +17 -12
- package/index.server.ts +20 -0
- package/package.json +5 -3
- package/paseo-plugin.json +12 -0
- package/server/bridge.ts +1 -1
- package/server/send.ts +1 -0
- package/shared/chat.ts +159 -0
- package/shared/contracts.ts +29 -1
- package/shared/overview.ts +76 -0
- package/shared/route.ts +33 -0
- package/shared/summary.ts +14 -0
- package/client/navigation.tsx +0 -14
package/paseo-plugin.json
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "send-to-paseo",
|
|
3
|
+
"name": "Send to Paseo",
|
|
4
|
+
"icon": "assets/icon.png",
|
|
5
|
+
"description": "Send work from a GitHub or Graphite pull request to the right Paseo workspace and agent, then see in the agent's chat which PR it came from and why it landed there.",
|
|
6
|
+
"media": [
|
|
7
|
+
"docs/media/send-to-paseo-hero-dark.png",
|
|
8
|
+
"docs/media/send-to-paseo-card-dark.png",
|
|
9
|
+
"docs/media/send-to-paseo-overview-dark.png",
|
|
10
|
+
"docs/media/send-to-paseo-setup-dark.png",
|
|
11
|
+
"docs/media/send-to-paseo-mobile.png",
|
|
12
|
+
"docs/media/send-to-paseo-overview-light.png",
|
|
13
|
+
"docs/media/send-to-paseo-card-light.png"
|
|
14
|
+
],
|
|
3
15
|
"requirements": {
|
|
4
16
|
"paseo": ">=0.14.0"
|
|
5
17
|
}
|
package/server/bridge.ts
CHANGED
|
@@ -581,7 +581,7 @@ async function onRequest(req: IncomingMessage, res: ServerResponse): Promise<voi
|
|
|
581
581
|
|
|
582
582
|
function describeListenError(error: NodeJS.ErrnoException, port: number): string {
|
|
583
583
|
if (error.code === "EADDRINUSE") {
|
|
584
|
-
return `Port ${port} is already in use, so the Send to Paseo bridge did not start. Pick another port
|
|
584
|
+
return `Port ${port} is already in use, so the Send to Paseo bridge did not start. Pick another port under Connection details on the Send to Paseo screen.`;
|
|
585
585
|
}
|
|
586
586
|
if (error.code === "EACCES") {
|
|
587
587
|
return `Port ${port} needs elevated privileges, so the Send to Paseo bridge did not start. Pick a port above 1024.`;
|
package/server/send.ts
CHANGED
|
@@ -428,6 +428,7 @@ export async function handleSend(request: SendRequest): Promise<SendResponse> {
|
|
|
428
428
|
dryRun,
|
|
429
429
|
outcome: "ok",
|
|
430
430
|
error: null,
|
|
431
|
+
dispatch,
|
|
431
432
|
})
|
|
432
433
|
.catch((error: unknown) => {
|
|
433
434
|
console.error("[send-to-paseo] could not record the send", String(error));
|
package/shared/chat.ts
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Send to Paseo as it appears inside an agent's chat, reduced to what a card or a
|
|
5
|
+
* one-line row needs. Pure, so the transformers and the tests read the same rules.
|
|
6
|
+
*
|
|
7
|
+
* The provenance card is parsed back out of the header `composePrompt` writes
|
|
8
|
+
* (CONTRACT.md, "Prompt header"). The header itself is unchanged: agents still
|
|
9
|
+
* read exactly the same text; only the person sees the card.
|
|
10
|
+
*/
|
|
11
|
+
export const PROVENANCE_CARD_KIND = "send-to-paseo-provenance";
|
|
12
|
+
export const TOOL_ROW_KIND = "send-to-paseo-tool";
|
|
13
|
+
|
|
14
|
+
export const ProvenanceSchema = z.object({
|
|
15
|
+
forge: z.string(),
|
|
16
|
+
repo: z.string(),
|
|
17
|
+
number: z.number(),
|
|
18
|
+
/** Null when `gh` could not describe the PR (the degraded header). */
|
|
19
|
+
title: z.string().nullable(),
|
|
20
|
+
head: z.string().nullable(),
|
|
21
|
+
base: z.string().nullable(),
|
|
22
|
+
prUrl: z.string(),
|
|
23
|
+
pageUrl: z.string().nullable(),
|
|
24
|
+
/** Where the user pressed Send, from the Page: line. */
|
|
25
|
+
site: z.enum(["github", "graphite"]).nullable(),
|
|
26
|
+
/** Set only when the workspace is not on the PR's own branch, or when gh was unavailable. */
|
|
27
|
+
workspaceBranch: z.string().nullable(),
|
|
28
|
+
/** How the workspace branch relates to the PR, when the header says. */
|
|
29
|
+
branchState: z.enum(["sibling", "merged", "closed"]).nullable(),
|
|
30
|
+
degraded: z.boolean(),
|
|
31
|
+
instruction: z.string(),
|
|
32
|
+
text: z.string(),
|
|
33
|
+
});
|
|
34
|
+
export type Provenance = z.infer<typeof ProvenanceSchema>;
|
|
35
|
+
|
|
36
|
+
const HEADER = /^\[Sent from Graphite — ([a-z]+)\/([^/\s]+)\/(\S+) PR #(\d+)\]$/;
|
|
37
|
+
|
|
38
|
+
function siteOf(url: string | null): Provenance["site"] {
|
|
39
|
+
if (url === null) return null;
|
|
40
|
+
try {
|
|
41
|
+
const host = new URL(url).hostname.toLowerCase();
|
|
42
|
+
if (host === "github.com" || host.endsWith(".github.com")) return "github";
|
|
43
|
+
if (/(^|\.)graphite\.(dev|com)$/.test(host)) return "graphite";
|
|
44
|
+
} catch {
|
|
45
|
+
// Not a URL; say nothing about the site rather than guess.
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The card for a message Send to Paseo wrote, or null for anything else. */
|
|
51
|
+
export function provenance(text: string): Provenance | null {
|
|
52
|
+
const split = text.indexOf("\n\n");
|
|
53
|
+
if (split < 0) return null;
|
|
54
|
+
const lines = text.slice(0, split).split("\n");
|
|
55
|
+
const header = HEADER.exec(lines[0] ?? "");
|
|
56
|
+
if (!header) return null;
|
|
57
|
+
const field = (name: string) => {
|
|
58
|
+
const line = lines.find((entry) => entry.startsWith(`${name}: `));
|
|
59
|
+
return line === undefined ? null : line.slice(name.length + 2).trim();
|
|
60
|
+
};
|
|
61
|
+
const prUrl = field("PR");
|
|
62
|
+
if (prUrl === null) return null;
|
|
63
|
+
const branch = field("Branch");
|
|
64
|
+
const arrow = branch === null ? null : /^(.*) -> (.*)$/.exec(branch);
|
|
65
|
+
const rawWorkspace = field("Workspace branch");
|
|
66
|
+
const workspaceBranch = rawWorkspace === null ? null : rawWorkspace.replace(/\s*\(NOT this PR's branch.*\)$/, "");
|
|
67
|
+
const branchState: Provenance["branchState"] =
|
|
68
|
+
rawWorkspace === null || !/NOT this PR's branch/.test(rawWorkspace)
|
|
69
|
+
? null
|
|
70
|
+
: /already merged/.test(rawWorkspace)
|
|
71
|
+
? "merged"
|
|
72
|
+
: /closed without merging/.test(rawWorkspace)
|
|
73
|
+
? "closed"
|
|
74
|
+
: "sibling";
|
|
75
|
+
const pageUrl = field("Page");
|
|
76
|
+
return {
|
|
77
|
+
forge: header[1]!,
|
|
78
|
+
repo: `${header[2]}/${header[3]}`,
|
|
79
|
+
number: Number(header[4]),
|
|
80
|
+
title: field("Title"),
|
|
81
|
+
head: arrow?.[1] ?? null,
|
|
82
|
+
base: arrow?.[2] ?? null,
|
|
83
|
+
prUrl,
|
|
84
|
+
pageUrl,
|
|
85
|
+
site: siteOf(pageUrl),
|
|
86
|
+
workspaceBranch,
|
|
87
|
+
branchState,
|
|
88
|
+
degraded: field("Title") === null,
|
|
89
|
+
instruction: text.slice(split + 2).trim(),
|
|
90
|
+
text,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const ToolRowSchema = z.object({
|
|
95
|
+
state: z.enum(["running", "done", "failed"]),
|
|
96
|
+
/** "Checked the bridge · running · paired". */
|
|
97
|
+
line: z.string(),
|
|
98
|
+
detail: z.string(),
|
|
99
|
+
/** Muted unless something needs attention. */
|
|
100
|
+
tone: z.enum(["neutral", "warning", "danger"]),
|
|
101
|
+
});
|
|
102
|
+
export type ToolRow = z.infer<typeof ToolRowSchema>;
|
|
103
|
+
|
|
104
|
+
/** Claude records mcp__paseo__send_to_paseo_bridge_status; Codex paseo.send_to_paseo_bridge_status. */
|
|
105
|
+
export function isBridgeStatusTool(name: string): boolean {
|
|
106
|
+
return /(^|__|\.|\/|:)send_to_paseo_bridge_status$/.test(name);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function record(value: unknown): value is Record<string, unknown> {
|
|
110
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The text a tool result carries, however the provider wrapped it. */
|
|
114
|
+
export function readText(value: unknown): string {
|
|
115
|
+
if (value === null || value === undefined) return "";
|
|
116
|
+
if (typeof value === "string") return value;
|
|
117
|
+
if (Array.isArray(value)) return value.map(readText).join("\n");
|
|
118
|
+
if (!record(value)) return "";
|
|
119
|
+
if (typeof value.type === "string" && typeof value.text === "string") return value.text;
|
|
120
|
+
const key = ["content", "output", "text", "message", "result", "structuredContent"].find((name) => name in value);
|
|
121
|
+
if (key) return readText(value[key]);
|
|
122
|
+
return JSON.stringify(value);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const BridgeResultSchema = z.object({
|
|
126
|
+
state: z.string(),
|
|
127
|
+
port: z.number().optional(),
|
|
128
|
+
paired: z.boolean().optional(),
|
|
129
|
+
dryRun: z.boolean().optional(),
|
|
130
|
+
dependencies: z.array(z.object({ name: z.string(), state: z.string() })).optional(),
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
/** One line for the agent tool, from its JSON result. */
|
|
134
|
+
export function bridgeToolRow(status: string, output: unknown, error: unknown): ToolRow {
|
|
135
|
+
if (status === "running" || status === "pending") {
|
|
136
|
+
return { state: "running", line: "Checking the Send to Paseo bridge", detail: "", tone: "neutral" };
|
|
137
|
+
}
|
|
138
|
+
const text = readText(output).trim();
|
|
139
|
+
if (status === "failed" || (typeof error === "string" && error !== "")) {
|
|
140
|
+
return { state: "failed", line: "Couldn't check the Send to Paseo bridge", detail: typeof error === "string" && error !== "" ? error : text, tone: "danger" };
|
|
141
|
+
}
|
|
142
|
+
let parsed: z.infer<typeof BridgeResultSchema> | null = null;
|
|
143
|
+
try {
|
|
144
|
+
const json = BridgeResultSchema.safeParse(JSON.parse(text.slice(text.indexOf("{"))));
|
|
145
|
+
parsed = json.success ? json.data : null;
|
|
146
|
+
} catch {
|
|
147
|
+
parsed = null;
|
|
148
|
+
}
|
|
149
|
+
if (parsed === null) return { state: "done", line: "Checked the Send to Paseo bridge", detail: text, tone: "neutral" };
|
|
150
|
+
const missing = (parsed.dependencies ?? []).filter((dep) => dep.state !== "ok").map((dep) => dep.name);
|
|
151
|
+
const parts = [
|
|
152
|
+
parsed.state === "running" ? `listening on ${parsed.port ?? "its port"}` : parsed.state,
|
|
153
|
+
parsed.paired ? "paired" : "not paired yet",
|
|
154
|
+
...(missing.length === 0 ? [] : [`${missing.join(", ")} missing`]),
|
|
155
|
+
...(parsed.dryRun ? ["dry run"] : []),
|
|
156
|
+
];
|
|
157
|
+
const tone: ToolRow["tone"] = parsed.state !== "running" ? "danger" : !parsed.paired || missing.length > 0 ? "warning" : "neutral";
|
|
158
|
+
return { state: "done", line: `Checked the Send to Paseo bridge · ${parts.join(" · ")}`, detail: text, tone };
|
|
159
|
+
}
|
package/shared/contracts.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { z } from "zod";
|
|
|
9
9
|
|
|
10
10
|
/** Advertised in `GET /v1/ping`. Keep in step with `package.json`. */
|
|
11
11
|
export const PLUGIN_NAME = "send-to-paseo";
|
|
12
|
-
export const PLUGIN_VERSION = "2.
|
|
12
|
+
export const PLUGIN_VERSION = "2.3.0";
|
|
13
13
|
/** Bumped only for an incompatible bridge API; the paths stay `/v1`. */
|
|
14
14
|
export const CONTRACT_VERSION = 1;
|
|
15
15
|
|
|
@@ -418,6 +418,12 @@ export const RecentSendSchema = z.object({
|
|
|
418
418
|
dryRun: z.boolean(),
|
|
419
419
|
outcome: z.enum(["ok", "failed"]),
|
|
420
420
|
error: z.string().nullable(),
|
|
421
|
+
/**
|
|
422
|
+
* Additive: whether the send started an agent or messaged the workspace's main
|
|
423
|
+
* one. Optional so rows written before it existed keep validating (a failed
|
|
424
|
+
* parse regenerates settings.json and with it the pairing token).
|
|
425
|
+
*/
|
|
426
|
+
dispatch: AgentDispatchSchema.optional(),
|
|
421
427
|
});
|
|
422
428
|
export type RecentSend = z.infer<typeof RecentSendSchema>;
|
|
423
429
|
|
|
@@ -533,6 +539,28 @@ export const getStatus = defineRpc({
|
|
|
533
539
|
}),
|
|
534
540
|
});
|
|
535
541
|
|
|
542
|
+
/**
|
|
543
|
+
* The sends that reached one agent, for the provenance card in its chat. Rows
|
|
544
|
+
* carry no prompt text beyond the title the agent already shows.
|
|
545
|
+
*/
|
|
546
|
+
export const dispatchesForAgent = defineRpc({
|
|
547
|
+
name: "send-to-paseo.dispatches.for-agent",
|
|
548
|
+
input: SurfaceTargetSchema.extend({ agentId: z.string().min(1).max(200) }),
|
|
549
|
+
output: z.object({ sends: z.array(RecentSendSchema) }),
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
/** Cheap enough for a sidebar row to poll: no provider, mode or dependency probes. */
|
|
553
|
+
export const getSummary = defineRpc({
|
|
554
|
+
name: "send-to-paseo.summary",
|
|
555
|
+
input: SurfaceTargetSchema,
|
|
556
|
+
output: z.object({
|
|
557
|
+
state: BridgeStatusSchema.shape.state,
|
|
558
|
+
paired: z.boolean(),
|
|
559
|
+
lastSendAt: z.string().nullable(),
|
|
560
|
+
lastSendFailed: z.boolean(),
|
|
561
|
+
}),
|
|
562
|
+
});
|
|
563
|
+
|
|
536
564
|
export const revealToken = defineRpc({
|
|
537
565
|
name: "send-to-paseo.token.reveal",
|
|
538
566
|
input: SurfaceTargetSchema,
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { BridgeStatus, RecentSend } from "./contracts";
|
|
2
|
+
|
|
3
|
+
export const CHROME_WEB_STORE_URL = "https://chromewebstore.google.com/detail/send-to-paseo/blflbbgkckbabbkoigpocilbkkmfijfg";
|
|
4
|
+
|
|
5
|
+
export type Lead =
|
|
6
|
+
| { kind: "down"; text: string; detail: string }
|
|
7
|
+
| { kind: "setup"; text: string; detail: string }
|
|
8
|
+
| { kind: "ready"; text: string; detail: string };
|
|
9
|
+
|
|
10
|
+
/** "4m ago", "just now". Absolute dates past a day. */
|
|
11
|
+
export function ago(iso: string | null, now = Date.now()): string {
|
|
12
|
+
if (iso === null) return "never";
|
|
13
|
+
const at = Date.parse(iso);
|
|
14
|
+
if (Number.isNaN(at)) return "never";
|
|
15
|
+
const seconds = Math.round((now - at) / 1000);
|
|
16
|
+
if (seconds < 45) return "just now";
|
|
17
|
+
const minutes = Math.round(seconds / 60);
|
|
18
|
+
if (minutes < 60) return `${minutes}m ago`;
|
|
19
|
+
const hours = Math.round(minutes / 60);
|
|
20
|
+
if (hours < 24) return `${hours}h ago`;
|
|
21
|
+
return new Date(at).toLocaleDateString(undefined, { month: "short", day: "numeric" });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The one sentence at the top of the screen: is it working, and what is next. */
|
|
25
|
+
export function lead(status: BridgeStatus, sends: RecentSend[], now = Date.now()): Lead {
|
|
26
|
+
if (status.state === "failed" || status.state === "stopped") {
|
|
27
|
+
return {
|
|
28
|
+
kind: "down",
|
|
29
|
+
text: "The bridge isn't running",
|
|
30
|
+
detail: status.error !== null && /already in use/i.test(status.error)
|
|
31
|
+
? `Port ${status.configuredPort} is taken by another program. Choose another port under Connection details below, or quit the program using it.`
|
|
32
|
+
: status.error ?? `Nothing is listening on port ${status.configuredPort}. Reload the plugin, or pick another port under Connection details.`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (status.state === "starting") return { kind: "ready", text: "Starting the bridge…", detail: "" };
|
|
36
|
+
if (!status.paired) {
|
|
37
|
+
return { kind: "setup", text: "Pair Chrome to start sending", detail: "Three steps, once. Then a Send to Paseo button appears on every GitHub and Graphite pull request." };
|
|
38
|
+
}
|
|
39
|
+
const today = new Date(now).toDateString();
|
|
40
|
+
const sentToday = sends.filter((send) => send.outcome === "ok" && new Date(send.at).toDateString() === today).length;
|
|
41
|
+
if (sends.length === 0) {
|
|
42
|
+
return { kind: "ready", text: "Paired with Chrome", detail: "Open a pull request on GitHub or Graphite and press Send to Paseo. Your sends show up here." };
|
|
43
|
+
}
|
|
44
|
+
const count = sentToday === 0 ? "nothing sent today" : `${sentToday} send${sentToday === 1 ? "" : "s"} today`;
|
|
45
|
+
return { kind: "ready", text: `Paired with Chrome · ${count}`, detail: `Last send ${ago(sends[0]!.at, now)}.` };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The second line of a send row: where it went and how. */
|
|
49
|
+
/** A failed send's cause and the one thing that fixes it, instead of the raw upstream message. */
|
|
50
|
+
export function failure(send: RecentSend): string {
|
|
51
|
+
const error = send.error ?? "";
|
|
52
|
+
const repo = send.prLabel.replace(/#\d+$/, "");
|
|
53
|
+
const number = /#(\d+)$/.exec(send.prLabel)?.[1] ?? "";
|
|
54
|
+
if (/could not create a worktree|Unable to resolve GitHub repository/i.test(error)) {
|
|
55
|
+
return `Paseo couldn't check out PR #${number}. Add ${repo} as a project in Paseo (a clone with its GitHub remote), then send again.`;
|
|
56
|
+
}
|
|
57
|
+
if (/not a registered Paseo project|project_not_found/i.test(error)) return `${repo} isn't a Paseo project yet. Add it in Paseo, then send again.`;
|
|
58
|
+
if (/no longer available/i.test(error)) return "That workspace was archived or removed. Reopen the composer to pick another one.";
|
|
59
|
+
if (/Follow Up registration changed/i.test(error)) return "The agent Follow Up registered for this PR changed. Reopen the composer and send again.";
|
|
60
|
+
return error === "" ? "Not sent." : error;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function destination(send: RecentSend): string {
|
|
64
|
+
if (send.outcome === "failed") return failure(send);
|
|
65
|
+
const parts = [
|
|
66
|
+
send.workspaceCreated ? `New worktree · ${send.workspaceLabel}` : send.workspaceLabel,
|
|
67
|
+
send.dispatch === "main" ? `messaged ${send.title}` : "new agent",
|
|
68
|
+
...(send.dryRun ? ["dry run"] : []),
|
|
69
|
+
];
|
|
70
|
+
return parts.join(" · ");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** "acme/billing-service#421" → "acme/billing-service #421". */
|
|
74
|
+
export function prLabel(label: string): string {
|
|
75
|
+
return label.replace(/#(\d+)$/, " #$1");
|
|
76
|
+
}
|
package/shared/route.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Provenance } from "./chat";
|
|
2
|
+
import type { RecentSend } from "./contracts";
|
|
3
|
+
|
|
4
|
+
/** "GitHub" / "Graphite", or null when the send carried no page URL. */
|
|
5
|
+
export function siteLabel(site: Provenance["site"]): string | null {
|
|
6
|
+
return site === "github" ? "GitHub" : site === "graphite" ? "Graphite" : null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Why the send landed where it did, in one line. The prompt header says which
|
|
11
|
+
* branch the workspace is on; the recorded send (when this host still has it)
|
|
12
|
+
* adds the workspace name, whether a worktree was created, and whether the
|
|
13
|
+
* message started an agent or reached the workspace's main one.
|
|
14
|
+
*/
|
|
15
|
+
export function routeLine(card: Provenance, send: RecentSend | null): { text: string; attention: boolean } {
|
|
16
|
+
const parts: string[] = [];
|
|
17
|
+
let attention = false;
|
|
18
|
+
if (send?.workspaceCreated) parts.push(`New worktree for #${card.number}`);
|
|
19
|
+
else if (send !== null) parts.push(send.workspaceLabel);
|
|
20
|
+
if (!send?.workspaceCreated) {
|
|
21
|
+
if (card.branchState === "merged") { parts.push(`on ${card.workspaceBranch}, a merged branch of this stack`); attention = true; }
|
|
22
|
+
else if (card.branchState === "closed") { parts.push(`on ${card.workspaceBranch}, a closed branch of this stack`); attention = true; }
|
|
23
|
+
else if (card.branchState === "sibling") parts.push(`on ${card.workspaceBranch}, another branch of this stack`);
|
|
24
|
+
else if (card.degraded) parts.push(card.workspaceBranch === null ? "PR details unavailable (gh)" : `on ${card.workspaceBranch} · PR details unavailable (gh)`);
|
|
25
|
+
else parts.push("on the PR's branch");
|
|
26
|
+
}
|
|
27
|
+
if (send?.dispatch === "main") parts.push("sent to this agent");
|
|
28
|
+
else if (send?.dispatch === "new" || send?.workspaceCreated) parts.push("new agent");
|
|
29
|
+
const text = parts.join(" · ");
|
|
30
|
+
// Capitalise only our own leading phrase; a workspace name is shown as Paseo shows it.
|
|
31
|
+
const ours = send === null || send.workspaceCreated;
|
|
32
|
+
return { text: ours ? text.charAt(0).toUpperCase() + text.slice(1) : text, attention };
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Summary {
|
|
2
|
+
state: "starting" | "running" | "failed" | "stopped";
|
|
3
|
+
paired: boolean;
|
|
4
|
+
lastSendAt: string | null;
|
|
5
|
+
lastSendFailed: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** What the sidebar dot says, or null when nothing needs the person. */
|
|
9
|
+
export function summaryAttention(summary: Summary): { tone: "warning" | "danger"; label: string } | null {
|
|
10
|
+
if (summary.state === "failed" || summary.state === "stopped") return { tone: "danger", label: "Bridge is not running" };
|
|
11
|
+
if (summary.lastSendFailed) return { tone: "danger", label: "The last send failed" };
|
|
12
|
+
if (!summary.paired) return { tone: "warning", label: "Not paired with Chrome yet" };
|
|
13
|
+
return null;
|
|
14
|
+
}
|
package/client/navigation.tsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ComponentType } from "react";
|
|
2
|
-
import type { PluginClientContext, PluginSurfaceProps } from "@getpaseo/plugin/client";
|
|
3
|
-
import { Pressable, Text, View } from "react-native";
|
|
4
|
-
|
|
5
|
-
export function withNavigation<P extends PluginSurfaceProps>(Component: ComponentType<P>, client: PluginClientContext, home: string, active = "overview") {
|
|
6
|
-
return function PluginView(props: P) {
|
|
7
|
-
return <View style={{ flex: 1, backgroundColor: props.theme.colors.surface0 }}>
|
|
8
|
-
<View accessibilityRole="toolbar" style={{ flexDirection: "row", flexWrap: "wrap", gap: 4, padding: 8, borderBottomWidth: 1, borderColor: props.theme.colors.border }}>
|
|
9
|
-
{[{ id: "overview", title: "Overview", target: home }, { id: "display", title: "Display settings", target: "display-settings" }].map(item => <Pressable key={item.id} accessibilityRole="button" accessibilityState={{ selected: active === item.id }} onPress={() => client.openSurface(item.target)} style={({ pressed }) => ({ minHeight: 44, paddingHorizontal: 12, justifyContent: "center", borderRadius: 6, backgroundColor: pressed || active === item.id ? props.theme.colors.surface2 : "transparent" })}><Text style={{ color: active === item.id ? props.theme.colors.foreground : props.theme.colors.foregroundMuted, fontSize: 13, fontWeight: active === item.id ? "600" : "400" }}>{item.title}</Text></Pressable>)}
|
|
10
|
-
</View>
|
|
11
|
-
<Component {...props} />
|
|
12
|
-
</View>;
|
|
13
|
-
};
|
|
14
|
-
}
|