gipity 1.1.9 → 1.1.11

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.
@@ -1,3 +1,4 @@
1
+ import { planForInstall, whichFirst } from './self-update.js';
1
2
  import { ensureClaudeInstalled, CLAUDE_PACKAGE } from '../claude-setup.js';
2
3
  import { parseTranscript as parseClaudeTranscript } from '../capture/sources/claude-code.js';
3
4
  import { userScopeInstallState, ensureGipityPluginInstalled, setupClaudeHooks, removeGipityPluginConfig, } from '../setup.js';
@@ -47,6 +48,13 @@ export const claudeCodeAdapter = {
47
48
  return ensureClaudeInstalled().installed;
48
49
  },
49
50
  installHint: `npm install -g ${CLAUDE_PACKAGE}`,
51
+ updatePlan() {
52
+ // Same-channel rule (see agents/self-update.ts): npm-global installs
53
+ // (what ensureClaudeInstalled sets up) update via npm; anything else gets
54
+ // Anthropic's own `claude update` - the native installer's self-updater,
55
+ // which is a harmless error on installs it doesn't manage.
56
+ return planForInstall(whichFirst('claude'), CLAUDE_PACKAGE, ['claude', 'update']);
57
+ },
50
58
  detectEnv() {
51
59
  // Most reliable: CLAUDECODE=1 plus a versioned exec path.
52
60
  if (process.env.CLAUDECODE === '1' || process.env.CLAUDE_CODE_ENTRYPOINT) {
@@ -1,4 +1,5 @@
1
1
  import { hasEnvPrefix } from './types.js';
2
+ import { planForInstall, whichFirst } from './self-update.js';
2
3
  import { parseTranscript as parseCodexTranscript } from '../capture/sources/codex.js';
3
4
  import { agentSkillsState, ensureAgentSkillsInstalled, setupCodexHooks, removeAgentSkills } from '../setup.js';
4
5
  export const codexAdapter = {
@@ -45,6 +46,11 @@ export const codexAdapter = {
45
46
  daemonStreamCapture: false,
46
47
  oneTimeSetupNote: 'Codex runs project hooks only after a one-time approval: run /hooks inside Codex and approve the Gipity entries, or session recording stays off.',
47
48
  installHint: 'npm install -g @openai/codex',
49
+ updatePlan() {
50
+ // npm-global installs only; brew/other channels stay manual (no
51
+ // self-updater fallback - see agents/self-update.ts's same-channel rule).
52
+ return planForInstall(whichFirst('codex'), '@openai/codex', null);
53
+ },
48
54
  detectEnv() {
49
55
  return hasEnvPrefix('CODEX_') ? { harness: 'codex' } : null;
50
56
  },
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Install-type detection + update plans backing adapter `updatePlan()`s
3
+ * (the relay daemon's daily harness auto-update; see relay/agent-updates.ts).
4
+ *
5
+ * The rule is conservative: only update through the SAME channel the binary
6
+ * was installed with. An npm-global install (what our own ensureInstalled
7
+ * paths set up) gets `npm install -g <pkg>@latest`; anything else falls back
8
+ * to the agent's own self-updater when it has one (`claude update`), and is
9
+ * otherwise left alone (brew, curl-script, GUI installs) - a wrong-channel
10
+ * update could shadow or corrupt the real install.
11
+ */
12
+ import { execSync } from 'child_process';
13
+ import { existsSync, realpathSync } from 'fs';
14
+ import { dirname, join, sep } from 'path';
15
+ /** First PATH hit for `binary` (`which`/`where`), or null when absent. */
16
+ export function whichFirst(binary) {
17
+ const cmd = process.platform === 'win32' ? `where ${binary}` : `which ${binary}`;
18
+ try {
19
+ const out = execSync(cmd, { stdio: ['ignore', 'pipe', 'ignore'], encoding: 'utf-8', windowsHide: true });
20
+ return out.split('\n').map(l => l.trim()).find(Boolean) || null;
21
+ }
22
+ catch {
23
+ return null; // execSync throws when the binary isn't on PATH
24
+ }
25
+ }
26
+ /**
27
+ * True when `binPath` is an npm-global install of `pkg`: the bin shim either
28
+ * realpath-resolves into `node_modules/<pkg>/` (Unix symlink shims) or sits
29
+ * next to a `node_modules/<pkg>` dir (Windows .cmd shims live in the prefix
30
+ * root beside node_modules).
31
+ */
32
+ export function isNpmManaged(binPath, pkg) {
33
+ const marker = join('node_modules', ...pkg.split('/')) + sep;
34
+ try {
35
+ if (realpathSync(binPath).includes(marker))
36
+ return true;
37
+ }
38
+ catch { /* dangling symlink or unreadable - fall through */ }
39
+ try {
40
+ return existsSync(join(dirname(binPath), 'node_modules', ...pkg.split('/')));
41
+ }
42
+ catch {
43
+ return false;
44
+ }
45
+ }
46
+ /** npm-global update argv. Lifecycle scripts stay ENABLED - this is the same
47
+ * channel the original `npm install -g` used, and some agent packages need
48
+ * their scripts to finish an install. */
49
+ export function npmLatestArgv(pkg) {
50
+ return ['npm', 'install', '-g', '--no-audit', '--no-fund', `${pkg}@latest`];
51
+ }
52
+ /**
53
+ * Pick the update plan for a resolved binary path (null when not installed).
54
+ * `selfUpdateArgv` is the agent's own self-updater for non-npm installs, or
55
+ * null when it has none (those installs stay manual).
56
+ */
57
+ export function planForInstall(binPath, pkg, selfUpdateArgv) {
58
+ if (!binPath)
59
+ return null;
60
+ if (isNpmManaged(binPath, pkg))
61
+ return { argv: npmLatestArgv(pkg), label: 'npm', pkg };
62
+ return selfUpdateArgv ? { argv: selfUpdateArgv, label: selfUpdateArgv.join(' ') } : null;
63
+ }
64
+ //# sourceMappingURL=self-update.js.map
@@ -1,7 +1,7 @@
1
1
  import { Command } from 'commander';
2
2
  import { get, post, put, del } from '../api.js';
3
3
  import { requireConfig, saveConfig } from '../config.js';
4
- import { error as clrError, success } from '../colors.js';
4
+ import { error as clrError, success, muted } from '../colors.js';
5
5
  import { run, printList, printResult } from '../helpers/index.js';
6
6
  import { confirm } from '../utils.js';
7
7
  export const agentCommand = new Command('agent')
@@ -32,10 +32,35 @@ export const agentCommand = new Command('agent')
32
32
  return `${a.name}${active}${def}${model}`;
33
33
  });
34
34
  }));
35
+ agentCommand
36
+ .command('models')
37
+ .description('List the LLM models an agent can use (ids for `agent create --model` and `agent set model`)')
38
+ .option('--json', 'Output as JSON')
39
+ .action((opts) => run('Models', async () => {
40
+ const res = await get('/agents/models');
41
+ if (opts.json) {
42
+ console.log(JSON.stringify(res.data));
43
+ return;
44
+ }
45
+ const width = res.data.reduce((m, x) => Math.max(m, x.id.length), 0);
46
+ for (const m of res.data) {
47
+ const notes = [
48
+ m.displayName,
49
+ m.provider,
50
+ `$${m.inputCostPerMTok}/$${m.outputCostPerMTok} per 1M tok`,
51
+ `${Math.round(m.maxContextTokens / 1000)}K ctx`,
52
+ ];
53
+ if (m.blurb)
54
+ notes.push(m.blurb);
55
+ if (m.isDefault)
56
+ notes.push('default');
57
+ console.log(`${m.id.padEnd(width)} ${muted(notes.join(' · '))}`);
58
+ }
59
+ }));
35
60
  agentCommand
36
61
  .command('create <name>')
37
62
  .description('Create an agent')
38
- .option('--model <model>', 'Model preference')
63
+ .option('--model <model>', 'Model preference (an id from `gipity agent models`; default: platform default)')
39
64
  .option('--switch', 'Switch to new agent after creation')
40
65
  .option('--json', 'Output as JSON')
41
66
  .action((name, opts) => run('Create', async () => {
@@ -58,7 +83,7 @@ agentCommand
58
83
  }));
59
84
  agentCommand
60
85
  .command('set <field> <value>')
61
- .description('Set a field (model, temp)')
86
+ .description('Set a field (model, temp). Model ids: `gipity agent models`')
62
87
  .option('--json', 'Output as JSON')
63
88
  .action((field, value, opts) => run('Set', async () => {
64
89
  const config = requireConfig();
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { Command, Option } from 'commander';
2
2
  import { get, post } from '../api.js';
3
3
  import { muted, success } from '../colors.js';
4
4
  import { run, printList, printResult } from '../helpers/index.js';
@@ -25,7 +25,7 @@ export const approvalCommand = new Command('approval')
25
25
  approvalCommand
26
26
  .command('list')
27
27
  .description('List pending approvals')
28
- .option('--status <status>', 'pending|approved|denied|cancelled|expired|all', 'pending')
28
+ .addOption(new Option('--status <status>', 'Filter by status').choices(['pending', 'approved', 'denied', 'cancelled', 'expired', 'all']).default('pending'))
29
29
  .option('--json', 'Output as JSON')
30
30
  .action((opts) => run('List', async () => {
31
31
  const res = await get(`/approvals?status=${encodeURIComponent(opts.status)}`);
@@ -35,7 +35,7 @@ approvalCommand
35
35
  .command('create <title...>')
36
36
  .description('Create a pending approval')
37
37
  .option('--description <text>', 'Detailed context')
38
- .option('--type <type>', 'yes_no | choice | text', 'yes_no')
38
+ .addOption(new Option('--type <type>', 'Approval type').choices(['yes_no', 'choice', 'text']).default('yes_no'))
39
39
  .option('--choices <a,b,c>', 'Comma-separated options (for --type choice)')
40
40
  .option('--prompt <text>', 'Custom prompt shown to the user')
41
41
  .option('--expires-in <minutes>', 'Minutes until expiry (default: 10080 = 7d)')
@@ -21,7 +21,7 @@ export const deployCommand = new Command('deploy')
21
21
  .description('Deploy to dev or prod')
22
22
  .argument('[target]', 'dev or prod', 'dev')
23
23
  .option('--source-dir <dir>', 'Source directory to deploy from')
24
- .option('--only <phases>', 'Run only specific phases (comma-separated)')
24
+ .option('--only <phases>', 'Run only specific phases, comma-separated, matched by gipity.yaml phase name or type: files/static, database/sql, functions, workflows, services, jobs, records, realtime, env, auth_branding')
25
25
  .option('--force', 'Re-run all phases (ignore checksums) and bypass the sync bulk-deletion guard')
26
26
  .option('--no-sync', 'Skip sync-up before deploy')
27
27
  .option('--optimize', 'Force Vite build optimization on (default for prod; use this to optimize a dev deploy too)')
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { Command, Option } from 'commander';
2
2
  import { get, post } from '../api.js';
3
3
  import { resolveProjectContext } from '../config.js';
4
4
  import { error as clrError, success, bold, muted, warning } from '../colors.js';
@@ -98,7 +98,7 @@ emailCommand
98
98
  emailCommand
99
99
  .command('log')
100
100
  .description('Recent email() sends and skipped attempts from your app')
101
- .option('--range <range>', 'Time range (24h, 7d, 30d)', '7d')
101
+ .addOption(new Option('--range <range>', 'Time range').choices(['1h', '24h', '7d', '30d', '1y']).default('7d'))
102
102
  .option('--limit <n>', 'Max rows', '50')
103
103
  .option('--project <guid-or-slug>', 'Target a specific project instead of cwd / Home')
104
104
  .option('--json', 'Output raw JSON')
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { Command, Option } from 'commander';
2
2
  import { post } from '../api.js';
3
3
  import { resolveProjectContext, getConfigPath } from '../config.js';
4
4
  import { pushFile } from '../sync.js';
@@ -8,7 +8,43 @@ import { error as clrError, success, muted } from '../colors.js';
8
8
  import { printCommandError } from '../helpers/command.js';
9
9
  import { withSpinner } from '../progress.js';
10
10
  import { guessMime } from '../upload.js';
11
- import { IMAGE_MODELS_DOC, VIDEO_MODELS_DOC, TTS_PROVIDER_DESCRIPTIONS } from '../provider-docs.js';
11
+ import { IMAGE_MODELS_TABLE, IMAGE_PROVIDER_IDS, IMAGE_QUALITY_IDS, IMAGE_TIER_ALIASES_DOC, IMAGE_TIER_ALIAS_IDS, IMAGE_GEMINI_ASPECT_RATIO_IDS, IMAGE_GEMINI_SIZE_IDS, VIDEO_MODEL_IDS, VIDEO_MODELS_TABLE, VIDEO_ASPECT_RATIOS, VIDEO_ASPECT_RATIO_IDS, VIDEO_RESOLUTION_IDS, TTS_PROVIDER_IDS, TTS_PROVIDER_DESCRIPTIONS, GEMINI_TTS_VOICES_DOC, } from '../provider-docs.js';
12
+ function printMetrics(metrics) {
13
+ const rows = metrics.filter((m) => m !== null);
14
+ const width = Math.max(...rows.map((m) => m.label.length));
15
+ for (const m of rows) {
16
+ console.log(` ${muted(`${m.label.padStart(width)}:`)} ${m.value}`);
17
+ }
18
+ }
19
+ function fmtSeconds(s) {
20
+ if (s >= 60)
21
+ return `${Math.floor(s / 60)}m ${Math.round(s % 60)}s`;
22
+ return `${s < 10 ? Math.round(s * 10) / 10 : Math.round(s)}s`;
23
+ }
24
+ /** The standard metric rows, in a fixed order so every subcommand reads the
25
+ * same: duration, size, time, speed, credits. Rows whose data is missing
26
+ * (image has no duration; free ops have no credits) are skipped. */
27
+ function generationMetrics(result, elapsedSeconds) {
28
+ // ffmpeg-style realtime multiple: media seconds produced per wall-clock
29
+ // second. Generation is slower than playback, so expect values below 1x.
30
+ const speed = result.duration_seconds !== undefined && elapsedSeconds > 0
31
+ ? result.duration_seconds / elapsedSeconds : undefined;
32
+ return [
33
+ result.duration_seconds !== undefined
34
+ ? { label: 'duration', value: `${fmtSeconds(result.duration_seconds)} clip` } : null,
35
+ { label: 'size', value: `${Math.round(result.size_bytes / 1024)}KB` },
36
+ { label: 'time', value: fmtSeconds(elapsedSeconds) },
37
+ speed !== undefined
38
+ ? { label: 'speed', value: `${speed >= 1 ? Math.round(speed * 10) / 10 : Math.round(speed * 100) / 100}x realtime` } : null,
39
+ result.credits_deducted !== undefined
40
+ ? { label: 'credits', value: `${result.credits_deducted.toLocaleString('en-US')} (${result.remaining_balance.toLocaleString('en-US')} remaining)` } : null,
41
+ ];
42
+ }
43
+ /** JSON-mode result: the server fields plus how long generation took and
44
+ * where the file landed. */
45
+ function jsonResult(result, elapsedSeconds, savedPath) {
46
+ return JSON.stringify({ ...result, generation_seconds: Math.round(elapsedSeconds * 10) / 10, saved: savedPath });
47
+ }
12
48
  /** Download a URL and save to a local file, then push it up to the project so
13
49
  * the cloud (and anything that mirrors it) immediately matches local disk.
14
50
  * Returns the absolute path written, so callers can report where it landed.
@@ -172,7 +208,11 @@ function readInputImages(paths) {
172
208
  const imageCommand = new Command('image')
173
209
  .description('Generate an image from a text prompt, or edit existing images with --input')
174
210
  .addHelpText('after', `
175
- Models: ${IMAGE_MODELS_DOC}
211
+ Models (one line per provider; pass an id with --model, the provider with --provider):
212
+ ${IMAGE_MODELS_TABLE}
213
+
214
+ Tier aliases (pass to --model instead of an id; each names a provider+model):
215
+ ${IMAGE_TIER_ALIASES_DOC}
176
216
 
177
217
  Editing (--input): pass one or more source images and the prompt becomes an edit
178
218
  instruction applied to them - "make it night time", "add a hat", "remove the car
@@ -189,12 +229,12 @@ Examples:
189
229
  `)
190
230
  .argument('<prompt>', 'Text description of the image, or (with --input) the edit instruction to apply')
191
231
  .option('--input <file>', 'Source image to edit/compose (repeatable). With --input the prompt is an edit instruction; routes to Gemini.', (v, acc) => (acc || []).concat(v))
192
- .option('--provider <provider>', 'Image provider: openai, bfl, or gemini (default: bfl)')
193
- .option('--model <model>', 'Model ID (see provider list above)')
232
+ .addOption(new Option('--provider <provider>', 'Image provider (default: bfl)').choices(IMAGE_PROVIDER_IDS))
233
+ .option('--model <model>', `Model id for the chosen provider, or a tier alias (${IMAGE_TIER_ALIAS_IDS.join(', ')}); see Models below`)
194
234
  .option('--size <size>', 'Dimensions as WxH, e.g. "1024x1024" (OpenAI/BFL)')
195
- .option('--quality <quality>', 'Quality: low|medium|high|auto (gpt-image-2)')
196
- .option('--aspect-ratio <ratio>', 'Aspect ratio (Gemini only): 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 4:5, 5:4, 21:9')
197
- .option('--image-size <size>', 'Output resolution (Gemini only): 512, 1K, 2K, 4K')
235
+ .addOption(new Option('--quality <quality>', 'Quality (gpt-image-2 only)').choices(IMAGE_QUALITY_IDS))
236
+ .addOption(new Option('--aspect-ratio <ratio>', 'Aspect ratio (Gemini only)').choices(IMAGE_GEMINI_ASPECT_RATIO_IDS))
237
+ .addOption(new Option('--image-size <size>', 'Output resolution (Gemini only)').choices(IMAGE_GEMINI_SIZE_IDS))
198
238
  .option('--seed <n>', 'Deterministic seed (BFL only): reuse one seed to keep a set of images visually coherent', (v) => parseInt(v, 10))
199
239
  .option('-o, --output <file>', 'Output path (default ./generated.png). For an image your app ships, write it into the source tree so it deploys, e.g. -o src/assets/images/hero.png; the cwd default is fine for one-off generation.')
200
240
  .option('--json', 'Output as JSON')
@@ -216,21 +256,24 @@ Examples:
216
256
  input_images: inputImages,
217
257
  });
218
258
  const verb = inputImages ? 'Editing image...' : 'Generating image...';
259
+ const started = Date.now();
219
260
  const result = opts.json
220
261
  ? await doGenerate()
221
262
  : await withSpinner(verb, doGenerate, { done: null });
263
+ const elapsed = (Date.now() - started) / 1000;
222
264
  const ext = result.content_type.includes('png') ? 'png' : 'jpg';
223
265
  const filename = opts.output || `generated.${ext}`;
224
266
  const savedPath = await downloadFile(result.url, filename, !!opts.output);
225
267
  if (opts.json) {
226
- console.log(JSON.stringify({ ...result, saved: savedPath }));
268
+ console.log(jsonResult(result, elapsed, savedPath));
227
269
  }
228
270
  else {
229
- const sizeKb = Math.round(result.size_bytes / 1024);
230
- console.log(`${muted(`Generated with ${result.provider}/${result.model} (${sizeKb}KB)`)}`);
231
- if (result.seed !== undefined) {
232
- console.log(muted(`Seed ${result.seed} — pass --seed ${result.seed} to keep the next image coherent`));
233
- }
271
+ console.log(muted(`Generated with ${result.provider}/${result.model}`));
272
+ printMetrics([
273
+ ...generationMetrics(result, elapsed),
274
+ result.seed !== undefined
275
+ ? { label: 'seed', value: `${result.seed} ${muted(`(pass --seed ${result.seed} to keep the next image coherent)`)}` } : null,
276
+ ]);
234
277
  // Saved-path last: a caller reading a truncated tail of this output (an
235
278
  // agent batching several generates in one shell call) must still see
236
279
  // WHERE the bytes landed - that is the one line the next command needs.
@@ -246,7 +289,10 @@ Examples:
246
289
  const videoCommand = new Command('video')
247
290
  .description('Generate a short video (up to 8 seconds) from a text prompt using Google Veo')
248
291
  .addHelpText('after', `
249
- Models: ${VIDEO_MODELS_DOC}
292
+ Models (default: veo-3.1-generate-preview):
293
+ ${VIDEO_MODELS_TABLE}
294
+
295
+ Aspect ratios: ${VIDEO_ASPECT_RATIOS}
250
296
 
251
297
  Tips:
252
298
  - Describe the scene, camera movement, lighting, and any dialogue
@@ -257,11 +303,13 @@ Examples:
257
303
  gipity generate video "a bird flying over a mountain lake at sunset"
258
304
  gipity generate video "close-up of coffee being poured" --model veo-3.1-fast-generate-preview
259
305
  gipity generate video "vertical dance video" --aspect 9:16 --resolution 1080p -o dance.mp4
306
+ gipity generate video "a wave crashing" --duration 4 --model veo-3.1-lite-generate-preview
260
307
  `)
261
308
  .argument('<prompt>', 'Description of the video scene, action, camera movement, and dialogue')
262
- .option('--model <model>', 'Veo model: veo-3.1-generate-preview (quality), veo-3.1-fast-generate-preview (speed), veo-3.1-lite-generate-preview (budget)')
263
- .option('--aspect <ratio>', 'Aspect ratio: 16:9 (landscape), 9:16 (portrait), 1:1 (square)')
264
- .option('--resolution <res>', 'Video resolution: 720p, 1080p, 4k')
309
+ .addOption(new Option('--model <model>', 'Video model; see Models below for quality/price').choices(VIDEO_MODEL_IDS))
310
+ .addOption(new Option('--aspect <ratio>', 'Aspect ratio (landscape, portrait, square)').choices(VIDEO_ASPECT_RATIO_IDS))
311
+ .addOption(new Option('--resolution <res>', 'Video resolution').choices(VIDEO_RESOLUTION_IDS))
312
+ .option('--duration <seconds>', 'Clip length in seconds. Veo models: 4, 6, or 8 (8 required at 1080p/4K); omni-flash: 3-10. Default 8. Billing is per second, so shorter is cheaper.')
265
313
  .option('-o, --output <file>', 'Output path (default ./generated.mp4). For a clip your app ships, write it into the source tree so it deploys, e.g. -o src/assets/video/clip.mp4; the cwd default is fine for one-off generation.')
266
314
  .option('--json', 'Output as JSON')
267
315
  .action(async (prompt, opts) => {
@@ -274,19 +322,22 @@ Examples:
274
322
  model: opts.model,
275
323
  aspect_ratio: opts.aspect,
276
324
  resolution: opts.resolution,
325
+ duration_seconds: opts.duration ? Number(opts.duration) : undefined,
277
326
  });
278
327
  // Veo runs 30-120s; the bouncing bar + timer keeps the wait honest.
328
+ const started = Date.now();
279
329
  const result = opts.json
280
330
  ? await doGenerate()
281
331
  : await withSpinner('Generating video...', doGenerate, { done: null });
332
+ const elapsed = (Date.now() - started) / 1000;
282
333
  const filename = opts.output || 'generated.mp4';
283
334
  const savedPath = await downloadFile(result.url, filename, !!opts.output);
284
335
  if (opts.json) {
285
- console.log(JSON.stringify({ ...result, saved: savedPath }));
336
+ console.log(jsonResult(result, elapsed, savedPath));
286
337
  }
287
338
  else {
288
- const sizeKb = Math.round(result.size_bytes / 1024);
289
- console.log(`${muted(`Generated with ${result.provider}/${result.model} (${sizeKb}KB)`)}`);
339
+ console.log(muted(`Generated with ${result.provider}/${result.model}`));
340
+ printMetrics(generationMetrics(result, elapsed));
290
341
  console.log(success(`Saved to ${savedPath}`));
291
342
  }
292
343
  }
@@ -299,7 +350,13 @@ Examples:
299
350
  const speechCommand = new Command('speech')
300
351
  .description('Generate speech audio from text using text-to-speech')
301
352
  .addHelpText('after', `
302
- Providers: ${Object.entries(TTS_PROVIDER_DESCRIPTIONS).map(([k, v]) => `${k} - ${v}`).join('\n ')}
353
+ Providers:
354
+ ${Object.entries(TTS_PROVIDER_DESCRIPTIONS).map(([k, v]) => ` ${k.padEnd(10)} ${v}`).join('\n')}
355
+
356
+ Voices: openai voices are the list above; the full Gemini list is below. ElevenLabs
357
+ voice ids: gipity service call "tts/voices?provider=elevenlabs" --get
358
+
359
+ Gemini voices: ${GEMINI_TTS_VOICES_DOC}
303
360
 
304
361
  Multi-speaker (--speakers, Gemini only): JSON array like
305
362
  [{"name":"Joe","voice":"Kore"},{"name":"Jane","voice":"Puck"}]; format the
@@ -312,8 +369,8 @@ Examples:
312
369
  gipity generate speech 'Joe: Hey!\\nJane: Hi there!' --provider gemini --speakers '[{"name":"Joe","voice":"Charon"},{"name":"Jane","voice":"Leda"}]'
313
370
  `)
314
371
  .argument('<text>', 'Text to convert to speech (max 5000 characters)')
315
- .option('--provider <provider>', 'TTS provider: elevenlabs (default), openai, or gemini')
316
- .option('--voice <voice>', 'Voice ID or name (provider-specific)')
372
+ .addOption(new Option('--provider <provider>', 'TTS provider (default: elevenlabs)').choices(TTS_PROVIDER_IDS))
373
+ .option('--voice <voice>', 'Voice ID or name (provider-specific; see Voices below)')
317
374
  .option('--language <code>', 'BCP-47 language code, e.g. ja-JP, es-ES (Gemini only, 60+ languages)')
318
375
  .option('--speakers <json>', 'Multi-speaker config as JSON array (Gemini only, up to 2 speakers)')
319
376
  .option('-o, --output <file>', 'Output path (default ./speech.mp3). For audio your app ships, write it into the source tree so it deploys, e.g. -o src/assets/sounds/intro.mp3; the cwd default is fine for one-off generation.')
@@ -340,17 +397,19 @@ Examples:
340
397
  language: opts.language,
341
398
  speakers,
342
399
  });
400
+ const started = Date.now();
343
401
  const result = opts.json
344
402
  ? await doGenerate()
345
403
  : await withSpinner('Generating speech...', doGenerate, { done: null });
404
+ const elapsed = (Date.now() - started) / 1000;
346
405
  const filename = opts.output || 'speech.mp3';
347
406
  const savedPath = await downloadFile(result.url, filename, !!opts.output);
348
407
  if (opts.json) {
349
- console.log(JSON.stringify({ ...result, saved: savedPath }));
408
+ console.log(jsonResult(result, elapsed, savedPath));
350
409
  }
351
410
  else {
352
- const sizeKb = Math.round(result.size_bytes / 1024);
353
- console.log(`${muted(`Generated with ${result.provider} (${sizeKb}KB)`)}`);
411
+ console.log(muted(`Generated with ${result.provider}`));
412
+ printMetrics(generationMetrics(result, elapsed));
354
413
  console.log(success(`Saved to ${savedPath}`));
355
414
  }
356
415
  }
@@ -379,7 +438,7 @@ Examples:
379
438
  `)
380
439
  .argument('<prompt>', 'Text description of the music to generate')
381
440
  .option('--duration <seconds>', 'Clip length in seconds (default 30; max depends on the model)', (v) => parseInt(v, 10))
382
- .option('--model <model>', 'Music model id (default: platform default)')
441
+ .option('--model <model>', 'Music model id (default: platform default; list ids: gipity service call music/models --get)')
383
442
  .option('--vocals', 'Allow vocals (default: instrumental only)')
384
443
  .option('-o, --output <file>', 'Output path (default ./music.mp3). For audio your app ships, write it into the source tree so it deploys, e.g. -o src/assets/audio/theme.mp3; the cwd default is fine for one-off generation.')
385
444
  .option('--json', 'Output as JSON')
@@ -394,17 +453,19 @@ Examples:
394
453
  model: opts.model,
395
454
  instrumental: !opts.vocals,
396
455
  });
456
+ const started = Date.now();
397
457
  const result = opts.json
398
458
  ? await doGenerate()
399
459
  : await withSpinner('Generating music...', doGenerate, { done: null });
460
+ const elapsed = (Date.now() - started) / 1000;
400
461
  const filename = opts.output || 'music.mp3';
401
462
  const savedPath = await downloadFile(result.url, filename, !!opts.output);
402
463
  if (opts.json) {
403
- console.log(JSON.stringify({ ...result, saved: savedPath }));
464
+ console.log(jsonResult(result, elapsed, savedPath));
404
465
  }
405
466
  else {
406
- const sizeKb = Math.round(result.size_bytes / 1024);
407
- console.log(`${muted(`Generated with ${result.model} (${sizeKb}KB)`)}`);
467
+ console.log(muted(`Generated with ${result.model}`));
468
+ printMetrics(generationMetrics(result, elapsed));
408
469
  console.log(success(`Saved to ${savedPath}`));
409
470
  }
410
471
  }
@@ -446,17 +507,19 @@ Examples:
446
507
  duration_seconds: opts.duration,
447
508
  prompt_influence: opts.influence,
448
509
  });
510
+ const started = Date.now();
449
511
  const result = opts.json
450
512
  ? await doGenerate()
451
513
  : await withSpinner('Generating sound effect...', doGenerate, { done: null });
514
+ const elapsed = (Date.now() - started) / 1000;
452
515
  const filename = opts.output || 'sound.mp3';
453
516
  const savedPath = await downloadFile(result.url, filename, !!opts.output);
454
517
  if (opts.json) {
455
- console.log(JSON.stringify({ ...result, saved: savedPath }));
518
+ console.log(jsonResult(result, elapsed, savedPath));
456
519
  }
457
520
  else {
458
- const sizeKb = Math.round(result.size_bytes / 1024);
459
- console.log(`${muted(`Generated sound effect (${sizeKb}KB)`)}`);
521
+ console.log(muted('Generated sound effect'));
522
+ printMetrics(generationMetrics(result, elapsed));
460
523
  console.log(success(`Saved to ${savedPath}`));
461
524
  }
462
525
  }
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { Command, Option } from 'commander';
2
2
  import { get, post, del } from '../api.js';
3
3
  import { resolveProjectContext } from '../config.js';
4
4
  import { bold, muted, success, warning } from '../colors.js';
@@ -35,7 +35,7 @@ async function projectGuid(opts) {
35
35
  keyCommand
36
36
  .command('create <name>')
37
37
  .description('Mint a project API key (shown once). Give it a name you will recognize later')
38
- .option('--role <role>', 'viewer | editor | owner (default: viewer)', 'viewer')
38
+ .addOption(new Option('--role <role>', 'Access role for the key').choices(['viewer', 'editor', 'owner']).default('viewer'))
39
39
  .option('--expires-days <n>', 'Days until the key expires (default: never)')
40
40
  .option(...projectOpt)
41
41
  .option('--json', 'Output as JSON')
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { Command, Option } from 'commander';
2
2
  import { get } from '../api.js';
3
3
  import { requireConfig } from '../config.js';
4
4
  import { success, error as clrError, warning, muted, bold } from '../colors.js';
@@ -66,7 +66,7 @@ logsCommand
66
66
  .command('app')
67
67
  .description('Unified recent activity for this app — JS errors, failed function calls, failed services, network failures. Designed for agents debugging a deployed app.')
68
68
  .option('--since <window>', "Window: 5m / 10m / 30m / 1h / 6h / 24h / 7d", '10m')
69
- .option('--severity <level>', 'error | warn | network | all', 'all')
69
+ .addOption(new Option('--severity <level>', 'Severity filter').choices(['error', 'warn', 'network', 'all']).default('all'))
70
70
  .option('--type <list>', "Comma-separated: errors,functions,services,traffic. Default excludes traffic (high volume).")
71
71
  .option('--filter <pattern>', 'Substring match against message / fn name / path (case-insensitive)')
72
72
  .option('--limit <n>', 'Max entries', '100')
@@ -1,6 +1,6 @@
1
1
  import { existsSync } from 'fs';
2
2
  import { dirname, resolve } from 'path';
3
- import { Command } from 'commander';
3
+ import { Command, Option } from 'commander';
4
4
  import { get, post, del } from '../api.js';
5
5
  import { requireConfig, getConfigPath } from '../config.js';
6
6
  import { error as clrError, success, muted, bold } from '../colors.js';
@@ -21,8 +21,8 @@ const roomCommand = new Command('room')
21
21
  .description('Manage realtime rooms')
22
22
  .argument('[action]', 'list | create | delete | info', 'list')
23
23
  .argument('[name]', 'room name (for create | delete | info)')
24
- .option('--type <type>', 'room type for create: state | relay', 'state')
25
- .option('--auth <level>', 'auth level for create: public | user', 'public')
24
+ .addOption(new Option('--type <type>', 'Room type for create').choices(['state', 'relay']).default('state'))
25
+ .addOption(new Option('--auth <level>', 'Auth level for create').choices(['public', 'user']).default('public'))
26
26
  .option('--max-clients <n>', 'max clients for create (1-200)')
27
27
  .option('--json', 'Output as JSON')
28
28
  .action((action, name, opts) => run('Realtime room', async () => {
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { Command, Option } from 'commander';
2
2
  import { get, post, put, patch, del, publicRequest, mintAppToken } from '../api.js';
3
3
  import { getAuth } from '../auth.js';
4
4
  import { requireConfig } from '../config.js';
@@ -50,7 +50,7 @@ recordsCommand
50
50
  recordsCommand
51
51
  .command('config <table>')
52
52
  .description('Show or set a table\'s Records API config (auth level, search, etc.)')
53
- .option('--auth <level>', 'Auth level: public (anonymous writes), member (sign-in), or user')
53
+ .addOption(new Option('--auth <level>', 'Auth level: public (anonymous writes), member (sign-in), or user').choices(['public', 'member', 'user']))
54
54
  .option('--searchable <bool>', 'Enable full-text search (true/false)')
55
55
  .option('--primary-key <col>', 'Primary key column (default: id)')
56
56
  .option('--soft-delete <col>', 'Soft-delete column (pass "none" to clear)')
@@ -81,8 +81,8 @@ recordsCommand
81
81
  .command('query <table>')
82
82
  .description('List records (full-text search, filter, sort, recycle bin)')
83
83
  .option('-q, --q <text>', 'Full-text search across the table\'s text columns (needs `--searchable true` on the table)')
84
- .option('--filter <filter>', 'AND filter string (e.g., "status:eq:active")')
85
- .option('--any <filter>', 'OR filter group, same grammar as --filter (e.g., "owner:eq:me,shared:eq:true")')
84
+ .option('--filter <filter>', 'AND filter string, "col:op:value" comma-joined. Ops: eq, neq, gt, gte, lt, lte, like, ilike, in (pipe-separated values), is_null, not_null. Full grammar: gipity skill read app-records')
85
+ .option('--any <filter>', 'OR filter group, same grammar and ops as --filter (e.g., "owner:eq:me,shared:eq:true")')
86
86
  .option('--sort <sort>', 'Sort string (e.g., "created_at:desc")')
87
87
  .option('--limit <n>', 'Max rows', '20')
88
88
  .option('--offset <n>', 'Offset', '0')
@@ -254,6 +254,36 @@ relayCommand
254
254
  ? `${success('Diagnostics sharing on.')} ${muted('Reported on the next daily heartbeat.')}`
255
255
  : `${success('Diagnostics sharing off.')} ${muted('No host/version data will be sent.')}`);
256
256
  });
257
+ // ─── gipity relay updates [on|off] ─────────────────────────────────────
258
+ relayCommand
259
+ .command('updates [state]')
260
+ .description('View or set daily auto-update of installed coding agents (on|off)')
261
+ .action((arg) => {
262
+ if (arg === undefined) {
263
+ const stored = state.getAgentUpdatesPref();
264
+ const effective = state.agentUpdatesEnabled();
265
+ const label = stored === undefined ? 'on (default, not yet chosen)' : stored ? 'on' : 'off';
266
+ console.log(`Agent auto-updates: ${effective ? success(label) : muted(label)}`);
267
+ if (!effective && stored !== false) {
268
+ console.log(muted(' (overridden off by DISABLE_AUTOUPDATER / GIPITY_RELAY_AGENT_UPDATES / CI)'));
269
+ }
270
+ console.log(muted(' Once a day, while idle, the relay brings its coding agents (Claude Code, Codex) to the latest release.'));
271
+ console.log(muted(' Upgrades appear in `gipity relay log` and in the device diagnostics on the web.'));
272
+ console.log(muted(' Set with `gipity relay updates on` / `gipity relay updates off`.'));
273
+ return;
274
+ }
275
+ const on = /^(on|true|yes|1|enable)$/i.test(arg);
276
+ const off = /^(off|false|no|0|disable)$/i.test(arg);
277
+ if (!on && !off) {
278
+ console.log(clrError("Expected 'on' or 'off'."));
279
+ process.exitCode = 1;
280
+ return;
281
+ }
282
+ state.setAgentUpdatesPref(on);
283
+ console.log(on
284
+ ? `${success('Agent auto-updates on.')} ${muted("Runs on the relay daemon's next daily maintenance tick.")}`
285
+ : `${success('Agent auto-updates off.')} ${muted('Installed agents only change when you update them yourself.')}`);
286
+ });
257
287
  // ─── gipity relay rename <name> ────────────────────────────────────────
258
288
  relayCommand
259
289
  .command('rename <new-name>')
@@ -13,9 +13,10 @@ const SERVICES = [
13
13
  { name: 'image', method: 'POST', desc: 'Generate an image ({ prompt, provider?, size? })' },
14
14
  { name: 'image/models', method: 'GET', desc: 'List image providers/models' },
15
15
  { name: 'tts', method: 'POST', desc: 'Text-to-speech ({ text, voice?, ... })' },
16
- { name: 'tts/voices', method: 'GET', desc: 'List TTS voices' },
16
+ { name: 'tts/voices', method: 'GET', desc: 'List TTS voices (append ?provider=elevenlabs|openai|gemini)' },
17
17
  { name: 'sound', method: 'POST', desc: 'Sound effect ({ text, duration_seconds? })' },
18
18
  { name: 'music', method: 'POST', desc: 'Music generation ({ prompt, duration_seconds? })' },
19
+ { name: 'music/models', method: 'GET', desc: 'List music models (ids for --model / model)' },
19
20
  { name: 'video', method: 'POST', desc: 'Video generation ({ prompt, ... })' },
20
21
  { name: 'location/ip', method: 'POST', desc: 'IP geolocation ({ ip? })' },
21
22
  { name: 'location/geocode', method: 'POST', desc: 'Reverse geocode ({ lat, lon })' },
@@ -75,9 +76,12 @@ serviceCommand
75
76
  .action((name, bodyArg, opts) => run('Call', async () => {
76
77
  const config = requireConfig();
77
78
  // Encode each path segment but preserve the `/` separators so subpaths
78
- // like `location/geocode` and `llm/models` resolve correctly.
79
- const path = name.split('/').map(encodeURIComponent).join('/');
80
- const url = `/api/${config.projectGuid}/services/${path}`;
79
+ // like `location/geocode` and `llm/models` resolve correctly. A query
80
+ // string rides along untouched, so listing endpoints that filter by
81
+ // parameter work: `gipity service call "tts/voices?provider=elevenlabs" --get`.
82
+ const [pathPart, query] = name.split('?', 2);
83
+ const path = pathPart.split('/').map(encodeURIComponent).join('/');
84
+ const url = `/api/${config.projectGuid}/services/${path}${query ? `?${query}` : ''}`;
81
85
  const body = resolveBody(bodyArg || opts.data, opts.file);
82
86
  // Name the calling identity (stderr, so stdout stays parseable). An owner
83
87
  // call always succeeds regardless of billing mode, so without this line a