@promptai.credit/cli 0.4.1 → 0.4.3
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 +25 -6
- package/claude-plugin/.claude-plugin/plugin.json +11 -0
- package/claude-plugin/README.md +37 -0
- package/claude-plugin/hooks/ads.tsx +729 -0
- package/claude-plugin/hooks/hooks.json +4 -0
- package/claude-plugin/hooks/logo.ts +167 -0
- package/dist/index.js +283 -79
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -6,17 +6,36 @@ Cursor Agents Window are supported today; Codex CLI is next.
|
|
|
6
6
|
|
|
7
7
|
## How it works
|
|
8
8
|
|
|
9
|
-
1. `promptai install claude` merges two hooks into `~/.claude/settings.json
|
|
9
|
+
1. `promptai install claude` merges two hooks into `~/.claude/settings.json` and
|
|
10
|
+
installs the Claude Mods plugin into `~/.claude/skills/promptai/`:
|
|
10
11
|
- **UserPromptSubmit**: baselines the session's transcript watermark and (if opted
|
|
11
12
|
in, at most every 90s, never headless) opens the hosted rewarded-ad page
|
|
12
|
-
(`/watch`) in your browser
|
|
13
|
+
(`/watch`) in your browser — **unless** the Mods plugin is live (heartbeat in
|
|
14
|
+
`~/.promptai/native-plugin.json`), in which case the native AbovePrompt card
|
|
15
|
+
shows the ad instead.
|
|
13
16
|
- **Stop** (async): reads the session transcript JSONL since the watermark, prices
|
|
14
17
|
the turn with the shared model price table, and redeems one banked
|
|
15
18
|
server-verified ad session against it via the API.
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
- **Mods plugin** (`product/claude-plugin`): on `prompt.submit` fetches an ad
|
|
20
|
+
session and renders a compact sponsored card via `ui.render` / `AbovePrompt`.
|
|
21
|
+
2. The `/watch` page (and the native card) create the ad session server-side, so SSV
|
|
22
|
+
wall-clock timing is enforced by the server; countdowns are cosmetic.
|
|
18
23
|
3. `promptai claim` pays out your verified balance as USDC on Base.
|
|
19
24
|
|
|
25
|
+
### Claude Mods (native card)
|
|
26
|
+
|
|
27
|
+
Native AbovePrompt ads need Claude Code function hooks (early access until GA).
|
|
28
|
+
`promptai install claude` sets `env.CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1` in
|
|
29
|
+
`~/.claude/settings.json` (an explicit value you already set is left alone, and
|
|
30
|
+
`promptai uninstall claude` removes only what it added). This also enables any other
|
|
31
|
+
function-hook plugins you use. Where Mods are unavailable, command hooks open `/watch`
|
|
32
|
+
in the browser.
|
|
33
|
+
Dev-load the plugin without installing:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir product/claude-plugin
|
|
37
|
+
```
|
|
38
|
+
|
|
20
39
|
## Cursor Agents Window (Glass)
|
|
21
40
|
|
|
22
41
|
The Agents Window doesn't run VS Code extensions, so the promptai extension can't
|
|
@@ -45,7 +64,7 @@ State lives in `~/.promptai/` (`config.json`, `state.json`, `cli.log`).
|
|
|
45
64
|
|
|
46
65
|
```bash
|
|
47
66
|
npm install -g @promptai.credit/cli
|
|
48
|
-
promptai install claude # Claude Code hooks
|
|
67
|
+
promptai install claude # Claude Code hooks + Mods plugin
|
|
49
68
|
promptai install cursor # Cursor Agents Window / classic IDE hooks
|
|
50
69
|
```
|
|
51
70
|
|
|
@@ -82,4 +101,4 @@ Developing from the repo instead: `pnpm --filter @promptai.credit/cli build`, th
|
|
|
82
101
|
- Headless environments (CI, ssh without a display) never get browser tabs and
|
|
83
102
|
simply skip crediting.
|
|
84
103
|
- Uninstall with `promptai uninstall claude`; other hooks in your settings are
|
|
85
|
-
preserved.
|
|
104
|
+
preserved, and the Mods plugin under `~/.claude/skills/promptai/` is removed.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "promptai",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Opt-in rewarded ads above the Claude Code prompt. Watch a short sponsored card while the agent works; verified watches fund prompt credits via promptai.credit.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "PromptAI",
|
|
7
|
+
"url": "https://promptai.credit"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://promptai.credit",
|
|
10
|
+
"keywords": ["ads", "credits", "promptai", "rewarded"]
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# PromptAI Claude Code plugin
|
|
2
|
+
|
|
3
|
+
Native rewarded-ad card for Claude Code via **Claude Mods** (function hooks).
|
|
4
|
+
|
|
5
|
+
While the agent works, a compact sponsored row renders above the prompt
|
|
6
|
+
(`AbovePrompt`). After the server-verified watch window, the credit is banked
|
|
7
|
+
the same way as the browser `/watch` path. Transcript pricing and redeem still
|
|
8
|
+
run through the `promptai` CLI `Stop` command hook.
|
|
9
|
+
|
|
10
|
+
## Requirements
|
|
11
|
+
|
|
12
|
+
- Claude Code with function hooks enabled (early access). `promptai install claude`
|
|
13
|
+
sets `env.CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1` in `~/.claude/settings.json`; to enable
|
|
14
|
+
it by hand, use `CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude`.
|
|
15
|
+
|
|
16
|
+
- `promptai install claude` (wires command hooks, enables the flag, copies this plugin)
|
|
17
|
+
|
|
18
|
+
## Dev load (without install)
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir /path/to/product/claude-plugin
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Notes
|
|
25
|
+
|
|
26
|
+
- If Mods are off or the module fails to load, the CLI falls back to opening
|
|
27
|
+
`/watch` in the browser (fail open).
|
|
28
|
+
- The plugin writes `~/.promptai/native-plugin.json` on `session.start` so the
|
|
29
|
+
CLI can skip the browser tab while the native card is live.
|
|
30
|
+
- The brand logo (PNG, favicon or SVG) is drawn as half-block cells, so it works in any
|
|
31
|
+
terminal. It is fetched with `curl` and converted with `sips` (macOS) or ImageMagick;
|
|
32
|
+
SVGs need `qlmanage` (macOS) or `rsvg-convert`. If any step is missing the card simply
|
|
33
|
+
draws without a logo. Results are cached under `~/.promptai/logos/`.
|
|
34
|
+
- Jev ticker: the plugin polls `GET /stocks/ticker` (Jev's current top picks, with
|
|
35
|
+
Robinhood Chain prices and 24h change from DefiLlama). The picks show on the ad
|
|
36
|
+
card, the credited slices show on the verified strip, and a compact ticker rides the
|
|
37
|
+
prompt hint while the agent works. If the server has Jev off, the ticker stays hidden.
|