@prettier-ai/dsh-client-ui-reference 0.1.2-alpha.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
+ # after editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write packages/client/ui-reference/README.md
5
+ README.md: 1f82f4bb30f2ad5d194a70279f9e80885d6a048e
6
+ README.zh.md: 03a79ec4ff34431a63d8a7b0de115e3ec63b9392
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ ---
2
+ description: "Web @file and @session reference source for the composer: candidates, ordering, and atomic inline references (unified file/session picking)."
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @deepseek-ai/dsh-client-ui-reference
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ `dsh-client-ui-reference` is the unified Web `@file` and `@session` reference source: it registers the `reference` entry in the composer's inline-suggestion machinery so a user typing `@` sees file and session candidates in one list. Files order before sessions, sections are labelled with locale-registered terms, and either candidate domain can fail independently without blocking the other. Each row carries only what distinguishes it: a file names its parent directory and nothing at the workspace root, a session names its workspace only when that workspace is not the current one, and a drilled directory listing names none because its breadcrumb already does. A pick inserts an atomic inline reference — file, folder, and session alike — whose hidden serialized and clipboard form is the natural text the shared `@path` grammar defines; a directory row additionally carries a drill verb (Tab or the row's chevron) that keeps plain editable path text and the menu active at its trailing slash so the user can descend another level. Selecting a session routes through the session-reference service, which validates the mention and captures model context at the pre-step boundary; this package itself registers no prompt or tool.
13
+
14
+ ## Table of Contents
15
+
16
+ - [Use this package](#use-this-package)
17
+ - [Understand the implementation](#understand-the-implementation)
18
+ - [Further Exploration](#further-exploration)
19
+ - [Model Experience](#model-experience)
20
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
21
+ - [Dev Note](#dev-note)
22
+
23
+ -----
24
+
25
+ <a id="use-this-package"></a>
26
+ ## Use this package
27
+
28
+ The source is active whenever the composition mounts this package and a Host `ctx.fileReferences` provider is available. Type `@` followed by an unquoted token to see files first, then sessions; open `@"…` to search files only. The candidate list is a completion menu, not a search result page: pick once and keep typing.
29
+
30
+ ### What a pick inserts
31
+
32
+ A file closes completion as an atomic inline reference displayed with a file glyph and business-color filename. A directory row carries two verbs: the settling pick (row click or Enter) resolves the folder itself as the same kind of atomic reference — folder glyph, trailing-slash label, canonical `@dir/` mention as its serialized form — while the drill action (Tab or the row's chevron) keeps plain editable path text with a folder glyph and the menu active at its trailing slash, so you can descend another level. Paths containing whitespace use `@"path with spaces"`, and a quote the user opened explicitly remains quoted.
33
+
34
+ A session pick inserts an atomic inline reference whose hidden `ref` and clipboard representation is the canonical `@[label](dsh-session:…)` mention returned by the Host; its visible form is a chat-bubble glyph plus the session title. Sending carries the mention through `session.prompt`, and the session-reference service validates it and captures model context at `agent/pre-step`.
35
+
36
+ ### Failure behavior
37
+
38
+ One unavailable or failed candidate domain yields no rows for that domain while the other still lists. A session-reference preparation failure occurs after prompt acceptance and terminates that agent turn.
39
+
40
+ -----
41
+
42
+ <a id="understand-the-implementation"></a>
43
+ ## Understand the implementation
44
+
45
+ <details>
46
+ <summary>Implementation internals — click to expand</summary>
47
+
48
+ The source keeps candidate encoding internal to the registration effect: the `/client` export is the plugin body (`apply`/`inject`) only.
49
+
50
+ ### Candidate flow
51
+
52
+ For an unquoted token, the browser starts the `fileReferences/list` and `sessionReferenceResolver/candidates` Remote calls together, then deterministically orders files before sessions with locale-registered folder/file/session labels. Rows render under non-selectable file and session section headings without a redundant raw `reference` source title. A session row is dated from the Host session list's `updatedAt` through the same relative-time bucket that list uses, so one session reads the same age on both surfaces; a session the list does not carry falls back to the candidate's creation time. A drilled query publishes a breadcrumb from the workspace root to the directory being listed; each crumb carries the drill payload a folder row would, so returning to a step and descending into one are one outcome.
53
+
54
+ ### Serialization
55
+
56
+ File picks preserve the natural text defined by the shared `@path` grammar as the hidden serialized and clipboard form. Session picks use the canonical `@[label](dsh-session:…)` mention; serialization never reconstructs identity from the visible title.
57
+
58
+ </details>
59
+
60
+ -----
61
+
62
+ <a id="further-exploration"></a>
63
+ ## Further Exploration
64
+
65
+ These pages cover the suggestion machinery, the reference seams, and the input pipeline.
66
+
67
+ - [ui-input-trigger](../ui-input-trigger/README.md) — the inline suggestion machinery the source registers into.
68
+ - [file-reference](../../context/file-reference/README.md) — the `@file` seam and its provider contract.
69
+ - [session-reference](../../context/session-reference/README.md) — the `@session` seam and prepared snapshot semantics.
70
+ - [Web input machine and slash pipeline](../../../.agents/notes/implemented/architecture/2026-07-25-web-input-machine-and-slash-pipeline.md) — how references and commands share the input machine.
71
+
72
+ -----
73
+
74
+ <a id="model-experience"></a>
75
+ ## Model Experience
76
+
77
+ Indirectly, through Host-owned providers, which own the file guidance and session snapshot preparation this package's reference selection delegates to them.
78
+
79
+ #### KV Cache effect
80
+
81
+ Candidate browsing has no model effect. A selected file or session changes only the new user-message suffix and any Host-prepared session-reference context that follows that message; earlier target history remains unchanged.
82
+
83
+ ## Known Limitations and Deferred Work
84
+
85
+ <a id="known-limitations-and-deferred-work"></a>
86
+
87
+
88
+ These limits define when the reference source cannot help; they are current package constraints.
89
+
90
+ - **Candidate failure is intentionally quiet** — one unavailable or failed Remote discovery call yields no rows for that domain. A session-reference preparation failure occurs after prompt acceptance and terminates that agent turn.
91
+ - **No browser-side file scan** — Web completion requires a mounted Host `ctx.fileReferences` provider; the browser cannot fall back to its own filesystem.
92
+ - **Session search remains metadata-only** — discovery filters session id, cwd, and the latest log-backed title through `ctx.sessionReferenceResolver`; message bodies and full transcripts are not searched.
93
+
94
+ <a id="dev-note"></a>
95
+ ### Dev Note
96
+
97
+ <details>
98
+ <summary>Working context for maintainers — click to expand</summary>
99
+
100
+ None.
101
+
102
+ </details>
package/README.zh.md ADDED
@@ -0,0 +1,102 @@
1
+ ---
2
+ description: "Web @file 与 @session 引用 source:候选项、排序,以及原子行内引用(统一的文件/会话选取)。"
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @deepseek-ai/dsh-client-ui-reference
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ `dsh-client-ui-reference` 是统一的 Web `@file` 与 `@session` 引用 source:它把 `reference` 条目注册进编辑器的行内建议机制,让用户在输入 `@` 时于同一个列表中看到文件与会话候选。文件排在会话之前,分组标题使用注册在 locale 字典中的标签,任一候选领域失败都会独立降级、不阻塞另一领域。每一行只承载能区分它的信息:文件显示其父目录、位于工作区根目录时不显示;会话仅在其工作区不是当前工作区时显示该工作区;下钻后的目录列表不显示位置,因为面包屑已经承载了它。选择一项会插入原子行内引用——文件、文件夹与会话皆然——其隐藏的序列化与剪贴板形式就是共享 `@path` 语法所定义的自然文本;目录行额外携带一个钻取动词(Tab 或行尾 chevron),保持可编辑的路径纯文本并让菜单在尾部斜杠处保持活跃,用户可以继续进入下一层。选择会话会经 session-reference 服务路由,该服务校验 mention 并在 pre-step 边界捕获模型上下文;本包自身不注册任何提示词或工具。
13
+
14
+ ## 目录
15
+
16
+ - [使用本包](#use-this-package)
17
+ - [理解实现](#understand-the-implementation)
18
+ - [进一步探索](#further-exploration)
19
+ - [模型体验](#model-experience)
20
+ - [已知限制与延期工作](#known-limitations-and-deferred-work)
21
+ - [开发备注](#dev-note)
22
+
23
+ -----
24
+
25
+ <a id="use-this-package"></a>
26
+ ## 使用本包
27
+
28
+ 只要组合挂载了本包且存在宿主 `ctx.fileReferences` 提供方,该 source 即处于活动状态。输入 `@` 后跟一个未加引号的 token,会先看到文件、再看到会话;打开 `@"…` 则只搜索文件。候选列表是补全菜单,不是搜索结果页:选一次、继续输入即可。
29
+
30
+ ### 选择后会插入什么
31
+
32
+ 选择文件会关闭补全,并显示为带文件图标与业务色文件名的原子行内引用。目录行携带两个动词:选定 pick(点击行主体或 Enter)把文件夹本身解析为同类原子引用——文件夹图标、带尾斜杠的标签、以规范 `@dir/` mention 为序列化形式;钻取动作(Tab 或行尾 chevron)则保持带文件夹图标的可编辑路径纯文本,并让菜单在尾部斜杠处保持活跃,用户可以继续进入下一层。包含空白的路径使用 `@"path with spaces"`,用户显式打开的引号会继续保留。
33
+
34
+ 选择会话会插入一个原子的行内引用,其隐藏 `ref` 与剪贴板表示均为宿主返回的规范 `@[label](dsh-session:…)` mention;可见形式为聊天气泡图标加会话标题。发送会经 `session.prompt` 携带该 mention,session-reference 服务会在 `agent/pre-step` 校验它并捕获模型上下文。
35
+
36
+ ### 失败行为
37
+
38
+ 某个候选领域不可用或失败时,该领域不产生任何行,另一领域仍正常列出。会话引用准备失败发生在提示词接受后,并会终止该 agent 轮次。
39
+
40
+ -----
41
+
42
+ <a id="understand-the-implementation"></a>
43
+ ## 理解实现
44
+
45
+ <details>
46
+ <summary>实现细节——点击展开</summary>
47
+
48
+ 该 source 把候选编码保留在注册 effect 内部:`/client` 导出接口只包含插件主体(`apply`/`inject`)。
49
+
50
+ ### 候选流程
51
+
52
+ 对于未加引号的 token,浏览器会同时启动 `fileReferences/list` 与 `sessionReferenceResolver/candidates` Remote 调用,再以确定性顺序把文件排在会话之前,并使用注册在 locale 字典中的文件夹、文件与会话标签。各行分别渲染在不可选择的文件与会话分组标题下,不显示重复的原始 `reference` source 标题。会话行用宿主会话列表的 `updatedAt` 经该列表相同的相对时间分档标注时间,因此同一个会话在两处读到的时长一致;列表中没有的会话回落到候选自带的创建时间。下钻后的查询会发布一条从工作区根目录到当前所列目录的面包屑;每一节携带的下钻载荷与文件夹行相同,因此「回到某一步」与「进入某一层」是同一个结果。
53
+
54
+ ### 序列化
55
+
56
+ 文件选择把共享 `@path` 语法所定义的自然文本保留为隐藏的序列化与剪贴板形式。会话选择使用规范的 `@[label](dsh-session:…)` mention;序列化永远不会根据可见标题重建身份。
57
+
58
+ </details>
59
+
60
+ -----
61
+
62
+ <a id="further-exploration"></a>
63
+ ## 进一步探索
64
+
65
+ 以下页面覆盖建议机制、引用 seam 与输入流水线。
66
+
67
+ - [ui-input-trigger](../ui-input-trigger/README.zh.md)——该 source 注册进的行内建议机制。
68
+ - [file-reference](../../context/file-reference/README.zh.md)——`@file` seam 及其提供方约定。
69
+ - [session-reference](../../context/session-reference/README.zh.md)——`@session` seam 与准备后快照的语义。
70
+ - [Web 输入机器与 slash 流水线](../../../.agents/notes/implemented/architecture/2026-07-25-web-input-machine-and-slash-pipeline.zh.md)——引用与命令如何共享输入机器。
71
+
72
+ -----
73
+
74
+ <a id="model-experience"></a>
75
+ ## 模型体验
76
+
77
+ 间接影响模型体验:通过宿主拥有的提供方实现,本包的引用选择把文件指引与会话快照准备委托给它们。
78
+
79
+ #### KV Cache 影响
80
+
81
+ 浏览候选项不会影响模型。选择文件或会话只会改变新用户消息的后缀,以及紧随该消息、由宿主准备的会话引用上下文;目标会话更早的历史保持不变。
82
+
83
+ ## 已知限制与延期工作
84
+
85
+ <a id="known-limitations-and-deferred-work"></a>
86
+
87
+
88
+ 这些限制说明引用 source 何时帮不上忙;它们是当前包约束。
89
+
90
+ - **候选失败有意保持静默**:Remote 发现调用不可用或失败时,该领域不产生候选行。会话引用准备失败发生在提示词接受后,并会终止该 agent 轮次。
91
+ - **浏览器侧不扫描文件**:Web 补全需要挂载宿主 `ctx.fileReferences` 提供方;浏览器无法回退到自身文件系统。
92
+ - **会话搜索仍仅使用元数据**:发现流程通过 `ctx.sessionReferenceResolver` 筛选 session id、cwd 与以日志为依据的最新标题;不搜索消息主体或完整 transcript。
93
+
94
+ <a id="dev-note"></a>
95
+ ### 开发备注
96
+
97
+ <details>
98
+ <summary>维护者的工作上下文——点击展开</summary>
99
+
100
+ 无。
101
+
102
+ </details>
package/lib/client.js ADDED
@@ -0,0 +1,254 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "@prettier-ai/dsh-client-ui-reference",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ let _prettier_ai_dsh_client_ui_primitives = require("@prettier-ai/dsh-client-ui-primitives");
8
+ //#region ../../context/file-reference/src/grammar.ts
9
+ /**
10
+ * Format a selected path as prompt text. Whitespace uses the quoted
11
+ * `@"path"` grammar; a quoted directory keeps that quote open after its
12
+ * trailing slash so completion can descend another level.
13
+ * @param candidate - selected file or directory.
14
+ * @param preserveQuote - retain an explicitly opened quote even when unnecessary.
15
+ * @returns the insertion value, or `undefined` for a path the editor grammar cannot represent safely.
16
+ */
17
+ function formatFileMention(candidate, preserveQuote) {
18
+ const path = candidate.kind === "directory" ? `${candidate.path}/` : candidate.path;
19
+ if (/[\u0000-\u001f\u007f-\u009f"]/u.test(path)) return void 0;
20
+ if (!(preserveQuote || /\s/u.test(path))) return `@${path}`;
21
+ if (candidate.kind === "directory") return `@"${path}`;
22
+ return `@"${path}"`;
23
+ }
24
+ //#endregion
25
+ //#region ../../util/workspace-path/src/index.ts
26
+ /**
27
+ * Browser-safe Workspace path and display helpers.
28
+ * @module @prettier-ai/dsh-util-workspace-path
29
+ */
30
+ /** Whether a path uses a Windows drive or UNC prefix. */
31
+ function isWindowsStylePath(value) {
32
+ return /^[A-Za-z]:[/\\]/.test(value) || value.startsWith("\\\\");
33
+ }
34
+ /**
35
+ * Abbreviate a POSIX home directory for display.
36
+ * @param path - Absolute or already-short display path.
37
+ * @param home - Host account home; absent skips abbreviation.
38
+ * @returns `~` or `~/…` for the POSIX home and its descendants, otherwise `path`.
39
+ */
40
+ function abbreviateHomePath(path, home) {
41
+ if (home === void 0 || home === "") return path;
42
+ if (isWindowsStylePath(path) || isWindowsStylePath(home)) return path;
43
+ const root = home.replace(/\/+$/, "");
44
+ if (root === "" || root === "/") return path;
45
+ if (path.replace(/\/+$/, "") === root) return "~";
46
+ if (path.startsWith(`${root}/`)) return `~${path.slice(root.length)}`;
47
+ return path;
48
+ }
49
+ //#endregion
50
+ //#region lib/types/client/locales.js
51
+ /** `reference` namespace dictionaries for the unified `@` source. */
52
+ /** Dictionary namespace owned by this plugin. */
53
+ const NS = "reference";
54
+ /**
55
+ * Simplified Chinese dictionary (the key-set source of truth).
56
+ *
57
+ * The `time.*` bucket words are this namespace's own copy of the session-row
58
+ * vocabulary: locale-owned copy keeps the words per plugin, while the
59
+ * bucketing they name is the one shared {@link relativeTime} in ui-primitives.
60
+ */
61
+ const zh = {
62
+ "section.files": "文件与文件夹",
63
+ "section.sessions": "对话",
64
+ "candidate.noCwd": "(无工作目录)",
65
+ "crumb.root": "工作区",
66
+ "time.now": "刚刚",
67
+ "time.minutes": "{n}分钟",
68
+ "time.hours": "{n}小时",
69
+ "time.days": "{n}天",
70
+ "time.months": "{n}个月",
71
+ "time.years": "{n}年"
72
+ };
73
+ /** English dictionary, checked complete against the zh key set. */
74
+ const en = {
75
+ "section.files": "Files & folders",
76
+ "section.sessions": "Sessions",
77
+ "candidate.noCwd": "(no cwd)",
78
+ "crumb.root": "Workspace",
79
+ "time.now": "now",
80
+ "time.minutes": "{n}min",
81
+ "time.hours": "{n}h",
82
+ "time.days": "{n}d",
83
+ "time.months": "{n}mo",
84
+ "time.years": "{n}y"
85
+ };
86
+ //#endregion
87
+ //#region lib/types/client/index.js
88
+ /** Required services: the trigger registry, the Remote namespaces, and the copy. */
89
+ const inject = [
90
+ "inputTriggers",
91
+ "locale",
92
+ "connection",
93
+ "sessions",
94
+ "remote",
95
+ "remote.fileReferences",
96
+ "remote.sessionReferenceResolver"
97
+ ];
98
+ /**
99
+ * Register the combined `@file` / `@session` source.
100
+ * @param ctx - client root context.
101
+ */
102
+ function apply(ctx) {
103
+ ctx.effect(() => ctx.locale.register(NS, {
104
+ zh,
105
+ en
106
+ }), "ui-reference: dictionaries");
107
+ const t = ctx.locale.bind(NS);
108
+ const connection = ctx.get("connection");
109
+ const sessions = ctx.get("sessions");
110
+ const source = {
111
+ trigger: "@",
112
+ name: "reference",
113
+ showGroupTitle: false,
114
+ async candidates(session, { query, quoted, drilled, signal }) {
115
+ const fileLookup = ctx.remote.fileReferences.list(session.sessionId, query, signal).then((result) => result.ok ? result.value : [], () => []);
116
+ const sessionLookup = quoted === true ? Promise.resolve([]) : ctx.remote.sessionReferenceResolver.candidates(session.sessionId, query, signal).then((result) => result.ok ? result.value : [], () => []);
117
+ const [fileItems, sessionItems] = await Promise.all([fileLookup, sessionLookup]);
118
+ if (signal.aborted) return [];
119
+ const withLocation = crumbsFor(query, quoted === true, drilled, t) === void 0;
120
+ const now = Date.now();
121
+ const home = connection.generation.getSnapshot()?.host.home;
122
+ const listed = sessions.list.getSnapshot().byId;
123
+ return [...fileItems.flatMap((candidate) => fileCandidate(candidate, quoted === true, withLocation, t)), ...sessionItems.map((candidate) => sessionCandidate(candidate, listed[candidate.sessionId]?.updatedAt ?? candidate.createdAt, now, home, t))];
124
+ },
125
+ header(_session, req) {
126
+ return crumbsFor(req.query, req.quoted === true, req.drilled, t);
127
+ },
128
+ onPick({ candidate, action }) {
129
+ const value = parseCandidate(candidate.value);
130
+ if (value?.kind === "file") {
131
+ if (value.fileKind === "directory" && action === "drill") return {
132
+ text: value.mention,
133
+ continue: true
134
+ };
135
+ return { insert: {
136
+ source: "reference",
137
+ ref: value.mention,
138
+ label: value.fileKind === "directory" ? `${value.label}/` : value.label,
139
+ appearance: value.fileKind === "directory" ? "folder" : "file",
140
+ clipboardText: value.mention
141
+ } };
142
+ }
143
+ if (value?.kind === "session") return { insert: {
144
+ source: "reference",
145
+ ref: value.mention,
146
+ label: value.label,
147
+ appearance: "session",
148
+ clipboardText: value.mention
149
+ } };
150
+ },
151
+ codec: {
152
+ clipboardText: (ref) => ref,
153
+ serialize: (ref) => Promise.resolve(ref)
154
+ }
155
+ };
156
+ const inputTriggers = ctx.get("inputTriggers");
157
+ ctx.effect(() => inputTriggers.registerSource(source), "ui-reference: @ source");
158
+ }
159
+ /**
160
+ * The breadcrumb of a drilled directory listing, from the workspace root down
161
+ * to the directory being listed.
162
+ *
163
+ * Only a drill produces one: a path the user typed carries its own context in
164
+ * the draft, while a drill replaced the text they were reading with a deeper
165
+ * one and owes them the way back.
166
+ * @param query - the live query, path text following `@` or `@"`.
167
+ * @param quoted - whether the active token is an open quoted path.
168
+ * @param drilled - whether a drill pick, rather than typing, produced the query.
169
+ * @param t - the reference dictionary.
170
+ * @returns the crumbs, or undefined when this listing needs no header.
171
+ */
172
+ function crumbsFor(query, quoted, drilled, t) {
173
+ if (!drilled) return void 0;
174
+ const slash = query.lastIndexOf("/");
175
+ if (slash < 0) return void 0;
176
+ const segments = query.slice(0, slash).split("/").filter((segment) => segment !== "");
177
+ const crumbs = [{
178
+ label: t("crumb.root"),
179
+ value: directoryValue(t("crumb.root"), quoted ? "@\"" : "@")
180
+ }];
181
+ for (const [index, segment] of segments.entries()) {
182
+ const mention = formatFileMention({
183
+ path: segments.slice(0, index + 1).join("/"),
184
+ kind: "directory"
185
+ }, quoted);
186
+ if (mention === void 0) return void 0;
187
+ crumbs.push({
188
+ label: segment,
189
+ value: directoryValue(segment, mention),
190
+ ...index === segments.length - 1 ? { current: true } : {}
191
+ });
192
+ }
193
+ return crumbs;
194
+ }
195
+ /** Project one directory destination as the drill payload `onPick` already understands. */
196
+ function directoryValue(label, mention) {
197
+ return JSON.stringify({
198
+ kind: "file",
199
+ fileKind: "directory",
200
+ label,
201
+ mention
202
+ });
203
+ }
204
+ function fileCandidate(candidate, preserveQuote, withLocation, t) {
205
+ const mention = formatFileMention(candidate, preserveQuote);
206
+ if (mention === void 0) return [];
207
+ const slash = candidate.path.lastIndexOf("/");
208
+ const name = candidate.path.slice(slash + 1);
209
+ const parent = slash < 0 ? "" : candidate.path.slice(0, slash);
210
+ const directory = candidate.kind === "directory";
211
+ const value = {
212
+ kind: "file",
213
+ fileKind: candidate.kind,
214
+ label: name,
215
+ mention
216
+ };
217
+ return [{
218
+ name: `${name}${directory ? "/" : ""}`,
219
+ ...withLocation && parent !== "" ? { description: parent } : {},
220
+ icon: directory ? "folder" : "file",
221
+ section: t("section.files"),
222
+ value: JSON.stringify(value),
223
+ ...directory ? { drill: true } : {}
224
+ }];
225
+ }
226
+ function sessionCandidate(candidate, updatedAt, now, home, t) {
227
+ const { unit, n } = (0, _prettier_ai_dsh_client_ui_primitives.relativeTime)(updatedAt, now);
228
+ const age = unit === "now" ? t("time.now") : t(`time.${unit}`, { n });
229
+ const location = candidate.sameWorkspace ? void 0 : candidate.cwd === void 0 ? t("candidate.noCwd") : abbreviateHomePath(candidate.cwd, home);
230
+ const value = {
231
+ kind: "session",
232
+ label: candidate.label,
233
+ mention: candidate.mention
234
+ };
235
+ return {
236
+ name: candidate.label,
237
+ description: location === void 0 ? age : `${location} · ${age}`,
238
+ icon: "session",
239
+ section: t("section.sessions"),
240
+ value: JSON.stringify(value)
241
+ };
242
+ }
243
+ function parseCandidate(value) {
244
+ if (value === void 0) return void 0;
245
+ return JSON.parse(value);
246
+ }
247
+ //#endregion
248
+ exports.apply = apply;
249
+ exports.inject = inject;
250
+ return module.exports;
251
+ }
252
+ });
253
+
254
+ //# sourceMappingURL=client.js.map
package/lib/index.js ADDED
@@ -0,0 +1,11 @@
1
+ //#region lib/types/index.js
2
+ /**
3
+ * File/session reference plugin, node half. Pure UI plugin: the empty apply
4
+ * exists so the plugin appears in the host cordis.yml / Loader; the browser
5
+ * half ships via exports["./client"], discovered through the package.json
6
+ * `dsh.client` declaration.
7
+ */
8
+ /** Host plugin body — no host-side behavior for this source plugin. */
9
+ function apply() {}
10
+ //#endregion
11
+ export { apply };
@@ -0,0 +1,24 @@
1
+ //#region lib/types/invariant.js
2
+ /**
3
+ * Package-owned invariant companion for `@prettier-ai/dsh-client-ui-reference`.
4
+ * @module @prettier-ai/dsh-client-ui-reference/invariant
5
+ */
6
+ const PACKAGE_NAME = "@prettier-ai/dsh-client-ui-reference";
7
+ /** Cordis companion plugin name. */
8
+ const name = "client-ui-reference-invariant";
9
+ /** Service required before the companion can reserve package ownership. */
10
+ const inject = ["invariants"];
11
+ /**
12
+ * No runtime invariant: a single slash-source registration whose disposal is
13
+ * proven by the HMR-safety spec — it emits no cordis events and owns no
14
+ * cross-plugin mutable state.
15
+ */
16
+ const install = () => {};
17
+ /**
18
+ * Register this package's invariant companion.
19
+ * @param ctx - Cordis context carrying the invariant service.
20
+ * @returns the installed registration's disposer after setup succeeds.
21
+ */
22
+ const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
23
+ //#endregion
24
+ export { apply, inject, name };
@@ -0,0 +1,9 @@
1
+ import type { Context as ClientContext } from '@prettier-ai/cordis';
2
+ /** Required services: the trigger registry, the Remote namespaces, and the copy. */
3
+ export declare const inject: string[];
4
+ /**
5
+ * Register the combined `@file` / `@session` source.
6
+ * @param ctx - client root context.
7
+ */
8
+ export declare function apply(ctx: ClientContext): void;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,44 @@
1
+ /** `reference` namespace dictionaries for the unified `@` source. */
2
+ /** Dictionary namespace owned by this plugin. */
3
+ export declare const NS = "reference";
4
+ /**
5
+ * Simplified Chinese dictionary (the key-set source of truth).
6
+ *
7
+ * The `time.*` bucket words are this namespace's own copy of the session-row
8
+ * vocabulary: locale-owned copy keeps the words per plugin, while the
9
+ * bucketing they name is the one shared {@link relativeTime} in ui-primitives.
10
+ */
11
+ export declare const zh: {
12
+ 'section.files': string;
13
+ 'section.sessions': string;
14
+ 'candidate.noCwd': string;
15
+ 'crumb.root': string;
16
+ 'time.now': string;
17
+ 'time.minutes': string;
18
+ 'time.hours': string;
19
+ 'time.days': string;
20
+ 'time.months': string;
21
+ 'time.years': string;
22
+ };
23
+ /** The reference namespace key union. */
24
+ export type ReferenceKey = keyof typeof zh;
25
+ declare module '@prettier-ai/dsh-client-ui-slots' {
26
+ interface LocaleNamespaceMap {
27
+ /** The unified `@` reference menu's copy. */
28
+ reference: ReferenceKey;
29
+ }
30
+ }
31
+ /** English dictionary, checked complete against the zh key set. */
32
+ export declare const en: {
33
+ 'section.files': string;
34
+ 'section.sessions': string;
35
+ 'candidate.noCwd': string;
36
+ 'crumb.root': string;
37
+ 'time.now': string;
38
+ 'time.minutes': string;
39
+ 'time.hours': string;
40
+ 'time.days': string;
41
+ 'time.months': string;
42
+ 'time.years': string;
43
+ };
44
+ //# sourceMappingURL=locales.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * File/session reference plugin, node half. Pure UI plugin: the empty apply
3
+ * exists so the plugin appears in the host cordis.yml / Loader; the browser
4
+ * half ships via exports["./client"], discovered through the package.json
5
+ * `dsh.client` declaration.
6
+ */
7
+ /** Host plugin body — no host-side behavior for this source plugin. */
8
+ export declare function apply(): void;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Package-owned invariant companion for `@prettier-ai/dsh-client-ui-reference`.
3
+ * @module @prettier-ai/dsh-client-ui-reference/invariant
4
+ */
5
+ import type { Context } from '@prettier-ai/cordis';
6
+ /** Cordis companion plugin name. */
7
+ export declare const name = "client-ui-reference-invariant";
8
+ /** Service required before the companion can reserve package ownership. */
9
+ export declare const inject: string[];
10
+ /**
11
+ * Register this package's invariant companion.
12
+ * @param ctx - Cordis context carrying the invariant service.
13
+ * @returns the installed registration's disposer after setup succeeds.
14
+ */
15
+ export declare const apply: (ctx: Context) => Promise<() => void>;
16
+ //# sourceMappingURL=invariant.d.ts.map
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@prettier-ai/dsh-client-ui-reference",
3
+ "description": "Unified Web @file and @session reference source",
4
+ "version": "0.1.2-alpha.1",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "packages/client/ui-reference"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./invariant": {
22
+ "types": "./lib/types/invariant.d.ts",
23
+ "default": "./lib/invariant.js"
24
+ },
25
+ "./client": {
26
+ "types": "./lib/types/client/index.d.ts",
27
+ "default": "./lib/client.js"
28
+ },
29
+ "./src/*": "./src/*",
30
+ "./package.json": "./package.json"
31
+ },
32
+ "dsh": {
33
+ "client": {
34
+ "inject": [
35
+ "@prettier-ai/dsh-api-remotes",
36
+ "@prettier-ai/dsh-api-session-controller",
37
+ "@prettier-ai/dsh-client-connection",
38
+ "@prettier-ai/dsh-client-locale",
39
+ "@prettier-ai/dsh-client-ui-input-trigger"
40
+ ],
41
+ "platform": "web"
42
+ }
43
+ },
44
+ "license": "MIT",
45
+ "peerDependencies": {
46
+ "@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.1",
47
+ "@prettier-ai/dsh-client-locale": "^0.1.2-alpha.1",
48
+ "@prettier-ai/dsh-client-ui-input-trigger": "^0.1.2-alpha.1",
49
+ "@prettier-ai/dsh-client-connection": "^0.1.2-alpha.1",
50
+ "@prettier-ai/dsh-file-reference": "^0.1.2-alpha.1",
51
+ "@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
52
+ "@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.1",
53
+ "@prettier-ai/dsh-session-reference": "^0.1.2-alpha.1",
54
+ "@prettier-ai/dsh-typert-protocol": "^0.1.2-alpha.1",
55
+ "@prettier-ai/dsh-util-workspace-path": "^0.1.2-alpha.1",
56
+ "@prettier-ai/cordis": "^4.0.1"
57
+ },
58
+ "devDependencies": {
59
+ "@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.1",
60
+ "@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.1",
61
+ "@prettier-ai/dsh-client-connection": "^0.1.2-alpha.1",
62
+ "@prettier-ai/dsh-client-ui-input-trigger": "^0.1.2-alpha.1",
63
+ "@prettier-ai/dsh-client-locale": "^0.1.2-alpha.1",
64
+ "@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.1",
65
+ "@prettier-ai/dsh-client-ui-slots": "^0.1.2-alpha.1",
66
+ "@prettier-ai/dsh-file-reference": "^0.1.2-alpha.1",
67
+ "@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
68
+ "@prettier-ai/dsh-typert-protocol": "^0.1.2-alpha.1",
69
+ "@prettier-ai/dsh-session-reference": "^0.1.2-alpha.1",
70
+ "@prettier-ai/dsh-util-workspace-path": "^0.1.2-alpha.1",
71
+ "@prettier-ai/cordis": "^4.0.1"
72
+ },
73
+ "files": [
74
+ "lib/index.js",
75
+ "lib/invariant.js",
76
+ "lib/client.js",
77
+ "lib/types/**/*.d.ts"
78
+ ],
79
+ "scripts": {
80
+ "bundle": "tsdown",
81
+ "watch": "tsdown --watch"
82
+ }
83
+ }