@agenticmail/enterprise 0.5.526 → 0.5.529

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.
@@ -131,6 +131,13 @@ 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; } });
135
+ // Export key PIN verification
136
+ const [exportStep, setExportStep] = useState('idle'); // 'idle' | 'pin' | 'setup_pin' | 'revealed'
137
+ const [exportPin, setExportPin] = useState('');
138
+ const [exportPinSetup, setExportPinSetup] = useState({ pin: '', confirm: '' });
139
+ const [exportLoading, setExportLoading] = useState(false);
140
+ const [exportAutoCloseTimer, setExportAutoCloseTimer] = useState(null);
134
141
 
135
142
  // Countdown timer during swap
136
143
  useEffect(function() {
@@ -1067,6 +1074,48 @@ export function PolymarketPage() {
1067
1074
  function renderDetailModal() {
1068
1075
  if (!selectedRow) return null;
1069
1076
  var d = selectedRow.data;
1077
+
1078
+ // Custom modal for pending orders on a position
1079
+ if (selectedRow.tab === 'pendingForPosition' && d.orders) {
1080
+ return h('div', { className: 'modal-overlay', onClick: function() { setSelectedRow(null); } },
1081
+ h('div', { className: 'modal', onClick: function(e) { e.stopPropagation(); }, style: { width: 560, maxHeight: '85vh', overflow: 'auto' } },
1082
+ h('div', { className: 'modal-header' },
1083
+ h('h2', { style: { fontSize: 16, flex: 1, display: 'flex', alignItems: 'center', gap: 8 } }, I('clock'), ' Pending Orders'),
1084
+ h('button', { className: 'btn btn-ghost btn-icon', onClick: function() { setSelectedRow(null); } }, '\u00d7')
1085
+ ),
1086
+ h('div', { className: 'modal-body', style: { padding: 20 } },
1087
+ h('div', { style: { marginBottom: 16, padding: '10px 14px', background: 'var(--bg-secondary)', borderRadius: 8, fontSize: 13 } },
1088
+ h('div', { style: { fontWeight: 600, marginBottom: 4 } }, d.market || 'Position'),
1089
+ h('div', { style: { color: 'var(--text-muted)' } }, 'Filled shares: ', h('strong', null, (d.filled_shares || 0).toFixed(1)),
1090
+ ' \u00b7 Pending orders: ', h('strong', null, d.orders.length))
1091
+ ),
1092
+ h('table', { className: 'data-table', style: { width: '100%' } },
1093
+ h('thead', null, h('tr', null,
1094
+ h('th', null, 'Side'), h('th', null, 'Outcome'), h('th', null, 'Shares'), h('th', null, 'Price'), h('th', null, 'Cost'), h('th', null, 'Placed')
1095
+ )),
1096
+ h('tbody', null, d.orders.map(function(o, i) {
1097
+ return h('tr', { key: i },
1098
+ h('td', null, sideBadge(o.side)),
1099
+ h('td', null, o.outcome
1100
+ ? h('span', { className: 'badge ' + (o.outcome.toLowerCase() === 'yes' ? 'badge-success' : 'badge-danger') }, o.outcome)
1101
+ : '--'),
1102
+ h('td', null, (o.size || 0).toFixed(1)),
1103
+ h('td', null, ((o.price || 0) * 100).toFixed(1) + '\u00a2'),
1104
+ h('td', null, '$' + ((o.price || 0) * (o.size || 0)).toFixed(2)),
1105
+ h('td', { style: { fontSize: 11, color: 'var(--text-muted)' } }, fmtDate(o.created_at))
1106
+ );
1107
+ }))
1108
+ ),
1109
+ h('div', { style: { marginTop: 12, fontSize: 12, color: 'var(--text-muted)', fontStyle: 'italic' } },
1110
+ 'Total pending capital: $' + d.orders.reduce(function(s, o) { return s + (o.price || 0) * (o.size || 0); }, 0).toFixed(2))
1111
+ ),
1112
+ h('div', { className: 'modal-footer' },
1113
+ h('button', { className: 'btn btn-primary', onClick: function() { setSelectedRow(null); } }, 'Close')
1114
+ )
1115
+ )
1116
+ );
1117
+ }
1118
+
1070
1119
  var title = d.market_question || d.title || d.headline || d.strategy_name || d.strategy ||
1071
1120
  d.topic || d.label || d.signal_source || d.category || d.name ||
1072
1121
  (d.lesson ? (d.lesson.length > 60 ? d.lesson.slice(0, 60) + '\u2026' : d.lesson) : null) ||
@@ -1679,9 +1728,20 @@ export function PolymarketPage() {
1679
1728
  );
1680
1729
  })(),
1681
1730
 
1682
- // ═══ HEADER P&L CHART (sticky — always visible) ═══
1731
+ // ═══ HEADER P&L CHART (sticky — toggle visibility, persisted to localStorage) ═══
1683
1732
  h('div', { style: { position: 'sticky', top: 0, zIndex: 20, background: 'var(--bg)', borderBottom: '1px solid var(--border)', padding: 0, marginTop: '-16px' } },
1684
- renderLiveChart()
1733
+ h('div', { style: { display: 'flex', justifyContent: 'flex-end', padding: '4px 8px 0' } },
1734
+ h('button', {
1735
+ className: 'btn btn-sm',
1736
+ style: { fontSize: 11, padding: '2px 8px', opacity: 0.7 },
1737
+ onClick: function() {
1738
+ var next = !chartVisible;
1739
+ setChartVisible(next);
1740
+ try { localStorage.setItem('pm_chart_visible', String(next)); } catch {}
1741
+ }
1742
+ }, chartVisible ? 'Hide Chart' : 'Show Chart')
1743
+ ),
1744
+ chartVisible ? renderLiveChart() : null
1685
1745
  ),
1686
1746
 
1687
1747
  h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16, flexWrap: 'wrap', gap: 12 } },
@@ -2079,16 +2139,24 @@ export function PolymarketPage() {
2079
2139
  ? h('span', { className: 'badge ' + (oc.toLowerCase() === 'yes' ? 'badge-success' : oc.toLowerCase() === 'no' ? 'badge-danger' : 'badge-secondary') }, oc)
2080
2140
  : h('span', { className: 'text-muted' }, '--')
2081
2141
  ),
2082
- h('td', { key: 'sh' }, h('div', null,
2142
+ h('td', { key: 'sh' }, h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
2083
2143
  (p.size || 0).toFixed(1),
2084
2144
  (function() {
2085
2145
  var pendingForToken = pendingTrades.filter(function(pt) { return pt.token_id === p.token_id && (pt.status === 'placed' || pt.source === 'placed'); });
2086
2146
  if (!pendingForToken.length) return null;
2087
- return pendingForToken.map(function(pt, i) {
2088
- return h('div', { key: i, style: { fontSize: 10, color: '#b45309', fontStyle: 'italic', marginTop: 2 } },
2089
- 'pending ' + (pt.size || 0).toFixed(1) + ' ' + (pt.side || '').toLowerCase()
2090
- );
2091
- });
2147
+ return h('button', {
2148
+ title: pendingForToken.length + ' pending order(s)',
2149
+ 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 },
2150
+ onClick: function(e) {
2151
+ e.stopPropagation();
2152
+ setSelectedRow({ tab: 'pendingForPosition', data: {
2153
+ market: p.market || shortId(p.token_id),
2154
+ token_id: p.token_id,
2155
+ filled_shares: p.size || 0,
2156
+ orders: pendingForToken,
2157
+ }});
2158
+ }
2159
+ }, I('clock'), ' ' + pendingForToken.length);
2092
2160
  })()
2093
2161
  )),
2094
2162
  h('td', { key: 'e' }, (p.entry * 100).toFixed(1) + '\u00a2'),
@@ -2149,7 +2217,7 @@ export function PolymarketPage() {
2149
2217
  if (isNaN(aEnd)) aEnd = Infinity;
2150
2218
  if (isNaN(bEnd)) bEnd = Infinity;
2151
2219
  return aEnd - bEnd;
2152
- }, pageSize: 20 }
2220
+ }, pageSize: 10 }
2153
2221
  )
2154
2222
  ),
2155
2223
 
@@ -2319,13 +2387,13 @@ export function PolymarketPage() {
2319
2387
  ),
2320
2388
  // Wallet management bar
2321
2389
  (wallet || walletBalance) && h('div', { style: { display: 'flex', gap: 8, marginTop: 16, marginBottom: 4 } },
2322
- h('button', { className: 'btn btn-sm btn-secondary', onClick: async function() {
2323
- if (!(await showConfirm('Export your wallet private key?\n\nThis will reveal the private key that controls all funds. Only do this if you need to import the wallet into MetaMask, Rabby, or another wallet app.\n\nThis action is logged in the audit trail.'))) return;
2324
- try {
2325
- var res = await apiCall('/polymarket/' + selectedAgent + '/wallet/export', { method: 'POST', body: JSON.stringify({ confirm: 'EXPORT' }) });
2326
- if (res.privateKey) { setExportedKey(res); }
2327
- else { toast(res.error || 'Export failed', 'error'); }
2328
- } catch (e) { toast(e.message || 'Export failed — owner access required', 'error'); }
2390
+ h('button', { className: 'btn btn-sm btn-secondary', onClick: function() {
2391
+ // Start PIN verification flow for export
2392
+ if (walletSecurity && walletSecurity.hasPin) {
2393
+ setExportStep('pin'); setExportPin('');
2394
+ } else {
2395
+ setExportStep('setup_pin'); setExportPinSetup({ pin: '', confirm: '' });
2396
+ }
2329
2397
  } }, I('key'), ' Export Private Key'),
2330
2398
  h('button', { className: 'btn btn-sm btn-secondary', onClick: function() { setImportKey(''); setShowImportWallet(true); } }, I('download'), ' Import Wallet'),
2331
2399
  h('button', { className: 'btn btn-sm btn-secondary', onClick: async function() {
@@ -2997,58 +3065,136 @@ export function PolymarketPage() {
2997
3065
  )
2998
3066
  ),
2999
3067
 
3000
- // Export key modal
3001
- exportedKey && h('div', { className: 'modal-overlay', onMouseMove: hideTip, onClick: function() { setExportedKey(null); } },
3068
+ // Export key modal — PIN-gated with auto-close
3069
+ exportStep !== 'idle' && h('div', { className: 'modal-overlay', onMouseMove: hideTip, onClick: function() { setExportStep('idle'); setExportedKey(null); if (exportAutoCloseTimer) clearTimeout(exportAutoCloseTimer); } },
3002
3070
  h('div', { className: 'modal', onClick: function(e) { e.stopPropagation(); }, style: { width: 520, maxHeight: '85vh', overflow: 'auto' } },
3003
3071
  h('div', { className: 'modal-header' },
3004
- h('h2', { style: { fontSize: 16, flex: 1, display: 'flex', alignItems: 'center', gap: 8 } }, I('key'), ' Wallet Private Key'),
3005
- h('button', { className: 'btn btn-ghost btn-icon', onClick: function() { setExportedKey(null); } }, '\u00d7')
3072
+ h('h2', { style: { fontSize: 16, flex: 1, display: 'flex', alignItems: 'center', gap: 8 } }, I('key'), ' Export Private Key'),
3073
+ h('button', { className: 'btn btn-ghost btn-icon', onClick: function() { setExportStep('idle'); setExportedKey(null); if (exportAutoCloseTimer) clearTimeout(exportAutoCloseTimer); } }, '\u00d7')
3006
3074
  ),
3007
3075
  h('div', { className: 'modal-body', style: { padding: 20 } },
3008
- h('div', { style: { padding: 12, background: 'rgba(239,68,68,0.08)', border: '1px solid rgba(239,68,68,0.25)', borderRadius: 8, marginBottom: 16, fontSize: 12, color: '#ef4444', lineHeight: 1.6 } },
3009
- h('strong', null, '\u26A0 SECURITY WARNING'), h('br'),
3010
- 'Anyone with this key has FULL CONTROL of this wallet and all funds. Never share it. Never paste it into untrusted sites.'
3011
- ),
3012
- exportedKey.mismatch && h('div', { style: { padding: 12, background: 'rgba(239,68,68,0.15)', border: '2px solid rgba(239,68,68,0.5)', borderRadius: 8, marginBottom: 16, fontSize: 12, color: '#dc2626', lineHeight: 1.6 } },
3013
- h('strong', null, '\u26A0 CRITICAL: KEY MISMATCH'), h('br'),
3014
- 'This private key derives address ', h('code', null, exportedKey.address),
3015
- ' but your funded wallet is ', h('code', null, exportedKey.storedFunderAddress), '. ',
3016
- h('br'), h('strong', null, 'The agent CANNOT access funds at the stored address. '),
3017
- 'This is likely caused by a VAULT_KEY environment variable change. Restore the original VAULT_KEY and restart to recover access.'
3018
- ),
3019
- h('div', { style: { marginBottom: 16 } },
3020
- h('label', { style: _labelStyle }, exportedKey.mismatch ? 'Derived Address (from private key)' : 'Wallet Address'),
3021
- h('div', { style: { fontFamily: 'var(--font-mono)', fontSize: 13, padding: '10px 12px', background: 'var(--bg-secondary)', borderRadius: 6, wordBreak: 'break-all', userSelect: 'all' } }, exportedKey.address),
3022
- exportedKey.mismatch && h('div', { style: { marginTop: 8 } },
3023
- h('label', { style: _labelStyle }, 'Stored Funder Address (has funds)'),
3024
- h('div', { style: { fontFamily: 'var(--font-mono)', fontSize: 13, padding: '10px 12px', background: 'rgba(239,68,68,0.06)', borderRadius: 6, wordBreak: 'break-all', userSelect: 'all', border: '1px solid rgba(239,68,68,0.2)' } }, exportedKey.storedFunderAddress)
3076
+
3077
+ // Step: Enter PIN
3078
+ exportStep === 'pin' && h('div', null,
3079
+ h('div', { style: { textAlign: 'center', padding: '16px 0' } },
3080
+ h('div', { style: { marginBottom: 12, color: 'var(--text-muted)' } }, I('lock', 40)),
3081
+ h('h3', { style: { marginBottom: 8 } }, 'Enter Wallet PIN'),
3082
+ h('p', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 16 } }, 'Enter your 6-digit wallet PIN to reveal the private key.')
3083
+ ),
3084
+ h('input', { type: 'password', value: exportPin, maxLength: 6, placeholder: '\u2022\u2022\u2022\u2022\u2022\u2022', autoFocus: true,
3085
+ style: { width: '100%', padding: '12px 16px', fontSize: 24, textAlign: 'center', letterSpacing: 8, fontFamily: 'var(--font-mono)', border: '2px solid var(--border)', borderRadius: 8, background: 'var(--bg-secondary)' },
3086
+ onChange: function(e) { setExportPin(e.target.value.replace(/\D/g, '').slice(0, 6)); }
3087
+ }),
3088
+ h('div', { style: { display: 'flex', gap: 8, marginTop: 16 } },
3089
+ h('button', { className: 'btn btn-secondary', onClick: function() { setExportStep('idle'); } }, 'Cancel'),
3090
+ h('button', { className: 'btn btn-primary', disabled: exportPin.length !== 6 || exportLoading, onClick: async function() {
3091
+ setExportLoading(true);
3092
+ try {
3093
+ var verify = await apiCall('/polymarket/' + selectedAgent + '/wallet/verify-transfer', { method: 'POST', body: JSON.stringify({ method: 'pin', code: exportPin }) });
3094
+ if (verify.ok) {
3095
+ var res = await apiCall('/polymarket/' + selectedAgent + '/wallet/export', { method: 'POST', body: JSON.stringify({ confirm: 'EXPORT' }) });
3096
+ if (res.privateKey) {
3097
+ setExportedKey(res); setExportStep('revealed');
3098
+ // Auto-close after 60 seconds
3099
+ var timer = setTimeout(function() { setExportStep('idle'); setExportedKey(null); toast('Export modal auto-closed for security', 'info'); }, 60000);
3100
+ setExportAutoCloseTimer(timer);
3101
+ } else { toast(res.error || 'Export failed', 'error'); }
3102
+ } else { toast(verify.error || 'Invalid PIN', 'error'); }
3103
+ } catch (e) { toast(e.message || 'Verification failed', 'error'); }
3104
+ setExportLoading(false);
3105
+ } }, exportLoading ? 'Verifying...' : 'Verify & Export')
3025
3106
  )
3026
3107
  ),
3027
- h('div', { style: { marginBottom: 16 } },
3028
- h('label', { style: _labelStyle }, 'Private Key'),
3029
- h('div', { style: { fontFamily: 'var(--font-mono)', fontSize: 12, padding: '10px 12px', background: 'var(--bg-secondary)', borderRadius: 6, wordBreak: 'break-all', userSelect: 'all', border: '1px solid rgba(239,68,68,0.3)' } }, exportedKey.privateKey)
3030
- ),
3031
- h('div', { style: { display: 'flex', gap: 8, marginBottom: 16 } },
3032
- h('button', { className: 'btn btn-sm btn-secondary', onClick: function() { navigator.clipboard?.writeText(exportedKey.privateKey); toast('Private key copied', 'success'); } }, 'Copy Key'),
3033
- h('button', { className: 'btn btn-sm btn-secondary', onClick: function() { navigator.clipboard?.writeText(exportedKey.address); toast('Address copied', 'success'); } }, 'Copy Address')
3034
- ),
3035
- h('div', { style: { fontSize: 13, color: 'var(--text-secondary)' } },
3036
- h('div', { style: { fontWeight: 600, marginBottom: 6 } }, 'Import into a wallet app:'),
3037
- h('div', { style: { display: 'grid', gap: 8 } },
3038
- h('div', { style: { padding: '8px 12px', background: 'var(--bg-secondary)', borderRadius: 6, fontSize: 12 } },
3039
- h('strong', null, 'MetaMask: '), 'Open MetaMask \u2192 Account menu \u2192 Import Account \u2192 Paste private key'
3108
+
3109
+ // Step: Set up PIN (first time)
3110
+ exportStep === 'setup_pin' && (function() {
3111
+ var pinVal = exportPinSetup.pin;
3112
+ var confVal = exportPinSetup.confirm;
3113
+ var isTrivial = pinVal.length === 6 && (/^(.)\1{5}$/.test(pinVal) || pinVal === '123456' || pinVal === '654321');
3114
+ var mismatch = pinVal.length === 6 && confVal.length === 6 && pinVal !== confVal;
3115
+ var canSubmit = pinVal.length === 6 && confVal.length === 6 && pinVal === confVal && !isTrivial && !exportLoading;
3116
+ return h('div', null,
3117
+ h('div', { style: { textAlign: 'center', padding: '12px 0 16px' } },
3118
+ h('div', { style: { marginBottom: 12, color: '#b45309' } }, I('shield', 40)),
3119
+ h('h3', { style: { marginBottom: 8 } }, 'Set Up Wallet PIN First'),
3120
+ h('p', { style: { fontSize: 12, color: 'var(--text-muted)', marginBottom: 4 } }, 'A 6-digit wallet PIN is required to export your private key. This PIN is also used for fund transfers.')
3121
+ ),
3122
+ h('div', { style: { marginBottom: 12 } },
3123
+ h('label', { style: { fontSize: 12, fontWeight: 600, display: 'block', marginBottom: 4 } }, 'PIN (6 digits)'),
3124
+ h('input', { type: 'password', inputMode: 'numeric', value: pinVal, maxLength: 6, placeholder: '\u2022\u2022\u2022\u2022\u2022\u2022', autoComplete: 'new-password',
3125
+ style: { width: '100%', padding: '10px 14px', fontSize: 20, textAlign: 'center', letterSpacing: 8, fontFamily: 'var(--font-mono)', border: '2px solid ' + (isTrivial ? '#ef4444' : 'var(--border)'), borderRadius: 8, background: 'var(--bg-secondary)' },
3126
+ onInput: function(e) { setExportPinSetup(Object.assign({}, exportPinSetup, { pin: e.target.value.replace(/\D/g, '').slice(0, 6) })); }
3127
+ }),
3128
+ isTrivial && h('div', { style: { fontSize: 11, color: '#ef4444', marginTop: 4 } }, 'PIN is too simple. Choose a less predictable PIN.')
3040
3129
  ),
3041
- h('div', { style: { padding: '8px 12px', background: 'var(--bg-secondary)', borderRadius: 6, fontSize: 12 } },
3042
- h('strong', null, 'Rabby: '), 'Open Rabby \u2192 Add Address \u2192 Import Private Key \u2192 Paste'
3130
+ h('div', { style: { marginBottom: 12 } },
3131
+ h('label', { style: { fontSize: 12, fontWeight: 600, display: 'block', marginBottom: 4 } }, 'Confirm PIN'),
3132
+ h('input', { type: 'password', inputMode: 'numeric', value: confVal, maxLength: 6, placeholder: '\u2022\u2022\u2022\u2022\u2022\u2022', autoComplete: 'new-password',
3133
+ style: { width: '100%', padding: '10px 14px', fontSize: 20, textAlign: 'center', letterSpacing: 8, fontFamily: 'var(--font-mono)', border: '2px solid ' + (mismatch ? '#ef4444' : 'var(--border)'), borderRadius: 8, background: 'var(--bg-secondary)' },
3134
+ onInput: function(e) { setExportPinSetup(Object.assign({}, exportPinSetup, { confirm: e.target.value.replace(/\D/g, '').slice(0, 6) })); }
3135
+ }),
3136
+ mismatch && h('div', { style: { fontSize: 11, color: '#ef4444', marginTop: 4 } }, 'PINs do not match')
3043
3137
  ),
3044
- h('div', { style: { padding: '8px 12px', background: 'var(--bg-secondary)', borderRadius: 6, fontSize: 12 } },
3045
- h('strong', null, 'Polymarket: '), 'Go to polymarket.com \u2192 Login \u2192 Connect Wallet \u2192 Use imported wallet via MetaMask/Rabby'
3138
+ h('div', { style: { display: 'flex', gap: 8, marginTop: 16 } },
3139
+ h('button', { className: 'btn btn-secondary', onClick: function() { setExportStep('idle'); } }, 'Cancel'),
3140
+ h('button', { className: 'btn btn-primary', disabled: !canSubmit, onClick: async function() {
3141
+ setExportLoading(true);
3142
+ try {
3143
+ var res = await apiCall('/polymarket/' + selectedAgent + '/wallet/setup-pin', { method: 'POST', body: JSON.stringify({ pin: pinVal }) });
3144
+ if (res.ok) {
3145
+ toast('Wallet PIN created!', 'success');
3146
+ setWalletSecurity(Object.assign({}, walletSecurity, { hasPin: true }));
3147
+ // Now export immediately
3148
+ var exp = await apiCall('/polymarket/' + selectedAgent + '/wallet/export', { method: 'POST', body: JSON.stringify({ confirm: 'EXPORT' }) });
3149
+ if (exp.privateKey) {
3150
+ setExportedKey(exp); setExportStep('revealed');
3151
+ var timer = setTimeout(function() { setExportStep('idle'); setExportedKey(null); toast('Export modal auto-closed for security', 'info'); }, 60000);
3152
+ setExportAutoCloseTimer(timer);
3153
+ }
3154
+ } else { toast(res.error || 'PIN setup failed', 'error'); }
3155
+ } catch (e) { toast(e.message, 'error'); }
3156
+ setExportLoading(false);
3157
+ } }, exportLoading ? 'Setting up...' : 'Create PIN & Export Key')
3158
+ )
3159
+ );
3160
+ })(),
3161
+
3162
+ // Step: Key revealed (auto-closes in 60s)
3163
+ exportStep === 'revealed' && exportedKey && h('div', null,
3164
+ h('div', { style: { padding: 10, background: 'rgba(180,83,9,0.1)', border: '1px solid rgba(180,83,9,0.3)', borderRadius: 8, marginBottom: 12, fontSize: 12, color: '#b45309', textAlign: 'center' } },
3165
+ I('clock'), ' This window will auto-close in 60 seconds for security.'
3166
+ ),
3167
+ h('div', { style: { padding: 12, background: 'rgba(239,68,68,0.08)', border: '1px solid rgba(239,68,68,0.25)', borderRadius: 8, marginBottom: 16, fontSize: 12, color: '#ef4444', lineHeight: 1.6 } },
3168
+ h('strong', null, '\u26A0 SECURITY WARNING'), h('br'),
3169
+ 'Anyone with this key has FULL CONTROL of this wallet and all funds. Never share it.'
3170
+ ),
3171
+ exportedKey.mismatch && h('div', { style: { padding: 12, background: 'rgba(239,68,68,0.15)', border: '2px solid rgba(239,68,68,0.5)', borderRadius: 8, marginBottom: 16, fontSize: 12, color: '#dc2626', lineHeight: 1.6 } },
3172
+ h('strong', null, '\u26A0 KEY MISMATCH'), h('br'),
3173
+ 'Key derives ', h('code', null, exportedKey.address), ' but funded wallet is ', h('code', null, exportedKey.storedFunderAddress)
3174
+ ),
3175
+ h('div', { style: { marginBottom: 16 } },
3176
+ h('label', { style: _labelStyle }, 'Wallet Address'),
3177
+ h('div', { style: { fontFamily: 'var(--font-mono)', fontSize: 13, padding: '10px 12px', background: 'var(--bg-secondary)', borderRadius: 6, wordBreak: 'break-all', userSelect: 'all' } }, exportedKey.address)
3178
+ ),
3179
+ h('div', { style: { marginBottom: 16 } },
3180
+ h('label', { style: _labelStyle }, 'Private Key'),
3181
+ h('div', { style: { fontFamily: 'var(--font-mono)', fontSize: 12, padding: '10px 12px', background: 'var(--bg-secondary)', borderRadius: 6, wordBreak: 'break-all', userSelect: 'all', border: '1px solid rgba(239,68,68,0.3)' } }, exportedKey.privateKey)
3182
+ ),
3183
+ h('div', { style: { display: 'flex', gap: 8, marginBottom: 16 } },
3184
+ h('button', { className: 'btn btn-sm btn-secondary', onClick: function() { navigator.clipboard?.writeText(exportedKey.privateKey); toast('Private key copied', 'success'); } }, 'Copy Key'),
3185
+ h('button', { className: 'btn btn-sm btn-secondary', onClick: function() { navigator.clipboard?.writeText(exportedKey.address); toast('Address copied', 'success'); } }, 'Copy Address')
3186
+ ),
3187
+ h('div', { style: { fontSize: 13, color: 'var(--text-secondary)' } },
3188
+ h('div', { style: { fontWeight: 600, marginBottom: 6 } }, 'Import into a wallet app:'),
3189
+ h('div', { style: { display: 'grid', gap: 8 } },
3190
+ h('div', { style: { padding: '8px 12px', background: 'var(--bg-secondary)', borderRadius: 6, fontSize: 12 } }, h('strong', null, 'MetaMask: '), 'Account menu \u2192 Import Account \u2192 Paste key'),
3191
+ h('div', { style: { padding: '8px 12px', background: 'var(--bg-secondary)', borderRadius: 6, fontSize: 12 } }, h('strong', null, 'Rabby: '), 'Add Address \u2192 Import Private Key \u2192 Paste')
3046
3192
  )
3047
3193
  )
3048
3194
  )
3049
3195
  ),
3050
3196
  h('div', { className: 'modal-footer' },
3051
- h('button', { className: 'btn btn-primary', onClick: function() { setExportedKey(null); } }, 'Done')
3197
+ h('button', { className: 'btn btn-primary', onClick: function() { setExportStep('idle'); setExportedKey(null); if (exportAutoCloseTimer) clearTimeout(exportAutoCloseTimer); } }, 'Close')
3052
3198
  )
3053
3199
  )
3054
3200
  ),
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  provision,
9
9
  runSetupWizard
10
- } from "./chunk-3556ZWOT.js";
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-MINHAUO7.js";
32
- import "./chunk-R3LFL3TN.js";
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-2DT6AIHU.js";
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-AFVQ2MLV.js";
120
+ import "./chunk-APNB5LUP.js";
121
121
  import "./chunk-X5IZUXDC.js";
122
122
  import "./chunk-I5IGHBXW.js";
123
- import "./chunk-5EKY6W2K.js";
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-NFUE25E4.js";
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,7 @@
1
+ import {
2
+ buildPolymarketPrompt
3
+ } from "./chunk-HP63Q326.js";
4
+ import "./chunk-KFQGP6VL.js";
5
+ export {
6
+ buildPolymarketPrompt
7
+ };
@@ -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
+ };
@@ -0,0 +1,50 @@
1
+ import {
2
+ AgentRuntime,
3
+ EmailChannel,
4
+ FollowUpScheduler,
5
+ SessionManager,
6
+ SubAgentManager,
7
+ ToolRegistry,
8
+ ageStaleMessages,
9
+ callLLM,
10
+ createAgentRuntime,
11
+ createNoopHooks,
12
+ createRuntimeHooks,
13
+ estimateMessageTokens,
14
+ estimateTokens,
15
+ executeTool,
16
+ runAgentLoop,
17
+ toolsToDefinitions,
18
+ truncateToolResults
19
+ } from "./chunk-7OINTHV5.js";
20
+ import "./chunk-HP63Q326.js";
21
+ import {
22
+ PROVIDER_REGISTRY,
23
+ listAllProviders,
24
+ resolveApiKeyForProvider,
25
+ resolveProvider
26
+ } from "./chunk-UF3ZJMJO.js";
27
+ import "./chunk-KFQGP6VL.js";
28
+ export {
29
+ AgentRuntime,
30
+ EmailChannel,
31
+ FollowUpScheduler,
32
+ PROVIDER_REGISTRY,
33
+ SessionManager,
34
+ SubAgentManager,
35
+ ToolRegistry,
36
+ ageStaleMessages,
37
+ callLLM,
38
+ createAgentRuntime,
39
+ createNoopHooks,
40
+ createRuntimeHooks,
41
+ estimateMessageTokens,
42
+ estimateTokens,
43
+ executeTool,
44
+ listAllProviders,
45
+ resolveApiKeyForProvider,
46
+ resolveProvider,
47
+ runAgentLoop,
48
+ toolsToDefinitions,
49
+ truncateToolResults
50
+ };
@@ -0,0 +1,36 @@
1
+ import {
2
+ createServer
3
+ } from "./chunk-LQ5OYZ7O.js";
4
+ import "./chunk-DJBCRQTD.js";
5
+ import "./chunk-UF3ZJMJO.js";
6
+ import "./chunk-TPL2J2U2.js";
7
+ import "./chunk-TK55CSBH.js";
8
+ import "./chunk-Z7NVD3OQ.js";
9
+ import "./chunk-VSBC4SWO.js";
10
+ import "./chunk-AF3WSNVX.js";
11
+ import "./chunk-74ZCQKYU.js";
12
+ import "./chunk-ET6WZFPS.js";
13
+ import "./chunk-FQWJMPKW.js";
14
+ import "./chunk-K2GKUQSB.js";
15
+ import "./chunk-NCODRQSS.js";
16
+ import "./chunk-PSZU6FMQ.js";
17
+ import "./chunk-APNB5LUP.js";
18
+ import "./chunk-X5IZUXDC.js";
19
+ import "./chunk-I5IGHBXW.js";
20
+ import "./chunk-MKE6LND3.js";
21
+ import "./chunk-WUAWWKTN.js";
22
+ import "./chunk-2CDGYMJK.js";
23
+ import "./chunk-V3LPIDTL.js";
24
+ import "./chunk-A4CX3XQS.js";
25
+ import "./chunk-5CENM5VB.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-TOGMCQSJ.js";
32
+ import "./chunk-22U7TZPN.js";
33
+ import "./chunk-KFQGP6VL.js";
34
+ export {
35
+ createServer
36
+ };