@deepagents/context 7.8.0 → 7.8.2
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/browser.js +28 -15
- package/dist/browser.js.map +2 -2
- package/dist/index.js +111 -187
- package/dist/index.js.map +3 -3
- package/dist/lib/agent.d.ts +6 -1
- package/dist/lib/agent.d.ts.map +1 -1
- package/dist/lib/chat.d.ts +7 -1
- package/dist/lib/chat.d.ts.map +1 -1
- package/dist/lib/engine.d.ts +27 -16
- package/dist/lib/engine.d.ts.map +1 -1
- package/dist/lib/fragments/reminders/src/predicates/tool.d.ts.map +1 -1
- package/dist/lib/fragments/reminders/src/predicates/turn.d.ts.map +1 -1
- package/dist/lib/fragments.d.ts.map +1 -1
- package/dist/lib/store/postgres.store.d.ts +5 -18
- package/dist/lib/store/postgres.store.d.ts.map +1 -1
- package/dist/lib/store/sqlite.store.d.ts.map +1 -1
- package/dist/lib/stream/postgres-notify-change-source.d.ts +3 -2
- package/dist/lib/stream/postgres-notify-change-source.d.ts.map +1 -1
- package/dist/lib/stream/postgres.stream-store.d.ts +3 -3
- package/dist/lib/stream/postgres.stream-store.d.ts.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -429,7 +429,7 @@ During streamed `chat()` turns, persisting that synthetic user message preserves
|
|
|
429
429
|
the exact `tool result → synthetic user message → next assistant` prefix across
|
|
430
430
|
later requests for prompt caching. Multiple tool-output and steer reminders
|
|
431
431
|
firing at one boundary share one synthetic message. `once(id)` is durable for
|
|
432
|
-
all three reminder targets. Bare `
|
|
432
|
+
all three reminder targets. Bare `createReminderSession()` integrations and
|
|
433
433
|
`agent.generate()` inject the reminder but own persistence of their generated
|
|
434
434
|
assistant history.
|
|
435
435
|
|
package/dist/browser.js
CHANGED
|
@@ -55,24 +55,37 @@ function fragment(name, ...children) {
|
|
|
55
55
|
data: children
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
function withReasoningItemsGrouped(message2) {
|
|
59
|
+
const partsByItemId = /* @__PURE__ */ new Map();
|
|
60
|
+
for (const part of message2.parts) {
|
|
61
|
+
const itemId = reasoningItemIdOf(part);
|
|
62
|
+
if (itemId === void 0) continue;
|
|
63
|
+
const itemParts = partsByItemId.get(itemId);
|
|
64
|
+
if (itemParts) {
|
|
65
|
+
itemParts.push(part);
|
|
66
|
+
} else {
|
|
67
|
+
partsByItemId.set(itemId, [part]);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (partsByItemId.values().every((itemParts) => itemParts.length === 1)) {
|
|
71
|
+
return message2;
|
|
72
|
+
}
|
|
73
|
+
const parts = message2.parts.flatMap((part) => {
|
|
74
|
+
const itemId = reasoningItemIdOf(part);
|
|
75
|
+
if (itemId === void 0) return [part];
|
|
76
|
+
const itemParts = partsByItemId.get(itemId) ?? [];
|
|
77
|
+
partsByItemId.delete(itemId);
|
|
78
|
+
return itemParts;
|
|
71
79
|
});
|
|
72
|
-
return
|
|
80
|
+
return { ...message2, parts };
|
|
81
|
+
}
|
|
82
|
+
function reasoningItemIdOf(part) {
|
|
83
|
+
if (part.type !== "reasoning") return void 0;
|
|
84
|
+
const itemId = part.providerMetadata?.openai?.itemId;
|
|
85
|
+
return typeof itemId === "string" ? itemId : void 0;
|
|
73
86
|
}
|
|
74
87
|
function assistant(message2) {
|
|
75
|
-
const normalized =
|
|
88
|
+
const normalized = withReasoningItemsGrouped(message2);
|
|
76
89
|
return {
|
|
77
90
|
id: normalized.id,
|
|
78
91
|
name: "assistant",
|