@yannelli/paseo-linear-plugin 0.1.0 → 0.4.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/NOTICE +8 -4
- package/OVERVIEW.md +23 -13
- package/README.md +138 -29
- package/client/agent-options.ts +200 -0
- package/client/autosave.ts +77 -0
- package/client/breadcrumbs.tsx +110 -0
- package/client/browser.tsx +275 -0
- package/client/compat.ts +107 -0
- package/client/connect.tsx +136 -0
- package/client/create-issue.tsx +291 -0
- package/client/glyphs.tsx +117 -0
- package/client/issue-description.tsx +206 -0
- package/client/issue-detail.tsx +358 -0
- package/client/issue-list.tsx +373 -0
- package/client/issue-row.tsx +152 -0
- package/client/issue-sections.tsx +325 -0
- package/client/issue-tree.ts +132 -0
- package/client/key-scope.tsx +23 -0
- package/client/launch-choices.ts +125 -0
- package/client/launch-fields.tsx +152 -0
- package/client/launch-plan.ts +227 -0
- package/client/launch.tsx +484 -0
- package/client/markdown.tsx +302 -0
- package/client/model-browser.tsx +296 -0
- package/client/pickers.tsx +238 -0
- package/client/provider-icon.tsx +78 -0
- package/client/queries.ts +242 -0
- package/client/settings-connection.tsx +109 -0
- package/client/settings-fields.tsx +173 -0
- package/client/settings-keys.tsx +117 -0
- package/client/settings-projects.tsx +281 -0
- package/client/settings-prompts.tsx +198 -0
- package/client/store.ts +71 -0
- package/client/timeline-card.tsx +63 -0
- package/client/ui.tsx +352 -0
- package/index.client.tsx +111 -0
- package/index.server.ts +7 -3
- package/package.json +4 -3
- package/paseo-plugin.json +2 -2
- package/server/cache.ts +68 -0
- package/server/credentials.ts +101 -0
- package/server/graphql.ts +68 -0
- package/server/handlers.ts +172 -0
- package/server/linear.ts +11 -64
- package/server/queries.ts +280 -0
- package/shared/linear.ts +268 -0
- package/shared/markdown.ts +461 -0
- package/shared/prompts.ts +150 -0
- package/shared/settings.ts +68 -0
- package/index.client.ts +0 -7
- package/server/issues.ts +0 -10
package/NOTICE
CHANGED
|
@@ -3,7 +3,11 @@ Copyright 2026 Ryan Yannelli
|
|
|
3
3
|
|
|
4
4
|
This product includes software from Paseo (https://github.com/getpaseo/paseo),
|
|
5
5
|
Copyright (c) 2025-present Mohamed Boudra, licensed under the Apache License,
|
|
6
|
-
Version 2.0. The plugin source in index.client.
|
|
7
|
-
shared/, and test/linear.test.ts
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
Version 2.0. The plugin source in index.client.tsx, index.server.ts, client/,
|
|
7
|
+
server/, shared/, and test/linear.test.ts started as the Linear example plugin
|
|
8
|
+
(plugin-examples/linear) in the Paseo repository. This repository adds Linear keys per Paseo project, a
|
|
9
|
+
response cache, list sorting, sub-issue nesting and breadcrumbs, Markdown
|
|
10
|
+
rendering, and the agent setup page. It also changes the package metadata.
|
|
11
|
+
|
|
12
|
+
client/provider-icon.tsx contains the provider icons from the Paseo app
|
|
13
|
+
(packages/app/src/components/icons). Each icon is a mark of its owner.
|
package/OVERVIEW.md
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
# Linear issues
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Browse and edit Linear issues in Paseo, and start agents from them. Open **Linear** from the sidebar, or open the Linear panel in a workspace. Requires Paseo 0.10.0 or newer.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Connect Linear
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Paste a Linear personal API key in **Settings → Plugins → Linear → Account**. Create the key in Linear under Settings → Security & access → Personal API keys. To change issues, the key must have write access. The daemon saves the key on its host with owner-only permissions. If no key is saved, the plugin uses `LINEAR_API_KEY` from the daemon environment.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
To use a different Linear key for one Paseo project, add it under **Project keys**. Workspace panels in that project use its key. The Linear screen shows a key button to switch keys.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
- Other text matches issue titles, without case sensitivity. Descriptions and comments are not searched.
|
|
13
|
-
- An empty search lists the 20 most recently updated issues. Title searches also return up to 20 issues.
|
|
14
|
-
- Each result shows its status and assignee.
|
|
11
|
+
## Browse issues
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
- Search titles and descriptions, or type an identifier such as `ENG-123`.
|
|
14
|
+
- Filter by assignee and status. Pick a team to see only its issues.
|
|
15
|
+
- Sort by Last updated, Newest, Priority, Due date, or Title.
|
|
16
|
+
- Select **Sub-issues** to nest sub-issues under their parent. The breadcrumbs above an issue show its team and parent chain.
|
|
17
|
+
- Change the status, priority, and assignee. Add comments, or create an issue.
|
|
18
|
+
- Descriptions and comments show as Markdown.
|
|
19
|
+
- Edit the description in place. It saves to Linear about one second after you stop typing, and the line under the editor confirms each save. Select a task list checkbox to check or uncheck it without opening the editor.
|
|
20
|
+
- `/linear` opens the panel. `/linear ENG-123` opens an issue.
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
## Start an agent
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
Select **Start agent** or **Start review** on an issue. The setup page shows the prompt and the composer controls for the prompt template, model, thinking level, and mode. The model picker lists providers first, and its search covers all models. Choose the project and where the agent runs: a new worktree, a pull request checkout, the issue branch, an existing agent workspace, or the current workspace or project folder. You can include comments in the prompt. For Implement, you can also move the issue to In Progress and assign it to you.
|
|
25
|
+
|
|
26
|
+
The prompt follows the template until you edit it. **Reset prompt** restores it. Edit the templates in **Prompts**, and add project instructions in **Projects**.
|
|
27
|
+
|
|
28
|
+
## Attach an issue
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
Choose **Attach Linear issue** in the composer attachment menu. The agent gets the issue text with your message. This uses the default key.
|
|
31
|
+
|
|
32
|
+
## Data and permissions
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
Only the daemon sends requests to `https://api.linear.app/graphql`. The daemon never sends a key back to the app. Paseo sends the prompt, with the issue snapshot, to the agent provider. The daemon keeps recent Linear responses in memory for up to 24 hours, and the list shows them with **Showing saved results. Updating…** while it gets new data.
|
package/README.md
CHANGED
|
@@ -1,59 +1,164 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
# Linear issues for Paseo
|
|
4
4
|
|
|
5
|
-
A Paseo plugin
|
|
5
|
+
A Paseo plugin for Linear. It adds a Linear screen and a workspace panel where you browse and edit Linear issues. From an issue, you can start an agent that implements it or reviews the work. Your Linear API key stays on the daemon host.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Browse issues in a list next to the issue view. Search and filter the list, and change its sort order.
|
|
8
|
+
- Nest sub-issues under their parent. Breadcrumbs show the parent chain of an issue.
|
|
9
|
+
- Read descriptions and comments as Markdown.
|
|
10
|
+
- Edit the description in place. It saves as you type. Check off task list items without opening the editor.
|
|
11
|
+
- Change the status, priority, and assignee. Add comments and create issues.
|
|
12
|
+
- Start an agent or a review from an issue. Choose the prompt, agent, model, effort, project, and where the agent runs.
|
|
13
|
+
- Use a different Linear key for a Paseo project.
|
|
14
|
+
- See saved results at once while the plugin gets new data from Linear.
|
|
15
|
+
- Attach a Linear issue to a message in the composer.
|
|
8
16
|
|
|
9
|
-

|
|
10
18
|
|
|
11
|
-

|
|
20
|
+
|
|
21
|
+

|
|
12
22
|
|
|
13
23
|
The images are illustrations with sample data. They come from `docs/graphics`; see [Graphics](#graphics).
|
|
14
24
|
|
|
15
25
|
## What you need
|
|
16
26
|
|
|
17
|
-
- Paseo 0.
|
|
18
|
-
- A Linear personal API key
|
|
19
|
-
|
|
20
|
-
## Setup
|
|
27
|
+
- Paseo 0.10.0 or newer, with **Enable plugins** turned on in **Settings → Plugins**.
|
|
28
|
+
- A Linear personal API key. Create one in Linear under **Settings → Security & access → Personal API keys**. To change issues, add comments, or create issues, the key must have write access.
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
## Install
|
|
23
31
|
|
|
24
32
|
```sh
|
|
25
|
-
|
|
33
|
+
paseo plugin add npm:@yannelli/paseo-linear-plugin
|
|
34
|
+
paseo plugin ls linear
|
|
26
35
|
```
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
To pin a version, add it to the source, for example `npm:@yannelli/paseo-linear-plugin@0.1.0`. To install a Git tag instead, run `paseo plugin add github:yannelli/paseo-linear-plugin --ref v0.1.0`. Plugins run trusted code with the daemon user's access.
|
|
29
38
|
|
|
30
|
-
##
|
|
39
|
+
## Connect Linear
|
|
40
|
+
|
|
41
|
+
### Default key
|
|
42
|
+
|
|
43
|
+
Open **Settings → Plugins → Linear → Account**, paste your key, and select **Connect Linear**. The Linear screen shows the same form until a key is set. The plugin checks the key with Linear before it saves it.
|
|
44
|
+
|
|
45
|
+
The daemon saves the key in `$PASEO_HOME/plugin-data/linear/credentials.json`, which is `~/.paseo/plugin-data/linear/credentials.json` by default. The file has mode `0600` and its folder has mode `0700`. A saved key takes effect at once. **Disconnect** deletes the saved key.
|
|
46
|
+
|
|
47
|
+
### Key from the environment
|
|
48
|
+
|
|
49
|
+
If no key is saved, the plugin uses `LINEAR_API_KEY` from the environment that starts the daemon:
|
|
31
50
|
|
|
32
51
|
```sh
|
|
33
|
-
|
|
34
|
-
paseo plugin ls linear
|
|
52
|
+
export LINEAR_API_KEY="lin_api_..."
|
|
35
53
|
```
|
|
36
54
|
|
|
37
|
-
|
|
55
|
+
A saved key takes precedence over the environment. To change the environment key, restart the daemon with the new value.
|
|
56
|
+
|
|
57
|
+
### Project keys
|
|
58
|
+
|
|
59
|
+
A Paseo project can use a different Linear key, for example for a different Linear workspace. In the **Project keys** section of the Account settings, choose the project, paste the key, and select **Save project key**.
|
|
60
|
+
|
|
61
|
+
- The Linear panel in a workspace of that project uses the project key.
|
|
62
|
+
- When project keys exist, the Linear screen shows a key button in the filter row. Use it to switch between **Default key** and the project keys.
|
|
63
|
+
- The plugin looks for a key in this order: the project key, the saved default key, then `LINEAR_API_KEY`.
|
|
64
|
+
- The composer attachment always uses the default key.
|
|
38
65
|
|
|
39
66
|
## Use
|
|
40
67
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
4. Send the message. The agent receives the issue text with your prompt.
|
|
68
|
+
### Browse issues
|
|
69
|
+
|
|
70
|
+
Open **Linear** from the sidebar, or run **Linear: Open issues** in the command center. In a workspace, run **Linear: Show issues in this workspace**, or type `/linear` in the composer. `/linear ENG-123` opens that issue, and `/linear <text>` searches.
|
|
45
71
|
|
|
46
|
-
The
|
|
72
|
+
- The search box matches issue titles and descriptions. An identifier such as `ENG-123` shows that issue only.
|
|
73
|
+
- Filter by assignee (**Mine**, **Everyone**, **Unassigned**), by status (**Active**, **Backlog**, **Done**, **All**), and by team.
|
|
74
|
+
- The list groups issues by status and loads more as you scroll.
|
|
75
|
+
- If you map Linear teams to a project in **Settings → Plugins → Linear → Projects**, the panel starts with the first mapped team.
|
|
76
|
+
|
|
77
|
+
### Sort
|
|
78
|
+
|
|
79
|
+
Select the sort button in the filter row. The options are **Last updated**, **Newest**, **Priority**, **Due date**, and **Title**.
|
|
80
|
+
|
|
81
|
+
### Sub-issues
|
|
82
|
+
|
|
83
|
+
Select **Sub-issues** in the filter row to nest sub-issues under their parent. A sub-issue shows under its parent when the parent is in the list, even if their statuses differ. Select the chevron to collapse or expand a parent. A collapsed parent shows how many sub-issues it hides.
|
|
84
|
+
|
|
85
|
+
The issue header shows breadcrumbs: the team, the parent chain, then the issue, for example **Engineering › ENG-120 › ENG-123**. Select a parent to open it. A long chain folds its middle into **…**; select it to show all parents.
|
|
86
|
+
|
|
87
|
+
### Read and edit an issue
|
|
88
|
+
|
|
89
|
+
- Select the status, priority, or assignee chip to change it.
|
|
90
|
+
- Descriptions and comments show as Markdown: headings, lists, task lists, code, quotes, tables, and links.
|
|
91
|
+
- Select the pencil next to **Description** to edit it as Markdown. The plugin saves about one second after you stop typing, and when you leave the box. The line under the box shows **Saving…**, then **Saved to Linear**. If a save fails, it shows **Could not save** and a **Retry** button. **Done** (or Escape) closes the editor only after Linear accepts the text.
|
|
92
|
+
- Select a task list checkbox in the description to check or uncheck it. The plugin changes only that box in the Markdown and saves it to Linear. If the save fails, the issue reloads from Linear.
|
|
93
|
+
- Add a comment in the **Activity** section.
|
|
94
|
+
- The header buttons refresh the issue, copy its branch name, and open it in Linear.
|
|
95
|
+
- Select **New issue**, or run **Linear: Create issue**, to create an issue. Set the team, status, priority, assignee, title, and a Markdown description.
|
|
96
|
+
|
|
97
|
+
### Start an agent
|
|
98
|
+
|
|
99
|
+
Select **Start agent** or **Start review** in the issue view. The agent setup page opens in the panel or the screen. It works with or without a current workspace.
|
|
100
|
+
|
|
101
|
+
1. Edit the prompt in the prompt box if you want. The prompt follows the template and options until you edit it. Select **Reset prompt** to go back to the template.
|
|
102
|
+
2. Use the controls under the prompt box, as in the Paseo composer. They set the prompt template (Implement or Review), the model, the thinking level, and the mode. The thinking level shows when the model has levels, and the mode shows when the agent has modes.
|
|
103
|
+
- The model picker lists the providers first. Select a provider to see its models, or search to find models from all providers.
|
|
104
|
+
- Choosing a model from another provider also changes the agent, and resets the thinking level and mode to that agent's defaults.
|
|
105
|
+
3. Choose the **Project**. The default is the project of the current workspace. Without a workspace, it is the last project you used for the team, then a project mapped to the team.
|
|
106
|
+
4. Choose where the agent runs in **Run in**:
|
|
107
|
+
- **New worktree** on the issue branch.
|
|
108
|
+
- **Check out PR #N** for a review, when the issue links a GitHub pull request.
|
|
109
|
+
- **Check out issue branch** for a review.
|
|
110
|
+
- **Existing agent workspace** or **Implementation workspace**, when an agent already works on the issue.
|
|
111
|
+
- **This workspace**, or **Project folder** when you are not in a workspace of that project.
|
|
112
|
+
|
|
113
|
+
The worktree and checkout options show only for a Git project.
|
|
114
|
+
5. Set the options: **Include comments in the prompt**, **Move the issue to In Progress**, and **Assign the issue to me**. The last two show only for Implement, and only when they would change the issue.
|
|
115
|
+
6. Select **Start agent** or **Start review**.
|
|
116
|
+
|
|
117
|
+
The plugin starts the agent and then updates Linear. If the Linear update fails, the agent keeps running and a message shows the error. The agent's timeline gets a card that links to the issue. The issue view lists the agents started from it under **Agents on this issue**.
|
|
118
|
+
|
|
119
|
+
Set the default model, where agents run, the default options, and the Implement and Review templates in **Settings → Plugins → Linear → Prompts**. In **Projects**, add instructions and steps for a project, or append to or replace a template for that project.
|
|
120
|
+
|
|
121
|
+
### Attach an issue to a message
|
|
122
|
+
|
|
123
|
+
In the composer, open the attachment menu and choose **Attach Linear issue**. Type an identifier such as `ENG-123`, or words from a title. An empty search lists the 20 most recently updated issues. The agent gets the issue text with your message. The plugin takes this snapshot when you select the issue.
|
|
124
|
+
|
|
125
|
+
## Data and permissions
|
|
126
|
+
|
|
127
|
+
- **Your key stays on the daemon host.** When you save a key, the app sends it to the daemon once. The daemon never sends a key back to the app. The app gets only the last four characters, to show which key is in use. Only the daemon sends requests to `https://api.linear.app/graphql`.
|
|
128
|
+
- **Data sent to Linear:** queries for issues, teams, users, and comments, and the changes you make. When you start an agent with the options on, the plugin moves the issue to In Progress and assigns it to you.
|
|
129
|
+
- **Data sent to the agent provider:** the prompt. It holds the template text and an issue snapshot: identifier, title, URL, team, status, priority, assignee, project, labels, parent, description, sub-issues, and links. It holds comments only when **Include comments in the prompt** is on. It also holds the project instructions and steps from the Projects settings. An attached issue sends the identifier, title, URL, status, priority, assignee, project, labels, and description.
|
|
130
|
+
- **Cached results:** the daemon keeps up to 300 recent Linear responses in memory for up to 24 hours. It groups them by a hash of the key, so two keys never share results. The app shows saved results at once with **Showing saved results. Updating…** while it gets new data. An edit clears the cached lists and issues for that key. Saving or removing a key clears the whole cache. The cache is not written to disk, and a daemon restart clears it.
|
|
131
|
+
|
|
132
|
+
Linear errors, such as a rejected key or a rate limit, show in the panel or as a message.
|
|
47
133
|
|
|
48
134
|
## How it works
|
|
49
135
|
|
|
50
136
|
| File | Runtime | Role |
|
|
51
137
|
| --- | --- | --- |
|
|
52
|
-
| `
|
|
53
|
-
| `server
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
138
|
+
| `index.client.tsx` | App | Registers the Linear screen, the workspace panel, the Account, Prompts, and Projects settings, the command center items, the `/linear` command, the timeline card, and the composer attachment |
|
|
139
|
+
| `index.server.ts` | Daemon | Registers the settings and the RPC handlers |
|
|
140
|
+
| `client/browser.tsx` | App | Screen and panel: picks the key, then shows the list, the issue, or the agent setup page |
|
|
141
|
+
| `client/issue-list.tsx`, `client/issue-row.tsx`, `client/issue-tree.ts` | App | Search, filters, sort, rows, status groups, and sub-issue nesting |
|
|
142
|
+
| `client/issue-detail.tsx`, `client/issue-sections.tsx`, `client/breadcrumbs.tsx` | App | Issue view: properties, breadcrumbs, sub-issues, links, agents, and comments |
|
|
143
|
+
| `client/issue-description.tsx`, `client/autosave.ts` | App | Description editor, task list checkboxes, and debounced saves |
|
|
144
|
+
| `client/markdown.tsx` | App | Renders Markdown |
|
|
145
|
+
| `client/launch.tsx`, `client/launch-fields.tsx`, `client/launch-choices.ts`, `client/launch-plan.ts`, `client/agent-options.ts` | App | Agent setup page, Run in options, and agent start |
|
|
146
|
+
| `client/model-browser.tsx`, `client/provider-icon.tsx` | App | Model picker and provider icons |
|
|
147
|
+
| `client/create-issue.tsx`, `client/pickers.tsx` | App | New issue form and option pickers |
|
|
148
|
+
| `client/connect.tsx`, `client/settings-*.tsx` | App | Key form and settings screens |
|
|
149
|
+
| `client/queries.ts`, `client/store.ts`, `client/key-scope.tsx` | App | Data hooks with saved results, browser state, and the key in use |
|
|
150
|
+
| `client/compat.ts` | App | Registers the screen on Paseo 0.10 and on later releases |
|
|
151
|
+
| `client/timeline-card.tsx`, `client/ui.tsx`, `client/glyphs.tsx` | App | Timeline card, shared controls, and icons |
|
|
152
|
+
| `shared/linear.ts` | Both | RPC contracts and issue schemas |
|
|
153
|
+
| `shared/issues.ts` | Both | The `issues.search` RPC and the composer attachment source |
|
|
154
|
+
| `shared/settings.ts` | Both | Settings schema: templates, agent defaults, and project settings |
|
|
155
|
+
| `shared/prompts.ts` | Both | Default templates and the issue snapshot |
|
|
156
|
+
| `shared/markdown.ts` | Both | Markdown parser and task list toggle |
|
|
157
|
+
| `server/handlers.ts` | Daemon | RPC handlers, key lookup, and cache use |
|
|
158
|
+
| `server/credentials.ts` | Daemon | Key file and key order |
|
|
159
|
+
| `server/cache.ts` | Daemon | Response cache in memory |
|
|
160
|
+
| `server/graphql.ts`, `server/queries.ts` | Daemon | Linear GraphQL client, queries, and changes |
|
|
161
|
+
| `server/linear.ts` | Daemon | Search and snapshot text for the composer attachment |
|
|
57
162
|
|
|
58
163
|
The client bundle holds no credentials and makes no calls to Linear.
|
|
59
164
|
|
|
@@ -69,7 +174,7 @@ npm run check
|
|
|
69
174
|
paseo plugin add "$PWD"
|
|
70
175
|
```
|
|
71
176
|
|
|
72
|
-
After you edit the source, run `paseo plugin reload linear`. `npm run check` runs the typecheck
|
|
177
|
+
After you edit the source, run `paseo plugin reload linear`. `npm run check` runs the typecheck and the tests. The tests cover the Linear client, the key file, the cache, the handlers, sub-issue nesting, the Markdown parser and task list toggle, the description autosave, the agent options, and the release scripts. They use a local GraphQL server and do not call Linear.
|
|
73
178
|
|
|
74
179
|
## Graphics
|
|
75
180
|
|
|
@@ -79,7 +184,7 @@ After you edit the source, run `paseo plugin reload linear`. `npm run check` run
|
|
|
79
184
|
node docs/graphics/render.mjs
|
|
80
185
|
```
|
|
81
186
|
|
|
82
|
-
The script finds Playwright locally or in the global npm root. Set `PLAYWRIGHT_MODULE` to its entry file to choose another copy. The fonts are Instrument Sans and JetBrains Mono under the [SIL Open Font License](docs/graphics/fonts/OFL.txt). The mark is original and is not the Linear logo.
|
|
187
|
+
The script finds Playwright locally or in the global npm root. Set `PLAYWRIGHT_MODULE` to its entry file to choose another copy. It stops if the fonts do not load, if content leaves the frame or is cut off, or if an image is 900 KB or larger. The fonts are Instrument Sans and JetBrains Mono under the [SIL Open Font License](docs/graphics/fonts/OFL.txt). The line icons follow [Lucide](https://lucide.dev), which uses the ISC License. The mark is original and is not the Linear logo.
|
|
83
188
|
|
|
84
189
|
## Releases
|
|
85
190
|
|
|
@@ -98,6 +203,10 @@ The highest change since the last release sets the next version. For example, `f
|
|
|
98
203
|
|
|
99
204
|
Run `npm run release:dry-run` from a clean `main` checkout with all tags fetched to preview the next release. To complete a GitHub or npm publication that stopped after its tag was pushed, run the **Release** workflow again.
|
|
100
205
|
|
|
206
|
+
## Contributing
|
|
207
|
+
|
|
208
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup, checks, commit message rules, and how releases work.
|
|
209
|
+
|
|
101
210
|
## License
|
|
102
211
|
|
|
103
|
-
Apache License 2.0. The plugin
|
|
212
|
+
Apache License 2.0. The plugin started as the Linear example plugin (`plugin-examples/linear`) in [getpaseo/paseo](https://github.com/getpaseo/paseo). See [NOTICE](NOTICE).
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Turns the daemon's provider snapshot into Agent, Model, Effort, and Mode choices.
|
|
2
|
+
|
|
3
|
+
export interface Choice {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ModelChoice extends Choice {
|
|
9
|
+
description: string | null;
|
|
10
|
+
isDefault: boolean;
|
|
11
|
+
efforts: Choice[];
|
|
12
|
+
defaultEffortId: string | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ModeChoice extends Choice {
|
|
16
|
+
icon: string | null;
|
|
17
|
+
colorTier: string | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface AgentChoice extends Choice {
|
|
21
|
+
/** SVG markup for custom providers. Built-in providers have none. */
|
|
22
|
+
iconSvg: string | null;
|
|
23
|
+
models: ModelChoice[];
|
|
24
|
+
modes: ModeChoice[];
|
|
25
|
+
defaultModeId: string | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface ThinkingOption {
|
|
29
|
+
id: string;
|
|
30
|
+
label: string;
|
|
31
|
+
isDefault?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface SnapshotModel {
|
|
35
|
+
id: string;
|
|
36
|
+
label: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
isDefault?: boolean;
|
|
39
|
+
isSelectable?: boolean;
|
|
40
|
+
thinkingOptions?: readonly ThinkingOption[];
|
|
41
|
+
defaultThinkingOptionId?: string;
|
|
42
|
+
thinkingSet?: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface SnapshotEntry {
|
|
46
|
+
provider: string;
|
|
47
|
+
label?: string;
|
|
48
|
+
iconSvg?: string;
|
|
49
|
+
status: string;
|
|
50
|
+
enabled?: boolean;
|
|
51
|
+
models?: readonly SnapshotModel[];
|
|
52
|
+
modes?: readonly (Choice & { icon?: string; colorTier?: string })[];
|
|
53
|
+
defaultModeId?: string | null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ProviderSnapshot {
|
|
57
|
+
entries: readonly SnapshotEntry[];
|
|
58
|
+
compactSnapshot?: {
|
|
59
|
+
entries: readonly SnapshotEntry[];
|
|
60
|
+
thinkingSets: readonly { options: readonly ThinkingOption[]; defaultOptionId?: string }[];
|
|
61
|
+
} | null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// App connections get the compact catalog, where a model points into a shared list of efforts.
|
|
65
|
+
export function agentChoices(snapshot: ProviderSnapshot): AgentChoice[] {
|
|
66
|
+
const compact = snapshot.entries.length === 0 ? snapshot.compactSnapshot : null;
|
|
67
|
+
const entries = compact ? compact.entries : snapshot.entries;
|
|
68
|
+
return entries
|
|
69
|
+
.filter((entry) => entry.status === "ready" && entry.enabled !== false)
|
|
70
|
+
.map((entry) => ({
|
|
71
|
+
id: entry.provider,
|
|
72
|
+
label: entry.label ?? entry.provider,
|
|
73
|
+
iconSvg: entry.iconSvg ?? null,
|
|
74
|
+
models: (entry.models ?? [])
|
|
75
|
+
.filter((model) => model.isSelectable !== false)
|
|
76
|
+
.map((model) => {
|
|
77
|
+
const set =
|
|
78
|
+
model.thinkingSet === undefined ? null : compact?.thinkingSets[model.thinkingSet];
|
|
79
|
+
const options = set?.options ?? model.thinkingOptions ?? [];
|
|
80
|
+
const fallback = options.find((option) => option.isDefault)?.id ?? null;
|
|
81
|
+
return {
|
|
82
|
+
id: model.id,
|
|
83
|
+
label: model.label,
|
|
84
|
+
description: model.description ?? null,
|
|
85
|
+
isDefault: model.isDefault === true,
|
|
86
|
+
efforts: options.map(({ id, label }) => ({ id, label })),
|
|
87
|
+
defaultEffortId: model.defaultThinkingOptionId ?? set?.defaultOptionId ?? fallback,
|
|
88
|
+
};
|
|
89
|
+
}),
|
|
90
|
+
modes: (entry.modes ?? []).map(({ id, label, icon, colorTier }) => ({
|
|
91
|
+
id,
|
|
92
|
+
label,
|
|
93
|
+
icon: icon ?? null,
|
|
94
|
+
colorTier: colorTier ?? null,
|
|
95
|
+
})),
|
|
96
|
+
defaultModeId: entry.defaultModeId ?? null,
|
|
97
|
+
}))
|
|
98
|
+
.filter((entry) => entry.models.length > 0);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface AgentSelection {
|
|
102
|
+
agent: AgentChoice;
|
|
103
|
+
model: ModelChoice;
|
|
104
|
+
effort: Choice | null;
|
|
105
|
+
mode: ModeChoice | null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface AgentPicks {
|
|
109
|
+
agent: string | null;
|
|
110
|
+
model: string | null;
|
|
111
|
+
effort: string | null;
|
|
112
|
+
mode: string | null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** `configured` is the settings default in `provider/model` form. Empty uses the first agent. */
|
|
116
|
+
export function resolveAgent(
|
|
117
|
+
agents: readonly AgentChoice[],
|
|
118
|
+
picks: AgentPicks,
|
|
119
|
+
configured: string,
|
|
120
|
+
): AgentSelection | null {
|
|
121
|
+
const [configuredAgent, ...rest] = configured.split("/");
|
|
122
|
+
const configuredModel = rest.join("/");
|
|
123
|
+
const agent =
|
|
124
|
+
agents.find((entry) => entry.id === picks.agent) ??
|
|
125
|
+
agents.find((entry) => entry.id === configuredAgent) ??
|
|
126
|
+
agents[0];
|
|
127
|
+
if (!agent) return null;
|
|
128
|
+
const preferredModel = agent.id === configuredAgent ? configuredModel : null;
|
|
129
|
+
const model =
|
|
130
|
+
agent.models.find((entry) => entry.id === picks.model) ??
|
|
131
|
+
agent.models.find((entry) => entry.id === preferredModel) ??
|
|
132
|
+
agent.models.find((entry) => entry.isDefault) ??
|
|
133
|
+
agent.models[0];
|
|
134
|
+
if (!model) return null;
|
|
135
|
+
const effort =
|
|
136
|
+
model.efforts.find((entry) => entry.id === picks.effort) ??
|
|
137
|
+
model.efforts.find((entry) => entry.id === model.defaultEffortId) ??
|
|
138
|
+
null;
|
|
139
|
+
const mode =
|
|
140
|
+
agent.modes.find((entry) => entry.id === picks.mode) ??
|
|
141
|
+
agent.modes.find((entry) => entry.id === agent.defaultModeId) ??
|
|
142
|
+
null;
|
|
143
|
+
return { agent, model, effort, mode };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Config for `agents.create`. Ids come from the selection, so they always fit the model. */
|
|
147
|
+
export function agentConfig(selection: AgentSelection) {
|
|
148
|
+
return {
|
|
149
|
+
provider: `${selection.agent.id}/${selection.model.id}`,
|
|
150
|
+
...(selection.effort ? { thinkingOptionId: selection.effort.id } : {}),
|
|
151
|
+
...(selection.mode ? { modeId: selection.mode.id } : {}),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ModelMatch {
|
|
156
|
+
agent: AgentChoice;
|
|
157
|
+
model: ModelChoice;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Models whose name, id, description, or agent name contain every word of the query. */
|
|
161
|
+
export function searchModels(agents: readonly AgentChoice[], query: string): ModelMatch[] {
|
|
162
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
163
|
+
if (words.length === 0) return [];
|
|
164
|
+
return agents.flatMap((agent) =>
|
|
165
|
+
agent.models
|
|
166
|
+
.filter((model) => {
|
|
167
|
+
const text = [model.label, model.id, model.description ?? "", agent.label]
|
|
168
|
+
.join(" ")
|
|
169
|
+
.toLowerCase();
|
|
170
|
+
return words.every((word) => text.includes(word));
|
|
171
|
+
})
|
|
172
|
+
.map((model) => ({ agent, model })),
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const MODE_ICONS = new Set([
|
|
177
|
+
"Bot",
|
|
178
|
+
"Shield",
|
|
179
|
+
"ShieldAlert",
|
|
180
|
+
"ShieldCheck",
|
|
181
|
+
"ShieldEllipsis",
|
|
182
|
+
"ShieldOff",
|
|
183
|
+
"ShieldPlus",
|
|
184
|
+
"ShieldQuestionMark",
|
|
185
|
+
]);
|
|
186
|
+
|
|
187
|
+
/** The Lucide icon Paseo shows for a mode. */
|
|
188
|
+
export function modeIcon(mode: ModeChoice): string {
|
|
189
|
+
const icon = mode.icon ?? "ShieldCheck";
|
|
190
|
+
return MODE_ICONS.has(icon) ? icon : "Bot";
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function sentenceCase(text: string): string {
|
|
194
|
+
return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Effort and mode names as Paseo writes them, for example "Extra high". */
|
|
198
|
+
export function optionLabel(option: Choice): string {
|
|
199
|
+
return option.id === "xhigh" ? "Extra high" : sentenceCase(option.label);
|
|
200
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Debounced, single-flight saving for one text value. Pure so the tests can drive it
|
|
2
|
+
// with fake timers. Only the latest value is kept, and one save runs at a time, so
|
|
3
|
+
// saves always reach the server in edit order.
|
|
4
|
+
|
|
5
|
+
export type SaveStatus = "idle" | "pending" | "saving" | "saved" | "error";
|
|
6
|
+
|
|
7
|
+
export interface AutosaveOptions {
|
|
8
|
+
delayMs: number;
|
|
9
|
+
save(value: string): Promise<void>;
|
|
10
|
+
onStatus(status: SaveStatus, error?: unknown): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface Autosave {
|
|
14
|
+
/** Queues `value` and saves it after `delayMs` (or the given delay) without changes. */
|
|
15
|
+
schedule(value: string, delayMs?: number): void;
|
|
16
|
+
/** Saves the queued value now. Resolves when nothing is left to save. */
|
|
17
|
+
flush(): Promise<void>;
|
|
18
|
+
/** Drops the queued value. A save in flight still finishes. */
|
|
19
|
+
cancel(): void;
|
|
20
|
+
/** True while a value is queued or saving. */
|
|
21
|
+
busy(): boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function createAutosave(options: AutosaveOptions): Autosave {
|
|
25
|
+
let queued: string | null = null;
|
|
26
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
27
|
+
let inFlight: Promise<void> | null = null;
|
|
28
|
+
|
|
29
|
+
function clearTimer() {
|
|
30
|
+
if (timer !== null) clearTimeout(timer);
|
|
31
|
+
timer = null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Starts the next save unless one is running. Rejects with the save error.
|
|
35
|
+
function run(): Promise<void> {
|
|
36
|
+
clearTimer();
|
|
37
|
+
if (inFlight) return inFlight.then(() => (queued === null ? undefined : run()));
|
|
38
|
+
if (queued === null) return Promise.resolve();
|
|
39
|
+
const value = queued;
|
|
40
|
+
queued = null;
|
|
41
|
+
options.onStatus("saving");
|
|
42
|
+
inFlight = options.save(value).then(
|
|
43
|
+
() => {
|
|
44
|
+
inFlight = null;
|
|
45
|
+
if (queued === null) options.onStatus(timer === null ? "saved" : "pending");
|
|
46
|
+
else if (timer === null) return run();
|
|
47
|
+
},
|
|
48
|
+
(error: unknown) => {
|
|
49
|
+
inFlight = null;
|
|
50
|
+
// Keep the failed value for a retry unless a newer edit replaced it.
|
|
51
|
+
if (queued === null) queued = value;
|
|
52
|
+
if (timer === null) options.onStatus("error", error);
|
|
53
|
+
throw error;
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
return inFlight;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function background() {
|
|
60
|
+
run().catch(() => undefined);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
schedule(value, delayMs = options.delayMs) {
|
|
65
|
+
queued = value;
|
|
66
|
+
clearTimer();
|
|
67
|
+
options.onStatus("pending");
|
|
68
|
+
timer = setTimeout(background, delayMs);
|
|
69
|
+
},
|
|
70
|
+
flush: run,
|
|
71
|
+
cancel() {
|
|
72
|
+
clearTimer();
|
|
73
|
+
queued = null;
|
|
74
|
+
},
|
|
75
|
+
busy: () => queued !== null || inFlight !== null,
|
|
76
|
+
};
|
|
77
|
+
}
|