@talqing/sdk 0.5.0 → 0.6.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.
@@ -1311,7 +1311,7 @@ export type CallDetailResponse = {
1311
1311
  /**
1312
1312
  * Transcript
1313
1313
  */
1314
- transcript: Array<TranscriptItemResponse>;
1314
+ transcript: Array<ConversationItemResponse>;
1315
1315
  usage: UsageResponse;
1316
1316
  /**
1317
1317
  * Vars
@@ -1717,6 +1717,26 @@ export type CatalogResponse = {
1717
1717
  */
1718
1718
  turn_detector_languages: Array<LanguageOption>;
1719
1719
  };
1720
+ /**
1721
+ * ChatDetailResponse
1722
+ *
1723
+ * One chat with what explains it: health, priced lines, vars and trace.
1724
+ */
1725
+ export type ChatDetailResponse = {
1726
+ chat: ChatResponse;
1727
+ cost: CostDetailResponse | null;
1728
+ /**
1729
+ * Events
1730
+ */
1731
+ events: Array<SessionEventResponse>;
1732
+ snapshot: HealthSnapshotResponse;
1733
+ /**
1734
+ * Vars
1735
+ */
1736
+ vars: {
1737
+ [key: string]: string;
1738
+ };
1739
+ };
1720
1740
  /**
1721
1741
  * ChatMessageRequest
1722
1742
  *
@@ -2017,7 +2037,7 @@ export type ConversationItemResponse = {
2017
2037
  /**
2018
2038
  * Agent Version
2019
2039
  */
2020
- agent_version: number | null;
2040
+ agent_version: number | 'draft' | null;
2021
2041
  /**
2022
2042
  * Attachments
2023
2043
  */
@@ -2047,6 +2067,7 @@ export type ConversationItemResponse = {
2047
2067
  * Id
2048
2068
  */
2049
2069
  id: string;
2070
+ latency: ReplyLatency | null;
2050
2071
  /**
2051
2072
  * Metadata
2052
2073
  */
@@ -2054,6 +2075,10 @@ export type ConversationItemResponse = {
2054
2075
  [key: string]: unknown;
2055
2076
  };
2056
2077
  metrics: TurnMetrics | null;
2078
+ /**
2079
+ * Origin
2080
+ */
2081
+ origin: 'speech' | 'typed' | 'keypad' | null;
2057
2082
  /**
2058
2083
  * Provider Message Id
2059
2084
  */
@@ -2212,14 +2237,16 @@ export type ConversationResponse = {
2212
2237
  * One agent execution within a conversation: a call, or a chat.
2213
2238
  */
2214
2239
  export type ConversationSessionResponse = {
2240
+ agent: AgentMetadata;
2215
2241
  /**
2216
- * Agent Id
2242
+ * Agent Version
2217
2243
  */
2218
- agent_id: string | null;
2244
+ agent_version: number | 'draft' | null;
2219
2245
  /**
2220
2246
  * Agent Version Id
2221
2247
  */
2222
2248
  agent_version_id: string | null;
2249
+ analysis: AnalysisResponse;
2223
2250
  /**
2224
2251
  * Channel
2225
2252
  */
@@ -2228,6 +2255,10 @@ export type ConversationSessionResponse = {
2228
2255
  * Close Reason
2229
2256
  */
2230
2257
  close_reason: string | null;
2258
+ /**
2259
+ * Close Reason Label
2260
+ */
2261
+ close_reason_label: string | null;
2231
2262
  /**
2232
2263
  * Conversation Id
2233
2264
  */
@@ -2236,11 +2267,15 @@ export type ConversationSessionResponse = {
2236
2267
  * Conversation Ref Id
2237
2268
  */
2238
2269
  conversation_ref_id: string | null;
2239
- cost: SessionCostResponse | null;
2270
+ cost: CostResponse | null;
2240
2271
  /**
2241
2272
  * Created At
2242
2273
  */
2243
2274
  created_at: string;
2275
+ /**
2276
+ * Duration S
2277
+ */
2278
+ duration_s: number | null;
2244
2279
  /**
2245
2280
  * Ended At
2246
2281
  */
@@ -2255,18 +2290,6 @@ export type ConversationSessionResponse = {
2255
2290
  */
2256
2291
  integration_id: string | null;
2257
2292
  metrics: SessionMetrics;
2258
- /**
2259
- * Outcome
2260
- */
2261
- outcome: 'success' | 'failure' | 'unknown' | null;
2262
- /**
2263
- * Output Item Ids
2264
- */
2265
- output_item_ids: Array<string>;
2266
- /**
2267
- * Session Id
2268
- */
2269
- session_id: string | null;
2270
2293
  /**
2271
2294
  * Started At
2272
2295
  */
@@ -2275,18 +2298,10 @@ export type ConversationSessionResponse = {
2275
2298
  * Status
2276
2299
  */
2277
2300
  status: string;
2278
- /**
2279
- * Summary
2280
- */
2281
- summary: string | null;
2282
2301
  /**
2283
2302
  * Trigger Id
2284
2303
  */
2285
2304
  trigger_id: string | null;
2286
- /**
2287
- * Trigger Item Ids
2288
- */
2289
- trigger_item_ids: Array<string>;
2290
2305
  /**
2291
2306
  * Type
2292
2307
  */
@@ -2370,6 +2385,46 @@ export type ConversationSpecOverride = {
2370
2385
  */
2371
2386
  summary_limit?: number | null;
2372
2387
  };
2388
+ /**
2389
+ * ConversationTraceEventResponse
2390
+ *
2391
+ * One trace row of a conversation, and the session it belongs to.
2392
+ */
2393
+ export type ConversationTraceEventResponse = {
2394
+ /**
2395
+ * Created At
2396
+ */
2397
+ created_at: string;
2398
+ /**
2399
+ * Payload
2400
+ */
2401
+ payload: {
2402
+ [key: string]: unknown;
2403
+ };
2404
+ /**
2405
+ * Seq
2406
+ */
2407
+ seq: number;
2408
+ /**
2409
+ * Session Id
2410
+ */
2411
+ session_id: string;
2412
+ /**
2413
+ * Type
2414
+ */
2415
+ type: string;
2416
+ };
2417
+ /**
2418
+ * ConversationTraceResponse
2419
+ *
2420
+ * A conversation's trace over one window, oldest first.
2421
+ */
2422
+ export type ConversationTraceResponse = {
2423
+ /**
2424
+ * Events
2425
+ */
2426
+ events: Array<ConversationTraceEventResponse>;
2427
+ };
2373
2428
  /**
2374
2429
  * CopilotFunctionCallItem
2375
2430
  *
@@ -4257,6 +4312,21 @@ export type HandoffTarget = {
4257
4312
  */
4258
4313
  summary_prompt?: string | null;
4259
4314
  };
4315
+ /**
4316
+ * HealthIssue
4317
+ *
4318
+ * One problem found, and what kind it is.
4319
+ */
4320
+ export type HealthIssue = {
4321
+ /**
4322
+ * Kind
4323
+ */
4324
+ kind: 'failed' | 'never_ready' | 'provider_errors' | 'provider_failover' | 'tool_failures' | 'tools_unfinished' | 'slow_tools' | 'slow_responses' | 'slow_after_filler' | 'connection' | 'noise_cancellation' | 'unpriceable';
4325
+ /**
4326
+ * Message
4327
+ */
4328
+ message: string;
4329
+ };
4260
4330
  /**
4261
4331
  * HealthResponse
4262
4332
  *
@@ -4305,10 +4375,6 @@ export type HealthSnapshotResponse = {
4305
4375
  * Duration Seconds
4306
4376
  */
4307
4377
  duration_seconds: number | null;
4308
- /**
4309
- * End Of Turn Avg Ms
4310
- */
4311
- end_of_turn_avg_ms: number | null;
4312
4378
  /**
4313
4379
  * Errors
4314
4380
  */
@@ -4332,7 +4398,7 @@ export type HealthSnapshotResponse = {
4332
4398
  /**
4333
4399
  * Issues
4334
4400
  */
4335
- issues: Array<string>;
4401
+ issues: Array<HealthIssue>;
4336
4402
  /**
4337
4403
  * Noise Cancellation Failed
4338
4404
  */
@@ -4359,6 +4425,14 @@ export type HealthSnapshotResponse = {
4359
4425
  */
4360
4426
  providers: Array<string>;
4361
4427
  response_latency: LatencyStats;
4428
+ /**
4429
+ * Response Stages
4430
+ */
4431
+ response_stages: Array<LatencyStage>;
4432
+ /**
4433
+ * Slow Replies After Filler
4434
+ */
4435
+ slow_replies_after_filler: number;
4362
4436
  /**
4363
4437
  * Slow Response Threshold Ms
4364
4438
  */
@@ -4395,18 +4469,6 @@ export type HealthSnapshotResponse = {
4395
4469
  * Total Cost Usd
4396
4470
  */
4397
4471
  total_cost_usd: number | null;
4398
- /**
4399
- * Transcription Avg Ms
4400
- */
4401
- transcription_avg_ms: number | null;
4402
- /**
4403
- * Ttfb Avg Ms
4404
- */
4405
- ttfb_avg_ms: number | null;
4406
- /**
4407
- * Ttft Avg Ms
4408
- */
4409
- ttft_avg_ms: number | null;
4410
4472
  /**
4411
4473
  * Tts Audio Ms
4412
4474
  */
@@ -5081,7 +5143,7 @@ export type ItemCreatedEvent = {
5081
5143
  /**
5082
5144
  * Agent Version
5083
5145
  */
5084
- agent_version: number | null;
5146
+ agent_version: number | 'draft' | null;
5085
5147
  /**
5086
5148
  * Attachments
5087
5149
  */
@@ -5115,6 +5177,7 @@ export type ItemCreatedEvent = {
5115
5177
  * Id
5116
5178
  */
5117
5179
  id: string;
5180
+ latency: ReplyLatency | null;
5118
5181
  /**
5119
5182
  * Metadata
5120
5183
  */
@@ -5122,6 +5185,10 @@ export type ItemCreatedEvent = {
5122
5185
  [key: string]: unknown;
5123
5186
  };
5124
5187
  metrics: TurnMetrics | null;
5188
+ /**
5189
+ * Origin
5190
+ */
5191
+ origin: 'speech' | 'typed' | 'keypad' | null;
5125
5192
  /**
5126
5193
  * Provider Message Id
5127
5194
  */
@@ -5946,6 +6013,25 @@ export type LanguageOption = {
5946
6013
  */
5947
6014
  name: string;
5948
6015
  };
6016
+ /**
6017
+ * LatencyStage
6018
+ *
6019
+ * One leg of a wait: what the time went on.
6020
+ */
6021
+ export type LatencyStage = {
6022
+ /**
6023
+ * Kind
6024
+ */
6025
+ kind: 'stt' | 'endpoint' | 'hook' | 'llm_step' | 'tool' | 'llm' | 'tts' | 'other';
6026
+ /**
6027
+ * Label
6028
+ */
6029
+ label: string;
6030
+ /**
6031
+ * Ms
6032
+ */
6033
+ ms: number;
6034
+ };
5949
6035
  /**
5950
6036
  * LatencyStats
5951
6037
  */
@@ -9021,6 +9107,25 @@ export type RemoteNumber = {
9021
9107
  */
9022
9108
  provider_number_id?: string | null;
9023
9109
  };
9110
+ /**
9111
+ * ReplyLatency
9112
+ *
9113
+ * How long the caller waited for this reply, in the order it was spent.
9114
+ */
9115
+ export type ReplyLatency = {
9116
+ /**
9117
+ * Kind
9118
+ */
9119
+ kind: 'response' | 'reply' | 'after_filler';
9120
+ /**
9121
+ * Stages
9122
+ */
9123
+ stages: Array<LatencyStage>;
9124
+ /**
9125
+ * Total Ms
9126
+ */
9127
+ total_ms: number;
9128
+ };
9024
9129
  /**
9025
9130
  * RunStepResponse
9026
9131
  *
@@ -9582,29 +9687,6 @@ export type SendWhatsAppBatchRequest = {
9582
9687
  timezone?: string | null;
9583
9688
  window?: TimeWindow | null;
9584
9689
  };
9585
- /**
9586
- * SessionCostResponse
9587
- *
9588
- * Priced money columns for one session. Absent when billing has not run.
9589
- */
9590
- export type SessionCostResponse = {
9591
- /**
9592
- * Duration S
9593
- */
9594
- duration_s?: number | null;
9595
- /**
9596
- * Platform Fee
9597
- */
9598
- platform_fee: number;
9599
- /**
9600
- * Provider Cost
9601
- */
9602
- provider_cost: number;
9603
- /**
9604
- * Total Charge
9605
- */
9606
- total_charge: number;
9607
- };
9608
9690
  /**
9609
9691
  * SessionError
9610
9692
  *
@@ -9655,6 +9737,7 @@ export type SessionEventResponse = {
9655
9737
  * Latency averages are milliseconds over every message that reported the
9656
9738
  * metric (same rule as call detail / workspace observability). Turn-level
9657
9739
  * samples live on conversation_items.metrics for workspace daily aggregates.
9740
+ * On a chat, `e2e_latency` is a message arriving → the first token back.
9658
9741
  */
9659
9742
  export type SessionMetrics = {
9660
9743
  /**
@@ -11273,51 +11356,6 @@ export type TraceStepResponse = {
11273
11356
  */
11274
11357
  truncated?: boolean;
11275
11358
  };
11276
- /**
11277
- * TranscriptItemResponse
11278
- */
11279
- export type TranscriptItemResponse = {
11280
- /**
11281
- * Agent Id
11282
- */
11283
- agent_id: string | null;
11284
- /**
11285
- * Agent Version
11286
- */
11287
- agent_version: number | 'draft' | null;
11288
- /**
11289
- * Attachments
11290
- */
11291
- attachments: Array<ConversationAttachment>;
11292
- /**
11293
- * Data
11294
- */
11295
- data: {
11296
- [key: string]: unknown;
11297
- } | null;
11298
- /**
11299
- * Id
11300
- */
11301
- id: string;
11302
- /**
11303
- * Item Id
11304
- */
11305
- item_id: string;
11306
- /**
11307
- * Metrics
11308
- */
11309
- metrics: {
11310
- [key: string]: unknown;
11311
- } | null;
11312
- /**
11313
- * Timestamp
11314
- */
11315
- timestamp: string;
11316
- /**
11317
- * Type
11318
- */
11319
- type: 'message' | 'function_call' | 'function_call_output' | 'agent_handoff' | 'agent_config_update';
11320
- };
11321
11359
  /**
11322
11360
  * TransferConfig
11323
11361
  */
@@ -14474,6 +14512,141 @@ export type ChatsGetResults = {
14474
14512
  200: ChatResponse;
14475
14513
  };
14476
14514
  export type ChatsGetResult = ChatsGetResults[keyof ChatsGetResults];
14515
+ export type ChatsAnalysisRerunData = {
14516
+ body?: never;
14517
+ path: {
14518
+ /**
14519
+ * Chat Id
14520
+ */
14521
+ chat_id: string;
14522
+ };
14523
+ query?: never;
14524
+ url: '/v1/chats/{chat_id}/analysis';
14525
+ };
14526
+ export type ChatsAnalysisRerunErrors = {
14527
+ /**
14528
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
14529
+ */
14530
+ 400: ErrorResponse;
14531
+ /**
14532
+ * Missing credential, or one that is revoked or no longer a member of this organization.
14533
+ */
14534
+ 401: ErrorResponse;
14535
+ /**
14536
+ * Authenticated, but this organization role may not perform the operation.
14537
+ */
14538
+ 403: ErrorResponse;
14539
+ /**
14540
+ * No such resource in this organization.
14541
+ */
14542
+ 404: ErrorResponse;
14543
+ /**
14544
+ * The resource's current state forbids this — a name already taken, a job already running.
14545
+ */
14546
+ 409: ErrorResponse;
14547
+ /**
14548
+ * The request did not match this operation's schema; `detail.errors` lists each field.
14549
+ */
14550
+ 422: ErrorResponse;
14551
+ /**
14552
+ * Unexpected error. Every error this API returns carries this body.
14553
+ */
14554
+ default: ErrorResponse;
14555
+ };
14556
+ export type ChatsAnalysisRerunError = ChatsAnalysisRerunErrors[keyof ChatsAnalysisRerunErrors];
14557
+ export type ChatsAnalysisRerunResults = {
14558
+ /**
14559
+ * Successful Response
14560
+ */
14561
+ 200: ChatResponse;
14562
+ };
14563
+ export type ChatsAnalysisRerunResult = ChatsAnalysisRerunResults[keyof ChatsAnalysisRerunResults];
14564
+ export type ChatsAnalysisPreviewData = {
14565
+ body: PreviewAnalysisRequest;
14566
+ path: {
14567
+ /**
14568
+ * Chat Id
14569
+ */
14570
+ chat_id: string;
14571
+ };
14572
+ query?: never;
14573
+ url: '/v1/chats/{chat_id}/analysis/preview';
14574
+ };
14575
+ export type ChatsAnalysisPreviewErrors = {
14576
+ /**
14577
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
14578
+ */
14579
+ 400: ErrorResponse;
14580
+ /**
14581
+ * Missing credential, or one that is revoked or no longer a member of this organization.
14582
+ */
14583
+ 401: ErrorResponse;
14584
+ /**
14585
+ * Authenticated, but this organization role may not perform the operation.
14586
+ */
14587
+ 403: ErrorResponse;
14588
+ /**
14589
+ * No such resource in this organization.
14590
+ */
14591
+ 404: ErrorResponse;
14592
+ /**
14593
+ * The resource's current state forbids this — a name already taken, a job already running.
14594
+ */
14595
+ 409: ErrorResponse;
14596
+ /**
14597
+ * The request did not match this operation's schema; `detail.errors` lists each field.
14598
+ */
14599
+ 422: ErrorResponse;
14600
+ /**
14601
+ * Unexpected error. Every error this API returns carries this body.
14602
+ */
14603
+ default: ErrorResponse;
14604
+ };
14605
+ export type ChatsAnalysisPreviewError = ChatsAnalysisPreviewErrors[keyof ChatsAnalysisPreviewErrors];
14606
+ export type ChatsAnalysisPreviewResults = {
14607
+ /**
14608
+ * Successful Response
14609
+ */
14610
+ 200: PreviewAnalysisResponse;
14611
+ };
14612
+ export type ChatsAnalysisPreviewResult = ChatsAnalysisPreviewResults[keyof ChatsAnalysisPreviewResults];
14613
+ export type ChatsDetailData = {
14614
+ body?: never;
14615
+ path: {
14616
+ /**
14617
+ * Chat Id
14618
+ */
14619
+ chat_id: string;
14620
+ };
14621
+ query?: never;
14622
+ url: '/v1/chats/{chat_id}/detail';
14623
+ };
14624
+ export type ChatsDetailErrors = {
14625
+ /**
14626
+ * Missing credential, or one that is revoked or no longer a member of this organization.
14627
+ */
14628
+ 401: ErrorResponse;
14629
+ /**
14630
+ * No such resource in this organization.
14631
+ */
14632
+ 404: ErrorResponse;
14633
+ /**
14634
+ * The request did not match this operation's schema; `detail.errors` lists each field.
14635
+ */
14636
+ 422: ErrorResponse;
14637
+ /**
14638
+ * Unexpected error. Every error this API returns carries this body.
14639
+ */
14640
+ default: ErrorResponse;
14641
+ };
14642
+ export type ChatsDetailError = ChatsDetailErrors[keyof ChatsDetailErrors];
14643
+ export type ChatsDetailResults = {
14644
+ /**
14645
+ * Successful Response
14646
+ */
14647
+ 200: ChatDetailResponse;
14648
+ };
14649
+ export type ChatsDetailResult = ChatsDetailResults[keyof ChatsDetailResults];
14477
14650
  export type ChatsEndData = {
14478
14651
  body?: never;
14479
14652
  path: {
@@ -15002,6 +15175,56 @@ export type ConversationsSnapshotResults = {
15002
15175
  200: HealthSnapshotResponse;
15003
15176
  };
15004
15177
  export type ConversationsSnapshotResult = ConversationsSnapshotResults[keyof ConversationsSnapshotResults];
15178
+ export type ConversationsTraceData = {
15179
+ body?: never;
15180
+ path: {
15181
+ /**
15182
+ * Conversation Id
15183
+ */
15184
+ conversation_id: string;
15185
+ };
15186
+ query?: {
15187
+ /**
15188
+ * After
15189
+ *
15190
+ * Only events at or after this.
15191
+ */
15192
+ after?: string | null;
15193
+ /**
15194
+ * Before
15195
+ *
15196
+ * Only events before this.
15197
+ */
15198
+ before?: string | null;
15199
+ };
15200
+ url: '/v1/conversations/{conversation_id}/trace';
15201
+ };
15202
+ export type ConversationsTraceErrors = {
15203
+ /**
15204
+ * Missing credential, or one that is revoked or no longer a member of this organization.
15205
+ */
15206
+ 401: ErrorResponse;
15207
+ /**
15208
+ * No such resource in this organization.
15209
+ */
15210
+ 404: ErrorResponse;
15211
+ /**
15212
+ * The request did not match this operation's schema; `detail.errors` lists each field.
15213
+ */
15214
+ 422: ErrorResponse;
15215
+ /**
15216
+ * Unexpected error. Every error this API returns carries this body.
15217
+ */
15218
+ default: ErrorResponse;
15219
+ };
15220
+ export type ConversationsTraceError = ConversationsTraceErrors[keyof ConversationsTraceErrors];
15221
+ export type ConversationsTraceResults = {
15222
+ /**
15223
+ * Successful Response
15224
+ */
15225
+ 200: ConversationTraceResponse;
15226
+ };
15227
+ export type ConversationsTraceResult = ConversationsTraceResults[keyof ConversationsTraceResults];
15005
15228
  export type CopilotAgentsSendData = {
15006
15229
  body: SendMessageRequest;
15007
15230
  path: {