@xandreed/plugin-memory-digest 0.13.0 → 0.14.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/README.md +1 -1
- package/dist/plugin.adapter.js +4 -4
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/plugin.adapter.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Effect, Layer, Option, Schema } from "effect";
|
|
2
|
-
import { definePlugin, HarnessError, ResultDigester, UtilityLlm } from "@xandreed/core";
|
|
2
|
+
import { definePlugin, HarnessError, ResultDigester, userMessageText, UtilityLlm } from "@xandreed/core";
|
|
3
3
|
export const MemoryDigestConfig = Schema.Struct({
|
|
4
4
|
maxSourceChars: Schema.Int.pipe(Schema.check(Schema.isBetween({ minimum: 1000, maximum: 400000 })))
|
|
5
5
|
}), memoryDigestDefaults = { maxSourceChars: 48000 }, UTILITY_DIGESTER = { id: "utility-digest", version: "1" };
|
|
6
6
|
const clip = (text, max) => text.length <= max ? text : `${text.slice(0, max)}\u2026`;
|
|
7
7
|
export const digestPrompt = (task, maxSourceChars) => task.mode === "select" ? [
|
|
8
8
|
task.instructions,
|
|
9
|
-
`Request: ${task.userMessage
|
|
9
|
+
`Request: ${userMessageText(task.userMessage)}`,
|
|
10
10
|
"Items:",
|
|
11
11
|
...task.items.map((item) => `[${item.key}] ${clip(item.text, Math.max(200, Math.floor(maxSourceChars / Math.max(1, task.items.length))))}`),
|
|
12
12
|
"Reply with the keys of the items to keep, one per line, and nothing else."
|
|
@@ -14,7 +14,7 @@ export const digestPrompt = (task, maxSourceChars) => task.mode === "select" ? [
|
|
|
14
14
|
|
|
15
15
|
`) : [
|
|
16
16
|
task.instructions,
|
|
17
|
-
`Request: ${task.userMessage
|
|
17
|
+
`Request: ${userMessageText(task.userMessage)}`,
|
|
18
18
|
`Result:
|
|
19
19
|
${clip(task.source, maxSourceChars)}`,
|
|
20
20
|
"Reply with the summary only."
|
|
@@ -26,7 +26,7 @@ ${clip(task.source, maxSourceChars)}`,
|
|
|
26
26
|
return [...new Set(named.filter((key) => known.has(key)))];
|
|
27
27
|
}, outcomeOf = (task, reply) => task.mode === "select" ? { keep: keysOf(task, reply), summary: Option.none() } : { keep: [], summary: reply.trim().length === 0 ? Option.none() : Option.some(reply.trim()) }, memoryDigestPlugin = definePlugin({
|
|
28
28
|
id: "@xandreed/plugin-memory-digest",
|
|
29
|
-
version: "0.
|
|
29
|
+
version: "0.14.0",
|
|
30
30
|
scope: "session",
|
|
31
31
|
config: MemoryDigestConfig,
|
|
32
32
|
defaults: memoryDigestDefaults,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xandreed/plugin-memory-digest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=24",
|
|
6
6
|
"bun": ">=1.3.0"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@xandreed/core": "0.
|
|
17
|
+
"@xandreed/core": "0.14.0",
|
|
18
18
|
"effect": "4.0.7"
|
|
19
19
|
},
|
|
20
20
|
"private": false,
|