vibedgames 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/commands/completions.js +18 -18
- package/dist/commands/generate.d.ts +1 -0
- package/dist/commands/{media.js → generate.js} +12 -12
- package/dist/index.js +2 -2
- package/dist/lib/media-args.d.ts +4 -4
- package/dist/lib/media-args.js +6 -12
- package/dist/lib/media-poll.js +3 -3
- package/package.json +1 -1
- package/dist/commands/media.d.ts +0 -1
|
@@ -5,16 +5,16 @@ const SUBCOMMANDS = [
|
|
|
5
5
|
"login",
|
|
6
6
|
"logout",
|
|
7
7
|
"deploy",
|
|
8
|
-
"
|
|
8
|
+
"generate",
|
|
9
9
|
"completions",
|
|
10
10
|
"whoami",
|
|
11
11
|
];
|
|
12
|
-
const
|
|
12
|
+
const GENERATE_SUBCOMMANDS = ["run", "status", "models", "schema", "pricing", "docs", "upload"];
|
|
13
13
|
const COMMON_FLAGS = ["--help", "--version"];
|
|
14
|
-
// CLI-level flags across the
|
|
15
|
-
// arbitrary per
|
|
14
|
+
// CLI-level flags across the generate subcommands. Model parameters are
|
|
15
|
+
// arbitrary per model endpoint and passed as `--<param>`, so they can't be
|
|
16
16
|
// enumerated here — these are just the stable, command-defined flags.
|
|
17
|
-
const
|
|
17
|
+
const GENERATE_FLAGS = [
|
|
18
18
|
"--async",
|
|
19
19
|
"--download",
|
|
20
20
|
"--result",
|
|
@@ -47,12 +47,12 @@ _vg_completions() {
|
|
|
47
47
|
fi
|
|
48
48
|
|
|
49
49
|
case "$cmd" in
|
|
50
|
-
|
|
50
|
+
generate)
|
|
51
51
|
if [[ $COMP_CWORD -eq 2 ]]; then
|
|
52
|
-
COMPREPLY=( $(compgen -W "${
|
|
52
|
+
COMPREPLY=( $(compgen -W "${GENERATE_SUBCOMMANDS.join(" ")} ${GENERATE_FLAGS.join(" ")} ${COMMON_FLAGS.join(" ")}" -- "$cur") )
|
|
53
53
|
return
|
|
54
54
|
fi
|
|
55
|
-
COMPREPLY=( $(compgen -W "${
|
|
55
|
+
COMPREPLY=( $(compgen -W "${GENERATE_FLAGS.join(" ")} ${COMMON_FLAGS.join(" ")}" -- "$cur") )
|
|
56
56
|
return
|
|
57
57
|
;;
|
|
58
58
|
*)
|
|
@@ -67,10 +67,10 @@ complete -F _vg_completions vg
|
|
|
67
67
|
function zshScript() {
|
|
68
68
|
return `# vg completions for zsh. Source this file or place it on your fpath.
|
|
69
69
|
_vg() {
|
|
70
|
-
local -a subcmds
|
|
70
|
+
local -a subcmds generate_subs generate_flags common_flags
|
|
71
71
|
subcmds=(${SUBCOMMANDS.map((s) => `"${s}"`).join(" ")})
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
generate_subs=(${GENERATE_SUBCOMMANDS.map((s) => `"${s}"`).join(" ")})
|
|
73
|
+
generate_flags=(${GENERATE_FLAGS.map((s) => `"${s}"`).join(" ")})
|
|
74
74
|
common_flags=(${COMMON_FLAGS.map((s) => `"${s}"`).join(" ")})
|
|
75
75
|
|
|
76
76
|
if (( CURRENT == 2 )); then
|
|
@@ -78,12 +78,12 @@ _vg() {
|
|
|
78
78
|
return
|
|
79
79
|
fi
|
|
80
80
|
case "\${words[2]}" in
|
|
81
|
-
|
|
81
|
+
generate)
|
|
82
82
|
if (( CURRENT == 3 )); then
|
|
83
|
-
_values "vg
|
|
83
|
+
_values "vg generate subcommand" "\${generate_subs[@]}" "\${generate_flags[@]}" "\${common_flags[@]}"
|
|
84
84
|
return
|
|
85
85
|
fi
|
|
86
|
-
_values "vg
|
|
86
|
+
_values "vg generate flag" "\${generate_flags[@]}" "\${common_flags[@]}"
|
|
87
87
|
;;
|
|
88
88
|
*)
|
|
89
89
|
_values "vg flag" "\${common_flags[@]}"
|
|
@@ -100,17 +100,17 @@ function fishFlag(flag, condition) {
|
|
|
100
100
|
return `complete -c vg -n '${condition}' ${opt} '${name}'`;
|
|
101
101
|
}
|
|
102
102
|
function fishScript() {
|
|
103
|
-
const
|
|
103
|
+
const generateFlagLines = [...GENERATE_FLAGS, ...COMMON_FLAGS].map((flag) => fishFlag(flag, "__fish_seen_subcommand_from generate"));
|
|
104
104
|
// For all other subcommands, only the common flags are meaningful.
|
|
105
|
-
const otherSubcommands = SUBCOMMANDS.filter((s) => s !== "
|
|
105
|
+
const otherSubcommands = SUBCOMMANDS.filter((s) => s !== "generate");
|
|
106
106
|
const otherFlagLines = COMMON_FLAGS.flatMap((flag) => otherSubcommands.map((sub) => fishFlag(flag, `__fish_seen_subcommand_from ${sub}`)));
|
|
107
107
|
const topLevelFlagLines = COMMON_FLAGS.map((flag) => fishFlag(flag, "__fish_use_subcommand"));
|
|
108
108
|
return `# vg completions for fish.
|
|
109
109
|
complete -c vg -f
|
|
110
110
|
complete -c vg -n '__fish_use_subcommand' -a '${SUBCOMMANDS.join(" ")}'
|
|
111
111
|
${topLevelFlagLines.join("\n")}
|
|
112
|
-
${
|
|
113
|
-
${
|
|
112
|
+
${GENERATE_SUBCOMMANDS.map((sub) => `complete -c vg -n '__fish_seen_subcommand_from generate' -a '${sub}'`).join("\n")}
|
|
113
|
+
${generateFlagLines.join("\n")}
|
|
114
114
|
${otherFlagLines.join("\n")}
|
|
115
115
|
`;
|
|
116
116
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateCommand: import("citty").CommandDef<import("citty").ArgsDef>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineCommand } from "citty";
|
|
2
2
|
import consola from "consola";
|
|
3
3
|
import { createClient } from "../lib/api.js";
|
|
4
|
-
import { parseDownloadFlag, parseRunInput, readExplicitLocalFile
|
|
4
|
+
import { parseDownloadFlag, parseRunInput, readExplicitLocalFile } from "../lib/media-args.js";
|
|
5
5
|
import { downloadMedia, extractMediaRefs } from "../lib/media-download.js";
|
|
6
6
|
import { endpointPath, queueAppId, waitForCompletion } from "../lib/media-poll.js";
|
|
7
7
|
import { uploadFile } from "../lib/media-upload.js";
|
|
@@ -33,7 +33,7 @@ function extractMediaUrls(result) {
|
|
|
33
33
|
}
|
|
34
34
|
// ---- run --------------------------------------------------------------------
|
|
35
35
|
const runCommand = defineCommand({
|
|
36
|
-
meta: { name: "run", description: "Run a
|
|
36
|
+
meta: { name: "run", description: "Run a model (waits for result by default)." },
|
|
37
37
|
args: {
|
|
38
38
|
endpoint_id: {
|
|
39
39
|
type: "positional",
|
|
@@ -57,25 +57,25 @@ const runCommand = defineCommand({
|
|
|
57
57
|
// endpoint_id and any subcommand name in argv are no-ops.
|
|
58
58
|
const finalInput = parseRunInput(rawArgs);
|
|
59
59
|
const client = createClient();
|
|
60
|
+
const endpoint_id = args.endpoint_id;
|
|
60
61
|
const submission = await client.media.forward.mutate({
|
|
61
62
|
target: "queue",
|
|
62
63
|
method: "POST",
|
|
63
|
-
path: `/${endpointPath(
|
|
64
|
+
path: `/${endpointPath(endpoint_id)}`,
|
|
64
65
|
body: finalInput,
|
|
65
66
|
});
|
|
66
67
|
const requestId = isRecord(submission) && typeof submission.request_id === "string"
|
|
67
68
|
? submission.request_id
|
|
68
69
|
: null;
|
|
69
70
|
if (!requestId) {
|
|
70
|
-
throw new Error("
|
|
71
|
+
throw new Error("queue submit did not return a request_id.");
|
|
71
72
|
}
|
|
72
|
-
const endpoint_id = args.endpoint_id;
|
|
73
73
|
if (args.async) {
|
|
74
74
|
const payload = {
|
|
75
75
|
status: "submitted",
|
|
76
76
|
endpoint_id,
|
|
77
77
|
request_id: requestId,
|
|
78
|
-
hint: `Check status: vg
|
|
78
|
+
hint: `Check status: vg generate status ${endpoint_id} ${requestId}`,
|
|
79
79
|
};
|
|
80
80
|
if (isJsonOutput(args))
|
|
81
81
|
writeJson(payload);
|
|
@@ -221,7 +221,7 @@ const statusCommand = defineCommand({
|
|
|
221
221
|
});
|
|
222
222
|
// ---- models -----------------------------------------------------------------
|
|
223
223
|
const modelsCommand = defineCommand({
|
|
224
|
-
meta: { name: "models", description: "Search/list
|
|
224
|
+
meta: { name: "models", description: "Search/list available models." },
|
|
225
225
|
args: {
|
|
226
226
|
query: { type: "positional", required: false, description: "Search query." },
|
|
227
227
|
category: { type: "string", description: "Filter by category." },
|
|
@@ -338,7 +338,7 @@ const pricingCommand = defineCommand({
|
|
|
338
338
|
});
|
|
339
339
|
// ---- docs -------------------------------------------------------------------
|
|
340
340
|
const docsCommand = defineCommand({
|
|
341
|
-
meta: { name: "docs", description: "Search
|
|
341
|
+
meta: { name: "docs", description: "Search generative-model documentation." },
|
|
342
342
|
args: {
|
|
343
343
|
query: { type: "positional", required: true },
|
|
344
344
|
json: { type: "boolean" },
|
|
@@ -363,7 +363,7 @@ const docsCommand = defineCommand({
|
|
|
363
363
|
const uploadCommand = defineCommand({
|
|
364
364
|
meta: {
|
|
365
365
|
name: "upload",
|
|
366
|
-
description: "Upload a local file
|
|
366
|
+
description: "Upload a local file. Returns a stable hosted URL.",
|
|
367
367
|
},
|
|
368
368
|
args: {
|
|
369
369
|
path: { type: "positional", required: true },
|
|
@@ -384,10 +384,10 @@ const uploadCommand = defineCommand({
|
|
|
384
384
|
},
|
|
385
385
|
});
|
|
386
386
|
// ---- top-level --------------------------------------------------------------
|
|
387
|
-
export const
|
|
387
|
+
export const generateCommand = defineCommand({
|
|
388
388
|
meta: {
|
|
389
|
-
name: "
|
|
390
|
-
description: "Generate, edit, and inspect
|
|
389
|
+
name: "generate",
|
|
390
|
+
description: "Generate, edit, and inspect images, video, and audio.",
|
|
391
391
|
},
|
|
392
392
|
subCommands: {
|
|
393
393
|
run: runCommand,
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import { defineCommand, runMain } from "citty";
|
|
|
4
4
|
import { completionsCommand } from "./commands/completions.js";
|
|
5
5
|
import { deployCommand } from "./commands/deploy.js";
|
|
6
6
|
import { forkCommand } from "./commands/fork.js";
|
|
7
|
+
import { generateCommand } from "./commands/generate.js";
|
|
7
8
|
import { initCommand } from "./commands/init.js";
|
|
8
9
|
import { loginCommand } from "./commands/login.js";
|
|
9
10
|
import { logoutCommand } from "./commands/logout.js";
|
|
10
|
-
import { mediaCommand } from "./commands/media.js";
|
|
11
11
|
import { newCommand } from "./commands/new.js";
|
|
12
12
|
import { whoamiCommand } from "./commands/whoami.js";
|
|
13
13
|
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
@@ -24,7 +24,7 @@ const main = defineCommand({
|
|
|
24
24
|
logout: logoutCommand,
|
|
25
25
|
deploy: deployCommand,
|
|
26
26
|
fork: forkCommand,
|
|
27
|
-
|
|
27
|
+
generate: generateCommand,
|
|
28
28
|
completions: completionsCommand,
|
|
29
29
|
whoami: whoamiCommand,
|
|
30
30
|
},
|
package/dist/lib/media-args.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parse `--<key> value` pairs from argv into a JS object, JSON-decoding
|
|
3
3
|
* values that look like JSON (true/false/null/numbers/objects/arrays) and
|
|
4
|
-
* leaving everything else as a string.
|
|
5
|
-
*
|
|
4
|
+
* leaving everything else as a string. The parse-value behavior is stable
|
|
5
|
+
* so skills targeting this surface produce the same input shapes.
|
|
6
6
|
*
|
|
7
7
|
* Handles both `--key value` and the GNU-style `--key=value`. Without
|
|
8
8
|
* `=` support, `--prompt=hello` would silently send the malformed key
|
|
9
|
-
* `"prompt=hello"`
|
|
9
|
+
* `"prompt=hello"` upstream, and `--async=true` would slip past the
|
|
10
10
|
* RUN_RESERVED_FLAGS guard as a bogus model param.
|
|
11
11
|
*/
|
|
12
12
|
export declare function parseRunInput(argv: string[]): Record<string, unknown>;
|
|
@@ -17,7 +17,7 @@ export type LocalFile = {
|
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* Probe a path the user explicitly asked us to read (e.g.
|
|
20
|
-
* `vg
|
|
20
|
+
* `vg generate upload <path>`). Skips the path-shape heuristic so a bare
|
|
21
21
|
* filename with a non-media extension — `model.glb`, `scene.fbx`,
|
|
22
22
|
* `data.ply`, even `LICENSE` — still works.
|
|
23
23
|
*/
|
package/dist/lib/media-args.js
CHANGED
|
@@ -4,25 +4,19 @@ import { basename, extname, isAbsolute, join, resolve } from "node:path";
|
|
|
4
4
|
// `--json`/`--help`/`--quiet` are global; `--async` switches the run path
|
|
5
5
|
// in citty; `--download` takes an optional template. None of them should
|
|
6
6
|
// leak through to fal as model parameters. `--logs` is intentionally NOT
|
|
7
|
-
// here: it's a `vg
|
|
7
|
+
// here: it's a `vg generate status` flag, not a `run` flag, so swallowing it
|
|
8
8
|
// would block users from passing a legitimate `logs` parameter to a
|
|
9
9
|
// model endpoint.
|
|
10
|
-
const RUN_RESERVED_FLAGS = new Set([
|
|
11
|
-
"--json",
|
|
12
|
-
"--help",
|
|
13
|
-
"--quiet",
|
|
14
|
-
"--async",
|
|
15
|
-
"--download",
|
|
16
|
-
]);
|
|
10
|
+
const RUN_RESERVED_FLAGS = new Set(["--json", "--help", "--quiet", "--async", "--download"]);
|
|
17
11
|
/**
|
|
18
12
|
* Parse `--<key> value` pairs from argv into a JS object, JSON-decoding
|
|
19
13
|
* values that look like JSON (true/false/null/numbers/objects/arrays) and
|
|
20
|
-
* leaving everything else as a string.
|
|
21
|
-
*
|
|
14
|
+
* leaving everything else as a string. The parse-value behavior is stable
|
|
15
|
+
* so skills targeting this surface produce the same input shapes.
|
|
22
16
|
*
|
|
23
17
|
* Handles both `--key value` and the GNU-style `--key=value`. Without
|
|
24
18
|
* `=` support, `--prompt=hello` would silently send the malformed key
|
|
25
|
-
* `"prompt=hello"`
|
|
19
|
+
* `"prompt=hello"` upstream, and `--async=true` would slip past the
|
|
26
20
|
* RUN_RESERVED_FLAGS guard as a bogus model param.
|
|
27
21
|
*/
|
|
28
22
|
export function parseRunInput(argv) {
|
|
@@ -100,7 +94,7 @@ function parseValue(raw) {
|
|
|
100
94
|
}
|
|
101
95
|
/**
|
|
102
96
|
* Probe a path the user explicitly asked us to read (e.g.
|
|
103
|
-
* `vg
|
|
97
|
+
* `vg generate upload <path>`). Skips the path-shape heuristic so a bare
|
|
104
98
|
* filename with a non-media extension — `model.glb`, `scene.fbx`,
|
|
105
99
|
* `data.ply`, even `LICENSE` — still works.
|
|
106
100
|
*/
|
package/dist/lib/media-poll.js
CHANGED
|
@@ -33,9 +33,9 @@ export async function waitForCompletion(client, endpoint_id, request_id, opts) {
|
|
|
33
33
|
let lastStatus;
|
|
34
34
|
while (true) {
|
|
35
35
|
if (Date.now() > deadline) {
|
|
36
|
-
throw new Error(`
|
|
36
|
+
throw new Error(`Job did not complete within ${POLL_TIMEOUT_MS}ms ` +
|
|
37
37
|
`(endpoint=${endpoint_id} request_id=${request_id}). ` +
|
|
38
|
-
`Use \`vg
|
|
38
|
+
`Use \`vg generate status ${endpoint_id} ${request_id} --result\` to check later.`);
|
|
39
39
|
}
|
|
40
40
|
const raw = await client.media.forward.mutate({
|
|
41
41
|
target: "queue",
|
|
@@ -54,7 +54,7 @@ export async function waitForCompletion(client, endpoint_id, request_id, opts) {
|
|
|
54
54
|
break;
|
|
55
55
|
if (upper === "FAILED" || upper === "CANCELLED") {
|
|
56
56
|
const reason = pickErrorReason(raw);
|
|
57
|
-
throw new Error(reason ? `
|
|
57
|
+
throw new Error(reason ? `Job ${upper.toLowerCase()}: ${reason}` : `Job ${upper.toLowerCase()}`);
|
|
58
58
|
}
|
|
59
59
|
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
60
60
|
}
|
package/package.json
CHANGED
package/dist/commands/media.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const mediaCommand: import("citty").CommandDef<import("citty").ArgsDef>;
|