@bounded-sh/client 0.0.100-performance.1 → 0.0.100
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/README.md +83 -0
- package/dist/auth/turnkey-auth.d.ts +4 -1
- package/dist/builds/client.d.ts +50 -5
- package/dist/builds/index.d.ts +6 -1
- package/dist/builds/media-tools.d.ts +37 -0
- package/dist/builds/types.d.ts +316 -16
- package/dist/{email-auth-provider-BGTfU1_i.mjs → email-auth-provider-BJXeBUwp.mjs} +2 -2
- package/dist/{email-auth-provider-CIRbOSM3.mjs.map → email-auth-provider-BJXeBUwp.mjs.map} +1 -1
- package/dist/{email-auth-provider-C6SFJd9L.js → email-auth-provider-Cr3I4Po5.js} +2 -2
- package/dist/{email-auth-provider-C6SFJd9L.js.map → email-auth-provider-Cr3I4Po5.js.map} +1 -1
- package/dist/{email-auth-provider-CIRbOSM3.mjs → email-auth-provider-Ct3YA68i.mjs} +2 -2
- package/dist/{email-auth-provider-BGTfU1_i.mjs.map → email-auth-provider-Ct3YA68i.mjs.map} +1 -1
- package/dist/{email-auth-provider-Cpj8hIFu.js → email-auth-provider-DCZ93FYg.js} +2 -2
- package/dist/{email-auth-provider-Cpj8hIFu.js.map → email-auth-provider-DCZ93FYg.js.map} +1 -1
- package/dist/{guest-auth-provider-0PjGFGDm.js → guest-auth-provider--Sqlucfr.js} +2 -2
- package/dist/{guest-auth-provider-0PjGFGDm.js.map → guest-auth-provider--Sqlucfr.js.map} +1 -1
- package/dist/{guest-auth-provider-pC-AheTZ.js → guest-auth-provider-CPj-w7_R.js} +2 -2
- package/dist/{guest-auth-provider-pC-AheTZ.js.map → guest-auth-provider-CPj-w7_R.js.map} +1 -1
- package/dist/{guest-auth-provider-DVxlea-z.mjs → guest-auth-provider-CUo6sgop.mjs} +2 -2
- package/dist/{guest-auth-provider-DVxlea-z.mjs.map → guest-auth-provider-CUo6sgop.mjs.map} +1 -1
- package/dist/{guest-auth-provider-C23vWrOT.mjs → guest-auth-provider-DMtDTZeA.mjs} +2 -2
- package/dist/{guest-auth-provider-C23vWrOT.mjs.map → guest-auth-provider-DMtDTZeA.mjs.map} +1 -1
- package/dist/{index-DmAXYXDi.mjs → index-CaZx7sd8.mjs} +687 -142
- package/dist/index-CaZx7sd8.mjs.map +1 -0
- package/dist/{index-DUVRmF9-.js → index-Pyb2SLgv.js} +689 -141
- package/dist/index-Pyb2SLgv.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{index.native-r1I-9E8e.mjs → index.native-3T0IcOed.mjs} +370 -9
- package/dist/index.native-3T0IcOed.mjs.map +1 -0
- package/dist/{index.native-CllNqdoy.js → index.native-PGrxu7RO.js} +370 -8
- package/dist/index.native-PGrxu7RO.js.map +1 -0
- package/dist/index.native.js +2 -1
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +1 -1
- package/dist/{injected-evm-wallet-provider-BPZMEE8I.mjs → injected-evm-wallet-provider-B3Mtkdnu.mjs} +2 -2
- package/dist/{injected-evm-wallet-provider-BPZMEE8I.mjs.map → injected-evm-wallet-provider-B3Mtkdnu.mjs.map} +1 -1
- package/dist/{injected-evm-wallet-provider-BXM8TfS3.js → injected-evm-wallet-provider-BNu6Z-iN.js} +2 -2
- package/dist/{injected-evm-wallet-provider-BXM8TfS3.js.map → injected-evm-wallet-provider-BNu6Z-iN.js.map} +1 -1
- package/dist/{injected-evm-wallet-provider-CkhN5u3d.mjs → injected-evm-wallet-provider-C8rBnyO1.mjs} +2 -2
- package/dist/{injected-evm-wallet-provider-CkhN5u3d.mjs.map → injected-evm-wallet-provider-C8rBnyO1.mjs.map} +1 -1
- package/dist/{injected-evm-wallet-provider-Dq3FDV1M.js → injected-evm-wallet-provider-U0XJu5HM.js} +2 -2
- package/dist/{injected-evm-wallet-provider-Dq3FDV1M.js.map → injected-evm-wallet-provider-U0XJu5HM.js.map} +1 -1
- package/dist/{injected-wallet-provider-Bi_mB_q3.js → injected-wallet-provider-29eTkM-A.js} +2 -2
- package/dist/injected-wallet-provider-29eTkM-A.js.map +1 -0
- package/dist/{injected-wallet-provider-BlSdRbgq.mjs → injected-wallet-provider-BnmYbm79.mjs} +2 -2
- package/dist/injected-wallet-provider-BnmYbm79.mjs.map +1 -0
- package/dist/{injected-wallet-provider-B3LLEpfp.js → injected-wallet-provider-Cv9RELO6.js} +2 -2
- package/dist/injected-wallet-provider-Cv9RELO6.js.map +1 -0
- package/dist/{injected-wallet-provider-CLLhLBAJ.mjs → injected-wallet-provider-DR8xVudg.mjs} +2 -2
- package/dist/injected-wallet-provider-DR8xVudg.mjs.map +1 -0
- package/dist/services/broadcast.d.ts +28 -0
- package/dist/services/session.d.ts +28 -0
- package/package.json +2 -2
- package/dist/index-DUVRmF9-.js.map +0 -1
- package/dist/index-DmAXYXDi.mjs.map +0 -1
- package/dist/index.native-CllNqdoy.js.map +0 -1
- package/dist/index.native-r1I-9E8e.mjs.map +0 -1
- package/dist/injected-wallet-provider-B3LLEpfp.js.map +0 -1
- package/dist/injected-wallet-provider-Bi_mB_q3.js.map +0 -1
- package/dist/injected-wallet-provider-BlSdRbgq.mjs.map +0 -1
- package/dist/injected-wallet-provider-CLLhLBAJ.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -48,3 +48,7 @@ export type { InjectedWalletProvider } from "./auth/providers/injected-wallet-pr
|
|
|
48
48
|
export { defaultInjectedEvmProvider, requestEip6963Providers, } from "./auth/providers/injected-evm-wallet-types";
|
|
49
49
|
export type { InjectedEvmWalletConfig, InjectedEvmProvider, Eip6963ProviderDetail, Eip6963ProviderInfo, } from "./auth/providers/injected-evm-wallet-types";
|
|
50
50
|
export type { InjectedEvmWalletProvider } from "./auth/providers/injected-evm-wallet-provider";
|
|
51
|
+
export { connectBroadcast } from "./services/broadcast";
|
|
52
|
+
export type { BroadcastTicket, BroadcastConnection } from "./services/broadcast";
|
|
53
|
+
export { connectServiceSession } from "./services/session";
|
|
54
|
+
export type { ServiceSessionTicket, ServiceSession, ServiceSessionReceipt } from "./services/session";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Pyb2SLgv.js');
|
|
4
4
|
var core = require('@bounded-sh/core');
|
|
5
5
|
require('react');
|
|
6
6
|
|
|
@@ -22,6 +22,8 @@ exports.apps = index.apps;
|
|
|
22
22
|
exports.builds = index.builds;
|
|
23
23
|
exports.completeLoginFromRedirect = index.completeLoginFromRedirect;
|
|
24
24
|
exports.completeLoginInPopup = index.completeLoginInPopup;
|
|
25
|
+
exports.connectBroadcast = index.connectBroadcast;
|
|
26
|
+
exports.connectServiceSession = index.connectServiceSession;
|
|
25
27
|
exports.defaultInjectedEvmProvider = index.defaultInjectedEvmProvider;
|
|
26
28
|
exports.defaultInjectedProvider = index.defaultInjectedProvider;
|
|
27
29
|
exports.ensureSharedWalletLoginReady = index.ensureSharedWalletLoginReady;
|
|
@@ -42,6 +44,7 @@ exports.loginWithPrivy = index.loginWithPrivy;
|
|
|
42
44
|
exports.loginWithRedirect = index.loginWithRedirect;
|
|
43
45
|
exports.loginWithWallet = index.loginWithWallet;
|
|
44
46
|
exports.logout = index.logout;
|
|
47
|
+
exports.mediaAgentTools = index.mediaAgentTools;
|
|
45
48
|
exports.onAuthLoadingChanged = index.onAuthLoadingChanged;
|
|
46
49
|
exports.onAuthStateChanged = index.onAuthStateChanged;
|
|
47
50
|
exports.onramp = index.onramp;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ag as BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA, af as BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA, ae as BUILD_REVIEW_CAPABILITY_SCHEMA, a7 as BuildsApiError, ad as FAILURE_REASONS, a9 as NON_TERMINAL_STATES, a1 as OffchainAuthProvider, ac as PARK_REASONS, a2 as PrivyExpoProvider, ab as RUN_STATES, aa as TERMINAL_STATES, W as WalletConfigError, Q as apps, a6 as builds, I as completeLoginFromRedirect, K as completeLoginInPopup, a4 as connectBroadcast, a5 as connectServiceSession, o as defaultInjectedEvmProvider, f as defaultInjectedProvider, F as ensureSharedWalletLoginReady, M as ensureSignedIn, E as ensureWalletLoginReady, w as getAuthLoading, A as getAuthProvider, q as getCurrentUser, Y as getIdToken, S as getOrCreateTurnkeyWallet, g as getPlatform, V as getTurnkeyWalletRecoveryUrl, U as getTurnkeyWalletSessionState, p as init, y as login, J as loginWithPopup, C as loginWithPrivy, H as loginWithRedirect, D as loginWithWallet, z as logout, a8 as mediaAgentTools, v as onAuthLoadingChanged, u as onAuthStateChanged, Z as onramp, _ as onrampQuote, $ as onrampStatus, L as openBoundedWidget, T as openTurnkeyKeyExport, G as preloadWalletLogin, a3 as requestEip6963Providers, a0 as setPlatform, B as signInAnonymously, R as signSolanaMessageViaTurnkey, X as startTurnkeyEmailLogin, N as useAuth, P as useBuildRun, O as useQuery, x as waitForAuthReady } from './index-CaZx7sd8.mjs';
|
|
2
2
|
export * from '@bounded-sh/core';
|
|
3
3
|
export { BoundedDeclineError, DECLINE_EVENT_NAME, RATE_LIMIT_EVENT_NAME, ScopedClientReadOnlyError, aggregate, count, createClient, deriveDecline, dispatchDeclineEvent, dispatchRateLimitEvent, docId, get, getConfig, getFiles, getMany, queryAggregate, reconcileSetResult, runExpression, runExpressionMany, runQuery, runQueryMany, search, set, setFile, setMany, signAndSubmitTransaction, signMessage, signTransaction, subscribe, waitForSetResult } from '@bounded-sh/core';
|
|
4
4
|
import 'react';
|
|
@@ -6044,7 +6044,7 @@ async function getAuthProvider(config) {
|
|
|
6044
6044
|
// manager as legacy email sessions. Human login should be started
|
|
6045
6045
|
// with loginWithRedirect(); this provider is kept as the restore and
|
|
6046
6046
|
// logout surface for those sessions.
|
|
6047
|
-
currentAuthProvider = new (await import('./email-auth-provider-
|
|
6047
|
+
currentAuthProvider = new (await import('./email-auth-provider-Ct3YA68i.mjs')).EmailAuthProvider();
|
|
6048
6048
|
break;
|
|
6049
6049
|
case "phantom": {
|
|
6050
6050
|
// First-class Solana WALLET LOGIN (the poof/TaroBase-style "connect
|
|
@@ -6086,7 +6086,7 @@ async function getAuthProvider(config) {
|
|
|
6086
6086
|
// (bounded-login-widget.ts), so registration never counts as
|
|
6087
6087
|
// evidence the user has a wallet.
|
|
6088
6088
|
await ensureSolanaMobileWalletRegistered(config, configuredNetwork);
|
|
6089
|
-
const { InjectedWalletProvider } = await import('./injected-wallet-provider-
|
|
6089
|
+
const { InjectedWalletProvider } = await import('./injected-wallet-provider-BnmYbm79.mjs');
|
|
6090
6090
|
currentAuthProvider = new InjectedWalletProvider(resolveInjectedWalletConfig(config), rpcUrl, configuredNetwork);
|
|
6091
6091
|
break;
|
|
6092
6092
|
}
|
|
@@ -6099,7 +6099,7 @@ async function getAuthProvider(config) {
|
|
|
6099
6099
|
// Selecting authMethod:'evm-wallet' IS the opt-in — pass evmWalletConfig
|
|
6100
6100
|
// to point at a specific wallet or set chainId/domain.
|
|
6101
6101
|
const evmWalletConfig = ((_a = config.evmWalletConfig) !== null && _a !== void 0 ? _a : {});
|
|
6102
|
-
const { InjectedEvmWalletProvider } = await import('./injected-evm-wallet-provider-
|
|
6102
|
+
const { InjectedEvmWalletProvider } = await import('./injected-evm-wallet-provider-C8rBnyO1.mjs');
|
|
6103
6103
|
currentAuthProvider = new InjectedEvmWalletProvider(evmWalletConfig);
|
|
6104
6104
|
break;
|
|
6105
6105
|
}
|
|
@@ -6124,7 +6124,7 @@ async function getAuthProvider(config) {
|
|
|
6124
6124
|
break;
|
|
6125
6125
|
case "guest":
|
|
6126
6126
|
// Anonymous auth: a device-local ed25519 keypair signs the challenge.
|
|
6127
|
-
currentAuthProvider = new (await import('./guest-auth-provider-
|
|
6127
|
+
currentAuthProvider = new (await import('./guest-auth-provider-DMtDTZeA.mjs')).GuestAuthProvider();
|
|
6128
6128
|
break;
|
|
6129
6129
|
}
|
|
6130
6130
|
if (!currentAuthProvider) {
|
|
@@ -6186,7 +6186,7 @@ async function signInAnonymously() {
|
|
|
6186
6186
|
// Lazy-load the guest provider so its ed25519/web3 dependencies stay out of
|
|
6187
6187
|
// the main bundle for data-only apps. Specifier is a static string literal
|
|
6188
6188
|
// so bundle-splitting can see it.
|
|
6189
|
-
const provider = new (await import('./guest-auth-provider-
|
|
6189
|
+
const provider = new (await import('./guest-auth-provider-DMtDTZeA.mjs')).GuestAuthProvider();
|
|
6190
6190
|
setAuthLoading(true); // reflect "signing in…" while the guest keypair session is minted
|
|
6191
6191
|
// adoptSessionProvider awaits only getConfig() (already resolved here) and then
|
|
6192
6192
|
// runs every write - provider/method/config/marker/user - in one synchronous
|
|
@@ -6357,7 +6357,7 @@ function ensureSharedWalletLoginReady() {
|
|
|
6357
6357
|
if (!sharedWalletReady) {
|
|
6358
6358
|
sharedWalletReady = (async () => {
|
|
6359
6359
|
await getConfig();
|
|
6360
|
-
await import('./injected-wallet-provider-
|
|
6360
|
+
await import('./injected-wallet-provider-BnmYbm79.mjs');
|
|
6361
6361
|
})().catch((error) => {
|
|
6362
6362
|
sharedWalletReady = null;
|
|
6363
6363
|
throw error;
|
|
@@ -7290,9 +7290,26 @@ async function getReviewCapability(appId, runId, gateId, options) {
|
|
|
7290
7290
|
body: { expectedPreviewUrl: options.expectedPreviewUrl },
|
|
7291
7291
|
});
|
|
7292
7292
|
}
|
|
7293
|
+
/**
|
|
7294
|
+
* Add funds to a run parked for funding. Accounts billed through payer shards refuse it with
|
|
7295
|
+
* `topup_unavailable_payer_shard` (in `details.upstreamCode`): a parked run there holds no money, so the payer adds
|
|
7296
|
+
* credits and submits the build again.
|
|
7297
|
+
*/
|
|
7293
7298
|
async function topup(appId, runId, options) {
|
|
7294
7299
|
return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/topup`, { method: 'POST', body: options });
|
|
7295
7300
|
}
|
|
7301
|
+
/** An image build's verified images and its asset's current release. */
|
|
7302
|
+
async function media(appId, runId) {
|
|
7303
|
+
return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/media`);
|
|
7304
|
+
}
|
|
7305
|
+
/** A short-lived signed URL for one image of an image build (usable directly as an image source). */
|
|
7306
|
+
async function mediaDownloadUrl(appId, runId, artifactId) {
|
|
7307
|
+
return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/media-download-url`, { method: 'POST', body: { artifactId } });
|
|
7308
|
+
}
|
|
7309
|
+
/** Roll back the release an image build published: its asset returns to the release it replaced. */
|
|
7310
|
+
async function rollbackMedia(appId, runId, options = {}) {
|
|
7311
|
+
return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/media-rollback`, { method: 'POST', body: options.note ? { note: options.note } : {} });
|
|
7312
|
+
}
|
|
7296
7313
|
async function list$1(appId, limit = 20) {
|
|
7297
7314
|
const requestedLimit = Number.isFinite(limit) ? Math.max(1, Math.floor(limit)) : 20;
|
|
7298
7315
|
return requestDevApi(`${appPath(appId)}?limit=${requestedLimit}`);
|
|
@@ -7324,13 +7341,15 @@ const RUN_STATES = [
|
|
|
7324
7341
|
...NON_TERMINAL_STATES,
|
|
7325
7342
|
...TERMINAL_STATES,
|
|
7326
7343
|
];
|
|
7327
|
-
const PARK_REASONS = ['gate', 'funding'];
|
|
7344
|
+
const PARK_REASONS = ['gate', 'funding', 'preview', 'design'];
|
|
7328
7345
|
const FAILURE_REASONS = [
|
|
7329
7346
|
'admission_rejected',
|
|
7330
7347
|
'dispatch_timeout',
|
|
7331
7348
|
'auth_revoked',
|
|
7332
7349
|
'owner_changed',
|
|
7333
7350
|
'policy_changed',
|
|
7351
|
+
'target_retired',
|
|
7352
|
+
'promotion_rejected',
|
|
7334
7353
|
'quarantine_forced',
|
|
7335
7354
|
'bind_failed',
|
|
7336
7355
|
'internal_error',
|
|
@@ -7588,6 +7607,345 @@ function useBuildRun(appId, runId, options) {
|
|
|
7588
7607
|
return { run, events, loading, error };
|
|
7589
7608
|
}
|
|
7590
7609
|
|
|
7610
|
+
const TERMINAL = new Set(['promoted', 'failed', 'canceled', 'rejected', 'expired', 'rebase_required', 'reported']);
|
|
7611
|
+
const KEY = { type: 'string', minLength: 1, maxLength: 256, description: 'A key unique to this intent; retrying with the same key never repeats the action.' };
|
|
7612
|
+
const RUN_ID = { type: 'string', minLength: 1, maxLength: 128, description: 'The build run id media_create or media_edit returned.' };
|
|
7613
|
+
const REGION = {
|
|
7614
|
+
type: 'object',
|
|
7615
|
+
additionalProperties: false,
|
|
7616
|
+
required: ['x', 'y', 'width', 'height'],
|
|
7617
|
+
properties: {
|
|
7618
|
+
x: { type: 'integer', minimum: 0 },
|
|
7619
|
+
y: { type: 'integer', minimum: 0 },
|
|
7620
|
+
width: { type: 'integer', minimum: 1 },
|
|
7621
|
+
height: { type: 'integer', minimum: 1 },
|
|
7622
|
+
},
|
|
7623
|
+
description: 'A rectangle in whole pixels of the image; nothing outside it changes.',
|
|
7624
|
+
};
|
|
7625
|
+
const SPEC = { type: 'object', description: 'The deliverable spec (image: size, quality, format, background, candidates, model, references, region; video: durationSeconds, resolution, aspectRatio, audio, images, scenes, replaceScenes, captions). See the builds docs.' };
|
|
7626
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
7627
|
+
const text = (value, max) => typeof value === 'string' && value.trim().length > 0 && value.length <= max ? value : undefined;
|
|
7628
|
+
const refuse = (code, message, next = ['media_inspect'], retryable = false) => ({ ok: false, code, message, retryable, next });
|
|
7629
|
+
function region(value) {
|
|
7630
|
+
if (!isRecord(value))
|
|
7631
|
+
return undefined;
|
|
7632
|
+
const { x, y, width, height } = value;
|
|
7633
|
+
return [x, y, width, height].every(Number.isSafeInteger) && x >= 0 && y >= 0
|
|
7634
|
+
&& width >= 1 && height >= 1
|
|
7635
|
+
? { x: x, y: y, width: width, height: height }
|
|
7636
|
+
: undefined;
|
|
7637
|
+
}
|
|
7638
|
+
/** A thrown API error, as the tool result the model reads. The developer API answers with a coarse public code and
|
|
7639
|
+
* relays Build's own reason (base_moved, candidate_unknown, media_storage_quota, ...) as details.upstreamCode. */
|
|
7640
|
+
function failure(error) {
|
|
7641
|
+
var _a;
|
|
7642
|
+
const apiError = error;
|
|
7643
|
+
const upstream = (_a = apiError === null || apiError === void 0 ? void 0 : apiError.details) === null || _a === void 0 ? void 0 : _a.upstreamCode;
|
|
7644
|
+
return refuse(typeof upstream === 'string' && /^[a-z][a-z0-9_]{0,79}$/.test(upstream) && upstream !== 'unknown_upstream_error'
|
|
7645
|
+
? upstream
|
|
7646
|
+
: typeof (apiError === null || apiError === void 0 ? void 0 : apiError.code) === 'string' ? apiError.code : 'request_failed', typeof (apiError === null || apiError === void 0 ? void 0 : apiError.message) === 'string' ? apiError.message : 'The request failed.', ['media_inspect'], (apiError === null || apiError === void 0 ? void 0 : apiError.retryable) === true);
|
|
7647
|
+
}
|
|
7648
|
+
/** What a run lets an agent do next. */
|
|
7649
|
+
function nextFor(run) {
|
|
7650
|
+
var _a;
|
|
7651
|
+
if ((_a = run.design) === null || _a === void 0 ? void 0 : _a.gate)
|
|
7652
|
+
return ['media_select', 'media_revise', 'media_export'];
|
|
7653
|
+
if (run.state === 'promoted')
|
|
7654
|
+
return ['media_export', 'media_edit', 'media_create'];
|
|
7655
|
+
if (run.state === 'parked' && run.parkReason === 'gate')
|
|
7656
|
+
return ['media_propose', 'media_export'];
|
|
7657
|
+
if (TERMINAL.has(run.state))
|
|
7658
|
+
return ['media_create'];
|
|
7659
|
+
return ['media_inspect'];
|
|
7660
|
+
}
|
|
7661
|
+
function candidateView(candidate) {
|
|
7662
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({ id: candidate.id }, (candidate.url ? { url: candidate.url } : {})), { mimeType: candidate.mimeType, width: candidate.width, height: candidate.height }), (candidate.durationMs !== undefined ? { durationMs: candidate.durationMs } : {})), (candidate.scenes ? { scenes: candidate.scenes } : {}));
|
|
7663
|
+
}
|
|
7664
|
+
function mediaAgentTools(appId, client = {
|
|
7665
|
+
submit: submit,
|
|
7666
|
+
get: get,
|
|
7667
|
+
decideGate: decideGate,
|
|
7668
|
+
media: media,
|
|
7669
|
+
mediaDownloadUrl: mediaDownloadUrl,
|
|
7670
|
+
}) {
|
|
7671
|
+
const run = async (runId) => (await client.get(appId, runId)).run;
|
|
7672
|
+
const submit = async (options) => {
|
|
7673
|
+
try {
|
|
7674
|
+
const submitted = await client.submit(appId, options);
|
|
7675
|
+
return { ok: true, data: { runId: submitted.runId, status: submitted.status }, next: ['media_inspect'] };
|
|
7676
|
+
}
|
|
7677
|
+
catch (error) {
|
|
7678
|
+
return failure(error);
|
|
7679
|
+
}
|
|
7680
|
+
};
|
|
7681
|
+
/** The open design review of a run, or the refusal that explains why there is none. */
|
|
7682
|
+
const openReview = async (input) => {
|
|
7683
|
+
var _a;
|
|
7684
|
+
const runId = text(input.runId, 128);
|
|
7685
|
+
if (!runId)
|
|
7686
|
+
return refuse('input_invalid', 'runId is required.');
|
|
7687
|
+
let current;
|
|
7688
|
+
try {
|
|
7689
|
+
current = await run(runId);
|
|
7690
|
+
}
|
|
7691
|
+
catch (error) {
|
|
7692
|
+
return failure(error);
|
|
7693
|
+
}
|
|
7694
|
+
const gate = (_a = current.design) === null || _a === void 0 ? void 0 : _a.gate;
|
|
7695
|
+
if (!gate) {
|
|
7696
|
+
return refuse('no_open_review', `Run ${runId} is ${current.state}${current.parkReason ? ` (${current.parkReason})` : ''}; no design round is waiting for a decision.`, nextFor(current));
|
|
7697
|
+
}
|
|
7698
|
+
return { run: current, gateId: gate.gateId };
|
|
7699
|
+
};
|
|
7700
|
+
const candidateOf = (current, id) => { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = current.design) === null || _a === void 0 ? void 0 : _a.rounds) === null || _b === void 0 ? void 0 : _b.find((round) => { var _a; return round.round === ((_a = current.design) === null || _a === void 0 ? void 0 : _a.round); })) === null || _c === void 0 ? void 0 : _c.candidates) === null || _d === void 0 ? void 0 : _d.find((candidate) => candidate.id === id); };
|
|
7701
|
+
return [
|
|
7702
|
+
{
|
|
7703
|
+
name: 'media_create',
|
|
7704
|
+
description: 'Start an image or video build for this app. Pass forkOf to start a new asset from a retained release. Returns the run id; the first round of candidates follows (read it with media_inspect).',
|
|
7705
|
+
inputSchema: {
|
|
7706
|
+
type: 'object',
|
|
7707
|
+
additionalProperties: false,
|
|
7708
|
+
required: ['kind', 'prompt', 'idempotencyKey'],
|
|
7709
|
+
properties: {
|
|
7710
|
+
kind: { type: 'string', enum: ['image', 'video'] },
|
|
7711
|
+
prompt: { type: 'string', minLength: 1, maxLength: 4000, description: 'What to make.' },
|
|
7712
|
+
spec: SPEC,
|
|
7713
|
+
forkOf: {
|
|
7714
|
+
type: 'object',
|
|
7715
|
+
additionalProperties: false,
|
|
7716
|
+
required: ['assetId', 'releaseId'],
|
|
7717
|
+
properties: { assetId: { type: 'string' }, releaseId: { type: 'string' } },
|
|
7718
|
+
description: 'A retained release of this app to start from.',
|
|
7719
|
+
},
|
|
7720
|
+
idempotencyKey: KEY,
|
|
7721
|
+
},
|
|
7722
|
+
},
|
|
7723
|
+
async execute(raw) {
|
|
7724
|
+
const input = isRecord(raw) ? raw : {};
|
|
7725
|
+
const prompt = text(input.prompt, 4000);
|
|
7726
|
+
const key = text(input.idempotencyKey, 256);
|
|
7727
|
+
if ((input.kind !== 'image' && input.kind !== 'video') || !prompt || !key) {
|
|
7728
|
+
return refuse('input_invalid', 'kind (image or video), prompt and idempotencyKey are required.', []);
|
|
7729
|
+
}
|
|
7730
|
+
return submit({
|
|
7731
|
+
operation: 'create',
|
|
7732
|
+
prompt,
|
|
7733
|
+
deliverable: Object.assign(Object.assign({ kind: input.kind }, (isRecord(input.spec) ? { spec: input.spec } : {})), (isRecord(input.forkOf) ? { forkOf: input.forkOf } : {})),
|
|
7734
|
+
idempotencyKey: key,
|
|
7735
|
+
});
|
|
7736
|
+
},
|
|
7737
|
+
},
|
|
7738
|
+
{
|
|
7739
|
+
name: 'media_edit',
|
|
7740
|
+
description: 'Edit a released image or video. Name the asset and the release you edit (a newer release refuses the edit as base_moved). An image spec may carry region to change only a rectangle; a video spec may carry replaceScenes or captions, and a captions-only edit makes no generation call.',
|
|
7741
|
+
inputSchema: {
|
|
7742
|
+
type: 'object',
|
|
7743
|
+
additionalProperties: false,
|
|
7744
|
+
required: ['kind', 'assetId', 'expectedReleaseId', 'prompt', 'idempotencyKey'],
|
|
7745
|
+
properties: {
|
|
7746
|
+
kind: { type: 'string', enum: ['image', 'video'] },
|
|
7747
|
+
assetId: { type: 'string' },
|
|
7748
|
+
expectedReleaseId: { type: 'string' },
|
|
7749
|
+
prompt: { type: 'string', minLength: 1, maxLength: 4000, description: 'The change to make.' },
|
|
7750
|
+
spec: SPEC,
|
|
7751
|
+
idempotencyKey: KEY,
|
|
7752
|
+
},
|
|
7753
|
+
},
|
|
7754
|
+
async execute(raw) {
|
|
7755
|
+
const input = isRecord(raw) ? raw : {};
|
|
7756
|
+
const prompt = text(input.prompt, 4000);
|
|
7757
|
+
const key = text(input.idempotencyKey, 256);
|
|
7758
|
+
const assetId = text(input.assetId, 128);
|
|
7759
|
+
const expectedReleaseId = text(input.expectedReleaseId, 128);
|
|
7760
|
+
if ((input.kind !== 'image' && input.kind !== 'video') || !prompt || !key || !assetId || !expectedReleaseId) {
|
|
7761
|
+
return refuse('input_invalid', 'kind, assetId, expectedReleaseId, prompt and idempotencyKey are required.', []);
|
|
7762
|
+
}
|
|
7763
|
+
return submit({
|
|
7764
|
+
operation: 'edit',
|
|
7765
|
+
prompt,
|
|
7766
|
+
deliverable: Object.assign({ kind: input.kind, assetId,
|
|
7767
|
+
expectedReleaseId }, (isRecord(input.spec) ? { spec: input.spec } : {})),
|
|
7768
|
+
idempotencyKey: key,
|
|
7769
|
+
});
|
|
7770
|
+
},
|
|
7771
|
+
},
|
|
7772
|
+
{
|
|
7773
|
+
name: 'media_inspect',
|
|
7774
|
+
description: 'Read a media build: its state, the candidates of the round under review (with their scenes), the decision it waits on, and its release once published.',
|
|
7775
|
+
inputSchema: { type: 'object', additionalProperties: false, required: ['runId'], properties: { runId: RUN_ID } },
|
|
7776
|
+
async execute(raw) {
|
|
7777
|
+
var _a, _b, _c, _d, _e;
|
|
7778
|
+
const runId = text(isRecord(raw) ? raw.runId : undefined, 128);
|
|
7779
|
+
if (!runId)
|
|
7780
|
+
return refuse('input_invalid', 'runId is required.', []);
|
|
7781
|
+
try {
|
|
7782
|
+
const current = await run(runId);
|
|
7783
|
+
const round = (_b = (_a = current.design) === null || _a === void 0 ? void 0 : _a.rounds) === null || _b === void 0 ? void 0 : _b.find((entry) => { var _a; return entry.round === ((_a = current.design) === null || _a === void 0 ? void 0 : _a.round); });
|
|
7784
|
+
const media = current.state === 'promoted' || current.media ? await client.media(appId, runId) : undefined;
|
|
7785
|
+
return {
|
|
7786
|
+
ok: true,
|
|
7787
|
+
data: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ runId, state: current.state }, (current.parkReason ? { parkReason: current.parkReason } : {})), (current.failureReason ? { failureReason: current.failureReason } : {})), (current.failureDetail ? { failureDetail: current.failureDetail } : {})), (round
|
|
7788
|
+
? Object.assign({ round: round.round, maxRounds: (_c = current.design) === null || _c === void 0 ? void 0 : _c.maxRounds, candidates: ((_d = round.candidates) !== null && _d !== void 0 ? _d : []).map(candidateView) }, (round.revisionFailed ? { revisionFailed: true } : {})) : {})), (((_e = current.design) === null || _e === void 0 ? void 0 : _e.gate) ? { review: { gateId: current.design.gate.gateId, allowedDecisions: current.design.gate.allowedDecisions } } : {})), (current.state === 'parked' && current.parkReason === 'funding'
|
|
7789
|
+
? { waitingFor: 'funding: the payer adds funds and, where top-up is unavailable (topup_unavailable_payer_shard), submits the build again; an agent cannot' }
|
|
7790
|
+
: {})), (media ? { media: media.media, asset: media.asset } : {})),
|
|
7791
|
+
next: nextFor(current),
|
|
7792
|
+
};
|
|
7793
|
+
}
|
|
7794
|
+
catch (error) {
|
|
7795
|
+
return failure(error);
|
|
7796
|
+
}
|
|
7797
|
+
},
|
|
7798
|
+
},
|
|
7799
|
+
{
|
|
7800
|
+
name: 'media_revise',
|
|
7801
|
+
description: 'Ask for another round of the design under review. Name the candidate to revise; for an image, region limits the change to a rectangle of that candidate (PNG only); for a multi-scene video, sceneIds regenerates only those scenes and keeps every other scene byte for byte.',
|
|
7802
|
+
inputSchema: {
|
|
7803
|
+
type: 'object',
|
|
7804
|
+
additionalProperties: false,
|
|
7805
|
+
required: ['runId', 'feedback', 'idempotencyKey'],
|
|
7806
|
+
properties: {
|
|
7807
|
+
runId: RUN_ID,
|
|
7808
|
+
feedback: { type: 'string', minLength: 1, maxLength: 4000, description: 'What to change.' },
|
|
7809
|
+
candidateId: { type: 'string', description: 'The candidate to revise; without it the whole round is redone from the feedback.' },
|
|
7810
|
+
sceneIds: { type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 6 },
|
|
7811
|
+
region: REGION,
|
|
7812
|
+
idempotencyKey: KEY,
|
|
7813
|
+
},
|
|
7814
|
+
},
|
|
7815
|
+
async execute(raw) {
|
|
7816
|
+
var _a, _b;
|
|
7817
|
+
const input = isRecord(raw) ? raw : {};
|
|
7818
|
+
const feedback = text(input.feedback, 4000);
|
|
7819
|
+
const key = text(input.idempotencyKey, 256);
|
|
7820
|
+
if (!feedback || !key)
|
|
7821
|
+
return refuse('input_invalid', 'runId, feedback and idempotencyKey are required.', []);
|
|
7822
|
+
const review = await openReview(input);
|
|
7823
|
+
if ('ok' in review)
|
|
7824
|
+
return review;
|
|
7825
|
+
if (!((_b = (_a = review.run.design) === null || _a === void 0 ? void 0 : _a.gate) === null || _b === void 0 ? void 0 : _b.allowedDecisions.includes('request_changes'))) {
|
|
7826
|
+
return refuse('decision_not_allowed', 'This round takes no revision (it may be the last one): select a candidate instead.', ['media_select']);
|
|
7827
|
+
}
|
|
7828
|
+
const candidate = input.candidateId === undefined ? undefined : candidateOf(review.run, input.candidateId);
|
|
7829
|
+
if (input.candidateId !== undefined && !candidate) {
|
|
7830
|
+
return refuse('candidate_unknown', `No candidate ${String(input.candidateId)} in the round under review.`, ['media_inspect']);
|
|
7831
|
+
}
|
|
7832
|
+
const sceneIds = Array.isArray(input.sceneIds) ? input.sceneIds.filter((id) => typeof id === 'string') : undefined;
|
|
7833
|
+
if (sceneIds && (!(candidate === null || candidate === void 0 ? void 0 : candidate.scenes) || !sceneIds.every((id) => candidate.scenes.some((scene) => scene.id === id)))) {
|
|
7834
|
+
return refuse('scenes_unknown', 'sceneIds must name scenes of the multi-scene candidate being revised (candidateId).', ['media_inspect']);
|
|
7835
|
+
}
|
|
7836
|
+
const area = input.region === undefined ? undefined : region(input.region);
|
|
7837
|
+
if (input.region !== undefined
|
|
7838
|
+
&& (!area || (candidate === null || candidate === void 0 ? void 0 : candidate.mimeType) !== 'image/png' || area.x + area.width > candidate.width || area.y + area.height > candidate.height)) {
|
|
7839
|
+
return refuse('region_invalid', 'region must lie inside the PNG candidate being revised (candidateId).', ['media_inspect']);
|
|
7840
|
+
}
|
|
7841
|
+
try {
|
|
7842
|
+
const decided = await client.decideGate(appId, review.run.runId, review.gateId, Object.assign(Object.assign(Object.assign(Object.assign({ decision: 'request_changes', feedback: { text: feedback } }, (candidate ? { selectedArtifactId: candidate.id } : {})), (sceneIds ? { sceneIds } : {})), (area ? { region: area } : {})), { idempotencyKey: key }));
|
|
7843
|
+
return { ok: true, data: { runId: review.run.runId, state: decided.state }, next: ['media_inspect'] };
|
|
7844
|
+
}
|
|
7845
|
+
catch (error) {
|
|
7846
|
+
return failure(error);
|
|
7847
|
+
}
|
|
7848
|
+
},
|
|
7849
|
+
},
|
|
7850
|
+
{
|
|
7851
|
+
name: 'media_select',
|
|
7852
|
+
description: 'Choose a candidate of the round under review. The chosen candidate is what the build releases, through the app\'s landing policy.',
|
|
7853
|
+
inputSchema: {
|
|
7854
|
+
type: 'object',
|
|
7855
|
+
additionalProperties: false,
|
|
7856
|
+
required: ['runId', 'candidateId', 'idempotencyKey'],
|
|
7857
|
+
properties: { runId: RUN_ID, candidateId: { type: 'string' }, idempotencyKey: KEY },
|
|
7858
|
+
},
|
|
7859
|
+
async execute(raw) {
|
|
7860
|
+
const input = isRecord(raw) ? raw : {};
|
|
7861
|
+
const key = text(input.idempotencyKey, 256);
|
|
7862
|
+
if (!key)
|
|
7863
|
+
return refuse('input_invalid', 'runId, candidateId and idempotencyKey are required.', []);
|
|
7864
|
+
const review = await openReview(input);
|
|
7865
|
+
if ('ok' in review)
|
|
7866
|
+
return review;
|
|
7867
|
+
const candidate = candidateOf(review.run, input.candidateId);
|
|
7868
|
+
if (!candidate)
|
|
7869
|
+
return refuse('candidate_unknown', `No candidate ${String(input.candidateId)} in the round under review.`, ['media_inspect']);
|
|
7870
|
+
try {
|
|
7871
|
+
const decided = await client.decideGate(appId, review.run.runId, review.gateId, {
|
|
7872
|
+
decision: 'approve',
|
|
7873
|
+
selectedArtifactId: candidate.id,
|
|
7874
|
+
idempotencyKey: key,
|
|
7875
|
+
});
|
|
7876
|
+
return { ok: true, data: { runId: review.run.runId, state: decided.state, selectedArtifactId: candidate.id }, next: ['media_propose', 'media_inspect'] };
|
|
7877
|
+
}
|
|
7878
|
+
catch (error) {
|
|
7879
|
+
return failure(error);
|
|
7880
|
+
}
|
|
7881
|
+
},
|
|
7882
|
+
},
|
|
7883
|
+
{
|
|
7884
|
+
name: 'media_export',
|
|
7885
|
+
description: 'A short-lived signed URL for one verified image or video of a build (a published release, or a candidate the build deposited), with its digest.',
|
|
7886
|
+
inputSchema: {
|
|
7887
|
+
type: 'object',
|
|
7888
|
+
additionalProperties: false,
|
|
7889
|
+
required: ['runId', 'artifactId'],
|
|
7890
|
+
properties: { runId: RUN_ID, artifactId: { type: 'string' } },
|
|
7891
|
+
},
|
|
7892
|
+
async execute(raw) {
|
|
7893
|
+
var _a, _b;
|
|
7894
|
+
const input = isRecord(raw) ? raw : {};
|
|
7895
|
+
const runId = text(input.runId, 128);
|
|
7896
|
+
const artifactId = text(input.artifactId, 64);
|
|
7897
|
+
if (!runId || !artifactId)
|
|
7898
|
+
return refuse('input_invalid', 'runId and artifactId are required.', []);
|
|
7899
|
+
try {
|
|
7900
|
+
const view = await client.media(appId, runId);
|
|
7901
|
+
const artifact = (_b = (_a = view.media) === null || _a === void 0 ? void 0 : _a.artifacts) === null || _b === void 0 ? void 0 : _b.find((entry) => entry.id === artifactId);
|
|
7902
|
+
if (!artifact) {
|
|
7903
|
+
return refuse('artifact_unavailable', `Run ${runId} has no verified artifact ${artifactId} yet; a candidate under review is exported from its round's url (media_inspect).`, ['media_inspect']);
|
|
7904
|
+
}
|
|
7905
|
+
const signed = await client.mediaDownloadUrl(appId, runId, artifactId);
|
|
7906
|
+
return {
|
|
7907
|
+
ok: true,
|
|
7908
|
+
data: { runId, artifactId, url: signed.url, expiresAtMs: signed.expiresAtMs, sha256: artifact.sha256, mimeType: artifact.mimeType, bytes: artifact.bytes },
|
|
7909
|
+
next: ['media_inspect'],
|
|
7910
|
+
};
|
|
7911
|
+
}
|
|
7912
|
+
catch (error) {
|
|
7913
|
+
return failure(error);
|
|
7914
|
+
}
|
|
7915
|
+
},
|
|
7916
|
+
},
|
|
7917
|
+
{
|
|
7918
|
+
name: 'media_propose',
|
|
7919
|
+
description: 'Put a build\'s chosen candidate forward for publication and report where it stands. Publishing is decided by the app\'s landing policy (the owner approves the release, or the policy lands it); this tool never approves it.',
|
|
7920
|
+
inputSchema: { type: 'object', additionalProperties: false, required: ['runId'], properties: { runId: RUN_ID } },
|
|
7921
|
+
async execute(raw) {
|
|
7922
|
+
var _a;
|
|
7923
|
+
const runId = text(isRecord(raw) ? raw.runId : undefined, 128);
|
|
7924
|
+
if (!runId)
|
|
7925
|
+
return refuse('input_invalid', 'runId is required.', []);
|
|
7926
|
+
try {
|
|
7927
|
+
const current = await run(runId);
|
|
7928
|
+
if (current.state === 'promoted') {
|
|
7929
|
+
const view = await client.media(appId, runId);
|
|
7930
|
+
return { ok: true, data: { runId, state: 'published', release: view.asset.currentRelease }, next: nextFor(current) };
|
|
7931
|
+
}
|
|
7932
|
+
if (current.state === 'parked' && current.parkReason === 'gate') {
|
|
7933
|
+
const gate = current.gates.find((entry) => !entry.decided);
|
|
7934
|
+
return { ok: true, data: Object.assign(Object.assign({ runId, state: 'awaiting_publication' }, (gate ? { gateId: gate.gateId } : {})), { decidedBy: 'the app owner, under the landing policy' }), next: ['media_inspect'] };
|
|
7935
|
+
}
|
|
7936
|
+
if ((_a = current.design) === null || _a === void 0 ? void 0 : _a.gate) {
|
|
7937
|
+
return refuse('not_selected', 'Choose a candidate first (media_select); only a chosen candidate can be published.', ['media_select', 'media_revise']);
|
|
7938
|
+
}
|
|
7939
|
+
return refuse('not_proposable', `Run ${runId} is ${current.state}${current.parkReason ? ` (${current.parkReason})` : ''}; it has no candidate waiting for publication.`, nextFor(current));
|
|
7940
|
+
}
|
|
7941
|
+
catch (error) {
|
|
7942
|
+
return failure(error);
|
|
7943
|
+
}
|
|
7944
|
+
},
|
|
7945
|
+
},
|
|
7946
|
+
];
|
|
7947
|
+
}
|
|
7948
|
+
|
|
7591
7949
|
/**
|
|
7592
7950
|
* Registered first-party product surfaces only, with
|
|
7593
7951
|
* one exact Drafted exception for delegated review/decision routes. Other
|
|
@@ -7605,6 +7963,9 @@ const builds = {
|
|
|
7605
7963
|
uploadInput,
|
|
7606
7964
|
list: list$1,
|
|
7607
7965
|
watch,
|
|
7966
|
+
media,
|
|
7967
|
+
mediaDownloadUrl,
|
|
7968
|
+
rollbackMedia,
|
|
7608
7969
|
};
|
|
7609
7970
|
|
|
7610
7971
|
async function create(options = {}) {
|
|
@@ -8324,5 +8685,5 @@ class PrivyExpoProvider {
|
|
|
8324
8685
|
}
|
|
8325
8686
|
}
|
|
8326
8687
|
|
|
8327
|
-
export {
|
|
8328
|
-
//# sourceMappingURL=index.native-
|
|
8688
|
+
export { BUILD_REVIEW_CAPABILITY_SCHEMA as $, logout as A, getAuthProvider as B, signInAnonymously as C, loginWithPrivy as D, loginWithRedirect as E, completeLoginFromRedirect as F, loginWithPopup as G, completeLoginInPopup as H, useAuth as I, useQuery as J, useBuildRun as K, apps as L, getIdToken as M, onramp as N, onrampQuote as O, onrampStatus as P, setPlatform as Q, OffchainAuthProvider as R, PrivyExpoProvider as S, builds as T, BuildsApiError as U, mediaAgentTools as V, NON_TERMINAL_STATES as W, TERMINAL_STATES as X, RUN_STATES as Y, PARK_REASONS as Z, FAILURE_REASONS as _, signMessageWithTurnkey as a, BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA as a0, BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA as a1, signTransactionWithTurnkey as b, signTransactionV1WithTurnkey as c, signAndSubmitTransactionWithTurnkey as d, bs58 as e, getWallets as f, getPlatform as g, hasTurnkeyWallet as h, isSolanaMobileWallet as i, solanaMobileWalletLeavesPage as j, setAuthLoading as k, bufferExports as l, setStoredAuthMethod as m, normalizeSolanaRpcUrl as n, confirmAndCheckTransaction as o, resolveSolanaRpcUrl as p, init as q, resolveSolanaWalletStandardChain as r, setCurrentUser as s, transactionHasSignature as t, getCurrentUser as u, onAuthStateChanged as v, onAuthLoadingChanged as w, getAuthLoading as x, waitForAuthReady as y, login as z };
|
|
8689
|
+
//# sourceMappingURL=index.native-3T0IcOed.mjs.map
|