@morlay/dsh-reference 0.0.2 → 0.0.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.md +3 -8
- package/dist/index.mjs +0 -5
- package/package.json +2 -2
- package/src/index.ts +4 -8
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# @morlay/dsh-reference
|
|
2
2
|
|
|
3
3
|
**引用展开**:用户消息里手打的 `@path` / `skill:name` 引用在 `agent/pre-step` 展开成注入内容——文件走
|
|
4
|
-
`<file_content>` 内容块(窗口与 `read`
|
|
4
|
+
`<file_content>` 内容块(窗口与 `read` 一致),skill 走正文(要 `skill` 工具可见);读不出的引用静默保持普通
|
|
5
|
+
文本,缺 `ctx.fs` 的部署只做 skill。
|
|
5
6
|
|
|
6
7
|
它不依赖注入通道([`@morlay/dsh-context-assembler`](../dsh-context-assembler/README.md) 的
|
|
7
|
-
`ctx.contextAssembler`):自己挂 `agent/pre-step`、`inject` 只有 `skills
|
|
8
|
+
`ctx.contextAssembler`):自己挂 `agent/pre-step`、`inject` 只有 `skills`,所以装在哪一层
|
|
8
9
|
装配面上都成立。装配落在 [`@morlay/better-session`](../../bundles/better-session/cordis.patch.yml)(一行
|
|
9
10
|
`@morlay/dsh-reference`)。
|
|
10
11
|
|
|
@@ -20,9 +21,3 @@
|
|
|
20
21
|
引用解析(`@a.ts`、`@a.ts#L12-L40`、`@[label](a.ts)`、`skill:name` 等形态与行窗口)复用
|
|
21
22
|
`@morlay/dsh-client-ui-primitives` 的 `reference.ts`——**源码上唯一一份**,构建时内联进本包产物,
|
|
22
23
|
所以发布清单里没有它。
|
|
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.mjs
CHANGED
|
@@ -4752,7 +4752,6 @@ function parseBareReference(raw) {
|
|
|
4752
4752
|
...column === void 0 ? {} : { column: Number(column) }
|
|
4753
4753
|
};
|
|
4754
4754
|
}
|
|
4755
|
-
/** 引号 mention 的起手字符:`@"path with spaces"`。 */
|
|
4756
4755
|
const QUOTED_PATH = "\"";
|
|
4757
4756
|
function parseQuotedReference(body) {
|
|
4758
4757
|
const end = body.indexOf(QUOTED_PATH, 1);
|
|
@@ -4888,10 +4887,6 @@ function sameWindow(left, right) {
|
|
|
4888
4887
|
//#region src/index.ts
|
|
4889
4888
|
const name = "reference";
|
|
4890
4889
|
const inject = ["skills"];
|
|
4891
|
-
/**
|
|
4892
|
-
* 内容之外的一条说明(见层级设计「内容之外的说明」):不说来源,模型会再 read 一遍同一段内容。
|
|
4893
|
-
* 与内容同处一条消息,所以同一步有多个引用时它也只说一次。
|
|
4894
|
-
*/
|
|
4895
4890
|
const NOTE = [
|
|
4896
4891
|
"<system-reminder>",
|
|
4897
4892
|
"这些文件内容是按你消息里的 @ 引用刚读取的,直接用它即可,不必再 read 一遍。",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morlay/dsh-reference",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Reference expansion for dsh: `@path` / `skill:name` in a user message expand into injected content at pre-step. Independent of the injection channel; the reference parser it reuses is inlined into the artifact, so this package ships without a client-side dependency.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"context",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@deepseek-ai/dsh-llm": "0.2.0-rc.1",
|
|
36
36
|
"@deepseek-ai/dsh-session": "0.2.0-rc.1",
|
|
37
37
|
"@deepseek-ai/dsh-skill": "0.2.0-rc.1",
|
|
38
|
-
"@morlay/dsh-client-ui-primitives": "0.0.
|
|
38
|
+
"@morlay/dsh-client-ui-primitives": "0.0.5",
|
|
39
39
|
"@types/mdast": "^4.0.4"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -27,10 +27,8 @@ declare module "@deepseek-ai/dsh-llm" {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* 与内容同处一条消息,所以同一步有多个引用时它也只说一次。
|
|
33
|
-
*/
|
|
30
|
+
// 内容之外的一条说明(见层级设计「内容之外的说明」):不说来源,模型会再 read 一遍同一段内容。
|
|
31
|
+
// 与内容同处一条消息,所以同一步有多个引用时它也只说一次。
|
|
34
32
|
const NOTE = [
|
|
35
33
|
"<system-reminder>",
|
|
36
34
|
"这些文件内容是按你消息里的 @ 引用刚读取的,直接用它即可,不必再 read 一遍。",
|
|
@@ -41,10 +39,8 @@ export function apply(ctx: Context): void {
|
|
|
41
39
|
ctx.on("agent/pre-step", async ({ agent, messages, signal }, next): Promise<PreStepDecision> => {
|
|
42
40
|
const decision = await next();
|
|
43
41
|
if (decision.kind === "reject") return decision;
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
// 工具服务是可选的(`ctx.get` 在未声明 inject 的 ctx 上会抛,所以这里自己兜住):
|
|
47
|
-
// 没有它时不参与判断,按解析结果照常展开。
|
|
42
|
+
// 注入跟着工具走:文件引用要有 `read` 能力、skill 引用要有 `skill` 工具,没有对应工具时注入也没有意义。
|
|
43
|
+
// 工具服务是可选的(没声明 `inject` 时 `ctx.get` 会抛,这里自己兜住):取不到就按解析结果照常展开。
|
|
48
44
|
const tools = ((): unknown => {
|
|
49
45
|
try {
|
|
50
46
|
return ctx.get("tools");
|