@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
|
@@ -6065,7 +6065,7 @@ async function getAuthProvider(config) {
|
|
|
6065
6065
|
// manager as legacy email sessions. Human login should be started
|
|
6066
6066
|
// with loginWithRedirect(); this provider is kept as the restore and
|
|
6067
6067
|
// logout surface for those sessions.
|
|
6068
|
-
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-
|
|
6068
|
+
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-DCZ93FYg.js'); })).EmailAuthProvider();
|
|
6069
6069
|
break;
|
|
6070
6070
|
case "phantom": {
|
|
6071
6071
|
// First-class Solana WALLET LOGIN (the poof/TaroBase-style "connect
|
|
@@ -6107,7 +6107,7 @@ async function getAuthProvider(config) {
|
|
|
6107
6107
|
// (bounded-login-widget.ts), so registration never counts as
|
|
6108
6108
|
// evidence the user has a wallet.
|
|
6109
6109
|
await ensureSolanaMobileWalletRegistered(config, configuredNetwork);
|
|
6110
|
-
const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-
|
|
6110
|
+
const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-29eTkM-A.js'); });
|
|
6111
6111
|
currentAuthProvider = new InjectedWalletProvider(resolveInjectedWalletConfig(config), rpcUrl, configuredNetwork);
|
|
6112
6112
|
break;
|
|
6113
6113
|
}
|
|
@@ -6120,7 +6120,7 @@ async function getAuthProvider(config) {
|
|
|
6120
6120
|
// Selecting authMethod:'evm-wallet' IS the opt-in — pass evmWalletConfig
|
|
6121
6121
|
// to point at a specific wallet or set chainId/domain.
|
|
6122
6122
|
const evmWalletConfig = ((_a = config.evmWalletConfig) !== null && _a !== void 0 ? _a : {});
|
|
6123
|
-
const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-
|
|
6123
|
+
const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-BNu6Z-iN.js'); });
|
|
6124
6124
|
currentAuthProvider = new InjectedEvmWalletProvider(evmWalletConfig);
|
|
6125
6125
|
break;
|
|
6126
6126
|
}
|
|
@@ -6145,7 +6145,7 @@ async function getAuthProvider(config) {
|
|
|
6145
6145
|
break;
|
|
6146
6146
|
case "guest":
|
|
6147
6147
|
// Anonymous auth: a device-local ed25519 keypair signs the challenge.
|
|
6148
|
-
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider
|
|
6148
|
+
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider--Sqlucfr.js'); })).GuestAuthProvider();
|
|
6149
6149
|
break;
|
|
6150
6150
|
}
|
|
6151
6151
|
if (!currentAuthProvider) {
|
|
@@ -6207,7 +6207,7 @@ async function signInAnonymously() {
|
|
|
6207
6207
|
// Lazy-load the guest provider so its ed25519/web3 dependencies stay out of
|
|
6208
6208
|
// the main bundle for data-only apps. Specifier is a static string literal
|
|
6209
6209
|
// so bundle-splitting can see it.
|
|
6210
|
-
const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider
|
|
6210
|
+
const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider--Sqlucfr.js'); })).GuestAuthProvider();
|
|
6211
6211
|
setAuthLoading(true); // reflect "signing in…" while the guest keypair session is minted
|
|
6212
6212
|
// adoptSessionProvider awaits only getConfig() (already resolved here) and then
|
|
6213
6213
|
// runs every write - provider/method/config/marker/user - in one synchronous
|
|
@@ -6378,7 +6378,7 @@ function ensureSharedWalletLoginReady() {
|
|
|
6378
6378
|
if (!sharedWalletReady) {
|
|
6379
6379
|
sharedWalletReady = (async () => {
|
|
6380
6380
|
await core.getConfig();
|
|
6381
|
-
await Promise.resolve().then(function () { return require('./injected-wallet-provider-
|
|
6381
|
+
await Promise.resolve().then(function () { return require('./injected-wallet-provider-29eTkM-A.js'); });
|
|
6382
6382
|
})().catch((error) => {
|
|
6383
6383
|
sharedWalletReady = null;
|
|
6384
6384
|
throw error;
|
|
@@ -7311,9 +7311,26 @@ async function getReviewCapability(appId, runId, gateId, options) {
|
|
|
7311
7311
|
body: { expectedPreviewUrl: options.expectedPreviewUrl },
|
|
7312
7312
|
});
|
|
7313
7313
|
}
|
|
7314
|
+
/**
|
|
7315
|
+
* Add funds to a run parked for funding. Accounts billed through payer shards refuse it with
|
|
7316
|
+
* `topup_unavailable_payer_shard` (in `details.upstreamCode`): a parked run there holds no money, so the payer adds
|
|
7317
|
+
* credits and submits the build again.
|
|
7318
|
+
*/
|
|
7314
7319
|
async function topup(appId, runId, options) {
|
|
7315
7320
|
return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/topup`, { method: 'POST', body: options });
|
|
7316
7321
|
}
|
|
7322
|
+
/** An image build's verified images and its asset's current release. */
|
|
7323
|
+
async function media(appId, runId) {
|
|
7324
|
+
return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/media`);
|
|
7325
|
+
}
|
|
7326
|
+
/** A short-lived signed URL for one image of an image build (usable directly as an image source). */
|
|
7327
|
+
async function mediaDownloadUrl(appId, runId, artifactId) {
|
|
7328
|
+
return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/media-download-url`, { method: 'POST', body: { artifactId } });
|
|
7329
|
+
}
|
|
7330
|
+
/** Roll back the release an image build published: its asset returns to the release it replaced. */
|
|
7331
|
+
async function rollbackMedia(appId, runId, options = {}) {
|
|
7332
|
+
return requestDevApi(`${appPath(appId)}/${encodeURIComponent(runId)}/media-rollback`, { method: 'POST', body: options.note ? { note: options.note } : {} });
|
|
7333
|
+
}
|
|
7317
7334
|
async function list$1(appId, limit = 20) {
|
|
7318
7335
|
const requestedLimit = Number.isFinite(limit) ? Math.max(1, Math.floor(limit)) : 20;
|
|
7319
7336
|
return requestDevApi(`${appPath(appId)}?limit=${requestedLimit}`);
|
|
@@ -7345,13 +7362,15 @@ const RUN_STATES = [
|
|
|
7345
7362
|
...NON_TERMINAL_STATES,
|
|
7346
7363
|
...TERMINAL_STATES,
|
|
7347
7364
|
];
|
|
7348
|
-
const PARK_REASONS = ['gate', 'funding'];
|
|
7365
|
+
const PARK_REASONS = ['gate', 'funding', 'preview', 'design'];
|
|
7349
7366
|
const FAILURE_REASONS = [
|
|
7350
7367
|
'admission_rejected',
|
|
7351
7368
|
'dispatch_timeout',
|
|
7352
7369
|
'auth_revoked',
|
|
7353
7370
|
'owner_changed',
|
|
7354
7371
|
'policy_changed',
|
|
7372
|
+
'target_retired',
|
|
7373
|
+
'promotion_rejected',
|
|
7355
7374
|
'quarantine_forced',
|
|
7356
7375
|
'bind_failed',
|
|
7357
7376
|
'internal_error',
|
|
@@ -7609,6 +7628,345 @@ function useBuildRun(appId, runId, options) {
|
|
|
7609
7628
|
return { run, events, loading, error };
|
|
7610
7629
|
}
|
|
7611
7630
|
|
|
7631
|
+
const TERMINAL = new Set(['promoted', 'failed', 'canceled', 'rejected', 'expired', 'rebase_required', 'reported']);
|
|
7632
|
+
const KEY = { type: 'string', minLength: 1, maxLength: 256, description: 'A key unique to this intent; retrying with the same key never repeats the action.' };
|
|
7633
|
+
const RUN_ID = { type: 'string', minLength: 1, maxLength: 128, description: 'The build run id media_create or media_edit returned.' };
|
|
7634
|
+
const REGION = {
|
|
7635
|
+
type: 'object',
|
|
7636
|
+
additionalProperties: false,
|
|
7637
|
+
required: ['x', 'y', 'width', 'height'],
|
|
7638
|
+
properties: {
|
|
7639
|
+
x: { type: 'integer', minimum: 0 },
|
|
7640
|
+
y: { type: 'integer', minimum: 0 },
|
|
7641
|
+
width: { type: 'integer', minimum: 1 },
|
|
7642
|
+
height: { type: 'integer', minimum: 1 },
|
|
7643
|
+
},
|
|
7644
|
+
description: 'A rectangle in whole pixels of the image; nothing outside it changes.',
|
|
7645
|
+
};
|
|
7646
|
+
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.' };
|
|
7647
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
7648
|
+
const text = (value, max) => typeof value === 'string' && value.trim().length > 0 && value.length <= max ? value : undefined;
|
|
7649
|
+
const refuse = (code, message, next = ['media_inspect'], retryable = false) => ({ ok: false, code, message, retryable, next });
|
|
7650
|
+
function region(value) {
|
|
7651
|
+
if (!isRecord(value))
|
|
7652
|
+
return undefined;
|
|
7653
|
+
const { x, y, width, height } = value;
|
|
7654
|
+
return [x, y, width, height].every(Number.isSafeInteger) && x >= 0 && y >= 0
|
|
7655
|
+
&& width >= 1 && height >= 1
|
|
7656
|
+
? { x: x, y: y, width: width, height: height }
|
|
7657
|
+
: undefined;
|
|
7658
|
+
}
|
|
7659
|
+
/** A thrown API error, as the tool result the model reads. The developer API answers with a coarse public code and
|
|
7660
|
+
* relays Build's own reason (base_moved, candidate_unknown, media_storage_quota, ...) as details.upstreamCode. */
|
|
7661
|
+
function failure(error) {
|
|
7662
|
+
var _a;
|
|
7663
|
+
const apiError = error;
|
|
7664
|
+
const upstream = (_a = apiError === null || apiError === void 0 ? void 0 : apiError.details) === null || _a === void 0 ? void 0 : _a.upstreamCode;
|
|
7665
|
+
return refuse(typeof upstream === 'string' && /^[a-z][a-z0-9_]{0,79}$/.test(upstream) && upstream !== 'unknown_upstream_error'
|
|
7666
|
+
? upstream
|
|
7667
|
+
: 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);
|
|
7668
|
+
}
|
|
7669
|
+
/** What a run lets an agent do next. */
|
|
7670
|
+
function nextFor(run) {
|
|
7671
|
+
var _a;
|
|
7672
|
+
if ((_a = run.design) === null || _a === void 0 ? void 0 : _a.gate)
|
|
7673
|
+
return ['media_select', 'media_revise', 'media_export'];
|
|
7674
|
+
if (run.state === 'promoted')
|
|
7675
|
+
return ['media_export', 'media_edit', 'media_create'];
|
|
7676
|
+
if (run.state === 'parked' && run.parkReason === 'gate')
|
|
7677
|
+
return ['media_propose', 'media_export'];
|
|
7678
|
+
if (TERMINAL.has(run.state))
|
|
7679
|
+
return ['media_create'];
|
|
7680
|
+
return ['media_inspect'];
|
|
7681
|
+
}
|
|
7682
|
+
function candidateView(candidate) {
|
|
7683
|
+
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 } : {}));
|
|
7684
|
+
}
|
|
7685
|
+
function mediaAgentTools(appId, client = {
|
|
7686
|
+
submit: submit,
|
|
7687
|
+
get: get,
|
|
7688
|
+
decideGate: decideGate,
|
|
7689
|
+
media: media,
|
|
7690
|
+
mediaDownloadUrl: mediaDownloadUrl,
|
|
7691
|
+
}) {
|
|
7692
|
+
const run = async (runId) => (await client.get(appId, runId)).run;
|
|
7693
|
+
const submit = async (options) => {
|
|
7694
|
+
try {
|
|
7695
|
+
const submitted = await client.submit(appId, options);
|
|
7696
|
+
return { ok: true, data: { runId: submitted.runId, status: submitted.status }, next: ['media_inspect'] };
|
|
7697
|
+
}
|
|
7698
|
+
catch (error) {
|
|
7699
|
+
return failure(error);
|
|
7700
|
+
}
|
|
7701
|
+
};
|
|
7702
|
+
/** The open design review of a run, or the refusal that explains why there is none. */
|
|
7703
|
+
const openReview = async (input) => {
|
|
7704
|
+
var _a;
|
|
7705
|
+
const runId = text(input.runId, 128);
|
|
7706
|
+
if (!runId)
|
|
7707
|
+
return refuse('input_invalid', 'runId is required.');
|
|
7708
|
+
let current;
|
|
7709
|
+
try {
|
|
7710
|
+
current = await run(runId);
|
|
7711
|
+
}
|
|
7712
|
+
catch (error) {
|
|
7713
|
+
return failure(error);
|
|
7714
|
+
}
|
|
7715
|
+
const gate = (_a = current.design) === null || _a === void 0 ? void 0 : _a.gate;
|
|
7716
|
+
if (!gate) {
|
|
7717
|
+
return refuse('no_open_review', `Run ${runId} is ${current.state}${current.parkReason ? ` (${current.parkReason})` : ''}; no design round is waiting for a decision.`, nextFor(current));
|
|
7718
|
+
}
|
|
7719
|
+
return { run: current, gateId: gate.gateId };
|
|
7720
|
+
};
|
|
7721
|
+
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); };
|
|
7722
|
+
return [
|
|
7723
|
+
{
|
|
7724
|
+
name: 'media_create',
|
|
7725
|
+
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).',
|
|
7726
|
+
inputSchema: {
|
|
7727
|
+
type: 'object',
|
|
7728
|
+
additionalProperties: false,
|
|
7729
|
+
required: ['kind', 'prompt', 'idempotencyKey'],
|
|
7730
|
+
properties: {
|
|
7731
|
+
kind: { type: 'string', enum: ['image', 'video'] },
|
|
7732
|
+
prompt: { type: 'string', minLength: 1, maxLength: 4000, description: 'What to make.' },
|
|
7733
|
+
spec: SPEC,
|
|
7734
|
+
forkOf: {
|
|
7735
|
+
type: 'object',
|
|
7736
|
+
additionalProperties: false,
|
|
7737
|
+
required: ['assetId', 'releaseId'],
|
|
7738
|
+
properties: { assetId: { type: 'string' }, releaseId: { type: 'string' } },
|
|
7739
|
+
description: 'A retained release of this app to start from.',
|
|
7740
|
+
},
|
|
7741
|
+
idempotencyKey: KEY,
|
|
7742
|
+
},
|
|
7743
|
+
},
|
|
7744
|
+
async execute(raw) {
|
|
7745
|
+
const input = isRecord(raw) ? raw : {};
|
|
7746
|
+
const prompt = text(input.prompt, 4000);
|
|
7747
|
+
const key = text(input.idempotencyKey, 256);
|
|
7748
|
+
if ((input.kind !== 'image' && input.kind !== 'video') || !prompt || !key) {
|
|
7749
|
+
return refuse('input_invalid', 'kind (image or video), prompt and idempotencyKey are required.', []);
|
|
7750
|
+
}
|
|
7751
|
+
return submit({
|
|
7752
|
+
operation: 'create',
|
|
7753
|
+
prompt,
|
|
7754
|
+
deliverable: Object.assign(Object.assign({ kind: input.kind }, (isRecord(input.spec) ? { spec: input.spec } : {})), (isRecord(input.forkOf) ? { forkOf: input.forkOf } : {})),
|
|
7755
|
+
idempotencyKey: key,
|
|
7756
|
+
});
|
|
7757
|
+
},
|
|
7758
|
+
},
|
|
7759
|
+
{
|
|
7760
|
+
name: 'media_edit',
|
|
7761
|
+
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.',
|
|
7762
|
+
inputSchema: {
|
|
7763
|
+
type: 'object',
|
|
7764
|
+
additionalProperties: false,
|
|
7765
|
+
required: ['kind', 'assetId', 'expectedReleaseId', 'prompt', 'idempotencyKey'],
|
|
7766
|
+
properties: {
|
|
7767
|
+
kind: { type: 'string', enum: ['image', 'video'] },
|
|
7768
|
+
assetId: { type: 'string' },
|
|
7769
|
+
expectedReleaseId: { type: 'string' },
|
|
7770
|
+
prompt: { type: 'string', minLength: 1, maxLength: 4000, description: 'The change to make.' },
|
|
7771
|
+
spec: SPEC,
|
|
7772
|
+
idempotencyKey: KEY,
|
|
7773
|
+
},
|
|
7774
|
+
},
|
|
7775
|
+
async execute(raw) {
|
|
7776
|
+
const input = isRecord(raw) ? raw : {};
|
|
7777
|
+
const prompt = text(input.prompt, 4000);
|
|
7778
|
+
const key = text(input.idempotencyKey, 256);
|
|
7779
|
+
const assetId = text(input.assetId, 128);
|
|
7780
|
+
const expectedReleaseId = text(input.expectedReleaseId, 128);
|
|
7781
|
+
if ((input.kind !== 'image' && input.kind !== 'video') || !prompt || !key || !assetId || !expectedReleaseId) {
|
|
7782
|
+
return refuse('input_invalid', 'kind, assetId, expectedReleaseId, prompt and idempotencyKey are required.', []);
|
|
7783
|
+
}
|
|
7784
|
+
return submit({
|
|
7785
|
+
operation: 'edit',
|
|
7786
|
+
prompt,
|
|
7787
|
+
deliverable: Object.assign({ kind: input.kind, assetId,
|
|
7788
|
+
expectedReleaseId }, (isRecord(input.spec) ? { spec: input.spec } : {})),
|
|
7789
|
+
idempotencyKey: key,
|
|
7790
|
+
});
|
|
7791
|
+
},
|
|
7792
|
+
},
|
|
7793
|
+
{
|
|
7794
|
+
name: 'media_inspect',
|
|
7795
|
+
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.',
|
|
7796
|
+
inputSchema: { type: 'object', additionalProperties: false, required: ['runId'], properties: { runId: RUN_ID } },
|
|
7797
|
+
async execute(raw) {
|
|
7798
|
+
var _a, _b, _c, _d, _e;
|
|
7799
|
+
const runId = text(isRecord(raw) ? raw.runId : undefined, 128);
|
|
7800
|
+
if (!runId)
|
|
7801
|
+
return refuse('input_invalid', 'runId is required.', []);
|
|
7802
|
+
try {
|
|
7803
|
+
const current = await run(runId);
|
|
7804
|
+
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); });
|
|
7805
|
+
const media = current.state === 'promoted' || current.media ? await client.media(appId, runId) : undefined;
|
|
7806
|
+
return {
|
|
7807
|
+
ok: true,
|
|
7808
|
+
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
|
|
7809
|
+
? 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'
|
|
7810
|
+
? { waitingFor: 'funding: the payer adds funds and, where top-up is unavailable (topup_unavailable_payer_shard), submits the build again; an agent cannot' }
|
|
7811
|
+
: {})), (media ? { media: media.media, asset: media.asset } : {})),
|
|
7812
|
+
next: nextFor(current),
|
|
7813
|
+
};
|
|
7814
|
+
}
|
|
7815
|
+
catch (error) {
|
|
7816
|
+
return failure(error);
|
|
7817
|
+
}
|
|
7818
|
+
},
|
|
7819
|
+
},
|
|
7820
|
+
{
|
|
7821
|
+
name: 'media_revise',
|
|
7822
|
+
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.',
|
|
7823
|
+
inputSchema: {
|
|
7824
|
+
type: 'object',
|
|
7825
|
+
additionalProperties: false,
|
|
7826
|
+
required: ['runId', 'feedback', 'idempotencyKey'],
|
|
7827
|
+
properties: {
|
|
7828
|
+
runId: RUN_ID,
|
|
7829
|
+
feedback: { type: 'string', minLength: 1, maxLength: 4000, description: 'What to change.' },
|
|
7830
|
+
candidateId: { type: 'string', description: 'The candidate to revise; without it the whole round is redone from the feedback.' },
|
|
7831
|
+
sceneIds: { type: 'array', items: { type: 'string' }, minItems: 1, maxItems: 6 },
|
|
7832
|
+
region: REGION,
|
|
7833
|
+
idempotencyKey: KEY,
|
|
7834
|
+
},
|
|
7835
|
+
},
|
|
7836
|
+
async execute(raw) {
|
|
7837
|
+
var _a, _b;
|
|
7838
|
+
const input = isRecord(raw) ? raw : {};
|
|
7839
|
+
const feedback = text(input.feedback, 4000);
|
|
7840
|
+
const key = text(input.idempotencyKey, 256);
|
|
7841
|
+
if (!feedback || !key)
|
|
7842
|
+
return refuse('input_invalid', 'runId, feedback and idempotencyKey are required.', []);
|
|
7843
|
+
const review = await openReview(input);
|
|
7844
|
+
if ('ok' in review)
|
|
7845
|
+
return review;
|
|
7846
|
+
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'))) {
|
|
7847
|
+
return refuse('decision_not_allowed', 'This round takes no revision (it may be the last one): select a candidate instead.', ['media_select']);
|
|
7848
|
+
}
|
|
7849
|
+
const candidate = input.candidateId === undefined ? undefined : candidateOf(review.run, input.candidateId);
|
|
7850
|
+
if (input.candidateId !== undefined && !candidate) {
|
|
7851
|
+
return refuse('candidate_unknown', `No candidate ${String(input.candidateId)} in the round under review.`, ['media_inspect']);
|
|
7852
|
+
}
|
|
7853
|
+
const sceneIds = Array.isArray(input.sceneIds) ? input.sceneIds.filter((id) => typeof id === 'string') : undefined;
|
|
7854
|
+
if (sceneIds && (!(candidate === null || candidate === void 0 ? void 0 : candidate.scenes) || !sceneIds.every((id) => candidate.scenes.some((scene) => scene.id === id)))) {
|
|
7855
|
+
return refuse('scenes_unknown', 'sceneIds must name scenes of the multi-scene candidate being revised (candidateId).', ['media_inspect']);
|
|
7856
|
+
}
|
|
7857
|
+
const area = input.region === undefined ? undefined : region(input.region);
|
|
7858
|
+
if (input.region !== undefined
|
|
7859
|
+
&& (!area || (candidate === null || candidate === void 0 ? void 0 : candidate.mimeType) !== 'image/png' || area.x + area.width > candidate.width || area.y + area.height > candidate.height)) {
|
|
7860
|
+
return refuse('region_invalid', 'region must lie inside the PNG candidate being revised (candidateId).', ['media_inspect']);
|
|
7861
|
+
}
|
|
7862
|
+
try {
|
|
7863
|
+
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 }));
|
|
7864
|
+
return { ok: true, data: { runId: review.run.runId, state: decided.state }, next: ['media_inspect'] };
|
|
7865
|
+
}
|
|
7866
|
+
catch (error) {
|
|
7867
|
+
return failure(error);
|
|
7868
|
+
}
|
|
7869
|
+
},
|
|
7870
|
+
},
|
|
7871
|
+
{
|
|
7872
|
+
name: 'media_select',
|
|
7873
|
+
description: 'Choose a candidate of the round under review. The chosen candidate is what the build releases, through the app\'s landing policy.',
|
|
7874
|
+
inputSchema: {
|
|
7875
|
+
type: 'object',
|
|
7876
|
+
additionalProperties: false,
|
|
7877
|
+
required: ['runId', 'candidateId', 'idempotencyKey'],
|
|
7878
|
+
properties: { runId: RUN_ID, candidateId: { type: 'string' }, idempotencyKey: KEY },
|
|
7879
|
+
},
|
|
7880
|
+
async execute(raw) {
|
|
7881
|
+
const input = isRecord(raw) ? raw : {};
|
|
7882
|
+
const key = text(input.idempotencyKey, 256);
|
|
7883
|
+
if (!key)
|
|
7884
|
+
return refuse('input_invalid', 'runId, candidateId and idempotencyKey are required.', []);
|
|
7885
|
+
const review = await openReview(input);
|
|
7886
|
+
if ('ok' in review)
|
|
7887
|
+
return review;
|
|
7888
|
+
const candidate = candidateOf(review.run, input.candidateId);
|
|
7889
|
+
if (!candidate)
|
|
7890
|
+
return refuse('candidate_unknown', `No candidate ${String(input.candidateId)} in the round under review.`, ['media_inspect']);
|
|
7891
|
+
try {
|
|
7892
|
+
const decided = await client.decideGate(appId, review.run.runId, review.gateId, {
|
|
7893
|
+
decision: 'approve',
|
|
7894
|
+
selectedArtifactId: candidate.id,
|
|
7895
|
+
idempotencyKey: key,
|
|
7896
|
+
});
|
|
7897
|
+
return { ok: true, data: { runId: review.run.runId, state: decided.state, selectedArtifactId: candidate.id }, next: ['media_propose', 'media_inspect'] };
|
|
7898
|
+
}
|
|
7899
|
+
catch (error) {
|
|
7900
|
+
return failure(error);
|
|
7901
|
+
}
|
|
7902
|
+
},
|
|
7903
|
+
},
|
|
7904
|
+
{
|
|
7905
|
+
name: 'media_export',
|
|
7906
|
+
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.',
|
|
7907
|
+
inputSchema: {
|
|
7908
|
+
type: 'object',
|
|
7909
|
+
additionalProperties: false,
|
|
7910
|
+
required: ['runId', 'artifactId'],
|
|
7911
|
+
properties: { runId: RUN_ID, artifactId: { type: 'string' } },
|
|
7912
|
+
},
|
|
7913
|
+
async execute(raw) {
|
|
7914
|
+
var _a, _b;
|
|
7915
|
+
const input = isRecord(raw) ? raw : {};
|
|
7916
|
+
const runId = text(input.runId, 128);
|
|
7917
|
+
const artifactId = text(input.artifactId, 64);
|
|
7918
|
+
if (!runId || !artifactId)
|
|
7919
|
+
return refuse('input_invalid', 'runId and artifactId are required.', []);
|
|
7920
|
+
try {
|
|
7921
|
+
const view = await client.media(appId, runId);
|
|
7922
|
+
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);
|
|
7923
|
+
if (!artifact) {
|
|
7924
|
+
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']);
|
|
7925
|
+
}
|
|
7926
|
+
const signed = await client.mediaDownloadUrl(appId, runId, artifactId);
|
|
7927
|
+
return {
|
|
7928
|
+
ok: true,
|
|
7929
|
+
data: { runId, artifactId, url: signed.url, expiresAtMs: signed.expiresAtMs, sha256: artifact.sha256, mimeType: artifact.mimeType, bytes: artifact.bytes },
|
|
7930
|
+
next: ['media_inspect'],
|
|
7931
|
+
};
|
|
7932
|
+
}
|
|
7933
|
+
catch (error) {
|
|
7934
|
+
return failure(error);
|
|
7935
|
+
}
|
|
7936
|
+
},
|
|
7937
|
+
},
|
|
7938
|
+
{
|
|
7939
|
+
name: 'media_propose',
|
|
7940
|
+
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.',
|
|
7941
|
+
inputSchema: { type: 'object', additionalProperties: false, required: ['runId'], properties: { runId: RUN_ID } },
|
|
7942
|
+
async execute(raw) {
|
|
7943
|
+
var _a;
|
|
7944
|
+
const runId = text(isRecord(raw) ? raw.runId : undefined, 128);
|
|
7945
|
+
if (!runId)
|
|
7946
|
+
return refuse('input_invalid', 'runId is required.', []);
|
|
7947
|
+
try {
|
|
7948
|
+
const current = await run(runId);
|
|
7949
|
+
if (current.state === 'promoted') {
|
|
7950
|
+
const view = await client.media(appId, runId);
|
|
7951
|
+
return { ok: true, data: { runId, state: 'published', release: view.asset.currentRelease }, next: nextFor(current) };
|
|
7952
|
+
}
|
|
7953
|
+
if (current.state === 'parked' && current.parkReason === 'gate') {
|
|
7954
|
+
const gate = current.gates.find((entry) => !entry.decided);
|
|
7955
|
+
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'] };
|
|
7956
|
+
}
|
|
7957
|
+
if ((_a = current.design) === null || _a === void 0 ? void 0 : _a.gate) {
|
|
7958
|
+
return refuse('not_selected', 'Choose a candidate first (media_select); only a chosen candidate can be published.', ['media_select', 'media_revise']);
|
|
7959
|
+
}
|
|
7960
|
+
return refuse('not_proposable', `Run ${runId} is ${current.state}${current.parkReason ? ` (${current.parkReason})` : ''}; it has no candidate waiting for publication.`, nextFor(current));
|
|
7961
|
+
}
|
|
7962
|
+
catch (error) {
|
|
7963
|
+
return failure(error);
|
|
7964
|
+
}
|
|
7965
|
+
},
|
|
7966
|
+
},
|
|
7967
|
+
];
|
|
7968
|
+
}
|
|
7969
|
+
|
|
7612
7970
|
/**
|
|
7613
7971
|
* Registered first-party product surfaces only, with
|
|
7614
7972
|
* one exact Drafted exception for delegated review/decision routes. Other
|
|
@@ -7626,6 +7984,9 @@ const builds = {
|
|
|
7626
7984
|
uploadInput,
|
|
7627
7985
|
list: list$1,
|
|
7628
7986
|
watch,
|
|
7987
|
+
media,
|
|
7988
|
+
mediaDownloadUrl,
|
|
7989
|
+
rollbackMedia,
|
|
7629
7990
|
};
|
|
7630
7991
|
|
|
7631
7992
|
async function create(options = {}) {
|
|
@@ -8377,6 +8738,7 @@ exports.loginWithPopup = loginWithPopup;
|
|
|
8377
8738
|
exports.loginWithPrivy = loginWithPrivy;
|
|
8378
8739
|
exports.loginWithRedirect = loginWithRedirect;
|
|
8379
8740
|
exports.logout = logout;
|
|
8741
|
+
exports.mediaAgentTools = mediaAgentTools;
|
|
8380
8742
|
exports.normalizeSolanaRpcUrl = normalizeSolanaRpcUrl;
|
|
8381
8743
|
exports.onAuthLoadingChanged = onAuthLoadingChanged;
|
|
8382
8744
|
exports.onAuthStateChanged = onAuthStateChanged;
|
|
@@ -8400,4 +8762,4 @@ exports.useAuth = useAuth;
|
|
|
8400
8762
|
exports.useBuildRun = useBuildRun;
|
|
8401
8763
|
exports.useQuery = useQuery;
|
|
8402
8764
|
exports.waitForAuthReady = waitForAuthReady;
|
|
8403
|
-
//# sourceMappingURL=index.native-
|
|
8765
|
+
//# sourceMappingURL=index.native-PGrxu7RO.js.map
|