sliceagent 0.1.0__py3-none-any.whl

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 (71) hide show
  1. sliceagent/__init__.py +3 -0
  2. sliceagent/__main__.py +6 -0
  3. sliceagent/access.py +93 -0
  4. sliceagent/agents.py +173 -0
  5. sliceagent/background_review.py +146 -0
  6. sliceagent/binsniff.py +89 -0
  7. sliceagent/cli.py +890 -0
  8. sliceagent/clock.py +32 -0
  9. sliceagent/code_grep.py +329 -0
  10. sliceagent/code_index.py +417 -0
  11. sliceagent/config.py +240 -0
  12. sliceagent/context_overflow.py +227 -0
  13. sliceagent/envspec.py +129 -0
  14. sliceagent/errors.py +167 -0
  15. sliceagent/events.py +96 -0
  16. sliceagent/finding_types.py +70 -0
  17. sliceagent/flags.py +63 -0
  18. sliceagent/fuzzy.py +135 -0
  19. sliceagent/guardrails.py +438 -0
  20. sliceagent/guidance.py +69 -0
  21. sliceagent/hippocampus.py +581 -0
  22. sliceagent/hooks.py +334 -0
  23. sliceagent/interfaces.py +144 -0
  24. sliceagent/llm.py +695 -0
  25. sliceagent/loop.py +548 -0
  26. sliceagent/mcp_client.py +255 -0
  27. sliceagent/mcp_security.py +77 -0
  28. sliceagent/memory.py +428 -0
  29. sliceagent/metrics.py +103 -0
  30. sliceagent/model_catalog.py +124 -0
  31. sliceagent/monitor.py +615 -0
  32. sliceagent/neocortex.py +436 -0
  33. sliceagent/onboarding.py +323 -0
  34. sliceagent/oracle.py +36 -0
  35. sliceagent/pagetable.py +255 -0
  36. sliceagent/pfc.py +449 -0
  37. sliceagent/plugins.py +127 -0
  38. sliceagent/policy.py +234 -0
  39. sliceagent/procman.py +187 -0
  40. sliceagent/prompt.py +239 -0
  41. sliceagent/records.py +108 -0
  42. sliceagent/recovery.py +119 -0
  43. sliceagent/regions.py +678 -0
  44. sliceagent/registry.py +128 -0
  45. sliceagent/retriever.py +19 -0
  46. sliceagent/safety.py +332 -0
  47. sliceagent/sandbox.py +143 -0
  48. sliceagent/scheduler.py +92 -0
  49. sliceagent/search_index.py +289 -0
  50. sliceagent/seed.py +465 -0
  51. sliceagent/sensory_cortex.py +500 -0
  52. sliceagent/session.py +222 -0
  53. sliceagent/skill_provenance.py +71 -0
  54. sliceagent/skill_usage.py +123 -0
  55. sliceagent/skills.py +209 -0
  56. sliceagent/subagent.py +332 -0
  57. sliceagent/subdir_hints.py +222 -0
  58. sliceagent/swap.py +182 -0
  59. sliceagent/taskstate.py +57 -0
  60. sliceagent/telemetry.py +59 -0
  61. sliceagent/terminal.py +240 -0
  62. sliceagent/text_utils.py +56 -0
  63. sliceagent/tool_summary.py +93 -0
  64. sliceagent/tools.py +1194 -0
  65. sliceagent/tui.py +1377 -0
  66. sliceagent/web.py +354 -0
  67. sliceagent-0.1.0.dist-info/METADATA +262 -0
  68. sliceagent-0.1.0.dist-info/RECORD +71 -0
  69. sliceagent-0.1.0.dist-info/WHEEL +4 -0
  70. sliceagent-0.1.0.dist-info/entry_points.txt +2 -0
  71. sliceagent-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,93 @@
1
+ """Deterministic tool-result one-liners (item 14b) — '[tool] action -> outcome, N lines'.
2
+
3
+ Replaces a large tool output with an informative line instead of a zero-information
4
+ placeholder. sliceagent has no transcript to compress, but the SAME shape makes the episodic
5
+ TRACE (history.render_trace) far more legible: a compact line that says WHAT the tool did and
6
+ HOW IT CAME OUT, replacing the raw head+tail tail-snippet.
7
+
8
+ Adapted to sliceagent's tool names (file_operations / tools.py: read_file, write_file,
9
+ edit_file/str_replace, append_to_file, run_command, list_files, execute_code, plus the
10
+ sliceagent built-ins skill/new_topic/switch_topic/recall_history). Pure + deterministic →
11
+ testable offline, no LLM.
12
+
13
+ NO-TRANSCRIPT INVARIANT: this only formats already-stored episodic records for read-back; it
14
+ produces no new context and is never injected into the slice.
15
+
16
+ PUBLIC SIGNATURE (pinned):
17
+ summarize_tool_result(name: str, args: dict, output: str, *, failing: bool = False) -> str
18
+ """
19
+ from __future__ import annotations
20
+
21
+ import re
22
+
23
+ _MAX_TGT = 70
24
+
25
+
26
+ def _line_count(text: str) -> int:
27
+ return (text.count("\n") + 1) if (text or "").strip() else 0
28
+
29
+
30
+ def _clip(s, n: int = _MAX_TGT) -> str:
31
+ s = str(s or "")
32
+ return s if len(s) <= n else s[: n - 1] + "…"
33
+
34
+
35
+ def _first_code_line(code: str) -> str:
36
+ for ln in str(code or "").splitlines():
37
+ if ln.strip():
38
+ return ln.strip()
39
+ return ""
40
+
41
+
42
+ def summarize_tool_result(name: str, args: dict, output: str, *, failing: bool = False) -> str:
43
+ """One informative line: '[name] action -> outcome, N lines'. Never raises — a bad arg
44
+ shape falls through to the generic branch. `failing` flags the outcome with ✗."""
45
+ args = args if isinstance(args, dict) else {}
46
+ out = output or ""
47
+ n = _line_count(out)
48
+ fail = " ✗" if failing else ""
49
+
50
+ if name in ("run_command", "execute_code"):
51
+ if name == "execute_code":
52
+ tgt = _clip(_first_code_line(args.get("code", "")))
53
+ else:
54
+ tgt = _clip(args.get("command", ""))
55
+ exit_m = re.search(r"[Ee]xit code[:\s]+(-?\d+)", out)
56
+ outcome = f"exit {exit_m.group(1)}" if exit_m else ("error" if failing else "ok")
57
+ return f"[{name}] `{tgt}` -> {outcome}, {n} lines{fail}"
58
+
59
+ if name == "read_file":
60
+ return f"[read_file] {_clip(args.get('path', '?'))} -> {len(out):,} chars, {n} lines{fail}"
61
+
62
+ if name in ("write_file", "append_to_file"):
63
+ wl = _line_count(args.get("content", ""))
64
+ verb = "wrote" if name == "write_file" else "appended"
65
+ return f"[{name}] {verb} {_clip(args.get('path', '?'))} ({wl} lines){fail}"
66
+
67
+ if name in ("edit_file", "str_replace"):
68
+ # "0 " anywhere in the first 20 chars false-matched the byte count of a normal write ("Wrote 100
69
+ # bytes" contains "0 bytes"); use precise no-op signals so a real edit is never summarized as no-op.
70
+ ok = "no-op" if (not failing and ("No changes" in out or "Wrote 0 bytes" in out)) else \
71
+ ("failed" if failing else "applied")
72
+ return f"[{name}] {_clip(args.get('path', '?'))} -> {ok}{fail}"
73
+
74
+ if name == "list_files":
75
+ return f"[list_files] {_clip(args.get('path', '.'))} -> {n} entries{fail}"
76
+
77
+ if name == "skill":
78
+ return f"[skill] loaded {_clip(args.get('name', '?'))}{fail}"
79
+
80
+ if name in ("new_topic", "switch_topic"):
81
+ tgt = args.get("goal") or args.get("task_id") or ""
82
+ return f"[{name}] {_clip(tgt)}{fail}"
83
+
84
+ if name == "recall_history":
85
+ return f"[recall_history] -> {n} lines{fail}"
86
+
87
+ # generic fallback: first one or two args + size
88
+ hint = ""
89
+ for k, v in list(args.items())[:2]:
90
+ if k == "note":
91
+ continue
92
+ hint += f" {k}={_clip(v, 30)}"
93
+ return f"[{name}]{hint} -> {len(out):,} chars{fail}"