dsh-jira-work-overview 0.16.5 → 0.16.7
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 +44 -0
- package/README.md +36 -13
- package/README.zh.md +40 -17
- package/client.js +166 -26
- package/index.js +58 -15
- package/package.json +1 -1
- package/test/README.md +2 -1
- package/test/dsh-jira-i18n.mjs +3 -2
- package/test/dsh-jira-plan.mjs +103 -7
- package/test/dsh-jira-resume.mjs +401 -0
- package/test/dsh-jira-search.mjs +49 -5
- package/test/run-offline.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,50 @@ All notable changes to **dsh-jira-work-overview** are documented here.
|
|
|
4
4
|
|
|
5
5
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The first 25 releases were built in a single day, so the dates are real but the cadence was not: each entry lists what changed, not how long it took.
|
|
6
6
|
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.16.7] - 2026-12-01
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **长时间挂起 / Mac 合盖后再打开,面板列表停在旧数据上(角标却在动)。** 列表只在「首次打开 /
|
|
14
|
+
显式操作 / watch 发现变化」时重拉,而 watch 的自动刷新还要求「之前已经有未读」(`before > 0`),
|
|
15
|
+
清过角标后的第一条变化不会刷新列表;入口按钮打开时看到已有数据也直接显示,不做任何重拉。于是
|
|
16
|
+
新任务能进未读角标、能弹系统通知,列表却只能手动点「刷新」。
|
|
17
|
+
现在:① 打开面板 / 窗口从隐藏或睡眠恢复(`visibilitychange` / `focus` / `pageshow`)时,载荷超过
|
|
18
|
+
60 秒或还有未读变化就重拉;② 面板开着时 watch 一出现新变化就重拉(不再要求之前已有未读);
|
|
19
|
+
③ watch 长轮询加了客户端超时(40 秒),睡眠里断掉的请求会被主动 abort 并重连,醒来后角标不会卡死。
|
|
20
|
+
新增离线套件 `test/dsh-jira-resume.mjs` 覆盖这几条(含「关闭 2 分钟后重开能看到新任务」)。
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **面板每次加载少打 3 个 Jira 请求。** 面板固定 `--limit=0` 把结果翻到底,原来还要再打两次
|
|
25
|
+
`approximate-count`(总数 + 每个项目的总数)和一次 `GET /rest/agile/1.0/board/{id}/sprint`——串行排在
|
|
26
|
+
翻页后面。现在翻页到底时总数与项目数直接用已取回的条目本地统计,count 只在被 `--limit=` /
|
|
27
|
+
5000 条安全上限 / `timeoutMs` 截断时才打;活跃迭代的请求提前到与翻页并行。实测(本机到站点,
|
|
28
|
+
350 条 4 页)请求数 7 → 4,面板整条路径耗时约 -35%(桩基准 819ms → 516ms @100ms/请求)。
|
|
29
|
+
- **首屏先画第一页,剩下的在后台补。** 面板在「还没有数据」时打开会先发一次 `--limit=100 --preview`
|
|
30
|
+
(host 只取一页、不查 `approximate-count`、不查活跃迭代,约 1 个往返),先把这 100 行画出来,
|
|
31
|
+
随后再拉全量替换——等待时不再是空面板转圈,而是「先读着,数字和后面的行随后补齐」。
|
|
32
|
+
`--preview` 载荷里 `total` / `projectTotals` 为 `null`、`hasMore` 恒为 `true`,界面等全量那份再显示数字;
|
|
33
|
+
首屏失败不影响最终结果(全量那份给出真正的错误)。
|
|
34
|
+
|
|
35
|
+
## [0.16.6] - 2026-11-26
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
|
|
39
|
+
- **「计划」不再要求项目先绑定工作区。** 以前项目没挂工作区时点「计划」只报一句「项目还没有绑定工作区」,
|
|
40
|
+
一条会话都不建;现在落点按一条顺序判定:项目已绑定的工作区 → 基座的**默认工作区**
|
|
41
|
+
(`workspaces.initializeDefault()`,与侧栏第一次用时初始化的是同一个),只有连默认工作区都取不到
|
|
42
|
+
(老基座没有工作区服务 / 调用失败)才报错并说明缺什么。host 侧(`createPlanSession`)同样兜底,
|
|
43
|
+
客户端与 host 的中英文案同步改。
|
|
44
|
+
为什么不能只删那句报错:DSH 的 `session.create` 在既无 `workspaceId` 又无 `cwd` 时用的是**基座的
|
|
45
|
+
`defaultCwd`**,不是默认工作区,所以两边都必须显式解析出默认工作区的 id。
|
|
46
|
+
|
|
47
|
+
- **README 把「计划」的落点写清楚了。** 中英两份都新增「落在哪个工作区」的判定顺序、两种落点分别长什么样、
|
|
48
|
+
怎么把已经生成的计划对话挪进项目工作区(先关联、再点 `×` 归档、重新点「计划」),错误表补了
|
|
49
|
+
「计划会话进了 `default-workspace`」一行;`test/README.md` 的套件说明同步。
|
|
50
|
+
|
|
7
51
|
## [0.16.5] - 2026-11-24
|
|
8
52
|
|
|
9
53
|
### Added
|
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ Show **your** Jira work items — with their real workflow status — inside [De
|
|
|
38
38
|
DSH installs plugins from an **installation spec** — anything `pnpm add` accepts (registry package name, git URL, tarball, absolute path). Pick one:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
# 1) from the npm registry (published since 0.14.0; pin a version with @0.16.
|
|
41
|
+
# 1) from the npm registry (published since 0.14.0; pin a version with @0.16.7)
|
|
42
42
|
plugin_manager install_bundle(target="dsh-jira-work-overview")
|
|
43
43
|
|
|
44
44
|
# 2) straight from GitHub (no npm publishing needed)
|
|
@@ -94,18 +94,21 @@ Prefer files? Add an override row to your profile's `cordis.patch.yml` (this is
|
|
|
94
94
|
- **Search**: the header magnifier expands in place into a field that slides out to the left; type a keyword or an issue key and press **Enter**. The query runs against all of Jira (not only your issues); matches are grouped by sprint like your own list, with the same project tabs / status filter / total. Losing focus (or **Esc**) collapses the field back to the button and keeps an unsubmitted draft; a submitted query clears the field and keeps the results, and `×` clears the search to return to your work.
|
|
95
95
|
|
|
96
96
|
<img src="docs/images/panel-search.png" width="1040" alt="A search for 'checkout' inside the panel: the header field is open, the subtitle reads 'Search: checkout 4 items', and the hits are grouped by sprint with their epic line and the same filters as the work list">
|
|
97
|
-
- The
|
|
97
|
+
- **The first page paints first**: opening the panel with no data at hand fetches page 1 (`--preview`: one round trip, no counts, no sprint lookup) and draws those rows, then the full load replaces them in the background — you read the list while the rest arrives.
|
|
98
|
+
- The header shows the **accurate total** for the current project + status: when pagination runs to the end it is the fetched row count (no extra request); only a truncated fetch (`--limit=`, the 5000-item safety net or `timeoutMs`) asks Jira's `approximate-count`.
|
|
98
99
|
- Click a **status chip** on any row to move the issue; the list reloads. **Esc** closes the top-most layer (status menu → configure dialog → panel).
|
|
99
100
|
- The list is **virtualized**: thousands of rows scroll smoothly because only the visible ones are in the DOM.
|
|
100
101
|
- **Plan at the end of a row** (the `☰ 计划` chip) opens a *planning* conversation for that issue in the
|
|
101
|
-
workspace the project is linked to
|
|
102
|
+
workspace the project is linked to (or in DSH's default Workspace when it is not linked): the new session
|
|
103
|
+
switches to plan mode, receives the issue key, title, status and link, and is told
|
|
102
104
|
to report **only the list of changes it intends to make** — no explanations, no analysis. You approve or amend
|
|
103
105
|
the plan in that conversation, and nothing is executed before you do. If the issue is too thin to plan (no
|
|
104
106
|
description, no parent and no links), the session stops instead of guessing and tells you the Jira issue is
|
|
105
107
|
unclear. One issue maps to one planning session: once bound the chip is highlighted, clicking it reopens the
|
|
106
108
|
existing conversation (the binding lives in the volatile `planSessions` config as `ISSUE<TAB>sessionId`, and a
|
|
107
|
-
lost binding is recovered from the `JIRA_PLAN_SESSION:<KEY>` marker in the session's first message).
|
|
108
|
-
|
|
109
|
+
lost binding is recovered from the `JIRA_PLAN_SESSION:<KEY>` marker in the session's first message). Only
|
|
110
|
+
when neither the project mapping nor DSH's default Workspace can be resolved does the button report what is
|
|
111
|
+
missing; if the profile ships
|
|
109
112
|
`deepseek-ai/dsh-plan-mode`, its `section` is the planning policy, and without it the first message carries a
|
|
110
113
|
built-in one ("plan only, list the changes, execute once the user agrees").
|
|
111
114
|
A planned row also carries a `×`: it archives that conversation through DSH's own workspace archive
|
|
@@ -113,10 +116,24 @@ Prefer files? Add an override row to your profile's `cordis.patch.yml` (this is
|
|
|
113
116
|
unplanned again and the next click starts a fresh session. Archiving keeps the log — a mis-click is
|
|
114
117
|
recoverable from the archive.
|
|
115
118
|
|
|
116
|
-
### Planning:
|
|
119
|
+
### Planning: click `☰ Plan`
|
|
117
120
|
|
|
118
|
-
The `☰ Plan` chip
|
|
119
|
-
|
|
121
|
+
The `☰ Plan` chip at the end of a row creates a **planning-mode conversation** for that issue: the new session
|
|
122
|
+
switches to plan mode, receives the issue key / title / status / link, and is told to report **only the list of
|
|
123
|
+
changes it intends to make** — no explanations, no background, no analysis. You approve or amend the plan in
|
|
124
|
+
that conversation, and nothing is executed before you do. If the card is too thin to plan (no summary, no
|
|
125
|
+
description, no parent and no links), the session stops and says the Jira issue is unclear instead of guessing.
|
|
126
|
+
|
|
127
|
+
**Where the conversation lands** is decided in one place, in this order:
|
|
128
|
+
|
|
129
|
+
1. the workspace the project is linked to (sidebar → *Link Jira project…*), when there is one;
|
|
130
|
+
2. otherwise DSH's **default Workspace** — the same one the sidebar initializes on first use — so an unlinked
|
|
131
|
+
project is no longer a dead end.
|
|
132
|
+
|
|
133
|
+
Either way the session appears in the sidebar immediately and the main view switches to it. A planned row
|
|
134
|
+
always reopens its existing conversation rather than creating a second one, so to file it under a project
|
|
135
|
+
workspace: link the project first, archive the old conversation with `×`, then click *Plan* again. Linking a
|
|
136
|
+
workspace to a project is a one-time four-step job:
|
|
120
137
|
|
|
121
138
|
<img src="docs/images/plan-flow.png" width="1040" alt="Four steps: (1) right-click the workspace row and pick 'Link Jira project…', (2) the panel opens by itself — click the dashed project tab to link it, (3) click the '☰ Plan' chip on a row, (4) back in the panel the chip turns blue and hovering the row shows a ×">
|
|
122
139
|
|
|
@@ -127,9 +144,10 @@ miss. Four steps, and from then on every card is one click away from a planning
|
|
|
127
144
|
to the current workspace." Candidate tabs carry a **dashed** outline — click one to link it; the header then
|
|
128
145
|
reads "This workspace is linked to APP". Candidates appear only after the panel has fetched issues once, so
|
|
129
146
|
hit *Refresh* if there are none.
|
|
130
|
-
3. **Click the `☰ Plan` chip at the end of a row**: creates a planning-mode session in that project's
|
|
131
|
-
|
|
132
|
-
|
|
147
|
+
3. **Click the `☰ Plan` chip at the end of a row**: creates a planning-mode session in that project's
|
|
148
|
+
workspace — or in DSH's default Workspace when the project is not linked. The first message only asks for a
|
|
149
|
+
bullet list of the edits to make, and you agree to it in the conversation. `deepseek-ai/dsh-plan-mode` is
|
|
150
|
+
optional — a built-in policy is used when it is absent.
|
|
133
151
|
4. **Back in the panel**: the chip turns blue (`on`) = planned. Hovering the row reveals a `×` that archives the
|
|
134
152
|
session and clears the binding (recoverable from the archive).
|
|
135
153
|
|
|
@@ -141,8 +159,9 @@ The real panel, for comparison (the two planned rows near the top are outlined):
|
|
|
141
159
|
|
|
142
160
|
| What you see | Why | What to do |
|
|
143
161
|
| --- | --- | --- |
|
|
144
|
-
| `Project APP is not linked to a workspace: link it from the sidebar first.` |
|
|
162
|
+
| `Project APP is not linked to a workspace and no default Workspace could be resolved: link it from the sidebar first.` | Neither the project mapping nor DSH's default Workspace could be resolved (workspace service unavailable / older DSH build) | Redo steps 1–2 above, or install a DSH build that provides the workspace service |
|
|
145
163
|
| No candidate tabs / `No projects to link yet: open the panel once so the project list loads.` | The panel has never fetched issues successfully | Hit *Refresh*; if it still fails, set the site / email / token first |
|
|
164
|
+
| The planning conversation sits under *default-workspace*, not the project workspace | The project was not linked to a workspace when you clicked *Plan*, so it fell back to DSH's default Workspace | Link the project, archive the row with `×`, then click *Plan* again |
|
|
146
165
|
| The workspace context menu has no *Link Jira project…* | The client half of the plugin did not register (the host row can still read active) | Reinstall the bundle and reload the page |
|
|
147
166
|
| The chip stays grey and does nothing | The previous session creation has not returned yet | Wait for it; a failure shows `Could not create the planning session: …` |
|
|
148
167
|
| It always reopens the same conversation | One issue maps to one planning session (by design) | Click `×` to archive it, then click *Plan* again |
|
|
@@ -182,6 +201,8 @@ The host polls `assignee = currentUser() AND statusCategory != Done` every `watc
|
|
|
182
201
|
|
|
183
202
|
A status **you** changed — from the panel dropdown or `jira_transition` — is not news: the write records the expected `from → to` and the next poll silently advances its baseline instead of raising a notification, an unread badge or a banner entry. The match is on that exact pair, so a colleague changing the same issue to something else still notifies. Notifications use `osascript` on macOS, a PowerShell Toast on Windows, and `notify-send` elsewhere — silently degrading if the platform refuses.
|
|
184
203
|
|
|
204
|
+
The list also re-fetches when it may be stale: opening the panel after it has been closed for more than a minute (or while an unread change is pending), and returning to a visible window after sleep / hiding (`visibilitychange` / `focus` / `pageshow`). The badge moving no longer leaves the list behind, and the long poll has a client-side timeout so a request killed by sleep reconnects instead of freezing the badge.
|
|
205
|
+
|
|
185
206
|
## Configuration reference
|
|
186
207
|
|
|
187
208
|
| Key | Default | Meaning |
|
|
@@ -249,7 +270,7 @@ Behind a corporate proxy on Windows, DSH needs the proxy env vars it was started
|
|
|
249
270
|
|
|
250
271
|
## Versions and upgrades
|
|
251
272
|
|
|
252
|
-
The current version is **0.16.
|
|
273
|
+
The current version is **0.16.7** (2026-12-01). The changelog records 41 versions (from 0.1.0); GitHub carries **16 tags / releases** (0.13.0 → 0.16.7), and **0.13.4 was the first public release** — the earlier 0.1.0–0.12.0 exist only in `CHANGELOG.md` and the project notes, with no commit or tag behind them, so "an older version" means **0.13.0 or later**. Every release is described in [CHANGELOG.md](CHANGELOG.md).
|
|
253
274
|
|
|
254
275
|
### Why people still install older versions
|
|
255
276
|
|
|
@@ -290,6 +311,8 @@ The current version is **0.16.5** (2026-11-24). The changelog records 39 version
|
|
|
290
311
|
| 0.16.3 | 2026-11-23 | **fix** | the Jira site URL is now an editable field in the config page (placeholder = current URL, saved to the profile Cordis patch); the failure hint's **Configure** button matches **Save and verify** |
|
|
291
312
|
| 0.16.4 | 2026-11-23 | **fix** | on a fresh profile, filling email + token + site URL and clicking only **Save & verify** left the URL unsaved, so the panel always said there was no site URL; the panel now also reloads automatically after a successful save |
|
|
292
313
|
| 0.16.5 | 2026-11-24 | feature | **nothing configured shows a form, not an error**: the panel body is the Connect Jira form (site URL / email / API token) in the old failure slot, saved fields can stay empty, and the list reloads once Jira accepts the pair |
|
|
314
|
+
| 0.16.6 | 2026-11-26 | feature | **`☰ Plan` works on an unlinked project too**: the planning conversation lands in the project's workspace when there is one and in DSH's default Workspace otherwise (resolved through `workspaces.initializeDefault()` client-side and `workspaceController.initializeDefault()` host-side); only when neither resolves does it fail, with copy that says so |
|
|
315
|
+
| 0.16.7 | 2026-12-01 | **fix + perf** | after a long suspend / lid close the panel kept showing the old list (resume + watch refresh, new `test/dsh-jira-resume.mjs`); the panel path now makes 3 fewer Jira requests (local totals, sprint lookup in parallel); **the first page paints first**, the full load replaces it in the background |
|
|
293
316
|
|
|
294
317
|
> 0.1.0–0.12.0 all happened on 2026-11-18; tags and GitHub Releases start at 0.13.0.
|
|
295
318
|
> To install an older version: `plugin_manager install_bundle(target="github:EagleSoap/dsh-jira-work-overview#v0.13.2")`, or pin the npm version with `target="dsh-jira-work-overview@0.14.0"` (the earliest version on npm is 0.14.0).
|
package/README.zh.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
DSH 用**安装 spec** 装插件 —— 凡是 `pnpm add` 能吃的写法都行(registry 包名、git 地址、tarball、绝对路径)。选一个:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
# 1) 从 npm 装(0.14.0 起已发布;要钉版本就在后面写 @0.16.
|
|
24
|
+
# 1) 从 npm 装(0.14.0 起已发布;要钉版本就在后面写 @0.16.7)
|
|
25
25
|
plugin_manager install_bundle(target="dsh-jira-work-overview")
|
|
26
26
|
|
|
27
27
|
# 2) 直接从 GitHub 装(不需要 npm 发布)
|
|
@@ -97,20 +97,30 @@ all : assignee = currentUser() ORDER BY updated DESC
|
|
|
97
97
|
不会出现「慢请求晚到、把新列表盖回旧范围」的闪烁;等待期间旧列表留在原位并压暗到 55%(`.jmw-body.pending`),
|
|
98
98
|
新数据到达时原子替换。注意 `abort()` 只能中断「等结果」,Host 侧已经发出的 Jira 查询无法撤回。
|
|
99
99
|
|
|
100
|
-
###
|
|
100
|
+
### 计划会话:点「计划」→ 敲定计划
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
**任务行末尾的「计划」按钮**会为这张卡新建一条 **plan 模式会话**:新会话切到 plan 模式,收到任务键、
|
|
103
|
+
标题、状态与链接,只被要求「按点列出将要执行的修改任务」——不写解释、背景或分析。计划由你在对话里敲定
|
|
104
|
+
或修改,确认之前它不会执行任何东西。这张卡信息不全(没标题 / 没描述 / 没父任务与关联)时,它会**中断**
|
|
105
|
+
并提示「Jira 任务不明确,无法进行任务」,同时列出缺什么,不会硬猜着往下做。
|
|
106
|
+
|
|
107
|
+
**落在哪个工作区**只有一条判定顺序:
|
|
108
|
+
|
|
109
|
+
1. 项目已经绑定的工作区(左侧栏工作区那一行右键 →「关联 Jira 项目…」);
|
|
110
|
+
2. 没绑(第一次用 / 映射丢了)就落在 DSH 的**默认工作区**——与侧栏第一次用时初始化的是同一个,
|
|
111
|
+
不会因为「还没关联」就把按钮堵死。
|
|
112
|
+
|
|
113
|
+
两种情况新建的会话都会立刻出现在左侧栏、并当场切到主视图。一条任务**只对应一条**计划对话:已计划的行
|
|
114
|
+
再点只打开原来那条,所以想把计划会话挪进项目工作区,先关联项目,再点 `×` 归档旧的那条、重新点「计划」。
|
|
115
|
+
关联一次只要四步(图解见下)。
|
|
116
|
+
|
|
117
|
+
#### 一条任务一条对话
|
|
106
118
|
|
|
107
119
|
建会话用的是 DSH 自己的会话服务(`sessions.create`),所以新会话会立刻出现在侧栏、并当场切到主视图;
|
|
108
120
|
`/plan` 与首条消息都按聊天框同一条路发(命令先、消息后),计划对话里的节奏和你在聊天框里开一条新会话一样。
|
|
109
|
-
一条任务**只对应一条**计划对话:已经计划过的任务按钮标成 `on`,再点只打开原来那条,不会又开一条。
|
|
110
121
|
绑定存在插件的 volatile 配置 `planSessions` 里(一行一条 `ISSUE<TAB>sessionId`);即使换了浏览器、
|
|
111
122
|
清过配置,HOST 也会按计划对话首条消息里的 `JIRA_PLAN_SESSION:<KEY>` 标记翻会话日志把它找回来。
|
|
112
|
-
|
|
113
|
-
第一次用请照下面「四步操作」走一遍。
|
|
123
|
+
只有连默认工作区都取不到(老基座没有工作区服务)时才报错,不会建出半成品会话。
|
|
114
124
|
profile 里装了 `deepseek-ai/dsh-plan-mode` 就用它的 `section` 当规划口径;没装也不影响使用——
|
|
115
125
|
首条消息会自带一份「只做规划、只列修改任务、敲定后再执行」的兜底口径。
|
|
116
126
|
|
|
@@ -118,8 +128,8 @@ profile 里装了 `deepseek-ai/dsh-plan-mode` 就用它的 `section` 当规划
|
|
|
118
128
|
(依次尝试 `remote.workspace.archiveSession` / 工作区注册表 `workspaceRegistry.archiveSession` / `connection.call('workspace/archiveSession')`,与侧栏右键「归档」是同一处状态)把那条会话收进归档区,同时清掉绑定;
|
|
119
129
|
归档后这一行回到未计划状态,再点「计划」是新建一条。归档不删日志,误删可以从归档区恢复。
|
|
120
130
|
|
|
121
|
-
**四步操作(图解)**:入口是任务行末尾的「☰
|
|
122
|
-
|
|
131
|
+
**四步操作(图解)**:入口是任务行末尾的「☰ 计划」;想让计划对话落进某个项目的工作区,就先关联一次
|
|
132
|
+
(不关联也能用,落在默认工作区)。四步走完,之后每张卡都能一键开计划对话:
|
|
123
133
|
|
|
124
134
|
<img src="docs/images/plan-flow.zh.png" width="1040" alt="四步图解:① 左侧栏工作区右键选「关联 Jira 项目…」② 面板自动打开,点带虚线框的项目 tab 完成关联 ③ 任务行末尾点「☰ 计划」④ 回到面板按钮变蓝=已计划,行尾出现 ×">
|
|
125
135
|
|
|
@@ -128,7 +138,7 @@ profile 里装了 `deepseek-ai/dsh-plan-mode` 就用它的 `section` 当规划
|
|
|
128
138
|
2. **点项目 tab 完成关联**:菜单点完面板会自动打开,顶部提示「点上面的项目 tab,把它关联到当前工作区。」,
|
|
129
139
|
候选 tab 带**虚线框**,点哪个就把哪个挂上去;成功后面板顶部变成「当前工作区已关联 APP」。
|
|
130
140
|
候选 tab 要等面板至少拉到过一次 issue 才会出现——一个候选都没有时先点「刷新」。
|
|
131
|
-
3. **点任务行末尾的「☰
|
|
141
|
+
3. **点任务行末尾的「☰ 计划」**:在该项目绑定的工作区里(没绑定就落在默认工作区)新建一条 plan 模式会话,
|
|
132
142
|
首条消息只要求它「按点列出将要执行的修改任务」,由你在对话里敲定;没装 `deepseek-ai/dsh-plan-mode`
|
|
133
143
|
也能用(首条消息自带兜底口径)。
|
|
134
144
|
4. **回到面板看状态**:这一行的按钮变蓝(`on`)=已计划;鼠标移到行上,按钮旁出现 `×`,
|
|
@@ -142,8 +152,9 @@ profile 里装了 `deepseek-ai/dsh-plan-mode` 就用它的 `section` 当规划
|
|
|
142
152
|
|
|
143
153
|
| 看到什么 | 原因 | 怎么办 |
|
|
144
154
|
| --- | --- | --- |
|
|
145
|
-
| `项目 APP
|
|
155
|
+
| `项目 APP 没有绑定工作区,也取不到基座的默认工作区:先在左侧侧栏里把项目挂到工作区。` | 项目映射与基座的默认工作区都取不到(工作区服务不可用 / 老版本基座) | 按上面第 1–2 步重新关联,或升级到提供工作区服务的 DSH 版本 |
|
|
146
156
|
| 一个候选 tab 都没有 / `没有可关联的项目:面板里先拉到过 issue 才会出现项目候选。` | 面板还没成功拉到过数据 | 先点「刷新」,必要时先在配置里补站点 / 邮箱 / 令牌 |
|
|
157
|
+
| 计划会话进了 `default-workspace`,不在项目工作区里 | 点「计划」时这个项目还没绑定工作区,落到了 DSH 的默认工作区 | 先关联项目,再点 `×` 归档这条,重新点「计划」 |
|
|
147
158
|
| 工作区右键菜单里没有「关联 Jira 项目…」 | 客户端的插件模块没注册上(host 行显示 active 也可能如此) | 重新装插件包并刷新页面 |
|
|
148
159
|
| 按钮一直是灰的,点不动 | 上一次建会话还没返回 | 等它结束;失败会显示 `创建计划对话失败:…` |
|
|
149
160
|
| 打开的总是同一条对话 | 一个任务只对应一条计划对话(设计如此) | 想重开就先点 `×` 归档,再点「计划」 |
|
|
@@ -248,11 +259,17 @@ profile 里装了 `deepseek-ai/dsh-plan-mode` 就用它的 `section` 当规划
|
|
|
248
259
|
- 上一版(0.11.0)的「渐进式渲染」(`RENDER_FIRST = 80` / `RENDER_STEP = 120` / 「正在渲染 N / M 行」)**已整套删除**,
|
|
249
260
|
换筛选 / 换 tab / 刷新后不会再有「分批画」的残留状态,滚动位置在切筛选、换 tab、刷新时重置到顶部。
|
|
250
261
|
|
|
262
|
+
### 首屏先画第一页
|
|
263
|
+
|
|
264
|
+
- 还没有数据时打开面板,会先请求第一页(`--limit=100 --preview`:host 只取一页,不查总数、不查活跃迭代,
|
|
265
|
+
约一个往返),先把这 100 行画出来;随后全量那份替换它——等待时不再是空面板转圈。
|
|
266
|
+
- 首屏那份的「共 N 项」暂时空着(`total` 为 `null`),等全量回来后补上;首屏失败不影响最终结果。
|
|
267
|
+
|
|
251
268
|
### 「共 N 项」是准确总数,不是页内条数
|
|
252
269
|
|
|
253
|
-
- **标题下面**的副标题会显示「**共 N 项**」(有状态筛选时再拼一句「· 状态
|
|
254
|
-
|
|
255
|
-
|
|
270
|
+
- **标题下面**的副标题会显示「**共 N 项**」(有状态筛选时再拼一句「· 状态 <名字>」)。翻页**拉到底**时这个数字就是
|
|
271
|
+
已取回的条数(本地统计,不再多打请求);只有翻页被 `--limit=` / 5000 条安全上限 / `timeoutMs` **截断**时,才用 Jira 的
|
|
272
|
+
`POST /rest/api/3/search/approximate-count`(只回一个 `count`,不拉数据)补一个准确总数——两条路径都与「把结果全拉完」一致。
|
|
256
273
|
- 数字随**当前筛选与当前项目 tab** 变:选「全部项目」时是整个范围(含已完成)的总数;选了某个项目 tab 就显示该项目
|
|
257
274
|
在当前范围下的总数(每个项目一次 count,最多统计 8 个项目,超过就只给总数)。
|
|
258
275
|
- **拿不到就不显示**(当年查询失败、count 端点不可用时副标题里没有数字,只留状态筛选那半句),宁可空着也不给一个会跳的数。
|
|
@@ -272,6 +289,10 @@ Jira Cloud **没有**给第三方 issue 事件的 websocket / SSE 长连接(
|
|
|
272
289
|
同事把同一个 issue 改成别的状态照样通知;写失败会立刻撤掉这份期望,不会吞掉之后别人的真变化。
|
|
273
290
|
- **面板角标**:入口按钮右上角显示未读条数;面板顶部出现「N 项新变化」横幅(列出最近几条,
|
|
274
291
|
如 `APP-4018 In Review → IN QA`)和「标记已读」按钮;面板开着时又来新变化会自动刷新列表。
|
|
292
|
+
- **重新打开 / 从挂起恢复也会重拉**:Mac 合盖、把窗口藏起来很久再打开时,载荷超过 60 秒(或还有
|
|
293
|
+
未读变化)就先重拉一次;窗口重新可见(`visibilitychange` / `focus` / `pageshow`)同样按这个
|
|
294
|
+
新鲜度判断。不会再出现「角标在动、列表还是旧的、只能手动刷新」——长轮询只负责通知,列表自己
|
|
295
|
+
也要跟上。
|
|
275
296
|
- **通道**:Host 在 `ctx.get('connection').fetch` 上注册四条精确路由——`/api/jira-work-overview/state`
|
|
276
297
|
(GET = 状态,支持 `?wait=25000` 长轮询;POST = 标记已读)、`/api/jira-work-overview/transition`
|
|
277
298
|
(GET `?key=…` = 可用流转;POST `{key, transitionId}` = 改状态)、`/api/jira-work-overview/credential`
|
|
@@ -509,7 +530,7 @@ Zed(`zed`)、Sublime Text(`subl`)、gedit(`gedit`)——**找到可
|
|
|
509
530
|
|
|
510
531
|
## 版本与升级
|
|
511
532
|
|
|
512
|
-
当前版本 **0.16.
|
|
533
|
+
当前版本 **0.16.7**(2026-12-01)。`CHANGELOG.md` 记了 41 个版本(0.1.0 起),GitHub 上有 **16 个 tag / Release**(0.13.0 → 0.16.7),**0.13.4 是第一个公开版本**——更早的 0.1.0–0.12.0 只存在于 `CHANGELOG.md` 与项目记录里,没有对应的提交与 tag,所以「以前的版本」= **0.13.0 及以后**。逐版的完整说明见 [CHANGELOG.md](CHANGELOG.md)。
|
|
513
534
|
|
|
514
535
|
### 为什么有人还在装以前的版本
|
|
515
536
|
|
|
@@ -550,6 +571,8 @@ Zed(`zed`)、Sublime Text(`subl`)、gedit(`gedit`)——**找到可
|
|
|
550
571
|
| 0.16.3 | 2026-11-23 | **修复** | 配置页「Jira 连接」的服务地址改成可编辑输入框(placeholder = 当前地址,写进 profile 的 Cordis patch);失败提示里的「去配置」按钮和「保存并验证」同款样式 |
|
|
551
572
|
| 0.16.4 | 2026-11-23 | **修复** | 全新 profile 上把邮箱、令牌、站点地址一起填好、只点「保存并验证」时地址没落盘,面板一直说没配站点地址;配置保存成功后还会自动重拉列表 |
|
|
552
573
|
| 0.16.5 | 2026-11-24 | 功能 | **没配置时给的是表单而不是报错**:面板直接把「连接 Jira」表单(服务地址 / 邮箱 / API token)放在原来的失败位置,已保存的字段可留空,连接成功即重拉列表 |
|
|
574
|
+
| 0.16.6 | 2026-11-26 | 功能 | **项目没绑工作区也能点「计划」**:绑了建在项目的工作区,没绑落到 DSH 的默认工作区(client 走 `workspaces.initializeDefault()`、host 走 `workspaceController.initializeDefault()`),只有两者都取不到才报错,文案也写明是「也取不到默认工作区」 |
|
|
575
|
+
| 0.16.7 | 2026-12-01 | **修复 + 性能** | 挂起 / 合盖后重开面板列表停在旧数据上(补恢复重拉与 watch 刷新,新增 `test/dsh-jira-resume.mjs`);面板整条路径少打 3 个 Jira 请求(翻到底本地统计总数、活跃迭代与翻页并行);**首屏先画第一页**,全量在后台补 |
|
|
553
576
|
|
|
554
577
|
> 0.1.0–0.12.0 这 15 个版本都发生在 2026-11-18 同一天;0.13.0 起才有 tag 与 Release。
|
|
555
578
|
> 想装某个旧版本:`plugin_manager install_bundle(target="github:EagleSoap/dsh-jira-work-overview#v0.13.2")`,或从 npm 钉版本 `target="dsh-jira-work-overview@0.14.0"`(npm 上最早的版本是 0.14.0)。
|
package/client.js
CHANGED
|
@@ -324,7 +324,7 @@ window.__ModuleLoader__.load({
|
|
|
324
324
|
planDropped: '{key} 的计划对话已删除',
|
|
325
325
|
planDropFailed: '删除计划对话失败:{message}',
|
|
326
326
|
planBusy: '该任务正在建计划对话…',
|
|
327
|
-
planNoWorkspace: '项目 {project}
|
|
327
|
+
planNoWorkspace: '项目 {project} 没有绑定工作区,也取不到基座的默认工作区:先在左侧侧栏里把项目挂到工作区。',
|
|
328
328
|
planFailed: '创建计划对话失败:{message}',
|
|
329
329
|
planCreated: '{key} 的计划对话已创建(plan 模式)',
|
|
330
330
|
planOpened: '已打开 {key} 的计划对话',
|
|
@@ -344,7 +344,7 @@ window.__ModuleLoader__.load({
|
|
|
344
344
|
planDropped: 'Deleted the planning session for {key}',
|
|
345
345
|
planDropFailed: 'Could not delete the planning session: {message}',
|
|
346
346
|
planBusy: 'Creating the planning session…',
|
|
347
|
-
planNoWorkspace: 'Project {project} is not linked to a workspace: link it from the sidebar first.',
|
|
347
|
+
planNoWorkspace: 'Project {project} is not linked to a workspace and no default Workspace could be resolved: link it from the sidebar first.',
|
|
348
348
|
planFailed: 'Could not create the planning session: {message}',
|
|
349
349
|
planCreated: 'Planning session for {key} created (plan mode)',
|
|
350
350
|
planOpened: 'Opened the planning session for {key}',
|
|
@@ -636,6 +636,8 @@ window.__ModuleLoader__.load({
|
|
|
636
636
|
failure: null,
|
|
637
637
|
scope: DEFAULT_SCOPE,
|
|
638
638
|
data: null,
|
|
639
|
+
// 上一次成功拉回列表的时刻(毫秒)。打开面板 / 窗口恢复可见时靠它判断载荷是不是旧了。
|
|
640
|
+
dataAt: 0,
|
|
639
641
|
collapsed: {},
|
|
640
642
|
watch: null,
|
|
641
643
|
// 条数不再进 snapshot:面板固定按「不限制」拉取,host 自己以 5000 条 / 50 页 / 30s 兜底。
|
|
@@ -744,6 +746,16 @@ window.__ModuleLoader__.load({
|
|
|
744
746
|
|
|
745
747
|
const WATCH_PATH = '/api/jira-work-overview/state';
|
|
746
748
|
const WATCH_WAIT_MS = 25000;
|
|
749
|
+
// 列表载荷的「新鲜度」:打开面板 / 窗口从挂起恢复时,超过这个年龄就先重拉一次。
|
|
750
|
+
// 后台 watch 长轮询只说明「有新变化」,自己不替列表重拉;Mac 合盖 / 窗口藏起来时
|
|
751
|
+
// 定时器还会被冻结,回来时列表可能停在睡前那一份。
|
|
752
|
+
const DATA_STALE_MS = 60 * 1000;
|
|
753
|
+
// 长轮询的客户端兜底:Host 侧最长等 25s,网络在睡眠里断掉时 fetch 可能一直挂着,
|
|
754
|
+
// 超时就主动 abort 让循环重连(否则醒来后角标再也不动)。
|
|
755
|
+
const WATCH_CLIENT_TIMEOUT_MS = WATCH_WAIT_MS + 15000;
|
|
756
|
+
// 首屏那一页的条数:与 host 的 PAGE_SIZE 一致(Jira 带 fields 时一页最多 100 条)。
|
|
757
|
+
// 首屏只画这一页,剩下的翻页在后台补(见 load 的两阶段)。
|
|
758
|
+
const PAGE_LIMIT = 100;
|
|
747
759
|
// 面板里改状态走 Host 的写通道(GET 列可用流转 / POST 执行流转)。
|
|
748
760
|
const TRANSITION_PATH = '/api/jira-work-overview/transition';
|
|
749
761
|
// 配置页里换令牌走的通道:GET 打码状态、POST 保存/清除(Host 侧仍写同一个凭据库键)。
|
|
@@ -807,6 +819,13 @@ window.__ModuleLoader__.load({
|
|
|
807
819
|
while (!watch.stopped) {
|
|
808
820
|
const controller = typeof AbortController === 'function' ? new AbortController() : undefined;
|
|
809
821
|
watch.controller = controller;
|
|
822
|
+
let timeout = null;
|
|
823
|
+
if (controller) {
|
|
824
|
+
timeout = setTimeout(() => {
|
|
825
|
+
try { controller.abort(); } catch { /* ignore */ }
|
|
826
|
+
}, WATCH_CLIENT_TIMEOUT_MS);
|
|
827
|
+
if (typeof timeout?.unref === 'function') timeout.unref();
|
|
828
|
+
}
|
|
810
829
|
try {
|
|
811
830
|
const response = await watchFetch(`${WATCH_PATH}?wait=${WATCH_WAIT_MS}`, {
|
|
812
831
|
method: 'GET',
|
|
@@ -825,13 +844,17 @@ window.__ModuleLoader__.load({
|
|
|
825
844
|
failures = 0;
|
|
826
845
|
patchWatch({ supported: true, reason: '', error: '', failures: 0, ...(incoming ?? {}) });
|
|
827
846
|
const total = incoming?.counts?.total ?? 0;
|
|
828
|
-
//
|
|
829
|
-
|
|
847
|
+
// 面板开着、且这次真的多了变化,就顺手把列表刷成新的。**不要求之前已经有未读**:
|
|
848
|
+
// 清过角标之后的第一条(before = 0)同样得刷新,否则列表会一直停在旧数据上,
|
|
849
|
+
// 只有角标在动——Mac 合盖醒来 / 窗口藏一晚上再打开时最明显。
|
|
850
|
+
if (snapshot.open && total > before && !snapshot.loading) load(snapshot.scope);
|
|
830
851
|
} catch (error) {
|
|
831
852
|
if (watch.stopped || watch.controller !== controller) break;
|
|
832
853
|
failures += 1;
|
|
833
854
|
patchWatch({ supported: true, error: String(error?.message ?? error), failures });
|
|
834
855
|
await sleep(Math.min(30000, 4000 * failures));
|
|
856
|
+
} finally {
|
|
857
|
+
if (timeout) clearTimeout(timeout);
|
|
835
858
|
}
|
|
836
859
|
}
|
|
837
860
|
}
|
|
@@ -1071,6 +1094,29 @@ window.__ModuleLoader__.load({
|
|
|
1071
1094
|
* ——host 会一直翻页到没有下一页,只受它自己的安全上限(5000 条 / 50 页 / 30s)约束。
|
|
1072
1095
|
* 条数不再是面板的功能开关,所以这里不吃 limit 参数(「加载更多」只在 host 真截断时出现)。
|
|
1073
1096
|
*/
|
|
1097
|
+
// 面板固定发 scope(all,含已完成/已关闭);`--status=` 是单选状态筛选,空串表示不筛。
|
|
1098
|
+
// `--search=` 放在行尾:搜索词可能带空格,host 会一路吃到下一个 `--` 开关为止。
|
|
1099
|
+
function buildLine(scope, limit, preview) {
|
|
1100
|
+
const status = typeof snapshot.status === 'string' ? snapshot.status : '';
|
|
1101
|
+
const search = typeof snapshot.searchText === 'string' ? snapshot.searchText.trim() : '';
|
|
1102
|
+
return `/jira --json ${scope} --limit=${limit}${preview ? ' --preview' : ''}${status ? ` --status=${status}` : ''} --lang=${currentLanguage()}${search ? ` --search=${search}` : ''}`;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
/** 发一行命令并把结构化载荷解析出来;通道失败 / 命令失败按面板口径抛错。 */
|
|
1106
|
+
async function executeLine(sessionId, line, signal) {
|
|
1107
|
+
const commands = resolveCommands();
|
|
1108
|
+
const result = await commands.execute(sessionId, line, [], signal);
|
|
1109
|
+
if (!result || result.ok !== true) {
|
|
1110
|
+
const code = result?.error?.code ?? '-';
|
|
1111
|
+
const message = result?.error?.message ?? '-';
|
|
1112
|
+
throw new Error(`${t('commandFailed')}: ${code}: ${message}`);
|
|
1113
|
+
}
|
|
1114
|
+
if (result.value === undefined) throw new Error(t('unknownCommand'));
|
|
1115
|
+
const outcome = result.value.result;
|
|
1116
|
+
if (!outcome || outcome.kind !== 'success') throw new Error(outcome?.text || t('commandFailed'));
|
|
1117
|
+
return JSON.parse(outcome.text);
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1074
1120
|
async function load(scope) {
|
|
1075
1121
|
const next = scope || snapshot.scope;
|
|
1076
1122
|
const commands = resolveCommands();
|
|
@@ -1088,32 +1134,32 @@ window.__ModuleLoader__.load({
|
|
|
1088
1134
|
const seq = cancelLoad();
|
|
1089
1135
|
const controller = typeof AbortController === 'function' ? new AbortController() : undefined;
|
|
1090
1136
|
loadController = controller;
|
|
1137
|
+
const firstPaint = !snapshot.data && !snapshot.error && !snapshot.failure;
|
|
1091
1138
|
patch({ loading: true, error: '', failure: null, scope: next });
|
|
1092
1139
|
try {
|
|
1093
|
-
// host
|
|
1094
|
-
//
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1140
|
+
// 两阶段:首屏先要第一页(`--preview` 让 host 跳过 count 与迭代查询,只 ~1 个往返),
|
|
1141
|
+
// 先把 100 行画出来;随后再拉全量替换。首屏只是加速,失败就静静等全量那份。
|
|
1142
|
+
if (firstPaint) {
|
|
1143
|
+
try {
|
|
1144
|
+
const preview = await executeLine(sessionId, buildLine(next, PAGE_LIMIT, true), controller?.signal);
|
|
1145
|
+
if (seq !== loadSeq) return;
|
|
1146
|
+
if (preview && preview.ok !== false && Array.isArray(preview.items) && preview.items.length > 0) {
|
|
1147
|
+
patch({ data: preview, dataAt: Date.now(), loading: true, error: '', failure: null });
|
|
1148
|
+
}
|
|
1149
|
+
} catch {
|
|
1150
|
+
/* 首屏失败不改变最终结果:全量那份会给出真正的错误 */
|
|
1151
|
+
}
|
|
1152
|
+
if (seq !== loadSeq) return;
|
|
1105
1153
|
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
if (!outcome || outcome.kind !== 'success') throw new Error(outcome?.text || t('commandFailed'));
|
|
1109
|
-
const data = JSON.parse(outcome.text);
|
|
1154
|
+
const data = await executeLine(sessionId, buildLine(next, 0, false), controller?.signal);
|
|
1155
|
+
if (seq !== loadSeq) return;
|
|
1110
1156
|
// host 在 --json 失败时不再 throw,而是回一份形状正常的 ok:false 载荷:这里只留
|
|
1111
1157
|
// error.code / message,界面按 code 给提示,不把整句报错糊在列表位置。
|
|
1112
1158
|
if (data && data.ok === false) {
|
|
1113
1159
|
patch({ data: null, failure: data.error ?? { code: 'unknown', message: '' }, error: '', loading: false });
|
|
1114
1160
|
return;
|
|
1115
1161
|
}
|
|
1116
|
-
patch({ data, failure: null, error: '', loading: false });
|
|
1162
|
+
patch({ data, failure: null, error: '', loading: false, dataAt: Date.now() });
|
|
1117
1163
|
} catch (error) {
|
|
1118
1164
|
if (seq !== loadSeq) return; // 被新请求取代 / 主动取消:不当成错误显示
|
|
1119
1165
|
patch({ error: String(error?.message ?? error), failure: null, loading: false });
|
|
@@ -1122,6 +1168,65 @@ window.__ModuleLoader__.load({
|
|
|
1122
1168
|
}
|
|
1123
1169
|
}
|
|
1124
1170
|
|
|
1171
|
+
/* ---------------------------------------------- 重新打开 / 从挂起恢复 */
|
|
1172
|
+
//
|
|
1173
|
+
// 列表只在「首次打开 / 显式操作 / 后台 watch 发现变化」时重拉。Mac 合盖一晚上再打开、
|
|
1174
|
+
// 或把窗口藏起来很久再回来时,watch 长轮询同样可能被冻结,回来只剩一份旧载荷;而入口
|
|
1175
|
+
// 按钮原来看到「已有数据」就直接显示,不做任何重拉——于是新任务能进角标、能弹通知,
|
|
1176
|
+
// 列表却一直停在睡前那一份,只能手动点「刷新」。
|
|
1177
|
+
//
|
|
1178
|
+
// 兜底两条:① 打开面板 / 窗口重新可见时,载荷超过 DATA_STALE_MS、或还有未读变化,就重拉;
|
|
1179
|
+
// ② 面板开着时 watch 一出现新变化就重拉(见 watchLoop)。两条都不改变「关着面板不查 Jira」。
|
|
1180
|
+
|
|
1181
|
+
function dataAge() {
|
|
1182
|
+
return Date.now() - Number(snapshot.dataAt ?? 0);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/** 面板打开 / 窗口恢复可见时调用:旧了、或者有未读变化,就重拉一次。 */
|
|
1186
|
+
function refreshListIfStale() {
|
|
1187
|
+
if (!snapshot.open || snapshot.loading) return false;
|
|
1188
|
+
const unread = snapshot.watch?.counts?.total ?? 0;
|
|
1189
|
+
if (snapshot.data && !snapshot.error && unread === 0 && dataAge() < DATA_STALE_MS) return false;
|
|
1190
|
+
void load(snapshot.scope);
|
|
1191
|
+
return true;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
function startResumeRefresh(ctx) {
|
|
1195
|
+
const doc = typeof document !== 'undefined' ? document : undefined;
|
|
1196
|
+
const win = typeof window !== 'undefined' ? window : undefined;
|
|
1197
|
+
if (typeof doc?.addEventListener !== 'function' && typeof win?.addEventListener !== 'function') return;
|
|
1198
|
+
let timer = null;
|
|
1199
|
+
const schedule = () => {
|
|
1200
|
+
// 变成 hidden 的那一下不刷新;focus / pageshow / visibilitychange 可能连着来,合并成一次。
|
|
1201
|
+
if (doc && doc.visibilityState === 'hidden') return;
|
|
1202
|
+
if (timer) clearTimeout(timer);
|
|
1203
|
+
timer = setTimeout(() => {
|
|
1204
|
+
timer = null;
|
|
1205
|
+
refreshListIfStale();
|
|
1206
|
+
}, 120);
|
|
1207
|
+
};
|
|
1208
|
+
const attach = () => {
|
|
1209
|
+
doc?.addEventListener?.('visibilitychange', schedule);
|
|
1210
|
+
win?.addEventListener?.('focus', schedule);
|
|
1211
|
+
win?.addEventListener?.('pageshow', schedule);
|
|
1212
|
+
return () => {
|
|
1213
|
+
if (timer) clearTimeout(timer);
|
|
1214
|
+
doc?.removeEventListener?.('visibilitychange', schedule);
|
|
1215
|
+
win?.removeEventListener?.('focus', schedule);
|
|
1216
|
+
win?.removeEventListener?.('pageshow', schedule);
|
|
1217
|
+
};
|
|
1218
|
+
};
|
|
1219
|
+
if (typeof ctx?.effect === 'function') {
|
|
1220
|
+
try {
|
|
1221
|
+
ctx.effect(attach, 'jira-work-overview: resume refresh');
|
|
1222
|
+
return;
|
|
1223
|
+
} catch {
|
|
1224
|
+
/* 落到下面的直接挂 */
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
attach();
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1125
1230
|
/* ------------------------------------------------ 项目 ↔ 工作区 */
|
|
1126
1231
|
//
|
|
1127
1232
|
// 一个 Jira 项目挂到一个工作区(工作区 = 一个项目目录),这样切到哪个工作区,
|
|
@@ -1154,7 +1259,10 @@ window.__ModuleLoader__.load({
|
|
|
1154
1259
|
|
|
1155
1260
|
/* ------------------------------------------------ 任务 → 计划对话 */
|
|
1156
1261
|
//
|
|
1157
|
-
//
|
|
1262
|
+
// 任务行后面的「计划」按钮:开一个 plan 模式会话,让它先做任务规划。
|
|
1263
|
+
// 落在哪个工作区:项目绑了工作区就建在那个工作区里;没绑(第一次用 / 映射丢了)就建在
|
|
1264
|
+
// 基座的**默认工作区**里(`workspaces.initializeDefault()`:与侧栏第一次用时建的是同一个),
|
|
1265
|
+
// 不再直接报错——按钮不该因为「还没关联」就什么都做不了。
|
|
1158
1266
|
// 一个任务只对应一个计划对话(避免重复点出好几条):绑定记在 host 的 volatile 配置
|
|
1159
1267
|
// planSessions 里(一行一条 `ISSUE<TAB>sessionId`),和「项目 ↔ 工作区」同一个套路——
|
|
1160
1268
|
// 前端只读写、不另存。重复点击时直接打开原来那条,不再新建;本地没记(比如换了浏览器)
|
|
@@ -1263,6 +1371,34 @@ window.__ModuleLoader__.load({
|
|
|
1263
1371
|
return '';
|
|
1264
1372
|
}
|
|
1265
1373
|
|
|
1374
|
+
/**
|
|
1375
|
+
* 项目没绑工作区时的落点:基座的「默认工作区」。
|
|
1376
|
+
*
|
|
1377
|
+
* 走客户端常驻的 `workspaces` 服务(不是 `remote.workspace`:面板没在 inject 里声明遥控,
|
|
1378
|
+
* 硬取会抛 `cannot get property "remote.workspace" without inject`):`initializeDefault()`
|
|
1379
|
+
* 已经初始化过就直接返回那条,没有才按基座的目录策略建一个——与侧栏第一次用时的默认工作区
|
|
1380
|
+
* 是同一个,之后会话自动归到它下面。服务缺席(老基座)或调用失败时返回空串,由调用方报错。
|
|
1381
|
+
*/
|
|
1382
|
+
async function defaultWorkspaceId() {
|
|
1383
|
+
const ctx = runtime.ctx;
|
|
1384
|
+
if (!ctx || typeof ctx.get !== 'function') return '';
|
|
1385
|
+
let workspaces;
|
|
1386
|
+
try {
|
|
1387
|
+
workspaces = ctx.get('workspaces');
|
|
1388
|
+
} catch {
|
|
1389
|
+
return '';
|
|
1390
|
+
}
|
|
1391
|
+
if (!workspaces || typeof workspaces.initializeDefault !== 'function') return '';
|
|
1392
|
+
try {
|
|
1393
|
+
const result = await workspaces.initializeDefault();
|
|
1394
|
+
if (result && result.ok === false) return '';
|
|
1395
|
+
const workspace = result?.value?.workspace ?? result?.workspace ?? result?.value ?? result;
|
|
1396
|
+
return String(workspace?.workspaceId ?? workspace?.id ?? '');
|
|
1397
|
+
} catch {
|
|
1398
|
+
return '';
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1266
1402
|
/** 让新建的计划对话出现在主视图:uiWorkspace 是官方的换主视图接口。 */
|
|
1267
1403
|
function openPlanSession(sessionId) {
|
|
1268
1404
|
const ctx = runtime.ctx;
|
|
@@ -1349,7 +1485,8 @@ window.__ModuleLoader__.load({
|
|
|
1349
1485
|
try {
|
|
1350
1486
|
await fetchWorkspaceLinks();
|
|
1351
1487
|
const project = projectOfKey(key);
|
|
1352
|
-
|
|
1488
|
+
// 绑定了就建在项目的工作区里;没绑定落默认工作区(取不到才报错)。
|
|
1489
|
+
const workspaceId = boundWorkspaceOf(project) || await defaultWorkspaceId();
|
|
1353
1490
|
if (!workspaceId) throw new Error(t('planNoWorkspace', { project }));
|
|
1354
1491
|
// 计划口径:profile 装了 plan 模式插件就用它的 section;没装时由首条消息自己带一份
|
|
1355
1492
|
// (NO_POLICY_POLICY),不因为「宿主没配」就拒绝开对话。
|
|
@@ -2146,8 +2283,9 @@ window.__ModuleLoader__.load({
|
|
|
2146
2283
|
const open = !snapshot.open;
|
|
2147
2284
|
// 计划失败提示是上一次点击的产物:收起 / 重开面板时一并清掉。
|
|
2148
2285
|
patch({ open, credOpen: false, menuKey: '', filterOpen: false, autoPickedOnce: false, planError: '' });
|
|
2149
|
-
//
|
|
2150
|
-
|
|
2286
|
+
// 打开时按「新鲜度」决定要不要重拉:没有数据 / 上次是错误 / 载荷旧了 / 还有未读变化
|
|
2287
|
+
// 都重拉一次(长时间挂起后重开面板,列表不能停在旧数据上)。
|
|
2288
|
+
if (open) refreshListIfStale();
|
|
2151
2289
|
// 工作区 ↔ 项目:打开面板时按当前会话的工作区把 tab 落到关联项目上(只做这一次,之后以用户选择为准)。
|
|
2152
2290
|
if (open) {
|
|
2153
2291
|
const p = fetchWorkspaceLinks().then(() => adoptWorkspaceProject());
|
|
@@ -2175,7 +2313,7 @@ window.__ModuleLoader__.load({
|
|
|
2175
2313
|
run: () => {
|
|
2176
2314
|
// 打开面板,并在项目 tab 条上把候选项目标成「待关联」:点哪个项目就挂到哪个工作区。
|
|
2177
2315
|
patch({ open: true, credOpen: false, menuKey: '', filterOpen: false, autoPickedOnce: false, linkTarget: workspaceId });
|
|
2178
|
-
|
|
2316
|
+
refreshListIfStale();
|
|
2179
2317
|
void fetchWorkspaceLinks(true);
|
|
2180
2318
|
},
|
|
2181
2319
|
};
|
|
@@ -4117,6 +4255,8 @@ window.__ModuleLoader__.load({
|
|
|
4117
4255
|
void fetchPlanSessions();
|
|
4118
4256
|
|
|
4119
4257
|
startWatchLoop(ctx);
|
|
4258
|
+
// 窗口从隐藏 / 睡眠里回来时重拉旧载荷(与 watch 长轮询互补:那条只保证角标和通知)。
|
|
4259
|
+
startResumeRefresh(ctx);
|
|
4120
4260
|
},
|
|
4121
4261
|
};
|
|
4122
4262
|
},
|