pwn 0.5.760 → 0.5.762
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/README.md +5 -5
- data/documentation/Swarm.md +113 -0
- data/documentation/pwn-ai-Agent.md +45 -11
- data/etc/default_skills/pwn/ai/agent/solve/SKILL.md +46 -0
- data/etc/default_skills/pwn/ai/agent/swarm/SKILL.md +1 -0
- data/etc/default_skills/pwn/banner/SKILL.md +1 -1
- data/lib/pwn/ai/agent/dispatch.rb +3 -0
- data/lib/pwn/ai/agent/loop.rb +18 -4
- data/lib/pwn/ai/agent/solve.rb +342 -0
- data/lib/pwn/ai/agent/swarm.rb +41 -1
- data/lib/pwn/ai/agent.rb +1 -0
- data/lib/pwn/ai/anthropic.rb +1 -0
- data/lib/pwn/ai/grok.rb +1 -0
- data/lib/pwn/ai/open_ai.rb +1 -0
- data/lib/pwn/banner.rb +593 -53
- data/lib/pwn/plugins/repl/ai.rb +6 -1
- data/lib/pwn/plugins/repl/ai_console.rb +81 -18
- data/lib/pwn/plugins/repl/ai_console_commands.rb +5 -4
- data/lib/pwn/plugins/repl/ai_swarm.rb +44 -11
- data/lib/pwn/version.rb +1 -1
- data/spec/lib/pwn/ai/agent/loop_spec.rb +2 -1
- data/spec/lib/pwn/ai/agent/solve_spec.rb +290 -0
- data/spec/lib/pwn/banner_spec.rb +428 -20
- data/spec/lib/pwn/plugins/repl/ai_console_commands_spec.rb +37 -1
- data/spec/lib/pwn/plugins/repl/ai_console_spec.rb +218 -27
- data/spec/lib/pwn/plugins/repl/ai_swarm_spec.rb +67 -7
- data/third_party/pwn_rdoc.jsonl +39 -2
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 20f94659af48e0dba30534ed36cfaf8942497dcc5851e346a44ef40c51abb130
|
|
4
|
+
data.tar.gz: 8f91abcce730d25f6721d89aa6389090aa572b40ffe7449cd419a874d15d1932
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8174ba5855b3cb25e41eabe9c34a57add502f6b1d52caef2809bd603e66eab5dd1a169e01e1e06feb5c745ffddaa817fbaae9748458933c35c727a5a9c18b736
|
|
7
|
+
data.tar.gz: 111e5b05d8ad0c54f82ba0ae1836fb9ab1f8f3c1845c992d2dbacf7a241286e6ea139c9714d91e58ee80a246a119bdadf59e71d6a0f65e30fc224b96a9de2b7a
|
data/README.md
CHANGED
|
@@ -278,12 +278,12 @@ If this project helped you and you want to support the work, keep us caffeinated
|
|
|
278
278
|
|
|
279
279
|
### [**0x004D65726368**](https://0day.myspreadshop.com/) ###
|
|
280
280
|
|
|
281
|
-
[](https://0day.myspreadshop.com/home+%26+living+stickers+%26+magnets)
|
|
282
282
|
|
|
283
|
-
[](https://0day.myspreadshop.com/home+%26+living+mugs+%26+drinkwear)
|
|
284
284
|
|
|
285
|
-
[](https://0day.myspreadshop.com/home+%26+living+other)
|
|
286
286
|
|
|
287
|
-
[](https://0day.myspreadshop.com/0dayinc-A5c3e498cf937643162a01b5f?productType=803&sellable=1naaRYxY1zhOoQlv7Mdg-803-34&appearance=2&size=29)
|
|
288
288
|
|
|
289
|
-
[](https://0day.myspreadshop.com/blackfingerprint-A5c3e49db1cbf3a0b9596b4d0?productType=111&sellable=ekXXmGonOyclynglNE87-111-22&appearance=5)
|
data/documentation/Swarm.md
CHANGED
|
@@ -18,6 +18,119 @@ self-improvement loop covers the whole swarm.
|
|
|
18
18
|
No daemon. Cross-session / cross-process communication == another `pwn-ai` (or
|
|
19
19
|
a `PWN::Cron` job) calling `Swarm.ask` with the same `swarm_id`.
|
|
20
20
|
|
|
21
|
+
## Run one mission with a built-in team
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
/swarm mission Write and test a Ruby function that validates the supplied data format
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
No persona setup is required. The exact text after `/swarm mission ` remains the
|
|
28
|
+
user request for **every** role; role instructions and JSON handoffs go in system
|
|
29
|
+
context, not a replacement task. Empty requests fail before dispatch. Existing
|
|
30
|
+
`dm`, `broadcast`, and `debate` retain their messaging semantics. `/swarm agents`
|
|
31
|
+
lists available personas; `/swarm dm NAME REQUEST` messages one persona.
|
|
32
|
+
The renamed slash commands replace the previous spellings without compatibility
|
|
33
|
+
aliases. Ruby APIs `Swarm.solve`, `Swarm.ask`, and the `Solve` coordinator are unchanged.
|
|
34
|
+
|
|
35
|
+
`/menu` and Tab use case-insensitive alphabetical ordering at every depth:
|
|
36
|
+
root commands, command actions, and live parameter lists (including agents,
|
|
37
|
+
jobs, MCP tools, sessions, skills, memory keys, and cron jobs). Exact spelling
|
|
38
|
+
breaks case-insensitive ties; selections keep their original command payloads.
|
|
39
|
+
|
|
40
|
+
1. **Antagonist** independently enumerates requirements and risks before seeing
|
|
41
|
+
a candidate. `R0` always contains the entire unchanged original request.
|
|
42
|
+
2. **Protagonist** builds the candidate using the ordinary nested tool-calling
|
|
43
|
+
`Loop.run` through `Swarm.ask`, then declares relative artifact paths.
|
|
44
|
+
3. **Antagonist** critiques the candidate and returns unresolved objections.
|
|
45
|
+
4. **Verifier** proposes requirement-indexed commands and exact expected stdout.
|
|
46
|
+
The coordinator executes them via the registered `shell` tool and `Dispatch`,
|
|
47
|
+
capturing actual stdout, stderr, and exit status. Model-supplied observations
|
|
48
|
+
are never accepted as execution evidence.
|
|
49
|
+
5. **Integrator** reviews those observations and either accepts or sends a
|
|
50
|
+
targeted repair to the protagonist. Repairs always repeat critique and tests.
|
|
51
|
+
|
|
52
|
+
Acceptance additionally requires every requirement ID to have passing executed
|
|
53
|
+
evidence, no open objections, every check to exit zero with its expected output,
|
|
54
|
+
and unchanged artifact hashes and steering revision. A model's `accept` alone
|
|
55
|
+
cannot complete the job. Candidate and handoff revisions are SHA-256-bound;
|
|
56
|
+
changed files, stale handoffs, failed checks, uncovered requirements, malformed
|
|
57
|
+
JSON, provider failures and limits return **INCOMPLETE**, never success. Structured
|
|
58
|
+
records and raw execution observations are saved with owner-only permissions in
|
|
59
|
+
`~/.pwn/swarm/<solve-id>/solve.json`. Every solve gets fresh role sessions, so an
|
|
60
|
+
earlier candidate cannot contaminate the independent initial assessment.
|
|
61
|
+
|
|
62
|
+
### Console and controls
|
|
63
|
+
|
|
64
|
+
Open the swarm workspace with **Ctrl+S / Ctrl+G**, keep a mission in the composer,
|
|
65
|
+
then press **v — Mission with team**. Enter confirms the exact draft and built-in
|
|
66
|
+
roles; Esc aborts without changing the draft or cursor. The jobs detail view
|
|
67
|
+
shows actual role phases, original requirements, provider/model routes, artifact
|
|
68
|
+
hashes, and open objections. There is one integrated final result. Provider usage
|
|
69
|
+
continues through the console's existing usage observer (no invented estimates).
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
/swarm status JOB
|
|
73
|
+
/swarm steer JOB Add this verification constraint
|
|
74
|
+
/swarm pause JOB
|
|
75
|
+
/swarm resume JOB
|
|
76
|
+
/swarm cancel JOB
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The same slash routes work in the legacy line console. Steering belongs to the
|
|
80
|
+
coordinator and is propagated to later roles; it invalidates previously accepted
|
|
81
|
+
candidate evidence without replacing the original goal. Pause stops future
|
|
82
|
+
dispatch at safe boundaries. Cancel interrupts the owned model wait; an already
|
|
83
|
+
running tool finishes first, and its changes are not undone. Another job cannot
|
|
84
|
+
start in the same controller while solve owns the workspace. A workspace file
|
|
85
|
+
lock also excludes overlapping solve coordinators across processes.
|
|
86
|
+
|
|
87
|
+
### Role configuration and limits
|
|
88
|
+
|
|
89
|
+
All roles inherit the already selected provider and that provider's configured
|
|
90
|
+
default model. Optional overrides use **existing** persona fields; no new vault
|
|
91
|
+
configuration keys or schema migration is needed:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
/swarm spawn solve_antagonist Review correctness --engine ollama --model YOUR_INSTALLED_MODEL
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The other names are `solve_protagonist`, `solve_verifier`, and `solve_integrator`.
|
|
98
|
+
They can also be defined in `agents.yml`. Engine/model overrides are request-local;
|
|
99
|
+
there is no superiority ranking, automatic diversity, or fallback to a different
|
|
100
|
+
provider. Remote credentials must already be configured. Solve never initiates
|
|
101
|
+
OAuth login or prompts for API keys; configured OAuth refresh remains the provider's
|
|
102
|
+
normal noninteractive operation. Implicit local-agent escalation is disabled for
|
|
103
|
+
solve. A missing provider fails visibly rather than silently switching.
|
|
104
|
+
|
|
105
|
+
Ruby API: `Swarm.solve(request:, workspace: Dir.pwd, rounds: 3, swarm_id: nil,
|
|
106
|
+
steering: nil, on_state: nil, on_tool: nil, usage_observer: nil)`. `swarm_id` supplies
|
|
107
|
+
role overrides; the returned solve ID identifies the independent records. The
|
|
108
|
+
default round limit is 3 (API range 1–10), each role turn is limited to 25 model
|
|
109
|
+
calls, and each of at most 32 checks per round has a 60-second tool timeout.
|
|
110
|
+
|
|
111
|
+
### Boundaries, not a security sandbox
|
|
112
|
+
|
|
113
|
+
The protagonist is the only model role with write-capable tools (`shell` and
|
|
114
|
+
`pwn_eval`). Review roles have no tools; Dispatch denies invented tool calls even
|
|
115
|
+
if a provider ignores its empty tool schema. Integrator repairs are dispatched
|
|
116
|
+
back to that one writer. This is role capability enforcement, **not** confinement
|
|
117
|
+
of arbitrary protagonist Ruby or shell code or other processes on the host.
|
|
118
|
+
|
|
119
|
+
Verification runs in fresh disposable copies of declared regular-file artifacts;
|
|
120
|
+
all test dependencies must be declared. Symlinks/out-of-workspace artifacts are
|
|
121
|
+
rejected, and input copies must retain their candidate hashes after a check.
|
|
122
|
+
Files over 128 KiB cannot currently be passed to full-content review and produce
|
|
123
|
+
an explicit incomplete result. A disposable directory is **not an OS sandbox**:
|
|
124
|
+
test code can use absolute paths, network, installed dependencies and host resources.
|
|
125
|
+
Existing Dispatch confirmation and `ai_sandbox` policies still apply. Use only
|
|
126
|
+
trusted test commands or supply external OS isolation when executing untrusted code.
|
|
127
|
+
|
|
128
|
+
Requirement extraction and test relevance still require model judgment. Executed
|
|
129
|
+
checks are evidence for their stated assertions, not mathematical proof of an
|
|
130
|
+
arbitrary natural-language goal; the saved commands, outputs, requirements and
|
|
131
|
+
revisions make that judgment inspectable. No live-provider reliability or automatic
|
|
132
|
+
security isolation is implied by the deterministic offline integration tests.
|
|
133
|
+
|
|
21
134
|
## Define personas
|
|
22
135
|
|
|
23
136
|
Each persona accepts optional `engine` and `model` keys. `model` is the exact
|
|
@@ -22,12 +22,46 @@ ASSISTANT and WARNING), a persistent multiline composer, and an operational
|
|
|
22
22
|
sidebar at 100 columns or wider. Narrower screens give the timeline the full width.
|
|
23
23
|
At 100 columns × 26 rows or larger, the header may carve out a bordered retro-game
|
|
24
24
|
colored Unicode-block animation on the left: falling tetrominoes with line clears,
|
|
25
|
-
a connected snake eating food and growing,
|
|
26
|
-
|
|
27
|
-
rocks, yellow shots and
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
a connected snake eating food and growing, Pac-Man with a blue maze, pellets,
|
|
26
|
+
yellow mouth sprite and colored ghosts, or Asteroids with a filled cyan ship,
|
|
27
|
+
red thrust, white rocks, yellow shots and expanding collision fragments.
|
|
28
|
+
Ctrl+T/Ctrl+X cycles MISSION CONTROL → SESSION → the visible game pane.
|
|
29
|
+
While the game is active, Ctrl+G cycles Tetris → Snake → Pac-Man → Asteroids → Galaga → Frogger;
|
|
30
|
+
outside game focus Ctrl+G retains its swarm alias, and Ctrl+S opens swarm.
|
|
31
|
+
Enter/Esc returns to the unchanged mission draft. Modals and cancellation retain
|
|
32
|
+
priority; games never read input or render on a separate thread.
|
|
33
|
+
Pac-Man starts on an arrow, moves every 0.3 seconds and buffers the latest turn
|
|
34
|
+
until a corridor permits it. Walls stop movement. Eat every pellet to advance
|
|
35
|
+
the level; large yellow power pellets turn ghosts blue for seven seconds.
|
|
36
|
+
Ghosts chase through corridors, flee while frightened and return home when eaten.
|
|
37
|
+
Contact with a normal ghost ends the round, followed by a brief flash and a fresh
|
|
38
|
+
arrow-ready start. Small mazes use one ghost; larger mazes use three.
|
|
39
|
+
Maze walls are generated from a seeded spanning tree with extra loops, not a
|
|
40
|
+
fixed grid with shuffled pellets. Every pellet remains reachable, and each round
|
|
41
|
+
consumes fresh random geometry. Pac-Man and ghosts each occupy one terminal cell,
|
|
42
|
+
including in the smallest eight-cell console pane. The maze fills the available
|
|
43
|
+
interior with internal walls and connected corridors instead of sacrificing routes
|
|
44
|
+
for enlarged sprites. Directional mouth and ghost glyphs retain compact hints;
|
|
45
|
+
individual eyes and scalloped feet cannot be resolved at this size.
|
|
46
|
+
Galaga uses arrows to move and Space to shoot. Destroy formations and diving
|
|
47
|
+
enemies, dodge hostile shots, and clear the formation to advance a wave. A hit
|
|
48
|
+
shows an expanding explosion, then an input-ready restart. The cyan player ship is
|
|
49
|
+
a filled upward-pointing delta with a nose, spine and wings on a 2x4 Braille-dot
|
|
50
|
+
raster; movement and collision coordinates remain unchanged.
|
|
51
|
+
Frogger uses arrows to hop: avoid moving traffic, ride moving logs across water,
|
|
52
|
+
and enter each empty goal. Water, traffic, occupied goals and riding off the edge
|
|
53
|
+
cause a short death/recovery animation. Filling all goals advances the level.
|
|
54
|
+
Both games begin on input, fill small and large panes, and run automatic demos
|
|
55
|
+
when inactive. Their footer hints appear only while the game pane is focused.
|
|
56
|
+
Pac-Man, Galaga and Frogger demos advance one caller-owned simulation frame per
|
|
57
|
+
UI tick rather than building a full replay on a cold resize or session change.
|
|
58
|
+
The deterministic random-access `mini_cells` replay API remains available to
|
|
59
|
+
other callers; its first large-canvas call can take longer than cached frames.
|
|
60
|
+
Snake uses arrows; Tetris uses Left/Right, Down and Space to rotate; Asteroids
|
|
61
|
+
uses Left/Right to turn, Up/Down for thrust/reverse and Space to fire. Asteroids
|
|
62
|
+
wraps at the edges and shots split rocks. Inactive games run seeded automatic demos.
|
|
63
|
+
Pong is no longer selectable; the explicit `name: :pong` Banner APIs remain
|
|
64
|
+
compatible with existing callers.
|
|
31
65
|
Its framed width in terminal cells equals the complete header's height in rows;
|
|
32
66
|
the interior canvas is `(header height - 2)` cells on each side. This is a
|
|
33
67
|
cell-square, not a pixel-square—terminal glyph cells are usually taller than wide.
|
|
@@ -43,14 +77,14 @@ color, holes and silhouette instead of recoloring neighbors when they touch.
|
|
|
43
77
|
The board remains full-width; only its horizontal logical resolution changes.
|
|
44
78
|
Completed rows intentionally flash white before collapsing; game-over and replay
|
|
45
79
|
resets also use white holds/wipes. Ordinary locking never changes color or shape.
|
|
46
|
-
Colored falling blocks support interiors up to 64 cells; the other artwork retains
|
|
80
|
+
Colored falling blocks, Pac-Man, Galaga and Frogger support interiors up to 64 cells; the other artwork retains
|
|
47
81
|
its 16-cell limit. Above the applicable limit, art is centered and padded rather
|
|
48
82
|
than clipped or stretched.
|
|
49
83
|
One `PWN::Banner.mini_names` animation is randomly
|
|
50
84
|
selected for the session and retained across redraws, model changes and resize;
|
|
51
85
|
changing the active session selects again. Frames advance at the banner API's
|
|
52
|
-
`mini_frame_seconds(name:)` cadence (0.05 seconds for
|
|
53
|
-
blocks/
|
|
86
|
+
`mini_frame_seconds(name:)` cadence (0.05 seconds for Asteroids/Galaga, 0.1 for
|
|
87
|
+
blocks/Snake/Pac-Man/Frogger) using monotonic time in the existing render loop—no extra animation
|
|
54
88
|
thread, input reader or provider call. This is decoration, not progress or
|
|
55
89
|
telemetry. The frame keeps the existing border/title theme roles. Artwork comes
|
|
56
90
|
from `PWN::Banner.mini_cells(branding: false)` with dedicated foreground/background curses pairs,
|
|
@@ -60,7 +94,7 @@ halves become a full block, not a half-block with its background lost). The `min
|
|
|
60
94
|
retains its 60-frame, 0.1-second loops for other callers. Both miniature APIs
|
|
61
95
|
default to their legacy branding; `branding: false` reclaims the label row and
|
|
62
96
|
leaves undersized fallback panes blank. Colored replays contain
|
|
63
|
-
1800 frames (90 seconds for
|
|
97
|
+
1800 frames (90 seconds for Asteroids, 180 for blocks/snake/Pac-Man), use a local
|
|
64
98
|
per-session seed, and share a bounded six-replay cache. Settings
|
|
65
99
|
wrap in the right-hand region without losing their label colors. A bounded,
|
|
66
100
|
nonrecursive layout pass grows the header and square together. If the terminal
|
|
@@ -266,7 +300,7 @@ and Ctrl+D still work. A running tool finishes cooperatively: neither rollback
|
|
|
266
300
|
nor remote provider billing cancellation is promised. Swarm jobs should use
|
|
267
301
|
noninteractive tools; their individual stdin prompts are not multiplexed.
|
|
268
302
|
|
|
269
|
-
Typed `/swarm
|
|
303
|
+
Typed `/swarm agents|mission|status|create|use|spawn|retire|dm|broadcast|debate|tail|steer|pause|resume|cancel`
|
|
270
304
|
commands remain available, including parameter completion. These are direct
|
|
271
305
|
operator commands and do not add the workspace's extra confirmation step.
|
|
272
306
|
`/swarm status JOB` includes retained outcomes. Jobs shown here belong to this
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pwn-ai-agent-solve
|
|
3
|
+
description: Drive PWN::AI::Agent::Solve from pwn_eval.
|
|
4
|
+
license: MIT
|
|
5
|
+
allowed-tools: [pwn, pwn_eval]
|
|
6
|
+
metadata:
|
|
7
|
+
bundled: true
|
|
8
|
+
generated: true
|
|
9
|
+
module: PWN::AI::Agent::Solve
|
|
10
|
+
source: pwn/ai/agent/solve.rb
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# PWN::AI::Agent::Solve
|
|
14
|
+
|
|
15
|
+
Revision-bound, single-writer team coordinator. Role replies are proposals, never observations. Only host-executed checks can become evidence.
|
|
16
|
+
|
|
17
|
+
## When to use
|
|
18
|
+
|
|
19
|
+
Call `PWN::AI::Agent::Solve` from `pwn_eval` when the task needs this module.
|
|
20
|
+
Do not reimplement it in shell.
|
|
21
|
+
|
|
22
|
+
## Methodologies
|
|
23
|
+
|
|
24
|
+
Generated from `pwn/ai/agent/solve.rb`. Prefer the public class methods below.
|
|
25
|
+
Class methods take `(opts = {})` and read `opts`.
|
|
26
|
+
|
|
27
|
+
## How to call
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
PWN::AI::Agent::Solve.help
|
|
31
|
+
PWN::AI::Agent::Solve.help(opts)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Public methods
|
|
35
|
+
|
|
36
|
+
- `authors`
|
|
37
|
+
- `help`
|
|
38
|
+
|
|
39
|
+
## Source
|
|
40
|
+
|
|
41
|
+
`pwn/ai/agent/solve.rb`
|
|
42
|
+
|
|
43
|
+
## Verification
|
|
44
|
+
|
|
45
|
+
`PWN::AI::Agent::Solve.respond_to?(:authors)` after the
|
|
46
|
+
module is loaded. Read the source for parameter names.
|
|
@@ -12,7 +12,7 @@ metadata:
|
|
|
12
12
|
|
|
13
13
|
# PWN::Banner
|
|
14
14
|
|
|
15
|
-
Static banners and pure, PWN-branded retro ASCII/color loops: falling_blocks, snake,
|
|
15
|
+
Static banners and pure, PWN-branded retro ASCII/color loops: falling_blocks, snake, pacman, asteroids, galaga and frogger. mini_frame returns fresh rows on a borderless canvas; use equal width and height (5..16) for complete square artwork. Dimensions clamp to 0..16 (colored blocks/Pac-Man/Galaga/Frogger: 0..64). Set branding: false for an unbranded pane with the wordmark row reclaimed for play; tiny panes then stay blank. The caller samples mini_names once per session and advances the explicit frame index every mini_frame_seconds(name:) (0.05 for Asteroids/Galaga, 0.1 otherwise). mini_cells replays 1800 seeded gameplay frames (MINI_FRAME_COUNT); mini_frame retains its legacy 60-frame ASCII loop. Inactive panes use seeded demos; MiniGame supplies caller-owned playable state. mini_cells uses local Random.new with seed 73 by default; callers may keep a different integer seed per session. Six immutable replays are cached. Tetrominoes stack and clear; snake pursues food and grows; Pac-Man eats pellets in connected mazes with chasing ghosts, energizers, recovery and new levels. Blocks use horizontal half-cells with independent foreground/background colors, filling the pane below PWN (up to 64 cells). Other games retain quadrant pixels; decorative snake stays centered with food/head color priority. White line-clear flashes and game-over/reset wipes are intentional. Pac-Man and ghosts occupy one cell each so even eight-cell panes retain internal walls and corridors. Directional mouths and compact ghost glyphs trade eye detail for maze geometry; spanning-tree mazes vary each round. Galaga has formations, dives, hostile fire, explosions and advancing waves; arrows move and Space fires. Frogger arrows hop through moving traffic and onto carrying logs to fill goals, recover from deaths and advance levels. Both start on input, run automatic demos when inactive and retain the UI owner. Legacy name: :pong remains accepted by direct APIs but is not selectable. Asteroids uses filled cyan ships on a 2x4 Braille raster, sparse small white rocks, yellow shots and red thrust; wrapped collisions split real rocks. Static Banner modules autoload only when needed. For more information, see: http://www.rubyinside.com/ruby-techniques-revealed-autoload-1652.html
|
|
16
16
|
|
|
17
17
|
## When to use
|
|
18
18
|
|
|
@@ -51,6 +51,9 @@ module PWN
|
|
|
51
51
|
entry = Registry.lookup(name: name) || Registry.lookup(name: repair_name(name: name))
|
|
52
52
|
return JSON.generate(error: "unknown tool: #{name}") unless entry
|
|
53
53
|
|
|
54
|
+
solve_tools = Thread.current[:pwn_solve_tools]
|
|
55
|
+
return JSON.generate(success: false, error: 'Tool denied by solve role capability boundary') if solve_tools && !solve_tools.include?(entry.name.to_s)
|
|
56
|
+
|
|
54
57
|
args = parse_args(raw: raw, entry: entry)
|
|
55
58
|
args = alias_known_keys(args: args, entry: entry)
|
|
56
59
|
schema = entry.schema[:parameters] || entry.schema['parameters'] || { type: 'object' }
|
data/lib/pwn/ai/agent/loop.rb
CHANGED
|
@@ -1704,6 +1704,8 @@ module PWN
|
|
|
1704
1704
|
# export_finetune can later teach the LoRA to NOT need it.
|
|
1705
1705
|
@escalate_warned = false
|
|
1706
1706
|
private_class_method def self.escalate(opts = {})
|
|
1707
|
+
return if Thread.current[:pwn_solve_tools]
|
|
1708
|
+
|
|
1707
1709
|
request = opts[:request]
|
|
1708
1710
|
turn_fails = opts[:turn_fails]
|
|
1709
1711
|
persona = agent_flag(key: :escalation_persona)
|
|
@@ -2058,7 +2060,7 @@ module PWN
|
|
|
2058
2060
|
)
|
|
2059
2061
|
|
|
2060
2062
|
runtime = Thread.current[:pwn_request_runtime]
|
|
2061
|
-
if runtime.respond_to?(:call)
|
|
2063
|
+
if runtime.respond_to?(:call) && !Thread.current[:pwn_solve_tools]
|
|
2062
2064
|
return runtime.call(messages: messages, tools: tools) do |prepared, route|
|
|
2063
2065
|
invoke_provider_chat(engine: (route || {})[:provider] || active_engine, messages: prepared, tools: tools, model: (route || {})[:model], temp: (route || {})[:temperature])
|
|
2064
2066
|
end
|
|
@@ -3160,6 +3162,16 @@ module PWN
|
|
|
3160
3162
|
end
|
|
3161
3163
|
|
|
3162
3164
|
# Commit the returned tool before unwinding, without stale recovery work.
|
|
3165
|
+
# Child handoffs are proposals, never a user completion. Solve owns
|
|
3166
|
+
# the original objective and the final artifact/evidence gate.
|
|
3167
|
+
private_class_method def self.solve_handoff?(opts = {})
|
|
3168
|
+
return false unless opts[:solve_handoff] && Thread.current[:pwn_solve_tools] && Array(opts[:calls]).empty?
|
|
3169
|
+
|
|
3170
|
+
JSON.parse(opts[:text]).is_a?(Hash)
|
|
3171
|
+
rescue JSON::ParserError
|
|
3172
|
+
false
|
|
3173
|
+
end
|
|
3174
|
+
|
|
3163
3175
|
private_class_method def self.steering_tool_checkpoint!(opts = {})
|
|
3164
3176
|
opts[:steering]&.checkpoint(messages: opts[:messages], phase: :tool) do
|
|
3165
3177
|
tc = opts[:tool_call]
|
|
@@ -3348,7 +3360,7 @@ module PWN
|
|
|
3348
3360
|
trivia = world_knowledge?(request: request)
|
|
3349
3361
|
catalog = catalog_lookup?(request: request)
|
|
3350
3362
|
browse = request_need(request: request) == :browse
|
|
3351
|
-
skip_compass = trivia || catalog || no_tools || browse
|
|
3363
|
+
skip_compass = trivia || catalog || no_tools || browse || opts[:solve_handoff]
|
|
3352
3364
|
# Trivia / catalog / browse do not get an implement-shaped
|
|
3353
3365
|
# English compass. Inventing "apply code/host changes" there
|
|
3354
3366
|
# keeps the model on a Navigate task after the page already loaded.
|
|
@@ -3372,7 +3384,7 @@ module PWN
|
|
|
3372
3384
|
Thread.current[:pwn_plan_predicted] = nil
|
|
3373
3385
|
cal_state = calibration_state
|
|
3374
3386
|
force_plan = cal_state[:force_plan]
|
|
3375
|
-
skip_plan = %i[howto recall greeting].include?(intent) ||
|
|
3387
|
+
skip_plan = %i[howto recall greeting].include?(intent) || skip_compass
|
|
3376
3388
|
did_plan = false
|
|
3377
3389
|
if !skip_plan && (force_plan || agent_flag(key: :plan_first, default: local) || budget_exhaustion_hot?) && !Array(tools).empty?
|
|
3378
3390
|
predicted = plan_first(messages: messages, request: request, ts_state: ts_state)
|
|
@@ -3523,6 +3535,8 @@ module PWN
|
|
|
3523
3535
|
|
|
3524
3536
|
messages << msg
|
|
3525
3537
|
|
|
3538
|
+
return text if solve_handoff?(opts.merge(text: text, calls: calls))
|
|
3539
|
+
|
|
3526
3540
|
if calls.empty?
|
|
3527
3541
|
# P28 — refuse polite mid-goal handoffs so multi-step tasks stay autonomous.
|
|
3528
3542
|
if incomplete_final?(text: text, last_iter: false)
|
|
@@ -3650,7 +3664,7 @@ module PWN
|
|
|
3650
3664
|
# P17 — never fork counterfactual when budget fingerprints dominate:
|
|
3651
3665
|
# CF is another mini agent loop and is the #1 amplifier of
|
|
3652
3666
|
# iteration-budget exhaustion on this host.
|
|
3653
|
-
if count >= thresh && !retryable_execution_failure?(raw: raw) && !escalated && defined?(Curriculum) && !budget_exhaustion_hot?
|
|
3667
|
+
if count >= thresh && !retryable_execution_failure?(raw: raw) && !escalated && defined?(Curriculum) && !budget_exhaustion_hot? && !opts[:solve_handoff]
|
|
3654
3668
|
cf = (turn_fails["cf:#{fkey}"] += 1) == 1 ? Curriculum.counterfactual(request: request, name: name, args: args, error: tele[:err] || raw[0, 200], hint: hint) : nil
|
|
3655
3669
|
hint = "#{hint}\n[pwn-ai/counterfactual] branch #{cf[:branch]} (score=#{cf[:score].round(2)}): #{cf[:content]}" if cf
|
|
3656
3670
|
end
|