@yasaswy.nagavolu/agents 0.10.0 → 0.11.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 (42) hide show
  1. package/bin/cli.js +56 -1
  2. package/content/agents/idea-agent/council_fanout.py +40 -8
  3. package/content/global/CLAUDE.md +1 -0
  4. package/content/global/hooks/ai_attribution_guard.py +6 -1
  5. package/content/global/hooks/large_file_read_guard.py +6 -2
  6. package/content/hooks/conclusion-scribe/conclusion-scribe.env.example +2 -1
  7. package/content/hooks/conclusion-scribe/conclusion_scribe_hook.py +827 -180
  8. package/content/hooks/conclusion-scribe/test_conclusion_scribe_hook.py +632 -298
  9. package/content/manifest.json +191 -32
  10. package/content/proxy/agent_dispatch_guard.py +6 -1
  11. package/content/proxy/agent_model_guard.py +6 -2
  12. package/content/proxy/artifact_mocker_gate.py +6 -2
  13. package/content/proxy/autostart_hook.py +7 -1
  14. package/content/proxy/code_is_law_lint_hook.py +6 -1
  15. package/content/proxy/code_is_law_prompt_nudge.py +6 -1
  16. package/content/proxy/execution_worker_review_gate.py +6 -2
  17. package/content/proxy/handover_ledger_hook.py +6 -2
  18. package/content/proxy/html_mocker_monitor_guard.py +6 -1
  19. package/content/proxy/html_mocker_prompt_nudge.py +6 -2
  20. package/content/proxy/html_mocker_subagent_guard.py +6 -1
  21. package/content/proxy/litellm/call_feed.ps1 +90 -0
  22. package/content/proxy/litellm/call_log.py +150 -0
  23. package/content/proxy/litellm/custom_callbacks.py +114 -0
  24. package/content/proxy/litellm/litellm_status.ps1 +104 -0
  25. package/content/proxy/litellm/litellm_watch.ps1 +108 -0
  26. package/content/proxy/litellm/smoke_test.py +182 -0
  27. package/content/proxy/litellm/start.ps1 +196 -18
  28. package/content/proxy/litellm/supervise_hidden.vbs +14 -0
  29. package/content/proxy/litellm/supervise_visible.vbs +25 -0
  30. package/content/proxy/managed_files_guard.py +6 -1
  31. package/content/proxy/publish_guard.py +6 -1
  32. package/content/proxy/reddit_intent_hook.py +6 -1
  33. package/content/proxy/triage_gate_hook.py +6 -2
  34. package/content/proxy/web_search_guard.py +6 -2
  35. package/content/skills/README.md +14 -0
  36. package/content/skills/launch-litellm/SKILL.md +53 -0
  37. package/content/skills/launch-litellm/launch_litellm.ps1 +177 -0
  38. package/content/skills/visual-check/compare.py +30 -4
  39. package/content/skills/web-search/search.py +25 -0
  40. package/lib/tty-menu.js +8 -3
  41. package/lib/version-banner.js +71 -0
  42. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -13,6 +13,8 @@ const { uninstallBundle, UninstallError } = require('../lib/uninstall');
13
13
  const { loadManifest, findBundle, ManifestError } = require('../lib/manifest');
14
14
  const { loadLedger, bundleKeysInLedger, LedgerError } = require('../lib/ledger');
15
15
  const { updateBundles, UpdateError } = require('../lib/update');
16
+ const { formatVersionBanner } = require('../lib/version-banner');
17
+ const { ledgerPath } = require('../lib/ledger');
16
18
  const { WiringError } = require('../lib/wiring');
17
19
  const {
18
20
  basicMenuBundles,
@@ -341,6 +343,54 @@ function printFinalSummary({ installed, skipped, targetBase }) {
341
343
  );
342
344
  }
343
345
 
346
+
347
+ /**
348
+ * cliVersion recorded by the last install, or null if this machine has none.
349
+ *
350
+ * Reads the ledger file DIRECTLY rather than via loadLedger(), on purpose: this is a
351
+ * cosmetic banner, and loadLedger throws on a schema-major mismatch or a malformed
352
+ * file. A ledger problem must not be able to stop the installer from rendering its
353
+ * menu -- the install path itself will surface that error properly.
354
+ */
355
+ function readInstalledCliVersion(targetDir) {
356
+ try {
357
+ const raw = readFileSync(ledgerPath(targetDir), 'utf8');
358
+ return JSON.parse(raw).cliVersion || null;
359
+ } catch {
360
+ return null;
361
+ }
362
+ }
363
+
364
+ /**
365
+ * Newest version on npm, or null. Best-effort with a short timeout: an offline or
366
+ * slow registry must never delay or block the menu, so every failure path resolves
367
+ * null rather than rejecting. Set AGENTS_NO_UPDATE_CHECK=1 to skip the request.
368
+ */
369
+ function fetchLatestVersion(pkgName, { timeoutMs = 1500 } = {}) {
370
+ if (process.env.AGENTS_NO_UPDATE_CHECK) return Promise.resolve(null);
371
+ return new Promise((resolve) => {
372
+ let settled = false;
373
+ const done = (v) => { if (!settled) { settled = true; resolve(v); } };
374
+ try {
375
+ const https = require('node:https');
376
+ const url = `https://registry.npmjs.org/${pkgName.replace('/', '%2F')}/latest`;
377
+ const req = https.get(url, { timeout: timeoutMs }, (res) => {
378
+ if (res.statusCode !== 200) { res.resume(); return done(null); }
379
+ let body = '';
380
+ res.setEncoding('utf8');
381
+ res.on('data', (c) => { body += c; });
382
+ res.on('end', () => {
383
+ try { done(JSON.parse(body).version || null); } catch { done(null); }
384
+ });
385
+ });
386
+ req.on('timeout', () => { req.destroy(); done(null); });
387
+ req.on('error', () => done(null));
388
+ } catch {
389
+ done(null);
390
+ }
391
+ });
392
+ }
393
+
344
394
  async function runInteractiveMenu({ advanced, targetDir, targetConfig, noSecrets, profile }) {
345
395
  const { manifest, manifestPath } = loadManifest(PACKAGE_ROOT);
346
396
  const repoRoot = path.dirname(manifestPath);
@@ -353,7 +403,12 @@ async function runInteractiveMenu({ advanced, targetDir, targetConfig, noSecrets
353
403
  const rows = candidateBundles.map((b) => describeBundleRow(b, manifest));
354
404
  const details = new Map(candidateBundles.map((b) => [b.key, deriveBundleDetails(b, manifest, { repoRoot })]));
355
405
  const header = `${pkg.name} v${pkg.version}`;
356
- const selectedKeys = await pickBundles(rows, { details, header });
406
+ const subheader = formatVersionBanner({
407
+ running: pkg.version,
408
+ installed: readInstalledCliVersion(targetDir),
409
+ latest: await fetchLatestVersion(pkg.name),
410
+ });
411
+ const selectedKeys = await pickBundles(rows, { details, header, subheader });
357
412
  if (selectedKeys === null) {
358
413
  console.log('Cancelled — nothing installed.');
359
414
  return 0;
@@ -23,6 +23,16 @@ GLM_MODEL = "litellm_glm"
23
23
  COUNCIL_NAME = "idea"
24
24
  LOG_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "council.log")
25
25
 
26
+ # Router-style call log (project / session / subagent attribution), shared by every
27
+ # LiteLLM caller so one window shows all non-Claude traffic. Optional: if the proxy
28
+ # tree is missing this degrades to the local council.log only, never to a crash.
29
+ try:
30
+ import pathlib as _pathlib
31
+ sys.path.insert(0, str(_pathlib.Path(__file__).resolve().parents[2] / "proxy" / "litellm"))
32
+ from call_log import log_call as _log_call
33
+ except Exception:
34
+ _log_call = None
35
+
26
36
 
27
37
  def _log_panel_call(model, duration, usage, error=None):
28
38
  """Best-effort structured log of one panel call. Never raises — a logging
@@ -44,6 +54,16 @@ def _log_panel_call(model, duration, usage, error=None):
44
54
  fh.write(json.dumps(entry) + "\n")
45
55
  except Exception:
46
56
  pass
57
+ # Mirror into the shared router-style feed so the LiteLLM window shows this call
58
+ # with session/subagent attribution. Separate try: a failure here must not lose the
59
+ # council.log entry written above.
60
+ try:
61
+ if _log_call:
62
+ _log_call(f"{COUNCIL_NAME}-council", model,
63
+ status="error" if error else "ok",
64
+ duration=duration, usage=usage, error=error)
65
+ except Exception:
66
+ pass
47
67
 
48
68
  PANEL_PROMPT_WITH_CONTEXT = """\
49
69
  {context}
@@ -82,10 +102,15 @@ def call_litellm(prompt, key, model, max_tokens=2000):
82
102
  try:
83
103
  with urllib.request.urlopen(req, timeout=90) as r:
84
104
  d = json.load(r)
85
- msg = d["choices"][0]["message"]
105
+ choice = d["choices"][0]
106
+ msg = choice["message"]
86
107
  # Reasoning models output CoT in 'reasoning_content'; final answer in 'content'
87
108
  text = msg.get("content") or msg.get("reasoning_content") or msg.get("reasoning") or ""
88
- _log_panel_call(model, time.monotonic() - start, d.get("usage"))
109
+ truncated = choice.get("finish_reason") == "length"
110
+ _log_panel_call(model, time.monotonic() - start, d.get("usage"),
111
+ error="truncated: hit max_tokens" if truncated else None)
112
+ if truncated:
113
+ text += "\n\n[response truncated — hit max_tokens cap]"
89
114
  return text.strip()
90
115
  except urllib.error.HTTPError as e:
91
116
  detail = e.read().decode()[:300]
@@ -113,6 +138,7 @@ def call_litellm_stream(prompt, key, model, max_tokens=2000):
113
138
  })
114
139
  start = time.monotonic()
115
140
  parts = []
141
+ truncated = False
116
142
  try:
117
143
  with urllib.request.urlopen(req, timeout=90) as r:
118
144
  for raw_line in r:
@@ -123,11 +149,17 @@ def call_litellm_stream(prompt, key, model, max_tokens=2000):
123
149
  if payload == "[DONE]":
124
150
  break
125
151
  chunk = json.loads(payload)
126
- delta = (chunk.get("choices") or [{}])[0].get("delta", {})
152
+ choice = (chunk.get("choices") or [{}])[0]
153
+ if choice.get("finish_reason") == "length":
154
+ truncated = True
155
+ delta = choice.get("delta", {})
127
156
  if delta.get("content"):
128
157
  parts.append(delta["content"])
129
158
  text = "".join(parts).strip()
130
- _log_panel_call(model, time.monotonic() - start, None)
159
+ _log_panel_call(model, time.monotonic() - start, None,
160
+ error="truncated: hit max_tokens" if truncated else None)
161
+ if truncated:
162
+ text += "\n\n[response truncated — hit max_tokens cap]"
131
163
  return text
132
164
  except urllib.error.HTTPError as e:
133
165
  detail = e.read().decode()[:300]
@@ -153,10 +185,10 @@ def main():
153
185
  sys.exit(1)
154
186
 
155
187
  with concurrent.futures.ThreadPoolExecutor(max_workers=4) as ex:
156
- f_gemini = ex.submit(call_litellm, prompt, or_key, GEMINI_MODEL, 2000)
157
- f_deepseek = ex.submit(call_litellm, prompt, or_key, DEEPSEEK_MODEL, 4000)
158
- f_qwen = ex.submit(call_litellm_stream, prompt, or_key, QWEN_MODEL, 2000)
159
- f_glm = ex.submit(call_litellm, prompt, or_key, GLM_MODEL, 2000)
188
+ f_gemini = ex.submit(call_litellm, prompt, or_key, GEMINI_MODEL, 4000)
189
+ f_deepseek = ex.submit(call_litellm, prompt, or_key, DEEPSEEK_MODEL, 6000)
190
+ f_qwen = ex.submit(call_litellm_stream, prompt, or_key, QWEN_MODEL, 4000)
191
+ f_glm = ex.submit(call_litellm, prompt, or_key, GLM_MODEL, 4000)
160
192
 
161
193
  print(f"=== {GEMINI_MODEL} ===")
162
194
  print(f_gemini.result())
@@ -4,6 +4,7 @@ When making technical decisions, do not give much weight to development cost. In
4
4
  When doing bug fixes, always start with reproducing the bug in an E2E setting as closely aligned with how an end user would experience it as possible. This makes sure you find the real problem so your fix will actually solve it.
5
5
  If user has custom agent and other models in their custom agents respect them and launch with what was instructed. This takes higher priority.
6
6
  Use git CLI for GitLab access, never glab — we use GitLab, not GitHub.
7
+ Always state all pending, open, or blocked items upfront and in full at the top of a response — never trail a reply with "one more thing pending" or drip-feed open items across later turns.
7
8
 
8
9
  ## Model Routing (HARD RULE)
9
10
 
@@ -57,10 +57,15 @@ Wiring (settings.json), matcher "Bash":
57
57
  """
58
58
  from __future__ import annotations
59
59
 
60
+ # CLAUDE_HOOK_CHILD guard: hook-spawned child claude processes set this so
61
+ # this hook never re-fires recursively. Must run before any other I/O.
62
+ import os, sys
63
+ if os.environ.get("CLAUDE_HOOK_CHILD"):
64
+ sys.exit(0)
65
+
60
66
  import json
61
67
  import re
62
68
  import shlex
63
- import sys
64
69
  import time
65
70
  from pathlib import Path
66
71
 
@@ -14,9 +14,13 @@ Allow when ANY of:
14
14
  Deny (exit 2 + stderr) when a whole-file read of a >THRESHOLD-line text file is attempted.
15
15
  Tune THRESHOLD below, or remove the matcher from settings.json to disable.
16
16
  """
17
+ # CLAUDE_HOOK_CHILD guard: hook-spawned child claude processes set this so
18
+ # this hook never re-fires recursively. Must run before any other I/O.
19
+ import os, sys
20
+ if os.environ.get("CLAUDE_HOOK_CHILD"):
21
+ sys.exit(0)
22
+
17
23
  import json
18
- import os
19
- import sys
20
24
 
21
25
  THRESHOLD = 200
22
26
 
@@ -1,7 +1,8 @@
1
1
  # conclusion-scribe hook config — copy to ~/.claude/hooks/conclusion-scribe.env
2
2
  # Machine/user-specific values live HERE, never in the hook code.
3
3
 
4
- # Repos addressable as "<repo>#<iid>" in scribe blocks (URL-encoded paths).
4
+ # Repos addressable as "<repo>#<iid>" when the hook extracts an issue
5
+ # reference from a conclusive message (URL-encoded paths).
5
6
  # NOTE: repos under a scanned root (default C:\dev, override via the
6
7
  # SCRIBE_HOOK_ROOTS env var) auto-discover from their gitlab.com git remote
7
8
  # with zero config -- PROJECT_MAP below is only needed as an override, or as