delimit-cli 4.5.12 → 4.6.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +9 -8
  3. package/bin/delimit-cli.js +162 -1
  4. package/bin/delimit-setup.js +46 -6
  5. package/gateway/ai/_compile_status.py +154 -0
  6. package/gateway/ai/agent_dispatch.py +36 -0
  7. package/gateway/ai/backends/tools_infra.py +150 -10
  8. package/gateway/ai/daemon.py +10 -0
  9. package/gateway/ai/daily_digest.py +1 -2
  10. package/gateway/ai/delimit_daemon.py +67 -0
  11. package/gateway/ai/dispatch_gate.py +399 -0
  12. package/gateway/ai/hot_reload.py +1 -2
  13. package/gateway/ai/led193_daemon/executor.py +9 -0
  14. package/gateway/ai/ledger_manager.py +9 -0
  15. package/gateway/ai/license_core.cpython-310-x86_64-linux-gnu.so +0 -0
  16. package/gateway/ai/license_core.pyi +17 -19
  17. package/gateway/ai/notify.py +39 -0
  18. package/gateway/ai/outreach_substantive.py +676 -0
  19. package/gateway/ai/reaper.py +70 -0
  20. package/gateway/ai/reddit_scanner.py +10 -5
  21. package/gateway/ai/sensing/schema.py +1 -1
  22. package/gateway/ai/sensing/signal_store.py +0 -1
  23. package/gateway/ai/server.py +5171 -1462
  24. package/gateway/ai/social_capability/fit_floor.py +114 -12
  25. package/gateway/ai/tdqs_lint.py +611 -0
  26. package/gateway/ai/usage_allowlist.py +198 -0
  27. package/gateway/ai/workers/base.py +2 -2
  28. package/gateway/ai/workers/executor.py +32 -3
  29. package/gateway/ai/workers/outreach_drafter.py +0 -1
  30. package/gateway/ai/workers/pr_drafter.py +0 -1
  31. package/gateway/ai/x_ranker.py +12 -2
  32. package/gateway/core/json_schema_diff.py +25 -1
  33. package/lib/auth-signin.js +136 -0
  34. package/lib/auth-signout.js +169 -0
  35. package/lib/delimit-template.js +11 -0
  36. package/lib/migration-2092-banner.js +213 -0
  37. package/package.json +3 -3
  38. package/server.json +4 -4
@@ -0,0 +1,70 @@
1
+ import subprocess
2
+ import logging
3
+ import json
4
+ import time
5
+ import os
6
+ import re
7
+ from pathlib import Path
8
+ from typing import Dict, Any, List
9
+
10
+ logger = logging.getLogger("delimit.reaper")
11
+
12
+ def reap_agent_tasks(project_path: str = "/home/delimit/delimit-gateway") -> List[str]:
13
+ """Reap completed agent arms by checking for commits and merging."""
14
+ from ai.agent_dispatch import get_agent_status, complete_task
15
+ from ai.ledger_manager import update_item
16
+
17
+ # 1. Get all dispatched tasks
18
+ res = get_agent_status()
19
+ tasks = res.get("tasks", [])
20
+ if not isinstance(tasks, list):
21
+ tasks = list(tasks.values())
22
+
23
+ reaped = []
24
+ for task in tasks:
25
+ if task.get("status") != "dispatched":
26
+ continue
27
+
28
+ task_id = task.get("id")
29
+ desc = task.get("description", "")
30
+
31
+ # 2. Extract branch from description
32
+ match = re.search(r'branch ([\w/-]+)', desc)
33
+ if not match:
34
+ continue
35
+ branch = match.group(1)
36
+
37
+ # 3. Check for new commits on the branch
38
+ try:
39
+ cmd = ["git", "-C", project_path, "log", f"main..${branch}", "--oneline"]
40
+ p = subprocess.run(cmd, capture_output=True, text=True)
41
+ if p.returncode == 0 and p.stdout.strip():
42
+ logger.info(f"Reaper: Found activity on ${branch} for task ${task_id}")
43
+
44
+ # 4. RUN TESTS
45
+ test_cmd = ["python3", "-m", "pytest", "tests/", "-v", "--maxfail=3"]
46
+ env = {"DELIMIT_TEST_MODE": "1", "PATH": f"/root/.delimit/shims:${os.environ['PATH']}"}
47
+ test_p = subprocess.run(test_cmd, cwd=project_path, capture_output=True, text=True, env={**os.environ, **env})
48
+
49
+ if test_p.returncode == 0:
50
+ # 5. MERGE
51
+ subprocess.run(["git", "-C", project_path, "checkout", "main"], check=True)
52
+ subprocess.run(["git", "-C", project_path, "merge", branch], check=True)
53
+
54
+ # 6. COMPLETE
55
+ complete_task(task_id, result="Reaper: Actually built and merged to main.")
56
+
57
+ # 7. Update Ledger
58
+ ctx = task.get("context", "")
59
+ led_match = re.search(r'LED-(\d+)', ctx)
60
+ if led_match:
61
+ led_id = led_match.group(0)
62
+ update_item(item_id=led_id, status="done", note=f"Arm ${task_id} merged.")
63
+
64
+ reaped.append(task_id)
65
+ else:
66
+ logger.warning(f"Reaper: Tests failed for ${branch}, skipping merge.")
67
+ except Exception as e:
68
+ logger.warning(f"Reaper: Failed to reap task ${task_id}: ${e}")
69
+
70
+ return reaped
@@ -470,14 +470,19 @@ def score_and_classify(
470
470
  final_score = engagement * fresh_mult * comment_opp * relevance_mult
471
471
  is_karma = group == "karma_building"
472
472
 
473
- # Classification
474
- if post.get("stickied") or age_h > 48 or comments > 100:
473
+ # Classification (LED-1335 freshness tightening 2026-05-12: founder
474
+ # explicit "we want fresh posts for highest visibility." Comment
475
+ # visibility decays sharply after 6h, marginal after 12h, ~zero
476
+ # after 24h. Old behavior let 12-48h posts through as medium and
477
+ # the daemon drafted on them. New thresholds: hard-skip > 24h,
478
+ # high_priority < 6h, medium_priority < 12h, low_priority < 24h.)
479
+ if post.get("stickied") or age_h > 24 or comments > 100:
475
480
  priority = "skip"
476
- elif final_score >= 30 and age_h < 12 and comments < 50:
481
+ elif final_score >= 30 and age_h < 6 and comments < 50:
477
482
  priority = "high_priority"
478
- elif final_score >= 10 or (len(tags) >= 2 and age_h < 24):
483
+ elif (final_score >= 10 and age_h < 12) or (len(tags) >= 2 and age_h < 12):
479
484
  priority = "medium_priority"
480
- elif final_score >= 3:
485
+ elif final_score >= 3 and age_h < 24:
481
486
  priority = "low_priority"
482
487
  else:
483
488
  priority = "skip"
@@ -10,7 +10,7 @@ from __future__ import annotations
10
10
  import hashlib
11
11
  import re
12
12
  from dataclasses import dataclass, field, asdict
13
- from typing import Any, Dict, List, Optional
13
+ from typing import Any, Dict, List
14
14
  from urllib.parse import urlparse, urlunparse, parse_qsl, urlencode
15
15
 
16
16
 
@@ -12,7 +12,6 @@ from __future__ import annotations
12
12
 
13
13
  import json
14
14
  import os
15
- import time
16
15
  import uuid
17
16
  from collections import Counter, defaultdict
18
17
  from datetime import datetime, timedelta, timezone