@sidequest-007/dsh-atlas 1.2.0 → 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 CHANGED
@@ -1,5 +1,49 @@
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
+
3
47
  ## [1.2.0] - 2026-11-20
4
48
 
5
49
  The two lines that were being released in parallel — the history/composer line
package/README.md CHANGED
@@ -1,3 +1,5 @@
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)
package/README.zh.md CHANGED
@@ -1,3 +1,5 @@
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) · **简体中文**
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.2.0",
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();
@@ -22227,6 +22273,9 @@ function createMentionSource(deps) {
22227
22273
  const usage = usageRows(query, { files, skills, chats: chatPage, plugins }, MAX_CANDIDATES - CATEGORIES.length - providers.length, t);
22228
22274
  const usageKeys = new Set(usage.map((row) => `${row.mentionKind}:${row.value}`));
22229
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
+ }
22230
22279
  const externalMatches = externalFolderRows(session.sessionId).filter((row) => matches(query, row.name));
22231
22280
  const relevance = [
22232
22281
  ...externalMatches.slice(0, 4),
@@ -22308,9 +22357,11 @@ function createMentionSource(deps) {
22308
22357
  return { text: `@${candidate.value ?? ""}`, continue: true };
22309
22358
  }
22310
22359
  if (candidate.mentionKind === "browse-dir") {
22360
+ if (candidate.value !== void 0) deps.onExternalDir?.(session.sessionId, candidate.value);
22311
22361
  return action === "drill" ? { text: `@${candidate.value ?? ""}/`, continue: true } : { text: `@${candidate.value ?? ""}/ ` };
22312
22362
  }
22313
22363
  if (candidate.mentionKind === "browse-file") {
22364
+ if (candidate.value !== void 0) deps.onExternalDir?.(session.sessionId, dirnameOf(candidate.value));
22314
22365
  return { text: `@${candidate.value ?? ""} ` };
22315
22366
  }
22316
22367
  if (candidate.mentionKind === "dir-group" || candidate.mentionKind === "browse-note") {
@@ -22325,6 +22376,7 @@ function createMentionSource(deps) {
22325
22376
  const path = value.replace(/[/\\]+$/u, "");
22326
22377
  const suffix2 = candidate.mentionKind === "dir" ? "/" : "";
22327
22378
  deps.onUsage?.(session.sessionId, candidate.mentionKind === "dir" ? "dir" : "file", `${path}${suffix2}`);
22379
+ deps.onExternalDir?.(session.sessionId, candidate.mentionKind === "dir" ? path : dirnameOf(path));
22328
22380
  return { text: `@${path}${suffix2} ` };
22329
22381
  }
22330
22382
  const entry = candidate.value === void 0 ? void 0 : findEntry(session.sessionId, candidate.value);
@@ -27613,6 +27665,7 @@ function apply(ctx) {
27613
27665
  const insert = (path) => {
27614
27666
  const text = `@${externalPath(path).replace(/[/\\]+$/u, "")}/ `;
27615
27667
  bail.bail(actx, "slash/input-insert-text", { text, span, continue: true });
27668
+ rememberExternal(sessionId, path);
27616
27669
  };
27617
27670
  const openOwnDialog = (error62) => {
27618
27671
  if (error62 !== void 0) {
@@ -27638,6 +27691,7 @@ function apply(ctx) {
27638
27691
  if (pending === null || actx === void 0) return;
27639
27692
  const text = `@${externalPath(path).replace(/[/\\]+$/u, "")}/ `;
27640
27693
  actx.bail(actx, "slash/input-insert-text", { text, span: pending.span, continue: true });
27694
+ rememberExternal(sessionId, path);
27641
27695
  };
27642
27696
  const inspectReferences = async (sessionId, targets) => {
27643
27697
  if (atFile === void 0 || typeof atFile.inspect !== "function") return [];
@@ -27692,6 +27746,16 @@ function apply(ctx) {
27692
27746
  const current = scope.getSnapshot().value;
27693
27747
  void updateSettings({ field: "usage", value: recordUsage(current, `${kind}:${value}`) });
27694
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
+ };
27695
27759
  const scopeFolder = async (sessionId) => {
27696
27760
  if (typeof document === "undefined") return void 0;
27697
27761
  const tokens = draftTokens().map((token) => token.token);
@@ -27725,6 +27789,7 @@ function apply(ctx) {
27725
27789
  onRecent,
27726
27790
  recentFiles,
27727
27791
  onUsage,
27792
+ onExternalDir: rememberExternal,
27728
27793
  usage: () => scope.getSnapshot().value.usage ?? [],
27729
27794
  atlasProviders: () => atlasRegistry.entries(),
27730
27795
  // A client that activates a reference token in the composer opens it through
package/lib/index.js CHANGED
@@ -22274,6 +22274,76 @@ var TYPERT_MANIFEST = {
22274
22274
  invocations: [...AT_FILE_INVOCATIONS, ...AT_MENTION_INVOCATIONS, ...ATLAS_INVOCATIONS]
22275
22275
  };
22276
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
+
22277
22347
  // src/settings.ts
22278
22348
  var AT_FILE_NAMESPACE = "at-file";
22279
22349
  var AtFileSettingsSchema = Schema.object({
@@ -22338,20 +22408,28 @@ var AtFileSettingsSchema = Schema.object({
22338
22408
  // message to reuse" means, so it must never be the default.
22339
22409
  historyJumpSmartFollow: Schema.boolean().default(false)
22340
22410
  });
22341
- function defaultScope() {
22342
- let current = AtFileSettingsSchema({});
22411
+ function durableScope(store) {
22412
+ let current;
22413
+ const value = () => current ??= store.load();
22343
22414
  return {
22344
- get: () => current,
22415
+ get: value,
22345
22416
  update: async (patch) => {
22346
- current = { ...current, ...patch };
22417
+ const next = AtFileSettingsSchema({ ...value(), ...patch });
22418
+ current = next;
22419
+ await store.save(next);
22347
22420
  }
22348
22421
  };
22349
22422
  }
22350
22423
  function registerAtFileSettings(ctx) {
22351
22424
  const registrar = ctx.settings;
22352
22425
  if (typeof registrar.register !== "function") {
22353
- console.warn(`[dsh-atlas] this profile's settings service has no namespace API; "${AT_FILE_NAMESPACE}" runs on defaults`);
22354
- return defaultScope();
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;
22355
22433
  }
22356
22434
  return registrar.register(AT_FILE_NAMESPACE, AtFileSettingsSchema, { applies: "live" });
22357
22435
  }
@@ -105,6 +105,16 @@ export interface MentionSourceDeps {
105
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
  /**
@@ -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.2.0",
4
+ "version": "1.2.2",
5
+ "icon": "icon.svg",
5
6
  "license": "MIT",
6
7
  "author": "Side Quest Labs",
7
8
  "publishConfig": {
@@ -76,12 +77,14 @@
76
77
  }
77
78
  },
78
79
  "files": [
80
+ "icon.svg",
79
81
  "lib/index.js",
80
82
  "lib/invariant.js",
81
83
  "lib/client.js",
82
84
  "lib/types",
83
85
  "assets/screenshots",
84
86
  "assets/diagrams",
87
+ "assets/brand",
85
88
  "cordis.patch.yml",
86
89
  "dsh.plugin.json",
87
90
  "README.md",