@beeos-ai/bma-sdk 1.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +72 -131
  2. package/dist/beta.d.ts +79 -0
  3. package/dist/beta.js +107 -0
  4. package/dist/beta.js.map +1 -0
  5. package/dist/client.d.ts +32 -0
  6. package/dist/client.js +50 -0
  7. package/dist/client.js.map +1 -0
  8. package/dist/errors.d.ts +6 -75
  9. package/dist/errors.js +11 -105
  10. package/dist/errors.js.map +1 -1
  11. package/dist/extensions.d.ts +80 -0
  12. package/dist/extensions.js +24 -0
  13. package/dist/extensions.js.map +1 -0
  14. package/dist/generated/extensions-resources.d.ts +271 -0
  15. package/dist/generated/extensions-resources.js +255 -0
  16. package/dist/generated/extensions-resources.js.map +1 -0
  17. package/dist/generated/extensions.d.ts +3727 -0
  18. package/dist/generated/{rest.js → extensions.js} +1 -1
  19. package/dist/generated/extensions.js.map +1 -0
  20. package/dist/idempotency.d.ts +4 -0
  21. package/dist/idempotency.js +7 -0
  22. package/dist/idempotency.js.map +1 -0
  23. package/dist/index.d.ts +9 -55
  24. package/dist/index.js +9 -57
  25. package/dist/index.js.map +1 -1
  26. package/dist/internal.d.ts +9 -0
  27. package/dist/internal.js +32 -0
  28. package/dist/internal.js.map +1 -0
  29. package/dist/resume.d.ts +24 -0
  30. package/dist/resume.js +127 -0
  31. package/dist/resume.js.map +1 -0
  32. package/dist/version.d.ts +1 -1
  33. package/dist/version.js +3 -3
  34. package/dist/version.js.map +1 -1
  35. package/package.json +6 -12
  36. package/dist/core.d.ts +0 -105
  37. package/dist/core.js +0 -406
  38. package/dist/core.js.map +0 -1
  39. package/dist/facade-extensions.d.ts +0 -27
  40. package/dist/facade-extensions.js +0 -47
  41. package/dist/facade-extensions.js.map +0 -1
  42. package/dist/generated/facade-extensions-operations.d.ts +0 -133
  43. package/dist/generated/facade-extensions-operations.js +0 -11
  44. package/dist/generated/facade-extensions-operations.js.map +0 -1
  45. package/dist/generated/facade-extensions-resources.d.ts +0 -34
  46. package/dist/generated/facade-extensions-resources.js +0 -47
  47. package/dist/generated/facade-extensions-resources.js.map +0 -1
  48. package/dist/generated/facade-extensions-types.d.ts +0 -14
  49. package/dist/generated/facade-extensions-types.js +0 -2
  50. package/dist/generated/facade-extensions-types.js.map +0 -1
  51. package/dist/generated/facade-extensions.d.ts +0 -507
  52. package/dist/generated/facade-extensions.js +0 -6
  53. package/dist/generated/facade-extensions.js.map +0 -1
  54. package/dist/generated/rest-operations.d.ts +0 -4079
  55. package/dist/generated/rest-operations.js +0 -234
  56. package/dist/generated/rest-operations.js.map +0 -1
  57. package/dist/generated/rest-resources.d.ts +0 -666
  58. package/dist/generated/rest-resources.js +0 -1124
  59. package/dist/generated/rest-resources.js.map +0 -1
  60. package/dist/generated/rest-types.d.ts +0 -572
  61. package/dist/generated/rest-types.js +0 -2
  62. package/dist/generated/rest-types.js.map +0 -1
  63. package/dist/generated/rest.d.ts +0 -18519
  64. package/dist/generated/rest.js.map +0 -1
  65. package/dist/lib/artifacts.d.ts +0 -14
  66. package/dist/lib/artifacts.js +0 -56
  67. package/dist/lib/artifacts.js.map +0 -1
  68. package/dist/lib/tool-runner.d.ts +0 -99
  69. package/dist/lib/tool-runner.js +0 -140
  70. package/dist/lib/tool-runner.js.map +0 -1
  71. package/dist/pagination.d.ts +0 -31
  72. package/dist/pagination.js +0 -66
  73. package/dist/pagination.js.map +0 -1
  74. package/dist/resource.d.ts +0 -8
  75. package/dist/resource.js +0 -9
  76. package/dist/resource.js.map +0 -1
  77. package/dist/streaming.d.ts +0 -27
  78. package/dist/streaming.js +0 -89
  79. package/dist/streaming.js.map +0 -1
package/dist/errors.js CHANGED
@@ -1,109 +1,15 @@
1
- /** Base class of every error thrown by the SDK. */
2
- export class BmaError extends Error {
3
- constructor(message, options) {
4
- super(message, options);
5
- this.name = new.target.name;
6
- }
7
- }
8
- /** An error response from the API, or a request that never got one. */
9
- export class BmaApiError extends BmaError {
10
- /** HTTP status; undefined for connection errors and stream error frames. */
11
- status;
12
- headers;
13
- /** Stable error code from the response body. */
14
- code;
15
- /** Parsed response body, if any. */
16
- error;
17
- /** Field-level problems for agent config validation errors. */
18
- issues;
19
- /** Current file digest for file_content_conflict / expected_digest_required. */
20
- currentDigest;
21
- /** Facade extensions only: the Anthropic-style `error.type`. */
22
- type;
23
- constructor(status, body, message, headers, options) {
24
- const wire = (typeof body === "object" && body !== null ? body : {});
25
- // Native API: {error: string, code}. Facade: {type: "error", error: {type, message, code}}.
26
- const nested = typeof wire.error === "object" && wire.error !== null ? wire.error : undefined;
27
- const code = str(nested ? nested.code : wire.code);
28
- const type = nested ? str(nested.type) : undefined;
29
- const detail = str(nested ? nested.message : wire.error) ?? message;
30
- super(status === undefined
31
- ? (message ?? detail ?? "bma: request failed")
32
- : `bma: ${status} ${code ?? type ?? "unknown"}: ${detail ?? `HTTP ${status}`}`, options);
33
- this.status = status;
34
- this.headers = headers;
35
- this.code = code;
36
- this.type = type;
37
- this.error = body;
38
- this.issues = Array.isArray(wire.issues) ? wire.issues : undefined;
39
- this.currentDigest = str(wire.current_digest);
40
- }
41
- /** @internal */
42
- static generate(status, body, headers) {
43
- const cls = STATUS_CLASSES.get(status) ?? (status >= 500 ? InternalServerError : BmaApiError);
44
- return new cls(status, body, undefined, headers);
45
- }
46
- }
47
- function str(value) {
48
- return typeof value === "string" && value !== "" ? value : undefined;
49
- }
50
- export class APIConnectionError extends BmaApiError {
51
- constructor({ message, cause } = {}) {
52
- super(undefined, undefined, message ?? "bma: connection error", undefined, { cause });
53
- }
54
- }
55
- export class APIConnectionTimeoutError extends APIConnectionError {
56
- constructor({ message } = {}) {
57
- super({ message: message ?? "bma: request timed out" });
58
- }
59
- }
60
- export class APIUserAbortError extends BmaApiError {
61
- constructor({ message } = {}) {
62
- super(undefined, undefined, message ?? "bma: request was aborted", undefined);
63
- }
64
- }
1
+ import { APIError } from '@anthropic-ai/sdk';
65
2
  /**
66
- * An `error` frame on an event stream. The stream ends after it; frames with
67
- * code `service_unavailable` are retried by the SDK before this is thrown.
3
+ * BMA's reason for an API error (`error.code` of the Anthropic error envelope,
4
+ * e.g. "idempotency_key_reused"), or undefined when `error` is not an API
5
+ * error or has no code. Branch on it rather than on the message. (The
6
+ * official `errorCode` property is `error.details.error_code`, which BMA does
7
+ * not set.)
68
8
  */
69
- export class EventStreamError extends BmaApiError {
70
- constructor(body) {
71
- const wire = (body ?? {});
72
- super(undefined, body, `bma: event stream error ${String(wire.code ?? "unknown")}: ${String(wire.error ?? "")}`, undefined);
73
- }
74
- }
75
- export class BadRequestError extends BmaApiError {
76
- }
77
- export class AuthenticationError extends BmaApiError {
78
- }
79
- export class PermissionDeniedError extends BmaApiError {
80
- }
81
- export class NotFoundError extends BmaApiError {
82
- }
83
- export class RequestTimeoutError extends BmaApiError {
84
- }
85
- export class ConflictError extends BmaApiError {
86
- }
87
- export class ContentTooLargeError extends BmaApiError {
88
- }
89
- export class UnprocessableEntityError extends BmaApiError {
90
- }
91
- export class RateLimitError extends BmaApiError {
92
- }
93
- export class InternalServerError extends BmaApiError {
94
- }
95
- export class ServiceUnavailableError extends InternalServerError {
9
+ export function errorCode(error) {
10
+ if (!(error instanceof APIError))
11
+ return undefined;
12
+ const code = error.error?.error?.code;
13
+ return typeof code === 'string' ? code : undefined;
96
14
  }
97
- const STATUS_CLASSES = new Map([
98
- [400, BadRequestError],
99
- [401, AuthenticationError],
100
- [403, PermissionDeniedError],
101
- [404, NotFoundError],
102
- [408, RequestTimeoutError],
103
- [409, ConflictError],
104
- [413, ContentTooLargeError],
105
- [422, UnprocessableEntityError],
106
- [429, RateLimitError],
107
- [503, ServiceUnavailableError],
108
- ]);
109
15
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAUA,mDAAmD;AACnD,MAAM,OAAO,QAAS,SAAQ,KAAK;I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,MAAM,OAAO,mBAAoB,SAAQ,WAAmB;CAAG;AAC/D,MAAM,OAAO,uBAAwB,SAAQ,mBAAmB;CAAG;AAEnE,MAAM,cAAc,GAAG,IAAI,GAAG,CAA+E;IAC3G,CAAC,GAAG,EAAE,eAAwB,CAAC;IAC/B,CAAC,GAAG,EAAE,mBAA4B,CAAC;IACnC,CAAC,GAAG,EAAE,qBAA8B,CAAC;IACrC,CAAC,GAAG,EAAE,aAAsB,CAAC;IAC7B,CAAC,GAAG,EAAE,mBAA4B,CAAC;IACnC,CAAC,GAAG,EAAE,aAAsB,CAAC;IAC7B,CAAC,GAAG,EAAE,oBAA6B,CAAC;IACpC,CAAC,GAAG,EAAE,wBAAiC,CAAC;IACxC,CAAC,GAAG,EAAE,cAAuB,CAAC;IAC9B,CAAC,GAAG,EAAE,uBAAuB,CAAC;CAC/B,CAAC,CAAC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,IAAI,CAAC,CAAC,KAAK,YAAY,QAAQ,CAAC;QAAE,OAAO,SAAS,CAAC;IACnD,MAAM,IAAI,GAAI,KAAK,CAAC,KAAoD,EAAE,KAAK,EAAE,IAAI,CAAC;IACtF,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC"}
@@ -0,0 +1,80 @@
1
+ import type { components } from './generated/extensions.js';
2
+ type Schemas = components['schemas'];
3
+ export type AgentModelOverride = Schemas['AgentModelOverride'];
4
+ export type AgentModelOverrideInput = Schemas['AgentModelOverrideInput'];
5
+ export type AgentModelOverridePatch = Schemas['AgentModelOverridePatch'];
6
+ /** bma_harness: a non-default brain for an agent or a session. */
7
+ export interface Harness {
8
+ kind: string;
9
+ agent?: string;
10
+ /** Where the environment runs the brain (sessions only). */
11
+ placement?: string;
12
+ }
13
+ /** bma_desktop of an environment: the default wallpaper is a file of the Files API. */
14
+ export interface EnvironmentDesktop {
15
+ wallpaper: {
16
+ file_id: string;
17
+ } | null;
18
+ }
19
+ /** bma_machine: present on the environment BMA projects from a machine. */
20
+ export interface EnvironmentMachine {
21
+ machine_id: string;
22
+ source_kind: string;
23
+ /** Who runs on a persistent machine: sessions borrowing it run their turns one at a time. */
24
+ lease: {
25
+ session_id: string | null;
26
+ queued_sessions: number;
27
+ };
28
+ }
29
+ /** The BMA fields of a session. */
30
+ export interface SessionExt {
31
+ /** The active model override (no key) or null. */
32
+ modelOverride: AgentModelOverride | null;
33
+ harness: Harness | null;
34
+ }
35
+ /** The BMA fields of an agent. */
36
+ export interface AgentExt {
37
+ harness: Harness | null;
38
+ }
39
+ /** The BMA fields of an environment. */
40
+ export interface EnvironmentExt {
41
+ desktop: EnvironmentDesktop | null;
42
+ machine: EnvironmentMachine | null;
43
+ }
44
+ /** The BMA fields of a session event, from a list or a stream. */
45
+ export interface EventExt {
46
+ /** Orders the events of a session; Last-Event-ID and the history cursor use it (the SSE id stays the opaque event id). */
47
+ sequence: number | null;
48
+ /** The BMA input of a user.message. */
49
+ inputID: string | null;
50
+ /** BMA's reason on a session.error. */
51
+ errorCode: string | null;
52
+ }
53
+ /** The BMA fields of a session returned by client.beta.sessions. */
54
+ export declare function sessionExtensions(session: object): SessionExt;
55
+ /** The BMA fields of an agent returned by client.beta.agents. */
56
+ export declare function agentExtensions(agent: object): AgentExt;
57
+ /** The BMA fields of an environment returned by client.beta.environments. */
58
+ export declare function environmentExtensions(environment: object): EnvironmentExt;
59
+ /** The BMA fields of a session event: an item of client.beta.sessions.events.list or a frame of stream. */
60
+ export declare function eventExtensions(event: object): EventExt;
61
+ /** Request fields BMA adds to sessions.create. */
62
+ export interface SessionCreateExt {
63
+ /** The override lasts for the session. `apiKey` is write-only. */
64
+ bma_model_override?: AgentModelOverrideInput;
65
+ bma_harness?: Harness;
66
+ }
67
+ /** Request fields BMA adds to sessions.update. */
68
+ export interface SessionUpdateExt {
69
+ /** An input replaces the active override, a patch changes fields of it, null revokes it. */
70
+ bma_model_override?: AgentModelOverrideInput | AgentModelOverridePatch | null;
71
+ }
72
+ /** Request fields BMA adds to agents.create and agents.update. */
73
+ export interface AgentExtParams {
74
+ bma_harness?: Harness;
75
+ }
76
+ /** Request fields BMA adds to environments.create and environments.update. */
77
+ export interface EnvironmentExtParams {
78
+ bma_desktop?: EnvironmentDesktop;
79
+ }
80
+ export {};
@@ -0,0 +1,24 @@
1
+ function field(object, name) {
2
+ return object[name] ?? null;
3
+ }
4
+ /** The BMA fields of a session returned by client.beta.sessions. */
5
+ export function sessionExtensions(session) {
6
+ return { modelOverride: field(session, 'bma_model_override'), harness: field(session, 'bma_harness') };
7
+ }
8
+ /** The BMA fields of an agent returned by client.beta.agents. */
9
+ export function agentExtensions(agent) {
10
+ return { harness: field(agent, 'bma_harness') };
11
+ }
12
+ /** The BMA fields of an environment returned by client.beta.environments. */
13
+ export function environmentExtensions(environment) {
14
+ return { desktop: field(environment, 'bma_desktop'), machine: field(environment, 'bma_machine') };
15
+ }
16
+ /** The BMA fields of a session event: an item of client.beta.sessions.events.list or a frame of stream. */
17
+ export function eventExtensions(event) {
18
+ return {
19
+ sequence: field(event, 'bma_sequence'),
20
+ inputID: field(event, 'bma_input_id'),
21
+ errorCode: field(event, 'bma_error_code'),
22
+ };
23
+ }
24
+ //# sourceMappingURL=extensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions.js","sourceRoot":"","sources":["../src/extensions.ts"],"names":[],"mappings":"AAkEA,SAAS,KAAK,CAAI,MAAc,EAAE,IAAY;IAC5C,OAAS,MAAkC,CAAC,IAAI,CAA0B,IAAI,IAAI,CAAC;AACrF,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,EAAE,aAAa,EAAE,KAAK,CAAC,OAAO,EAAE,oBAAoB,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE,CAAC;AACzG,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,qBAAqB,CAAC,WAAmB;IACvD,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC,EAAE,CAAC;AACpG,CAAC;AAED,2GAA2G;AAC3G,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,OAAO;QACL,QAAQ,EAAE,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC;QACtC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC;QACrC,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,gBAAgB,CAAC;KAC1C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,271 @@
1
+ import { APIPromise } from '@anthropic-ai/sdk/core/api-promise';
2
+ import { PageCursor, PagePromise } from '@anthropic-ai/sdk/core/pagination';
3
+ import type { BaseAnthropic } from '@anthropic-ai/sdk/client';
4
+ import { APIResource } from '@anthropic-ai/sdk/core/resource';
5
+ import { type RequestOptions } from '../internal.js';
6
+ import type { components } from './extensions.js';
7
+ type S = components['schemas'];
8
+ export type CheckMachinePoolConnectionRequest = S['CheckMachinePoolConnectionRequest'];
9
+ export type CreateDesktopSessionExtensionRequest = S['CreateDesktopSessionExtensionRequest'];
10
+ export type CreateDesktopTicketRequest = S['CreateDesktopTicketRequest'];
11
+ export type CreateMachineExtensionRequest = S['CreateMachineExtensionRequest'];
12
+ export type CreateMachinePoolGrantExtensionRequest = S['CreateMachinePoolGrantExtensionRequest'];
13
+ export type CreateMachinePoolRequest = S['CreateMachinePoolRequest'];
14
+ export type CreateProjectRequest = S['CreateProjectRequest'];
15
+ export type CreateTerminalSessionExtensionRequest = S['CreateTerminalSessionExtensionRequest'];
16
+ export type CreateTicketRequest = S['CreateTicketRequest'];
17
+ export type DesktopActionRequest = S['DesktopActionRequest'];
18
+ export type DesktopActionResult = S['DesktopActionResult'];
19
+ export type DesktopControlLeaseRequest = S['DesktopControlLeaseRequest'];
20
+ export type DesktopControlStatus = S['DesktopControlStatus'];
21
+ export type DesktopEmptyRequest = S['DesktopEmptyRequest'];
22
+ export type DesktopGenerationRequest = S['DesktopGenerationRequest'];
23
+ export type DesktopScreenshot = S['DesktopScreenshot'];
24
+ export type DesktopSession = S['DesktopSession'];
25
+ export type DesktopSessionClosed = S['DesktopSessionClosed'];
26
+ export type Machine = S['Machine'];
27
+ export type MachineCapabilities = S['MachineCapabilities'];
28
+ export type MachineDeleted = S['MachineDeleted'];
29
+ export type MachinePool = S['MachinePool'];
30
+ export type MachinePoolConnectionCheck = S['MachinePoolConnectionCheck'];
31
+ export type MachinePoolDeleted = S['MachinePoolDeleted'];
32
+ export type MachinePoolGrant = S['MachinePoolGrant'];
33
+ export type MachinePoolGrantDeleted = S['MachinePoolGrantDeleted'];
34
+ export type MachinePoolGrantsPageCursor = PageCursor<MachinePoolGrant>;
35
+ export type MachinePoolsPageCursor = PageCursor<MachinePool>;
36
+ export type MachinePowerStatus = S['MachinePowerStatus'];
37
+ export type MachinesPageCursor = PageCursor<Machine>;
38
+ export type OrganizationProjectsPageCursor = PageCursor<Project>;
39
+ export type Project = S['Project'];
40
+ export type TerminalSession = S['TerminalSession'];
41
+ export type TerminalSessionsPageCursor = PageCursor<TerminalSession>;
42
+ export type Ticket = S['Ticket'];
43
+ export type UpdateMachinePoolRequest = S['UpdateMachinePoolRequest'];
44
+ export type UpdateMachineRequest = S['UpdateMachineRequest'];
45
+ export type UpdateProjectMachinePoolGrantRequest = S['UpdateProjectMachinePoolGrantRequest'];
46
+ export interface OrganizationProjectListParams {
47
+ limit?: number;
48
+ /** Opaque cursor from `next_page`. */
49
+ page?: string;
50
+ }
51
+ export type OrganizationProjectCreateParams = CreateProjectRequest;
52
+ export interface MachineListParams {
53
+ limit?: number;
54
+ /** Opaque cursor from `next_page`. */
55
+ page?: string;
56
+ sort?: string;
57
+ machine_pool_id?: string;
58
+ agent_id?: string;
59
+ }
60
+ export type MachineCreateParams = CreateMachineExtensionRequest;
61
+ export type MachineUpdateParams = UpdateMachineRequest;
62
+ export interface MachineDeleteParams {
63
+ agent_id?: string;
64
+ }
65
+ export interface MachinePoolListParams {
66
+ limit?: number;
67
+ /** Opaque cursor from `next_page`. */
68
+ page?: string;
69
+ sort?: string;
70
+ }
71
+ export type MachinePoolCreateParams = CreateMachinePoolRequest;
72
+ export type MachinePoolCheckConnectionParams = CheckMachinePoolConnectionRequest;
73
+ export type MachinePoolUpdateParams = UpdateMachinePoolRequest;
74
+ export interface MachinePoolGrantListParams {
75
+ limit?: number;
76
+ /** Opaque cursor from `next_page`. */
77
+ page?: string;
78
+ sort?: string;
79
+ }
80
+ export type MachinePoolGrantCreateParams = CreateMachinePoolGrantExtensionRequest;
81
+ export type MachinePoolGrantUpdateParams = UpdateProjectMachinePoolGrantRequest;
82
+ export type DesktopSessionCreateParams = CreateDesktopSessionExtensionRequest;
83
+ export type DesktopSessionAcquireControlParams = DesktopControlLeaseRequest;
84
+ export type DesktopSessionRenewControlParams = DesktopControlLeaseRequest;
85
+ export type DesktopSessionReleaseControlParams = DesktopEmptyRequest;
86
+ export type DesktopSessionHandbackControlParams = DesktopEmptyRequest;
87
+ export type DesktopSessionSendActionsParams = DesktopActionRequest;
88
+ export type DesktopSessionScreenshotParams = DesktopEmptyRequest;
89
+ export type DesktopSessionResumeAgentParams = DesktopGenerationRequest;
90
+ export type DesktopSessionConfirmActionParams = DesktopGenerationRequest;
91
+ export type DesktopSessionTicketCreateParams = CreateDesktopTicketRequest;
92
+ export interface TerminalSessionListParams {
93
+ machine_id?: string;
94
+ }
95
+ export type TerminalSessionCreateParams = CreateTerminalSessionExtensionRequest;
96
+ export type TerminalSessionTicketCreateParams = CreateTicketRequest;
97
+ export declare class OrganizationProjects extends APIResource {
98
+ /**
99
+ * List the projects the key can see.
100
+ */
101
+ list(organizationID: string, params?: OrganizationProjectListParams | null | undefined, options?: RequestOptions): PagePromise<OrganizationProjectsPageCursor, Project>;
102
+ /**
103
+ * Create a project.
104
+ */
105
+ create(organizationID: string, params: OrganizationProjectCreateParams, options?: RequestOptions): APIPromise<Project>;
106
+ }
107
+ export declare class Machines extends APIResource {
108
+ /**
109
+ * List machines. `agent_id` lists that agent's machines (project scope, native listAgentMachines).
110
+ */
111
+ list(params?: MachineListParams | null | undefined, options?: RequestOptions): PagePromise<MachinesPageCursor, Machine>;
112
+ /**
113
+ * Create a machine. `agent_id` + `persistent: true` creates an agent persistent machine (createAgentPersistentMachine); `source: byo` connects a BYO machine (connectBYOMachine) and returns the one-time `token`; otherwise createMachine.
114
+ */
115
+ create(params?: MachineCreateParams, options?: RequestOptions): APIPromise<Machine>;
116
+ /**
117
+ * Retrieve a machine. Adds `capabilities` (getMachineCapabilities), null when the project cannot use the machine.
118
+ */
119
+ retrieve(machineID: string, options?: RequestOptions): APIPromise<Machine>;
120
+ /**
121
+ * Update a machine.
122
+ */
123
+ update(machineID: string, params?: MachineUpdateParams, options?: RequestOptions): APIPromise<Machine>;
124
+ /**
125
+ * Delete a machine. With `agent_id` it deletes that agent's persistent machine (deleteAgentMachine).
126
+ */
127
+ delete(machineID: string, params?: MachineDeleteParams | null | undefined, options?: RequestOptions): APIPromise<MachineDeleted>;
128
+ /**
129
+ * Resume a paused machine.
130
+ */
131
+ resume(machineID: string, options?: RequestOptions): APIPromise<MachinePowerStatus>;
132
+ /**
133
+ * Machine interaction capabilities.
134
+ */
135
+ getCapabilities(machineID: string, options?: RequestOptions): APIPromise<MachineCapabilities>;
136
+ }
137
+ export declare class MachinePools extends APIResource {
138
+ grants: MachinePoolGrants;
139
+ /**
140
+ * List machine pools.
141
+ */
142
+ list(params?: MachinePoolListParams | null | undefined, options?: RequestOptions): PagePromise<MachinePoolsPageCursor, MachinePool>;
143
+ /**
144
+ * Create a machine pool.
145
+ */
146
+ create(params: MachinePoolCreateParams, options?: RequestOptions): APIPromise<MachinePool>;
147
+ /**
148
+ * Check provider connectivity before creating a pool.
149
+ */
150
+ checkConnection(params: MachinePoolCheckConnectionParams, options?: RequestOptions): APIPromise<MachinePoolConnectionCheck>;
151
+ /**
152
+ * Retrieve a machine pool.
153
+ */
154
+ retrieve(poolID: string, options?: RequestOptions): APIPromise<MachinePool>;
155
+ /**
156
+ * Update a machine pool.
157
+ */
158
+ update(poolID: string, params?: MachinePoolUpdateParams, options?: RequestOptions): APIPromise<MachinePool>;
159
+ /**
160
+ * Delete a machine pool.
161
+ */
162
+ delete(poolID: string, options?: RequestOptions): APIPromise<MachinePoolDeleted>;
163
+ }
164
+ export declare class MachinePoolGrants extends APIResource {
165
+ /**
166
+ * List the pool grants of a project. The project is the `project_id` query parameter or `x-bma-project-id`.
167
+ */
168
+ list(poolID: string, params?: MachinePoolGrantListParams | null | undefined, options?: RequestOptions): PagePromise<MachinePoolGrantsPageCursor, MachinePoolGrant>;
169
+ /**
170
+ * Grant a project the use of a pool. The body may carry `project_id`; otherwise the project header selects it. `machine_pool_id` comes from the path.
171
+ */
172
+ create(poolID: string, params?: MachinePoolGrantCreateParams, options?: RequestOptions): APIPromise<MachinePoolGrant>;
173
+ /**
174
+ * Retrieve a pool grant.
175
+ */
176
+ retrieve(poolID: string, grantID: string, options?: RequestOptions): APIPromise<MachinePoolGrant>;
177
+ /**
178
+ * Update a pool grant.
179
+ */
180
+ update(poolID: string, grantID: string, params?: MachinePoolGrantUpdateParams, options?: RequestOptions): APIPromise<MachinePoolGrant>;
181
+ /**
182
+ * Delete a pool grant.
183
+ */
184
+ delete(poolID: string, grantID: string, options?: RequestOptions): APIPromise<MachinePoolGrantDeleted>;
185
+ }
186
+ export declare class DesktopSessions extends APIResource {
187
+ tickets: DesktopSessionTickets;
188
+ /**
189
+ * Create a desktop session.
190
+ */
191
+ create(params: DesktopSessionCreateParams, options?: RequestOptions): APIPromise<DesktopSession>;
192
+ /**
193
+ * Retrieve a desktop session (control state in `control`).
194
+ */
195
+ retrieve(desktopSessionID: string, options?: RequestOptions): APIPromise<DesktopSession>;
196
+ /**
197
+ * Close a desktop session.
198
+ */
199
+ close(desktopSessionID: string, options?: RequestOptions): APIPromise<DesktopSessionClosed>;
200
+ /**
201
+ * Take input control.
202
+ */
203
+ acquireControl(desktopSessionID: string, params?: DesktopSessionAcquireControlParams, options?: RequestOptions): APIPromise<DesktopControlStatus>;
204
+ /**
205
+ * Renew the control lease.
206
+ */
207
+ renewControl(desktopSessionID: string, params?: DesktopSessionRenewControlParams, options?: RequestOptions): APIPromise<DesktopControlStatus>;
208
+ /**
209
+ * Release control.
210
+ */
211
+ releaseControl(desktopSessionID: string, params?: DesktopSessionReleaseControlParams, options?: RequestOptions): APIPromise<DesktopControlStatus>;
212
+ /**
213
+ * Hand control back to the agent.
214
+ */
215
+ handbackControl(desktopSessionID: string, params?: DesktopSessionHandbackControlParams, options?: RequestOptions): APIPromise<DesktopControlStatus>;
216
+ /**
217
+ * Send input actions.
218
+ */
219
+ sendActions(desktopSessionID: string, params: DesktopSessionSendActionsParams, options?: RequestOptions): APIPromise<DesktopActionResult>;
220
+ /**
221
+ * Capture a screenshot.
222
+ */
223
+ screenshot(desktopSessionID: string, params?: DesktopSessionScreenshotParams, options?: RequestOptions): APIPromise<DesktopScreenshot>;
224
+ /**
225
+ * Resume the desktop agent.
226
+ */
227
+ resumeAgent(desktopSessionID: string, params: DesktopSessionResumeAgentParams, options?: RequestOptions): APIPromise<DesktopControlStatus>;
228
+ /**
229
+ * Confirm a pending agent action.
230
+ */
231
+ confirmAction(desktopSessionID: string, pendingID: string, params: DesktopSessionConfirmActionParams, options?: RequestOptions): APIPromise<DesktopActionResult>;
232
+ }
233
+ export declare class DesktopSessionTickets extends APIResource {
234
+ /**
235
+ * Mint a single-use ticket (purpose watch). D-7 unified ticket endpoint. `purpose` defaults to and must be `watch`; the response is a `ticket` object. `watch_tickets` is the deprecated alias that answers `desktop_watch_ticket`.
236
+ */
237
+ create(desktopSessionID: string, params?: DesktopSessionTicketCreateParams, options?: RequestOptions): APIPromise<Ticket>;
238
+ }
239
+ export declare class TerminalSessions extends APIResource {
240
+ tickets: TerminalSessionTickets;
241
+ /**
242
+ * List the terminal sessions of a machine.
243
+ */
244
+ list(params?: TerminalSessionListParams | null | undefined, options?: RequestOptions): PagePromise<TerminalSessionsPageCursor, TerminalSession>;
245
+ /**
246
+ * Open a terminal session (body machine_id).
247
+ */
248
+ create(params: TerminalSessionCreateParams, options?: RequestOptions): APIPromise<TerminalSession>;
249
+ /**
250
+ * Retrieve a terminal session.
251
+ */
252
+ retrieve(terminalSessionID: string, options?: RequestOptions): APIPromise<TerminalSession>;
253
+ /**
254
+ * Close a terminal session. Native answers 204; the facade returns the session.
255
+ */
256
+ close(terminalSessionID: string, options?: RequestOptions): APIPromise<TerminalSession>;
257
+ }
258
+ export declare class TerminalSessionTickets extends APIResource {
259
+ /**
260
+ * Mint a single-use ticket (purpose connect). D-7 unified ticket endpoint. `purpose` defaults to and must be `connect`; the response is a `ticket` object. `connection_tickets` is the deprecated alias that answers `terminal_connection_ticket`.
261
+ */
262
+ create(terminalSessionID: string, params?: TerminalSessionTicketCreateParams, options?: RequestOptions): APIPromise<Ticket>;
263
+ }
264
+ export interface ExtensionServices {
265
+ machines: Machines;
266
+ machinePools: MachinePools;
267
+ desktopSessions: DesktopSessions;
268
+ terminalSessions: TerminalSessions;
269
+ }
270
+ export declare function newExtensionServices(client: BaseAnthropic): ExtensionServices;
271
+ export {};