@lornatang/dsh-atlassian 0.1.17 → 0.1.18

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.18 - 2026-11-23
4
+
5
+ - Use host authentication for connector routes. Requires DeepSeek Harness 0.2.3-alpha.2 or newer.
6
+
3
7
  ## 0.1.17 - 2026-11-23
4
8
 
5
9
  - Validate connector tool output in a worker and enforce limits on discovered tools and returned data.
package/README.md CHANGED
@@ -11,6 +11,8 @@ English | [中文](README.zh.md)
11
11
 
12
12
  `dsh-atlassian` connects a dsh profile to Atlassian Cloud or a self-hosted Jira and Confluence pair. Cloud mode holds an OAuth 2.1 session with the Atlassian remote MCP server and registers the tools it advertises for agent sessions; server mode registers a fixed REST tool set. It adds an Atlassian settings section and a Jira board panel to the Web client. Add or remove it with `dsh plugin --profile <name> add|remove @lornatang/dsh-atlassian`. The boundary: one connection per row, unencrypted credentials under the profile data directory, and a loopback OAuth callback.
13
13
 
14
+ Requires DeepSeek Harness `0.2.3-alpha.2` or later.
15
+
14
16
  ## Table of Contents
15
17
 
16
18
  - [Use this package](#use-this-package)
@@ -56,7 +58,7 @@ The client half adds three rows, all owned and rendered by this package inside s
56
58
  - `sidebar.panellist`, id `jira-board`, order 40, label `Jira` — the sidebar icon that opens the board.
57
59
  - `main`, key `jira-board` — the board itself: search, project filter, JQL form, one column per issue status, issue detail with transition buttons, and Send to current session / Send to new session / Copy prompt.
58
60
 
59
- The routes behind those rows live at the fixed prefix `/plugins/atlassian` (`status`, `configure`, `connect`, `disconnect`, `debug-tools`, `board`, `projects`, `transition`, `issue/<key>`, `issue/<key>/transitions`). They answer only when the DSH `connection` service is present and its request fence admits the request; without the service the routes return 503.
61
+ The routes behind those rows live at the fixed prefix `/plugins/atlassian` (`status`, `configure`, `connect`, `disconnect`, `debug-tools`, `board`, `projects`, `transition`, `issue/<key>`, `issue/<key>/transitions`). These routes require an authenticated DSH peer.
60
62
 
61
63
  ### Configuration
62
64
 
@@ -107,7 +109,7 @@ Service URLs go through the same validation when they are saved in Settings: the
107
109
 
108
110
  The layer is a single patch row: an `insert` of `atlassian` carrying the Cloud defaults. The patch has no platform gate; the client half is declared in `package.json` (`dsh.client.platform: web`, with the two slot packages injected), so a headless profile loads the host half only and the settings and board rows appear in a Web profile.
109
111
 
110
- `apply` selects the bridge from `mode` — `AtlassianBridge` for Cloud, `ServerBridge` for self-hosted — derives the credential identity (the configured URL for Cloud, `server:<jiraUrl>` and `<confluenceUrl>` joined by a NUL for self-hosted), builds a `SessionStore` for `sessionFileFor(serverName, identity, patchPath)`, creates the board, and registers the routes against `webServer` or `httpServer`. Every route sits behind the `connection` service's request fence; when the service appears after the plugin, an `internal/service` listener re-binds the routes. `void bridge.start()` runs in the background and logs failures.
112
+ `apply` selects the bridge from `mode` — `AtlassianBridge` for Cloud, `ServerBridge` for self-hosted — derives the credential identity (the configured URL for Cloud, `server:<jiraUrl>` and `<confluenceUrl>` joined by a NUL for self-hosted), builds a `SessionStore` for `sessionFileFor(serverName, identity, patchPath)`, creates the board, and registers authenticated routes on `webServer`. An `internal/service` listener updates the bindings when the web service changes. `void bridge.start()` runs in the background and logs failures.
111
113
 
112
114
  The Cloud path uses OAuth 2.1 with PKCE through the MCP SDK: a callback server on `127.0.0.1:<redirectPort>` receives `/callback`, `createCloudFetch` rejects every non-HTTPS endpoint (loopback HTTP excepted) and caps response bodies and SSE events at 10 MiB, and after `connect` the bridge paginates `tools/list` (at most 100 pages and 1000 tools) and registers each definition. The site label comes from `getAccessibleAtlassianResources`.
113
115
 
@@ -126,7 +128,7 @@ The client half registers into `settings.section`, `sidebar.panellist` and `main
126
128
  | `src/oauth.ts` | PKCE provider, loopback callback server, HTTPS-only fetch wrapper, response size limits. |
127
129
  | `src/store.ts` | Profile-scoped credential file: naming, ownership and symlink checks, atomic `0600` writes. |
128
130
  | `src/board.ts` | `JiraBoard`: JQL search, site resolution, issue detail, transitions, projects. |
129
- | `src/routes.ts` | `/plugins/atlassian` handlers behind the DSH request fence. |
131
+ | `src/routes.ts` | `/plugins/atlassian` handlers authenticated by the DSH host. |
130
132
  | `src/open-url.ts` | Browser launch for the authorization page, HTTPS or loopback HTTP only. |
131
133
  | `src/client/index.tsx` | Settings section, sidebar entry and board panel; calls the routes above. |
132
134
  | `tests/*.test.mjs` | Bridge, configuration, security, server and browser suites. |
@@ -176,6 +178,6 @@ These constraints describe what the layer does not bridge and where a profile ha
176
178
 
177
179
  `npm run build` cleans `lib/`, compiles the host and client trees with `tsc`, then bundles `src/client/index.tsx` into `lib/client.js` with `scripts/bundle-client.mjs`. `npm test` runs that build and then `node --test tests/*.test.mjs`, which includes the Chrome-backed browser suite; `npm run typecheck` runs both `tsc --noEmit` passes. `npm run test:dsh` runs `scripts/verify-dsh.mjs`, which packs the plugin with `npm pack` and drives a real `dsh` binary (default `dsh`, overridable with `DSH_TEST_BINARY`) through profile creation, `plugin add`, the authenticated Web route, a self-hosted connect, a board load and `plugin remove`, then runs the browser check. The environment variables the script reads are `DSH_TEST_BINARY`, `DSH_TEST_MODE=server`, `DSH_TEST_UPGRADE_FROM=legacy-fixture`, `DSH_TEST_LANGUAGE` and `CHROME_PATH`.
178
180
 
179
- `lib/` is committed and CI runs `git diff --exit-code -- lib`, so rebuild and include `lib/` with any source change. Node.js 22.19 or newer is required (`engines.node`), the peer dependency is `@deepseek-ai/cordis ~4.1.0`, and the optional `dsh-tools`/`dsh-llm` development dependencies track the `0.2.2-rc.2` DSH line. The stored file is `data/atlassian-bridge-<serverName>-<first 12 hex of sha256(identity)>.json` with `version: 1`; changing the identity computation or the file naming orphans saved credentials. `tests/language.test.mjs` scans `README.md`, `CHANGELOG.md`, `NOTICE`, `src/` and `lib/` for CJK characters, so English text belongs in `README.md` and Chinese only in `README.zh.md`.
181
+ `lib/` is committed and CI runs `git diff --exit-code -- lib`, so rebuild and include `lib/` with any source change. Node.js 22.19 or newer is required (`engines.node`), the peer dependency is `@deepseek-ai/cordis ~4.1.0`, and the optional `dsh-tools` and `dsh-llm` development dependencies are declared with `*`. The stored file is `data/atlassian-bridge-<serverName>-<first 12 hex of sha256(identity)>.json` with `version: 1`; changing the identity computation or the file naming orphans saved credentials. `tests/language.test.mjs` scans `README.md`, `CHANGELOG.md`, `NOTICE`, `src/` and `lib/` for CJK characters, so English text belongs in `README.md` and Chinese only in `README.zh.md`.
180
182
 
181
183
  </details>
package/README.zh.md CHANGED
@@ -11,6 +11,8 @@ kind: "package-bundle"
11
11
 
12
12
  `dsh-atlassian` 将 dsh profile 连接到 Atlassian Cloud,或连接到一对自建 Jira、Confluence 服务。Cloud 模式与 Atlassian 远程 MCP 服务器保持 OAuth 2.1 会话,并把它向 agent 会话公布的每个工具注册进来;server 模式注册一组固定的 REST 工具。它会在 Web 客户端中加入 Atlassian 设置区与 Jira 看板面板。安装或移除使用 `dsh plugin --profile <name> add|remove @lornatang/dsh-atlassian`。边界:每行一个连接,凭据以未加密形式存放在 profile 数据目录下,OAuth 回调走回环地址。
13
13
 
14
+ 需要 DeepSeek Harness `0.2.3-alpha.2` 或更新版本。
15
+
14
16
  ## 目录
15
17
 
16
18
  - [使用本包](#use-this-package)
@@ -56,7 +58,7 @@ Cloud 模式下工具面来自远程服务器的目录:MCP `tools/list` 返回
56
58
  - `sidebar.panellist`,id `jira-board`,order 40,label `Jira`——打开看板的侧边栏图标。
57
59
  - `main`,key `jira-board`——看板本身:搜索、项目过滤、JQL 表单、按 issue 状态分列、带流转按钮的 issue 详情,以及 Send to current session / Send to new session / Copy prompt。
58
60
 
59
- 这些行背后的路由位于固定前缀 `/plugins/atlassian`(`status`、`configure`、`connect`、`disconnect`、`debug-tools`、`board`、`projects`、`transition`、`issue/<key>`、`issue/<key>/transitions`)。只有在 DSH `connection` 服务存在且其请求栅栏放行时它们才响应;没有该服务时路由返回 503。
61
+ 这些行背后的路由位于固定前缀 `/plugins/atlassian`(`status`、`configure`、`connect`、`disconnect`、`debug-tools`、`board`、`projects`、`transition`、`issue/<key>`、`issue/<key>/transitions`)。这些路由只接受 DSH 宿主已认证的会话请求。
60
62
 
61
63
  ### 配置
62
64
 
@@ -107,7 +109,7 @@ profile 补丁中有一条 `atlassian` 记录。随包提供的层以 Cloud 默
107
109
 
108
110
  本层只有一条补丁记录:一个插入 `atlassian` 的 `insert`,并带上 Cloud 默认值。补丁没有平台门控;客户端部分在 `package.json` 中声明(`dsh.client.platform: web`,并注入两个 slot 包),因此无界面 profile 只加载宿主部分,设置区与看板行只出现在 Web profile 中。
109
111
 
110
- `apply` 按 `mode` 选择桥接——Cloud 用 `AtlassianBridge`,自建用 `ServerBridge`——推导凭据身份(Cloud 为配置的 URL,自建为 `server:<jiraUrl>` 与 `<confluenceUrl>` 用 NUL 连接),用 `sessionFileFor(serverName, identity, patchPath)` 构造 `SessionStore`,创建看板,并把路由注册到 `webServer` 或 `httpServer`。所有路由都在 `connection` 服务的请求栅栏之后;若该服务在插件之后出现,`internal/service` 监听器会重新绑定路由。`void bridge.start()` 在后台运行并记录失败。
112
+ `apply` 按 `mode` 选择桥接——Cloud 用 `AtlassianBridge`,自建用 `ServerBridge`——推导凭据身份(Cloud 为配置的 URL,自建为 `server:<jiraUrl>` 与 `<confluenceUrl>` 用 NUL 连接),用 `sessionFileFor(serverName, identity, patchPath)` 构造 `SessionStore`,创建看板,并在 `webServer` 上注册需要鉴权的路由。Web 服务变化时,`internal/service` 监听器会更新绑定。`void bridge.start()` 在后台运行并记录失败。
111
113
 
112
114
  Cloud 路径通过 MCP SDK 使用带 PKCE 的 OAuth 2.1:`127.0.0.1:<redirectPort>` 上的回调服务器接收 `/callback`,`createCloudFetch` 拒绝所有非 HTTPS 端点(回环 HTTP 除外),并把响应体与 SSE 事件限制在 10 MiB;`connect` 之后桥接会分页读取 `tools/list`(最多 100 页、1000 个工具)并注册每个定义。站点标签来自 `getAccessibleAtlassianResources`。
113
115
 
@@ -126,7 +128,7 @@ Cloud 路径通过 MCP SDK 使用带 PKCE 的 OAuth 2.1:`127.0.0.1:<redirectPo
126
128
  | `src/oauth.ts` | PKCE provider、回环回调服务器、仅 HTTPS 的 fetch 包装、响应大小限制。 |
127
129
  | `src/store.ts` | profile 范围的凭据文件:命名、属主与符号链接检查、原子 `0600` 写入。 |
128
130
  | `src/board.ts` | `JiraBoard`:JQL 搜索、站点解析、issue 详情、流转、项目。 |
129
- | `src/routes.ts` | DSH 请求栅栏之后的 `/plugins/atlassian` 处理器。 |
131
+ | `src/routes.ts` | 由 DSH 宿主鉴权的 `/plugins/atlassian` 处理器。 |
130
132
  | `src/open-url.ts` | 授权页面的浏览器启动,仅 HTTPS 或回环 HTTP。 |
131
133
  | `src/client/index.tsx` | 设置区、侧边栏入口与看板面板;调用上面的路由。 |
132
134
  | `tests/*.test.mjs` | 桥接、配置、安全、服务端与浏览器测试套件。 |
@@ -176,6 +178,6 @@ Cloud 路径通过 MCP SDK 使用带 PKCE 的 OAuth 2.1:`127.0.0.1:<redirectPo
176
178
 
177
179
  `npm run build` 清理 `lib/`,用 `tsc` 编译宿主与客户端两个树,再用 `scripts/bundle-client.mjs` 把 `src/client/index.tsx` 打包成 `lib/client.js`。`npm test` 先执行该构建,再执行 `node --test tests/*.test.mjs`,其中包含依赖 Chrome 的浏览器套件;`npm run typecheck` 执行两次 `tsc --noEmit`。`npm run test:dsh` 执行 `scripts/verify-dsh.mjs`:用 `npm pack` 打包插件,并驱动真实的 `dsh` 二进制(默认 `dsh`,可用 `DSH_TEST_BINARY` 覆盖)依次完成创建 profile、`plugin add`、带认证的 Web 路由请求、自建连接、看板加载与 `plugin remove`,最后执行浏览器检查。脚本读取的环境变量是 `DSH_TEST_BINARY`、`DSH_TEST_MODE=server`、`DSH_TEST_UPGRADE_FROM=legacy-fixture`、`DSH_TEST_LANGUAGE` 与 `CHROME_PATH`。
178
180
 
179
- `lib/` 已提交,CI 会执行 `git diff --exit-code -- lib`,因此任何源码改动都要重新构建并一并提交 `lib/`。需要 Node.js 22.19 或更新版本(`engines.node`),peer 依赖是 `@deepseek-ai/cordis ~4.1.0`,可选的 `dsh-tools`/`dsh-llm` 开发依赖跟随 `0.2.2-rc.2` 的 DSH 版本线。存储文件为 `data/atlassian-bridge-<serverName>-<sha256(identity) 前 12 个十六进制字符>.json`,内容带 `version: 1`;修改身份计算或文件命名会让已保存的凭据失配。`tests/language.test.mjs` 会扫描 `README.md`、`CHANGELOG.md`、`NOTICE`、`src/` 与 `lib/` 中的 CJK 字符,因此英文写在 `README.md`,中文只能放在 `README.zh.md`。
181
+ `lib/` 已提交,CI 会执行 `git diff --exit-code -- lib`,因此任何源码改动都要重新构建并一并提交 `lib/`。需要 Node.js 22.19 或更新版本(`engines.node`),peer 依赖是 `@deepseek-ai/cordis ~4.1.0`,可选的 `dsh-tools` 和 `dsh-llm` 开发依赖声明为 `*`。存储文件为 `data/atlassian-bridge-<serverName>-<sha256(identity) 前 12 个十六进制字符>.json`,内容带 `version: 1`;修改身份计算或文件命名会让已保存的凭据失配。`tests/language.test.mjs` 会扫描 `README.md`、`CHANGELOG.md`、`NOTICE`、`src/` 与 `lib/` 中的 CJK 字符,因此英文写在 `README.md`,中文只能放在 `README.zh.md`。
180
182
 
181
183
  </details>
package/lib/index.js CHANGED
@@ -38,20 +38,21 @@ export function apply(ctx, config) {
38
38
  ctx.effect(() => () => bridge.dispose(), 'atlassian:connection');
39
39
  ctx.effect(() => {
40
40
  let dispose;
41
- let secured = false;
41
+ let boundWeb;
42
42
  const bind = () => {
43
- const web = (scope.get('webServer') ?? scope.get('httpServer'));
44
- if (!web)
45
- return;
46
- const fence = scope.get('connection');
47
- if (dispose && (secured || !fence))
43
+ const web = scope.get('webServer');
44
+ const webIdentity = web && (Reflect.get(web, Symbol.for('cordis.original')) ?? web);
45
+ if (webIdentity === boundWeb)
48
46
  return;
49
47
  dispose?.();
50
- dispose = registerRoutes(web, bridge, board, config.board, fence, connection);
51
- secured = !!fence;
48
+ boundWeb = webIdentity;
49
+ dispose = web ? registerRoutes(web, bridge, board, config.board, connection) : undefined;
52
50
  };
53
51
  bind();
54
- const off = scope.on?.('internal/service', bind);
52
+ const off = scope.on?.('internal/service', (name) => {
53
+ if (!name || name === 'webServer')
54
+ bind();
55
+ });
55
56
  return () => { off?.(); dispose?.(); };
56
57
  }, 'atlassian:routes');
57
58
  void bridge.start().catch((error) => ctx.logger.error(`atlassian: ${String(error)}`));
package/lib/routes.js CHANGED
@@ -48,18 +48,13 @@ function required(input, key) {
48
48
  throw new BoardError('bad-request', `Missing ${key}`);
49
49
  return value;
50
50
  }
51
- export function registerRoutes(web, bridge, board, options, fence, connection) {
52
- return web.register({ kind: 'prefix', path: ROUTE_PREFIX, handler: async (req, res) => {
51
+ export function registerRoutes(web, bridge, board, options, connection) {
52
+ return web.register({ kind: 'prefix', path: ROUTE_PREFIX, auth: 'required', handler: async (req, res, peer) => {
53
+ if (!peer || peer.signal.aborted) {
54
+ res.writeHead(401).end();
55
+ return;
56
+ }
53
57
  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
58
  let url;
64
59
  try {
65
60
  url = new URL(req.url ?? '/', 'http://localhost');
@@ -5,14 +5,14 @@ import { type JiraBoard, type ToolBridge } from './board.js';
5
5
  export declare const ROUTE_PREFIX = "/plugins/atlassian";
6
6
  export interface RouteRegistrar {
7
7
  register(route: {
8
- kind: 'exact' | 'prefix';
8
+ kind: 'prefix';
9
9
  path: string;
10
- handler: (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
10
+ auth: 'required';
11
+ handler: (req: IncomingMessage, res: ServerResponse, peer?: {
12
+ signal: AbortSignal;
13
+ }) => void | Promise<void>;
11
14
  }): () => void;
12
15
  }
13
- export interface RequestFence {
14
- requestRejection(req: IncomingMessage): number | undefined;
15
- }
16
16
  export interface EditableConnection {
17
17
  snapshot(): {
18
18
  jiraUrl: string;
@@ -31,4 +31,4 @@ export interface PluginBridge extends ToolBridge {
31
31
  start(): Promise<void>;
32
32
  dispose(): Promise<void>;
33
33
  }
34
- export declare function registerRoutes(web: RouteRegistrar, bridge: PluginBridge, board: JiraBoard, options: BoardConfig, fence: RequestFence | undefined, connection?: EditableConnection): () => void;
34
+ export declare function registerRoutes(web: RouteRegistrar, bridge: PluginBridge, board: JiraBoard, options: BoardConfig, connection?: EditableConnection): () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lornatang/dsh-atlassian",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
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",
@@ -18,7 +18,7 @@
18
18
  "type": "module",
19
19
  "engines": {
20
20
  "node": ">=22.19",
21
- "dsh": "*"
21
+ "dsh": ">=0.2.3-alpha.2"
22
22
  },
23
23
  "main": "lib/index.js",
24
24
  "types": "lib/types/index.d.ts",