@agenticmail/enterprise 0.5.445 → 0.5.447
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/chunk-47EWPF3R.js +7689 -0
- package/dist/chunk-GON6OGXB.js +1728 -0
- package/dist/cli-serve-H3OEAR5D.js +322 -0
- package/dist/cli.js +2 -2
- package/dist/dashboard/pages/polymarket.js +40 -4
- package/dist/index.js +2 -2
- package/dist/server-4HMEQGVZ.js +36 -0
- package/dist/setup-RLIJVRPO.js +20 -0
- package/logs/cloudflared-error.log +36 -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-R6MMSC2X.js");
|
|
97
|
+
const { createServer } = await import("./server-4HMEQGVZ.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-2JCPZUKA.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-PRBWZ4MQ.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-6LTI2BL7.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-H3OEAR5D.js").then((m) => m.runServe(args.slice(1))).catch(fatal);
|
|
69
69
|
break;
|
|
70
70
|
case "agent":
|
|
71
71
|
import("./cli-agent-7TB4WA57.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-RLIJVRPO.js").then((m) => m.runSetupWizard()).catch(fatal);
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
function fatal(err) {
|
|
@@ -1694,18 +1694,54 @@ export function PolymarketPage() {
|
|
|
1694
1694
|
dailyScorecard && h('div', { className: 'card', style: { padding: 16, marginBottom: 20 } },
|
|
1695
1695
|
h('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 12 } },
|
|
1696
1696
|
h('h3', { style: { margin: 0, fontSize: 15, fontWeight: 600 } }, 'Daily Scorecard'),
|
|
1697
|
-
h('
|
|
1697
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8 } },
|
|
1698
|
+
h('button', { className: 'btn btn-sm btn-secondary', style: { fontSize: 11, padding: '2px 8px' }, onClick: function() {
|
|
1699
|
+
var currentTarget = dailyScorecard.daily_target || 10;
|
|
1700
|
+
var newTarget = prompt('Set daily P&L target ($):', currentTarget);
|
|
1701
|
+
if (newTarget === null) return;
|
|
1702
|
+
var val = parseFloat(newTarget);
|
|
1703
|
+
if (isNaN(val) || val <= 0) { toast('Invalid target value', 'error'); return; }
|
|
1704
|
+
// Find existing daily_pnl_usd goal or create one
|
|
1705
|
+
var existingGoal = goals.find(function(g) { return g.type === 'daily_pnl_usd' && g.enabled; });
|
|
1706
|
+
if (existingGoal) {
|
|
1707
|
+
apiCall('/polymarket/' + selectedAgent + '/goals/' + existingGoal.id, { method: 'PUT', body: JSON.stringify(Object.assign({}, existingGoal, { target_value: val })) })
|
|
1708
|
+
.then(function() { toast('Daily target updated to $' + val, 'success'); loadAgentData(selectedAgent); })
|
|
1709
|
+
.catch(function(e) { toast(e.message, 'error'); });
|
|
1710
|
+
} else {
|
|
1711
|
+
apiCall('/polymarket/' + selectedAgent + '/goals', { method: 'POST', body: JSON.stringify({ name: 'Daily P&L Target', type: 'daily_pnl_usd', target_value: val, notify_on_met: true }) })
|
|
1712
|
+
.then(function() { toast('Daily target set to $' + val, 'success'); loadAgentData(selectedAgent); })
|
|
1713
|
+
.catch(function(e) { toast(e.message, 'error'); });
|
|
1714
|
+
}
|
|
1715
|
+
} }, I('journal'), ' Set Target'),
|
|
1716
|
+
h('span', { className: 'badge ' + (dailyScorecard.status === 'TARGET_HIT' ? 'badge-success' : dailyScorecard.status === 'AHEAD' ? 'badge-success' : dailyScorecard.status === 'ON_TRACK' ? 'badge-secondary' : dailyScorecard.status === 'STOP_TRADING' ? 'badge-danger' : 'badge-warning') }, dailyScorecard.status?.replace(/_/g, ' '))
|
|
1717
|
+
)
|
|
1698
1718
|
),
|
|
1699
1719
|
// Progress bar
|
|
1700
1720
|
h('div', { style: { marginBottom: 12 } },
|
|
1701
1721
|
h('div', { style: { display: 'flex', justifyContent: 'space-between', fontSize: 12, marginBottom: 4, color: 'var(--text-muted)' } },
|
|
1702
1722
|
h('span', null, 'P&L: $' + (dailyScorecard.total_pnl || 0).toFixed(2)),
|
|
1703
|
-
h('span',
|
|
1723
|
+
h('span', { style: { cursor: 'pointer', textDecoration: 'underline dotted' }, title: 'Click to change daily target', onClick: function() {
|
|
1724
|
+
var currentTarget = dailyScorecard.daily_target || 10;
|
|
1725
|
+
var newTarget = prompt('Set daily P&L target ($):', currentTarget);
|
|
1726
|
+
if (newTarget === null) return;
|
|
1727
|
+
var val = parseFloat(newTarget);
|
|
1728
|
+
if (isNaN(val) || val <= 0) { toast('Invalid target value', 'error'); return; }
|
|
1729
|
+
var existingGoal = goals.find(function(g) { return g.type === 'daily_pnl_usd' && g.enabled; });
|
|
1730
|
+
if (existingGoal) {
|
|
1731
|
+
apiCall('/polymarket/' + selectedAgent + '/goals/' + existingGoal.id, { method: 'PUT', body: JSON.stringify(Object.assign({}, existingGoal, { target_value: val })) })
|
|
1732
|
+
.then(function() { toast('Daily target updated to $' + val, 'success'); loadAgentData(selectedAgent); })
|
|
1733
|
+
.catch(function(e) { toast(e.message, 'error'); });
|
|
1734
|
+
} else {
|
|
1735
|
+
apiCall('/polymarket/' + selectedAgent + '/goals', { method: 'POST', body: JSON.stringify({ name: 'Daily P&L Target', type: 'daily_pnl_usd', target_value: val, notify_on_met: true }) })
|
|
1736
|
+
.then(function() { toast('Daily target set to $' + val, 'success'); loadAgentData(selectedAgent); })
|
|
1737
|
+
.catch(function(e) { toast(e.message, 'error'); });
|
|
1738
|
+
}
|
|
1739
|
+
} }, 'Target: $' + (dailyScorecard.daily_target || 0))
|
|
1704
1740
|
),
|
|
1705
1741
|
h('div', { style: { height: 8, background: 'var(--bg-secondary)', borderRadius: 4, overflow: 'hidden' } },
|
|
1706
1742
|
h('div', { style: { height: '100%', width: Math.min(100, Math.max(0, dailyScorecard.target_progress_pct || 0)) + '%', background: (dailyScorecard.total_pnl || 0) >= 0 ? '#22c55e' : '#ef4444', borderRadius: 4, transition: 'width 0.3s' } })
|
|
1707
1743
|
),
|
|
1708
|
-
h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginTop: 2 } }, (dailyScorecard.target_progress_pct || 0).toFixed(0) + '% of daily target')
|
|
1744
|
+
h('div', { style: { fontSize: 11, color: 'var(--text-muted)', marginTop: 2 } }, dailyScorecard.daily_target > 0 ? (dailyScorecard.target_progress_pct || 0).toFixed(0) + '% of daily target' : 'No daily target set \u2014 click "Set Target" above')
|
|
1709
1745
|
),
|
|
1710
1746
|
// Score metrics row
|
|
1711
1747
|
h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(100px, 1fr))', gap: 8 } },
|
|
@@ -2716,7 +2752,7 @@ export function PolymarketPage() {
|
|
|
2716
2752
|
|
|
2717
2753
|
// Transaction detail modal
|
|
2718
2754
|
selectedTx && h('div', { className: 'modal-overlay', onMouseMove: hideTip, onClick: function() { setSelectedTx(null); }, style: { zIndex: 1100 } },
|
|
2719
|
-
h('div', { className: 'modal
|
|
2755
|
+
h('div', { className: 'modal', onClick: function(e) { e.stopPropagation(); }, style: { maxWidth: 520, padding: 24 } },
|
|
2720
2756
|
h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 20 } },
|
|
2721
2757
|
h('h3', { style: { margin: 0, fontSize: 16, fontWeight: 600 } }, 'Transaction Details'),
|
|
2722
2758
|
h('button', { className: 'btn btn-sm', onClick: function() { setSelectedTx(null); } }, '\u2715')
|
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-GON6OGXB.js";
|
|
11
11
|
import {
|
|
12
12
|
AgenticMailManager,
|
|
13
13
|
GoogleEmailProvider,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
requireRole,
|
|
44
44
|
securityHeaders,
|
|
45
45
|
validate
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-47EWPF3R.js";
|
|
47
47
|
import "./chunk-DJBCRQTD.js";
|
|
48
48
|
import {
|
|
49
49
|
PROVIDER_REGISTRY,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-47EWPF3R.js";
|
|
4
|
+
import "./chunk-DJBCRQTD.js";
|
|
5
|
+
import "./chunk-UF3ZJMJO.js";
|
|
6
|
+
import "./chunk-NHLOKTUV.js";
|
|
7
|
+
import "./chunk-3UAFHUEC.js";
|
|
8
|
+
import "./chunk-Z7NVD3OQ.js";
|
|
9
|
+
import "./chunk-VSBC4SWO.js";
|
|
10
|
+
import "./chunk-AF3WSNVX.js";
|
|
11
|
+
import "./chunk-74ZCQKYU.js";
|
|
12
|
+
import "./chunk-ZNLABJCS.js";
|
|
13
|
+
import "./chunk-FQWJMPKW.js";
|
|
14
|
+
import "./chunk-WYDVMFGJ.js";
|
|
15
|
+
import "./chunk-5GAIJBOE.js";
|
|
16
|
+
import "./chunk-E6B4W3WG.js";
|
|
17
|
+
import "./chunk-YXSIPPBW.js";
|
|
18
|
+
import "./chunk-ZB3VC2MR.js";
|
|
19
|
+
import "./chunk-N5C3PJZC.js";
|
|
20
|
+
import "./chunk-XTRFUWIR.js";
|
|
21
|
+
import "./chunk-WUAWWKTN.js";
|
|
22
|
+
import "./chunk-IN7VIORK.js";
|
|
23
|
+
import "./chunk-ZMKVEJKR.js";
|
|
24
|
+
import "./chunk-CVFIM72Q.js";
|
|
25
|
+
import "./chunk-46UEEFMW.js";
|
|
26
|
+
import "./chunk-YDD5TC5Q.js";
|
|
27
|
+
import "./chunk-37ABTUFU.js";
|
|
28
|
+
import "./chunk-NU657BBQ.js";
|
|
29
|
+
import "./chunk-PGAU3W3M.js";
|
|
30
|
+
import "./chunk-FLQ5FLHW.js";
|
|
31
|
+
import "./chunk-ERS3QNNJ.js";
|
|
32
|
+
import "./chunk-22U7TZPN.js";
|
|
33
|
+
import "./chunk-KFQGP6VL.js";
|
|
34
|
+
export {
|
|
35
|
+
createServer
|
|
36
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-GON6OGXB.js";
|
|
10
|
+
import "./chunk-HPIK224M.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
|
@@ -80,3 +80,39 @@
|
|
|
80
80
|
2026-03-11 02:47:32: 2026-03-11T01:47:32Z ERR Request failed error="stream 37721 canceled by remote with error code 0" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/67ba24f1-c8af-40b4-9df5-c05b81fc1e7a/price-stream event=0 ip=198.41.200.23 type=http
|
|
81
81
|
2026-03-11 02:47:42: 2026-03-11T01:47:42Z ERR error="stream 37725 canceled by remote with error code 0" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
82
82
|
2026-03-11 02:47:42: 2026-03-11T01:47:42Z ERR Request failed error="stream 37725 canceled by remote with error code 0" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.200.23 type=http
|
|
83
|
+
2026-03-11 02:49:38: 2026-03-11T01:49:38Z ERR error="stream 38317 canceled by remote with error code 0" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
84
|
+
2026-03-11 02:49:38: 2026-03-11T01:49:38Z ERR Request failed error="stream 38317 canceled by remote with error code 0" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/67ba24f1-c8af-40b4-9df5-c05b81fc1e7a/price-stream event=0 ip=198.41.200.23 type=http
|
|
85
|
+
2026-03-11 02:49:45: 2026-03-11T01:49:45Z ERR error="stream 38313 canceled by remote with error code 0" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
86
|
+
2026-03-11 02:49:45: 2026-03-11T01:49:45Z ERR Request failed error="stream 38313 canceled by remote with error code 0" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.200.23 type=http
|
|
87
|
+
2026-03-11 02:51:53: 2026-03-11T01:51:53Z ERR error="stream 38905 canceled by remote with error code 0" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
88
|
+
2026-03-11 02:51:53: 2026-03-11T01:51:53Z ERR Request failed error="stream 38905 canceled by remote with error code 0" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/67ba24f1-c8af-40b4-9df5-c05b81fc1e7a/price-stream event=0 ip=198.41.200.23 type=http
|
|
89
|
+
2026-03-11 02:52:02: 2026-03-11T01:52:02Z ERR error="stream 38901 canceled by remote with error code 0" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
90
|
+
2026-03-11 02:52:02: 2026-03-11T01:52:02Z ERR Request failed error="stream 38901 canceled by remote with error code 0" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.200.23 type=http
|
|
91
|
+
2026-03-11 02:56:18: 2026-03-11T01:56:18Z ERR error="unexpected EOF" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
92
|
+
2026-03-11 02:56:18: 2026-03-11T01:56:18Z ERR error="unexpected EOF" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
93
|
+
2026-03-11 02:56:18: 2026-03-11T01:56:18Z ERR Request failed error="unexpected EOF" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.200.23 type=http
|
|
94
|
+
2026-03-11 02:56:18: 2026-03-11T01:56:18Z ERR Request failed error="unexpected EOF" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/67ba24f1-c8af-40b4-9df5-c05b81fc1e7a/price-stream event=0 ip=198.41.200.23 type=http
|
|
95
|
+
2026-03-11 02:56:18: 2026-03-11T01:56:18Z ERR error="unexpected EOF" connIndex=2 event=1 ingressRule=0 originService=http://localhost:3100
|
|
96
|
+
2026-03-11 02:56:18: 2026-03-11T01:56:18Z ERR Request failed error="unexpected EOF" connIndex=2 dest=https://enterprise.agenticmail.io/api/polymarket/67ba24f1-c8af-40b4-9df5-c05b81fc1e7a/price-stream event=0 ip=198.41.192.167 type=http
|
|
97
|
+
2026-03-11 02:56:18: 2026-03-11T01:56:18Z ERR error="unexpected EOF" connIndex=2 event=1 ingressRule=0 originService=http://localhost:3100
|
|
98
|
+
2026-03-11 02:56:18: 2026-03-11T01:56:18Z ERR Request failed error="unexpected EOF" connIndex=2 dest=https://enterprise.agenticmail.io/api/polymarket/stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.192.167 type=http
|
|
99
|
+
2026-03-11 02:56:18: 2026-03-11T01:56:18Z ERR error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp [::1]:3100: connect: connection refused" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
100
|
+
2026-03-11 02:56:18: 2026-03-11T01:56:18Z ERR Request failed error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp [::1]:3100: connect: connection refused" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/67ba24f1-c8af-40b4-9df5-c05b81fc1e7a/wallet/balance event=0 ip=198.41.200.23 type=http
|
|
101
|
+
2026-03-11 03:08:54: 2026-03-11T02:08:54Z ERR error="stream 3125 canceled by remote with error code 0" connIndex=2 event=1 ingressRule=0 originService=http://localhost:3100
|
|
102
|
+
2026-03-11 03:08:54: 2026-03-11T02:08:54Z ERR Request failed error="stream 3125 canceled by remote with error code 0" connIndex=2 dest=https://enterprise.agenticmail.io/api/polymarket/67ba24f1-c8af-40b4-9df5-c05b81fc1e7a/price-stream event=0 ip=198.41.192.167 type=http
|
|
103
|
+
2026-03-11 03:08:58: 2026-03-11T02:08:58Z ERR error="stream 39777 canceled by remote with error code 0" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
104
|
+
2026-03-11 03:08:58: 2026-03-11T02:08:58Z ERR Request failed error="stream 39777 canceled by remote with error code 0" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.200.23 type=http
|
|
105
|
+
2026-03-11 03:09:45: 2026-03-11T02:09:45Z ERR error="unexpected EOF" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
106
|
+
2026-03-11 03:09:45: 2026-03-11T02:09:45Z ERR Request failed error="unexpected EOF" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.200.23 type=http
|
|
107
|
+
2026-03-11 03:09:45: 2026-03-11T02:09:45Z ERR error="unexpected EOF" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
108
|
+
2026-03-11 03:09:45: 2026-03-11T02:09:45Z ERR error="unexpected EOF" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
109
|
+
2026-03-11 03:09:45: 2026-03-11T02:09:45Z ERR Request failed error="unexpected EOF" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/67ba24f1-c8af-40b4-9df5-c05b81fc1e7a/price-stream event=0 ip=198.41.200.23 type=http
|
|
110
|
+
2026-03-11 03:09:45: 2026-03-11T02:09:45Z ERR Request failed error="unexpected EOF" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.200.23 type=http
|
|
111
|
+
2026-03-11 03:09:45: 2026-03-11T02:09:45Z ERR error="unexpected EOF" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
112
|
+
2026-03-11 03:09:45: 2026-03-11T02:09:45Z ERR Request failed error="unexpected EOF" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/67ba24f1-c8af-40b4-9df5-c05b81fc1e7a/price-stream event=0 ip=198.41.200.23 type=http
|
|
113
|
+
2026-03-11 03:09:46: 2026-03-11T02:09:46Z ERR error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp [::1]:3100: connect: connection refused" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
114
|
+
2026-03-11 03:09:46: 2026-03-11T02:09:46Z ERR Request failed error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp [::1]:3100: connect: connection refused" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/67ba24f1-c8af-40b4-9df5-c05b81fc1e7a/wallet/balance event=0 ip=198.41.200.23 type=http
|
|
115
|
+
2026-03-11 03:10:29: 2026-03-11T02:10:29Z ERR error="stream 40853 canceled by remote with error code 0" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
116
|
+
2026-03-11 03:10:29: 2026-03-11T02:10:29Z ERR Request failed error="stream 40853 canceled by remote with error code 0" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/67ba24f1-c8af-40b4-9df5-c05b81fc1e7a/price-stream event=0 ip=198.41.200.23 type=http
|
|
117
|
+
2026-03-11 03:10:35: 2026-03-11T02:10:35Z ERR error="stream 40857 canceled by remote with error code 0" connIndex=3 event=1 ingressRule=0 originService=http://localhost:3100
|
|
118
|
+
2026-03-11 03:10:35: 2026-03-11T02:10:35Z ERR Request failed error="stream 40857 canceled by remote with error code 0" connIndex=3 dest=https://enterprise.agenticmail.io/api/polymarket/stream?agentId=67ba24f1-c8af-40b4-9df5-c05b81fc1e7a event=0 ip=198.41.200.23 type=http
|