feat(mvp): DAGI Integration Fix - gov_level, DAIS, nodes table

TASK_PHASE_MVP_DAGI_INTEGRATION_FIX_20251201

A) Agents Layer:
- A1: Added gov_level to API and UI (list + profile)
- A2: Added dais_identity_id to API and UI
- A3: Added home_microdao_id/name/slug for ownership display

B) MicroDAO Layer:
- B1/B2: Already implemented (agents, rooms, citizens, district badge)

C) Nodes Layer:
- C1: Node Dashboard already implemented
- C2: Created nodes table migration with owner_microdao_id
- C3: INSERT NODE1/NODE2 with dao_daarion ownership

D) Backend Fixes:
- D1: Extended /api/agents/* with DAIS/governance fields
- D2/D3: Already implemented

Files changed:
- services/city-service/repo_city.py
- services/city-service/models_city.py
- services/city-service/routes_city.py
- services/city-service/migrations.py
- apps/web/src/lib/types/agents.ts
- apps/web/src/lib/agent-dashboard.ts
- apps/web/src/app/agents/page.tsx
- apps/web/src/components/agent-dashboard/AgentSummaryCard.tsx

Reports:
- docs/debug/mvp_dagi_integration_fix_report_20251201.md
- docs/tasks/TASK_PHASE_MVP_DAGI_INTEGRATION_FIX_20251201.md
This commit is contained in:
Apple
2025-11-30 08:45:07 -08:00
parent a23deae3c4
commit 644edd3f30
22 changed files with 1227 additions and 82 deletions

View File

@@ -1,9 +1,9 @@
'use client';
import Link from 'next/link';
import { Bot, Users, Building2, Server, ExternalLink } from 'lucide-react';
import { Bot, Users, Building2, Server, ExternalLink, Shield } from 'lucide-react';
import { useAgentList } from '@/hooks/useAgents';
import { AgentSummary } from '@/lib/types/agents';
import { AgentSummary, getGovLevelBadge } from '@/lib/types/agents';
// Kind emoji mapping
const kindEmoji: Record<string, string> = {
@@ -33,6 +33,7 @@ function AgentCard({ agent }: { agent: AgentSummary }) {
const statusColor = isOnline ? 'text-emerald-400' : 'text-white/40';
const emoji = kindEmoji[agent.kind] || '🤖';
const nodeBadge = getNodeBadge(agent.home_node?.id);
const govBadge = getGovLevelBadge(agent.gov_level);
return (
<Link
@@ -82,7 +83,7 @@ function AgentCard({ agent }: { agent: AgentSummary }) {
{/* Footer */}
<div className="pt-4 border-t border-white/10 flex items-center justify-between">
<div className="flex items-center gap-3">
<div className="flex items-center gap-2 flex-wrap">
<span className={`flex items-center gap-1.5 text-xs ${statusColor}`}>
<span
className={`w-2 h-2 rounded-full ${
@@ -94,6 +95,13 @@ function AgentCard({ agent }: { agent: AgentSummary }) {
<span className={`px-2 py-0.5 rounded text-[10px] font-medium ${nodeBadge.color}`}>
{nodeBadge.label}
</span>
{/* Gov Level Badge (A1) */}
{agent.gov_level && (
<span className={`px-2 py-0.5 rounded text-[10px] font-medium flex items-center gap-1 ${govBadge.color}`}>
<Shield className="w-3 h-3" />
{govBadge.label}
</span>
)}
{agent.is_public && (
<span className="px-2 py-0.5 rounded text-[10px] font-medium bg-cyan-500/20 text-cyan-400">
Public

View File

@@ -1,7 +1,10 @@
'use client';
import Link from 'next/link';
import { AgentProfile, AgentRuntime, getAgentKindIcon, getAgentStatusColor } from '@/lib/agent-dashboard';
import { StatusBadge } from '@/components/node-dashboard';
import { getGovLevelBadge } from '@/lib/types/agents';
import { Shield, Fingerprint, Building2 } from 'lucide-react';
interface AgentSummaryCardProps {
profile: AgentProfile;
@@ -10,6 +13,7 @@ interface AgentSummaryCardProps {
export function AgentSummaryCard({ profile, runtime }: AgentSummaryCardProps) {
const kindIcon = getAgentKindIcon(profile.kind);
const govBadge = getGovLevelBadge(profile.gov_level);
return (
<div className="bg-white/5 backdrop-blur-md rounded-2xl border border-white/10 p-6">
@@ -60,6 +64,20 @@ export function AgentSummaryCard({ profile, runtime }: AgentSummaryCardProps) {
>
{kindIcon} {profile.kind}
</span>
{/* Gov Level Badge (A1) */}
{profile.gov_level && (
<span className={`px-2 py-1 rounded-md text-sm font-medium flex items-center gap-1 ${govBadge.color}`}>
<Shield className="w-3 h-3" />
{govBadge.label}
</span>
)}
{/* DAIS Identity (A2) */}
{profile.dais_identity_id && (
<span className="px-2 py-1 bg-violet-500/20 text-violet-400 rounded-md text-sm flex items-center gap-1">
<Fingerprint className="w-3 h-3" />
{profile.dais_identity_id}
</span>
)}
{profile.roles.map(role => (
<span
key={role}
@@ -72,6 +90,22 @@ export function AgentSummaryCard({ profile, runtime }: AgentSummaryCardProps) {
</div>
</div>
{/* Home MicroDAO (A3) */}
{(profile.home_microdao_id || profile.primary_microdao_id) && (
<div className="mt-4 pt-4 border-t border-white/10">
<div className="flex items-center gap-2 text-sm">
<Building2 className="w-4 h-4 text-cyan-400" />
<span className="text-white/50">Belongs to:</span>
<Link
href={`/microdao/${profile.home_microdao_slug || profile.primary_microdao_slug}`}
className="text-cyan-400 hover:text-cyan-300 font-medium"
>
{profile.home_microdao_name || profile.primary_microdao_name}
</Link>
</div>
</div>
)}
{/* Runtime info */}
{runtime && (
<div className="mt-4 pt-4 border-t border-white/10 flex items-center gap-4">

View File

@@ -91,6 +91,13 @@ export interface AgentProfile {
primary_microdao_id?: string;
primary_microdao_name?: string;
primary_microdao_slug?: string;
// Governance & DAIS (A1, A2)
gov_level?: string | null;
dais_identity_id?: string | null;
// Home MicroDAO (A3)
home_microdao_id?: string | null;
home_microdao_name?: string | null;
home_microdao_slug?: string | null;
roles: string[];
tags: string[];
dais: DAIS;

View File

@@ -71,6 +71,10 @@ export interface AgentSummary {
node_label?: string | null;
home_node?: HomeNode | null;
// Governance & DAIS (A1, A2)
gov_level?: string | null; // personal, core_team, orchestrator, district_lead, city_governance
dais_identity_id?: string | null; // DAIS identity reference
// Visibility & roles
visibility_scope: VisibilityScope;
is_listed_in_directory: boolean;
@@ -78,10 +82,13 @@ export interface AgentSummary {
is_public: boolean;
is_orchestrator: boolean;
// MicroDAO
// MicroDAO (A3)
primary_microdao_id?: string | null;
primary_microdao_name?: string | null;
primary_microdao_slug?: string | null;
home_microdao_id?: string | null; // Owner microDAO
home_microdao_name?: string | null;
home_microdao_slug?: string | null;
district?: string | null;
microdaos: MicrodaoBadge[];
microdao_memberships: AgentMicrodaoMembership[];
@@ -187,3 +194,22 @@ export function getVisibilityScopeLabel(scope: VisibilityScope): string {
default: return scope;
}
}
/**
* Gov level configuration (A1)
*/
export const GOV_LEVEL_CONFIG: Record<string, { label: string; color: string; emoji: string }> = {
city_governance: { label: 'City Governance', color: 'bg-amber-500/20 text-amber-400', emoji: '👑' },
district_lead: { label: 'District Lead', color: 'bg-purple-500/20 text-purple-400', emoji: '🏛️' },
orchestrator: { label: 'Orchestrator', color: 'bg-cyan-500/20 text-cyan-400', emoji: '🎭' },
core_team: { label: 'Core Team', color: 'bg-blue-500/20 text-blue-400', emoji: '⚡' },
personal: { label: 'Personal', color: 'bg-gray-500/20 text-gray-400', emoji: '👤' },
};
/**
* Get gov level badge info
*/
export function getGovLevelBadge(govLevel?: string | null): { label: string; color: string; emoji: string } {
if (!govLevel) return { label: 'Unknown', color: 'bg-gray-500/20 text-gray-400', emoji: '❓' };
return GOV_LEVEL_CONFIG[govLevel] || { label: govLevel, color: 'bg-gray-500/20 text-gray-400', emoji: '❓' };
}