@amigo-ai/platform-sdk 0.39.0 → 0.41.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.
@@ -0,0 +1,86 @@
1
+ import { WorkspaceScopedResource, extractData } from './base.js';
2
+ /**
3
+ * Prompt-log read surface — full LLM input/output (system prompt,
4
+ * conversation history, tool catalog, model, response) per turn for
5
+ * auditing, debugging, and post-hoc trace analysis.
6
+ *
7
+ * Reads the Delta ``world_events`` ledger via Databricks SQL (typical
8
+ * latency 1-5s, 15s ceiling). **Admin or owner role required** —
9
+ * responses can include PHI from prompt history.
10
+ *
11
+ * The canonical filter is ``conversation_id`` (UUID from
12
+ * ``world.entities``) which works across voice / text / sim / scribe
13
+ * modalities. ``call_sid`` remains for legacy callers and external
14
+ * systems holding the SID directly. The two are mutually exclusive.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * // Cross-modality: filter by conversation entity UUID.
19
+ * const page = await client.promptLogs.list({
20
+ * conversation_id: '<entity-uuid>',
21
+ * limit: 50,
22
+ * })
23
+ *
24
+ * // Direct call SID (Twilio CA-SID for voice).
25
+ * const callPage = await client.promptLogs.list({
26
+ * call_sid: 'CA01a2b3...',
27
+ * prompt_type: 'engage_user',
28
+ * })
29
+ *
30
+ * // Auto-paged sweep over a workspace's last 7 days
31
+ * for await (const entry of client.promptLogs.listAutoPaging({
32
+ * prompt_type: 'navigation',
33
+ * })) {
34
+ * console.log(entry.event_id, entry.state_name, entry.llm_model)
35
+ * }
36
+ * ```
37
+ */
38
+ export class PromptLogsResource extends WorkspaceScopedResource {
39
+ /**
40
+ * One page of prompt-log entries, newest-first.
41
+ *
42
+ * When ``params.conversation_id`` is supplied, the response surfaces
43
+ * ``resolved_call_sid`` (the call_sid the lookup mapped to) and
44
+ * ``resolved_conversation_kind`` (``"call"`` for voice/sim/scribe,
45
+ * ``"conversation"`` for text/sms/whatsapp/email) so you can drill
46
+ * into per-call surfaces afterward without re-querying
47
+ * ``world.entities``.
48
+ *
49
+ * When no selectivity-bearing filter is supplied (no conversation_id /
50
+ * call_sid / time range), the query is auto-capped to the last 7 days.
51
+ * The applied window is reported in ``applied_time_window_days``.
52
+ */
53
+ async list(params) {
54
+ return extractData(await this.client.GET('/v1/{workspace_id}/prompt-logs', {
55
+ params: { path: { workspace_id: this.workspaceId }, query: params },
56
+ }));
57
+ }
58
+ /**
59
+ * Auto-paginating async iterator over prompt-log entries. Walks
60
+ * ``next_offset`` until ``has_more`` is false, yielding individual
61
+ * entries. Use this when consuming logs at scale (e.g. nightly
62
+ * backfills) rather than rendering one page in a UI.
63
+ *
64
+ * Bounded by the same per-call hard caps as ``list`` (200 items per
65
+ * page, 10,000 cumulative offset).
66
+ */
67
+ async *listAutoPaging(params) {
68
+ let offset = 0;
69
+ while (true) {
70
+ const page = await this.list({ ...params, offset });
71
+ for (const entry of page.items) {
72
+ yield entry;
73
+ }
74
+ if (!page.has_more || page.next_offset == null) {
75
+ return;
76
+ }
77
+ // Advance to the offset the server told us to use; guard against a
78
+ // non-advancing token to avoid an infinite loop on a buggy backend.
79
+ if (page.next_offset === offset) {
80
+ return;
81
+ }
82
+ offset = page.next_offset;
83
+ }
84
+ }
85
+ }
86
+ //# sourceMappingURL=prompt-logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-logs.js","sourceRoot":"","sources":["../../src/resources/prompt-logs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAgBhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,kBAAmB,SAAQ,uBAAuB;IAC7D;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,IAAI,CAAC,MAA6B;QACtC,OAAO,WAAW,CAChB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,gCAAgC,EAAE;YACtD,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SACpE,CAAC,CACH,CAAA;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,CAAC,cAAc,CACnB,MAA6C;QAE7C,IAAI,MAAM,GAAG,CAAC,CAAA;QACd,OAAO,IAAI,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;YACnD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC/B,MAAM,KAAK,CAAA;YACb,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,EAAE,CAAC;gBAC/C,OAAM;YACR,CAAC;YACD,mEAAmE;YACnE,oEAAoE;YACpE,IAAI,IAAI,CAAC,WAAW,KAAK,MAAM,EAAE,CAAC;gBAChC,OAAM;YACR,CAAC;YACD,MAAM,GAAG,IAAI,CAAC,WAAW,CAAA;QAC3B,CAAC;IACH,CAAC;CACF"}
@@ -5225,7 +5225,9 @@ export interface paths {
5225
5225
  * List prompt logs for a workspace
5226
5226
  * @description Lists ``prompt_log`` events emitted by agent-engine — full system prompt, conversation history, tool catalog, LLM model, and response — for auditing and debugging. Reads the Delta ``world_events`` ledger via Databricks SQL; typical latency is 1-5s with a 15s ceiling on cold-start.
5227
5227
  *
5228
- * **Filters**: ``call_sid``, ``prompt_type``, ``state_name``, ``from_ts``, ``to_ts``. When no selectivity-bearing filter (call_sid / time range) is supplied, the query is auto-capped to the last 7 days; the applied window is reported in ``applied_time_window_days``.
5228
+ * **Conversation filter**: pass ``conversation_id`` (UUID from ``world.entities``) for the canonical mental model works uniformly across voice, text, sim, and scribe modalities. ``call_sid`` is the legacy direct-SID filter (Twilio CA-SID for voice, session_id UUID otherwise) and is mutually exclusive with ``conversation_id``.
5229
+ *
5230
+ * **Other filters**: ``prompt_type``, ``state_name``, ``from_ts``, ``to_ts``. When no selectivity-bearing filter (conversation_id / call_sid / time range) is supplied, the query is auto-capped to the last 7 days; the applied window is reported in ``applied_time_window_days``.
5229
5231
  *
5230
5232
  * **Pagination**: peek-ahead — ``has_more`` is true when more rows exist; use ``next_offset`` to fetch the next page.
5231
5233
  *
@@ -21423,6 +21425,16 @@ export interface components {
21423
21425
  * @description Pass back as offset to fetch the next page; null when has_more is false
21424
21426
  */
21425
21427
  next_offset?: number | null;
21428
+ /**
21429
+ * Resolved Call Sid
21430
+ * @description When ``conversation_id`` was supplied, this is the underlying ``call_sid`` that the lookup resolved to. Useful for callers that want to drill into per-call surfaces afterward without re-querying ``world.entities``. Null when the caller filtered by ``call_sid`` directly or did not filter by conversation.
21431
+ */
21432
+ resolved_call_sid?: string | null;
21433
+ /**
21434
+ * Resolved Conversation Kind
21435
+ * @description ``entity_type`` of the conversation entity when ``conversation_id`` was supplied (``call`` for voice/sim/scribe, ``conversation`` for text/sms/whatsapp/email). Null otherwise.
21436
+ */
21437
+ resolved_conversation_kind?: ("call" | "conversation") | null;
21426
21438
  };
21427
21439
  /**
21428
21440
  * ProviderType
@@ -41117,7 +41129,9 @@ export interface operations {
41117
41129
  "list-prompt-logs": {
41118
41130
  parameters: {
41119
41131
  query?: {
41120
- /** @description Filter to a single call (Twilio SID or simulation session id) */
41132
+ /** @description Conversation entity UUID (canonical identifier across all modalities voice, text/web, sms, sim, scribe). Resolves to the underlying ``call_sid`` via ``world.entities``. Mutually exclusive with the ``call_sid`` query parameter. */
41133
+ conversation_id?: string | null;
41134
+ /** @description Direct conversation identifier as stored on the prompt-log event: Twilio CA-SID for voice calls, session_id UUID for text/sim/scribe sessions. Most callers should use ``conversation_id`` instead — this is kept for legacy callers and external systems that hold the SID directly. Mutually exclusive with ``conversation_id``. */
41121
41135
  call_sid?: string | null;
41122
41136
  /** @description Filter by prompt_type (e.g. engage_user, navigation, tool) */
41123
41137
  prompt_type?: string | null;
@@ -41149,6 +41163,13 @@ export interface operations {
41149
41163
  "application/json": components["schemas"]["PromptLogListResponse"];
41150
41164
  };
41151
41165
  };
41166
+ /** @description Mutually exclusive filters supplied */
41167
+ 400: {
41168
+ headers: {
41169
+ [name: string]: unknown;
41170
+ };
41171
+ content?: never;
41172
+ };
41152
41173
  /** @description Caller is not admin/owner */
41153
41174
  403: {
41154
41175
  headers: {
@@ -41156,6 +41177,13 @@ export interface operations {
41156
41177
  };
41157
41178
  content?: never;
41158
41179
  };
41180
+ /** @description conversation_id does not match any conversation in this workspace */
41181
+ 404: {
41182
+ headers: {
41183
+ [name: string]: unknown;
41184
+ };
41185
+ content?: never;
41186
+ };
41159
41187
  /** @description Validation Error */
41160
41188
  422: {
41161
41189
  headers: {