@deepseek-ai/dsh-file-reference-local 0.2.1-alpha.1 → 0.2.1-alpha.3
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 +3 -1
- package/README.zh.md +3 -1
- package/lib/index.js +15 -10
- package/lib/types/index.js +12 -10
- package/locale/en.json +5 -0
- package/locale/zh.json +6 -0
- package/package.json +19 -13
package/README.i18n.yaml
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
en: d152484eb41ac6b4
|
|
16
16
|
zh: 09388d293f9be9cb
|
|
17
17
|
/deepseek-ai-dsh-file-reference-local/use-this-package:
|
|
18
|
-
en:
|
|
19
|
-
zh:
|
|
18
|
+
en: 1fd922f09d15163f
|
|
19
|
+
zh: e1d68a27a676256d
|
|
20
20
|
/deepseek-ai-dsh-file-reference-local/use-this-package/enabling-the-provider:
|
|
21
21
|
en: 62b9ce096fa4a94e
|
|
22
22
|
zh: 53081797c34d64eb
|
package/README.md
CHANGED
|
@@ -25,7 +25,9 @@ Agents and host UIs can complete `@file` mentions with ranked paths from each ag
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## Use this package
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Changing the Session's working directory discards the previous directory's search index; the next completion searches the new directory.
|
|
29
|
+
|
|
30
|
+
Mount this provider when `@file` completion should discover the Harness host's own filesystem — the namespace the shipped `read` tool operates on. Each agent's workspace is indexed from its Session's current working directory.
|
|
29
31
|
|
|
30
32
|
### Enabling the provider
|
|
31
33
|
|
package/README.zh.md
CHANGED
|
@@ -25,7 +25,9 @@ agent(智能体)及宿主 UI 可以用各 agent 本地工作区中经过排
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## 使用本包
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
切换 Session 工作目录后,旧目录的搜索索引会被丢弃;下一次补全会搜索新目录。
|
|
29
|
+
|
|
30
|
+
当 `@file` 补全应发现 Harness 宿主自身的文件系统——即随附 `read` 工具所操作的命名空间——时,挂载此提供方。每个 agent 的工作区从其 Session 当前工作目录开始建立索引。
|
|
29
31
|
|
|
30
32
|
### 启用提供方
|
|
31
33
|
|
package/lib/index.js
CHANGED
|
@@ -318,7 +318,7 @@ function errorReason(reason, fallback) {
|
|
|
318
318
|
*/
|
|
319
319
|
/** Local-filesystem owner of the file-reference discovery service. */
|
|
320
320
|
var LocalFileReferenceService = class extends FileReferenceService {
|
|
321
|
-
static inject = ["agents"];
|
|
321
|
+
static inject = ["agents", "workingDirectory"];
|
|
322
322
|
static Config = z.object({
|
|
323
323
|
maxResults: z.number().step(1).min(1).default(20),
|
|
324
324
|
maxEntries: z.number().step(1).min(1).default(DEFAULT_FILE_SEARCH_MAX_ENTRIES),
|
|
@@ -366,30 +366,35 @@ var LocalFileReferenceService = class extends FileReferenceService {
|
|
|
366
366
|
await installPrompt(agent);
|
|
367
367
|
});
|
|
368
368
|
ctx.on("agent/disposed", ({ agent }) => {
|
|
369
|
-
this.searches.get(agent)?.dispose();
|
|
369
|
+
this.searches.get(agent)?.search.dispose();
|
|
370
370
|
this.searches.delete(agent);
|
|
371
371
|
disposePrompt(agent);
|
|
372
372
|
});
|
|
373
373
|
ctx.on("session/event", (session, event) => {
|
|
374
374
|
if (event.type !== "tool/result") return;
|
|
375
375
|
const agent = ctx.agents.get(session.id);
|
|
376
|
-
if (agent !== void 0) this.searches.get(agent)?.invalidate();
|
|
376
|
+
if (agent !== void 0) this.searches.get(agent)?.search.invalidate();
|
|
377
377
|
});
|
|
378
378
|
ctx.effect(() => async () => {
|
|
379
|
-
for (const search of this.searches.values()) search.dispose();
|
|
379
|
+
for (const { search } of this.searches.values()) search.dispose();
|
|
380
380
|
this.searches.clear();
|
|
381
381
|
const promptFibers = [...this.promptFibers.values()];
|
|
382
382
|
this.promptFibers.clear();
|
|
383
383
|
await Promise.all([...promptFibers.map((fiber) => fiber.dispose()), ...this.promptDisposals]);
|
|
384
384
|
}, "file-reference-local: search cache");
|
|
385
385
|
}
|
|
386
|
-
list(agent, query, signal) {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
386
|
+
async list(agent, query, signal) {
|
|
387
|
+
const cwd = await this.ctx.workingDirectory.ensure(agent, signal);
|
|
388
|
+
let cached = this.searches.get(agent);
|
|
389
|
+
if (cached?.cwd !== cwd) {
|
|
390
|
+
cached?.search.dispose();
|
|
391
|
+
cached = {
|
|
392
|
+
cwd,
|
|
393
|
+
search: new WorkspaceFileSearch(cwd, this.config)
|
|
394
|
+
};
|
|
395
|
+
this.searches.set(agent, cached);
|
|
391
396
|
}
|
|
392
|
-
return search.list(query, signal);
|
|
397
|
+
return cached.search.list(query, signal);
|
|
393
398
|
}
|
|
394
399
|
};
|
|
395
400
|
function validateConfig(config) {
|
package/lib/types/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export { FILE_REFERENCE_PROMPT } from '@deepseek-ai/dsh-file-reference';
|
|
|
11
11
|
export { activeAtToken, formatFileMention } from '@deepseek-ai/dsh-file-reference/grammar';
|
|
12
12
|
/** Local-filesystem owner of the file-reference discovery service. */
|
|
13
13
|
export class LocalFileReferenceService extends FileReferenceService {
|
|
14
|
-
static inject = ['agents'];
|
|
14
|
+
static inject = ['agents', 'workingDirectory'];
|
|
15
15
|
static Config = z.object({
|
|
16
16
|
maxResults: z.number().step(1).min(1).default(DEFAULT_FILE_SEARCH_MAX_RESULTS),
|
|
17
17
|
maxEntries: z.number().step(1).min(1).default(DEFAULT_FILE_SEARCH_MAX_ENTRIES),
|
|
@@ -60,7 +60,7 @@ export class LocalFileReferenceService extends FileReferenceService {
|
|
|
60
60
|
installPrompt(agent);
|
|
61
61
|
ctx.on('agent/created', async ({ agent }) => { await installPrompt(agent); });
|
|
62
62
|
ctx.on('agent/disposed', ({ agent }) => {
|
|
63
|
-
this.searches.get(agent)?.dispose();
|
|
63
|
+
this.searches.get(agent)?.search.dispose();
|
|
64
64
|
this.searches.delete(agent);
|
|
65
65
|
disposePrompt(agent);
|
|
66
66
|
});
|
|
@@ -69,10 +69,10 @@ export class LocalFileReferenceService extends FileReferenceService {
|
|
|
69
69
|
return;
|
|
70
70
|
const agent = ctx.agents.get(session.id);
|
|
71
71
|
if (agent !== undefined)
|
|
72
|
-
this.searches.get(agent)?.invalidate();
|
|
72
|
+
this.searches.get(agent)?.search.invalidate();
|
|
73
73
|
});
|
|
74
74
|
ctx.effect(() => async () => {
|
|
75
|
-
for (const search of this.searches.values())
|
|
75
|
+
for (const { search } of this.searches.values())
|
|
76
76
|
search.dispose();
|
|
77
77
|
this.searches.clear();
|
|
78
78
|
const promptFibers = [...this.promptFibers.values()];
|
|
@@ -83,13 +83,15 @@ export class LocalFileReferenceService extends FileReferenceService {
|
|
|
83
83
|
]);
|
|
84
84
|
}, 'file-reference-local: search cache');
|
|
85
85
|
}
|
|
86
|
-
list(agent, query, signal) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
async list(agent, query, signal) {
|
|
87
|
+
const cwd = await this.ctx.workingDirectory.ensure(agent, signal);
|
|
88
|
+
let cached = this.searches.get(agent);
|
|
89
|
+
if (cached?.cwd !== cwd) {
|
|
90
|
+
cached?.search.dispose();
|
|
91
|
+
cached = { cwd, search: new WorkspaceFileSearch(cwd, this.config) };
|
|
92
|
+
this.searches.set(agent, cached);
|
|
91
93
|
}
|
|
92
|
-
return search.list(query, signal);
|
|
94
|
+
return cached.search.list(query, signal);
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
function validateConfig(config) {
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-file-reference-local",
|
|
3
3
|
"description": "Local-filesystem ctx.fileReferences provider with bounded fuzzy indexes",
|
|
4
|
-
"version": "0.2.1-alpha.
|
|
4
|
+
"version": "0.2.1-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -23,29 +23,35 @@
|
|
|
23
23
|
"default": "./lib/types/search.js"
|
|
24
24
|
},
|
|
25
25
|
"./src/*": "./src/*",
|
|
26
|
-
"./package.json": "./package.json"
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
"./locale/*.json": "./locale/*.json"
|
|
27
28
|
},
|
|
28
29
|
"files": [
|
|
30
|
+
"locale/*.json",
|
|
29
31
|
"lib/index.js",
|
|
30
32
|
"lib/types/**/*.js",
|
|
31
33
|
"lib/types/**/*.d.ts"
|
|
32
34
|
],
|
|
33
35
|
"license": "MIT",
|
|
34
36
|
"dependencies": {
|
|
35
|
-
"@deepseek-ai/schemastery": "~3.18.5-alpha.
|
|
37
|
+
"@deepseek-ai/schemastery": "~3.18.5-alpha.2"
|
|
36
38
|
},
|
|
37
39
|
"peerDependencies": {
|
|
38
|
-
"@deepseek-ai/dsh-agent": "0.2.1-alpha.
|
|
39
|
-
"@deepseek-ai/dsh-file-reference": "0.2.1-alpha.
|
|
40
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.
|
|
41
|
-
"@deepseek-ai/dsh-tools": "0.2.1-alpha.
|
|
42
|
-
"@deepseek-ai/cordis": "~4.0.5-alpha.
|
|
40
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.3",
|
|
41
|
+
"@deepseek-ai/dsh-file-reference": "0.2.1-alpha.3",
|
|
42
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.3",
|
|
43
|
+
"@deepseek-ai/dsh-tools": "0.2.1-alpha.3",
|
|
44
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2",
|
|
45
|
+
"@deepseek-ai/dsh-working-directory": "0.2.1-alpha.3"
|
|
43
46
|
},
|
|
44
47
|
"devDependencies": {
|
|
45
|
-
"@deepseek-ai/dsh-agent": "0.2.1-alpha.
|
|
46
|
-
"@deepseek-ai/dsh-file-reference": "0.2.1-alpha.
|
|
47
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.
|
|
48
|
-
"@deepseek-ai/dsh-tools": "0.2.1-alpha.
|
|
49
|
-
"@deepseek-ai/cordis": "~4.0.5-alpha.
|
|
48
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.3",
|
|
49
|
+
"@deepseek-ai/dsh-file-reference": "0.2.1-alpha.3",
|
|
50
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.3",
|
|
51
|
+
"@deepseek-ai/dsh-tools": "0.2.1-alpha.3",
|
|
52
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2",
|
|
53
|
+
"@deepseek-ai/dsh-working-directory": "0.2.1-alpha.3",
|
|
54
|
+
"@deepseek-ai/dsh-fs-local": "0.2.1-alpha.3",
|
|
55
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.3"
|
|
50
56
|
}
|
|
51
57
|
}
|