lsh-framework 3.1.2 → 3.1.4

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.
@@ -109,6 +109,13 @@ export const DEFAULTS = {
109
109
  // Cache and retention
110
110
  REDIS_CACHE_EXPIRY_SECONDS: 3600, // 1 hour
111
111
  METRICS_RETENTION_SECONDS: 30 * 24 * 60 * 60, // 30 days
112
+ // Cloud sync intervals
113
+ CLOUD_CONFIG_SYNC_INTERVAL_MS: 60000, // 1 minute
114
+ HISTORY_SYNC_INTERVAL_MS: 30000, // 30 seconds
115
+ // Job registry
116
+ MAX_RECORDS_PER_JOB: 1000,
117
+ MAX_TOTAL_RECORDS: 50000,
118
+ METRICS_RETENTION_DAYS: 90,
112
119
  // Shell defaults
113
120
  DEFAULT_SHELL_UNIX: '/bin/sh',
114
121
  DEFAULT_SHELL_WIN: 'cmd.exe',
@@ -39,4 +39,13 @@ export const TABLES = {
39
39
  TRADING_DISCLOSURES: 'trading_disclosures',
40
40
  POLITICIANS: 'politicians',
41
41
  DATA_PULL_JOBS: 'data_pull_jobs',
42
+ // ML tables
43
+ ML_TRAINING_JOBS: 'ml_training_jobs',
44
+ ML_MODELS: 'ml_models',
45
+ ML_FEATURES: 'ml_features',
46
+ // Views (read-only aggregations)
47
+ ORGANIZATION_MEMBERS_DETAILED: 'organization_members_detailed',
48
+ ORGANIZATION_USAGE_SUMMARY: 'organization_usage_summary',
49
+ TEAM_MEMBERS_DETAILED: 'team_members_detailed',
50
+ SECRETS_SUMMARY: 'secrets_summary',
42
51
  };
@@ -11,7 +11,7 @@ import * as os from 'os';
11
11
  import { exec } from 'child_process';
12
12
  import { BaseJobManager } from '../lib/base-job-manager.js';
13
13
  import MemoryJobStorage from '../lib/job-storage-memory.js';
14
- import { ENV_VARS } from '../constants/index.js';
14
+ import { ENV_VARS, DEFAULTS, PATHS } from '../constants/index.js';
15
15
  export class JobRegistry extends BaseJobManager {
16
16
  config;
17
17
  records = new Map(); // jobId -> execution records
@@ -20,12 +20,12 @@ export class JobRegistry extends BaseJobManager {
20
20
  constructor(config) {
21
21
  super(new MemoryJobStorage(), 'JobRegistry');
22
22
  this.config = {
23
- registryFile: '/tmp/lsh-job-registry.json',
24
- maxRecordsPerJob: 1000,
25
- maxTotalRecords: 50000,
23
+ registryFile: PATHS.JOB_REGISTRY_FILE,
24
+ maxRecordsPerJob: DEFAULTS.MAX_RECORDS_PER_JOB,
25
+ maxTotalRecords: DEFAULTS.MAX_TOTAL_RECORDS,
26
26
  compressionEnabled: true,
27
- metricsRetentionDays: 90,
28
- outputLogDir: '/tmp/lsh-job-logs',
27
+ metricsRetentionDays: DEFAULTS.METRICS_RETENTION_DAYS,
28
+ outputLogDir: PATHS.JOB_LOGS_DIR,
29
29
  indexingEnabled: true,
30
30
  ...config
31
31
  };
@@ -6,6 +6,7 @@ import DatabasePersistence from './database-persistence.js';
6
6
  import * as fs from 'fs';
7
7
  import * as path from 'path';
8
8
  import * as os from 'os';
9
+ import { DEFAULTS } from '../constants/index.js';
9
10
  export class CloudConfigManager {
10
11
  databasePersistence;
11
12
  options;
@@ -17,7 +18,7 @@ export class CloudConfigManager {
17
18
  userId: undefined,
18
19
  enableCloudSync: true,
19
20
  localConfigPath: path.join(os.homedir(), '.lshrc'),
20
- syncInterval: 60000, // 1 minute
21
+ syncInterval: DEFAULTS.CLOUD_CONFIG_SYNC_INTERVAL_MS,
21
22
  ...options,
22
23
  };
23
24
  this.databasePersistence = new DatabasePersistence(this.options.userId);
@@ -8,6 +8,7 @@ import { BaseJobManager, } from './base-job-manager.js';
8
8
  import DatabaseJobStorage from './job-storage-database.js';
9
9
  import DaemonClient from './daemon-client.js';
10
10
  import DatabasePersistence from './database-persistence.js';
11
+ import { DEFAULTS } from '../constants/index.js';
11
12
  export class CronJobManager extends BaseJobManager {
12
13
  daemonClient;
13
14
  databasePersistence;
@@ -36,7 +37,7 @@ export class CronJobManager extends BaseJobManager {
36
37
  workingDirectory: '/backups',
37
38
  priority: 8,
38
39
  maxRetries: 3,
39
- timeout: 3600000, // 1 hour
40
+ timeout: DEFAULTS.JOB_TIMEOUT_1H_MS,
40
41
  },
41
42
  {
42
43
  id: 'log-cleanup',
@@ -48,7 +49,7 @@ export class CronJobManager extends BaseJobManager {
48
49
  tags: ['logs', 'cleanup', 'weekly'],
49
50
  priority: 3,
50
51
  maxRetries: 2,
51
- timeout: 300000, // 5 minutes
52
+ timeout: DEFAULTS.JOB_TIMEOUT_5M_MS,
52
53
  },
53
54
  {
54
55
  id: 'disk-monitor',
@@ -60,7 +61,7 @@ export class CronJobManager extends BaseJobManager {
60
61
  tags: ['monitoring', 'disk', 'alert'],
61
62
  priority: 7,
62
63
  maxRetries: 1,
63
- timeout: 60000, // 1 minute
64
+ timeout: DEFAULTS.JOB_TIMEOUT_1M_MS,
64
65
  },
65
66
  {
66
67
  id: 'data-sync',
@@ -73,7 +74,7 @@ export class CronJobManager extends BaseJobManager {
73
74
  workingDirectory: '/data',
74
75
  priority: 6,
75
76
  maxRetries: 5,
76
- timeout: 7200000, // 2 hours
77
+ timeout: DEFAULTS.JOB_TIMEOUT_2H_MS,
77
78
  },
78
79
  ];
79
80
  templates.forEach(template => {
@@ -8,7 +8,7 @@ import { EventEmitter } from 'events';
8
8
  import DatabasePersistence from './database-persistence.js';
9
9
  import { createLogger } from './logger.js';
10
10
  import { getPlatformPaths } from './platform-utils.js';
11
- import { ENV_VARS } from '../constants/index.js';
11
+ import { ENV_VARS, DEFAULTS } from '../constants/index.js';
12
12
  export class DaemonClient extends EventEmitter {
13
13
  socketPath;
14
14
  socket;
@@ -67,7 +67,7 @@ export class DaemonClient extends EventEmitter {
67
67
  resolve(true);
68
68
  });
69
69
  let buffer = '';
70
- const MAX_BUFFER_SIZE = 1024 * 1024; // 1MB limit
70
+ const MAX_BUFFER_SIZE = DEFAULTS.MAX_BUFFER_SIZE_BYTES;
71
71
  this.socket.on('data', (data) => {
72
72
  try {
73
73
  buffer += data.toString();
@@ -6,6 +6,7 @@ import HistorySystem from './history-system.js';
6
6
  import DatabasePersistence from './database-persistence.js';
7
7
  import * as os from 'os';
8
8
  import * as path from 'path';
9
+ import { DEFAULTS } from '../constants/index.js';
9
10
  export class EnhancedHistorySystem extends HistorySystem {
10
11
  databasePersistence;
11
12
  enhancedConfig;
@@ -13,7 +14,7 @@ export class EnhancedHistorySystem extends HistorySystem {
13
14
  pendingSync = false;
14
15
  constructor(config = {}) {
15
16
  const defaultConfig = {
16
- maxSize: 10000,
17
+ maxSize: DEFAULTS.MAX_HISTORY_SIZE,
17
18
  filePath: path.join(os.homedir(), '.lsh_history'),
18
19
  shareHistory: true,
19
20
  ignoreDups: true,
@@ -21,7 +22,7 @@ export class EnhancedHistorySystem extends HistorySystem {
21
22
  expireDuplicatesFirst: true,
22
23
  enableCloudSync: true,
23
24
  userId: undefined,
24
- syncInterval: 30000, // 30 seconds
25
+ syncInterval: DEFAULTS.HISTORY_SYNC_INTERVAL_MS,
25
26
  ...config,
26
27
  };
27
28
  super(defaultConfig);
@@ -5,6 +5,7 @@
5
5
  import * as fs from 'fs';
6
6
  import * as path from 'path';
7
7
  import * as os from 'os';
8
+ import { DEFAULTS } from '../constants/index.js';
8
9
  export class HistorySystem {
9
10
  entries = [];
10
11
  currentIndex = -1;
@@ -12,7 +13,7 @@ export class HistorySystem {
12
13
  isEnabled = true;
13
14
  constructor(config) {
14
15
  this.config = {
15
- maxSize: 10000,
16
+ maxSize: DEFAULTS.MAX_HISTORY_SIZE,
16
17
  filePath: path.join(os.homedir(), '.lsh_history'),
17
18
  shareHistory: false,
18
19
  ignoreDups: true,
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { getSupabaseClient } from './supabase-client.js';
6
6
  import { auditLogger } from './saas-audit.js';
7
+ import { TABLES } from '../constants/index.js';
7
8
  /**
8
9
  * Generate URL-friendly slug from name
9
10
  */
@@ -232,7 +233,7 @@ export class OrganizationService {
232
233
  */
233
234
  async getOrganizationMembers(organizationId) {
234
235
  const { data, error } = await this.supabase
235
- .from('organization_members_detailed')
236
+ .from(TABLES.ORGANIZATION_MEMBERS_DETAILED)
236
237
  .select('*')
237
238
  .eq('organization_id', organizationId);
238
239
  if (error) {
@@ -270,7 +271,7 @@ export class OrganizationService {
270
271
  */
271
272
  async getUsageSummary(organizationId) {
272
273
  const { data, error } = await this.supabase
273
- .from('organization_usage_summary')
274
+ .from(TABLES.ORGANIZATION_USAGE_SUMMARY)
274
275
  .select('*')
275
276
  .eq('organization_id', organizationId)
276
277
  .single();
@@ -550,7 +551,7 @@ export class TeamService {
550
551
  */
551
552
  async getTeamMembers(teamId) {
552
553
  const { data, error } = await this.supabase
553
- .from('team_members_detailed')
554
+ .from(TABLES.TEAM_MEMBERS_DETAILED)
554
555
  .select('*')
555
556
  .eq('team_id', teamId);
556
557
  if (error) {
@@ -7,6 +7,7 @@ import { getSupabaseClient } from './supabase-client.js';
7
7
  import { encryptionService } from './saas-encryption.js';
8
8
  import { auditLogger } from './saas-audit.js';
9
9
  import { organizationService } from './saas-organizations.js';
10
+ import { TABLES } from '../constants/index.js';
10
11
  /**
11
12
  * Secrets Service
12
13
  */
@@ -211,7 +212,7 @@ export class SecretsService {
211
212
  */
212
213
  async getSecretsSummary(teamId) {
213
214
  const { data, error } = await this.supabase
214
- .from('secrets_summary')
215
+ .from(TABLES.SECRETS_SUMMARY)
215
216
  .select('*')
216
217
  .eq('team_id', teamId);
217
218
  if (error) {
@@ -7,6 +7,7 @@ import { supabaseClient } from '../../lib/supabase-client.js';
7
7
  import DatabasePersistence from '../../lib/database-persistence.js';
8
8
  import CloudConfigManager from '../../lib/cloud-config-manager.js';
9
9
  import { CREATE_TABLES_SQL } from '../../lib/database-schema.js';
10
+ import { TABLES } from '../../constants/index.js';
10
11
  export class SupabaseCommandRegistrar extends BaseCommandRegistrar {
11
12
  constructor() {
12
13
  super('SupabaseService');
@@ -259,7 +260,7 @@ export class SupabaseCommandRegistrar extends BaseCommandRegistrar {
259
260
  const opts = options;
260
261
  if (opts.list) {
261
262
  let query = supabaseClient.getClient()
262
- .from('ml_training_jobs')
263
+ .from(TABLES.ML_TRAINING_JOBS)
263
264
  .select('*')
264
265
  .order('created_at', { ascending: false });
265
266
  if (opts.status) {
@@ -315,7 +316,7 @@ export class SupabaseCommandRegistrar extends BaseCommandRegistrar {
315
316
  const opts = options;
316
317
  if (opts.list) {
317
318
  let query = supabaseClient.getClient()
318
- .from('ml_models')
319
+ .from(TABLES.ML_MODELS)
319
320
  .select('*')
320
321
  .order('created_at', { ascending: false });
321
322
  if (opts.deployed) {
@@ -351,7 +352,7 @@ export class SupabaseCommandRegistrar extends BaseCommandRegistrar {
351
352
  const opts = options;
352
353
  if (opts.list) {
353
354
  const { data: features, error } = await supabaseClient.getClient()
354
- .from('ml_features')
355
+ .from(TABLES.ML_FEATURES)
355
356
  .select('*')
356
357
  .order('created_at', { ascending: false })
357
358
  .limit(20);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lsh-framework",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "Simple, cross-platform encrypted secrets manager with automatic sync, IPFS audit logs, and multi-environment support. Just run lsh sync and start managing your secrets.",
5
5
  "main": "dist/app.js",
6
6
  "bin": {
@@ -67,21 +67,21 @@
67
67
  "@supabase/supabase-js": "^2.57.4",
68
68
  "bcrypt": "^5.1.1",
69
69
  "chalk": "^5.3.0",
70
- "chokidar": "^3.6.0",
71
- "commander": "^10.0.1",
70
+ "chokidar": "^5.0.0",
71
+ "commander": "^14.0.2",
72
72
  "cors": "^2.8.5",
73
- "dotenv": "^16.4.5",
73
+ "dotenv": "^17.2.3",
74
74
  "express": "^4.18.2",
75
- "express-rate-limit": "^7.5.1",
76
- "glob": "^10.3.12",
75
+ "express-rate-limit": "^8.2.1",
76
+ "glob": "^13.0.0",
77
77
  "inquirer": "^9.2.12",
78
78
  "js-yaml": "^4.1.0",
79
79
  "jsonwebtoken": "^9.0.2",
80
- "node-cron": "^3.0.3",
81
- "ora": "^8.0.1",
80
+ "node-cron": "^4.2.1",
81
+ "ora": "^9.0.0",
82
82
  "pg": "^8.16.3",
83
83
  "smol-toml": "^1.3.1",
84
- "uuid": "^10.0.0"
84
+ "uuid": "^13.0.0"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@types/bcrypt": "^5.0.2",