@deepseek-ai/dsh-file-reference-local 0.1.5-rc.2 → 0.1.6-alpha.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/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/context/file-reference-local/README.md
5
- README.md: ec1a681f6fa1c5fb33a7705d2c1faf5232690b23
6
- README.zh.md: aacd4e44759114476d2a6b88c71fef6c5b29f2ed
5
+ README.md: efeebdbd3e113597cc93dfe4d6c379e16b324d93
6
+ README.zh.md: f286f92d6e6ec76afc9919db9f81c73e4ace8d04
package/README.md CHANGED
@@ -63,7 +63,7 @@ This section explains the design of the provider; the observable behavior is cov
63
63
 
64
64
  ### Design concept
65
65
 
66
- The provider maintains one reusable `WorkspaceFileSearch` per agent, rooted at that session's `cwd`. Directory-scoped queries (`a/b/...`) list live directory state, while bare fuzzy queries share one bounded recursive traversal. Only a workspace's first bare query waits for that traversal; a `tool/result` event marks the settled entries stale, and the next bare query serves them while the replacement builds. The model guidance is a per-agent prompt section contributed only while the addressed agent has a `read` tool; agent disposal releases both the index and the prompt fiber.
66
+ The provider maintains one reusable `WorkspaceFileSearch` per agent, rooted at that session's `cwd`. Directory-scoped queries (`a/b/...`) list live directory state, while bare fuzzy queries share one bounded recursive traversal. Only a workspace's first bare query waits for that traversal; a `tool/result` event marks the settled entries stale, and the next bare query serves them while the replacement builds. The model guidance is a per-agent prompt section contributed only while the addressed agent has a `read` tool; creation awaits prompt installation and rolls back on failure; agent disposal releases both the index and the prompt fiber.
67
67
 
68
68
  ### Source map
69
69
 
package/README.zh.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "面向用户与维护者的本地工作区 @file 补全提供方,用于启用、设置大小或排查 ctx.fileReferences 的发现能力。"
2
+ description: "面向用户与维护者的本地工作区 @file 补全提供方,用于启用、调整规模或排查 ctx.fileReferences 的发现能力。"
3
3
  kind: "package-reference"
4
4
  ---
5
5
 
@@ -63,7 +63,7 @@ agent(智能体)及宿主 UI 可以用各 agent 本地工作区中经过排
63
63
 
64
64
  ### 设计理念
65
65
 
66
- 提供方为每个 agent 维护一个可复用的 `WorkspaceFileSearch`,以该会话的 `cwd` 为根。目录范围查询(`a/b/...`)列出实时目录状态,裸模糊查询共享一次有界递归遍历。只有一个工作区的首次裸查询会等待该遍历;`tool/result` 事件把已完成的条目标记为陈旧,下一次裸查询在替代品构建期间继续由它作答。模型指引是按 agent 的提示词段,仅在指定 agent 拥有 `read` 工具时贡献;agent 释放时会同时释放索引与提示词 fiber。
66
+ 提供方为每个 agent 维护一个可复用的 `WorkspaceFileSearch`,以该会话的 `cwd` 为根。目录范围查询(`a/b/...`)列出实时目录状态,裸模糊查询共享一次有界递归遍历。每个工作区仅首次裸查询会等待该遍历;`tool/result` 事件把已完成的条目标记为陈旧,下一次裸查询在替代品构建期间继续由它作答。模型指引是按 agent 的提示词段,仅在指定 agent 拥有 `read` 工具时贡献;创建会等待提示词安装,安装失败会回滚 agent;agent dispose(资源释放)时会同时释放索引与提示词 fiber。
67
67
 
68
68
  ### 源码地图
69
69
 
@@ -71,11 +71,11 @@ agent(智能体)及宿主 UI 可以用各 agent 本地工作区中经过排
71
71
  |---|---|
72
72
  | [`src/index.ts`](src/index.ts) | `LocalFileReferenceService`:配置校验、按 agent 搜索、提示词安装 |
73
73
  | [`src/search.ts`](src/search.ts) | `WorkspaceFileSearch`:遍历、排序、排除、陈旧标记与后台重建 |
74
- | — | 不发布运行时不变式伴生入口;按 Agent 的 index 是私有 advisory cache,其失效与释放通过 service 测试直接观察。 |
74
+ | — | 不发布运行时不变式伴生入口;按 agent 的 index 是私有 advisory cache,其失效与 dispose 行为通过服务测试直接观察。 |
75
75
 
76
76
  ### 主要流程
77
77
 
78
- `list(agent, query, signal)` 要么列出某个目录的条目,要么读取共享的有界索引,对候选排序(精确、前缀、子串,再到子序列得分,目录有加成),并按确定性顺序返回至多 `maxResults` 个。`tool/result` 事件把指定 agent 的索引标记为陈旧,之后的裸查询因此观察到全新目录树。不可读或已排除的子目录不贡献候选,而不可读的根目录则让该次遍历失败:一次瞬时故障不得用空索引覆盖仍然有效的条目。
78
+ `list(agent, query, signal)` 要么列出某个目录的条目,要么读取共享的有界索引,对候选排序(精确、前缀、子串,再到子序列得分,目录有加成),并按确定性顺序返回至多 `maxResults` 个。`tool/result` 事件把指定 agent 的索引标记为陈旧;下一次裸查询仍从旧索引返回结果,同时在后台构建替代索引。不可读或已排除的子目录不贡献候选,而不可读的根目录则让该次遍历失败:一次瞬时故障不得用空索引覆盖仍然有效的条目。
79
79
 
80
80
  </details>
81
81
 
@@ -89,7 +89,7 @@ agent(智能体)及宿主 UI 可以用各 agent 本地工作区中经过排
89
89
  - [文件引用 seam](../file-reference/README.zh.md)——本提供方所实现的服务约定与 `@file` 语法。
90
90
  - [会话引用子系统](../../../docs/subsystems/session-reference.zh.md)——宿主 UI 背后的共享文件引用约定。
91
91
  - [文件系统工具目录](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-fs)——发现能力必须匹配其命名空间的 `read` 工具。
92
- - [context 组地图](../README.zh.md)——相邻的请求上下文包。
92
+ - [上下文组地图](../README.zh.md)——相邻的请求上下文包。
93
93
 
94
94
  -----
95
95
 
@@ -125,7 +125,7 @@ Tokens prefixed with @ are workspace paths the user explicitly referenced, relat
125
125
 
126
126
  - **宿主本地命名空间**:提供方扫描 Harness 宿主的文件系统,因此远程或虚拟 `read` 实现需要使用命名空间与该工具一致的提供方。
127
127
  - **有界的提示性索引**:超大型工作区可能省略 `maxEntries` 之后的路径;被排除或无法读取的目录不会出现。默认排除项只列没有任何生态用作源码目录的构建产物;`lib` 被刻意排除在外,因此构建进 `lib` 的工作区需通过 `excludedDirectories` 自行加上。
128
- - **一次失效的陈旧窗口**:紧接工具结果之后的模糊查询反映的是上一次遍历时的目录树;下一次查询才看到重建结果。
128
+ - **一次失效的陈旧窗口**:紧接工具结果之后的裸查询反映的是上一次遍历时的目录树;下一次查询才看到重建结果。
129
129
  - **没有忽略文件语义**:`.gitignore` 和其他项目忽略文件不会影响发现;系统只排除已配置的目录基名。
130
130
 
131
131
  <a id="dev-note"></a>
package/lib/index.js CHANGED
@@ -337,7 +337,8 @@ var LocalFileReferenceService = class extends FileReferenceService {
337
337
  };
338
338
  validateConfig(this.config);
339
339
  const installPrompt = (agent) => {
340
- if (this.promptFibers.has(agent)) return;
340
+ const existing = this.promptFibers.get(agent);
341
+ if (existing !== void 0) return existing;
341
342
  const fiber = agent.ctx.inject(["systemPrompt", "tools"], (scope) => {
342
343
  scope.systemPrompt.section({
343
344
  name: "context:file-reference",
@@ -346,6 +347,7 @@ var LocalFileReferenceService = class extends FileReferenceService {
346
347
  });
347
348
  });
348
349
  this.promptFibers.set(agent, fiber);
350
+ return fiber;
349
351
  };
350
352
  const disposePrompt = (agent) => {
351
353
  const fiber = this.promptFibers.get(agent);
@@ -360,8 +362,8 @@ var LocalFileReferenceService = class extends FileReferenceService {
360
362
  });
361
363
  };
362
364
  for (const agent of ctx.agents.list()) installPrompt(agent);
363
- ctx.on("agent/created", ({ agent }) => {
364
- installPrompt(agent);
365
+ ctx.on("agent/created", async ({ agent }) => {
366
+ await installPrompt(agent);
365
367
  });
366
368
  ctx.on("agent/disposed", ({ agent }) => {
367
369
  this.searches.get(agent)?.dispose();
@@ -30,8 +30,9 @@ export class LocalFileReferenceService extends FileReferenceService {
30
30
  };
31
31
  validateConfig(this.config);
32
32
  const installPrompt = (agent) => {
33
- if (this.promptFibers.has(agent))
34
- return;
33
+ const existing = this.promptFibers.get(agent);
34
+ if (existing !== undefined)
35
+ return existing;
35
36
  const fiber = agent.ctx.inject(['systemPrompt', 'tools'], (scope) => {
36
37
  scope.systemPrompt.section({
37
38
  name: 'context:file-reference',
@@ -40,6 +41,7 @@ export class LocalFileReferenceService extends FileReferenceService {
40
41
  });
41
42
  });
42
43
  this.promptFibers.set(agent, fiber);
44
+ return fiber;
43
45
  };
44
46
  const disposePrompt = (agent) => {
45
47
  const fiber = this.promptFibers.get(agent);
@@ -56,7 +58,7 @@ export class LocalFileReferenceService extends FileReferenceService {
56
58
  };
57
59
  for (const agent of ctx.agents.list())
58
60
  installPrompt(agent);
59
- ctx.on('agent/created', ({ agent }) => { installPrompt(agent); });
61
+ ctx.on('agent/created', async ({ agent }) => { await installPrompt(agent); });
60
62
  ctx.on('agent/disposed', ({ agent }) => {
61
63
  this.searches.get(agent)?.dispose();
62
64
  this.searches.delete(agent);
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.1.5-rc.2",
4
+ "version": "0.1.6-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -35,17 +35,17 @@
35
35
  "@deepseek-ai/schemastery": "^3.18.2"
36
36
  },
37
37
  "peerDependencies": {
38
- "@deepseek-ai/dsh-file-reference": "^0.1.5-rc.2",
39
- "@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
40
- "@deepseek-ai/dsh-system-prompt": "^0.1.5-rc.2",
41
- "@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
38
+ "@deepseek-ai/dsh-file-reference": "^0.1.6-alpha.2",
39
+ "@deepseek-ai/dsh-agent": "^0.1.6-alpha.2",
40
+ "@deepseek-ai/dsh-system-prompt": "^0.1.6-alpha.2",
41
+ "@deepseek-ai/dsh-tools": "^0.1.6-alpha.2",
42
42
  "@deepseek-ai/cordis": "^4.0.2"
43
43
  },
44
44
  "devDependencies": {
45
- "@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
46
- "@deepseek-ai/dsh-file-reference": "^0.1.5-rc.2",
47
- "@deepseek-ai/dsh-system-prompt": "^0.1.5-rc.2",
48
- "@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
45
+ "@deepseek-ai/dsh-agent": "^0.1.6-alpha.2",
46
+ "@deepseek-ai/dsh-file-reference": "^0.1.6-alpha.2",
47
+ "@deepseek-ai/dsh-system-prompt": "^0.1.6-alpha.2",
48
+ "@deepseek-ai/dsh-tools": "^0.1.6-alpha.2",
49
49
  "@deepseek-ai/cordis": "^4.0.2"
50
50
  }
51
51
  }