@anna-ai/cli 0.1.33 → 0.1.35
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/dist/{_lifecycle-shared-CUK2CE76.js → _lifecycle-shared-RyiRITI5.js} +4 -2
- package/dist/{account-bqao7Gp5.js → account-B4rdVDyg.js} +1 -1
- package/dist/{agent-CzPryLi6.js → agent-DAOr_aiE.js} +1 -1
- package/dist/{app-bundle-upload-CqT9KUOl.js → app-bundle-upload-DmVKWAj9.js} +3 -3
- package/dist/{apps-dvknZYI2.js → apps-C_Oln_om.js} +1 -1
- package/dist/apps-cut-MjSe2ph7.js +159 -0
- package/dist/{apps-destructive-B6RFjokU.js → apps-destructive-a2YBmWFm.js} +2 -2
- package/dist/{apps-discard-hVZxAQyj.js → apps-discard-BWLVVMu7.js} +12 -10
- package/dist/{apps-grants-DnXCnkH5.js → apps-grants-lmllFB02.js} +1 -1
- package/dist/{apps-publish-BKqVsS1W.js → apps-publish--EmBa0zN.js} +8 -7
- package/dist/apps-publish-B7reDBe1.js +17 -0
- package/dist/{apps-push-B3wZr9B4.js → apps-push-CkJ1gtpy.js} +16 -12
- package/dist/{apps-release-CyAPmWPU.js → apps-release-J-Sjkoym.js} +3 -3
- package/dist/{apps-rename-slug-D2BrWasG.js → apps-rename-slug-DYrk4Zpt.js} +3 -3
- package/dist/{apps-status-DV8V_y35.js → apps-status-CcCoYu6i.js} +1 -1
- package/dist/{apps-submit-review-DMFQI8JZ.js → apps-submit-review-DNrQc2ws.js} +2 -2
- package/dist/{apps-sync-meta-BOb6J_wz.js → apps-sync-meta-CL2PCMCv.js} +6 -4
- package/dist/{apps-versions-D1lixrmM.js → apps-versions-2BR8xo7C.js} +1 -1
- package/dist/binary-upload-CKMU5Rfw.js +181 -0
- package/dist/bridge-CzeSuRRL.js +3 -0
- package/dist/{bridge-CbjqAm0H.js → bridge-Dvck0e9c.js} +1 -1
- package/dist/{bundled-executas-06keEPP_.js → bundled-executas-Bp9Z6aiR.js} +1 -1
- package/dist/cli.js +80 -44
- package/dist/dev-CZLOk2qE.js +4 -0
- package/dist/{dev-Re6NyNDS.js → dev-GUFWek03.js} +5 -5
- package/dist/{dev-app-cache-Dv1dZ_bw.js → dev-app-cache-B3Wa5t6X.js} +18 -3
- package/dist/{doctor-VrfEkedz.js → doctor-C3Nx8E2L.js} +1 -1
- package/dist/{executa-cache-B0O79Hpb.js → executa-cache-WBkCLic7.js} +1 -1
- package/dist/{executa-destructive-Bz7vWxEO.js → executa-destructive-DCfQ1ez5.js} +3 -3
- package/dist/{executa-dev-B5Uz982M.js → executa-dev-CAw5X64R.js} +8 -8
- package/dist/{executa-install-BW9jjY7u.js → executa-install-Dz7hBUsn.js} +2 -2
- package/dist/executa-install-nOFLBwxv.js +7 -0
- package/dist/executa-publish-B_7k1gOf.js +11 -0
- package/dist/{executa-publish-Ah6J7jYd.js → executa-publish-kh4Ucd3o.js} +21 -5
- package/dist/{executa-reads-BXDJWWw6.js → executa-reads-BmwT_Yjp.js} +2 -2
- package/dist/executa-trusted-publisher-tVwzjI2d.js +91 -0
- package/dist/executa-upload-binaries-DURJTXRI.js +277 -0
- package/dist/executa-upload-binaries-DrwpzQp3.js +9 -0
- package/dist/{listing-meta-BlY7XMrw.js → listing-meta-CtVtyaWu.js} +13 -4
- package/dist/{manifest-DOMrcdCK.js → manifest-CAF3_r1T.js} +88 -11
- package/dist/{publish-GpvkaBIx.js → publish-DwIJWl46.js} +12 -10
- package/dist/{server-BMcGaUTy.js → server-BHWGGZsf.js} +1 -1
- package/dist/{storage-BkF4XyI0.js → storage-aii8EyPC.js} +1 -1
- package/dist/{token-uedeaAy7.js → token-COnYMRB-.js} +1 -1
- package/dist/{working-orchestration-1jzRuk34.js → working-orchestration-D7cW2Bf2.js} +7 -6
- package/package.json +1 -1
- package/dist/apps-cut-8870xpk-.js +0 -86
- package/dist/apps-publish-Djpw5cfG.js +0 -15
- package/dist/bridge-CzHB_IsQ.js +0 -3
- package/dist/dev-C3yWhzAp.js +0 -4
- package/dist/executa-install-Cyid8R7r.js +0 -7
- package/dist/executa-publish-DI_6M_ea.js +0 -9
- /package/dist/{app-cache-BqnTkxUw.js → app-cache-Cr3tKbux.js} +0 -0
- /package/dist/{bundled-executas-_H1A9M50.js → bundled-executas-rSIkaA6-.js} +0 -0
- /package/dist/{confirm-BuT56E_B.js → confirm-BSoOy1X2.js} +0 -0
- /package/dist/{dev-account-DqEFCmVg.js → dev-account-CfVdGa9j.js} +0 -0
- /package/dist/{executa-cache-Do1D7xC0.js → executa-cache-BFoUtb4J.js} +0 -0
- /package/dist/{executa-init-D-kWINZ3.js → executa-init-DKy7DMSD.js} +0 -0
- /package/dist/{executa-register-D5kvSSz_.js → executa-register-CmqKsoAU.js} +0 -0
- /package/dist/{executas-BhFed1B-.js → executas-CvQY_w2U.js} +0 -0
- /package/dist/{fixture-BUKQYR5e.js → fixture-BF1Z0Rry.js} +0 -0
- /package/dist/{host_upload-BVzAqvX1.js → host_upload-DrbQ-vk2.js} +0 -0
- /package/dist/{image-BLPyUbGQ.js → image-B4UrufYH.js} +0 -0
- /package/dist/{login-DhgBgsfx.js → login-DbETuUxy.js} +0 -0
- /package/dist/{logout-VYDkLYAx.js → logout-BzIEf-HU.js} +0 -0
- /package/dist/{runner-BxYjAmih.js → runner-Bka_coxb.js} +0 -0
- /package/dist/{sampling-XBIEYU4A.js → sampling-BpJcd6BC.js} +0 -0
- /package/dist/{whoami-C_x26b_k.js → whoami-Bn38ns8r.js} +0 -0
|
@@ -11,7 +11,8 @@ function resolveClient(opts = {}) {
|
|
|
11
11
|
return {
|
|
12
12
|
client: new NexusClient({
|
|
13
13
|
host,
|
|
14
|
-
pat: envPat
|
|
14
|
+
pat: envPat,
|
|
15
|
+
fetchImpl: opts.fetchImpl
|
|
15
16
|
}),
|
|
16
17
|
host,
|
|
17
18
|
source: "env"
|
|
@@ -22,7 +23,8 @@ function resolveClient(opts = {}) {
|
|
|
22
23
|
return {
|
|
23
24
|
client: new NexusClient({
|
|
24
25
|
host: acc.host,
|
|
25
|
-
pat: acc.pat
|
|
26
|
+
pat: acc.pat,
|
|
27
|
+
fetchImpl: opts.fetchImpl
|
|
26
28
|
}),
|
|
27
29
|
host: acc.host,
|
|
28
30
|
source: "credentials"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import { setDeveloperHandle } from "./apps-DlVsVHQ5.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import { reportError, resolveClient } from "./_lifecycle-shared-
|
|
4
|
+
import { reportError, resolveClient } from "./_lifecycle-shared-RyiRITI5.js";
|
|
5
5
|
import { bold, dim, green, red } from "kleur/colors";
|
|
6
6
|
|
|
7
7
|
//#region src/commands/account.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { canonicalHost } from "./credentials-BTv2IfUZ.js";
|
|
2
|
-
import { hostOf, mintAppSession, requireAccount, withCode } from "./dev-account-
|
|
2
|
+
import { hostOf, mintAppSession, requireAccount, withCode } from "./dev-account-CfVdGa9j.js";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { finalizeBundle, finalizeWorkingBundle, getBundle, initBundle, initWorkingBundle, uploadBundleFile, uploadWorkingBundleFile } from "./apps-DlVsVHQ5.js";
|
|
2
2
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
3
|
-
import { canonicalize } from "./executa-publish-
|
|
3
|
+
import { canonicalize } from "./executa-publish-kh4Ucd3o.js";
|
|
4
4
|
import { join, relative, sep } from "node:path";
|
|
5
5
|
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
@@ -28,8 +28,8 @@ const CONTENT_TYPES = {
|
|
|
28
28
|
txt: "text/plain",
|
|
29
29
|
md: "text/markdown"
|
|
30
30
|
};
|
|
31
|
-
const MAX_TOTAL_BYTES =
|
|
32
|
-
const MAX_FILE_BYTES =
|
|
31
|
+
const MAX_TOTAL_BYTES = 1024 * 1024 * 1024;
|
|
32
|
+
const MAX_FILE_BYTES = 100 * 1024 * 1024;
|
|
33
33
|
const MAX_FILES = 2e3;
|
|
34
34
|
const UPLOAD_PARALLEL = 4;
|
|
35
35
|
function guessContentType(name) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import { listMyApps } from "./apps-DlVsVHQ5.js";
|
|
3
3
|
import "./client-D-_z1ALk.js";
|
|
4
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
4
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
5
5
|
import { bold, cyan, dim, green, magenta, red, yellow } from "kleur/colors";
|
|
6
6
|
|
|
7
7
|
//#region src/commands/apps.ts
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { canonicalHost } from "./credentials-BTv2IfUZ.js";
|
|
2
|
+
import "./nexus-root-BlPwOusj.js";
|
|
3
|
+
import { cutWorkingDraft } from "./apps-DlVsVHQ5.js";
|
|
4
|
+
import { CliError } from "./client-D-_z1ALk.js";
|
|
5
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
6
|
+
import { readExecutaIdentity } from "./executa-cache-BFoUtb4J.js";
|
|
7
|
+
import { readExecutasLock, writeExecutasLock } from "./bundled-executas-rSIkaA6-.js";
|
|
8
|
+
import { loadAppManifest, loadExecutaManifest } from "./manifest-CAF3_r1T.js";
|
|
9
|
+
import "./executas-CvQY_w2U.js";
|
|
10
|
+
import "./executa-publish-kh4Ucd3o.js";
|
|
11
|
+
import "./binary-upload-CKMU5Rfw.js";
|
|
12
|
+
import { uploadExecutaBinaries } from "./executa-upload-binaries-DURJTXRI.js";
|
|
13
|
+
import "./dev-GUFWek03.js";
|
|
14
|
+
import "./executa-install-Dz7hBUsn.js";
|
|
15
|
+
import "./app-cache-Cr3tKbux.js";
|
|
16
|
+
import { resolveAppBySlugOrCache } from "./working-orchestration-D7cW2Bf2.js";
|
|
17
|
+
import { resolve } from "node:path";
|
|
18
|
+
import { existsSync } from "node:fs";
|
|
19
|
+
import { bold, cyan, dim, green, yellow } from "kleur/colors";
|
|
20
|
+
|
|
21
|
+
//#region src/commands/apps-cut.ts
|
|
22
|
+
/**
|
|
23
|
+
* Pre-cut step (design executa-binary-direct-upload.md §7.3): every bundled
|
|
24
|
+
* executa that declares `distribution.binary_artifacts` gets its bytes
|
|
25
|
+
* pushed to the platform BEFORE the freeze, so the server-side executa
|
|
26
|
+
* version snapshot pins CDN URLs + sha256 (and `ensure_binaries_ready`
|
|
27
|
+
* passes without any pull-mirror fetch). Content-addressed idempotency
|
|
28
|
+
* makes re-cuts free: an already-published artifact set is all-`exists`.
|
|
29
|
+
*
|
|
30
|
+
* Executas using `binary_urls` (pull-mirror track) or no distribution are
|
|
31
|
+
* untouched. Missing tool_id (never pushed) is a hard error — the freeze
|
|
32
|
+
* would fail anyway, so surface the actionable message here.
|
|
33
|
+
*/
|
|
34
|
+
async function preUploadBundledBinaries(params) {
|
|
35
|
+
const { client, host, cwd, dryRun, json } = params;
|
|
36
|
+
const log = (msg) => {
|
|
37
|
+
if (!json) console.log(msg);
|
|
38
|
+
};
|
|
39
|
+
if (!existsSync(resolve(cwd, "manifest.json"))) return;
|
|
40
|
+
let appManifest;
|
|
41
|
+
try {
|
|
42
|
+
appManifest = loadAppManifest(cwd);
|
|
43
|
+
} catch {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (appManifest.bundledExecutas.length === 0) return;
|
|
47
|
+
const lock = readExecutasLock(cwd, host);
|
|
48
|
+
for (const decl of appManifest.bundledExecutas) {
|
|
49
|
+
const dir = resolve(cwd, decl.path);
|
|
50
|
+
let exManifest;
|
|
51
|
+
try {
|
|
52
|
+
exManifest = loadExecutaManifest(dir);
|
|
53
|
+
} catch {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const artifacts = exManifest.distribution?.binaryArtifacts;
|
|
57
|
+
if (!artifacts || Object.keys(artifacts).length === 0) {
|
|
58
|
+
if (exManifest.distribution?.type === "binary" && exManifest.distribution?.binaryUrls) log(yellow(`! "${decl.handle}" uses binary_urls (pull-mirror): the platform must be able to GET these URLs anonymously at cut/release. Private source URLs are deprecated — switch to binary_artifacts (direct upload) if the source is private.`));
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const identity = readExecutaIdentity(dir);
|
|
62
|
+
const toolId = (identity && identity.host === canonicalHost(host) ? identity.tool_id : void 0) ?? lock?.executas[decl.handle]?.tool_id;
|
|
63
|
+
if (!toolId) throw new CliError(`bundled executa "${decl.handle}" declares binary_artifacts but has no minted tool_id — run \`anna-app apps push\` once to register it, then re-run cut`, 4);
|
|
64
|
+
if (dryRun) {
|
|
65
|
+
log(yellow(`[dry-run] would upload binary_artifacts for "${decl.handle}" (${toolId})`));
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
log(dim(`↑ uploading binary artifacts for "${decl.handle}" (${toolId})…`));
|
|
69
|
+
const up = await uploadExecutaBinaries({
|
|
70
|
+
client,
|
|
71
|
+
host,
|
|
72
|
+
dir,
|
|
73
|
+
manifest: exManifest,
|
|
74
|
+
toolId,
|
|
75
|
+
fetchImpl: params.fetchImpl,
|
|
76
|
+
log
|
|
77
|
+
});
|
|
78
|
+
log(green(`✓ "${decl.handle}": binaries ready `) + dim(`(${up.uploaded.length} uploaded, ${up.skipped.length} cached)`));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function runAppsCut(opts) {
|
|
82
|
+
return withErrorHandling(async () => {
|
|
83
|
+
const { client, host } = resolveClient({
|
|
84
|
+
account: opts.account,
|
|
85
|
+
fetchImpl: opts.fetchImpl
|
|
86
|
+
});
|
|
87
|
+
const app = await resolveAppBySlugOrCache(client, host, {
|
|
88
|
+
slug: opts.slug,
|
|
89
|
+
cwd: opts.cwd
|
|
90
|
+
});
|
|
91
|
+
await preUploadBundledBinaries({
|
|
92
|
+
client,
|
|
93
|
+
host,
|
|
94
|
+
cwd: resolve(opts.cwd ?? process.cwd()),
|
|
95
|
+
dryRun: opts.dryRun === true,
|
|
96
|
+
json: opts.json === true,
|
|
97
|
+
fetchImpl: opts.fetchImpl
|
|
98
|
+
});
|
|
99
|
+
if (opts.dryRun) {
|
|
100
|
+
if (!opts.json) console.log(yellow(`[dry-run] would cut version ${opts.version} for apps/${app.slug} (app_id=${app.id})`));
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
let result;
|
|
104
|
+
try {
|
|
105
|
+
result = await cutWorkingDraft(client, app.id, {
|
|
106
|
+
version: opts.version,
|
|
107
|
+
changelog: opts.changelog
|
|
108
|
+
});
|
|
109
|
+
} catch (e) {
|
|
110
|
+
if (e instanceof CliError && e.status === 409) throw new CliError(`version ${opts.version} already cut for apps/${app.slug}; choose a higher SemVer (e.g. bump patch/minor) and retry`, 9);
|
|
111
|
+
if (e instanceof CliError && (e.status === 400 || e.status === 422)) throw new CliError(`cannot cut: ${e.message} — fix the working draft and \`apps push\` again`, 4);
|
|
112
|
+
throw e;
|
|
113
|
+
}
|
|
114
|
+
if (result.frozen_executas.length > 0) {
|
|
115
|
+
const cwd = resolve(opts.cwd ?? process.cwd());
|
|
116
|
+
const lock = readExecutasLock(cwd, host);
|
|
117
|
+
if (lock) {
|
|
118
|
+
const byToolId = new Map(Object.entries(lock.executas).map(([h, e]) => [e.tool_id, h]));
|
|
119
|
+
for (const fr of result.frozen_executas) {
|
|
120
|
+
const handle = byToolId.get(fr.tool_id);
|
|
121
|
+
if (handle && lock.executas[handle]) lock.executas[handle] = {
|
|
122
|
+
...lock.executas[handle],
|
|
123
|
+
tool_id: fr.tool_id,
|
|
124
|
+
source: "cut"
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
writeExecutasLock(cwd, {
|
|
128
|
+
$schema: "anna-executas-lock/v1",
|
|
129
|
+
host: canonicalHost(host),
|
|
130
|
+
executas: lock.executas
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (opts.json) {
|
|
135
|
+
console.log(JSON.stringify({
|
|
136
|
+
app_id: app.id,
|
|
137
|
+
slug: app.slug,
|
|
138
|
+
host,
|
|
139
|
+
version_id: result.version_id,
|
|
140
|
+
version: result.version,
|
|
141
|
+
frozen_executas: result.frozen_executas,
|
|
142
|
+
bundle: result.bundle
|
|
143
|
+
}, null, 2));
|
|
144
|
+
return 0;
|
|
145
|
+
}
|
|
146
|
+
console.log(green(`✓ apps/${app.slug}: cut immutable version ${result.version} `) + dim(`(version_id=${result.version_id})`));
|
|
147
|
+
for (const fr of result.frozen_executas) console.log(dim(` froze ${fr.tool_id} → executa_version=${fr.executa_version_id}`) + (fr.version ? dim(` (v${fr.version})`) : ""));
|
|
148
|
+
if (result.bundle && typeof result.bundle === "object") {
|
|
149
|
+
const prefix = result.bundle.object_prefix;
|
|
150
|
+
if (prefix) console.log(dim(` bundle frozen at ${prefix}`));
|
|
151
|
+
}
|
|
152
|
+
console.log(dim(`→ run `) + cyan(`anna-app apps release ${result.version}`) + dim(` to go live`));
|
|
153
|
+
console.log(bold(cyan(`status: ${app.status}`)));
|
|
154
|
+
return 0;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
export { runAppsCut };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import { archiveApp, deleteApp, findAppBySlug, unarchiveApp, unpublishApp } from "./apps-DlVsVHQ5.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
5
|
-
import { ensureDestructiveAllowed } from "./confirm-
|
|
4
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
5
|
+
import { ensureDestructiveAllowed } from "./confirm-BSoOy1X2.js";
|
|
6
6
|
import { dim, green, yellow } from "kleur/colors";
|
|
7
7
|
|
|
8
8
|
//#region src/commands/apps-destructive.ts
|
|
@@ -2,16 +2,18 @@ import "./credentials-BTv2IfUZ.js";
|
|
|
2
2
|
import "./nexus-root-BlPwOusj.js";
|
|
3
3
|
import { deleteWorkingDraft, getWorkingDraft } from "./apps-DlVsVHQ5.js";
|
|
4
4
|
import "./client-D-_z1ALk.js";
|
|
5
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
6
|
-
import "./
|
|
7
|
-
import "./executas-
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
11
|
-
import "./
|
|
12
|
-
import "./executa-
|
|
13
|
-
import "./
|
|
14
|
-
import
|
|
5
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
6
|
+
import "./executa-cache-BFoUtb4J.js";
|
|
7
|
+
import "./bundled-executas-rSIkaA6-.js";
|
|
8
|
+
import "./manifest-CAF3_r1T.js";
|
|
9
|
+
import "./executas-CvQY_w2U.js";
|
|
10
|
+
import "./executa-publish-kh4Ucd3o.js";
|
|
11
|
+
import "./binary-upload-CKMU5Rfw.js";
|
|
12
|
+
import "./executa-upload-binaries-DURJTXRI.js";
|
|
13
|
+
import "./dev-GUFWek03.js";
|
|
14
|
+
import "./executa-install-Dz7hBUsn.js";
|
|
15
|
+
import "./app-cache-Cr3tKbux.js";
|
|
16
|
+
import { resolveAppBySlugOrCache } from "./working-orchestration-D7cW2Bf2.js";
|
|
15
17
|
import { dim, green, yellow } from "kleur/colors";
|
|
16
18
|
|
|
17
19
|
//#region src/commands/apps-discard.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import { findAppBySlug, getAppGrants } from "./apps-DlVsVHQ5.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
4
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
5
5
|
import { bold, cyan, dim } from "kleur/colors";
|
|
6
6
|
|
|
7
7
|
//#region src/commands/apps-grants.ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { canonicalHost } from "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import { createApp, createVersion, findAppBySlug, getApp } from "./apps-DlVsVHQ5.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
5
|
-
import { parseExecutaIdOverrides, readExecutasLock, substituteBundledRefs, validateBundledHandles, writeBundleToolIdSidecar, writeExecutasLock } from "./bundled-executas-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { appCacheMatches, readAppIdentity, writeAppIdentity } from "./app-cache-
|
|
9
|
-
import { syncAppListingMeta } from "./listing-meta-
|
|
10
|
-
import { isExistingDir, uploadAppBundle } from "./app-bundle-upload-
|
|
4
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
5
|
+
import { parseExecutaIdOverrides, readExecutasLock, substituteBundledRefs, validateBundledHandles, writeBundleToolIdSidecar, writeExecutasLock } from "./bundled-executas-rSIkaA6-.js";
|
|
6
|
+
import { loadAppManifest } from "./manifest-CAF3_r1T.js";
|
|
7
|
+
import { bumpVersion, bundleHash, manifestHash, rewriteVersion, runExecutaPublish } from "./executa-publish-kh4Ucd3o.js";
|
|
8
|
+
import { appCacheMatches, readAppIdentity, writeAppIdentity } from "./app-cache-Cr3tKbux.js";
|
|
9
|
+
import { syncAppListingMeta } from "./listing-meta-CtVtyaWu.js";
|
|
10
|
+
import { isExistingDir, uploadAppBundle } from "./app-bundle-upload-DmVKWAj9.js";
|
|
11
11
|
import { resolve } from "node:path";
|
|
12
12
|
import { bold, cyan, dim, green, yellow } from "kleur/colors";
|
|
13
13
|
|
|
@@ -75,6 +75,7 @@ async function runAppsPublish(opts) {
|
|
|
75
75
|
cwd: execCwd,
|
|
76
76
|
account: opts.account,
|
|
77
77
|
quiet: true,
|
|
78
|
+
profile: opts.profile,
|
|
78
79
|
capture: (r) => {
|
|
79
80
|
captured = r;
|
|
80
81
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "./credentials-BTv2IfUZ.js";
|
|
2
|
+
import "./apps-DlVsVHQ5.js";
|
|
3
|
+
import "./client-D-_z1ALk.js";
|
|
4
|
+
import "./_lifecycle-shared-RyiRITI5.js";
|
|
5
|
+
import "./executa-cache-BFoUtb4J.js";
|
|
6
|
+
import "./bundled-executas-rSIkaA6-.js";
|
|
7
|
+
import "./manifest-CAF3_r1T.js";
|
|
8
|
+
import "./executas-CvQY_w2U.js";
|
|
9
|
+
import "./executa-publish-kh4Ucd3o.js";
|
|
10
|
+
import "./binary-upload-CKMU5Rfw.js";
|
|
11
|
+
import "./executa-upload-binaries-DURJTXRI.js";
|
|
12
|
+
import "./app-cache-Cr3tKbux.js";
|
|
13
|
+
import "./listing-meta-CtVtyaWu.js";
|
|
14
|
+
import "./app-bundle-upload-DmVKWAj9.js";
|
|
15
|
+
import { runAppsPublish } from "./apps-publish--EmBa0zN.js";
|
|
16
|
+
|
|
17
|
+
export { runAppsPublish };
|
|
@@ -2,18 +2,20 @@ import "./credentials-BTv2IfUZ.js";
|
|
|
2
2
|
import "./nexus-root-BlPwOusj.js";
|
|
3
3
|
import { getApp, getWorkingDraft, upsertWorkingDraft } from "./apps-DlVsVHQ5.js";
|
|
4
4
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
5
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
6
|
-
import "./
|
|
7
|
-
import "./executas-
|
|
8
|
-
import "./
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import "./
|
|
12
|
-
import "./executa-
|
|
13
|
-
import "./
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
5
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
6
|
+
import "./executa-cache-BFoUtb4J.js";
|
|
7
|
+
import "./bundled-executas-rSIkaA6-.js";
|
|
8
|
+
import { loadAppManifest } from "./manifest-CAF3_r1T.js";
|
|
9
|
+
import "./executas-CvQY_w2U.js";
|
|
10
|
+
import { bumpVersion, bundleHash, manifestHash, rewriteVersion } from "./executa-publish-kh4Ucd3o.js";
|
|
11
|
+
import "./binary-upload-CKMU5Rfw.js";
|
|
12
|
+
import "./executa-upload-binaries-DURJTXRI.js";
|
|
13
|
+
import "./dev-GUFWek03.js";
|
|
14
|
+
import "./executa-install-Dz7hBUsn.js";
|
|
15
|
+
import "./app-cache-Cr3tKbux.js";
|
|
16
|
+
import { installLocalBundledShims, resolveAppIdentity, resolveBundledExecutas } from "./working-orchestration-D7cW2Bf2.js";
|
|
17
|
+
import { syncAppListingMeta } from "./listing-meta-CtVtyaWu.js";
|
|
18
|
+
import { isExistingDir, uploadWorkingBundle } from "./app-bundle-upload-DmVKWAj9.js";
|
|
17
19
|
import { resolve } from "node:path";
|
|
18
20
|
import { bold, cyan, dim, green, yellow } from "kleur/colors";
|
|
19
21
|
|
|
@@ -41,6 +43,7 @@ async function runAppsPush(opts) {
|
|
|
41
43
|
dryRun: opts.dryRun,
|
|
42
44
|
freeze: false,
|
|
43
45
|
lockSource: "working",
|
|
46
|
+
profile: opts.profile,
|
|
44
47
|
account: opts.account,
|
|
45
48
|
json: opts.json
|
|
46
49
|
});
|
|
@@ -49,6 +52,7 @@ async function runAppsPush(opts) {
|
|
|
49
52
|
manifest,
|
|
50
53
|
cwd,
|
|
51
54
|
resolved,
|
|
55
|
+
profile: opts.profile,
|
|
52
56
|
json: opts.json
|
|
53
57
|
});
|
|
54
58
|
const identity = await resolveAppIdentity({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { canonicalHost } from "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import { findAppBySlug, getApp, getBundle, listVersions, publishVersion } from "./apps-DlVsVHQ5.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
5
|
-
import { readAppIdentity } from "./app-cache-
|
|
4
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
5
|
+
import { readAppIdentity } from "./app-cache-Cr3tKbux.js";
|
|
6
6
|
import { resolve } from "node:path";
|
|
7
7
|
import { bold, cyan, dim, green, yellow } from "kleur/colors";
|
|
8
8
|
|
|
@@ -59,7 +59,7 @@ async function runAppsRelease(opts) {
|
|
|
59
59
|
if (!target) {
|
|
60
60
|
if (opts.allowCreate) {
|
|
61
61
|
if (!opts.json) console.log(yellow(`version ${opts.version} not found remotely; running 'apps publish' first (--allow-create)…`));
|
|
62
|
-
const { runAppsPublish } = await import("./apps-publish-
|
|
62
|
+
const { runAppsPublish } = await import("./apps-publish-B7reDBe1.js");
|
|
63
63
|
const code = await runAppsPublish({
|
|
64
64
|
cwd: opts.cwd,
|
|
65
65
|
account: opts.account,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import { findAppBySlug, patchApp } from "./apps-DlVsVHQ5.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import { reportError, resolveClient } from "./_lifecycle-shared-
|
|
5
|
-
import { loadAppManifest } from "./manifest-
|
|
6
|
-
import { readAppIdentity, writeAppIdentity } from "./app-cache-
|
|
4
|
+
import { reportError, resolveClient } from "./_lifecycle-shared-RyiRITI5.js";
|
|
5
|
+
import { loadAppManifest } from "./manifest-CAF3_r1T.js";
|
|
6
|
+
import { readAppIdentity, writeAppIdentity } from "./app-cache-Cr3tKbux.js";
|
|
7
7
|
import { writeFileSync } from "node:fs";
|
|
8
8
|
import { bold, dim, green, red, yellow } from "kleur/colors";
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import { findAppBySlug, getApp, listVersions } from "./apps-DlVsVHQ5.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
4
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
5
5
|
import { bold, cyan, dim, green, red, yellow } from "kleur/colors";
|
|
6
6
|
|
|
7
7
|
//#region src/commands/apps-status.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { canonicalHost } from "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import { findAppBySlug, getApp, submitForReview } from "./apps-DlVsVHQ5.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
5
|
-
import { readAppIdentity } from "./app-cache-
|
|
4
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
5
|
+
import { readAppIdentity } from "./app-cache-Cr3tKbux.js";
|
|
6
6
|
import { resolve } from "node:path";
|
|
7
7
|
import { bold, cyan, green } from "kleur/colors";
|
|
8
8
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { canonicalHost } from "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import { findAppBySlug, getApp } from "./apps-DlVsVHQ5.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
5
|
-
import { loadAppManifest } from "./manifest-
|
|
6
|
-
import { readAppIdentity } from "./app-cache-
|
|
7
|
-
import { syncAppListingMeta } from "./listing-meta-
|
|
4
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
5
|
+
import { loadAppManifest } from "./manifest-CAF3_r1T.js";
|
|
6
|
+
import { readAppIdentity } from "./app-cache-Cr3tKbux.js";
|
|
7
|
+
import { syncAppListingMeta } from "./listing-meta-CtVtyaWu.js";
|
|
8
8
|
import { resolve } from "node:path";
|
|
9
9
|
import { bold, cyan, dim, green } from "kleur/colors";
|
|
10
10
|
|
|
@@ -70,6 +70,8 @@ async function runAppsSyncMeta(opts) {
|
|
|
70
70
|
console.log(` ${dim("name :")} ${manifest.name}`);
|
|
71
71
|
if (manifest.category) console.log(` ${dim("category :")} ${manifest.category}`);
|
|
72
72
|
if (manifest.tagline) console.log(` ${dim("tagline :")} ${manifest.tagline}`);
|
|
73
|
+
const cleared = Object.entries(meta).filter(([, v]) => v === "").map(([k]) => k);
|
|
74
|
+
if (cleared.length > 0) console.log(` ${dim("cleared :")} ${cleared.join(", ")}`);
|
|
73
75
|
if (sync.logoUpload?.logo_url) console.log(` ${dim("logo :")} ${sync.logoUpload.logo_url}`);
|
|
74
76
|
if (sync.screenshotUploads && sync.screenshotUploads.length > 0) console.log(` ${dim("shots :")} ${sync.screenshotUploads.length} uploaded`);
|
|
75
77
|
console.log(bold(cyan(`status: ${finalApp.status}`)));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./credentials-BTv2IfUZ.js";
|
|
2
2
|
import { findAppBySlug, listVersions } from "./apps-DlVsVHQ5.js";
|
|
3
3
|
import { CliError } from "./client-D-_z1ALk.js";
|
|
4
|
-
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-
|
|
4
|
+
import { resolveClient, withErrorHandling } from "./_lifecycle-shared-RyiRITI5.js";
|
|
5
5
|
import { bold, cyan, dim, green } from "kleur/colors";
|
|
6
6
|
|
|
7
7
|
//#region src/commands/apps-versions.ts
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { CliError } from "./client-D-_z1ALk.js";
|
|
2
|
+
|
|
3
|
+
//#region src/api/binary-upload.ts
|
|
4
|
+
/** Exchange the PAT for a short-lived upload token bound to one tool_id. */
|
|
5
|
+
async function mintUploadSession(client, toolId) {
|
|
6
|
+
const res = await client.request({
|
|
7
|
+
path: "/api/v1/anna-apps/dev/upload-session/mint",
|
|
8
|
+
method: "POST",
|
|
9
|
+
body: { tool_id: toolId }
|
|
10
|
+
});
|
|
11
|
+
return res.data;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The id-token audience BOTH ends pin (server:
|
|
15
|
+
* settings.ANNA_APS_OIDC_AUDIENCE). A token minted for any other relying
|
|
16
|
+
* party is rejected by the exchange endpoint.
|
|
17
|
+
*/
|
|
18
|
+
const APS_OIDC_AUDIENCE = "anna-aps";
|
|
19
|
+
/**
|
|
20
|
+
* Fetch a GitHub Actions OIDC id-token from the runner's token service.
|
|
21
|
+
*
|
|
22
|
+
* Requires `permissions: id-token: write` on the workflow/job — GitHub then
|
|
23
|
+
* injects ACTIONS_ID_TOKEN_REQUEST_URL / ACTIONS_ID_TOKEN_REQUEST_TOKEN.
|
|
24
|
+
* Throws a CliError with an actionable message when unavailable.
|
|
25
|
+
*/
|
|
26
|
+
async function fetchGitHubIdToken(opts) {
|
|
27
|
+
const env = opts?.env ?? process.env;
|
|
28
|
+
const requestUrl = env.ACTIONS_ID_TOKEN_REQUEST_URL;
|
|
29
|
+
const requestToken = env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;
|
|
30
|
+
if (!requestUrl || !requestToken) throw new CliError("GitHub OIDC token service unavailable — --oidc only works inside GitHub Actions with `permissions: id-token: write` on the job", 2);
|
|
31
|
+
const audience = opts?.audience ?? APS_OIDC_AUDIENCE;
|
|
32
|
+
const url = `${requestUrl}${requestUrl.includes("?") ? "&" : "?"}audience=${encodeURIComponent(audience)}`;
|
|
33
|
+
const fetchImpl = opts?.fetchImpl ?? fetch;
|
|
34
|
+
let res;
|
|
35
|
+
try {
|
|
36
|
+
res = await fetchImpl(url, { headers: {
|
|
37
|
+
authorization: `Bearer ${requestToken}`,
|
|
38
|
+
accept: "application/json"
|
|
39
|
+
} });
|
|
40
|
+
} catch (e) {
|
|
41
|
+
throw new CliError(`failed to reach the GitHub OIDC token service: ${e.message}`, 6);
|
|
42
|
+
}
|
|
43
|
+
if (!res.ok) throw new CliError(`GitHub OIDC token service returned ${res.status}`, 6, { status: res.status });
|
|
44
|
+
const data = await res.json();
|
|
45
|
+
if (!data.value) throw new CliError("GitHub OIDC token service returned no token value", 6);
|
|
46
|
+
return data.value;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Exchange a GitHub Actions id-token for an upload token — zero long-term
|
|
50
|
+
* secrets. Requires a Trusted Publisher registration on the executa
|
|
51
|
+
* (`anna-app executa trusted-publisher add`).
|
|
52
|
+
*/
|
|
53
|
+
async function mintUploadSessionViaOidc(opts) {
|
|
54
|
+
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
55
|
+
let res;
|
|
56
|
+
try {
|
|
57
|
+
res = await fetchImpl(`${opts.host}/api/v1/anna-apps/dev/upload-session/oidc-exchange`, {
|
|
58
|
+
method: "POST",
|
|
59
|
+
headers: {
|
|
60
|
+
"content-type": "application/json",
|
|
61
|
+
accept: "application/json"
|
|
62
|
+
},
|
|
63
|
+
body: JSON.stringify({
|
|
64
|
+
tool_id: opts.toolId,
|
|
65
|
+
oidc_token: opts.oidcToken
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
} catch (e) {
|
|
69
|
+
throw new CliError(`network error contacting ${opts.host}: ${e.message}`, 6);
|
|
70
|
+
}
|
|
71
|
+
let parsed = null;
|
|
72
|
+
const text = await res.text();
|
|
73
|
+
if (text.length > 0) try {
|
|
74
|
+
parsed = JSON.parse(text);
|
|
75
|
+
} catch {
|
|
76
|
+
parsed = text;
|
|
77
|
+
}
|
|
78
|
+
if (!res.ok) {
|
|
79
|
+
const { code, message } = describeUploadError(parsed);
|
|
80
|
+
throw new CliError(`OIDC exchange failed (${res.status}${code ? ` ${code}` : ""}): ${message}`, res.status === 401 ? 2 : res.status >= 500 ? 6 : 3, {
|
|
81
|
+
status: res.status,
|
|
82
|
+
body: parsed
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return parsed;
|
|
86
|
+
}
|
|
87
|
+
async function listTrustedPublishers(client, toolId) {
|
|
88
|
+
const res = await client.request({ path: `/api/v1/anna-apps/dev/executas/${encodeURIComponent(toolId)}/trusted-publishers` });
|
|
89
|
+
return res.data.trusted_publishers;
|
|
90
|
+
}
|
|
91
|
+
async function addTrustedPublisher(client, toolId, body) {
|
|
92
|
+
const res = await client.request({
|
|
93
|
+
path: `/api/v1/anna-apps/dev/executas/${encodeURIComponent(toolId)}/trusted-publishers`,
|
|
94
|
+
method: "POST",
|
|
95
|
+
body
|
|
96
|
+
});
|
|
97
|
+
return res.data;
|
|
98
|
+
}
|
|
99
|
+
async function removeTrustedPublisher(client, toolId, publisherId) {
|
|
100
|
+
await client.request({
|
|
101
|
+
path: `/api/v1/anna-apps/dev/executas/${encodeURIComponent(toolId)}/trusted-publishers/${publisherId}`,
|
|
102
|
+
method: "DELETE"
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/** Extract `{code, message}` from a structured upload error body. */
|
|
106
|
+
function describeUploadError(body) {
|
|
107
|
+
if (body && typeof body === "object") {
|
|
108
|
+
const det = body.detail;
|
|
109
|
+
if (det && typeof det === "object") {
|
|
110
|
+
const d = det;
|
|
111
|
+
if (d.message) return {
|
|
112
|
+
code: d.code,
|
|
113
|
+
message: d.message
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (typeof det === "string") return { message: det };
|
|
117
|
+
}
|
|
118
|
+
if (typeof body === "string" && body) return { message: body.slice(0, 240) };
|
|
119
|
+
return { message: "(empty body)" };
|
|
120
|
+
}
|
|
121
|
+
async function uploadRequest(t, path, opts) {
|
|
122
|
+
const fetchImpl = t.fetchImpl ?? fetch;
|
|
123
|
+
const headers = {
|
|
124
|
+
authorization: `Bearer ${t.uploadToken}`,
|
|
125
|
+
accept: "application/json"
|
|
126
|
+
};
|
|
127
|
+
let body;
|
|
128
|
+
if (opts.rawBody !== void 0) {
|
|
129
|
+
headers["content-type"] = "application/octet-stream";
|
|
130
|
+
body = opts.rawBody;
|
|
131
|
+
} else if (opts.body !== void 0) {
|
|
132
|
+
headers["content-type"] = "application/json";
|
|
133
|
+
body = JSON.stringify(opts.body);
|
|
134
|
+
}
|
|
135
|
+
let res;
|
|
136
|
+
try {
|
|
137
|
+
res = await fetchImpl(t.host + path, {
|
|
138
|
+
method: "POST",
|
|
139
|
+
headers,
|
|
140
|
+
body
|
|
141
|
+
});
|
|
142
|
+
} catch (e) {
|
|
143
|
+
throw new CliError(`network error contacting ${t.host}: ${e.message}`, 6);
|
|
144
|
+
}
|
|
145
|
+
let parsed = null;
|
|
146
|
+
const text = await res.text();
|
|
147
|
+
if (text.length > 0) try {
|
|
148
|
+
parsed = JSON.parse(text);
|
|
149
|
+
} catch {
|
|
150
|
+
parsed = text;
|
|
151
|
+
}
|
|
152
|
+
if (!res.ok) {
|
|
153
|
+
const { code, message } = describeUploadError(parsed);
|
|
154
|
+
if (res.status === 401) throw new CliError(`upload token rejected (401${code ? ` ${code}` : ""}): ${message}`, 2, {
|
|
155
|
+
status: res.status,
|
|
156
|
+
body: parsed
|
|
157
|
+
});
|
|
158
|
+
const exit = res.status >= 500 ? 6 : res.status === 403 ? 3 : 5;
|
|
159
|
+
throw new CliError(`binary upload failed (${res.status}${code ? ` ${code}` : ""}): ${message}`, exit, {
|
|
160
|
+
status: res.status,
|
|
161
|
+
body: parsed
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return parsed;
|
|
165
|
+
}
|
|
166
|
+
/** Declare the per-platform manifest; returns the upload plan (resumable). */
|
|
167
|
+
async function initBinaryUpload(t, toolId, body) {
|
|
168
|
+
return uploadRequest(t, `/api/v1/anna-apps/dev/executas/${encodeURIComponent(toolId)}/binaries/init`, { body });
|
|
169
|
+
}
|
|
170
|
+
/** Upload one raw chunk (≤ part_size). Idempotent per (platform, index). */
|
|
171
|
+
async function uploadBinaryPart(t, toolId, uploadId, platform, index, bytes) {
|
|
172
|
+
const qs = `?platform=${encodeURIComponent(platform)}&index=${index}`;
|
|
173
|
+
await uploadRequest(t, `/api/v1/anna-apps/dev/executas/${encodeURIComponent(toolId)}/binaries/${encodeURIComponent(uploadId)}/part${qs}`, { rawBody: bytes });
|
|
174
|
+
}
|
|
175
|
+
/** Assemble + server-side verify + persist. Returns per-platform CDN URLs. */
|
|
176
|
+
async function finalizeBinaryUpload(t, toolId, uploadId) {
|
|
177
|
+
return uploadRequest(t, `/api/v1/anna-apps/dev/executas/${encodeURIComponent(toolId)}/binaries/${encodeURIComponent(uploadId)}/finalize`, { body: {} });
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
//#endregion
|
|
181
|
+
export { addTrustedPublisher, fetchGitHubIdToken, finalizeBinaryUpload, initBinaryUpload, listTrustedPublishers, mintUploadSession, mintUploadSessionViaOidc, removeTrustedPublisher, uploadBinaryPart };
|