@eggjs/tegg-types
Advanced tools
@@ -31,3 +31,48 @@ export interface TextInputContentPart { | ||
| } | ||
| export interface SDKSystemMessage { | ||
| /** Per-message timing, stamped by the executor as each message streams in. */ | ||
| export interface MessageTiming { | ||
| /** Epoch ms when the executor received this message — authoritative per-message time. */ | ||
| receivedAtMs: number; | ||
| /** Gap in ms since the previous persisted message's `receivedAtMs`. */ | ||
| sincePrevMs?: number; | ||
| /** assistant only: ms the model took to generate this message (turn `message_start` → arrival). */ | ||
| genMs?: number; | ||
| /** assistant only: time-to-first-token in ms, carried over from the turn's `stream_event`. */ | ||
| ttftMs?: number; | ||
| } | ||
| /** Precise execution timing for a single tool call, derived from PreToolUse / PostToolUse hooks. */ | ||
| export interface ToolTiming { | ||
| toolUseId: string; | ||
| name: string; | ||
| /** Epoch ms when the tool started executing (PreToolUse). */ | ||
| startedAtMs: number; | ||
| /** Epoch ms when the tool finished (PostToolUse); `null` when interrupted before completion. */ | ||
| endedAtMs: number | null; | ||
| /** `endedAtMs - startedAtMs`; `null` when the tool did not finish. */ | ||
| durationMs: number | null; | ||
| isError?: boolean; | ||
| /** Set when the tool ran inside a sub-agent. */ | ||
| agentId?: string; | ||
| } | ||
| /** Single `eggExt` namespace carrying all framework extension fields on a message. */ | ||
| export interface EggExt { | ||
| /** Owning runId. Mirrored here as the forward-looking canonical location; also kept top-level for back-compat. */ | ||
| runId?: string; | ||
| /** Per-message timing. */ | ||
| timing?: MessageTiming; | ||
| /** Per-tool timing; present on `user` messages that carry tool_result blocks. */ | ||
| toolTimings?: ToolTiming[]; | ||
| /** | ||
| * Epoch ms when the store persisted this message (server-side clock). A | ||
| * fallback / drift-calibration timestamp stamped on every persisted message; | ||
| * it never overwrites the executor-stamped per-message `timing`. For input | ||
| * messages (which carry no `timing`) this is their only time field. | ||
| */ | ||
| persistedAtMs?: number; | ||
| } | ||
| /** Mixin giving every AgentMessage member the `eggExt` extension namespace. */ | ||
| export interface AgentMessageExtensions { | ||
| eggExt?: EggExt; | ||
| } | ||
| export interface SDKSystemMessage extends AgentMessageExtensions { | ||
| type: 'system'; | ||
@@ -38,3 +83,3 @@ subtype: string; | ||
| } | ||
| export interface SDKStreamEvent { | ||
| export interface SDKStreamEvent extends AgentMessageExtensions { | ||
| type: 'stream_event'; | ||
@@ -45,3 +90,3 @@ event: unknown; | ||
| } | ||
| export interface SDKUserMessage { | ||
| export interface SDKUserMessage extends AgentMessageExtensions { | ||
| type: 'user'; | ||
@@ -51,3 +96,3 @@ message: unknown; | ||
| } | ||
| export interface SDKAssistantMessage { | ||
| export interface SDKAssistantMessage extends AgentMessageExtensions { | ||
| type: 'assistant'; | ||
@@ -57,3 +102,3 @@ message: unknown; | ||
| } | ||
| export interface SDKResultMessage { | ||
| export interface SDKResultMessage extends AgentMessageExtensions { | ||
| type: 'result'; | ||
@@ -70,3 +115,3 @@ subtype: string; | ||
| } | ||
| export interface SDKGenericMessage { | ||
| export interface SDKGenericMessage extends AgentMessageExtensions { | ||
| type: string; | ||
@@ -73,0 +118,0 @@ [key: string]: unknown; |
@@ -30,2 +30,8 @@ import type { AgentMessage } from './AgentMessage'; | ||
| failedAt?: number | null; | ||
| startedAtMs?: number | null; | ||
| completedAtMs?: number | null; | ||
| /** completedAtMs - startedAtMs (end-to-end run wall time in ms). */ | ||
| durationMs?: number | null; | ||
| /** Sum of result.duration_api_ms across the run (pure model API time in ms). */ | ||
| apiDurationMs?: number | null; | ||
| usage?: { | ||
@@ -32,0 +38,0 @@ promptTokens: number; |
@@ -65,2 +65,8 @@ import type { AgentMessage, InputMessage } from './AgentMessage'; | ||
| failedAt?: number | null; | ||
| startedAtMs?: number | null; | ||
| completedAtMs?: number | null; | ||
| /** completedAtMs - startedAtMs (end-to-end run wall time in ms). */ | ||
| durationMs?: number | null; | ||
| /** Sum of result.duration_api_ms across the run (pure model API time in ms). */ | ||
| apiDurationMs?: number | null; | ||
| } | ||
@@ -67,0 +73,0 @@ export interface AgentStore { |
+2
-2
| { | ||
| "name": "@eggjs/tegg-types", | ||
| "version": "3.83.0", | ||
| "version": "3.84.0", | ||
| "description": "tegg types", | ||
@@ -48,3 +48,3 @@ "keywords": [ | ||
| }, | ||
| "gitHead": "a027c9c8b0a0308f47b678959aae0ae2bfdb183c" | ||
| "gitHead": "5829c6060f5052ca9061cbf258a4d2407e42191f" | ||
| } |
137706
2.14%2755
2.11%