@agenticmail/enterprise 0.5.300 → 0.5.302

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 (46) hide show
  1. package/dist/chunk-QKQWDX6M.js +1519 -0
  2. package/dist/chunk-VLVRDLYO.js +48 -0
  3. package/dist/chunk-VMVOJFCX.js +4338 -0
  4. package/dist/cli-agent-4GZGC6XO.js +1778 -0
  5. package/dist/cli-recover-WS27YEB7.js +487 -0
  6. package/dist/cli-serve-HVULKNQH.js +143 -0
  7. package/dist/cli-verify-CVYMUGKX.js +149 -0
  8. package/dist/cli.js +5 -5
  9. package/dist/dashboard/components/org-switcher.js +96 -0
  10. package/dist/dashboard/pages/agents.js +8 -1
  11. package/dist/dashboard/pages/approvals.js +5 -1
  12. package/dist/dashboard/pages/dashboard.js +6 -2
  13. package/dist/dashboard/pages/guardrails.js +20 -16
  14. package/dist/dashboard/pages/journal.js +6 -2
  15. package/dist/dashboard/pages/knowledge-contributions.js +18 -10
  16. package/dist/dashboard/pages/knowledge.js +32 -9
  17. package/dist/dashboard/pages/messages.js +8 -4
  18. package/dist/dashboard/pages/org-chart.js +5 -1
  19. package/dist/dashboard/pages/organizations.js +166 -13
  20. package/dist/dashboard/pages/skills.js +15 -11
  21. package/dist/dashboard/pages/task-pipeline.js +6 -2
  22. package/dist/dashboard/pages/workforce.js +5 -1
  23. package/dist/factory-XEBV2VGZ.js +9 -0
  24. package/dist/index.js +3 -3
  25. package/dist/postgres-NZBDKOQR.js +816 -0
  26. package/dist/server-3HZEV5X2.js +15 -0
  27. package/dist/setup-JUB67BUU.js +20 -0
  28. package/dist/sqlite-INPN4DQN.js +545 -0
  29. package/package.json +1 -1
  30. package/src/admin/routes.ts +94 -5
  31. package/src/dashboard/components/org-switcher.js +96 -0
  32. package/src/dashboard/pages/agents.js +8 -1
  33. package/src/dashboard/pages/approvals.js +5 -1
  34. package/src/dashboard/pages/dashboard.js +6 -2
  35. package/src/dashboard/pages/guardrails.js +20 -16
  36. package/src/dashboard/pages/journal.js +6 -2
  37. package/src/dashboard/pages/knowledge-contributions.js +18 -10
  38. package/src/dashboard/pages/knowledge.js +32 -9
  39. package/src/dashboard/pages/messages.js +8 -4
  40. package/src/dashboard/pages/org-chart.js +5 -1
  41. package/src/dashboard/pages/organizations.js +166 -13
  42. package/src/dashboard/pages/skills.js +15 -11
  43. package/src/dashboard/pages/task-pipeline.js +6 -2
  44. package/src/dashboard/pages/workforce.js +5 -1
  45. package/src/db/postgres.ts +17 -0
  46. package/src/db/sqlite.ts +8 -0
@@ -2,8 +2,11 @@ import { h, useState, useEffect, useCallback, Fragment, useApp, engineCall, buil
2
2
  import { I } from '../components/icons.js';
3
3
  import { TimezoneSelect } from '../components/timezones.js';
4
4
  import { HelpButton } from '../components/help-button.js';
5
+ import { useOrgContext } from '../components/org-switcher.js';
5
6
 
6
7
  export function WorkforcePage() {
8
+ var orgCtx = useOrgContext();
9
+ var effectiveOrgId = orgCtx.selectedOrgId || getOrgId();
7
10
  const { toast } = useApp();
8
11
  const [tab, setTab] = useState('overview');
9
12
  const [status, setStatus] = useState(null);
@@ -44,7 +47,7 @@ export function WorkforcePage() {
44
47
  setSchedules(schedulesRes.schedules || []);
45
48
  setBudgetData(budgetRes);
46
49
  setClockRecords(recordsRes.records || []);
47
- engineCall('/agents?orgId=' + getOrgId()).then(d => setAgents(d.agents || [])).catch(() => {});
50
+ engineCall('/agents?orgId=' + effectiveOrgId).then(d => setAgents(d.agents || [])).catch(() => {});
48
51
  } catch (err) { toast('Failed to load workforce data', 'error'); }
49
52
  setLoading(false);
50
53
  };
@@ -251,6 +254,7 @@ export function WorkforcePage() {
251
254
  var _tip = { marginTop: 12, padding: 12, background: 'var(--bg-secondary, #1e293b)', borderRadius: 'var(--radius, 8px)', fontSize: 13 };
252
255
 
253
256
  return h('div', { className: 'page-inner' },
257
+ h(orgCtx.Switcher),
254
258
  h('div', { className: 'page-header' },
255
259
  h('h1', { style: { display: 'flex', alignItems: 'center' } }, 'Workforce Management', h(HelpButton, { label: 'Workforce Management' },
256
260
  h('p', null, 'Manage your agents like employees — set work schedules, assign tasks, track budgets, and monitor clock-in/out history.'),
@@ -209,7 +209,24 @@ export class PostgresAdapter extends DatabaseAdapter {
209
209
  );
210
210
  `);
211
211
  await client.query(`
212
+ ALTER TABLE client_organizations ADD COLUMN IF NOT EXISTS billing_rate_per_agent NUMERIC(10,2) DEFAULT 0;
213
+ ALTER TABLE client_organizations ADD COLUMN IF NOT EXISTS currency TEXT DEFAULT 'USD';
212
214
  ALTER TABLE agents ADD COLUMN IF NOT EXISTS client_org_id TEXT REFERENCES client_organizations(id);
215
+
216
+ CREATE TABLE IF NOT EXISTS org_billing_records (
217
+ id TEXT PRIMARY KEY DEFAULT gen_random_uuid(),
218
+ org_id TEXT NOT NULL REFERENCES client_organizations(id) ON DELETE CASCADE,
219
+ agent_id TEXT,
220
+ month TEXT NOT NULL,
221
+ revenue NUMERIC(10,2) DEFAULT 0,
222
+ token_cost NUMERIC(10,4) DEFAULT 0,
223
+ input_tokens BIGINT DEFAULT 0,
224
+ output_tokens BIGINT DEFAULT 0,
225
+ notes TEXT,
226
+ created_at TIMESTAMP DEFAULT NOW(),
227
+ updated_at TIMESTAMP DEFAULT NOW(),
228
+ UNIQUE(org_id, agent_id, month)
229
+ );
213
230
  `).catch(() => {});
214
231
  await client.query(`
215
232
  CREATE TABLE IF NOT EXISTS agent_knowledge_access (
package/src/db/sqlite.ts CHANGED
@@ -78,7 +78,15 @@ export class SqliteAdapter extends DatabaseAdapter {
78
78
  updated_at TEXT DEFAULT (datetime('now'))
79
79
  );
80
80
  `);
81
+ try { this.db.exec(`ALTER TABLE client_organizations ADD COLUMN billing_rate_per_agent REAL DEFAULT 0`); } catch { /* exists */ }
82
+ try { this.db.exec(`ALTER TABLE client_organizations ADD COLUMN currency TEXT DEFAULT 'USD'`); } catch { /* exists */ }
81
83
  try { this.db.exec(`ALTER TABLE agents ADD COLUMN client_org_id TEXT REFERENCES client_organizations(id)`); } catch { /* exists */ }
84
+ this.db.exec(`CREATE TABLE IF NOT EXISTS org_billing_records (
85
+ id TEXT PRIMARY KEY, org_id TEXT NOT NULL, agent_id TEXT, month TEXT NOT NULL,
86
+ revenue REAL DEFAULT 0, token_cost REAL DEFAULT 0, input_tokens INTEGER DEFAULT 0,
87
+ output_tokens INTEGER DEFAULT 0, notes TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
88
+ updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UNIQUE(org_id, agent_id, month)
89
+ )`);
82
90
  this.db.exec(`
83
91
  CREATE TABLE IF NOT EXISTS agent_knowledge_access (
84
92
  id TEXT PRIMARY KEY,