@deepseek-ai/dsh-client-ui-reference 0.1.5-rc.1 → 0.1.6-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/README.i18n.yaml +2 -2
- package/README.md +2 -0
- package/README.zh.md +2 -0
- package/lib/client.js +61 -1
- package/package.json +17 -15
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/client/ui-reference/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 1a79a22425fff1c7323a3bcb55afd324decbe5e8
|
|
6
|
+
README.zh.md: 7cde5e46e69f008e9fcfffeb3920184d90bddb60
|
package/README.md
CHANGED
|
@@ -37,6 +37,8 @@ A session pick inserts an atomic inline reference whose hidden `ref` and clipboa
|
|
|
37
37
|
|
|
38
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
39
|
|
|
40
|
+
Click a file reference in the composer to preview its current contents in the right Sidebar. Quoted paths retain their spaces, and paths resolve in the composer Session. Folder and Session references retain their editing behavior.
|
|
41
|
+
|
|
40
42
|
-----
|
|
41
43
|
|
|
42
44
|
<a id="understand-the-implementation"></a>
|
package/README.zh.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -22,12 +22,46 @@ window.__ModuleLoader__.load({
|
|
|
22
22
|
return `@"${path}"`;
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
25
|
+
//#region ../../util/workspace-path/src/file-address.ts
|
|
26
|
+
/** The scheme and type every file address opens with. */
|
|
27
|
+
const FILE_ADDRESS_PREFIX = "dsh-resource://file/";
|
|
28
|
+
/** Component-encode one id or path segment, keeping `:` literal for drive letters. */
|
|
29
|
+
function encodeSegment(segment) {
|
|
30
|
+
return encodeURIComponent(segment).replace(/%3A/gi, ":");
|
|
31
|
+
}
|
|
32
|
+
/** Encode a `/`-separated path segment by segment. */
|
|
33
|
+
function encodePath(path) {
|
|
34
|
+
return path.split("/").map(encodeSegment).join("/");
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build the address of a file read through one Session.
|
|
38
|
+
* @param sessionId - the Session whose Host workspace resolves the path.
|
|
39
|
+
* @param path - absolute or workspace-relative path; backslashes are normalized to `/`, and leading `./` prefixes are dropped.
|
|
40
|
+
* @returns the `dsh-resource://file/session/<sessionId>/<path>` address.
|
|
41
|
+
*/
|
|
42
|
+
function sessionFileAddress(sessionId, path) {
|
|
43
|
+
const normalized = path.replace(/\\/g, "/").replace(/^(?:\.\/)+/, "");
|
|
44
|
+
return `${FILE_ADDRESS_PREFIX}session/${encodeSegment(sessionId)}/${encodePath(normalized)}`;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
25
47
|
//#region ../../util/workspace-path/src/index.ts
|
|
48
|
+
/**
|
|
49
|
+
* Browser-safe Workspace path and display helpers.
|
|
50
|
+
* @module @deepseek-ai/dsh-util-workspace-path
|
|
51
|
+
*/
|
|
26
52
|
/** Whether a path uses a Windows drive or UNC prefix. */
|
|
27
53
|
function isWindowsStylePath(value) {
|
|
28
54
|
return /^[A-Za-z]:[/\\]/.test(value) || value.startsWith("\\\\");
|
|
29
55
|
}
|
|
30
56
|
/**
|
|
57
|
+
* Whether a path is absolute in either spelling the Host accepts: POSIX (`/a/b`) or Windows drive or UNC.
|
|
58
|
+
* @param path - the path to classify.
|
|
59
|
+
* @returns `true` for an absolute path; `false` for a Workspace-relative one.
|
|
60
|
+
*/
|
|
61
|
+
function isAbsoluteWorkspacePath(path) {
|
|
62
|
+
return path.startsWith("/") || isWindowsStylePath(path);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
31
65
|
* Abbreviate a POSIX home directory for display.
|
|
32
66
|
* @param path - Absolute or already-short display path.
|
|
33
67
|
* @param home - Host account home; absent skips abbreviation.
|
|
@@ -42,6 +76,24 @@ window.__ModuleLoader__.load({
|
|
|
42
76
|
if (path.startsWith(`${root}/`)) return `~${path.slice(root.length)}`;
|
|
43
77
|
return path;
|
|
44
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* The address for a path as a caller holds it: a relative path, or an absolute
|
|
81
|
+
* path inside the Session's workspace, becomes a `session`-scoped address; an
|
|
82
|
+
* absolute path outside it, or one whose workspace root is unknown, keeps its
|
|
83
|
+
* absolute path in that Session's address.
|
|
84
|
+
* @param sessionId - the Session the path is read in.
|
|
85
|
+
* @param cwd - that Session's workspace root, when known.
|
|
86
|
+
* @param path - absolute or workspace-relative path, in either separator spelling.
|
|
87
|
+
* @returns the `dsh-resource://file/…` address.
|
|
88
|
+
*/
|
|
89
|
+
function fileAddressFor(sessionId, cwd, path) {
|
|
90
|
+
const normalized = path.replace(/\\/g, "/");
|
|
91
|
+
if (!isAbsoluteWorkspacePath(normalized)) return sessionFileAddress(sessionId, normalized);
|
|
92
|
+
const root = cwd === void 0 ? "" : cwd.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
93
|
+
if (root !== "" && normalized === root) return sessionFileAddress(sessionId, "");
|
|
94
|
+
if (root !== "" && normalized.startsWith(`${root}/`)) return sessionFileAddress(sessionId, normalized.slice(root.length + 1));
|
|
95
|
+
return sessionFileAddress(sessionId, normalized);
|
|
96
|
+
}
|
|
45
97
|
//#endregion
|
|
46
98
|
//#region lib/types/client/locales.js
|
|
47
99
|
/** `reference` namespace dictionaries for the unified `@` source. */
|
|
@@ -88,7 +140,8 @@ window.__ModuleLoader__.load({
|
|
|
88
140
|
"sessions",
|
|
89
141
|
"remote",
|
|
90
142
|
"remote.fileReferences",
|
|
91
|
-
"remote.sessionReferenceResolver"
|
|
143
|
+
"remote.sessionReferenceResolver",
|
|
144
|
+
"sidebarRight"
|
|
92
145
|
];
|
|
93
146
|
/**
|
|
94
147
|
* Register the combined `@file` / `@session` source.
|
|
@@ -142,6 +195,13 @@ window.__ModuleLoader__.load({
|
|
|
142
195
|
clipboardText: value.mention
|
|
143
196
|
} };
|
|
144
197
|
},
|
|
198
|
+
openReference(session, { ref, appearance }) {
|
|
199
|
+
if (appearance !== "file") return false;
|
|
200
|
+
const path = ref.startsWith("@\"") ? ref.slice(2, -1) : ref.slice(1);
|
|
201
|
+
const cwd = sessions.list.getSnapshot().byId[session.sessionId]?.cwd;
|
|
202
|
+
ctx.sidebarRight.openResource(fileAddressFor(session.sessionId, cwd, path));
|
|
203
|
+
return true;
|
|
204
|
+
},
|
|
145
205
|
codec: {
|
|
146
206
|
clipboardText: (ref) => ref,
|
|
147
207
|
serialize: (ref) => Promise.resolve(ref)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-client-ui-reference",
|
|
3
3
|
"description": "Unified Web @file and @session reference source",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.6-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"@deepseek-ai/dsh-api-session-controller",
|
|
33
33
|
"@deepseek-ai/dsh-client-connection",
|
|
34
34
|
"@deepseek-ai/dsh-client-locale",
|
|
35
|
-
"@deepseek-ai/dsh-client-ui-input-trigger"
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-input-trigger",
|
|
36
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right"
|
|
36
37
|
],
|
|
37
38
|
"platform": "web"
|
|
38
39
|
}
|
|
@@ -42,19 +43,20 @@
|
|
|
42
43
|
"@deepseek-ai/cordis": "^4.0.2"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@deepseek-ai/dsh-api-
|
|
46
|
-
"@deepseek-ai/dsh-api-
|
|
47
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
48
|
-
"@deepseek-ai/dsh-client-connection": "^0.1.
|
|
49
|
-
"@deepseek-ai/dsh-client-
|
|
50
|
-
"@deepseek-ai/dsh-client-
|
|
51
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.
|
|
52
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.
|
|
53
|
-
"@deepseek-ai/dsh-file-reference": "^0.1.
|
|
54
|
-
"@deepseek-ai/dsh-session-reference": "^0.1.
|
|
55
|
-
"@deepseek-ai/dsh-typert-protocol": "^0.1.
|
|
56
|
-
"@deepseek-ai/dsh-util-workspace-path": "^0.1.
|
|
57
|
-
"@deepseek-ai/cordis": "^4.0.2"
|
|
46
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.6-alpha.1",
|
|
47
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.1.6-alpha.1",
|
|
48
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.6-alpha.1",
|
|
49
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.6-alpha.1",
|
|
50
|
+
"@deepseek-ai/dsh-client-test-runtime": "^0.1.6-alpha.1",
|
|
51
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": "^0.1.6-alpha.1",
|
|
52
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.6-alpha.1",
|
|
53
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.6-alpha.1",
|
|
54
|
+
"@deepseek-ai/dsh-file-reference": "^0.1.6-alpha.1",
|
|
55
|
+
"@deepseek-ai/dsh-session-reference": "^0.1.6-alpha.1",
|
|
56
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.6-alpha.1",
|
|
57
|
+
"@deepseek-ai/dsh-util-workspace-path": "^0.1.6-alpha.1",
|
|
58
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": "^0.1.6-alpha.1"
|
|
58
60
|
},
|
|
59
61
|
"files": [
|
|
60
62
|
"lib/index.js",
|