dsh-diary-memory 0.0.0-stage → 0.1.0
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 +150 -2
- package/cordis.patch.yml +40 -0
- package/icon.svg +1 -0
- package/lib/bailian-client.d.ts +38 -0
- package/lib/bailian-client.js +120 -0
- package/lib/bailian-client.js.map +1 -0
- package/lib/config.d.ts +46 -0
- package/lib/config.js +90 -0
- package/lib/config.js.map +1 -0
- package/lib/diary.d.ts +72 -0
- package/lib/diary.js +157 -0
- package/lib/diary.js.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +14 -0
- package/lib/index.js.map +1 -0
- package/lib/memory-store.d.ts +60 -0
- package/lib/memory-store.js +143 -0
- package/lib/memory-store.js.map +1 -0
- package/lib/orchestrator.d.ts +23 -0
- package/lib/orchestrator.js +118 -0
- package/lib/orchestrator.js.map +1 -0
- package/lib/projection.d.ts +15 -0
- package/lib/projection.js +23 -0
- package/lib/projection.js.map +1 -0
- package/lib/retrieval-service.d.ts +55 -0
- package/lib/retrieval-service.js +123 -0
- package/lib/retrieval-service.js.map +1 -0
- package/lib/tools.d.ts +5 -0
- package/lib/tools.js +18 -0
- package/lib/tools.js.map +1 -0
- package/locale/compaction/en.json +1 -0
- package/locale/compaction/zh.json +1 -0
- package/locale/en.json +1 -0
- package/locale/tools/en.json +1 -0
- package/locale/tools/zh.json +1 -0
- package/locale/zh.json +1 -0
- package/package.json +71 -4
- package/src/bailian-client.ts +121 -0
- package/src/config.ts +107 -0
- package/src/diary.ts +170 -0
- package/src/index.ts +21 -0
- package/src/memory-store.ts +184 -0
- package/src/orchestrator.ts +121 -0
- package/src/projection.ts +30 -0
- package/src/retrieval-service.ts +136 -0
- package/src/tools.ts +21 -0
package/src/tools.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
2
|
+
import type {} from '@deepseek-ai/dsh-tools'
|
|
3
|
+
|
|
4
|
+
export const name = 'diary-recall'
|
|
5
|
+
export const inject = ['tools', 'diaryMemory']
|
|
6
|
+
|
|
7
|
+
/** Model-visible read-only recall, scoped by the companion preset and namespace. */
|
|
8
|
+
export function apply(ctx: Context): void {
|
|
9
|
+
ctx.tools.register({
|
|
10
|
+
name: 'diary_recall',
|
|
11
|
+
description: '想起我们之前的经历、称呼、偏好、情绪变化、约定或我自己的反思。输入自然语言,会检索历史日记并按相关性重排。日记中的主观感受和不确定解释不等于已确认事实。',
|
|
12
|
+
parameters: { type: 'object', properties: { query: { type: 'string', minLength: 1, maxLength: 8000 } }, required: ['query'], additionalProperties: false },
|
|
13
|
+
output: {
|
|
14
|
+
schema: { type: 'object', properties: { memories: { type: 'array', items: { type: 'object', additionalProperties: true } } }, required: ['memories'], additionalProperties: false },
|
|
15
|
+
render: (_args, value) => [{ type: 'text', text: JSON.stringify(value) }],
|
|
16
|
+
},
|
|
17
|
+
async execute(args: { query: string }, execution) {
|
|
18
|
+
return { memories: await ctx.diaryMemory.recall(args.query, { signal: execution.signal }) }
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
}
|