@sidequest-007/dsh-atlas 1.0.12 → 1.2.2
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 +124 -0
- package/README.md +30 -2
- package/README.zh.md +27 -2
- package/assets/brand/atlas-icon-128.png +0 -0
- package/assets/brand/atlas-icon-32.png +0 -0
- package/assets/brand/atlas-icon-512.png +0 -0
- package/assets/brand/atlas-icon-64.png +0 -0
- package/assets/diagrams/atlas-social-1280x640.png +0 -0
- package/dsh.plugin.json +1 -1
- package/icon.svg +13 -0
- package/lib/client.js +91 -23
- package/lib/index.js +85 -8
- package/lib/types/client/FilesDock.d.ts +19 -1
- package/lib/types/client/source.d.ts +11 -1
- package/lib/types/runtime.d.ts +1 -1
- package/lib/types/store.d.ts +30 -0
- package/package.json +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,129 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.2] - 2026-11-21
|
|
4
|
+
|
|
5
|
+
`1.2.1` was cut but never published, so this release carries it too: the marks,
|
|
6
|
+
the settings document and the folder ledger are one version again.
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- **A settings document that says `enabled: false` is no longer silent.** Releases
|
|
11
|
+
since DSH `0.2.2` keep `at-file` in `<harness home>/atlas/at-file.json`; when that
|
|
12
|
+
document arrives switched off (a migrated profile, a hand edit), every host method
|
|
13
|
+
refuses and the composer merely shows nothing — indistinguishable from "the plugin
|
|
14
|
+
does nothing". The plugin now names the file and the switch once at load.
|
|
15
|
+
- `scripts/migrate-legacy-settings.mjs` copies data only: a fresh target starts with
|
|
16
|
+
`enabled: true` instead of inheriting a switch from a profile that no longer reads it.
|
|
17
|
+
|
|
18
|
+
## [1.2.1 (unpublished)] - 2026-11-21
|
|
19
|
+
|
|
20
|
+
The out-of-workspace folder you pick shows up in the very next `@` query, and the
|
|
21
|
+
plugin now has a brand mark of its own instead of the panel's default artwork.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- `icon.svg` (36 × 36 grid, `@` built from strokes, violet → blue) plus
|
|
26
|
+
`assets/brand/atlas-icon-{32,64,128,512}.png`; the package declares `icon`, so
|
|
27
|
+
Plugin Manager and Settings draw the same mark as the README and the social card.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- A profile whose settings service has no plugin namespace (the shape every release
|
|
32
|
+
since DSH `0.2.2` ships) kept the whole `at-file` section — switches, filters, the
|
|
33
|
+
recent-file list, the pick counters and the out-of-workspace ledger — in memory
|
|
34
|
+
only, so a restart forgot everything and the ledger stayed invisible to `@`.
|
|
35
|
+
The section now lives in `<harness home>/atlas/at-file.json`, written atomically
|
|
36
|
+
and validated through the same schema; `scripts/migrate-legacy-settings.mjs`
|
|
37
|
+
copies the rows an older `settings.yaml` still holds.
|
|
38
|
+
- Picking an out-of-workspace folder (native picker, the bundled picker, or a row in
|
|
39
|
+
the `@` menu) writes it to `at-file.externalRefs` immediately and invalidates that
|
|
40
|
+
session's external scope, instead of waiting for the next send to record it. The
|
|
41
|
+
mixed `@` view also awaits a cold scope once, so the first `@dsh` of a session can
|
|
42
|
+
already list the folder. Case-insensitive matching was never the problem — `dsh`,
|
|
43
|
+
`DSH` and `dSh` all hit `DSH-Atlas/`.
|
|
44
|
+
- The folder fallback after a sidebar failure opened the first-click target again,
|
|
45
|
+
recursing until the renderer ran out of heap; it falls back to the file manager.
|
|
46
|
+
|
|
47
|
+
## [1.2.0] - 2026-11-20
|
|
48
|
+
|
|
49
|
+
The two lines that were being released in parallel — the history/composer line
|
|
50
|
+
(`1.1.0`) and the reference-quality line (`1.0.10`–`1.0.12`) — are one release again.
|
|
51
|
+
`1.1.0` was never published, so anyone on `latest` was getting `1.0.12`: line-range
|
|
52
|
+
pricing and the restored first-screen definition, but not the `Esc` ladder, the
|
|
53
|
+
palette, the folder picker or the plugin-registered `@` categories.
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- **`Esc` walks the session back, one turn at a time.** The composer turns into a ladder, a
|
|
58
|
+
frame cursor shows where you stand (`第 3 / 11 轮`), and `Enter` hands that turn back for
|
|
59
|
+
reuse. One stop per turn — the same unit the GUI's own turn rail counts, so the two
|
|
60
|
+
numbers can never disagree.
|
|
61
|
+
- **`Ctrl+Shift+H`** (and `Ctrl+H`) opens a searchable palette over the same history.
|
|
62
|
+
- **`@` references every source**: files, folders, skills, past sessions, installed plugins,
|
|
63
|
+
workspace git changes, and any category a third-party plugin registers through `ctx.atlas`.
|
|
64
|
+
Paths outside the workspace work and carry a scope badge.
|
|
65
|
+
- Folder picker is keyboard-only (arrows, Tab, paging, create folder), recent folders are
|
|
66
|
+
remembered, and `@atlas` resolves registrations from other plugins.
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- **The one-sentence definition is back on the first screen**, in both languages.
|
|
71
|
+
- **A line-range reference is priced by its lines, not by the file.** `@src/db.ts:88-140`
|
|
72
|
+
used to be quoted at the full weight of `db.ts`; it now costs its line count and never
|
|
73
|
+
more than the file's own figure.
|
|
74
|
+
- **The palette had no surface of its own**, and nine surfaces referenced theme tokens this
|
|
75
|
+
shell does not define, so they resolved to `transparent`.
|
|
76
|
+
- **The sidebar's folder fallback recursed.** A refused `openResource` fell back to
|
|
77
|
+
`openReferenceTarget`, which calls back into `openOwningFolder` for a folder — one
|
|
78
|
+
refusal was enough to recurse and log until the tab died. It now falls back to the
|
|
79
|
+
native folder opener.
|
|
80
|
+
- `dsh.plugin.json` carried a different version than `package.json`; both agree.
|
|
81
|
+
|
|
82
|
+
### Changed
|
|
83
|
+
|
|
84
|
+
- `description` names the line ranges and the per-reference token cost.
|
|
85
|
+
- Cursor users get the menu they already know (`Ctrl+Shift+H`), plus the two rows the
|
|
86
|
+
real Cursor menu does not have.
|
|
87
|
+
- **The published surface is gated**: `pnpm run verify:publish` reads the tarball for
|
|
88
|
+
internal paths, sources, sourcemaps and ad inlining, and the release workflow runs it
|
|
89
|
+
next to an install-from-registry acceptance job.
|
|
90
|
+
|
|
91
|
+
### Notes
|
|
92
|
+
|
|
93
|
+
- Requires dsh `0.2.0-rc.2`.
|
|
94
|
+
- Upgrading in place from `1.0.0` / `1.0.8` / `1.0.9` / `1.0.12` is verified: settings and
|
|
95
|
+
session files stay byte-identical, boot is clean, and rollback is one command.
|
|
96
|
+
|
|
97
|
+
## [1.1.0] - 2026-10-27
|
|
98
|
+
|
|
99
|
+
The history line, cut but never published: `1.0.10`–`1.0.12` took `latest` instead.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
The first stable release of the history line. Same code as `1.0.9-port.9`, published
|
|
103
|
+
under `latest` so a plain `dsh plugin add @sidequest-007/dsh-atlas` no longer hands out the
|
|
104
|
+
old 1.0.9 composer.
|
|
105
|
+
|
|
106
|
+
### Added
|
|
107
|
+
|
|
108
|
+
- **`Esc` walks the session back, one turn at a time.** The composer turns into a ladder, a
|
|
109
|
+
frame cursor shows where you stand (`第 3 / 11 轮`), and `Enter` hands that turn back for
|
|
110
|
+
reuse. One stop per turn — the same unit the GUI's own turn rail counts, so the two
|
|
111
|
+
numbers can never disagree.
|
|
112
|
+
- **`Ctrl+Shift+H`** (and `Ctrl+H`) opens a searchable palette over the same history.
|
|
113
|
+
- **`@` references every source**: files, folders, skills, past sessions, installed plugins,
|
|
114
|
+
workspace git changes, and any category a third-party plugin registers through `ctx.atlas`.
|
|
115
|
+
Paths outside the workspace work and carry a scope badge.
|
|
116
|
+
- Folder picker is keyboard-only (arrows, Tab, paging, create folder), recent folders are
|
|
117
|
+
remembered, and `@atlas` resolves registrations from other plugins.
|
|
118
|
+
- Fixed: the palette (and eight other surfaces) referenced theme tokens this shell does not
|
|
119
|
+
define, so they resolved to `transparent` — the history dialog had no surface of its own and
|
|
120
|
+
the transcript read through it.
|
|
121
|
+
|
|
122
|
+
### Notes
|
|
123
|
+
|
|
124
|
+
- Requires dsh `0.2.0-rc.2`.
|
|
125
|
+
- Upgrading in place from `1.0.0` / `1.0.8` / `1.0.9` is verified: settings and session files
|
|
126
|
+
stay byte-identical, boot is clean, and rollback is one command.
|
|
3
127
|
## [1.0.12] - 2026-10-28
|
|
4
128
|
|
|
5
129
|
### Fixed
|
package/README.md
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
<p align="center"><img src="assets/brand/atlas-icon-128.png" alt="dsh-ATLAS — one @ for every source" width="88" height="88"></p>
|
|
2
|
+
|
|
1
3
|
# dsh-ATLAS
|
|
2
4
|
|
|
3
5
|
**English** · [简体中文](README.zh.md)
|
|
4
6
|
|
|
7
|
+
> [](https://www.npmjs.com/package/@sidequest-007/dsh-atlas) [](https://www.npmjs.com/package/@sidequest-007/dsh-atlas) [](LICENSE) [](https://github.com/jameswatt139240-crypto/dsh-ATLAS/stargazers)
|
|
8
|
+
|
|
9
|
+
**One `@` jumps anywhere. One `Esc` walks the session back — one turn at a time.**
|
|
10
|
+
Type `@` to reference any source. Press `Esc` to stand inside your own history: the
|
|
11
|
+
composer turns into a ladder, the right rail shows which turn you are on (`第 3 / 11 轮`),
|
|
12
|
+
and `Enter` hands that turn back to you for reuse. `Ctrl+Shift+H` opens a searchable
|
|
13
|
+
palette over the same history.
|
|
14
|
+
|
|
5
15
|
Beyond the **built-in `@`**: line ranges like `@src/a.ts:12-40`, skills, plugins and any git repo as source groups — with the approximate token cost of each reference shown before you send.
|
|
6
16
|
|
|
7
17
|
A **Side Quest** project (工作室:支线任务, **Side Quest Labs**) — npm scope `@sidequest-007/*`, repository [`jameswatt139240-crypto/dsh-ATLAS`](https://github.com/jameswatt139240-crypto/dsh-ATLAS); the DSH plugin id keeps the ecosystem's unscoped `dsh-*` form.
|
|
@@ -40,12 +50,30 @@ dsh plugin --profile web add github:jameswatt139240-crypto/dsh-ATLAS
|
|
|
40
50
|
git clone https://github.com/jameswatt139240-crypto/dsh-ATLAS
|
|
41
51
|
dsh plugin --profile web add link:/path/to/dsh-ATLAS
|
|
42
52
|
|
|
43
|
-
# npm (published; `latest` is the
|
|
44
|
-
dsh plugin --profile web add @sidequest-007/dsh-atlas
|
|
53
|
+
# npm (published; `latest` is 1.2.0 since 2026-11-20, `port` carries the ported builds)
|
|
54
|
+
dsh plugin --profile web add @sidequest-007/dsh-atlas@1.2.0
|
|
45
55
|
```
|
|
46
56
|
|
|
47
57
|
Restart `dsh web` after installing or updating so the Host and the browser client load the same version. Then type `@` in the composer.
|
|
48
58
|
|
|
59
|
+
## Coming from Cursor?
|
|
60
|
+
|
|
61
|
+
Cursor's `@` menu taught a lot of people to type `@file`, `@folder`, `@Chats`, `@Commit`. The DSH composer resolves `@path` and `@label` on its own. This plugin widens that menu to the shape you already expect, and adds the two things Cursor does not do:
|
|
62
|
+
|
|
63
|
+
| | Cursor | DSH built-in | dsh-ATLAS |
|
|
64
|
+
|---|:---:|:---:|:---:|
|
|
65
|
+
| `@file` | yes | yes | yes |
|
|
66
|
+
| `@folder`, with `/` to descend | yes | yes | yes |
|
|
67
|
+
| previous conversations | `@Chats` | `@label` | yes |
|
|
68
|
+
| git diff | `@Commit` / `@Branch` | — | `@git` |
|
|
69
|
+
| a skill as a source | via `/` | — | yes |
|
|
70
|
+
| a plugin as a source | — | — | yes |
|
|
71
|
+
| **line range** `@src/a.ts:12-40` | — | — | **yes** |
|
|
72
|
+
| **token cost, before you send** | — | — | **yes** |
|
|
73
|
+
| `@Terminals`, `@Browser` | yes | — | — |
|
|
74
|
+
|
|
75
|
+
The last two rows are the argument. In an editor, attaching `@db.ts` to reach one function drags the whole file into the window, and you find out what it cost once the window is already full. Here you write `@src/db.ts:88-140`, the dock prices it at `~348 tokens`, and it stays 348 — `TOKENS_PER_LINE = 12`, capped by the whole-file estimate, so an over-long range can never look cheaper than the file itself.
|
|
76
|
+
|
|
49
77
|
## The categories
|
|
50
78
|
|
|
51
79
|
The menu keeps the category rows — five built in, plus the bundled `@git` — in its **bottom band**, the rows nearest the composer, so pressing `@` opens on them rather than on whatever else shares the trigger.
|
package/README.zh.md
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
<p align="center"><img src="assets/brand/atlas-icon-128.png" alt="dsh-ATLAS — one @ for every source" width="88" height="88"></p>
|
|
2
|
+
|
|
1
3
|
# dsh-ATLAS
|
|
2
4
|
|
|
3
5
|
[English](README.md) · **简体中文**
|
|
4
6
|
|
|
7
|
+
> [](https://www.npmjs.com/package/@sidequest-007/dsh-atlas) [](https://www.npmjs.com/package/@sidequest-007/dsh-atlas) [](LICENSE) [](https://github.com/jameswatt139240-crypto/dsh-ATLAS/stargazers)
|
|
8
|
+
|
|
9
|
+
**一个 `@` 跳到任何来源;一个 `Esc` 把整段会话倒着走,一轮一格。**
|
|
10
|
+
输入 `@` 引用任何来源;按 `Esc` 站进自己的历史:输入框变成一把阶梯,右侧帧游标显示你正停在哪一轮(`第 3 / 11 轮`),回车把这一轮的内容交回给你复用。`Ctrl+Shift+H` 打开可搜索的历史调色板。
|
|
11
|
+
|
|
5
12
|
在**内置 `@`** 之上:行区间如 `@src/a.ts:12-40`、Skill、插件与任意 git 仓库作为可选来源,并在发送前显示每条引用要花多少 token。
|
|
6
13
|
|
|
7
14
|
本项目属于 **Side Quest(支线任务)** 工作室(**Side Quest Labs**)—— npm 范围 `@sidequest-007/*`,仓库 [`jameswatt139240-crypto/dsh-ATLAS`](https://github.com/jameswatt139240-crypto/dsh-ATLAS);**DSH 插件 id 沿用生态惯例的无 scope 形式 `dsh-*`**。
|
|
@@ -40,12 +47,30 @@ dsh plugin --profile web add github:jameswatt139240-crypto/dsh-ATLAS
|
|
|
40
47
|
git clone https://github.com/jameswatt139240-crypto/dsh-ATLAS
|
|
41
48
|
dsh plugin --profile web add link:/path/to/dsh-ATLAS
|
|
42
49
|
|
|
43
|
-
# npm 包(已发布;`latest`
|
|
44
|
-
dsh plugin --profile web add @sidequest-007/dsh-atlas
|
|
50
|
+
# npm 包(已发布;`latest` 自 2026-11-20 起是 1.2.0,`port` 是移植版使用的 tag)
|
|
51
|
+
dsh plugin --profile web add @sidequest-007/dsh-atlas@1.2.0
|
|
45
52
|
```
|
|
46
53
|
|
|
47
54
|
安装或更新后**重启 `dsh web`**,确保 Host 与浏览器客户端都加载同一版本。然后在输入框打 `@`。
|
|
48
55
|
|
|
56
|
+
## 如果你用过 Cursor
|
|
57
|
+
|
|
58
|
+
Cursor 的 `@` 菜单把 `@file`、`@folder`、`@Chats`、`@Commit` 这套手感教给了很多人。DSH 输入框自己就能解析 `@路径` 和 `@会话标签`。这个插件把菜单扩成你已经习惯的形状,并补上 Cursor 没做的两件事:
|
|
59
|
+
|
|
60
|
+
| | Cursor | DSH 内置 | dsh-ATLAS |
|
|
61
|
+
|---|:---:|:---:|:---:|
|
|
62
|
+
| `@文件` | 有 | 有 | 有 |
|
|
63
|
+
| `@文件夹`,打 `/` 继续下钻 | 有 | 有 | 有 |
|
|
64
|
+
| 过往会话 | `@Chats` | `@标签` | 有 |
|
|
65
|
+
| git diff | `@Commit` / `@Branch` | — | `@git` |
|
|
66
|
+
| 把 Skill 当来源 | 走 `/` | — | 有 |
|
|
67
|
+
| 把插件当来源 | — | — | 有 |
|
|
68
|
+
| **行区间** `@src/a.ts:12-40` | — | — | **有** |
|
|
69
|
+
| **发送前看到 token 成本** | — | — | **有** |
|
|
70
|
+
| `@Terminals`、`@Browser` | 有 | — | — |
|
|
71
|
+
|
|
72
|
+
后两行才是重点。在编辑器里为了一个函数 `@db.ts`,整个文件都被拖进窗口,等窗口塞满才知道它值多少钱。这里你写 `@src/db.ts:88-140`,dock 上标 `≈348 tokens`,而且它就一直是 348 —— `TOKENS_PER_LINE = 12`,并以整文件估算封顶,所以再长的区间也不会显得比整个文件还便宜。
|
|
73
|
+
|
|
49
74
|
## 类别
|
|
50
75
|
|
|
51
76
|
输入 `@` 后,菜单顶部是五个常驻类别行;也可以直接输入关键字跨类别混合搜索。
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dsh.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sidequest-007/dsh-atlas",
|
|
3
3
|
"description": "AT Last, All Sources. One @ to jump anywhere — line ranges like @src/a.ts:12-40, the token cost of each reference before you send, and Esc to walk the session back.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"entry": {
|
|
6
6
|
"name": "@sidequest-007/dsh-atlas",
|
|
7
7
|
"inject": []
|
package/icon.svg
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="atlasMark" x1="8" y1="7" x2="29" y2="30" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop stop-color="#8B5CF6"/>
|
|
5
|
+
<stop offset="1" stop-color="#3B82F6"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<g transform="translate(18 18) scale(0.95) translate(-17.47 -17.98)">
|
|
9
|
+
<path d="M25.6 19.6A8.9 8.9 0 1 0 23.1 24.3" stroke="url(#atlasMark)" stroke-width="3.8" stroke-linecap="round"/>
|
|
10
|
+
<circle cx="18.1" cy="16.6" r="3.4" stroke="url(#atlasMark)" stroke-width="3.1"/>
|
|
11
|
+
<path d="M21.5 12.8V18.3C21.5 21.3 23.8 23.4 27.4 25.4" stroke="url(#atlasMark)" stroke-width="3" stroke-linecap="round"/>
|
|
12
|
+
</g>
|
|
13
|
+
</svg>
|
package/lib/client.js
CHANGED
|
@@ -20353,6 +20353,52 @@ function recordRecentFile(settings, workspace, relative) {
|
|
|
20353
20353
|
if (!merged) next.push({ workspace, files: [trimmed] });
|
|
20354
20354
|
return next;
|
|
20355
20355
|
}
|
|
20356
|
+
var MAX_EXTERNAL_REFS = 100;
|
|
20357
|
+
var MAX_EXTERNAL_WORKSPACES = 8;
|
|
20358
|
+
function normalizeExternalRefs(values) {
|
|
20359
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
20360
|
+
for (const value of values ?? []) {
|
|
20361
|
+
const path = value.path.trim().replace(/\\/gu, "/").replace(/\/+$/u, "");
|
|
20362
|
+
const key = workspacePathKey(path);
|
|
20363
|
+
if (key === "") continue;
|
|
20364
|
+
const current = byPath.get(key);
|
|
20365
|
+
if (current === void 0) {
|
|
20366
|
+
byPath.set(key, {
|
|
20367
|
+
path,
|
|
20368
|
+
kind: value.kind,
|
|
20369
|
+
count: Math.max(0, Math.trunc(value.count)),
|
|
20370
|
+
lastUsedAt: Math.max(0, value.lastUsedAt),
|
|
20371
|
+
...value.workspaces === void 0 || value.workspaces.length === 0 ? {} : { workspaces: [...value.workspaces].slice(0, MAX_EXTERNAL_WORKSPACES) }
|
|
20372
|
+
});
|
|
20373
|
+
continue;
|
|
20374
|
+
}
|
|
20375
|
+
byPath.set(key, {
|
|
20376
|
+
...current,
|
|
20377
|
+
// A directory wins over a file: only directories can become search roots.
|
|
20378
|
+
kind: current.kind === "dir" || value.kind === "dir" ? "dir" : "file",
|
|
20379
|
+
count: current.count + Math.max(0, Math.trunc(value.count)),
|
|
20380
|
+
lastUsedAt: Math.max(current.lastUsedAt, value.lastUsedAt),
|
|
20381
|
+
...current.workspaces === void 0 && value.workspaces === void 0 ? {} : { workspaces: [.../* @__PURE__ */ new Set([...current.workspaces ?? [], ...value.workspaces ?? []])].slice(0, MAX_EXTERNAL_WORKSPACES) }
|
|
20382
|
+
});
|
|
20383
|
+
}
|
|
20384
|
+
return [...byPath.values()].sort((left, right) => right.lastUsedAt - left.lastUsedAt || left.path.localeCompare(right.path)).slice(0, MAX_EXTERNAL_REFS);
|
|
20385
|
+
}
|
|
20386
|
+
function recordExternalRef(settings, path, kind, workspace, now) {
|
|
20387
|
+
const trimmed = path.trim().replace(/\\/gu, "/").replace(/\/+$/u, "");
|
|
20388
|
+
const rows = normalizeExternalRefs(settings.externalRefs);
|
|
20389
|
+
if (trimmed === "") return rows;
|
|
20390
|
+
const key = workspacePathKey(trimmed);
|
|
20391
|
+
const current = rows.find((row) => workspacePathKey(row.path) === key);
|
|
20392
|
+
const workspaces = [workspace, ...current?.workspaces ?? []].filter((entry) => entry !== "").filter((entry, index, all) => all.findIndex((other) => workspacePathKey(other) === workspacePathKey(entry)) === index).slice(0, MAX_EXTERNAL_WORKSPACES);
|
|
20393
|
+
const updated = {
|
|
20394
|
+
path: trimmed,
|
|
20395
|
+
kind: current?.kind === "dir" || kind === "dir" ? "dir" : kind,
|
|
20396
|
+
count: (current?.count ?? 0) + 1,
|
|
20397
|
+
lastUsedAt: now,
|
|
20398
|
+
...workspaces.length === 0 ? {} : { workspaces }
|
|
20399
|
+
};
|
|
20400
|
+
return normalizeExternalRefs([updated, ...rows.filter((row) => workspacePathKey(row.path) !== key)]);
|
|
20401
|
+
}
|
|
20356
20402
|
var MAX_USAGE_ENTRIES = 200;
|
|
20357
20403
|
function normalizeUsage(values) {
|
|
20358
20404
|
const byKey = /* @__PURE__ */ new Map();
|
|
@@ -20360,9 +20406,8 @@ function normalizeUsage(values) {
|
|
|
20360
20406
|
const key = entry.key.trim();
|
|
20361
20407
|
if (key === "" || entry.count < 1) continue;
|
|
20362
20408
|
const current = byKey.get(key);
|
|
20363
|
-
if (current
|
|
20364
|
-
|
|
20365
|
-
}
|
|
20409
|
+
if (current !== void 0 && entry.count <= current.count) continue;
|
|
20410
|
+
byKey.set(key, { key, count: entry.count, at: entry.at });
|
|
20366
20411
|
}
|
|
20367
20412
|
return [...byKey.values()].sort((a, b) => b.count - a.count || b.at - a.at).slice(0, MAX_USAGE_ENTRIES);
|
|
20368
20413
|
}
|
|
@@ -21763,7 +21808,6 @@ function createMentionSource(deps) {
|
|
|
21763
21808
|
const abort = new AbortController();
|
|
21764
21809
|
const promise2 = load(sessionId, path, abort.signal);
|
|
21765
21810
|
remember({ promise: promise2, abort, at });
|
|
21766
|
-
if (signal === void 0) return promise2;
|
|
21767
21811
|
return promise2.then((value) => signal.aborted ? { path, entries: [] } : value);
|
|
21768
21812
|
};
|
|
21769
21813
|
const insideWorkspace = (sessionId, path) => {
|
|
@@ -21831,9 +21875,9 @@ function createMentionSource(deps) {
|
|
|
21831
21875
|
const ownByName = dirs.filter((file2) => nameOf(file2.relative).includes(needle));
|
|
21832
21876
|
const ownNamed = new Set(ownByName);
|
|
21833
21877
|
const ownByPath = dirs.filter((file2) => !ownNamed.has(file2) && file2.relative.toLowerCase().includes(needle));
|
|
21834
|
-
const outsideByName = outside.filter((row) => nameOf(row.value
|
|
21878
|
+
const outsideByName = outside.filter((row) => nameOf(row.value).includes(needle));
|
|
21835
21879
|
const namedOutside = new Set(outsideByName.map((row) => row.value));
|
|
21836
|
-
const outsideByPath = outside.filter((row) => !namedOutside.has(row.value) &&
|
|
21880
|
+
const outsideByPath = outside.filter((row) => !namedOutside.has(row.value) && row.value.toLowerCase().includes(needle));
|
|
21837
21881
|
const byPath = [...candidateRows(ownByPath, "dir", false, t), ...outsideByPath];
|
|
21838
21882
|
const explicitPath = collapsedGroups.get(sessionId)?.get(PATH_GROUP_KEY);
|
|
21839
21883
|
const rows = [];
|
|
@@ -21928,10 +21972,9 @@ function createMentionSource(deps) {
|
|
|
21928
21972
|
return rows;
|
|
21929
21973
|
};
|
|
21930
21974
|
const fileScopeKey = (path) => `file:scope:${path.toLowerCase()}`;
|
|
21931
|
-
const resolveFileScope = async (sessionId, query,
|
|
21975
|
+
const resolveFileScope = async (sessionId, query, abort) => {
|
|
21932
21976
|
const read = deps.scopeFolder;
|
|
21933
21977
|
if (read === void 0) return void 0;
|
|
21934
|
-
const abort = signal ?? new AbortController().signal;
|
|
21935
21978
|
let path;
|
|
21936
21979
|
try {
|
|
21937
21980
|
path = await read(sessionId, abort);
|
|
@@ -22230,6 +22273,9 @@ function createMentionSource(deps) {
|
|
|
22230
22273
|
const usage = usageRows(query, { files, skills, chats: chatPage, plugins }, MAX_CANDIDATES - CATEGORIES.length - providers.length, t);
|
|
22231
22274
|
const usageKeys = new Set(usage.map((row) => `${row.mentionKind}:${row.value}`));
|
|
22232
22275
|
const relevantFiles = files.filter((file2) => !usageKeys.has(`file:${file2.relative}`));
|
|
22276
|
+
if (externalFetches.get(session.sessionId)?.settled === void 0) {
|
|
22277
|
+
await fetchExternal(session.sessionId, signal).catch(() => NO_EXTERNAL);
|
|
22278
|
+
}
|
|
22233
22279
|
const externalMatches = externalFolderRows(session.sessionId).filter((row) => matches(query, row.name));
|
|
22234
22280
|
const relevance = [
|
|
22235
22281
|
...externalMatches.slice(0, 4),
|
|
@@ -22311,9 +22357,11 @@ function createMentionSource(deps) {
|
|
|
22311
22357
|
return { text: `@${candidate.value ?? ""}`, continue: true };
|
|
22312
22358
|
}
|
|
22313
22359
|
if (candidate.mentionKind === "browse-dir") {
|
|
22360
|
+
if (candidate.value !== void 0) deps.onExternalDir?.(session.sessionId, candidate.value);
|
|
22314
22361
|
return action === "drill" ? { text: `@${candidate.value ?? ""}/`, continue: true } : { text: `@${candidate.value ?? ""}/ ` };
|
|
22315
22362
|
}
|
|
22316
22363
|
if (candidate.mentionKind === "browse-file") {
|
|
22364
|
+
if (candidate.value !== void 0) deps.onExternalDir?.(session.sessionId, dirnameOf(candidate.value));
|
|
22317
22365
|
return { text: `@${candidate.value ?? ""} ` };
|
|
22318
22366
|
}
|
|
22319
22367
|
if (candidate.mentionKind === "dir-group" || candidate.mentionKind === "browse-note") {
|
|
@@ -22328,12 +22376,13 @@ function createMentionSource(deps) {
|
|
|
22328
22376
|
const path = value.replace(/[/\\]+$/u, "");
|
|
22329
22377
|
const suffix2 = candidate.mentionKind === "dir" ? "/" : "";
|
|
22330
22378
|
deps.onUsage?.(session.sessionId, candidate.mentionKind === "dir" ? "dir" : "file", `${path}${suffix2}`);
|
|
22379
|
+
deps.onExternalDir?.(session.sessionId, candidate.mentionKind === "dir" ? path : dirnameOf(path));
|
|
22331
22380
|
return { text: `@${path}${suffix2} ` };
|
|
22332
22381
|
}
|
|
22333
22382
|
const entry = candidate.value === void 0 ? void 0 : findEntry(session.sessionId, candidate.value);
|
|
22334
22383
|
const file2 = entry ?? (candidate.recent === true && candidate.value !== void 0 ? { relative: candidate.value, kind: "file" } : void 0);
|
|
22335
22384
|
if (file2 === void 0) return void 0;
|
|
22336
|
-
if (file2.kind === "file" && entry !== void 0) deps.onRecent?.(session.sessionId, file2.relative);
|
|
22385
|
+
if (file2.kind === "file" && entry !== void 0) deps.onRecent?.(session.sessionId, entry.path, file2.relative);
|
|
22337
22386
|
deps.onUsage?.(session.sessionId, file2.kind === "dir" ? "dir" : "file", file2.relative);
|
|
22338
22387
|
const suffix = file2.kind === "dir" ? "/" : "";
|
|
22339
22388
|
return { text: `@${file2.relative}${suffix} ` };
|
|
@@ -22482,6 +22531,7 @@ function draftMentions(draft) {
|
|
|
22482
22531
|
label,
|
|
22483
22532
|
relative,
|
|
22484
22533
|
link: directoryForm ? { kind: "folder", path: relative } : { kind: "file", path: relative },
|
|
22534
|
+
...lines === void 0 ? {} : { lines },
|
|
22485
22535
|
start: match.index,
|
|
22486
22536
|
end: match.index + match[0].length
|
|
22487
22537
|
});
|
|
@@ -25226,10 +25276,10 @@ function tokenAtPoint(root, node2, offset) {
|
|
|
25226
25276
|
if (local === void 0) return void 0;
|
|
25227
25277
|
const run = tokenRunAt(index.text, local);
|
|
25228
25278
|
if (run === void 0) return void 0;
|
|
25229
|
-
const head = [...line.querySelectorAll(TEXT_REF_SELECTOR)].find((span) => startOf(index, span) === run.start &&
|
|
25279
|
+
const head = [...line.querySelectorAll(TEXT_REF_SELECTOR)].find((span) => startOf(index, span) === run.start && span.textContent.length > 0);
|
|
25230
25280
|
const settled = settledIn(index.text, run.end, line === root.lastElementChild);
|
|
25231
25281
|
if (head === void 0) return { ...run, line, index, local, settled };
|
|
25232
|
-
return { ...run, line, index, local, settled, decoratedEnd: run.start +
|
|
25282
|
+
return { ...run, line, index, local, settled, decoratedEnd: run.start + head.textContent.length };
|
|
25233
25283
|
}
|
|
25234
25284
|
function settledIn(text, end, lastLine) {
|
|
25235
25285
|
if (end < text.length) return isSpace(text[end]);
|
|
@@ -25335,9 +25385,16 @@ function DraftLinks({ actionFor, repeatClick, noteClick, useReferenceInfo, resol
|
|
|
25335
25385
|
() => new Map(infos.map((info) => [referenceKey(info.relative), { exists: info.exists, kind: info.kind }])),
|
|
25336
25386
|
[infos]
|
|
25337
25387
|
);
|
|
25338
|
-
const
|
|
25388
|
+
const faceOf = () => ({
|
|
25389
|
+
actionFor,
|
|
25390
|
+
repeatClick,
|
|
25391
|
+
noteClick,
|
|
25392
|
+
verdict: (path) => verdictByPath.get(referenceKey(path)),
|
|
25393
|
+
resolveSession
|
|
25394
|
+
});
|
|
25395
|
+
const face = (0, import_react6.useRef)(faceOf());
|
|
25339
25396
|
(0, import_react6.useEffect)(() => {
|
|
25340
|
-
face.current =
|
|
25397
|
+
face.current = faceOf();
|
|
25341
25398
|
}, [actionFor, repeatClick, noteClick, verdictByPath, resolveSession]);
|
|
25342
25399
|
const repaint = (0, import_react6.useRef)(() => {
|
|
25343
25400
|
});
|
|
@@ -25538,7 +25595,6 @@ function buildFrames(order, getNode, mode = "message", outline = void 0) {
|
|
|
25538
25595
|
if (mode === "turn" && (turn === void 0 || promptTurns.has(turn))) continue;
|
|
25539
25596
|
if (turn === void 0 || lastAnswerKey.get(turn) !== key) continue;
|
|
25540
25597
|
const replyText = answerTextOf(node2);
|
|
25541
|
-
if (replyText === void 0 || replyText.trim() === "") continue;
|
|
25542
25598
|
const replyData = node2.data;
|
|
25543
25599
|
frames.push({
|
|
25544
25600
|
key,
|
|
@@ -25897,8 +25953,9 @@ function FrameCursor(props) {
|
|
|
25897
25953
|
if (chordResetRef.current.newestQuickTurn !== newestQuickTurn) {
|
|
25898
25954
|
const previous = chordResetRef.current;
|
|
25899
25955
|
chordResetRef.current = { quickSlot, turnRunning: sessionRunning, newestQuickTurn };
|
|
25900
|
-
if (previous.quickSlot !== 0
|
|
25901
|
-
|
|
25956
|
+
if (previous.quickSlot !== 0) {
|
|
25957
|
+
const stillRunning = previous.turnRunning && sessionRunning;
|
|
25958
|
+
if (!stillRunning) setQuickSlot(0);
|
|
25902
25959
|
}
|
|
25903
25960
|
} else if (chordResetRef.current.quickSlot !== quickSlot || chordResetRef.current.turnRunning !== sessionRunning) {
|
|
25904
25961
|
chordResetRef.current = { quickSlot, turnRunning: sessionRunning, newestQuickTurn };
|
|
@@ -26409,7 +26466,7 @@ function composerChipBody(host) {
|
|
|
26409
26466
|
return host.querySelector("[title]") ?? host;
|
|
26410
26467
|
}
|
|
26411
26468
|
function composerChipLink(host, resolve = (label) => label) {
|
|
26412
|
-
const raw = (composerChipBody(host).getAttribute("title") ?? host.textContent
|
|
26469
|
+
const raw = (composerChipBody(host).getAttribute("title") ?? host.textContent).trim();
|
|
26413
26470
|
if (raw === "" || raw.startsWith("/")) return void 0;
|
|
26414
26471
|
const label = raw.startsWith("@") ? raw.slice(1) : raw;
|
|
26415
26472
|
const path = resolve(label);
|
|
@@ -27399,7 +27456,7 @@ function crumbsOf(path) {
|
|
|
27399
27456
|
const crumbs = [];
|
|
27400
27457
|
if (parts[0] === "") crumbs.push({ name: "/", path: "/", hidden: false });
|
|
27401
27458
|
for (let index = 1; index < parts.length; index += 1) {
|
|
27402
|
-
const segment = parts[index]
|
|
27459
|
+
const segment = parts[index];
|
|
27403
27460
|
if (segment === "") continue;
|
|
27404
27461
|
crumbs.push({ name: segment, path: parts.slice(0, index + 1).join("/"), hidden: false });
|
|
27405
27462
|
}
|
|
@@ -27608,6 +27665,7 @@ function apply(ctx) {
|
|
|
27608
27665
|
const insert = (path) => {
|
|
27609
27666
|
const text = `@${externalPath(path).replace(/[/\\]+$/u, "")}/ `;
|
|
27610
27667
|
bail.bail(actx, "slash/input-insert-text", { text, span, continue: true });
|
|
27668
|
+
rememberExternal(sessionId, path);
|
|
27611
27669
|
};
|
|
27612
27670
|
const openOwnDialog = (error62) => {
|
|
27613
27671
|
if (error62 !== void 0) {
|
|
@@ -27633,6 +27691,7 @@ function apply(ctx) {
|
|
|
27633
27691
|
if (pending === null || actx === void 0) return;
|
|
27634
27692
|
const text = `@${externalPath(path).replace(/[/\\]+$/u, "")}/ `;
|
|
27635
27693
|
actx.bail(actx, "slash/input-insert-text", { text, span: pending.span, continue: true });
|
|
27694
|
+
rememberExternal(sessionId, path);
|
|
27636
27695
|
};
|
|
27637
27696
|
const inspectReferences = async (sessionId, targets) => {
|
|
27638
27697
|
if (atFile === void 0 || typeof atFile.inspect !== "function") return [];
|
|
@@ -27677,10 +27736,8 @@ function apply(ctx) {
|
|
|
27677
27736
|
if (!result.ok) throw new Error(`listPlugins failed: ${result.error.code}: ${result.error.message}`);
|
|
27678
27737
|
return result.value;
|
|
27679
27738
|
};
|
|
27680
|
-
const onRecent = (
|
|
27681
|
-
const
|
|
27682
|
-
if (entry === void 0) return;
|
|
27683
|
-
const workspace = workspaceFromAbsolute(entry.path, relative);
|
|
27739
|
+
const onRecent = (_sessionId, absolute, relative) => {
|
|
27740
|
+
const workspace = workspaceFromAbsolute(absolute, relative);
|
|
27684
27741
|
const current = scope.getSnapshot().value;
|
|
27685
27742
|
void updateSettings({ field: "recentFiles", value: recordRecentFile(current, workspace, relative) });
|
|
27686
27743
|
};
|
|
@@ -27689,6 +27746,16 @@ function apply(ctx) {
|
|
|
27689
27746
|
const current = scope.getSnapshot().value;
|
|
27690
27747
|
void updateSettings({ field: "usage", value: recordUsage(current, `${kind}:${value}`) });
|
|
27691
27748
|
};
|
|
27749
|
+
const rememberExternal = (sessionId, path) => {
|
|
27750
|
+
const absolute = externalPath(path).replace(/[/\\]+$/u, "");
|
|
27751
|
+
if (absolute === "") return;
|
|
27752
|
+
const current = scope.getSnapshot().value;
|
|
27753
|
+
void updateSettings({
|
|
27754
|
+
field: "externalRefs",
|
|
27755
|
+
value: recordExternalRef(current, absolute, "dir", sessionWorkspaceRoot(sessionId) ?? "", Date.now())
|
|
27756
|
+
});
|
|
27757
|
+
mention.invalidateExternal(sessionId);
|
|
27758
|
+
};
|
|
27692
27759
|
const scopeFolder = async (sessionId) => {
|
|
27693
27760
|
if (typeof document === "undefined") return void 0;
|
|
27694
27761
|
const tokens = draftTokens().map((token) => token.token);
|
|
@@ -27722,6 +27789,7 @@ function apply(ctx) {
|
|
|
27722
27789
|
onRecent,
|
|
27723
27790
|
recentFiles,
|
|
27724
27791
|
onUsage,
|
|
27792
|
+
onExternalDir: rememberExternal,
|
|
27725
27793
|
usage: () => scope.getSnapshot().value.usage ?? [],
|
|
27726
27794
|
atlasProviders: () => atlasRegistry.entries(),
|
|
27727
27795
|
// A client that activates a reference token in the composer opens it through
|
|
@@ -27916,7 +27984,7 @@ function apply(ctx) {
|
|
|
27916
27984
|
return "opened";
|
|
27917
27985
|
} catch (error62) {
|
|
27918
27986
|
console.error("[dsh-atlas] sidebar folder open failed:", error62);
|
|
27919
|
-
return
|
|
27987
|
+
return openNativeFolder(sessionId, link.path);
|
|
27920
27988
|
}
|
|
27921
27989
|
};
|
|
27922
27990
|
const clickReference = (sessionId, link) => {
|
package/lib/index.js
CHANGED
|
@@ -1395,7 +1395,6 @@ import { stat as stat2 } from "node:fs/promises";
|
|
|
1395
1395
|
|
|
1396
1396
|
// src/external.ts
|
|
1397
1397
|
var EXTERNAL_ADDING_MODE = "danger-full-access";
|
|
1398
|
-
var NO_EXTERNAL_DISCOVERY = { canDiscover: false, roots: [], known: [] };
|
|
1399
1398
|
function externalAccess(mode, roots, known = []) {
|
|
1400
1399
|
return { canDiscover: mode === EXTERNAL_ADDING_MODE, roots, known };
|
|
1401
1400
|
}
|
|
@@ -21866,7 +21865,7 @@ var _AtFileRuntime = class _AtFileRuntime extends (_a3 = TypertRemoteService, _g
|
|
|
21866
21865
|
* @param config - resolved plugin configuration.
|
|
21867
21866
|
* @param isEnabled - live settings read; false refuses the endpoint.
|
|
21868
21867
|
*/
|
|
21869
|
-
constructor(ctx, config2, readSettings, writeSettings, externalAccessFor
|
|
21868
|
+
constructor(ctx, config2, readSettings, writeSettings, externalAccessFor) {
|
|
21870
21869
|
super(ctx, "atFile");
|
|
21871
21870
|
this.config = config2;
|
|
21872
21871
|
this.readSettings = readSettings;
|
|
@@ -22275,6 +22274,76 @@ var TYPERT_MANIFEST = {
|
|
|
22275
22274
|
invocations: [...AT_FILE_INVOCATIONS, ...AT_MENTION_INVOCATIONS, ...ATLAS_INVOCATIONS]
|
|
22276
22275
|
};
|
|
22277
22276
|
|
|
22277
|
+
// src/store.ts
|
|
22278
|
+
import { readFileSync } from "node:fs";
|
|
22279
|
+
import { mkdir, rename, rm, writeFile } from "node:fs/promises";
|
|
22280
|
+
import { homedir as homedir2 } from "node:os";
|
|
22281
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
22282
|
+
function harnessHome(ctx) {
|
|
22283
|
+
const profile = ctx.profileContext;
|
|
22284
|
+
if (profile !== void 0 && typeof profile.home === "string" && profile.home !== "") return profile.home;
|
|
22285
|
+
const fromEnv = process.env.DSH_HOME;
|
|
22286
|
+
if (fromEnv !== void 0 && fromEnv !== "") return fromEnv;
|
|
22287
|
+
return join4(homedir2(), ".dsh");
|
|
22288
|
+
}
|
|
22289
|
+
function settingsFile(home) {
|
|
22290
|
+
return join4(home, "atlas", "at-file.json");
|
|
22291
|
+
}
|
|
22292
|
+
function defaults() {
|
|
22293
|
+
return AtFileSettingsSchema({});
|
|
22294
|
+
}
|
|
22295
|
+
function readDurableSettings(file2) {
|
|
22296
|
+
let raw;
|
|
22297
|
+
try {
|
|
22298
|
+
raw = readFileSync(file2, "utf8");
|
|
22299
|
+
} catch {
|
|
22300
|
+
return defaults();
|
|
22301
|
+
}
|
|
22302
|
+
try {
|
|
22303
|
+
const parsed = JSON.parse(raw);
|
|
22304
|
+
const section = pickSection(parsed);
|
|
22305
|
+
return AtFileSettingsSchema(section);
|
|
22306
|
+
} catch (error62) {
|
|
22307
|
+
console.warn(`[dsh-atlas] ignoring unreadable settings at ${file2}: ${String(error62)}`);
|
|
22308
|
+
return defaults();
|
|
22309
|
+
}
|
|
22310
|
+
}
|
|
22311
|
+
function pickSection(parsed) {
|
|
22312
|
+
if (parsed === null || typeof parsed !== "object") return {};
|
|
22313
|
+
const document = parsed;
|
|
22314
|
+
if (document.version === 1 && document.settings !== null && typeof document.settings === "object") {
|
|
22315
|
+
return document.settings;
|
|
22316
|
+
}
|
|
22317
|
+
if ("settings" in document || "version" in document) return {};
|
|
22318
|
+
return document;
|
|
22319
|
+
}
|
|
22320
|
+
function createDurableSettings(ctx) {
|
|
22321
|
+
const file2 = settingsFile(harnessHome(ctx));
|
|
22322
|
+
const directory = dirname2(file2);
|
|
22323
|
+
let pending = Promise.resolve();
|
|
22324
|
+
return {
|
|
22325
|
+
file: file2,
|
|
22326
|
+
load: () => readDurableSettings(file2),
|
|
22327
|
+
save: (settings) => {
|
|
22328
|
+
pending = pending.then(async () => {
|
|
22329
|
+
const document = { version: 1, settings };
|
|
22330
|
+
const temporary = `${file2}.${String(process.pid)}.tmp`;
|
|
22331
|
+
try {
|
|
22332
|
+
await mkdir(directory, { recursive: true, mode: 448 });
|
|
22333
|
+
await writeFile(temporary, `${JSON.stringify(document, null, 2)}
|
|
22334
|
+
`, { mode: 384 });
|
|
22335
|
+
await rename(temporary, file2);
|
|
22336
|
+
} catch (error62) {
|
|
22337
|
+
await rm(temporary, { force: true }).catch(() => {
|
|
22338
|
+
});
|
|
22339
|
+
console.warn(`[dsh-atlas] could not save settings to ${file2}: ${String(error62)}`);
|
|
22340
|
+
}
|
|
22341
|
+
});
|
|
22342
|
+
return pending;
|
|
22343
|
+
}
|
|
22344
|
+
};
|
|
22345
|
+
}
|
|
22346
|
+
|
|
22278
22347
|
// src/settings.ts
|
|
22279
22348
|
var AT_FILE_NAMESPACE = "at-file";
|
|
22280
22349
|
var AtFileSettingsSchema = Schema.object({
|
|
@@ -22339,20 +22408,28 @@ var AtFileSettingsSchema = Schema.object({
|
|
|
22339
22408
|
// message to reuse" means, so it must never be the default.
|
|
22340
22409
|
historyJumpSmartFollow: Schema.boolean().default(false)
|
|
22341
22410
|
});
|
|
22342
|
-
function
|
|
22343
|
-
let current
|
|
22411
|
+
function durableScope(store) {
|
|
22412
|
+
let current;
|
|
22413
|
+
const value = () => current ??= store.load();
|
|
22344
22414
|
return {
|
|
22345
|
-
get:
|
|
22415
|
+
get: value,
|
|
22346
22416
|
update: async (patch) => {
|
|
22347
|
-
|
|
22417
|
+
const next = AtFileSettingsSchema({ ...value(), ...patch });
|
|
22418
|
+
current = next;
|
|
22419
|
+
await store.save(next);
|
|
22348
22420
|
}
|
|
22349
22421
|
};
|
|
22350
22422
|
}
|
|
22351
22423
|
function registerAtFileSettings(ctx) {
|
|
22352
22424
|
const registrar = ctx.settings;
|
|
22353
22425
|
if (typeof registrar.register !== "function") {
|
|
22354
|
-
|
|
22355
|
-
|
|
22426
|
+
const store = createDurableSettings(ctx);
|
|
22427
|
+
console.warn(`[dsh-atlas] this profile's settings service has no namespace API; "${AT_FILE_NAMESPACE}" is kept in ${store.file}`);
|
|
22428
|
+
const scope = durableScope(store);
|
|
22429
|
+
if (!scope.get().enabled) {
|
|
22430
|
+
console.warn(`[dsh-atlas] "${AT_FILE_NAMESPACE}" is switched OFF in ${store.file}; the "@" categories, history jump and folder picker stay idle until it is turned back on`);
|
|
22431
|
+
}
|
|
22432
|
+
return scope;
|
|
22356
22433
|
}
|
|
22357
22434
|
return registrar.register(AT_FILE_NAMESPACE, AtFileSettingsSchema, { applies: "live" });
|
|
22358
22435
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
2
|
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
3
3
|
import type { AtFileSettings, ReferenceInfo } from '../contract.ts';
|
|
4
|
+
import type { LineRange } from '../tokens.ts';
|
|
4
5
|
import type { ReferenceLink } from './reference-links.ts';
|
|
5
6
|
import type { MentionKind } from './source.ts';
|
|
6
7
|
export interface AtFileSettingsSnapshot {
|
|
@@ -28,15 +29,30 @@ export interface AtFileDockInjected {
|
|
|
28
29
|
}
|
|
29
30
|
/** Approximate bytes per token for text files (the dock's cost hint). */
|
|
30
31
|
export declare const BYTES_PER_TOKEN = 4;
|
|
32
|
+
/**
|
|
33
|
+
* Approximate tokens per source line, used when the reference carries a line
|
|
34
|
+
* range. The Host never opens the referenced file, so the exact span size is
|
|
35
|
+
* unknowable here; this constant is what turns a line COUNT into a plausible
|
|
36
|
+
* cost. The estimate is always capped by the whole-file figure, so a range can
|
|
37
|
+
* never be quoted as heavier than the file that contains it.
|
|
38
|
+
*/
|
|
39
|
+
export declare const TOKENS_PER_LINE = 12;
|
|
31
40
|
/** References heavier than this many tokens are flagged in the dock. */
|
|
32
41
|
export declare const COST_WARN_TOKENS = 8000;
|
|
33
42
|
/**
|
|
34
43
|
* Approximate context cost of one reference, or undefined when there is nothing
|
|
35
44
|
* to price (missing path, directory, or a file whose size is unknown).
|
|
45
|
+
*
|
|
46
|
+
* A reference with a line range is priced by its line count, not by the file's
|
|
47
|
+
* size: `@src/a.ts:12-40` asks the agent for 29 lines, and quoting the whole
|
|
48
|
+
* file's cost there made a narrow reference look like the most expensive thing
|
|
49
|
+
* in the draft. Without a range the file's size is the only fact available and
|
|
50
|
+
* is still the best answer.
|
|
36
51
|
* @param info - the host-inspected facts for this reference, when available.
|
|
52
|
+
* @param lines - the inclusive line range on this reference, when it has one.
|
|
37
53
|
* @returns the token estimate and whether it exceeds the warning threshold.
|
|
38
54
|
*/
|
|
39
|
-
export declare function referenceCost(info: ReferenceInfo | undefined): {
|
|
55
|
+
export declare function referenceCost(info: ReferenceInfo | undefined, lines?: LineRange): {
|
|
40
56
|
readonly tokens: number;
|
|
41
57
|
readonly warn: boolean;
|
|
42
58
|
} | undefined;
|
|
@@ -59,6 +75,8 @@ export interface DraftMention {
|
|
|
59
75
|
readonly relative?: string;
|
|
60
76
|
/** The click action's target, for rows this build can open. */
|
|
61
77
|
readonly link?: ReferenceLink;
|
|
78
|
+
/** The inclusive line range the token asked for, when it carried one. */
|
|
79
|
+
readonly lines?: LineRange;
|
|
62
80
|
readonly start: number;
|
|
63
81
|
readonly end: number;
|
|
64
82
|
}
|
|
@@ -102,9 +102,19 @@ export interface MentionSourceDeps {
|
|
|
102
102
|
/** Locale binder for time/tier labels (defaults to zh copy). */
|
|
103
103
|
t?: (key: string, params?: Record<string, string>) => string;
|
|
104
104
|
/** Record one referenced path into the session workspace's recent list. */
|
|
105
|
-
onRecent?(sessionId: SessionId, relative: string): void;
|
|
105
|
+
onRecent?(sessionId: SessionId, absolute: string, relative: string): void;
|
|
106
106
|
/** Record one pick in the cross-category usage counters. */
|
|
107
107
|
onUsage?(sessionId: SessionId, kind: string, value: string): void;
|
|
108
|
+
/**
|
|
109
|
+
* Report one pick that names a directory OUTSIDE the workspace.
|
|
110
|
+
*
|
|
111
|
+
* The Host only records such a path at `agent/pre-step`, so a folder picked
|
|
112
|
+
* here stayed out of the scope the `@` menu reads until a message carrying it
|
|
113
|
+
* was sent. The pick itself is that statement, and the owner records it.
|
|
114
|
+
* @param sessionId - the session whose composer made the pick.
|
|
115
|
+
* @param absolute - the absolute directory the pick referenced.
|
|
116
|
+
*/
|
|
117
|
+
onExternalDir?(sessionId: SessionId, absolute: string): void;
|
|
108
118
|
/** The live cross-category pick counters (highest count first). */
|
|
109
119
|
usage?(): readonly UsageEntry[];
|
|
110
120
|
/**
|
package/lib/types/runtime.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare class AtFileRuntime extends TypertRemoteService {
|
|
|
35
35
|
*/
|
|
36
36
|
constructor(ctx: Context, config: ResolvedConfig, readSettings: () => AtFileSettings, writeSettings: (update: AtFileSettingsUpdate) => Promise<AtFileSettings>,
|
|
37
37
|
/** The session's out-of-workspace access (see src/external.ts). */
|
|
38
|
-
externalAccessFor
|
|
38
|
+
externalAccessFor: (agent: Agent) => ExternalAccess);
|
|
39
39
|
/** One TTL for the workspace index cache (matches the client cache). */
|
|
40
40
|
private static readonly FILE_CACHE_TTL_MS;
|
|
41
41
|
/** Read the resolved durable settings through the plugin-owned wire. */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { AtFileSettings } from './contract.ts';
|
|
3
|
+
/** The harness home this profile uses, as far as the plugin can tell. */
|
|
4
|
+
export declare function harnessHome(ctx: Context): string;
|
|
5
|
+
/** The file that holds the `at-file` section for one harness home. */
|
|
6
|
+
export declare function settingsFile(home: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Read the section, or the defaults when the file is absent or unreadable.
|
|
9
|
+
* A corrupt document is reported once and replaced on the next write; it never
|
|
10
|
+
* takes the plugin down.
|
|
11
|
+
* @param file - absolute path of the settings document.
|
|
12
|
+
* @returns the validated section.
|
|
13
|
+
*/
|
|
14
|
+
export declare function readDurableSettings(file: string): AtFileSettings;
|
|
15
|
+
/** One durable document for one harness home. */
|
|
16
|
+
export interface DurableSettings {
|
|
17
|
+
/** Absolute path of the document this store reads and writes. */
|
|
18
|
+
readonly file: string;
|
|
19
|
+
/** The section as it stands on disk (defaults when there is nothing yet). */
|
|
20
|
+
load(): AtFileSettings;
|
|
21
|
+
/** Replace the section, atomically and in order with other saves. */
|
|
22
|
+
save(settings: AtFileSettings): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build the store for the profile behind `ctx`.
|
|
26
|
+
* @param ctx - the plugin context; only its profile home is consulted.
|
|
27
|
+
* @returns a store whose saves are serialized and whose failures are reported,
|
|
28
|
+
* not thrown: a read-only home must not break the composer.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createDurableSettings(ctx: Context): DurableSettings;
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sidequest-007/dsh-atlas",
|
|
3
3
|
"description": "AT Last, All Sources. One @ to jump anywhere — line ranges like @src/a.ts:12-40, the token cost of each reference before you send, and Esc to walk the session back.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.2",
|
|
5
|
+
"icon": "icon.svg",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"author": "Side Quest Labs",
|
|
7
8
|
"publishConfig": {
|
|
@@ -21,7 +22,14 @@
|
|
|
21
22
|
"keyboard",
|
|
22
23
|
"navigation",
|
|
23
24
|
"session-history",
|
|
24
|
-
"esc"
|
|
25
|
+
"esc",
|
|
26
|
+
"deepseek",
|
|
27
|
+
"harness",
|
|
28
|
+
"mention-anything",
|
|
29
|
+
"command-palette",
|
|
30
|
+
"history-navigation",
|
|
31
|
+
"keyboard-shortcuts",
|
|
32
|
+
"dsh-atlas"
|
|
25
33
|
],
|
|
26
34
|
"homepage": "https://github.com/jameswatt139240-crypto/dsh-ATLAS#readme",
|
|
27
35
|
"bugs": {
|
|
@@ -69,12 +77,14 @@
|
|
|
69
77
|
}
|
|
70
78
|
},
|
|
71
79
|
"files": [
|
|
80
|
+
"icon.svg",
|
|
72
81
|
"lib/index.js",
|
|
73
82
|
"lib/invariant.js",
|
|
74
83
|
"lib/client.js",
|
|
75
84
|
"lib/types",
|
|
76
85
|
"assets/screenshots",
|
|
77
86
|
"assets/diagrams",
|
|
87
|
+
"assets/brand",
|
|
78
88
|
"cordis.patch.yml",
|
|
79
89
|
"dsh.plugin.json",
|
|
80
90
|
"README.md",
|