@lornatang/dsh-atlassian 0.1.11 → 0.1.13

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,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.13 - 2026-11-19
4
+
5
+ - Remove a duplicated request-target pre-check left over from the route hardening; malformed URLs still receive the same 400 response.
6
+ - Share one loopback-host predicate between the OAuth callback and the browser helper instead of two copies.
7
+ - Drop the unused OAuth provider logger option, the unused board availability helper and a redundant board options type.
8
+
9
+ ## 0.1.12 - 2026-11-18
10
+
11
+ - Re-arm the OAuth callback listener when authorization starts, so a callback port that becomes available after a failed bind no longer leaves the published redirect URI pointing at port 0.
12
+ - Publish the authorization URL only while a callback wait is armed, preventing a browser flow that would land on an unbound listener and fail with HTTP 400.
13
+ - Reset the observed token snapshot after a successful credential invalidation, so the built-in re-authorization no longer fails with a stale-credentials conflict.
14
+ - Hold the shared session lease until an in-flight token exchange settles instead of releasing it from the client error hook, avoiding a spurious invalid-session-lock failure.
15
+ - Validate the site label reported by the server before caching it.
16
+ - Reject malformed percent-encoded issue keys with a 400 response and bound request-body reads with a deadline.
17
+ - Reflect saved connection settings in the live configuration instead of only in the planner draft.
18
+ - Include a GitHub release archive; this release is also published to npm.
19
+
3
20
  ## 0.1.11 - 2026-11-17
4
21
 
5
22
  - Invalidate the cached Jira site whenever the connection is replaced and deduplicate concurrent site lookups, so a reconnect can never serve data from the previous site.
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.11/lornatang-dsh-atlassian-0.1.11.tgz`.
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.13/lornatang-dsh-atlassian-0.1.13.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.11/lornatang-dsh-atlassian-0.1.11.tgz`。
37
+ 也可以从 GitHub release 附带的压缩包安装同一版本:`dsh plugin --profile <name> add https://github.com/Lornatang/dsh-atlassian/releases/download/v0.1.13/lornatang-dsh-atlassian-0.1.13.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
@@ -31,7 +31,6 @@ export class JiraBoard {
31
31
  #resource;
32
32
  #pending;
33
33
  constructor(bridge) { this.#bridge = bridge; }
34
- available() { return !!this.#bridge.rawNameMatching(/searchJiraIssuesUsingJql/i); }
35
34
  get site() { return this.#resource?.epoch === (this.#bridge.epoch?.() ?? 0) ? this.#resource.site : undefined; }
36
35
  async #call(pattern, args, timeoutMs) {
37
36
  const name = this.#bridge.rawNameMatching(pattern);
package/lib/bridge.js CHANGED
@@ -56,10 +56,13 @@ export class AtlassianBridge {
56
56
  #flight;
57
57
  #refreshes = new Set();
58
58
  #waiters = new Set();
59
+ #waiting = false;
60
+ #allowLoopbackHttp;
59
61
  constructor(host, options) {
60
62
  this.#host = host;
61
63
  this.#options = options;
62
64
  const network = createCloudFetch(new URL(options.url));
65
+ this.#allowLoopbackHttp = network.allowLoopbackHttp;
63
66
  const active = () => {
64
67
  const operation = this.#operation.getStore();
65
68
  return !this.#disposed && (!operation || (operation.generation === this.#generation && !operation.signal.aborted));
@@ -129,10 +132,12 @@ export class AtlassianBridge {
129
132
  operation.releaseRefresh = undefined;
130
133
  };
131
134
  this.#flight = { owner: operation, done };
135
+ operation.exchangePending = true;
132
136
  operation.lease = lease;
133
137
  operation.releaseRefresh = release;
134
138
  signal.addEventListener('abort', release, { once: true });
135
139
  if (signal.aborted) {
140
+ operation.exchangePending = false;
136
141
  pending = false;
137
142
  release();
138
143
  throw new Error('atlassian: connection cancelled');
@@ -161,6 +166,7 @@ export class AtlassianBridge {
161
166
  throw error;
162
167
  }
163
168
  finally {
169
+ operation.exchangePending = false;
164
170
  pending = false;
165
171
  if (requested)
166
172
  release();
@@ -178,7 +184,7 @@ export class AtlassianBridge {
178
184
  throw new Error('atlassian: refresh is already in progress');
179
185
  };
180
186
  this.#provider = new AtlassianOAuthProvider({
181
- store: options.store, redirectUri: () => this.#callback.redirectUri, allowLoopbackHttp: network.allowLoopbackHttp, logger: host.logger,
187
+ store: options.store, redirectUri: () => this.#callback.redirectUri, allowLoopbackHttp: network.allowLoopbackHttp,
182
188
  onAuthorizationUrl: (url) => {
183
189
  if (!active())
184
190
  return;
@@ -197,6 +203,13 @@ export class AtlassianBridge {
197
203
  lease: () => this.#operation.getStore()?.lease,
198
204
  observedTokens: () => this.#operation.getStore()?.observedTokens,
199
205
  signal: () => this.#operation.getStore()?.signal,
206
+ resetObservation: () => {
207
+ const operation = this.#operation.getStore();
208
+ if (!operation)
209
+ return;
210
+ operation.observedTokens = undefined;
211
+ operation.refreshExpected = undefined;
212
+ },
200
213
  });
201
214
  }
202
215
  #newOperation() { return { generation: this.#generation, signal: this.#controller.signal }; }
@@ -234,7 +247,9 @@ export class AtlassianBridge {
234
247
  mismatch = true;
235
248
  }
236
249
  }
237
- return { status: this.#status, authorizationUrl: this.#url, site, siteMismatch: mismatch, toolCount: this.#tools.size, error: this.#error };
250
+ // Only publish a URL while a callback wait is armed; following it otherwise
251
+ // would reach an unbound callback listener and fail with an HTTP 400.
252
+ return { status: this.#status, authorizationUrl: this.#waiting ? this.#url : undefined, site, siteMismatch: mismatch, toolCount: this.#tools.size, error: this.#error };
238
253
  }
239
254
  rawNames() { return [...this.#tools.values()].map((value) => value.raw); }
240
255
  rawNameMatching(pattern) { return this.rawNames().find((name) => pattern.test(name)); }
@@ -276,6 +291,8 @@ export class AtlassianBridge {
276
291
  await this.#boot;
277
292
  if (this.#disposed || this.#status === 'ready')
278
293
  return this.snapshot();
294
+ if (!this.#callback.listening)
295
+ await this.#callback.listen(this.#options.redirectPort);
279
296
  if (this.#status === 'authorizing' && this.#url) {
280
297
  if (this.#options.autoOpenBrowser)
281
298
  await openInBrowser(this.#url);
@@ -311,8 +328,11 @@ export class AtlassianBridge {
311
328
  check();
312
329
  this.#setStatus('connecting');
313
330
  this.#error = undefined;
314
- const client = new Client({ name: 'dsh-atlassian', version: '0.1.11' });
315
- client.onerror = () => { this.#operation.getStore()?.releaseRefresh?.(); };
331
+ const client = new Client({ name: 'dsh-atlassian', version: '0.1.13' });
332
+ // Releasing the session lease here would race the SDK's saveTokens; an
333
+ // exchange that is still in flight is released by its own finally block.
334
+ client.onerror = () => { const operation = this.#operation.getStore(); if (operation?.exchangePending)
335
+ operation.releaseRefresh?.(); };
316
336
  const transport = new StreamableHTTPClientTransport(new URL(this.#options.url), { authProvider: this.#provider, fetch: this.#fetch });
317
337
  const send = transport.send.bind(transport);
318
338
  transport.send = (message, options) => {
@@ -346,14 +366,20 @@ export class AtlassianBridge {
346
366
  throw error;
347
367
  const state = this.#url ? new URL(this.#url).searchParams.get('state') ?? undefined : undefined;
348
368
  const waiting = this.#callback.waitForCode(this.#options.authorizationTimeoutMs, state);
369
+ this.#waiting = true;
349
370
  this.#setStatus('authorizing');
350
371
  if (open && this.#url && this.#options.autoOpenBrowser)
351
372
  void openInBrowser(this.#url);
352
- const callback = await waiting;
353
- check();
354
- await this.#operation.run(this.#newOperation(), () => auth(this.#provider, { serverUrl: this.#options.url, authorizationCode: callback.code, fetchFn: this.#fetch }));
355
- check();
356
- await this.#options.store.clearCredentialsIf(() => !this.#disposed && generation === this.#generation, undefined, undefined, this.#controller.signal, false, 'codeVerifier');
373
+ try {
374
+ const callback = await waiting;
375
+ check();
376
+ await this.#operation.run(this.#newOperation(), () => auth(this.#provider, { serverUrl: this.#options.url, authorizationCode: callback.code, fetchFn: this.#fetch }));
377
+ check();
378
+ await this.#options.store.clearCredentialsIf(() => !this.#disposed && generation === this.#generation, undefined, undefined, this.#controller.signal, false, 'codeVerifier');
379
+ }
380
+ finally {
381
+ this.#waiting = false;
382
+ }
357
383
  continue;
358
384
  }
359
385
  this.#client = client;
@@ -425,7 +451,9 @@ export class AtlassianBridge {
425
451
  const items = JSON.parse(display(result.content));
426
452
  const first = Array.isArray(items) ? items[0] : items;
427
453
  if (first && typeof first === 'object' && typeof first['url'] === 'string') {
428
- await this.#options.store.patch({ site: new URL(first['url']).host }, () => !this.#disposed && generation === this.#generation && !signal.aborted, undefined, undefined, signal);
454
+ const reported = new URL(first['url']);
455
+ secureUrl(reported, this.#allowLoopbackHttp);
456
+ await this.#options.store.patch({ site: reported.host }, () => !this.#disposed && generation === this.#generation && !signal.aborted, undefined, undefined, signal);
429
457
  }
430
458
  }
431
459
  catch { /* The connection can work without a site label. */ }
package/lib/config.js CHANGED
@@ -44,12 +44,12 @@ export function configureEndpoints(current, input) {
44
44
  }
45
45
  export const Config = z.object({
46
46
  mode: z.union(['cloud', 'server']).default('cloud'),
47
- serverName: z.string().default('atlassian'),
47
+ serverName: z.string().default('atlassian').pattern(/^[A-Za-z0-9_-]{1,64}$/),
48
48
  url: z.string().default(DEFAULT_CLOUD_URL),
49
49
  redirectPort: z.number().step(1).min(0).max(65535).default(3334),
50
- toolCallTimeoutMs: z.number().step(1).min(1).default(60000),
50
+ toolCallTimeoutMs: z.number().step(1).min(1).max(2_147_483_647).default(60000),
51
51
  expectedSite: z.string().default(''),
52
- authorizationTimeoutMs: z.number().step(1).min(1000).default(300000),
52
+ authorizationTimeoutMs: z.number().step(1).min(1000).max(2_147_483_647).default(300000),
53
53
  autoOpenBrowser: z.boolean().default(true),
54
54
  server: z.object({
55
55
  jiraUrl: z.string().default(''),
package/lib/index.js CHANGED
@@ -22,7 +22,7 @@ export function apply(ctx, config) {
22
22
  const connection = {
23
23
  snapshot: () => ({ ...config.server }),
24
24
  update: async (input) => {
25
- const next = configureEndpoints(config, input);
25
+ const next = Object.assign(config, configureEndpoints(config, input));
26
26
  const editor = scope.get('configEditor');
27
27
  const entry = editor?.entries().find((candidate) => candidate.options.id === 'atlassian');
28
28
  if (!editor || !entry)
package/lib/oauth.js CHANGED
@@ -75,17 +75,18 @@ function limitCloudResponse(response, allowEvents) {
75
75
  });
76
76
  return limited;
77
77
  }
78
- function isLoopback(url) {
79
- return ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname);
78
+ /** Loopback hosts may use plain HTTP for local MCP and OAuth endpoints. */
79
+ export function isLoopbackHost(hostname) {
80
+ return ['localhost', '127.0.0.1', '[::1]'].includes(hostname);
80
81
  }
81
82
  export function secureUrl(url, allowLoopbackHttp) {
82
- if (url.username || url.password || (url.protocol !== 'https:' && !(allowLoopbackHttp && url.protocol === 'http:' && isLoopback(url)))) {
83
+ if (url.username || url.password || (url.protocol !== 'https:' && !(allowLoopbackHttp && url.protocol === 'http:' && isLoopbackHost(url.hostname)))) {
83
84
  throw new Error('Cloud and OAuth endpoints must use HTTPS without embedded credentials');
84
85
  }
85
86
  }
86
87
  /** Restrict every discovered OAuth and MCP endpoint, including redirect targets. */
87
88
  export function createCloudFetch(serverUrl) {
88
- const allowLoopbackHttp = serverUrl.protocol === 'http:' && isLoopback(serverUrl);
89
+ const allowLoopbackHttp = serverUrl.protocol === 'http:' && isLoopbackHost(serverUrl.hostname);
89
90
  secureUrl(serverUrl, allowLoopbackHttp);
90
91
  return {
91
92
  allowLoopbackHttp,
@@ -104,9 +105,16 @@ export class CallbackServer {
104
105
  #port = 0;
105
106
  #pending;
106
107
  get redirectUri() { return `http://127.0.0.1:${this.#port}/callback`; }
108
+ get listening() { return this.#server?.listening === true; }
107
109
  async listen(preferredPort) {
108
- if (this.#server)
110
+ if (this.#server?.listening)
109
111
  return this.#port;
112
+ const stale = this.#server;
113
+ if (stale) {
114
+ this.#server = undefined;
115
+ this.cancelWait();
116
+ await new Promise((resolve) => { stale.close(() => resolve()); });
117
+ }
110
118
  const server = createServer((req, res) => {
111
119
  let url;
112
120
  try {
@@ -151,7 +159,10 @@ export class CallbackServer {
151
159
  this.#port = await bind(preferredPort);
152
160
  }
153
161
  catch (error) {
154
- if (error.code !== 'EADDRINUSE' || preferredPort === 0)
162
+ const code = error.code;
163
+ // A privileged or unavailable port must not leave redirectUri pointing at
164
+ // port 0; retry any bind failure that a dynamic port can avoid.
165
+ if (preferredPort === 0 || (code !== 'EADDRINUSE' && code !== 'EACCES' && code !== 'EADDRNOTAVAIL'))
155
166
  throw error;
156
167
  this.#port = await bind(0);
157
168
  }
@@ -215,6 +226,7 @@ export class AtlassianOAuthProvider {
215
226
  #lease;
216
227
  #observedTokens;
217
228
  #signal;
229
+ #resetObservation;
218
230
  constructor(options) {
219
231
  this.#store = options.store;
220
232
  this.#redirect = options.redirectUri;
@@ -227,6 +239,7 @@ export class AtlassianOAuthProvider {
227
239
  this.#lease = options.lease ?? (() => undefined);
228
240
  this.#observedTokens = options.observedTokens ?? (() => undefined);
229
241
  this.#signal = options.signal ?? (() => undefined);
242
+ this.#resetObservation = options.resetObservation ?? (() => undefined);
230
243
  }
231
244
  #check() { if (!this.#active())
232
245
  throw new Error('atlassian: connection cancelled'); }
@@ -276,14 +289,20 @@ export class AtlassianOAuthProvider {
276
289
  async invalidateCredentials(scope) {
277
290
  try {
278
291
  const expected = this.#refreshExpected() ?? this.#observedTokens();
292
+ let cleared = false;
279
293
  if (scope === 'all')
280
- await this.#store.clearCredentialsIf(this.#active, expected, this.#lease(), this.#signal(), true, 'tokens', 'clientInformation', 'codeVerifier');
294
+ cleared = await this.#store.clearCredentialsIf(this.#active, expected, this.#lease(), this.#signal(), true, 'tokens', 'clientInformation', 'codeVerifier');
281
295
  else if (scope === 'client')
282
- await this.#store.clearCredentialsIf(this.#active, expected, this.#lease(), this.#signal(), true, 'clientInformation');
296
+ cleared = await this.#store.clearCredentialsIf(this.#active, expected, this.#lease(), this.#signal(), true, 'clientInformation');
283
297
  else if (scope === 'tokens')
284
- await this.#store.clearCredentialsIf(this.#active, expected, this.#lease(), this.#signal(), true, 'tokens');
298
+ cleared = await this.#store.clearCredentialsIf(this.#active, expected, this.#lease(), this.#signal(), true, 'tokens');
285
299
  else if (scope === 'verifier')
286
- await this.#store.clearCredentialsIf(this.#active, expected, this.#lease(), this.#signal(), true, 'codeVerifier');
300
+ cleared = await this.#store.clearCredentialsIf(this.#active, expected, this.#lease(), this.#signal(), true, 'codeVerifier');
301
+ // Only a clear this operation actually performed invalidates its observation.
302
+ // If another process removed or replaced the session, the stale observation
303
+ // must keep refusing credential writes.
304
+ if (cleared && (scope === 'all' || scope === 'tokens'))
305
+ this.#resetObservation();
287
306
  }
288
307
  finally {
289
308
  this.#authFinished();
package/lib/open-url.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { spawn } from 'node:child_process';
2
+ import { isLoopbackHost } from './oauth.js';
2
3
  /** Open a browser without invoking a shell. */
3
4
  export function openInBrowser(value) {
4
5
  let url;
@@ -8,7 +9,7 @@ export function openInBrowser(value) {
8
9
  catch {
9
10
  return Promise.resolve(false);
10
11
  }
11
- if (url.protocol !== 'https:' && !(url.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname))) {
12
+ if (url.protocol !== 'https:' && !(url.protocol === 'http:' && isLoopbackHost(url.hostname))) {
12
13
  return Promise.resolve(false);
13
14
  }
14
15
  const command = process.platform === 'win32' ? 'rundll32.exe' : process.platform === 'darwin' ? 'open' : 'xdg-open';
package/lib/routes.js CHANGED
@@ -50,26 +50,26 @@ function required(input, key) {
50
50
  }
51
51
  export function registerRoutes(web, bridge, board, options, fence, connection) {
52
52
  return web.register({ kind: 'prefix', path: ROUTE_PREFIX, handler: async (req, res) => {
53
- if (!fence) {
54
- respond(res, 503, { ok: false, error: 'DSH connection service is unavailable' });
55
- return;
56
- }
57
- const rejection = fence.requestRejection(req);
58
- if (rejection !== undefined) {
59
- res.writeHead(rejection).end();
60
- return;
61
- }
62
- let url;
63
- try {
64
- url = new URL(req.url ?? '/', 'http://localhost');
65
- }
66
- catch {
67
- respond(res, 400, { ok: false, code: 'bad-request', error: 'Invalid request URL' });
68
- return;
69
- }
70
- const action = url.pathname.slice(ROUTE_PREFIX.length).replace(/^\//, '');
71
- const method = req.method ?? 'GET';
72
53
  try {
54
+ if (!fence) {
55
+ respond(res, 503, { ok: false, error: 'DSH connection service is unavailable' });
56
+ return;
57
+ }
58
+ const rejection = fence.requestRejection(req);
59
+ if (rejection !== undefined) {
60
+ res.writeHead(rejection).end();
61
+ return;
62
+ }
63
+ let url;
64
+ try {
65
+ url = new URL(req.url ?? '/', 'http://localhost');
66
+ }
67
+ catch {
68
+ respond(res, 400, { ok: false, error: 'Invalid request URL' });
69
+ return;
70
+ }
71
+ const action = url.pathname.slice(ROUTE_PREFIX.length).replace(/^\//, '');
72
+ const method = req.method ?? 'GET';
73
73
  if (method === 'GET' && action === 'status') {
74
74
  respond(res, 200, { ...bridge.snapshot(), ok: true, board: { jql: options.jql, limit: options.limit, promptTemplate: options.promptTemplate }, ...(connection ? { configuration: connection.snapshot() } : {}) });
75
75
  return;
@@ -77,9 +77,9 @@ export class ServerBridge {
77
77
  },
78
78
  };
79
79
  }
80
+ epoch() { return this.#generation; }
80
81
  rawNames() { return [...this.#operations.keys()]; }
81
82
  rawNameMatching(pattern) { return this.rawNames().find((name) => pattern.test(name)); }
82
- epoch() { return this.#generation; }
83
83
  async start() {
84
84
  if (this.#starting)
85
85
  return this.#starting;
package/lib/store.js CHANGED
@@ -257,7 +257,13 @@ export class SessionStore {
257
257
  this.#value = next;
258
258
  }, lease, signal);
259
259
  }
260
+ /**
261
+ * Returns whether the guard matched and the credentials were actually cleared:
262
+ * a stale observation must keep refusing writes when another process removed
263
+ * the session first.
264
+ */
260
265
  async clearCredentialsIf(active, expected, lease, signal, guard, ...fields) {
266
+ let cleared = false;
261
267
  await this.#withLease(async () => {
262
268
  if (!active())
263
269
  throw new Error('atlassian: connection cancelled');
@@ -269,7 +275,9 @@ export class SessionStore {
269
275
  delete next[field];
270
276
  await this.#flush(next);
271
277
  this.#value = next;
278
+ cleared = true;
272
279
  }, lease, signal);
280
+ return cleared;
273
281
  }
274
282
  async clear(...fields) {
275
283
  await this.#withLease(async () => {
@@ -63,7 +63,6 @@ export declare class BoardError extends Error {
63
63
  export declare class JiraBoard {
64
64
  #private;
65
65
  constructor(bridge: ToolBridge);
66
- available(): boolean;
67
66
  get site(): string | undefined;
68
67
  cloudId(): Promise<string>;
69
68
  load(query: BoardQuery): Promise<BoardPayload>;
@@ -13,6 +13,8 @@ export interface AuthorizationCallback {
13
13
  }
14
14
  export declare class RedirectRegistrationChanged extends Error {
15
15
  }
16
+ /** Loopback hosts may use plain HTTP for local MCP and OAuth endpoints. */
17
+ export declare function isLoopbackHost(hostname: string): boolean;
16
18
  export declare function secureUrl(url: URL, allowLoopbackHttp: boolean): void;
17
19
  /** Restrict every discovered OAuth and MCP endpoint, including redirect targets. */
18
20
  export declare function createCloudFetch(serverUrl: URL): {
@@ -22,6 +24,7 @@ export declare function createCloudFetch(serverUrl: URL): {
22
24
  export declare class CallbackServer {
23
25
  #private;
24
26
  get redirectUri(): string;
27
+ get listening(): boolean;
25
28
  listen(preferredPort: number): Promise<number>;
26
29
  waitForCode(timeoutMs: number, state: string | undefined, signal?: AbortSignal): Promise<AuthorizationCallback>;
27
30
  cancelWait(): void;
@@ -34,7 +37,6 @@ export declare class AtlassianOAuthProvider implements OAuthClientProvider {
34
37
  redirectUri: () => string;
35
38
  onAuthorizationUrl: (url: string) => void;
36
39
  allowLoopbackHttp: boolean;
37
- logger: Logger;
38
40
  active?: () => boolean;
39
41
  tokenRead?: (tokens: OAuthTokens | undefined) => void;
40
42
  refreshExpected?: () => OAuthTokens | undefined;
@@ -42,6 +44,7 @@ export declare class AtlassianOAuthProvider implements OAuthClientProvider {
42
44
  lease?: () => SessionLease | undefined;
43
45
  observedTokens?: () => OAuthTokens | undefined;
44
46
  signal?: () => AbortSignal | undefined;
47
+ resetObservation?: () => void;
45
48
  });
46
49
  get redirectUrl(): string;
47
50
  get clientMetadata(): OAuthClientMetadata;
@@ -1,5 +1,6 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
2
  import type { BridgeSnapshot } from './bridge.js';
3
+ import type { BoardConfig } from './config.js';
3
4
  import { type JiraBoard, type ToolBridge } from './board.js';
4
5
  export declare const ROUTE_PREFIX = "/plugins/atlassian";
5
6
  export interface RouteRegistrar {
@@ -12,12 +13,6 @@ export interface RouteRegistrar {
12
13
  export interface RequestFence {
13
14
  requestRejection(req: IncomingMessage): number | undefined;
14
15
  }
15
- export interface BoardRouteOptions {
16
- jql: string;
17
- limit: number;
18
- timeoutMs: number;
19
- promptTemplate: string;
20
- }
21
16
  export interface EditableConnection {
22
17
  snapshot(): {
23
18
  jiraUrl: string;
@@ -36,4 +31,4 @@ export interface PluginBridge extends ToolBridge {
36
31
  start(): Promise<void>;
37
32
  dispose(): Promise<void>;
38
33
  }
39
- export declare function registerRoutes(web: RouteRegistrar, bridge: PluginBridge, board: JiraBoard, options: BoardRouteOptions, fence: RequestFence | undefined, connection?: EditableConnection): () => void;
34
+ export declare function registerRoutes(web: RouteRegistrar, bridge: PluginBridge, board: JiraBoard, options: BoardConfig, fence: RequestFence | undefined, connection?: EditableConnection): () => void;
@@ -12,9 +12,9 @@ export declare class ServerBridge {
12
12
  timeoutMs: number;
13
13
  });
14
14
  snapshot(): BridgeSnapshot;
15
+ epoch(): number;
15
16
  rawNames(): readonly string[];
16
17
  rawNameMatching(pattern: RegExp): string | undefined;
17
- epoch(): number;
18
18
  start(): Promise<void>;
19
19
  authorize(input?: Args): Promise<BridgeSnapshot>;
20
20
  disconnect(): Promise<BridgeSnapshot>;
@@ -41,7 +41,12 @@ export declare class SessionStore {
41
41
  /** Re-register only when a new interactive flow needs a different callback. */
42
42
  rebindRedirect(actual: string, expected: OAuthTokens | undefined, active: () => boolean, lease?: SessionLease, signal?: AbortSignal): Promise<void>;
43
43
  saveTokens(tokens: OAuthTokens, active: () => boolean, expected?: OAuthTokens, lease?: SessionLease, signal?: AbortSignal, guard?: boolean): Promise<void>;
44
- clearCredentialsIf(active: () => boolean, expected: OAuthTokens | undefined, lease: SessionLease | undefined, signal: AbortSignal | undefined, guard: boolean, ...fields: readonly (keyof StoredSession)[]): Promise<void>;
44
+ /**
45
+ * Returns whether the guard matched and the credentials were actually cleared:
46
+ * a stale observation must keep refusing writes when another process removed
47
+ * the session first.
48
+ */
49
+ clearCredentialsIf(active: () => boolean, expected: OAuthTokens | undefined, lease: SessionLease | undefined, signal: AbortSignal | undefined, guard: boolean, ...fields: readonly (keyof StoredSession)[]): Promise<boolean>;
45
50
  clear(...fields: readonly (keyof StoredSession)[]): Promise<void>;
46
51
  destroy(): Promise<void>;
47
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lornatang/dsh-atlassian",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
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",
@@ -78,7 +78,7 @@
78
78
  "@deepseek-ai/dsh-llm": "0.2.2-rc.2",
79
79
  "@deepseek-ai/dsh-tools": "0.2.2-rc.2",
80
80
  "@types/node": "^22.18.0",
81
- "@types/react": "^18.3.31",
81
+ "@types/react": "^19.3.0",
82
82
  "typescript": "^5.9.0"
83
83
  },
84
84
  "author": "Lornatang",