feat(agent): activate BOC agent layer
BOC CI/CD / Test (push) Failing after 2s
BOC CI/CD / Security Scan (push) Has been skipped
BOC CI/CD / Build & Push (push) Has been skipped
BOC CI/CD / Deploy to Staging (push) Has been skipped
BOC CI/CD / Deploy to Production (push) Has been skipped

- Add agent orchestrator API (/api/v1/agents/*)
- Connect frontend AgentContext to real backend
- Add AgentLayerPage with full agent management
- Implement specialist agents: finance, sales, hr, crm, legal, marketing, dashboard
- Add authentication, RBAC, tenant isolation on agent endpoints
- Add rate limiting and audit logging
- Update sidebar with Agent Layer navigation
- Build fresh web-v2 dist
This commit is contained in:
Bernt
2026-08-12 07:50:12 +00:00
parent 971a2bd9a9
commit 0b416b0f13
21 changed files with 2249 additions and 1370 deletions
+21 -21
View File
@@ -44,13 +44,13 @@ type LedgerAccount struct {
// GetAccounts returns all BAS accounts with balances
func (c *RobustClient) GetAccounts(ctx context.Context) ([]LedgerAccount, error) {
rows, err := c.db.QueryContext(ctx, `
SELECT a.account_code, a.name, a.account_type,
SELECT a.code, a.name, a.account_type,
COALESCE(SUM(CASE WHEN jl.debit IS NOT NULL THEN jl.debit ELSE 0 END) -
SUM(CASE WHEN jl.credit IS NOT NULL THEN jl.credit ELSE 0 END), 0) as balance
FROM boc_chart_of_accounts a
LEFT JOIN boc_journal_lines jl ON a.id = jl.account_id
GROUP BY a.id, a.account_code, a.name, a.account_type
ORDER BY a.account_code
FROM accounts a
LEFT JOIN journal_lines jl ON a.id = jl.account_id
GROUP BY a.id, a.code, a.name, a.account_type
ORDER BY a.code
`)
if err != nil {
return nil, fmt.Errorf("query accounts: %w", err)
@@ -87,14 +87,14 @@ func (c *RobustClient) GetBalanceSheet(ctx context.Context, period string) (*Bal
}
rows, err := c.db.QueryContext(ctx, `
SELECT a.account_code, a.name, a.account_type,
SELECT a.code, a.name, a.account_type,
COALESCE(SUM(CASE WHEN jl.debit IS NOT NULL THEN jl.debit ELSE 0 END) -
SUM(CASE WHEN jl.credit IS NOT NULL THEN jl.credit ELSE 0 END), 0) as balance
FROM boc_chart_of_accounts a
LEFT JOIN boc_journal_lines jl ON a.id = jl.account_id
LEFT JOIN boc_journal_entries je ON jl.entry_id = je.id AND je.entry_date >= $1::date AND je.entry_date < ($1::date + INTERVAL '1 month')
GROUP BY a.id, a.account_code, a.name, a.account_type
ORDER BY a.account_code
FROM accounts a
LEFT JOIN journal_lines jl ON a.id = jl.account_id
LEFT JOIN journal_entries je ON jl.journal_entry_id = je.id AND je.entry_date >= $1::date AND je.entry_date < ($1::date + INTERVAL '1 month')
GROUP BY a.id, a.code, a.name, a.account_type
ORDER BY a.code
`, period+"-01")
if err != nil {
return nil, fmt.Errorf("query balance sheet: %w", err)
@@ -141,15 +141,15 @@ func (c *RobustClient) GetIncomeStatement(ctx context.Context, period string) (*
}
rows, err := c.db.QueryContext(ctx, `
SELECT a.account_code, a.name, a.account_type,
SELECT a.code, a.name, a.account_type,
COALESCE(SUM(CASE WHEN jl.debit IS NOT NULL THEN jl.debit ELSE 0 END) -
SUM(CASE WHEN jl.credit IS NOT NULL THEN jl.credit ELSE 0 END), 0) as balance
FROM boc_chart_of_accounts a
LEFT JOIN boc_journal_lines jl ON a.id = jl.account_id
LEFT JOIN boc_journal_entries je ON jl.entry_id = je.id AND je.entry_date >= $1::date AND je.entry_date < ($1::date + INTERVAL '1 month')
FROM accounts a
LEFT JOIN journal_lines jl ON a.id = jl.account_id
LEFT JOIN journal_entries je ON jl.journal_entry_id = je.id AND je.entry_date >= $1::date AND je.entry_date < ($1::date + INTERVAL '1 month')
WHERE LOWER(a.account_type) IN ('revenue', 'expense')
GROUP BY a.id, a.account_code, a.name, a.account_type
ORDER BY a.account_code
GROUP BY a.id, a.code, a.name, a.account_type
ORDER BY a.code
`, period+"-01")
if err != nil {
return nil, fmt.Errorf("query income statement: %w", err)
@@ -197,11 +197,11 @@ func (c *RobustClient) GetMomsReport(ctx context.Context, period string) (*MomsR
// Moms in (utgående moms från försäljning)
err := c.db.QueryRowContext(ctx, `
SELECT COALESCE(SUM(jl.credit), 0)
FROM boc_journal_lines jl
JOIN boc_journal_entries je ON jl.entry_id = je.id
JOIN boc_chart_of_accounts a ON jl.account_id = a.id
FROM journal_lines jl
JOIN journal_entries je ON jl.journal_entry_id = je.id
JOIN accounts a ON jl.account_id = a.id
WHERE je.entry_date >= $1::date AND je.entry_date < ($1::date + INTERVAL '1 month')
AND a.account_code LIKE '26%'
AND a.code LIKE '26%'
`, period+"-01").Scan(&report.MomsUt)
if err != nil {
return nil, fmt.Errorf("query moms ut: %w", err)