plotlink-ows 0.1.13

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 (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -0
  3. package/app/db.ts +8 -0
  4. package/app/lib/llm-client.ts +265 -0
  5. package/app/lib/paths.ts +11 -0
  6. package/app/lib/publish.ts +204 -0
  7. package/app/lib/writer-prompt.ts +44 -0
  8. package/app/node_modules/.prisma/local-client/client.d.ts +1 -0
  9. package/app/node_modules/.prisma/local-client/client.js +5 -0
  10. package/app/node_modules/.prisma/local-client/default.d.ts +1 -0
  11. package/app/node_modules/.prisma/local-client/default.js +5 -0
  12. package/app/node_modules/.prisma/local-client/edge.d.ts +1 -0
  13. package/app/node_modules/.prisma/local-client/edge.js +184 -0
  14. package/app/node_modules/.prisma/local-client/index-browser.js +173 -0
  15. package/app/node_modules/.prisma/local-client/index.d.ts +3304 -0
  16. package/app/node_modules/.prisma/local-client/index.js +207 -0
  17. package/app/node_modules/.prisma/local-client/libquery_engine-darwin-arm64.dylib.node +0 -0
  18. package/app/node_modules/.prisma/local-client/package.json +183 -0
  19. package/app/node_modules/.prisma/local-client/query_engine_bg.js +2 -0
  20. package/app/node_modules/.prisma/local-client/query_engine_bg.wasm +0 -0
  21. package/app/node_modules/.prisma/local-client/runtime/edge-esm.js +35 -0
  22. package/app/node_modules/.prisma/local-client/runtime/edge.js +35 -0
  23. package/app/node_modules/.prisma/local-client/runtime/index-browser.d.ts +370 -0
  24. package/app/node_modules/.prisma/local-client/runtime/index-browser.js +17 -0
  25. package/app/node_modules/.prisma/local-client/runtime/library.d.ts +3982 -0
  26. package/app/node_modules/.prisma/local-client/runtime/library.js +147 -0
  27. package/app/node_modules/.prisma/local-client/runtime/react-native.js +84 -0
  28. package/app/node_modules/.prisma/local-client/runtime/wasm-compiler-edge.js +85 -0
  29. package/app/node_modules/.prisma/local-client/runtime/wasm-engine-edge.js +38 -0
  30. package/app/node_modules/.prisma/local-client/schema.prisma +21 -0
  31. package/app/node_modules/.prisma/local-client/wasm-edge-light-loader.mjs +5 -0
  32. package/app/node_modules/.prisma/local-client/wasm-worker-loader.mjs +5 -0
  33. package/app/node_modules/.prisma/local-client/wasm.d.ts +1 -0
  34. package/app/node_modules/.prisma/local-client/wasm.js +191 -0
  35. package/app/prisma/schema.prisma +57 -0
  36. package/app/routes/auth.ts +173 -0
  37. package/app/routes/chat.ts +135 -0
  38. package/app/routes/config.ts +210 -0
  39. package/app/routes/dashboard.ts +186 -0
  40. package/app/routes/oauth.ts +150 -0
  41. package/app/routes/publish.ts +112 -0
  42. package/app/routes/wallet.ts +99 -0
  43. package/app/server.ts +154 -0
  44. package/app/vite.config.ts +19 -0
  45. package/app/web/App.tsx +102 -0
  46. package/app/web/components/Chat.tsx +272 -0
  47. package/app/web/components/Dashboard.tsx +222 -0
  48. package/app/web/components/LLMSetup.tsx +291 -0
  49. package/app/web/components/Layout.tsx +235 -0
  50. package/app/web/components/Login.tsx +62 -0
  51. package/app/web/components/Publish.tsx +245 -0
  52. package/app/web/components/Settings.tsx +175 -0
  53. package/app/web/components/Setup.tsx +84 -0
  54. package/app/web/components/WalletCard.tsx +117 -0
  55. package/app/web/dist/assets/index-C9kXlYO_.css +2 -0
  56. package/app/web/dist/assets/index-CJiiaLHs.js +9 -0
  57. package/app/web/dist/index.html +16 -0
  58. package/app/web/index.html +15 -0
  59. package/app/web/main.tsx +10 -0
  60. package/app/web/plotlink-logo.svg +5 -0
  61. package/app/web/styles.css +51 -0
  62. package/bin/plotlink-ows.js +394 -0
  63. package/lib/ows/index.ts +3 -0
  64. package/lib/ows/policy.ts +68 -0
  65. package/lib/ows/types.ts +14 -0
  66. package/lib/ows/wallet.ts +70 -0
  67. package/package.json +79 -0
  68. package/packages/cli/node_modules/commander/LICENSE +22 -0
  69. package/packages/cli/node_modules/commander/Readme.md +1149 -0
  70. package/packages/cli/node_modules/commander/esm.mjs +16 -0
  71. package/packages/cli/node_modules/commander/index.js +24 -0
  72. package/packages/cli/node_modules/commander/lib/argument.js +149 -0
  73. package/packages/cli/node_modules/commander/lib/command.js +2662 -0
  74. package/packages/cli/node_modules/commander/lib/error.js +39 -0
  75. package/packages/cli/node_modules/commander/lib/help.js +709 -0
  76. package/packages/cli/node_modules/commander/lib/option.js +367 -0
  77. package/packages/cli/node_modules/commander/lib/suggestSimilar.js +101 -0
  78. package/packages/cli/node_modules/commander/package-support.json +16 -0
  79. package/packages/cli/node_modules/commander/package.json +82 -0
  80. package/packages/cli/node_modules/commander/typings/esm.d.mts +3 -0
  81. package/packages/cli/node_modules/commander/typings/index.d.ts +1045 -0
  82. package/packages/cli/node_modules/resolve-from/index.d.ts +31 -0
  83. package/packages/cli/node_modules/resolve-from/index.js +47 -0
  84. package/packages/cli/node_modules/resolve-from/license +9 -0
  85. package/packages/cli/node_modules/resolve-from/package.json +36 -0
  86. package/packages/cli/node_modules/resolve-from/readme.md +72 -0
  87. package/packages/cli/node_modules/tsup/LICENSE +21 -0
  88. package/packages/cli/node_modules/tsup/README.md +75 -0
  89. package/packages/cli/node_modules/tsup/assets/cjs_shims.js +13 -0
  90. package/packages/cli/node_modules/tsup/assets/esm_shims.js +9 -0
  91. package/packages/cli/node_modules/tsup/assets/package.json +3 -0
  92. package/packages/cli/node_modules/tsup/dist/chunk-DI5BO6XE.js +153 -0
  93. package/packages/cli/node_modules/tsup/dist/chunk-JZ25TPTY.js +42 -0
  94. package/packages/cli/node_modules/tsup/dist/chunk-PEEXUWMS.js +6 -0
  95. package/packages/cli/node_modules/tsup/dist/chunk-TWFEYLU4.js +352 -0
  96. package/packages/cli/node_modules/tsup/dist/chunk-VGC3FXLU.js +203 -0
  97. package/packages/cli/node_modules/tsup/dist/cli-default.js +12 -0
  98. package/packages/cli/node_modules/tsup/dist/cli-main.js +8 -0
  99. package/packages/cli/node_modules/tsup/dist/cli-node.js +14 -0
  100. package/packages/cli/node_modules/tsup/dist/index.d.ts +511 -0
  101. package/packages/cli/node_modules/tsup/dist/index.js +1711 -0
  102. package/packages/cli/node_modules/tsup/dist/rollup.js +6949 -0
  103. package/packages/cli/node_modules/tsup/package.json +99 -0
  104. package/packages/cli/node_modules/tsup/schema.json +362 -0
  105. package/packages/cli/package.json +35 -0
  106. package/packages/cli/src/commands/agent-register.ts +77 -0
  107. package/packages/cli/src/commands/chain.ts +29 -0
  108. package/packages/cli/src/commands/claim.ts +70 -0
  109. package/packages/cli/src/commands/create.ts +34 -0
  110. package/packages/cli/src/commands/status.ts +201 -0
  111. package/packages/cli/src/config.ts +103 -0
  112. package/packages/cli/src/index.ts +21 -0
  113. package/packages/cli/src/sdk/abi.ts +222 -0
  114. package/packages/cli/src/sdk/client.ts +713 -0
  115. package/packages/cli/src/sdk/constants.ts +56 -0
  116. package/packages/cli/src/sdk/index.ts +46 -0
  117. package/packages/cli/src/sdk/ipfs.ts +88 -0
  118. package/packages/cli/src/sdk.ts +36 -0
  119. package/packages/cli/tsconfig.json +20 -0
  120. package/packages/cli/tsup.config.ts +14 -0
  121. package/public/.well-known/farcaster.json +38 -0
  122. package/public/basescan-icon.svg +4 -0
  123. package/public/embed-image.png +0 -0
  124. package/public/favicon.png +0 -0
  125. package/public/hunt-token.svg +11 -0
  126. package/public/icon-192.png +0 -0
  127. package/public/icon.png +0 -0
  128. package/public/manifest.json +26 -0
  129. package/public/mc-icon-light.svg +12 -0
  130. package/public/og-image.png +0 -0
  131. package/public/plotlink-logo-symbol.svg +5 -0
  132. package/public/plotlink-logo.svg +5 -0
  133. package/public/screenshot-1.png +0 -0
  134. package/public/screenshot-2.png +0 -0
  135. package/public/screenshot-3.png +0 -0
  136. package/public/splash.png +0 -0
  137. package/public/wide-banner.png +0 -0
  138. package/scripts/backfill-trade-prices.ts +97 -0
  139. package/scripts/backfill-usd-rates.ts +220 -0
  140. package/scripts/e2e-verify.ts +1100 -0
  141. package/scripts/ows-smoke-test.ts +37 -0
  142. package/scripts/score-users.mjs +203 -0
@@ -0,0 +1,37 @@
1
+ /**
2
+ * OWS SDK smoke test — verifies native bindings load and basic operations work.
3
+ * Run: npx tsx scripts/ows-smoke-test.ts
4
+ */
5
+ import { createWallet, getWallet, signMessage, deleteWallet } from "@open-wallet-standard/core";
6
+
7
+ const TEST_WALLET_NAME = `plotlink-smoke-test-${Date.now()}`;
8
+
9
+ try {
10
+ console.log("1. Creating wallet...");
11
+ const wallet = createWallet(TEST_WALLET_NAME);
12
+ console.log(` ✓ Created: ${wallet.id} (${wallet.name})`);
13
+ console.log(` Accounts: ${wallet.accounts.length}`);
14
+
15
+ const baseAccount = wallet.accounts.find((a) => a.chainId.startsWith("eip155:"));
16
+ if (!baseAccount) throw new Error("No EVM account derived");
17
+ console.log(` ✓ Base address: ${baseAccount.address}`);
18
+
19
+ console.log("2. Retrieving wallet...");
20
+ const retrieved = getWallet(wallet.id);
21
+ console.log(` ✓ Retrieved: ${retrieved.name}`);
22
+
23
+ console.log("3. Signing message...");
24
+ const sig = signMessage(wallet.id, baseAccount.chainId, "PlotLink OWS test");
25
+ console.log(` ✓ Signature: ${sig.signature.slice(0, 20)}...`);
26
+
27
+ console.log("4. Cleaning up...");
28
+ deleteWallet(wallet.id);
29
+ console.log(" ✓ Wallet deleted");
30
+
31
+ console.log("\n✅ OWS SDK smoke test passed");
32
+ } catch (err) {
33
+ console.error("\n❌ OWS SDK smoke test failed:", err);
34
+ // Attempt cleanup
35
+ try { deleteWallet(TEST_WALLET_NAME); } catch { /* ignore */ }
36
+ process.exit(1);
37
+ }
@@ -0,0 +1,203 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Score DropCast users for PlotLink Writer/Reader targeting.
4
+ * Input: archive/dropcast-user-table-20260330.csv
5
+ * Output: archive/dropcast-users-scored-20260330.csv
6
+ */
7
+
8
+ import { readFileSync, writeFileSync } from "node:fs";
9
+ import { resolve, dirname } from "node:path";
10
+ import { fileURLToPath } from "node:url";
11
+
12
+ const __dirname = dirname(fileURLToPath(import.meta.url));
13
+ const ROOT = resolve(__dirname, "..");
14
+
15
+ const INPUT = resolve(ROOT, "archive/dropcast-user-table-20260330.csv");
16
+ const OUTPUT = resolve(ROOT, "archive/dropcast-users-scored-20260330.csv");
17
+
18
+ // ---------------------------------------------------------------------------
19
+ // CSV parsing (handles quoted fields with commas/newlines)
20
+ // ---------------------------------------------------------------------------
21
+
22
+ function parseCSV(text) {
23
+ const rows = [];
24
+ let i = 0;
25
+ while (i < text.length) {
26
+ const row = [];
27
+ while (i < text.length) {
28
+ if (text[i] === '"') {
29
+ i++; // skip opening quote
30
+ let val = "";
31
+ while (i < text.length) {
32
+ if (text[i] === '"' && text[i + 1] === '"') { val += '"'; i += 2; }
33
+ else if (text[i] === '"') { i++; break; }
34
+ else { val += text[i]; i++; }
35
+ }
36
+ row.push(val);
37
+ if (text[i] === ",") i++;
38
+ else if (text[i] === "\n" || text[i] === "\r") { if (text[i] === "\r") i++; i++; break; }
39
+ else if (i >= text.length) break;
40
+ } else {
41
+ let val = "";
42
+ while (i < text.length && text[i] !== "," && text[i] !== "\n" && text[i] !== "\r") {
43
+ val += text[i]; i++;
44
+ }
45
+ row.push(val);
46
+ if (text[i] === ",") i++;
47
+ else { if (text[i] === "\r") i++; if (text[i] === "\n") i++; break; }
48
+ }
49
+ }
50
+ if (row.length > 1 || (row.length === 1 && row[0] !== "")) rows.push(row);
51
+ }
52
+ return rows;
53
+ }
54
+
55
+ function escapeCSV(val) {
56
+ const s = String(val ?? "");
57
+ if (s.includes(",") || s.includes('"') || s.includes("\n")) {
58
+ return '"' + s.replace(/"/g, '""') + '"';
59
+ }
60
+ return s;
61
+ }
62
+
63
+ // ---------------------------------------------------------------------------
64
+ // Scoring
65
+ // ---------------------------------------------------------------------------
66
+
67
+ function logScale(val, max) {
68
+ if (val <= 0) return 0;
69
+ return Math.min(1, Math.log10(val + 1) / Math.log10(max + 1));
70
+ }
71
+
72
+ function scoreUser(row, headers) {
73
+ const get = (col) => row[headers.indexOf(col)] ?? "";
74
+ const num = (col) => { const v = parseFloat(get(col)); return isNaN(v) ? 0 : v; };
75
+ const bool = (col) => get(col) === "true" || get(col) === "t";
76
+ const has = (col) => get(col).trim().length > 0;
77
+
78
+ // Instant disqualify
79
+ if (bool("is_blacklisted")) return { score: 0, tag: "None" };
80
+
81
+ // spam_label: 1 = spam, 2 = verified non-spammer, 0/blank = unknown
82
+ const spamLabel = parseInt(get("spam_label"), 10);
83
+ if (spamLabel === 1) return { score: 0, tag: "None" };
84
+
85
+ const followers = num("follower_count");
86
+ const following = num("following_count");
87
+
88
+ // Zero-engagement accounts = inactive/bot
89
+ if (followers === 0 && following === 0) {
90
+ return { score: 0, tag: "None" };
91
+ }
92
+
93
+ // No profile data at all = None
94
+ if (!has("bio") && !has("pfp_url") && !has("twitter")) {
95
+ return { score: 0, tag: "None" };
96
+ }
97
+
98
+ // --- Social Reach (40%) ---
99
+ const fcReach = logScale(followers, 100000); // FC followers, log-scaled to 100k
100
+ const xReach = logScale(num("x_followers_count"), 500000); // X followers
101
+ const xVerified = bool("x_verified") ? 1 : 0;
102
+ const socialScore = (fcReach * 0.55 + xReach * 0.35 + xVerified * 0.1) * 40;
103
+
104
+ // --- Reputation (30%) ---
105
+ const neynarScore = Math.min(1, num("neynar_score"));
106
+ const quotientScore = Math.min(1, num("quotient_score"));
107
+ const powerBadge = bool("power_badge") ? 1 : 0;
108
+ const proBadge = bool("is_pro_subscriber") ? 1 : 0;
109
+ const repScore = (neynarScore * 0.4 + quotientScore * 0.3 + powerBadge * 0.2 + proBadge * 0.1) * 30;
110
+
111
+ // --- Profile Completeness (15%) ---
112
+ const hasBio = has("bio") ? 1 : 0;
113
+ const hasTwitter = has("twitter") ? 1 : 0;
114
+ const hasUrl = has("url") ? 1 : 0;
115
+ const hasPfp = has("pfp_url") ? 1 : 0;
116
+ const profileScore = ((hasBio + hasTwitter + hasUrl + hasPfp) / 4) * 15;
117
+
118
+ // spam_label=0/blank (unknown) applies a small penalty; spam_label=2 (verified) gets a bonus
119
+ const spamPenalty = spamLabel === 2 ? 2 : (isNaN(spamLabel) || spamLabel === 0) ? -3 : 0;
120
+
121
+ const raw = socialScore + repScore + profileScore + spamPenalty;
122
+ const score = Math.max(0, Math.min(100, Math.round(raw)));
123
+
124
+ // --- Tagging ---
125
+ if (score < 10) return { score, tag: "None" };
126
+
127
+ // Writer signals: creator pattern (followers >> following), has bio, has url/github
128
+ const ratio = following > 0 ? followers / following : followers;
129
+ const bio = get("bio").toLowerCase();
130
+ const writerKeywords = ["writ", "author", "fiction", "story", "novel", "poet", "creat", "artist", "journal"];
131
+ const hasWriterKeyword = writerKeywords.some((kw) => bio.includes(kw));
132
+
133
+ const writerSignals =
134
+ (ratio > 2 ? 1 : 0) +
135
+ (has("github") ? 1 : 0) +
136
+ (has("url") ? 1 : 0) +
137
+ (hasBio && get("bio").length > 50 ? 1 : 0) +
138
+ (hasWriterKeyword ? 1.5 : 0) +
139
+ (neynarScore >= 0.7 ? 1 : 0);
140
+
141
+ if (writerSignals >= 3) return { score, tag: "Writer" };
142
+ return { score, tag: "Reader" };
143
+ }
144
+
145
+ // ---------------------------------------------------------------------------
146
+ // Main
147
+ // ---------------------------------------------------------------------------
148
+
149
+ const raw = readFileSync(INPUT, "utf-8");
150
+ const rows = parseCSV(raw);
151
+ const headers = rows[0];
152
+ const data = rows.slice(1);
153
+
154
+ console.log(`Input: ${data.length} users, ${headers.length} columns`);
155
+
156
+ const scored = data.map((row) => {
157
+ const { score, tag } = scoreUser(row, headers);
158
+ return { row, score, tag };
159
+ });
160
+
161
+ // Sort by score descending
162
+ scored.sort((a, b) => b.score - a.score);
163
+
164
+ // Build output
165
+ const outHeaders = [...headers, "plotlink_score", "plotlink_tag"];
166
+ const outRows = scored.map(({ row, score, tag }) =>
167
+ [...row, score, tag].map(escapeCSV).join(","),
168
+ );
169
+ const output = [outHeaders.map(escapeCSV).join(","), ...outRows].join("\n") + "\n";
170
+ writeFileSync(OUTPUT, output);
171
+
172
+ // --- Summary stats ---
173
+ const tagCounts = { Writer: 0, Reader: 0, None: 0 };
174
+ const buckets = { "80-100": 0, "60-79": 0, "40-59": 0, "20-39": 0, "0-19": 0 };
175
+
176
+ for (const { score, tag } of scored) {
177
+ tagCounts[tag]++;
178
+ if (score >= 80) buckets["80-100"]++;
179
+ else if (score >= 60) buckets["60-79"]++;
180
+ else if (score >= 40) buckets["40-59"]++;
181
+ else if (score >= 20) buckets["20-39"]++;
182
+ else buckets["0-19"]++;
183
+ }
184
+
185
+ console.log("\n=== Summary ===");
186
+ console.log(`Writers: ${tagCounts.Writer} | Readers: ${tagCounts.Reader} | None: ${tagCounts.None}`);
187
+ console.log(`\nScore Distribution:`);
188
+ for (const [range, count] of Object.entries(buckets)) {
189
+ console.log(` ${range}: ${count}`);
190
+ }
191
+
192
+ console.log(`\nTop 20 Users:`);
193
+ console.log("Rank | Username | Score | Tag | Followers | Bio");
194
+ console.log("-----|----------|-------|-----|-----------|----");
195
+ for (let i = 0; i < Math.min(20, scored.length); i++) {
196
+ const { row, score, tag } = scored[i];
197
+ const username = row[headers.indexOf("username")] || "?";
198
+ const followers = row[headers.indexOf("follower_count")] || "0";
199
+ const bio = (row[headers.indexOf("bio")] || "").slice(0, 60).replace(/\n/g, " ");
200
+ console.log(`${i + 1}. ${username} | ${score} | ${tag} | ${followers} | ${bio}`);
201
+ }
202
+
203
+ console.log(`\nOutput: ${OUTPUT}`);