@byok-sdk/bot-collaboration 0.0.0-stage → 0.43.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 +2075 -2
- package/dist/adapter-steps.d.ts +49 -0
- package/dist/channel.d.ts +111 -0
- package/dist/chunk-33YA66U7.js +7 -0
- package/dist/chunk-33YA66U7.js.map +1 -0
- package/dist/chunk-6Y2B2XCP.js +12 -0
- package/dist/chunk-6Y2B2XCP.js.map +1 -0
- package/dist/chunk-QZRWFFHM.js +12 -0
- package/dist/chunk-QZRWFFHM.js.map +1 -0
- package/dist/chunk-ZX6C5U2S.js +27 -0
- package/dist/chunk-ZX6C5U2S.js.map +1 -0
- package/dist/coalesce.d.ts +18 -0
- package/dist/commit-vectors.test-support.d.ts +173 -0
- package/dist/commit.d.ts +53 -0
- package/dist/compaction.d.ts +13 -0
- package/dist/delegation.d.ts +12 -0
- package/dist/delivery-routing.d.ts +63 -0
- package/dist/delivery-vectors.test-support.d.ts +78 -0
- package/dist/delivery.d.ts +20 -0
- package/dist/dream.d.ts +88 -0
- package/dist/home-projections.d.ts +5 -0
- package/dist/host-kit.d.ts +60 -0
- package/dist/host-kit.js +11 -0
- package/dist/host-kit.js.map +1 -0
- package/dist/host.d.ts +472 -0
- package/dist/inbound.d.ts +17 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/k4-fixtures.test-support.d.ts +10 -0
- package/dist/l-test-host.test-support.d.ts +72 -0
- package/dist/migration.d.ts +251 -0
- package/dist/model.d.ts +89 -0
- package/dist/persona.d.ts +2 -0
- package/dist/retention-vectors.test-support.d.ts +17 -0
- package/dist/retention.d.ts +61 -0
- package/dist/rooms.d.ts +22 -0
- package/dist/routine-vectors.test-support.d.ts +81 -0
- package/dist/routines.d.ts +110 -0
- package/dist/rules/autonomy.d.ts +67 -0
- package/dist/rules/cards.d.ts +31 -0
- package/dist/rules/coalesce.d.ts +111 -0
- package/dist/rules/commands.d.ts +306 -0
- package/dist/rules/commit.d.ts +82 -0
- package/dist/rules/compaction.d.ts +33 -0
- package/dist/rules/context.d.ts +484 -0
- package/dist/rules/delegation.d.ts +366 -0
- package/dist/rules/due.d.ts +15 -0
- package/dist/rules/frame.d.ts +4 -0
- package/dist/rules/history.d.ts +34 -0
- package/dist/rules/inbound.d.ts +53 -0
- package/dist/rules/index.d.ts +13 -0
- package/dist/rules/index.js +4 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/message.d.ts +31 -0
- package/dist/rules/outcome.d.ts +45 -0
- package/dist/rules/priority.d.ts +52 -0
- package/dist/rules/rooms.d.ts +187 -0
- package/dist/rules/schema.d.ts +110 -0
- package/dist/rules/sync.d.ts +157 -0
- package/dist/rules/team.d.ts +119 -0
- package/dist/rules/turn.d.ts +129 -0
- package/dist/schema.d.ts +154 -0
- package/dist/store-compatibility.d.ts +3 -0
- package/dist/switch.d.ts +53 -0
- package/dist/team-model.d.ts +54 -0
- package/dist/team.d.ts +56 -0
- package/dist/testing.d.ts +6 -0
- package/dist/testing.js +20 -0
- package/dist/testing.js.map +1 -0
- package/dist/toolset-policy.d.ts +2 -0
- package/dist/topology.d.ts +49 -0
- package/package.json +80 -4
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
import { type HandoffPackBudgets, type HandoffTurn } from '@byok-sdk/protocol';
|
|
2
|
+
import type { Card, Question, Rejection, Turn } from './turn.js';
|
|
3
|
+
import { type RoomMessage } from './rooms.js';
|
|
4
|
+
import { type ContextRoutine, type ContextState } from './schema.js';
|
|
5
|
+
/**
|
|
6
|
+
* The frozen ContextPack and instruction as pure rules (#739 D1). The caller gives the history; no function
|
|
7
|
+
* here reads stored Turn rows. A Host can read the history from the device ledger or from an external authority.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* One Bot's history, oldest first. `turns` holds the current Turn; the Turn id selects it.
|
|
11
|
+
* For a frozen Bot Turn, give only this Bot's rows: its Turns, the cards and questions of its Turns,
|
|
12
|
+
* and its rejected actions that no Turn consumed. `room` holds a seat Turn's room messages from an external authority.
|
|
13
|
+
*/
|
|
14
|
+
export interface ContextHistory {
|
|
15
|
+
readonly turns: readonly (Turn | ContextTurn)[];
|
|
16
|
+
readonly cards: readonly Card[];
|
|
17
|
+
readonly questions: readonly Question[];
|
|
18
|
+
readonly rejected: readonly Rejection[];
|
|
19
|
+
readonly room?: readonly RoomMessage[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One history row of a ContextPack. An external history authority gives its rows in this shape (#739 Q4a).
|
|
23
|
+
* `reply` is the reply text that the user saw for this Turn (#1318). Only an external authority gives it; K8 stores no reply text.
|
|
24
|
+
*/
|
|
25
|
+
export interface ContextTurn {
|
|
26
|
+
id: string;
|
|
27
|
+
root: string;
|
|
28
|
+
source: Turn['source'];
|
|
29
|
+
request: string;
|
|
30
|
+
hop: number;
|
|
31
|
+
status: Turn['status'];
|
|
32
|
+
conclusion?: string;
|
|
33
|
+
outcomeSummary: string[];
|
|
34
|
+
reply?: string;
|
|
35
|
+
}
|
|
36
|
+
/** Checks rows from an external authority. A row in another shape refuses the whole history. */
|
|
37
|
+
export declare function contextTurns(value: unknown): ContextTurn[];
|
|
38
|
+
/**
|
|
39
|
+
* One history row from a `bot-turn:<id>` projection value and the reply text that the user saw, for an external authority.
|
|
40
|
+
* The row passes `contextTurns`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function historyRowFromTurn(projection: Turn & {
|
|
43
|
+
readonly owner: string;
|
|
44
|
+
readonly reply?: string;
|
|
45
|
+
}): ContextTurn;
|
|
46
|
+
/** One history row as a turn of the handoff pack. Its text goes in `lines`, and the rest stays whole in `meta`. */
|
|
47
|
+
export declare function handoffTurn(turn: Turn | ContextTurn): HandoffTurn;
|
|
48
|
+
/** The bytes of a pack of `turns` turns with nothing in it. */
|
|
49
|
+
export declare function handoffFrameBytes(turns: number): number;
|
|
50
|
+
/** `crossRequest` is the framed Request section of a Cross-Bot Turn; its background is trimmed too (§3.7). */
|
|
51
|
+
export declare function turnContext<R extends ContextRoutine>(state: ContextState, history: ContextHistory, turn: Turn, turnLimit?: number, maxBytes?: number, crossRequest?: string, routines?: readonly R[], handoff?: HandoffPackBudgets): {
|
|
52
|
+
historyWindow: import("./history.js").HistoryWindow;
|
|
53
|
+
room: {
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
members: string[];
|
|
57
|
+
announcement: string;
|
|
58
|
+
visibility: 'after_join';
|
|
59
|
+
messages: RoomMessage[];
|
|
60
|
+
};
|
|
61
|
+
round: {
|
|
62
|
+
id: string;
|
|
63
|
+
limit: number;
|
|
64
|
+
counts: Record<string, number>;
|
|
65
|
+
};
|
|
66
|
+
seat: {
|
|
67
|
+
id: string;
|
|
68
|
+
deadline: number | undefined;
|
|
69
|
+
};
|
|
70
|
+
teamNotes: {
|
|
71
|
+
id: string;
|
|
72
|
+
text: string;
|
|
73
|
+
}[];
|
|
74
|
+
roster: {
|
|
75
|
+
id: string;
|
|
76
|
+
name: string;
|
|
77
|
+
role: string;
|
|
78
|
+
mainBot: boolean;
|
|
79
|
+
}[];
|
|
80
|
+
rejectedActions: Rejection[];
|
|
81
|
+
rooms: {
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
members: string[];
|
|
85
|
+
admin?: string;
|
|
86
|
+
mode: 'mention';
|
|
87
|
+
announcement: string;
|
|
88
|
+
memberMentions?: import("./rooms.js").MemberMentions;
|
|
89
|
+
archived?: true;
|
|
90
|
+
}[];
|
|
91
|
+
delegation?: {
|
|
92
|
+
delegationId: string;
|
|
93
|
+
from: {
|
|
94
|
+
botId: string;
|
|
95
|
+
name: string;
|
|
96
|
+
};
|
|
97
|
+
hop: number;
|
|
98
|
+
} | undefined;
|
|
99
|
+
openDelegations?: {
|
|
100
|
+
items: {
|
|
101
|
+
id: string;
|
|
102
|
+
from: string;
|
|
103
|
+
to: string;
|
|
104
|
+
status: "queued" | "reply_held" | "reply_pending" | "resolved" | "running" | "uncertain" | "waiting_device";
|
|
105
|
+
request: string;
|
|
106
|
+
}[];
|
|
107
|
+
omitted: number;
|
|
108
|
+
notice: string | null;
|
|
109
|
+
} | undefined;
|
|
110
|
+
} | ({
|
|
111
|
+
teamNotes: {
|
|
112
|
+
id: string;
|
|
113
|
+
text: string;
|
|
114
|
+
}[];
|
|
115
|
+
roster: {
|
|
116
|
+
id: string;
|
|
117
|
+
name: string;
|
|
118
|
+
role: string;
|
|
119
|
+
mainBot: boolean;
|
|
120
|
+
}[];
|
|
121
|
+
rejectedActions: Rejection[];
|
|
122
|
+
rooms: {
|
|
123
|
+
id: string;
|
|
124
|
+
name: string;
|
|
125
|
+
members: string[];
|
|
126
|
+
admin?: string;
|
|
127
|
+
mode: 'mention';
|
|
128
|
+
announcement: string;
|
|
129
|
+
memberMentions?: import("./rooms.js").MemberMentions;
|
|
130
|
+
archived?: true;
|
|
131
|
+
}[];
|
|
132
|
+
delegation?: {
|
|
133
|
+
delegationId: string;
|
|
134
|
+
from: {
|
|
135
|
+
botId: string;
|
|
136
|
+
name: string;
|
|
137
|
+
};
|
|
138
|
+
hop: number;
|
|
139
|
+
} | undefined;
|
|
140
|
+
openDelegations?: {
|
|
141
|
+
items: {
|
|
142
|
+
id: string;
|
|
143
|
+
from: string;
|
|
144
|
+
to: string;
|
|
145
|
+
status: "queued" | "reply_held" | "reply_pending" | "resolved" | "running" | "uncertain" | "waiting_device";
|
|
146
|
+
request: string;
|
|
147
|
+
}[];
|
|
148
|
+
omitted: number;
|
|
149
|
+
notice: string | null;
|
|
150
|
+
} | undefined;
|
|
151
|
+
} & {
|
|
152
|
+
historyWindow: {
|
|
153
|
+
turnLimit: number;
|
|
154
|
+
maxBytes: number;
|
|
155
|
+
omittedMessages: number;
|
|
156
|
+
omittedTurns?: number;
|
|
157
|
+
currentRequestBytes: number;
|
|
158
|
+
metadataOverBudget: boolean;
|
|
159
|
+
notice: string | null;
|
|
160
|
+
omittedBackground?: number;
|
|
161
|
+
omittedCards: number;
|
|
162
|
+
omittedQuestions: number;
|
|
163
|
+
omittedPendingCards: number;
|
|
164
|
+
omittedPendingQuestions: number;
|
|
165
|
+
omittedRejections: number;
|
|
166
|
+
};
|
|
167
|
+
rejectedActions: Rejection[];
|
|
168
|
+
questions: Question[];
|
|
169
|
+
cards: Card[];
|
|
170
|
+
routines: R[];
|
|
171
|
+
history: import("@byok-sdk/protocol").HandoffPack;
|
|
172
|
+
});
|
|
173
|
+
export interface InstructionLimits {
|
|
174
|
+
turnLimit: number;
|
|
175
|
+
/** The Request and the ContextPack without its Bot `history`. */
|
|
176
|
+
contextMaxBytes: number;
|
|
177
|
+
instructionMaxBytes: number;
|
|
178
|
+
/** The Bot `history`. Default: `DEFAULT_HANDOFF_BUDGETS`. */
|
|
179
|
+
handoff?: HandoffPackBudgets;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The frozen instruction. A Cross-Bot Turn fits `instructionMaxBytes` as a whole.
|
|
183
|
+
* `actions` narrows the Bot Turn prompt to those actions (`promptActions`). Absent: `SYSTEM_PROMPT`.
|
|
184
|
+
*/
|
|
185
|
+
export declare function turnInstruction<R extends ContextRoutine>(state: ContextState, history: ContextHistory, turn: Turn, limits: InstructionLimits, routines?: readonly R[], actions?: readonly string[]): {
|
|
186
|
+
context: {
|
|
187
|
+
historyWindow: import("./history.js").HistoryWindow;
|
|
188
|
+
room: {
|
|
189
|
+
id: string;
|
|
190
|
+
name: string;
|
|
191
|
+
members: string[];
|
|
192
|
+
announcement: string;
|
|
193
|
+
visibility: 'after_join';
|
|
194
|
+
messages: RoomMessage[];
|
|
195
|
+
};
|
|
196
|
+
round: {
|
|
197
|
+
id: string;
|
|
198
|
+
limit: number;
|
|
199
|
+
counts: Record<string, number>;
|
|
200
|
+
};
|
|
201
|
+
seat: {
|
|
202
|
+
id: string;
|
|
203
|
+
deadline: number | undefined;
|
|
204
|
+
};
|
|
205
|
+
teamNotes: {
|
|
206
|
+
id: string;
|
|
207
|
+
text: string;
|
|
208
|
+
}[];
|
|
209
|
+
roster: {
|
|
210
|
+
id: string;
|
|
211
|
+
name: string;
|
|
212
|
+
role: string;
|
|
213
|
+
mainBot: boolean;
|
|
214
|
+
}[];
|
|
215
|
+
rejectedActions: Rejection[];
|
|
216
|
+
rooms: {
|
|
217
|
+
id: string;
|
|
218
|
+
name: string;
|
|
219
|
+
members: string[];
|
|
220
|
+
admin?: string;
|
|
221
|
+
mode: 'mention';
|
|
222
|
+
announcement: string;
|
|
223
|
+
memberMentions?: import("./rooms.js").MemberMentions;
|
|
224
|
+
archived?: true;
|
|
225
|
+
}[];
|
|
226
|
+
delegation?: {
|
|
227
|
+
delegationId: string;
|
|
228
|
+
from: {
|
|
229
|
+
botId: string;
|
|
230
|
+
name: string;
|
|
231
|
+
};
|
|
232
|
+
hop: number;
|
|
233
|
+
} | undefined;
|
|
234
|
+
openDelegations?: {
|
|
235
|
+
items: {
|
|
236
|
+
id: string;
|
|
237
|
+
from: string;
|
|
238
|
+
to: string;
|
|
239
|
+
status: "queued" | "reply_held" | "reply_pending" | "resolved" | "running" | "uncertain" | "waiting_device";
|
|
240
|
+
request: string;
|
|
241
|
+
}[];
|
|
242
|
+
omitted: number;
|
|
243
|
+
notice: string | null;
|
|
244
|
+
} | undefined;
|
|
245
|
+
} | ({
|
|
246
|
+
teamNotes: {
|
|
247
|
+
id: string;
|
|
248
|
+
text: string;
|
|
249
|
+
}[];
|
|
250
|
+
roster: {
|
|
251
|
+
id: string;
|
|
252
|
+
name: string;
|
|
253
|
+
role: string;
|
|
254
|
+
mainBot: boolean;
|
|
255
|
+
}[];
|
|
256
|
+
rejectedActions: Rejection[];
|
|
257
|
+
rooms: {
|
|
258
|
+
id: string;
|
|
259
|
+
name: string;
|
|
260
|
+
members: string[];
|
|
261
|
+
admin?: string;
|
|
262
|
+
mode: 'mention';
|
|
263
|
+
announcement: string;
|
|
264
|
+
memberMentions?: import("./rooms.js").MemberMentions;
|
|
265
|
+
archived?: true;
|
|
266
|
+
}[];
|
|
267
|
+
delegation?: {
|
|
268
|
+
delegationId: string;
|
|
269
|
+
from: {
|
|
270
|
+
botId: string;
|
|
271
|
+
name: string;
|
|
272
|
+
};
|
|
273
|
+
hop: number;
|
|
274
|
+
} | undefined;
|
|
275
|
+
openDelegations?: {
|
|
276
|
+
items: {
|
|
277
|
+
id: string;
|
|
278
|
+
from: string;
|
|
279
|
+
to: string;
|
|
280
|
+
status: "queued" | "reply_held" | "reply_pending" | "resolved" | "running" | "uncertain" | "waiting_device";
|
|
281
|
+
request: string;
|
|
282
|
+
}[];
|
|
283
|
+
omitted: number;
|
|
284
|
+
notice: string | null;
|
|
285
|
+
} | undefined;
|
|
286
|
+
} & {
|
|
287
|
+
historyWindow: {
|
|
288
|
+
turnLimit: number;
|
|
289
|
+
maxBytes: number;
|
|
290
|
+
omittedMessages: number;
|
|
291
|
+
omittedTurns?: number;
|
|
292
|
+
currentRequestBytes: number;
|
|
293
|
+
metadataOverBudget: boolean;
|
|
294
|
+
notice: string | null;
|
|
295
|
+
omittedBackground?: number;
|
|
296
|
+
omittedCards: number;
|
|
297
|
+
omittedQuestions: number;
|
|
298
|
+
omittedPendingCards: number;
|
|
299
|
+
omittedPendingQuestions: number;
|
|
300
|
+
omittedRejections: number;
|
|
301
|
+
};
|
|
302
|
+
rejectedActions: Rejection[];
|
|
303
|
+
questions: Question[];
|
|
304
|
+
cards: Card[];
|
|
305
|
+
routines: R[];
|
|
306
|
+
history: import("@byok-sdk/protocol").HandoffPack;
|
|
307
|
+
});
|
|
308
|
+
instruction: string;
|
|
309
|
+
};
|
|
310
|
+
/** The stored Turn and row tables that a Bot's history selects from. */
|
|
311
|
+
export interface BotHistoryState {
|
|
312
|
+
readonly turns: Readonly<Record<string, Turn>>;
|
|
313
|
+
readonly cards: Readonly<Record<string, Card>>;
|
|
314
|
+
readonly questions: Readonly<Record<string, Question>>;
|
|
315
|
+
readonly rejected: readonly Rejection[];
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* One Bot's history in ledger order. `turn` takes its stored position, or comes last when it is not stored.
|
|
319
|
+
* Select within the Bot boundary before applying any count or byte window.
|
|
320
|
+
*/
|
|
321
|
+
export declare function botHistory(state: BotHistoryState, turn: Turn, injected?: readonly ContextTurn[], room?: readonly RoomMessage[]): ContextHistory;
|
|
322
|
+
/**
|
|
323
|
+
* The frozen instruction of a Bot Turn, from its own history. A Cross-Bot Turn fits `instructionMaxBytes` as a whole.
|
|
324
|
+
* `injected` is the Bot's earlier history from an external authority. Cards, questions and rejected actions stay Host state.
|
|
325
|
+
* `room` is a seat Turn's room messages from an external authority. `actions` narrows the prompt, as in `turnInstruction`.
|
|
326
|
+
*/
|
|
327
|
+
export declare function botTurnInstruction<R extends ContextRoutine>(state: ContextState & BotHistoryState, turn: Turn, limits: InstructionLimits, routines?: readonly R[], injected?: readonly ContextTurn[], room?: readonly RoomMessage[], actions?: readonly string[]): {
|
|
328
|
+
context: {
|
|
329
|
+
historyWindow: import("./history.js").HistoryWindow;
|
|
330
|
+
room: {
|
|
331
|
+
id: string;
|
|
332
|
+
name: string;
|
|
333
|
+
members: string[];
|
|
334
|
+
announcement: string;
|
|
335
|
+
visibility: 'after_join';
|
|
336
|
+
messages: RoomMessage[];
|
|
337
|
+
};
|
|
338
|
+
round: {
|
|
339
|
+
id: string;
|
|
340
|
+
limit: number;
|
|
341
|
+
counts: Record<string, number>;
|
|
342
|
+
};
|
|
343
|
+
seat: {
|
|
344
|
+
id: string;
|
|
345
|
+
deadline: number | undefined;
|
|
346
|
+
};
|
|
347
|
+
teamNotes: {
|
|
348
|
+
id: string;
|
|
349
|
+
text: string;
|
|
350
|
+
}[];
|
|
351
|
+
roster: {
|
|
352
|
+
id: string;
|
|
353
|
+
name: string;
|
|
354
|
+
role: string;
|
|
355
|
+
mainBot: boolean;
|
|
356
|
+
}[];
|
|
357
|
+
rejectedActions: Rejection[];
|
|
358
|
+
rooms: {
|
|
359
|
+
id: string;
|
|
360
|
+
name: string;
|
|
361
|
+
members: string[];
|
|
362
|
+
admin?: string;
|
|
363
|
+
mode: 'mention';
|
|
364
|
+
announcement: string;
|
|
365
|
+
memberMentions?: import("./rooms.js").MemberMentions;
|
|
366
|
+
archived?: true;
|
|
367
|
+
}[];
|
|
368
|
+
delegation?: {
|
|
369
|
+
delegationId: string;
|
|
370
|
+
from: {
|
|
371
|
+
botId: string;
|
|
372
|
+
name: string;
|
|
373
|
+
};
|
|
374
|
+
hop: number;
|
|
375
|
+
} | undefined;
|
|
376
|
+
openDelegations?: {
|
|
377
|
+
items: {
|
|
378
|
+
id: string;
|
|
379
|
+
from: string;
|
|
380
|
+
to: string;
|
|
381
|
+
status: "queued" | "reply_held" | "reply_pending" | "resolved" | "running" | "uncertain" | "waiting_device";
|
|
382
|
+
request: string;
|
|
383
|
+
}[];
|
|
384
|
+
omitted: number;
|
|
385
|
+
notice: string | null;
|
|
386
|
+
} | undefined;
|
|
387
|
+
} | ({
|
|
388
|
+
teamNotes: {
|
|
389
|
+
id: string;
|
|
390
|
+
text: string;
|
|
391
|
+
}[];
|
|
392
|
+
roster: {
|
|
393
|
+
id: string;
|
|
394
|
+
name: string;
|
|
395
|
+
role: string;
|
|
396
|
+
mainBot: boolean;
|
|
397
|
+
}[];
|
|
398
|
+
rejectedActions: Rejection[];
|
|
399
|
+
rooms: {
|
|
400
|
+
id: string;
|
|
401
|
+
name: string;
|
|
402
|
+
members: string[];
|
|
403
|
+
admin?: string;
|
|
404
|
+
mode: 'mention';
|
|
405
|
+
announcement: string;
|
|
406
|
+
memberMentions?: import("./rooms.js").MemberMentions;
|
|
407
|
+
archived?: true;
|
|
408
|
+
}[];
|
|
409
|
+
delegation?: {
|
|
410
|
+
delegationId: string;
|
|
411
|
+
from: {
|
|
412
|
+
botId: string;
|
|
413
|
+
name: string;
|
|
414
|
+
};
|
|
415
|
+
hop: number;
|
|
416
|
+
} | undefined;
|
|
417
|
+
openDelegations?: {
|
|
418
|
+
items: {
|
|
419
|
+
id: string;
|
|
420
|
+
from: string;
|
|
421
|
+
to: string;
|
|
422
|
+
status: "queued" | "reply_held" | "reply_pending" | "resolved" | "running" | "uncertain" | "waiting_device";
|
|
423
|
+
request: string;
|
|
424
|
+
}[];
|
|
425
|
+
omitted: number;
|
|
426
|
+
notice: string | null;
|
|
427
|
+
} | undefined;
|
|
428
|
+
} & {
|
|
429
|
+
historyWindow: {
|
|
430
|
+
turnLimit: number;
|
|
431
|
+
maxBytes: number;
|
|
432
|
+
omittedMessages: number;
|
|
433
|
+
omittedTurns?: number;
|
|
434
|
+
currentRequestBytes: number;
|
|
435
|
+
metadataOverBudget: boolean;
|
|
436
|
+
notice: string | null;
|
|
437
|
+
omittedBackground?: number;
|
|
438
|
+
omittedCards: number;
|
|
439
|
+
omittedQuestions: number;
|
|
440
|
+
omittedPendingCards: number;
|
|
441
|
+
omittedPendingQuestions: number;
|
|
442
|
+
omittedRejections: number;
|
|
443
|
+
};
|
|
444
|
+
rejectedActions: Rejection[];
|
|
445
|
+
questions: Question[];
|
|
446
|
+
cards: Card[];
|
|
447
|
+
routines: R[];
|
|
448
|
+
history: import("@byok-sdk/protocol").HandoffPack;
|
|
449
|
+
});
|
|
450
|
+
instruction: string;
|
|
451
|
+
};
|
|
452
|
+
export declare const DEFAULT_CONTEXT_MAX_BYTES: number;
|
|
453
|
+
export declare const DEFAULT_CONTEXT_TURN_LIMIT = 12;
|
|
454
|
+
export declare const DEFAULT_HANDOFF_BUDGETS: HandoffPackBudgets;
|
|
455
|
+
/**
|
|
456
|
+
* Snapshot views include the candidate as the newest turn of `history.recent`; an empty `recent` means it did not fit.
|
|
457
|
+
* Frozen turn views keep it in Request. `maxBytes` bounds everything but `history`, which `handoff` bounds. `fit.request`
|
|
458
|
+
* marks a Cross-Bot Turn, whose `history` gets only the bytes left in `maxBytes`.
|
|
459
|
+
*/
|
|
460
|
+
export declare function contextPack<T extends object = Record<never, never>, R = ContextRoutine>(history: ContextHistory, turnLimit?: number, currentTurnId?: string, maxBytes?: number, separateRequest?: boolean, shared?: T, fit?: {
|
|
461
|
+
request?: string;
|
|
462
|
+
background?: unknown[][];
|
|
463
|
+
}, routines?: readonly R[], handoff?: HandoffPackBudgets): T & {
|
|
464
|
+
historyWindow: {
|
|
465
|
+
turnLimit: number;
|
|
466
|
+
maxBytes: number;
|
|
467
|
+
omittedMessages: number;
|
|
468
|
+
omittedTurns?: number;
|
|
469
|
+
currentRequestBytes: number;
|
|
470
|
+
metadataOverBudget: boolean;
|
|
471
|
+
notice: string | null;
|
|
472
|
+
omittedBackground?: number;
|
|
473
|
+
omittedCards: number;
|
|
474
|
+
omittedQuestions: number;
|
|
475
|
+
omittedPendingCards: number;
|
|
476
|
+
omittedPendingQuestions: number;
|
|
477
|
+
omittedRejections: number;
|
|
478
|
+
};
|
|
479
|
+
rejectedActions: Rejection[];
|
|
480
|
+
questions: Question[];
|
|
481
|
+
cards: Card[];
|
|
482
|
+
routines: R[];
|
|
483
|
+
history: import("@byok-sdk/protocol").HandoffPack;
|
|
484
|
+
};
|