@morlay/dsh-reference 0.0.1-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/LICENSE +21 -0
- package/README.md +28 -0
- package/dist/index.d.mts +24 -0
- package/dist/index.mjs +4948 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +52 -0
- package/src/file-content.ts +144 -0
- package/src/index.ts +105 -0
- package/src/links.ts +96 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 morlay
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @morlay/dsh-reference
|
|
2
|
+
|
|
3
|
+
**引用展开**:用户消息里手打的 `@path` / `skill:name` 引用在 `agent/pre-step` 展开成注入内容——文件走
|
|
4
|
+
`<file_content>` 内容块(窗口与 `read` 一致)、skill 走正文与 `skill` 工具;读不出的引用静默保持普通文本。
|
|
5
|
+
|
|
6
|
+
它不依赖注入通道([`@morlay/dsh-context-assembler`](../dsh-context-assembler/README.md) 的
|
|
7
|
+
`ctx.contextAssembler`):自己挂 `agent/pre-step`、`inject` 只有 `skills`,所以在 preset 的通道组之外
|
|
8
|
+
装配也成立。装配落在 [`@morlay/better-session`](../../session/better-session/cordis.patch.yml)(一行
|
|
9
|
+
`@morlay/dsh-reference`)。
|
|
10
|
+
|
|
11
|
+
## 用法
|
|
12
|
+
|
|
13
|
+
装配一行即可,没有 config:
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
- id: reference
|
|
17
|
+
name: "@morlay/dsh-reference"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
引用解析(`@a.ts`、`@a.ts#L12-L40`、`@[label](a.ts)`、`skill:name` 等形态与行窗口)复用
|
|
21
|
+
`@morlay/dsh-client-ui-primitives` 的 `reference.ts`——**源码上唯一一份**,构建时内联进本包产物,
|
|
22
|
+
所以发布清单里没有它。
|
|
23
|
+
|
|
24
|
+
## 文档
|
|
25
|
+
|
|
26
|
+
- 设计与取舍(窗口、信封、读不出的处理):[设计 文件引用内容注入](./.agents/designs/20260920-文件引用内容注入.md)
|
|
27
|
+
- 信封形态(`<file_content>` 由谁定):[设计 上下文注入规则](../dsh-context-assembler/.agents/designs/20260921-上下文注入规则.md)
|
|
28
|
+
- 本包术语:[.agents/CONTEXT.md](./.agents/CONTEXT.md)
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import "@deepseek-ai/dsh-session";
|
|
3
|
+
//#region src/links.d.ts
|
|
4
|
+
interface FileReference {
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly lineStart?: number;
|
|
7
|
+
readonly lineEnd?: number;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/index.d.ts
|
|
11
|
+
declare const name = "reference";
|
|
12
|
+
declare const inject: string[];
|
|
13
|
+
interface FileReferenceSource {
|
|
14
|
+
readonly kind: "file-reference";
|
|
15
|
+
readonly references: readonly FileReference[];
|
|
16
|
+
}
|
|
17
|
+
declare module "@deepseek-ai/dsh-llm" {
|
|
18
|
+
interface MessageSourceMap {
|
|
19
|
+
"file-reference": FileReferenceSource;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
declare function apply(ctx: Context): void;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { FileReferenceSource, apply, inject, name };
|