dealgo 1.0.1 → 1.1.0
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.
- package/README.md +28 -0
- package/dist/index.js +132 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,6 +102,34 @@ dealgo keys create \
|
|
|
102
102
|
- `decisions:read` - Read decisions
|
|
103
103
|
- `ops:read` - View system status
|
|
104
104
|
- `keys:manage` - Manage API keys
|
|
105
|
+
- `agents:read` - List and view agents
|
|
106
|
+
- `agents:write` - Create and update agents
|
|
107
|
+
|
|
108
|
+
### Agent Management
|
|
109
|
+
```bash
|
|
110
|
+
# List all agents
|
|
111
|
+
dealgo agents list
|
|
112
|
+
|
|
113
|
+
# Create new agent
|
|
114
|
+
dealgo agents create \
|
|
115
|
+
--name "Production Bot" \
|
|
116
|
+
--description "Main production AI agent"
|
|
117
|
+
|
|
118
|
+
# Update agent
|
|
119
|
+
dealgo agents update <agent-id> \
|
|
120
|
+
--name "Updated Name" \
|
|
121
|
+
--status "paused"
|
|
122
|
+
|
|
123
|
+
# Link decisions to agents
|
|
124
|
+
dealgo decisions log \
|
|
125
|
+
--agent <agent-id> \
|
|
126
|
+
--verdict APPROVE \
|
|
127
|
+
--score 90 \
|
|
128
|
+
--rationale "Safe to proceed"
|
|
129
|
+
|
|
130
|
+
# Filter decisions by agent
|
|
131
|
+
dealgo decisions list --agent <agent-id>
|
|
132
|
+
```
|
|
105
133
|
|
|
106
134
|
### Configuration
|
|
107
135
|
```bash
|
package/dist/index.js
CHANGED
|
@@ -225,7 +225,8 @@ decisionsCmd
|
|
|
225
225
|
.requiredOption('--verdict <type>', 'Verdict: APPROVE, DENY, DELAY, FOUNDER_REQUIRED')
|
|
226
226
|
.requiredOption('--score <number>', 'Survival score (-100 to 100)')
|
|
227
227
|
.requiredOption('--rationale <text>', 'Decision rationale')
|
|
228
|
-
.option('--
|
|
228
|
+
.option('--agent <id>', 'Link decision to agent')
|
|
229
|
+
.option('--agentId <id>', 'Link decision to agent (alias)')
|
|
229
230
|
.option('--json', 'Output JSON format')
|
|
230
231
|
.action(async (options) => {
|
|
231
232
|
const verdict = options.verdict.toUpperCase();
|
|
@@ -246,8 +247,10 @@ decisionsCmd
|
|
|
246
247
|
survivalScore: score,
|
|
247
248
|
rationale: [options.rationale],
|
|
248
249
|
};
|
|
249
|
-
|
|
250
|
-
|
|
250
|
+
// Support both --agent and --agentId (backwards compatible)
|
|
251
|
+
const agentId = options.agent || options.agentId;
|
|
252
|
+
if (agentId) {
|
|
253
|
+
body.agentId = agentId;
|
|
251
254
|
}
|
|
252
255
|
const data = await apiCall('/api/v1/decisions', {
|
|
253
256
|
method: 'POST',
|
|
@@ -271,10 +274,16 @@ decisionsCmd
|
|
|
271
274
|
.command('list')
|
|
272
275
|
.description('List recent decisions')
|
|
273
276
|
.option('--limit <number>', 'Number of decisions to show', '10')
|
|
277
|
+
.option('--agent <id>', 'Filter by agent ID')
|
|
274
278
|
.option('--json', 'Output JSON format')
|
|
275
279
|
.action(async (options) => {
|
|
276
280
|
const limit = parseInt(options.limit);
|
|
277
|
-
|
|
281
|
+
let url = `/api/v1/decisions?limit=${limit}`;
|
|
282
|
+
// Add agent filter if provided
|
|
283
|
+
if (options.agent) {
|
|
284
|
+
url += `&agentId=${options.agent}`;
|
|
285
|
+
}
|
|
286
|
+
const data = await apiCall(url, {
|
|
278
287
|
profile: program.opts().profile,
|
|
279
288
|
});
|
|
280
289
|
if (options.json) {
|
|
@@ -473,5 +482,124 @@ configCmd
|
|
|
473
482
|
});
|
|
474
483
|
console.log();
|
|
475
484
|
});
|
|
485
|
+
// ============================================================================
|
|
486
|
+
// Agents Command
|
|
487
|
+
// ============================================================================
|
|
488
|
+
const agentsCmd = program
|
|
489
|
+
.command('agents')
|
|
490
|
+
.description('Manage agents');
|
|
491
|
+
agentsCmd
|
|
492
|
+
.command('list')
|
|
493
|
+
.description('List all agents')
|
|
494
|
+
.option('--json', 'Output as JSON')
|
|
495
|
+
.option('--profile <name>', 'Use specific profile')
|
|
496
|
+
.action(async (options) => {
|
|
497
|
+
try {
|
|
498
|
+
const data = await apiCall('/api/v1/agents', {
|
|
499
|
+
method: 'GET',
|
|
500
|
+
profile: options.profile,
|
|
501
|
+
});
|
|
502
|
+
if (options.json) {
|
|
503
|
+
console.log(JSON.stringify(data, null, 2));
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if (!data.agents || data.agents.length === 0) {
|
|
507
|
+
console.log(chalk_1.default.gray('No agents found. Create one with: dealgo agents create --name "My Agent"'));
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
console.log(chalk_1.default.bold('\nAgents:\n'));
|
|
511
|
+
console.log(chalk_1.default.gray('ID NAME STATUS DECISIONS CREATED'));
|
|
512
|
+
console.log(chalk_1.default.gray('─'.repeat(90)));
|
|
513
|
+
data.agents.forEach((agent) => {
|
|
514
|
+
const id = agent.id.padEnd(22);
|
|
515
|
+
const name = (agent.name || 'Unnamed').substring(0, 20).padEnd(21);
|
|
516
|
+
const status = agent.status.toUpperCase().padEnd(11);
|
|
517
|
+
const decisions = String(agent.decisionsCount || 0).padEnd(10);
|
|
518
|
+
const created = new Date(agent.createdAt).toLocaleDateString();
|
|
519
|
+
console.log(`${id} ${chalk_1.default.bold(name)} ${chalk_1.default.green(status)} ${decisions} ${created}`);
|
|
520
|
+
});
|
|
521
|
+
console.log();
|
|
522
|
+
}
|
|
523
|
+
catch (error) {
|
|
524
|
+
console.error(chalk_1.default.red('✗ Error:'), error.message);
|
|
525
|
+
process.exit(1);
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
agentsCmd
|
|
529
|
+
.command('create')
|
|
530
|
+
.description('Create a new agent')
|
|
531
|
+
.requiredOption('--name <name>', 'Agent name')
|
|
532
|
+
.option('--description <desc>', 'Agent description')
|
|
533
|
+
.option('--json', 'Output as JSON')
|
|
534
|
+
.option('--profile <name>', 'Use specific profile')
|
|
535
|
+
.action(async (options) => {
|
|
536
|
+
try {
|
|
537
|
+
const data = await apiCall('/api/v1/agents', {
|
|
538
|
+
method: 'POST',
|
|
539
|
+
profile: options.profile,
|
|
540
|
+
body: {
|
|
541
|
+
name: options.name,
|
|
542
|
+
description: options.description || '',
|
|
543
|
+
},
|
|
544
|
+
});
|
|
545
|
+
if (options.json) {
|
|
546
|
+
console.log(JSON.stringify(data, null, 2));
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
console.log(chalk_1.default.green('✓ Agent created'));
|
|
550
|
+
console.log(chalk_1.default.gray(` ID: ${data.agent.id}`));
|
|
551
|
+
console.log(chalk_1.default.gray(` Name: ${data.agent.name}`));
|
|
552
|
+
if (data.agent.description) {
|
|
553
|
+
console.log(chalk_1.default.gray(` Description: ${data.agent.description}`));
|
|
554
|
+
}
|
|
555
|
+
console.log(chalk_1.default.gray(` Status: ${data.agent.status}`));
|
|
556
|
+
}
|
|
557
|
+
catch (error) {
|
|
558
|
+
console.error(chalk_1.default.red('✗ Error:'), error.message);
|
|
559
|
+
process.exit(1);
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
agentsCmd
|
|
563
|
+
.command('update')
|
|
564
|
+
.description('Update an agent')
|
|
565
|
+
.argument('<id>', 'Agent ID')
|
|
566
|
+
.option('--name <name>', 'New agent name')
|
|
567
|
+
.option('--description <desc>', 'New agent description')
|
|
568
|
+
.option('--status <status>', 'New status (active, paused, archived)')
|
|
569
|
+
.option('--json', 'Output as JSON')
|
|
570
|
+
.option('--profile <name>', 'Use specific profile')
|
|
571
|
+
.action(async (id, options) => {
|
|
572
|
+
try {
|
|
573
|
+
const body = {};
|
|
574
|
+
if (options.name)
|
|
575
|
+
body.name = options.name;
|
|
576
|
+
if (options.description !== undefined)
|
|
577
|
+
body.description = options.description;
|
|
578
|
+
if (options.status)
|
|
579
|
+
body.status = options.status;
|
|
580
|
+
if (Object.keys(body).length === 0) {
|
|
581
|
+
console.error(chalk_1.default.red('✗ Error: No update fields provided'));
|
|
582
|
+
console.log(chalk_1.default.gray(' Use --name, --description, or --status'));
|
|
583
|
+
process.exit(1);
|
|
584
|
+
}
|
|
585
|
+
const data = await apiCall(`/api/v1/agents/${id}`, {
|
|
586
|
+
method: 'PATCH',
|
|
587
|
+
profile: options.profile,
|
|
588
|
+
body,
|
|
589
|
+
});
|
|
590
|
+
if (options.json) {
|
|
591
|
+
console.log(JSON.stringify(data, null, 2));
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
console.log(chalk_1.default.green('✓ Agent updated'));
|
|
595
|
+
console.log(chalk_1.default.gray(` ID: ${data.agent.id}`));
|
|
596
|
+
console.log(chalk_1.default.gray(` Name: ${data.agent.name}`));
|
|
597
|
+
console.log(chalk_1.default.gray(` Status: ${data.agent.status}`));
|
|
598
|
+
}
|
|
599
|
+
catch (error) {
|
|
600
|
+
console.error(chalk_1.default.red('✗ Error:'), error.message);
|
|
601
|
+
process.exit(1);
|
|
602
|
+
}
|
|
603
|
+
});
|
|
476
604
|
// Parse CLI arguments
|
|
477
605
|
program.parse();
|
package/package.json
CHANGED