@qoniai/qoni 0.4.3 → 0.5.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 +19 -0
- package/README.md +26 -0
- package/README.zh-CN.md +25 -0
- package/dist/index.cjs +82 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +82 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -601,6 +601,10 @@ interface Artifact {
|
|
|
601
601
|
mime?: string;
|
|
602
602
|
sizeBytes?: number;
|
|
603
603
|
createdAt?: string;
|
|
604
|
+
/** Temporary signed storage URL; refresh after expiry. */
|
|
605
|
+
downloadUrl?: string;
|
|
606
|
+
expiresIn?: number;
|
|
607
|
+
refreshDownloadUrl?(): Promise<string>;
|
|
604
608
|
content(): Promise<Uint8Array>;
|
|
605
609
|
}
|
|
606
610
|
/** Settled outcome of `run.wait()`. */
|
|
@@ -735,6 +739,15 @@ interface SnapshotAction {
|
|
|
735
739
|
interface RunLimits {
|
|
736
740
|
maxDurationMinutes?: number;
|
|
737
741
|
}
|
|
742
|
+
type BrowserbaseRegion = "us-west-2" | "us-east-1" | "eu-central-1" | "ap-southeast-1";
|
|
743
|
+
interface BrowserProxyOptions {
|
|
744
|
+
/** Server-side proxy registry id. Credentials never enter the SDK call. */
|
|
745
|
+
proxyId?: string;
|
|
746
|
+
/** `off` uses datacenter egress; `all` proxies all requests; `scoped` uses admin patterns. */
|
|
747
|
+
mode?: "off" | "all" | "scoped";
|
|
748
|
+
/** Browserbase compute region. This is separate from the proxy's IP geography. */
|
|
749
|
+
region?: BrowserbaseRegion;
|
|
750
|
+
}
|
|
738
751
|
interface DoAnythingRunOptions {
|
|
739
752
|
/** Delegation token — passed once here; the returned handle holds it. */
|
|
740
753
|
token: string;
|
|
@@ -748,6 +761,8 @@ interface DoAnythingRunOptions {
|
|
|
748
761
|
*/
|
|
749
762
|
session?: SessionRef;
|
|
750
763
|
profileId?: string;
|
|
764
|
+
/** Applies when this run creates a new Browserbase session. */
|
|
765
|
+
browserProxy?: BrowserProxyOptions;
|
|
751
766
|
keepAlive?: boolean;
|
|
752
767
|
allowedActions?: string[];
|
|
753
768
|
skills?: string[];
|
|
@@ -772,6 +787,10 @@ declare function createDoAnythingNamespace(transport: QoniTransport): {
|
|
|
772
787
|
* not supplied.
|
|
773
788
|
*/
|
|
774
789
|
attach: (runId: string, opts: DoAnythingAttachOptions) => Promise<RunHandle<DoAnythingEvent>>;
|
|
790
|
+
artifacts: (input: RuntimeTokenInput & {
|
|
791
|
+
runId: string;
|
|
792
|
+
signal?: AbortSignal;
|
|
793
|
+
}) => Promise<Artifact[]>;
|
|
775
794
|
api: {
|
|
776
795
|
createSession: <T = unknown>(input: RuntimeTokenInput & JsonObject) => Promise<QoniResponse<T>>;
|
|
777
796
|
/**
|
|
@@ -817,6 +836,18 @@ declare function createDoAnythingNamespace(transport: QoniTransport): {
|
|
|
817
836
|
sessionId: string;
|
|
818
837
|
artifactId: string;
|
|
819
838
|
}) => Promise<QoniResponse<T>>;
|
|
839
|
+
listArtifacts: <T = {
|
|
840
|
+
items: JsonObject[];
|
|
841
|
+
}>(input: RuntimeTokenInput & {
|
|
842
|
+
runId: string;
|
|
843
|
+
signal?: AbortSignal;
|
|
844
|
+
}) => Promise<QoniResponse<T>>;
|
|
845
|
+
artifactDownloadUrl: (input: RuntimeTokenInput & {
|
|
846
|
+
artifactId: string;
|
|
847
|
+
}) => Promise<QoniResponse<{
|
|
848
|
+
download_url: string;
|
|
849
|
+
expires_in: number;
|
|
850
|
+
}>>;
|
|
820
851
|
readRecording: <T = unknown>(input: RuntimeTokenInput & {
|
|
821
852
|
sessionId: string;
|
|
822
853
|
}) => Promise<QoniResponse<T>>;
|
|
@@ -1364,4 +1395,4 @@ declare const QoniScopeBundles: {
|
|
|
1364
1395
|
readonly TRACK: readonly ["webagent.track:read", "webagent.track:manage"];
|
|
1365
1396
|
};
|
|
1366
1397
|
|
|
1367
|
-
export { type Action, type ActionKind, ActionKinds, type Artifact, type CaptureOptions, type ClarificationPayload, type CompleteDelegateAgentInput, type CompleteDelegateTokenInput, type ConfirmationPayload, type CoreRunEvent, type DeepResearchAttachOptions, type DeepResearchEvent, type DeepResearchRunOptions, type DelegateAgentInput, type DelegateAgentResponse, type DelegateAgentTokenResponse, type DelegateTokenInput, type DelegateTokenInteractiveInput, type DelegateTokenResponse, type DelegateTokenResult, type DelegateTokenSilentInput, type DelegateTokenSilentResponse, type DelegationMode, type DelegationTokenResponse, type DoAnythingAttachOptions, type DoAnythingEvent, type DoAnythingRunOptions, type DoAnythingSnapshot, type GenAuthAccessTokenInput, type GenAuthAdminToken, type GenAuthAdminTokenOverrideInput, type GenAuthDelegationIntrospectionInput, type GenAuthUserCreateBatchInput, type GenAuthUserCreateInput, type GenAuthUserDeleteBatchInput, type GenAuthUserGetBatchInput, type GenAuthUserGetInput, type GenAuthUserListInput, type GenAuthUserUpdateInput, type Interaction, type InteractionEvidence, InteractionHandle, type InteractionPayloadByType, type InteractionSite, type InteractionStatus, InteractionStatuses, type InteractionType, InteractionTypes, type InteractiveDelegationResponse, type JsonObject, type MonitorEvent, type MonitorEventsOptions, MonitorHandle, type MonitorRunsOptions, Qoni, QoniAuthError, QoniDelegationRequiredError, QoniError, type QoniErrorCode, type QoniErrorOptions, type QoniEvent, type QoniEventType, QoniEventTypes, type QoniMeta, type QoniOptions, QoniPermissionDeniedError, type QoniProduct, type QoniProductName, QoniProductScopes, QoniRateLimitError, type QoniResponse, type QoniRuntimeConfig, type QoniSSEEvent, QoniScopeBundles, QoniScopes, QoniTimeoutError, QoniTokenExpiredError, QoniUpstreamError, QoniValidationError, type RawRequestInput, type RunDoneData, type RunEvent, type RunEventsOptions, RunHandle, type RunImage, type RunLimits, type RunMessageData, type RunReconnectInfo, type RunResult, type RunScreenshotData, type RunStatus, type RunWaitOptions, type RuntimeTokenInput, type SessionRef, type SiteLoginPayload, type SnapshotAction, type SnapshotImage, type TakeControlPayload, type TokenInput, type TrackAttachOptions, type TrackCreateOptions, type WaitKind, type WaitPayload, type WebSearchAttachOptions, type WebSearchEvent, type WebSearchRunOptions, buildAuthorization, buildSignature, buildStringToSign };
|
|
1398
|
+
export { type Action, type ActionKind, ActionKinds, type Artifact, type BrowserProxyOptions, type BrowserbaseRegion, type CaptureOptions, type ClarificationPayload, type CompleteDelegateAgentInput, type CompleteDelegateTokenInput, type ConfirmationPayload, type CoreRunEvent, type DeepResearchAttachOptions, type DeepResearchEvent, type DeepResearchRunOptions, type DelegateAgentInput, type DelegateAgentResponse, type DelegateAgentTokenResponse, type DelegateTokenInput, type DelegateTokenInteractiveInput, type DelegateTokenResponse, type DelegateTokenResult, type DelegateTokenSilentInput, type DelegateTokenSilentResponse, type DelegationMode, type DelegationTokenResponse, type DoAnythingAttachOptions, type DoAnythingEvent, type DoAnythingRunOptions, type DoAnythingSnapshot, type GenAuthAccessTokenInput, type GenAuthAdminToken, type GenAuthAdminTokenOverrideInput, type GenAuthDelegationIntrospectionInput, type GenAuthUserCreateBatchInput, type GenAuthUserCreateInput, type GenAuthUserDeleteBatchInput, type GenAuthUserGetBatchInput, type GenAuthUserGetInput, type GenAuthUserListInput, type GenAuthUserUpdateInput, type Interaction, type InteractionEvidence, InteractionHandle, type InteractionPayloadByType, type InteractionSite, type InteractionStatus, InteractionStatuses, type InteractionType, InteractionTypes, type InteractiveDelegationResponse, type JsonObject, type MonitorEvent, type MonitorEventsOptions, MonitorHandle, type MonitorRunsOptions, Qoni, QoniAuthError, QoniDelegationRequiredError, QoniError, type QoniErrorCode, type QoniErrorOptions, type QoniEvent, type QoniEventType, QoniEventTypes, type QoniMeta, type QoniOptions, QoniPermissionDeniedError, type QoniProduct, type QoniProductName, QoniProductScopes, QoniRateLimitError, type QoniResponse, type QoniRuntimeConfig, type QoniSSEEvent, QoniScopeBundles, QoniScopes, QoniTimeoutError, QoniTokenExpiredError, QoniUpstreamError, QoniValidationError, type RawRequestInput, type RunDoneData, type RunEvent, type RunEventsOptions, RunHandle, type RunImage, type RunLimits, type RunMessageData, type RunReconnectInfo, type RunResult, type RunScreenshotData, type RunStatus, type RunWaitOptions, type RuntimeTokenInput, type SessionRef, type SiteLoginPayload, type SnapshotAction, type SnapshotImage, type TakeControlPayload, type TokenInput, type TrackAttachOptions, type TrackCreateOptions, type WaitKind, type WaitPayload, type WebSearchAttachOptions, type WebSearchEvent, type WebSearchRunOptions, buildAuthorization, buildSignature, buildStringToSign };
|
package/dist/index.d.ts
CHANGED
|
@@ -601,6 +601,10 @@ interface Artifact {
|
|
|
601
601
|
mime?: string;
|
|
602
602
|
sizeBytes?: number;
|
|
603
603
|
createdAt?: string;
|
|
604
|
+
/** Temporary signed storage URL; refresh after expiry. */
|
|
605
|
+
downloadUrl?: string;
|
|
606
|
+
expiresIn?: number;
|
|
607
|
+
refreshDownloadUrl?(): Promise<string>;
|
|
604
608
|
content(): Promise<Uint8Array>;
|
|
605
609
|
}
|
|
606
610
|
/** Settled outcome of `run.wait()`. */
|
|
@@ -735,6 +739,15 @@ interface SnapshotAction {
|
|
|
735
739
|
interface RunLimits {
|
|
736
740
|
maxDurationMinutes?: number;
|
|
737
741
|
}
|
|
742
|
+
type BrowserbaseRegion = "us-west-2" | "us-east-1" | "eu-central-1" | "ap-southeast-1";
|
|
743
|
+
interface BrowserProxyOptions {
|
|
744
|
+
/** Server-side proxy registry id. Credentials never enter the SDK call. */
|
|
745
|
+
proxyId?: string;
|
|
746
|
+
/** `off` uses datacenter egress; `all` proxies all requests; `scoped` uses admin patterns. */
|
|
747
|
+
mode?: "off" | "all" | "scoped";
|
|
748
|
+
/** Browserbase compute region. This is separate from the proxy's IP geography. */
|
|
749
|
+
region?: BrowserbaseRegion;
|
|
750
|
+
}
|
|
738
751
|
interface DoAnythingRunOptions {
|
|
739
752
|
/** Delegation token — passed once here; the returned handle holds it. */
|
|
740
753
|
token: string;
|
|
@@ -748,6 +761,8 @@ interface DoAnythingRunOptions {
|
|
|
748
761
|
*/
|
|
749
762
|
session?: SessionRef;
|
|
750
763
|
profileId?: string;
|
|
764
|
+
/** Applies when this run creates a new Browserbase session. */
|
|
765
|
+
browserProxy?: BrowserProxyOptions;
|
|
751
766
|
keepAlive?: boolean;
|
|
752
767
|
allowedActions?: string[];
|
|
753
768
|
skills?: string[];
|
|
@@ -772,6 +787,10 @@ declare function createDoAnythingNamespace(transport: QoniTransport): {
|
|
|
772
787
|
* not supplied.
|
|
773
788
|
*/
|
|
774
789
|
attach: (runId: string, opts: DoAnythingAttachOptions) => Promise<RunHandle<DoAnythingEvent>>;
|
|
790
|
+
artifacts: (input: RuntimeTokenInput & {
|
|
791
|
+
runId: string;
|
|
792
|
+
signal?: AbortSignal;
|
|
793
|
+
}) => Promise<Artifact[]>;
|
|
775
794
|
api: {
|
|
776
795
|
createSession: <T = unknown>(input: RuntimeTokenInput & JsonObject) => Promise<QoniResponse<T>>;
|
|
777
796
|
/**
|
|
@@ -817,6 +836,18 @@ declare function createDoAnythingNamespace(transport: QoniTransport): {
|
|
|
817
836
|
sessionId: string;
|
|
818
837
|
artifactId: string;
|
|
819
838
|
}) => Promise<QoniResponse<T>>;
|
|
839
|
+
listArtifacts: <T = {
|
|
840
|
+
items: JsonObject[];
|
|
841
|
+
}>(input: RuntimeTokenInput & {
|
|
842
|
+
runId: string;
|
|
843
|
+
signal?: AbortSignal;
|
|
844
|
+
}) => Promise<QoniResponse<T>>;
|
|
845
|
+
artifactDownloadUrl: (input: RuntimeTokenInput & {
|
|
846
|
+
artifactId: string;
|
|
847
|
+
}) => Promise<QoniResponse<{
|
|
848
|
+
download_url: string;
|
|
849
|
+
expires_in: number;
|
|
850
|
+
}>>;
|
|
820
851
|
readRecording: <T = unknown>(input: RuntimeTokenInput & {
|
|
821
852
|
sessionId: string;
|
|
822
853
|
}) => Promise<QoniResponse<T>>;
|
|
@@ -1364,4 +1395,4 @@ declare const QoniScopeBundles: {
|
|
|
1364
1395
|
readonly TRACK: readonly ["webagent.track:read", "webagent.track:manage"];
|
|
1365
1396
|
};
|
|
1366
1397
|
|
|
1367
|
-
export { type Action, type ActionKind, ActionKinds, type Artifact, type CaptureOptions, type ClarificationPayload, type CompleteDelegateAgentInput, type CompleteDelegateTokenInput, type ConfirmationPayload, type CoreRunEvent, type DeepResearchAttachOptions, type DeepResearchEvent, type DeepResearchRunOptions, type DelegateAgentInput, type DelegateAgentResponse, type DelegateAgentTokenResponse, type DelegateTokenInput, type DelegateTokenInteractiveInput, type DelegateTokenResponse, type DelegateTokenResult, type DelegateTokenSilentInput, type DelegateTokenSilentResponse, type DelegationMode, type DelegationTokenResponse, type DoAnythingAttachOptions, type DoAnythingEvent, type DoAnythingRunOptions, type DoAnythingSnapshot, type GenAuthAccessTokenInput, type GenAuthAdminToken, type GenAuthAdminTokenOverrideInput, type GenAuthDelegationIntrospectionInput, type GenAuthUserCreateBatchInput, type GenAuthUserCreateInput, type GenAuthUserDeleteBatchInput, type GenAuthUserGetBatchInput, type GenAuthUserGetInput, type GenAuthUserListInput, type GenAuthUserUpdateInput, type Interaction, type InteractionEvidence, InteractionHandle, type InteractionPayloadByType, type InteractionSite, type InteractionStatus, InteractionStatuses, type InteractionType, InteractionTypes, type InteractiveDelegationResponse, type JsonObject, type MonitorEvent, type MonitorEventsOptions, MonitorHandle, type MonitorRunsOptions, Qoni, QoniAuthError, QoniDelegationRequiredError, QoniError, type QoniErrorCode, type QoniErrorOptions, type QoniEvent, type QoniEventType, QoniEventTypes, type QoniMeta, type QoniOptions, QoniPermissionDeniedError, type QoniProduct, type QoniProductName, QoniProductScopes, QoniRateLimitError, type QoniResponse, type QoniRuntimeConfig, type QoniSSEEvent, QoniScopeBundles, QoniScopes, QoniTimeoutError, QoniTokenExpiredError, QoniUpstreamError, QoniValidationError, type RawRequestInput, type RunDoneData, type RunEvent, type RunEventsOptions, RunHandle, type RunImage, type RunLimits, type RunMessageData, type RunReconnectInfo, type RunResult, type RunScreenshotData, type RunStatus, type RunWaitOptions, type RuntimeTokenInput, type SessionRef, type SiteLoginPayload, type SnapshotAction, type SnapshotImage, type TakeControlPayload, type TokenInput, type TrackAttachOptions, type TrackCreateOptions, type WaitKind, type WaitPayload, type WebSearchAttachOptions, type WebSearchEvent, type WebSearchRunOptions, buildAuthorization, buildSignature, buildStringToSign };
|
|
1398
|
+
export { type Action, type ActionKind, ActionKinds, type Artifact, type BrowserProxyOptions, type BrowserbaseRegion, type CaptureOptions, type ClarificationPayload, type CompleteDelegateAgentInput, type CompleteDelegateTokenInput, type ConfirmationPayload, type CoreRunEvent, type DeepResearchAttachOptions, type DeepResearchEvent, type DeepResearchRunOptions, type DelegateAgentInput, type DelegateAgentResponse, type DelegateAgentTokenResponse, type DelegateTokenInput, type DelegateTokenInteractiveInput, type DelegateTokenResponse, type DelegateTokenResult, type DelegateTokenSilentInput, type DelegateTokenSilentResponse, type DelegationMode, type DelegationTokenResponse, type DoAnythingAttachOptions, type DoAnythingEvent, type DoAnythingRunOptions, type DoAnythingSnapshot, type GenAuthAccessTokenInput, type GenAuthAdminToken, type GenAuthAdminTokenOverrideInput, type GenAuthDelegationIntrospectionInput, type GenAuthUserCreateBatchInput, type GenAuthUserCreateInput, type GenAuthUserDeleteBatchInput, type GenAuthUserGetBatchInput, type GenAuthUserGetInput, type GenAuthUserListInput, type GenAuthUserUpdateInput, type Interaction, type InteractionEvidence, InteractionHandle, type InteractionPayloadByType, type InteractionSite, type InteractionStatus, InteractionStatuses, type InteractionType, InteractionTypes, type InteractiveDelegationResponse, type JsonObject, type MonitorEvent, type MonitorEventsOptions, MonitorHandle, type MonitorRunsOptions, Qoni, QoniAuthError, QoniDelegationRequiredError, QoniError, type QoniErrorCode, type QoniErrorOptions, type QoniEvent, type QoniEventType, QoniEventTypes, type QoniMeta, type QoniOptions, QoniPermissionDeniedError, type QoniProduct, type QoniProductName, QoniProductScopes, QoniRateLimitError, type QoniResponse, type QoniRuntimeConfig, type QoniSSEEvent, QoniScopeBundles, QoniScopes, QoniTimeoutError, QoniTokenExpiredError, QoniUpstreamError, QoniValidationError, type RawRequestInput, type RunDoneData, type RunEvent, type RunEventsOptions, RunHandle, type RunImage, type RunLimits, type RunMessageData, type RunReconnectInfo, type RunResult, type RunScreenshotData, type RunStatus, type RunWaitOptions, type RuntimeTokenInput, type SessionRef, type SiteLoginPayload, type SnapshotAction, type SnapshotImage, type TakeControlPayload, type TokenInput, type TrackAttachOptions, type TrackCreateOptions, type WaitKind, type WaitPayload, type WebSearchAttachOptions, type WebSearchEvent, type WebSearchRunOptions, buildAuthorization, buildSignature, buildStringToSign };
|
package/dist/index.js
CHANGED
|
@@ -1146,6 +1146,34 @@ var PLATFORM_DECIDED_RUN_OPTIONS = [
|
|
|
1146
1146
|
"outputSchema",
|
|
1147
1147
|
"cacheScript"
|
|
1148
1148
|
];
|
|
1149
|
+
var BROWSERBASE_REGIONS = /* @__PURE__ */ new Set([
|
|
1150
|
+
"us-west-2",
|
|
1151
|
+
"us-east-1",
|
|
1152
|
+
"eu-central-1",
|
|
1153
|
+
"ap-southeast-1"
|
|
1154
|
+
]);
|
|
1155
|
+
function validateBrowserProxyOptions(value) {
|
|
1156
|
+
if (value === void 0) return;
|
|
1157
|
+
if (!isJsonObject(value)) {
|
|
1158
|
+
throw new QoniValidationError("browserProxy must be an object");
|
|
1159
|
+
}
|
|
1160
|
+
const allowed = /* @__PURE__ */ new Set(["proxyId", "mode", "region"]);
|
|
1161
|
+
const extras = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1162
|
+
if (extras.length > 0) {
|
|
1163
|
+
throw new QoniValidationError(
|
|
1164
|
+
`browserProxy does not accept ${extras.join(", ")} \u2014 credentials stay server-side`
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
if (value.proxyId !== void 0 && (typeof value.proxyId !== "string" || !/^[a-z0-9][a-z0-9._-]{0,63}$/.test(value.proxyId))) {
|
|
1168
|
+
throw new QoniValidationError("browserProxy.proxyId is invalid");
|
|
1169
|
+
}
|
|
1170
|
+
if (value.mode !== void 0 && !["off", "all", "scoped"].includes(String(value.mode))) {
|
|
1171
|
+
throw new QoniValidationError("browserProxy.mode must be off, all, or scoped");
|
|
1172
|
+
}
|
|
1173
|
+
if (value.region !== void 0 && (typeof value.region !== "string" || !BROWSERBASE_REGIONS.has(value.region))) {
|
|
1174
|
+
throw new QoniValidationError("browserProxy.region is not supported");
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1149
1177
|
function createDoAnythingNamespace(transport) {
|
|
1150
1178
|
const api = {
|
|
1151
1179
|
createSession: (input) => transport.webAgentJson("POST", "/do_anything/sessions", input.token, {
|
|
@@ -1214,6 +1242,18 @@ function createDoAnythingNamespace(transport) {
|
|
|
1214
1242
|
requiredScopes: ["webagent.do_anything:read"]
|
|
1215
1243
|
}
|
|
1216
1244
|
),
|
|
1245
|
+
listArtifacts: (input) => transport.webAgentJson(
|
|
1246
|
+
"GET",
|
|
1247
|
+
`/do_anything/runs/${encodeURIComponent(input.runId)}/artifacts`,
|
|
1248
|
+
input.token,
|
|
1249
|
+
{ signal: input.signal, requiredScopes: ["webagent.do_anything:read"] }
|
|
1250
|
+
),
|
|
1251
|
+
artifactDownloadUrl: (input) => transport.webAgentJson(
|
|
1252
|
+
"GET",
|
|
1253
|
+
`/do_anything/artifacts/${encodeURIComponent(input.artifactId)}/download-url`,
|
|
1254
|
+
input.token,
|
|
1255
|
+
{ requiredScopes: ["webagent.do_anything:read"] }
|
|
1256
|
+
),
|
|
1217
1257
|
readRecording: (input) => transport.webAgentJson(
|
|
1218
1258
|
"GET",
|
|
1219
1259
|
`/do_anything/sessions/${encodeURIComponent(input.sessionId)}/recording`,
|
|
@@ -1223,8 +1263,42 @@ function createDoAnythingNamespace(transport) {
|
|
|
1223
1263
|
}
|
|
1224
1264
|
)
|
|
1225
1265
|
};
|
|
1266
|
+
async function artifacts(input) {
|
|
1267
|
+
const { data } = await api.listArtifacts(input);
|
|
1268
|
+
if (!isJsonObject(data) || !Array.isArray(data.items)) {
|
|
1269
|
+
throw new QoniValidationError("artifact list response requires items");
|
|
1270
|
+
}
|
|
1271
|
+
return data.items.map((item) => {
|
|
1272
|
+
if (!isJsonObject(item) || typeof item.id !== "string" || !item.id) {
|
|
1273
|
+
throw new QoniValidationError("artifact requires a nonempty id");
|
|
1274
|
+
}
|
|
1275
|
+
const id = item.id;
|
|
1276
|
+
const artifact = {
|
|
1277
|
+
id,
|
|
1278
|
+
name: typeof item.name === "string" ? item.name : void 0,
|
|
1279
|
+
mime: typeof item.mime_type === "string" ? item.mime_type : void 0,
|
|
1280
|
+
sizeBytes: typeof item.size_bytes === "number" ? item.size_bytes : void 0,
|
|
1281
|
+
createdAt: typeof item.created_at === "string" ? item.created_at : void 0,
|
|
1282
|
+
downloadUrl: typeof item.download_url === "string" ? item.download_url : void 0,
|
|
1283
|
+
expiresIn: typeof item.expires_in === "number" ? item.expires_in : void 0,
|
|
1284
|
+
content: async () => (await transport.webAgentBytes(
|
|
1285
|
+
`/do_anything/artifacts/${encodeURIComponent(id)}/blob`,
|
|
1286
|
+
input.token,
|
|
1287
|
+
{ requiredScopes: ["webagent.do_anything:read"] }
|
|
1288
|
+
)).bytes,
|
|
1289
|
+
refreshDownloadUrl: async () => {
|
|
1290
|
+
const { data: link } = await api.artifactDownloadUrl({ token: input.token, artifactId: id });
|
|
1291
|
+
artifact.downloadUrl = link.download_url;
|
|
1292
|
+
artifact.expiresIn = link.expires_in;
|
|
1293
|
+
return link.download_url;
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
return artifact;
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1226
1299
|
function buildOps(token, runId, capture) {
|
|
1227
1300
|
return {
|
|
1301
|
+
listArtifacts: (signal) => artifacts({ token, runId, signal }),
|
|
1228
1302
|
getDetail: async (signal) => asRecord2((await api.getRun({ token, runId, signal })).data),
|
|
1229
1303
|
streamEvents: (opts) => api.events({
|
|
1230
1304
|
token,
|
|
@@ -1262,6 +1336,7 @@ function createDoAnythingNamespace(transport) {
|
|
|
1262
1336
|
if (!prompt || typeof prompt !== "string") {
|
|
1263
1337
|
throw new QoniValidationError("doAnything.run requires a prompt string");
|
|
1264
1338
|
}
|
|
1339
|
+
validateBrowserProxyOptions(rest.browserProxy);
|
|
1265
1340
|
const unsupported = PLATFORM_DECIDED_RUN_OPTIONS.filter(
|
|
1266
1341
|
(key) => rest[key] !== void 0
|
|
1267
1342
|
);
|
|
@@ -1303,6 +1378,7 @@ function createDoAnythingNamespace(transport) {
|
|
|
1303
1378
|
await handle.status();
|
|
1304
1379
|
return handle;
|
|
1305
1380
|
},
|
|
1381
|
+
artifacts,
|
|
1306
1382
|
api
|
|
1307
1383
|
};
|
|
1308
1384
|
}
|
|
@@ -1312,8 +1388,13 @@ function normalizeDoAnythingRunInput(input) {
|
|
|
1312
1388
|
profileId: "profile_id",
|
|
1313
1389
|
keepAlive: "keep_alive",
|
|
1314
1390
|
allowedActions: "allowed_actions",
|
|
1315
|
-
maxDurationMinutes: "max_duration_minutes"
|
|
1391
|
+
maxDurationMinutes: "max_duration_minutes",
|
|
1392
|
+
browserProxy: "browser_proxy"
|
|
1316
1393
|
});
|
|
1394
|
+
const browserProxy = body.browser_proxy;
|
|
1395
|
+
if (isJsonObject(browserProxy)) {
|
|
1396
|
+
body.browser_proxy = renameKeys2(browserProxy, { proxyId: "proxy_id" });
|
|
1397
|
+
}
|
|
1317
1398
|
return body;
|
|
1318
1399
|
}
|
|
1319
1400
|
function normalizeDoAnythingInterveneInput(input) {
|