File size: 3,139 Bytes
e870690
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var AgentSpawner = {
  roles: {
    'researcher':  { tools: ['search', 'summarize', 'cite'],      permissions: ['read', 'audit'], memory: 'session' },
    'auditor':     { tools: ['verify', 'seal', 'log'],           permissions: ['read', 'audit'], memory: 'persistent' },
    'builder':     { tools: ['create', 'edit', 'compile'],       permissions: ['read', 'write'], memory: 'session' },
    'debater':     { tools: ['propose', 'challenge', 'synthesize'], permissions: ['read', 'audit'], memory: 'session' },
    'archivist':   { tools: ['store', 'index', 'retrieve'],      permissions: ['read', 'write'], memory: 'persistent' },
    'sentinel':    { tools: ['monitor', 'alert', 'block'],       permissions: ['read', 'audit'], memory: 'persistent' },
    'explorer':    { tools: ['scan', 'map', 'discover'],         permissions: ['read'],          memory: 'session' },
    'translator':  { tools: ['decode', 'encode', 'transform'],   permissions: ['read', 'write'], memory: 'session' }
  },

  spawn: async function(name, role) {
    role = (role || 'researcher').toLowerCase();
    var profile = this.roles[role] || this.roles['researcher'];
    var agent = {
      id: 'agent_' + Date.now().toString(36),
      name: name,
      role: role,
      tools: profile.tools,
      permissions: profile.permissions,
      memoryScope: profile.memory,
      createdAt: new Date().toISOString(),
      mode: RuntimeRegistry.current,
      lastRun: null,
      runCount: 0,
      seal: null
    };
    var s = await Seal.createSeal({ type: 'AGENT_SPAWN', name: name, role: role });
    agent.seal = s.hash;
    AgentRegistry.save(agent);
    return agent;
  },

  renderProfile: function(agent) {
    return [
      '╔══════════════════════════════════════════════════════════╗',
      'β•‘  AGENT PROFILE                                          β•‘',
      '╠══════════════════════════════════════════════════════════╣',
      'β•‘  ID:          ' + agent.id.padEnd(43) + 'β•‘',
      'β•‘  NAME:        ' + agent.name.padEnd(43) + 'β•‘',
      'β•‘  ROLE:        ' + agent.role.padEnd(43) + 'β•‘',
      'β•‘  TOOLS:       ' + agent.tools.join(', ').substring(0, 43).padEnd(43) + 'β•‘',
      'β•‘  PERMISSIONS: ' + agent.permissions.join(', ').padEnd(43) + 'β•‘',
      'β•‘  MEMORY:      ' + agent.memoryScope.padEnd(43) + 'β•‘',
      'β•‘  MODE:        ' + agent.mode.padEnd(43) + 'β•‘',
      'β•‘  RUNS:        ' + String(agent.runCount).padEnd(43) + 'β•‘',
      'β•‘  CREATED:     ' + agent.createdAt.substring(0, 19).padEnd(43) + 'β•‘',
      'β•‘  SEAL:        ' + (agent.seal || 'none').substring(0, 43).padEnd(43) + 'β•‘',
      'β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•'
    ].join('\n');
  }
};