@replayci/replay 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +458 -66
- package/dist/index.d.cts +48 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +458 -66
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -375,6 +375,41 @@ interface Store {
|
|
|
375
375
|
* @see specs/replay-v1.md § SDK API surface
|
|
376
376
|
*/
|
|
377
377
|
|
|
378
|
+
/**
|
|
379
|
+
* Stage identifiers for the enforcement pipeline decision trace.
|
|
380
|
+
* @see specs/decision-trace.md § Core types
|
|
381
|
+
*/
|
|
382
|
+
type TraceStage = "extract" | "narrow" | "pre_check" | "validate" | "cross_step" | "phase" | "policy" | "limit" | "gate" | "execute" | "finalize";
|
|
383
|
+
/**
|
|
384
|
+
* A single decision entry in the enforcement trace.
|
|
385
|
+
* @see specs/decision-trace.md § Core types
|
|
386
|
+
*/
|
|
387
|
+
type TraceEntry = {
|
|
388
|
+
stage: TraceStage;
|
|
389
|
+
tool: string | null;
|
|
390
|
+
verdict: "allow" | "remove" | "block" | "narrow" | "skip" | "info" | "error";
|
|
391
|
+
reason: string;
|
|
392
|
+
checked: Record<string, unknown>;
|
|
393
|
+
found: Record<string, unknown>;
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* Push-only interface passed to stage functions.
|
|
397
|
+
* @see specs/decision-trace.md § TraceContext
|
|
398
|
+
*/
|
|
399
|
+
type TraceContext = {
|
|
400
|
+
push(entry: TraceEntry): void;
|
|
401
|
+
readonly entries: readonly TraceEntry[];
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Full decision trace for one enforcement cycle.
|
|
405
|
+
* @see specs/decision-trace.md § Core types
|
|
406
|
+
*/
|
|
407
|
+
type DecisionTrace = {
|
|
408
|
+
sessionId: string;
|
|
409
|
+
stepIndex: number;
|
|
410
|
+
complete: boolean;
|
|
411
|
+
entries: TraceEntry[];
|
|
412
|
+
};
|
|
378
413
|
/**
|
|
379
414
|
* Workflow attachment options for `replay()`.
|
|
380
415
|
* Either root-create or child-attach — never both.
|
|
@@ -536,6 +571,12 @@ type ReplaySession<T> = {
|
|
|
536
571
|
* Returns null when not in shadow mode or before first call.
|
|
537
572
|
*/
|
|
538
573
|
getLastShadowDelta: () => ShadowDelta | null;
|
|
574
|
+
/**
|
|
575
|
+
* Return the DecisionTrace for the most recent enforcement cycle.
|
|
576
|
+
* Returns null before the first call. Returns partial traces (complete: false) after faults.
|
|
577
|
+
* @see specs/decision-trace.md § session.getLastTrace()
|
|
578
|
+
*/
|
|
579
|
+
getLastTrace: () => DecisionTrace | null;
|
|
539
580
|
/**
|
|
540
581
|
* v3: Manually restrict available tools within compiled legal space.
|
|
541
582
|
* Cannot add tools that the compiled session would remove.
|
|
@@ -744,6 +785,8 @@ type ReplayCapture = CapturedCall & {
|
|
|
744
785
|
phase: string | null;
|
|
745
786
|
phase_transition: string | null;
|
|
746
787
|
shadow_delta?: ShadowDelta;
|
|
788
|
+
/** Decision trace for this enforcement cycle. Optional for backward compat. */
|
|
789
|
+
trace?: DecisionTrace;
|
|
747
790
|
receipt: null;
|
|
748
791
|
};
|
|
749
792
|
};
|
|
@@ -850,6 +893,10 @@ type ReplayDiagnosticEvent = {
|
|
|
850
893
|
type: "replay_capture_error";
|
|
851
894
|
session_id: string;
|
|
852
895
|
details: string;
|
|
896
|
+
} | {
|
|
897
|
+
type: "replay_trace";
|
|
898
|
+
session_id: string;
|
|
899
|
+
trace: DecisionTrace;
|
|
853
900
|
};
|
|
854
901
|
/**
|
|
855
902
|
* Workflow state snapshot returned by `session.getWorkflowState()`.
|
|
@@ -1171,4 +1218,4 @@ declare class RuntimeClient {
|
|
|
1171
1218
|
private recordFailure;
|
|
1172
1219
|
}
|
|
1173
1220
|
|
|
1174
|
-
export { type BlockReason, type BlockedToolCall, type CircuitBreakerResult, type CompareAndSetResult, type CompletedStep, type CompletedStepSnapshot, type CompletedToolCall, type CompletedToolCallSnapshot, type ConstraintFailure, type ConstraintVerdict, type ContractFailure, type CrossStepCaptureResult, type CrossStepFailure, type CrossStepResult, type DecisionOutcome, type FlushResult, type GateMode, type LoopDetectionResult, MemoryStore, type NarrowRemovalReason, type NarrowResult, type NarrowedTool, type ObserveActivationReasonCode, type ObserveDiagnosticEvent, type ObserveHandle, type ObserveHealthSnapshot, type ObserveOptions, type ObserveSessionState, type PendingEntry, type PhaseTransitionResult, type PolicyVerdict, type PreconditionEvidence, type ReplayCapture, ReplayConfigError, ReplayContractError, type ReplayDecision, type ReplayDiagnosticEvent, type ReplayHealthSnapshot, ReplayKillError, type ReplayMode, type ReplayOptions, type ReplaySession, type ReplayTiming, type ResponseMetadata, RuntimeClient, RuntimeClientError, type RuntimeClientHealth, type RuntimeClientOptions, type RuntimeSessionInit, type RuntimeSessionResult, type SessionState, type SessionStateSnapshot, type ShadowDelta, type Store, type ToolDefinition, type ToolExecutor, type ValidationResult, type WrappedExecutorResult, type WrappedToolExecutor, createRuntimeClient, observe, prepareContracts, replay, validate };
|
|
1221
|
+
export { type BlockReason, type BlockedToolCall, type CircuitBreakerResult, type CompareAndSetResult, type CompletedStep, type CompletedStepSnapshot, type CompletedToolCall, type CompletedToolCallSnapshot, type ConstraintFailure, type ConstraintVerdict, type ContractFailure, type CrossStepCaptureResult, type CrossStepFailure, type CrossStepResult, type DecisionOutcome, type DecisionTrace, type FlushResult, type GateMode, type LoopDetectionResult, MemoryStore, type NarrowRemovalReason, type NarrowResult, type NarrowedTool, type ObserveActivationReasonCode, type ObserveDiagnosticEvent, type ObserveHandle, type ObserveHealthSnapshot, type ObserveOptions, type ObserveSessionState, type PendingEntry, type PhaseTransitionResult, type PolicyVerdict, type PreconditionEvidence, type ReplayCapture, ReplayConfigError, ReplayContractError, type ReplayDecision, type ReplayDiagnosticEvent, type ReplayHealthSnapshot, ReplayKillError, type ReplayMode, type ReplayOptions, type ReplaySession, type ReplayTiming, type ResponseMetadata, RuntimeClient, RuntimeClientError, type RuntimeClientHealth, type RuntimeClientOptions, type RuntimeSessionInit, type RuntimeSessionResult, type SessionState, type SessionStateSnapshot, type ShadowDelta, type Store, type ToolDefinition, type ToolExecutor, type TraceContext, type TraceEntry, type TraceStage, type ValidationResult, type WrappedExecutorResult, type WrappedToolExecutor, createRuntimeClient, observe, prepareContracts, replay, validate };
|
package/dist/index.d.ts
CHANGED
|
@@ -375,6 +375,41 @@ interface Store {
|
|
|
375
375
|
* @see specs/replay-v1.md § SDK API surface
|
|
376
376
|
*/
|
|
377
377
|
|
|
378
|
+
/**
|
|
379
|
+
* Stage identifiers for the enforcement pipeline decision trace.
|
|
380
|
+
* @see specs/decision-trace.md § Core types
|
|
381
|
+
*/
|
|
382
|
+
type TraceStage = "extract" | "narrow" | "pre_check" | "validate" | "cross_step" | "phase" | "policy" | "limit" | "gate" | "execute" | "finalize";
|
|
383
|
+
/**
|
|
384
|
+
* A single decision entry in the enforcement trace.
|
|
385
|
+
* @see specs/decision-trace.md § Core types
|
|
386
|
+
*/
|
|
387
|
+
type TraceEntry = {
|
|
388
|
+
stage: TraceStage;
|
|
389
|
+
tool: string | null;
|
|
390
|
+
verdict: "allow" | "remove" | "block" | "narrow" | "skip" | "info" | "error";
|
|
391
|
+
reason: string;
|
|
392
|
+
checked: Record<string, unknown>;
|
|
393
|
+
found: Record<string, unknown>;
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* Push-only interface passed to stage functions.
|
|
397
|
+
* @see specs/decision-trace.md § TraceContext
|
|
398
|
+
*/
|
|
399
|
+
type TraceContext = {
|
|
400
|
+
push(entry: TraceEntry): void;
|
|
401
|
+
readonly entries: readonly TraceEntry[];
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Full decision trace for one enforcement cycle.
|
|
405
|
+
* @see specs/decision-trace.md § Core types
|
|
406
|
+
*/
|
|
407
|
+
type DecisionTrace = {
|
|
408
|
+
sessionId: string;
|
|
409
|
+
stepIndex: number;
|
|
410
|
+
complete: boolean;
|
|
411
|
+
entries: TraceEntry[];
|
|
412
|
+
};
|
|
378
413
|
/**
|
|
379
414
|
* Workflow attachment options for `replay()`.
|
|
380
415
|
* Either root-create or child-attach — never both.
|
|
@@ -536,6 +571,12 @@ type ReplaySession<T> = {
|
|
|
536
571
|
* Returns null when not in shadow mode or before first call.
|
|
537
572
|
*/
|
|
538
573
|
getLastShadowDelta: () => ShadowDelta | null;
|
|
574
|
+
/**
|
|
575
|
+
* Return the DecisionTrace for the most recent enforcement cycle.
|
|
576
|
+
* Returns null before the first call. Returns partial traces (complete: false) after faults.
|
|
577
|
+
* @see specs/decision-trace.md § session.getLastTrace()
|
|
578
|
+
*/
|
|
579
|
+
getLastTrace: () => DecisionTrace | null;
|
|
539
580
|
/**
|
|
540
581
|
* v3: Manually restrict available tools within compiled legal space.
|
|
541
582
|
* Cannot add tools that the compiled session would remove.
|
|
@@ -744,6 +785,8 @@ type ReplayCapture = CapturedCall & {
|
|
|
744
785
|
phase: string | null;
|
|
745
786
|
phase_transition: string | null;
|
|
746
787
|
shadow_delta?: ShadowDelta;
|
|
788
|
+
/** Decision trace for this enforcement cycle. Optional for backward compat. */
|
|
789
|
+
trace?: DecisionTrace;
|
|
747
790
|
receipt: null;
|
|
748
791
|
};
|
|
749
792
|
};
|
|
@@ -850,6 +893,10 @@ type ReplayDiagnosticEvent = {
|
|
|
850
893
|
type: "replay_capture_error";
|
|
851
894
|
session_id: string;
|
|
852
895
|
details: string;
|
|
896
|
+
} | {
|
|
897
|
+
type: "replay_trace";
|
|
898
|
+
session_id: string;
|
|
899
|
+
trace: DecisionTrace;
|
|
853
900
|
};
|
|
854
901
|
/**
|
|
855
902
|
* Workflow state snapshot returned by `session.getWorkflowState()`.
|
|
@@ -1171,4 +1218,4 @@ declare class RuntimeClient {
|
|
|
1171
1218
|
private recordFailure;
|
|
1172
1219
|
}
|
|
1173
1220
|
|
|
1174
|
-
export { type BlockReason, type BlockedToolCall, type CircuitBreakerResult, type CompareAndSetResult, type CompletedStep, type CompletedStepSnapshot, type CompletedToolCall, type CompletedToolCallSnapshot, type ConstraintFailure, type ConstraintVerdict, type ContractFailure, type CrossStepCaptureResult, type CrossStepFailure, type CrossStepResult, type DecisionOutcome, type FlushResult, type GateMode, type LoopDetectionResult, MemoryStore, type NarrowRemovalReason, type NarrowResult, type NarrowedTool, type ObserveActivationReasonCode, type ObserveDiagnosticEvent, type ObserveHandle, type ObserveHealthSnapshot, type ObserveOptions, type ObserveSessionState, type PendingEntry, type PhaseTransitionResult, type PolicyVerdict, type PreconditionEvidence, type ReplayCapture, ReplayConfigError, ReplayContractError, type ReplayDecision, type ReplayDiagnosticEvent, type ReplayHealthSnapshot, ReplayKillError, type ReplayMode, type ReplayOptions, type ReplaySession, type ReplayTiming, type ResponseMetadata, RuntimeClient, RuntimeClientError, type RuntimeClientHealth, type RuntimeClientOptions, type RuntimeSessionInit, type RuntimeSessionResult, type SessionState, type SessionStateSnapshot, type ShadowDelta, type Store, type ToolDefinition, type ToolExecutor, type ValidationResult, type WrappedExecutorResult, type WrappedToolExecutor, createRuntimeClient, observe, prepareContracts, replay, validate };
|
|
1221
|
+
export { type BlockReason, type BlockedToolCall, type CircuitBreakerResult, type CompareAndSetResult, type CompletedStep, type CompletedStepSnapshot, type CompletedToolCall, type CompletedToolCallSnapshot, type ConstraintFailure, type ConstraintVerdict, type ContractFailure, type CrossStepCaptureResult, type CrossStepFailure, type CrossStepResult, type DecisionOutcome, type DecisionTrace, type FlushResult, type GateMode, type LoopDetectionResult, MemoryStore, type NarrowRemovalReason, type NarrowResult, type NarrowedTool, type ObserveActivationReasonCode, type ObserveDiagnosticEvent, type ObserveHandle, type ObserveHealthSnapshot, type ObserveOptions, type ObserveSessionState, type PendingEntry, type PhaseTransitionResult, type PolicyVerdict, type PreconditionEvidence, type ReplayCapture, ReplayConfigError, ReplayContractError, type ReplayDecision, type ReplayDiagnosticEvent, type ReplayHealthSnapshot, ReplayKillError, type ReplayMode, type ReplayOptions, type ReplaySession, type ReplayTiming, type ResponseMetadata, RuntimeClient, RuntimeClientError, type RuntimeClientHealth, type RuntimeClientOptions, type RuntimeSessionInit, type RuntimeSessionResult, type SessionState, type SessionStateSnapshot, type ShadowDelta, type Store, type ToolDefinition, type ToolExecutor, type TraceContext, type TraceEntry, type TraceStage, type ValidationResult, type WrappedExecutorResult, type WrappedToolExecutor, createRuntimeClient, observe, prepareContracts, replay, validate };
|