@droz-js/sdk 0.19.20 → 0.19.21

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@droz-js/sdk",
3
3
  "description": "Droz SDK",
4
- "version": "0.19.20",
4
+ "version": "0.19.21",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",
package/src/sdks/ai.d.ts CHANGED
@@ -127,17 +127,408 @@ export type AgentInfo = {
127
127
  name: Scalars['String']['output'];
128
128
  picture?: Maybe<Scalars['String']['output']>;
129
129
  };
130
+ export type AiAgentAuthoringRefInput = {
131
+ agentId: Scalars['ID']['input'];
132
+ id: Scalars['ID']['input'];
133
+ };
134
+ export type AiAgentBudget = {
135
+ /**
136
+ * Teto de gasto da conversa em micro-dolar (1e-6 USD). So vale para chamada com preco conhecido:
137
+ * modelo fora da tabela de preco produz custo desconhecido, nunca zero. Combine com `maxTokens`,
138
+ * que sempre vale.
139
+ */
140
+ maxCostMicroUsd?: Maybe<Scalars['Int']['output']>;
141
+ maxSteps: Scalars['Int']['output'];
142
+ /** Teto de token da conversa inteira. Ausente = sem teto de token. */
143
+ maxTokens?: Maybe<Scalars['Int']['output']>;
144
+ maxToolCalls: Scalars['Int']['output'];
145
+ onExceeded: BudgetExceededAction;
146
+ };
147
+ export type AiAgentBudgetInput = {
148
+ maxCostMicroUsd?: InputMaybe<Scalars['Int']['input']>;
149
+ maxSteps: Scalars['Int']['input'];
150
+ maxTokens?: InputMaybe<Scalars['Int']['input']>;
151
+ maxToolCalls: Scalars['Int']['input'];
152
+ onExceeded: BudgetExceededAction;
153
+ };
154
+ export type AiAgentCheckResult = {
155
+ regressions: Array<AiAgentRegression>;
156
+ reports: Array<AiAgentScenarioReport>;
157
+ /** Falso quando um cenário piorou além da tolerância em relação à versão live. */
158
+ safeToPublish: Scalars['Boolean']['output'];
159
+ };
160
+ export type AiAgentCompetingPair = {
161
+ left: Scalars['ID']['output'];
162
+ right: Scalars['ID']['output'];
163
+ /** Similaridade entre as duas descricoes, de 0 a 1. */
164
+ score: Scalars['Number']['output'];
165
+ };
166
+ export type AiAgentConversationMetrics = {
167
+ channel?: Maybe<Scalars['String']['output']>;
168
+ costMicroUsd: Scalars['Number']['output'];
169
+ durationMs: Scalars['Number']['output'];
170
+ lastOutcome: Scalars['String']['output'];
171
+ lastTurnAt: Scalars['Number']['output'];
172
+ sessionId: Scalars['ID']['output'];
173
+ startedAt: Scalars['Number']['output'];
174
+ totalTokens: Scalars['Number']['output'];
175
+ turns: Scalars['Number']['output'];
176
+ };
177
+ export type AiAgentConversationOutcome = {
178
+ agentId: Scalars['ID']['output'];
179
+ agentVersion: Scalars['String']['output'];
180
+ /** Fatos da sessao; chave e valor mascarados quando a politica de retencao pede. */
181
+ collectedData: Scalars['JSON']['output'];
182
+ /** false quando a retencao ja apagou a sessao. */
183
+ collectedDataAvailable: Scalars['Boolean']['output'];
184
+ /** Motivo da parada do ultimo turno, quando houve. */
185
+ haltReason?: Maybe<Scalars['String']['output']>;
186
+ lastTurnAt: Scalars['Number']['output'];
187
+ resolution: Scalars['String']['output'];
188
+ resolutionDefinition: Scalars['String']['output'];
189
+ sessionId: Scalars['ID']['output'];
190
+ startedAt: Scalars['Number']['output'];
191
+ turns: Scalars['Number']['output'];
192
+ };
193
+ /**
194
+ * Como este agente passa o atendimento para uma pessoa.
195
+ *
196
+ * A transicao vive no fluxo do tenant — e a state machine dele que sabe qual estado atende gente —,
197
+ * por isso e configuracao e nao constante da plataforma. Ausente significa que o agente nao passa
198
+ * para ninguem: ele diz que o caso precisa de uma pessoa e usa o comportamento fora de escopo do
199
+ * autor para dizer onde procura-la, em vez de prometer transferencia que nao acontece.
200
+ */
201
+ export type AiAgentHandoff = {
202
+ transition: Scalars['String']['output'];
203
+ };
204
+ export type AiAgentHandoffInput = {
205
+ transition: Scalars['String']['input'];
206
+ };
207
+ export type AiAgentIdentity = {
208
+ displayName: Scalars['String']['output'];
209
+ openingMessage?: Maybe<Scalars['String']['output']>;
210
+ outOfScopeBehaviour: Scalars['String']['output'];
211
+ role: Scalars['String']['output'];
212
+ tone: TonePreset;
213
+ toneNotes?: Maybe<Scalars['String']['output']>;
214
+ };
215
+ export type AiAgentIdentityInput = {
216
+ displayName: Scalars['String']['input'];
217
+ openingMessage?: InputMaybe<Scalars['String']['input']>;
218
+ outOfScopeBehaviour: Scalars['String']['input'];
219
+ role: Scalars['String']['input'];
220
+ tone: TonePreset;
221
+ toneNotes?: InputMaybe<Scalars['String']['input']>;
222
+ };
223
+ export type AiAgentMetrics = {
224
+ agentId: Scalars['ID']['output'];
225
+ answeredTurns: Scalars['Number']['output'];
226
+ avgLlmLatencyMs: Scalars['Number']['output'];
227
+ avgTurnDurationMs: Scalars['Number']['output'];
228
+ budgetExceededTurns: Scalars['Number']['output'];
229
+ conversations: Scalars['Number']['output'];
230
+ /**
231
+ * Conversas em que algum turno **pediu** uma pessoa. Pedido, nao confirmacao: o disparo da transicao
232
+ * e best-effort, entao nem toda solicitacao virou transferencia de fato.
233
+ */
234
+ conversationsHandoffRequested: Scalars['Number']['output'];
235
+ /**
236
+ * Nem uma nem outra: parou por prazo, por repeticao, ou ainda esta acontecendo. Existe para nao
237
+ * inflar a resolucao — contar "nao transferiu" como "resolveu" transformaria conversa abandonada
238
+ * em sucesso.
239
+ */
240
+ conversationsInconclusive: Scalars['Number']['output'];
241
+ /** Conversas resolvidas sob a regra declarada em `resolutionDefinition`. */
242
+ conversationsResolved: Scalars['Number']['output'];
243
+ /** Gasto da janela em micro-dolar (1e-6 USD), inteiro. */
244
+ costMicroUsd: Scalars['Number']['output'];
245
+ from: Scalars['Number']['output'];
246
+ haltReasons: Array<AiAgentMetricsCount>;
247
+ haltedTurns: Scalars['Number']['output'];
248
+ /** Turnos que terminaram pedindo uma pessoa (pedido, nao transferencia). */
249
+ humanRequestedTurns: Scalars['Number']['output'];
250
+ /** Turnos que precisaram de cliente identificado e nao tinham um — a medida do atrito de identificacao. */
251
+ identificationRequiredTurns: Scalars['Number']['output'];
252
+ inputTokens: Scalars['Number']['output'];
253
+ knowledgeEmpty: Scalars['Number']['output'];
254
+ knowledgeRetrieved: Scalars['Number']['output'];
255
+ knowledgeSkipped: Scalars['Number']['output'];
256
+ knowledgeUnavailable: Scalars['Number']['output'];
257
+ llmCalls: Scalars['Number']['output'];
258
+ outputTokens: Scalars['Number']['output'];
259
+ p95TurnDurationMs: Scalars['Number']['output'];
260
+ /** A regra aplicada para contar resolucao, junto do numero, para ele nao ser lido como cada um quiser. */
261
+ resolutionDefinition: Scalars['String']['output'];
262
+ /**
263
+ * Conversas resolvidas sobre o total, em pontos percentuais. **Ausente** quando nao houve conversa na
264
+ * janela — sem dado e zero por cento nao sao a mesma coisa.
265
+ */
266
+ resolutionRate?: Maybe<Scalars['Number']['output']>;
267
+ to: Scalars['Number']['output'];
268
+ toolCalls: Scalars['Number']['output'];
269
+ /** Chamadas de ferramenta que falharam. */
270
+ toolCallsFailed: Scalars['Number']['output'];
271
+ /** Falhas por classe: timeout, upstream, nao configurada, sem identificacao. */
272
+ toolErrorsByClass: Array<AiAgentMetricsCount>;
273
+ /** Falhas por conexao externa, identificada pelo host — responde "qual integracao esta caindo". */
274
+ toolErrorsByConnection: Array<AiAgentMetricsCount>;
275
+ totalTokens: Scalars['Number']['output'];
276
+ /** true quando o teto de leitura foi atingido: os numeros cobrem parte do periodo. */
277
+ truncated: Scalars['Boolean']['output'];
278
+ turns: Scalars['Number']['output'];
279
+ turnsByModel: Array<AiAgentMetricsCount>;
280
+ /**
281
+ * Turnos com ao menos uma chamada ao modelo sem preco conhecido. Com isto > 0, `costMicroUsd` e
282
+ * **piso**, nao total — nao decidir preco sem olhar este numero.
283
+ */
284
+ unpricedTurns: Scalars['Number']['output'];
285
+ };
286
+ export type AiAgentMetricsCount = {
287
+ count: Scalars['Number']['output'];
288
+ key: Scalars['String']['output'];
289
+ };
290
+ export type AiAgentMetricsInput = {
291
+ agentId: Scalars['ID']['input'];
292
+ channel?: InputMaybe<Scalars['String']['input']>;
293
+ from: Scalars['Number']['input'];
294
+ to: Scalars['Number']['input'];
295
+ };
296
+ /** A mesma janela, sem agente: a listagem quer todos de uma vez. */
297
+ export type AiAgentMetricsWindowInput = {
298
+ channel?: InputMaybe<Scalars['String']['input']>;
299
+ from: Scalars['Number']['input'];
300
+ to: Scalars['Number']['input'];
301
+ };
302
+ export type AiAgentProcedure = {
303
+ contingency: Scalars['String']['output'];
304
+ /** `autonomous` ou `needsApproval`. Ferramenta irreversivel exige `needsApproval`. */
305
+ executionAutonomy: Scalars['String']['output'];
306
+ /** As etapas como o autor instruiria uma pessoa. O texto e a fonte da verdade (§6.2). */
307
+ guidanceSteps: Array<Scalars['String']['output']>;
308
+ id: Scalars['ID']['output'];
309
+ name: Scalars['String']['output'];
310
+ status: Scalars['String']['output'];
311
+ /** Ferramentas que as etapas usam. Declaradas: e o que da para validar sem interpretar o texto. */
312
+ toolIds: Array<Scalars['ID']['output']>;
313
+ updatedAt: Scalars['Number']['output'];
314
+ };
315
+ export type AiAgentRegression = {
316
+ after: Scalars['Float']['output'];
317
+ before: Scalars['Float']['output'];
318
+ scenarioId: Scalars['ID']['output'];
319
+ };
320
+ export type AiAgentRetentionDays = {
321
+ long_term_memory: Scalars['Int']['output'];
322
+ session_state: Scalars['Int']['output'];
323
+ transcript: Scalars['Int']['output'];
324
+ };
325
+ export type AiAgentRetentionPolicy = {
326
+ days: AiAgentRetentionDays;
327
+ masksPersonalData: Scalars['Boolean']['output'];
328
+ };
329
+ export type AiAgentScenario = {
330
+ description: Scalars['String']['output'];
331
+ expectations: Array<Scalars['JSON']['output']>;
332
+ scenarioId: Scalars['ID']['output'];
333
+ /** O que o cliente diz, em ordem. */
334
+ turns: Array<Scalars['String']['output']>;
335
+ };
336
+ export type AiAgentScenarioReport = {
337
+ passed: Scalars['Int']['output'];
338
+ /** Fração de execuções em que todas as expectativas valeram, 0..1. */
339
+ rate: Scalars['Float']['output'];
340
+ runs: Scalars['Int']['output'];
341
+ scenarioId: Scalars['ID']['output'];
342
+ };
343
+ export type AiAgentSpec = {
344
+ budget: AiAgentBudget;
345
+ /** One natural-language permission per item. */
346
+ can: Array<Scalars['String']['output']>;
347
+ /** Restrictions. On conflict these win over `can`, without exception. */
348
+ cannot: Array<Scalars['String']['output']>;
349
+ /** Canais em que o agente atende. Ausente = ainda nao vinculado; declarado vazio e erro. */
350
+ channels?: Maybe<Array<Scalars['String']['output']>>;
351
+ handoff?: Maybe<AiAgentHandoff>;
352
+ identity: AiAgentIdentity;
353
+ knowledgeBaseIds: Array<Scalars['ID']['output']>;
354
+ /** `inform_limitation` (default) ou `general_knowledge`; ausente vale o mais restritivo. */
355
+ knowledgeFallback?: Maybe<Scalars['String']['output']>;
356
+ toolIds: Array<Scalars['ID']['output']>;
357
+ };
358
+ export type AiAgentSpecInput = {
359
+ budget: AiAgentBudgetInput;
360
+ can: Array<Scalars['String']['input']>;
361
+ cannot: Array<Scalars['String']['input']>;
362
+ channels?: InputMaybe<Array<Scalars['String']['input']>>;
363
+ handoff?: InputMaybe<AiAgentHandoffInput>;
364
+ identity: AiAgentIdentityInput;
365
+ knowledgeBaseIds: Array<Scalars['ID']['input']>;
366
+ /** `inform_limitation` (default) ou `general_knowledge`; ausente vale o mais restritivo. */
367
+ knowledgeFallback?: InputMaybe<Scalars['String']['input']>;
368
+ toolIds: Array<Scalars['ID']['input']>;
369
+ };
370
+ export type AiAgentSummary = {
371
+ agentId: Scalars['ID']['output'];
372
+ /** Canais da versao no ar; sem versao no ar, os da mais recente. Vazio quando nenhuma declarou canal. */
373
+ channels: Array<Scalars['String']['output']>;
374
+ /** Absent until a version is published. An agent with no live version answers nobody. */
375
+ liveVersion?: Maybe<Scalars['Int']['output']>;
376
+ name: Scalars['String']['output'];
377
+ /** Acoes esperando aprovacao humana (§5.5.3). Zero tambem quando a fila nao pode ser lida. */
378
+ queuedApprovals: Scalars['Number']['output'];
379
+ /**
380
+ * `draft` (nunca publicado), `live` (no ar) ou `paused` (ja esteve no ar e foi tirado). `liveVersion`
381
+ * sozinho nao distingue quem nunca publicou de quem foi pausado.
382
+ */
383
+ status: Scalars['String']['output'];
384
+ /** Momento da versao mais recente, no ar ou nao — o "ultima alteracao" da listagem. */
385
+ updatedAt: Scalars['Number']['output'];
386
+ };
387
+ export type AiAgentTool = {
388
+ /** `pre_approved` (padrao) ou `human_approval`. */
389
+ approval?: Maybe<Scalars['String']['output']>;
390
+ availability: ToolAvailability;
391
+ /** `url` (default): a plataforma impoe o recorte via `{customerId}` na URL; `credential`: a credencial ja e do cliente (declarado, nunca inferido). */
392
+ customerScope?: Maybe<Scalars['String']['output']>;
393
+ description: Scalars['String']['output'];
394
+ effect: ToolEffect;
395
+ name: Scalars['String']['output'];
396
+ /** `{kind: message, message?}` (default), `{kind: retry, attempts, message?}` ou `{kind: handoff}`. */
397
+ onFailure?: Maybe<Scalars['JSON']['output']>;
398
+ parameters: Array<AiAgentToolParameter>;
399
+ requiresAuthenticatedCustomer: Scalars['Boolean']['output'];
400
+ /** Fields the agent is allowed to see. Anything not listed never reaches the model. */
401
+ returns: Array<Scalars['String']['output']>;
402
+ toolId: Scalars['ID']['output'];
403
+ };
404
+ export type AiAgentToolParameter = {
405
+ description: Scalars['String']['output'];
406
+ grounding: ParameterGrounding;
407
+ name: Scalars['String']['output'];
408
+ required: Scalars['Boolean']['output'];
409
+ type: ToolParameterType;
410
+ };
411
+ export type AiAgentToolParameterInput = {
412
+ description: Scalars['String']['input'];
413
+ groundedBy?: InputMaybe<Array<Scalars['String']['input']>>;
414
+ grounding?: InputMaybe<ParameterGrounding>;
415
+ name: Scalars['String']['input'];
416
+ required: Scalars['Boolean']['input'];
417
+ type: ToolParameterType;
418
+ };
419
+ export type AiAgentToolSpecInput = {
420
+ /** `pre_approved` (padrao) ou `human_approval`. */
421
+ approval?: InputMaybe<Scalars['String']['input']>;
422
+ availability: ToolAvailability;
423
+ credentialRef?: InputMaybe<CredentialRefInput>;
424
+ /** `url` (default): a plataforma impoe o recorte via `{customerId}` na URL; `credential`: a credencial ja e do cliente (declarado, nunca inferido). */
425
+ customerScope?: InputMaybe<Scalars['String']['input']>;
426
+ description: Scalars['String']['input'];
427
+ effect: ToolEffect;
428
+ idempotent: Scalars['Boolean']['input'];
429
+ name: Scalars['String']['input'];
430
+ /** `{kind: message, message?}` (default), `{kind: retry, attempts, message?}` ou `{kind: handoff}`. */
431
+ onFailure?: InputMaybe<Scalars['JSON']['input']>;
432
+ parameters: Array<AiAgentToolParameterInput>;
433
+ requiresAuthenticatedCustomer: Scalars['Boolean']['input'];
434
+ /** Campos que o agente pode ver. O que não estiver aqui nunca chega ao modelo. */
435
+ returns: Array<Scalars['String']['input']>;
436
+ reversible: Scalars['Boolean']['input'];
437
+ toolId: Scalars['ID']['input'];
438
+ };
439
+ export type AiAgentTrace = {
440
+ agentId: Scalars['ID']['output'];
441
+ agentVersion: Scalars['String']['output'];
442
+ answer: Scalars['String']['output'];
443
+ /** Presente so quando o turno parou por limite; ausente quando respondeu. */
444
+ haltReason?: Maybe<Scalars['String']['output']>;
445
+ /** O turno tentou usar ferramenta que exige cliente identificado, sem ter um. */
446
+ identificationRequired?: Maybe<Scalars['Boolean']['output']>;
447
+ input: Scalars['String']['output'];
448
+ knowledgeOrigins: Array<Scalars['String']['output']>;
449
+ /** Versao da regra mestra da plataforma vigente no turno — atribui a conversa a regra sob a qual ela rodou. */
450
+ masterRuleVersion?: Maybe<Scalars['Int']['output']>;
451
+ outcome: Scalars['String']['output'];
452
+ promptBuilderVersion: Scalars['Int']['output'];
453
+ /** Identifica o prompt que gerou este turno sem guardar o prompt inteiro. */
454
+ promptFingerprint: Scalars['String']['output'];
455
+ sessionId: Scalars['ID']['output'];
456
+ startedAt: Scalars['Float']['output'];
457
+ steps: Scalars['Int']['output'];
458
+ toolCalls: Array<AiAgentTracedToolCall>;
459
+ turn: Scalars['Int']['output'];
460
+ };
461
+ export type AiAgentTracedToolCall = {
462
+ /** O sistema externo, pelo host. Sem path nem query, que carregam parametro do cliente. */
463
+ connection?: Maybe<Scalars['String']['output']>;
464
+ /** `unauthenticated`, `not_configured`, `timeout` ou `upstream`. */
465
+ errorClass?: Maybe<Scalars['String']['output']>;
466
+ name: Scalars['String']['output'];
467
+ /**
468
+ * Se a chamada deu certo. Ausente em chamada gravada antes do desfecho estruturado existir — e
469
+ * ausente nao significa falha.
470
+ */
471
+ ok?: Maybe<Scalars['Boolean']['output']>;
472
+ /** Ja restrito aos campos que a ferramenta declarou em `returns`. */
473
+ result: Scalars['String']['output'];
474
+ toolId: Scalars['ID']['output'];
475
+ };
476
+ export type AiAgentUseCase = {
477
+ id: Scalars['ID']['output'];
478
+ name: Scalars['String']['output'];
479
+ procedureId?: Maybe<Scalars['ID']['output']>;
480
+ status: Scalars['String']['output'];
481
+ /**
482
+ * NAO e documentacao: e o texto que o roteador le para classificar a mensagem (§6.1). Descricao vaga
483
+ * produz roteamento ruim.
484
+ */
485
+ subjectDescription: Scalars['String']['output'];
486
+ updatedAt: Scalars['Number']['output'];
487
+ };
488
+ export type AiAgentUseCaseOverlap = {
489
+ /** Do par mais parecido para o menos: e a ordem em que o autor deve olhar. */
490
+ pairs: Array<AiAgentCompetingPair>;
491
+ /** O limiar aplicado, publicado junto do resultado para o aviso nao ser lido como cada um quiser. */
492
+ threshold: Scalars['Number']['output'];
493
+ };
494
+ export type AiAgentVersion = {
495
+ agentId: Scalars['ID']['output'];
496
+ createdAt: Scalars['DateTime']['output'];
497
+ spec: AiAgentSpec;
498
+ status: AiAgentVersionStatus;
499
+ version: Scalars['Int']['output'];
500
+ };
501
+ export type AiAgentVersionRefInput = {
502
+ agentId: Scalars['ID']['input'];
503
+ version: Scalars['Int']['input'];
504
+ };
505
+ export declare enum AiAgentVersionStatus {
506
+ Draft = "draft",
507
+ Live = "live",
508
+ Published = "published",
509
+ Removed = "removed"
510
+ }
130
511
  export declare enum AppInstanceStatus {
131
512
  Active = "Active",
132
513
  Failing = "Failing",
133
514
  Inactive = "Inactive"
134
515
  }
516
+ export declare enum BudgetExceededAction {
517
+ EndWithNotice = "end_with_notice",
518
+ TransferToHuman = "transfer_to_human"
519
+ }
135
520
  export declare enum Can {
136
521
  Manage = "manage",
137
522
  Read = "read",
138
523
  Remove = "remove",
139
524
  Write = "write"
140
525
  }
526
+ export type CheckAiAgentVersionInput = {
527
+ agentId: Scalars['ID']['input'];
528
+ /** De 2 a 20. Uma execução só não prova nada num sistema probabilístico. */
529
+ runsPerScenario?: InputMaybe<Scalars['Int']['input']>;
530
+ version: Scalars['Int']['input'];
531
+ };
141
532
  export type CreateNlpInstanceInput = {
142
533
  name: Scalars['String']['input'];
143
534
  options: Array<NlpOptionInput>;
@@ -147,6 +538,17 @@ export type CreateQnAInstanceInput = {
147
538
  name: Scalars['String']['input'];
148
539
  tryToReplyOnTransition?: InputMaybe<Scalars['Boolean']['input']>;
149
540
  };
541
+ export type CredentialRefInput = {
542
+ /** Nome do parâmetro no cofre do tenant. O valor nunca é armazenado aqui. */
543
+ name: Scalars['String']['input'];
544
+ vault: Scalars['String']['input'];
545
+ };
546
+ export type DraftAiAgentInput = {
547
+ /** Omitted for a brand new agent; supplied to draft the next version of an existing one. */
548
+ agentId?: InputMaybe<Scalars['ID']['input']>;
549
+ name: Scalars['String']['input'];
550
+ spec: AiAgentSpecInput;
551
+ };
150
552
  export type ExtractImageMetadataInput = {
151
553
  imageUrl: Scalars['String']['input'];
152
554
  metadataRequirements: Scalars['JSONObject']['input'];
@@ -166,30 +568,89 @@ export type I18nTextInput = {
166
568
  value: Scalars['String']['input'];
167
569
  };
168
570
  export type Mutation = {
571
+ /** Roda os cenários contra uma versão candidata e registra o resultado. Custa chamadas de modelo. */
572
+ checkAiAgentVersion?: Maybe<AiAgentCheckResult>;
169
573
  createNlpInstance?: Maybe<NlpInstance>;
170
574
  createQnAInstance?: Maybe<QnAInstance>;
575
+ draftAiAgent?: Maybe<AiAgentVersion>;
171
576
  extractImageMetadata: ExtractImageMetadataResult;
577
+ publishAiAgentVersion: Array<AiAgentVersion>;
578
+ registerAiAgentTool?: Maybe<AiAgentTool>;
579
+ removeAiAgentProcedure: Scalars['Boolean']['output'];
580
+ removeAiAgentUseCase: Scalars['Boolean']['output'];
581
+ removeAiAgentVersion: Array<AiAgentVersion>;
172
582
  removeNlpInstance?: Maybe<NlpInstance>;
173
583
  removeQnAInstance?: Maybe<QnAInstance>;
584
+ /** Decide uma acao que ficou esperando aprovacao humana (§5.5.3). Decidir de novo nao repete a acao. */
585
+ resolveAiAgentApproval: Scalars['Boolean']['output'];
586
+ rollbackAiAgentVersion: Array<AiAgentVersion>;
587
+ saveAiAgentProcedure: AiAgentProcedure;
588
+ saveAiAgentScenario?: Maybe<AiAgentScenario>;
589
+ saveAiAgentUseCase: AiAgentUseCase;
590
+ /** Tira a versao do ar sem apagar (pausar). Publicar de novo e o caminho de volta. */
591
+ unpublishAiAgentVersion: Array<AiAgentVersion>;
592
+ unregisterAiAgentTool?: Maybe<Scalars['Boolean']['output']>;
174
593
  updateNlpInstance?: Maybe<NlpInstance>;
175
594
  updateQnAInstance?: Maybe<QnAInstance>;
176
595
  version?: Maybe<Scalars['String']['output']>;
177
596
  };
597
+ export type MutationCheckAiAgentVersionArgs = {
598
+ input: CheckAiAgentVersionInput;
599
+ };
178
600
  export type MutationCreateNlpInstanceArgs = {
179
601
  input: CreateNlpInstanceInput;
180
602
  };
181
603
  export type MutationCreateQnAInstanceArgs = {
182
604
  input: CreateQnAInstanceInput;
183
605
  };
606
+ export type MutationDraftAiAgentArgs = {
607
+ input: DraftAiAgentInput;
608
+ };
184
609
  export type MutationExtractImageMetadataArgs = {
185
610
  input: ExtractImageMetadataInput;
186
611
  };
612
+ export type MutationPublishAiAgentVersionArgs = {
613
+ input: AiAgentVersionRefInput;
614
+ };
615
+ export type MutationRegisterAiAgentToolArgs = {
616
+ input: RegisterAiAgentToolInput;
617
+ };
618
+ export type MutationRemoveAiAgentProcedureArgs = {
619
+ input: AiAgentAuthoringRefInput;
620
+ };
621
+ export type MutationRemoveAiAgentUseCaseArgs = {
622
+ input: AiAgentAuthoringRefInput;
623
+ };
624
+ export type MutationRemoveAiAgentVersionArgs = {
625
+ input: AiAgentVersionRefInput;
626
+ };
187
627
  export type MutationRemoveNlpInstanceArgs = {
188
628
  input: RemoveNlpInstanceInput;
189
629
  };
190
630
  export type MutationRemoveQnAInstanceArgs = {
191
631
  input: RemoveQnAInstanceInput;
192
632
  };
633
+ export type MutationResolveAiAgentApprovalArgs = {
634
+ input: ResolveAiAgentApprovalInput;
635
+ };
636
+ export type MutationRollbackAiAgentVersionArgs = {
637
+ input: AiAgentVersionRefInput;
638
+ };
639
+ export type MutationSaveAiAgentProcedureArgs = {
640
+ input: SaveAiAgentProcedureInput;
641
+ };
642
+ export type MutationSaveAiAgentScenarioArgs = {
643
+ input: SaveAiAgentScenarioInput;
644
+ };
645
+ export type MutationSaveAiAgentUseCaseArgs = {
646
+ input: SaveAiAgentUseCaseInput;
647
+ };
648
+ export type MutationUnpublishAiAgentVersionArgs = {
649
+ input: AiAgentVersionRefInput;
650
+ };
651
+ export type MutationUnregisterAiAgentToolArgs = {
652
+ input: UnregisterAiAgentToolInput;
653
+ };
193
654
  export type MutationUpdateNlpInstanceArgs = {
194
655
  input: UpdateNlpInstanceInput;
195
656
  };
@@ -234,6 +695,10 @@ export type PageInfo = {
234
695
  hasNext: Scalars['Boolean']['output'];
235
696
  next?: Maybe<Scalars['Base64']['output']>;
236
697
  };
698
+ export declare enum ParameterGrounding {
699
+ Free = "free",
700
+ Required = "required"
701
+ }
237
702
  export type QnAInstance = {
238
703
  createdAt: Scalars['DateTime']['output'];
239
704
  credentialsId: Scalars['ID']['output'];
@@ -244,22 +709,80 @@ export type QnAInstance = {
244
709
  updatedAt: Scalars['DateTime']['output'];
245
710
  };
246
711
  export type Query = {
712
+ aiAgentConversationMetrics: Array<AiAgentConversationMetrics>;
713
+ aiAgentConversationOutcome?: Maybe<AiAgentConversationOutcome>;
714
+ aiAgentMetrics: AiAgentMetrics;
715
+ /** As metricas da janela para todos os agentes, numa ida so. Agente sem rastro vem com zeros. */
716
+ aiAgentMetricsByAgent: Array<AiAgentMetrics>;
717
+ /**
718
+ * A politica de retencao em vigor para o tenant, com os padroes aplicados quando ele nao
719
+ * configurou a propria. Existe para a politica ser verificavel de fora, nao so estar escrita.
720
+ */
721
+ aiAgentRetentionPolicy: AiAgentRetentionPolicy;
722
+ /**
723
+ * Os turnos de um atendimento, do primeiro ao ultimo. E o que responde "o que aconteceu nesta
724
+ * conversa" sem depender de ler o DynamoDB por fora.
725
+ */
726
+ aiAgentTrace: Array<AiAgentTrace>;
727
+ /**
728
+ * Casos de uso cujas descricoes competem no roteador (§6.1). Aviso de autoria, nao bloqueio: descricoes
729
+ * parecidas podem ser intencionais.
730
+ */
731
+ aiAgentUseCaseOverlap: AiAgentUseCaseOverlap;
247
732
  app?: Maybe<Scalars['DRN']['output']>;
248
733
  getHttpEndpoint?: Maybe<Scalars['String']['output']>;
249
734
  getNlpInstance?: Maybe<NlpInstance>;
250
735
  getQnAInstance?: Maybe<QnAInstance>;
736
+ /** Os procedimentos do agente (§6.2): o plano em linguagem natural. */
737
+ listAiAgentProcedures: Array<AiAgentProcedure>;
738
+ listAiAgentScenarios: Array<AiAgentScenario>;
739
+ listAiAgentTools: Array<AiAgentTool>;
740
+ /** Os casos de uso do agente (§6.1): os motivos de contato. */
741
+ listAiAgentUseCases: Array<AiAgentUseCase>;
742
+ listAiAgentVersions: Array<AiAgentVersion>;
743
+ listAiAgents: Array<AiAgentSummary>;
251
744
  listNlpInstances: Array<NlpInstance>;
252
745
  listQnAInstances: Array<QnAInstance>;
253
746
  testNlpInstance?: Maybe<TestNlpInstanceResult>;
254
747
  testQnAInstance?: Maybe<TestQnAInstanceResult>;
255
748
  version?: Maybe<Scalars['String']['output']>;
256
749
  };
750
+ export type QueryAiAgentConversationMetricsArgs = {
751
+ input: AiAgentMetricsInput;
752
+ };
753
+ export type QueryAiAgentConversationOutcomeArgs = {
754
+ sessionId: Scalars['ID']['input'];
755
+ };
756
+ export type QueryAiAgentMetricsArgs = {
757
+ input: AiAgentMetricsInput;
758
+ };
759
+ export type QueryAiAgentMetricsByAgentArgs = {
760
+ input: AiAgentMetricsWindowInput;
761
+ };
762
+ export type QueryAiAgentTraceArgs = {
763
+ sessionId: Scalars['ID']['input'];
764
+ };
765
+ export type QueryAiAgentUseCaseOverlapArgs = {
766
+ agentId: Scalars['ID']['input'];
767
+ };
257
768
  export type QueryGetNlpInstanceArgs = {
258
769
  id: Scalars['ID']['input'];
259
770
  };
260
771
  export type QueryGetQnAInstanceArgs = {
261
772
  id: Scalars['ID']['input'];
262
773
  };
774
+ export type QueryListAiAgentProceduresArgs = {
775
+ agentId: Scalars['ID']['input'];
776
+ };
777
+ export type QueryListAiAgentScenariosArgs = {
778
+ agentId: Scalars['ID']['input'];
779
+ };
780
+ export type QueryListAiAgentUseCasesArgs = {
781
+ agentId: Scalars['ID']['input'];
782
+ };
783
+ export type QueryListAiAgentVersionsArgs = {
784
+ agentId: Scalars['ID']['input'];
785
+ };
263
786
  export type QueryTestNlpInstanceArgs = {
264
787
  id: Scalars['ID']['input'];
265
788
  sample: Scalars['String']['input'];
@@ -269,12 +792,53 @@ export type QueryTestQnAInstanceArgs = {
269
792
  id: Scalars['ID']['input'];
270
793
  input: Scalars['String']['input'];
271
794
  };
795
+ export type RegisterAiAgentToolInput = {
796
+ method: Scalars['String']['input'];
797
+ spec: AiAgentToolSpecInput;
798
+ /** Pode conter {param} para parâmetros declarados e {customerId}. Precisa ser https e público. */
799
+ url: Scalars['String']['input'];
800
+ };
272
801
  export type RemoveNlpInstanceInput = {
273
802
  id: Scalars['ID']['input'];
274
803
  };
275
804
  export type RemoveQnAInstanceInput = {
276
805
  id: Scalars['ID']['input'];
277
806
  };
807
+ export type ResolveAiAgentApprovalInput = {
808
+ agentId: Scalars['ID']['input'];
809
+ decidedBy: Scalars['String']['input'];
810
+ /** `approved` executa a acao guardada; `rejected` avisa o consumidor e nao executa nada. */
811
+ decision: Scalars['String']['input'];
812
+ /** Identifica a pendencia junto da sessao: e o momento em que a acao foi enfileirada. */
813
+ requestedAt: Scalars['Number']['input'];
814
+ sessionId: Scalars['ID']['input'];
815
+ };
816
+ export type SaveAiAgentProcedureInput = {
817
+ agentId: Scalars['ID']['input'];
818
+ contingency: Scalars['String']['input'];
819
+ executionAutonomy: Scalars['String']['input'];
820
+ guidanceSteps: Array<Scalars['String']['input']>;
821
+ id: Scalars['ID']['input'];
822
+ name: Scalars['String']['input'];
823
+ status: Scalars['String']['input'];
824
+ toolIds: Array<Scalars['ID']['input']>;
825
+ };
826
+ export type SaveAiAgentScenarioInput = {
827
+ agentId: Scalars['ID']['input'];
828
+ description: Scalars['String']['input'];
829
+ /** Expectativas de comportamento. `blocked_by_rule` ainda não é observável e é recusada. */
830
+ expectations: Array<Scalars['JSON']['input']>;
831
+ scenarioId: Scalars['ID']['input'];
832
+ turns: Array<Scalars['String']['input']>;
833
+ };
834
+ export type SaveAiAgentUseCaseInput = {
835
+ agentId: Scalars['ID']['input'];
836
+ id: Scalars['ID']['input'];
837
+ name: Scalars['String']['input'];
838
+ procedureId?: InputMaybe<Scalars['ID']['input']>;
839
+ status: Scalars['String']['input'];
840
+ subjectDescription: Scalars['String']['input'];
841
+ };
278
842
  export type SearchResultsFacet = {
279
843
  name: Scalars['String']['output'];
280
844
  stats?: Maybe<SearchResultsFacetStats>;
@@ -342,7 +906,37 @@ export type TokenUsage = {
342
906
  prompt?: Maybe<Scalars['Int']['output']>;
343
907
  total?: Maybe<Scalars['Int']['output']>;
344
908
  };
909
+ export declare enum TonePreset {
910
+ Cordial = "cordial",
911
+ Descontraido = "descontraido",
912
+ Direto = "direto",
913
+ Formal = "formal",
914
+ Tecnico = "tecnico"
915
+ }
916
+ export declare enum ToolAvailability {
917
+ Available = "available",
918
+ Unavailable = "unavailable"
919
+ }
920
+ export declare enum ToolEffect {
921
+ Read = "read",
922
+ Write = "write"
923
+ }
924
+ export declare enum ToolParameterType {
925
+ Boolean = "boolean",
926
+ Number = "number",
927
+ String = "string"
928
+ }
345
929
  export declare enum Typenames {
930
+ AiAgentApproval = "AiAgentApproval",
931
+ AiAgentEvalReport = "AiAgentEvalReport",
932
+ AiAgentProcedure = "AiAgentProcedure",
933
+ AiAgentRetentionPolicy = "AiAgentRetentionPolicy",
934
+ AiAgentScenario = "AiAgentScenario",
935
+ AiAgentSession = "AiAgentSession",
936
+ AiAgentTool = "AiAgentTool",
937
+ AiAgentTrace = "AiAgentTrace",
938
+ AiAgentUseCase = "AiAgentUseCase",
939
+ AiAgentVersion = "AiAgentVersion",
346
940
  Any = "Any",
347
941
  GraphqlConnections = "GraphqlConnections",
348
942
  GraphqlSubscriptions = "GraphqlSubscriptions",
@@ -350,6 +944,9 @@ export declare enum Typenames {
350
944
  NlpEmbeddings = "NlpEmbeddings",
351
945
  QnA = "QnA"
352
946
  }
947
+ export type UnregisterAiAgentToolInput = {
948
+ toolId: Scalars['ID']['input'];
949
+ };
353
950
  export type UpdateNlpInstanceInput = {
354
951
  id: Scalars['ID']['input'];
355
952
  name?: InputMaybe<Scalars['String']['input']>;
package/src/sdks/ai.js CHANGED
@@ -1,14 +1,26 @@
1
1
  "use strict";
2
2
  /* istanbul ignore file */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.serviceName = exports.RemoveQnAInstanceDocument = exports.UpdateQnAInstanceDocument = exports.CreateQnAInstanceDocument = exports.TestQnAInstanceDocument = exports.ListQnAInstancesDocument = exports.GetQnAInstanceDocument = exports.TestNlpInstanceDocument = exports.RemoveNlpInstanceDocument = exports.UpdateNlpInstanceDocument = exports.CreateNlpInstanceDocument = exports.ListNlpInstancesDocument = exports.GetNlpInstanceDocument = exports.ExtractImageMetadataDocument = exports.QnaFragmentFragmentDoc = exports.NlpInstanceFragmentDoc = exports.Typenames = exports.Can = exports.AppInstanceStatus = void 0;
4
+ exports.serviceName = exports.RemoveQnAInstanceDocument = exports.UpdateQnAInstanceDocument = exports.CreateQnAInstanceDocument = exports.TestQnAInstanceDocument = exports.ListQnAInstancesDocument = exports.GetQnAInstanceDocument = exports.TestNlpInstanceDocument = exports.RemoveNlpInstanceDocument = exports.UpdateNlpInstanceDocument = exports.CreateNlpInstanceDocument = exports.ListNlpInstancesDocument = exports.GetNlpInstanceDocument = exports.ExtractImageMetadataDocument = exports.QnaFragmentFragmentDoc = exports.NlpInstanceFragmentDoc = exports.Typenames = exports.ToolParameterType = exports.ToolEffect = exports.ToolAvailability = exports.TonePreset = exports.ParameterGrounding = exports.Can = exports.BudgetExceededAction = exports.AppInstanceStatus = exports.AiAgentVersionStatus = void 0;
5
5
  exports.getSdk = getSdk;
6
+ var AiAgentVersionStatus;
7
+ (function (AiAgentVersionStatus) {
8
+ AiAgentVersionStatus["Draft"] = "draft";
9
+ AiAgentVersionStatus["Live"] = "live";
10
+ AiAgentVersionStatus["Published"] = "published";
11
+ AiAgentVersionStatus["Removed"] = "removed";
12
+ })(AiAgentVersionStatus || (exports.AiAgentVersionStatus = AiAgentVersionStatus = {}));
6
13
  var AppInstanceStatus;
7
14
  (function (AppInstanceStatus) {
8
15
  AppInstanceStatus["Active"] = "Active";
9
16
  AppInstanceStatus["Failing"] = "Failing";
10
17
  AppInstanceStatus["Inactive"] = "Inactive";
11
18
  })(AppInstanceStatus || (exports.AppInstanceStatus = AppInstanceStatus = {}));
19
+ var BudgetExceededAction;
20
+ (function (BudgetExceededAction) {
21
+ BudgetExceededAction["EndWithNotice"] = "end_with_notice";
22
+ BudgetExceededAction["TransferToHuman"] = "transfer_to_human";
23
+ })(BudgetExceededAction || (exports.BudgetExceededAction = BudgetExceededAction = {}));
12
24
  var Can;
13
25
  (function (Can) {
14
26
  Can["Manage"] = "manage";
@@ -16,8 +28,47 @@ var Can;
16
28
  Can["Remove"] = "remove";
17
29
  Can["Write"] = "write";
18
30
  })(Can || (exports.Can = Can = {}));
31
+ var ParameterGrounding;
32
+ (function (ParameterGrounding) {
33
+ ParameterGrounding["Free"] = "free";
34
+ ParameterGrounding["Required"] = "required";
35
+ })(ParameterGrounding || (exports.ParameterGrounding = ParameterGrounding = {}));
36
+ var TonePreset;
37
+ (function (TonePreset) {
38
+ TonePreset["Cordial"] = "cordial";
39
+ TonePreset["Descontraido"] = "descontraido";
40
+ TonePreset["Direto"] = "direto";
41
+ TonePreset["Formal"] = "formal";
42
+ TonePreset["Tecnico"] = "tecnico";
43
+ })(TonePreset || (exports.TonePreset = TonePreset = {}));
44
+ var ToolAvailability;
45
+ (function (ToolAvailability) {
46
+ ToolAvailability["Available"] = "available";
47
+ ToolAvailability["Unavailable"] = "unavailable";
48
+ })(ToolAvailability || (exports.ToolAvailability = ToolAvailability = {}));
49
+ var ToolEffect;
50
+ (function (ToolEffect) {
51
+ ToolEffect["Read"] = "read";
52
+ ToolEffect["Write"] = "write";
53
+ })(ToolEffect || (exports.ToolEffect = ToolEffect = {}));
54
+ var ToolParameterType;
55
+ (function (ToolParameterType) {
56
+ ToolParameterType["Boolean"] = "boolean";
57
+ ToolParameterType["Number"] = "number";
58
+ ToolParameterType["String"] = "string";
59
+ })(ToolParameterType || (exports.ToolParameterType = ToolParameterType = {}));
19
60
  var Typenames;
20
61
  (function (Typenames) {
62
+ Typenames["AiAgentApproval"] = "AiAgentApproval";
63
+ Typenames["AiAgentEvalReport"] = "AiAgentEvalReport";
64
+ Typenames["AiAgentProcedure"] = "AiAgentProcedure";
65
+ Typenames["AiAgentRetentionPolicy"] = "AiAgentRetentionPolicy";
66
+ Typenames["AiAgentScenario"] = "AiAgentScenario";
67
+ Typenames["AiAgentSession"] = "AiAgentSession";
68
+ Typenames["AiAgentTool"] = "AiAgentTool";
69
+ Typenames["AiAgentTrace"] = "AiAgentTrace";
70
+ Typenames["AiAgentUseCase"] = "AiAgentUseCase";
71
+ Typenames["AiAgentVersion"] = "AiAgentVersion";
21
72
  Typenames["Any"] = "Any";
22
73
  Typenames["GraphqlConnections"] = "GraphqlConnections";
23
74
  Typenames["GraphqlSubscriptions"] = "GraphqlSubscriptions";