enigma-memory 0.1.18 → 0.1.22
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 +76 -24
- package/apps/cli/bin/enigma-desktop.mjs +140 -0
- package/apps/cli/bin/enigma-terminal.mjs +78 -0
- package/apps/cli/bin/enigma.mjs +1923 -285
- package/apps/desktop/electron-main.cjs +217 -0
- package/apps/desktop/package.json +12 -0
- package/apps/desktop/src/app.js +264 -7
- package/apps/desktop/src/index.html +3514 -1373
- package/apps/desktop/src/launch-electron.mjs +51 -0
- package/apps/desktop/src/server.mjs +2914 -0
- package/apps/desktop/src/styles.css +2972 -260
- package/apps/desktop/src/zk-browser-prove.mjs +53 -0
- package/apps/desktop/src/zk-state.mjs +1789 -0
- package/apps/gateway/bin/enigma-gateway.mjs +102 -5
- package/apps/gateway/src/server.mjs +271 -8
- package/apps/ios/EnigmaCore/Package.swift +12 -0
- package/apps/ios/EnigmaCore/Sources/EnigmaCore/EnigmaAPIClient.swift +227 -0
- package/apps/ios/EnigmaCore/Sources/EnigmaCore/Models.swift +278 -0
- package/apps/ios/EnigmaCore/Sources/EnigmaCore/PKCE.swift +96 -0
- package/apps/ios/EnigmaCore/Sources/EnigmaCore/PrivacyMinimizer.swift +187 -0
- package/apps/ios/EnigmaCore/Sources/EnigmaCore/ToolModels.swift +129 -0
- package/apps/ios/EnigmaCore/Tests/EnigmaCoreTests/EnigmaCoreTests.swift +42 -0
- package/apps/ios/EnigmaIOS/Enigma/AppModel.swift +346 -0
- package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/AccentColor.colorset/Contents.json +12 -0
- package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/AppIcon.appiconset/Contents.json +11 -0
- package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/AppIcon.appiconset/EnigmaAppIcon.png +0 -0
- package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/Contents.json +3 -0
- package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/LaunchBackground.colorset/Contents.json +12 -0
- package/apps/ios/EnigmaIOS/Enigma/ChatView.swift +181 -0
- package/apps/ios/EnigmaIOS/Enigma/CouncilView.swift +78 -0
- package/apps/ios/EnigmaIOS/Enigma/CreateView.swift +152 -0
- package/apps/ios/EnigmaIOS/Enigma/EnigmaApp.swift +52 -0
- package/apps/ios/EnigmaIOS/Enigma/Info.plist +52 -0
- package/apps/ios/EnigmaIOS/Enigma/NaturalLanguagePrivacyTagger.swift +26 -0
- package/apps/ios/EnigmaIOS/Enigma/OAuthClient.swift +321 -0
- package/apps/ios/EnigmaIOS/Enigma/OnboardingView.swift +105 -0
- package/apps/ios/EnigmaIOS/Enigma/PrivateVaultView.swift +275 -0
- package/apps/ios/EnigmaIOS/Enigma/SecureStore.swift +76 -0
- package/apps/ios/EnigmaIOS/Enigma/SettingsView.swift +60 -0
- package/apps/ios/EnigmaIOS/Enigma/Theme.swift +80 -0
- package/apps/ios/EnigmaIOS/EnigmaIOS.xcodeproj/project.pbxproj +211 -0
- package/apps/ios/EnigmaIOS/EnigmaIOS.xcodeproj/xcshareddata/xcschemes/Enigma.xcscheme +23 -0
- package/apps/native-host/README.md +19 -8
- package/apps/native-host/bin/enigma-native-host.mjs +229 -13
- package/apps/relay/bin/enigma-relay.mjs +103 -5
- package/apps/relay/src/federation-runtime.mjs +618 -0
- package/apps/relay/src/server.mjs +310 -9
- package/apps/verifier/bin/enigma-verify.mjs +327 -11
- package/cortex-v3/circuits/build/intent_vk_bytes.json +35 -0
- package/cortex-v3/circuits/build/sale_vk_bytes.json +35 -0
- package/cortex-v3/circuits/build/vk_bytes.json +32 -0
- package/cortex-v3/proving-assets.json +64 -0
- package/cortex-v3/zk/BUILD-CONTRACT.md +87 -0
- package/cortex-v3/zk/action-transition-vk.json +119 -0
- package/cortex-v3/zk/alias-adversarial.test.mjs +220 -0
- package/cortex-v3/zk/groth16-verify-child.mjs +17 -0
- package/cortex-v3/zk/intent-witness.mjs +365 -0
- package/cortex-v3/zk/intent-witness.test.mjs +485 -0
- package/cortex-v3/zk/proving-assets.mjs +203 -0
- package/cortex-v3/zk/sale-witness.mjs +783 -0
- package/cortex-v3/zk/sale-witness.test.mjs +784 -0
- package/cortex-v3/zk/sealed-sale-release-vk.json +119 -0
- package/cortex-v3/zk/settlement-evidence.mjs +722 -0
- package/cortex-v3/zk/setup-intent.mjs +688 -0
- package/cortex-v3/zk/setup-sale.mjs +666 -0
- package/cortex-v3/zk/setup.mjs +594 -0
- package/cortex-v3/zk/witness.mjs +184 -0
- package/cortex-v3/zk/zk-codec.mjs +232 -0
- package/cortex-v3/zk/zk-codec.test.mjs +293 -0
- package/cortex-v3/zk/zk-settle.mjs +370 -0
- package/cortex-v3/zk/zk-tree.mjs +256 -0
- package/cortex-v3/zk/zk-tree.test.mjs +419 -0
- package/deploy/docker-compose.local-production-simulation.yml +36 -0
- package/docs/browser-extension-install.md +8 -6
- package/docs/client-connectors.md +15 -11
- package/docs/developer-ecosystem.md +15 -13
- package/docs/enigma-memory-ready-conformance.md +11 -9
- package/docs/install-anywhere.md +61 -28
- package/docs/installers-and-desktop.md +8 -7
- package/docs/novelty-invention-candidates.md +161 -161
- package/docs/proof-network-claim-boundaries.md +320 -318
- package/examples/01-quickstart-agent/index.mjs +49 -0
- package/examples/01_agent_memory_quickstart.mjs +57 -0
- package/examples/02-multi-agent-swarm/index.mjs +57 -0
- package/examples/02_cross_model_passport.mjs +64 -0
- package/examples/03-langchain-memory/index.mjs +41 -0
- package/examples/03_poseidon_commitment_verification.mjs +71 -0
- package/examples/04-python-trading-agent/trader.py +49 -0
- package/examples/README.md +27 -0
- package/examples/ci/github-actions.yml +7 -2
- package/package.json +142 -11
- package/packages/adapters/PACKAGE_CONTRACT.md +1 -1
- package/packages/connectors/src/index.js +196 -4
- package/packages/connectors/swarm-router.mjs +168 -0
- package/packages/core/src/index.js +248 -1
- package/packages/core/src/version.mjs +7 -0
- package/packages/dev-tools/package.json +19 -0
- package/packages/dev-tools/src/index.js +4 -0
- package/packages/dev-tools/src/memory-benchmark-suite.js +112 -0
- package/packages/dev-tools/src/swarm-simulator.js +101 -0
- package/packages/dev-tools/src/vault-inspector.js +114 -0
- package/packages/dev-tools/src/vector-benchmark.js +100 -0
- package/packages/developer-platform/src/access-credentials.js +341 -0
- package/packages/developer-platform/src/http.js +132 -0
- package/packages/developer-platform/src/index.js +4 -0
- package/packages/developer-platform/src/usage-http.js +60 -0
- package/packages/developer-platform/src/usage.js +295 -0
- package/packages/enclave-runtime/attestation.mjs +159 -0
- package/packages/enclave-runtime/index.mjs +47 -0
- package/packages/enclave-runtime/session-manager.mjs +253 -0
- package/packages/enclave-runtime/zeroization-proof.mjs +227 -0
- package/packages/enigma-reflex/package.json +14 -0
- package/packages/enigma-reflex/src/index.js +204 -0
- package/packages/enigma-reflex/training/generate-dataset.mjs +40 -0
- package/packages/enigma-reflex/training/requirements.txt +8 -0
- package/packages/enigma-reflex/training/train.py +314 -0
- package/packages/enigma-weave/LICENSE +22 -0
- package/packages/enigma-weave/UPSTREAM.json +21 -0
- package/packages/enigma-weave/package.json +14 -0
- package/packages/enigma-weave/src/index.js +286 -0
- package/packages/hosted-cloud/src/index.js +80 -5
- package/packages/importers/src/index.js +432 -0
- package/packages/inference-runtime/src/browser.js +401 -0
- package/packages/inference-runtime/src/chat.js +265 -0
- package/packages/inference-runtime/src/code.js +407 -0
- package/packages/inference-runtime/src/contracts.js +162 -0
- package/packages/inference-runtime/src/http.js +232 -0
- package/packages/inference-runtime/src/image.js +186 -0
- package/packages/inference-runtime/src/index.js +10 -0
- package/packages/inference-runtime/src/model-router.js +320 -0
- package/packages/inference-runtime/src/platform.js +125 -0
- package/packages/inference-runtime/src/privacy.js +400 -0
- package/packages/inference-runtime/src/video.js +253 -0
- package/packages/mcp-server/README.md +22 -6
- package/packages/mcp-server/bin/enigma-mcp.mjs +2 -1
- package/packages/mcp-server/src/index.js +1418 -105
- package/packages/mcp-server/src/oauth.js +561 -0
- package/packages/mcp-server/src/private-handoff.js +84 -0
- package/packages/mcp-server/src/remote-http.js +273 -0
- package/packages/mcp-server/src/remote-policy.js +72 -0
- package/packages/mcp-server/swarm-bridge.mjs +361 -0
- package/packages/mesh/index.d.ts +283 -0
- package/packages/mesh/package.json +23 -0
- package/packages/mesh/src/crypto.js +189 -0
- package/packages/mesh/src/federation-packets.js +353 -0
- package/packages/mesh/src/gossip.js +311 -0
- package/packages/mesh/src/index.js +6 -0
- package/packages/mesh/src/protocol.js +255 -0
- package/packages/mesh/src/router.js +279 -0
- package/packages/mesh/src/transport.js +306 -0
- package/packages/passport/src/index.js +426 -1
- package/packages/private-economy/src/credits-http.js +100 -0
- package/packages/private-economy/src/credits.js +447 -0
- package/packages/private-economy/src/index.js +5 -0
- package/packages/private-economy/src/payments-http.js +120 -0
- package/packages/private-economy/src/payments.js +509 -0
- package/packages/private-economy/src/x402.js +346 -0
- package/packages/proof-network/PACKAGE_CONTRACT.md +21 -0
- package/packages/rag/index.d.ts +182 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/THIRD_PARTY_LICENSES.txt +207 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/config.json +25 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/onnx/model_quantized.onnx +0 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/sha256-manifest.json +28 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/tokenizer.json +30686 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/tokenizer_config.json +15 -0
- package/packages/rag/package.json +27 -0
- package/packages/rag/src/blinded-search.js +109 -0
- package/packages/rag/src/bm25.js +169 -0
- package/packages/rag/src/embeddings.js +459 -0
- package/packages/rag/src/hybrid.js +76 -0
- package/packages/rag/src/index.js +38 -0
- package/packages/rag/src/reranker.js +61 -0
- package/packages/rag/src/research.js +107 -0
- package/packages/rag/src/vector-store.js +430 -0
- package/packages/rag/src/verify-model-artifacts.mjs +4 -0
- package/packages/sdk/index.d.ts +760 -0
- package/packages/sdk/package.json +33 -0
- package/packages/sdk/python/README.md +24 -0
- package/packages/sdk/python/enigma_sdk.py +250 -0
- package/packages/sdk/python/pyproject.toml +34 -0
- package/packages/sdk/python/requirements.txt +1 -0
- package/packages/sdk/python/setup.py +20 -0
- package/packages/sdk/src/federation/capability-grant.js +389 -0
- package/packages/sdk/src/federation/federation-router.js +360 -0
- package/packages/sdk/src/federation/ghostmesh-bridge.js +497 -0
- package/packages/sdk/src/federation/index.js +3 -0
- package/packages/sdk/src/index.js +1796 -0
- package/packages/sdk/src/intelligence/contradiction.js +337 -0
- package/packages/sdk/src/intelligence/decision-engine.js +155 -0
- package/packages/sdk/src/intelligence/index.js +4 -0
- package/packages/sdk/src/intelligence/ontology.js +122 -0
- package/packages/sdk/src/intelligence/temporal.js +123 -0
- package/packages/sdk/src/market-client.js +142 -0
- package/packages/sdk/src/mesh-client.js +110 -0
- package/packages/sdk/src/middleware/index.js +3 -0
- package/packages/sdk/src/middleware/langchain.js +159 -0
- package/packages/sdk/src/middleware/llamaindex.js +101 -0
- package/packages/sdk/src/middleware/vercel-ai.js +112 -0
- package/packages/sdk/src/rag-client.js +85 -0
- package/packages/sdk/src/swarm-orchestrator.js +260 -0
- package/packages/settlement/PACKAGE_CONTRACT.md +1 -1
- package/packages/snapcompact/THIRD_PARTY_LICENSES.txt +40 -0
- package/packages/snapcompact/assets/8x13-latin1.bdf +3837 -0
- package/packages/snapcompact/index.d.ts +284 -0
- package/packages/snapcompact/package.json +25 -0
- package/packages/snapcompact/src/index.js +716 -0
- package/packages/storage/PACKAGE_CONTRACT.md +1 -1
- package/packages/terminal-console/animations.mjs +240 -0
- package/packages/terminal-console/auto-anchor.mjs +220 -0
- package/packages/terminal-console/banner.mjs +91 -0
- package/packages/terminal-console/commands.mjs +459 -0
- package/packages/terminal-console/delegation.mjs +152 -0
- package/packages/terminal-console/index.mjs +5 -0
- package/packages/terminal-console/outbox.mjs +143 -0
- package/packages/terminal-console/phantom-bridge.mjs +637 -0
- package/packages/terminal-console/repl.mjs +136 -0
- package/packages/terminal-console/signer-store.mjs +130 -0
- package/packages/terminal-console/solana-rpc.mjs +214 -0
- package/packages/terminal-console/solana-transport.mjs +189 -0
- package/packages/terminal-tui/dashboard.mjs +214 -0
- package/packages/terminal-tui/index.mjs +28 -0
- package/packages/terminal-tui/merkle-tree-renderer.mjs +268 -0
- package/packages/terminal-tui/telemetry-hud.mjs +137 -0
- package/packages/vault/index.d.ts +449 -0
- package/packages/vault/package.json +27 -0
- package/packages/vault/src/e2ee.mjs +393 -0
- package/packages/vault/src/enclave.js +481 -0
- package/packages/vault/src/erasure.js +207 -0
- package/packages/vault/src/index.js +1018 -155
- package/packages/vault/src/persistence.js +307 -0
- package/packages/vault/src/poseidon.js +354 -0
- package/packages/vault/src/receipt.js +459 -0
- package/scripts/benchmark-optical-context.mjs +166 -0
- package/scripts/bootstrap-enigma.mjs +502 -0
- package/scripts/build-edge-backend-workers.mjs +20 -5
- package/scripts/build-goal-completion-audit.mjs +72 -25
- package/scripts/build-hosted-api-key-lifecycle.mjs +26 -8
- package/scripts/build-hosted-customer-lifecycle.mjs +20 -3
- package/scripts/build-hosted-probe-worker.mjs +19 -4
- package/scripts/build-installer-assets.mjs +41 -21
- package/scripts/build-operator-evidence-starter.mjs +59 -1
- package/scripts/build-production-backend-env-kit.mjs +2 -0
- package/scripts/build-production-unblocker.mjs +3 -0
- package/scripts/check.mjs +17 -3
- package/scripts/collect-hosted-backend-live-evidence.mjs +49 -12
- package/scripts/install-enigma-local.mjs +18 -5
- package/scripts/release-audit.mjs +65 -109
- package/scripts/release-provenance.mjs +6 -0
- package/scripts/run-backend-readiness-smoke.mjs +112 -10
- package/scripts/scan-secrets.mjs +1 -0
- package/scripts/simulate-production-env.mjs +7 -2
- package/scripts/validate-hosted-backend-live.mjs +112 -1
- package/specs/antibody-pack-v1.schema.json +95 -0
- package/specs/antigen-envelope-v1.schema.json +81 -0
- package/specs/boundary-manifest-v1.schema.json +35 -35
- package/specs/capsule-v1.schema.json +55 -55
- package/specs/claim-boundary-manifest-v1.schema.json +22 -22
- package/specs/claim-ledger-v1.schema.json +291 -0
- package/specs/context-passport-v1.schema.json +59 -0
- package/specs/deletion-tombstone-v1.schema.json +26 -26
- package/specs/evidence-packet-v1.schema.json +177 -0
- package/specs/hosted-backend-live-evidence-v1.schema.json +72 -3
- package/specs/immune-scan-report-v1.schema.json +112 -0
- package/specs/lifecycle-receipt-log-v1.schema.json +67 -0
- package/specs/memory-atom-v1.schema.json +59 -0
- package/specs/memory-event-v1.schema.json +42 -42
- package/specs/passport-v1.schema.json +50 -50
- package/specs/proof-of-non-use-v1.schema.json +65 -0
- package/specs/quarantine-record-v1.schema.json +126 -0
- package/specs/receipt-v1.schema.json +61 -61
- package/specs/state-checkpoint-v1.schema.json +37 -37
- package/specs/trust-bundle-v1.schema.json +56 -56
- package/specs/trust-card-v1.schema.json +119 -0
- package/docs/proof-network-launch-plan.md +0 -421
- package/packages/metering/PACKAGE_CONTRACT.md +0 -20
- package/scripts/build-ai-orchestration-plan.mjs +0 -248
|
@@ -0,0 +1,760 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { EmbeddingProvider, EncryptedVectorStore } from '../rag/index.js';
|
|
3
|
+
import type {
|
|
4
|
+
ContextCarrierDescriptor,
|
|
5
|
+
CostInputs,
|
|
6
|
+
ProviderImageBlock,
|
|
7
|
+
RenderLimits,
|
|
8
|
+
RepetitionOptions,
|
|
9
|
+
TokenEstimateOverrides,
|
|
10
|
+
TransportEstimates,
|
|
11
|
+
} from '../snapcompact/index.js';
|
|
12
|
+
export * from '../snapcompact/index.js';
|
|
13
|
+
|
|
14
|
+
export interface EnigmaOptions {
|
|
15
|
+
scope?: string;
|
|
16
|
+
agentId?: string;
|
|
17
|
+
vaultKey?: Buffer | string;
|
|
18
|
+
passphrase?: string;
|
|
19
|
+
storagePath?: string;
|
|
20
|
+
apiBase?: string;
|
|
21
|
+
authToken?: string;
|
|
22
|
+
identity?: MeshIdentity;
|
|
23
|
+
autoStartMesh?: boolean;
|
|
24
|
+
ragClient?: EnigmaRagClient;
|
|
25
|
+
meshClient?: EnigmaMeshClient;
|
|
26
|
+
marketClient?: EnigmaMarketClient;
|
|
27
|
+
ownRagClient?: boolean;
|
|
28
|
+
ownMeshClient?: boolean;
|
|
29
|
+
ownMarketClient?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface MeshIdentity {
|
|
33
|
+
publicKey: Buffer;
|
|
34
|
+
secretKey: Buffer;
|
|
35
|
+
encryptionPublicKey: Buffer;
|
|
36
|
+
encryptionSecretKey: Buffer;
|
|
37
|
+
destination: Buffer;
|
|
38
|
+
destinationHex: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface TemporalMetadata {
|
|
42
|
+
validFrom: number;
|
|
43
|
+
validUntil: number | null;
|
|
44
|
+
observedAt: number;
|
|
45
|
+
isPermanent: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface MemoryAtom {
|
|
49
|
+
id: string;
|
|
50
|
+
scope: string;
|
|
51
|
+
text: string;
|
|
52
|
+
type?: string;
|
|
53
|
+
importance?: number;
|
|
54
|
+
createdAt: number;
|
|
55
|
+
temporal?: TemporalMetadata;
|
|
56
|
+
metadata?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface RememberOptions {
|
|
60
|
+
id?: string;
|
|
61
|
+
scope?: string;
|
|
62
|
+
type?: 'episodic' | 'semantic' | 'procedural' | 'preference' | 'policy' | 'identity' | 'goal' | 'working' | string;
|
|
63
|
+
importance?: number;
|
|
64
|
+
validFrom?: number | string | Date;
|
|
65
|
+
validUntil?: number | string | Date | null;
|
|
66
|
+
observedAt?: number | string | Date;
|
|
67
|
+
ttlMs?: number;
|
|
68
|
+
supersedes?: string[];
|
|
69
|
+
metadata?: Record<string, unknown>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface RecallOptions {
|
|
73
|
+
scope?: string;
|
|
74
|
+
topK?: number;
|
|
75
|
+
threshold?: number;
|
|
76
|
+
type?: string;
|
|
77
|
+
filterSuperseded?: boolean;
|
|
78
|
+
asOfTime?: number | string | Date;
|
|
79
|
+
signal?: AbortSignal;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface RecallResult {
|
|
83
|
+
id: string;
|
|
84
|
+
text: string;
|
|
85
|
+
score: number;
|
|
86
|
+
scope: string;
|
|
87
|
+
type?: string;
|
|
88
|
+
superseded?: boolean;
|
|
89
|
+
createdAt?: number;
|
|
90
|
+
commitment?: string;
|
|
91
|
+
temporal?: TemporalMetadata;
|
|
92
|
+
importance?: number;
|
|
93
|
+
metadata?: Record<string, unknown>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface ContextPackOptions extends RecallOptions {
|
|
97
|
+
maxTokens?: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface ContextPack {
|
|
101
|
+
contextText: string;
|
|
102
|
+
items: RecallResult[];
|
|
103
|
+
totalChars: number;
|
|
104
|
+
estimatedTokens: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface EnigmaStatus {
|
|
108
|
+
agentId: string;
|
|
109
|
+
scope: string;
|
|
110
|
+
memoryCount: number;
|
|
111
|
+
vectorCount: number;
|
|
112
|
+
storagePath: string | null;
|
|
113
|
+
meshConnected: boolean;
|
|
114
|
+
activeRules: number;
|
|
115
|
+
contradictionsTracked: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface MemoryReceipt {
|
|
119
|
+
schema: string;
|
|
120
|
+
version: number;
|
|
121
|
+
receipt_id: string;
|
|
122
|
+
memory_id: string;
|
|
123
|
+
operation: 'append' | 'update' | 'revoke' | string;
|
|
124
|
+
commitment: string;
|
|
125
|
+
previous_root: string;
|
|
126
|
+
new_root: string;
|
|
127
|
+
leaf_index: number;
|
|
128
|
+
inclusion_proof?: unknown;
|
|
129
|
+
transition_proof?: {
|
|
130
|
+
type: string;
|
|
131
|
+
operation: string;
|
|
132
|
+
prior_size: number;
|
|
133
|
+
new_size: number;
|
|
134
|
+
prior_commitments: string[];
|
|
135
|
+
prior_commitment?: string;
|
|
136
|
+
prior_inclusion_proof?: unknown;
|
|
137
|
+
new_non_membership_proof?: unknown;
|
|
138
|
+
};
|
|
139
|
+
timestamp: string;
|
|
140
|
+
agent_pubkey: string;
|
|
141
|
+
signature: string;
|
|
142
|
+
metadata?: Record<string, unknown>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export declare const AGENT_TURN_RECEIPT_REF_SCHEMA: 'enigma.agent_turn_receipt_ref.v1';
|
|
146
|
+
|
|
147
|
+
export interface AgentTurnReceiptRef {
|
|
148
|
+
schema: typeof AGENT_TURN_RECEIPT_REF_SCHEMA;
|
|
149
|
+
receiptId: string;
|
|
150
|
+
memoryId: string;
|
|
151
|
+
operation: string;
|
|
152
|
+
commitment: string;
|
|
153
|
+
previousRoot: string;
|
|
154
|
+
newRoot: string;
|
|
155
|
+
agentPubkey: string;
|
|
156
|
+
receiptDigest: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export type AgentContextCarrierMode = 'text' | 'bitmap-png' | 'auto';
|
|
160
|
+
|
|
161
|
+
export interface AgentContextCarrierOptions {
|
|
162
|
+
mode?: AgentContextCarrierMode;
|
|
163
|
+
provider?: string;
|
|
164
|
+
model?: string;
|
|
165
|
+
vision?: boolean;
|
|
166
|
+
costs?: CostInputs;
|
|
167
|
+
costAssumptions?: CostInputs;
|
|
168
|
+
expectedReuse?: number;
|
|
169
|
+
tokenEstimates?: TokenEstimateOverrides;
|
|
170
|
+
limits?: RenderLimits;
|
|
171
|
+
renderLimits?: RenderLimits;
|
|
172
|
+
tabWidth?: number;
|
|
173
|
+
collapseRepeatedLines?: boolean;
|
|
174
|
+
repetition?: RepetitionOptions;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface AgentContextCarrierDecision {
|
|
178
|
+
readonly requested: AgentContextCarrierMode;
|
|
179
|
+
readonly selected: 'text' | 'bitmap-png';
|
|
180
|
+
readonly eligible: boolean;
|
|
181
|
+
readonly reason: string;
|
|
182
|
+
readonly profile: string | null;
|
|
183
|
+
readonly preparationStatus: 'prepared' | 'text-fallback';
|
|
184
|
+
readonly deliveryConfirmed: false;
|
|
185
|
+
readonly expectedReuse?: number;
|
|
186
|
+
readonly frameCount?: number;
|
|
187
|
+
readonly estimates?: Readonly<TransportEstimates>;
|
|
188
|
+
}
|
|
189
|
+
export interface AgentContextCarrierPublicDescriptor {
|
|
190
|
+
readonly codec: ContextCarrierDescriptor['codec'];
|
|
191
|
+
readonly version: string;
|
|
192
|
+
readonly profile: string | null;
|
|
193
|
+
readonly commitment: Readonly<{
|
|
194
|
+
scheme: 'sha256-blinded-v1';
|
|
195
|
+
value: string;
|
|
196
|
+
}>;
|
|
197
|
+
readonly dimensions: ContextCarrierDescriptor['dimensions'];
|
|
198
|
+
readonly bytes: number;
|
|
199
|
+
readonly counts: ContextCarrierDescriptor['counts'];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
export interface AgentContextCarrierInvocation {
|
|
204
|
+
selected: 'text' | 'bitmap-png';
|
|
205
|
+
textFallback: string;
|
|
206
|
+
blocks: Array<Readonly<ProviderImageBlock>>;
|
|
207
|
+
readonly descriptor: Readonly<ContextCarrierDescriptor>;
|
|
208
|
+
readonly decision: Readonly<AgentContextCarrierDecision>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface AgentContextCarrierDisclosure {
|
|
212
|
+
readonly descriptor: Readonly<AgentContextCarrierPublicDescriptor>;
|
|
213
|
+
readonly decision: Readonly<AgentContextCarrierDecision>;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface AgentTurnInvocation {
|
|
217
|
+
prompt: string;
|
|
218
|
+
context: string;
|
|
219
|
+
contextPack: ContextPack;
|
|
220
|
+
metadata: Record<string, unknown>;
|
|
221
|
+
contextCarrier?: AgentContextCarrierInvocation;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface RunAgentTurnOptions<TResult = unknown> {
|
|
225
|
+
prompt: string;
|
|
226
|
+
invoke: (input: AgentTurnInvocation) => TResult | Promise<TResult>;
|
|
227
|
+
metadata?: Record<string, unknown>;
|
|
228
|
+
retrieval?: ContextPackOptions;
|
|
229
|
+
rememberResponse?: boolean;
|
|
230
|
+
contextCarrier?: AgentContextCarrierOptions;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface RunAgentTurnResult<TResult = unknown> {
|
|
234
|
+
context: ContextPack;
|
|
235
|
+
result: TResult;
|
|
236
|
+
memory: MemoryAtom | null;
|
|
237
|
+
receipts: {
|
|
238
|
+
refs: AgentTurnReceiptRef[];
|
|
239
|
+
memory: MemoryReceipt | null;
|
|
240
|
+
};
|
|
241
|
+
contextCarrier?: AgentContextCarrierDisclosure;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface UpdateMemoryOptions {
|
|
245
|
+
type?: RememberOptions['type'];
|
|
246
|
+
importance?: number;
|
|
247
|
+
validFrom?: number | string | Date;
|
|
248
|
+
validUntil?: number | string | Date | null;
|
|
249
|
+
observedAt?: number | string | Date;
|
|
250
|
+
ttlMs?: number;
|
|
251
|
+
metadata?: Record<string, unknown>;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface UpdatedMemoryAtom extends MemoryAtom {
|
|
255
|
+
updatedAt: number;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface UpdateMemoryResult {
|
|
259
|
+
memory: UpdatedMemoryAtom;
|
|
260
|
+
receipt: MemoryReceipt;
|
|
261
|
+
receiptRef: AgentTurnReceiptRef;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export interface CreateMemoryReceiptResult {
|
|
265
|
+
receipt: MemoryReceipt;
|
|
266
|
+
opening: {
|
|
267
|
+
blindingFactor: string;
|
|
268
|
+
contentHash: string;
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface ReceiptVerificationResult {
|
|
273
|
+
ok: boolean;
|
|
274
|
+
verified: boolean;
|
|
275
|
+
receipt_id: string;
|
|
276
|
+
memory_id: string;
|
|
277
|
+
operation?: string;
|
|
278
|
+
commitment: string;
|
|
279
|
+
previous_root?: string;
|
|
280
|
+
new_root?: string;
|
|
281
|
+
signatureValid: boolean;
|
|
282
|
+
inclusionValid: boolean;
|
|
283
|
+
transitionValid: boolean;
|
|
284
|
+
openingValid?: boolean;
|
|
285
|
+
errors: string[];
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export declare const MEMORY_RECEIPT_SCHEMA: string;
|
|
289
|
+
|
|
290
|
+
export interface ErasureReceipt {
|
|
291
|
+
schema: string;
|
|
292
|
+
version: number;
|
|
293
|
+
erasure_id: string;
|
|
294
|
+
agent_id: string;
|
|
295
|
+
scope: string;
|
|
296
|
+
erased_memory_count: number;
|
|
297
|
+
pre_erasure_root: string;
|
|
298
|
+
erasure_digest: string;
|
|
299
|
+
storage_wiped?: boolean;
|
|
300
|
+
timestamp: string;
|
|
301
|
+
agent_pubkey: string;
|
|
302
|
+
signature: string;
|
|
303
|
+
metadata?: Record<string, unknown>;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export type ErasureAttestation = ErasureReceipt;
|
|
307
|
+
|
|
308
|
+
export interface ErasureVerificationResult {
|
|
309
|
+
ok: boolean;
|
|
310
|
+
verified: boolean;
|
|
311
|
+
erasure_id: string;
|
|
312
|
+
agent_id: string;
|
|
313
|
+
signatureValid: boolean;
|
|
314
|
+
digestValid?: boolean;
|
|
315
|
+
errors: string[];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export declare const ERASURE_RECEIPT_SCHEMA: string;
|
|
319
|
+
export declare const ERASURE_ATTESTATION_SCHEMA: string;
|
|
320
|
+
export interface BlindedMemoryGrant {
|
|
321
|
+
schema: string;
|
|
322
|
+
version: number;
|
|
323
|
+
grant_id: string;
|
|
324
|
+
granter_agent_id: string;
|
|
325
|
+
granter_pubkey: string;
|
|
326
|
+
grantee_pubkey: string;
|
|
327
|
+
scope: string;
|
|
328
|
+
allowed_types: string[];
|
|
329
|
+
max_access_count: number;
|
|
330
|
+
valid_until: string;
|
|
331
|
+
issued_at: string;
|
|
332
|
+
signature: string;
|
|
333
|
+
metadata?: Record<string, unknown>;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export interface GrantVerificationResult {
|
|
337
|
+
ok: boolean;
|
|
338
|
+
valid: boolean;
|
|
339
|
+
grant_id: string;
|
|
340
|
+
granter_agent_id: string;
|
|
341
|
+
signatureValid: boolean;
|
|
342
|
+
expired: boolean;
|
|
343
|
+
errors: string[];
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export declare const BLINDED_GRANT_SCHEMA: string;
|
|
347
|
+
|
|
348
|
+
export interface FederatedQueryRequest {
|
|
349
|
+
schema: string;
|
|
350
|
+
version: number;
|
|
351
|
+
grant: BlindedMemoryGrant;
|
|
352
|
+
grant_id: string;
|
|
353
|
+
query: string;
|
|
354
|
+
requester_pubkey: string;
|
|
355
|
+
nonce: string;
|
|
356
|
+
timestamp: string;
|
|
357
|
+
signature: string;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface FederatedQueryVerificationResult {
|
|
361
|
+
ok: boolean;
|
|
362
|
+
valid: boolean;
|
|
363
|
+
signatureValid: boolean;
|
|
364
|
+
errors: string[];
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export declare const FEDERATED_QUERY_REQUEST_SCHEMA: string;
|
|
368
|
+
|
|
369
|
+
export declare function computeHidingCommitment(
|
|
370
|
+
plaintext: string,
|
|
371
|
+
blindingFactor?: Buffer | string | null
|
|
372
|
+
): { commitment: string; blindingFactor: string; contentHash: string };
|
|
373
|
+
|
|
374
|
+
export declare function verifyCommitmentOpening(
|
|
375
|
+
plaintext: string,
|
|
376
|
+
blindingFactorHex: string,
|
|
377
|
+
expectedCommitmentHex: string
|
|
378
|
+
): boolean;
|
|
379
|
+
|
|
380
|
+
export declare function createErasureReceipt(params: {
|
|
381
|
+
agentId: string;
|
|
382
|
+
scope: string;
|
|
383
|
+
erasedMemoryCount: number;
|
|
384
|
+
preErasureRoot: string;
|
|
385
|
+
activeCommitments?: string[];
|
|
386
|
+
signingSecretKey: Buffer | string;
|
|
387
|
+
signingPublicKey: Buffer | string;
|
|
388
|
+
metadata?: Record<string, unknown>;
|
|
389
|
+
}): ErasureReceipt;
|
|
390
|
+
export declare function createErasureAttestation(params: {
|
|
391
|
+
agentId: string;
|
|
392
|
+
scope: string;
|
|
393
|
+
erasedMemoryCount: number;
|
|
394
|
+
preErasureRoot: string;
|
|
395
|
+
activeCommitments?: string[];
|
|
396
|
+
storageWiped?: boolean;
|
|
397
|
+
signingSecretKey: Buffer | string;
|
|
398
|
+
signingPublicKey: Buffer | string;
|
|
399
|
+
metadata?: Record<string, unknown>;
|
|
400
|
+
}): ErasureReceipt;
|
|
401
|
+
|
|
402
|
+
export declare function verifyErasureReceipt(
|
|
403
|
+
receipt: ErasureReceipt,
|
|
404
|
+
options?: { expectedAgentPubkey?: string; expectedCommitments?: string[] }
|
|
405
|
+
): ErasureVerificationResult;
|
|
406
|
+
|
|
407
|
+
export declare function verifyErasureAttestation(
|
|
408
|
+
receipt: ErasureReceipt,
|
|
409
|
+
options?: { expectedAgentPubkey?: string; expectedCommitments?: string[] }
|
|
410
|
+
): ErasureVerificationResult;
|
|
411
|
+
export declare function createBlindedMemoryGrant(params: {
|
|
412
|
+
granterAgentId: string;
|
|
413
|
+
granterSecretKey: Buffer | string;
|
|
414
|
+
granterPublicKey: Buffer | string;
|
|
415
|
+
granteePublicKey: Buffer | string;
|
|
416
|
+
scope?: string;
|
|
417
|
+
allowedTypes?: string[];
|
|
418
|
+
maxAccessCount?: number;
|
|
419
|
+
validUntil?: number | string | Date;
|
|
420
|
+
metadata?: Record<string, unknown>;
|
|
421
|
+
}): BlindedMemoryGrant;
|
|
422
|
+
|
|
423
|
+
export declare function verifyBlindedMemoryGrant(
|
|
424
|
+
grant: BlindedMemoryGrant,
|
|
425
|
+
options?: { expectedGranteePubkey?: string; asOfTime?: number }
|
|
426
|
+
): GrantVerificationResult;
|
|
427
|
+
|
|
428
|
+
export declare function createFederatedQueryRequest(params: {
|
|
429
|
+
grant: BlindedMemoryGrant;
|
|
430
|
+
query: string;
|
|
431
|
+
requesterSecretKey: Buffer | string;
|
|
432
|
+
requesterPublicKey?: Buffer | string;
|
|
433
|
+
nonce?: string;
|
|
434
|
+
timestamp?: string;
|
|
435
|
+
}): FederatedQueryRequest;
|
|
436
|
+
|
|
437
|
+
export declare function verifyFederatedQueryRequest(
|
|
438
|
+
request: FederatedQueryRequest,
|
|
439
|
+
options?: { maxClockSkewMs?: number }
|
|
440
|
+
): FederatedQueryVerificationResult;
|
|
441
|
+
|
|
442
|
+
export interface EncryptedVaultBundle {
|
|
443
|
+
format: string;
|
|
444
|
+
version: number;
|
|
445
|
+
kdf?: {
|
|
446
|
+
algorithm: string;
|
|
447
|
+
hash: string;
|
|
448
|
+
salt: string;
|
|
449
|
+
};
|
|
450
|
+
ciphertext: string;
|
|
451
|
+
iv: string;
|
|
452
|
+
authTag: string;
|
|
453
|
+
count: number;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export declare class Enigma {
|
|
457
|
+
scope: string;
|
|
458
|
+
agentId: string;
|
|
459
|
+
storagePath: string | null;
|
|
460
|
+
passphrase: string | null;
|
|
461
|
+
vaultKey: Buffer;
|
|
462
|
+
rag: EnigmaRagClient;
|
|
463
|
+
mesh: EnigmaMeshClient;
|
|
464
|
+
market: EnigmaMarketClient;
|
|
465
|
+
contradictionGraph: unknown;
|
|
466
|
+
decisionEngine: unknown;
|
|
467
|
+
federation: EnigmaFederationRouter;
|
|
468
|
+
|
|
469
|
+
constructor(options?: EnigmaOptions);
|
|
470
|
+
|
|
471
|
+
static connect(options?: EnigmaOptions): Promise<Enigma>;
|
|
472
|
+
dispose(): Promise<void>;
|
|
473
|
+
|
|
474
|
+
static verifyReceipt(
|
|
475
|
+
receipt: MemoryReceipt,
|
|
476
|
+
options?: { expectedAgentPubkey?: string; plaintext?: string; blindingFactor?: string }
|
|
477
|
+
): ReceiptVerificationResult;
|
|
478
|
+
|
|
479
|
+
static verifyErasure(
|
|
480
|
+
receipt: ErasureReceipt,
|
|
481
|
+
options?: { expectedAgentPubkey?: string; expectedCommitments?: string[] }
|
|
482
|
+
): ErasureVerificationResult;
|
|
483
|
+
|
|
484
|
+
static verifyAttestation(
|
|
485
|
+
receipt: ErasureReceipt,
|
|
486
|
+
options?: { expectedAgentPubkey?: string; expectedCommitments?: string[] }
|
|
487
|
+
): ErasureVerificationResult;
|
|
488
|
+
|
|
489
|
+
static verifyCapability(
|
|
490
|
+
grant: BlindedMemoryGrant,
|
|
491
|
+
options?: { expectedGranteePubkey?: string; asOfTime?: number }
|
|
492
|
+
): GrantVerificationResult;
|
|
493
|
+
createReceipt(
|
|
494
|
+
memoryId: string,
|
|
495
|
+
options?: {
|
|
496
|
+
operation?: 'append' | 'update' | 'revoke' | string;
|
|
497
|
+
blindingFactor?: Buffer | string | null;
|
|
498
|
+
priorCommitment?: string;
|
|
499
|
+
metadata?: Record<string, unknown>;
|
|
500
|
+
}
|
|
501
|
+
): Promise<MemoryReceipt>;
|
|
502
|
+
|
|
503
|
+
remember(text: string, options?: RememberOptions): Promise<{ id: string; scope: string; text: string; type: string; temporal: TemporalMetadata; createdAt: number }>;
|
|
504
|
+
|
|
505
|
+
updateMemory(id: string, text: string, options?: UpdateMemoryOptions): Promise<UpdateMemoryResult>;
|
|
506
|
+
|
|
507
|
+
runAgentTurn<TResult = unknown>(input: RunAgentTurnOptions<TResult>): Promise<RunAgentTurnResult<TResult>>;
|
|
508
|
+
|
|
509
|
+
recall(query: string, options?: RecallOptions): Promise<RecallResult[]>;
|
|
510
|
+
|
|
511
|
+
evaluateObservation(text: string, metadata?: Record<string, unknown>): { shouldRemember: boolean; novelty: number; importance: number; type: string; conflicts: Array<unknown>; reason: string };
|
|
512
|
+
|
|
513
|
+
consolidate(): Array<unknown>;
|
|
514
|
+
|
|
515
|
+
getContextPack(query: string, options?: ContextPackOptions): Promise<ContextPack>;
|
|
516
|
+
|
|
517
|
+
forget(id: string): Promise<boolean>;
|
|
518
|
+
|
|
519
|
+
grantCapability(
|
|
520
|
+
granteePublicKey: Buffer | string,
|
|
521
|
+
options?: {
|
|
522
|
+
allowedTypes?: string[];
|
|
523
|
+
maxAccessCount?: number;
|
|
524
|
+
validUntil?: number | string | Date;
|
|
525
|
+
scope?: string;
|
|
526
|
+
metadata?: Record<string, unknown>;
|
|
527
|
+
}
|
|
528
|
+
): BlindedMemoryGrant;
|
|
529
|
+
resetSession(options?: { wipeStorage?: boolean; metadata?: Record<string, unknown> }): Promise<ErasureReceipt>;
|
|
530
|
+
|
|
531
|
+
zeroizeSession(options?: { wipeStorage?: boolean; metadata?: Record<string, unknown> }): Promise<ErasureReceipt>;
|
|
532
|
+
|
|
533
|
+
save(targetPath?: string): Promise<void>;
|
|
534
|
+
|
|
535
|
+
load(sourcePath?: string): Promise<void>;
|
|
536
|
+
|
|
537
|
+
status(): EnigmaStatus;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
export declare class EnigmaFederationRouter {
|
|
541
|
+
enigma: Enigma;
|
|
542
|
+
activeGrants: Map<string, { grant: BlindedMemoryGrant; usedCount: number }>;
|
|
543
|
+
seenNonces: Map<string, number>;
|
|
544
|
+
constructor(options: { enigma: Enigma });
|
|
545
|
+
registerGrant(grant: BlindedMemoryGrant): { ok: boolean; grant_id: string };
|
|
546
|
+
revokeGrant(grantId: string): boolean;
|
|
547
|
+
queryFederatedCluster(
|
|
548
|
+
grantOrRequest: BlindedMemoryGrant | FederatedQueryRequest,
|
|
549
|
+
query?: string,
|
|
550
|
+
options?: {
|
|
551
|
+
requesterSecretKey?: Buffer | string;
|
|
552
|
+
requesterPublicKey?: Buffer | string;
|
|
553
|
+
requesterAgent?: Enigma;
|
|
554
|
+
authorization?: { requester_pubkey: string; nonce: string; timestamp: string; signature: string };
|
|
555
|
+
topK?: number;
|
|
556
|
+
}
|
|
557
|
+
): Promise<{ ok: boolean; grant_id: string; scope: string; items: RecallResult[]; remainingAccess: number }>;
|
|
558
|
+
}
|
|
559
|
+
export declare class EnigmaRagClient {
|
|
560
|
+
store: EncryptedVectorStore;
|
|
561
|
+
constructor(options?: {
|
|
562
|
+
vectorStore?: EncryptedVectorStore;
|
|
563
|
+
embeddingProvider?: EmbeddingProvider;
|
|
564
|
+
embeddingModel?: 'neural' | 'lexical';
|
|
565
|
+
});
|
|
566
|
+
index(
|
|
567
|
+
id: string,
|
|
568
|
+
text: string,
|
|
569
|
+
metadata?: Record<string, unknown>,
|
|
570
|
+
options?: { epoch?: number; signal?: AbortSignal }
|
|
571
|
+
): Promise<{ id: string; scope: string } | null>;
|
|
572
|
+
updateMetadata(id: string, metadata: Record<string, unknown>): boolean;
|
|
573
|
+
search(query: string, options?: RecallOptions): Promise<RecallResult[]>;
|
|
574
|
+
compileContext(query: string, options?: ContextPackOptions): Promise<ContextPack>;
|
|
575
|
+
encryptAtRest(vaultKey: Buffer | string): EncryptedVaultBundle;
|
|
576
|
+
dispose(): Promise<void>;
|
|
577
|
+
static fromEncryptedBundle(
|
|
578
|
+
bundle: EncryptedVaultBundle,
|
|
579
|
+
vaultKey: Buffer | string,
|
|
580
|
+
options?: { embeddingProvider?: EmbeddingProvider }
|
|
581
|
+
): EnigmaRagClient;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
export declare class EnigmaMeshClient {
|
|
585
|
+
node: unknown;
|
|
586
|
+
scope: string;
|
|
587
|
+
nodeId: string;
|
|
588
|
+
identity: MeshIdentity | null;
|
|
589
|
+
constructor(options?: { scope?: string; nodeId?: string; identity?: MeshIdentity });
|
|
590
|
+
start(): Promise<void>;
|
|
591
|
+
stop(): Promise<void>;
|
|
592
|
+
announce(metadata?: Record<string, unknown>): Promise<{ action: string; nodeId: string }>;
|
|
593
|
+
send(destinationHex: string, recipientEncryptionPubKey: string | Uint8Array, message: string): Promise<{ routed: boolean; packetId: string }>;
|
|
594
|
+
onCapsule(handler: (capsule: unknown) => void): void;
|
|
595
|
+
status(): { nodeId: string; scope: string; destinationHex: string; publicKeyHex: string; encryptionPublicKeyHex: string | null; peersCount: number };
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export interface ZkSettlementEvidence {
|
|
599
|
+
schema: 'enigma.zk_settlement_evidence.v1';
|
|
600
|
+
version: 1;
|
|
601
|
+
receipt_ref: string;
|
|
602
|
+
event: 'action.append' | 'action.revoke' | 'sale.list' | 'sale.claim' | 'sale.open';
|
|
603
|
+
circuit: 'action_transition' | 'sealed_sale_release' | null;
|
|
604
|
+
constraint_count: 90897 | 87422 | null;
|
|
605
|
+
program_id: string;
|
|
606
|
+
cluster: string;
|
|
607
|
+
transaction: { signature: string; explorer_url: string | null } | null;
|
|
608
|
+
proof: {
|
|
609
|
+
algorithm: 'groth16-bn254';
|
|
610
|
+
encoding: 'enigma.groth16_raw_be.c1c0.v1';
|
|
611
|
+
a: string;
|
|
612
|
+
b: string;
|
|
613
|
+
c: string;
|
|
614
|
+
digest: string;
|
|
615
|
+
public_inputs: string[];
|
|
616
|
+
circuit_artifact: { r1cs_sha256: string };
|
|
617
|
+
verification_key: { sha256: string };
|
|
618
|
+
} | null;
|
|
619
|
+
state: Record<string, string | number | boolean | null>;
|
|
620
|
+
predecessor_refs: string[];
|
|
621
|
+
created_at: string;
|
|
622
|
+
signer: {
|
|
623
|
+
algorithm: 'Ed25519';
|
|
624
|
+
public_key: string;
|
|
625
|
+
key_id: string;
|
|
626
|
+
signer_id: string | null;
|
|
627
|
+
signer_domain: string;
|
|
628
|
+
};
|
|
629
|
+
signature: string;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
export interface PreparedMarketListing extends Record<string, unknown> {
|
|
633
|
+
ok: boolean;
|
|
634
|
+
proofBytes: { a: string; b: string; c: string };
|
|
635
|
+
publicInputs: string[];
|
|
636
|
+
ciphertextChunks: string[];
|
|
637
|
+
saleTermsHashHex: string;
|
|
638
|
+
payloadCommitPosHex: string;
|
|
639
|
+
keyCommitHex: string;
|
|
640
|
+
envelopeCommitHex: string;
|
|
641
|
+
receiptPda: string;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
export interface SubmittedMarketListing extends Record<string, unknown> {
|
|
645
|
+
ok: boolean;
|
|
646
|
+
sig: string;
|
|
647
|
+
signature: string;
|
|
648
|
+
txSignature: string;
|
|
649
|
+
receiptPda: string;
|
|
650
|
+
receiptRef: string;
|
|
651
|
+
settlementReceipt: ZkSettlementEvidence;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
export declare class EnigmaMarketClient {
|
|
655
|
+
apiBase: string;
|
|
656
|
+
authToken: string | null;
|
|
657
|
+
constructor(options?: { apiBase?: string; authToken?: string });
|
|
658
|
+
getStatus(): Promise<Record<string, unknown>>;
|
|
659
|
+
getBuyerIdentity(): Promise<Record<string, unknown>>;
|
|
660
|
+
prepareListing(options: Record<string, unknown>): Promise<PreparedMarketListing>;
|
|
661
|
+
submitListing(prepared: {
|
|
662
|
+
proofBytes: { a: string; b: string; c: string };
|
|
663
|
+
publicInputs: string[];
|
|
664
|
+
predecessorReceiptRefs?: string[];
|
|
665
|
+
}): Promise<SubmittedMarketListing>;
|
|
666
|
+
createListing(options: Record<string, unknown> & { predecessorReceiptRefs?: string[] }): Promise<{
|
|
667
|
+
ok: true;
|
|
668
|
+
listing: PreparedMarketListing & Pick<SubmittedMarketListing, 'receiptPda' | 'receiptRef' | 'settlementReceipt'>;
|
|
669
|
+
submission: SubmittedMarketListing;
|
|
670
|
+
}>;
|
|
671
|
+
verifyListing(options: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
672
|
+
fundEscrow(options: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
673
|
+
claim(options: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
674
|
+
open(options: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
export interface SwarmAgentEntry {
|
|
678
|
+
agentId: string;
|
|
679
|
+
role: string;
|
|
680
|
+
scope: string;
|
|
681
|
+
permissions: string[];
|
|
682
|
+
memoryCount: number;
|
|
683
|
+
vectorCount: number;
|
|
684
|
+
destinationHex: string;
|
|
685
|
+
inboxCount: number;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
export interface SwarmTopology {
|
|
689
|
+
swarmId: string;
|
|
690
|
+
agentCount: number;
|
|
691
|
+
roster: SwarmAgentEntry[];
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
export declare class EnigmaSwarmOrchestrator {
|
|
695
|
+
swarmId: string;
|
|
696
|
+
passphrase: string | null;
|
|
697
|
+
storageDir: string | null;
|
|
698
|
+
bus: unknown;
|
|
699
|
+
agents: Map<string, unknown>;
|
|
700
|
+
enigmaFactory: (options: EnigmaOptions) => Promise<Enigma>;
|
|
701
|
+
|
|
702
|
+
constructor(options?: {
|
|
703
|
+
swarmId?: string;
|
|
704
|
+
passphrase?: string;
|
|
705
|
+
storageDir?: string;
|
|
706
|
+
bus?: unknown;
|
|
707
|
+
enigmaFactory?: (options: EnigmaOptions) => Promise<Enigma>;
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
registerAgent(agentId: string, options?: { role?: string; permissions?: string[]; scope?: string }): Promise<Enigma>;
|
|
711
|
+
getAgent(agentId: string): Enigma | undefined;
|
|
712
|
+
unregisterAgent(agentId: string): Promise<boolean>;
|
|
713
|
+
syncGlobalRule(ruleText: string, metadata?: Record<string, unknown>): Promise<{ ruleId: string; syncedCount: number }>;
|
|
714
|
+
dispatchSignal(senderAgentId: string, targetAgentId: string, message: string): Promise<{ delivered: boolean; packetId: string; receivedPlaintext?: string }>;
|
|
715
|
+
getTopology(): SwarmTopology;
|
|
716
|
+
shutdown(): Promise<void>;
|
|
717
|
+
on(event: string, listener: (...args: unknown[]) => void): this;
|
|
718
|
+
emit(event: string, ...args: unknown[]): boolean;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
export declare class EnigmaLangChainMemory {
|
|
722
|
+
enigma: Enigma;
|
|
723
|
+
memoryKey: string;
|
|
724
|
+
inputKey: string;
|
|
725
|
+
outputKey: string;
|
|
726
|
+
maxTokens: number;
|
|
727
|
+
scope: string;
|
|
728
|
+
selectiveMemory: boolean;
|
|
729
|
+
readonly memoryKeys: string[];
|
|
730
|
+
constructor(options: { enigma: Enigma; memoryKey?: string; inputKey?: string; outputKey?: string; maxTokens?: number; scope?: string; selectiveMemory?: boolean });
|
|
731
|
+
loadMemoryVariables(values?: Record<string, unknown>): Promise<Record<string, string>>;
|
|
732
|
+
saveContext(inputValues: Record<string, unknown>, outputValues: Record<string, unknown>): Promise<void>;
|
|
733
|
+
beforeModel(promptOrMessages: unknown): Promise<{ sovereignContext: string; items: unknown[] }>;
|
|
734
|
+
afterTool(toolName: string, toolInput: unknown, toolOutput: unknown): Promise<void>;
|
|
735
|
+
onCorrection(priorFact: string, updatedFact: string, reason?: string): Promise<unknown>;
|
|
736
|
+
clear(): Promise<number>;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export interface EnigmaContextMiddleware {
|
|
740
|
+
enrichPrompt(params?: { prompt?: string; messages?: Array<{ role: string; content: string }>; system?: string }): Promise<Record<string, unknown>>;
|
|
741
|
+
recordTurn(userPrompt: string, modelCompletion: string, metadata?: Record<string, unknown>): Promise<MemoryAtom | null>;
|
|
742
|
+
onToolExecution(toolName: string, args: unknown, result: unknown): Promise<unknown>;
|
|
743
|
+
onCorrection(priorFact: string, updatedFact: string): Promise<unknown>;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
export declare function createEnigmaContextMiddleware(
|
|
747
|
+
enigma: Enigma,
|
|
748
|
+
options?: { maxTokens?: number; scope?: string; autoRemember?: boolean; selectiveMemory?: boolean }
|
|
749
|
+
): EnigmaContextMiddleware;
|
|
750
|
+
|
|
751
|
+
export declare class EnigmaLlamaIndexRetriever {
|
|
752
|
+
enigma: Enigma;
|
|
753
|
+
similarityTopK: number;
|
|
754
|
+
scope: string;
|
|
755
|
+
constructor(options: { enigma: Enigma; similarityTopK?: number; scope?: string });
|
|
756
|
+
retrieve(query: string): Promise<Array<{ node: { id_: string; text: string; metadata: Record<string, unknown> }; score: number }>>;
|
|
757
|
+
insertNodes(nodes: Array<{ id_?: string; text: string; metadata?: Record<string, unknown> }>): Promise<number>;
|
|
758
|
+
deleteNodes(nodeIds: string[]): Promise<number>;
|
|
759
|
+
onCorrection(priorFact: string, updatedFact: string): Promise<unknown>;
|
|
760
|
+
}
|