@koinzhang/paseo-plugin-inbox 0.1.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/CHANGELOG.md +30 -0
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/client/agent-status.tsx +129 -0
- package/client/header-button.ts +127 -0
- package/client/inbox-surface.tsx +1369 -0
- package/client/last-exchange.ts +49 -0
- package/client/panel-visibility.ts +45 -0
- package/client/selection.ts +50 -0
- package/client/use-inbox-filters.ts +83 -0
- package/client/web.ts +84 -0
- package/client/workspace-panel.tsx +18 -0
- package/index.client.tsx +74 -0
- package/index.server.ts +17 -0
- package/package.json +43 -0
- package/paseo-plugin.json +7 -0
- package/server/agents.ts +106 -0
- package/server/daemon.ts +85 -0
- package/server/directory.ts +63 -0
- package/server/handlers.ts +144 -0
- package/server/project-key.ts +42 -0
- package/server/store.ts +394 -0
- package/server/tags.ts +41 -0
- package/shared/agent-status.ts +39 -0
- package/shared/contracts.ts +192 -0
- package/shared/filter-settings.ts +74 -0
- package/shared/item-title.ts +8 -0
- package/shared/last-exchange.ts +124 -0
- package/shared/note.ts +4 -0
- package/shared/plugin-id.ts +4 -0
- package/shared/project-key.ts +55 -0
- package/shared/slash-command.ts +9 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@koinzhang/paseo-plugin-inbox` are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-09-30
|
|
11
|
+
|
|
12
|
+
Requires Paseo **>= 0.9.0**.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Each workspace header has an Inbox icon that opens that workspace's Inbox in the Explorer, and hides while the panel is open.
|
|
17
|
+
- A starred agent's detail shows its latest user prompt and agent reply from the host timeline.
|
|
18
|
+
- Inbox sidebar surface with Agents / Notes / Scratch groups, project filter, and search.
|
|
19
|
+
- Star the current agent from the Command Center; starred agents survive archiving and can be unarchived from the Inbox (restoring an archived workspace first).
|
|
20
|
+
- `/inbox <text>` slash command and Quick note command for scratch capture.
|
|
21
|
+
- `/inbox` with no text adds the current agent to the Inbox.
|
|
22
|
+
- Starred agents show their live status (Running, Finished, Needs permission, Error, Idle); archived agents no longer offer Open, and the agent actions read `Open` / `Remove`.
|
|
23
|
+
- Notes and scratch can be tagged with a project and a workspace; a workspace must belong to the tagged project.
|
|
24
|
+
- The Explorer's workspace Inbox shows the items tagged with that workspace or only with its project, and everything in it is on the Inbox page.
|
|
25
|
+
- Tags of archived projects and workspaces are struck through; their items are no longer hidden.
|
|
26
|
+
- Empty notes are never kept: a new note is saved only once it has a title or text, and a note left empty is removed.
|
|
27
|
+
- Items grouped by project: git remote URL, falling back to the repository root path.
|
|
28
|
+
|
|
29
|
+
[Unreleased]: https://github.com/koinzhang/paseo-plugins/compare/inbox-v0.1.0...HEAD
|
|
30
|
+
[0.1.0]: https://github.com/koinzhang/paseo-plugins/releases/tag/inbox-v0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 koinzhang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Inbox
|
|
2
|
+
|
|
3
|
+
A personal inbox for Paseo: star agents, keep notes per project, and capture scratch text without leaving the composer.
|
|
4
|
+
|
|
5
|
+
- **Starred agents**: ⌘K → *Add agent to Inbox*. A starred agent stays in the Inbox after it is archived; *Unarchive* restores it, restoring its archived workspace first when needed. Its detail shows the latest user prompt and the latest agent reply.
|
|
6
|
+
- **Notes**: ⌘K → *New Inbox note*, or *+ Note* in the Inbox. Autosaved plain text / Markdown.
|
|
7
|
+
- **Scratch**: type `/inbox <text>` in an agent composer. It is tagged with the current project. Nothing is sent to the agent. Convert scratch to a note later.
|
|
8
|
+
- **Star from the composer**: type `/inbox` with no text to add the current agent to the Inbox.
|
|
9
|
+
- **Tags**: every item can carry a project tag and a workspace tag. On a note or scratch, tap the tags in its detail to change them. A workspace must belong to the tagged project: while a workspace is set, other projects are unavailable, and picking a workspace alone sets its project. A starred agent is tagged with its own workspace and project.
|
|
10
|
+
- **Workspace Inbox**: the *Inbox* panel in the right-hand Explorer shows items tagged with that workspace, plus items tagged only with its project. It is a filtered view of the one Inbox, so everything in it is also on the Inbox page. A note added in the panel is tagged with that workspace. An Inbox icon in the workspace header opens it, and hides while the panel is open. The note and add-agent buttons sit to the right of search. Workspace and project chips on the Inbox page appear only on the *Agents* tab; tap one to narrow the agents, tap again to clear. The choice is kept when you leave Agents and applied again when you come back.
|
|
11
|
+
- **Archived projects and workspaces**: their items stay in the Inbox; their tags and chips are struck through, and the strike goes away when they are restored.
|
|
12
|
+
- **Sorting**: the button next to *+ Note* on the Inbox page cycles through updated time (default), starred time, created time, and name. Drag the divider to resize the list. Pinned items stay on top.
|
|
13
|
+
- **Projects**: items are grouped by the git remote URL (`origin`, else the first remote), falling back to the repository root, then the directory. Worktrees of one repository share a project.
|
|
14
|
+
- **Hosts**: data lives on each daemon in `~/.paseo/plugin-data/inbox/inbox.db`. With several hosts connected, the Inbox host picker switches between them.
|
|
15
|
+
|
|
16
|
+
Requires Paseo >= 0.9.0 and a daemon Node runtime with `node:sqlite`.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
paseo plugin add npm:@koinzhang/paseo-plugin-inbox
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
To install from GitHub, use `paseo plugin add koinzhang/paseo-plugins --path inbox`.
|
|
25
|
+
|
|
26
|
+
## Development
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install
|
|
30
|
+
npm run typecheck
|
|
31
|
+
npm test
|
|
32
|
+
paseo plugin install "$PWD"
|
|
33
|
+
paseo plugin reload inbox
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Specs: [`specs/`](./specs/).
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { PluginTheme } from "@getpaseo/plugin";
|
|
2
|
+
import { Icon } from "@getpaseo/plugin/client/react-native";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { Animated, Easing, Text, View } from "react-native";
|
|
5
|
+
import type { AgentLive, AgentState } from "../shared/contracts.ts";
|
|
6
|
+
import { agentAttention, isAgentRunning } from "../shared/agent-status.ts";
|
|
7
|
+
|
|
8
|
+
const SPIN_SIZE = 10;
|
|
9
|
+
const SPIN_DURATION_MS = 800;
|
|
10
|
+
const BADGE_HEIGHT = 18;
|
|
11
|
+
|
|
12
|
+
/** Host-style running ring, same as Activity's Explorer rows. */
|
|
13
|
+
function RunningIndicator({ theme }: { theme: PluginTheme }) {
|
|
14
|
+
const spin = useRef(new Animated.Value(0)).current;
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const animation = Animated.loop(
|
|
17
|
+
Animated.timing(spin, {
|
|
18
|
+
toValue: 1,
|
|
19
|
+
duration: SPIN_DURATION_MS,
|
|
20
|
+
easing: Easing.linear,
|
|
21
|
+
useNativeDriver: false,
|
|
22
|
+
}),
|
|
23
|
+
);
|
|
24
|
+
animation.start();
|
|
25
|
+
return () => animation.stop();
|
|
26
|
+
}, [spin]);
|
|
27
|
+
return (
|
|
28
|
+
<Animated.View
|
|
29
|
+
style={{
|
|
30
|
+
width: SPIN_SIZE,
|
|
31
|
+
height: SPIN_SIZE,
|
|
32
|
+
borderRadius: SPIN_SIZE / 2,
|
|
33
|
+
borderWidth: 2,
|
|
34
|
+
borderColor: theme.colors.border,
|
|
35
|
+
borderTopColor: theme.colors.accent,
|
|
36
|
+
transform: [{ rotate: spin.interpolate({ inputRange: [0, 1], outputRange: ["0deg", "360deg"] }) }],
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Activity's agent glyph: `BotOff` once archived or gone, otherwise a Bot tinted by
|
|
44
|
+
* attention (error / permission / finished) with a spinner badge while it runs.
|
|
45
|
+
*/
|
|
46
|
+
export function AgentIcon({
|
|
47
|
+
state,
|
|
48
|
+
live,
|
|
49
|
+
size,
|
|
50
|
+
theme,
|
|
51
|
+
}: {
|
|
52
|
+
state: AgentState | undefined;
|
|
53
|
+
live: AgentLive | undefined;
|
|
54
|
+
size: number;
|
|
55
|
+
theme: PluginTheme;
|
|
56
|
+
}) {
|
|
57
|
+
const c = theme.colors;
|
|
58
|
+
const off = state === "archived" || state === "missing";
|
|
59
|
+
const attention = off ? null : agentAttention(live);
|
|
60
|
+
const color =
|
|
61
|
+
attention === "error"
|
|
62
|
+
? c.statusDanger
|
|
63
|
+
: attention === "permission"
|
|
64
|
+
? c.statusWarning
|
|
65
|
+
: attention === "finished"
|
|
66
|
+
? c.statusSuccess
|
|
67
|
+
: c.foregroundMuted;
|
|
68
|
+
return (
|
|
69
|
+
<View style={{ width: size, height: size, alignItems: "center", justifyContent: "center" }}>
|
|
70
|
+
<Icon name={off ? "BotOff" : "Bot"} size={size} color={color} />
|
|
71
|
+
{!off && isAgentRunning(live) ? (
|
|
72
|
+
<View
|
|
73
|
+
style={{
|
|
74
|
+
position: "absolute",
|
|
75
|
+
right: -4,
|
|
76
|
+
bottom: -4,
|
|
77
|
+
width: 13,
|
|
78
|
+
height: 13,
|
|
79
|
+
borderRadius: 6.5,
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
backgroundColor: c.surface0,
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<RunningIndicator theme={theme} />
|
|
86
|
+
</View>
|
|
87
|
+
) : null}
|
|
88
|
+
</View>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Pending permission pill shown at the end of the row. */
|
|
93
|
+
export function PermissionBadge({
|
|
94
|
+
state,
|
|
95
|
+
live,
|
|
96
|
+
theme,
|
|
97
|
+
}: {
|
|
98
|
+
state: AgentState | undefined;
|
|
99
|
+
live: AgentLive | undefined;
|
|
100
|
+
theme: PluginTheme;
|
|
101
|
+
}) {
|
|
102
|
+
const count = state === "active" ? (live?.permissions ?? 0) : 0;
|
|
103
|
+
if (count === 0) return null;
|
|
104
|
+
const c = theme.colors;
|
|
105
|
+
return (
|
|
106
|
+
<View
|
|
107
|
+
accessibilityLabel={count === 1 ? "1 pending permission" : `${count} pending permissions`}
|
|
108
|
+
style={{
|
|
109
|
+
flexDirection: "row",
|
|
110
|
+
alignItems: "center",
|
|
111
|
+
gap: 3,
|
|
112
|
+
height: BADGE_HEIGHT,
|
|
113
|
+
paddingHorizontal: 5,
|
|
114
|
+
borderRadius: BADGE_HEIGHT / 2,
|
|
115
|
+
borderWidth: 1,
|
|
116
|
+
borderColor: c.border,
|
|
117
|
+
backgroundColor: c.surface1,
|
|
118
|
+
flexShrink: 0,
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
<Icon name="ShieldAlert" size={12} color={c.statusWarning} />
|
|
122
|
+
{count > 1 ? (
|
|
123
|
+
<Text style={{ fontSize: 11, fontWeight: "600", color: c.statusWarning, fontVariant: ["tabular-nums"] }}>
|
|
124
|
+
{count}
|
|
125
|
+
</Text>
|
|
126
|
+
) : null}
|
|
127
|
+
</View>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { PluginButtonRegistration, PluginClientContext } from "@getpaseo/plugin/client";
|
|
2
|
+
import { isPanelMounted, watchPanelPresence } from "./panel-visibility.ts";
|
|
3
|
+
|
|
4
|
+
type WorkspacesApi = PluginClientContext["paseo"]["workspaces"];
|
|
5
|
+
type ListResult = Awaited<ReturnType<WorkspacesApi["list"]>>;
|
|
6
|
+
|
|
7
|
+
const BUTTON_ID = "workspace-inbox";
|
|
8
|
+
const PANEL_ID = "workspace-inbox";
|
|
9
|
+
const PAGE_LIMIT = 200;
|
|
10
|
+
const BUTTON_TITLE = "Inbox";
|
|
11
|
+
|
|
12
|
+
/** One header button per workspace, following an entry-owned workspace directory subscription. */
|
|
13
|
+
export function contributeHeaderButtons(
|
|
14
|
+
client: PluginClientContext,
|
|
15
|
+
intervalMs = 15_000,
|
|
16
|
+
): () => void {
|
|
17
|
+
const workspaces = client.paseo.workspaces;
|
|
18
|
+
const buttons = new Map<string, PluginButtonRegistration>();
|
|
19
|
+
const report = (error: unknown) => console.error("[inbox] workspace directory failed", error);
|
|
20
|
+
let disposed = false;
|
|
21
|
+
let connecting = false;
|
|
22
|
+
let generation = 0;
|
|
23
|
+
let release: (() => Promise<void>) | undefined;
|
|
24
|
+
|
|
25
|
+
function add(workspaceId: string) {
|
|
26
|
+
if (disposed || buttons.has(workspaceId)) return;
|
|
27
|
+
buttons.set(workspaceId, client.addHeaderButton({
|
|
28
|
+
id: BUTTON_ID,
|
|
29
|
+
workspaceId,
|
|
30
|
+
button: {
|
|
31
|
+
title: BUTTON_TITLE,
|
|
32
|
+
icon: "Inbox",
|
|
33
|
+
visible: !isPanelMounted(workspaceId),
|
|
34
|
+
behavior: {
|
|
35
|
+
kind: "action",
|
|
36
|
+
onPress() {
|
|
37
|
+
client.openPanel(PANEL_ID, { workspaceId, location: "explorer" });
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function remove(workspaceId: string) {
|
|
45
|
+
buttons.get(workspaceId)?.remove();
|
|
46
|
+
buttons.delete(workspaceId);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function read(first?: ListResult) {
|
|
50
|
+
const run = ++generation;
|
|
51
|
+
try {
|
|
52
|
+
const ids = new Set<string>();
|
|
53
|
+
let page = first ?? await workspaces.list({ page: { limit: PAGE_LIMIT } });
|
|
54
|
+
for (let pages = 0; ; pages++) {
|
|
55
|
+
if (disposed || run !== generation) return;
|
|
56
|
+
for (const workspace of page.entries) ids.add(workspace.id);
|
|
57
|
+
if (!page.pageInfo.hasMore) break;
|
|
58
|
+
if (!page.pageInfo.nextCursor || pages >= 99) throw new Error("Incomplete workspace pagination");
|
|
59
|
+
page = await workspaces.list({ page: { limit: PAGE_LIMIT, cursor: page.pageInfo.nextCursor } });
|
|
60
|
+
}
|
|
61
|
+
for (const id of [...buttons.keys()]) if (!ids.has(id)) remove(id);
|
|
62
|
+
for (const id of ids) add(id);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
if (!disposed && run === generation) report(error);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function connect() {
|
|
69
|
+
if (disposed || connecting || release) return;
|
|
70
|
+
connecting = true;
|
|
71
|
+
try {
|
|
72
|
+
const result = await workspaces.list({ page: { limit: PAGE_LIMIT }, subscribe: {} });
|
|
73
|
+
if (disposed) {
|
|
74
|
+
await result.subscription.release();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
release = () => result.subscription.release();
|
|
78
|
+
result.subscription.subscribe({
|
|
79
|
+
// Called immediately and again after reconnect.
|
|
80
|
+
snapshot: (page) => { void read(page); },
|
|
81
|
+
update: (message) => {
|
|
82
|
+
if (disposed || message.type !== "workspace_update") return;
|
|
83
|
+
const update = message.payload;
|
|
84
|
+
if (update.kind === "upsert") add(update.workspace.id);
|
|
85
|
+
else remove(update.id);
|
|
86
|
+
},
|
|
87
|
+
error: (error) => {
|
|
88
|
+
if (disposed) return;
|
|
89
|
+
report(error);
|
|
90
|
+
const stop = release;
|
|
91
|
+
release = undefined;
|
|
92
|
+
if (stop) void stop().catch(report);
|
|
93
|
+
void read();
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
} catch (error) {
|
|
97
|
+
if (!disposed) {
|
|
98
|
+
report(error);
|
|
99
|
+
await read();
|
|
100
|
+
}
|
|
101
|
+
} finally {
|
|
102
|
+
connecting = false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const timer = setInterval(() => {
|
|
107
|
+
if (!release) void connect();
|
|
108
|
+
else void read();
|
|
109
|
+
}, intervalMs);
|
|
110
|
+
void connect();
|
|
111
|
+
|
|
112
|
+
const stopPresence = watchPanelPresence((workspaceId) => {
|
|
113
|
+
buttons.get(workspaceId)?.update({ visible: !isPanelMounted(workspaceId) });
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
return () => {
|
|
117
|
+
disposed = true;
|
|
118
|
+
++generation;
|
|
119
|
+
clearInterval(timer);
|
|
120
|
+
stopPresence();
|
|
121
|
+
const stop = release;
|
|
122
|
+
release = undefined;
|
|
123
|
+
if (stop) void stop().catch(report);
|
|
124
|
+
buttons.forEach((button) => button.remove());
|
|
125
|
+
buttons.clear();
|
|
126
|
+
};
|
|
127
|
+
}
|