@bctrl/sdk 1.0.4 → 1.0.5

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 (57) hide show
  1. package/README.md +0 -1
  2. package/dist/account.d.ts +43 -0
  3. package/dist/account.js +100 -0
  4. package/dist/accountTypes.d.ts +126 -0
  5. package/dist/accountTypes.js +1 -0
  6. package/dist/aiProviderTypes.d.ts +58 -0
  7. package/dist/aiProviderTypes.js +1 -0
  8. package/dist/aiProviders.d.ts +13 -0
  9. package/dist/aiProviders.js +36 -0
  10. package/dist/bctrl.d.ts +35 -3
  11. package/dist/bctrl.js +74 -6
  12. package/dist/browserExtensionTypes.d.ts +45 -0
  13. package/dist/browserExtensionTypes.js +1 -0
  14. package/dist/browserExtensions.d.ts +14 -0
  15. package/dist/browserExtensions.js +53 -0
  16. package/dist/files.d.ts +6 -24
  17. package/dist/files.js +9 -56
  18. package/dist/help.d.ts +7 -0
  19. package/dist/help.js +9 -0
  20. package/dist/http.d.ts +12 -1
  21. package/dist/http.js +73 -10
  22. package/dist/index.d.ts +17 -6
  23. package/dist/index.js +15 -5
  24. package/dist/invocations.d.ts +85 -47
  25. package/dist/invocations.js +144 -102
  26. package/dist/node.d.ts +12 -0
  27. package/dist/node.js +11 -0
  28. package/dist/proxies.d.ts +21 -0
  29. package/dist/proxies.js +55 -0
  30. package/dist/proxyTypes.d.ts +114 -0
  31. package/dist/proxyTypes.js +1 -0
  32. package/dist/runs.d.ts +35 -31
  33. package/dist/runs.js +95 -38
  34. package/dist/runtimes.d.ts +26 -42
  35. package/dist/runtimes.js +64 -65
  36. package/dist/schemas.d.ts +7 -0
  37. package/dist/schemas.js +36 -0
  38. package/dist/spaces.d.ts +20 -32
  39. package/dist/spaces.js +48 -36
  40. package/dist/toolCallTypes.d.ts +41 -0
  41. package/dist/toolCallTypes.js +1 -0
  42. package/dist/toolCalls.d.ts +9 -0
  43. package/dist/toolCalls.js +16 -0
  44. package/dist/tools.d.ts +23 -0
  45. package/dist/tools.js +49 -0
  46. package/dist/toolsetTypes.d.ts +32 -0
  47. package/dist/toolsetTypes.js +1 -0
  48. package/dist/toolsets.d.ts +12 -0
  49. package/dist/toolsets.js +31 -0
  50. package/dist/types.d.ts +499 -155
  51. package/dist/utils.d.ts +2 -1
  52. package/dist/utils.js +28 -3
  53. package/dist/vault.d.ts +14 -0
  54. package/dist/vault.js +37 -0
  55. package/dist/vaultTypes.d.ts +73 -0
  56. package/dist/vaultTypes.js +1 -0
  57. package/package.json +21 -12
package/dist/spaces.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { iterateV1Pages } from './pagination.js';
2
2
  import { V1RuntimesClient } from './runtimes.js';
3
- export class V1SpaceEnvironmentClient {
3
+ class V1SpaceEnvironmentClient {
4
4
  http;
5
5
  spaceId;
6
6
  constructor(http, spaceId) {
@@ -17,7 +17,7 @@ export class V1SpaceEnvironmentClient {
17
17
  });
18
18
  }
19
19
  }
20
- export class V1SpaceRuntimesClient {
20
+ class V1SpaceRuntimesClient {
21
21
  http;
22
22
  spaceId;
23
23
  constructor(http, spaceId) {
@@ -30,10 +30,10 @@ export class V1SpaceRuntimesClient {
30
30
  iter(query = {}) {
31
31
  return new V1RuntimesClient(this.http).iter({ ...query, spaceId: this.spaceId });
32
32
  }
33
- async create(request) {
33
+ create(request) {
34
34
  return new V1RuntimesClient(this.http).createInSpace(this.spaceId, request);
35
35
  }
36
- async get(runtimeId) {
36
+ get(runtimeId) {
37
37
  return new V1RuntimesClient(this.http).get(runtimeId);
38
38
  }
39
39
  stop(runtimeId) {
@@ -43,54 +43,66 @@ export class V1SpaceRuntimesClient {
43
43
  return new V1RuntimesClient(this.http).start(runtimeId);
44
44
  }
45
45
  }
46
- export class V1SpaceResource {
46
+ export class V1SpacesClient {
47
47
  http;
48
- data;
49
48
  environment;
50
49
  runtimes;
51
- constructor(http, data) {
50
+ constructor(http) {
52
51
  this.http = http;
53
- this.data = data;
54
- this.environment = new V1SpaceEnvironmentClient(http, data.id);
55
- this.runtimes = new V1SpaceRuntimesClient(http, data.id);
52
+ this.environment = new V1SpaceEnvironmentNamespaceClient(http);
53
+ this.runtimes = new V1SpaceRuntimesNamespaceClient(http);
56
54
  }
57
- get id() {
58
- return this.data.id;
55
+ list(query = {}) {
56
+ return this.http.request('/spaces', { query });
59
57
  }
60
- refresh() {
61
- return new V1SpacesClient(this.http).get(this.id);
58
+ iter(query = {}) {
59
+ return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
60
+ }
61
+ create(request) {
62
+ return this.http.request('/spaces', {
63
+ method: 'POST',
64
+ body: request,
65
+ });
66
+ }
67
+ get(id) {
68
+ return this.http.request(`/spaces/${encodeURIComponent(id)}`);
69
+ }
70
+ update(id, request) {
71
+ return this.http.request(`/spaces/${encodeURIComponent(id)}`, {
72
+ method: 'PATCH',
73
+ body: request,
74
+ });
62
75
  }
63
- async update(request) {
64
- return new V1SpacesClient(this.http).update(this.id, request);
76
+ delete(id) {
77
+ return this.http.request(`/spaces/${encodeURIComponent(id)}`, {
78
+ method: 'DELETE',
79
+ });
65
80
  }
66
81
  }
67
- export class V1SpacesClient {
82
+ export class V1SpaceEnvironmentNamespaceClient {
68
83
  http;
69
84
  constructor(http) {
70
85
  this.http = http;
71
86
  }
72
- async list() {
73
- return this.http.request('/spaces');
87
+ get(spaceId) {
88
+ return new V1SpaceEnvironmentClient(this.http, spaceId).get();
74
89
  }
75
- iter() {
76
- return iterateV1Pages({}, () => this.list());
90
+ update(spaceId, request) {
91
+ return new V1SpaceEnvironmentClient(this.http, spaceId).update(request);
77
92
  }
78
- async create(request) {
79
- const space = await this.http.request('/spaces', {
80
- method: 'POST',
81
- body: request,
82
- });
83
- return new V1SpaceResource(this.http, space);
93
+ }
94
+ export class V1SpaceRuntimesNamespaceClient {
95
+ http;
96
+ constructor(http) {
97
+ this.http = http;
84
98
  }
85
- async get(id) {
86
- const space = await this.http.request(`/spaces/${encodeURIComponent(id)}`);
87
- return new V1SpaceResource(this.http, space);
99
+ list(spaceId, query = {}) {
100
+ return new V1RuntimesClient(this.http).list({ ...query, spaceId });
88
101
  }
89
- async update(id, request) {
90
- const space = await this.http.request(`/spaces/${encodeURIComponent(id)}`, {
91
- method: 'PATCH',
92
- body: request,
93
- });
94
- return new V1SpaceResource(this.http, space);
102
+ iter(spaceId, query = {}) {
103
+ return new V1RuntimesClient(this.http).iter({ ...query, spaceId });
104
+ }
105
+ create(spaceId, request) {
106
+ return new V1RuntimesClient(this.http).createInSpace(spaceId, request);
95
107
  }
96
108
  }
@@ -0,0 +1,41 @@
1
+ import type { JsonObject, JsonValue, V1PageQuery, V1ToolType } from './types.js';
2
+ export type V1ToolCallActor = 'test' | 'agent' | 'invocation';
3
+ export type V1ToolCallStatus = 'succeeded' | 'failed';
4
+ export interface V1ToolCallTool {
5
+ id: string;
6
+ name: string;
7
+ type: V1ToolType;
8
+ }
9
+ export interface V1ToolCall {
10
+ id: string;
11
+ toolCallId: string;
12
+ spaceId: string;
13
+ runId?: string | null;
14
+ invocationId?: string | null;
15
+ toolsetId?: string | null;
16
+ tool: V1ToolCallTool;
17
+ actor: V1ToolCallActor;
18
+ status: V1ToolCallStatus;
19
+ redactedInput?: JsonValue;
20
+ redactedOutput?: JsonValue;
21
+ redactedError?: JsonObject | null;
22
+ inputSummary?: JsonObject | null;
23
+ outputSummary?: JsonObject | null;
24
+ error?: {
25
+ code: string;
26
+ message: string;
27
+ details?: JsonObject;
28
+ } | null;
29
+ startedAt: string;
30
+ finishedAt: string;
31
+ durationMs: number;
32
+ createdAt: string;
33
+ }
34
+ export interface V1ToolCallListQuery extends V1PageQuery {
35
+ spaceId?: string;
36
+ runId?: string;
37
+ invocationId?: string;
38
+ toolId?: string;
39
+ status?: V1ToolCallStatus;
40
+ actor?: V1ToolCallActor;
41
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { V1HttpClient } from './http.js';
2
+ import type { V1ListEnvelope, V1ToolCall, V1ToolCallListQuery } from './types.js';
3
+ export declare class V1ToolCallsClient {
4
+ private readonly http;
5
+ constructor(http: V1HttpClient);
6
+ list(query?: V1ToolCallListQuery): Promise<V1ListEnvelope<V1ToolCall>>;
7
+ iter(query?: V1ToolCallListQuery): AsyncGenerator<V1ToolCall, void, undefined>;
8
+ get(toolCallId: string): Promise<V1ToolCall>;
9
+ }
@@ -0,0 +1,16 @@
1
+ import { iterateV1Pages } from './pagination.js';
2
+ export class V1ToolCallsClient {
3
+ http;
4
+ constructor(http) {
5
+ this.http = http;
6
+ }
7
+ list(query = {}) {
8
+ return this.http.request('/tool-calls', { query });
9
+ }
10
+ iter(query = {}) {
11
+ return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
12
+ }
13
+ get(toolCallId) {
14
+ return this.http.request(`/tool-calls/${encodeURIComponent(toolCallId)}`);
15
+ }
16
+ }
@@ -0,0 +1,23 @@
1
+ import type { V1HttpClient } from './http.js';
2
+ import type { JsonObject, V1ListEnvelope, V1PageQuery, V1Tool, V1ToolCreateRequest, V1ToolUpdateRequest, V1ToolVersion, V1ToolVersionCreateRequest } from './types.js';
3
+ export interface V1ToolListQuery extends V1PageQuery {
4
+ spaceId?: string;
5
+ }
6
+ export type V1ToolVersionListQuery = V1PageQuery;
7
+ export declare class V1ToolsClient {
8
+ private readonly http;
9
+ constructor(http: V1HttpClient);
10
+ list(query?: V1ToolListQuery): Promise<V1ListEnvelope<V1Tool>>;
11
+ iter(query?: V1ToolListQuery): AsyncGenerator<V1Tool, void, undefined>;
12
+ create(request: V1ToolCreateRequest): Promise<V1Tool>;
13
+ get(id: string): Promise<V1Tool>;
14
+ update(id: string, request: V1ToolUpdateRequest): Promise<V1Tool>;
15
+ test(id: string, request?: {
16
+ input?: unknown;
17
+ }): Promise<unknown>;
18
+ listVersions(id: string, query?: V1ToolVersionListQuery): Promise<V1ListEnvelope<V1ToolVersion>>;
19
+ createVersion(id: string, request: V1ToolVersionCreateRequest): Promise<V1ToolVersion>;
20
+ getVersion(id: string, versionId: string): Promise<V1ToolVersion>;
21
+ promoteVersion(id: string, versionId: string): Promise<V1ToolVersion>;
22
+ }
23
+ export declare function passthroughJsonSchema(): JsonObject;
package/dist/tools.js ADDED
@@ -0,0 +1,49 @@
1
+ import { iterateV1Pages } from './pagination.js';
2
+ export class V1ToolsClient {
3
+ http;
4
+ constructor(http) {
5
+ this.http = http;
6
+ }
7
+ list(query = {}) {
8
+ return this.http.request('/tools', { query });
9
+ }
10
+ iter(query = {}) {
11
+ return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
12
+ }
13
+ create(request) {
14
+ return this.http.request('/tools', { method: 'POST', body: request });
15
+ }
16
+ get(id) {
17
+ return this.http.request(`/tools/${encodeURIComponent(id)}`);
18
+ }
19
+ update(id, request) {
20
+ return this.http.request(`/tools/${encodeURIComponent(id)}`, {
21
+ method: 'PATCH',
22
+ body: request,
23
+ });
24
+ }
25
+ test(id, request = {}) {
26
+ return this.http.request(`/tools/${encodeURIComponent(id)}/test`, {
27
+ method: 'POST',
28
+ body: request,
29
+ });
30
+ }
31
+ listVersions(id, query = {}) {
32
+ return this.http.request(`/tools/${encodeURIComponent(id)}/versions`, { query });
33
+ }
34
+ createVersion(id, request) {
35
+ return this.http.request(`/tools/${encodeURIComponent(id)}/versions`, {
36
+ method: 'POST',
37
+ body: request,
38
+ });
39
+ }
40
+ getVersion(id, versionId) {
41
+ return this.http.request(`/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}`);
42
+ }
43
+ promoteVersion(id, versionId) {
44
+ return this.http.request(`/tools/${encodeURIComponent(id)}/versions/${encodeURIComponent(versionId)}/promote`, { method: 'POST' });
45
+ }
46
+ }
47
+ export function passthroughJsonSchema() {
48
+ return { type: 'object', additionalProperties: true };
49
+ }
@@ -0,0 +1,32 @@
1
+ import type { JsonObject, V1PageQuery } from './types.js';
2
+ export type V1ToolsetBuiltinName = 'files' | 'vault' | 'captcha';
3
+ export interface V1Toolset {
4
+ id: string;
5
+ spaceId: string;
6
+ name: string;
7
+ builtins: V1ToolsetBuiltinName[];
8
+ toolIds: string[];
9
+ metadata?: JsonObject | null;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ }
13
+ export interface V1ToolsetListQuery extends V1PageQuery {
14
+ spaceId?: string;
15
+ }
16
+ export interface V1ToolsetCreateRequest {
17
+ spaceId?: string;
18
+ name: string;
19
+ builtins?: V1ToolsetBuiltinName[];
20
+ toolIds?: string[];
21
+ metadata?: JsonObject | null;
22
+ }
23
+ export interface V1ToolsetUpdateRequest {
24
+ name?: string;
25
+ builtins?: V1ToolsetBuiltinName[];
26
+ toolIds?: string[];
27
+ metadata?: JsonObject | null;
28
+ }
29
+ export interface V1ToolsetDeleteResponse {
30
+ id: string;
31
+ deleted: true;
32
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { V1HttpClient } from './http.js';
2
+ import type { V1ListEnvelope, V1Toolset, V1ToolsetCreateRequest, V1ToolsetDeleteResponse, V1ToolsetListQuery, V1ToolsetUpdateRequest } from './types.js';
3
+ export declare class V1ToolsetsClient {
4
+ private readonly http;
5
+ constructor(http: V1HttpClient);
6
+ list(query?: V1ToolsetListQuery): Promise<V1ListEnvelope<V1Toolset>>;
7
+ iter(query?: V1ToolsetListQuery): AsyncGenerator<V1Toolset, void, undefined>;
8
+ create(request: V1ToolsetCreateRequest): Promise<V1Toolset>;
9
+ get(toolsetId: string): Promise<V1Toolset>;
10
+ update(toolsetId: string, request: V1ToolsetUpdateRequest): Promise<V1Toolset>;
11
+ delete(toolsetId: string): Promise<V1ToolsetDeleteResponse>;
12
+ }
@@ -0,0 +1,31 @@
1
+ import { iterateV1Pages } from './pagination.js';
2
+ export class V1ToolsetsClient {
3
+ http;
4
+ constructor(http) {
5
+ this.http = http;
6
+ }
7
+ list(query = {}) {
8
+ return this.http.request('/toolsets', { query });
9
+ }
10
+ iter(query = {}) {
11
+ return iterateV1Pages(query, (pageQuery) => this.list(pageQuery));
12
+ }
13
+ create(request) {
14
+ return this.http.request('/toolsets', {
15
+ method: 'POST',
16
+ body: request,
17
+ });
18
+ }
19
+ get(toolsetId) {
20
+ return this.http.request(`/toolsets/${encodeURIComponent(toolsetId)}`);
21
+ }
22
+ update(toolsetId, request) {
23
+ return this.http.request(`/toolsets/${encodeURIComponent(toolsetId)}`, {
24
+ method: 'PATCH',
25
+ body: request,
26
+ });
27
+ }
28
+ delete(toolsetId) {
29
+ return this.http.request(`/toolsets/${encodeURIComponent(toolsetId)}`, { method: 'DELETE' });
30
+ }
31
+ }