Skip to content

Commit 898bd96

Browse files
feat(api): manual updates
1 parent 0c471b5 commit 898bd96

File tree

9 files changed

+163
-2
lines changed

9 files changed

+163
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 12
1+
configured_endpoints: 14
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta%2Fwarp-api-91a7db62ba0752b9bdccd4bac4c6d09c1d59b7b69788159fe13598b7a5def7ee.yml
33
openapi_spec_hash: f03a889deaf6df14d678643be1e4dbe3
4-
config_hash: 433e7a5579323a048aa173a0ace06bfc
4+
config_hash: 25c1059aa958c8c2ad60ef16c318514d

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ Types:
88
- <code><a href="./src/resources/agent/agent.ts">McpServerConfig</a></code>
99
- <code><a href="./src/resources/agent/agent.ts">UserProfile</a></code>
1010
- <code><a href="./src/resources/agent/agent.ts">AgentListResponse</a></code>
11+
- <code><a href="./src/resources/agent/agent.ts">AgentGetArtifactResponse</a></code>
1112
- <code><a href="./src/resources/agent/agent.ts">AgentRunResponse</a></code>
1213

1314
Methods:
1415

1516
- <code title="get /agent">client.agent.<a href="./src/resources/agent/agent.ts">list</a>({ ...params }) -> AgentListResponse</code>
17+
- <code title="get /agent/artifacts/{artifactUid}">client.agent.<a href="./src/resources/agent/agent.ts">getArtifact</a>(artifactUid) -> AgentGetArtifactResponse</code>
1618
- <code title="post /agent/run">client.agent.<a href="./src/resources/agent/agent.ts">run</a>({ ...params }) -> AgentRunResponse</code>
1719

1820
## Runs
@@ -49,3 +51,13 @@ Methods:
4951
- <code title="delete /agent/schedules/{scheduleId}">client.agent.schedules.<a href="./src/resources/agent/schedules.ts">delete</a>(scheduleID) -> ScheduleDeleteResponse</code>
5052
- <code title="post /agent/schedules/{scheduleId}/pause">client.agent.schedules.<a href="./src/resources/agent/schedules.ts">pause</a>(scheduleID) -> ScheduledAgentItem</code>
5153
- <code title="post /agent/schedules/{scheduleId}/resume">client.agent.schedules.<a href="./src/resources/agent/schedules.ts">resume</a>(scheduleID) -> ScheduledAgentItem</code>
54+
55+
## Sessions
56+
57+
Types:
58+
59+
- <code><a href="./src/resources/agent/sessions.ts">SessionCheckRedirectResponse</a></code>
60+
61+
Methods:
62+
63+
- <code title="get /agent/sessions/{sessionUuid}/redirect">client.agent.sessions.<a href="./src/resources/agent/sessions.ts">checkRedirect</a>(sessionUuid) -> SessionCheckRedirectResponse</code>

src/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import * as API from './resources/index';
1919
import { APIPromise } from './core/api-promise';
2020
import {
2121
Agent,
22+
AgentGetArtifactResponse,
2223
AgentListParams,
2324
AgentListResponse,
2425
AgentRunParams,
@@ -742,6 +743,7 @@ export declare namespace OzAPI {
742743
type McpServerConfig as McpServerConfig,
743744
type UserProfile as UserProfile,
744745
type AgentListResponse as AgentListResponse,
746+
type AgentGetArtifactResponse as AgentGetArtifactResponse,
745747
type AgentRunResponse as AgentRunResponse,
746748
type AgentListParams as AgentListParams,
747749
type AgentRunParams as AgentRunParams,

src/resources/agent/agent.ts

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ import {
2121
ScheduledAgentItem,
2222
Schedules,
2323
} from './schedules';
24+
import * as SessionsAPI from './sessions';
25+
import { SessionCheckRedirectResponse, Sessions } from './sessions';
2426
import { APIPromise } from '../../core/api-promise';
2527
import { RequestOptions } from '../../internal/request-options';
28+
import { path } from '../../internal/utils/path';
2629

2730
export class Agent extends APIResource {
2831
runs: RunsAPI.Runs = new RunsAPI.Runs(this._client);
2932
schedules: SchedulesAPI.Schedules = new SchedulesAPI.Schedules(this._client);
33+
sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client);
3034

3135
/**
3236
* Retrieve a list of available agents (skills) that can be used to run tasks.
@@ -44,6 +48,21 @@ export class Agent extends APIResource {
4448
return this._client.get('/agent', { query, ...options });
4549
}
4650

51+
/**
52+
* Retrieve an artifact by its UUID. For screenshot artifacts, returns a
53+
* time-limited signed download URL.
54+
*
55+
* @example
56+
* ```ts
57+
* const response = await client.agent.getArtifact(
58+
* 'artifactUid',
59+
* );
60+
* ```
61+
*/
62+
getArtifact(artifactUid: string, options?: RequestOptions): APIPromise<AgentGetArtifactResponse> {
63+
return this._client.get(path`/agent/artifacts/${artifactUid}`, options);
64+
}
65+
4766
/**
4867
* Spawn a cloud agent with a prompt and optional configuration. The agent will be
4968
* queued for execution and assigned a unique run ID.
@@ -302,6 +321,58 @@ export interface AgentListResponse {
302321
agents: Array<AgentSkill>;
303322
}
304323

324+
/**
325+
* Response for artifact retrieval. Currently supports screenshot artifacts.
326+
*/
327+
export interface AgentGetArtifactResponse {
328+
/**
329+
* Type of the artifact (e.g., SCREENSHOT)
330+
*/
331+
artifact_type: string;
332+
333+
/**
334+
* Unique identifier (UUID) for the artifact
335+
*/
336+
artifact_uid: string;
337+
338+
/**
339+
* Timestamp when the artifact was created (RFC3339)
340+
*/
341+
created_at: string;
342+
343+
/**
344+
* Response data for a screenshot artifact, including a signed download URL.
345+
*/
346+
data: AgentGetArtifactResponse.Data;
347+
}
348+
349+
export namespace AgentGetArtifactResponse {
350+
/**
351+
* Response data for a screenshot artifact, including a signed download URL.
352+
*/
353+
export interface Data {
354+
/**
355+
* MIME type of the screenshot (e.g., image/png)
356+
*/
357+
content_type: string;
358+
359+
/**
360+
* Time-limited signed URL to download the screenshot
361+
*/
362+
download_url: string;
363+
364+
/**
365+
* Timestamp when the download URL expires (RFC3339)
366+
*/
367+
expires_at: string;
368+
369+
/**
370+
* Optional description of the screenshot
371+
*/
372+
description?: string;
373+
}
374+
}
375+
305376
export interface AgentRunResponse {
306377
/**
307378
* Unique identifier for the created run
@@ -427,6 +498,7 @@ export namespace AgentRunParams {
427498

428499
Agent.Runs = Runs;
429500
Agent.Schedules = Schedules;
501+
Agent.Sessions = Sessions;
430502

431503
export declare namespace Agent {
432504
export {
@@ -436,6 +508,7 @@ export declare namespace Agent {
436508
type McpServerConfig as McpServerConfig,
437509
type UserProfile as UserProfile,
438510
type AgentListResponse as AgentListResponse,
511+
type AgentGetArtifactResponse as AgentGetArtifactResponse,
439512
type AgentRunResponse as AgentRunResponse,
440513
type AgentListParams as AgentListParams,
441514
type AgentRunParams as AgentRunParams,
@@ -460,4 +533,6 @@ export declare namespace Agent {
460533
type ScheduleCreateParams as ScheduleCreateParams,
461534
type ScheduleUpdateParams as ScheduleUpdateParams,
462535
};
536+
537+
export { Sessions as Sessions, type SessionCheckRedirectResponse as SessionCheckRedirectResponse };
463538
}

src/resources/agent/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export {
88
type McpServerConfig,
99
type UserProfile,
1010
type AgentListResponse,
11+
type AgentGetArtifactResponse,
1112
type AgentRunResponse,
1213
type AgentListParams,
1314
type AgentRunParams,
@@ -30,3 +31,4 @@ export {
3031
type ScheduleCreateParams,
3132
type ScheduleUpdateParams,
3233
} from './schedules';
34+
export { Sessions, type SessionCheckRedirectResponse } from './sessions';

src/resources/agent/sessions.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../../core/resource';
4+
import { APIPromise } from '../../core/api-promise';
5+
import { RequestOptions } from '../../internal/request-options';
6+
import { path } from '../../internal/utils/path';
7+
8+
export class Sessions extends APIResource {
9+
/**
10+
* Check whether a shared session should redirect to a conversation transcript.
11+
* Returns a conversation_id if the agent sandbox has finished and conversation
12+
* data is available, or an empty object if no redirect is needed.
13+
*
14+
* @example
15+
* ```ts
16+
* const response = await client.agent.sessions.checkRedirect(
17+
* 'sessionUuid',
18+
* );
19+
* ```
20+
*/
21+
checkRedirect(sessionUuid: string, options?: RequestOptions): APIPromise<SessionCheckRedirectResponse> {
22+
return this._client.get(path`/agent/sessions/${sessionUuid}/redirect`, options);
23+
}
24+
}
25+
26+
export interface SessionCheckRedirectResponse {
27+
/**
28+
* The conversation ID to redirect to (only present when redirect is needed)
29+
*/
30+
conversation_id?: string;
31+
}
32+
33+
export declare namespace Sessions {
34+
export { type SessionCheckRedirectResponse as SessionCheckRedirectResponse };
35+
}

src/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export {
88
type McpServerConfig,
99
type UserProfile,
1010
type AgentListResponse,
11+
type AgentGetArtifactResponse,
1112
type AgentRunResponse,
1213
type AgentListParams,
1314
type AgentRunParams,

tests/api-resources/agent/agent.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ describe('resource agent', () => {
3535
).rejects.toThrow(OzAPI.NotFoundError);
3636
});
3737

38+
// Mock server tests are disabled
39+
test.skip('getArtifact', async () => {
40+
const responsePromise = client.agent.getArtifact('artifactUid');
41+
const rawResponse = await responsePromise.asResponse();
42+
expect(rawResponse).toBeInstanceOf(Response);
43+
const response = await responsePromise;
44+
expect(response).not.toBeInstanceOf(Response);
45+
const dataAndResponse = await responsePromise.withResponse();
46+
expect(dataAndResponse.data).toBe(response);
47+
expect(dataAndResponse.response).toBe(rawResponse);
48+
});
49+
3850
// Mock server tests are disabled
3951
test.skip('run', async () => {
4052
const responsePromise = client.agent.run({});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import OzAPI from 'oz-agent-sdk';
4+
5+
const client = new OzAPI({
6+
apiKey: 'My API Key',
7+
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
8+
});
9+
10+
describe('resource sessions', () => {
11+
// Mock server tests are disabled
12+
test.skip('checkRedirect', async () => {
13+
const responsePromise = client.agent.sessions.checkRedirect('sessionUuid');
14+
const rawResponse = await responsePromise.asResponse();
15+
expect(rawResponse).toBeInstanceOf(Response);
16+
const response = await responsePromise;
17+
expect(response).not.toBeInstanceOf(Response);
18+
const dataAndResponse = await responsePromise.withResponse();
19+
expect(dataAndResponse.data).toBe(response);
20+
expect(dataAndResponse.response).toBe(rawResponse);
21+
});
22+
});

0 commit comments

Comments
 (0)