chainlesschain 0.66.0 → 0.132.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/bin/chainlesschain.js +0 -0
- package/package.json +1 -1
- package/src/commands/a2a.js +380 -0
- package/src/commands/agent-network.js +254 -1
- package/src/commands/audit.js +302 -0
- package/src/commands/automation.js +271 -1
- package/src/commands/bi.js +348 -0
- package/src/commands/codegen.js +224 -0
- package/src/commands/collab.js +341 -0
- package/src/commands/compliance.js +1035 -0
- package/src/commands/cowork.js +221 -0
- package/src/commands/crosschain.js +218 -0
- package/src/commands/dbevo.js +284 -0
- package/src/commands/dev.js +252 -0
- package/src/commands/did.js +358 -0
- package/src/commands/dlp.js +341 -0
- package/src/commands/encrypt.js +341 -0
- package/src/commands/evomap.js +394 -0
- package/src/commands/export.js +256 -1
- package/src/commands/federation.js +283 -0
- package/src/commands/fusion.js +258 -0
- package/src/commands/governance.js +325 -0
- package/src/commands/hardening.js +411 -0
- package/src/commands/hook.js +148 -0
- package/src/commands/import.js +252 -0
- package/src/commands/incentive.js +322 -0
- package/src/commands/inference.js +318 -0
- package/src/commands/infra.js +244 -0
- package/src/commands/instinct.js +260 -0
- package/src/commands/ipfs.js +318 -0
- package/src/commands/kg.js +387 -0
- package/src/commands/llm.js +263 -0
- package/src/commands/lowcode.js +356 -0
- package/src/commands/marketplace.js +256 -0
- package/src/commands/mcp.js +221 -0
- package/src/commands/memory.js +248 -0
- package/src/commands/multimodal.js +296 -0
- package/src/commands/nlprog.js +356 -0
- package/src/commands/note.js +244 -0
- package/src/commands/ops.js +354 -0
- package/src/commands/orchestrate.js +166 -0
- package/src/commands/org.js +277 -0
- package/src/commands/p2p.js +390 -0
- package/src/commands/perception.js +290 -0
- package/src/commands/permmem.js +251 -0
- package/src/commands/plugin-ecosystem.js +273 -0
- package/src/commands/pqc.js +393 -0
- package/src/commands/privacy.js +321 -0
- package/src/commands/quantization.js +351 -0
- package/src/commands/rcache.js +271 -0
- package/src/commands/recommend.js +340 -0
- package/src/commands/reputation.js +261 -0
- package/src/commands/runtime.js +307 -0
- package/src/commands/scim.js +262 -0
- package/src/commands/session.js +258 -0
- package/src/commands/siem.js +246 -0
- package/src/commands/skill.js +267 -1
- package/src/commands/sla.js +259 -0
- package/src/commands/social.js +256 -0
- package/src/commands/sso.js +186 -1
- package/src/commands/stress.js +230 -0
- package/src/commands/sync.js +256 -0
- package/src/commands/tech.js +338 -0
- package/src/commands/tenant.js +351 -0
- package/src/commands/terraform.js +245 -0
- package/src/commands/tokens.js +269 -0
- package/src/commands/trust.js +249 -0
- package/src/commands/wallet.js +277 -0
- package/src/commands/workflow.js +171 -0
- package/src/commands/zkp.js +335 -0
- package/src/index.js +4 -0
- package/src/lib/a2a-protocol.js +451 -0
- package/src/lib/agent-coordinator.js +325 -0
- package/src/lib/agent-network.js +387 -0
- package/src/lib/agent-router.js +395 -0
- package/src/lib/aiops.js +478 -0
- package/src/lib/app-builder.js +239 -0
- package/src/lib/audit-logger.js +379 -0
- package/src/lib/automation-engine.js +330 -0
- package/src/lib/autonomous-developer.js +350 -0
- package/src/lib/bi-engine.js +338 -0
- package/src/lib/code-agent.js +323 -0
- package/src/lib/collaboration-governance.js +364 -0
- package/src/lib/community-governance.js +436 -0
- package/src/lib/compliance-manager.js +434 -0
- package/src/lib/content-recommendation.js +469 -0
- package/src/lib/cross-chain.js +345 -0
- package/src/lib/crypto-manager.js +350 -0
- package/src/lib/dbevo.js +338 -0
- package/src/lib/decentral-infra.js +340 -0
- package/src/lib/did-manager.js +367 -0
- package/src/lib/dlp-engine.js +389 -0
- package/src/lib/evomap-federation.js +177 -0
- package/src/lib/evomap-governance.js +276 -0
- package/src/lib/federation-hardening.js +259 -0
- package/src/lib/hardening-manager.js +348 -0
- package/src/lib/hook-manager.js +380 -0
- package/src/lib/inference-network.js +330 -0
- package/src/lib/instinct-manager.js +332 -0
- package/src/lib/ipfs-storage.js +334 -0
- package/src/lib/knowledge-exporter.js +381 -0
- package/src/lib/knowledge-graph.js +432 -0
- package/src/lib/knowledge-importer.js +379 -0
- package/src/lib/llm-providers.js +391 -0
- package/src/lib/mcp-registry.js +333 -0
- package/src/lib/memory-manager.js +330 -0
- package/src/lib/multimodal.js +346 -0
- package/src/lib/nl-programming.js +343 -0
- package/src/lib/note-versioning.js +327 -0
- package/src/lib/org-manager.js +323 -0
- package/src/lib/p2p-manager.js +387 -0
- package/src/lib/perception.js +346 -0
- package/src/lib/perf-tuning.js +4 -1
- package/src/lib/permanent-memory.js +320 -0
- package/src/lib/plugin-ecosystem.js +377 -0
- package/src/lib/pqc-manager.js +368 -0
- package/src/lib/privacy-computing.js +427 -0
- package/src/lib/protocol-fusion.js +417 -0
- package/src/lib/quantization.js +325 -0
- package/src/lib/reputation-optimizer.js +299 -0
- package/src/lib/response-cache.js +327 -0
- package/src/lib/scim-manager.js +329 -0
- package/src/lib/session-manager.js +329 -0
- package/src/lib/siem-exporter.js +333 -0
- package/src/lib/skill-loader.js +377 -0
- package/src/lib/skill-marketplace.js +325 -0
- package/src/lib/sla-manager.js +275 -0
- package/src/lib/social-manager.js +326 -0
- package/src/lib/sso-manager.js +332 -0
- package/src/lib/stress-tester.js +330 -0
- package/src/lib/sync-manager.js +326 -0
- package/src/lib/tech-learning-engine.js +369 -0
- package/src/lib/tenant-saas.js +460 -0
- package/src/lib/terraform-manager.js +363 -0
- package/src/lib/threat-intel.js +335 -0
- package/src/lib/token-incentive.js +293 -0
- package/src/lib/token-tracker.js +329 -0
- package/src/lib/trust-security.js +390 -0
- package/src/lib/ueba.js +389 -0
- package/src/lib/universal-runtime.js +325 -0
- package/src/lib/wallet-manager.js +326 -0
- package/src/lib/workflow-engine.js +322 -0
- package/src/lib/zkp-engine.js +274 -0
package/bin/chainlesschain.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/commands/a2a.js
CHANGED
|
@@ -17,6 +17,26 @@ import {
|
|
|
17
17
|
getTaskStatus,
|
|
18
18
|
negotiateCapability,
|
|
19
19
|
listPeers,
|
|
20
|
+
// V2 (Phase 81)
|
|
21
|
+
TASK_STATUS_V2,
|
|
22
|
+
CARD_STATUS_V2,
|
|
23
|
+
SUBSCRIPTION_TYPE,
|
|
24
|
+
NEGOTIATION_RESULT,
|
|
25
|
+
validateAgentCard,
|
|
26
|
+
setCardStatus,
|
|
27
|
+
getCardStatusV2,
|
|
28
|
+
sendTaskV2,
|
|
29
|
+
startWorking,
|
|
30
|
+
requestInput,
|
|
31
|
+
provideInput,
|
|
32
|
+
completeTaskV2,
|
|
33
|
+
failTaskV2,
|
|
34
|
+
cancelTask,
|
|
35
|
+
checkTaskTimeout,
|
|
36
|
+
getTaskV2,
|
|
37
|
+
listTasksV2,
|
|
38
|
+
negotiateCapabilityV2,
|
|
39
|
+
getA2AStatsV2,
|
|
20
40
|
} from "../lib/a2a-protocol.js";
|
|
21
41
|
|
|
22
42
|
export function registerA2aCommand(program) {
|
|
@@ -371,4 +391,364 @@ export function registerA2aCommand(program) {
|
|
|
371
391
|
process.exit(1);
|
|
372
392
|
}
|
|
373
393
|
});
|
|
394
|
+
|
|
395
|
+
// ═══════════════════════════════════════════════════════════════
|
|
396
|
+
// Phase 81 — A2A Protocol V2
|
|
397
|
+
// ═══════════════════════════════════════════════════════════════
|
|
398
|
+
|
|
399
|
+
// Enum listings (no DB required)
|
|
400
|
+
a2a
|
|
401
|
+
.command("task-statuses")
|
|
402
|
+
.description("List V2 task statuses (Phase 81)")
|
|
403
|
+
.option("--json", "Output as JSON")
|
|
404
|
+
.action((options) => {
|
|
405
|
+
const statuses = Object.values(TASK_STATUS_V2);
|
|
406
|
+
if (options.json) console.log(JSON.stringify(statuses, null, 2));
|
|
407
|
+
else statuses.forEach((s) => logger.log(` ${s}`));
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
a2a
|
|
411
|
+
.command("card-statuses")
|
|
412
|
+
.description("List V2 card statuses (Phase 81)")
|
|
413
|
+
.option("--json", "Output as JSON")
|
|
414
|
+
.action((options) => {
|
|
415
|
+
const statuses = Object.values(CARD_STATUS_V2);
|
|
416
|
+
if (options.json) console.log(JSON.stringify(statuses, null, 2));
|
|
417
|
+
else statuses.forEach((s) => logger.log(` ${s}`));
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
a2a
|
|
421
|
+
.command("subscription-types")
|
|
422
|
+
.description("List V2 subscription types (Phase 81)")
|
|
423
|
+
.option("--json", "Output as JSON")
|
|
424
|
+
.action((options) => {
|
|
425
|
+
const types = Object.values(SUBSCRIPTION_TYPE);
|
|
426
|
+
if (options.json) console.log(JSON.stringify(types, null, 2));
|
|
427
|
+
else types.forEach((t) => logger.log(` ${t}`));
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
a2a
|
|
431
|
+
.command("negotiation-results")
|
|
432
|
+
.description("List V2 negotiation outcomes (Phase 81)")
|
|
433
|
+
.option("--json", "Output as JSON")
|
|
434
|
+
.action((options) => {
|
|
435
|
+
const outcomes = Object.values(NEGOTIATION_RESULT);
|
|
436
|
+
if (options.json) console.log(JSON.stringify(outcomes, null, 2));
|
|
437
|
+
else outcomes.forEach((o) => logger.log(` ${o}`));
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
// validate-card — pure, no DB
|
|
441
|
+
a2a
|
|
442
|
+
.command("validate-card")
|
|
443
|
+
.description("Validate an agent card against the A2A schema")
|
|
444
|
+
.argument("<name>", "Agent name")
|
|
445
|
+
.option("--description <desc>", "Description", "")
|
|
446
|
+
.option("--url <url>", "URL", "")
|
|
447
|
+
.option("--capabilities <csv>", "Capabilities CSV", "")
|
|
448
|
+
.option("--skills <csv>", "Skills CSV", "")
|
|
449
|
+
.option("--card-version <semver>", "Card version (major.minor.patch)")
|
|
450
|
+
.option("--auth-type <t>", "Auth type (none|bearer|basic|oauth2)")
|
|
451
|
+
.option("--json", "Output as JSON")
|
|
452
|
+
.action((name, options) => {
|
|
453
|
+
const card = {
|
|
454
|
+
name,
|
|
455
|
+
description: options.description,
|
|
456
|
+
url: options.url,
|
|
457
|
+
capabilities: options.capabilities
|
|
458
|
+
? options.capabilities.split(",").map((s) => s.trim())
|
|
459
|
+
: [],
|
|
460
|
+
skills: options.skills
|
|
461
|
+
? options.skills.split(",").map((s) => s.trim())
|
|
462
|
+
: [],
|
|
463
|
+
};
|
|
464
|
+
if (options.cardVersion) card.version = options.cardVersion;
|
|
465
|
+
if (options.authType) card.auth_type = options.authType;
|
|
466
|
+
const result = validateAgentCard(card);
|
|
467
|
+
if (options.json) {
|
|
468
|
+
console.log(JSON.stringify(result, null, 2));
|
|
469
|
+
} else if (result.valid) {
|
|
470
|
+
logger.success("Card is valid");
|
|
471
|
+
} else {
|
|
472
|
+
logger.warn("Card is invalid");
|
|
473
|
+
result.errors.forEach((e) => logger.log(` - ${e}`));
|
|
474
|
+
process.exit(1);
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
// set-card-status <cardId> <status>
|
|
479
|
+
a2a
|
|
480
|
+
.command("set-card-status")
|
|
481
|
+
.description("Transition a card between active/inactive/expired")
|
|
482
|
+
.argument("<cardId>", "Card ID")
|
|
483
|
+
.argument("<status>", "active|inactive|expired")
|
|
484
|
+
.option("--json", "Output as JSON")
|
|
485
|
+
.action(async (cardId, status, options) => {
|
|
486
|
+
try {
|
|
487
|
+
const ctx = await bootstrap({ verbose: program.opts().verbose });
|
|
488
|
+
const db = ctx.db?.getDatabase?.() || null;
|
|
489
|
+
const result = setCardStatus(db, cardId, status);
|
|
490
|
+
if (options.json) console.log(JSON.stringify(result, null, 2));
|
|
491
|
+
else logger.success(`Card ${cardId} → ${status}`);
|
|
492
|
+
await shutdown();
|
|
493
|
+
} catch (err) {
|
|
494
|
+
logger.error(`Failed: ${err.message}`);
|
|
495
|
+
process.exit(1);
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
// card-status <cardId>
|
|
500
|
+
a2a
|
|
501
|
+
.command("card-status")
|
|
502
|
+
.description("Show a card's V2 status")
|
|
503
|
+
.argument("<cardId>", "Card ID")
|
|
504
|
+
.option("--json", "Output as JSON")
|
|
505
|
+
.action((cardId, options) => {
|
|
506
|
+
const status = getCardStatusV2(cardId);
|
|
507
|
+
if (options.json) console.log(JSON.stringify({ cardId, status }));
|
|
508
|
+
else logger.log(`${cardId}: ${status}`);
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
// send-task-v2 <agentId> <input> [--timeout-ms N]
|
|
512
|
+
a2a
|
|
513
|
+
.command("send-task-v2")
|
|
514
|
+
.description("Submit a V2 task (in-memory, with optional timeout)")
|
|
515
|
+
.argument("<agentId>", "Agent ID")
|
|
516
|
+
.argument("<input>", "Task input")
|
|
517
|
+
.option("--timeout-ms <ms>", "Timeout in ms", parseInt)
|
|
518
|
+
.option("--json", "Output as JSON")
|
|
519
|
+
.action((agentId, input, options) => {
|
|
520
|
+
const res = sendTaskV2(null, {
|
|
521
|
+
agentId,
|
|
522
|
+
input,
|
|
523
|
+
timeoutMs: options.timeoutMs,
|
|
524
|
+
});
|
|
525
|
+
if (options.json) console.log(JSON.stringify(res, null, 2));
|
|
526
|
+
else logger.success(`Task ${res.taskId} submitted`);
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
a2a
|
|
530
|
+
.command("start-working")
|
|
531
|
+
.description("Transition a V2 task to working")
|
|
532
|
+
.argument("<taskId>", "Task ID")
|
|
533
|
+
.option("--json", "Output as JSON")
|
|
534
|
+
.action((taskId, options) => {
|
|
535
|
+
try {
|
|
536
|
+
const res = startWorking(null, taskId);
|
|
537
|
+
if (options.json) console.log(JSON.stringify(res, null, 2));
|
|
538
|
+
else logger.success(`Task ${taskId} → working`);
|
|
539
|
+
} catch (err) {
|
|
540
|
+
logger.error(err.message);
|
|
541
|
+
process.exit(1);
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
a2a
|
|
546
|
+
.command("request-input")
|
|
547
|
+
.description("Request user input while a V2 task is working")
|
|
548
|
+
.argument("<taskId>", "Task ID")
|
|
549
|
+
.argument("<prompt>", "Prompt to surface")
|
|
550
|
+
.option("--json", "Output as JSON")
|
|
551
|
+
.action((taskId, prompt, options) => {
|
|
552
|
+
try {
|
|
553
|
+
const res = requestInput(null, taskId, prompt);
|
|
554
|
+
if (options.json) console.log(JSON.stringify(res, null, 2));
|
|
555
|
+
else logger.success(`Task ${taskId} → input-required`);
|
|
556
|
+
} catch (err) {
|
|
557
|
+
logger.error(err.message);
|
|
558
|
+
process.exit(1);
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
a2a
|
|
563
|
+
.command("provide-input")
|
|
564
|
+
.description("Provide input for an input-required V2 task")
|
|
565
|
+
.argument("<taskId>", "Task ID")
|
|
566
|
+
.argument("<input>", "User-provided input")
|
|
567
|
+
.option("--json", "Output as JSON")
|
|
568
|
+
.action((taskId, input, options) => {
|
|
569
|
+
try {
|
|
570
|
+
const res = provideInput(null, taskId, input);
|
|
571
|
+
if (options.json) console.log(JSON.stringify(res, null, 2));
|
|
572
|
+
else logger.success(`Task ${taskId} → working`);
|
|
573
|
+
} catch (err) {
|
|
574
|
+
logger.error(err.message);
|
|
575
|
+
process.exit(1);
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
a2a
|
|
580
|
+
.command("complete-task-v2")
|
|
581
|
+
.description("Complete a V2 task (from working only)")
|
|
582
|
+
.argument("<taskId>", "Task ID")
|
|
583
|
+
.argument("[output]", "Task output", "")
|
|
584
|
+
.option("--json", "Output as JSON")
|
|
585
|
+
.action((taskId, output, options) => {
|
|
586
|
+
try {
|
|
587
|
+
const res = completeTaskV2(null, taskId, output);
|
|
588
|
+
if (options.json) console.log(JSON.stringify(res, null, 2));
|
|
589
|
+
else logger.success(`Task ${taskId} → completed`);
|
|
590
|
+
} catch (err) {
|
|
591
|
+
logger.error(err.message);
|
|
592
|
+
process.exit(1);
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
a2a
|
|
597
|
+
.command("fail-task-v2")
|
|
598
|
+
.description("Fail a V2 task with an error message")
|
|
599
|
+
.argument("<taskId>", "Task ID")
|
|
600
|
+
.argument("[error]", "Error message", "Unknown error")
|
|
601
|
+
.option("--json", "Output as JSON")
|
|
602
|
+
.action((taskId, error, options) => {
|
|
603
|
+
try {
|
|
604
|
+
const res = failTaskV2(null, taskId, error);
|
|
605
|
+
if (options.json) console.log(JSON.stringify(res, null, 2));
|
|
606
|
+
else logger.warn(`Task ${taskId} → failed`);
|
|
607
|
+
} catch (err) {
|
|
608
|
+
logger.error(err.message);
|
|
609
|
+
process.exit(1);
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
a2a
|
|
614
|
+
.command("cancel-task")
|
|
615
|
+
.description("Cancel a non-terminal V2 task")
|
|
616
|
+
.argument("<taskId>", "Task ID")
|
|
617
|
+
.argument("[reason]", "Cancel reason", "user_requested")
|
|
618
|
+
.option("--json", "Output as JSON")
|
|
619
|
+
.action((taskId, reason, options) => {
|
|
620
|
+
try {
|
|
621
|
+
const res = cancelTask(null, taskId, reason);
|
|
622
|
+
if (options.json) console.log(JSON.stringify(res, null, 2));
|
|
623
|
+
else logger.log(`Task ${taskId} → canceled`);
|
|
624
|
+
} catch (err) {
|
|
625
|
+
logger.error(err.message);
|
|
626
|
+
process.exit(1);
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
a2a
|
|
631
|
+
.command("check-timeout")
|
|
632
|
+
.description("Check V2 task timeout (auto-fails if past deadline)")
|
|
633
|
+
.argument("<taskId>", "Task ID")
|
|
634
|
+
.option("--json", "Output as JSON")
|
|
635
|
+
.action((taskId, options) => {
|
|
636
|
+
try {
|
|
637
|
+
const res = checkTaskTimeout(null, taskId);
|
|
638
|
+
if (options.json) console.log(JSON.stringify(res, null, 2));
|
|
639
|
+
else if (res.timedOut) logger.warn(`Task ${taskId} timed out`);
|
|
640
|
+
else logger.log(`Task ${taskId} status: ${res.status}`);
|
|
641
|
+
} catch (err) {
|
|
642
|
+
logger.error(err.message);
|
|
643
|
+
process.exit(1);
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
a2a
|
|
648
|
+
.command("task-v2")
|
|
649
|
+
.description("Show a V2 task snapshot")
|
|
650
|
+
.argument("<taskId>", "Task ID")
|
|
651
|
+
.option("--json", "Output as JSON")
|
|
652
|
+
.action((taskId, options) => {
|
|
653
|
+
try {
|
|
654
|
+
const task = getTaskV2(taskId);
|
|
655
|
+
if (options.json) console.log(JSON.stringify(task, null, 2));
|
|
656
|
+
else {
|
|
657
|
+
logger.log(`Task: ${task.taskId}`);
|
|
658
|
+
logger.log(` Agent: ${task.agentId}`);
|
|
659
|
+
logger.log(` Status: ${task.status}`);
|
|
660
|
+
logger.log(` History: ${task.history.length} entries`);
|
|
661
|
+
if (task.deadline)
|
|
662
|
+
logger.log(` Deadline: ${new Date(task.deadline).toISOString()}`);
|
|
663
|
+
if (task.inputPrompt) logger.log(` Prompt: ${task.inputPrompt}`);
|
|
664
|
+
if (task.cancelReason) logger.log(` Cancel: ${task.cancelReason}`);
|
|
665
|
+
}
|
|
666
|
+
} catch (err) {
|
|
667
|
+
logger.error(err.message);
|
|
668
|
+
process.exit(1);
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
a2a
|
|
673
|
+
.command("tasks-v2")
|
|
674
|
+
.description("List V2 tasks")
|
|
675
|
+
.option("--agent-id <id>", "Filter by agent ID")
|
|
676
|
+
.option("--status <s>", "Filter by status")
|
|
677
|
+
.option("--json", "Output as JSON")
|
|
678
|
+
.action((options) => {
|
|
679
|
+
const filter = {};
|
|
680
|
+
if (options.agentId) filter.agentId = options.agentId;
|
|
681
|
+
if (options.status) filter.status = options.status;
|
|
682
|
+
const tasks = listTasksV2(filter);
|
|
683
|
+
if (options.json) console.log(JSON.stringify(tasks, null, 2));
|
|
684
|
+
else {
|
|
685
|
+
if (!tasks.length) {
|
|
686
|
+
logger.log("No V2 tasks");
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
tasks.forEach((t) => {
|
|
690
|
+
logger.log(
|
|
691
|
+
` ${t.taskId} [${t.status}] agent=${t.agentId} history=${t.history.length}`,
|
|
692
|
+
);
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
a2a
|
|
698
|
+
.command("negotiate-v2")
|
|
699
|
+
.description("Phase 81 capability negotiation against an agent card")
|
|
700
|
+
.argument("<cardJson>", "Agent card as JSON string")
|
|
701
|
+
.option("--required <csv>", "Required capabilities CSV", "")
|
|
702
|
+
.option("--preferred <csv>", "Preferred capabilities CSV", "")
|
|
703
|
+
.option("--client-version <semver>", "Client version")
|
|
704
|
+
.option("--json", "Output as JSON")
|
|
705
|
+
.action((cardJson, options) => {
|
|
706
|
+
let card;
|
|
707
|
+
try {
|
|
708
|
+
card = JSON.parse(cardJson);
|
|
709
|
+
} catch (_err) {
|
|
710
|
+
logger.error("cardJson must be valid JSON");
|
|
711
|
+
process.exit(1);
|
|
712
|
+
}
|
|
713
|
+
const result = negotiateCapabilityV2(card, {
|
|
714
|
+
required: options.required
|
|
715
|
+
? options.required.split(",").map((s) => s.trim())
|
|
716
|
+
: [],
|
|
717
|
+
preferred: options.preferred
|
|
718
|
+
? options.preferred.split(",").map((s) => s.trim())
|
|
719
|
+
: [],
|
|
720
|
+
version: options.clientVersion,
|
|
721
|
+
});
|
|
722
|
+
if (options.json) console.log(JSON.stringify(result, null, 2));
|
|
723
|
+
else {
|
|
724
|
+
logger.log(`Result: ${result.result}`);
|
|
725
|
+
if (result.missingRequired.length)
|
|
726
|
+
logger.log(
|
|
727
|
+
` Missing required: ${result.missingRequired.join(", ")}`,
|
|
728
|
+
);
|
|
729
|
+
if (result.missingPreferred.length)
|
|
730
|
+
logger.log(
|
|
731
|
+
` Missing preferred: ${result.missingPreferred.join(", ")}`,
|
|
732
|
+
);
|
|
733
|
+
logger.log(` Version OK: ${result.versionOk}`);
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
a2a
|
|
738
|
+
.command("stats-v2")
|
|
739
|
+
.description("Aggregate V2 stats (tasks + cards + subscriptions)")
|
|
740
|
+
.option("--json", "Output as JSON")
|
|
741
|
+
.action((options) => {
|
|
742
|
+
const s = getA2AStatsV2();
|
|
743
|
+
if (options.json) console.log(JSON.stringify(s, null, 2));
|
|
744
|
+
else {
|
|
745
|
+
logger.log("A2A V2 Stats:");
|
|
746
|
+
logger.log(` Tasks total: ${s.tasks.total}`);
|
|
747
|
+
logger.log(` Tasks by status: ${JSON.stringify(s.tasks.byStatus)}`);
|
|
748
|
+
logger.log(` With deadline: ${s.tasks.withDeadline}`);
|
|
749
|
+
logger.log(` Cards tracked: ${s.cards.tracked}`);
|
|
750
|
+
logger.log(` Subs (legacy): ${s.subscriptions.legacy}`);
|
|
751
|
+
logger.log(` Subs (typed): ${s.subscriptions.typed}`);
|
|
752
|
+
}
|
|
753
|
+
});
|
|
374
754
|
}
|
|
@@ -50,6 +50,37 @@ import {
|
|
|
50
50
|
getTopAgents,
|
|
51
51
|
getNetworkStats,
|
|
52
52
|
getNetworkConfig,
|
|
53
|
+
AGENT_MATURITY_V2,
|
|
54
|
+
TASK_LIFECYCLE_V2,
|
|
55
|
+
getMaxActiveAgentsPerNetworkV2,
|
|
56
|
+
setMaxActiveAgentsPerNetworkV2,
|
|
57
|
+
getMaxPendingTasksPerAgentV2,
|
|
58
|
+
setMaxPendingTasksPerAgentV2,
|
|
59
|
+
getAgentIdleMsV2,
|
|
60
|
+
setAgentIdleMsV2,
|
|
61
|
+
getTaskStuckMsV2,
|
|
62
|
+
setTaskStuckMsV2,
|
|
63
|
+
registerAgentV2,
|
|
64
|
+
getAgentV2,
|
|
65
|
+
listAgentsV2,
|
|
66
|
+
setAgentStatusV2,
|
|
67
|
+
activateAgentV2,
|
|
68
|
+
suspendAgentV2,
|
|
69
|
+
revokeAgentV2,
|
|
70
|
+
touchAgentV2,
|
|
71
|
+
createTaskV2,
|
|
72
|
+
getTaskV2,
|
|
73
|
+
listTasksV2,
|
|
74
|
+
setTaskStatusV2,
|
|
75
|
+
startTaskV2,
|
|
76
|
+
completeTaskV2,
|
|
77
|
+
failTaskV2,
|
|
78
|
+
cancelTaskV2,
|
|
79
|
+
getActiveAgentCountV2,
|
|
80
|
+
getPendingTaskCountV2,
|
|
81
|
+
autoSuspendIdleAgentsV2,
|
|
82
|
+
autoFailStuckTasksV2,
|
|
83
|
+
getAgentNetworkStatsV2,
|
|
53
84
|
} from "../lib/agent-network.js";
|
|
54
85
|
|
|
55
86
|
function _dbFromCtx(cmd) {
|
|
@@ -81,7 +112,8 @@ export function registerAgentNetworkCommand(program) {
|
|
|
81
112
|
.description(
|
|
82
113
|
"Decentralized Agent Network (Phase 24) — DID / registry / credentials / task routing",
|
|
83
114
|
)
|
|
84
|
-
.hook("preAction", (thisCmd) => {
|
|
115
|
+
.hook("preAction", (thisCmd, actionCommand) => {
|
|
116
|
+
if (actionCommand && actionCommand.name().endsWith("-v2")) return;
|
|
85
117
|
const db = _dbFromCtx(thisCmd);
|
|
86
118
|
if (db) ensureAgentNetworkTables(db);
|
|
87
119
|
});
|
|
@@ -780,6 +812,227 @@ export function registerAgentNetworkCommand(program) {
|
|
|
780
812
|
console.log(`Peers: ${s.peers}`);
|
|
781
813
|
});
|
|
782
814
|
|
|
815
|
+
// ─── V2 Governance Layer ──────────────────────────────────────────
|
|
816
|
+
const out = (obj) => console.log(JSON.stringify(obj, null, 2));
|
|
817
|
+
const tryRun = (fn) => {
|
|
818
|
+
try {
|
|
819
|
+
fn();
|
|
820
|
+
} catch (err) {
|
|
821
|
+
console.error(err.message);
|
|
822
|
+
process.exit(1);
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
anet
|
|
827
|
+
.command("agent-maturities-v2")
|
|
828
|
+
.description("List V2 agent maturity states")
|
|
829
|
+
.action(() => out(Object.values(AGENT_MATURITY_V2)));
|
|
830
|
+
|
|
831
|
+
anet
|
|
832
|
+
.command("task-lifecycles-v2")
|
|
833
|
+
.description("List V2 task lifecycle states")
|
|
834
|
+
.action(() => out(Object.values(TASK_LIFECYCLE_V2)));
|
|
835
|
+
|
|
836
|
+
anet
|
|
837
|
+
.command("stats-v2")
|
|
838
|
+
.description("V2 agent-network stats")
|
|
839
|
+
.action(() => out(getAgentNetworkStatsV2()));
|
|
840
|
+
|
|
841
|
+
anet
|
|
842
|
+
.command("get-max-active-agents-v2")
|
|
843
|
+
.description("Get max active agents per network (V2)")
|
|
844
|
+
.action(() =>
|
|
845
|
+
out({ maxActiveAgentsPerNetwork: getMaxActiveAgentsPerNetworkV2() }),
|
|
846
|
+
);
|
|
847
|
+
|
|
848
|
+
anet
|
|
849
|
+
.command("set-max-active-agents-v2 <n>")
|
|
850
|
+
.description("Set max active agents per network (V2)")
|
|
851
|
+
.action((n) =>
|
|
852
|
+
tryRun(() => {
|
|
853
|
+
setMaxActiveAgentsPerNetworkV2(Number(n));
|
|
854
|
+
out({ maxActiveAgentsPerNetwork: getMaxActiveAgentsPerNetworkV2() });
|
|
855
|
+
}),
|
|
856
|
+
);
|
|
857
|
+
|
|
858
|
+
anet
|
|
859
|
+
.command("get-max-pending-tasks-v2")
|
|
860
|
+
.description("Get max pending tasks per agent (V2)")
|
|
861
|
+
.action(() =>
|
|
862
|
+
out({ maxPendingTasksPerAgent: getMaxPendingTasksPerAgentV2() }),
|
|
863
|
+
);
|
|
864
|
+
|
|
865
|
+
anet
|
|
866
|
+
.command("set-max-pending-tasks-v2 <n>")
|
|
867
|
+
.description("Set max pending tasks per agent (V2)")
|
|
868
|
+
.action((n) =>
|
|
869
|
+
tryRun(() => {
|
|
870
|
+
setMaxPendingTasksPerAgentV2(Number(n));
|
|
871
|
+
out({ maxPendingTasksPerAgent: getMaxPendingTasksPerAgentV2() });
|
|
872
|
+
}),
|
|
873
|
+
);
|
|
874
|
+
|
|
875
|
+
anet
|
|
876
|
+
.command("get-agent-idle-ms-v2")
|
|
877
|
+
.description("Get agent idle threshold (V2)")
|
|
878
|
+
.action(() => out({ agentIdleMs: getAgentIdleMsV2() }));
|
|
879
|
+
|
|
880
|
+
anet
|
|
881
|
+
.command("set-agent-idle-ms-v2 <ms>")
|
|
882
|
+
.description("Set agent idle threshold (V2)")
|
|
883
|
+
.action((ms) =>
|
|
884
|
+
tryRun(() => {
|
|
885
|
+
setAgentIdleMsV2(Number(ms));
|
|
886
|
+
out({ agentIdleMs: getAgentIdleMsV2() });
|
|
887
|
+
}),
|
|
888
|
+
);
|
|
889
|
+
|
|
890
|
+
anet
|
|
891
|
+
.command("get-task-stuck-ms-v2")
|
|
892
|
+
.description("Get task stuck threshold (V2)")
|
|
893
|
+
.action(() => out({ taskStuckMs: getTaskStuckMsV2() }));
|
|
894
|
+
|
|
895
|
+
anet
|
|
896
|
+
.command("set-task-stuck-ms-v2 <ms>")
|
|
897
|
+
.description("Set task stuck threshold (V2)")
|
|
898
|
+
.action((ms) =>
|
|
899
|
+
tryRun(() => {
|
|
900
|
+
setTaskStuckMsV2(Number(ms));
|
|
901
|
+
out({ taskStuckMs: getTaskStuckMsV2() });
|
|
902
|
+
}),
|
|
903
|
+
);
|
|
904
|
+
|
|
905
|
+
anet
|
|
906
|
+
.command("active-agent-count-v2 <networkId>")
|
|
907
|
+
.description("Active agent count for network (V2)")
|
|
908
|
+
.action((networkId) =>
|
|
909
|
+
out({ networkId, count: getActiveAgentCountV2(networkId) }),
|
|
910
|
+
);
|
|
911
|
+
|
|
912
|
+
anet
|
|
913
|
+
.command("pending-task-count-v2 <agentId>")
|
|
914
|
+
.description("Pending task count for agent (V2)")
|
|
915
|
+
.action((agentId) =>
|
|
916
|
+
out({ agentId, count: getPendingTaskCountV2(agentId) }),
|
|
917
|
+
);
|
|
918
|
+
|
|
919
|
+
anet
|
|
920
|
+
.command("register-agent-v2 <id>")
|
|
921
|
+
.description("Register a V2 agent")
|
|
922
|
+
.requiredOption("-n, --network <id>", "network id")
|
|
923
|
+
.requiredOption("-d, --did <did>", "agent DID")
|
|
924
|
+
.option("--display <name>", "display name")
|
|
925
|
+
.action((id, opts) =>
|
|
926
|
+
tryRun(() =>
|
|
927
|
+
out(
|
|
928
|
+
registerAgentV2(id, {
|
|
929
|
+
networkId: opts.network,
|
|
930
|
+
did: opts.did,
|
|
931
|
+
displayName: opts.display,
|
|
932
|
+
}),
|
|
933
|
+
),
|
|
934
|
+
),
|
|
935
|
+
);
|
|
936
|
+
|
|
937
|
+
anet
|
|
938
|
+
.command("get-agent-v2 <id>")
|
|
939
|
+
.description("Get a V2 agent")
|
|
940
|
+
.action((id) => out(getAgentV2(id)));
|
|
941
|
+
|
|
942
|
+
anet
|
|
943
|
+
.command("list-agents-v2")
|
|
944
|
+
.description("List V2 agents")
|
|
945
|
+
.option("-n, --network <id>", "filter by network")
|
|
946
|
+
.option("-s, --status <status>", "filter by status")
|
|
947
|
+
.action((opts) =>
|
|
948
|
+
out(listAgentsV2({ networkId: opts.network, status: opts.status })),
|
|
949
|
+
);
|
|
950
|
+
|
|
951
|
+
anet
|
|
952
|
+
.command("set-agent-status-v2 <id> <next>")
|
|
953
|
+
.description("Set V2 agent status")
|
|
954
|
+
.action((id, next) => tryRun(() => out(setAgentStatusV2(id, next))));
|
|
955
|
+
|
|
956
|
+
anet
|
|
957
|
+
.command("activate-agent-v2 <id>")
|
|
958
|
+
.description("Activate a V2 agent")
|
|
959
|
+
.action((id) => tryRun(() => out(activateAgentV2(id))));
|
|
960
|
+
|
|
961
|
+
anet
|
|
962
|
+
.command("suspend-agent-v2 <id>")
|
|
963
|
+
.description("Suspend a V2 agent")
|
|
964
|
+
.action((id) => tryRun(() => out(suspendAgentV2(id))));
|
|
965
|
+
|
|
966
|
+
anet
|
|
967
|
+
.command("revoke-agent-v2 <id>")
|
|
968
|
+
.description("Revoke a V2 agent")
|
|
969
|
+
.action((id) => tryRun(() => out(revokeAgentV2(id))));
|
|
970
|
+
|
|
971
|
+
anet
|
|
972
|
+
.command("touch-agent-v2 <id>")
|
|
973
|
+
.description("Touch a V2 agent")
|
|
974
|
+
.action((id) => tryRun(() => out(touchAgentV2(id))));
|
|
975
|
+
|
|
976
|
+
anet
|
|
977
|
+
.command("create-task-v2 <id>")
|
|
978
|
+
.description("Create a V2 task")
|
|
979
|
+
.requiredOption("-a, --agent <id>", "agent id")
|
|
980
|
+
.option("-k, --kind <kind>", "task kind", "invoke")
|
|
981
|
+
.action((id, opts) =>
|
|
982
|
+
tryRun(() =>
|
|
983
|
+
out(createTaskV2(id, { agentId: opts.agent, kind: opts.kind })),
|
|
984
|
+
),
|
|
985
|
+
);
|
|
986
|
+
|
|
987
|
+
anet
|
|
988
|
+
.command("get-task-v2 <id>")
|
|
989
|
+
.description("Get a V2 task")
|
|
990
|
+
.action((id) => out(getTaskV2(id)));
|
|
991
|
+
|
|
992
|
+
anet
|
|
993
|
+
.command("list-tasks-v2")
|
|
994
|
+
.description("List V2 tasks")
|
|
995
|
+
.option("-a, --agent <id>", "filter by agent")
|
|
996
|
+
.option("-s, --status <status>", "filter by status")
|
|
997
|
+
.action((opts) =>
|
|
998
|
+
out(listTasksV2({ agentId: opts.agent, status: opts.status })),
|
|
999
|
+
);
|
|
1000
|
+
|
|
1001
|
+
anet
|
|
1002
|
+
.command("set-task-status-v2 <id> <next>")
|
|
1003
|
+
.description("Set V2 task status")
|
|
1004
|
+
.action((id, next) => tryRun(() => out(setTaskStatusV2(id, next))));
|
|
1005
|
+
|
|
1006
|
+
anet
|
|
1007
|
+
.command("start-task-v2 <id>")
|
|
1008
|
+
.description("Start a V2 task")
|
|
1009
|
+
.action((id) => tryRun(() => out(startTaskV2(id))));
|
|
1010
|
+
|
|
1011
|
+
anet
|
|
1012
|
+
.command("complete-task-v2 <id>")
|
|
1013
|
+
.description("Complete a V2 task")
|
|
1014
|
+
.action((id) => tryRun(() => out(completeTaskV2(id))));
|
|
1015
|
+
|
|
1016
|
+
anet
|
|
1017
|
+
.command("fail-task-v2 <id>")
|
|
1018
|
+
.description("Fail a V2 task")
|
|
1019
|
+
.action((id) => tryRun(() => out(failTaskV2(id))));
|
|
1020
|
+
|
|
1021
|
+
anet
|
|
1022
|
+
.command("cancel-task-v2 <id>")
|
|
1023
|
+
.description("Cancel a V2 task")
|
|
1024
|
+
.action((id) => tryRun(() => out(cancelTaskV2(id))));
|
|
1025
|
+
|
|
1026
|
+
anet
|
|
1027
|
+
.command("auto-suspend-idle-agents-v2")
|
|
1028
|
+
.description("Auto-suspend idle V2 agents")
|
|
1029
|
+
.action(() => out(autoSuspendIdleAgentsV2()));
|
|
1030
|
+
|
|
1031
|
+
anet
|
|
1032
|
+
.command("auto-fail-stuck-tasks-v2")
|
|
1033
|
+
.description("Auto-fail stuck V2 tasks")
|
|
1034
|
+
.action(() => out(autoFailStuckTasksV2()));
|
|
1035
|
+
|
|
783
1036
|
program.addCommand(anet);
|
|
784
1037
|
return anet;
|
|
785
1038
|
}
|