@agent-api/sdk 1.3.2 → 1.4.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.
- package/CHANGELOG.md +9 -0
- package/dist/resources/responses.d.ts +3 -1
- package/dist/resources/responses.js +8 -3
- package/dist/resources/safety-identifiers.d.ts +9 -0
- package/dist/resources/safety-identifiers.js +13 -0
- package/dist/resources/skills.js +11 -1
- package/dist/resources/volumes.d.ts +2 -4
- package/dist/resources/volumes.js +17 -4
- package/dist/types/input.d.ts +1 -0
- package/dist/types/responses.d.ts +8 -0
- package/dist/types/safety-identifiers.d.ts +17 -0
- package/dist/types/safety-identifiers.js +1 -0
- package/dist/types/skills.d.ts +3 -0
- package/dist/types/volumes.d.ts +4 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +1 -1
- package/dist-cjs/resources/responses.js +8 -3
- package/dist-cjs/resources/safety-identifiers.js +17 -0
- package/dist-cjs/resources/skills.js +20 -10
- package/dist-cjs/resources/volumes.js +23 -10
- package/dist-cjs/types/safety-identifiers.js +2 -0
- package/dist-cjs/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog — @agent-api/sdk
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Added `user_id` filters to response, volume, and skill list helpers.
|
|
8
|
+
- Added response-only `safety_identifier` filtering and retrieve guards.
|
|
9
|
+
- Added `user_id` and `safety_identifier` fields to response and response list item types.
|
|
10
|
+
- Added `tenant_search` controls for memory and skill tools, plus `previous_response_id` support for skill discovery.
|
|
11
|
+
|
|
3
12
|
## 1.3.2
|
|
4
13
|
|
|
5
14
|
### Added
|
|
@@ -13,7 +13,9 @@ export declare class ResponsesResource {
|
|
|
13
13
|
list(params?: ListResponsesParams, options?: RequestOptions): Promise<ListResponsesResponse>;
|
|
14
14
|
listPage(params?: ListResponsesParams, options?: RequestOptions): Promise<Page<ResponseListItem, ListResponsesParams>>;
|
|
15
15
|
listIterator(params?: ListResponsesParams, options?: RequestOptions): AsyncIterable<ResponseListItem>;
|
|
16
|
-
retrieve(responseID: string,
|
|
16
|
+
retrieve(responseID: string, params?: {
|
|
17
|
+
safety_identifier?: string;
|
|
18
|
+
}, options?: RequestOptions): Promise<AgentResponse>;
|
|
17
19
|
cancel(responseID: string, options?: RequestOptions): Promise<CancelResponse>;
|
|
18
20
|
listChildren(responseID: string, options?: RequestOptions): Promise<ListChildrenResponse>;
|
|
19
21
|
listEvents(responseID: string, params?: ListEventsParams, options?: RequestOptions): Promise<ListEventsResponse>;
|
|
@@ -17,7 +17,12 @@ export class ResponsesResource {
|
|
|
17
17
|
return this.http.request("POST", this.path, params, options).then(addOutputText);
|
|
18
18
|
}
|
|
19
19
|
list(params = {}, options) {
|
|
20
|
-
return this.http.request("GET", `${this.path}${buildQuery({
|
|
20
|
+
return this.http.request("GET", `${this.path}${buildQuery({
|
|
21
|
+
limit: params.limit,
|
|
22
|
+
page_token: params.page_token,
|
|
23
|
+
safety_identifier: params.safety_identifier,
|
|
24
|
+
user_id: params.user_id,
|
|
25
|
+
})}`, undefined, options);
|
|
21
26
|
}
|
|
22
27
|
async listPage(params = {}, options) {
|
|
23
28
|
return collectPage((pageParams) => this.list(pageParams, options), params);
|
|
@@ -31,9 +36,9 @@ export class ResponsesResource {
|
|
|
31
36
|
},
|
|
32
37
|
};
|
|
33
38
|
}
|
|
34
|
-
retrieve(responseID, options) {
|
|
39
|
+
retrieve(responseID, params = {}, options) {
|
|
35
40
|
return this.http
|
|
36
|
-
.request("GET", `${this.path}/${encodeURIComponent(responseID)}`, undefined, options)
|
|
41
|
+
.request("GET", `${this.path}/${encodeURIComponent(responseID)}${buildQuery({ safety_identifier: params.safety_identifier })}`, undefined, options)
|
|
37
42
|
.then(addOutputText);
|
|
38
43
|
}
|
|
39
44
|
cancel(responseID, options) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HTTPClient } from "../internal/http.js";
|
|
2
|
+
import type { RequestOptions } from "../types/common.js";
|
|
3
|
+
import type { ListSafetyIdentifiersParams, ListSafetyIdentifiersResponse, SafetyIdentifier } from "../types/safety-identifiers.js";
|
|
4
|
+
export declare class SafetyIdentifiersResource {
|
|
5
|
+
private readonly http;
|
|
6
|
+
constructor(http: HTTPClient);
|
|
7
|
+
list(params?: ListSafetyIdentifiersParams, options?: RequestOptions): Promise<ListSafetyIdentifiersResponse>;
|
|
8
|
+
lookup(safetyIdentifier: string, options?: RequestOptions): Promise<SafetyIdentifier>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { buildQuery } from "../internal/query.js";
|
|
2
|
+
export class SafetyIdentifiersResource {
|
|
3
|
+
http;
|
|
4
|
+
constructor(http) {
|
|
5
|
+
this.http = http;
|
|
6
|
+
}
|
|
7
|
+
list(params = {}, options) {
|
|
8
|
+
return this.http.request("GET", `/v1/safety_identifiers${buildQuery({ page_size: params.page_size, page_token: params.page_token })}`, undefined, options);
|
|
9
|
+
}
|
|
10
|
+
lookup(safetyIdentifier, options) {
|
|
11
|
+
return this.http.request("GET", `/v1/safety_identifiers/lookup${buildQuery({ safety_identifier: safetyIdentifier })}`, undefined, options);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/resources/skills.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { buildQuery } from "../internal/query.js";
|
|
2
1
|
export class SkillsResource {
|
|
3
2
|
http;
|
|
4
3
|
constructor(http) {
|
|
@@ -9,6 +8,7 @@ export class SkillsResource {
|
|
|
9
8
|
include_archived: params.include_archived ? "true" : undefined,
|
|
10
9
|
limit: params.limit,
|
|
11
10
|
page_token: params.page_token,
|
|
11
|
+
user_id: params.user_id,
|
|
12
12
|
})}`, undefined, options);
|
|
13
13
|
}
|
|
14
14
|
create(params = {}, options) {
|
|
@@ -96,6 +96,16 @@ export class SkillsResource {
|
|
|
96
96
|
})}`, undefined, options);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
+
function buildQuery(values) {
|
|
100
|
+
const search = new URLSearchParams();
|
|
101
|
+
for (const [key, value] of Object.entries(values)) {
|
|
102
|
+
if (value !== undefined && value !== "") {
|
|
103
|
+
search.set(key, String(value));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const qs = search.toString();
|
|
107
|
+
return qs ? `?${qs}` : "";
|
|
108
|
+
}
|
|
99
109
|
function skillPath(path) {
|
|
100
110
|
return path
|
|
101
111
|
.split("/")
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type { HTTPClient } from "../internal/http.js";
|
|
2
2
|
import type { RequestOptions } from "../types/common.js";
|
|
3
|
-
import type { CreateVolumeParams, DownloadVolumeArchiveParams, GrepVolumeParams, ListVolumeEntriesParams, ListVolumeEntriesResponse, ListVolumesParams, ListVolumesResponse, PatchVolumeFileLinesParams, ReadVolumeFileLinesParams, ReadVolumeFileParams, ReadVolumeFileRawParams, SearchVolumeEntriesParams, SummarizeVolumeParams, VolumeArchive, VolumeFileDeliver, VolumeFileLines, VolumeFileLinesPatch, VolumeFileRaw, VolumeFileWrite, VolumeGrepResponse, VolumeInfo, VolumePathDelete, VolumeSummary } from "../types/volumes.js";
|
|
3
|
+
import type { CreateVolumeParams, DownloadVolumeArchiveParams, GrepVolumeParams, ListVolumeEntriesParams, ListVolumeEntriesResponse, ListVolumesParams, ListVolumesResponse, PatchVolumeFileLinesParams, ReadVolumeFileLinesParams, ReadVolumeFileParams, ReadVolumeFileRawParams, SearchVolumeEntriesParams, SummarizeVolumeParams, UpdateVolumeParams, VolumeArchive, VolumeFileDeliver, VolumeFileLines, VolumeFileLinesPatch, VolumeFileRaw, VolumeFileWrite, VolumeGrepResponse, VolumeInfo, VolumePathDelete, VolumeSummary } from "../types/volumes.js";
|
|
4
4
|
export declare class VolumesResource {
|
|
5
5
|
private readonly http;
|
|
6
6
|
constructor(http: HTTPClient);
|
|
7
7
|
list(params?: ListVolumesParams, options?: RequestOptions): Promise<ListVolumesResponse>;
|
|
8
8
|
create(params?: CreateVolumeParams, options?: RequestOptions): Promise<VolumeInfo>;
|
|
9
9
|
retrieve(volumeID: string, options?: RequestOptions): Promise<VolumeInfo>;
|
|
10
|
-
update(volumeID: string, params:
|
|
11
|
-
name: string;
|
|
12
|
-
}, options?: RequestOptions): Promise<VolumeInfo>;
|
|
10
|
+
update(volumeID: string, params: UpdateVolumeParams, options?: RequestOptions): Promise<VolumeInfo>;
|
|
13
11
|
delete(volumeID: string, options?: RequestOptions): Promise<void>;
|
|
14
12
|
listEntries(volumeID: string, params?: ListVolumeEntriesParams, options?: RequestOptions): Promise<ListVolumeEntriesResponse>;
|
|
15
13
|
searchEntries(volumeID: string, params: SearchVolumeEntriesParams, options?: RequestOptions): Promise<ListVolumeEntriesResponse>;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { buildQuery } from "../internal/query.js";
|
|
2
1
|
export class VolumesResource {
|
|
3
2
|
http;
|
|
4
3
|
constructor(http) {
|
|
5
4
|
this.http = http;
|
|
6
5
|
}
|
|
7
6
|
list(params = {}, options) {
|
|
8
|
-
return this.http.request("GET", `/v1/volumes${buildQuery({
|
|
7
|
+
return this.http.request("GET", `/v1/volumes${buildQuery({
|
|
8
|
+
limit: params.limit,
|
|
9
|
+
page_token: params.page_token,
|
|
10
|
+
user_id: params.user_id,
|
|
11
|
+
})}`, undefined, options);
|
|
9
12
|
}
|
|
10
13
|
create(params = {}, options) {
|
|
11
14
|
return this.http.request("POST", "/v1/volumes", params, options);
|
|
@@ -74,7 +77,7 @@ export class VolumesResource {
|
|
|
74
77
|
}));
|
|
75
78
|
}
|
|
76
79
|
summarize(volumeID, params = {}, options) {
|
|
77
|
-
return this.http.request("POST", `/v1/volumes/${encodeURIComponent(volumeID)}/summarize`, params, options);
|
|
80
|
+
return this.http.request("POST", `/v1/volumes/${encodeURIComponent(volumeID)}/summarize`, { path: params.path }, options);
|
|
78
81
|
}
|
|
79
82
|
readLines(volumeID, path, params, options) {
|
|
80
83
|
return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/file_lines/${volumePath(path)}${buildQuery({
|
|
@@ -84,7 +87,7 @@ export class VolumesResource {
|
|
|
84
87
|
})}`, undefined, options);
|
|
85
88
|
}
|
|
86
89
|
patchLines(volumeID, path, params, options) {
|
|
87
|
-
return this.http.request("PATCH", `/v1/volumes/${encodeURIComponent(volumeID)}/file_lines/${volumePath(path)}`, params, options);
|
|
90
|
+
return this.http.request("PATCH", `/v1/volumes/${encodeURIComponent(volumeID)}/file_lines/${volumePath(path)}`, { start_line: params.start_line, end_line: params.end_line, replacement: params.replacement }, options);
|
|
88
91
|
}
|
|
89
92
|
grep(volumeID, params, options) {
|
|
90
93
|
return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/grep${buildQuery({
|
|
@@ -95,6 +98,16 @@ export class VolumesResource {
|
|
|
95
98
|
})}`, undefined, options);
|
|
96
99
|
}
|
|
97
100
|
}
|
|
101
|
+
function buildQuery(values) {
|
|
102
|
+
const search = new URLSearchParams();
|
|
103
|
+
for (const [key, value] of Object.entries(values)) {
|
|
104
|
+
if (value !== undefined && value !== "") {
|
|
105
|
+
search.set(key, String(value));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const qs = search.toString();
|
|
109
|
+
return qs ? `?${qs}` : "";
|
|
110
|
+
}
|
|
98
111
|
function volumePath(path) {
|
|
99
112
|
return path
|
|
100
113
|
.split("/")
|
package/dist/types/input.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface CallerContext {
|
|
|
10
10
|
}
|
|
11
11
|
export interface SkillToolOptions {
|
|
12
12
|
enabled?: boolean;
|
|
13
|
+
tenant_search?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export interface ResponseCreateParamsBase {
|
|
15
16
|
input: Input;
|
|
@@ -40,6 +41,7 @@ export interface ResponseCreateParamsBase {
|
|
|
40
41
|
memory?: MemoryOptions;
|
|
41
42
|
plan_mode_preference?: AgentCapabilityPreference;
|
|
42
43
|
sub_agent_preference?: AgentCapabilityPreference;
|
|
44
|
+
safety_identifier?: string;
|
|
43
45
|
user?: string;
|
|
44
46
|
stream?: boolean;
|
|
45
47
|
}
|
|
@@ -122,8 +124,10 @@ export interface AgentResponse {
|
|
|
122
124
|
prompt_cache_key?: string | null;
|
|
123
125
|
store?: boolean;
|
|
124
126
|
background?: boolean;
|
|
127
|
+
user_id?: string;
|
|
125
128
|
tool_results?: ToolInvocationResult[];
|
|
126
129
|
plan?: unknown;
|
|
130
|
+
safety_identifier?: string;
|
|
127
131
|
}
|
|
128
132
|
export interface ResponseListItem {
|
|
129
133
|
id: string;
|
|
@@ -135,10 +139,14 @@ export interface ResponseListItem {
|
|
|
135
139
|
input_preview?: string;
|
|
136
140
|
root_response_id?: string;
|
|
137
141
|
background?: boolean;
|
|
142
|
+
user_id?: string;
|
|
143
|
+
safety_identifier?: string;
|
|
138
144
|
}
|
|
139
145
|
export interface ListResponsesParams {
|
|
140
146
|
limit?: number;
|
|
141
147
|
page_token?: string;
|
|
148
|
+
safety_identifier?: string;
|
|
149
|
+
user_id?: string;
|
|
142
150
|
}
|
|
143
151
|
export interface ListResponsesResponse {
|
|
144
152
|
object: "list";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface SafetyIdentifier {
|
|
2
|
+
object: "safety_identifier";
|
|
3
|
+
workspace_id: string;
|
|
4
|
+
safety_identifier: string;
|
|
5
|
+
created_by_user_id: string;
|
|
6
|
+
status: string;
|
|
7
|
+
created_at: number;
|
|
8
|
+
updated_at: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ListSafetyIdentifiersParams {
|
|
11
|
+
page_size?: number;
|
|
12
|
+
page_token?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ListSafetyIdentifiersResponse {
|
|
15
|
+
object: "list";
|
|
16
|
+
data: SafetyIdentifier[];
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/skills.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ export interface ListSkillsParams {
|
|
|
99
99
|
include_archived?: boolean;
|
|
100
100
|
limit?: number;
|
|
101
101
|
page_token?: string;
|
|
102
|
+
user_id?: string;
|
|
102
103
|
}
|
|
103
104
|
export interface ListSkillsResponse {
|
|
104
105
|
object: "list";
|
|
@@ -115,6 +116,8 @@ export interface DiscoverSkillsParams {
|
|
|
115
116
|
branch?: SkillBranch | "both";
|
|
116
117
|
include_dev?: boolean;
|
|
117
118
|
limit?: number;
|
|
119
|
+
previous_response_id?: string;
|
|
120
|
+
tenant_search?: boolean;
|
|
118
121
|
local_skills?: LocalSkillDescriptor[];
|
|
119
122
|
}
|
|
120
123
|
export interface FocusSkillParams {
|
package/dist/types/volumes.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface VolumeEntry {
|
|
|
18
18
|
export interface ListVolumesParams {
|
|
19
19
|
limit?: number;
|
|
20
20
|
page_token?: string;
|
|
21
|
+
user_id?: string;
|
|
21
22
|
}
|
|
22
23
|
export interface ListVolumesResponse {
|
|
23
24
|
object: "list";
|
|
@@ -27,6 +28,9 @@ export interface ListVolumesResponse {
|
|
|
27
28
|
export interface CreateVolumeParams {
|
|
28
29
|
name?: string;
|
|
29
30
|
}
|
|
31
|
+
export interface UpdateVolumeParams {
|
|
32
|
+
name?: string;
|
|
33
|
+
}
|
|
30
34
|
export interface ListVolumeEntriesParams {
|
|
31
35
|
path?: string;
|
|
32
36
|
limit?: number;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
2
|
-
export declare const USER_AGENT = "@agent-api/sdk/1.
|
|
1
|
+
export declare const VERSION = "1.4.0";
|
|
2
|
+
export declare const USER_AGENT = "@agent-api/sdk/1.4.0";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.4.0";
|
|
2
2
|
export const USER_AGENT = `@agent-api/sdk/${VERSION}`;
|
|
@@ -20,7 +20,12 @@ class ResponsesResource {
|
|
|
20
20
|
return this.http.request("POST", this.path, params, options).then(output_text_js_1.addOutputText);
|
|
21
21
|
}
|
|
22
22
|
list(params = {}, options) {
|
|
23
|
-
return this.http.request("GET", `${this.path}${(0, query_js_1.buildQuery)({
|
|
23
|
+
return this.http.request("GET", `${this.path}${(0, query_js_1.buildQuery)({
|
|
24
|
+
limit: params.limit,
|
|
25
|
+
page_token: params.page_token,
|
|
26
|
+
safety_identifier: params.safety_identifier,
|
|
27
|
+
user_id: params.user_id,
|
|
28
|
+
})}`, undefined, options);
|
|
24
29
|
}
|
|
25
30
|
async listPage(params = {}, options) {
|
|
26
31
|
return (0, pagination_js_1.collectPage)((pageParams) => this.list(pageParams, options), params);
|
|
@@ -34,9 +39,9 @@ class ResponsesResource {
|
|
|
34
39
|
},
|
|
35
40
|
};
|
|
36
41
|
}
|
|
37
|
-
retrieve(responseID, options) {
|
|
42
|
+
retrieve(responseID, params = {}, options) {
|
|
38
43
|
return this.http
|
|
39
|
-
.request("GET", `${this.path}/${encodeURIComponent(responseID)}`, undefined, options)
|
|
44
|
+
.request("GET", `${this.path}/${encodeURIComponent(responseID)}${(0, query_js_1.buildQuery)({ safety_identifier: params.safety_identifier })}`, undefined, options)
|
|
40
45
|
.then(output_text_js_1.addOutputText);
|
|
41
46
|
}
|
|
42
47
|
cancel(responseID, options) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SafetyIdentifiersResource = void 0;
|
|
4
|
+
const query_js_1 = require("../internal/query.js");
|
|
5
|
+
class SafetyIdentifiersResource {
|
|
6
|
+
http;
|
|
7
|
+
constructor(http) {
|
|
8
|
+
this.http = http;
|
|
9
|
+
}
|
|
10
|
+
list(params = {}, options) {
|
|
11
|
+
return this.http.request("GET", `/v1/safety_identifiers${(0, query_js_1.buildQuery)({ page_size: params.page_size, page_token: params.page_token })}`, undefined, options);
|
|
12
|
+
}
|
|
13
|
+
lookup(safetyIdentifier, options) {
|
|
14
|
+
return this.http.request("GET", `/v1/safety_identifiers/lookup${(0, query_js_1.buildQuery)({ safety_identifier: safetyIdentifier })}`, undefined, options);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.SafetyIdentifiersResource = SafetyIdentifiersResource;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SkillsResource = void 0;
|
|
4
|
-
const query_js_1 = require("../internal/query.js");
|
|
5
4
|
class SkillsResource {
|
|
6
5
|
http;
|
|
7
6
|
constructor(http) {
|
|
8
7
|
this.http = http;
|
|
9
8
|
}
|
|
10
9
|
list(params = {}, options) {
|
|
11
|
-
return this.http.request("GET", `/v1/skills${
|
|
10
|
+
return this.http.request("GET", `/v1/skills${buildQuery({
|
|
12
11
|
include_archived: params.include_archived ? "true" : undefined,
|
|
13
12
|
limit: params.limit,
|
|
14
13
|
page_token: params.page_token,
|
|
14
|
+
user_id: params.user_id,
|
|
15
15
|
})}`, undefined, options);
|
|
16
16
|
}
|
|
17
17
|
create(params = {}, options) {
|
|
@@ -42,13 +42,13 @@ class SkillsResource {
|
|
|
42
42
|
return this.http.request("DELETE", `/v1/skills/${encodeURIComponent(skillID)}`, undefined, options);
|
|
43
43
|
}
|
|
44
44
|
acceptDev(skillID, params = {}, options) {
|
|
45
|
-
return this.http.request("POST", `/v1/skills/${encodeURIComponent(skillID)}/accept_dev${
|
|
45
|
+
return this.http.request("POST", `/v1/skills/${encodeURIComponent(skillID)}/accept_dev${buildQuery({ strategy: params.strategy })}`, {}, options);
|
|
46
46
|
}
|
|
47
47
|
discardDev(skillID, options) {
|
|
48
48
|
return this.http.request("POST", `/v1/skills/${encodeURIComponent(skillID)}/discard_dev`, {}, options);
|
|
49
49
|
}
|
|
50
50
|
listFiles(skillID, params = {}, options) {
|
|
51
|
-
return this.http.request("GET", `/v1/skills/${encodeURIComponent(skillID)}/files${
|
|
51
|
+
return this.http.request("GET", `/v1/skills/${encodeURIComponent(skillID)}/files${buildQuery({
|
|
52
52
|
path: params.path,
|
|
53
53
|
branch: params.branch,
|
|
54
54
|
fallback_to_main: params.fallback_to_main === false ? "false" : undefined,
|
|
@@ -57,22 +57,22 @@ class SkillsResource {
|
|
|
57
57
|
})}`, undefined, options);
|
|
58
58
|
}
|
|
59
59
|
readFile(skillID, path, params = {}, options) {
|
|
60
|
-
return this.http.request("GET", `/v1/skills/${encodeURIComponent(skillID)}/files/${skillPath(path)}${
|
|
60
|
+
return this.http.request("GET", `/v1/skills/${encodeURIComponent(skillID)}/files/${skillPath(path)}${buildQuery({
|
|
61
61
|
branch: params.branch,
|
|
62
62
|
fallback_to_main: params.fallback_to_main === false ? "false" : undefined,
|
|
63
63
|
max_bytes: params.max_bytes,
|
|
64
64
|
})}`, undefined, options);
|
|
65
65
|
}
|
|
66
66
|
writeFile(skillID, path, content, params = {}, options) {
|
|
67
|
-
return this.http.requestRaw("PUT", `/v1/skills/${encodeURIComponent(skillID)}/files/${skillPath(path)}${
|
|
67
|
+
return this.http.requestRaw("PUT", `/v1/skills/${encodeURIComponent(skillID)}/files/${skillPath(path)}${buildQuery({ branch: params.branch })}`, content, options);
|
|
68
68
|
}
|
|
69
69
|
deleteFile(skillID, path, params = {}, options) {
|
|
70
|
-
return this.http.request("DELETE", `/v1/skills/${encodeURIComponent(skillID)}/files/${skillPath(path)}${
|
|
70
|
+
return this.http.request("DELETE", `/v1/skills/${encodeURIComponent(skillID)}/files/${skillPath(path)}${buildQuery({ branch: params.branch })}`, undefined, options);
|
|
71
71
|
}
|
|
72
72
|
exportArchive(skillID, params = {}, options) {
|
|
73
73
|
const archivePath = normalizeArchivePath(params.path);
|
|
74
74
|
return this.http
|
|
75
|
-
.requestBinary("GET", `/v1/skills/${encodeURIComponent(skillID)}/export${
|
|
75
|
+
.requestBinary("GET", `/v1/skills/${encodeURIComponent(skillID)}/export${buildQuery({
|
|
76
76
|
path: archivePath || undefined,
|
|
77
77
|
branch: params.branch,
|
|
78
78
|
fallback_to_main: params.fallback_to_main === false ? "false" : undefined,
|
|
@@ -84,7 +84,7 @@ class SkillsResource {
|
|
|
84
84
|
}));
|
|
85
85
|
}
|
|
86
86
|
importArchive(skillID, archive, params = {}, options) {
|
|
87
|
-
return this.http.requestRaw("POST", `/v1/skills/${encodeURIComponent(skillID)}/import${
|
|
87
|
+
return this.http.requestRaw("POST", `/v1/skills/${encodeURIComponent(skillID)}/import${buildQuery({
|
|
88
88
|
path: normalizeArchivePath(params.path) || undefined,
|
|
89
89
|
branch: params.branch,
|
|
90
90
|
replace: params.replace ? "true" : undefined,
|
|
@@ -92,7 +92,7 @@ class SkillsResource {
|
|
|
92
92
|
})}`, archive, options);
|
|
93
93
|
}
|
|
94
94
|
diff(skillID, params = {}, options) {
|
|
95
|
-
return this.http.request("GET", `/v1/skills/${encodeURIComponent(skillID)}/diff${
|
|
95
|
+
return this.http.request("GET", `/v1/skills/${encodeURIComponent(skillID)}/diff${buildQuery({
|
|
96
96
|
path: normalizeArchivePath(params.path) || undefined,
|
|
97
97
|
max_file_chars: params.max_file_chars,
|
|
98
98
|
include_unchanged: params.include_unchanged ? "true" : undefined,
|
|
@@ -100,6 +100,16 @@ class SkillsResource {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
exports.SkillsResource = SkillsResource;
|
|
103
|
+
function buildQuery(values) {
|
|
104
|
+
const search = new URLSearchParams();
|
|
105
|
+
for (const [key, value] of Object.entries(values)) {
|
|
106
|
+
if (value !== undefined && value !== "") {
|
|
107
|
+
search.set(key, String(value));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const qs = search.toString();
|
|
111
|
+
return qs ? `?${qs}` : "";
|
|
112
|
+
}
|
|
103
113
|
function skillPath(path) {
|
|
104
114
|
return path
|
|
105
115
|
.split("/")
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VolumesResource = void 0;
|
|
4
|
-
const query_js_1 = require("../internal/query.js");
|
|
5
4
|
class VolumesResource {
|
|
6
5
|
http;
|
|
7
6
|
constructor(http) {
|
|
8
7
|
this.http = http;
|
|
9
8
|
}
|
|
10
9
|
list(params = {}, options) {
|
|
11
|
-
return this.http.request("GET", `/v1/volumes${
|
|
10
|
+
return this.http.request("GET", `/v1/volumes${buildQuery({
|
|
11
|
+
limit: params.limit,
|
|
12
|
+
page_token: params.page_token,
|
|
13
|
+
user_id: params.user_id,
|
|
14
|
+
})}`, undefined, options);
|
|
12
15
|
}
|
|
13
16
|
create(params = {}, options) {
|
|
14
17
|
return this.http.request("POST", "/v1/volumes", params, options);
|
|
@@ -23,14 +26,14 @@ class VolumesResource {
|
|
|
23
26
|
return this.http.requestVoid("DELETE", `/v1/volumes/${encodeURIComponent(volumeID)}`, options);
|
|
24
27
|
}
|
|
25
28
|
listEntries(volumeID, params = {}, options) {
|
|
26
|
-
return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/entries${
|
|
29
|
+
return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/entries${buildQuery({
|
|
27
30
|
path: params.path,
|
|
28
31
|
limit: params.limit,
|
|
29
32
|
page_token: params.page_token,
|
|
30
33
|
})}`, undefined, options);
|
|
31
34
|
}
|
|
32
35
|
searchEntries(volumeID, params, options) {
|
|
33
|
-
return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/search${
|
|
36
|
+
return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/search${buildQuery({
|
|
34
37
|
query: params.query,
|
|
35
38
|
path: params.path,
|
|
36
39
|
limit: params.limit,
|
|
@@ -39,7 +42,7 @@ class VolumesResource {
|
|
|
39
42
|
}
|
|
40
43
|
readFile(volumeID, path, params = {}, options) {
|
|
41
44
|
const format = "format" in params ? params.format : undefined;
|
|
42
|
-
const url = `/v1/volumes/${encodeURIComponent(volumeID)}/files/${volumePath(path)}${
|
|
45
|
+
const url = `/v1/volumes/${encodeURIComponent(volumeID)}/files/${volumePath(path)}${buildQuery({
|
|
43
46
|
max_bytes: params.max_bytes,
|
|
44
47
|
format,
|
|
45
48
|
})}`;
|
|
@@ -69,7 +72,7 @@ class VolumesResource {
|
|
|
69
72
|
downloadArchive(volumeID, params = {}, options) {
|
|
70
73
|
const archivePath = normalizeArchivePath(params.path);
|
|
71
74
|
return this.http
|
|
72
|
-
.requestBinary("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/archive${
|
|
75
|
+
.requestBinary("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/archive${buildQuery({ path: archivePath || undefined })}`, options)
|
|
73
76
|
.then(({ body, headers }) => ({
|
|
74
77
|
path: archivePath,
|
|
75
78
|
content: body,
|
|
@@ -77,20 +80,20 @@ class VolumesResource {
|
|
|
77
80
|
}));
|
|
78
81
|
}
|
|
79
82
|
summarize(volumeID, params = {}, options) {
|
|
80
|
-
return this.http.request("POST", `/v1/volumes/${encodeURIComponent(volumeID)}/summarize`, params, options);
|
|
83
|
+
return this.http.request("POST", `/v1/volumes/${encodeURIComponent(volumeID)}/summarize`, { path: params.path }, options);
|
|
81
84
|
}
|
|
82
85
|
readLines(volumeID, path, params, options) {
|
|
83
|
-
return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/file_lines/${volumePath(path)}${
|
|
86
|
+
return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/file_lines/${volumePath(path)}${buildQuery({
|
|
84
87
|
start_line: params.start_line,
|
|
85
88
|
end_line: params.end_line,
|
|
86
89
|
max_bytes: params.max_bytes,
|
|
87
90
|
})}`, undefined, options);
|
|
88
91
|
}
|
|
89
92
|
patchLines(volumeID, path, params, options) {
|
|
90
|
-
return this.http.request("PATCH", `/v1/volumes/${encodeURIComponent(volumeID)}/file_lines/${volumePath(path)}`, params, options);
|
|
93
|
+
return this.http.request("PATCH", `/v1/volumes/${encodeURIComponent(volumeID)}/file_lines/${volumePath(path)}`, { start_line: params.start_line, end_line: params.end_line, replacement: params.replacement }, options);
|
|
91
94
|
}
|
|
92
95
|
grep(volumeID, params, options) {
|
|
93
|
-
return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/grep${
|
|
96
|
+
return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/grep${buildQuery({
|
|
94
97
|
pattern: params.pattern,
|
|
95
98
|
path: params.path,
|
|
96
99
|
limit: params.limit,
|
|
@@ -99,6 +102,16 @@ class VolumesResource {
|
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
exports.VolumesResource = VolumesResource;
|
|
105
|
+
function buildQuery(values) {
|
|
106
|
+
const search = new URLSearchParams();
|
|
107
|
+
for (const [key, value] of Object.entries(values)) {
|
|
108
|
+
if (value !== undefined && value !== "") {
|
|
109
|
+
search.set(key, String(value));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const qs = search.toString();
|
|
113
|
+
return qs ? `?${qs}` : "";
|
|
114
|
+
}
|
|
102
115
|
function volumePath(path) {
|
|
103
116
|
return path
|
|
104
117
|
.split("/")
|
package/dist-cjs/version.js
CHANGED