File size: 2,678 Bytes
4e23b01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import type { AgentId, AttachmentId, FrameId, InteractionId, TaskId, TodoId } from './ids';

export type { InteractionKind, InteractionState } from './interaction';

export type FrameRef = {
  readonly target: 'frame';
  readonly frameId: FrameId;
};

export interface TranscriptSkillActivation {
  readonly skillName: string;
  readonly skillArgs?: string;
}

export type TranscriptUserOrigin = {
  readonly kind: 'user';
  readonly clientMetadata?: readonly Readonly<Record<string, unknown>>[];
  readonly skillActivations?: readonly TranscriptSkillActivation[];
} | {
  readonly kind: 'skill_activation';
  readonly trigger: 'user-slash';
  readonly skillName: string;
  readonly skillArgs?: string;
  readonly clientMetadata?: readonly Readonly<Record<string, unknown>>[];
};

interface TextFrameBase {
  readonly kind: 'text';
  readonly frameId: FrameId;
  readonly text: string;
  readonly attachmentIds?: readonly AttachmentId[];
  readonly taskId?: TaskId;
  readonly promptIds?: readonly string[];
}

export interface AssistantTextFrame extends TextFrameBase {
  readonly role: 'assistant';
  readonly origin?: never;
}

export interface UserTextFrame extends TextFrameBase {
  readonly role: 'user';
  readonly origin?: TranscriptUserOrigin;
}

export type TextFrame = AssistantTextFrame | UserTextFrame;

export interface ThinkingFrame {
  readonly kind: 'thinking';
  readonly frameId: FrameId;
  readonly text: string;
}

export type ToolFrameState = 'running' | 'done' | 'error';

export interface ToolFrameProgress {
  readonly kind: 'stdout' | 'stderr' | 'progress' | 'status' | 'custom';
  readonly text?: string;
  readonly percent?: number;
  readonly customKind?: string;
  readonly customData?: unknown;
}

export interface AgentRef {
  readonly agentId: AgentId;
  readonly role?: 'child' | 'member';
}

export interface ToolCallFrame {
  readonly kind: 'tool';
  readonly frameId: FrameId;
  readonly toolCallId: string;
  readonly name: string;
  readonly view?: string;
  readonly state: ToolFrameState;
  readonly input?: unknown;
  readonly output?: unknown;
  readonly display?: unknown;
  readonly error?: string;
  readonly inputText?: string;
  readonly progress?: ToolFrameProgress;
  readonly taskId?: TaskId;
  readonly approvalId?: InteractionId;
  readonly todoId?: TodoId;
  readonly agentRefs?: readonly AgentRef[];
}

export interface NoticeFrame {
  readonly kind: 'notice';
  readonly frameId: FrameId;
  readonly level: 'error' | 'warning' | 'info';
  readonly source?: string;
  readonly message: string;
  readonly detail?: unknown;
}

export type TranscriptFrame =
  | TextFrame
  | ThinkingFrame
  | ToolCallFrame
  | NoticeFrame;