@loreai/core 0.18.0 → 0.20.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/dist/bun/agents-file.d.ts.map +1 -1
- package/dist/bun/config.d.ts.map +1 -1
- package/dist/bun/curator.d.ts.map +1 -1
- package/dist/bun/db.d.ts +86 -1
- package/dist/bun/db.d.ts.map +1 -1
- package/dist/bun/distillation.d.ts +2 -13
- package/dist/bun/distillation.d.ts.map +1 -1
- package/dist/bun/embedding.d.ts +5 -1
- package/dist/bun/embedding.d.ts.map +1 -1
- package/dist/bun/git.d.ts.map +1 -1
- package/dist/bun/gradient.d.ts +13 -1
- package/dist/bun/gradient.d.ts.map +1 -1
- package/dist/bun/hosted.d.ts +36 -0
- package/dist/bun/hosted.d.ts.map +1 -0
- package/dist/bun/index.d.ts +3 -2
- package/dist/bun/index.d.ts.map +1 -1
- package/dist/bun/index.js +1049 -247
- package/dist/bun/index.js.map +4 -4
- package/dist/bun/lat-reader.d.ts.map +1 -1
- package/dist/bun/ltm.d.ts +99 -5
- package/dist/bun/ltm.d.ts.map +1 -1
- package/dist/bun/session-limiter.d.ts +26 -0
- package/dist/bun/session-limiter.d.ts.map +1 -0
- package/dist/bun/temporal.d.ts +2 -0
- package/dist/bun/temporal.d.ts.map +1 -1
- package/dist/node/agents-file.d.ts.map +1 -1
- package/dist/node/config.d.ts.map +1 -1
- package/dist/node/curator.d.ts.map +1 -1
- package/dist/node/db.d.ts +86 -1
- package/dist/node/db.d.ts.map +1 -1
- package/dist/node/distillation.d.ts +2 -13
- package/dist/node/distillation.d.ts.map +1 -1
- package/dist/node/embedding.d.ts +5 -1
- package/dist/node/embedding.d.ts.map +1 -1
- package/dist/node/git.d.ts.map +1 -1
- package/dist/node/gradient.d.ts +13 -1
- package/dist/node/gradient.d.ts.map +1 -1
- package/dist/node/hosted.d.ts +36 -0
- package/dist/node/hosted.d.ts.map +1 -0
- package/dist/node/index.d.ts +3 -2
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +1049 -247
- package/dist/node/index.js.map +4 -4
- package/dist/node/lat-reader.d.ts.map +1 -1
- package/dist/node/ltm.d.ts +99 -5
- package/dist/node/ltm.d.ts.map +1 -1
- package/dist/node/session-limiter.d.ts +26 -0
- package/dist/node/session-limiter.d.ts.map +1 -0
- package/dist/node/temporal.d.ts +2 -0
- package/dist/node/temporal.d.ts.map +1 -1
- package/dist/types/agents-file.d.ts.map +1 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/curator.d.ts.map +1 -1
- package/dist/types/db.d.ts +86 -1
- package/dist/types/db.d.ts.map +1 -1
- package/dist/types/distillation.d.ts +2 -13
- package/dist/types/distillation.d.ts.map +1 -1
- package/dist/types/embedding.d.ts +5 -1
- package/dist/types/embedding.d.ts.map +1 -1
- package/dist/types/git.d.ts.map +1 -1
- package/dist/types/gradient.d.ts +13 -1
- package/dist/types/gradient.d.ts.map +1 -1
- package/dist/types/hosted.d.ts +36 -0
- package/dist/types/hosted.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lat-reader.d.ts.map +1 -1
- package/dist/types/ltm.d.ts +99 -5
- package/dist/types/ltm.d.ts.map +1 -1
- package/dist/types/session-limiter.d.ts +26 -0
- package/dist/types/session-limiter.d.ts.map +1 -0
- package/dist/types/temporal.d.ts +2 -0
- package/dist/types/temporal.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/agents-file.ts +12 -0
- package/src/config.ts +10 -5
- package/src/curator.ts +54 -2
- package/src/db.ts +386 -6
- package/src/distillation.ts +55 -14
- package/src/embedding.ts +71 -8
- package/src/git.ts +4 -0
- package/src/gradient.ts +227 -74
- package/src/hosted.ts +46 -0
- package/src/index.ts +12 -0
- package/src/lat-reader.ts +4 -0
- package/src/ltm.ts +480 -45
- package/src/session-limiter.ts +47 -0
- package/src/temporal.ts +10 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-file.d.ts","sourceRoot":"","sources":["../../src/agents-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"agents-file.d.ts","sourceRoot":"","sources":["../../src/agents-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,eAAO,MAAM,kBAAkB,qGACqE,CAAC;AACrG,eAAO,MAAM,gBAAgB,sCAAsC,CAAC;AAepE;;;;GAIG;AACH,eAAO,MAAM,SAAS,aAAa,CAAC;AA8CpC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAI5D;AAMD,MAAM,MAAM,eAAe,GAAG;IAC5B,+EAA+E;IAC/E,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA+EF;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,CAgD1E;AAmFD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAgCP;AAMD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAeV;AAoFD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAgBP;AAMD;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAG3D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAmBxD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CA0BjE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAqBxD"}
|
package/dist/bun/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8OrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAIpD,wBAAgB,MAAM,IAAI,UAAU,CAEnC;AAED,wBAAsB,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAajE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curator.d.ts","sourceRoot":"","sources":["../../src/curator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"curator.d.ts","sourceRoot":"","sources":["../../src/curator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,MAAM,MAAM,SAAS,GACjB;IACE,EAAE,EAAE,QAAQ,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CA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B,WAAW,CAAC,KAAK,EAAE;IACvC,GAAG,EAAE,SAAS,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAkChD"}
|
package/dist/bun/db.d.ts
CHANGED
|
@@ -38,8 +38,20 @@ export declare function close(): void;
|
|
|
38
38
|
* an alias so subsequent calls skip the subprocess. If the matched project's
|
|
39
39
|
* git_remote was not yet populated (pre-v14 rows), it is backfilled lazily.
|
|
40
40
|
*/
|
|
41
|
-
export declare function ensureProject(path: string, name?: string): string;
|
|
41
|
+
export declare function ensureProject(path: string, name?: string, suppliedGitRemote?: string | null): string;
|
|
42
42
|
export declare function projectId(path: string): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Look up a project by git_remote (preferred) or path. Returns the project ID
|
|
45
|
+
* or null if not found. Unlike `ensureProject()`, this is read-only — it never
|
|
46
|
+
* creates a project or registers path aliases.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveProjectByRemoteOrPath(gitRemote?: string, path?: string): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Look up the path for a project by its internal ID.
|
|
51
|
+
* Used by the REST API to resolve project UUID → path for core functions
|
|
52
|
+
* that require a path argument.
|
|
53
|
+
*/
|
|
54
|
+
export declare function projectPath(id: string): string | null;
|
|
43
55
|
/** Look up a project's display name by its internal ID. */
|
|
44
56
|
export declare function projectName(id: string): string | null;
|
|
45
57
|
/**
|
|
@@ -96,6 +108,79 @@ export declare function loadSessionCosts(sessionID: string): SessionCostSnapshot
|
|
|
96
108
|
* Returns a map of sessionID → SessionCostSnapshot.
|
|
97
109
|
*/
|
|
98
110
|
export declare function loadAllSessionCosts(): Map<string, SessionCostSnapshot>;
|
|
111
|
+
/** Fields that can be persisted for session tracking state. */
|
|
112
|
+
export type SessionTrackingState = {
|
|
113
|
+
lastCuratedAt?: number;
|
|
114
|
+
messageCount?: number;
|
|
115
|
+
turnsSinceCuration?: number;
|
|
116
|
+
consecutiveTextOnlyTurns?: number;
|
|
117
|
+
ltmCacheText?: string | null;
|
|
118
|
+
ltmCacheTokens?: number | null;
|
|
119
|
+
ltmPinText?: string | null;
|
|
120
|
+
ltmPinTokens?: number | null;
|
|
121
|
+
fingerprint?: string;
|
|
122
|
+
headerSessionId?: string | null;
|
|
123
|
+
headerName?: string | null;
|
|
124
|
+
resolvedConversationTTL?: string;
|
|
125
|
+
warmupState?: string | null;
|
|
126
|
+
dynamicContextCap?: number;
|
|
127
|
+
bustRateEMA?: number;
|
|
128
|
+
interBustIntervalEMA?: number;
|
|
129
|
+
lastLayer?: number;
|
|
130
|
+
lastKnownInput?: number;
|
|
131
|
+
lastTurnAt?: number;
|
|
132
|
+
lastBustAt?: number;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Persist session tracking state. Ensures the row exists, then updates
|
|
136
|
+
* only the fields that are explicitly provided (not undefined).
|
|
137
|
+
*/
|
|
138
|
+
export declare function saveSessionTracking(sessionID: string, state: SessionTrackingState): void;
|
|
139
|
+
/** Loaded session tracking state. */
|
|
140
|
+
export type LoadedSessionTracking = {
|
|
141
|
+
lastCuratedAt: number;
|
|
142
|
+
messageCount: number;
|
|
143
|
+
turnsSinceCuration: number;
|
|
144
|
+
consecutiveTextOnlyTurns: number;
|
|
145
|
+
ltmCacheText: string | null;
|
|
146
|
+
ltmCacheTokens: number | null;
|
|
147
|
+
ltmPinText: string | null;
|
|
148
|
+
ltmPinTokens: number | null;
|
|
149
|
+
fingerprint: string;
|
|
150
|
+
headerSessionId: string | null;
|
|
151
|
+
headerName: string | null;
|
|
152
|
+
resolvedConversationTTL: string;
|
|
153
|
+
warmupState: string | null;
|
|
154
|
+
dynamicContextCap: number;
|
|
155
|
+
bustRateEMA: number;
|
|
156
|
+
interBustIntervalEMA: number;
|
|
157
|
+
lastLayer: number;
|
|
158
|
+
lastKnownInput: number;
|
|
159
|
+
lastTurnAt: number;
|
|
160
|
+
lastBustAt: number;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Load persisted session tracking state. Returns null if no row exists.
|
|
164
|
+
*/
|
|
165
|
+
export declare function loadSessionTracking(sessionID: string): LoadedSessionTracking | null;
|
|
166
|
+
/**
|
|
167
|
+
* Load all persisted header → session ID mappings from the session_state table.
|
|
168
|
+
*
|
|
169
|
+
* Used on gateway startup (in initIfNeeded) to pre-populate the in-memory
|
|
170
|
+
* headerSessionIndex so Tier 1 session identification works immediately
|
|
171
|
+
* after a process restart — without this, the first post-restart request
|
|
172
|
+
* with a known session header would generate a new session ID and orphan
|
|
173
|
+
* the old session's persisted state.
|
|
174
|
+
*/
|
|
175
|
+
export declare function loadHeaderSessionIndex(): Array<{
|
|
176
|
+
sessionId: string;
|
|
177
|
+
headerSessionId: string;
|
|
178
|
+
headerName: string;
|
|
179
|
+
}>;
|
|
180
|
+
/** Get a kv_meta value by key. Returns null if not found. */
|
|
181
|
+
export declare function getKV(key: string): string | null;
|
|
182
|
+
/** Set a kv_meta value (upsert). */
|
|
183
|
+
export declare function setKV(key: string, value: string): void;
|
|
99
184
|
/** Get a metadata value by key. Returns null if not found. */
|
|
100
185
|
export declare function getMeta(key: string): string | null;
|
|
101
186
|
/** Set a metadata value (upsert). */
|
package/dist/bun/db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMtC;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAMvE;
|
|
1
|
+
{"version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AE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CAyDnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,IAAI,KAAK,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAiBD;AAMD,6DAA6D;AAC7D,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKhD;AAED,oCAAoC;AACpC,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAMtD;AAMD,8DAA8D;AAC9D,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKlD;AAED,qCAAqC;AACrC,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAMxD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAMtC"}
|
|
@@ -147,21 +147,9 @@ export declare function run(input: {
|
|
|
147
147
|
providerID: string;
|
|
148
148
|
modelID: string;
|
|
149
149
|
};
|
|
150
|
-
/** Skip minMessages threshold check — distill whatever is pending */
|
|
151
150
|
force?: boolean;
|
|
152
|
-
/** Skip meta-distillation even when gen-0 count exceeds the threshold.
|
|
153
|
-
* Used when the upstream prompt cache is likely still warm — meta-distillation
|
|
154
|
-
* rewrites distillation row IDs, which invalidates the distilled prefix cache
|
|
155
|
-
* and causes a cache bust on the next turn. Callers should set this to true
|
|
156
|
-
* when `Date.now() - getLastTurnAt(sessionID) < cacheTTL`. */
|
|
157
151
|
skipMeta?: boolean;
|
|
158
|
-
/** When true, all LLM calls in this run are marked urgent and bypass the
|
|
159
|
-
* batch queue (if one is active). Use for compaction and overflow recovery
|
|
160
|
-
* where the caller is blocking on the result. Background/idle distillation
|
|
161
|
-
* should leave this false to benefit from batch API 50% cost savings. */
|
|
162
152
|
urgent?: boolean;
|
|
163
|
-
/** Whether the LLM call will use batch or direct pricing. Recorded on the
|
|
164
|
-
* distillation row for accurate historical cost estimates. */
|
|
165
153
|
callType?: "batch" | "direct";
|
|
166
154
|
}): Promise<{
|
|
167
155
|
rounds: number;
|
|
@@ -173,7 +161,8 @@ export declare function run(input: {
|
|
|
173
161
|
* via `<previous-meta-summary>` so the LLM updates in place rather than
|
|
174
162
|
* re-deriving from scratch.
|
|
175
163
|
*
|
|
176
|
-
*
|
|
164
|
+
* Serialized per session via the same p-limit(1) as `run()`. Exported for
|
|
165
|
+
* the idle handler which calls metaDistill() independently of run().
|
|
177
166
|
*/
|
|
178
167
|
export declare function metaDistill(input: {
|
|
179
168
|
llm: LLMClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distillation.d.ts","sourceRoot":"","sources":["../../src/distillation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAavC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"distillation.d.ts","sourceRoot":"","sources":["../../src/distillation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAavC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,KAAK,eAAe,GAAG,QAAQ,CAAC,e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E,CAAC;IAChD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC/B,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAErC;AAuHD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAkDxC"}
|
package/dist/bun/embedding.d.ts
CHANGED
|
@@ -110,8 +110,12 @@ type VectorHit = {
|
|
|
110
110
|
* Search all knowledge entries with embeddings by cosine similarity.
|
|
111
111
|
* Returns top-k entries sorted by similarity descending.
|
|
112
112
|
* Pure brute-force — fine for <100 entries (microseconds).
|
|
113
|
+
*
|
|
114
|
+
* @param excludeCategories Optional category names to exclude from results.
|
|
115
|
+
* Useful when preferences are injected in a separate system block and
|
|
116
|
+
* shouldn't compete for vector search slots with context-bound entries.
|
|
113
117
|
*/
|
|
114
|
-
export declare function vectorSearch(queryEmbedding: Float32Array, limit?: number): VectorHit[];
|
|
118
|
+
export declare function vectorSearch(queryEmbedding: Float32Array, limit?: number, excludeCategories?: string[]): VectorHit[];
|
|
115
119
|
/**
|
|
116
120
|
* Search non-archived distillations with embeddings by cosine similarity.
|
|
117
121
|
* Returns top-k entries sorted by similarity descending.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/embedding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../src/embedding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA0CH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IACjF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAgHD;;;;GAIG;AACH,qBAAa,6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AsB,8BAA8B,IAAI,OAAO,CAAC,MAAM,CAAC,CAwDtE"}
|
package/dist/bun/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA6BtD;AAaD;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkDxD"}
|
package/dist/bun/gradient.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function getMaxContextTokens(): number;
|
|
|
17
17
|
* @param cacheRead - cache_read_input_tokens from the API response
|
|
18
18
|
* @param sessionID - session that produced this response
|
|
19
19
|
*/
|
|
20
|
-
export declare function updateBustRate(cacheWrite: number, cacheRead: number, sessionID?: string): void;
|
|
20
|
+
export declare function updateBustRate(cacheWrite: number, cacheRead: number, sessionID?: string, lastLayer?: number): void;
|
|
21
21
|
type DistillationSnapshot = {
|
|
22
22
|
/** Cached distillation rows from the most recent DB read */
|
|
23
23
|
rows: Distillation[];
|
|
@@ -141,6 +141,9 @@ export declare function inspectSessionState(sessionID: string): {
|
|
|
141
141
|
postIdleCompact: boolean;
|
|
142
142
|
lastTurnAt: number;
|
|
143
143
|
distillationSnapshot: DistillationSnapshot | null;
|
|
144
|
+
bustRateEMA: number;
|
|
145
|
+
dynamicContextCap: number;
|
|
146
|
+
consecutiveLayer4: number;
|
|
144
147
|
} | null;
|
|
145
148
|
/**
|
|
146
149
|
* For testing only — set the session's lastTurnAt field. Used to simulate
|
|
@@ -148,6 +151,14 @@ export declare function inspectSessionState(sessionID: string): {
|
|
|
148
151
|
* tests don't need to seed it via a transform() call.
|
|
149
152
|
*/
|
|
150
153
|
export declare function setLastTurnAtForTest(sessionID: string, ms: number): void;
|
|
154
|
+
/**
|
|
155
|
+
* Persist gradient calibration state to the session_state table.
|
|
156
|
+
*
|
|
157
|
+
* Designed to be called periodically (e.g. every 30s from the idle scheduler
|
|
158
|
+
* tick) rather than on every mutation, to avoid write amplification on the
|
|
159
|
+
* hot path. Max data loss on crash is one tick interval (~30s).
|
|
160
|
+
*/
|
|
161
|
+
export declare function saveGradientState(sessionID: string): void;
|
|
151
162
|
type Distillation = {
|
|
152
163
|
id: string;
|
|
153
164
|
observations: string;
|
|
@@ -206,6 +217,7 @@ export type TransformResult = {
|
|
|
206
217
|
usable: number;
|
|
207
218
|
distilledBudget: number;
|
|
208
219
|
rawBudget: number;
|
|
220
|
+
refreshLtm: boolean;
|
|
209
221
|
};
|
|
210
222
|
export declare function needsUrgentDistillation(sessionID: string): boolean;
|
|
211
223
|
export declare function transform(input: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../src/gradient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,oBAAoB,EAAqE,MAAM,SAAS,CAAC;AAQ9I,KAAK,gBAAgB,GAAG,oBAAoB,CAAC;AA0D7C,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,sBAAsB,EAAE,MAAM,GAC7B,MAAM,CAGR;AAED;;0CAE0C;AAC1C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,QAEjD;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACjB,IA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gB,yBAAyB,CAAC,SAAS,CAAC,EAAE,MAAM,QAO3D;AAgCD,wBAAgB,mBAAmB,CAAC,SAAS,CAAC,EAAE,MAAM,QAOrD;AAuHD,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAqB5C,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IAEpB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAIlB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAMF,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAIlE;AAgVD,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,eAAe,CAwClB;AAGD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAErE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hosted.ts — Hosted/remote mode flag for @loreai/core.
|
|
3
|
+
*
|
|
4
|
+
* When the gateway runs remotely (different machine/container from the
|
|
5
|
+
* developer's workspace), filesystem operations that use client-controlled
|
|
6
|
+
* paths are unsafe:
|
|
7
|
+
*
|
|
8
|
+
* - `git remote -v` subprocess with attacker-controlled cwd
|
|
9
|
+
* - `.lore.json` config read from attacker-controlled path
|
|
10
|
+
* - `.lore.md` / AGENTS.md read/write at attacker-controlled path
|
|
11
|
+
* - `lat.md/` recursive directory scan at attacker-controlled path
|
|
12
|
+
* - `fs.watch()` on attacker-controlled paths
|
|
13
|
+
*
|
|
14
|
+
* Setting hosted mode causes all these operations to become safe no-ops.
|
|
15
|
+
* The gateway sets this flag during startup when `LORE_HOSTED_MODE=1`.
|
|
16
|
+
*
|
|
17
|
+
* This is a process-wide flag — once set, it cannot be unset (the only
|
|
18
|
+
* consumer is the gateway process, and hosted mode is a startup decision).
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Enable hosted mode. Once enabled, cannot be disabled.
|
|
22
|
+
* All filesystem operations using client-controlled paths become no-ops.
|
|
23
|
+
*/
|
|
24
|
+
export declare function enableHostedMode(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Returns true if hosted mode is active — filesystem operations using
|
|
27
|
+
* client-controlled paths should be skipped.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isHostedMode(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Reset hosted mode flag. **Test-only** — production code should never
|
|
32
|
+
* call this. Exported so tests can toggle hosted mode without process
|
|
33
|
+
* restarts.
|
|
34
|
+
*/
|
|
35
|
+
export declare function _resetHostedModeForTest(): void;
|
|
36
|
+
//# sourceMappingURL=hosted.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted.d.ts","sourceRoot":"","sources":["../../src/hosted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
|
package/dist/bun/index.d.ts
CHANGED
|
@@ -15,9 +15,10 @@ export type { LoreMessage, LoreUserMessage, LoreAssistantMessage, LorePart, Lore
|
|
|
15
15
|
export { isTextPart, isReasoningPart, isToolPart } from "./types";
|
|
16
16
|
export { dataDir } from "./data-dir";
|
|
17
17
|
export { load, config, type LoreConfig } from "./config";
|
|
18
|
-
export { db, dbPath, ensureProject, getLastImportAt, setLastImportAt, isFirstRun, projectId, projectName, mergeProjectInternal, loadForceMinLayer, saveForceMinLayer, saveSessionCosts, loadSessionCosts, loadAllSessionCosts, type SessionCostSnapshot, getMeta, setMeta, getInstanceId, close, } from "./db";
|
|
18
|
+
export { db, dbPath, ensureProject, getLastImportAt, setLastImportAt, isFirstRun, projectId, projectName, projectPath, resolveProjectByRemoteOrPath, mergeProjectInternal, loadForceMinLayer, saveForceMinLayer, saveSessionCosts, loadSessionCosts, loadAllSessionCosts, type SessionCostSnapshot, saveSessionTracking, loadSessionTracking, loadHeaderSessionIndex, type SessionTrackingState, type LoadedSessionTracking, getKV, setKV, getMeta, setMeta, getInstanceId, close, } from "./db";
|
|
19
19
|
export { normalizeRemoteUrl, getGitRemote, clearGitRemoteCache } from "./git";
|
|
20
|
-
export {
|
|
20
|
+
export { enableHostedMode, isHostedMode } from "./hosted";
|
|
21
|
+
export { transform, setModelLimits, setMaxLayer0Tokens, computeLayer0Cap, setMaxContextTokens, computeContextCap, getMaxContextTokens, updateBustRate, needsUrgentDistillation, calibrate, setLtmTokens, getLtmTokens, getLtmBudget, setForceMinLayer, getLastTransformedCount, getLastTransformEstimate, getLastLayer, toolStripAnnotation, onIdleResume, getLastTurnAt, consumeCameOutOfIdle, saveGradientState, setLastTurnAtForTest, inspectSessionState, } from "./gradient";
|
|
21
22
|
export { formatKnowledge, formatDistillations, DISTILLATION_SYSTEM, distillationUser, RECURSIVE_SYSTEM, recursiveUser, CURATOR_SYSTEM, curatorUser, CONSOLIDATION_SYSTEM, consolidationUser, QUERY_EXPANSION_SYSTEM, COMPACT_SUMMARY_TEMPLATE, buildCompactPrompt, } from "./prompt";
|
|
22
23
|
export { shouldImport, importFromFile, exportToFile, exportLoreFile, importLoreFile, shouldImportLoreFile, loreFileExists, clearLoreFileCache, LORE_FILE, } from "./agents-file";
|
|
23
24
|
export { workerSessionIDs, isWorkerSession } from "./worker";
|
package/dist/bun/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,kBAAkB,MAAM,UAAU,CAAC;AAE/C,OAAO,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,kBAAkB,GACxB,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO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