@clarity-js/agent 0.0.0-stage → 0.2.0
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 +285 -2
- package/index.d.ts +155 -0
- package/package.json +132 -4
- package/src/app.js +139 -0
- package/src/budget.js +34 -0
- package/src/chat.js +288 -0
- package/src/checkpoints.js +126 -0
- package/src/ci.js +121 -0
- package/src/clarity.js +16 -0
- package/src/cli.js +340 -0
- package/src/connectors/adapters.js +371 -0
- package/src/connectors/http.js +46 -0
- package/src/connectors/index.js +103 -0
- package/src/connectors/more.js +346 -0
- package/src/diff.js +59 -0
- package/src/dream.js +156 -0
- package/src/headless.js +61 -0
- package/src/index.js +120 -0
- package/src/integrations.js +196 -0
- package/src/keys.js +48 -0
- package/src/loop.js +80 -0
- package/src/mcp-client.js +101 -0
- package/src/providers.js +200 -0
- package/src/schedule.js +113 -0
- package/src/session.js +126 -0
- package/src/ship.js +127 -0
- package/src/tools.js +139 -0
- package/ui/Panel.clarity +191 -0
- package/ui/main.js +28 -0
- package/ui/panel.css +93 -0
package/README.md
CHANGED
|
@@ -1,3 +1,286 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @clarity-js/agent — Clarity Agent
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An open-source coding agent that builds **websites, web apps, dashboards and games** with [Clarity.js](https://clarity-js.com),
|
|
4
|
+
on **your own model**. It knows Clarity before it starts: it looks things up in the language reference, checks every
|
|
5
|
+
component with the compiler, renders it as a server would, looks at the page in a headless browser, and makes games with
|
|
6
|
+
Clarity's engine and its bots. **Dream Engine** turns one sentence into a design. **Connectors** make the images, 3D models,
|
|
7
|
+
video, voice and music the project needs, priced and asked first.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install -D @clarity-js/agent
|
|
11
|
+
npx clarity keys set anthropic # or deepseek, kimi, minimax, qwen, glm, mistral, gemini, openai … (kept on this computer)
|
|
12
|
+
npx clarity dream "A booking app for hairdressers: clients pick a time, the salon sees its day, an SMS reminder goes out"
|
|
13
|
+
npx clarity agent "Build the first version from dream.md"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Your model
|
|
17
|
+
|
|
18
|
+
Any of these, with your key (`--model provider:model`):
|
|
19
|
+
|
|
20
|
+
| Provider | Id | Key |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| Anthropic | `anthropic` | `ANTHROPIC_API_KEY` |
|
|
23
|
+
| OpenAI | `openai` | `OPENAI_API_KEY` |
|
|
24
|
+
| Google Gemini | `gemini` | `GEMINI_API_KEY` |
|
|
25
|
+
| DeepSeek | `deepseek` | `DEEPSEEK_API_KEY` |
|
|
26
|
+
| Kimi (Moonshot) | `moonshot`, `kimi` | `MOONSHOT_API_KEY` |
|
|
27
|
+
| MiniMax | `minimax` | `MINIMAX_API_KEY` |
|
|
28
|
+
| Qwen (Alibaba Cloud) | `qwen` | `DASHSCOPE_API_KEY` |
|
|
29
|
+
| GLM (Z.ai) | `zhipu`, `glm` | `ZAI_API_KEY` |
|
|
30
|
+
| Mistral | `mistral` | `MISTRAL_API_KEY` |
|
|
31
|
+
| xAI | `xai` | `XAI_API_KEY` |
|
|
32
|
+
| Meta Model API (Muse) | `meta`, `llama` | `META_API_KEY` |
|
|
33
|
+
| Groq, Together, Fireworks, Cerebras, DeepInfra | `groq`, `together`, `fireworks`, `cerebras`, `deepinfra` | their `*_API_KEY` |
|
|
34
|
+
| NVIDIA (build.nvidia.com) | `nvidia` | `NVIDIA_API_KEY` |
|
|
35
|
+
| Ollama Cloud | `ollama-cloud` | `OLLAMA_API_KEY` |
|
|
36
|
+
| Cohere | `cohere` | `COHERE_API_KEY` |
|
|
37
|
+
| BytePlus ModelArk (Seed) | `byteplus`, `ark` | `ARK_API_KEY` (`ARK_REGION`, default ap-southeast) |
|
|
38
|
+
| Azure OpenAI (Foundry) | `azure` (the model is your deployment's name) | `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_RESOURCE` |
|
|
39
|
+
| Amazon Bedrock | `bedrock`, `aws` | `AWS_BEARER_TOKEN_BEDROCK` (`AWS_REGION`, default us-east-1) |
|
|
40
|
+
| Google Vertex AI | `vertex` | a token from `gcloud auth print-access-token` (or `VERTEX_ACCESS_TOKEN`), `GOOGLE_CLOUD_PROJECT` |
|
|
41
|
+
| On this computer | `ollama`, `lmstudio`, `vllm`, `llamacpp` (port 9931; older builds 8080), `mlx`, `jan` | none |
|
|
42
|
+
| Any OpenAI-compatible server | `custom` with `providers.custom.baseUrl` | yours |
|
|
43
|
+
|
|
44
|
+
`clarity models <provider>` lists the models your key can use. A local model that cannot call tools gets them in words
|
|
45
|
+
(`"providers": { "ollama": { "toolMode": "text" } }` in `.clarity/agent.json`). A server on another port or host:
|
|
46
|
+
`"providers": { "llamacpp": { "baseUrl": "http://127.0.0.1:8080/v1" } }`. A reasoning model's thinking (DeepSeek,
|
|
47
|
+
MiniMax) is sent back with its tool calls, as they ask.
|
|
48
|
+
|
|
49
|
+
## What it asks first
|
|
50
|
+
|
|
51
|
+
| Risk | Example | Asked |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
| read | read a file, search, the reference, look at a page | never |
|
|
54
|
+
| run | render a component, let bots play | in `ask` mode |
|
|
55
|
+
| write | write or edit a file | in `ask` mode (`--mode edits` lets it edit) |
|
|
56
|
+
| exec | run a command | unless allowed (`--allow "npm test"`; `--mode auto` allows a few safe ones) |
|
|
57
|
+
| spend | a paid generation | always, with its price |
|
|
58
|
+
| publish | anything that leaves this computer | always |
|
|
59
|
+
|
|
60
|
+
It never reads or writes outside the project's folder (a `..` or a link that leads out is refused), and it asks before
|
|
61
|
+
reading a file that may hold secrets (`.env`, keys). Every session is written to `.clarity/agent/`.
|
|
62
|
+
|
|
63
|
+
## Dream Engine
|
|
64
|
+
|
|
65
|
+
`clarity dream "<idea>"` asks at most three questions, proposes three original concepts, and writes the chosen one:
|
|
66
|
+
|
|
67
|
+
- `dream.md` — for an app: roles, screens, data, flows and the API; for a site: pages, content and search text; for a game:
|
|
68
|
+
the loop, controls, levels, obstacles and progression; then the first minutes and the store text;
|
|
69
|
+
- `style.json` — the palette, type, light, lines and mood, and the words every image prompt starts with, so everything made
|
|
70
|
+
for the project looks alike;
|
|
71
|
+
- `assets.yaml` — each asset with its kind, size, prompt and price.
|
|
72
|
+
|
|
73
|
+
When the idea names an existing product, Dream Engine takes its kind and its mechanics, never its names, characters, art
|
|
74
|
+
or music.
|
|
75
|
+
|
|
76
|
+
## Connectors
|
|
77
|
+
|
|
78
|
+
`clarity gen <kind> "<prompt>"` (or the agent's `generate_asset`): `image`, `sprite`, `texture`, `vector` (SVG: icons,
|
|
79
|
+
logos), `video`, `model3d`, `voice`, `sfx`, `music`. `clarity gen --list` shows which have keys.
|
|
80
|
+
|
|
81
|
+
| Connector | Makes | Key |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| `comfyui` | images and video, on this computer (its first checkpoint, or a workflow of your own with `{{prompt}}`) | none |
|
|
84
|
+
| `comfy-cloud` | the same workflows on Comfy's GPUs | `COMFY_CLOUD_API_KEY` |
|
|
85
|
+
| `higgsfield` | images and video from its catalogue (Seedance, Kling, MiniMax, Soul …) | `HIGGSFIELD_API_KEY` as `id:secret` |
|
|
86
|
+
| `minimax` | images, Hailuo video, voice | `MINIMAX_API_KEY` |
|
|
87
|
+
| `elevenlabs` | voice, sound effects, music | `ELEVENLABS_API_KEY` |
|
|
88
|
+
| `cartesia` | voice (Sonic) | `CARTESIA_API_KEY` |
|
|
89
|
+
| `tripo` | 3D models (glb, PBR) | `TRIPO_API_KEY` |
|
|
90
|
+
| `meshy` | 3D models (a preview, then its textures) | `MESHY_API_KEY` |
|
|
91
|
+
| `bfl` | FLUX.2 images from Black Forest Labs | `BFL_API_KEY` |
|
|
92
|
+
| `recraft` | SVG vectors (icons, logos) and images | `RECRAFT_API_TOKEN` |
|
|
93
|
+
| `pixellab` | pixel-art sprites and tiles | `PIXELLAB_API_KEY` |
|
|
94
|
+
| `retrodiffusion` | pixel art (RD Lite, Core, Pro styles) | `RETRODIFFUSION_API_KEY` |
|
|
95
|
+
| `stability` | Stable Image Core and Ultra | `STABILITY_API_KEY` |
|
|
96
|
+
| `fal` | FLUX, Rodin, Kling, Wan and hundreds more, by model id | `FAL_KEY` |
|
|
97
|
+
| `replicate` | open models by `owner/name` | `REPLICATE_API_TOKEN` |
|
|
98
|
+
| `openai` | images (the same key as the model) | `OPENAI_API_KEY` |
|
|
99
|
+
| `gemini` | images, Omni video, speech, Lyria music (the same key as the model) | `GEMINI_API_KEY` |
|
|
100
|
+
| `runway` | Gen-4.5 video, Gen-4 images, sound effects, music | `RUNWAYML_API_SECRET` |
|
|
101
|
+
| `luma` | Ray video, Photon images | `LUMAAI_API_KEY` |
|
|
102
|
+
| `pixverse` | video | `PIXVERSE_API_KEY` |
|
|
103
|
+
| `vidu` | video | `VIDU_API_KEY` |
|
|
104
|
+
| `leonardo` | images | `LEONARDO_API_KEY` |
|
|
105
|
+
| `ideogram` | images with lettering | `IDEOGRAM_API_KEY` |
|
|
106
|
+
| `krea` | images (Flux and more) | `KREA_API_TOKEN` |
|
|
107
|
+
| `firefly` | Adobe Firefly images | `FIREFLY_CREDENTIALS` as `client id:client secret` |
|
|
108
|
+
| `scenario` | game art, your own trained styles | `SCENARIO_API_KEY` as `key:secret` |
|
|
109
|
+
| `ludo` | sprites, icons, backgrounds, sound, music, voices | `LUDO_API_KEY` |
|
|
110
|
+
| `runware`, `wavespeed`, `atlas` | hundreds of models by id | `RUNWARE_API_KEY`, `WAVESPEED_API_KEY`, `ATLASCLOUD_API_KEY` |
|
|
111
|
+
| `3daistudio` | 3D models (Hunyuan 3D) | `THREEDAI_API_KEY` |
|
|
112
|
+
| `stability` | also 3D: Stable Fast 3D from a picture | `STABILITY_API_KEY` |
|
|
113
|
+
| `inworld`, `groq` | voices (Inworld TTS, Orpheus) | `INWORLD_API_KEY`, `GROQ_API_KEY` |
|
|
114
|
+
| `beatoven` | royalty-free music | `BEATOVEN_API_KEY` |
|
|
115
|
+
| `figma` | frames and icons exported from your design file (the prompt is a Figma link) | `FIGMA_TOKEN` |
|
|
116
|
+
| `forge`, `drawthings` | images on this computer (A1111-style API on port 7860) | none |
|
|
117
|
+
| `piper` | voices on this computer (`"connectors": { "piper": { "voice": "…onnx" } }`) | none |
|
|
118
|
+
|
|
119
|
+
Files go to `assets/<kind>/`; the same request is not paid twice (`.clarity/assets-cache.json`); each one is written to the
|
|
120
|
+
ledger. Limits: `clarity keys limits --daily 5 --monthly 50` (the defaults), and per connector in
|
|
121
|
+
`"limits": { "perConnector": { "tripo": 10 } }`. A generation that would pass a limit is refused before it is asked.
|
|
122
|
+
|
|
123
|
+
## Ship
|
|
124
|
+
|
|
125
|
+
`clarity ship <target>` (or the agent's `ship`, always asked) publishes a built folder (`dist` by default) with the host's
|
|
126
|
+
own tool. The key goes into that tool's environment, never onto its command line; `--dry` only shows the command.
|
|
127
|
+
|
|
128
|
+
| Target | Runs | Key |
|
|
129
|
+
| --- | --- | --- |
|
|
130
|
+
| `netlify` | `netlify-cli deploy --prod` (`--site`) | `NETLIFY_AUTH_TOKEN` |
|
|
131
|
+
| `cloudflare` | `wrangler pages deploy` (`--project`) | `CLOUDFLARE_API_TOKEN` (and `CLOUDFLARE_ACCOUNT_ID`) |
|
|
132
|
+
| `vercel` | `vercel deploy --prod` | signed in with `npx vercel login` |
|
|
133
|
+
| `github-pages` | `gh-pages -d dist` | this repository's git remote |
|
|
134
|
+
| `surge` | `surge dist <domain>` | `SURGE_TOKEN` (and `SURGE_LOGIN`) |
|
|
135
|
+
| `itch` | `butler push dist user/game:html5` | `BUTLER_API_KEY` |
|
|
136
|
+
| `rsync` (`ssh`, `hostinger`) | `rsync -az --delete dist/ host:path` | your ssh keys |
|
|
137
|
+
| `gitlab-pages` | writes a `pages` job into `.gitlab-ci.yml`, then `git push` | this repository's git remote |
|
|
138
|
+
| `fly`, `railway` | `flyctl deploy`, `railway up` | `FLY_API_TOKEN`, `RAILWAY_TOKEN` |
|
|
139
|
+
| `render` | one POST to the service's deploy hook | `RENDER_DEPLOY_HOOK` |
|
|
140
|
+
| `digitalocean`, `firebase` | `doctl apps create-deployment`, `firebase-tools deploy` | `DIGITALOCEAN_ACCESS_TOKEN`; `firebase login` |
|
|
141
|
+
| `poki` | `@poki/cli versions upload` | you sign in once yourself |
|
|
142
|
+
| `steam`, `google-play`, `app-store`, `meta-horizon` | steamcmd, fastlane supply, `xcrun altool`, ovr-platform-util | the store's own sign-in or key |
|
|
143
|
+
|
|
144
|
+
What a host needs every time can sit in `.clarity/agent.json`: `"ship": { "cloudflare": { "project": "my-site" } }`.
|
|
145
|
+
|
|
146
|
+
## Integrations
|
|
147
|
+
|
|
148
|
+
`add_integration` (the agent's tool) adds a service the app talks to while it runs: it writes `src/services/<id>.js`
|
|
149
|
+
with the service's own client, puts the names of its settings in `.env.example` (never their values) and says which
|
|
150
|
+
package to install. Supabase, Firebase, Neon, PlanetScale, Turso; Stripe, Paddle, Lemon Squeezy; Resend; Clerk,
|
|
151
|
+
Auth0; Sentry, PostHog; Inworld and Convai characters.
|
|
152
|
+
|
|
153
|
+
## MCP servers
|
|
154
|
+
|
|
155
|
+
Any Model Context Protocol server becomes tools: a program on this computer or a remote address.
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{ "mcp": {
|
|
159
|
+
"blender": { "command": "uvx", "args": ["blender-mcp"] },
|
|
160
|
+
"ludo": { "url": "https://…/mcp", "headers": { "Authorization": "Bearer ${LUDO_API_KEY}" } }
|
|
161
|
+
} }
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
A tool the server marks read-only runs; every other one is asked first.
|
|
165
|
+
|
|
166
|
+
## What it changed, and the way back
|
|
167
|
+
|
|
168
|
+
Every step that changes files is a **checkpoint**. Before a write is allowed, the question shows its diff; after it,
|
|
169
|
+
the step lists the files with what was added and taken away, and each opens to its diff. **Undo from here** puts the
|
|
170
|
+
files back as they were before that step (the steps after it are undone too, since they were built on it), and the
|
|
171
|
+
agent is told. A file you changed yourself since is not overwritten unless you say so.
|
|
172
|
+
|
|
173
|
+
In the terminal: `/changes`, `/diff <n>`, `/undo [n]`. In code: `agent.checkpoints.list()`, `.undo(id)`,
|
|
174
|
+
`createCheckpoints({ root })`, `lineDiff(before, after)`.
|
|
175
|
+
|
|
176
|
+
What a command does (`npm install`, a formatter) is not in a checkpoint: nobody can know beforehand which files it
|
|
177
|
+
will touch. Those files are listed with the step, and not undone.
|
|
178
|
+
|
|
179
|
+
## With nobody there: a pipeline, a schedule
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
npx clarity agent --headless --mode auto --allow "npm test" "Fix the failing test"
|
|
183
|
+
# --json --summary run.md --task-file task.txt --max-steps 60 --strict --yes
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Nothing is asked; what would have been asked is refused and listed (`--yes` allows it, except publishing). It ends
|
|
187
|
+
with a code a pipeline reads: `0` done, `1` it failed to run, `2` the steps ran out, `3` done but something was refused
|
|
188
|
+
(`--strict`). `--json` gives every event as a line of JSON; `--summary` a Markdown account of the run (in GitHub
|
|
189
|
+
Actions it also goes to the job's summary).
|
|
190
|
+
|
|
191
|
+
`npx clarity agent ci github --write` writes `.github/workflows/clarity-agent.yml`: run by hand, by an issue comment
|
|
192
|
+
that starts with `/clarity ` from somebody who may write to the repository, or at set times (`--schedule "0 6 * * 1"
|
|
193
|
+
--task "…"`). `npx clarity agent ci gitlab --write` writes a job to include. Both work on a branch and open a pull
|
|
194
|
+
request (a merge request); the provider's key is a secret of the repository; a comment's text reaches the agent as
|
|
195
|
+
data, never as part of a script. The files are valid YAML and are tested as text; **they have not been run on GitHub
|
|
196
|
+
or GitLab yet.**
|
|
197
|
+
|
|
198
|
+
Tasks at set times on your own computer:
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
npx clarity agent schedule add "0 7 * * 1-5" "Update the dependencies and run the tests" --mode auto --allow "npm test"
|
|
202
|
+
npx clarity agent schedule list
|
|
203
|
+
npx clarity agent schedule run # stay, and do each when its time comes
|
|
204
|
+
npx clarity agent schedule due # do what has come due, and leave (for cron, or a CI schedule)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
A line of cron is read as cron reads it (lists, ranges, steps, names, `@daily`), in the computer's own time. Each run
|
|
208
|
+
is headless, and leaves its summary in `.clarity/agent/runs/`.
|
|
209
|
+
|
|
210
|
+
## From Slack, Discord, Telegram and Linear
|
|
211
|
+
|
|
212
|
+
```sh
|
|
213
|
+
npx clarity keys set telegram-bot # the bot's token, from @BotFather
|
|
214
|
+
npx clarity agent chat allow telegram 123456789 # who may talk to it: nobody, until somebody is named
|
|
215
|
+
npx clarity agent chat # stay and answer
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
A message from somebody on the list is a task; the thread, the channel or the issue it came in is one conversation.
|
|
219
|
+
What the agent says comes back there, and what it must ask comes as a question with **Allow** and **Don't allow**
|
|
220
|
+
(buttons in Slack, Discord and Telegram; in Linear, a reply of `allow` or `deny`). `stop`, `new`, `undo` are heard
|
|
221
|
+
too.
|
|
222
|
+
|
|
223
|
+
| | keys (`clarity keys set …`) | how it hears |
|
|
224
|
+
|---|---|---|
|
|
225
|
+
| Telegram | `telegram-bot` | it asks Telegram for its messages: no address has to be open to the internet |
|
|
226
|
+
| Slack | `slack-bot`, `slack-signing` | Events API → `/slack/events`, Interactivity → `/slack/actions`; a mention or a direct message |
|
|
227
|
+
| Discord | `discord-bot`, and `"chat": { "discord": { "appId", "publicKey" } }` in `.clarity/agent.json` | Interactions endpoint → `/discord/interactions`; the command `/clarity task:…` (`clarity agent chat discord-register`) |
|
|
228
|
+
| Linear | `linear`, `linear-webhook` | a webhook for comments → `/linear/webhook`; a comment that starts with `@clarity` |
|
|
229
|
+
|
|
230
|
+
Every request is checked against the service's own signature before it is read (Slack and Linear: HMAC-SHA256;
|
|
231
|
+
Discord: Ed25519), and a stale one is refused. Somebody not on the list is told their id, and nothing runs; an answer
|
|
232
|
+
counts only from somebody on the list. The server listens on this computer alone (`--host` changes that); a tunnel or
|
|
233
|
+
a reverse proxy you set up brings the services' requests to it.
|
|
234
|
+
|
|
235
|
+
Each of the four is tested against a stand-in of its service, signed as the service signs. **None has been connected
|
|
236
|
+
to the real service yet.**
|
|
237
|
+
|
|
238
|
+
## In a window, in an app, and in an editor
|
|
239
|
+
|
|
240
|
+
The same conversation without the terminal:
|
|
241
|
+
|
|
242
|
+
```sh
|
|
243
|
+
npx clarity agent app # a window of its own (--model, --mode, --port, --no-open)
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
It starts a small server on this computer and opens its page as a window without the browser's bars (Chrome, Edge,
|
|
247
|
+
Chromium or Brave, where one is found; otherwise your default browser). You type the task; the steps appear as they
|
|
248
|
+
happen; a question (a file to write, a command to run, money to spend) is a card with **Allow** and **Don't allow**; **Stop**
|
|
249
|
+
ends a task. The model and a key can be given in the window. The page can be installed from the browser's menu, and is
|
|
250
|
+
then an app in the Dock or the Start menu.
|
|
251
|
+
|
|
252
|
+
What keeps it yours: the server listens on `127.0.0.1` only; the address carries a token made for that run, and nothing
|
|
253
|
+
is said or heard without it; a request under another host name or from another page is refused; the page loads nothing
|
|
254
|
+
from anywhere else. It runs while the command runs.
|
|
255
|
+
|
|
256
|
+
**As an app** (macOS, Windows, Linux) the same window needs no terminal and no Node: `packages/clarity-agent-desktop`
|
|
257
|
+
(Electron, with the agent inside it). It is built and packed there; the apps are not signed yet (see its README).
|
|
258
|
+
|
|
259
|
+
In **VS Code, Cursor, Windsurf and VSCodium** the same panel is a view in the side bar, in the Clarity.js extension
|
|
260
|
+
(1.4.2 or later): the Clarity Agent icon in the activity bar. A change opens in the editor's own diff view. In
|
|
261
|
+
**JetBrains IDEs** it is a tool window (`packages/jetbrains-clarity`). Choosing a model is a quick pick, a key goes into the editor's own password box and straight to
|
|
262
|
+
the key store, and the agent works only in a folder you trust. Settings: `clarity.agent.model`, `clarity.agent.mode`.
|
|
263
|
+
|
|
264
|
+
Both are one component (`ui/Panel.clarity`, written in Clarity) over one conversation (`createSession()`): messages in
|
|
265
|
+
(`send`, `answer`, `stop`, `new`, `model`, `mode`), things to show out. A shell of your own needs only to carry them.
|
|
266
|
+
|
|
267
|
+
```js
|
|
268
|
+
import { createSession } from '@clarity-js/agent/session'
|
|
269
|
+
import { startApp } from '@clarity-js/agent/app'
|
|
270
|
+
|
|
271
|
+
const session = createSession({ root: '.', post: (message) => view.postMessage(message) })
|
|
272
|
+
view.onMessage((message) => session.handle(message))
|
|
273
|
+
|
|
274
|
+
const app = await startApp({ root: '.', open: false }) // → { url, port, token, session, close() }
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## In code
|
|
278
|
+
|
|
279
|
+
```js
|
|
280
|
+
import { createAgent, dream, generator, provider } from '@clarity-js/agent'
|
|
281
|
+
|
|
282
|
+
const agent = await createAgent({ root: '.', model: 'deepseek:deepseek-chat', mode: 'edits', ask: async (q) => q.risk !== 'spend' })
|
|
283
|
+
const r = await agent.run('Add a page that lists the bookings, newest first')
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
MIT. No dependencies; Node 18 or newer. Clarity's own tools come from `@ozsarman/clarityjs/make` when Clarity is installed.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// @clarity-js/agent — types.
|
|
2
|
+
|
|
3
|
+
export type Risk = 'read' | 'run' | 'write' | 'exec' | 'spend' | 'publish';
|
|
4
|
+
export interface ToolCall { id: string; name: string; args: Record<string, any> }
|
|
5
|
+
export type Message =
|
|
6
|
+
| { role: 'user'; content: string }
|
|
7
|
+
| { role: 'assistant'; content: string; toolCalls?: ToolCall[]; reasoning?: string }
|
|
8
|
+
| { role: 'tool'; toolCallId: string; name: string; content: string; isError?: boolean };
|
|
9
|
+
export interface ChatRequest { model: string; system?: string; messages: Message[]; tools?: { name: string; description: string; inputSchema: object }[]; maxTokens?: number; temperature?: number; signal?: AbortSignal; json?: boolean }
|
|
10
|
+
export interface ChatResult { text: string; toolCalls: ToolCall[]; reasoning?: string; usage: { input: number; output: number }; stop: string | null; raw: unknown }
|
|
11
|
+
export interface Provider { id: string; config: { name: string; kind: 'anthropic' | 'openai' | 'gemini'; baseUrl: string }; chat(req: ChatRequest): Promise<ChatResult>; models(): Promise<string[]> }
|
|
12
|
+
export interface ProviderInfo { name: string; kind: 'anthropic' | 'openai' | 'gemini'; baseUrl: string; keyEnv?: string; model?: string; local?: boolean; aliases?: string[]; vars?: Record<string, { env?: string; default?: string }>; keyCommand?: string[]; noModelList?: boolean; note?: string }
|
|
13
|
+
|
|
14
|
+
export declare const PROVIDERS: Record<string, ProviderInfo>;
|
|
15
|
+
export declare function parseModel(spec: string): { id: string; model: string | null };
|
|
16
|
+
export declare function provider(id: string, options?: { key?: string; baseUrl?: string; toolMode?: 'native' | 'text'; fetchImpl?: typeof fetch; timeout?: number }): Provider;
|
|
17
|
+
|
|
18
|
+
export interface ToolResult { text: string; error?: boolean; data?: unknown; image?: string }
|
|
19
|
+
export interface ToolContext { root: string; signal?: AbortSignal; ask?: (q: { tool: string; summary: string }) => Promise<boolean | 'always'>; quote?: Quote | null }
|
|
20
|
+
export interface Tool { name: string; description: string; inputSchema: object; risk: Risk; run(args: any, ctx: ToolContext): ToolResult | Promise<ToolResult>; summary?(args: any): string; quote?(args: any, ctx: ToolContext): Quote | Promise<Quote> }
|
|
21
|
+
export interface Quote { connector?: string; name?: string; usd: number | null; note?: string; refuse?: string }
|
|
22
|
+
export interface Question { tool: string; args?: any; summary: string; risk: Risk; usd?: number | null; note?: string }
|
|
23
|
+
export interface Policy { mode: 'ask' | 'edits' | 'auto'; decide(tool: Tool, args: any): 'allow' | 'ask'; allowCommand(prefix: string): void }
|
|
24
|
+
export type AgentEvent =
|
|
25
|
+
| { type: 'text'; text: string; step: number }
|
|
26
|
+
| { type: 'tool'; call: ToolCall; summary: string; step: number }
|
|
27
|
+
| { type: 'result'; call: ToolCall; result: ToolResult; step: number }
|
|
28
|
+
| { type: 'usage'; usage: { input: number; output: number }; step: number }
|
|
29
|
+
| { type: 'refused'; call: ToolCall; reason: string };
|
|
30
|
+
|
|
31
|
+
export declare const CORE_TOOLS: Tool[];
|
|
32
|
+
export declare function policy(options?: { mode?: 'ask' | 'edits' | 'auto'; allow?: string[] }): Policy;
|
|
33
|
+
export declare function inside(root: string, given?: string): string;
|
|
34
|
+
export declare function systemPrompt(options?: { root?: string; extra?: string; clarity?: boolean }): string;
|
|
35
|
+
export declare function runAgent(options: { provider: Pick<Provider, 'chat'>; model: string; system?: string; messages: Message[]; tools?: Tool[]; policy?: Policy; ask?: (q: Question) => Promise<boolean | 'always'>; on?: (e: AgentEvent) => void; root?: string; maxSteps?: number; maxTokens?: number; signal?: AbortSignal }): Promise<{ text: string; steps: number; usage: { input: number; output: number }; unfinished?: boolean }>;
|
|
36
|
+
export declare function clarityTools(options?: { importer?: (specifier: string) => Promise<any> }): Promise<Tool[]>;
|
|
37
|
+
|
|
38
|
+
export interface KeyStore { get(id: string): string | null; where(id: string): string | null; set(id: string, value: string): string; remove(id: string): void; list(ids: string[]): { id: string; set: boolean; masked: string; where: string | null }[] }
|
|
39
|
+
export declare function keyStore(options?: { env?: Record<string, string | undefined>; envName?: (id: string) => string | null }): KeyStore;
|
|
40
|
+
export declare function mask(key: string | null | undefined): string;
|
|
41
|
+
export declare function configDir(env?: Record<string, string | undefined>): string;
|
|
42
|
+
|
|
43
|
+
export interface Limits { daily?: number; monthly?: number; perConnector?: Record<string, number> }
|
|
44
|
+
export interface Ledger { limits: Required<Limits>; today(): number; thisMonth(): number; byConnector(id: string): number; check(connector: string, usd: number): string | null; record(entry: { connector: string; usd: number; [k: string]: unknown }): object; entries(): any[] }
|
|
45
|
+
export declare function ledger(options?: { env?: Record<string, string | undefined>; file?: string; limits?: Limits; now?: () => number }): Ledger;
|
|
46
|
+
export declare function usd(value: number | null | undefined): string;
|
|
47
|
+
|
|
48
|
+
export type AssetKind = 'image' | 'sprite' | 'texture' | 'vector' | 'video' | 'model3d' | 'voice' | 'sfx' | 'music';
|
|
49
|
+
export interface AssetRequest { kind: AssetKind; prompt: string; via?: string; model?: string; out?: string; name?: string; aspect?: string; seconds?: number; voice?: string; negative?: string; refs?: string[]; options?: Record<string, unknown> }
|
|
50
|
+
export interface Adapter { id: string; name: string; kinds: AssetKind[]; keyEnv?: string; keyHint?: string; local?: boolean; docs: string; models: Partial<Record<AssetKind, string | null>>; estimate(req: AssetRequest, config?: object): { usd: number | null; note: string }; generate(req: AssetRequest, ctx: { key: string | null; fetchImpl?: typeof fetch; signal?: AbortSignal; onProgress?: (i: number) => void; config?: Record<string, any> }): Promise<{ files: { bytes?: Uint8Array; url?: string; ext?: string; preview?: boolean }[]; usd?: number | null; meta?: object }> }
|
|
51
|
+
export declare const ADAPTERS: Adapter[];
|
|
52
|
+
export declare const KINDS: AssetKind[];
|
|
53
|
+
export interface Generator { adapters: Adapter[]; available(kind?: AssetKind): { id: string; name: string; kinds: AssetKind[]; local: boolean; ready: boolean }[]; pick(req: { kind: AssetKind; via?: string }): Adapter; quote(req: AssetRequest): Quote; make(req: AssetRequest, options?: { signal?: AbortSignal }): Promise<{ files: string[]; usd: number | null; connector: string; name: string; license: string; cached: boolean; meta: object }> }
|
|
54
|
+
export declare function generator(options?: { root?: string; keys?: KeyStore; ledger?: Ledger; config?: Record<string, any>; adapters?: Adapter[]; fetchImpl?: typeof fetch; onProgress?: (i: number) => void }): Generator;
|
|
55
|
+
export declare function assetTool(gen: Generator): Tool;
|
|
56
|
+
|
|
57
|
+
export interface ShipTarget { name: string; keyEnv?: string; extraEnv?: string[]; need?: string[]; docs: string; note?: string; args(options: Record<string, string>): string[] }
|
|
58
|
+
export declare const TARGETS: Record<'netlify' | 'cloudflare' | 'vercel' | 'github-pages' | 'surge' | 'itch', ShipTarget>;
|
|
59
|
+
export interface ShipRequest { target: string; dir?: string; site?: string; project?: string; domain?: string; game?: string; channel?: string; branch?: string }
|
|
60
|
+
export interface ShipPlan { target: string; name: string; dir: string; argv: string[]; command: string; env: string[]; keySet: boolean; missing: string[]; note: string | null; docs: string }
|
|
61
|
+
export interface Shipper { targets: typeof TARGETS; plan(req: ShipRequest): ShipPlan; ship(req: ShipRequest, options?: { signal?: AbortSignal; onOutput?: (text: string) => void }): Promise<{ ok: boolean; code: number | null; url: string | null; output: string; target: string; dir: string }> }
|
|
62
|
+
export declare function shipper(options?: { root?: string; keys?: KeyStore; config?: Record<string, any>; env?: Record<string, string | undefined>; spawnImpl?: (...args: any[]) => any }): Shipper;
|
|
63
|
+
export declare function shipTool(s: Shipper): Tool;
|
|
64
|
+
export declare function targetOf(name: string): string;
|
|
65
|
+
|
|
66
|
+
export interface Integration { name: string; kind: string; pkg: string; side: 'client' | 'server'; env: string[]; docs: string; code: string; note?: string }
|
|
67
|
+
export declare const INTEGRATIONS: Record<string, Integration>;
|
|
68
|
+
export declare function addIntegration(root: string, id: string, options?: { dir?: string; overwrite?: boolean }): { file: string; wrote: boolean; env: string[]; install: string; note: string | null; docs: string };
|
|
69
|
+
export declare function integrationTool(root: string): Tool;
|
|
70
|
+
|
|
71
|
+
export type McpServer = { command: string; args?: string[]; env?: Record<string, string>; risk?: Risk } | { url: string; headers?: Record<string, string>; risk?: Risk };
|
|
72
|
+
export declare function mcpTools(servers: Record<string, McpServer>, options?: { env?: Record<string, string | undefined>; fetchImpl?: typeof fetch; timeout?: number }): Promise<{ tools: Tool[]; notes: string[]; close(): Promise<unknown> }>;
|
|
73
|
+
export declare function mcpConnect(name: string, server: McpServer, options?: { env?: Record<string, string | undefined>; fetchImpl?: typeof fetch; timeout?: number }): { request(method: string, params?: unknown): Promise<any>; notify(method: string, params?: unknown): Promise<unknown>; close(): Promise<void> };
|
|
74
|
+
|
|
75
|
+
export declare function fillUrl(preset: ProviderInfo, options?: Record<string, any>, env?: Record<string, string | undefined>): string;
|
|
76
|
+
export declare function providerKey(id: string, keys: KeyStore, run?: (cmd: string[]) => string): string | null;
|
|
77
|
+
|
|
78
|
+
export type DreamMode = 'app' | 'site' | 'game';
|
|
79
|
+
export declare const MODES: DreamMode[];
|
|
80
|
+
export interface DreamResult { mode: DreamMode; idea: string; analysis: any; answers: Record<string, string>; concepts: { name: string; hook: string; look: string; core: string; why?: string }[]; chosen: any; design: any; style: any; assets: (AssetRequest & { name: string; use?: string; status: string; usd: number | null })[]; usage: { input: number; output: number }; files: string[] }
|
|
81
|
+
export declare function dream(options: { idea: string; provider: Pick<Provider, 'chat'>; model: string; mode?: DreamMode; answer?: (questions: { id: string; question: string; options?: string[] }[]) => Promise<Record<string, string>>; choose?: (concepts: DreamResult['concepts']) => Promise<number>; root?: string; dir?: string; write?: boolean; quote?: (asset: any) => number | null | Promise<number | null>; signal?: AbortSignal; on?: (step: string) => void }): Promise<DreamResult>;
|
|
82
|
+
export declare function guessMode(idea: string): DreamMode;
|
|
83
|
+
export declare function readJSON(text: string): any;
|
|
84
|
+
export declare function dreamMarkdown(result: DreamResult): string;
|
|
85
|
+
export declare function assetsYaml(assets: object[]): string;
|
|
86
|
+
export declare function readAssetsYaml(text: string): any[];
|
|
87
|
+
|
|
88
|
+
export interface Agent { root: string; model: string; provider: Provider; tools: Tool[]; policy: Policy; messages: Message[]; generator: Generator; shipper: Shipper; ledger: Ledger; mcpNotes: string[]; close(): Promise<unknown>; keys: KeyStore; run(prompt: string, options?: { signal?: AbortSignal }): Promise<{ text: string; steps: number; usage: { input: number; output: number }; total: { input: number; output: number }; unfinished?: boolean }>; dream(idea: string, options?: Partial<Parameters<typeof dream>[0]>): Promise<DreamResult> }
|
|
89
|
+
export declare function createAgent(options?: { root?: string; model?: string; mode?: 'ask' | 'edits' | 'auto'; allow?: string[]; ask?: (q: Question) => Promise<boolean | 'always'>; on?: (e: AgentEvent) => void; env?: Record<string, string | undefined>; fetchImpl?: typeof fetch; keys?: KeyStore; config?: object; tools?: Tool[]; maxSteps?: number }): Promise<Agent>;
|
|
90
|
+
export declare function loadConfig(options?: { root?: string; env?: Record<string, string | undefined> }): any;
|
|
91
|
+
export declare function saveUserConfig(patch: object, options?: { env?: Record<string, string | undefined> }): any;
|
|
92
|
+
export declare function chooseModel(options: { given?: string; config?: any; keys: KeyStore; env?: Record<string, string | undefined> }): { id: string; model: string | null; spec: string } | null;
|
|
93
|
+
export declare function envNameOf(id: string): string | null;
|
|
94
|
+
export declare const VERSION: string;
|
|
95
|
+
|
|
96
|
+
// ── a conversation for a window to show (session.js), and the window (app.js) ──
|
|
97
|
+
export type SessionItem =
|
|
98
|
+
| { id: string; kind: 'user' | 'text' | 'error'; text: string }
|
|
99
|
+
| { id: string; kind: 'tool'; name: string; summary: string; done: boolean; error: boolean; output: string }
|
|
100
|
+
| { id: string; kind: 'ask'; tool: string | null; summary: string; risk: Risk | null; usd: number | null; note: string | null; answer: null | boolean | 'always' }
|
|
101
|
+
| { id: string; kind: 'refused'; summary: string }
|
|
102
|
+
| { id: string; kind: 'done'; steps: number; unfinished?: boolean; stopped?: boolean };
|
|
103
|
+
export interface SessionStatus { busy: boolean; model: string | null; mode: 'ask' | 'edits' | 'auto'; problem: string | null; usage: { input: number; output: number }; spent: { today: number; month: number } | null }
|
|
104
|
+
/** What the page is told. */
|
|
105
|
+
export type SessionOut = ({ type: 'state'; root: string; name: string; items: SessionItem[] } & SessionStatus) | { type: 'item'; item: SessionItem } | ({ type: 'status' } & SessionStatus);
|
|
106
|
+
/** What the page says. */
|
|
107
|
+
export type SessionIn = { type: 'hello' | 'stop' | 'new' } | { type: 'send'; text: string } | { type: 'answer'; id: string; value: boolean | 'always' } | { type: 'model'; spec: string | null } | { type: 'mode'; mode: 'ask' | 'edits' | 'auto' };
|
|
108
|
+
export interface Session { readonly busy: boolean; state(): SessionOut; handle(message: SessionIn): Promise<void>; dispose(): Promise<void> }
|
|
109
|
+
/** A conversation with the agent, as messages in and out: what an editor's panel and the desktop window both talk to. */
|
|
110
|
+
export declare function createSession(options?: { root?: string; post?: (message: SessionOut) => void; make?: (options: object) => Promise<Agent> | Agent; model?: string | null; mode?: 'ask' | 'edits' | 'auto'; options?: object }): Session;
|
|
111
|
+
/** The agent in a window of its own: a server on 127.0.0.1 with a token for this run, and the panel as its page (`@clarity-js/agent/app`). */
|
|
112
|
+
export declare function startApp(options?: { root?: string; port?: number; open?: boolean; model?: string | null; mode?: 'ask' | 'edits' | 'auto'; make?: (options: object) => Promise<Agent> | Agent; options?: object; clarity?: { compile: Function; runtimeDir: string }; keys?: KeyStore }): Promise<{ url: string; port: number; token: string; session: Session; shown: { cmd: string; args: string[]; window: boolean } | null; close(): Promise<void> }>;
|
|
113
|
+
export declare function openWindow(url: string, options?: object): { cmd: string; args: string[]; window: boolean } | null;
|
|
114
|
+
|
|
115
|
+
// ── what changed, kept and put back (diff.js, checkpoints.js) ──
|
|
116
|
+
export interface Diff { text: string; added: number; removed: number; hunks: number; binary: boolean }
|
|
117
|
+
/** The difference between two texts as a unified diff (null: the file is not there). */
|
|
118
|
+
export declare function lineDiff(before: string | null, after: string | null, options?: { path?: string; context?: number; most?: number }): Diff;
|
|
119
|
+
export interface ChangedFile { path: string; status: 'made' | 'changed' | 'removed'; added: number; removed: number; diff: string; kept: boolean }
|
|
120
|
+
export interface Checkpoint { id: number | null; label: string; at: number; files: ChangedFile[]; /** Files a command changed meanwhile: seen, not kept, not undone. */ others: string[]; undone?: boolean }
|
|
121
|
+
export interface Checkpoints {
|
|
122
|
+
root: string;
|
|
123
|
+
begin(label?: string, options?: { watch?: boolean }): { touch(file: string): void; end(): Checkpoint | null };
|
|
124
|
+
list(): Checkpoint[]; get(id: number): Checkpoint | null;
|
|
125
|
+
before(id: number, path: string): Buffer | null;
|
|
126
|
+
/** Put the files back as before step `id` (that step and the later ones). A file changed by somebody else since is a conflict: nothing is undone unless `force`. */
|
|
127
|
+
undo(id: number, options?: { force?: boolean }): { done: boolean; restored: string[]; conflicts: string[]; skipped: string[]; ids: number[] };
|
|
128
|
+
clear(): void;
|
|
129
|
+
}
|
|
130
|
+
export declare function createCheckpoints(options?: { root?: string; dir?: string; most?: number }): Checkpoints;
|
|
131
|
+
|
|
132
|
+
// ── nobody there: a headless run, a pipeline's job, a schedule (headless.js, ci.js, schedule.js) ──
|
|
133
|
+
export interface HeadlessResult { code: 0 | 1 | 2 | 3; state: 'done' | 'unfinished' | 'failed'; text: string; steps: number; usage: { input: number; output: number }; changed: { path: string; status: string; added: number; removed: number }[]; refused: string[]; commands: { command: string; code: number }[]; summary: string }
|
|
134
|
+
/** One task to its end with nothing asked: what would be asked is refused (or allowed with `yes`, never publishing). */
|
|
135
|
+
export declare function runHeadless(options: { root?: string; task: string; model?: string; mode?: 'ask' | 'edits' | 'auto'; allow?: string[]; yes?: boolean; json?: boolean; strict?: boolean; maxSteps?: number; summary?: string | null; env?: Record<string, string | undefined>; write?: (line: string) => void; create?: (options: object) => Promise<Agent> | Agent; options?: object }): Promise<HeadlessResult>;
|
|
136
|
+
export declare function runSummary(run: object): string;
|
|
137
|
+
export declare function githubWorkflow(options?: { schedule?: string | null; task?: string; model?: string; keyEnv?: string; allow?: string[]; node?: number }): string;
|
|
138
|
+
export declare function gitlabJob(options?: { task?: string; model?: string; keyEnv?: string; allow?: string[]; node?: number }): string;
|
|
139
|
+
export interface Cron { minute: Set<number>; hour: Set<number>; day: Set<number>; month: Set<number>; weekday: Set<number>; anyDay: boolean; anyWeekday: boolean }
|
|
140
|
+
export declare function parseCron(expr: string): Cron;
|
|
141
|
+
/** The first time after `from` a schedule allows, in this computer's time (or UTC). null: never. */
|
|
142
|
+
export declare function nextRun(expr: string | Cron, from?: Date, options?: { utc?: boolean }): Date | null;
|
|
143
|
+
export interface Schedule { id: string; cron: string; task: string; model: string | null; mode: 'ask' | 'edits' | 'auto'; allow: string[]; added: string; last: string | null; state: string | null; next?: string | null }
|
|
144
|
+
export declare function schedules(options?: { root?: string; now?: () => Date }): { file: string; list(): Schedule[]; add(entry: { cron: string; task: string; model?: string | null; mode?: 'ask' | 'edits' | 'auto'; allow?: string[] }): Schedule; remove(id: string): boolean; due(at?: Date): Schedule[]; ran(id: string, at: Date, result: { state: string; code: number }): void };
|
|
145
|
+
export declare function serveSchedules(options?: { root?: string; once?: boolean; signal?: AbortSignal | null; log?: (line: string) => void; now?: () => Date; sleep?: (ms: number) => Promise<void> }): Promise<{ id: string; state: string; code: number }[]>;
|
|
146
|
+
|
|
147
|
+
// ── from where a team talks (chat.js) ──
|
|
148
|
+
export declare const CHAT_KEYS: Record<string, string>;
|
|
149
|
+
export declare const CHAT_PLATFORMS: ('slack' | 'discord' | 'telegram' | 'linear')[];
|
|
150
|
+
export interface ChatAdapter { id: string; send(chat: string, message: { text: string; ask?: string }): Promise<void>; routes?: Record<string, (request: { headers: Record<string, string>; body: string; hub: ChatHub }) => Promise<{ status: number; type: string; body: string }>>; start?(hub: ChatHub): void; stop?(): Promise<void> }
|
|
151
|
+
export interface ChatHub { sessions: Map<string, { session: Session }>; hear(message: { platform: string; chat: string; user: string; text: string }): Promise<string>; answer(answer: { platform: string; chat: string; user: string; ask: string; value: boolean }): Promise<boolean>; http(method: string, path: string, headers: Record<string, string>, body: string): Promise<{ status: number; type: string; body: string }>; close(): Promise<void> }
|
|
152
|
+
/** Conversations by where they are held; only the people on `allow` are heard. */
|
|
153
|
+
export declare function createHub(options: { root?: string; adapters: Record<string, ChatAdapter>; allow: Record<string, string[]>; mode?: 'ask' | 'edits' | 'auto'; make?: (options: object) => Promise<Agent> | Agent; options?: object; most?: number; log?: (line: string) => void }): ChatHub;
|
|
154
|
+
export declare function chatAdapters(options: { keys: Pick<KeyStore, 'get'>; config?: object; fetchImpl?: typeof fetch; log?: (line: string) => void }): Record<string, ChatAdapter>;
|
|
155
|
+
export declare function serveChat(options: Parameters<typeof createHub>[0] & { port?: number; host?: string }): Promise<{ hub: ChatHub; port: number | null; url: string | null; close(): Promise<void> }>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,134 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clarity-js/agent",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Clarity Agent: an open-source coding agent that builds websites, web apps and games with Clarity.js on your own model (Anthropic, OpenAI, Gemini, DeepSeek, Kimi, MiniMax, Qwen, GLM, Mistral, Meta, NVIDIA, Ollama, LM Studio, MLX …). Dream Engine turns a sentence into a design; connectors make images, SVG icons, 3D models, video, voice and music (ComfyUI, Comfy Cloud, FLUX.2, Recraft, PixelLab, Higgsfield, MiniMax, ElevenLabs, Tripo, Meshy, fal …), priced and asked first; ship publishes to Netlify, Cloudflare, Vercel, GitHub Pages or itch.io. No dependencies.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.js",
|
|
7
|
+
"module": "./src/index.js",
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./index.d.ts",
|
|
12
|
+
"import": "./src/index.js",
|
|
13
|
+
"default": "./src/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./cli": {
|
|
16
|
+
"import": "./src/cli.js",
|
|
17
|
+
"default": "./src/cli.js"
|
|
18
|
+
},
|
|
19
|
+
"./dream": {
|
|
20
|
+
"types": "./index.d.ts",
|
|
21
|
+
"import": "./src/dream.js",
|
|
22
|
+
"default": "./src/dream.js"
|
|
23
|
+
},
|
|
24
|
+
"./connectors": {
|
|
25
|
+
"types": "./index.d.ts",
|
|
26
|
+
"import": "./src/connectors/index.js",
|
|
27
|
+
"default": "./src/connectors/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./providers": {
|
|
30
|
+
"types": "./index.d.ts",
|
|
31
|
+
"import": "./src/providers.js",
|
|
32
|
+
"default": "./src/providers.js"
|
|
33
|
+
},
|
|
34
|
+
"./ship": {
|
|
35
|
+
"types": "./index.d.ts",
|
|
36
|
+
"import": "./src/ship.js",
|
|
37
|
+
"default": "./src/ship.js"
|
|
38
|
+
},
|
|
39
|
+
"./session": {
|
|
40
|
+
"types": "./index.d.ts",
|
|
41
|
+
"import": "./src/session.js",
|
|
42
|
+
"default": "./src/session.js"
|
|
43
|
+
},
|
|
44
|
+
"./app": {
|
|
45
|
+
"types": "./index.d.ts",
|
|
46
|
+
"import": "./src/app.js",
|
|
47
|
+
"default": "./src/app.js"
|
|
48
|
+
},
|
|
49
|
+
"./checkpoints": {
|
|
50
|
+
"types": "./index.d.ts",
|
|
51
|
+
"import": "./src/checkpoints.js",
|
|
52
|
+
"default": "./src/checkpoints.js"
|
|
53
|
+
},
|
|
54
|
+
"./headless": {
|
|
55
|
+
"types": "./index.d.ts",
|
|
56
|
+
"import": "./src/headless.js",
|
|
57
|
+
"default": "./src/headless.js"
|
|
58
|
+
},
|
|
59
|
+
"./schedule": {
|
|
60
|
+
"types": "./index.d.ts",
|
|
61
|
+
"import": "./src/schedule.js",
|
|
62
|
+
"default": "./src/schedule.js"
|
|
63
|
+
},
|
|
64
|
+
"./chat": {
|
|
65
|
+
"types": "./index.d.ts",
|
|
66
|
+
"import": "./src/chat.js",
|
|
67
|
+
"default": "./src/chat.js"
|
|
68
|
+
},
|
|
69
|
+
"./ci": {
|
|
70
|
+
"types": "./index.d.ts",
|
|
71
|
+
"import": "./src/ci.js",
|
|
72
|
+
"default": "./src/ci.js"
|
|
73
|
+
},
|
|
74
|
+
"./package.json": "./package.json"
|
|
75
|
+
},
|
|
76
|
+
"bin": {
|
|
77
|
+
"clarity-agent": "./src/cli.js"
|
|
78
|
+
},
|
|
79
|
+
"files": [
|
|
80
|
+
"src/",
|
|
81
|
+
"ui/",
|
|
82
|
+
"index.d.ts",
|
|
83
|
+
"README.md"
|
|
84
|
+
],
|
|
85
|
+
"sideEffects": false,
|
|
86
|
+
"keywords": [
|
|
87
|
+
"clarity",
|
|
88
|
+
"@ozsarman/clarityjs",
|
|
89
|
+
"ai-agent",
|
|
90
|
+
"coding-agent",
|
|
91
|
+
"cli",
|
|
92
|
+
"byok",
|
|
93
|
+
"anthropic",
|
|
94
|
+
"openai",
|
|
95
|
+
"gemini",
|
|
96
|
+
"deepseek",
|
|
97
|
+
"kimi",
|
|
98
|
+
"minimax",
|
|
99
|
+
"qwen",
|
|
100
|
+
"ollama",
|
|
101
|
+
"lm-studio",
|
|
102
|
+
"comfyui",
|
|
103
|
+
"elevenlabs",
|
|
104
|
+
"tripo",
|
|
105
|
+
"meshy",
|
|
106
|
+
"flux",
|
|
107
|
+
"recraft",
|
|
108
|
+
"pixel-art",
|
|
109
|
+
"netlify",
|
|
110
|
+
"cloudflare-pages",
|
|
111
|
+
"itch-io",
|
|
112
|
+
"game-dev",
|
|
113
|
+
"web-apps"
|
|
114
|
+
],
|
|
115
|
+
"author": "Özdemir Şarman",
|
|
116
|
+
"license": "MIT",
|
|
117
|
+
"peerDependencies": {
|
|
118
|
+
"@ozsarman/clarityjs": ">=1.16.0"
|
|
119
|
+
},
|
|
120
|
+
"peerDependenciesMeta": {
|
|
121
|
+
"@ozsarman/clarityjs": {
|
|
122
|
+
"optional": true
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"homepage": "https://clarity-js.com/docs/agent",
|
|
126
|
+
"repository": {
|
|
127
|
+
"type": "git",
|
|
128
|
+
"url": "git+https://github.com/ozdemirsarman/clarity.js.git",
|
|
129
|
+
"directory": "packages/clarity-agent"
|
|
130
|
+
},
|
|
131
|
+
"engines": {
|
|
132
|
+
"node": ">=18.0.0"
|
|
133
|
+
}
|
|
134
|
+
}
|