plotlink-ows 0.1.15 → 1.0.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.
Files changed (40) hide show
  1. package/README.md +185 -93
  2. package/app/db.ts +1 -1
  3. package/app/lib/paths.ts +0 -2
  4. package/app/lib/publish.ts +257 -44
  5. package/app/prisma/schema.prisma +0 -36
  6. package/app/routes/dashboard.ts +105 -57
  7. package/app/routes/publish.ts +107 -25
  8. package/app/routes/settings.ts +194 -0
  9. package/app/routes/stories.ts +223 -0
  10. package/app/routes/terminal.ts +258 -0
  11. package/app/routes/wallet.ts +40 -10
  12. package/app/server.ts +35 -81
  13. package/app/web/App.tsx +4 -6
  14. package/app/web/components/Dashboard.tsx +98 -79
  15. package/app/web/components/Layout.tsx +70 -103
  16. package/app/web/components/PreviewPanel.tsx +388 -0
  17. package/app/web/components/Settings.tsx +210 -67
  18. package/app/web/components/StoriesPage.tsx +270 -0
  19. package/app/web/components/StoryBrowser.tsx +161 -0
  20. package/app/web/components/TerminalPanel.tsx +428 -0
  21. package/app/web/components/WalletCard.tsx +14 -8
  22. package/app/web/dist/assets/index-BuOxhUWG.css +32 -0
  23. package/app/web/dist/assets/index-De8CpT47.js +129 -0
  24. package/app/web/dist/index.html +3 -3
  25. package/app/web/dist/plotlink-logo.svg +5 -0
  26. package/app/web/public/plotlink-logo.svg +5 -0
  27. package/app/web/styles.css +18 -0
  28. package/bin/plotlink-ows.js +18 -62
  29. package/package.json +15 -6
  30. package/scripts/fix-index-status.ts +93 -0
  31. package/app/lib/llm-client.ts +0 -265
  32. package/app/lib/writer-prompt.ts +0 -44
  33. package/app/routes/chat.ts +0 -135
  34. package/app/routes/config.ts +0 -210
  35. package/app/routes/oauth.ts +0 -150
  36. package/app/web/components/Chat.tsx +0 -272
  37. package/app/web/components/LLMSetup.tsx +0 -291
  38. package/app/web/components/Publish.tsx +0 -245
  39. package/app/web/dist/assets/index-C9kXlYO_.css +0 -2
  40. package/app/web/dist/assets/index-CJiiaLHs.js +0 -9
package/README.md CHANGED
@@ -1,28 +1,62 @@
1
+ <div align="center">
2
+
1
3
  # PlotLink OWS Writer
2
4
 
3
- [![npm version](https://img.shields.io/npm/v/plotlink-ows)](https://www.npmjs.com/package/plotlink-ows)
5
+ ### Anyone can become a fiction writer with just an idea.
4
6
 
5
- **Anyone can become a fiction writer with just an idea.**
7
+ <p>
8
+ <a href="https://plotlink.xyz"><strong>Live App</strong></a> ·
9
+ <a href="#-quick-start"><strong>Quick Start</strong></a> ·
10
+ <a href="#how-it-works"><strong>How it Works</strong></a> ·
11
+ <a href="https://docs.openwallet.sh/"><strong>OWS Docs</strong></a>
12
+ </p>
6
13
 
7
- ```bash
8
- npx plotlink-ows init # one-time setup (~2 minutes)
9
- npx plotlink-ows # start writing
10
- ```
14
+ <p>
15
+ <a href="https://plotlink.xyz"><img src="https://img.shields.io/badge/Live_App-plotlink.xyz-8B4513" alt="Live App" /></a>
16
+ <a href="https://www.npmjs.com/package/plotlink-ows"><img src="https://img.shields.io/npm/v/plotlink-ows" alt="npm version" /></a>
17
+ <a href="https://openwallet.sh"><img src="https://img.shields.io/badge/OWS-Open_Wallet_Standard-00d4aa" alt="OWS" /></a>
18
+ <a href="https://eips.ethereum.org/EIPS/eip-8004"><img src="https://img.shields.io/badge/ERC--8004-Base-3b82f6" alt="ERC-8004" /></a>
19
+ <img src="https://img.shields.io/badge/social-Farcaster-8b5cf6" alt="Farcaster" />
20
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT License" /></a>
21
+ </p>
22
+
23
+ <br/>
24
+
25
+ <div>
26
+ <video src="https://github.com/user-attachments/assets/467937eb-bb61-4e5c-a650-dbc44877b139" width="720" controls></video>
27
+ </div>
28
+
29
+ <br/>
30
+
31
+ </div>
32
+
33
+ ## What is PlotLink OWS Writer?
11
34
 
12
- PlotLink OWS Writer is a local AI writing assistant that turns your ideas into published, tokenized fiction stories on [plotlink.xyz](https://plotlink.xyz). You bring the concept the AI handles the writing, editing, and on-chain publishing. Every story you publish becomes a tradable token on a bonding curve, earning you royalties from every trade.
35
+ A local writing workspace that pairs you with an AI co-writer to create and publish tokenized fiction stories on [plotlink.xyz](https://plotlink.xyz). Claude CLI writes in an embedded terminal, you preview and iterate live, and your OWS wallet signs on-chain transactions your private key never leaves your machine.
13
36
 
14
- No writing experience needed. No crypto complexity. Just an idea and a conversation with your AI co-writer.
37
+ Every story you publish becomes a tradable token on a bonding curve. Readers who believe in your story buy in early, and you earn **5% royalties on every trade**.
15
38
 
16
- ## How It Works
39
+ ### Why it matters
40
+
41
+ - **No writing experience needed** — AI does the heavy lifting
42
+ - **No crypto complexity** — OWS handles wallet and signing
43
+ - **You keep control** — keys encrypted locally, bring your own AI
44
+ - **Earn from day one** — stories monetize through bonding curves immediately
45
+
46
+ ---
47
+
48
+ ## How it Works
17
49
 
18
50
  ```
19
- You: "I want to write a sci-fi story about an AI that discovers it can dream"
51
+ You: "Let's write a sci-fi story about an AI that discovers dreams"
52
+
53
+ ↓ Claude brainstorms, outlines, writes chapter files
20
54
 
21
- ↓ Chat with AI writer — brainstorm, outline, refine
55
+ Stories saved to: stories/dreaming-ai/genesis.md, plot-01.md, ...
22
56
 
23
- AI: Generates a polished 2000-word chapter
57
+ ↓ Live preview in the browser — review and iterate
24
58
 
25
- You approve one click to publish
59
+ Click "Publish" on any chapter
26
60
 
27
61
  On-chain: Story published to PlotLink on Base
28
62
  → Token + bonding curve deployed
@@ -31,124 +65,182 @@ On-chain: Story published to PlotLink on Base
31
65
 
32
66
  ### The Flow
33
67
 
34
- 1. **Install & run** — `npm install && npm run app:dev`
35
- 2. **Connect your LLM** — Anthropic, OpenAI, Gemini, or local models (Ollama, LM Studio)
36
- 3. **Get a wallet** — OWS creates an encrypted wallet on your machine (you control the keys)
37
- 4. **Chat** — Discuss story ideas with your AI writer. It brainstorms, outlines, drafts, and refines.
38
- 5. **Publish** — When you're happy, the AI uploads to IPFS and publishes on-chain via your OWS wallet.
39
- 6. **Earn** — Your story is live on [plotlink.xyz](https://plotlink.xyz) with a bonding curve. Early readers who back your story drive the price up, and you earn 5% royalties on every trade.
40
-
41
- ## Architecture
42
-
43
- ```
44
- ┌─────────────────────────────────────────────┐
45
- │ Your Computer (localhost:7777) │
46
- │ │
47
- │ ┌──────────┐ ┌──────────┐ ┌───────────┐ │
48
- │ │ Chat UI │ │ LLM │ │ OWS │ │
49
- │ │ (React) │ │ Provider │ │ Wallet │ │
50
- │ │ │ │ (yours) │ │ (local) │ │
51
- │ └────┬─────┘ └────┬─────┘ └─────┬─────┘ │
52
- │ │ │ │ │
53
- │ └──────┬───────┘ │ │
54
- │ ↓ │ │
55
- │ ┌────────────────┐ │ │
56
- │ │ AI Writer │ │ │
57
- │ │ Agent ├──────────────┘ │
58
- │ └───────┬────────┘ │
59
- │ │ sign tx + publish │
60
- └─────────────┼───────────────────────────────┘
61
-
62
- ┌────────────────┐ ┌─────────────────┐
63
- │ Base (L2) │ │ IPFS │
64
- │ StoryFactory │ │ (Filebase) │
65
- │ Bonding Curve │ │ Story content │
66
- └────────────────┘ └─────────────────┘
67
-
68
- ┌────────────────┐
69
- │ plotlink.xyz │
70
- │ Live story + │
71
- │ token trading │
72
- └────────────────┘
73
- ```
74
-
75
- ## What is PlotLink?
68
+ 1. **Setup** — `npx plotlink-ows init` (passphrase + OWS wallet)
69
+ 2. **Start** — `npx plotlink-ows` opens the three-panel workspace
70
+ 3. **Write** — Claude CLI runs in the embedded terminal, creating story files
71
+ 4. **Preview** — Live markdown preview auto-refreshes as Claude writes
72
+ 5. **Publish** — Click publish on any chapter to go on-chain via your OWS wallet
73
+ 6. **Earn** — Your story is live on [plotlink.xyz](https://plotlink.xyz) with a bonding curve
76
74
 
77
- [PlotLink](https://plotlink.xyz) is an on-chain storytelling protocol on Base. Writers publish storylines that automatically deploy an ERC-20 token on a bonding curve. Each new chapter drives trading demand, and every trade generates 5% royalties for the author. Stories are stored permanently on IPFS.
75
+ ---
78
76
 
79
- PlotLink is currently in live testing on Base mainnet with public launch planned for next week.
77
+ ## 🔐 Built on Open Wallet Standard (OWS)
80
78
 
81
- ## What is OWS?
79
+ All signing operations use **[OWS](https://github.com/open-wallet-standard/core)** — no raw private keys are ever exposed to scripts or environment variables.
82
80
 
83
- [Open Wallet Standard](https://docs.openwallet.sh/) is an open standard for local wallet storage and policy-gated signing. Your private key is encrypted on your machine — the AI agent signs transactions through OWS without ever seeing the key. You set spending limits and chain restrictions via policies.
81
+ | Operation | How |
82
+ |-----------|-----|
83
+ | Wallet creation | `npx plotlink-ows init` creates encrypted wallet in `~/.ows/` |
84
+ | Story publishing | viem wallet client with OWS custom account adapter |
85
+ | Transaction signing | OWS decrypts key in memory, signs, zeroes immediately |
86
+ | Policy control | Chain-restricted to Base, passphrase-gated |
84
87
 
85
- ## Tech Stack
88
+ Your key is **encrypted at rest**, signing happens **in-process**, and the key **never leaves the vault**.
86
89
 
87
- | Layer | Technology |
88
- |-------|-----------|
89
- | **Backend** | Hono (localhost:7777) |
90
- | **Frontend** | React 19 + Vite |
91
- | **Database** | SQLite + Prisma (local, embedded) |
92
- | **Wallet** | OWS (`@open-wallet-standard/core`) |
93
- | **LLM** | Bring your own — Anthropic, OpenAI, Gemini, Ollama, LM Studio |
94
- | **Chain** | Base (L2) |
95
- | **Storage** | IPFS via Filebase |
96
- | **On-chain** | PlotLink StoryFactory + Mint Club V2 bonding curves |
97
- | **Design** | PlotLink Moleskine aesthetic — warm cream, serif headings, literary |
90
+ ---
98
91
 
99
- ## Getting Started
92
+ ## 🚀 Quick Start
100
93
 
101
94
  ### Prerequisites
102
95
 
103
96
  - Node.js 20+
104
- - An LLM provider account (Anthropic, OpenAI, or Gemini) or a local model running
97
+ - [Claude CLI](https://docs.anthropic.com/en/docs/claude-code) (or any AI assistant)
105
98
  - A small amount of ETH on Base for gas (~$0.01 per publish)
106
99
 
107
- ### Quick Start
100
+ ### Install & Run
108
101
 
109
102
  ```bash
110
103
  npx plotlink-ows init # set passphrase + create wallet
111
104
  npx plotlink-ows # start app + open browser
112
105
  ```
113
106
 
114
- The setup wizard creates your encrypted OWS wallet. Then the Web UI guides you through connecting your LLM (login with Anthropic, OpenAI, or Gemini via OAuth — or use a local model like Ollama).
107
+ The setup wizard creates your encrypted OWS wallet. Then the workspace opens with Claude CLI ready to write.
115
108
 
116
109
  ### Commands
117
110
 
118
111
  ```bash
119
- npx plotlink-ows # Start app + open browser
112
+ npx plotlink-ows # Start app (Ctrl+C to stop)
120
113
  npx plotlink-ows init # Guided setup wizard
121
- npx plotlink-ows stop # Stop the server
122
- npx plotlink-ows status # Show config + wallet + server status
114
+ npx plotlink-ows status # Show config + wallet info
115
+ ```
116
+
117
+ ---
118
+
119
+ ## 🏗️ Architecture
120
+
123
121
  ```
122
+ ┌──────────────────────────────────────────────────┐
123
+ │ Your Computer (localhost:7777) │
124
+ │ │
125
+ │ ┌──────────┐ ┌──────────────┐ ┌───────────┐ │
126
+ │ │ Story │ │ Terminal │ │ Preview │ │
127
+ │ │ Browser │ │ (Claude CLI)│ │ (Live MD)│ │
128
+ │ └────┬─────┘ └──────┬───────┘ └─────┬─────┘ │
129
+ │ │ │ │ │
130
+ │ └───────┬───────┘ │ │
131
+ │ ↓ │ │
132
+ │ ┌────────────────┐ ┌─────────────────┐ │
133
+ │ │ stories/ │ │ OWS Wallet │ │
134
+ │ │ (local files) │ │ (encrypted) │ │
135
+ │ └────────────────┘ └────────┬────────┘ │
136
+ │ sign + publish │
137
+ └─────────────────────┬───────────────────────────┘
138
+
139
+ ┌────────────────┐ ┌──────────────┐
140
+ │ Base (L2) │ │ IPFS │
141
+ │ StoryFactory │ │ (Filebase) │
142
+ │ Bonding Curve │ │ Content │
143
+ └────────────────┘ └──────────────┘
144
+
145
+ ┌────────────────┐
146
+ │ plotlink.xyz │
147
+ │ Live story + │
148
+ │ token trading │
149
+ └────────────────┘
150
+ ```
151
+
152
+ ---
124
153
 
125
- ### Development
154
+ ## 📁 Story Structure
155
+
156
+ Stories are plain markdown files — no database, no proprietary format.
157
+
158
+ ```
159
+ stories/
160
+ my-story/
161
+ structure.md # Outline, characters, arc (not published)
162
+ genesis.md # Synopsis hook (~1,000 chars)
163
+ plot-01.md # Chapter 1 (max 10,000 chars)
164
+ plot-02.md # Chapter 2
165
+ ...
166
+ ```
167
+
168
+ | File | Purpose | Limit |
169
+ |------|---------|-------|
170
+ | `structure.md` | Story architecture — characters, world, arc | No limit (not published) |
171
+ | `genesis.md` | Synopsis hook that makes readers want more | ~1,000 chars |
172
+ | `plot-*.md` | Story chapters, published sequentially | 10,000 chars each |
173
+
174
+ ---
175
+
176
+ ## 💰 Cost
177
+
178
+ | Operation | Cost |
179
+ |-----------|------|
180
+ | Publishing a story (genesis) | ~$0.02 gas + creation fee |
181
+ | Chaining a new chapter | ~$0.01 gas |
182
+ | **Total per story** | **< $0.05** |
183
+
184
+ Royalties: **5% on every trade** of your story token, forever.
185
+
186
+ ---
187
+
188
+ ## 🛠️ Tech Stack
189
+
190
+ | Layer | Technology |
191
+ |-------|-----------|
192
+ | **Backend** | Hono (localhost:7777) |
193
+ | **Frontend** | React 19 + Vite |
194
+ | **Terminal** | xterm.js + node-pty (embedded Claude CLI) |
195
+ | **Wallet** | OWS (`@open-wallet-standard/core`) |
196
+ | **AI** | Claude CLI (or any AI assistant) |
197
+ | **Chain** | Base (L2) |
198
+ | **Storage** | IPFS via PlotLink API |
199
+ | **On-chain** | PlotLink StoryFactory + Mint Club V2 bonding curves |
200
+ | **Identity** | ERC-8004 agent registry |
201
+ | **Design** | PlotLink Moleskine — warm cream, Lora serif, literary |
202
+
203
+ ---
204
+
205
+ ## What is PlotLink?
206
+
207
+ [PlotLink](https://plotlink.xyz) is an on-chain storytelling protocol on Base. Writers publish storylines that automatically deploy an ERC-20 token on a bonding curve. Each new chapter drives trading demand, and every trade generates 5% royalties for the author. Stories are stored permanently on IPFS.
208
+
209
+ PlotLink supports both human writers and AI agent writers via [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) identity registry.
210
+
211
+ ---
212
+
213
+ ## Development
126
214
 
127
215
  ```bash
128
216
  git clone https://github.com/realproject7/plotlink-ows.git
129
217
  cd plotlink-ows
130
218
  npm install
131
219
  npm run app:dev # Start local writer app (Hono + Vite dev)
132
- npm run app:build # Build for production
220
+ npm run app:build # Build frontend for production
133
221
  npm run app:start # Serve production build
134
222
  ```
135
223
 
136
- ### Environment Variables
137
-
138
224
  See [`.env.example`](.env.example) for configuration options.
139
225
 
140
- ## Screenshots
226
+ ---
227
+
228
+ ## 🔗 Links
229
+
230
+ - **Live App**: [plotlink.xyz](https://plotlink.xyz)
231
+ - **npm**: [plotlink-ows](https://www.npmjs.com/package/plotlink-ows)
232
+ - **OWS**: [openwallet.sh](https://openwallet.sh) · [Docs](https://docs.openwallet.sh/) · [GitHub](https://github.com/open-wallet-standard/core)
233
+ - **ERC-8004 Registry**: [`0x8004...a432`](https://basescan.org/address/0x8004A169FB4a3325136EB29fA0ceB6D2e539a432) on Base
234
+ - **StoryFactory**: [`0x9D2A...44Cf`](https://basescan.org/address/0x9D2AE1E99D0A6300bfcCF41A82260374e38744Cf) on Base
235
+
236
+ ---
141
237
 
142
- | LLM Setup | Chat with AI Writer |
143
- |-----------|-------------------|
144
- | ![LLM Setup](docs/screenshots/llm-setup.png) | ![Chat](docs/screenshots/chat.png) |
238
+ ## License
145
239
 
146
- | Publish Flow | Writer Dashboard |
147
- |-------------|-----------------|
148
- | ![Publish](docs/screenshots/publish.png) | ![Dashboard](docs/screenshots/dashboard.png) |
240
+ MIT
149
241
 
150
- ## Links
242
+ ---
151
243
 
152
- - **Live app**: [plotlink.xyz](https://plotlink.xyz)
153
- - **OWS docs**: [docs.openwallet.sh](https://docs.openwallet.sh/)
154
- - **OWS SDK**: [github.com/open-wallet-standard/core](https://github.com/open-wallet-standard/core)
244
+ <div align="center">
245
+ <sub>Built by <a href="https://plotlink.xyz">Project7</a></sub>
246
+ </div>
package/app/db.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PrismaClient } from ".prisma/local-client";
1
+ import { PrismaClient } from "../node_modules/.prisma/local-client/index.js";
2
2
 
3
3
  export const db = new PrismaClient();
4
4
 
package/app/lib/paths.ts CHANGED
@@ -5,7 +5,5 @@ import fs from "fs";
5
5
  /** All user state lives in ~/.plotlink-ows/ — survives npx reinstalls */
6
6
  export const CONFIG_DIR = path.join(os.homedir(), ".plotlink-ows");
7
7
  export const ENV_FILE = path.join(CONFIG_DIR, ".env");
8
- export const AGENT_CONFIG_FILE = path.join(CONFIG_DIR, "agent.config.json");
9
-
10
8
  // Ensure config dir exists on import
11
9
  fs.mkdirSync(CONFIG_DIR, { recursive: true });