dsh-plugin-om 0.0.21 → 0.0.23
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 +70 -159
- package/dist/client/OmCompactionCard.d.ts +6 -11
- package/dist/client/OmCompactionCard.d.ts.map +1 -1
- package/dist/client/definition.d.ts +21 -20
- package/dist/client/definition.d.ts.map +1 -1
- package/dist/client/format.d.ts +2 -2
- package/dist/client/format.d.ts.map +1 -1
- package/dist/client/index.d.ts +5 -11
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/locales.d.ts +5 -4
- package/dist/client/locales.d.ts.map +1 -1
- package/dist/client.js +87 -28
- package/dist/client.js.map +1 -1
- package/dist/compress.d.ts +30 -48
- package/dist/compress.d.ts.map +1 -1
- package/dist/config.d.ts +13 -22
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +15 -10
- package/dist/constants.d.ts.map +1 -1
- package/dist/embedding.d.ts +19 -36
- package/dist/embedding.d.ts.map +1 -1
- package/dist/index.d.ts +1 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +584 -772
- package/dist/json-schema.d.ts +4 -7
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/log-index.d.ts +19 -12
- package/dist/log-index.d.ts.map +1 -1
- package/dist/logger.d.ts +3 -3
- package/dist/logger.d.ts.map +1 -1
- package/dist/model-download.d.ts +7 -11
- package/dist/model-download.d.ts.map +1 -1
- package/dist/rate-limit.d.ts +9 -14
- package/dist/rate-limit.d.ts.map +1 -1
- package/dist/recall-output.d.ts +37 -0
- package/dist/recall-output.d.ts.map +1 -0
- package/dist/recall.d.ts +7 -17
- package/dist/recall.d.ts.map +1 -1
- package/dist/semantic-recall.d.ts +10 -19
- package/dist/semantic-recall.d.ts.map +1 -1
- package/dist/summarize.d.ts +56 -49
- package/dist/summarize.d.ts.map +1 -1
- package/dist/types.d.ts +22 -35
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +9 -8
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* ctx.on / ctx.get 等 mixin 方法由 cordis 自身声明,无需本地补充。
|
|
2
|
+
* 共享类型:宿主类型再导出(type-only,编译期擦除)+ 插件领域类型。
|
|
3
|
+
* 导出官方包宿主类型(Context/Agent/Session 等)、PluginConfig、
|
|
4
|
+
* MessageNode/MessageIndex/CompleteMessage(完整消息索引)与 compaction 载荷扩展。
|
|
5
|
+
* 各 dsh-* 包通过 declare module 增强 Context/Events,使 ctx.tools 等获得宿主一致类型。
|
|
7
6
|
*/
|
|
8
7
|
import type { Context, EventOptions, Events } from '@deepseek-ai/cordis';
|
|
9
8
|
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
10
9
|
import type { CompactionId } from '@deepseek-ai/dsh-compaction';
|
|
11
10
|
import type { ToolResultPruner } from '@deepseek-ai/dsh-compaction-tool-result-pruner';
|
|
12
|
-
import type { Message, TokenUsage, UserMessage } from '@deepseek-ai/dsh-llm';
|
|
11
|
+
import type { ContentBlock, ImageBlock, Message, TokenUsage, UserMessage } from '@deepseek-ai/dsh-llm';
|
|
13
12
|
import type { Session, SessionEvent, SessionEventMap } from '@deepseek-ai/dsh-session';
|
|
14
13
|
import type { SubagentResult, SubagentRun, SubagentStartRequest } from '@deepseek-ai/dsh-subagent';
|
|
15
14
|
import type { SystemPrompt } from '@deepseek-ai/dsh-system-prompt';
|
|
16
15
|
import type { TokenMeter } from '@deepseek-ai/dsh-token-meter';
|
|
17
|
-
import type { ToolDefinition, ToolRunContext } from '@deepseek-ai/dsh-tools';
|
|
18
|
-
/** 插件配置类型(来自 config.ts
|
|
16
|
+
import type { JsonSchemaNode, ToolDefinition, ToolRunContext } from '@deepseek-ai/dsh-tools';
|
|
17
|
+
/** 插件配置类型(来自 config.ts)。 */
|
|
19
18
|
export type { PluginConfig } from './config.ts';
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
*/
|
|
24
|
-
export type { Agent, CompactionId, Context, EventOptions, Events, Message, Session, SessionEvent, SessionEventMap, SubagentResult, SubagentRun, SubagentStartRequest, SystemPrompt, TokenMeter, TokenUsage, ToolDefinition, ToolResultPruner, ToolRunContext, UserMessage, };
|
|
25
|
-
/**
|
|
26
|
-
* 一条消息事件(user/assistant/tool-result),带稳定 message_id;
|
|
27
|
-
* 消息级索引(indexMessages)的节点,按 message_id 定位消息序列下标。
|
|
28
|
-
*/
|
|
19
|
+
/** 官方包宿主类型再导出:插件 API 与工具签名统一从这里取型。 */
|
|
20
|
+
export type { Agent, CompactionId, ContentBlock, Context, EventOptions, Events, ImageBlock, JsonSchemaNode, Message, Session, SessionEvent, SessionEventMap, SubagentResult, SubagentRun, SubagentStartRequest, SystemPrompt, TokenMeter, TokenUsage, ToolDefinition, ToolResultPruner, ToolRunContext, UserMessage, };
|
|
21
|
+
/** 一条消息事件(user/assistant/tool-result),带稳定 message_id;消息级索引的节点。 */
|
|
29
22
|
export type MessageNode = {
|
|
30
23
|
/** 事件在日志中的 seq。 */
|
|
31
24
|
seq: number;
|
|
@@ -43,43 +36,37 @@ export type MessageIndex = {
|
|
|
43
36
|
};
|
|
44
37
|
/**
|
|
45
38
|
* 一条完整消息:摘要日志与 recall 共用的定位单位,分四类——
|
|
46
|
-
* user
|
|
47
|
-
* sys(系统消息,user_message 中其余 source.kind 的部分,如宿主注入的上下文)、
|
|
39
|
+
* user(用户消息)、sys(系统消息,user_message 中非 user 来源的部分)、
|
|
48
40
|
* assistant(模型输出文本)、toolcall(单个工具调用及其结果)。
|
|
49
|
-
* index 从 0
|
|
50
|
-
*
|
|
41
|
+
* index 从 0 起、按日志顺序递增、只追加不重排(会话内全局稳定);
|
|
42
|
+
* 本插件自产的压缩日志消息不占位。
|
|
51
43
|
*/
|
|
52
44
|
export type CompleteMessage = {
|
|
53
45
|
/** 完整消息序号(0 起,全局稳定)。 */
|
|
54
46
|
index: number;
|
|
55
|
-
/**
|
|
56
|
-
* 类别:user=用户消息;sys=系统消息(压缩日志中以 <sys type="KIND" index="N"> 空块
|
|
57
|
-
* 表示);assistant=模型输出文本;toolcall=单个工具调用及其结果。
|
|
58
|
-
*/
|
|
47
|
+
/** 类别:user=用户消息;sys=系统消息;assistant=模型输出文本;toolcall=工具调用及其结果。 */
|
|
59
48
|
type: 'user' | 'sys' | 'assistant' | 'toolcall';
|
|
60
|
-
/** 系统消息的 source.kind(仅 sys
|
|
49
|
+
/** 系统消息的 source.kind(仅 sys 类)。 */
|
|
61
50
|
kind?: string;
|
|
62
51
|
/** 关联的消息事件 seq(user/sys/assistant=1 个;toolcall=assistant 消息 + 结果)。 */
|
|
63
52
|
seqs: number[];
|
|
64
|
-
/** 工具调用 id(仅 toolcall
|
|
53
|
+
/** 工具调用 id(仅 toolcall 类)。 */
|
|
65
54
|
callId?: string;
|
|
66
55
|
};
|
|
67
56
|
/**
|
|
68
|
-
* 插件扩展的 compaction/summary 载荷:宿主类型 + shadowedCharCount
|
|
69
|
-
* 宿主 append 不做 schema
|
|
70
|
-
* 客户端读取时按可选处理。宿主类型是 union
|
|
71
|
-
* 故用交叉类型 + 读取处收窄。
|
|
57
|
+
* 插件扩展的 compaction/summary 载荷:宿主类型 + shadowedCharCount/attemptCount。
|
|
58
|
+
* 宿主 append 不做 schema 剥离,扩展字段原样持久化;旧会话载荷可能缺失,
|
|
59
|
+
* 客户端读取时按可选处理。宿主类型是 union,无法声明合并,故用交叉类型 + 读取处收窄。
|
|
72
60
|
*/
|
|
73
61
|
export type CompactionSummaryPayload = SessionEventMap['compaction/summary'] & {
|
|
74
|
-
/** 被压缩内容的字符数(压缩前文本长度合计;UI
|
|
62
|
+
/** 被压缩内容的字符数(压缩前文本长度合计;UI 标题统计用)。 */
|
|
75
63
|
shadowedCharCount?: number;
|
|
76
|
-
/**
|
|
64
|
+
/** 摘要重试次数(观察分块为各块重试之和,反思为尝试次数 - 1)。 */
|
|
77
65
|
attemptCount?: number;
|
|
78
66
|
};
|
|
79
67
|
/**
|
|
80
68
|
* 插件扩展的 compaction/start 载荷:宿主类型 + phase(压缩 pass)。
|
|
81
|
-
*
|
|
82
|
-
* 缺失(旧版本会话)回落通用压缩中文案。
|
|
69
|
+
* 客户端读取时按可选处理,缺失回落通用压缩中文案。
|
|
83
70
|
*/
|
|
84
71
|
export type CompactionStartPayload = SessionEventMap['compaction/start'] & {
|
|
85
72
|
/** 压缩 pass(观察/反思;UI 压缩中提示行区分文案)。 */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,OAAO,EACP,UAAU,EACV,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACnG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AA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BAAoB,CAAC,GAAG;IAC7E,qCAAqC;IACrC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,eAAe,CAAC,kBAAkB,CAAC,GAAG;IACzE,oCAAoC;IACpC,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;CAC9B,CAAC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* 零依赖工具函数:文本呈现、主会话判定、路由解析等通用辅助(不 import 运行时包)。
|
|
3
|
+
* 导出 isRecord / uuid / blocksToText / textCharCount / renderMessageText / safeJson /
|
|
4
|
+
* isMainSession / routedTarget。
|
|
4
5
|
*/
|
|
5
6
|
import type { Message } from '@deepseek-ai/dsh-llm';
|
|
6
7
|
import type { Session } from './types.ts';
|
|
7
|
-
/**
|
|
8
|
+
/** 判断值是否为普通对象(非 null、非数组)。 */
|
|
8
9
|
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
9
|
-
/** 生成 uuid:优先 crypto.randomUUID
|
|
10
|
+
/** 生成 uuid:优先 crypto.randomUUID,回退为时间戳+随机串拼接。 */
|
|
10
11
|
export declare function uuid(): string;
|
|
11
12
|
/** 提取 content 数组中的纯文本块(type === 'text' 的 block.text 拼接)。 */
|
|
12
13
|
export declare function blocksToText(blocks: unknown): string;
|
|
13
|
-
/** 消息内容的字符数:递归计入 text 块与 tool-result
|
|
14
|
+
/** 消息内容的字符数:递归计入 text 块与 tool-result 内嵌文本。 */
|
|
14
15
|
export declare function textCharCount(message: Message | null | undefined): number;
|
|
15
16
|
/** 面向 recall 的完整消息呈现:text 原样;tool-call 展开(参数=代码);tool-result 取文本。 */
|
|
16
17
|
export declare function renderMessageText(message: Message | null | undefined): string;
|
|
17
|
-
/** 安全 JSON 序列化:序列化失败时退回 String
|
|
18
|
+
/** 安全 JSON 序列化:序列化失败时退回 String 呈现。 */
|
|
18
19
|
export declare function safeJson(value: unknown): string;
|
|
19
|
-
/** 主会话判定:subagent 会话 header.origin === 'subagent'
|
|
20
|
+
/** 主会话判定:subagent 会话 header.origin === 'subagent'。 */
|
|
20
21
|
export declare function isMainSession(session: Session): boolean;
|
|
21
|
-
/** 会话路由目标:provider + model
|
|
22
|
+
/** 会话路由目标:provider + model。 */
|
|
22
23
|
export type RoutedTarget = {
|
|
23
24
|
provider: string;
|
|
24
25
|
model: string;
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,8BAA8B;AAC9B,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,iDAAiD;AACjD,wBAAgB,IAAI,IAAI,MAAM,CAI7B;AAED,4DAA4D;AAC5D,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAQpD;AAED,8CAA8C;AAC9C,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAWzE;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAc7E;AAED,sCAAsC;AACtC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAM/C;AAED,sDAAsD;AACtD,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEvD;AAED,+BAA+B;AAC/B,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/D,iDAAiD;AACjD,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAQvE"}
|