delimit-cli 3.15.7 → 3.15.8
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/gateway/ai/server.py +8 -0
- package/gateway/ai/swarm.py +98 -0
- package/package.json +1 -1
package/gateway/ai/server.py
CHANGED
|
@@ -3684,6 +3684,14 @@ def delimit_swarm(action: str = "status", venture: str = "",
|
|
|
3684
3684
|
return _with_next_steps("swarm", _safe_call(
|
|
3685
3685
|
check_namespace_access, agent_id=agent_id, target_path=target_path, action=access_action,
|
|
3686
3686
|
))
|
|
3687
|
+
if action == "metric":
|
|
3688
|
+
from ai.swarm import record_metric
|
|
3689
|
+
return _with_next_steps("swarm", _safe_call(
|
|
3690
|
+
record_metric, venture=venture, metric_type=access_action, note=target_path,
|
|
3691
|
+
))
|
|
3692
|
+
if action == "metrics":
|
|
3693
|
+
from ai.swarm import get_metrics
|
|
3694
|
+
return _with_next_steps("swarm", _safe_call(get_metrics, venture=venture))
|
|
3687
3695
|
return _with_next_steps("swarm", _safe_call(get_swarm_status))
|
|
3688
3696
|
|
|
3689
3697
|
|
package/gateway/ai/swarm.py
CHANGED
|
@@ -395,3 +395,101 @@ Medium alerts: prompt drift, model errors, credit exhaustion.
|
|
|
395
395
|
def get_usage_guide() -> Dict[str, Any]:
|
|
396
396
|
"""Get the swarm usage guide."""
|
|
397
397
|
return {"guide": USAGE_GUIDE, "version": "1.2"}
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
# ═══════════════════════════════════════════════════════════════════════
|
|
401
|
+
# LED-278: GTM Tracking — speed, revenue, venture launches
|
|
402
|
+
# ═══════════════════════════════════════════════════════════════════════
|
|
403
|
+
|
|
404
|
+
METRICS_FILE = SWARM_DIR / "metrics.json"
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def _load_metrics() -> Dict[str, Any]:
|
|
408
|
+
if not METRICS_FILE.exists():
|
|
409
|
+
return {"daily": {}, "ventures": {}}
|
|
410
|
+
try:
|
|
411
|
+
return json.loads(METRICS_FILE.read_text())
|
|
412
|
+
except (json.JSONDecodeError, OSError):
|
|
413
|
+
return {"daily": {}, "ventures": {}}
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def _save_metrics(metrics: Dict[str, Any]):
|
|
417
|
+
_ensure_dir()
|
|
418
|
+
METRICS_FILE.write_text(json.dumps(metrics, indent=2))
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
def record_metric(
|
|
422
|
+
venture: str,
|
|
423
|
+
metric_type: str,
|
|
424
|
+
value: float = 1.0,
|
|
425
|
+
note: str = "",
|
|
426
|
+
) -> Dict[str, Any]:
|
|
427
|
+
"""Record a GTM metric for tracking swarm performance.
|
|
428
|
+
|
|
429
|
+
Metric types: tasks_completed, deploy_count, revenue, launch_event,
|
|
430
|
+
outreach_sent, user_signup, feature_shipped.
|
|
431
|
+
"""
|
|
432
|
+
if not venture or not metric_type:
|
|
433
|
+
return {"error": "venture and metric_type required"}
|
|
434
|
+
|
|
435
|
+
metrics = _load_metrics()
|
|
436
|
+
today = time.strftime("%Y-%m-%d")
|
|
437
|
+
|
|
438
|
+
# Daily tracking
|
|
439
|
+
if today not in metrics["daily"]:
|
|
440
|
+
metrics["daily"][today] = {}
|
|
441
|
+
day = metrics["daily"][today]
|
|
442
|
+
key = f"{venture}:{metric_type}"
|
|
443
|
+
day[key] = day.get(key, 0) + value
|
|
444
|
+
|
|
445
|
+
# Venture totals
|
|
446
|
+
if venture not in metrics["ventures"]:
|
|
447
|
+
metrics["ventures"][venture] = {}
|
|
448
|
+
vtotals = metrics["ventures"][venture]
|
|
449
|
+
vtotals[metric_type] = vtotals.get(metric_type, 0) + value
|
|
450
|
+
|
|
451
|
+
_save_metrics(metrics)
|
|
452
|
+
_log({"action": "metric", "venture": venture, "type": metric_type, "value": value, "note": note})
|
|
453
|
+
|
|
454
|
+
return {
|
|
455
|
+
"status": "recorded",
|
|
456
|
+
"venture": venture,
|
|
457
|
+
"metric": metric_type,
|
|
458
|
+
"value": value,
|
|
459
|
+
"today_total": day[key],
|
|
460
|
+
"all_time": vtotals[metric_type],
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
def get_metrics(venture: str = "", days: int = 7) -> Dict[str, Any]:
|
|
465
|
+
"""Get GTM metrics — speed, revenue, launches across ventures.
|
|
466
|
+
|
|
467
|
+
Shows daily breakdown and venture totals. Used for dogfood tracking
|
|
468
|
+
and build-in-public content.
|
|
469
|
+
"""
|
|
470
|
+
metrics = _load_metrics()
|
|
471
|
+
|
|
472
|
+
# Filter by date range
|
|
473
|
+
today = time.strftime("%Y-%m-%d")
|
|
474
|
+
recent_days = {}
|
|
475
|
+
for date_str, day_data in sorted(metrics["daily"].items(), reverse=True)[:days]:
|
|
476
|
+
if venture:
|
|
477
|
+
filtered = {k: v for k, v in day_data.items() if k.startswith(f"{venture}:")}
|
|
478
|
+
if filtered:
|
|
479
|
+
recent_days[date_str] = filtered
|
|
480
|
+
else:
|
|
481
|
+
recent_days[date_str] = day_data
|
|
482
|
+
|
|
483
|
+
# Venture totals
|
|
484
|
+
if venture:
|
|
485
|
+
vtotals = metrics["ventures"].get(venture, {})
|
|
486
|
+
else:
|
|
487
|
+
vtotals = metrics["ventures"]
|
|
488
|
+
|
|
489
|
+
return {
|
|
490
|
+
"status": "ok",
|
|
491
|
+
"daily": recent_days,
|
|
492
|
+
"totals": vtotals,
|
|
493
|
+
"venture_filter": venture or "all",
|
|
494
|
+
"days": days,
|
|
495
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "delimit-cli",
|
|
3
3
|
"mcpName": "io.github.delimit-ai/delimit-mcp-server",
|
|
4
|
-
"version": "3.15.
|
|
4
|
+
"version": "3.15.8",
|
|
5
5
|
"description": "Unify Claude Code, Codex, Cursor, and Gemini CLI with persistent context, governance, and multi-model debate.",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|