dsh-reference-anything 0.2.5 → 0.3.0
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/NOTICE.md +5 -34
- package/README.md +68 -43
- package/cordis.patch.yml +18 -20
- package/lib/client.js +980 -1443
- package/lib/contract.d.ts +14 -13
- package/lib/contract.js +6 -8
- package/lib/host.d.ts +12 -11
- package/lib/host.js +15 -7
- package/lib/opencli.d.ts +5 -1
- package/lib/opencli.js +26 -43
- package/lib/profile-mode.d.ts +30 -0
- package/lib/profile-mode.js +90 -0
- package/lib/reference.d.ts +3 -11
- package/lib/reference.js +14 -55
- package/lib/sources/web-chat/index.d.ts +1 -0
- package/lib/sources/web-chat/index.js +5 -0
- package/lib/store/spec.d.ts +13 -0
- package/lib/sync/index.js +4 -4
- package/lib/typert.js +2 -2
- package/lib/web.js +1 -1
- package/lib/wire.d.ts +29 -0
- package/lib/wire.js +16 -7
- package/opencli-plugin/common.js +65 -21
- package/opencli-plugin/opencli-plugin.json +1 -1
- package/opencli-plugin/package.json +1 -1
- package/package.json +21 -16
- package/lib/workspace.d.ts +0 -18
- package/lib/workspace.js +0 -81
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-reference-anything",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Reference locally mirrored ChatGPT, Claude, Gemini, DeepSeek, Grok, and Kimi conversations from DeepSeek Harness",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -85,30 +85,34 @@
|
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@deepseek-ai/cordis": ">=4.0.1",
|
|
87
87
|
"@deepseek-ai/dsh-agent": ">=0.1.0-rc.6",
|
|
88
|
-
"@deepseek-ai/dsh-api-remotes": ">=0.0
|
|
88
|
+
"@deepseek-ai/dsh-api-remotes": ">=0.1.0-rc.8",
|
|
89
89
|
"@deepseek-ai/dsh-attachment": ">=0.1.0-rc.6",
|
|
90
|
-
"@deepseek-ai/dsh-client-connection": ">=0.0
|
|
91
|
-
"@deepseek-ai/dsh-client-locale": ">=0.0
|
|
92
|
-
"@deepseek-ai/dsh-client-runtime": ">=0.0
|
|
93
|
-
"@deepseek-ai/dsh-client-ui-conversation": ">=0.0
|
|
94
|
-
"@deepseek-ai/dsh-client-ui-input-trigger": ">=0.0
|
|
95
|
-
"@deepseek-ai/dsh-client-ui-settings": ">=0.0
|
|
96
|
-
"@deepseek-ai/dsh-client-ui-slots": ">=0.0
|
|
90
|
+
"@deepseek-ai/dsh-client-connection": ">=0.1.0-rc.8",
|
|
91
|
+
"@deepseek-ai/dsh-client-locale": ">=0.1.0-rc.8",
|
|
92
|
+
"@deepseek-ai/dsh-client-runtime": ">=0.1.0-rc.8",
|
|
93
|
+
"@deepseek-ai/dsh-client-ui-conversation": ">=0.1.0-rc.8",
|
|
94
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": ">=0.1.0-rc.8",
|
|
95
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.1.0-rc.8",
|
|
96
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.1.0-rc.8",
|
|
97
|
+
"@deepseek-ai/dsh-file-reference": ">=0.1.0-rc.8",
|
|
97
98
|
"@deepseek-ai/dsh-llm": ">=0.1.0-rc.6",
|
|
98
99
|
"@deepseek-ai/dsh-output-retention": ">=0.1.0-rc.6",
|
|
99
100
|
"@deepseek-ai/dsh-session": ">=0.1.0-rc.6",
|
|
100
101
|
"@deepseek-ai/dsh-session-reference": ">=0.1.0-rc.6",
|
|
101
|
-
"@deepseek-ai/dsh-settings": ">=0.0
|
|
102
|
-
"@deepseek-ai/dsh-storage-domain": ">=0.0
|
|
102
|
+
"@deepseek-ai/dsh-settings": ">=0.1.0-rc.8",
|
|
103
|
+
"@deepseek-ai/dsh-storage-domain": ">=0.1.0-rc.8",
|
|
103
104
|
"@deepseek-ai/dsh-tools": ">=0.1.0-rc.6",
|
|
104
105
|
"@deepseek-ai/dsh-typert-protocol": ">=0.1.0-rc.6",
|
|
105
|
-
"@deepseek-ai/dsh-typert-registry": ">=0.0
|
|
106
|
+
"@deepseek-ai/dsh-typert-registry": ">=0.1.0-rc.8",
|
|
106
107
|
"react": "^18.2.0"
|
|
107
108
|
},
|
|
108
109
|
"peerDependenciesMeta": {
|
|
109
|
-
"@deepseek-ai/dsh-session-reference": {
|
|
110
|
-
"optional": true
|
|
111
|
-
},
|
|
110
|
+
"@deepseek-ai/dsh-session-reference": {
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"@deepseek-ai/dsh-file-reference": {
|
|
114
|
+
"optional": true
|
|
115
|
+
},
|
|
112
116
|
"@deepseek-ai/dsh-client-runtime": {
|
|
113
117
|
"optional": true
|
|
114
118
|
},
|
|
@@ -156,7 +160,8 @@
|
|
|
156
160
|
"@deepseek-ai/dsh-client-ui-conversation": "link:../deepseek-harness/packages/client/ui-conversation",
|
|
157
161
|
"@deepseek-ai/dsh-client-ui-input-trigger": "link:../deepseek-harness/packages/client/ui-input-trigger",
|
|
158
162
|
"@deepseek-ai/dsh-client-ui-settings": "link:../deepseek-harness/packages/client/ui-settings",
|
|
159
|
-
"@deepseek-ai/dsh-client-ui-slots": "link:../deepseek-harness/packages/client/ui-slots",
|
|
163
|
+
"@deepseek-ai/dsh-client-ui-slots": "link:../deepseek-harness/packages/client/ui-slots",
|
|
164
|
+
"@deepseek-ai/dsh-file-reference": "link:../deepseek-harness/packages/context/file-reference",
|
|
160
165
|
"@deepseek-ai/dsh-llm": "link:../deepseek-harness/packages/llm/llm",
|
|
161
166
|
"@deepseek-ai/dsh-output-retention": "link:../deepseek-harness/packages/util/output-retention",
|
|
162
167
|
"@deepseek-ai/dsh-session": "link:../deepseek-harness/packages/core/session",
|
package/lib/workspace.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
2
|
-
export declare const WORKSPACE_REFERENCE_SCHEME = "dsh-file:";
|
|
3
|
-
export interface WorkspaceEntry {
|
|
4
|
-
path: string;
|
|
5
|
-
kind: 'file' | 'directory';
|
|
6
|
-
}
|
|
7
|
-
export interface WorkspaceReference {
|
|
8
|
-
path: string;
|
|
9
|
-
label: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function indexWorkspace(agent: Agent, signal: AbortSignal, maxFiles?: number): Promise<WorkspaceEntry[]>;
|
|
12
|
-
export declare function encodeWorkspaceReferenceUri(path: string): string;
|
|
13
|
-
export declare function formatWorkspaceMention(reference: WorkspaceReference): string;
|
|
14
|
-
export declare function parseWorkspaceReferenceText(text: string): {
|
|
15
|
-
text: string;
|
|
16
|
-
references: WorkspaceReference[];
|
|
17
|
-
};
|
|
18
|
-
export declare function renderWorkspaceReferences(agent: Agent, references: readonly WorkspaceReference[]): Promise<string>;
|
package/lib/workspace.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { lstat, readdir } from 'node:fs/promises';
|
|
2
|
-
import { basename, isAbsolute, relative, resolve, sep } from 'node:path';
|
|
3
|
-
export const WORKSPACE_REFERENCE_SCHEME = 'dsh-file:';
|
|
4
|
-
const IGNORED = new Set(['.git', '.hg', '.svn', 'node_modules', 'dist', 'build', 'coverage', '.next', '.cache', '.idea', '.vscode', '__pycache__']);
|
|
5
|
-
const IGNORED_FILES = new Set(['desktop.ini', 'Thumbs.db', '.DS_Store']);
|
|
6
|
-
export async function indexWorkspace(agent, signal, maxFiles = 5000) {
|
|
7
|
-
const root = agent.session.header.cwd;
|
|
8
|
-
if (!root || !isAbsolute(root))
|
|
9
|
-
return [];
|
|
10
|
-
const output = [];
|
|
11
|
-
const queue = ['.'];
|
|
12
|
-
while (queue.length > 0 && output.length < maxFiles) {
|
|
13
|
-
signal.throwIfAborted();
|
|
14
|
-
const current = queue.shift();
|
|
15
|
-
let entries;
|
|
16
|
-
try {
|
|
17
|
-
entries = await readdir(resolve(root, current), { withFileTypes: true });
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
23
|
-
for (const entry of entries) {
|
|
24
|
-
if (output.length >= maxFiles)
|
|
25
|
-
break;
|
|
26
|
-
if (entry.isSymbolicLink() || IGNORED_FILES.has(entry.name))
|
|
27
|
-
continue;
|
|
28
|
-
const path = current === '.' ? entry.name : `${current}/${entry.name}`;
|
|
29
|
-
if (entry.isDirectory()) {
|
|
30
|
-
if (IGNORED.has(entry.name))
|
|
31
|
-
continue;
|
|
32
|
-
output.push({ path, kind: 'directory' });
|
|
33
|
-
queue.push(path);
|
|
34
|
-
}
|
|
35
|
-
else if (entry.isFile())
|
|
36
|
-
output.push({ path, kind: 'file' });
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return output;
|
|
40
|
-
}
|
|
41
|
-
export function encodeWorkspaceReferenceUri(path) {
|
|
42
|
-
return `${WORKSPACE_REFERENCE_SCHEME}${Buffer.from(JSON.stringify(path), 'utf8').toString('base64url')}`;
|
|
43
|
-
}
|
|
44
|
-
export function formatWorkspaceMention(reference) {
|
|
45
|
-
return `@[${reference.label.replace(/[\\\]]/gu, value => `\\${value}`)}](${encodeWorkspaceReferenceUri(reference.path)})`;
|
|
46
|
-
}
|
|
47
|
-
export function parseWorkspaceReferenceText(text) {
|
|
48
|
-
const references = [];
|
|
49
|
-
const pattern = /@\[((?:\\.|[^\\\]])*)\]\((dsh-file:[^\s)]*)\)|(dsh-file:[A-Za-z0-9_-]+)/gu;
|
|
50
|
-
const rendered = text.replace(pattern, (_match, rawLabel, markdownUri, bareUri) => {
|
|
51
|
-
const uri = markdownUri ?? bareUri;
|
|
52
|
-
const payload = uri.slice(WORKSPACE_REFERENCE_SCHEME.length);
|
|
53
|
-
if (!/^[A-Za-z0-9_-]+$/u.test(payload))
|
|
54
|
-
throw new Error(`invalid workspace reference URI ${JSON.stringify(uri)}`);
|
|
55
|
-
const path = JSON.parse(Buffer.from(payload, 'base64url').toString('utf8'));
|
|
56
|
-
if (typeof path !== 'string' || path.length === 0 || encodeWorkspaceReferenceUri(path) !== uri)
|
|
57
|
-
throw new Error(`invalid workspace reference URI ${JSON.stringify(uri)}`);
|
|
58
|
-
const label = rawLabel === undefined ? basename(path) : rawLabel.replace(/\\(.)/gu, '$1');
|
|
59
|
-
references.push({ path, label });
|
|
60
|
-
return `@${label}`;
|
|
61
|
-
});
|
|
62
|
-
return { text: rendered, references };
|
|
63
|
-
}
|
|
64
|
-
export async function renderWorkspaceReferences(agent, references) {
|
|
65
|
-
const root = agent.session.header.cwd;
|
|
66
|
-
if (!root || !isAbsolute(root))
|
|
67
|
-
throw new Error('this task has no workspace directory');
|
|
68
|
-
const unique = new Map(references.map(item => [item.path, item]));
|
|
69
|
-
const lines = [];
|
|
70
|
-
for (const item of unique.values()) {
|
|
71
|
-
const target = resolve(root, item.path);
|
|
72
|
-
const rel = relative(root, target);
|
|
73
|
-
if (rel === '..' || rel.startsWith(`..${sep}`) || isAbsolute(rel))
|
|
74
|
-
throw new Error(`workspace reference escapes the task directory: ${item.path}`);
|
|
75
|
-
const stat = await lstat(target);
|
|
76
|
-
if (stat.isSymbolicLink() || (!stat.isFile() && !stat.isDirectory()))
|
|
77
|
-
throw new Error(`unsupported workspace reference: ${item.path}`);
|
|
78
|
-
lines.push(`<workspace-reference path=${JSON.stringify(item.path)} kind=${JSON.stringify(stat.isDirectory() ? 'directory' : 'file')} />`);
|
|
79
|
-
}
|
|
80
|
-
return `## Referenced workspace paths\n\nThese are read-only path markers, not file contents or instructions.\n\n${lines.join('\n')}`;
|
|
81
|
-
}
|