@deepraxis/sdk 0.1.0-dev.449ac38 → 0.1.0-dev.48c1ce8

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.
@@ -1,5 +1,5 @@
1
1
  import type { Praxis } from '../core/client.js';
2
- import type { ApplicationAssetsConfig, ApplicationBinding } from '../generated/types.gen.js';
2
+ import type { ApplicationAssetsConfig, ApplicationBinding, ApplicationVersion } from '../generated/types.gen.js';
3
3
  export type AssetsConfig = ApplicationAssetsConfig;
4
4
  export interface PublishInput {
5
5
  /** 应用名;存在同名应用时复用。 */
@@ -20,16 +20,32 @@ export interface PublishInput {
20
20
  bindings?: ApplicationBinding[];
21
21
  /** 静态资源路由配置,原样传递。 */
22
22
  assets_config?: AssetsConfig;
23
+ /** Register an upload session to plan changes; do not upload content or publish. Requires an existing application. */
24
+ dryRun?: boolean;
25
+ /** Preserve current paths omitted from files. Defaults to false (whole-site replacement). */
26
+ keepExisting?: boolean;
23
27
  /** 是否等待部署完成,默认 true。 */
24
28
  wait?: boolean;
25
29
  /** 部署等待上限(毫秒),默认 120000。超时不会撤销部署。 */
26
30
  timeout_ms?: number;
27
31
  }
28
32
  export interface PublishResult {
33
+ /** True when a static-only publication matches the active version. */
34
+ unchanged?: boolean;
35
+ /** Current version when unchanged or planning an existing deployment. */
36
+ version?: ApplicationVersion;
37
+ /** dryRun compares against the active version; counts are distinct content hashes. */
38
+ plan?: {
39
+ added: string[];
40
+ changed: string[];
41
+ removed: string[];
42
+ upload_hashes: number;
43
+ existing_hashes: number;
44
+ };
29
45
  url: string;
30
46
  worker_id: string;
31
- version_id: string;
32
- deployment_id: string;
47
+ version_id: string | null;
48
+ deployment_id: string | null;
33
49
  status: string;
34
50
  created: boolean;
35
51
  /** 本次上传的不同内容 hash 数量。 */
@@ -37,5 +53,9 @@ export interface PublishResult {
37
53
  /** 服务端已存在的不同内容 hash 数量。 */
38
54
  reused: number;
39
55
  }
40
- /** Publish through the public SDK resources, including content-addressed incremental uploads. */
56
+ /** Publish with whole-site replacement by default; keepExisting preserves omitted paths.
57
+ * dryRun registers an idempotent upload session (stores its manifest), but uploads no content and does not publish.
58
+ * The platform does not support gradual rollout. Roll back using workers.deployments.create with
59
+ * strategy: 'percentage', versions: [{ version_id: previousVersionId, percentage: 100 }], while artifacts are retained.
60
+ */
41
61
  export declare function publish(client: Pick<Praxis, 'application'>, input: PublishInput): Promise<PublishResult>;
@@ -8,8 +8,16 @@ function base64(bytes) {
8
8
  }
9
9
  return btoa(chunks.join(''));
10
10
  }
11
- /** Publish through the public SDK resources, including content-addressed incremental uploads. */
11
+ /** Publish with whole-site replacement by default; keepExisting preserves omitted paths.
12
+ * dryRun registers an idempotent upload session (stores its manifest), but uploads no content and does not publish.
13
+ * The platform does not support gradual rollout. Roll back using workers.deployments.create with
14
+ * strategy: 'percentage', versions: [{ version_id: previousVersionId, percentage: 100 }], while artifacts are retained.
15
+ */
12
16
  export async function publish(client, input) {
17
+ const rolloutFields = ['gradual', 'gradualRollout', 'gradual_rollout', 'canary', 'rollout', 'percentage', 'percent', 'traffic', 'traffic_percentage', 'strategy', 'versions'];
18
+ if (Object.keys(input).some(key => rolloutFields.includes(key) || /percentage|percent|canary|gradual|rollout|灰度/i.test(key))) {
19
+ throw new PraxisError({ code: 'INVALID_PARAMS', message: '平台不支持灰度 (gradual rollout is not supported). Roll back with praxis.application.workers.deployments.create({ path: { worker_id }, body: { strategy: "percentage", versions: [{ version_id: previousVersionId, percentage: 100 }] } }); the previous version artifacts must still be retained.' });
20
+ }
13
21
  const timeout = input.timeout_ms ?? 120_000;
14
22
  if (!Number.isFinite(timeout) || timeout < 0)
15
23
  throw new RangeError('timeout_ms must be non-negative and finite');
@@ -21,7 +29,7 @@ export async function publish(client, input) {
21
29
  const files = Object.entries(input.files);
22
30
  if (files.length > 100_000)
23
31
  throw new PraxisError({ code: 'LIMIT_EXCEEDED', message: 'At most 100000 asset paths can be published' });
24
- const manifest = {};
32
+ let manifest = {};
25
33
  const contents = new Map();
26
34
  for (const [path, content] of files) {
27
35
  const normalized = path.startsWith('/') ? path : `/${path}`;
@@ -44,9 +52,51 @@ export async function publish(client, input) {
44
52
  }
45
53
  }
46
54
  const created = !worker;
55
+ if (!worker && input.dryRun)
56
+ throw new PraxisError({ code: 'NOT_FOUND', message: '请先创建应用 (create the application before dryRun)' });
47
57
  worker ??= await workers.create({ body: { name: input.name, subdomain: { enabled: true } } });
48
58
  const path = { worker_id: worker.id };
59
+ let currentVersion;
60
+ let currentDeployment;
61
+ let previous = {};
62
+ if (worker.praxis?.current_deployment_id) {
63
+ currentDeployment = await workers.deployments.retrieve({ path: { ...path, deployment_id: worker.praxis.current_deployment_id } });
64
+ const active = currentDeployment.versions[0];
65
+ if (!active)
66
+ throw new PraxisError({ code: 'INVALID_RESPONSE', message: 'Current deployment has no version' });
67
+ currentVersion = await workers.versions.retrieve({ path: { ...path, version_id: active.version_id } });
68
+ previous = (await workers.versions.assets.retrieveManifest({ path: { ...path, version_id: active.version_id } })).manifest;
69
+ }
70
+ // Keep the stored path order: the service hashes JSON.stringify(manifest), including property order.
71
+ // Reordered input with identical paths must still hash to the active version's manifest_hash.
72
+ manifest = {
73
+ ...Object.fromEntries(Object.entries(previous).filter(([key]) => input.keepExisting || Object.hasOwn(manifest, key))),
74
+ ...manifest,
75
+ };
76
+ if (Object.keys(manifest).length > 100_000)
77
+ throw new PraxisError({ code: 'LIMIT_EXCEEDED', message: 'At most 100000 asset paths can be published' });
78
+ const added = Object.keys(manifest).filter(key => !Object.hasOwn(previous, key));
79
+ const changed = Object.keys(manifest).filter(key => previous[key] && (previous[key].hash !== manifest[key].hash || previous[key].size !== manifest[key].size));
80
+ const removed = Object.keys(previous).filter(key => !Object.hasOwn(manifest, key));
81
+ const digest = new Uint8Array(await crypto.subtle.digest('SHA-256', new TextEncoder().encode(JSON.stringify(manifest))));
82
+ const manifestHash = Array.from(digest, byte => byte.toString(16).padStart(2, '0')).join('');
83
+ const staticOnly = !['main', 'bindings', 'compatibility_date', 'compatibility_flags', 'assets_config'].some(key => Object.hasOwn(input, key));
84
+ const unchanged = staticOnly && !!currentVersion && manifestHash === currentVersion.praxis.assets_manifest?.manifest_hash;
85
+ const hashes = new Set(Object.values(manifest).map(entry => entry.hash));
86
+ const currentResult = { url: worker.subdomain.url, worker_id: worker.id, version_id: currentVersion?.id ?? null,
87
+ deployment_id: currentDeployment?.id ?? null, status: currentDeployment?.praxis.status ?? 'draft', created,
88
+ ...(currentVersion ? { version: currentVersion } : {}), unchanged, uploaded: 0, reused: hashes.size };
89
+ if (unchanged && !input.dryRun)
90
+ return currentResult;
91
+ // dryRun intentionally registers the content-addressed session manifest, but never uploads or publishes.
49
92
  const session = await workers.assetsUploadSession.create({ path, body: { manifest } });
93
+ if (input.dryRun) {
94
+ const missing = new Set(session.buckets.flat());
95
+ if ([...missing].some(hash => !hashes.has(hash)))
96
+ throw new PraxisError({ code: 'INVALID_RESPONSE', message: 'Upload session requested an unknown hash' });
97
+ return { ...currentResult, reused: hashes.size - missing.size,
98
+ plan: { added, changed, removed, upload_hashes: missing.size, existing_hashes: hashes.size - missing.size } };
99
+ }
50
100
  let jwt = session.buckets.length ? null : session.jwt;
51
101
  const uploaded = new Set();
52
102
  for (const bucket of session.buckets) {
@@ -112,5 +162,5 @@ export async function publish(client, input) {
112
162
  }
113
163
  return { url: worker.subdomain.url, worker_id: worker.id, version_id: result.version.id,
114
164
  deployment_id: deployment.id, status: deployment.praxis.status, created,
115
- uploaded: uploaded.size, reused: contents.size - uploaded.size };
165
+ uploaded: uploaded.size, reused: hashes.size - uploaded.size };
116
166
  }
@@ -2,7 +2,7 @@ export declare const operations: readonly [{
2
2
  readonly resource: "agent.agents";
3
3
  readonly method: "list";
4
4
  readonly summary: "List agents";
5
- readonly description: "List the agents of the workspace behind your API key, newest first, in pages of at most 100 (default 20). Use it to find an agent id before creating a session; to read one agent use agents.retrieve, to see its history use agents.versions.list. Archived agents are hidden unless include_archived is true. Filter kind=personal for durable-computer agents or kind=service for per-session environments. Pass next_page from the response as page to read the next page; a null next_page means the end.";
5
+ readonly description: "List the agents of the workspace behind your API key, newest first, in pages of at most 100 (default 20). Use it to find an agent id before creating a session; to read one agent use agents.retrieve, to see its history use agents.versions.list. Archived agents are hidden unless include_archived is true. Filter kind=personal for durable-computer agents or kind=business for per-session environments. Pass next_page from the response as page to read the next page; a null next_page means the end.";
6
6
  readonly http: "GET";
7
7
  readonly path: "/agent/v1/agents";
8
8
  readonly streaming: "no";
@@ -37,7 +37,7 @@ export declare const operations: readonly [{
37
37
  }, {
38
38
  readonly name: "kind";
39
39
  readonly type: "string";
40
- readonly enum: readonly ["personal", "service"];
40
+ readonly enum: readonly ["personal", "business"];
41
41
  readonly required: false;
42
42
  readonly description: "Filter agents by their immutable kind, including agents created before kind was recorded.";
43
43
  }];
@@ -45,7 +45,7 @@ export declare const operations: readonly [{
45
45
  readonly resource: "agent.agents";
46
46
  readonly method: "create";
47
47
  readonly summary: "Create agent";
48
- readonly description: "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\"}]}.";
48
+ readonly description: "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\"}]}.";
49
49
  readonly http: "POST";
50
50
  readonly path: "/agent/v1/agents";
51
51
  readonly streaming: "no";
@@ -105,9 +105,9 @@ export declare const operations: readonly [{
105
105
  }, {
106
106
  readonly name: "kind";
107
107
  readonly type: "string";
108
- readonly enum: readonly ["personal", "service"];
108
+ readonly enum: readonly ["personal", "business"];
109
109
  readonly required: false;
110
- readonly description: "Immutable agent kind. personal requires computer_id; service cannot bind a computer. Omit on create to infer from computer_id. On update, the same kind is ignored; changing kind or crossing its computer binding returns 400 invalid_request_error.";
110
+ readonly description: "Immutable agent kind. personal requires computer_id; business cannot bind a computer. Omit on create to infer from computer_id. On update, the same kind is ignored; changing kind or crossing its computer binding returns 400 invalid_request_error.";
111
111
  }, {
112
112
  readonly name: "computer_id";
113
113
  readonly type: "string";
@@ -140,6 +140,12 @@ export declare const operations: readonly [{
140
140
  readonly type: "object";
141
141
  readonly required: false;
142
142
  readonly description: "Praxis extension: switchable model ids on /agent/v1 only. The default model must be included. When omitted, only the default model is selectable.";
143
+ }, {
144
+ readonly name: "preset";
145
+ readonly type: "string";
146
+ readonly enum: readonly ["minimal", "data-editor", "full"];
147
+ readonly required: false;
148
+ readonly description: "Optional tool preset. minimal enables read, glob, grep and ask_user_question; data-editor also enables write and edit; full uses the default toolset with always_allow. Explicit tools override matching preset entries. codemode requires bash and is absent from data-editor.";
143
149
  }];
144
150
  };
145
151
  }, {
@@ -165,7 +171,7 @@ export declare const operations: readonly [{
165
171
  readonly resource: "agent.agents";
166
172
  readonly method: "update";
167
173
  readonly summary: "Update agent";
168
- readonly description: "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.";
174
+ readonly description: "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.";
169
175
  readonly http: "POST";
170
176
  readonly path: "/agent/v1/agents/{agent_id}";
171
177
  readonly streaming: "no";
@@ -233,9 +239,9 @@ export declare const operations: readonly [{
233
239
  }, {
234
240
  readonly name: "kind";
235
241
  readonly type: "string";
236
- readonly enum: readonly ["personal", "service"];
242
+ readonly enum: readonly ["personal", "business"];
237
243
  readonly required: false;
238
- readonly description: "Immutable agent kind. personal requires computer_id; service cannot bind a computer. Omit on create to infer from computer_id. On update, the same kind is ignored; changing kind or crossing its computer binding returns 400 invalid_request_error.";
244
+ readonly description: "Immutable agent kind. personal requires computer_id; business cannot bind a computer. Omit on create to infer from computer_id. On update, the same kind is ignored; changing kind or crossing its computer binding returns 400 invalid_request_error.";
239
245
  }, {
240
246
  readonly name: "computer_id";
241
247
  readonly type: "string";
@@ -268,6 +274,12 @@ export declare const operations: readonly [{
268
274
  readonly type: "object";
269
275
  readonly required: false;
270
276
  readonly description: "Praxis extension: switchable model ids on /agent/v1 only. The default model must be included. When omitted, only the default model is selectable.";
277
+ }, {
278
+ readonly name: "preset";
279
+ readonly type: "string";
280
+ readonly enum: readonly ["minimal", "data-editor", "full"];
281
+ readonly required: false;
282
+ readonly description: "Optional tool preset. minimal enables read, glob, grep and ask_user_question; data-editor also enables write and edit; full uses the default toolset with always_allow. Explicit tools override matching preset entries. codemode requires bash and is absent from data-editor.";
271
283
  }];
272
284
  };
273
285
  }, {
@@ -284,6 +296,156 @@ export declare const operations: readonly [{
284
296
  readonly sdkName: "agent_id";
285
297
  }];
286
298
  readonly query: readonly [];
299
+ }, {
300
+ readonly resource: "agent.agents.endUsers";
301
+ readonly method: "list";
302
+ readonly summary: "List End Users";
303
+ readonly description: "List users who have sessions or token issuance history on a business agent.\n\nOrdered 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.";
304
+ readonly http: "GET";
305
+ readonly path: "/agent/v1/agents/{agent_id}/end_users";
306
+ readonly streaming: "no";
307
+ readonly pagination: false;
308
+ readonly pathParams: readonly [{
309
+ readonly name: "agent_id";
310
+ readonly sdkName: "agent_id";
311
+ }];
312
+ readonly query: readonly [{
313
+ readonly name: "limit";
314
+ readonly type: "integer";
315
+ readonly required: false;
316
+ readonly description: "Maximum users per page; defaults to 20.";
317
+ }, {
318
+ readonly name: "page";
319
+ readonly type: "string";
320
+ readonly required: false;
321
+ readonly description: "next_page from the previous response with the same agent, q and limit.";
322
+ }, {
323
+ readonly name: "q";
324
+ readonly type: "string";
325
+ readonly required: false;
326
+ readonly description: "Case-sensitive literal prefix of external_user_id; omit or use an empty string for all users.";
327
+ }];
328
+ }, {
329
+ readonly resource: "agent.agents.endUsers";
330
+ readonly method: "delete";
331
+ readonly summary: "Delete end-user data";
332
+ readonly description: "Delete a host application's end-user data from one business agent after explicit confirmation.\n\nDevelop 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.";
333
+ readonly http: "DELETE";
334
+ readonly path: "/agent/v1/agents/{agent_id}/end_users/{external_user_id}";
335
+ readonly streaming: "no";
336
+ readonly pagination: false;
337
+ readonly pathParams: readonly [{
338
+ readonly name: "agent_id";
339
+ readonly sdkName: "agent_id";
340
+ }, {
341
+ readonly name: "external_user_id";
342
+ readonly sdkName: "external_user_id";
343
+ }];
344
+ readonly query: readonly [{
345
+ readonly name: "confirm";
346
+ readonly type: "string";
347
+ readonly required: true;
348
+ readonly description: "Must exactly equal the external_user_id path parameter to confirm destructive deletion.";
349
+ }];
350
+ }, {
351
+ readonly resource: "agent.agents.endUsers";
352
+ readonly method: "retrieve";
353
+ readonly summary: "Get End User";
354
+ readonly description: "Inspect one end user and their twenty most recently updated sessions.\n\nUse 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.";
355
+ readonly http: "GET";
356
+ readonly path: "/agent/v1/agents/{agent_id}/end_users/{external_user_id}";
357
+ readonly streaming: "no";
358
+ readonly pagination: false;
359
+ readonly pathParams: readonly [{
360
+ readonly name: "agent_id";
361
+ readonly sdkName: "agent_id";
362
+ }, {
363
+ readonly name: "external_user_id";
364
+ readonly sdkName: "external_user_id";
365
+ }];
366
+ readonly query: readonly [];
367
+ }, {
368
+ readonly resource: "agent.agents.endUsers.block";
369
+ readonly method: "create";
370
+ readonly summary: "Block End User";
371
+ readonly description: "Block token issuance and session creation, then revoke existing tokens for an end user.\n\nMay 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.";
372
+ readonly http: "POST";
373
+ readonly path: "/agent/v1/agents/{agent_id}/end_users/{external_user_id}/block";
374
+ readonly streaming: "no";
375
+ readonly pagination: false;
376
+ readonly pathParams: readonly [{
377
+ readonly name: "agent_id";
378
+ readonly sdkName: "agent_id";
379
+ }, {
380
+ readonly name: "external_user_id";
381
+ readonly sdkName: "external_user_id";
382
+ }];
383
+ readonly query: readonly [];
384
+ }, {
385
+ readonly resource: "agent.agents.endUsers";
386
+ readonly method: "retrieveDeletion";
387
+ readonly summary: "Get end-user deletion";
388
+ readonly description: "Poll the latest deletion task for an end user, including after the user data has been removed.\n\nUse 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.";
389
+ readonly http: "GET";
390
+ readonly path: "/agent/v1/agents/{agent_id}/end_users/{external_user_id}/deletion";
391
+ readonly streaming: "no";
392
+ readonly pagination: false;
393
+ readonly pathParams: readonly [{
394
+ readonly name: "agent_id";
395
+ readonly sdkName: "agent_id";
396
+ }, {
397
+ readonly name: "external_user_id";
398
+ readonly sdkName: "external_user_id";
399
+ }];
400
+ readonly query: readonly [];
401
+ }, {
402
+ readonly resource: "agent.agents.endUsers.revokeTokens";
403
+ readonly method: "create";
404
+ readonly summary: "Revoke End User Tokens";
405
+ readonly description: "Revoke all issued tokens for an end user and terminate their open embed streams.\n\nRevokes 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.";
406
+ readonly http: "POST";
407
+ readonly path: "/agent/v1/agents/{agent_id}/end_users/{external_user_id}/revoke_tokens";
408
+ readonly streaming: "no";
409
+ readonly pagination: false;
410
+ readonly pathParams: readonly [{
411
+ readonly name: "agent_id";
412
+ readonly sdkName: "agent_id";
413
+ }, {
414
+ readonly name: "external_user_id";
415
+ readonly sdkName: "external_user_id";
416
+ }];
417
+ readonly query: readonly [];
418
+ }, {
419
+ readonly resource: "agent.agents.endUsers.unblock";
420
+ readonly method: "create";
421
+ readonly summary: "Unblock End User";
422
+ readonly description: "Allow an end user to receive new tokens and create new sessions again.\n\nRemoves 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.";
423
+ readonly http: "POST";
424
+ readonly path: "/agent/v1/agents/{agent_id}/end_users/{external_user_id}/unblock";
425
+ readonly streaming: "no";
426
+ readonly pagination: false;
427
+ readonly pathParams: readonly [{
428
+ readonly name: "agent_id";
429
+ readonly sdkName: "agent_id";
430
+ }, {
431
+ readonly name: "external_user_id";
432
+ readonly sdkName: "external_user_id";
433
+ }];
434
+ readonly query: readonly [];
435
+ }, {
436
+ readonly resource: "agent.agents.unarchive";
437
+ readonly method: "create";
438
+ readonly summary: "Unarchive Agent";
439
+ readonly description: "Restore an archived agent without creating a configuration version. Already active agents are unchanged. Missing or inaccessible agents return 404. Use the returned agent id to create new sessions.";
440
+ readonly http: "POST";
441
+ readonly path: "/agent/v1/agents/{agent_id}/unarchive";
442
+ readonly streaming: "no";
443
+ readonly pagination: false;
444
+ readonly pathParams: readonly [{
445
+ readonly name: "agent_id";
446
+ readonly sdkName: "agent_id";
447
+ }];
448
+ readonly query: readonly [];
287
449
  }, {
288
450
  readonly resource: "agent.agents.versions";
289
451
  readonly method: "list";
@@ -446,7 +608,7 @@ export declare const operations: readonly [{
446
608
  readonly resource: "agent.computers";
447
609
  readonly method: "connect";
448
610
  readonly summary: "Connect computer";
449
- readonly description: "Resume the computer and issue a sandbox connection.\n\nOwn-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.";
611
+ readonly description: "Resume the computer and issue a sandbox connection.\n\nOwn-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.\n\nConnect to a computer with a caller-held lease. Omit the body or send {} to request light: the lightweight shell, or the heavy instance while it is running. Send {\"need\":\"heavy\"} to request full Linux for interactive programs; files are synchronized before the heavy connection is returned with tier heavy. Heavy running time counts toward the daily budget in seconds. Renew the lease while using the connection and release it with DELETE when finished. If the daily budget is exhausted, 429 COMPUTER_BUDGET_EXHAUSTED allows you to continue with need light.";
450
612
  readonly http: "POST";
451
613
  readonly path: "/agent/v1/computers/{computer_id}/connect";
452
614
  readonly streaming: "no";
@@ -456,6 +618,16 @@ export declare const operations: readonly [{
456
618
  readonly sdkName: "computer_id";
457
619
  }];
458
620
  readonly query: readonly [];
621
+ readonly body: {
622
+ readonly required: false;
623
+ readonly fields: readonly [{
624
+ readonly name: "need";
625
+ readonly type: "string";
626
+ readonly enum: readonly ["light", "heavy"];
627
+ readonly required: false;
628
+ readonly description: "Defaults to light. light uses the lightweight shell, or the heavy instance while it is running. heavy requests a full Linux computer for interactive programs; heavy running time counts toward the daily budget in seconds.";
629
+ }];
630
+ };
459
631
  }, {
460
632
  readonly resource: "agent.computers.files";
461
633
  readonly method: "list";
@@ -494,6 +666,40 @@ export declare const operations: readonly [{
494
666
  readonly required: true;
495
667
  readonly description: "Absolute path of the file whose content to download, as returned in the path field of computers.files.list.";
496
668
  }];
669
+ }, {
670
+ readonly resource: "agent.computers.leases";
671
+ readonly method: "delete";
672
+ readonly summary: "Release computer lease";
673
+ readonly description: "Give the lease back when a connection closes so the full machine can be reclaimed without waiting for it to expire.\n\nOwn-face extension. Idempotent: an unknown or already released lease succeeds as well. Foreign or absent computers return 404.";
674
+ readonly http: "DELETE";
675
+ readonly path: "/agent/v1/computers/{computer_id}/leases/{lease_id}";
676
+ readonly streaming: "no";
677
+ readonly pagination: false;
678
+ readonly pathParams: readonly [{
679
+ readonly name: "computer_id";
680
+ readonly sdkName: "computer_id";
681
+ }, {
682
+ readonly name: "lease_id";
683
+ readonly sdkName: "lease_id";
684
+ }];
685
+ readonly query: readonly [];
686
+ }, {
687
+ readonly resource: "agent.computers.leases.renew";
688
+ readonly method: "create";
689
+ readonly summary: "Renew computer lease";
690
+ readonly description: "Extend the lease a connection holds so the full machine stays in service while the connection is open.\n\nOwn-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.";
691
+ readonly http: "POST";
692
+ readonly path: "/agent/v1/computers/{computer_id}/leases/{lease_id}/renew";
693
+ readonly streaming: "no";
694
+ readonly pagination: false;
695
+ readonly pathParams: readonly [{
696
+ readonly name: "computer_id";
697
+ readonly sdkName: "computer_id";
698
+ }, {
699
+ readonly name: "lease_id";
700
+ readonly sdkName: "lease_id";
701
+ }];
702
+ readonly query: readonly [];
497
703
  }, {
498
704
  readonly resource: "agent.deploymentRuns";
499
705
  readonly method: "list";
@@ -833,6 +1039,37 @@ export declare const operations: readonly [{
833
1039
  readonly sdkName: "deployment_id";
834
1040
  }];
835
1041
  readonly query: readonly [];
1042
+ }, {
1043
+ readonly resource: "agent.embed";
1044
+ readonly method: "retrieveAppearance";
1045
+ readonly summary: "Read chat appearance";
1046
+ readonly description: "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.";
1047
+ readonly http: "GET";
1048
+ readonly path: "/agent/v1/embed/appearance";
1049
+ readonly streaming: "no";
1050
+ readonly pagination: false;
1051
+ readonly pathParams: readonly [];
1052
+ readonly query: readonly [];
1053
+ }, {
1054
+ readonly resource: "agent.embed.exchange";
1055
+ readonly method: "create";
1056
+ readonly summary: "Exchange Hosted Code";
1057
+ readonly description: "Redeem a single-use hosted link credential for an end-user token.\n\nRead 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>\"}.";
1058
+ readonly http: "POST";
1059
+ readonly path: "/agent/v1/embed/exchange";
1060
+ readonly streaming: "no";
1061
+ readonly pagination: false;
1062
+ readonly pathParams: readonly [];
1063
+ readonly query: readonly [];
1064
+ readonly body: {
1065
+ readonly required: true;
1066
+ readonly fields: readonly [{
1067
+ readonly name: "code";
1068
+ readonly type: "string";
1069
+ readonly required: true;
1070
+ readonly description: "Single-use credential from the c fragment parameter of hosted_url returned by embed token creation. Valid for 60 seconds.";
1071
+ }];
1072
+ };
836
1073
  }, {
837
1074
  readonly resource: "agent.embedTokens";
838
1075
  readonly method: "list";
@@ -847,7 +1084,7 @@ export declare const operations: readonly [{
847
1084
  readonly name: "agent_id";
848
1085
  readonly type: "string";
849
1086
  readonly required: false;
850
- readonly description: "Filter by service agent identifier (agent_ or agt_ prefix).";
1087
+ readonly description: "Filter by business agent identifier (agent_ or agt_ prefix).";
851
1088
  }, {
852
1089
  readonly name: "external_user_id";
853
1090
  readonly type: "string";
@@ -868,7 +1105,7 @@ export declare const operations: readonly [{
868
1105
  readonly resource: "agent.embedTokens";
869
1106
  readonly method: "create";
870
1107
  readonly summary: "Create Embed Token";
871
- readonly description: "Issue a short-lived credential on your backend for an end user of a service agent.\n\nRequires 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.";
1108
+ readonly description: "Issue a short-lived credential on your backend for an end user of a business agent.\n\nRequires an active business 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.";
872
1109
  readonly http: "POST";
873
1110
  readonly path: "/agent/v1/embed_tokens";
874
1111
  readonly streaming: "no";
@@ -878,10 +1115,15 @@ export declare const operations: readonly [{
878
1115
  readonly body: {
879
1116
  readonly required: true;
880
1117
  readonly fields: readonly [{
1118
+ readonly name: "hosted";
1119
+ readonly type: "boolean";
1120
+ readonly required: false;
1121
+ readonly description: "Set true to also return a hosted chat URL with a single-use credential valid for 60 seconds. Defaults to false; the agent must have an identity_number.";
1122
+ }, {
881
1123
  readonly name: "agent";
882
1124
  readonly type: "string";
883
1125
  readonly required: true;
884
- readonly description: "Service agent ID or identity_number from agent retrieval; it must belong to your organization and be active.";
1126
+ readonly description: "Business agent ID or identity_number from agent retrieval; it must belong to your organization and be active.";
885
1127
  }, {
886
1128
  readonly name: "version";
887
1129
  readonly type: "integer";
@@ -926,6 +1168,31 @@ export declare const operations: readonly [{
926
1168
  readonly description: "Host metadata preserved verbatim; at most 16 keys of 1–64 characters and string values of at most 512 characters. Defaults to an empty object.";
927
1169
  }];
928
1170
  };
1171
+ }, {
1172
+ readonly resource: "agent.embedTokens.anonymous";
1173
+ readonly method: "create";
1174
+ readonly summary: "Issue anonymous visitor token";
1175
+ readonly description: "Obtain a short-lived embedding token for a visitor without an account using the agent owner's publishable key.\n\nNo 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\"}.";
1176
+ readonly http: "POST";
1177
+ readonly path: "/agent/v1/embed_tokens/anonymous";
1178
+ readonly streaming: "no";
1179
+ readonly pagination: false;
1180
+ readonly pathParams: readonly [];
1181
+ readonly query: readonly [];
1182
+ readonly body: {
1183
+ readonly required: true;
1184
+ readonly fields: readonly [{
1185
+ readonly name: "publishable_key";
1186
+ readonly type: "string";
1187
+ readonly required: true;
1188
+ readonly description: "Public key created by the business agent owner; safe to include in browser code.";
1189
+ }, {
1190
+ readonly name: "visitor_secret";
1191
+ readonly type: "string";
1192
+ readonly required: false;
1193
+ readonly description: "Secret returned by a previous anonymous issuance for this key. Omit for a new visitor; an unknown secret creates a new visitor.";
1194
+ }];
1195
+ };
929
1196
  }, {
930
1197
  readonly resource: "agent.embedTokens.revoke";
931
1198
  readonly method: "create";
@@ -1254,6 +1521,20 @@ export declare const operations: readonly [{
1254
1521
  readonly description: "Praxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error.";
1255
1522
  }];
1256
1523
  };
1524
+ }, {
1525
+ readonly resource: "agent.sessions";
1526
+ readonly method: "delete";
1527
+ readonly summary: "Delete session";
1528
+ readonly description: "Delete an idle or terminated session and its event history after saving a deletion snapshot. Supply the session id from creation or listing. Running sessions return 409 INVALID_STATE: interrupt first or wait until idle or terminated. Afterwards retrieval and event listing return 404 and lists omit the session. Example: DELETE /agent/v1/sessions/sesn_example.";
1529
+ readonly http: "DELETE";
1530
+ readonly path: "/agent/v1/sessions/{session_id}";
1531
+ readonly streaming: "no";
1532
+ readonly pagination: false;
1533
+ readonly pathParams: readonly [{
1534
+ readonly name: "session_id";
1535
+ readonly sdkName: "session_id";
1536
+ }];
1537
+ readonly query: readonly [];
1257
1538
  }, {
1258
1539
  readonly resource: "agent.sessions";
1259
1540
  readonly method: "retrieve";
@@ -1466,7 +1747,7 @@ export declare const operations: readonly [{
1466
1747
  readonly resource: "agent.sessions.events";
1467
1748
  readonly method: "list";
1468
1749
  readonly summary: "List session events";
1469
- readonly description: "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.";
1750
+ readonly description: "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.";
1470
1751
  readonly http: "GET";
1471
1752
  readonly path: "/agent/v1/sessions/{session_id}/events";
1472
1753
  readonly streaming: "no";
@@ -1522,7 +1803,7 @@ export declare const operations: readonly [{
1522
1803
  readonly resource: "agent.sessions.events";
1523
1804
  readonly method: "send";
1524
1805
  readonly summary: "Send session events";
1525
- readonly description: "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.";
1806
+ readonly description: "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.";
1526
1807
  readonly http: "POST";
1527
1808
  readonly path: "/agent/v1/sessions/{session_id}/events";
1528
1809
  readonly streaming: "no";
@@ -2463,6 +2744,23 @@ export declare const operations: readonly [{
2463
2744
  readonly sdkName: "version_id";
2464
2745
  }];
2465
2746
  readonly query: readonly [];
2747
+ }, {
2748
+ readonly resource: "application.workers.versions.assets";
2749
+ readonly method: "retrieveManifest";
2750
+ readonly summary: "Get version asset manifest";
2751
+ readonly description: "Read the retained asset paths, content hashes and byte sizes of a version for publication planning. This read creates no session or version. A version without assets returns an empty manifest; unavailable artifacts and foreign resources return 404.";
2752
+ readonly http: "GET";
2753
+ readonly path: "/application/v1/workers/{worker_id}/versions/{version_id}/assets/manifest";
2754
+ readonly streaming: "no";
2755
+ readonly pagination: false;
2756
+ readonly pathParams: readonly [{
2757
+ readonly name: "worker_id";
2758
+ readonly sdkName: "worker_id";
2759
+ }, {
2760
+ readonly name: "version_id";
2761
+ readonly sdkName: "version_id";
2762
+ }];
2763
+ readonly query: readonly [];
2466
2764
  }, {
2467
2765
  readonly resource: "automation.actions";
2468
2766
  readonly method: "list";