gipity 1.1.21 → 1.1.22
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/api.js +16 -5
- package/dist/commands/service.js +12 -6
- package/dist/helpers/body.js +38 -0
- package/dist/helpers/index.js +1 -1
- package/dist/index.js +58 -21
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -184,13 +184,23 @@ export async function getAuthHeader() {
|
|
|
184
184
|
const headers = await getHeaders();
|
|
185
185
|
return headers.Authorization;
|
|
186
186
|
}
|
|
187
|
+
/** A FormData body goes out as multipart/form-data (fetch sets the boundary
|
|
188
|
+
* header itself, so callers must not send a JSON Content-Type with it); any
|
|
189
|
+
* other body is JSON. */
|
|
190
|
+
function encodeBody(body) {
|
|
191
|
+
if (body instanceof FormData)
|
|
192
|
+
return body;
|
|
193
|
+
return body ? JSON.stringify(body) : undefined;
|
|
194
|
+
}
|
|
187
195
|
async function request(method, path, body, retrying = false, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
188
196
|
const headers = await getHeaders();
|
|
189
197
|
const url = `${baseUrl()}${path}`;
|
|
198
|
+
if (body instanceof FormData)
|
|
199
|
+
delete headers['Content-Type'];
|
|
190
200
|
const res = await fetchWithTimeout(url, {
|
|
191
201
|
method,
|
|
192
202
|
headers,
|
|
193
|
-
body:
|
|
203
|
+
body: encodeBody(body),
|
|
194
204
|
}, timeoutMs, `${method} ${path}`);
|
|
195
205
|
if (await shouldRetryAfter401(res.status, retrying)) {
|
|
196
206
|
return request(method, path, body, true, timeoutMs);
|
|
@@ -425,13 +435,14 @@ export async function getAccountSlug() {
|
|
|
425
435
|
/** Unauthenticated request (for login/verify, and anonymous-visitor calls like
|
|
426
436
|
* `fn call --anon`). extraHeaders lets callers attach non-auth headers such as
|
|
427
437
|
* X-App-Token; no Authorization header is ever sent. */
|
|
428
|
-
export async function publicRequest(method, path, body, extraHeaders) {
|
|
438
|
+
export async function publicRequest(method, path, body, extraHeaders, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
429
439
|
const url = `${baseUrl()}${path}`;
|
|
440
|
+
const isForm = body instanceof FormData;
|
|
430
441
|
const res = await fetchWithTimeout(url, {
|
|
431
442
|
method,
|
|
432
|
-
headers: { ...clientHeaders(), 'Content-Type': 'application/json', ...extraHeaders },
|
|
433
|
-
body: body === undefined ? undefined : JSON.stringify(body),
|
|
434
|
-
},
|
|
443
|
+
headers: { ...clientHeaders(), ...(isForm ? {} : { 'Content-Type': 'application/json' }), ...extraHeaders },
|
|
444
|
+
body: isForm ? body : body === undefined ? undefined : JSON.stringify(body),
|
|
445
|
+
}, timeoutMs, `${method} ${path}`);
|
|
435
446
|
if (!res.ok) {
|
|
436
447
|
const json = await res.json().catch(() => null);
|
|
437
448
|
throw apiErrorFrom(res, json, `${method} ${path}`, false);
|
package/dist/commands/service.js
CHANGED
|
@@ -3,10 +3,11 @@ import { get, post, publicRequest, mintAppToken, ApiError, LONG_REQUEST_TIMEOUT_
|
|
|
3
3
|
import { getAuth } from '../auth.js';
|
|
4
4
|
import { requireConfig } from '../config.js';
|
|
5
5
|
import { bold, muted } from '../colors.js';
|
|
6
|
-
import { run, emitField, resolveBody } from '../helpers/index.js';
|
|
6
|
+
import { run, emitField, resolveBody, resolveFormBody } from '../helpers/index.js';
|
|
7
7
|
/** Known app-service endpoints, shown by `gipity service list` and used to
|
|
8
|
-
* give a helpful hint on typos. POST endpoints take a JSON body
|
|
9
|
-
*
|
|
8
|
+
* give a helpful hint on typos. POST endpoints take a JSON body, except
|
|
9
|
+
* transcribe, which takes a multipart upload via --form. GET endpoints
|
|
10
|
+
* (model/voice listings) are reached with `--get`. */
|
|
10
11
|
const SERVICES = [
|
|
11
12
|
{ name: 'llm', method: 'POST', desc: 'Chat completion ({ prompt | messages, model?, ... })' },
|
|
12
13
|
{ name: 'llm/models', method: 'GET', desc: 'List available LLM models' },
|
|
@@ -18,6 +19,7 @@ const SERVICES = [
|
|
|
18
19
|
{ name: 'music', method: 'POST', desc: 'Music generation ({ prompt, duration_seconds? })' },
|
|
19
20
|
{ name: 'music/models', method: 'GET', desc: 'List music models (ids for --model / model)' },
|
|
20
21
|
{ name: 'video', method: 'POST', desc: 'Video generation ({ prompt, ... })' },
|
|
22
|
+
{ name: 'transcribe', method: 'POST', desc: 'Speech-to-text, multipart (--form audio=@talk.mp3 [--form language=en] [--form diarize=true])' },
|
|
21
23
|
{ name: 'location/ip', method: 'POST', desc: 'IP geolocation ({ ip? })' },
|
|
22
24
|
{ name: 'location/geocode', method: 'POST', desc: 'Reverse geocode ({ lat, lon })' },
|
|
23
25
|
];
|
|
@@ -68,7 +70,8 @@ serviceCommand
|
|
|
68
70
|
.command('call <name> [body]')
|
|
69
71
|
.description('Call an app service by name (e.g. llm, image, music). Uses your logged-in session - no token wrangling; --anon calls it as a signed-out visitor instead.')
|
|
70
72
|
.option('-d, --data <json>', 'JSON request body: inline JSON, @file to read a file, or @- / - for stdin (alternative to the positional [body])')
|
|
71
|
-
.option('--file <field=@path>', 'Attach a file as { data, media_type } under <field> (the
|
|
73
|
+
.option('--file <field=@path>', 'Attach a file as { data, media_type } under <field> in the JSON body (the shape image/vision services expect), repeatable, e.g. --file image=@receipt.png', (v, acc) => (acc || []).concat(v))
|
|
74
|
+
.option('--form <field=value>', 'Send multipart/form-data instead of JSON, curl -F style: field=@path attaches a file, field=value a text field. Repeatable. For upload endpoints like transcribe: --form audio=@talk.mp3 --form language=en', (v, acc) => (acc || []).concat(v))
|
|
72
75
|
.option('--anon', 'Call as an anonymous visitor (the public path a signed-out user of your deployed app hits) instead of as your signed-in account')
|
|
73
76
|
.option('--get', 'Issue a GET (for listing endpoints like llm/models, tts/voices)')
|
|
74
77
|
.option('--field <path>', 'Print only this field of the result (dot path, e.g. choices.0.message.content)')
|
|
@@ -82,7 +85,10 @@ serviceCommand
|
|
|
82
85
|
const [pathPart, query] = name.split('?', 2);
|
|
83
86
|
const path = pathPart.split('/').map(encodeURIComponent).join('/');
|
|
84
87
|
const url = `/api/${config.projectGuid}/services/${path}${query ? `?${query}` : ''}`;
|
|
85
|
-
|
|
88
|
+
if (opts.form && (bodyArg || opts.data || opts.file || opts.get)) {
|
|
89
|
+
throw new Error('--form sends a multipart body, so it cannot be combined with a JSON body, --data, --file, or --get.');
|
|
90
|
+
}
|
|
91
|
+
const body = opts.form ? resolveFormBody(opts.form) : resolveBody(bodyArg || opts.data, opts.file);
|
|
86
92
|
// Name the calling identity (stderr, so stdout stays parseable). An owner
|
|
87
93
|
// call always succeeds regardless of billing mode, so without this line a
|
|
88
94
|
// "the service works" verification silently proves nothing about the
|
|
@@ -107,7 +113,7 @@ serviceCommand
|
|
|
107
113
|
`That means the app is not deployed on this API base yet: run \`gipity deploy dev\` first, ` +
|
|
108
114
|
`then re-run this command.`);
|
|
109
115
|
}
|
|
110
|
-
res = await publicRequest(opts.get ? 'GET' : 'POST', url, opts.get ? undefined : body, headers);
|
|
116
|
+
res = await publicRequest(opts.get ? 'GET' : 'POST', url, opts.get ? undefined : body, headers, LONG_REQUEST_TIMEOUT_MS);
|
|
111
117
|
}
|
|
112
118
|
else {
|
|
113
119
|
// Generation services (music, video, image, ...) can hold the request
|
package/dist/helpers/body.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* path sidesteps the shell argument entirely.
|
|
13
13
|
*/
|
|
14
14
|
import { readFileSync } from 'node:fs';
|
|
15
|
+
import { basename } from 'node:path';
|
|
15
16
|
import { guessMime } from '../upload.js';
|
|
16
17
|
/** Read all of stdin synchronously (fd 0). Returns '' if stdin is a TTY. */
|
|
17
18
|
function readStdin() {
|
|
@@ -114,4 +115,41 @@ export function resolveJsonBody(raw) {
|
|
|
114
115
|
throw new Error(`Invalid JSON in ${origin}: ${e.message}`);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Build a multipart/form-data body from repeatable `--form` specs, curl `-F`
|
|
120
|
+
* style: `field=@path` attaches a file (sent with its filename and detected
|
|
121
|
+
* media type), `field=value` sends a text field. This is for endpoints that
|
|
122
|
+
* take a real file upload rather than a JSON body, e.g. the transcribe service
|
|
123
|
+
* (`--form audio=@talk.mp3 --form language=en`). Multipart also carries much
|
|
124
|
+
* larger files than a base64 JSON body can.
|
|
125
|
+
*/
|
|
126
|
+
export function resolveFormBody(specs) {
|
|
127
|
+
const form = new FormData();
|
|
128
|
+
for (const spec of specs) {
|
|
129
|
+
const eq = spec.indexOf('=');
|
|
130
|
+
if (eq === -1) {
|
|
131
|
+
throw new Error(`Invalid --form '${spec}': expected field=@path for a file or field=value for text (e.g. --form audio=@talk.mp3).`);
|
|
132
|
+
}
|
|
133
|
+
const field = spec.slice(0, eq).trim();
|
|
134
|
+
const value = spec.slice(eq + 1);
|
|
135
|
+
if (!field)
|
|
136
|
+
throw new Error(`Invalid --form '${spec}': missing field name before '='.`);
|
|
137
|
+
if (!value.startsWith('@')) {
|
|
138
|
+
form.append(field, value);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const path = value.slice(1);
|
|
142
|
+
if (!path)
|
|
143
|
+
throw new Error(`Invalid --form '${spec}': missing file path after '@'.`);
|
|
144
|
+
let data;
|
|
145
|
+
try {
|
|
146
|
+
data = readFileSync(path);
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
throw new Error(`Cannot read --form '${path}': ${e.message}`);
|
|
150
|
+
}
|
|
151
|
+
form.append(field, new Blob([new Uint8Array(data)], { type: guessMime(path) }), basename(path));
|
|
152
|
+
}
|
|
153
|
+
return form;
|
|
154
|
+
}
|
|
117
155
|
//# sourceMappingURL=body.js.map
|
package/dist/helpers/index.js
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
export { run } from './command.js';
|
|
5
5
|
export { printOutput, printList, printResult, pluckField, emitField } from './output.js';
|
|
6
6
|
export { syncBeforeAction } from './sync.js';
|
|
7
|
-
export { resolveJsonBody, resolveBody } from './body.js';
|
|
7
|
+
export { resolveJsonBody, resolveBody, resolveFormBody } from './body.js';
|
|
8
8
|
export { parseDuration } from './duration.js';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js
CHANGED
|
@@ -9151,13 +9151,18 @@ async function getAuthHeader() {
|
|
|
9151
9151
|
const headers = await getHeaders();
|
|
9152
9152
|
return headers.Authorization;
|
|
9153
9153
|
}
|
|
9154
|
+
function encodeBody(body) {
|
|
9155
|
+
if (body instanceof FormData) return body;
|
|
9156
|
+
return body ? JSON.stringify(body) : void 0;
|
|
9157
|
+
}
|
|
9154
9158
|
async function request(method, path5, body, retrying = false, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
9155
9159
|
const headers = await getHeaders();
|
|
9156
9160
|
const url = `${baseUrl()}${path5}`;
|
|
9161
|
+
if (body instanceof FormData) delete headers["Content-Type"];
|
|
9157
9162
|
const res = await fetchWithTimeout(url, {
|
|
9158
9163
|
method,
|
|
9159
9164
|
headers,
|
|
9160
|
-
body:
|
|
9165
|
+
body: encodeBody(body)
|
|
9161
9166
|
}, timeoutMs, `${method} ${path5}`);
|
|
9162
9167
|
if (await shouldRetryAfter401(res.status, retrying)) {
|
|
9163
9168
|
return request(method, path5, body, true, timeoutMs);
|
|
@@ -9345,13 +9350,14 @@ async function getAccountSlug() {
|
|
|
9345
9350
|
accountSlugCache = res.data.accountSlug;
|
|
9346
9351
|
return accountSlugCache;
|
|
9347
9352
|
}
|
|
9348
|
-
async function publicRequest(method, path5, body, extraHeaders) {
|
|
9353
|
+
async function publicRequest(method, path5, body, extraHeaders, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
9349
9354
|
const url = `${baseUrl()}${path5}`;
|
|
9355
|
+
const isForm = body instanceof FormData;
|
|
9350
9356
|
const res = await fetchWithTimeout(url, {
|
|
9351
9357
|
method,
|
|
9352
|
-
headers: { ...clientHeaders(), "Content-Type": "application/json", ...extraHeaders },
|
|
9353
|
-
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
9354
|
-
},
|
|
9358
|
+
headers: { ...clientHeaders(), ...isForm ? {} : { "Content-Type": "application/json" }, ...extraHeaders },
|
|
9359
|
+
body: isForm ? body : body === void 0 ? void 0 : JSON.stringify(body)
|
|
9360
|
+
}, timeoutMs, `${method} ${path5}`);
|
|
9355
9361
|
if (!res.ok) {
|
|
9356
9362
|
const json = await res.json().catch(() => null);
|
|
9357
9363
|
throw apiErrorFrom(res, json, `${method} ${path5}`, false);
|
|
@@ -36126,6 +36132,7 @@ async function syncBeforeAction(opts) {
|
|
|
36126
36132
|
|
|
36127
36133
|
// src/helpers/body.ts
|
|
36128
36134
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
36135
|
+
import { basename as basename2 } from "node:path";
|
|
36129
36136
|
function readStdin() {
|
|
36130
36137
|
if (process.stdin.isTTY) return "";
|
|
36131
36138
|
try {
|
|
@@ -36191,6 +36198,32 @@ function resolveJsonBody(raw) {
|
|
|
36191
36198
|
throw new Error(`Invalid JSON in ${origin}: ${e.message}`);
|
|
36192
36199
|
}
|
|
36193
36200
|
}
|
|
36201
|
+
function resolveFormBody(specs) {
|
|
36202
|
+
const form = new FormData();
|
|
36203
|
+
for (const spec of specs) {
|
|
36204
|
+
const eq2 = spec.indexOf("=");
|
|
36205
|
+
if (eq2 === -1) {
|
|
36206
|
+
throw new Error(`Invalid --form '${spec}': expected field=@path for a file or field=value for text (e.g. --form audio=@talk.mp3).`);
|
|
36207
|
+
}
|
|
36208
|
+
const field = spec.slice(0, eq2).trim();
|
|
36209
|
+
const value = spec.slice(eq2 + 1);
|
|
36210
|
+
if (!field) throw new Error(`Invalid --form '${spec}': missing field name before '='.`);
|
|
36211
|
+
if (!value.startsWith("@")) {
|
|
36212
|
+
form.append(field, value);
|
|
36213
|
+
continue;
|
|
36214
|
+
}
|
|
36215
|
+
const path5 = value.slice(1);
|
|
36216
|
+
if (!path5) throw new Error(`Invalid --form '${spec}': missing file path after '@'.`);
|
|
36217
|
+
let data;
|
|
36218
|
+
try {
|
|
36219
|
+
data = readFileSync9(path5);
|
|
36220
|
+
} catch (e) {
|
|
36221
|
+
throw new Error(`Cannot read --form '${path5}': ${e.message}`);
|
|
36222
|
+
}
|
|
36223
|
+
form.append(field, new Blob([new Uint8Array(data)], { type: guessMime(path5) }), basename2(path5));
|
|
36224
|
+
}
|
|
36225
|
+
return form;
|
|
36226
|
+
}
|
|
36194
36227
|
|
|
36195
36228
|
// src/helpers/duration.ts
|
|
36196
36229
|
var UNIT_TO_MS = { ms: 1, s: 1e3, m: 6e4 };
|
|
@@ -36333,7 +36366,7 @@ init_setup();
|
|
|
36333
36366
|
init_agents();
|
|
36334
36367
|
init_colors();
|
|
36335
36368
|
init_utils();
|
|
36336
|
-
import { basename as
|
|
36369
|
+
import { basename as basename3, resolve as resolve8, dirname as dirname8 } from "path";
|
|
36337
36370
|
import { existsSync as existsSync11, readFileSync as readFileSync13 } from "fs";
|
|
36338
36371
|
|
|
36339
36372
|
// src/adopt-cwd.ts
|
|
@@ -37369,7 +37402,7 @@ Working with an existing Gipity project:
|
|
|
37369
37402
|
process.exit(1);
|
|
37370
37403
|
}
|
|
37371
37404
|
}
|
|
37372
|
-
const projectName = (name ||
|
|
37405
|
+
const projectName = (name || basename3(cwd)).slice(0, 100);
|
|
37373
37406
|
const projectSlug = slugify(projectName);
|
|
37374
37407
|
if (!projectSlug) {
|
|
37375
37408
|
console.error(error("Could not derive a valid project slug. Provide a name: gipity init my-app"));
|
|
@@ -37644,7 +37677,7 @@ var pushCommand = new Command("push").description("Push one or more files").argu
|
|
|
37644
37677
|
init_api();
|
|
37645
37678
|
init_config();
|
|
37646
37679
|
import { statSync as statSync5 } from "fs";
|
|
37647
|
-
import { basename as
|
|
37680
|
+
import { basename as basename4 } from "path";
|
|
37648
37681
|
init_utils();
|
|
37649
37682
|
init_colors();
|
|
37650
37683
|
var uploadCommand = new Command("upload").description("Upload a file and print a durable public URL (works immediately, no deploy)").argument("<file>", "Local file to upload").option("--private", "Store as a private token-signed serve URL instead of a public CDN url").option("--content-type <mime>", "Override the content type (default: detected from the file extension)").option("--json", "Output as JSON").addHelpText("after", `
|
|
@@ -37664,7 +37697,7 @@ Public by default (a media.gipity.ai CDN url any job or function can fetch);
|
|
|
37664
37697
|
throw new Error(`can't read ${file}: ${err.message}`);
|
|
37665
37698
|
}
|
|
37666
37699
|
if (size === 0) throw new Error(`${file} is empty - nothing to upload.`);
|
|
37667
|
-
const filename =
|
|
37700
|
+
const filename = basename4(file);
|
|
37668
37701
|
const contentType = opts.contentType || guessMime(file);
|
|
37669
37702
|
const doUpload = async () => {
|
|
37670
37703
|
const init = await post(`/api/${config.projectGuid}/uploads/init`, {
|
|
@@ -37739,7 +37772,7 @@ function dropCheckpoint(projectGuid2, database) {
|
|
|
37739
37772
|
init_api();
|
|
37740
37773
|
init_config();
|
|
37741
37774
|
import { readFileSync as readFileSync15, statSync as statSync6, existsSync as existsSync13, readdirSync as readdirSync7 } from "node:fs";
|
|
37742
|
-
import { basename as
|
|
37775
|
+
import { basename as basename5, resolve as resolve11, relative as relative3, join as join17 } from "node:path";
|
|
37743
37776
|
var FIND_SKIP = /* @__PURE__ */ new Set(["node_modules", ".git", ".gipity", "dist", "build", ".next", "coverage"]);
|
|
37744
37777
|
function findByBasename(root, name, limit = 3) {
|
|
37745
37778
|
const hits = [];
|
|
@@ -37768,18 +37801,18 @@ function assertLocalAsset(flag, localPath) {
|
|
|
37768
37801
|
const abs = resolve11(localPath);
|
|
37769
37802
|
if (existsSync13(abs)) return;
|
|
37770
37803
|
const root = getProjectRoot() ?? process.cwd();
|
|
37771
|
-
const elsewhere = findByBasename(root,
|
|
37804
|
+
const elsewhere = findByBasename(root, basename5(localPath)).filter((p) => p !== abs);
|
|
37772
37805
|
const found = elsewhere.length ? `
|
|
37773
37806
|
That file DOES exist here. Pass this path instead:
|
|
37774
37807
|
${elsewhere.map((p) => ` ${flag} ${relative3(process.cwd(), p) || p}`).join("\n")}` : `
|
|
37775
|
-
Nothing named "${
|
|
37808
|
+
Nothing named "${basename5(localPath)}" under ${root} either. Generate a frame with \`gipity generate image "<description>" -o ${localPath}\`, or check the path.`;
|
|
37776
37809
|
throw new Error(
|
|
37777
37810
|
`${flag} ${localPath}: no such file. Looked for ${abs} (relative paths resolve against the current directory, ${process.cwd()}).${found}`
|
|
37778
37811
|
);
|
|
37779
37812
|
}
|
|
37780
37813
|
async function uploadPublicFixture(projectGuid2, localPath, flag = "--fixture") {
|
|
37781
37814
|
assertLocalAsset(flag, localPath);
|
|
37782
|
-
const name =
|
|
37815
|
+
const name = basename5(localPath);
|
|
37783
37816
|
const size = statSync6(localPath).size;
|
|
37784
37817
|
const contentType = guessMime(localPath);
|
|
37785
37818
|
const init = await post(
|
|
@@ -37812,7 +37845,7 @@ function assertCameraFile(localPath) {
|
|
|
37812
37845
|
const ext = localPath.slice(localPath.lastIndexOf(".")).toLowerCase();
|
|
37813
37846
|
if (CAMERA_EXTS.includes(ext)) return;
|
|
37814
37847
|
throw new Error(
|
|
37815
|
-
`--camera ${
|
|
37848
|
+
`--camera ${basename5(localPath)}: unsupported file type "${ext || "(none)"}": the camera feed must be an image or video (${CAMERA_EXTS.join(", ")}).
|
|
37816
37849
|
A still image is played as a looping single-frame feed, which is what a gesture/pose/object model needs.
|
|
37817
37850
|
No frame to hand? Generate one: gipity generate image "a hand making a closed fist, palm to camera, plain background"`
|
|
37818
37851
|
);
|
|
@@ -40561,7 +40594,7 @@ storageCommand.command("retention").description("View or adjust your file versio
|
|
|
40561
40594
|
init_platform();
|
|
40562
40595
|
init_auth();
|
|
40563
40596
|
init_api();
|
|
40564
|
-
import { join as join22, dirname as dirname12, resolve as resolve13, basename as
|
|
40597
|
+
import { join as join22, dirname as dirname12, resolve as resolve13, basename as basename6, sep as sep6 } from "path";
|
|
40565
40598
|
import { existsSync as existsSync17, mkdirSync as mkdirSync14, readFileSync as readFileSync19, writeFileSync as writeFileSync14, renameSync as renameSync2, readdirSync as readdirSync8, statSync as statSync8 } from "fs";
|
|
40566
40599
|
import { homedir as homedir15 } from "os";
|
|
40567
40600
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -41314,7 +41347,7 @@ async function runLaunch(cmdName, cmdCfg, opts) {
|
|
|
41314
41347
|
let accountSlug = "";
|
|
41315
41348
|
const result = forceAdoptCwd ? { kind: "adopt-cwd" } : projects.length > 0 ? await pickOrCreateProject(projects, existingSlugs) : { kind: "create-new", project: await createNewProject(existingSlugs) };
|
|
41316
41349
|
if (result.kind === "adopt-cwd") {
|
|
41317
|
-
const cwdBase =
|
|
41350
|
+
const cwdBase = basename6(process.cwd());
|
|
41318
41351
|
const adoptSlug = slugify(cwdBase) || "project";
|
|
41319
41352
|
const adoptName = (cwdBase || adoptSlug).slice(0, 100);
|
|
41320
41353
|
accountSlug = await getAccountSlug();
|
|
@@ -43375,6 +43408,7 @@ var SERVICES = [
|
|
|
43375
43408
|
{ name: "music", method: "POST", desc: "Music generation ({ prompt, duration_seconds? })" },
|
|
43376
43409
|
{ name: "music/models", method: "GET", desc: "List music models (ids for --model / model)" },
|
|
43377
43410
|
{ name: "video", method: "POST", desc: "Video generation ({ prompt, ... })" },
|
|
43411
|
+
{ name: "transcribe", method: "POST", desc: "Speech-to-text, multipart (--form audio=@talk.mp3 [--form language=en] [--form diarize=true])" },
|
|
43378
43412
|
{ name: "location/ip", method: "POST", desc: "IP geolocation ({ ip? })" },
|
|
43379
43413
|
{ name: "location/geocode", method: "POST", desc: "Reverse geocode ({ lat, lon })" }
|
|
43380
43414
|
];
|
|
@@ -43407,12 +43441,15 @@ function anonBillingHint(name, err) {
|
|
|
43407
43441
|
billing_mode: owner_pays
|
|
43408
43442
|
gipity deploy dev --only services`;
|
|
43409
43443
|
}
|
|
43410
|
-
serviceCommand.command("call <name> [body]").description("Call an app service by name (e.g. llm, image, music). Uses your logged-in session - no token wrangling; --anon calls it as a signed-out visitor instead.").option("-d, --data <json>", "JSON request body: inline JSON, @file to read a file, or @- / - for stdin (alternative to the positional [body])").option("--file <field=@path>", "Attach a file as { data, media_type } under <field> (the
|
|
43444
|
+
serviceCommand.command("call <name> [body]").description("Call an app service by name (e.g. llm, image, music). Uses your logged-in session - no token wrangling; --anon calls it as a signed-out visitor instead.").option("-d, --data <json>", "JSON request body: inline JSON, @file to read a file, or @- / - for stdin (alternative to the positional [body])").option("--file <field=@path>", "Attach a file as { data, media_type } under <field> in the JSON body (the shape image/vision services expect), repeatable, e.g. --file image=@receipt.png", (v7, acc) => (acc || []).concat(v7)).option("--form <field=value>", "Send multipart/form-data instead of JSON, curl -F style: field=@path attaches a file, field=value a text field. Repeatable. For upload endpoints like transcribe: --form audio=@talk.mp3 --form language=en", (v7, acc) => (acc || []).concat(v7)).option("--anon", "Call as an anonymous visitor (the public path a signed-out user of your deployed app hits) instead of as your signed-in account").option("--get", "Issue a GET (for listing endpoints like llm/models, tts/voices)").option("--field <path>", "Print only this field of the result (dot path, e.g. choices.0.message.content)").option("--json", "Output compact JSON").action((name, bodyArg, opts) => run("Call", async () => {
|
|
43411
43445
|
const config = requireConfig2();
|
|
43412
43446
|
const [pathPart, query] = name.split("?", 2);
|
|
43413
43447
|
const path5 = pathPart.split("/").map(encodeURIComponent).join("/");
|
|
43414
43448
|
const url = `/api/${config.projectGuid}/services/${path5}${query ? `?${query}` : ""}`;
|
|
43415
|
-
|
|
43449
|
+
if (opts.form && (bodyArg || opts.data || opts.file || opts.get)) {
|
|
43450
|
+
throw new Error("--form sends a multipart body, so it cannot be combined with a JSON body, --data, --file, or --get.");
|
|
43451
|
+
}
|
|
43452
|
+
const body = opts.form ? resolveFormBody(opts.form) : resolveBody(bodyArg || opts.data, opts.file);
|
|
43416
43453
|
if (opts.anon) {
|
|
43417
43454
|
console.error(muted("Auth: anonymous visitor (the public path a signed-out user of your deployed app hits)"));
|
|
43418
43455
|
} else {
|
|
@@ -43428,7 +43465,7 @@ serviceCommand.command("call <name> [body]").description("Call an app service by
|
|
|
43428
43465
|
`Could not mint a visitor token for this project, so there is no anonymous path to call. That means the app is not deployed on this API base yet: run \`gipity deploy dev\` first, then re-run this command.`
|
|
43429
43466
|
);
|
|
43430
43467
|
}
|
|
43431
|
-
res = await publicRequest(opts.get ? "GET" : "POST", url, opts.get ? void 0 : body, headers);
|
|
43468
|
+
res = await publicRequest(opts.get ? "GET" : "POST", url, opts.get ? void 0 : body, headers, LONG_REQUEST_TIMEOUT_MS);
|
|
43432
43469
|
} else {
|
|
43433
43470
|
res = opts.get ? await get(url) : await post(url, body, { timeoutMs: LONG_REQUEST_TIMEOUT_MS });
|
|
43434
43471
|
}
|
|
@@ -44157,7 +44194,7 @@ init_api();
|
|
|
44157
44194
|
init_config();
|
|
44158
44195
|
init_colors();
|
|
44159
44196
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync15, readFileSync as readFileSync20 } from "fs";
|
|
44160
|
-
import { resolve as resolvePath2, dirname as dirname13, relative as relative5, isAbsolute, basename as
|
|
44197
|
+
import { resolve as resolvePath2, dirname as dirname13, relative as relative5, isAbsolute, basename as basename7 } from "path";
|
|
44161
44198
|
|
|
44162
44199
|
// src/provider-docs.ts
|
|
44163
44200
|
var GEMINI_TTS_VOICES_DOC = `Zephyr, Puck, Charon, Kore, Fenrir, Leda, Orus, Aoede, Callirrhoe, Autonoe, Enceladus, Iapetus, Umbriel, Algieba, Despina, Erinome, Algenib, Rasalgethi, Laomedeia, Achernar, Alnilam, Schedar, Gacrux, Pulcherrima, Achird, Zubenelgenubi, Vindemiatrix, Sadachbia, Sadaltager, Sulafat`;
|
|
@@ -44298,7 +44335,7 @@ function noteFormatMismatch(filename, buf) {
|
|
|
44298
44335
|
const asked = dot > 0 ? filename.slice(dot + 1).toLowerCase() : "";
|
|
44299
44336
|
if (!asked || canonicalExt(asked) === actual) return;
|
|
44300
44337
|
console.error(muted(
|
|
44301
|
-
`Note: ${
|
|
44338
|
+
`Note: ${basename7(filename)} holds ${formatName(actual)} bytes though its name ends .${asked}: that's fine (browsers and image/video/edit tools sniff the bytes, not the name). Saved at the exact path you requested; reference it as-is.`
|
|
44302
44339
|
));
|
|
44303
44340
|
}
|
|
44304
44341
|
function ensureOutputDir(output) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gipity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"description": "The full-stack platform tuned for AI agents. Database, storage, auth, functions, deploy, and drop-in kits - all agent-tuned. Pair with Claude Code or use standalone.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gipity": "dist/updater/shim.js",
|