@deepraxis/sdk 0.1.1-dev.d25d171 → 0.1.1-dev.ed5af3e

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.
@@ -4,7 +4,7 @@ import { client } from './client.gen.js';
4
4
  /**
5
5
  * Apply Agent Version
6
6
  *
7
- * Apply a version from agents.versions.list by its version number. This idempotent operation changes active_version without creating a version; existing sessions and tokens keep their version. The response is the latest saved agent with its current active_version. Missing versions return 404 Agent version not found; archived agents return 409 Agent is archived. For example, POST /agent/v1/agents/{agent_id}/versions/2/apply with no body.
7
+ * Apply a saved version from agents.versions.list for new sessions and newly issued tokens, without creating a version. Existing sessions and tokens retain their version. The response contains the effective configuration with version equal to active_version and latest_version naming the newest saved version. Missing versions return 404; archived agents return 409. For example, POST /agent/v1/agents/{agent_id}/versions/2/apply with no body.
8
8
  */
9
9
  export const applyAgentVersion = (options) => (options.client ?? client).post({
10
10
  security: [{
@@ -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
  /**
@@ -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
  *
@@ -2580,7 +2492,7 @@ export const agentsCreate = (options) => (options.client ?? client).post({
2580
2492
  /**
2581
2493
  * Get agent
2582
2494
  *
2583
- * Read one agent by id. The top level is the latest saved version, the editable head whose version you send back for optimistic concurrency; after a save with apply false it differs from active_version, and new sessions use active_version, which you read with version=active. With version, read a specific saved version. The response lists every native tool with its resolved configuration in one agent_toolset_20260401 entry, so it can be sent back unchanged to agents.update. Use agents.versions.list to enumerate versions.
2495
+ * Read the agent configuration currently effective for new sessions. By default, version equals active_version and latest_version identifies the newest saved version, including an unapplied save. Use latest_version for optimistic concurrency when updating. Pass version as a positive integer to read that saved version; version=active is equivalent to omission. The response lists every native tool with its resolved configuration in one agent_toolset_20260401 entry, so tools can be sent back unchanged to agents.update. Use agents.versions.list to enumerate saved versions.
2584
2496
  */
2585
2497
  export const agentsRetrieve = (options) => (options.client ?? client).get({
2586
2498
  security: [{
@@ -2598,7 +2510,7 @@ export const agentsRetrieve = (options) => (options.client ?? client).get({
2598
2510
  /**
2599
2511
  * Update agent
2600
2512
  *
2601
- * Update an agent. Send the current version in the body for optimistic concurrency: a stale version returns 409, and an update that changes nothing keeps the version number. Any real change saves a new version. apply defaults to true and moves active_version to the new version, or to the latest when configuration is unchanged; apply false saves without applying. version_note optionally records up to 280 characters on a newly created version; null means no note, and a note sent when the request changes nothing else returns 400 because a note is stored only with a new version. Existing sessions and tokens keep their version. Omitted fields keep their value. multiagent takes null or a coordinator roster; subagent_model keeps its value when omitted and is cleared by null. Archived agents cannot be updated. tools: [] removes every tool, while tools: null returns 400 (tools cannot be null; send [] to remove every tool). On update, omit skills to keep them, send an array to replace them, or send [] or null to clear them. skills attaches uploaded custom skills as [{type: "custom", skill_id, version?}] (skill_id from skills.create or skills.list; at most 20, no repeated skill_id). Omit version, or send "latest", to use the skill's newest version when a session starts. type anthropic returns 400.
2513
+ * Save configuration changes as a new immutable version. Send latest_version from a default retrieve or update response as the request version for optimistic concurrency; a stale value returns 409. apply defaults to true and makes the new version effective; apply false saves without changing active_version. The response contains the effective configuration, with version equal to active_version and latest_version naming the newest saved version. An unchanged configuration, including a note-only update, is a no-op returning 200 and the current effective version without creating or activating a version. version_note records up to 280 characters only when a configuration change creates a new version; null is equivalent to omission. Use agents.versions.apply to activate an existing saved version. Existing sessions and tokens keep their version. Omitted fields keep their value. multiagent takes null or a coordinator roster; subagent_model keeps its value when omitted and is cleared by null. Archived agents cannot be updated. tools: [] removes every tool, while tools: null returns 400 (tools cannot be null; send [] to remove every tool). On update, omit skills to keep them, send an array to replace them, or send [] or null to clear them. skills attaches uploaded custom skills as [{type: "custom", skill_id, version?}] (skill_id from skills.create or skills.list; at most 20, no repeated skill_id). Omit version, or send "latest", to use the skill's newest version when a session starts. type anthropic returns 400.
2602
2514
  */
2603
2515
  export const agentsUpdate = (options) => (options.client ?? client).post({
2604
2516
  security: [{
@@ -2638,7 +2550,7 @@ export const agentsArchive = (options) => (options.client ?? client).post({
2638
2550
  /**
2639
2551
  * List agent versions
2640
2552
  *
2641
- * List the saved versions of one agent, in pages of at most 100 (default 20). Each item is the full agent definition at that version, so you can compare what changed between versions. active is true only for the item that new sessions use; active_version on each item is the agent-level value, kept for compatibility. Use agents.retrieve with version to read a single one; agent_id comes from agents.list or agents.create.
2553
+ * List the saved versions of one agent in ascending version number, oldest first, in pages of at most 100 (default 20). Each item is the full agent definition at that saved version, so you can compare configurations. active is true only for the item new sessions use. active_version on every item is the same agent-level currently effective version; it is not that item's version. Use agents.retrieve with version to read a single saved version; agent_id comes from agents.list or agents.create. Pass next_page as page to continue.
2642
2554
  */
2643
2555
  export const agentsVersionsList = (options) => (options.client ?? client).get({
2644
2556
  security: [{
@@ -2674,7 +2586,7 @@ export const sessionsList = (options) => (options?.client ?? client).get({
2674
2586
  /**
2675
2587
  * Create session
2676
2588
  *
2677
- * Create a session: one conversation with an agent. Pass agent as an agent id or {type:"agent", id, version?}; an id alone, or an object without version, pins the agent's active_version (the version chosen with agents.versions.apply, not necessarily the newest saved one). Unlike Anthropic Managed Agents, omit environment_id to use the default environment saved in the agent version (light for a new agent), unless computer_id (explicit, or the agent's default) selects a Computer; pass an environment id for a sandbox recipe. For service agents, explicit null allocates no machine, so codemode, bash and other machine tools are unavailable. Optional model must be one of the agent's allowed models; optional thinking is {effort: low|medium|high|xhigh|max|none} or null, where null inherits the agent default and then the model default (none requires the model to allow disabling thinking). Selections are saved before initial_events run; invalid ones return 400 invalid_request_error. Unlike Anthropic Managed Agents, the only inline agent override is system ({type:"agent_with_overrides", id, system}); to change the model, tools, MCP servers or skills, save a version instead. Supports vault_ids, up to 50, owned by the current organization and not archived; credential injection is deferred to a later version. budget is {type:"limit", max_list_cost:{amount, currency:"USD"}} where amount is a positive integer string of US cents ("2000" is USD 20.00); omitted budget defaults to "2000" and null removes the limit. Up to 500 file resources can be attached. Use initial_events to send a first user.message in this request, or send messages afterwards with sessions.events.send. The returned status can still be idle before initial events run; read agent.message and the subsequent session.status_idle event to confirm completion.
2589
+ * Create a session: one conversation with an agent. Pass agent as an agent id or {type:"agent", id, version?}; an id alone, or an object without version, pins the agent's active_version (the version chosen with agents.versions.apply, not necessarily the newest saved one). Unlike Anthropic Managed Agents, omit environment_id to use the default environment saved in the agent version (light for a new agent), unless computer_id (explicit, or the agent's default) selects a Computer; pass an environment id for a sandbox recipe. For service agents, explicit null allocates no machine, so codemode, bash and other machine tools are unavailable. Optional model must be one of the agent's allowed models; optional thinking is {effort: low|medium|high|xhigh|max|none} or null, where null inherits the agent default and then the model default (none requires the model to allow disabling thinking). Selections are saved before initial_events run; invalid ones return 400 invalid_request_error. Unlike Anthropic Managed Agents, the only inline agent override is system ({type:"agent_with_overrides", id, system}); to change the model, tools, MCP servers or skills, save a version instead. Supports vault_ids, up to 50, owned by the current organization and not archived; credential injection is deferred to a later version. budget is {type:"limit", max_list_cost:{amount, currency:"USD"}} where amount is a positive decimal string of US dollars with at most 2 decimal places ("20.00" is USD 20.00); omitted budget defaults to "20.00" and null removes the limit. Up to 500 file resources can be attached. Use initial_events to send a first user.message in this request, or send messages afterwards with sessions.events.send. The returned status can still be idle before initial events run; read agent.message and the subsequent session.status_idle event to confirm completion.
2678
2590
  */
2679
2591
  export const sessionsCreate = (options) => (options.client ?? client).post({
2680
2592
  security: [{
@@ -3782,7 +3694,7 @@ export const applicationUploadAssets = (options) => (options.client ?? client).p
3782
3694
  /**
3783
3695
  * List actions
3784
3696
  *
3785
- * Discover callable Actions and their ns/name references without executing them. Combine each returned namespace and name as ns/name; Action calls use the current revision and do not accept @version or @tag. Filter by name or description; results include seven-day statistics and revision summaries without implementation source. Archived actions are excluded by default.
3697
+ * Discover callable Actions and their ns/name references without executing them. Combine each returned namespace and name as ns/name; Action calls use the current revision and do not accept @version or @tag. Filter by name or description; results include seven-day statistics and revision summaries without implementation source. Archived actions are excluded by default. List items carry no input contract: get the action and read current_revision.input_schema. Call it with call("ns/name", input) in a script or call: ns/name with with: in a workflow.
3786
3698
  */
3787
3699
  export const automationActionsList = (options) => (options?.client ?? client).get({
3788
3700
  querySerializer: { parameters: {
@@ -3827,7 +3739,7 @@ export const automationActionsCreate = (options) => (options.client ?? client).p
3827
3739
  /**
3828
3740
  * Get an Action with its current input and output JSON Schemas
3829
3741
  *
3830
- * Read the Action and its full current implementation, with input and output JSON Schemas at current_revision.input_schema and current_revision.output_schema. To read a built-in Action, use ns=praxis and name=<bare name>, for example name=ocr; invoke it in a script with call("ocr", input). The response ETag is the current revision ID for conditional updates.
3742
+ * Read the Action and its full current implementation, with input and output JSON Schemas at current_revision.input_schema and current_revision.output_schema. To read a built-in Action, use ns=praxis and name=<bare name>, for example name=ocr; invoke it in a script with call("ocr", input) or in a workflow step with call: ocr and with:. Input that breaks the contract returns INPUT_INVALID, with the fields in errors[]. The response ETag is the current revision ID for conditional updates.
3831
3743
  */
3832
3744
  export const automationActionsGet = (options) => (options.client ?? client).get({
3833
3745
  security: [{
@@ -4025,7 +3937,7 @@ export const automationScriptsList = (options) => (options?.client ?? client).ge
4025
3937
  /**
4026
3938
  * Create a script
4027
3939
  *
4028
- * Save a TypeScript script as an editable draft for later reuse; this does not publish or start a run. Choose your own namespace without registering it first; praxis is reserved for built-in Actions. Scripts and workflows share names within the tenant; a duplicate returns NAME_TAKEN. The draft is a source string with a default-exported function, for example `export default async (input: {name: string}) => ({greeting: "Hello, " + input.name});`. Scripts provide praxis, call, invoke, console and codemode as module-scope bindings, not on globalThis, with no import needed: praxis.<domain>.<resource>.<method>(...) calls a platform API, call("ocr", input) calls a built-in Action, and invoke("namespace/name", input) starts a child run. Action IDs are strings (bare names for built-ins, namespace/name for your own Actions); praxis.ocr(...) does not exist. To test it, pass that source and language=ts to praxis.automation.runs.create without publishing. To publish later, use the returned draft.revision as expected_draft_revision.
3940
+ * Save a TypeScript script as an editable draft for later reuse; this does not publish or start a run. Choose your own namespace without registering it first; praxis is reserved for built-in Actions. Scripts and workflows share names within the tenant; a duplicate returns NAME_TAKEN. The draft is a source string with a default-exported function, for example `export default async (input: {name: string}) => ({greeting: "Hello, " + input.name});`. Scripts provide praxis, call, invoke, console and codemode as module-scope bindings, not on globalThis, with no import needed: praxis.<domain>.<resource>.<method>(...) calls a platform API, call("ocr", input) calls a built-in Action, and invoke("namespace/name", input) starts a child run. Action IDs are strings (bare names for built-ins, namespace/name for your own Actions); praxis.ocr(...) does not exist. The return value is limited to 1 MiB: write large results to a file with call("write-file", ...) and return the file ID. A call error carries errors[] (pointer, detail, hint); String(e) is only the summary. To test it, pass that source and language=ts to praxis.automation.runs.create without publishing. To publish later, use the returned draft.revision as expected_draft_revision.
4029
3941
  */
4030
3942
  export const automationScriptsCreate = (options) => (options.client ?? client).post({
4031
3943
  security: [{
@@ -4288,7 +4200,7 @@ export const automationWorkflowsList = (options) => (options?.client ?? client).
4288
4200
  /**
4289
4201
  * Create a workflow
4290
4202
  *
4291
- * Save a YAML workflow as an editable draft without publishing or starting a run. Choose your own namespace without registering it first; praxis is reserved for built-in Actions. To test the draft, send its source and language=yaml to praxis.automation.runs.create. Scripts and workflows share names within the tenant; a duplicate returns NAME_TAKEN. run.workflow accepts ns/name@range or {namespace, name, version, input}; run.script uses the same reference shape as a platform extension. Object namespace, name and version are required; version accepts an exact version, dist-tag or range, locked at publication. Object input defaults to {} and supports expressions; string references retain task-level with. run.await defaults to true and returns the child output. With false, the child uses detach and the task immediately returns {run_id}; parent cancellation does not cascade. Inline script.code returns DEFINITION_INVALID with a detail asking you to save a script and reference it first. raise.error retains its type URI, status, title and detail in the run error.
4203
+ * Save a YAML workflow as an editable draft; this does not validate, publish or run it, so check it with validate (kind=workflow) first. Minimal draft: document with dsl ("1.0.3"), namespace, name and version, plus a do list of steps, for example document: {dsl: "1.0.3", namespace: demo, name: add, version: "1.0.0"} and do: [{first: {call: demo/add-one, with: {n: "${ .n }"}}}]. call: <ns/name> calls an Action directly (bare name for built-ins such as ocr) and with is the Action input; the input contract is at current_revision.input_schema in the get-action response. run: starts a saved script or child workflow. The run input is . in the first step, and expressions are jq written as a whole ${ ... } string. Limits: Action 30 s (run-sandbox 10 min), workflow 24 h by default and 30 days at most, payload 1 MiB. Test the draft by sending its source and language=yaml to praxis.automation.runs.create. Guide: /docs/developers/automation/guides/write-workflow. Error details are in the errors[] of the response (pointer, detail, hint). Choose your own namespace without registering it first; praxis is reserved for built-in Actions. Scripts and workflows share names within the tenant; a duplicate returns NAME_TAKEN. run.workflow accepts ns/name@range or {namespace, name, version, input}; run.script uses the same reference shape as a platform extension. Object namespace, name and version are required; version accepts an exact version, dist-tag or range, locked at publication. Object input defaults to {} and supports expressions; string references retain task-level with. run.await defaults to true and returns the child output. With false, the child uses detach and the task immediately returns {run_id}; parent cancellation does not cascade. Inline script.code returns DEFINITION_INVALID with a detail asking you to save a script and reference it first. raise.error retains its type URI, status, title and detail in the run error.
4292
4204
  */
4293
4205
  export const automationWorkflowsCreate = (options) => (options.client ?? client).post({
4294
4206
  security: [{
@@ -4328,7 +4240,7 @@ export const automationWorkflowsGet = (options) => (options.client ?? client).ge
4328
4240
  /**
4329
4241
  * Update a workflow draft
4330
4242
  *
4331
- * Update description, labels or draft with the current draft revision in If-Match. Even metadata-only updates create a new draft revision.
4243
+ * Update description, labels or draft with the current draft revision in If-Match, taken from draft.revision in the get-workflow response. Even metadata-only updates create a new draft revision. A mismatch returns 412 PRECONDITION_FAILED; read the draft again, merge and retry. The draft is not validated here, so check it with validate (kind=workflow) before publishing. Error details are in errors[].
4332
4244
  */
4333
4245
  export const automationWorkflowsPatch = (options) => (options.client ?? client).patch({
4334
4246
  security: [{
@@ -4412,7 +4324,7 @@ export const automationWorkflowsVersions = (options) => (options.client ?? clien
4412
4324
  /**
4413
4325
  * Publish a workflow version
4414
4326
  *
4415
- * Publish a saved definition from its draft or an ad hoc run as a reusable version for named runs or triggers, validating the definition and locking dependencies. To test unpublished code, use praxis.automation.runs.create with source and language instead. Use draft.revision from create or retrieve as expected_draft_revision. The draft must match expected_draft_revision; an ad hoc run requires from_run and expected_source_sha256. The same version and contents return the existing version; different contents return VERSION_EXISTS, prereleases require an explicit tag (not latest, URL-safe characters only, not a version or range; violations return TAG_REQUIRED or TAG_INVALID with the complete rules in hint), and invalid definitions return DEFINITION_INVALID. Stable releases automatically advance latest only above the highest existing stable version; workflows becoming latest synchronize their declared schedule. String and object run.workflow/run.script references share version resolution and dependency locking. Publishing removes +build metadata from the version number.
4327
+ * Publish a saved definition from its draft or an ad hoc run as a reusable version for named runs or triggers, validating the definition and locking dependencies. To test unpublished code, use praxis.automation.runs.create with source and language instead. Use draft.revision from create or retrieve as expected_draft_revision. The draft must match expected_draft_revision; an ad hoc run requires from_run and expected_source_sha256. The same version and contents return the existing version; different contents return VERSION_EXISTS, prereleases require an explicit tag (not latest, URL-safe characters only, not a version or range; violations return TAG_REQUIRED or TAG_INVALID with the complete rules in hint), and invalid definitions return DEFINITION_INVALID. Stable releases automatically advance latest only above the highest existing stable version; workflows becoming latest synchronize their declared schedule. String and object run.workflow/run.script references share version resolution and dependency locking. Publishing removes +build metadata from the version number. For a workflow, document namespace, name and version must equal the publish target, otherwise DEFINITION_IDENTITY_MISMATCH; where a DEFINITION_INVALID failure sits is listed in errors[] (pointer, detail, hint).
4416
4328
  */
4417
4329
  export const automationWorkflowsPublish = (options) => (options.client ?? client).post({
4418
4330
  security: [{
@@ -4532,7 +4444,7 @@ export const automationWorkflowsSetDistTag = (options) => (options.client ?? cli
4532
4444
  /**
4533
4445
  * Validate a definition
4534
4446
  *
4535
- * Check source without executing it when you need diagnostics, inferred schemas or references. This is optional before praxis.automation.runs.create, which also validates source before execution. Actions, scripts and workflows are supported; results include validity without saving. Invalid source is reported with valid=false. Script/action output schemas are inferred from return types: Promise unwrapping, Record, intersections and Date. Unknown types yield an empty schema and a warning in warnings. Source diagnostics use /source or /implementation/source with 1-based line/column. For kind=action the same admission checks as action creation apply (no external imports, platform operations only as direct call(praxis/<api>.<op>, input) calls, no agent or automation calls), so source that validates is not rejected at creation.
4447
+ * Check source without executing it when you need diagnostics, inferred schemas or references. This is optional before praxis.automation.runs.create, which also validates source before execution. Actions, scripts and workflows are supported; results include validity without saving. Invalid source is reported with valid=false. Script/action output schemas are inferred from return types: Promise unwrapping, Record, intersections and Date. Unknown types yield an empty schema and a warning in warnings. Source diagnostics use /source or /implementation/source with 1-based line/column. For kind=action the same admission checks as action creation apply (no external imports, platform operations only as direct call(praxis/<api>.<op>, input) calls, no agent or automation calls), so source that validates is not rejected at creation. For kind=workflow the YAML needs document (dsl, namespace, name, version) and do; each problem is one entry in errors[] (pointer, detail, hint), so read the first one. A listen outside the supported subset (to.all, inside a fork) and emit are not reported here and fail with DEFINITION_INVALID only when a run is created.
4536
4448
  */
4537
4449
  export const automationValidateValidate = (options) => (options.client ?? client).post({
4538
4450
  security: [{
@@ -4620,7 +4532,7 @@ export const automationRunsList = (options) => (options?.client ?? client).get({
4620
4532
  /**
4621
4533
  * Run a published target or execute draft source
4622
4534
  *
4623
- * Execute a published script or workflow with target, or test unpublished code directly with source and language (ts for TypeScript, yaml for workflow YAML), without first saving or publishing a definition. Minimal script: `export default async ({ file_id }: { file_id: string }) => { const result = await call("ocr", { document: { type: "file", file_id } }); return result; }`; send it as source with language="ts", input={"file_id":"<uploaded file ID>"} and wait=0, using a PDF or image already uploaded to your account. To call a platform API directly in the same script, use the praxis SDK object, for example `praxis.model.ocr.create({ body: { model: "glm-ocr", document: { type: "file", file_id } } })`; Action IDs are strings passed to call(), not SDK methods such as praxis.ocr(...). praxis, call, invoke, console and codemode are module-scope bindings, not on globalThis, and need no import; invoke("namespace/name", input) starts a child run. target and source are mutually exclusive; target accepts ns/name@version, @tag or @range and defaults to latest when @ is omitted. Source/input validation precedes run creation, so a separate validate call is optional. input defaults to {} and must match the input schema and fit within 1 MiB. wait is 0–60 seconds (default 0): a terminal run returns 200, otherwise 202. Use the returned id with praxis.automation.runs.retrieve and inspect status, output and error; acceptance does not mean successful completion. For long-running, background or batch work, use wait: 0 and poll the run, or split work into child runs or a workflow; wait only controls the response wait and does not extend execution limits. Actions time out after 30 s (run-sandbox after 10 min); scripts have a 5 min wall-clock limit and a 30 s CPU limit; workflows default to 24 h and allow up to 7 days. Each run can start at most 100 child runs, with at most 20 active at once; nesting depth is limited to 10. Idempotency-Key is scoped to tenant, method and path for 24 hours, excluding wait from the fingerprint; replay returns the current run with Idempotent-Replayed: true, changed contents return 422 and an in-flight request returns 409. New non-deterministic run IDs contain 78 characters, compared with 46 for legacy random IDs; treat IDs as opaque strings. Historical and deterministic IDs remain valid; same-millisecond order is not guaranteed.
4535
+ * Execute a published script or workflow with target, or test unpublished code directly with source and language (ts for TypeScript, yaml for workflow YAML), without first saving or publishing a definition. Minimal script: `export default async ({ file_id }: { file_id: string }) => { const result = await call("ocr", { document: { type: "file", file_id } }); return result; }`; send it as source with language="ts", input={"file_id":"<uploaded file ID>"} and wait=0, using a PDF or image already uploaded to your account. To call a platform API directly in the same script, use the praxis SDK object, for example `praxis.model.ocr.create({ body: { model: "glm-ocr", document: { type: "file", file_id } } })`; Action IDs are strings passed to call(), not SDK methods such as praxis.ocr(...). praxis, call, invoke, console and codemode are module-scope bindings, not on globalThis, and need no import; invoke("namespace/name", input) starts a child run. target and source are mutually exclusive; target accepts ns/name@version, @tag or @range and defaults to latest when @ is omitted. Source/input validation precedes run creation, so a separate validate call is optional. input defaults to {} and must match the input schema and fit within 1 MiB. wait is 0–60 seconds (default 0): a terminal run returns 200, otherwise 202. Use the returned id with praxis.automation.runs.retrieve and inspect status, output and error; acceptance does not mean successful completion. For long-running, background or batch work, use wait: 0 and poll the run, or split work into child runs or a workflow; wait only controls the response wait and does not extend execution limits. Actions time out after 30 s (run-sandbox after 10 min); scripts have a 5 min wall-clock limit and a 30 s CPU limit; workflows default to 24 h and allow up to 30 days. Each run can start at most 100 child runs, with at most 20 active at once; nesting depth is limited to 10. Idempotency-Key is scoped to tenant, method and path for 24 hours, excluding wait from the fingerprint; replay returns the current run with Idempotent-Replayed: true, changed contents return 422 and an in-flight request returns 409. With language=yaml, source is a workflow YAML: the run input is . in the first step, and the shape is described in create workflow. Error details are in errors[] (pointer, detail, hint). New non-deterministic run IDs contain 78 characters, compared with 46 for legacy random IDs; treat IDs as opaque strings. Historical and deterministic IDs remain valid; same-millisecond order is not guaranteed.
4624
4536
  */
4625
4537
  export const automationRunsCreate = (options) => (options.client ?? client).post({
4626
4538
  security: [{
@@ -5123,6 +5035,109 @@ export const automationHooksReceive = (options) => (options.client ?? client).po
5123
5035
  ...options.headers
5124
5036
  }
5125
5037
  });
5038
+ /**
5039
+ * List human tasks
5040
+ *
5041
+ * List the human tasks that praxis/approval workflow steps opened, newest first. By default it returns only open tasks assigned to the caller: their approval inbox. scope=all lists every task of the organization, and status and run_id narrow the list. Use a returned id with retrieve for details and respond to decide. Read-only: listing never changes a task.
5042
+ */
5043
+ export const automationHumanTasksList = (options) => (options?.client ?? client).get({
5044
+ querySerializer: { parameters: { status: { array: { explode: false } } } },
5045
+ security: [{
5046
+ key: 'BearerAuth',
5047
+ scheme: 'bearer',
5048
+ type: 'http'
5049
+ }, {
5050
+ key: 'ApiKeyAuth',
5051
+ name: 'X-API-Key',
5052
+ type: 'apiKey'
5053
+ }],
5054
+ url: '/automation/v1/human-tasks',
5055
+ ...options
5056
+ });
5057
+ /**
5058
+ * Retrieve a human task
5059
+ *
5060
+ * Read one human task - title, Markdown body, context, actions, form, assignees, mode, due time, responses and outcome - so an assignee can choose an action and fill the form. Read-only; the Console approval page /automation/tasks/{id} reads the same resource.
5061
+ */
5062
+ export const automationHumanTasksGet = (options) => (options.client ?? client).get({
5063
+ security: [{
5064
+ key: 'BearerAuth',
5065
+ scheme: 'bearer',
5066
+ type: 'http'
5067
+ }, {
5068
+ key: 'ApiKeyAuth',
5069
+ name: 'X-API-Key',
5070
+ type: 'apiKey'
5071
+ }],
5072
+ url: '/automation/v1/human-tasks/{id}',
5073
+ ...options
5074
+ });
5075
+ /**
5076
+ * Respond to a human task
5077
+ *
5078
+ * Submit an action (action_id), form values (values) and a comment as the calling user. Depending on the task's mode the response either decides it (status becomes completed, outcome is set, and the waiting workflow resumes with outcome as the step output) or is recorded while other assignees are awaited. When two assignees respond at once, exactly one decides and the other gets TASK_CLOSED. An agent may respond only if the workflow set allow_agent_decision. Send an Idempotency-Key to retry safely.
5079
+ */
5080
+ export const automationHumanTasksRespond = (options) => (options.client ?? client).post({
5081
+ security: [{
5082
+ key: 'BearerAuth',
5083
+ scheme: 'bearer',
5084
+ type: 'http'
5085
+ }, {
5086
+ key: 'ApiKeyAuth',
5087
+ name: 'X-API-Key',
5088
+ type: 'apiKey'
5089
+ }],
5090
+ url: '/automation/v1/human-tasks/{id}/respond',
5091
+ ...options,
5092
+ headers: {
5093
+ 'Content-Type': 'application/json',
5094
+ ...options.headers
5095
+ }
5096
+ });
5097
+ /**
5098
+ * Cancel a human task
5099
+ *
5100
+ * Cancel an open human task; only the person who started the run or an organization API key may cancel. The task becomes cancelled and the waiting workflow step raises a runtime error with code HUMAN_TASK_CANCELLED, which try/catch can catch. Open tasks are cancelled automatically when their run ends, so this call is not needed then.
5101
+ */
5102
+ export const automationHumanTasksCancel = (options) => (options.client ?? client).post({
5103
+ security: [{
5104
+ key: 'BearerAuth',
5105
+ scheme: 'bearer',
5106
+ type: 'http'
5107
+ }, {
5108
+ key: 'ApiKeyAuth',
5109
+ name: 'X-API-Key',
5110
+ type: 'apiKey'
5111
+ }],
5112
+ url: '/automation/v1/human-tasks/{id}/cancel',
5113
+ ...options,
5114
+ headers: {
5115
+ 'Content-Type': 'application/json',
5116
+ ...options.headers
5117
+ }
5118
+ });
5119
+ /**
5120
+ * Delegate a human task
5121
+ *
5122
+ * An assignee who has not responded hands their place to another user (to_user), replacing their entry in assignees.users in place, so sequential order is kept. The new user cannot already be an assignee, nor the initiator unless self-approval is allowed. The task must still be open.
5123
+ */
5124
+ export const automationHumanTasksDelegate = (options) => (options.client ?? client).post({
5125
+ security: [{
5126
+ key: 'BearerAuth',
5127
+ scheme: 'bearer',
5128
+ type: 'http'
5129
+ }, {
5130
+ key: 'ApiKeyAuth',
5131
+ name: 'X-API-Key',
5132
+ type: 'apiKey'
5133
+ }],
5134
+ url: '/automation/v1/human-tasks/{id}/delegate',
5135
+ ...options,
5136
+ headers: {
5137
+ 'Content-Type': 'application/json',
5138
+ ...options.headers
5139
+ }
5140
+ });
5126
5141
  /**
5127
5142
  * List databases
5128
5143
  *