@pollinations/cli 0.1.76 → 0.1.78
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 +10 -0
- package/SKILL.md +7 -2
- package/dist/index.js +321 -120
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var init_package = __esm({
|
|
|
14
14
|
"package.json"() {
|
|
15
15
|
package_default = {
|
|
16
16
|
name: "@pollinations/cli",
|
|
17
|
-
version: "0.1.
|
|
17
|
+
version: "0.1.78",
|
|
18
18
|
description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
|
|
19
19
|
type: "module",
|
|
20
20
|
bin: {
|
|
@@ -79,6 +79,7 @@ var init_package = __esm({
|
|
|
79
79
|
"cross-spawn": "^7.0.6",
|
|
80
80
|
json5: "^2.2.3",
|
|
81
81
|
open: "^11.0.0",
|
|
82
|
+
"smol-toml": "^1.9.1",
|
|
82
83
|
"update-notifier": "^7.3.1",
|
|
83
84
|
yaml: "^2.9.0"
|
|
84
85
|
},
|
|
@@ -640,13 +641,13 @@ function readConfig(path) {
|
|
|
640
641
|
throw new ExitSignal(1);
|
|
641
642
|
}
|
|
642
643
|
}
|
|
643
|
-
function agentBody(
|
|
644
|
+
function agentBody(configPath5, opts) {
|
|
644
645
|
if (opts.visibility !== void 0 && opts.visibility !== "private" && opts.visibility !== "public") {
|
|
645
646
|
printError("--visibility must be 'private' or 'public'");
|
|
646
647
|
throw new ExitSignal(1);
|
|
647
648
|
}
|
|
648
649
|
return {
|
|
649
|
-
...
|
|
650
|
+
...configPath5 && readConfig(configPath5),
|
|
650
651
|
...opts.name !== void 0 && { name: opts.name },
|
|
651
652
|
...opts.title !== void 0 && { title: opts.title },
|
|
652
653
|
...opts.description !== void 0 && {
|
|
@@ -799,14 +800,14 @@ var remove = new Command("delete").description("Delete an agent and its model re
|
|
|
799
800
|
var sync = new Command("sync").description("Deploy the latest revision of a code agent").argument("<id>", "Agent id").action(async (id) => {
|
|
800
801
|
const key = requireKey();
|
|
801
802
|
try {
|
|
802
|
-
const
|
|
803
|
+
const result10 = await gen(`/account/agents/${encodeURIComponent(id)}/sync`, {
|
|
803
804
|
apiKey: key,
|
|
804
805
|
method: "POST"
|
|
805
806
|
});
|
|
806
|
-
if (getOutputMode() === "json") printResult(
|
|
807
|
+
if (getOutputMode() === "json") printResult(result10);
|
|
807
808
|
else {
|
|
808
809
|
printSuccess(
|
|
809
|
-
|
|
810
|
+
result10.updated ? `Agent deployed at ${result10.deployedCommitSha}` : `Agent already uses ${result10.deployedCommitSha}`
|
|
810
811
|
);
|
|
811
812
|
}
|
|
812
813
|
} catch (error) {
|
|
@@ -2283,8 +2284,8 @@ var captureFiles = (paths) => Object.fromEntries(
|
|
|
2283
2284
|
}
|
|
2284
2285
|
])
|
|
2285
2286
|
);
|
|
2286
|
-
var restoreFiles = (
|
|
2287
|
-
for (const [path, file] of Object.entries(
|
|
2287
|
+
var restoreFiles = (files10) => {
|
|
2288
|
+
for (const [path, file] of Object.entries(files10)) {
|
|
2288
2289
|
if (file.symlink !== void 0) {
|
|
2289
2290
|
const tmp = join3(
|
|
2290
2291
|
dirname3(path),
|
|
@@ -2808,8 +2809,8 @@ var configureCodex = async (ctx, model, options = {}) => {
|
|
|
2808
2809
|
if (!check.ok) {
|
|
2809
2810
|
throw failRun(check, "Codex Router smoke test");
|
|
2810
2811
|
}
|
|
2811
|
-
const
|
|
2812
|
-
if (
|
|
2812
|
+
const result10 = parseJson(check, "Codex Router smoke test");
|
|
2813
|
+
if (result10.ok !== true || !result10.results?.some(
|
|
2813
2814
|
(item) => item.name === "basic response" && item.ok === true
|
|
2814
2815
|
)) {
|
|
2815
2816
|
throw new Error(
|
|
@@ -2888,7 +2889,7 @@ import { parseEnv as parseEnv2 } from "util";
|
|
|
2888
2889
|
import { isMap, isSeq, parseDocument, Scalar } from "yaml";
|
|
2889
2890
|
|
|
2890
2891
|
// SKILL.md?raw
|
|
2891
|
-
var SKILL_default = '---\nname: polli\ndescription: Generate images, text, audio, video, and transcribe speech via the Pollinations API using the polli CLI. Use when asked to generate media, call pollinations.ai, check pollen balance, list models, manage API keys, inspect quests, manage agents or my-models, publish a static site, or run polli commands.\nallowed-tools: Bash(polli *)\n---\n\n# polli \u2014 Pollinations CLI\n\nThin wrapper around `gen.pollinations.ai`. Generates images, text, audio, video; transcribes speech; manages API keys, usage, quests, agents, and invite-only my-models.\n\nIf `polli` is not installed, run `npm i -g @pollinations/cli@latest` (provides the `polli` binary).\n\n## When to use this skill\n\n- User asks to **generate an image / text / audio / video** via pollinations\n- User mentions **polli, pollinations, pollen, pollinations.ai**\n- User wants to **transcribe speech** or run TTS\n- User asks about their **pollen balance, usage, or API keys**\n- User wants to **browse or filter available models**\n- User wants to inspect **quests** or manage invite-only **my-models**\n- User wants to create or update a hosted prompt **agent**\n- User wants to **publish a website or web app** they built\n\nFor agent-assisted login, use `polli --json auth login --no-browser`. Read stderr while the command runs and show the user the verification URL and user code so they can review access. On approval, stdout contains one JSON result: `{"authenticated":true}`. Tokens are stored locally and never included in that result.\n\n## Quick reference\n\n| Intent | Command |\n|---|---|\n| Log in once | `polli auth login` |\n| Agent-assisted login | `polli --json auth login --no-browser` |\n| Store an existing key | `printf \'%s\' "$POLLINATIONS_API_KEY" \\| polli auth login --with-token` |\n| Generate image | `polli gen image "<prompt>" --output out.png` |\n| Generate text | `polli gen text "<prompt>"` |\n| Text with stdin as context | `echo "<ctx>" \\| polli gen text "<question>"` |\n| Describe an image (vision) | `polli gen text "what is this?" --image <url>` |\n| One-shot TTS | `polli gen audio "<text>" --output speech.mp3` |\n| Speak out loud | `polli gen audio "<text>" --play` (uses `afplay` on macOS; `ffplay`/`mpv`/`mpg123` on Linux) |\n| Generate video | `polli gen video "<prompt>" --output out.mp4` |\n| Generate a 3D model | `polli gen 3d "<prompt>" --output out.glb` (or `--image <url>` for image-only models) |\n| Embed text | `polli gen embeddings "<text>" ["<text2>" ...]` (one vector per line; also reads stdin) |\n| Change a voice | `polli gen voice-change talk.mp3 --voice nova` |\n| Isolate speech | `polli gen isolate interview.mp4` (strips music/noise) |\n| Speech + character timings | `polli gen audio "<text>" --timestamps` (also writes `speech.mp3.json`) |\n| Transcribe audio | `polli gen transcribe path/to.mp3` |\n| Upload a local file | `polli upload path/to.png` (prints public URL) |\n| List all models | `polli models` |\n| Search models | `polli models <query>` (`--source official\\|community`, `--reliability all`) |\n| Discover voices | `polli models --type audio --voices` (one line per model) |\n| Filter models by type | `polli models --type image` (text, decision, image, audio, video, 3d, embedding, realtime) |\n| Model health + latency | `polli models --stats` (default 60m, `--window <min>`) |\n| Check balance | `polli usage` |\n| Developer earnings | `polli earnings` (`--days <n>`) |\n| List your quests + claim state | `polli quests` (filters: `--open --claimable --claimed --coming-soon`) |\n| Manage prompt agents | `polli agents list` |\n| Manage invite-only community models | `polli my-models list` |\n| Update the CLI | `polli update` (global installs only; npx/local get instructions) |\n| Connect a coding harness to Pollinations | `polli harness <bloom\\|dsh\\|hermes\\|opencode\\|openclaw\\|pi\\|prime\\|tgpt> on` (available adapters: `polli harness --help`) |\n| Start a Linux sandbox (alpha) | `polli sandbox create` (`--timeout <seconds>` to keep it running without ssh, `0` until you pause or kill it; `pollinations-large` as the template for 4 vCPU and 8 GB; then `list`, `logs <id>`, `timeout <id> <seconds>`, `pause <id>`, `kill <id>`); the default template comes logged in, with the coding harnesses |\n| ssh / scp / rsync into a sandbox | `ssh <sandbox-id>.polli`. Port forwarding (`ssh -L 3000:localhost:3000 <sandbox-id>.polli`) and VS Code Remote-SSH work. An open connection keeps the sandbox running and paid; it pauses 15\u201320 minutes after the last one closes (5\u201310 on Windows) |\n| Publish a static site | `polli sites deploy ./dist --name my-app` (prints `https://my-app.pollinations.app`; then `list`, `delete <name>`) |\n| Machine-readable output | append `--json` to any command |\n\n## Setup\n\nOne-time: `polli auth login` (device-flow; creates a key with `profile`, `usage`, and `keys`). To store an existing key, run\n`printf \'%s\' "$POLLINATIONS_API_KEY" | polli auth login --with-token`. Verify\nwith `polli auth status` (or `polli whoami`).\nOverride the stored key for a single command with `--key <key>`, or set `POLLINATIONS_API_KEY` in the environment.\nPrefix any command with `POLLINATIONS_ENV=staging` to use staging; it keeps its own login, so run `POLLINATIONS_ENV=staging polli auth login` once. An exported `POLLINATIONS_API_KEY` wins over both logins.\n\n## Recipes\n\n### Generate an image to a file\n```bash\npolli gen image "a fox reading a book, studio ghibli style" --output fox.png\n```\nDefaults: `tongyi-mai/z-image-turbo`, 1024x1024. Without `--output` the file is `image.<ext>`, with the extension inferred from the response\'s `Content-Type` (`tongyi-mai/z-image-turbo` and `black-forest-labs/flux.1-schnell` return JPEG, so `image.jpg`); an explicit `--output` is used as given. Pick a different model with `--model black-forest-labs/flux.1-schnell` (see `polli models --type image`). For edits / img2img, pass one or more `--image <url>` flags \u2014 **must be public http(s) URLs**, local paths are rejected client-side. **Only models that list `"image"` in `input_modalities` actually consume the flag** \u2014 `black-forest-labs/flux.1-schnell` and `tongyi-mai/z-image-turbo` are text-only and will silently ignore `--image`. Find i2i-capable models with `polli models --type image --json | jq -r \'.[] | select(.input_modalities | contains(["image"])) | .name\'` (common choices: `google/gemini-2.5-flash-image`, `black-forest-labs/flux.1-kontext-pro`, `prunaai/p-image-edit`). To use a local file, upload it first with `polli upload` (see next recipe). **Img2img models may treat `--width`/`--height` as a hint** and keep the source aspect \u2014 check the output with `file`/`ffprobe`; if the aspect matters, pre-crop the source or crop afterwards.\n\n### Upload a local file to get a public URL\n```bash\nURL=$(polli upload cat.png)\npolli gen image "make the cat purple" --image "$URL" --output purple.png\n```\n`polli upload <file>` streams one raw-file request to `media.pollinations.ai` (400 MiB max; 30-day lifecycle, refreshed by GETs once the object is at least 15 days old). Each upload receives a unique id. Human mode: URL on stdout and id/size/contentType on stderr. `--json`: full upload response on stdout. The returned URL is public (no auth to fetch) and works anywhere `--image` is accepted \u2014 `gen image`, `gen video`, etc.\n\n### Generate text\n```bash\npolli gen text "summarize the three laws of robotics"\n```\nSave to file: `--output summary.txt`. Use `--system "<msg>"` to set system prompt. For reasoning models, pass `--reasoning low|medium|high` to control reasoning effort. **Only send `--reasoning` to models where `reasoning: true`** in `polli models --type text --json` \u2014 the flag is not validated client-side, and non-reasoning models may silently accept it (openai), ignore it, or return a 400 (mistral).\n\n### Describe an image with a vision model\n```bash\nURL=$(polli upload selfie.jpg)\npolli gen text "turn this person into a cartoon pet in one playful sentence" --image "$URL"\n```\n`gen text --image <url...>` attaches one or more **public https URLs** as an OpenAI-style multimodal message \u2014 repeatable for multi-image prompts. Local paths aren\'t supported; run them through `polli upload` first (see the upload recipe above). **Only text models with `"image"` in `input_modalities` actually read the image** \u2014 filter with `polli models --type text --json | jq -r \'.[] | select(.input_modalities | index("image")) | .name\'`. Non-vision models silently ignore the attachment. Good defaults: `openai`, `gemini`, `claude`.\n\n### Pipe stdin as context into text generation\n```bash\ncat README.md | polli gen text "what does this project do?"\n```\nstdin becomes context; the positional argument is the question.\n\n### Interactive chat session\n```bash\npolli gen chat --model openai/gpt-5.4-nano --system "you are a terse assistant"\n```\nSlash commands inside the session: `/exit`, `/clear`, `/save <path>`.\n\n### Text-to-speech\n```bash\npolli gen audio "hello world" --voice nova --output hello.mp3\necho "long script" | polli gen audio --voice nova --output out.mp3\n```\nWithout `--voice`, the API uses the model\'s default voice. Voices differ per model: `polli models --type audio --voices` lists each model\'s voices, so pass the matching `--model` with `--voice`. Format defaults to mp3; `--format opus|aac|flac|wav` to change. Accepts stdin (same as `gen text`). Add `--play` to save and then play the audio back (handy for narration/demos). Playback starts after the file is fully written, and the command blocks until playback finishes \u2014 if you want fire-and-forget, wrap in a subshell: `( polli gen audio "..." --play & )`. Player on macOS: `afplay`; on Linux it tries `ffplay`, then `mpv`, then `mpg123` in that order.\n\n### Generate music (elevenlabs/music-v2)\n```bash\npolli gen audio "lofi hip-hop beat" --model elevenlabs/music-v2 --duration 30 --instrumental --output track.mp3\n```\n\n### Generate sound effects (elevenlabs/eleven-text-to-sound-v2)\n```bash\npolli gen audio "thunderclap with heavy rain" --model elevenlabs/eleven-text-to-sound-v2 --duration 5 --output thunder.mp3\n```\nText-to-sound-effect via ElevenLabs (aliases: `sfx`, `sound-effects`). `--duration` 0.5\u201330s (omit to let the model pick). Billed per second of output (~$0.004/s, capped at $0.12 for a full 30s).\n\n### Multilingual TTS (elevenlabs/eleven-multilingual-v2)\n```bash\npolli gen audio "Bonjour, ceci est un test" --model elevenlabs/eleven-multilingual-v2 --voice rachel --output fr.mp3\n```\nStable, lifelike TTS across 29 languages (aliases: `multilingual-v2`, `eleven-v2`) \u2014 a non-alpha alternative to the default v3.\n\n### Estimate the cost before generating\n```bash\npolli gen image "a fox" --model flux --estimate\npolli gen video "a spacecraft landing on mars" --model veo --duration 8 --audio --estimate\n```\n`--estimate` reads the public model list (`/image/models`), prints the estimated Pollen for that request and exits without generating. Per-image, per-megapixel and per-second rates, plus fixed per-generation fees, give a number; token-billed models (e.g. `gpt-image-2`, `nanobanana`) print `estimate: unknown` with their rates, because the charge depends on usage the provider reports afterwards. `--json` adds `pollen` (null when unknown) and the per-rate `lines`.\n\n### Generate video\n```bash\npolli gen video "a spacecraft landing on mars" --model alibaba/wan-2.2-fast --duration 5 --output mars.mp4\n```\nCheapest path: `--model alibaba/wan-2.2-fast` at ~$0.01/sec, **fixed 5-second output** (any `--duration` value is ignored \u2014 you always pay for and receive 5 sec). For image-to-video, pass `--image <url>` with a **public HTTPS URL** (local file paths and 404/rate-limited hosts will fail with a server error).\n\n**Flag support varies per model and is not enforced client-side.** `--duration`, `--aspect-ratio`, and `--audio` are forwarded to the server but may be silently ignored \u2014 verified on `wan-fast` where duration is locked to 5s, `--aspect-ratio 9:16` still returns 16:9, and `--audio` produces no audio track. Always inspect the output (`file`, `ffprobe`) before trusting a flag worked. Check `polli models --type video --json` for per-model capabilities.\n\n**Video is not tracked by `--stats`.** `polli models --type video --stats` returns empty \u2014 the stats pipe only records text/image/audio events. To compare video models, fall back to `polli models --type video --json` and look at price/description fields. The same applies to `--type 3d`.\n\n### Generate a 3D model\n```bash\npolli gen 3d "a red fox" --output fox.glb\npolli gen 3d --image https://media.pollinations.ai/abc --resolution high\n```\n`--model` defaults to `hyper3d/rodin-2.5` for a text-only prompt and `microsoft/trellis-2` once `--image <url>` is given (public http(s), upload local files first with `polli upload`) \u2014 `trellis-2` is **image-to-3D only** and rejects a bare prompt. `--resolution low|medium|high` only affects `trellis-2`. The output extension is inferred from the response\'s `Content-Type`, not the model name: `nvidia/asset-harvester` returns a Gaussian Splat `.ply`, everything else returns `.glb`. `hyper3d/rodin-2.5` and `nvidia/asset-harvester` require Paid Pollen.\n\n### Generate embeddings\n```bash\npolli gen embeddings "first text" "second text" --model google/gemini-embedding-2\nprintf \'first\\nsecond\\n\' | polli gen embeddings # one input per stdin line\n```\nPrints one JSON array per input, in input order, one per line (pipe/`jq`-friendly). `--dimensions <n>` (128-4096), `--task-type` (Gemini retrieval hint), and `--input-type query|document` (Cohere) are optional. `--json` prints the full response including `usage`.\n\n### Change or isolate a voice\n```bash\npolli gen voice-change talk.mp3 --voice nova --format wav\npolli gen isolate interview.mp4\n```\n`voice-change` re-speaks a **local** audio file in another voice (preset name or ElevenLabs voice ID) \u2014 default output `voice.<format>`. `isolate` strips music/background noise from local audio **or video**, keeping only speech \u2014 default output `isolated.mp3`. Both upload the file as multipart form data; ElevenLabs requires **at least 4.6 seconds** of audio for isolation, shorter clips fail with the API\'s `audio_too_short` error.\n\n### Speech with character-level timestamps\n```bash\npolli gen audio "Hello world" --timestamps\n```\nSaves the audio as usual (`speech.mp3` by default) and appends `.json` to its path for the `alignment`/`normalized_alignment` character timings. Only `elevenlabs/eleven-v3`, `elevenlabs/eleven-flash-v2.5`, and `elevenlabs/eleven-multilingual-v2` support this \u2014 other models fail with the API\'s error message.\n\n### Transcribe audio to text\n```bash\npolli gen transcribe recording.mp3 --language en\n```\nModels: `openai/whisper-large-v3` (default), `elevenlabs/scribe-v2`, `assemblyai/universal-2`, `assemblyai/universal-3.5-pro`. Accepts common audio formats (mp3, wav, m4a, flac, ogg); non-audio input (e.g. a `.txt` file) returns a clear `400 invalid_request_error: extension "txt" not supported` \u2014 no need to pre-validate with `file`. Default output is the plain transcript on stdout as a single line (pipe-friendly). Use `--json` for structured output: **whisper** and **AssemblyAI** return timing data when requested through the API; **scribe** returns only `{text: "..."}` \u2014 use whisper or AssemblyAI if you need timing data. `--language <ISO-639-1>` (e.g. `en`, `fr`) is an optional hint that can improve accuracy for non-English or accented speech.\n\n### Discover models\n```bash\npolli models --type text # text models only\npolli models flux # search name, aliases, title, description, publisher\npolli models --source community # official or community only\npolli models --reliability all # also community models failing health checks\npolli models --type audio --voices # voices per model\npolli models --type image --verbose # with publisher, context length, pricing\npolli models --stats # health + avg latency + err% (60m default)\npolli models --stats --window 5 # last 5 minutes only\n```\nUse `--stats` before choosing a model. **Caveat**: the `err%` column counts **5xx only** \u2014 a model can show `0.0%` while having massive 4xx rates (auth, validation, etc.). For the full picture use `--stats --json` and read `errors_4xx`, `errors_5xx`, `latency_p95_ms`.\n\n**Pricing fields are per-token, not per-request.** `completionImageTokens: 0.000008` means each output image-token costs that much \u2014 a single 1024x1024 image from `openai/gpt-image-1-mini` lands at ~$0.008, not $0.000008. Flat-priced image models (`black-forest-labs/flux.1-schnell`, `tongyi-mai/z-image-turbo`) expose `completionImageTokens` as the whole-image price because they emit exactly one "token" per image. When in doubt, make one call and read the true cost from `polli usage --history --limit 5 --json`.\n\n### Check usage and balance\n```bash\npolli usage # current pollen balance\npolli usage --history # recent individual requests\npolli usage --daily # daily cost summary\npolli usage --daily --key polli-harness-claude --days 1 # cost of one harness key for the last day (`--model`, `--csv` filter/export both views; `--key` is repeatable)\npolli earnings # developer earnings total + per-entity breakdown (default 30d)\npolli earnings --days 7 # rolling window\npolli quests # your quests + claim state (open/claimable/claimed/closed/coming)\npolli quests --claimable # only rewards ready to claim\n```\n**History is eventually consistent** \u2014 a request you just made may not appear for 30\u201360s. When matching costs to freshly-generated media, use `--limit 50` and filter by timestamp, and retry if the expected entry is missing. `polli usage --json` returns `{"pollen": <number>}` \u2014 the current balance only; use `--history --json` or `--daily --json` for cost breakdowns. Those print a JSON array of the API usage records (numeric `cost_usd`, `api_key_id`, available per-modality token fields), not the table columns.\n\n### Manage my-models\n```bash\npolli my-models list\npolli my-models models --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY"\npolli my-models create --name my-model --title "My Model" --api chat_completions --url https://api.example.com/v1/chat/completions --bearer-token "$UPSTREAM_KEY" --upstream-model gpt-4.1-mini --required-safety privacy,secrets,sexual,violence,shield\npolli my-models create --name my-image --title "My Image" --modality image --image-pricing request --completion-image-price 0.01 --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --upstream-model flux\npolli my-models update <id> --description "Updated description"\npolli my-models update <id> --paid-only # only accept Paid Pollen; --no-paid-only reverts\npolli my-models update <id> --required-safety privacy,secrets,sexual,violence,shield\npolli my-models delete <id>\n```\n`my-models` manages owned community text, image, and transcription models. Any account can create private models; `communityEndpointsAllowed: true` is required only to publish them. API keys require `account:keys`. Use `account:usage` for narrow read-only usage and `polli quests`; use both permissions when a client needs both read-only account state and admin operations. Quest claiming is dashboard-only; `polli quests` is read-only and account-aware.\n\n### Register an image my-model\n```bash\npolli my-models test --modality image --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --model image-v1\npolli my-models create --name my-image --title "My Image" --modality image --image-pricing request --completion-image-price 0.01 --input-modalities text,image --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --upstream-model image-v1\n```\nTest before creating. The probe reports the pricing mode it detected and the input modalities it found, including whether the endpoint accepts image edits; pass those back as `--input-modalities text,image` to advertise edit support. `polli my-models list` shows them in the `inputs` column.\n\nTwo billing modes: `--image-pricing request` charges `--completion-image-price` per generated image, while `--image-pricing tokens` bills returned token usage per 1M through `--prompt-text-price`, `--prompt-image-price`, and `--completion-image-price`.\n\nPrices only apply to `--visibility public` models. A private model is owner-only and always free, so every price flag above is stored as `0` until you publish \u2014 and making a published model private clears its prices again.\n\n`--modality` is fixed at creation \u2014 `update` cannot change it.\n\n### Manage agents\n\n```bash\npolli agents list\npolli agents get <id>\npolli agents create --config agent.json --name my-agent --title "My Agent"\npolli agents create --config code-agent.json\npolli agents update <id> --config agent.json\npolli agents sync <id>\npolli agents delete <id>\n```\nPrompt-agent config contains `systemPrompt`, `baseModel`, and optional `mcpServers` (add `composio` to act in the caller\'s own accounts, such as a GitHub commit; callers connect apps at https://enter.pollinations.ai/account#connectors); create also requires `--name` and `--title`. Code-agent config contains `type: "code_agent"` and a public GitHub `repository` with `agent.ts` at its root; its model ID, title, and description come from GitHub. Use server IDs from the MCP catalog. Updates are partial: send only the fields to change; the rest keep their values. `sync` deploys the latest GitHub revision of a code agent.\n\nCreating an agent also creates its callable model listing. Managed agents are text-only and free, with no fallbacks or per-user RPM. Deleting the agent also deletes its model listing. See [Publish an Agent](https://github.com/pollinations/pollinations/blob/main/BUILD_YOUR_OWN_AGENT.md).\n\n### Publish a static site\n```bash\nnpm run build\npolli sites deploy ./dist --name my-app --verify # \u2192 https://my-app.pollinations.app\npolli sites list\npolli sites delete my-app\n```\nPublishes a folder of static files with an `index.html`; unknown paths serve `index.html`, so single-page apps route on the client. Deploying the same name again replaces the site and uploads only changed files. Names are 3\u201332 lowercase letters, digits and hyphens, starting with a letter; the first deploy claims the name. Limits: 5 sites per account, 200 MB and 1,000 files per site, 25 MiB per file. Dotfiles and `node_modules` are not uploaded. Sites are public: never put an API key in them. To call Pollinations from a site, let visitors connect through Pollinations Connect and spend their own Pollen (see [Pollinations Pay](https://gen.pollinations.ai/docs/llm.txt?section=byop)). Share the URL the command prints rather than composing one from the name.\n\n`--verify` reads every published file without credentials and compares its bytes to the build, following redirects and retrying failures. The published URL (or site object with `--json`) is printed before verification. A failed check reports that the site is published, exits non-zero and does not roll back.\n\n### Manage API keys\n```bash\npolli keys list # list all keys on the account\npolli keys info # details about the CURRENTLY AUTHENTICATED key only (takes no id)\npolli keys create --name "my-bot" --type secret --budget 1000 --permissions profile usage # scoped key\npolli keys create --name "my-app" --type publishable --redirect-uri https://app.example/callback --earnings\npolli keys create --name "server" --models black-forest-labs/flux.1-schnell tongyi-mai/z-image-turbo # only these two models\npolli keys update <id> --models text black-forest-labs/flux.1-schnell # every text model plus FLUX.1 Schnell\npolli keys revoke <id> # id comes from `keys list --json`\n```\n`--models` takes categories (`text`, `image`, `video`, `audio`, `3d`, `embedding`, `realtime`, `decision`) and model IDs from `polli models`. A category includes models added later; a model ID allows only that model.\n`--permissions <perms...>` scopes what the new key can do on the account (e.g. `profile usage` lets it call `polli --key <new> usage`). **Without `--permissions`, new scoped keys can generate media but cannot read account state** \u2014 `polli --key <new> usage` will 403. Include `keys` to let the new key create, list, and revoke keys itself. Existing keys with `account:keys` can manage my-models where that invite-only feature is enabled, but still need `account:usage` for read-only account state. Publishable app keys default developer earnings off; pass `--earnings` to enable them. To inspect a specific key other than the current one, use `polli keys list --json | jq \'.[] | select(.id == "<id>")\'`. `keys info` is intentionally scoped to the caller\'s own key.\n\n### Connect a coding harness\nPolli defaults to `openai/gpt-6-sol`; `--model <id>` overrides it. Bloom is key-only and keeps its own model selection.\n\n```bash\npolli harness --help # supported harnesses\npolli harness bloom on # create a dedicated key for Bloom CLI\npolli harness dsh on # login if needed, mint key "polli-harness-dsh", write provider + default model\npolli harness dsh on --model moonshotai/kimi-k2.6 # use the model ID from `polli models`\npolli harness dsh on --no-mcp # configure the provider and skill without MCP tools\npolli harness dsh off # restore the config backed up before "on"\npolli harness hermes on # login if needed, mint key "polli-harness-hermes", add provider + Polli skill\npolli harness hermes on --model deepseek/deepseek-v4-flash # use the model ID from `polli models`\npolli harness hermes off # restore the config backed up before "on"\npolli harness opencode on # add the Pollinations provider (OpenCode 1.x and 2.x)\npolli harness opencode off # remove the provider setup and stored key\npolli harness pi on # login if needed, mint key "polli-harness-pi", configure Pi with Pollinations\npolli harness pi on --model moonshotai/kimi-k2.6 # use the model ID from `polli models`\npolli harness pi off # restore the Pi config backed up before "on"\npolli harness openclaw on # login if needed, mint key "polli-harness-openclaw", add provider + Polli skill\npolli harness openclaw off # remove the Pollinations provider, key, and skill\npolli harness tgpt on # use tgpt\'s Pollinations provider with a dedicated key\npolli harness tgpt off # restore tgpt\'s previous configuration\n```\nEach adapter checks that its harness can be launched before login, key creation, or configuration. DSH\'s official launch uses `npx`, so its adapter checks for `npx`; Bloom, Hermes Agent, OpenCode, OpenClaw, Pi, and tgpt require their installed commands.\n\nBloom already uses Pollinations and only needs a dedicated key in `$BLOOM_HOME/.env` (default `~/.bloom/.env`). tgpt\'s existing Pollinations provider is selected in `~/.config/tgpt/config.conf` with a dedicated key and model. The DSH adapter globally configures the Pollinations provider, hosted Pollinations MCP, and this skill under `$DSH_HOME` (default `~/.dsh`). OpenCode adds a `pollinations` provider (read by both 1.x and 2.x) and stores its dedicated key in the provider\'s options. OpenClaw adds a `pollinations` provider to `~/.openclaw/openclaw.json`, stores a dedicated key in `env.vars`, and installs this skill under `~/.openclaw/skills/polli/`. Pi writes `~/.pi/agent/models.json`, `auth.json`, and `settings.json`, and installs this skill under `~/.pi/agent/skills/polli/`. Guide: `polli docs` section "Coding Harnesses".\n\n### Read API docs\n```bash\npolli docs # full llm.txt reference\npolli docs /v1/chat/completions # filter to one endpoint\npolli docs --open # open in browser\n```\n\n## Output contract\n\n- **Default (human mode):** varies by command \u2014 most emit `key: value` pairs or tab-separated tables with a header row. Exceptions: `gen text` prints the full response to stdout; `gen transcribe` prints the transcript as plain text; `gen chat` runs an interactive REPL. Status/progress messages go to stderr, so pipes stay clean.\n- **`--json`:** every command emits machine-parseable JSON to stdout; all human messages go to stderr. **Always prefer `--json` when piping into `jq` or parsing** \u2014 it\'s the only shape with a stable contract.\n- **Exit codes:** 0 on success, non-zero on auth failure, rate limit, network error, or invalid args. Error messages go to stderr.\n\n## Agent operating rules\n\n1. **Run `polli auth status` (or `polli whoami`) first** if you don\'t know whether the user is logged in. Fail fast with a clear "run `polli auth login`" message if not.\n2. **Prefer `--json`** whenever you\'ll parse the output. Never grep human-formatted tables.\n3. **Don\'t hardcode model IDs.** Fetch the live list with `polli models --type <type>`. Model availability changes.\n4. **Before picking a model for production use, check `polli models --stats`.** Rule of thumb for "healthy": `err%` \u2264 5, `avg` latency in a reasonable range for the modality (standard text <5s, image <10s, video <60s), and `requests` high enough to be statistically meaningful (ignore rows with <10 requests \u2014 noise). **Filter by capability first, then optimize by health** \u2014 e.g. for a reasoning task, narrow to models where `reasoning: true` (via `polli models --type text --json`), *then* cross-reference against `--stats` output. The healthiest model overall may not support the capability you need. **Reasoning models are inherently slower \u2014 expect 5\u201350s, not <5s**; when picking among them, prioritize low `err%` and request count over raw latency, and compare latency only within the reasoning-capable subset.\n5. **Always pass `--output <path>`** for `gen image`, `gen audio`, `gen video` \u2014 otherwise the file lands in the current directory with a default name.\n6. **For stdin-as-context** on `gen text`, pipe the context and pass the question as the positional argument: `cat file | polli gen text "question about the file"`.\n7. **For exact flag lists, run `polli <cmd> --help` or `polli gen <cmd> --help`.** This skill\'s recipes cover the common path; the CLI\'s own help is always the source of truth.\n8. **Use `polli docs [endpoint]` over guessing API shapes.** It prints the canonical `llm.txt` reference from the live API.\n\n## Common pitfalls\n\n- Forgetting `--output` on binary generators (image/audio/video) \u2014 the file goes to a default path, which may not be what the user wants.\n- Using `polli gen text --json` expecting OpenAI chat-completions shape \u2014 the CLI\'s `--json` wraps its own structure. Use `polli docs /v1/chat/completions` to see the raw API shape if you need it.\n- Running commands without auth \u2014 `polli auth status` / `polli whoami` tells you who you\'re logged in as and your balance in one call.\n- **`gen text` streams to a TTY, buffers when piped.** The default now auto-detects \u2014 a human at the terminal sees tokens tick in, a pipe/redirect gets the full response once. Force either mode with `--stream` or `--no-stream`. For scripts and chains like `polli gen text \u2026 | polli gen audio \u2026`, you don\'t need to do anything; buffering happens automatically.\n- **Translating a `polli` workflow into a browser app.** `gen.pollinations.ai` requires a bearer token for generation requests, so a plain client-side `fetch` with no auth returns 401 unless it is served from cache. Mint a scoped key with `polli keys create` and proxy via your own backend.\n- **Backgrounded `polli gen` can fail silently** \u2014 no output file, empty log, no error (a safety rejection is an explicit 400). Run in the foreground; if backgrounded, check the `--output` file exists and retry once in the foreground before calling it failed.\n- **Content-safety 400s aren\'t only about violence.** Body-focused action phrasing can trip a sexual-content category on some edit models. Rephrase the benign intent neutrally (e.g. sport framing) and retry with a new seed.\n';
|
|
2892
|
+
var SKILL_default = '---\nname: polli\ndescription: Generate images, text, audio, video, and transcribe speech via the Pollinations API using the polli CLI. Use when asked to generate media, call pollinations.ai, check pollen balance, list models, manage API keys, inspect quests, manage agents or my-models, publish a static site, or run polli commands.\nallowed-tools: Bash(polli *)\n---\n\n# polli \u2014 Pollinations CLI\n\nThin wrapper around `gen.pollinations.ai`. Generates images, text, audio, video; transcribes speech; manages API keys, usage, quests, agents, and invite-only my-models.\n\nIf `polli` is not installed, run `npm i -g @pollinations/cli@latest` (provides the `polli` binary).\n\n## When to use this skill\n\n- User asks to **generate an image / text / audio / video** via pollinations\n- User mentions **polli, pollinations, pollen, pollinations.ai**\n- User wants to **transcribe speech** or run TTS\n- User asks about their **pollen balance, usage, or API keys**\n- User wants to **browse or filter available models**\n- User wants to inspect **quests** or manage invite-only **my-models**\n- User wants to create or update a hosted prompt **agent**\n- User wants to **publish a website or web app** they built\n\nFor agent-assisted login, use `polli --json auth login --no-browser`. Read stderr while the command runs and show the user the verification URL and user code so they can review access. On approval, stdout contains one JSON result: `{"authenticated":true}`. Tokens are stored locally and never included in that result.\n\n## Quick reference\n\n| Intent | Command |\n|---|---|\n| Log in once | `polli auth login` |\n| Agent-assisted login | `polli --json auth login --no-browser` |\n| Store an existing key | `printf \'%s\' "$POLLINATIONS_API_KEY" \\| polli auth login --with-token` |\n| Generate image | `polli gen image "<prompt>" --output out.png` |\n| Generate text | `polli gen text "<prompt>"` |\n| Text with stdin as context | `echo "<ctx>" \\| polli gen text "<question>"` |\n| Describe an image (vision) | `polli gen text "what is this?" --image <url>` |\n| One-shot TTS | `polli gen audio "<text>" --output speech.mp3` |\n| Speak out loud | `polli gen audio "<text>" --play` (uses `afplay` on macOS; `ffplay`/`mpv`/`mpg123` on Linux) |\n| Generate video | `polli gen video "<prompt>" --output out.mp4` |\n| Generate a 3D model | `polli gen 3d "<prompt>" --output out.glb` (or `--image <url>` for image-only models) |\n| Embed text | `polli gen embeddings "<text>" ["<text2>" ...]` (one vector per line; also reads stdin) |\n| Change a voice | `polli gen voice-change talk.mp3 --voice nova` |\n| Isolate speech | `polli gen isolate interview.mp4` (strips music/noise) |\n| Speech + character timings | `polli gen audio "<text>" --timestamps` (also writes `speech.mp3.json`) |\n| Transcribe audio | `polli gen transcribe path/to.mp3` |\n| Upload a local file | `polli upload path/to.png` (prints public URL) |\n| List all models | `polli models` |\n| Search models | `polli models <query>` (`--source official\\|community`, `--reliability all`) |\n| Discover voices | `polli models --type audio --voices` (one line per model) |\n| Filter models by type | `polli models --type image` (text, decision, image, audio, video, 3d, embedding, realtime) |\n| Model health + latency | `polli models --stats` (default 60m, `--window <min>`) |\n| Check balance | `polli usage` |\n| Developer earnings | `polli earnings` (`--days <n>`) |\n| List your quests + claim state | `polli quests` (filters: `--open --claimable --claimed --coming-soon`) |\n| Manage prompt agents | `polli agents list` |\n| Manage invite-only community models | `polli my-models list` |\n| Update the CLI | `polli update` (global installs only; npx/local get instructions) |\n| Connect a coding harness to Pollinations | `polli harness <bloom\\|dsh\\|hermes\\|opencode\\|openclaw\\|pi\\|prime\\|tgpt\\|vibe> on` (available adapters: `polli harness --help`) |\n| Start a Linux sandbox (alpha) | `polli sandbox create` (`--timeout <seconds>` to keep it running without ssh, `0` until you pause or kill it; `pollinations-large` as the template for 4 vCPU and 8 GB; then `list`, `logs <id>`, `timeout <id> <seconds>`, `pause <id>`, `kill <id>`); the default template comes logged in, with the coding harnesses |\n| ssh / scp / rsync into a sandbox | `ssh <sandbox-id>.polli`. Port forwarding (`ssh -L 3000:localhost:3000 <sandbox-id>.polli`) and VS Code Remote-SSH work. An open connection keeps the sandbox running and paid; it pauses 15\u201320 minutes after the last one closes (5\u201310 on Windows) |\n| Publish a static site | `polli sites deploy ./dist --name my-app` (prints `https://my-app.pollinations.app`; then `list`, `delete <name>`) |\n| Machine-readable output | append `--json` to any command |\n\n## Setup\n\nOne-time: `polli auth login` (device-flow; creates a key with `profile`, `usage`, and `keys`). To store an existing key, run\n`printf \'%s\' "$POLLINATIONS_API_KEY" | polli auth login --with-token`. Verify\nwith `polli auth status` (or `polli whoami`).\nOverride the stored key for a single command with `--key <key>`, or set `POLLINATIONS_API_KEY` in the environment.\nPrefix any command with `POLLINATIONS_ENV=staging` to use staging; it keeps its own login, so run `POLLINATIONS_ENV=staging polli auth login` once. An exported `POLLINATIONS_API_KEY` wins over both logins.\n\n## Recipes\n\n### Generate an image to a file\n```bash\npolli gen image "a fox reading a book, studio ghibli style" --output fox.png\n```\nDefaults: `tongyi-mai/z-image-turbo`, 1024x1024. Without `--output` the file is `image.<ext>`, with the extension inferred from the response\'s `Content-Type` (`tongyi-mai/z-image-turbo` and `black-forest-labs/flux.1-schnell` return JPEG, so `image.jpg`); an explicit `--output` is used as given. Pick a different model with `--model black-forest-labs/flux.1-schnell` (see `polli models --type image`). For edits / img2img, pass one or more `--image <url>` flags \u2014 **must be public http(s) URLs**, local paths are rejected client-side. **Only models that list `"image"` in `input_modalities` actually consume the flag** \u2014 `black-forest-labs/flux.1-schnell` and `tongyi-mai/z-image-turbo` are text-only and will silently ignore `--image`. Find i2i-capable models with `polli models --type image --json | jq -r \'.[] | select(.input_modalities | contains(["image"])) | .name\'` (common choices: `google/gemini-2.5-flash-image`, `black-forest-labs/flux.1-kontext-pro`, `prunaai/p-image-edit`). To use a local file, upload it first with `polli upload` (see next recipe). **Img2img models may treat `--width`/`--height` as a hint** and keep the source aspect \u2014 check the output with `file`/`ffprobe`; if the aspect matters, pre-crop the source or crop afterwards.\n\n### Upload a local file to get a public URL\n```bash\nURL=$(polli upload cat.png)\npolli gen image "make the cat purple" --image "$URL" --output purple.png\n```\n`polli upload <file>` streams one raw-file request to `media.pollinations.ai` (400 MiB max; 30-day lifecycle, refreshed by GETs once the object is at least 15 days old). Each upload receives a unique id. Human mode: URL on stdout and id/size/contentType on stderr. `--json`: full upload response on stdout. The returned URL is public (no auth to fetch) and works anywhere `--image` is accepted \u2014 `gen image`, `gen video`, etc.\n\n### Generate text\n```bash\npolli gen text "summarize the three laws of robotics"\n```\nSave to file: `--output summary.txt`. Use `--system "<msg>"` to set system prompt. For reasoning models, pass `--reasoning low|medium|high` to control reasoning effort. **Only send `--reasoning` to models where `reasoning: true`** in `polli models --type text --json` \u2014 the flag is not validated client-side, and non-reasoning models may silently accept it (openai), ignore it, or return a 400 (mistral).\n\n### Describe an image with a vision model\n```bash\nURL=$(polli upload selfie.jpg)\npolli gen text "turn this person into a cartoon pet in one playful sentence" --image "$URL"\n```\n`gen text --image <url...>` attaches one or more **public https URLs** as an OpenAI-style multimodal message \u2014 repeatable for multi-image prompts. Local paths aren\'t supported; run them through `polli upload` first (see the upload recipe above). **Only text models with `"image"` in `input_modalities` actually read the image** \u2014 filter with `polli models --type text --json | jq -r \'.[] | select(.input_modalities | index("image")) | .name\'`. Non-vision models silently ignore the attachment. Good defaults: `openai`, `gemini`, `claude`.\n\n### Pipe stdin as context into text generation\n```bash\ncat README.md | polli gen text "what does this project do?"\n```\nstdin becomes context; the positional argument is the question.\n\n### Interactive chat session\n```bash\npolli gen chat --model openai/gpt-5.4-nano --system "you are a terse assistant"\n```\nSlash commands inside the session: `/exit`, `/clear`, `/save <path>`.\n\n### Text-to-speech\n```bash\npolli gen audio "hello world" --voice nova --output hello.mp3\necho "long script" | polli gen audio --voice nova --output out.mp3\n```\nWithout `--voice`, the API uses the model\'s default voice. Voices differ per model: `polli models --type audio --voices` lists each model\'s voices, so pass the matching `--model` with `--voice`. Format defaults to mp3; `--format opus|aac|flac|wav` to change. Accepts stdin (same as `gen text`). Add `--play` to save and then play the audio back (handy for narration/demos). Playback starts after the file is fully written, and the command blocks until playback finishes \u2014 if you want fire-and-forget, wrap in a subshell: `( polli gen audio "..." --play & )`. Player on macOS: `afplay`; on Linux it tries `ffplay`, then `mpv`, then `mpg123` in that order.\n\n### Generate music (elevenlabs/music-v2)\n```bash\npolli gen audio "lofi hip-hop beat" --model elevenlabs/music-v2 --duration 30 --instrumental --output track.mp3\n```\n\n### Generate sound effects (elevenlabs/eleven-text-to-sound-v2)\n```bash\npolli gen audio "thunderclap with heavy rain" --model elevenlabs/eleven-text-to-sound-v2 --duration 5 --output thunder.mp3\n```\nText-to-sound-effect via ElevenLabs (aliases: `sfx`, `sound-effects`). `--duration` 0.5\u201330s (omit to let the model pick). Billed per second of output (~$0.004/s, capped at $0.12 for a full 30s).\n\n### Multilingual TTS (elevenlabs/eleven-multilingual-v2)\n```bash\npolli gen audio "Bonjour, ceci est un test" --model elevenlabs/eleven-multilingual-v2 --voice rachel --output fr.mp3\n```\nStable, lifelike TTS across 29 languages (aliases: `multilingual-v2`, `eleven-v2`) \u2014 a non-alpha alternative to the default v3.\n\n### Estimate the cost before generating\n```bash\npolli gen image "a fox" --model flux --estimate\npolli gen video "a spacecraft landing on mars" --model veo --duration 8 --audio --estimate\n```\n`--estimate` reads the public model list (`/image/models`), prints the estimated Pollen for that request and exits without generating. Per-image, per-megapixel and per-second rates, plus fixed per-generation fees, give a number; token-billed models (e.g. `gpt-image-2`, `nanobanana`) print `estimate: unknown` with their rates, because the charge depends on usage the provider reports afterwards. `--json` adds `pollen` (null when unknown) and the per-rate `lines`.\n\n### Generate video\n```bash\npolli gen video "a spacecraft landing on mars" --model alibaba/wan-2.2-fast --duration 5 --output mars.mp4\n```\nCheapest path: `--model alibaba/wan-2.2-fast` at ~$0.01/sec, **fixed 5-second output** (any `--duration` value is ignored \u2014 you always pay for and receive 5 sec). For image-to-video, pass `--image <url>` with a **public HTTPS URL** (local file paths and 404/rate-limited hosts will fail with a server error).\n\n**Flag support varies per model and is not enforced client-side.** `--duration`, `--aspect-ratio`, and `--audio` are forwarded to the server but may be silently ignored \u2014 verified on `wan-fast` where duration is locked to 5s, `--aspect-ratio 9:16` still returns 16:9, and `--audio` produces no audio track. Always inspect the output (`file`, `ffprobe`) before trusting a flag worked. Check `polli models --type video --json` for per-model capabilities.\n\n**Video is not tracked by `--stats`.** `polli models --type video --stats` returns empty \u2014 the stats pipe only records text/image/audio events. To compare video models, fall back to `polli models --type video --json` and look at price/description fields. The same applies to `--type 3d`.\n\n### Generate a 3D model\n```bash\npolli gen 3d "a red fox" --output fox.glb\npolli gen 3d --image https://media.pollinations.ai/abc --resolution high\n```\n`--model` defaults to `hyper3d/rodin-2.5` for a text-only prompt and `microsoft/trellis-2` once `--image <url>` is given (public http(s), upload local files first with `polli upload`) \u2014 `trellis-2` is **image-to-3D only** and rejects a bare prompt. `--resolution low|medium|high` only affects `trellis-2`. The output extension is inferred from the response\'s `Content-Type`, not the model name: `nvidia/asset-harvester` returns a Gaussian Splat `.ply`, everything else returns `.glb`. `hyper3d/rodin-2.5` and `nvidia/asset-harvester` require Paid Pollen.\n\n### Generate embeddings\n```bash\npolli gen embeddings "first text" "second text" --model google/gemini-embedding-2\nprintf \'first\\nsecond\\n\' | polli gen embeddings # one input per stdin line\n```\nPrints one JSON array per input, in input order, one per line (pipe/`jq`-friendly). `--dimensions <n>` (128-4096), `--task-type` (Gemini retrieval hint), and `--input-type query|document` (Cohere) are optional. `--json` prints the full response including `usage`.\n\n### Change or isolate a voice\n```bash\npolli gen voice-change talk.mp3 --voice nova --format wav\npolli gen isolate interview.mp4\n```\n`voice-change` re-speaks a **local** audio file in another voice (preset name or ElevenLabs voice ID) \u2014 default output `voice.<format>`. `isolate` strips music/background noise from local audio **or video**, keeping only speech \u2014 default output `isolated.mp3`. Both upload the file as multipart form data; ElevenLabs requires **at least 4.6 seconds** of audio for isolation, shorter clips fail with the API\'s `audio_too_short` error.\n\n### Speech with character-level timestamps\n```bash\npolli gen audio "Hello world" --timestamps\n```\nSaves the audio as usual (`speech.mp3` by default) and appends `.json` to its path for the `alignment`/`normalized_alignment` character timings. Only `elevenlabs/eleven-v3`, `elevenlabs/eleven-flash-v2.5`, and `elevenlabs/eleven-multilingual-v2` support this \u2014 other models fail with the API\'s error message.\n\n### Transcribe audio to text\n```bash\npolli gen transcribe recording.mp3 --language en\n```\nModels: `openai/whisper-large-v3` (default), `elevenlabs/scribe-v2`, `assemblyai/universal-2`, `assemblyai/universal-3.5-pro`. Accepts common audio formats (mp3, wav, m4a, flac, ogg); non-audio input (e.g. a `.txt` file) returns a clear `400 invalid_request_error: extension "txt" not supported` \u2014 no need to pre-validate with `file`. Default output is the plain transcript on stdout as a single line (pipe-friendly). Use `--json` for structured output: **whisper** and **AssemblyAI** return timing data when requested through the API; **scribe** returns only `{text: "..."}` \u2014 use whisper or AssemblyAI if you need timing data. `--language <ISO-639-1>` (e.g. `en`, `fr`) is an optional hint that can improve accuracy for non-English or accented speech.\n\n### Discover models\n```bash\npolli models --type text # text models only\npolli models flux # search name, aliases, title, description, publisher\npolli models --source community # official or community only\npolli models --reliability all # also community models failing health checks\npolli models --type audio --voices # voices per model\npolli models --type image --verbose # with publisher, context length, pricing\npolli models --stats # health + avg latency + err% (60m default)\npolli models --stats --window 5 # last 5 minutes only\n```\nUse `--stats` before choosing a model. **Caveat**: the `err%` column counts **5xx only** \u2014 a model can show `0.0%` while having massive 4xx rates (auth, validation, etc.). For the full picture use `--stats --json` and read `errors_4xx`, `errors_5xx`, `latency_p95_ms`.\n\n**Pricing fields are per-token, not per-request.** `completionImageTokens: 0.000008` means each output image-token costs that much \u2014 a single 1024x1024 image from `openai/gpt-image-1-mini` lands at ~$0.008, not $0.000008. Flat-priced image models (`black-forest-labs/flux.1-schnell`, `tongyi-mai/z-image-turbo`) expose `completionImageTokens` as the whole-image price because they emit exactly one "token" per image. When in doubt, make one call and read the true cost from `polli usage --history --limit 5 --json`.\n\n### Check usage and balance\n```bash\npolli usage # current pollen balance\npolli usage --history # recent individual requests\npolli usage --daily # daily cost summary\npolli usage --daily --key polli-harness-claude --days 1 # cost of one harness key for the last day (`--model`, `--csv` filter/export both views; `--key` is repeatable)\npolli earnings # developer earnings total + per-entity breakdown (default 30d)\npolli earnings --days 7 # rolling window\npolli quests # your quests + claim state (open/claimable/claimed/closed/coming)\npolli quests --claimable # only rewards ready to claim\n```\n**History is eventually consistent** \u2014 a request you just made may not appear for 30\u201360s. When matching costs to freshly-generated media, use `--limit 50` and filter by timestamp, and retry if the expected entry is missing. `polli usage --json` returns `{"pollen": <number>}` \u2014 the current balance only; use `--history --json` or `--daily --json` for cost breakdowns. Those print a JSON array of the API usage records (numeric `cost_usd`, `api_key_id`, available per-modality token fields), not the table columns.\n\n### Manage my-models\n```bash\npolli my-models list\npolli my-models models --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY"\npolli my-models create --name my-model --title "My Model" --api chat_completions --url https://api.example.com/v1/chat/completions --bearer-token "$UPSTREAM_KEY" --upstream-model gpt-4.1-mini --required-safety privacy,secrets,sexual,violence,shield\npolli my-models create --name my-image --title "My Image" --modality image --image-pricing request --completion-image-price 0.01 --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --upstream-model flux\npolli my-models update <id> --description "Updated description"\npolli my-models update <id> --paid-only # only accept Paid Pollen; --no-paid-only reverts\npolli my-models update <id> --required-safety privacy,secrets,sexual,violence,shield\npolli my-models delete <id>\n```\n`my-models` manages owned community text, image, and transcription models. Any account can create private models; `communityEndpointsAllowed: true` is required only to publish them. API keys require `account:keys`. Use `account:usage` for narrow read-only usage and `polli quests`; use both permissions when a client needs both read-only account state and admin operations. Quest claiming is dashboard-only; `polli quests` is read-only and account-aware.\n\n### Register an image my-model\n```bash\npolli my-models test --modality image --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --model image-v1\npolli my-models create --name my-image --title "My Image" --modality image --image-pricing request --completion-image-price 0.01 --input-modalities text,image --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --upstream-model image-v1\n```\nTest before creating. The probe reports the pricing mode it detected and the input modalities it found, including whether the endpoint accepts image edits; pass those back as `--input-modalities text,image` to advertise edit support. `polli my-models list` shows them in the `inputs` column.\n\nTwo billing modes: `--image-pricing request` charges `--completion-image-price` per generated image, while `--image-pricing tokens` bills returned token usage per 1M through `--prompt-text-price`, `--prompt-image-price`, and `--completion-image-price`.\n\nPrices only apply to `--visibility public` models. A private model is owner-only and always free, so every price flag above is stored as `0` until you publish \u2014 and making a published model private clears its prices again.\n\n`--modality` is fixed at creation \u2014 `update` cannot change it.\n\n### Manage agents\n\n```bash\npolli agents list\npolli agents get <id>\npolli agents create --config agent.json --name my-agent --title "My Agent"\npolli agents create --config code-agent.json\npolli agents update <id> --config agent.json\npolli agents sync <id>\npolli agents delete <id>\n```\nPrompt-agent config contains `systemPrompt`, `baseModel`, and optional `mcpServers` (add `composio` to act in the caller\'s own accounts, such as a GitHub commit; callers connect apps at https://enter.pollinations.ai/account#connectors); create also requires `--name` and `--title`. Code-agent config contains `type: "code_agent"` and a public GitHub `repository` with `agent.ts` at its root; its model ID, title, and description come from GitHub. Use server IDs from the MCP catalog. Updates are partial: send only the fields to change; the rest keep their values. `sync` deploys the latest GitHub revision of a code agent.\n\nCreating an agent also creates its callable model listing. Managed agents are text-only and free, with no fallbacks or per-user RPM. Deleting the agent also deletes its model listing. See [Publish an Agent](https://github.com/pollinations/pollinations/blob/main/BUILD_YOUR_OWN_AGENT.md).\n\n### Publish a static site\n```bash\nnpm run build\npolli sites deploy ./dist --name my-app --verify # \u2192 https://my-app.pollinations.app\npolli sites list\npolli sites delete my-app\n```\nPublishes a folder of static files with an `index.html`; unknown paths serve `index.html`, so single-page apps route on the client. Deploying the same name again replaces the site and uploads only changed files. Names are 3\u201332 lowercase letters, digits and hyphens, starting with a letter; the first deploy claims the name. Limits: 5 sites per account, 200 MB and 1,000 files per site, 25 MiB per file. Dotfiles and `node_modules` are not uploaded. Sites are public: never put an API key in them. To call Pollinations from a site, let visitors connect through Pollinations Connect and spend their own Pollen (see [Pollinations Pay](https://gen.pollinations.ai/docs/llm.txt?section=byop)). Share the URL the command prints rather than composing one from the name.\n\n`--verify` reads every published file without credentials and compares its bytes to the build, following redirects and retrying failures. The published URL (or site object with `--json`) is printed before verification. A failed check reports that the site is published, exits non-zero and does not roll back.\n\n### Manage API keys\n```bash\npolli keys list # list all keys on the account\npolli keys info # details about the CURRENTLY AUTHENTICATED key only (takes no id)\npolli keys create --name "my-bot" --type secret --budget 1000 --permissions profile usage # scoped key\npolli keys create --name "my-app" --type publishable --redirect-uri https://app.example/callback --earnings\npolli keys create --name "server" --models black-forest-labs/flux.1-schnell tongyi-mai/z-image-turbo # only these two models\npolli keys update <id> --models text black-forest-labs/flux.1-schnell # every text model plus FLUX.1 Schnell\npolli keys revoke <id> # id comes from `keys list --json`\n```\n`--models` takes categories (`text`, `image`, `video`, `audio`, `3d`, `embedding`, `realtime`, `decision`) and model IDs from `polli models`. A category includes models added later; a model ID allows only that model.\n`--permissions <perms...>` scopes what the new key can do on the account (e.g. `profile usage` lets it call `polli --key <new> usage`). **Without `--permissions`, new scoped keys can generate media but cannot read account state** \u2014 `polli --key <new> usage` will 403. Include `keys` to let the new key create, list, and revoke keys itself. Existing keys with `account:keys` can manage my-models where that invite-only feature is enabled, but still need `account:usage` for read-only account state. Publishable app keys default developer earnings off; pass `--earnings` to enable them. To inspect a specific key other than the current one, use `polli keys list --json | jq \'.[] | select(.id == "<id>")\'`. `keys info` is intentionally scoped to the caller\'s own key.\n\n### Connect a coding harness\nPolli defaults to `openai/gpt-6-sol`; `--model <id>` overrides it. Bloom is key-only and keeps its own model selection.\n\n```bash\npolli harness --help # supported harnesses\npolli harness bloom on # create a dedicated key for Bloom CLI\npolli harness dsh on # login if needed, mint key "polli-harness-dsh", write provider + default model\npolli harness dsh on --model moonshotai/kimi-k2.6 # use the model ID from `polli models`\npolli harness dsh on --no-mcp # configure the provider and skill without MCP tools\npolli harness dsh off # restore the config backed up before "on"\npolli harness hermes on # login if needed, mint key "polli-harness-hermes", add provider + Polli skill\npolli harness hermes on --model deepseek/deepseek-v4-flash # use the model ID from `polli models`\npolli harness hermes off # restore the config backed up before "on"\npolli harness opencode on # add the Pollinations provider (OpenCode 1.x and 2.x)\npolli harness opencode off # remove the provider setup and stored key\npolli harness pi on # login if needed, mint key "polli-harness-pi", configure Pi with Pollinations\npolli harness pi on --model moonshotai/kimi-k2.6 # use the model ID from `polli models`\npolli harness pi off # restore the Pi config backed up before "on"\npolli harness openclaw on # login if needed, mint key "polli-harness-openclaw", add provider + Polli skill\npolli harness openclaw off # remove the Pollinations provider, key, and skill\npolli harness tgpt on # use tgpt\'s Pollinations provider with a dedicated key\npolli harness tgpt off # restore tgpt\'s previous configuration\npolli harness vibe on # Mistral Vibe provider, live models, dedicated key, and Polli skill\npolli harness vibe on --model deepseek/deepseek-v4-flash\npolli harness vibe off # restore Vibe\'s previous user configuration\n```\nEach adapter checks that its harness can be launched before login, key creation, or configuration. DSH\'s official launch uses `npx`, so its adapter checks for `npx`; Bloom, Hermes Agent, OpenCode, OpenClaw, Pi, tgpt, and Mistral Vibe require their installed commands.\n\nMistral Vibe writes `$VIBE_HOME/config.toml`, `.env`, and `skills/polli/` (default `~/.vibe`), using the native OpenAI-compatible provider. Session titles and smart approval use the selected Pollinations model too. Restart Vibe afterward; project, agent, admin, and environment overrides still take precedence. Setup reformats TOML; `off` restores untouched files or strips only the Pollinations setup after edits. Install with `uv tool install mistral-vibe`.\n\nBloom already uses Pollinations and only needs a dedicated key in `$BLOOM_HOME/.env` (default `~/.bloom/.env`). tgpt\'s existing Pollinations provider is selected in `~/.config/tgpt/config.conf` with a dedicated key and model. The DSH adapter globally configures the Pollinations provider, hosted Pollinations MCP, and this skill under `$DSH_HOME` (default `~/.dsh`). OpenCode adds a `pollinations` provider (read by both 1.x and 2.x) and stores its dedicated key in the provider\'s options. OpenClaw adds a `pollinations` provider to `~/.openclaw/openclaw.json`, stores a dedicated key in `env.vars`, and installs this skill under `~/.openclaw/skills/polli/`. Pi writes `~/.pi/agent/models.json`, `auth.json`, and `settings.json`, and installs this skill under `~/.pi/agent/skills/polli/`. Guide: `polli docs` section "Coding Harnesses".\n\n### Read API docs\n```bash\npolli docs # full llm.txt reference\npolli docs /v1/chat/completions # filter to one endpoint\npolli docs --open # open in browser\n```\n\n## Output contract\n\n- **Default (human mode):** varies by command \u2014 most emit `key: value` pairs or tab-separated tables with a header row. Exceptions: `gen text` prints the full response to stdout; `gen transcribe` prints the transcript as plain text; `gen chat` runs an interactive REPL. Status/progress messages go to stderr, so pipes stay clean.\n- **`--json`:** every command emits machine-parseable JSON to stdout; all human messages go to stderr. **Always prefer `--json` when piping into `jq` or parsing** \u2014 it\'s the only shape with a stable contract.\n- **Exit codes:** 0 on success, non-zero on auth failure, rate limit, network error, or invalid args. Error messages go to stderr.\n\n## Agent operating rules\n\n1. **Run `polli auth status` (or `polli whoami`) first** if you don\'t know whether the user is logged in. Fail fast with a clear "run `polli auth login`" message if not.\n2. **Prefer `--json`** whenever you\'ll parse the output. Never grep human-formatted tables.\n3. **Don\'t hardcode model IDs.** Fetch the live list with `polli models --type <type>`. Model availability changes.\n4. **Before picking a model for production use, check `polli models --stats`.** Rule of thumb for "healthy": `err%` \u2264 5, `avg` latency in a reasonable range for the modality (standard text <5s, image <10s, video <60s), and `requests` high enough to be statistically meaningful (ignore rows with <10 requests \u2014 noise). **Filter by capability first, then optimize by health** \u2014 e.g. for a reasoning task, narrow to models where `reasoning: true` (via `polli models --type text --json`), *then* cross-reference against `--stats` output. The healthiest model overall may not support the capability you need. **Reasoning models are inherently slower \u2014 expect 5\u201350s, not <5s**; when picking among them, prioritize low `err%` and request count over raw latency, and compare latency only within the reasoning-capable subset.\n5. **Always pass `--output <path>`** for `gen image`, `gen audio`, `gen video` \u2014 otherwise the file lands in the current directory with a default name.\n6. **For stdin-as-context** on `gen text`, pipe the context and pass the question as the positional argument: `cat file | polli gen text "question about the file"`.\n7. **For exact flag lists, run `polli <cmd> --help` or `polli gen <cmd> --help`.** This skill\'s recipes cover the common path; the CLI\'s own help is always the source of truth.\n8. **Use `polli docs [endpoint]` over guessing API shapes.** It prints the canonical `llm.txt` reference from the live API.\n\n## Common pitfalls\n\n- Forgetting `--output` on binary generators (image/audio/video) \u2014 the file goes to a default path, which may not be what the user wants.\n- Using `polli gen text --json` expecting OpenAI chat-completions shape \u2014 the CLI\'s `--json` wraps its own structure. Use `polli docs /v1/chat/completions` to see the raw API shape if you need it.\n- Running commands without auth \u2014 `polli auth status` / `polli whoami` tells you who you\'re logged in as and your balance in one call.\n- **`gen text` streams to a TTY, buffers when piped.** The default now auto-detects \u2014 a human at the terminal sees tokens tick in, a pipe/redirect gets the full response once. Force either mode with `--stream` or `--no-stream`. For scripts and chains like `polli gen text \u2026 | polli gen audio \u2026`, you don\'t need to do anything; buffering happens automatically.\n- **Translating a `polli` workflow into a browser app.** `gen.pollinations.ai` requires a bearer token for generation requests, so a plain client-side `fetch` with no auth returns 401 unless it is served from cache. Mint a scoped key with `polli keys create` and proxy via your own backend.\n- **Backgrounded `polli gen` can fail silently** \u2014 no output file, empty log, no error (a safety rejection is an explicit 400). Run in the foreground; if backgrounded, check the `--output` file exists and retry once in the foreground before calling it failed.\n- **Content-safety 400s aren\'t only about violence.** Body-focused action phrasing can trip a sexual-content category on some edit models. Rephrase the benign intent neutrally (e.g. sport framing) and retry with a new seed.\n';
|
|
2892
2893
|
|
|
2893
2894
|
// src/harnesses/dsh.ts
|
|
2894
2895
|
init_config();
|
|
@@ -3540,9 +3541,9 @@ var isLegacyPlugin = (entry) => typeof entry === "string" ? entry === LEGACY_PLU
|
|
|
3540
3541
|
var pluginListKey = (config) => Array.isArray(config.plugins) && !Array.isArray(config.plugin) ? "plugins" : "plugin";
|
|
3541
3542
|
var removeLegacyPlugin = (config) => {
|
|
3542
3543
|
const key = pluginListKey(config);
|
|
3543
|
-
const
|
|
3544
|
-
if (!Array.isArray(
|
|
3545
|
-
const filtered =
|
|
3544
|
+
const entries2 = config[key];
|
|
3545
|
+
if (!Array.isArray(entries2) || !entries2.some(isLegacyPlugin)) return false;
|
|
3546
|
+
const filtered = entries2.filter((entry) => !isLegacyPlugin(entry));
|
|
3546
3547
|
if (filtered.length === 0) delete config[key];
|
|
3547
3548
|
else config[key] = filtered;
|
|
3548
3549
|
return true;
|
|
@@ -4082,6 +4083,205 @@ var tgpt = {
|
|
|
4082
4083
|
status: result8
|
|
4083
4084
|
};
|
|
4084
4085
|
|
|
4086
|
+
// src/harnesses/vibe.ts
|
|
4087
|
+
import { join as join14 } from "path";
|
|
4088
|
+
import { parseEnv as parseEnv5 } from "util";
|
|
4089
|
+
import { parse, stringify } from "smol-toml";
|
|
4090
|
+
init_config();
|
|
4091
|
+
var ID11 = "vibe";
|
|
4092
|
+
var LABEL11 = "Mistral Vibe";
|
|
4093
|
+
var PROVIDER8 = "pollinations";
|
|
4094
|
+
var KEY_ENV5 = "POLLI_VIBE_API_KEY";
|
|
4095
|
+
var DEFAULT_MODEL10 = "openai/gpt-6-sol";
|
|
4096
|
+
var vibeHome = (ctx) => ctx.env.VIBE_HOME?.trim() ? resolveHomePath(ctx.home, ctx.env.VIBE_HOME) : join14(ctx.home, ".vibe");
|
|
4097
|
+
var configPath4 = (ctx) => join14(vibeHome(ctx), "config.toml");
|
|
4098
|
+
var envPath4 = (ctx) => join14(vibeHome(ctx), ".env");
|
|
4099
|
+
var skillPath4 = (ctx) => join14(vibeHome(ctx), "skills", "polli", "SKILL.md");
|
|
4100
|
+
var files9 = (ctx) => [
|
|
4101
|
+
configPath4(ctx),
|
|
4102
|
+
envPath4(ctx),
|
|
4103
|
+
skillPath4(ctx)
|
|
4104
|
+
];
|
|
4105
|
+
var loadConfig = (ctx) => {
|
|
4106
|
+
try {
|
|
4107
|
+
return parse(readTextIfExists(configPath4(ctx)) ?? "");
|
|
4108
|
+
} catch {
|
|
4109
|
+
throw new Error(
|
|
4110
|
+
`Cannot parse ${configPath4(ctx)}; leaving it unchanged.`
|
|
4111
|
+
);
|
|
4112
|
+
}
|
|
4113
|
+
};
|
|
4114
|
+
var entries = (config, field) => {
|
|
4115
|
+
const value = config[field] ?? [];
|
|
4116
|
+
if (!Array.isArray(value) || value.some(
|
|
4117
|
+
(item) => !item || typeof item !== "object" || Array.isArray(item)
|
|
4118
|
+
)) {
|
|
4119
|
+
throw new Error(`Vibe ${field} must be an array of TOML tables.`);
|
|
4120
|
+
}
|
|
4121
|
+
return value;
|
|
4122
|
+
};
|
|
4123
|
+
var providerEntry3 = {
|
|
4124
|
+
name: PROVIDER8,
|
|
4125
|
+
api_base: `${BASE_URL}/v1`,
|
|
4126
|
+
api_key_env_var: KEY_ENV5,
|
|
4127
|
+
api_style: "openai",
|
|
4128
|
+
backend: "generic"
|
|
4129
|
+
};
|
|
4130
|
+
var ownsProvider3 = (provider2) => Object.entries(providerEntry3).every(
|
|
4131
|
+
([key, value]) => provider2[key] === value
|
|
4132
|
+
);
|
|
4133
|
+
var modelAlias = (id) => `${PROVIDER8}/${id}`;
|
|
4134
|
+
var utilityModels = (config) => {
|
|
4135
|
+
const value = config.utility_models ?? {};
|
|
4136
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
4137
|
+
throw new Error("Vibe utility_models must be a TOML table.");
|
|
4138
|
+
}
|
|
4139
|
+
return value;
|
|
4140
|
+
};
|
|
4141
|
+
var readKey8 = (ctx) => ctx.env[KEY_ENV5] || parseEnv5(readTextIfExists(envPath4(ctx)) ?? "")[KEY_ENV5] || null;
|
|
4142
|
+
var keyLine4 = new RegExp(`^\\s*(?:export\\s+)?${KEY_ENV5}\\s*=`, "u");
|
|
4143
|
+
var setKey2 = (ctx, key) => {
|
|
4144
|
+
const text = readTextIfExists(envPath4(ctx));
|
|
4145
|
+
if (text === null && key === null) return false;
|
|
4146
|
+
const lines = (text ?? "").split("\n").filter((line) => !keyLine4.test(line));
|
|
4147
|
+
if (key !== null) {
|
|
4148
|
+
const index = lines.at(-1) === "" ? lines.length - 1 : lines.length;
|
|
4149
|
+
lines.splice(index, 0, `${KEY_ENV5}=${JSON.stringify(key)}`);
|
|
4150
|
+
}
|
|
4151
|
+
const next = lines.join("\n");
|
|
4152
|
+
if (next === text) return false;
|
|
4153
|
+
writeTextAtomic(envPath4(ctx), next, 384);
|
|
4154
|
+
return true;
|
|
4155
|
+
};
|
|
4156
|
+
var configuredDocument = (ctx, settings) => {
|
|
4157
|
+
const config = loadConfig(ctx);
|
|
4158
|
+
const providers = entries(config, "providers");
|
|
4159
|
+
const existing = providers.find((provider2) => provider2.name === PROVIDER8);
|
|
4160
|
+
if (providers.some(
|
|
4161
|
+
(provider2) => provider2.name === PROVIDER8 && !ownsProvider3(provider2)
|
|
4162
|
+
)) {
|
|
4163
|
+
throw new Error(
|
|
4164
|
+
"An existing pollinations provider has different settings; leaving it unchanged."
|
|
4165
|
+
);
|
|
4166
|
+
}
|
|
4167
|
+
const models2 = entries(config, "models");
|
|
4168
|
+
const aliases = new Set(
|
|
4169
|
+
settings.models.map((model) => modelAlias(model.id))
|
|
4170
|
+
);
|
|
4171
|
+
if (models2.some(
|
|
4172
|
+
(model) => aliases.has(String(model.alias)) && model.provider !== PROVIDER8
|
|
4173
|
+
)) {
|
|
4174
|
+
throw new Error(
|
|
4175
|
+
"An existing Vibe model uses a Pollinations alias; leaving it unchanged."
|
|
4176
|
+
);
|
|
4177
|
+
}
|
|
4178
|
+
config.providers = [
|
|
4179
|
+
...providers.filter((provider2) => provider2.name !== PROVIDER8),
|
|
4180
|
+
{ ...existing, ...providerEntry3 }
|
|
4181
|
+
];
|
|
4182
|
+
config.models = [
|
|
4183
|
+
...models2.filter((model) => model.provider !== PROVIDER8),
|
|
4184
|
+
...settings.models.map((model) => ({
|
|
4185
|
+
...models2.find(
|
|
4186
|
+
(entry) => entry.provider === PROVIDER8 && entry.alias === modelAlias(model.id)
|
|
4187
|
+
),
|
|
4188
|
+
name: model.id,
|
|
4189
|
+
provider: PROVIDER8,
|
|
4190
|
+
alias: modelAlias(model.id),
|
|
4191
|
+
max_context_length: model.contextWindow,
|
|
4192
|
+
supports_images: model.input.includes("image")
|
|
4193
|
+
}))
|
|
4194
|
+
];
|
|
4195
|
+
config.active_model = modelAlias(settings.model);
|
|
4196
|
+
config.utility_models = {
|
|
4197
|
+
...utilityModels(config),
|
|
4198
|
+
title: config.active_model,
|
|
4199
|
+
smart_approve: config.active_model
|
|
4200
|
+
};
|
|
4201
|
+
return config;
|
|
4202
|
+
};
|
|
4203
|
+
var writeConfig8 = (ctx, settings) => {
|
|
4204
|
+
const config = configuredDocument(ctx, settings);
|
|
4205
|
+
writeTextAtomic(configPath4(ctx), stringify(config), 384);
|
|
4206
|
+
setKey2(ctx, settings.apiKey);
|
|
4207
|
+
if (readTextIfExists(skillPath4(ctx)) === null) {
|
|
4208
|
+
writeTextAtomic(skillPath4(ctx), SKILL_default, 384);
|
|
4209
|
+
}
|
|
4210
|
+
};
|
|
4211
|
+
var stripConfig8 = (ctx) => {
|
|
4212
|
+
const config = loadConfig(ctx);
|
|
4213
|
+
const providers = entries(config, "providers");
|
|
4214
|
+
if (!providers.some(ownsProvider3)) return false;
|
|
4215
|
+
const models2 = entries(config, "models");
|
|
4216
|
+
const aliases = new Set(
|
|
4217
|
+
models2.filter((model) => model.provider === PROVIDER8).map((model) => model.alias)
|
|
4218
|
+
);
|
|
4219
|
+
if (models2.some(
|
|
4220
|
+
(model) => model.provider === PROVIDER8 && model.alias === config.active_model
|
|
4221
|
+
)) {
|
|
4222
|
+
delete config.active_model;
|
|
4223
|
+
}
|
|
4224
|
+
config.providers = providers.filter((provider2) => !ownsProvider3(provider2));
|
|
4225
|
+
config.models = models2.filter((model) => model.provider !== PROVIDER8);
|
|
4226
|
+
const utilities = utilityModels(config);
|
|
4227
|
+
for (const key of ["title", "smart_approve"]) {
|
|
4228
|
+
if (aliases.has(utilities[key])) delete utilities[key];
|
|
4229
|
+
}
|
|
4230
|
+
if (Object.keys(utilities).length) config.utility_models = utilities;
|
|
4231
|
+
else delete config.utility_models;
|
|
4232
|
+
writeTextAtomic(configPath4(ctx), stringify(config), 384);
|
|
4233
|
+
setKey2(ctx, null);
|
|
4234
|
+
if (readTextIfExists(skillPath4(ctx)) === SKILL_default)
|
|
4235
|
+
removeIfExists(skillPath4(ctx));
|
|
4236
|
+
return true;
|
|
4237
|
+
};
|
|
4238
|
+
var result9 = (ctx) => {
|
|
4239
|
+
const config = loadConfig(ctx);
|
|
4240
|
+
const model = entries(config, "models").find(
|
|
4241
|
+
(entry) => entry.provider === PROVIDER8 && entry.alias === config.active_model
|
|
4242
|
+
);
|
|
4243
|
+
return {
|
|
4244
|
+
harness: ID11,
|
|
4245
|
+
label: LABEL11,
|
|
4246
|
+
installed: commandExists("vibe", ctx.env),
|
|
4247
|
+
configured: entries(config, "providers").some(ownsProvider3) && Boolean(model && readKey8(ctx)),
|
|
4248
|
+
model: typeof model?.name === "string" ? model.name : void 0,
|
|
4249
|
+
files: files9(ctx)
|
|
4250
|
+
};
|
|
4251
|
+
};
|
|
4252
|
+
var configureVibe = (ctx, settings) => {
|
|
4253
|
+
applyWithSnapshot(ctx, ID11, files9(ctx), () => writeConfig8(ctx, settings));
|
|
4254
|
+
return result9(ctx);
|
|
4255
|
+
};
|
|
4256
|
+
var disableVibe = (ctx) => {
|
|
4257
|
+
const outcome = restoreOrStrip(ctx, ID11, files9(ctx), () => stripConfig8(ctx));
|
|
4258
|
+
return { ...result9(ctx), configured: false, outcome };
|
|
4259
|
+
};
|
|
4260
|
+
var vibe = {
|
|
4261
|
+
id: ID11,
|
|
4262
|
+
label: LABEL11,
|
|
4263
|
+
description: "Configure Mistral Vibe to use Pollinations",
|
|
4264
|
+
restartHint: "Start a new Vibe session with: vibe. Use /model to switch models. Project, agent, admin, and environment settings can override this user configuration.",
|
|
4265
|
+
async on(ctx, options) {
|
|
4266
|
+
if (!commandExists("vibe", ctx.env)) {
|
|
4267
|
+
throw new Error(
|
|
4268
|
+
"Mistral Vibe was not found. Install it first: uv tool install mistral-vibe"
|
|
4269
|
+
);
|
|
4270
|
+
}
|
|
4271
|
+
const { model, models: models2 } = await fetchHarnessModels(
|
|
4272
|
+
options.model ?? DEFAULT_MODEL10
|
|
4273
|
+
);
|
|
4274
|
+
configuredDocument(ctx, { model, models: models2 });
|
|
4275
|
+
const apiKey = await resolveHarnessKey(
|
|
4276
|
+
{ id: ID11, label: LABEL11, existingKey: readKey8(ctx) },
|
|
4277
|
+
{ browser: options.browser }
|
|
4278
|
+
);
|
|
4279
|
+
return configureVibe(ctx, { apiKey, model, models: models2 });
|
|
4280
|
+
},
|
|
4281
|
+
off: disableVibe,
|
|
4282
|
+
status: result9
|
|
4283
|
+
};
|
|
4284
|
+
|
|
4085
4285
|
// src/harnesses/index.ts
|
|
4086
4286
|
var HARNESSES = [
|
|
4087
4287
|
bloom,
|
|
@@ -4093,7 +4293,8 @@ var HARNESSES = [
|
|
|
4093
4293
|
openclaw,
|
|
4094
4294
|
pi,
|
|
4095
4295
|
prime,
|
|
4096
|
-
tgpt
|
|
4296
|
+
tgpt,
|
|
4297
|
+
vibe
|
|
4097
4298
|
];
|
|
4098
4299
|
|
|
4099
4300
|
// src/commands/harness.ts
|
|
@@ -4107,26 +4308,26 @@ var OFF_MESSAGES = {
|
|
|
4107
4308
|
};
|
|
4108
4309
|
var runOn = async (harness, options) => {
|
|
4109
4310
|
try {
|
|
4110
|
-
const
|
|
4311
|
+
const result10 = await harness.on(context(), options);
|
|
4111
4312
|
await gen("/account/polli/harness-on", {
|
|
4112
4313
|
method: "POST",
|
|
4113
4314
|
body: { harness: harness.id }
|
|
4114
4315
|
}).catch(() => void 0);
|
|
4115
|
-
const model =
|
|
4316
|
+
const model = result10.model ? ` (model: ${result10.model})` : "";
|
|
4116
4317
|
printSuccess(`${harness.label} now uses Pollinations${model}.`);
|
|
4117
4318
|
printInfo(harness.restartHint);
|
|
4118
|
-
printResult(
|
|
4319
|
+
printResult(result10);
|
|
4119
4320
|
} catch (error) {
|
|
4120
4321
|
fail(`Failed to connect ${harness.label}`, error);
|
|
4121
4322
|
}
|
|
4122
4323
|
};
|
|
4123
4324
|
var runOff = async (harness) => {
|
|
4124
4325
|
try {
|
|
4125
|
-
const
|
|
4126
|
-
const outcome =
|
|
4326
|
+
const result10 = await harness.off(context());
|
|
4327
|
+
const outcome = result10.outcome ?? "unchanged";
|
|
4127
4328
|
printSuccess(`${harness.label}: ${OFF_MESSAGES[outcome]}`);
|
|
4128
4329
|
if (outcome !== "unchanged") printInfo(harness.restartHint);
|
|
4129
|
-
printResult(
|
|
4330
|
+
printResult(result10);
|
|
4130
4331
|
} catch (error) {
|
|
4131
4332
|
fail(`Failed to disconnect ${harness.label}`, error);
|
|
4132
4333
|
}
|
|
@@ -4167,9 +4368,9 @@ for (const harness of HARNESSES) {
|
|
|
4167
4368
|
|
|
4168
4369
|
// src/commands/keys.ts
|
|
4169
4370
|
init_api();
|
|
4371
|
+
init_output();
|
|
4170
4372
|
import chalk6 from "chalk";
|
|
4171
4373
|
import { Command as Command17 } from "commander";
|
|
4172
|
-
init_output();
|
|
4173
4374
|
var MODELS_HELP = "Models the key can use: categories (text, image, video, audio, 3d, embedding, realtime, decision) or model IDs from `polli models`. A category includes models added later; a model ID allows only that model";
|
|
4174
4375
|
var formatPerms = (p) => {
|
|
4175
4376
|
if (!p) return "-";
|
|
@@ -4256,7 +4457,7 @@ var create2 = new Command17("create").description(
|
|
|
4256
4457
|
"--type <type>",
|
|
4257
4458
|
"Key type: secret or publishable app key",
|
|
4258
4459
|
"secret"
|
|
4259
|
-
).option("--expires-in <seconds>", "Expiry in seconds
|
|
4460
|
+
).option("--expires-in <seconds>", "Expiry in seconds").option("--models <models...>", MODELS_HELP).option("--budget <pollen>", "Pollen budget cap").option(
|
|
4260
4461
|
"--quest-pollen-only",
|
|
4261
4462
|
"Never spend paid Pollen; requests stop when Quest Pollen runs out"
|
|
4262
4463
|
).option(
|
|
@@ -4287,13 +4488,13 @@ Examples:
|
|
|
4287
4488
|
fail("--earnings requires --type publishable");
|
|
4288
4489
|
}
|
|
4289
4490
|
if (opts.expiresIn !== void 0) {
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4491
|
+
const expiresIn = Number(opts.expiresIn);
|
|
4492
|
+
if (!Number.isInteger(expiresIn) || expiresIn < 1) {
|
|
4493
|
+
fail(
|
|
4494
|
+
"--expires-in must be a whole number of seconds above 0"
|
|
4495
|
+
);
|
|
4496
|
+
}
|
|
4497
|
+
body.expiresIn = expiresIn;
|
|
4297
4498
|
}
|
|
4298
4499
|
if (opts.models) body.allowedModels = opts.models;
|
|
4299
4500
|
if (opts.budget !== void 0) {
|
|
@@ -4404,7 +4605,7 @@ var resolveServers = (catalog, requested) => {
|
|
|
4404
4605
|
};
|
|
4405
4606
|
|
|
4406
4607
|
// src/mcp/clients.ts
|
|
4407
|
-
import { join as
|
|
4608
|
+
import { join as join15 } from "path";
|
|
4408
4609
|
import spawn4 from "cross-spawn";
|
|
4409
4610
|
import { isMap as isMap3, parseDocument as parseDocument3 } from "yaml";
|
|
4410
4611
|
init_config();
|
|
@@ -4584,24 +4785,24 @@ var yamlClient = (adapter) => {
|
|
|
4584
4785
|
`${path}: expected YAML mappings for config and ${table}`
|
|
4585
4786
|
);
|
|
4586
4787
|
}
|
|
4587
|
-
const
|
|
4588
|
-
const before = { ...
|
|
4589
|
-
const removed = mutate(
|
|
4590
|
-
if (JSON.stringify(
|
|
4591
|
-
return { installed: ownedEntryNames(
|
|
4788
|
+
const entries2 = readTable(ctx);
|
|
4789
|
+
const before = { ...entries2 };
|
|
4790
|
+
const removed = mutate(entries2);
|
|
4791
|
+
if (JSON.stringify(entries2) === JSON.stringify(before)) {
|
|
4792
|
+
return { installed: ownedEntryNames(entries2), removed };
|
|
4592
4793
|
}
|
|
4593
4794
|
if (doc.get(table) == null) doc.set(table, doc.createNode({}));
|
|
4594
4795
|
for (const name of Object.keys(before)) {
|
|
4595
|
-
if (!(name in
|
|
4796
|
+
if (!(name in entries2)) doc.deleteIn([table, name]);
|
|
4596
4797
|
}
|
|
4597
|
-
for (const [name, entry] of Object.entries(
|
|
4798
|
+
for (const [name, entry] of Object.entries(entries2)) {
|
|
4598
4799
|
if (JSON.stringify(entry) !== JSON.stringify(before[name])) {
|
|
4599
4800
|
doc.setIn([table, name], entry);
|
|
4600
4801
|
}
|
|
4601
4802
|
}
|
|
4602
|
-
if (Object.keys(
|
|
4803
|
+
if (Object.keys(entries2).length === 0) doc.delete(table);
|
|
4603
4804
|
writeTextAtomic(path, doc.toString({ lineWidth: 0 }), 384);
|
|
4604
|
-
return { installed: ownedEntryNames(
|
|
4805
|
+
return { installed: ownedEntryNames(entries2), removed };
|
|
4605
4806
|
};
|
|
4606
4807
|
return {
|
|
4607
4808
|
id,
|
|
@@ -4609,14 +4810,14 @@ var yamlClient = (adapter) => {
|
|
|
4609
4810
|
description,
|
|
4610
4811
|
install: (ctx, servers, key) => {
|
|
4611
4812
|
const skipped = [];
|
|
4612
|
-
const { installed } = update4(ctx, (
|
|
4813
|
+
const { installed } = update4(ctx, (entries2) => {
|
|
4613
4814
|
for (const server of servers) {
|
|
4614
|
-
const existing =
|
|
4815
|
+
const existing = entries2[server.id];
|
|
4615
4816
|
if (existing !== void 0 && !isOwnedEntry(existing)) {
|
|
4616
4817
|
skipped.push(server.id);
|
|
4617
4818
|
continue;
|
|
4618
4819
|
}
|
|
4619
|
-
|
|
4820
|
+
entries2[server.id] = urlEntry(server, key);
|
|
4620
4821
|
}
|
|
4621
4822
|
return [];
|
|
4622
4823
|
});
|
|
@@ -4631,9 +4832,9 @@ var yamlClient = (adapter) => {
|
|
|
4631
4832
|
};
|
|
4632
4833
|
},
|
|
4633
4834
|
remove: (ctx, serverIds) => {
|
|
4634
|
-
const { installed, removed } = update4(ctx, (
|
|
4635
|
-
const names = serverIds?.length ? serverIds.filter((name) => isOwnedEntry(
|
|
4636
|
-
for (const name of names) delete
|
|
4835
|
+
const { installed, removed } = update4(ctx, (entries2) => {
|
|
4836
|
+
const names = serverIds?.length ? serverIds.filter((name) => isOwnedEntry(entries2[name])) : ownedEntryNames(entries2);
|
|
4837
|
+
for (const name of names) delete entries2[name];
|
|
4637
4838
|
return names;
|
|
4638
4839
|
});
|
|
4639
4840
|
return {
|
|
@@ -4651,17 +4852,17 @@ var yamlClient = (adapter) => {
|
|
|
4651
4852
|
};
|
|
4652
4853
|
var vscodeUserDir = (ctx) => {
|
|
4653
4854
|
if (process.platform === "win32") {
|
|
4654
|
-
return
|
|
4655
|
-
ctx.env.APPDATA ??
|
|
4855
|
+
return join15(
|
|
4856
|
+
ctx.env.APPDATA ?? join15(ctx.home, "AppData", "Roaming"),
|
|
4656
4857
|
"Code",
|
|
4657
4858
|
"User"
|
|
4658
4859
|
);
|
|
4659
4860
|
}
|
|
4660
4861
|
if (process.platform === "darwin") {
|
|
4661
|
-
return
|
|
4862
|
+
return join15(ctx.home, "Library", "Application Support", "Code", "User");
|
|
4662
4863
|
}
|
|
4663
|
-
return
|
|
4664
|
-
ctx.env.XDG_CONFIG_HOME ??
|
|
4864
|
+
return join15(
|
|
4865
|
+
ctx.env.XDG_CONFIG_HOME ?? join15(ctx.home, ".config"),
|
|
4665
4866
|
"Code",
|
|
4666
4867
|
"User"
|
|
4667
4868
|
);
|
|
@@ -4672,7 +4873,7 @@ var jsonClients = [
|
|
|
4672
4873
|
label: "Cursor",
|
|
4673
4874
|
description: "Cursor desktop app (~/.cursor/mcp.json)",
|
|
4674
4875
|
target: {
|
|
4675
|
-
file: (ctx) =>
|
|
4876
|
+
file: (ctx) => join15(ctx.home, ".cursor", "mcp.json"),
|
|
4676
4877
|
table: "mcpServers",
|
|
4677
4878
|
entry: urlEntry
|
|
4678
4879
|
}
|
|
@@ -4697,7 +4898,7 @@ var jsonClients = [
|
|
|
4697
4898
|
label: "GitHub Copilot CLI",
|
|
4698
4899
|
description: "Copilot CLI (~/.copilot/mcp-config.json)",
|
|
4699
4900
|
target: {
|
|
4700
|
-
file: (ctx) =>
|
|
4901
|
+
file: (ctx) => join15(ctx.home, ".copilot", "mcp-config.json"),
|
|
4701
4902
|
table: "mcpServers",
|
|
4702
4903
|
entry: (server, key) => ({
|
|
4703
4904
|
type: "http",
|
|
@@ -4711,7 +4912,7 @@ var jsonClients = [
|
|
|
4711
4912
|
label: "Windsurf",
|
|
4712
4913
|
description: "Windsurf (~/.codeium/windsurf/mcp_config.json)",
|
|
4713
4914
|
target: {
|
|
4714
|
-
file: (ctx) =>
|
|
4915
|
+
file: (ctx) => join15(ctx.home, ".codeium", "windsurf", "mcp_config.json"),
|
|
4715
4916
|
table: "mcpServers",
|
|
4716
4917
|
entry: (server, key) => ({
|
|
4717
4918
|
serverUrl: server.url,
|
|
@@ -4724,7 +4925,7 @@ var jsonClients = [
|
|
|
4724
4925
|
label: "Cline",
|
|
4725
4926
|
description: "Cline CLI (~/.cline/mcp.json)",
|
|
4726
4927
|
target: {
|
|
4727
|
-
file: (ctx) =>
|
|
4928
|
+
file: (ctx) => join15(ctx.home, ".cline", "mcp.json"),
|
|
4728
4929
|
table: "mcpServers",
|
|
4729
4930
|
entry: (server, key) => ({
|
|
4730
4931
|
type: "streamableHttp",
|
|
@@ -4738,7 +4939,7 @@ var jsonClients = [
|
|
|
4738
4939
|
label: "Kiro",
|
|
4739
4940
|
description: "Kiro user-level MCP (~/.kiro/settings/mcp.json)",
|
|
4740
4941
|
target: {
|
|
4741
|
-
file: (ctx) =>
|
|
4942
|
+
file: (ctx) => join15(ctx.home, ".kiro", "settings", "mcp.json"),
|
|
4742
4943
|
table: "mcpServers",
|
|
4743
4944
|
entry: urlEntry
|
|
4744
4945
|
}
|
|
@@ -4748,7 +4949,7 @@ var jsonClients = [
|
|
|
4748
4949
|
label: "Warp",
|
|
4749
4950
|
description: "Warp file-based MCP (~/.warp/.mcp.json)",
|
|
4750
4951
|
target: {
|
|
4751
|
-
file: (ctx) =>
|
|
4952
|
+
file: (ctx) => join15(ctx.home, ".warp", ".mcp.json"),
|
|
4752
4953
|
table: "mcpServers",
|
|
4753
4954
|
entry: urlEntry,
|
|
4754
4955
|
notes: () => [
|
|
@@ -4761,7 +4962,7 @@ var jsonClients = [
|
|
|
4761
4962
|
label: "VS Code",
|
|
4762
4963
|
description: "VS Code user MCP profile (User/mcp.json)",
|
|
4763
4964
|
target: {
|
|
4764
|
-
file: (ctx) =>
|
|
4965
|
+
file: (ctx) => join15(vscodeUserDir(ctx), "mcp.json"),
|
|
4765
4966
|
table: "servers",
|
|
4766
4967
|
entry: (server, key) => ({
|
|
4767
4968
|
type: "http",
|
|
@@ -4774,8 +4975,8 @@ var jsonClients = [
|
|
|
4774
4975
|
label: "Zed",
|
|
4775
4976
|
description: "Zed (native HTTP context_servers)",
|
|
4776
4977
|
target: {
|
|
4777
|
-
file: (ctx) =>
|
|
4778
|
-
ctx.env.XDG_CONFIG_HOME ??
|
|
4978
|
+
file: (ctx) => join15(
|
|
4979
|
+
ctx.env.XDG_CONFIG_HOME ?? join15(ctx.home, ".config"),
|
|
4779
4980
|
"zed",
|
|
4780
4981
|
"settings.json"
|
|
4781
4982
|
),
|
|
@@ -4787,7 +4988,7 @@ var jsonClients = [
|
|
|
4787
4988
|
id: "hermes",
|
|
4788
4989
|
label: "Hermes Agent",
|
|
4789
4990
|
description: "Hermes Agent (mcp_servers in $HERMES_HOME/config.yaml, Bearer auth)",
|
|
4790
|
-
file: (ctx) =>
|
|
4991
|
+
file: (ctx) => join15(hermesHome(ctx), "config.yaml"),
|
|
4791
4992
|
table: "mcp_servers"
|
|
4792
4993
|
}),
|
|
4793
4994
|
{
|
|
@@ -4796,20 +4997,20 @@ var jsonClients = [
|
|
|
4796
4997
|
label: "Pi",
|
|
4797
4998
|
description: "Pi native MCP (0.99+, ~/.pi/agent/mcp.json)",
|
|
4798
4999
|
target: {
|
|
4799
|
-
file: (ctx) =>
|
|
5000
|
+
file: (ctx) => join15(piAgentDir(ctx), "mcp.json"),
|
|
4800
5001
|
table: "mcpServers",
|
|
4801
5002
|
entry: urlEntry,
|
|
4802
5003
|
notes: () => ["Run /reload in Pi, or start a new session."]
|
|
4803
5004
|
}
|
|
4804
5005
|
}),
|
|
4805
5006
|
preflight: (ctx) => {
|
|
4806
|
-
const
|
|
5007
|
+
const result10 = spawn4.sync("pi", ["--version"], {
|
|
4807
5008
|
env: ctx.env,
|
|
4808
5009
|
encoding: "utf8",
|
|
4809
5010
|
timeout: 5e3
|
|
4810
5011
|
});
|
|
4811
|
-
const version =
|
|
4812
|
-
if (
|
|
5012
|
+
const version = result10.stdout?.trim().match(/^(\d+)\.(\d+)\.\d+/);
|
|
5013
|
+
if (result10.status !== 0 || !version || Number(version[1]) === 0 && Number(version[2]) < 99) {
|
|
4813
5014
|
throw new Error(
|
|
4814
5015
|
"Pi 0.99+ is required for native MCP. Install or upgrade: npm install -g --ignore-scripts @earendil-works/pi-coding-agent@latest"
|
|
4815
5016
|
);
|
|
@@ -4818,14 +5019,14 @@ var jsonClients = [
|
|
|
4818
5019
|
}
|
|
4819
5020
|
];
|
|
4820
5021
|
var run = (command, args) => {
|
|
4821
|
-
const
|
|
5022
|
+
const result10 = spawn4.sync(command, args, {
|
|
4822
5023
|
stdio: ["ignore", "pipe", "pipe"],
|
|
4823
5024
|
encoding: "utf-8"
|
|
4824
5025
|
});
|
|
4825
|
-
if (
|
|
4826
|
-
if (
|
|
5026
|
+
if (result10.error) throw result10.error;
|
|
5027
|
+
if (result10.status !== 0) {
|
|
4827
5028
|
throw new Error(
|
|
4828
|
-
`${command} ${args[0]} failed (${
|
|
5029
|
+
`${command} ${args[0]} failed (${result10.status}): ${result10.stderr?.trim() || result10.stdout?.trim() || "no output"}`
|
|
4829
5030
|
);
|
|
4830
5031
|
}
|
|
4831
5032
|
};
|
|
@@ -4845,7 +5046,7 @@ var cliClient = (adapter) => {
|
|
|
4845
5046
|
preflight: ensureCli,
|
|
4846
5047
|
install: (ctx, servers, key) => {
|
|
4847
5048
|
ensureCli();
|
|
4848
|
-
const
|
|
5049
|
+
const files10 = [];
|
|
4849
5050
|
const notes = target.notes?.() ?? [];
|
|
4850
5051
|
const owned = target.installedIds(ctx);
|
|
4851
5052
|
const configured = target.configuredIds(ctx);
|
|
@@ -4863,14 +5064,14 @@ var cliClient = (adapter) => {
|
|
|
4863
5064
|
}
|
|
4864
5065
|
const extra = target.afterAdd?.(ctx, key);
|
|
4865
5066
|
if (extra) {
|
|
4866
|
-
|
|
5067
|
+
files10.push(...extra.files);
|
|
4867
5068
|
notes.push(...extra.notes);
|
|
4868
5069
|
}
|
|
4869
5070
|
return {
|
|
4870
5071
|
client: id,
|
|
4871
5072
|
label,
|
|
4872
5073
|
installed: target.installedIds(ctx),
|
|
4873
|
-
files:
|
|
5074
|
+
files: files10,
|
|
4874
5075
|
notes
|
|
4875
5076
|
};
|
|
4876
5077
|
},
|
|
@@ -4898,8 +5099,8 @@ var jsonTableIds = (file, table, ownedOnly = true) => (ctx) => {
|
|
|
4898
5099
|
const config = readJsonObject(file(ctx));
|
|
4899
5100
|
return ownedOnly ? ownedEntryNames(config[table]) : Object.keys(config[table] ?? {});
|
|
4900
5101
|
};
|
|
4901
|
-
var claudeConfigFile = (ctx) =>
|
|
4902
|
-
var codexConfigToml = (ctx) =>
|
|
5102
|
+
var claudeConfigFile = (ctx) => join15(ctx.env.CLAUDE_CONFIG_DIR || ctx.home, ".claude.json");
|
|
5103
|
+
var codexConfigToml = (ctx) => join15(ctx.env.CODEX_HOME ?? join15(ctx.home, ".codex"), "config.toml");
|
|
4903
5104
|
var codexInstalledIds = (toml, baseUrl = BASE_URL) => {
|
|
4904
5105
|
const ids = [];
|
|
4905
5106
|
let current = null;
|
|
@@ -4980,16 +5181,16 @@ var cliClients = [
|
|
|
4980
5181
|
(match) => match[1].replaceAll('"', "")
|
|
4981
5182
|
),
|
|
4982
5183
|
recoverKey: (ctx) => {
|
|
4983
|
-
const envFile =
|
|
4984
|
-
ctx.env.CODEX_HOME ??
|
|
5184
|
+
const envFile = join15(
|
|
5185
|
+
ctx.env.CODEX_HOME ?? join15(ctx.home, ".codex"),
|
|
4985
5186
|
".env"
|
|
4986
5187
|
);
|
|
4987
5188
|
const line = (readTextIfExists(envFile) ?? "").split("\n").find((l) => new RegExp(`^${CODEX_KEY_ENV}\\s*=`).test(l));
|
|
4988
5189
|
return line?.split("=").slice(1).join("=").trim() || null;
|
|
4989
5190
|
},
|
|
4990
5191
|
afterAdd: (ctx, key) => {
|
|
4991
|
-
const envFile =
|
|
4992
|
-
ctx.env.CODEX_HOME ??
|
|
5192
|
+
const envFile = join15(
|
|
5193
|
+
ctx.env.CODEX_HOME ?? join15(ctx.home, ".codex"),
|
|
4993
5194
|
".env"
|
|
4994
5195
|
);
|
|
4995
5196
|
upsertEnvFile(envFile, { [CODEX_KEY_ENV]: key });
|
|
@@ -5029,16 +5230,16 @@ var cliClients = [
|
|
|
5029
5230
|
],
|
|
5030
5231
|
installHint: "Install it from https://github.com/google-gemini/gemini-cli.",
|
|
5031
5232
|
configuredIds: jsonTableIds(
|
|
5032
|
-
(ctx) =>
|
|
5233
|
+
(ctx) => join15(ctx.home, ".gemini", "settings.json"),
|
|
5033
5234
|
"mcpServers",
|
|
5034
5235
|
false
|
|
5035
5236
|
),
|
|
5036
5237
|
installedIds: jsonTableIds(
|
|
5037
|
-
(ctx) =>
|
|
5238
|
+
(ctx) => join15(ctx.home, ".gemini", "settings.json"),
|
|
5038
5239
|
"mcpServers"
|
|
5039
5240
|
),
|
|
5040
5241
|
recoverKey: (ctx) => recoverKeyFromTable(
|
|
5041
|
-
readJsonObject(
|
|
5242
|
+
readJsonObject(join15(ctx.home, ".gemini", "settings.json")).mcpServers
|
|
5042
5243
|
)
|
|
5043
5244
|
}
|
|
5044
5245
|
}),
|
|
@@ -5059,16 +5260,16 @@ var cliClients = [
|
|
|
5059
5260
|
removeArgs: (serverId) => ["mcp", "remove", serverId],
|
|
5060
5261
|
installHint: "Install it from https://ampcode.com.",
|
|
5061
5262
|
installedIds: jsonTableIds(
|
|
5062
|
-
(ctx) =>
|
|
5063
|
-
ctx.env.XDG_CONFIG_HOME ??
|
|
5263
|
+
(ctx) => join15(
|
|
5264
|
+
ctx.env.XDG_CONFIG_HOME ?? join15(ctx.home, ".config"),
|
|
5064
5265
|
"amp",
|
|
5065
5266
|
"settings.json"
|
|
5066
5267
|
),
|
|
5067
5268
|
"amp.mcpServers"
|
|
5068
5269
|
),
|
|
5069
5270
|
configuredIds: jsonTableIds(
|
|
5070
|
-
(ctx) =>
|
|
5071
|
-
ctx.env.XDG_CONFIG_HOME ??
|
|
5271
|
+
(ctx) => join15(
|
|
5272
|
+
ctx.env.XDG_CONFIG_HOME ?? join15(ctx.home, ".config"),
|
|
5072
5273
|
"amp",
|
|
5073
5274
|
"settings.json"
|
|
5074
5275
|
),
|
|
@@ -5077,8 +5278,8 @@ var cliClients = [
|
|
|
5077
5278
|
),
|
|
5078
5279
|
recoverKey: (ctx) => {
|
|
5079
5280
|
const config = readJsonObject(
|
|
5080
|
-
|
|
5081
|
-
ctx.env.XDG_CONFIG_HOME ??
|
|
5281
|
+
join15(
|
|
5282
|
+
ctx.env.XDG_CONFIG_HOME ?? join15(ctx.home, ".config"),
|
|
5082
5283
|
"amp",
|
|
5083
5284
|
"settings.json"
|
|
5084
5285
|
)
|
|
@@ -5157,23 +5358,23 @@ var runInstall = async (client, servers, options) => {
|
|
|
5157
5358
|
},
|
|
5158
5359
|
{ browser: options.browser }
|
|
5159
5360
|
);
|
|
5160
|
-
const
|
|
5361
|
+
const result10 = await client.install(context2(), selected, key);
|
|
5161
5362
|
printSuccess(
|
|
5162
5363
|
`${client.label}: configured ${selected.map((server) => server.id).join(", ")}.`
|
|
5163
5364
|
);
|
|
5164
|
-
for (const note of
|
|
5165
|
-
printResult({ ...
|
|
5365
|
+
for (const note of result10.notes) printInfo(note);
|
|
5366
|
+
printResult({ ...result10 });
|
|
5166
5367
|
} catch (error) {
|
|
5167
5368
|
fail(`Failed to install MCP servers into ${client.label}`, error);
|
|
5168
5369
|
}
|
|
5169
5370
|
};
|
|
5170
5371
|
var runRemove = async (client, servers) => {
|
|
5171
5372
|
try {
|
|
5172
|
-
const
|
|
5373
|
+
const result10 = await client.remove(
|
|
5173
5374
|
context2(),
|
|
5174
5375
|
servers.length ? servers : void 0
|
|
5175
5376
|
);
|
|
5176
|
-
const removed =
|
|
5377
|
+
const removed = result10.removed ?? [];
|
|
5177
5378
|
if (removed.length === 0) {
|
|
5178
5379
|
printInfo(
|
|
5179
5380
|
`${client.label}: no Pollinations-owned MCP entries found; nothing changed.`
|
|
@@ -5183,7 +5384,7 @@ var runRemove = async (client, servers) => {
|
|
|
5183
5384
|
`${client.label}: removed ${removed.join(", ")}. Other MCP entries were left untouched.`
|
|
5184
5385
|
);
|
|
5185
5386
|
}
|
|
5186
|
-
printResult({ ...
|
|
5387
|
+
printResult({ ...result10 });
|
|
5187
5388
|
} catch (error) {
|
|
5188
5389
|
fail(`Failed to remove MCP servers from ${client.label}`, error);
|
|
5189
5390
|
}
|
|
@@ -5946,7 +6147,7 @@ import {
|
|
|
5946
6147
|
writeSync
|
|
5947
6148
|
} from "fs";
|
|
5948
6149
|
import { homedir as homedir4 } from "os";
|
|
5949
|
-
import { join as
|
|
6150
|
+
import { join as join16 } from "path";
|
|
5950
6151
|
|
|
5951
6152
|
// src/commands/sandbox/bootstrap.sh?raw
|
|
5952
6153
|
var bootstrap_default = `#!/bin/bash
|
|
@@ -6019,14 +6220,14 @@ exit 1
|
|
|
6019
6220
|
`;
|
|
6020
6221
|
|
|
6021
6222
|
// src/commands/sandbox/ssh.ts
|
|
6022
|
-
var SSH_DIR =
|
|
6023
|
-
var SSH_KEY =
|
|
6024
|
-
var SSH_CONFIG =
|
|
6025
|
-
var USER_SSH_CONFIG =
|
|
6223
|
+
var SSH_DIR = join16(homedir4(), ".pollinations", "ssh");
|
|
6224
|
+
var SSH_KEY = join16(SSH_DIR, "id_ed25519");
|
|
6225
|
+
var SSH_CONFIG = join16(SSH_DIR, "config");
|
|
6226
|
+
var USER_SSH_CONFIG = join16(homedir4(), ".ssh", "config");
|
|
6026
6227
|
var INCLUDE = "Include ~/.pollinations/ssh/config";
|
|
6027
6228
|
var SSH_PORT = 8022;
|
|
6028
6229
|
var RENEW_MS = 3e5;
|
|
6029
|
-
var SHARES_CONNECTIONS = process.platform !== "win32" && Buffer.byteLength(
|
|
6230
|
+
var SHARES_CONNECTIONS = process.platform !== "win32" && Buffer.byteLength(join16(homedir4(), ".ssh", "polli-")) + 57 < 104;
|
|
6030
6231
|
function stderrToTerminal() {
|
|
6031
6232
|
let tty;
|
|
6032
6233
|
try {
|
|
@@ -6155,14 +6356,14 @@ function setupSsh() {
|
|
|
6155
6356
|
" User user",
|
|
6156
6357
|
` IdentityFile "${SSH_KEY}"`,
|
|
6157
6358
|
" IdentitiesOnly yes",
|
|
6158
|
-
` UserKnownHostsFile "${
|
|
6359
|
+
` UserKnownHostsFile "${join16(SSH_DIR, "known_hosts")}"`,
|
|
6159
6360
|
" StrictHostKeyChecking accept-new",
|
|
6160
6361
|
` ProxyCommand ${polli} sandbox proxy %h`,
|
|
6161
6362
|
// Later ssh, scp and rsync reuse the first connection, up to 10
|
|
6162
6363
|
// minutes after it ends.
|
|
6163
6364
|
...SHARES_CONNECTIONS ? [
|
|
6164
6365
|
" ControlMaster auto",
|
|
6165
|
-
` ControlPath "${
|
|
6366
|
+
` ControlPath "${join16(homedir4(), ".ssh", "polli-%C")}"`,
|
|
6166
6367
|
" ControlPersist 10m"
|
|
6167
6368
|
] : [],
|
|
6168
6369
|
""
|
|
@@ -6170,7 +6371,7 @@ function setupSsh() {
|
|
|
6170
6371
|
);
|
|
6171
6372
|
const current = existsSync3(USER_SSH_CONFIG) ? readFileSync7(USER_SSH_CONFIG, "utf8") : "";
|
|
6172
6373
|
if (!current.split("\n").includes(INCLUDE)) {
|
|
6173
|
-
mkdirSync4(
|
|
6374
|
+
mkdirSync4(join16(homedir4(), ".ssh"), { recursive: true, mode: 448 });
|
|
6174
6375
|
writeFileSync11(USER_SSH_CONFIG, `${INCLUDE}
|
|
6175
6376
|
|
|
6176
6377
|
${current}`);
|
|
@@ -6354,22 +6555,22 @@ var sandboxCommand = new Command22("sandbox").description("E2B sandboxes billed
|
|
|
6354
6555
|
init_api();
|
|
6355
6556
|
import { createHash as createHash2 } from "crypto";
|
|
6356
6557
|
import { readdirSync as readdirSync2, readFileSync as readFileSync8 } from "fs";
|
|
6357
|
-
import { extname as extname2, join as
|
|
6558
|
+
import { extname as extname2, join as join17, relative, resolve as resolve3, sep } from "path";
|
|
6358
6559
|
import { setTimeout as setTimeout2 } from "timers/promises";
|
|
6359
6560
|
import chalk10 from "chalk";
|
|
6360
6561
|
import { Command as Command23 } from "commander";
|
|
6361
6562
|
init_output();
|
|
6362
6563
|
function collectSiteFiles(dir) {
|
|
6363
|
-
const
|
|
6564
|
+
const files10 = [];
|
|
6364
6565
|
const walk = (current) => {
|
|
6365
6566
|
for (const entry of readdirSync2(current, { withFileTypes: true })) {
|
|
6366
6567
|
const skipped = entry.name.startsWith(".") && entry.name !== ".well-known" || entry.name === "node_modules";
|
|
6367
6568
|
if (skipped) continue;
|
|
6368
|
-
const file =
|
|
6569
|
+
const file = join17(current, entry.name);
|
|
6369
6570
|
if (entry.isDirectory()) walk(file);
|
|
6370
6571
|
else if (entry.isFile()) {
|
|
6371
6572
|
const content = readFileSync8(file);
|
|
6372
|
-
|
|
6573
|
+
files10.push({
|
|
6373
6574
|
path: `/${relative(dir, file).split(sep).join("/")}`,
|
|
6374
6575
|
file,
|
|
6375
6576
|
hash: createHash2("sha256").update(
|
|
@@ -6381,14 +6582,14 @@ function collectSiteFiles(dir) {
|
|
|
6381
6582
|
}
|
|
6382
6583
|
};
|
|
6383
6584
|
walk(dir);
|
|
6384
|
-
return
|
|
6585
|
+
return files10;
|
|
6385
6586
|
}
|
|
6386
6587
|
function assetType(file) {
|
|
6387
6588
|
const type = mimeTypeFor(file);
|
|
6388
6589
|
return type === "application/octet-stream" ? "application/null" : type;
|
|
6389
6590
|
}
|
|
6390
|
-
async function verifySiteFiles(
|
|
6391
|
-
for (const file of
|
|
6591
|
+
async function verifySiteFiles(files10, siteUrl, retryDelayMs = 5e3) {
|
|
6592
|
+
for (const file of files10) {
|
|
6392
6593
|
const path = file.path.split("/").map(encodeURIComponent).join("/");
|
|
6393
6594
|
for (let attempt = 0; ; attempt++) {
|
|
6394
6595
|
try {
|
|
@@ -6418,8 +6619,8 @@ async function verifySiteFiles(files9, siteUrl, retryDelayMs = 5e3) {
|
|
|
6418
6619
|
}
|
|
6419
6620
|
}
|
|
6420
6621
|
}
|
|
6421
|
-
async function uploadBuckets(session,
|
|
6422
|
-
const byHash = new Map(
|
|
6622
|
+
async function uploadBuckets(session, files10) {
|
|
6623
|
+
const byHash = new Map(files10.map((file) => [file.hash, file]));
|
|
6423
6624
|
let jwt = session.jwt;
|
|
6424
6625
|
for (const bucket of session.buckets) {
|
|
6425
6626
|
const form = new FormData();
|
|
@@ -6459,9 +6660,9 @@ var deploy = new Command23("deploy").description(
|
|
|
6459
6660
|
"Site name: 3-32 lowercase letters, digits and hyphens"
|
|
6460
6661
|
).option("--verify", "Check every published file against the local build").action(async (dir, opts) => {
|
|
6461
6662
|
const key = requireKey();
|
|
6462
|
-
const
|
|
6663
|
+
const files10 = collectSiteFiles(resolve3(dir));
|
|
6463
6664
|
const manifest = Object.fromEntries(
|
|
6464
|
-
|
|
6665
|
+
files10.map((file) => [
|
|
6465
6666
|
file.path,
|
|
6466
6667
|
{ hash: file.hash, size: file.size }
|
|
6467
6668
|
])
|
|
@@ -6474,7 +6675,7 @@ var deploy = new Command23("deploy").description(
|
|
|
6474
6675
|
body: { manifest },
|
|
6475
6676
|
apiKey: key
|
|
6476
6677
|
});
|
|
6477
|
-
const jwt = await uploadBuckets(session,
|
|
6678
|
+
const jwt = await uploadBuckets(session, files10);
|
|
6478
6679
|
site = await gen(path, {
|
|
6479
6680
|
method: "PUT",
|
|
6480
6681
|
body: { jwt },
|
|
@@ -6486,10 +6687,10 @@ var deploy = new Command23("deploy").description(
|
|
|
6486
6687
|
const uploaded = session.buckets.flat().length;
|
|
6487
6688
|
printSuccess(`Published ${site.url}`);
|
|
6488
6689
|
printInfo(
|
|
6489
|
-
`${
|
|
6690
|
+
`${files10.length} files, ${uploaded} uploaded, ${files10.length - uploaded} unchanged`
|
|
6490
6691
|
);
|
|
6491
6692
|
}
|
|
6492
|
-
if (opts.verify) await verifySiteFiles(
|
|
6693
|
+
if (opts.verify) await verifySiteFiles(files10, site.url);
|
|
6493
6694
|
} catch (error) {
|
|
6494
6695
|
printError(
|
|
6495
6696
|
site ? `Site published at ${site.url}, but verification failed: ${errorMessage(error)}` : `Failed to deploy site: ${errorMessage(error)}`
|
|
@@ -6539,14 +6740,14 @@ var sitesCommand = new Command23("sites").description("Host static sites at <nam
|
|
|
6539
6740
|
init_output();
|
|
6540
6741
|
import { execSync, spawnSync as spawnSync3 } from "child_process";
|
|
6541
6742
|
import { existsSync as existsSync4, readFileSync as readFileSync9 } from "fs";
|
|
6542
|
-
import { dirname as dirname4, join as
|
|
6743
|
+
import { dirname as dirname4, join as join18, resolve as resolve4, sep as sep2 } from "path";
|
|
6543
6744
|
import { fileURLToPath } from "url";
|
|
6544
6745
|
import { Command as Command24 } from "commander";
|
|
6545
6746
|
var PACKAGE_NAME = "@pollinations/cli";
|
|
6546
6747
|
var REGISTRY_URL = "https://registry.npmjs.org/@pollinations%2Fcli/latest";
|
|
6547
6748
|
function findPackageRoot(fromDir) {
|
|
6548
6749
|
let dir = resolve4(fromDir);
|
|
6549
|
-
while (!existsSync4(
|
|
6750
|
+
while (!existsSync4(join18(dir, "package.json"))) {
|
|
6550
6751
|
const parent = dirname4(dir);
|
|
6551
6752
|
if (parent === dir) throw new Error("could not locate package.json");
|
|
6552
6753
|
dir = parent;
|
|
@@ -6554,7 +6755,7 @@ function findPackageRoot(fromDir) {
|
|
|
6554
6755
|
return dir;
|
|
6555
6756
|
}
|
|
6556
6757
|
var packageDir = findPackageRoot(dirname4(fileURLToPath(import.meta.url)));
|
|
6557
|
-
var currentVersion = JSON.parse(readFileSync9(
|
|
6758
|
+
var currentVersion = JSON.parse(readFileSync9(join18(packageDir, "package.json"), "utf-8")).version;
|
|
6558
6759
|
function detectInstallKind(dir, globalRoot) {
|
|
6559
6760
|
const resolvedDir = resolve4(dir);
|
|
6560
6761
|
if (resolvedDir.split(sep2).includes("_npx")) return "npx";
|
|
@@ -6636,7 +6837,7 @@ var updateCommand = new Command24("update").description(
|
|
|
6636
6837
|
);
|
|
6637
6838
|
}
|
|
6638
6839
|
const installed = JSON.parse(
|
|
6639
|
-
readFileSync9(
|
|
6840
|
+
readFileSync9(join18(packageDir, "package.json"), "utf-8")
|
|
6640
6841
|
).version;
|
|
6641
6842
|
printSuccess(`Updated to v${installed}.`);
|
|
6642
6843
|
printResult({
|