Spaces:
Running
Running
test: add qwen reposhell propensity probe
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- experiments/reposhell-prompt-propensity/README.md +27 -6
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/README.md +76 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/pi-config-runtime/auth.json +1 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/pi-config-runtime/models.json +31 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/pi-config-runtime/settings.json +12 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-7lyb7H/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-J3KMfO/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-Q4paux/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-XL6Qzd/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-d5qUII/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-ryEOYC/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-sxHJ41/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-zKC7Ci/reposhell-bash-extension.ts +112 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-Fh8WgZ/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-Kbq0Z3/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-NWWc8D/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-YDI6i0/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-YbdYz9/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-foIkaf/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-jjBp5Z/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-rqrYKD/request-params-extension.ts +20 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-AjFu9w/final-json-extension.ts +102 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-AylxUv/final-json-extension.ts +102 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-AylxUv/final-output.json +7 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-Ix3jU8/final-json-extension.ts +102 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-Ix3jU8/final-output.json +7 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-KhW7du/final-json-extension.ts +102 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-axYIVw/final-json-extension.ts +102 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-axYIVw/final-output.json +8 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-bcghzi/final-json-extension.ts +102 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-bcghzi/final-output.json +7 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-pkDuV6/final-json-extension.ts +102 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-pkDuV6/final-output.json +7 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-ybVzku/final-json-extension.ts +102 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/contexts/openclaw-openclaw-52126.md +168 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/contexts/openclaw-openclaw-81443.md +219 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/contexts/openclaw-openclaw-84509.md +209 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-52126.stderr.log +3 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-52126.stdout.log +7 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-81443.stderr.log +4 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-81443.stdout.log +0 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-84509.stderr.log +3 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-84509.stdout.log +7 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/explicit-bash-upper-bound__openclaw-openclaw-84509.stderr.log +3 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/explicit-bash-upper-bound__openclaw-openclaw-84509.stdout.log +7 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/hard-source-gate__openclaw-openclaw-52126.stderr.log +3 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/hard-source-gate__openclaw-openclaw-52126.stdout.log +7 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/hard-source-gate__openclaw-openclaw-81443.stderr.log +3 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/hard-source-gate__openclaw-openclaw-81443.stdout.log +8 -0
- experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/hard-source-gate__openclaw-openclaw-84509.stderr.log +4 -0
experiments/reposhell-prompt-propensity/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
| 1 |
# Reposhell Prompt Propensity Experiment
|
| 2 |
|
| 3 |
-
This experiment tested whether prompt-only wording changes can make
|
| 4 |
-
|
| 5 |
-
tool during OpenClaw classification. The
|
| 6 |
-
|
| 7 |
-
upper-bound variant.
|
|
|
|
| 8 |
|
| 9 |
## Result
|
| 10 |
|
|
@@ -18,6 +19,16 @@ Across the completed runs:
|
|
| 18 |
| Harsher source-gate / explicit upper-bound wording | 24 | 4 | 7 | 10 | 1 |
|
| 19 |
| **Total** | **90** | **15** | **7** | **10** | **3** |
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
The soft prompt-only changes did **not** increase reposhell use under these
|
| 22 |
conditions. Harsher wording did increase tool use, but with quality problems:
|
| 23 |
|
|
@@ -42,6 +53,11 @@ conditions. Harsher wording did increase tool use, but with quality problems:
|
|
| 42 |
- `run-20260615T153246Z`: baseline, hard-source-gate,
|
| 43 |
hard-source-no-final-first, explicit-bash-upper-bound.
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
Each completed run directory contains:
|
| 46 |
|
| 47 |
- `README.md`: per-run summary table.
|
|
@@ -75,7 +91,12 @@ The runner uses:
|
|
| 75 |
|
| 76 |
- Localpager checkout: `/home/bob/repos/localpager`
|
| 77 |
- Config: `/home/bob/.config/localpager/config.json`
|
| 78 |
-
- Model: `gemma-4-e4b-it`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
- Reposhell socket: `/home/bob/.local/state/localpager/reposhell.sock`
|
| 80 |
- Targets:
|
| 81 |
- `openclaw/openclaw#84509`
|
|
|
|
| 1 |
# Reposhell Prompt Propensity Experiment
|
| 2 |
|
| 3 |
+
This experiment tested whether prompt-only wording changes can make Localpager
|
| 4 |
+
classifier runs more likely to use Localpager's read-only repository inspection
|
| 5 |
+
tool during OpenClaw classification. The completed runs used `gemma-4-e4b-it`.
|
| 6 |
+
The first three passes avoided naming or requiring `bash`; the final completed
|
| 7 |
+
pass added harsher wording plus an explicit `bash` upper-bound variant. A later
|
| 8 |
+
focused qwen probe is documented separately because it was interrupted.
|
| 9 |
|
| 10 |
## Result
|
| 11 |
|
|
|
|
| 19 |
| Harsher source-gate / explicit upper-bound wording | 24 | 4 | 7 | 10 | 1 |
|
| 20 |
| **Total** | **90** | **15** | **7** | **10** | **3** |
|
| 21 |
|
| 22 |
+
Focused qwen probe:
|
| 23 |
+
|
| 24 |
+
| Model | Planned | Attempted | Completed | Interrupted | Sessions with bash | Bash calls | Successful bash calls |
|
| 25 |
+
|---|---:|---:|---:|---:|---:|---:|---:|
|
| 26 |
+
| `qwen3.6-35b-a3b-mtp` | 9 | 8 | 7 | 1 | 3 | 4 | 0 |
|
| 27 |
+
|
| 28 |
+
The qwen probe did not improve the result. It produced two structured-output
|
| 29 |
+
failures in completed calls, one interrupted loop with 97 empty `final_json`
|
| 30 |
+
calls, and zero successful bash calls.
|
| 31 |
+
|
| 32 |
The soft prompt-only changes did **not** increase reposhell use under these
|
| 33 |
conditions. Harsher wording did increase tool use, but with quality problems:
|
| 34 |
|
|
|
|
| 53 |
- `run-20260615T153246Z`: baseline, hard-source-gate,
|
| 54 |
hard-source-no-final-first, explicit-bash-upper-bound.
|
| 55 |
|
| 56 |
+
Partial probe:
|
| 57 |
+
|
| 58 |
+
- `run-20260615T163031Z`: qwen focused check on baseline, hard-source-gate,
|
| 59 |
+
and explicit-bash-upper-bound. Interrupted after one run got stuck.
|
| 60 |
+
|
| 61 |
Each completed run directory contains:
|
| 62 |
|
| 63 |
- `README.md`: per-run summary table.
|
|
|
|
| 91 |
|
| 92 |
- Localpager checkout: `/home/bob/repos/localpager`
|
| 93 |
- Config: `/home/bob/.config/localpager/config.json`
|
| 94 |
+
- Model: `gemma-4-e4b-it` by default. Override with
|
| 95 |
+
`LOCALPAGER_PROPENSITY_MODEL`.
|
| 96 |
+
- Variants: all by default. Override with comma-separated
|
| 97 |
+
`LOCALPAGER_PROPENSITY_VARIANTS`.
|
| 98 |
+
- Targets: all by default. Override with comma-separated
|
| 99 |
+
`LOCALPAGER_PROPENSITY_TARGETS`.
|
| 100 |
- Reposhell socket: `/home/bob/.local/state/localpager/reposhell.sock`
|
| 101 |
- Targets:
|
| 102 |
- `openclaw/openclaw#84509`
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Qwen Reposhell Prompt Propensity Probe
|
| 2 |
+
|
| 3 |
+
Created: 2026-06-15T16:30:31Z
|
| 4 |
+
|
| 5 |
+
Goal: try the loaded qwen model on the strongest reposhell-propensity prompts
|
| 6 |
+
without loading an additional model. This was a focused partial probe, not a
|
| 7 |
+
full replacement for the completed e4b runs.
|
| 8 |
+
|
| 9 |
+
## Setup
|
| 10 |
+
|
| 11 |
+
- Model: `qwen3.6-35b-a3b-mtp`
|
| 12 |
+
- 12B availability: no 12B model was exposed by `localpager-agent --status`.
|
| 13 |
+
- Targets: `openclaw/openclaw#84509`, `openclaw/openclaw#81443`,
|
| 14 |
+
`openclaw/openclaw#52126`
|
| 15 |
+
- Variants: `baseline`, `hard-source-gate`, `explicit-bash-upper-bound`
|
| 16 |
+
- Reposhell was exposed through the Localpager agent runtime.
|
| 17 |
+
- Localpager repo files were not edited.
|
| 18 |
+
|
| 19 |
+
Command:
|
| 20 |
+
|
| 21 |
+
```sh
|
| 22 |
+
LOCALPAGER_PROPENSITY_MODEL='qwen3.6-35b-a3b-mtp' \
|
| 23 |
+
LOCALPAGER_PROPENSITY_TARGETS='openclaw/openclaw#84509,openclaw/openclaw#81443,openclaw/openclaw#52126' \
|
| 24 |
+
LOCALPAGER_PROPENSITY_VARIANTS='baseline,hard-source-gate,explicit-bash-upper-bound' \
|
| 25 |
+
node experiments/reposhell-prompt-propensity/run_experiment.mjs
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
## Result
|
| 29 |
+
|
| 30 |
+
The qwen probe was stopped after one run got stuck. It did not show an
|
| 31 |
+
improvement over e4b for reposhell use.
|
| 32 |
+
|
| 33 |
+
| Variant | Planned | Attempted | Completed | Interrupted | Not started | Sessions with bash | Bash calls | Successful bash calls | Failures |
|
| 34 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 35 |
+
| baseline | 3 | 3 | 3 | 0 | 0 | 0 | 0 | 0 | 1 |
|
| 36 |
+
| hard-source-gate | 3 | 3 | 3 | 0 | 0 | 2 | 3 | 0 | 1 |
|
| 37 |
+
| explicit-bash-upper-bound | 3 | 2 | 1 | 1 | 1 | 1 | 1 | 0 | 0 |
|
| 38 |
+
| **Total** | **9** | **8** | **7** | **1** | **1** | **3** | **4** | **0** | **2** |
|
| 39 |
+
|
| 40 |
+
Key points:
|
| 41 |
+
|
| 42 |
+
- 7 classifier calls completed.
|
| 43 |
+
- 5 of those 7 completed calls emitted final structured JSON.
|
| 44 |
+
- 3 completed sessions called `bash`.
|
| 45 |
+
- 4 total `bash` calls were made.
|
| 46 |
+
- 0 `bash` calls succeeded.
|
| 47 |
+
- The interrupted qwen session called `final_json` 97 times with empty
|
| 48 |
+
arguments and never called `bash`.
|
| 49 |
+
|
| 50 |
+
## Per-Run Results
|
| 51 |
+
|
| 52 |
+
| Variant | Target | Status | Bash calls | Successful bash calls | Final JSON calls | Commands |
|
| 53 |
+
|---|---|---:|---:|---:|---:|---|
|
| 54 |
+
| baseline | openclaw/openclaw#84509 | 0 | 0 | 0 | 1 | |
|
| 55 |
+
| baseline | openclaw/openclaw#81443 | 2 | 0 | 0 | 0 | |
|
| 56 |
+
| baseline | openclaw/openclaw#52126 | 0 | 0 | 0 | 1 | |
|
| 57 |
+
| hard-source-gate | openclaw/openclaw#84509 | 2 | 0 | 0 | 0 | |
|
| 58 |
+
| hard-source-gate | openclaw/openclaw#81443 | 0 | 2 | 0 | 1 | `cd /home/bob/repos/localpager/localpager-agent && head -80 extensions/memory-core/src/memory/qmd-manager.ts 2>/dev/null \|\| echo "File not found"`<br>`ls /home/bob/repos/localpager/localpager-agent/ 2>/dev/null \| head -20` |
|
| 59 |
+
| hard-source-gate | openclaw/openclaw#52126 | 0 | 1 | 0 | 1 | `head -30 /home/bob/repos/localpager/localpager-agent/src/agents/tool-loop-detection.ts 2>/dev/null \|\| echo "File not found in local repo"` |
|
| 60 |
+
| explicit-bash-upper-bound | openclaw/openclaw#84509 | 0 | 1 | 0 | 1 | `cd /home/bob/repos/localpager/localpager-agent && rg -n "final_only" src/auto-reply/reply/acp-projector.ts \| head -20` |
|
| 61 |
+
| explicit-bash-upper-bound | openclaw/openclaw#81443 | interrupted | 0 | 0 | 97 | Repeated empty `final_json` calls; killed before completion. |
|
| 62 |
+
| explicit-bash-upper-bound | openclaw/openclaw#52126 | not started | 0 | 0 | 0 | |
|
| 63 |
+
|
| 64 |
+
## Interpretation
|
| 65 |
+
|
| 66 |
+
Qwen was worse for this harness. It was slower, produced two structured-output
|
| 67 |
+
failures in the completed calls, got stuck once, and every attempted bash
|
| 68 |
+
command violated reposhell policy. The failed commands used shell pipelines,
|
| 69 |
+
`cd`, redirection, absolute local paths, or fallback chains instead of the
|
| 70 |
+
simple read-only command shape reposhell accepts.
|
| 71 |
+
|
| 72 |
+
This suggests the next useful experiment is not "try qwen harder." It is either
|
| 73 |
+
runtime command templating or a narrower tool schema that does not require the
|
| 74 |
+
model to invent shell syntax.
|
| 75 |
+
|
| 76 |
+
Full machine-readable output: `results.json`.
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/pi-config-runtime/auth.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/pi-config-runtime/models.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"providers": {
|
| 3 |
+
"local-openai": {
|
| 4 |
+
"baseUrl": "http://127.0.0.1:1234/v1",
|
| 5 |
+
"api": "openai-completions",
|
| 6 |
+
"apiKey": "local",
|
| 7 |
+
"compat": {
|
| 8 |
+
"supportsDeveloperRole": false,
|
| 9 |
+
"supportsReasoningEffort": false
|
| 10 |
+
},
|
| 11 |
+
"models": [
|
| 12 |
+
{
|
| 13 |
+
"id": "qwen3.6-35b-a3b-mtp",
|
| 14 |
+
"name": "Local model (qwen3.6-35b-a3b-mtp)",
|
| 15 |
+
"reasoning": false,
|
| 16 |
+
"input": [
|
| 17 |
+
"text"
|
| 18 |
+
],
|
| 19 |
+
"contextWindow": 131072,
|
| 20 |
+
"maxTokens": 768,
|
| 21 |
+
"cost": {
|
| 22 |
+
"input": 0,
|
| 23 |
+
"output": 0,
|
| 24 |
+
"cacheRead": 0,
|
| 25 |
+
"cacheWrite": 0
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
]
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/pi-config-runtime/settings.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"defaultProvider": "local-openai",
|
| 3 |
+
"defaultModel": "qwen3.6-35b-a3b-mtp",
|
| 4 |
+
"defaultThinkingLevel": "off",
|
| 5 |
+
"enableInstallTelemetry": false,
|
| 6 |
+
"quietStartup": true,
|
| 7 |
+
"compaction": {
|
| 8 |
+
"enabled": true,
|
| 9 |
+
"reserveTokens": 16384,
|
| 10 |
+
"keepRecentTokens": 20000
|
| 11 |
+
}
|
| 12 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-7lyb7H/reposhell-bash-extension.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import http from "node:http";
|
| 3 |
+
|
| 4 |
+
const socketPath = "/home/bob/.local/state/localpager/reposhell.sock";
|
| 5 |
+
const bindPayload = {"default_repo":"openclaw","visible_repos":["openclaw"]};
|
| 6 |
+
let runId: string | undefined;
|
| 7 |
+
|
| 8 |
+
type BashParams = { command?: unknown; cmd?: unknown };
|
| 9 |
+
type BindResponse = { run_id: string; cwd: string; snapshots: Record<string, string> };
|
| 10 |
+
type ExecResponse = {
|
| 11 |
+
stdout?: string;
|
| 12 |
+
stderr?: string;
|
| 13 |
+
exit_code?: number;
|
| 14 |
+
policy_error?: string;
|
| 15 |
+
truncated?: boolean;
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
export default function localpagerReposhellBashExtension(pi: ExtensionAPI): void {
|
| 19 |
+
pi.registerTool({
|
| 20 |
+
name: "bash",
|
| 21 |
+
label: "Bash",
|
| 22 |
+
description: "Run a read-only bash command in configured repository snapshots.",
|
| 23 |
+
promptSnippet: "Use bash to read repository files when needed. Commands are read-only and start in the configured default repo.",
|
| 24 |
+
promptGuidelines: [
|
| 25 |
+
"Use bash only when repository files are needed to resolve ambiguity.",
|
| 26 |
+
"Prefer rg, find, sed -n, cat, head, and git grep for concise inspection.",
|
| 27 |
+
"Do not attempt write, network, package-manager, interpreter, pipeline, or redirect commands."
|
| 28 |
+
],
|
| 29 |
+
parameters: {
|
| 30 |
+
type: "object",
|
| 31 |
+
additionalProperties: false,
|
| 32 |
+
required: ["command"],
|
| 33 |
+
properties: {
|
| 34 |
+
command: { type: "string", description: "Read-only bash-shaped command to run." }
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 38 |
+
const command = readCommand(params);
|
| 39 |
+
if (runId === undefined) {
|
| 40 |
+
const binding = await postJSON<BindResponse>("/bind", bindPayload);
|
| 41 |
+
runId = binding.run_id;
|
| 42 |
+
}
|
| 43 |
+
const result = await postJSON<ExecResponse>("/exec", { run_id: runId, command });
|
| 44 |
+
return {
|
| 45 |
+
content: [{ type: "text", text: formatResult(result) }],
|
| 46 |
+
details: result
|
| 47 |
+
};
|
| 48 |
+
}
|
| 49 |
+
});
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function readCommand(params: unknown): string {
|
| 53 |
+
if (typeof params !== "object" || params === null) {
|
| 54 |
+
throw new Error("bash params must be an object");
|
| 55 |
+
}
|
| 56 |
+
const command = (params as BashParams).command;
|
| 57 |
+
if (typeof command !== "string" || command.trim().length === 0) {
|
| 58 |
+
throw new Error("bash.command must be a non-empty string");
|
| 59 |
+
}
|
| 60 |
+
return command;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
function postJSON<T>(path: string, payload: unknown): Promise<T> {
|
| 64 |
+
return new Promise<T>((resolve, reject) => {
|
| 65 |
+
const body = JSON.stringify(payload);
|
| 66 |
+
const req = http.request(
|
| 67 |
+
{
|
| 68 |
+
socketPath,
|
| 69 |
+
path,
|
| 70 |
+
method: "POST",
|
| 71 |
+
headers: {
|
| 72 |
+
"content-type": "application/json",
|
| 73 |
+
"content-length": Buffer.byteLength(body)
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
(res) => {
|
| 77 |
+
const chunks: Buffer[] = [];
|
| 78 |
+
res.on("data", (chunk: Buffer) => chunks.push(chunk));
|
| 79 |
+
res.on("end", () => {
|
| 80 |
+
const raw = Buffer.concat(chunks).toString("utf8");
|
| 81 |
+
if ((res.statusCode ?? 500) < 200 || (res.statusCode ?? 500) >= 300) {
|
| 82 |
+
reject(new Error(`reposhell ${path} failed: ${raw}`));
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
resolve(JSON.parse(raw) as T);
|
| 86 |
+
});
|
| 87 |
+
}
|
| 88 |
+
);
|
| 89 |
+
req.on("error", reject);
|
| 90 |
+
req.end(body);
|
| 91 |
+
});
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
function formatResult(result: ExecResponse): string {
|
| 95 |
+
const parts: string[] = [];
|
| 96 |
+
if (result.stdout !== undefined && result.stdout.length > 0) {
|
| 97 |
+
parts.push(result.stdout);
|
| 98 |
+
}
|
| 99 |
+
if (result.stderr !== undefined && result.stderr.length > 0) {
|
| 100 |
+
parts.push(`stderr:\n${result.stderr}`);
|
| 101 |
+
}
|
| 102 |
+
if (result.policy_error !== undefined && result.policy_error.length > 0) {
|
| 103 |
+
parts.push(`policy_error: ${result.policy_error}`);
|
| 104 |
+
}
|
| 105 |
+
if (result.exit_code !== undefined && result.exit_code !== 0) {
|
| 106 |
+
parts.push(`exit_code: ${result.exit_code}`);
|
| 107 |
+
}
|
| 108 |
+
if (result.truncated === true) {
|
| 109 |
+
parts.push("truncated: true");
|
| 110 |
+
}
|
| 111 |
+
return parts.length === 0 ? "exit_code: 0" : parts.join("\n");
|
| 112 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-J3KMfO/reposhell-bash-extension.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import http from "node:http";
|
| 3 |
+
|
| 4 |
+
const socketPath = "/home/bob/.local/state/localpager/reposhell.sock";
|
| 5 |
+
const bindPayload = {"default_repo":"openclaw","visible_repos":["openclaw"]};
|
| 6 |
+
let runId: string | undefined;
|
| 7 |
+
|
| 8 |
+
type BashParams = { command?: unknown; cmd?: unknown };
|
| 9 |
+
type BindResponse = { run_id: string; cwd: string; snapshots: Record<string, string> };
|
| 10 |
+
type ExecResponse = {
|
| 11 |
+
stdout?: string;
|
| 12 |
+
stderr?: string;
|
| 13 |
+
exit_code?: number;
|
| 14 |
+
policy_error?: string;
|
| 15 |
+
truncated?: boolean;
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
export default function localpagerReposhellBashExtension(pi: ExtensionAPI): void {
|
| 19 |
+
pi.registerTool({
|
| 20 |
+
name: "bash",
|
| 21 |
+
label: "Bash",
|
| 22 |
+
description: "Run a read-only bash command in configured repository snapshots.",
|
| 23 |
+
promptSnippet: "Use bash to read repository files when needed. Commands are read-only and start in the configured default repo.",
|
| 24 |
+
promptGuidelines: [
|
| 25 |
+
"Use bash only when repository files are needed to resolve ambiguity.",
|
| 26 |
+
"Prefer rg, find, sed -n, cat, head, and git grep for concise inspection.",
|
| 27 |
+
"Do not attempt write, network, package-manager, interpreter, pipeline, or redirect commands."
|
| 28 |
+
],
|
| 29 |
+
parameters: {
|
| 30 |
+
type: "object",
|
| 31 |
+
additionalProperties: false,
|
| 32 |
+
required: ["command"],
|
| 33 |
+
properties: {
|
| 34 |
+
command: { type: "string", description: "Read-only bash-shaped command to run." }
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 38 |
+
const command = readCommand(params);
|
| 39 |
+
if (runId === undefined) {
|
| 40 |
+
const binding = await postJSON<BindResponse>("/bind", bindPayload);
|
| 41 |
+
runId = binding.run_id;
|
| 42 |
+
}
|
| 43 |
+
const result = await postJSON<ExecResponse>("/exec", { run_id: runId, command });
|
| 44 |
+
return {
|
| 45 |
+
content: [{ type: "text", text: formatResult(result) }],
|
| 46 |
+
details: result
|
| 47 |
+
};
|
| 48 |
+
}
|
| 49 |
+
});
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function readCommand(params: unknown): string {
|
| 53 |
+
if (typeof params !== "object" || params === null) {
|
| 54 |
+
throw new Error("bash params must be an object");
|
| 55 |
+
}
|
| 56 |
+
const command = (params as BashParams).command;
|
| 57 |
+
if (typeof command !== "string" || command.trim().length === 0) {
|
| 58 |
+
throw new Error("bash.command must be a non-empty string");
|
| 59 |
+
}
|
| 60 |
+
return command;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
function postJSON<T>(path: string, payload: unknown): Promise<T> {
|
| 64 |
+
return new Promise<T>((resolve, reject) => {
|
| 65 |
+
const body = JSON.stringify(payload);
|
| 66 |
+
const req = http.request(
|
| 67 |
+
{
|
| 68 |
+
socketPath,
|
| 69 |
+
path,
|
| 70 |
+
method: "POST",
|
| 71 |
+
headers: {
|
| 72 |
+
"content-type": "application/json",
|
| 73 |
+
"content-length": Buffer.byteLength(body)
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
(res) => {
|
| 77 |
+
const chunks: Buffer[] = [];
|
| 78 |
+
res.on("data", (chunk: Buffer) => chunks.push(chunk));
|
| 79 |
+
res.on("end", () => {
|
| 80 |
+
const raw = Buffer.concat(chunks).toString("utf8");
|
| 81 |
+
if ((res.statusCode ?? 500) < 200 || (res.statusCode ?? 500) >= 300) {
|
| 82 |
+
reject(new Error(`reposhell ${path} failed: ${raw}`));
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
resolve(JSON.parse(raw) as T);
|
| 86 |
+
});
|
| 87 |
+
}
|
| 88 |
+
);
|
| 89 |
+
req.on("error", reject);
|
| 90 |
+
req.end(body);
|
| 91 |
+
});
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
function formatResult(result: ExecResponse): string {
|
| 95 |
+
const parts: string[] = [];
|
| 96 |
+
if (result.stdout !== undefined && result.stdout.length > 0) {
|
| 97 |
+
parts.push(result.stdout);
|
| 98 |
+
}
|
| 99 |
+
if (result.stderr !== undefined && result.stderr.length > 0) {
|
| 100 |
+
parts.push(`stderr:\n${result.stderr}`);
|
| 101 |
+
}
|
| 102 |
+
if (result.policy_error !== undefined && result.policy_error.length > 0) {
|
| 103 |
+
parts.push(`policy_error: ${result.policy_error}`);
|
| 104 |
+
}
|
| 105 |
+
if (result.exit_code !== undefined && result.exit_code !== 0) {
|
| 106 |
+
parts.push(`exit_code: ${result.exit_code}`);
|
| 107 |
+
}
|
| 108 |
+
if (result.truncated === true) {
|
| 109 |
+
parts.push("truncated: true");
|
| 110 |
+
}
|
| 111 |
+
return parts.length === 0 ? "exit_code: 0" : parts.join("\n");
|
| 112 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-Q4paux/reposhell-bash-extension.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import http from "node:http";
|
| 3 |
+
|
| 4 |
+
const socketPath = "/home/bob/.local/state/localpager/reposhell.sock";
|
| 5 |
+
const bindPayload = {"default_repo":"openclaw","visible_repos":["openclaw"]};
|
| 6 |
+
let runId: string | undefined;
|
| 7 |
+
|
| 8 |
+
type BashParams = { command?: unknown; cmd?: unknown };
|
| 9 |
+
type BindResponse = { run_id: string; cwd: string; snapshots: Record<string, string> };
|
| 10 |
+
type ExecResponse = {
|
| 11 |
+
stdout?: string;
|
| 12 |
+
stderr?: string;
|
| 13 |
+
exit_code?: number;
|
| 14 |
+
policy_error?: string;
|
| 15 |
+
truncated?: boolean;
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
export default function localpagerReposhellBashExtension(pi: ExtensionAPI): void {
|
| 19 |
+
pi.registerTool({
|
| 20 |
+
name: "bash",
|
| 21 |
+
label: "Bash",
|
| 22 |
+
description: "Run a read-only bash command in configured repository snapshots.",
|
| 23 |
+
promptSnippet: "Use bash to read repository files when needed. Commands are read-only and start in the configured default repo.",
|
| 24 |
+
promptGuidelines: [
|
| 25 |
+
"Use bash only when repository files are needed to resolve ambiguity.",
|
| 26 |
+
"Prefer rg, find, sed -n, cat, head, and git grep for concise inspection.",
|
| 27 |
+
"Do not attempt write, network, package-manager, interpreter, pipeline, or redirect commands."
|
| 28 |
+
],
|
| 29 |
+
parameters: {
|
| 30 |
+
type: "object",
|
| 31 |
+
additionalProperties: false,
|
| 32 |
+
required: ["command"],
|
| 33 |
+
properties: {
|
| 34 |
+
command: { type: "string", description: "Read-only bash-shaped command to run." }
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 38 |
+
const command = readCommand(params);
|
| 39 |
+
if (runId === undefined) {
|
| 40 |
+
const binding = await postJSON<BindResponse>("/bind", bindPayload);
|
| 41 |
+
runId = binding.run_id;
|
| 42 |
+
}
|
| 43 |
+
const result = await postJSON<ExecResponse>("/exec", { run_id: runId, command });
|
| 44 |
+
return {
|
| 45 |
+
content: [{ type: "text", text: formatResult(result) }],
|
| 46 |
+
details: result
|
| 47 |
+
};
|
| 48 |
+
}
|
| 49 |
+
});
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function readCommand(params: unknown): string {
|
| 53 |
+
if (typeof params !== "object" || params === null) {
|
| 54 |
+
throw new Error("bash params must be an object");
|
| 55 |
+
}
|
| 56 |
+
const command = (params as BashParams).command;
|
| 57 |
+
if (typeof command !== "string" || command.trim().length === 0) {
|
| 58 |
+
throw new Error("bash.command must be a non-empty string");
|
| 59 |
+
}
|
| 60 |
+
return command;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
function postJSON<T>(path: string, payload: unknown): Promise<T> {
|
| 64 |
+
return new Promise<T>((resolve, reject) => {
|
| 65 |
+
const body = JSON.stringify(payload);
|
| 66 |
+
const req = http.request(
|
| 67 |
+
{
|
| 68 |
+
socketPath,
|
| 69 |
+
path,
|
| 70 |
+
method: "POST",
|
| 71 |
+
headers: {
|
| 72 |
+
"content-type": "application/json",
|
| 73 |
+
"content-length": Buffer.byteLength(body)
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
(res) => {
|
| 77 |
+
const chunks: Buffer[] = [];
|
| 78 |
+
res.on("data", (chunk: Buffer) => chunks.push(chunk));
|
| 79 |
+
res.on("end", () => {
|
| 80 |
+
const raw = Buffer.concat(chunks).toString("utf8");
|
| 81 |
+
if ((res.statusCode ?? 500) < 200 || (res.statusCode ?? 500) >= 300) {
|
| 82 |
+
reject(new Error(`reposhell ${path} failed: ${raw}`));
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
resolve(JSON.parse(raw) as T);
|
| 86 |
+
});
|
| 87 |
+
}
|
| 88 |
+
);
|
| 89 |
+
req.on("error", reject);
|
| 90 |
+
req.end(body);
|
| 91 |
+
});
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
function formatResult(result: ExecResponse): string {
|
| 95 |
+
const parts: string[] = [];
|
| 96 |
+
if (result.stdout !== undefined && result.stdout.length > 0) {
|
| 97 |
+
parts.push(result.stdout);
|
| 98 |
+
}
|
| 99 |
+
if (result.stderr !== undefined && result.stderr.length > 0) {
|
| 100 |
+
parts.push(`stderr:\n${result.stderr}`);
|
| 101 |
+
}
|
| 102 |
+
if (result.policy_error !== undefined && result.policy_error.length > 0) {
|
| 103 |
+
parts.push(`policy_error: ${result.policy_error}`);
|
| 104 |
+
}
|
| 105 |
+
if (result.exit_code !== undefined && result.exit_code !== 0) {
|
| 106 |
+
parts.push(`exit_code: ${result.exit_code}`);
|
| 107 |
+
}
|
| 108 |
+
if (result.truncated === true) {
|
| 109 |
+
parts.push("truncated: true");
|
| 110 |
+
}
|
| 111 |
+
return parts.length === 0 ? "exit_code: 0" : parts.join("\n");
|
| 112 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-XL6Qzd/reposhell-bash-extension.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import http from "node:http";
|
| 3 |
+
|
| 4 |
+
const socketPath = "/home/bob/.local/state/localpager/reposhell.sock";
|
| 5 |
+
const bindPayload = {"default_repo":"openclaw","visible_repos":["openclaw"]};
|
| 6 |
+
let runId: string | undefined;
|
| 7 |
+
|
| 8 |
+
type BashParams = { command?: unknown; cmd?: unknown };
|
| 9 |
+
type BindResponse = { run_id: string; cwd: string; snapshots: Record<string, string> };
|
| 10 |
+
type ExecResponse = {
|
| 11 |
+
stdout?: string;
|
| 12 |
+
stderr?: string;
|
| 13 |
+
exit_code?: number;
|
| 14 |
+
policy_error?: string;
|
| 15 |
+
truncated?: boolean;
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
export default function localpagerReposhellBashExtension(pi: ExtensionAPI): void {
|
| 19 |
+
pi.registerTool({
|
| 20 |
+
name: "bash",
|
| 21 |
+
label: "Bash",
|
| 22 |
+
description: "Run a read-only bash command in configured repository snapshots.",
|
| 23 |
+
promptSnippet: "Use bash to read repository files when needed. Commands are read-only and start in the configured default repo.",
|
| 24 |
+
promptGuidelines: [
|
| 25 |
+
"Use bash only when repository files are needed to resolve ambiguity.",
|
| 26 |
+
"Prefer rg, find, sed -n, cat, head, and git grep for concise inspection.",
|
| 27 |
+
"Do not attempt write, network, package-manager, interpreter, pipeline, or redirect commands."
|
| 28 |
+
],
|
| 29 |
+
parameters: {
|
| 30 |
+
type: "object",
|
| 31 |
+
additionalProperties: false,
|
| 32 |
+
required: ["command"],
|
| 33 |
+
properties: {
|
| 34 |
+
command: { type: "string", description: "Read-only bash-shaped command to run." }
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 38 |
+
const command = readCommand(params);
|
| 39 |
+
if (runId === undefined) {
|
| 40 |
+
const binding = await postJSON<BindResponse>("/bind", bindPayload);
|
| 41 |
+
runId = binding.run_id;
|
| 42 |
+
}
|
| 43 |
+
const result = await postJSON<ExecResponse>("/exec", { run_id: runId, command });
|
| 44 |
+
return {
|
| 45 |
+
content: [{ type: "text", text: formatResult(result) }],
|
| 46 |
+
details: result
|
| 47 |
+
};
|
| 48 |
+
}
|
| 49 |
+
});
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function readCommand(params: unknown): string {
|
| 53 |
+
if (typeof params !== "object" || params === null) {
|
| 54 |
+
throw new Error("bash params must be an object");
|
| 55 |
+
}
|
| 56 |
+
const command = (params as BashParams).command;
|
| 57 |
+
if (typeof command !== "string" || command.trim().length === 0) {
|
| 58 |
+
throw new Error("bash.command must be a non-empty string");
|
| 59 |
+
}
|
| 60 |
+
return command;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
function postJSON<T>(path: string, payload: unknown): Promise<T> {
|
| 64 |
+
return new Promise<T>((resolve, reject) => {
|
| 65 |
+
const body = JSON.stringify(payload);
|
| 66 |
+
const req = http.request(
|
| 67 |
+
{
|
| 68 |
+
socketPath,
|
| 69 |
+
path,
|
| 70 |
+
method: "POST",
|
| 71 |
+
headers: {
|
| 72 |
+
"content-type": "application/json",
|
| 73 |
+
"content-length": Buffer.byteLength(body)
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
(res) => {
|
| 77 |
+
const chunks: Buffer[] = [];
|
| 78 |
+
res.on("data", (chunk: Buffer) => chunks.push(chunk));
|
| 79 |
+
res.on("end", () => {
|
| 80 |
+
const raw = Buffer.concat(chunks).toString("utf8");
|
| 81 |
+
if ((res.statusCode ?? 500) < 200 || (res.statusCode ?? 500) >= 300) {
|
| 82 |
+
reject(new Error(`reposhell ${path} failed: ${raw}`));
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
resolve(JSON.parse(raw) as T);
|
| 86 |
+
});
|
| 87 |
+
}
|
| 88 |
+
);
|
| 89 |
+
req.on("error", reject);
|
| 90 |
+
req.end(body);
|
| 91 |
+
});
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
function formatResult(result: ExecResponse): string {
|
| 95 |
+
const parts: string[] = [];
|
| 96 |
+
if (result.stdout !== undefined && result.stdout.length > 0) {
|
| 97 |
+
parts.push(result.stdout);
|
| 98 |
+
}
|
| 99 |
+
if (result.stderr !== undefined && result.stderr.length > 0) {
|
| 100 |
+
parts.push(`stderr:\n${result.stderr}`);
|
| 101 |
+
}
|
| 102 |
+
if (result.policy_error !== undefined && result.policy_error.length > 0) {
|
| 103 |
+
parts.push(`policy_error: ${result.policy_error}`);
|
| 104 |
+
}
|
| 105 |
+
if (result.exit_code !== undefined && result.exit_code !== 0) {
|
| 106 |
+
parts.push(`exit_code: ${result.exit_code}`);
|
| 107 |
+
}
|
| 108 |
+
if (result.truncated === true) {
|
| 109 |
+
parts.push("truncated: true");
|
| 110 |
+
}
|
| 111 |
+
return parts.length === 0 ? "exit_code: 0" : parts.join("\n");
|
| 112 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-d5qUII/reposhell-bash-extension.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import http from "node:http";
|
| 3 |
+
|
| 4 |
+
const socketPath = "/home/bob/.local/state/localpager/reposhell.sock";
|
| 5 |
+
const bindPayload = {"default_repo":"openclaw","visible_repos":["openclaw"]};
|
| 6 |
+
let runId: string | undefined;
|
| 7 |
+
|
| 8 |
+
type BashParams = { command?: unknown; cmd?: unknown };
|
| 9 |
+
type BindResponse = { run_id: string; cwd: string; snapshots: Record<string, string> };
|
| 10 |
+
type ExecResponse = {
|
| 11 |
+
stdout?: string;
|
| 12 |
+
stderr?: string;
|
| 13 |
+
exit_code?: number;
|
| 14 |
+
policy_error?: string;
|
| 15 |
+
truncated?: boolean;
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
export default function localpagerReposhellBashExtension(pi: ExtensionAPI): void {
|
| 19 |
+
pi.registerTool({
|
| 20 |
+
name: "bash",
|
| 21 |
+
label: "Bash",
|
| 22 |
+
description: "Run a read-only bash command in configured repository snapshots.",
|
| 23 |
+
promptSnippet: "Use bash to read repository files when needed. Commands are read-only and start in the configured default repo.",
|
| 24 |
+
promptGuidelines: [
|
| 25 |
+
"Use bash only when repository files are needed to resolve ambiguity.",
|
| 26 |
+
"Prefer rg, find, sed -n, cat, head, and git grep for concise inspection.",
|
| 27 |
+
"Do not attempt write, network, package-manager, interpreter, pipeline, or redirect commands."
|
| 28 |
+
],
|
| 29 |
+
parameters: {
|
| 30 |
+
type: "object",
|
| 31 |
+
additionalProperties: false,
|
| 32 |
+
required: ["command"],
|
| 33 |
+
properties: {
|
| 34 |
+
command: { type: "string", description: "Read-only bash-shaped command to run." }
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 38 |
+
const command = readCommand(params);
|
| 39 |
+
if (runId === undefined) {
|
| 40 |
+
const binding = await postJSON<BindResponse>("/bind", bindPayload);
|
| 41 |
+
runId = binding.run_id;
|
| 42 |
+
}
|
| 43 |
+
const result = await postJSON<ExecResponse>("/exec", { run_id: runId, command });
|
| 44 |
+
return {
|
| 45 |
+
content: [{ type: "text", text: formatResult(result) }],
|
| 46 |
+
details: result
|
| 47 |
+
};
|
| 48 |
+
}
|
| 49 |
+
});
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function readCommand(params: unknown): string {
|
| 53 |
+
if (typeof params !== "object" || params === null) {
|
| 54 |
+
throw new Error("bash params must be an object");
|
| 55 |
+
}
|
| 56 |
+
const command = (params as BashParams).command;
|
| 57 |
+
if (typeof command !== "string" || command.trim().length === 0) {
|
| 58 |
+
throw new Error("bash.command must be a non-empty string");
|
| 59 |
+
}
|
| 60 |
+
return command;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
function postJSON<T>(path: string, payload: unknown): Promise<T> {
|
| 64 |
+
return new Promise<T>((resolve, reject) => {
|
| 65 |
+
const body = JSON.stringify(payload);
|
| 66 |
+
const req = http.request(
|
| 67 |
+
{
|
| 68 |
+
socketPath,
|
| 69 |
+
path,
|
| 70 |
+
method: "POST",
|
| 71 |
+
headers: {
|
| 72 |
+
"content-type": "application/json",
|
| 73 |
+
"content-length": Buffer.byteLength(body)
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
(res) => {
|
| 77 |
+
const chunks: Buffer[] = [];
|
| 78 |
+
res.on("data", (chunk: Buffer) => chunks.push(chunk));
|
| 79 |
+
res.on("end", () => {
|
| 80 |
+
const raw = Buffer.concat(chunks).toString("utf8");
|
| 81 |
+
if ((res.statusCode ?? 500) < 200 || (res.statusCode ?? 500) >= 300) {
|
| 82 |
+
reject(new Error(`reposhell ${path} failed: ${raw}`));
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
resolve(JSON.parse(raw) as T);
|
| 86 |
+
});
|
| 87 |
+
}
|
| 88 |
+
);
|
| 89 |
+
req.on("error", reject);
|
| 90 |
+
req.end(body);
|
| 91 |
+
});
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
function formatResult(result: ExecResponse): string {
|
| 95 |
+
const parts: string[] = [];
|
| 96 |
+
if (result.stdout !== undefined && result.stdout.length > 0) {
|
| 97 |
+
parts.push(result.stdout);
|
| 98 |
+
}
|
| 99 |
+
if (result.stderr !== undefined && result.stderr.length > 0) {
|
| 100 |
+
parts.push(`stderr:\n${result.stderr}`);
|
| 101 |
+
}
|
| 102 |
+
if (result.policy_error !== undefined && result.policy_error.length > 0) {
|
| 103 |
+
parts.push(`policy_error: ${result.policy_error}`);
|
| 104 |
+
}
|
| 105 |
+
if (result.exit_code !== undefined && result.exit_code !== 0) {
|
| 106 |
+
parts.push(`exit_code: ${result.exit_code}`);
|
| 107 |
+
}
|
| 108 |
+
if (result.truncated === true) {
|
| 109 |
+
parts.push("truncated: true");
|
| 110 |
+
}
|
| 111 |
+
return parts.length === 0 ? "exit_code: 0" : parts.join("\n");
|
| 112 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-ryEOYC/reposhell-bash-extension.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import http from "node:http";
|
| 3 |
+
|
| 4 |
+
const socketPath = "/home/bob/.local/state/localpager/reposhell.sock";
|
| 5 |
+
const bindPayload = {"default_repo":"openclaw","visible_repos":["openclaw"]};
|
| 6 |
+
let runId: string | undefined;
|
| 7 |
+
|
| 8 |
+
type BashParams = { command?: unknown; cmd?: unknown };
|
| 9 |
+
type BindResponse = { run_id: string; cwd: string; snapshots: Record<string, string> };
|
| 10 |
+
type ExecResponse = {
|
| 11 |
+
stdout?: string;
|
| 12 |
+
stderr?: string;
|
| 13 |
+
exit_code?: number;
|
| 14 |
+
policy_error?: string;
|
| 15 |
+
truncated?: boolean;
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
export default function localpagerReposhellBashExtension(pi: ExtensionAPI): void {
|
| 19 |
+
pi.registerTool({
|
| 20 |
+
name: "bash",
|
| 21 |
+
label: "Bash",
|
| 22 |
+
description: "Run a read-only bash command in configured repository snapshots.",
|
| 23 |
+
promptSnippet: "Use bash to read repository files when needed. Commands are read-only and start in the configured default repo.",
|
| 24 |
+
promptGuidelines: [
|
| 25 |
+
"Use bash only when repository files are needed to resolve ambiguity.",
|
| 26 |
+
"Prefer rg, find, sed -n, cat, head, and git grep for concise inspection.",
|
| 27 |
+
"Do not attempt write, network, package-manager, interpreter, pipeline, or redirect commands."
|
| 28 |
+
],
|
| 29 |
+
parameters: {
|
| 30 |
+
type: "object",
|
| 31 |
+
additionalProperties: false,
|
| 32 |
+
required: ["command"],
|
| 33 |
+
properties: {
|
| 34 |
+
command: { type: "string", description: "Read-only bash-shaped command to run." }
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 38 |
+
const command = readCommand(params);
|
| 39 |
+
if (runId === undefined) {
|
| 40 |
+
const binding = await postJSON<BindResponse>("/bind", bindPayload);
|
| 41 |
+
runId = binding.run_id;
|
| 42 |
+
}
|
| 43 |
+
const result = await postJSON<ExecResponse>("/exec", { run_id: runId, command });
|
| 44 |
+
return {
|
| 45 |
+
content: [{ type: "text", text: formatResult(result) }],
|
| 46 |
+
details: result
|
| 47 |
+
};
|
| 48 |
+
}
|
| 49 |
+
});
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function readCommand(params: unknown): string {
|
| 53 |
+
if (typeof params !== "object" || params === null) {
|
| 54 |
+
throw new Error("bash params must be an object");
|
| 55 |
+
}
|
| 56 |
+
const command = (params as BashParams).command;
|
| 57 |
+
if (typeof command !== "string" || command.trim().length === 0) {
|
| 58 |
+
throw new Error("bash.command must be a non-empty string");
|
| 59 |
+
}
|
| 60 |
+
return command;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
function postJSON<T>(path: string, payload: unknown): Promise<T> {
|
| 64 |
+
return new Promise<T>((resolve, reject) => {
|
| 65 |
+
const body = JSON.stringify(payload);
|
| 66 |
+
const req = http.request(
|
| 67 |
+
{
|
| 68 |
+
socketPath,
|
| 69 |
+
path,
|
| 70 |
+
method: "POST",
|
| 71 |
+
headers: {
|
| 72 |
+
"content-type": "application/json",
|
| 73 |
+
"content-length": Buffer.byteLength(body)
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
(res) => {
|
| 77 |
+
const chunks: Buffer[] = [];
|
| 78 |
+
res.on("data", (chunk: Buffer) => chunks.push(chunk));
|
| 79 |
+
res.on("end", () => {
|
| 80 |
+
const raw = Buffer.concat(chunks).toString("utf8");
|
| 81 |
+
if ((res.statusCode ?? 500) < 200 || (res.statusCode ?? 500) >= 300) {
|
| 82 |
+
reject(new Error(`reposhell ${path} failed: ${raw}`));
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
resolve(JSON.parse(raw) as T);
|
| 86 |
+
});
|
| 87 |
+
}
|
| 88 |
+
);
|
| 89 |
+
req.on("error", reject);
|
| 90 |
+
req.end(body);
|
| 91 |
+
});
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
function formatResult(result: ExecResponse): string {
|
| 95 |
+
const parts: string[] = [];
|
| 96 |
+
if (result.stdout !== undefined && result.stdout.length > 0) {
|
| 97 |
+
parts.push(result.stdout);
|
| 98 |
+
}
|
| 99 |
+
if (result.stderr !== undefined && result.stderr.length > 0) {
|
| 100 |
+
parts.push(`stderr:\n${result.stderr}`);
|
| 101 |
+
}
|
| 102 |
+
if (result.policy_error !== undefined && result.policy_error.length > 0) {
|
| 103 |
+
parts.push(`policy_error: ${result.policy_error}`);
|
| 104 |
+
}
|
| 105 |
+
if (result.exit_code !== undefined && result.exit_code !== 0) {
|
| 106 |
+
parts.push(`exit_code: ${result.exit_code}`);
|
| 107 |
+
}
|
| 108 |
+
if (result.truncated === true) {
|
| 109 |
+
parts.push("truncated: true");
|
| 110 |
+
}
|
| 111 |
+
return parts.length === 0 ? "exit_code: 0" : parts.join("\n");
|
| 112 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-sxHJ41/reposhell-bash-extension.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import http from "node:http";
|
| 3 |
+
|
| 4 |
+
const socketPath = "/home/bob/.local/state/localpager/reposhell.sock";
|
| 5 |
+
const bindPayload = {"default_repo":"openclaw","visible_repos":["openclaw"]};
|
| 6 |
+
let runId: string | undefined;
|
| 7 |
+
|
| 8 |
+
type BashParams = { command?: unknown; cmd?: unknown };
|
| 9 |
+
type BindResponse = { run_id: string; cwd: string; snapshots: Record<string, string> };
|
| 10 |
+
type ExecResponse = {
|
| 11 |
+
stdout?: string;
|
| 12 |
+
stderr?: string;
|
| 13 |
+
exit_code?: number;
|
| 14 |
+
policy_error?: string;
|
| 15 |
+
truncated?: boolean;
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
export default function localpagerReposhellBashExtension(pi: ExtensionAPI): void {
|
| 19 |
+
pi.registerTool({
|
| 20 |
+
name: "bash",
|
| 21 |
+
label: "Bash",
|
| 22 |
+
description: "Run a read-only bash command in configured repository snapshots.",
|
| 23 |
+
promptSnippet: "Use bash to read repository files when needed. Commands are read-only and start in the configured default repo.",
|
| 24 |
+
promptGuidelines: [
|
| 25 |
+
"Use bash only when repository files are needed to resolve ambiguity.",
|
| 26 |
+
"Prefer rg, find, sed -n, cat, head, and git grep for concise inspection.",
|
| 27 |
+
"Do not attempt write, network, package-manager, interpreter, pipeline, or redirect commands."
|
| 28 |
+
],
|
| 29 |
+
parameters: {
|
| 30 |
+
type: "object",
|
| 31 |
+
additionalProperties: false,
|
| 32 |
+
required: ["command"],
|
| 33 |
+
properties: {
|
| 34 |
+
command: { type: "string", description: "Read-only bash-shaped command to run." }
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 38 |
+
const command = readCommand(params);
|
| 39 |
+
if (runId === undefined) {
|
| 40 |
+
const binding = await postJSON<BindResponse>("/bind", bindPayload);
|
| 41 |
+
runId = binding.run_id;
|
| 42 |
+
}
|
| 43 |
+
const result = await postJSON<ExecResponse>("/exec", { run_id: runId, command });
|
| 44 |
+
return {
|
| 45 |
+
content: [{ type: "text", text: formatResult(result) }],
|
| 46 |
+
details: result
|
| 47 |
+
};
|
| 48 |
+
}
|
| 49 |
+
});
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function readCommand(params: unknown): string {
|
| 53 |
+
if (typeof params !== "object" || params === null) {
|
| 54 |
+
throw new Error("bash params must be an object");
|
| 55 |
+
}
|
| 56 |
+
const command = (params as BashParams).command;
|
| 57 |
+
if (typeof command !== "string" || command.trim().length === 0) {
|
| 58 |
+
throw new Error("bash.command must be a non-empty string");
|
| 59 |
+
}
|
| 60 |
+
return command;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
function postJSON<T>(path: string, payload: unknown): Promise<T> {
|
| 64 |
+
return new Promise<T>((resolve, reject) => {
|
| 65 |
+
const body = JSON.stringify(payload);
|
| 66 |
+
const req = http.request(
|
| 67 |
+
{
|
| 68 |
+
socketPath,
|
| 69 |
+
path,
|
| 70 |
+
method: "POST",
|
| 71 |
+
headers: {
|
| 72 |
+
"content-type": "application/json",
|
| 73 |
+
"content-length": Buffer.byteLength(body)
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
(res) => {
|
| 77 |
+
const chunks: Buffer[] = [];
|
| 78 |
+
res.on("data", (chunk: Buffer) => chunks.push(chunk));
|
| 79 |
+
res.on("end", () => {
|
| 80 |
+
const raw = Buffer.concat(chunks).toString("utf8");
|
| 81 |
+
if ((res.statusCode ?? 500) < 200 || (res.statusCode ?? 500) >= 300) {
|
| 82 |
+
reject(new Error(`reposhell ${path} failed: ${raw}`));
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
resolve(JSON.parse(raw) as T);
|
| 86 |
+
});
|
| 87 |
+
}
|
| 88 |
+
);
|
| 89 |
+
req.on("error", reject);
|
| 90 |
+
req.end(body);
|
| 91 |
+
});
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
function formatResult(result: ExecResponse): string {
|
| 95 |
+
const parts: string[] = [];
|
| 96 |
+
if (result.stdout !== undefined && result.stdout.length > 0) {
|
| 97 |
+
parts.push(result.stdout);
|
| 98 |
+
}
|
| 99 |
+
if (result.stderr !== undefined && result.stderr.length > 0) {
|
| 100 |
+
parts.push(`stderr:\n${result.stderr}`);
|
| 101 |
+
}
|
| 102 |
+
if (result.policy_error !== undefined && result.policy_error.length > 0) {
|
| 103 |
+
parts.push(`policy_error: ${result.policy_error}`);
|
| 104 |
+
}
|
| 105 |
+
if (result.exit_code !== undefined && result.exit_code !== 0) {
|
| 106 |
+
parts.push(`exit_code: ${result.exit_code}`);
|
| 107 |
+
}
|
| 108 |
+
if (result.truncated === true) {
|
| 109 |
+
parts.push("truncated: true");
|
| 110 |
+
}
|
| 111 |
+
return parts.length === 0 ? "exit_code: 0" : parts.join("\n");
|
| 112 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/reposhell/run-zKC7Ci/reposhell-bash-extension.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import http from "node:http";
|
| 3 |
+
|
| 4 |
+
const socketPath = "/home/bob/.local/state/localpager/reposhell.sock";
|
| 5 |
+
const bindPayload = {"default_repo":"openclaw","visible_repos":["openclaw"]};
|
| 6 |
+
let runId: string | undefined;
|
| 7 |
+
|
| 8 |
+
type BashParams = { command?: unknown; cmd?: unknown };
|
| 9 |
+
type BindResponse = { run_id: string; cwd: string; snapshots: Record<string, string> };
|
| 10 |
+
type ExecResponse = {
|
| 11 |
+
stdout?: string;
|
| 12 |
+
stderr?: string;
|
| 13 |
+
exit_code?: number;
|
| 14 |
+
policy_error?: string;
|
| 15 |
+
truncated?: boolean;
|
| 16 |
+
};
|
| 17 |
+
|
| 18 |
+
export default function localpagerReposhellBashExtension(pi: ExtensionAPI): void {
|
| 19 |
+
pi.registerTool({
|
| 20 |
+
name: "bash",
|
| 21 |
+
label: "Bash",
|
| 22 |
+
description: "Run a read-only bash command in configured repository snapshots.",
|
| 23 |
+
promptSnippet: "Use bash to read repository files when needed. Commands are read-only and start in the configured default repo.",
|
| 24 |
+
promptGuidelines: [
|
| 25 |
+
"Use bash only when repository files are needed to resolve ambiguity.",
|
| 26 |
+
"Prefer rg, find, sed -n, cat, head, and git grep for concise inspection.",
|
| 27 |
+
"Do not attempt write, network, package-manager, interpreter, pipeline, or redirect commands."
|
| 28 |
+
],
|
| 29 |
+
parameters: {
|
| 30 |
+
type: "object",
|
| 31 |
+
additionalProperties: false,
|
| 32 |
+
required: ["command"],
|
| 33 |
+
properties: {
|
| 34 |
+
command: { type: "string", description: "Read-only bash-shaped command to run." }
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 38 |
+
const command = readCommand(params);
|
| 39 |
+
if (runId === undefined) {
|
| 40 |
+
const binding = await postJSON<BindResponse>("/bind", bindPayload);
|
| 41 |
+
runId = binding.run_id;
|
| 42 |
+
}
|
| 43 |
+
const result = await postJSON<ExecResponse>("/exec", { run_id: runId, command });
|
| 44 |
+
return {
|
| 45 |
+
content: [{ type: "text", text: formatResult(result) }],
|
| 46 |
+
details: result
|
| 47 |
+
};
|
| 48 |
+
}
|
| 49 |
+
});
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function readCommand(params: unknown): string {
|
| 53 |
+
if (typeof params !== "object" || params === null) {
|
| 54 |
+
throw new Error("bash params must be an object");
|
| 55 |
+
}
|
| 56 |
+
const command = (params as BashParams).command;
|
| 57 |
+
if (typeof command !== "string" || command.trim().length === 0) {
|
| 58 |
+
throw new Error("bash.command must be a non-empty string");
|
| 59 |
+
}
|
| 60 |
+
return command;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
function postJSON<T>(path: string, payload: unknown): Promise<T> {
|
| 64 |
+
return new Promise<T>((resolve, reject) => {
|
| 65 |
+
const body = JSON.stringify(payload);
|
| 66 |
+
const req = http.request(
|
| 67 |
+
{
|
| 68 |
+
socketPath,
|
| 69 |
+
path,
|
| 70 |
+
method: "POST",
|
| 71 |
+
headers: {
|
| 72 |
+
"content-type": "application/json",
|
| 73 |
+
"content-length": Buffer.byteLength(body)
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
(res) => {
|
| 77 |
+
const chunks: Buffer[] = [];
|
| 78 |
+
res.on("data", (chunk: Buffer) => chunks.push(chunk));
|
| 79 |
+
res.on("end", () => {
|
| 80 |
+
const raw = Buffer.concat(chunks).toString("utf8");
|
| 81 |
+
if ((res.statusCode ?? 500) < 200 || (res.statusCode ?? 500) >= 300) {
|
| 82 |
+
reject(new Error(`reposhell ${path} failed: ${raw}`));
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
resolve(JSON.parse(raw) as T);
|
| 86 |
+
});
|
| 87 |
+
}
|
| 88 |
+
);
|
| 89 |
+
req.on("error", reject);
|
| 90 |
+
req.end(body);
|
| 91 |
+
});
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
function formatResult(result: ExecResponse): string {
|
| 95 |
+
const parts: string[] = [];
|
| 96 |
+
if (result.stdout !== undefined && result.stdout.length > 0) {
|
| 97 |
+
parts.push(result.stdout);
|
| 98 |
+
}
|
| 99 |
+
if (result.stderr !== undefined && result.stderr.length > 0) {
|
| 100 |
+
parts.push(`stderr:\n${result.stderr}`);
|
| 101 |
+
}
|
| 102 |
+
if (result.policy_error !== undefined && result.policy_error.length > 0) {
|
| 103 |
+
parts.push(`policy_error: ${result.policy_error}`);
|
| 104 |
+
}
|
| 105 |
+
if (result.exit_code !== undefined && result.exit_code !== 0) {
|
| 106 |
+
parts.push(`exit_code: ${result.exit_code}`);
|
| 107 |
+
}
|
| 108 |
+
if (result.truncated === true) {
|
| 109 |
+
parts.push("truncated: true");
|
| 110 |
+
}
|
| 111 |
+
return parts.length === 0 ? "exit_code: 0" : parts.join("\n");
|
| 112 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-Fh8WgZ/request-params-extension.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
|
| 3 |
+
const requestParams = {
|
| 4 |
+
"temperature": 0,
|
| 5 |
+
"top_p": 1,
|
| 6 |
+
"max_tokens": 768
|
| 7 |
+
} as const;
|
| 8 |
+
|
| 9 |
+
export default function localpagerAgentRequestParamsExtension(pi: ExtensionAPI): void {
|
| 10 |
+
pi.on("before_provider_request", (event) => {
|
| 11 |
+
if (!isRecord(event.payload)) {
|
| 12 |
+
return event.payload;
|
| 13 |
+
}
|
| 14 |
+
return { ...event.payload, ...requestParams };
|
| 15 |
+
});
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
| 19 |
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
| 20 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-Kbq0Z3/request-params-extension.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
|
| 3 |
+
const requestParams = {
|
| 4 |
+
"temperature": 0,
|
| 5 |
+
"top_p": 1,
|
| 6 |
+
"max_tokens": 768
|
| 7 |
+
} as const;
|
| 8 |
+
|
| 9 |
+
export default function localpagerAgentRequestParamsExtension(pi: ExtensionAPI): void {
|
| 10 |
+
pi.on("before_provider_request", (event) => {
|
| 11 |
+
if (!isRecord(event.payload)) {
|
| 12 |
+
return event.payload;
|
| 13 |
+
}
|
| 14 |
+
return { ...event.payload, ...requestParams };
|
| 15 |
+
});
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
| 19 |
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
| 20 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-NWWc8D/request-params-extension.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
|
| 3 |
+
const requestParams = {
|
| 4 |
+
"temperature": 0,
|
| 5 |
+
"top_p": 1,
|
| 6 |
+
"max_tokens": 768
|
| 7 |
+
} as const;
|
| 8 |
+
|
| 9 |
+
export default function localpagerAgentRequestParamsExtension(pi: ExtensionAPI): void {
|
| 10 |
+
pi.on("before_provider_request", (event) => {
|
| 11 |
+
if (!isRecord(event.payload)) {
|
| 12 |
+
return event.payload;
|
| 13 |
+
}
|
| 14 |
+
return { ...event.payload, ...requestParams };
|
| 15 |
+
});
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
| 19 |
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
| 20 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-YDI6i0/request-params-extension.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
|
| 3 |
+
const requestParams = {
|
| 4 |
+
"temperature": 0,
|
| 5 |
+
"top_p": 1,
|
| 6 |
+
"max_tokens": 768
|
| 7 |
+
} as const;
|
| 8 |
+
|
| 9 |
+
export default function localpagerAgentRequestParamsExtension(pi: ExtensionAPI): void {
|
| 10 |
+
pi.on("before_provider_request", (event) => {
|
| 11 |
+
if (!isRecord(event.payload)) {
|
| 12 |
+
return event.payload;
|
| 13 |
+
}
|
| 14 |
+
return { ...event.payload, ...requestParams };
|
| 15 |
+
});
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
| 19 |
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
| 20 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-YbdYz9/request-params-extension.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
|
| 3 |
+
const requestParams = {
|
| 4 |
+
"temperature": 0,
|
| 5 |
+
"top_p": 1,
|
| 6 |
+
"max_tokens": 768
|
| 7 |
+
} as const;
|
| 8 |
+
|
| 9 |
+
export default function localpagerAgentRequestParamsExtension(pi: ExtensionAPI): void {
|
| 10 |
+
pi.on("before_provider_request", (event) => {
|
| 11 |
+
if (!isRecord(event.payload)) {
|
| 12 |
+
return event.payload;
|
| 13 |
+
}
|
| 14 |
+
return { ...event.payload, ...requestParams };
|
| 15 |
+
});
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
| 19 |
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
| 20 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-foIkaf/request-params-extension.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
|
| 3 |
+
const requestParams = {
|
| 4 |
+
"temperature": 0,
|
| 5 |
+
"top_p": 1,
|
| 6 |
+
"max_tokens": 768
|
| 7 |
+
} as const;
|
| 8 |
+
|
| 9 |
+
export default function localpagerAgentRequestParamsExtension(pi: ExtensionAPI): void {
|
| 10 |
+
pi.on("before_provider_request", (event) => {
|
| 11 |
+
if (!isRecord(event.payload)) {
|
| 12 |
+
return event.payload;
|
| 13 |
+
}
|
| 14 |
+
return { ...event.payload, ...requestParams };
|
| 15 |
+
});
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
| 19 |
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
| 20 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-jjBp5Z/request-params-extension.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
|
| 3 |
+
const requestParams = {
|
| 4 |
+
"temperature": 0,
|
| 5 |
+
"top_p": 1,
|
| 6 |
+
"max_tokens": 768
|
| 7 |
+
} as const;
|
| 8 |
+
|
| 9 |
+
export default function localpagerAgentRequestParamsExtension(pi: ExtensionAPI): void {
|
| 10 |
+
pi.on("before_provider_request", (event) => {
|
| 11 |
+
if (!isRecord(event.payload)) {
|
| 12 |
+
return event.payload;
|
| 13 |
+
}
|
| 14 |
+
return { ...event.payload, ...requestParams };
|
| 15 |
+
});
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
| 19 |
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
| 20 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/request-params/run-rqrYKD/request-params-extension.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
|
| 3 |
+
const requestParams = {
|
| 4 |
+
"temperature": 0,
|
| 5 |
+
"top_p": 1,
|
| 6 |
+
"max_tokens": 768
|
| 7 |
+
} as const;
|
| 8 |
+
|
| 9 |
+
export default function localpagerAgentRequestParamsExtension(pi: ExtensionAPI): void {
|
| 10 |
+
pi.on("before_provider_request", (event) => {
|
| 11 |
+
if (!isRecord(event.payload)) {
|
| 12 |
+
return event.payload;
|
| 13 |
+
}
|
| 14 |
+
return { ...event.payload, ...requestParams };
|
| 15 |
+
});
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
| 19 |
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
| 20 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-AjFu9w/final-json-extension.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import { writeFileSync } from "node:fs";
|
| 3 |
+
|
| 4 |
+
const schema = {
|
| 5 |
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
| 6 |
+
"type": "object",
|
| 7 |
+
"additionalProperties": false,
|
| 8 |
+
"required": [
|
| 9 |
+
"topics_of_interest",
|
| 10 |
+
"description",
|
| 11 |
+
"caveats"
|
| 12 |
+
],
|
| 13 |
+
"properties": {
|
| 14 |
+
"topics_of_interest": {
|
| 15 |
+
"type": "array",
|
| 16 |
+
"maxItems": 5,
|
| 17 |
+
"items": {
|
| 18 |
+
"type": "string",
|
| 19 |
+
"enum": [
|
| 20 |
+
"local_models",
|
| 21 |
+
"local_model_providers",
|
| 22 |
+
"model_serving",
|
| 23 |
+
"self_hosted_inference",
|
| 24 |
+
"open_weight_models",
|
| 25 |
+
"acpx",
|
| 26 |
+
"acp",
|
| 27 |
+
"coding_agents",
|
| 28 |
+
"mcp_tooling",
|
| 29 |
+
"hf_agents",
|
| 30 |
+
"hub_workflows",
|
| 31 |
+
"post_training",
|
| 32 |
+
"model_releases",
|
| 33 |
+
"agent_demos",
|
| 34 |
+
"codex",
|
| 35 |
+
"agent_runtime",
|
| 36 |
+
"sessions",
|
| 37 |
+
"gateway",
|
| 38 |
+
"exec_tools",
|
| 39 |
+
"approvals",
|
| 40 |
+
"sandboxing",
|
| 41 |
+
"hooks",
|
| 42 |
+
"cron_automation",
|
| 43 |
+
"chat_integrations",
|
| 44 |
+
"ui_tui",
|
| 45 |
+
"browser_automation",
|
| 46 |
+
"memory",
|
| 47 |
+
"security",
|
| 48 |
+
"config",
|
| 49 |
+
"packaging_deployment",
|
| 50 |
+
"docs",
|
| 51 |
+
"tests_ci",
|
| 52 |
+
"telemetry_usage",
|
| 53 |
+
"api_surface",
|
| 54 |
+
"queueing",
|
| 55 |
+
"notifications",
|
| 56 |
+
"skills_plugins",
|
| 57 |
+
"auth_identity",
|
| 58 |
+
"reliability",
|
| 59 |
+
"tool_calling"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
"uniqueItems": true
|
| 63 |
+
},
|
| 64 |
+
"description": {
|
| 65 |
+
"type": "string",
|
| 66 |
+
"minLength": 1,
|
| 67 |
+
"maxLength": 500
|
| 68 |
+
},
|
| 69 |
+
"caveats": {
|
| 70 |
+
"type": "array",
|
| 71 |
+
"maxItems": 5,
|
| 72 |
+
"items": {
|
| 73 |
+
"type": "string",
|
| 74 |
+
"maxLength": 240
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
} as const;
|
| 79 |
+
const outputPath = "/home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-AjFu9w/final-output.json";
|
| 80 |
+
|
| 81 |
+
export default function localpagerAgentFinalJsonExtension(pi: ExtensionAPI): void {
|
| 82 |
+
pi.registerTool({
|
| 83 |
+
name: "final_json",
|
| 84 |
+
label: "Final JSON",
|
| 85 |
+
description: "Submit the final structured answer and end the run.",
|
| 86 |
+
promptSnippet: "Use final_json to submit the final structured answer. Call it exactly once after completing the requested work.",
|
| 87 |
+
promptGuidelines: [
|
| 88 |
+
"Complete any required investigation first.",
|
| 89 |
+
"When done, call final_json with the final answer.",
|
| 90 |
+
"Do not write the final answer as ordinary prose."
|
| 91 |
+
],
|
| 92 |
+
parameters: schema,
|
| 93 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 94 |
+
writeFileSync(outputPath, JSON.stringify(params, null, 2) + "\n", "utf8");
|
| 95 |
+
return {
|
| 96 |
+
content: [{ type: "text", text: "Structured final answer captured." }],
|
| 97 |
+
details: { outputPath },
|
| 98 |
+
terminate: true
|
| 99 |
+
};
|
| 100 |
+
}
|
| 101 |
+
});
|
| 102 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-AylxUv/final-json-extension.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import { writeFileSync } from "node:fs";
|
| 3 |
+
|
| 4 |
+
const schema = {
|
| 5 |
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
| 6 |
+
"type": "object",
|
| 7 |
+
"additionalProperties": false,
|
| 8 |
+
"required": [
|
| 9 |
+
"topics_of_interest",
|
| 10 |
+
"description",
|
| 11 |
+
"caveats"
|
| 12 |
+
],
|
| 13 |
+
"properties": {
|
| 14 |
+
"topics_of_interest": {
|
| 15 |
+
"type": "array",
|
| 16 |
+
"maxItems": 5,
|
| 17 |
+
"items": {
|
| 18 |
+
"type": "string",
|
| 19 |
+
"enum": [
|
| 20 |
+
"local_models",
|
| 21 |
+
"local_model_providers",
|
| 22 |
+
"model_serving",
|
| 23 |
+
"self_hosted_inference",
|
| 24 |
+
"open_weight_models",
|
| 25 |
+
"acpx",
|
| 26 |
+
"acp",
|
| 27 |
+
"coding_agents",
|
| 28 |
+
"mcp_tooling",
|
| 29 |
+
"hf_agents",
|
| 30 |
+
"hub_workflows",
|
| 31 |
+
"post_training",
|
| 32 |
+
"model_releases",
|
| 33 |
+
"agent_demos",
|
| 34 |
+
"codex",
|
| 35 |
+
"agent_runtime",
|
| 36 |
+
"sessions",
|
| 37 |
+
"gateway",
|
| 38 |
+
"exec_tools",
|
| 39 |
+
"approvals",
|
| 40 |
+
"sandboxing",
|
| 41 |
+
"hooks",
|
| 42 |
+
"cron_automation",
|
| 43 |
+
"chat_integrations",
|
| 44 |
+
"ui_tui",
|
| 45 |
+
"browser_automation",
|
| 46 |
+
"memory",
|
| 47 |
+
"security",
|
| 48 |
+
"config",
|
| 49 |
+
"packaging_deployment",
|
| 50 |
+
"docs",
|
| 51 |
+
"tests_ci",
|
| 52 |
+
"telemetry_usage",
|
| 53 |
+
"api_surface",
|
| 54 |
+
"queueing",
|
| 55 |
+
"notifications",
|
| 56 |
+
"skills_plugins",
|
| 57 |
+
"auth_identity",
|
| 58 |
+
"reliability",
|
| 59 |
+
"tool_calling"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
"uniqueItems": true
|
| 63 |
+
},
|
| 64 |
+
"description": {
|
| 65 |
+
"type": "string",
|
| 66 |
+
"minLength": 1,
|
| 67 |
+
"maxLength": 500
|
| 68 |
+
},
|
| 69 |
+
"caveats": {
|
| 70 |
+
"type": "array",
|
| 71 |
+
"maxItems": 5,
|
| 72 |
+
"items": {
|
| 73 |
+
"type": "string",
|
| 74 |
+
"maxLength": 240
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
} as const;
|
| 79 |
+
const outputPath = "/home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-AylxUv/final-output.json";
|
| 80 |
+
|
| 81 |
+
export default function localpagerAgentFinalJsonExtension(pi: ExtensionAPI): void {
|
| 82 |
+
pi.registerTool({
|
| 83 |
+
name: "final_json",
|
| 84 |
+
label: "Final JSON",
|
| 85 |
+
description: "Submit the final structured answer and end the run.",
|
| 86 |
+
promptSnippet: "Use final_json to submit the final structured answer. Call it exactly once after completing the requested work.",
|
| 87 |
+
promptGuidelines: [
|
| 88 |
+
"Complete any required investigation first.",
|
| 89 |
+
"When done, call final_json with the final answer.",
|
| 90 |
+
"Do not write the final answer as ordinary prose."
|
| 91 |
+
],
|
| 92 |
+
parameters: schema,
|
| 93 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 94 |
+
writeFileSync(outputPath, JSON.stringify(params, null, 2) + "\n", "utf8");
|
| 95 |
+
return {
|
| 96 |
+
content: [{ type: "text", text: "Structured final answer captured." }],
|
| 97 |
+
details: { outputPath },
|
| 98 |
+
terminate: true
|
| 99 |
+
};
|
| 100 |
+
}
|
| 101 |
+
});
|
| 102 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-AylxUv/final-output.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"topics_of_interest": [
|
| 3 |
+
"acp"
|
| 4 |
+
],
|
| 5 |
+
"description": "Fixes pre-tool text loss in final_only delivery mode by preserving accumulated turn state across intermediate done events in the ACP projector.",
|
| 6 |
+
"caveats": []
|
| 7 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-Ix3jU8/final-json-extension.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import { writeFileSync } from "node:fs";
|
| 3 |
+
|
| 4 |
+
const schema = {
|
| 5 |
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
| 6 |
+
"type": "object",
|
| 7 |
+
"additionalProperties": false,
|
| 8 |
+
"required": [
|
| 9 |
+
"topics_of_interest",
|
| 10 |
+
"description",
|
| 11 |
+
"caveats"
|
| 12 |
+
],
|
| 13 |
+
"properties": {
|
| 14 |
+
"topics_of_interest": {
|
| 15 |
+
"type": "array",
|
| 16 |
+
"maxItems": 5,
|
| 17 |
+
"items": {
|
| 18 |
+
"type": "string",
|
| 19 |
+
"enum": [
|
| 20 |
+
"local_models",
|
| 21 |
+
"local_model_providers",
|
| 22 |
+
"model_serving",
|
| 23 |
+
"self_hosted_inference",
|
| 24 |
+
"open_weight_models",
|
| 25 |
+
"acpx",
|
| 26 |
+
"acp",
|
| 27 |
+
"coding_agents",
|
| 28 |
+
"mcp_tooling",
|
| 29 |
+
"hf_agents",
|
| 30 |
+
"hub_workflows",
|
| 31 |
+
"post_training",
|
| 32 |
+
"model_releases",
|
| 33 |
+
"agent_demos",
|
| 34 |
+
"codex",
|
| 35 |
+
"agent_runtime",
|
| 36 |
+
"sessions",
|
| 37 |
+
"gateway",
|
| 38 |
+
"exec_tools",
|
| 39 |
+
"approvals",
|
| 40 |
+
"sandboxing",
|
| 41 |
+
"hooks",
|
| 42 |
+
"cron_automation",
|
| 43 |
+
"chat_integrations",
|
| 44 |
+
"ui_tui",
|
| 45 |
+
"browser_automation",
|
| 46 |
+
"memory",
|
| 47 |
+
"security",
|
| 48 |
+
"config",
|
| 49 |
+
"packaging_deployment",
|
| 50 |
+
"docs",
|
| 51 |
+
"tests_ci",
|
| 52 |
+
"telemetry_usage",
|
| 53 |
+
"api_surface",
|
| 54 |
+
"queueing",
|
| 55 |
+
"notifications",
|
| 56 |
+
"skills_plugins",
|
| 57 |
+
"auth_identity",
|
| 58 |
+
"reliability",
|
| 59 |
+
"tool_calling"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
"uniqueItems": true
|
| 63 |
+
},
|
| 64 |
+
"description": {
|
| 65 |
+
"type": "string",
|
| 66 |
+
"minLength": 1,
|
| 67 |
+
"maxLength": 500
|
| 68 |
+
},
|
| 69 |
+
"caveats": {
|
| 70 |
+
"type": "array",
|
| 71 |
+
"maxItems": 5,
|
| 72 |
+
"items": {
|
| 73 |
+
"type": "string",
|
| 74 |
+
"maxLength": 240
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
} as const;
|
| 79 |
+
const outputPath = "/home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-Ix3jU8/final-output.json";
|
| 80 |
+
|
| 81 |
+
export default function localpagerAgentFinalJsonExtension(pi: ExtensionAPI): void {
|
| 82 |
+
pi.registerTool({
|
| 83 |
+
name: "final_json",
|
| 84 |
+
label: "Final JSON",
|
| 85 |
+
description: "Submit the final structured answer and end the run.",
|
| 86 |
+
promptSnippet: "Use final_json to submit the final structured answer. Call it exactly once after completing the requested work.",
|
| 87 |
+
promptGuidelines: [
|
| 88 |
+
"Complete any required investigation first.",
|
| 89 |
+
"When done, call final_json with the final answer.",
|
| 90 |
+
"Do not write the final answer as ordinary prose."
|
| 91 |
+
],
|
| 92 |
+
parameters: schema,
|
| 93 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 94 |
+
writeFileSync(outputPath, JSON.stringify(params, null, 2) + "\n", "utf8");
|
| 95 |
+
return {
|
| 96 |
+
content: [{ type: "text", text: "Structured final answer captured." }],
|
| 97 |
+
details: { outputPath },
|
| 98 |
+
terminate: true
|
| 99 |
+
};
|
| 100 |
+
}
|
| 101 |
+
});
|
| 102 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-Ix3jU8/final-output.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"topics_of_interest": [
|
| 3 |
+
"coding_agents"
|
| 4 |
+
],
|
| 5 |
+
"description": "PR extends tool-loop-detection to escalate repeated identical exec calls to critical alerts, filling a gap where the generic repeat detector was warn-only for non-poll tools.",
|
| 6 |
+
"caveats": []
|
| 7 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-KhW7du/final-json-extension.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import { writeFileSync } from "node:fs";
|
| 3 |
+
|
| 4 |
+
const schema = {
|
| 5 |
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
| 6 |
+
"type": "object",
|
| 7 |
+
"additionalProperties": false,
|
| 8 |
+
"required": [
|
| 9 |
+
"topics_of_interest",
|
| 10 |
+
"description",
|
| 11 |
+
"caveats"
|
| 12 |
+
],
|
| 13 |
+
"properties": {
|
| 14 |
+
"topics_of_interest": {
|
| 15 |
+
"type": "array",
|
| 16 |
+
"maxItems": 5,
|
| 17 |
+
"items": {
|
| 18 |
+
"type": "string",
|
| 19 |
+
"enum": [
|
| 20 |
+
"local_models",
|
| 21 |
+
"local_model_providers",
|
| 22 |
+
"model_serving",
|
| 23 |
+
"self_hosted_inference",
|
| 24 |
+
"open_weight_models",
|
| 25 |
+
"acpx",
|
| 26 |
+
"acp",
|
| 27 |
+
"coding_agents",
|
| 28 |
+
"mcp_tooling",
|
| 29 |
+
"hf_agents",
|
| 30 |
+
"hub_workflows",
|
| 31 |
+
"post_training",
|
| 32 |
+
"model_releases",
|
| 33 |
+
"agent_demos",
|
| 34 |
+
"codex",
|
| 35 |
+
"agent_runtime",
|
| 36 |
+
"sessions",
|
| 37 |
+
"gateway",
|
| 38 |
+
"exec_tools",
|
| 39 |
+
"approvals",
|
| 40 |
+
"sandboxing",
|
| 41 |
+
"hooks",
|
| 42 |
+
"cron_automation",
|
| 43 |
+
"chat_integrations",
|
| 44 |
+
"ui_tui",
|
| 45 |
+
"browser_automation",
|
| 46 |
+
"memory",
|
| 47 |
+
"security",
|
| 48 |
+
"config",
|
| 49 |
+
"packaging_deployment",
|
| 50 |
+
"docs",
|
| 51 |
+
"tests_ci",
|
| 52 |
+
"telemetry_usage",
|
| 53 |
+
"api_surface",
|
| 54 |
+
"queueing",
|
| 55 |
+
"notifications",
|
| 56 |
+
"skills_plugins",
|
| 57 |
+
"auth_identity",
|
| 58 |
+
"reliability",
|
| 59 |
+
"tool_calling"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
"uniqueItems": true
|
| 63 |
+
},
|
| 64 |
+
"description": {
|
| 65 |
+
"type": "string",
|
| 66 |
+
"minLength": 1,
|
| 67 |
+
"maxLength": 500
|
| 68 |
+
},
|
| 69 |
+
"caveats": {
|
| 70 |
+
"type": "array",
|
| 71 |
+
"maxItems": 5,
|
| 72 |
+
"items": {
|
| 73 |
+
"type": "string",
|
| 74 |
+
"maxLength": 240
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
} as const;
|
| 79 |
+
const outputPath = "/home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-KhW7du/final-output.json";
|
| 80 |
+
|
| 81 |
+
export default function localpagerAgentFinalJsonExtension(pi: ExtensionAPI): void {
|
| 82 |
+
pi.registerTool({
|
| 83 |
+
name: "final_json",
|
| 84 |
+
label: "Final JSON",
|
| 85 |
+
description: "Submit the final structured answer and end the run.",
|
| 86 |
+
promptSnippet: "Use final_json to submit the final structured answer. Call it exactly once after completing the requested work.",
|
| 87 |
+
promptGuidelines: [
|
| 88 |
+
"Complete any required investigation first.",
|
| 89 |
+
"When done, call final_json with the final answer.",
|
| 90 |
+
"Do not write the final answer as ordinary prose."
|
| 91 |
+
],
|
| 92 |
+
parameters: schema,
|
| 93 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 94 |
+
writeFileSync(outputPath, JSON.stringify(params, null, 2) + "\n", "utf8");
|
| 95 |
+
return {
|
| 96 |
+
content: [{ type: "text", text: "Structured final answer captured." }],
|
| 97 |
+
details: { outputPath },
|
| 98 |
+
terminate: true
|
| 99 |
+
};
|
| 100 |
+
}
|
| 101 |
+
});
|
| 102 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-axYIVw/final-json-extension.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import { writeFileSync } from "node:fs";
|
| 3 |
+
|
| 4 |
+
const schema = {
|
| 5 |
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
| 6 |
+
"type": "object",
|
| 7 |
+
"additionalProperties": false,
|
| 8 |
+
"required": [
|
| 9 |
+
"topics_of_interest",
|
| 10 |
+
"description",
|
| 11 |
+
"caveats"
|
| 12 |
+
],
|
| 13 |
+
"properties": {
|
| 14 |
+
"topics_of_interest": {
|
| 15 |
+
"type": "array",
|
| 16 |
+
"maxItems": 5,
|
| 17 |
+
"items": {
|
| 18 |
+
"type": "string",
|
| 19 |
+
"enum": [
|
| 20 |
+
"local_models",
|
| 21 |
+
"local_model_providers",
|
| 22 |
+
"model_serving",
|
| 23 |
+
"self_hosted_inference",
|
| 24 |
+
"open_weight_models",
|
| 25 |
+
"acpx",
|
| 26 |
+
"acp",
|
| 27 |
+
"coding_agents",
|
| 28 |
+
"mcp_tooling",
|
| 29 |
+
"hf_agents",
|
| 30 |
+
"hub_workflows",
|
| 31 |
+
"post_training",
|
| 32 |
+
"model_releases",
|
| 33 |
+
"agent_demos",
|
| 34 |
+
"codex",
|
| 35 |
+
"agent_runtime",
|
| 36 |
+
"sessions",
|
| 37 |
+
"gateway",
|
| 38 |
+
"exec_tools",
|
| 39 |
+
"approvals",
|
| 40 |
+
"sandboxing",
|
| 41 |
+
"hooks",
|
| 42 |
+
"cron_automation",
|
| 43 |
+
"chat_integrations",
|
| 44 |
+
"ui_tui",
|
| 45 |
+
"browser_automation",
|
| 46 |
+
"memory",
|
| 47 |
+
"security",
|
| 48 |
+
"config",
|
| 49 |
+
"packaging_deployment",
|
| 50 |
+
"docs",
|
| 51 |
+
"tests_ci",
|
| 52 |
+
"telemetry_usage",
|
| 53 |
+
"api_surface",
|
| 54 |
+
"queueing",
|
| 55 |
+
"notifications",
|
| 56 |
+
"skills_plugins",
|
| 57 |
+
"auth_identity",
|
| 58 |
+
"reliability",
|
| 59 |
+
"tool_calling"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
"uniqueItems": true
|
| 63 |
+
},
|
| 64 |
+
"description": {
|
| 65 |
+
"type": "string",
|
| 66 |
+
"minLength": 1,
|
| 67 |
+
"maxLength": 500
|
| 68 |
+
},
|
| 69 |
+
"caveats": {
|
| 70 |
+
"type": "array",
|
| 71 |
+
"maxItems": 5,
|
| 72 |
+
"items": {
|
| 73 |
+
"type": "string",
|
| 74 |
+
"maxLength": 240
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
} as const;
|
| 79 |
+
const outputPath = "/home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-axYIVw/final-output.json";
|
| 80 |
+
|
| 81 |
+
export default function localpagerAgentFinalJsonExtension(pi: ExtensionAPI): void {
|
| 82 |
+
pi.registerTool({
|
| 83 |
+
name: "final_json",
|
| 84 |
+
label: "Final JSON",
|
| 85 |
+
description: "Submit the final structured answer and end the run.",
|
| 86 |
+
promptSnippet: "Use final_json to submit the final structured answer. Call it exactly once after completing the requested work.",
|
| 87 |
+
promptGuidelines: [
|
| 88 |
+
"Complete any required investigation first.",
|
| 89 |
+
"When done, call final_json with the final answer.",
|
| 90 |
+
"Do not write the final answer as ordinary prose."
|
| 91 |
+
],
|
| 92 |
+
parameters: schema,
|
| 93 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 94 |
+
writeFileSync(outputPath, JSON.stringify(params, null, 2) + "\n", "utf8");
|
| 95 |
+
return {
|
| 96 |
+
content: [{ type: "text", text: "Structured final answer captured." }],
|
| 97 |
+
details: { outputPath },
|
| 98 |
+
terminate: true
|
| 99 |
+
};
|
| 100 |
+
}
|
| 101 |
+
});
|
| 102 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-axYIVw/final-output.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"topics_of_interest": [
|
| 3 |
+
"memory",
|
| 4 |
+
"security"
|
| 5 |
+
],
|
| 6 |
+
"description": "Fixes Windows QMD shim path resolution for memory-core availability and adds guarded HTTP downloads with MIME validation, bounded reads, and same-origin transport reuse for provider-returned image URLs.",
|
| 7 |
+
"caveats": []
|
| 8 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-bcghzi/final-json-extension.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import { writeFileSync } from "node:fs";
|
| 3 |
+
|
| 4 |
+
const schema = {
|
| 5 |
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
| 6 |
+
"type": "object",
|
| 7 |
+
"additionalProperties": false,
|
| 8 |
+
"required": [
|
| 9 |
+
"topics_of_interest",
|
| 10 |
+
"description",
|
| 11 |
+
"caveats"
|
| 12 |
+
],
|
| 13 |
+
"properties": {
|
| 14 |
+
"topics_of_interest": {
|
| 15 |
+
"type": "array",
|
| 16 |
+
"maxItems": 5,
|
| 17 |
+
"items": {
|
| 18 |
+
"type": "string",
|
| 19 |
+
"enum": [
|
| 20 |
+
"local_models",
|
| 21 |
+
"local_model_providers",
|
| 22 |
+
"model_serving",
|
| 23 |
+
"self_hosted_inference",
|
| 24 |
+
"open_weight_models",
|
| 25 |
+
"acpx",
|
| 26 |
+
"acp",
|
| 27 |
+
"coding_agents",
|
| 28 |
+
"mcp_tooling",
|
| 29 |
+
"hf_agents",
|
| 30 |
+
"hub_workflows",
|
| 31 |
+
"post_training",
|
| 32 |
+
"model_releases",
|
| 33 |
+
"agent_demos",
|
| 34 |
+
"codex",
|
| 35 |
+
"agent_runtime",
|
| 36 |
+
"sessions",
|
| 37 |
+
"gateway",
|
| 38 |
+
"exec_tools",
|
| 39 |
+
"approvals",
|
| 40 |
+
"sandboxing",
|
| 41 |
+
"hooks",
|
| 42 |
+
"cron_automation",
|
| 43 |
+
"chat_integrations",
|
| 44 |
+
"ui_tui",
|
| 45 |
+
"browser_automation",
|
| 46 |
+
"memory",
|
| 47 |
+
"security",
|
| 48 |
+
"config",
|
| 49 |
+
"packaging_deployment",
|
| 50 |
+
"docs",
|
| 51 |
+
"tests_ci",
|
| 52 |
+
"telemetry_usage",
|
| 53 |
+
"api_surface",
|
| 54 |
+
"queueing",
|
| 55 |
+
"notifications",
|
| 56 |
+
"skills_plugins",
|
| 57 |
+
"auth_identity",
|
| 58 |
+
"reliability",
|
| 59 |
+
"tool_calling"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
"uniqueItems": true
|
| 63 |
+
},
|
| 64 |
+
"description": {
|
| 65 |
+
"type": "string",
|
| 66 |
+
"minLength": 1,
|
| 67 |
+
"maxLength": 500
|
| 68 |
+
},
|
| 69 |
+
"caveats": {
|
| 70 |
+
"type": "array",
|
| 71 |
+
"maxItems": 5,
|
| 72 |
+
"items": {
|
| 73 |
+
"type": "string",
|
| 74 |
+
"maxLength": 240
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
} as const;
|
| 79 |
+
const outputPath = "/home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-bcghzi/final-output.json";
|
| 80 |
+
|
| 81 |
+
export default function localpagerAgentFinalJsonExtension(pi: ExtensionAPI): void {
|
| 82 |
+
pi.registerTool({
|
| 83 |
+
name: "final_json",
|
| 84 |
+
label: "Final JSON",
|
| 85 |
+
description: "Submit the final structured answer and end the run.",
|
| 86 |
+
promptSnippet: "Use final_json to submit the final structured answer. Call it exactly once after completing the requested work.",
|
| 87 |
+
promptGuidelines: [
|
| 88 |
+
"Complete any required investigation first.",
|
| 89 |
+
"When done, call final_json with the final answer.",
|
| 90 |
+
"Do not write the final answer as ordinary prose."
|
| 91 |
+
],
|
| 92 |
+
parameters: schema,
|
| 93 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 94 |
+
writeFileSync(outputPath, JSON.stringify(params, null, 2) + "\n", "utf8");
|
| 95 |
+
return {
|
| 96 |
+
content: [{ type: "text", text: "Structured final answer captured." }],
|
| 97 |
+
details: { outputPath },
|
| 98 |
+
terminate: true
|
| 99 |
+
};
|
| 100 |
+
}
|
| 101 |
+
});
|
| 102 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-bcghzi/final-output.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"topics_of_interest": [
|
| 3 |
+
"coding_agents"
|
| 4 |
+
],
|
| 5 |
+
"description": "PR extends agent loop-detection to escalate repeated identical exec tool calls from warn-only to critical, preventing runaway shell command loops in the coding agent harness.",
|
| 6 |
+
"caveats": []
|
| 7 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-pkDuV6/final-json-extension.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import { writeFileSync } from "node:fs";
|
| 3 |
+
|
| 4 |
+
const schema = {
|
| 5 |
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
| 6 |
+
"type": "object",
|
| 7 |
+
"additionalProperties": false,
|
| 8 |
+
"required": [
|
| 9 |
+
"topics_of_interest",
|
| 10 |
+
"description",
|
| 11 |
+
"caveats"
|
| 12 |
+
],
|
| 13 |
+
"properties": {
|
| 14 |
+
"topics_of_interest": {
|
| 15 |
+
"type": "array",
|
| 16 |
+
"maxItems": 5,
|
| 17 |
+
"items": {
|
| 18 |
+
"type": "string",
|
| 19 |
+
"enum": [
|
| 20 |
+
"local_models",
|
| 21 |
+
"local_model_providers",
|
| 22 |
+
"model_serving",
|
| 23 |
+
"self_hosted_inference",
|
| 24 |
+
"open_weight_models",
|
| 25 |
+
"acpx",
|
| 26 |
+
"acp",
|
| 27 |
+
"coding_agents",
|
| 28 |
+
"mcp_tooling",
|
| 29 |
+
"hf_agents",
|
| 30 |
+
"hub_workflows",
|
| 31 |
+
"post_training",
|
| 32 |
+
"model_releases",
|
| 33 |
+
"agent_demos",
|
| 34 |
+
"codex",
|
| 35 |
+
"agent_runtime",
|
| 36 |
+
"sessions",
|
| 37 |
+
"gateway",
|
| 38 |
+
"exec_tools",
|
| 39 |
+
"approvals",
|
| 40 |
+
"sandboxing",
|
| 41 |
+
"hooks",
|
| 42 |
+
"cron_automation",
|
| 43 |
+
"chat_integrations",
|
| 44 |
+
"ui_tui",
|
| 45 |
+
"browser_automation",
|
| 46 |
+
"memory",
|
| 47 |
+
"security",
|
| 48 |
+
"config",
|
| 49 |
+
"packaging_deployment",
|
| 50 |
+
"docs",
|
| 51 |
+
"tests_ci",
|
| 52 |
+
"telemetry_usage",
|
| 53 |
+
"api_surface",
|
| 54 |
+
"queueing",
|
| 55 |
+
"notifications",
|
| 56 |
+
"skills_plugins",
|
| 57 |
+
"auth_identity",
|
| 58 |
+
"reliability",
|
| 59 |
+
"tool_calling"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
"uniqueItems": true
|
| 63 |
+
},
|
| 64 |
+
"description": {
|
| 65 |
+
"type": "string",
|
| 66 |
+
"minLength": 1,
|
| 67 |
+
"maxLength": 500
|
| 68 |
+
},
|
| 69 |
+
"caveats": {
|
| 70 |
+
"type": "array",
|
| 71 |
+
"maxItems": 5,
|
| 72 |
+
"items": {
|
| 73 |
+
"type": "string",
|
| 74 |
+
"maxLength": 240
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
} as const;
|
| 79 |
+
const outputPath = "/home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-pkDuV6/final-output.json";
|
| 80 |
+
|
| 81 |
+
export default function localpagerAgentFinalJsonExtension(pi: ExtensionAPI): void {
|
| 82 |
+
pi.registerTool({
|
| 83 |
+
name: "final_json",
|
| 84 |
+
label: "Final JSON",
|
| 85 |
+
description: "Submit the final structured answer and end the run.",
|
| 86 |
+
promptSnippet: "Use final_json to submit the final structured answer. Call it exactly once after completing the requested work.",
|
| 87 |
+
promptGuidelines: [
|
| 88 |
+
"Complete any required investigation first.",
|
| 89 |
+
"When done, call final_json with the final answer.",
|
| 90 |
+
"Do not write the final answer as ordinary prose."
|
| 91 |
+
],
|
| 92 |
+
parameters: schema,
|
| 93 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 94 |
+
writeFileSync(outputPath, JSON.stringify(params, null, 2) + "\n", "utf8");
|
| 95 |
+
return {
|
| 96 |
+
content: [{ type: "text", text: "Structured final answer captured." }],
|
| 97 |
+
details: { outputPath },
|
| 98 |
+
terminate: true
|
| 99 |
+
};
|
| 100 |
+
}
|
| 101 |
+
});
|
| 102 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-pkDuV6/final-output.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"topics_of_interest": [
|
| 3 |
+
"acp"
|
| 4 |
+
],
|
| 5 |
+
"description": "PR fixes loss of pre-tool text in final_only delivery mode by preserving accumulated state across intermediate done events in the ACP projector.",
|
| 6 |
+
"caveats": []
|
| 7 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-ybVzku/final-json-extension.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
| 2 |
+
import { writeFileSync } from "node:fs";
|
| 3 |
+
|
| 4 |
+
const schema = {
|
| 5 |
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
| 6 |
+
"type": "object",
|
| 7 |
+
"additionalProperties": false,
|
| 8 |
+
"required": [
|
| 9 |
+
"topics_of_interest",
|
| 10 |
+
"description",
|
| 11 |
+
"caveats"
|
| 12 |
+
],
|
| 13 |
+
"properties": {
|
| 14 |
+
"topics_of_interest": {
|
| 15 |
+
"type": "array",
|
| 16 |
+
"maxItems": 5,
|
| 17 |
+
"items": {
|
| 18 |
+
"type": "string",
|
| 19 |
+
"enum": [
|
| 20 |
+
"local_models",
|
| 21 |
+
"local_model_providers",
|
| 22 |
+
"model_serving",
|
| 23 |
+
"self_hosted_inference",
|
| 24 |
+
"open_weight_models",
|
| 25 |
+
"acpx",
|
| 26 |
+
"acp",
|
| 27 |
+
"coding_agents",
|
| 28 |
+
"mcp_tooling",
|
| 29 |
+
"hf_agents",
|
| 30 |
+
"hub_workflows",
|
| 31 |
+
"post_training",
|
| 32 |
+
"model_releases",
|
| 33 |
+
"agent_demos",
|
| 34 |
+
"codex",
|
| 35 |
+
"agent_runtime",
|
| 36 |
+
"sessions",
|
| 37 |
+
"gateway",
|
| 38 |
+
"exec_tools",
|
| 39 |
+
"approvals",
|
| 40 |
+
"sandboxing",
|
| 41 |
+
"hooks",
|
| 42 |
+
"cron_automation",
|
| 43 |
+
"chat_integrations",
|
| 44 |
+
"ui_tui",
|
| 45 |
+
"browser_automation",
|
| 46 |
+
"memory",
|
| 47 |
+
"security",
|
| 48 |
+
"config",
|
| 49 |
+
"packaging_deployment",
|
| 50 |
+
"docs",
|
| 51 |
+
"tests_ci",
|
| 52 |
+
"telemetry_usage",
|
| 53 |
+
"api_surface",
|
| 54 |
+
"queueing",
|
| 55 |
+
"notifications",
|
| 56 |
+
"skills_plugins",
|
| 57 |
+
"auth_identity",
|
| 58 |
+
"reliability",
|
| 59 |
+
"tool_calling"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
"uniqueItems": true
|
| 63 |
+
},
|
| 64 |
+
"description": {
|
| 65 |
+
"type": "string",
|
| 66 |
+
"minLength": 1,
|
| 67 |
+
"maxLength": 500
|
| 68 |
+
},
|
| 69 |
+
"caveats": {
|
| 70 |
+
"type": "array",
|
| 71 |
+
"maxItems": 5,
|
| 72 |
+
"items": {
|
| 73 |
+
"type": "string",
|
| 74 |
+
"maxLength": 240
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
} as const;
|
| 79 |
+
const outputPath = "/home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/agent-state/structured-output/run-ybVzku/final-output.json";
|
| 80 |
+
|
| 81 |
+
export default function localpagerAgentFinalJsonExtension(pi: ExtensionAPI): void {
|
| 82 |
+
pi.registerTool({
|
| 83 |
+
name: "final_json",
|
| 84 |
+
label: "Final JSON",
|
| 85 |
+
description: "Submit the final structured answer and end the run.",
|
| 86 |
+
promptSnippet: "Use final_json to submit the final structured answer. Call it exactly once after completing the requested work.",
|
| 87 |
+
promptGuidelines: [
|
| 88 |
+
"Complete any required investigation first.",
|
| 89 |
+
"When done, call final_json with the final answer.",
|
| 90 |
+
"Do not write the final answer as ordinary prose."
|
| 91 |
+
],
|
| 92 |
+
parameters: schema,
|
| 93 |
+
async execute(_toolCallId: string, params: unknown) {
|
| 94 |
+
writeFileSync(outputPath, JSON.stringify(params, null, 2) + "\n", "utf8");
|
| 95 |
+
return {
|
| 96 |
+
content: [{ type: "text", text: "Structured final answer captured." }],
|
| 97 |
+
details: { outputPath },
|
| 98 |
+
terminate: true
|
| 99 |
+
};
|
| 100 |
+
}
|
| 101 |
+
});
|
| 102 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/contexts/openclaw-openclaw-52126.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GitHub item:
|
| 2 |
+
- Repository: openclaw/openclaw
|
| 3 |
+
- Type: github_pr
|
| 4 |
+
- Number: 52126
|
| 5 |
+
- URL: https://github.com/openclaw/openclaw/pull/52126
|
| 6 |
+
- Title: fix: extend loopDetection to cover exec tool calls (#34574)
|
| 7 |
+
- State: closed
|
| 8 |
+
- Author: poushwell
|
| 9 |
+
- Labels: agents, size: S
|
| 10 |
+
- Changed files: src/agents/tool-loop-detection.test.ts, src/agents/tool-loop-detection.ts
|
| 11 |
+
|
| 12 |
+
Body:
|
| 13 |
+
```markdown
|
| 14 |
+
**What:** loopDetection did not escalate to critical for repeated exec calls. 121 identical shell commands = zero critical alerts.
|
| 15 |
+
|
| 16 |
+
**Why:** exec is the most dangerous tool type. The generic repeat detector was warn-only for non-poll tools, so criticalThreshold never triggered for exec.
|
| 17 |
+
|
| 18 |
+
**Changes:**
|
| 19 |
+
- Added escalation path for exec tool in loop detection: repeated identical exec calls now trigger critical at criticalThreshold (same as other dangerous patterns)
|
| 20 |
+
- Default thresholds unchanged (warningThreshold: 3, criticalThreshold: 6)
|
| 21 |
+
- No change to enabled/disabled defaults
|
| 22 |
+
- 4 new tests: repeated exec alert, different commands no alert, below threshold no alert, existing non-exec unchanged
|
| 23 |
+
|
| 24 |
+
**Testing:**
|
| 25 |
+
- `vitest run src/agents/tool-loop-detection.test.ts` — all passed
|
| 26 |
+
- Existing loop detection behavior unchanged for non-exec tools
|
| 27 |
+
|
| 28 |
+
Closes #34574
|
| 29 |
+
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
Comments/context (truncated):
|
| 33 |
+
```markdown
|
| 34 |
+
- greptile-apps[bot] at 2026-03-22T07:10:03Z:
|
| 35 |
+
<h3>Greptile Summary</h3>
|
| 36 |
+
|
| 37 |
+
This PR extends `detectToolCallLoop` so that repeated identical `exec` calls escalate to `critical` at `criticalThreshold`, filling a gap where the generic repeat detector was warn-only for non-poll tools. The implementation is correct: a new guard checks `isExecTool && recentCount >= criticalThreshold` before the existing generic warning block, giving `exec` a warning at `warningThreshold` and a critical at `criticalThreshold` — consistent with how `known_poll_no_progress` is structured.
|
| 38 |
+
|
| 39 |
+
- The logic in `tool-loop-detection.ts` is sound and consistent with existing detector patterns.
|
| 40 |
+
- The `warningKey` format (`generic:${toolName}:${currentHash}`) is shared between the new critical block and the existing warning block, which is consistent with how `known_poll_no_progress` handles the same situation.
|
| 41 |
+
- The four new tests cover warning, below-threshold, different-args, and non-exec regression cases — but **no test verifies the core new behavior**: exec reachin
|
| 42 |
+
|
| 43 |
+
[comments/context truncated: 6548 characters omitted]
|
| 44 |
+
|
| 45 |
+
tes: reviewed against [bc73141e8284](https://github.com/openclaw/openclaw/commit/bc73141e8284c219933970dbd4f6aeacb05bbb77); fix evidence: release [v2026.4.23](https://github.com/openclaw/openclaw/releases/tag/v2026.4.23), commit [a9797214338b](https://github.com/openclaw/openclaw/commit/a9797214338ba31c52c796adbb75afb16e0684a9).
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
Diff/context (selected/truncated):
|
| 49 |
+
```diff
|
| 50 |
+
diff --git a/src/agents/tool-loop-detection.test.ts b/src/agents/tool-loop-detection.test.ts
|
| 51 |
+
index 056c5286cbbfd..ed0b7bb2e3f0b 100644
|
| 52 |
+
--- a/src/agents/tool-loop-detection.test.ts
|
| 53 |
+
+++ b/src/agents/tool-loop-detection.test.ts
|
| 54 |
+
@@ -1,4 +1,4 @@
|
| 55 |
+
-import { describe, expect, it } from "vitest";
|
| 56 |
+
+import { describe, expect, it } from "vitest";
|
| 57 |
+
import type { ToolLoopDetectionConfig } from "../config/types.tools.js";
|
| 58 |
+
import type { SessionState } from "../logging/diagnostic-session-state.js";
|
| 59 |
+
import {
|
| 60 |
+
@@ -249,6 +249,17 @@ describe("tool-loop-detection", () => {
|
| 61 |
+
});
|
| 62 |
+
|
| 63 |
+
describe("detectToolCallLoop", () => {
|
| 64 |
+
+ const execThresholdConfig: ToolLoopDetectionConfig = {
|
| 65 |
+
+ enabled: true,
|
| 66 |
+
+ warningThreshold: 3,
|
| 67 |
+
+ criticalThreshold: 6,
|
| 68 |
+
+ detectors: {
|
| 69 |
+
+ genericRepeat: true,
|
| 70 |
+
+ knownPollNoProgress: true,
|
| 71 |
+
+ pingPong: true,
|
| 72 |
+
+ },
|
| 73 |
+
+ };
|
| 74 |
+
+
|
| 75 |
+
it("is disabled by default", () => {
|
| 76 |
+
const state = createState();
|
| 77 |
+
|
| 78 |
+
@@ -276,6 +287,112 @@ describe("tool-loop-detection", () => {
|
| 79 |
+
expect(result.stuck).toBe(false);
|
| 80 |
+
});
|
| 81 |
+
|
| 82 |
+
+ it("warns for repeated exec calls at repeat threshold", () => {
|
| 83 |
+
+ const result = detectLoopAfterRepeatedCalls({
|
| 84 |
+
+ toolName: "exec",
|
| 85 |
+
+ toolParams: { command: "ls /tmp" },
|
| 86 |
+
+ result: {
|
| 87 |
+
+ content: [{ type: "text", text: "file-a\nfile-b" }],
|
| 88 |
+
+ details: { status: "completed", exitCode: 0 },
|
| 89 |
+
+ },
|
| 90 |
+
+ count: 3,
|
| 91 |
+
+ config: execThresholdConfig,
|
| 92 |
+
+ });
|
| 93 |
+
+
|
| 94 |
+
+ expect(result.stuck).toBe(true);
|
| 95 |
+
+ if (result.stuck) {
|
| 96 |
+
+ expect(result.level).toBe("warning");
|
| 97 |
+
+ expect(result.detector).toBe("generic_repeat");
|
| 98 |
+
+ }
|
| 99 |
+
+ }
|
| 100 |
+
|
| 101 |
+
[file diff truncated: 2223 characters omitted]
|
| 102 |
+
|
| 103 |
+
toolName: "read",
|
| 104 |
+
+ toolParams: { path: "a.txt" },
|
| 105 |
+
+ result: {
|
| 106 |
+
+ content: [{ type: "text", text: "same file data" }],
|
| 107 |
+
+ details: { ok: true },
|
| 108 |
+
+ },
|
| 109 |
+
+ count: 4,
|
| 110 |
+
+ config: execThresholdConfig,
|
| 111 |
+
+ });
|
| 112 |
+
+
|
| 113 |
+
+ expect(result.stuck).toBe(true);
|
| 114 |
+
+ if (result.stuck) {
|
| 115 |
+
+ expect(result.level).toBe("warning");
|
| 116 |
+
+ expect(result.detector).toBe("generic_repeat");
|
| 117 |
+
+ }
|
| 118 |
+
+ });
|
| 119 |
+
+
|
| 120 |
+
it("warns on generic repeated tool+args calls", () => {
|
| 121 |
+
const state = createState();
|
| 122 |
+
for (let i = 0; i < WARNING_THRESHOLD; i += 1) {
|
| 123 |
+
|
| 124 |
+
diff --git a/src/agents/tool-loop-detection.ts b/src/agents/tool-loop-detection.ts
|
| 125 |
+
index 1576e7ace9baf..7758bbfc59a9b 100644
|
| 126 |
+
--- a/src/agents/tool-loop-detection.ts
|
| 127 |
+
+++ b/src/agents/tool-loop-detection.ts
|
| 128 |
+
@@ -1,4 +1,4 @@
|
| 129 |
+
-import { createHash } from "node:crypto";
|
| 130 |
+
+import { createHash } from "node:crypto";
|
| 131 |
+
import type { ToolLoopDetectionConfig } from "../config/types.tools.js";
|
| 132 |
+
import type { SessionState } from "../logging/diagnostic-session-state.js";
|
| 133 |
+
import { createSubsystemLogger } from "../logging/subsystem.js";
|
| 134 |
+
@@ -470,10 +470,29 @@ export function detectToolCallLoop(
|
| 135 |
+
};
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
- // Generic detector: warn-only for repeated identical calls.
|
| 139 |
+
+ // Generic detector: warn on repeated identical calls for all tools.
|
| 140 |
+
+ // Exec is higher risk, so it escalates to critical at the configured critical threshold.
|
| 141 |
+
const recentCount = history.filter(
|
| 142 |
+
(h) => h.toolName === toolName && h.argsHash === currentHash,
|
| 143 |
+
).length;
|
| 144 |
+
+ const isExecTool = toolName === "exec";
|
| 145 |
+
+
|
| 146 |
+
+ if (
|
| 147 |
+
+ !knownPollTool &&
|
| 148 |
+
+ isExecTool &&
|
| 149 |
+
+ resolvedConfig.detectors.genericRepeat &&
|
| 150 |
+
+ recentCount >= resolvedConfig.criticalThreshold
|
| 151 |
+
+ ) {
|
| 152 |
+
+ log.error(`Critical exec loop detected: ${toolName} called ${recentCount} times identically`);
|
| 153 |
+
+ return {
|
| 154 |
+
+ stuck: true,
|
| 155 |
+
+ level: "critical",
|
| 156 |
+
+ detector: "generic_repeat",
|
| 157 |
+
+ count: recentCount,
|
| 158 |
+
+ message: `CRITICAL: You have called ${toolName} ${recentCount} times with identical arguments. Session execution blocked to prevent runaway command loops.`,
|
| 159 |
+
+ warningKey: `generic:${toolName}:${currentHash}`,
|
| 160 |
+
+ };
|
| 161 |
+
+ }
|
| 162 |
+
|
| 163 |
+
if (
|
| 164 |
+
!knownPollTool &&
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
[diff truncated from 6143 characters to selected relevant excerpts]
|
| 168 |
+
```
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/contexts/openclaw-openclaw-81443.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GitHub item:
|
| 2 |
+
- Repository: openclaw/openclaw
|
| 3 |
+
- Type: github_pr
|
| 4 |
+
- Number: 81443
|
| 5 |
+
- URL: https://github.com/openclaw/openclaw/pull/81443
|
| 6 |
+
- Title: fix: resolve QMD Windows shims and guard image URL downloads
|
| 7 |
+
- State: open
|
| 8 |
+
- Author: knightplat-blip
|
| 9 |
+
- Labels: docs, gateway, extensions: memory-core, agents, stale, size: XL, extensions: openai, extensions: litellm, extensions: deepinfra, triage: needs-real-behavior-proof, extensions: xai, dependencies-changed, P2, rating: 🧂 unranked krab, merge-risk: 🚨 compatibility, merge-risk: 🚨 auth-provider, merge-risk: 🚨 security-boundary, status: 📣 needs proof, proof: 📸 screenshot
|
| 10 |
+
- Changed files: docs/plugins/sdk-migration.md, docs/plugins/sdk-subpaths.md, extensions/deepinfra/image-generation-provider.test.ts, extensions/litellm/image-generation-provider.test.ts, extensions/memory-core/src/memory/qmd-manager.test.ts, extensions/memory-core/src/memory/qmd-manager.ts, extensions/memory-core/src/tools.test.ts, extensions/memory-core/src/tools.ts, extensions/openai/image-generation-provider.test.ts, extensions/openai/image-generation-provider.ts, extensions/xai/image-generation-provider.test.ts, package.json, packages/memory-host-sdk/src/host/qmd-process.test.ts, packages/memory-host-sdk/src/host/qmd-process.ts, pnpm-lock.yaml, src/agents/embedded-agent-runner/run/CLAUDE.md, src/agents/embedded-agent-runner/run/CLAUDE.md, src/gateway/server-cron.ts, src/image-generation/image-assets.test.ts, src/image-generation/image-assets.ts, src/image-generation/openai-compatible-image-provider.test.ts, src/image-generation/openai-compatible-image-provider.ts, src/media-understanding/shared.test.ts, src/media-understanding/shared.ts, src/plugin-sdk/image-generation.ts, src/plugin-sdk/provider-http.ts, src/plugin-sdk/windows-spawn.ts, test/CLAUDE.md, test/CLAUDE.md
|
| 11 |
+
|
| 12 |
+
Body (truncated):
|
| 13 |
+
```markdown
|
| 14 |
+
## Summary
|
| 15 |
+
|
| 16 |
+
Fixes the Windows QMD shim path and narrows the image URL work into a guarded provider-download path.
|
| 17 |
+
|
| 18 |
+
- Resolve Windows `.cmd` shims that point at quoted absolute JavaScript entrypoints.
|
| 19 |
+
- Use the real QMD package name, `@tobilu/qmd`, for package-bin fallback resolution.
|
| 20 |
+
- Parse OpenAI-compatible image responses that return `data[].url` instead of `data[].b64_json`.
|
| 21 |
+
- Route provider-returned image URLs through guarded HTTP with bounded reads, MIME validation, scoped same-origin transport reuse, configured media limits, and operation-deadline timeouts.
|
| 22 |
+
- Dropped the unrelated `node-llama-cpp` dependency/lockfile churn from the original PR scope.
|
| 23 |
+
|
| 24 |
+
## Behavior addressed
|
| 25 |
+
|
| 26 |
+
Windows QMD availability checks no longer fail when `qmd.cmd` wraps a quoted absolute Node entrypoint instead of a `%~dp0`-relative entrypoint. OpenAI-compatible URL-backed image generation responses now produce image assets without using raw fetch or broad private-network carryover.
|
| 27 |
+
|
| 28 |
+
## Real environment tested
|
| 29 |
+
|
| 30 |
+
- AWS Crabbox native Windows: `cbx_36917d25d801`, run `run_0dd48bf72083`, hydrate workflow `26722175678`.
|
| 31 |
+
- AWS Crabbox Windows WSL2: `cbx_92cdb109d982`, run `run_740f8e92e641`, hydrate workflow `26721781232`.
|
| 32 |
+
- AWS Crabbox Linux changed gate after rebase: `cbx_0b074a7498e9`, run `run_72f46782c53c`.
|
| 33 |
+
|
| 34 |
+
## Exact steps or command run after this patch
|
| 35 |
+
|
| 36 |
+
```bash
|
| 37 |
+
node scripts/run-vitest.mjs src/plugin-sdk/windows-spawn.test.ts packages/memory-host-sdk/src/host/qmd-process.test.ts extensions/memory-core/src/memory/qmd-manager.test.ts src/image-generation/image-assets.test.ts src/image-generation/openai-compatible-image-provider.test.ts extensions/openai/image-generation-provider.test.ts
|
| 38 |
+
node --max-old-space-size=8192 --import tsx scripts/generat
|
| 39 |
+
|
| 40 |
+
[body truncated: 1193 characters omitted]
|
| 41 |
+
|
| 42 |
+
-origin provider-returned URLs do not inherit provider private-network/dispatcher/auth policy.
|
| 43 |
+
- Same-origin provider-returned URLs keep provider auth/transport policy and still use guarded fetch.
|
| 44 |
+
- URL downloads honor configured generated-media byte limits and share the image operation deadline instead of resetting timeout per download.
|
| 45 |
+
|
| 46 |
+
## What was not tested
|
| 47 |
+
|
| 48 |
+
Full live QMD memory indexing/search was not run. The final `pnpm check:changed` gate is blocked by a current `origin/main` type error in untouched `src/channels/message/ingress-queue.test.ts` from `b0679d1f13d`; this PR does not touch channel ingress queue files.
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
Comments/context (truncated):
|
| 53 |
+
```markdown
|
| 54 |
+
- knightplat-blip at 2026-05-13T14:51:39Z:
|
| 55 |
+
@clawsweeper re-review
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
- clawsweeper[bot] at 2026-05-13T14:51:46Z:
|
| 59 |
+
Codex review: needs real behavior proof before merge. _Reviewed June 14, 2026, 7:57 PM ET / 23:57 UTC._
|
| 60 |
+
|
| 61 |
+
**Summary**
|
| 62 |
+
This PR changes Windows QMD spawn/package resolution, OpenAI-compatible URL-backed image parsing/downloads, provider timeout SDK helpers, memory_search timeout behavior, docs/tests, and root dependency files.
|
| 63 |
+
|
| 64 |
+
PR surface: Source +308, Tests +545, Docs 0, Config +1, Other +65. Total +919 across 29 files.
|
| 65 |
+
|
| 66 |
+
Reproducibility: yes. at source level: current main resolves QMD package fallbacks against the old qmd package name and only parses b64_json image entries. I did not establish live exact-head Windows QMD indexing/search proof, and the PR body says that full path was not tested.
|
| 67 |
+
|
| 68 |
+
**Review metrics:** 3 noteworthy metrics.
|
| 69 |
+
- **Dependency Graph Change:** 1 devDependency added, 1 lockfile changed. External root dependency graph changes are blocked by repository automation and require security/admin handling before
|
| 70 |
+
|
| 71 |
+
[comments/context truncated: 39842 characters omitted]
|
| 72 |
+
|
| 73 |
+
:43Z:
|
| 74 |
+
This assigned pull request has been automatically marked as stale after being open for 27 days.
|
| 75 |
+
Please add updates or it will be closed.
|
| 76 |
+
|
| 77 |
+
- openclaw-barnacle[bot] at 2026-06-14T05:13:26Z:
|
| 78 |
+
This assigned pull request has been automatically marked as stale after being open for 27 days.
|
| 79 |
+
Please add updates or it will be closed.
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
Diff/context (selected/truncated):
|
| 83 |
+
```diff
|
| 84 |
+
diff --git a/extensions/openai/image-generation-provider.test.ts b/extensions/openai/image-generation-provider.test.ts
|
| 85 |
+
index 104aac4c1c61d..e3f9900addc86 100644
|
| 86 |
+
--- a/extensions/openai/image-generation-provider.test.ts
|
| 87 |
+
+++ b/extensions/openai/image-generation-provider.test.ts
|
| 88 |
+
@@ -7,10 +7,14 @@ const {
|
| 89 |
+
isProviderApiKeyConfiguredMock,
|
| 90 |
+
listProfilesForProviderMock,
|
| 91 |
+
resolveApiKeyForProviderMock,
|
| 92 |
+
+ fetchWithTimeoutGuardedMock,
|
| 93 |
+
+ createProviderOperationDeadlineMock,
|
| 94 |
+
postJsonRequestMock,
|
| 95 |
+
postMultipartRequestMock,
|
| 96 |
+
assertOkOrThrowHttpErrorMock,
|
| 97 |
+
resolveProviderHttpRequestConfigMock,
|
| 98 |
+
+ resolveProviderOperationRemainingTimeoutMsMock,
|
| 99 |
+
+ resolveProviderOperationTimeoutMsMock,
|
| 100 |
+
sanitizeConfiguredModelProviderRequestMock,
|
| 101 |
+
logInfoMock,
|
| 102 |
+
} = vi.hoisted(() => ({
|
| 103 |
+
@@ -31,6 +35,11 @@ const {
|
| 104 |
+
apiKey: "openai-key",
|
| 105 |
+
}),
|
| 106 |
+
),
|
| 107 |
+
+ fetchWithTimeoutGuardedMock: vi.fn(),
|
| 108 |
+
+ createProviderOperationDeadlineMock: vi.fn((params: Record<string, unknown>) => ({
|
| 109 |
+
+ timeoutMs: params.timeoutMs,
|
| 110 |
+
+ label: params.label,
|
| 111 |
+
+ })),
|
| 112 |
+
postJsonRequestMock: vi.fn(),
|
| 113 |
+
postMultipartRequestMock: vi.fn(),
|
| 114 |
+
assertOkOrThrowHttpErrorMock: vi.fn(async () => {}),
|
| 115 |
+
@@ -46,6 +55,14 @@ const {
|
| 116 |
+
dispatcherPolicy: undefined,
|
| 117 |
+
};
|
| 118 |
+
}),
|
| 119 |
+
+ resolveProviderOperationTimeoutMsMock: vi.fn(
|
| 120 |
+
+ (params: { deadline: { timeoutMs?: number }; defaultTimeoutMs: number }) =>
|
| 121 |
+
+ params.deadline.timeoutMs ?? params.defaultTimeoutMs,
|
| 122 |
+
+ ),
|
| 123 |
+
+ resolveProviderOperationRemainingTimeoutMsMock: vi.fn(
|
| 124 |
+
+ (params: { deadline: { timeoutMs?: number }; defaultTimeoutMs: number }) =>
|
| 125 |
+
+ params.deadline.timeoutMs ?? params.defaultTimeoutMs,
|
| 126 |
+
+ ),
|
| 127 |
+
sanitizeConfiguredMo
|
| 128 |
+
|
| 129 |
+
[file diff truncated: 7408 characters omitted]
|
| 130 |
+
|
| 131 |
+
await expect(
|
| 132 |
+
+ provider.generateImage({
|
| 133 |
+
+ provider: "openai",
|
| 134 |
+
+ model: "gpt-image-2",
|
| 135 |
+
+ prompt: "test",
|
| 136 |
+
+ cfg: { agents: { defaults: { mediaMaxMb: 1 / (1024 * 1024) } } },
|
| 137 |
+
+ }),
|
| 138 |
+
+ ).rejects.toThrow("OpenAI image URL download exceeded 1 bytes");
|
| 139 |
+
+ expect(requestRelease).toHaveBeenCalledOnce();
|
| 140 |
+
+ expect(downloadRelease).toHaveBeenCalledOnce();
|
| 141 |
+
+ });
|
| 142 |
+
+
|
| 143 |
+
it("wraps malformed successful OpenAI image responses", async () => {
|
| 144 |
+
postJsonRequestMock.mockResolvedValue({
|
| 145 |
+
response: { json: async () => ({ data: { b64_json: "not-an-array" } }) },
|
| 146 |
+
|
| 147 |
+
diff --git a/extensions/openai/image-generation-provider.ts b/extensions/openai/image-generation-provider.ts
|
| 148 |
+
index 4b0e64bd66c7b..f871d62a446bc 100644
|
| 149 |
+
--- a/extensions/openai/image-generation-provider.ts
|
| 150 |
+
+++ b/extensions/openai/image
|
| 151 |
+
|
| 152 |
+
[file diff truncated: 6036 characters omitted]
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
|
| 157 |
+
index 09f3aa93f0970..65a0f47250cf3 100644
|
| 158 |
+
--- a/pnpm-lock.yaml
|
| 159 |
+
+++ b/pnpm-lock.yaml
|
| 160 |
+
@@ -274,6 +274,9 @@ importers:
|
| 161 |
+
lit:
|
| 162 |
+
specifier: 3.3.3
|
| 163 |
+
version: 3.3.3
|
| 164 |
+
+ node-llama-cpp:
|
| 165 |
+
+ specifier: ^3.18.1
|
| 166 |
+
+ version: 3.18.1(typescript@6.0.3)
|
| 167 |
+
oxfmt:
|
| 168 |
+
specifier: 0.52.0
|
| 169 |
+
version: 0.52.0
|
| 170 |
+
@@ -1942,7 +1945,7 @@ importers:
|
| 171 |
+
version: 14.1.2
|
| 172 |
+
'@vitest/browser-playwright':
|
| 173 |
+
specifier: 4.1.7
|
| 174 |
+
- version: 4.1.7(playwright@1.60.0)(vite@8.0.14(@types/node@25.9.2)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)(yaml@2.9.0))(vitest@4.1.7)
|
| 175 |
+
+ version: 4.1.7(playwright@1.60.0)(vite@8.0.14(@types/node@25.9.1)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.3)(yaml@2.9.0))(vitest@4.1.7)
|
| 176 |
+
jsdom:
|
| 177 |
+
specifier: 29.1.1
|
| 178 |
+
version: 29.1.1(@noble/hashes@2.0.1)
|
| 179 |
+
@@ -1951,10 +1954,10 @@ importers:
|
| 180 |
+
version: 1.60.0
|
| 181 |
+
vite:
|
| 182 |
+
specifier: 8.0.14
|
| 183 |
+
- version: 8.0.14(@types/node@25.9.2)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)(yaml@2.9.0)
|
| 184 |
+
+ version: 8.0.14(@types/node@25.9.1)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.3)(yaml@2.9.0)
|
| 185 |
+
vitest:
|
| 186 |
+
specifier: 4.1.7
|
| 187 |
+
- version: 4.1.7(@opentelemetry/api@1.9.1)(@types/node@25.9.2)(@vitest/browser-playwright@4.1.7)(@vitest/coverage-v8@4.1.7)(jsdom@29.1.1(@noble/hashes@2.0.1))(vite@8.0.14(@types/node@25.9.2)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)(yaml@2.9.0))
|
| 188 |
+
+ version: 4.1.7(@opentelemetry/api@1.9.1)(@types/node@25.9.1)(@vitest/browser-playwright@4.1.7)(@vitest/coverage-v8@4.1.7)(jsdom@29.1.1(@noble/hashes@2.0.1))(vite@8.0.14(@types/node@25.9.1)(esbuild@0.28.1)(jiti@2
|
| 189 |
+
|
| 190 |
+
[file diff truncated: 100450 characters omitted]
|
| 191 |
+
|
| 192 |
+
.9.2
|
| 193 |
+
- '@vitest/browser-playwright': 4.1.7(playwright@1.60.0)(vite@8.0.14(@types/node@25.9.2)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.22.4)(yaml@2.9.0))(vitest@4.1.7)
|
| 194 |
+
- '@vitest/coverage-v8': 4.1.7(@vitest/browser@4.1.7)(vitest@4.1.7)
|
| 195 |
+
- jsdom: 29.1.1(@noble/hashes@2.0.1)
|
| 196 |
+
- transitivePeerDependencies:
|
| 197 |
+
- - msw
|
| 198 |
+
-
|
| 199 |
+
void-elements@3.1.0: {}
|
| 200 |
+
|
| 201 |
+
vscode-jsonrpc@8.2.1: {}
|
| 202 |
+
@@ -14008,7 +14073,7 @@ snapshots:
|
| 203 |
+
form-data: 2.5.4
|
| 204 |
+
json-bigint: 1.0.0
|
| 205 |
+
pako: 2.1.0
|
| 206 |
+
- semver: 7.8.2
|
| 207 |
+
+ semver: 7.8.1
|
| 208 |
+
spark-md5: 3.0.2
|
| 209 |
+
tough-cookie: 4.1.3
|
| 210 |
+
ws: 8.21.0
|
| 211 |
+
|
| 212 |
+
diff --git a/src/gateway/server-cr
|
| 213 |
+
|
| 214 |
+
[file diff truncated: 799 characters omitted]
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
[diff truncated from 173937 characters to selected relevant excerpts]
|
| 219 |
+
```
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/contexts/openclaw-openclaw-84509.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GitHub item:
|
| 2 |
+
- Repository: openclaw/openclaw
|
| 3 |
+
- Type: github_pr
|
| 4 |
+
- Number: 84509
|
| 5 |
+
- URL: https://github.com/openclaw/openclaw/pull/84509
|
| 6 |
+
- Title: fix(acp): preserve pre-tool text in final_only delivery mode
|
| 7 |
+
- State: closed
|
| 8 |
+
- Author: Jerry-Xin
|
| 9 |
+
- Labels: size: S, proof: supplied, proof: sufficient, P2, rating: 🐚 platinum hermit, merge-risk: 🚨 automation, merge-risk: 🚨 message-delivery, status: 👀 ready for maintainer look
|
| 10 |
+
- Changed files: src/auto-reply/reply/acp-projector.test.ts, src/auto-reply/reply/acp-projector.ts
|
| 11 |
+
|
| 12 |
+
Body (truncated):
|
| 13 |
+
```markdown
|
| 14 |
+
## Summary
|
| 15 |
+
|
| 16 |
+
In `final_only` delivery mode (used by Feishu, QQ Bot, and other channels that prefer a single consolidated reply), text output that precedes tool calls within the same turn is lost. Only the post-tool final response reaches the user.
|
| 17 |
+
|
| 18 |
+
**Root cause**: In `acp-projector.ts`, the `onEvent` handler calls `flush(true)` + `resetTurnState()` on every `done` event, including intermediate ones (e.g. `stopReason=toolUse`). This prematurely delivers accumulated text and then clears the `finalOnlyOutputText` buffer. When the model outputs more text after tool execution, it arrives as a separate "final" delivery — and channels like Feishu that replace the previous card only show the last one.
|
| 19 |
+
|
| 20 |
+
**Fix**: In `final_only` mode, intermediate `done` events now call `resetTurnState({ preserveAccumulated: true })`, which resets per-completion state (timers, dedup hashes, pipelines) but preserves all turn-scoped accumulated state:
|
| 21 |
+
- `finalOnlyOutputText` and `pendingToolDeliveries` — the text/tool content being assembled
|
| 22 |
+
- `emittedOutputChars` and `truncationNoticeEmitted` — output limit enforcement across the entire turn
|
| 23 |
+
- `pendingHiddenBoundary` and `lastVisibleOutputTail` — hidden-boundary separator state for correct paragraph breaks after hidden tool calls
|
| 24 |
+
|
| 25 |
+
The turn-level `flush(true)` in `dispatch-acp.ts` delivers everything as one combined message after the entire turn completes.
|
| 26 |
+
|
| 27 |
+
Fixes #84486.
|
| 28 |
+
Also related to #84491.
|
| 29 |
+
|
| 30 |
+
## Changes
|
| 31 |
+
|
| 32 |
+
- `src/auto-reply/reply/acp-projector.ts` — Parameterized `resetTurnState()` with `preserveAccumulated` option; `final_only` + `done` now uses partial reset preserving all accumulated turn state
|
| 33 |
+
- `src/auto-reply/reply/acp-projector.test.ts` — 5 new tests + 1 updated existing test
|
| 34 |
+
|
| 35 |
+
##
|
| 36 |
+
|
| 37 |
+
[body truncated: 6877 characters omitted]
|
| 38 |
+
|
| 39 |
+
mode, **both texts were delivered as a single consolidated SSE stream** — no premature flush, no split messages
|
| 40 |
+
4. **On unpatched `upstream/main`**: the intermediate `done` event after the first completion (stopReason=toolUse) would have called `flush(true)` + `resetTurnState()`, delivering "I'll run that command now." as a premature `kind="final"` delivery and clearing the buffer. The post-tool text would arrive as a second "final" delivery. Channels like Feishu that replace the previous card would only show the last message, losing the pre-tool text entirely.
|
| 41 |
+
|
| 42 |
+
### Cleanup
|
| 43 |
+
|
| 44 |
+
```bash
|
| 45 |
+
docker rm -f openclaw-test-84486
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
Comments/context (truncated):
|
| 51 |
+
```markdown
|
| 52 |
+
- Jerry-Xin at 2026-05-20T08:39:06Z:
|
| 53 |
+
## Real behavior proof
|
| 54 |
+
|
| 55 |
+
- **Behavior or issue addressed**: In `final_only` delivery mode, text output before tool calls within a multi-step agentic turn is lost because `flush(true)` + `resetTurnState()` fires on intermediate `done` events, prematurely delivering and then clearing the `finalOnlyOutputText` buffer.
|
| 56 |
+
|
| 57 |
+
- **Real environment tested**: Local patched OpenClaw checkout at `6af59ccb95`, macOS arm64, Node.js `v24.10.0`.
|
| 58 |
+
|
| 59 |
+
- **Failing proof before fix**: Applied the new test assertions to unpatched `upstream/main` projector code. Two tests fail, confirming the bug:
|
| 60 |
+
|
| 61 |
+
```
|
| 62 |
+
❯ src/auto-reply/reply/acp-projector.test.ts > createAcpReplyProjector > supports deliveryMode=final_only by buffering all projected output until done
|
| 63 |
+
AssertionError: expected [ { kind: 'tool', …(1) }, …(2) ] to strictly equal []
|
| 64 |
+
→ On main, the projector delivers text+tools immediately on the intermediate "done"
|
| 65 |
+
event instead of deferring to the turn-level flush.
|
| 66 |
+
|
| 67 |
+
❯ src/auto-reply/reply/acp-projector.test.t
|
| 68 |
+
|
| 69 |
+
[comments/context truncated: 20038 characters omitted]
|
| 70 |
+
|
| 71 |
+
->
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
- clawsweeper[bot] at 2026-05-23T02:36:03Z:
|
| 75 |
+
ClawSweeper applied the proposed close for this PR.
|
| 76 |
+
|
| 77 |
+
- Action: closed this PR.
|
| 78 |
+
- Close reason: duplicate or superseded.
|
| 79 |
+
- Evidence: [durable ClawSweeper review](https://github.com/openclaw/openclaw/pull/84509#issuecomment-4496333044).
|
| 80 |
+
|
| 81 |
+
<!-- clawsweeper-close-applied item=84509 -->
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
Diff/context (selected/truncated):
|
| 85 |
+
```diff
|
| 86 |
+
diff --git a/src/auto-reply/reply/acp-projector.test.ts b/src/auto-reply/reply/acp-projector.test.ts
|
| 87 |
+
index 78d1f9f548a2a..13adbd3f5e777 100644
|
| 88 |
+
--- a/src/auto-reply/reply/acp-projector.test.ts
|
| 89 |
+
+++ b/src/auto-reply/reply/acp-projector.test.ts
|
| 90 |
+
@@ -364,6 +364,9 @@ describe("createAcpReplyProjector", () => {
|
| 91 |
+
expect(deliveries).toStrictEqual([]);
|
| 92 |
+
|
| 93 |
+
await projector.onEvent({ type: "done" });
|
| 94 |
+
+ expect(deliveries).toStrictEqual([]);
|
| 95 |
+
+
|
| 96 |
+
+ await projector.flush(true);
|
| 97 |
+
expect(deliveries).toHaveLength(3);
|
| 98 |
+
expect(deliveries[0]).toEqual({
|
| 99 |
+
kind: "tool",
|
| 100 |
+
@@ -769,4 +772,156 @@ describe("createAcpReplyProjector", () => {
|
| 101 |
+
|
| 102 |
+
expect(combinedBlockText(deliveries)).toBe("AB");
|
| 103 |
+
});
|
| 104 |
+
+
|
| 105 |
+
+ describe("final_only multi-completion accumulation", () => {
|
| 106 |
+
+ it("accumulates text across intermediate done events in final_only mode", async () => {
|
| 107 |
+
+ const { deliveries, projector } = createFinalOnlyStatusToolHarness();
|
| 108 |
+
+
|
| 109 |
+
+ await projector.onEvent({
|
| 110 |
+
+ type: "text_delta",
|
| 111 |
+
+ text: "Searching...",
|
| 112 |
+
+ tag: "agent_message_chunk",
|
| 113 |
+
+ });
|
| 114 |
+
+ await projector.onEvent({ type: "done" });
|
| 115 |
+
+ expect(deliveries).toStrictEqual([]);
|
| 116 |
+
+
|
| 117 |
+
+ await projector.onEvent({
|
| 118 |
+
+ type: "text_delta",
|
| 119 |
+
+ text: "Results: found 3 items",
|
| 120 |
+
+ tag: "agent_message_chunk",
|
| 121 |
+
+ });
|
| 122 |
+
+ await projector.onEvent({ type: "done" });
|
| 123 |
+
+ expect(deliveries).toStrictEqual([]);
|
| 124 |
+
+
|
| 125 |
+
+ await projector.flush(true);
|
| 126 |
+
+ const finals = deliveries.filter((d) => d.kind === "final");
|
| 127 |
+
+ expect(finals).toHaveLength(1);
|
| 128 |
+
+ expect(finals[0]!.text).toBe("Searching...Results: found 3 items");
|
| 129 |
+
+ });
|
| 130 |
+
+
|
| 131 |
+
+ it("flushes text
|
| 132 |
+
|
| 133 |
+
[file diff truncated: 3611 characters omitted]
|
| 134 |
+
|
| 135 |
+
ent({
|
| 136 |
+
+ type: "text_delta",
|
| 137 |
+
+ text: "After tool.",
|
| 138 |
+
+ tag: "agent_message_chunk",
|
| 139 |
+
+ });
|
| 140 |
+
+ await projector.onEvent({ type: "done" });
|
| 141 |
+
+
|
| 142 |
+
+ await projector.flush(true);
|
| 143 |
+
+ const finals = deliveries.filter((d) => d.kind === "final");
|
| 144 |
+
+ expect(finals).toHaveLength(1);
|
| 145 |
+
+ // Should contain a paragraph separator (\n\n) between the two text segments
|
| 146 |
+
+ expect(finals[0]!.text).toContain("Before tool.");
|
| 147 |
+
+ expect(finals[0]!.text).toContain("After tool.");
|
| 148 |
+
+ expect(finals[0]!.text).toMatch(/Before tool\.\n\nAfter tool\./);
|
| 149 |
+
+ });
|
| 150 |
+
+ });
|
| 151 |
+
});
|
| 152 |
+
|
| 153 |
+
diff --git a/src/auto-reply/reply/acp-projector.ts b/src/auto-reply/reply/acp-projector.ts
|
| 154 |
+
index 3b919a2b3d462..e405c48707cc5 100644
|
| 155 |
+
--- a/src/auto-reply/reply/acp-projector.ts
|
| 156 |
+
+++ b/src/auto-reply/reply/acp-projector.ts
|
| 157 |
+
@@ -261,21 +261,23 @@ export function createAcpReplyProjector(params: {
|
| 158 |
+
}, liveIdleFlushMs);
|
| 159 |
+
};
|
| 160 |
+
|
| 161 |
+
- const resetTurnState = () => {
|
| 162 |
+
+ const resetTurnState = (opts?: { preserveAccumulated?: boolean }) => {
|
| 163 |
+
clearLiveIdleTimer();
|
| 164 |
+
blockReplyPipeline.stop();
|
| 165 |
+
blockReplyPipeline = createTurnBlockReplyPipeline();
|
| 166 |
+
- emittedOutputChars = 0;
|
| 167 |
+
- truncationNoticeEmitted = false;
|
| 168 |
+
lastStatusHash = undefined;
|
| 169 |
+
lastToolHash = undefined;
|
| 170 |
+
lastUsageTuple = undefined;
|
| 171 |
+
- lastVisibleOutputTail = undefined;
|
| 172 |
+
- pendingHiddenBoundary = false;
|
| 173 |
+
liveBufferText = "";
|
| 174 |
+
- finalOnlyOutputText = "";
|
| 175 |
+
- pendingToolDeliveries.length = 0;
|
| 176 |
+
toolLifecycleById.clear();
|
| 177 |
+
+ if (!opts?.preserveAccumulated) {
|
| 178 |
+
+ emittedOutputChars = 0;
|
| 179 |
+
+ truncationNoticeEmitted = false;
|
| 180 |
+
+ lastVisibleOutputTail = undefined;
|
| 181 |
+
+ pendingHiddenBoundary = false;
|
| 182 |
+
+ finalOnlyOutputText = "";
|
| 183 |
+
+ pendingToolDeliveries.length = 0;
|
| 184 |
+
+ }
|
| 185 |
+
};
|
| 186 |
+
|
| 187 |
+
const flushBufferedToolDeliveries = async (force: boolean) => {
|
| 188 |
+
@@ -498,8 +500,15 @@ export function createAcpReplyProjector(params: {
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
if (event.type === "done" || event.type === "error") {
|
| 192 |
+
- await flush(true);
|
| 193 |
+
- resetTurnState();
|
| 194 |
+
+ if (settings.deliveryMode === "final_only" && event.type === "done") {
|
| 195 |
+
+ // In final_only mode, skip flush on intermediate "done" events.
|
| 196 |
+
+ // Text keeps accumulating in finalOnlyOutputText across completions;
|
| 197 |
+
+ // the turn-level flush(true) in dispatch-acp.ts delivers everything.
|
| 198 |
+
+ resetTurnState({ preserveAccumulated: true });
|
| 199 |
+
+ } else {
|
| 200 |
+
+ await flush(true);
|
| 201 |
+
+ resetTurnState();
|
| 202 |
+
+ }
|
| 203 |
+
}
|
| 204 |
+
};
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
[diff truncated from 7810 characters to selected relevant excerpts]
|
| 209 |
+
```
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-52126.stderr.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
prompt: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/baseline__openclaw-openclaw-52126/prompts/20260615T163133Z-1757014.md
|
| 2 |
+
schema: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/baseline__openclaw-openclaw-52126/schemas/20260615T163133Z-1757014.json
|
| 3 |
+
session: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/baseline__openclaw-openclaw-52126/sessions/20260615T163133Z-1757014
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-52126.stdout.log
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"topics_of_interest": [
|
| 3 |
+
"coding_agents"
|
| 4 |
+
],
|
| 5 |
+
"description": "PR extends agent loop-detection to escalate repeated identical exec tool calls from warn-only to critical, preventing runaway shell command loops in the coding agent harness.",
|
| 6 |
+
"caveats": []
|
| 7 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-81443.stderr.log
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
prompt: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/baseline__openclaw-openclaw-81443/prompts/20260615T163049Z-1756523.md
|
| 2 |
+
schema: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/baseline__openclaw-openclaw-81443/schemas/20260615T163049Z-1756523.json
|
| 3 |
+
session: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/baseline__openclaw-openclaw-81443/sessions/20260615T163049Z-1756523
|
| 4 |
+
localpager-agent: final_json was not called; no structured output was captured
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-81443.stdout.log
ADDED
|
File without changes
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-84509.stderr.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
prompt: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/baseline__openclaw-openclaw-84509/prompts/20260615T163031Z-1756236.md
|
| 2 |
+
schema: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/baseline__openclaw-openclaw-84509/schemas/20260615T163031Z-1756236.json
|
| 3 |
+
session: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/baseline__openclaw-openclaw-84509/sessions/20260615T163031Z-1756236
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/baseline__openclaw-openclaw-84509.stdout.log
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"topics_of_interest": [
|
| 3 |
+
"acp"
|
| 4 |
+
],
|
| 5 |
+
"description": "PR fixes loss of pre-tool text in final_only delivery mode by preserving accumulated state across intermediate done events in the ACP projector.",
|
| 6 |
+
"caveats": []
|
| 7 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/explicit-bash-upper-bound__openclaw-openclaw-84509.stderr.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
prompt: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/explicit-bash-upper-bound__openclaw-openclaw-84509/prompts/20260615T163302Z-1758143.md
|
| 2 |
+
schema: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/explicit-bash-upper-bound__openclaw-openclaw-84509/schemas/20260615T163302Z-1758143.json
|
| 3 |
+
session: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/explicit-bash-upper-bound__openclaw-openclaw-84509/sessions/20260615T163302Z-1758143
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/explicit-bash-upper-bound__openclaw-openclaw-84509.stdout.log
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"topics_of_interest": [
|
| 3 |
+
"acp"
|
| 4 |
+
],
|
| 5 |
+
"description": "Fixes pre-tool text loss in final_only delivery mode by preserving accumulated turn state across intermediate done events in the ACP projector.",
|
| 6 |
+
"caveats": []
|
| 7 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/hard-source-gate__openclaw-openclaw-52126.stderr.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
prompt: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/hard-source-gate__openclaw-openclaw-52126/prompts/20260615T163244Z-1757918.md
|
| 2 |
+
schema: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/hard-source-gate__openclaw-openclaw-52126/schemas/20260615T163244Z-1757918.json
|
| 3 |
+
session: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/hard-source-gate__openclaw-openclaw-52126/sessions/20260615T163244Z-1757918
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/hard-source-gate__openclaw-openclaw-52126.stdout.log
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"topics_of_interest": [
|
| 3 |
+
"coding_agents"
|
| 4 |
+
],
|
| 5 |
+
"description": "PR extends tool-loop-detection to escalate repeated identical exec calls to critical alerts, filling a gap where the generic repeat detector was warn-only for non-poll tools.",
|
| 6 |
+
"caveats": []
|
| 7 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/hard-source-gate__openclaw-openclaw-81443.stderr.log
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
prompt: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/hard-source-gate__openclaw-openclaw-81443/prompts/20260615T163220Z-1757632.md
|
| 2 |
+
schema: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/hard-source-gate__openclaw-openclaw-81443/schemas/20260615T163220Z-1757632.json
|
| 3 |
+
session: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/hard-source-gate__openclaw-openclaw-81443/sessions/20260615T163220Z-1757632
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/hard-source-gate__openclaw-openclaw-81443.stdout.log
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"topics_of_interest": [
|
| 3 |
+
"memory",
|
| 4 |
+
"security"
|
| 5 |
+
],
|
| 6 |
+
"description": "Fixes Windows QMD shim path resolution for memory-core availability and adds guarded HTTP downloads with MIME validation, bounded reads, and same-origin transport reuse for provider-returned image URLs.",
|
| 7 |
+
"caveats": []
|
| 8 |
+
}
|
experiments/reposhell-prompt-propensity/run-20260615T163031Z/logs/hard-source-gate__openclaw-openclaw-84509.stderr.log
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
prompt: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/hard-source-gate__openclaw-openclaw-84509/prompts/20260615T163149Z-1757253.md
|
| 2 |
+
schema: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/hard-source-gate__openclaw-openclaw-84509/schemas/20260615T163149Z-1757253.json
|
| 3 |
+
session: /home/bob/repos/scratch/experiments/reposhell-prompt-propensity/run-20260615T163031Z/state/hard-source-gate__openclaw-openclaw-84509/sessions/20260615T163149Z-1757253
|
| 4 |
+
localpager-agent: final_json was not called; no structured output was captured
|