@loomwork/conversation 0.1.3 → 0.1.5
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 +22 -0
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -42,6 +42,28 @@ const transcript = input.messages.map((m) => `${m.role}: ${summarizerText(m.cont
|
|
|
42
42
|
|
|
43
43
|
The text is **untrusted data**: summarize or quote it, never put it in a system prompt or assistant message (if the summarizer calls an LLM with this text, re-wrap it with `tainted(text, origin)` and put it in a user message, never the system prompt: `guardRequest` can no longer refuse it after unwrapping). The returned summary is clipped to `maxSummaryTokens` and re-injected as a fenced `user` message with origin `conversation:summary`, never the system prompt.
|
|
44
44
|
|
|
45
|
+
## Remembering facts across conversations (`agent.writeBack.distill`)
|
|
46
|
+
|
|
47
|
+
`conversation$` passes `agent.writeBack` to every turn's `agentLoop$`, so the opt-in distilled write-back
|
|
48
|
+
([ADR 0149](../../docs/adr/0149-distilled-memory-writeback.md)) works per turn with no extra setup: each finished
|
|
49
|
+
turn stores short facts, consolidated against the facts already in the scope, instead of the raw exchange. Give
|
|
50
|
+
it a tier without `summarizeAfter` (a summarizing tier is refused). In shared mode the scope must come from
|
|
51
|
+
`shared.memoryScope(asker)`, so each participant's facts stay in their own scope. Every fact a conversation
|
|
52
|
+
distills is stored tainted (the prompt is the end user's words) and is recalled fenced. Outside shared mode, set
|
|
53
|
+
`agent.memoryScope` to where facts should accumulate (the user, say): without it the scope defaults to the turn's
|
|
54
|
+
own execution id, so no later turn ever recalls what it wrote (the loop warns: `LOOM_AGENT_DISTILL_SCOPE`).
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
agent: {
|
|
58
|
+
definition, modelToolId: "model",
|
|
59
|
+
memory, memoryTier: "facts", memoryScope: `user:${userId}`,
|
|
60
|
+
writeBack: { toolId: "memwrite", distill: { toolId: "distill" } }, // createDistillerEffect(provider) under "distill"
|
|
61
|
+
},
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Every turn recalls the scope's facts at its start, in this conversation and later ones. That is separate from
|
|
65
|
+
`budget` (above), which decides which of this conversation's own turns the model sees.
|
|
66
|
+
|
|
45
67
|
## Work after a turn (`turnSettledObserver`)
|
|
46
68
|
|
|
47
69
|
To start work once a reply exists (a title, an index entry, something composed from the answer), observe the runtime's durable writes. The listener is called once per settled turn of ANY conversation of the flow, after the closing record is in the log:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomwork/conversation",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "A durable conversation over one chained execution: turns arrive on the inbox, a new turn barges in on a running one, long dialogues rotate (continue-as-new), history is read from the log, and the prompt is fitted to a token budget",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,20 +13,20 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"zod": "^3.23.8",
|
|
16
|
-
"@loomwork/agent": "^0.1.
|
|
17
|
-
"@loomwork/
|
|
18
|
-
"@loomwork/
|
|
19
|
-
"@loomwork/
|
|
20
|
-
"@loomwork/
|
|
21
|
-
"@loomwork/
|
|
22
|
-
"@loomwork/
|
|
16
|
+
"@loomwork/agent": "^0.1.5",
|
|
17
|
+
"@loomwork/effect-runtime": "^0.1.5",
|
|
18
|
+
"@loomwork/llm": "^0.1.5",
|
|
19
|
+
"@loomwork/workflow-runtime": "^0.1.5",
|
|
20
|
+
"@loomwork/core": "^0.1.5",
|
|
21
|
+
"@loomwork/classify": "^0.1.5",
|
|
22
|
+
"@loomwork/event-runtime": "^0.1.5"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^22.0.0",
|
|
26
26
|
"typescript": "^5.6.3",
|
|
27
27
|
"vitest": "^2.1.8",
|
|
28
|
-
"@loomwork/
|
|
29
|
-
"@loomwork/
|
|
28
|
+
"@loomwork/snapshot-runtime": "0.1.5",
|
|
29
|
+
"@loomwork/memory": "0.1.5"
|
|
30
30
|
},
|
|
31
31
|
"license": "Apache-2.0",
|
|
32
32
|
"repository": {
|