@plur-ai/core 0.9.3 → 0.9.4
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/{chunk-3ZPTRZE3.js → chunk-EQPTF4JZ.js} +11 -1
- package/dist/{chunk-IGGMRXAB.js → chunk-ZY4R3VEG.js} +52 -12
- package/dist/embeddings-3EXLC3EH.js +21 -0
- package/dist/index.d.ts +306 -1
- package/dist/index.js +345 -42
- package/dist/{learn-async-R5KZ5EWF.js → learn-async-IISWD7HC.js} +1 -2
- package/package.json +1 -1
- package/dist/chunk-2ZDO52B4.js +0 -52
- package/dist/embeddings-ZRT6IRPA.js +0 -14
- package/dist/onnxruntime_binding-5QEF3SUC.node +0 -0
- package/dist/onnxruntime_binding-BKPKNEGC.node +0 -0
- package/dist/onnxruntime_binding-FMOXGIUT.node +0 -0
- package/dist/onnxruntime_binding-OI2KMXC5.node +0 -0
- package/dist/onnxruntime_binding-UX44MLAZ.node +0 -0
- package/dist/onnxruntime_binding-Y2W7N7WY.node +0 -0
- package/dist/transformers.node-PH5YK5EA.js +0 -46777
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Next session starts → relevant ones injected → agent remembers
|
|
|
56
56
|
You rate the result → engram strengthens → quality improves
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Search is fully local: BM25 over enriched text + BGE-small-en-v1.5 embeddings + Reciprocal Rank Fusion.
|
|
59
|
+
Search is fully local: BM25 over enriched text + BGE-small-en-v1.5 embeddings + Reciprocal Rank Fusion. Zero API calls, zero per-query cost. [Benchmark methodology →](https://plur.ai/benchmark.html)
|
|
60
60
|
|
|
61
61
|
## Search modes
|
|
62
62
|
|
|
@@ -183,7 +183,17 @@ var EngramSchema = z.object({
|
|
|
183
183
|
previous_version_ref: PreviousVersionRefSchema.optional(),
|
|
184
184
|
episode_ids: z.array(z.string()).default([]),
|
|
185
185
|
// === SP3: Retrieval & Injection fields ===
|
|
186
|
-
summary: z.string().max(80).optional()
|
|
186
|
+
summary: z.string().max(80).optional(),
|
|
187
|
+
/**
|
|
188
|
+
* Always-load flag. Pinned engrams bypass the term-hits gate in scoreEngram
|
|
189
|
+
* and are eligible for injection on every session start, regardless of
|
|
190
|
+
* keyword overlap with the user's task. Use sparingly: meta-rules,
|
|
191
|
+
* cross-cutting safety conventions, and core operating principles only.
|
|
192
|
+
* Pinned engrams still respect the token budget — they bypass per-pack and
|
|
193
|
+
* per-domain fairness caps in fillTokenBudget so always-load behavior is
|
|
194
|
+
* honored even if a single pack contributes many.
|
|
195
|
+
*/
|
|
196
|
+
pinned: z.boolean().optional()
|
|
187
197
|
});
|
|
188
198
|
var EngramSchemaPassthrough = EngramSchema.passthrough();
|
|
189
199
|
|
|
@@ -113,21 +113,57 @@ import { existsSync, readFileSync, mkdirSync } from "fs";
|
|
|
113
113
|
import { join } from "path";
|
|
114
114
|
import { createHash } from "crypto";
|
|
115
115
|
var embedPipeline = null;
|
|
116
|
+
var lastLoadError = null;
|
|
116
117
|
var transformersUnavailable = false;
|
|
118
|
+
function readDisabledFromEnv(env) {
|
|
119
|
+
const raw = env.PLUR_DISABLE_EMBEDDINGS;
|
|
120
|
+
if (!raw) return null;
|
|
121
|
+
const normalized = raw.trim().toLowerCase();
|
|
122
|
+
if (normalized === "1" || normalized === "true" || normalized === "yes") {
|
|
123
|
+
return "embeddings disabled by PLUR_DISABLE_EMBEDDINGS env var";
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
var ENV_DISABLED_REASON = readDisabledFromEnv(process.env);
|
|
128
|
+
var embeddingsDisabled = ENV_DISABLED_REASON !== null;
|
|
129
|
+
var disabledReason = ENV_DISABLED_REASON;
|
|
130
|
+
function embedderStatus() {
|
|
131
|
+
return {
|
|
132
|
+
available: !embeddingsDisabled && !transformersUnavailable,
|
|
133
|
+
loaded: embedPipeline !== null,
|
|
134
|
+
lastError: lastLoadError,
|
|
135
|
+
disabled: embeddingsDisabled,
|
|
136
|
+
disabledReason
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function setEmbeddingsEnabled(enabled, reason) {
|
|
140
|
+
embeddingsDisabled = !enabled;
|
|
141
|
+
disabledReason = enabled ? null : reason ?? "embeddings disabled by config";
|
|
142
|
+
if (!enabled) {
|
|
143
|
+
embedPipeline = null;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function resetEmbedder() {
|
|
147
|
+
transformersUnavailable = false;
|
|
148
|
+
lastLoadError = null;
|
|
149
|
+
embedPipeline = null;
|
|
150
|
+
}
|
|
117
151
|
async function getEmbedder() {
|
|
118
|
-
if (
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
152
|
+
if (embeddingsDisabled) return null;
|
|
153
|
+
if (embedPipeline) return embedPipeline;
|
|
154
|
+
try {
|
|
155
|
+
const { pipeline } = await import("@huggingface/transformers");
|
|
156
|
+
embedPipeline = await pipeline("feature-extraction", "Xenova/bge-small-en-v1.5", {
|
|
157
|
+
dtype: "fp32"
|
|
158
|
+
});
|
|
159
|
+
transformersUnavailable = false;
|
|
160
|
+
lastLoadError = null;
|
|
161
|
+
return embedPipeline;
|
|
162
|
+
} catch (err) {
|
|
163
|
+
transformersUnavailable = true;
|
|
164
|
+
lastLoadError = err instanceof Error ? err.message : String(err);
|
|
165
|
+
return null;
|
|
129
166
|
}
|
|
130
|
-
return embedPipeline;
|
|
131
167
|
}
|
|
132
168
|
async function embed(text) {
|
|
133
169
|
const embedder = await getEmbedder();
|
|
@@ -226,6 +262,10 @@ export {
|
|
|
226
262
|
computeIdf,
|
|
227
263
|
ftsScore,
|
|
228
264
|
searchEngrams,
|
|
265
|
+
readDisabledFromEnv,
|
|
266
|
+
embedderStatus,
|
|
267
|
+
setEmbeddingsEnabled,
|
|
268
|
+
resetEmbedder,
|
|
229
269
|
embed,
|
|
230
270
|
cosineSimilarity,
|
|
231
271
|
embeddingSearch,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cosineSimilarity,
|
|
3
|
+
embed,
|
|
4
|
+
embedderStatus,
|
|
5
|
+
embeddingSearch,
|
|
6
|
+
embeddingSearchWithScores,
|
|
7
|
+
readDisabledFromEnv,
|
|
8
|
+
resetEmbedder,
|
|
9
|
+
setEmbeddingsEnabled
|
|
10
|
+
} from "./chunk-ZY4R3VEG.js";
|
|
11
|
+
import "./chunk-PRK3B7WR.js";
|
|
12
|
+
export {
|
|
13
|
+
cosineSimilarity,
|
|
14
|
+
embed,
|
|
15
|
+
embedderStatus,
|
|
16
|
+
embeddingSearch,
|
|
17
|
+
embeddingSearchWithScores,
|
|
18
|
+
readDisabledFromEnv,
|
|
19
|
+
resetEmbedder,
|
|
20
|
+
setEmbeddingsEnabled
|
|
21
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -320,6 +320,16 @@ declare const EngramSchema: z.ZodObject<{
|
|
|
320
320
|
}>>;
|
|
321
321
|
episode_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
322
322
|
summary: z.ZodOptional<z.ZodString>;
|
|
323
|
+
/**
|
|
324
|
+
* Always-load flag. Pinned engrams bypass the term-hits gate in scoreEngram
|
|
325
|
+
* and are eligible for injection on every session start, regardless of
|
|
326
|
+
* keyword overlap with the user's task. Use sparingly: meta-rules,
|
|
327
|
+
* cross-cutting safety conventions, and core operating principles only.
|
|
328
|
+
* Pinned engrams still respect the token budget — they bypass per-pack and
|
|
329
|
+
* per-domain fairness caps in fillTokenBudget so always-load behavior is
|
|
330
|
+
* honored even if a single pack contributes many.
|
|
331
|
+
*/
|
|
332
|
+
pinned: z.ZodOptional<z.ZodBoolean>;
|
|
323
333
|
}, "strip", z.ZodTypeAny, {
|
|
324
334
|
type: "behavioral" | "architectural" | "procedural" | "terminological";
|
|
325
335
|
status: "active" | "dormant" | "retired" | "candidate";
|
|
@@ -425,6 +435,7 @@ declare const EngramSchema: z.ZodObject<{
|
|
|
425
435
|
changed_at: string;
|
|
426
436
|
} | undefined;
|
|
427
437
|
summary?: string | undefined;
|
|
438
|
+
pinned?: boolean | undefined;
|
|
428
439
|
}, {
|
|
429
440
|
type: "behavioral" | "architectural" | "procedural" | "terminological";
|
|
430
441
|
status: "active" | "dormant" | "retired" | "candidate";
|
|
@@ -530,6 +541,7 @@ declare const EngramSchema: z.ZodObject<{
|
|
|
530
541
|
} | undefined;
|
|
531
542
|
episode_ids?: string[] | undefined;
|
|
532
543
|
summary?: string | undefined;
|
|
544
|
+
pinned?: boolean | undefined;
|
|
533
545
|
}>;
|
|
534
546
|
type Engram = z.infer<typeof EngramSchema>;
|
|
535
547
|
type KnowledgeAnchor = z.infer<typeof KnowledgeAnchorSchema>;
|
|
@@ -567,12 +579,35 @@ declare function applyBatchDecay(engrams: Engram[], historyRoot: string, options
|
|
|
567
579
|
modified: Engram[];
|
|
568
580
|
};
|
|
569
581
|
|
|
582
|
+
interface EmbedderStatus {
|
|
583
|
+
available: boolean;
|
|
584
|
+
loaded: boolean;
|
|
585
|
+
lastError: string | null;
|
|
586
|
+
/** True when embeddings are explicitly disabled by user (env var or config). */
|
|
587
|
+
disabled: boolean;
|
|
588
|
+
/** Human-readable reason when disabled is true; null otherwise. */
|
|
589
|
+
disabledReason: string | null;
|
|
590
|
+
}
|
|
570
591
|
/** Result with cosine similarity score attached. */
|
|
571
592
|
interface SimilarityResult {
|
|
572
593
|
engram: Engram;
|
|
573
594
|
score: number;
|
|
574
595
|
}
|
|
575
596
|
|
|
597
|
+
/** Result of a hybrid search call with diagnostic metadata. */
|
|
598
|
+
interface HybridSearchResult {
|
|
599
|
+
engrams: Engram[];
|
|
600
|
+
/**
|
|
601
|
+
* - "hybrid": both BM25 and embeddings contributed (full operation).
|
|
602
|
+
* - "hybrid-degraded": embeddings were configured to load but failed —
|
|
603
|
+
* ran BM25-only as a fallback. Indicates a fault to surface to the user.
|
|
604
|
+
* - "bm25-only": embeddings are explicitly disabled (env var or
|
|
605
|
+
* config.yaml); ran BM25 by design. Not a fault, no remediation needed.
|
|
606
|
+
*/
|
|
607
|
+
mode: 'hybrid' | 'hybrid-degraded' | 'bm25-only';
|
|
608
|
+
embedderError: string | null;
|
|
609
|
+
}
|
|
610
|
+
|
|
576
611
|
declare const EpisodeSchema: z.ZodObject<{
|
|
577
612
|
id: z.ZodString;
|
|
578
613
|
summary: z.ZodString;
|
|
@@ -663,6 +698,13 @@ declare const PlurConfigSchema: z.ZodObject<{
|
|
|
663
698
|
path?: string | undefined;
|
|
664
699
|
backend?: "yaml" | "sqlite" | undefined;
|
|
665
700
|
}>>>;
|
|
701
|
+
embeddings: z.ZodOptional<z.ZodDefault<z.ZodObject<{
|
|
702
|
+
enabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
703
|
+
}, "strip", z.ZodTypeAny, {
|
|
704
|
+
enabled?: boolean | undefined;
|
|
705
|
+
}, {
|
|
706
|
+
enabled?: boolean | undefined;
|
|
707
|
+
}>>>;
|
|
666
708
|
stores: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
667
709
|
path: z.ZodString;
|
|
668
710
|
scope: z.ZodString;
|
|
@@ -732,6 +774,9 @@ declare const PlurConfigSchema: z.ZodObject<{
|
|
|
732
774
|
path?: string | undefined;
|
|
733
775
|
backend?: "yaml" | "sqlite" | undefined;
|
|
734
776
|
} | undefined;
|
|
777
|
+
embeddings?: {
|
|
778
|
+
enabled?: boolean | undefined;
|
|
779
|
+
} | undefined;
|
|
735
780
|
stores?: {
|
|
736
781
|
path: string;
|
|
737
782
|
scope: string;
|
|
@@ -772,6 +817,9 @@ declare const PlurConfigSchema: z.ZodObject<{
|
|
|
772
817
|
path?: string | undefined;
|
|
773
818
|
backend?: "yaml" | "sqlite" | undefined;
|
|
774
819
|
} | undefined;
|
|
820
|
+
embeddings?: {
|
|
821
|
+
enabled?: boolean | undefined;
|
|
822
|
+
} | undefined;
|
|
775
823
|
stores?: {
|
|
776
824
|
path: string;
|
|
777
825
|
scope: string;
|
|
@@ -903,6 +951,8 @@ interface LearnContext {
|
|
|
903
951
|
memory_class?: 'semantic' | 'episodic' | 'procedural' | 'metacognitive';
|
|
904
952
|
/** Current session episode ID for episodic anchoring (SP2 Idea 24). */
|
|
905
953
|
session_episode_id?: string;
|
|
954
|
+
/** Always-load flag — bypass keyword-relevance gate during injection. */
|
|
955
|
+
pinned?: boolean;
|
|
906
956
|
}
|
|
907
957
|
/** Extended context for async learn with LLM dedup. */
|
|
908
958
|
interface LearnAsyncContext extends LearnContext {
|
|
@@ -1846,6 +1896,244 @@ declare function getCachedUpdateCheck(packageName: string): VersionCheckResult |
|
|
|
1846
1896
|
/** Clear cache (for testing). */
|
|
1847
1897
|
declare function clearVersionCache(): void;
|
|
1848
1898
|
|
|
1899
|
+
declare const CAPSULE_MAGIC: Buffer<ArrayBuffer>;
|
|
1900
|
+
declare const CAPSULE_MAGIC_HEX = "50 4c 55 52";
|
|
1901
|
+
declare const FORMAT_VERSION_V1 = 1;
|
|
1902
|
+
declare const SUPPORTED_FORMAT_VERSIONS: readonly [1];
|
|
1903
|
+
declare const CAPSULE_FLAGS: {
|
|
1904
|
+
readonly SIGNED: number;
|
|
1905
|
+
readonly COMPRESSED: number;
|
|
1906
|
+
};
|
|
1907
|
+
declare const CAPSULE_FLAG_RESERVED_MASK = 65532;
|
|
1908
|
+
declare const PREAMBLE_LEN = 12;
|
|
1909
|
+
declare const CAPSULE_SIZE_LIMITS: {
|
|
1910
|
+
readonly SOFT_BYTES: number;
|
|
1911
|
+
readonly HARD_BYTES: number;
|
|
1912
|
+
};
|
|
1913
|
+
declare const ED25519_SIG_LEN = 64;
|
|
1914
|
+
declare const ManifestSummarySchema: z.ZodObject<{
|
|
1915
|
+
name: z.ZodString;
|
|
1916
|
+
version: z.ZodString;
|
|
1917
|
+
creator: z.ZodOptional<z.ZodString>;
|
|
1918
|
+
engram_count: z.ZodNumber;
|
|
1919
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
1920
|
+
license: z.ZodDefault<z.ZodString>;
|
|
1921
|
+
}, "strip", z.ZodTypeAny, {
|
|
1922
|
+
version: string;
|
|
1923
|
+
license: string;
|
|
1924
|
+
name: string;
|
|
1925
|
+
engram_count: number;
|
|
1926
|
+
domain?: string | undefined;
|
|
1927
|
+
creator?: string | undefined;
|
|
1928
|
+
}, {
|
|
1929
|
+
version: string;
|
|
1930
|
+
name: string;
|
|
1931
|
+
engram_count: number;
|
|
1932
|
+
domain?: string | undefined;
|
|
1933
|
+
license?: string | undefined;
|
|
1934
|
+
creator?: string | undefined;
|
|
1935
|
+
}>;
|
|
1936
|
+
type ManifestSummary = z.infer<typeof ManifestSummarySchema>;
|
|
1937
|
+
declare const PayloadDescriptorSchema: z.ZodObject<{
|
|
1938
|
+
compression: z.ZodEnum<["gzip", "none"]>;
|
|
1939
|
+
size_compressed: z.ZodNumber;
|
|
1940
|
+
size_uncompressed: z.ZodNumber;
|
|
1941
|
+
sha256: z.ZodString;
|
|
1942
|
+
}, "strip", z.ZodTypeAny, {
|
|
1943
|
+
sha256: string;
|
|
1944
|
+
compression: "none" | "gzip";
|
|
1945
|
+
size_compressed: number;
|
|
1946
|
+
size_uncompressed: number;
|
|
1947
|
+
}, {
|
|
1948
|
+
sha256: string;
|
|
1949
|
+
compression: "none" | "gzip";
|
|
1950
|
+
size_compressed: number;
|
|
1951
|
+
size_uncompressed: number;
|
|
1952
|
+
}>;
|
|
1953
|
+
type PayloadDescriptor = z.infer<typeof PayloadDescriptorSchema>;
|
|
1954
|
+
declare const ProducerSchema: z.ZodObject<{
|
|
1955
|
+
tool: z.ZodString;
|
|
1956
|
+
version: z.ZodString;
|
|
1957
|
+
agent_id: z.ZodOptional<z.ZodString>;
|
|
1958
|
+
}, "strip", z.ZodTypeAny, {
|
|
1959
|
+
version: string;
|
|
1960
|
+
tool: string;
|
|
1961
|
+
agent_id?: string | undefined;
|
|
1962
|
+
}, {
|
|
1963
|
+
version: string;
|
|
1964
|
+
tool: string;
|
|
1965
|
+
agent_id?: string | undefined;
|
|
1966
|
+
}>;
|
|
1967
|
+
type Producer = z.infer<typeof ProducerSchema>;
|
|
1968
|
+
declare const SignerSchema: z.ZodObject<{
|
|
1969
|
+
algo: z.ZodLiteral<"ed25519">;
|
|
1970
|
+
public_key: z.ZodString;
|
|
1971
|
+
key_id: z.ZodOptional<z.ZodString>;
|
|
1972
|
+
}, "strip", z.ZodTypeAny, {
|
|
1973
|
+
algo: "ed25519";
|
|
1974
|
+
public_key: string;
|
|
1975
|
+
key_id?: string | undefined;
|
|
1976
|
+
}, {
|
|
1977
|
+
algo: "ed25519";
|
|
1978
|
+
public_key: string;
|
|
1979
|
+
key_id?: string | undefined;
|
|
1980
|
+
}>;
|
|
1981
|
+
type Signer = z.infer<typeof SignerSchema>;
|
|
1982
|
+
declare const CapsuleHeaderSchema: z.ZodObject<{
|
|
1983
|
+
schema: z.ZodLiteral<"plur.capsule/1">;
|
|
1984
|
+
product_type: z.ZodEnum<["engram-pack", "skill"]>;
|
|
1985
|
+
manifest_summary: z.ZodObject<{
|
|
1986
|
+
name: z.ZodString;
|
|
1987
|
+
version: z.ZodString;
|
|
1988
|
+
creator: z.ZodOptional<z.ZodString>;
|
|
1989
|
+
engram_count: z.ZodNumber;
|
|
1990
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
1991
|
+
license: z.ZodDefault<z.ZodString>;
|
|
1992
|
+
}, "strip", z.ZodTypeAny, {
|
|
1993
|
+
version: string;
|
|
1994
|
+
license: string;
|
|
1995
|
+
name: string;
|
|
1996
|
+
engram_count: number;
|
|
1997
|
+
domain?: string | undefined;
|
|
1998
|
+
creator?: string | undefined;
|
|
1999
|
+
}, {
|
|
2000
|
+
version: string;
|
|
2001
|
+
name: string;
|
|
2002
|
+
engram_count: number;
|
|
2003
|
+
domain?: string | undefined;
|
|
2004
|
+
license?: string | undefined;
|
|
2005
|
+
creator?: string | undefined;
|
|
2006
|
+
}>;
|
|
2007
|
+
payload: z.ZodObject<{
|
|
2008
|
+
compression: z.ZodEnum<["gzip", "none"]>;
|
|
2009
|
+
size_compressed: z.ZodNumber;
|
|
2010
|
+
size_uncompressed: z.ZodNumber;
|
|
2011
|
+
sha256: z.ZodString;
|
|
2012
|
+
}, "strip", z.ZodTypeAny, {
|
|
2013
|
+
sha256: string;
|
|
2014
|
+
compression: "none" | "gzip";
|
|
2015
|
+
size_compressed: number;
|
|
2016
|
+
size_uncompressed: number;
|
|
2017
|
+
}, {
|
|
2018
|
+
sha256: string;
|
|
2019
|
+
compression: "none" | "gzip";
|
|
2020
|
+
size_compressed: number;
|
|
2021
|
+
size_uncompressed: number;
|
|
2022
|
+
}>;
|
|
2023
|
+
created_at: z.ZodString;
|
|
2024
|
+
producer: z.ZodObject<{
|
|
2025
|
+
tool: z.ZodString;
|
|
2026
|
+
version: z.ZodString;
|
|
2027
|
+
agent_id: z.ZodOptional<z.ZodString>;
|
|
2028
|
+
}, "strip", z.ZodTypeAny, {
|
|
2029
|
+
version: string;
|
|
2030
|
+
tool: string;
|
|
2031
|
+
agent_id?: string | undefined;
|
|
2032
|
+
}, {
|
|
2033
|
+
version: string;
|
|
2034
|
+
tool: string;
|
|
2035
|
+
agent_id?: string | undefined;
|
|
2036
|
+
}>;
|
|
2037
|
+
signer: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
2038
|
+
algo: z.ZodLiteral<"ed25519">;
|
|
2039
|
+
public_key: z.ZodString;
|
|
2040
|
+
key_id: z.ZodOptional<z.ZodString>;
|
|
2041
|
+
}, "strip", z.ZodTypeAny, {
|
|
2042
|
+
algo: "ed25519";
|
|
2043
|
+
public_key: string;
|
|
2044
|
+
key_id?: string | undefined;
|
|
2045
|
+
}, {
|
|
2046
|
+
algo: "ed25519";
|
|
2047
|
+
public_key: string;
|
|
2048
|
+
key_id?: string | undefined;
|
|
2049
|
+
}>>>;
|
|
2050
|
+
}, "strip", z.ZodTypeAny, {
|
|
2051
|
+
schema: "plur.capsule/1";
|
|
2052
|
+
product_type: "engram-pack" | "skill";
|
|
2053
|
+
manifest_summary: {
|
|
2054
|
+
version: string;
|
|
2055
|
+
license: string;
|
|
2056
|
+
name: string;
|
|
2057
|
+
engram_count: number;
|
|
2058
|
+
domain?: string | undefined;
|
|
2059
|
+
creator?: string | undefined;
|
|
2060
|
+
};
|
|
2061
|
+
payload: {
|
|
2062
|
+
sha256: string;
|
|
2063
|
+
compression: "none" | "gzip";
|
|
2064
|
+
size_compressed: number;
|
|
2065
|
+
size_uncompressed: number;
|
|
2066
|
+
};
|
|
2067
|
+
created_at: string;
|
|
2068
|
+
producer: {
|
|
2069
|
+
version: string;
|
|
2070
|
+
tool: string;
|
|
2071
|
+
agent_id?: string | undefined;
|
|
2072
|
+
};
|
|
2073
|
+
signer: {
|
|
2074
|
+
algo: "ed25519";
|
|
2075
|
+
public_key: string;
|
|
2076
|
+
key_id?: string | undefined;
|
|
2077
|
+
} | null;
|
|
2078
|
+
}, {
|
|
2079
|
+
schema: "plur.capsule/1";
|
|
2080
|
+
product_type: "engram-pack" | "skill";
|
|
2081
|
+
manifest_summary: {
|
|
2082
|
+
version: string;
|
|
2083
|
+
name: string;
|
|
2084
|
+
engram_count: number;
|
|
2085
|
+
domain?: string | undefined;
|
|
2086
|
+
license?: string | undefined;
|
|
2087
|
+
creator?: string | undefined;
|
|
2088
|
+
};
|
|
2089
|
+
payload: {
|
|
2090
|
+
sha256: string;
|
|
2091
|
+
compression: "none" | "gzip";
|
|
2092
|
+
size_compressed: number;
|
|
2093
|
+
size_uncompressed: number;
|
|
2094
|
+
};
|
|
2095
|
+
created_at: string;
|
|
2096
|
+
producer: {
|
|
2097
|
+
version: string;
|
|
2098
|
+
tool: string;
|
|
2099
|
+
agent_id?: string | undefined;
|
|
2100
|
+
};
|
|
2101
|
+
signer?: {
|
|
2102
|
+
algo: "ed25519";
|
|
2103
|
+
public_key: string;
|
|
2104
|
+
key_id?: string | undefined;
|
|
2105
|
+
} | null | undefined;
|
|
2106
|
+
}>;
|
|
2107
|
+
type CapsuleHeader = z.infer<typeof CapsuleHeaderSchema>;
|
|
2108
|
+
interface CapsulePreamble {
|
|
2109
|
+
formatVersion: number;
|
|
2110
|
+
flags: number;
|
|
2111
|
+
headerLen: number;
|
|
2112
|
+
}
|
|
2113
|
+
declare function parseCapsulePreamble(buf: Buffer): CapsulePreamble;
|
|
2114
|
+
declare function serializeCapsulePreamble(p: CapsulePreamble): Buffer;
|
|
2115
|
+
declare function hasFlag(flags: number, flag: number): boolean;
|
|
2116
|
+
|
|
2117
|
+
interface WriteCapsuleOptions {
|
|
2118
|
+
payload: Buffer;
|
|
2119
|
+
manifestSummary: ManifestSummary;
|
|
2120
|
+
producer: Producer;
|
|
2121
|
+
productType?: 'engram-pack' | 'skill';
|
|
2122
|
+
compression?: 'gzip' | 'none';
|
|
2123
|
+
sizeUncompressed?: number;
|
|
2124
|
+
createdAt?: string;
|
|
2125
|
+
signer?: Signer | null;
|
|
2126
|
+
signature?: Buffer;
|
|
2127
|
+
}
|
|
2128
|
+
interface ReadCapsuleResult {
|
|
2129
|
+
header: CapsuleHeader;
|
|
2130
|
+
payload: Buffer;
|
|
2131
|
+
signature: Buffer | null;
|
|
2132
|
+
}
|
|
2133
|
+
declare function writeCapsule(opts: WriteCapsuleOptions): Buffer;
|
|
2134
|
+
declare function readCapsule(buf: Buffer): ReadCapsuleResult;
|
|
2135
|
+
declare function verifyCapsuleIntegrity(buf: Buffer): boolean;
|
|
2136
|
+
|
|
1849
2137
|
interface IngestOptions {
|
|
1850
2138
|
source?: string;
|
|
1851
2139
|
extract_only?: boolean;
|
|
@@ -1935,6 +2223,16 @@ declare class Plur {
|
|
|
1935
2223
|
recallSemantic(query: string, options?: Omit<RecallOptions, 'mode' | 'llm'>): Promise<Engram[]>;
|
|
1936
2224
|
/** Hybrid search: BM25 + embeddings merged via Reciprocal Rank Fusion. Async, no API calls. */
|
|
1937
2225
|
recallHybrid(query: string, options?: Omit<RecallOptions, 'mode' | 'llm'>): Promise<Engram[]>;
|
|
2226
|
+
/**
|
|
2227
|
+
* Hybrid search with diagnostic metadata — returns both the engrams and
|
|
2228
|
+
* whether embeddings actually contributed (mode: "hybrid" vs "hybrid-degraded").
|
|
2229
|
+
* Use this when you want to surface degraded-mode warnings to users.
|
|
2230
|
+
*/
|
|
2231
|
+
recallHybridWithMeta(query: string, options?: Omit<RecallOptions, 'mode' | 'llm'>): Promise<HybridSearchResult>;
|
|
2232
|
+
/** Inspect embedder availability without forcing a load. */
|
|
2233
|
+
embedderStatus(): EmbedderStatus;
|
|
2234
|
+
/** Reset cached embedder failure state — next call will retry the model load. */
|
|
2235
|
+
resetEmbedder(): void;
|
|
1938
2236
|
/** Embedding search returning {engram, score}[] with cosine similarity scores. Async, no API calls. */
|
|
1939
2237
|
similaritySearch(query: string, options?: {
|
|
1940
2238
|
limit?: number;
|
|
@@ -1972,6 +2270,13 @@ declare class Plur {
|
|
|
1972
2270
|
};
|
|
1973
2271
|
/** Update an existing engram in the store by ID. Returns true if found and updated. */
|
|
1974
2272
|
updateEngram(updated: Engram): boolean;
|
|
2273
|
+
/**
|
|
2274
|
+
* Toggle the always-load (pinned) flag for an engram.
|
|
2275
|
+
* Returns the updated engram on success, null if not found.
|
|
2276
|
+
*/
|
|
2277
|
+
setPinned(id: string, pinned: boolean): Engram | null;
|
|
2278
|
+
/** List engrams that have pinned: true. */
|
|
2279
|
+
listPinned(): Engram[];
|
|
1975
2280
|
/** Set engram status to 'retired'. Supports primary and store engrams. */
|
|
1976
2281
|
forget(id: string, reason?: string): void;
|
|
1977
2282
|
/** Remove retired engrams from storage. Returns count of removed and remaining. */
|
|
@@ -2069,4 +2374,4 @@ declare class Plur {
|
|
|
2069
2374
|
}>;
|
|
2070
2375
|
}
|
|
2071
2376
|
|
|
2072
|
-
export { ALL_MIGRATIONS, type AlignmentResult, type Association, type AutoSearchResult, type BatchDecayOptions, type BatchDecayResult, type BoundedRecallResult, COMMITMENT_MULTIPLIER, CURRENT_SCHEMA_VERSION, type CaptureContext, type DecayTransition, type DedupConfig, type DedupDecision, type DomainCoverage, DomainCoverageSchema, type Engram, type EngramCluster, type EngramStore, type Episode, type EvidenceEntry, EvidenceEntrySchema, type ExtractOptions, type ExtractionResult, type Falsification, FalsificationSchema, type HierarchyPosition, HierarchyPositionSchema, type HistoryEvent, IndexedStorage, type IngestCandidate, type IngestOptions, type InjectOptions, type InjectionLayer, type InjectionResult, type KnowledgeAnchor, type LearnAsyncContext, type LearnAsyncResult, type LearnBatchResult, type LearnContext, type LlmFunction, type LlmTierConfig, type MemberAlignment, type MetaConfidence, MetaConfidenceSchema, type MetaField, MetaFieldSchema, type Migration, type MigrationResult, type ModelTier, PLATITUDE_PATTERNS, type PackManifest, Plur, type PlurConfig, type PlurPaths, type PreviewResult, type PreviousVersionRef, type PrivacyIssue, type PrivacyScanResult, type ProfileCache, type RecallBudget, type RecallOptions, type RegistryEntry, type RelationalAnalysis, type RelationalTriple, type SearchStrategy, SessionBreadcrumbs, type SimilarityResult, SqliteStore, type StatusResult, type StorageBackend, type StorageConfig, type StoreEntry, type StructuralTemplate, StructuralTemplateSchema, type SyncResult, type SyncStatus, type TimelineQuery, type TypedRole, type ValidationResult, type VersionCheckResult, YamlStore, alignCluster, analyzeStructure, appendHistory, applyBatchDecay, assignLayer, asyncAtomicWrite, autoSummary, buildBatchDedupPrompt, buildDedupPrompt, checkForUpdate, classifyPolarity, clearVersionCache, clusterByStructure, computeConfidence, computeContentHash, computeMetaConfidence, confidenceBand, createStore, detectPlurStorage, detectSecrets, engramSearchText, extractMetaEngrams, formatLayer1, formatLayer2, formatLayer3, formatWithLayer, formulateMetaEngram, freshTailBoost, generateEventId, generateGuardrails, generateProfile, generateSummary, getCachedUpdateCheck, getProfileForInjection, getSchemaVersion, isPlatitude, listHistoryMonths, loadProfileCache, markProfileDirty, migrateStore, needsSummary, normalizeStatement, organizeHierarchy, parseDedupResponse, profileNeedsRegeneration, readHistory, readHistoryForEngram, recallAuto, resolveOperationTier, rollbackMigrations, runMigrations, saveProfileCache, selectModel, selectModelForOperation, setSchemaVersion, strengthToStatus, tokenSimilarity, validateMetaEngram, withAsyncLock };
|
|
2377
|
+
export { ALL_MIGRATIONS, type AlignmentResult, type Association, type AutoSearchResult, type BatchDecayOptions, type BatchDecayResult, type BoundedRecallResult, CAPSULE_FLAGS, CAPSULE_FLAG_RESERVED_MASK, CAPSULE_MAGIC, CAPSULE_MAGIC_HEX, CAPSULE_SIZE_LIMITS, COMMITMENT_MULTIPLIER, CURRENT_SCHEMA_VERSION, type CapsuleHeader, CapsuleHeaderSchema, type CapsulePreamble, type CaptureContext, type DecayTransition, type DedupConfig, type DedupDecision, type DomainCoverage, DomainCoverageSchema, ED25519_SIG_LEN, type Engram, type EngramCluster, type EngramStore, type Episode, type EvidenceEntry, EvidenceEntrySchema, type ExtractOptions, type ExtractionResult, FORMAT_VERSION_V1, type Falsification, FalsificationSchema, type HierarchyPosition, HierarchyPositionSchema, type HistoryEvent, IndexedStorage, type IngestCandidate, type IngestOptions, type InjectOptions, type InjectionLayer, type InjectionResult, type KnowledgeAnchor, type LearnAsyncContext, type LearnAsyncResult, type LearnBatchResult, type LearnContext, type LlmFunction, type LlmTierConfig, type ManifestSummary, ManifestSummarySchema, type MemberAlignment, type MetaConfidence, MetaConfidenceSchema, type MetaField, MetaFieldSchema, type Migration, type MigrationResult, type ModelTier, PLATITUDE_PATTERNS, PREAMBLE_LEN, type PackManifest, type PayloadDescriptor, PayloadDescriptorSchema, Plur, type PlurConfig, type PlurPaths, type PreviewResult, type PreviousVersionRef, type PrivacyIssue, type PrivacyScanResult, type Producer, ProducerSchema, type ProfileCache, type ReadCapsuleResult, type RecallBudget, type RecallOptions, type RegistryEntry, type RelationalAnalysis, type RelationalTriple, SUPPORTED_FORMAT_VERSIONS, type SearchStrategy, SessionBreadcrumbs, type Signer, SignerSchema, type SimilarityResult, SqliteStore, type StatusResult, type StorageBackend, type StorageConfig, type StoreEntry, type StructuralTemplate, StructuralTemplateSchema, type SyncResult, type SyncStatus, type TimelineQuery, type TypedRole, type ValidationResult, type VersionCheckResult, type WriteCapsuleOptions, YamlStore, alignCluster, analyzeStructure, appendHistory, applyBatchDecay, assignLayer, asyncAtomicWrite, autoSummary, buildBatchDedupPrompt, buildDedupPrompt, checkForUpdate, classifyPolarity, clearVersionCache, clusterByStructure, computeConfidence, computeContentHash, computeMetaConfidence, confidenceBand, createStore, detectPlurStorage, detectSecrets, engramSearchText, extractMetaEngrams, formatLayer1, formatLayer2, formatLayer3, formatWithLayer, formulateMetaEngram, freshTailBoost, generateEventId, generateGuardrails, generateProfile, generateSummary, getCachedUpdateCheck, getProfileForInjection, getSchemaVersion, hasFlag, isPlatitude, listHistoryMonths, loadProfileCache, markProfileDirty, migrateStore, needsSummary, normalizeStatement, organizeHierarchy, parseCapsulePreamble, parseDedupResponse, profileNeedsRegeneration, readCapsule, readHistory, readHistoryForEngram, recallAuto, resolveOperationTier, rollbackMigrations, runMigrations, saveProfileCache, selectModel, selectModelForOperation, serializeCapsulePreamble, setSchemaVersion, strengthToStatus, tokenSimilarity, validateMetaEngram, verifyCapsuleIntegrity, withAsyncLock, writeCapsule };
|