@omnicross/contracts 0.1.9 → 0.1.10

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.
@@ -28,6 +28,7 @@ var DEFAULT_AUDIT_CONFIG = {
28
28
  captureBodies: false,
29
29
  maxBodyBytes: -1,
30
30
  retentionDays: 7,
31
+ compactStreamingBodies: false,
31
32
  trustForwardedFor: false
32
33
  };
33
34
  // Annotate the CommonJS export names for ESM import in node:
@@ -28,6 +28,19 @@ interface AuditRecord {
28
28
  id: string;
29
29
  /** Epoch ms the request was captured. */
30
30
  ts: number;
31
+ /**
32
+ * Derived conversation-session key (a truncated SHA-256 digest — NEVER a raw
33
+ * client id or prompt). Groups the turns of one conversation so the body store
34
+ * can shard by session and delta-encode each turn against the previous one.
35
+ * Absent on a pre-upgrade record and whenever no key could be derived.
36
+ */
37
+ sessionKey?: string;
38
+ /**
39
+ * True when a body snapshot for this record exists in the session body store.
40
+ * The metadata line itself never carries the payload — fetch it through the
41
+ * authed body query.
42
+ */
43
+ hasBody?: boolean;
31
44
  /** Outbound key id (attribution) — NEVER the key secret/hash. Null when unauthenticated. */
32
45
  keyId?: string | null;
33
46
  /** Client IP (PII). Socket address by default; a trusted forwarded header only when configured. */
@@ -80,6 +93,13 @@ interface AuditConfig {
80
93
  maxBodyBytes: number;
81
94
  /** TTL retention in days; default 7, clamped `[1, 365]`. */
82
95
  retentionDays: number;
96
+ /**
97
+ * Collapse streaming text deltas in a captured response body into one contiguous
98
+ * block (default FALSE — the raw frame sequence is stored verbatim). Every
99
+ * NON-delta frame is kept either way, so `response.failed` / `error` / usage
100
+ * frames stay visible; only the per-token `*_delta` envelopes are merged.
101
+ */
102
+ compactStreamingBodies: boolean;
83
103
  /**
84
104
  * Trust the `X-Forwarded-For` header for the client IP (LEAD OQ1 anti-spoof).
85
105
  * Default FALSE — the socket remote address is authoritative. Only set true
@@ -94,6 +114,17 @@ declare const DEFAULT_AUDIT_CONFIG: AuditConfig;
94
114
  interface AuditQueryResult {
95
115
  records: AuditRecord[];
96
116
  }
117
+ /**
118
+ * The reconstructed body pair for ONE audit record, returned by the authed body
119
+ * query. Bodies live in the per-session delta store rather than inline on the
120
+ * metadata line, so reading one is an explicit second call.
121
+ */
122
+ interface AuditBodyResult {
123
+ /** Reconstructed request body, or absent when none was captured. */
124
+ requestBody?: string;
125
+ /** Reconstructed response body, or absent when none was captured. */
126
+ responseBody?: string;
127
+ }
97
128
  /** Metadata-only aggregate for an audit time window (body payloads are never returned). */
98
129
  interface AuditStats {
99
130
  requestCount: number;
@@ -102,4 +133,4 @@ interface AuditStats {
102
133
  complete: boolean;
103
134
  }
104
135
 
105
- export { type AuditConfig, type AuditQueryResult, type AuditRecord, type AuditStats, DEFAULT_AUDIT_CONFIG };
136
+ export { type AuditBodyResult, type AuditConfig, type AuditQueryResult, type AuditRecord, type AuditStats, DEFAULT_AUDIT_CONFIG };
@@ -28,6 +28,19 @@ interface AuditRecord {
28
28
  id: string;
29
29
  /** Epoch ms the request was captured. */
30
30
  ts: number;
31
+ /**
32
+ * Derived conversation-session key (a truncated SHA-256 digest — NEVER a raw
33
+ * client id or prompt). Groups the turns of one conversation so the body store
34
+ * can shard by session and delta-encode each turn against the previous one.
35
+ * Absent on a pre-upgrade record and whenever no key could be derived.
36
+ */
37
+ sessionKey?: string;
38
+ /**
39
+ * True when a body snapshot for this record exists in the session body store.
40
+ * The metadata line itself never carries the payload — fetch it through the
41
+ * authed body query.
42
+ */
43
+ hasBody?: boolean;
31
44
  /** Outbound key id (attribution) — NEVER the key secret/hash. Null when unauthenticated. */
32
45
  keyId?: string | null;
33
46
  /** Client IP (PII). Socket address by default; a trusted forwarded header only when configured. */
@@ -80,6 +93,13 @@ interface AuditConfig {
80
93
  maxBodyBytes: number;
81
94
  /** TTL retention in days; default 7, clamped `[1, 365]`. */
82
95
  retentionDays: number;
96
+ /**
97
+ * Collapse streaming text deltas in a captured response body into one contiguous
98
+ * block (default FALSE — the raw frame sequence is stored verbatim). Every
99
+ * NON-delta frame is kept either way, so `response.failed` / `error` / usage
100
+ * frames stay visible; only the per-token `*_delta` envelopes are merged.
101
+ */
102
+ compactStreamingBodies: boolean;
83
103
  /**
84
104
  * Trust the `X-Forwarded-For` header for the client IP (LEAD OQ1 anti-spoof).
85
105
  * Default FALSE — the socket remote address is authoritative. Only set true
@@ -94,6 +114,17 @@ declare const DEFAULT_AUDIT_CONFIG: AuditConfig;
94
114
  interface AuditQueryResult {
95
115
  records: AuditRecord[];
96
116
  }
117
+ /**
118
+ * The reconstructed body pair for ONE audit record, returned by the authed body
119
+ * query. Bodies live in the per-session delta store rather than inline on the
120
+ * metadata line, so reading one is an explicit second call.
121
+ */
122
+ interface AuditBodyResult {
123
+ /** Reconstructed request body, or absent when none was captured. */
124
+ requestBody?: string;
125
+ /** Reconstructed response body, or absent when none was captured. */
126
+ responseBody?: string;
127
+ }
97
128
  /** Metadata-only aggregate for an audit time window (body payloads are never returned). */
98
129
  interface AuditStats {
99
130
  requestCount: number;
@@ -102,4 +133,4 @@ interface AuditStats {
102
133
  complete: boolean;
103
134
  }
104
135
 
105
- export { type AuditConfig, type AuditQueryResult, type AuditRecord, type AuditStats, DEFAULT_AUDIT_CONFIG };
136
+ export { type AuditBodyResult, type AuditConfig, type AuditQueryResult, type AuditRecord, type AuditStats, DEFAULT_AUDIT_CONFIG };
@@ -4,6 +4,7 @@ var DEFAULT_AUDIT_CONFIG = {
4
4
  captureBodies: false,
5
5
  maxBodyBytes: -1,
6
6
  retentionDays: 7,
7
+ compactStreamingBodies: false,
7
8
  trustForwardedFor: false
8
9
  };
9
10
  export {
package/dist/index.cjs CHANGED
@@ -83,6 +83,7 @@ var DEFAULT_AUDIT_CONFIG = {
83
83
  captureBodies: false,
84
84
  maxBodyBytes: -1,
85
85
  retentionDays: 7,
86
+ compactStreamingBodies: false,
86
87
  trustForwardedFor: false
87
88
  };
88
89
 
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { AccountClientIdentity, AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, ProxyConfig, SanitizedProxyConfig, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, SyncWarningCode, TokenExchangeRequest, TokenStatus } from './account-tokens-types.cjs';
2
2
  import { SubscriptionProviderId } from './subscription-types.cjs';
3
3
  export { OpenCodeGoModelEntry, OpenCodeGoScenario, OpenCodeGoTokenConfig, OpenCodeGoTokenSanitized, ProviderChannel, SubscriptionListEntry, SubscriptionStatusEntry, legacyCliBackendToSubscriptionProvider, subscriptionTargetForSession } from './subscription-types.cjs';
4
- export { AuditConfig, AuditQueryResult, AuditRecord, AuditStats, DEFAULT_AUDIT_CONFIG } from './audit-types.cjs';
4
+ export { AuditBodyResult, AuditConfig, AuditQueryResult, AuditRecord, AuditStats, DEFAULT_AUDIT_CONFIG } from './audit-types.cjs';
5
5
  export { BillingConfig, BillingDeliveryStatus, BillingEvent, DEFAULT_BILLING_CONFIG } from './billing-types.cjs';
6
6
  export { KNOWN_MODELS, KnownModelCapabilities, MODEL_ALIASES, ResolvedModelCapabilities, applyAlias, lookupCanonicalCapabilities, normalizeModelId, resolveModelCapabilities } from './canonical-models.cjs';
7
7
  export { AnthropicAudioContent, AnthropicChatRequest, AnthropicChatResponse, AnthropicContentPart, AnthropicImageContent, AnthropicMessage, AnthropicSystemContent, AnthropicTextContent, AnthropicThinkingContent, AnthropicTool, AnthropicToolResultContent, AnthropicToolUseContent, AnthropicVideoContent, ConversionConfig, OpenAIChatRequest, OpenAIChatResponse, OpenAIContentPart, OpenAIMessage, OpenAIStreamChunk, OpenAITool, OpenAIToolCall, SimpleChatAudio, SimpleChatImage, SimpleChatMessage, SimpleChatSession, SimpleChatVideo } from './completion-types.cjs';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { AccountClientIdentity, AccountTokensConfig, AuthMethod, ClaudeAuthMethod, ClaudeTokenConfig, CodexTokenConfig, GeminiTokenConfig, OAuthParams, ProxyConfig, SanitizedProxyConfig, SubscriptionAccountEntry, SubscriptionAccountSanitized, SubscriptionLevel, SyncWarningCode, TokenExchangeRequest, TokenStatus } from './account-tokens-types.js';
2
2
  import { SubscriptionProviderId } from './subscription-types.js';
3
3
  export { OpenCodeGoModelEntry, OpenCodeGoScenario, OpenCodeGoTokenConfig, OpenCodeGoTokenSanitized, ProviderChannel, SubscriptionListEntry, SubscriptionStatusEntry, legacyCliBackendToSubscriptionProvider, subscriptionTargetForSession } from './subscription-types.js';
4
- export { AuditConfig, AuditQueryResult, AuditRecord, AuditStats, DEFAULT_AUDIT_CONFIG } from './audit-types.js';
4
+ export { AuditBodyResult, AuditConfig, AuditQueryResult, AuditRecord, AuditStats, DEFAULT_AUDIT_CONFIG } from './audit-types.js';
5
5
  export { BillingConfig, BillingDeliveryStatus, BillingEvent, DEFAULT_BILLING_CONFIG } from './billing-types.js';
6
6
  export { KNOWN_MODELS, KnownModelCapabilities, MODEL_ALIASES, ResolvedModelCapabilities, applyAlias, lookupCanonicalCapabilities, normalizeModelId, resolveModelCapabilities } from './canonical-models.js';
7
7
  export { AnthropicAudioContent, AnthropicChatRequest, AnthropicChatResponse, AnthropicContentPart, AnthropicImageContent, AnthropicMessage, AnthropicSystemContent, AnthropicTextContent, AnthropicThinkingContent, AnthropicTool, AnthropicToolResultContent, AnthropicToolUseContent, AnthropicVideoContent, ConversionConfig, OpenAIChatRequest, OpenAIChatResponse, OpenAIContentPart, OpenAIMessage, OpenAIStreamChunk, OpenAITool, OpenAIToolCall, SimpleChatAudio, SimpleChatImage, SimpleChatMessage, SimpleChatSession, SimpleChatVideo } from './completion-types.js';
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ var DEFAULT_AUDIT_CONFIG = {
4
4
  captureBodies: false,
5
5
  maxBodyBytes: -1,
6
6
  retentionDays: 7,
7
+ compactStreamingBodies: false,
7
8
  trustForwardedFor: false
8
9
  };
9
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnicross/contracts",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Dependency-light, host-agnostic contract types + runtime-value helpers shared by the @omnicross/* packages.",
5
5
  "license": "MIT",
6
6
  "author": "Sayo (https://github.com/Dumoedss)",