gipity 1.1.16 → 1.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -75
- package/dist/adopt-cwd.js +2 -13
- package/dist/api.js +27 -45
- package/dist/auth.js +1 -1
- package/dist/banner.js +3 -7
- package/dist/catalog.js +8 -7
- package/dist/commands/add.js +26 -9
- package/dist/commands/approval.js +1 -1
- package/dist/commands/ask.js +112 -0
- package/dist/commands/bug.js +5 -5
- package/dist/commands/build.js +10 -35
- package/dist/commands/credits.js +3 -3
- package/dist/commands/doctor.js +7 -8
- package/dist/commands/email.js +6 -56
- package/dist/commands/generate.js +12 -12
- package/dist/commands/init.js +40 -30
- package/dist/commands/key.js +1 -1
- package/dist/commands/load.js +2 -12
- package/dist/commands/logs.js +2 -2
- package/dist/commands/memory.js +5 -17
- package/dist/commands/notify.js +1 -1
- package/dist/commands/page-eval.js +55 -38
- package/dist/commands/page-inspect.js +6 -6
- package/dist/commands/page-screenshot.js +51 -54
- package/dist/commands/page-test.js +188 -14
- package/dist/commands/payments.js +2 -2
- package/dist/commands/project.js +66 -15
- package/dist/commands/realtime.js +96 -4
- package/dist/commands/records.js +4 -6
- package/dist/commands/sandbox.js +2 -3
- package/dist/commands/skill.js +50 -22
- package/dist/commands/status.js +7 -9
- package/dist/commands/test.js +2 -2
- package/dist/commands/token.js +4 -4
- package/dist/commands/workflow.js +45 -8
- package/dist/config.js +22 -6
- package/dist/flag-aliases.js +75 -18
- package/dist/help-skills.js +2 -2
- package/dist/hooks/capture-runner.js +5 -3
- package/dist/index.js +1631 -1517
- package/dist/knowledge.js +24 -21
- package/dist/login-flow.js +4 -4
- package/dist/net.js +91 -0
- package/dist/opencode-setup.js +2 -2
- package/dist/page-fixtures.js +3 -3
- package/dist/project-setup.js +2 -3
- package/dist/prompts.js +1 -1
- package/dist/provider-docs.js +22 -25
- package/dist/realtime-bench.js +12040 -0
- package/dist/relay/agent-token.js +1 -1
- package/dist/relay/daemon.js +0 -1
- package/dist/relay/setup.js +13 -2
- package/dist/setup.js +11 -12
- package/dist/sync.js +3 -3
- package/dist/utils.js +1 -1
- package/package.json +10 -4
- package/dist/commands/agent.js +0 -251
- package/dist/commands/chat.js +0 -137
- package/dist/commands/claude.js +0 -1056
- package/dist/commands/plan.js +0 -93
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Gipity CLI
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The cloud backend for your coding agent.
|
|
4
4
|
|
|
5
|
-
[Gipity](https://gipity.ai) is the
|
|
5
|
+
[Gipity](https://gipity.ai) is the backend your coding agent gets by installing one CLI and one skill: hosting, databases, serverless functions, file storage, a code sandbox, CPU/GPU jobs, AI models and media services, workflows, and a quick LLM call (`gipity ask`), plus templates and kits that give you a running start.
|
|
6
6
|
|
|
7
|
-
This CLI connects your coding agent
|
|
7
|
+
This CLI connects your coding agent ([Claude Code](https://claude.ai/claude-code), Codex, Grok, or opencode) to Gipity: deploy, query the database, call functions, test pages in a real browser, generate images and audio, and keep your local files in sync with your Gipity project.
|
|
8
8
|
|
|
9
9
|
## Getting Started
|
|
10
10
|
|
|
11
|
-
**Step 1 - install.** One line installs everything. It sets up Node
|
|
11
|
+
**Step 1 - install.** One line installs everything. It sets up Node 22+ (if you don't already have it) and the Gipity CLI, with no sudo required:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
# macOS / Linux / WSL
|
|
@@ -18,13 +18,12 @@ curl -fsSL https://gipity.ai/install.sh | bash
|
|
|
18
18
|
irm https://gipity.ai/install.ps1 | iex
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
**Step 2 - pick your path.** There are
|
|
21
|
+
**Step 2 - pick your path.** There are two, and they mix freely:
|
|
22
22
|
|
|
23
23
|
| You want to... | Run |
|
|
24
24
|
|----------------|-----|
|
|
25
25
|
| Start building right now, from anywhere | `gipity build` |
|
|
26
26
|
| Use your own workflow in your own directory | `gipity init`, then `claude` / `codex` / `grok` / `opencode` |
|
|
27
|
-
| Drive this computer from gipity.ai (phone, browser) | `gipity connect` |
|
|
28
27
|
|
|
29
28
|
### `gipity build` - start from anywhere
|
|
30
29
|
|
|
@@ -45,19 +44,9 @@ claude # or codex, grok, or opencode - whatever you use
|
|
|
45
44
|
|
|
46
45
|
`init` links the directory to a Gipity project, writes CLAUDE.md/AGENTS.md primers so your agent understands Gipity, and installs the Gipity skills + file-sync hooks into the agent CLIs found on your machine (Claude Code, Codex, Grok; Cursor and Gemini get primer files too).
|
|
47
46
|
|
|
48
|
-
### `gipity connect` - drive it from the web
|
|
49
|
-
|
|
50
|
-
Want to start chats from gipity.ai (including your phone) and have them run the coding agent on this computer? Connect it once:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
gipity connect
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
It logs you in, pairs the machine, starts the Gipity relay in the background, and installs the login service so it survives reboots - then stops, without launching anything. From then on, open gipity.ai and start a chat to drive your agent here. Manage it with `gipity relay status` / `pause` / `resume` / `revoke`.
|
|
57
|
-
|
|
58
47
|
### Prefer npm
|
|
59
48
|
|
|
60
|
-
If you already have **Node.js
|
|
49
|
+
If you already have **Node.js 22+** you can install directly:
|
|
61
50
|
|
|
62
51
|
```bash
|
|
63
52
|
npm install -g gipity
|
|
@@ -135,16 +124,14 @@ This is the good part. When you run `gipity init` (or `gipity build`) in a proje
|
|
|
135
124
|
|
|
136
125
|
**Auto-push** - Every time your agent writes or edits a file, it gets pushed to Gipity in the background. No extra steps.
|
|
137
126
|
|
|
138
|
-
**Auto-pull** - Before each turn, your agent pulls any changes that happened remotely (
|
|
127
|
+
**Auto-pull** - Before each turn, your agent pulls any changes that happened remotely (files written by a sandbox run, a workflow, or another machine). It sees what changed and can pick up where things left off.
|
|
139
128
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
Sessions are also recorded to your Gipity project so you can watch them live at prompt.gipity.ai. Opt out per project with `gipity init --no-capture`.
|
|
129
|
+
Session recording is off by default. To keep your Claude Code sessions in your Gipity project (the Chats tab in your dashboard), run `gipity init --capture`; turn it off again with `gipity init --no-capture`.
|
|
143
130
|
|
|
144
131
|
### What gets set up
|
|
145
132
|
|
|
146
133
|
```
|
|
147
|
-
.gipity.json # Project config (which project
|
|
134
|
+
.gipity.json # Project config (which project)
|
|
148
135
|
.gipity/ # Local sync state (gitignored)
|
|
149
136
|
.claude/settings.json # Hooks for auto-push and auto-pull (per-agent equivalents for Codex/Grok)
|
|
150
137
|
CLAUDE.md / AGENTS.md # Gipity commands reference for your agent
|
|
@@ -155,9 +142,9 @@ CLAUDE.md / AGENTS.md # Gipity commands reference for your agent
|
|
|
155
142
|
If you ever need to sync manually:
|
|
156
143
|
|
|
157
144
|
```bash
|
|
158
|
-
gipity sync
|
|
159
|
-
gipity sync
|
|
160
|
-
gipity
|
|
145
|
+
gipity sync --plan # See what would change, without applying it
|
|
146
|
+
gipity sync # Sync both ways
|
|
147
|
+
gipity push <file> # Push one or more files
|
|
161
148
|
```
|
|
162
149
|
|
|
163
150
|
## Commands
|
|
@@ -166,38 +153,37 @@ gipity sync down # Pull remote changes
|
|
|
166
153
|
|---------|-------------|
|
|
167
154
|
| `gipity build` | Log in, pick a project, pick your coding agent, and launch it - all in one |
|
|
168
155
|
| `gipity init` | Link this directory to a project and set up your coding agent |
|
|
169
|
-
| `gipity
|
|
170
|
-
| `gipity
|
|
171
|
-
| `gipity
|
|
172
|
-
| `gipity
|
|
173
|
-
| `gipity
|
|
174
|
-
| `gipity push <file>` | Push a single file |
|
|
156
|
+
| `gipity login` / `gipity logout` | Authenticate with email + verification code / sign out |
|
|
157
|
+
| `gipity status` | Show project and login status |
|
|
158
|
+
| `gipity skill list` / `skill read <name>` | Task docs: read the matching skill before building |
|
|
159
|
+
| `gipity project` | List, create, switch, rename, or delete projects |
|
|
160
|
+
| `gipity add <template\|kit>` | Add a template (web-simple, web-fullstack, api, 2d-game, 3d-world, ...) or a kit (realtime, stripe, i18n, ...) |
|
|
175
161
|
| `gipity deploy [dev\|prod]` | Deploy your project to the web |
|
|
176
|
-
| `gipity
|
|
162
|
+
| `gipity page inspect\|eval\|screenshot <url>` | Check a page in a real browser: console errors, failed resources, DOM, screenshots |
|
|
163
|
+
| `gipity test` | Run project tests in sandboxed containers |
|
|
177
164
|
| `gipity db` | Query, list, create, or drop project databases |
|
|
178
|
-
| `gipity
|
|
179
|
-
| `gipity
|
|
180
|
-
| `gipity
|
|
181
|
-
| `gipity
|
|
165
|
+
| `gipity fn` | List, call, and delete serverless functions |
|
|
166
|
+
| `gipity logs fn <name>` / `logs app` | Function logs / recent app activity and errors |
|
|
167
|
+
| `gipity secrets` | Manage app secrets (encrypted, never echoed back) |
|
|
168
|
+
| `gipity job` | Run long CPU/GPU jobs |
|
|
169
|
+
| `gipity workflow` | Create, run, and schedule workflows |
|
|
182
170
|
| `gipity approval` | List, create, answer, or cancel pending approvals |
|
|
183
|
-
| `gipity
|
|
184
|
-
| `gipity
|
|
185
|
-
| `gipity
|
|
186
|
-
| `gipity
|
|
187
|
-
| `gipity
|
|
188
|
-
| `gipity page inspect <url>` | Inspect a URL: console errors, performance, failed resources |
|
|
171
|
+
| `gipity memory` | Read/write project memory used by workflow llm steps |
|
|
172
|
+
| `gipity ask "<question>"` | Ask a model one question and print the answer |
|
|
173
|
+
| `gipity generate` | Generate images, video, speech, sound effects, or music |
|
|
174
|
+
| `gipity service` | Call an app service (llm, tts, image, transcribe, ...) |
|
|
175
|
+
| `gipity sandbox run` | Execute code in a sandboxed container |
|
|
189
176
|
| `gipity records` | Query and manage Records API tables |
|
|
190
|
-
| `gipity
|
|
191
|
-
| `gipity
|
|
192
|
-
| `gipity
|
|
193
|
-
| `gipity
|
|
194
|
-
| `gipity skill` | List and manage agent skills |
|
|
195
|
-
| `gipity chat [list\|rename\|archive\|delete]` | Manage chats (or `gipity chat <message>` to send) |
|
|
196
|
-
| `gipity gmail [send\|reply\|search\|read]` | Send/read via your own Gmail (different from `gipity email`) |
|
|
177
|
+
| `gipity rbac` / `gipity audit` | Access policies / audit logs |
|
|
178
|
+
| `gipity file` | Browse remote files, versions, and rollbacks |
|
|
179
|
+
| `gipity sync` / `gipity push` | Sync files between local and Gipity |
|
|
180
|
+
| `gipity upload <file>` | Upload a file and print a durable public URL |
|
|
197
181
|
| `gipity domain` | Manage custom domains for deployed apps |
|
|
198
|
-
| `gipity email
|
|
199
|
-
| `gipity
|
|
200
|
-
| `gipity
|
|
182
|
+
| `gipity email` | Test and inspect your app's `email()` sends (`email test`, `email log`) |
|
|
183
|
+
| `gipity credits` | Check your plan, balance, and usage |
|
|
184
|
+
| `gipity doctor` | Check install + environment health |
|
|
185
|
+
|
|
186
|
+
Run `gipity --help` for the full list, and `gipity <command> --help` for details.
|
|
201
187
|
|
|
202
188
|
Every command supports `--json` for scripted/programmatic use.
|
|
203
189
|
|
|
@@ -210,13 +196,16 @@ gipity deploy prod # Deploy to production (app.gipity.ai)
|
|
|
210
196
|
|
|
211
197
|
Your project gets a live URL at `https://dev.gipity.ai/{account}/{project}/`.
|
|
212
198
|
|
|
213
|
-
###
|
|
199
|
+
### ask
|
|
214
200
|
|
|
215
|
-
|
|
201
|
+
One question, one answer: no chat history, no tools. Handy for summarizing a log or getting a second opinion while you work.
|
|
216
202
|
|
|
217
203
|
```bash
|
|
218
|
-
gipity
|
|
219
|
-
gipity
|
|
204
|
+
gipity ask "summarize this" --file notes.md
|
|
205
|
+
cat errors.log | gipity ask "group these by root cause" --file -
|
|
206
|
+
cat prompt.txt | gipity ask # piped stdin is the whole prompt
|
|
207
|
+
gipity ask "what's in this image" --image shot.png --model haiku
|
|
208
|
+
gipity ask "list the causes" --schema '{"type":"array","items":{"type":"string"}}'
|
|
220
209
|
```
|
|
221
210
|
|
|
222
211
|
### db
|
|
@@ -232,49 +221,44 @@ gipity db drop old_db --project my-old-app # Drop from another project (no cd n
|
|
|
232
221
|
|
|
233
222
|
### memory
|
|
234
223
|
|
|
235
|
-
|
|
224
|
+
Project memory is notes by topic, scoped to one project. Workflow llm steps read and write it with the `memory` tool, so it carries context from one run to the next. You can read and edit it from the CLI.
|
|
236
225
|
|
|
237
226
|
```bash
|
|
238
227
|
gipity memory list
|
|
239
|
-
gipity memory read
|
|
240
|
-
gipity memory write
|
|
241
|
-
gipity memory
|
|
228
|
+
gipity memory read design_notes
|
|
229
|
+
gipity memory write design_notes "use dark theme"
|
|
230
|
+
gipity memory delete design_notes
|
|
242
231
|
```
|
|
243
232
|
|
|
233
|
+
Don't put secrets in memory. Use `gipity secrets set STRIPE_KEY ...` instead: secrets are encrypted at rest and never echoed back.
|
|
234
|
+
|
|
244
235
|
### sandbox
|
|
245
236
|
|
|
246
237
|
Run code in a sandboxed Docker container with no network access. JavaScript, Python, and Bash.
|
|
247
238
|
|
|
248
239
|
```bash
|
|
249
|
-
gipity sandbox run "console.log('Hello')" --
|
|
250
|
-
gipity sandbox run "import pandas; print(pandas.__version__)" --
|
|
251
|
-
gipity sandbox run
|
|
240
|
+
gipity sandbox run "console.log('Hello')" --language js
|
|
241
|
+
gipity sandbox run "import pandas; print(pandas.__version__)" --language py
|
|
242
|
+
gipity sandbox run --file scripts/report.py
|
|
252
243
|
```
|
|
253
244
|
|
|
254
245
|
### workflow
|
|
255
246
|
|
|
256
247
|
```bash
|
|
257
248
|
gipity workflow # List workflows
|
|
258
|
-
gipity workflow
|
|
259
|
-
gipity workflow
|
|
249
|
+
gipity workflow create workflows/daily_report.yaml
|
|
250
|
+
gipity workflow run daily_report # Run now and print each step's output
|
|
251
|
+
gipity workflow enable daily_report # Turn on its schedule
|
|
260
252
|
gipity workflow runs daily_report # View recent runs
|
|
261
253
|
```
|
|
262
254
|
|
|
263
|
-
### agent
|
|
264
|
-
|
|
265
|
-
```bash
|
|
266
|
-
gipity agent # List agents
|
|
267
|
-
gipity agent create "Research Bot" # Create a new agent
|
|
268
|
-
gipity agent set model claude-opus # Change the model
|
|
269
|
-
gipity agent "Research Bot" # Switch active agent
|
|
270
|
-
```
|
|
271
|
-
|
|
272
255
|
### project
|
|
273
256
|
|
|
274
257
|
```bash
|
|
275
258
|
gipity project # List projects
|
|
276
259
|
gipity project create "My App" # Create new project
|
|
277
260
|
gipity project my-app # Switch active project
|
|
261
|
+
gipity project rename "My Great App" # Rename (display name only)
|
|
278
262
|
```
|
|
279
263
|
|
|
280
264
|
## Project Config
|
|
@@ -288,7 +272,6 @@ Created by `gipity init`. Links your local directory to a Gipity project.
|
|
|
288
272
|
"projectGuid": "prj-a1b2c3d4",
|
|
289
273
|
"projectSlug": "my-app",
|
|
290
274
|
"accountSlug": "steve",
|
|
291
|
-
"agentGuid": "agt-x1y2z3w4",
|
|
292
275
|
"apiBase": "https://a.gipity.ai",
|
|
293
276
|
"ignore": ["node_modules", ".git", "dist", ".env"]
|
|
294
277
|
}
|
package/dist/adopt-cwd.js
CHANGED
|
@@ -193,7 +193,7 @@ export function formatBytes(n) {
|
|
|
193
193
|
* validate/prompt as needed).
|
|
194
194
|
* 2. Try to match an existing server project by slug; adopt if found.
|
|
195
195
|
* 3. Otherwise POST /projects with relay-device wiring.
|
|
196
|
-
* 4.
|
|
196
|
+
* 4. `finalizeLocalProject` to write config,
|
|
197
197
|
* sync, and install hooks/skills/gitignore.
|
|
198
198
|
* Caller is responsible for the size-tier check before calling. */
|
|
199
199
|
export async function adoptCurrentDir(opts) {
|
|
@@ -238,28 +238,17 @@ export async function adoptCurrentDir(opts) {
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
// Fetch the project's agent (if any). An explicit override wins.
|
|
242
|
-
let agentGuid = opts.agentOverride ?? '';
|
|
243
|
-
if (!agentGuid) {
|
|
244
|
-
try {
|
|
245
|
-
const agents = await get(`/projects/${project.short_guid}/agents`);
|
|
246
|
-
if (agents.data.length > 0)
|
|
247
|
-
agentGuid = agents.data[0].short_guid;
|
|
248
|
-
}
|
|
249
|
-
catch { /* no agents */ }
|
|
250
|
-
}
|
|
251
241
|
const { applied } = await finalizeLocalProject({
|
|
252
242
|
dir: opts.cwd,
|
|
253
243
|
projectGuid: project.short_guid,
|
|
254
244
|
projectSlug: project.slug,
|
|
255
245
|
projectName: project.name,
|
|
256
246
|
accountSlug: opts.accountSlug,
|
|
257
|
-
agentGuid,
|
|
258
247
|
sync: 'strict',
|
|
259
248
|
interactive: opts.confirmDeletions,
|
|
260
249
|
tools: opts.tools,
|
|
261
250
|
});
|
|
262
|
-
return { project, isNew,
|
|
251
|
+
return { project, isNew, accountSlug: opts.accountSlug, applied };
|
|
263
252
|
}
|
|
264
253
|
/** Re-export so callers can unify on these constants for messaging. */
|
|
265
254
|
export const ADOPT_THRESHOLDS = {
|
package/dist/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Readable } from 'stream';
|
|
2
2
|
import * as tar from 'tar-stream';
|
|
3
3
|
import { getAuth, refreshTokenIfNeeded, forceRefreshAccessToken } from './auth.js';
|
|
4
|
-
import { resolveApiBase
|
|
4
|
+
import { resolveApiBase } from './config.js';
|
|
5
5
|
import { clientHeaders } from './client-context.js';
|
|
6
6
|
export class ApiError extends Error {
|
|
7
7
|
statusCode;
|
|
@@ -32,7 +32,7 @@ const DOWNLOAD_HEADER_TIMEOUT_MS = 30_000;
|
|
|
32
32
|
// Media generation (music/video/image/speech, `service call` POSTs) can
|
|
33
33
|
// legitimately run minutes in ONE request/response: a GPU-backed music model
|
|
34
34
|
// waking from scale-to-zero spends 1-3 min booting + loading weights before it
|
|
35
|
-
// renders a note, and
|
|
35
|
+
// renders a note, and a video render runs 20-120s. The server bounds all of these at
|
|
36
36
|
// 300s (its provider fetch budget and the ALB idle timeout are both 300s), so
|
|
37
37
|
// the long-call cap sits just above that ceiling - the server's clearer error
|
|
38
38
|
// always arrives before the CLI gives up. Callers opt in per request; plain
|
|
@@ -150,9 +150,19 @@ async function shouldRetryAfter401(status, retried) {
|
|
|
150
150
|
* the emailed login code, and dead-ending there stranded whole runs (cli#137). */
|
|
151
151
|
function with401Hint(status, message) {
|
|
152
152
|
return status === 401 && !usingEnvToken()
|
|
153
|
-
? `${message}
|
|
153
|
+
? `${message}; run: gipity login (headless/CI: set GIPITY_TOKEN instead; see gipity skill read agent-deploy)`
|
|
154
154
|
: message;
|
|
155
155
|
}
|
|
156
|
+
/** Build the ApiError for a non-2xx response from its parsed JSON body (null
|
|
157
|
+
* when the body wasn't JSON). A non-JSON error (an HTML 404 from a retired
|
|
158
|
+
* route, a proxy 502) has no message of its own, and over HTTP/2 statusText is
|
|
159
|
+
* always empty, so name the status and the request instead of printing a
|
|
160
|
+
* blank error. */
|
|
161
|
+
function apiErrorFrom(res, json, label, hint = true) {
|
|
162
|
+
const err = json?.error ?? {};
|
|
163
|
+
const message = err.message || `HTTP ${res.status}${res.statusText ? ` ${res.statusText}` : ''} from ${label}`;
|
|
164
|
+
return new ApiError(res.status, err.code || 'UNKNOWN', hint ? with401Hint(res.status, message) : message, json?.data);
|
|
165
|
+
}
|
|
156
166
|
async function getHeaders() {
|
|
157
167
|
return {
|
|
158
168
|
...clientHeaders(),
|
|
@@ -186,9 +196,8 @@ async function request(method, path, body, retrying = false, timeoutMs = REQUEST
|
|
|
186
196
|
return request(method, path, body, true, timeoutMs);
|
|
187
197
|
}
|
|
188
198
|
if (!res.ok) {
|
|
189
|
-
const json = await res.json().catch(() =>
|
|
190
|
-
|
|
191
|
-
throw new ApiError(res.status, err.code, with401Hint(res.status, err.message), json.data);
|
|
199
|
+
const json = await res.json().catch(() => null);
|
|
200
|
+
throw apiErrorFrom(res, json, `${method} ${path}`);
|
|
192
201
|
}
|
|
193
202
|
return res.json();
|
|
194
203
|
}
|
|
@@ -216,9 +225,8 @@ export async function postForTarEntries(path, body, retried = false) {
|
|
|
216
225
|
return postForTarEntries(path, body, true);
|
|
217
226
|
}
|
|
218
227
|
if (!res.ok) {
|
|
219
|
-
const json = await read(r => r.json().catch(() =>
|
|
220
|
-
|
|
221
|
-
throw new ApiError(res.status, err.code, with401Hint(res.status, err.message), json.data);
|
|
228
|
+
const json = await read(r => r.json().catch(() => null));
|
|
229
|
+
throw apiErrorFrom(res, json, `POST ${path}`);
|
|
222
230
|
}
|
|
223
231
|
if (!res.body) {
|
|
224
232
|
await read(async () => null); // clear the body timer before bailing out
|
|
@@ -255,29 +263,6 @@ export function patch(path, body) {
|
|
|
255
263
|
export function del(path, body) {
|
|
256
264
|
return request('DELETE', path, body);
|
|
257
265
|
}
|
|
258
|
-
/** Send a message via the conversation API, reusing or creating a conversation. Returns content string. */
|
|
259
|
-
export async function sendMessage(message) {
|
|
260
|
-
const config = requireConfig();
|
|
261
|
-
const useExisting = !!config.conversationGuid;
|
|
262
|
-
const endpoint = useExisting
|
|
263
|
-
? `/conversations/${config.conversationGuid}/messages`
|
|
264
|
-
: '/conversations';
|
|
265
|
-
const body = useExisting
|
|
266
|
-
? { content: message }
|
|
267
|
-
: { agentGuid: config.agentGuid, content: message, projectGuid: config.projectGuid };
|
|
268
|
-
const res = await post(endpoint, body);
|
|
269
|
-
if (res.data.conversationGuid !== config.conversationGuid) {
|
|
270
|
-
saveConfig({ ...config, conversationGuid: res.data.conversationGuid });
|
|
271
|
-
}
|
|
272
|
-
// The server's cost-consent gate stops the agentic loop on big-build
|
|
273
|
-
// requests and returns an explicit costWarning with empty content. Surface
|
|
274
|
-
// it - before this the CLI printed nothing and the command silently did
|
|
275
|
-
// nothing. Replying "y" (next sendMessage) consents and proceeds.
|
|
276
|
-
if (res.data.costWarning && !res.data.content) {
|
|
277
|
-
return res.data.costWarning.message;
|
|
278
|
-
}
|
|
279
|
-
return res.data.content;
|
|
280
|
-
}
|
|
281
266
|
/** Download a file as raw bytes (no JSON parsing) */
|
|
282
267
|
export async function download(path, retried = false) {
|
|
283
268
|
const url = `${baseUrl()}${path}`;
|
|
@@ -290,7 +275,7 @@ export async function download(path, retried = false) {
|
|
|
290
275
|
}
|
|
291
276
|
if (!res.ok) {
|
|
292
277
|
await read(async () => null);
|
|
293
|
-
throw new ApiError(res.status, 'DOWNLOAD_ERROR', with401Hint(res.status, `Download failed: ${res.statusText}`));
|
|
278
|
+
throw new ApiError(res.status, 'DOWNLOAD_ERROR', with401Hint(res.status, `Download failed: HTTP ${res.status}${res.statusText ? ` ${res.statusText}` : ''}`));
|
|
294
279
|
}
|
|
295
280
|
return read(async (r) => Buffer.from(await r.arrayBuffer()));
|
|
296
281
|
}
|
|
@@ -310,9 +295,8 @@ export async function downloadWithHeaders(path, retried = false) {
|
|
|
310
295
|
return downloadWithHeaders(path, true);
|
|
311
296
|
}
|
|
312
297
|
if (!res.ok) {
|
|
313
|
-
const json = await read(r => r.json().catch(() =>
|
|
314
|
-
|
|
315
|
-
throw new ApiError(res.status, err.code, with401Hint(res.status, err.message), json.data);
|
|
298
|
+
const json = await read(r => r.json().catch(() => null));
|
|
299
|
+
throw apiErrorFrom(res, json, `GET ${path}`);
|
|
316
300
|
}
|
|
317
301
|
return read(async (r) => ({ buffer: Buffer.from(await r.arrayBuffer()), headers: r.headers }));
|
|
318
302
|
}
|
|
@@ -336,9 +320,8 @@ export async function postBinary(path, body, contentType = 'application/zip', re
|
|
|
336
320
|
return postBinary(path, body, contentType, true);
|
|
337
321
|
}
|
|
338
322
|
if (!res.ok) {
|
|
339
|
-
const json = await res.json().catch(() =>
|
|
340
|
-
|
|
341
|
-
throw new ApiError(res.status, err.code, with401Hint(res.status, err.message), json.data);
|
|
323
|
+
const json = await res.json().catch(() => null);
|
|
324
|
+
throw apiErrorFrom(res, json, `POST ${path}`);
|
|
342
325
|
}
|
|
343
326
|
return { status: res.status, json: await res.json() };
|
|
344
327
|
}
|
|
@@ -372,7 +355,7 @@ export async function downloadStream(path, retried = false) {
|
|
|
372
355
|
return downloadStream(path, true);
|
|
373
356
|
}
|
|
374
357
|
if (!res.ok) {
|
|
375
|
-
throw new ApiError(res.status, 'DOWNLOAD_ERROR', with401Hint(res.status, `Download failed: ${res.statusText}`));
|
|
358
|
+
throw new ApiError(res.status, 'DOWNLOAD_ERROR', with401Hint(res.status, `Download failed: HTTP ${res.status}${res.statusText ? ` ${res.statusText}` : ''}`));
|
|
376
359
|
}
|
|
377
360
|
return Readable.fromWeb(res.body);
|
|
378
361
|
}
|
|
@@ -419,13 +402,13 @@ export async function putToPresignedUrl(url, body, contentLength, contentType) {
|
|
|
419
402
|
// A timeout aborts with a TimeoutError/AbortError. Surface it as a 408 so
|
|
420
403
|
// withRetry() treats it as transient and retries the PUT.
|
|
421
404
|
if (err instanceof Error && (err.name === 'TimeoutError' || err.name === 'AbortError')) {
|
|
422
|
-
throw new ApiError(408, 'S3_UPLOAD_TIMEOUT', `
|
|
405
|
+
throw new ApiError(408, 'S3_UPLOAD_TIMEOUT', `Storage upload stalled (no completion in ${Math.round(timeoutMs / 1000)}s)`);
|
|
423
406
|
}
|
|
424
407
|
throw err;
|
|
425
408
|
}
|
|
426
409
|
if (!res.ok) {
|
|
427
410
|
const text = await res.text().catch(() => res.statusText);
|
|
428
|
-
throw new ApiError(res.status, 'S3_UPLOAD', `
|
|
411
|
+
throw new ApiError(res.status, 'S3_UPLOAD', `Storage upload failed: ${res.status} ${text.slice(0, 200)}`);
|
|
429
412
|
}
|
|
430
413
|
const etag = (res.headers.get('etag') ?? '').replace(/^"|"$/g, '');
|
|
431
414
|
return etag;
|
|
@@ -450,9 +433,8 @@ export async function publicRequest(method, path, body, extraHeaders) {
|
|
|
450
433
|
body: body === undefined ? undefined : JSON.stringify(body),
|
|
451
434
|
}, REQUEST_TIMEOUT_MS, `${method} ${path}`);
|
|
452
435
|
if (!res.ok) {
|
|
453
|
-
const json = await res.json().catch(() =>
|
|
454
|
-
|
|
455
|
-
throw new ApiError(res.status, err.code, err.message, json.data);
|
|
436
|
+
const json = await res.json().catch(() => null);
|
|
437
|
+
throw apiErrorFrom(res, json, `${method} ${path}`, false);
|
|
456
438
|
}
|
|
457
439
|
return res.json();
|
|
458
440
|
}
|
package/dist/auth.js
CHANGED
|
@@ -169,7 +169,7 @@ export async function acquireRefreshLock() {
|
|
|
169
169
|
* refresh" shortcut and performs the refresh round-trip unconditionally, so a token
|
|
170
170
|
* the server considers dead actually gets replaced instead of re-sent. */
|
|
171
171
|
export async function refreshTokenIfNeeded(force = false) {
|
|
172
|
-
const auth = readAuthFresh(); // never the cache
|
|
172
|
+
const auth = readAuthFresh(); // never the cache: a sibling may have rotated
|
|
173
173
|
if (!auth)
|
|
174
174
|
return; // not logged in - caller throws the clean error
|
|
175
175
|
cached = auth;
|
package/dist/banner.js
CHANGED
|
@@ -19,19 +19,16 @@ function tildify(p) {
|
|
|
19
19
|
// ── Static content ─────────────────────────────────────────────────────
|
|
20
20
|
// ── Feature groups ────────────────────────────────────────────────────
|
|
21
21
|
const AI_MODELS = [
|
|
22
|
-
'OpenAI', 'Anthropic', 'Gemini', '
|
|
22
|
+
'OpenAI', 'Anthropic', 'Gemini', 'Black Forest Labs',
|
|
23
23
|
];
|
|
24
24
|
const GENERATION = [
|
|
25
25
|
'Image', 'Video', 'Music', 'Speech / TTS', 'Sound',
|
|
26
26
|
];
|
|
27
|
-
const AGENT = [
|
|
28
|
-
'Memory', 'Conversations', 'Plans', 'Schedules', 'Soul',
|
|
29
|
-
];
|
|
30
27
|
const AUTOMATION = [
|
|
31
|
-
'Workflows', 'Triggers', 'Webhooks', 'Approvals',
|
|
28
|
+
'Workflows', 'Schedules', 'Triggers', 'Webhooks', 'Approvals', 'Memory',
|
|
32
29
|
];
|
|
33
30
|
const INTEGRATIONS = [
|
|
34
|
-
'
|
|
31
|
+
'GitHub', 'Stripe', 'Web Push', 'Email', 'Custom Domains',
|
|
35
32
|
];
|
|
36
33
|
const DATA = [
|
|
37
34
|
'Database', 'Records API', 'RBAC', 'Audit Trail', 'Soft Deletes',
|
|
@@ -236,7 +233,6 @@ function printFull(opts, outerW) {
|
|
|
236
233
|
rightLines.push('');
|
|
237
234
|
addSection('AI Models', AI_MODELS);
|
|
238
235
|
addSection('Generation', GENERATION);
|
|
239
|
-
addSection('Agent', AGENT);
|
|
240
236
|
addSection('Automation', AUTOMATION);
|
|
241
237
|
addSection('Integrations', INTEGRATIONS);
|
|
242
238
|
addSection('Data', DATA);
|
package/dist/catalog.js
CHANGED
|
@@ -5,28 +5,28 @@
|
|
|
5
5
|
* Source: platform/packages/shared/src/constants.ts (TEMPLATES/KITS cliHint fields)
|
|
6
6
|
* Run `just build-knowledge` to refresh.
|
|
7
7
|
*/
|
|
8
|
-
/** Visible
|
|
9
|
-
export const
|
|
8
|
+
/** Visible apps (registry/apps/): complete working apps to run, then extend. */
|
|
9
|
+
export const APPS = [
|
|
10
10
|
{ key: 'web-vision-cam', hint: 'fullscreen camera app with on-device vision (MediaPipe)' },
|
|
11
11
|
{ key: 'object-spotter', hint: 'camera app that boxes, labels, and counts objects (YOLOX on-device)' },
|
|
12
12
|
{ key: '2d-game', hint: '2D games with Phaser 3 - platformer, arcade, puzzle' },
|
|
13
13
|
{ key: '3d-world', hint: 'playable 3D multiplayer rocket-launcher demo' },
|
|
14
14
|
{ key: 'karaoke-captions', hint: 'audio + lyrics -> word-synced karaoke captions (GPU job)' },
|
|
15
|
-
{ key: 'outreach-agent', hint: 'AI-run outreach funnel - import contacts, draft + auto-send staged emails' },
|
|
16
15
|
{ key: 'paid-app', hint: 'storefront that charges real money - Stripe checkout, members area, billing' },
|
|
17
16
|
{ key: 'notify-demo', hint: 'web-push demo - enable notifications, send a real ping' },
|
|
18
17
|
];
|
|
19
|
-
/** Visible blank
|
|
20
|
-
export const
|
|
18
|
+
/** Visible templates (registry/templates/): blank framework wiring. */
|
|
19
|
+
export const TEMPLATES = [
|
|
21
20
|
{ key: 'web-simple', hint: 'static frontend-only site - pages, dashboards, simple games' },
|
|
22
21
|
{ key: 'web-fullstack', hint: 'backend API + database wiring - frontend, functions, migrations; deploys green empty' },
|
|
23
22
|
{ key: '3d-engine', hint: '3D multiplayer wiring - Three.js + Rapier + Gipity Realtime' },
|
|
24
23
|
{ key: 'api', hint: 'pure API backend, no frontend - functions + tests, deploys green' },
|
|
25
24
|
];
|
|
26
|
-
/** Hidden templates - installable by exact key, omitted from listings. */
|
|
25
|
+
/** Hidden templates and apps - installable by exact key, omitted from listings. */
|
|
27
26
|
export const HIDDEN = [
|
|
28
27
|
{ key: 'app-itsm', hint: 'IT service management / helpdesk / ticketing' },
|
|
29
|
-
{ key: 'monitor', hint: 'account
|
|
28
|
+
{ key: 'monitor', hint: 'the Gipity account web app (projects, deploys, logs, billing)' },
|
|
29
|
+
{ key: 'outreach-agent', hint: 'incomplete: AI-run outreach funnel (needs porting to workflow tools)' },
|
|
30
30
|
];
|
|
31
31
|
/** Kits - building blocks added into an existing app. */
|
|
32
32
|
export const KITS = [
|
|
@@ -40,5 +40,6 @@ export const KITS = [
|
|
|
40
40
|
{ key: 'stripe', hint: 'charge your users - Stripe checkout, subscriptions, brokered webhooks' },
|
|
41
41
|
{ key: 'notify', hint: 'web push notifications - platform-owned keys, works on iOS home screen' },
|
|
42
42
|
{ key: 'servicenow', hint: 'ServiceNow tables as a data source - OAuth pull/write-back/real-time sync' },
|
|
43
|
+
{ key: 'leaderboard', hint: 'leaderboards for any game - scores or times, daily/weekly/season boards, tiebreaks, replays, bans' },
|
|
43
44
|
];
|
|
44
45
|
//# sourceMappingURL=catalog.js.map
|
package/dist/commands/add.js
CHANGED
|
@@ -7,6 +7,7 @@ import { requireConfig } from '../config.js';
|
|
|
7
7
|
import { sync } from '../sync.js';
|
|
8
8
|
import { success, muted, bold, warning, error as clrError } from '../colors.js';
|
|
9
9
|
import { run } from '../helpers/index.js';
|
|
10
|
+
import { syncBeforeAction } from '../helpers/sync.js';
|
|
10
11
|
import { createProgressReporter, withSpinner } from '../progress.js';
|
|
11
12
|
// Catalog GENERATED from platform/packages/shared (TEMPLATES + KITS cliHint
|
|
12
13
|
// fields) into src/catalog.ts by platform/scripts/build-knowledge.ts - the CLI
|
|
@@ -14,22 +15,22 @@ import { createProgressReporter, withSpinner } from '../progress.js';
|
|
|
14
15
|
// workspace. The hand-mirrored copy that used to live here silently dropped
|
|
15
16
|
// every new catalog entry; edit constants.ts + `just build-knowledge` instead.
|
|
16
17
|
//
|
|
17
|
-
// Templates install a whole app (blank wiring or a working
|
|
18
|
+
// Templates and apps install a whole app (blank wiring or a complete working app).
|
|
18
19
|
// Kits are reusable building blocks added into an existing app's src/packages/.
|
|
19
|
-
import {
|
|
20
|
+
import { APPS, TEMPLATES, KITS } from '../catalog.js';
|
|
20
21
|
// The catalog block, rendered once and reused by the full help output
|
|
21
22
|
// (`gipity add` / `gipity add --help`) and the bare listing (`gipity add
|
|
22
23
|
// --list`) so they can never drift. Three sections, one entry per line, keys
|
|
23
24
|
// column-aligned. No leading/trailing blank lines - callers add surrounding
|
|
24
25
|
// whitespace.
|
|
25
26
|
function catalogText() {
|
|
26
|
-
const width = Math.max(...[...
|
|
27
|
+
const width = Math.max(...[...TEMPLATES, ...APPS, ...KITS].map(e => e.key.length));
|
|
27
28
|
const row = (e) => ` ${e.key.padEnd(width)} ${muted(e.hint)}`;
|
|
28
29
|
const section = (title, blurb, entries) => [`${bold(title)} ${muted('- ' + blurb)}`, ...entries.map(row)].join('\n');
|
|
29
30
|
return [
|
|
30
31
|
'Names to pass to `gipity add <name>`:',
|
|
31
|
-
section('Templates
|
|
32
|
-
section('
|
|
32
|
+
section('Templates', 'blank framework wiring for a new app - build on top', TEMPLATES),
|
|
33
|
+
section('Apps', 'complete working apps to run, then extend or replace', APPS),
|
|
33
34
|
section('Kits', 'building blocks to add into an app you already scaffolded', KITS),
|
|
34
35
|
].join('\n\n');
|
|
35
36
|
}
|
|
@@ -68,8 +69,8 @@ const ORIENTATION_FILES = [
|
|
|
68
69
|
// `gipity add ./path/to/template` walks a directory and ships the contents to
|
|
69
70
|
// the server as a JSON payload, instead of asking the server to look the name
|
|
70
71
|
// up in its bundled catalog. This is the dev loop for template authors: you
|
|
71
|
-
// can iterate on `registry/templates/<name>/`
|
|
72
|
-
// having to redeploy the server.
|
|
72
|
+
// can iterate on `registry/templates/<name>/` or `registry/apps/<name>/` and
|
|
73
|
+
// push to a real app without having to redeploy the server.
|
|
73
74
|
//
|
|
74
75
|
// The server-side wire shape this builds matches addSchema.files in
|
|
75
76
|
// platform/server/src/routes/projects/add.ts (same field names, same encoding
|
|
@@ -174,7 +175,7 @@ export const addCommand = new Command('add')
|
|
|
174
175
|
// `--list` is a bare catalog dump; no project/config needed.
|
|
175
176
|
if (opts.list) {
|
|
176
177
|
if (opts.json) {
|
|
177
|
-
console.log(JSON.stringify({ templates:
|
|
178
|
+
console.log(JSON.stringify({ templates: TEMPLATES, apps: APPS, kits: KITS }));
|
|
178
179
|
}
|
|
179
180
|
else {
|
|
180
181
|
console.log(catalogText());
|
|
@@ -191,7 +192,20 @@ export const addCommand = new Command('add')
|
|
|
191
192
|
process.exitCode = 1;
|
|
192
193
|
return;
|
|
193
194
|
}
|
|
195
|
+
// `name=3d-engine` is an option carried over in key=value shape (the same
|
|
196
|
+
// miss the excess-argument handler catches for `title=...`). Sent as-is it
|
|
197
|
+
// comes back "not a known template or kit", which reads as a catalog problem
|
|
198
|
+
// rather than an argument-shape one, so name the bare positional instead.
|
|
199
|
+
const kv = /^([A-Za-z][\w-]*)=(.+)$/.exec(name);
|
|
200
|
+
if (kv && !looksLikePath(name)) {
|
|
201
|
+
throw new Error(`"${name}" is a key=value pair: the template or kit name is a bare positional, e.g. gipity add ${kv[2]}`);
|
|
202
|
+
}
|
|
194
203
|
const config = requireConfig();
|
|
204
|
+
// Push local edits first, like deploy does: the install merges into the
|
|
205
|
+
// project's files on the server (a kit edits index.html's import map and
|
|
206
|
+
// gipity.yaml), so an unsynced local edit would otherwise collide with the
|
|
207
|
+
// server's version and come back as a conflict copy.
|
|
208
|
+
await syncBeforeAction({ json: opts.json });
|
|
195
209
|
// Local-path payload mode kicks in when `name` looks like a path - bare
|
|
196
210
|
// names still go through the server's bundled catalog like before.
|
|
197
211
|
let body;
|
|
@@ -242,7 +256,7 @@ export const addCommand = new Command('add')
|
|
|
242
256
|
const syncResult = await sync({ interactive: false, progress: opts.json ? undefined : createProgressReporter() });
|
|
243
257
|
const data = res.data;
|
|
244
258
|
if (opts.json) {
|
|
245
|
-
console.log(JSON.stringify({ ...data, synced: syncResult.applied }));
|
|
259
|
+
console.log(JSON.stringify({ ...data, synced: syncResult.applied, conflicts: syncResult.plan.conflicts }));
|
|
246
260
|
return;
|
|
247
261
|
}
|
|
248
262
|
if (data.kind === 'kit') {
|
|
@@ -289,5 +303,8 @@ export const addCommand = new Command('add')
|
|
|
289
303
|
if (syncResult.applied > 0) {
|
|
290
304
|
console.log(`\nPulled ${syncResult.applied} files to local.`);
|
|
291
305
|
}
|
|
306
|
+
if (syncResult.plan.conflicts > 0) {
|
|
307
|
+
console.log(warning(`${syncResult.plan.conflicts} file(s) changed both here and on the server; the server's version is in place and yours was kept as "<name> (conflict from ...)". Merge your changes back and delete the copy.`));
|
|
308
|
+
}
|
|
292
309
|
}));
|
|
293
310
|
//# sourceMappingURL=add.js.map
|