@agent-api/sdk 1.0.1 → 1.0.2

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog — @agent-api/sdk
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Added
6
+
7
+ - `user` on create-run params; `input_document` content parts in TypeScript types.
8
+ - `response.requires_action` in streaming event types.
9
+ - `readFile(..., { format: "raw" })` for binary volume files (`VolumeFileRaw` with `ArrayBuffer` content).
10
+ - Route manifest coverage for volume rename, usage reconcile, and directory create/delete.
11
+
12
+ ### Fixed
13
+
14
+ - README and route manifest now list all volume resource methods implemented since 1.0.1.
15
+
3
16
  ## 1.0.1
4
17
 
5
18
  ### Added
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Production JavaScript/TypeScript SDK for the Managed Agent API.
4
4
 
5
- **Published on npm:** [`@agent-api/sdk`](https://www.npmjs.com/package/@agent-api/sdk) (v1.0.1)
5
+ **Published on npm:** [`@agent-api/sdk`](https://www.npmjs.com/package/@agent-api/sdk) (v1.0.2)
6
6
 
7
7
  ## Install
8
8
 
@@ -59,7 +59,7 @@ src/
59
59
  | `client.models` | `list` |
60
60
  | `client.presets` | `list` |
61
61
  | `client.tools` | `list` |
62
- | `client.volumes` | `list`, `create`, `retrieve`, `delete`, `listEntries`, `searchEntries`, `readFile`, `writeFile`, `deleteFile` |
62
+ | `client.volumes` | `list`, `create`, `retrieve`, `update`, `delete`, `listEntries`, `searchEntries`, `readFile`, `writeFile`, `deleteFile`, `reconcileUsage`, `createDirectory`, `deleteDirectory` |
63
63
 
64
64
  ## Durable Volumes
65
65
 
@@ -68,6 +68,7 @@ const volume = await client.volumes.create({ name: "research-notes" });
68
68
 
69
69
  await client.volumes.writeFile(volume.volume_id, "notes/summary.md", "# Summary\n");
70
70
  const file = await client.volumes.readFile(volume.volume_id, "notes/summary.md");
71
+ const binary = await client.volumes.readFile(volume.volume_id, "assets/logo.png", { format: "raw" });
71
72
 
72
73
  const response = await client.agent.create({
73
74
  preset: "pro-search",
@@ -14,6 +14,10 @@ export declare class HTTPClient {
14
14
  request<T>(method: string, path: string, body?: unknown, options?: RequestOptions): Promise<T>;
15
15
  requestRaw<T>(method: string, path: string, body: BodyInit, options?: RequestOptions): Promise<T>;
16
16
  requestVoid(method: string, path: string, options?: RequestOptions): Promise<void>;
17
+ requestBinary(method: string, path: string, options?: RequestOptions): Promise<{
18
+ body: ArrayBuffer;
19
+ headers: Headers;
20
+ }>;
17
21
  stream<T>(path: string, body: unknown, options?: RequestOptions): Promise<AsyncIterable<T>>;
18
22
  private fetchWithRetry;
19
23
  private fetchOnce;
@@ -17,6 +17,10 @@ export class HTTPClient {
17
17
  async requestVoid(method, path, options = {}) {
18
18
  await this.fetchWithRetry(method, path, undefined, options, false, false);
19
19
  }
20
+ async requestBinary(method, path, options = {}) {
21
+ const response = await this.fetchWithRetry(method, path, undefined, options, false, false);
22
+ return { body: await response.arrayBuffer(), headers: response.headers };
23
+ }
20
24
  async stream(path, body, options = {}) {
21
25
  const response = await this.fetchWithRetry("POST", path, body, options, true, false);
22
26
  return parseSSE(response);
@@ -1,16 +1,25 @@
1
1
  import type { HTTPClient } from "../internal/http.js";
2
2
  import type { RequestOptions } from "../types/common.js";
3
- import type { CreateVolumeParams, ListVolumeEntriesParams, ListVolumeEntriesResponse, ListVolumesParams, ListVolumesResponse, ReadVolumeFileParams, SearchVolumeEntriesParams, VolumeFileRead, VolumeFileWrite, VolumeInfo } from "../types/volumes.js";
3
+ import type { CreateVolumeParams, ListVolumeEntriesParams, ListVolumeEntriesResponse, ListVolumesParams, ListVolumesResponse, ReadVolumeFileParams, ReadVolumeFileRawParams, SearchVolumeEntriesParams, VolumeFileRead, VolumeFileRaw, VolumeFileWrite, VolumeInfo } 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
13
  delete(volumeID: string, options?: RequestOptions): Promise<void>;
11
14
  listEntries(volumeID: string, params?: ListVolumeEntriesParams, options?: RequestOptions): Promise<ListVolumeEntriesResponse>;
12
15
  searchEntries(volumeID: string, params: SearchVolumeEntriesParams, options?: RequestOptions): Promise<ListVolumeEntriesResponse>;
16
+ readFile(volumeID: string, path: string, params: ReadVolumeFileRawParams, options?: RequestOptions): Promise<VolumeFileRaw>;
13
17
  readFile(volumeID: string, path: string, params?: ReadVolumeFileParams, options?: RequestOptions): Promise<VolumeFileRead>;
14
18
  writeFile(volumeID: string, path: string, content: string | ArrayBuffer | Blob, options?: RequestOptions): Promise<VolumeFileWrite>;
15
19
  deleteFile(volumeID: string, path: string, options?: RequestOptions): Promise<void>;
20
+ reconcileUsage(volumeID: string, options?: RequestOptions): Promise<VolumeInfo>;
21
+ createDirectory(volumeID: string, path: string, options?: RequestOptions): Promise<{
22
+ path: string;
23
+ }>;
24
+ deleteDirectory(volumeID: string, path: string, options?: RequestOptions): Promise<void>;
16
25
  }
@@ -13,6 +13,9 @@ export class VolumesResource {
13
13
  retrieve(volumeID, options) {
14
14
  return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}`, undefined, options);
15
15
  }
16
+ update(volumeID, params, options) {
17
+ return this.http.request("PATCH", `/v1/volumes/${encodeURIComponent(volumeID)}`, params, options);
18
+ }
16
19
  delete(volumeID, options) {
17
20
  return this.http.requestVoid("DELETE", `/v1/volumes/${encodeURIComponent(volumeID)}`, options);
18
21
  }
@@ -32,9 +35,20 @@ export class VolumesResource {
32
35
  })}`, undefined, options);
33
36
  }
34
37
  readFile(volumeID, path, params = {}, options) {
35
- return this.http.request("GET", `/v1/volumes/${encodeURIComponent(volumeID)}/files/${volumePath(path)}${buildQuery({
38
+ const url = `/v1/volumes/${encodeURIComponent(volumeID)}/files/${volumePath(path)}${buildQuery({
36
39
  max_bytes: params.max_bytes,
37
- })}`, undefined, options);
40
+ format: params.format,
41
+ })}`;
42
+ if (params.format === "raw") {
43
+ return this.http.requestBinary("GET", url, options).then(({ body, headers }) => ({
44
+ path,
45
+ size: Number(headers.get("X-Volume-Size") ?? body.byteLength),
46
+ truncated: headers.get("X-Volume-Truncated") === "true",
47
+ content: body,
48
+ content_type: headers.get("Content-Type") ?? undefined,
49
+ }));
50
+ }
51
+ return this.http.request("GET", url, undefined, options);
38
52
  }
39
53
  writeFile(volumeID, path, content, options) {
40
54
  return this.http.requestRaw("PUT", `/v1/volumes/${encodeURIComponent(volumeID)}/files/${volumePath(path)}`, content, options);
@@ -42,6 +56,15 @@ export class VolumesResource {
42
56
  deleteFile(volumeID, path, options) {
43
57
  return this.http.requestVoid("DELETE", `/v1/volumes/${encodeURIComponent(volumeID)}/files/${volumePath(path)}`, options);
44
58
  }
59
+ reconcileUsage(volumeID, options) {
60
+ return this.http.request("POST", `/v1/volumes/${encodeURIComponent(volumeID)}/usage/reconcile`, undefined, options);
61
+ }
62
+ createDirectory(volumeID, path, options) {
63
+ return this.http.request("POST", `/v1/volumes/${encodeURIComponent(volumeID)}/directories`, { path }, options);
64
+ }
65
+ deleteDirectory(volumeID, path, options) {
66
+ return this.http.requestVoid("DELETE", `/v1/volumes/${encodeURIComponent(volumeID)}/directories/${volumePath(path)}`, options);
67
+ }
45
68
  }
46
69
  function volumePath(path) {
47
70
  return path
@@ -6,9 +6,12 @@ export interface Annotation {
6
6
  end_index?: number;
7
7
  }
8
8
  export interface ContentPart {
9
- type: "input_text" | "output_text" | "input_image";
9
+ type: "input_text" | "output_text" | "input_image" | "input_document";
10
10
  text?: string;
11
11
  image_url?: string;
12
+ mime_type?: string;
13
+ filename?: string;
14
+ document_url?: string;
12
15
  annotations?: Annotation[];
13
16
  logprobs?: unknown[];
14
17
  }
@@ -23,6 +23,7 @@ export interface ResponseCreateParamsBase {
23
23
  memory?: MemoryOptions;
24
24
  plan_mode_preference?: AgentCapabilityPreference;
25
25
  sub_agent_preference?: AgentCapabilityPreference;
26
+ user?: string;
26
27
  stream?: boolean;
27
28
  }
28
29
  export interface ResponseCreateParamsNonStreaming extends ResponseCreateParamsBase {
@@ -17,7 +17,7 @@ export interface ResponseModelCallEvent {
17
17
  model_chain?: string[];
18
18
  attempt_count?: number;
19
19
  }
20
- export type ResponseStreamEventType = "response.created" | "response.in_progress" | "response.completed" | "response.failed" | "response.plan.updated" | "response.output_item.added" | "response.output_item.done" | "response.output_text.delta" | "response.output_text.done" | "response.reasoning.started" | "response.reasoning.search_queries" | "response.reasoning.search_results" | "response.reasoning.fetch_url_queries" | "response.reasoning.fetch_url_results" | "response.reasoning.stopped" | "response.tool.invocation.completed" | "response.step.completed" | "response.step.failed" | "response.step.skipped" | "response.model.requested" | "response.model.completed" | "response.model.failed";
20
+ export type ResponseStreamEventType = "response.created" | "response.in_progress" | "response.completed" | "response.failed" | "response.requires_action" | "response.plan.updated" | "response.output_item.added" | "response.output_item.done" | "response.output_text.delta" | "response.output_text.done" | "response.reasoning.started" | "response.reasoning.search_queries" | "response.reasoning.search_results" | "response.reasoning.fetch_url_queries" | "response.reasoning.fetch_url_results" | "response.reasoning.stopped" | "response.tool.invocation.completed" | "response.step.completed" | "response.step.failed" | "response.step.skipped" | "response.model.requested" | "response.model.completed" | "response.model.failed";
21
21
  export interface ResponseStreamEvent {
22
22
  type: ResponseStreamEventType;
23
23
  sequence_number: number;
@@ -3,6 +3,9 @@ export interface VolumeInfo {
3
3
  tenant_id?: string;
4
4
  name?: string;
5
5
  oss_prefix?: string;
6
+ bytes_used?: number;
7
+ object_count?: number;
8
+ usage_reconciled_at_unix?: number;
6
9
  created_at_unix?: number;
7
10
  updated_at_unix?: number;
8
11
  }
@@ -39,6 +42,11 @@ export interface ListVolumeEntriesResponse {
39
42
  }
40
43
  export interface ReadVolumeFileParams {
41
44
  max_bytes?: number;
45
+ format?: "json";
46
+ }
47
+ export interface ReadVolumeFileRawParams {
48
+ max_bytes?: number;
49
+ format: "raw";
42
50
  }
43
51
  export interface VolumeFileRead {
44
52
  path: string;
@@ -46,6 +54,13 @@ export interface VolumeFileRead {
46
54
  truncated: boolean;
47
55
  content: string;
48
56
  }
57
+ export interface VolumeFileRaw {
58
+ path: string;
59
+ size: number;
60
+ truncated: boolean;
61
+ content: ArrayBuffer;
62
+ content_type?: string;
63
+ }
49
64
  export interface VolumeFileWrite {
50
65
  path: string;
51
66
  size: number;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.0.1";
2
- export declare const USER_AGENT = "@agent-api/sdk/1.0.1";
1
+ export declare const VERSION = "1.0.2";
2
+ export declare const USER_AGENT = "@agent-api/sdk/1.0.2";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = "1.0.1";
1
+ export const VERSION = "1.0.2";
2
2
  export const USER_AGENT = `@agent-api/sdk/${VERSION}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-api/sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Production JavaScript SDK for the Managed Agent API",
5
5
  "license": "MIT",
6
6
  "repository": {