@andrioid/paseo-attention-span 0.2.1 → 0.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/OVERVIEW.md +11 -7
- package/client/attention-screen.tsx +182 -79
- package/client/card.tsx +5 -15
- package/client/coverage-settings.tsx +35 -4
- package/client/feedback.tsx +151 -0
- package/client/host.ts +8 -0
- package/client/icons.ts +3 -2
- package/client/next-up.tsx +29 -45
- package/client/session-menu.ts +18 -26
- package/client/sessions.ts +5 -2
- package/client/sheet.tsx +17 -72
- package/client/ui.tsx +0 -49
- package/docs/architecture.md +188 -0
- package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
- package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
- package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing-too-long.png +0 -0
- package/docs/screenshots/desktop-dark-doing.png +0 -0
- package/docs/screenshots/desktop-dark-history-reviewed.png +0 -0
- package/docs/screenshots/desktop-dark-history.png +0 -0
- package/docs/screenshots/desktop-dark-next-up.png +0 -0
- package/docs/screenshots/desktop-dark-settings.png +0 -0
- package/docs/screenshots/desktop-dark-setup.png +0 -0
- package/docs/screenshots/desktop-dark-waiting.png +0 -0
- package/docs/screenshots/phone-dark-doing.png +0 -0
- package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
- package/index.client.tsx +15 -5
- package/index.server.ts +28 -2
- package/package.json +5 -2
- package/requirements.yaml +128 -0
- package/server/actions.ts +31 -1
- package/server/classify.ts +150 -52
- package/server/feedback.ts +38 -0
- package/server/fixture.ts +48 -16
- package/server/github-types.ts +15 -2
- package/server/queries.ts +15 -4
- package/server/rules.ts +119 -0
- package/server/service.ts +15 -3
- package/server/setup.ts +3 -3
- package/server/store.ts +5 -0
- package/shared/attention.ts +36 -2
- package/shared/config.ts +3 -0
- package/shared/feedback.ts +91 -0
- package/shared/rpc.ts +12 -1
- package/shared/setup.ts +2 -0
- package/docs/screenshots/desktop-dark-doing-session-menu.png +0 -0
|
@@ -5,7 +5,8 @@ import { useState } from "react";
|
|
|
5
5
|
import { Text, View } from "react-native";
|
|
6
6
|
import * as rpc from "../shared/rpc";
|
|
7
7
|
import type { ConfigStatus, CoverageKind } from "../shared/setup";
|
|
8
|
-
import { VIEW_QUERY_KEY } from "./data";
|
|
8
|
+
import { useAttention, VIEW_QUERY_KEY } from "./data";
|
|
9
|
+
import { useHostLabel } from "./host";
|
|
9
10
|
import { Button, StylesProvider, useStyles } from "./ui";
|
|
10
11
|
|
|
11
12
|
const COVERAGE_QUERY_KEY = ["attention-span", "coverage"] as const;
|
|
@@ -15,20 +16,33 @@ const CAPTION = { marginTop: -24, marginBottom: 16 };
|
|
|
15
16
|
|
|
16
17
|
// Settings → Plugins → Attention Span: which orgs and repos the lists cover, and where Next up looks,
|
|
17
18
|
// saved to config.json [SRC-02, NXT-04].
|
|
18
|
-
export function CoverageSettings({ theme, layout }: PluginSurfaceProps) {
|
|
19
|
+
export function CoverageSettings({ theme, layout, host }: PluginSurfaceProps) {
|
|
19
20
|
return (
|
|
20
21
|
<StylesProvider theme={theme} compact={layout.compact}>
|
|
21
|
-
<
|
|
22
|
+
<View style={{ gap: 24 }}>
|
|
23
|
+
<HostLine host={host} />
|
|
24
|
+
<Coverage />
|
|
25
|
+
</View>
|
|
22
26
|
</StylesProvider>
|
|
23
27
|
);
|
|
24
28
|
}
|
|
25
29
|
|
|
30
|
+
// Which host's config.json this edits, and its GitHub account, when there are several hosts [REACH-02].
|
|
31
|
+
function HostLine({ host }: Pick<PluginSurfaceProps, "host">) {
|
|
32
|
+
const styles = useStyles();
|
|
33
|
+
const label = useHostLabel(host);
|
|
34
|
+
const login = useAttention().data?.login;
|
|
35
|
+
if (!label) return null;
|
|
36
|
+
return <Text style={styles.muted}>{login ? `These settings are for ${label}, signed in to GitHub as @${login}.` : `These settings are for ${label}.`}</Text>;
|
|
37
|
+
}
|
|
38
|
+
|
|
26
39
|
function Coverage() {
|
|
27
40
|
const styles = useStyles();
|
|
28
41
|
const queryClient = useQueryClient();
|
|
29
42
|
const fetchCoverage = useRpc(rpc.getCoverage);
|
|
30
43
|
const save = useRpc(rpc.setCoverage);
|
|
31
44
|
const saveNextUp = useRpc(rpc.setNextUpSources);
|
|
45
|
+
const saveFollow = useRpc(rpc.setFollowThreads);
|
|
32
46
|
const coverage = useQuery({ queryKey: COVERAGE_QUERY_KEY, queryFn: () => fetchCoverage({}) });
|
|
33
47
|
const [saving, setSaving] = useState(false);
|
|
34
48
|
const [error, setError] = useState<string | null>(null);
|
|
@@ -41,7 +55,7 @@ function Coverage() {
|
|
|
41
55
|
</SettingsCard>
|
|
42
56
|
</SettingsSection>
|
|
43
57
|
);
|
|
44
|
-
const { orgs, repos, nextUp } = coverage.data;
|
|
58
|
+
const { orgs, repos, nextUp, followThreads } = coverage.data;
|
|
45
59
|
// A file that doesn't parse is left for the person who edited it.
|
|
46
60
|
if (coverage.data.error)
|
|
47
61
|
return (
|
|
@@ -105,6 +119,23 @@ function Coverage() {
|
|
|
105
119
|
: "None chosen: using your Paseo projects."}
|
|
106
120
|
</Text>
|
|
107
121
|
</View>
|
|
122
|
+
<View style={{ gap: 8 }}>
|
|
123
|
+
<SettingsSection title="Replies">
|
|
124
|
+
<SettingsCard>
|
|
125
|
+
<SettingsSwitch
|
|
126
|
+
label="Follow threads I've commented on"
|
|
127
|
+
value={followThreads}
|
|
128
|
+
disabled={saving}
|
|
129
|
+
onValueChange={(on) => void write({ followThreads: on }, () => saveFollow({ on }))}
|
|
130
|
+
/>
|
|
131
|
+
</SettingsCard>
|
|
132
|
+
</SettingsSection>
|
|
133
|
+
<Text style={[styles.muted, CAPTION]}>
|
|
134
|
+
{followThreads
|
|
135
|
+
? "Recent replies after your comment on other people's threads show under Answered."
|
|
136
|
+
: "Only tags bring other people's threads back. Your own issues and PRs show any recent reply."}
|
|
137
|
+
</Text>
|
|
138
|
+
</View>
|
|
108
139
|
<View style={{ gap: 4 }}>
|
|
109
140
|
{error ? <Text style={styles.danger}>{error}</Text> : null}
|
|
110
141
|
{/* Until more moves here, point to the file for the rest. */}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { openExternalUrl, usePaseo, useRpc } from "@getpaseo/plugin/client";
|
|
2
|
+
import { Modal, TextInput, useToast } from "@getpaseo/plugin/client/ui";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Pressable, Text, View } from "react-native";
|
|
5
|
+
import type { AgentSummary } from "../shared/attention";
|
|
6
|
+
import type { AttentionConfig } from "../shared/config";
|
|
7
|
+
import { FEEDBACK_REPO, type FeedbackContext, type FeedbackKind, feedbackItemKey, feedbackPrompt } from "../shared/feedback";
|
|
8
|
+
import * as rpc from "../shared/rpc";
|
|
9
|
+
import { ActionSheet, type SheetEntry } from "./sheet";
|
|
10
|
+
import { sessionEntry } from "./session-menu";
|
|
11
|
+
import { ITEM_LABEL, KIND_LABEL, LABEL, resolveAgentConfig } from "./sessions";
|
|
12
|
+
import { Button, KeepStyles, TablerIcon, useStyles } from "./ui";
|
|
13
|
+
|
|
14
|
+
// Feedback to the Attention Span project from the bottom of every tab [FB-01].
|
|
15
|
+
// Problem and Idea start an agent that asks until it's clear and posts only once I approve; Like opens the repo to star it.
|
|
16
|
+
|
|
17
|
+
const KINDS: Record<FeedbackKind, { label: string; detail: string; ask: string; placeholder: string; cont: string }> = {
|
|
18
|
+
problem: {
|
|
19
|
+
label: "Something's wrong",
|
|
20
|
+
detail: "A bug, something in the wrong list, or something confusing. An agent asks until it's clear, then drafts an issue or discussion for you to approve",
|
|
21
|
+
ask: "What happened?",
|
|
22
|
+
placeholder: "Waiting still shows a PR I merged yesterday…",
|
|
23
|
+
cont: "Continue problem report",
|
|
24
|
+
},
|
|
25
|
+
idea: {
|
|
26
|
+
label: "I have an idea",
|
|
27
|
+
detail: "An agent checks it against what's planned, asks until it's clear, then drafts an issue or discussion for you to approve",
|
|
28
|
+
ask: "What's your idea?",
|
|
29
|
+
placeholder: "I'd like to see…",
|
|
30
|
+
cont: "Continue idea",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const REPO_URL = `https://github.com/${FEEDBACK_REPO}`;
|
|
35
|
+
|
|
36
|
+
export type FeedbackScreen = Omit<FeedbackContext, "message" | "dir" | "version">;
|
|
37
|
+
|
|
38
|
+
export function FeedbackLine({ onPress }: { onPress: () => void }) {
|
|
39
|
+
const styles = useStyles();
|
|
40
|
+
return (
|
|
41
|
+
<Pressable accessibilityRole="button" onPress={onPress} style={[styles.row, { justifyContent: "center", paddingVertical: 12 }]} hitSlop={8}>
|
|
42
|
+
<Text style={styles.muted}>Enjoying Attention Span?</Text>
|
|
43
|
+
<TablerIcon name="chevronRight" size={14} color={styles.c.foregroundMuted} />
|
|
44
|
+
</Pressable>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Picking a line closes the sheet before the next one opens, as an item's sheet does for Options:
|
|
49
|
+
// swapping the sheet for the next one inside it showed the wrong dialog on phones.
|
|
50
|
+
export function FeedbackSheet({
|
|
51
|
+
agents,
|
|
52
|
+
onOpenAgent,
|
|
53
|
+
onAsk,
|
|
54
|
+
onClose,
|
|
55
|
+
}: {
|
|
56
|
+
agents: AgentSummary[];
|
|
57
|
+
onOpenAgent: (agentId: string) => void;
|
|
58
|
+
onAsk: (kind: FeedbackKind) => void;
|
|
59
|
+
onClose: () => void;
|
|
60
|
+
}) {
|
|
61
|
+
const close = (then: () => void) => () => (onClose(), then());
|
|
62
|
+
// Built with map, not a for loop: a closure must get its own kind on every JS engine the app runs on.
|
|
63
|
+
const entries: SheetEntry[] = (["problem", "idea"] as const).flatMap((kind): SheetEntry[] => {
|
|
64
|
+
// An open one takes the line, so a report stays in one session [SES-03].
|
|
65
|
+
const open = agents.filter((agent) => agent.itemKey === feedbackItemKey(kind));
|
|
66
|
+
if (open.length) return open.map((agent) => sessionEntry(agent, KINDS[kind].cont, (id) => close(() => onOpenAgent(id))()));
|
|
67
|
+
return [{ key: kind, icon: "agent", label: `${KINDS[kind].label}…`, detail: KINDS[kind].detail, onPress: close(() => onAsk(kind)) }];
|
|
68
|
+
});
|
|
69
|
+
entries.push({ key: "like", icon: "star", label: "I'll star it on GitHub", detail: "Opens the repo, so others find it too", onPress: close(() => void openExternalUrl(REPO_URL)) });
|
|
70
|
+
return <ActionSheet title="Enjoying Attention Span?" top={null} entries={entries} bottom={null} onClose={onClose} />;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// The first words go in the prompt, so the agent's first message is already a follow-up [FB-01].
|
|
74
|
+
export function FeedbackAsk({
|
|
75
|
+
kind,
|
|
76
|
+
config,
|
|
77
|
+
screen,
|
|
78
|
+
onStarted,
|
|
79
|
+
onBack,
|
|
80
|
+
onClose,
|
|
81
|
+
}: {
|
|
82
|
+
kind: FeedbackKind;
|
|
83
|
+
config: AttentionConfig;
|
|
84
|
+
screen: FeedbackScreen;
|
|
85
|
+
onStarted: (agentId: string) => Promise<void>;
|
|
86
|
+
onBack: () => void;
|
|
87
|
+
onClose: () => void;
|
|
88
|
+
}) {
|
|
89
|
+
const styles = useStyles();
|
|
90
|
+
const paseo = usePaseo();
|
|
91
|
+
const toast = useToast();
|
|
92
|
+
const fetchInfo = useRpc(rpc.feedbackInfo);
|
|
93
|
+
const [message, setMessage] = useState("");
|
|
94
|
+
const [starting, setStarting] = useState(false);
|
|
95
|
+
|
|
96
|
+
async function start() {
|
|
97
|
+
setStarting(true);
|
|
98
|
+
try {
|
|
99
|
+
const info = await fetchInfo({});
|
|
100
|
+
const prompt = feedbackPrompt(kind, { ...screen, message, dir: info.hasSource ? info.cwd : null, version: info.version });
|
|
101
|
+
const { agent } = await resolveAgentConfig(paseo, "start", config);
|
|
102
|
+
const workspace = await paseo.workspaces.open({ cwd: info.cwd });
|
|
103
|
+
const created = await workspace.agents.create({
|
|
104
|
+
config: { ...agent, modeId: (await readOnlyMode(paseo, agent.provider)) ?? agent.modeId },
|
|
105
|
+
title: `Feedback: ${KINDS[kind].label}`,
|
|
106
|
+
prompt,
|
|
107
|
+
labels: { [LABEL]: "1", [ITEM_LABEL]: feedbackItemKey(kind), [KIND_LABEL]: `feedback-${kind}` },
|
|
108
|
+
});
|
|
109
|
+
onClose();
|
|
110
|
+
await onStarted(created.id);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
toast.error(`Starting the session failed: ${(error as Error).message}`);
|
|
113
|
+
} finally {
|
|
114
|
+
setStarting(false);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<Modal title={KINDS[kind].label} open onOpenChange={(open) => (open ? null : onClose())}>
|
|
120
|
+
<Modal.Content>
|
|
121
|
+
<KeepStyles styles={styles}>
|
|
122
|
+
<View style={{ gap: 10 }}>
|
|
123
|
+
<Text style={styles.muted}>{KINDS[kind].ask}</Text>
|
|
124
|
+
<TextInput
|
|
125
|
+
style={[styles.input, { minHeight: 110 }]}
|
|
126
|
+
value={message}
|
|
127
|
+
onChangeText={setMessage}
|
|
128
|
+
placeholder={KINDS[kind].placeholder}
|
|
129
|
+
multiline
|
|
130
|
+
textAlignVertical="top"
|
|
131
|
+
autoFocus
|
|
132
|
+
/>
|
|
133
|
+
<Text style={styles.muted}>An agent asks what else it needs and shows you the post before anything goes to GitHub.</Text>
|
|
134
|
+
<View style={styles.wrap}>
|
|
135
|
+
<Button label={starting ? "Starting…" : "Start"} icon="agent" variant="solid" disabled={starting || !message.trim()} onPress={() => void start()} />
|
|
136
|
+
<Button label="Back" onPress={onBack} />
|
|
137
|
+
</View>
|
|
138
|
+
</View>
|
|
139
|
+
</KeepStyles>
|
|
140
|
+
</Modal.Content>
|
|
141
|
+
</Modal>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// The provider's plan or read-only mode, where it has one, so the session reads but doesn't change files.
|
|
146
|
+
async function readOnlyMode(paseo: ReturnType<typeof usePaseo>, provider: string): Promise<string | undefined> {
|
|
147
|
+
const name = provider.split("/")[0];
|
|
148
|
+
const snapshot = await paseo.providers.snapshot();
|
|
149
|
+
const modes = snapshot.entries.find((entry) => entry.provider === name)?.modes ?? [];
|
|
150
|
+
return modes.find((mode) => /plan|read.?only/i.test(`${mode.id} ${mode.label}`))?.id;
|
|
151
|
+
}
|
package/client/host.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type PluginHostProps, useHosts } from "@getpaseo/plugin/client";
|
|
2
|
+
|
|
3
|
+
// This host's name, once the app knows more than one host, so two copies of Attention Span can be told apart [REACH-02].
|
|
4
|
+
// Hosts without the plugin count too: the app can't say which hosts have it.
|
|
5
|
+
export function useHostLabel(host: PluginHostProps["host"]): string | null {
|
|
6
|
+
const hosts = useHosts();
|
|
7
|
+
return hosts.length > 1 ? host.label : null;
|
|
8
|
+
}
|
package/client/icons.ts
CHANGED
|
@@ -32,15 +32,16 @@ export const ICONS = {
|
|
|
32
32
|
clock: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0\"/><path d=\"M12 7v5l3 3\"/></g></svg>" },
|
|
33
33
|
history: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M12 8v4l2 2\"/><path d=\"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5\"/></g></svg>" },
|
|
34
34
|
issueClosed: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0\"/><path d=\"m9 12l2 2l4-4\"/></g></svg>" },
|
|
35
|
-
dots: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 12a1 1 0 1 0 2 0a1 1 0 1 0-2 0m7 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0m7 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0\"/></svg>" },
|
|
36
35
|
thumbUp: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M7 11v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1h3a4 4 0 0 0 4-4V6a2 2 0 0 1 4 0v5h3a2 2 0 0 1 2 2l-1 5a2 3 0 0 1-2 2h-7a3 3 0 0 1-3-3\"/></svg>" },
|
|
36
|
+
star: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m12 17.75l-6.172 3.245l1.179-6.873l-5-4.867l6.9-1l3.086-6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z\"/></svg>" },
|
|
37
37
|
settings: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></g></svg>" },
|
|
38
38
|
reload: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747M20 4v5h-5\"/></svg>" },
|
|
39
39
|
unclaim: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 7a4 4 0 1 0 8 0a4 4 0 0 0-8 0M6 21v-2a4 4 0 0 1 4-4h4c.348 0 .686.045 1.009.128M16 19h6\"/></svg>" },
|
|
40
40
|
filter: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227z\"/></svg>" },
|
|
41
41
|
square: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"/></svg>" },
|
|
42
42
|
squareCheck: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zm6 7l2 2l4-4\"/></svg>" },
|
|
43
|
-
|
|
43
|
+
chevronRight: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m9 6l6 6l-6 6\"/></svg>" },
|
|
44
|
+
plus: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 5v14m-7-7h14\"/></svg>" },
|
|
44
45
|
check: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m5 12l5 5L20 7\"/></svg>" },
|
|
45
46
|
// Tabler message-ai: marks actions that start or continue an agent session.
|
|
46
47
|
agent: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M8 9h8m-8 4h3.5m-1.506 6.804L8 21v-3H6a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v4\"/><path d=\"M14 21v-4a2 2 0 1 1 4 0v4m-4-2h4m3-4v6\"/></g></svg>" },
|
package/client/next-up.tsx
CHANGED
|
@@ -8,10 +8,10 @@ import type { NextUpSource } from "../shared/config";
|
|
|
8
8
|
import type { IconName } from "./icons";
|
|
9
9
|
import type { FetchDetails } from "./attention-screen";
|
|
10
10
|
import { CardList, CardRow, type Tone } from "./card";
|
|
11
|
-
import {
|
|
12
|
-
import { ActionSheet, DetailLines, type
|
|
11
|
+
import { sessionEntry, startAnotherEntry } from "./session-menu";
|
|
12
|
+
import { ActionSheet, DetailLines, type SheetEntry } from "./sheet";
|
|
13
13
|
import { Modal } from "@getpaseo/plugin/client/ui";
|
|
14
|
-
import {
|
|
14
|
+
import { Button, KeepStyles, Meta, SectionHeader, TablerIcon, useHover, useStyles } from "./ui";
|
|
15
15
|
|
|
16
16
|
const TYPE_ICONS: Record<string, IconName> = { bug: "bug", feature: "feature", debt: "debt", task: "task", epic: "epic" };
|
|
17
17
|
|
|
@@ -229,10 +229,9 @@ function Tags({ issue }: { issue: NextUpIssue }) {
|
|
|
229
229
|
// The type as the card's mark: red bugs, green features and epics, amber debt, the rest quiet.
|
|
230
230
|
const TYPE_TONES: Record<string, Tone> = { bug: "bad", feature: "good", epic: "good", debt: "warn" };
|
|
231
231
|
|
|
232
|
-
// Its main action and
|
|
232
|
+
// Its main action and ›; tapping it opens the sheet with the description, Claim or Unclaim [ATT-06, NXT-07].
|
|
233
233
|
function IssueRow({ issue, claim, first, agents, login, busy, fetchDetails, onStart, onOptions, onClaim, onCloseIssue, onOpenAgent }: RowProps & { issue: NextUpIssue; claim: boolean; first: boolean }) {
|
|
234
|
-
|
|
235
|
-
const [sheet, setSheet] = useState<"item" | { anchor?: Anchor } | null>(null);
|
|
234
|
+
const [sheet, setSheet] = useState(false);
|
|
236
235
|
// Closing asks first, with the reason and an optional comment [NXT-11, SAFE-01].
|
|
237
236
|
const [closing, setClosing] = useState(false);
|
|
238
237
|
// An open session leads; without one, Start does [SES-03].
|
|
@@ -240,21 +239,6 @@ function IssueRow({ issue, claim, first, agents, login, busy, fetchDetails, onSt
|
|
|
240
239
|
const startLabel = claim ? "Claim & start" : "Start";
|
|
241
240
|
const type = issue.type?.toLowerCase() ?? "";
|
|
242
241
|
const close = (reason: IssueCloseReason) => (comment: string) => (setClosing(false), onCloseIssue(issue, reason, comment));
|
|
243
|
-
const onMenu = (anchor: Anchor | undefined) => setSheet({ anchor });
|
|
244
|
-
const done = (then: () => void) => () => (setSheet(null), then());
|
|
245
|
-
const withOptions: SheetEntry = {
|
|
246
|
-
key: "start-options",
|
|
247
|
-
icon: "agent",
|
|
248
|
-
label: `${startLabel} with options…`,
|
|
249
|
-
detail: "Choose the workspace, agent profile and prompt first",
|
|
250
|
-
onPress: done(() => onOptions(issue, claim, startLabel)),
|
|
251
|
-
};
|
|
252
|
-
const groups: MenuGroup[] = sessions.length
|
|
253
|
-
? [
|
|
254
|
-
sessionsGroup(sessions, (agentId) => done(() => onOpenAgent(agentId))()),
|
|
255
|
-
{ title: "Start a new one", entries: [{ ...startEntry(claim), onPress: done(() => onStart(issue, claim)) }, withOptions] },
|
|
256
|
-
]
|
|
257
|
-
: [{ entries: [withOptions] }];
|
|
258
242
|
return (
|
|
259
243
|
<CardRow
|
|
260
244
|
first={first}
|
|
@@ -263,15 +247,15 @@ function IssueRow({ issue, claim, first, agents, login, busy, fetchDetails, onSt
|
|
|
263
247
|
accessibilityLabel={`${issue.type ? `${issue.type}: ` : ""}${issue.title}, more`}
|
|
264
248
|
meta={{ place: `${repoLabel(issue.repo, login)} #${issue.number}`, when: `${ago(issue.createdAt)} old`, signals: prSignal(issue) }}
|
|
265
249
|
extra={<Tags issue={issue} />}
|
|
266
|
-
onOpen={() => setSheet(
|
|
250
|
+
onOpen={() => setSheet(true)}
|
|
267
251
|
busy={busy.has(issue.key)}
|
|
268
252
|
primary={
|
|
269
253
|
sessions[0]
|
|
270
|
-
? { label: "Open session", icon: "agent", onPress: () => onOpenAgent(sessions[0].id)
|
|
254
|
+
? { label: "Open session", icon: "agent", onPress: () => onOpenAgent(sessions[0].id) }
|
|
271
255
|
: // Claim first so teammates see it's taken [NXT-05].
|
|
272
|
-
{ label: startLabel, accessibilityLabel: `${startLabel} ${issue.title}`, icon: "agent", onPress: () => onStart(issue, claim)
|
|
256
|
+
{ label: startLabel, accessibilityLabel: `${startLabel} ${issue.title}`, icon: "agent", onPress: () => onStart(issue, claim) }
|
|
273
257
|
}
|
|
274
|
-
secondary={[{ label:
|
|
258
|
+
secondary={[{ label: `Details for #${issue.number}`, icon: "chevronRight", onPress: () => setSheet(true) }]}
|
|
275
259
|
confirm={
|
|
276
260
|
closing
|
|
277
261
|
? {
|
|
@@ -286,50 +270,38 @@ function IssueRow({ issue, claim, first, agents, login, busy, fetchDetails, onSt
|
|
|
286
270
|
: null
|
|
287
271
|
}
|
|
288
272
|
overlay={
|
|
289
|
-
sheet
|
|
273
|
+
sheet ? (
|
|
290
274
|
<IssueSheet
|
|
291
275
|
issue={issue}
|
|
292
276
|
claim={claim}
|
|
293
277
|
sessions={sessions}
|
|
294
278
|
fetchDetails={fetchDetails}
|
|
295
|
-
|
|
279
|
+
onOptions={onOptions}
|
|
296
280
|
onClaim={onClaim}
|
|
297
281
|
onOpenAgent={onOpenAgent}
|
|
298
|
-
onMenu={onMenu}
|
|
299
282
|
onCloseIssue={() => setClosing(true)}
|
|
300
|
-
onClose={() => setSheet(
|
|
283
|
+
onClose={() => setSheet(false)}
|
|
301
284
|
/>
|
|
302
|
-
) : sheet ? (
|
|
303
|
-
<MenuSheet title={issue.title} anchor={sheet.anchor} groups={groups} onClose={() => setSheet(null)} />
|
|
304
285
|
) : null
|
|
305
286
|
}
|
|
306
287
|
/>
|
|
307
288
|
);
|
|
308
289
|
}
|
|
309
290
|
|
|
310
|
-
const startEntry = (claim: boolean): Omit<SheetEntry, "onPress"> => ({
|
|
311
|
-
key: "start",
|
|
312
|
-
icon: "agent",
|
|
313
|
-
label: claim ? "Claim & start" : "Start",
|
|
314
|
-
detail: `${claim ? "Assigns you, then an agent" : "An agent"} reads the issue and proposes a plan`,
|
|
315
|
-
});
|
|
316
|
-
|
|
317
291
|
function IssueSheet({
|
|
318
292
|
issue,
|
|
319
293
|
claim,
|
|
320
294
|
sessions,
|
|
321
295
|
fetchDetails,
|
|
322
|
-
|
|
296
|
+
onOptions,
|
|
323
297
|
onClaim,
|
|
324
298
|
onOpenAgent,
|
|
325
|
-
onMenu,
|
|
326
299
|
onCloseIssue,
|
|
327
300
|
onClose,
|
|
328
|
-
}: Pick<Props, "fetchDetails" | "
|
|
301
|
+
}: Pick<Props, "fetchDetails" | "onOptions" | "onClaim" | "onOpenAgent"> & {
|
|
329
302
|
issue: NextUpIssue;
|
|
330
303
|
claim: boolean;
|
|
331
304
|
sessions: AgentSummary[];
|
|
332
|
-
onMenu: (anchor: Anchor | undefined) => void;
|
|
333
305
|
onCloseIssue: () => void;
|
|
334
306
|
onClose: () => void;
|
|
335
307
|
}) {
|
|
@@ -339,14 +311,26 @@ function IssueSheet({
|
|
|
339
311
|
staleTime: 60_000,
|
|
340
312
|
});
|
|
341
313
|
const close = (then: () => void) => () => (onClose(), then());
|
|
314
|
+
const startLabel = claim ? "Claim & start" : "Start";
|
|
315
|
+
const withOptions = close(() => onOptions(issue, claim, startLabel));
|
|
316
|
+
// Its sessions in Start's place; until there's one, Start asks first, since the card's button is the one-tap start [SES-01, SES-02, SES-03].
|
|
342
317
|
const entries: SheetEntry[] = [
|
|
343
|
-
sessions.length
|
|
344
|
-
?
|
|
345
|
-
:
|
|
318
|
+
...(sessions.length
|
|
319
|
+
? sessions.map((agent) => sessionEntry(agent, "Continue session", (agentId) => close(() => onOpenAgent(agentId))()))
|
|
320
|
+
: [
|
|
321
|
+
{
|
|
322
|
+
key: "start",
|
|
323
|
+
icon: "agent" as const,
|
|
324
|
+
label: `${startLabel}…`,
|
|
325
|
+
detail: `${claim ? "Assigns you, then an agent" : "An agent"} reads the issue and proposes a plan`,
|
|
326
|
+
onPress: withOptions,
|
|
327
|
+
},
|
|
328
|
+
]),
|
|
346
329
|
claim
|
|
347
330
|
? { key: "claim", icon: "claim", label: "Claim", detail: "Assigns you, without starting a session", onPress: close(() => onClaim(issue, true)) }
|
|
348
331
|
: { key: "unclaim", icon: "unclaim", label: "Unclaim", detail: "Removes you as assignee, so it goes back to Unclaimed", onPress: close(() => onClaim(issue, false)) },
|
|
349
332
|
{ key: "github", icon: "github", label: "Open issue on GitHub", detail: `${issue.repo}#${issue.number}`, onPress: close(() => void openExternalUrl(issue.url)) },
|
|
333
|
+
...(sessions.length ? [startAnotherEntry(true, withOptions)] : []),
|
|
350
334
|
{ key: "close", icon: "issueClosed", label: "Close issue", detail: "Asks first: as completed or not planned, with an optional comment", onPress: close(onCloseIssue) },
|
|
351
335
|
];
|
|
352
336
|
return (
|
package/client/session-menu.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentSummary, Chip } from "../shared/attention";
|
|
2
2
|
import { ago } from "../shared/format";
|
|
3
|
-
import type {
|
|
3
|
+
import type { SheetEntry } from "./sheet";
|
|
4
4
|
|
|
5
5
|
// A session started from the item, as a signal [ATT-07].
|
|
6
6
|
export function agentSignal(agent: AgentSummary): Chip {
|
|
@@ -10,36 +10,28 @@ export function agentSignal(agent: AgentSummary): Chip {
|
|
|
10
10
|
return { text: "agent idle", tone: "neutral" };
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
//
|
|
14
|
-
export function
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// With a session open, the item's main action opens it; ▾ picks another or starts a new one [SES-03].
|
|
20
|
-
export function openSessionEntry(sessions: AgentSummary[], onOpen: (agentId: string) => void, onMenu: SheetEntry["menu"]): SheetEntry {
|
|
21
|
-
const first = sessions[0];
|
|
13
|
+
// A session as a sheet line, under the name of what started it: it opens the session, its state at the end [SES-03, ATT-07].
|
|
14
|
+
export function sessionEntry(agent: AgentSummary, label: string, onOpen: (agentId: string) => void): SheetEntry {
|
|
15
|
+
const signal = agentSignal(agent);
|
|
16
|
+
const when = agent.lastActivityAt ? `${ago(agent.lastActivityAt)} ago` : null;
|
|
22
17
|
return {
|
|
23
|
-
key:
|
|
18
|
+
key: agent.id,
|
|
24
19
|
icon: "agent",
|
|
25
|
-
label
|
|
26
|
-
detail:
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
label,
|
|
21
|
+
detail: [agent.title, when].filter(Boolean).join(" · ") || undefined,
|
|
22
|
+
badge: { ...signal, text: signal.text.replace(/^agent /, "") },
|
|
23
|
+
onPress: () => onOpen(agent.id),
|
|
29
24
|
};
|
|
30
25
|
}
|
|
31
26
|
|
|
32
|
-
//
|
|
33
|
-
export function
|
|
27
|
+
// A session no action covers, or another one, only on purpose: quiet, near the end [SES-02, SES-03].
|
|
28
|
+
export function startAnotherEntry(any: boolean, onPress: () => void): SheetEntry {
|
|
34
29
|
return {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
checked: index === 0,
|
|
42
|
-
onPress: () => onOpen(agent.id),
|
|
43
|
-
})),
|
|
30
|
+
key: "start-another",
|
|
31
|
+
icon: "plus",
|
|
32
|
+
label: any ? "Start another session…" : "Start a session…",
|
|
33
|
+
detail: "Pick the workspace, agent profile and prompt",
|
|
34
|
+
quiet: true,
|
|
35
|
+
onPress,
|
|
44
36
|
};
|
|
45
37
|
}
|
package/client/sessions.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { usePaseo } from "@getpaseo/plugin/client";
|
|
2
2
|
import type { AgentSummary, Target } from "../shared/attention";
|
|
3
|
-
import { type AttentionConfig, codeRepoFor, githubRepoOf,
|
|
3
|
+
import { type AttentionConfig, codeRepoFor, githubRepoOf, SessionKind } from "../shared/config";
|
|
4
4
|
|
|
5
5
|
type Paseo = ReturnType<typeof usePaseo>;
|
|
6
6
|
|
|
7
7
|
// Labels tie an agent to the item it works on [ATT-07, SES-03].
|
|
8
8
|
export const LABEL = "attention-span";
|
|
9
9
|
export const ITEM_LABEL = "attention-span-item";
|
|
10
|
+
// The action it was started for, so the sheet shows it in that action's line.
|
|
11
|
+
export const KIND_LABEL = "attention-span-kind";
|
|
10
12
|
// Sessions started under the plugin's earlier names, "GitHub attention" and "GitHub inbox".
|
|
11
13
|
const OLD_LABELS = ["github-attention", "github-inbox"];
|
|
12
14
|
|
|
@@ -21,6 +23,7 @@ export async function itemAgents(paseo: Paseo): Promise<AgentSummary[]> {
|
|
|
21
23
|
byId.set(agent.id, {
|
|
22
24
|
id: agent.id,
|
|
23
25
|
itemKey,
|
|
26
|
+
kind: SessionKind.safeParse(agent.labels?.[KIND_LABEL]).data,
|
|
24
27
|
status: agent.status,
|
|
25
28
|
requiresAttention: !!agent.requiresAttention,
|
|
26
29
|
title: agent.title ?? null,
|
|
@@ -198,7 +201,7 @@ export async function startSession(paseo: Paseo, input: StartSession): Promise<s
|
|
|
198
201
|
config: agentConfig,
|
|
199
202
|
title,
|
|
200
203
|
prompt: input.prompt,
|
|
201
|
-
labels: { [LABEL]: "1", [ITEM_LABEL]: input.itemKey },
|
|
204
|
+
labels: { [LABEL]: "1", [ITEM_LABEL]: input.itemKey, [KIND_LABEL]: input.kind },
|
|
202
205
|
});
|
|
203
206
|
return agent.id;
|
|
204
207
|
}
|