@agenticmail/enterprise 0.5.524 → 0.5.526

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.
@@ -1041,6 +1041,7 @@ export function PolymarketPage() {
1041
1041
  function renderFilteredTable(tabId, data, emptyMsg, headers, rowFn, opts) {
1042
1042
  var clickFn = opts.onRowClick || function(item) { setSelectedRow({ tab: tabId, data: item }); };
1043
1043
  var filtered = applySearchFilter(data, tabId, opts.searchFields || [], opts.filters || []);
1044
+ if (opts.sortFn) filtered = filtered.slice().sort(opts.sortFn);
1044
1045
  var result = paginateData(filtered, tabId, opts.pageSize);
1045
1046
  var hasData = data && data.length > 0;
1046
1047
  var s = getTC(tabId);
@@ -1879,8 +1880,9 @@ export function PolymarketPage() {
1879
1880
  h('ul', { style: _ul },
1880
1881
  h('li', null, h('strong', null, 'Pending Buy Orders'), ' — Buy orders placed by the agent or awaiting approval before execution.'),
1881
1882
  h('li', null, h('strong', null, 'Pending Sell Orders'), ' — Sell orders placed automatically (e.g. stop-loss, take-profit) or manually, awaiting execution.'),
1882
- h('li', null, h('strong', null, 'Approve'), ' — Executes the trade on Polymarket via the CLOB API.'),
1883
- h('li', null, h('strong', null, 'Reject'), ' — Cancels the trade. The agent learns from rejections.')
1883
+ h('li', null, h('strong', null, 'Awaiting fill'), ' — Order is on the exchange, waiting to be matched. No action needed.'),
1884
+ h('li', null, h('strong', null, 'Approve'), ' — (Approval mode only) Executes the trade on Polymarket via the CLOB API.'),
1885
+ h('li', null, h('strong', null, 'Reject'), ' — (Approval mode only) Cancels the trade. The agent learns from rejections.')
1884
1886
  ),
1885
1887
  h('div', { style: _tip }, h('strong', null, 'Tip: '), 'Switch to "autonomous" mode in Config to let the agent trade without approval (within risk limits).')
1886
1888
  )
@@ -1930,14 +1932,18 @@ export function PolymarketPage() {
1930
1932
  h('td', null, '$' + ((t.price || 0) * (t.size || 0)).toFixed(2)),
1931
1933
  h('td', null, h('span', { className: 'badge badge-' + (t.urgency === 'high' ? 'warning' : 'secondary') }, t.urgency || 'normal')),
1932
1934
  h('td', null, fmtDate(t.created_at)),
1933
- h('td', null, h('div', { style: { display: "flex", gap: "4px" } },
1934
- h('button', { className: 'btn btn-sm btn-success', onClick: function() { decideTrade(t.id, 'approve'); } }, I('check')),
1935
- h('button', { className: 'btn btn-sm btn-danger', onClick: function() { decideTrade(t.id, 'reject'); } }, I('x'))
1936
- )),
1935
+ h('td', null, t.source === 'placed' || t.status === 'placed'
1936
+ ? h('span', { style: { fontSize: 11, color: 'var(--text-muted)', fontStyle: 'italic' } }, 'Awaiting fill')
1937
+ : h('div', { style: { display: "flex", gap: "4px" } },
1938
+ h('button', { className: 'btn btn-sm btn-success', onClick: function() { decideTrade(t.id, 'approve'); } }, I('check')),
1939
+ h('button', { className: 'btn btn-sm btn-danger', onClick: function() { decideTrade(t.id, 'reject'); } }, I('x'))
1940
+ )
1941
+ ),
1937
1942
  ]; },
1938
1943
  { searchFields: ['market_question', 'outcome'], filters: [
1939
1944
  { key: 'side', label: 'Side', options: ['BUY', 'SELL'] },
1940
- { key: 'status', label: 'Status', options: ['pending', 'placed', 'cancelled'] },
1945
+ { key: 'status', label: 'Status', options: ['pending', 'placed'] },
1946
+ { key: 'source', label: 'Type', options: ['approval', 'placed'] },
1941
1947
  { key: 'urgency', label: 'Urgency', options: ['normal', 'high'] }
1942
1948
  ]}
1943
1949
  )),
@@ -1986,15 +1992,18 @@ export function PolymarketPage() {
1986
1992
  h('td', null, (t.size || 0).toFixed(1)),
1987
1993
  h('td', null, ((t.fill_price || t.price || 0) * 100).toFixed(1) + '\u00a2'),
1988
1994
  h('td', null, '$' + ((t.fill_price || t.price || 0) * (t.size || 0)).toFixed(2)),
1989
- h('td', null, h('span', { className: 'badge badge-' + (t.status === 'placed' || t.status === 'filled' ? 'success' : t.status === 'failed' || t.status === 'no_wallet' ? 'danger' : 'secondary') }, t.status)),
1990
- h('td', null, t.pnl != null ? pnlCell(t.pnl) : (t.status === 'placed' || t.status === 'filled' ? h('span', { className: 'text-muted', style: { fontSize: 11 } }, 'Open') : '--')),
1995
+ h('td', null, h('span', { className: 'badge badge-' + (t.status === 'filled' ? 'success' : t.status === 'placed' ? 'warning' : t.status === 'failed' || t.status === 'no_wallet' ? 'danger' : 'secondary') }, t.status === 'placed' ? 'pending' : t.status)),
1996
+ h('td', null, t.pnl != null ? pnlCell(t.pnl) : (t.status === 'filled' ? h('span', { className: 'text-muted', style: { fontSize: 11 } }, 'Open') : t.status === 'placed' ? h('span', { className: 'text-muted', style: { fontSize: 11 } }, 'Awaiting fill') : '--')),
1991
1997
  h('td', null, fmtDate(t.created_at)),
1992
1998
  ]; },
1993
1999
  { searchFields: ['market_question', 'token_id', 'outcome'], filters: [
1994
2000
  { key: 'side', label: 'Side', options: ['BUY', 'SELL'] },
1995
2001
  { key: 'outcome', label: 'Outcome', options: ['Yes', 'No'] },
1996
- { key: 'status', label: 'Status', options: ['placed', 'filled', 'failed', 'no_wallet', 'pending', 'cancelled', 'rejected'] }
1997
- ]}
2002
+ { key: 'status', label: 'Status', options: ['filled', 'failed', 'no_wallet', 'cancelled', 'rejected'] }
2003
+ ], sortFn: function(a, b) {
2004
+ // Most recent first
2005
+ return new Date(b.created_at || 0).getTime() - new Date(a.created_at || 0).getTime();
2006
+ }}
1998
2007
  )),
1999
2008
 
2000
2009
  // ═══ WALLET ═══
@@ -2070,7 +2079,18 @@ export function PolymarketPage() {
2070
2079
  ? h('span', { className: 'badge ' + (oc.toLowerCase() === 'yes' ? 'badge-success' : oc.toLowerCase() === 'no' ? 'badge-danger' : 'badge-secondary') }, oc)
2071
2080
  : h('span', { className: 'text-muted' }, '--')
2072
2081
  ),
2073
- h('td', { key: 'sh' }, (p.size || 0).toFixed(1)),
2082
+ h('td', { key: 'sh' }, h('div', null,
2083
+ (p.size || 0).toFixed(1),
2084
+ (function() {
2085
+ var pendingForToken = pendingTrades.filter(function(pt) { return pt.token_id === p.token_id && (pt.status === 'placed' || pt.source === 'placed'); });
2086
+ 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
+ });
2092
+ })()
2093
+ )),
2074
2094
  h('td', { key: 'e' }, (p.entry * 100).toFixed(1) + '\u00a2'),
2075
2095
  h('td', { key: 'c', style: { fontWeight: 600, color: isWon ? '#10b981' : isLost ? '#ef4444' : undefined } },
2076
2096
  isWon ? '100.0\u00a2' : isLost ? '0.0\u00a2' : (p.current * 100).toFixed(1) + '\u00a2'
@@ -2119,7 +2139,17 @@ export function PolymarketPage() {
2119
2139
  }, sellExecuting === p.token_id ? '...' : 'Sell')
2120
2140
  )
2121
2141
  ];
2122
- }, { searchKeys: ['market', 'outcome'], pageSize: 6 }
2142
+ }, { searchFields: ['market', 'outcome', 'token_id'], filters: [
2143
+ { key: 'side', label: 'Side', options: ['BUY', 'SELL'] },
2144
+ { key: 'outcome', label: 'Outcome', options: ['Yes', 'No'] },
2145
+ ], sortFn: function(a, b) {
2146
+ // Sort by closing date — soonest first
2147
+ var aEnd = a.endDate ? new Date(a.endDate).getTime() : Infinity;
2148
+ var bEnd = b.endDate ? new Date(b.endDate).getTime() : Infinity;
2149
+ if (isNaN(aEnd)) aEnd = Infinity;
2150
+ if (isNaN(bEnd)) bEnd = Infinity;
2151
+ return aEnd - bEnd;
2152
+ }, pageSize: 20 }
2123
2153
  )
2124
2154
  ),
2125
2155
 
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  provision,
9
9
  runSetupWizard
10
- } from "./chunk-SBGJQBFU.js";
10
+ } from "./chunk-3556ZWOT.js";
11
11
  import {
12
12
  AgenticMailManager,
13
13
  GoogleEmailProvider,
@@ -28,7 +28,7 @@ import {
28
28
  executeTool,
29
29
  runAgentLoop,
30
30
  toolsToDefinitions
31
- } from "./chunk-DWXADN72.js";
31
+ } from "./chunk-MINHAUO7.js";
32
32
  import "./chunk-R3LFL3TN.js";
33
33
  import {
34
34
  ValidationError,
@@ -43,7 +43,7 @@ import {
43
43
  requireRole,
44
44
  securityHeaders,
45
45
  validate
46
- } from "./chunk-Y7JDECBF.js";
46
+ } from "./chunk-2DT6AIHU.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-EXUNNJ6N.js";
120
+ import "./chunk-AFVQ2MLV.js";
121
121
  import "./chunk-X5IZUXDC.js";
122
122
  import "./chunk-I5IGHBXW.js";
123
- import "./chunk-BLJLFTPD.js";
123
+ import "./chunk-5EKY6W2K.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-SXARA4VN.js";
131
+ import "./chunk-NFUE25E4.js";
132
132
  import {
133
133
  CircuitBreaker,
134
134
  CircuitOpenError,
@@ -0,0 +1,17 @@
1
+ import {
2
+ createPolymarketTools,
3
+ executeOrder
4
+ } from "./chunk-AFVQ2MLV.js";
5
+ import "./chunk-X5IZUXDC.js";
6
+ import "./chunk-I5IGHBXW.js";
7
+ import "./chunk-5EKY6W2K.js";
8
+ import "./chunk-WUAWWKTN.js";
9
+ import "./chunk-2CDGYMJK.js";
10
+ import "./chunk-V3LPIDTL.js";
11
+ import "./chunk-A4CX3XQS.js";
12
+ import "./chunk-NFUE25E4.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-5EKY6W2K.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-NFUE25E4.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-MINHAUO7.js";
20
+ import "./chunk-R3LFL3TN.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-IEYHI57W.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-EXUNNJ6N.js";
18
+ import "./chunk-X5IZUXDC.js";
19
+ import "./chunk-I5IGHBXW.js";
20
+ import "./chunk-BLJLFTPD.js";
21
+ import "./chunk-WUAWWKTN.js";
22
+ import "./chunk-2CDGYMJK.js";
23
+ import "./chunk-V3LPIDTL.js";
24
+ import "./chunk-A4CX3XQS.js";
25
+ import "./chunk-SXARA4VN.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
+ };
@@ -0,0 +1,36 @@
1
+ import {
2
+ createServer
3
+ } from "./chunk-2DT6AIHU.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-AFVQ2MLV.js";
18
+ import "./chunk-X5IZUXDC.js";
19
+ import "./chunk-I5IGHBXW.js";
20
+ import "./chunk-5EKY6W2K.js";
21
+ import "./chunk-WUAWWKTN.js";
22
+ import "./chunk-2CDGYMJK.js";
23
+ import "./chunk-V3LPIDTL.js";
24
+ import "./chunk-A4CX3XQS.js";
25
+ import "./chunk-NFUE25E4.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
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ promptCompanyInfo,
3
+ promptDatabase,
4
+ promptDeployment,
5
+ promptDomain,
6
+ promptRegistration,
7
+ provision,
8
+ runSetupWizard
9
+ } from "./chunk-CB27JM7S.js";
10
+ import "./chunk-5KB5MAZK.js";
11
+ import "./chunk-KFQGP6VL.js";
12
+ export {
13
+ promptCompanyInfo,
14
+ promptDatabase,
15
+ promptDeployment,
16
+ promptDomain,
17
+ promptRegistration,
18
+ provision,
19
+ runSetupWizard
20
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ promptCompanyInfo,
3
+ promptDatabase,
4
+ promptDeployment,
5
+ promptDomain,
6
+ promptRegistration,
7
+ provision,
8
+ runSetupWizard
9
+ } from "./chunk-3556ZWOT.js";
10
+ import "./chunk-5KB5MAZK.js";
11
+ import "./chunk-KFQGP6VL.js";
12
+ export {
13
+ promptCompanyInfo,
14
+ promptDatabase,
15
+ promptDeployment,
16
+ promptDomain,
17
+ promptRegistration,
18
+ provision,
19
+ runSetupWizard
20
+ };
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Indeed Job Application Bot — Headed Chrome with persistent login
3
+ * Step 1: Launch browser, verify login, search for jobs, screenshot results
4
+ */
5
+
6
+ const { chromium } = require('playwright');
7
+ const path = require('path');
8
+ const fs = require('fs');
9
+
10
+ const PROFILE_DIR = path.join(process.env.HOME, '.agenticmail', 'browser-profile-indeed');
11
+ const SCREENSHOT_DIR = '/tmp';
12
+
13
+ async function screenshot(page, name) {
14
+ const p = path.join(SCREENSHOT_DIR, `indeed-${name}.png`);
15
+ await page.screenshot({ path: p, fullPage: false });
16
+ return p;
17
+ }
18
+
19
+ async function main() {
20
+ const action = process.argv[2] || 'search';
21
+
22
+ const ctx = await chromium.launchPersistentContext(PROFILE_DIR, {
23
+ headless: false,
24
+ channel: 'chrome',
25
+ args: ['--no-first-run', '--disable-blink-features=AutomationControlled'],
26
+ viewport: { width: 1400, height: 900 },
27
+ });
28
+
29
+ // Use existing page or create new one
30
+ const page = ctx.pages()[0] || await ctx.newPage();
31
+
32
+ if (action === 'search') {
33
+ // Navigate to Indeed and search
34
+ const query = process.argv[3] || 'AI Engineer';
35
+ const location = process.argv[4] || 'Charlotte, NC';
36
+
37
+ console.log(`Searching Indeed for "${query}" in "${location}"...`);
38
+ await page.goto(`https://www.indeed.com/jobs?q=${encodeURIComponent(query)}&l=${encodeURIComponent(location)}&radius=50&fromage=14`, {
39
+ waitUntil: 'domcontentloaded', timeout: 30000
40
+ });
41
+ await page.waitForTimeout(3000);
42
+
43
+ const ss = await screenshot(page, 'search');
44
+ console.log(`Screenshot: ${ss}`);
45
+
46
+ // Extract job listings
47
+ const jobs = await page.evaluate(() => {
48
+ const cards = document.querySelectorAll('.job_seen_beacon, .jobsearch-ResultsList > li, [data-jk]');
49
+ const results = [];
50
+ cards.forEach(card => {
51
+ const titleEl = card.querySelector('h2 a, .jobTitle a, [data-jk] a');
52
+ const companyEl = card.querySelector('[data-testid="company-name"], .companyName, .company');
53
+ const locationEl = card.querySelector('[data-testid="text-location"], .companyLocation, .location');
54
+ if (titleEl) {
55
+ results.push({
56
+ title: titleEl.textContent?.trim() || '',
57
+ company: companyEl?.textContent?.trim() || '',
58
+ location: locationEl?.textContent?.trim() || '',
59
+ href: titleEl.href || '',
60
+ jk: card.getAttribute('data-jk') || titleEl.href?.match(/jk=([^&]+)/)?.[1] || '',
61
+ });
62
+ }
63
+ });
64
+ return results;
65
+ });
66
+
67
+ console.log(`\nFound ${jobs.length} jobs:`);
68
+ jobs.forEach((j, i) => {
69
+ console.log(`${i+1}. ${j.title} @ ${j.company} (${j.location})`);
70
+ });
71
+
72
+ // Output as JSON for piping
73
+ fs.writeFileSync('/tmp/indeed-jobs.json', JSON.stringify(jobs, null, 2));
74
+ console.log('\nJobs saved to /tmp/indeed-jobs.json');
75
+ }
76
+
77
+ // Keep browser open
78
+ console.log('\nBROWSER_READY');
79
+ await new Promise(() => {});
80
+ }
81
+
82
+ main().catch(e => { console.error('ERROR:', e.message); process.exit(1); });