pwn 0.5.669 → 0.5.670
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +4 -2
- data/documentation/AI-Integration.md +1 -1
- data/documentation/Configuration.md +4 -0
- data/documentation/How-PWN-Works.md +1 -1
- data/documentation/diagrams/dot/task-summarizer.dot +24 -12
- data/documentation/diagrams/task-summarizer.svg +178 -126
- data/documentation/pwn-ai-Agent.md +35 -13
- data/lib/pwn/ai/agent/loop.rb +587 -8
- data/lib/pwn/ai/agent/prompt_builder.rb +58 -3
- data/lib/pwn/ai/agent/task_summarizer.rb +394 -33
- data/lib/pwn/config.rb +7 -2
- data/lib/pwn/memory.rb +188 -0
- data/lib/pwn/sessions.rb +9 -4
- data/lib/pwn/version.rb +1 -1
- data/spec/lib/pwn/ai/agent/loop_spec.rb +215 -2
- data/spec/lib/pwn/ai/agent/prompt_builder_spec.rb +51 -0
- data/spec/lib/pwn/ai/agent/task_summarizer_spec.rb +111 -6
- data/spec/lib/pwn/memory_spec.rb +62 -0
- data/third_party/pwn_rdoc.jsonl +25 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df46a72d0f582458534c1bcfcbdc0fcbf121cf002828ff5da313a5cf5eddea37
|
|
4
|
+
data.tar.gz: c4bf47cbbe4e7ad22d52104f4fa9af499c06176cae9b93500652956428abe4a2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c51242fc7542f675245804852cb313d75a8779675032148585cfde8afab392934d9da03eef08765d1339bca64732c7c3d7350a6ff76a366801c36e5b9e315df5
|
|
7
|
+
data.tar.gz: 983ff27f8a551664fbc42a5d72357389fee1aaeeb67da5c7b82e4704fa54c06d469aa4589585369c48eca7441193644fd837a08049ee3a560a6bb99f424ba007
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -118,8 +118,10 @@ message bus:
|
|
|
118
118
|

|
|
119
119
|
|
|
120
120
|
Long-running turns also show **executive task briefs** (not raw commands) via
|
|
121
|
-
`TaskSummarizer
|
|
122
|
-
|
|
121
|
+
`TaskSummarizer`. Every request is first classified as a **general statement**,
|
|
122
|
+
a **question**, or an **autonomous goal**. Only autonomous goals get a multi-step
|
|
123
|
+
breakdown on submit (`emit_plan!`); statements and questions stay single-turn.
|
|
124
|
+
Per-batch `about_to` lines use `tool_counts_phrase` + `intent_phrase` with
|
|
123
125
|
`last_brief_fp` duplicate suppression. When recent turns keep hitting the iteration ceiling, the Loop tightens the remaining runway (lower `max_iters` on local engines, text-only tail, no counterfactual fork) so the agent still finishes instead of thrashing.
|
|
124
126
|
|
|
125
127
|
Full pages: [How PWN Works](documentation/How-PWN-Works.md) ·
|
|
@@ -48,7 +48,7 @@ The harness adapts to the *class* of engine, not the model name:
|
|
|
48
48
|
| **MEMORY ranking** | relevance-ranked when a local Ollama `embed_model` is reachable, else newest-first | relevance-ranked via `PWN::MemoryIndex` (`~/.pwn/memory.idx`) |
|
|
49
49
|
| **Tool schemas shipped** | all toolsets | `CORE_TOOLS` + top-K keyword matches when `ai.agent.tool_router` is on |
|
|
50
50
|
| **Pre-pass** | none | `plan_first` numbered tool plan before first dispatch |
|
|
51
|
-
| **Intent route** | always | `request_intent`
|
|
51
|
+
| **Intent route** | always | `request_intent` + LLM/heuristic `request_kind` (statement \| question \| autonomous_goal). Short-circuits how-to/questions (text only), greetings/statements (fixed ack), pure recall, and unauthorized recon on all engines; host-evidence Qs (hostname/cwd/whoami) and only true autonomous goals get multi-step TaskSummarizer plans. Critical for ollama/openwebui |
|
|
52
52
|
| **Few-shot** | none | `Learning.exemplars_for(request)` splices a prior successful trace |
|
|
53
53
|
| **Dispatch parsing** | strict | tolerant - Levenshtein tool-name repair + JSON5-ish arg cleanup, each repair fingerprinted into `Mistakes` |
|
|
54
54
|
| **Post-answer** | `auto_introspect` | `auto_introspect` **+** `fact_check_local_final` (auto `extro_verify` on CVE/version-shaped claims) |
|
|
@@ -103,6 +103,8 @@ ai:
|
|
|
103
103
|
task_summary_every: 5 # When task_summary_verbose: emit Progress every N completed tools.
|
|
104
104
|
task_summary_interval_s: 8.0 # When verbose: also emit when this many seconds elapsed.
|
|
105
105
|
task_summary_verbose: false # Mid-flight Progress/Finished lines (default: only plan + about_to).
|
|
106
|
+
task_summary_llm: true # LLM tangible-task decompose for autonomous goals (default on). false = offline fallback.
|
|
107
|
+
request_kind_llm: ~ # LLM request_kind classifier (statement|question|autonomous_goal). nil = follow task_summary_llm.
|
|
106
108
|
max_depth: 3 # Recursion guard: how many levels deep agent_ask/agent_debate sub-agents may spawn sub-agents.
|
|
107
109
|
auto_introspect: true # Run Learning.auto_introspect (outcome logging + lesson mining) after every final answer.
|
|
108
110
|
auto_extrospect: false # Optional ambient baseline (host/repo/env ONLY - never launches burpsuite/zaproxy/msf/gqrx). Sense tools (intel/verify/watch/rf_tune/observe) stay on-demand.
|
|
@@ -268,6 +270,8 @@ PWN::Config.refresh_env
|
|
|
268
270
|
| `ai.agent.task_summary_every` | Integer | `5` | `TaskSummarizer.every_n` | Verbose progress cadence (tools). |
|
|
269
271
|
| `ai.agent.task_summary_interval_s` | Float | `8.0` | `TaskSummarizer.interval_s` | Verbose progress cadence (seconds). |
|
|
270
272
|
| `ai.agent.task_summary_verbose` | Boolean | `false` | `TaskSummarizer.verbose?` | Emit mid-flight `Progress:` / `Finished:` lines; default keeps only plan + about_to. |
|
|
273
|
+
| `ai.agent.task_summary_llm` | Boolean \| `nil` | `nil` (on) | `TaskSummarizer.llm_plan_enabled?` | LLM tangible-task decomposition for autonomous goals. `false` forces offline generic fallback (tests / air-gap). |
|
|
274
|
+
| `ai.agent.request_kind_llm` | Boolean \| `nil` | `nil` (follow `task_summary_llm`) | `TaskSummarizer.llm_kind_enabled?` / `request_kind` | LLM classifier for `statement` \| `question` \| `autonomous_goal`. Cheap intents and host-evidence heuristics still win first; `false` is heuristic-only. |
|
|
271
275
|
| `ai.agent.max_depth` | Integer | `3` | `PWN::AI::Agent::Swarm` | Recursion guard for `agent_ask` / `agent_debate` sub-agents spawning sub-agents. |
|
|
272
276
|
| `ai.agent.auto_introspect` | Boolean | `true` | `PWN::AI::Agent::Learning.auto_introspect` | Run outcome logging + lesson mining after every final answer. Toggle live via `learning_auto_introspect_toggle`. |
|
|
273
277
|
| `ai.agent.auto_extrospect` | Boolean | `false` | `PWN::AI::Agent::Extrospection.auto_extrospect` | Optional ambient baseline after every final answer (`AUTO_SECTIONS` = host/repo/env only; never spawns GUI/JVM tools). Prefer on-demand sense tools (`intel`/`verify`/`watch`/`rf_tune`/`observe`). Toggle live via `extro_auto_toggle`. |
|
|
@@ -28,7 +28,7 @@ hardware).
|
|
|
28
28
|
| Module | Role |
|
|
29
29
|
|---|---|
|
|
30
30
|
| `Loop` | plan → **TaskSummarizer** briefs → dispatch tool_calls → observe → repeat until final answer; tightens runway when recent turns exhausted the budget |
|
|
31
|
-
| **`TaskSummarizer`** | Executive UX: English tasks primary - `emit_plan!` · `about_to` as `task k/n` + via tools · Loop `plan_context` injection · clearer `plan_idx` advance |
|
|
31
|
+
| **`TaskSummarizer`** | Executive UX: LLM/heuristic `request_kind` gates plans (only autonomous goals, including host-evidence Qs) - English tasks primary - `emit_plan!` · `about_to` as `task k/n` + via tools · Loop `plan_context` injection · clearer `plan_idx` advance |
|
|
32
32
|
| `Registry` | JSON-Schema function definitions grouped into 12 **toolsets** · **82 tools** |
|
|
33
33
|
| `Dispatch` / `Result` | execute a tool, capture stdout/value/error/duration |
|
|
34
34
|
| `PromptBuilder` | inject MEMORY / SKILLS / LEARNING / **KNOWN MISTAKES + FIXES** / METRICS / EXTROSPECTION blocks |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
digraph "PWN_TaskSummarizer" {
|
|
2
2
|
graph [
|
|
3
|
-
label=<<B>PWN::AI::Agent::TaskSummarizer -
|
|
3
|
+
label=<<B>PWN::AI::Agent::TaskSummarizer - Request kind + executive briefs</B><BR/><FONT POINT-SIZE="11" COLOR="#94a3b8">request_kind → (statement|question: no plan) · (autonomous_goal: emit_plan! → about_to → tools)</FONT>>,
|
|
4
4
|
labelloc=t, fontsize=20, fontname="Helvetica",
|
|
5
5
|
rankdir=TB, splines=spline, nodesep=0.55, ranksep=0.9,
|
|
6
6
|
bgcolor="#0f172a", fontcolor="#e2e8f0", pad=0.6, newrank=true, compound=true
|
|
@@ -10,25 +10,34 @@ digraph "PWN_TaskSummarizer" {
|
|
|
10
10
|
edge [fontname="Helvetica", fontsize=9, color="#94a3b8",
|
|
11
11
|
fontcolor="#cbd5e1", penwidth=1.3, arrowsize=0.8];
|
|
12
12
|
|
|
13
|
-
User [label="
|
|
14
|
-
Loop [label="Loop.run\nts_state = TaskSummarizer.fresh", fillcolor="#c4b5fd"];
|
|
15
|
-
|
|
13
|
+
User [label="User request", fillcolor="#7dd3fc"];
|
|
14
|
+
Loop [label="Loop.run\nts_state = TaskSummarizer.fresh\nrequest_kind + request_intent", fillcolor="#c4b5fd"];
|
|
15
|
+
Kind [label="request_kind (LLM + heuristic)\nstatement | question | autonomous_goal\nhost-evidence Qs → goal", fillcolor="#fcd34d", penwidth=2];
|
|
16
|
+
{rank=same; User; Loop; Kind}
|
|
17
|
+
|
|
18
|
+
subgraph cluster_nogoal {
|
|
19
|
+
label="No multi-step breakdown"; fontcolor="#fda4af";
|
|
20
|
+
style=rounded; color="#be123c"; bgcolor="#4c0519"; penwidth=2;
|
|
21
|
+
Stmt [label="statement\nanswer_statement / greeting ack", fillcolor="#fda4af"];
|
|
22
|
+
Ques [label="question (knowledge/howto/recall)\nanswer_question / howto / recall\nno tools / no plan", fillcolor="#fda4af"];
|
|
23
|
+
}
|
|
24
|
+
{rank=same; Stmt; Ques}
|
|
16
25
|
|
|
17
26
|
subgraph cluster_plan {
|
|
18
|
-
label="
|
|
27
|
+
label="Autonomous goal plan (once per turn)"; fontcolor="#ddd6fe";
|
|
19
28
|
style=rounded; color="#6d28d9"; bgcolor="#2e1065"; penwidth=2;
|
|
20
|
-
Plan [label="plan(request)\nenumerated
|
|
21
|
-
EmitP [label="emit_plan!\nGoal:
|
|
29
|
+
Plan [label="plan(request)\nenumerated · LLM · fallback\nordered work units", fillcolor="#c4b5fd"];
|
|
30
|
+
EmitP [label="emit_plan!\nKind: autonomous_goal\nGoal: ...\nTangible tasks (N):\n each may use 1+ tools", fillcolor="#c4b5fd", penwidth=2];
|
|
22
31
|
}
|
|
23
32
|
{rank=same; Plan; EmitP}
|
|
24
33
|
|
|
25
34
|
subgraph cluster_batch {
|
|
26
35
|
label="Batch layer (each tool collection)"; fontcolor="#a7f3d0";
|
|
27
36
|
style=rounded; color="#047857"; bgcolor="#022c22"; penwidth=2;
|
|
28
|
-
About [label="about_to(tools:)\
|
|
37
|
+
About [label="about_to(tools:)\ntask k/n English primary\nvia tools (intent)", fillcolor="#6ee7b7"];
|
|
29
38
|
FP [label="brief_fingerprint\nlast_brief_fp", fillcolor="#6ee7b7"];
|
|
30
39
|
Dup [label="duplicate_brief?", shape=diamond, fillcolor="#fcd34d"];
|
|
31
|
-
EmitB [label="emit task line\
|
|
40
|
+
EmitB [label="emit task line\ntask k/N: ...\nvia shell×2 (search)", fillcolor="#6ee7b7", penwidth=2];
|
|
32
41
|
Skip [label="return nil\n(suppress duplicate)", fillcolor="#fda4af"];
|
|
33
42
|
}
|
|
34
43
|
{rank=same; About; FP; Dup; EmitB; Skip}
|
|
@@ -36,7 +45,7 @@ digraph "PWN_TaskSummarizer" {
|
|
|
36
45
|
subgraph cluster_exec {
|
|
37
46
|
label="Execution (not on task row)"; fontcolor="#fde68a";
|
|
38
47
|
style=rounded; color="#a16207"; bgcolor="#422006"; penwidth=2;
|
|
39
|
-
Tools [label="Dispatch tools\nshell · pwn_eval ·
|
|
48
|
+
Tools [label="Dispatch tools\nshell · pwn_eval · ...\nown REPL lines", fillcolor="#fcd34d"];
|
|
40
49
|
Rec [label="record!\nadvance plan_idx\n(silent unless verbose)", fillcolor="#fcd34d"];
|
|
41
50
|
Flush [label="flush! / emit!\noptional closing brief", fillcolor="#fcd34d"];
|
|
42
51
|
}
|
|
@@ -45,10 +54,13 @@ digraph "PWN_TaskSummarizer" {
|
|
|
45
54
|
UI [label="REPL on_tool\nname='task', full text, result=''\n(no truncation)", fillcolor="#7dd3fc"];
|
|
46
55
|
|
|
47
56
|
User -> Loop [color="#38bdf8", penwidth=2];
|
|
48
|
-
Loop ->
|
|
57
|
+
Loop -> Kind [color="#fbbf24", penwidth=2];
|
|
58
|
+
Kind -> Stmt [label="statement", color="#fb7185"];
|
|
59
|
+
Kind -> Ques [label="question", color="#fb7185"];
|
|
60
|
+
Kind -> Plan [label="autonomous_goal", color="#a78bfa", penwidth=2];
|
|
49
61
|
Plan -> EmitP [color="#a78bfa"];
|
|
50
62
|
EmitP -> UI [label="full goal once", color="#38bdf8", penwidth=2];
|
|
51
|
-
Loop -> About [label="before each\ntool batch", color="#a78bfa"];
|
|
63
|
+
Loop -> About [label="before each\ntool batch\n(goals only)", color="#a78bfa"];
|
|
52
64
|
About -> FP [color="#34d399"];
|
|
53
65
|
FP -> Dup [color="#34d399"];
|
|
54
66
|
Dup -> EmitB [label="new", color="#34d399"];
|