gipity 1.1.23 → 1.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/knowledge.js CHANGED
@@ -48,11 +48,11 @@ Gipity is the cloud platform your project runs on - hosting, databases, deployme
48
48
 
49
49
  Prefer the cheapest option that works - CLI and sandbox are instant and free, app services are runtime HTTP calls, and a model call (\`gipity ask\`) costs tokens:
50
50
 
51
- 1. CLI commands (fast, no agent overhead). The \`gipity\` CLI covers add, deploy, db, fn, logs, page, sync, memory, skill, email, and more. All commands support \`--json\`.
51
+ 1. CLI commands (fast, no agent overhead). The \`gipity\` CLI covers add, deploy, db, fn, logs, page, sync, memory, skill, email, and more. All commands support \`--json\` (except \`gipity build\`, which hands the terminal to your coding agent).
52
52
  2. Cloud sandbox via \`gipity sandbox run\` - Docker container with pre-installed tools for media (ffmpeg, ImageMagick, sox), documents (pandoc, LibreOffice), and data (pandas, matplotlib, sqlite3). Run \`gipity skill read sandbox-tools\` for the full toolkit. No network from inside the sandbox - fetch what you need before sending it in.
53
- 3. App services - runtime HTTP endpoints your deployed app calls directly at \`https://a.gipity.ai/api/<PROJECT_GUID>/services/*\`. Available: LLM, TTS, image, sound, music, transcribe, video, file upload, realtime, location, push notifications (Gipity Notify - \`gipity add notify\`, send from a function with the injected \`notify()\`; see \`app-notify\`). Load the matching skill (\`app-llm\`, \`app-tts\`, etc.) before writing service code - they have the schemas, auth pattern, and common-mistake guards. For one-off generation during development, prefer \`gipity generate <image|video|speech|sound|music>\` - direct generation always bills you (the owner), regardless of any service \`billing_mode\` (that setting only governs the deployed app's runtime calls; never flip it just to create assets). \`gipity generate\` saves to a generic file in the current directory by default (e.g. \`./generated.png\`) - pass \`-o <path>\` to write it straight into your source tree so it deploys (e.g. \`gipity generate image "hero banner" -o src/assets/images/hero.png\`) instead of generating at cwd and moving it. For a quick model answer while you work - summarize a log, extract fields, describe a screenshot, a second opinion from a different model - use \`gipity ask "<question>"\`: one call, no history or tools, any model (\`--model sonnet\`, \`--model openai\`), text files with \`--file <path>\` (\`--file -\` for stdin), images with \`--image <path>\`, and a JSON answer with \`--schema '<json schema>'\`.
53
+ 3. App services - runtime HTTP endpoints your deployed app calls directly at \`https://a.gipity.ai/api/<PROJECT_GUID>/services/*\`. Available: LLM, TTS, image, sound, music, transcribe, video, file upload, realtime (a function can push into a room with the injected \`realtime.publish()\`, so a page listens instead of polling; see \`app-realtime\`), location, push notifications (Gipity Notify - \`gipity add notify\`, send from a function with the injected \`notify()\`; see \`app-notify\`). Load the matching skill (\`app-llm\`, \`app-tts\`, etc.) before writing service code - they have the schemas, auth pattern, and common-mistake guards. For one-off generation during development, prefer \`gipity generate <image|video|speech|sound|music>\` - direct generation always bills you (the owner), regardless of any service \`billing_mode\` (that setting only governs the deployed app's runtime calls; never flip it just to create assets). \`gipity generate\` saves to a generic file in the current directory by default (e.g. \`./generated.png\`) - pass \`-o <path>\` to write it straight into your source tree so it deploys (e.g. \`gipity generate image "hero banner" -o src/assets/images/hero.png\`) instead of generating at cwd and moving it. For a quick model answer while you work - summarize a log, extract fields, describe a screenshot, a second opinion from a different model - use \`gipity ask "<question>"\`: one call, no history or tools, any model (\`--model sonnet\`, \`--model openai\`), text files with \`--file <path>\` (\`--file -\` for stdin), images with \`--image <path>\`, and a JSON answer with \`--schema '<json schema>'\`.
54
54
 
55
- You are the developer. Write files in this directory - Gipity's editor hooks (installed by \`gipity init\` into Claude Code, Grok, Codex, and opencode) auto-sync them to Gipity. Don't run \`npm install\`, \`npm start\`, \`node\`, or \`python\` locally; there is no local runtime. Code runs in the Gipity sandbox.
55
+ You are the developer. Write files in this directory - Gipity's editor hooks (installed by \`gipity init\` into Claude Code, Codex, Grok, Antigravity, and opencode) auto-sync them to Gipity. Don't run \`npm install\`, \`npm start\`, \`node\`, or \`python\` locally; there is no local runtime. Code runs in the Gipity sandbox.
56
56
 
57
57
  ## Use first-party services before reaching outside
58
58
 
@@ -120,7 +120,7 @@ Run \`gipity --help\` for the full list. Use \`--help\` on any command for detai
120
120
 
121
121
  Function return shape: \`gipity fn call\`, the in-test \`ctx.fn.call\`/\`callAs\`, and the client \`Gipity.fn\` all return your function's value **unwrapped** - read/assert \`result.field\`. Only raw HTTP/\`curl\` wraps it as \`{ data: ... }\`; never write \`result.data.field\` in a test.
122
122
 
123
- Tests are isolated, not run against your live DB: \`gipity test\` points \`ctx.fn.call\`/\`callAs\` at a throwaway copy of your database (your \`migrations/\` + \`seeds/\`), one per test FILE, reset (truncate + reseed) before the file runs - so files can't interfere, test rows never reach the deployed app, and you don't write teardown. Functions see \`ctx.isTest === true\` during a run (use it to skip your own rate limiting); the platform also suppresses \`notify()\` push so a suite can't spam subscribers. Reference data tests need goes in seed files; a runtime-written settings table that isn't seeded goes under \`test.preserve\` in \`gipity.yaml\`. Build per-file fixtures in \`setup(fn)\` → \`ctx.fixtures\`.
123
+ Tests are isolated, not run against your live DB: \`gipity test\` points \`ctx.fn.call\`/\`callAs\` at a throwaway copy of your database (your migrations plus the seed files named by the sql phase's \`seed:\` key in \`gipity.yaml\`), one per test FILE, reset (truncate + reseed) before the file runs - so files can't interfere, test rows never reach the deployed app, and you don't write teardown. Functions see \`ctx.isTest === true\` during a run (use it to skip your own rate limiting); the platform also suppresses \`notify()\` push so a suite can't spam subscribers. Reference data tests need goes in those seed files; a runtime-written settings table that isn't seeded goes under \`test.preserve\` in \`gipity.yaml\`. Build per-file fixtures in \`setup(fn)\` → \`ctx.fixtures\`.
124
124
 
125
125
  ## Hit friction on the platform? Report it in real time
126
126
 
@@ -148,7 +148,9 @@ Every tool call returns its full output with that call. There is no output buffe
148
148
 
149
149
  This directory is the app root - it holds \`.gipity.json\` (and \`gipity.yaml\` for backends) and is already your cwd, so run app commands here. Don't \`cd\` to a git root (\`git rev-parse --show-toplevel\`): when the app is nested in a larger repo that resolves outside the app.
150
150
 
151
- Write files locally - Gipity's editor hooks (installed into Claude Code, Grok, Codex, and opencode by \`gipity init\`) auto-push every save to Gipity and auto-pull remote changes (sandbox outputs, restored versions) before each turn. Use \`gipity sync\` if things get out of sync (or if the hooks aren't installed - \`gipity status --repair-hooks\` re-enables them). Deletes are safe - \`gipity file rollback <datetime>\` undoes a tree, \`gipity file restore <path> <version>\` a single file.
151
+ Write files locally - Gipity's editor hooks (installed into Claude Code, Codex, Grok, Antigravity, and opencode by \`gipity init\`) auto-push every save to Gipity and auto-pull remote changes (sandbox outputs, restored versions) before each turn. Use \`gipity sync\` if things get out of sync (or if the hooks aren't installed - \`gipity status --repair-hooks\` re-enables them). Deletes are safe - \`gipity file rollback <datetime>\` undoes a tree, \`gipity file restore <path> <version>\` a single file.
152
+
153
+ Files your deployed app stores at runtime through the app uploads API (users' uploads, \`gipity upload\`, or an external service using a project API key; under \`uploads/\` or any custom path) are user content, not source: they stay in Gipity Storage and never sync into this directory, and sync never deletes them. List them with \`gipity file tree\`, read one with \`gipity file cat <path>\`.
152
154
 
153
155
  To keep local-only material (research clones, scratch data, vendored references) in the project directory without syncing or deploying it, list it in a \`.gipityignore\` at the project root - gitignore-style, one pattern per line, \`#\` comments. Ignored paths are invisible to sync in both directions; anything that already synced before being ignored stays on the server until you delete it.
154
156
 
@@ -156,7 +158,7 @@ To keep local-only material (research clones, scratch data, vendored references)
156
158
 
157
159
  ### Where files go: deploy only ships \`src/\`
158
160
 
159
- Deploy is opt-in, not opt-out: the \`files\` phase uploads **only** what's under \`src/\` (plus \`functions/\` and \`migrations/\` as backend, not CDN files). Anything else at the project root is kept but never deployed. Put each kind of file in the right bucket so scratch and reference material can't bloat a deploy:
161
+ Deploy is opt-in, not opt-out: the \`files\` phase uploads **only** what's under \`src/\` (plus \`functions/\` and \`migrations/\` as backend, not CDN files). Anything else at the project root is kept but never deployed. (A project with no \`src/\` fails the files deploy with \`no src/ directory\`; every template creates it.) Put each kind of file in the right bucket so scratch and reference material can't bloat a deploy:
160
162
 
161
163
  - **\`src/\`** - the app itself. Synced **and** deployed to the CDN. Only app code, assets, and pages belong here.
162
164
  - **\`tmp/\`** - ephemeral scratch: file conversions, intermediate outputs, design staging. **Already ignored** (never synced, never deployed) - the one place to do throwaway work. Use this single root. Leave scratch files where they are when you're done; there's nothing to clean up (no \`rm\` turn) - they're invisible to sync and deploy. (\`*_tmp/\` dirs and \`.gipityscratch/\` are auto-ignored too, as a safety net, so legacy scattered scratch like \`_vsd_tmp/\` can't leak - but write new scratch to \`tmp/\`, not scattered dirs.) Because it never syncs, \`tmp/\` is also never mirrored into the sandbox: **don't stage \`gipity sandbox run\` inputs here** - the sandbox won't see them. Stage inputs under \`src/\`/\`docs/\` and delete them after.
@@ -181,7 +183,7 @@ App services skills (load before calling \`/services/*\` endpoints):
181
183
  - \`app-notify\` - web push notifications for deployed apps (incl. iOS home-screen web apps) - notify kit + injected notify() service, platform owns the keys
182
184
  - \`app-payments\` - charge end-users real money - Stripe one-time purchases & subscriptions, via the stripe kit (gipity add stripe)
183
185
  - \`app-realtime\` - Gipity Realtime rooms, relay vs state
184
- - \`app-tts\` - voices, multi-speaker, languages
186
+ - \`app-tts\` - voices, models, dialogue, languages, word timestamps
185
187
  - \`app-video\` - Gipity Video: models, aspect, resolution
186
188
 
187
189
  App development skills:
@@ -21,36 +21,38 @@ import { flushBugQueue } from './bug-queue.js';
21
21
  function newAccountWouldBeUnexpected(email, priorAuth) {
22
22
  return !!getConfig() || priorAuth?.email.toLowerCase() === email.toLowerCase().trim();
23
23
  }
24
+ /** Both warnings take a `log` sink so `gipity login --json` can send them to
25
+ * stderr and keep stdout to the one JSON result. */
24
26
  /** Called right after `/auth/login` (send-code), before the code is entered -
25
27
  * the server already knows at this point whether the email matches an
26
28
  * existing account (bug cli#S2: logging into the wrong/new account was
27
29
  * previously silent until a later "not found" error). */
28
- export function warnBeforeCodeIfUnexpectedNewAccount(isNewUser, email, indent = '') {
30
+ export function warnBeforeCodeIfUnexpectedNewAccount(isNewUser, email, indent = '', log = console.log) {
29
31
  if (isNewUser !== true)
30
32
  return;
31
33
  const priorAuth = getAuth();
32
34
  if (!newAccountWouldBeUnexpected(email, priorAuth))
33
35
  return;
34
36
  const config = getConfig();
35
- console.log(`${indent}${warning(`No existing Gipity account for ${email}: entering the code will CREATE a new one.`)}`);
37
+ log(`${indent}${warning(`No existing Gipity account for ${email}: entering the code will CREATE a new one.`)}`);
36
38
  if (config) {
37
- console.log(`${indent}${muted(`This directory is linked to project ${config.projectSlug} (account ${config.accountSlug}). If you meant to log into that account, stop and re-check the email before entering the code.`)}`);
39
+ log(`${indent}${muted(`This directory is linked to project ${config.projectSlug} (account ${config.accountSlug}). If you meant to log into that account, stop and re-check the email before entering the code.`)}`);
38
40
  }
39
41
  }
40
42
  /** Called right after `/auth/verify` succeeds. `priorAuth` must be captured
41
43
  * BEFORE `saveAuth()` overwrites the cache - it's the only way to tell "this
42
44
  * machine already had a session for this email" from "first login ever". */
43
- export function warnIfUnexpectedNewAccount(isNewUser, email, priorAuth, indent = '') {
45
+ export function warnIfUnexpectedNewAccount(isNewUser, email, priorAuth, indent = '', log = console.log) {
44
46
  if (isNewUser !== true)
45
47
  return;
46
48
  if (!newAccountWouldBeUnexpected(email, priorAuth))
47
49
  return;
48
50
  const config = getConfig();
49
- console.log(`${indent}${warning(`Logged into a NEW, empty account for ${email}: no prior account existed for this email.`)}`);
51
+ log(`${indent}${warning(`Logged into a NEW, empty account for ${email}: no prior account existed for this email.`)}`);
50
52
  if (config) {
51
- console.log(`${indent}${muted(`This directory is linked to project ${config.projectSlug} (account ${config.accountSlug}), which the new account does not own: project / skill / sync commands will fail with "not found".`)}`);
53
+ log(`${indent}${muted(`This directory is linked to project ${config.projectSlug} (account ${config.accountSlug}), which the new account does not own: project / skill / sync commands will fail with "not found".`)}`);
52
54
  }
53
- console.log(`${indent}${muted('If you expected an existing account, run gipity status, then gipity login again with the correct email.')}`);
55
+ log(`${indent}${muted('If you expected an existing account, run gipity status, then gipity login again with the correct email.')}`);
54
56
  }
55
57
  /** Prompt for email + 6-digit code, persist the tokens, and return the new
56
58
  * auth. Exits the process on empty input or a bad token (the caller can't
package/dist/net.js CHANGED
@@ -56,7 +56,8 @@ export function describeFetchError(err, input, proxyActive, env = process.env) {
56
56
  let protocol;
57
57
  try {
58
58
  const url = new URL(input instanceof Request ? input.url : String(input));
59
- origin = url.origin;
59
+ // Uploads go straight to the storage provider; users see it as Gipity Storage.
60
+ origin = /(^|\.)amazonaws\.com$/i.test(url.hostname) ? 'Gipity Storage' : url.origin;
60
61
  protocol = url.protocol;
61
62
  }
62
63
  catch { /* keep the generic name */ }
@@ -100,7 +100,7 @@ export const TTS_PROVIDERS_LIST = `elevenlabs, openai, gemini`;
100
100
  export const TTS_PROVIDER_DESCRIPTIONS = {
101
101
  'elevenlabs': `ElevenLabs (many premium voices)`,
102
102
  'openai': `OpenAI (alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer, verse)`,
103
- 'gemini': `Gemini (30 voices: Kore, Puck, Zephyr, Charon, Fenrir, Leda, Orus, Aoede, and 22 more). Multi-speaker (up to 2) and 60+ languages`,
103
+ 'gemini': `Gemini (30 voices: Kore, Puck, Zephyr, Charon, Fenrir, Leda, Orus, Aoede, and 22 more). Two-voice dialogue (speakers) and an explicit language`,
104
104
  };
105
105
  export const TTS_PROVIDER_IDS = [
106
106
  'elevenlabs',
package/dist/sync.js CHANGED
@@ -176,6 +176,7 @@ export function readBaseline(projectGuid) {
176
176
  files: parsed.files ?? {},
177
177
  lastFullSync: parsed.lastFullSync ?? null,
178
178
  ...(parsed.deletesSkippedStreak ? { deletesSkippedStreak: parsed.deletesSkippedStreak } : {}),
179
+ ...(parsed.appUploads?.length ? { appUploads: parsed.appUploads } : {}),
179
180
  };
180
181
  }
181
182
  catch {
@@ -294,9 +295,16 @@ export function resolveInRoot(root, relPath) {
294
295
  }
295
296
  return full;
296
297
  }
298
+ /** The server's sync manifest. `files` is the project's source tree. App runtime
299
+ * uploads (end-user content written through the app uploads API, e.g. images an
300
+ * external service generates into `uploads/` or any custom path) are left out
301
+ * of it by the server and named separately in `appUploads`, so sync can tell
302
+ * "an upload, not synced" apart from "deleted remotely": their absence must
303
+ * never turn into a local delete, a re-upload, or a remote delete. */
297
304
  async function fetchRemote(projectGuid) {
298
305
  const res = await get(`/projects/${projectGuid}/files/tree`);
299
306
  const out = new Map();
307
+ const appUploads = new Set((res.appUploads ?? []).map(normalizeTreePath));
300
308
  for (const f of res.data) {
301
309
  if (f.type !== 'file')
302
310
  continue;
@@ -309,7 +317,7 @@ async function fetchRemote(projectGuid) {
309
317
  modified: f.modified,
310
318
  });
311
319
  }
312
- return out;
320
+ return { files: out, appUploads };
313
321
  }
314
322
  /**
315
323
  * Extract a tar stream into a path→bytes map, guarded by an idle watchdog.
@@ -626,6 +634,23 @@ export function formatPlan(p) {
626
634
  lines.push(formatAction(a));
627
635
  return lines.join('\n');
628
636
  }
637
+ /** The one-time note for leftover local copies of app uploads (see syncInner),
638
+ * or '' when there are none. Shown only on the run that drops their baseline
639
+ * entries, so it never repeats. */
640
+ export function appUploadNote(leftLocal) {
641
+ const n = leftLocal.length;
642
+ if (!n)
643
+ return '';
644
+ const first = leftLocal[0];
645
+ const where = first.includes('/') ? `${first.split('/')[0]}/` : first;
646
+ return `${n} app upload${n === 1 ? '' : 's'} (files your app stored at runtime, e.g. in ${where}) ` +
647
+ `${n === 1 ? 'is' : 'are'} no longer synced: ${n === 1 ? 'it stays' : 'they stay'} in Gipity Storage. ` +
648
+ `The local ${n === 1 ? 'copy was' : 'copies were'} left in place and ${n === 1 ? 'is' : 'are'} safe to delete.`;
649
+ }
650
+ function withAppUploadNote(summary, leftLocal) {
651
+ const note = appUploadNote(leftLocal);
652
+ return note ? `${summary}\n${note}` : summary;
653
+ }
629
654
  async function bulkDeleteGuard(p, knownFiles, opts) {
630
655
  const totalDeletes = p.deletesLocal + p.deletesRemote;
631
656
  if (totalDeletes === 0)
@@ -702,6 +727,9 @@ export function isLocalTreeClean() {
702
727
  if (!baseline.lastFullSync)
703
728
  return false;
704
729
  const local = walkLocal(root, effectiveIgnore(root, config.ignore), baseline.files);
730
+ // Leftover local copies of app uploads aren't part of the synced tree.
731
+ for (const path of baseline.appUploads ?? [])
732
+ local.delete(path);
705
733
  const baselineFiles = baseline.files;
706
734
  if (local.size !== Object.keys(baselineFiles).length)
707
735
  return false;
@@ -738,7 +766,32 @@ async function syncInner(projectGuid, root, ignore, opts, interactive) {
738
766
  p?.phase('Scanning local files...');
739
767
  const local = walkLocal(root, ignore, baseline.files);
740
768
  p?.phase('Checking Gipity for changes...');
741
- const remote = await fetchRemote(projectGuid);
769
+ const { files: remote, appUploads } = await fetchRemote(projectGuid);
770
+ // App runtime uploads stay in Gipity Storage and out of the working tree. Take
771
+ // them off EVERY side before planning, so no cell of the decision table can
772
+ // act on them: a local copy (pulled by an older sync, or committed to git) is
773
+ // never uploaded, and a baseline entry for one is never read as "deleted
774
+ // remotely" (which would delete the local copy) or, once the local copy is
775
+ // gone, as "deleted locally" (which would delete the user's upload on the
776
+ // server). The baseline entry is dropped and the local file left in place.
777
+ //
778
+ // Paths known from earlier syncs stay excluded while a local copy remains,
779
+ // even once the upload is gone from the server (the app deleted it): a
780
+ // leftover copy must not be pushed back as a new source file.
781
+ const appUploadsLeftLocal = [];
782
+ const knownUploads = new Set([...appUploads, ...(baseline.appUploads ?? []).filter(p => local.has(p))]);
783
+ for (const path of knownUploads) {
784
+ if (baseline.files[path]) {
785
+ if (local.has(path))
786
+ appUploadsLeftLocal.push(path);
787
+ delete baseline.files[path];
788
+ }
789
+ local.delete(path);
790
+ }
791
+ if (knownUploads.size)
792
+ baseline.appUploads = [...knownUploads].sort();
793
+ else
794
+ delete baseline.appUploads;
742
795
  // Ignored paths are invisible on BOTH sides: filtering only the local walk
743
796
  // would classify a remote copy as "added" (pull it), then next pass as a
744
797
  // local deletion (delete it remotely) - a churn loop. Filtering remote too
@@ -767,8 +820,9 @@ async function syncInner(projectGuid, root, ignore, opts, interactive) {
767
820
  if (opts.plan) {
768
821
  return {
769
822
  plan: planned, applied: 0, skipped: 0, errors: [],
770
- summary: formatPlan(planned),
823
+ summary: withAppUploadNote(formatPlan(planned), appUploadsLeftLocal),
771
824
  deferredDeletes: 0,
825
+ appUploadsLeftLocal,
772
826
  };
773
827
  }
774
828
  // Uncertain-merge guard (armed via confirmMerge): syncing INTO a populated
@@ -801,7 +855,7 @@ async function syncInner(projectGuid, root, ignore, opts, interactive) {
801
855
  ...shape,
802
856
  `Re-run with --yes to merge, or sync into an empty folder.`,
803
857
  ].join('\n'),
804
- deferredDeletes: 0, aborted: true,
858
+ deferredDeletes: 0, aborted: true, appUploadsLeftLocal: [],
805
859
  });
806
860
  if (getAutoConfirm()) {
807
861
  // --yes: proceed with the merge; the caller reports the applied counts.
@@ -1388,8 +1442,9 @@ async function syncInner(projectGuid, root, ignore, opts, interactive) {
1388
1442
  applied,
1389
1443
  skipped: skippedByGuard,
1390
1444
  errors,
1391
- summary: formatPlan(planned),
1445
+ summary: withAppUploadNote(formatPlan(planned), appUploadsLeftLocal),
1392
1446
  deferredDeletes: skippedByGuard,
1447
+ appUploadsLeftLocal,
1393
1448
  };
1394
1449
  }
1395
1450
  /**
@@ -1439,12 +1494,14 @@ function cleanupEmptyDirs(root, emptiedDirs) {
1439
1494
  }
1440
1495
  }
1441
1496
  // ─── Single-file push (used by `gipity push <file>`) ───────────
1497
+ /** Returns false when the path is out of sync scope (ignored, a symlink, gone,
1498
+ * or a local copy of an app upload) and nothing was uploaded. */
1442
1499
  export async function pushFile(filePath) {
1443
1500
  const config = requireConfig();
1444
1501
  const root = projectDir();
1445
1502
  const rel = relative(root, filePath).replace(/\\/g, '/');
1446
1503
  if (shouldIgnore(rel, effectiveIgnore(root, config.ignore)))
1447
- return;
1504
+ return false;
1448
1505
  // Skip symlinks (FIX M6b): `walkLocal` (the full-sync scanner) ignores symlink
1449
1506
  // dirents, so if the push path followed a link and uploaded it, the next full
1450
1507
  // sync would see a remote path with no local counterpart and plan delete-remote
@@ -1452,10 +1509,10 @@ export async function pushFile(filePath) {
1452
1509
  // scope. lstat (not stat) so we inspect the link itself, not its target.
1453
1510
  try {
1454
1511
  if (lstatSync(filePath).isSymbolicLink())
1455
- return;
1512
+ return false;
1456
1513
  }
1457
1514
  catch {
1458
- return; /* gone/unreadable - nothing to push */
1515
+ return false; /* gone/unreadable - nothing to push */
1459
1516
  }
1460
1517
  // Serialize against `gipity sync` and other concurrent pushes by holding the
1461
1518
  // same per-project lock `sync()` uses. Both paths read-modify-write the shared
@@ -1468,6 +1525,10 @@ export async function pushFile(filePath) {
1468
1525
  const releaseLock = await acquireLock();
1469
1526
  try {
1470
1527
  const baseline = readBaseline(config.projectGuid);
1528
+ // A leftover local copy of an app upload is not source: never push it back
1529
+ // over the user's upload (same rule as the full sync).
1530
+ if (baseline.appUploads?.includes(rel))
1531
+ return false;
1471
1532
  const baseEntry = baseline.files[rel];
1472
1533
  const result = await uploadOneFile(config.projectGuid, filePath, rel, {
1473
1534
  expectedServerVersion: baseEntry ? baseEntry.serverVersion : null,
@@ -1479,6 +1540,7 @@ export async function pushFile(filePath) {
1479
1540
  sha256, serverVersion: result.serverVersion,
1480
1541
  };
1481
1542
  writeBaseline(baseline);
1543
+ return true;
1482
1544
  }
1483
1545
  catch (err) {
1484
1546
  if (err instanceof UploadConflictError) {
package/dist/upload.js CHANGED
@@ -90,7 +90,12 @@ async function withRetry(label, fn, attempts = 3) {
90
90
  break;
91
91
  const delay = 500 * Math.pow(2, i);
92
92
  await new Promise(r => setTimeout(r, delay));
93
- console.error(`[upload] ${label} attempt ${i + 1} failed, retrying in ${delay}ms: ${err.message}`);
93
+ // The first failure is usually a pooled connection the storage host had
94
+ // already closed (ECONNRESET on the first PUT after a pause), and the retry
95
+ // succeeds. Printing it made agents and reviewers treat a healthy upload as
96
+ // a network fault, so only a second failure is reported.
97
+ if (i > 0)
98
+ console.error(`[upload] ${label} attempt ${i + 1} failed, retrying in ${delay}ms: ${err.message}`);
94
99
  }
95
100
  }
96
101
  throw lastErr;
package/dist/utils.js CHANGED
@@ -76,11 +76,13 @@ export function decodeJwtExp(token) {
76
76
  * indefinitely on a closed stdin, hanging the dispatch until the web
77
77
  * CLI's 8-second latch gives up. Turning that into a loud error lets
78
78
  * the daemon ack the dispatch cleanly and surface a real message. */
79
- export function prompt(question) {
79
+ /** `output` is where the question is written: stderr keeps a `--json` command's
80
+ * stdout parse-clean while it still asks interactively. */
81
+ export function prompt(question, output = process.stdout) {
80
82
  if (!process.stdin.isTTY) {
81
83
  return Promise.reject(new Error(`prompt() called without a TTY: ${question.trim()}`));
82
84
  }
83
- const rl = createInterface({ input: process.stdin, output: process.stdout });
85
+ const rl = createInterface({ input: process.stdin, output });
84
86
  return new Promise(resolve => {
85
87
  rl.question(question, answer => {
86
88
  rl.close();
@@ -106,7 +108,7 @@ export function setAutoConfirm(val) { _autoConfirm = val; }
106
108
  export function getAutoConfirm() { return _autoConfirm; }
107
109
  /** Reconstruct the current invocation with `--yes` appended, for self-correcting
108
110
  * non-interactive confirmation hints. Shell-quotes args that need it. */
109
- function rerunWithYes() {
111
+ export function rerunWithYes() {
110
112
  const args = process.argv.slice(2);
111
113
  if (!args.some(a => a === '--yes' || a === '-y'))
112
114
  args.push('--yes');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gipity",
3
- "version": "1.1.23",
3
+ "version": "1.1.25",
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-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__/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-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",
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",