@company-semantics/contracts 0.78.0 → 0.79.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "0.78.0",
3
+ "version": "0.79.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.ts CHANGED
@@ -477,3 +477,10 @@ export type {
477
477
  UsageByUser,
478
478
  OrgUsageResponse,
479
479
  } from './usage/types'
480
+
481
+ // Runtime execution telemetry types
482
+ // @see PRD-00200 for design rationale
483
+ export type {
484
+ ExecutionFailureReason,
485
+ RuntimeExecutionTelemetry,
486
+ } from './usage/execution-types'
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Runtime Execution Telemetry Types
3
+ * One execution = one user message -> full assistant response (including tool loops).
4
+ * See PRD-00200 for design rationale and invariants.
5
+ */
6
+
7
+ import type { ChatRuntimeProfile } from '../chat/runtime-profile'
8
+
9
+ export type ExecutionFailureReason =
10
+ | 'tool_error'
11
+ | 'timeout'
12
+ | 'model_error'
13
+ | 'budget_exceeded'
14
+ | 'client_disconnect'
15
+ | 'unknown'
16
+
17
+ export interface RuntimeExecutionTelemetry {
18
+ executionId: string
19
+ orgId: string
20
+ chatId?: string
21
+ messageId?: string
22
+ profile: ChatRuntimeProfile
23
+ provider: string
24
+ model: string
25
+ stepCount: number
26
+ toolCallCount: number
27
+ tokensInput: number
28
+ tokensOutput: number
29
+ tokensTotal: number
30
+ costInputUsd: string // 8 decimal places
31
+ costOutputUsd: string // 8 decimal places
32
+ costTotalUsd: string // 8 decimal places
33
+ durationMs: number
34
+ success: boolean
35
+ failureReason?: ExecutionFailureReason
36
+ createdAt: string // ISO 8601
37
+ }