@seanhogg/builderforce-memory 2026.9.32 → 2026.9.34
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/dist/handoff/budget.d.ts +34 -0
- package/dist/handoff/budget.d.ts.map +1 -0
- package/dist/handoff/budget.js +77 -0
- package/dist/handoff/budget.js.map +1 -0
- package/dist/handoff/index.d.ts +18 -0
- package/dist/handoff/index.d.ts.map +1 -0
- package/dist/handoff/index.js +17 -0
- package/dist/handoff/index.js.map +1 -0
- package/dist/handoff/note.d.ts +35 -0
- package/dist/handoff/note.d.ts.map +1 -0
- package/dist/handoff/note.js +82 -0
- package/dist/handoff/note.js.map +1 -0
- package/dist/handoff/pack.d.ts +17 -0
- package/dist/handoff/pack.d.ts.map +1 -0
- package/dist/handoff/pack.js +110 -0
- package/dist/handoff/pack.js.map +1 -0
- package/dist/handoff/segments.d.ts +18 -0
- package/dist/handoff/segments.d.ts.map +1 -0
- package/dist/handoff/segments.js +36 -0
- package/dist/handoff/segments.js.map +1 -0
- package/dist/handoff/types.d.ts +59 -0
- package/dist/handoff/types.d.ts.map +1 -0
- package/dist/handoff/types.js +7 -0
- package/dist/handoff/types.js.map +1 -0
- package/dist/limbic/LimbicSession.d.ts +2 -2
- package/package.json +8 -3
- package/src/handoff/budget.ts +78 -0
- package/src/handoff/handoff.test.ts +197 -0
- package/src/handoff/index.ts +24 -0
- package/src/handoff/note.ts +102 -0
- package/src/handoff/pack.ts +133 -0
- package/src/handoff/segments.ts +42 -0
- package/src/handoff/types.ts +63 -0
- package/src/limbic/LimbicSession.ts +2 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The hand-off contract (PRD 34 §3.3) — the shapes a host passes in and gets back when
|
|
3
|
+
* a conversation moves from one model to another whose context window may be smaller.
|
|
4
|
+
* Pure data: no runtime imports, so the subpath stays Worker/browser/Node safe.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** One chat message in the OpenAI-style shape every Builderforce host already speaks. */
|
|
8
|
+
export interface HandoffMessage {
|
|
9
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
10
|
+
content: unknown;
|
|
11
|
+
tool_calls?: unknown;
|
|
12
|
+
tool_call_id?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** What {@link packHandoff} packs, and the budget it packs into. */
|
|
16
|
+
export interface HandoffPackInput {
|
|
17
|
+
messages: readonly HandoffMessage[];
|
|
18
|
+
/** The NEXT model's context window, in tokens. */
|
|
19
|
+
targetContextTokens: number;
|
|
20
|
+
/** Tokens held back for the next model's reply. */
|
|
21
|
+
reserveOutputTokens: number;
|
|
22
|
+
/** Tokens the advertised tool schemas cost. */
|
|
23
|
+
toolsTokens?: number;
|
|
24
|
+
/** Model refs, for the one-line hand-off note. */
|
|
25
|
+
from?: string;
|
|
26
|
+
to?: string;
|
|
27
|
+
/** Memory block for the latest directive, at most `budgetChars` long. */
|
|
28
|
+
recall?: (query: string, budgetChars: number) => Promise<string>;
|
|
29
|
+
/** Summary of the dropped middle. */
|
|
30
|
+
summarize?: (dropped: readonly HandoffMessage[]) => Promise<string>;
|
|
31
|
+
/** Token estimate for a text. Default: chars/4, rounded up. */
|
|
32
|
+
estimateTokens?: (text: string) => number;
|
|
33
|
+
/**
|
|
34
|
+
* Optional ceiling (ms) on each of `summarize` / `recall`. A call that outlives it is
|
|
35
|
+
* treated as a failure and packing falls through to the next note source. No ceiling
|
|
36
|
+
* when omitted.
|
|
37
|
+
*/
|
|
38
|
+
timeoutMs?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The packed transcript and how it was made. */
|
|
42
|
+
export interface HandoffPack {
|
|
43
|
+
messages: HandoffMessage[];
|
|
44
|
+
/** Messages from the input that are in neither the verbatim tail nor re-injected. */
|
|
45
|
+
dropped: number;
|
|
46
|
+
/** The note carries the `summarize` result. */
|
|
47
|
+
summarized: boolean;
|
|
48
|
+
/** The note carries the `recall` result. */
|
|
49
|
+
recalled: boolean;
|
|
50
|
+
estimatedTokens: number;
|
|
51
|
+
/** False only when the system message(s) + the latest directive alone exceed the budget. */
|
|
52
|
+
fits: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The three numbers the usable budget is computed from. */
|
|
56
|
+
export interface HandoffBudgetInput {
|
|
57
|
+
targetContextTokens: number;
|
|
58
|
+
reserveOutputTokens: number;
|
|
59
|
+
toolsTokens?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A text → token-count estimator. */
|
|
63
|
+
export type TokenEstimator = (text: string) => number;
|
|
@@ -62,8 +62,8 @@ export interface LimbicSessionOptions {
|
|
|
62
62
|
*/
|
|
63
63
|
personalityTraits?: PersonalityTraits;
|
|
64
64
|
/**
|
|
65
|
-
* An explicit 8-dim resting setpoint (e.g. one already derived
|
|
66
|
-
* `
|
|
65
|
+
* An explicit 8-dim resting setpoint (e.g. one already derived with the
|
|
66
|
+
* engine's `limbicSetpoints`). Overrides {@link personalityTraits}. Clamped to bounds.
|
|
67
67
|
*/
|
|
68
68
|
personalitySetpoint?: ArrayLike<number>;
|
|
69
69
|
}
|