@lornatang/dsh-atlassian 0.1.13 → 0.1.14
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 +4 -0
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/board.js +7 -0
- package/lib/bridge.js +40 -5
- package/lib/types/board.d.ts +7 -0
- package/lib/types/bridge.d.ts +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.14 - 2026-11-19
|
|
4
|
+
|
|
5
|
+
- Reuse the site resolved while connecting for the first Jira board render, removing a duplicate accessibleatlassianresources MCP round-trip; the board still falls back to its own lookup when the cached site is stale.
|
|
6
|
+
|
|
3
7
|
## 0.1.13 - 2026-11-19
|
|
4
8
|
|
|
5
9
|
- Remove a duplicated request-target pre-check left over from the route hardening; malformed URLs still receive the same 400 response.
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ dsh plugin --profile <name> add @lornatang/dsh-atlassian
|
|
|
34
34
|
dsh plugin --profile <name> remove @lornatang/dsh-atlassian
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
The same release is also attached as an archive on GitHub: `dsh plugin --profile <name> add https://github.com/Lornatang/dsh-atlassian/releases/download/v0.1.
|
|
37
|
+
The same release is also attached as an archive on GitHub: `dsh plugin --profile <name> add https://github.com/Lornatang/dsh-atlassian/releases/download/v0.1.14/lornatang-dsh-atlassian-0.1.14.tgz`.
|
|
38
38
|
|
|
39
39
|
`add` composes the layer into the profile: the profile's `cordis.patch.yml` gains an insert entry with row id `atlassian`, package `@lornatang/dsh-atlassian`, and the five values the shipped patch carries — `mode: cloud`, `serverName: atlassian`, `url: https://mcp.atlassian.com/v1/mcp`, `redirectPort: 3334` and `autoOpenBrowser: true`. The manifest declares `dsh.bundle.patch: ./cordis.patch.yml`, which is the declaration the reconcile step reads; `remove` deletes the entry again. Restart DSH after either command, because the profile composes its rows and its client half only at startup, then open Settings → Atlassian. Releases before 0.1.5 published this package as `@lornatang/dsh-atlassian-bridge`; add the scoped name, remove the old package from the same profile and restart once — the row, its settings and the stored credentials survive.
|
|
40
40
|
|
package/README.zh.md
CHANGED
|
@@ -34,7 +34,7 @@ dsh plugin --profile <name> add @lornatang/dsh-atlassian
|
|
|
34
34
|
dsh plugin --profile <name> remove @lornatang/dsh-atlassian
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
也可以从 GitHub release 附带的压缩包安装同一版本:`dsh plugin --profile <name> add https://github.com/Lornatang/dsh-atlassian/releases/download/v0.1.
|
|
37
|
+
也可以从 GitHub release 附带的压缩包安装同一版本:`dsh plugin --profile <name> add https://github.com/Lornatang/dsh-atlassian/releases/download/v0.1.14/lornatang-dsh-atlassian-0.1.14.tgz`。
|
|
38
38
|
|
|
39
39
|
`add` 会把本层组合进 profile:profile 的 `cordis.patch.yml` 会增加一条 insert 记录,行 id 为 `atlassian`,包名为 `@lornatang/dsh-atlassian`,并带上随包提供的补丁中的五个值——`mode: cloud`、`serverName: atlassian`、`url: https://mcp.atlassian.com/v1/mcp`、`redirectPort: 3334` 与 `autoOpenBrowser: true`。包的 manifest 声明了 `dsh.bundle.patch: ./cordis.patch.yml`,reconcile 步骤读取的正是这条声明;`remove` 会再次删除该记录。两条命令执行后都要重启 DSH,因为 profile 只在启动时组合自己的行与客户端部分,随后打开 Settings → Atlassian。0.1.5 之前的版本以 `@lornatang/dsh-atlassian-bridge` 发布;添加带作用域的新名称、从同一 profile 删除旧包、重启一次即可——行、其设置与已保存的凭据都会保留。
|
|
40
40
|
|
package/lib/board.js
CHANGED
|
@@ -59,6 +59,13 @@ export class JiraBoard {
|
|
|
59
59
|
const epoch = this.#bridge.epoch?.() ?? 0;
|
|
60
60
|
if (this.#resource?.epoch === epoch)
|
|
61
61
|
return this.#resource.id;
|
|
62
|
+
// The bridge resolves the same resource while connecting; reuse that result
|
|
63
|
+
// instead of paying a second MCP round-trip on the first board render.
|
|
64
|
+
const shared = this.#bridge.resource?.();
|
|
65
|
+
if (shared && shared.epoch === epoch) {
|
|
66
|
+
this.#resource = { epoch, id: shared.id, base: shared.base, site: shared.site };
|
|
67
|
+
return shared.id;
|
|
68
|
+
}
|
|
62
69
|
if (this.#pending?.epoch === epoch)
|
|
63
70
|
return this.#pending.promise;
|
|
64
71
|
const promise = this.#resolveSite(epoch);
|
package/lib/bridge.js
CHANGED
|
@@ -57,6 +57,7 @@ export class AtlassianBridge {
|
|
|
57
57
|
#refreshes = new Set();
|
|
58
58
|
#waiters = new Set();
|
|
59
59
|
#waiting = false;
|
|
60
|
+
#resource;
|
|
60
61
|
#allowLoopbackHttp;
|
|
61
62
|
constructor(host, options) {
|
|
62
63
|
this.#host = host;
|
|
@@ -214,6 +215,10 @@ export class AtlassianBridge {
|
|
|
214
215
|
}
|
|
215
216
|
#newOperation() { return { generation: this.#generation, signal: this.#controller.signal }; }
|
|
216
217
|
epoch() { return this.#generation; }
|
|
218
|
+
/** Site resolved during connect, shared with the board to avoid a duplicate MCP call. */
|
|
219
|
+
resource() {
|
|
220
|
+
return this.#resource?.epoch === this.#generation ? this.#resource : undefined;
|
|
221
|
+
}
|
|
217
222
|
#setStatus(status) { this.#status = status; this.#wake(); }
|
|
218
223
|
#setUrl(url) { this.#url = url; this.#wake(); }
|
|
219
224
|
#wake() { const waiters = [...this.#waiters]; this.#waiters.clear(); for (const wake of waiters)
|
|
@@ -328,7 +333,7 @@ export class AtlassianBridge {
|
|
|
328
333
|
check();
|
|
329
334
|
this.#setStatus('connecting');
|
|
330
335
|
this.#error = undefined;
|
|
331
|
-
const client = new Client({ name: 'dsh-atlassian', version: '0.1.
|
|
336
|
+
const client = new Client({ name: 'dsh-atlassian', version: '0.1.14' });
|
|
332
337
|
// Releasing the session lease here would race the SDK's saveTokens; an
|
|
333
338
|
// exchange that is still in flight is released by its own finally block.
|
|
334
339
|
client.onerror = () => { const operation = this.#operation.getStore(); if (operation?.exchangePending)
|
|
@@ -449,11 +454,39 @@ export class AtlassianBridge {
|
|
|
449
454
|
try {
|
|
450
455
|
const result = await client.callTool({ name, arguments: {} }, undefined, { timeout: 20000, signal });
|
|
451
456
|
const items = JSON.parse(display(result.content));
|
|
452
|
-
const
|
|
457
|
+
const list = Array.isArray(items) ? items : [items];
|
|
458
|
+
// Publish the first safe site label for the status snapshot. The board's
|
|
459
|
+
// stricter URL policy decides which entry can act as its cloud resource.
|
|
460
|
+
const first = list[0];
|
|
453
461
|
if (first && typeof first === 'object' && typeof first['url'] === 'string') {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
462
|
+
try {
|
|
463
|
+
const reported = new URL(first['url']);
|
|
464
|
+
secureUrl(reported, this.#allowLoopbackHttp);
|
|
465
|
+
await this.#options.store.patch({ site: reported.host }, () => !this.#disposed && generation === this.#generation && !signal.aborted, undefined, undefined, signal);
|
|
466
|
+
}
|
|
467
|
+
catch { /* The status label is optional; the board still validates URLs itself. */ }
|
|
468
|
+
}
|
|
469
|
+
for (const item of list) {
|
|
470
|
+
if (!item || typeof item !== 'object')
|
|
471
|
+
continue;
|
|
472
|
+
const entry = item;
|
|
473
|
+
const id = entry['id'];
|
|
474
|
+
const url = entry['url'];
|
|
475
|
+
if (typeof id !== 'string' || !id || typeof url !== 'string' || !url)
|
|
476
|
+
continue;
|
|
477
|
+
let parsed;
|
|
478
|
+
try {
|
|
479
|
+
parsed = new URL(url);
|
|
480
|
+
if (!['http:', 'https:'].includes(parsed.protocol) || parsed.username || parsed.password)
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
catch {
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
if (!this.#disposed && generation === this.#generation && !signal.aborted) {
|
|
487
|
+
this.#resource = { epoch: generation, id, base: `${parsed.origin}${parsed.pathname.replace(/\/$/, '')}`, site: parsed.host };
|
|
488
|
+
}
|
|
489
|
+
break;
|
|
457
490
|
}
|
|
458
491
|
}
|
|
459
492
|
catch { /* The connection can work without a site label. */ }
|
|
@@ -468,6 +501,7 @@ export class AtlassianBridge {
|
|
|
468
501
|
}
|
|
469
502
|
async disconnect() {
|
|
470
503
|
this.#generation++;
|
|
504
|
+
this.#resource = undefined;
|
|
471
505
|
this.#controller.abort();
|
|
472
506
|
this.#controller = new AbortController();
|
|
473
507
|
this.#setStatus('idle');
|
|
@@ -488,6 +522,7 @@ export class AtlassianBridge {
|
|
|
488
522
|
return;
|
|
489
523
|
this.#disposed = true;
|
|
490
524
|
this.#generation++;
|
|
525
|
+
this.#resource = undefined;
|
|
491
526
|
this.#controller.abort();
|
|
492
527
|
this.#setStatus('idle');
|
|
493
528
|
this.#callback.cancelWait();
|
package/lib/types/board.d.ts
CHANGED
|
@@ -7,6 +7,13 @@ export interface ToolBridge {
|
|
|
7
7
|
};
|
|
8
8
|
/** Changes whenever the connection is replaced, so cached site data can be invalidated. */
|
|
9
9
|
epoch?(): number;
|
|
10
|
+
/** Site resolved while connecting, so the first board render need not repeat that MCP call. */
|
|
11
|
+
resource?(): {
|
|
12
|
+
epoch: number;
|
|
13
|
+
id: string;
|
|
14
|
+
base: string;
|
|
15
|
+
site: string;
|
|
16
|
+
} | undefined;
|
|
10
17
|
}
|
|
11
18
|
export interface BoardStatus {
|
|
12
19
|
name: string;
|
package/lib/types/bridge.d.ts
CHANGED
|
@@ -37,6 +37,13 @@ export declare class AtlassianBridge {
|
|
|
37
37
|
#private;
|
|
38
38
|
constructor(host: BridgeHost, options: BridgeOptions);
|
|
39
39
|
epoch(): number;
|
|
40
|
+
/** Site resolved during connect, shared with the board to avoid a duplicate MCP call. */
|
|
41
|
+
resource(): {
|
|
42
|
+
epoch: number;
|
|
43
|
+
id: string;
|
|
44
|
+
base: string;
|
|
45
|
+
site: string;
|
|
46
|
+
} | undefined;
|
|
40
47
|
snapshot(): BridgeSnapshot;
|
|
41
48
|
rawNames(): readonly string[];
|
|
42
49
|
rawNameMatching(pattern: RegExp): string | undefined;
|
package/package.json
CHANGED