@nextera.one/axis-server-sdk 2.2.1 → 2.2.3

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.
Files changed (49) hide show
  1. package/dist/axis-sensor-GBEI3Fab.d.mts +209 -0
  2. package/dist/axis-sensor-GBEI3Fab.d.ts +209 -0
  3. package/dist/cce/index.d.mts +162 -0
  4. package/dist/cce/index.d.ts +162 -0
  5. package/dist/cce/index.js +1502 -0
  6. package/dist/cce/index.js.map +1 -0
  7. package/dist/cce/index.mjs +1442 -0
  8. package/dist/cce/index.mjs.map +1 -0
  9. package/dist/cce-pipeline-B-zUBHo3.d.mts +294 -0
  10. package/dist/cce-pipeline-DbGBSsCG.d.ts +294 -0
  11. package/dist/idel/index.d.mts +24 -0
  12. package/dist/idel/index.d.ts +24 -0
  13. package/dist/idel/index.js +306 -0
  14. package/dist/idel/index.js.map +1 -0
  15. package/dist/idel/index.mjs +279 -0
  16. package/dist/idel/index.mjs.map +1 -0
  17. package/dist/idel.types-DuUAcOnQ.d.mts +83 -0
  18. package/dist/idel.types-DuUAcOnQ.d.ts +83 -0
  19. package/dist/index-B2G6cbRL.d.mts +824 -0
  20. package/dist/index-DbSxdR0f.d.ts +824 -0
  21. package/dist/index-_S4fmVUJ.d.mts +501 -0
  22. package/dist/index-l3Hhirqb.d.ts +501 -0
  23. package/dist/index.d.mts +77 -1894
  24. package/dist/index.d.ts +77 -1894
  25. package/dist/index.js +10087 -5970
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +10302 -5897
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/needle/index.d.mts +4 -0
  30. package/dist/needle/index.d.ts +4 -0
  31. package/dist/needle/index.js +3499 -0
  32. package/dist/needle/index.js.map +1 -0
  33. package/dist/needle/index.mjs +3528 -0
  34. package/dist/needle/index.mjs.map +1 -0
  35. package/dist/sensors/index.d.mts +5 -0
  36. package/dist/sensors/index.d.ts +5 -0
  37. package/dist/sensors/index.js +12767 -0
  38. package/dist/sensors/index.js.map +1 -0
  39. package/dist/sensors/index.mjs +12835 -0
  40. package/dist/sensors/index.mjs.map +1 -0
  41. package/dist/timeline/index.d.mts +54 -0
  42. package/dist/timeline/index.d.ts +54 -0
  43. package/dist/timeline/index.js +389 -0
  44. package/dist/timeline/index.js.map +1 -0
  45. package/dist/timeline/index.mjs +362 -0
  46. package/dist/timeline/index.mjs.map +1 -0
  47. package/dist/timeline.types-Cn0aqbUj.d.mts +125 -0
  48. package/dist/timeline.types-Cn0aqbUj.d.ts +125 -0
  49. package/package.json +28 -10
package/dist/index.d.ts CHANGED
@@ -1,355 +1,45 @@
1
- import * as z from 'zod';
2
- import { AxisFrame as AxisFrame$1 } from '@nextera.one/axis-protocol';
3
- export { AXIS_MAGIC, AXIS_VERSION, AxisBinaryFrame, AxisFrame, TLV as AxisTlvType, BodyProfile, ERR_BAD_SIGNATURE, ERR_CONTRACT_VIOLATION, ERR_INVALID_PACKET, ERR_REPLAY_DETECTED, FLAG_BODY_TLV, FLAG_CHAIN_REQ, FLAG_HAS_WITNESS, MAX_BODY_LEN, MAX_FRAME_LEN, MAX_HDR_LEN, MAX_SIG_LEN, NCERT_ALG, NCERT_EXP, NCERT_ISSUER_KID, NCERT_KID, NCERT_NBF, NCERT_NODE_ID, NCERT_PAYLOAD, NCERT_PUB, NCERT_SCOPE, NCERT_SIG, PROOF_CAPSULE, PROOF_JWT, PROOF_LOOM, PROOF_MTLS, PROOF_NONE, PROOF_WITNESS, ProofType, TLV, TLV_ACTOR_ID, TLV_AUD, TLV_BODY_ARR, TLV_BODY_OBJ, TLV_CAPSULE, TLV_EFFECT, TLV_ERROR_CODE, TLV_ERROR_MSG, TLV_INDEX, TLV_INTENT, TLV_KID, TLV_LOOM_PRESENCE_ID, TLV_LOOM_THREAD_HASH, TLV_LOOM_WRIT, TLV_NODE, TLV_NODE_CERT_HASH, TLV_NODE_KID, TLV_NONCE, TLV_OFFSET, TLV_OK, TLV_PID, TLV_LOOM_PRESENCE_ID as TLV_PRESENCE_ID, TLV_PREV_HASH, TLV_PROOF_REF, TLV_PROOF_TYPE, TLV_REALM, TLV_RECEIPT_HASH, TLV_RID, TLV_SHA256_CHUNK, TLV_LOOM_THREAD_HASH as TLV_THREAD_HASH, TLV_TRACE_ID, TLV_TS, TLV_UPLOAD_ID, TLV_LOOM_WRIT as TLV_WRIT, decodeArray, decodeFrame, decodeObject, decodeTLVs, decodeTLVsList, decodeVarint, encodeFrame, encodeTLVs, encodeVarint, getSignTarget, varintLength } from '@nextera.one/axis-protocol';
4
- import { ModuleRef, DiscoveryService, Reflector, MetadataScanner } from '@nestjs/core';
5
- import { ConfigService } from '@nestjs/config';
1
+ import { C as ChainOptions, A as AxisIntentSensorRef, I as IntentTlvField, T as TlvValidatorFn, a as IntentRouter, O as ObserverDispatcherService, b as AxisChainEnvelope, c as AxisChainResult, d as AxisCapsuleRef, e as AxisChainStep, f as AxisContext, S as SensorRegistry } from './index-DbSxdR0f.js';
2
+ export { g as AXIS_ANONYMOUS_KEY, h as AXIS_META_KEY, i as AXIS_PUBLIC_KEY, j as AXIS_RATE_LIMIT_KEY, k as AccessProfileResolverSensor, l as Axis, m as AxisAnonymous, n as AxisChainEncryption, o as AxisChainRequest, p as AxisChainStatus, q as AxisChainStepResult, r as AxisChainStepStatus, s as AxisEffect, t as AxisExecutionMode, u as AxisIntentEnvelope, v as AxisIntentObserver, w as AxisIntentSensorOptions, x as AxisKeyExchangeRef, y as AxisLawArticleSummary, z as AxisLawDecision, B as AxisLawEvaluationContext, D as AxisLawEvaluationResult, E as AxisLawEvaluator, F as AxisObserverBinding, G as AxisObserverBindingOptions, H as AxisObserverContext, J as AxisObserverDefinition, K as AxisObserverEvent, L as AxisObserverRef, M as AxisObserverRegistration, N as AxisPublic, P as AxisRateLimit, Q as AxisRateLimitConfig, R as BodyBudgetSensor, U as CAPSULE_POLICY_METADATA_KEY, V as CONTRACT_METADATA_KEY, W as CapabilityEnforcementSensor, X as Capsule, Y as CapsulePolicy, Z as CapsulePolicyOptions, _ as CapsuleScopeMode, $ as ChunkHashSensor, a0 as Contract, a1 as DEFAULT_CONTRACTS, a2 as EntropySensor, a3 as ExecutionContract, a4 as ExecutionTimeoutSensor, a5 as FALLBACK_CONTRACT, a6 as FrameBudgetSensor, a7 as FrameHeaderSanitySensor, a8 as HeaderTLVLimitSensor, a9 as INTENT_METADATA_KEY, aa as INTENT_ROUTES_KEY, ab as Intent, ac as IntentAllowlistSensor, ad as IntentKind, ae as IntentOptions, af as IntentRegistrySensor, ag as IntentRoute, ah as LawEvaluationSensor, ai as LawEvaluationSensorOptions, aj as OBSERVER_BINDINGS_KEY, ak as OBSERVER_METADATA_KEY, al as Observer, am as ObserverRegistry, an as ProofPresenceSensor, ao as ProtocolStrictSensor, ap as REQUIRED_PROOF_METADATA_KEY, aq as ReceiptPolicySensor, ar as RegisteredChainConfig, as as RequiredProof, at as RequiredProofKind, au as RiskDecision, av as RiskEvaluation, aw as RiskGateSensor, ax as RiskGateSensorOptions, ay as RiskSignal, az as RiskSignalCollector, aA as SENSITIVITY_METADATA_KEY, aB as SchemaValidationSensor, aC as Sensitivity, aD as StreamScopeSensor, aE as TLVParseSensor, aF as TLV_FIELDS_KEY, aG as TLV_VALIDATORS_KEY, aH as TickAuthCapsuleRef, aI as TickAuthSensor, aJ as TickAuthSensorOptions, aK as TickAuthVerifier, aL as TlvEnum, aM as TlvField, aN as TlvFieldKind, aO as TlvFieldMeta, aP as TlvFieldOptions, aQ as TlvMinLen, aR as TlvRange, aS as TlvUtf8Pattern, aT as TlvValidate, aU as TlvValidatorMeta, aV as TpsSensor, aW as TpsSensorOptions, aX as VarintHardeningSensor, aY as Witness, aZ as buildAxisLawEvaluationContext } from './index-DbSxdR0f.js';
3
+ import { AxisFrame } from '@nextera.one/axis-protocol';
4
+ export { AXIS_MAGIC, AXIS_VERSION, AxisBinaryFrame, AxisFrame, TLV as AxisTlvType, ERR_BAD_SIGNATURE, ERR_CONTRACT_VIOLATION, ERR_INVALID_PACKET, ERR_REPLAY_DETECTED, FLAG_BODY_TLV, FLAG_CHAIN_REQ, FLAG_HAS_WITNESS, MAX_BODY_LEN, MAX_FRAME_LEN, MAX_HDR_LEN, MAX_SIG_LEN, NCERT_ALG, NCERT_EXP, NCERT_ISSUER_KID, NCERT_KID, NCERT_NBF, NCERT_NODE_ID, NCERT_PAYLOAD, NCERT_PUB, NCERT_SCOPE, NCERT_SIG, PROOF_CAPSULE, PROOF_JWT, PROOF_LOOM, PROOF_MTLS, PROOF_NONE, PROOF_WITNESS, TLV, TLV_ACTOR_ID, TLV_AUD, TLV_BODY_ARR, TLV_BODY_OBJ, TLV_CAPSULE, TLV_EFFECT, TLV_ERROR_CODE, TLV_ERROR_MSG, TLV_INDEX, TLV_INTENT, TLV_KID, TLV_LOOM_PRESENCE_ID, TLV_LOOM_THREAD_HASH, TLV_LOOM_WRIT, TLV_NODE, TLV_NODE_CERT_HASH, TLV_NODE_KID, TLV_NONCE, TLV_OFFSET, TLV_OK, TLV_PID, TLV_LOOM_PRESENCE_ID as TLV_PRESENCE_ID, TLV_PREV_HASH, TLV_PROOF_REF, TLV_PROOF_TYPE, TLV_REALM, TLV_RECEIPT_HASH, TLV_RID, TLV_SHA256_CHUNK, TLV_LOOM_THREAD_HASH as TLV_THREAD_HASH, TLV_TRACE_ID, TLV_TS, TLV_UPLOAD_ID, TLV_LOOM_WRIT as TLV_WRIT, decodeArray, decodeFrame, decodeObject, decodeTLVs, decodeTLVsList, decodeVarint, encodeFrame, encodeTLVs, encodeVarint, getSignTarget, varintLength } from '@nextera.one/axis-protocol';
5
+ import { A as AxisObservation, L as LoomReceipt, T as ThreadState, W as WritValidationResult, G as Grant, a as GrantCapability, P as PresenceDeclaration, b as PresenceChallenge, c as Writ, R as Revocation, d as WritBody, e as WritMeta, f as PresenceReceipt, g as GrantStatus, h as PresenceStatus, i as PresenceProof, j as GrantValidationResult, k as PresenceVerifyResult } from './index-l3Hhirqb.js';
6
+ export { l as Anomaly, m as AnomalyLevel, E as ExpectedOutcome, F as Fabric, n as FabricCell, o as FabricDiff, p as FabricDiffEntry, q as FabricDiffKind, r as FabricEffect, s as FabricEffectResolver, t as FabricQuery, u as GrantMeta, v as GrantType, I as InMemoryPatternStore, K as Knot, w as KnotBreakRequest, x as KnotError, y as KnotStatus, z as KnotType, B as KnotValidationResult, C as LoomValidationResult, N as Needle, D as NeedleError, H as NeedleHandler, J as NeedleHandlerContext, M as NeedleHandlerResult, O as NeedlePhase, Q as NeedlePipelineConfig, S as NeedlePipelineResult, U as ObservationSensor, V as ObservationStage, X as ObservedDeed, Y as Pattern, Z as PatternConfidence, _ as PatternKind, $ as PatternMatch, a0 as PatternPrediction, a1 as PatternSignature, a2 as PatternStore, a3 as RevocationTargetType, a4 as Stitch, a5 as StitchKind, a6 as Thread, a7 as TruthStatus, a8 as TruthVerdict, a9 as WritHead, aa as WritSignature, ab as addStitchToKnot, ac as applyStitch, ad as assembleNeedle, ae as breakKnot, af as canonicalizeGrant, ag as canonicalizeWrit, ah as createFabric, ai as createObservation, aj as deriveAnchorReflection, ak as detectAnomalies, al as detectKnotPatterns, am as detectSequencePatterns, an as diffFabrics, ao as endStage, ap as finalizeObservation, aq as findKnotsForStitch, ar as forkFromKnot, as as formStitch, at as getDecisionPoints, au as getFabricValue, av as getIrreversibleKnots, aw as isKnotOpen, ax as isPointOfNoReturn, ay as lockCells, az as matchPatterns, aA as openKnot, aB as projectAt, aC as queryFabric, aD as recordOccurrence, aE as recordSensor, aF as runNeedlePipeline, aG as scoreTruth, aH as startStage, aI as tieKnot, aJ as validateKnot, aK as verifyObservation, aL as weave } from './index-l3Hhirqb.js';
6
7
  export { AxisError, AxisFrameZ, computeReceiptHash, computeSignaturePayload, generateEd25519KeyPair, sha256, signFrame, verifyFrameSignature } from './core/index.js';
7
8
  export { Axis1FrameToEncode, encodeAxis1Frame } from './codec/axis1.encode.js';
8
9
  export { axis1SigningBytes } from './codec/axis1.signing.js';
10
+ import { S as SensorInput, a as SensorDecision } from './axis-sensor-GBEI3Fab.js';
11
+ export { b as AxisAlg, c as AxisCapsule, d as AxisCapsuleConstraints, e as AxisCapsulePayload, f as AxisJsonAlg, g as AxisJsonFrame, h as AxisJsonResponse, i as AxisJsonSig, j as AxisObservedContext, k as AxisPacket, l as AxisPostSensor, m as AxisPreSensor, n as AxisRequestContext, A as AxisSensor, o as AxisSensorInit, p as AxisSig, C as CapsuleMode, D as Decision, K as KeyStatus, q as SensorDecisions, r as SensorMinifiedDecision, s as SensorPhaseMetadata, t as normalizeSensorDecision } from './axis-sensor-GBEI3Fab.js';
9
12
  import { Axis1DecodedFrame } from './types/frame.js';
10
13
  export { decodeAxis1Frame } from './types/frame.js';
11
- import { OnApplicationBootstrap, OnModuleInit } from '@nestjs/common';
12
-
13
- type AxisExecutionMode = 'strict' | 'parallel' | 'best_effort' | 'atomic';
14
- type AxisObserverEvent = 'intent.received' | 'intent.completed' | 'intent.failed' | 'chain.received' | 'chain.admitted' | 'chain.completed' | 'chain.failed' | 'chain.partial' | 'step.started' | 'step.completed' | 'step.failed' | 'step.blocked' | 'step.skipped' | 'signature.verified' | 'decryption.succeeded' | 'sensor.passed' | 'sensor.failed' | 'handler.completed' | 'proof.recorded';
15
- interface AxisCapsuleRef {
16
- capsuleId?: string;
17
- scope?: string | string[];
18
- scopeMode?: 'chain' | 'step' | 'chain+step';
19
- proofRequired?: boolean;
20
- metadata?: Record<string, unknown>;
21
- }
22
- interface AxisKeyExchangeRef {
23
- profile?: string;
24
- sessionId?: string;
25
- clientKid?: string;
26
- serverKid?: string;
27
- algorithm?: string;
28
- derivedKeyRef?: string;
29
- required?: boolean;
30
- metadata?: Record<string, unknown>;
31
- }
32
- interface AxisIntentEnvelope<TPayload = unknown> {
33
- intent: string;
34
- handler?: string;
35
- payload: TPayload;
36
- capsule?: AxisCapsuleRef;
37
- keyExchange?: AxisKeyExchangeRef;
38
- observerTags?: string[];
39
- proofRequired?: boolean;
40
- metadata?: Record<string, unknown>;
41
- }
42
- interface AxisChainStep<TInput = unknown> {
43
- stepId: string;
44
- intent: string;
45
- handler?: string;
46
- input?: TInput;
47
- dependsOn?: string[];
48
- onSuccess?: string[];
49
- onFailure?: string[];
50
- capsuleScope?: string | string[];
51
- observerTags?: string[];
52
- proofRequired?: boolean;
53
- keyExchange?: AxisKeyExchangeRef;
54
- metadata?: Record<string, unknown>;
55
- }
56
- interface AxisChainEncryption {
57
- enabled?: boolean;
58
- profile?: string;
59
- keyExchange?: AxisKeyExchangeRef;
60
- }
61
- interface AxisChainEnvelope<TInput = unknown> {
62
- chainId: string;
63
- subject?: string;
64
- issuer?: string;
65
- issuedAtTps?: string | number;
66
- expiresAtTps?: string | number;
67
- mode: AxisExecutionMode;
68
- signature?: string;
69
- encryption?: AxisChainEncryption;
70
- capsule?: AxisCapsuleRef;
71
- keyExchange?: AxisKeyExchangeRef;
72
- observerTags?: string[];
73
- dynamic?: boolean;
74
- metadata?: Record<string, unknown>;
75
- steps: Array<AxisChainStep<TInput>>;
76
- }
77
- interface AxisChainRequest<TInput = unknown, TCapsule = Record<string, unknown>> {
78
- envelope: AxisChainEnvelope<TInput>;
79
- capsule?: TCapsule;
80
- actorId?: string;
81
- }
82
- type AxisChainStepStatus = 'SUCCEEDED' | 'FAILED' | 'BLOCKED' | 'SKIPPED';
83
- interface AxisChainStepResult<TOutput = unknown> {
84
- stepId: string;
85
- intent: string;
86
- status: AxisChainStepStatus;
87
- effect?: string;
88
- output?: TOutput;
89
- error?: string;
90
- dependsOn?: string[];
91
- startedAt: number;
92
- finishedAt: number;
93
- proofHash?: string;
94
- observerTags?: string[];
95
- metadata?: Record<string, unknown>;
96
- }
97
- type AxisChainStatus = 'SUCCEEDED' | 'FAILED' | 'PARTIAL';
98
- interface AxisChainResult<TOutput = unknown> {
99
- chainId: string;
100
- mode: AxisExecutionMode;
101
- status: AxisChainStatus;
102
- completedSteps: number;
103
- failedSteps: number;
104
- blockedSteps: number;
105
- skippedSteps: number;
106
- startedAt: number;
107
- finishedAt: number;
108
- results: Array<AxisChainStepResult<TOutput>>;
109
- rollback?: {
110
- supported: boolean;
111
- attempted: boolean;
112
- reason?: string;
113
- };
114
- metadata?: Record<string, unknown>;
115
- }
116
- interface ChainOptions {
117
- mode?: AxisExecutionMode;
118
- allowPartial?: boolean;
119
- dynamic?: boolean;
120
- proofRequired?: boolean;
121
- capsuleScope?: string | string[];
122
- observerTags?: string[];
123
- keyExchangeRequired?: boolean;
124
- }
125
- interface RegisteredChainConfig extends ChainOptions {
126
- enabled: boolean;
127
- }
14
+ export { InMemoryTimelineStore, TimelineEngine, TimelineStore } from './timeline/index.js';
15
+ export { F as ForkRequest, a as ForkResult, R as ReplayDifference, b as ReplayRequest, c as ReplayResult, S as SimulatedSideEffect, d as SimulationRequest, e as SimulationResult, f as StateSnapshot, T as TimelineBranch, g as TimelineComparison, h as TimelineDomain, i as TimelineEvent, j as TimelineEventStatus, k as TimelineHandler, l as TimelineHandlerContext, m as TimelineHandlerResult } from './timeline.types-Cn0aqbUj.js';
16
+ export { e as CCE_ERROR, h as CCE_PROTOCOL_VERSION, C as CceCapsuleClaimsType, q as CceError, a as CceExecutionContextType, s as CceHandler, t as CceHandlerContext, u as CceHandlerResult, x as CcePipelineConfig, y as CcePipelineResult, z as CcePolicyContext, A as CcePolicyDecision, B as CcePolicyEvaluator, b as CceRequestEnvelopeType, D as CceResponseEnvelopeType, I as CceWitnessRecordType, O as executeCcePipeline } from './cce-pipeline-DbGBSsCG.js';
17
+ export { IdelCompiler, IdelSchemaRegistry } from './idel/index.js';
18
+ export { A as AlternativeIntent, C as ClarificationQuestion, a as CompilationError, b as CompilationResult, c as CompiledIntent, d as ConstraintKind, I as IntentConstraint, e as IntentParamSchema, f as IntentProposal, g as IntentRisk, h as IntentSchema, R as RiskLevel } from './idel.types-DuUAcOnQ.js';
19
+ import 'zod';
128
20
 
129
21
  declare const CHAIN_METADATA_KEY = "axis:chain";
130
22
  declare function Chain(options?: ChainOptions): MethodDecorator;
131
23
 
132
- declare const CAPSULE_POLICY_METADATA_KEY = "axis:capsule:policy";
133
- type CapsuleScopeMode = "all" | "any";
134
- interface CapsulePolicyOptions {
135
- required?: boolean;
136
- scopes?: string | string[];
137
- scopeMode?: CapsuleScopeMode;
138
- intentBound?: boolean;
139
- allowCapsuleRef?: boolean;
140
- }
141
- declare function CapsulePolicy(options?: CapsulePolicyOptions): ClassDecorator & MethodDecorator;
142
-
143
- interface ExecutionContract {
144
- maxDbWrites: number;
145
- maxDbReads?: number;
146
- maxExternalCalls: number;
147
- maxTimeMs: number;
148
- allowedEffects: string[];
149
- maxMemoryMb?: number;
150
- }
151
- declare const DEFAULT_CONTRACTS: Record<string, ExecutionContract>;
152
- declare const FALLBACK_CONTRACT: ExecutionContract;
153
-
154
- declare const ProofKindZ: z.ZodEnum<{
155
- NONE: "NONE";
156
- CAPSULE: "CAPSULE";
157
- PASSPORT: "PASSPORT";
158
- MTLS: "MTLS";
159
- JWT: "JWT";
160
- }>;
161
- type ProofKind = z.infer<typeof ProofKindZ>;
162
- declare const SensitivityLevelZ: z.ZodEnum<{
163
- LOW: "LOW";
164
- MEDIUM: "MEDIUM";
165
- HIGH: "HIGH";
166
- CRITICAL: "CRITICAL";
167
- }>;
168
- type SensitivityLevel = z.infer<typeof SensitivityLevelZ>;
169
- declare enum ProofType {
170
- CAPSULE = 1,
171
- JWT = 2,
172
- MTLS_ID = 3,
173
- DEVICE_SE = 4,
174
- WITNESS_SIG = 5
175
- }
176
- declare const AxisContextZ: z.ZodObject<{
177
- pid: z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>;
178
- ts: z.ZodBigInt;
179
- intent: z.ZodString;
180
- actorId: z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>;
181
- proofType: z.ZodEnum<typeof ProofType>;
182
- proofRef: z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>;
183
- nonce: z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>;
184
- ip: z.ZodString;
185
- nodeCertHash: z.ZodOptional<z.ZodString>;
186
- capsule: z.ZodOptional<z.ZodObject<{
187
- id: z.ZodString;
188
- claims: z.ZodObject<{
189
- capsuleId: z.ZodString;
190
- allowIntents: z.ZodArray<z.ZodString>;
191
- limits: z.ZodOptional<z.ZodObject<{
192
- maxBodyBytes: z.ZodOptional<z.ZodNumber>;
193
- }, z.z.core.$strip>>;
194
- scopes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
195
- }, z.z.core.$strip>;
196
- issuedAt: z.ZodNumber;
197
- expiresAt: z.ZodNumber;
198
- tier: z.ZodEnum<{
199
- FREE: "FREE";
200
- STANDARD: "STANDARD";
201
- PREMIUM: "PREMIUM";
202
- }>;
203
- }, z.z.core.$strip>>;
204
- passport: z.ZodOptional<z.ZodObject<{
205
- id: z.ZodString;
206
- public_key: z.ZodCustom<Buffer<ArrayBufferLike>, Buffer<ArrayBufferLike>>;
207
- status: z.ZodEnum<{
208
- ACTIVE: "ACTIVE";
209
- REVOKED: "REVOKED";
210
- EXPIRED: "EXPIRED";
211
- PENDING: "PENDING";
212
- }>;
213
- issuedAt: z.ZodNumber;
214
- expiresAt: z.ZodOptional<z.ZodNumber>;
215
- }, z.z.core.$strip>>;
216
- meter: z.ZodOptional<z.ZodAny>;
217
- }, z.z.core.$strip>;
218
- type AxisContext$1 = z.infer<typeof AxisContextZ>;
219
-
220
- declare const AXIS_META_KEY = "axis:axis";
221
- declare const SENSITIVITY_METADATA_KEY = "axis:sensitivity";
222
- declare const CONTRACT_METADATA_KEY = "axis:contract";
223
- declare const REQUIRED_PROOF_METADATA_KEY = "axis:required_proof";
224
- type RequiredProofKind = ProofKind | "WITNESS";
225
- declare function Sensitivity(level: SensitivityLevel): ClassDecorator & MethodDecorator;
226
- declare function Contract(options: Partial<ExecutionContract>): ClassDecorator & MethodDecorator;
227
- declare function RequiredProof(proofs: [RequiredProofKind, ...RequiredProofKind[]]): ClassDecorator & MethodDecorator;
228
- declare function Capsule(): ClassDecorator & MethodDecorator;
229
- declare function Witness(): ClassDecorator & MethodDecorator;
230
- declare function Axis(): ClassDecorator;
231
- declare const AXIS_PUBLIC_KEY = "axis:public";
232
- declare function AxisPublic(): ClassDecorator & MethodDecorator;
233
- declare const AXIS_ANONYMOUS_KEY = "axis:anonymous";
234
- declare function AxisAnonymous(): ClassDecorator & MethodDecorator;
235
- declare const AXIS_RATE_LIMIT_KEY = "axis:rateLimit";
236
- interface AxisRateLimitConfig {
237
- max: number;
238
- windowSec: number;
239
- key?: string;
240
- }
241
- declare function AxisRateLimit(config: AxisRateLimitConfig): MethodDecorator;
242
-
243
24
  declare const HANDLER_METADATA_KEY = "axis:handler";
244
25
  declare function Handler(intent?: string): ClassDecorator;
245
26
 
246
- declare const INTENT_METADATA_KEY = "axis:intent";
247
- declare const INTENT_ROUTES_KEY = "axis:intent_routes";
248
- type IntentKind = "create" | "read" | "update" | "delete" | "action";
249
- type AxisIntentSensorRef = string | Function;
250
- interface AxisIntentSensorOptions {
251
- is?: AxisIntentSensorRef[];
252
- }
253
- interface IntentTlvField {
254
- name: string;
255
- tag: number;
256
- kind: "utf8" | "u64" | "bytes" | "bytes16" | "bool" | "obj" | "arr";
257
- required?: boolean;
258
- maxLen?: number;
259
- max?: string;
260
- scope?: "header" | "body";
261
- }
262
- interface IntentRoute extends AxisIntentSensorOptions {
263
- action: string;
264
- methodName: string | symbol;
265
- absolute?: boolean;
266
- frame?: boolean;
267
- kind?: IntentKind;
268
- sensitivity?: SensitivityLevel;
269
- chain?: boolean | ChainOptions;
270
- bodyProfile?: "TLV_MAP" | "RAW" | "TLV_OBJ" | "TLV_ARR";
271
- tlv?: IntentTlvField[];
272
- dto?: Function;
273
- }
274
- interface IntentOptions extends AxisIntentSensorOptions {
275
- kind?: IntentKind;
276
- sensitivity?: SensitivityLevel;
277
- absolute?: boolean;
278
- frame?: boolean;
279
- chain?: boolean | ChainOptions;
280
- bodyProfile?: "TLV_MAP" | "RAW" | "TLV_OBJ" | "TLV_ARR";
281
- tlv?: IntentTlvField[];
282
- dto?: Function;
283
- decoder?: (buf: Buffer) => any;
284
- }
285
- declare function Intent(action: string, options?: IntentOptions): MethodDecorator;
286
-
287
27
  declare const INTENT_BODY_KEY = "axis:intent:body";
288
28
  declare function IntentBody(decoder: (buf: Buffer) => any): MethodDecorator;
289
29
 
290
30
  declare const INTENT_SENSORS_KEY = "axis:intent:sensors";
291
31
  declare function IntentSensors(sensors: AxisIntentSensorRef[]): MethodDecorator;
292
32
 
293
- declare const OBSERVER_METADATA_KEY = "axis:observer";
294
- declare const OBSERVER_BINDINGS_KEY = "axis:observer:bindings";
295
- type AxisObserverRef = string | Function;
296
- interface AxisObserverDefinition {
297
- name?: string;
298
- tags?: string[];
299
- events?: AxisObserverEvent[];
300
- intents?: string[];
301
- handlers?: string[];
302
- }
303
- interface AxisObserverBinding {
304
- refs: AxisObserverRef[];
305
- tags?: string[];
306
- events?: AxisObserverEvent[];
307
- }
308
- interface AxisObserverBindingOptions {
309
- use: AxisObserverRef | AxisObserverRef[];
310
- tags?: string[];
311
- events?: AxisObserverEvent[];
312
- }
313
- declare function Observer(input?: AxisObserverDefinition | AxisObserverBindingOptions | AxisObserverRef | AxisObserverRef[]): ClassDecorator & MethodDecorator;
314
-
315
33
  declare const HANDLER_SENSORS_KEY = "axis:handler:sensors";
316
34
  declare function HandlerSensors(sensors: AxisIntentSensorRef[]): ClassDecorator;
317
35
 
318
36
  declare const SENSOR_METADATA_KEY = "axis:sensor";
319
- type SensorPhase = 'PRE_DECODE' | 'POST_DECODE';
37
+ type SensorPhase = "PRE_DECODE" | "POST_DECODE";
320
38
  interface SensorOptions {
321
39
  phase?: SensorPhase;
322
40
  }
323
41
  declare function Sensor(options?: SensorOptions): ClassDecorator;
324
42
 
325
- declare const TLV_FIELDS_KEY = "axis:tlv:fields";
326
- declare const TLV_VALIDATORS_KEY = "axis:tlv:validators";
327
- type TlvFieldKind = 'utf8' | 'u64' | 'bytes' | 'bytes16' | 'bool' | 'obj' | 'arr';
328
- interface TlvFieldOptions {
329
- kind: TlvFieldKind;
330
- required?: boolean;
331
- maxLen?: number;
332
- max?: string;
333
- scope?: 'header' | 'body';
334
- }
335
- interface TlvFieldMeta {
336
- property: string;
337
- tag: number;
338
- options: TlvFieldOptions;
339
- }
340
- type TlvValidatorFn = (value: Uint8Array, property: string) => string | null | undefined;
341
- interface TlvValidatorMeta {
342
- property: string;
343
- tag: number;
344
- validators: TlvValidatorFn[];
345
- }
346
- declare function TlvField(tag: number, options: TlvFieldOptions): PropertyDecorator;
347
- declare function TlvValidate(validator: TlvValidatorFn): PropertyDecorator;
348
- declare function TlvUtf8Pattern(pattern: RegExp, message?: string): PropertyDecorator;
349
- declare function TlvMinLen(min: number, message?: string): PropertyDecorator;
350
- declare function TlvEnum(allowed: string[], message?: string): PropertyDecorator;
351
- declare function TlvRange(min: bigint, max: bigint, message?: string): PropertyDecorator;
352
-
353
43
  interface DtoSchema {
354
44
  fields: IntentTlvField[];
355
45
  validators: Map<number, TlvValidatorFn[]>;
@@ -380,622 +70,9 @@ declare abstract class AxisResponseDto extends AxisTlvDto {
380
70
  updated_by?: string;
381
71
  }
382
72
 
383
- declare const CCE_PROTOCOL_VERSION: "cce-v1";
384
- type CceAlgorithm = "AES-256-GCM";
385
- type CceKemAlgorithm = "X25519" | "RSA-OAEP-256";
386
- type CceKdfAlgorithm = "HKDF-SHA256";
387
- interface CceCapsuleClaims {
388
- capsule_id: string;
389
- ver: typeof CCE_PROTOCOL_VERSION;
390
- sub: string;
391
- kid: string;
392
- intent: string;
393
- aud: string;
394
- tps_from: number;
395
- tps_to: number;
396
- capsule_nonce: string;
397
- challenge_id: string;
398
- proof_hash?: string;
399
- policy_hash?: string;
400
- iat: number;
401
- exp: number;
402
- mode: "SINGLE_USE" | "SESSION";
403
- scope?: string[];
404
- constraints?: CceConstraints;
405
- issuer_sig: CceSignature;
406
- }
407
- interface CceConstraints {
408
- max_payload_bytes?: number;
409
- ip_allow?: string[];
410
- device_allow?: string[];
411
- country_allow?: string[];
412
- }
413
- interface CceSignature {
414
- alg: "EdDSA" | "ES256";
415
- kid: string;
416
- value: string;
417
- }
418
- interface CceRequestEnvelope {
419
- ver: typeof CCE_PROTOCOL_VERSION;
420
- request_id: string;
421
- correlation_id: string;
422
- client_kid: string;
423
- capsule: CceCapsuleClaims;
424
- encrypted_key: CceEncryptedKey;
425
- encrypted_payload: CceEncryptedPayload;
426
- request_nonce: string;
427
- client_sig: CceSignature;
428
- content_type: string;
429
- algorithms: CceAlgorithmDescriptor;
430
- aad_descriptor?: string;
431
- }
432
- interface CceEncryptedKey {
433
- alg: CceKemAlgorithm;
434
- axis_kid: string;
435
- ciphertext: string;
436
- ephemeral_pk?: string;
437
- }
438
- interface CceEncryptedPayload {
439
- alg: CceAlgorithm;
440
- iv: string;
441
- ciphertext: string;
442
- tag: string;
443
- }
444
- interface CceAlgorithmDescriptor {
445
- kem: CceKemAlgorithm;
446
- enc: CceAlgorithm;
447
- kdf: CceKdfAlgorithm;
448
- sig: "EdDSA" | "ES256";
449
- }
450
- interface CceResponseEnvelope {
451
- ver: typeof CCE_PROTOCOL_VERSION;
452
- response_id: string;
453
- request_id: string;
454
- correlation_id: string;
455
- capsule_id: string;
456
- encrypted_key: CceEncryptedKey;
457
- encrypted_payload: CceEncryptedPayload;
458
- response_nonce: string;
459
- axis_sig: CceSignature;
460
- witness_ref?: string;
461
- algorithms: CceAlgorithmDescriptor;
462
- status: CceResponseStatus;
463
- }
464
- type CceResponseStatus = "SUCCESS" | "DENIED" | "PARTIAL" | "FAILED" | "ERROR";
465
- interface CceExecutionContext {
466
- execution_key_hash: string;
467
- request_id: string;
468
- capsule_id: string;
469
- sub: string;
470
- kid: string;
471
- intent: string;
472
- aud: string;
473
- tps_from: number;
474
- tps_to: number;
475
- policy_hash?: string;
476
- derived_at: number;
477
- valid: boolean;
478
- }
479
- interface CceWitnessRecord {
480
- witness_id: string;
481
- request_id: string;
482
- capsule_id: string;
483
- sub: string;
484
- intent: string;
485
- aud: string;
486
- tps_from: number;
487
- tps_to: number;
488
- timestamp: number;
489
- verification: {
490
- client_sig: boolean;
491
- capsule_sig: boolean;
492
- tps_valid: boolean;
493
- audience_match: boolean;
494
- intent_match: boolean;
495
- replay_clean: boolean;
496
- nonce_unique: boolean;
497
- decryption_ok: boolean;
498
- };
499
- execution: {
500
- status: CceResponseStatus;
501
- handler_duration_ms: number;
502
- effect?: string;
503
- };
504
- response_encrypted: boolean;
505
- execution_context_hash: string;
506
- request_payload_hash?: string;
507
- response_payload_hash?: string;
508
- }
509
- declare const CCE_ERROR: {
510
- readonly INVALID_ENVELOPE: "CCE_INVALID_ENVELOPE";
511
- readonly UNSUPPORTED_VERSION: "CCE_UNSUPPORTED_VERSION";
512
- readonly MISSING_CAPSULE: "CCE_MISSING_CAPSULE";
513
- readonly MISSING_ENCRYPTED_KEY: "CCE_MISSING_ENCRYPTED_KEY";
514
- readonly CLIENT_SIG_INVALID: "CCE_CLIENT_SIG_INVALID";
515
- readonly CLIENT_KEY_NOT_FOUND: "CCE_CLIENT_KEY_NOT_FOUND";
516
- readonly CAPSULE_SIG_INVALID: "CCE_CAPSULE_SIG_INVALID";
517
- readonly CAPSULE_EXPIRED: "CCE_CAPSULE_EXPIRED";
518
- readonly CAPSULE_NOT_YET_VALID: "CCE_CAPSULE_NOT_YET_VALID";
519
- readonly CAPSULE_REVOKED: "CCE_CAPSULE_REVOKED";
520
- readonly CAPSULE_CONSUMED: "CCE_CAPSULE_CONSUMED";
521
- readonly AUDIENCE_MISMATCH: "CCE_AUDIENCE_MISMATCH";
522
- readonly INTENT_MISMATCH: "CCE_INTENT_MISMATCH";
523
- readonly TPS_WINDOW_EXPIRED: "CCE_TPS_WINDOW_EXPIRED";
524
- readonly TPS_WINDOW_FUTURE: "CCE_TPS_WINDOW_FUTURE";
525
- readonly REPLAY_DETECTED: "CCE_REPLAY_DETECTED";
526
- readonly NONCE_REUSED: "CCE_NONCE_REUSED";
527
- readonly DECRYPTION_FAILED: "CCE_DECRYPTION_FAILED";
528
- readonly KEY_UNWRAP_FAILED: "CCE_KEY_UNWRAP_FAILED";
529
- readonly AEAD_TAG_MISMATCH: "CCE_AEAD_TAG_MISMATCH";
530
- readonly PAYLOAD_TOO_LARGE: "CCE_PAYLOAD_TOO_LARGE";
531
- readonly PAYLOAD_SCHEMA_INVALID: "CCE_PAYLOAD_SCHEMA_INVALID";
532
- readonly INTENT_SCHEMA_MISMATCH: "CCE_INTENT_SCHEMA_MISMATCH";
533
- readonly POLICY_DENIED: "CCE_POLICY_DENIED";
534
- readonly CONSTRAINT_VIOLATED: "CCE_CONSTRAINT_VIOLATED";
535
- readonly HANDLER_NOT_FOUND: "CCE_HANDLER_NOT_FOUND";
536
- readonly HANDLER_EXECUTION_FAILED: "CCE_HANDLER_EXECUTION_FAILED";
537
- readonly HANDLER_TIMEOUT: "CCE_HANDLER_TIMEOUT";
538
- readonly RESPONSE_ENCRYPTION_FAILED: "CCE_RESPONSE_ENCRYPTION_FAILED";
539
- };
540
- type CceErrorCode = (typeof CCE_ERROR)[keyof typeof CCE_ERROR];
541
- declare class CceError extends Error {
542
- readonly code: CceErrorCode;
543
- readonly metadata?: Record<string, unknown> | undefined;
544
- constructor(code: CceErrorCode, message: string, metadata?: Record<string, unknown> | undefined);
545
- get clientSafe(): boolean;
546
- toClientError(): {
547
- code: CceErrorCode;
548
- message: string;
549
- };
550
- }
551
-
552
- interface CceClientKeyEncryptor {
553
- wrapKey(aesKey: Uint8Array, clientKid: string, clientPublicKeyHex: string): Promise<CceEncryptedKey>;
554
- }
555
- interface CceAxisSigner {
556
- sign(payload: Uint8Array): Promise<CceSignature>;
557
- }
558
-
559
- interface CceWitnessStore {
560
- record(witness: CceWitnessRecord): Promise<void>;
561
- }
562
-
563
- type AxisAlg$1 = 'EdDSA' | 'ES256' | 'RS256';
564
- type CapsuleMode = 'SINGLE_USE' | 'MULTI_USE';
565
- type KeyStatus = 'ACTIVE' | 'GRACE' | 'REVOKED' | 'RETIRED';
566
- interface AxisSig$1 {
567
- alg: AxisAlg$1;
568
- kid: string;
569
- value: string;
570
- }
571
- interface AxisPacket$1<T = any> {
572
- v: 1;
573
- pid: string;
574
- nonce: string;
575
- ts: number;
576
- actorId: string;
577
- opcode: string;
578
- body: T;
579
- sig: AxisSig$1;
580
- }
581
- interface AxisCapsuleConstraints {
582
- maxAmount?: number;
583
- maxCount?: number;
584
- ttlSeconds?: number;
585
- ipCidrAllow?: string[];
586
- countryAllow?: string[];
587
- deviceIdAllow?: string[];
588
- sessionIdLock?: string;
589
- nonceRequired?: boolean;
590
- }
591
- interface TickWindow {
592
- start: number;
593
- end: number;
594
- }
595
- interface AxisCapsulePayload {
596
- v: 1;
597
- capsuleId: string;
598
- actorId: string;
599
- issuer: string;
600
- audience: string;
601
- subject?: string;
602
- intent: string;
603
- scopes: string[];
604
- actions?: string[];
605
- iat: number;
606
- nbf?: number;
607
- exp: number;
608
- tickWindow?: TickWindow;
609
- mode: CapsuleMode;
610
- maxUses: number;
611
- nonceSeed?: string;
612
- policyRefs?: string[];
613
- riskScore?: number;
614
- constraints?: AxisCapsuleConstraints;
615
- meta?: Record<string, unknown>;
616
- }
617
- interface AxisCapsule {
618
- payload: AxisCapsulePayload;
619
- sig: AxisSig$1;
620
- }
621
- interface AxisResponse$1<T = any> {
622
- ok: boolean;
623
- pid: string;
624
- decisionId: string;
625
- code: string;
626
- message?: string;
627
- data?: T;
628
- meta?: Record<string, unknown>;
629
- }
630
-
631
- type AxisAlg = Extract<AxisAlg$1, 'EdDSA'>;
632
- type AxisSig = AxisSig$1 & {
633
- alg: AxisAlg;
634
- };
635
- interface AxisFrame<T = any> {
636
- v: 1;
637
- pid: string;
638
- nonce: string;
639
- ts: number;
640
- actorId: string;
641
- aud?: string;
642
- opcode: string;
643
- headers: Map<number, Uint8Array>;
644
- body: T;
645
- sig: AxisSig;
646
- }
647
- type AxisResponse<T = any> = AxisResponse$1<T> & {
648
- policyRefs?: string[];
649
- riskScore?: number;
650
- };
651
- interface AxisObservedContext {
652
- ip?: string;
653
- ua?: string;
654
- geo?: string;
655
- }
656
- interface AxisRequestContext {
657
- observed: AxisObservedContext;
658
- actorKeyKid?: string;
659
- issuerKeyKid?: string;
660
- decisionId: string;
661
- actorId: string;
662
- aud?: string;
663
- opcode: string;
664
- deviceId?: string;
665
- sessionId?: string;
666
- }
667
-
668
- interface SensorPhaseMetadata {
669
- phase: 'PRE_DECODE' | 'POST_DECODE';
670
- dependencies?: string[];
671
- asyncOk?: boolean;
672
- cryptoOk?: boolean;
673
- description?: string;
674
- }
675
- interface AxisSensor {
676
- readonly name: string;
677
- readonly order?: number;
678
- phase?: SensorPhaseMetadata | 'PRE_DECODE' | 'POST_DECODE';
679
- supports?(input: SensorInput): boolean;
680
- run(input: SensorInput): Promise<SensorDecision>;
681
- }
682
- interface AxisSensorInit extends AxisSensor {
683
- onModuleInit?(): void | Promise<void>;
684
- }
685
- interface AxisPreSensor extends AxisSensor {
686
- phase: 'PRE_DECODE';
687
- }
688
- interface AxisPostSensor extends AxisSensor {
689
- phase: 'POST_DECODE';
690
- }
691
- interface SensorInput {
692
- rawBytes?: Buffer | Uint8Array;
693
- intent?: string;
694
- ip?: string;
695
- path?: string;
696
- contentLength?: number;
697
- peek?: Uint8Array;
698
- country?: string;
699
- clientId?: string;
700
- isWs?: boolean;
701
- metadata?: Record<string, any>;
702
- actorId?: string;
703
- opcode?: string;
704
- aud?: string;
705
- observed?: AxisObservedContext;
706
- frameBody?: any;
707
- deviceId?: string;
708
- sessionId?: string;
709
- packet?: Record<string, any>;
710
- [key: string]: any;
711
- }
712
- declare enum Decision {
713
- ALLOW = "ALLOW",
714
- DENY = "DENY",
715
- THROTTLE = "THROTTLE",
716
- FLAG = "FLAG"
717
- }
718
- type SensorDecision = {
719
- decision?: Decision;
720
- allow: boolean;
721
- riskScore: number;
722
- reasons: string[];
723
- code?: string;
724
- retryAfterMs?: number;
725
- scoreDelta?: number;
726
- tags?: Record<string, any>;
727
- meta?: any;
728
- tighten?: {
729
- expSecondsMax?: number;
730
- constraintsPatch?: Record<string, any>;
731
- };
732
- } | {
733
- action: 'ALLOW';
734
- meta?: any;
735
- } | {
736
- action: 'DENY';
737
- code: string;
738
- reason?: string;
739
- retryAfterMs?: number;
740
- meta?: any;
741
- } | {
742
- action: 'THROTTLE';
743
- retryAfterMs: number;
744
- meta?: any;
745
- } | {
746
- action: 'FLAG';
747
- scoreDelta: number;
748
- reasons: string[];
749
- meta?: any;
750
- };
751
- type SensorMinifiedDecision = {
752
- allow: boolean;
753
- riskScore: number;
754
- reasons: string[];
755
- tags?: Record<string, any>;
756
- meta?: any;
757
- tighten?: {
758
- expSecondsMax?: number;
759
- constraintsPatch?: Record<string, any>;
760
- };
761
- retryAfterMs?: number;
762
- };
763
- declare function normalizeSensorDecision(sensorDecision: SensorDecision): SensorMinifiedDecision;
764
- declare const SensorDecisions: {
765
- allow(meta?: any, tags?: Record<string, any>): SensorDecision;
766
- deny(code: string, reason?: string, meta?: any): SensorDecision;
767
- throttle(retryAfterMs: number, meta?: any): SensorDecision;
768
- flag(scoreDelta: number, reasons: string[], meta?: any): SensorDecision;
769
- };
770
-
771
- type CceHandler = (payload: Uint8Array, context: CceHandlerContext) => Promise<CceHandlerResult>;
772
- interface CceHandlerContext {
773
- capsule: CceCapsuleClaims;
774
- executionContext: CceExecutionContext;
775
- envelope: CceRequestEnvelope;
776
- clientPublicKeyHex: string;
777
- intent: string;
778
- sub: string;
779
- }
780
- interface CceHandlerResult {
781
- status: CceResponseStatus;
782
- body: Uint8Array;
783
- effect?: string;
784
- }
785
- interface CcePolicyContext {
786
- envelope: CceRequestEnvelope;
787
- capsule: CceCapsuleClaims;
788
- executionContext: CceExecutionContext;
789
- decryptedPayload: Uint8Array;
790
- clientPublicKeyHex: string;
791
- }
792
- interface CcePolicyDecision {
793
- allow: boolean;
794
- code?: string;
795
- message?: string;
796
- }
797
- interface CcePolicyEvaluator {
798
- evaluate(context: CcePolicyContext): Promise<CcePolicyDecision>;
799
- }
800
- interface CcePipelineConfig {
801
- axisLocalSecret: string;
802
- axisAudience: string;
803
- sensors: AxisSensor[];
804
- handlers: Map<string, CceHandler>;
805
- witnessStore: CceWitnessStore;
806
- clientKeyEncryptor: CceClientKeyEncryptor;
807
- axisSigner: CceAxisSigner;
808
- policyEvaluator?: CcePolicyEvaluator;
809
- }
810
- type CcePipelineResult = {
811
- ok: true;
812
- response: CceResponseEnvelope;
813
- witnessId: string;
814
- } | {
815
- ok: false;
816
- error: {
817
- code: string;
818
- message: string;
819
- };
820
- status: CceResponseStatus;
821
- };
822
- declare function executeCcePipeline(envelope: CceRequestEnvelope, config: CcePipelineConfig): Promise<CcePipelineResult>;
823
-
824
- declare class SensorRegistry {
825
- private readonly configService;
826
- private sensors;
827
- private sensorsByName;
828
- private sensorsByType;
829
- private readonly logger;
830
- constructor(configService: ConfigService);
831
- register(sensor: AxisSensor): void;
832
- list(): AxisSensor[];
833
- resolve(ref: AxisIntentSensorRef): AxisSensor | undefined;
834
- getByName(name: string): AxisSensor | undefined;
835
- getPreDecodeSensors(): AxisPreSensor[];
836
- getPostDecodeSensors(): AxisPostSensor[];
837
- private isPreDecodeSensor;
838
- private isPostDecodeSensor;
839
- getSensorCountByPhase(): {
840
- preDecodeCount: number;
841
- postDecodeCount: number;
842
- };
843
- clear(): void;
844
- private indexSensor;
845
- }
846
-
847
- interface IntentSchema$1 {
848
- intent: string;
849
- version: number;
850
- bodyProfile: "TLV_MAP" | "RAW" | "TLV_OBJ" | "TLV_ARR";
851
- fields: Array<{
852
- name: string;
853
- tlv: number;
854
- kind: IntentTlvField["kind"];
855
- required?: boolean;
856
- maxLen?: number;
857
- max?: string;
858
- scope?: "header" | "body";
859
- }>;
860
- }
861
- interface AxisEffect {
862
- ok: boolean;
863
- effect: string;
864
- body?: Uint8Array;
865
- headers?: Map<number, Uint8Array>;
866
- metadata?: any;
867
- }
868
- declare class IntentRouter {
869
- private readonly moduleRef?;
870
- private readonly observerDispatcher?;
871
- private readonly sensorRegistry?;
872
- private readonly logger;
873
- private readonly decoder;
874
- private readonly encoder;
875
- private static readonly BUILTIN_INTENTS;
876
- private handlers;
877
- private intentSensors;
878
- private intentDecoders;
879
- private intentSchemas;
880
- private intentValidators;
881
- private intentKinds;
882
- private intentChains;
883
- private intentObservers;
884
- private intentCapsulePolicies;
885
- private intentSensitivity;
886
- private intentContracts;
887
- private intentRequiredProof;
888
- private publicIntents;
889
- private anonymousIntents;
890
- private intentRateLimits;
891
- private cceHandlers;
892
- private ccePipelineConfig;
893
- constructor(moduleRef?: ModuleRef | undefined, observerDispatcher?: ObserverDispatcherService | undefined, sensorRegistry?: SensorRegistry | undefined);
894
- getSchema(intent: string): IntentSchema$1 | undefined;
895
- getValidators(intent: string): Map<number, TlvValidatorFn[]> | undefined;
896
- has(intent: string): boolean;
897
- getRegisteredIntents(): string[];
898
- getIntentEntry(intent: string): {
899
- schema?: IntentSchema$1;
900
- validators?: Map<number, TlvValidatorFn[]>;
901
- hasSensors: boolean;
902
- builtin: boolean;
903
- kind?: IntentKind;
904
- chain?: RegisteredChainConfig;
905
- capsulePolicy?: CapsulePolicyOptions;
906
- observerCount: number;
907
- } | null;
908
- getChainConfig(intent: string): RegisteredChainConfig | undefined;
909
- getObservers(intent: string): AxisObserverBinding[];
910
- register(intent: string, handler: any): void;
911
- registerHandler(instance: any): void;
912
- route(frame: AxisFrame$1): Promise<AxisEffect>;
913
- private logIntent;
914
- registerIntentMeta(intent: string, proto: object, methodName: string, handlerSensors?: AxisIntentSensorRef[], handlerObservers?: AxisObserverBinding[]): void;
915
- getSensitivity(intent: string): SensitivityLevel | undefined;
916
- getContract(intent: string): Record<string, any> | undefined;
917
- getRequiredProof(intent: string): RequiredProofKind[] | undefined;
918
- isPublic(intent: string): boolean;
919
- isAnonymous(intent: string): boolean;
920
- getRateLimit(intent: string): AxisRateLimitConfig | undefined;
921
- private emitIntentObservers;
922
- private runIntentSensors;
923
- private resolveIntentSensor;
924
- private getEffectiveCapsulePolicy;
925
- private enforceCapsulePolicy;
926
- private executeChainRequest;
927
- private parseIntentExecBody;
928
- private parseChainRequestBody;
929
- private isChainRequestLike;
930
- private isChainEnvelopeLike;
931
- private encodeJson;
932
- private getActorIdFromFrame;
933
- private getProofRefFromFrame;
934
- private hasCapsuleReference;
935
- private getHeaderValue;
936
- private identifiersMatch;
937
- private extractInlineCapsuleId;
938
- private toInlineCapsuleRecord;
939
- private toScopeList;
940
- configureCce(config: Omit<CcePipelineConfig, "handlers">): void;
941
- registerCceHandler(intent: string, handler: CceHandler): void;
942
- hasCceHandler(intent: string): boolean;
943
- routeCce(envelope: CceRequestEnvelope): Promise<CcePipelineResult>;
944
- private storeSchema;
945
- }
946
-
947
- interface AxisObserverContext {
948
- event: AxisObserverEvent;
949
- timestamp: number;
950
- intent?: string;
951
- chainId?: string;
952
- stepId?: string;
953
- handler?: string;
954
- frame?: AxisFrame$1;
955
- envelope?: AxisChainEnvelope;
956
- step?: AxisChainStep;
957
- effect?: AxisEffect;
958
- result?: AxisChainStepResult | AxisChainResult;
959
- error?: string;
960
- observerTags?: string[];
961
- capsule?: AxisCapsuleRef;
962
- keyExchange?: AxisKeyExchangeRef;
963
- metadata?: Record<string, unknown>;
964
- }
965
- interface AxisIntentObserver {
966
- readonly name: string;
967
- supports?(context: AxisObserverContext): boolean;
968
- observe(context: AxisObserverContext): Promise<void> | void;
969
- }
970
- interface AxisObserverRegistration {
971
- name: string;
972
- instance: AxisIntentObserver;
973
- tags: string[];
974
- events?: AxisObserverEvent[];
975
- intents?: string[];
976
- handlers?: string[];
977
- }
978
-
979
- declare class ObserverRegistry {
980
- private readonly logger;
981
- private readonly byName;
982
- private readonly byType;
983
- register(instance: AxisIntentObserver, meta?: AxisObserverDefinition): void;
984
- resolve(ref: AxisObserverRef): AxisObserverRegistration | undefined;
985
- list(): AxisObserverRegistration[];
986
- clear(): void;
987
- }
988
-
989
- declare class ObserverDispatcherService {
990
- private readonly registry;
991
- private readonly logger;
992
- constructor(registry: ObserverRegistry);
993
- dispatch(bindings: AxisObserverBinding[] | undefined, context: AxisObserverContext): Promise<void>;
994
- }
995
-
996
73
  interface AxisChainExecutionOptions {
997
74
  actorId?: string;
998
- baseFrame?: Partial<AxisFrame$1>;
75
+ baseFrame?: Partial<AxisFrame>;
999
76
  }
1000
77
  declare class AxisChainExecutor {
1001
78
  private readonly router;
@@ -1030,7 +107,7 @@ interface AxisExecutionContext {
1030
107
  chainEnvelope?: AxisChainEnvelope;
1031
108
  chainStep?: AxisChainStep;
1032
109
  }
1033
- declare function getAxisExecutionContext(frame?: Partial<AxisFrame$1>): AxisExecutionContext | undefined;
110
+ declare function getAxisExecutionContext(frame?: Partial<AxisFrame>): AxisExecutionContext | undefined;
1034
111
  declare function withAxisExecutionContext<T extends object>(target: T, context: AxisExecutionContext): T;
1035
112
  declare function mergeAxisExecutionContext(base?: AxisExecutionContext, override?: AxisExecutionContext): AxisExecutionContext | undefined;
1036
113
 
@@ -1047,46 +124,6 @@ declare const PRE_DECODE_BOUNDARY = 40;
1047
124
 
1048
125
  declare function stableJsonStringify(value: unknown): string;
1049
126
 
1050
- interface ObservationStage {
1051
- name: string;
1052
- status: 'ok' | 'fail' | 'skip';
1053
- startMs: number;
1054
- endMs?: number;
1055
- durationMs?: number;
1056
- reason?: string;
1057
- code?: string;
1058
- }
1059
- interface ObservationSensor {
1060
- name: string;
1061
- allowed: boolean;
1062
- riskScore: number;
1063
- durationMs: number;
1064
- reasons: string[];
1065
- code?: string;
1066
- }
1067
- interface AxisObservation {
1068
- id: string;
1069
- startMs: number;
1070
- transport: 'http' | 'ws';
1071
- ip?: string;
1072
- intent?: string;
1073
- actorId?: string;
1074
- capsuleId?: string;
1075
- stages: ObservationStage[];
1076
- sensors: ObservationSensor[];
1077
- decision?: 'ALLOW' | 'DENY';
1078
- resultCode?: string;
1079
- statusCode?: number;
1080
- endMs?: number;
1081
- durationMs?: number;
1082
- facts: Record<string, unknown>;
1083
- }
1084
- declare function createObservation(transport: 'http' | 'ws', ip?: string): AxisObservation;
1085
- declare function startStage(obs: AxisObservation, name: string): ObservationStage;
1086
- declare function endStage(stage: ObservationStage, status?: 'ok' | 'fail' | 'skip', reason?: string, code?: string): void;
1087
- declare function recordSensor(obs: AxisObservation, name: string, allowed: boolean, riskScore: number, durationMs: number, reasons: string[], code?: string): void;
1088
- declare function finalizeObservation(obs: AxisObservation, decision: 'ALLOW' | 'DENY', statusCode: number, resultCode?: string): void;
1089
-
1090
127
  interface ObservationQueueMessage {
1091
128
  v: 1;
1092
129
  observation: AxisObservation;
@@ -1142,42 +179,6 @@ declare function canonicalizeObservation(obs: AxisObservation): string;
1142
179
  declare function hashObservation(obs: AxisObservation): string;
1143
180
  declare function buildUnsignedWitness(obs: AxisObservation): UnsignedObservationWitness | null;
1144
181
 
1145
- type TruthStatus = 'confirmed' | 'partial' | 'uncertain' | 'failed' | 'disputed';
1146
- interface ExpectedOutcome {
1147
- decision?: 'ALLOW' | 'DENY';
1148
- effect?: string;
1149
- statusCode?: number;
1150
- ok?: boolean;
1151
- stateChanges?: Record<string, unknown>;
1152
- maxDurationMs?: number;
1153
- minSensorsPassed?: number;
1154
- assertions?: Record<string, unknown>;
1155
- }
1156
- type AnomalyLevel = 'info' | 'warning' | 'critical';
1157
- interface Anomaly {
1158
- code: string;
1159
- level: AnomalyLevel;
1160
- message: string;
1161
- field?: string;
1162
- expected?: unknown;
1163
- actual?: unknown;
1164
- }
1165
- interface TruthVerdict {
1166
- status: TruthStatus;
1167
- confidence: number;
1168
- anomalies: Anomaly[];
1169
- passedChecks: number;
1170
- totalChecks: number;
1171
- verifiedAt: number;
1172
- isDeed: boolean;
1173
- }
1174
- declare function scoreTruth(obs: AxisObservation, expected?: ExpectedOutcome): TruthVerdict;
1175
- interface ObservedDeed {
1176
- observation: AxisObservation;
1177
- verdict: TruthVerdict;
1178
- }
1179
- declare function verifyObservation(obs: AxisObservation, expected?: ExpectedOutcome): ObservedDeed;
1180
-
1181
182
  interface ResponseObserverContext {
1182
183
  actorId: string;
1183
184
  intent: string;
@@ -1555,65 +556,64 @@ type Capability = keyof typeof CAPABILITIES;
1555
556
  declare const PROOF_CAPABILITIES: Record<number, Capability[]>;
1556
557
  declare const INTENT_REQUIREMENTS: Record<string, Capability[]>;
1557
558
 
1558
- type AxisLawDecision = "allow" | "deny" | "conditional";
1559
- interface AxisLawArticleSummary {
1560
- article_id: string;
1561
- article_type?: string;
1562
- decision?: string;
1563
- reason?: string;
1564
- }
1565
- interface AxisLawEvaluationContext {
559
+ type ProofType = 1 | 2 | 3 | 4;
560
+ interface ProofVerificationResult {
561
+ valid: boolean;
1566
562
  actorId?: string;
1567
- intent?: string;
1568
- audience?: string;
1569
- tps?: string | number;
1570
- country?: string;
1571
- ip?: string;
1572
- path?: string;
1573
- clientId?: string;
1574
- deviceId?: string;
1575
- sessionId?: string;
1576
- capsuleId?: string;
1577
- metadata: Record<string, unknown>;
1578
- packet?: Record<string, unknown>;
1579
- frameBody?: unknown;
1580
- }
1581
- interface AxisLawEvaluationResult {
1582
- decision: AxisLawDecision;
1583
- reason: string;
1584
- explanation?: string;
1585
- denied?: AxisLawArticleSummary[];
1586
- permitted?: AxisLawArticleSummary[];
1587
- required?: AxisLawArticleSummary[];
1588
- applicable?: AxisLawArticleSummary[];
1589
- metadata?: Record<string, unknown>;
563
+ error?: string;
564
+ metadata?: Record<string, any>;
1590
565
  }
1591
- type AxisLawEvaluator = ((context: AxisLawEvaluationContext) => AxisLawEvaluationResult | Promise<AxisLawEvaluationResult>);
1592
- interface LawEvaluationSensorOptions {
1593
- evaluator?: AxisLawEvaluator;
1594
- conditionalDecision?: "deny" | "flag" | "allow";
566
+ interface MTLSContext {
567
+ clientCertPem?: string;
568
+ clientCertFingerprint?: string;
569
+ clientCertSubject?: string;
570
+ clientCertIssuer?: string;
571
+ verified?: boolean;
1595
572
  }
1596
- declare function buildAxisLawEvaluationContext(input: SensorInput): AxisLawEvaluationContext;
1597
-
1598
- interface RiskSignal {
1599
- type: string;
1600
- severity: 'low' | 'medium' | 'high' | 'critical';
1601
- value: any;
1602
- message: string;
573
+ interface DeviceSEContext {
574
+ deviceId: string;
575
+ signature: Uint8Array;
576
+ publicKey: Uint8Array;
577
+ challenge?: Uint8Array;
1603
578
  }
1604
- declare enum RiskDecision {
1605
- ALLOW = "ALLOW",
1606
- THROTTLE = "THROTTLE",
1607
- STEP_UP = "STEP_UP",
1608
- WITNESS = "WITNESS",
1609
- DENY = "DENY"
579
+ declare class ProofVerificationService {
580
+ private readonly logger;
581
+ private readonly deviceKeys;
582
+ private readonly trustedCerts;
583
+ verifyProof(proofType: ProofType, proofRef: Uint8Array, context: {
584
+ signTarget?: Uint8Array;
585
+ signature?: Uint8Array;
586
+ mtls?: MTLSContext;
587
+ deviceSE?: DeviceSEContext;
588
+ }): Promise<ProofVerificationResult>;
589
+ private verifyCapsuleProof;
590
+ private verifyJWTProof;
591
+ private verifyMTLSProof;
592
+ private verifyDeviceSEProof;
593
+ registerDeviceKey(deviceId: string, publicKey: Uint8Array): void;
594
+ unregisterDevice(deviceId: string): boolean;
595
+ registerMTLSCert(fingerprint: string, actorId: string): void;
596
+ revokeMTLSCert(fingerprint: string): boolean;
597
+ static calculateFingerprint(certPem: string): string;
598
+ }
599
+
600
+ declare enum BodyProfile {
601
+ RAW = 0,
602
+ TLV_MAP = 1,
603
+ OBJ = 2,
604
+ ARR = 3
605
+ }
606
+ interface BodyProfileValidation {
607
+ valid: boolean;
608
+ error?: string;
609
+ profile: BodyProfile;
1610
610
  }
1611
- interface RiskEvaluation {
1612
- decision: RiskDecision;
1613
- reason?: string;
1614
- retryAfterMs?: number;
1615
- confidence: number;
1616
- signals: RiskSignal[];
611
+ declare class BodyProfileValidator {
612
+ validate(body: Uint8Array, profile: BodyProfile): BodyProfileValidation;
613
+ private validateRaw;
614
+ private validateTlvMap;
615
+ private validateObj;
616
+ private validateArr;
1617
617
  }
1618
618
 
1619
619
  declare const AXIS_OPCODES: Set<string>;
@@ -1653,6 +653,10 @@ interface IntentDefinition {
1653
653
  declare function validateFrameShape(frame: any): boolean;
1654
654
  declare function isTimestampValid(ts: number, skewSeconds?: number): boolean;
1655
655
 
656
+ declare const AXIS_UPLOAD_SESSION_STORE = "AXIS_UPLOAD_SESSION_STORE";
657
+ declare const AXIS_UPLOAD_FILE_STORE = "AXIS_UPLOAD_FILE_STORE";
658
+ declare const AXIS_UPLOAD_RECEIPT_SIGNER = "AXIS_UPLOAD_RECEIPT_SIGNER";
659
+
1656
660
  type UploadSessionStatus = 'ACTIVE' | 'FINALIZING' | 'COMPLETE' | 'ABORTED';
1657
661
  interface UploadSessionRecord {
1658
662
  id?: string;
@@ -1691,32 +695,6 @@ interface UploadFileStore {
1691
695
  createTempReadStream(fileId: string): NodeJS.ReadableStream;
1692
696
  }
1693
697
 
1694
- declare class AxisFilesDownloadHandler implements AxisHandler {
1695
- private readonly sessions;
1696
- private readonly files;
1697
- private readonly logger;
1698
- readonly name = "axis.files.download";
1699
- readonly open = true;
1700
- readonly description = "File download handler";
1701
- constructor(sessions: UploadSessionStore, files: UploadFileStore);
1702
- execute(body: Uint8Array, headers?: Map<number, Uint8Array>): Promise<any>;
1703
- }
1704
- declare class AxisFilesFinalizeHandler implements AxisHandler {
1705
- private readonly sessions;
1706
- private readonly files;
1707
- private readonly keyring?;
1708
- private readonly logger;
1709
- readonly name = "axis.files.finalize";
1710
- readonly open = false;
1711
- readonly description = "File upload finalization handler";
1712
- constructor(sessions: UploadSessionStore, files: UploadFileStore, keyring?: UploadReceiptSigner | undefined);
1713
- execute(body: Uint8Array, headers?: Map<number, Uint8Array>): Promise<any>;
1714
- }
1715
-
1716
- declare const AXIS_UPLOAD_SESSION_STORE = "AXIS_UPLOAD_SESSION_STORE";
1717
- declare const AXIS_UPLOAD_FILE_STORE = "AXIS_UPLOAD_FILE_STORE";
1718
- declare const AXIS_UPLOAD_RECEIPT_SIGNER = "AXIS_UPLOAD_RECEIPT_SIGNER";
1719
-
1720
698
  interface DiskUploadFileStoreOptions {
1721
699
  uploadDir: string;
1722
700
  chunkDir: string;
@@ -1734,48 +712,10 @@ declare class DiskUploadFileStore implements UploadFileStore {
1734
712
  createTempReadStream(fileId: string): NodeJS.ReadableStream;
1735
713
  }
1736
714
 
1737
- interface AxisRequestData {
1738
- raw: Buffer;
1739
- ip: string | undefined;
1740
- preDecodeInput: any;
1741
- frameBytesCount: number;
1742
- }
1743
- declare const AxisRaw: (...dataOrPipes: unknown[]) => ParameterDecorator;
1744
- declare const AxisIp: (...dataOrPipes: unknown[]) => ParameterDecorator;
1745
- declare const AxisContext: (...dataOrPipes: unknown[]) => ParameterDecorator;
1746
- declare const AxisDemoPubkey: (...dataOrPipes: unknown[]) => ParameterDecorator;
1747
-
1748
- declare class ObserverDiscoveryService implements OnApplicationBootstrap {
1749
- private readonly discovery;
1750
- private readonly reflector;
1751
- private readonly registry;
1752
- private readonly logger;
1753
- constructor(discovery: DiscoveryService, reflector: Reflector, registry: ObserverRegistry);
1754
- onApplicationBootstrap(): void;
1755
- }
1756
-
1757
- declare class HandlerDiscoveryService implements OnModuleInit {
1758
- private readonly discovery;
1759
- private readonly scanner;
1760
- private readonly router;
1761
- private readonly logger;
1762
- constructor(discovery: DiscoveryService, scanner: MetadataScanner, router: IntentRouter);
1763
- onModuleInit(): void;
1764
- }
1765
-
1766
- declare class SensorDiscoveryService implements OnApplicationBootstrap {
1767
- private readonly discovery;
1768
- private readonly reflector;
1769
- private readonly registry;
1770
- private readonly logger;
1771
- constructor(discovery: DiscoveryService, reflector: Reflector, registry: SensorRegistry);
1772
- onApplicationBootstrap(): void;
1773
- }
1774
-
1775
715
  interface AxisDecoded {
1776
716
  frame: Axis1DecodedFrame;
1777
717
  packet: AxisPacket;
1778
- axisCtx: AxisContext$1;
718
+ axisCtx: AxisContext;
1779
719
  correlationId: Buffer;
1780
720
  correlationIdHex: string;
1781
721
  sensorInput: SensorInput;
@@ -1796,324 +736,15 @@ interface ChainResult {
1796
736
  declare class AxisSensorChainService {
1797
737
  private readonly registry;
1798
738
  constructor(registry: SensorRegistry);
1799
- evaluate(input: SensorInput, phase?: 'PRE_DECODE' | 'POST_DECODE' | 'BOTH', baseDecision?: SensorDecision): Promise<SensorDecision>;
739
+ evaluate(input: SensorInput, phase?: "PRE_DECODE" | "POST_DECODE" | "BOTH", baseDecision?: SensorDecision): Promise<SensorDecision>;
1800
740
  evaluatePre(input: SensorInput): Promise<SensorDecision>;
1801
741
  evaluatePost(input: SensorInput, baseDecision?: SensorDecision): Promise<SensorDecision>;
1802
742
  private evaluateSensors;
1803
743
  }
1804
744
 
1805
- type TimelineDomain = 'prime' | 'fork' | 'shadow' | 'training' | 'audit';
1806
- type TimelineEventStatus = 'executed' | 'replayed' | 'forked' | 'simulated' | 'failed';
1807
- interface TimelineEvent {
1808
- event_id: string;
1809
- timeline_id: string;
1810
- branch_id: string;
1811
- parent_event_id: string | null;
1812
- intent: string;
1813
- actor_id: string;
1814
- capsule_id?: string;
1815
- tps_coordinate?: string;
1816
- payload_hash: string;
1817
- result_hash?: string;
1818
- status: TimelineEventStatus;
1819
- domain: TimelineDomain;
1820
- determinism: 'deterministic' | 'bounded_nondeterministic' | 'open_nondeterministic';
1821
- witness_id?: string;
1822
- created_at: number;
1823
- metadata?: Record<string, unknown>;
1824
- }
1825
- interface TimelineBranch {
1826
- branch_id: string;
1827
- timeline_id: string;
1828
- origin_timeline_id: string;
1829
- origin_event_id: string;
1830
- branch_type: 'fork' | 'simulation' | 'replay' | 'training';
1831
- created_at_tps?: string;
1832
- creator_subject_id: string;
1833
- purpose: string;
1834
- status: 'active' | 'completed' | 'abandoned';
1835
- }
1836
- interface StateSnapshot {
1837
- snapshot_id: string;
1838
- timeline_id: string;
1839
- event_id: string;
1840
- tps_coordinate?: string;
1841
- state_hash: string;
1842
- state_data: Record<string, unknown>;
1843
- created_at: number;
1844
- }
1845
- type ReplayMode = 'strict' | 'analytical';
1846
- interface ReplayRequest {
1847
- source_event_id: string;
1848
- mode: ReplayMode;
1849
- override_payload?: Record<string, unknown>;
1850
- }
1851
- interface ReplayResult {
1852
- original_event: TimelineEvent;
1853
- replayed_event: TimelineEvent;
1854
- mode: ReplayMode;
1855
- deterministic_match: boolean;
1856
- differences: ReplayDifference[];
1857
- duration_ms: number;
1858
- }
1859
- interface ReplayDifference {
1860
- field: string;
1861
- original: unknown;
1862
- replayed: unknown;
1863
- }
1864
- interface ForkRequest {
1865
- source_event_id: string;
1866
- new_payload: Record<string, unknown>;
1867
- purpose: string;
1868
- actor_id: string;
1869
- }
1870
- interface ForkResult {
1871
- branch: TimelineBranch;
1872
- forked_event: TimelineEvent;
1873
- snapshot?: StateSnapshot;
1874
- }
1875
- interface SimulationRequest {
1876
- intent: string;
1877
- payload: Record<string, unknown>;
1878
- actor_id: string;
1879
- at_tps?: string;
1880
- from_snapshot_id?: string;
1881
- purpose: string;
1882
- }
1883
- interface SimulationResult {
1884
- branch: TimelineBranch;
1885
- simulated_event: TimelineEvent;
1886
- predicted_outcome: Record<string, unknown>;
1887
- side_effects: SimulatedSideEffect[];
1888
- duration_ms: number;
1889
- }
1890
- interface SimulatedSideEffect {
1891
- type: string;
1892
- target: string;
1893
- action: string;
1894
- predicted_result: unknown;
1895
- }
1896
- interface TimelineComparison {
1897
- timeline_a: string;
1898
- timeline_b: string;
1899
- event_pairs: Array<{
1900
- event_a: TimelineEvent;
1901
- event_b: TimelineEvent;
1902
- match: boolean;
1903
- differences: ReplayDifference[];
1904
- }>;
1905
- divergence_point?: string;
1906
- }
1907
- interface TimelineHandler {
1908
- intent: string;
1909
- execute(payload: Record<string, unknown>, context: TimelineHandlerContext): Promise<TimelineHandlerResult>;
1910
- }
1911
- interface TimelineHandlerContext {
1912
- event_id: string;
1913
- timeline_id: string;
1914
- branch_id: string;
1915
- domain: TimelineDomain;
1916
- actor_id: string;
1917
- tps_coordinate?: string;
1918
- snapshot?: StateSnapshot;
1919
- is_replay: boolean;
1920
- is_simulation: boolean;
1921
- }
1922
- interface TimelineHandlerResult {
1923
- ok: boolean;
1924
- effect: string;
1925
- result_data: Record<string, unknown>;
1926
- side_effects?: SimulatedSideEffect[];
1927
- }
1928
-
1929
- interface TimelineStore {
1930
- saveEvent(event: TimelineEvent): Promise<void>;
1931
- getEvent(eventId: string): Promise<TimelineEvent | null>;
1932
- getEventsByTimeline(timelineId: string): Promise<TimelineEvent[]>;
1933
- getEventsByBranch(branchId: string): Promise<TimelineEvent[]>;
1934
- saveBranch(branch: TimelineBranch): Promise<void>;
1935
- getBranch(branchId: string): Promise<TimelineBranch | null>;
1936
- getBranchesByTimeline(timelineId: string): Promise<TimelineBranch[]>;
1937
- saveSnapshot(snapshot: StateSnapshot): Promise<void>;
1938
- getSnapshot(snapshotId: string): Promise<StateSnapshot | null>;
1939
- getSnapshotByEvent(eventId: string): Promise<StateSnapshot | null>;
1940
- }
1941
- declare class InMemoryTimelineStore implements TimelineStore {
1942
- private events;
1943
- private branches;
1944
- private snapshots;
1945
- saveEvent(event: TimelineEvent): Promise<void>;
1946
- getEvent(eventId: string): Promise<TimelineEvent | null>;
1947
- getEventsByTimeline(timelineId: string): Promise<TimelineEvent[]>;
1948
- getEventsByBranch(branchId: string): Promise<TimelineEvent[]>;
1949
- saveBranch(branch: TimelineBranch): Promise<void>;
1950
- getBranch(branchId: string): Promise<TimelineBranch | null>;
1951
- getBranchesByTimeline(timelineId: string): Promise<TimelineBranch[]>;
1952
- saveSnapshot(snapshot: StateSnapshot): Promise<void>;
1953
- getSnapshot(snapshotId: string): Promise<StateSnapshot | null>;
1954
- getSnapshotByEvent(eventId: string): Promise<StateSnapshot | null>;
1955
- }
1956
-
1957
- declare class TimelineEngine {
1958
- private readonly store;
1959
- private handlers;
1960
- constructor(store: TimelineStore);
1961
- registerHandler(handler: TimelineHandler): void;
1962
- recordEvent(intent: string, actorId: string, payload: Record<string, unknown>, result: Record<string, unknown>, options?: {
1963
- timelineId?: string;
1964
- branchId?: string;
1965
- capsuleId?: string;
1966
- tpsCoordinate?: string;
1967
- witnessId?: string;
1968
- determinism?: TimelineEvent['determinism'];
1969
- parentEventId?: string;
1970
- }): Promise<TimelineEvent>;
1971
- replay(request: ReplayRequest): Promise<ReplayResult>;
1972
- fork(request: ForkRequest): Promise<ForkResult>;
1973
- simulate(request: SimulationRequest): Promise<SimulationResult>;
1974
- compare(timelineIdA: string, timelineIdB: string): Promise<TimelineComparison>;
1975
- createSnapshot(eventId: string, stateData: Record<string, unknown>): Promise<StateSnapshot>;
1976
- restoreSnapshot(snapshotId: string): Promise<StateSnapshot>;
1977
- }
1978
-
1979
745
  type AxisTlvDtoCtor<T = object> = new (...args: never[]) => T;
1980
746
  declare function encodeAxisTlvDto<T extends object>(dtoClass: AxisTlvDtoCtor<T>, data: Partial<Record<keyof T, unknown>>): Uint8Array;
1981
747
 
1982
- interface PresenceDeclaration {
1983
- softid: string;
1984
- device_meta?: {
1985
- fingerprint?: string;
1986
- platform?: string;
1987
- user_agent?: string;
1988
- };
1989
- }
1990
- interface PresenceChallenge {
1991
- challenge_id: string;
1992
- nonce: string;
1993
- temporal_anchor: number;
1994
- ttl_ms: number;
1995
- expires_at: number;
1996
- }
1997
- interface PresenceProof {
1998
- challenge_id: string;
1999
- signature: string;
2000
- public_key: string;
2001
- kid?: string;
2002
- }
2003
- interface PresenceReceipt {
2004
- presence_id: string;
2005
- softid: string;
2006
- anchor_reflection: string;
2007
- scope: {
2008
- ip?: string;
2009
- device_fingerprint?: string;
2010
- };
2011
- issued_at: number;
2012
- expires_at: number;
2013
- renewed_at?: number;
2014
- }
2015
- type PresenceStatus = 'active' | 'expired' | 'revoked';
2016
- interface WritHead {
2017
- tid: string;
2018
- seq: number;
2019
- }
2020
- interface WritBody {
2021
- who: string;
2022
- act: string;
2023
- res: string;
2024
- law: string;
2025
- }
2026
- interface WritMeta {
2027
- iat: number;
2028
- exp: number;
2029
- prev: string;
2030
- }
2031
- interface WritSignature {
2032
- alg: 'ed25519';
2033
- value: string;
2034
- kid?: string;
2035
- }
2036
- interface Writ {
2037
- head: WritHead;
2038
- body: WritBody;
2039
- meta: WritMeta;
2040
- sig: WritSignature;
2041
- }
2042
- type GrantType = 'sovereign' | 'delegated' | 'system';
2043
- interface GrantCapability {
2044
- oec: string;
2045
- scope: string;
2046
- limit?: {
2047
- rate?: string;
2048
- amount?: number;
2049
- depth?: string;
2050
- };
2051
- }
2052
- interface GrantMeta {
2053
- iat: number;
2054
- exp: number;
2055
- revocable: boolean;
2056
- version: number;
2057
- contract_ref?: string;
2058
- }
2059
- interface Grant {
2060
- grant_id: string;
2061
- issuer: string;
2062
- subject: string;
2063
- grant_type: GrantType;
2064
- caps: GrantCapability[];
2065
- meta: GrantMeta;
2066
- sig: WritSignature;
2067
- }
2068
- type GrantStatus = 'active' | 'revoked' | 'expired';
2069
- interface LoomReceipt {
2070
- receipt_id: string;
2071
- writ_hash: string;
2072
- thread_id: string;
2073
- sequence: number;
2074
- effect: string;
2075
- hash: string;
2076
- prev_hash: string | null;
2077
- executed_at: number;
2078
- metadata?: Record<string, unknown>;
2079
- }
2080
- interface ThreadState {
2081
- thread_id: string;
2082
- softid: string;
2083
- last_receipt_hash: string;
2084
- sequence: number;
2085
- updated_at: number;
2086
- }
2087
- type RevocationTargetType = 'grant' | 'presence' | 'softid';
2088
- interface Revocation {
2089
- revocation_id: string;
2090
- target_type: RevocationTargetType;
2091
- target_id: string;
2092
- issuer_softid: string;
2093
- reason?: string;
2094
- effective_at: number;
2095
- sig_value: string;
2096
- }
2097
- interface LoomValidationResult {
2098
- valid: boolean;
2099
- error?: string;
2100
- code?: string;
2101
- }
2102
- interface PresenceVerifyResult extends LoomValidationResult {
2103
- presence?: PresenceReceipt;
2104
- }
2105
- interface WritValidationResult extends LoomValidationResult {
2106
- writ?: Writ;
2107
- gate_failed?: 'temporal' | 'causal' | 'legal' | 'authentic';
2108
- }
2109
- interface GrantValidationResult extends LoomValidationResult {
2110
- grant?: Grant;
2111
- }
2112
-
2113
- declare function deriveAnchorReflection(softid: string, context?: string, scope?: string): string;
2114
- declare function canonicalizeWrit(writ: Omit<Writ, 'sig'>): string;
2115
- declare function canonicalizeGrant(grant: Omit<Grant, 'sig'>): string;
2116
-
2117
748
  declare function createPresenceChallenge(declaration: PresenceDeclaration, ttlMs?: number): PresenceChallenge;
2118
749
  declare function signPresenceChallenge(challenge: PresenceChallenge, privateKeyHex: string, publicKeyHex: string, declaration: PresenceDeclaration, kid?: string): PresenceProof;
2119
750
  declare function verifyPresenceProof(challenge: PresenceChallenge, proof: PresenceProof, declaration: PresenceDeclaration, durationMs?: number): PresenceVerifyResult;
@@ -2149,452 +780,4 @@ declare function executeLoomPipeline(writ: Writ, publicKeyHex: string, presence:
2149
780
  code: string;
2150
781
  };
2151
782
 
2152
- interface IntentProposal {
2153
- raw: string;
2154
- actor_id: string;
2155
- target?: string;
2156
- params?: Record<string, unknown>;
2157
- context?: Record<string, unknown>;
2158
- }
2159
- interface CompiledIntent {
2160
- intent: string;
2161
- actor_id: string;
2162
- target?: string;
2163
- params: Record<string, unknown>;
2164
- constraints: IntentConstraint[];
2165
- confidence: number;
2166
- alternatives: AlternativeIntent[];
2167
- needs_clarification: boolean;
2168
- clarifications: ClarificationQuestion[];
2169
- expected_outcome?: string;
2170
- fallback?: string;
2171
- risk: IntentRisk;
2172
- metadata: Record<string, unknown>;
2173
- }
2174
- type ConstraintKind = 'required_param' | 'type_check' | 'range' | 'pattern' | 'temporal' | 'spatial' | 'authority' | 'safety' | 'custom';
2175
- interface IntentConstraint {
2176
- kind: ConstraintKind;
2177
- field: string;
2178
- description: string;
2179
- satisfied: boolean;
2180
- value?: unknown;
2181
- expected?: unknown;
2182
- }
2183
- interface AlternativeIntent {
2184
- intent: string;
2185
- confidence: number;
2186
- reason: string;
2187
- }
2188
- interface ClarificationQuestion {
2189
- id: string;
2190
- question: string;
2191
- field: string;
2192
- options?: string[];
2193
- required: boolean;
2194
- }
2195
- type RiskLevel = 'none' | 'low' | 'medium' | 'high' | 'critical';
2196
- interface IntentRisk {
2197
- level: RiskLevel;
2198
- score: number;
2199
- factors: string[];
2200
- }
2201
- interface IntentParamSchema {
2202
- name: string;
2203
- type: 'string' | 'number' | 'boolean' | 'object' | 'array';
2204
- required: boolean;
2205
- description?: string;
2206
- default?: unknown;
2207
- pattern?: string;
2208
- min?: number;
2209
- max?: number;
2210
- enum?: unknown[];
2211
- }
2212
- interface IntentSchema {
2213
- intent: string;
2214
- description: string;
2215
- params: IntentParamSchema[];
2216
- required_scopes?: string[];
2217
- risk_level: RiskLevel;
2218
- has_side_effects: boolean;
2219
- reversible: boolean;
2220
- related?: string[];
2221
- tags?: string[];
2222
- }
2223
- interface CompilationResult {
2224
- ok: boolean;
2225
- compiled?: CompiledIntent;
2226
- errors: CompilationError[];
2227
- }
2228
- interface CompilationError {
2229
- code: string;
2230
- message: string;
2231
- field?: string;
2232
- }
2233
-
2234
- declare class IdelSchemaRegistry {
2235
- private schemas;
2236
- private aliases;
2237
- register(schema: IntentSchema): void;
2238
- registerAlias(alias: string, intent: string): void;
2239
- get(intent: string): IntentSchema | undefined;
2240
- resolve(raw: string): IntentSchema | undefined;
2241
- findCandidates(raw: string): Array<{
2242
- schema: IntentSchema;
2243
- score: number;
2244
- }>;
2245
- list(): IntentSchema[];
2246
- }
2247
- declare class IdelCompiler {
2248
- private readonly registry;
2249
- constructor(registry: IdelSchemaRegistry);
2250
- compile(proposal: IntentProposal): CompilationResult;
2251
- applyClarifications(compiled: CompiledIntent, answers: Record<string, unknown>): CompilationResult;
2252
- }
2253
-
2254
- type NeedlePhase = 'created' | 'validated' | 'executing' | 'observed' | 'stitched' | 'failed';
2255
- interface Needle {
2256
- needle_id: string;
2257
- phase: NeedlePhase;
2258
- tps_coordinate?: string;
2259
- intent: CompiledIntent;
2260
- presence: PresenceReceipt;
2261
- writ: Writ;
2262
- grants: Grant[];
2263
- observation?: AxisObservation;
2264
- receipt?: LoomReceipt;
2265
- verdict?: TruthVerdict;
2266
- created_at: number;
2267
- completed_at?: number;
2268
- error?: NeedleError;
2269
- }
2270
- interface NeedleError {
2271
- phase: NeedlePhase;
2272
- code: string;
2273
- message: string;
2274
- }
2275
- type StitchKind = 'deed' | 'silent' | 'torn';
2276
- interface Stitch {
2277
- stitch_id: string;
2278
- kind: StitchKind;
2279
- intent: string;
2280
- actor_id: string;
2281
- tps_coordinate?: string;
2282
- observation: AxisObservation;
2283
- verdict: TruthVerdict;
2284
- receipt: LoomReceipt;
2285
- thread_id: string;
2286
- sequence: number;
2287
- timeline_event_id?: string;
2288
- stitched_at: number;
2289
- }
2290
- interface Thread {
2291
- state: ThreadState;
2292
- length: number;
2293
- started_at_tps?: string;
2294
- last_stitch_tps?: string;
2295
- has_branches: boolean;
2296
- branch_ids: string[];
2297
- }
2298
-
2299
- type NeedleHandler = (intent: CompiledIntent, context: NeedleHandlerContext) => Promise<NeedleHandlerResult>;
2300
- interface NeedleHandlerContext {
2301
- needle_id: string;
2302
- actor_id: string;
2303
- presence_id: string;
2304
- writ: Writ;
2305
- grants: Grant[];
2306
- tps_coordinate?: string;
2307
- }
2308
- interface NeedleHandlerResult {
2309
- ok: boolean;
2310
- effect: string;
2311
- data?: Record<string, unknown>;
2312
- status_code?: number;
2313
- }
2314
- interface NeedlePipelineConfig {
2315
- handlers: Map<string, NeedleHandler>;
2316
- private_key: string;
2317
- public_key: string;
2318
- sensors?: AxisSensor[];
2319
- record_timeline?: boolean;
2320
- tps_provider?: () => string;
2321
- }
2322
- interface NeedlePipelineResult {
2323
- ok: boolean;
2324
- needle: Needle;
2325
- stitch?: Stitch;
2326
- thread_state?: ThreadState;
2327
- timeline_event?: TimelineEvent;
2328
- }
2329
-
2330
- declare function assembleNeedle(params: {
2331
- intent: CompiledIntent;
2332
- presence: PresenceReceipt;
2333
- writ: Writ;
2334
- grants: Grant[];
2335
- tps_coordinate?: string;
2336
- }): Needle;
2337
- declare function formStitch(needle: Needle, observation: AxisObservation, verdict: TruthVerdict, receipt: LoomReceipt): Stitch;
2338
- declare function runNeedlePipeline(needle: Needle, config: NeedlePipelineConfig, threadState: ThreadState | null, prevReceipt: LoomReceipt | null, expectedOutcome?: ExpectedOutcome): Promise<NeedlePipelineResult>;
2339
-
2340
- type KnotType = 'authority' | 'law' | 'causal' | 'decision' | 'irreversible';
2341
- type KnotStatus = 'open' | 'tied' | 'broken' | 'forked';
2342
- interface Knot {
2343
- knot_id: string;
2344
- type: KnotType;
2345
- status: KnotStatus;
2346
- stitch_ids: string[];
2347
- thread_id: string;
2348
- tps_anchor?: string;
2349
- irreversible: boolean;
2350
- capsule_id?: string;
2351
- law_ref?: string;
2352
- decision_stitch_id?: string;
2353
- branch_ids: string[];
2354
- required_count?: number;
2355
- all_or_nothing: boolean;
2356
- actor_id: string;
2357
- created_at: number;
2358
- tied_at?: number;
2359
- broken_at?: number;
2360
- break_reason?: string;
2361
- witness_hash?: string;
2362
- }
2363
- interface KnotValidationResult {
2364
- valid: boolean;
2365
- passed_stitch_ids: string[];
2366
- failed_stitch_ids: string[];
2367
- can_tie: boolean;
2368
- errors: KnotError[];
2369
- }
2370
- interface KnotError {
2371
- code: string;
2372
- message: string;
2373
- stitch_id?: string;
2374
- }
2375
- interface KnotBreakRequest {
2376
- knot_id: string;
2377
- actor_id: string;
2378
- reason: string;
2379
- override_grant_id?: string;
2380
- signature?: string;
2381
- }
2382
-
2383
- interface OpenKnotParams {
2384
- type: KnotType;
2385
- thread_id: string;
2386
- actor_id: string;
2387
- tps_anchor?: string;
2388
- capsule_id?: string;
2389
- law_ref?: string;
2390
- required_count?: number;
2391
- all_or_nothing?: boolean;
2392
- }
2393
- declare function openKnot(params: OpenKnotParams): Knot;
2394
- declare function addStitchToKnot(knot: Knot, stitch: Stitch): string | null;
2395
- declare function validateKnot(knot: Knot, stitches: Stitch[]): KnotValidationResult;
2396
- declare function tieKnot(knot: Knot, stitches: Stitch[]): KnotValidationResult & {
2397
- knot: Knot;
2398
- };
2399
- declare function breakKnot(knot: Knot, request: KnotBreakRequest): {
2400
- ok: boolean;
2401
- error?: string;
2402
- };
2403
- declare function forkFromKnot(knot: Knot, branchId: string, decisionStitchId?: string): {
2404
- ok: boolean;
2405
- error?: string;
2406
- };
2407
- declare function isKnotOpen(knot: Knot): boolean;
2408
- declare function isPointOfNoReturn(knot: Knot): boolean;
2409
- declare function findKnotsForStitch(stitchId: string, knots: Knot[]): Knot[];
2410
- declare function getIrreversibleKnots(knots: Knot[]): Knot[];
2411
- declare function getDecisionPoints(knots: Knot[]): Knot[];
2412
-
2413
- interface FabricCell {
2414
- key: string;
2415
- value: unknown;
2416
- last_stitch_id: string;
2417
- last_tps?: string;
2418
- write_count: number;
2419
- locked: boolean;
2420
- locked_by_knot?: string;
2421
- }
2422
- interface Fabric {
2423
- fabric_id: string;
2424
- state_hash: string;
2425
- cells: Map<string, FabricCell>;
2426
- thread_ids: string[];
2427
- stitch_count: number;
2428
- knot_count: number;
2429
- projected_at_tps?: string;
2430
- computed_at: number;
2431
- version: number;
2432
- }
2433
- interface FabricEffect {
2434
- mutations: Record<string, unknown | null>;
2435
- reads?: string[];
2436
- }
2437
- type FabricEffectResolver = (stitch: Stitch) => FabricEffect;
2438
- type FabricDiffKind = 'added' | 'modified' | 'deleted';
2439
- interface FabricDiffEntry {
2440
- key: string;
2441
- kind: FabricDiffKind;
2442
- before?: unknown;
2443
- after?: unknown;
2444
- caused_by_stitch?: string;
2445
- }
2446
- interface FabricDiff {
2447
- from_fabric_id: string;
2448
- to_fabric_id: string;
2449
- entries: FabricDiffEntry[];
2450
- added_count: number;
2451
- modified_count: number;
2452
- deleted_count: number;
2453
- }
2454
- interface FabricQuery {
2455
- prefix?: string;
2456
- keys?: string[];
2457
- actor_id?: string;
2458
- thread_id?: string;
2459
- locked_only?: boolean;
2460
- }
2461
-
2462
- declare function createFabric(): Fabric;
2463
- declare function applyStitch(fabric: Fabric, stitch: Stitch, effect: FabricEffect): void;
2464
- declare function weave(stitches: Stitch[], resolver: FabricEffectResolver, knots?: Knot[]): Fabric;
2465
- declare function projectAt(stitches: Stitch[], resolver: FabricEffectResolver, tpsFilter: (tps: string | undefined) => boolean, knots?: Knot[]): Fabric;
2466
- declare function lockCells(fabric: Fabric, keys: string[], knotId: string): void;
2467
- declare function queryFabric(fabric: Fabric, query: FabricQuery): FabricCell[];
2468
- declare function getFabricValue(fabric: Fabric, key: string): unknown | undefined;
2469
- declare function diffFabrics(a: Fabric, b: Fabric): FabricDiff;
2470
-
2471
- type PatternKind = 'sequence' | 'knot' | 'state' | 'decision' | 'anomaly';
2472
- type PatternConfidence = number;
2473
- interface Pattern {
2474
- pattern_id: string;
2475
- kind: PatternKind;
2476
- name: string;
2477
- description?: string;
2478
- signature: PatternSignature;
2479
- confidence: PatternConfidence;
2480
- occurrence_count: number;
2481
- first_seen_at: number;
2482
- last_seen_at: number;
2483
- seen_in_threads: string[];
2484
- classification: 'normal' | 'anomalous' | 'unclassified';
2485
- predicted_next?: PatternPrediction;
2486
- }
2487
- interface PatternSignature {
2488
- intent_sequence?: string[];
2489
- stitch_kinds?: StitchKind[];
2490
- knot_type?: KnotType;
2491
- knot_size?: number;
2492
- state_keys?: string[];
2493
- state_mutations?: Record<string, 'created' | 'updated' | 'deleted'>;
2494
- decision_outcome?: string;
2495
- actor?: string;
2496
- min_length?: number;
2497
- max_length?: number;
2498
- }
2499
- interface PatternMatch {
2500
- pattern_id: string;
2501
- matched_stitch_ids: string[];
2502
- matched_knot_ids?: string[];
2503
- match_score: number;
2504
- thread_id: string;
2505
- detected_at: number;
2506
- }
2507
- interface PatternPrediction {
2508
- next_intent: string;
2509
- confidence: PatternConfidence;
2510
- alternatives: Array<{
2511
- intent: string;
2512
- confidence: PatternConfidence;
2513
- }>;
2514
- predicted_outcome?: string;
2515
- risk_note?: string;
2516
- }
2517
- interface PatternStore {
2518
- save(pattern: Pattern): void;
2519
- get(patternId: string): Pattern | undefined;
2520
- findByKind(kind: PatternKind): Pattern[];
2521
- findByIntent(intent: string): Pattern[];
2522
- all(): Pattern[];
2523
- }
2524
-
2525
- declare class InMemoryPatternStore implements PatternStore {
2526
- private patterns;
2527
- save(pattern: Pattern): void;
2528
- get(patternId: string): Pattern | undefined;
2529
- findByKind(kind: PatternKind): Pattern[];
2530
- findByIntent(intent: string): Pattern[];
2531
- all(): Pattern[];
2532
- }
2533
- declare function detectSequencePatterns(stitches: Stitch[], windowSize: number, minOccurrences: number): Pattern[];
2534
- declare function detectKnotPatterns(knots: Knot[], minOccurrences: number): Pattern[];
2535
- declare function matchPatterns(stitches: Stitch[], patterns: Pattern[]): PatternMatch[];
2536
- declare function recordOccurrence(pattern: Pattern, threadId: string): void;
2537
- declare function detectAnomalies(recentStitches: Stitch[], knownPatterns: Pattern[], threshold?: number): Pattern[];
2538
-
2539
- interface TpsSensorOptions {
2540
- maxDriftMs?: number;
2541
- resolver?: (tps: string) => number | null;
2542
- }
2543
- declare class TpsSensor implements AxisSensor {
2544
- readonly name = "TpsSensor";
2545
- readonly order: number;
2546
- private readonly maxDriftMs;
2547
- private readonly resolver;
2548
- constructor(options?: TpsSensorOptions);
2549
- supports(input: SensorInput): boolean;
2550
- run(input: SensorInput): Promise<SensorDecision>;
2551
- }
2552
-
2553
- type RiskSignalCollector = (input: SensorInput) => Promise<RiskSignal[]> | RiskSignal[];
2554
- interface RiskGateSensorOptions {
2555
- collectors: RiskSignalCollector[];
2556
- denyThreshold?: number;
2557
- flagThreshold?: number;
2558
- }
2559
- declare class RiskGateSensor implements AxisSensor {
2560
- readonly name = "RiskGateSensor";
2561
- readonly order: number;
2562
- private readonly collectors;
2563
- private readonly denyThreshold;
2564
- private readonly flagThreshold;
2565
- constructor(options: RiskGateSensorOptions);
2566
- run(input: SensorInput): Promise<SensorDecision>;
2567
- private evaluate;
2568
- }
2569
-
2570
- interface TickAuthCapsuleRef {
2571
- capsule_id: string;
2572
- capsule_type?: string;
2573
- intent?: string;
2574
- mode?: string;
2575
- verification?: {
2576
- status: 'approved' | 'denied' | 'expired' | 'replay_rejected' | 'consumed' | 'revoked';
2577
- reason?: string;
2578
- };
2579
- scope?: string[];
2580
- single_use?: boolean;
2581
- tick_index?: number;
2582
- }
2583
- type TickAuthVerifier = (capsule: TickAuthCapsuleRef, input: SensorInput) => Promise<string | null> | (string | null);
2584
- interface TickAuthSensorOptions {
2585
- verifier?: TickAuthVerifier;
2586
- matchIntent?: boolean;
2587
- acceptTypes?: string[];
2588
- }
2589
- declare class TickAuthSensor implements AxisSensor {
2590
- readonly name = "TickAuthSensor";
2591
- readonly order: number;
2592
- private readonly verifier?;
2593
- private readonly matchIntent;
2594
- private readonly acceptTypes;
2595
- constructor(options?: TickAuthSensorOptions);
2596
- supports(input: SensorInput): boolean;
2597
- run(input: SensorInput): Promise<SensorDecision>;
2598
- }
2599
-
2600
- export { ATS1_HDR, ATS1_SCHEMA, AXIS_ANONYMOUS_KEY, AXIS_EXECUTION_CONTEXT_KEY, AXIS_META_KEY, AXIS_OPCODES, AXIS_PUBLIC_KEY, AXIS_RATE_LIMIT_KEY, AXIS_UPLOAD_FILE_STORE, AXIS_UPLOAD_RECEIPT_SIGNER, AXIS_UPLOAD_SESSION_STORE, type AlternativeIntent, type Anomaly, type AnomalyLevel, ats1 as Ats1Codec, Axis, Axis1DecodedFrame, type AxisAlg$1 as AxisAlg, AxisAnonymous, type AxisPacket as AxisBinaryPacket, type AxisCapsule, type AxisCapsuleConstraints, type AxisCapsulePayload, type AxisCapsuleRef, type AxisChainEncryption, type AxisChainEnvelope, AxisChainExecutor, type AxisChainRequest, type AxisChainResult, type AxisChainStatus, type AxisChainStep, type AxisChainStepResult, type AxisChainStepStatus, AxisContext, type AxisCrudHandler, type AxisDecoded, AxisDemoPubkey, type AxisEffect, type AxisExecutionContext, type AxisExecutionMode, AxisFilesDownloadHandler, AxisFilesFinalizeHandler, type AxisHandler, type AxisHandlerInit, AxisIdDto, type AxisIntentEnvelope, type AxisIntentObserver, type AxisIntentSensorOptions, type AxisIntentSensorRef, AxisIp, type AxisAlg as AxisJsonAlg, type AxisFrame as AxisJsonFrame, type AxisResponse as AxisJsonResponse, type AxisSig as AxisJsonSig, type AxisKeyExchangeRef, type AxisLawArticleSummary, type AxisLawDecision, type AxisLawEvaluationContext, type AxisLawEvaluationResult, type AxisLawEvaluator, AxisMediaTypes, type AxisObservation, type AxisObservedContext, type AxisObserverBinding, type AxisObserverBindingOptions, type AxisObserverContext, type AxisObserverDefinition, type AxisObserverEvent, type AxisObserverRef, type AxisObserverRegistration, type AxisPacket$1 as AxisPacket, T as AxisPacketTags, AxisPartialType, type AxisPostSensor, type AxisPreSensor, AxisPublic, AxisRateLimit, type AxisRateLimitConfig, AxisRaw, type AxisRequestContext, type AxisRequestData, AxisResponseDto, type AxisSensor, AxisSensorChainService, type AxisSensorInit, type AxisSig$1 as AxisSig, AxisTlvDto, BAND, CAPABILITIES, CAPSULE_POLICY_METADATA_KEY, CCE_ERROR, CCE_PROTOCOL_VERSION, CHAIN_METADATA_KEY, CONTRACT_METADATA_KEY, type Capability, Capsule, type CapsuleMode, CapsulePolicy, type CapsulePolicyOptions, type CapsuleScopeMode, type CceCapsuleClaims as CceCapsuleClaimsType, CceError, type CceExecutionContext as CceExecutionContextType, type CceHandler, type CceHandlerContext, type CceHandlerResult, type CcePipelineConfig, type CcePipelineResult, type CcePolicyContext, type CcePolicyDecision, type CcePolicyEvaluator, type CceRequestEnvelope as CceRequestEnvelopeType, type CceResponseEnvelope as CceResponseEnvelopeType, type CceWitnessRecord as CceWitnessRecordType, Chain, type ChainOptions, type ChainResult, type ClarificationQuestion, type CompilationError, type CompilationResult, type CompiledIntent, type ConstraintKind, Contract, ContractViolationError, DEFAULT_CONTRACTS, DEFAULT_TIMEOUT, Decision, DiskUploadFileStore, type DtoSchema, type ExecutionContract, ExecutionMeter, type ExecutionMetrics, type ExpectedOutcome, FALLBACK_CONTRACT, type Fabric, type FabricCell, type FabricDiff, type FabricDiffEntry, type FabricDiffKind, type FabricEffect, type FabricEffectResolver, type FabricQuery, type ForkRequest, type ForkResult, type Grant, type GrantCapability, type GrantMeta, type GrantStatus, type GrantType, type GrantValidationResult, HANDLER_METADATA_KEY, HANDLER_SENSORS_KEY, Handler, HandlerDiscoveryService, HandlerSensors, INTENT_BODY_KEY, INTENT_METADATA_KEY, INTENT_REQUIREMENTS, INTENT_ROUTES_KEY, INTENT_SENSITIVITY_MAP, INTENT_SENSORS_KEY, INTENT_TIMEOUTS, IdelCompiler, IdelSchemaRegistry, InMemoryPatternStore, InMemoryTimelineStore, Intent, IntentBody, type IntentConstraint, type IntentDefinition, type IntentKind, type IntentOptions, type IntentParamSchema, type IntentProposal, type IntentRisk, type IntentRoute, IntentRouter, type IntentSchema, IntentSensitivity, IntentSensors, type IntentTlvField, type KeyStatus, type Knot, type KnotBreakRequest, type KnotError, type KnotStatus, type KnotType, type KnotValidationResult, type LawEvaluationSensorOptions, type LoomExecutionResult, type LoomReceipt, type LoomValidationResult, type Needle, type NeedleError, type NeedleHandler, type NeedleHandlerContext, type NeedleHandlerResult, type NeedlePhase, type NeedlePipelineConfig, type NeedlePipelineResult, OBSERVER_BINDINGS_KEY, OBSERVER_METADATA_KEY, type ObservationQueueConfig, type ObservationQueueMessage, type ObservationSensor, type ObservationStage, type ObservationStreamEntry, type ObservationWitnessSummary, type ObservedDeed, Observer, ObserverDiscoveryService, ObserverDispatcherService, ObserverRegistry, type ObserverVerdict, PRE_DECODE_BOUNDARY, PROOF_CAPABILITIES, type Pattern, type PatternConfidence, type PatternKind, type PatternMatch, type PatternPrediction, type PatternSignature, type PatternStore, type PresenceChallenge, type PresenceDeclaration, type PresenceProof, type PresenceReceipt, type PresenceStatus, type PresenceVerifyResult, REQUIRED_PROOF_METADATA_KEY, RESPONSE_TAG_CREATED_AT, RESPONSE_TAG_CREATED_BY, RESPONSE_TAG_ID, RESPONSE_TAG_UPDATED_AT, RESPONSE_TAG_UPDATED_BY, type ReceiptEffect, type RegisteredChainConfig, type ReplayDifference, type ReplayRequest, type ReplayResult, RequiredProof, type RequiredProofKind, type ResponseContract, ResponseObserver, type ResponseObserverContext, type Revocation, type RevocationTargetType, RiskDecision, type RiskEvaluation, RiskGateSensor, type RiskGateSensorOptions, type RiskLevel, type RiskSignal, type RiskSignalCollector, SENSITIVITY_METADATA_KEY, SENSOR_METADATA_KEY, Schema2002_PasskeyLoginOptionsRes, Schema2011_PasskeyLoginVerifyReq, Schema2012_PasskeyLoginVerifyRes, Schema2021_PasskeyRegisterOptionsReq, Sensitivity, Sensor, type SensorBand, type SensorDecision, SensorDecisions, SensorDiscoveryService, type SensorInput, type SensorMinifiedDecision, type SensorOptions, type SensorPhase, type SensorPhaseMetadata, SensorRegistry, type SimulatedSideEffect, type SimulationRequest, type SimulationResult, type StateSnapshot, type Stitch, type StitchKind, TLV_FIELDS_KEY, TLV_VALIDATORS_KEY, type Thread, type ThreadState, type TickAuthCapsuleRef, TickAuthSensor, type TickAuthSensorOptions, type TickAuthVerifier, type TimelineBranch, type TimelineComparison, type TimelineDomain, TimelineEngine, type TimelineEvent, type TimelineEventStatus, type TimelineHandler, type TimelineHandlerContext, type TimelineHandlerResult, type TimelineStore, TlvEnum, TlvField, type TlvFieldKind, type TlvFieldMeta, type TlvFieldOptions, TlvMinLen, TlvRange, TlvUtf8Pattern, TlvValidate, type TlvValidatorFn, type TlvValidatorMeta, TpsSensor, type TpsSensorOptions, type TruthStatus, type TruthVerdict, type UnsignedObservationWitness, type UploadFileStat, type UploadFileStore, type UploadReceiptSigner, type UploadSessionRecord, type UploadSessionStatus, type UploadSessionStore, Witness, type Writ, type WritBody, type WritHead, type WritMeta, type WritSignature, type WritValidationResult, addStitchToKnot, applyStitch, assembleNeedle, b64urlDecode, b64urlDecodeString, b64urlEncode, b64urlEncodeString, breakKnot, buildAts1Hdr, buildAxisLawEvaluationContext, buildDtoDecoder, buildPacket, buildQueueMessage, buildReceiptHash, buildTLVs, buildUnsignedWitness, bytes, canAccessResource, canonicalJson, canonicalJsonExcluding, canonicalizeGrant, canonicalizeObservation, canonicalizeWrit, classifyIntent, createFabric, createGrant, createObservation, createPresenceChallenge, createReceipt, createRevocation, createWrit, decodeQueueMessage, deriveAnchorReflection, detectAnomalies, detectKnotPatterns, detectSequencePatterns, diffFabrics, encVarint, encodeAxisTlvDto, encodeQueueMessage, endStage, executeCcePipeline, executeLoomPipeline, extractDtoSchema, finalizeObservation, findKnotsForStitch, forkFromKnot, formStitch, getAxisExecutionContext, getDecisionPoints, getFabricValue, getGrantStatus, getIrreversibleKnots, getPresenceStatus, grantCoversAction, hasScope, hashObservation, isAdminOpcode, isKnotOpen, isKnownOpcode, isPointOfNoReturn, isRevoked, isTimestampValid, lockCells, matchPatterns, mergeAxisExecutionContext, nonce16, normalizeSensorDecision, openKnot, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, parseAutoClaimEntries, parseScope, parseStreamEntries, projectAt, queryFabric, recordOccurrence, recordSensor, renewPresence, resolveTimeout, runNeedlePipeline, scoreTruth, sensitivityName, signPresenceChallenge, stableJsonStringify, startStage, tieKnot, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, updateThreadState, utf8, validateFrameShape, validateGrant, validateKnot, validateWrit, varintU, verifyObservation, verifyPresenceProof, verifyReceiptChain, verifyResponse, weave, withAxisExecutionContext };
783
+ export { ATS1_HDR, ATS1_SCHEMA, AXIS_EXECUTION_CONTEXT_KEY, AXIS_OPCODES, AXIS_UPLOAD_FILE_STORE, AXIS_UPLOAD_RECEIPT_SIGNER, AXIS_UPLOAD_SESSION_STORE, ats1 as Ats1Codec, Axis1DecodedFrame, type AxisPacket as AxisBinaryPacket, AxisCapsuleRef, AxisChainEnvelope, AxisChainExecutor, AxisChainResult, AxisChainStep, type AxisCrudHandler, type AxisDecoded, type AxisExecutionContext, type AxisHandler, type AxisHandlerInit, AxisIdDto, AxisIntentSensorRef, AxisMediaTypes, AxisObservation, T as AxisPacketTags, AxisPartialType, AxisResponseDto, AxisSensorChainService, AxisTlvDto, BAND, BodyProfile, type BodyProfileValidation, BodyProfileValidator, CAPABILITIES, CHAIN_METADATA_KEY, type Capability, Chain, ChainOptions, type ChainResult, ContractViolationError, DEFAULT_TIMEOUT, type DeviceSEContext, DiskUploadFileStore, type DtoSchema, ExecutionMeter, type ExecutionMetrics, Grant, GrantCapability, GrantStatus, GrantValidationResult, HANDLER_METADATA_KEY, HANDLER_SENSORS_KEY, Handler, HandlerSensors, INTENT_BODY_KEY, INTENT_REQUIREMENTS, INTENT_SENSITIVITY_MAP, INTENT_SENSORS_KEY, INTENT_TIMEOUTS, IntentBody, type IntentDefinition, IntentRouter, IntentSensitivity, IntentSensors, IntentTlvField, type LoomExecutionResult, LoomReceipt, type MTLSContext, type ObservationQueueConfig, type ObservationQueueMessage, type ObservationStreamEntry, type ObservationWitnessSummary, ObserverDispatcherService, type ObserverVerdict, PRE_DECODE_BOUNDARY, PROOF_CAPABILITIES, PresenceChallenge, PresenceDeclaration, PresenceProof, PresenceReceipt, PresenceStatus, PresenceVerifyResult, type ProofType, type ProofVerificationResult, ProofVerificationService, RESPONSE_TAG_CREATED_AT, RESPONSE_TAG_CREATED_BY, RESPONSE_TAG_ID, RESPONSE_TAG_UPDATED_AT, RESPONSE_TAG_UPDATED_BY, type ReceiptEffect, type ResponseContract, ResponseObserver, type ResponseObserverContext, Revocation, SENSOR_METADATA_KEY, Schema2002_PasskeyLoginOptionsRes, Schema2011_PasskeyLoginVerifyReq, Schema2012_PasskeyLoginVerifyRes, Schema2021_PasskeyRegisterOptionsReq, Sensor, type SensorBand, SensorDecision, SensorInput, type SensorOptions, type SensorPhase, SensorRegistry, ThreadState, TlvValidatorFn, type UnsignedObservationWitness, type UploadFileStat, type UploadFileStore, type UploadReceiptSigner, type UploadSessionRecord, type UploadSessionStatus, type UploadSessionStore, Writ, WritBody, WritMeta, WritValidationResult, b64urlDecode, b64urlDecodeString, b64urlEncode, b64urlEncodeString, buildAts1Hdr, buildDtoDecoder, buildPacket, buildQueueMessage, buildReceiptHash, buildTLVs, buildUnsignedWitness, bytes, canAccessResource, canonicalJson, canonicalJsonExcluding, canonicalizeObservation, classifyIntent, createGrant, createPresenceChallenge, createReceipt, createRevocation, createWrit, decodeQueueMessage, encVarint, encodeAxisTlvDto, encodeQueueMessage, executeLoomPipeline, extractDtoSchema, getAxisExecutionContext, getGrantStatus, getPresenceStatus, grantCoversAction, hasScope, hashObservation, isAdminOpcode, isKnownOpcode, isRevoked, isTimestampValid, mergeAxisExecutionContext, nonce16, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, parseAutoClaimEntries, parseScope, parseStreamEntries, renewPresence, resolveTimeout, sensitivityName, signPresenceChallenge, stableJsonStringify, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, updateThreadState, utf8, validateFrameShape, validateGrant, validateWrit, varintU, verifyPresenceProof, verifyReceiptChain, verifyResponse, withAxisExecutionContext };