entroly-wasm 1.0.77 → 1.0.80
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/data/tuning_defaults.json +5 -5
- package/index.d.ts +8 -0
- package/index.js +90 -1
- package/js/continuity_contracts.d.ts +86 -0
- package/js/continuity_contracts.js +81 -0
- package/js/trust_engine.d.ts +18 -0
- package/js/trust_engine.js +31 -0
- package/js/work_context_snapshot_store.d.ts +43 -0
- package/js/work_context_snapshot_store.js +280 -0
- package/js/work_graph.d.ts +225 -0
- package/js/work_graph.js +191 -0
- package/js/work_graph_content_digest.js +151 -0
- package/js/work_graph_continuity.d.ts +54 -0
- package/js/work_graph_continuity.js +128 -0
- package/js/work_graph_repo.d.ts +26 -0
- package/js/work_graph_repo.js +364 -0
- package/js/work_graph_store.d.ts +85 -0
- package/js/work_graph_store.js +364 -0
- package/package.json +18 -3
- package/pkg/entroly_wasm.d.ts +208 -0
- package/pkg/entroly_wasm.js +1710 -2
- package/pkg/entroly_wasm_bg.wasm +0 -0
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_comment": "Shipped baseline scoring config applied by the engine on startup across pip / MCP / npm. Runtime self-improvement (PRISM online + task-profile feedback journal) adapts from here per session. Maintainers regenerate these values with `entroly autotune` and commit them so the improvement reaches all installed users on the next release. (Distinct from the gitignored, locally-mutated bench/tuning_config.json.)",
|
|
3
3
|
"weights": {
|
|
4
|
-
"recency": 0.
|
|
4
|
+
"recency": 0.3,
|
|
5
5
|
"frequency": 0.25,
|
|
6
6
|
"semantic_sim": 0.25,
|
|
7
|
-
"entropy": 0.
|
|
7
|
+
"entropy": 0.2
|
|
8
8
|
},
|
|
9
9
|
"decay": {
|
|
10
10
|
"half_life_turns": 15,
|
|
11
11
|
"min_relevance_threshold": 0.05
|
|
12
12
|
},
|
|
13
13
|
"knapsack": {
|
|
14
|
-
"exploration_rate": 0.
|
|
14
|
+
"exploration_rate": 0.0
|
|
15
15
|
},
|
|
16
16
|
"dedup": {
|
|
17
17
|
"hamming_threshold": 3
|
|
18
18
|
},
|
|
19
19
|
"ios": {
|
|
20
|
-
"skeleton_info_factor": 0.
|
|
20
|
+
"skeleton_info_factor": 0.7,
|
|
21
21
|
"reference_info_factor": 0.15,
|
|
22
|
-
"diversity_floor": 0.
|
|
22
|
+
"diversity_floor": 0.1
|
|
23
23
|
}
|
|
24
24
|
}
|
package/index.d.ts
CHANGED
|
@@ -121,3 +121,11 @@ export function createContextReceipt(
|
|
|
121
121
|
|
|
122
122
|
export function renderContextReceipt(receipt: Record<string, unknown>): string;
|
|
123
123
|
export function explainReceiptOmission(receipt: Record<string, unknown>, chunkId: string): string;
|
|
124
|
+
|
|
125
|
+
export * from "./js/trust_engine";
|
|
126
|
+
export * from "./js/work_graph";
|
|
127
|
+
export * from "./js/work_graph_repo";
|
|
128
|
+
export * from "./js/work_graph_store";
|
|
129
|
+
export * from "./js/work_context_snapshot_store";
|
|
130
|
+
export * from "./js/work_graph_continuity";
|
|
131
|
+
export * from "./js/continuity_contracts";
|
package/index.js
CHANGED
|
@@ -11,13 +11,19 @@
|
|
|
11
11
|
// npx entroly-wasm serve
|
|
12
12
|
|
|
13
13
|
let WasmEntrolyEngine;
|
|
14
|
+
let WasmWorkGraph;
|
|
15
|
+
let WasmTrustEngine;
|
|
14
16
|
let classifyQueryTransitionRust;
|
|
15
17
|
let rewardWeightedOptimizeRust;
|
|
16
18
|
let optimizeTaskProfilesRust;
|
|
17
19
|
let classifyLearningQueryRust;
|
|
20
|
+
let wasmExports = {};
|
|
18
21
|
function bindWasmExports(mod) {
|
|
22
|
+
wasmExports = mod;
|
|
19
23
|
({
|
|
20
24
|
WasmEntrolyEngine,
|
|
25
|
+
WasmWorkGraph,
|
|
26
|
+
WasmTrustEngine,
|
|
21
27
|
classify_query_transition: classifyQueryTransitionRust,
|
|
22
28
|
reward_weighted_optimize: rewardWeightedOptimizeRust,
|
|
23
29
|
optimize_task_profiles: optimizeTaskProfilesRust,
|
|
@@ -39,11 +45,24 @@ function buildAndBindWasm() {
|
|
|
39
45
|
try {
|
|
40
46
|
bindWasmExports(require('./pkg/entroly_wasm'));
|
|
41
47
|
if (
|
|
48
|
+
!WasmWorkGraph ||
|
|
49
|
+
!WasmTrustEngine ||
|
|
42
50
|
!classifyQueryTransitionRust ||
|
|
43
51
|
!rewardWeightedOptimizeRust ||
|
|
44
52
|
!optimizeTaskProfilesRust ||
|
|
45
|
-
!classifyLearningQueryRust
|
|
53
|
+
!classifyLearningQueryRust ||
|
|
54
|
+
!wasmExports.contextReceiptBuildJSON ||
|
|
55
|
+
!wasmExports.verifiedContextSnapshotVerifyBytes ||
|
|
56
|
+
!wasmExports.recoveryHandleBuildJSON ||
|
|
57
|
+
!wasmExports.memoryRecordBuildJSON ||
|
|
58
|
+
!wasmExports.routingDecisionBuildJSON ||
|
|
59
|
+
!wasmExports.modelExecutionOutcomeBuildJSON ||
|
|
60
|
+
!wasmExports.verificationRecordBuildJSON ||
|
|
61
|
+
!wasmExports.workContinuationProofBuildJSON
|
|
46
62
|
) {
|
|
63
|
+
// A source checkout can contain an older generated pkg/ directory. Treat
|
|
64
|
+
// a missing Work Graph export exactly like any other stale native surface
|
|
65
|
+
// and rebuild before loading the high-level JS wrapper.
|
|
47
66
|
buildAndBindWasm();
|
|
48
67
|
}
|
|
49
68
|
} catch (err) {
|
|
@@ -65,6 +84,34 @@ const { ValueTracker, EVOLUTION_TAX_RATE, estimateCost } = require('./js/value_t
|
|
|
65
84
|
const { exportPromoted: exportAgentSkills } = require('./js/agentskills_export');
|
|
66
85
|
const { TelegramGateway, DiscordGateway, SlackGateway } = require('./js/gateways');
|
|
67
86
|
const { VaultObserver } = require('./js/vault_observer');
|
|
87
|
+
const { TrustEngine } = require('./js/trust_engine');
|
|
88
|
+
const {
|
|
89
|
+
WorkGraph,
|
|
90
|
+
RepositoryDiscoveryError,
|
|
91
|
+
discoverRepositoryIdentity,
|
|
92
|
+
discoverRepositoryObservation,
|
|
93
|
+
} = require('./js/work_graph');
|
|
94
|
+
const {
|
|
95
|
+
WorkGraphLockTimeout,
|
|
96
|
+
WorkGraphStateError,
|
|
97
|
+
WorkGraphStore,
|
|
98
|
+
WorkGraphStoreError,
|
|
99
|
+
} = require('./js/work_graph_store');
|
|
100
|
+
const {
|
|
101
|
+
CONTEXT_SNAPSHOT_TOKEN_PREFIX,
|
|
102
|
+
DEFAULT_MAX_CONTEXT_BYTES,
|
|
103
|
+
DEFAULT_MAX_SNAPSHOTS,
|
|
104
|
+
DEFAULT_MAX_TOTAL_BYTES,
|
|
105
|
+
WorkContextSnapshotError,
|
|
106
|
+
WorkContextSnapshotStore,
|
|
107
|
+
verifyCanonicalSnapshotBytes,
|
|
108
|
+
} = require('./js/work_context_snapshot_store');
|
|
109
|
+
const {
|
|
110
|
+
MAX_RESUME_EVIDENCE,
|
|
111
|
+
handoffRepository,
|
|
112
|
+
handoffRepositoryWithProof,
|
|
113
|
+
resumeRepository,
|
|
114
|
+
} = require('./js/work_graph_continuity');
|
|
68
115
|
const {
|
|
69
116
|
createContextReceipt,
|
|
70
117
|
explainReceiptOmission,
|
|
@@ -72,6 +119,13 @@ const {
|
|
|
72
119
|
renderContextReceipt,
|
|
73
120
|
selectReceiptContext,
|
|
74
121
|
} = require('./js/context_receipts');
|
|
122
|
+
const {
|
|
123
|
+
continuationProofState,
|
|
124
|
+
createModelExecutionOutcome,
|
|
125
|
+
createRoutingDecision,
|
|
126
|
+
createVerificationRecord,
|
|
127
|
+
verificationFreshness,
|
|
128
|
+
} = require('./js/continuity_contracts');
|
|
75
129
|
const {
|
|
76
130
|
createEntrolyMiddleware,
|
|
77
131
|
optimizeAnthropicParams,
|
|
@@ -114,6 +168,10 @@ function classifyLearningQuery(...args) {
|
|
|
114
168
|
}
|
|
115
169
|
|
|
116
170
|
module.exports = {
|
|
171
|
+
// The TypeScript surface re-exports the generated bindings. Mirror that at
|
|
172
|
+
// runtime so package-root imports and `index.d.ts` describe the same API.
|
|
173
|
+
...wasmExports,
|
|
174
|
+
|
|
117
175
|
// Core engine (wasm)
|
|
118
176
|
EntrolyEngine: WasmEntrolyEngine,
|
|
119
177
|
WasmEntrolyEngine,
|
|
@@ -122,6 +180,30 @@ module.exports = {
|
|
|
122
180
|
optimizeTaskProfiles,
|
|
123
181
|
classifyLearningQuery,
|
|
124
182
|
|
|
183
|
+
// Shared Rust evidence-bounded Trust Engine.
|
|
184
|
+
TrustEngine,
|
|
185
|
+
|
|
186
|
+
// Shared Rust AI Work Graph with Node-only repository/persistence glue.
|
|
187
|
+
WorkGraph,
|
|
188
|
+
RepositoryDiscoveryError,
|
|
189
|
+
discoverRepositoryIdentity,
|
|
190
|
+
discoverRepositoryObservation,
|
|
191
|
+
WorkGraphStore,
|
|
192
|
+
WorkGraphStoreError,
|
|
193
|
+
WorkGraphLockTimeout,
|
|
194
|
+
WorkGraphStateError,
|
|
195
|
+
WorkContextSnapshotStore,
|
|
196
|
+
WorkContextSnapshotError,
|
|
197
|
+
verifyCanonicalSnapshotBytes,
|
|
198
|
+
CONTEXT_SNAPSHOT_TOKEN_PREFIX,
|
|
199
|
+
DEFAULT_MAX_CONTEXT_BYTES,
|
|
200
|
+
DEFAULT_MAX_SNAPSHOTS,
|
|
201
|
+
DEFAULT_MAX_TOTAL_BYTES,
|
|
202
|
+
MAX_RESUME_EVIDENCE,
|
|
203
|
+
handoffRepository,
|
|
204
|
+
handoffRepositoryWithProof,
|
|
205
|
+
resumeRepository,
|
|
206
|
+
|
|
125
207
|
// Configuration
|
|
126
208
|
EntrolyConfig,
|
|
127
209
|
|
|
@@ -179,4 +261,11 @@ module.exports = {
|
|
|
179
261
|
createContextReceipt,
|
|
180
262
|
renderContextReceipt,
|
|
181
263
|
explainReceiptOmission,
|
|
264
|
+
|
|
265
|
+
// Canonical evidence-backed execution and continuation contracts.
|
|
266
|
+
continuationProofState,
|
|
267
|
+
createModelExecutionOutcome,
|
|
268
|
+
createRoutingDecision,
|
|
269
|
+
createVerificationRecord,
|
|
270
|
+
verificationFreshness,
|
|
182
271
|
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export interface RoutingDecisionInput {
|
|
2
|
+
repository_id: string;
|
|
3
|
+
task_id: string;
|
|
4
|
+
workstream_id: string;
|
|
5
|
+
provider: string;
|
|
6
|
+
model: string;
|
|
7
|
+
runtime: string;
|
|
8
|
+
context_budget_tokens: number;
|
|
9
|
+
policy_version: string;
|
|
10
|
+
reason_codes?: string[];
|
|
11
|
+
feature_commitments?: string[];
|
|
12
|
+
fallback_route_ids?: string[];
|
|
13
|
+
receipt_id?: string;
|
|
14
|
+
evidence_ids?: string[];
|
|
15
|
+
decided_at_ms: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type RoutingDecision = RoutingDecisionInput & {
|
|
19
|
+
schema_version: number;
|
|
20
|
+
routing_id: string;
|
|
21
|
+
decision_commitment: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export interface ModelExecutionOutcomeInput {
|
|
25
|
+
routing_id: string;
|
|
26
|
+
repository_id: string;
|
|
27
|
+
task_id: string;
|
|
28
|
+
workstream_id: string;
|
|
29
|
+
provider: string;
|
|
30
|
+
model: string;
|
|
31
|
+
runtime: string;
|
|
32
|
+
receipt_id?: string;
|
|
33
|
+
request_commitment?: string;
|
|
34
|
+
response_commitment?: string;
|
|
35
|
+
state: "succeeded" | "failed" | "cancelled" | "unknown";
|
|
36
|
+
verification_state: "passed" | "failed" | "skipped" | "unknown" | "stale";
|
|
37
|
+
latency_ms?: number;
|
|
38
|
+
input_tokens?: number;
|
|
39
|
+
output_tokens?: number;
|
|
40
|
+
cost_micro_usd?: number;
|
|
41
|
+
error_code?: string;
|
|
42
|
+
evidence_ids?: string[];
|
|
43
|
+
completed_at_ms: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type ModelExecutionOutcome = ModelExecutionOutcomeInput & {
|
|
47
|
+
schema_version: number;
|
|
48
|
+
outcome_id: string;
|
|
49
|
+
outcome_commitment: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export interface VerificationRecordInput {
|
|
53
|
+
repository_id: string;
|
|
54
|
+
subject_id: string;
|
|
55
|
+
subject_commitment: string;
|
|
56
|
+
verified_repository_commitment: string;
|
|
57
|
+
verdict: "passed" | "failed" | "skipped" | "unknown";
|
|
58
|
+
evidence_ids?: string[];
|
|
59
|
+
dependency_commitments?: string[];
|
|
60
|
+
observed_at_ms: number;
|
|
61
|
+
valid_until_ms?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type VerificationRecord = VerificationRecordInput & {
|
|
65
|
+
schema_version: number;
|
|
66
|
+
verification_id: string;
|
|
67
|
+
record_commitment: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export function createRoutingDecision(input: RoutingDecisionInput): RoutingDecision;
|
|
71
|
+
export function createModelExecutionOutcome(
|
|
72
|
+
input: ModelExecutionOutcomeInput,
|
|
73
|
+
): ModelExecutionOutcome;
|
|
74
|
+
export function createVerificationRecord(input: VerificationRecordInput): VerificationRecord;
|
|
75
|
+
export function verificationFreshness(
|
|
76
|
+
record: VerificationRecord | string,
|
|
77
|
+
currentRepositoryCommitment: string,
|
|
78
|
+
nowMs: number,
|
|
79
|
+
invalidatedCommitments?: string[],
|
|
80
|
+
): "current" | "stale" | "invalidated" | "unknown";
|
|
81
|
+
export function continuationProofState(
|
|
82
|
+
proof: Record<string, unknown> | string,
|
|
83
|
+
repositoryId: string,
|
|
84
|
+
graphRevision: number,
|
|
85
|
+
graphCommitment: string,
|
|
86
|
+
): "valid" | "stale" | "invalid";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Ergonomic Node facade over the canonical Rust continuity contracts. This
|
|
4
|
+
// module performs transport conversion and JavaScript safe-integer checks only;
|
|
5
|
+
// identity, commitments, cross-field validation and freshness remain in Rust.
|
|
6
|
+
|
|
7
|
+
function native() {
|
|
8
|
+
return require('../pkg/entroly_wasm');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function asObject(value) {
|
|
12
|
+
return typeof value === 'string' ? JSON.parse(value) : value;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function checkedInput(input, integerFields) {
|
|
16
|
+
const value = { ...(input || {}) };
|
|
17
|
+
for (const field of integerFields) {
|
|
18
|
+
if (value[field] == null) continue;
|
|
19
|
+
const number = Number(value[field]);
|
|
20
|
+
if (!Number.isSafeInteger(number) || number < 0) {
|
|
21
|
+
throw new TypeError(`${field} must be a JavaScript-safe integer >= 0`);
|
|
22
|
+
}
|
|
23
|
+
value[field] = number;
|
|
24
|
+
}
|
|
25
|
+
return JSON.stringify(value);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function createRoutingDecision(input) {
|
|
29
|
+
return JSON.parse(native().routingDecisionBuildJSON(checkedInput(input, [
|
|
30
|
+
'context_budget_tokens', 'decided_at_ms',
|
|
31
|
+
])));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function createModelExecutionOutcome(input) {
|
|
35
|
+
return JSON.parse(native().modelExecutionOutcomeBuildJSON(checkedInput(input, [
|
|
36
|
+
'latency_ms', 'input_tokens', 'output_tokens', 'cost_micro_usd', 'completed_at_ms',
|
|
37
|
+
])));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function createVerificationRecord(input) {
|
|
41
|
+
return JSON.parse(native().verificationRecordBuildJSON(checkedInput(input, [
|
|
42
|
+
'observed_at_ms', 'valid_until_ms',
|
|
43
|
+
])));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function verificationFreshness(
|
|
47
|
+
record,
|
|
48
|
+
currentRepositoryCommitment,
|
|
49
|
+
nowMs,
|
|
50
|
+
invalidatedCommitments = [],
|
|
51
|
+
) {
|
|
52
|
+
if (!Number.isSafeInteger(nowMs) || nowMs < 0) {
|
|
53
|
+
throw new TypeError('nowMs must be a JavaScript-safe integer >= 0');
|
|
54
|
+
}
|
|
55
|
+
return native().verificationRecordFreshness(
|
|
56
|
+
JSON.stringify(asObject(record)),
|
|
57
|
+
String(currentRepositoryCommitment),
|
|
58
|
+
nowMs,
|
|
59
|
+
JSON.stringify(invalidatedCommitments),
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function continuationProofState(proof, repositoryId, graphRevision, graphCommitment) {
|
|
64
|
+
if (!Number.isSafeInteger(graphRevision) || graphRevision < 0) {
|
|
65
|
+
throw new TypeError('graphRevision must be a JavaScript-safe integer >= 0');
|
|
66
|
+
}
|
|
67
|
+
return native().workContinuationProofState(
|
|
68
|
+
JSON.stringify(asObject(proof)),
|
|
69
|
+
String(repositoryId),
|
|
70
|
+
graphRevision,
|
|
71
|
+
String(graphCommitment),
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = {
|
|
76
|
+
continuationProofState,
|
|
77
|
+
createModelExecutionOutcome,
|
|
78
|
+
createRoutingDecision,
|
|
79
|
+
createVerificationRecord,
|
|
80
|
+
verificationFreshness,
|
|
81
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type EvidenceSupportStatus = "supported" | "unsupported" | "unknown";
|
|
2
|
+
|
|
3
|
+
export interface ClaimEvidenceAssessment {
|
|
4
|
+
status: EvidenceSupportStatus;
|
|
5
|
+
support_density: number;
|
|
6
|
+
unsupported_fraction: number;
|
|
7
|
+
contradiction_fraction: number;
|
|
8
|
+
evidence_commitment: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type FileCriticality = "normal" | "important" | "critical" | "safety";
|
|
12
|
+
|
|
13
|
+
export class TrustEngine {
|
|
14
|
+
constructor(profile?: "rag" | "qa" | "summarization" | "dialogue" | "fact_check" | "default" | string);
|
|
15
|
+
assessClaim(evidence: string, claim: string): ClaimEvidenceAssessment;
|
|
16
|
+
fileCriticality(path: string): FileCriticality;
|
|
17
|
+
hasSafetySignal(content: string): boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Thin Node transport over the shared Rust/WASM Trust Engine. All profile,
|
|
4
|
+
// scoring, commitment, and guardrail semantics stay in entroly-engine.
|
|
5
|
+
function wasmTrustEngine() {
|
|
6
|
+
const { WasmTrustEngine } = require('../pkg/entroly_wasm');
|
|
7
|
+
if (!WasmTrustEngine) {
|
|
8
|
+
throw new Error('Rust Trust Engine is unavailable; rebuild entroly-wasm');
|
|
9
|
+
}
|
|
10
|
+
return WasmTrustEngine;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
class TrustEngine {
|
|
14
|
+
constructor(profile = 'rag') {
|
|
15
|
+
this._inner = new (wasmTrustEngine())(String(profile));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
assessClaim(evidence, claim) {
|
|
19
|
+
return JSON.parse(this._inner.assessClaimJSON(String(evidence), String(claim)));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
fileCriticality(path) {
|
|
23
|
+
return this._inner.fileCriticality(String(path));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
hasSafetySignal(content) {
|
|
27
|
+
return Boolean(this._inner.hasSafetySignal(String(content)));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = { TrustEngine };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { WorkGraphStore } from "./work_graph_store";
|
|
2
|
+
|
|
3
|
+
export interface WorkContextSnapshotStoreOptions {
|
|
4
|
+
maxContextBytes?: number;
|
|
5
|
+
maxSnapshots?: number;
|
|
6
|
+
maxTotalBytes?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface VerifiedContextSnapshotBytes {
|
|
10
|
+
payload: Record<string, unknown>;
|
|
11
|
+
commitment: string;
|
|
12
|
+
bytes: Uint8Array;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class WorkContextSnapshotError extends Error {}
|
|
16
|
+
|
|
17
|
+
export function verifyCanonicalSnapshotBytes(
|
|
18
|
+
value: Uint8Array | string,
|
|
19
|
+
expectedCommitment?: string | null,
|
|
20
|
+
maxBytes?: number,
|
|
21
|
+
): VerifiedContextSnapshotBytes;
|
|
22
|
+
|
|
23
|
+
export class WorkContextSnapshotStore {
|
|
24
|
+
constructor(graphStore: WorkGraphStore, options?: WorkContextSnapshotStoreOptions);
|
|
25
|
+
|
|
26
|
+
readonly graphStore: WorkGraphStore;
|
|
27
|
+
readonly maxContextBytes: number;
|
|
28
|
+
readonly maxSnapshots: number;
|
|
29
|
+
readonly maxTotalBytes: number;
|
|
30
|
+
readonly contextDir: string;
|
|
31
|
+
|
|
32
|
+
static tokenForCommitment(commitment: string): string;
|
|
33
|
+
static digestFromToken(token: string): string;
|
|
34
|
+
|
|
35
|
+
putCanonicalBytes(value: Uint8Array | string, expectedCommitment: string): string;
|
|
36
|
+
getCanonicalBytes(token: string): Uint8Array;
|
|
37
|
+
getJSON(token: string): Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const CONTEXT_SNAPSHOT_TOKEN_PREFIX: "wctx1.";
|
|
41
|
+
export const DEFAULT_MAX_CONTEXT_BYTES: number;
|
|
42
|
+
export const DEFAULT_MAX_SNAPSHOTS: number;
|
|
43
|
+
export const DEFAULT_MAX_TOTAL_BYTES: number;
|