@agenticmail/enterprise 0.5.526 → 0.5.528
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/dist/agent-tools-JLIDLCYB.js +14677 -0
- package/dist/chunk-5CENM5VB.js +2281 -0
- package/dist/chunk-7OINTHV5.js +5703 -0
- package/dist/chunk-APNB5LUP.js +6024 -0
- package/dist/chunk-HP63Q326.js +1249 -0
- package/dist/chunk-ILFP55AY.js +1728 -0
- package/dist/chunk-LQ5OYZ7O.js +7908 -0
- package/dist/chunk-MKE6LND3.js +1687 -0
- package/dist/cli-agent-HTPQCEN4.js +2882 -0
- package/dist/cli-serve-R4K2E4ZR.js +322 -0
- package/dist/cli.js +3 -3
- package/dist/dashboard/pages/polymarket.js +66 -9
- package/dist/index.js +7 -7
- package/dist/polymarket-6VEZTYWD.js +17 -0
- package/dist/polymarket-S6BKUPNP.js +7 -0
- package/dist/polymarket-runtime-DLFKYZQ2.js +108 -0
- package/dist/polymarket-watcher-PM5ZIVBH.js +23 -0
- package/dist/runtime-ANL77CJQ.js +50 -0
- package/dist/server-QUMXSXKX.js +36 -0
- package/dist/setup-C66RQXDO.js +20 -0
- package/dist/system-prompts-S2MYX3MQ.js +69 -0
- package/logs/cloudflared-error.log +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import "./chunk-KFQGP6VL.js";
|
|
2
|
+
|
|
3
|
+
// src/cli-serve.ts
|
|
4
|
+
import { existsSync, readFileSync } from "fs";
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
import { homedir } from "os";
|
|
7
|
+
function loadEnvFile() {
|
|
8
|
+
const candidates = [
|
|
9
|
+
join(process.cwd(), ".env"),
|
|
10
|
+
join(homedir(), ".agenticmail", ".env")
|
|
11
|
+
];
|
|
12
|
+
for (const envPath of candidates) {
|
|
13
|
+
if (!existsSync(envPath)) continue;
|
|
14
|
+
try {
|
|
15
|
+
const content = readFileSync(envPath, "utf8");
|
|
16
|
+
for (const line of content.split("\n")) {
|
|
17
|
+
const trimmed = line.trim();
|
|
18
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
19
|
+
const eq = trimmed.indexOf("=");
|
|
20
|
+
if (eq < 0) continue;
|
|
21
|
+
const key = trimmed.slice(0, eq).trim();
|
|
22
|
+
let val = trimmed.slice(eq + 1).trim();
|
|
23
|
+
if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
|
|
24
|
+
val = val.slice(1, -1);
|
|
25
|
+
}
|
|
26
|
+
if (!process.env[key]) process.env[key] = val;
|
|
27
|
+
}
|
|
28
|
+
console.log(`Loaded config from ${envPath}`);
|
|
29
|
+
return;
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function ensureSecrets() {
|
|
35
|
+
const { randomUUID } = await import("crypto");
|
|
36
|
+
const envDir = join(homedir(), ".agenticmail");
|
|
37
|
+
const envPath = join(envDir, ".env");
|
|
38
|
+
let dirty = false;
|
|
39
|
+
if (!process.env.JWT_SECRET) {
|
|
40
|
+
process.env.JWT_SECRET = randomUUID() + randomUUID();
|
|
41
|
+
dirty = true;
|
|
42
|
+
console.log("[startup] Generated new JWT_SECRET (existing sessions will need to re-login)");
|
|
43
|
+
}
|
|
44
|
+
if (!process.env.AGENTICMAIL_VAULT_KEY) {
|
|
45
|
+
process.env.AGENTICMAIL_VAULT_KEY = randomUUID() + randomUUID();
|
|
46
|
+
dirty = true;
|
|
47
|
+
console.log("[startup] Generated new AGENTICMAIL_VAULT_KEY");
|
|
48
|
+
console.log("[startup] \u26A0\uFE0F Previously encrypted credentials will need to be re-entered in the dashboard");
|
|
49
|
+
}
|
|
50
|
+
if (dirty) {
|
|
51
|
+
try {
|
|
52
|
+
if (!existsSync(envDir)) {
|
|
53
|
+
const { mkdirSync } = await import("fs");
|
|
54
|
+
mkdirSync(envDir, { recursive: true });
|
|
55
|
+
}
|
|
56
|
+
const { appendFileSync } = await import("fs");
|
|
57
|
+
const lines = [];
|
|
58
|
+
let existing = "";
|
|
59
|
+
if (existsSync(envPath)) {
|
|
60
|
+
existing = readFileSync(envPath, "utf8");
|
|
61
|
+
}
|
|
62
|
+
if (!existing.includes("JWT_SECRET=")) {
|
|
63
|
+
lines.push(`JWT_SECRET=${process.env.JWT_SECRET}`);
|
|
64
|
+
}
|
|
65
|
+
if (!existing.includes("AGENTICMAIL_VAULT_KEY=")) {
|
|
66
|
+
lines.push(`AGENTICMAIL_VAULT_KEY=${process.env.AGENTICMAIL_VAULT_KEY}`);
|
|
67
|
+
}
|
|
68
|
+
if (lines.length) {
|
|
69
|
+
appendFileSync(envPath, "\n" + lines.join("\n") + "\n", { mode: 384 });
|
|
70
|
+
console.log(`[startup] Saved secrets to ${envPath}`);
|
|
71
|
+
}
|
|
72
|
+
} catch (e) {
|
|
73
|
+
console.warn(`[startup] Could not save secrets to ${envPath}: ${e.message}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function runServe(_args) {
|
|
78
|
+
loadEnvFile();
|
|
79
|
+
const DATABASE_URL = process.env.DATABASE_URL;
|
|
80
|
+
const PORT = parseInt(process.env.PORT || "8080", 10);
|
|
81
|
+
await ensureSecrets();
|
|
82
|
+
const JWT_SECRET = process.env.JWT_SECRET;
|
|
83
|
+
const _VAULT_KEY = process.env.AGENTICMAIL_VAULT_KEY;
|
|
84
|
+
if (!DATABASE_URL) {
|
|
85
|
+
console.error("ERROR: DATABASE_URL is required.");
|
|
86
|
+
console.error("");
|
|
87
|
+
console.error("Set it via environment variable or .env file:");
|
|
88
|
+
console.error(" DATABASE_URL=postgresql://user:pass@host:5432/db npx @agenticmail/enterprise start");
|
|
89
|
+
console.error("");
|
|
90
|
+
console.error("Or create a .env file (in cwd or ~/.agenticmail/.env):");
|
|
91
|
+
console.error(" DATABASE_URL=postgresql://user:pass@host:5432/db");
|
|
92
|
+
console.error(" JWT_SECRET=your-secret-here");
|
|
93
|
+
console.error(" PORT=3200");
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
const { createAdapter, smartDbConfig } = await import("./factory-6KTIEZYC.js");
|
|
97
|
+
const { createServer } = await import("./server-QUMXSXKX.js");
|
|
98
|
+
const db = await createAdapter(smartDbConfig(DATABASE_URL));
|
|
99
|
+
await db.migrate();
|
|
100
|
+
const server = createServer({
|
|
101
|
+
port: PORT,
|
|
102
|
+
db,
|
|
103
|
+
jwtSecret: JWT_SECRET,
|
|
104
|
+
corsOrigins: ["*"]
|
|
105
|
+
});
|
|
106
|
+
await server.start();
|
|
107
|
+
console.log(`AgenticMail Enterprise server running on :${PORT}`);
|
|
108
|
+
try {
|
|
109
|
+
const { startWatcherEngine, initWatcherTables, setWatcherRuntime } = await import("./polymarket-watcher-PM5ZIVBH.js");
|
|
110
|
+
const edb = db.getEngineDB?.();
|
|
111
|
+
if (edb) {
|
|
112
|
+
await initWatcherTables(edb);
|
|
113
|
+
startWatcherEngine(db, {
|
|
114
|
+
log: (...args) => console.log(...args),
|
|
115
|
+
onEvent: (agentId, event) => {
|
|
116
|
+
if (event.severity === "critical") {
|
|
117
|
+
console.log(`[poly-watcher] CRITICAL signal for agent ${agentId}: ${event.title}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
setTimeout(async () => {
|
|
122
|
+
try {
|
|
123
|
+
const routes = await import("./routes-JDDQBS4W.js");
|
|
124
|
+
setWatcherRuntime(
|
|
125
|
+
() => routes.getRuntime?.() || null
|
|
126
|
+
);
|
|
127
|
+
} catch (e) {
|
|
128
|
+
console.warn("[poly-watcher] Could not inject runtime:", e.message);
|
|
129
|
+
}
|
|
130
|
+
}, 5e3);
|
|
131
|
+
console.log("[startup] Polymarket watcher engine started");
|
|
132
|
+
}
|
|
133
|
+
setTimeout(async () => {
|
|
134
|
+
try {
|
|
135
|
+
const { autoConnectProxy } = await import("./polymarket-runtime-DLFKYZQ2.js");
|
|
136
|
+
const pdb = db.getEngineDB?.();
|
|
137
|
+
if (pdb) await autoConnectProxy(pdb);
|
|
138
|
+
} catch {
|
|
139
|
+
}
|
|
140
|
+
}, 8e3);
|
|
141
|
+
} catch (e) {
|
|
142
|
+
console.warn("[startup] Polymarket watcher engine skipped:", e.message);
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const { startBackgroundUpdateCheck } = await import("./cli-update-SX7GACL3.js");
|
|
146
|
+
startBackgroundUpdateCheck();
|
|
147
|
+
} catch {
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const { startPreventSleep } = await import("./screen-unlock-4RPZBHOI.js");
|
|
151
|
+
const adminDb = server.getAdminDb?.() || server.adminDb;
|
|
152
|
+
if (adminDb) {
|
|
153
|
+
const settings = await adminDb.getSettings?.().catch(() => null);
|
|
154
|
+
const screenAccess = settings?.securityConfig?.screenAccess;
|
|
155
|
+
if (screenAccess?.enabled && screenAccess?.preventSleep) {
|
|
156
|
+
startPreventSleep();
|
|
157
|
+
console.log("[startup] Prevent-sleep enabled \u2014 system will stay awake while agents are active");
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} catch {
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
await setupSystemPersistence();
|
|
164
|
+
} catch (e) {
|
|
165
|
+
console.warn("[startup] System persistence setup skipped: " + e.message);
|
|
166
|
+
}
|
|
167
|
+
const tunnelToken = process.env.CLOUDFLARED_TOKEN;
|
|
168
|
+
if (tunnelToken) {
|
|
169
|
+
try {
|
|
170
|
+
const { execSync, spawn } = await import("child_process");
|
|
171
|
+
try {
|
|
172
|
+
execSync(process.platform === "win32" ? "where cloudflared" : "which cloudflared", { timeout: 3e3 });
|
|
173
|
+
} catch {
|
|
174
|
+
console.log("[startup] cloudflared not found \u2014 skipping tunnel auto-start");
|
|
175
|
+
console.log("[startup] Install cloudflared to enable tunnel: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/");
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
if (process.platform === "win32") {
|
|
180
|
+
const tasklist = execSync('tasklist /FI "IMAGENAME eq cloudflared.exe" /NH', { encoding: "utf8", timeout: 5e3 });
|
|
181
|
+
if (tasklist.includes("cloudflared.exe")) {
|
|
182
|
+
console.log("[startup] cloudflared tunnel already running");
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
execSync('pgrep -f "cloudflared.*tunnel.*run"', { timeout: 3e3 });
|
|
187
|
+
console.log("[startup] cloudflared tunnel already running");
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
} catch {
|
|
191
|
+
}
|
|
192
|
+
const subdomain = process.env.AGENTICMAIL_SUBDOMAIN || process.env.AGENTICMAIL_DOMAIN || "";
|
|
193
|
+
console.log(`[startup] Starting cloudflared tunnel${subdomain ? ` for ${subdomain}.agenticmail.io` : ""}...`);
|
|
194
|
+
let cfBin = "cloudflared";
|
|
195
|
+
if (process.platform === "win32") {
|
|
196
|
+
try {
|
|
197
|
+
cfBin = execSync("where cloudflared", { encoding: "utf8", timeout: 3e3 }).trim().split("\n")[0].trim();
|
|
198
|
+
} catch {
|
|
199
|
+
const candidate = `${process.env.LOCALAPPDATA || ""}\\cloudflared\\cloudflared.exe`;
|
|
200
|
+
try {
|
|
201
|
+
(await import("fs")).statSync(candidate);
|
|
202
|
+
cfBin = candidate;
|
|
203
|
+
} catch {
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const child = spawn(cfBin, ["tunnel", "--no-autoupdate", "run", "--token", tunnelToken], {
|
|
208
|
+
detached: true,
|
|
209
|
+
stdio: "ignore"
|
|
210
|
+
});
|
|
211
|
+
child.unref();
|
|
212
|
+
console.log("[startup] cloudflared tunnel started (pid " + child.pid + ")");
|
|
213
|
+
} catch (e) {
|
|
214
|
+
console.warn("[startup] Could not auto-start cloudflared: " + e.message);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
async function setupSystemPersistence() {
|
|
219
|
+
const { execSync, spawnSync } = await import("child_process");
|
|
220
|
+
const { existsSync: exists, writeFileSync, mkdirSync } = await import("fs");
|
|
221
|
+
const { join: pathJoin } = await import("path");
|
|
222
|
+
const platform = process.platform;
|
|
223
|
+
if (!process.env.PM2_HOME && !process.env.pm_id) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const markerDir = pathJoin(homedir(), ".agenticmail");
|
|
227
|
+
const markerFile = pathJoin(markerDir, ".persistence-configured");
|
|
228
|
+
if (exists(markerFile)) {
|
|
229
|
+
try {
|
|
230
|
+
execSync("pm2 save --silent", { timeout: 1e4, stdio: "ignore" });
|
|
231
|
+
} catch {
|
|
232
|
+
}
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
console.log("[startup] Configuring system persistence (one-time setup)...");
|
|
236
|
+
try {
|
|
237
|
+
if (platform === "darwin") {
|
|
238
|
+
const result = spawnSync("pm2", ["startup", "launchd", "--silent"], {
|
|
239
|
+
timeout: 15e3,
|
|
240
|
+
stdio: "pipe",
|
|
241
|
+
encoding: "utf-8"
|
|
242
|
+
});
|
|
243
|
+
const output = (result.stdout || "") + (result.stderr || "");
|
|
244
|
+
const sudoMatch = output.match(/sudo\s+env\s+.*pm2\s+startup.*/);
|
|
245
|
+
if (sudoMatch) {
|
|
246
|
+
console.log("[startup] PM2 startup requires sudo. Run this once:");
|
|
247
|
+
console.log(" " + sudoMatch[0]);
|
|
248
|
+
} else {
|
|
249
|
+
console.log("[startup] PM2 startup configured (launchd)");
|
|
250
|
+
}
|
|
251
|
+
const plistPath = pathJoin(homedir(), "Library", "LaunchAgents", `pm2.${process.env.USER || "user"}.plist`);
|
|
252
|
+
if (exists(plistPath)) {
|
|
253
|
+
try {
|
|
254
|
+
execSync(`launchctl load -w "${plistPath}"`, { timeout: 5e3, stdio: "ignore" });
|
|
255
|
+
} catch {
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
} else if (platform === "linux") {
|
|
259
|
+
const result = spawnSync("pm2", ["startup", "systemd", "--silent"], {
|
|
260
|
+
timeout: 15e3,
|
|
261
|
+
stdio: "pipe",
|
|
262
|
+
encoding: "utf-8"
|
|
263
|
+
});
|
|
264
|
+
const output = (result.stdout || "") + (result.stderr || "");
|
|
265
|
+
const sudoMatch = output.match(/sudo\s+env\s+.*pm2\s+startup.*/);
|
|
266
|
+
if (sudoMatch) {
|
|
267
|
+
try {
|
|
268
|
+
execSync(sudoMatch[0], { timeout: 15e3, stdio: "ignore" });
|
|
269
|
+
console.log("[startup] PM2 startup configured (systemd)");
|
|
270
|
+
} catch {
|
|
271
|
+
console.log("[startup] PM2 startup requires root. Run this once:");
|
|
272
|
+
console.log(" " + sudoMatch[0]);
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
console.log("[startup] PM2 startup configured (systemd)");
|
|
276
|
+
}
|
|
277
|
+
} else if (platform === "win32") {
|
|
278
|
+
try {
|
|
279
|
+
execSync("npm list -g pm2-windows-startup", { timeout: 1e4, stdio: "ignore" });
|
|
280
|
+
} catch {
|
|
281
|
+
console.log("[startup] Installing pm2-windows-startup...");
|
|
282
|
+
try {
|
|
283
|
+
execSync("npm install -g pm2-windows-startup", { timeout: 6e4, stdio: "ignore" });
|
|
284
|
+
execSync("pm2-startup install", { timeout: 15e3, stdio: "ignore" });
|
|
285
|
+
console.log("[startup] PM2 startup configured (Windows Service)");
|
|
286
|
+
} catch (e) {
|
|
287
|
+
console.warn("[startup] Could not install pm2-windows-startup: " + e.message);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
} catch (e) {
|
|
292
|
+
console.warn("[startup] PM2 startup setup: " + e.message);
|
|
293
|
+
}
|
|
294
|
+
try {
|
|
295
|
+
const moduleList = execSync("pm2 ls --silent 2>/dev/null || true", { timeout: 1e4, encoding: "utf-8" });
|
|
296
|
+
if (!moduleList.includes("pm2-logrotate")) {
|
|
297
|
+
console.log("[startup] Installing pm2-logrotate...");
|
|
298
|
+
execSync("pm2 install pm2-logrotate --silent", { timeout: 6e4, stdio: "ignore" });
|
|
299
|
+
execSync("pm2 set pm2-logrotate:max_size 10M --silent", { timeout: 5e3, stdio: "ignore" });
|
|
300
|
+
execSync("pm2 set pm2-logrotate:retain 5 --silent", { timeout: 5e3, stdio: "ignore" });
|
|
301
|
+
execSync("pm2 set pm2-logrotate:compress true --silent", { timeout: 5e3, stdio: "ignore" });
|
|
302
|
+
console.log("[startup] Log rotation configured (10MB, 5 files)");
|
|
303
|
+
}
|
|
304
|
+
} catch {
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
execSync("pm2 save --silent", { timeout: 1e4, stdio: "ignore" });
|
|
308
|
+
console.log("[startup] Process list saved");
|
|
309
|
+
} catch {
|
|
310
|
+
}
|
|
311
|
+
try {
|
|
312
|
+
if (!exists(markerDir)) mkdirSync(markerDir, { recursive: true });
|
|
313
|
+
writeFileSync(markerFile, (/* @__PURE__ */ new Date()).toISOString() + `
|
|
314
|
+
platform=${platform}
|
|
315
|
+
`, { mode: 384 });
|
|
316
|
+
console.log("[startup] System persistence configured successfully");
|
|
317
|
+
} catch {
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
export {
|
|
321
|
+
runServe
|
|
322
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -65,14 +65,14 @@ Skill Development:
|
|
|
65
65
|
break;
|
|
66
66
|
case "serve":
|
|
67
67
|
case "start":
|
|
68
|
-
import("./cli-serve-
|
|
68
|
+
import("./cli-serve-R4K2E4ZR.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
|
|
69
69
|
break;
|
|
70
70
|
case "agent":
|
|
71
|
-
import("./cli-agent-
|
|
71
|
+
import("./cli-agent-HTPQCEN4.js").then((m) => m.runAgent(args.slice(1))).catch(fatal);
|
|
72
72
|
break;
|
|
73
73
|
case "setup":
|
|
74
74
|
default:
|
|
75
|
-
import("./setup-
|
|
75
|
+
import("./setup-C66RQXDO.js").then((m) => m.runSetupWizard()).catch(fatal);
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
function fatal(err) {
|
|
@@ -131,6 +131,7 @@ export function PolymarketPage() {
|
|
|
131
131
|
const [swapAmount, setSwapAmount] = useState('');
|
|
132
132
|
const [swapLoading, setSwapLoading] = useState(false);
|
|
133
133
|
const [swapCountdown, setSwapCountdown] = useState(0);
|
|
134
|
+
const [chartVisible, setChartVisible] = useState(function() { try { return localStorage.getItem('pm_chart_visible') !== 'false'; } catch { return true; } });
|
|
134
135
|
|
|
135
136
|
// Countdown timer during swap
|
|
136
137
|
useEffect(function() {
|
|
@@ -1067,6 +1068,43 @@ export function PolymarketPage() {
|
|
|
1067
1068
|
function renderDetailModal() {
|
|
1068
1069
|
if (!selectedRow) return null;
|
|
1069
1070
|
var d = selectedRow.data;
|
|
1071
|
+
|
|
1072
|
+
// Custom modal for pending orders on a position
|
|
1073
|
+
if (selectedRow.tab === 'pendingForPosition' && d.orders) {
|
|
1074
|
+
return h('div', { className: 'modal-overlay', onClick: function() { setSelectedRow(null); } },
|
|
1075
|
+
h('div', { className: 'modal-content', style: { maxWidth: 560, maxHeight: '80vh', overflow: 'auto' }, onClick: function(e) { e.stopPropagation(); } },
|
|
1076
|
+
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 } },
|
|
1077
|
+
h('h3', { style: { margin: 0 } }, 'Pending Orders'),
|
|
1078
|
+
h('button', { className: 'btn btn-sm btn-secondary', onClick: function() { setSelectedRow(null); } }, '\u2715')
|
|
1079
|
+
),
|
|
1080
|
+
h('div', { style: { marginBottom: 16, padding: '10px 14px', background: 'var(--bg-secondary)', borderRadius: 8, fontSize: 13 } },
|
|
1081
|
+
h('div', { style: { fontWeight: 600, marginBottom: 4 } }, d.market || 'Position'),
|
|
1082
|
+
h('div', { style: { color: 'var(--text-muted)' } }, 'Filled shares: ', h('strong', null, (d.filled_shares || 0).toFixed(1)),
|
|
1083
|
+
' \u00b7 Pending orders: ', h('strong', null, d.orders.length))
|
|
1084
|
+
),
|
|
1085
|
+
h('table', { className: 'data-table', style: { width: '100%' } },
|
|
1086
|
+
h('thead', null, h('tr', null,
|
|
1087
|
+
h('th', null, 'Side'), h('th', null, 'Outcome'), h('th', null, 'Shares'), h('th', null, 'Price'), h('th', null, 'Cost'), h('th', null, 'Placed')
|
|
1088
|
+
)),
|
|
1089
|
+
h('tbody', null, d.orders.map(function(o, i) {
|
|
1090
|
+
return h('tr', { key: i },
|
|
1091
|
+
h('td', null, sideBadge(o.side)),
|
|
1092
|
+
h('td', null, o.outcome
|
|
1093
|
+
? h('span', { className: 'badge ' + (o.outcome.toLowerCase() === 'yes' ? 'badge-success' : 'badge-danger') }, o.outcome)
|
|
1094
|
+
: '--'),
|
|
1095
|
+
h('td', null, (o.size || 0).toFixed(1)),
|
|
1096
|
+
h('td', null, ((o.price || 0) * 100).toFixed(1) + '\u00a2'),
|
|
1097
|
+
h('td', null, '$' + ((o.price || 0) * (o.size || 0)).toFixed(2)),
|
|
1098
|
+
h('td', { style: { fontSize: 11, color: 'var(--text-muted)' } }, fmtDate(o.created_at))
|
|
1099
|
+
);
|
|
1100
|
+
}))
|
|
1101
|
+
),
|
|
1102
|
+
h('div', { style: { marginTop: 12, fontSize: 12, color: 'var(--text-muted)', fontStyle: 'italic' } },
|
|
1103
|
+
'Total pending capital: $' + d.orders.reduce(function(s, o) { return s + (o.price || 0) * (o.size || 0); }, 0).toFixed(2))
|
|
1104
|
+
)
|
|
1105
|
+
);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1070
1108
|
var title = d.market_question || d.title || d.headline || d.strategy_name || d.strategy ||
|
|
1071
1109
|
d.topic || d.label || d.signal_source || d.category || d.name ||
|
|
1072
1110
|
(d.lesson ? (d.lesson.length > 60 ? d.lesson.slice(0, 60) + '\u2026' : d.lesson) : null) ||
|
|
@@ -1679,9 +1717,20 @@ export function PolymarketPage() {
|
|
|
1679
1717
|
);
|
|
1680
1718
|
})(),
|
|
1681
1719
|
|
|
1682
|
-
// ═══ HEADER P&L CHART (sticky —
|
|
1720
|
+
// ═══ HEADER P&L CHART (sticky — toggle visibility, persisted to localStorage) ═══
|
|
1683
1721
|
h('div', { style: { position: 'sticky', top: 0, zIndex: 20, background: 'var(--bg)', borderBottom: '1px solid var(--border)', padding: 0, marginTop: '-16px' } },
|
|
1684
|
-
|
|
1722
|
+
h('div', { style: { display: 'flex', justifyContent: 'flex-end', padding: '4px 8px 0' } },
|
|
1723
|
+
h('button', {
|
|
1724
|
+
className: 'btn btn-sm',
|
|
1725
|
+
style: { fontSize: 11, padding: '2px 8px', opacity: 0.7 },
|
|
1726
|
+
onClick: function() {
|
|
1727
|
+
var next = !chartVisible;
|
|
1728
|
+
setChartVisible(next);
|
|
1729
|
+
try { localStorage.setItem('pm_chart_visible', String(next)); } catch {}
|
|
1730
|
+
}
|
|
1731
|
+
}, chartVisible ? 'Hide Chart' : 'Show Chart')
|
|
1732
|
+
),
|
|
1733
|
+
chartVisible ? renderLiveChart() : null
|
|
1685
1734
|
),
|
|
1686
1735
|
|
|
1687
1736
|
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16, flexWrap: 'wrap', gap: 12 } },
|
|
@@ -2079,16 +2128,24 @@ export function PolymarketPage() {
|
|
|
2079
2128
|
? h('span', { className: 'badge ' + (oc.toLowerCase() === 'yes' ? 'badge-success' : oc.toLowerCase() === 'no' ? 'badge-danger' : 'badge-secondary') }, oc)
|
|
2080
2129
|
: h('span', { className: 'text-muted' }, '--')
|
|
2081
2130
|
),
|
|
2082
|
-
h('td', { key: 'sh' }, h('div',
|
|
2131
|
+
h('td', { key: 'sh' }, h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
|
|
2083
2132
|
(p.size || 0).toFixed(1),
|
|
2084
2133
|
(function() {
|
|
2085
2134
|
var pendingForToken = pendingTrades.filter(function(pt) { return pt.token_id === p.token_id && (pt.status === 'placed' || pt.source === 'placed'); });
|
|
2086
2135
|
if (!pendingForToken.length) return null;
|
|
2087
|
-
return
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
)
|
|
2091
|
-
|
|
2136
|
+
return h('button', {
|
|
2137
|
+
title: pendingForToken.length + ' pending order(s)',
|
|
2138
|
+
style: { background: 'rgba(180,83,9,0.15)', border: '1px solid rgba(180,83,9,0.3)', borderRadius: 4, padding: '1px 5px', cursor: 'pointer', fontSize: 10, color: '#b45309', fontWeight: 600, display: 'inline-flex', alignItems: 'center', gap: 3 },
|
|
2139
|
+
onClick: function(e) {
|
|
2140
|
+
e.stopPropagation();
|
|
2141
|
+
setSelectedRow({ tab: 'pendingForPosition', data: {
|
|
2142
|
+
market: p.market || shortId(p.token_id),
|
|
2143
|
+
token_id: p.token_id,
|
|
2144
|
+
filled_shares: p.size || 0,
|
|
2145
|
+
orders: pendingForToken,
|
|
2146
|
+
}});
|
|
2147
|
+
}
|
|
2148
|
+
}, I('clock'), ' ' + pendingForToken.length);
|
|
2092
2149
|
})()
|
|
2093
2150
|
)),
|
|
2094
2151
|
h('td', { key: 'e' }, (p.entry * 100).toFixed(1) + '\u00a2'),
|
|
@@ -2149,7 +2206,7 @@ export function PolymarketPage() {
|
|
|
2149
2206
|
if (isNaN(aEnd)) aEnd = Infinity;
|
|
2150
2207
|
if (isNaN(bEnd)) bEnd = Infinity;
|
|
2151
2208
|
return aEnd - bEnd;
|
|
2152
|
-
}, pageSize:
|
|
2209
|
+
}, pageSize: 10 }
|
|
2153
2210
|
)
|
|
2154
2211
|
),
|
|
2155
2212
|
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
provision,
|
|
9
9
|
runSetupWizard
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ILFP55AY.js";
|
|
11
11
|
import {
|
|
12
12
|
AgenticMailManager,
|
|
13
13
|
GoogleEmailProvider,
|
|
@@ -28,8 +28,8 @@ import {
|
|
|
28
28
|
executeTool,
|
|
29
29
|
runAgentLoop,
|
|
30
30
|
toolsToDefinitions
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-7OINTHV5.js";
|
|
32
|
+
import "./chunk-HP63Q326.js";
|
|
33
33
|
import {
|
|
34
34
|
ValidationError,
|
|
35
35
|
auditLogger,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
requireRole,
|
|
44
44
|
securityHeaders,
|
|
45
45
|
validate
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-LQ5OYZ7O.js";
|
|
47
47
|
import "./chunk-DJBCRQTD.js";
|
|
48
48
|
import {
|
|
49
49
|
PROVIDER_REGISTRY,
|
|
@@ -117,10 +117,10 @@ import {
|
|
|
117
117
|
init_agent_config,
|
|
118
118
|
init_deployer
|
|
119
119
|
} from "./chunk-PSZU6FMQ.js";
|
|
120
|
-
import "./chunk-
|
|
120
|
+
import "./chunk-APNB5LUP.js";
|
|
121
121
|
import "./chunk-X5IZUXDC.js";
|
|
122
122
|
import "./chunk-I5IGHBXW.js";
|
|
123
|
-
import "./chunk-
|
|
123
|
+
import "./chunk-MKE6LND3.js";
|
|
124
124
|
import {
|
|
125
125
|
SecureVault,
|
|
126
126
|
init_vault
|
|
@@ -128,7 +128,7 @@ import {
|
|
|
128
128
|
import "./chunk-2CDGYMJK.js";
|
|
129
129
|
import "./chunk-V3LPIDTL.js";
|
|
130
130
|
import "./chunk-A4CX3XQS.js";
|
|
131
|
-
import "./chunk-
|
|
131
|
+
import "./chunk-5CENM5VB.js";
|
|
132
132
|
import {
|
|
133
133
|
CircuitBreaker,
|
|
134
134
|
CircuitOpenError,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createPolymarketTools,
|
|
3
|
+
executeOrder
|
|
4
|
+
} from "./chunk-APNB5LUP.js";
|
|
5
|
+
import "./chunk-X5IZUXDC.js";
|
|
6
|
+
import "./chunk-I5IGHBXW.js";
|
|
7
|
+
import "./chunk-MKE6LND3.js";
|
|
8
|
+
import "./chunk-WUAWWKTN.js";
|
|
9
|
+
import "./chunk-2CDGYMJK.js";
|
|
10
|
+
import "./chunk-V3LPIDTL.js";
|
|
11
|
+
import "./chunk-A4CX3XQS.js";
|
|
12
|
+
import "./chunk-5CENM5VB.js";
|
|
13
|
+
import "./chunk-KFQGP6VL.js";
|
|
14
|
+
export {
|
|
15
|
+
createPolymarketTools,
|
|
16
|
+
executeOrder
|
|
17
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
autoConnectProxy,
|
|
3
|
+
cancelBracketSibling,
|
|
4
|
+
checkAlerts,
|
|
5
|
+
createBracketAlerts,
|
|
6
|
+
deleteAlert,
|
|
7
|
+
deleteAllAlerts,
|
|
8
|
+
deleteAutoApproveRule,
|
|
9
|
+
deployProxyToVPS,
|
|
10
|
+
ensureSDK,
|
|
11
|
+
flushClobClient,
|
|
12
|
+
getAlerts,
|
|
13
|
+
getAutoApproveRules,
|
|
14
|
+
getBracketConfig,
|
|
15
|
+
getCalibration,
|
|
16
|
+
getClobClient,
|
|
17
|
+
getClobUrl,
|
|
18
|
+
getDailyCounter,
|
|
19
|
+
getPaperPositions,
|
|
20
|
+
getPendingTrades,
|
|
21
|
+
getProxyState,
|
|
22
|
+
getResolvedPredictions,
|
|
23
|
+
getSocksAgent,
|
|
24
|
+
getStrategyPerformance,
|
|
25
|
+
getUnresolvedPredictions,
|
|
26
|
+
importSDK,
|
|
27
|
+
incrementDailyCounter,
|
|
28
|
+
initLearningDB,
|
|
29
|
+
initPolymarketDB,
|
|
30
|
+
isPostgresDB,
|
|
31
|
+
isProxyEnabled,
|
|
32
|
+
loadConfig,
|
|
33
|
+
loadProxyConfig,
|
|
34
|
+
loadWalletCredentials,
|
|
35
|
+
logTrade,
|
|
36
|
+
markLessonsExtracted,
|
|
37
|
+
pauseTrading,
|
|
38
|
+
recallLessons,
|
|
39
|
+
recordPrediction,
|
|
40
|
+
resolvePendingTrade,
|
|
41
|
+
resolvePrediction,
|
|
42
|
+
resumeTrading,
|
|
43
|
+
saveAlert,
|
|
44
|
+
saveAutoApproveRule,
|
|
45
|
+
saveConfig,
|
|
46
|
+
savePaperPosition,
|
|
47
|
+
savePendingTrade,
|
|
48
|
+
saveProxyConfig,
|
|
49
|
+
saveWalletCredentials,
|
|
50
|
+
startProxy,
|
|
51
|
+
stopProxy,
|
|
52
|
+
storeLesson
|
|
53
|
+
} from "./chunk-MKE6LND3.js";
|
|
54
|
+
import "./chunk-WUAWWKTN.js";
|
|
55
|
+
import "./chunk-KFQGP6VL.js";
|
|
56
|
+
export {
|
|
57
|
+
autoConnectProxy,
|
|
58
|
+
cancelBracketSibling,
|
|
59
|
+
checkAlerts,
|
|
60
|
+
createBracketAlerts,
|
|
61
|
+
deleteAlert,
|
|
62
|
+
deleteAllAlerts,
|
|
63
|
+
deleteAutoApproveRule,
|
|
64
|
+
deployProxyToVPS,
|
|
65
|
+
ensureSDK,
|
|
66
|
+
flushClobClient,
|
|
67
|
+
getAlerts,
|
|
68
|
+
getAutoApproveRules,
|
|
69
|
+
getBracketConfig,
|
|
70
|
+
getCalibration,
|
|
71
|
+
getClobClient,
|
|
72
|
+
getClobUrl,
|
|
73
|
+
getDailyCounter,
|
|
74
|
+
getPaperPositions,
|
|
75
|
+
getPendingTrades,
|
|
76
|
+
getProxyState,
|
|
77
|
+
getResolvedPredictions,
|
|
78
|
+
getSocksAgent,
|
|
79
|
+
getStrategyPerformance,
|
|
80
|
+
getUnresolvedPredictions,
|
|
81
|
+
importSDK,
|
|
82
|
+
incrementDailyCounter,
|
|
83
|
+
initLearningDB,
|
|
84
|
+
initPolymarketDB,
|
|
85
|
+
isPostgresDB,
|
|
86
|
+
isProxyEnabled,
|
|
87
|
+
loadConfig,
|
|
88
|
+
loadProxyConfig,
|
|
89
|
+
loadWalletCredentials,
|
|
90
|
+
logTrade,
|
|
91
|
+
markLessonsExtracted,
|
|
92
|
+
pauseTrading,
|
|
93
|
+
recallLessons,
|
|
94
|
+
recordPrediction,
|
|
95
|
+
resolvePendingTrade,
|
|
96
|
+
resolvePrediction,
|
|
97
|
+
resumeTrading,
|
|
98
|
+
saveAlert,
|
|
99
|
+
saveAutoApproveRule,
|
|
100
|
+
saveConfig,
|
|
101
|
+
savePaperPosition,
|
|
102
|
+
savePendingTrade,
|
|
103
|
+
saveProxyConfig,
|
|
104
|
+
saveWalletCredentials,
|
|
105
|
+
startProxy,
|
|
106
|
+
stopProxy,
|
|
107
|
+
storeLesson
|
|
108
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeWithAI,
|
|
3
|
+
controlWatcherEngine,
|
|
4
|
+
createWatcherTools,
|
|
5
|
+
getAIConfig,
|
|
6
|
+
getWatcherEngineStatus,
|
|
7
|
+
initWatcherTables,
|
|
8
|
+
setWatcherRuntime,
|
|
9
|
+
startWatcherEngine,
|
|
10
|
+
stopWatcherEngine
|
|
11
|
+
} from "./chunk-5CENM5VB.js";
|
|
12
|
+
import "./chunk-KFQGP6VL.js";
|
|
13
|
+
export {
|
|
14
|
+
analyzeWithAI,
|
|
15
|
+
controlWatcherEngine,
|
|
16
|
+
createWatcherTools,
|
|
17
|
+
getAIConfig,
|
|
18
|
+
getWatcherEngineStatus,
|
|
19
|
+
initWatcherTables,
|
|
20
|
+
setWatcherRuntime,
|
|
21
|
+
startWatcherEngine,
|
|
22
|
+
stopWatcherEngine
|
|
23
|
+
};
|