@lornatang/dsh-atlassian 0.1.15 → 0.1.16

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.16 - 2026-11-21
4
+
5
+ - Move the source and release metadata to the shared dsh-plugin repository.
6
+
3
7
  ## 0.1.15 - 2026-11-19
4
8
 
5
9
  - Serialize connection replacement and refresh the Jira site cache when the connection changes.
package/LICENSE CHANGED
@@ -1,202 +1,202 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE CHANGED
@@ -1,2 +1,2 @@
1
- DSH Atlassian
2
- Copyright 2026 Lornatang
1
+ DSH Atlassian
2
+ Copyright 2026 Lornatang
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.15/lornatang-dsh-atlassian-0.1.15.tgz`.
37
+ Prebuilt tarballs are available in [GitHub Releases](https://github.com/Lornatang/dsh-plugin/releases) under tags such as `dsh-atlassian-v<version>`.
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.15/lornatang-dsh-atlassian-0.1.15.tgz`。
37
+ 预构建压缩包见新仓库的 [GitHub Releases](https://github.com/Lornatang/dsh-plugin/releases),标签格式为 `dsh-atlassian-v<version>`。
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/cordis.patch.yml CHANGED
@@ -1,9 +1,9 @@
1
- - insert:
2
- - id: atlassian
3
- name: '@lornatang/dsh-atlassian'
4
- config:
5
- mode: cloud
6
- serverName: atlassian
7
- url: 'https://mcp.atlassian.com/v1/mcp'
8
- redirectPort: 3334
9
- autoOpenBrowser: true
1
+ - insert:
2
+ - id: atlassian
3
+ name: '@lornatang/dsh-atlassian'
4
+ config:
5
+ mode: cloud
6
+ serverName: atlassian
7
+ url: 'https://mcp.atlassian.com/v1/mcp'
8
+ redirectPort: 3334
9
+ autoOpenBrowser: true
package/lib/bridge.js CHANGED
@@ -7,7 +7,10 @@ import { AtlassianOAuthProvider, CallbackServer, RedirectRegistrationChanged, cr
7
7
  import { OAuthTokensSchema } from '@modelcontextprotocol/sdk/shared/auth.js';
8
8
  import { decodeToolJson, selectJiraResource } from './jira-resource.js';
9
9
  import { openInBrowser } from './open-url.js';
10
+ import { deferredOutputValidation, validateOutput } from './output-validator.js';
10
11
  import { sameTokens } from './store.js';
12
+ const MAX_DISCOVERY_BYTES = 8 * 1024 * 1024;
13
+ const MAX_TOOL_BYTES = 512 * 1024;
11
14
  async function waitForFlight(flight, signal) {
12
15
  if (signal.aborted)
13
16
  throw new Error('atlassian: connection cancelled');
@@ -264,7 +267,7 @@ export class AtlassianBridge {
264
267
  // would reach an unbound callback listener and fail with an HTTP 400.
265
268
  return { status: this.#status, authorizationUrl: this.#waiting ? this.#url : undefined, site, siteMismatch: mismatch, toolCount: this.#tools.size, error: this.#error };
266
269
  }
267
- rawNames() { return [...this.#tools.values()].map((value) => value.raw); }
270
+ rawNames() { return [...this.#tools.keys()]; }
268
271
  rawNameMatching(pattern) { return this.rawNames().find((name) => pattern.test(name)); }
269
272
  async start() {
270
273
  if (this.#boot)
@@ -352,7 +355,7 @@ export class AtlassianBridge {
352
355
  for (let attempt = 0; attempt < 2; attempt++) {
353
356
  check();
354
357
  this.#setStatus('connecting');
355
- const client = new Client({ name: 'dsh-atlassian', version: '0.1.15' });
358
+ const client = new Client({ name: 'dsh-atlassian', version: '0.1.15' }, { jsonSchemaValidator: deferredOutputValidation });
356
359
  // Releasing the session lease here would race the SDK's saveTokens; an
357
360
  // exchange that is still in flight is released by its own finally block.
358
361
  client.onerror = () => { const operation = this.#operation.getStore(); if (operation?.exchangePending)
@@ -407,27 +410,42 @@ export class AtlassianBridge {
407
410
  continue;
408
411
  }
409
412
  this.#client = client;
410
- await this.#registerTools(client);
411
- check();
412
- await this.#readSite(client, generation, signal);
413
- check();
414
- this.#setUrl(undefined);
415
- this.#setStatus('ready');
413
+ try {
414
+ await this.#registerTools(client, signal);
415
+ check();
416
+ await this.#readSite(client, generation, signal);
417
+ check();
418
+ this.#setUrl(undefined);
419
+ this.#setStatus('ready');
420
+ }
421
+ catch (error) {
422
+ this.#clearTools();
423
+ await this.#closeClient();
424
+ throw error;
425
+ }
416
426
  return;
417
427
  }
418
428
  throw new Error('Atlassian authorization did not establish a connection');
419
429
  }
420
- async #registerTools(client) {
430
+ async #registerTools(client, signal) {
421
431
  const found = [];
422
432
  const seen = new Set();
423
433
  let cursor;
434
+ let bytes = 0;
424
435
  do {
425
436
  if (seen.size >= 100)
426
437
  throw new Error('MCP server returned too many tool pages');
427
- const page = await client.listTools(cursor ? { cursor } : {});
428
- found.push(...page.tools);
429
- if (found.length > 1000)
438
+ const page = await client.listTools(cursor ? { cursor } : {}, { signal, timeout: this.#options.toolCallTimeoutMs });
439
+ if (found.length + page.tools.length > 1000)
430
440
  throw new Error('MCP server returned too many tools');
441
+ bytes += Buffer.byteLength(JSON.stringify(page), 'utf8');
442
+ if (bytes > MAX_DISCOVERY_BYTES)
443
+ throw new Error('MCP tool discovery exceeds the total byte limit');
444
+ for (const tool of page.tools) {
445
+ if (Buffer.byteLength(JSON.stringify(tool), 'utf8') > MAX_TOOL_BYTES)
446
+ throw new Error('MCP tool definition exceeds the byte limit');
447
+ found.push(tool);
448
+ }
431
449
  cursor = page.nextCursor;
432
450
  if (cursor && seen.has(cursor))
433
451
  throw new Error('MCP server repeated a continuation cursor');
@@ -441,29 +459,21 @@ export class AtlassianBridge {
441
459
  throw new Error('MCP server returned duplicate tool names');
442
460
  names.add(name);
443
461
  }
444
- this.#clearTools();
445
- try {
446
- for (const tool of found) {
447
- const name = publicToolName(this.#options.serverName, tool.name);
448
- const definition = {
449
- name, description: tool.description ?? '', parameters: tool.inputSchema,
450
- output: {
451
- schema: { type: 'object', properties: { content: { type: 'array', items: {} } }, required: ['content'], additionalProperties: false },
452
- render: (_args, result) => [{ type: 'text', text: display(result?.content) }],
453
- },
454
- execute: async (args, context) => {
455
- const result = await client.callTool({ name: tool.name, arguments: (typeof args === 'object' && args !== null ? args : {}) }, undefined, { timeout: this.#options.toolCallTimeoutMs, signal: context.signal });
456
- if (result.isError)
457
- throw new Error(display(result.content));
458
- return { content: result.content };
459
- },
460
- };
461
- this.#tools.set(name, { raw: tool.name, dispose: this.#host.register(definition) });
462
- }
463
- }
464
- catch (error) {
465
- this.#clearTools();
466
- throw error;
462
+ for (const tool of found) {
463
+ const name = publicToolName(this.#options.serverName, tool.name);
464
+ const definition = {
465
+ name, description: tool.description ?? '', parameters: tool.inputSchema,
466
+ output: {
467
+ schema: { type: 'object', properties: { content: { type: 'array', items: {} } }, required: ['content'], additionalProperties: false },
468
+ render: (_args, result) => [{ type: 'text', text: display(result?.content) }],
469
+ },
470
+ execute: async (args, context) => {
471
+ const combined = context.signal ? AbortSignal.any([signal, context.signal]) : signal;
472
+ const input = (typeof args === 'object' && args !== null ? args : {});
473
+ return { content: await this.#callTool(client, tool.name, input, this.#options.toolCallTimeoutMs, combined) };
474
+ },
475
+ };
476
+ this.#tools.set(tool.name, { outputSchema: tool.outputSchema, dispose: this.#host.register(definition) });
467
477
  }
468
478
  }
469
479
  async #readSite(client, generation, signal) {
@@ -471,10 +481,10 @@ export class AtlassianBridge {
471
481
  if (!name)
472
482
  return;
473
483
  try {
474
- const result = await client.callTool({ name, arguments: {} }, undefined, { timeout: 20000, signal });
475
- if (result.isError || signal.aborted)
484
+ const content = await this.#callTool(client, name, {}, 20_000, signal);
485
+ if (signal.aborted)
476
486
  return;
477
- const site = selectJiraResource(decodeToolJson(result.content), (url) => this.allowsHttpResource(url));
487
+ const site = selectJiraResource(decodeToolJson(content), (url) => this.allowsHttpResource(url));
478
488
  if (!site)
479
489
  return;
480
490
  this.#resource = { epoch: generation, ...site };
@@ -485,9 +495,22 @@ export class AtlassianBridge {
485
495
  async callTool(rawName, args, timeoutMs) {
486
496
  if (!this.#client || this.#status !== 'ready')
487
497
  throw new Error('Atlassian is not connected');
488
- const result = await this.#client.callTool({ name: rawName, arguments: args }, undefined, { timeout: timeoutMs ?? this.#options.toolCallTimeoutMs });
498
+ return this.#callTool(this.#client, rawName, args, timeoutMs ?? this.#options.toolCallTimeoutMs, this.#controller.signal);
499
+ }
500
+ async #callTool(client, name, args, timeout, signal) {
501
+ signal.throwIfAborted();
502
+ const tool = this.#tools.get(name);
503
+ if (!tool)
504
+ throw new Error(`Atlassian MCP tool ${name} was not discovered`);
505
+ const result = await client.callTool({ name, arguments: args }, undefined, { timeout, signal });
489
506
  if (result.isError)
490
507
  throw new Error(display(result.content));
508
+ if (tool.outputSchema) {
509
+ if (result.structuredContent === undefined)
510
+ throw new Error(`Atlassian MCP tool ${name} did not return structured output`);
511
+ await validateOutput(tool.outputSchema, result.structuredContent, timeout, signal);
512
+ }
513
+ signal.throwIfAborted();
491
514
  return Array.isArray(result.content) ? result.content : [];
492
515
  }
493
516
  async disconnect() {
package/lib/client.js CHANGED
@@ -48,25 +48,25 @@ const Context = React.createContext({ slots: { inject: () => () => undefined, re
48
48
  if (typeof document !== 'undefined') {
49
49
  const style = document.createElement('style');
50
50
  style.setAttribute('data-plugin-css', '@lornatang/dsh-atlassian');
51
- style.textContent = `
52
- .dab-root{--dab-line:color-mix(in srgb,currentColor 14%,transparent);--dab-soft:color-mix(in srgb,currentColor 4%,transparent);--dab-softer:color-mix(in srgb,currentColor 2.5%,transparent);box-sizing:border-box;padding:24px 28px 36px;max-width:1120px;margin:0 auto;color:inherit;font-size:14px;line-height:1.5}
53
- .dab-root *{box-sizing:border-box}.dab-settings{max-width:900px}.dab-root h2,.dab-root h3,.dab-root p{margin:0}.dab-root button,.dab-root input,.dab-root select{font:inherit}
54
- .dab-hero{display:flex;align-items:flex-start;gap:15px;margin-bottom:24px}.dab-brand-icon,.dab-service-icon{display:grid;place-items:center;flex:none;border-radius:14px;background:rgba(79,125,244,.15);color:#7098ff}
55
- .dab-brand-icon{width:46px;height:46px}.dab-brand-icon svg{width:24px;height:24px}.dab-hero-copy{flex:1;min-width:0}.dab-eyebrow{font-size:10px;font-weight:700;letter-spacing:.13em;text-transform:uppercase;opacity:.58;margin-bottom:3px!important}
56
- .dab-title{font-size:23px;line-height:1.2;font-weight:700;letter-spacing:-.025em}.dab-subtitle{margin-top:6px!important;opacity:.68;font-size:13px;max-width:560px}.dab-mode{flex:none;padding:5px 9px;border:1px solid var(--dab-line);border-radius:999px;background:var(--dab-soft);font-size:10px;font-weight:700;letter-spacing:.035em;opacity:.8}
57
- .dab-section-label{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:24px 0 10px;font-size:11px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;opacity:.6}
58
- .dab-status{display:flex;align-items:center;gap:14px;padding:16px 18px;border:1px solid var(--dab-line);border-radius:13px;background:var(--dab-softer)}.dab-status-icon{display:grid;place-items:center;width:34px;height:34px;flex:none;border-radius:10px;color:#7296fa;background:rgba(100,137,255,.14)}
59
- .dab-status-icon.is-ready{color:#2dbb87;background:rgba(45,187,135,.14)}.dab-status-icon.is-error{color:#f47878;background:rgba(244,120,120,.14)}.dab-status-main{min-width:0;flex:1}.dab-status-title{font-weight:700;font-size:14px}.dab-status-note{opacity:.64;font-size:12px;margin-top:1px!important;overflow-wrap:anywhere}.dab-status-count{padding-left:18px;border-left:1px solid var(--dab-line);text-align:right;white-space:nowrap}.dab-status-count strong{display:block;font-size:17px;line-height:1.1}.dab-status-count span{font-size:10px;text-transform:uppercase;letter-spacing:.07em;opacity:.58}
60
- .dab-service{border:1px solid var(--dab-line);border-radius:14px;background:var(--dab-softer);padding:18px;margin-bottom:12px}.dab-service-head{display:flex;align-items:center;gap:11px;margin-bottom:16px}.dab-service-icon{width:37px;height:37px;border-radius:11px;font-size:15px;font-weight:800}.dab-service-icon.is-confluence{background:rgba(92,158,230,.15);color:#70b5f5}.dab-service-title{font-size:14px;font-weight:700;line-height:1.25}.dab-service-url{font-size:12px;opacity:.62;overflow-wrap:anywhere}.dab-service-copy{min-width:0;flex:1}.dab-service-tag{font-size:10px;font-weight:700;letter-spacing:.05em;opacity:.52;text-transform:uppercase}
61
- .dab-config-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:15px}.dab-config-head p{font-size:12px;opacity:.65;margin-top:3px!important}.dab-advanced{margin-top:14px;font-size:12px}.dab-advanced summary{cursor:pointer;font-weight:650;opacity:.75;list-style-position:inside}.dab-advanced-body{padding-top:12px}.dab-checkbox{display:flex;align-items:flex-start;gap:8px;margin-top:13px;line-height:1.4}.dab-checkbox input{accent-color:#5984f3;margin-top:2px}.dab-config-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:15px}.dab-config-hint{font-size:12px;opacity:.62}
62
- .dab-field-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.dab-field{display:block;min-width:0;font-size:12px;font-weight:650}.dab-field span{display:block;margin-bottom:6px}.dab-input{width:100%;min-width:0;min-height:39px;padding:8px 11px;border:1px solid var(--dab-line);border-radius:9px;background:var(--dab-soft);color:inherit;outline:none;transition:border-color .15s,box-shadow .15s}.dab-input::placeholder{color:inherit;opacity:.42}.dab-input:focus{border-color:#7196ff;box-shadow:0 0 0 3px rgba(104,145,255,.17)}
63
- .dab-help{font-size:12px;opacity:.62;margin-top:11px!important}.dab-callout{display:flex;gap:9px;align-items:flex-start;padding:11px 12px;border-radius:9px;background:rgba(226,161,40,.11);color:color-mix(in srgb,currentColor 45%,#e8a82e);font-size:12px;margin-top:13px}.dab-callout svg{width:15px;height:15px;flex:none;margin-top:1px}
64
- .dab-alert{padding:11px 13px;border:1px solid rgba(230,89,89,.3);border-radius:10px;background:rgba(230,89,89,.09);color:color-mix(in srgb,currentColor 40%,#ed6969);white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;margin-top:14px!important}.dab-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:18px}.dab-action-note{font-size:12px;opacity:.58;margin-left:auto}.dab-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:36px;padding:7px 13px;border:1px solid var(--dab-line);border-radius:9px;background:var(--dab-soft);color:inherit;font-weight:600;cursor:pointer;transition:background .15s,border-color .15s,transform .15s}.dab-button:hover:not(:disabled){background:color-mix(in srgb,currentColor 9%,transparent)}.dab-button:focus-visible{outline:2px solid #7196ff;outline-offset:2px}.dab-button:disabled{opacity:.4;cursor:not-allowed}.dab-button-primary{border-color:#4678ed;background:#4678ed;color:#fff}.dab-button-primary:hover:not(:disabled){background:#356be0;border-color:#356be0}.dab-button svg{width:15px;height:15px;flex:none}
65
- .dab-link{color:#779bff;text-decoration:none;font-weight:600}.dab-link:hover{text-decoration:underline}.dab-cloud-card{padding:18px;border:1px solid var(--dab-line);border-radius:14px;background:var(--dab-softer)}.dab-cloud-card strong{display:block;margin-bottom:5px}.dab-cloud-card p{font-size:13px;opacity:.68}
66
- .dab-board-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:20px}.dab-row{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin:10px 0}.dab-toolbar{display:flex;gap:9px;align-items:center;flex-wrap:wrap}.dab-search{flex:1;min-width:180px}.dab-project{width:auto;min-width:140px}.dab-query{display:flex;gap:9px;align-items:center;margin:10px 0 16px;padding:10px 12px;border:1px solid var(--dab-line);border-radius:10px;background:var(--dab-softer)}.dab-query label{font-size:11px;font-weight:800;letter-spacing:.06em;opacity:.65}.dab-query .dab-input{border:0;background:transparent;min-height:32px;padding:4px 6px;flex:1}.dab-query .dab-input:focus{box-shadow:none}.dab-selection{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 12px;margin:0 0 16px;border:1px solid rgba(105,145,255,.3);border-radius:10px;background:rgba(105,145,255,.08)}.dab-selection-count{font-size:12px;font-weight:700;margin-right:5px}
67
- .dab-columns{display:flex;align-items:flex-start;gap:12px;overflow-x:auto;padding-bottom:12px}.dab-column{min-width:230px;flex:1;border:1px solid var(--dab-line);border-radius:12px;background:var(--dab-softer);padding:10px}.dab-column-head{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:3px 3px 9px;font-size:12px;font-weight:700}.dab-column-count{font-size:11px;font-weight:600;opacity:.6}.dab-issue{border:1px solid var(--dab-line);border-radius:10px;background:var(--dab-soft);padding:11px;margin:0 0 8px;cursor:pointer;transition:border-color .15s,transform .15s}.dab-issue:hover{border-color:rgba(105,145,255,.5);transform:translateY(-1px)}.dab-issue:focus-visible{outline:2px solid #7196ff;outline-offset:2px}.dab-issue-key{display:flex;align-items:center;gap:6px;font-size:11px;font-weight:700;color:#7a9cff}.dab-issue-key input{accent-color:#5984f3}.dab-issue-summary{font-weight:600;font-size:13px;line-height:1.4;margin-top:7px}.dab-issue-meta{display:block;margin-top:8px;font-size:11px;opacity:.6}.dab-empty{padding:36px 18px;text-align:center;border:1px dashed var(--dab-line);border-radius:12px;opacity:.65;font-size:13px}
68
- .dab-detail{position:fixed;right:0;top:0;bottom:0;width:min(520px,90vw);overflow:auto;background:var(--dab-detail-bg,Canvas);color:CanvasText;border-left:1px solid var(--dab-line);padding:22px;z-index:50;box-shadow:0 0 24px #0004}.dab-detail-head{display:flex;justify-content:space-between;align-items:center;gap:12px}.dab-detail pre{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;opacity:.85;margin:18px 0}.dab-message{font-size:13px;opacity:.8;margin:10px 0!important}.dab-root svg{display:block}
69
- @media(max-width:640px){.dab-root{padding:18px 16px 28px}.dab-hero{gap:11px}.dab-mode{display:none}.dab-field-grid{grid-template-columns:1fr}.dab-status-count{padding-left:10px}.dab-action-note{width:100%;margin-left:0}.dab-board-head{display:block}.dab-toolbar>*{min-width:0}.dab-project{flex:1}}
51
+ style.textContent = `
52
+ .dab-root{--dab-line:color-mix(in srgb,currentColor 14%,transparent);--dab-soft:color-mix(in srgb,currentColor 4%,transparent);--dab-softer:color-mix(in srgb,currentColor 2.5%,transparent);box-sizing:border-box;padding:24px 28px 36px;max-width:1120px;margin:0 auto;color:inherit;font-size:14px;line-height:1.5}
53
+ .dab-root *{box-sizing:border-box}.dab-settings{max-width:900px}.dab-root h2,.dab-root h3,.dab-root p{margin:0}.dab-root button,.dab-root input,.dab-root select{font:inherit}
54
+ .dab-hero{display:flex;align-items:flex-start;gap:15px;margin-bottom:24px}.dab-brand-icon,.dab-service-icon{display:grid;place-items:center;flex:none;border-radius:14px;background:rgba(79,125,244,.15);color:#7098ff}
55
+ .dab-brand-icon{width:46px;height:46px}.dab-brand-icon svg{width:24px;height:24px}.dab-hero-copy{flex:1;min-width:0}.dab-eyebrow{font-size:10px;font-weight:700;letter-spacing:.13em;text-transform:uppercase;opacity:.58;margin-bottom:3px!important}
56
+ .dab-title{font-size:23px;line-height:1.2;font-weight:700;letter-spacing:-.025em}.dab-subtitle{margin-top:6px!important;opacity:.68;font-size:13px;max-width:560px}.dab-mode{flex:none;padding:5px 9px;border:1px solid var(--dab-line);border-radius:999px;background:var(--dab-soft);font-size:10px;font-weight:700;letter-spacing:.035em;opacity:.8}
57
+ .dab-section-label{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:24px 0 10px;font-size:11px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;opacity:.6}
58
+ .dab-status{display:flex;align-items:center;gap:14px;padding:16px 18px;border:1px solid var(--dab-line);border-radius:13px;background:var(--dab-softer)}.dab-status-icon{display:grid;place-items:center;width:34px;height:34px;flex:none;border-radius:10px;color:#7296fa;background:rgba(100,137,255,.14)}
59
+ .dab-status-icon.is-ready{color:#2dbb87;background:rgba(45,187,135,.14)}.dab-status-icon.is-error{color:#f47878;background:rgba(244,120,120,.14)}.dab-status-main{min-width:0;flex:1}.dab-status-title{font-weight:700;font-size:14px}.dab-status-note{opacity:.64;font-size:12px;margin-top:1px!important;overflow-wrap:anywhere}.dab-status-count{padding-left:18px;border-left:1px solid var(--dab-line);text-align:right;white-space:nowrap}.dab-status-count strong{display:block;font-size:17px;line-height:1.1}.dab-status-count span{font-size:10px;text-transform:uppercase;letter-spacing:.07em;opacity:.58}
60
+ .dab-service{border:1px solid var(--dab-line);border-radius:14px;background:var(--dab-softer);padding:18px;margin-bottom:12px}.dab-service-head{display:flex;align-items:center;gap:11px;margin-bottom:16px}.dab-service-icon{width:37px;height:37px;border-radius:11px;font-size:15px;font-weight:800}.dab-service-icon.is-confluence{background:rgba(92,158,230,.15);color:#70b5f5}.dab-service-title{font-size:14px;font-weight:700;line-height:1.25}.dab-service-url{font-size:12px;opacity:.62;overflow-wrap:anywhere}.dab-service-copy{min-width:0;flex:1}.dab-service-tag{font-size:10px;font-weight:700;letter-spacing:.05em;opacity:.52;text-transform:uppercase}
61
+ .dab-config-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:15px}.dab-config-head p{font-size:12px;opacity:.65;margin-top:3px!important}.dab-advanced{margin-top:14px;font-size:12px}.dab-advanced summary{cursor:pointer;font-weight:650;opacity:.75;list-style-position:inside}.dab-advanced-body{padding-top:12px}.dab-checkbox{display:flex;align-items:flex-start;gap:8px;margin-top:13px;line-height:1.4}.dab-checkbox input{accent-color:#5984f3;margin-top:2px}.dab-config-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:15px}.dab-config-hint{font-size:12px;opacity:.62}
62
+ .dab-field-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.dab-field{display:block;min-width:0;font-size:12px;font-weight:650}.dab-field span{display:block;margin-bottom:6px}.dab-input{width:100%;min-width:0;min-height:39px;padding:8px 11px;border:1px solid var(--dab-line);border-radius:9px;background:var(--dab-soft);color:inherit;outline:none;transition:border-color .15s,box-shadow .15s}.dab-input::placeholder{color:inherit;opacity:.42}.dab-input:focus{border-color:#7196ff;box-shadow:0 0 0 3px rgba(104,145,255,.17)}
63
+ .dab-help{font-size:12px;opacity:.62;margin-top:11px!important}.dab-callout{display:flex;gap:9px;align-items:flex-start;padding:11px 12px;border-radius:9px;background:rgba(226,161,40,.11);color:color-mix(in srgb,currentColor 45%,#e8a82e);font-size:12px;margin-top:13px}.dab-callout svg{width:15px;height:15px;flex:none;margin-top:1px}
64
+ .dab-alert{padding:11px 13px;border:1px solid rgba(230,89,89,.3);border-radius:10px;background:rgba(230,89,89,.09);color:color-mix(in srgb,currentColor 40%,#ed6969);white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;margin-top:14px!important}.dab-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:18px}.dab-action-note{font-size:12px;opacity:.58;margin-left:auto}.dab-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:36px;padding:7px 13px;border:1px solid var(--dab-line);border-radius:9px;background:var(--dab-soft);color:inherit;font-weight:600;cursor:pointer;transition:background .15s,border-color .15s,transform .15s}.dab-button:hover:not(:disabled){background:color-mix(in srgb,currentColor 9%,transparent)}.dab-button:focus-visible{outline:2px solid #7196ff;outline-offset:2px}.dab-button:disabled{opacity:.4;cursor:not-allowed}.dab-button-primary{border-color:#4678ed;background:#4678ed;color:#fff}.dab-button-primary:hover:not(:disabled){background:#356be0;border-color:#356be0}.dab-button svg{width:15px;height:15px;flex:none}
65
+ .dab-link{color:#779bff;text-decoration:none;font-weight:600}.dab-link:hover{text-decoration:underline}.dab-cloud-card{padding:18px;border:1px solid var(--dab-line);border-radius:14px;background:var(--dab-softer)}.dab-cloud-card strong{display:block;margin-bottom:5px}.dab-cloud-card p{font-size:13px;opacity:.68}
66
+ .dab-board-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:20px}.dab-row{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin:10px 0}.dab-toolbar{display:flex;gap:9px;align-items:center;flex-wrap:wrap}.dab-search{flex:1;min-width:180px}.dab-project{width:auto;min-width:140px}.dab-query{display:flex;gap:9px;align-items:center;margin:10px 0 16px;padding:10px 12px;border:1px solid var(--dab-line);border-radius:10px;background:var(--dab-softer)}.dab-query label{font-size:11px;font-weight:800;letter-spacing:.06em;opacity:.65}.dab-query .dab-input{border:0;background:transparent;min-height:32px;padding:4px 6px;flex:1}.dab-query .dab-input:focus{box-shadow:none}.dab-selection{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 12px;margin:0 0 16px;border:1px solid rgba(105,145,255,.3);border-radius:10px;background:rgba(105,145,255,.08)}.dab-selection-count{font-size:12px;font-weight:700;margin-right:5px}
67
+ .dab-columns{display:flex;align-items:flex-start;gap:12px;overflow-x:auto;padding-bottom:12px}.dab-column{min-width:230px;flex:1;border:1px solid var(--dab-line);border-radius:12px;background:var(--dab-softer);padding:10px}.dab-column-head{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:3px 3px 9px;font-size:12px;font-weight:700}.dab-column-count{font-size:11px;font-weight:600;opacity:.6}.dab-issue{border:1px solid var(--dab-line);border-radius:10px;background:var(--dab-soft);padding:11px;margin:0 0 8px;cursor:pointer;transition:border-color .15s,transform .15s}.dab-issue:hover{border-color:rgba(105,145,255,.5);transform:translateY(-1px)}.dab-issue:focus-visible{outline:2px solid #7196ff;outline-offset:2px}.dab-issue-key{display:flex;align-items:center;gap:6px;font-size:11px;font-weight:700;color:#7a9cff}.dab-issue-key input{accent-color:#5984f3}.dab-issue-summary{font-weight:600;font-size:13px;line-height:1.4;margin-top:7px}.dab-issue-meta{display:block;margin-top:8px;font-size:11px;opacity:.6}.dab-empty{padding:36px 18px;text-align:center;border:1px dashed var(--dab-line);border-radius:12px;opacity:.65;font-size:13px}
68
+ .dab-detail{position:fixed;right:0;top:0;bottom:0;width:min(520px,90vw);overflow:auto;background:var(--dab-detail-bg,Canvas);color:CanvasText;border-left:1px solid var(--dab-line);padding:22px;z-index:50;box-shadow:0 0 24px #0004}.dab-detail-head{display:flex;justify-content:space-between;align-items:center;gap:12px}.dab-detail pre{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;opacity:.85;margin:18px 0}.dab-message{font-size:13px;opacity:.8;margin:10px 0!important}.dab-root svg{display:block}
69
+ @media(max-width:640px){.dab-root{padding:18px 16px 28px}.dab-hero{gap:11px}.dab-mode{display:none}.dab-field-grid{grid-template-columns:1fr}.dab-status-count{padding-left:10px}.dab-action-note{width:100%;margin-left:0}.dab-board-head{display:block}.dab-toolbar>*{min-width:0}.dab-project{flex:1}}
70
70
  `;
71
71
  document.head.appendChild(style);
72
72
  }
@@ -0,0 +1,28 @@
1
+ import { parentPort } from 'node:worker_threads';
2
+ import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv';
3
+ const MAX_SCHEMAS = 16;
4
+ const MAX_TASKS = 64;
5
+ const cache = new Map();
6
+ let tasks = 0;
7
+ parentPort?.on('message', ({ id, schema, value }) => {
8
+ let valid = false;
9
+ let error;
10
+ try {
11
+ let validator = cache.get(id);
12
+ if (!validator) {
13
+ if (!schema || ('$async' in schema && schema.$async))
14
+ throw new Error('expected a synchronous output schema');
15
+ // AJV also caches by remote $id. Compile new schema identities independently.
16
+ validator = new AjvJsonSchemaValidator().getValidator(schema);
17
+ cache.set(id, validator);
18
+ }
19
+ const result = validator(value);
20
+ valid = result.valid;
21
+ error = result.errorMessage;
22
+ }
23
+ catch (failure) {
24
+ error = failure instanceof Error ? failure.message : 'invalid output schema';
25
+ }
26
+ tasks++;
27
+ parentPort?.postMessage({ valid, error: error?.slice(0, 1000), cached: cache.has(id), retire: cache.size >= MAX_SCHEMAS || tasks >= MAX_TASKS });
28
+ });
@@ -0,0 +1,133 @@
1
+ import { Worker } from 'node:worker_threads';
2
+ // The SDK's validator API is synchronous. The bridge validates successful
3
+ // results against their discovered schema before they leave the bridge.
4
+ export const deferredOutputValidation = {
5
+ getValidator() {
6
+ return (data) => ({ valid: true, data: data, errorMessage: undefined });
7
+ },
8
+ };
9
+ const MAX_ACTIVE = 4;
10
+ const MAX_WAITING = 8;
11
+ const MAX_LIVE = 8;
12
+ const MAX_VALIDATION_MS = 5000;
13
+ const CANCELLED = 'atlassian: output validation timed out or was cancelled';
14
+ let active = 0;
15
+ const waiting = [];
16
+ async function acquire(signal) {
17
+ if (signal.aborted)
18
+ throw new Error(CANCELLED);
19
+ if (active < MAX_ACTIVE) {
20
+ active++;
21
+ return;
22
+ }
23
+ if (waiting.length >= MAX_WAITING)
24
+ throw new Error('atlassian: too many pending output validations');
25
+ await new Promise((resolve, reject) => {
26
+ const waiter = {
27
+ resume: () => { signal.removeEventListener('abort', waiter.cancel); resolve(); },
28
+ cancel: () => {
29
+ const index = waiting.indexOf(waiter);
30
+ if (index >= 0)
31
+ waiting.splice(index, 1);
32
+ reject(new Error(CANCELLED));
33
+ },
34
+ };
35
+ waiting.push(waiter);
36
+ signal.addEventListener('abort', waiter.cancel, { once: true });
37
+ });
38
+ }
39
+ const live = new Set();
40
+ const idle = [];
41
+ const schemaIds = new WeakMap();
42
+ let nextSchemaId = 1;
43
+ function spawn() {
44
+ // A retiring worker still counts until it exits. Native schema processing
45
+ // can delay V8's response to terminate(), so do not replace it indefinitely.
46
+ if (live.size >= MAX_LIVE)
47
+ throw new Error('atlassian: output validation workers are unavailable');
48
+ const worker = new Worker(new URL('./output-validator-worker.js', import.meta.url), {
49
+ execArgv: [],
50
+ resourceLimits: { maxOldGenerationSizeMb: 64, maxYoungGenerationSizeMb: 16, stackSizeMb: 4 },
51
+ });
52
+ const entry = { worker, schemas: new Set() };
53
+ live.add(entry);
54
+ worker.on('error', () => { }); // A worker can fail after its caller has cancelled.
55
+ worker.once('exit', () => {
56
+ live.delete(entry);
57
+ const index = idle.indexOf(entry);
58
+ if (index >= 0)
59
+ idle.splice(index, 1);
60
+ });
61
+ return entry;
62
+ }
63
+ function runTask(entry, schema, value, signal) {
64
+ const { worker, schemas } = entry;
65
+ let schemaId = schemaIds.get(schema);
66
+ if (schemaId === undefined) {
67
+ schemaId = nextSchemaId++;
68
+ schemaIds.set(schema, schemaId);
69
+ }
70
+ const id = schemaId;
71
+ return new Promise((resolve, reject) => {
72
+ const cleanup = () => {
73
+ worker.off('message', onResult);
74
+ worker.off('error', onError);
75
+ worker.off('exit', onExit);
76
+ signal.removeEventListener('abort', onAbort);
77
+ };
78
+ const onResult = (result) => {
79
+ cleanup();
80
+ if (result.cached)
81
+ schemas.add(id);
82
+ resolve(result);
83
+ };
84
+ const onError = (error) => { cleanup(); reject(error); };
85
+ const onExit = () => onError(new Error('atlassian: output validation worker exited'));
86
+ const onAbort = () => onError(new Error(CANCELLED));
87
+ worker.once('message', onResult);
88
+ worker.once('error', onError);
89
+ worker.once('exit', onExit);
90
+ if (signal.aborted) {
91
+ onAbort();
92
+ return;
93
+ }
94
+ signal.addEventListener('abort', onAbort, { once: true });
95
+ try {
96
+ worker.postMessage({ id, value, schema: schemas.has(id) ? undefined : schema });
97
+ }
98
+ catch (error) {
99
+ cleanup();
100
+ reject(error);
101
+ }
102
+ });
103
+ }
104
+ export async function validateOutput(schema, value, timeoutMs, caller) {
105
+ const signal = AbortSignal.any([caller, AbortSignal.timeout(Math.min(timeoutMs, MAX_VALIDATION_MS))]);
106
+ await acquire(signal);
107
+ let entry;
108
+ let result;
109
+ try {
110
+ if (signal.aborted)
111
+ throw new Error(CANCELLED);
112
+ entry = idle.pop() ?? spawn();
113
+ entry.worker.ref();
114
+ result = await runTask(entry, schema, value, signal);
115
+ signal.throwIfAborted();
116
+ if (!result.valid)
117
+ throw new Error(`atlassian: structured output does not match its schema: ${result.error ?? 'invalid output'}`);
118
+ }
119
+ finally {
120
+ if (entry) {
121
+ entry.worker.unref();
122
+ if (result && !result.retire && !signal.aborted)
123
+ idle.push(entry);
124
+ else
125
+ void entry.worker.terminate().catch(() => undefined);
126
+ }
127
+ const next = waiting.shift();
128
+ if (next)
129
+ next.resume();
130
+ else
131
+ active--;
132
+ }
133
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { jsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/types';
2
+ export declare const deferredOutputValidation: jsonSchemaValidator;
3
+ export declare function validateOutput(schema: object, value: unknown, timeoutMs: number, caller: AbortSignal): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lornatang/dsh-atlassian",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Connect Atlassian Cloud or self-hosted Jira and Confluence to DeepSeek Harness with tools and a Jira board.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -84,11 +84,12 @@
84
84
  "author": "Lornatang",
85
85
  "repository": {
86
86
  "type": "git",
87
- "url": "git+https://github.com/Lornatang/dsh-atlassian.git"
87
+ "url": "git+https://github.com/Lornatang/dsh-plugin.git",
88
+ "directory": "packages/integrations/dsh-atlassian"
88
89
  },
89
- "homepage": "https://github.com/Lornatang/dsh-atlassian#readme",
90
+ "homepage": "https://github.com/Lornatang/dsh-plugin/tree/main/packages/integrations/dsh-atlassian#readme",
90
91
  "bugs": {
91
- "url": "https://github.com/Lornatang/dsh-atlassian/issues"
92
+ "url": "https://github.com/Lornatang/dsh-plugin/issues"
92
93
  },
93
94
  "publishConfig": {
94
95
  "access": "public"