waitspin 0.1.3 → 0.1.5

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 CHANGED
@@ -26,13 +26,26 @@ waitspin bid create --line "Your ad" --url https://example.com --price-per-block
26
26
  waitspin bid checkout CAMPAIGN_ID
27
27
  npx --yes waitspin init --email you@example.com --key-profile publisher-extension
28
28
 
29
+ # Advanced agent install for every detected supported target
30
+ waitspin install --all --dry-run --api-key PASTE_PUBLISHER_EXTENSION_KEY --compose-existing
31
+ waitspin install --all --api-key PASTE_PUBLISHER_EXTENSION_KEY --compose-existing
32
+ waitspin status --all
33
+
29
34
  # Install for VS Code status-bar fallback
30
35
  waitspin extension install --target vscode --api-key PASTE_PUBLISHER_EXTENSION_KEY
31
36
  waitspin extension status --target vscode
32
37
 
33
38
  # Or install for Claude Code statusline
34
- waitspin claude-code install --api-key PASTE_PUBLISHER_EXTENSION_KEY
39
+ waitspin claude-code install --api-key PASTE_PUBLISHER_EXTENSION_KEY --compose-existing
35
40
  waitspin claude-code status
41
+
42
+ # Or install for MiMo Code shell hook
43
+ waitspin mimocode install --api-key PASTE_PUBLISHER_EXTENSION_KEY
44
+ waitspin mimocode status
45
+
46
+ # Or install for OpenCode TUI plugin slot
47
+ waitspin opencode install --api-key PASTE_PUBLISHER_EXTENSION_KEY
48
+ waitspin opencode status
36
49
  ```
37
50
 
38
51
  ## Commands
@@ -49,16 +62,34 @@ waitspin claude-code status
49
62
  - `waitspin extension install --target vscode` — install the VS Code status-bar fallback
50
63
  - `waitspin extension status --target vscode` — inspect managed fallback lifecycle state
51
64
  - `waitspin extension uninstall --target vscode` — remove the managed fallback runtime and local state
52
- - `waitspin claude-code install` — install the Claude Code statusline command
65
+ - `waitspin install --all --dry-run` — preview detected publisher targets without file changes
66
+ - `waitspin install --all` — install every detected supported publisher target
67
+ - `waitspin status --all` — aggregate lifecycle status for every publisher target
68
+ - `waitspin claude-code install --compose-existing` — install the Claude Code statusline command
53
69
  - `waitspin claude-code status` — inspect managed Claude Code runtime state
54
70
  - `waitspin claude-code uninstall` — restore Claude Code statusline settings and remove managed local state
71
+ - `waitspin mimocode install` — install the MiMo Code shell hook
72
+ - `waitspin mimocode status` — inspect managed MiMo Code runtime state
73
+ - `waitspin mimocode uninstall` — remove managed MiMo Code runtime and bash hook
74
+ - `waitspin opencode install` — install the OpenCode TUI plugin slot
75
+ - `waitspin opencode status` — inspect managed OpenCode runtime state
76
+ - `waitspin opencode uninstall` — remove managed OpenCode runtime and plugin
55
77
 
56
78
  API base: `https://api.waitspin.com`
57
79
 
58
- The public package installs two verified publisher targets: the VS Code
59
- status-bar fallback and the Claude Code statusline command. Claude Code support
60
- uses the official `statusLine.command` path and does not patch Claude Code
61
- internals.
80
+ The public package installs four verified publisher targets: the VS Code
81
+ status-bar fallback, the Claude Code statusline command, the MiMo Code shell
82
+ hook, and the OpenCode TUI plugin slot. Claude Code support uses the official
83
+ `statusLine.command` path and does not patch Claude Code internals. MiMo Code
84
+ uses a bash hook that polls the API for sponsored messages. OpenCode uses its
85
+ TUI `app_bottom` plugin slot.
86
+
87
+ `waitspin install --all` is an advanced agent command for installing every
88
+ detected supported target. It keeps explicit target commands as the canonical
89
+ debug path, supports `--dry-run`, skips unsupported local tools in
90
+ `skipped_not_detected`, reports recoverable config conflicts in
91
+ `skipped_conflict`, and reports unexpected installer failures in
92
+ `failed_rollback`.
62
93
 
63
94
  Payout execution is guarded server-side. Public launch proof uses Stripe test
64
95
  mode with `waitspin wallet payout --confirm-test-transfer`; live transfers stay
@@ -74,8 +105,13 @@ Use a publisher-extension key for publisher polling/events:
74
105
 
75
106
  ```bash
76
107
  npx waitspin init --email you@example.com --key-profile publisher-extension
108
+ npx waitspin install --all --dry-run --api-key PASTE_PUBLISHER_EXTENSION_KEY --compose-existing
109
+ npx waitspin install --all --api-key PASTE_PUBLISHER_EXTENSION_KEY --compose-existing
110
+ npx waitspin status --all
77
111
  npx waitspin extension install --target vscode --api-key PASTE_PUBLISHER_EXTENSION_KEY
78
- npx waitspin claude-code install --api-key PASTE_PUBLISHER_EXTENSION_KEY
112
+ npx waitspin claude-code install --api-key PASTE_PUBLISHER_EXTENSION_KEY --compose-existing
113
+ npx waitspin mimocode install --api-key PASTE_PUBLISHER_EXTENSION_KEY
114
+ npx waitspin opencode install --api-key PASTE_PUBLISHER_EXTENSION_KEY
79
115
  ```
80
116
 
81
117
  - `WAITSPIN_API_KEY` — temporary publisher-extension key for first activation
@@ -92,6 +128,14 @@ The Claude Code installer writes a managed statusline runtime/state under
92
128
  `statusLine.command`. It fails fast when an existing unmanaged statusline is
93
129
  present unless `--compose-existing` is explicitly requested and restorable.
94
130
 
131
+ The MiMo Code installer writes a managed runtime script under `~/.local/bin/`
132
+ and a bash hook in `~/.bashrc`. It polls the API for sponsored messages and
133
+ displays them in the terminal.
134
+
135
+ The OpenCode installer writes a managed runtime/state under `~/.waitspin`,
136
+ installs a TUI plugin under `~/.config/opencode/plugins`, and adds the managed
137
+ entry to `~/.config/opencode/tui.json` so OpenCode mounts the `app_bottom` slot.
138
+
95
139
  ## Release validation
96
140
 
97
141
  Before advertising the public `npx waitspin` path, release operators should run:
@@ -101,4 +145,6 @@ npm --workspace packages/waitspin pack --dry-run --json
101
145
  npm run test:waitspin:distribution
102
146
  npm view waitspin version
103
147
  npx --yes waitspin --help
148
+ npx --yes waitspin@latest mimocode status
149
+ npx --yes waitspin@latest opencode status
104
150
  ```
@@ -0,0 +1,169 @@
1
+ # WaitSpin MiMo Code Integration
2
+
3
+ WaitSpin publisher support for MiMo Code CLI — sponsored status-line messages
4
+ in your terminal.
5
+
6
+ ## Quick Start
7
+
8
+ ```bash
9
+ # 1. Get a publisher-extension key
10
+ npx waitspin init --email you@example.com --key-profile publisher-extension
11
+
12
+ # 2. Install for MiMo Code
13
+ waitspin mimocode install --api-key wts_live_...
14
+
15
+ # 3. Check status
16
+ waitspin mimocode status
17
+
18
+ # 4. Restart your shell or run:
19
+ source ~/.bashrc
20
+ ```
21
+
22
+ ## How It Works
23
+
24
+ 1. **Install** registers your install ID with WaitSpin and adds a bash hook
25
+ 2. **Runtime** polls `POST /v1/serve/next` every 15 seconds for sponsored messages
26
+ 3. **Display** shows the ad line in your terminal: `── Sponsored message ──`
27
+ 4. **Impression** records a billable view after 5 seconds of visibility
28
+
29
+ ## Commands
30
+
31
+ ### `waitspin mimocode install`
32
+
33
+ Register publisher and configure shell integration.
34
+
35
+ ```bash
36
+ waitspin mimocode install --api-key wts_live_...
37
+ waitspin mimocode install --dry-run # preview without changes
38
+ ```
39
+
40
+ Options:
41
+ - `--api-key KEY` — publisher-extension API key (or set `WAITSPIN_API_KEY`)
42
+ - `--dry-run` — show what would be done without making changes
43
+
44
+ ### `waitspin mimocode status`
45
+
46
+ Show installation state and health.
47
+
48
+ ```bash
49
+ waitspin mimocode status
50
+ ```
51
+
52
+ Output includes:
53
+ - `install_id` — unique install identifier
54
+ - `publisher_id` — registered publisher ID
55
+ - `publisher_registered` — whether registration succeeded
56
+ - `runtime_exists` — whether runtime script is present
57
+ - `bashrc_hook` — whether shell hook is installed
58
+
59
+ ### `waitspin mimocode uninstall`
60
+
61
+ Remove all managed files and hooks.
62
+
63
+ ```bash
64
+ waitspin mimocode uninstall
65
+ waitspin mimocode uninstall --dry-run # preview without changes
66
+ ```
67
+
68
+ Removes:
69
+ - `~/.waitspin/mimocode-statusline.json`
70
+ - `~/.waitspin/mimocode-statusline-cache.json`
71
+ - Bash hook from `~/.bashrc`
72
+
73
+ ## Runtime Script
74
+
75
+ The runtime script (`waitspin-mimocode-runtime`) can be called directly:
76
+
77
+ ```bash
78
+ # Fetch and display one ad line
79
+ waitspin-mimocode-runtime
80
+
81
+ # Use in a custom prompt
82
+ PS1="$(__waitspin_statusline)\n$ "
83
+ ```
84
+
85
+ The generated runtime strips terminal control characters from sponsor text
86
+ before the bash hook renders it.
87
+
88
+ ## Configuration
89
+
90
+ ### Environment Variables
91
+
92
+ | Variable | Default | Description |
93
+ |----------|---------|-------------|
94
+ | `WAITSPIN_API_KEY` | — | Publisher-extension API key |
95
+ | `WAITSPIN_BASE_URL` | `https://api.waitspin.com` | API base URL |
96
+ | `WAITSPIN_DEV` | — | Must be `1` before dev override executables are honored |
97
+ | `WAITSPIN_CLI_JS` | — | Development-only CLI delegator override |
98
+ | `WAITSPIN_MIMOCODE_RUNTIME` | — | Development-only runtime launcher override |
99
+
100
+ ### State Files
101
+
102
+ | File | Purpose |
103
+ |------|---------|
104
+ | `~/.waitspin/mimocode-statusline.json` | Install state (API key, install ID) |
105
+ | `~/.waitspin/mimocode-statusline-cache.json` | Runtime cache (active serve) |
106
+
107
+ ## Trust and Warmup
108
+
109
+ New publishers start at trust level 1/10. The serve endpoint returns empty
110
+ inventory until trust warms up. Expected warmup: ~10 days.
111
+
112
+ During warmup, `waitspin-mimocode-runtime` exits silently (no output, no errors).
113
+
114
+ ## Security
115
+
116
+ - API key stored with `chmod 600` (owner read/write only)
117
+ - Runtime never logs or echoes credentials
118
+ - No credentials written to MiMo Code config files
119
+ - State file is isolated in `~/.waitspin/`
120
+ - `WAITSPIN_CLI_JS` and `WAITSPIN_MIMOCODE_RUNTIME` are ignored unless
121
+ `WAITSPIN_DEV=1`. They are development-only trust-boundary overrides; do not
122
+ set them in shared shells, CI, or production-like environments unless you
123
+ intentionally trust the executable.
124
+
125
+ ## Differences from VS Code Extension
126
+
127
+ | Aspect | VS Code | MiMo Code |
128
+ |--------|---------|-----------|
129
+ | Display | Status bar item | Terminal output |
130
+ | Runtime | Packaged extension | Node.js runtime invoked by bash hook |
131
+ | Auth storage | VS Code SecretStorage | `~/.waitspin/` state file |
132
+ | Polling | Extension host interval | Prompt hook/runtime interval |
133
+ | Impression | After min_visible_ms | After min_visible_ms |
134
+
135
+ ## Architecture
136
+
137
+ See [MIMOCODE_ARCHITECTURE.md](./MIMOCODE_ARCHITECTURE.md) for detailed
138
+ architecture documentation.
139
+
140
+ ## Files
141
+
142
+ ```
143
+ packages/waitspin/assets/waitspin-mimocode/
144
+ ├── README.md # This file
145
+ ├── mimocode-install.sh # CLI delegator for install
146
+ ├── mimocode-status.sh # CLI delegator for status
147
+ ├── mimocode-uninstall.sh # CLI delegator for uninstall
148
+ └── mimocode-runtime.sh # Launcher for generated runtime
149
+
150
+ docs/waitspin/
151
+ ├── MIMOCODE_ARCHITECTURE.md # Architecture document
152
+ ```
153
+
154
+ ## Development
155
+
156
+ ```bash
157
+ # Test with local API
158
+ WAITSPIN_BASE_URL=http://localhost:8787 waitspin mimocode install --dry-run
159
+
160
+ # Run runtime manually
161
+ WAITSPIN_API_KEY=wts_live_... waitspin-mimocode-runtime
162
+
163
+ # Check state
164
+ cat ~/.waitspin/mimocode-statusline.json | python3 -m json.tool
165
+ ```
166
+
167
+ ## License
168
+
169
+ MIT — same as the waitspin package.
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ # WaitSpin MiMo Code install script.
3
+ # Delegates to the canonical waitspin CLI implementation.
4
+ set -euo pipefail
5
+
6
+ usage() {
7
+ cat <<'EOF'
8
+ Usage: mimocode-install.sh [waitspin mimocode install options]
9
+
10
+ This asset intentionally does not duplicate install, registration, or JSON
11
+ logic. Use the package CLI as the single source of truth:
12
+
13
+ waitspin mimocode install --api-key KEY
14
+
15
+ For trusted development only, set WAITSPIN_DEV=1 and WAITSPIN_CLI_JS to a
16
+ local dist/cli.js path.
17
+ EOF
18
+ }
19
+
20
+ if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
21
+ usage
22
+ exit 0
23
+ fi
24
+
25
+ if [ -n "${WAITSPIN_CLI_JS:-}" ]; then
26
+ if [ "${WAITSPIN_DEV:-}" != "1" ]; then
27
+ echo "WAITSPIN_CLI_JS requires WAITSPIN_DEV=1." >&2
28
+ exit 126
29
+ fi
30
+ exec node "$WAITSPIN_CLI_JS" mimocode install "$@"
31
+ fi
32
+
33
+ if command -v waitspin >/dev/null 2>&1; then
34
+ exec waitspin mimocode install "$@"
35
+ fi
36
+
37
+ cat >&2 <<'EOF'
38
+ waitspin CLI was not found.
39
+
40
+ Install the package or run from a built checkout, then retry:
41
+ npm --workspace packages/waitspin run build
42
+ node packages/waitspin/dist/cli.js mimocode install --api-key KEY
43
+ EOF
44
+ exit 127
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bash
2
+ # WaitSpin MiMo Code statusline runtime launcher.
3
+ # The real runtime is generated by `waitspin mimocode install`.
4
+ set -euo pipefail
5
+
6
+ if [ -n "${WAITSPIN_MIMOCODE_RUNTIME:-}" ]; then
7
+ if [ "${WAITSPIN_DEV:-}" != "1" ]; then
8
+ exit 0
9
+ fi
10
+ runtime="$WAITSPIN_MIMOCODE_RUNTIME"
11
+ else
12
+ runtime="$HOME/.local/bin/waitspin-mimocode-runtime"
13
+ fi
14
+
15
+ if [ ! -x "$runtime" ]; then
16
+ exit 0
17
+ fi
18
+
19
+ exec "$runtime" "$@"
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ # WaitSpin MiMo Code status script.
3
+ # Delegates to the canonical waitspin CLI implementation.
4
+ set -euo pipefail
5
+
6
+ usage() {
7
+ cat <<'EOF'
8
+ Usage: mimocode-status.sh [waitspin mimocode status options]
9
+
10
+ This asset intentionally does not duplicate status, path-safety, or JSON logic.
11
+ Use the package CLI as the single source of truth:
12
+
13
+ waitspin mimocode status
14
+
15
+ For trusted development only, set WAITSPIN_DEV=1 and WAITSPIN_CLI_JS to a
16
+ local dist/cli.js path.
17
+ EOF
18
+ }
19
+
20
+ if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
21
+ usage
22
+ exit 0
23
+ fi
24
+
25
+ if [ -n "${WAITSPIN_CLI_JS:-}" ]; then
26
+ if [ "${WAITSPIN_DEV:-}" != "1" ]; then
27
+ echo "WAITSPIN_CLI_JS requires WAITSPIN_DEV=1." >&2
28
+ exit 126
29
+ fi
30
+ exec node "$WAITSPIN_CLI_JS" mimocode status "$@"
31
+ fi
32
+
33
+ if command -v waitspin >/dev/null 2>&1; then
34
+ exec waitspin mimocode status "$@"
35
+ fi
36
+
37
+ cat >&2 <<'EOF'
38
+ waitspin CLI was not found.
39
+
40
+ Install the package or run from a built checkout, then retry:
41
+ npm --workspace packages/waitspin run build
42
+ node packages/waitspin/dist/cli.js mimocode status
43
+ EOF
44
+ exit 127
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ # WaitSpin MiMo Code uninstall script.
3
+ # Delegates to the canonical waitspin CLI implementation.
4
+ set -euo pipefail
5
+
6
+ usage() {
7
+ cat <<'EOF'
8
+ Usage: mimocode-uninstall.sh [waitspin mimocode uninstall options]
9
+
10
+ This asset intentionally does not duplicate uninstall, restore, path-safety, or
11
+ JSON logic. Use the package CLI as the single source of truth:
12
+
13
+ waitspin mimocode uninstall
14
+
15
+ For trusted development only, set WAITSPIN_DEV=1 and WAITSPIN_CLI_JS to a
16
+ local dist/cli.js path.
17
+ EOF
18
+ }
19
+
20
+ if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
21
+ usage
22
+ exit 0
23
+ fi
24
+
25
+ if [ -n "${WAITSPIN_CLI_JS:-}" ]; then
26
+ if [ "${WAITSPIN_DEV:-}" != "1" ]; then
27
+ echo "WAITSPIN_CLI_JS requires WAITSPIN_DEV=1." >&2
28
+ exit 126
29
+ fi
30
+ exec node "$WAITSPIN_CLI_JS" mimocode uninstall "$@"
31
+ fi
32
+
33
+ if command -v waitspin >/dev/null 2>&1; then
34
+ exec waitspin mimocode uninstall "$@"
35
+ fi
36
+
37
+ cat >&2 <<'EOF'
38
+ waitspin CLI was not found.
39
+
40
+ Install the package or run from a built checkout, then retry:
41
+ npm --workspace packages/waitspin run build
42
+ node packages/waitspin/dist/cli.js mimocode uninstall
43
+ EOF
44
+ exit 127