neoagent 2.3.0 → 2.3.1-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/.env.example +13 -0
  2. package/README.md +3 -1
  3. package/docs/automation.md +1 -1
  4. package/docs/capabilities.md +2 -2
  5. package/docs/configuration.md +14 -1
  6. package/docs/integrations.md +6 -1
  7. package/lib/manager.js +127 -1
  8. package/package.json +2 -1
  9. package/server/db/database.js +68 -0
  10. package/server/http/middleware.js +50 -0
  11. package/server/http/routes.js +3 -1
  12. package/server/index.js +1 -0
  13. package/server/public/.last_build_id +1 -1
  14. package/server/public/assets/NOTICES +61 -0
  15. package/server/public/assets/fonts/MaterialIcons-Regular.otf +0 -0
  16. package/server/public/flutter_bootstrap.js +1 -1
  17. package/server/public/main.dart.js +61049 -60444
  18. package/server/routes/integrations.js +97 -8
  19. package/server/routes/memory.js +11 -2
  20. package/server/routes/screenHistory.js +46 -0
  21. package/server/routes/triggers.js +81 -0
  22. package/server/services/ai/engine.js +9 -0
  23. package/server/services/ai/models.js +30 -0
  24. package/server/services/ai/providers/githubCopilot.js +97 -0
  25. package/server/services/ai/providers/openaiCodex.js +26 -0
  26. package/server/services/ai/settings.js +20 -0
  27. package/server/services/ai/systemPrompt.js +1 -1
  28. package/server/services/ai/tools.js +150 -11
  29. package/server/services/browser/controller.js +47 -3
  30. package/server/services/desktop/screenRecorder.js +126 -0
  31. package/server/services/integrations/env.js +19 -0
  32. package/server/services/integrations/github/common.js +106 -0
  33. package/server/services/integrations/github/provider.js +499 -0
  34. package/server/services/integrations/github/repos.js +1124 -0
  35. package/server/services/integrations/home_assistant/provider.js +630 -0
  36. package/server/services/integrations/manager.js +63 -7
  37. package/server/services/integrations/oauth_provider.js +13 -6
  38. package/server/services/integrations/provider_config_store.js +76 -0
  39. package/server/services/integrations/registry.js +10 -0
  40. package/server/services/integrations/spotify/provider.js +487 -0
  41. package/server/services/integrations/weather/provider.js +559 -0
  42. package/server/services/integrations/whatsapp/provider.js +6 -2
  43. package/server/services/manager.js +22 -0
  44. package/server/services/memory/manager.js +39 -2
  45. package/server/services/messaging/manager.js +29 -7
  46. package/server/services/skills/base_catalog.js +33 -0
  47. package/server/services/tasks/adapters/index.js +2 -0
  48. package/server/services/tasks/adapters/manual.js +12 -0
  49. package/server/services/tasks/adapters/schedule.js +33 -5
  50. package/server/services/tasks/adapters/weather_event.js +84 -0
  51. package/server/services/tasks/integration_runtime.js +85 -0
  52. package/server/services/tasks/runtime.js +2 -2
  53. package/server/services/voice/agentBridge.js +20 -4
  54. package/server/services/voice/message.js +3 -0
  55. package/server/services/voice/openaiClient.js +4 -1
  56. package/server/services/voice/providers.js +2 -1
  57. package/server/services/voice/runtimeManager.js +136 -1
  58. package/server/services/widgets/service.js +49 -4
  59. package/server/utils/local_secrets.js +56 -0
  60. package/server/utils/logger.js +37 -9
package/.env.example CHANGED
@@ -6,6 +6,10 @@ PORT=3333
6
6
  NODE_ENV=production
7
7
  SESSION_SECRET=change-this-to-a-random-secret-in-production
8
8
 
9
+ # Optional: dedicated key for encrypting local at-rest secrets (for example API_KEYS.json).
10
+ # If unset, encryption falls back to SESSION_SECRET.
11
+ # NEOAGENT_DATA_ENCRYPTION_KEY=
12
+
9
13
  # Public base URL used for OAuth callbacks and external links.
10
14
  # Example: https://agent.example.com
11
15
  PUBLIC_URL=
@@ -139,6 +143,15 @@ FIGMA_OAUTH_CLIENT_ID=your-figma-oauth-client-id
139
143
  FIGMA_OAUTH_CLIENT_SECRET=your-figma-oauth-client-secret
140
144
  FIGMA_OAUTH_REDIRECT_URI=
141
145
 
146
+ # GitHub official integration OAuth client.
147
+ # Redirect URI should match <PUBLIC_URL>/api/integrations/oauth/callback.
148
+ # Prefer least-privilege OAuth scopes for your use case.
149
+ # Read-oriented examples: public_repo (public repositories), repo:status (commit status), read:org (org membership).
150
+ # Avoid broad blanket scopes unless explicitly required by a specific write workflow.
151
+ GITHUB_OAUTH_CLIENT_ID=your-github-oauth-client-id
152
+ GITHUB_OAUTH_CLIENT_SECRET=your-github-oauth-client-secret
153
+ GITHUB_OAUTH_REDIRECT_URI=
154
+
142
155
  ########################################
143
156
  # Tools and media services
144
157
  ########################################
package/README.md CHANGED
@@ -22,6 +22,8 @@
22
22
  ```bash
23
23
  npm install -g neoagent
24
24
  neoagent install
25
+
26
+ neoagent migrate
25
27
  ```
26
28
 
27
29
  ## Manage the Service
@@ -36,7 +38,7 @@ neoagent logs
36
38
 
37
39
  ## Links
38
40
 
39
- [Docs](https://neolabs-systems.github.io/NeoAgent/) | [Issues](https://github.com/NeoLabs-Systems/NeoAgent/issues)
41
+ [Docs](https://neolabs-systems.github.io/NeoAgent/docs/) | [Homepage](https://neolabs-systems.github.io/NeoAgent/) | [Issues](https://github.com/NeoLabs-Systems/NeoAgent/issues)
40
42
 
41
43
  ---
42
44
 
@@ -4,7 +4,7 @@ NeoAgent is built for proactive work: tasks that run later, repeat on a schedule
4
4
 
5
5
  ## Tasks
6
6
 
7
- Use the **Tasks** section in the UI to create scheduled automations. These tasks use Cron expressions for time-based scheduling. A task has:
7
+ Use the **Tasks** section in the UI to create automations. Tasks can be time-based (Cron) or integration-triggered (for example email, messaging, and weather-event triggers). A task has:
8
8
 
9
9
  | Field | Purpose |
10
10
  |---|---|
@@ -75,10 +75,10 @@ The agent tool `read_health_data` returns summaries and recent samples. It is de
75
75
 
76
76
  NeoAgent has two separate integration layers:
77
77
 
78
- - Official integrations expose structured tools for Google Workspace, Microsoft 365, Notion, Slack, Figma, and a separate personal WhatsApp connection.
78
+ - Official integrations expose structured tools for Google Workspace, Microsoft 365, Notion, Slack, Figma, Home Assistant, Weather, Spotify, and a separate personal WhatsApp connection.
79
79
  - Messaging platforms let the agent talk through WhatsApp, Telegram, Discord, Slack, Google Chat, Teams, Matrix, Signal, iMessage/BlueBubbles, IRC, Twitch, LINE, Mattermost, configurable webhook bridges, and Telnyx Voice.
80
80
 
81
- Official integration examples include Gmail thread search and send mail, Google Calendar events, Drive upload/download/export/share links, Docs create/append/replace, Sheets read/update/append/create, Microsoft Outlook/Calendar/OneDrive/Teams tools, Notion search/page/block/database tools, Slack conversation/message tools, Figma file/node/comment/image tools, and a personal WhatsApp integration with isolated chat read/send tools and per-account read-only versus read/write access.
81
+ Official integration examples include Gmail thread search and send mail, Google Calendar events, Drive upload/download/export/share links, Docs create/append/replace, Sheets read/update/append/create, Microsoft Outlook/Calendar/OneDrive/Teams tools, Notion search/page/block/database tools, Slack conversation/message tools, Figma file/node/comment/image tools, Home Assistant entity/config reads and service calls, Weather current/forecast tools plus weather-event task triggers, Spotify playback/search/control tools, and a personal WhatsApp integration with isolated chat read/send tools and per-account read-only versus read/write access.
82
82
 
83
83
  Messaging examples include Telegram and Discord messages, Slack channel replies, Matrix room messages, Google Chat and Teams webhook delivery, Signal bridge delivery, iMessage/BlueBubbles sends, WhatsApp text and media sends, Telnyx inbound voice, Telnyx outbound calls, and scheduled-task call delivery.
84
84
 
@@ -68,7 +68,7 @@ Recording insight generation is controlled in app AI settings with `auto_recordi
68
68
 
69
69
  ## Official Integrations
70
70
 
71
- Official integrations use OAuth or provider-native account linking and expose structured tools to the agent. The built-in registry currently covers Google Workspace, Notion, Microsoft 365, Slack, Figma, and personal WhatsApp.
71
+ Official integrations use OAuth or provider-native account linking and expose structured tools to the agent. The built-in registry currently covers Google Workspace, Notion, Microsoft 365, Slack, Figma, Home Assistant, Weather, Spotify, and personal WhatsApp.
72
72
 
73
73
  All OAuth callbacks default to `PUBLIC_URL + /api/integrations/oauth/callback` unless you set a provider-specific redirect URI.
74
74
 
@@ -90,6 +90,19 @@ All OAuth callbacks default to `PUBLIC_URL + /api/integrations/oauth/callback` u
90
90
  | `FIGMA_OAUTH_CLIENT_ID` | Figma OAuth client ID |
91
91
  | `FIGMA_OAUTH_CLIENT_SECRET` | Figma OAuth client secret |
92
92
  | `FIGMA_OAUTH_REDIRECT_URI` | Optional Figma OAuth callback URL |
93
+ | `HOME_ASSISTANT_BASE_URL` | Optional fallback Home Assistant base URL. Users can configure this per account in Official Integrations. |
94
+ | `HOME_ASSISTANT_OAUTH_CLIENT_ID` | Optional fallback Home Assistant OAuth client ID. |
95
+ | `HOME_ASSISTANT_OAUTH_CLIENT_SECRET` | Optional fallback Home Assistant OAuth client secret. |
96
+ | `HOME_ASSISTANT_OAUTH_REDIRECT_URI` | Optional fallback Home Assistant OAuth callback URL. |
97
+ | `HOME_ASSISTANT_ALLOW_PRIVATE_BASE_URL` | Optional safety override. Set to `1` only if you intentionally allow Home Assistant base URLs on localhost/private networks. |
98
+ | `SPOTIFY_OAUTH_CLIENT_ID` | Spotify OAuth client ID |
99
+ | `SPOTIFY_OAUTH_CLIENT_SECRET` | Spotify OAuth client secret |
100
+ | `SPOTIFY_OAUTH_REDIRECT_URI` | Optional Spotify OAuth callback URL |
101
+
102
+ Home Assistant no longer requires server-side setup. Each user can open Official Integrations, select Home Assistant, and enter their own base URL and OAuth app credentials.
103
+ For safety, local/private Home Assistant targets are blocked by default unless `HOME_ASSISTANT_ALLOW_PRIVATE_BASE_URL=1` is set on the server.
104
+
105
+ Weather integration uses Open-Meteo public endpoints and does not require OAuth environment variables.
93
106
 
94
107
  ## Messaging
95
108
 
@@ -13,8 +13,13 @@ The built-in registry includes:
13
13
  | Microsoft 365 | Outlook, Calendar, OneDrive, Teams, and Microsoft Graph requests |
14
14
  | Slack | Conversations, history, posting, search, user info, and Slack Web API requests |
15
15
  | Figma | Current user, files, nodes, rendered images, comments, and Figma REST requests |
16
+ | Home Assistant | Entity/config reads, service calls, and Home Assistant REST API requests |
17
+ | Weather | Keyless Open-Meteo current weather and forecast tools |
18
+ | Spotify | Playback state, recently played, search, and playback controls |
16
19
 
17
- OAuth app credentials are configured through server environment variables. Account connections are created in the Flutter UI under **Integrations**. Connected tools are exposed to the agent as structured tools, so prefer them over browser automation when they can do the job.
20
+ OAuth app credentials are configured through server environment variables for most providers. Home Assistant can also be configured per-user in the Flutter **Integrations** UI without any server-side setup. Account connections are created in the Flutter UI under **Integrations**. Connected tools are exposed to the agent as structured tools, so prefer them over browser automation when they can do the job.
21
+
22
+ Weather note: the Weather integration uses Open-Meteo public APIs and does not require OAuth client credentials.
18
23
 
19
24
  ### Per-Account Access Mode
20
25
 
package/lib/manager.js CHANGED
@@ -674,6 +674,128 @@ async function cmdMigrate(args = []) {
674
674
  });
675
675
  }
676
676
 
677
+ async function cmdLogin(args = []) {
678
+ const provider = args[0];
679
+ if (provider !== 'github-copilot' && provider !== 'openai-codex') {
680
+ throw new Error(`Unsupported login provider: ${provider || 'none'}. Available: github-copilot, openai-codex`);
681
+ }
682
+
683
+ if (provider === 'github-copilot') {
684
+ heading('GitHub Copilot Login');
685
+ const clientId = '01ab8ac9400c4e429b23';
686
+ logInfo('Requesting device code from GitHub...');
687
+
688
+ const reqRes = await fetch('https://github.com/login/device/code', {
689
+ method: 'POST',
690
+ headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
691
+ body: JSON.stringify({ client_id: clientId, scope: 'user:email' })
692
+ });
693
+
694
+ if (!reqRes.ok) {
695
+ throw new Error(`Failed to request device code: HTTP ${reqRes.status}`);
696
+ }
697
+
698
+ const { device_code, user_code, verification_uri, interval } = await reqRes.json();
699
+
700
+ console.log(`\n ${COLORS.cyan}Please visit:${COLORS.reset} ${verification_uri}`);
701
+ console.log(` ${COLORS.cyan}And enter the code:${COLORS.reset} ${COLORS.bold}${user_code}${COLORS.reset}\n`);
702
+
703
+ logInfo('Waiting for authorization (timeout in 15m)...');
704
+ const startTime = Date.now();
705
+ const timeoutMs = 15 * 60 * 1000;
706
+ let currentPollInterval = (interval || 5) * 1000;
707
+
708
+ while (Date.now() - startTime < timeoutMs) {
709
+ await new Promise((r) => setTimeout(r, currentPollInterval));
710
+ const tokenRes = await fetch('https://github.com/login/oauth/access_token', {
711
+ method: 'POST',
712
+ headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
713
+ body: JSON.stringify({
714
+ client_id: clientId,
715
+ device_code,
716
+ grant_type: 'urn:ietf:params:oauth:grant-type:device_code'
717
+ })
718
+ });
719
+
720
+ if (!tokenRes.ok) {
721
+ const errorText = await tokenRes.text().catch(() => 'Unknown error');
722
+ throw new Error(`GitHub token request failed: HTTP ${tokenRes.status} - ${errorText}`);
723
+ }
724
+
725
+ const data = await tokenRes.json();
726
+ if (data.access_token) {
727
+ upsertEnvValue('GITHUB_COPILOT_ACCESS_TOKEN', data.access_token);
728
+ logOk('Successfully authenticated and saved GitHub Copilot access token to .env');
729
+ return;
730
+ } else if (data.error === 'authorization_pending') {
731
+ // Continue polling
732
+ } else if (data.error === 'slow_down') {
733
+ currentPollInterval += 5000;
734
+ } else if (data.error) {
735
+ throw new Error(`Authentication failed: ${data.error_description || data.error}`);
736
+ }
737
+ }
738
+ throw new Error('GitHub authentication timed out after 15 minutes.');
739
+ } else if (provider === 'openai-codex') {
740
+ heading('OpenAI Codex Login');
741
+ const clientId = 'app_EMoamEEZ73f0CkXaXp7hrann';
742
+ logInfo('Requesting device code from OpenAI...');
743
+
744
+ const reqRes = await fetch('https://auth.openai.com/api/accounts/deviceauth/usercode', {
745
+ method: 'POST',
746
+ headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
747
+ body: JSON.stringify({ client_id: clientId, scope: 'openid profile email offline_access model.request model.read model.create' })
748
+ });
749
+
750
+ if (!reqRes.ok) {
751
+ throw new Error(`Failed to request device code: HTTP ${reqRes.status}`);
752
+ }
753
+
754
+ const { device_code, user_code, verification_uri, interval } = await reqRes.json();
755
+
756
+ console.log(`\n ${COLORS.cyan}Please visit:${COLORS.reset} ${verification_uri}`);
757
+ console.log(` ${COLORS.cyan}And enter the code:${COLORS.reset} ${COLORS.bold}${user_code}${COLORS.reset}\n`);
758
+
759
+ logInfo('Waiting for authorization (timeout in 15m)...');
760
+ const startTime = Date.now();
761
+ const timeoutMs = 15 * 60 * 1000;
762
+ let currentPollInterval = (interval || 5) * 1000;
763
+
764
+ while (Date.now() - startTime < timeoutMs) {
765
+ await new Promise((r) => setTimeout(r, currentPollInterval));
766
+ const tokenRes = await fetch('https://auth.openai.com/api/accounts/deviceauth/token', {
767
+ method: 'POST',
768
+ headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
769
+ body: JSON.stringify({
770
+ client_id: clientId,
771
+ device_code,
772
+ grant_type: 'urn:ietf:params:oauth:grant-type:device_code'
773
+ })
774
+ });
775
+
776
+ if (!tokenRes.ok) {
777
+ const errorText = await tokenRes.text().catch(() => 'Unknown error');
778
+ throw new Error(`OpenAI token request failed: HTTP ${tokenRes.status} - ${errorText}`);
779
+ }
780
+
781
+ const data = await tokenRes.json();
782
+ if (data.access_token) {
783
+ upsertEnvValue('OPENAI_CODEX_ACCESS_TOKEN', data.access_token);
784
+ logOk('Successfully authenticated and saved OpenAI Codex access token to .env');
785
+ return;
786
+ } else if (data.error === 'authorization_pending') {
787
+ // Continue polling
788
+ } else if (data.error === 'slow_down') {
789
+ currentPollInterval += 5000;
790
+ } else if (data.error) {
791
+ throw new Error(`Authentication failed: ${data.error_description || data.error}`);
792
+ }
793
+ }
794
+ throw new Error('OpenAI authentication timed out after 15 minutes.');
795
+ }
796
+ }
797
+ }
798
+
677
799
  function installDependencies() {
678
800
  heading('Dependencies');
679
801
  runOrThrow('npm', ['install', '--omit=dev', '--no-audit', '--no-fund'], {
@@ -1062,7 +1184,8 @@ async function cmdEnv(args = []) {
1062
1184
  function printHelp() {
1063
1185
  console.log(`${APP_NAME} manager`);
1064
1186
  console.log('Usage: neoagent <command>');
1065
- console.log('Commands: install | setup | env | channel | update | restart | start | stop | status | logs | uninstall | migrate');
1187
+ console.log('Commands: install | setup | env | channel | update | restart | start | stop | status | logs | uninstall | migrate | login');
1188
+ console.log('Login usage: neoagent login github-copilot | neoagent login openai-codex');
1066
1189
  console.log('Channel usage: neoagent channel | neoagent channel stable | neoagent channel beta');
1067
1190
  console.log('Update usage: neoagent update | neoagent update stable | neoagent update beta');
1068
1191
  console.log('Env usage: neoagent env list | neoagent env get PORT | neoagent env set PORT 3333 | neoagent env unset PORT');
@@ -1112,6 +1235,9 @@ async function runCLI(argv) {
1112
1235
  case 'migrate':
1113
1236
  await cmdMigrate(argv.slice(1));
1114
1237
  break;
1238
+ case 'login':
1239
+ await cmdLogin(argv.slice(1));
1240
+ break;
1115
1241
  case 'help':
1116
1242
  case '--help':
1117
1243
  case '-h':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neoagent",
3
- "version": "2.3.0",
3
+ "version": "2.3.1-beta.10",
4
4
  "description": "Proactive personal AI agent with no limits",
5
5
  "license": "MIT",
6
6
  "main": "server/index.js",
@@ -80,6 +80,7 @@
80
80
  "socket.io": "^4.8.1",
81
81
  "telegraf": "^4.16.3",
82
82
  "telnyx": "^5.51.0",
83
+ "tesseract.js": "^7.0.0",
83
84
  "uuid": "^11.1.0",
84
85
  "ws": "^8.19.0"
85
86
  },
@@ -272,6 +272,17 @@ db.exec(`
272
272
  FOREIGN KEY (agent_id) REFERENCES agents(id) ON DELETE SET NULL
273
273
  );
274
274
 
275
+ CREATE TABLE IF NOT EXISTS integration_provider_configs (
276
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
277
+ user_id INTEGER NOT NULL,
278
+ provider_key TEXT NOT NULL,
279
+ config_json TEXT DEFAULT '{}',
280
+ created_at TEXT DEFAULT (datetime('now')),
281
+ updated_at TEXT DEFAULT (datetime('now')),
282
+ FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
283
+ UNIQUE(user_id, provider_key)
284
+ );
285
+
275
286
  CREATE TABLE IF NOT EXISTS browser_extension_pairing_requests (
276
287
  id TEXT PRIMARY KEY,
277
288
  user_id INTEGER,
@@ -651,6 +662,40 @@ db.exec(`
651
662
  CREATE INDEX IF NOT EXISTS idx_recording_chunks_source ON recording_chunks(source_id, sequence_index);
652
663
  CREATE INDEX IF NOT EXISTS idx_recording_segments_session ON recording_transcript_segments(session_id, start_ms, created_at);
653
664
 
665
+ CREATE TABLE IF NOT EXISTS screen_history (
666
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
667
+ user_id INTEGER NOT NULL,
668
+ timestamp TEXT DEFAULT (datetime('now')),
669
+ app_name TEXT,
670
+ text_content TEXT,
671
+ FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
672
+ );
673
+
674
+ CREATE TABLE IF NOT EXISTS notification_history (
675
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
676
+ user_id INTEGER NOT NULL,
677
+ app_package TEXT,
678
+ title TEXT,
679
+ body TEXT,
680
+ timestamp TEXT DEFAULT (datetime('now')),
681
+ action_taken TEXT,
682
+ FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
683
+ );
684
+
685
+ CREATE TABLE IF NOT EXISTS geofences (
686
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
687
+ user_id INTEGER NOT NULL,
688
+ label TEXT,
689
+ latitude REAL NOT NULL,
690
+ longitude REAL NOT NULL,
691
+ radius_meters INTEGER NOT NULL,
692
+ trigger_action TEXT,
693
+ FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
694
+ );
695
+
696
+ CREATE INDEX IF NOT EXISTS idx_screen_history_user ON screen_history(user_id, timestamp DESC);
697
+ CREATE INDEX IF NOT EXISTS idx_notification_history_user ON notification_history(user_id, timestamp DESC);
698
+
654
699
  CREATE TABLE IF NOT EXISTS artifacts (
655
700
  id TEXT PRIMARY KEY,
656
701
  user_id INTEGER NOT NULL,
@@ -676,6 +721,29 @@ db.exec(`
676
721
 
677
722
  try {
678
723
  db.exec(`
724
+ CREATE VIRTUAL TABLE IF NOT EXISTS screen_history_fts USING fts5(
725
+ text_content,
726
+ app_name,
727
+ timestamp UNINDEXED,
728
+ user_id UNINDEXED,
729
+ tokenize = 'porter unicode61'
730
+ );
731
+
732
+ CREATE TRIGGER IF NOT EXISTS screen_history_fts_ai AFTER INSERT ON screen_history BEGIN
733
+ INSERT INTO screen_history_fts(rowid, text_content, app_name, timestamp, user_id)
734
+ VALUES (new.id, COALESCE(new.text_content, ''), COALESCE(new.app_name, ''), new.timestamp, new.user_id);
735
+ END;
736
+
737
+ CREATE TRIGGER IF NOT EXISTS screen_history_fts_ad AFTER DELETE ON screen_history BEGIN
738
+ DELETE FROM screen_history_fts WHERE rowid = old.id;
739
+ END;
740
+
741
+ CREATE TRIGGER IF NOT EXISTS screen_history_fts_au AFTER UPDATE ON screen_history BEGIN
742
+ DELETE FROM screen_history_fts WHERE rowid = old.id;
743
+ INSERT INTO screen_history_fts(rowid, text_content, app_name, timestamp, user_id)
744
+ VALUES (new.id, COALESCE(new.text_content, ''), COALESCE(new.app_name, ''), new.timestamp, new.user_id);
745
+ END;
746
+
679
747
  CREATE VIRTUAL TABLE IF NOT EXISTS conversation_history_fts USING fts5(
680
748
  content,
681
749
  role UNINDEXED,
@@ -88,7 +88,18 @@ function buildHelmetOptions({ secureCookies }) {
88
88
  return {
89
89
  strictTransportSecurity: false,
90
90
  crossOriginOpenerPolicy: false,
91
+ crossOriginResourcePolicy: { policy: 'same-site' },
91
92
  originAgentCluster: false,
93
+ referrerPolicy: { policy: 'strict-origin-when-cross-origin' },
94
+ permissionsPolicy: {
95
+ features: {
96
+ camera: ['self'],
97
+ geolocation: ['self'],
98
+ microphone: ['self'],
99
+ payment: [],
100
+ usb: [],
101
+ },
102
+ },
92
103
  contentSecurityPolicy: {
93
104
  directives: {
94
105
  defaultSrc: ["'self'"],
@@ -154,6 +165,16 @@ function applyHttpMiddleware(app, { secureCookies, trustProxy, sessionMiddleware
154
165
  const path = `${value}`.split('?')[0];
155
166
  return path === '/socket.io/' || path === '/socket.io' || path.startsWith('/socket.io/');
156
167
  };
168
+ const isStateChangingMethod = (method = '') => ['POST', 'PUT', 'PATCH', 'DELETE'].includes(String(method).toUpperCase());
169
+ const extractOriginFromReferer = (referer = '') => {
170
+ const value = String(referer || '').trim();
171
+ if (!value) return '';
172
+ try {
173
+ return new URL(value).origin;
174
+ } catch {
175
+ return '';
176
+ }
177
+ };
157
178
  const requestPath = (req) => req.originalUrl || req.url || req.path || '';
158
179
  const applyOnlyToRecordingChunk = (handler) => (req, res, next) => (
159
180
  isRecordingChunkPath(requestPath(req)) ? handler(req, res, next) : next()
@@ -187,6 +208,35 @@ function applyHttpMiddleware(app, { secureCookies, trustProxy, sessionMiddleware
187
208
  });
188
209
  })
189
210
  );
211
+ app.use((req, res, next) => {
212
+ const path = `${req.originalUrl || req.url || req.path || ''}`.split('?')[0];
213
+ if (path.startsWith('/api/')) {
214
+ res.setHeader('Cache-Control', 'no-store, max-age=0');
215
+ res.setHeader('Pragma', 'no-cache');
216
+ res.setHeader('Expires', '0');
217
+ }
218
+ next();
219
+ });
220
+ app.use((req, res, next) => {
221
+ const path = `${req.originalUrl || req.url || req.path || ''}`.split('?')[0];
222
+ if (!path.startsWith('/api/')) return next();
223
+ if (!isStateChangingMethod(req.method)) return next();
224
+
225
+ const origin = String(req.get('origin') || '').trim() || extractOriginFromReferer(req.get('referer'));
226
+ if (!origin) return next();
227
+
228
+ const allowBrowserExtensionOrigin = isBrowserExtensionCorsPath(path);
229
+ return validateOrigin(origin, (error) => {
230
+ if (error) {
231
+ logRequestSummary('warn', req, 'blocked state-changing request due to invalid origin', { origin });
232
+ return res.status(403).json({ error: 'Origin not allowed' });
233
+ }
234
+ return next();
235
+ }, {
236
+ allowChromeExtension: allowBrowserExtensionOrigin,
237
+ allowMissingOrigin: false,
238
+ });
239
+ });
190
240
  app.use((req, res, next) => {
191
241
  const startedAt = Date.now();
192
242
 
@@ -26,7 +26,9 @@ const routeRegistry = [
26
26
  { basePath: '/api/desktop', modulePath: '../routes/desktop' },
27
27
  { basePath: '/api/recordings', modulePath: '../routes/recordings' },
28
28
  { basePath: '/api/voice-assistant', modulePath: '../routes/voice_assistant' },
29
- { basePath: '/api/mobile/health', modulePath: '../routes/mobile-health' }
29
+ { basePath: '/api/mobile/health', modulePath: '../routes/mobile-health' },
30
+ { basePath: '/api/screen-history', modulePath: '../routes/screenHistory' },
31
+ { basePath: '/api/triggers', modulePath: '../routes/triggers' }
30
32
  ];
31
33
 
32
34
  function registerApiRoutes(app) {
package/server/index.js CHANGED
@@ -97,6 +97,7 @@ if (!configuredSessionSecret()) {
97
97
  }
98
98
 
99
99
  const app = express();
100
+ app.disable('x-powered-by');
100
101
  const httpServer = createServer(app);
101
102
  const io = createSocketServer(httpServer, { validateOrigin });
102
103
  app.locals.httpRuntimeConfig = {
@@ -1 +1 @@
1
- dc2ac3821de37958afef0c20433c5630
1
+ 6a766d17dbfd039c552814519add74f6
@@ -5535,6 +5535,19 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5535
5535
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
5536
5536
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5537
5537
  --------------------------------------------------------------------------------
5538
+ flutter_background_service
5539
+ flutter_background_service_android
5540
+ flutter_background_service_ios
5541
+ flutter_background_service_platform_interface
5542
+
5543
+ Copyright 2022 Eka Setiawan Saputra
5544
+
5545
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5546
+
5547
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5548
+
5549
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5550
+ --------------------------------------------------------------------------------
5538
5551
  flutter_lints
5539
5552
  flutter_markdown
5540
5553
  path_provider
@@ -7093,6 +7106,35 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7093
7106
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
7094
7107
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7095
7108
  --------------------------------------------------------------------------------
7109
+ geolocator
7110
+ geolocator_android
7111
+ geolocator_apple
7112
+ geolocator_platform_interface
7113
+ geolocator_web
7114
+ geolocator_windows
7115
+
7116
+ MIT License
7117
+
7118
+ Copyright (c) 2018 Baseflow
7119
+
7120
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7121
+ of this software and associated documentation files (the "Software"), to deal
7122
+ in the Software without restriction, including without limitation the rights
7123
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7124
+ copies of the Software, and to permit persons to whom the Software is
7125
+ furnished to do so, subject to the following conditions:
7126
+
7127
+ The above copyright notice and this permission notice shall be included in all
7128
+ copies or substantial portions of the Software.
7129
+
7130
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7131
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7132
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7133
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
7134
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
7135
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
7136
+ SOFTWARE.
7137
+ --------------------------------------------------------------------------------
7096
7138
  glfw
7097
7139
 
7098
7140
 
@@ -24797,6 +24839,25 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24797
24839
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24798
24840
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24799
24841
  --------------------------------------------------------------------------------
24842
+ notification_listener_service
24843
+
24844
+ Copyright (c) 2022 Iheb Briki
24845
+ Permission is hereby granted, free of charge, to any person obtaining a copy
24846
+ of this software and associated documentation files (the "Software"), to deal
24847
+ in the Software without restriction, including without limitation the rights
24848
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24849
+ copies of the Software, and to permit persons to whom the Software is
24850
+ furnished to do so, subject to the following conditions:
24851
+ The above copyright notice and this permission notice shall be included in all
24852
+ copies or substantial portions of the Software.
24853
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24854
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24855
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24856
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24857
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24858
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24859
+ SOFTWARE.
24860
+ --------------------------------------------------------------------------------
24800
24861
  perfetto
24801
24862
 
24802
24863
  Apache License
@@ -37,6 +37,6 @@ _flutter.buildConfig = {"engineRevision":"59aa584fdf100e6c78c785d8a5b565d1de4b48
37
37
 
38
38
  _flutter.loader.load({
39
39
  serviceWorkerSettings: {
40
- serviceWorkerVersion: "282358507" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
40
+ serviceWorkerVersion: "2234309269" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
41
41
  }
42
42
  });