gipity 1.0.245 → 1.0.264

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.
Files changed (49) hide show
  1. package/README.md +1 -1
  2. package/dist/__tests__/relay-daemon.test.js +6 -2
  3. package/dist/__tests__/relay-daemon.test.js.map +1 -1
  4. package/dist/__tests__/relay-ingest-contract.test.d.ts +1 -0
  5. package/dist/__tests__/relay-ingest-contract.test.js +76 -0
  6. package/dist/__tests__/relay-ingest-contract.test.js.map +1 -0
  7. package/dist/__tests__/relay-installers.test.js +34 -8
  8. package/dist/__tests__/relay-installers.test.js.map +1 -1
  9. package/dist/__tests__/stream-json.test.d.ts +1 -0
  10. package/dist/__tests__/stream-json.test.js +186 -0
  11. package/dist/__tests__/stream-json.test.js.map +1 -0
  12. package/dist/commands/claude.js +81 -43
  13. package/dist/commands/claude.js.map +1 -1
  14. package/dist/commands/page-inspect.d.ts +2 -0
  15. package/dist/commands/page-inspect.js +84 -0
  16. package/dist/commands/page-inspect.js.map +1 -0
  17. package/dist/commands/relay-install.js +29 -14
  18. package/dist/commands/relay-install.js.map +1 -1
  19. package/dist/commands/relay.js +18 -18
  20. package/dist/commands/relay.js.map +1 -1
  21. package/dist/commands/sandbox.js +57 -6
  22. package/dist/commands/sandbox.js.map +1 -1
  23. package/dist/commands/skills.js +8 -0
  24. package/dist/commands/skills.js.map +1 -1
  25. package/dist/commands/uninstall.js +11 -7
  26. package/dist/commands/uninstall.js.map +1 -1
  27. package/dist/index.js +2 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/prompts.d.ts +28 -9
  30. package/dist/prompts.js +82 -220
  31. package/dist/prompts.js.map +1 -1
  32. package/dist/relay/daemon.d.ts +30 -6
  33. package/dist/relay/daemon.js +449 -51
  34. package/dist/relay/daemon.js.map +1 -1
  35. package/dist/relay/installers.d.ts +9 -3
  36. package/dist/relay/installers.js +56 -16
  37. package/dist/relay/installers.js.map +1 -1
  38. package/dist/relay/onboarding.js +11 -2
  39. package/dist/relay/onboarding.js.map +1 -1
  40. package/dist/relay/stream-json.d.ts +105 -0
  41. package/dist/relay/stream-json.js +158 -0
  42. package/dist/relay/stream-json.js.map +1 -0
  43. package/dist/relay/transcripts.d.ts +60 -0
  44. package/dist/relay/transcripts.js +119 -0
  45. package/dist/relay/transcripts.js.map +1 -0
  46. package/dist/setup.d.ts +0 -28
  47. package/dist/setup.js +11 -42
  48. package/dist/setup.js.map +1 -1
  49. package/package.json +2 -2
package/dist/prompts.js CHANGED
@@ -13,11 +13,11 @@
13
13
  * - Section headings are `## `, lists are `-` or `1.`.
14
14
  */
15
15
  export const SCAFFOLD_TYPES = [
16
- { key: 'web-simple', for: 'Static page, canvas demo, visualization, physics toy, landing page, dashboard, single-page tool' },
17
- { key: 'web-fullstack', for: 'Frontend + backendneeds DB or serverless functions' },
18
- { key: '2d-game', for: 'Phaser platformer / arcade / puzzle / endless runner' },
19
- { key: '3d-world', for: 'Three.js + Rapier + Colyseus multiplayer world' },
20
- { key: 'api', for: 'API only, no frontend' },
16
+ { key: 'web-simple', for: 'Landing page, dashboard, calculator, canvas demo, visualization, animation, single-page tool' },
17
+ { key: 'web-fullstack', for: 'Web app with login, database, or API CRM, invoice tracker, booking system, admin panel' },
18
+ { key: '2d-game', for: 'Platformer, arcade, puzzle, endless runner, physics toy (Phaser 3)' },
19
+ { key: '3d-world', for: 'Multiplayer world, 3D sandbox, shooter, exploration, virtual showroom (Three.js + Rapier + Colyseus)' },
20
+ { key: 'api', for: 'Backend service, webhook, data pipeline, chatbot, cron job — no frontend' },
21
21
  ];
22
22
  export const SCAFFOLD_TYPE_KEYS = SCAFFOLD_TYPES.map(t => t.key).join('|');
23
23
  export const SCAFFOLD_TYPE_PICKER = SCAFFOLD_TYPES
@@ -27,44 +27,60 @@ export const SCAFFOLD_TYPE_PICKER = SCAFFOLD_TYPES
27
27
  // Single source of truth for the build-vs-non-build rule.
28
28
  // ---------------------------------------------------------------------------
29
29
  export const BUILD_VS_NON_BUILD_RULE = [
30
- `## Build vs. one-off`,
31
- `Build request (deployable web app, game, API): run \`gipity scaffold --type <type>\` before writing any files. Scaffolding wires up \`gipity.yaml\`, deploy config, and sync; hand-written files miss all of it. Pick the type:`,
30
+ `## When to scaffold`,
31
+ `If the user wants a deployable app (web, game, API): run \`gipity scaffold --type <type>\` before writing any files. Scaffolding wires up \`gipity.yaml\`, deploy config, and sync; hand-written files miss all of it.`,
32
+ `If it's a one-off task (analysis, media, data, research): skip scaffolding — use \`gipity sandbox run\` or work with files directly.`,
33
+ `If ambiguous: ask one short clarifying question.`,
34
+ ``,
35
+ `Scaffold types:`,
32
36
  SCAFFOLD_TYPE_PICKER,
33
37
  `When unsure, default to \`web-simple\`. After scaffolding, edit the generated files, then \`gipity deploy dev\`.`,
34
- ``,
35
- `One-off task (PDF analysis, data exploration, media/document work, research, scratch): do not scaffold. Use \`gipity sandbox run\` for compute, or work with files directly.`,
36
- ``,
37
- `If ambiguous, ask one short clarifying question. Only skip scaffolding on a build request if the user explicitly says "don't scaffold".`,
38
+ `Only skip scaffolding on a build request if the user explicitly says "don't scaffold".`,
38
39
  ].join('\n');
39
40
  export const DEFINITION_OF_DONE = [
40
41
  `## Definition of done (build tasks)`,
41
42
  `1. \`gipity deploy dev\` succeeds and you have a live URL.`,
42
- `2. \`gipity browser <url>\` shows no console errors and the golden path works.`,
43
+ `2. \`gipity page-inspect <url>\` returns no console errors and the page loads (HTTP 200, no blank screen).`,
43
44
  `3. For apps with functions: \`gipity test\` passes.`,
44
45
  `4. You told the user the live URL.`,
45
46
  ``,
46
47
  `If any step fails, fix it before claiming done — do not report success on a broken deploy.`,
47
48
  ].join('\n');
48
- export const CAPABILITIES_BLURB_SHORT = `Gipity gives this session: cloud hosting, Postgres, serverless functions, a sandboxed toolkit ` +
49
- `(ffmpeg, ImageMagick, pandas, pandoc, LibreOffice, etc.), headless browsers, file storage, email, ` +
50
- `image/TTS/video generation, web search, scheduled workflows, persistent memory, custom domains. ` +
51
- `Full reference is in CLAUDE.md. Prefer CLI commands and the sandbox over \`gipity chat\` — they're ` +
52
- `faster and don't burn LLM tokens. Naming: honor the user's chosen name; if inventing, blend "Gip" or "Gipity" in.`;
49
+ export const CAPABILITIES_BLURB_SHORT = `Full platform reference is in CLAUDE.md. ` +
50
+ `Prefer CLI commands and the sandbox over \`gipity chat\` they're faster and cheaper. ` +
51
+ `Naming: honor the user's chosen name; if inventing, blend "Gip" or "Gipity" in.`;
52
+ function humanBytes(n) {
53
+ if (n < 1024)
54
+ return `${n} B`;
55
+ if (n < 1024 * 1024)
56
+ return `${(n / 1024).toFixed(1)} KB`;
57
+ if (n < 1024 * 1024 * 1024)
58
+ return `${(n / 1024 / 1024).toFixed(1)} MB`;
59
+ return `${(n / 1024 / 1024 / 1024).toFixed(2)} GB`;
60
+ }
53
61
  function buildHeader(opts) {
54
62
  const deployUrl = opts.accountSlug
55
63
  ? `https://dev.gipity.ai/${opts.accountSlug}/${opts.projectSlug}/`
56
64
  : '(not yet deployed)';
57
- const entryLabel = opts.fileCount === 1 ? 'entry' : 'entries';
65
+ // "Files" line is the agent's at-a-glance signal of project size and
66
+ // shape. Counts are recursive (from the VFS DB), not just top-level —
67
+ // prevents the bug where a scaffolded project with everything under
68
+ // `src/` showed as "1 top-level entry (src/)" and looked nearly empty.
69
+ const filesLine = opts.fileCount === 0
70
+ ? `- Files: empty (no files yet)`
71
+ : `- Files: ${opts.fileCount} file${opts.fileCount === 1 ? '' : 's'}` +
72
+ ` in ${opts.folderCount} folder${opts.folderCount === 1 ? '' : 's'}` +
73
+ ` (${humanBytes(opts.totalBytes)}) — ${opts.topLevel}`;
58
74
  return [
59
75
  `## Gipity project`,
60
76
  `- Name: ${opts.projectName} (slug: \`${opts.projectSlug}\`)`,
61
- `- GUID: \`${opts.projectGuid}\` use as \`<PROJECT_GUID>\` in App Services calls`,
77
+ `- Project GUID: \`${opts.projectGuid}\` (use as \`<PROJECT_GUID>\` in service calls)`,
62
78
  `- Directory: ${opts.cwd}`,
63
79
  `- Deploy URL: ${deployUrl}`,
64
- `- Files: ${opts.fileCount} top-level ${entryLabel}${opts.fileCount > 0 ? ` (${opts.contents})` : ''}`,
80
+ filesLine,
65
81
  ].join('\n');
66
82
  }
67
- const EMPTY_STATE_NOTE = `Directory is empty. Apply the build-vs-one-off rule above before writing any files.`;
83
+ const EMPTY_STATE_NOTE = `Directory is empty. Apply the scaffolding rule above before writing any files.`;
68
84
  const EXISTING_STATE_NOTE = [
69
85
  `Project already has files. Before making changes:`,
70
86
  `- Read \`README.md\` / \`gipity.yaml\` if present to understand what's here.`,
@@ -72,7 +88,13 @@ const EXISTING_STATE_NOTE = [
72
88
  `- Edit in place. Don't re-scaffold over an existing app.`,
73
89
  `- Exception: if the existing files are user content (media, data, notes) and the user wants to build an app around them, scaffolding is allowed — \`gipity scaffold\` will refuse automatically if any file paths would collide.`,
74
90
  ].join('\n');
75
- /** Compact project-context preamble — header + capabilities + build rule + state note + definition of done. */
91
+ /** Compact project-context preamble — header + capabilities + state note + definition of done.
92
+ * The BUILD_VS_NON_BUILD_RULE (scaffold picker, scaffold types, default
93
+ * recommendations) only fires for empty projects. An existing project
94
+ * that already has a scaffold doesn't need to be told to pick a scaffold
95
+ * type — that guidance conflicts with EXISTING_STATE_NOTE's "edit in
96
+ * place, don't re-scaffold" and led to agents re-scaffolding over live
97
+ * projects. */
76
98
  export function buildProjectContextBlock(opts) {
77
99
  const isEmpty = opts.fileCount === 0;
78
100
  return [
@@ -81,12 +103,12 @@ export function buildProjectContextBlock(opts) {
81
103
  `## Session`,
82
104
  `You're pairing with the user on this project. ${CAPABILITIES_BLURB_SHORT}`,
83
105
  ``,
84
- BUILD_VS_NON_BUILD_RULE,
106
+ isEmpty ? BUILD_VS_NON_BUILD_RULE : EXISTING_STATE_NOTE,
85
107
  ``,
86
- isEmpty ? EMPTY_STATE_NOTE : EXISTING_STATE_NOTE,
108
+ isEmpty ? EMPTY_STATE_NOTE : '',
87
109
  ``,
88
110
  DEFINITION_OF_DONE,
89
- ].join('\n');
111
+ ].join('\n').replace(/\n{3,}/g, '\n\n');
90
112
  }
91
113
  /** Project-context block + a brief greeting instruction. */
92
114
  export function buildExistingProjectPrompt(opts) {
@@ -100,7 +122,7 @@ export function buildExistingProjectPrompt(opts) {
100
122
  export function buildNewProjectPrompt(opts) {
101
123
  const base = buildProjectContextBlock(opts);
102
124
  if (opts.buildIdea) {
103
- return `${base}\n\nThe user's first message: "${opts.buildIdea}"\n\nGet started. Apply the build-vs-one-off rule. Report back when you hit the definition of done.`;
125
+ return `${base}\n\nThe user's first message: "${opts.buildIdea}"\n\nGet started. Apply the scaffolding rule. Report back when you hit the definition of done.`;
104
126
  }
105
127
  return `${base}\n\nThe user started a blank project with no specific request. Briefly introduce yourself, highlight a few key capabilities, and ask what they want to build.`;
106
128
  }
@@ -109,20 +131,20 @@ export function buildNewProjectPrompt(opts) {
109
131
  // ---------------------------------------------------------------------------
110
132
  /** Compact capability reminder — safe to include on every resumed-session message.
111
133
  * Hedges against Claude compacting away the original context block mid-session. */
112
- export const PLATFORM_REMINDER = `This project runs on the Gipity hosting platform. The \`gipity\` CLI exposes 90+ tools common ones: ` +
113
- `\`gipity deploy dev\`, \`gipity browser <url>\`, \`gipity sandbox run\`, \`gipity test\`, \`gipity fn call\`. ` +
114
- `Run \`gipity skills list\` for the full skill catalog; full platform reference is in \`CLAUDE.md\`.`;
115
- /** Resume wrap: header + capability reminder + short framing. */
134
+ export const PLATFORM_REMINDER = `This project runs on the Gipity platform. All CLI commands and service APIs are documented in CLAUDE.md.`;
135
+ /** Resume wrap: compact header + capability reminder + short framing.
136
+ * Takes identity only resume doesn't need the full file stats
137
+ * (Claude already has the context from the initial start dispatch). */
116
138
  export function buildResumeWrap(opts, userMsg) {
139
+ const deployUrl = opts.accountSlug
140
+ ? `https://dev.gipity.ai/${opts.accountSlug}/${opts.projectSlug}/`
141
+ : '(not yet deployed)';
117
142
  return [
118
- buildHeader(opts),
119
- ``,
143
+ `Project: ${opts.projectName} (\`${opts.projectGuid}\`) — ${deployUrl}`,
120
144
  PLATFORM_REMINDER,
121
- `Resumed session — apply the build-vs-one-off rule for new features; files auto-sync on save.`,
145
+ `Resumed session — scaffold before building (see CLAUDE.md); skip for one-off tasks.`,
122
146
  ``,
123
147
  `User message: ${userMsg}`,
124
- ``,
125
- `Answer directly. Do not greet or reintroduce yourself.`,
126
148
  ].join('\n');
127
149
  }
128
150
  /** Fresh wrap: full project context + the user's message. */
@@ -143,208 +165,48 @@ export const SKILLS_CONTENT = `# Gipity Integration
143
165
 
144
166
  Gipity is a platform for cloud agents — AI agents that run on a server with persistent memory, storage, a database, a sandboxed runtime, and direct internet access. Gip is the cloud agent on Gipity.
145
167
 
146
- This Claude Code session is connected to a Gipity project. You have four ways to use the platform try them in this order before falling back to \`gipity chat\`:
147
-
148
- 1. CLI commands (fast, no agent overhead). The \`gipity\` CLI exposes ~30 commands covering scaffold/deploy/db/fn/logs/browser/sync/memory/skills/etc. Use these whenever possible.
149
- 2. Cloud sandbox via \`gipity sandbox run\` (fast, no agent overhead, no deploy needed). The sandbox is a Docker container with a huge pre-installed toolkit — use it for any one-off media, data, or build task instead of delegating to Gip:
150
- - Media: \`ffmpeg\` (transcode, trim, concat, extract audio, generate thumbnails, splice video), \`ImageMagick\` (resize, convert, composite, OCR-friendly preprocess), \`sox\` (audio mix/normalize/effects), \`exiftool\`, \`mediainfo\`, \`optipng\`, \`gifsicle\`, \`webp\`, \`potrace\` (raster→SVG)
151
- - Documents: \`pandoc\` (any-to-any docs), \`LibreOffice\` headless (DOCX/XLSX/PPTX↔PDF), \`wkhtmltopdf\`, \`poppler-utils\` (PDF text/image extract), \`ghostscript\`, \`qpdf\`, \`python-docx\`, \`python-pptx\`, \`openpyxl\`, \`reportlab\`, \`cairosvg\`
152
- - Data / analysis: Python with \`pandas\`, \`numpy\`, \`scipy\`, \`sympy\`, \`matplotlib\`, \`seaborn\`, \`pillow\`, \`bs4\`, \`requests\`, \`pyyaml\`, \`jinja2\`, \`tabulate\`, plus \`csvkit\`, \`miller\`, \`datamash\`, \`jq\`, \`xmlstarlet\`, \`sqlite3\`
153
- - Misc: \`Graphviz\`, \`gnuplot\`, \`qrcode\`, \`p7zip\`, \`GCC/G++\`, \`Rust\` (rustc/cargo), \`mingw-w64\` (Windows cross-compile)
154
- - Languages: Node 20, Python 3, Bash. Workspace files are auto-injected; output files auto-extract back to the project. Sticky session per user (state persists across calls). No network from inside the sandbox — fetch what you need before sending it in.
168
+ This Claude Code session is connected to a Gipity project. Prefer the cheapest option that works CLI and sandbox are instant and free, app services are runtime HTTP calls, \`gipity chat\` burns LLM tokens:
155
169
 
156
- Examples:
157
- \`\`\`bash
158
- gipity sandbox run --lang bash "ffmpeg -i input.mp4 -vf scale=640:-1 -c:a copy out.mp4"
159
- gipity sandbox run --lang bash "convert input.png -resize 200x200 thumb.jpg" # ImageMagick
160
- gipity sandbox run --lang py "import pandas as pd; print(pd.read_csv('sales.csv').groupby('region').total.sum())"
161
- gipity sandbox run --lang bash "libreoffice --headless --convert-to pdf report.docx"
162
- gipity sandbox run --lang bash "pandoc article.md -o article.pdf"
163
- \`\`\`
164
- 3. Call app services directly from your app (no agent overhead, runtime endpoints). LLM, TTS, image, sound, music, transcription, video, file upload, and realtime multiplayer are HTTP endpoints under \`https://a.gipity.ai/api/<PROJECT_GUID>/services/*\` — see the app services section below. These are for the deployed app to call at runtime; for one-off generation during development, prefer \`gipity generate <image|video|...>\` or \`gipity chat\`.
165
- 4. Delegate to Gip (\`gipity chat "<task>"\`) — only when the work genuinely needs agent reasoning or a tool that isn't in the CLI, the sandbox, or the app services. Required for: Twitter/X search, Gmail, calendar operations, push notifications, video understanding, audio source isolation, cross-model second opinions, multi-step orchestration. Don't use \`gipity chat\` to run ffmpeg, ImageMagick, pandas, LibreOffice, pandoc, or anything else listed in the sandbox toolkit above — \`gipity sandbox run\` is faster and doesn't burn tokens.
170
+ 1. CLI commands (fast, no agent overhead). The \`gipity\` CLI covers scaffold, deploy, db, fn, logs, browser, sync, memory, skills, and more. Run \`gipity --help\` for the full list. All commands support \`--json\`.
171
+ 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 skills read sandbox-tools\` for the full toolkit. No network from inside the sandbox — fetch what you need before sending it in.
172
+ 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. 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|...>\` or \`gipity chat\`.
173
+ 4. Delegate to Gip (\`gipity chat "<task>"\`) — only when the work genuinely needs agent reasoning or a tool not in the CLI, sandbox, or app services. Required for: Twitter/X search, Gmail, calendar, push notifications, video understanding, audio source isolation, cross-model second opinions, multi-step orchestration. Don't use \`gipity chat\` for anything the sandbox can do — it's slower and burns tokens.
166
174
 
167
175
  You are the developer. Write files in this directory — they auto-sync to Gipity via hooks. Don't run \`npm install\`, \`npm start\`, \`node\`, or \`python\` locally; there is no local runtime. Code runs in the Gipity sandbox.
168
176
 
169
- ## Build vs. one-off
170
-
171
- The full build-vs-one-off rule and definition of done are injected at the top of every session context. In short: if the user asks you to build something deployable (web app, game, API), run \`gipity scaffold --type <type>\` first (default \`web-simple\`); if it's a one-off task (analysis, PDFs, data work), use \`gipity sandbox run\` — do not scaffold.
172
-
173
- ## Remote control
174
-
175
- This session can be driven from the Gipity web CLI on any browser (desktop or phone). The first \`gipity claude\` run on this machine pairs the device and starts the relay daemon automatically. Once paired, typing \`/claude\` (or \`/cc\`) in the web CLI enters dispatch mode; each message queues a new \`gipity claude -p "…"\` session here and streams the captured conversation back to their browser. If the user asks how to use Gipity from their phone or another browser, point them at \`gipity relay --help\`.
176
-
177
- ## Workflow
178
-
179
- 1. Write and edit files normally (auto-pushed to Gipity on every save)
180
- 2. \`gipity deploy dev\` → live URL instantly
181
- 3. \`gipity deploy prod\` when ready
182
-
183
- ## CLI commands
184
-
185
- | Command | Purpose |
186
- |---------|---------|
187
- | \`gipity scaffold [title]\` | Create app structure. \`--type\` is required. Canonical types: \`${SCAFFOLD_TYPE_KEYS}\`. Run \`gipity scaffold --help\` for the full list. |
188
- | \`gipity deploy [dev\\|prod]\` | Deploy and get live URL |
189
- | \`gipity sync [up\\|down\\|check]\` | Manual file sync |
190
- | \`gipity db create <name>\` | Create a project database |
191
- | \`gipity db drop <name> [--project <slug>]\` | Drop a database (--project for cross-project) |
192
- | \`gipity db query "SQL"\` | Run SQL on project database |
193
- | \`gipity db list [--all]\` | List databases (--all for account-wide) |
194
- | \`gipity fn list\\|call <name> [body]\\|logs <name>\` | Manage serverless functions |
195
- | \`gipity memory list\\|read\\|write\` | Persistent key-value memory |
196
- | \`gipity browser <url>\` | Inspect URL: console errors, timing, resources |
197
- | \`gipity logs fn <name>\` | View function execution logs |
198
- | \`gipity sandbox <lang> "code"\` | Execute code in cloud sandbox |
199
- | \`gipity location [ip\\|lat lng]\` | IP geo / reverse-geocode / caller location |
200
- | \`gipity chat <message>\` | Send a task to the Gipity agent |
201
- | \`gipity skills list\` | List all available skill docs |
202
- | \`gipity skills read <name>\` | Read detailed docs on a topic |
203
- | \`gipity status\` | Check project and auth status (project GUID, slug, auth state) |
204
-
205
- All commands support \`--json\` for structured output. Use \`--help\` on any command for details (auto-fetches relevant skill docs from the server).
177
+ ## When to scaffold
206
178
 
207
- ## Platform capabilities
179
+ The full scaffolding rule and definition of done are injected at the top of every session context. In short: if the user asks you to build something deployable (web app, game, API), run \`gipity scaffold --type <type>\` first (default \`web-simple\`); if it's a one-off task (analysis, PDFs, data work), use \`gipity sandbox run\` — do not scaffold.
208
180
 
209
- - App hosting — deploy to dev/prod URLs on Gipity CDN
210
- - Databases — per-project PostgreSQL databases with SQL access
211
- - Serverless functions — JavaScript functions callable via REST
212
- - Multiplayer — Colyseus WebSocket rooms (relay and state-synced)
213
- - Image generation — OpenAI (gpt-image-1, DALL-E 3) and BFL/Flux
214
- - Speech / TTS — ElevenLabs and OpenAI voices
215
- - Audio/video processing — FFmpeg, sox, transcription, source isolation
216
- - Web search — Brave API
217
- - Browser automation — open URLs, screenshot, click, fill forms, console
218
- - Workflows — cron or webhook-triggered multi-step AI pipelines
219
- - Email — SendGrid transactional email
220
- - Cloud sandbox — Python, Node.js, Bash with 50+ pre-installed tools
221
- - Cross-model queries — ask GPT-5, Claude, etc. for second opinions
181
+ ## CLI quick reference
222
182
 
223
- ## App services (HTTP endpoints your deployed app can call)
183
+ Key commands: \`gipity scaffold --type <type>\`, \`gipity deploy dev\`, \`gipity sandbox run\`, \`gipity page-inspect <url>\`, \`gipity db query "SQL"\`, \`gipity fn call <name>\`, \`gipity skills read <name>\`.
184
+ Run \`gipity --help\` for the full list. Use \`--help\` on any command for details.
224
185
 
225
- Every project automatically exposes platform services at \`https://a.gipity.ai/api/<PROJECT_GUID>/services/*\`. Your frontend or function calls these directly — don't write a server-side wrapper function for them, and don't fall back to browser APIs (e.g. \`window.speechSynthesis\`). Billing defaults to your credits (\`owner_pays\`); no setup needed.
186
+ ## Files and sync
226
187
 
227
- Your \`<PROJECT_GUID>\` is printed in the session context header on every launch, and also via \`gipity status --json\`.
188
+ Write files locally hooks auto-push to Gipity on every save. Remote-generated files (images, audio from \`gipity chat\`) auto-pull. Use \`gipity sync\` if things get out of sync. Deletes are safe — use \`rollback\` with a datetime to undo, or \`file_version_restore\` for individual files.
228
189
 
229
- | Service | Endpoint | Purpose |
230
- |---------|----------|---------|
231
- | LLM | \`POST /services/llm\` | OpenAI-style chat completions (Anthropic + OpenAI models, streaming) |
232
- | TTS | \`POST /services/tts\` | Text-to-speech → MP3 URL (ElevenLabs/OpenAI/Gemini) |
233
- | Image | \`POST /services/image\` | Image generation (OpenAI/BFL/Gemini) |
234
- | Sound effects | \`POST /services/sound\` | ElevenLabs SFX from text |
235
- | Music | \`POST /services/music\` | ElevenLabs music from prompt |
236
- | Transcribe (STT) | \`POST /services/transcribe\` | Multipart audio → text |
237
- | Video | \`POST /services/video\` | Veo 3.1 video with audio |
238
- | Files | \`POST /uploads/init\` + \`/uploads/complete\` | Presigned S3 uploads up to 30 GB |
239
- | Realtime | \`wss://rt.gipity.ai\` | Colyseus rooms (relay or state) |
190
+ ## Skills (detailed documentation)
240
191
 
241
- ### Universal authmint an app token
192
+ Run \`gipity skills list\` to see all available skill docs. Run \`gipity skills read <name>\` to read one. Load the relevant skill before starting a task they contain the correct API patterns, code examples, and common mistakes.
242
193
 
243
- \`\`\`js
244
- const r = await fetch('https://a.gipity.ai/api/token', { // must be absolute URL, POST
245
- method: 'POST',
246
- headers: { 'Content-Type': 'application/json' },
247
- body: JSON.stringify({ app: '<PROJECT_GUID>' })
248
- });
249
- const { data: { token } } = await r.json(); // token is at .data.token
250
- \`\`\`
251
- Send on every service call as \`X-App-Token: <token>\`. For \`auth: user\` functions or \`user_pays\` services also pass \`credentials: 'include'\` so the \`.gipity.ai\` session cookie travels.
252
-
253
- Common mistakes the agent should avoid:
254
- - Relative URL \`/api/token\` (hits app host, 404) — always absolute \`https://a.gipity.ai/api/token\`
255
- - Reading \`json.token\` instead of \`json.data.token\`
256
- - Treating the project GUID as the bearer token
257
- - Writing a server-side TTS \`speak\` function or a \`useBrowserTts\` fallback — just call \`/services/tts\` from the browser and \`new Audio(url).play()\`
258
- - Calling \`client.getAvailableRooms()\` for realtime — that method doesn't exist; use \`GET https://rt.gipity.ai/rooms?room=<name>&token=<t>\`
259
-
260
- ### Quick examples
261
-
262
- LLM:
263
- \`\`\`js
264
- const r = await fetch(\`https://a.gipity.ai/api/\${APP}/services/llm\`, {
265
- method: 'POST',
266
- headers: { 'Content-Type': 'application/json', 'X-App-Token': token },
267
- body: JSON.stringify({ messages: [{ role: 'user', content: 'Hi' }], model: 'gpt-5-mini' })
268
- });
269
- const { choices } = await r.json();
270
- // choices[0].message.content
271
- \`\`\`
272
-
273
- TTS:
274
- \`\`\`js
275
- const r = await fetch(\`https://a.gipity.ai/api/\${APP}/services/tts\`, {
276
- method: 'POST',
277
- headers: { 'Content-Type': 'application/json', 'X-App-Token': token },
278
- body: JSON.stringify({ text: 'Hello world', provider: 'elevenlabs' })
279
- });
280
- const { url } = await r.json();
281
- new Audio(url).play();
282
- \`\`\`
283
-
284
- Transcribe:
285
- \`\`\`js
286
- const fd = new FormData();
287
- fd.append('audio', file); // mp3/wav/m4a, up to 100MB
288
- fd.append('diarize', 'true'); // optional
289
- const r = await fetch(\`https://a.gipity.ai/api/\${APP}/services/transcribe\`, {
290
- method: 'POST',
291
- headers: { 'X-App-Token': token }, // do not set Content-Type for FormData
292
- body: fd
293
- });
294
- const { text } = await r.json();
295
- \`\`\`
296
-
297
- File upload (helper script handles progress + multipart for 5GB+ files):
298
- \`\`\`html
299
- <script src="https://media.gipity.ai/scripts/gipity-upload.js"></script>
300
- <script>
301
- const result = await Gipity.upload(file, { appGuid: '<PROJECT_GUID>', appToken: token });
302
- // result.url, result.guid
303
- </script>
304
- \`\`\`
305
-
306
- For full request/response schemas, parameters, error codes, and edge cases (streaming, image input, multi-speaker TTS, Veo aspect ratios, multipart uploads, popup auth flow, Colyseus room safety patterns), load the matching skill before writing code.
307
-
308
- ## Detailed documentation
309
-
310
- Run \`gipity skills list\` to see all available skill docs. Run \`gipity skills read <name>\` to read one.
311
-
312
- App services skills (load before calling \`/services/*\` endpoints — they contain the canonical request/response schemas, examples, and common-mistake guards):
313
-
314
- - \`app-llm\` — \`/services/llm\` (chat completions, streaming, image input, model list)
315
- - \`app-tts\` — \`/services/tts\` (voices, multi-speaker Gemini, languages)
316
- - \`app-image\` — \`/services/image\` (providers, sizes, aspect ratios)
317
- - \`app-audio\` — \`/services/sound\`, \`/services/music\`, \`/services/transcribe\`
318
- - \`app-video\` — \`/services/video\` (Veo models, aspect, resolution)
319
- - \`app-files\` — \`/uploads/init\`+\`/uploads/complete\`, \`gipity-upload.js\` helper, variants, file listing
320
- - \`app-auth\` — sign in with Gipity, popup vs redirect, \`auth/status\`, error codes
321
- - \`app-realtime\` — Colyseus rooms (relay vs state), \`MapSchema\` init guard, room discovery
194
+ App services skills (load before calling \`/services/*\` endpoints):
195
+ - \`app-llm\` chat completions, streaming, image input
196
+ - \`app-tts\` — voices, multi-speaker, languages
197
+ - \`app-image\` providers, sizes, aspect ratios
198
+ - \`app-audio\` sound effects, music, transcription
199
+ - \`app-video\` — Veo models, aspect, resolution
200
+ - \`app-files\` uploads, variants, file listing
201
+ - \`app-auth\` — sign in with Gipity, popup vs redirect
202
+ - \`app-realtime\` Colyseus rooms, relay vs state
322
203
 
323
204
  Other key skills:
324
-
325
205
  - \`web-app-basics\` — coding guidelines, file structure, HTML/CSS/JS patterns
326
- - \`app-development\` — functions, database & API (write functions → deploy → test → call via REST)
206
+ - \`app-development\` — functions, database and API
327
207
  - \`3d-world\` — 3D multiplayer game template (Three.js + Rapier + Colyseus)
328
208
  - \`2d-game\` — 2D game template (Phaser 3)
329
209
  - \`sandbox-tools\` — cloud sandbox capabilities and pre-installed tools
330
- - \`tts-guide\` — agent-side speech tools (\`speech_generate\`, \`voice_set\`, sound/music) — different from the \`app-tts\` HTTP service
331
-
332
- Load the relevant skill before starting a task — they contain the correct API patterns, code examples, and common mistakes.
333
-
334
- ## File operations
335
-
336
- All file creation and editing should happen locally — hooks auto-push changes to Gipity. Don't use \`gipity chat\` to create or edit files. Use \`gipity sync\` if files get out of sync. Files generated remotely by \`gipity chat\` (images, audio, etc.) also sync down automatically and can be referenced in your code like any local file.
337
-
338
- ## Authentication
339
-
340
- 1. \`gipity login --email user@example.com\` → sends a 6-digit code
341
- 2. \`gipity login --email user@example.com --code 123456\`
342
-
343
- ## Sync behavior
344
-
345
- - Auto-push — files push to Gipity after every Write/Edit (hook)
346
- - Auto-pull — remote changes pull before each prompt (hook)
347
- - Tool-generated files sync too — images, audio, and other files created by \`gipity chat\` or remote agent tools auto-pull like any other
348
- - Deletes are safe — use \`rollback\` with a datetime to undo, or \`file_version_restore\` for individual files
210
+ - \`tts-guide\` — agent-side speech tools (different from the \`app-tts\` HTTP service)
349
211
  `;
350
212
  //# sourceMappingURL=prompts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH,MAAM,CAAC,MAAM,cAAc,GAA4B;IACrD,EAAE,GAAG,EAAE,YAAY,EAAK,GAAG,EAAE,iGAAiG,EAAE;IAChI,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,uDAAuD,EAAE;IACtF,EAAE,GAAG,EAAE,SAAS,EAAQ,GAAG,EAAE,sDAAsD,EAAE;IACrF,EAAE,GAAG,EAAE,UAAU,EAAO,GAAG,EAAE,gDAAgD,EAAE;IAC/E,EAAE,GAAG,EAAE,KAAK,EAAY,GAAG,EAAE,uBAAuB,EAAE;CAC9C,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc;KAC/C,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;KACzC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEd,8EAA8E;AAC9E,0DAA0D;AAC1D,8EAA8E;AAE9E,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,sBAAsB;IACtB,mOAAmO;IACnO,oBAAoB;IACpB,kHAAkH;IAClH,EAAE;IACF,8KAA8K;IAC9K,EAAE;IACF,yIAAyI;CAC1I,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,CAAC,MAAM,kBAAk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EAAE,OAAe;IACxE,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW;QAChC,CAAC,CAAC,yBAAyB,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,GAAG;QAClE,CAAC,CAAC,oBAAoB,CAAC;IACzB,OAAO;QACL,YAAY,IAAI,CAAC,WAAW,OAAO,IAAI,CAAC,WAAW,SAAS,SAAS,EAAE;QACvE,iBAAiB;QACjB,qFAAqF;QACrF,EAAE;QACF,iBAAiB,OAAO,EAAE;KAC3B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,cAAc,CAAC,YAAoB,EAAE,OAAe;IAClE,OAAO,GAAG,YAAY,qBAAqB,OAAO,4DAA4D,CAAC;AACjH,CAAC;AAED,8EAA8E;AAC9E,oEAAoE;AACpE,8EAA8E;AAE9E,4FAA4F;AAC5F,MAAM,CAAC,MAAM,qBAAqB,GAChC,sGAAsG;IACtG,yCAAyC,kBAAkB,4BAA4B;IACvF,0EAA0E,CAAC;AAE7E,8EAA8E;AAC9E,2EAA2E;AAC3E,8EAA8E;AAE9E,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+C7B,CAAC"}
@@ -15,9 +15,33 @@ export interface DaemonOptions {
15
15
  verbose?: boolean;
16
16
  }
17
17
  export declare function run(opts?: DaemonOptions): Promise<number>;
18
- /** Spawn `gipity claude …` in `cwd`. Inherits stdio so the child's
19
- * stream-json flows to our stdout (which launchd/systemd captures).
20
- * `GIPITY_CONVERSATION_GUID` is passed to the child so every capture
21
- * hook tags events with the right conv. Injectable via
22
- * GIPITY_RELAY_CLAUDE_CMD env for tests. */
23
- export declare function spawnGipityClaude(args: string[], cwd: string, convGuid: string): Promise<number>;
18
+ interface ClaimedDispatch {
19
+ short_guid: string;
20
+ kind: 'start' | 'resume';
21
+ remote_session_id: string | null;
22
+ message: string;
23
+ project_guid: string;
24
+ project_slug: string;
25
+ account_slug: string;
26
+ /** Server-assigned conv guid. We pass it as GIPITY_CONVERSATION_GUID
27
+ * to the spawned `gipity claude` so every capture hook tags events
28
+ * with it — no placeholder adoption needed. */
29
+ conversation_guid: string;
30
+ agent_guid: string | null;
31
+ }
32
+ export declare function getRunningDispatchGuids(): string[];
33
+ export declare function getRunningConvGuids(): string[];
34
+ /** SIGTERM any running child whose conv_guid matches, then wait for each
35
+ * to fully unwind (exit event fires, handleDispatch acks + posts
36
+ * cancelled marker). Used at the top of handleDispatch so a new message
37
+ * for a busy conv cleanly replaces the in-flight one. No-op if no child
38
+ * matches. */
39
+ export declare function killRunningForConv(convGuid: string): Promise<void>;
40
+ export declare function spawnGipityClaude(args: string[], cwd: string, d: ClaimedDispatch): Promise<{
41
+ exitCode: number;
42
+ killed: boolean;
43
+ }>;
44
+ /** SIGTERM a specific running dispatch. Returns true if one was killed,
45
+ * false if no such child was running on this daemon. */
46
+ export declare function killDispatch(shortGuid: string): boolean;
47
+ export {};