@deepraxis/sdk 0.1.0-dev.449ac38 → 0.1.0-dev.67c7f3b

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.
@@ -45,6 +45,176 @@ export const setRunFeedback = (options) => (options.client ?? client).post({
45
45
  ...options.headers
46
46
  }
47
47
  });
48
+ /**
49
+ * List End Users
50
+ *
51
+ * List users who have sessions or token issuance history on a service agent.
52
+ *
53
+ * 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.
54
+ */
55
+ export const listEndUsers = (options) => (options.client ?? client).get({
56
+ security: [{
57
+ key: 'BearerAuth',
58
+ scheme: 'bearer',
59
+ type: 'http'
60
+ }, {
61
+ key: 'ApiKeyAuth',
62
+ name: 'X-API-Key',
63
+ type: 'apiKey'
64
+ }],
65
+ url: '/agent/v1/agents/{agent_id}/end_users',
66
+ ...options
67
+ });
68
+ /**
69
+ * Delete end-user data
70
+ *
71
+ * Delete a host application's end-user data from one service agent after explicit confirmation.
72
+ *
73
+ * 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.
74
+ */
75
+ export const deleteEndUser = (options) => (options.client ?? client).delete({
76
+ security: [{
77
+ key: 'BearerAuth',
78
+ scheme: 'bearer',
79
+ type: 'http'
80
+ }, {
81
+ key: 'ApiKeyAuth',
82
+ name: 'X-API-Key',
83
+ type: 'apiKey'
84
+ }],
85
+ url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}',
86
+ ...options
87
+ });
88
+ /**
89
+ * Get End User
90
+ *
91
+ * Inspect one end user and their twenty most recently updated sessions.
92
+ *
93
+ * 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.
94
+ */
95
+ export const getEndUser = (options) => (options.client ?? client).get({
96
+ security: [{
97
+ key: 'BearerAuth',
98
+ scheme: 'bearer',
99
+ type: 'http'
100
+ }, {
101
+ key: 'ApiKeyAuth',
102
+ name: 'X-API-Key',
103
+ type: 'apiKey'
104
+ }],
105
+ url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}',
106
+ ...options
107
+ });
108
+ /**
109
+ * Get end-user deletion
110
+ *
111
+ * Poll the latest deletion task for an end user, including after the user data has been removed.
112
+ *
113
+ * 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.
114
+ */
115
+ export const getEndUserDeletion = (options) => (options.client ?? client).get({
116
+ security: [{
117
+ key: 'BearerAuth',
118
+ scheme: 'bearer',
119
+ type: 'http'
120
+ }, {
121
+ key: 'ApiKeyAuth',
122
+ name: 'X-API-Key',
123
+ type: 'apiKey'
124
+ }],
125
+ url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}/deletion',
126
+ ...options
127
+ });
128
+ /**
129
+ * Revoke End User Tokens
130
+ *
131
+ * Revoke all issued tokens for an end user and terminate their open embed streams.
132
+ *
133
+ * 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.
134
+ */
135
+ export const revokeEndUserTokens = (options) => (options.client ?? client).post({
136
+ security: [{
137
+ key: 'BearerAuth',
138
+ scheme: 'bearer',
139
+ type: 'http'
140
+ }, {
141
+ key: 'ApiKeyAuth',
142
+ name: 'X-API-Key',
143
+ type: 'apiKey'
144
+ }],
145
+ url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}/revoke_tokens',
146
+ ...options
147
+ });
148
+ /**
149
+ * Block End User
150
+ *
151
+ * Block token issuance and session creation, then revoke existing tokens for an end user.
152
+ *
153
+ * 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.
154
+ */
155
+ export const blockEndUser = (options) => (options.client ?? client).post({
156
+ security: [{
157
+ key: 'BearerAuth',
158
+ scheme: 'bearer',
159
+ type: 'http'
160
+ }, {
161
+ key: 'ApiKeyAuth',
162
+ name: 'X-API-Key',
163
+ type: 'apiKey'
164
+ }],
165
+ url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}/block',
166
+ ...options
167
+ });
168
+ /**
169
+ * Unblock End User
170
+ *
171
+ * Allow an end user to receive new tokens and create new sessions again.
172
+ *
173
+ * 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.
174
+ */
175
+ export const unblockEndUser = (options) => (options.client ?? client).post({
176
+ security: [{
177
+ key: 'BearerAuth',
178
+ scheme: 'bearer',
179
+ type: 'http'
180
+ }, {
181
+ key: 'ApiKeyAuth',
182
+ name: 'X-API-Key',
183
+ type: 'apiKey'
184
+ }],
185
+ url: '/agent/v1/agents/{agent_id}/end_users/{external_user_id}/unblock',
186
+ ...options
187
+ });
188
+ /**
189
+ * Exchange Hosted Code
190
+ *
191
+ * Redeem a single-use hosted link credential for an end-user token.
192
+ *
193
+ * 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>"}.
194
+ */
195
+ export const exchangeEmbedCode = (options) => (options.client ?? client).post({
196
+ url: '/agent/v1/embed/exchange',
197
+ ...options,
198
+ headers: {
199
+ 'Content-Type': 'application/json',
200
+ ...options.headers
201
+ }
202
+ });
203
+ /**
204
+ * Issue anonymous visitor token
205
+ *
206
+ * Obtain a short-lived embedding token for a visitor without an account using the agent owner's publishable key.
207
+ *
208
+ * 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"}.
209
+ */
210
+ export const createAnonymousEmbedToken = (options) => (options.client ?? client).post({
211
+ url: '/agent/v1/embed_tokens/anonymous',
212
+ ...options,
213
+ headers: {
214
+ 'Content-Type': 'application/json',
215
+ ...options.headers
216
+ }
217
+ });
48
218
  /**
49
219
  * List Embed Tokens
50
220
  *
@@ -70,7 +240,7 @@ export const listEmbedTokens = (options) => (options?.client ?? client).get({
70
240
  *
71
241
  * Issue a short-lived credential on your backend for an end user of a service agent.
72
242
  *
73
- * 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. The hosted field is not supported.
243
+ * 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.
74
244
  */
75
245
  export const createEmbedToken = (options) => (options.client ?? client).post({
76
246
  security: [{
@@ -307,7 +477,7 @@ export const computersFilesContent = (options) => (options.client ?? client).get
307
477
  *
308
478
  * Resume the computer and issue a sandbox connection.
309
479
  *
310
- * Own-face extension: Managed Agents has no persistent Computer connection. Returns the public SDK sandbox_id, envd_access_token and template_id. Archived computers remain accessible; foreign or absent computers return 404. Never cache credentials.
480
+ * Own-face extension: Managed Agents has no persistent Computer connection. Returns the public SDK sandbox_id, envd_access_token and template_id, plus the machine tier the computer is on now (light or heavy) and the lease that keeps it there (lease_id, lease_expires_at; lease_id is null when no lease exists). Keep the lease while the connection stays open: renew it about every 20 seconds (POST .../leases/{lease_id}/renew) and release it on close (DELETE .../leases/{lease_id}). An unrenewed lease simply expires, and the full machine is reclaimed only after that. Archived computers remain accessible; foreign or absent computers return 404. Never cache credentials.
311
481
  */
312
482
  export const connectComputer = (options) => (options.client ?? client).post({
313
483
  security: [{
@@ -322,6 +492,46 @@ export const connectComputer = (options) => (options.client ?? client).post({
322
492
  url: '/agent/v1/computers/{computer_id}/connect',
323
493
  ...options
324
494
  });
495
+ /**
496
+ * Renew computer lease
497
+ *
498
+ * Extend the lease a connection holds so the full machine stays in service while the connection is open.
499
+ *
500
+ * Own-face extension. A lease that is no longer valid (released, expired, or the computer moved to another machine) returns 409 LEASE_STALE; call connect again for a new connection and lease. Foreign or absent computers return 404.
501
+ */
502
+ export const renewComputerLease = (options) => (options.client ?? client).post({
503
+ security: [{
504
+ key: 'BearerAuth',
505
+ scheme: 'bearer',
506
+ type: 'http'
507
+ }, {
508
+ key: 'ApiKeyAuth',
509
+ name: 'X-API-Key',
510
+ type: 'apiKey'
511
+ }],
512
+ url: '/agent/v1/computers/{computer_id}/leases/{lease_id}/renew',
513
+ ...options
514
+ });
515
+ /**
516
+ * Release computer lease
517
+ *
518
+ * Give the lease back when a connection closes so the full machine can be reclaimed without waiting for it to expire.
519
+ *
520
+ * Own-face extension. Idempotent: an unknown or already released lease succeeds as well. Foreign or absent computers return 404.
521
+ */
522
+ export const releaseComputerLease = (options) => (options.client ?? client).delete({
523
+ security: [{
524
+ key: 'BearerAuth',
525
+ scheme: 'bearer',
526
+ type: 'http'
527
+ }, {
528
+ key: 'ApiKeyAuth',
529
+ name: 'X-API-Key',
530
+ type: 'apiKey'
531
+ }],
532
+ url: '/agent/v1/computers/{computer_id}/leases/{lease_id}',
533
+ ...options
534
+ });
325
535
  /**
326
536
  * List Toolsets
327
537
  *
@@ -508,6 +718,20 @@ export const listSessionCompactions = (options) => (options.client ?? client).ge
508
718
  url: '/agent/v1/sessions/{session_id}/compactions',
509
719
  ...options
510
720
  });
721
+ /**
722
+ * Read chat appearance
723
+ *
724
+ * 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.
725
+ */
726
+ export const getEmbedAppearance = (options) => (options?.client ?? client).get({
727
+ security: [{
728
+ key: 'BearerAuth',
729
+ scheme: 'bearer',
730
+ type: 'http'
731
+ }, { name: 'Praxis-Publishable-Key', type: 'apiKey' }],
732
+ url: '/agent/v1/embed/appearance',
733
+ ...options
734
+ });
511
735
  /**
512
736
  * Generate speech
513
737
  *
@@ -2086,7 +2310,7 @@ export const agentsList = (options) => (options?.client ?? client).get({
2086
2310
  /**
2087
2311
  * Create agent
2088
2312
  *
2089
- * Create a reusable agent definition, then pass its returned id to sessions.create to start a conversation. The definition includes model, system prompt, tools, MCP servers and an optional multiagent roster. It is saved as version 1; real updates create new versions. Unlike Anthropic Managed Agents, nonempty skills attachments and custom tool entries return 400; the native skill tool is separate from the skills field. Use tools: [{type: "agent_toolset_20260401"}] for built-in tools including codemode, skill and agent; inspect toolsets.list for names and schemas, and keep bash enabled for native additions. To offer only some tools, set default_config: {enabled: false} and list the tools to keep in configs, e.g. tools: [{type: "agent_toolset_20260401", default_config: {enabled: false}, configs: [{name: "codemode", enabled: true}, {name: "bash", enabled: true, permission_policy: {type: "always_ask"}}]}]; every tool not listed, including todo_write, enter_plan_mode, ask_user_question and goal_read, follows default_config, and the response echoes it. codemode runs through bash, so enabling codemode while bash is disabled returns 400. Optional mcp_toolset entries pair with mcp_servers. model accepts platform model IDs such as deepseek-flash, not only the Claude IDs in the protocol examples. model.settings.reasoning sets default thinking; other extra model controls return 400. Example: {"name":"helper","model":{"id":"deepseek-flash"},"tools":[{"type":"agent_toolset_20260401"}]}.
2313
+ * Create a reusable agent definition, then pass its returned id to sessions.create to start a conversation. The definition includes model, system prompt, tools, MCP servers and an optional multiagent roster. It is saved as version 1; real updates create new versions. Unlike Anthropic Managed Agents, nonempty skills attachments return 400; the native skill tool is separate from the skills field. Use tools: [{type: "agent_toolset_20260401"}] for built-in tools including codemode, skill and agent; inspect toolsets.list for names and schemas, and keep bash enabled for native additions. To offer only some tools, set default_config: {enabled: false} and list the tools to keep in configs, e.g. tools: [{type: "agent_toolset_20260401", default_config: {enabled: false}, configs: [{name: "codemode", enabled: true}, {name: "bash", enabled: true, permission_policy: {type: "always_ask"}}]}]; every tool not listed, including todo_write, enter_plan_mode, ask_user_question and goal_read, follows default_config, and the response echoes it. codemode runs through bash, so enabling codemode while bash is disabled returns 400. Optional mcp_toolset entries pair with mcp_servers. model accepts platform model IDs such as deepseek-flash, not only the Claude IDs in the protocol examples. model.settings.reasoning sets default thinking; other extra model controls return 400. Example: {"name":"helper","model":{"id":"deepseek-flash"},"tools":[{"type":"agent_toolset_20260401"}]}.
2090
2314
  */
2091
2315
  export const agentsCreate = (options) => (options.client ?? client).post({
2092
2316
  security: [{
@@ -2126,7 +2350,7 @@ export const agentsRetrieve = (options) => (options.client ?? client).get({
2126
2350
  /**
2127
2351
  * Update agent
2128
2352
  *
2129
- * 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; existing sessions keep the version they were created with. 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. Unlike Anthropic Managed Agents, nonempty skills attachments and custom tools return 400; use the native skill tool for available runtime skills.
2353
+ * 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; existing sessions keep the version they were created with. 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. Unlike Anthropic Managed Agents, nonempty skills attachments return 400; use the native skill tool for available runtime skills.
2130
2354
  */
2131
2355
  export const agentsUpdate = (options) => (options.client ?? client).post({
2132
2356
  security: [{
@@ -2282,7 +2506,7 @@ export const sessionsArchive = (options) => (options.client ?? client).post({
2282
2506
  /**
2283
2507
  * List session events
2284
2508
  *
2285
- * Read the event history of a session as a page of events, oldest first by default (order=desc for newest first). Use it after sending a message to collect the reply, to find tool calls that wait for approval (session.status_idle with stop_reason requires_action lists their event_ids), or to audit a run; to follow a running session live use sessions.events.stream instead. Filter by types and by a created_at range on processed_at; pages hold at most 100 events (default 20) and next_page continues. A failed run emits session.error before session.status_terminated. Native history also includes user.steer, user.withdraw, system.notification, session.forked, session.goal_changed and session.goal_verification; these are not accepted by the /anthropic/v1 event-type filter.
2509
+ * Read the event history of a session as a page of events, oldest first by default (order=desc for newest first). Use it after sending a message to collect the reply, to find tool calls that wait for approval or client custom tool results (session.status_idle with stop_reason requires_action lists their event_ids), or to audit a run; to follow a running session live use sessions.events.stream instead. Filter by types and by a created_at range on processed_at; pages hold at most 100 events (default 20) and next_page continues. A failed run emits session.error before session.status_terminated. Native history also includes user.steer, user.withdraw, system.notification, session.forked, session.goal_changed and session.goal_verification; these are not accepted by the /anthropic/v1 event-type filter.
2286
2510
  */
2287
2511
  export const sessionsEventsList = (options) => (options.client ?? client).get({
2288
2512
  security: [{
@@ -2300,7 +2524,7 @@ export const sessionsEventsList = (options) => (options.client ?? client).get({
2300
2524
  /**
2301
2525
  * Send session events
2302
2526
  *
2303
- * Send events to a session: user.message (exactly one nonempty text block), user.interrupt, user.tool_confirmation to allow or deny a pending tool call, user.steer to inject a queued user.message into a turn that is still running, and user.withdraw to retract a queued message. The response only acknowledges the inputs; read replies with sessions.events.list or sessions.events.stream. A message sent while the session waits for tool approval is queued (processed_at null) and runs in order after the approval is resolved. Archived sessions reject new messages. To approve, read a pending agent.tool_use or agent.mcp_tool_use event and send {type: "user.tool_confirmation", tool_use_id: <that event id>, result: "allow"} (or deny); include session_thread_id for a child approval. Native confirmations also accept updated_permissions, answers and annotations, which /anthropic/v1 rejects.
2527
+ * Attach optional praxis_context={items:[{name,value}]} to user.message for untrusted page context on this turn only (maximum 32 items, 4096 UTF-8 JSON bytes). /anthropic/v1 rejects this field. Send events to a session: user.message (exactly one nonempty text block), user.interrupt, user.tool_confirmation to allow or deny a pending tool call, user.custom_tool_result to return a custom tool result, user.steer to inject a queued user.message into a turn that is still running, and user.withdraw to retract a queued message. The response only acknowledges the inputs; read replies with sessions.events.list or sessions.events.stream. A message sent while the session waits for tool approval is queued (processed_at null) and runs in order after the approval is resolved. Archived sessions reject new messages. To approve, read a pending agent.tool_use or agent.mcp_tool_use event and send {type: "user.tool_confirmation", tool_use_id: <that event id>, result: "allow"} (or deny); include session_thread_id for a child approval. Native confirmations also accept updated_permissions, answers and annotations, which /anthropic/v1 rejects. Both faces accept user.custom_tool_result with custom_tool_use_id from agent.custom_tool_use.id or the requires_action stop_reason.event_ids. Unlike Anthropic, result content accepts only text blocks (omit it for an empty array). Omitted or null is_error means false. The server routes child calls by id; session_thread_id is rejected in this input. Unknown call ids return 400; duplicate results or calls no longer waiting return 409.
2304
2528
  */
2305
2529
  export const sessionsEventsSend = (options) => (options.client ?? client).post({
2306
2530
  security: [{