@arcote.tech/arc-ai 0.7.8 → 0.7.9

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/types.ts +69 -19
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arcote.tech/arc-ai",
3
3
  "type": "module",
4
- "version": "0.7.8",
4
+ "version": "0.7.9",
5
5
  "private": false,
6
6
  "description": "AI provider abstraction, completion tracking, and budget management for Arc framework",
7
7
  "main": "./src/index.ts",
@@ -10,8 +10,8 @@
10
10
  "type-check": "tsc --noEmit"
11
11
  },
12
12
  "peerDependencies": {
13
- "@arcote.tech/arc": "^0.7.8",
14
- "@arcote.tech/arc-auth": "^0.7.8",
13
+ "@arcote.tech/arc": "^0.7.9",
14
+ "@arcote.tech/arc-auth": "^0.7.9",
15
15
  "typescript": "^5.0.0"
16
16
  },
17
17
  "devDependencies": {
package/src/types.ts CHANGED
@@ -119,6 +119,12 @@ export interface CompletionRequest {
119
119
  webSearch?: boolean;
120
120
  temperature?: number;
121
121
  maxTokens?: number;
122
+ /**
123
+ * Reasoning effort dla modeli z reasoning (gpt-5, o-series). "minimal"
124
+ * pomija reasoning step → szybki time-to-first-token. Domyślnie provider
125
+ * wybiera (gpt-5 = medium). Adaptery bez wsparcia ignorują pole.
126
+ */
127
+ reasoningEffort?: "minimal" | "low" | "medium" | "high";
122
128
  }
123
129
 
124
130
  export interface CompletionResult {
@@ -140,22 +146,34 @@ export interface CompletionResult {
140
146
 
141
147
  // ─── Streaming ───────────────────────────────────────────────────
142
148
 
143
- export type StreamEventType =
144
- | "content_delta"
145
- | "tool_call_start"
146
- | "tool_call_delta"
147
- | "tool_result"
148
- | "usage_update"
149
- | "done"
150
- | "error";
149
+ /**
150
+ * Provider emit'uje cztery fazy tool calla:
151
+ * started → arguments_delta(*) → arguments_complete → (server-side execute)
152
+ *
153
+ * "started" daje klientowi `name` od razu (gdy provider go zna), żeby UI
154
+ * mogło pokazać "Przygotowuję: {name}..." przed completion args.
155
+ */
156
+ export type StreamChunkType =
157
+ | "text_delta"
158
+ | "tool_call_started"
159
+ | "tool_call_arguments_delta"
160
+ | "tool_call_arguments_complete"
161
+ | "usage_update";
151
162
 
152
163
  export interface StreamChunk {
153
- type: StreamEventType;
154
- content?: string;
155
- toolCall?: ToolCall;
156
- toolResult?: ToolResult;
164
+ type: StreamChunkType;
165
+ /** text_delta */
166
+ textDelta?: string;
167
+ /** tool_call_* — stable id z provider'a (np. OpenAI call_id). */
168
+ toolCallId?: string;
169
+ /** tool_call_started — nazwa funkcji, jeśli provider ją zna od razu. */
170
+ toolCallName?: string;
171
+ /** tool_call_arguments_delta — surowy fragment JSON arguments. */
172
+ argumentsDelta?: string;
173
+ /** tool_call_arguments_complete — sparsed pełne arguments. */
174
+ arguments?: Record<string, unknown>;
175
+ /** usage_update */
157
176
  usage?: TokenUsage;
158
- finishReason?: FinishReason;
159
177
  }
160
178
 
161
179
  // ─── LLM Provider ────────────────────────────────────────────────
@@ -181,10 +199,19 @@ export interface LLMProvider {
181
199
 
182
200
  // ─── Chat Stream (SSE events for chat streaming) ────────────────
183
201
 
202
+ /**
203
+ * SSE event types pomiędzy listenerem (serwer) a `chat-component.tsx` (klient).
204
+ *
205
+ * Każdy event niesie monotonicznie rosnące `seq` per session — klient trzyma
206
+ * `lastSeq` i odrzuca eventy które już zaaplikował (deduplication przy
207
+ * replay buffer / SSE reconnect).
208
+ */
184
209
  export type ChatStreamEventType =
185
- | "content_delta"
186
- | "server_tool_start"
187
- | "server_tool_result"
210
+ | "text_delta"
211
+ | "tool_call_pending"
212
+ | "tool_call_arguments_delta"
213
+ | "tool_call_arguments_complete"
214
+ | "tool_call_executed"
188
215
  | "interactive_tool_request"
189
216
  | "usage_update"
190
217
  | "done"
@@ -193,13 +220,36 @@ export type ChatStreamEventType =
193
220
  export interface ChatStreamEvent {
194
221
  type: ChatStreamEventType;
195
222
  sessionId: string;
196
- content?: string;
197
- toolCall?: ToolCall;
223
+ /** Monotonicznie rosnący per session — klient dedupuje. */
224
+ seq: number;
225
+ /** ID wiadomości asystenta do której event się odnosi. */
226
+ messageId?: string;
227
+
228
+ /** text_delta */
229
+ textDelta?: string;
230
+
231
+ /** tool_call_pending / tool_call_arguments_delta / tool_call_arguments_complete / tool_call_executed */
232
+ toolCallId?: string;
233
+ toolCallName?: string;
234
+ argumentsDelta?: string;
235
+ arguments?: Record<string, unknown>;
236
+
237
+ /** tool_call_executed */
198
238
  toolResult?: ToolResult;
239
+ executionCount?: number;
240
+
241
+ /** interactive_tool_request — multi tools awaiting user input */
199
242
  toolCalls?: ToolCall[];
243
+
244
+ /** usage_update */
200
245
  usage?: TokenUsage;
246
+
247
+ /** done */
201
248
  finishReason?: FinishReason;
202
- executionCount?: number;
249
+ /** done — total liczba seq w tej sesji (klient może sanity-checkować). */
250
+ lastSeq?: number;
251
+
252
+ /** error */
203
253
  error?: string;
204
254
  }
205
255