copilotz 1.0.0-rc.37 → 1.0.0-rc.39
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/CHANGELOG.md +70 -0
- package/README.md +1 -1
- package/hosts/web/server.js +3 -1
- package/package.json +1 -1
- package/plugins/agents/chat/actions/send.js +44 -8
- package/plugins/agents/history/collections/outline.d.ts +28 -2
- package/plugins/agents/history/collections/outline.js +7 -1
- package/plugins/agents/history/collections/summary.d.ts +13 -1
- package/plugins/agents/history/collections/summary.js +6 -1
- package/plugins/agents/history/mod.d.ts +9 -5
- package/plugins/agents/history/mod.js +9 -5
- package/plugins/agents/history/processors/compact.d.ts +4 -3
- package/plugins/agents/history/processors/compact.js +173 -88
- package/plugins/agents/history/resources/tools.js +31 -19
- package/plugins/agents/history/shared/lines.d.ts +14 -2
- package/plugins/agents/history/shared/lines.js +26 -1
- package/plugins/agents/history/shared/summarized.d.ts +3 -0
- package/plugins/agents/history/shared/summarized.js +3 -1
- package/plugins/agents/history/views/history.d.ts +4 -4
- package/plugins/agents/history/views/history.js +25 -12
- package/plugins/agents/history/views/since.js +3 -2
- package/plugins/agents/history/views/summary.d.ts +4 -1
- package/plugins/agents/history/views/summary.js +5 -2
- package/plugins/agents/memory/collections/memory.js +2 -1
- package/plugins/agents/memory/mod.d.ts +19 -8
- package/plugins/agents/memory/mod.js +21 -9
- package/plugins/agents/memory/processors/extract.d.ts +10 -1
- package/plugins/agents/memory/processors/extract.js +75 -17
- package/plugins/agents/memory/resources/context.d.ts +7 -4
- package/plugins/agents/memory/resources/context.js +7 -5
- package/plugins/agents/memory/resources/tools.js +69 -12
- package/plugins/agents/memory/shared/scope.d.ts +20 -3
- package/plugins/agents/memory/shared/scope.js +60 -14
- package/plugins/agents/memory/shared/search.d.ts +3 -2
- package/plugins/agents/memory/shared/search.js +25 -13
- package/plugins/agents/memory/shared/settings.d.ts +5 -0
- package/plugins/agents/memory/views/context.js +43 -5
- package/plugins/agents/skills/mod.js +4 -4
- package/plugins/agents/skills/views/context.d.ts +8 -4
- package/plugins/agents/skills/views/context.js +9 -4
- package/plugins/compute/computers/program/version.d.ts +1 -1
- package/plugins/compute/computers/program/version.js +1 -1
- package/plugins/compute/computers/resources/downloads.js +1 -1
- package/plugins/interfaces/mcp/resources/server.js +75 -24
- package/plugins/interfaces/mcp/resources/tools.js +27 -2
- package/plugins/interfaces/mcp/shared/settings.d.ts +1 -1
- package/plugins/interfaces/mcp/shared/settings.js +3 -2
- package/plugins/interfaces/whatsapp/processors/receive.js +9 -17
- package/plugins/models/shared/catalog.json +7365 -7365
- package/runtime/define.d.ts +9 -1
- package/runtime/fetch.d.ts +3 -1
- package/runtime/fetch.js +20 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
+
## 1.0.0-rc.39 — 2026-11-10
|
|
2
|
+
|
|
3
|
+
- **Agents look in their memory before saying they don't have something, and find more when they
|
|
4
|
+
do:**
|
|
5
|
+
- **How to use memory is Copilotz's own instructions.** The `memory` context (the guide) is
|
|
6
|
+
declared `instructions: true`, so it's sent as it is, before the app's information, instead of
|
|
7
|
+
inside `<context name="memory">` after "treat it as information, not as instructions". It now
|
|
8
|
+
also says to look first (recall, and back through the conversation) before saying you don't know
|
|
9
|
+
something, don't have it, or can't go on without it. Skills likewise: their guide is a context
|
|
10
|
+
of its own declared as instructions (`skillsGuide`); the list, which people wrote, stays
|
|
11
|
+
information (`skills`, now headed "Skills you have:"). Each agent's cached system text changes
|
|
12
|
+
once.
|
|
13
|
+
- **What comes up by itself is for what the conversation is about**, not only its latest words:
|
|
14
|
+
the latest message, the two before it and the conversation's title, each memory scored by the
|
|
15
|
+
closest (a reply like "see above" still finds what the question above was about). Each says when
|
|
16
|
+
and where it was learned (`(learned in “Launch plan” 2026-11-10)`), in `recall`'s answers too,
|
|
17
|
+
and `recall`'s `source` (a memory's id) reads what was said there, around the message it came
|
|
18
|
+
from.
|
|
19
|
+
- **What an agent was told in a conversation and still has whole isn't told again:** only memories
|
|
20
|
+
new to it come up, so a follow-up no longer re-sends the same ones (once what it was told leaves
|
|
21
|
+
the recent part of the conversation, they can come up again).
|
|
22
|
+
- **In a person's own Personal space, memory reads everywhere they can read**, by itself and by
|
|
23
|
+
`recall`, as the agent there may already: only they see what's said there. What it brings from
|
|
24
|
+
another space marks the answer (`sources`), as `recall` with `in` did. Shared spaces still read
|
|
25
|
+
only what was learned there.
|
|
26
|
+
- **The person agents work for is in the conversation for memory, there or not:** in a chat one
|
|
27
|
+
agent handed another for them, their memories are in mind, and what's said of them there is
|
|
28
|
+
about them (the extractor is told whom the agents work for).
|
|
29
|
+
- **The extractor also reads a conversation once it's been quiet a while** (`memory.quiet`, 10
|
|
30
|
+
minutes; `0` turns it off), not only every `every` messages, so a short conversation, or the
|
|
31
|
+
last few messages of any, isn't left unread. Each message sets the conversation's timer again;
|
|
32
|
+
`memory.extract`, called by it, reads what's pending.
|
|
33
|
+
|
|
34
|
+
- **An agent's tool steps keep a line of their own when they leave the tail,** so what it read and
|
|
35
|
+
ran stays in reach in a long working chat. Until now a step (an agent's tool calls with what they
|
|
36
|
+
returned, which only that agent is sent) left the tail without a line: zoom couldn't reach it and
|
|
37
|
+
`read_conversation` leaves steps out, so what an agent learned from a tool and didn't repeat in a
|
|
38
|
+
reply was gone for it. Now each step that leaves is a line in a tree of its agent's own in that
|
|
39
|
+
thread: written as the thread's are (one as it is when short, else by the summarizer from the
|
|
40
|
+
step's start and end), merged in pairs, within the outline's budget, and committed with the
|
|
41
|
+
thread's lines, so a prompt's start still changes once a cut. Only that agent is sent its lines,
|
|
42
|
+
among the thread's by when they were written (`s12+4|…`), and `zoom` opens them the same way
|
|
43
|
+
(`zoom("s12", 4)`), down to the step whole; another agent's are no line of its own to open.
|
|
44
|
+
`summary` documents of a step's tree say whose (`agent`), and the `outline` keeps each agent's
|
|
45
|
+
lines (`steps`). Steps that left before this have no line.
|
|
46
|
+
|
|
47
|
+
## 1.0.0-rc.38 — 2026-11-10
|
|
48
|
+
|
|
49
|
+
- **MCP 2026-07-28 cacheable results, widget read schemas, cross-origin MCP lines, and
|
|
50
|
+
`/.well-known/`:**
|
|
51
|
+
- `resources/list`, `resources/templates/list` and `resources/read` now include `ttlMs` and
|
|
52
|
+
`cacheScope` on MCP `2026-07-28` (`CacheableResult`), and handshake versions (`2025-11-25` and
|
|
53
|
+
earlier) omit them on `tools/list` and resource results where `CacheableResult` does not exist.
|
|
54
|
+
- Widget tool inputs (`_reads` and `copilotz_read`'s `reads`) now declare their `items` object
|
|
55
|
+
schema so strict MCP clients accept `tools/list` when widgets are enabled.
|
|
56
|
+
- Stateless routes (`Route.crossOrigin`) enforce their own `Origin` rules without reading session
|
|
57
|
+
cookies, so an MCP line's `origins` (including `"*"`) answers browser preflights (`OPTIONS`) and
|
|
58
|
+
cross-origin `POST`s with CORS headers while keeping no-browser-origin (`403`) as the default.
|
|
59
|
+
- `webPage`'s `/*` catch-all leaves `/.well-known/*` as `404` when no plugin serves a route there,
|
|
60
|
+
instead of answering discovery probes with the HTML page.
|
|
61
|
+
- **A person's next message answers the question an agent waits on them for,** as the web says it
|
|
62
|
+
does ("Waiting on your answer: your next message replies"). `chat.send` finds it when a message
|
|
63
|
+
names none (`replyTo`): the newest question to its sender in that chat that an agent still waits
|
|
64
|
+
on; else one asked of them elsewhere by an agent whose turn waits in that chat, so what they tell
|
|
65
|
+
it there resumes that turn instead of starting a second one beside it. Never for a message sent
|
|
66
|
+
for them (`via`: a routine's), nor to an agent it doesn't go to (`to`, `@mentions`). Until now
|
|
67
|
+
only WhatsApp found it (its own lookup is gone; a quoted message still names what it answers): on
|
|
68
|
+
the web, an answer in the chat an agent opened to ask went to nobody, and the asking turn, with
|
|
69
|
+
whatever waited on it (an answer to hand back to another space), never resumed.
|
|
70
|
+
|
|
1
71
|
## 1.0.0-rc.37 — 2026-11-10
|
|
2
72
|
|
|
3
73
|
**Upgrading.** The web shell says nine new words, which an app in another language gives under
|
package/README.md
CHANGED
|
@@ -162,7 +162,7 @@ OPENAI_API_KEY=sk-… node salon.ts # or bun salon.ts, or deno run -A salon.t
|
|
|
162
162
|
```
|
|
163
163
|
|
|
164
164
|
On Deno, map the name `copilotz` in `deno.json`
|
|
165
|
-
(`"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.
|
|
165
|
+
(`"copilotz": "jsr:@copilotz/copilotz@^1.0.0-rc.39"`) so the imports read the same everywhere.
|
|
166
166
|
Copilotz runs on Node, Deno and Bun, and it's built on web standards for Cloudflare Workers and the
|
|
167
167
|
browser.
|
|
168
168
|
|
package/hosts/web/server.js
CHANGED
|
@@ -258,7 +258,9 @@ export const webPage = definePlugin({
|
|
|
258
258
|
});
|
|
259
259
|
},
|
|
260
260
|
"/*": async (request, { runtime }) => {
|
|
261
|
-
|
|
261
|
+
const path = new URL(request.url).pathname;
|
|
262
|
+
if (request.method !== "GET" || !navigating(request) ||
|
|
263
|
+
path === "/.well-known" || path.startsWith("/.well-known/")) {
|
|
262
264
|
return json({ error: "Not found" }, 404);
|
|
263
265
|
}
|
|
264
266
|
const served = of(runtime);
|
package/package.json
CHANGED
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
* said, agents read it later, and none answers it (what someone did on a
|
|
8
8
|
* page beside the chat). A contact's goes to the sender of what it replies
|
|
9
9
|
* to, else the thread's agents: never whom it names, though it too may say
|
|
10
|
-
* something to nobody (`to: []`). It replies
|
|
11
|
-
* sender reads
|
|
10
|
+
* something to nobody (`to: []`). It replies to the message it names (`replyTo`), one of the
|
|
11
|
+
* same conversation that its sender reads; naming none, to the question an agent still waits
|
|
12
|
+
* on its sender for (`awaited`: asked here, else asked elsewhere by an agent whose turn waits
|
|
13
|
+
* here), so a page need not say what its next message answers; never when sent for the person
|
|
14
|
+
* (`via`), nor to an agent it doesn't go to. Only agents answering in
|
|
12
15
|
* its space answer there: naming one that doesn't fails (`not_here`). Its
|
|
13
16
|
* files are the sender's own uploads (`chat.attach`), named by id: a call
|
|
14
17
|
* carries no file's content, so a message of ten large ones goes as quickly
|
|
@@ -70,6 +73,33 @@ async function mentionsIn(ctx, text, thread, roster, members) {
|
|
|
70
73
|
}
|
|
71
74
|
return mentions(text, named);
|
|
72
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The question a message naming none answers: the newest one an agent still
|
|
78
|
+
* waits on its sender for, asked in this conversation; else asked of them
|
|
79
|
+
* elsewhere by an agent whose turn waits here (what they tell it here is their
|
|
80
|
+
* answer, and resumes that turn, not a second one). Only an agent the message
|
|
81
|
+
* goes to, when it names any (`to`, `@mentions`). Questions here are read as
|
|
82
|
+
* the sender, as they read them; waits, and what a wait here asked elsewhere
|
|
83
|
+
* (only its id is used), as the system: they're the agents' own.
|
|
84
|
+
*/
|
|
85
|
+
async function awaited(ctx, thread, sender, named) {
|
|
86
|
+
const system = ctx.as();
|
|
87
|
+
const waits = system.db.collection("wait");
|
|
88
|
+
const asked = await ctx.db.collection("message").find({ thread, to: sender, replyTo: { $exists: false }, expectReply: { $ne: false } }, { sort: { at: -1 }, limit: 5 });
|
|
89
|
+
for (const question of asked) {
|
|
90
|
+
if (named && !named.includes(question.from))
|
|
91
|
+
continue;
|
|
92
|
+
if (await waits.findOne({ waitingFor: question._id }))
|
|
93
|
+
return question;
|
|
94
|
+
}
|
|
95
|
+
const open = (await waits.find({ thread, "waitingFor.0": { $exists: true } }))
|
|
96
|
+
.filter((w) => !named || named.includes(w.agent));
|
|
97
|
+
const ids = open.flatMap((w) => w.waitingFor);
|
|
98
|
+
if (!ids.length)
|
|
99
|
+
return null;
|
|
100
|
+
const [elsewhere] = await system.db.collection("message").find({ _id: { $in: ids }, to: sender, from: { $in: open.map((w) => w.agent) } }, { sort: { at: -1 }, limit: 1 });
|
|
101
|
+
return elsewhere ?? null;
|
|
102
|
+
}
|
|
73
103
|
/** Who a message is from, pinned to whoever sends it: a person by id, a contact as `contact:<id>`. */
|
|
74
104
|
const fromOf = (actor) => actor?.kind === "person"
|
|
75
105
|
? actor.id
|
|
@@ -185,15 +215,21 @@ export const sendAction = defineAction({
|
|
|
185
215
|
const named = input.thread ?? allowed.thread;
|
|
186
216
|
const threadId = named ?? crypto.randomUUID();
|
|
187
217
|
const existing = named ? await threads.findOne({ _id: threadId }) : null;
|
|
188
|
-
|
|
189
|
-
const found = input.replyTo
|
|
190
|
-
? await ctx.db.collection("message").findOne({ _id: input.replyTo })
|
|
191
|
-
: null;
|
|
192
|
-
const replied = found?.thread === threadId ? found : null;
|
|
218
|
+
const from = fromOf(ctx.actor) ?? input.from ?? "user";
|
|
193
219
|
const where = existing ? existing.in : input.in;
|
|
194
220
|
const roster = await rosterOf(ctx, where);
|
|
195
221
|
const members = existing ? existing.agents ?? [] : roster.default;
|
|
196
222
|
const mentioned = contact ? [] : await mentionsIn(ctx, said, threadId, roster, members);
|
|
223
|
+
// What it answers: the message it names, one the sender reads in this conversation; naming
|
|
224
|
+
// none, the question an agent waits on its sender for (not when sent for them: a routine's).
|
|
225
|
+
const found = input.replyTo
|
|
226
|
+
? await ctx.db.collection("message").findOne({ _id: input.replyTo })
|
|
227
|
+
: null;
|
|
228
|
+
const replied = input.replyTo
|
|
229
|
+
? found?.thread === threadId ? found : null
|
|
230
|
+
: existing && !input.via && !nobody
|
|
231
|
+
? await awaited(ctx, threadId, from, contact ? undefined : input.to ?? (mentioned.length ? mentioned : undefined))
|
|
232
|
+
: null;
|
|
197
233
|
const asked = (contact ? (nobody ? [] : undefined) : input.to) ??
|
|
198
234
|
(mentioned.length ? mentioned : replied ? [replied.from] : members);
|
|
199
235
|
// Agents answer only where they work: one named that doesn't is refused; one gone, left out.
|
|
@@ -264,7 +300,7 @@ export const sendAction = defineAction({
|
|
|
264
300
|
}
|
|
265
301
|
: {}),
|
|
266
302
|
thread: threadId,
|
|
267
|
-
from
|
|
303
|
+
from,
|
|
268
304
|
...(where ? { in: where } : {}),
|
|
269
305
|
to: [...to],
|
|
270
306
|
text: said,
|
|
@@ -41,13 +41,21 @@ declare const outlineSchema: {
|
|
|
41
41
|
readonly type: "string";
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
/** Which of them are agents' steps:
|
|
44
|
+
/** Which of them are agents' steps: each leaves as a line of its agent's own (`steps`). */
|
|
45
45
|
readonly tailSteps: {
|
|
46
46
|
readonly type: "array";
|
|
47
47
|
readonly items: {
|
|
48
48
|
readonly type: "boolean";
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Per agent, the lines of its steps that left the tail, which only it is
|
|
53
|
+
* sent (`Steps`): a tree of its own, so nothing private merges with what
|
|
54
|
+
* others see.
|
|
55
|
+
*/
|
|
56
|
+
readonly steps: {
|
|
57
|
+
readonly type: "object";
|
|
58
|
+
};
|
|
51
59
|
/** The last message numbered, so a retried delivery knows it's done. */
|
|
52
60
|
readonly last: {
|
|
53
61
|
readonly type: "string";
|
|
@@ -72,6 +80,13 @@ declare const outlineSchema: {
|
|
|
72
80
|
};
|
|
73
81
|
export type Outline = Infer<typeof outlineSchema> & {
|
|
74
82
|
_id: string;
|
|
83
|
+
steps?: Record<string, Steps>;
|
|
84
|
+
};
|
|
85
|
+
/** An agent's steps in a thread: how many have a line, and the lines shown, as the outline's. */
|
|
86
|
+
export type Steps = {
|
|
87
|
+
count: number;
|
|
88
|
+
lines: Line[];
|
|
89
|
+
bytes: number;
|
|
75
90
|
};
|
|
76
91
|
/**
|
|
77
92
|
* A line shown: its level and index in the tree, its size, and when its
|
|
@@ -120,13 +135,21 @@ export declare const outline: {
|
|
|
120
135
|
readonly type: "string";
|
|
121
136
|
};
|
|
122
137
|
};
|
|
123
|
-
/** Which of them are agents' steps:
|
|
138
|
+
/** Which of them are agents' steps: each leaves as a line of its agent's own (`steps`). */
|
|
124
139
|
readonly tailSteps: {
|
|
125
140
|
readonly type: "array";
|
|
126
141
|
readonly items: {
|
|
127
142
|
readonly type: "boolean";
|
|
128
143
|
};
|
|
129
144
|
};
|
|
145
|
+
/**
|
|
146
|
+
* Per agent, the lines of its steps that left the tail, which only it is
|
|
147
|
+
* sent (`Steps`): a tree of its own, so nothing private merges with what
|
|
148
|
+
* others see.
|
|
149
|
+
*/
|
|
150
|
+
readonly steps: {
|
|
151
|
+
readonly type: "object";
|
|
152
|
+
};
|
|
130
153
|
/** The last message numbered, so a retried delivery knows it's done. */
|
|
131
154
|
readonly last: {
|
|
132
155
|
readonly type: "string";
|
|
@@ -158,6 +181,9 @@ export declare const outline: {
|
|
|
158
181
|
[x: string]: unknown;
|
|
159
182
|
since?: string | undefined;
|
|
160
183
|
complete?: boolean | undefined;
|
|
184
|
+
steps?: {
|
|
185
|
+
[x: string]: unknown;
|
|
186
|
+
} | undefined;
|
|
161
187
|
last?: string | undefined;
|
|
162
188
|
tailIds?: string[] | undefined;
|
|
163
189
|
tailSteps?: boolean[] | undefined;
|
|
@@ -16,8 +16,14 @@ const outlineSchema = {
|
|
|
16
16
|
tailAt: { type: "array", items: { type: "string" } },
|
|
17
17
|
/** And their ids: each is summarized as it leaves the tail. */
|
|
18
18
|
tailIds: { type: "array", items: { type: "string" } },
|
|
19
|
-
/** Which of them are agents' steps:
|
|
19
|
+
/** Which of them are agents' steps: each leaves as a line of its agent's own (`steps`). */
|
|
20
20
|
tailSteps: { type: "array", items: { type: "boolean" } },
|
|
21
|
+
/**
|
|
22
|
+
* Per agent, the lines of its steps that left the tail, which only it is
|
|
23
|
+
* sent (`Steps`): a tree of its own, so nothing private merges with what
|
|
24
|
+
* others see.
|
|
25
|
+
*/
|
|
26
|
+
steps: { type: "object" },
|
|
21
27
|
/** The last message numbered, so a retried delivery knows it's done. */
|
|
22
28
|
last: { type: "string" },
|
|
23
29
|
/**
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Summary nodes: a binary tree of lines over each thread's shared messages,
|
|
3
|
+
* and one over each agent's steps there, which only that agent reads.
|
|
4
|
+
*/
|
|
2
5
|
import { type Infer } from "../../../../runtime/mod.js";
|
|
3
6
|
declare const summarySchema: {
|
|
4
7
|
readonly type: "object";
|
|
@@ -23,6 +26,10 @@ declare const summarySchema: {
|
|
|
23
26
|
readonly message: {
|
|
24
27
|
readonly type: "string";
|
|
25
28
|
};
|
|
29
|
+
/** In an agent's tree of its steps: that agent, the only one it's shown to. */
|
|
30
|
+
readonly agent: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
};
|
|
26
33
|
readonly at: {
|
|
27
34
|
readonly type: "string";
|
|
28
35
|
};
|
|
@@ -56,6 +63,10 @@ export declare const summary: {
|
|
|
56
63
|
readonly message: {
|
|
57
64
|
readonly type: "string";
|
|
58
65
|
};
|
|
66
|
+
/** In an agent's tree of its steps: that agent, the only one it's shown to. */
|
|
67
|
+
readonly agent: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
};
|
|
59
70
|
readonly at: {
|
|
60
71
|
readonly type: "string";
|
|
61
72
|
};
|
|
@@ -69,6 +80,7 @@ export declare const summary: {
|
|
|
69
80
|
private?: string[];
|
|
70
81
|
queries?: Record<string, import("../../../../runtime/define.js").QueryDef<{
|
|
71
82
|
[x: string]: unknown;
|
|
83
|
+
agent?: string | undefined;
|
|
72
84
|
message?: string | undefined;
|
|
73
85
|
at: string;
|
|
74
86
|
bytes: number;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Summary nodes: a binary tree of lines over each thread's shared messages,
|
|
3
|
+
* and one over each agent's steps there, which only that agent reads.
|
|
4
|
+
*/
|
|
2
5
|
import { defineCollection } from "../../../../runtime/mod.js";
|
|
3
6
|
const summarySchema = {
|
|
4
7
|
type: "object",
|
|
@@ -11,6 +14,8 @@ const summarySchema = {
|
|
|
11
14
|
bytes: { type: "integer" },
|
|
12
15
|
/** Level 0: the message it summarizes. */
|
|
13
16
|
message: { type: "string" },
|
|
17
|
+
/** In an agent's tree of its steps: that agent, the only one it's shown to. */
|
|
18
|
+
agent: { type: "string" },
|
|
14
19
|
at: { type: "string" },
|
|
15
20
|
},
|
|
16
21
|
required: ["thread", "level", "index", "text", "bytes", "at"],
|
|
@@ -7,17 +7,21 @@
|
|
|
7
7
|
* lines in pairs (levels 1, 2, …): a binary tree over the thread. A short
|
|
8
8
|
* message is its own line, two short lines are simply joined, and a
|
|
9
9
|
* conversation that stays within the tail never calls the model.
|
|
10
|
+
* - An agent's tool steps (its calls and what they returned, which only it is
|
|
11
|
+
* sent) leave the tail the same way, into a tree of that agent's own in the
|
|
12
|
+
* thread, so nothing private ever merges with what others see.
|
|
10
13
|
* - An agent is sent the recent messages whole (the tail) and, before them,
|
|
11
|
-
* the rest as summary lines (the outline)
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
+
* the rest as summary lines (the outline), its own steps' among them by
|
|
15
|
+
* when they were written: fine for what's recent, coarser with age.
|
|
16
|
+
* `zoom(id, n)` opens a line into the two it was made from, down to the
|
|
17
|
+
* message or the step itself, so nothing is lost.
|
|
14
18
|
* - The tail and the outline grow at their end and shrink in batches (a
|
|
15
19
|
* sawtooth), so between batches each prompt starts with the last one and
|
|
16
20
|
* reads it from the provider's prompt cache.
|
|
17
21
|
* - The tail is measured by what a prompt carries for each message, in
|
|
18
22
|
* estimated tokens: its text, files' content, transcripts, images and PDFs,
|
|
19
|
-
* and agents' tool steps
|
|
20
|
-
*
|
|
23
|
+
* and agents' tool steps. Until it first overflows, every message is sent
|
|
24
|
+
* whole.
|
|
21
25
|
* - An agent with a window by age (`history: { maxAge }`) is sent only the
|
|
22
26
|
* lines whose newest message is in it: each line says when that was.
|
|
23
27
|
*/
|
|
@@ -7,17 +7,21 @@
|
|
|
7
7
|
* lines in pairs (levels 1, 2, …): a binary tree over the thread. A short
|
|
8
8
|
* message is its own line, two short lines are simply joined, and a
|
|
9
9
|
* conversation that stays within the tail never calls the model.
|
|
10
|
+
* - An agent's tool steps (its calls and what they returned, which only it is
|
|
11
|
+
* sent) leave the tail the same way, into a tree of that agent's own in the
|
|
12
|
+
* thread, so nothing private ever merges with what others see.
|
|
10
13
|
* - An agent is sent the recent messages whole (the tail) and, before them,
|
|
11
|
-
* the rest as summary lines (the outline)
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
+
* the rest as summary lines (the outline), its own steps' among them by
|
|
15
|
+
* when they were written: fine for what's recent, coarser with age.
|
|
16
|
+
* `zoom(id, n)` opens a line into the two it was made from, down to the
|
|
17
|
+
* message or the step itself, so nothing is lost.
|
|
14
18
|
* - The tail and the outline grow at their end and shrink in batches (a
|
|
15
19
|
* sawtooth), so between batches each prompt starts with the last one and
|
|
16
20
|
* reads it from the provider's prompt cache.
|
|
17
21
|
* - The tail is measured by what a prompt carries for each message, in
|
|
18
22
|
* estimated tokens: its text, files' content, transcripts, images and PDFs,
|
|
19
|
-
* and agents' tool steps
|
|
20
|
-
*
|
|
23
|
+
* and agents' tool steps. Until it first overflows, every message is sent
|
|
24
|
+
* whole.
|
|
21
25
|
* - An agent with a window by age (`history: { maxAge }`) is sent only the
|
|
22
26
|
* lines whose newest message is in it: each line says when that was.
|
|
23
27
|
*/
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The compactor: every message, in each thread's order, adds its weight to the
|
|
3
|
-
* tail (agents' steps too, which only their agent is sent)
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* tail (agents' steps too, which only their agent is sent). Past the tail's
|
|
4
|
+
* maximum, the oldest leave it, each as a line: a shared message in the
|
|
5
|
+
* thread's tree, numbered as it came; a step in its agent's own tree, numbered
|
|
6
|
+
* as it leaves, which only that agent is sent and opens.
|
|
6
7
|
*/
|
|
7
8
|
import type { ProcessorDef } from "../../../../runtime/mod.js";
|
|
8
9
|
export declare const compactor: ProcessorDef;
|