@deepraxis/sdk 0.1.1-dev.b176367 → 0.1.1-dev.bdcd5e6

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.
@@ -82,13 +82,13 @@ export const setRunFeedback = (options) => (options.client ?? client).post({
82
82
  }
83
83
  });
84
84
  /**
85
- * List End Users
85
+ * List customers
86
86
  *
87
- * List users who have sessions or token issuance history on a service agent.
87
+ * List the customers of a service agent, identified and anonymous, most recently seen first.
88
88
  *
89
- * Ordered by last_active_at and external_user_id descending. q is a case-sensitive literal prefix, including underscores. limit is 1–100, default 20. Reuse next_page with the same organization, agent, q and limit. Preemptively blocked users without history do not appear. End-user credentials and inaccessible or personal agents return 404.
89
+ * Call this from your backend with your API key, or from the console. Customers follow Shopify Admin customers (list, retrieve, block, sign-out and data deletion of the people who use your storefront), so that experience applies. The list includes customers who signed in but have not started a session yet, and customers recorded under your own ids by embed tokens before customer sign-in existed; an id first seen that way is identified unless it starts with anon_. Unlike Shopify, a customer can be anonymous: a visitor admitted with the publishable key gets an anon_ id, and when it later signs in with anonymous_access_token it is merged: merged_into names the identified customer, and its sessions count toward that customer. Filter with q (a case-sensitive customer id prefix), type (identified or anonymous) and blocked (true or false). limit is 1 to 100, default 20; reuse next_page with the same filters and limit. A customer access token gets 404. Example: GET /agent/v1/agents/agent_example/customers?type=identified&blocked=false&limit=50.
90
90
  */
91
- export const listEndUsers = (options) => (options.client ?? client).get({
91
+ export const listCustomers = (options) => (options.client ?? client).get({
92
92
  security: [{
93
93
  key: 'BearerAuth',
94
94
  scheme: 'bearer',
@@ -98,17 +98,17 @@ export const listEndUsers = (options) => (options.client ?? client).get({
98
98
  name: 'X-API-Key',
99
99
  type: 'apiKey'
100
100
  }],
101
- url: '/agent/v1/agents/{agent_id}/end_users',
101
+ url: '/agent/v1/agents/{agent_id}/customers',
102
102
  ...options
103
103
  });
104
104
  /**
105
- * Delete end-user data
105
+ * Delete customer data
106
106
  *
107
- * Delete a host application's end-user data from one service agent after explicit confirmation.
107
+ * Delete a customer's data from one service agent after explicit confirmation.
108
108
  *
109
- * Develop only. Set confirm to the exact external_user_id; missing or mismatched confirmation returns 400. Returns 202 with a pending task id, not completion. Poll the deletion endpoint. Concurrent requests reuse the unfinished task; retry DELETE after failure to resume it. Tokens are revoked and the user is blocked before a seven-day recovery snapshot is verified. Sessions including child sessions, conversation data, grants and feedback are then removed. A pre-existing block remains; a temporary block is removed on success. Attachment metadata is recorded and File attachments are retained. No charge is introduced by this operation. Example: DELETE /agent/v1/agents/agent_example/end_users/customer_123?confirm=customer_123.
109
+ * Develop only. Set confirm to the exact customer id; a missing or different confirm returns 400 naming the value to send. Returns 202 with a pending task id; poll the deletion endpoint. Concurrent requests reuse the unfinished task; retry DELETE after failure to resume it. Tokens are revoked and the customer is blocked before a seven-day recovery snapshot is verified; sessions including child sessions, conversation data, grants and feedback are then removed. A block that existed before stays; a temporary block is removed on success. File attachments are retained. Example: DELETE /agent/v1/agents/agent_example/customers/cus_8f2a91?confirm=cus_8f2a91.
110
110
  */
111
- export const deleteEndUser = (options) => (options.client ?? client).delete({
111
+ export const deleteCustomer = (options) => (options.client ?? client).delete({
112
112
  security: [{
113
113
  key: 'BearerAuth',
114
114
  scheme: 'bearer',
@@ -118,17 +118,17 @@ export const deleteEndUser = (options) => (options.client ?? client).delete({
118
118
  name: 'X-API-Key',
119
119
  type: 'apiKey'
120
120
  }],
121
- url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}',
121
+ url: '/agent/v1/agents/{agent_id}/customers/{customer_id}',
122
122
  ...options
123
123
  });
124
124
  /**
125
- * Get End User
125
+ * Get customer
126
126
  *
127
- * Inspect one end user and their twenty most recently updated sessions.
127
+ * Retrieve one customer of a service agent with its twenty most recently updated sessions.
128
128
  *
129
- * Use external_user_id from listing or your host application. Users without session or issuance history return 404, including preemptively blocked users. End-user credentials and inaccessible or personal agents return 404.
129
+ * Use the customer id from the list or your own customer_id. An unknown customer returns 404 CUSTOMER_NOT_FOUND, and so does a customer access token. Unlike Shopify, an identified customer's session_count, cost and recent_sessions include the sessions of anonymous customers merged into it; the merged anonymous customer still shows its own sessions and its merged_into.
130
130
  */
131
- export const getEndUser = (options) => (options.client ?? client).get({
131
+ export const getCustomer = (options) => (options.client ?? client).get({
132
132
  security: [{
133
133
  key: 'BearerAuth',
134
134
  scheme: 'bearer',
@@ -138,17 +138,17 @@ export const getEndUser = (options) => (options.client ?? client).get({
138
138
  name: 'X-API-Key',
139
139
  type: 'apiKey'
140
140
  }],
141
- url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}',
141
+ url: '/agent/v1/agents/{agent_id}/customers/{customer_id}',
142
142
  ...options
143
143
  });
144
144
  /**
145
- * Get end-user deletion
145
+ * Get customer deletion
146
146
  *
147
- * Poll the latest deletion task for an end user, including after the user data has been removed.
147
+ * Poll the latest deletion task of a customer, including after its data has been removed.
148
148
  *
149
- * Use the same agent_id and external_user_id as the confirmed DELETE. Status is pending, snapshotting, deleting, done or failed. Counts are empty until a verified snapshot exists. A failed task remains blocked and resumes when DELETE is retried with matching confirmation. snapshot_key is an operator recovery reference retained for seven days, not a public download URL. End-user credentials, inaccessible or personal agents, and missing tasks return 404. This read does not create a task or charge usage.
149
+ * Use the same agent_id and customer id as the confirmed DELETE. Status is pending, snapshotting, deleting, done or failed. Counts are empty until a verified snapshot exists. snapshot_key is an operator recovery reference retained for seven days, not a download URL. A customer access token and a missing task return 404.
150
150
  */
151
- export const getEndUserDeletion = (options) => (options.client ?? client).get({
151
+ export const getCustomerDeletion = (options) => (options.client ?? client).get({
152
152
  security: [{
153
153
  key: 'BearerAuth',
154
154
  scheme: 'bearer',
@@ -158,17 +158,17 @@ export const getEndUserDeletion = (options) => (options.client ?? client).get({
158
158
  name: 'X-API-Key',
159
159
  type: 'apiKey'
160
160
  }],
161
- url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}/deletion',
161
+ url: '/agent/v1/agents/{agent_id}/customers/{customer_id}/deletion',
162
162
  ...options
163
163
  });
164
164
  /**
165
- * Revoke End User Tokens
165
+ * Block customer
166
166
  *
167
- * Revoke all issued tokens for an end user and terminate their open embed streams.
167
+ * Block a customer and end every sign-in it has on this agent.
168
168
  *
169
- * Revokes credentials before marking grants revoked. Upstream failure returns 502 without changing grant revocation timestamps. Returns the count of newly revoked grants; a repeat without new grants returns zero. Does not block future issuance. End-user credentials and inaccessible or personal agents return 404.
169
+ * Blocks the customer, then ends every live sign-in the way logout does: each access token is revoked and its open event streams close. From then on grant_codes, access_tokens, renew and new sessions for this customer return CUSTOMER_BLOCKED until you unblock it. Idempotent: a repeat keeps the first block time and revokes whatever is still live. If credential revocation fails the request returns 502 and the customer stays blocked; retry to finish. An unknown customer returns 404 CUSTOMER_NOT_FOUND.
170
170
  */
171
- export const revokeEndUserTokens = (options) => (options.client ?? client).post({
171
+ export const blockCustomer = (options) => (options.client ?? client).post({
172
172
  security: [{
173
173
  key: 'BearerAuth',
174
174
  scheme: 'bearer',
@@ -178,17 +178,17 @@ export const revokeEndUserTokens = (options) => (options.client ?? client).post(
178
178
  name: 'X-API-Key',
179
179
  type: 'apiKey'
180
180
  }],
181
- url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}/revoke_tokens',
181
+ url: '/agent/v1/agents/{agent_id}/customers/{customer_id}/block',
182
182
  ...options
183
183
  });
184
184
  /**
185
- * Block End User
185
+ * Unblock customer
186
186
  *
187
- * Block token issuance and session creation, then revoke existing tokens for an end user.
187
+ * Allow a blocked customer to sign in and start sessions again.
188
188
  *
189
- * May block a user before any history exists; timestamps are then null and counts and cost are zero. Requires an embed policy, otherwise returns 409 with setup guidance. Deduplicates the policy blocklist and retains its 1000-user maximum. If revocation returns 502, the user remains blocked; retry to finish revocation. Repeats keep the user blocked and revoke any remaining grants. End-user credentials and inaccessible or personal agents return 404.
189
+ * Idempotent. Access tokens revoked while the customer was blocked stay revoked; sign the customer in again with a new grant code. An unknown customer returns 404 CUSTOMER_NOT_FOUND.
190
190
  */
191
- export const blockEndUser = (options) => (options.client ?? client).post({
191
+ export const unblockCustomer = (options) => (options.client ?? client).post({
192
192
  security: [{
193
193
  key: 'BearerAuth',
194
194
  scheme: 'bearer',
@@ -198,17 +198,17 @@ export const blockEndUser = (options) => (options.client ?? client).post({
198
198
  name: 'X-API-Key',
199
199
  type: 'apiKey'
200
200
  }],
201
- url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}/block',
201
+ url: '/agent/v1/agents/{agent_id}/customers/{customer_id}/unblock',
202
202
  ...options
203
203
  });
204
204
  /**
205
- * Unblock End User
205
+ * Revoke customer tokens
206
206
  *
207
- * Allow an end user to receive new tokens and create new sessions again.
207
+ * Sign a customer out everywhere without blocking it.
208
208
  *
209
- * Removes the user from the blocklist; previously revoked tokens stay revoked. Idempotent. Requires an embed policy, otherwise returns 409 with setup guidance. Returns null timestamps and zero counts and cost when no session or issuance history exists. End-user credentials and inaccessible or personal agents return 404.
209
+ * Ends every live sign-in of the customer, revoking each access token and closing its open event streams; the customer can sign in again right away. Returns the number of access tokens this request revoked; a repeat returns 0. Credential revocation failure returns 502; retry to finish. An unknown customer returns 404 CUSTOMER_NOT_FOUND.
210
210
  */
211
- export const unblockEndUser = (options) => (options.client ?? client).post({
211
+ export const revokeCustomerTokens = (options) => (options.client ?? client).post({
212
212
  security: [{
213
213
  key: 'BearerAuth',
214
214
  scheme: 'bearer',
@@ -218,7 +218,27 @@ export const unblockEndUser = (options) => (options.client ?? client).post({
218
218
  name: 'X-API-Key',
219
219
  type: 'apiKey'
220
220
  }],
221
- url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}/unblock',
221
+ url: '/agent/v1/agents/{agent_id}/customers/{customer_id}/revoke_tokens',
222
+ ...options
223
+ });
224
+ /**
225
+ * Get agent appearance
226
+ *
227
+ * Read the saved chat appearance of a service agent.
228
+ *
229
+ * Agent Kit calls this from the page with a customer access token of this agent; your API key and console members can read it too. A token of another agent returns 404. The body is the same as the embed appearance read; a missing appearance returns the agent's own name and avatar only. Responses are private and cacheable for 60 seconds.
230
+ */
231
+ export const getAgentAppearance = (options) => (options.client ?? client).get({
232
+ security: [{
233
+ key: 'BearerAuth',
234
+ scheme: 'bearer',
235
+ type: 'http'
236
+ }, {
237
+ key: 'ApiKeyAuth',
238
+ name: 'X-API-Key',
239
+ type: 'apiKey'
240
+ }],
241
+ url: '/agent/v1/agents/{agent_id}/appearance',
222
242
  ...options
223
243
  });
224
244
  /**
@@ -226,7 +246,7 @@ export const unblockEndUser = (options) => (options.client ?? client).post({
226
246
  *
227
247
  * Sign your logged-in customer in to a service agent from your backend with a one-time grant code that Agent Kit exchanges for a customer access token.
228
248
  *
229
- * Call this from your backend with your API key after your own login succeeds, then pass the returned code to Agent Kit in the browser; never call it from the browser. Customer authorization follows Shopify Storefront customer access tokens (Multipass-style sign-in, a short-lived token, renewal and logout), so that experience applies. customer_id is your own identifier for the customer: use an opaque id such as your database user id, not an email address or phone number. The value auth is reserved, and ids starting with anon_ are reserved for anonymous customers. The code works once and expires after expires_in seconds (default 900). The sign-in it starts lasts max_session_seconds (default 7 days); version, budget_cents, system_message, agent_override and metadata apply to every token of the sign-in. Unlike Shopify, origin binds the whole sign-in to one page origin, and anonymous_access_token merges the conversations of the anonymous visitor who chatted before signing in into this customer. Example body: {"customer_id":"cus_8f2a91","origin":"https://shop.example.com"}.
249
+ * Call this from your backend with your API key after your own login succeeds, then pass the returned code to Agent Kit in the browser; never call it from the browser. Customer authorization follows Shopify Storefront customer access tokens (Multipass-style sign-in, a short-lived token, renewal and logout), so that experience applies. customer_id is your own identifier for the customer: use an opaque id such as your database user id, not an email address or phone number. The value auth is reserved, and ids starting with anon_ are reserved for anonymous customers. The code works once and expires after expires_in seconds (default 900). The sign-in it starts lasts max_session_seconds (default 7 days); version, budget (US dollars, at most 2 decimals), system_message, agent_override and metadata apply to every token of the sign-in. Unlike Shopify, origin binds the whole sign-in to one page origin, and anonymous_access_token merges the conversations of the anonymous visitor who chatted before signing in into this customer. Example body: {"customer_id":"cus_8f2a91","origin":"https://shop.example.com"}.
230
250
  */
231
251
  export const createCustomerGrantCode = (options) => (options.client ?? client).post({
232
252
  security: [{
@@ -300,100 +320,6 @@ export const deleteCurrentCustomerAccessToken = (options) => (options.client ??
300
320
  url: '/agent/v1/agents/{agent_id}/customers/auth/access_tokens/current',
301
321
  ...options
302
322
  });
303
- /**
304
- * Exchange Hosted Code
305
- *
306
- * Redeem a single-use hosted link credential for an end-user token.
307
- *
308
- * Read code from the c fragment parameter of hosted_url returned by embed token creation with hosted true, then remove the fragment before exchanging. No Authorization header is required; the code authenticates this request. The code expires after 60 seconds and is consumed atomically on exchange, so concurrent attempts have only one winner. Expired, used and unknown codes return the same 404 body. Keep the token in memory and return to the host website for a fresh link when it expires; exchange cannot refresh it. Requests are IP limited per minute using the anonymous entrypoint budget (default 20). Example body is {"code":"<code from hosted_url>"}.
309
- */
310
- export const exchangeEmbedCode = (options) => (options.client ?? client).post({
311
- url: '/agent/v1/embed/exchange',
312
- ...options,
313
- headers: {
314
- 'Content-Type': 'application/json',
315
- ...options.headers
316
- }
317
- });
318
- /**
319
- * Issue anonymous visitor token
320
- *
321
- * Obtain a short-lived embedding token for a visitor without an account using the agent owner's publishable key.
322
- *
323
- * No Authorization header is required. Send the browser Origin allowed by the agent policy. Save a returned visitor_secret and reuse it for refreshes; only new visitors receive one. Unknown secrets create new visitors, and extra fields including visitor_id return 400. Issuance uses the key creator's organization membership, the key session budget and the smaller of the policy TTL maximum and 3600 seconds. IP requests are limited per minute (default 20); UTC daily session and spending caps are checked across the key's primary sessions created that day. Token issuance itself does not create a session or charge usage; subsequent sessions bill the host organization. Example body: {"publishable_key":"pk_praxis_example"}.
324
- */
325
- export const createAnonymousEmbedToken = (options) => (options.client ?? client).post({
326
- url: '/agent/v1/embed_tokens/anonymous',
327
- ...options,
328
- headers: {
329
- 'Content-Type': 'application/json',
330
- ...options.headers
331
- }
332
- });
333
- /**
334
- * List Embed Tokens
335
- *
336
- * List embed token issuance records in your organization.
337
- *
338
- * Includes expired and revoked grants; returns neither token nor token_id. Sorts by created_at, then grant id, both descending. agent_id accepts agent_ or agt_; external_user_id matches exactly. limit is 1–100 (default 20). Reuse next_page as page with the same filters and organization; a mismatch returns 400. End-user credentials return 404.
339
- */
340
- export const listEmbedTokens = (options) => (options?.client ?? client).get({
341
- security: [{
342
- key: 'BearerAuth',
343
- scheme: 'bearer',
344
- type: 'http'
345
- }, {
346
- key: 'ApiKeyAuth',
347
- name: 'X-API-Key',
348
- type: 'apiKey'
349
- }],
350
- url: '/agent/v1/embed_tokens',
351
- ...options
352
- });
353
- /**
354
- * Create Embed Token
355
- *
356
- * Issue a short-lived credential on your backend for an end user of a service agent.
357
- *
358
- * Requires an active service agent in your organization with an embed policy. Pins the requested version or the latest version and snapshots the policy environment, vaults and resources; metadata comes from the request. Blocked users cannot receive tokens. Keep your API key on the backend and pass only the returned token to the frontend. Every call creates a new grant; issuance is not idempotent. Set hosted to true to also receive hosted_url; redirect the user there within 60 seconds. The agent must have an identity_number. The URL fragment contains a single-use exchange credential, not the token. Omit hosted or set false for ordinary token issuance.
359
- */
360
- export const createEmbedToken = (options) => (options.client ?? client).post({
361
- security: [{
362
- key: 'BearerAuth',
363
- scheme: 'bearer',
364
- type: 'http'
365
- }, {
366
- key: 'ApiKeyAuth',
367
- name: 'X-API-Key',
368
- type: 'apiKey'
369
- }],
370
- url: '/agent/v1/embed_tokens',
371
- ...options,
372
- headers: {
373
- 'Content-Type': 'application/json',
374
- ...options.headers
375
- }
376
- });
377
- /**
378
- * Revoke Embed Token
379
- *
380
- * Revoke an embed token and close its open event streams.
381
- *
382
- * Use an id from issuance or listing. Revokes the credential before setting revoked_at; upstream failure leaves it unset. Streams receive session.error (EMBED_TOKEN_REVOKED), then close immediately; other credentials are unaffected. Idempotent; repeats return the original revoked record without another revocation or audit. Missing or foreign grants and end-user credentials return 404.
383
- */
384
- export const revokeEmbedToken = (options) => (options.client ?? client).post({
385
- security: [{
386
- key: 'BearerAuth',
387
- scheme: 'bearer',
388
- type: 'http'
389
- }, {
390
- key: 'ApiKeyAuth',
391
- name: 'X-API-Key',
392
- type: 'apiKey'
393
- }],
394
- url: '/agent/v1/embed_tokens/{id}/revoke',
395
- ...options
396
- });
397
323
  /**
398
324
  * List Computers
399
325
  *
@@ -839,20 +765,6 @@ export const listSessionCompactions = (options) => (options.client ?? client).ge
839
765
  url: '/agent/v1/sessions/{session_id}/compactions',
840
766
  ...options
841
767
  });
842
- /**
843
- * Read chat appearance
844
- *
845
- * Load saved appearance for an iframe or Hosted chat page. Supply an end-user embed token as Bearer authorization, or a console-issued publishable key in Praxis-Publishable-Key before anonymous token issuance. The credential selects the agent; identity_number and agent_id query parameters are rejected with 400. Missing appearance returns an empty object. Kit option names retain camelCase. Responses are private and cacheable for 60 seconds. Component hosts configure Kit in their own code instead.
846
- */
847
- export const getEmbedAppearance = (options) => (options?.client ?? client).get({
848
- security: [{
849
- key: 'BearerAuth',
850
- scheme: 'bearer',
851
- type: 'http'
852
- }, { name: 'Praxis-Publishable-Key', type: 'apiKey' }],
853
- url: '/agent/v1/embed/appearance',
854
- ...options
855
- });
856
768
  /**
857
769
  * Generate speech
858
770
  *