gipity 1.1.38 → 1.1.40

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.
@@ -13,7 +13,7 @@ export const emailCommand = new Command('email')
13
13
  emailCommand
14
14
  .command('test')
15
15
  .description("Send a test email through your app's email() path (owner-billed)")
16
- .argument('<to>', 'Recipient address')
16
+ .argument('<to>', "Recipient address, or 'owner' for the app owner's own account email")
17
17
  .option('--subject <text>', 'Subject', 'Test email from Gipity')
18
18
  .option('--text <text>', 'Body text', 'This is a test email sent through your app\'s email() service. ✉️')
19
19
  .option('--reply-to <email>', 'Reply-To address')
@@ -5,7 +5,9 @@ import { bold, muted, success, warning } from '../colors.js';
5
5
  import { run, printList } from '../helpers/index.js';
6
6
  /**
7
7
  * Project API keys - the revocable secret a script, cron, or agent sends as
8
- * `X-Api-Key` to write to YOUR app without a browser login.
8
+ * `X-Api-Key` (or `Authorization: Bearer`) to write to YOUR app without a
9
+ * browser login. Optional scopes limit a key to named functions, tables,
10
+ * files access and source IPs.
9
11
  *
10
12
  * These are per-project and app-facing; `gipity token` mints account-level
11
13
  * agent tokens (gip_at_*) that drive the CLI itself. Without this command the
@@ -20,6 +22,19 @@ Give a script, cron, or agent write access to your app without a login:
20
22
  gipity key create "laptop importer" --role editor
21
23
  # the script sends: X-Api-Key: <the key printed once above>
22
24
 
25
+ The key also works as Authorization: Bearer <key>, and only on this app
26
+ (and environment: add --env dev for a dev key).
27
+
28
+ Scope a key that lives on a device or anywhere you don't fully control, so a
29
+ leaked key can only do its one job:
30
+
31
+ gipity key create "front door" --role editor \\
32
+ --functions send-command,heartbeat --tables commands:write,logs:read \\
33
+ --files read --ip 203.0.113.7/32
34
+
35
+ Any of --functions / --tables / --files limits the key to exactly what is
36
+ listed (nothing else on the app API); --ip alone only pins the source address.
37
+
23
38
  Inside a function the caller shows up as ctx.auth.via === 'api_key' with
24
39
  ctx.auth.apiKeyName set to the key's name - stamp that on rows to tell
25
40
  script-written entries from hand-entered ones. Never build your own key table.
@@ -27,6 +42,55 @@ script-written entries from hand-entered ones. Never build your own key table.
27
42
  Account-level tokens that run the CLI headlessly are a different thing: see
28
43
  gipity token --help.`);
29
44
  const fmtDate = (d) => (d ? new Date(d).toLocaleDateString() : 'never');
45
+ const splitList = (v) => v.split(',').map(x => x.trim()).filter(Boolean);
46
+ /** Build the scopes body from the create flags; null when none were given.
47
+ * The server validates names, access levels and addresses. */
48
+ export function scopesFromFlags(opts) {
49
+ const scopes = {};
50
+ if (opts.functions !== undefined) {
51
+ const fns = splitList(opts.functions);
52
+ if (!fns.length)
53
+ throw new Error('--functions needs at least one function name');
54
+ scopes.functions = fns;
55
+ }
56
+ if (opts.tables !== undefined) {
57
+ const entries = splitList(opts.tables);
58
+ if (!entries.length)
59
+ throw new Error('--tables needs at least one table:read or table:write');
60
+ scopes.tables = {};
61
+ for (const entry of entries) {
62
+ const [table, access, ...rest] = entry.split(':');
63
+ if (!table || (access !== 'read' && access !== 'write') || rest.length) {
64
+ throw new Error(`--tables entry "${entry}" must be table:read or table:write`);
65
+ }
66
+ scopes.tables[table] = access;
67
+ }
68
+ }
69
+ if (opts.files !== undefined)
70
+ scopes.files = opts.files;
71
+ if (opts.ip !== undefined) {
72
+ const ips = splitList(opts.ip);
73
+ if (!ips.length)
74
+ throw new Error('--ip needs at least one address or CIDR range');
75
+ scopes.ip = ips;
76
+ }
77
+ return Object.keys(scopes).length ? scopes : null;
78
+ }
79
+ /** One-line scope summary for listings. */
80
+ export function describeScopes(scopes) {
81
+ if (!scopes)
82
+ return 'all access';
83
+ const parts = [];
84
+ if (scopes.functions)
85
+ parts.push(`fn: ${scopes.functions.join(',')}`);
86
+ if (scopes.tables)
87
+ parts.push(`tables: ${Object.entries(scopes.tables).map(([t, a]) => `${t}:${a}`).join(',')}`);
88
+ if (scopes.files)
89
+ parts.push(`files: ${scopes.files}`);
90
+ if (scopes.ip)
91
+ parts.push(`ip: ${scopes.ip.join(',')}`);
92
+ return parts.join(' ');
93
+ }
30
94
  const projectOpt = ['--project <guid-or-slug>', 'Target a specific project instead of cwd / Home'];
31
95
  async function projectGuid(opts) {
32
96
  const { config } = await resolveProjectContext({ projectOverride: opts.project });
@@ -37,10 +101,17 @@ keyCommand
37
101
  .description('Mint a project API key (shown once). Give it a name you will recognize later')
38
102
  .addOption(new Option('--role <role>', 'Access role for the key').choices(['viewer', 'editor', 'owner']).default('viewer'))
39
103
  .option('--expires-days <n>', 'Days until the key expires (default: never)')
104
+ .option('--functions <names>', 'Scope: only these functions (comma-separated)')
105
+ .option('--tables <list>', 'Scope: only these Records tables, e.g. commands:write,logs:read')
106
+ .addOption(new Option('--files <access>', 'Scope: app files access').choices(['read', 'write']))
107
+ .option('--ip <list>', 'Scope: only from these IPs / CIDR ranges (comma-separated)')
40
108
  .option(...projectOpt)
41
109
  .option('--json', 'Output as JSON')
42
110
  .action((name, opts) => run('Create', async () => {
43
111
  const body = { name, role: opts.role };
112
+ const scopes = scopesFromFlags(opts);
113
+ if (scopes)
114
+ body.scopes = scopes;
44
115
  if (opts.expiresDays !== undefined) {
45
116
  const days = parseInt(opts.expiresDays, 10);
46
117
  if (!Number.isFinite(days) || days <= 0)
@@ -55,11 +126,13 @@ keyCommand
55
126
  }
56
127
  const expNote = k.expires_at ? ` (expires ${fmtDate(k.expires_at)})` : ' (never expires)';
57
128
  console.log(success(`Created API key ${bold(k.short_guid)} "${k.name}" as ${k.role}${muted(expNote)}.`));
129
+ if (k.scopes)
130
+ console.log(muted(`Scopes: ${describeScopes(k.scopes)}`));
58
131
  console.log('');
59
132
  console.log(k.key);
60
133
  console.log('');
61
134
  console.log(muted('Send it from your script on every request:'));
62
- console.log(muted(` curl -H "X-Api-Key: ${k.key}" ...`));
135
+ console.log(muted(` curl -H "X-Api-Key: ${k.key}" ... (or Authorization: Bearer <key>)`));
63
136
  console.log(muted(`Revoke it any time: gipity key revoke ${k.short_guid}`));
64
137
  console.log('');
65
138
  console.log(warning('Copy it now - it will not be shown again.'));
@@ -72,7 +145,7 @@ keyCommand
72
145
  .option('--json', 'Output as JSON')
73
146
  .action((opts) => run('List', async () => {
74
147
  const res = await get(`/projects/${await projectGuid(opts)}/api-keys`);
75
- printList(res.data, opts, 'No API keys. Mint one with: gipity key create "my script" --role editor', (k) => `${bold(k.short_guid)} ${k.name} ${muted(`${k.role} ${k.prefix}... last used ${fmtDate(k.last_used_at)} expires ${fmtDate(k.expires_at)}`)}`);
148
+ printList(res.data, opts, 'No API keys. Mint one with: gipity key create "my script" --role editor', (k) => `${bold(k.short_guid)} ${k.name} ${muted(`${k.role} ${describeScopes(k.scopes)} ${k.prefix}... last used ${fmtDate(k.last_used_at)} expires ${fmtDate(k.expires_at)}`)}`);
76
149
  }));
77
150
  keyCommand
78
151
  .command('revoke <short_guid>')
@@ -326,28 +326,51 @@ export function slowRenderMessage(fps, o) {
326
326
  + `2D/Phaser template: ${bold("(await import('./js/config.js')).advance(seconds)")}).`;
327
327
  }
328
328
  /** A slow eval should say which leg was slow, instead of leaving the caller to
329
- * guess a longer --wait. Silent under SLOW_EVAL_MS. Exported for tests. */
330
- const SLOW_EVAL_MS = 20_000;
329
+ * guess a longer --wait. Silent under SLOW_EVAL_MS. Uses the server's phase
330
+ * breakdown when it has one. Exported for tests. */
331
+ const SLOW_EVAL_MS = 10_000;
332
+ // Above this, say before waiting that the call may run long.
333
+ const LONG_EVAL_WARN_MS = 100_000;
331
334
  export function evalTimingLine(t) {
332
335
  const total = t.hostMs + t.submitMs + t.pollMs;
333
336
  if (total < SLOW_EVAL_MS)
334
337
  return null;
335
338
  const s = (ms) => `${(ms / 1000).toFixed(1)}s`;
336
- const parts = [
337
- t.hostMs >= 500 ? `hosting files ${s(t.hostMs)}` : null,
338
- t.submitMs >= 500 ? `camera/feed setup ${s(t.submitMs)}` : null,
339
- t.browserMs !== undefined ? `browser ${s(t.browserMs)} (launch, page load, waits, script)` : `browser ${s(t.pollMs)}`,
340
- t.browserMs !== undefined && t.pollMs - t.browserMs >= 2000 ? `queue + cleanup ${s(t.pollMs - t.browserMs)}` : null,
341
- ].filter(Boolean);
342
- return `timing: ${s(total)} = ${parts.join(' + ')}`;
339
+ const some = (label, ms, min = 500) => (ms !== undefined && ms >= min ? `${label} ${s(ms)}` : null);
340
+ const head = [
341
+ some('hosting files', t.hostMs),
342
+ some('camera/feed setup', t.submitMs),
343
+ ];
344
+ const tm = t.timing;
345
+ const browser = tm
346
+ ? [
347
+ some('sandbox queue', tm.queueMs),
348
+ some('browser start', tm.browserStartMs, 0),
349
+ some('page load', tm.pageLoadMs, 0),
350
+ some('wait/wait-for', tm.settleMs),
351
+ ...tm.scriptMs.map((ms, i) => `${i === 0 ? 'script' : `step ${i}`} ${s(ms)}`),
352
+ some('reload', tm.reloadMs),
353
+ some('cleanup', tm.cleanupMs),
354
+ // Result pickup: the client polls the finished job.
355
+ some('result pickup', t.pollMs - tm.totalMs, 1000),
356
+ ]
357
+ : [
358
+ t.browserMs !== undefined ? `browser ${s(t.browserMs)}` : `browser ${s(t.pollMs)}`,
359
+ t.browserMs !== undefined && t.pollMs - t.browserMs >= 2000 ? `queue + cleanup ${s(t.pollMs - t.browserMs)}` : null,
360
+ ];
361
+ return `timing: ${s(total)} = ${[...head, ...browser].filter(Boolean).join(' + ')}`;
343
362
  }
344
363
  /** Poll the async eval job until it finishes. Eval runs server-side as a
345
364
  * short-lived job (so a long --wait can't trip the gateway idle timeout);
346
365
  * we submit, then poll the result out of the job store. `expectedWorkMs` is
347
366
  * the time the server-side work is expected to take (see evalWorkBudgetMs);
348
367
  * the client budget is that plus 60s of headroom for browser open/cold start. */
349
- export async function pollEvalResult(evalJobId, expectedWorkMs) {
350
- const deadline = Date.now() + expectedWorkMs + 60_000;
368
+ export async function pollEvalResult(evalJobId, expectedWorkMs, serverMaxMs) {
369
+ // The server states the job's real upper bound (every leg ends on its own
370
+ // wall-clock deadline); wait that plus a little for the result to land.
371
+ // Without it, fall back to our own estimate plus flat headroom.
372
+ const budgetMs = serverMaxMs !== undefined ? serverMaxMs + 10_000 : expectedWorkMs + 60_000;
373
+ const deadline = Date.now() + budgetMs;
351
374
  let missCount = 0;
352
375
  while (Date.now() < deadline) {
353
376
  let rec;
@@ -367,14 +390,16 @@ export async function pollEvalResult(evalJobId, expectedWorkMs) {
367
390
  return rec;
368
391
  if (rec.status === 'error')
369
392
  throw new ApiError(rec.httpStatus, rec.code, rec.reason);
370
- await sleep(1000);
393
+ // A finished job sits in Redis until picked up; a short interval keeps that
394
+ // pickup from adding up to a second to every call.
395
+ await sleep(250);
371
396
  }
372
397
  // This is the CLIENT giving up, not the page failing — and the budget above
373
398
  // already covers everything the caller asked for, so "your expression is too
374
399
  // big" is the one thing it is NOT. Never advise lowering --wait: on a camera /
375
400
  // vision run the wait is what lets the model load, so that "fix" swaps a
376
401
  // timeout for a silently empty read, which is worse.
377
- throw new ApiError(504, 'EVAL_TIMEOUT', `the browser did not report back within ${Math.round((expectedWorkMs + 60_000) / 1000)}s: that budget already ` +
402
+ throw new ApiError(504, 'EVAL_TIMEOUT', `the browser did not report back within ${Math.round(budgetMs / 1000)}s: that budget already ` +
378
403
  `covers --wait, --wait-for, the eval body and any --camera setup, so this is the browser itself being slow or ` +
379
404
  `stuck (a cold sandbox, a heavy page), not your expression being too big. Lowering --wait does NOT help and on ` +
380
405
  `a --camera run actively hurts (the wait is what lets the vision model load: cut it and the eval reads an ` +
@@ -653,6 +678,13 @@ export const pageEvalCommand = new Command('eval')
653
678
  cameraUrl: camera?.url,
654
679
  });
655
680
  const pollStart = Date.now();
681
+ // Say up front when this call can outlast a typical 120s agent tool cap,
682
+ // so a long run is a choice, not a surprise background task.
683
+ const maxMs = kickoff.data.maxMs;
684
+ if (maxMs !== undefined && maxMs > LONG_EVAL_WARN_MS) {
685
+ console.error(muted(`This eval can take up to ${Math.round(maxMs / 1000)}s (page load + --wait/--wait-for + --timeout per script, ` +
686
+ `each a hard limit). Lower --timeout or --wait-timeout to keep it shorter.`));
687
+ }
656
688
  let d;
657
689
  try {
658
690
  d = await pollEvalResult(kickoff.data.evalJobId, evalWorkBudgetMs({
@@ -662,7 +694,7 @@ export const pageEvalCommand = new Command('eval')
662
694
  hasCamera: !!camera,
663
695
  scriptBudgetMs: sentScriptBudgetMs,
664
696
  legs: 1 + sentSteps.length,
665
- }));
697
+ }), maxMs);
666
698
  }
667
699
  catch (err) {
668
700
  // The server's overrun message names the budget but not the flag that
@@ -679,7 +711,7 @@ export const pageEvalCommand = new Command('eval')
679
711
  }
680
712
  const timing = evalTimingLine({
681
713
  hostMs: submitStart - hostStart, submitMs: pollStart - submitStart,
682
- pollMs: Date.now() - pollStart, browserMs: d.browserMs,
714
+ pollMs: Date.now() - pollStart, browserMs: d.browserMs, timing: d.timing,
683
715
  });
684
716
  if (timing)
685
717
  console.error(muted(timing));
@@ -900,6 +932,9 @@ Which one:
900
932
  calls; every call re-loads the page and re-pays it. Start that work on page load and
901
933
  absorb it in the pre-eval window: --wait <ms> (max ${MAX_WAIT_MS}) or, better,
902
934
  --wait-for '<ready-selector>' --wait-timeout ${WAIT_FOR_MAX_MS}.
935
+ Every one of these is a hard limit: a call takes at most page load (~20s) + the wait
936
+ + --timeout per script, plus a few seconds of browser start/close. Calls over 10s print
937
+ a 'timing:' line naming where the time went (--json: the 'timing' field).
903
938
 
904
939
  Several things to check on one page? Pass --step (max ${MAX_EVAL_STEPS}) instead of running
905
940
  'page eval' N times: the steps run in order against the ONE loaded page, so a slow
@@ -223,11 +223,18 @@ export function looksLikeImagePath(p) {
223
223
  * picture of the wrong moment. Exported for tests. */
224
224
  export function buildWaitForGate(selector, timeoutMs) {
225
225
  const sel = JSON.stringify(selector);
226
- return (`await (async () => { const __t0 = Date.now(); ` +
227
- `while (Date.now() - __t0 < ${timeoutMs}) { ` +
228
- `try { if (document.querySelector(${sel})) return; } catch (e) { throw new Error('wait-for: invalid selector ' + ${sel}); } ` +
229
- `await new Promise((r) => setTimeout(r, 100)); } ` +
230
- `throw new Error('wait-for: nothing matched ' + ${sel} + ' within ${timeoutMs}ms: the page never reached that state (raise --wait-timeout, fix the selector, or check the app actually gets there headlessly)'); })();`);
226
+ // Checked on every DOM mutation (a microtask, so the gate opens the moment the
227
+ // app sets its ready attribute) with a slow timer as backstop: a timer-only
228
+ // poll lagged by seconds on a vision page busy inferring every frame.
229
+ return (`await (async () => { const __q = ${sel}; ` +
230
+ `try { document.querySelector(__q); } catch (e) { throw new Error('wait-for: invalid selector ' + __q); } ` +
231
+ `if (document.querySelector(__q)) return; ` +
232
+ `const __ok = await new Promise((res) => { let o; const end = (v) => { clearTimeout(t); clearInterval(iv); if (o) o.disconnect(); res(v); }; ` +
233
+ `try { o = new MutationObserver(() => { if (document.querySelector(__q)) end(true); }); ` +
234
+ `o.observe(document.documentElement, { subtree: true, childList: true, attributes: true, characterData: true }); } catch (e) {} ` +
235
+ `const iv = setInterval(() => { if (document.querySelector(__q)) end(true); }, 100); ` +
236
+ `const t = setTimeout(() => end(!!document.querySelector(__q)), ${timeoutMs}); }); ` +
237
+ `if (!__ok) throw new Error('wait-for: nothing matched ' + __q + ' within ${timeoutMs}ms: the page never reached that state (raise --wait-timeout, fix the selector, or check the app actually gets there headlessly)'); })();`);
231
238
  }
232
239
  /** Max ms the selector gate may wait. The gate runs inside the capture's sandbox
233
240
  * exec budget (page load + delay + script + settle + render), and 15s is what
@@ -189,8 +189,8 @@ async function observeClient(url, expr, i, label, settleMs, holdMs, waitForSelec
189
189
  // anything still applied at the end of the hold so the harness finishes.
190
190
  lifecycle: lifecycle?.length ? { steps: lifecycle, untilMs: holdMs } : undefined,
191
191
  });
192
- // Server work ≈ nav + settle + the in-page hold; pollEvalResult adds 60s headroom.
193
- const d = await pollEvalResult(kickoff.data.evalJobId, settleMs + holdMs + (barrier ? JOIN_ALLOWANCE_MS : 0));
192
+ // The server states the job's upper bound; the estimate is the fallback.
193
+ const d = await pollEvalResult(kickoff.data.evalJobId, settleMs + holdMs + (barrier ? JOIN_ALLOWANCE_MS : 0), kickoff.data.maxMs);
194
194
  const raw = d.result?.trim() ?? '';
195
195
  if (raw.startsWith('EvalError:') || raw.startsWith('ObserveError:')) {
196
196
  return { ...base, error: raw };
@@ -47,12 +47,13 @@ const SETUP_STEPS = {
47
47
  'gipity project auth provider google --client-id <id> --client-secret <secret>',
48
48
  ],
49
49
  apple: r => [
50
- 'Apple Developer > Certificates, Identifiers & Profiles > Identifiers > add a Services ID.',
51
- ' Its identifier is your client ID.',
52
- `Enable Sign in with Apple on it, register your domain and the return URL: ${r}`,
53
- 'Keys > add a key with Sign in with Apple enabled. Note its Key ID and download the .p8 file (only once).',
54
- 'Your Team ID is on the Membership details page.',
55
- 'gipity project auth provider apple --client-id <services-id> --team-id <team> --key-id <key> --private-key-file AuthKey_XXXX.p8',
50
+ 'Apple Developer > Certificates, Identifiers & Profiles > Keys > add a key with Sign in with Apple enabled.',
51
+ ' Note its Key ID and download the .p8 file (only once). Your Team ID is on the Membership details page.',
52
+ 'Web sign-in (the hosted sign-in page): Identifiers > add a Services ID. Its identifier is your client ID.',
53
+ ` Enable Sign in with Apple on it, register your domain and the return URL: ${r}`,
54
+ 'iOS app (native, POST /api/<guid>/auth/apple): enable Sign in with Apple on your App ID; its bundle ID is what you pass as --bundle-id.',
55
+ 'gipity project auth provider apple --team-id <team> --key-id <key> --private-key-file AuthKey_XXXX.p8 [--client-id <services-id>] [--bundle-id <bundle-id> ...] [--require-nonce]',
56
+ ' Pass every flag each time: this replaces the app\'s whole Apple setup.',
56
57
  ],
57
58
  discord: r => [
58
59
  'Discord Developer Portal > Applications > your application > OAuth2.',
@@ -68,6 +69,9 @@ function formatProvider(p) {
68
69
  ];
69
70
  if (p.note)
70
71
  lines.push(muted(p.note));
72
+ if (p.provider === 'apple' && p.bundle_ids) {
73
+ lines.push(`iOS bundle ids: ${p.bundle_ids.length ? p.bundle_ids.join(', ') : 'none'}${p.require_nonce ? ' (nonce required)' : ''}`);
74
+ }
71
75
  lines.push('', `Redirect URI: ${p.redirect_uri}`, '', 'Use your own credentials:');
72
76
  let n = 0;
73
77
  for (const step of SETUP_STEPS[p.provider](p.redirect_uri)) {
@@ -92,13 +96,15 @@ Modes:
92
96
  gipity Sign in with Gipity only (default)
93
97
  app Users sign in to this app alone, without a Gipity account:
94
98
  Google, Apple, Discord and email codes for web apps (the hosted sign-in
95
- page / Gipity.auth.signIn), Steam (POST /api/<guid>/auth/steam) and guest
96
- devices (POST /api/<guid>/auth/guest) for games
99
+ page / Gipity.auth.signIn); native apps sign in over HTTPS with Steam
100
+ (POST /api/<guid>/auth/steam), guest devices (/auth/guest), Sign in with
101
+ Apple from iOS (/auth/apple) or email codes, and renew with /auth/refresh
97
102
  both Either
98
103
 
99
104
  Sign-in providers:
100
105
  gipity project auth provider <google|apple|discord> show setup steps and the redirect URI
101
- Google and Discord work at once on Gipity's shared credentials; Apple needs your own.
106
+ Google and Discord work at once on Gipity's shared credentials; Apple needs your own
107
+ (a web Services ID, iOS bundle ids with --bundle-id, or both).
102
108
  Manage the app's users: gipity project users
103
109
 
104
110
  --unique-names on|off
@@ -156,7 +162,9 @@ See: gipity skill read steam-game`)
156
162
  auth
157
163
  .command('provider <name>')
158
164
  .description('Show setup for a sign-in provider (google, apple, discord), set your own credentials, or go back to shared')
159
- .option('--client-id <id>', 'OAuth client ID (Apple: the Services ID)')
165
+ .option('--client-id <id>', 'OAuth client ID (Apple: the web Services ID)')
166
+ .option('--bundle-id <id>', 'Apple: an iOS bundle ID allowed to sign in natively (repeat for several)', (v, prev = []) => [...prev, v])
167
+ .option('--require-nonce', 'Apple: native sign-in must send a nonce')
160
168
  .option('--client-secret <secret>', 'OAuth client secret (Google, Discord)')
161
169
  .option('--team-id <id>', 'Apple Team ID')
162
170
  .option('--key-id <id>', 'Apple Sign in with Apple key ID')
@@ -170,7 +178,7 @@ See: gipity skill read steam-game`)
170
178
  const config = requireConfig();
171
179
  const base = `/projects/${config.projectGuid}/auth/providers/${provider}`;
172
180
  const label = PROVIDER_LABEL[provider];
173
- const credFlags = ['clientId', 'clientSecret', 'teamId', 'keyId', 'privateKeyFile'].filter(k => opts[k] !== undefined);
181
+ const credFlags = ['clientId', 'clientSecret', 'teamId', 'keyId', 'privateKeyFile', 'bundleId', 'requireNonce'].filter(k => opts[k] !== undefined);
174
182
  if (opts.shared) {
175
183
  if (credFlags.length)
176
184
  fail('--shared cannot be combined with credential flags.');
@@ -191,10 +199,12 @@ See: gipity skill read steam-game`)
191
199
  }
192
200
  let body;
193
201
  if (provider === 'apple') {
194
- const missing = [['clientId', '--client-id'], ['teamId', '--team-id'], ['keyId', '--key-id'], ['privateKeyFile', '--private-key-file']]
202
+ const missing = [['teamId', '--team-id'], ['keyId', '--key-id'], ['privateKeyFile', '--private-key-file']]
195
203
  .filter(([k]) => !opts[k]).map(([, f]) => f);
196
204
  if (missing.length)
197
205
  fail(`Apple needs ${missing.join(', ')}. See: gipity project auth provider apple`);
206
+ if (!opts.clientId && !opts.bundleId)
207
+ fail('Apple needs --client-id (web Services ID), --bundle-id (iOS app), or both. See: gipity project auth provider apple');
198
208
  if (opts.clientSecret)
199
209
  fail('Apple takes --team-id, --key-id and --private-key-file, not --client-secret.');
200
210
  let privateKey;
@@ -206,22 +216,30 @@ See: gipity skill read steam-game`)
206
216
  }
207
217
  if (!privateKey.includes('PRIVATE KEY'))
208
218
  fail(`${opts.privateKeyFile} does not look like a .p8 private key.`);
209
- body = { client_id: opts.clientId, team_id: opts.teamId, key_id: opts.keyId, private_key: privateKey };
219
+ body = {
220
+ ...(opts.clientId ? { client_id: opts.clientId } : {}),
221
+ ...(opts.bundleId ? { bundle_ids: opts.bundleId } : {}),
222
+ ...(opts.requireNonce ? { require_nonce: true } : {}),
223
+ team_id: opts.teamId, key_id: opts.keyId, private_key: privateKey,
224
+ };
210
225
  }
211
226
  else {
212
227
  const missing = [['clientId', '--client-id'], ['clientSecret', '--client-secret']]
213
228
  .filter(([k]) => !opts[k]).map(([, f]) => f);
214
229
  if (missing.length)
215
230
  fail(`${label} needs ${missing.join(' and ')}. See: gipity project auth provider ${provider}`);
216
- const extra = ['teamId', 'keyId', 'privateKeyFile'].filter(k => opts[k] !== undefined);
231
+ const extra = ['teamId', 'keyId', 'privateKeyFile', 'bundleId', 'requireNonce'].filter(k => opts[k] !== undefined);
217
232
  if (extra.length)
218
- fail(`--team-id, --key-id and --private-key-file are for Apple only.`);
233
+ fail(`--team-id, --key-id, --private-key-file, --bundle-id and --require-nonce are for Apple only.`);
219
234
  body = { client_id: opts.clientId, client_secret: opts.clientSecret };
220
235
  }
221
236
  const res = await put(base, body);
222
237
  const lines = [success(`${label} sign-in now uses your own credentials.`)];
223
238
  if (provider === 'google')
224
239
  lines.push(muted('Existing Google users keep their accounts.'));
240
+ if (provider === 'apple' && opts.bundleId) {
241
+ lines.push(muted(`iOS apps (${opts.bundleId.join(', ')}) can sign in with POST /api/<guid>/auth/apple. See: gipity skill read app-users`));
242
+ }
225
243
  printResult(lines.join('\n'), opts, res.data);
226
244
  }));
227
245
  }
@@ -49,7 +49,7 @@ email code, Steam or a guest device. They belong to the app, not to Gipity.
49
49
  gipity project users --search ann find users by name or email
50
50
  gipity project users export -o users.csv every user, as CSV (or --format json)
51
51
  gipity project users delete <guid> erase a user (runs the app's user_deleted hooks)
52
- gipity project users signout <guid> end all of a user's web sessions`);
52
+ gipity project users signout <guid> sign a user out everywhere (web and native apps)`);
53
53
  users
54
54
  .command('list', { isDefault: true })
55
55
  .description("List the app's users")
@@ -119,7 +119,7 @@ email code, Steam or a guest device. They belong to the app, not to Gipity.
119
119
  }));
120
120
  users
121
121
  .command('signout <userGuid>')
122
- .description("Sign a user out everywhere (revoke all of the user's web sessions)")
122
+ .description("Sign a user out everywhere: end their web sessions, revoke their native apps' refresh tokens, and void their access tokens")
123
123
  .option('--json', 'Output as JSON')
124
124
  .action((userGuid, opts) => run('Sign out', async () => {
125
125
  const res = await post(`/projects/${requireConfig().projectGuid}/app-users/${encodeURIComponent(userGuid)}/signout`);
@@ -1,5 +1,6 @@
1
1
  import { Command, Option } from 'commander';
2
- import { get, post, put, patch, del, publicRequest, mintAppToken } from '../api.js';
2
+ import { pipeline } from 'stream/promises';
3
+ import { get, post, put, patch, del, publicRequest, mintAppToken, downloadStream } from '../api.js';
3
4
  import { getAuth } from '../auth.js';
4
5
  import { requireConfig } from '../config.js';
5
6
  import { bold, muted } from '../colors.js';
@@ -44,7 +45,7 @@ recordsCommand
44
45
  .action((opts) => run('Tables', async () => {
45
46
  const config = requireConfig();
46
47
  const res = await get(`/api/${config.projectGuid}/records-config`);
47
- printList(res.data, opts, 'No tables configured for Records API. Configure one with `gipity records config <table> --auth <level>`.', t => `${bold(t.table_name)} ${muted(t.auth_level)} ${muted(`pk=${t.primary_key_column}`)} ${muted(`db=${t.database_name}`)}`);
48
+ printList(res.data, opts, 'No tables configured for Records API. Configure one with `gipity records config <table> --auth <level>`.', t => `${bold(t.table_name)} ${muted(t.auth_level)} ${muted(`pk=${t.primary_key_column}`)} ${muted(`db=${t.database_name}`)}${t.append_only ? ` ${muted('append-only')}` : ''}`);
48
49
  }));
49
50
  recordsCommand
50
51
  .command('config <table>')
@@ -56,13 +57,14 @@ recordsCommand
56
57
  .option('--auto-number <prefix>', 'Number new records automatically, e.g. INC -> INC0001001 (pass "none" to turn off). Same as auto_number in gipity.yaml')
57
58
  .option('--auto-number-pad <n>', 'Zero-pad width of the auto-number (default 7)')
58
59
  .option('--auto-number-column <col>', 'Column the auto-number is written to (default: number)')
60
+ .option('--append-only', "Make the table inserts-only for good: updates, deletes and purges are refused for everyone, including raw SQL. Can't be undone. Same as append_only: true in gipity.yaml")
59
61
  .option('--json', 'Output as JSON')
60
62
  .action((table, opts) => run('Config', async () => {
61
63
  const config = requireConfig();
62
64
  const base = `/api/${config.projectGuid}/records/${table}/config`;
63
65
  // No setter flags → just show the current config.
64
66
  const setting = opts.auth || opts.searchable !== undefined || opts.primaryKey || opts.softDelete
65
- || opts.autoNumber || opts.autoNumberPad || opts.autoNumberColumn;
67
+ || opts.autoNumber || opts.autoNumberPad || opts.autoNumberColumn || opts.appendOnly;
66
68
  if (!setting) {
67
69
  const res = await get(base);
68
70
  printResult(JSON.stringify(res.data, null, 2), opts, res.data);
@@ -87,12 +89,14 @@ recordsCommand
87
89
  }
88
90
  if (opts.autoNumberColumn)
89
91
  body.auto_number_column = opts.autoNumberColumn;
92
+ if (opts.appendOnly)
93
+ body.append_only = true;
90
94
  const res = await patch(base, body);
91
95
  const d = res.data;
92
96
  const autoNumber = d.auto_number_prefix
93
97
  ? `${d.auto_number_prefix} (pad ${d.auto_number_pad}, column ${d.auto_number_column})`
94
98
  : 'off';
95
- printResult(`Configured "${table}": auth=${d.auth_level}, searchable=${d.searchable}, pk=${d.primary_key_column}, auto-number=${autoNumber}`, opts, d);
99
+ printResult(`Configured "${table}": auth=${d.auth_level}, searchable=${d.searchable}, pk=${d.primary_key_column}, auto-number=${autoNumber}${d.append_only ? ', append-only' : ''}`, opts, d);
96
100
  }));
97
101
  recordsCommand
98
102
  .command('list <table>')
@@ -154,9 +158,20 @@ recordsCommand
154
158
  .command('history <table> [id]')
155
159
  .description('Audit history (who/what changed it, with English summaries). Omit <id> for the whole table\'s feed.')
156
160
  .option('--limit <n>', 'Max events', '20')
161
+ .option('--jsonl', 'Export the WHOLE table history to stdout as JSON Lines, oldest first (owner/editor; ignores --limit)')
157
162
  .option(ANON_FLAG, ANON_HELP)
158
163
  .option('--json', 'Output as JSON')
159
164
  .action((table, id, opts) => run('History', async () => {
165
+ if (opts.jsonl) {
166
+ if (id)
167
+ throw new Error('--jsonl exports a whole table: drop the <id>');
168
+ if (opts.anon)
169
+ throw new Error('--jsonl needs the owner or an editor: drop --anon');
170
+ const config = requireConfig();
171
+ const body = await downloadStream(`/api/${config.projectGuid}/records/${encodeURIComponent(table)}/history?format=jsonl`);
172
+ await pipeline(body, process.stdout, { end: false });
173
+ return;
174
+ }
160
175
  const api = await recordsHttp(opts);
161
176
  // Table-wide feed when no id is given - the same endpoint an activity/history
162
177
  // view reads, so verifying it needs no hand-built HTTP call.
@@ -13,7 +13,7 @@ async function scopeQuery(opts) {
13
13
  }
14
14
  export const secretsCommand = new Command('secrets')
15
15
  .description('Manage app secrets')
16
- .addHelpText('after', '\nEncrypted API keys and tokens for your app, read in functions via secrets.get("NAME").');
16
+ .addHelpText('after', '\nEncrypted API keys and tokens for your app, read in functions via secrets.get("NAME").\nValues are write-only: no command prints a stored value back.');
17
17
  secretsCommand
18
18
  .command('list')
19
19
  .alias('ls')
@@ -38,6 +38,27 @@ secretsCommand
38
38
  console.log(` ${s.name} ${masked} ${muted(`updated ${new Date(s.updated_at).toLocaleDateString()}`)}`);
39
39
  }
40
40
  }));
41
+ // Secret values are write-only by design: they are decrypted only inside a
42
+ // running function (secrets.get), never returned to the CLI. `get` exists so an
43
+ // agent that reaches for it gets a clear refusal (stderr, exit 1) instead of an
44
+ // unknown-command line it might mistake for the value (platform#500).
45
+ secretsCommand
46
+ .command('get <name>')
47
+ .description('Secret values are write-only: confirms the secret exists, never prints its value')
48
+ .option('--account', 'Look in account-wide secrets')
49
+ .option('--project <guid-or-slug>', 'Target a specific project instead of cwd / Home')
50
+ .option('--json', 'Output raw JSON')
51
+ .action((name, opts) => run('Secrets', async () => {
52
+ const res = await get(`/secrets?${await scopeQuery(opts)}`);
53
+ const scope = opts.account ? 'account-wide' : 'project';
54
+ const found = res.data.find(s => s.name === name);
55
+ if (!found)
56
+ throw new Error(`No ${scope} secret named '${name}'. Values are write-only, so set it with: gipity secrets set ${name} VALUE${opts.account ? ' --account' : ''}`);
57
+ const ends = found.preview ? ` (ends in ...${found.preview})` : '';
58
+ throw new Error(`secret values are write-only and are never shown. '${name}' exists${ends}; only a deployed function can read it, with secrets.get('${name}'). `
59
+ + `To hand a value to another service too, generate it yourself, keep it, then store it: `
60
+ + `TOK=$(openssl rand -hex 24); gipity secrets set ${name} "$TOK"; echo "$TOK". Setting it again replaces the live value.`);
61
+ }));
41
62
  secretsCommand
42
63
  .command('set <name> <value>')
43
64
  .description('Create or update a secret (UPPER_SNAKE_CASE name). Encrypted at rest; never echoed back')
package/dist/index.js CHANGED
@@ -5606,13 +5606,13 @@ var require_streamx = __commonJS({
5606
5606
  }
5607
5607
  function pipelinePromise(...streams) {
5608
5608
  return new Promise((resolve21, reject) => {
5609
- return pipeline(...streams, (err) => {
5609
+ return pipeline2(...streams, (err) => {
5610
5610
  if (err) return reject(err);
5611
5611
  resolve21();
5612
5612
  });
5613
5613
  });
5614
5614
  }
5615
- function pipeline(stream, ...streams) {
5615
+ function pipeline2(stream, ...streams) {
5616
5616
  const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams];
5617
5617
  const done = all.length && typeof all[all.length - 1] === "function" ? all.pop() : null;
5618
5618
  if (all.length < 2) throw new Error("Pipeline requires at least 2 streams");
@@ -5706,7 +5706,7 @@ var require_streamx = __commonJS({
5706
5706
  return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev;
5707
5707
  }
5708
5708
  module.exports = {
5709
- pipeline,
5709
+ pipeline: pipeline2,
5710
5710
  pipelinePromise,
5711
5711
  isStream,
5712
5712
  isStreamx,
@@ -6999,7 +6999,7 @@ You are the developer. Write files in this directory - Gipity's editor hooks (in
6999
6999
 
7000
7000
  ## Use first-party services before reaching outside
7001
7001
 
7002
- Gipity ships first-party services for what apps usually pull from third parties - auth, location/geocoding, LLM, image/audio/video generation, transcription, file uploads, realtime, web push notifications (Gipity Notify - no VAPID keys, no Firebase/OneSignal; works on iOS home-screen web apps), semantic search (\`embed()\` + pgvector in the app's own DB - no Pinecone/Weaviate/vector DB), and email (from a deployed app's function with the injected \`email()\` service - \`services: ['email']\`, no SMTP/SendGrid/Nodemailer; check it with \`gipity email test <to>\`). Before calling an external API or adding an npm package for one of these, check \`gipity skill list\` for a match. First-party services need no API keys, cost less, and keep data in-house. Reach outside only when the catalog has no equivalent - and say so when you do.
7002
+ Gipity ships first-party services for what apps usually pull from third parties - auth, location/geocoding, LLM, image/audio/video generation, transcription, file uploads, realtime, web push notifications (Gipity Notify - no VAPID keys, no Firebase/OneSignal; works on iOS home-screen web apps), semantic search (\`embed()\` + pgvector in the app's own DB - no Pinecone/Weaviate/vector DB), and email (from a deployed app's function with the injected \`email()\` service - \`services: ['email']\`, no SMTP/SendGrid/Nodemailer; "email me when..." is \`email({ to: 'owner', ... })\`, which reaches the app owner with no address or secret; check it with \`gipity email test <to>\`). Before calling an external API or adding an npm package for one of these, check \`gipity skill list\` for a match. First-party services need no API keys, cost less, and keep data in-house. Reach outside only when the catalog has no equivalent - and say so when you do.
7003
7003
 
7004
7004
  ## Don't guess Gipity facts - look them up
7005
7005
 
@@ -7053,7 +7053,7 @@ mkdir -p ~/GipityProjects/<slug> && cd ~/GipityProjects/<slug> && gipity init <s
7053
7053
 
7054
7054
  ## CLI quick reference
7055
7055
 
7056
- Key commands: \`gipity add <template|kit>\`, \`gipity brand set --emoji <e>|--color <hex>\` (regenerate the app's icons + social share card), \`gipity deploy [prod|<env>]\`, \`gipity env\` (list/create/delete environments), \`gipity sandbox run\`, \`gipity page inspect <url>\`, \`gipity page screenshot <url>\`, \`gipity db query "SQL"\`, \`gipity fn call <name>\`, \`gipity logs fn <name>\`, \`gipity secrets set <NAME> <value> [--account]\` (store an API key/token encrypted; read in functions via \`secrets.get('NAME')\` - never hardcode keys), \`gipity skill read <name>\`.
7056
+ Key commands: \`gipity add <template|kit>\`, \`gipity brand set --emoji <e>|--color <hex>\` (regenerate the app's icons + social share card), \`gipity deploy [prod|<env>]\`, \`gipity env\` (list/create/delete environments), \`gipity sandbox run\`, \`gipity page inspect <url>\`, \`gipity page screenshot <url>\`, \`gipity db query "SQL"\`, \`gipity fn call <name>\`, \`gipity logs fn <name>\`, \`gipity secrets set <NAME> <value> [--account]\` (store an API key/token encrypted; read in functions via \`secrets.get('NAME')\`; write-only, so keep a copy of any value another service also needs - never hardcode keys), \`gipity skill read <name>\`.
7057
7057
  Rename for findability: \`gipity project rename <name>\` renames the current project's display name (the slug and deployed URLs never change); it's the label users scan in Monitor and \`gipity project\`, so keep it SHORT: 2-4 words, at most 40 characters, no trailing punctuation (e.g. "Stripe checkout", "Tetris game").
7058
7058
  Pull an existing remote project local (given its URL/slug): \`mkdir -p ~/GipityProjects/<slug> && cd ~/GipityProjects/<slug> && gipity init <slug>\` (adopts the matching project and syncs files down - this is the "clone").
7059
7059
  Move whole apps in/out: \`gipity save\` (export this project as a portable \`.gip\` bundle), \`gipity load <file.gip | github:owner/repo>\` (import as a NEW project; \`--inspect\` to preview), \`gipity github connect\` (1-2 click GitHub access for imports). Porting a Vercel/Replit/Lovable app? Load the \`app-import\` skill first.
@@ -7117,6 +7117,7 @@ Watch for **bulky output dirs dropped loose at the root** (e.g. \`out/\`, \`vsd_
7117
7117
  Run \`gipity skill list\` to see every skill. Run \`gipity skill read <name>\` to read one. Load the relevant skill before starting a task - they have the correct API patterns, code examples, and common mistakes.
7118
7118
 
7119
7119
  App services skills (load before calling \`/services/*\` endpoints):
7120
+ - \`app-api-keys\` - project API keys for scripts/devices: gipity key create, scopes (functions, tables, files, ip)
7120
7121
  - \`app-audio\` - sound effects, music, transcription
7121
7122
  - \`app-auth\` - sign in: Gipity accounts or app-owned users (Google, email code), popup vs redirect
7122
7123
  - \`app-files\` - uploads, then displaying files and the storage helper (ownership check, delete)
@@ -7152,7 +7153,7 @@ Kit skills (reusable building blocks - \`gipity add <kit>\`):
7152
7153
  - \`leaderboard\` - game leaderboards: high scores or times, daily/weekly/monthly/season boards, tiebreaks, replays, cheat checks, bans
7153
7154
 
7154
7155
  Other key skills:
7155
- - \`email\` - sending email from a deployed app with the email() service or a workflow notify step (no setup/keys), gipity email test/log, HTML formatting, images
7156
+ - \`email\` - sending email from a deployed app with the email() service or a workflow notify step (no setup/keys; to: 'owner' emails you, the app owner), gipity email test/log, HTML formatting, images
7156
7157
  - \`sandbox-tools\` - cloud sandbox capabilities and pre-installed tools`;
7157
7158
  DEFINITION_OF_DONE = `## Definition of done (build tasks)
7158
7159
  1. \`gipity deploy\` succeeds and you have a live URL.
@@ -36481,6 +36482,19 @@ Give a script, cron, or agent write access to your app without a login:
36481
36482
  gipity key create "laptop importer" --role editor
36482
36483
  # the script sends: X-Api-Key: <the key printed once above>
36483
36484
 
36485
+ The key also works as Authorization: Bearer <key>, and only on this app
36486
+ (and environment: add --env dev for a dev key).
36487
+
36488
+ Scope a key that lives on a device or anywhere you don't fully control, so a
36489
+ leaked key can only do its one job:
36490
+
36491
+ gipity key create "front door" --role editor \\
36492
+ --functions send-command,heartbeat --tables commands:write,logs:read \\
36493
+ --files read --ip 203.0.113.7/32
36494
+
36495
+ Any of --functions / --tables / --files limits the key to exactly what is
36496
+ listed (nothing else on the app API); --ip alone only pins the source address.
36497
+
36484
36498
  Inside a function the caller shows up as ctx.auth.via === 'api_key' with
36485
36499
  ctx.auth.apiKeyName set to the key's name - stamp that on rows to tell
36486
36500
  script-written entries from hand-entered ones. Never build your own key table.
@@ -36488,13 +36502,52 @@ script-written entries from hand-entered ones. Never build your own key table.
36488
36502
  Account-level tokens that run the CLI headlessly are a different thing: see
36489
36503
  gipity token --help.`);
36490
36504
  var fmtDate2 = (d) => d ? new Date(d).toLocaleDateString() : "never";
36505
+ var splitList = (v7) => v7.split(",").map((x) => x.trim()).filter(Boolean);
36506
+ function scopesFromFlags(opts) {
36507
+ const scopes = {};
36508
+ if (opts.functions !== void 0) {
36509
+ const fns = splitList(opts.functions);
36510
+ if (!fns.length) throw new Error("--functions needs at least one function name");
36511
+ scopes.functions = fns;
36512
+ }
36513
+ if (opts.tables !== void 0) {
36514
+ const entries = splitList(opts.tables);
36515
+ if (!entries.length) throw new Error("--tables needs at least one table:read or table:write");
36516
+ scopes.tables = {};
36517
+ for (const entry of entries) {
36518
+ const [table, access, ...rest] = entry.split(":");
36519
+ if (!table || access !== "read" && access !== "write" || rest.length) {
36520
+ throw new Error(`--tables entry "${entry}" must be table:read or table:write`);
36521
+ }
36522
+ scopes.tables[table] = access;
36523
+ }
36524
+ }
36525
+ if (opts.files !== void 0) scopes.files = opts.files;
36526
+ if (opts.ip !== void 0) {
36527
+ const ips = splitList(opts.ip);
36528
+ if (!ips.length) throw new Error("--ip needs at least one address or CIDR range");
36529
+ scopes.ip = ips;
36530
+ }
36531
+ return Object.keys(scopes).length ? scopes : null;
36532
+ }
36533
+ function describeScopes(scopes) {
36534
+ if (!scopes) return "all access";
36535
+ const parts = [];
36536
+ if (scopes.functions) parts.push(`fn: ${scopes.functions.join(",")}`);
36537
+ if (scopes.tables) parts.push(`tables: ${Object.entries(scopes.tables).map(([t, a]) => `${t}:${a}`).join(",")}`);
36538
+ if (scopes.files) parts.push(`files: ${scopes.files}`);
36539
+ if (scopes.ip) parts.push(`ip: ${scopes.ip.join(",")}`);
36540
+ return parts.join(" ");
36541
+ }
36491
36542
  var projectOpt = ["--project <guid-or-slug>", "Target a specific project instead of cwd / Home"];
36492
36543
  async function projectGuid(opts) {
36493
36544
  const { config } = await resolveProjectContext({ projectOverride: opts.project });
36494
36545
  return config.projectGuid;
36495
36546
  }
36496
- keyCommand.command("create <name>").description("Mint a project API key (shown once). Give it a name you will recognize later").addOption(new Option("--role <role>", "Access role for the key").choices(["viewer", "editor", "owner"]).default("viewer")).option("--expires-days <n>", "Days until the key expires (default: never)").option(...projectOpt).option("--json", "Output as JSON").action((name, opts) => run("Create", async () => {
36547
+ keyCommand.command("create <name>").description("Mint a project API key (shown once). Give it a name you will recognize later").addOption(new Option("--role <role>", "Access role for the key").choices(["viewer", "editor", "owner"]).default("viewer")).option("--expires-days <n>", "Days until the key expires (default: never)").option("--functions <names>", "Scope: only these functions (comma-separated)").option("--tables <list>", "Scope: only these Records tables, e.g. commands:write,logs:read").addOption(new Option("--files <access>", "Scope: app files access").choices(["read", "write"])).option("--ip <list>", "Scope: only from these IPs / CIDR ranges (comma-separated)").option(...projectOpt).option("--json", "Output as JSON").action((name, opts) => run("Create", async () => {
36497
36548
  const body = { name, role: opts.role };
36549
+ const scopes = scopesFromFlags(opts);
36550
+ if (scopes) body.scopes = scopes;
36498
36551
  if (opts.expiresDays !== void 0) {
36499
36552
  const days = parseInt(opts.expiresDays, 10);
36500
36553
  if (!Number.isFinite(days) || days <= 0) throw new Error("--expires-days must be a positive number of days");
@@ -36511,11 +36564,12 @@ keyCommand.command("create <name>").description("Mint a project API key (shown o
36511
36564
  }
36512
36565
  const expNote = k7.expires_at ? ` (expires ${fmtDate2(k7.expires_at)})` : " (never expires)";
36513
36566
  console.log(success(`Created API key ${bold(k7.short_guid)} "${k7.name}" as ${k7.role}${muted(expNote)}.`));
36567
+ if (k7.scopes) console.log(muted(`Scopes: ${describeScopes(k7.scopes)}`));
36514
36568
  console.log("");
36515
36569
  console.log(k7.key);
36516
36570
  console.log("");
36517
36571
  console.log(muted("Send it from your script on every request:"));
36518
- console.log(muted(` curl -H "X-Api-Key: ${k7.key}" ...`));
36572
+ console.log(muted(` curl -H "X-Api-Key: ${k7.key}" ... (or Authorization: Bearer <key>)`));
36519
36573
  console.log(muted(`Revoke it any time: gipity key revoke ${k7.short_guid}`));
36520
36574
  console.log("");
36521
36575
  console.log(warning("Copy it now - it will not be shown again."));
@@ -36526,7 +36580,7 @@ keyCommand.command("list").alias("ls").description("List this project's API keys
36526
36580
  res.data,
36527
36581
  opts,
36528
36582
  'No API keys. Mint one with: gipity key create "my script" --role editor',
36529
- (k7) => `${bold(k7.short_guid)} ${k7.name} ${muted(`${k7.role} ${k7.prefix}... last used ${fmtDate2(k7.last_used_at)} expires ${fmtDate2(k7.expires_at)}`)}`
36583
+ (k7) => `${bold(k7.short_guid)} ${k7.name} ${muted(`${k7.role} ${describeScopes(k7.scopes)} ${k7.prefix}... last used ${fmtDate2(k7.last_used_at)} expires ${fmtDate2(k7.expires_at)}`)}`
36530
36584
  );
36531
36585
  }));
36532
36586
  keyCommand.command("revoke <short_guid>").alias("rm").description("Revoke a project API key (instant, irreversible)").option(...projectOpt).option("--json", "Output as JSON").action((shortGuid, opts) => run("Revoke", async () => {
@@ -38216,21 +38270,37 @@ function slowRenderMessage(fps, o) {
38216
38270
  }
38217
38271
  return `${warning("\u26A0 Slow render:")} page painted at ${fps} fps. Waiting on real time (setTimeout) advances animation/physics time far slower than it looks: assertions after a wall-clock wait can report a false negative. Step the app's own loop deterministically instead (3D templates: ${bold("core.advance(seconds)")}; 2D/Phaser template: ${bold("(await import('./js/config.js')).advance(seconds)")}).`;
38218
38272
  }
38219
- var SLOW_EVAL_MS = 2e4;
38273
+ var SLOW_EVAL_MS = 1e4;
38274
+ var LONG_EVAL_WARN_MS = 1e5;
38220
38275
  function evalTimingLine(t) {
38221
38276
  const total = t.hostMs + t.submitMs + t.pollMs;
38222
38277
  if (total < SLOW_EVAL_MS) return null;
38223
38278
  const s = (ms2) => `${(ms2 / 1e3).toFixed(1)}s`;
38224
- const parts = [
38225
- t.hostMs >= 500 ? `hosting files ${s(t.hostMs)}` : null,
38226
- t.submitMs >= 500 ? `camera/feed setup ${s(t.submitMs)}` : null,
38227
- t.browserMs !== void 0 ? `browser ${s(t.browserMs)} (launch, page load, waits, script)` : `browser ${s(t.pollMs)}`,
38279
+ const some = (label2, ms2, min = 500) => ms2 !== void 0 && ms2 >= min ? `${label2} ${s(ms2)}` : null;
38280
+ const head = [
38281
+ some("hosting files", t.hostMs),
38282
+ some("camera/feed setup", t.submitMs)
38283
+ ];
38284
+ const tm2 = t.timing;
38285
+ const browser = tm2 ? [
38286
+ some("sandbox queue", tm2.queueMs),
38287
+ some("browser start", tm2.browserStartMs, 0),
38288
+ some("page load", tm2.pageLoadMs, 0),
38289
+ some("wait/wait-for", tm2.settleMs),
38290
+ ...tm2.scriptMs.map((ms2, i) => `${i === 0 ? "script" : `step ${i}`} ${s(ms2)}`),
38291
+ some("reload", tm2.reloadMs),
38292
+ some("cleanup", tm2.cleanupMs),
38293
+ // Result pickup: the client polls the finished job.
38294
+ some("result pickup", t.pollMs - tm2.totalMs, 1e3)
38295
+ ] : [
38296
+ t.browserMs !== void 0 ? `browser ${s(t.browserMs)}` : `browser ${s(t.pollMs)}`,
38228
38297
  t.browserMs !== void 0 && t.pollMs - t.browserMs >= 2e3 ? `queue + cleanup ${s(t.pollMs - t.browserMs)}` : null
38229
- ].filter(Boolean);
38230
- return `timing: ${s(total)} = ${parts.join(" + ")}`;
38298
+ ];
38299
+ return `timing: ${s(total)} = ${[...head, ...browser].filter(Boolean).join(" + ")}`;
38231
38300
  }
38232
- async function pollEvalResult(evalJobId, expectedWorkMs) {
38233
- const deadline = Date.now() + expectedWorkMs + 6e4;
38301
+ async function pollEvalResult(evalJobId, expectedWorkMs, serverMaxMs) {
38302
+ const budgetMs = serverMaxMs !== void 0 ? serverMaxMs + 1e4 : expectedWorkMs + 6e4;
38303
+ const deadline = Date.now() + budgetMs;
38234
38304
  let missCount = 0;
38235
38305
  while (Date.now() < deadline) {
38236
38306
  let rec;
@@ -38245,12 +38315,12 @@ async function pollEvalResult(evalJobId, expectedWorkMs) {
38245
38315
  }
38246
38316
  if (rec.status === "done") return rec;
38247
38317
  if (rec.status === "error") throw new ApiError(rec.httpStatus, rec.code, rec.reason);
38248
- await sleep(1e3);
38318
+ await sleep(250);
38249
38319
  }
38250
38320
  throw new ApiError(
38251
38321
  504,
38252
38322
  "EVAL_TIMEOUT",
38253
- `the browser did not report back within ${Math.round((expectedWorkMs + 6e4) / 1e3)}s: that budget already covers --wait, --wait-for, the eval body and any --camera setup, so this is the browser itself being slow or stuck (a cold sandbox, a heavy page), not your expression being too big. Lowering --wait does NOT help and on a --camera run actively hurts (the wait is what lets the vision model load: cut it and the eval reads an empty page instead). Just run the same command again: the sandbox is warm on the second hit.`
38323
+ `the browser did not report back within ${Math.round(budgetMs / 1e3)}s: that budget already covers --wait, --wait-for, the eval body and any --camera setup, so this is the browser itself being slow or stuck (a cold sandbox, a heavy page), not your expression being too big. Lowering --wait does NOT help and on a --camera run actively hurts (the wait is what lets the vision model load: cut it and the eval reads an empty page instead). Just run the same command again: the sandbox is warm on the second hit.`
38254
38324
  );
38255
38325
  }
38256
38326
  function evalExecTimeoutMessage(result, budgetMs) {
@@ -38426,6 +38496,12 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
38426
38496
  cameraUrl: camera?.url
38427
38497
  });
38428
38498
  const pollStart = Date.now();
38499
+ const maxMs = kickoff.data.maxMs;
38500
+ if (maxMs !== void 0 && maxMs > LONG_EVAL_WARN_MS) {
38501
+ console.error(muted(
38502
+ `This eval can take up to ${Math.round(maxMs / 1e3)}s (page load + --wait/--wait-for + --timeout per script, each a hard limit). Lower --timeout or --wait-timeout to keep it shorter.`
38503
+ ));
38504
+ }
38429
38505
  let d;
38430
38506
  try {
38431
38507
  d = await pollEvalResult(kickoff.data.evalJobId, evalWorkBudgetMs({
@@ -38435,7 +38511,7 @@ var pageEvalCommand = new Command("eval").description("Evaluate JS in a real bro
38435
38511
  hasCamera: !!camera,
38436
38512
  scriptBudgetMs: sentScriptBudgetMs,
38437
38513
  legs: 1 + sentSteps.length
38438
- }));
38514
+ }), maxMs);
38439
38515
  } catch (err) {
38440
38516
  const msg = err?.message ?? "";
38441
38517
  const hint = budgetOverrunHint(msg, scriptBudgetMs) ?? (reloadExpr === void 0 ? navigationAbortHint(msg) : null);
@@ -38447,7 +38523,8 @@ ${hint}`);
38447
38523
  hostMs: submitStart - hostStart,
38448
38524
  submitMs: pollStart - submitStart,
38449
38525
  pollMs: Date.now() - pollStart,
38450
- browserMs: d.browserMs
38526
+ browserMs: d.browserMs,
38527
+ timing: d.timing
38451
38528
  });
38452
38529
  if (timing) console.error(muted(timing));
38453
38530
  const { result, noValue } = normalizeEvalResult(d.result);
@@ -38612,6 +38689,9 @@ Which one:
38612
38689
  calls; every call re-loads the page and re-pays it. Start that work on page load and
38613
38690
  absorb it in the pre-eval window: --wait <ms> (max ${MAX_WAIT_MS}) or, better,
38614
38691
  --wait-for '<ready-selector>' --wait-timeout ${WAIT_FOR_MAX_MS}.
38692
+ Every one of these is a hard limit: a call takes at most page load (~20s) + the wait
38693
+ + --timeout per script, plus a few seconds of browser start/close. Calls over 10s print
38694
+ a 'timing:' line naming where the time went (--json: the 'timing' field).
38615
38695
 
38616
38696
  Several things to check on one page? Pass --step (max ${MAX_EVAL_STEPS}) instead of running
38617
38697
  'page eval' N times: the steps run in order against the ONE loaded page, so a slow
@@ -38764,7 +38844,7 @@ function looksLikeImagePath(p) {
38764
38844
  }
38765
38845
  function buildWaitForGate(selector, timeoutMs) {
38766
38846
  const sel = JSON.stringify(selector);
38767
- return `await (async () => { const __t0 = Date.now(); while (Date.now() - __t0 < ${timeoutMs}) { try { if (document.querySelector(${sel})) return; } catch (e) { throw new Error('wait-for: invalid selector ' + ${sel}); } await new Promise((r) => setTimeout(r, 100)); } throw new Error('wait-for: nothing matched ' + ${sel} + ' within ${timeoutMs}ms: the page never reached that state (raise --wait-timeout, fix the selector, or check the app actually gets there headlessly)'); })();`;
38847
+ return `await (async () => { const __q = ${sel}; try { document.querySelector(__q); } catch (e) { throw new Error('wait-for: invalid selector ' + __q); } if (document.querySelector(__q)) return; const __ok = await new Promise((res) => { let o; const end = (v) => { clearTimeout(t); clearInterval(iv); if (o) o.disconnect(); res(v); }; try { o = new MutationObserver(() => { if (document.querySelector(__q)) end(true); }); o.observe(document.documentElement, { subtree: true, childList: true, attributes: true, characterData: true }); } catch (e) {} const iv = setInterval(() => { if (document.querySelector(__q)) end(true); }, 100); const t = setTimeout(() => end(!!document.querySelector(__q)), ${timeoutMs}); }); if (!__ok) throw new Error('wait-for: nothing matched ' + __q + ' within ${timeoutMs}ms: the page never reached that state (raise --wait-timeout, fix the selector, or check the app actually gets there headlessly)'); })();`;
38768
38848
  }
38769
38849
  var WAIT_FOR_MAX_MS2 = 15e3;
38770
38850
  var WAIT_FOR_DEFAULT_MS = 15e3;
@@ -40180,12 +40260,13 @@ var SETUP_STEPS = {
40180
40260
  "gipity project auth provider google --client-id <id> --client-secret <secret>"
40181
40261
  ],
40182
40262
  apple: (r) => [
40183
- "Apple Developer > Certificates, Identifiers & Profiles > Identifiers > add a Services ID.",
40184
- " Its identifier is your client ID.",
40185
- `Enable Sign in with Apple on it, register your domain and the return URL: ${r}`,
40186
- "Keys > add a key with Sign in with Apple enabled. Note its Key ID and download the .p8 file (only once).",
40187
- "Your Team ID is on the Membership details page.",
40188
- "gipity project auth provider apple --client-id <services-id> --team-id <team> --key-id <key> --private-key-file AuthKey_XXXX.p8"
40263
+ "Apple Developer > Certificates, Identifiers & Profiles > Keys > add a key with Sign in with Apple enabled.",
40264
+ " Note its Key ID and download the .p8 file (only once). Your Team ID is on the Membership details page.",
40265
+ "Web sign-in (the hosted sign-in page): Identifiers > add a Services ID. Its identifier is your client ID.",
40266
+ ` Enable Sign in with Apple on it, register your domain and the return URL: ${r}`,
40267
+ "iOS app (native, POST /api/<guid>/auth/apple): enable Sign in with Apple on your App ID; its bundle ID is what you pass as --bundle-id.",
40268
+ "gipity project auth provider apple --team-id <team> --key-id <key> --private-key-file AuthKey_XXXX.p8 [--client-id <services-id>] [--bundle-id <bundle-id> ...] [--require-nonce]",
40269
+ " Pass every flag each time: this replaces the app's whole Apple setup."
40189
40270
  ],
40190
40271
  discord: (r) => [
40191
40272
  "Discord Developer Portal > Applications > your application > OAuth2.",
@@ -40200,6 +40281,9 @@ function formatProvider(p) {
40200
40281
  `${bold(name)}: ${credentialsLabel(p)}${p.available ? "" : muted(" (off)")}`
40201
40282
  ];
40202
40283
  if (p.note) lines.push(muted(p.note));
40284
+ if (p.provider === "apple" && p.bundle_ids) {
40285
+ lines.push(`iOS bundle ids: ${p.bundle_ids.length ? p.bundle_ids.join(", ") : "none"}${p.require_nonce ? " (nonce required)" : ""}`);
40286
+ }
40203
40287
  lines.push("", `Redirect URI: ${p.redirect_uri}`, "", "Use your own credentials:");
40204
40288
  let n = 0;
40205
40289
  for (const step of SETUP_STEPS[p.provider](p.redirect_uri)) {
@@ -40219,13 +40303,15 @@ Modes:
40219
40303
  gipity Sign in with Gipity only (default)
40220
40304
  app Users sign in to this app alone, without a Gipity account:
40221
40305
  Google, Apple, Discord and email codes for web apps (the hosted sign-in
40222
- page / Gipity.auth.signIn), Steam (POST /api/<guid>/auth/steam) and guest
40223
- devices (POST /api/<guid>/auth/guest) for games
40306
+ page / Gipity.auth.signIn); native apps sign in over HTTPS with Steam
40307
+ (POST /api/<guid>/auth/steam), guest devices (/auth/guest), Sign in with
40308
+ Apple from iOS (/auth/apple) or email codes, and renew with /auth/refresh
40224
40309
  both Either
40225
40310
 
40226
40311
  Sign-in providers:
40227
40312
  gipity project auth provider <google|apple|discord> show setup steps and the redirect URI
40228
- Google and Discord work at once on Gipity's shared credentials; Apple needs your own.
40313
+ Google and Discord work at once on Gipity's shared credentials; Apple needs your own
40314
+ (a web Services ID, iOS bundle ids with --bundle-id, or both).
40229
40315
  Manage the app's users: gipity project users
40230
40316
 
40231
40317
  --unique-names on|off
@@ -40276,13 +40362,13 @@ See: gipity skill read steam-game`).option("--unique-names <on|off>", "Require u
40276
40362
  }
40277
40363
  printResult(lines.join("\n"), opts, { ...body, ...res.data.players_sharing_names !== void 0 ? { players_sharing_names: res.data.players_sharing_names } : {} });
40278
40364
  }));
40279
- auth.command("provider <name>").description("Show setup for a sign-in provider (google, apple, discord), set your own credentials, or go back to shared").option("--client-id <id>", "OAuth client ID (Apple: the Services ID)").option("--client-secret <secret>", "OAuth client secret (Google, Discord)").option("--team-id <id>", "Apple Team ID").option("--key-id <id>", "Apple Sign in with Apple key ID").option("--private-key-file <path>", "Apple .p8 private key file").option("--shared", "Remove your own credentials and use Gipity's shared ones").option("--json", "Output as JSON").action((name, opts) => run("Provider", async () => {
40365
+ auth.command("provider <name>").description("Show setup for a sign-in provider (google, apple, discord), set your own credentials, or go back to shared").option("--client-id <id>", "OAuth client ID (Apple: the web Services ID)").option("--bundle-id <id>", "Apple: an iOS bundle ID allowed to sign in natively (repeat for several)", (v7, prev = []) => [...prev, v7]).option("--require-nonce", "Apple: native sign-in must send a nonce").option("--client-secret <secret>", "OAuth client secret (Google, Discord)").option("--team-id <id>", "Apple Team ID").option("--key-id <id>", "Apple Sign in with Apple key ID").option("--private-key-file <path>", "Apple .p8 private key file").option("--shared", "Remove your own credentials and use Gipity's shared ones").option("--json", "Output as JSON").action((name, opts) => run("Provider", async () => {
40280
40366
  const provider = name.toLowerCase();
40281
40367
  if (!PROVIDERS.includes(provider)) fail(`Unknown provider "${name}". Use one of: ${PROVIDERS.join(", ")}.`);
40282
40368
  const config = requireConfig2();
40283
40369
  const base = `/projects/${config.projectGuid}/auth/providers/${provider}`;
40284
40370
  const label2 = PROVIDER_LABEL[provider];
40285
- const credFlags = ["clientId", "clientSecret", "teamId", "keyId", "privateKeyFile"].filter((k7) => opts[k7] !== void 0);
40371
+ const credFlags = ["clientId", "clientSecret", "teamId", "keyId", "privateKeyFile", "bundleId", "requireNonce"].filter((k7) => opts[k7] !== void 0);
40286
40372
  if (opts.shared) {
40287
40373
  if (credFlags.length) fail("--shared cannot be combined with credential flags.");
40288
40374
  const res2 = await del(base);
@@ -40299,8 +40385,9 @@ See: gipity skill read steam-game`).option("--unique-names <on|off>", "Require u
40299
40385
  }
40300
40386
  let body;
40301
40387
  if (provider === "apple") {
40302
- const missing = [["clientId", "--client-id"], ["teamId", "--team-id"], ["keyId", "--key-id"], ["privateKeyFile", "--private-key-file"]].filter(([k7]) => !opts[k7]).map(([, f]) => f);
40388
+ const missing = [["teamId", "--team-id"], ["keyId", "--key-id"], ["privateKeyFile", "--private-key-file"]].filter(([k7]) => !opts[k7]).map(([, f]) => f);
40303
40389
  if (missing.length) fail(`Apple needs ${missing.join(", ")}. See: gipity project auth provider apple`);
40390
+ if (!opts.clientId && !opts.bundleId) fail("Apple needs --client-id (web Services ID), --bundle-id (iOS app), or both. See: gipity project auth provider apple");
40304
40391
  if (opts.clientSecret) fail("Apple takes --team-id, --key-id and --private-key-file, not --client-secret.");
40305
40392
  let privateKey;
40306
40393
  try {
@@ -40309,17 +40396,27 @@ See: gipity skill read steam-game`).option("--unique-names <on|off>", "Require u
40309
40396
  fail(`Cannot read ${opts.privateKeyFile}: ${err.code === "ENOENT" ? "no such file" : err.message}`);
40310
40397
  }
40311
40398
  if (!privateKey.includes("PRIVATE KEY")) fail(`${opts.privateKeyFile} does not look like a .p8 private key.`);
40312
- body = { client_id: opts.clientId, team_id: opts.teamId, key_id: opts.keyId, private_key: privateKey };
40399
+ body = {
40400
+ ...opts.clientId ? { client_id: opts.clientId } : {},
40401
+ ...opts.bundleId ? { bundle_ids: opts.bundleId } : {},
40402
+ ...opts.requireNonce ? { require_nonce: true } : {},
40403
+ team_id: opts.teamId,
40404
+ key_id: opts.keyId,
40405
+ private_key: privateKey
40406
+ };
40313
40407
  } else {
40314
40408
  const missing = [["clientId", "--client-id"], ["clientSecret", "--client-secret"]].filter(([k7]) => !opts[k7]).map(([, f]) => f);
40315
40409
  if (missing.length) fail(`${label2} needs ${missing.join(" and ")}. See: gipity project auth provider ${provider}`);
40316
- const extra = ["teamId", "keyId", "privateKeyFile"].filter((k7) => opts[k7] !== void 0);
40317
- if (extra.length) fail(`--team-id, --key-id and --private-key-file are for Apple only.`);
40410
+ const extra = ["teamId", "keyId", "privateKeyFile", "bundleId", "requireNonce"].filter((k7) => opts[k7] !== void 0);
40411
+ if (extra.length) fail(`--team-id, --key-id, --private-key-file, --bundle-id and --require-nonce are for Apple only.`);
40318
40412
  body = { client_id: opts.clientId, client_secret: opts.clientSecret };
40319
40413
  }
40320
40414
  const res = await put(base, body);
40321
40415
  const lines = [success(`${label2} sign-in now uses your own credentials.`)];
40322
40416
  if (provider === "google") lines.push(muted("Existing Google users keep their accounts."));
40417
+ if (provider === "apple" && opts.bundleId) {
40418
+ lines.push(muted(`iOS apps (${opts.bundleId.join(", ")}) can sign in with POST /api/<guid>/auth/apple. See: gipity skill read app-users`));
40419
+ }
40323
40420
  printResult(lines.join("\n"), opts, res.data);
40324
40421
  }));
40325
40422
  }
@@ -40381,7 +40478,7 @@ email code, Steam or a guest device. They belong to the app, not to Gipity.
40381
40478
  gipity project users --search ann find users by name or email
40382
40479
  gipity project users export -o users.csv every user, as CSV (or --format json)
40383
40480
  gipity project users delete <guid> erase a user (runs the app's user_deleted hooks)
40384
- gipity project users signout <guid> end all of a user's web sessions`);
40481
+ gipity project users signout <guid> sign a user out everywhere (web and native apps)`);
40385
40482
  users.command("list", { isDefault: true }).description("List the app's users").option("--search <text>", "Match name or email").option("--limit <n>", "How many to show (1-500, default 100)").option("--json", "Output as JSON").action((opts) => run("Users", async () => {
40386
40483
  let limit;
40387
40484
  if (opts.limit !== void 0) {
@@ -40431,7 +40528,7 @@ email code, Steam or a guest device. They belong to the app, not to Gipity.
40431
40528
  const res = await del(`/projects/${requireConfig2().projectGuid}/app-users/${encodeURIComponent(userGuid)}`);
40432
40529
  printResult(success(`Deleted user ${userGuid}.`), opts, { guid: userGuid, ...res.data });
40433
40530
  }));
40434
- users.command("signout <userGuid>").description("Sign a user out everywhere (revoke all of the user's web sessions)").option("--json", "Output as JSON").action((userGuid, opts) => run("Sign out", async () => {
40531
+ users.command("signout <userGuid>").description("Sign a user out everywhere: end their web sessions, revoke their native apps' refresh tokens, and void their access tokens").option("--json", "Output as JSON").action((userGuid, opts) => run("Sign out", async () => {
40435
40532
  const res = await post(`/projects/${requireConfig2().projectGuid}/app-users/${encodeURIComponent(userGuid)}/signout`);
40436
40533
  const n = res.data.signed_out_sessions;
40437
40534
  printResult(success(`Signed out ${userGuid}: ${n} session${n === 1 ? "" : "s"} ended.`), opts, { guid: userGuid, ...res.data });
@@ -43677,7 +43774,7 @@ async function observeClient(url, expr, i, label2, settleMs, holdMs, waitForSele
43677
43774
  // anything still applied at the end of the hold so the harness finishes.
43678
43775
  lifecycle: lifecycle?.length ? { steps: lifecycle, untilMs: holdMs } : void 0
43679
43776
  });
43680
- const d = await pollEvalResult(kickoff.data.evalJobId, settleMs + holdMs + (barrier ? JOIN_ALLOWANCE_MS : 0));
43777
+ const d = await pollEvalResult(kickoff.data.evalJobId, settleMs + holdMs + (barrier ? JOIN_ALLOWANCE_MS : 0), kickoff.data.maxMs);
43681
43778
  const raw = d.result?.trim() ?? "";
43682
43779
  if (raw.startsWith("EvalError:") || raw.startsWith("ObserveError:")) {
43683
43780
  return { ...base, error: raw };
@@ -44059,6 +44156,7 @@ init_api();
44059
44156
  init_auth();
44060
44157
  init_config();
44061
44158
  init_colors();
44159
+ import { pipeline } from "stream/promises";
44062
44160
  var recordsCommand = new Command("records").description("Manage app records (Gipity Records - validated CRUD with audit history)");
44063
44161
  var ANON_FLAG = "--anon";
44064
44162
  var ANON_HELP = "Call as an anonymous visitor (the public path a signed-out user hits) instead of as your signed-in account";
@@ -44087,13 +44185,13 @@ recordsCommand.command("tables").description("List the tables exposed through Gi
44087
44185
  res.data,
44088
44186
  opts,
44089
44187
  "No tables configured for Records API. Configure one with `gipity records config <table> --auth <level>`.",
44090
- (t) => `${bold(t.table_name)} ${muted(t.auth_level)} ${muted(`pk=${t.primary_key_column}`)} ${muted(`db=${t.database_name}`)}`
44188
+ (t) => `${bold(t.table_name)} ${muted(t.auth_level)} ${muted(`pk=${t.primary_key_column}`)} ${muted(`db=${t.database_name}`)}${t.append_only ? ` ${muted("append-only")}` : ""}`
44091
44189
  );
44092
44190
  }));
44093
- recordsCommand.command("config <table>").description("Show or set a table's Records API config (auth level, search, auto-numbering, etc.)").addOption(new Option("--auth <level>", "Auth level: public (anonymous writes), user (any signed-in caller), or member (owner and project members only)").choices(["public", "member", "user"])).option("--searchable <bool>", "Enable full-text search (true/false)").option("--primary-key <col>", "Primary key column (default: id)").option("--soft-delete <col>", 'Soft-delete column (pass "none" to clear)').option("--auto-number <prefix>", 'Number new records automatically, e.g. INC -> INC0001001 (pass "none" to turn off). Same as auto_number in gipity.yaml').option("--auto-number-pad <n>", "Zero-pad width of the auto-number (default 7)").option("--auto-number-column <col>", "Column the auto-number is written to (default: number)").option("--json", "Output as JSON").action((table, opts) => run("Config", async () => {
44191
+ recordsCommand.command("config <table>").description("Show or set a table's Records API config (auth level, search, auto-numbering, etc.)").addOption(new Option("--auth <level>", "Auth level: public (anonymous writes), user (any signed-in caller), or member (owner and project members only)").choices(["public", "member", "user"])).option("--searchable <bool>", "Enable full-text search (true/false)").option("--primary-key <col>", "Primary key column (default: id)").option("--soft-delete <col>", 'Soft-delete column (pass "none" to clear)').option("--auto-number <prefix>", 'Number new records automatically, e.g. INC -> INC0001001 (pass "none" to turn off). Same as auto_number in gipity.yaml').option("--auto-number-pad <n>", "Zero-pad width of the auto-number (default 7)").option("--auto-number-column <col>", "Column the auto-number is written to (default: number)").option("--append-only", "Make the table inserts-only for good: updates, deletes and purges are refused for everyone, including raw SQL. Can't be undone. Same as append_only: true in gipity.yaml").option("--json", "Output as JSON").action((table, opts) => run("Config", async () => {
44094
44192
  const config = requireConfig2();
44095
44193
  const base = `/api/${config.projectGuid}/records/${table}/config`;
44096
- const setting = opts.auth || opts.searchable !== void 0 || opts.primaryKey || opts.softDelete || opts.autoNumber || opts.autoNumberPad || opts.autoNumberColumn;
44194
+ const setting = opts.auth || opts.searchable !== void 0 || opts.primaryKey || opts.softDelete || opts.autoNumber || opts.autoNumberPad || opts.autoNumberColumn || opts.appendOnly;
44097
44195
  if (!setting) {
44098
44196
  const res2 = await get(base);
44099
44197
  printResult(JSON.stringify(res2.data, null, 2), opts, res2.data);
@@ -44111,11 +44209,12 @@ recordsCommand.command("config <table>").description("Show or set a table's Reco
44111
44209
  body.auto_number_pad = pad;
44112
44210
  }
44113
44211
  if (opts.autoNumberColumn) body.auto_number_column = opts.autoNumberColumn;
44212
+ if (opts.appendOnly) body.append_only = true;
44114
44213
  const res = await patch(base, body);
44115
44214
  const d = res.data;
44116
44215
  const autoNumber = d.auto_number_prefix ? `${d.auto_number_prefix} (pad ${d.auto_number_pad}, column ${d.auto_number_column})` : "off";
44117
44216
  printResult(
44118
- `Configured "${table}": auth=${d.auth_level}, searchable=${d.searchable}, pk=${d.primary_key_column}, auto-number=${autoNumber}`,
44217
+ `Configured "${table}": auth=${d.auth_level}, searchable=${d.searchable}, pk=${d.primary_key_column}, auto-number=${autoNumber}${d.append_only ? ", append-only" : ""}`,
44119
44218
  opts,
44120
44219
  d
44121
44220
  );
@@ -44151,7 +44250,15 @@ recordsCommand.command("get <table> <id>").description("Get a record").option(AN
44151
44250
  const res = await api.get(`/api/${api.guid}/records/${table}/${id2}`);
44152
44251
  console.log(opts.json ? JSON.stringify(res.data) : JSON.stringify(res.data, null, 2));
44153
44252
  }));
44154
- recordsCommand.command("history <table> [id]").description("Audit history (who/what changed it, with English summaries). Omit <id> for the whole table's feed.").option("--limit <n>", "Max events", "20").option(ANON_FLAG, ANON_HELP).option("--json", "Output as JSON").action((table, id2, opts) => run("History", async () => {
44253
+ recordsCommand.command("history <table> [id]").description("Audit history (who/what changed it, with English summaries). Omit <id> for the whole table's feed.").option("--limit <n>", "Max events", "20").option("--jsonl", "Export the WHOLE table history to stdout as JSON Lines, oldest first (owner/editor; ignores --limit)").option(ANON_FLAG, ANON_HELP).option("--json", "Output as JSON").action((table, id2, opts) => run("History", async () => {
44254
+ if (opts.jsonl) {
44255
+ if (id2) throw new Error("--jsonl exports a whole table: drop the <id>");
44256
+ if (opts.anon) throw new Error("--jsonl needs the owner or an editor: drop --anon");
44257
+ const config = requireConfig2();
44258
+ const body = await downloadStream(`/api/${config.projectGuid}/records/${encodeURIComponent(table)}/history?format=jsonl`);
44259
+ await pipeline(body, process.stdout, { end: false });
44260
+ return;
44261
+ }
44155
44262
  const api = await recordsHttp(opts);
44156
44263
  const scope = id2 ? `${table}/${encodeURIComponent(id2)}` : table;
44157
44264
  const res = await api.get(
@@ -44373,7 +44480,7 @@ async function scopeQuery(opts) {
44373
44480
  const { config } = await resolveProjectContext({ projectOverride: opts.project });
44374
44481
  return `scope=project&app_guid=${config.projectGuid}`;
44375
44482
  }
44376
- var secretsCommand = new Command("secrets").description("Manage app secrets").addHelpText("after", '\nEncrypted API keys and tokens for your app, read in functions via secrets.get("NAME").');
44483
+ var secretsCommand = new Command("secrets").description("Manage app secrets").addHelpText("after", '\nEncrypted API keys and tokens for your app, read in functions via secrets.get("NAME").\nValues are write-only: no command prints a stored value back.');
44377
44484
  secretsCommand.command("list").alias("ls").description("List secret names (never values). Project secrets by default; --account for account-wide").option("--account", "Account-wide secrets shared across all your projects").option("--project <guid-or-slug>", "Target a specific project instead of cwd / Home").option("--json", "Output raw JSON").action((opts) => run("Secrets", async () => {
44378
44485
  const res = await get(`/secrets?${await scopeQuery(opts)}`);
44379
44486
  if (opts.json) {
@@ -44391,6 +44498,16 @@ secretsCommand.command("list").alias("ls").description("List secret names (never
44391
44498
  console.log(` ${s.name} ${masked} ${muted(`updated ${new Date(s.updated_at).toLocaleDateString()}`)}`);
44392
44499
  }
44393
44500
  }));
44501
+ secretsCommand.command("get <name>").description("Secret values are write-only: confirms the secret exists, never prints its value").option("--account", "Look in account-wide secrets").option("--project <guid-or-slug>", "Target a specific project instead of cwd / Home").option("--json", "Output raw JSON").action((name, opts) => run("Secrets", async () => {
44502
+ const res = await get(`/secrets?${await scopeQuery(opts)}`);
44503
+ const scope = opts.account ? "account-wide" : "project";
44504
+ const found = res.data.find((s) => s.name === name);
44505
+ if (!found) throw new Error(`No ${scope} secret named '${name}'. Values are write-only, so set it with: gipity secrets set ${name} VALUE${opts.account ? " --account" : ""}`);
44506
+ const ends = found.preview ? ` (ends in ...${found.preview})` : "";
44507
+ throw new Error(
44508
+ `secret values are write-only and are never shown. '${name}' exists${ends}; only a deployed function can read it, with secrets.get('${name}'). To hand a value to another service too, generate it yourself, keep it, then store it: TOK=$(openssl rand -hex 24); gipity secrets set ${name} "$TOK"; echo "$TOK". Setting it again replaces the live value.`
44509
+ );
44510
+ }));
44394
44511
  secretsCommand.command("set <name> <value>").description("Create or update a secret (UPPER_SNAKE_CASE name). Encrypted at rest; never echoed back").option("--account", "Store account-wide (shared across all your projects)").option("--project <guid-or-slug>", "Target a specific project instead of cwd / Home").option("--json", "Output raw JSON").action((name, value, opts) => run("Secrets", async () => {
44395
44512
  const res = await put(`/secrets?${await scopeQuery(opts)}`, { name, value });
44396
44513
  if (opts.json) {
@@ -45049,7 +45166,7 @@ init_api();
45049
45166
  init_config();
45050
45167
  init_colors();
45051
45168
  var emailCommand = new Command("email").description("Test and inspect a deployed app's email() sends");
45052
- emailCommand.command("test").description("Send a test email through your app's email() path (owner-billed)").argument("<to>", "Recipient address").option("--subject <text>", "Subject", "Test email from Gipity").option("--text <text>", "Body text", "This is a test email sent through your app's email() service. \u2709\uFE0F").option("--reply-to <email>", "Reply-To address").option("--from-name <name>", "Sender display name (address stays gipity@gipity.ai)").option("--project <guid-or-slug>", "Target a specific project instead of cwd / Home").option("--json", "Output raw JSON").action((to2, opts) => run("Email", async () => {
45169
+ emailCommand.command("test").description("Send a test email through your app's email() path (owner-billed)").argument("<to>", "Recipient address, or 'owner' for the app owner's own account email").option("--subject <text>", "Subject", "Test email from Gipity").option("--text <text>", "Body text", "This is a test email sent through your app's email() service. \u2709\uFE0F").option("--reply-to <email>", "Reply-To address").option("--from-name <name>", "Sender display name (address stays gipity@gipity.ai)").option("--project <guid-or-slug>", "Target a specific project instead of cwd / Home").option("--json", "Output raw JSON").action((to2, opts) => run("Email", async () => {
45053
45170
  const { config } = await resolveProjectContext({ projectOverride: opts.project });
45054
45171
  const payload = { to: to2, subject: opts.subject, text: opts.text };
45055
45172
  if (opts.replyTo) payload.replyTo = opts.replyTo;
package/dist/knowledge.js CHANGED
@@ -56,7 +56,7 @@ You are the developer. Write files in this directory - Gipity's editor hooks (in
56
56
 
57
57
  ## Use first-party services before reaching outside
58
58
 
59
- Gipity ships first-party services for what apps usually pull from third parties - auth, location/geocoding, LLM, image/audio/video generation, transcription, file uploads, realtime, web push notifications (Gipity Notify - no VAPID keys, no Firebase/OneSignal; works on iOS home-screen web apps), semantic search (\`embed()\` + pgvector in the app's own DB - no Pinecone/Weaviate/vector DB), and email (from a deployed app's function with the injected \`email()\` service - \`services: ['email']\`, no SMTP/SendGrid/Nodemailer; check it with \`gipity email test <to>\`). Before calling an external API or adding an npm package for one of these, check \`gipity skill list\` for a match. First-party services need no API keys, cost less, and keep data in-house. Reach outside only when the catalog has no equivalent - and say so when you do.
59
+ Gipity ships first-party services for what apps usually pull from third parties - auth, location/geocoding, LLM, image/audio/video generation, transcription, file uploads, realtime, web push notifications (Gipity Notify - no VAPID keys, no Firebase/OneSignal; works on iOS home-screen web apps), semantic search (\`embed()\` + pgvector in the app's own DB - no Pinecone/Weaviate/vector DB), and email (from a deployed app's function with the injected \`email()\` service - \`services: ['email']\`, no SMTP/SendGrid/Nodemailer; "email me when..." is \`email({ to: 'owner', ... })\`, which reaches the app owner with no address or secret; check it with \`gipity email test <to>\`). Before calling an external API or adding an npm package for one of these, check \`gipity skill list\` for a match. First-party services need no API keys, cost less, and keep data in-house. Reach outside only when the catalog has no equivalent - and say so when you do.
60
60
 
61
61
  ## Don't guess Gipity facts - look them up
62
62
 
@@ -110,7 +110,7 @@ mkdir -p ~/GipityProjects/<slug> && cd ~/GipityProjects/<slug> && gipity init <s
110
110
 
111
111
  ## CLI quick reference
112
112
 
113
- Key commands: \`gipity add <template|kit>\`, \`gipity brand set --emoji <e>|--color <hex>\` (regenerate the app's icons + social share card), \`gipity deploy [prod|<env>]\`, \`gipity env\` (list/create/delete environments), \`gipity sandbox run\`, \`gipity page inspect <url>\`, \`gipity page screenshot <url>\`, \`gipity db query "SQL"\`, \`gipity fn call <name>\`, \`gipity logs fn <name>\`, \`gipity secrets set <NAME> <value> [--account]\` (store an API key/token encrypted; read in functions via \`secrets.get('NAME')\` - never hardcode keys), \`gipity skill read <name>\`.
113
+ Key commands: \`gipity add <template|kit>\`, \`gipity brand set --emoji <e>|--color <hex>\` (regenerate the app's icons + social share card), \`gipity deploy [prod|<env>]\`, \`gipity env\` (list/create/delete environments), \`gipity sandbox run\`, \`gipity page inspect <url>\`, \`gipity page screenshot <url>\`, \`gipity db query "SQL"\`, \`gipity fn call <name>\`, \`gipity logs fn <name>\`, \`gipity secrets set <NAME> <value> [--account]\` (store an API key/token encrypted; read in functions via \`secrets.get('NAME')\`; write-only, so keep a copy of any value another service also needs - never hardcode keys), \`gipity skill read <name>\`.
114
114
  Rename for findability: \`gipity project rename <name>\` renames the current project's display name (the slug and deployed URLs never change); it's the label users scan in Monitor and \`gipity project\`, so keep it SHORT: 2-4 words, at most 40 characters, no trailing punctuation (e.g. "Stripe checkout", "Tetris game").
115
115
  Pull an existing remote project local (given its URL/slug): \`mkdir -p ~/GipityProjects/<slug> && cd ~/GipityProjects/<slug> && gipity init <slug>\` (adopts the matching project and syncs files down - this is the "clone").
116
116
  Move whole apps in/out: \`gipity save\` (export this project as a portable \`.gip\` bundle), \`gipity load <file.gip | github:owner/repo>\` (import as a NEW project; \`--inspect\` to preview), \`gipity github connect\` (1-2 click GitHub access for imports). Porting a Vercel/Replit/Lovable app? Load the \`app-import\` skill first.
@@ -174,6 +174,7 @@ Watch for **bulky output dirs dropped loose at the root** (e.g. \`out/\`, \`vsd_
174
174
  Run \`gipity skill list\` to see every skill. Run \`gipity skill read <name>\` to read one. Load the relevant skill before starting a task - they have the correct API patterns, code examples, and common mistakes.
175
175
 
176
176
  App services skills (load before calling \`/services/*\` endpoints):
177
+ - \`app-api-keys\` - project API keys for scripts/devices: gipity key create, scopes (functions, tables, files, ip)
177
178
  - \`app-audio\` - sound effects, music, transcription
178
179
  - \`app-auth\` - sign in: Gipity accounts or app-owned users (Google, email code), popup vs redirect
179
180
  - \`app-files\` - uploads, then displaying files and the storage helper (ownership check, delete)
@@ -209,7 +210,7 @@ Kit skills (reusable building blocks - \`gipity add <kit>\`):
209
210
  - \`leaderboard\` - game leaderboards: high scores or times, daily/weekly/monthly/season boards, tiebreaks, replays, cheat checks, bans
210
211
 
211
212
  Other key skills:
212
- - \`email\` - sending email from a deployed app with the email() service or a workflow notify step (no setup/keys), gipity email test/log, HTML formatting, images
213
+ - \`email\` - sending email from a deployed app with the email() service or a workflow notify step (no setup/keys; to: 'owner' emails you, the app owner), gipity email test/log, HTML formatting, images
213
214
  - \`sandbox-tools\` - cloud sandbox capabilities and pre-installed tools`;
214
215
  export const DEFINITION_OF_DONE = `## Definition of done (build tasks)
215
216
  1. \`gipity deploy\` succeeds and you have a live URL.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gipity",
3
- "version": "1.1.38",
3
+ "version": "1.1.40",
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",
@@ -14,7 +14,7 @@
14
14
  "prepack": "npm run build",
15
15
  "dev": "tsc --watch",
16
16
  "test": "npm run test:smoke",
17
- "test:smoke": "npm run build && node --test dist/__tests__/utils.test.js dist/__tests__/template-vars.test.js dist/__tests__/platform.test.js dist/__tests__/colors.test.js dist/__tests__/config.test.js dist/__tests__/sync.test.js dist/__tests__/sync-apply.test.js dist/__tests__/sync-unretrievable.test.js dist/__tests__/sync-clean-check.test.js dist/__tests__/sync-lock.test.js dist/__tests__/auth-lock.test.js dist/__tests__/auth-refresh-timeout.test.js dist/__tests__/api-401-retry.test.js dist/__tests__/api-timeout.test.js dist/__tests__/api-error-body.test.js dist/__tests__/push-cas.test.js dist/__tests__/upload.test.js dist/__tests__/progress.test.js dist/__tests__/updater.test.js dist/__tests__/cli-smoke.test.js dist/__tests__/claude-noninteractive.test.js dist/__tests__/claude-trust.test.js dist/__tests__/claude-auth-status.test.js dist/__tests__/build-picker.test.js dist/__tests__/relay-state.test.js dist/__tests__/media-upload.test.js dist/__tests__/prompts.test.js dist/__tests__/capture-transcript.test.js dist/__tests__/capture-parsers.test.js dist/__tests__/agents.test.js dist/__tests__/capture-lock.test.js dist/__tests__/capture-resolve.test.js dist/__tests__/capture-metrics.test.js dist/__tests__/flag-aliases.test.js dist/__tests__/net.test.js dist/__tests__/client-context.test.js dist/__tests__/adopt-cwd.test.js dist/__tests__/cli-cmd-approval.test.js dist/__tests__/cli-cmd-audit.test.js dist/__tests__/cli-cmd-brand.test.js dist/__tests__/cli-cmd-bug.test.js dist/__tests__/cli-cmd-bug-queue.test.js dist/__tests__/cli-cmd-credits.test.js dist/__tests__/cli-cmd-account.test.js dist/__tests__/cli-cmd-db.test.js dist/__tests__/cli-cmd-db-checkpoint.test.js dist/__tests__/cli-cmd-deploy.test.js dist/__tests__/cli-cmd-env.test.js dist/__tests__/cli-cmd-domain.test.js dist/__tests__/cli-cmd-email.test.js dist/__tests__/cli-cmd-file.test.js dist/__tests__/cli-cmd-storage.test.js dist/__tests__/cli-cmd-fn.test.js dist/__tests__/cli-cmd-service.test.js dist/__tests__/cli-cmd-job.test.js dist/__tests__/cli-cmd-generate.test.js dist/__tests__/cli-cmd-ask.test.js dist/__tests__/cli-cmd-gmail.test.js dist/__tests__/cli-cmd-info.test.js dist/__tests__/cli-cmd-init.test.js dist/__tests__/cli-cmd-location.test.js dist/__tests__/cli-cmd-text.test.js dist/__tests__/cli-cmd-login.test.js dist/__tests__/cli-cmd-status.test.js dist/__tests__/cli-cmd-logout.test.js dist/__tests__/cli-cmd-token.test.js dist/__tests__/cli-cmd-key.test.js dist/__tests__/cli-cmd-logs.test.js dist/__tests__/cli-cmd-memory.test.js dist/__tests__/cli-cmd-page.test.js dist/__tests__/cli-cmd-plan.test.js dist/__tests__/cli-cmd-project.test.js dist/__tests__/cli-cmd-rbac.test.js dist/__tests__/cli-cmd-realtime.test.js dist/__tests__/cli-cmd-records.test.js dist/__tests__/cli-cmd-setup.test.js dist/__tests__/cli-cmd-doctor.test.js dist/__tests__/claude-setup.test.js dist/__tests__/cli-cmd-sandbox.test.js dist/__tests__/cli-cmd-add.test.js dist/__tests__/cli-cmd-remove.test.js dist/__tests__/cli-cmd-skill.test.js dist/__tests__/cli-cmd-test.test.js dist/__tests__/cli-cmd-workflow.test.js dist/__tests__/cli-cmd-push.test.js dist/__tests__/cli-cmd-uninstall.test.js dist/__tests__/tool-detection.test.js dist/__tests__/setup-skills-block.test.js dist/__tests__/setup-hooks.test.js dist/__tests__/setup-codex-hooks.test.js dist/__tests__/setup-agy-hooks.test.js dist/__tests__/trace.test.js",
17
+ "test:smoke": "npm run build && node --test dist/__tests__/utils.test.js dist/__tests__/template-vars.test.js dist/__tests__/platform.test.js dist/__tests__/colors.test.js dist/__tests__/config.test.js dist/__tests__/sync.test.js dist/__tests__/sync-apply.test.js dist/__tests__/sync-unretrievable.test.js dist/__tests__/sync-clean-check.test.js dist/__tests__/sync-lock.test.js dist/__tests__/auth-lock.test.js dist/__tests__/auth-refresh-timeout.test.js dist/__tests__/api-401-retry.test.js dist/__tests__/api-timeout.test.js dist/__tests__/api-error-body.test.js dist/__tests__/push-cas.test.js dist/__tests__/upload.test.js dist/__tests__/progress.test.js dist/__tests__/updater.test.js dist/__tests__/cli-smoke.test.js dist/__tests__/claude-noninteractive.test.js dist/__tests__/claude-trust.test.js dist/__tests__/claude-auth-status.test.js dist/__tests__/build-picker.test.js dist/__tests__/relay-state.test.js dist/__tests__/media-upload.test.js dist/__tests__/prompts.test.js dist/__tests__/capture-transcript.test.js dist/__tests__/capture-parsers.test.js dist/__tests__/agents.test.js dist/__tests__/capture-lock.test.js dist/__tests__/capture-resolve.test.js dist/__tests__/capture-metrics.test.js dist/__tests__/flag-aliases.test.js dist/__tests__/net.test.js dist/__tests__/client-context.test.js dist/__tests__/adopt-cwd.test.js dist/__tests__/cli-cmd-approval.test.js dist/__tests__/cli-cmd-audit.test.js dist/__tests__/cli-cmd-brand.test.js dist/__tests__/cli-cmd-bug.test.js dist/__tests__/cli-cmd-bug-queue.test.js dist/__tests__/cli-cmd-credits.test.js dist/__tests__/cli-cmd-account.test.js dist/__tests__/cli-cmd-db.test.js dist/__tests__/cli-cmd-db-checkpoint.test.js dist/__tests__/cli-cmd-deploy.test.js dist/__tests__/cli-cmd-env.test.js dist/__tests__/cli-cmd-domain.test.js dist/__tests__/cli-cmd-email.test.js dist/__tests__/cli-cmd-secrets.test.js dist/__tests__/cli-cmd-file.test.js dist/__tests__/cli-cmd-storage.test.js dist/__tests__/cli-cmd-fn.test.js dist/__tests__/cli-cmd-service.test.js dist/__tests__/cli-cmd-job.test.js dist/__tests__/cli-cmd-generate.test.js dist/__tests__/cli-cmd-ask.test.js dist/__tests__/cli-cmd-gmail.test.js dist/__tests__/cli-cmd-info.test.js dist/__tests__/cli-cmd-init.test.js dist/__tests__/cli-cmd-location.test.js dist/__tests__/cli-cmd-text.test.js dist/__tests__/cli-cmd-login.test.js dist/__tests__/cli-cmd-status.test.js dist/__tests__/cli-cmd-logout.test.js dist/__tests__/cli-cmd-token.test.js dist/__tests__/cli-cmd-key.test.js dist/__tests__/cli-cmd-logs.test.js dist/__tests__/cli-cmd-memory.test.js dist/__tests__/cli-cmd-page.test.js dist/__tests__/cli-cmd-plan.test.js dist/__tests__/cli-cmd-project.test.js dist/__tests__/cli-cmd-rbac.test.js dist/__tests__/cli-cmd-realtime.test.js dist/__tests__/cli-cmd-records.test.js dist/__tests__/cli-cmd-setup.test.js dist/__tests__/cli-cmd-doctor.test.js dist/__tests__/claude-setup.test.js dist/__tests__/cli-cmd-sandbox.test.js dist/__tests__/cli-cmd-add.test.js dist/__tests__/cli-cmd-remove.test.js dist/__tests__/cli-cmd-skill.test.js dist/__tests__/cli-cmd-test.test.js dist/__tests__/cli-cmd-workflow.test.js dist/__tests__/cli-cmd-push.test.js dist/__tests__/cli-cmd-uninstall.test.js dist/__tests__/tool-detection.test.js dist/__tests__/setup-skills-block.test.js dist/__tests__/setup-hooks.test.js dist/__tests__/setup-codex-hooks.test.js dist/__tests__/setup-agy-hooks.test.js dist/__tests__/trace.test.js",
18
18
  "test:relay": "npm run build && node --test dist/__tests__/relay-daemon.test.js dist/__tests__/session-pool.test.js dist/__tests__/relay-diagnostics.test.js dist/__tests__/relay-agent-updates.test.js dist/__tests__/relay-installers.test.js dist/__tests__/relay-bridge-abort.test.js dist/__tests__/relay-redact.test.js dist/__tests__/relay-machine-id.test.js dist/__tests__/stream-json.test.js dist/__tests__/ingest-queue.test.js dist/__tests__/stream-delta.test.js dist/__tests__/phase-tracker.test.js dist/__tests__/relay-ingest-contract.test.js dist/__tests__/cli-cmd-relay.test.js",
19
19
  "test:smoke:quick": "node scripts/smoke-quick.mjs",
20
20
  "test:e2e": "tsc && GIPITY_E2E=1 node --test --test-timeout=180000 dist/__tests__/cli-e2e-live.test.js dist/__tests__/cli-e2e-sync-live.test.js dist/__tests__/cli-e2e-sync-stress-live.test.js dist/__tests__/cli-e2e-rollback-live.test.js dist/__tests__/cli-e2e-services-media-live.test.js dist/__tests__/cli-e2e-workflow-live.test.js dist/__tests__/cli-e2e-sandbox-live.test.js dist/__tests__/cli-e2e-page-fetch-live.test.js dist/__tests__/cli-e2e-page-test-live.test.js dist/__tests__/cli-e2e-surface-live.test.js dist/__tests__/cli-e2e-account-live.test.js dist/__tests__/cli-e2e-envs-live.test.js",